commit d9766f43e82d8e7c3b422edce2f3c594c3c5d254 Author: JayJiaJun Date: Mon Dec 9 14:16:57 2024 +0800 12.9 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6184d91 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# Build Tools +unpackage/* +!unpackage/res +node_modules/* + + +# Development Tools +.idea +.vscode +.hbuilderx/* + +package-lock.json +yarn.lock +.DS_Store diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..44241b6 --- /dev/null +++ b/App.vue @@ -0,0 +1,128 @@ + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e9acb16 --- /dev/null +++ b/README.md @@ -0,0 +1,124 @@ +### 请勿随意分发和转售 + +|微信小程序|安卓|IOS|H5|Vue2| +|:---:|:---:|:---:|:---:|:---:| +|√|√|√|√|√| + + +### 一、项目介绍 +1. 项目使用uniapp开发,适配微信小程序、安卓、IOS和H5,其他平台未测试。 +2. UI框架使用uView2.0。 +3. 组件使用easycom模式,只要组件安装在项目的components目录下或uni_modules目录下,并符合components/组件名称/组件名称.vue目录结构。就可以不用引用、注册,直接在页面中使用。 +4. 开发工具为Hbuilder3.3以上版本。 +5. 近期在开发项目升级过程中会逐步优化项目结构,由于旧代码比较庞大需要很多时间优化,所以项目结构目录这块暂时没有更新,希望谅解。 + + +### 二、项目结构 + +``` +├─apis // 接口管理 +│ ├─modules // api模块化目录 +│ │ └─device.js // 设备接口地址 +│ ├─http.api.js // 接口定义文件 +│ └─http.interceptor // 拦截器 +├─common // 公共文件 +│ ├─mqttTool // mqtt工具 +│ ├─extend // 扩展原型方法 +│ ├─filters // 全局过滤器 +│ └─tools // 全局公共方法 +├─components // 项目组件库,组件放置这里,其他页面可直接使用 +│ ├─cl-test // easycom测试组件 +│ ├─cl-icon // iconfont图标组件 +│ ├─deviceMonitor // 设备实时监测组件 +│ └─other... // 使用的其他组件等等 +├─pages // 页面目录 +│ ├─public // 公共页面 +│ └─tarbar // 底部导航栏页面 +│ ├─home // 首页的所有页面 +│ ├─scene // 场景联动页面 +│ ├─trend // 新闻动态页面 +│ └─user // 个人中心页面 +├─static // 图片目录 +├─store // vuex +│ ├─$u.mixin // store全局混入方法 +│ └─index // vuex 组件全局状态管理 +├─uni_modules // 插件市场插件目录 +│ └─uview-ui // uview-ui +├─env.config.js // 接口地址和mqtt地址配置文件 +├─mainfest.json // 各个平台的配置信息 +``` + +### 三、基本配置 +1. 打开根目录的mainfest.json文件, 基础配置中 AppId改为自己的 [uni-app应用标识](https://ask.dcloud.net.cn/article/35907),微信小程序配置中,AppId改为自己的 [微信小程序AppId](https://mp.weixin.qq.com/) 。 + +2. 打开根目录的 `env.config.js` 文件,修改服务端接口地址和emqx消息服务器地址 +``` + // H5端开发和生产环境协议 + let protocalDev = "ws://"; + let protocalProd = "wss://"; + + // 条件编译,微信端和App端使用wxs协议 + // #ifdef MP-WEIXIN || APP-PLUS + protocalDev = 'wxs://'; + protocalProd = 'wxs://'; + // #endif + + const CONFIG = { + // 开发环境配置 + development: { + baseUrl: 'http://localhost:8080', + mqttServer: protocalDev + 'localhost:8083/mqtt', + }, + // 生产环境配置 + production: { + baseUrl: 'https://domain.com/prod-api/', + mqttServer: protocalProd + 'domain.com/mqtt', + } + } +``` + +* 小程序调用接口必须使用https协议,可以去阿里、腾讯、百度等平台申请免费证书,Nginx配置https和wss参考 [官网文档](https://fastbee.cn/doc/pages/applet/) +* H5端使用ws(未加密)或者wss(加密)协议 +* 微信小程序和App端使用wxs协议,同时需要配置域名,App端使用wss连接失败,可能跟mqtt.js版本有关系。 + +### 四、Mqtt协议 +|协议 |一般使用端口 |说明 | +|:-----|:----------|:------------------| +| mqtt | 1883端口 | 未加密 TCP 连接,硬件端和服务端使用| +| mqtts| 8883端口 | 加密 TCP 连接,硬件端和服务端使用| +| ws | 8083端口 | 未加密 WebSocket 连接,前端和移动端使用| +| wss | 8084端口 | 加密 WebSocket 连接,前端和移动端使用,通过代理访问8083端口| +| wxs | 8084端口 | 微信小程序连接,微信小程序端使用,通过代理访问8083端口| +| alis | 8084端口 | 支付宝小程序连接,支付宝小程序端使用,通过代理访问8083端口| + +### 五、使用说明 +1. 项目使用uChart图表,部分图标启用canvas2d模式,解决小程序层级过高及拖拽卡顿问题。微信开发工具中图表显示会有问题,发布后正常显示。 +2. 微信小程序支持多设备配网,mainfest.json微信小程序配置中要启用位置接口才能使用。微信小程序端配网需要使用真机调试。 +3. 微信小程序视频需要向微信官方申请权限,Android 和 IOS 需要用Wap2App 方式打包,播放器暂时不支持原生App。 +4. 项目天气预报使用的是心知天气API需要自行前往官网申请(小程序配置心知天气域名),也可以使用其他天气API,但需要调整一下weather的数据(已自定义组件),由于某些浏览器原因,为保证H5正常运行,可以申请腾讯地图key来定位。 + +### 六、设备配网 / 扫码添加设备 +1. 有两种情况:第一种是系统不存在该设备,配网或扫码后会新建设备到用户账号下;第二种是系统已存在该设备,配网或扫码后是关联设备到用户账号下。 +2. 设备配网:通过配网可以把wifi信息配置到设备,以及新建设备到用户账号下。目前H5、微信小程序、安卓和IOS都支持单设备配网,多设备配网只有微信小程序支持。单设备配网时用户手动切换手机wifi为设备热点,然后进行配网。 +3. 扫码添加设备:用户通过扫码新建设备到自己账号下。系统中的每个设备都有二维码,在设备详情摘要中查看。二维码固定为下面JSON格式: +``` +# type固定值为1,代表扫码添加设备 +# type、deviceNumber、productId 为必填项,productName为可选项 +# 如果系统中还不存在该设备,设备编号使用一个唯一性编码即可,不能包含特殊字符 +{ + "type": 1, + "deviceNumber": "D888666", + "productId": 5, + "productName": "智能插座" +} +``` + +### 七、相关文档 +[uView2.0文档 >>](https://www.uviewui.com/components/intro.html)
+[uniapp文档 >>](https://uniapp.dcloud.io/tutorial/)
+[easycom说明 >>](https://uniapp.dcloud.io/component/#easycom%E7%BB%84%E4%BB%B6%E8%A7%84%E8%8C%83)
+[uChart2.0文档 >>](https://www.ucharts.cn/v2/#/guide/index)
+[Wap2App打包](https://code.wumei.live/ultimate/wumei-smart/-/wikis/Wap2App打包) + +### 八、项目运行 +运行前先跑 npm install 下载所需要的依赖包! diff --git a/apis/http.api.js b/apis/http.api.js new file mode 100644 index 0000000..8eade92 --- /dev/null +++ b/apis/http.api.js @@ -0,0 +1,30 @@ +import * as common from './modules/common.js'; +import * as account from './modules/account.js'; +import * as scene from './modules/scene.js'; +import * as group from './modules/group.js'; +import * as deviceUser from './modules/deviceUser.js'; +import * as deviceLog from './modules/deviceLog.js'; +import * as device from './modules/device.js'; +// const http = uni.$u.http; + +// api 接口管理 +const install = (Vue, vm) => { + + Vue.prototype.$api = { + // 登录 + // login:(params = {})=>http.post('/login',params), + + // import modules + common, + scene, + group, + deviceUser, + deviceLog, + device, + account + }; +} + +export default { + install +} \ No newline at end of file diff --git a/apis/http.interceptor.js b/apis/http.interceptor.js new file mode 100644 index 0000000..da6890e --- /dev/null +++ b/apis/http.interceptor.js @@ -0,0 +1,129 @@ +// common/http.interceptor.js + +import projectConfig from '@/env.config.js'; + +const codeMessage = { + 404: '您所请求的资源无法找到', + 500: '服务器内部错误,无法完成请求', +}; + +const install = (Vue, vm) => { + // 这个配置是一次配置,全局通用的,具体参数见 https://www.uviewui.com/js/http.html + uni.$u.http.setConfig((config) => { + // 域名设置 + config.baseURL = projectConfig.baseUrl; + // 全局header + config.header = {}; + // + config.method = ''; + // 设置为json,返回后会对数据进行一次JSON.parse() + config.dataType = 'json'; + // + config.responseType = 'text'; + // 注:如果局部custom与全局custom有同名属性,则后面的属性会覆盖前面的属性,相当于Object.assign(全局,局部) + config.custom = { + // 请求接口展示Loading + ShowLoading: true, + // Loading中是否遮罩 + LoadingMask: true, + // Loading文本 + LoadingText: '正在加载', + }; // 全局自定义参数默认值 + // #ifdef H5 || APP-PLUS || MP-ALIPAY || MP-WEIXIN + config.timeout = 60000; + // #endif + // #ifdef APP-PLUS + // 验证 ssl 证书 仅5+App安卓端支持(HBuilderX 2.3.3+) + config.sslVerify = true; + // #endif + // #ifdef H5 + // 跨域请求时是否携带凭证(cookies)仅H5支持(HBuilderX 2.6.15+) + config.withCredentials = false; + // #endif + // #ifdef APP-PLUS + // DNS解析时优先使用ipv4 仅 App-Android 支持 (HBuilderX 2.8.0+) + config.firstIpv4 = false; + // #endif + // 局部优先级高于全局,返回当前请求的task,options。请勿在此处修改options。非必填 + // getTask: (task, options) => { + // 相当于设置了请求超时时间500ms + // setTimeout(() => { + // task.abort() + // }, 500) + // }, + // 全局自定义验证器。参数为statusCode 且必存在,不用判断空情况。 + config.validateStatus = (statusCode) => { // statusCode 必存在。此处示例为全局默认配置 + return statusCode >= 200 && statusCode < 300 + }; + return config; + }); + + // 请求拦截部分,如配置,每次请求前都会执行 + uni.$u.http.interceptors.request.use((config) => { + config.header.language = uni.getLocale('lang'); + if (config.custom.ShowLoading) { + uni.showLoading({ + title: config.custom.LoadingText || '正在加载', + mask: config.custom.LoadingMask || false + }); + } + + // 引用token + // 方式一,存放在vuex的token,假设使用了uView封装的vuex方式 + // 见:https://uviewui.com/components/globalVariable.html + // config.header.token = vm.token; + + // 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取 + if (config.url != '/captchaImage' && config.url != '/login' && config.url != '/iot/tool/register') { + config.header.Authorization = 'Bearer ' + vm.$store.state.vuex_token; + } + + // 方式三,如果token放在了globalData,通过getApp().globalData获取 + // config.header.token = getApp().globalData.username; + + // 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的 + // 所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值 + // const token = uni.getStorageSync('token'); + // config.header.token = token; + // config.header.Token = 'xxxxxx'; + + // 可以对某个url进行特别处理,此url参数为this.$u.get(url)中的url值 + // if (config.url == '/pages/login') config.header.noToken = true; + // 最后需要将config进行return + return config; + // 如果return一个false值,则会取消本次请求 + // if(config.url == '/user/rest') return false; // 取消某次请求 + }) + + // 响应拦截,如配置,每次请求结束都会执行本方法 + uni.$u.http.interceptors.response.use((res) => { + if (res.config.custom.ShowLoading) { + uni.hideLoading(); + } + // if 状态码是否正常 + if (res.statusCode === 200) { + let result = res.data; + // if 与后台规定的成功码是否正常 + if (result.code === 200 || result.code === 500 || result.code === 450) { + return result + } else if (result.code == 401) { + // 本地缓存存储token + uni.setStorageSync('token', ''); + uni.reLaunch({ + url: '/pages/tabBar/home/index' + }); + return result + } else { + console.log(result); + vm.$u.toast(result.msg); + } + } else { + vm.$u.toast(res.data.msg); + } + return false; + }); +} + +export default { + install +} \ No newline at end of file diff --git a/apis/modules/account.js b/apis/modules/account.js new file mode 100644 index 0000000..165b5ba --- /dev/null +++ b/apis/modules/account.js @@ -0,0 +1,25 @@ +const http = uni.$u.http; + +import upload from '@/utils/upload' +//修改个人信息 +export function updateProfile(params) { + return http.put('/system/user/profile', params); +} + +//用户头像上传 +export function uploadAvatar(data) { + return upload({ + url: '/system/user/profile/avatar', + method: 'post', + name: data.name, + filePath: data.filePath + }) +} + +//用户密码重置 +export function updateUserPwd(oldPassword, newPassword) { + return http.request({ + url: '/system/user/profile/updatePwd?oldPassword=' + oldPassword + '&newPassword=' + newPassword, + method: 'put', + }) +} \ No newline at end of file diff --git a/apis/modules/alertLog.js b/apis/modules/alertLog.js new file mode 100644 index 0000000..abf1231 --- /dev/null +++ b/apis/modules/alertLog.js @@ -0,0 +1,32 @@ +const http = uni.$u.http; + +// 查询设备告警数据 +export function getAlertList (query) { + return http.request({ + url: '/iot/alertLog/list', + method: 'get', + params: query + }) +} + +// 查询单个设备告警详情 +export function getAlertLog (id) { + return http.get('/iot/alertLog/' + id); +} + +// 修改单个设备告警详情 +export function editAlertLog (data) { + return http.request({ + url: '/iot/alertLog', + method: 'put', + data: data + }) +} + +// 查询微信小程序告警通知模板id +export function getAlertTemplateId() { + return http.request({ + url: '/notify/template/getAlertWechatMini', + method: 'get', + }) +} \ No newline at end of file diff --git a/apis/modules/common.js b/apis/modules/common.js new file mode 100644 index 0000000..0c912e4 --- /dev/null +++ b/apis/modules/common.js @@ -0,0 +1,78 @@ +const http = uni.$u.http; + +// 查询所有产品列表 +export function listShortProduct () { + return http.get('/iot/product/shortList'); +} + +// 获取验证码 +export function captchaImage (showCode) { + return http.request({ + url: '/captchaImage?showCode='+ showCode, + method: 'get', + }) + + //return http.get('/captchaImage',params); +} + +// 获取用户信息 +export function getProfile () { + return http.get('/system/user/profile'); +} + +// 个人中心-微信绑定-app和小程序 +export function wechatBind (params) { + return http.post('/wechat/bind', params); +} + +//解除微信绑定 +export function secureBind (params) { + return http.post('/wechat/cancelBind', params); +} + +// 登录 +export function login (params) { + return http.post('/login', params); +} + +// 绑定登录 +export function bindLogin (params) { + return http.post('/auth/bind/login', params); +} + +// 绑定注册 +export function bindRegister (params) { + return http.post('/auth/bind/register', params); +} +//获取短信验证码 +export function getSmsCode (phoneNumber) { + return http.request({ + url: '/notify/smsLoginCaptcha?phoneNumber=' + phoneNumber, + method: 'get', + }) +} +//短信登录 +export function smsLogin (params) { + return http.post('/auth/sms/login', params); +} +// 退出登录 +export function logout () { + return http.post('/logout'); +} + +// 注册方法 +export function register (params) { + return http.post('/iot/tool/register', params); +} + +// 查询用户列表 +export function listUser (params) { + return http.get('/iot/tool/userList', { + params: params + }); +} + +// 注销账号 +export function unsubscribe () { + return http.post('/unsubscribe'); +} \ No newline at end of file diff --git a/apis/modules/device.js b/apis/modules/device.js new file mode 100644 index 0000000..48ab4ef --- /dev/null +++ b/apis/modules/device.js @@ -0,0 +1,123 @@ +const http = uni.$u.http; + +// 查询设备简短列表 +export function listDeviceShort(params) { + return http.get('/iot/device/shortList', { + params: params + }); +} + +// 查询设备详细 +export function getDevice(deviceId) { + return http.get('/iot/device/' + deviceId); +} + +// 设备数据同步 +export function deviceSynchronization(serialNumber) { + return http.get('/iot/device/synchronization/' + serialNumber); +} + +// 查询设备运行状态详细 +export function getRunningStatus(deviceId, slaveId, type, productId, serialNumber) { + let params = { + deviceId: deviceId, + slaveId: slaveId, + type: type, + productId: productId, + serialNumber: serialNumber, + + }; + return http.get('/iot/device/runningStatus', { + params: params + }); +} + +// 查询设备物模型的值 +export function getDeviceThingsModelValue(deviceId) { + return http.get('/iot/device/thingsModelValue/' + deviceId); +} + +// 根据产品ID获取缓存的物模型 +export function cacheJsonThingsModel(productId) { + return http.get('/iot/model/cache/' + productId, { + custom: { + ShowLoading: false + } + }); +} + +// 根据产品ID获取缓存的物模型 +export function getCacheThingsModel(productId) { + return http.get('/iot/model/cache/' + productId); +} + +// 修改设备 +export function updateDevice(data) { + return http.put('/iot/device', data) +} + +// 用户关联设备 +export function deviceRelateUser(data) { + return http.post('/iot/device/relateUser', data) +} + +// 删除设备 +export function delDevice(deviceId) { + return http.delete('/iot/device/' + deviceId); +} + +// 查询设备最新固件 +export function getLatestFirmware(deviceId) { + return http.get('/iot/firmware/getLatest/' + deviceId); +} + +// 查询分组可添加设备分页列表 +export function listDeviceByGroup(query) { + return http.get('/iot/device/listByGroup', { + params: query + }) +} + +// 查询设备绑定的视频通道列表 +export function relateChannelList(deviceId) { + return http.get('/iot/relation/dev/' + deviceId); +} + +// 查询设备变量概况 +export function listThingsModel(data) { + return http.get('/iot/device/listThingsModel', { + params: data + }) +} +// 查询指令权限 +export function getOrderControl(params) { + return http.request({ + url: '/order/control/get', + method: 'get', + params: params + }) +} +//主动采集 +export function propGet(params) { + return http.request({ + url: '/iot/runtime/prop/get', + method: 'get', + params: params, + }); +} +//告警记录列表 +export function listAlertLog(params) { + return http.request({ + url: '/iot/alertLog/list', + method: 'get', + params: params, + }); +} +//服务调用,等待设备响应 +export function serviceInvokeReply(data) { + return http.request({ + url: '/iot/runtime/service/invokeReply', + method: 'post', + data: data, + }); +} \ No newline at end of file diff --git a/apis/modules/deviceLog.js b/apis/modules/deviceLog.js new file mode 100644 index 0000000..0f74e06 --- /dev/null +++ b/apis/modules/deviceLog.js @@ -0,0 +1,74 @@ +const http = uni.$u.http; + +// 查询设备日志列表 +export function listDeviceLog (query) { + return http.request({ + url: '/iot/deviceLog/list', + method: 'get', + params: query + }) +} + +// 查询事件日志列表 +export function getEventLogList (query) { + return http.request({ + url: '/iot/event/list', + method: 'get', + params: query + }) +} + +// 查询设备监测数据 +export function listMonitor (query) { + return http.request({ + url: '/iot/deviceLog/monitor', + method: 'get', + params: query + }) +} + +// 查询设备历史监测数据 +export function getDeviceHistory (params) { + return http.get('/iot/deviceLog/history', { params: params }); +} +//查询历史监测数据 +export function getHistoryList (data) { + return http.request({ + url: '/data/center/deviceHistory', + method: 'post', + data: data, + }) +} +// 查询设备日志详细 +export function getDeviceLog (logId) { + return http.request({ + url: '/iot/deviceLog/' + logId, + method: 'get' + }) +} + +// 新增设备日志 +export function addDeviceLog (data) { + return http.request({ + url: '/iot/deviceLog', + method: 'post', + data: data + }) +} + +// 修改设备日志 +export function updateDeviceLog (data) { + return http.request({ + url: '/iot/deviceLog', + method: 'put', + data: data + }) +} + +// 删除设备日志 +export function delDeviceLog (logId) { + return http.request({ + url: '/iot/deviceLog/' + logId, + method: 'delete' + }) +} \ No newline at end of file diff --git a/apis/modules/deviceUser.js b/apis/modules/deviceUser.js new file mode 100644 index 0000000..6c4de0f --- /dev/null +++ b/apis/modules/deviceUser.js @@ -0,0 +1,31 @@ +const http = uni.$u.http; + +// 查询设备用户详细 +export function getDeviceUser (deviceId) { + return http.get('/iot/deviceUser/' + deviceId) +} + +// 新增设备用户 +export function addDeviceUser (data) { + return http.post('/iot/share', data); +} + +// 修改设备用户 +export function updateDeviceUser (data) { + return http.put('/iot/share', data) +} + +// 删除设备用户 +export function delDeviceUser (device) { + return http.delete('/iot/share', device) +} + +// 查询可分享用户列表 +export function getShareUser (data) { + return http.get('/iot/share/shareUser', { params: data }); +} + +// 查询已经分享用户列表 +export function getUserList (params) { + return http.get('/iot/share/list', { params: params }); +} \ No newline at end of file diff --git a/apis/modules/gateway.js b/apis/modules/gateway.js new file mode 100644 index 0000000..0194027 --- /dev/null +++ b/apis/modules/gateway.js @@ -0,0 +1,8 @@ +const http = uni.$u.http; + +// 查询设备简短列表 +export function getSubGatewayList (query) { + return http.get('/sub/gateway/list', { + params: query + }); +} \ No newline at end of file diff --git a/apis/modules/group.js b/apis/modules/group.js new file mode 100644 index 0000000..7687619 --- /dev/null +++ b/apis/modules/group.js @@ -0,0 +1,58 @@ +const http = uni.$u.http; + +// 获取设备分组列表 +export function getGroupList (query) { + return http.request({ + url: '/iot/group/list', + method: 'get', + params: query + }) +} + +// 查询设备分组详细 +export function getGroup (groupId) { + return http.request({ + url: '/iot/group/' + groupId, + method: 'get' + }) +} + +// 新增设备分组 +export function addGroup (data) { + return http.request({ + url: '/iot/group', + method: 'post', + data: data + }) +} + +// 修改设备分组 +export function updateGroup (data) { + return http.request({ + url: '/iot/group', + method: 'put', + data: data + }) +} + +// 更新分组下的设备 +export function updateDeviceGroups (data) { + return http.request({ + url: '/iot/group/updateDeviceGroups', + method: 'put', + data: data + }) +} + +// 删除设备分组 +export function delGroup (groupId) { + return http.request({ + url: '/iot/group/' + groupId, + method: 'delete' + }) +} + +// 查询分组下的关联设备ID数组 +export function getDeviceIds (groupId) { + return http.get('/iot/group/getDeviceIds/' + groupId); +} \ No newline at end of file diff --git a/apis/modules/job.js b/apis/modules/job.js new file mode 100644 index 0000000..74bb6c0 --- /dev/null +++ b/apis/modules/job.js @@ -0,0 +1,62 @@ +const http = uni.$u.http; + +// 查询定时任务调度列表 +export function getJobList (query) { + return http.request({ + url: '/iot/job/list', + method: 'get', + data: query + }) +} + +// 定时任务立即执行一次 +export function runJob (data) { + return http.request({ + url: '/iot/job/run', + method: 'put', + data: data + }) +} + +// 任务状态修改 +export function changeJobStatus (data) { + return http.request({ + url: '/iot/job/changeStatus', + method: 'put', + data: data + }) +} + +// 新增定时任务调度 +export function addJob (data) { + return http.request({ + url: '/iot/job', + method: 'post', + data: data + }) +} + +// 查询定时任务调度详细 +export function getJob (jobId) { + return http.request({ + url: '/iot/job/' + jobId, + method: 'get' + }) +} + +// 修改定时任务调度 +export function updateJob (data) { + return http.request({ + url: '/iot/job', + method: 'put', + data: data + }) +} + +// 删除定时任务调度 +export function delJob (jobId) { + return http.request({ + url: '/iot/job/' + jobId, + method: 'delete' + }) +} \ No newline at end of file diff --git a/apis/modules/log.js b/apis/modules/log.js new file mode 100644 index 0000000..4011f8b --- /dev/null +++ b/apis/modules/log.js @@ -0,0 +1,10 @@ +const http = uni.$u.http; + +// 查询指令日志列表 +export function getOrderLogList (query) { + return http.request({ + url: '/iot/log/list', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/apis/modules/model.js b/apis/modules/model.js new file mode 100644 index 0000000..e66b9e5 --- /dev/null +++ b/apis/modules/model.js @@ -0,0 +1,6 @@ +const http = uni.$u.http; + +// 查询物模型对应分享设备用户权限列表 +export function getModelPermList (productId) { + return http.get('/iot/model/permList/' + productId); +} \ No newline at end of file diff --git a/apis/modules/notice.js b/apis/modules/notice.js new file mode 100644 index 0000000..72ac770 --- /dev/null +++ b/apis/modules/notice.js @@ -0,0 +1,11 @@ +const http = uni.$u.http; + +// 查询公告列表 +export function listNotice(params) { + return http.get('/system/notice/list',{params}) +} + +// 查询公告详情 +export function getNotice(noticeId) { + return http.get('/system/notice/' + noticeId); +} \ No newline at end of file diff --git a/apis/modules/player.js b/apis/modules/player.js new file mode 100644 index 0000000..260ff53 --- /dev/null +++ b/apis/modules/player.js @@ -0,0 +1,50 @@ +//播放器 +const http = uni.$u.http; +export function startPlay(deviceId, channelId) { + return http.get('/sip/player/play/' + deviceId + "/" + channelId); +} + +export function closeStream(deviceId, channelId, streamId) { + return http.get('/sip/player/closeStream/' + deviceId + "/" + channelId + "/" + streamId); +} + +export function playback(deviceId, channelId, query) { + return http.get('/sip/player/playback/' + deviceId + "/" + channelId,{params: query}); +} + +export function playbackPause(deviceId, channelId, streamId) { + return http.get('/sip/player/playbackPause/' + deviceId + "/" + channelId + "/" + streamId); +} + +export function playbackReplay(deviceId, channelId, streamId) { + return http.get('/sip/player/playbackReplay/' + deviceId + "/" + channelId + "/" + streamId); +} + +export function playbackSeek(deviceId, channelId, streamId, query) { + return http.get('/sip/player/playbackSeek/' + deviceId + "/" + channelId + "/" + streamId,{params: query}); +} + +export function playbackSpeed(deviceId, channelId, streamId, query) { + return http.get('/sip/player/playbackSpeed/' + deviceId + "/" + channelId + "/" + streamId,{params: query}); +} + +// record +export function getDevRecord(deviceId,channelId,query) { + return http.get('/sip/record/devquery/' + deviceId + "/" + channelId,{params: query}); +} + +export function getRecord(channelId,sn) { + return http.get('/sip/record/query/' + channelId + "/" + sn); +} + +export function getPushUrl(deviceId, channelId) { + return http.get('/sip/talk/getPushUrl/' + deviceId + "/" + channelId); +} + +export function startBroadcast(deviceId, channelId) { + return http.get('/sip/talk/broadcast/' + deviceId + "/" + channelId); +} + +export function stopBroadcast(deviceId, channelId) { + return http.get('/sip/talk/broadcast/stop/' + deviceId + "/" + channelId); +} diff --git a/apis/modules/product.js b/apis/modules/product.js new file mode 100644 index 0000000..a125e38 --- /dev/null +++ b/apis/modules/product.js @@ -0,0 +1,8 @@ +const http = uni.$u.http; + +// 查询产品列表 +export function getProductList (query) { + return http.get('/iot/product/list', { + params: query + }) +} \ No newline at end of file diff --git a/apis/modules/runtime.js b/apis/modules/runtime.js new file mode 100644 index 0000000..179f21d --- /dev/null +++ b/apis/modules/runtime.js @@ -0,0 +1,6 @@ +const http = uni.$u.http; + +// 发送设备实时数据 +export function serviceInvoke (data) { + return http.post('/iot/runtime/service/invoke', data); +} \ No newline at end of file diff --git a/apis/modules/scada.js b/apis/modules/scada.js new file mode 100644 index 0000000..6643337 --- /dev/null +++ b/apis/modules/scada.js @@ -0,0 +1,10 @@ +const http = uni.$u.http; + +// 查询独立组态列表 +export function getIndeScadaList (query) { + return http.request({ + url: '/scada/center/list', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/apis/modules/scene.js b/apis/modules/scene.js new file mode 100644 index 0000000..97db353 --- /dev/null +++ b/apis/modules/scene.js @@ -0,0 +1,41 @@ +const http = uni.$u.http; + +// 查询场景联动列表 +export function listScene (query) { + return http.get('/iot/scene/list', { params: query }); +} + +// 查询场景联动详细 +export function getScene (sceneId) { + return http.get('/iot/scene/' + sceneId); +} + +// 新增场景联动 +export function addScene (data) { + return http.post('/iot/scene', data); +} + +// 修改场景联动 +export function updateScene (data) { + return http.put('/iot/scene', data); +} + +// 删除场景联动 +export function delScene (sceneId) { + return http.delete('/iot/scene/' + sceneId); +} + +//获取设备列表 +export function deviceShortList (params) { + return http.get('/iot/device/shortList', { params }); +} + +//根据设备id获取下拉选项数据 +export function runScene (query) { + return http.post('/iot/runtime/runScene', null, { params: query }); +} + +// 修改场景状态 +export function updateStatus (data) { + return http.put('/iot/scene/updateStatus', data); +} \ No newline at end of file diff --git a/apis/modules/sip.js b/apis/modules/sip.js new file mode 100644 index 0000000..68d4a75 --- /dev/null +++ b/apis/modules/sip.js @@ -0,0 +1,40 @@ +// sipchannel +// 查询监控设备通道信息列表 +const http = uni.$u.http; + +export function listChannel(query) { + return http.request({ + url: '/sip/channel/list', + method: 'get', + params: query + }); +} + +// 查询监控设备通道信息详细 +export function getChannel(channelId) { + return http.get('/sip/channel/' + channelId); +} + +// 新增监控设备通道信息 +export function addChannel(createNum, data) { + return http.post('/sip/channel/'+ createNum,data); +} + +// 修改监控设备通道信息 +export function updateChannel(data) { + return http.put('/sip/channel',data) +} + +// 删除监控设备通道信息 +export function delChannel(channelId) { + return http.delete('/sip/channel/'+ channelId) +} + +// ptz控制 +export function ptzdirection(deviceId,channelId,data) { + return http.post('/sip/ptz/direction/'+ deviceId + "/" + channelId,data); +} + +export function ptzscale(deviceId,channelId,data) { + return http.post('/sip/ptz/scale/'+ deviceId + "/" + channelId,data); +} diff --git a/apis/modules/trend.js b/apis/modules/trend.js new file mode 100644 index 0000000..662440d --- /dev/null +++ b/apis/modules/trend.js @@ -0,0 +1,30 @@ +const http = uni.$u.http; + +// 查询动态 +export function topListTrend () { + return http.get('/iot/news/topList') +} + +// 查询轮播广告图 +export function bannerListTrend () { + return http.get('/iot/news/bannerList') +} + +// 查询分类下动态 +export function listTrend (params) { + return http.get('/iot/news/list', { params }) +} + +// 查询动态详情 +export function getTrend (newsId) { + return http.get('/iot/news/' + newsId); +} + +// 查询动态详情 +export function getNewsDetail (query) { + return http.request({ + url: '/iot/news/getDetail', + method: 'get', + params: query + }) +} \ No newline at end of file diff --git a/common/bus.js b/common/bus.js new file mode 100644 index 0000000..1a3c632 --- /dev/null +++ b/common/bus.js @@ -0,0 +1,5 @@ +import Vue from 'vue'; + +const bus = new Vue(); + +export default bus \ No newline at end of file diff --git a/common/extend.js b/common/extend.js new file mode 100644 index 0000000..7a70318 --- /dev/null +++ b/common/extend.js @@ -0,0 +1,24 @@ +// 对Date的扩展,将 Date 转化为指定格式的String +// 月(M)、日(d)、小时(H)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符, +// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字) +// 例子: +// (new Date()).Format("yyyy-MM-dd HH:mm:ss.S") ==> 2006-07-02 08:09:04.423 +// (new Date()).Format("yyyy-M-d H:m:s.S") ==> 2006-7-2 8:9:4.18 +Date.prototype.Format = function(fmt) +{ //author: meizz + var o = { + "M+" : this.getMonth()+1, //月份 + "d+" : this.getDate(), //日 + "h+" : this.getHours(), //小时 + "m+" : this.getMinutes(), //分 + "s+" : this.getSeconds(), //秒 + "q+" : Math.floor((this.getMonth()+3)/3), //季度 + "S" : this.getMilliseconds() //毫秒 + }; + if(/(y+)/.test(fmt)) + fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); + for(var k in o) + if(new RegExp("("+ k +")").test(fmt)) + fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length))); + return fmt; +} \ No newline at end of file diff --git a/common/filters.js b/common/filters.js new file mode 100644 index 0000000..384136b --- /dev/null +++ b/common/filters.js @@ -0,0 +1,7 @@ +import Vue from 'vue'; +let vm = new Vue(); + +// 测试过滤器 +export function toUpperCase(arg) { + return arg && arg.toUpperCase(); +} diff --git a/common/mqttTool.js b/common/mqttTool.js new file mode 100644 index 0000000..ef44c22 --- /dev/null +++ b/common/mqttTool.js @@ -0,0 +1,149 @@ +import projectConfig from '@/env.config.js'; + +var mqtt = require('mqtt/dist/mqtt.min.js') +var url = projectConfig.mqttServer; + +let mqttTool = { + client: null +} + +mqttTool.connect = function (token) { + let options = { + clientId: 'phone-' + Math.random().toString(16).substr(2), + username: 'fastbee', + password: token, + cleanSession: true, + keepalive: 30, + connectTimeout: 60000, + }; + mqttTool.client = mqtt.connect(url, options); + // 连接成功 + mqttTool.client.on('connect', function (res) { + console.log('mqtt连接成功'); + }); + // 重新连接 + mqttTool.client.on('reconnect', function (res) { + console.log('mqtt重连'); + }); + // 发生错误 + mqttTool.client.on('error', function (err) { + console.log('mqtt连接错误:', err); + uni.showToast({ + icon: 'none', + title: 'mqtt连接错误', + }); + }); + // 断开连接 + mqttTool.client.on('close', function (res) { + console.log('mqtt断开连接'); + }); +} + +mqttTool.end = function () { + return new Promise((resolve, reject) => { + if (mqttTool.client == null) { + resolve('未连接') + console.log("未连接") + return; + } + mqttTool.client.end() + mqttTool.client = null + resolve('连接终止') + }) +} + +mqttTool.reconnect = function () { + return new Promise((resolve, reject) => { + if (mqttTool.client == null) { + // 调用resolve方法,Promise变为操作成功状态(fulfilled) + resolve('未连接') + console.log("未连接") + return; + } + console.log('正在重连...', res); + mqttTool.client.reconnect() + }) +} + +mqttTool.subscribe = function (topics) { + return new Promise((resolve, reject) => { + if (mqttTool.client == null) { + resolve('未连接') + console.log("未连接") + uni.showToast({ + icon: 'none', + title: 'mqtt未连接', + }); + return; + } + mqttTool.client.subscribe(topics, { + qos: 0 + }, function (err, res) { + console.log("订阅主题:", topics); + if (!err && res.length > 0) { + console.log("订阅成功") + resolve('订阅成功') + } else { + console.log("订阅失败,主题可能已经订阅") + resolve('订阅失败') + return; + } + }) + }) +} + +mqttTool.unsubscribe = function (topics) { + return new Promise((resolve, reject) => { + if (mqttTool.client == null) { + resolve('未连接') + console.log("未连接") + return; + } + mqttTool.client.unsubscribe(topics, function (err) { + if (!err) { + resolve('取消订阅成功') + console.log("取消订阅成功") + } else { + resolve('取消订阅失败') + console.log("取消订阅失败") + return; + } + }) + }) +} + +mqttTool.publish = function (topic, message, name) { + return new Promise((resolve, reject) => { + if (mqttTool.client == null) { + resolve('未连接') + console.log("未连接") + uni.showToast({ + icon: 'none', + title: '已断开Mqtt连接', + }); + return; + } + mqttTool.client.publish(topic, message, function (err) { + if (!err) { + resolve(topic + '-' + message + '-发布成功') + console.log('发布主题:' + topic + ",内容:" + message); + uni.showToast({ + icon: 'none', + title: "[ " + name + " ] 指令发送成功", + duration: 1000, + }); + } else { + resolve(topic + '-' + message + '-发布失败') + console.log("发布失败") + uni.showToast({ + icon: 'none', + title: "[ " + name + " ] 指令发送失败", + duration: 1000, + }); + return; + } + }) + }) +} + +export default mqttTool \ No newline at end of file diff --git a/common/qqmap-wx-jssdk.min.js b/common/qqmap-wx-jssdk.min.js new file mode 100644 index 0000000..8fa1477 --- /dev/null +++ b/common/qqmap-wx-jssdk.min.js @@ -0,0 +1 @@ +var ERROR_CONF = { KEY_ERR: 311, KEY_ERR_MSG: 'key格式错误', PARAM_ERR: 310, PARAM_ERR_MSG: '请求参数信息有误', SYSTEM_ERR: 600, SYSTEM_ERR_MSG: '系统错误', WX_ERR_CODE: 1000, WX_OK_CODE: 200 }; var BASE_URL = 'https://apis.map.qq.com/ws/'; var URL_SEARCH = BASE_URL + 'place/v1/search'; var URL_SUGGESTION = BASE_URL + 'place/v1/suggestion'; var URL_GET_GEOCODER = BASE_URL + 'geocoder/v1/'; var URL_CITY_LIST = BASE_URL + 'district/v1/list'; var URL_AREA_LIST = BASE_URL + 'district/v1/getchildren'; var URL_DISTANCE = BASE_URL + 'distance/v1/'; var URL_DIRECTION = BASE_URL + 'direction/v1/'; var MODE = { driving: 'driving', transit: 'transit' }; var EARTH_RADIUS = 6378136.49; var Utils = { safeAdd(x, y) { var lsw = (x & 0xffff) + (y & 0xffff); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xffff) }, bitRotateLeft(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)) }, md5cmn(q, a, b, x, s, t) { return this.safeAdd(this.bitRotateLeft(this.safeAdd(this.safeAdd(a, q), this.safeAdd(x, t)), s), b) }, md5ff(a, b, c, d, x, s, t) { return this.md5cmn((b & c) | (~b & d), a, b, x, s, t) }, md5gg(a, b, c, d, x, s, t) { return this.md5cmn((b & d) | (c & ~d), a, b, x, s, t) }, md5hh(a, b, c, d, x, s, t) { return this.md5cmn(b ^ c ^ d, a, b, x, s, t) }, md5ii(a, b, c, d, x, s, t) { return this.md5cmn(c ^ (b | ~d), a, b, x, s, t) }, binlMD5(x, len) { x[len >> 5] |= 0x80 << (len % 32); x[((len + 64) >>> 9 << 4) + 14] = len; var i; var olda; var oldb; var oldc; var oldd; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; for (i = 0; i < x.length; i += 16) { olda = a; oldb = b; oldc = c; oldd = d; a = this.md5ff(a, b, c, d, x[i], 7, -680876936); d = this.md5ff(d, a, b, c, x[i + 1], 12, -389564586); c = this.md5ff(c, d, a, b, x[i + 2], 17, 606105819); b = this.md5ff(b, c, d, a, x[i + 3], 22, -1044525330); a = this.md5ff(a, b, c, d, x[i + 4], 7, -176418897); d = this.md5ff(d, a, b, c, x[i + 5], 12, 1200080426); c = this.md5ff(c, d, a, b, x[i + 6], 17, -1473231341); b = this.md5ff(b, c, d, a, x[i + 7], 22, -45705983); a = this.md5ff(a, b, c, d, x[i + 8], 7, 1770035416); d = this.md5ff(d, a, b, c, x[i + 9], 12, -1958414417); c = this.md5ff(c, d, a, b, x[i + 10], 17, -42063); b = this.md5ff(b, c, d, a, x[i + 11], 22, -1990404162); a = this.md5ff(a, b, c, d, x[i + 12], 7, 1804603682); d = this.md5ff(d, a, b, c, x[i + 13], 12, -40341101); c = this.md5ff(c, d, a, b, x[i + 14], 17, -1502002290); b = this.md5ff(b, c, d, a, x[i + 15], 22, 1236535329); a = this.md5gg(a, b, c, d, x[i + 1], 5, -165796510); d = this.md5gg(d, a, b, c, x[i + 6], 9, -1069501632); c = this.md5gg(c, d, a, b, x[i + 11], 14, 643717713); b = this.md5gg(b, c, d, a, x[i], 20, -373897302); a = this.md5gg(a, b, c, d, x[i + 5], 5, -701558691); d = this.md5gg(d, a, b, c, x[i + 10], 9, 38016083); c = this.md5gg(c, d, a, b, x[i + 15], 14, -660478335); b = this.md5gg(b, c, d, a, x[i + 4], 20, -405537848); a = this.md5gg(a, b, c, d, x[i + 9], 5, 568446438); d = this.md5gg(d, a, b, c, x[i + 14], 9, -1019803690); c = this.md5gg(c, d, a, b, x[i + 3], 14, -187363961); b = this.md5gg(b, c, d, a, x[i + 8], 20, 1163531501); a = this.md5gg(a, b, c, d, x[i + 13], 5, -1444681467); d = this.md5gg(d, a, b, c, x[i + 2], 9, -51403784); c = this.md5gg(c, d, a, b, x[i + 7], 14, 1735328473); b = this.md5gg(b, c, d, a, x[i + 12], 20, -1926607734); a = this.md5hh(a, b, c, d, x[i + 5], 4, -378558); d = this.md5hh(d, a, b, c, x[i + 8], 11, -2022574463); c = this.md5hh(c, d, a, b, x[i + 11], 16, 1839030562); b = this.md5hh(b, c, d, a, x[i + 14], 23, -35309556); a = this.md5hh(a, b, c, d, x[i + 1], 4, -1530992060); d = this.md5hh(d, a, b, c, x[i + 4], 11, 1272893353); c = this.md5hh(c, d, a, b, x[i + 7], 16, -155497632); b = this.md5hh(b, c, d, a, x[i + 10], 23, -1094730640); a = this.md5hh(a, b, c, d, x[i + 13], 4, 681279174); d = this.md5hh(d, a, b, c, x[i], 11, -358537222); c = this.md5hh(c, d, a, b, x[i + 3], 16, -722521979); b = this.md5hh(b, c, d, a, x[i + 6], 23, 76029189); a = this.md5hh(a, b, c, d, x[i + 9], 4, -640364487); d = this.md5hh(d, a, b, c, x[i + 12], 11, -421815835); c = this.md5hh(c, d, a, b, x[i + 15], 16, 530742520); b = this.md5hh(b, c, d, a, x[i + 2], 23, -995338651); a = this.md5ii(a, b, c, d, x[i], 6, -198630844); d = this.md5ii(d, a, b, c, x[i + 7], 10, 1126891415); c = this.md5ii(c, d, a, b, x[i + 14], 15, -1416354905); b = this.md5ii(b, c, d, a, x[i + 5], 21, -57434055); a = this.md5ii(a, b, c, d, x[i + 12], 6, 1700485571); d = this.md5ii(d, a, b, c, x[i + 3], 10, -1894986606); c = this.md5ii(c, d, a, b, x[i + 10], 15, -1051523); b = this.md5ii(b, c, d, a, x[i + 1], 21, -2054922799); a = this.md5ii(a, b, c, d, x[i + 8], 6, 1873313359); d = this.md5ii(d, a, b, c, x[i + 15], 10, -30611744); c = this.md5ii(c, d, a, b, x[i + 6], 15, -1560198380); b = this.md5ii(b, c, d, a, x[i + 13], 21, 1309151649); a = this.md5ii(a, b, c, d, x[i + 4], 6, -145523070); d = this.md5ii(d, a, b, c, x[i + 11], 10, -1120210379); c = this.md5ii(c, d, a, b, x[i + 2], 15, 718787259); b = this.md5ii(b, c, d, a, x[i + 9], 21, -343485551); a = this.safeAdd(a, olda); b = this.safeAdd(b, oldb); c = this.safeAdd(c, oldc); d = this.safeAdd(d, oldd) } return [a, b, c, d] }, binl2rstr(input) { var i; var output = ''; var length32 = input.length * 32; for (i = 0; i < length32; i += 8) { output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff) } return output }, rstr2binl(input) { var i; var output = []; output[(input.length >> 2) - 1] = undefined; for (i = 0; i < output.length; i += 1) { output[i] = 0 } var length8 = input.length * 8; for (i = 0; i < length8; i += 8) { output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32) } return output }, rstrMD5(s) { return this.binl2rstr(this.binlMD5(this.rstr2binl(s), s.length * 8)) }, rstrHMACMD5(key, data) { var i; var bkey = this.rstr2binl(key); var ipad = []; var opad = []; var hash; ipad[15] = opad[15] = undefined; if (bkey.length > 16) { bkey = this.binlMD5(bkey, key.length * 8) } for (i = 0; i < 16; i += 1) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5c5c5c5c } hash = this.binlMD5(ipad.concat(this.rstr2binl(data)), 512 + data.length * 8); return this.binl2rstr(this.binlMD5(opad.concat(hash), 512 + 128)) }, rstr2hex(input) { var hexTab = '0123456789abcdef'; var output = ''; var x; var i; for (i = 0; i < input.length; i += 1) { x = input.charCodeAt(i); output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f) } return output }, str2rstrUTF8(input) { return unescape(encodeURIComponent(input)) }, rawMD5(s) { return this.rstrMD5(this.str2rstrUTF8(s)) }, hexMD5(s) { return this.rstr2hex(this.rawMD5(s)) }, rawHMACMD5(k, d) { return this.rstrHMACMD5(this.str2rstrUTF8(k), str2rstrUTF8(d)) }, hexHMACMD5(k, d) { return this.rstr2hex(this.rawHMACMD5(k, d)) }, md5(string, key, raw) { if (!key) { if (!raw) { return this.hexMD5(string) } return this.rawMD5(string) } if (!raw) { return this.hexHMACMD5(key, string) } return this.rawHMACMD5(key, string) }, getSig(requestParam, sk, feature, mode) { var sig = null; var requestArr = []; Object.keys(requestParam).sort().forEach(function (key) { requestArr.push(key + '=' + requestParam[key]) }); if (feature == 'search') { sig = '/ws/place/v1/search?' + requestArr.join('&') + sk } if (feature == 'suggest') { sig = '/ws/place/v1/suggestion?' + requestArr.join('&') + sk } if (feature == 'reverseGeocoder') { sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk } if (feature == 'geocoder') { sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk } if (feature == 'getCityList') { sig = '/ws/district/v1/list?' + requestArr.join('&') + sk } if (feature == 'getDistrictByCityId') { sig = '/ws/district/v1/getchildren?' + requestArr.join('&') + sk } if (feature == 'calculateDistance') { sig = '/ws/distance/v1/?' + requestArr.join('&') + sk } if (feature == 'direction') { sig = '/ws/direction/v1/' + mode + '?' + requestArr.join('&') + sk } sig = this.md5(sig); return sig }, location2query(data) { if (typeof data == 'string') { return data } var query = ''; for (var i = 0; i < data.length; i++) { var d = data[i]; if (!!query) { query += ';' } if (d.location) { query = query + d.location.lat + ',' + d.location.lng } if (d.latitude && d.longitude) { query = query + d.latitude + ',' + d.longitude } } return query }, rad(d) { return d * Math.PI / 180.0 }, getEndLocation(location) { var to = location.split(';'); var endLocation = []; for (var i = 0; i < to.length; i++) { endLocation.push({ lat: parseFloat(to[i].split(',')[0]), lng: parseFloat(to[i].split(',')[1]) }) } return endLocation }, getDistance(latFrom, lngFrom, latTo, lngTo) { var radLatFrom = this.rad(latFrom); var radLatTo = this.rad(latTo); var a = radLatFrom - radLatTo; var b = this.rad(lngFrom) - this.rad(lngTo); var distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLatFrom) * Math.cos(radLatTo) * Math.pow(Math.sin(b / 2), 2))); distance = distance * EARTH_RADIUS; distance = Math.round(distance * 10000) / 10000; return parseFloat(distance.toFixed(0)) }, getWXLocation(success, fail, complete) { wx.getLocation({ type: 'gcj02', success: success, fail: fail, complete: complete }) }, getLocationParam(location) { if (typeof location == 'string') { var locationArr = location.split(','); if (locationArr.length === 2) { location = { latitude: location.split(',')[0], longitude: location.split(',')[1] } } else { location = {} } } return location }, polyfillParam(param) { param.success = param.success || function () { }; param.fail = param.fail || function () { }; param.complete = param.complete || function () { } }, checkParamKeyEmpty(param, key) { if (!param[key]) { var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + key + '参数格式有误'); param.fail(errconf); param.complete(errconf); return true } return false }, checkKeyword(param) { return !this.checkParamKeyEmpty(param, 'keyword') }, checkLocation(param) { var location = this.getLocationParam(param.location); if (!location || !location.latitude || !location.longitude) { var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + ' location参数格式有误'); param.fail(errconf); param.complete(errconf); return false } return true }, buildErrorConfig(errCode, errMsg) { return { status: errCode, message: errMsg } }, handleData(param, data, feature) { if (feature == 'search') { var searchResult = data.data; var searchSimplify = []; for (var i = 0; i < searchResult.length; i++) { searchSimplify.push({ id: searchResult[i].id || null, title: searchResult[i].title || null, latitude: searchResult[i].location && searchResult[i].location.lat || null, longitude: searchResult[i].location && searchResult[i].location.lng || null, address: searchResult[i].address || null, category: searchResult[i].category || null, tel: searchResult[i].tel || null, adcode: searchResult[i].ad_info && searchResult[i].ad_info.adcode || null, city: searchResult[i].ad_info && searchResult[i].ad_info.city || null, district: searchResult[i].ad_info && searchResult[i].ad_info.district || null, province: searchResult[i].ad_info && searchResult[i].ad_info.province || null }) } param.success(data, { searchResult: searchResult, searchSimplify: searchSimplify }) } else if (feature == 'suggest') { var suggestResult = data.data; var suggestSimplify = []; for (var i = 0; i < suggestResult.length; i++) { suggestSimplify.push({ adcode: suggestResult[i].adcode || null, address: suggestResult[i].address || null, category: suggestResult[i].category || null, city: suggestResult[i].city || null, district: suggestResult[i].district || null, id: suggestResult[i].id || null, latitude: suggestResult[i].location && suggestResult[i].location.lat || null, longitude: suggestResult[i].location && suggestResult[i].location.lng || null, province: suggestResult[i].province || null, title: suggestResult[i].title || null, type: suggestResult[i].type || null }) } param.success(data, { suggestResult: suggestResult, suggestSimplify: suggestSimplify }) } else if (feature == 'reverseGeocoder') { var reverseGeocoderResult = data.result; var reverseGeocoderSimplify = { address: reverseGeocoderResult.address || null, latitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lat || null, longitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lng || null, adcode: reverseGeocoderResult.ad_info && reverseGeocoderResult.ad_info.adcode || null, city: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.city || null, district: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.district || null, nation: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.nation || null, province: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.province || null, street: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street || null, street_number: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street_number || null, recommend: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.recommend || null, rough: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.rough || null }; if (reverseGeocoderResult.pois) { var pois = reverseGeocoderResult.pois; var poisSimplify = []; for (var i = 0; i < pois.length; i++) { poisSimplify.push({ id: pois[i].id || null, title: pois[i].title || null, latitude: pois[i].location && pois[i].location.lat || null, longitude: pois[i].location && pois[i].location.lng || null, address: pois[i].address || null, category: pois[i].category || null, adcode: pois[i].ad_info && pois[i].ad_info.adcode || null, city: pois[i].ad_info && pois[i].ad_info.city || null, district: pois[i].ad_info && pois[i].ad_info.district || null, province: pois[i].ad_info && pois[i].ad_info.province || null }) } param.success(data, { reverseGeocoderResult: reverseGeocoderResult, reverseGeocoderSimplify: reverseGeocoderSimplify, pois: pois, poisSimplify: poisSimplify }) } else { param.success(data, { reverseGeocoderResult: reverseGeocoderResult, reverseGeocoderSimplify: reverseGeocoderSimplify }) } } else if (feature == 'geocoder') { var geocoderResult = data.result; var geocoderSimplify = { title: geocoderResult.title || null, latitude: geocoderResult.location && geocoderResult.location.lat || null, longitude: geocoderResult.location && geocoderResult.location.lng || null, adcode: geocoderResult.ad_info && geocoderResult.ad_info.adcode || null, province: geocoderResult.address_components && geocoderResult.address_components.province || null, city: geocoderResult.address_components && geocoderResult.address_components.city || null, district: geocoderResult.address_components && geocoderResult.address_components.district || null, street: geocoderResult.address_components && geocoderResult.address_components.street || null, street_number: geocoderResult.address_components && geocoderResult.address_components.street_number || null, level: geocoderResult.level || null }; param.success(data, { geocoderResult: geocoderResult, geocoderSimplify: geocoderSimplify }) } else if (feature == 'getCityList') { var provinceResult = data.result[0]; var cityResult = data.result[1]; var districtResult = data.result[2]; param.success(data, { provinceResult: provinceResult, cityResult: cityResult, districtResult: districtResult }) } else if (feature == 'getDistrictByCityId') { var districtByCity = data.result[0]; param.success(data, districtByCity) } else if (feature == 'calculateDistance') { var calculateDistanceResult = data.result.elements; var distance = []; for (var i = 0; i < calculateDistanceResult.length; i++) { distance.push(calculateDistanceResult[i].distance) } param.success(data, { calculateDistanceResult: calculateDistanceResult, distance: distance }) } else if (feature == 'direction') { var direction = data.result.routes; param.success(data, direction) } else { param.success(data) } }, buildWxRequestConfig(param, options, feature) { var that = this; options.header = { "content-type": "application/json" }; options.method = 'GET'; options.success = function (res) { var data = res.data; if (data.status === 0) { that.handleData(param, data, feature) } else { param.fail(data) } }; options.fail = function (res) { res.statusCode = ERROR_CONF.WX_ERR_CODE; param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)) }; options.complete = function (res) { var statusCode = +res.statusCode; switch (statusCode) { case ERROR_CONF.WX_ERR_CODE: { param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); break } case ERROR_CONF.WX_OK_CODE: { var data = res.data; if (data.status === 0) { param.complete(data) } else { param.complete(that.buildErrorConfig(data.status, data.message)) } break } default: { param.complete(that.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG)) } } }; return options }, locationProcess(param, locationsuccess, locationfail, locationcomplete) { var that = this; locationfail = locationfail || function (res) { res.statusCode = ERROR_CONF.WX_ERR_CODE; param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)) }; locationcomplete = locationcomplete || function (res) { if (res.statusCode == ERROR_CONF.WX_ERR_CODE) { param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)) } }; if (!param.location) { that.getWXLocation(locationsuccess, locationfail, locationcomplete) } else if (that.checkLocation(param)) { var location = Utils.getLocationParam(param.location); locationsuccess(location) } } }; class QQMapWX { constructor(options) { if (!options.key) { throw Error('key值不能为空') } this.key = options.key }; search(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (!Utils.checkKeyword(options)) { return } var requestParam = { keyword: options.keyword, orderby: options.orderby || '_distance', page_size: options.page_size || 10, page_index: options.page_index || 1, output: 'json', key: that.key }; if (options.address_format) { requestParam.address_format = options.address_format } if (options.filter) { requestParam.filter = options.filter } var distance = options.distance || "1000"; var auto_extend = options.auto_extend || 1; var region = null; var rectangle = null; if (options.region) { region = options.region } if (options.rectangle) { rectangle = options.rectangle } var locationsuccess = function (result) { if (region && !rectangle) { requestParam.boundary = "region(" + region + "," + auto_extend + "," + result.latitude + "," + result.longitude + ")"; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'search') } } else if (rectangle && !region) { requestParam.boundary = "rectangle(" + rectangle + ")"; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'search') } } else { requestParam.boundary = "nearby(" + result.latitude + "," + result.longitude + "," + distance + "," + auto_extend + ")"; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'search') } } wx.request(Utils.buildWxRequestConfig(options, { url: URL_SEARCH, data: requestParam }, 'search')) }; Utils.locationProcess(options, locationsuccess) }; getSuggestion(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (!Utils.checkKeyword(options)) { return } var requestParam = { keyword: options.keyword, region: options.region || '全国', region_fix: options.region_fix || 0, policy: options.policy || 0, page_size: options.page_size || 10, page_index: options.page_index || 1, get_subpois: options.get_subpois || 0, output: 'json', key: that.key }; if (options.address_format) { requestParam.address_format = options.address_format } if (options.filter) { requestParam.filter = options.filter } if (options.location) { var locationsuccess = function (result) { requestParam.location = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_SUGGESTION, data: requestParam }, "suggest")) }; Utils.locationProcess(options, locationsuccess) } else { if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_SUGGESTION, data: requestParam }, "suggest")) } }; reverseGeocoder(options) { var that = this; options = options || {}; Utils.polyfillParam(options); var requestParam = { coord_type: options.coord_type || 5, get_poi: options.get_poi || 0, output: 'json', key: that.key }; if (options.poi_options) { requestParam.poi_options = options.poi_options } var locationsuccess = function (result) { requestParam.location = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'reverseGeocoder') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_GET_GEOCODER, data: requestParam }, 'reverseGeocoder')) }; Utils.locationProcess(options, locationsuccess) }; geocoder(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'address')) { return } var requestParam = { address: options.address, output: 'json', key: that.key }; if (options.region) { requestParam.region = options.region } if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'geocoder') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_GET_GEOCODER, data: requestParam }, 'geocoder')) }; getCityList(options) { var that = this; options = options || {}; Utils.polyfillParam(options); var requestParam = { output: 'json', key: that.key }; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'getCityList') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_CITY_LIST, data: requestParam }, 'getCityList')) }; getDistrictByCityId(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'id')) { return } var requestParam = { id: options.id || '', output: 'json', key: that.key }; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'getDistrictByCityId') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_AREA_LIST, data: requestParam }, 'getDistrictByCityId')) }; calculateDistance(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'to')) { return } var requestParam = { mode: options.mode || 'walking', to: Utils.location2query(options.to), output: 'json', key: that.key }; if (options.from) { options.location = options.from } if (requestParam.mode == 'straight') { var locationsuccess = function (result) { var locationTo = Utils.getEndLocation(requestParam.to); var data = { message: "query ok", result: { elements: [] }, status: 0 }; for (var i = 0; i < locationTo.length; i++) { data.result.elements.push({ distance: Utils.getDistance(result.latitude, result.longitude, locationTo[i].lat, locationTo[i].lng), duration: 0, from: { lat: result.latitude, lng: result.longitude }, to: { lat: locationTo[i].lat, lng: locationTo[i].lng } }) } var calculateResult = data.result.elements; var distanceResult = []; for (var i = 0; i < calculateResult.length; i++) { distanceResult.push(calculateResult[i].distance) } return options.success(data, { calculateResult: calculateResult, distanceResult: distanceResult }) }; Utils.locationProcess(options, locationsuccess) } else { var locationsuccess = function (result) { requestParam.from = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'calculateDistance') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_DISTANCE, data: requestParam }, 'calculateDistance')) }; Utils.locationProcess(options, locationsuccess) } }; direction(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'to')) { return } var requestParam = { output: 'json', key: that.key }; if (typeof options.to == 'string') { requestParam.to = options.to } else { requestParam.to = options.to.latitude + ',' + options.to.longitude } var SET_URL_DIRECTION = null; options.mode = options.mode || MODE.driving; SET_URL_DIRECTION = URL_DIRECTION + options.mode; if (options.from) { options.location = options.from } if (options.mode == MODE.driving) { if (options.from_poi) { requestParam.from_poi = options.from_poi } if (options.heading) { requestParam.heading = options.heading } if (options.speed) { requestParam.speed = options.speed } if (options.accuracy) { requestParam.accuracy = options.accuracy } if (options.road_type) { requestParam.road_type = options.road_type } if (options.to_poi) { requestParam.to_poi = options.to_poi } if (options.from_track) { requestParam.from_track = options.from_track } if (options.waypoints) { requestParam.waypoints = options.waypoints } if (options.policy) { requestParam.policy = options.policy } if (options.plate_number) { requestParam.plate_number = options.plate_number } } if (options.mode == MODE.transit) { if (options.departure_time) { requestParam.departure_time = options.departure_time } if (options.policy) { requestParam.policy = options.policy } } var locationsuccess = function (result) { requestParam.from = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'direction', options.mode) } wx.request(Utils.buildWxRequestConfig(options, { url: SET_URL_DIRECTION, data: requestParam }, 'direction')) }; Utils.locationProcess(options, locationsuccess) } }; module.exports = QQMapWX; \ No newline at end of file diff --git a/common/tools.js b/common/tools.js new file mode 100644 index 0000000..8db8f30 --- /dev/null +++ b/common/tools.js @@ -0,0 +1,60 @@ +const install = (Vue, vm) => { + + Vue.prototype.$t = { + // 测试加法 + toUpperCase(arg){ + return arg && arg.toUpperCase(); + }, + // 转换字符串,undefined,null等转化为"" + praseStrEmpty(str) { + if (!str || str == "undefined" || str == "null") { + return ""; + } + return str; + }, + // 日期格式化 + parseTime(time, pattern) { + if (arguments.length === 0 || !time) { + return null + } + const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}' + let date + if (typeof time === 'object') { + date = time + } else { + if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) { + time = parseInt(time) + } else if (typeof time === 'string') { + time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm),''); + } + if ((typeof time === 'number') && (time.toString().length === 10)) { + time = time * 1000 + } + date = new Date(time) + } + const formatObj = { + y: date.getFullYear(), + m: date.getMonth() + 1, + d: date.getDate(), + h: date.getHours(), + i: date.getMinutes(), + s: date.getSeconds(), + a: date.getDay() + } + const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => { + let value = formatObj[key] + // Note: getDay() returns 0 on Sunday + if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] } + if (result.length > 0 && value < 10) { + value = '0' + value + } + return value || 0 + }) + return time_str + } + } +} + +export default { + install +} diff --git a/components/NavBar/NavBar.vue b/components/NavBar/NavBar.vue new file mode 100644 index 0000000..18c0287 --- /dev/null +++ b/components/NavBar/NavBar.vue @@ -0,0 +1,304 @@ + + + + + \ No newline at end of file diff --git a/components/circleProgress/circleProgress.vue b/components/circleProgress/circleProgress.vue new file mode 100644 index 0000000..2953c03 --- /dev/null +++ b/components/circleProgress/circleProgress.vue @@ -0,0 +1,180 @@ + + + + + diff --git a/components/cl-icon/cl-icon.vue b/components/cl-icon/cl-icon.vue new file mode 100644 index 0000000..8cd68af --- /dev/null +++ b/components/cl-icon/cl-icon.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/components/cl-icon/iconfont.css b/components/cl-icon/iconfont.css new file mode 100644 index 0000000..4fba631 --- /dev/null +++ b/components/cl-icon/iconfont.css @@ -0,0 +1,19 @@ +@font-face { + font-family: "iconfont"; /* Project id 2505219 */ + src: url('iconfont.woff2?t=1626686156492') format('woff2'), + url('iconfont.woff?t=1626686156492') format('woff'), + url('iconfont.ttf?t=1626686156492') format('truetype'); +} + +.iconfont { + font-family: "iconfont" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.iconlaba:before { + content: "\e600"; +} + diff --git a/components/cl-icon/iconfont.json b/components/cl-icon/iconfont.json new file mode 100644 index 0000000..d881810 --- /dev/null +++ b/components/cl-icon/iconfont.json @@ -0,0 +1,16 @@ +{ + "id": "2505219", + "name": "uniapp 插件市场", + "font_family": "iconfont", + "css_prefix_text": "icon", + "description": "", + "glyphs": [ + { + "icon_id": "8478792", + "name": "喇叭", + "font_class": "laba", + "unicode": "e600", + "unicode_decimal": 58880 + } + ] +} diff --git a/components/cl-icon/iconfont.ttf b/components/cl-icon/iconfont.ttf new file mode 100644 index 0000000..ec18497 Binary files /dev/null and b/components/cl-icon/iconfont.ttf differ diff --git a/components/cl-icon/iconfont.woff b/components/cl-icon/iconfont.woff new file mode 100644 index 0000000..6de15f6 Binary files /dev/null and b/components/cl-icon/iconfont.woff differ diff --git a/components/cl-icon/iconfont.woff2 b/components/cl-icon/iconfont.woff2 new file mode 100644 index 0000000..562ef12 Binary files /dev/null and b/components/cl-icon/iconfont.woff2 differ diff --git a/components/cl-icon/index.vue b/components/cl-icon/index.vue new file mode 100644 index 0000000..8cd68af --- /dev/null +++ b/components/cl-icon/index.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/components/cl-icon/readme.md b/components/cl-icon/readme.md new file mode 100644 index 0000000..7a29fdf --- /dev/null +++ b/components/cl-icon/readme.md @@ -0,0 +1,33 @@ +### Tag 标签 + +图标 +项目图标当前管理者1209559047@qq.com + +**使用方式:** + +在 ``script`` 中引用组件 + +```javascript +import mIcon from "@/components/m-icon/m-icon.vue" +export default { + components: {mIcon}, +} +``` + +在 ``template`` 中使用组件 + +```html + +``` + + +**属性说明:** + +|属性名 |类型 |默认值 |说明 | +|--- |---- |--- |--- | + +**事件说明:** + +|事件称名|说明| +|---|----|---| +|click|接管了点击事件| diff --git a/components/cl-test/cl-test.vue b/components/cl-test/cl-test.vue new file mode 100644 index 0000000..a10c33d --- /dev/null +++ b/components/cl-test/cl-test.vue @@ -0,0 +1,19 @@ + + + + + diff --git a/components/cl-test/index.vue b/components/cl-test/index.vue new file mode 100644 index 0000000..a10c33d --- /dev/null +++ b/components/cl-test/index.vue @@ -0,0 +1,19 @@ + + + + + diff --git a/components/cropping/index.vue b/components/cropping/index.vue new file mode 100644 index 0000000..0800c7f --- /dev/null +++ b/components/cropping/index.vue @@ -0,0 +1,1053 @@ + + + + + \ No newline at end of file diff --git a/components/model/vip-model.vue b/components/model/vip-model.vue new file mode 100644 index 0000000..2678db0 --- /dev/null +++ b/components/model/vip-model.vue @@ -0,0 +1,216 @@ + + + + + \ No newline at end of file diff --git a/components/weather/index.vue b/components/weather/index.vue new file mode 100644 index 0000000..df04dc4 --- /dev/null +++ b/components/weather/index.vue @@ -0,0 +1,341 @@ + + + + + \ No newline at end of file diff --git a/env.config.js b/env.config.js new file mode 100644 index 0000000..12f99f8 --- /dev/null +++ b/env.config.js @@ -0,0 +1,37 @@ +// H5端开发和生产环境协议 +let protocalDev = "wss://"; +let protocalProd = "wss://"; + +// 条件编译,微信端和移动端使用wxs协议 +// #ifdef MP-WEIXIN || APP-PLUS +protocalDev = 'wxs://'; +protocalProd = 'wxs://'; +// #endif + +// 腾讯地图key +let qqmapKey = '4PDBZ-4KQKU-AX6VO-GU7NB-INDZJ-YBFXC'; + +// 心知天气key +let xinzhiKey = 'SBh45_yy21FU5ErV_'; + +const CONFIG = { + // 开发环境配置 + development: { + officialWebUrl: 'https://www.xcwl-aiot.cn/', + baseUrl: 'https://www.xcwl-aiot.cn/prod-api/', + mqttServer: protocalDev + 'www.xcwl-aiot.cn/mqtt', + decoderUrl: 'https://www.xcwl-aiot.cn/', + qqmapKey, + xinzhiKey, + }, + // 生产环境配置 + production: { + officialWebUrl: 'https://www.xcwl-aiot.cn/', + baseUrl: 'https://www.xcwl-aiot.cn/prod-api/', + mqttServer: protocalDev + 'www.xcwl-aiot.cn/mqtt', + decoderUrl: 'https://www.xcwl-aiot.cn/', + qqmapKey, + xinzhiKey, + } +} +export default CONFIG[process.env.NODE_ENV]; \ No newline at end of file diff --git a/helpers/common.js b/helpers/common.js new file mode 100644 index 0000000..8ef5178 --- /dev/null +++ b/helpers/common.js @@ -0,0 +1,55 @@ +/** + * 获取sip状态名称、颜色等信息 + * @param {Number} value 状态id + * @returns {Object} { id, name, type } + */ + export function getSipStatusInfo (id) { + if (id === 1) { + return { id: id, name: '未使用', type: 'info' }; + }else if (id === 2) { + return { id: id, name: '禁用', type: 'info' }; + } else if (id === 3) { + return { id: id, name: '在线', type: 'success' }; + } else if (id === 4) { + return { id: id, name: '离线', type: 'warning' }; + } else { + return null; + } + } + + +/** + * 获取device状态名称、颜色等信息 + * @param {Number} value 状态id + * @returns {Object} { id, name, type } + */ +export function getDeviceStatusInfo (id) { + if (id === 1) { + return { id: id, name: '未激活', type: 'info' }; + } else if (id === 2) { + return { id: id, name: '禁用', type: 'info' }; + } else if (id === 3) { + return { id: id, name: '在线', type: 'success' }; + } else if (id === 4) { + return { id: id, name: '离线', type: 'warning' }; + } else { + return null; + } +} + +/** + * 获取状态名称、颜色等信息 + * @param {Number} value 定位方式id + * @returns {Object} { id, name } + */ +export function getLocationWayInfo (id) { + if (id === 1) { + return { id: id, name: '自动定位' }; + } else if (id === 2) { + return { id: id, name: '设备定位' }; + } else if (id === 3) { + return { id: id, name: '自定义位置' }; + } else { + return null; + } +} \ No newline at end of file diff --git a/locale/en-US.json b/locale/en-US.json new file mode 100644 index 0000000..57d45c9 --- /dev/null +++ b/locale/en-US.json @@ -0,0 +1,698 @@ +{ + "locale.auto": "System", + "locale.en-US": "English", + "locale.zh-CN": "简体中文", + "navBar.login": "Login", + "navBar.registration": "User Registration", + "navBar.loginBinding": "User Login Binding", + "navBar.registrationBinding": "User Registration Binding", + "navBar.smsBogin": "SMS Login", + "navBar.home": "Home", + "navBar.scene": "Scene", + "navBar.alert": "Alert", + "navBar.news": "Dynamic", + "navBar.user": "Me", + "navBar.browse": "Browsing web pages", + "navBar.sceneDetail": "Scene Detail", + "navBar.sceneList": "Scene List", + "navBar.productList": "Product List", + "navBar.deviceList": "Device List", + "navBar.physicalModels": "List Of Physical Models", + "navBar.alarmList": "Alarm List", + "navBar.timer": "Timer", + "navBar.alarmLog": "Alarm Log", + "navBar.alarmHandling": "Alarm Handling", + "navBar.deviceDetails ": "Device Details ", + "navBar.timedList": "Timed List", + "navBar.timedDetails": "Timed Details", + "navBar.dynamic": "Latest updates", + "navBar.dynamicDetails": "Dynamic Details", + "navBar.classification": "Classification Dynamics", + "navBar.addDevice": "Add Device", + "navBar.associatedDevices": "Associated Devices", + "navBar.deviceSharing": "Device Dharing", + "navBar.shareDetails": "Share User Details", + "navBar.about ": "About", + "common.fastbee": "Fastbee", + "navBar.latest": "Latest news", + "navBar.newsDetail": "News Detail", + "navBar.setting": "System Setting", + "navBar.simulation": "Device Simulation", + "navBar.mobile": "Mobile monitoring", + "navBar.account": "Account Messages", + "navBar.language": "Multilingual", + "navBar.updateAvatar": "Update Avatar", + "navBar.unbind": "Unbind WeChat", + "navBar.group": "Device grouping", + "navBar.running": "Runiing Status", + "navBar.updateGroup": "Edit group", + "navBar.updateDevice": "Device Update", + "navBar.eventLog": "Event Log", + "navBar.orderLog": "Instruction log", + "navBar.player": "Player", + "common.add": "add", + "common.delete": "Delete", + "common.save": "Save", + "common.cancel": "Cancel", + "common.confirm": "Comfirm", + "common.back": "Back", + "common.edit": "Edit", + "common.updateSuccessful": "upadte successful", + "common.addSuccessful": "add successsful", + "common.saveError": "Save failed", + "common.saveSuccessful": "Save Successful", + "common.operation": "Operation successful", + "common.search": "Search", + "common.tips": "Tips", + "common.loginTips": "This function can be used only after you log in. Do you want to log in ?", + "login": { + "accountLogin": "Account Login", + "inputUserName": "Please Input Username", + "inputPassword": "Please Input Password", + "inputCode": "Please Input Code", + "login": "Log in", + "exampleAccount": "Example:fastbee 123456", + "HuapuIoT": "HuapuIoT", + "registerNow": "Register", + "readAndAgree": "Read and Agree", + "serviceAgreement": "Service Agreement", + "and": "and", + "privacyPolicy": "Privacy Policy", + "childProtectionStatement": "Children's Privacy Statement", + "commonBill": "Third-party Sharing And SDK Bill", + "readAndCheckTheAgreement": "Please read and check the agreement", + "accontMsg": "Account information cannot be empty", + "phoneLogin": "Phone Login", + "welcomeToLogin": "Welcome to login FastBee", + "phoneAuthorization": "phone Login", + "remember": "Remember password", + "other": "Other login methods" + }, + "register": { + "userRegister": "User Registration", + "inputUserName": "Please Input Username", + "inputPhone": "Please Input Phonenumber", + "inputPassword": "Please Input Password", + "inputPasswordAgain": "Please Input Password Again", + "inputUserNameSize": "Please Input Username And Length greater than four", + "inputCode": "Please Input Code", + "registration": "Sign up", + "accountLogin": "Log In To An Existing Account", + "congratulations": "congratulations,your account ", + "registeredSuccessfully": "Registered Successfully" + }, + "smsLogin": { + "smsLogin": "Sms Login", + "login": "Log in", + "HuapuIoT": "HuapuIoT ", + "accountLogin": "Account Login", + "obtainCode": "Obtain Code", + "correctPhone": "Please Input Correct PhoneNumber", + "obtainSmsCode": "Obtaining Verification Code", + "codeSent": "Verification code has been sent", + "sending": "The countdown ends before sending" + }, + "bindLogin": { + "bindLogin": "Bind Account Login", + "bindRegister": "Bind Register", + "alert": "Alert", + "alertTitle": "The account does not exist. Do you want to register a new account", + "notRegister": "Cancel", + "confirmRegister": "Confirm", + "accountNotNull": "Account cannot be empty", + "bind": "Bind" + }, + "bindRegister": { + "bindRegister": "Bind Register", + "incorrectPhone": "Incorrect phone number format", + "inputPasswordSize": "Please Input Code And Length greater than five", + "enterPasswordsDiffer": "Entered passwords differ" + }, + "user": { + "personalCentre": "Personal Centre", + "openIOT": "FastBee-Open source IoT platform", + "addDevice": "Add Device", + "addScene": "Add Scene", + "groupManagement": "Group Manage", + "platformMsg": "Platform Msg", + "ordinaryMembers": "Ordinary Members", + "currentAccountAlert": "Current Account No Membership Has Been Opened", + "openAtOnce": "Open At Once", + "account": "Account Number", + "messages": "Messages", + "signOut": "Sign Out", + "about": "About", + "language": "language", + "appDownload": "App Download", + "exitAccount": "Exit", + "confirmExit": "confirm Exit", + "confirmSignOut": "confirm Sign Out", + "signOutAlert": "After account cancellation, all information will be cleared and cannot be restored. Do you want to cancel?", + "notWriteOff": "Not Write Off", + "confirmWriteOff": "Confirm Write Off", + "confirmWxBind": "Confirm Bind Wechat", + "wxBindAlertTitle": "Do you want to bind WeChat", + "notBind": "Not Currently Bind", + "confirmBind": "Confirm Binding", + "saveSuccess": "Save Success", + "occurError": "Occur Error", + "scanning": "Scanning only supports apps and mini programs", + "parseQrCode": "After parsing the QR code,Unable to find corresponding processing type", + "errorParseQRcode": "Error parsing QR code,Incorrect format", + "language-01": "Language", + "updatePassword": "Edit Password", + "login": "Login/Register", + "visitor": "Visitor", + "configuration": "Independent Configuration", + "notice": "This feature requires you to log in to use it. Would you like to log in?" + }, + "account": { + "avatar": "Avatar", + "nikeName": "Nikename", + "email": "Email", + "phone": "Phonenumber", + "createTime": "Createtime", + "Ip": "IP", + "save": "Save", + "inputPhone": "Please Input PhoneNumber", + "inputEmail": "Please Input Email", + "inputNickname": "PleaseInput NickName", + "inputCreatetime": "Please Input Createtime", + "inputIP": "Please Input IP", + "incorrectEmail": "Incorrect Email format" + }, + "home": { + "netWork": "Distribution Network Add", + "wifi-type": "Common For WIFI-type Devices", + "qrCode": "SCAN QR Code To Add", + "networksDevices": "For Cellular Networks/Ethernet Devices", + "association": "Association Is Added", + "supportBatchOperations": "For Cellular Networks/Ethernet Devices, And Support Batch Operations", + "errorLoading": "Loading Error", + "sureAdd": "Are you sure to add it?", + "productName": "productName", + "serialNumber": "serialNumber", + "notActive": "Not Active", + "disabled": "disAbled", + "onLine": "onLine", + "offline": "offline", + "all": "All", + "shadow": "Shadow", + "eventLog": "Event Log", + "Instructionlog": "Instruction log" + }, + "about": { + "about": "about", + "authorQQ": "Author QQ : 164770707", + "authorWechat": "Author Wechat : QQ164770707", + "group": "Group: 720136372, 1073236354", + "webSite": "Official Website", + "SourceCode": "View The Source Code", + "open": "FastBee-Open source IoT platform Version 2.5.1", + "message": "Qujing Fengxin Technology Co., Ltd | HuapuIOT | Official website fastbee.cn" + }, + "deviceDetail": { + "basicMsg": "Basic Messages", + "deviceName": "DeviceName", + "position": "Position", + "longitude": "Longitude", + "latitude": "Latitude", + "address": "Address", + "shadow": "Shadow", + "disabledDevice": "DSisable", + "remark": "Remarks", + "inputMsg": "Please Input The Content", + "inputLongitude": "Please Input Device Longitude", + "inputLatitude": "Please Input Device latitudel", + "loadingFail": "Loading Fail", + "veryGood": "Very Good", + "excellent": "excellent", + "good": "Good", + "average": "Average", + "poor": "Poor", + "device": "Device", + "timing": "Timing", + "journal": "Journal", + "static": "static", + "share": "Share", + "preserve": "Preserve", + "deviceStatus": "Status", + "serialNumber": "Serial Number", + "belongingProducts": "Product", + "firmwareVersion": "Version", + "positionMethod": "Position", + "equipmentSignal": "Signal", + "networkAddress": "networkIp", + "address": "Address", + "activationTime": "activeTime", + "deleteDevice": "Delete", + "monitor": "monitor", + "runningStatus": "runningStatus", + "deviceDetail": "Device Detail", + "channel": "Channel", + "autoPosition": "Auto Position", + "devicePosition": "Device Position", + "customLocation": "Custom Location", + "deviceCheck": "The device name cannot be empty", + "positionCheck": "The position methods cannot be empty", + "updateSuccess": "Update Success", + "Overview": "Device Overview", + "Surveillance": "Video Surveillance", + "Alert": "Alert Log", + "scada": "scada", + "emptyNull": "Data Null" + }, + "timing": { + "timingName": "Please Input Timing Name", + "search": "search", + "execute": "Execute once", + "effortLoading": "hard Loading...", + "loadMore": "Click on me to load more", + "nothing": "There's really nothing left", + "emptyNull": "Data is empty", + "all": "All", + "enable": "Enable", + "notEnabled": "Not Enabled", + "nosupported": "WeChat mini programs are currently not supported", + "wap2": "Please use wap2app to package!" + }, + "deviceStatic": { + "selectSub": "Please Select Device Slave", + "rangeTime": "BeginTime-EndTime", + "selectTime": "Please Select Range Time", + "search": "search" + }, + "monitior": { + "stop": "stop", + "monitoringInterval": "Monitoring interval(ms) And number of times", + "inputNumber": "Enter the number of milliseconds between inputs", + "inputTimes": " Input count", + "stop": "Stop", + "monitior": "Monitior", + "receivingData": "Receive Data...", + "monitoringRange": "Monitoring interval range 500-10000 milliseconds", + "monitoringQuantity": "Monitoring quantity range 1-300", + "real-timeMonitor": "real-time monitor", + "stopMonitor": "Stop Monitior" + }, + "scene": { + "sceneLink": "Scene Linkage", + "inputSceneName": "Please Enter The Scene Name", + "search": "Search", + "condition": "Condition", + "way": "Way", + "task": "Task", + "execute": "Execute once", + "tryingToLoad": "Trying To Load...", + "gentlyPullUp": "Gently Pull Up", + "nothingLeft": "There's Really Nothing Left", + "emptyData": "Data Is Empty", + "administration": "Administration", + "alarm": "Alarm", + "anyCondition": " Any Condition", + "allCondition": "All Conditions", + "notConditions": "Not Meeting The Conditions", + "unknown": "Unknown", + "serial": "Serial", + "parallel": "Parallel", + "switchSuccessful": "Switch Successful", + "switchFail": "Switch Fail", + "seeMore": "See more >" + }, + "share": { + "userDetail": "User Details", + "userMsg": "User Information ", + "userId": "userId:", + "userName": "userName:", + "phoneNumber": "phoneNumber:", + "userPermissions": "User permissions", + "remark": "Remark", + "notRemark": "There are currently no notes available", + "confirmShare": "Confirm Share", + "deviceUpgradation": "Device upgradation", + "otaUpgradation": "Device OTA upgradation", + "timing": "Device Timing", + "timedTaskExecution": "Timed task execution", + "deviceLog": "Device Log", + "contains": "Contains event logs and instruction logs", + "monitior": "Monitior", + "afterMonitior": "After Issuing Real-time Monitoring Instructions, The Chart Displays The Data Reported By The Device In Real Time", + "monitioringStatic": "Monitoring Statistics", + "chartDisplay": "Chart Displays Stored Historical Monitoring Data", + "deviceShareSuccess": "Device Sharing Successful", + "title": "prompted", + "alert": "Are you sure to delete the current user ?", + "delete": "Delete...", + "inputUserPhone": "Please enter the user's mobile phone number ", + "deviceShare": "Share Device", + "query": "query", + "sharedUsers": "Shared Users", + "master": "master", + "share": "Share", + "unable": "Unable to find user information, or the user is already a device user", + "correct": "Please enter the correct phone number" + }, + "sceneDetail": { + "inputName": "Please Enter A Name", + "sceneState": "Scene State", + "trigger": "Trigger", + "addConditions": "Add Conditions", + "deviceNumber": "Number Of Devices", + "deviceOnline": "Device Online", + "Equipment": "Equipment Offline", + "action": "Execute Action", + "addTask": "Add Task", + "alertExecute": "Alarm Execution", + "moreSetting": "More Settings", + "silentTimeAlert": "Silent Time: Within The Set Time Range, It Will No Longer Be Executed Repeatedly;Delay Execution: The Delay Will Not Be Stored And Is limited To 90 Seconds.", + "silentTime": "Silent Time", + "inputTime": "Please Enter The Silence Time", + "minute": "Minute", + "executionMethod": "Execution Method", + "serial": " Serial", + "parallel": "Parallel", + "delayed ": "Delayed Execution", + "inputExtensionTime": "Please Enter An Extension Time ", + "seconds": "Seconds", + "complete": "Complete", + "deviceTriggered": "Device Triggered", + "productTriggering": "Product Triggering", + "timedTrigger": "Timed Trigger", + "deviceExecution": "Device Execution", + "productExecution": "Product Execution", + "sceneValidate": "Scene name cannot be empty", + "triggerValidate": "Trigger condition cannot be empty", + "taskValidate": "Task execution cannot be empty", + "tips": "Tips" + }, + "product": { + "inputDeviceName": "Please Input DeviceName", + "next": "Next", + "selectThingModel": "Selcet ThingsModel", + "attribute": "attribute", + "function": "function", + "event": "Event", + "selectDevice": "Please Select DeviceName", + "selectThingsModels": "Please Select ThingsModels", + "inputProduct": "Please input Product Name", + "selectProducts": "Please Select Product", + "operator": "Operator", + "selectOperator": "select Operator", + "on": "ON", + "off": "OFF", + "input": "Please Enter", + "inputValue": "Please Set corresponding values", + "selectValue": "Please Select Value", + "timedName": "Timed name cannot be empty", + "taskExecution": "Task execution cannot be empty" + }, + "sceneTiming": { + "time": "Time", + "selectTime": "Please Select Time", + "again": "Again", + "selectWeek": "Please Select Week", + "default": "Default", + "auto": "Auto", + "inputCRON": "Please Input CRON", + "expression": "Generate expression", + "monday": "Monday", + "tuesday": "Tuesday", + "wednesday": "Wednesday", + "thursday": "Thursday", + "friday": "Friday", + "saturday": "Saturday", + "sunday": "Sunday", + "everyDay": "EveryDay", + "status": "Timing Status", + "trigger": "The trigger has only one timing, and the alarm during the execution action is invalid", + "alarm": "Alarm execution", + "develop": "Under development...", + "select": "Please select an alarm" + }, + "alert": { + "inputAlertName": "Please input alert name", + "all": "All", + "pending": "Pending", + "untreated": "Untreated", + "processed": "Processed", + "notice": "Notice", + "minor": "Minor", + "warning": "Warning", + "alertName": "Alert Name", + "processState": "Process State", + "data": "Data", + "alertTime": "Alert Time", + "process": "Process", + "alertInformation": "Warning Information", + "serialNumber": "Serial Number", + "deviceName": "Device Name", + "alertType": "Alert Level", + "alertProcess": "Alert Process", + "processAlert": "Process Alert", + "processResult": "Process Result", + "processTime": "Process Time", + "inputProcessMsg": "Please input process message, do not fill" + }, + "status": { + "deviceVersion": "Version", + "deviceFirmware": "Device Firmware Upgrade", + "grade": "grade", + "noNeedToUpgrade": "It Is Already The Latest Version, No Need To Upgrade", + "upgraded": "There Is A New Version That Can Be Upgraded", + "name": "Name:", + "version": "Version:", + "description": "Description:", + "inputString": "Please Enter A String", + "unit": "Unit", + "send": "Send Out", + "decimals": "Please Enter Decimals", + "integer": " Please Enter An Integer", + "monitior": "Monitoring Data", + "offline": "Data When The Device Is Offline", + "service": "Service Call Successful", + "equip": "Equipment Upgrade", + "online": "Device Online", + "shadow": "Shadow Mode", + "deviceOffline": "Device Offline", + "control": "Equipment control", + "stateModel": "State Model", + "dataModel": "Data Model", + "devDetail": "Device Detail" + }, + "deviceAdd": { + "addDevice": "Add Device", + "wifi": "Name", + "inputWifiName": "Please Enter The WIFI Name", + "passsword": "Password", + "inputWifiPassword": "Please Enter The WIFI Password", + "remember": "Remember Password", + "senior": "Senior", + "userId": "User Number", + "inputUserId": "Please Enter The User Number", + "deviceNum": "DeviceNum", + "inputDeviceNum": "Please Enter The Device Number", + "authorization": "Authorization Code", + "inputAuthor": "Please Enter The Authorization Code", + "supplementary": "Supplementary Information", + "inputSupplementary": "Please Enter Supplementary Information", + "step1": "Step 1: Fill in WIFI information", + "step2": "Step 2: The Device Enters Distribution Network Mode", + "step3": "Step 3: Distribution Network", + "single": "Single", + "multiple": "Multiple", + "networkMode": "Equipment Enters Distribution Network Mode", + "wifiHotspot": "The Device Will Activate WIFI Hotspot", + "manually": "Manually Connecting Device Hotspots", + "mobile": "Mobile Phone Connection Device WIFI Hotspot", + "detection": "Detection Equipment", + "system": "System Automatic Detection", + "end": "End Of Distribution Network", + "reconnected": "Mobile Phone Can Be Reconnected To WIFI", + "startWork": "Start Network Distribution", + "redistributingNetwork": "Redistributing The Network", + "after": "After Reconnecting ThePhone To WiFi, Return To View", + "tip": "Tip: Currently, Multi Device Networking Only Supports WeChat Mini Programs And Requires Enabling The Mobile WiFi Switch", + "noData": "No Further Data Available At The Moment", + "select": "Please Select A Device Hotspot", + "refresh": "Refresh", + "start": "Start Distribution Network", + "distribution": "Distribution network...", + "connect": "Connecting to network...", + "return": "Return To View", + "noDevice": "No device detected", + "wifiName": "WIFI Name cannot be empty", + "wifiPassword": "WIFI Password Cannot be empty", + "userNum": "userName is Cannot be empty", + "deviceDetected": "Device detected", + "userIdAndWifiAccount": "User ID and WIFI account password cannot be empty", + "sendInformation": "Send configuration information...", + "successNetwork": "Network configuration successful. If the device is not connected properly, please check if the WIFI information is correct and the network condition", + "fail": "Distribution network failed. Please confirm that the device has entered distribution network mode and is connected to the hotspot", + "selectNetwork": "Please select a device hotspot", + "successDistribution": "Successful distribution network", + "afterNetwork": "After network configuration, please connect to the WiFi network for internet connection.", + "failNetwork": "Network configuration failed", + "phoneTurnOn": "Please ensure that your phone's WiFi is turned on, and then re-enter the page", + "prepare": "Prepare the distribution network", + "miniProgrem": "Failed to start WiFi module, please reopen the mini program" + }, + "linkDevice": { + "linkDevice": "Device Linkage", + "scan": "Scan", + "deviceNum": "DeviceNum", + "productNum": "ProductNum", + "productName": "ProductName", + "userName": "userName cannot be empty", + "deviceEmpty": "deviceNum cannot be empty", + "productIdEmpty": "productId cannot be empty ", + "format": "Parsing QR code, incorrect format", + "inputDeviceId": "Please Input DeviceId", + "inputProductId": "Please Input productId", + "product": "ProductName can be left blank" + }, + "group": { + "equipment": "Device Grouping", + "add": " Add Device", + "detail": "Details", + "select": "Select Device", + "update": "Device Update Successful", + "name": "Name", + "inputName": "Please Enter The Group Name", + "sort": "Sort", + "inputSort": "Please Enter Grouping Sorting", + "remark": "Remarks", + "content": "Please Enter The Content", + "groupName": "Group Name Cannot Be Empty", + "serialNumber": "The Serial Number Cannot Be Empty", + "updateGroup": "Update Group", + "submit": "Submitting", + "system": "System Prompt", + "delete": "Are You Sure To Delete The Current Group ?", + "deleting": "Deleting...", + "inputContent": "Please enter keywords", + "nomore": "No More", + "confirm": "Confirm", + "cancel": "Cancel" + }, + "log": { + "all": "All", + "function": "function", + "attribute": "Attribute reporting", + "event": "Event reporting", + "online": "online", + "offline": "offline", + "upgrade": "Upgrade", + "element": "Element", + "service": "Service distribution", + "acquisition": "Attribute acquisition", + "ota": "OTA Upgrade" + }, + "modbus": { + "deviceName": "Device Name", + "firmware": "Firmware version", + "inputDeviceName": "Please Enter Device Name", + "inputVersion": "Please Enter Firmware version", + "time": "Time", + "range": "Range", + "unknown": "unknown" + }, + "message": { + "message": "message", + "inform": "Inform", + "notice": "Notice", + "noticeDetail": "Notice Detail", + "noContent": "There is currently no content available", + "config": "Equipment configuration", + "NTP": "NTP address", + "productConfig": "Product configuration", + "productPassword": "Product Password", + "mqttConfig": "Mqtt Configuration", + "mqttAddress": "Mqtt Address", + "mqttAccount": " Mqtt Account", + "mqttPassword": " Mqtt Password", + "save": "Save Config", + "report": "Reporting attributes", + "reportfunction": "Reporting function", + "event": "Reporting Event", + "abtainTime": "Get Time", + "monitior": "Reporting monitoring data", + "mobile": "Mobile Phone monitoring", + "function": "Function", + "call": "Call", + "bright": "screen brightness", + "vibration": "vibration", + "bluetooth": "Bluetooth", + "photo": "Taking photos", + "record": "Recording", + "videos": "Videos", + "attribute": "attribute", + "information": "Device Information", + "pointer": "Acceleration pointer", + "gyroscope": "gyroscope", + "compass": "compass", + "memory": "insufficient memory", + "network": "Network changes", + "screenshot": "User screenshot", + "setting": "System Setting", + "system": "system configuration", + "address": "Server address", + "text": "Text", + "statusReset": "Device status reset", + "reset": "Reset", + "mqttReconnection": "Mqtt reconnection", + "reconnection": "reconnection" + }, + "avatar": { + "cropping": "Cropping", + "album": "album", + "relieve": "relieve" + }, + "player": { + "stream": "Live streaming on devices", + "replay": "Replay Theater", + "play": "Play", + "suspend": "suspend", + "enlarge": "enlarge", + "narrow": "narrow", + "recording": "Select recording date", + "storage": "Device storage", + "screenshot": "screenshot", + "channel": "Device Channel", + "loading": "Loading", + "noRecording": "There is no recording in the current channel", + "purchase": "Commercial version, please purchase authorization, loading in progress", + "monitior": "Monitoring details" + }, + "waitLogin": { + "loginOrregister": "Login/Register", + "ExperienceAccountLogin": "Experience account login", + "agree": "I have read and agree", + "privacy": "Privacy Policy", + "agreement": "User Agreement", + "children": "Children's Privacy Protection Statement", + "third": "Third-Party Sharing and SDK List" + }, + "indeScada": { + "inputScada": "Please enter a scada name", + "search": "Search", + "tryingToLoad": "Trying To Load...", + "gentlyPullUp": "Gently Pull Up", + "nothingLeft": "There's Really Nothing Left", + "emptyData": "Data Is Empty" + }, + "deviceHistory": { + "lastTwoHours": "last 2 hours", + "lastOneDay": "last 1 day", + "lastThirtyDay": "last 30 day", + "custom": "custom", + "inputDate": "starting time", + "cancel": "Cancel", + "nextStep": "Next Step", + "confirm": "Confirm", + "filtrate": "Filtrate", + "variable": "Variable", + "updateTime": "Update Time", + "emptyTable": "No further data available", + "emptyData": "No data" + } +} \ No newline at end of file diff --git a/locale/index.js b/locale/index.js new file mode 100644 index 0000000..6277376 --- /dev/null +++ b/locale/index.js @@ -0,0 +1,6 @@ +import en from './en-US.json'; +import zhHans from './zh-CN.json'; +export default { + 'zh-CN': zhHans, + 'en-US': en, +} \ No newline at end of file diff --git a/locale/zh-CN.json b/locale/zh-CN.json new file mode 100644 index 0000000..d73a835 --- /dev/null +++ b/locale/zh-CN.json @@ -0,0 +1,697 @@ +{ + "locale.en-US": "English", + "locale.zh-CN": "简体中文", + "navBar.login": "登录", + "navBar.registration": "用户注册", + "navBar.loginBinding": "用户登录绑定", + "navBar.registrationBinding": "用户注册绑定", + "navBar.smsBogin": "短信登录", + "navBar.home": "首页", + "navBar.scene": "场景", + "navBar.alert": "告警", + "navBar.news": "动态", + "navBar.user": "我的", + "navBar.browse": "浏览网页", + "navBar.sceneDetail": "场景详情", + "navBar.sceneList": "场景列表", + "navBar.productList": "产品列表", + "navBar.deviceList": "设备列表", + "navBar.physicalModels": "物模列表", + "navBar.alarmList": "告警列表", + "navBar.timer": "定时器", + "navBar.alarmLog": "告警记录", + "navBar.alarmHandling": "告警处理", + "navBar.deviceDetails ": "设备详情", + "navBar.timedList": "定时列表", + "navBar.timedDetails": "定时详情", + "navBar.dynamic": "最新动态", + "navBar.dynamicDetails": "动态详情", + "navBar.classification": "分类动态", + "navBar.addDevice": "添加设备", + "navBar.associatedDevices": "关联设备", + "navBar.deviceSharing": "设备分享", + "navBar.shareDetails": "分享用户详情", + "navBar.latest": "最新消息", + "navBar.newsDetail": "消息详情", + "navBar.setting": "系统设置", + "navBar.simulation": "设备模拟", + "navBar.mobile": "手机监控", + "navBar.account": "账号信息", + "navBar.language": "多语言", + "navBar.updateAvatar": "修改头像", + "navBar.unbind": "解除微信绑定", + "navBar.group": "设备分组", + "navBar.running": "运行状态", + "navBar.updateGroup": "编辑分组", + "navBar.updateDevice": "设备修改", + "navBar.eventLog": "事件日志", + "navBar.orderLog": "指令日志", + "navBar.player": "播放器", + "common.fastbee": "芯程物联", + "common.add": "添加", + "common.delete": "删除", + "common.save": "保存", + "common.cancel": "取消", + "common.confirm": "确认", + "common.back": "返回", + "common.edit": "编辑", + "common.updateSuccessful": "编辑成功", + "common.addSuccessful": "新增成功", + "common.saveError": "保存失败", + "common.saveSuccessful": "保存成功", + "common.operation": "操作成功", + "common.search": "搜索", + "common.tips": "提示", + "common.loginTips": "该功能需要登录后才可使用,是否去登录?", + "login": { + "accountLogin": "账号登录", + "inputUserName": "请输入用户名", + "inputPassword": "请输入密码", + "inputCode": "请输入验证码", + "login": "登录", + "exampleAccount": "演示账号: fastbee 123456", + "HuapuIoT": "华普物联", + "registerNow": "现在注册", + "readAndAgree": "已阅读并同意", + "serviceAgreement": "服务协议", + "and": "与", + "privacyPolicy": "隐私政策", + "childProtectionStatement": "儿童隐私保护声明", + "commonBill": "第三方共享与SDK清单", + "readAndCheckTheAgreement": "请阅读并勾选协议", + "accontMsg": "账号信息不能为空", + "phoneLogin": "手机号快捷登录", + "welcomeToLogin": "欢迎登录峰信物联", + "phoneAuthorization": "手机授权登录", + "remember": "记住密码", + "other": "其他方式登录" + }, + "register": { + "userRegister": "用户注册", + "inputUserName": "请输入用户名", + "inputPhone": "请输入手机号码", + "inputPassword": "请输入密码", + "inputPasswordAgain": "请再次输入密码", + "inputUserNameSize": "请输入用户名,长度大于4", + "inputCode": "请输入验证码", + "registration": "注册", + "accountLogin": "已有账号登录", + "congratulations": "恭喜你,您的账号", + "registeredSuccessfully": "注册成功" + }, + "smsLogin": { + "smsLogin": "短信登录", + "inputPhone": "请输入手机号码", + "inputCode": "请输入验证码", + "login": "登录", + "HuapuIoT": "华普物联", + "accountLogin": "账号登录", + "obtainCode": "获取验证码", + "correctPhone": "请输入正确的手机号码", + "obtainSmsCode": "正在获取验证码", + "codeSent": "验证码已发送", + "sending": "倒计时结束在发送!" + }, + "bindLogin": { + "bindLogin": "账号绑定登录", + "bindRegister": "注册绑定", + "alert": "提示", + "alertTitle": "账户不存在,您是否要注册新账户", + "notRegister": "暂不注册", + "confirmRegister": "确认注册", + "accountNotNull": "账号不能为空", + "bind": "绑 定" + }, + "bindRegister": { + "bindRegister": "绑 定 注 册", + "incorrectPhone": "手机号码格式不正确", + "inputPasswordSize": "请输入密码且长度大于", + "enterPasswordsDiffer": "两次输入的密码不一致" + }, + "user": { + "personalCentre": "个人中心", + "openIOT": "芯程物联", + "addDevice": "添加设备", + "addScene": "添加场景", + "groupManagement": "分组管理", + "platformMsg": "平台消息", + "ordinaryMembers": "普通会员", + "currentAccountAlert": "当前账号未开通会员", + "openAtOnce": "立即开通", + "account": "账号", + "messages": "信息", + "signOut": "注销账号", + "about": "关于", + "language": "语言设置", + "appDownload": "app下载", + "exitAccount": "退出登录", + "confirmExit": "确认退出账号", + "confirmSignOut": "账户注销确认", + "signOutAlert": "账户注销后,所有信息将被清空,且无法恢复,您是否要注销?", + "notWriteOff": "暂不注销", + "confirmWriteOff": "确认注销", + "confirmWxBind": "微信绑定确认", + "wxBindAlertTitle": "您是否要绑定微信", + "notBind": "暂不绑定", + "confirmBind": "确认绑定", + "saveSuccess": "保存成功", + "occurError": "发生错误", + "scanning": "扫码只支持App和小程序", + "parseQrCode": "解析二维码后,找不到对应处理类型", + "errorParseQRcode": "解析二维码错误,格式不正确", + "language-01": "多语言", + "updatePassword": "密码修改", + "login": "登陆/注册", + "visitor": "游客", + "configuration": "独立组态", + "notice": "该功能需要登录才可使用,是否去登录?" + }, + "account": { + "avatar": "用户头像", + "nikeName": "用户昵称", + "email": "电子邮箱", + "phone": "电话号码", + "createTime": "创建时间", + "Ip": "IP", + "save": "保存", + "inputNickname": "请输入用户昵称", + "inputEmail": "请输入电子邮箱", + "inputPhone": "请输入电话号码", + "inputCreatetime": "请输入创建时间", + "inputIP": "请输入登录ip", + "incorrectEmail": "邮箱号码格式不正确" + }, + "home": { + "netWork": "配网添加", + "wifi-type": "通用于WIFI类型的设备", + "qrCode": "扫码添加", + "networksDevices": "适用于蜂窝网络/以太网类设备", + "association": "关联添加", + "supportBatchOperations": "适用于蜂窝网络/以太网类设备,并支持批量操作", + "errorLoading": "加载失败", + "serialNumber": "设备编号", + "productName": "产品名称", + "sureAdd": "确定添加吗", + "notActive": "未激活", + "disabled": "禁用", + "onLine": "在线", + "offline": "离线", + "shadow": "影子", + "all": "全部", + "eventLog": "事件日志", + "Instructionlog": "指令日志" + }, + "about": { + "about": "关于", + "authorQQ": "作者企鹅:164770707", + "authorWechat": "作者微信:QQ164770707", + "group": "交流群:720136372,1073236354", + "webSite": "官方网站", + "SourceCode": "查看源码", + "open": "开源物联网平台 Version 2.5.1", + "message": "曲靖蜂信科技有限公司 | 华普物联 | 官网 fastbee.cn" + }, + "deviceDetail": { + "basicMsg": "基本信息", + "deviceName": "设备名称", + "position": "定位方式", + "longitude": "设备经度", + "latitude": "设备纬度", + "address": "所在地址", + "shadow": "设备影子", + "disabledDevice": "禁用设备", + "remark": "备注信息", + "inputMsg": "请输入内容", + "inputLongitude": "请输入设备经度", + "inputLatitude": "请输入设备经度", + "loadingFail": "加载失败", + "veryGood": "极好", + "excellent": "优", + "good": "良", + "average": "中", + "poor": "差", + "device": "设备", + "timing": "定时", + "journal": "日志", + "static": "统计", + "share": "分享", + "preserve": "保存", + "deviceStatus": "设备状态", + "serialNumber": "设备编号", + "belongingProducts": "所属产品", + "firmwareVersion": "固件版本", + "positionMethod": "定位方式", + "equipmentSignal": "设备信号", + "address": "所在地址", + "networkAddress": "入网地址", + "activationTime": "激活时间", + "deleteDevice": "删除设备", + "runningStatus": "运行状态", + "monitor": "实时监测", + "deviceDetail": "设备详情", + "channel": "设备通道", + "autoPosition": "自动定位", + "devicePosition": "设备定位", + "customLocation": "自定义位置", + "deviceCheck": "设备名称不能为空", + "positionCheck": "定位方式不能为空", + "updateSuccess": "修改成功", + "Overview": "设备概况", + "Surveillance": "视频监控", + "Alert": "告警记录", + "scada": "组态", + "emptyNull": "数据为空" + }, + "timing": { + "timingName": "请输入定时名称", + "search": "搜索", + "execute": "执行一次", + "effortLoading": "努力加载中...", + "loadMore": "点击我加载更多", + "nothing": "实在没有了", + "emptyNull": "数据为空", + "all": "全部", + "enable": "启用", + "notEnabled": "未启用", + "nosupported": "暂不支持微信小程序", + "wap2": "请使用wap2app方式打包!" + }, + "deviceStatic": { + "selectSub": "请选择设备从机", + "rangeTime": "开始时间 - 结束时间", + "selectTime": "选择时间范围", + "search": "查询" + }, + "monitior": { + "monitoringInterval": "监测间隔(ms) 和 次数:", + "inputNumber": "输入间隔毫秒数", + "inputTimes": " 输入次数", + "stop": "停止", + "monitior": "监测", + "receivingData": "正在接收数据...", + "MonitoringRange": "监测的间隔范围500-10000毫秒", + "monitoringQuantity": " 监测数量范围1-300", + "real-timeMonitor": "实时监测", + "stopMonitor": "停止监测" + }, + "scene": { + "sceneLink": "场景联动", + "inputSceneName": "请输入场景名称", + "search": "搜索", + "condition": "条件", + "way": "方式", + "task": "任务", + "execute": "执行一次", + "tryingToLoad": "努力加载中...", + "gentlyPullUp": "轻轻上拉", + "nothingLeft": "实在没有了", + "emptyData": "数据为空", + "administration": "管理", + "alarm": "告警", + "anyCondition": "任意条件", + "allCondition": "所有条件", + "notConditions": "不满足条件", + "unknown": "未知", + "serial": "串行", + "parallel": "并行", + "switchSuccessful": "切换成功", + "switchFail": "切换失败", + "seeMore": "查看更多 >" + }, + "share": { + "userDetail": "用户详情", + "userMsg": "用户信息", + "userId": "用户编号:", + "userName": "用户名称:", + "phoneNumber": "手机号码:", + "userPermissions": "设置用户权限", + "notRemark": "暂无备注", + "remark": "备注信息", + "confirmShare": "确认分享", + "deviceUpgradation": "设备升级", + "otaUpgradation": "设备OTA升级", + "timing": "设备定时", + "timedTaskExecution": "定时执行任务", + "deviceLog": "设备日志", + "contains": "包含事件日志和指令日志", + "monitior": "实时监测", + "afterMonitior": "下发实时监测指令后,图表实时显示设备上报数据", + "monitioringStatic": "监测统计", + "chartDisplay": "图表显示存储的历史监测数据", + "deviceShareSuccess": "设备分享成功", + "title": "系统提示", + "alert": "确定删除当前用户吗?", + "delete": "删除中...", + "inputUserPhone": "请输入用户手机号码", + "deviceShare": "设备分享", + "query": "查 询", + "sharedUsers": "已分享用户", + "master": "主人", + "share": "分享", + "unable": "查询不到用户信息,或者该用户已经是设备用户", + "correct": "请输入正确手机号码" + }, + "sceneDetail": { + "inputName": "请输入名称", + "sceneState": "场景状态", + "trigger": "触发器", + "addConditions": "添加条件", + "deviceNumber": "设备数量", + "deviceOnline": "设备上线", + "Equipment": "设备下线", + "action": "执行动作", + "addTask": "添加任务", + "alertExecute": "告警执行", + "moreSetting": "更多设置", + "silentTimeAlert": "静默时间:在设定的时间范围内将不再重复执行;延时执行:延时不会存储,限制为90秒内。", + "silentTime": "静默时间", + "inputTime": "请输入静默时间", + "minute": "分钟", + "executionMethod": "执行方式", + "serial": "串行", + "parallel": "并行", + "delayed ": "延时执行", + "inputExtensionTime": "请输入延长时间 ", + "seconds": "秒钟", + "complete": "完成", + "deviceTriggered": "设备触发", + "productTriggering": "产品触发", + "timedTrigger": "定时触发", + "deviceExecution": "设备执行", + "productExecution": "产品执行", + "sceneValidate": "场景名称不能为空", + "triggerValidate": "触发条件不能为空", + "taskValidate": "执行任务不能为空", + "tips": "温馨提示" + }, + "product": { + "inputDeviceName": "请输入设备名称", + "next": "下一步", + "selectThingModel": "物模型选择", + "attribute": "属性", + "function": "功能", + "event": "事件", + "selectDevice": "请选择设备", + "selectThingsModels": "请选择物模型", + "inputProduct": "请输入产品名称", + "selectProducts": "请选择产品", + "operator": "操作符", + "selectOperator": "请选择操作符", + "on": "开", + "off": "关", + "input": "请输入", + "inputValue": "请设置对应值", + "selectValue": "请选择值", + "timedName": "定时名称不能为空", + "taskExecution": "执行任务不能为空" + }, + "sceneTiming": { + "time": "时间", + "selectTime": "请选择时间", + "again": "重复", + "selectWeek": "请选择星期", + "default": "默认", + "auto": "自定义", + "inputCRON": "请输入CRON", + "expression": "生成表达式", + "monday": "周一", + "tuesday": "周二", + "wednesday": "周三", + "thursday": "周四", + "friday": "周五", + "saturday": "周六", + "sunday": "周天", + "everyDay": "每天", + "status": "定时状态", + "trigger": "触发器有且只有一个定时,执行动作中的告警无效", + "alarm": "告警执行", + "develop": "开发中...", + "select": "请选择告警" + }, + "alert": { + "inputAlertName": "请输入告警名称", + "all": "全部", + "pending": "待处理", + "untreated": "无需处理", + "processed": "已处理", + "notice": "提醒通知", + "minor": "轻微问题", + "warning": "严重警告", + "alertName": "告警名称", + "processState": "处理状态", + "data": "数据", + "alertTime": "告警时间", + "process": "处理", + "alertInformation": "告警信息", + "serialNumber": "设备编号", + "deviceName": "设备名称", + "alertType": "告警级别", + "alertProcess": "告警处理", + "processAlert": "处理告警", + "processResult": "处理结果", + "processTime": "处理时间", + "inputProcessMsg": "请输入处理内容,可不填" + }, + "status": { + "deviceVersion": "设备版本", + "deviceFirmware": "设备固件升级", + "grade": "升级", + "noNeedToUpgrade": "已经是最新版本,不需要升级", + "upgraded": "有新版本可以升级", + "name": "名称:", + "version": "版本:", + "description": "描述:", + "inputString": "请输入字符串", + "unit": "单位", + "send": "发送", + "decimals": "请输入小数", + "integer": "请输入整数", + "monitior": "监测数据", + "offline": "设备离线时状态", + "service": "服务调用成功", + "equip": "设备升级", + "online": "设备在线", + "shadow": "影子模式", + "deviceOffline": "设备离线", + "control": "设备控制", + "stateModel": "状态模式", + "dataModel": "数据模式", + "devDetail": "设备详情" + }, + "deviceAdd": { + "addDevice": "添加设备", + "wifi": "WIFI名称", + "inputWifiName": "请输入WIFI名称", + "passsword": "WIFI密码", + "inputWifiPassword": "请输入WIFI密码", + "remember": "记住密码", + "senior": "高级", + "userId": "用户编号", + "inputUserId": "请输入用户编号", + "deviceNum": "设备编号", + "inputDeviceNum": "请输入设备编号", + "authorization": "授 权 码", + "inputAuthor": "请输入授权码", + "supplementary": "补充信息", + "inputSupplementary": "请输入补充信息", + "step1": "第一步: 填写WIFI信息", + "step2": "第二步: 设备进入配网模式", + "step3": "第三步: 配网", + "single": "单设备", + "multiple": "多设备", + "networkMode": "设备进入配网模式", + "wifiHotspot": "设备会启动WIFI热点", + "manually": "手动连接设备热点", + "mobile": "手机连接设备WIFI热点", + "detection": "检测设备", + "system": "系统自动检测", + "end": "配网结束", + "reconnected": "手机可重新连接WIFI", + "startWork": "开始配网", + "redistributingNetwork": "重新配网", + "after": "手机重连Wifi后, 返回查看", + "tip": "提示:多设备配网目前只支持微信小程序, 需要启用手机Wifi开关 ", + "noData": "暂无更多数据", + "select": "请选择设备热点", + "refresh": "刷新", + "start": "开始配网", + "distribution": "配网中...", + "connect": "正在连接网络...", + "return": "返回查看", + "noDevice": "未检测到设备", + "wifiName": "WIFI名称不能为空", + "wifiPassword": "WIFI密码不能为空", + "userNum": "用户编号不能为空", + "deviceDetected": "已检测到设备", + "userIdAndWifiAccount": "用户编号和WIFI账号密码不能为空", + "sendInformation": "发送配置信息...", + "successNetwork": "配网成功,如果设备没有正常连接,请检查WIFI信息是否正确以及网络状况", + "fail": "配网失败,请确认设备进入配网模式,并连接了该热点", + "selectNetwork": "请选择设备热点", + "successDistribution": "配网成功", + "afterNetwork": "配网后,请连接上网用的Wifi", + "failNetwork": "配网失败", + "phoneTurnOn": "请确保手机Wifi已打开,然后重新进入页面", + "prepare": "准备配网", + "miniProgrem": "启动Wifi模块失败,请重新打开小程序" + }, + "linkDevice": { + "linkDevice": "关联设备", + "scan": "扫码识别", + "deviceNum": "设备编号", + "productNum": "产品编号", + "productName": "产品名称", + "userName": "用户名不能为空", + "deviceEmpty": "设备编号不能为空", + "productIdEmpty": "产品ID不能为空 ", + "format": "解析二维码,格式不正确", + "inputDeviceId": "请输入设备编号", + "inputProductId": "请输入产品编号", + "product": "产品名称可不填" + }, + "group": { + "equipment": "设备分组", + "add": "添加设备", + "detail": "详情", + "select": "选择设备", + "update": "设备更新成功", + "name": "名称", + "inputName": "请输入分组名称", + "sort": "排序", + "inputSort": "请输入分组排序", + "remark": "备注", + "content": "请输入内容", + "groupName": "分组名称不能为空", + "serialNumber": "序号不能为空", + "updateGroup": "修改分组", + "submit": "提交中...", + "system": "系统提示", + "delete": "确定删除当前分组吗?", + "deleting": "删除中...", + "inputContent": "请输入关键字", + "nomore": "没有更多了", + "confirm": "确认", + "cancel": "取消" + }, + "log": { + "all": "全部", + "function": "功能调用", + "attribute": "属性上报", + "event": "事件上报", + "online": "设备上线", + "offline": "设备离线", + "upgrade": "设备升级", + "element": "元素", + "service": "服务下发", + "acquisition": "属性获取", + "ota": "OTA升级" + }, + "modbus": { + "deviceName": "设备名", + "firmware": "固件版本", + "inputDeviceName": "请填写设备名", + "inputVersion": "请填写固件版本", + "time": "时间", + "range": "数据范围", + "unknown": "未知" + }, + "message": { + "message": "消息", + "inform": "通知", + "notice": "公告", + "noticeDetail": "公告详情", + "noContent": "暂无内容...", + "config": "设备配置", + "NTP": " NTP地址", + "productConfig": "产品配置", + "productPassword": "产品秘钥", + "mqttConfig": "Mqtt配置", + "mqttAddress": "Mqtt地址", + "mqttAccount": " Mqtt账号", + "mqttPassword": " Mqtt密码", + "save": "保存配置", + "report": "上报属性", + "reportfunction": "上报功能", + "event": "上报事件", + "abtainTime": "获取时间", + "monitior": "上报监测数据", + "mobile": "手机监控", + "function": "功能", + "call": "拨打电话", + "bright": "屏幕亮度", + "vibration": "震动", + "bluetooth": "蓝牙", + "photo": "拍照", + "record": "录音", + "videos": "视频", + "attribute": "属性", + "information": "设备信息", + "pointer": "加速指针", + "gyroscope": "陀螺仪", + "compass": "罗盘", + "memory": "内存不足", + "network": "网络变化", + "screenshot": "用户截屏", + "setting": "系统设置", + "system": "系统配置", + "address": "服务端地址", + "text": "测试", + "statusReset": "设备状态重置", + "reset": "重置", + "mqttReconnection": "Mqtt重连", + "reconnection": "重连" + }, + "avatar": { + "cropping": "裁剪", + "album": "相册", + "relieve": "解 除" + }, + "player": { + "stream": "设备直播", + "replay": "录像回放", + "play": "播放", + "suspend": "暂停", + "enlarge": "放大", + "narrow": "缩小", + "recording": "选择录像日期", + "storage": "设备存储", + "screenshot": "截图", + "channel": "设备通道", + "loading": "加载中...", + "noRecording": "当前通道没有录像", + "purchase": "商用版请购买授权,加载中", + "monitior": "监控详情" + }, + "waitLogin": { + "loginOrregister": "登录/注册", + "ExperienceAccountLogin": "体验账号登录", + "agree": "我已阅读并同意", + "privacy": "隐私政策", + "agreement": "用户协议", + "children": "儿童隐私保护申明", + "third": "第三方共享与SDK清单" + }, + "indeScada": { + "inputScada": "请输入组态名称", + "search": "搜索", + "tryingToLoad": "努力加载中...", + "gentlyPullUp": "轻轻上拉", + "nothingLeft": "实在没有了", + "emptyData": "数据为空" + }, + "deviceHistory": { + "lastTwoHours": "最近2小时", + "lastOneDay": "最近1天", + "lastThirtyDay": "最近30天", + "custom": "自定义", + "inputDate": "起始时间", + "cancel": "取消", + "nextStep": "下一步", + "confirm": "确定", + "filtrate": "筛选", + "variable": "变量", + "updateTime": "更新时间", + "emptyTable": "暂无更多数据", + "emptyData": "暂无数据" + } +} \ No newline at end of file diff --git a/main.js b/main.js new file mode 100644 index 0000000..dd55a41 --- /dev/null +++ b/main.js @@ -0,0 +1,55 @@ +import Vue from 'vue'; +import App from './App'; +import store from '@/store'; +import * as filters from '@/common/filters.js'; +import mqttTool from '@/common/mqttTool.js'; +import bus from "@/common/bus.js" + +Vue.prototype.$mqttTool = mqttTool; +Vue.prototype.$bus = bus; + +// 注入全局过滤器 +Object.keys(filters).forEach(key => { + Vue.filter(key, filters[key]) +}) + +// 引入uview +import uView from '@/uni_modules/uview-ui'; +Vue.use(uView); + +// 全局引入vuex +let vuexStore = require("@/store/$u.mixin.js"); +Vue.mixin(vuexStore); + +// 引入扩展方法 +import '@/common/extend.js'; +Vue.config.productionTip = false + +App.mpType = 'app' + +import VueI18n from 'vue-i18n'; +import messages from '@/locale'; +Vue.use(VueI18n); +const i18n = new VueI18n({ + locale: wx.getStorageSync('language') || 'zh-CN', + messages, // 设置语言环境信息 + silentFallbackWarn: true, +}) +Vue.prototype.$tt = Vue.prototype.$t; //设置别名,因为$t已经在项目中有使用 +const app = new Vue({ + store, + i18n, + ...App +}) +// http拦截器,将此部分放在new Vue()和app.$mount()之间,才能App.vue中正常使用 +import httpInterceptor from '@/apis/http.interceptor.js' +Vue.use(httpInterceptor, app) + +// http接口API集中管理引入部分 +import httpApi from '@/apis/http.api.js' +Vue.use(httpApi, app) + +import tools from '@/common/tools.js'; +Vue.use(tools, app) + +app.$mount() \ No newline at end of file diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..83969b1 --- /dev/null +++ b/manifest.json @@ -0,0 +1,182 @@ +{ + "name" : "芯程物联", + "appid" : "__UNI__BEE3050", + "description" : "开源物联网平台", + "versionName" : "2.2.0", + "versionCode" : 200, + "transformPx" : false, + "app-plus" : { + "kernel" : { + "ios" : "WKWebview" + }, + "usingComponents" : true, + "nvueCompiler" : "uni-app", + "compilerVersion" : 3, + "splashscreen" : { + "alwaysShowBeforeRender" : true, + "waiting" : true, + "autoclose" : true, + "delay" : 0 + }, + "modules" : { + "Barcode" : {}, + "OAuth" : {}, + "Camera" : {} + }, + "distribute" : { + "android" : { + "permissions" : [ + "", + "", + "", + "", + "", + "", + "", + "", + "" + ], + "minSdkVersion" : 22, + "targetSdkVersion" : 30, + "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ], + "permissionExternalStorage" : { + "request" : "none", + "prompt" : "应用保存运行状态等信息,需要获取读写手机存储权限,请允许。" + }, + "permissionPhoneState" : { + "request" : "none", + "prompt" : "为保证您正常、安全地使用,需要获取设备识别码使用权限,请允许。" + } + }, + "ios" : { + "idfa" : true, + "privacyDescription" : { + "NSLocationAlwaysUsageDescription" : "便于您使用该功能获取当前位置天气情况、WIFI列表等场景。", + "NSLocationAlwaysAndWhenInUseUsageDescription" : "便于您使用该功能获取当前位置天气情况、WIFI列表等场景。", + "NSLocalNetworkUsageDescription" : "允许访问蜂窝网络,用于扫码/关联式添加设备", + "NSLocationWhenInUseUsageDescription" : "便于您使用该功能获取当前位置天气情况、WIFI列表等场景。" + }, + "dSYMs" : false + }, + "sdkConfigs" : { + "push" : {}, + "statics" : {}, + "maps" : {}, + "ad" : {}, + "oauth" : { + "weixin" : { + "appid" : "wx6be3f0d7bf7154e1", + "appsecret" : "b6c1d0da60bd5250857d211cdc64fdc9", + "UniversalLinks" : "" + } + } + }, + "splashscreen" : { + "iosStyle" : "common", + "androidStyle" : "common", + "alwaysShowBeforeRender" : false, + "waiting" : true, + "autoclose" : false, + "delay" : 0, + "android" : { + "hdpi" : "./static/logo.9.png", + "xhdpi" : "./static/logo.9.png", + "xxhdpi" : "./static/logo.9.png" + } + }, + "icons" : { + "android" : { + "hdpi" : "unpackage/res/icons/72x72.png", + "xhdpi" : "unpackage/res/icons/96x96.png", + "xxhdpi" : "unpackage/res/icons/144x144.png", + "xxxhdpi" : "unpackage/res/icons/192x192.png" + }, + "ios" : { + "appstore" : "unpackage/res/icons/1024x1024.png", + "ipad" : { + "app" : "unpackage/res/icons/76x76.png", + "app@2x" : "unpackage/res/icons/152x152.png", + "notification" : "unpackage/res/icons/20x20.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "proapp@2x" : "unpackage/res/icons/167x167.png", + "settings" : "unpackage/res/icons/29x29.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "spotlight" : "unpackage/res/icons/40x40.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png" + }, + "iphone" : { + "app@2x" : "unpackage/res/icons/120x120.png", + "app@3x" : "unpackage/res/icons/180x180.png", + "notification@2x" : "unpackage/res/icons/40x40.png", + "notification@3x" : "unpackage/res/icons/60x60.png", + "settings@2x" : "unpackage/res/icons/58x58.png", + "settings@3x" : "unpackage/res/icons/87x87.png", + "spotlight@2x" : "unpackage/res/icons/80x80.png", + "spotlight@3x" : "unpackage/res/icons/120x120.png" + } + } + } + }, + "uniStatistics" : { + "enable" : false + }, + "nativePlugins" : {} + }, + "quickapp" : {}, + "mp-weixin" : { + "appid" : "wx5bfbadf52adc17f3", + "setting" : { + "urlCheck" : false, + "minified" : true + }, + "usingComponents" : true, + "uniStatistics" : { + "enable" : false + }, + "optimization" : { + "subPackages" : true + }, + "permission" : { + "scope.userLocation" : { + "desc" : "便于您使用该功能获取当前位置天气情况、WIFI列表等场景。" + } + }, + "requiredPrivateInfos" : [ "getLocation" ], + "lazyCodeLoading" : "requiredComponents" + }, + "mp-alipay" : { + "usingComponents" : true + }, + "mp-baidu" : { + "usingComponents" : true + }, + "mp-toutiao" : { + "usingComponents" : true + }, + "uniStatistics" : { + "enable" : false + }, + "h5" : { + "title" : "芯程物联", + "router" : { + "mode" : "hash", + "base" : "./" + }, + "devServer" : { + "port" : 8090 + }, + "optimization" : { + "treeShaking" : { + "enable" : false + } + }, + "template" : "uni_modules/jessibuca/hybrid/index.html", + "sdkConfigs" : { + "maps" : { + "qqmap" : { + "key" : "4PDBZ-4KQKU-AX6VO-GU7NB-INDZJ-YBFXC" + } + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..cad7621 --- /dev/null +++ b/package.json @@ -0,0 +1,28 @@ +{ + "name": "xcwl-app", + "version": "2.5.1", + "description": "手机端,可用于中小企业快速搭建物联网系统,个人学习搭建智能家居平台;适用于智能家居、智慧办公、智慧社区、农业监测、工业控制等", + "homepage": "https://fastbee.cn", + "main": "main.js", + "dependencies": { + "jsencrypt": "^3.3.2", + "moment": "^2.30.1", + "mqtt": "^3.0.0", + "vue-i18n": "^9.13.1" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://code.wumei.live/ultimate/wumei-smart-app.git" + }, + "keywords": [ + "fastbee" + ], + "author": "fastbee", + "license": "ISC", + "devDependencies": { + "code-inspector-plugin": "^0.18.0" + } +} diff --git a/pages.json b/pages.json new file mode 100644 index 0000000..67f3d3d --- /dev/null +++ b/pages.json @@ -0,0 +1,678 @@ +{ + "easycom": { + // uview 组件 + "^u-(.*)": "@/uni_modules/uview-ui/components/u-$1/u-$1.vue", + // 自定义组件 + "^cl-(.*)": "@/components/cl-$1/index.vue" + }, + + "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages + { + "path": "pages/tabBar/home/index", + "style": { + "navigationBarTitleText": "%navBar.home%", + "enablePullDownRefresh": true, + "navigationStyle": "custom" + } + }, + { + "path": "pages/tabBar/user/user", + "style": { + "navigationBarTitleText": "%navBar.user%", + "enablePullDownRefresh": false, + "navigationStyle": "custom", + "app-plus": { + "bounce": "none" + } + } + }, + { + "path": "pages/login/index", + "style": { + "navigationBarTitleText": "%navBar.login%", + "enablePullDownRefresh": false, + "navigationStyle": "custom", + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + + { + "path": "pages/tabBar/scene/index", + "style": { + "navigationBarTitleText": "%navBar.scene%", + "enablePullDownRefresh": true + }, + "meta": { + "requireAuth": true + } + }, + { + "path": "pages/tabBar/alert/index", + "meta": { + "title": "%navBar.alert%", + "requireAuth": true + }, + "style": { + "navigationBarTitleText": "%navBar.alert%", + "enablePullDownRefresh": true + } + }, + { + "path": "pages/tabBar/alert/edit", + "meta": { + "title": "%navBar.alarmHandling%" + }, + "style": { + "navigationBarTitleText": "%navBar.alarmHandling%", + "enablePullDownRefresh": false + } + }, + { + "path": "pages/tabBar/trend/trend", + "style": { + "navigationBarTitleText": "%navBar.news%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "pages/common/webview/index", + "style": { + "navigationBarTitleText": "%navBar.browse%" + }, + "meta": { + "requireAuth": true + } + } + ], + "subPackages": [{ + "root": "pagesA", + "pages": [{ + "path": "scene/detail", + "meta": { + "title": "%navBar.sceneDetail%", + "requireAuth": true + }, + "style": { + "navigationBarTitleText": "%navBar.sceneDetail%", + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "scene/list", + "meta": { + "title": "%navBar.productList%", + "requireAuth": true + }, + "style": { + "navigationBarTitleText": "%navBar.productList%", + "enablePullDownRefresh": true + } + }, + { + "path": "scene/product/index", + "meta": { + "title": "%navBar.productList%", + "requireAuth": true + }, + "style": { + "navigationBarTitleText": "%navBar.productList%", + "enablePullDownRefresh": true + } + }, + { + "path": "scene/product/device", + "meta": { + "title": "%navBar.deviceList%", + "requireAuth": true + }, + "style": { + "navigationBarTitleText": "%navBar.deviceList%", + "enablePullDownRefresh": true + } + }, + { + "path": "scene/product/model", + "meta": { + "title": "%navBar.physicalModels%", + "requireAuth": true + }, + "style": { + "navigationBarTitleText": "%navBar.physicalModels%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "scene/warning/index", + "meta": { + "title": "%navBar.alarmList%", + "requireAuth": true + }, + "style": { + "navigationBarTitleText": "%navBar.alarmList%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "scene/timing/index", + "meta": { + "title": "%navBar.timer%", + "requireAuth": true + }, + "style": { + "navigationBarTitleText": "%navBar.timer%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "home/device/index", + "meta": { + "title": "%navBar.deviceDetails%" + }, + "style": { + "navigationBarTitleText": "%navBar.deviceDetails%", + "enablePullDownRefresh": false + } + }, + { + "path": "home/device/timing/list", + "meta": { + "title": "%navBar.timedList%" + }, + "style": { + "navigationBarTitleText": "%navBar.timedList%", + "enablePullDownRefresh": true + } + }, + { + "path": "home/device/timing/detail", + "meta": { + "title": "%navBar.timedDetails%" + }, + "style": { + "navigationBarTitleText": "%navBar.timedDetails%", + "enablePullDownRefresh": false + } + }, + { + "path": "home/device/model", + "meta": { + "title": "%navBar.physicalModels%" + }, + "style": { + "navigationBarTitleText": "%navBar.physicalModels%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "home/device/detail/index", + "meta": { + "title": "%navBar.deviceDetails%", + "requireAuth": true + }, + "style": { + "navigationBarTitleText": "%navBar.deviceDetails%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "list/trend/trendDetail", + "meta": { + "title": "%navBar.dynamicDetails%" + }, + "style": { + "navigationBarTitleText": "%navBar.dynamicDetails%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "list/trend/categoryTrend", + "meta": { + "title": "%navBar.classification%" + }, + "style": { + "navigationBarTitleText": "%navBar.classification%", + "enablePullDownRefresh": false + } + }, + { + "path": "list/home/deviceAdd", + "meta": { + "title": "%navBar.addDevice%" + }, + "style": { + "navigationBarTitleText": "%navBar.addDevice%", + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "list/home/deviceRelate", + "meta": { + "title": "%navBar.associatedDevices%" + }, + "style": { + "navigationBarTitleText": "%navBar.associatedDevices%", + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "device/share/list", + "meta": { + "title": "%navBar.deviceSharing%" + }, + "style": { + "navigationBarTitleText": "%navBar.deviceSharing%", + "enablePullDownRefresh": true + } + }, + { + "path": "device/share/detail", + "meta": { + "title": "%navBar.shareDetails%" + }, + "style": { + "navigationBarTitleText": "%navBar.shareDetails%", + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + } + ] + }, { + "root": "pagesB", + "pages": [{ + "path": "user/about", + "meta": { + "title": "%navBar.about%" + }, + "style": { + "navigationBarTitleText": "%navBar.about%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "list/user/message", + "meta": { + "title": "%navBar.latest%" + }, + "style": { + "navigationBarTitleText": "%navBar.latest%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "list/user/messageDetail", + "meta": { + "title": "%navBar.newsDetail%" + }, + "style": { + "navigationBarTitleText": "%navBar.newsDetail%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "list/user/setting", + "meta": { + "title": "%navBar.setting%" + }, + "style": { + "navigationBarTitleText": "%navBar.setting%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "list/user/emulator", + "meta": { + "title": "%navBar.simulation%" + }, + "style": { + "navigationBarTitleText": "%navBar.simulation%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "list/user/phone", + "meta": { + "title": "%navBar.mobile%" + }, + "style": { + "navigationBarTitleText": "%navBar.mobile%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "user/account", + "meta": { + "title": "%navBar.account%" + }, + "style": { + "navigationBarTitleText": "%navBar.account%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "language/index", + "meta": { + "title": "%navBar.language%" + }, + "style": { + "navigationBarTitleText": "%navBar.language%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "user/scada/indeScada", + "meta": { + "title": "独立组态" + }, + "style": { + "navigationBarTitleText": "独立组态", + "enablePullDownRefresh": true + } + }, + { + "path": "user/resetPsd", + "meta": { + "title": "密码修改" + }, + "style": { + "navigationBarTitleText": "密码修改", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "user/avatar", + "meta": { + "title": "%navBar.updateAvatar%" + }, + "style": { + "navigationBarTitleText": "%navBar.updateAvatar%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "user/secureBind", + "meta": { + "title": "%navBar.unbind%" + }, + "style": { + "navigationBarTitleText": "%navBar.unbind%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "user/deviceGroup/index", + "meta": { + "title": "%navBar.group%" + }, + "style": { + "navigationBarTitleText": "%navBar.group%", + "enablePullDownRefresh": true + } + }, + { + "path": "user/deviceGroup/detail", + "meta": { + "title": "%navBar.updateGroup%" + }, + "style": { + "navigationBarTitleText": "%navBar.updateGroup%", + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "user/deviceGroup/devices", + "meta": { + "title": "%navBar.deviceList%" + }, + "style": { + "navigationBarTitleText": "%navBar.deviceList%", + "enablePullDownRefresh": true + } + }, + { + "path": "home/device/status/modbus/index", + "meta": { + "title": "%navBar.running%" + }, + "style": { + "navigationBarTitleText": "%navBar.running%", + "enablePullDownRefresh": false + } + }, + { + "path": "home/device/status/modbus/edit", + "meta": { + "title": "%navBar.updateDevice%" + }, + "style": { + "navigationBarTitleText": "%navBar.updateDevice%", + "enablePullDownRefresh": false + } + }, + { + "path": "home/device/log/event", + "meta": { + "title": "%navBar.eventLog%" + }, + "style": { + "navigationBarTitleText": "%navBar.eventLog%", + "enablePullDownRefresh": true + } + }, + { + "path": "home/device/log/order", + "meta": { + "title": "%navBar.orderLog%" + }, + "style": { + "navigationBarTitleText": "%navBar.orderLog%", + "enablePullDownRefresh": true + } + }, + { + "path": "login/register", + "style": { + "navigationBarTitleText": "%navBar.registration%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "login/bindLogin", + "style": { + "navigationBarTitleText": "%navBar.loginBinding%", + "enablePullDownRefresh": false, + "navigationStyle": "custom", + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "login/bindRegister", + "style": { + "navigationBarTitleText": "%navBar.registrationBinding%", + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "login/smsLogin", + "style": { + "navigationBarTitleText": "%navBar.smsBogin%", + "enablePullDownRefresh": false, + "navigationStyle": "custom", + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "login/firstOpen", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom", + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + }, + { + "path": "login/waitLogin", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom", + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + } + ] + }, { + "root": "pages_player", //分包所在路径 + "pages": [ //页面数组 + { + "path": "list/devicePlayer", + "style": { + "navigationBarTitleText": "%navBar.player%", //页面头部标题 + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + + }, + { + "path": "list/devicePlayerApp", + "style": { + "navigationBarTitleText": "%navBar.player%", //页面头部标题 + "enablePullDownRefresh": false, + "app-plus": { + "bounce": "none" // 将回弹属性关掉 + } + } + } + ] + }], + "globalStyle": { + "pageOrientation": "portrait", + "navigationBarTitleText": "%common.fastbee%", + "navigationBarTextStyle": "white", + "navigationBarBackgroundColor": "#007AFF", + "backgroundColor": "#F8F8F8", + "backgroundColorTop": "#F4F5F6", + "backgroundColorBottom": "#F4F5F6", + "onReachBottomDistance": 50 + }, + "tabBar": { + "color": "#7A7E83", + "selectedColor": "#007AFF", + "borderStyle": "black", + "backgroundColor": "#F8F8F8", + "list": [{ + "pagePath": "pages/tabBar/home/index", + "iconPath": "static/home.png", + "selectedIconPath": "static/home_active.png", + // "text": "%navBar.home%" + "text": "首页" + }, + { + "pagePath": "pages/tabBar/scene/index", + "iconPath": "static/scene.png", + "selectedIconPath": "static/scene_active.png", + // "text": "%navBar.scene%" + "text": "场景" + }, + { + "pagePath": "pages/tabBar/alert/index", + "iconPath": "static/alert.png", + "selectedIconPath": "static/alert_active.png", + // "text": "%navBar.alert%" + "text": "告警" + }, + // { + // "pagePath": "pages/tabBar/trend/trend", + // "iconPath": "static/trend.png", + // "selectedIconPath": "static/trend_active.png", + // "text": "%navBar.news%" + // }, + { + "pagePath": "pages/tabBar/user/user", + "iconPath": "static/user.png", + "selectedIconPath": "static/user_active.png", + "text": "用户" + // "text": "%navBar.user%" + } + ] + } +} \ No newline at end of file diff --git a/pages/common/webview/index.vue b/pages/common/webview/index.vue new file mode 100644 index 0000000..c139ef1 --- /dev/null +++ b/pages/common/webview/index.vue @@ -0,0 +1,38 @@ + + + \ No newline at end of file diff --git a/pages/login/index.vue b/pages/login/index.vue new file mode 100644 index 0000000..ddcb103 --- /dev/null +++ b/pages/login/index.vue @@ -0,0 +1,561 @@ + + + + + \ No newline at end of file diff --git a/pages/public/richPage/richPage.vue b/pages/public/richPage/richPage.vue new file mode 100644 index 0000000..cec29df --- /dev/null +++ b/pages/public/richPage/richPage.vue @@ -0,0 +1,40 @@ + + + + + diff --git a/pages/tabBar/alert/edit.vue b/pages/tabBar/alert/edit.vue new file mode 100644 index 0000000..6f6e1b7 --- /dev/null +++ b/pages/tabBar/alert/edit.vue @@ -0,0 +1,214 @@ + + + + + + \ No newline at end of file diff --git a/pages/tabBar/alert/index.vue b/pages/tabBar/alert/index.vue new file mode 100644 index 0000000..6d32b5b --- /dev/null +++ b/pages/tabBar/alert/index.vue @@ -0,0 +1,401 @@ + + + + + \ No newline at end of file diff --git a/pages/tabBar/home/index.vue b/pages/tabBar/home/index.vue new file mode 100644 index 0000000..5736268 --- /dev/null +++ b/pages/tabBar/home/index.vue @@ -0,0 +1,751 @@ + + + + + \ No newline at end of file diff --git a/pages/tabBar/scene/index.vue b/pages/tabBar/scene/index.vue new file mode 100644 index 0000000..688dc8c --- /dev/null +++ b/pages/tabBar/scene/index.vue @@ -0,0 +1,496 @@ + + + + + + \ No newline at end of file diff --git a/pages/tabBar/trend/trend.vue b/pages/tabBar/trend/trend.vue new file mode 100644 index 0000000..3b484ce --- /dev/null +++ b/pages/tabBar/trend/trend.vue @@ -0,0 +1,126 @@ + + + + + \ No newline at end of file diff --git a/pages/tabBar/user/user.vue b/pages/tabBar/user/user.vue new file mode 100644 index 0000000..bbcde96 --- /dev/null +++ b/pages/tabBar/user/user.vue @@ -0,0 +1,729 @@ + + + + + \ No newline at end of file diff --git a/pagesA/components/uni-data-checkbox/index.vue b/pagesA/components/uni-data-checkbox/index.vue new file mode 100644 index 0000000..3c75d9f --- /dev/null +++ b/pagesA/components/uni-data-checkbox/index.vue @@ -0,0 +1,821 @@ + + + + + diff --git a/pagesA/components/uni-pagination/i18n/en.json b/pagesA/components/uni-pagination/i18n/en.json new file mode 100644 index 0000000..d6e2897 --- /dev/null +++ b/pagesA/components/uni-pagination/i18n/en.json @@ -0,0 +1,5 @@ +{ + "uni-pagination.prevText": "prev", + "uni-pagination.nextText": "next", + "uni-pagination.piecePerPage": "piece/page" +} diff --git a/pagesA/components/uni-pagination/i18n/es.json b/pagesA/components/uni-pagination/i18n/es.json new file mode 100644 index 0000000..604a113 --- /dev/null +++ b/pagesA/components/uni-pagination/i18n/es.json @@ -0,0 +1,5 @@ +{ + "uni-pagination.prevText": "anterior", + "uni-pagination.nextText": "prxima", + "uni-pagination.piecePerPage": "Artculo/Pgina" +} diff --git a/pagesA/components/uni-pagination/i18n/fr.json b/pagesA/components/uni-pagination/i18n/fr.json new file mode 100644 index 0000000..a7a0c77 --- /dev/null +++ b/pagesA/components/uni-pagination/i18n/fr.json @@ -0,0 +1,5 @@ +{ + "uni-pagination.prevText": "précédente", + "uni-pagination.nextText": "suivante", + "uni-pagination.piecePerPage": "Articles/Pages" +} diff --git a/pagesA/components/uni-pagination/i18n/index.js b/pagesA/components/uni-pagination/i18n/index.js new file mode 100644 index 0000000..2469dd0 --- /dev/null +++ b/pagesA/components/uni-pagination/i18n/index.js @@ -0,0 +1,12 @@ +import en from './en.json' +import es from './es.json' +import fr from './fr.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + es, + fr, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/pagesA/components/uni-pagination/i18n/zh-Hans.json b/pagesA/components/uni-pagination/i18n/zh-Hans.json new file mode 100644 index 0000000..782bbe4 --- /dev/null +++ b/pagesA/components/uni-pagination/i18n/zh-Hans.json @@ -0,0 +1,5 @@ +{ + "uni-pagination.prevText": "上一页", + "uni-pagination.nextText": "下一页", + "uni-pagination.piecePerPage": "条/页" +} diff --git a/pagesA/components/uni-pagination/i18n/zh-Hant.json b/pagesA/components/uni-pagination/i18n/zh-Hant.json new file mode 100644 index 0000000..180fddb --- /dev/null +++ b/pagesA/components/uni-pagination/i18n/zh-Hant.json @@ -0,0 +1,5 @@ +{ + "uni-pagination.prevText": "上一頁", + "uni-pagination.nextText": "下一頁", + "uni-pagination.piecePerPage": "條/頁" +} diff --git a/pagesA/components/uni-pagination/index.vue b/pagesA/components/uni-pagination/index.vue new file mode 100644 index 0000000..5305b5f --- /dev/null +++ b/pagesA/components/uni-pagination/index.vue @@ -0,0 +1,465 @@ + + + + + diff --git a/pagesA/device/share/detail.vue b/pagesA/device/share/detail.vue new file mode 100644 index 0000000..a10295a --- /dev/null +++ b/pagesA/device/share/detail.vue @@ -0,0 +1,285 @@ + + + + \ No newline at end of file diff --git a/pagesA/device/share/list.vue b/pagesA/device/share/list.vue new file mode 100644 index 0000000..6e8b4e7 --- /dev/null +++ b/pagesA/device/share/list.vue @@ -0,0 +1,254 @@ + + + + + \ No newline at end of file diff --git a/pagesA/home/device/detail/index.vue b/pagesA/home/device/detail/index.vue new file mode 100644 index 0000000..90e061d --- /dev/null +++ b/pagesA/home/device/detail/index.vue @@ -0,0 +1,290 @@ + + + + + \ No newline at end of file diff --git a/pagesA/home/device/index.vue b/pagesA/home/device/index.vue new file mode 100644 index 0000000..0885645 --- /dev/null +++ b/pagesA/home/device/index.vue @@ -0,0 +1,812 @@ + + + + + \ No newline at end of file diff --git a/pagesA/home/device/log/alertLog.vue b/pagesA/home/device/log/alertLog.vue new file mode 100644 index 0000000..f6c9844 --- /dev/null +++ b/pagesA/home/device/log/alertLog.vue @@ -0,0 +1,324 @@ + + + + + \ No newline at end of file diff --git a/pagesA/home/device/log/index.vue b/pagesA/home/device/log/index.vue new file mode 100644 index 0000000..859b80a --- /dev/null +++ b/pagesA/home/device/log/index.vue @@ -0,0 +1,74 @@ + + + + + \ No newline at end of file diff --git a/pagesA/home/device/model.vue b/pagesA/home/device/model.vue new file mode 100644 index 0000000..3f38732 --- /dev/null +++ b/pagesA/home/device/model.vue @@ -0,0 +1,711 @@ + + + + + + \ No newline at end of file diff --git a/pagesA/home/device/monitor/index.vue b/pagesA/home/device/monitor/index.vue new file mode 100644 index 0000000..19b416e --- /dev/null +++ b/pagesA/home/device/monitor/index.vue @@ -0,0 +1,354 @@ + + + + + \ No newline at end of file diff --git a/pagesA/home/device/scada.vue b/pagesA/home/device/scada.vue new file mode 100644 index 0000000..9c41b89 --- /dev/null +++ b/pagesA/home/device/scada.vue @@ -0,0 +1,71 @@ + + + + + \ No newline at end of file diff --git a/pagesA/home/device/statistic/history.vue b/pagesA/home/device/statistic/history.vue new file mode 100644 index 0000000..ef03996 --- /dev/null +++ b/pagesA/home/device/statistic/history.vue @@ -0,0 +1,500 @@ + + + + + \ No newline at end of file diff --git a/pagesA/home/device/statistic/index.vue b/pagesA/home/device/statistic/index.vue new file mode 100644 index 0000000..6c07510 --- /dev/null +++ b/pagesA/home/device/statistic/index.vue @@ -0,0 +1,407 @@ + + + + + \ No newline at end of file diff --git a/pagesA/home/device/status/base.vue b/pagesA/home/device/status/base.vue new file mode 100644 index 0000000..d14c9ea --- /dev/null +++ b/pagesA/home/device/status/base.vue @@ -0,0 +1,1459 @@ + + + + + \ No newline at end of file diff --git a/pagesA/home/device/status/index.vue b/pagesA/home/device/status/index.vue new file mode 100644 index 0000000..6a9e9d7 --- /dev/null +++ b/pagesA/home/device/status/index.vue @@ -0,0 +1,88 @@ + + + + + \ No newline at end of file diff --git a/pagesA/home/device/status/modbus.vue b/pagesA/home/device/status/modbus.vue new file mode 100644 index 0000000..5af38ac --- /dev/null +++ b/pagesA/home/device/status/modbus.vue @@ -0,0 +1,254 @@ + + + + + \ No newline at end of file diff --git a/pagesA/home/device/status/variable.vue b/pagesA/home/device/status/variable.vue new file mode 100644 index 0000000..685082a --- /dev/null +++ b/pagesA/home/device/status/variable.vue @@ -0,0 +1,420 @@ + + + + + + \ No newline at end of file diff --git a/pagesA/home/device/timing/detail.vue b/pagesA/home/device/timing/detail.vue new file mode 100644 index 0000000..5e642e6 --- /dev/null +++ b/pagesA/home/device/timing/detail.vue @@ -0,0 +1,588 @@ + + + + + + \ No newline at end of file diff --git a/pagesA/home/device/timing/index.vue b/pagesA/home/device/timing/index.vue new file mode 100644 index 0000000..dc91220 --- /dev/null +++ b/pagesA/home/device/timing/index.vue @@ -0,0 +1,436 @@ + + + + + + \ No newline at end of file diff --git a/pagesA/home/device/timing/list.vue b/pagesA/home/device/timing/list.vue new file mode 100644 index 0000000..0e619ea --- /dev/null +++ b/pagesA/home/device/timing/list.vue @@ -0,0 +1,143 @@ + + + + + + \ No newline at end of file diff --git a/pagesA/home/device/video/index.vue b/pagesA/home/device/video/index.vue new file mode 100644 index 0000000..70507ef --- /dev/null +++ b/pagesA/home/device/video/index.vue @@ -0,0 +1,237 @@ + + + + + \ No newline at end of file diff --git a/pagesA/list/home/deviceAdd.vue b/pagesA/list/home/deviceAdd.vue new file mode 100644 index 0000000..ca6e720 --- /dev/null +++ b/pagesA/list/home/deviceAdd.vue @@ -0,0 +1,815 @@ + + + + + \ No newline at end of file diff --git a/pagesA/list/home/deviceRelate.vue b/pagesA/list/home/deviceRelate.vue new file mode 100644 index 0000000..48a733f --- /dev/null +++ b/pagesA/list/home/deviceRelate.vue @@ -0,0 +1,189 @@ + + + + + diff --git a/pagesA/list/trend/categoryTrend.vue b/pagesA/list/trend/categoryTrend.vue new file mode 100644 index 0000000..b34999f --- /dev/null +++ b/pagesA/list/trend/categoryTrend.vue @@ -0,0 +1,131 @@ + + + + + diff --git a/pagesA/list/trend/trendDetail.vue b/pagesA/list/trend/trendDetail.vue new file mode 100644 index 0000000..d185c0e --- /dev/null +++ b/pagesA/list/trend/trendDetail.vue @@ -0,0 +1,116 @@ + + + + + \ No newline at end of file diff --git a/pagesA/public/player/index.vue b/pagesA/public/player/index.vue new file mode 100644 index 0000000..3f4a360 --- /dev/null +++ b/pagesA/public/player/index.vue @@ -0,0 +1,26 @@ + + + + + \ No newline at end of file diff --git a/pagesA/scene/detail.vue b/pagesA/scene/detail.vue new file mode 100644 index 0000000..c79520b --- /dev/null +++ b/pagesA/scene/detail.vue @@ -0,0 +1,839 @@ + + + + + + \ No newline at end of file diff --git a/pagesA/scene/list.vue b/pagesA/scene/list.vue new file mode 100644 index 0000000..6ffc229 --- /dev/null +++ b/pagesA/scene/list.vue @@ -0,0 +1,143 @@ + + + + + + \ No newline at end of file diff --git a/pagesA/scene/product/device.vue b/pagesA/scene/product/device.vue new file mode 100644 index 0000000..b3a16ee --- /dev/null +++ b/pagesA/scene/product/device.vue @@ -0,0 +1,396 @@ + + + + + + \ No newline at end of file diff --git a/pagesA/scene/product/index.vue b/pagesA/scene/product/index.vue new file mode 100644 index 0000000..f81bc04 --- /dev/null +++ b/pagesA/scene/product/index.vue @@ -0,0 +1,375 @@ + + + + + + \ No newline at end of file diff --git a/pagesA/scene/product/model.vue b/pagesA/scene/product/model.vue new file mode 100644 index 0000000..126bac4 --- /dev/null +++ b/pagesA/scene/product/model.vue @@ -0,0 +1,830 @@ + + + + + + \ No newline at end of file diff --git a/pagesA/scene/timing/index.vue b/pagesA/scene/timing/index.vue new file mode 100644 index 0000000..326ae99 --- /dev/null +++ b/pagesA/scene/timing/index.vue @@ -0,0 +1,300 @@ + + + + + + \ No newline at end of file diff --git a/pagesA/scene/warning/index.vue b/pagesA/scene/warning/index.vue new file mode 100644 index 0000000..af7e448 --- /dev/null +++ b/pagesA/scene/warning/index.vue @@ -0,0 +1,133 @@ + + + + + + \ No newline at end of file diff --git a/pagesB/home/device/log/event.vue b/pagesB/home/device/log/event.vue new file mode 100644 index 0000000..22b0a8c --- /dev/null +++ b/pagesB/home/device/log/event.vue @@ -0,0 +1,404 @@ + + + + + \ No newline at end of file diff --git a/pagesB/home/device/log/order.vue b/pagesB/home/device/log/order.vue new file mode 100644 index 0000000..18a940d --- /dev/null +++ b/pagesB/home/device/log/order.vue @@ -0,0 +1,220 @@ + + + + + \ No newline at end of file diff --git a/pagesB/home/device/status/modbus/edit.vue b/pagesB/home/device/status/modbus/edit.vue new file mode 100644 index 0000000..d07c2fc --- /dev/null +++ b/pagesB/home/device/status/modbus/edit.vue @@ -0,0 +1,120 @@ + + + + + \ No newline at end of file diff --git a/pagesB/home/device/status/modbus/index.vue b/pagesB/home/device/status/modbus/index.vue new file mode 100644 index 0000000..5358adf --- /dev/null +++ b/pagesB/home/device/status/modbus/index.vue @@ -0,0 +1,235 @@ + + + + + \ No newline at end of file diff --git a/pagesB/language/index.vue b/pagesB/language/index.vue new file mode 100644 index 0000000..2dc392b --- /dev/null +++ b/pagesB/language/index.vue @@ -0,0 +1,113 @@ + + + + + \ No newline at end of file diff --git a/pagesB/list/user/emulator.vue b/pagesB/list/user/emulator.vue new file mode 100644 index 0000000..2fc1b93 --- /dev/null +++ b/pagesB/list/user/emulator.vue @@ -0,0 +1,127 @@ + + + + + \ No newline at end of file diff --git a/pagesB/list/user/message.vue b/pagesB/list/user/message.vue new file mode 100644 index 0000000..eecd7d8 --- /dev/null +++ b/pagesB/list/user/message.vue @@ -0,0 +1,109 @@ + + + + + \ No newline at end of file diff --git a/pagesB/list/user/messageDetail.vue b/pagesB/list/user/messageDetail.vue new file mode 100644 index 0000000..086e5e2 --- /dev/null +++ b/pagesB/list/user/messageDetail.vue @@ -0,0 +1,130 @@ + + + + + diff --git a/pagesB/list/user/phone.vue b/pagesB/list/user/phone.vue new file mode 100644 index 0000000..39c6050 --- /dev/null +++ b/pagesB/list/user/phone.vue @@ -0,0 +1,142 @@ + + + + + \ No newline at end of file diff --git a/pagesB/list/user/setting.vue b/pagesB/list/user/setting.vue new file mode 100644 index 0000000..af00b1c --- /dev/null +++ b/pagesB/list/user/setting.vue @@ -0,0 +1,46 @@ + + + + + \ No newline at end of file diff --git a/pagesB/login/bindLogin.vue b/pagesB/login/bindLogin.vue new file mode 100644 index 0000000..d526bda --- /dev/null +++ b/pagesB/login/bindLogin.vue @@ -0,0 +1,252 @@ + + + + + \ No newline at end of file diff --git a/pagesB/login/bindRegister.vue b/pagesB/login/bindRegister.vue new file mode 100644 index 0000000..3c0e8cc --- /dev/null +++ b/pagesB/login/bindRegister.vue @@ -0,0 +1,274 @@ + + + + + \ No newline at end of file diff --git a/pagesB/login/firstOpen.vue b/pagesB/login/firstOpen.vue new file mode 100644 index 0000000..e3fd1a6 --- /dev/null +++ b/pagesB/login/firstOpen.vue @@ -0,0 +1,120 @@ + + + + + \ No newline at end of file diff --git a/pagesB/login/register.vue b/pagesB/login/register.vue new file mode 100644 index 0000000..2dc4bdc --- /dev/null +++ b/pagesB/login/register.vue @@ -0,0 +1,272 @@ + + + + + \ No newline at end of file diff --git a/pagesB/login/smsLogin.vue b/pagesB/login/smsLogin.vue new file mode 100644 index 0000000..b43e416 --- /dev/null +++ b/pagesB/login/smsLogin.vue @@ -0,0 +1,234 @@ + + + + + \ No newline at end of file diff --git a/pagesB/login/waitLogin.vue b/pagesB/login/waitLogin.vue new file mode 100644 index 0000000..2820c9f --- /dev/null +++ b/pagesB/login/waitLogin.vue @@ -0,0 +1,414 @@ + + + + + \ No newline at end of file diff --git a/pagesB/user/about.vue b/pagesB/user/about.vue new file mode 100644 index 0000000..b72bf56 --- /dev/null +++ b/pagesB/user/about.vue @@ -0,0 +1,62 @@ + + + + + \ No newline at end of file diff --git a/pagesB/user/account.vue b/pagesB/user/account.vue new file mode 100644 index 0000000..196f92a --- /dev/null +++ b/pagesB/user/account.vue @@ -0,0 +1,204 @@ + + + + + \ No newline at end of file diff --git a/pagesB/user/avatar.vue b/pagesB/user/avatar.vue new file mode 100644 index 0000000..d387be2 --- /dev/null +++ b/pagesB/user/avatar.vue @@ -0,0 +1,41 @@ + + + + \ No newline at end of file diff --git a/pagesB/user/deviceGroup/detail.vue b/pagesB/user/deviceGroup/detail.vue new file mode 100644 index 0000000..5852e28 --- /dev/null +++ b/pagesB/user/deviceGroup/detail.vue @@ -0,0 +1,194 @@ + + + + + \ No newline at end of file diff --git a/pagesB/user/deviceGroup/devices.vue b/pagesB/user/deviceGroup/devices.vue new file mode 100644 index 0000000..6b7eb61 --- /dev/null +++ b/pagesB/user/deviceGroup/devices.vue @@ -0,0 +1,178 @@ + + + + + \ No newline at end of file diff --git a/pagesB/user/deviceGroup/index.vue b/pagesB/user/deviceGroup/index.vue new file mode 100644 index 0000000..5099a79 --- /dev/null +++ b/pagesB/user/deviceGroup/index.vue @@ -0,0 +1,156 @@ + + + + + \ No newline at end of file diff --git a/pagesB/user/resetPsd.vue b/pagesB/user/resetPsd.vue new file mode 100644 index 0000000..c9874c9 --- /dev/null +++ b/pagesB/user/resetPsd.vue @@ -0,0 +1,139 @@ + + + + + + \ No newline at end of file diff --git a/pagesB/user/scada/indeScada.vue b/pagesB/user/scada/indeScada.vue new file mode 100644 index 0000000..b5b7a80 --- /dev/null +++ b/pagesB/user/scada/indeScada.vue @@ -0,0 +1,184 @@ + + + + + + \ No newline at end of file diff --git a/pagesB/user/secureBind.vue b/pagesB/user/secureBind.vue new file mode 100644 index 0000000..c93505f --- /dev/null +++ b/pagesB/user/secureBind.vue @@ -0,0 +1,72 @@ + + + + + \ No newline at end of file diff --git a/pages_player/list/VideoProgressBar.vue b/pages_player/list/VideoProgressBar.vue new file mode 100644 index 0000000..1c83c46 --- /dev/null +++ b/pages_player/list/VideoProgressBar.vue @@ -0,0 +1,264 @@ + + + + + diff --git a/pages_player/list/devicePlayer.vue b/pages_player/list/devicePlayer.vue new file mode 100644 index 0000000..873141f --- /dev/null +++ b/pages_player/list/devicePlayer.vue @@ -0,0 +1,1290 @@ + + + + + + diff --git a/pages_player/list/devicePlayerApp.vue b/pages_player/list/devicePlayerApp.vue new file mode 100644 index 0000000..c05cd6c --- /dev/null +++ b/pages_player/list/devicePlayerApp.vue @@ -0,0 +1,1106 @@ + + + + + \ No newline at end of file diff --git a/pages_player/list/jessibuca.vue b/pages_player/list/jessibuca.vue new file mode 100644 index 0000000..eb608e6 --- /dev/null +++ b/pages_player/list/jessibuca.vue @@ -0,0 +1,421 @@ + + + diff --git a/pages_player/list/props.js b/pages_player/list/props.js new file mode 100644 index 0000000..b6fcc5f --- /dev/null +++ b/pages_player/list/props.js @@ -0,0 +1,97 @@ +export default { + props:{ + /*唯一标识*/ + refId:{ + type:String, + default:'' + }, + /*其他配置项*/ + options:{ + type:[Object,Array], + default:()=>{return {}} + }, + /*引用jessibuca路径 */ + decoder:{ + type:String, + default:'' + }, + /*true 视频画面做等比缩放后,高或宽对齐canvas区域,画面不被拉伸,但有黑边 false 视频画面完全填充canvas区域,画面会被拉伸*/ + isResize:{ + type:Boolean, + default:true + }, + /*是否开启声音*/ + isNotMute:{ + type:Boolean, + default:false + }, + /*加载过程中文案*/ + loadingText:{ + type:String, + default:'' + }, + /*封面图*/ + poster:{ + type:String, + default:'' + }, + /*背景图*/ + background:{ + type:String, + default:"url(./uni_modules/jessibuca/static/img/bg.jpg)" + }, + /*是否自动播放*/ + isAuto:{ + type:Boolean, + default:false + }, + /*组件样式*/ + mainStyle:{ + type:Object, + default:()=>{return{}} + }, + /*是否全屏*/ + // isFull:{ + // type:Boolean, + // default:true + // }, + /* + screensJosn({name:filename, format:format, quality:quality,type:type}) + 截图时参数 + filename: 可选参数, 保存的文件名, 默认 时间戳 + format : 可选参数, 截图的格式,可选png或jpeg或者webp ,默认 png + quality: 可选参数, 当格式是jpeg或者webp时,压缩质量,取值0 ~ 1 ,默认 0.92 + type: 可选参数, 可选download或者base64或者blob,默认download + */ + screensJosn:{ + type:Object, + default:()=>{return{}} + }, + /* + 是否显示流状态统计 + buf: 当前缓冲区时长,单位毫秒, + fps: 当前视频帧率, + abps: 当前音频码率,单位bit, + vbps: 当前视频码率,单位bit, + ts:当前视频帧pts,单位毫秒 + */ + screensStats:{ + type:Object, + default:()=>{return{fps:true}} + }, + /*是否显示标题栏*/ + isTabbar:{ + type:Boolean, + default:false + }, + /* + 录屏时的参数 + fileName: 可选,默认时间戳 + fileType: 可选,默认webm,支持webm 和mp4 格式 + */ + screenJosn:{ + type:Object, + default:()=>{return{fileName:new Date().getTime(),fileType:'webm'}} + } + } +} diff --git a/pages_player/list/webview.vue b/pages_player/list/webview.vue new file mode 100644 index 0000000..af9a60e --- /dev/null +++ b/pages_player/list/webview.vue @@ -0,0 +1,70 @@ + + + + + + diff --git a/pages_player/static/app-plus/demo.css b/pages_player/static/app-plus/demo.css new file mode 100644 index 0000000..a084a44 --- /dev/null +++ b/pages_player/static/app-plus/demo.css @@ -0,0 +1,168 @@ +html, body { + width: 100%; + height: 100%; +} + +html { + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; + -webkit-tap-highlight-color: transparent; +} + +body { + line-height: 1.6; + position: relative; + font-family: "Microsoft Yahei", tahoma, arial, "Hiragino Sans GB"; +} + + +.root { + display: flex; + place-content: center; + margin-top: 3rem; +} + +.container-shell { + background: hsla(0, 0%, 50%, 0.5); + width: 100%; + position: relative; + border-radius: 5px; +} + +.container-shell:before { + content: "jessibuca demo player"; + position: absolute; + color: darkgray; + left: 10px; + text-shadow: 1px 1px black; +} + +#container { + background: rgba(13, 14, 27, 0.7); + width: 960px; + height: 597px; +} + +.container { + background: rgba(13, 14, 27, 0.7); + width: 320px; + height: 199px; + display: inline-block; + margin-right: 10px; + margin-bottom: 10px; +} + +.input { + display: flex; + margin-top: 10px; + max-width: 960px; + color: white; + place-content: stretch; +} + +.input2 { + bottom: 0px; +} + +.input input { + flex: auto; +} + +.err { + position: absolute; + top: 40px; + left: 10px; + color: red; +} + +.option { + position: absolute; + top: 4px; + right: 10px; + display: flex; + place-content: center; + font-size: 12px; +} + +.option span { + color: white; +} + +.page { + background: url('./bg.jpg'); + background-repeat: no-repeat; + background-position: top; +} + +button{ + font-size: 12px; + padding: 4px 8px; + border-radius: 4px; +} + +.container-multi{ + text-align: center; +} + + +.audio-container{ + width: 960px; +} + +@media (max-width: 720px) { + input { + outline: 0; + } + + * { + margin: 0; + padding: 0; + } + + * { + -webkit-tap-highlight-color: transparent + } + + a img { + border: 0; + } + + a { + text-decoration: none; + } + + + li { + list-style: none; + } + + ol, + ul { + margin: 0; + padding: 0; + list-style: none; + } + + + #container { + width: 100%; + height: 52.7vw; + margin: 0 auto; + } + + .input{ + max-width: 95vw; + } + + .audio-container{ + width: 95vw; + } + + .container { + width: 95vw; + height: 52.7vw; + margin: 0 auto; + margin-bottom: 10px; + display: block; + } +} diff --git a/pages_player/static/app-plus/demo.js b/pages_player/static/app-plus/demo.js new file mode 100644 index 0000000..cb8c167 --- /dev/null +++ b/pages_player/static/app-plus/demo.js @@ -0,0 +1,209 @@ +function getBrowser() { + const UserAgent = window.navigator.userAgent.toLowerCase() || ''; + let browserInfo = { + type: '', + version: '' + }; + var browserArray = { + IE: window.ActiveXObject || "ActiveXObject" in window, // IE + Chrome: UserAgent.indexOf('chrome') > -1 && UserAgent.indexOf('safari') > -1, // Chrome浏览器 + Firefox: UserAgent.indexOf('firefox') > -1, // 火狐浏览器 + Opera: UserAgent.indexOf('opera') > -1, // Opera浏览器 + Safari: UserAgent.indexOf('safari') > -1 && UserAgent.indexOf('chrome') == -1, // safari浏览器 + Edge: UserAgent.indexOf('edge') > -1, // Edge浏览器 + QQBrowser: /qqbrowser/.test(UserAgent), // qq浏览器 + WeixinBrowser: /MicroMessenger/i.test(UserAgent) // 微信浏览器 + }; + // console.log(browserArray) + for (let i in browserArray) { + if (browserArray[i]) { + let versions = ''; + if (i === 'IE') { + const versionArray = UserAgent.match(/(msie\s|trident.*rv:)([\w.]+)/) + if (versionArray && versionArray.length > 2) { + versions = UserAgent.match(/(msie\s|trident.*rv:)([\w.]+)/)[2]; + } + } else if (i === 'Chrome') { + for (let mt in navigator.mimeTypes) { + //检测是否是360浏览器(测试只有pc端的360才起作用) + if (navigator.mimeTypes[mt]['type'] === 'application/360softmgrplugin') { + i = '360'; + } + } + const versionArray = UserAgent.match(/chrome\/([\d.]+)/); + if (versionArray && versionArray.length > 1) { + versions = versionArray[1]; + } + } else if (i === 'Firefox') { + const versionArray = UserAgent.match(/firefox\/([\d.]+)/); + if (versionArray && versionArray.length > 1) { + versions = versionArray[1]; + } + } else if (i === 'Opera') { + const versionArray = UserAgent.match(/opera\/([\d.]+)/); + if (versionArray && versionArray.length > 1) { + versions = versionArray[1]; + } + } else if (i === 'Safari') { + const versionArray = UserAgent.match(/version\/([\d.]+)/); + if (versionArray && versionArray.length > 1) { + versions = versionArray[1]; + } + } else if (i === 'Edge') { + const versionArray = UserAgent.match(/edge\/([\d.]+)/); + if (versionArray && versionArray.length > 1) { + versions = versionArray[1]; + } + } else if (i === 'QQBrowser') { + const versionArray = UserAgent.match(/qqbrowser\/([\d.]+)/); + if (versionArray && versionArray.length > 1) { + versions = versionArray[1]; + } + } + browserInfo.type = i; + browserInfo.version = parseInt(versions); + } + } + return browserInfo; +} + + +function checkSupportMSEHevc() { + return window.MediaSource && window.MediaSource.isTypeSupported('video/mp4; codecs="hev1.1.6.L123.b0"'); +} + +function checkSupportMSEH264() { + return window.MediaSource && window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.64002A"'); +} + +function checkSupportWCSHevc() { + const browserInfo = getBrowser(); + + return browserInfo.type.toLowerCase() === 'chrome' && browserInfo.version >= 107 && (location.protocol === 'https:' || location.hostname === 'localhost'); +} + +function checkSupportWCS() { + return "VideoEncoder" in window; +} + +function checkSupportWasm() { + try { + if (typeof window.WebAssembly === 'object' && typeof window.WebAssembly.instantiate === 'function') { + const module = new window.WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00)); + if (module instanceof window.WebAssembly.Module) { + return new window.WebAssembly.Instance(module) instanceof window.WebAssembly.Instance; + } + } + return false; + } catch (e) { + return false; + } +} + + +function checkSupportSIMD() { + return WebAssembly && WebAssembly.validate(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 5, 1, 96, 0, 1, 123, 3, 2, 1, 0, 10, 10, 1, 8, 0, 65, 0, 253, 15, 253, 98, 11])); +} + +function supportSharedArrayBuffer() { + try { + new SharedArrayBuffer(1); + return true; + } catch (e) { + return false; + } +} + +let support = document.getElementById('mseSupport'); +let notSupport = document.getElementById('mseNotSupport'); +if (support && notSupport) { + if (checkSupportMSEHevc()) { + support.style.display = 'inline-block' + } else { + notSupport.style.display = 'inline-block' + } +} + + +let supportH264 = document.getElementById('mseSupport264'); +let notSupportH264 = document.getElementById('mseNotSupport264'); +if (supportH264 && notSupportH264) { + if (checkSupportMSEH264()) { + supportH264.style.display = 'inline-block' + } else { + notSupportH264.style.display = 'inline-block' + } +} + + +let supportWcsHevc = document.getElementById('wcsSupport'); +let notSupportWcsHevc = document.getElementById('wcsNotSupport'); + +if (supportWcsHevc && notSupportWcsHevc) { + if (checkSupportWCSHevc()) { + supportWcsHevc.style.display = 'inline-block'; + } else { + notSupportWcsHevc.style.display = 'inline-block' + } +} + +let supportWcs = document.getElementById('wcsSupport264'); +let notSupportWcs = document.getElementById('wcsNotSupport264'); + +if (supportWcs && notSupportWcs) { + if (checkSupportWCS()) { + supportWcs.style.display = 'inline-block'; + } else { + notSupportWcs.style.display = 'inline-block' + } +} + +let wasmSupport = document.getElementById('wasmSupport'); +let wasmNotSupport = document.getElementById('wasmNotSupport'); + +if (wasmSupport && wasmNotSupport) { + if (checkSupportWasm()) { + wasmSupport.style.display = 'inline-block'; + } else { + wasmNotSupport.style.display = 'inline-block'; + } +} + + +let supportSimd = document.getElementById('simdSupport'); +let notSupportSimd = document.getElementById('simdNotSupport'); + +if (supportSimd && notSupportSimd) { + if (checkSupportSIMD()) { + supportSimd.style.display = 'inline-block'; + } else { + notSupportSimd.style.display = 'inline-block' + } +} + +let supportSimdMtSupport = document.getElementById('simdMtSupport'); +var notSupportSimdMtSupport = document.getElementById('simdMtNotSupport'); + + +if (supportSimdMtSupport) { + if (supportSharedArrayBuffer()) { + supportSimdMtSupport.style.display = 'inline-block'; + } else { + notSupportSimdMtSupport.style.display = 'inline-block'; + } +} + + +function isMobile() { + return (/iphone|ipad|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())); +} + +function isPad() { + return (/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase())); +} + +const useVconsole = isMobile() || isPad() + +if (useVconsole && window.VConsole) { + new window.VConsole(); +} diff --git a/pages_player/static/app-plus/jessibuca-pro.js b/pages_player/static/app-plus/jessibuca-pro.js new file mode 100644 index 0000000..a0b8ba6 --- /dev/null +++ b/pages_player/static/app-plus/jessibuca-pro.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("crypto")):"function"==typeof define&&define.amd?define(["crypto"],t):(e="undefined"!=typeof globalThis?globalThis:e||self)["jessibuca-pro"]=t(e.crypto$1)}(this,(function(t){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=s(t);const a=1,o=2,n=3,l=4,d=5,h=6,c=["","websocket","fetch","hls","webrtc","webTransport","aliyunRtc","ts"],u="fetch",p="hls",f="websocket",m="webrtc",g="webTransport",y="worker",A="aliyunRtc",b="player",v="playerAudio",_="playbackTF",S="mp4",w="webm",E="flv",T="flv",k="m7s",C="hls",x="webrtc",R="webTransport",D="nakedFlow",L="fmp4",P="mpeg4",B="aliyunRtc",I="ts",M={flv:"FLV",m7s:"M7S",hls:"HLS",fmp4:"FMP4",mpeg4:"MPEG4",webrtc:"Webrtc",webTransport:"WebTransport",nakedFlow:"裸流",aliyunRtc:"AliyunRtc",ts:"TS"},U="mse",F="wcs",O="offscreen",N="wasm",j="simd",z="mt",G="webrtc",H="hls",V="aliyunRtc",$="canvas",W="video",J="debug",q="warn",K="click",Y="mouseDownAndUp",Q={normal:"normal",simple:"simple"},X=36e5,Z="/crypto/",ee="jbprov",te=1e4,ie={url:"",playbackConfig:{},fullscreenWatermarkConfig:{},playType:b,playbackForwardMaxRateDecodeIFrame:4,playOptions:{},isLive:!0,isMulti:!0,isM7sCrypto:!1,supportHls265:!1,playFailedUseLastFrameShow:!0,playFailedAndPausedShowMessage:!1,pauseAndNextPlayUseLastFrameShow:!1,widthOrHeightChangeReplayDelayTime:0,isUseNewFullscreenWatermark:!1,websocket1006ErrorReplay:!1,websocket1006ErrorReplayDelayTime:1,streamErrorReplay:!1,streamErrorReplayDelayTime:1,streamEndReplay:!1,streamEndReplayDelayTime:1,networkDisconnectReplay:!1},se={playType:b,container:"",videoBuffer:1e3,videoBufferDelay:1e3,networkDelay:1e4,isResize:!0,isFullResize:!1,isFlv:!1,isHls:!1,isFmp4:!1,isFmp4Private:!1,isWebrtc:!1,isWebrtcForZLM:!1,isWebrtcForSRS:!1,isWebrtcForOthers:!1,isNakedFlow:!1,isMpeg4:!1,isAliyunRtc:!1,isTs:!1,debug:!1,debugLevel:q,debugUuid:"",isMulti:!0,multiIndex:-1,hotKey:!1,loadingTimeout:10,heartTimeout:10,timeout:10,pageVisibilityHiddenTimeout:300,loadingTimeoutReplay:!0,heartTimeoutReplay:!0,loadingTimeoutReplayTimes:3,heartTimeoutReplayTimes:3,heartTimeoutReplayUseLastFrameShow:!0,replayUseLastFrameShow:!0,replayShowLoadingIcon:!1,supportDblclickFullscreen:!1,showBandwidth:!1,showPerformance:!1,mseCorrectTimeDuration:20,mseCorrectAudioTimeDuration:20,keepScreenOn:!0,isNotMute:!1,muted:!0,hasAudio:!0,hasVideo:!0,operateBtns:{fullscreen:!1,screenshot:!1,play:!1,audio:!1,record:!1,ptz:!1,quality:!1,zoom:!1,close:!1,scale:!1,performance:!1,logSave:!1,aiFace:!1,aiObject:!1,aiOcclusion:!1,fullscreenFn:null,fullscreenExitFn:null,screenshotFn:null,playFn:null,pauseFn:null,recordFn:null,recordStopFn:null},extendOperateBtns:[],contextmenuBtns:[],watermarkConfig:{},controlAutoHide:!1,hasControl:!1,loadingIcon:!0,loadingIconStyle:{},loadingText:"",background:"",poster:"",backgroundLoadingShow:!0,loadingBackground:"",loadingBackgroundWidth:0,loadingBackgroundHeight:0,decoder:"decoder-pro.js",decoderAudio:"decoder-pro-audio.js",decoderHard:"decoder-pro-hard.js",decoderHardNotWasm:"decoder-pro-hard-not-wasm.js",wasmMp4RecorderDecoder:"jessibuca-pro-mp4-recorder-decoder.js",decoderWASM:"",isDecoderUseCDN:!1,url:"",rotate:0,mirrorRotate:"none",aspectRatio:"default",playbackConfig:{playList:[],fps:"",showControl:!0,controlType:Q.normal,duration:0,startTime:"",showRateBtn:!1,rateConfig:[],showPrecision:"",showPrecisionBtn:!0,isCacheBeforeDecodeForFpsRender:!1,uiUsePlaybackPause:!1,isPlaybackPauseClearCache:!0,isUseFpsRender:!1,isUseLocalCalculateTime:!1,localOneFrameTimestamp:40,supportWheel:!1,useWCS:!1,useMSE:!1},qualityConfig:[],defaultStreamQuality:"",scaleConfig:["拉伸","缩放","正常"],forceNoOffscreen:!0,hiddenAutoPause:!1,protocol:o,demuxType:T,useWasm:!1,useMSE:!1,useWCS:!1,useSIMD:!0,useMThreading:!1,wcsUseVideoRender:!0,wcsUseWebgl2Render:!0,wasmUseVideoRender:!0,mseUseCanvasRender:!1,hlsUseCanvasRender:!1,webrtcUseCanvasRender:!1,useOffscreen:!1,useWebGPU:!1,mseDecodeErrorReplay:!0,wcsDecodeErrorReplay:!0,wasmDecodeErrorReplay:!0,simdDecodeErrorReplay:!0,simdDecodeErrorReplayType:N,autoWasm:!0,decoderErrorAutoWasm:!0,hardDecodingNotSupportAutoWasm:!0,webglAlignmentErrorReplay:!0,webglContextLostErrorReplay:!0,openWebglAlignment:!1,syncAudioAndVideo:!1,syncAudioAndVideoDiff:500,playbackDelayTime:1e3,playbackFps:25,playbackForwardMaxRateDecodeIFrame:4,playbackCurrentTimeMove:!0,useVideoRender:!0,useCanvasRender:!1,networkDelayTimeoutReplay:!1,recordType:S,checkFirstIFrame:!0,nakedFlowFps:25,audioEngine:null,isShowRecordingUI:!0,isShowZoomingUI:!0,useFaceDetector:!1,useObjectDetector:!1,useImageDetector:!1,useOcclusionDetector:!1,ptzPositionConfig:{},ptzShowType:"vertical",ptzClickType:K,ptzStopEmitDelay:.3,ptzZoomShow:!1,ptzApertureShow:!1,ptzFocusShow:!1,ptzMoreArrowShow:!1,ptzCruiseShow:!1,ptzFogShow:!1,ptzWiperShow:!1,ptzSupportDraggable:!1,weiXinInAndroidAudioBufferSize:4800,isM7sCrypto:!1,m7sCryptoAudio:!1,isSm4Crypto:!1,isXorCrypto:!1,sm4CryptoKey:"",m7sCryptoKey:"",xorCryptoKey:"",cryptoKey:"",cryptoIV:"",cryptoKeyUrl:"",autoResize:!1,useWebFullScreen:!1,ptsMaxDiff:3600,aiFaceDetectLevel:2,aiFaceDetectWidth:240,aiFaceDetectShowRect:!0,aiFaceDetectInterval:1e3,aiFaceDetectRectConfig:{},aiObjectDetectLevel:2,aiObjectDetectWidth:240,aiObjectDetectShowRect:!0,aiObjectDetectInterval:1e3,aiObjectDetectRectConfig:{},aiOcclusionDetectInterval:1e3,aiImageDetectDrop:!1,aiImageDetectActive:!1,videoRenderSupportScale:!0,mediaSourceTsIsMaxDiffReplay:!0,controlHtml:"",isH265:!1,isWebrtcH265:!1,supportLockScreenPlayAudio:!0,supportHls265:!1,isEmitSEI:!1,pauseAndNextPlayUseLastFrameShow:!1,demuxUseWorker:!0,playFailedAndReplay:!0,showMessageConfig:{webglAlignmentError:"Webgl 渲染失败",webglContextLostError:"webgl 上下文丢失",mediaSourceH265NotSupport:"不支持硬解码H265",mediaSourceFull:"缓冲区已满",mediaSourceAppendBufferError:"初始化解码器失败",mseSourceBufferError:"解码失败",mseAddSourceBufferError:"初始化解码器失败",mediaSourceDecoderConfigurationError:"初始化解码器失败",mediaSourceTsIsMaxDiff:"流异常",mseWidthOrHeightChange:"流异常",mediaSourceAudioG711NotSupport:"硬解码不支持G711a/u音频格式",mediaSourceUseCanvasRenderPlayFailed:"MediaSource解码使用canvas渲染失败",webcodecsH265NotSupport:"不支持硬解码H265",webcodecsUnsupportedConfigurationError:"初始化解码器失败",webcodecsDecodeConfigureError:"初始化解码器失败",webcodecsDecodeError:"解码失败",wcsWidthOrHeightChange:"解码失败",wasmDecodeError:"解码失败",simdDecodeError:"解码失败",wasmWidthOrHeightChange:"流异常",wasmUseVideoRenderError:"video自动渲染失败",videoElementPlayingFailed:"video自动渲染失败",simdH264DecodeVideoWidthIsTooLarge:"不支持该分辨率的视频",networkDelayTimeout:"网络超时重播失败",fetchError:"请求失败",streamEnd:"请求结束",websocketError:"请求失败",webrtcError:"请求失败",hlsError:"请求失败",decoderWorkerInitError:"初始化worker失败",videoElementPlayingFailedForWebrtc:"video自动渲染失败",videoInfoError:"解析视频分辨率失败",webrtcStreamH265:"webrtc不支持H265",delayTimeout:"播放超时重播失败",loadingTimeout:"加载超时重播失败",loadingTimeoutRetryEnd:"加载超时重播失败",delayTimeoutRetryEnd:"播放超时重播失败"},videoElementPlayingFailedReplay:!0,mp4RecordUseWasm:!0,mseAutoCleanupSourceBuffer:!0,mseAutoCleanupMaxBackwardDuration:30,mseAutoCleanupMinBackwardDuration:10,widthOrHeightChangeReplay:!0,simdH264DecodeVideoWidthIsTooLargeReplay:!0,mediaSourceAudioG711NotSupportReplay:!0,mediaSourceAudioInitTimeoutReplay:!0,mediaSourceUseCanvasRenderPlayFailedReplay:!0,mediaSourceUseCanvasRenderPlayFailedReplayType:W,widthOrHeightChangeReplayDelayTime:0,ghostWatermarkConfig:{on:5,off:5,content:"",fontSize:12,color:"white",opacity:.15,speed:.2},dynamicWatermarkConfig:{content:"",speed:.2,fontSize:12,color:"white",opacity:.15},isDropSameTimestampGop:!1,mseDecodeAudio:!1,nakedFlowH265DemuxUseNew:!0,extendDomConfig:{html:"",showBeforePlay:!1,showAfterLoading:!0},disableContextmenu:!1,mseDecoderUseWorker:!1,openMemoryLog:!1,mainThreadFetchUseWorker:!0,playFailedAndPausedShowPlayBtn:!0,mseCorrectionTimestamp:!0,flvDemuxBufferSizeTooLargeReplay:!1,flvDemuxBufferSizeTooLargeEmitFailed:!1,flvDemuxBufferSizeMaxLarge:1048576,isCheckInView:!1,hiddenControl:!1},re="init",ae="initVideo",oe="render",ne="playAudio",le="initAudio",de="audioCode",he="audioNalu",ce="audioAACSequenceHeader",ue="videoCode",pe="videoCodec",fe="videoNalu",me="videoPayload",ge="audioPayload",ye="wasmError",Ae="workerFetch",be="iframeIntervalTs",ve="isDropping",_e="workerEnd",Se="playbackStreamVideoFps",we="wasmDecodeVideoNoResponseError",Ee="wasmWidthOrHeightChange",Te="simdDecodeError",ke="simdH264DecodeVideoWidthIsTooLarge",Ce="closeEnd",xe="tempStream",Re="videoSEI",De="flvScriptData",Le="aacSequenceHeader",Pe="videoSequenceHeader",Be="flvBufferData",Ie="checkFirstIFrame",Me="mseHandle",Ue="mseFirstRenderTime",Fe="mseError",Oe="Invalid NAL unit size",Ne=1,je=2,ze=8,Ge=9,He=18,Ve="init",$e="decode",We="audioDecode",Je="videoDecode",qe="close",Ke="updateConfig",Ye="clearBuffer",Qe="fetchStream",Xe="sendWsMessage",Ze="mseUpdateVideoTimestamp",et="fetch",tt="destroy",it="destroyEnd",st="buffer",rt="fetchError",at="fetchClose",ot="fetchSuccess",nt={fullscreen:"fullscreen$2",webFullscreen:"webFullscreen",decoderWorkerInit:"decoderWorkerInit",play:"play",playing:"playing",pause:"pause",mute:"mute",load:"load",loading:"loading",zooming:"zooming",videoInfo:"videoInfo",timeUpdate:"timeUpdate",audioInfo:"audioInfo",log:"log",error:"error",kBps:"kBps",timeout:"timeout",delayTimeout:"delayTimeout",delayTimeoutRetryEnd:"delayTimeoutRetryEnd",loadingTimeout:"loadingTimeout",loadingTimeoutRetryEnd:"loadingTimeoutRetryEnd",stats:"stats",performance:"performance",videoSmooth:"videoSmooth",faceDetectActive:"faceDetectActive",objectDetectActive:"objectDetectActive",occlusionDetectActive:"occlusionDetectActive",imageDetectActive:"imageDetectActive",record:"record",recording:"recording",recordingTimestamp:"recordingTimestamp",recordStart:"recordStart",recordEnd:"recordEnd",recordCreateError:"recordCreateError",recordBlob:"recordBlob",buffer:"buffer",videoFrame:"videoFrame",videoSEI:"videoSEI",start:"start",metadata:"metadata",resize:"resize",volumechange:"volumechange",volume:"volume",destroy:"destroy",beforeDestroy:"beforeDestroy",streamEnd:"streamEnd",streamRate:"streamRate",streamAbps:"streamAbps",streamVbps:"streamVbps",streamDts:"streamDts",streamSuccess:"streamSuccess",streamMessage:"streamMessage",streamError:"streamError",streamStats:"streamStats",mseSourceOpen:"mseSourceOpen",mseSourceClose:"mseSourceClose",mseSourceended:"mseSourceended",mseSourceStartStreaming:"mseSourceStartStreaming",mseSourceEndStreaming:"mseSourceEndStreaming",mseSourceBufferError:"mseSourceBufferError",mseAddSourceBufferError:"mseAddSourceBufferError",mseSourceBufferBusy:"mseSourceBufferBusy",mseSourceBufferFull:"mseSourceBufferFull",videoWaiting:"videoWaiting",videoTimeUpdate:"videoTimeUpdate",videoSyncAudio:"videoSyncAudio",playToRenderTimes:"playToRenderTimes",playbackTime:"playbackTime",playbackTimestamp:"playbackTimestamp",playbackTimeScroll:"playbackTimeScroll",playbackPrecision:"playbackPrecision",playbackShowPrecisionChange:"playbackShowPrecisionChange",playbackJustTime:"playbackJustTime",playbackStats:"playbackStats",playbackSeek:"playbackSeek",playbackPause:"playbackPause",playbackPauseOrResume:"playbackPauseOrResume",playbackRateChange:"playbackRateChange",playbackPreRateChange:"playbackPreRateChange",ptz:"ptz",streamQualityChange:"streamQualityChange",visibilityChange:"visibilityChange",netBuf:"netBuf",close:"close",networkDelayTimeout:"networkDelayTimeout",togglePerformancePanel:"togglePerformancePanel",viewResizeChange:"viewResizeChange",flvDemuxBufferSizeTooLarge:"flvDemuxBufferSizeTooLarge",talkGetUserMediaSuccess:"talkGetUserMediaSuccess",talkGetUserMediaFail:"talkGetUserMediaFail",talkGetUserMediaTimeout:"talkGetUserMediaTimeout",talkStreamStart:"talkStreamStart",talkStreamOpen:"talkStreamOpen",talkStreamClose:"talkStreamClose",talkStreamError:"talkStreamError",talkStreamInactive:"talkStreamInactive",webrtcDisconnect:"webrtcDisconnect",webrtcFailed:"webrtcFailed",webrtcClosed:"webrtcClosed",webrtcOnConnectionStateChange:"webrtcOnConnectionStateChange",webrtcOnIceConnectionStateChange:"webrtcOnIceConnectionStateChange",crashLog:"crashLog",focus:"focus",blur:"blur",inView:"inView",visibilityHiddenTimeout:"visibilityHiddenTimeout",websocketOpen:"websocketOpen",websocketClose:"websocketClose",websocketError:"websocketError",websocketMessage:"websocketMessage",aiObjectDetectorInfo:"aiObjectDetectorInfo",aiFaceDetectorInfo:"aiFaceDetectorInfo",aiOcclusionDetectResult:"aiOcclusionDetectResult",aiImageDetectResult:"aiImageDetectResult",playFailedAndPaused:"playFailedAndPaused",audioResumeState:"audioResumeState",webrtcStreamH265:"webrtcStreamH265",flvMetaData:"flvMetaData",talkFailedAndStop:"talkFailedAndStop",removeLoadingBgImage:"removeLoadingBgImage",memoryLog:"memoryLog",downloadMemoryLog:"downloadMemoryLog",pressureObserverCpu:"pressureObserverCpu",currentPts:"currentPts",online:"online",offline:"offline",networkState:"networkState"},lt={load:nt.load,timeUpdate:nt.timeUpdate,videoInfo:nt.videoInfo,audioInfo:nt.audioInfo,error:nt.error,kBps:nt.kBps,start:nt.start,timeout:nt.timeout,loadingTimeout:nt.loadingTimeout,loadingTimeoutRetryEnd:nt.loadingTimeoutRetryEnd,delayTimeout:nt.delayTimeout,delayTimeoutRetryEnd:nt.delayTimeoutRetryEnd,fullscreen:"fullscreen",webFullscreen:nt.webFullscreen,play:nt.play,pause:nt.pause,mute:nt.mute,stats:nt.stats,performance:nt.performance,recordingTimestamp:nt.recordingTimestamp,recordStart:nt.recordStart,recordCreateError:nt.recordCreateError,recordEnd:nt.recordEnd,recordBlob:nt.recordBlob,playToRenderTimes:nt.playToRenderTimes,playbackSeek:nt.playbackSeek,playbackStats:nt.playbackStats,playbackTimestamp:nt.playbackTimestamp,playbackPauseOrResume:nt.playbackPauseOrResume,playbackPreRateChange:nt.playbackPreRateChange,playbackRateChange:nt.playbackRateChange,playbackShowPrecisionChange:nt.playbackShowPrecisionChange,ptz:nt.ptz,streamQualityChange:nt.streamQualityChange,zooming:nt.zooming,crashLog:nt.crashLog,focus:nt.focus,blur:nt.blur,visibilityHiddenTimeout:nt.visibilityHiddenTimeout,visibilityChange:nt.visibilityChange,websocketOpen:nt.websocketOpen,websocketClose:nt.websocketClose,networkDelayTimeout:nt.networkDelayTimeout,aiObjectDetectorInfo:nt.aiObjectDetectorInfo,aiFaceDetectorInfo:nt.aiFaceDetectorInfo,aiOcclusionDetectResult:nt.aiOcclusionDetectResult,aiImageDetectResult:nt.aiImageDetectResult,playFailedAndPaused:nt.playFailedAndPaused,streamEnd:nt.streamEnd,audioResumeState:nt.audioResumeState,videoSEI:nt.videoSEI,flvMetaData:nt.flvMetaData,webrtcOnConnectionStateChange:nt.webrtcOnConnectionStateChange,webrtcOnIceConnectionStateChange:nt.webrtcOnIceConnectionStateChange,currentPts:nt.currentPts,videoSmooth:nt.videoSmooth,networkState:nt.networkState,volume:nt.volume},dt={talkStreamClose:nt.talkStreamClose,talkStreamError:nt.talkStreamError,talkStreamInactive:nt.talkStreamInactive,talkGetUserMediaTimeout:nt.talkGetUserMediaTimeout,talkFailedAndStop:nt.talkFailedAndStop},ht={talkStreamError:nt.talkStreamError,talkStreamClose:nt.talkStreamClose},ct={playError:"playIsNotPauseOrUrlIsNull",fetchError:"fetchError",websocketError:"websocketError",webcodecsH265NotSupport:"webcodecsH265NotSupport",webcodecsDecodeError:"webcodecsDecodeError",webcodecsUnsupportedConfigurationError:"webcodecsUnsupportedConfigurationError",webcodecsDecodeConfigureError:"webcodecsDecodeConfigureError",mediaSourceH265NotSupport:"mediaSourceH265NotSupport",mediaSourceAudioG711NotSupport:"mediaSourceAudioG711NotSupport",mediaSourceAudioInitTimeout:"mediaSourceAudioInitTimeout",mediaSourceAudioNoDataTimeout:"mediaSourceAudioNoDataTimeout",mediaSourceDecoderConfigurationError:"mediaSourceDecoderConfigurationError",mediaSourceFull:nt.mseSourceBufferFull,mseSourceBufferError:nt.mseSourceBufferError,mseAddSourceBufferError:nt.mseAddSourceBufferError,mediaSourceAppendBufferError:"mediaSourceAppendBufferError",mediaSourceTsIsMaxDiff:"mediaSourceTsIsMaxDiff",mediaSourceUseCanvasRenderPlayFailed:"mediaSourceUseCanvasRenderPlayFailed",mediaSourceBufferedIsZeroError:"mediaSourceBufferedIsZeroError",wasmDecodeError:"wasmDecodeError",wasmUseVideoRenderError:"wasmUseVideoRenderError",hlsError:"hlsError",webrtcError:"webrtcError",webrtcClosed:nt.webrtcClosed,webrtcIceCandidateError:"webrtcIceCandidateError",webglAlignmentError:"webglAlignmentError",wasmWidthOrHeightChange:"wasmWidthOrHeightChange",mseWidthOrHeightChange:"mseWidthOrHeightChange",wcsWidthOrHeightChange:"wcsWidthOrHeightChange",widthOrHeightChange:"widthOrHeightChange",tallWebsocketClosedByError:"tallWebsocketClosedByError",flvDemuxBufferSizeTooLarge:nt.flvDemuxBufferSizeTooLarge,wasmDecodeVideoNoResponseError:"wasmDecodeVideoNoResponseError",audioChannelError:"audioChannelError",simdH264DecodeVideoWidthIsTooLarge:"simdH264DecodeVideoWidthIsTooLarge",simdDecodeError:"simdDecodeError",webglContextLostError:"webglContextLostError",videoElementPlayingFailed:"videoElementPlayingFailed",videoElementPlayingFailedForWebrtc:"videoElementPlayingFailedForWebrtc",decoderWorkerInitError:"decoderWorkerInitError",videoInfoError:"videoInfoError",videoCodecIdError:"videoCodecIdError",streamEnd:nt.streamEnd,websocket1006Error:"websocket1006Error",delayTimeout:nt.delayTimeout,loadingTimeout:nt.loadingTimeout,networkDelayTimeout:nt.networkDelayTimeout,aliyunRtcError:"aliyunRtcError",...ht},ut="notConnect",pt="open",ft="close",mt="error",gt={download:"download",base64:"base64",blob:"blob"},yt="download",At="blob",bt={7:"H264(AVC)",12:"H265(HEVC)",99:"MPEG4"},vt=7,_t=12,St="H264(AVC)",wt="H265(HEVC)",Et=10,Tt=2,kt={AAC:"AAC",ALAW:"ALAW(g711a)",MULAW:"MULAW(g711u)",MP3:"MP3"},Ct={10:"AAC",7:"ALAW",8:"MULAW",2:"MP3"},xt=7,Rt=8,Dt=5,Lt=1,Pt=5,Bt=6,It=7,Mt=8,Ut=14,Ft=19,Ot=20,Nt=21,jt=32,zt=32,Gt=33,Ht=33,Vt=34,$t=34,Wt=39,Jt=39,qt=40,Kt=38,Yt=48,Qt=0,Xt=1,Zt=2,ei="webcodecs",ti="webgl",ii="webgl2",si="webgpu",ri="offscreen",ai="mse",oi="hls",ni="webrtc",li="key",di="delta",hi='video/mp4; codecs="avc1.64002A"',ci='video/mp4; codecs="hev1.1.6.L123.b0"',ui='video/mp4;codecs="hev1.1.6.L120.90"',pi='video/mp4;codecs="hev1.2.4.L120.90"',fi='video/mp4;codecs="hev1.3.E.L120.90"',mi='video/mp4;codecs="hev1.4.10.L120.90"',gi="ended",yi="open",Ai="closed",bi=27,vi=38,_i=40,Si="oneHour",wi="halfHour",Ei="tenMin",Ti="fiveMin",ki={oneHour:"one-hour",halfHour:"half-hour",tenMin:"ten-min",fiveMin:"five-min"},Ci=["oneHour","halfHour","tenMin","fiveMin"],xi=["up","right","down","left","left-up","right-up","left-down","right-down"],Ri="stop",Di="fiStop",Li="zoomExpand",Pi="zoomNarrow",Bi="apertureFar",Ii="apertureNear",Mi="focusFar",Ui="focusNear",Fi="cruiseStart",Oi="cruiseStop",Ni="fogOpen",ji="fogClose",zi="wiperOpen",Gi="wiperClose",Hi="g711a",Vi="g711u",$i="pcm",Wi="opus",Ji={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"},qi="sourceclose",Ki="sourceopen",Yi="sourceended",Qi="startstreaming",Xi="endstreaming",Zi="qualitychange",es="canplay",ts="waiting",is="timeupdate",ss="ratechange",rs="avc",as="hevc",os="A key frame is required after configure() or flush()",ns="Cannot call 'decode' on a closed codec",ls="Unsupported configuration",ds="Decoder failure",hs="Decoding error",cs="Decoder error",us="HEVC decoding is not supported",ps="The user aborted a request",fs="AbortError",ms="AbortError",gs="loading",ys="playing",As="paused",bs="destroy",vs=0,_s=1,Ss=8,ws=0,Es=98,Ts="empty",ks="rtp",Cs="tcp",xs="open",Rs="close",Ds="error",Ls="message",Ps="worklet",Bs="script",Is={encType:Hi,packetType:ks,packetTcpSendType:Cs,rtpSsrc:"0000000000",numberChannels:1,sampleRate:8e3,sampleBitsWidth:16,sendInterval:20,debug:!1,debugLevel:q,testMicrophone:!1,saveToTempFile:!1,audioBufferLength:160,engine:Ps,checkGetUserMediaTimeout:!1,getUserMediaTimeout:1e4,audioConstraints:{latency:!0,noiseSuppression:!0,autoGainControl:!0,echoCancellation:!0,sampleRate:48e3,channelCount:1}},Ms="worklet",Us="script",Fs="active",Os={name:"",index:0,icon:"",iconHover:"",iconTitle:"",activeIcon:"",activeIconHover:"",activeIconTitle:"",click:null,activeClick:null},Ns={content:"",click:null,index:0},js=1,zs="subtitle-segments",Gs="hls-manifest-loaded",Hs="hls-level-loaded",Vs="demuxed-track",$s="flv-script-data",Ws="metadata-parsed",Js="ttfb",qs="load-retry",Ks="load-start",Ys="speed",Qs="load-complete",Xs="load-response-headers",Zs="sei",er="sei-in-time",tr="switch-url-failed",ir="switch-url-success",sr="subtitle-playlist",rr="stream-parsed",ar="error",or=[0,160,240,320,480,640],nr=[0,160,240,320,480,640],lr=["轻松","正常","较高","高"],dr="idle",hr="buffering",cr="complete",ur={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"},pr="video decoder initialization failed",fr="audio packet",mr=1,gr=2,yr=0,Ar=1,br=3,vr=16,_r="candidate-pair",Sr="inbound-rtp",wr="local-candidate",Er="remote-candidate",Tr="track",kr=9e4,Cr=45e4,xr=9e4,Rr="ws1006",Dr="mseDecodeError",Lr="wcsDecodeError";class Pr{constructor(e){this.log=function(t){if(e._opt.debug&&e._opt.debugLevel==J){const a=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var i=arguments.length,s=new Array(i>1?i-1:0),r=1;r1?i-1:0),r=1;r1?s-1:0),a=1;a32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let i=e-this._current_word_bits_left;this._fillCurrentWord();let s=Math.min(i,this._current_word_bits_left),r=this._current_word>>>32-s;return this._current_word<<=s,this._current_word_bits_left-=s,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Fr=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Or=Fr,Nr=Fr;function jr(e){let{profile:t,sampleRate:i,channel:s}=e;return new Uint8Array([175,0,t<<3|(14&i)>>1,(1&i)<<7|s<<3])}function zr(e){return Gr(e)&&e[1]===vs}function Gr(e){return e[0]>>4===Et}function Hr(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}function Vr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return 1024*t/e}const $r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];class Wr{constructor(e){this.buffer=e,this.buflen=e.length,this.bufpos=0,this.bufoff=0,this.iserro=!1}read(e){let t=0,i=0;for(;e;){if(e<0||this.bufpos>=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=this.bufoff+e>8?8-this.bufoff:e,t<<=i,t+=this.buffer[this.bufpos]>>8-this.bufoff-i&255>>8-i,this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,i=this.bufoff,s=this.read(e);return this.bufpos=t,this.bufoff=i,s}read_golomb(){let e;for(e=0;0==this.read(1)&&!this.iserro;e++);return(1<=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(4095===(i[t+0]<<8|i[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let i=this.current_syncword_offset_,s=(8&e[i+1])>>>3,r=(6&e[i+1])>>>1,a=1&e[i+1],o=(192&e[i+2])>>>6,n=(60&e[i+2])>>>2,l=(1&e[i+2])<<2|(192&e[i+3])>>>6,d=(3&e[i+3])<<11|e[i+4]<<3|(224&e[i+5])>>>5;if(e[i+6],i+d>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let h=1===a?7:9,c=d-h;i+=h;let u=this.findNextSyncwordOffset(i+c);if(this.current_syncword_offset_=u,0!==s&&1!==s||0!==r)continue;let p=e.subarray(i,i+c);t={},t.audio_object_type=o+1,t.sampling_freq_index=n,t.sampling_frequency=Or[n],t.channel_config=l,t.data=p}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Xr{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,i=this.data_;for(;;){if(t+1>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(695===(i[t+0]<<3|i[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),i=0;for(let s=0;s<=t;s++)i<<=8,i|=e.readByte();return i}readNextAACFrame(e){let t=this.data_,i=null;for(;null==i&&!this.eof_flag_;){let s=this.current_syncword_offset_,r=(31&t[s+1])<<8|t[s+2];if(s+3+r>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let a=new Ur(t.subarray(s+3,s+3+r)),o=null;if(a.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(s+3+r),a.destroy();continue}o=e}else{let e=a.readBool();if(e&&a.readBool()){console.error("audioMuxVersionA is Not Supported"),a.destroy();break}if(e&&this.getLATMValue(a),!a.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),a.destroy();break}if(0!==a.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),a.destroy();break}if(0!==a.readBits(4)){console.error("more than 2 numProgram Not Supported"),a.destroy();break}if(0!==a.readBits(3)){console.error("more than 2 numLayer Not Supported"),a.destroy();break}let t=e?this.getLATMValue(a):0,i=a.readBits(5);t-=5;let s=a.readBits(4);t-=4;let r=a.readBits(4);t-=4,a.readBits(3),t-=3,t>0&&a.readBits(t);let n=a.readBits(3);if(0!==n){console.error(`frameLengthType = ${n}. Only frameLengthType = 0 Supported`),a.destroy();break}a.readByte();let l=a.readBool();if(l)if(e)this.getLATMValue(a);else{let e=0;for(;;){e<<=8;let t=a.readBool();if(e+=a.readByte(),!t)break}console.log(e)}a.readBool()&&a.readByte(),o={},o.audio_object_type=i,o.sampling_freq_index=s,o.sampling_frequency=Or[o.sampling_freq_index],o.channel_config=r,o.other_data_present=l}let n=0;for(;;){let e=a.readByte();if(n+=e,255!==e)break}let l=new Uint8Array(n);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function ea(e){const t=e.byteLength,i=new Uint8Array(4);i[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t;const s=new Uint8Array(t+4);return s.set(i,0),s.set(e,4),s}function ta(){}function ia(e){let t=null;const i=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let s=0;for(;!t&&s0&&void 0!==arguments[0]?arguments[0]:"";const t=e.split(","),i=atob(t[1]),s=t[0].replace("data:","").replace(";base64","");let r=i.length,a=new Uint8Array(r);for(;r--;)a[r]=i.charCodeAt(r);return new File([a],"file",{type:s})}function aa(){return(new Date).getTime()}function oa(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}function na(e,t,i){if(e)return"object"==typeof t&&Object.keys(t).forEach((i=>{na(e,i,t[i])})),e.style[t]=i,e}function la(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return 0;const s=getComputedStyle(e,null).getPropertyValue(t);return i?parseFloat(s):s}function da(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function ha(e){let t=0,i=da();return s=>{if(!Ta(s))return;t+=s;const r=da(),a=r-i;a>=1e3&&(e(t/a*1e3),i=r,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();const ca='"4-1-2024"';function ua(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function pa(){return!(ua()||/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase()))}function fa(){const e=window.navigator.userAgent.toLowerCase();return/android/i.test(e)}function ma(){const e=window.navigator.userAgent.toLowerCase();return/firefox/i.test(e)}function ga(){const e=window.navigator.userAgent.toLowerCase()||"",t={type:"",version:""},i={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:e.indexOf("chrome")>-1&&e.indexOf("safari")>-1,Firefox:e.indexOf("firefox")>-1,Opera:e.indexOf("opera")>-1,Safari:e.indexOf("safari")>-1&&-1==e.indexOf("chrome"),Edge:e.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(e),WeixinBrowser:/MicroMessenger/i.test(e)};for(let s in i)if(i[s]){let i="";if("IE"===s){const t=e.match(/(msie\s|trident.*rv:)([\w.]+)/);t&&t.length>2&&(i=e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2])}else if("Chrome"===s){for(let e in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[e].type&&(s="360");const t=e.match(/chrome\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Firefox"===s){const t=e.match(/firefox\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Opera"===s){const t=e.match(/opera\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Safari"===s){const t=e.match(/version\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Edge"===s){const t=e.match(/edge\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("QQBrowser"===s){const t=e.match(/qqbrowser\/([\d.]+)/);t&&t.length>1&&(i=t[1])}t.type=s,t.version=parseInt(i)}return t}function ya(){const e=window.navigator.userAgent.toLowerCase();return e&&/iphone|ipad|ipod|ios/.test(e)}function Aa(){const e=window.navigator.userAgent;return!e.match(/Chrome/gi)&&!!e.match(/Safari/gi)}function ba(e,t){if(0===arguments.length)return null;var i,s=t||"{y}-{m}-{d} {h}:{i}:{s}";"object"==typeof e?i=e:(10===(""+e).length&&(e=1e3*parseInt(e)),e=+e,i=new Date(e));var r={y:i.getFullYear(),m:i.getMonth()+1,d:i.getDate(),h:i.getHours(),i:i.getMinutes(),s:i.getSeconds(),a:i.getDay()},a=s.replace(/{(y|m|d|h|i|s|a)+}/g,((e,t)=>{var i=r[t];return"a"===t?["一","二","三","四","五","六","日"][i-1]:(e.length>0&&i<10&&(i="0"+i),i||0)}));return a}function va(){return"VideoFrame"in window}function _a(e){if("string"!=typeof e)return e;var t=Number(e);return isNaN(t)?e:t}function Sa(){return"xxxxxxxxxxxx4xxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}function wa(e,t){let i,s,r=!1;return function a(){for(var o=arguments.length,n=new Array(o),l=0;l{r=!1,i&&(a.apply(s,i),i=null,s=null)}),t)}}function Ea(e){if(null==e||""==e)return"0 Bytes";const t=new Array("Bytes","KB","MB","GB","TB","PB","EB","ZB","YB");let i=0;const s=parseFloat(e);i=Math.floor(Math.log(s)/Math.log(1024));var r=s/Math.pow(1024,i);return(r=r.toFixed(2))+t[i]}function Ta(e){return"[object Number]"===Object.prototype.toString.call(e)}function ka(){let e=!1;return"MediaSource"in self&&(self.MediaSource.isTypeSupported(ci)||self.MediaSource.isTypeSupported(ui)||self.MediaSource.isTypeSupported(pi)||self.MediaSource.isTypeSupported(fi)||self.MediaSource.isTypeSupported(mi))&&(e=!0),e}function Ca(){const e=ga();return"chrome"===e.type.toLowerCase()&&e.version>=107}function xa(){let e=!1;return"MediaStreamTrackGenerator"in window&&(e=!0),e}function Ra(){let e=!1;return"MediaStream"in window&&(e=!0),e}function Da(e,t){let i=window.URL.createObjectURL(t),s=window.document.createElement("a");s.download=e,s.href=i;let r=window.document.createEvent("MouseEvents");r.initEvent("click",!0,!0),s.dispatchEvent(r),setTimeout((()=>{window.URL.revokeObjectURL(i)}),ya()?1e3:0)}function La(e){return null==e}function Pa(e){return!0===e||!1===e}function Ba(e){return!La(e)}function Ia(e){let t={left:"",right:"",top:"",bottom:"",opacity:1,backgroundColor:"",image:{src:"",width:"100",height:"60"},text:{content:"",fontSize:"14",color:"#000",width:"",height:""},rect:{color:"green",lineWidth:2,width:"",height:"",fill:"",fillOpacity:.2},line:{x1:"",y1:"",x2:"",y2:"",color:"green",lineWidth:2},polygon:{color:"green",lineWidth:2,list:[],fill:"",fillOpacity:.2},html:""};const i=Object.assign(t.image,e.image||{}),s=Object.assign(t.text,e.text||{}),r=Object.assign(t.rect,e.rect||{}),a=Object.assign(t.line,e.line||{});return t=Object.assign(t,e,{image:i,text:s,rect:r,line:a}),t}function Ma(e,t){let i={container:e||"",text:"",opacity:"",angle:"",color:"",fontSize:"",fontFamily:""};return i=Object.assign(i,t),{watermark_parent_node:i.container,watermark_alpha:i.opacity,watermark_angle:i.angle,watermark_fontsize:i.fontSize,watermark_color:i.color,watermark_font:i.fontFamily,watermark_txt:i.text}}function Ua(e,t){return new Promise(((i,s)=>{let r=Ia(t);if(!r.image.src&&!r.text.content)return i(e);let a=document.createElement("canvas");a.width=t.width,a.height=t.height;let o=a.getContext("2d"),n=0,l=0;Ta(r.left)?n=r.left:Ta(r.right)&&(n=a.width-r.right),Ta(r.top)?l=r.top:Ta(r.bottom)&&(l=a.height-r.bottom);const d=new Image;d.src=e,d.onload=()=>{if(o.drawImage(d,0,0),r.image&&r.image.src){const e=new Image;e.src=r.image.src,e.setAttribute("crossOrigin","Anonymous"),e.onload=()=>{n-=r.image.width,o.drawImage(e,n,l,r.image.width,r.image.height),i(a.toDataURL(t.format,t.quality))},e.onerror=e=>{s()}}else r.text&&r.text.content&&(o.font=r.text.fontSize+"px 宋体",o.fillStyle=r.text.color,o.textAlign="right",o.fillText(r.text.content,n,l),i(a.toDataURL(t.format,t.quality)))},d.onerror=e=>{s(e)}}))}function Fa(e){var t;if(e>-1){var i=Math.floor(e/3600),s=Math.floor(e/60)%60,r=e%60;t=i<10?"0"+i+":":i+":",s<10&&(t+="0"),t+=s+":",(r=Math.round(r))<10&&(t+="0"),t+=r.toFixed(0)}return t}function Oa(e,t){let i="";if(e>-1){const s=Math.floor(e/60)%60;let r=e%60;r=Math.round(r),i=s<10?"0"+s+":":s+":",r<10&&(i+="0"),i+=r,La(t)||(t<10&&(t="0"+t),i+=":"+t)}return i}function Na(e){let t="";if(e>-1){const i=Math.floor(e/60/60)%60;let s=Math.floor(e/60)%60,r=e%60;s=Math.round(s),t=i<10?"0"+i+":":i+":",s<10&&(t+="0"),t+=s+":",r<10&&(t+="0"),t+=r}return t}function ja(e,t){const i=Math.floor(t/60)%60,s=Math.floor(t%60);return new Date(e).setHours(i,s,0,0)}function za(e,t){const i=Math.floor(t/60/60)%60,s=Math.floor(t/60)%60,r=t%60;return new Date(e).setHours(i,s,r,0)}function Ga(e){return(""+e).length}function Ha(e){return e&&0===Object.keys(e).length}function Va(e){return!Ha(e)}function $a(e){return"string"==typeof e}const Wa=()=>{const e=window.navigator.userAgent;return/MicroMessenger/i.test(e)},Ja=()=>{const e=window.navigator.userAgent;return/Chrome/i.test(e)};function qa(e){const t=e||window.event;return t.target||t.srcElement}function Ka(){return ma()&&function(){const e=navigator.userAgent.toLowerCase();return/macintosh|mac os x/i.test(e)}()}function Ya(e){return"function"==typeof e}function Qa(e){if(ua()){let t=0,i=0;if(1===e.touches.length){let s=e.touches[0];t=s.clientX,i=s.clientY}return{posX:t,posY:i}}let t=0,i=0;const s=e||window.event;return s.pageX||s.pageY?(t=s.pageX,i=s.pageY):(s.clientX||s.clientY)&&(t=e.clientX+document.documentElement.scrollLeft+document.body.scrollLeft,i=e.clientY+document.documentElement.scrollTop+document.body.scrollTop),{posX:t,posY:i}}function Xa(){let e=document.createElement("video"),t=e.canPlayType("application/vnd.apple.mpegurl");return e=null,t}function Za(e){let t=po(e.hasAudio)&&(e.useMSE||e.useWCS&&!e.useOffscreen)&&po(e.demuxUseWorker);return!!(po(t)&&e.useMSE&&e.mseDecodeAudio&&po(e.demuxUseWorker))||t}function eo(e){const t=e.toString().trim().match(/^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/)[1];const i=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(i)}function to(e){e.close()}function io(){return"https:"===window.location.protocol||"localhost"===window.location.hostname}function so(e){const t=Object.prototype.toString;return function(e){switch(t.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:try{return e instanceof Error}catch(e){return!1}}}(e)?e.message:null==e?"":"object"==typeof e?JSON.stringify(e,null,2):String(e)}function ro(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let i=e[0],s=null,r=1;if(e.length>0){let t=e[1];t&&t.ts-i.ts>1e5&&(i=t,r=2)}if(i)for(let a=r;a=1e3){e[a-1].ts-i.ts<1e3&&(s=a+1)}}}return s}function ao(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),i=window.atob(t),s=new Uint8Array(i.length),r=0;r>4===_s&&e[1]===vs}function uo(e){return!0===e||"true"===e}function po(e){return!0!==e&&"true"!==e}function fo(e){return e.replace(/-([a-z])/g,(function(e,t){return t.toUpperCase()}))}function mo(){return/iphone/i.test(navigator.userAgent)}function go(){return window.performance&&window.performance.memory?window.performance.memory:null}function yo(){try{var e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}}function Ao(e){return e.trim().match(/^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/)[1]}function bo(){let e=!1;return"requestVideoFrameCallback"in HTMLVideoElement.prototype&&(e=!0),e}function vo(){let e=!1;return"PressureObserver"in window&&(e=!0),e}class _o{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,i,s)));e.addEventListener(t,i,s);const r=()=>{Ya(e.removeEventListener)&&e.removeEventListener(t,i,s)};return this.destroys.push(r),r}destroy(){this.master.debug&&this.master.debug.log("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class So{on(e,t,i){const s=this.e||(this.e={});return(s[e]||(s[e]=[])).push({fn:t,ctx:i}),this}once(e,t,i){const s=this;function r(){s.off(e,r);for(var a=arguments.length,o=new Array(a),n=0;n1?i-1:0),r=1;r{delete i[e]})),void delete this.e;const s=i[e],r=[];if(s&&t)for(let e=0,i=s.length;e0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=this.gl.createProgram();return this.gl.attachShader(i,e),this.gl.attachShader(i,t),this.gl.linkProgram(i),this.gl.getProgramParameter(i,this.gl.LINK_STATUS)?i:(console.log("Unable to initialize the shader program: "+this.gl.getProgramInfoLog(i)),null)}_loadShader(e,t){const i=this.gl,s=i.createShader(e);return i.shaderSource(s,t),i.compileShader(s),i.getShaderParameter(s,i.COMPILE_STATUS)?s:(console.log("An error occurred compiling the shaders: "+i.getShaderInfoLog(s)),i.deleteShader(s),null)}_initBuffers(){const e=this.gl,t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);const i=[-1,-1,1,-1,1,1,-1,1];e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW);var s=[];s=s.concat([0,1],[1,1],[1,0],[0,0]);const r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array(s),e.STATIC_DRAW);const a=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,a);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{positions:i,position:t,texPosition:r,indices:a}}_createTexture(){let e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),e}_drawScene(e,t,i){this.gl.viewport(0,0,e,t),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.position),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array(this._buffers.positions),this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this._programInfo.attribLocations.vertexPosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.vertexPosition),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.texPosition),this.gl.vertexAttribPointer(this._programInfo.attribLocations.texturePosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.texturePosition),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this._buffers.indices);i?(this.gl.activeTexture(this.gl.TEXTURE0+3),this.gl.bindTexture(this.gl.TEXTURE_2D,this._ytexture),this.gl.activeTexture(this.gl.TEXTURE0+4),this.gl.bindTexture(this.gl.TEXTURE_2D,this._utexture),this.gl.activeTexture(this.gl.TEXTURE0+5),this.gl.bindTexture(this.gl.TEXTURE_2D,this._vtexture)):(this.gl.activeTexture(this.gl.TEXTURE0+2),this.gl.bindTexture(this.gl.TEXTURE_2D,this._rgbatexture)),this.gl.useProgram(this._programInfo.program),this.gl.uniform1i(this._programInfo.uniformLocations.rgbatexture,2),this.gl.uniform1i(this._programInfo.uniformLocations.ytexture,3),this.gl.uniform1i(this._programInfo.uniformLocations.utexture,4),this.gl.uniform1i(this._programInfo.uniformLocations.vtexture,5),this.gl.uniform1i(this._programInfo.uniformLocations.isyuv,i?1:0),this.gl.drawElements(this.gl.TRIANGLES,6,this.gl.UNSIGNED_SHORT,0)}_calRect(e,t,i,s,r,a){let o=2*e/r-1,n=2*(a-t-s)/a-1,l=2*(e+i)/r-1,d=2*(a-t)/a-1;return[o,n,l,n,l,d,o,d]}_clear(){this.gl.clearColor(0,0,0,1),this.gl.clearDepth(1),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}render(e,t,i,s,r){const a=this.gl;this._clear(),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._ytexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e,t,0,a.LUMINANCE,a.UNSIGNED_BYTE,i),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this._utexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,s),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,this._vtexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,r),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}renderYUV(e,t,i){let s=i.slice(0,e*t),r=i.slice(e*t,e*t*5/4),a=i.slice(e*t*5/4,e*t*3/2);const o=this.gl;this._clear(),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,this._ytexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e,t,0,o.LUMINANCE,o.UNSIGNED_BYTE,s),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this._utexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e/2,t/2,0,o.LUMINANCE,o.UNSIGNED_BYTE,r),o.activeTexture(o.TEXTURE2),o.bindTexture(o.TEXTURE_2D,this._vtexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e/2,t/2,0,o.LUMINANCE,o.UNSIGNED_BYTE,a),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}drawDom(e,t,i,s,r){const a=this.gl;a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._rgbatexture),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,r),this._buffers.positions=this._calRect(i,s,r.width,r.height,e,t),this._drawScene(e,t,!1)}}class Lo{constructor(e){this.gpu=e,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null,this.hasInited=!1,this.buffers=this._initBuffer(),this._initPipeline().then((e=>{this.pipeline=e,this.matrixGroupInfo=this._initMatrixGroupInfo(),this.hasInited=!0}))}destroy(){this.gpu&&(this.gpu.device.destroy(),this.gpu=null),this.hasInited=!1,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null}_initBuffer(){const e=this.gpu.device,t=new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),i=e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST});e.queue.writeBuffer(i,0,t);const s=new Float32Array([0,1,1,1,1,0,0,0]),r=e.createBuffer({size:s.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST});e.queue.writeBuffer(r,0,s);const a=new Uint16Array([0,1,2,0,2,3]),o=e.createBuffer({size:a.byteLength,usage:window.GPUBufferUsage.INDEX|window.GPUBufferUsage.COPY_DST});return e.queue.writeBuffer(o,0,a),{positionBuffer:i,texpositionBuffer:r,indexBuffer:o}}_initPipeline(){return new Promise(((e,t)=>{const i=this.gpu.device,s=this.gpu.format,r={layout:"auto",vertex:{module:i.createShaderModule({code:"\n\n @binding(0) @group(0) var uModelMatrix : mat4x4;\n @binding(1) @group(0) var uViewMatrix : mat4x4;\n @binding(2) @group(0) var uProjectionMatrix : mat4x4;\n\n struct VertexOutput {\n @builtin(position) Position : vec4,\n @location(0) vTexturePosition : vec2,\n }\n\n @vertex\n fn main(\n @location(0) aVertexPosition : vec4,\n @location(1) aTexturePosition : vec2\n ) -> VertexOutput {\n var output : VertexOutput;\n var tmppos : vec4 = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n output.Position = vec4(tmppos.x, tmppos.y, (tmppos.z+1.)/2., tmppos.w); // webgl z [-1, 1], webgpu z [0, 1], 这里z做下调整 z-webgpu = (z-webgl+1)/2\n output.vTexturePosition = aTexturePosition;\n return output;\n }\n\n "}),entryPoint:"main",buffers:[{arrayStride:12,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]},{arrayStride:8,attributes:[{shaderLocation:1,offset:0,format:"float32x2"}]}]},primitive:{topology:"triangle-list"},fragment:{module:i.createShaderModule({code:"\n @group(1) @binding(0) var mySampler: sampler;\n @group(1) @binding(1) var yTexture: texture_2d;\n @group(1) @binding(2) var uTexture: texture_2d;\n @group(1) @binding(3) var vTexture: texture_2d;\n\n const YUV2RGB : mat4x4 = mat4x4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n @fragment\n fn main(\n @location(0) vTexturePosition: vec2\n ) -> @location(0) vec4 {\n\n var y : f32= textureSample(yTexture, mySampler, vTexturePosition).r;\n var u : f32 = textureSample(uTexture, mySampler, vTexturePosition).r;\n var v : f32 = textureSample(vTexture, mySampler, vTexturePosition).r;\n\n return vec4(y, u, v, 1.0)*YUV2RGB;\n }\n\n "}),entryPoint:"main",targets:[{format:s}]},depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};i.createRenderPipelineAsync(r).then((t=>{e(t)})).catch((e=>{t(e)}))}))}_initMatrixGroupInfo(){const e=this.gpu.device,t=this.pipeline,i=To();xo(i,-1,1,-1,1,.1,100);const s=To();ko(s);const r=To();!function(e,t,i,s){var r,a,o,n,l,d,h,c,u,p,f=t[0],m=t[1],g=t[2],y=s[0],A=s[1],b=s[2],v=i[0],_=i[1],S=i[2];Math.abs(f-v)Ia(e)));this.configList=i,this._updateDom()}_resizeDomForVideo(){const e=this.player.width,t=this.player.height,i=this.player.getVideoInfo();if(!(i&&i.height>0&&i.width>0))return;let s=i.width,r=i.height;const a=this.player._opt;let o=t,n=e;if(a.hasControl&&!a.controlAutoHide){const e=a.playType===_?Yt:Kt;ua()&&this.player.fullscreen&&a.useWebFullScreen?n-=e:o-=e}const l=a.rotate;let d=(n-s)/2,h=(o-r)/2;270!==l&&90!==l||(s=i.height,r=i.width);const c=n/s,u=o/r;let p=c>u?u:c;a.isResize||c!==u&&(p=c+","+u),a.isFullResize&&(p=c>u?c:u);let f="scale("+p+")";"none"===a.mirrorRotate&&l&&(f+=" rotate("+l+"deg)"),"level"===a.mirrorRotate?f+=" rotateY(180deg)":"vertical"===a.mirrorRotate&&(f+=" rotateX(180deg)"),this.scale=-1!==(""+p).indexOf(",")?c:p,this.shadowRootInnerDom.style.transform=f,this.shadowRootInnerDom.style.left=d+"px",this.shadowRootInnerDom.style.top=h+"px",this.shadowRootInnerDom.style.width=i.width+"px",this.shadowRootInnerDom.style.height=i.height+"px",this.shadowRootInnerDom.style.display="block"}_resizeDomForCanvas(){const e=this.player.getVideoInfo();if(!(e&&e.height>0&&e.width>0))return;const t=this.player._opt;let i=this.player.width,s=this.player.height;if(t.hasControl&&!t.controlAutoHide){const e=t.playType===_?Yt:Kt;ua()&&this.player.fullscreen&&t.useWebFullScreen?i-=e:s-=e}let r=e.width,a=e.height;const o=t.rotate;let n=(i-r)/2,l=(s-a)/2;270!==o&&90!==o||(r=e.height,a=e.width);const d=i/r,h=s/a;let c=d>h?h:d;t.isResize||d!==h&&(c=d+","+h),t.isFullResize&&(c=d>h?d:h);let u="scale("+c+")";"none"===t.mirrorRotate&&o&&(u+=" rotate("+o+"deg)"),"level"===t.mirrorRotate?u+=" rotateY(180deg)":"vertical"===t.mirrorRotate&&(u+=" rotateX(180deg)"),this.shadowRootInnerDom.style.height=e.height+"px",this.shadowRootInnerDom.style.width=e.width+"px",this.shadowRootInnerDom.style.padding="0",this.shadowRootInnerDom.style.transform=u,this.shadowRootInnerDom.style.left=n+"px",this.shadowRootInnerDom.style.top=l+"px",this.shadowRootInnerDom.style.display="block"}_resizeDomRatio(){const e=this.player.getVideoInfo();if(!(e&&e.height>0&&e.width>0))return;const t=this.player._opt.aspectRatio.split(":").map(Number);let i=this.player.width,s=this.player.height;const r=this.player._opt;let a=0;r.hasControl&&!r.controlAutoHide&&(a=r.playType===_?Yt:Kt,s-=a);const o=e.width/e.height,n=t[0]/t[1];if(o>n){const t=n*e.height/e.width;this.shadowRootInnerDom.style.width=100*t+"%",this.shadowRootInnerDom.style.height=`calc(100% - ${a}px)`,this.shadowRootInnerDom.style.padding=`0 ${(i-i*t)/2}px`}else{const t=e.width/n/e.height;this.shadowRootInnerDom.style.width="100%",this.shadowRootInnerDom.style.height=`calc(${100*t}% - ${a}px)`,this.shadowRootInnerDom.style.padding=(s-s*t)/2+"px 0"}this.shadowRootInnerDom.style.display="block"}_updateDom(){this.shadowRoot&&this.configList.forEach((e=>{const t=document.createElement("div");let i=null;if(e.image&&e.image.src?(i=document.createElement("img"),i.style.height="100%",i.style.width="100%",i.style.objectFit="contain",i.src=e.image.src):e.text&&e.text.content?i=document.createTextNode(e.text.content):(e.rect&&e.rect.color&&e.rect.width||e.html||e.line&&e.line.x1&&e.line.y1&&e.line.x2&&e.line.y2||e.polygon&&e.polygon.list&&e.polygon.list.length>=3)&&(i=document.createElement("div")),i){if(t.appendChild(i),t.style.visibility="",t.style.position="absolute",t.style.display="block",t.style["-ms-user-select"]="none",t.style["-moz-user-select"]="none",t.style["-webkit-user-select"]="none",t.style["-o-user-select"]="none",t.style["user-select"]="none",t.style["-webkit-touch-callout"]="none",t.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",t.style["-webkit-text-size-adjust"]="none",t.style["-webkit-touch-callout"]="none",t.style.opacity=e.opacity,Ba(e.left)&&(Ta(e.left)?t.style.left=e.left+"px":t.style.left=e.left),Ba(e.right)&&(Ta(e.right)?t.style.right=e.right+"px":t.style.right=e.right),Ba(e.top)&&(Ta(e.top)?t.style.top=e.top+"px":t.style.top=e.top),Ba(e.bottom)&&(Ta(e.bottom)?t.style.bottom=e.bottom+"px":t.style.bottom=e.bottom),e.backgroundColor&&(t.style.backgroundColor=e.backgroundColor),t.style.overflow="hidden",t.style.zIndex="9999999",e.image&&e.image.src)t.style.width=e.image.width+"px",t.style.height=e.image.height+"px";else if(e.text&&e.text.content)t.style.fontSize=e.text.fontSize+"px",t.style.color=e.text.color,e.text.width&&(t.style.width=e.text.width+"px"),e.text.height&&(t.style.height=e.text.height+"px");else if(e.rect&&e.rect.color&&e.rect.width){if(t.style.width=e.rect.width+"px",t.style.height=e.rect.height+"px",t.style.borderWidth=e.rect.lineWidth+"px",t.style.borderStyle="solid",t.style.borderColor=e.rect.color,e.rect.fill){const i=document.createElement("div");i.style.position="absolute",i.style.width="100%",i.style.height="100%",i.style.backgroundColor=e.rect.fill,e.rect.fillOpacity&&(i.style.opacity=e.rect.fillOpacity),t.appendChild(i)}}else if(e.html)t.style.width="100%",t.style.height="100%",t.innerHTML=e.html;else if(e.line&&e.line.x1&&e.line.y1&&e.line.x2&&e.line.y2)this.settingLine(t,e.line);else if(e.polygon&&e.polygon.list&&e.polygon.list.length>=3){t.style.width="100%",t.style.height="100%";let i=e.polygon.list;const s=e.polygon.color,r=e.polygon.lineWidth;if(i=i.sort(((e,t)=>(e.index||0)-(t.index||0))),e.polygon.fill){const s=document.createElement("div");s.style.position="absolute",s.style.width="100%",s.style.height="100%";const r="polygon("+i.map((e=>`${e.x}px ${e.y}px`)).join(", ")+")";s.style.clipPath=r,s.style.backgroundColor=e.polygon.fill,e.polygon.fillOpacity&&(s.style.opacity=e.polygon.fillOpacity),t.appendChild(s)}i.forEach(((e,a)=>{const o=document.createElement("div");if(a===i.length-1){const a=i[0],n={x1:e.x,y1:e.y,x2:a.x,y2:a.y,color:s,lineWidth:r};return this.settingLine(o,n),void t.appendChild(o)}const n=i[a+1],l={x1:e.x,y1:e.y,x2:n.x,y2:n.y,color:s,lineWidth:r};this.settingLine(o,l),t.appendChild(o)}))}this.isDynamic&&(this.shadowRootDynamicDom=t),this.shadowRootInnerDom.appendChild(t)}}))}settingLine(e,t){const i=t.x1,s=t.y1,r=t.x2,a=t.y2;var o=Math.sqrt((i-r)**2+(s-a)**2),n=180*Math.atan2(a-s,r-i)/Math.PI;e.style.backgroundColor=t.color,e.style.width=o+"px",e.style.height=t.lineWidth+"px",e.style.position="absolute",e.style.top=s+"px",e.style.left=i+"px",e.style.transform="rotate("+n+"deg)",e.style.transformOrigin="0 0"}remove(){this._removeDom()}_removeDom(){this.shadowRootInnerDom&&(this.shadowRootInnerDom.innerHTML="")}}class Bo extends So{constructor(){super(),this.videoInfo={width:null,height:null,encType:null,encTypeCode:null},this.init=!1,this.prevAiFaceDetectTime=null,this.prevAiObjectDetectTime=null,this.prevOcclusionDetectTime=null,this.contentWatermark=null,this.aiContentWatermark=null,this.tempContentList=[],this.tempAiContentList=[],this.streamFps=0}destroy(){this.resetInit(),this.contentWatermark&&(this.contentWatermark.destroy(),this.contentWatermark=null),this.tempContentList=[],this.aiContentWatermark&&(this.aiContentWatermark.destroy(),this.aiContentWatermark=null),this.tempAiContentList=[],this.prevAiFaceDetectTime=null,this.prevAiObjectDetectTime=null,this.streamFps=0,this.off()}resetInit(){this.videoInfo={width:null,height:null,encType:null,encTypeCode:null},this.init=!1}getHasInit(){return this.init}updateVideoInfo(e){Ba(e.encTypeCode)&&(this.videoInfo.encType=bt[e.encTypeCode],this.videoInfo.encTypeCode=e.encTypeCode),Ba(e.encType)&&(this.videoInfo.encType=e.encType),Ba(e.width)&&(this.videoInfo.width=e.width),Ba(e.height)&&(this.videoInfo.height=e.height),Ba(this.videoInfo.encType)&&Ba(this.videoInfo.height)&&Ba(this.videoInfo.width)&&!this.init&&(this.player.emit(nt.videoInfo,this.videoInfo),this.init=!0)}getVideoInfo(){return this.videoInfo}clearView(){this.tempContentList=[],this.tempAiContentList=[]}resize(){if(this.player.debug.log("CommonVideo","resize()"),"default"===this.player._opt.aspectRatio||ua()?this._resize():this._resizeRatio(),this.contentWatermark&&this.contentWatermark.resize(),this.aiContentWatermark&&this.aiContentWatermark.resize(),this.player.singleWatermark&&this.player.singleWatermark.resize(),this.player.ghostWatermark&&this.player.ghostWatermark.resize(),this.player.dynamicWatermark&&this.player.dynamicWatermark.resize(),this.player.zoom&&this.player.zooming){const e=this._getStyleScale();this.player.zoom.updatePrevVideoElementStyleScale(e),this.player.zoom.updateVideoElementScale()}}_resizeRatio(){this.player.debug.log("CommonVideo","_resizeRatio()");const e=this.player._opt.aspectRatio.split(":").map(Number);let t=this.player.width,i=this.player.height;const s=this.player._opt;let r=0;s.hasControl&&!s.controlAutoHide&&(r=s.playType===_?Yt:Kt,i-=r);const a=this.videoInfo,o=a.width/a.height,n=e[0]/e[1];if(this.getType()===$&&(this.$videoElement.style.left="0",this.$videoElement.style.top="0",this.$videoElement.style.transform="none"),this.getType()===W&&this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit="fill"),o>n){const e=n*a.height/a.width;this.$videoElement.style.width=100*e+"%",this.$videoElement.style.height=`calc(100% - ${r}px)`,this.$videoElement.style.padding=`0 ${(t-t*e)/2}px`}else{const e=a.width/n/a.height;this.$videoElement.style.width="100%",this.$videoElement.style.height=`calc(${100*e}% - ${r}px)`,this.$videoElement.style.padding=(i-i*e)/2+"px 0"}}play(){}pause(){}setRate(e){}getType(){return""}getCanvasType(){return""}getCurrentTime(){return 0}getStreamFps(){return this.streamFps}isPlaying(){return!0}getPlaybackQuality(){return null}setStreamFps(e){this.player.debug.log("CommonVideo","setStreamFps",e),this.streamFps=e}addContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.tempContentList=e}addAiContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.tempAiContentList=e}doAddContentToWatermark(){if(this.tempContentList.length>0){this.contentWatermark||(this.contentWatermark=new Po(this.player),this.contentWatermark.resize());const e=[];this.tempContentList.forEach((t=>{let i={left:t.x||0,top:t.y||0};"text"===t.type?i.text={content:t.text,fontSize:t.fontSize||"14",color:t.color||"#000"}:"rect"===t.type?i.rect={width:t.width,height:t.height,color:t.color||"green",lineWidth:t.lineWidth||2,fill:t.fill||"",fillOpacity:t.fillOpacity||.2}:"polygon"===t.type?i.polygon={list:t.list,color:t.color||"green",lineWidth:t.lineWidth||2,fill:t.fill,fillOpacity:t.fillOpacity||.2}:"line"===t.type&&(i.line={color:t.color||"green",lineWidth:t.lineWidth||2,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}),e.push(i)})),this.contentWatermark.update(e)}else this.contentWatermark&&this.contentWatermark.remove()}doAddAiContentToWatermark(){if(this.tempAiContentList.length>0){this.aiContentWatermark||(this.aiContentWatermark=new Po(this.player),this.aiContentWatermark.resize());const e=this.tempAiContentList.map((e=>{let t={left:e.x,top:e.y};return"text"===e.type?t.text={content:e.text,fontSize:e.fontSize,color:e.color}:"rect"===e.type&&(t.rect={width:e.width,height:e.height,color:e.color,lineWidth:e.lineWidth}),t}));this.aiContentWatermark.update(e)}else this.aiContentWatermark&&this.aiContentWatermark.remove()}_getStyleScale(){let e=this.$videoElement.style.transform.match(/scale\([0-9., ]*\)/g),t="";if(e&&e[0]){t=e[0].replace("scale(","").replace(")","").split(",")}return t}getReadyStateInited(){return!0}}var Io="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0;function Mo(e,t,i){var s=new XMLHttpRequest;s.open("GET",e),s.responseType="blob",s.onload=function(){No(s.response,t,i)},s.onerror=function(){console.error("could not download file")},s.send()}function Uo(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return t.status>=200&&t.status<=299}function Fo(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(i){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var Oo=Io.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),No="object"!=typeof window||window!==Io?function(){}:"download"in HTMLAnchorElement.prototype&&!Oo?function(e,t,i){var s=Io.URL||Io.webkitURL,r=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",r.download=t,r.rel="noopener","string"==typeof e?(r.href=e,r.origin!==location.origin?Uo(r.href)?Mo(e,t,i):Fo(r,r.target="_blank"):Fo(r)):(r.href=s.createObjectURL(e),setTimeout((function(){s.revokeObjectURL(r.href)}),4e4),setTimeout((function(){Fo(r)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download","string"==typeof e)if(Uo(e))Mo(e,t,i);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout((function(){Fo(s)}))}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,i),t)}:function(e,t,i,s){if((s=s||open("","_blank"))&&(s.document.title=s.document.body.innerText="downloading..."),"string"==typeof e)return Mo(e,t,i);var r="application/octet-stream"===e.type,a=/constructor/i.test(Io.HTMLElement)||Io.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||r&&a||Oo)&&"undefined"!=typeof FileReader){var n=new FileReader;n.onloadend=function(){var e=n.result;e=o?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),s?s.location.href=e:location=e,s=null},n.readAsDataURL(e)}else{var l=Io.URL||Io.webkitURL,d=l.createObjectURL(e);s?s.location=d:location.href=d,s=null,setTimeout((function(){l.revokeObjectURL(d)}),4e4)}};class jo{constructor(e,t){this.canvas=e,this.gl=t;const i=t.createShader(t.VERTEX_SHADER);if(t.shaderSource(i,"\n attribute vec2 xy;\n varying highp vec2 uv;\n void main(void) {\n gl_Position = vec4(xy, 0.0, 1.0);\n // Map vertex coordinates (-1 to +1) to UV coordinates (0 to 1).\n // UV coordinates are Y-flipped relative to vertex coordinates.\n uv = vec2((1.0 + xy.x) / 2.0, (1.0 - xy.y) / 2.0);\n }\n "),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS))throw t.getShaderInfoLog(i);const s=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(s,"\n varying highp vec2 uv;\n uniform sampler2D texture;\n void main(void) {\n gl_FragColor = texture2D(texture, uv);\n }\n "),t.compileShader(s),!t.getShaderParameter(s,t.COMPILE_STATUS))throw t.getShaderInfoLog(s);const r=t.createProgram();if(t.attachShader(r,i),t.attachShader(r,s),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS))throw t.getProgramInfoLog(r);t.useProgram(r);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),t.STATIC_DRAW);const o=t.getAttribLocation(r,"xy");t.vertexAttribPointer(o,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o);const n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.program=r,this.buffer=a,this.vertexShader=i,this.fragmentShader=s,this.texture=n}destroy(){this.gl.deleteProgram(this.program),this.gl.deleteBuffer(this.buffer),this.gl.deleteTexture(this.texture),this.gl.deleteShader(this.vertexShader),this.gl.deleteShader(this.fragmentShader),this.program=null,this.buffer=null,this.vertexShader=null,this.fragmentShader=null,this.texture=null}render(e){this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight;const t=this.gl;t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),t.clearColor(1,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4)}}class zo extends Bo{constructor(e){super(),this.player=e;const t=document.createElement("canvas");t.style.position="absolute",t.style.top=0,t.style.left=0,this.$videoElement=t,e.$container.appendChild(this.$videoElement),this.context2D=null,this.contextGl=null,this.webglRender=null,this.webglRectRender=null,this.webGPURender=null,this.isWebglContextLost=!1,this.isWcsWebgl2=!1,this.bitmaprenderer=null,this.renderType=null,this.controlHeight=0,this.proxyDestroyList=[],this._initCanvasRender()}destroy(){super.destroy(),this.proxyDestroyList.length>0&&(this.proxyDestroyList.forEach((e=>{e&&e()})),this.proxyDestroyList=[]),this.contextGl&&(this.contextGl=null),this.context2D&&(this.context2D=null),this.webglRender&&(this.webglRender.destroy(),this.webglRender=null),this.webglRectRender&&(this.webglRectRender.destroy(),this.webglRectRender=null),this.webGPURender&&(this.webGPURender.destroy(),this.webGPURender=null),this.bitmaprenderer&&(this.bitmaprenderer=null),this.renderType=null,this.isWebglContextLost=!1,this.videoInfo={width:"",height:"",encType:""},this.player.$container.removeChild(this.$videoElement),this.init=!1,this.off()}_initContext2D(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.context2D=this.$videoElement.getContext("2d",e)}_initContextGl(){if(this.player.events,this.contextGl=ia(this.$videoElement),!this.contextGl)throw this.player.debug.error("CommonCanvasLoader","_initContextGl() createContextGL error"),new Error("CommonCanvasLoader and _initContextGl createContextGL error");this._bindContextGlEvents(),this.webglRender=new Do(this.contextGl,this.player._opt.openWebglAlignment)}_initContextGl2(){if(this.contextGl=sa(this.$videoElement),this.contextGl){this._bindContextGlEvents(2);try{this.webglRender=new jo(this.$videoElement,this.contextGl)}catch(e){this.player.debug.error("CommonCanvasLoader",`create webgl2Render error is ${e} and next use context2d.draw render`),this.contextGl=null,this.webglRender=null,this._initContext2D()}}else this.player.debug.error("CommonCanvasLoader","_initContextGl2() createContextGL2 error")}_bindContextGlEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const{proxy:t}=this.player.events,i=t(this.$videoElement,"webglcontextlost",(t=>{t.preventDefault(),this.player.debug.error("canvasVideo","webglcontextlost error",t),this.isWebglContextLost=!0,this.webglRender&&(this.player.debug.log("CommonCanvasLoader","webglcontextlost error and destroy webglRender"),this.webglRender.destroy(),this.webglRender=null),this.webglRectRender&&(this.player.debug.log("CommonCanvasLoader","webglcontextlost error and destroy webglRectRender"),this.webglRectRender.destroy(),this.webglRectRender=null),this.contextGl=null,setTimeout((()=>{if(this.player.debug.log("CommonCanvasLoader",`createContextGL() version ${e}`),1===e?this.contextGl=ia(this.$videoElement):2===e&&(this.contextGl=sa(this.$videoElement)),this.player.debug.log("CommonCanvasLoader","createContextGL success"),this.contextGl&&this.contextGl.getContextAttributes){const t=this.contextGl.getContextAttributes();t&&t.stencil?(1===e?this.webglRender=new Do(this.contextGl,this.player._opt.openWebglAlignment):2===e&&(this.webglRender=new jo(this.$videoElement,this.contextGl)),this.isWebglContextLost=!1,this.player.debug.log("CommonCanvasLoader","webglcontextlost error reset and getContextAttributes().stencil is true")):(this.player.debug.error("CommonCanvasLoader","webglcontextlost error, getContextAttributes().stencil is false"),this.player.emitError(ct.webglContextLostError))}else this.player.debug.error("CommonCanvasLoader","webglcontextlost error, getContextAttributes().stencil is false"),this.player.emitError(ct.webglContextLostError)}),500)})),s=t(this.$videoElement,"webglcontextrestored",(e=>{e.preventDefault(),this.player.debug.log("CommonCanvasLoader","webglcontextrestored ",e)}));this.proxyDestroyList.push(i,s)}_initContextGPU(){var t;(t=this.$videoElement,new Promise(((e,i)=>{navigator.gpu?navigator.gpu.requestAdapter().then((s=>{s?s.requestDevice().then((r=>{if(r){const a=t.getContext("webgpu");if(a){const t=navigator.gpu.getPreferredCanvasFormat();a.configure({device:r,format:t,alphaMode:"opaque"}),e({adapter:s,device:r,context:a,format:t})}else i('WebGPU "context" create fail')}else i('WebGPU "device" request fail')})).catch((e=>{i('WebGPU "adapter.requestDevice()" fail')})):i('WebGPU "adapter" request fail is empty')})).catch((e=>{i('WebGPU "navigator.gpu.requestAdapter()" fail')})):i("WebGPU not support!!")}))).then((t=>{t?(this.webGPURender=new Lo(t),this.player.debug.log("CommonCanvasLoader","webGPURender init success")):(this.player.debug.warn("CommonCanvasLoader",`createWebGPUContext error is ${e} and next use webgl render`),this.renderType=ti,this._initContextGl())})).catch((e=>{this.player.debug.warn("CommonCanvasLoader",`createWebGPUContext error is ${e} and next use webgl render`),this.renderType=ti,this._initContextGl()}))}initCanvasViewSize(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()}screenshot(e,t,i,s){e=e||aa(),s=s||gt.download;let r=.92;!Ji[t]&>[t]&&(s=t,t="png",i=void 0),"string"==typeof i&&(s=i,i=void 0),void 0!==i&&(r=Number(i));const a=Ji[t]||Ji.png,o=this.$videoElement.toDataURL(a,r);if(s===gt.base64)return o;{const t=ra(o);if(s===gt.blob)return t;if(s===gt.download){const i=a.split("/")[1];No(t,e+"."+i)}}}screenshotWatermark(e){return new Promise(((t,i)=>{$a(e)&&(e={filename:e}),(e=e||{}).width=this.videoInfo.width,e.height=this.videoInfo.height,e.filename=e.filename||aa(),e.format=e.format?Ji[e.format]:Ji.png,e.quality=Number(e.quality)||.92,e.type=e.type||gt.download;const s=this.$videoElement.toDataURL(e.format,e.quality);Ua(s,e).then((i=>{if(e.type===gt.base64)t(s);else{const s=ra(i);if(e.type===gt.blob)t(s);else if(e.type===gt.download){t();const i=e.format.split("/")[1];No(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}render(){}clearView(){super.clearView()}play(){}pause(){}_resize(){this.player.debug.log("canvasVideo","_resize()");const e=this.player._opt;let t=this.player.width,i=this.player.height;if(e.hasControl&&!e.controlAutoHide){const s=this.controlHeight;ua()&&this.player.fullscreen&&e.useWebFullScreen?t-=s:i-=s}let s=this.$videoElement.width,r=this.$videoElement.height;const a=e.rotate;let o=(t-s)/2,n=(i-r)/2;270!==a&&90!==a||(s=this.$videoElement.height,r=this.$videoElement.width);const l=t/s,d=i/r;let h=l>d?d:l;po(e.isResize)&&l!==d&&(h=l+","+d),e.isFullResize&&(h=l>d?l:d);let c="scale("+h+")";"none"===e.mirrorRotate&&a&&(c+=" rotate("+a+"deg)"),"level"===e.mirrorRotate?c+=" rotateY(180deg)":"vertical"===e.mirrorRotate&&(c+=" rotateX(180deg)"),this.$videoElement.style.height=this.videoInfo.height+"px",this.$videoElement.style.width=this.videoInfo.width+"px",this.$videoElement.style.padding="0",this.$videoElement.style.transform=c,this.$videoElement.style.left=o+"px",this.$videoElement.style.top=n+"px"}initFps(){}setStreamFps(e){}getStreamFps(){return 25}getType(){return $}getCanvasType(){let e=this.renderType===si?si:ti;return this.isWcsWebgl2&&(e=ii),e}}class Go extends zo{constructor(e){super(e),this.yuvList=[],this.controlHeight=Kt,this.tempTextCanvas=null,this.tempTextCanvasCtx=null,this.player.debug.log("CanvasVideo","init")}async destroy(){super.destroy(),this.yuvList=[],this.tempTextCanvas&&(this.tempTextCanvasCtx.clearRect(0,0,this.tempTextCanvas.width,this.tempTextCanvas.height),this.tempTextCanvas.width=0,this.tempTextCanvas.height=0,this.tempTextCanvas=null),this.player.debug.log("CanvasVideoLoader","destroy")}_initCanvasRender(){this.player._opt.useWCS&&!this._supportOffscreen()?(this.renderType=ei,yo()&&this.player._opt.wcsUseWebgl2Render?(this._initContextGl2(),this.webglRender&&(this.isWcsWebgl2=!0)):this._initContext2D()):this.player._opt.useMSE&&this.player._opt.mseUseCanvasRender?(this.renderType=ai,this._initContext2D()):this.player.isOldHls()&&this.player._opt.useCanvasRender?(this.renderType=oi,this._initContext2D()):this.player.isWebrtcH264()&&this.player._opt.webrtcUseCanvasRender?(this.renderType=ni,this._initContext2D()):this._supportOffscreen()?(this.renderType=ri,this._bindOffscreen()):this.player._opt.useWebGPU?(this.renderType=si,this._initContextGPU()):(this.renderType=ti,this._initContextGl())}_supportOffscreen(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen}_bindOffscreen(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")}render(e){this.yuvList.push(e),this.startRender()}startRender(){for(;!(this.yuvList.length<=0);){const e=this.yuvList.shift();this.doRender(e)}}doRender(e){if(this.renderType!==ai){const t={ts:e.ts||0,fps:!0};this.player.updateStats(t)}switch(this.renderType){case ri:this.bitmaprenderer.transferFromImageBitmap(e.buffer);break;case ti:case si:if(this.isWebglContextLost)return void this.player.debug.warn("CanvasVideoLoader","doRender() and webgl context is lost");let t=e.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector){null===this.prevAiFaceDetectTime&&(this.prevAiFaceDetectTime=aa());const i=aa();i-this.prevAiFaceDetectTime>=this.player._opt.aiFaceDetectInterval&&(t=this.player.ai.faceDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output,ts:e.ts||0}),this.prevAiFaceDetectTime=i)}if(this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector){null===this.prevAiObjectDetectTime&&(this.prevAiObjectDetectTime=aa());const i=aa();i-this.prevAiObjectDetectTime>=this.player._opt.aiObjectDetectInterval&&(t=this.player.ai.objectDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output,ts:e.ts||0}),this.prevAiObjectDetectTime=i)}if(this.player.occlusionDetectActive&&this.player.ai&&this.player.ai.occlusionDetector){null===this.prevAiOcclusionDetectTime&&(this.prevAiOcclusionDetectTime=aa());const t=aa();if(t-this.prevAiOcclusionDetectTime>=this.player._opt.aiOcclusionDetectInterval){const i=this.player.ai.occlusionDetector.check({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output});this.prevAiOcclusionDetectTime=t,i&&this.player.emit(nt.aiOcclusionDetectResult,{ts:e.ts||0})}}if(this.player.imageDetectActive&&this.player.ai&&this.player.ai.imageDetector){const t=this.player.ai.imageDetector.check({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output});if(t&&t.data&&(this.player.emit(nt.aiOcclusionDetectResult,{type:t.type,ts:e.ts||0}),this.player._opt.aiImageDetectDrop))return void this.player.debug.log("CanvasVideoLoader",`doRender() and ai image detect result type is ${t.type} and drop`)}if(this.renderType===si)try{if(!this.webGPURender)return void this.player.debug.warn("CanvasVideoLoader","doRender webgpu render is not init");this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,t)}catch(e){this.player.debug.error("CanvasVideoLoader",`doRender webgpu render and error: ${e.toString()}`)}else if(this.renderType===ti)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,t)}catch(e){this.player.debug.error("CanvasVideoLoader",`doRender webgl render context is lost ${this.contextGl&&this.contextGl.isContextLost()} and error: ${e.toString()}`)}break;case ei:if(this.webglRender)this.webglRender.render(e.videoFrame),to(e.videoFrame);else if(this.context2D)if(Ya(e.videoFrame.createImageBitmap))try{e.videoFrame.createImageBitmap().then((t=>{this.context2D.drawImage(t,0,0,this.$videoElement.width,this.$videoElement.height),to(e.videoFrame)}))}catch(e){}else this.context2D.drawImage(e.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),to(e.videoFrame);else this.player.debug.warn("CanvasVideoLoader","doRender() and webcodecs context is lost");break;case ai:case oi:case ni:this.context2D.drawImage(e.$video,0,0,this.$videoElement.width,this.$videoElement.height)}let t=e.ts||0;this.renderType===ai&&(t=parseInt(1e3*e.$video.currentTime,10)+(this.player.mseDecoder.firstRenderTime||0)),this.player.updateCurrentPts(t),this.doAddContentToWatermark(),this.doAddAiContentToWatermark()}clearView(){switch(super.clearView(),this.renderType){case ri:(function(e,t){const i=document.createElement("canvas");i.width=e,i.height=t;const s=window.createImageBitmap(i,0,0,e,t);return i.width=0,i.height=0,s})(this.$videoElement.width,this.$videoElement.height).then((e=>{this.bitmaprenderer.transferFromImageBitmap(e)}));break;case ti:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case si:this.webGPURender.clear();break;case ei:this.contextGl?this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT):this.context2D&&this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height);break;case ai:case oi:case ni:this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}}_initTempTextCanvas(){this.tempTextCanvas=document.createElement("canvas"),this.tempTextCanvasCtx=this.tempTextCanvas.getContext("2d"),this.tempTextCanvas.width=600,this.tempTextCanvas.height=20}doAddContentToCanvas(){this.tempContentList.length>0&&this.context2D&&function(e){let{ctx:t,list:i}=e;t.save(),(i||[]).forEach((e=>{"text"===e.type?(t.font=`${e.fontSize||12}px Arial`,t.fillStyle=e.color||"green",t.fillText(e.text,e.x,e.y)):"rect"===e.type&&(t.strokeStyle=e.color||"green",t.lineWidth=e.lineWidth||2,t.strokeRect(e.x,e.y,e.width,e.height))})),t.restore()}({ctx:this.context2D,list:this.tempContentList})}doAddContentToWebGlCanvas(){this.tempContentList.length>0&&this.contextGl&&this.webglRectRender&&this.tempContentList.forEach((e=>{const t=e.x,i=e.y;if("rect"===e.type){const r=e.width,a=e.height,o=(s=e.color||"#008000",[parseInt(s.substring(1,3),16)/255,parseInt(s.substring(3,5),16)/255,parseInt(s.substring(5,7),16)/255,1]),n=e.lineWidth||4;if(!r||!a)return;this.webglRectRender.drawBox({x:t,y:i,width:r,height:a,lineColor:o,lineWidth:n,canvasWidth:this.$videoElement.width,canvasHeight:this.$videoElement.height})}else if("text"===e.type){const s=e.text||"";if(!s)return;const r=e.fontSize||20,a=e.color||"#008000";this.tempTextCanvas||this._initTempTextCanvas(),this.tempTextCanvasCtx.clearRect(0,0,this.tempTextCanvas.width,this.tempTextCanvas.height),this.tempTextCanvasCtx.font=`${r}px Arial`,this.tempTextCanvasCtx.fillStyle=a,this.tempTextCanvasCtx.textBaseline="top",this.tempTextCanvasCtx.fillText(s,0,0),this.webglRender.drawDom(this.$videoElement.width,this.$videoElement.height,t,i,this.tempTextCanvas)}var s}))}}class Ho extends Bo{constructor(e){super(),this.player=e,this.TAG_NAME="Video";const t=document.createElement("video"),i=document.createElement("canvas");t.muted=!0,t.style.position="absolute",t.style.top=0,t.style.left=0,this._delayPlay=!1,e.$container.appendChild(t),this.$videoElement=t,this.$canvasElement=i,this.canvasContext=i.getContext("2d"),this.mediaStream=null,this.vwriter=null,e.canVideoTrackWritter()&&xa()&&Ra()&&(this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),this.mediaStream=new MediaStream([this.trackGenerator]),t.srcObject=this.mediaStream,this.vwriter=this.trackGenerator.writable.getWriter()),this.fixChromeVideoFlashBug(),this.fixMobileAutoFullscreen(),this.resize(),this.eventListenList=[],this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes=0,this.isRetryPlaying=!1,this.isRetryPlayingTimes=0,this.canplayReceived=!1,this.progressProxyDestroy=null,this.checkVideoCanplayTimeout=null;const s=bo();this.supportVideoFrameCallbackHandle=null;const{proxy:r}=this.player.events,a=r(this.$videoElement,"canplay",(()=>{this.player.debug.log("Video","canplay"),this.player.isDestroyedOrClosed()||(this.canplayReceived=!0,this._delayPlay?(this.clearCheckVideoCanplayTimeout(),this._play(),bo()?this.supportVideoFrameCallbackHandle||(this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))):this.player.debug.warn("Video","not support requestVideoFrameCallback and use timeupdate event to update stats")):this.$videoElement.paused&&this.player.isMSEPlaybackRateChangePause&&(this.player.debug.log("Video",`canplay and video is paused and isMSEPlaybackRateChangePause is ${this.player.isMSEPlaybackRateChangePause} so next try to play`),this.player.isMSEPlaybackRateChangePause=!1,this.$videoElement.play()))})),o=r(this.$videoElement,"waiting",(()=>{this.player.debug.log("Video","waiting")})),n=r(this.$videoElement,"loadedmetadata",(()=>{this.player.debug.log("Video","loadedmetadata")})),l=r(this.$videoElement,"timeupdate",(t=>{if(!this.player.isDestroyedOrClosed()){if(po(s)){const t=parseInt(1e3*this.getCurrentTime(),10);(e.isWebrtcH264()||this.player.isOldHls()||this.player.isAliyunRtc())&&(this.player.emit(nt.timeUpdate,t),e.handleRender(),e.updateStats({fps:!0,ts:t,dts:t}))}this.player.isMseDecoderUseWorker()&&(this.player.decoderWorker.updateVideoTimestamp(this.getCurrentTime()),this._handleUpdatePlaybackRate())}})),d=r(this.$videoElement,"error",(()=>{let e={};if(this.player.isUseMSE()&&(e=this.player.getMseMineType()),this.player.debug.error("Video","Error Code "+this.$videoElement.error.code+" "+ur[this.$videoElement.error.code]+"; Details: "+this.$videoElement.error.message+"; Video Info: "+JSON.stringify(this.videoInfo)+"; Mse Mine Type: "+e.video+"; "),this.player.isUseMSE()){this.$videoElement.error.code;const e=this.$videoElement.error.message;-1!==e.indexOf(pr)&&(this.player.isMSEVideoDecoderInitializationFailedNotSupportHevc=!0),-1!==e.indexOf(fr)&&(this.player.isMSEAudioDecoderError=!0)}this.player.isHlsCanVideoPlay()})),h=r(this.$videoElement,"stalled",(()=>{this._detectAndFixStuckPlayback(!0)}));if(this.progressProxyDestroy=r(this.$videoElement,"progress",(()=>{this._detectAndFixStuckPlayback()})),this.eventListenList.push(a,o,l,d,n,h),this.player.isUseMSE()){const e=r(this.$videoElement,ss,(()=>{this.player.debug.log(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate),this.$videoElement&&this.$videoElement.paused&&(this.player.debug.warn(this.TAG_NAME,"ratechange and video is paused and sent isMSEPlaybackRateChangePause true"),this.player.isMSEPlaybackRateChangePause=!0)}));this.eventListenList.push(e),this.player.on(nt.visibilityChange,(e=>{e&&setTimeout((()=>{if(this.player.isPlaying()&&this.$videoElement){const e=this.getVideoBufferLastTime();e-this.$videoElement.currentTime>this.getBufferMaxDelayTime()&&(this.player.debug.log(this.TAG_NAME,`visibilityChange is true and lastTime is ${e} and currentTime is ${this.$videoElement.currentTime} so set currentTime to lastTime`),this.$videoElement.currentTime=e)}}),300)}))}this.player.debug.log("Video","init")}async destroy(){if(super.destroy(),this.clearCheckVideoCanplayTimeout(),this._cancelVideoFrameCallback(),this._removeProgressProxyDestroy(),this.eventListenList.length&&(this.eventListenList.forEach((e=>{e()})),this.eventListenList=[]),this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes=0,this.isRetryPlaying=!1,this.isRetryPlayingTimes=0,this.canplayReceived=!1,this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()){const e=this.player.$container;e.style.backdropFilter="none",e.style.transform="none"}if(this.$canvasElement.height=0,this.$canvasElement.width=0,this.$canvasElement=null,this.canvasContext=null,this.$videoElement){this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}this.player.$container.removeChild(this.$videoElement),this.$videoElement=null}this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.vwriter&&(await this.vwriter.close(),this.vwriter=null),this._delayPlay=!1,this.mediaStream&&(this.mediaStream.getTracks().forEach((e=>e.stop())),this.mediaStream=null),this.off(),this.player.debug.log("Video","destroy")}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debug.log("Video","videoFrameCallback() and isDestroyedOrClosed and return");this.player.handleRender();const i=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)||0;if(this.player.isUseHls265UseMse())this.player.updateStats({fps:!0,ts:i});else if(this.player.isMseDecoderUseWorker()){this.player._times.videoStart||(this.player._times.videoStart=aa(),this.player.handlePlayToRenderTimes());const e=i+(this.player._mseWorkerData.firstRenderTime||0);if(this.player.updateStats({fps:!0,dfps:!0,ts:e,mseTs:i}),this.player.emit(nt.timeUpdate,e),po(this.getHasInit())&&t.width&&t.height){const e={width:t.width,height:t.height};this.updateVideoInfo(e),this.initCanvasViewSize()}}if(this.player.isWebrtcH264()||this.player.isOldHls()||this.player.isAliyunRtc()){if(this.player.emit(nt.timeUpdate,i),po(this.getHasInit())&&t.width&&t.height){const e={width:t.width,height:t.height};this.videoInfo.encTypeCode||this.player.isOldHls()||(e.encTypeCode=vt),this.updateVideoInfo(e)}this.player.updateStats({fps:!0,ts:i,dts:i}),this.player.updateCurrentPts(i),this.doAddContentToWatermark()}else if(uo(this.player._opt.useMSE)&&po(this.player._opt.mseUseCanvasRender)){if(this.player.mseDecoder){let e=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)+(this.player.mseDecoder.firstRenderTime||0);this.player.updateCurrentPts(e)}else if(this.player._opt.mseDecoderUseWorker){let e=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)+(this.player._mseWorkerData.firstRenderTime||0);this.player.updateCurrentPts(e)}this.doAddContentToWatermark()}this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}fixChromeVideoFlashBug(){if(this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()){const e=this.player.$container;e.style.backdropFilter="blur(0px)",e.style.transform="translateZ(0)"}}fixMobileAutoFullscreen(){const e=ya(),t=fa();(e||t)&&(this.player.debug.log("Video",`fixMobileAutoFullscreen and isIOS ${e} and isAndroid ${t}`),this.$videoElement.setAttribute("webkit-playsinline","true"),this.$videoElement.setAttribute("playsinline","true"),this.$videoElement.setAttribute("x5-video-player-type","h5-page"))}_detectAndFixStuckPlayback(e){const t=this.$videoElement,i=t.buffered,s=t.readyState;this.player.debug.log(this.TAG_NAME,`_detectAndFixStuckPlayback() and isStalled is ${e} ,canplayReceived is ${this.canplayReceived} ,videoReadyState is ${s}`),e||po(this.canplayReceived)||s<2?i.length>0&&t.currentTime{if(this.clearCheckVideoCanplayTimeout(),!this.player.isDestroyedOrClosed()&&po(this.isPlaying())){const e=this._getBufferStore();this.player.debug.warn("Video",`checkVideoCanplayTimeout and video is not playing and buffer store is ${e} and retry play`),this.$videoElement.currentTime=e,this._replay()}}),1e3)));this._play()}}_play(){this.$videoElement&&this.$videoElement.play().then((()=>{this._delayPlay=!1,this.player.debug.log("Video","_play success"),this.isPlaying()?(this.player.emit(nt.removeLoadingBgImage),this.isRetryPlayingTimes=0,this.isRetryPlaying=!1):setTimeout((()=>{this._replay()}),100)})).catch((e=>{this.player.isDestroyedOrClosed()?this.player.debug.log("Video","_play error and player is isDestroyedOrClosed and return"):(this.player.debug.error("Video","_play error",e),this.isRetryPlaying=!1,setTimeout((()=>{this._replay()}),100))}))}_replay(){if(!this.isPlaying()&&po(this.player.isDestroyedOrClosed())&&po(this.isRetryPlaying)){if(this.isRetryPlaying=!0,this.isRetryPlayingTimes>=3)return void(this.player.isWebrtcH264()?(this.player.debug.error("Video",`_replay(webrtc H264) then but not playing and retry play times is ${this.isRetryPlayingTimes} and emit error`),this.player.emitError(ct.videoElementPlayingFailedForWebrtc)):(this.player.debug.error("Video",`_replay then but not playing and retry play times is ${this.isRetryPlayingTimes} and emit error to use canvas render`),this.player.emitError(ct.videoElementPlayingFailed)));this.player.debug.warn("Video",`_play then but not playing and retry play and isRetryPlayingTimes is ${this.isRetryPlayingTimes}`),this._play(),this.isRetryPlayingTimes++}else this.player.debug.log("Video",`_replay() and isPlaying is ${this.isPlaying()} and isRetryPlaying is ${this.isRetryPlaying} and isDestroyedOrClosed is ${this.player.isDestroyedOrClosed()} and return;`)}pause(e){this.player.debug.log(this.TAG_NAME,"pause and isNow is "+e),this.isPlaying()&&(e?(this.$videoElement&&this.$videoElement.pause(),this._cancelVideoFrameCallback()):setTimeout((()=>{this.$videoElement&&this.$videoElement.pause(),this._cancelVideoFrameCallback()}),100))}clearView(){super.clearView(),this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")))}screenshot(e,t,i,s){if(!this._canScreenshot())return this.player.debug.warn("Video",`screenshot failed, video is not ready and stats is ${this._getVideoReadyState()}`),null;e=e||aa(),s=s||gt.download;let r=.92;!Ji[t]&>[t]&&(s=t,t="png",i=void 0),"string"==typeof i&&(s=i,i=void 0),void 0!==i&&(r=Number(i));const a=this.$videoElement;let o=this.$canvasElement;o.width=a.videoWidth,o.height=a.videoHeight,this.canvasContext.drawImage(a,0,0,o.width,o.height);const n=Ji[t]||Ji.png,l=o.toDataURL(n,r);if(this.canvasContext.clearRect(0,0,o.width,o.height),o.width=0,o.height=0,s===gt.base64)return l;{const t=ra(l);if(s===gt.blob)return t;if(s===gt.download){const i=n.split("/")[1];No(t,e+"."+i)}}}screenshotWatermark(e){return new Promise(((t,i)=>{if($a(e)&&(e={filename:e}),!this._canScreenshot())return this.player.debug.warn("Video","screenshot failed, video is not ready"),i("screenshot failed, video is not ready");const s=this.$videoElement;(e=e||{}).width=s.videoWidth,e.height=s.videoHeight,e.filename=e.filename||aa(),e.format=e.format?Ji[e.format]:Ji.png,e.quality=Number(e.quality)||.92,e.type=e.type||gt.download;let r=this.$canvasElement;r.width=s.videoWidth,r.height=s.videoHeight,this.canvasContext.drawImage(s,0,0,r.width,r.height);const a=r.toDataURL(e.format,e.quality);this.canvasContext.clearRect(0,0,r.width,r.height),r.width=0,r.height=0,Ua(a,e).then((i=>{if(e.type===gt.base64)t(a);else{const s=ra(i);if(e.type===gt.blob)t(s);else if(e.type===gt.download){t();const i=e.format.split("/")[1];No(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}initCanvasViewSize(){this.resize()}clear(){const e=this.$videoElement,t=e.buffered,i=t.length?t.end(t.length-1):0;e.currentTime=i}render(e){if(this.vwriter){if(this.$videoElement.srcObject||(this.$videoElement.srcObject=this.mediaStream),this.isPaused()){const e=this._getVideoReadyState();if(this.player.debug.warn("Video","render() error, video is paused and readyState is "+e),4===e&&po(this.isRenderRetryPlaying)){if(this.isRenderRetryPlaying=!0,this.isRenderRetryPlayingTimes>3)return this.player.debug.error("Video","render() error, video is paused and readyState is "+e+", retry times is "+this.isRenderRetryPlayingTimes+", emit error and use canvas render"),void this.player.emitError(ct.videoElementPlayingFailed);this.$videoElement.play().then((()=>{this.isRenderRetryPlayingTimes=0,this.isRenderRetryPlaying=!1,this.player.debug.log("Video","render() video is paused and replay success")})).catch((e=>{this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes++,this.player.debug.warn("Video","render() error, video is paused and replay error ",e)}))}}if(this.player.updateStats({fps:!0,ts:e.ts||0}),e.videoFrame)this.vwriter.write(e.videoFrame),to(e.videoFrame);else if(e.output){let s=e.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector){null===this.prevAiFaceDetectTime&&(this.prevAiFaceDetectTime=aa());const t=aa();t-this.prevAiFaceDetectTime>this.player._opt.aiFaceDetectInterval&&(s=this.player.ai.faceDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0}),this.prevAiFaceDetectTime=t)}if(this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector){null===this.prevAiObjectDetectTime&&(this.prevAiObjectDetectTime=aa());const t=aa();t-this.prevAiObjectDetectTime>this.player._opt.aiObjectDetectInterval&&(s=this.player.ai.objectDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0}),this.prevAiObjectDetectTime=t)}if(this.player.occlusionDetectActive&&this.player.ai&&this.player.ai.occlusionDetector){null===this.prevAiOcclusionDetectTime&&(this.prevAiOcclusionDetectTime=aa());const t=aa();if(t-this.prevAiOcclusionDetectTime>=this.player._opt.aiOcclusionDetectInterval){const i=this.player.ai.occlusionDetector.check({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0});this.prevAiOcclusionDetectTime=t,i&&(this.player.debug.log("Video","render() and ai occlusion detect result is true"),this.player.emit(nt.aiOcclusionDetectResult,{ts:e.ts||0}))}}if(this.player.imageDetectActive&&this.player.ai&&this.player.ai.imageDetector){const t=this.player.ai.imageDetector.check({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0});if(t&&t.data&&(this.player.emit(nt.aiOcclusionDetectResult,{type:t.type,ts:e.ts||0}),this.player._opt.aiImageDetectDrop))return void this.player.debug.log("Video",`render() and ai image detect result type is ${t.type} and drop`)}try{const r=(t=s,i={format:"I420",codedWidth:this.videoInfo.width,codedHeight:this.videoInfo.height,timestamp:e.ts},new VideoFrame(t,i));this.vwriter.write(r),to(r)}catch(e){this.player.debug.error("Video","render error",e),this.player.emitError(ct.wasmUseVideoRenderError,e)}}this.player.updateCurrentPts(e.ts||0),this.doAddContentToWatermark(),this.doAddAiContentToWatermark()}else this.player.debug.warn("Video","render and this.vwriter is null");var t,i}_resize(){this.player.debug.log("Video","_resize()");let e=this.player.width,t=this.player.height;const i=this.player._opt,s=i.rotate;if(i.hasControl&&!i.controlAutoHide){const s=i.playType===_?Yt:Kt;ua()&&this.player.fullscreen&&i.useWebFullScreen?e-=s:t-=s}this.$videoElement.width=e,this.$videoElement.height=t,this.$videoElement.style.width=e+"px",this.$videoElement.style.height=t+"px",270!==s&&90!==s||(this.$videoElement.width=t,this.$videoElement.height=e,this.$videoElement.style.width=t+"px",this.$videoElement.style.height=e+"px");let r=(e-this.$videoElement.width)/2,a=(t-this.$videoElement.height)/2,o="contain";po(i.isResize)&&(o="fill"),i.isFullResize&&(o="none");let n="";"none"===i.mirrorRotate&&s&&(n+=" rotate("+s+"deg)"),"level"===i.mirrorRotate?n+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(n+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit=o),this.$videoElement.style.transform=n,this.$videoElement.style.padding="0",this.$videoElement.style.left=r+"px",this.$videoElement.style.top=a+"px"}getType(){return W}getCurrentTime(){return this.$videoElement.currentTime}isPlaying(){return this.$videoElement&&po(this.$videoElement.paused)&&po(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}_canScreenshot(){return this.$videoElement&&this.$videoElement.readyState>=1}getPlaybackQuality(){let e=null;if(this.$videoElement){if(Ya(this.$videoElement.getVideoPlaybackQuality)){const t=this.$videoElement.getVideoPlaybackQuality();e={droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}else e={droppedVideoFrames:this.$videoElement.webkitDroppedFrameCount,totalVideoFrames:this.$videoElement.webkitDecodedFrameCount,creationTime:aa()};e&&(e.renderedVideoFrames=e.totalVideoFrames-e.droppedVideoFrames)}return e}setRate(e){this.$videoElement&&(this.$videoElement.playbackRate=e)}get rate(){let e=1;return this.$videoElement&&(e=this.$videoElement.playbackRate),e}clearCheckVideoCanplayTimeout(){this.checkVideoCanplayTimeout&&(clearTimeout(this.checkVideoCanplayTimeout),this.checkVideoCanplayTimeout=null)}_cancelVideoFrameCallback(){this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null)}_getBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.buffered.start(0)),t}_handleUpdatePlaybackRate(){const e=this.$videoElement,t=e.buffered;t.length&&t.start(0);const i=t.length?t.end(t.length-1):0;let s=e.currentTime;const r=i-s,a=this.getBufferMaxDelayTime();if(this.player.updateStats({mseVideoBufferDelayTime:r}),r>a)this.player.debug.log(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current is ${s} , delay buffer is more than ${a} is ${r} and new time is ${i}`),e.currentTime=i,s=e.currentTime;else if(r<0){if(this.player.debug.warn(this.TAG_NAME,`handleUpdatePlaybackRate and delay buffer is ${i} - current is ${s} = ${r} < 0 and check video is paused : ${e.paused} `),0===i)return void this.player.emit(ct.mediaSourceBufferedIsZeroError,"video.buffered is empty");e.paused&&e.play()}const o=this._getPlaybackRate(i-s);e.playbackRate!==o&&(this.player.debug.log(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current time is ${s} and delay is ${i-s} set playbackRate is ${o} `),e.playbackRate=o)}_getPlaybackRate(e){const t=this.$videoElement;let i=this.player._opt.videoBufferDelay+this.player._opt.videoBuffer;const s=Math.max(i,1e3),r=s/2;return e*=1e3,1===t.playbackRate?e>s?1.2:1:e<=r?1:t.playbackRate}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}getVideoBufferLastTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;i.length&&i.start(0);t=i.length?i.end(i.length-1):0}return t}getVideoBufferDelayTime(){const e=this.$videoElement;const t=this.getVideoBufferLastTime()-e.currentTime;return t>0?t:0}checkSourceBufferDelay(){const e=this.$videoElement;let t=0,i=0;return e.buffered.length>0&&(i=e.buffered.end(e.buffered.length-1),t=i-e.currentTime),t<0&&(this.player.debug.warn(this.TAG_NAME,`checkVideoSourceBufferDelay ${t} < 0, and buffered is ${i} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${i}`),e.currentTime=i,t=0),t}checkSourceBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.currentTime-e.buffered.start(0)),t}getDecodePlaybackRate(){let e=0;const t=this.$videoElement;return t&&(e=t.playbackRate),e}getBufferMaxDelayTime(){let e=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3;return Math.max(5,e+3)}getReadyStateInited(){return this._getVideoReadyState()>=1}}class Vo extends zo{constructor(e){super(e),this.controlHeight=Yt,this.bufferList=[],this.playing=!1,this.playInterval=null,this.fps=1,this.preFps=1,this.streamFps=0,this.playbackRate=1,this._firstTimestamp=null,this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,this.player.on(nt.playbackPause,(e=>{e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()})),this.player.debug.log("CanvasPlaybackLoader","init")}async destroy(){this._stopSync(),this._firstTimestamp=null,this.playing=!1,this.playbackRate=1,this.fps=1,this.preFps=1,this.bufferList=[],this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,super.destroy(),this.player.debug.log("CanvasPlaybackLoader","destroy")}_initCanvasRender(){this.player._opt.useWCS?(this.renderType=ei,yo()&&this.player._opt.wcsUseWebgl2Render?(this._initContextGl2(),this.webglRender&&(this.isWcsWebgl2=!0)):this._initContext2D()):this.player._opt.useWebGPU?(this.renderType=si,this._initContextGPU()):(this.renderType=ti,this._initContextGl())}_sync(){this._stopSync(),this._doPlay(),this.playInterval=setInterval((()=>{this._doPlay()}),this.fragDuration)}_doPlay(){if(this.bufferList.length>0&&!this.player.seeking){const e=this.bufferList.shift();e&&e.buffer&&(this._doRender(e.buffer),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:e.tfTs}))}}_stopSync(){this.playInterval&&(clearInterval(this.playInterval),this.playInterval=null)}_doRender(e){if(this.player._opt.useWCS)if(this.webglRender)this.webglRender.render(e),to(e);else if(Ya(e.createImageBitmap))try{e.createImageBitmap().then((t=>{this.context2D.drawImage(t,0,0,this.$videoElement.width,this.$videoElement.height),to(e)}))}catch(e){}else this.context2D.drawImage(e,0,0,this.$videoElement.width,this.$videoElement.height),to(e);else if(this.getCanvasType()===ti)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(e){this.player.debug.error("CanvasPlaybackLoader",`doRender webgl render context is lost ${this.contextGl&&this.contextGl.isContextLost()} and error: ${e.toString()}`)}else if(this.getCanvasType()===si)try{if(!this.webGPURender)return void this.player.debug.warn("CanvasVideoLoader","doRender webgpu render is not init");this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(e){this.player.debug.error("CanvasPlaybackLoader",`doRender webgpu render and error: ${e.toString()}`)}}get rate(){return this.playbackRate}get fragDuration(){return Math.ceil(1e3/(this.fps*this.playbackRate))}get bufferSize(){return this.bufferList.length}getStreamFps(){return this.streamFps}initFps(){this._hasCalcFps?this.player.debug.log("CanvasPlaybackLoader","initFps, has calc fps"):(this.preFps=oa(this.player.playback.fps,1,100),this.fps=this.preFps)}setFps(e){e!==this.fps?(e>100&&this.player.debug.warn("CanvasPlaybackLoader","setFps max",e),e<0&&this.player.debug.warn("CanvasPlaybackLoader","setFps min",e),this.fps=oa(e,1,100),this.player.debug.log("CanvasPlaybackLoader",`setFps ${this.preFps} -> ${this.fps}`),this.player.playback.isUseFpsRender&&this._sync()):this.player.debug.log("CanvasPlaybackLoader",`setFps, same fps ${e}`)}setStreamFps(e){this.player.debug.log("CanvasPlaybackLoader","setStreamFps",e),this._hasCalcFps=!0,this.streamFps=e,this.preFps=e,this.setFps(e)}setRate(e){e!==this.playbackRate&&(this.playbackRate=e,this.player.playback.isUseFpsRender&&this._sync())}render$2(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);const t={tfTs:e.ts-this._firstTimestamp,ts:e.ts};e.videoFrame?t.buffer=e.videoFrame:t.buffer=e.output,this.bufferList.push(t),this.startRender(),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:t.tfTs})}startRender(){for(;!(this.bufferList.length<=0);){const e=this.bufferList.shift();this._doRender(e.buffer)}}pushData(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);const t={tfTs:e.ts-this._firstTimestamp,ts:e.ts};e.videoFrame?t.buffer=e.videoFrame:t.buffer=e.output;const i=this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender;if(i||this.bufferSize>this.fps*this.playbackRate*2&&(this.player.debug.warn("CanvasPlaybackLoader",`buffer size is ${this.bufferSize}`),this._doPlay()),this.bufferList.push(t),!this._hasCalcFps){const e=ro(this.bufferList);null!==e&&e!==this.preFps&&(this.player.debug.log("CanvasPlaybackLoader",`calc fps is ${e} pre fps is ${this.preFps} and updatePreFps`),this.setStreamFps(e))}if(!i){const e=this.bufferList.length,t=e/(this.fps*this.playbackRate);this.player.debug.log("CanvasPlaybackLoader","rate is",t),t<=1?this.setFps(this.preFps):(this.setFps(this.fps+Math.floor(t*this.playbackRate)),this.player.debug.warn("CanvasPlaybackLoader","rate is",t,"fps is",this.fps,"bufferListLength is",e))}}initVideo(){this.player.playback&&this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}initVideoDelay(){const e=this.player._opt.playbackDelayTime;e>0?this.delayTimeout=setTimeout((()=>{this.initVideo()}),e):this.initVideo()}clearView(){super.clearView(),this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT)}clear(){this.player._opt.useWCS&&this.bufferList.forEach((e=>{e.buffer&&to(e.buffer)})),this.bufferList=[]}resume(){this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}pause(){this.player.playback.isUseFpsRender&&this._stopSync(),this.playing=!1}}class $o{constructor(e){return new($o.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.useMSE?e.mseUseCanvasRender?Go:Ho:e.isHls&&po(e.supportHls265)||e.isWebrtc&&po(e.isWebrtcH265)?e.useCanvasRender?Go:Ho:e.isAliyunRtc?Ho:e.useWCS?e.playType===_?Vo:!e.useOffscreen&&e.wcsUseVideoRender?Ho:Go:e.playType===_?Vo:e.wasmUseVideoRender&&!e.useOffscreen?Ho:Go}}class Wo extends So{constructor(e){super(),this.bufferList=[],this.player=e,this.$audio=null,this.scriptNode=null,this.workletProcessorNode=null,this.workletWorkerCloseTimeout=null,this.hasInitScriptNode=!1,this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:48e3}),this.gainNode=this.audioContext.createGain();const t=this.audioContext.createBufferSource();t.buffer=this.audioContext.createBuffer(1,1,22050),t.connect(this.audioContext.destination),t.noteOn?t.noteOn(0):t.start(0),this.audioBufferSourceNode=t,this.mediaStreamAudioDestinationNode=this.audioContext.createMediaStreamDestination(),this.gainNode.gain.value=0,this._prevVolume=null,this.playing=!1,this.audioInfo={encTypeCode:"",encType:"",channels:"",sampleRate:"",depth:""},this.init=!1,this.hasAudio=!1,this.audioResumeStateTimeout=null}async destroy(){return this.closeAudio(),this.resetInit(),this.clearAudioResumeStateTimeout(),this.audioContext&&(await this.audioContext.close(),this.audioContext=null),this.gainNode&&(this.gainNode.disconnect(),this.gainNode=null),this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.disconnect(),this.scriptNode.onaudioprocess=ta,this.scriptNode=null),await this._destroyWorklet(),this.workletProcessorNode&&(this.workletProcessorNode.disconnect(),this.workletProcessorNode.port.onmessage=ta,this.workletProcessorNode=null),this.audioBufferSourceNode&&(this.audioBufferSourceNode.stop(),this.audioBufferSourceNode=null),this.mediaStreamAudioDestinationNode&&(this.mediaStreamAudioDestinationNode.disconnect(),this.mediaStreamAudioDestinationNode=null),this.hasInitScriptNode=!1,this._prevVolume=null,this.off(),!0}_destroyWorklet(){return new Promise(((e,t)=>{this.workletProcessorNode?(this.workletProcessorNode.port.postMessage({type:"destroy"}),this.workletWorkerCloseTimeout=setTimeout((()=>{this.player.debug.log(this.TAG_NAME,"send close and wait 10ms destroy directly"),this.workletWorkerCloseTimeout&&(clearTimeout(this.workletWorkerCloseTimeout),this.workletWorkerCloseTimeout=null),e()}),10)):e()}))}resetInit(){this.audioInfo={encTypeCode:"",encType:"",channels:"",sampleRate:"",depth:""},this.init=!1}getAudioInfo(){return this.audioInfo}updateAudioInfo(e){e.encTypeCode&&(this.audioInfo.encTypeCode=e.encTypeCode,this.audioInfo.encType=Ct[e.encTypeCode]),e.channels&&(this.audioInfo.channels=e.channels),e.sampleRate&&(this.audioInfo.sampleRate=e.sampleRate),e.depth&&(this.audioInfo.depth=e.depth),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(nt.audioInfo,this.audioInfo),this.init=!0)}get isPlaying(){return this.playing}get isMute(){return 0===this.gainNode.gain.value}get volume(){return this.gainNode.gain.value}get bufferSize(){return this.bufferList.length}get audioContextState(){let e=null;return this.audioContext&&(e=this.audioContext.state),e}initScriptNode(){}initMobileScriptNode(){}initWorkletScriptNode(){}getEngineType(){return""}mute(e){e?(this.setVolume(0),this.clear()):this.setVolume(this.player.lastVolume||.5)}setVolume(e){e=parseFloat(e).toFixed(2),isNaN(e)||(this.audioEnabled(!0),e=oa(e,0,1),null===this._prevVolume?this.player.emit(nt.mute,0===e):0===this._prevVolume&&e>0?this.player.emit(nt.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(nt.mute,!0),this.gainNode.gain.value=e,this.player.emit(nt.volumechange,this.player.volume),this.player.emit(nt.volume,this.player.volume),this._prevVolume=e)}closeAudio(){this.hasInitScriptNode&&(this.scriptNode&&this.scriptNode.disconnect(this.gainNode),this.workletProcessorNode&&this.workletProcessorNode.disconnect(this.gainNode),this.gainNode&&(this.gainNode.disconnect(this.mediaStreamAudioDestinationNode),this.$audio||this.gainNode.disconnect(this.audioContext.destination))),this.clear()}audioEnabled(e){e?this.isStateSuspended()&&(this.audioContext.resume().then((()=>{this.player.emit(nt.audioResumeState,{state:this.audioContextState,isRunning:this.isStateRunning()})})),this.audioResumeStateTimeout=setTimeout((()=>{this.clearAudioResumeStateTimeout(),this.isStateSuspended()&&this.player.emit(nt.audioResumeState,{state:this.audioContextState,isRunning:this.isStateRunning()})}),1e3)):this.isStateRunning()&&this.audioContext.suspend()}isStateRunning(){return"running"===this.audioContextState}isStateSuspended(){return"suspended"===this.audioContextState}clearAudioResumeStateTimeout(){this.audioResumeStateTimeout&&(clearTimeout(this.audioResumeStateTimeout),this.audioResumeStateTimeout=null)}clear(){this.bufferList=[]}play(e,t){}pause(){this.playing=!1}resume(){this.playing=!0}setRate(e){}getAudioBufferSize(){return 0}}class Jo{constructor(e,t,i,s){this.player=e,this.audio=t,this.channel=i,this.bufferSize=s}destroy(){this.buffer=null,this.channel=null}extract(e,t){let i=this.provide(t);for(let t=0;t=o){try{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:0;const s=2*(t=t||0);i>=0||(i=(e.length-s)/2);const r=2*i;this.ensureCapacity(i+this._frameCount);const a=this.endIndex;this.vector.set(e.subarray(s,s+r),a),this._frameCount+=i}putBuffer(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t=t||0,i>=0||(i=e.frameCount-t),this.putSamples(e.vector,e.position+t,i)}receive(e){e>=0&&!(e>this._frameCount)||(e=this.frameCount),this._frameCount-=e,this._position+=e}receiveSamples(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=2*t,s=this.startIndex;e.set(this._vector.subarray(s,s+i)),this.receive(t)}extract(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.startIndex+2*t,r=2*i;e.set(this._vector.subarray(s,s+r))}ensureCapacity(){const e=parseInt(2*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0));if(this._vector.length0&&void 0!==arguments[0]?arguments[0]:0;this.ensureCapacity(this._frameCount+e)}rewind(){this._position>0&&(this._vector.set(this._vector.subarray(this.startIndex,this.endIndex)),this._position=0)}}class Ko{constructor(e){e?(this._inputBuffer=new qo,this._outputBuffer=new qo):this._inputBuffer=this._outputBuffer=null}destroy(){this.clear(),this._outputBuffer&&(this._outputBuffer.destroy(),this._outputBuffer=null),this._inputBuffer&&(this._inputBuffer.destroy(),this._inputBuffer=null)}get inputBuffer(){return this._inputBuffer}set inputBuffer(e){this._inputBuffer=e}get outputBuffer(){return this._outputBuffer}set outputBuffer(e){this._outputBuffer=e}clear(){this._inputBuffer.clear(),this._outputBuffer.clear()}}class Yo extends Ko{constructor(e){super(e),this.reset(),this._rate=1}destroy(){super.destroy()}set rate(e){this._rate=e}reset(){this.slopeCount=0,this.prevSampleL=0,this.prevSampleR=0}clone(){const e=new Yo;return e.rate=this._rate,e}process(){const e=this._inputBuffer.frameCount;this._outputBuffer.ensureAdditionalCapacity(e/this._rate+1);const t=this.transpose(e);this._inputBuffer.receive(),this._outputBuffer.put(t)}transpose(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(0===e)return 0;const t=this._inputBuffer.vector,i=this._inputBuffer.startIndex,s=this._outputBuffer.vector,r=this._outputBuffer.endIndex;let a=0,o=0;for(;this.slopeCount<1;)s[r+2*o]=(1-this.slopeCount)*this.prevSampleL+this.slopeCount*t[i],s[r+2*o+1]=(1-this.slopeCount)*this.prevSampleR+this.slopeCount*t[i+1],o+=1,this.slopeCount+=this._rate;if(this.slopeCount-=1,1!==e)e:for(;;){for(;this.slopeCount>1;)if(this.slopeCount-=1,a+=1,a>=e-1)break e;const n=i+2*a;s[r+2*o]=(1-this.slopeCount)*t[n]+this.slopeCount*t[n+2],s[r+2*o+1]=(1-this.slopeCount)*t[n+1]+this.slopeCount*t[n+3],o+=1,this.slopeCount+=this._rate}return this.prevSampleL=t[i+2*e-2],this.prevSampleR=t[i+2*e-1],o}}class Qo{constructor(e){this._pipe=e}destroy(){}get pipe(){return this._pipe}get inputBuffer(){return this._pipe.inputBuffer}get outputBuffer(){return this._pipe.outputBuffer}fillInputBuffer(){throw new Error("fillInputBuffer() not overridden")}fillOutputBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;for(;this.outputBuffer.frameCount2&&void 0!==arguments[2]?arguments[2]:Xo;super(t),this.callback=i,this.sourceSound=e,this.historyBufferSize=22050,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}destroy(){this.clear(),this.sourceSound.destroy(),this.sourceSound=null,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}get position(){return this._position}set position(e){if(e>this._position)throw new RangeError("New position may not be greater than current position");const t=this.outputBufferPosition-(this._position-e);if(t<0)throw new RangeError("New position falls outside of history buffer");this.outputBufferPosition=t,this._position=e}get sourcePosition(){return this._sourcePosition}set sourcePosition(e){this.clear(),this._sourcePosition=e}onEnd(){this.callback()}fillInputBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=new Float32Array(2*e),i=this.sourceSound.extract(t,e,this._sourcePosition);this._sourcePosition+=i,this.inputBuffer.putSamples(t,0,i)}extract(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillOutputBuffer(this.outputBufferPosition+t);const i=Math.min(t,this.outputBuffer.frameCount-this.outputBufferPosition);this.outputBuffer.extract(e,this.outputBufferPosition,i);const s=this.outputBufferPosition+i;return this.outputBufferPosition=Math.min(this.historyBufferSize,s),this.outputBuffer.receive(Math.max(s-this.historyBufferSize,0)),this._position+=i,i}handleSampleData(e){this.extract(e.data,4096)}clear(){super.clear(),this.outputBufferPosition=0}}const en=[[124,186,248,310,372,434,496,558,620,682,744,806,868,930,992,1054,1116,1178,1240,1302,1364,1426,1488,0],[-100,-75,-50,-25,25,50,75,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-20,-15,-10,-5,5,10,15,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-4,-3,-2,-1,1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],tn=-10/1.5;class sn extends Ko{constructor(e){super(e),this._quickSeek=!0,this.midBufferDirty=!1,this.midBuffer=null,this.refMidBuffer=null,this.overlapLength=0,this.autoSeqSetting=!0,this.autoSeekSetting=!0,this._tempo=1,this.setParameters(44100,0,0,8)}destroy(){this.clear(),super.destroy()}clear(){super.clear(),this.clearMidBuffer(),this.refMidBuffer=null}clearMidBuffer(){this.midBufferDirty&&(this.midBufferDirty=!1),this.midBuffer=null}setParameters(e,t,i,s){e>0&&(this.sampleRate=e),s>0&&(this.overlapMs=s),t>0?(this.sequenceMs=t,this.autoSeqSetting=!1):this.autoSeqSetting=!0,i>0?(this.seekWindowMs=i,this.autoSeekSetting=!1):this.autoSeekSetting=!0,this.calculateSequenceParameters(),this.calculateOverlapLength(this.overlapMs),this.tempo=this._tempo}set tempo(e){let t;this._tempo=e,this.calculateSequenceParameters(),this.nominalSkip=this._tempo*(this.seekWindowLength-this.overlapLength),this.skipFract=0,t=Math.floor(this.nominalSkip+.5),this.sampleReq=Math.max(t+this.overlapLength,this.seekWindowLength)+this.seekLength}get tempo(){return this._tempo}get inputChunkSize(){return this.sampleReq}get outputChunkSize(){return this.overlapLength+Math.max(0,this.seekWindowLength-2*this.overlapLength)}calculateOverlapLength(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;e=this.sampleRate*t/1e3,e=e<16?16:e,e-=e%8,this.overlapLength=e,this.refMidBuffer=new Float32Array(2*this.overlapLength),this.midBuffer=new Float32Array(2*this.overlapLength)}checkLimits(e,t,i){return ei?i:e}calculateSequenceParameters(){let e,t;this.autoSeqSetting&&(e=150+-50*this._tempo,e=this.checkLimits(e,50,125),this.sequenceMs=Math.floor(e+.5)),this.autoSeekSetting&&(t=28.333333333333332+tn*this._tempo,t=this.checkLimits(t,15,25),this.seekWindowMs=Math.floor(t+.5)),this.seekWindowLength=Math.floor(this.sampleRate*this.sequenceMs/1e3),this.seekLength=Math.floor(this.sampleRate*this.seekWindowMs/1e3)}set quickSeek(e){this._quickSeek=e}clone(){const e=new sn;return e.tempo=this._tempo,e.setParameters(this.sampleRate,this.sequenceMs,this.seekWindowMs,this.overlapMs),e}seekBestOverlapPosition(){return this._quickSeek?this.seekBestOverlapPositionStereoQuick():this.seekBestOverlapPositionStereo()}seekBestOverlapPositionStereo(){let e,t,i,s=0;for(this.preCalculateCorrelationReferenceStereo(),e=0,t=Number.MIN_VALUE;st&&(t=i,e=s);return e}seekBestOverlapPositionStereoQuick(){let e,t,i,s,r,a=0;for(this.preCalculateCorrelationReferenceStereo(),t=Number.MIN_VALUE,e=0,s=0,r=0;a<4;a+=1){let o=0;for(;en[a][o]&&(r=s+en[a][o],!(r>=this.seekLength));)i=this.calculateCrossCorrelationStereo(2*r,this.refMidBuffer),i>t&&(t=i,e=r),o+=1;s=e}return e}preCalculateCorrelationReferenceStereo(){let e,t,i=0;for(;i=this.sampleReq;){e=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(e)),this._outputBuffer.put(this.overlapLength),t=this.seekWindowLength-2*this.overlapLength,t>0&&this._outputBuffer.putBuffer(this._inputBuffer,e+this.overlapLength,t);const s=this._inputBuffer.startIndex+2*(e+this.seekWindowLength-this.overlapLength);this.midBuffer.set(this._inputBuffer.vector.subarray(s,s+2*this.overlapLength)),this.skipFract+=this.nominalSkip,i=Math.floor(this.skipFract),this.skipFract-=i,this._inputBuffer.receive(i)}}}const rn=function(e,t){return(e>t?e-t:t-e)>1e-10};class an{constructor(){this.transposer=new Yo(!1),this.stretch=new sn(!1),this._inputBuffer=new qo,this._intermediateBuffer=new qo,this._outputBuffer=new qo,this._rate=0,this._tempo=0,this.virtualPitch=1,this.virtualRate=1,this.virtualTempo=1,this.calculateEffectiveRateAndTempo()}destroy(){this.clear(),this._inputBuffer.destroy(),this._intermediateBuffer.destroy(),this._outputBuffer.destroy(),this._inputBuffer=null,this._intermediateBuffer=null,this._outputBuffer=null}clear(){this.transposer.clear(),this.stretch.clear()}clone(){const e=new an;return e.rate=this.rate,e.tempo=this.tempo,e}get rate(){return this._rate}set rate(e){this.virtualRate=e,this.calculateEffectiveRateAndTempo()}set rateChange(e){this._rate=1+.01*e}get tempo(){return this._tempo}set tempo(e){this.virtualTempo=e,this.calculateEffectiveRateAndTempo()}set tempoChange(e){this.tempo=1+.01*e}set pitch(e){this.virtualPitch=e,this.calculateEffectiveRateAndTempo()}set pitchOctaves(e){this.pitch=Math.exp(.69314718056*e),this.calculateEffectiveRateAndTempo()}set pitchSemitones(e){this.pitchOctaves=e/12}get inputBuffer(){return this._inputBuffer}get outputBuffer(){return this._outputBuffer}calculateEffectiveRateAndTempo(){const e=this._tempo,t=this._rate;this._tempo=this.virtualTempo/this.virtualPitch,this._rate=this.virtualRate*this.virtualPitch,rn(this._tempo,e)&&(this.stretch.tempo=this._tempo),rn(this._rate,t)&&(this.transposer.rate=this._rate),this._rate>1?this._outputBuffer!=this.transposer.outputBuffer&&(this.stretch.inputBuffer=this._inputBuffer,this.stretch.outputBuffer=this._intermediateBuffer,this.transposer.inputBuffer=this._intermediateBuffer,this.transposer.outputBuffer=this._outputBuffer):this._outputBuffer!=this.stretch.outputBuffer&&(this.transposer.inputBuffer=this._inputBuffer,this.transposer.outputBuffer=this._intermediateBuffer,this.stretch.inputBuffer=this._intermediateBuffer,this.stretch.outputBuffer=this._outputBuffer)}process(){this._rate>1?(this.stretch.process(),this.transposer.process()):(this.transposer.process(),this.stretch.process())}}class on{constructor(e,t,i){this.player=e,this.audio=t,this.soundTouch=new an,this.soundTouch.tempo=1,this.soundTouch.rate=1,this.filter=new Zo(i,this.soundTouch)}destroy(){this.filter&&(this.filter.destroy(),this.filter=null),this.soundTouch&&(this.soundTouch.destroy(),this.soundTouch=null)}setRate(e){e!==this.soundTouch.rate&&(this.soundTouch.tempo=e)}provide(e){let t=new Float32Array(2*e),i=this.filter.extract(t,e),s=new Float32Array(i),r=new Float32Array(i);for(let e=0;e{e()})),this.eventListenList=[]),this.$audio&&(this.$audio.pause(),this.$audio.srcObject=null,this.$audio.parentNode&&this.$audio.parentNode.removeChild(this.$audio),this.$audio=null),this.processor&&(this.processor.destroy(),this.processor=null),this.rateProcessor&&(this.rateProcessor.destroy(),this.rateProcessor=null),this.scriptNodeInterval&&(clearInterval(this.scriptNodeInterval),this.scriptNodeInterval=null),this.defaultPlaybackRate=1,this.playbackRate=1,this.scriptStartTime=0,this.audioBufferSize=0,this.engineType=Us,this.player.debug.log("AudioContext","destroy"),!0}isAudioPlaying(){return this.$audio&&po(this.$audio.paused)&&po(this.$audio.ended)&&0!==this.$audio.playbackRate&&0!==this.$audio.readyState}_bindAudioProxy(){const{proxy:e}=this.player.events,t=e(this.$audio,"canplay",(()=>{this.player.debug.log("AudioContext","canplay"),this._delayPlay&&this._audioElementPlay()}));this.eventListenList.push(t)}_getAudioElementReadyState(){let e=0;return this.$audio&&(e=this.$audio.readyState),e}audioElementPlay(){if(this.$audio){const e=this._getAudioElementReadyState();if(this.player.debug.log("AudioContext",`play and readyState: ${e}`),!(0!==e||Wa()&&ya()))return this.player.debug.warn("AudioContext","readyState is 0 and set _delayPlay to true"),void(this._delayPlay=!0);this._audioElementPlay()}}_audioElementPlay(){this.$audio&&this.$audio.play().then((()=>{this._delayPlay=!1,this.player.debug.log("AudioContext","_audioElementPlay success"),setTimeout((()=>{this.isAudioPlaying()||(this.player.debug.warn("AudioContext","play failed and retry play"),this._audioElementPlay())}),100),this.isAudioPlaying()&&(this.player.debug.log("AudioContext","play success and remove document click event listener"),document.removeEventListener("click",this._audioElementPlay.bind(this)))})).catch((e=>{this.player.debug.error("AudioContext","_audioElementPlay error",e),document.addEventListener("click",this._audioElementPlay.bind(this))}))}getAudioBufferSize(){return this.audioBufferSize}get oneBufferDuration(){return this.audioBufferSize/this.audioContext.sampleRate*1e3}get isActiveEngineType(){return this.engineType===Fs}getBufferListDuration(){return this.bufferList.length*this.oneBufferDuration}isMoreThanMinBufferDuration(){return this.getBufferListDuration()>=100*this.playbackRate}initProcessor(){this.processor=new Jo(this.player,this,this.audioInfo.channels,this.audioBufferSize),this.rateProcessor=new on(this.player,this,this.processor)}getAutoAudioEngineType(){let e=this.player._opt.audioEngine||Us;const t=()=>{e=Wa()&&fa()?Fs:(ya()&&this.player._opt.supportLockScreenPlayAudio||io()&&this.supportAudioWorklet(),Us)};return this.player._opt.audioEngine?this.player._opt.audioEngine===Ms&&io()&&this.supportAudioWorklet()?e=Ms:this.player._opt.audioEngine===Fs?e=Fs:this.player._opt.audioEngine===Us?e=Us:t():t(),e}getAudioBufferSizeByType(){const e=this.engineType;this.player._opt.hasVideo;const t=this.player._opt.weiXinInAndroidAudioBufferSize;return e===Ms?1024:e===Fs?t||4800:1024}supportAudioWorklet(){return this.audioContext&&this.audioContext.audioWorklet}initScriptNode(){this.playing=!0,this.hasInitScriptNode||(this.initProcessor(),this.engineType===Ms?this.initWorkletScriptNode():this.engineType===Fs?this.initIntervalScriptNode():this.engineType===Us&&this.initProcessScriptNode(),this.audioElementPlay())}getEngineType(){return this.engineType}isPlaybackRateSpeed(){return this.playbackRate>this.defaultPlaybackRate}initProcessScriptNode(){const e=this.audioContext.createScriptProcessor(this.audioBufferSize,0,this.audioInfo.channels);e.onaudioprocess=e=>{const t=e.outputBuffer;this.handleScriptNodeCallback(t)},e.connect(this.gainNode),this.scriptNode=e,this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0}initIntervalScriptNode(){this.scriptStartTime=0;const e=1e3*this.audioBufferSize/this.audioContext.sampleRate;this.scriptNodeInterval=setInterval((()=>{if(0===this.bufferList.length||po(this.playing)||this.isMute)return void(this.playing&&po(this.isMute)&&this.player.debug.log("AudioContext",`interval script node and bufferList is ${this.bufferList.length} or playing is ${this.playing}`));const e=this.audioContext.createBufferSource(),t=this.audioContext.createBuffer(this.audioInfo.channels,this.audioBufferSize,this.audioContext.sampleRate);this.handleScriptNodeCallback(t,(()=>{this.scriptStartTime{"init"===e.data.message?(this.audioBufferSize=e.data.audioBufferSize,this.start=e.data.start,this.channels=e.data.channels,this.state=0,this.offset=0,this.samplesArray=[]):"stop"===e.data.message?(this.state=0,this.start=!1,this.offset=0,this.samplesArray=[]):"data"===e.data.message?this.samplesArray.push(e.data.buffer):"zero"===e.data.message&&this.samplesArray.push({left:new Float32Array(this.audioBufferSize).fill(0),right:new Float32Array(this.audioBufferSize).fill(0)})}}process(e,t,i){const s=t[0][0],r=t[0][1];if(0===this.offset&&this.port.postMessage({message:"beep"}),0===this.state)this.state=1;else if(1===this.state&&this.samplesArray.length>=4)this.state=2;else if(2===this.state){const e=this.samplesArray[0];for(let t=0;t{if(this.player.isDestroyedOrClosed())return void this.player.debug.log("AudioContext","initWorkletScriptNode() player is destroyed");if(!this.audioContext)return void this.player.debug.warn("AudioContext","initWorkletScriptNode audioContext is null");let e=[1];2===this.audioInfo.channels&&(e=[1,1]);try{this.workletProcessorNode=new AudioWorkletNode(this.audioContext,"worklet-processor",{numberOfOutputs:this.audioInfo.channels,outputChannelCount:e})}catch(e){this.player.debug.error("AudioContext","initWorkletScriptNode error",e),this.workletProcessorNode=null,this.tierDownToProcessScript()}this.workletProcessorNode&&(this.workletProcessorNode.connect(this.gainNode),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0,this.workletProcessorNode.port.postMessage({message:"init",audioBufferSize:this.audioBufferSize,start:!0,channels:this.audioInfo.channels}),this.workletProcessorNode.port.onmessage=e=>{this.workletProcessorNode?this.audioContext?this.handleScriptNodeCallback(this.workletProcessorNode,null,!0):this.workletProcessorNode.port.postMessage({message:"zero"}):this.player.debug.error("AudioContext","workletProcessorNode is null")})})),this.clearWorkletUrlTimeout=setTimeout((()=>{URL.revokeObjectURL(this.workletUrl),this.workletUrl=null,this.clearWorkletUrlTimeout=null}),te)}tierDownToProcessScript(){this.player.debug.log("AudioContext","tierDownToProcessScript"),this.engineType=Us,this.audioBufferSize=this.getAudioBufferSizeByType(),this.initProcessScriptNode(),this.audioElementPlay()}handleScriptNodeCallback(e,t){let i,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t=t||ta;let r=e.length;s&&(i=e,r=this.audioBufferSize);const a=this.audioInfo.channels;if(this.playing&&this.isMoreThanMinBufferDuration()){if(this.player._opt,this.player.openSyncAudioAndVideo()&&uo(this.player.visibility)){this.calcPlaybackRateBySync();const r=this.player.getAudioSyncVideoDiff();if(r>this.player._opt.syncAudioAndVideoDiff)return this.player.debug.warn("AudioContext",`audioSyncVideoOption more than diff :${r}, waiting and bufferList is ${this.bufferList.length}`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,a),void t()}let o=this._provide(r);if(0===o.size)return po(this.player.isPlaybackOnlyDecodeIFrame())&&this.player.debug.warn("AudioContext",`bufferList size is ${this.bufferList.length} outputBufferLength is ${r},and bufferItem.size is 0`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,a),void t();o&&o.ts&&(this.player.audioTimestamp=o.ts),s?i.port.postMessage({message:"data",buffer:o}):this.fillScriptNodeOutputBuffer(e,a,o),t()}else 0===this.bufferList.length&&this.playing&&po(this.isMute)&&po(this.player.isPlaybackOnlyDecodeIFrame())&&this.player.debug.warn("AudioContext",`bufferList size is 0 and outputBufferLength is ${r}`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,a),t()}fillScriptNodeOutputBuffer(e,t,i){if(1===t){const t=e.getChannelData(0);i?0===i.size?t.fill(0):t.set(i.left):t.fill(0)}else if(2===t){const t=e.getChannelData(0),s=e.getChannelData(1);i?0===i.size?(t.fill(0),s.fill(0)):(t.set(i.left),s.set(i.right)):(t.fill(0),s.fill(0))}}play(e,t){this.isMute||(this.hasInitScriptNode?(this.hasAudio=!0,this.player.latestAudioTimestamp=t,this.bufferList.push({buffer:e,ts:t}),po(this.player.openSyncAudioAndVideo())&&this.calcPlaybackRateByBuffer()):this.player.debug.warn("AudioContext","play has not init script node"))}calcPlaybackRateBySync(){if(this.isMute)return;if(!this.playing)return;const e=Math.floor(2e3/this.oneBufferDuration);if(this.bufferList.length>e)return this.player.debug.warn("AudioContext",`bufferList length ${this.bufferList.length} more than ${e}, and drop`),void this.clear();const t=this.player.getAudioSyncVideoDiff();if(this.getEngineType()===Fs){if(t<-this.player._opt.syncAudioAndVideoDiff){this.player.debug.warn("AudioContext",`engine active , audioSyncVideoOption ${-this.player._opt.syncAudioAndVideoDiff} less than diff :${t},\n and bufferlist is ${this.bufferList.length}`);const e=this.player.getRenderCurrentPts();for(;this.bufferList.length>0;){const t=this.bufferList[0],i=t.ts-e;if(i>-this.player._opt.syncAudioAndVideoDiff/2){this.player.audioTimestamp=t.ts,this.player.debug.log("AudioContext",`engine active , audioSyncVideoOption\n item.ts is ${t.ts} and currentVideoTimestamp is ${e}, diff is ${i} > -${this.player._opt.syncAudioAndVideoDiff/2} and end`);break}this.bufferList.shift(),this.player.audioTimestamp=t.ts}}}else{let e=this.playbackRate;t<-this.player._opt.syncAudioAndVideoDiff?e===this.defaultPlaybackRate&&(this.player.debug.log("AudioContext",`audioSyncVideoOption ${-this.player._opt.syncAudioAndVideoDiff} less than diff :${t},\n speed up, playbackRate is ${e},\n and bufferList is ${this.bufferList.length}`),e=this.defaultPlaybackRate+.2):t>-this.player._opt.syncAudioAndVideoDiff/2&&e!==this.defaultPlaybackRate&&(this.player.debug.log("AudioContext",`diff is ${t} > -${this.player._opt.syncAudioAndVideoDiff/2} and speed to 1`),e=this.defaultPlaybackRate),this.updatePlaybackRate(e)}}calcPlaybackRateByBuffer(){if(this.isMute)return;if(!this.playing)return;let e=this.playbackRate,t=1e3,i=5e3;this.isAudioPlayer&&(t=this.player._opt.videoBufferDelay,i=this.player._opt.videoBufferMax);const s=Math.floor(t/this.oneBufferDuration),r=Math.floor(i/this.oneBufferDuration);if(this.bufferList.length>r)return this.player.debug.warn("AudioContext",`bufferList length ${this.bufferList.length} more than ${r}, and drop`),void this.clear();this.getEngineType()!==Fs&&(this.bufferList.length>s?(e=this.defaultPlaybackRate+.2,this.player.debug.log("AudioContext",`bufferList length ${this.bufferList.length} more than ${s}, speed up, playbackRate is ${e}`)):this.bufferList.length0?this.player.emit(nt.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(nt.mute,!0),this.$video.volume=e,this.player.emit(nt.volumechange,this.player.volume),this.player.emit(nt.volume,this.player.volume),this._prevVolume=e)}clear(){}play(){}pause(){}resume(){}getEngineType(){return"audio"}isPlaybackRateSpeed(){return!1}getAudioBufferSize(){return 0}setRate(){}initScriptNode(){}initScriptNodeDelay(){}audioEnabled(){this.mute(!1)}}class dn extends nn{constructor(e){super(e),this.delayTimeout=null,this.player.on(nt.playbackPause,(e=>{this.listenPlaybackPause(e)})),this.player.debug.log("AudioPlaybackContext","init")}async destroy(){return this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null),await super.destroy(),this.player.debug.log("AudioPlaybackLoader","destroy"),!0}listenPlaybackPause(e){e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()}initScriptNodeDelay(){const e=this.player._opt.playbackDelayTime;e>0?this.delayTimeout=setTimeout((()=>{this.initScriptNode()}),e):this.initScriptNode()}setRate(e){e!==this.defaultPlaybackRate&&this.rateProcessor&&(this.player.debug.log("AudioPlaybackContext","setRate",e),this.defaultPlaybackRate=e,this.updatePlaybackRate(e))}}class hn extends nn{constructor(e){super(e),this.TAG_NAME="AudioPlayerLoader",this.isAudioPlayer=!0,this.player.debug.log(this.TAG_NAME,"init")}async destroy(){return await super.destroy(),this.player.debug.log(this.TAG_NAME,"destroy"),!0}play(e,t){po(this.playing)||super.play(e,t)}pause(){this.player.debug.log(this.TAG_NAME,"pause"),this.playing=!1,this.clear()}resume(){this.player.debug.log(this.TAG_NAME,"resume"),this.playing=!0}}class cn{constructor(e){return new(cn.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.playType===_?e.useMSE&&e.mseDecodeAudio?ln:dn:e.playType===v?hn:e.isHls&&po(e.supportHls265)||e.isWebrtc&&po(e.isWebrtcH265)||e.useMSE&&e.mseDecodeAudio||e.isAliyunRtc?ln:nn}}class un extends So{constructor(e){super(),this.player=e,this.playing=!1,this._requestAbort=!1,this._status=dr,this.writableStream=null,this.abortController=new AbortController,this.streamRate=ha((t=>{e.emit(nt.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debug.log("FetchStream","init")}async destroy(){return this.abort(),this.writableStream&&po(this.writableStream.locked)&&this.writableStream.close().catch((e=>{this.player.debug.log("FetchStream","destroy and writableStream.close()",e)})),this.writableStream=null,this.off(),this._status=dr,this.streamRate=null,this.stopStreamRateInterval(),this.player.debug.log("FetchStream","destroy"),!0}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{demux:i}=this.player;this.player._times.streamStart=aa();const s=Object.assign({signal:this.abortController.signal},{headers:t.headers||{}});fetch(e,s).then((e=>{if(this._requestAbort)return this._status=dr,void e.body.cancel();if(!function(e){return e.ok&&e.status>=200&&e.status<=299}(e))return this.player.debug.error("FetchStream",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),this.abort(),void this.emit(ct.fetchError,`fetch response status is ${e.status} and ok is ${e.ok}`);if(this.emit(nt.streamSuccess),this.startStreamRateInterval(),"undefined"!=typeof WritableStream)this.player.debug.log("FetchStream","use WritableStream() to read stream"),this.writableStream=new WritableStream({write:e=>this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?(this.player.debug.log("FetchStream","writableStream.write() and this.abortController.signal.aborted so return"),void(this._status=cr)):uo(this._requestAbort)?(this.player.debug.log("FetchStream","writableStream.write() and this._requestAbort is true so return"),void(this._status=cr)):"string"!=typeof e?(this._status=hr,this.streamRate&&this.streamRate(e.byteLength),i.dispatch(e)):void this.player.debug.warn("FetchStream",`writableStream.write() and value is "${e}" string so return`),close:()=>{this._status=cr,i.close(),this.emit(nt.streamEnd,"fetch done")},abort:e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return this.player.debug.log("FetchStream","writableStream.abort() and this.abortController.signal.aborted so return"),void(this._status=cr);i.close();const t=e.toString();-1===t.indexOf(ps)&&-1===t.indexOf(fs)&&e.name!==ms&&(this.abort(),this.emit(ct.fetchError,e))}}),e.body.pipeTo(this.writableStream);else{this.player.debug.log("FetchStream","not support WritableStream and use getReader() to read stream");const t=e.body.getReader(),s=()=>{t.read().then((e=>{let{done:t,value:r}=e;return t?(this._status=cr,i.close(),void this.emit(nt.streamEnd,"fetch done")):this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?(this.player.debug.log("FetchStream","reader.read() and this.abortController.signal.aborted so return"),void(this._status=cr)):uo(this._requestAbort)?(this.player.debug.log("FetchStream","reader.read() and this._requestAbort is true so return"),void(this._status=cr)):void("string"!=typeof r?(this._status=hr,this.streamRate&&this.streamRate(r.byteLength),i.dispatch(r),s()):this.player.debug.warn("FetchStream",`reader.read() and value is "${r}" string so return`))})).catch((e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return this.player.debug.log("FetchStream","reader.read().catch() and this.abortController.signal.aborted so return"),void(this._status=cr);i.close();const t=e.toString();-1===t.indexOf(ps)&&-1===t.indexOf(fs)&&e.name!==ms&&(this.abort(),this.emit(ct.fetchError,e))}))};s()}})).catch((e=>{this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||"AbortError"!==e.name&&(i.close(),this.abort(),this.emit(ct.fetchError,e))}))}abort(){this._requestAbort=!0;const e=Ja();if(this._status!==hr||po(e)){if(this.abortController){try{this.abortController.abort()}catch(e){}this.abortController=null}}else this.abortController=null,this.player.debug.log("FetchStream",`abort() and not abortController.abort() _status is ${this._status} and _isChrome is ${e}`)}getStreamType(){return u}}class pn extends So{constructor(e){super(),this.TAG_NAME="FetchWorkerLoader",this.player=e,this.playing=!1,this.fetchWorker=null,this.workerClearTimeout=null,this.workerUrl=null,this.destroyResolve=null,this.decoderWorkerCloseTimeout=null,this.abortController=new AbortController,this.streamRate=ha((t=>{e.emit(nt.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,this._initFetchWorker(),e.debug.log(this.TAG_NAME,"init")}destroy(){return new Promise(((e,t)=>{this.fetchWorker?(this.player.debug.log(this.TAG_NAME,"send destroy"),this.fetchWorker.postMessage({cmd:tt}),this.destroyResolve=e,this.decoderWorkerCloseTimeout=setTimeout((()=>{this.player.debug.warn(this.TAG_NAME,"send close but not response and destroy directly"),this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this._destroy(),setTimeout((()=>{e()}),0)}),2e3)):(this._destroy(),setTimeout((()=>{e()}),0))}))}_destroy(){this.off(),this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this.workerUrl&&(window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this._stopStreamRateInterval(),this.streamRate=null,this.fetchWorker&&(this.fetchWorker.terminate(),this.fetchWorker.onmessage=null,this.fetchWorker=null),this.destroyResolve&&(this.destroyResolve(),this.destroyResolve=null),this.player.debug.log(this.TAG_NAME,"destroy")}_initFetchWorker(){const e=Ao(function(){function e(e){return!0===e||"true"===e}function t(e){return!1===e||"false"===e}const i="The user aborted a request",s="AbortError",r="AbortError",a="fetch",o="destroy",n="destroyEnd",l="buffer",d="fetchError",h="fetchClose",c="fetchSuccess",u="idle",p="buffering",f="complete";let m=new class{constructor(){this._requestAbort=!1,this._status=u,this.writableStream=null,this.isChrome=!1,this.abortController=new AbortController}destroy(){this.abort(),this.writableStream&&t(this.writableStream.locked)&&this.writableStream.close().catch((e=>{})),this.writableStream=null,this._status=u}fetchStream(t){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=Object.assign({signal:this.abortController.signal},{headers:a.headers||{}});fetch(t,o).then((t=>{if(this._requestAbort)return this._status=u,void t.body.cancel();if(!function(e){return e.ok&&e.status>=200&&e.status<=299}(t))return this.abort(),void postMessage({cmd:d,message:`fetch response status is ${t.status} and ok is ${t.ok}`});if(postMessage({cmd:c}),"undefined"!=typeof WritableStream)this.writableStream=new WritableStream({write:t=>{this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||e(this._requestAbort)?this._status=f:"string"!=typeof t&&(this._status=p,postMessage({cmd:l,buffer:t},[t.buffer]))},close:()=>{this._status=f,postMessage({cmd:h})},abort:e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return void(this._status=f);const t=e.toString();-1===t.indexOf(i)&&-1===t.indexOf(s)&&e.name!==r&&(this.abort(),postMessage({cmd:d,message:e.toString()}))}}),t.body.pipeTo(this.writableStream);else{const a=t.body.getReader(),o=()=>{a.read().then((t=>{let{done:i,value:s}=t;if(i)return this._status=f,void postMessage({cmd:h});this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||e(this._requestAbort)?this._status=f:"string"!=typeof s&&(this._status=p,postMessage({cmd:l,buffer:s},[s.buffer]),o())})).catch((e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return void(this._status=f);const t=e.toString();-1===t.indexOf(i)&&-1===t.indexOf(s)&&e.name!==r&&(this.abort(),postMessage({cmd:d,message:e.toString()}))}))};o()}})).catch((e=>{this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||"AbortError"!==e.name&&(this.abort(),postMessage({cmd:d,message:e.toString()}))}))}abort(){if(this._requestAbort=!0,this._status!==p||t(m.isChrome)){if(this.abortController){try{this.abortController.abort()}catch(e){}this.abortController=null}}else this.abortController=null}};self.onmessage=t=>{const i=t.data;switch(i.cmd){case a:m.isChrome=e(i.isChrome),m.fetchStream(i.url,JSON.parse(i.options));break;case o:m.destroy(),m=null,postMessage({cmd:n})}}}.toString()),t=new Blob([e],{type:"text/javascript"});let i=URL.createObjectURL(t);const s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te),s.onmessage=e=>{const{demux:t}=this.player,i=e.data;switch(i.cmd){case st:this.streamRate&&this.streamRate(i.buffer.byteLength),t.dispatch(i.buffer);break;case ot:this.emit(nt.streamSuccess),this._startStreamRateInterval();break;case at:t.close(),this.emit(nt.streamEnd,"fetch done");break;case rt:t.close(),this.emit(ct.fetchError,i.message);break;case it:this._destroy()}},this.fetchWorker=s}_startStreamRateInterval(){this._stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}_stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player._times.streamStart=aa(),this.fetchWorker.postMessage({cmd:et,url:e,isChrome:Ja(),options:JSON.stringify(t)})}getStreamType(){return u}}class fn extends So{constructor(e){super(),this.player=e,this.socket=null,this.socketStatus=ut,this.wsUrl=null,this.requestAbort=!1,this.socketDestroyFnList=[],this.streamRate=ha((t=>{e.emit(nt.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debug.log("WebsocketStream","init")}async destroy(){this._closeWebSocket(),this.stopStreamRateInterval(),this.wsUrl=null,this.off(),this.player.debug.log("WebsocketStream","destroy")}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebSocket(){const e=this.player,{debug:t,events:{proxy:i},demux:s}=e;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer";const r=i(this.socket,"open",(()=>{t.log("WebsocketStream","socket open"),this.socketStatus=pt,this.emit(nt.streamSuccess),this.player.emit(nt.websocketOpen),this.startStreamRateInterval()})),a=i(this.socket,"message",(e=>{"string"!=typeof e.data?(this.streamRate&&this.streamRate(e.data.byteLength),this._handleMessage(e.data)):this.player.debug.warn("WebsocketStream",`websocket handle message message is "${e.data}" string so return`)})),o=i(this.socket,"close",(e=>{if(this.socketStatus!==mt){if(t.log("WebsocketStream",`socket close and code is ${e.code}`),1006===e.code&&t.error("WebsocketStream",`socket close abnormally and code is ${e.code}`),uo(this.requestAbort))return this.requestAbort=!1,void t.log("WebsocketStream","socket close and requestAbort is true");s.close(),this.socketStatus=ft,this.player.emit(nt.websocketClose,e.code),this.emit(nt.streamEnd,e.code)}else t.log("WebsocketStream","socket close and status is error, so return")})),n=i(this.socket,"error",(e=>{t.error("WebsocketStream","socket error",e),this.socketStatus=mt,this.emit(ct.websocketError,e),s.close(),t.log("WebsocketStream","socket error:",e.isTrusted?"websocket user aborted":"websocket error")}));this.socketDestroyFnList.push(r,a,o,n)}_closeWebSocket(){this.socketDestroyFnList.forEach((e=>e())),!this.socket||0!==this.socket.readyState&&1!==this.socket.readyState?this.socket&&this.player.debug.log("WebsocketStream",`_closeWebSocket() socket is null or socket status is ${this.socket&&this.socket.readyState}`):(this.requestAbort=!0,this.socket.close(1e3,"Client disconnecting")),this.socket=null,this.socketStatus=ut,this.streamRate=null}_handleMessage(e){const{demux:t}=this.player;t?t.dispatch(e):this.player.debug.warn("WebsocketStream","websocket handle message demux is null so return")}fetchStream(e,t){this.player._times.streamStart=aa(),this.wsUrl=e,this._createWebSocket()}sendMessage(e){this.socket?this.socketStatus===pt?this.socket.send(e):this.player.debug.error("WebsocketStream",`websocket send message error and socket status is ${this.socketStatus}`):this.player.debug.error("WebsocketStream","websocket send message socket is null")}resetFetchStream(){this._closeWebSocket(),this._createWebSocket()}getStreamType(){return f}}class mn extends So{constructor(e){super(),this.player=e,e.debug.log("HlsStream","init")}async destroy(){return this.off(),this.player.debug.log("HlsStream","destroy"),!0}fetchStream(e){const{hlsDecoder:t,debug:i}=this.player;this.player._times.streamStart=aa(),t.loadSource(e).then((()=>{this.player.debug.log("HlsStream","loadSource success"),this.emit(nt.streamSuccess)})).catch((e=>{this.emit(ct.hlsError,e)}))}getStreamType(){return p}}class gn extends So{constructor(e){super(),this.player=e,this.webrctUrl=null,e.debug.log("WebrtcStream","init")}async destroy(){return this.webrctUrl=null,this.off(),this.player.debug.log("WebrtcStream","destroy"),!0}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{webrtc:i,debug:s}=this.player;if(this.player._times.streamStart=aa(),this.webrctUrl=e.replace("webrtc:",window.location.protocol),-1===this.webrctUrl.indexOf("/webrtc/play")&&this.player.isWebrtcForM7S()){const t=new URL(this.webrctUrl),i="/webrtc/play"+t.pathname;this.webrctUrl=t.origin+i+t.search,this.player.debug.log("WebrtcStream",`original url is ${e}, and new url is: ${this.webrctUrl}`)}i.loadSource(this.webrctUrl,t).then((()=>{this.player.debug.log("WebrtcStream","loadSource success"),this.emit(nt.streamSuccess)})).catch((e=>{this.player.debug.error("WebrtcStream","loadSource error",e),this.emit(ct.webrtcError,e)}))}getStreamType(){return m}}class yn extends So{constructor(e){super(),this.player=e,this.transport=null,this.wtUrl=null,this.streamRate=ha((t=>{e.emit(nt.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debug.log("WebTransportLoader","init")}async destroy(){return this.abort(),this.off(),this.player.debug.log("WebTransportLoader","destroy"),!0}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebTransport(){const e=this.player,{debug:t,events:{proxy:i},demux:s}=e;try{this.transport=new WebTransport(this.wtUrl),this.transport.ready.then((()=>{this.emit(nt.streamSuccess),this.startStreamRateInterval(),this.transport.createBidirectionalStream().then((e=>{e.readable.pipeTo(new WritableStream(s.input))}))})).catch((e=>{this.player.debug.warn("WebTransportLoader","_createWebTransport-ready",e)}))}catch(e){this.player.debug.warn("WebTransportLoader","_createWebTransport",e)}}fetchStream(e){this.player._times.streamStart=aa(),this.wtUrl=e.replace(/^wt:/,"https:"),this._createWebTransport()}abort(){if(this.transport)try{this.transport.close(),this.transport=null}catch(e){this.transport=null}}getStreamType(){return g}}class An extends So{constructor(e){super(),this.player=e,this.workUrl=null,e.debug.log("WorkerStream","init")}async destroy(){return this.workUrl=null,this.off(),this.player.debug.log("WorkerStream","destroy"),!0}sendMessage(e){this.player.decoderWorker.workerSendMessage(e)}fetchStream(e){this.workUrl=e,this.player._times.streamStart=aa(),this.player.decoderWorker.workerFetchStream(e)}getStreamType(){const e=this.player._opt.protocol;return y+" "+(e===o?u:f)}}class bn extends So{constructor(e){super(),this.TAG_NAME="AliyunRtcLoader",this.player=e,e.debug.log(this.TAG_NAME,"init")}async destroy(){return this.off(),this.player.debug.log(this.TAG_NAME,"destroy"),!0}fetchStream(e){const{aliyunRtcDecoder:t}=this.player;this.player._times.streamStart=aa(),t.loadSource(e).then((()=>{this.player.debug.log(this.TAG_NAME,"loadSource success"),this.emit(nt.streamSuccess)})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource error",e),this.emit(ct.aliyunRtcError,e)}))}getStreamType(){return A}}class vn{constructor(e){return new(vn.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){const{protocol:t,useWasm:i,playType:s,useWCS:r,useMSE:c,demuxUseWorker:u,mainThreadFetchUseWorker:p}=e;return t===o?s===v?An:s===b?i&&!Za(e)||u?An:p?pn:un:r||c?u?An:p?pn:un:An:t===a?s===v?An:s===b?i&&!Za(e)||u?An:fn:r||c?u?An:fn:An:t===n?mn:t===l?gn:t===d?yn:t===h?bn:void 0}}var _n=Ir((function(e){function t(e,r){if(!e)throw"First parameter is required.";r=new i(e,r=r||{type:"video"});var a=this;function o(t){t&&(r.initCallback=function(){t(),t=r.initCallback=null});var i=new s(e,r);(p=new i(e,r)).record(),u("recording"),r.disableLogs||console.log("Initialized recorderType:",p.constructor.name,"for output-type:",r.type)}function n(e){if(e=e||function(){},p){if("paused"===a.state)return a.resumeRecording(),void setTimeout((function(){n(e)}),1);"recording"===a.state||r.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',a.state),r.disableLogs||console.log("Stopped recording "+r.type+" stream."),"gif"!==r.type?p.stop(t):(p.stop(),t()),u("stopped")}else m();function t(t){if(p){Object.keys(p).forEach((function(e){"function"!=typeof p[e]&&(a[e]=p[e])}));var i=p.blob;if(!i){if(!t)throw"Recording failed.";p.blob=i=t}if(i&&!r.disableLogs&&console.log(i.type,"->",y(i.size)),e){var s;try{s=h.createObjectURL(i)}catch(e){}"function"==typeof e.call?e.call(a,s):e(s)}r.autoWriteToDisk&&d((function(e){var t={};t[r.type+"Blob"]=e,R.Store(t)}))}else"function"==typeof e.call?e.call(a,""):e("")}}function l(e){postMessage((new FileReaderSync).readAsDataURL(e))}function d(e,t){if(!e)throw"Pass a callback function over getDataURL.";var i=t?t.blob:(p||{}).blob;if(!i)return r.disableLogs||console.warn("Blob encoder did not finish its job yet."),void setTimeout((function(){d(e,t)}),1e3);if("undefined"==typeof Worker||navigator.mozGetUserMedia){var s=new FileReader;s.readAsDataURL(i),s.onload=function(t){e(t.target.result)}}else{var a=function(e){try{var t=h.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"})),i=new Worker(t);return h.revokeObjectURL(t),i}catch(e){}}(l);a.onmessage=function(t){e(t.data)},a.postMessage(i)}}function c(e){e=e||0,"paused"!==a.state?"stopped"!==a.state&&(e>=a.recordingDuration?n(a.onRecordingStopped):(e+=1e3,setTimeout((function(){c(e)}),1e3))):setTimeout((function(){c(e)}),1e3)}function u(e){a&&(a.state=e,"function"==typeof a.onStateChanged.call?a.onStateChanged.call(a,e):a.onStateChanged(e))}var p,f='It seems that recorder is destroyed or "startRecording" is not invoked for '+r.type+" recorder.";function m(){!0!==r.disableLogs&&console.warn(f)}var g={startRecording:function(t){return r.disableLogs||console.log("RecordRTC version: ",a.version),t&&(r=new i(e,t)),r.disableLogs||console.log("started recording "+r.type+" stream."),p?(p.clearRecordedData(),p.record(),u("recording"),a.recordingDuration&&c(),a):(o((function(){a.recordingDuration&&c()})),a)},stopRecording:n,pauseRecording:function(){p?"recording"===a.state?(u("paused"),p.pause(),r.disableLogs||console.log("Paused recording.")):r.disableLogs||console.warn("Unable to pause the recording. Recording state: ",a.state):m()},resumeRecording:function(){p?"paused"===a.state?(u("recording"),p.resume(),r.disableLogs||console.log("Resumed recording.")):r.disableLogs||console.warn("Unable to resume the recording. Recording state: ",a.state):m()},initRecorder:o,setRecordingDuration:function(e,t){if(void 0===e)throw"recordingDuration is required.";if("number"!=typeof e)throw"recordingDuration must be a number.";return a.recordingDuration=e,a.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){a.onRecordingStopped=e}}},clearRecordedData:function(){p?(p.clearRecordedData(),r.disableLogs||console.log("Cleared old recorded data.")):m()},getBlob:function(){if(p)return p.blob;m()},getDataURL:d,toURL:function(){if(p)return h.createObjectURL(p.blob);m()},getInternalRecorder:function(){return p},save:function(e){p?A(p.blob,e):m()},getFromDisk:function(e){p?t.getFromDisk(r.type,e):m()},setAdvertisementArray:function(e){r.advertisement=[];for(var t=e.length,i=0;i-1&&"netscape"in window&&/ rv:/.test(navigator.userAgent),f=!u&&!c&&!!navigator.webkitGetUserMedia||b()||-1!==navigator.userAgent.toLowerCase().indexOf("chrome/"),m=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);m&&!f&&-1!==navigator.userAgent.indexOf("CriOS")&&(m=!1,f=!0);var g=window.MediaStream;function y(e){if(0===e)return"0 Bytes";var t=parseInt(Math.floor(Math.log(e)/Math.log(1e3)),10);return(e/Math.pow(1e3,t)).toPrecision(3)+" "+["Bytes","KB","MB","GB","TB"][t]}function A(e,t){if(!e)throw"Blob object is required.";if(!e.type)try{e.type="video/webm"}catch(e){}var i=(e.type||"video/webm").split("/")[1];if(-1!==i.indexOf(";")&&(i=i.split(";")[0]),t&&-1!==t.indexOf(".")){var s=t.split(".");t=s[0],i=s[1]}var r=(t||Math.round(9999999999*Math.random())+888888888)+"."+i;if(void 0!==navigator.msSaveOrOpenBlob)return navigator.msSaveOrOpenBlob(e,r);if(void 0!==navigator.msSaveBlob)return navigator.msSaveBlob(e,r);var a=document.createElement("a");a.href=h.createObjectURL(e),a.download=r,a.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(a),"function"==typeof a.click?a.click():(a.target="_blank",a.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),h.revokeObjectURL(a.href)}function b(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||(!("undefined"==typeof process||"object"!=typeof process.versions||!process.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}function v(e,t){return e&&e.getTracks?e.getTracks().filter((function(e){return e.kind===(t||"audio")})):[]}function _(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}void 0===g&&"undefined"!=typeof webkitMediaStream&&(g=webkitMediaStream),void 0!==g&&void 0===g.prototype.stop&&(g.prototype.stop=function(){this.getTracks().forEach((function(e){e.stop()}))}),t.invokeSaveAsDialog=A,t.getTracks=v,t.getSeekableBlob=function(e,t){if("undefined"==typeof EBML)throw new Error("Please link: https://www.webrtc-experiment.com/EBML.js");var i=new EBML.Reader,s=new EBML.Decoder,r=EBML.tools,a=new FileReader;a.onload=function(e){s.decode(this.result).forEach((function(e){i.read(e)})),i.stop();var a=r.makeMetadataSeekable(i.metadatas,i.duration,i.cues),o=this.result.slice(i.metadataSize),n=new Blob([a,o],{type:"video/webm"});t(n)},a.readAsArrayBuffer(e)},t.bytesToSize=y,t.isElectron=b;var S={};function w(){if(p||m||c)return!0;var e,t,i=navigator.userAgent,s=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10);return(f||u)&&(e=i.indexOf("Chrome"),s=i.substring(e+7)),-1!==(t=s.indexOf(";"))&&(s=s.substring(0,t)),-1!==(t=s.indexOf(" "))&&(s=s.substring(0,t)),r=parseInt(""+s,10),isNaN(r)&&(s=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10)),r>=49}function E(e,t){var i=this;if(void 0===e)throw'First argument "MediaStream" is required.';if("undefined"==typeof MediaRecorder)throw"Your browser does not support the Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.";if("audio"===(t=t||{mimeType:"video/webm"}).type){var s;if(v(e,"video").length&&v(e,"audio").length)navigator.mozGetUserMedia?(s=new g).addTrack(v(e,"audio")[0]):s=new g(v(e,"audio")),e=s;t.mimeType&&-1!==t.mimeType.toString().toLowerCase().indexOf("audio")||(t.mimeType=f?"audio/webm":"audio/ogg"),t.mimeType&&"audio/ogg"!==t.mimeType.toString().toLowerCase()&&navigator.mozGetUserMedia&&(t.mimeType="audio/ogg")}var r,a=[];function o(){i.timestamps.push((new Date).getTime()),"function"==typeof t.onTimeStamp&&t.onTimeStamp(i.timestamps[i.timestamps.length-1],i.timestamps)}function n(e){return r&&r.mimeType?r.mimeType:e.mimeType||"video/webm"}function l(){a=[],r=null,i.timestamps=[]}this.getArrayOfBlobs=function(){return a},this.record=function(){i.blob=null,i.clearRecordedData(),i.timestamps=[],d=[],a=[];var s=t;t.disableLogs||console.log("Passing following config over MediaRecorder API.",s),r&&(r=null),f&&!w()&&(s="video/vp8"),"function"==typeof MediaRecorder.isTypeSupported&&s.mimeType&&(MediaRecorder.isTypeSupported(s.mimeType)||(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",s.mimeType),s.mimeType="audio"===t.type?"audio/webm":"video/webm"));try{r=new MediaRecorder(e,s),t.mimeType=s.mimeType}catch(t){r=new MediaRecorder(e)}s.mimeType&&!MediaRecorder.isTypeSupported&&"canRecordMimeType"in r&&!1===r.canRecordMimeType(s.mimeType)&&(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",s.mimeType)),r.ondataavailable=function(e){if(e.data&&d.push("ondataavailable: "+y(e.data.size)),"number"!=typeof t.timeSlice)!e.data||!e.data.size||e.data.size<100||i.blob?i.recordingCallback&&(i.recordingCallback(new Blob([],{type:n(s)})),i.recordingCallback=null):(i.blob=t.getNativeBlob?e.data:new Blob([e.data],{type:n(s)}),i.recordingCallback&&(i.recordingCallback(i.blob),i.recordingCallback=null));else if(e.data&&e.data.size&&(a.push(e.data),o(),"function"==typeof t.ondataavailable)){var r=t.getNativeBlob?e.data:new Blob([e.data],{type:n(s)});t.ondataavailable(r)}},r.onstart=function(){d.push("started")},r.onpause=function(){d.push("paused")},r.onresume=function(){d.push("resumed")},r.onstop=function(){d.push("stopped")},r.onerror=function(e){e&&(e.name||(e.name="UnknownError"),d.push("error: "+e),t.disableLogs||(-1!==e.name.toString().toLowerCase().indexOf("invalidstate")?console.error("The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.",e):-1!==e.name.toString().toLowerCase().indexOf("notsupported")?console.error("MIME type (",s.mimeType,") is not supported.",e):-1!==e.name.toString().toLowerCase().indexOf("security")?console.error("MediaRecorder security error",e):"OutOfMemory"===e.name?console.error("The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"IllegalStreamModification"===e.name?console.error("A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"OtherRecordingError"===e.name?console.error("Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"GenericError"===e.name?console.error("The UA cannot provide the codec or recording option that has been requested.",e):console.error("MediaRecorder Error",e)),function(e){if(!i.manuallyStopped&&r&&"inactive"===r.state)return delete t.timeslice,void r.start(6e5);setTimeout(void 0,1e3)}(),"inactive"!==r.state&&"stopped"!==r.state&&r.stop())},"number"==typeof t.timeSlice?(o(),r.start(t.timeSlice)):r.start(36e5),t.initCallback&&t.initCallback()},this.timestamps=[],this.stop=function(e){e=e||function(){},i.manuallyStopped=!0,r&&(this.recordingCallback=e,"recording"===r.state&&r.stop(),"number"==typeof t.timeSlice&&setTimeout((function(){i.blob=new Blob(a,{type:n(t)}),i.recordingCallback(i.blob)}),100))},this.pause=function(){r&&"recording"===r.state&&r.pause()},this.resume=function(){r&&"paused"===r.state&&r.resume()},this.clearRecordedData=function(){r&&"recording"===r.state&&i.stop(l),l()},this.getInternalRecorder=function(){return r},this.blob=null,this.getState=function(){return r&&r.state||"inactive"};var d=[];this.getAllStates=function(){return d},void 0===t.checkForInactiveTracks&&(t.checkForInactiveTracks=!1);i=this;!function s(){if(r&&!1!==t.checkForInactiveTracks)return!1===function(){if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}()?(t.disableLogs||console.log("MediaStream seems stopped."),void i.stop()):void setTimeout(s,1e3)}(),this.name="MediaStreamRecorder",this.toString=function(){return this.name}}function T(e,i){if(!v(e,"audio").length)throw"Your stream has no audio tracks.";var s,r=this,a=[],o=[],n=!1,l=0,d=2,c=(i=i||{}).desiredSampRate;function u(){if(!1===i.checkForInactiveTracks)return!0;if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}function p(e,t){function i(e,t){var i,s=e.numberOfAudioChannels,r=e.leftBuffers.slice(0),a=e.rightBuffers.slice(0),o=e.sampleRate,n=e.internalInterleavedLength,l=e.desiredSampRate;function d(e,t,i){var s=Math.round(e.length*(t/i)),r=[],a=Number((e.length-1)/(s-1));r[0]=e[0];for(var o=1;o96e3)&&(i.disableLogs||console.log("sample-rate must be under range 22050 and 96000.")),i.disableLogs||i.desiredSampRate&&console.log("Desired sample-rate: "+i.desiredSampRate);var b=!1;function _(){a=[],o=[],l=0,w=!1,n=!1,b=!1,f=null,r.leftchannel=a,r.rightchannel=o,r.numberOfAudioChannels=d,r.desiredSampRate=c,r.sampleRate=A,r.recordingLength=l,E={left:[],right:[],recordingLength:0}}function S(){s&&(s.onaudioprocess=null,s.disconnect(),s=null),m&&(m.disconnect(),m=null),_()}this.pause=function(){b=!0},this.resume=function(){if(!1===u())throw"Please make sure MediaStream is active.";if(!n)return i.disableLogs||console.log("Seems recording has been restarted."),void this.record();b=!1},this.clearRecordedData=function(){i.checkForInactiveTracks=!1,n&&this.stop(S),S()},this.name="StereoAudioRecorder",this.toString=function(){return this.name};var w=!1;s.onaudioprocess=function(e){if(!b)if(!1===u()&&(i.disableLogs||console.log("MediaStream seems stopped."),s.disconnect(),n=!1),n){w||(w=!0,i.onAudioProcessStarted&&i.onAudioProcessStarted(),i.initCallback&&i.initCallback());var t=e.inputBuffer.getChannelData(0),h=new Float32Array(t);if(a.push(h),2===d){var c=e.inputBuffer.getChannelData(1),p=new Float32Array(c);o.push(p)}l+=y,r.recordingLength=l,void 0!==i.timeSlice&&(E.recordingLength+=y,E.left.push(h),2===d&&E.right.push(p))}else m&&(m.disconnect(),m=null)},f.createMediaStreamDestination?s.connect(f.createMediaStreamDestination()):s.connect(f.destination),this.leftchannel=a,this.rightchannel=o,this.numberOfAudioChannels=d,this.desiredSampRate=c,this.sampleRate=A,r.recordingLength=l;var E={left:[],right:[],recordingLength:0};function T(){n&&"function"==typeof i.ondataavailable&&void 0!==i.timeSlice&&(E.left.length?(p({desiredSampRate:c,sampleRate:A,numberOfAudioChannels:d,internalInterleavedLength:E.recordingLength,leftBuffers:E.left,rightBuffers:1===d?[]:E.right},(function(e,t){var s=new Blob([t],{type:"audio/wav"});i.ondataavailable(s),setTimeout(T,i.timeSlice)})),E={left:[],right:[],recordingLength:0}):setTimeout(T,i.timeSlice))}}function k(e,t){if("undefined"==typeof html2canvas)throw"Please link: https://www.webrtc-experiment.com/screenshot.js";(t=t||{}).frameInterval||(t.frameInterval=10);var i=!1;["captureStream","mozCaptureStream","webkitCaptureStream"].forEach((function(e){e in document.createElement("canvas")&&(i=!0)}));var s,r,a,o=!(!window.webkitRTCPeerConnection&&!window.webkitGetUserMedia||!window.chrome),n=50,l=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);if(o&&l&&l[2]&&(n=parseInt(l[2],10)),o&&n<52&&(i=!1),t.useWhammyRecorder&&(i=!1),i)if(t.disableLogs||console.log("Your browser supports both MediRecorder API and canvas.captureStream!"),e instanceof HTMLCanvasElement)s=e;else{if(!(e instanceof CanvasRenderingContext2D))throw"Please pass either HTMLCanvasElement or CanvasRenderingContext2D.";s=e.canvas}else navigator.mozGetUserMedia&&(t.disableLogs||console.error("Canvas recording is NOT supported in Firefox."));this.record=function(){if(a=!0,i&&!t.useWhammyRecorder){var e;"captureStream"in s?e=s.captureStream(25):"mozCaptureStream"in s?e=s.mozCaptureStream(25):"webkitCaptureStream"in s&&(e=s.webkitCaptureStream(25));try{var o=new g;o.addTrack(v(e,"video")[0]),e=o}catch(e){}if(!e)throw"captureStream API are NOT available.";(r=new E(e,{mimeType:t.mimeType||"video/webm"})).record()}else p.frames=[],u=(new Date).getTime(),c();t.initCallback&&t.initCallback()},this.getWebPImages=function(i){if("canvas"===e.nodeName.toLowerCase()){var s=p.frames.length;p.frames.forEach((function(e,i){var r=s-i;t.disableLogs||console.log(r+"/"+s+" frames remaining"),t.onEncodingCallback&&t.onEncodingCallback(r,s);var a=e.image.toDataURL("image/webp",1);p.frames[i].image=a})),t.disableLogs||console.log("Generating WebM"),i()}else i()},this.stop=function(e){a=!1;var s=this;i&&r?r.stop(e):this.getWebPImages((function(){p.compile((function(i){t.disableLogs||console.log("Recording finished!"),s.blob=i,s.blob.forEach&&(s.blob=new Blob([],{type:"video/webm"})),e&&e(s.blob),p.frames=[]}))}))};var d=!1;function h(){p.frames=[],a=!1,d=!1}function c(){if(d)return u=(new Date).getTime(),setTimeout(c,500);if("canvas"===e.nodeName.toLowerCase()){var i=(new Date).getTime()-u;return u=(new Date).getTime(),p.frames.push({image:(s=document.createElement("canvas"),r=s.getContext("2d"),s.width=e.width,s.height=e.height,r.drawImage(e,0,0),s),duration:i}),void(a&&setTimeout(c,t.frameInterval))}var s,r;html2canvas(e,{grabMouse:void 0===t.showMousePointer||t.showMousePointer,onrendered:function(e){var i=(new Date).getTime()-u;if(!i)return setTimeout(c,t.frameInterval);u=(new Date).getTime(),p.frames.push({image:e.toDataURL("image/webp",1),duration:i}),a&&setTimeout(c,t.frameInterval)}})}this.pause=function(){d=!0,r instanceof E&&r.pause()},this.resume=function(){d=!1,r instanceof E?r.resume():a||this.record()},this.clearRecordedData=function(){a&&this.stop(h),h()},this.name="CanvasRecorder",this.toString=function(){return this.name};var u=(new Date).getTime(),p=new x.Video(100)}function C(e,t){function i(e){e=void 0!==e?e:10;var t=(new Date).getTime()-l;return t?a?(l=(new Date).getTime(),setTimeout(i,100)):(l=(new Date).getTime(),n.paused&&n.play(),c.drawImage(n,0,0,h.width,h.height),d.frames.push({duration:t,image:h.toDataURL("image/webp")}),void(r||setTimeout(i,e,e))):setTimeout(i,e,e)}function s(e,t,i,s,r){var a=document.createElement("canvas");a.width=h.width,a.height=h.height;var o=a.getContext("2d"),n=[],l=-1===t,d=t&&t>0&&t<=e.length?t:e.length,c=0,u=0,p=0,f=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),m=i&&i>=0&&i<=1?i:0,g=s&&s>=0&&s<=1?s:0,y=!1;!function(e){var t=-1,i=e.length;!function s(){++t!==i?setTimeout((function(){e.functionToLoop(s,t)}),1):e.callback()}()}({length:d,functionToLoop:function(t,i){var s,r,a,d=function(){!y&&a-s<=a*g||(l&&(y=!0),n.push(e[i])),t()};if(y)d();else{var A=new Image;A.onload=function(){o.drawImage(A,0,0,h.width,h.height);var e=o.getImageData(0,0,h.width,h.height);s=0,r=e.data.length,a=e.data.length/4;for(var t=0;t127)throw"TrackNumber > 127 not supported";return[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map((function(e){return String.fromCharCode(e)})).join("")+e.frame}({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(t)});return t+=e.duration,{data:i,id:163}})))}function i(e){for(var t=[];e>0;)t.push(255&e),e>>=8;return new Uint8Array(t.reverse())}function s(e){var t=[];e=(e.length%8?new Array(9-e.length%8).join("0"):"")+e;for(var i=0;i1?2*a[0].width:a[0].width;var n=1;3!==e&&4!==e||(n=2),5!==e&&6!==e||(n=3),7!==e&&8!==e||(n=4),9!==e&&10!==e||(n=5),r.height=a[0].height*n}else r.width=o.width||360,r.height=o.height||240;t&&t instanceof HTMLVideoElement&&u(t),a.forEach((function(e,t){u(e,t)})),setTimeout(c,o.frameInterval)}}function u(e,t){if(!s){var i=0,r=0,o=e.width,n=e.height;1===t&&(i=e.width),2===t&&(r=e.height),3===t&&(i=e.width,r=e.height),4===t&&(r=2*e.height),5===t&&(i=e.width,r=2*e.height),6===t&&(r=3*e.height),7===t&&(i=e.width,r=3*e.height),void 0!==e.stream.left&&(i=e.stream.left),void 0!==e.stream.top&&(r=e.stream.top),void 0!==e.stream.width&&(o=e.stream.width),void 0!==e.stream.height&&(n=e.stream.height),a.drawImage(e,i,r,o,n),"function"==typeof e.stream.onRender&&e.stream.onRender(a,i,r,o,n,t)}}function p(e){var i=document.createElement("video");return function(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}(e,i),i.className=t,i.muted=!0,i.volume=0,i.width=e.width||o.width||360,i.height=e.height||o.height||240,i.play(),i}function f(t){i=[],(t=t||e).forEach((function(e){if(e.getTracks().filter((function(e){return"video"===e.kind})).length){var t=p(e);t.stream=e,i.push(t)}}))}void 0!==n?h.AudioContext=n:"undefined"!=typeof webkitAudioContext&&(h.AudioContext=webkitAudioContext),this.startDrawingFrames=function(){c()},this.appendStreams=function(t){if(!t)throw"First parameter is required.";t instanceof Array||(t=[t]),t.forEach((function(t){var s=new d;if(t.getTracks().filter((function(e){return"video"===e.kind})).length){var r=p(t);r.stream=t,i.push(r),s.addTrack(t.getTracks().filter((function(e){return"video"===e.kind}))[0])}if(t.getTracks().filter((function(e){return"audio"===e.kind})).length){var a=o.audioContext.createMediaStreamSource(t);o.audioDestination=o.audioContext.createMediaStreamDestination(),a.connect(o.audioDestination),s.addTrack(o.audioDestination.stream.getTracks().filter((function(e){return"audio"===e.kind}))[0])}e.push(s)}))},this.releaseStreams=function(){i=[],s=!0,o.gainNode&&(o.gainNode.disconnect(),o.gainNode=null),o.audioSources.length&&(o.audioSources.forEach((function(e){e.disconnect()})),o.audioSources=[]),o.audioDestination&&(o.audioDestination.disconnect(),o.audioDestination=null),o.audioContext&&o.audioContext.close(),o.audioContext=null,a.clearRect(0,0,r.width,r.height),r.stream&&(r.stream.stop(),r.stream=null)},this.resetVideoStreams=function(e){!e||e instanceof Array||(e=[e]),f(e)},this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=function(){s=!1;var t=function(){var e;f(),"captureStream"in r?e=r.captureStream():"mozCaptureStream"in r?e=r.mozCaptureStream():o.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features");var t=new d;return e.getTracks().filter((function(e){return"video"===e.kind})).forEach((function(e){t.addTrack(e)})),r.stream=t,t}(),i=function(){h.AudioContextConstructor||(h.AudioContextConstructor=new h.AudioContext);o.audioContext=h.AudioContextConstructor,o.audioSources=[],!0===o.useGainNode&&(o.gainNode=o.audioContext.createGain(),o.gainNode.connect(o.audioContext.destination),o.gainNode.gain.value=0);var t=0;if(e.forEach((function(e){if(e.getTracks().filter((function(e){return"audio"===e.kind})).length){t++;var i=o.audioContext.createMediaStreamSource(e);!0===o.useGainNode&&i.connect(o.gainNode),o.audioSources.push(i)}})),!t)return;return o.audioDestination=o.audioContext.createMediaStreamDestination(),o.audioSources.forEach((function(e){e.connect(o.audioDestination)})),o.audioDestination.stream}();return i&&i.getTracks().filter((function(e){return"audio"===e.kind})).forEach((function(e){t.addTrack(e)})),e.forEach((function(e){e.fullcanvas})),t}}function P(e,t){e=e||[];var i,s,r=this;(t=t||{elementClass:"multi-streams-mixer",mimeType:"video/webm",video:{width:360,height:240}}).frameInterval||(t.frameInterval=10),t.video||(t.video={}),t.video.width||(t.video.width=360),t.video.height||(t.video.height=240),this.record=function(){var r;i=new L(e,t.elementClass||"multi-streams-mixer"),(r=[],e.forEach((function(e){v(e,"video").forEach((function(e){r.push(e)}))})),r).length&&(i.frameInterval=t.frameInterval||10,i.width=t.video.width||360,i.height=t.video.height||240,i.startDrawingFrames()),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()),(s=new E(i.getMixedStream(),t)).record()},this.stop=function(e){s&&s.stop((function(t){r.blob=t,e(t),r.clearRecordedData()}))},this.pause=function(){s&&s.pause()},this.resume=function(){s&&s.resume()},this.clearRecordedData=function(){s&&(s.clearRecordedData(),s=null),i&&(i.releaseStreams(),i=null)},this.addStreams=function(r){if(!r)throw"First parameter is required.";r instanceof Array||(r=[r]),e.concat(r),s&&i&&(i.appendStreams(r),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()))},this.resetVideoStreams=function(e){i&&(!e||e instanceof Array||(e=[e]),i.resetVideoStreams(e))},this.getMixer=function(){return i},this.name="MultiStreamRecorder",this.toString=function(){return this.name}}function B(e,t){var i,s,r;function a(){return new ReadableStream({start:function(s){var r=document.createElement("canvas"),a=document.createElement("video"),o=!0;a.srcObject=e,a.muted=!0,a.height=t.height,a.width=t.width,a.volume=0,a.onplaying=function(){r.width=t.width,r.height=t.height;var e=r.getContext("2d"),n=1e3/t.frameRate,l=setInterval((function(){if(i&&(clearInterval(l),s.close()),o&&(o=!1,t.onVideoProcessStarted&&t.onVideoProcessStarted()),e.drawImage(a,0,0),"closed"!==s._controlledReadableStream.state)try{s.enqueue(e.getImageData(0,0,t.width,t.height))}catch(e){}}),n)},a.play()}})}function o(e,l){if(!t.workerPath&&!l)return i=!1,void fetch("https://unpkg.com/webm-wasm@latest/dist/webm-worker.js").then((function(t){t.arrayBuffer().then((function(t){o(e,t)}))}));if(!t.workerPath&&l instanceof ArrayBuffer){var d=new Blob([l],{type:"text/javascript"});t.workerPath=h.createObjectURL(d)}t.workerPath||console.error("workerPath parameter is missing."),(s=new Worker(t.workerPath)).postMessage(t.webAssemblyPath||"https://unpkg.com/webm-wasm@latest/dist/webm-wasm.wasm"),s.addEventListener("message",(function(e){"READY"===e.data?(s.postMessage({width:t.width,height:t.height,bitrate:t.bitrate||1200,timebaseDen:t.frameRate||30,realtime:t.realtime}),a().pipeTo(new WritableStream({write:function(e){i?console.error("Got image, but recorder is finished!"):s.postMessage(e.data.buffer,[e.data.buffer])}}))):e.data&&(r||n.push(e.data))}))}"undefined"!=typeof ReadableStream&&"undefined"!=typeof WritableStream||console.error("Following polyfill is strongly recommended: https://unpkg.com/@mattiasbuelens/web-streams-polyfill/dist/polyfill.min.js"),(t=t||{}).width=t.width||640,t.height=t.height||480,t.frameRate=t.frameRate||30,t.bitrate=t.bitrate||1200,t.realtime=t.realtime||!0,this.record=function(){n=[],r=!1,this.blob=null,o(e),"function"==typeof t.initCallback&&t.initCallback()},this.pause=function(){r=!0},this.resume=function(){r=!1};var n=[];this.stop=function(e){i=!0;var t=this;!function(e){s?(s.addEventListener("message",(function(t){null===t.data&&(s.terminate(),s=null,e&&e())})),s.postMessage(null)):e&&e()}((function(){t.blob=new Blob(n,{type:"video/webm"}),e(t.blob)}))},this.name="WebAssemblyRecorder",this.toString=function(){return this.name},this.clearRecordedData=function(){n=[],r=!1,this.blob=null},this.blob=null}t.DiskStorage=R,t.GifRecorder=D,t.MultiStreamRecorder=P,t.RecordRTCPromisesHandler=function(e,i){if(!this)throw'Use "new RecordRTCPromisesHandler()"';if(void 0===e)throw'First argument "MediaStream" is required.';var s=this;s.recordRTC=new t(e,i),this.startRecording=function(){return new Promise((function(e,t){try{s.recordRTC.startRecording(),e()}catch(e){t(e)}}))},this.stopRecording=function(){return new Promise((function(e,t){try{s.recordRTC.stopRecording((function(i){s.blob=s.recordRTC.getBlob(),s.blob&&s.blob.size?e(i):t("Empty blob.",s.blob)}))}catch(e){t(e)}}))},this.pauseRecording=function(){return new Promise((function(e,t){try{s.recordRTC.pauseRecording(),e()}catch(e){t(e)}}))},this.resumeRecording=function(){return new Promise((function(e,t){try{s.recordRTC.resumeRecording(),e()}catch(e){t(e)}}))},this.getDataURL=function(e){return new Promise((function(e,t){try{s.recordRTC.getDataURL((function(t){e(t)}))}catch(e){t(e)}}))},this.getBlob=function(){return new Promise((function(e,t){try{e(s.recordRTC.getBlob())}catch(e){t(e)}}))},this.getInternalRecorder=function(){return new Promise((function(e,t){try{e(s.recordRTC.getInternalRecorder())}catch(e){t(e)}}))},this.reset=function(){return new Promise((function(e,t){try{e(s.recordRTC.reset())}catch(e){t(e)}}))},this.destroy=function(){return new Promise((function(e,t){try{e(s.recordRTC.destroy())}catch(e){t(e)}}))},this.getState=function(){return new Promise((function(e,t){try{e(s.recordRTC.getState())}catch(e){t(e)}}))},this.blob=null,this.version="5.6.2"},t.WebAssemblyRecorder=B}));class Sn{static _ebsp2rbsp(e){let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)}static parseSPS(e){let t=Sn._ebsp2rbsp(e),i=new Ur(t);i.readByte();let s=i.readByte();i.readByte();let r=i.readByte();i.readUEG();let a=Sn.getProfileString(s),o=Sn.getLevelString(r),n=1,l=420,d=[0,420,422,444],h=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(n=i.readUEG(),3===n&&i.readBits(1),n<=3&&(l=d[n]),h=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool())){let e=3!==n?8:12;for(let t=0;t0&&e<16?(v=t[e-1],_=s[e-1]):255===e&&(v=i.readByte()<<8|i.readByte(),_=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){let e=i.readBits(32),t=i.readBits(32);w=i.readBool(),E=t,T=2*e,S=E/T}}let k=1;1===v&&1===_||(k=v/_);let C=0,x=0;if(0===n)C=1,x=2-m;else{C=3===n?1:2,x=(1===n?2:1)*(2-m)}let R=16*(p+1),D=16*(f+1)*(2-m);R-=(g+y)*C,D-=(A+b)*x;let L=Math.ceil(R*k);return i.destroy(),i=null,{profile_string:a,level_string:o,bit_depth:h,ref_frames:u,chroma_format:l,chroma_format_string:Sn.getChromaFormatString(l),frame_rate:{fixed:w,fps:S,fps_den:T,fps_num:E},sar_ratio:{width:v,height:_},codec_size:{width:R,height:D},present_size:{width:L,height:D}}}static parseSPS$2(e){let t=e.subarray(1,4),i="avc1.";for(let e=0;e<3;e++){let s=t[e].toString(16);s.length<2&&(s="0"+s),i+=s}let s=Sn._ebsp2rbsp(e),r=new Ur(s);r.readByte();let a=r.readByte();r.readByte();let o=r.readByte();r.readUEG();let n=Sn.getProfileString(a),l=Sn.getLevelString(o),d=1,h=420,c=[0,420,422,444],u=8,p=8;if((100===a||110===a||122===a||244===a||44===a||83===a||86===a||118===a||128===a||138===a||144===a)&&(d=r.readUEG(),3===d&&r.readBits(1),d<=3&&(h=c[d]),u=r.readUEG()+8,p=r.readUEG()+8,r.readBits(1),r.readBool())){let e=3!==d?8:12;for(let t=0;t0&&e<16?(w=t[e-1],E=i[e-1]):255===e&&(w=r.readByte()<<8|r.readByte(),E=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);k=r.readBool(),C=t,x=2*e,T=C/x}}let R=1;1===w&&1===E||(R=w/E);let D=0,L=0;if(0===d)D=1,L=2-A;else{D=3===d?1:2,L=(1===d?2:1)*(2-A)}let P=16*(g+1),B=16*(y+1)*(2-A);P-=(b+v)*D,B-=(_+S)*L;let I=Math.ceil(P*R);return r.destroy(),r=null,{codec_mimetype:i,profile_idc:a,level_idc:o,profile_string:n,level_string:l,chroma_format_idc:d,bit_depth:u,bit_depth_luma:u,bit_depth_chroma:p,ref_frames:m,chroma_format:h,chroma_format_string:Sn.getChromaFormatString(h),frame_rate:{fixed:k,fps:T,fps_den:x,fps_num:C},sar_ratio:{width:w,height:E},codec_size:{width:P,height:B},present_size:{width:I,height:B}}}static _skipScalingList(e,t){let i=8,s=8,r=0;for(let a=0;a=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=this.bufoff+e>8?8-this.bufoff:e,t<<=i,t+=this.buffer[this.bufpos]>>8-this.bufoff-i&255>>8-i,this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,i=this.bufoff,s=this.read(e);return this.bufpos=t,this.bufoff=i,s}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),s=new Uint8Array(e+4);s.set(i,0),s.set(t.sps,4),t.sps=s}if(t.pps){const e=t.pps.byteLength,i=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),s=new Uint8Array(e+4);s.set(i,0),s.set(t.pps,4),t.pps=s}return t}function Tn(e){let{sps:t,pps:i}=e,s=8+t.byteLength+1+2+i.byteLength,r=!1;const a=Sn.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(r=!0,s+=4);let o=new Uint8Array(s);o[0]=1,o[1]=t[1],o[2]=t[2],o[3]=t[3],o[4]=255,o[5]=225;let n=t.byteLength;o[6]=n>>>8,o[7]=255&n;let l=8;o.set(t,8),l+=n,o[l]=1;let d=i.byteLength;o[l+1]=d>>>8,o[l+2]=255&d,o.set(i,l+3),l+=3+d,r&&(o[l]=252|a.chroma_format_idc,o[l+1]=248|a.bit_depth_luma-8,o[l+2]=248|a.bit_depth_chroma-8,o[l+3]=0,l+=4);const h=[23,0,0,0,0],c=new Uint8Array(h.length+o.byteLength);return c.set(h,0),c.set(o,h.length),c}function kn(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}function Cn(e){return 31&e[0]}function xn(e){return e===Bt}function Rn(e){return!function(e){return e===xt||e===Rt}(e)&&!xn(e)}function Dn(e){return e===Dt}class Ln{constructor(e){this.data=e,this.eofFlag=!1,this.currentStartcodeOffset=this.findNextStartCodeOffset(0),this.eofFlag&&console.error("Could not find H264 startcode until payload end!")}findNextStartCodeOffset(e){let t=e,i=this.data;for(;;){if(t+3>=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],s=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===s)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let s=31&e[i],r=(128&e[i])>>>7,a=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=a,s>=Ut||0===r&&(t={type:s,data:e.subarray(i,a)})}return t}}class Pn{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Bn=e=>{let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)},In=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Mn{static _ebsp2rbsp(e){let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)}static parseVPS(e){let t=Mn._ebsp2rbsp(e),i=new Ur(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}}static parseSPS(e){let t=Mn._ebsp2rbsp(e),i=new Ur(t);i.readByte(),i.readByte();let s=0,r=0,a=0,o=0;i.readBits(4);let n=i.readBits(3);i.readBool();let l=i.readBits(2),d=i.readBool(),h=i.readBits(5),c=i.readByte(),u=i.readByte(),p=i.readByte(),f=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),A=i.readByte(),b=i.readByte(),v=i.readByte(),_=i.readByte(),S=[],w=[];for(let e=0;e0)for(let e=n;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<=16?(I=t[e-1],M=s[e-1]):255===e&&(I=i.readBits(16),M=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()){i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())}if(i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),P=i.readBool(),P&&(i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG()),i.readBool()){if(F=i.readBits(32),O=i.readBits(32),i.readBool()&&i.readUEG(),i.readBool()){let e=!1,t=!1,s=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(s=i.readBool(),s&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),s&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let r=0;r<=n;r++){let r=i.readBool();U=r;let a=!0,o=1;r||(a=i.readBool());let n=!1;if(a?i.readUEG():n=i.readBool(),n||(o=i.readUEG()+1),e){for(let e=0;e>6&3,i.general_tier_flag=e[1]>>5&1,i.general_profile_idc=31&e[1],i.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],i.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],i.general_constraint_indicator_flags=i.general_constraint_indicator_flags<<16|e[10]<<8|e[11],i.general_level_idc=e[12],i.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],i.parallelismType=3&e[15],i.chromaFormat=3&e[16],i.bitDepthLumaMinus8=7&e[17],i.bitDepthChromaMinus8=7&e[18],i.avgFrameRate=e[19]<<8|e[20],i.constantFrameRate=e[21]>>6&3,i.numTemporalLayers=e[21]>>3&7,i.temporalIdNested=e[21]>>2&1,i.lengthSizeMinusOne=3&e[21];let s=e[22],r=e.slice(23);for(let e=0;e0)for(let t=i;t<8;t++)e.read(2);s.sub_layer_profile_space=[],s.sub_layer_tier_flag=[],s.sub_layer_profile_idc=[],s.sub_layer_profile_compatibility_flag=[],s.sub_layer_progressive_source_flag=[],s.sub_layer_interlaced_source_flag=[],s.sub_layer_non_packed_constraint_flag=[],s.sub_layer_frame_only_constraint_flag=[],s.sub_layer_level_idc=[];for(let t=0;t{let t=Bn(e),i=new Ur(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}})(t),o=(e=>{let t=Bn(e),i=new Ur(t);i.readByte(),i.readByte();let s=0,r=0,a=0,o=0;i.readBits(4);let n=i.readBits(3);i.readBool();let l=i.readBits(2),d=i.readBool(),h=i.readBits(5),c=i.readByte(),u=i.readByte(),p=i.readByte(),f=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),A=i.readByte(),b=i.readByte(),v=i.readByte(),_=i.readByte(),S=[],w=[];for(let e=0;e0)for(let e=n;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<16?(I=t[e-1],M=s[e-1]):255===e&&(I=i.readBits(16),M=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),P=i.readBool(),P&&(s+=i.readUEG(),r+=i.readUEG(),a+=i.readUEG(),o+=i.readUEG()),i.readBool()&&(F=i.readBits(32),O=i.readBits(32),i.readBool()&&(i.readUEG(),i.readBool()))){let e=!1,t=!1,s=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(s=i.readBool(),s&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),s&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let r=0;r<=n;r++){let r=i.readBool();U=r;let a=!1,o=1;r||(a=i.readBool());let n=!1;if(a?i.readSEG():n=i.readBool(),n||(cpbcnt=i.readUEG()+1),e)for(let e=0;e{let t=Bn(e),i=new Ur(t);i.readByte(),i.readByte(),i.readUEG(),i.readUEG(),i.readBool(),i.readBool(),i.readBits(3),i.readBool(),i.readBool(),i.readUEG(),i.readUEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool()&&i.readUEG(),i.readSEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool(),i.readBool();let s=i.readBool(),r=i.readBool(),a=1;return r&&s?a=0:r?a=3:s&&(a=2),{parallelismType:a}})(i);r=Object.assign(r,a,o,n);let l=23+(5+t.byteLength)+(5+s.byteLength)+(5+i.byteLength),d=new Uint8Array(l);d[0]=1,d[1]=(3&r.general_profile_space)<<6|(r.general_tier_flag?1:0)<<5|31&r.general_profile_idc,d[2]=r.general_profile_compatibility_flags_1||0,d[3]=r.general_profile_compatibility_flags_2||0,d[4]=r.general_profile_compatibility_flags_3||0,d[5]=r.general_profile_compatibility_flags_4||0,d[6]=r.general_constraint_indicator_flags_1||0,d[7]=r.general_constraint_indicator_flags_2||0,d[8]=r.general_constraint_indicator_flags_3||0,d[9]=r.general_constraint_indicator_flags_4||0,d[10]=r.general_constraint_indicator_flags_5||0,d[11]=r.general_constraint_indicator_flags_6||0,d[12]=60,d[13]=240|(3840&r.min_spatial_segmentation_idc)>>8,d[14]=255&r.min_spatial_segmentation_idc,d[15]=252|3&r.parallelismType,d[16]=252|3&r.chroma_format_idc,d[17]=248|7&r.bit_depth_luma_minus8,d[18]=248|7&r.bit_depth_chroma_minus8,d[19]=0,d[20]=0,d[21]=(3&r.constant_frame_rate)<<6|(7&r.num_temporal_layers)<<3|(r.temporal_id_nested?1:0)<<2|3,d[22]=3,d[23]=128|jt,d[24]=0,d[25]=1,d[26]=(65280&t.byteLength)>>8,d[27]=(255&t.byteLength)>>0,d.set(t,28),d[23+(5+t.byteLength)+0]=128|Gt,d[23+(5+t.byteLength)+1]=0,d[23+(5+t.byteLength)+2]=1,d[23+(5+t.byteLength)+3]=(65280&s.byteLength)>>8,d[23+(5+t.byteLength)+4]=(255&s.byteLength)>>0,d.set(s,23+(5+t.byteLength)+5),d[23+(5+t.byteLength+5+s.byteLength)+0]=128|Vt,d[23+(5+t.byteLength+5+s.byteLength)+1]=0,d[23+(5+t.byteLength+5+s.byteLength)+2]=1,d[23+(5+t.byteLength+5+s.byteLength)+3]=(65280&i.byteLength)>>8,d[23+(5+t.byteLength+5+s.byteLength)+4]=(255&i.byteLength)>>0,d.set(i,23+(5+t.byteLength+5+s.byteLength)+5);const h=[28,0,0,0,0],c=new Uint8Array(h.length+d.byteLength);return c.set(h,0),c.set(d,h.length),c}function jn(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}function zn(e){return(126&e[0])>>1}function Gn(e){return!function(e){return e>=32&&e<=40}(e)}function Hn(e){return e>=16&&e<=21}class Vn{constructor(e){this.data=e,this.eofFlag=!1,this.currentStartcodeOffset=this.findNextStartCodeOffset(0),this.eofFlag&&console.error("Could not find H265 startcode until payload end!")}findNextStartCodeOffset(e){let t=e,i=this.data;for(;;){if(t+3>=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],s=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===s)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let s=e[i]>>1&63,r=(128&e[i])>>>7,a=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=a,0===r&&(t={type:s,data:e.subarray(i,a)})}return t}}class $n{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}class Wn extends So{constructor(e){super(),this.TAG_NAME="recorderCommon",this.player=e,this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.recordingInterval=null,this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.audioCodeId=null,this.metaInfo={codecWidth:0,codecHeight:0,presentWidth:0,presentHeight:0,refSampleDuration:0,timescale:1e3,avcc:null,videoType:""},this.audioMetaInfo={timescale:1e3,sampleRate:0,refSampleDuration:0,channelCount:0,codec:"",originalCodec:"",audioType:"",extraData:new Uint8Array(0)}}destroy(){this._reset(),this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.audioCodeId=null,this.metaInfo=null,this.audioMetaInfo=null}get isH264(){return this.codecId===vt}get isH265(){return this.codecId===_t}setFileName(e){this.fileName=e}get isRecording(){return this._isRecording}get recording(){return this._isRecording}get recordTime(){return this._recordingTimestamp}startRecord(){}handleAddNaluTrack(e,t,i,s){}handleAddAudioTrack(e,t){}handleAddTrack(e){}stopRecordAndSave(){}startRecordingInterval(){}isWasmMp4(){return!1}stopRecordingInterval(){this.recordingInterval&&clearInterval(this.recordingInterval),this.recordingInterval=null}getToTalByteLength(){return 0}_reset(){this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.stopRecordingInterval()}initMetaData(e,t){let i;const s=e.slice(5);if(this.codecId=t,this.metaInfo.avcc=s,t===vt)i=En(s);else if(t===_t){i=function(e){let t=23;const i=e[t];if((63&i)!==jt)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and vpsTag is ${i}`),{};t+=2,t+=1;const s=e[t+1]|e[t]<<8;t+=2;const r=e.slice(t,t+s);t+=s;const a=e[t];if((63&a)!==Gt)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and sps tag is ${a}`),{};t+=2,t+=1;const o=e[t+1]|e[t]<<8;t+=2;const n=e.slice(t,t+o);t+=o;const l=e[t];if((63&l)!==Vt)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and pps tag is ${l}`),{};t+=2,t+=1;const d=e[t+1]|e[t]<<8;t+=2;const h=e.slice(t,t+d),c=new Uint8Array([o>>>24&255,o>>>16&255,o>>>8&255,255&o]),u=new Uint8Array([d>>>24&255,d>>>16&255,d>>>8&255,255&d]),p=new Uint8Array([s>>>24&255,s>>>16&255,s>>>8&255,255&s]),f=new Uint8Array(o+4);f.set(c,0),f.set(n,4);const m=new Uint8Array(d+4);m.set(u,0),m.set(h,4);const g=new Uint8Array(s+4);return g.set(p,0),g.set(r,4),{sps:f,pps:m,vps:g}}(s);const t=Un(e);i=Object.assign(i,t)}i&&(i.vps&&(this.vps=i.vps),i.pps&&(this.pps=i.pps),i.sps&&(this.sps=i.sps),i.presentWidth&&(this.metaInfo.presentWidth=i.presentWidth),i.presentHeight&&(this.metaInfo.presentHeight=i.presentHeight),i.codecWidth&&(this.metaInfo.codecWidth=i.codecWidth),i.codecHeight&&(this.metaInfo.codecHeight=i.codecHeight),i.timescale&&(this.metaInfo.timescale=i.timescale),i.refSampleDuration&&(this.metaInfo.refSampleDuration=i.refSampleDuration),i.videoType&&(this.metaInfo.videoType=i.videoType))}initAudioMetaData(e,t){this.audioCodeId=t;const i=e[0]>>1&1;let s=null;t===Et?(s=function(e){let t={},i=new Wr(e);return i.read(16),t.object_type=Jr(i),t.sample_rate=qr(i,t),t.chan_config=i.read(4),t.chan_config{r.onload=function(e){i.decode(this.result).forEach((function(e){t.read(e)})),t.stop();const r=s.makeMetadataSeekable(t.metadatas,t.duration,t.cues),o=this.result.slice(t.metadataSize),n=new Blob([r,o],{type:"video/webm"});a(n)},r.readAsArrayBuffer(e)}))}startRecord(){const e=this.player.debug,t={type:"video",mimeType:"video/webm;codecs=h264",timeSlice:1e3,onTimeStamp:t=>{e.log("RecorderRTC","record timestamp :"+t),null===this._startRecordingTimestamp&&(this._startRecordingTimestamp=t),this._recordingTimestamp=(t-this._startRecordingTimestamp)/1e3},ondataavailable:t=>{this.totalByteLength+=t.size,e.log("RecorderRTC","ondataavailable",t.size)},disableLogs:!this.player._opt.debug};try{let i=null;if(this.player.getRenderType()===$?i=this.player.video.$videoElement.captureStream(25):this.player.video.mediaStream?i=this.player.video.mediaStream:this.player.isOldHls()||this.player._opt.useMSE||this.player._opt.useWCS?i=this.player.video.$videoElement.captureStream(25):this.player.isWebrtcH264()?i=this.player.webrtc.videoStream:this.player.isAliyunRtc()&&(i=this.player.video.$videoElement.captureStream(25)),!i)return e.error("RecorderRTC","startRecord error and can not create stream"),void this.player.emitError(nt.recordCreateError,"can not create stream");if(this.player.audio&&this.player.audio.mediaStreamAudioDestinationNode&&this.player.audio.mediaStreamAudioDestinationNode.stream&&!this.player.audio.isStateSuspended()&&this.player.audio.hasAudio&&this.player._opt.hasAudio){const e=this.player.audio.mediaStreamAudioDestinationNode.stream;if(e.getAudioTracks().length>0){const t=e.getAudioTracks()[0];t&&t.enabled&&i.addTrack(t)}}this.recorder=_n(i,t)}catch(t){return e.error("RecorderRTC","startRecord error",t),void this.player.emitError(nt.recordCreateError,t)}this.recorder&&(this._isRecording=!0,this.player.emit(nt.recording,!0),this.recorder.startRecording(),e.log("RecorderRTC","start recording"),this.player.emit(nt.recordStart),this.startRecordingInterval())}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(nt.recordingTimestamp,this._recordingTimestamp)}),1e3)}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{this.recorder&&this._isRecording||s("recorder is not ready"),t&&this.setFileName(t),this.recorder.stopRecording((()=>{this.player.debug.log("RecorderRTC","stop recording");const t=(this.fileName||aa())+"."+w;if(this.recorder.getBlob(),e===At){const e=this.recorder.getBlob();i(e),this.player.emit(nt.recordBlob,e)}else i(),this.recorder.save(t);this.player.emit(nt.recordEnd),this._reset(),this.player.emit(nt.recording,!1)}))}))}getToTalByteLength(){return this.totalByteLength}getTotalDuration(){return this.recordTime}getType(){return w}initMetaData(){}}class qn{static init(){qn.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],free:[],edts:[],elst:[],stss:[]};for(let e in qn.types)qn.types.hasOwnProperty(e)&&(qn.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=qn.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,97,118,99,49,109,112,52,49,0,0,0,0]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=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]),e.HDLR_AUDIO=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]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,s=Array.prototype.slice.call(arguments,1),r=s.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let a=8;for(let e=0;e=Math.pow(2,32)-1?(a=16,o=new Uint8Array(i+a),o.set(new Uint8Array([0,0,0,1]),0),o.set(qn.types.mdat,4),o.set(new Uint8Array([i+8>>>56&255,i+8>>>48&255,i+8>>>40&255,i+8>>>32&255,i+8>>>24&255,i+8>>>16&255,i+8>>>8&255,i+8&255]),8)):(o=new Uint8Array(i+a),o[0]=i+8>>>24&255,o[1]=i+8>>>16&255,o[2]=i+8>>>8&255,o[3]=i+8&255,o.set(qn.types.mdat,4));for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,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,0,0,0,3]))}static trak(e){return qn.box(qn.types.trak,qn.tkhd(e),qn.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,s=e.presentWidth,r=e.presentHeight;return qn.box(qn.types.tkhd,new Uint8Array([0,0,0,15,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,r>>>8&255,255&r,0,0]))}static edts(e,t){return qn.box(qn.types.edts,qn.elst(e,t))}static elst(e,t){let i=0;for(let s=0;s>>24&255,i>>>16&255,i>>>8&255,255&i,255,255,255,255,0,1,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,0,0,0,0,0,1,0,0]))}static mdia(e){return qn.box(qn.types.mdia,qn.mdhd(e),qn.hdlr(e),qn.minf(e))}static mdhd(e){let t=e.timescale/e.refSampleDuration,i=t*e.duration/e.timescale;return qn.box(qn.types.mdhd,new Uint8Array([0,0,0,0,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t=qn.constants.HDLR_VIDEO,qn.box(qn.types.hdlr,t)}static minf(e){let t=null;return t=qn.box(qn.types.vmhd,qn.constants.VMHD),qn.box(qn.types.minf,t,qn.dinf(),qn.stbl(e))}static dinf(){return qn.box(qn.types.dinf,qn.box(qn.types.dref,qn.constants.DREF))}static stbl(e){let t=e.samples,i=[{No:1,num:0,sampleDelte:1,chunkNo:1,duration:t[0].duration}],s=[t[0].duration],r=t.length;for(let e=0;e>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+8*t);r.set(i,0);for(let i=0;i>>24&255,e[i].num>>>16&255,e[i].num>>>8&255,255&e[i].num,e[i].sampleDelte>>>24&255,e[i].sampleDelte>>>16&255,e[i].sampleDelte>>>8&255,255&e[i].sampleDelte]),s),s+=8;return qn.box(qn.types.stts,r)}static stss(e){let t=[],i=e.length;for(let s=0;s>>24&255,s>>>16&255,s>>>8&255,255&s]),a=r.byteLength,o=new Uint8Array(a+4*s);o.set(r,0);for(let e=0;e>>24&255,t[e]>>>16&255,t[e]>>>8&255,255&t[e]]),a),a+=4;return qn.box(qn.types.stss,o)}static stsc(e){let t=e.length,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+12*t);r.set(i,0);for(let i=0;i>>24&255,t>>>16&255,t>>>8&255,255&t,a>>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o]),s),s+=12}return qn.box(qn.types.stsc,r)}static stsz(e){let t=e.length,i=new Uint8Array([0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+4*t);r.set(i,0);for(let i=0;i>>24&255,t>>>16&255,t>>>8&255,255&t]),s),s+=4}return qn.box(qn.types.stsz,r)}static stco(e,t){let i=t[0].chunkOffset;return qn.box(qn.types.stco,new Uint8Array([0,0,0,0,0,0,0,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i]))}static stsd(e){return"audio"===e.type?"mp3"===e.codec?qn.box(qn.types.stsd,qn.constants.STSD_PREFIX,qn.mp3(e)):qn.box(qn.types.stsd,qn.constants.STSD_PREFIX,qn.mp4a(e)):"avc"===e.videoType?qn.box(qn.types.stsd,qn.constants.STSD_PREFIX,qn.avc1(e)):qn.box(qn.types.stsd,qn.constants.STSD_PREFIX,qn.hvc1(e))}static mp3(e){let t=e.channelCount,i=e.sampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return qn.box(qn.types[".mp3"],s)}static mp4a(e){let t=e.channelCount,i=e.sampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return qn.box(qn.types.mp4a,s,qn.esds(e))}static esds(e){let t=e.config||[],i=t.length,s=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return qn.box(qn.types.esds,s)}static avc1(e){let t=e.avcc,i=e.codecWidth,s=e.codecHeight,r=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,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return qn.box(qn.types.avc1,r,qn.box(qn.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=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,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return qn.box(qn.types.hvc1,r,qn.box(qn.types.hvcC,t))}static mvex(e){return qn.box(qn.types.mvex,qn.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return qn.box(qn.types.trex,i)}static moof(e,t){return qn.box(qn.types.moof,qn.mfhd(e.sequenceNumber),qn.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return qn.box(qn.types.mfhd,t)}static traf(e,t){let i=e.id,s=qn.box(qn.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),r=qn.box(qn.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),a=qn.sdtp(e),o=qn.trun(e,a.byteLength+16+16+8+16+8+8);return qn.box(qn.types.traf,s,r,o,a)}static sdtp(e){let t=e.samples||[],i=t.length,s=new Uint8Array(4+i);for(let e=0;e>>24&255,s>>>16&255,s>>>8&255,255&s,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);for(let e=0;e>>24&255,t>>>16&255,t>>>8&255,255&t,s>>>24&255,s>>>16&255,s>>>8&255,255&s,r.isLeading<<2|r.dependsOn,r.isDependedOn<<6|r.hasRedundancy<<4|r.isNonSync,0,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o],12+16*e)}return qn.box(qn.types.trun,a)}static mdat(e){return qn.box(qn.types.mdat,e)}}qn.init();class Kn extends Wn{constructor(e){super(e),this.TAG_NAME="recorderMP4",this._reset(),e.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this._reset(),this.player.debug.log(this.TAG_NAME,"destroy")}_reset(){super._reset(),this.totalDuration=0,this.totalAudioDuration=0,this.totalByteLength=0,this.totalAudioByteLength=0,this.bufferList=[],this.audioBufferList=[],this.cacheTrack={},this.audioCacheTrack={},this.sequenceNumber=0,this.audioSequenceNumber=0}startRecord(){const e=this.player.debug;this._isRecording=!0,this.player.emit(nt.recording,!0),e.log(this.TAG_NAME,"start recording"),this.player.emit(nt.recordStart),this.startRecordingInterval()}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(nt.recordingTimestamp,this.getTotalDuration())}),1e3)}formatFmp4Track(e,t,i,s){return{id:1,sequenceNumber:++this.sequenceNumber,size:e.byteLength,dts:i,cts:s,isKeyframe:t,data:e,duration:0,flags:{isLeading:0,dependsOn:t?2:1,isDependedOn:t?1:0,hasRedundancy:0,isNonSync:t?0:1}}}formatAudioFmp4Track(e,t){return{id:2,sequenceNumber:++this.audioSequenceNumber,size:e.byteLength,dts:t,pts:t,cts:0,data:new Uint8Array(e),duration:0,originalDts:t,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}}handleAddNaluTrack(e,t,i,s){this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.handleAddFmp4Track(this.cacheTrack)):this.cacheTrack={},this.cacheTrack=this.formatFmp4Track(e,t,i,s)}handleAddAudioTrack(e,t){}handleAddFmp4Track(e){if(!this.isRecording)return void this.player.debug.error(this.TAG_NAME,"handleAddFmp4Track, isRecording is false ");if((null===this.sps||null===this.pps)&&this.isH264)return void this.player.debug.error(this.TAG_NAME,"handleAddFmp4Track, is h264 and this.sps or this.pps is null ");if((null===this.sps||null===this.pps||null===this.vps)&&this.isH265)return void this.player.debug.error(this.TAG_NAME,"handleAddFmp4Track, is h265 and this.sps or this.pps or this.vps is null ");const t=Object.assign({},e);t.pts=t.dts+t.cts;const i=t.data;if(t.isKeyframe)if(this.isH264){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength);e.set(this.sps,0),e.set(this.pps,this.sps.byteLength);const s=new Uint8Array(e.byteLength+i.byteLength);s.set(e,0),s.set(i,e.byteLength),t.data=s}else if(this.isH265){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength+this.vps.byteLength);e.set(this.vps,0),e.set(this.sps,this.vps.byteLength),e.set(this.pps,this.vps.byteLength+this.sps.byteLength);const s=new Uint8Array(e.byteLength+i.byteLength);s.set(e,0),s.set(i,e.byteLength),t.data=s}t.size=t.data.byteLength,this.totalDuration+=t.duration,this.totalByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.bufferList.push(t)}handleAddFmp4AudioTrack(e){const t=Object.assign({},e);t.pts=t.dts+t.cts,t.size=t.data.byteLength,this.totalAudioDuration+=t.duration,this.totalAudioByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.audioBufferList.push(t)}getTotalDuration(){return this.totalDuration/1e3}getType(){return S}getToTalByteLength(){return this.totalByteLength+this.totalAudioByteLength}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{if(!this.isRecording)return this.player.debug.error(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false ");if(0===this.bufferList.length)return this.player.debug.error(this.TAG_NAME,"stop recording fail, this.bufferList.length is 0 "),s("stop recording fail, this.bufferList.length is 0 ");t&&this.setFileName(t);const r={id:1,type:"video",sps:this.sps,pps:this.pps,samples:this.bufferList,sequenceNumber:this.bufferList.length,length:0,addSampleNum:1,duration:0,...this.metaInfo},a={id:2,type:"audio",sequenceNumber:this.audioBufferList.length,samples:this.audioBufferList,...this.audioMetaInfo},o=[r];a.samples.length>0&&o.push(a),this.player.debug.log(this.TAG_NAME,`trackList length is ${o.length}`);const n=qn.generateInitSegment({timescale:1e3,duration:this.totalDuration},o,this.totalByteLength+this.totalAudioByteLength);this.player.debug.log(this.TAG_NAME,"stop recording");const l=new Blob([n],{type:"application/octet-stream"});if(e===At)i(l),this.player.emit(nt.recordBlob,l);else{i();Da((this.fileName||aa())+"."+S,l)}this._reset(),this.player.emit(nt.recording,!1)}))}}class Yn extends Wn{constructor(e){super(e),this.TAG_NAME="FlvRecorderLoader",this.player=e,this._init(),this.player.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this._init(),this.player.debug.log(this.TAG_NAME,"destroy")}_init(){this.hasAudio=!1,this.hasVideo=!1,this.startTime=null,this.currentTime=0,this.prevTimestamp=0,this.totalByteLength=0,this.totalDuration=0,this.flvMetaData=null,this.aacSequenceHeader=null,this.videoSequenceHeader=null,this.bufferList=[]}_reset(){super._reset(),this._init()}startRecord(){const e=this.player.debug;this._isRecording=!0,this.player.emit(nt.recording,!0),e.log(this.TAG_NAME,"start recording"),this.player.emit(nt.recordStart),this.startRecordingInterval()}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(nt.recordingTimestamp,this.getTotalDuration())}),1e3)}addMetaData(e){this.flvMetaData=e}addAACSequenceHeader(e){this.aacSequenceHeader=e}addVideoSequenceHeader(e){this.videoSequenceHeader=e}addVideo(e,t){this._setStartTime(t);const i=this._getBufferTs(t);this.hasVideo=!0,this._createBufferItem(e,Ge,i)}addAudio(e,t){this._setStartTime(t);const i=this._getBufferTs(t);this.hasAudio=!0,this._createBufferItem(e,ze,i)}_setStartTime(e){null===this.startTime&&this._isRecording&&(this.startTime=e,this.player.debug.log(this.TAG_NAME,`_setStartTime is ${e}`))}_getBufferTs(e){e>this.currentTime&&(this.currentTime=e);let t=0;return this.startTime&&e>=this.startTime&&(t=e-this.startTime),t>this.prevTimestamp?this.prevTimestamp=t:t=this.prevTimestamp,t}_createBufferItem(e,t,i){const s=this._createFlvPacket(e,t,i),r=this._createFlvTag(s);this.totalByteLength+=r.byteLength,this.bufferList.push(r)}_createFlvTag(e){let t=11+e.header.length,i=new Uint8Array(t+4);i[0]=e.header.type;let s=new DataView(i.buffer);return i[1]=e.header.length>>16&255,i[2]=e.header.length>>8&255,i[3]=255&e.header.length,i[4]=e.header.timestamp>>16&255,i[5]=e.header.timestamp>>8&255,i[6]=255&e.header.timestamp,i[7]=e.header.timestamp>>24&255,i[8]=0,i[9]=0,i[10]=0,s.setUint32(t,t),i.set(e.payload.subarray(0,e.header.length),11),i}_createFlvPacket(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{header:{length:e?e.length:0,timestamp:i,type:t},payload:e}}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{if(!this.isRecording)return this.player.debug.error(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false ");if(0===this.bufferList.length)return this.player.debug.error(this.TAG_NAME,"stop recording fail, this.bufferList.length is 0 "),s("stop recording fail, this.bufferList.length is 0 ");t&&this.setFileName(t);const r=new Uint8Array([70,76,86,1,0,0,0,0,9,0,0,0,0]);this.hasVideo&&(r[4]|=1),this.hasAudio&&(r[4]|=4);let a=[r];if(this.flvMetaData){const e=this._createFlvPacket(this.flvMetaData,He),t=this._createFlvTag(e);a.push(t)}if(this.videoSequenceHeader){const e=this._createFlvPacket(this.videoSequenceHeader,Ge),t=this._createFlvTag(e);a.push(t)}if(this.aacSequenceHeader){const e=this._createFlvPacket(this.aacSequenceHeader,ze),t=this._createFlvTag(e);a.push(t)}const o=function(e){const t=e[0].constructor;return e.reduce(((e,i)=>{const s=new t((0|e.byteLength)+(0|i.byteLength));return s.set(e,0),s.set(i,0|e.byteLength),s}),new t)}(a.concat(this.bufferList));this.player.debug.log(this.TAG_NAME,"stop recording");const n=new Blob([o],{type:"application/octet-stream"});if(e===At)i(n),this.player.emit(nt.recordBlob,n);else{i();Da((this.fileName||aa())+"."+E,n)}this._reset(),this.player.emit(nt.recording,!1)}))}getTotalDuration(){let e=0;return null!==this.startTime&&null!==this.currentTime&&(e=this.currentTime-this.startTime),Math.round(e/1e3)}getType(){return E}getToTalByteLength(){return this.totalByteLength}}const Qn={init:0,findFirstStartCode:1,findSecondStartCode:2};class Xn extends So{constructor(e){super(),this.player=e,this.isDestroyed=!1,this.reset()}destroy(){this.isDestroyed=!1,this.off(),this.reset()}reset(){this.stats=Qn.init,this.tempBuffer=new Uint8Array(0),this.parsedOffset=0,this.versionLayer=0}dispatch(e,t){let i=new Uint8Array(this.tempBuffer.length+e.length);for(i.set(this.tempBuffer,0),i.set(e,this.tempBuffer.length),this.tempBuffer=i;!this.isDestroyed;){if(this.state==Qn.Init){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=Qn.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==Qn.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=Qn.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==Qn.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=Qn.findFirstStartCode}}}}class Zn extends Wn{constructor(e){super(e),this.TAG_NAME="recorderWasmMP4",this._reset(),this.wasmMp4Recorder=new window.JessibucaProMp4Recorder({debug:e._opt.debug,debugLevel:e._opt.debugLevel,debugUuid:e._opt.debugUuid,decoder:e._opt.wasmMp4RecorderDecoder}),this.wasmMp4Recorder.on("recordingTimestamp",(e=>{this._recordingTimestamp=e/1e3})),this.mp3Demuxer=null,e.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.mp3Demuxer&&(this.mp3Demuxer.destroy(),this.mp3Demuxer=null),this._reset(),this.player.debug.log(this.TAG_NAME,"destroy")}_reset(){super._reset(),this.cacheTrack={},this.audioCacheTrack={},this.totalDuration=0,this.totalAudioDuration=0,this.totalByteLength=0,this.totalAudioByteLength=0,this.hasAudio=!1,this.hasVideo=!1}getType(){return S}isWasmMp4(){return!0}getTotalDuration(){return this.totalDuration/1e3}getToTalByteLength(){return this.totalByteLength+this.totalAudioByteLength}startRecord(){const e=this.player.debug,t=this.player.getAudioInfo(),i=this.player.getVideoInfo(),s={};if(this.codecId){const e={type:this.codecId,width:i.width,height:i.height,extraData:this.metaInfo.avcc};s.video=e,this.hasVideo=!0}if(t.encTypeCode){const e={type:t.encTypeCode,sampleRate:t.sampleRate,channels:t.channels,extraData:this.audioMetaInfo.extraData,depth:t.depth};this.audioCodeId=t.encTypeCode,s.audio=e,this.hasAudio=!0}this.wasmMp4Recorder.startRecord(s).then((()=>{this._isRecording=!0,this.player.emit(nt.recording,!0),e.log(this.TAG_NAME,"start recording"),this.player.emit(nt.recordStart),this.startRecordingInterval()})).catch((t=>{e.error(this.TAG_NAME,"startRecord error",t),this.player.emitError(nt.recordCreateError,t)}))}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(nt.recordingTimestamp,this.recordTime)}),1e3)}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>this.isRecording?0===this.totalDuration?(this.player.debug.error(this.TAG_NAME,"stop recording fail, totalDuration is 0 "),s("stop recording fail, totalDuration is 0 ")):(t&&this.setFileName(t),void this.wasmMp4Recorder.stopRecord().then((t=>{if(e===At)i(t),this.player.emit(nt.recordBlob,t);else{i();Da((this.fileName||aa())+"."+S,t)}})).catch((e=>{this.player.debug.error(this.TAG_NAME,"stopRecord error",e),s(e)})).finally((()=>{this._reset(),this.player.emit(nt.recording,!1)}))):(this.player.debug.error(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false "))))}handleAddAudioTrack(e,t){this.audioCodeId===Tt?(this.mp3Demuxer||(this.mp3Demuxer=new Xn(this.player),this.mp3Demuxer.on("data",((e,t)=>{this._handleAddAudioTrack(e,t)}))),this.mp3Demuxer.dispatch(e,t)):this._handleAddAudioTrack(e,t)}_handleAddAudioTrack(e,t){po(this.hasAudio)||(this.audioCacheTrack.id&&t>=this.audioCacheTrack.dts?(this.audioCacheTrack.duration=t-this.audioCacheTrack.dts,this.totalAudioDuration+=this.audioCacheTrack.duration,this.totalAudioByteLength+=this.audioCacheTrack.payload.byteLength,this.wasmMp4Recorder.sendAudioFrame(this.audioCacheTrack.payload,this.audioCacheTrack.dts)):this.audioCacheTrack={},this.audioCacheTrack={id:2,payload:e,dts:t})}handleAddNaluTrack(e,t,i,s){po(this.hasVideo)||(this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.totalDuration+=this.cacheTrack.duration,this.totalByteLength+=this.cacheTrack.payload.byteLength,this.wasmMp4Recorder.sendVideoFrame(this.cacheTrack.payload,this.cacheTrack.isIFrame,this.cacheTrack.dts,this.cacheTrack.cts)):this.cacheTrack={},this.cacheTrack={id:1,payload:e,isIFrame:t,dts:i,cts:s})}}class el{constructor(e){return new(el.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){if(e.recordType===S){if(e.useWasm||e.useMSE||e.useWCS)return window.JessibucaProMp4Recorder&&e.mp4RecordUseWasm?Zn:Kn}else if(e.recordType===E)return Yn;return Jn}}function tl(e,t,i){let s=e;if(t+i=128){t.push(String.fromCharCode(65535&e)),s+=2;continue}}}else if(i[s]<240){if(tl(i,s,2)){let e=(15&i[s])<<12|(63&i[s+1])<<6|63&i[s+2];if(e>=2048&&55296!=(63488&e)){t.push(String.fromCharCode(65535&e)),s+=3;continue}}}else if(i[s]<248&&tl(i,s,3)){let e=(7&i[s])<<18|(63&i[s+1])<<12|(63&i[s+2])<<6|63&i[s+3];if(e>65536&&e<1114112){e-=65536,t.push(String.fromCharCode(e>>>10|55296)),t.push(String.fromCharCode(1023&e|56320)),s+=4;continue}}t.push(String.fromCharCode(65533)),++s}return t.join("")}let sl=function(){let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}();class rl{static parseScriptData(e,t,i){let s={};try{let r=rl.parseValue(e,t,i),a=rl.parseValue(e,t+r.size,i-r.size);s[r.data]=a.data}catch(e){console.error("AMF",e.toString())}return s}static parseObject(e,t,i){let s=rl.parseString(e,t,i),r=rl.parseValue(e,t+s.size,i-s.size),a=r.objectEnd;return{data:{name:s.data,value:r.data},size:s.size+r.size,objectEnd:a}}static parseVariable(e,t,i){return rl.parseObject(e,t,i)}static parseString(e,t,i){let s,r=new DataView(e,t,i).getUint16(0,!sl);return s=r>0?il(new Uint8Array(e,t+2,r)):"",{data:s,size:2+r}}static parseLongString(e,t,i){let s,r=new DataView(e,t,i).getUint32(0,!sl);return s=r>0?il(new Uint8Array(e,t+4,r)):"",{data:s,size:4+r}}static parseDate(e,t,i){let s=new DataView(e,t,i),r=s.getFloat64(0,!sl);return r+=60*s.getInt16(8,!sl)*1e3,{data:new Date(r),size:10}}static parseValue(e,t,i){let s,r=new DataView(e,t,i),a=1,o=r.getUint8(0),n=!1;try{switch(o){case 0:s=r.getFloat64(1,!sl),a+=8;break;case 1:s=!!r.getUint8(1),a+=1;break;case 2:{let r=rl.parseString(e,t+1,i-1);s=r.data,a+=r.size;break}case 3:{s={};let o=0;for(9==(16777215&r.getUint32(i-4,!sl))&&(o=3);a{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te)}this.decoderWorker=new Worker(t),this._initDecoderWorker(),e.debug.log("decoderWorker",`init and decoder url is ${t}`),e.on(nt.visibilityChange,(()=>{this.updateWorkConfig({key:"visibility",value:e.visibility})}))}destroy(){return new Promise(((e,t)=>{if(this.player.loaded)if(this.player.debug.log("decoderWorker","has loaded and post message to destroy"),this.decoderWorker){const t={};this.player.isMseDecoderUseWorker()&&(t.isVideoInited=this.player.isMseVideoStateInited()),this.decoderWorker.postMessage({cmd:qe,options:t}),this.destroyResolve=e,this.decoderWorkerCloseTimeout=setTimeout((()=>{this.player.debug.warn("decoderWorker","send close but not response and destroy directly"),this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this._destroy(),setTimeout((()=>{e()}),0)}),2e3)}else this.player.debug.warn("decoderWorker","has loaded but decoderWorker is null and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0);else this.player.debug.log("decoderWorker","has not loaded and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0)}))}_destroy(){this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this.workerUrl&&(window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.decoderWorker&&(this.decoderWorker.terminate(),this.decoderWorker.onerror=null,this.decoderWorker.onmessageerror=null,this.decoderWorker.onmessage=null,this.decoderWorker=null),this.player.debug.log("decoderWorker","destroy"),this.destroyResolve&&(this.destroyResolve(),this.destroyResolve=null)}_initDecoderWorker(){const{debug:e,events:{proxy:t}}=this.player;this.decoderWorker.onerror=e=>{this.player.debug.error("decoderWorker","onerror",e),this.player.emitError(ct.decoderWorkerInitError,e)},this.decoderWorker.onmessageerror=e=>{this.player.debug.error("decoderWorker","onmessageerror",e)},this.decoderWorker.onmessage=t=>{const i=t.data;switch(i.cmd){case re:e.log("decoderWorker","onmessage:",re),this.decoderWorker&&this._initWork(),this.player.loaded||this.player.emit(nt.load),this.player.emit(nt.decoderWorkerInit);break;case ue:e.log("decoderWorker","onmessage:",ue,i.code),this.player._times.decodeStart||(this.player._times.decodeStart=aa()),this.player.video.updateVideoInfo({encTypeCode:i.code});break;case pe:e.log("decoderWorker","onmessage:",pe,i.codecId),this.player.recorder&&this.player.recorder.initMetaData(i.buffer,i.codecId),this.player.video.updateVideoInfo({encTypeCode:i.codecId});break;case de:e.log("decoderWorker","onmessage:",de,i.code),this.player.audio&&this.player.audio.updateAudioInfo({encTypeCode:i.code});break;case ce:e.log("decoderWorker","onmessage:",ce),this.player.recorder&&this.player.recorder.initAudioAacExtraData(i.buffer);break;case ae:if(e.log("decoderWorker","onmessage:",ae,`width:${i.w},height:${i.h}`),La(i.w)||La(i.h))return void this.player.emitError(ct.videoInfoError,`video width ${i.w} or height ${i.h} is empty`);if(this.player.video.updateVideoInfo({width:i.w,height:i.h}),!this.player._opt.openWebglAlignment&&i.w/2%4!=0&&this.player.getRenderType()===$)return void this.player.emitError(ct.webglAlignmentError);this.player.video.initCanvasViewSize(),this.player._opt.playType===_&&(this.player.video.initFps(),this.player.video.initVideoDelay());break;case le:if(e.log("decoderWorker","onmessage:",le,`channels:${i.channels},sampleRate:${i.sampleRate}`),i.channels>2)return void this.player.emitError(ct.audioChannelError,`audio channel is ${i.channels}, max is 2`);this.player.audio&&(this.player.audio.updateAudioInfo(i),this.player._opt.playType===b?this.player.audio.initScriptNode():this.player._opt.playType===_&&this.player.audio.initScriptNodeDelay());break;case oe:if(!this.player.video)return void e.warn("decoderWorker","onmessage render but video is null");if(this.player.isPlayer()){if(po(this.player.video.getHasInit()))return void e.warn("decoderWorker","onmessage render but video has not init");this.player.video.render(i),this.player.handleRender(),this.player.emit(nt.timeUpdate,i.ts),this.player.updateStats({dfps:!0,buf:i.delay}),this.player._times.videoStart||(this.player._times.videoStart=aa(),this.player.handlePlayToRenderTimes())}else this.player.isPlayback()&&(this.player.updateStats({dfps:!0}),po(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this.player.playback.isUseFpsRender?this.player.video.pushData(i):this.player.video.render$2(i)):!this.player.playback.isPlaybackPauseClearCache&&this.player.playback.isCacheBeforeDecodeForFpsRender&&this.player.playback.isUseFpsRender&&this.player.video.pushData(i));break;case fe:this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===S&&this.player.recorder.handleAddNaluTrack(i.buffer,i.isIFrame,i.ts,i.cts);break;case he:this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===S&&this.player.recorder.isWasmMp4()&&this.player.recorder.handleAddAudioTrack(i.buffer,i.ts);break;case me:const{webcodecsDecoder:t,mseDecoder:s}=this.player;this.player.updateStats({buf:i.delay});const r=new Uint8Array(i.payload);this.player._opt.useWCS&&!this.player._opt.useOffscreen?t.decodeVideo(r,i.ts,i.isIFrame,i.cts):this.player._opt.useMSE&&s.decodeVideo(r,i.ts,i.isIFrame,i.cts);break;case ge:if(this.player._opt.useMSE){const e=new Uint8Array(i.payload);this.player.mseDecoder.decodeAudio(e,i.ts,i.cts)}break;case ne:if(!this.player.audio)return void e.warn("decoderWorker","onmessage playAudio but audio is null");(this.player.playing&&this.player.audio||!this.player.video)&&(this.player._opt.hasVideo||this.player.handleRender(),(this.player._opt.playType===b||this.player._opt.playType===_&&(po(this.player.playbackPause)||!this.player.playback.isPlaybackPauseClearCache&&this.player.playback.isCacheBeforeDecodeForFpsRender&&this.player.playback.isUseFpsRender))&&this.player.audio.play(i.buffer,i.ts));break;case Ae:if(i.type===nt.streamSuccess)this.player.stream?this.player.stream.emit(nt.streamSuccess):e.warn("decoderWorker","onmessage and workerFetch response stream success but stream is null");else if(i.type===nt.streamRate)this.player.emit(nt.kBps,(i.value/1024).toFixed(2));else if(i.type===nt.streamEnd)this.player?(i.value===f&&this.player.emit(nt.websocketClose,i.msg),this.player.stream?this.player.stream.emit(nt.streamEnd,i.msg):e&&e.warn("decoderWorker","onmessage and workerFetch response stream end but player.stream is null")):e&&e.warn("decoderWorker","onmessage and workerFetch response stream end but player is null");else if(i.type===ct.websocketError)this.player&&this.player.stream?this.player.stream.emit(ct.websocketError,i.value):e&&e.warn("decoderWorker","onmessage and workerFetch response websocket error but stream is null");else if(i.type===ct.fetchError)this.player&&this.player.stream?this.player.stream.emit(ct.fetchError,i.value):e&&e.warn("decoderWorker","onmessage and workerFetch response fetch error but stream is null");else if(i.type===nt.streamAbps)this.player.updateStats({abps:i.value});else if(i.type===nt.streamVbps)this.player._times.demuxStart||(this.player._times.demuxStart=aa()),this.player.updateStats({vbps:i.value});else if(i.type===nt.streamDts)this.player.updateStats({dts:i.value});else if(i.type===nt.netBuf)this.player.updateStats({netBuf:i.value});else if(i.type===nt.networkDelayTimeout)this.player.emit(nt.networkDelayTimeout,i.value);else if(i.type===nt.streamStats){const e=JSON.parse(i.value);this.player.updateStats({workerStats:e})}else i.type===nt.websocketOpen&&this.player.emit(nt.websocketOpen);break;case be:this.player&&(this.player.videoIframeIntervalTs=i.value);break;case ve:this.player&&this.player.updateStats({isDropping:!0});break;case Ie:this.player.decoderCheckFirstIFrame();break;case Se:this.player&&this.player.video&&this.player.video.setStreamFps(i.value);break;case ye:i.message&&-1!==i.message.indexOf(Oe)&&this.player.emitError(ct.wasmDecodeError,"");break;case we:this.player.emitError(ct.wasmDecodeVideoNoResponseError);break;case ke:this.player.emitError(ct.simdH264DecodeVideoWidthIsTooLarge);break;case Ee:this.player.emitError(ct.wasmWidthOrHeightChange);break;case Te:this.player.emitError(ct.simdDecodeError);break;case _e:e.log("decoderWorker","onmessage:",_e);break;case Ce:e.log("decoderWorker","onmessage:",Ce),this._destroy();break;case xe:this.player&&this.player.pushTempStream(i.buffer);break;case Re:this.player&&this.player.emit(nt.videoSEI,{ts:i.ts,data:new Uint8Array(i.buffer)});break;case De:if(this.player){if(this.player.isRecordTypeFlv()){const e=new Uint8Array(i.buffer);this.player.recorder.addMetaData(e)}const e=al(new Uint8Array(i.buffer));e&&e.onMetaData&&this.player.updateMetaData(e.onMetaData)}break;case Le:if(this.player&&this.player.isRecordTypeFlv()){const e=new Uint8Array(i.buffer);this.player.recorder.addAACSequenceHeader(e,i.ts)}break;case Pe:if(this.player&&this.player.isRecordTypeFlv()){const e=new Uint8Array(i.buffer);this.player.recorder.addVideoSequenceHeader(e,i.ts)}break;case Be:if(this.player&&this.player.isRecordTypeFlv()&&this.player.recording){const e=new Uint8Array(i.buffer);i.type===je?this.player.recorder.addVideo(e,i.ts):i.type===Ne&&this.player.recorder.addAudio(e,i.ts)}break;case Me:this.player&&(this.player.debug.log("decoderWorker","onmessage:",Me),this.player.video.$videoElement.srcObject=i.mseHandle);break;case Ue:this.player&&(this.player.debug.log("decoderWorker","onmessage:",Ue,i.value),this.player._mseWorkerData.firstRenderTime=Number(i.value));break;case Fe:this.player&&(this.player.debug.log("decoderWorker","onmessage:",Fe,i.value,i.msg),this.player.emitError(i.value,i.msg));break;default:this.player[i.cmd]&&this.player[i.cmd](i)}}}_initWork(){const e={debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid,useOffscreen:this.player._opt.useOffscreen,useWCS:this.player._opt.useWCS,useMSE:this.player._opt.useMSE,videoBuffer:this.player._opt.videoBuffer,videoBufferDelay:this.player._opt.videoBufferDelay,openWebglAlignment:this.player._opt.openWebglAlignment,playType:this.player._opt.playType,hasAudio:this.player._opt.hasAudio,hasVideo:this.player._opt.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:this.player._opt.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:this.player.audio&&this.player.audio.audioContext&&this.player.audio.audioContext.sampleRate||0,audioBufferSize:this.player.audio&&this.player.audio.getAudioBufferSize()||1024,networkDelay:this.player._opt.networkDelay,visibility:this.player.visibility,useSIMD:this.player._opt.useSIMD,recordType:this.player._opt.recordType,checkFirstIFrame:this.player._opt.checkFirstIFrame,isM7sCrypto:this.player._opt.isM7sCrypto,isXorCrypto:this.player._opt.isXorCrypto,isSm4Crypto:this.player._opt.isSm4Crypto,sm4CryptoKey:this.player._opt.sm4CryptoKey,m7sCryptoAudio:this.player._opt.m7sCryptoAudio,isFlv:this.player._opt.isFlv,isFmp4:this.player._opt.isFmp4,isMpeg4:this.player._opt.isMpeg4,isTs:this.player._opt.isTs,isNakedFlow:this.player._opt.isNakedFlow,isHls265:this.player.isUseHls265(),isFmp4Private:this.player._opt.isFmp4Private,isEmitSEI:this.player._opt.isEmitSEI,isRecordTypeFlv:this.player.isRecordTypeFlv(),isWasmMp4:this.player.recorder&&this.player.recorder.isWasmMp4()||!1,isChrome:Ja(),isDropSameTimestampGop:this.player._opt.isDropSameTimestampGop,mseDecodeAudio:this.player._opt.mseDecodeAudio,nakedFlowH265DemuxUseNew:this.player._opt.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:this.player._opt.mseDecoderUseWorker,mseAutoCleanupMinBackwardDuration:this.player._opt.mseAutoCleanupMinBackwardDuration,mseAutoCleanupMaxBackwardDuration:this.player._opt.mseAutoCleanupMaxBackwardDuration,mseCorrectTimeDuration:this.player._opt.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:this.player._opt.mseCorrectAudioTimeDuration};this.decoderWorker.postMessage({cmd:Ve,opt:JSON.stringify(e)}),this.player._opt.isM7sCrypto&&(this.updateWorkConfig({key:"cryptoKey",value:this.player._opt.cryptoKey}),this.updateWorkConfig({key:"cryptoIV",value:this.player._opt.cryptoIV}))}decodeVideo(e,t,i){this.player._opt.playType===b?this.player.isUseHls265()?this._decodeVideoNoDelay(e,t,i):this._decodeVideo(e,t,i):this.player._opt.playType===_&&(this.player.video.rate>=this.player._opt.playbackForwardMaxRateDecodeIFrame?i&&(this.player.debug.log("decoderWorker",`current rate is ${this.player.video.rate},only decode i frame`),this._decodeVideoNoDelay(e,t,i)):1===this.player.video.rate?this._decodeVideo(e,t,i):this._decodeVideoNoDelay(e,t,i))}_decodeVideo(e,t,i){const s={type:je,ts:Math.max(t,0),isIFrame:i};this.decoderWorker.postMessage({cmd:$e,buffer:e,options:s},[e.buffer])}_decodeVideoNoDelay(e,t,i){this.decoderWorker.postMessage({cmd:Je,buffer:e,ts:Math.max(t,0),isIFrame:i},[e.buffer])}decodeAudio(e,t){this.player._opt.playType===b?this.player._opt.useWCS||this.player._opt.useMSE||this.player.isUseHls265()?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t):this.player._opt.playType===_&&(1===this.player.video.rate?this._decodeAudio(e,t):this._decodeAudioNoDelay(e,t))}_decodeAudio(e,t){const i={type:Ne,ts:Math.max(t,0)};this.decoderWorker.postMessage({cmd:$e,buffer:e,options:i},[e.buffer])}_decodeAudioNoDelay(e,t){this.decoderWorker.postMessage({cmd:We,buffer:e,ts:Math.max(t,0)},[e.buffer])}updateWorkConfig(e){this.decoderWorker&&this.decoderWorker.postMessage({cmd:Ke,key:e.key,value:e.value})}workerFetchStream(e){const{_opt:t}=this.player,i={protocol:t.protocol,isFlv:t.isFlv,isFmp4:t.isFmp4,isMpeg4:t.isMpeg4,isNakedFlow:t.isNakedFlow,isTs:t.isTs};this.decoderWorker.postMessage({cmd:Qe,url:e,opt:JSON.stringify(i)})}clearWorkBuffer(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.decoderWorker.postMessage({cmd:Ye,needClear:e})}workerSendMessage(e){this.decoderWorker.postMessage({cmd:Xe,message:e})}updateVideoTimestamp(e){this.decoderWorker.postMessage({cmd:Ze,message:e})}}var nl,ll="application/json, text/javascript",dl="text/html",hl=/^(?:text|application)\/xml/i,cl=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,ul=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,pl=/^\s*$/,fl={},ml={},gl="",yl={type:"GET",beforeSend:Al,success:Al,error:Al,complete:Al,context:null,xhr:function(){return new window.XMLHttpRequest},accepts:{json:ll,xml:"application/xml, text/xml",html:dl,text:"text/plain","*":"*/".concat("*")},crossDomain:!1,timeout:0,username:null,password:null,processData:!0,promise:Al,contentType:"application/x-www-form-urlencoded; charset=UTF-8"};function Al(){}var bl=function(e,t){"object"==typeof e&&(t=e,e=void 0);var i=Cl({},t=t||{});for(var s in yl)void 0===i[s]&&(i[s]=yl[s]);try{var r={},a=new Promise((function(e,t){r.resolve=e,r.reject=t}));a.resolve=r.resolve,a.reject=r.reject,i.promise=a}catch(e){i.promise={resolve:Al,reject:Al}}var o=ul.exec(window.location.href.toLowerCase())||[];i.url=((e||i.url||window.location.href)+"").replace(/#.*$/,"").replace(/^\/\//,o[1]+"//");var n=i.url;i.crossDomain||(i.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(i.url)&&RegExp.$2!==window.location.href);var l=i.dataType;if("jsonp"===l){if(!/=\?/.test(i.url)){var d=(i.jsonp||"callback")+"=?";i.url=El(i.url,d)}return function(e){var t,i=e.jsonpCallback||"jsonp"+Dl(),s=window.document.createElement("script"),r={abort:function(){i in window&&(window[i]=Al)}},a=window.document.getElementsByTagName("head")[0]||window.document.documentElement;function o(i){window.clearTimeout(t),r.abort(),Sl(i.type,r,i.type,e),n()}s.onerror=function(e){o(e)},window[i]=function(i){window.clearTimeout(t),vl(i,r,e),n()},Tl(e),s.src=e.url.replace(/=\?/,"="+i),s.src=El(s.src,"_="+(new Date).getTime()),s.async=!0,e.scriptCharset&&(s.charset=e.scriptCharset);a.insertBefore(s,a.firstChild),e.timeout>0&&(t=window.setTimeout((function(){r.abort(),Sl("timeout",r,"timeout",e),n()}),e.timeout));function n(){s.clearAttributes?s.clearAttributes():s.onload=s.onreadystatechange=s.onerror=null,s.parentNode&&s.parentNode.removeChild(s),s=null,delete window[i]}return e.promise.abort=function(){r.abort()},e.promise.xhr=r,e.promise}(i)}Tl(i);var h=i.accepts[l]||i.accepts["*"],c={};/^([\w-]+:)\/\//.test(i.url)?RegExp.$1:window.location.protocol;var u,p=yl.xhr();i.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest"),i.ifModified&&(fl[n]&&(c["If-Modified-Since"]=fl[n]),ml[n]&&(c["If-None-Match"]=ml[n])),h&&(c.Accept=h,h.indexOf(",")>-1&&(h=h.split(",",2)[0]),p.overrideMimeType&&p.overrideMimeType(h));var f=!/^(?:GET|HEAD)$/.test(i.type.toUpperCase());if((i.data&&f&&!1!==i.contentType||t.contentType)&&(c["Content-Type"]=i.contentType),!1===i.cache&&!f){var m=/([?&])_=[^&]*/;i.url=m.test(n)?n.replace(m,"$1_="+Dl()):n+(/\?/.test(n)?"&":"?")+"_="+Dl()}i.headers=Cl(c,i.headers||{}),p.onreadystatechange=function(){if(4===p.readyState){var e;clearTimeout(u);var t=!1;if(p.status>=200&&p.status<300||304===p.status){if(gl=p.getAllResponseHeaders(),i.ifModified){var s=wl("Last-Modified");s&&(fl[n]=s),(s=wl("etag"))&&(ml[n]=s)}l=l||function(e){return e&&(e===dl?"html":e===ll?"json":hl.test(e)&&"xml")||"text"}(p.getResponseHeader("content-type")),e=p.responseText;try{"xml"===l?e=p.responseXML:"json"===l&&(e=pl.test(e)?null:JSON.parse(e))}catch(e){t=e}t?Sl(t,"parseerror",p,i):vl(e,p,i)}else Sl(null,"error",p,i)}};var g=!("async"in i)||i.async;if(p.open(i.type,i.url,g,i.username,i.password),i.xhrFields)for(var y in i.xhrFields)p[y]=i.xhrFields[y];for(var y in i.mimeType&&p.overrideMimeType&&p.overrideMimeType(i.mimeType),i.headers)void 0!==i.headers[y]&&p.setRequestHeader(y,i.headers[y]+"");return!1===function(e,t){var i=t.context;if(!1===t.beforeSend.call(i,e,t))return!1}(p,i)?(p.abort(),!1):(i.timeout>0&&(u=window.setTimeout((function(){p.onreadystatechange=Al,p.abort(),Sl(null,"timeout",p,i)}),i.timeout)),p.send(i.data?i.data:null),i.promise.abort=function(){p.abort()},i.promise)};function vl(e,t,i){var s=i.context,r="success";i.success.call(s,e,r,t),i.promise.resolve(e,r,t),_l(r,t,i)}function _l(e,t,i){var s=i.context;i.complete.call(s,t,e)}function Sl(e,t,i,s){var r=s.context;s.error.call(r,i,t,e),s.promise.reject(i,t,e),_l(t,i,s)}function wl(e){var t;if(!nl){for(nl={};t=cl.exec(gl);)nl[t[1].toLowerCase()]=t[2];t=nl[e.toLowerCase()]}return null===t?null:t}function El(e,t){return(e+"&"+t).replace(/[&?]{1,2}/,"?")}function Tl(e){!xl(e)||e.data instanceof FormData||!e.processData||(e.data=function(e,t){var i=[];return i.add=function(e,t){this.push(encodeURIComponent(e)+"="+encodeURIComponent(t))},kl(i,e,t),i.join("&").replace("%20","+")}(e.data)),!e.data||e.type&&"GET"!==e.type.toUpperCase()||(e.url=El(e.url,e.data))}function kl(e,t,i,s){var r=function(e){return"[object Array]"===Object.prototype.toString.call(e)}(t);for(var a in t){var o=t[a];s&&(a=i?s:s+"["+(r?"":a)+"]"),!s&&r?e.add(o.name,o.value):(i?r(o):xl(o))?kl(e,o,i,a):e.add(a,o)}}function Cl(e){for(var t=Array.prototype.slice,i=t.call(arguments,1),s=0,r=i.length;s255)return!1;return!0}function Bl(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!Pl(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(Ll(e.length)&&Pl(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function Il(e){return new Uint8Array(e)}function Ml(e,t,i,s,r){null==s&&null==r||(e=e.slice?e.slice(s,r):Array.prototype.slice.call(e,s,r)),t.set(e,i)}bl.get=function(e,t,i,s){return Rl(t)&&(s=s||i,i=t,t=void 0),bl({url:e,data:t,success:i,dataType:s})},bl.post=function(e,t,i,s){return Rl(t)&&(s=s||i,i=t,t=void 0),bl({type:"POST",url:e,data:t,success:i,dataType:s})},bl.getJSON=function(e,t,i){return Rl(t)&&(i=t,t=void 0),bl({url:e,data:t,success:i,dataType:"json"})},bl.ajaxSetup=function(e,t){return t?Cl(Cl(e,yl),t):Cl(yl,e)};var Ul={toBytes:function(e){var t=[],i=0;for(e=encodeURI(e);i191&&s<224?(t.push(String.fromCharCode((31&s)<<6|63&e[i+1])),i+=2):(t.push(String.fromCharCode((15&s)<<12|(63&e[i+1])<<6|63&e[i+2])),i+=3)}return t.join("")}},Fl=function(){var e="0123456789abcdef";return{toBytes:function(e){for(var t=[],i=0;i>4]+e[15&r])}return i.join("")}}}(),Ol={16:10,24:12,32:14},Nl=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],jl=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],zl=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],Gl=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],Hl=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],Vl=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],$l=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],Wl=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Jl=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],ql=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Kl=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Yl=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ql=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Xl=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Zl=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function ed(e){for(var t=[],i=0;i>2,this._Ke[i][t%4]=a[t],this._Kd[e-i][t%4]=a[t];for(var o,n=0,l=r;l>16&255]<<24^jl[o>>8&255]<<16^jl[255&o]<<8^jl[o>>24&255]^Nl[n]<<24,n+=1,8!=r)for(t=1;t>8&255]<<8^jl[o>>16&255]<<16^jl[o>>24&255]<<24;for(t=r/2+1;t>2,h=l%4,this._Ke[d][h]=a[t],this._Kd[e-d][h]=a[t++],l++}for(var d=1;d>24&255]^Ql[o>>16&255]^Xl[o>>8&255]^Zl[255&o]},td.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,i=[0,0,0,0],s=ed(e),r=0;r<4;r++)s[r]^=this._Ke[0][r];for(var a=1;a>24&255]^Hl[s[(r+1)%4]>>16&255]^Vl[s[(r+2)%4]>>8&255]^$l[255&s[(r+3)%4]]^this._Ke[a][r];s=i.slice()}var o,n=Il(16);for(r=0;r<4;r++)o=this._Ke[t][r],n[4*r]=255&(jl[s[r]>>24&255]^o>>24),n[4*r+1]=255&(jl[s[(r+1)%4]>>16&255]^o>>16),n[4*r+2]=255&(jl[s[(r+2)%4]>>8&255]^o>>8),n[4*r+3]=255&(jl[255&s[(r+3)%4]]^o);return n},td.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,i=[0,0,0,0],s=ed(e),r=0;r<4;r++)s[r]^=this._Kd[0][r];for(var a=1;a>24&255]^Jl[s[(r+3)%4]>>16&255]^ql[s[(r+2)%4]>>8&255]^Kl[255&s[(r+1)%4]]^this._Kd[a][r];s=i.slice()}var o,n=Il(16);for(r=0;r<4;r++)o=this._Kd[t][r],n[4*r]=255&(zl[s[r]>>24&255]^o>>24),n[4*r+1]=255&(zl[s[(r+3)%4]>>16&255]^o>>16),n[4*r+2]=255&(zl[s[(r+2)%4]>>8&255]^o>>8),n[4*r+3]=255&(zl[255&s[(r+1)%4]]^o);return n};var id=function(e){if(!(this instanceof id))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new td(e)};id.prototype.encrypt=function(e){if((e=Bl(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=Il(e.length),i=Il(16),s=0;sNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},od.prototype.setBytes=function(e){if(16!=(e=Bl(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},od.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var nd=function(e,t){if(!(this instanceof nd))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof od||(t=new od(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new td(e)};nd.prototype.encrypt=function(e){for(var t=Bl(e,!0),i=0;i16)throw new Error("PKCS#7 padding byte out of range");for(var i=e.length-t,s=0;s>>2]>>>24-a%4*8&255;t[s+a>>>2]|=o<<24-(s+a)%4*8}else for(var n=0;n>>2]=i[n>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=l.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i>>2]>>>24-r%4*8&255;s.push((a>>>4).toString(16)),s.push((15&a).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new d.init(i,t/2)}},u=h.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],r=0;r>>2]>>>24-r%4*8&255;s.push(String.fromCharCode(a))}return s.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s>>2]|=(255&e.charCodeAt(s))<<24-s%4*8;return new d.init(i,t)}},p=h.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},f=n.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i,s=this._data,r=s.words,a=s.sigBytes,o=this.blockSize,n=a/(4*o),l=(n=t?e.ceil(n):e.max((0|n)-this._minBufferSize,0))*o,h=e.min(4*l,a);if(l){for(var c=0;c>>2]|=e[r]<<24-r%4*8;t.call(this,s,i)}else t.apply(this,arguments)};s.prototype=e}}(),i.lib.WordArray)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.WordArray,s=e.enc;function r(e){return e<<8&4278255360|e>>>8&16711935}s.Utf16=s.Utf16BE={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],r=0;r>>2]>>>16-r%4*8&65535;s.push(String.fromCharCode(a))}return s.join("")},parse:function(e){for(var i=e.length,s=[],r=0;r>>1]|=e.charCodeAt(r)<<16-r%2*16;return t.create(s,2*i)}},s.Utf16LE={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],a=0;a>>2]>>>16-a%4*8&65535);s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var i=e.length,s=[],a=0;a>>1]|=r(e.charCodeAt(a)<<16-a%2*16);return t.create(s,2*i)}}}(),i.enc.Utf16)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.WordArray;function s(e,i,s){for(var r=[],a=0,o=0;o>>6-o%4*2;r[a>>>2]|=n<<24-a%4*8,a++}return t.create(r,a)}e.enc.Base64={stringify:function(e){var t=e.words,i=e.sigBytes,s=this._map;e.clamp();for(var r=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,n=0;n<4&&a+.75*n>>6*(3-n)&63));var l=s.charAt(64);if(l)for(;r.length%4;)r.push(l);return r.join("")},parse:function(e){var t=e.length,i=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var a=0;a>>6-o%4*2;r[a>>>2]|=n<<24-a%4*8,a++}return t.create(r,a)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var i=e.words,s=e.sigBytes,r=t?this._safe_map:this._map;e.clamp();for(var a=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(i[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|i[o+2>>>2]>>>24-(o+2)%4*8&255,l=0;l<4&&o+.75*l>>6*(3-l)&63));var d=r.charAt(64);if(d)for(;a.length%4;)a.push(d);return a.join("")},parse:function(e,t){void 0===t&&(t=!0);var i=e.length,r=t?this._safe_map:this._map,a=this._reverseMap;if(!a){a=this._reverseMap=[];for(var o=0;o>>24)|4278255360&(r<<24|r>>>8)}var a=this._hash.words,o=e[t+0],l=e[t+1],p=e[t+2],f=e[t+3],m=e[t+4],g=e[t+5],y=e[t+6],A=e[t+7],b=e[t+8],v=e[t+9],_=e[t+10],S=e[t+11],w=e[t+12],E=e[t+13],T=e[t+14],k=e[t+15],C=a[0],x=a[1],R=a[2],D=a[3];C=d(C,x,R,D,o,7,n[0]),D=d(D,C,x,R,l,12,n[1]),R=d(R,D,C,x,p,17,n[2]),x=d(x,R,D,C,f,22,n[3]),C=d(C,x,R,D,m,7,n[4]),D=d(D,C,x,R,g,12,n[5]),R=d(R,D,C,x,y,17,n[6]),x=d(x,R,D,C,A,22,n[7]),C=d(C,x,R,D,b,7,n[8]),D=d(D,C,x,R,v,12,n[9]),R=d(R,D,C,x,_,17,n[10]),x=d(x,R,D,C,S,22,n[11]),C=d(C,x,R,D,w,7,n[12]),D=d(D,C,x,R,E,12,n[13]),R=d(R,D,C,x,T,17,n[14]),C=h(C,x=d(x,R,D,C,k,22,n[15]),R,D,l,5,n[16]),D=h(D,C,x,R,y,9,n[17]),R=h(R,D,C,x,S,14,n[18]),x=h(x,R,D,C,o,20,n[19]),C=h(C,x,R,D,g,5,n[20]),D=h(D,C,x,R,_,9,n[21]),R=h(R,D,C,x,k,14,n[22]),x=h(x,R,D,C,m,20,n[23]),C=h(C,x,R,D,v,5,n[24]),D=h(D,C,x,R,T,9,n[25]),R=h(R,D,C,x,f,14,n[26]),x=h(x,R,D,C,b,20,n[27]),C=h(C,x,R,D,E,5,n[28]),D=h(D,C,x,R,p,9,n[29]),R=h(R,D,C,x,A,14,n[30]),C=c(C,x=h(x,R,D,C,w,20,n[31]),R,D,g,4,n[32]),D=c(D,C,x,R,b,11,n[33]),R=c(R,D,C,x,S,16,n[34]),x=c(x,R,D,C,T,23,n[35]),C=c(C,x,R,D,l,4,n[36]),D=c(D,C,x,R,m,11,n[37]),R=c(R,D,C,x,A,16,n[38]),x=c(x,R,D,C,_,23,n[39]),C=c(C,x,R,D,E,4,n[40]),D=c(D,C,x,R,o,11,n[41]),R=c(R,D,C,x,f,16,n[42]),x=c(x,R,D,C,y,23,n[43]),C=c(C,x,R,D,v,4,n[44]),D=c(D,C,x,R,w,11,n[45]),R=c(R,D,C,x,k,16,n[46]),C=u(C,x=c(x,R,D,C,p,23,n[47]),R,D,o,6,n[48]),D=u(D,C,x,R,A,10,n[49]),R=u(R,D,C,x,T,15,n[50]),x=u(x,R,D,C,g,21,n[51]),C=u(C,x,R,D,w,6,n[52]),D=u(D,C,x,R,f,10,n[53]),R=u(R,D,C,x,_,15,n[54]),x=u(x,R,D,C,l,21,n[55]),C=u(C,x,R,D,b,6,n[56]),D=u(D,C,x,R,k,10,n[57]),R=u(R,D,C,x,y,15,n[58]),x=u(x,R,D,C,E,21,n[59]),C=u(C,x,R,D,m,6,n[60]),D=u(D,C,x,R,S,10,n[61]),R=u(R,D,C,x,p,15,n[62]),x=u(x,R,D,C,v,21,n[63]),a[0]=a[0]+C|0,a[1]=a[1]+x|0,a[2]=a[2]+R|0,a[3]=a[3]+D|0},_doFinalize:function(){var t=this._data,i=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;i[r>>>5]|=128<<24-r%32;var a=e.floor(s/4294967296),o=s;i[15+(r+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),i[14+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(i.length+1),this._process();for(var n=this._hash,l=n.words,d=0;d<4;d++){var h=l[d];l[d]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return n},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function d(e,t,i,s,r,a,o){var n=e+(t&i|~t&s)+r+o;return(n<>>32-a)+t}function h(e,t,i,s,r,a,o){var n=e+(t&s|i&~s)+r+o;return(n<>>32-a)+t}function c(e,t,i,s,r,a,o){var n=e+(t^i^s)+r+o;return(n<>>32-a)+t}function u(e,t,i,s,r,a,o){var n=e+(i^(t|~s))+r+o;return(n<>>32-a)+t}t.MD5=a._createHelper(l),t.HmacMD5=a._createHmacHelper(l)}(Math),i.MD5)})),Ir((function(e,t){var i,s,r,a,o,n,l,d;e.exports=(s=(i=d=dd).lib,r=s.WordArray,a=s.Hasher,o=i.algo,n=[],l=o.SHA1=a.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],a=i[2],o=i[3],l=i[4],d=0;d<80;d++){if(d<16)n[d]=0|e[t+d];else{var h=n[d-3]^n[d-8]^n[d-14]^n[d-16];n[d]=h<<1|h>>>31}var c=(s<<5|s>>>27)+l+n[d];c+=d<20?1518500249+(r&a|~r&o):d<40?1859775393+(r^a^o):d<60?(r&a|r&o|a&o)-1894007588:(r^a^o)-899497514,l=o,o=a,a=r<<30|r>>>2,r=s,s=c}i[0]=i[0]+s|0,i[1]=i[1]+r|0,i[2]=i[2]+a|0,i[3]=i[3]+o|0,i[4]=i[4]+l|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;return t[s>>>5]|=128<<24-s%32,t[14+(s+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(s+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}}),i.SHA1=a._createHelper(l),i.HmacSHA1=a._createHmacHelper(l),d.SHA1)})),Ir((function(e,t){var i;e.exports=(i=dd,function(e){var t=i,s=t.lib,r=s.WordArray,a=s.Hasher,o=t.algo,n=[],l=[];!function(){function t(t){for(var i=e.sqrt(t),s=2;s<=i;s++)if(!(t%s))return!1;return!0}function i(e){return 4294967296*(e-(0|e))|0}for(var s=2,r=0;r<64;)t(s)&&(r<8&&(n[r]=i(e.pow(s,.5))),l[r]=i(e.pow(s,1/3)),r++),s++}();var d=[],h=o.SHA256=a.extend({_doReset:function(){this._hash=new r.init(n.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],a=i[2],o=i[3],n=i[4],h=i[5],c=i[6],u=i[7],p=0;p<64;p++){if(p<16)d[p]=0|e[t+p];else{var f=d[p-15],m=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,g=d[p-2],y=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;d[p]=m+d[p-7]+y+d[p-16]}var A=s&r^s&a^r&a,b=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),v=u+((n<<26|n>>>6)^(n<<21|n>>>11)^(n<<7|n>>>25))+(n&h^~n&c)+l[p]+d[p];u=c,c=h,h=n,n=o+v|0,o=a,a=r,r=s,s=v+(b+A)|0}i[0]=i[0]+s|0,i[1]=i[1]+r|0,i[2]=i[2]+a|0,i[3]=i[3]+o|0,i[4]=i[4]+n|0,i[5]=i[5]+h|0,i[6]=i[6]+c|0,i[7]=i[7]+u|0},_doFinalize:function(){var t=this._data,i=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;return i[r>>>5]|=128<<24-r%32,i[14+(r+64>>>9<<4)]=e.floor(s/4294967296),i[15+(r+64>>>9<<4)]=s,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=a._createHelper(h),t.HmacSHA256=a._createHmacHelper(h)}(Math),i.SHA256)})),Ir((function(e,t){var i,s,r,a,o,n;e.exports=(s=(i=n=dd).lib.WordArray,r=i.algo,a=r.SHA256,o=r.SHA224=a.extend({_doReset:function(){this._hash=new s.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=4,e}}),i.SHA224=a._createHelper(o),i.HmacSHA224=a._createHmacHelper(o),n.SHA224)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.Hasher,s=e.x64,r=s.Word,a=s.WordArray,o=e.algo;function n(){return r.create.apply(r,arguments)}var l=[n(1116352408,3609767458),n(1899447441,602891725),n(3049323471,3964484399),n(3921009573,2173295548),n(961987163,4081628472),n(1508970993,3053834265),n(2453635748,2937671579),n(2870763221,3664609560),n(3624381080,2734883394),n(310598401,1164996542),n(607225278,1323610764),n(1426881987,3590304994),n(1925078388,4068182383),n(2162078206,991336113),n(2614888103,633803317),n(3248222580,3479774868),n(3835390401,2666613458),n(4022224774,944711139),n(264347078,2341262773),n(604807628,2007800933),n(770255983,1495990901),n(1249150122,1856431235),n(1555081692,3175218132),n(1996064986,2198950837),n(2554220882,3999719339),n(2821834349,766784016),n(2952996808,2566594879),n(3210313671,3203337956),n(3336571891,1034457026),n(3584528711,2466948901),n(113926993,3758326383),n(338241895,168717936),n(666307205,1188179964),n(773529912,1546045734),n(1294757372,1522805485),n(1396182291,2643833823),n(1695183700,2343527390),n(1986661051,1014477480),n(2177026350,1206759142),n(2456956037,344077627),n(2730485921,1290863460),n(2820302411,3158454273),n(3259730800,3505952657),n(3345764771,106217008),n(3516065817,3606008344),n(3600352804,1432725776),n(4094571909,1467031594),n(275423344,851169720),n(430227734,3100823752),n(506948616,1363258195),n(659060556,3750685593),n(883997877,3785050280),n(958139571,3318307427),n(1322822218,3812723403),n(1537002063,2003034995),n(1747873779,3602036899),n(1955562222,1575990012),n(2024104815,1125592928),n(2227730452,2716904306),n(2361852424,442776044),n(2428436474,593698344),n(2756734187,3733110249),n(3204031479,2999351573),n(3329325298,3815920427),n(3391569614,3928383900),n(3515267271,566280711),n(3940187606,3454069534),n(4118630271,4000239992),n(116418474,1914138554),n(174292421,2731055270),n(289380356,3203993006),n(460393269,320620315),n(685471733,587496836),n(852142971,1086792851),n(1017036298,365543100),n(1126000580,2618297676),n(1288033470,3409855158),n(1501505948,4234509866),n(1607167915,987167468),n(1816402316,1246189591)],d=[];!function(){for(var e=0;e<80;e++)d[e]=n()}();var h=o.SHA512=t.extend({_doReset:function(){this._hash=new a.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],a=i[2],o=i[3],n=i[4],h=i[5],c=i[6],u=i[7],p=s.high,f=s.low,m=r.high,g=r.low,y=a.high,A=a.low,b=o.high,v=o.low,_=n.high,S=n.low,w=h.high,E=h.low,T=c.high,k=c.low,C=u.high,x=u.low,R=p,D=f,L=m,P=g,B=y,I=A,M=b,U=v,F=_,O=S,N=w,j=E,z=T,G=k,H=C,V=x,$=0;$<80;$++){var W,J,q=d[$];if($<16)J=q.high=0|e[t+2*$],W=q.low=0|e[t+2*$+1];else{var K=d[$-15],Y=K.high,Q=K.low,X=(Y>>>1|Q<<31)^(Y>>>8|Q<<24)^Y>>>7,Z=(Q>>>1|Y<<31)^(Q>>>8|Y<<24)^(Q>>>7|Y<<25),ee=d[$-2],te=ee.high,ie=ee.low,se=(te>>>19|ie<<13)^(te<<3|ie>>>29)^te>>>6,re=(ie>>>19|te<<13)^(ie<<3|te>>>29)^(ie>>>6|te<<26),ae=d[$-7],oe=ae.high,ne=ae.low,le=d[$-16],de=le.high,he=le.low;J=(J=(J=X+oe+((W=Z+ne)>>>0>>0?1:0))+se+((W+=re)>>>0>>0?1:0))+de+((W+=he)>>>0>>0?1:0),q.high=J,q.low=W}var ce,ue=F&N^~F&z,pe=O&j^~O&G,fe=R&L^R&B^L&B,me=D&P^D&I^P&I,ge=(R>>>28|D<<4)^(R<<30|D>>>2)^(R<<25|D>>>7),ye=(D>>>28|R<<4)^(D<<30|R>>>2)^(D<<25|R>>>7),Ae=(F>>>14|O<<18)^(F>>>18|O<<14)^(F<<23|O>>>9),be=(O>>>14|F<<18)^(O>>>18|F<<14)^(O<<23|F>>>9),ve=l[$],_e=ve.high,Se=ve.low,we=H+Ae+((ce=V+be)>>>0>>0?1:0),Ee=ye+me;H=z,V=G,z=N,G=j,N=F,j=O,F=M+(we=(we=(we=we+ue+((ce+=pe)>>>0>>0?1:0))+_e+((ce+=Se)>>>0>>0?1:0))+J+((ce+=W)>>>0>>0?1:0))+((O=U+ce|0)>>>0>>0?1:0)|0,M=B,U=I,B=L,I=P,L=R,P=D,R=we+(ge+fe+(Ee>>>0>>0?1:0))+((D=ce+Ee|0)>>>0>>0?1:0)|0}f=s.low=f+D,s.high=p+R+(f>>>0>>0?1:0),g=r.low=g+P,r.high=m+L+(g>>>0

>>0?1:0),A=a.low=A+I,a.high=y+B+(A>>>0>>0?1:0),v=o.low=v+U,o.high=b+M+(v>>>0>>0?1:0),S=n.low=S+O,n.high=_+F+(S>>>0>>0?1:0),E=h.low=E+j,h.high=w+N+(E>>>0>>0?1:0),k=c.low=k+G,c.high=T+z+(k>>>0>>0?1:0),x=u.low=x+V,u.high=C+H+(x>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;return t[s>>>5]|=128<<24-s%32,t[30+(s+128>>>10<<5)]=Math.floor(i/4294967296),t[31+(s+128>>>10<<5)]=i,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(h),e.HmacSHA512=t._createHmacHelper(h)}(),i.SHA512)})),Ir((function(e,t){var i,s,r,a,o,n,l,d;e.exports=(s=(i=d=dd).x64,r=s.Word,a=s.WordArray,o=i.algo,n=o.SHA512,l=o.SHA384=n.extend({_doReset:function(){this._hash=new a.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=16,e}}),i.SHA384=n._createHelper(l),i.HmacSHA384=n._createHmacHelper(l),d.SHA384)})),Ir((function(e,t){var i;e.exports=(i=dd,function(e){var t=i,s=t.lib,r=s.WordArray,a=s.Hasher,o=t.x64.Word,n=t.algo,l=[],d=[],h=[];!function(){for(var e=1,t=0,i=0;i<24;i++){l[e+5*t]=(i+1)*(i+2)/2%64;var s=(2*e+3*t)%5;e=t%5,t=s}for(e=0;e<5;e++)for(t=0;t<5;t++)d[e+5*t]=t+(2*e+3*t)%5*5;for(var r=1,a=0;a<24;a++){for(var n=0,c=0,u=0;u<7;u++){if(1&r){var p=(1<>>24)|4278255360&(a<<24|a>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(x=i[r]).high^=o,x.low^=a}for(var n=0;n<24;n++){for(var u=0;u<5;u++){for(var p=0,f=0,m=0;m<5;m++)p^=(x=i[u+5*m]).high,f^=x.low;var g=c[u];g.high=p,g.low=f}for(u=0;u<5;u++){var y=c[(u+4)%5],A=c[(u+1)%5],b=A.high,v=A.low;for(p=y.high^(b<<1|v>>>31),f=y.low^(v<<1|b>>>31),m=0;m<5;m++)(x=i[u+5*m]).high^=p,x.low^=f}for(var _=1;_<25;_++){var S=(x=i[_]).high,w=x.low,E=l[_];E<32?(p=S<>>32-E,f=w<>>32-E):(p=w<>>64-E,f=S<>>64-E);var T=c[d[_]];T.high=p,T.low=f}var k=c[0],C=i[0];for(k.high=C.high,k.low=C.low,u=0;u<5;u++)for(m=0;m<5;m++){var x=i[_=u+5*m],R=c[_],D=c[(u+1)%5+5*m],L=c[(u+2)%5+5*m];x.high=R.high^~D.high&L.high,x.low=R.low^~D.low&L.low}x=i[0];var P=h[n];x.high^=P.high,x.low^=P.low}},_doFinalize:function(){var t=this._data,i=t.words;this._nDataBytes;var s=8*t.sigBytes,a=32*this.blockSize;i[s>>>5]|=1<<24-s%32,i[(e.ceil((s+1)/a)*a>>>5)-1]|=128,t.sigBytes=4*i.length,this._process();for(var o=this._state,n=this.cfg.outputLength/8,l=n/8,d=[],h=0;h>>24)|4278255360&(u<<24|u>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),d.push(p),d.push(u)}return new r.init(d,n)},clone:function(){for(var e=a.clone.call(this),t=e._state=this._state.slice(0),i=0;i<25;i++)t[i]=t[i].clone();return e}});t.SHA3=a._createHelper(u),t.HmacSHA3=a._createHmacHelper(u)}(Math),i.SHA3)})),Ir((function(e,t){var i;e.exports=(i=dd,function(e){var t=i,s=t.lib,r=s.WordArray,a=s.Hasher,o=t.algo,n=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),l=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),d=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),h=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),c=r.create([0,1518500249,1859775393,2400959708,2840853838]),u=r.create([1352829926,1548603684,1836072691,2053994217,0]),p=o.RIPEMD160=a.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=0;i<16;i++){var s=t+i,r=e[s];e[s]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var a,o,p,v,_,S,w,E,T,k,C,x=this._hash.words,R=c.words,D=u.words,L=n.words,P=l.words,B=d.words,I=h.words;for(S=a=x[0],w=o=x[1],E=p=x[2],T=v=x[3],k=_=x[4],i=0;i<80;i+=1)C=a+e[t+L[i]]|0,C+=i<16?f(o,p,v)+R[0]:i<32?m(o,p,v)+R[1]:i<48?g(o,p,v)+R[2]:i<64?y(o,p,v)+R[3]:A(o,p,v)+R[4],C=(C=b(C|=0,B[i]))+_|0,a=_,_=v,v=b(p,10),p=o,o=C,C=S+e[t+P[i]]|0,C+=i<16?A(w,E,T)+D[0]:i<32?y(w,E,T)+D[1]:i<48?g(w,E,T)+D[2]:i<64?m(w,E,T)+D[3]:f(w,E,T)+D[4],C=(C=b(C|=0,I[i]))+k|0,S=k,k=T,T=b(E,10),E=w,w=C;C=x[1]+p+T|0,x[1]=x[2]+v+k|0,x[2]=x[3]+_+S|0,x[3]=x[4]+a+w|0,x[4]=x[0]+o+E|0,x[0]=C},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;t[s>>>5]|=128<<24-s%32,t[14+(s+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(t.length+1),this._process();for(var r=this._hash,a=r.words,o=0;o<5;o++){var n=a[o];a[o]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}return r},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function f(e,t,i){return e^t^i}function m(e,t,i){return e&t|~e&i}function g(e,t,i){return(e|~t)^i}function y(e,t,i){return e&i|t&~i}function A(e,t,i){return e^(t|~i)}function b(e,t){return e<>>32-t}t.RIPEMD160=a._createHelper(p),t.HmacRIPEMD160=a._createHmacHelper(p)}(),i.RIPEMD160)})),Ir((function(e,t){var i,s,r;e.exports=(s=(i=dd).lib.Base,r=i.enc.Utf8,void(i.algo.HMAC=s.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var i=e.blockSize,s=4*i;t.sigBytes>s&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),o=this._iKey=t.clone(),n=a.words,l=o.words,d=0;d>>2];e.sigBytes-=t}};s.BlockCipher=h.extend({cfg:h.cfg.extend({mode:p,padding:f}),reset:function(){var e;h.reset.call(this);var t=this.cfg,i=t.iv,s=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=s.createEncryptor:(e=s.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,i&&i.words):(this._mode=e.call(s,this,i&&i.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=s.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,i=e.salt;return(i?a.create([1398893684,1701076831]).concat(i).concat(t):t).toString(l)},parse:function(e){var t,i=l.parse(e),s=i.words;return 1398893684==s[0]&&1701076831==s[1]&&(t=a.create(s.slice(2,4)),s.splice(0,4),i.sigBytes-=16),m.create({ciphertext:i,salt:t})}},y=s.SerializableCipher=r.extend({cfg:r.extend({format:g}),encrypt:function(e,t,i,s){s=this.cfg.extend(s);var r=e.createEncryptor(i,s),a=r.finalize(t),o=r.cfg;return m.create({ciphertext:a,key:i,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:s.format})},decrypt:function(e,t,i,s){return s=this.cfg.extend(s),t=this._parse(t,s.format),e.createDecryptor(i,s).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),A=(t.kdf={}).OpenSSL={execute:function(e,t,i,s,r){if(s||(s=a.random(8)),r)o=d.create({keySize:t+i,hasher:r}).compute(e,s);else var o=d.create({keySize:t+i}).compute(e,s);var n=a.create(o.words.slice(t),4*i);return o.sigBytes=4*t,m.create({key:o,iv:n,salt:s})}},b=s.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:A}),encrypt:function(e,t,i,s){var r=(s=this.cfg.extend(s)).kdf.execute(i,e.keySize,e.ivSize,s.salt,s.hasher);s.iv=r.iv;var a=y.encrypt.call(this,e,t,r.key,s);return a.mixIn(r),a},decrypt:function(e,t,i,s){s=this.cfg.extend(s),t=this._parse(t,s.format);var r=s.kdf.execute(i,e.keySize,e.ivSize,t.salt,s.hasher);return s.iv=r.iv,y.decrypt.call(this,e,t,r.key,s)}})}())})),Ir((function(e,t){var i;e.exports=((i=dd).mode.CFB=function(){var e=i.lib.BlockCipherMode.extend();function t(e,t,i,s){var r,a=this._iv;a?(r=a.slice(0),this._iv=void 0):r=this._prevBlock,s.encryptBlock(r,0);for(var o=0;o>24&255)){var t=e>>16&255,i=e>>8&255,s=255&e;255===t?(t=0,255===i?(i=0,255===s?s=0:++s):++i):++t,e=0,e+=t<<16,e+=i<<8,e+=s}else e+=1<<24;return e}function s(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var r=e.Encryptor=e.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize,a=this._iv,o=this._counter;a&&(o=this._counter=a.slice(0),this._iv=void 0),s(o);var n=o.slice(0);i.encryptBlock(n,0);for(var l=0;l>>2]|=r<<24-a%4*8,e.sigBytes+=r},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Ansix923)})),Ir((function(e,t){var i;e.exports=((i=dd).pad.Iso10126={pad:function(e,t){var s=4*t,r=s-e.sigBytes%s;e.concat(i.lib.WordArray.random(r-1)).concat(i.lib.WordArray.create([r<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Iso10126)})),Ir((function(e,t){var i;e.exports=((i=dd).pad.Iso97971={pad:function(e,t){e.concat(i.lib.WordArray.create([2147483648],1)),i.pad.ZeroPadding.pad(e,t)},unpad:function(e){i.pad.ZeroPadding.unpad(e),e.sigBytes--}},i.pad.Iso97971)})),Ir((function(e,t){var i;e.exports=((i=dd).pad.ZeroPadding={pad:function(e,t){var i=4*t;e.clamp(),e.sigBytes+=i-(e.sigBytes%i||i)},unpad:function(e){var t=e.words,i=e.sigBytes-1;for(i=e.sigBytes-1;i>=0;i--)if(t[i>>>2]>>>24-i%4*8&255){e.sigBytes=i+1;break}}},i.pad.ZeroPadding)})),Ir((function(e,t){var i;e.exports=((i=dd).pad.NoPadding={pad:function(){},unpad:function(){}},i.pad.NoPadding)})),Ir((function(e,t){var i;e.exports=(i=dd,function(e){var t=i,s=t.lib.CipherParams,r=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(r)},parse:function(e){var t=r.parse(e);return s.create({ciphertext:t})}}}(),i.format.Hex)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.BlockCipher,s=e.algo,r=[],a=[],o=[],n=[],l=[],d=[],h=[],c=[],u=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var i=0,s=0;for(t=0;t<256;t++){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,r[i]=f,a[f]=i;var m=e[i],g=e[m],y=e[g],A=257*e[f]^16843008*f;o[i]=A<<24|A>>>8,n[i]=A<<16|A>>>16,l[i]=A<<8|A>>>24,d[i]=A,A=16843009*y^65537*g^257*m^16843008*i,h[f]=A<<24|A>>>8,c[f]=A<<16|A>>>16,u[f]=A<<8|A>>>24,p[f]=A,i?(i=m^e[e[e[y^m]]],s^=e[e[s]]):i=s=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],m=s.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,i=e.sigBytes/4,s=4*((this._nRounds=i+6)+1),a=this._keySchedule=[],o=0;o6&&o%i==4&&(d=r[d>>>24]<<24|r[d>>>16&255]<<16|r[d>>>8&255]<<8|r[255&d]):(d=r[(d=d<<8|d>>>24)>>>24]<<24|r[d>>>16&255]<<16|r[d>>>8&255]<<8|r[255&d],d^=f[o/i|0]<<24),a[o]=a[o-i]^d);for(var n=this._invKeySchedule=[],l=0;l>>24]]^c[r[d>>>16&255]]^u[r[d>>>8&255]]^p[r[255&d]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,n,l,d,r)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,h,c,u,p,a),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,s,r,a,o,n){for(var l=this._nRounds,d=e[t]^i[0],h=e[t+1]^i[1],c=e[t+2]^i[2],u=e[t+3]^i[3],p=4,f=1;f>>24]^r[h>>>16&255]^a[c>>>8&255]^o[255&u]^i[p++],g=s[h>>>24]^r[c>>>16&255]^a[u>>>8&255]^o[255&d]^i[p++],y=s[c>>>24]^r[u>>>16&255]^a[d>>>8&255]^o[255&h]^i[p++],A=s[u>>>24]^r[d>>>16&255]^a[h>>>8&255]^o[255&c]^i[p++];d=m,h=g,c=y,u=A}m=(n[d>>>24]<<24|n[h>>>16&255]<<16|n[c>>>8&255]<<8|n[255&u])^i[p++],g=(n[h>>>24]<<24|n[c>>>16&255]<<16|n[u>>>8&255]<<8|n[255&d])^i[p++],y=(n[c>>>24]<<24|n[u>>>16&255]<<16|n[d>>>8&255]<<8|n[255&h])^i[p++],A=(n[u>>>24]<<24|n[d>>>16&255]<<16|n[h>>>8&255]<<8|n[255&c])^i[p++],e[t]=m,e[t+1]=g,e[t+2]=y,e[t+3]=A},keySize:8});e.AES=t._createHelper(m)}(),i.AES)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib,s=t.WordArray,r=t.BlockCipher,a=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],n=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],d=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],c=a.DES=r.extend({_doReset:function(){for(var e=this._key.words,t=[],i=0;i<56;i++){var s=o[i]-1;t[i]=e[s>>>5]>>>31-s%32&1}for(var r=this._subKeys=[],a=0;a<16;a++){var d=r[a]=[],h=l[a];for(i=0;i<24;i++)d[i/6|0]|=t[(n[i]-1+h)%28]<<31-i%6,d[4+(i/6|0)]|=t[28+(n[i+24]-1+h)%28]<<31-i%6;for(d[0]=d[0]<<1|d[0]>>>31,i=1;i<7;i++)d[i]=d[i]>>>4*(i-1)+3;d[7]=d[7]<<5|d[7]>>>27}var c=this._invSubKeys=[];for(i=0;i<16;i++)c[i]=r[15-i]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,i){this._lBlock=e[t],this._rBlock=e[t+1],u.call(this,4,252645135),u.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),u.call(this,1,1431655765);for(var s=0;s<16;s++){for(var r=i[s],a=this._lBlock,o=this._rBlock,n=0,l=0;l<8;l++)n|=d[l][((o^r[l])&h[l])>>>0];this._lBlock=o,this._rBlock=a^n}var c=this._lBlock;this._lBlock=this._rBlock,this._rBlock=c,u.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),u.call(this,16,65535),u.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function u(e,t){var i=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=i,this._lBlock^=i<>>e^this._lBlock)&t;this._lBlock^=i,this._rBlock^=i<192.");var t=e.slice(0,2),i=e.length<4?e.slice(0,2):e.slice(2,4),r=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=c.createEncryptor(s.create(t)),this._des2=c.createEncryptor(s.create(i)),this._des3=c.createEncryptor(s.create(r))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=r._createHelper(f)}(),i.TripleDES)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=s.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,i=e.sigBytes,s=this._S=[],r=0;r<256;r++)s[r]=r;r=0;for(var a=0;r<256;r++){var o=r%i,n=t[o>>>2]>>>24-o%4*8&255;a=(a+s[r]+n)%256;var l=s[r];s[r]=s[a],s[a]=l}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=a.call(this)},keySize:8,ivSize:0});function a(){for(var e=this._S,t=this._i,i=this._j,s=0,r=0;r<4;r++){i=(i+e[t=(t+1)%256])%256;var a=e[t];e[t]=e[i],e[i]=a,s|=e[(e[t]+e[i])%256]<<24-8*r}return this._i=t,this._j=i,s}e.RC4=t._createHelper(r);var o=s.RC4Drop=r.extend({cfg:r.cfg.extend({drop:192}),_doReset:function(){r._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)a.call(this)}});e.RC4Drop=t._createHelper(o)}(),i.RC4)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=[],a=[],o=[],n=s.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,i=0;i<4;i++)e[i]=16711935&(e[i]<<8|e[i]>>>24)|4278255360&(e[i]<<24|e[i]>>>8);var s=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,i=0;i<4;i++)l.call(this);for(i=0;i<8;i++)r[i]^=s[i+4&7];if(t){var a=t.words,o=a[0],n=a[1],d=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),h=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=d>>>16|4294901760&h,u=h<<16|65535&d;for(r[0]^=d,r[1]^=c,r[2]^=h,r[3]^=u,r[4]^=d,r[5]^=c,r[6]^=h,r[7]^=u,i=0;i<4;i++)l.call(this)}},_doProcessBlock:function(e,t){var i=this._X;l.call(this),r[0]=i[0]^i[5]>>>16^i[3]<<16,r[1]=i[2]^i[7]>>>16^i[5]<<16,r[2]=i[4]^i[1]>>>16^i[7]<<16,r[3]=i[6]^i[3]>>>16^i[1]<<16;for(var s=0;s<4;s++)r[s]=16711935&(r[s]<<8|r[s]>>>24)|4278255360&(r[s]<<24|r[s]>>>8),e[t+s]^=r[s]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,i=0;i<8;i++)a[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var s=e[i]+t[i],r=65535&s,n=s>>>16,l=((r*r>>>17)+r*n>>>15)+n*n,d=((4294901760&s)*s|0)+((65535&s)*s|0);o[i]=l^d}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=t._createHelper(n)}(),i.Rabbit)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=[],a=[],o=[],n=s.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],s=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var r=0;r<4;r++)l.call(this);for(r=0;r<8;r++)s[r]^=i[r+4&7];if(t){var a=t.words,o=a[0],n=a[1],d=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),h=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=d>>>16|4294901760&h,u=h<<16|65535&d;for(s[0]^=d,s[1]^=c,s[2]^=h,s[3]^=u,s[4]^=d,s[5]^=c,s[6]^=h,s[7]^=u,r=0;r<4;r++)l.call(this)}},_doProcessBlock:function(e,t){var i=this._X;l.call(this),r[0]=i[0]^i[5]>>>16^i[3]<<16,r[1]=i[2]^i[7]>>>16^i[5]<<16,r[2]=i[4]^i[1]>>>16^i[7]<<16,r[3]=i[6]^i[3]>>>16^i[1]<<16;for(var s=0;s<4;s++)r[s]=16711935&(r[s]<<8|r[s]>>>24)|4278255360&(r[s]<<24|r[s]>>>8),e[t+s]^=r[s]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,i=0;i<8;i++)a[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var s=e[i]+t[i],r=65535&s,n=s>>>16,l=((r*r>>>17)+r*n>>>15)+n*n,d=((4294901760&s)*s|0)+((65535&s)*s|0);o[i]=l^d}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=t._createHelper(n)}(),i.RabbitLegacy)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.BlockCipher,s=e.algo;const r=16,a=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],o=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var n={pbox:[],sbox:[]};function l(e,t){let i=t>>24&255,s=t>>16&255,r=t>>8&255,a=255&t,o=e.sbox[0][i]+e.sbox[1][s];return o^=e.sbox[2][r],o+=e.sbox[3][a],o}function d(e,t,i){let s,a=t,o=i;for(let t=0;t1;--t)a^=e.pbox[t],o=l(e,a)^o,s=a,a=o,o=s;return s=a,a=o,o=s,o^=e.pbox[1],a^=e.pbox[0],{left:a,right:o}}function c(e,t,i){for(let t=0;t<4;t++){e.sbox[t]=[];for(let i=0;i<256;i++)e.sbox[t][i]=o[t][i]}let s=0;for(let o=0;o=i&&(s=0);let n=0,l=0,h=0;for(let t=0;t>>2]|=e[i]<<24-i%4*8;return hd.lib.WordArray.create(t,e.length)}const pd=16,fd=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],md=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function gd(e){const t=[];for(let i=0,s=e.length;i1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Ad(e){const t=[];for(let i=0,s=e.length;i>>6),t.push(128|63&s);else if(s<=55295||s>=57344&&s<=65535)t.push(224|s>>>12),t.push(128|s>>>6&63),t.push(128|63&s);else{if(!(s>=65536&&s<=1114111))throw t.push(s),new Error("input is not supported");i++,t.push(240|s>>>18&28),t.push(128|s>>>12&63),t.push(128|s>>>6&63),t.push(128|63&s)}}return t}function bd(e){const t=[];for(let i=0,s=e.length;i=240&&e[i]<=247?(t.push(String.fromCodePoint(((7&e[i])<<18)+((63&e[i+1])<<12)+((63&e[i+2])<<6)+(63&e[i+3]))),i+=3):e[i]>=224&&e[i]<=239?(t.push(String.fromCodePoint(((15&e[i])<<12)+((63&e[i+1])<<6)+(63&e[i+2]))),i+=2):e[i]>=192&&e[i]<=223?(t.push(String.fromCodePoint(((31&e[i])<<6)+(63&e[i+1]))),i++):t.push(String.fromCodePoint(e[i]));return t.join("")}function vd(e,t){const i=31&t;return e<>>32-i}function _d(e){return(255&fd[e>>>24&255])<<24|(255&fd[e>>>16&255])<<16|(255&fd[e>>>8&255])<<8|255&fd[255&e]}function Sd(e){return e^vd(e,2)^vd(e,10)^vd(e,18)^vd(e,24)}function wd(e){return e^vd(e,13)^vd(e,23)}function Ed(e,t,i){const s=new Array(4),r=new Array(4);for(let t=0;t<4;t++)r[0]=255&e[4*t],r[1]=255&e[4*t+1],r[2]=255&e[4*t+2],r[3]=255&e[4*t+3],s[t]=r[0]<<24|r[1]<<16|r[2]<<8|r[3];for(let e,t=0;t<32;t+=4)e=s[1]^s[2]^s[3]^i[t+0],s[0]^=Sd(_d(e)),e=s[2]^s[3]^s[0]^i[t+1],s[1]^=Sd(_d(e)),e=s[3]^s[0]^s[1]^i[t+2],s[2]^=Sd(_d(e)),e=s[0]^s[1]^s[2]^i[t+3],s[3]^=Sd(_d(e));for(let e=0;e<16;e+=4)t[e]=s[3-e/4]>>>24&255,t[e+1]=s[3-e/4]>>>16&255,t[e+2]=s[3-e/4]>>>8&255,t[e+3]=255&s[3-e/4]}function Td(e,t,i){const s=new Array(4),r=new Array(4);for(let t=0;t<4;t++)r[0]=255&e[0+4*t],r[1]=255&e[1+4*t],r[2]=255&e[2+4*t],r[3]=255&e[3+4*t],s[t]=r[0]<<24|r[1]<<16|r[2]<<8|r[3];s[0]^=2746333894,s[1]^=1453994832,s[2]^=1736282519,s[3]^=2993693404;for(let e,i=0;i<32;i+=4)e=s[1]^s[2]^s[3]^md[i+0],t[i+0]=s[0]^=wd(_d(e)),e=s[2]^s[3]^s[0]^md[i+1],t[i+1]=s[1]^=wd(_d(e)),e=s[3]^s[0]^s[1]^md[i+2],t[i+2]=s[2]^=wd(_d(e)),e=s[0]^s[1]^s[2]^md[i+3],t[i+3]=s[3]^=wd(_d(e));if(0===i)for(let e,i=0;i<16;i++)e=t[i],t[i]=t[31-i],t[31-i]=e}function kd(e,t,i){let{padding:s="pkcs#7",mode:r,iv:a=[],output:o="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===r&&("string"==typeof a&&(a=gd(a)),16!==a.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=gd(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==i?Ad(e):gd(e):[...e],("pkcs#5"===s||"pkcs#7"===s)&&0!==i){const t=pd-e.length%pd;for(let i=0;i=pd;){const t=e.slice(c,c+16),s=new Array(16);if("cbc"===r)for(let e=0;ee)return this.preDelayTimestamp-e>1e3&&this.player.debug.warn("CommonDemux",`getDelay() and preDelayTimestamp is ${this.preDelayTimestamp} > timestamp is ${e} more than ${this.preDelayTimestamp-e}ms and return ${this.delay}`),this.preDelayTimestamp=e,this.delay;if(this.firstTimestamp){if(e){const t=Date.now()-this.startTimestamp,i=e-this.firstTimestamp;t>=i?(this.isStreamTsMoreThanLocal=!1,this.delay=t-i):(this.isStreamTsMoreThanLocal=!0,this.delay=i-t)}}else this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1;return this.preDelayTimestamp=e,this.delay}getDelayNotUpdateDelay(e,t){if(!e||!this.player.isDemuxDecodeFirstIIframeInit())return-1;if(t===Ne)return this.pushLatestDelay;if(this.preDelayTimestamp&&this.preDelayTimestamp-e>1e3)return this.player.debug.warn("CommonDemux",`getDelayNotUpdateDelay() and preDelayTimestamp is ${this.preDelayTimestamp} > timestamp is ${e} more than ${this.preDelayTimestamp-e}ms and return -1`),-1;if(this.firstTimestamp){let t=-1;if(e){const i=Date.now()-this.startTimestamp,s=e-this.firstTimestamp;t=i>=s?i-s:s-i}return t}return-1}resetDelay(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}resetAllDelay(){this.resetDelay(),this.preDelayTimestamp=null}initInterval(){this.player.isUseHls265()?this.player.debug.log("CommonDemux","initInterval() and is hls and support hls265 so return"):-1===this.player.getStreamType().indexOf(y)?this.player.isPlaybackCacheBeforeDecodeForFpsRender()?this.player.debug.log("CommonDemux","initInterval() and playback and playbackIsCacheBeforeDecodeForFpsRender is true so return"):(this.player.debug.log("CommonDemux","setInterval()"),this._loop(),this.stopId=setInterval((()=>{let e=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=e);const t=e-this.preLoopTimestamp;this.updateHistoryIntervalDiffTimeList(t),t>100&&this.player.debug.warn("CommonDemux",`loop demux diff time is ${t}`),this._loop(),this.preLoopTimestamp=(new Date).getTime()}),20)):this.player.debug.log("CommonDemux","initInterval() and is worker stream so return")}clearStopInterval(){this.stopId&&(clearInterval(this.stopId),this.stopId=null)}updateHistoryIntervalDiffTimeList(e){this.historyIntervalDiffTimeList.length>5&&this.historyIntervalDiffTimeList.shift(),this.historyIntervalDiffTimeList.push(e)}isHistoryIntervalDiffTimeAllLarge(){if(this.historyIntervalDiffTimeList.length<5)return!1;for(let e=0;e{let e=null;this.bufferList.length&&(e=this.bufferList.shift(),this._doDecoderDecode(e))};e();const t=Math.ceil(1e3/(this.playbackStreamFps*this.player.getPlaybackRate()));this.player.debug.log("CommonDemux",`initPlaybackCacheLoop() and fragDuration is ${t}, playbackStreamFps is ${this.playbackStreamFps}, playbackRate is ${this.player.getPlaybackRate()}`),this.stopId=setInterval(e,t)}_loop(){let e;const t=this.player._opt.videoBuffer,i=this.player._opt.videoBufferDelay,s=this.player._opt.playType===b;if(this.bufferList.length){if(this.isPushDropping)return void this.player.debug.warn("CommonDemux",`_loop isPushDropping is true and bufferList length is ${this.bufferList.length}`);if(this.dropping){for(e=this.bufferList.shift(),this.player.debug.warn("CommonDemux",`_loop is dropping and data.ts is ${e.ts}, data.type is ${e.type}, data.isIFrame is ${e.isIFrame}, delay is ${this.delay} ,buffer list is ${this.bufferList.length}`);!e.isIFrame&&this.bufferList.length;)e=this.bufferList.shift();const t=this.getDelayNotUpdateDelay(e.ts,e.type);e.isIFrame&&t<=this.getNotDroppingDelayTs()&&(this.player.debug.log("CommonDemux",`_loop data isIFrame is true and delay is ${this.delay}`),this.dropping=!1,this._doDecoderDecode(e),this._decodeNext(e))}else if(this.player.isPlayback()||this.player.isPlayUseMSE()||0===t)for(;this.bufferList.length;)e=this.bufferList.shift(),this._doDecoderDecode(e);else if(e=this.bufferList[0],-1===this.getDelay(e.ts,e.type))this.player.debug.log("CommonDemux",`delay is -1 and data.ts is ${e.ts} data.type is ${e.type}`),this.bufferList.shift(),this._doDecoderDecode(e),this._decodeNext(e);else if(this.delay>i+t&&s)this.hasIframeInBufferList()?(this.player.debug.warn("CommonDemux",`_loop delay is ${this.delay}, set dropping is true`),this.resetAllDelay(),this.dropping=!0,this.player.updateStats({isDropping:!0})):(this.bufferList.shift(),this._doDecoderDecode(e),this._decodeNext(e));else for(;this.bufferList.length;){if(e=this.bufferList[0],!(this.getDelay(e.ts,e.type)>t)){this.delay<0&&this.player.debug.warn("CommonDemux",`_loop delay is ${this.delay} bufferList is ${this.bufferList}`);break}this.bufferList.shift(),this._doDecoderDecode(e)}}else-1!==this.delay&&this.player.debug.log("CommonDemux","loop() bufferList is empty and reset delay"),this.resetAllDelay()}_doDecode(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;const a=this.player;let o={ts:i,cts:r,type:t,isIFrame:!1};this.player.isPlayer()?(t===je&&a._opt.playType===b&&this.calcNetworkDelay(i),a._opt.useWCS&&!a._opt.useOffscreen||a._opt.useMSE?(t===je&&(o.isIFrame=s),this.pushBuffer(e,o)):t===je?a.decoderWorker&&a.decoderWorker.decodeVideo(e,i,s):t===Ne&&a._opt.hasAudio&&a.decoderWorker&&a.decoderWorker.decodeAudio(e,i)):this.player.isPlayback()&&(t===je&&(o.isIFrame=s),this.player.isPlaybackOnlyDecodeIFrame()?t===je&&s&&this.pushBuffer(e,o):this.player.isPlaybackCacheBeforeDecodeForFpsRender()||1===this.player.getPlaybackRate()?this.pushBuffer(e,o):this.pushBuffer(e,o,!1))}_doDecodeByHls(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=!1;if(t===Ne&&zr(e)&&(this.player.debug.log("CommonDemux",`hls pushBuffer audio ts is ${i}, isAacCodecPacket is true`),a=!0,this.player.isRecordTypeFlv())){const t=new Uint8Array(e);this.player.recorder.addAACSequenceHeader(t,i)}let o=!1;if(t===je&&s&&co(e)&&(this.player.debug.log("CommonDemux",`hls pushBuffer video ts is ${i}, isVideoSequenceHeader is true`),o=!0,this.player.isRecordTypeFlv())){const t=new Uint8Array(e);this.player.recorder.addVideoSequenceHeader(t,i)}this.player.recording&&po(o)&&po(a)&&this.handleRecording(e,t,i,s,r),t===je?this._doDecoderDecode({ts:i,cts:r,payload:e,type:je,isIFrame:s}):t===Ne&&this._doDecoderDecode({ts:i,payload:e,type:Ne})}_doDecodeByFmp4(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_doDecodeByTs(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_doDecodeByPs(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_decodeNext(e){const t=e.ts;if(0===this.bufferList.length)return;let i=this.bufferList[0];const s=i.ts-t,r=e.type===je&&i.type===Ne,a=e.type===je&&co(e.payload);(s<=20||r||a)&&(this.player.debug.log("CommonDemux",`decode data type is ${e.type} and\n ts is ${t} next data type is ${i.type} ts is ${i.ts}\n diff is ${s} and isVideoAndNextAudio is ${r} and isVideoSqeHeader is ${a}`),this.bufferList.shift(),this._doDecoderDecode(i))}_doDecoderDecode(e){const t=this.player,{webcodecsDecoder:i,mseDecoder:s}=t;this.player.isPlayer()&&this.player.updateStats({buf:this.delay}),e.type===Ne?t._opt.hasAudio&&(t._opt.useMSE&&t._opt.mseDecodeAudio?s.decodeAudio(e.payload,e.ts):t.decoderWorker&&t.decoderWorker.decodeAudio(e.payload,e.ts)):e.type===je&&(t._opt.isEmitSEI&&this.findSei(e.payload,e.ts),t._opt.useWCS&&!t._opt.useOffscreen?i.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t._opt.useMSE?s.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t.decoderWorker&&t.decoderWorker.decodeVideo(e.payload,e.ts,e.isIFrame))}pushBuffer(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=this.player._opt.videoBuffer,r=this.player._opt.videoBufferDelay,a=this.player.isPlayer();if(t.type===Ne&&zr(e)){if(this.player.debug.log("CommonDemux",`pushBuffer() audio ts is ${t.ts}, isAacCodecPacket is true`),this.player.isRecordTypeFlv()){const i=new Uint8Array(e);this.player.recorder.addAACSequenceHeader(i,t.ts)}this._doDecoderDecode({ts:t.ts,payload:e,type:Ne})}else if(t.type===je&&t.isIFrame&&co(e)){if(this.player.debug.log("CommonDemux",`pushBuffer() video ts is ${t.ts}, isVideoSequenceHeader is true`),this.player.isRecordTypeFlv()){const i=new Uint8Array(e);this.player.recorder.addVideoSequenceHeader(i,t.ts)}this._doDecoderDecode({ts:t.ts,payload:e,type:je,isIFrame:t.isIFrame,cts:t.cts})}else{if(this.player.recording&&this.handleRecording(e,t.type,t.ts,t.isIFrame,t.cts),a){if(this.preTimestampDuration>0&&this.preTimestamp>0&&t.type===je){const e=t.ts-this.preTimestamp,i=this.preTimestampDuration+this.preTimestampDuration/2;e>=i&&this.player.debug.log("CommonDemux",`pushBuffer() video\n ts is ${t.ts}, preTimestamp is ${this.preTimestamp},\n diff is ${e} and preTimestampDuration is ${this.preTimestampDuration} and maxDiff is ${i}\n maybe trigger black screen or flower screen`)}if(this.preTimestamp>0&&t.tsX&&(this.player.debug.warn("CommonDemux",`pushBuffer() video\n ts is ${t.ts}, preTimestamp is ${this.preTimestamp},\n diff is ${this.preTimestamp-t.ts} more than 3600000\n and resetAllDelay()`),this.resetAllDelay()),t.ts<=this.preTimestamp&&this.preTimestamp>0&&t.type===je&&(this.player.debug.warn("CommonDemux",`pushBuffer() video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts} less than (or equal) preTimestamp is ${this.preTimestamp} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${this.prevPayloadBufferSize}`),this.player._opt.isDropSameTimestampGop&&po(t.isIFrame)&&this.player.isDemuxDecodeFirstIIframeInit())){const e=this.hasIframeInBufferList(),t=po(this.isPushDropping);return this.player.debug.log("CommonDemux",`pushBuffer(), isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next drop buffer`),void(e&&t?this.dropBuffer$2():this.clearBuffer(!0))}if(this.player.isDemuxDecodeFirstIIframeInit()){let e=this.getDelayNotUpdateDelay(t.ts,t.type);this.pushLatestDelay=e;const i=r+s;this.player._opt.useMSE?e>i&&this.delay0&&this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debug.warn("CommonDemux",`useMSE, pushLatestDelay is ${e} > ${r+s}, bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()):e>i&&this.delay0&&this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debug.warn("CommonDemux",`useWCS, pushLatestDelay is ${e} > ${r+s},bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()),this.isHistoryIntervalDiffTimeAllLarge()&&po(this.player.visibility)&&(this.player._opt.useMSE?this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debug.warn("CommonDemux",`useMSE, page visibility is false and\n history interval diff is ${this.historyIntervalDiffTimeList.join(",")} and\n bufferList is ${this.bufferList.length},\n delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()):this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debug.warn("CommonDemux",`useWCS, page visibility is false and\n history interval diff is ${this.historyIntervalDiffTimeList.join(",")} and\n bufferList is ${this.bufferList.length},\n delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()))}t.type===je&&(this.preTimestamp>0&&(this.preTimestampDuration=t.ts-this.preTimestamp),this.prevPayloadBufferSize=e.byteLength,this.preTimestamp=t.ts)}if(i?t.type===Ne?this.bufferList.push({ts:t.ts,payload:e,type:Ne}):t.type===je&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:je,isIFrame:t.isIFrame}):t.type===je?this._doDecoderDecode({ts:t.ts,cts:t.cts,payload:e,type:je,isIFrame:t.isIFrame}):t.type===Ne&&this._doDecoderDecode({ts:t.ts,payload:e,type:Ne}),this.player.isPlaybackCacheBeforeDecodeForFpsRender()&&(La(this.playbackStreamVideoFps)||La(this.playbackStreamAudioFps))){let e=this.playbackStreamVideoFps,t=this.playbackStreamAudioFps;if(La(this.playbackStreamVideoFps)&&(e=ro(this.bufferList,je),e>0&&(this.playbackStreamVideoFps=e,this.player.video&&this.player.video.setStreamFps(this.playbackStreamVideoFps),this.playbackStreamFps=t?e+t:e,po(this.player._opt.hasAudio)&&(this.player.debug.log(this.TAG_NAME,"playbackCacheBeforeDecodeForFpsRender,_opt.hasAudio is false and set streamAudioFps is 0"),this.playbackStreamAudioFps=0),this.initPlaybackCacheLoop())),La(this.playbackStreamAudioFps)&&(t=ro(this.bufferList,Ne),t>0&&(this.playbackStreamAudioFps=t,this.playbackStreamFps=e?e+t:t,this.initPlaybackCacheLoop())),La(this.playbackStreamVideoFps)&&La(this.playbackStreamAudioFps)){const i=this.bufferList.map((e=>({type:e.type,ts:e.ts})));this.player.debug.log("CommonDemux",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${this.bufferList.length} and ts list is ${JSON.stringify(i)}`)}const i=this.getAudioBufferLength()>0,s=i?60:40;this.bufferList.length>=s&&(this.debug.warn("CommonDemux",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${this.bufferList.length} more than ${s}, and hasAudio is ${i} an set streamFps is 25`),this.playbackStreamVideoFps=e,this.player.video&&this.player.video.setStreamFps(this.playbackStreamVideoFps),i?(this.playbackStreamAudioFps=25,this.playbackStreamFps=this.playbackStreamVideoFps+this.playbackStreamAudioFps):this.playbackStreamFps=this.playbackStreamVideoFps,this.initPlaybackCacheLoop())}}}dropBuffer$2(){if(this.bufferList.length>0){let e=this.bufferList.findIndex((e=>uo(e.isIFrame)&&e.type===je));if(this.isAllIframeInBufferList())for(let t=0;t=this.getNotDroppingDelayTs()){this.player.debug.log("CommonDemux",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${s} and notDroppingDelayTs is ${this.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){this.isPushDropping=!0,this.player.updateStats({isDropping:!0});const t=this.bufferList.length;this.bufferList=this.bufferList.slice(e);const i=this.bufferList.shift();this.resetAllDelay(),this.getDelay(i.ts,i.type),this._doDecoderDecode(i),this.isPushDropping=!1,this.player.debug.log("CommonDemux",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,and new bufferList length is ${this.bufferList.length} and new delay is ${this.delay} `)}else this.isPushDropping=!1}0===this.bufferList.length&&(this.isPushDropping=!1)}clearBuffer(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.player.debug.log("CommonDemux",`clearBuffer,buffer length is ${this.bufferList.length}, need clear is ${e} and _opt.checkFirstIFrame is ${this.player._opt.checkFirstIFrame}`),e&&(this.bufferList=[]),this.player.isPlayer()&&(this.resetAllDelay(),uo(this.player._opt.checkFirstIFrame)&&(this.dropping=!0,this.player.updateStats({isDropping:!0}))),this.player.decoderCheckFirstIFrame()}calcNetworkDelay(e){if(!(this.player.isDemuxDecodeFirstIIframeInit()&&e>0))return;null===this.bufferStartDts?(this.bufferStartDts=e,this.bufferStartLocalTs=aa()):et?i-t:0;s>this.player._opt.networkDelay&&this.player._opt.playType===b&&(this.player.debug.warn("CommonDemux",`delay is more than networkDelay and now dts:${e},start dts is ${this.bufferStartDts}, vs start is ${t},local diff is ${i} ,delay is ${s}, _opt.networkDelay is ${this.player._opt.networkDelay}`),this.player.emit(nt.networkDelayTimeout,s)),this.player.updateStats({netBuf:s})}calcIframeIntervalTimestamp(e){if(null===this.preIframeTs)this.preIframeTs=e;else if(this.preIframeTs{t.type===je&&(e+=1)})),e}getAudioBufferLength(){let e=0;return this.bufferList.forEach((t=>{t.type===Ne&&(e+=1)})),e}hasIframeInBufferList(){return this.bufferList.some((e=>e.type===je&&e.isIFrame))}isAllIframeInBufferList(){const e=this.getVideoBufferLength();let t=0;return this.bufferList.forEach((e=>{e.type===je&&e.isIFrame&&(t+=1)})),e===t}getInputByteLength(){return 0}getIsStreamTsMoreThanLocal(){return this.isStreamTsMoreThanLocal}close(){}reset(){}findSei(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=4;Ba(this.nalUnitSize)&&(s=this.nalUnitSize);const r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return;const i=e.length,s=[];let r,a=0;for(;a+t>>=8),a+=t,r){if(a+r>i)break;s.push(e.subarray(a,a+r)),a+=r}return s}(e.slice(5),s);if(po(i)){const e=this.player.getVideoInfo();e&&e.encType&&(i=e.encType===wt)}r.forEach((e=>{const s=i?e[0]>>>1&63:31&e[0];(i&&(s===qt||s===Jt)||po(i)&&s===Bt)&&this.player.emit(nt.videoSEI,{ts:t,data:e})}))}handleRecording(e,t,i,s,r){if(this.player.isRecordTypeFlv()){const s=new Uint8Array(e);t===je?this.player.recorder.addVideo(s,i):t===Ne&&this.player.recorder.addAudio(s,i)}else if(this.player.isRecordTypeMp4()){const a=new Uint8Array(e);if(this.player.recorder.isWasmMp4()){if(t===je)this.player.recorder.handleAddNaluTrack(a.slice(5),s,i,r);else if(t===Ne){const t=new Uint8Array(e);this.player.recorder.handleAddAudioTrack(Gr(t)?t.slice(2):t.slice(1),i)}}else t===je&&this.player.recorder.handleAddNaluTrack(a.slice(5),s,i,r)}}updateNalUnitSize(e){const t=15&e[0];this.player.video.updateVideoInfo({encTypeCode:t});const i=t===_t;this.nalUnitSize=function(e,t){let i=null;return t?e.length>=28&&(i=1+(3&e[26])):e.length>=12&&(i=1+(3&e[9])),i}(e,i),this.player.debug.log(this.TAG_NAME,`demux() isVideoSequenceHeader is true and isHevc is ${i} and nalUnitSize is ${this.nalUnitSize}`)}cryptoPayload(e,t){let i=e,s=this.player;if(s._opt.isM7sCrypto)if(s._opt.cryptoKey&&s._opt.cryptoKey.byteLength>0&&s._opt.cryptoIV&&s._opt.cryptoIV.byteLength>0){const t=this.player.video.getVideoInfo();t.encTypeCode?i=function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),i=new Uint8Array(i);const r=e.byteLength;let a=5;for(;ar)break;let n=e[a+4],l=!1;if(s?(n=n>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(n)):(n&=31,l=1===n||5===n),l){const s=e.slice(a+4+2,a+4+o);let r=new ld.ModeOfOperation.ctr(t,new ld.Counter(i));const n=r.decrypt(s);r=null,e.set(n,a+4+2)}a=a+4+o}return e}(e,s._opt.cryptoKey,s._opt.cryptoIV,t.encTypeCode===_t):s.debug.warn(this.TAG_NAME,`videoInfo.encTypeCode is ${t.encTypeCode}`)}else s.debug.error(this.TAG_NAME,`isM7sCrypto cryptoKey.length is ${s._opt.cryptoKey&&s._opt.cryptoKey.byteLength} or cryptoIV.length is ${s._opt.cryptoIV&&s._opt.cryptoIV.byteLength} null`);else if(s._opt.isSm4Crypto)s._opt.sm4CryptoKey&&t?i=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const s=e.byteLength;let r=5;for(;rs)break;let o=e[r+4],n=!1;if(i?(o=o>>>1&63,n=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,n=1===o||5===o),n){const i=kd(e.slice(r+4+2,r+4+a),t,0,{padding:"none",output:"array"});e.set(i,r+4+2)}r=r+4+a}return e}(e,s._opt.sm4CryptoKey):s._opt.sm4CryptoKey||s.debug.error(this.TAG_NAME,"isSm4Crypto opt.sm4CryptoKey is null");else if(s._opt.isXorCrypto)if(s._opt.cryptoKey&&s._opt.cryptoKey.byteLength>0&&s._opt.cryptoIV&&s._opt.cryptoIV.byteLength>0){const t=this.player.video.getVideoInfo();i=function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=e.byteLength;let a=5;for(;ar)break;let n=e[a+4],l=!1;if(s?(n=n>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(n)):(n&=31,l=1===n||5===n),l){const s=xd(e.slice(a+4,a+4+o),t,i);e.set(s,a+4)}a=a+4+o}return e}(e,s._opt.cryptoKey,s._opt.cryptoIV,t.encTypeCode===_t)}else s.debug.error(this.TAG_NAME,"isXorCrypto opt.xorCryptoKey is null");return i}cryptoPayloadAudio(e){let t=e,i=this.player;if(i._opt.isM7sCrypto)if(i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0){e[0]>>4===Et&&(t=function(e,t,i){if(e.byteLength<=30)return e;const s=e.slice(32);let r=new ld.ModeOfOperation.ctr(t,new ld.Counter(i));const a=r.decrypt(s);return r=null,e.set(a,32),e}(e,i._opt.cryptoKey,i._opt.cryptoIV))}else i.debug.error(this.TAG_NAME,`isM7sCrypto cryptoKey.length is ${i._opt.cryptoKey&&i._opt.cryptoKey.byteLength} or cryptoIV.length is ${i._opt.cryptoIV&&i._opt.cryptoIV.byteLength} null`);return t}_decodeEnhancedH265Video(e,t){const i=e[0],s=48&i,r=15&i,a=e.slice(1,5),o=new ArrayBuffer(4),n=new Uint32Array(o),l="a"==String.fromCharCode(a[0]);if(r===yr){if(s===vr){const t=e.slice(5);if(l);else{const e=new Uint8Array(5+t.length);e.set([28,0,0,0,0],0),e.set(t,5),this.updateNalUnitSize(e),this.player.debug.log(this.TAG_NAME,`demux() isVideoSequenceHeader(enhancedH265) is true and nalUnitSize is ${this.nalUnitSize}`),this._doDecode(e,je,0,!0,0)}}}else if(r===Ar){let i=e,r=0;const a=s===vr;if(a&&this.calcIframeIntervalTimestamp(t),l);else{n[0]=e[4],n[1]=e[3],n[2]=e[2],n[3]=0,r=n[0];i=jn(e.slice(8),a),i=this.cryptoPayload(i,a),this._doDecode(i,je,t,a,r)}}else if(r===br){const i=s===vr,r=e.slice(5);i&&this.calcIframeIntervalTimestamp(t);let a=jn(r,i);a=this.cryptoPayload(a,i),this._doDecode(a,je,t,i,0)}}_isEnhancedH265Header(e){return 128==(128&e)}}var Ld=function(e,t,i,s){return new(i||(i=Promise))((function(r,a){function o(e){try{l(s.next(e))}catch(e){a(e)}}function n(e){try{l(s.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,n)}l((s=s.apply(e,t||[])).next())}))};const Pd=Symbol(32),Bd=Symbol(16),Id=Symbol(8);class Md{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return Ld(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,i)=>{var s;this.reject=i,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(s=this.pull)||void 0===s||s.call(this,e)}))}))}readU32(){return this.read(Pd)}readU16(){return this.read(Bd)}readU8(){return this.read(Id)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let i=0;const s=e=>t.length<(i=e);if("number"==typeof this.need){if(s(this.need))return;e=t.subarray(0,i)}else if(this.need===Pd){if(s(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Bd){if(s(2))return;e=t[0]<<8|t[1]}else if(this.need===Id){if(s(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(s(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,i)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(s(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,i)),e=this.need}return this.consumed+=i,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{const e=new Uint8Array(i);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}}Md.U32=Pd,Md.U16=Bd,Md.U8=Id;class Ud extends Dd{constructor(e){super(e),this.TAG_NAME="FlvDemux",this.input=new Md(this.demux()),e.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.input=null,this.player.debug.log(this.TAG_NAME,"destroy")}dispatch(e){this.input?this.input.write(e):this.player&&this.player.debug.warn(this.TAG_NAME,"dispatch() this.input is null")}*demux(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),i=new Uint32Array(e),s=this.player;for(;;){if(!this.input)return;t[3]=0;const e=yield 15,r=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const a=i[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let o=i[0];const n=(yield a).slice();if(!s)return;switch(r){case ze:if(s._opt.hasAudio&&(s.updateStats({abps:n.byteLength}),n.byteLength>0)){let e=n;uo(this.player._opt.m7sCryptoAudio)&&(e=this.cryptoPayloadAudio(n)),this._doDecode(e,Ne,o)}break;case Ge:if(s._opt.hasVideo&&n.length>=6){let e=o;s.updateStats({vbps:n.byteLength,dts:e}),s._times.demuxStart||(s._times.demuxStart=aa());const t=n[0];if(this._isEnhancedH265Header(t))this._decodeEnhancedH265Video(n,e);else{const e=15&t;let s=(t>>4&15)===js;const r=e===vt;if(po(e===_t||r))return void this.player.debug.warn(this.TAG_NAME,`demux() codecId is ${e} and ignore`);s&&(this.calcIframeIntervalTimestamp(o),null===this.nalUnitSize&&co(n)&&this.updateNalUnitSize(n)),i[0]=n[4],i[1]=n[3],i[2]=n[2],i[3]=0;let a=i[0],l=this.cryptoPayload(n,s);this._doDecode(l,je,o,s,a)}}else n.length<6&&s.debug.warn(this.TAG_NAME,`payload.length is ${n.length} less than 6 and ignore`);break;case He:if(this.player.isRecordTypeFlv()){const e=new Uint8Array(n);this.player.recorder.addMetaData(e)}const e=al(n);e&&e.onMetaData&&s.updateMetaData(e.onMetaData);break;default:s.debug.log(this.TAG_NAME,`demux() type is ${r}`)}}}close(){this.input=null}getInputByteLength(){let e=0;return this.input&&this.input.buffer&&(e=this.input.buffer.byteLength),e}}class Fd extends Dd{constructor(e){super(e),this.TAG_NAME="M7sDemux",e.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debug.log(this.TAG_NAME,"destroy")}dispatch(e){const t=this.player,i=new DataView(e),s=i.getUint8(0),r=i.getUint32(1,!1),a=new ArrayBuffer(4),o=new Uint32Array(a);switch(s){case Ne:if(t._opt.hasAudio){const i=new Uint8Array(e,5);t.updateStats({abps:i.byteLength}),i.byteLength>0&&this._doDecode(i,s,r)}break;case je:if(t._opt.hasVideo)if(t._times.demuxStart||(t._times.demuxStart=aa()),i.byteLength>=11){const a=new Uint8Array(e,5);let n=r;t.updateStats({vbps:a.byteLength,dts:n});const l=a[0];if(this._isEnhancedH265Header(l))this._decodeEnhancedH265Video(a,r);else{const e=i.getUint8(5)>>4==1;e&&this.calcIframeIntervalTimestamp(r),o[0]=a[4],o[1]=a[3],o[2]=a[2],o[3]=0;let t=o[0],n=this.cryptoPayload(a,e);this._doDecode(n,s,r,e,t)}}else this.player.debug.warn(this.TAG_NAME,"dispatch","dv byteLength is",i.byteLength,"and return")}}}class Od extends Ud{constructor(e){super(e),e.debug.log("WebTransportDemux","init")}destroy(){this.player.debug.log("WebTransportDemux","destroy"),super.destroy()}}var Nd,jd=Ir((function(e){e.exports=function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},e.exports.__esModule=!0,e.exports.default=e.exports})),zd=(Nd=jd)&&Nd.__esModule&&Object.prototype.hasOwnProperty.call(Nd,"default")?Nd.default:Nd;class Gd extends Dd{constructor(e){super(e),zd(this,"TAG_NAME","NakedFlowDemux"),this.lastBuf=null,this.vps=null,this.sps=null,this.pps=null,this.streamVideoType=null,this.streamAudioType=null,this.tempNaluBufferList=new Uint8Array(0),this.localDts=0,this.isSendSeqHeader=!1,this.isSendAACSeqHeader=!1,e.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.lastBuf=null,this.vps=null,this.sps=null,this.pps=null,this.streamVideoType=null,this.streamAudioType=null,this.tempNaluBufferList=new Uint8Array(0),this.localDts=0,this.localAudioDts=0,this.isSendSeqHeader=!1,this.isSendAACSeqHeader=!1,this.player.debug.log(this.TAG_NAME,"destroy")}dispatch(e){this.player;const t=new Uint8Array(e);this.extractNALu$2(t)}addNaluToBuffer(e){const t=e.byteLength+this.tempNaluBufferList.byteLength,i=new Uint8Array(t);i.set(this.tempNaluBufferList,0),i.set(e,this.tempNaluBufferList.byteLength),this.tempNaluBufferList=i}downloadNakedFlowFile(){const e=new Blob([this.tempNaluBufferList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".h264",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadTempNalu",e)}}getNaluDts(){const e=this.player._opt.nakedFlowFps;return this.localDts=this.localDts+parseInt(1e3/e),this.localDts}getNaluAudioDts(){const e=this.player.audio.audioContext.sampleRate,t=this.player.audio.audioBufferSize;return this.localDts+parseInt(t/e*1e3)}extractNALu(e){let t,i,s=0,r=e.byteLength,a=0,o=[];for(;s1)for(let e=0;e>1,i!==jt&&i!==Gt&&i!==Vt||(t=wt)),t}(t)),this.streamVideoType===St){const e=this.handleAddNaluStartCode(t),i=this.extractNALu(e);if(0===i.length)return void this.player.debug.warn(this.TAG_NAME,"handleVideoNalu","naluList.length === 0");const s=[];if(i.forEach((e=>{const t=Cn(e);t===Rt||t===xt?this.handleVideoH264Nalu(e):Rn(t)&&s.push(e)})),1===s.length)this.handleVideoH264Nalu(s[0]);else{const e=function(e){if(0===e.length)return!1;const t=Cn(e[0]);for(let i=1;i{this.handleVideoH264Nalu(e)}))}}else if(this.streamVideoType===wt)if(this.player._opt.nakedFlowH265DemuxUseNew){const e=this.handleAddNaluStartCode(t),i=this.extractNALu(e);if(0===i.length)return void this.player.debug.warn(this.TAG_NAME,"handleVideoNalu","h265 naluList.length === 0");const s=[];if(i.forEach((e=>{const t=zn(e);t===Vt||t===Gt||t===jt?this.handleVideoH265Nalu(e):Gn(t)&&s.push(e)})),1===s.length)this.handleVideoH265Nalu(s[0]);else{const e=function(e){if(0===e.length)return!1;const t=zn(e[0]);for(let i=1;i{this.handleVideoH265Nalu(e)}))}}else{zn(t)===Vt?this.extractH265PPS(t):this.handleVideoH265Nalu(t)}else this.player.debug.error(this.TAG_NAME," this.streamVideoType is null")}extractH264PPS(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{xn(Cn(e))?this.extractH264SEI(e):this.handleVideoH264Nalu(e)}))}extractH265PPS(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{const t=zn(e);t===Wt?this.extractH265SEI(e):this.handleVideoH265Nalu(e)}))}extractH264SEI(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{this.handleVideoH264Nalu(e)}))}extractH265SEI(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{this.handleVideoH265Nalu(e)}))}handleAddNaluStartCode(e){const t=[0,0,0,1],i=new Uint8Array(e.length+t.length);return i.set(t),i.set(e,t.length),i}handleAudioAACNalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=kt.AAC);let t=new Uint8Array(e);const i=t.slice(0,7);if(t=t.slice(7),!this.isSendAACSeqHeader){const e=(192&i[2])>>6,t=(60&i[2])>>2,s=(1&i[2])<<2|(192&i[3])>>6,r=new Uint8Array([175,0,e<<3|(14&t)>>1,(1&t)<<7|s<<3]);this.isSendAACSeqHeader=!0,this._doDecode(r,Ne,0,!1,0)}const s=this.getNaluAudioDts(),r=new Uint8Array(t.length+2);r.set([175,1],0),r.set(t,2),this._doDecode(r,Ne,s,!1,0)}handleAudioG711ANalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=kt.ALAW);let t=new Uint8Array(e);const i=this.getNaluAudioDts(),s=new Uint8Array(t.length+1);s.set([114],0),s.set(t,1),this._doDecode(s,Ne,i,!1,0)}handleAudioG711UNalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=kt.MULAW);let t=new Uint8Array(e);const i=this.getNaluAudioDts(),s=new Uint8Array(t.length+1);s.set([130],0),s.set(t,1),this._doDecode(s,Ne,i,!1,0)}handleVideoH264Nalu(e){const t=Cn(e);switch(t){case xt:this.sps=e;break;case Rt:this.pps=e}if(this.isSendSeqHeader){if(this.sps&&this.pps){const e=Tn({sps:this.sps,pps:this.pps}),t=this.getNaluDts();this._doDecode(e,je,t,!0,0),this.sps=null,this.pps=null}if(Rn(t)){this.player._times.demuxStart||(this.player._times.demuxStart=aa());const i=Dn(t),s=this.getNaluDts(),r=function(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}(e,i);this._preDoDecode(r,je,s,i,0)}else this.player.debug.warn(this.TAG_NAME,`handleVideoH264Nalu is avc seq head nalType is ${t}`)}else if(this.sps&&this.pps){this.isSendSeqHeader=!0;const e=Tn({sps:this.sps,pps:this.pps});this._doDecode(e,je,0,!0,0),this.sps=null,this.pps=null}}handleVideoH264NaluList(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=aa());const i=this.getNaluDts(),s=kn(e.reduce(((e,t)=>{const i=ea(e),s=ea(t),r=new Uint8Array(i.byteLength+s.byteLength);return r.set(i,0),r.set(s,i.byteLength),r})),t);this._preDoDecode(s,je,i,t,0)}else this.player.debug.warn(this.TAG_NAME,"handleVideoH264NaluList isSendSeqHeader is false")}handleVideoH265Nalu(e){const t=zn(e);switch(t){case jt:this.vps=e;break;case Gt:this.sps=e;break;case Vt:this.pps=e}if(this.isSendSeqHeader){if(this.vps&&this.sps&&this.pps){const e=Nn({vps:this.vps,sps:this.sps,pps:this.pps}),t=this.getNaluDts();this._doDecode(e,je,t,!0,0),this.vps=null,this.sps=null,this.pps=null}if(Gn(t)){this.player._times.demuxStart||(this.player._times.demuxStart=aa());const i=Hn(t),s=this.getNaluDts(),r=function(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}(e,i);this._preDoDecode(r,je,s,i,0)}}else if(this.vps&&this.sps&&this.pps){this.isSendSeqHeader=!0;const e=Nn({vps:this.vps,sps:this.sps,pps:this.pps});this._doDecode(e,je,0,!0,0),this.vps=null,this.sps=null,this.pps=null}}handleVideoH265NaluList(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=aa());const i=this.getNaluDts(),s=jn(e.reduce(((e,t)=>{const i=ea(e),s=ea(t),r=new Uint8Array(i.byteLength+s.byteLength);return r.set(i,0),r.set(s,i.byteLength),r})),t);this._preDoDecode(s,je,i,t,0)}else this.player.debug.warn(this.TAG_NAME,"handleVideoH265NaluList isSendSeqHeader is false")}_preDoDecode(e,t,i,s,r){this.player.updateStats({vbps:e.byteLength,dts:i}),s&&this.calcIframeIntervalTimestamp(i),this._doDecode(e,je,i,s,r)}getInputByteLength(){let e=0;return this.lastBuf&&(e=this.lastBuf.byteLength),e}}class Hd extends Dd{constructor(e){super(e),this.player=e,e.debug.log("EmptyDemux","init")}destroy(){super.destroy(),this.player.debug.log("EmptyDemux","destroy")}}var Vd=Ir((function(e,t){var s,r,a,o=(s=new Date,r=4,a={setLogLevel:function(e){r=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=r&&console.debug("["+o.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=r&&console.info("["+o.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=r&&console.warn("["+o.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=r&&console.error("["+o.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)}},a);o.getDurationString=function(e,t){var i;function s(e,t){for(var i=(""+e).split(".");i[0].length0){for(var i="",s=0;s0&&(i+=","),i+="["+o.getDurationString(e.start(s))+","+o.getDurationString(e.end(s))+"]";return i}return"(empty)"},t.Log=o;var n=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};n.prototype.getPosition=function(){return this.position},n.prototype.getEndPosition=function(){return this.buffer.byteLength},n.prototype.getLength=function(){return this.buffer.byteLength},n.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},n.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},n.prototype.readAnyInt=function(e,t){var i=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:i=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:i=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";i=this.dataview.getUint8(this.position)<<16,i|=this.dataview.getUint8(this.position+1)<<8,i|=this.dataview.getUint8(this.position+2);break;case 4:i=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";i=this.dataview.getUint32(this.position)<<32,i|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,i}throw"Not enough bytes in buffer"},n.prototype.readUint8=function(){return this.readAnyInt(1,!1)},n.prototype.readUint16=function(){return this.readAnyInt(2,!1)},n.prototype.readUint24=function(){return this.readAnyInt(3,!1)},n.prototype.readUint32=function(){return this.readAnyInt(4,!1)},n.prototype.readUint64=function(){return this.readAnyInt(8,!1)},n.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",i=0;ithis._byteLength&&(this._byteLength=t);else{for(i<1&&(i=1);t>i;)i*=2;var s=new ArrayBuffer(i),r=new Uint8Array(this._buffer);new Uint8Array(s,0,r.length).set(r),this.buffer=s,this._byteLength=t}}},l.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),i=new Uint8Array(this._buffer,0,t.length);t.set(i),this.buffer=e}},l.BIG_ENDIAN=!1,l.LITTLE_ENDIAN=!0,l.prototype._byteLength=0,Object.defineProperty(l.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(l.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(l.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(l.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),l.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},l.prototype.isEof=function(){return this.position>=this._byteLength},l.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},l.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Int32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Int16Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return l.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},l.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Uint32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Uint16Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return l.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},l.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var i=new Float64Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Float32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},l.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},l.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},l.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},l.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},l.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,l.memcpy=function(e,t,i,s,r){var a=new Uint8Array(e,t,r),o=new Uint8Array(i,s,r);a.set(o)},l.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},l.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},l.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i=0;ir;s--,r++){var a=t[r];t[r]=t[s],t[s]=a}return e},l.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],i=0;i>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},l.prototype.adjustUint32=function(e,t){var i=this.position;this.seek(e),this.writeUint32(t),this.seek(i)},l.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var i=new Int32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},l.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var i=new Int16Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},l.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},l.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var i=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},l.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var i=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},l.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var i=new Float64Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=8*e,i},l.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var i=new Float32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i};var h=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(h.prototype=new l(new ArrayBuffer,0,l.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,o.debug("MultiBufferStream","Stream ready for parsing"),!0):(o.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(o.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){o.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),i.buffer},h.prototype.reduceBuffer=function(e,t,i){var s;return(s=new Uint8Array(i)).set(new Uint8Array(e,t,i)),s.buffer.fileStart=e.fileStart+t,s.buffer.usedBytes=0,s.buffer},h.prototype.insertBuffer=function(e){for(var t=!0,i=0;is.byteLength){this.buffers.splice(i,1),i--;continue}o.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=s.fileStart||(e=this.reduceBuffer(e,0,s.fileStart-e.fileStart)),o.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(i,0,e),0===i&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,r,a)}}t&&(o.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===i&&(this.buffer=e))},h.prototype.logBufferLevel=function(e){var t,i,s,r,a,n=[],l="";for(s=0,r=0,t=0;t0&&(l+=a.end-1+"]");var d=e?o.info:o.debug;0===this.buffers.length?d("MultiBufferStream","No more buffer in memory"):d("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+s+"/"+r+" bytes), continuous ranges: "+l)},h.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},h.prototype.findPosition=function(e,t,i){var s,r=null,a=-1;for(s=!0===e?0:this.bufferIndex;s=t?(o.debug("MultiBufferStream","Found position in existing buffer #"+a),a):-1},h.prototype.findEndContiguousBuf=function(e){var t,i,s,r=void 0!==e?e:this.bufferIndex;if(i=this.buffers[r],this.buffers.length>r+1)for(t=r+1;t>3;return 31===s&&i.data.length>=2&&(s=32+((7&i.data[0])<<3)+((224&i.data[1])>>5)),s}return null},i.DecoderConfigDescriptor=function(e){i.Descriptor.call(this,4,e)},i.DecoderConfigDescriptor.prototype=new i.Descriptor,i.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},i.DecoderSpecificInfo=function(e){i.Descriptor.call(this,5,e)},i.DecoderSpecificInfo.prototype=new i.Descriptor,i.SLConfigDescriptor=function(e){i.Descriptor.call(this,6,e)},i.SLConfigDescriptor.prototype=new i.Descriptor,this};t.MPEG4DescriptorParser=c;var u={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){u.FullBox.prototype=new u.Box,u.ContainerBox.prototype=new u.Box,u.SampleEntry.prototype=new u.Box,u.TrackGroupTypeBox.prototype=new u.FullBox,u.BASIC_BOXES.forEach((function(e){u.createBoxCtor(e)})),u.FULL_BOXES.forEach((function(e){u.createFullBoxCtor(e)})),u.CONTAINER_BOXES.forEach((function(e){u.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,i){this.type=e,this.size=t,this.uuid=i},FullBox:function(e,t,i){u.Box.call(this,e,t,i),this.flags=0,this.version=0},ContainerBox:function(e,t,i){u.Box.call(this,e,t,i),this.boxes=[]},SampleEntry:function(e,t,i,s){u.ContainerBox.call(this,e,t),this.hdr_size=i,this.start=s},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){u.FullBox.call(this,e,t)},createBoxCtor:function(e,t){u.boxCodes.push(e),u[e+"Box"]=function(t){u.Box.call(this,e,t)},u[e+"Box"].prototype=new u.Box,t&&(u[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){u[e+"Box"]=function(t){u.FullBox.call(this,e,t)},u[e+"Box"].prototype=new u.FullBox,u[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,i=0;ii?(o.error("BoxParser","Box of type '"+h+"' has a size "+d+" greater than its container size "+i),{code:u.ERR_NOT_ENOUGH_DATA,type:h,size:d,hdr_size:l,start:n}):0!==d&&n+d>e.getEndPosition()?(e.seek(n),o.info("BoxParser","Not enough data in stream to parse the entire '"+h+"' box"),{code:u.ERR_NOT_ENOUGH_DATA,type:h,size:d,hdr_size:l,start:n}):t?{code:u.OK,type:h,size:d,hdr_size:l,start:n}:(u[h+"Box"]?s=new u[h+"Box"](d):"uuid"!==h?(o.warn("BoxParser","Unknown box type: '"+h+"'"),(s=new u.Box(h,d)).has_unparsed_data=!0):u.UUIDBoxes[a]?s=new u.UUIDBoxes[a](d):(o.warn("BoxParser","Unknown uuid type: '"+a+"'"),(s=new u.Box(h,d)).uuid=a,s.has_unparsed_data=!0),s.hdr_size=l,s.start=n,s.write===u.Box.prototype.write&&"mdat"!==s.type&&(o.info("BoxParser","'"+c+"' box writing not yet implemented, keeping unparsed data in memory for later write"),s.parseDataAndRewind(e)),s.parse(e),(r=e.getPosition()-(s.start+s.size))<0?(o.warn("BoxParser","Parsing of box '"+c+"' did not read the entire indicated box data size (missing "+-r+" bytes), seeking forward"),e.seek(s.start+s.size)):r>0&&(o.error("BoxParser","Parsing of box '"+c+"' read "+r+" more bytes than the indicated box data size, seeking backwards"),0!==s.size&&e.seek(s.start+s.size)),{code:u.OK,box:s,size:s.size})},u.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},u.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},u.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},u.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},u.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},u.ContainerBox.prototype.parse=function(e){for(var t,i;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},u.SAMPLE_ENTRY_TYPE_VISUAL="Visual",u.SAMPLE_ENTRY_TYPE_AUDIO="Audio",u.SAMPLE_ENTRY_TYPE_HINT="Hint",u.SAMPLE_ENTRY_TYPE_METADATA="Metadata",u.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",u.SAMPLE_ENTRY_TYPE_SYSTEM="System",u.SAMPLE_ENTRY_TYPE_TEXT="Text",u.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},u.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},u.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},u.SampleEntry.prototype.parseFooter=function(e){u.ContainerBox.prototype.parse.call(this,e)},u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_HINT),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_METADATA),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SUBTITLE),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SYSTEM),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_TEXT),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_TEXT,"enct"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_METADATA,"encm"),u.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var i=0;i<3;i++)this.layer_size[i]=16==t?e.readUint16():e.readUint32()})),u.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),u.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),u.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)o.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void o.error("av1C reserved_2 parsing problem");var i=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(i)}else o.error("av1C reserved_1 parsing problem");else o.error("av1C version "+this.version+" not supported")})),u.createBoxCtor("avcC",(function(e){var t,i;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),i=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(i))})),u.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),u.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),u.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),u.createFullBoxCtor("co64",(function(e){var t,i;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(i=0;i>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),u.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),u.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),u.createFullBoxCtor("ctts",(function(e){var t,i;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(i=0;i>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|i>>6&3,this.acmod=i>>3&7,this.lfeon=i>>2&1,this.bit_rate_code=3&i|s>>5&7})),u.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var i=0;i>6,s.bsid=r>>1&31,s.bsmod=(1&r)<<4|a>>4&15,s.acmod=a>>1&7,s.lfeon=1&a,s.num_dep_sub=o>>1&15,s.num_dep_sub>0&&(s.chan_loc=(1&o)<<8|e.readUint8())}})),u.createFullBoxCtor("dfLa",(function(e){var t=[],i=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var s=e.readUint8(),r=Math.min(127&s,i.length-1);if(r?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(i[r]),128&s)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),u.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),u.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),u.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),u.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[i]=e.readString(4),t-=4,i++})),u.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),u.createBoxCtor("hvcC",(function(e){var t,i,s,r;this.configurationVersion=e.readUint8(),r=e.readUint8(),this.general_profile_space=r>>6,this.general_tier_flag=(32&r)>>5,this.general_profile_idc=31&r,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),r=e.readUint8(),this.constantFrameRate=r>>6,this.numTemporalLayers=(13&r)>>3,this.temporalIdNested=(4&r)>>2,this.lengthSizeMinusOne=3&r,this.nalu_arrays=[];var a=e.readUint8();for(t=0;t>7,o.nalu_type=63&r;var n=e.readUint16();for(i=0;i>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var i=0;if(this.version<2)i=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";i=e.readUint32()}for(var s=0;s>7,this.axis=1&t})),u.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),o.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),u.createFullBoxCtor("ipma",(function(e){var t,i;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?o.property_index=(127&a)<<8|e.readUint8():o.property_index=127&a}}})),u.createFullBoxCtor("iref",(function(e){var t,i;for(this.references=[];e.getPosition()>7,s.assignment_type=127&r,s.assignment_type){case 0:s.grouping_type=e.readString(4);break;case 1:s.grouping_type=e.readString(4),s.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:s.sub_track_id=e.readUint32();break;default:o.warn("BoxParser","Unknown leva assignement type")}}})),u.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),u.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),p.prototype.toString=function(){return"("+this.x+","+this.y+")"},u.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new p(e.readUint16(),e.readUint16()),this.display_primaries[1]=new p(e.readUint16(),e.readUint16()),this.display_primaries[2]=new p(e.readUint16(),e.readUint16()),this.white_point=new p(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),u.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),u.createFullBoxCtor("mehd",(function(e){1&this.flags&&(o.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),u.createFullBoxCtor("meta",(function(e){this.boxes=[],u.ContainerBox.prototype.parse.call(this,e)})),u.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),u.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),u.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),u.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),u.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),u.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),u.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var i=0;i0){var t=e.readUint32();this.kid=[];for(var i=0;i0&&(this.data=e.readUint8Array(s))})),u.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),u.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),u.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var i=0;i>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var i=e.readUint8(),s=0;s>7,this.num_leading_samples=127&t})),u.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)o.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=u.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),u.createSampleGroupCtor("stsa",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),u.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),u.createSampleGroupCtor("tsas",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("tscl",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("vipr",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),i=0;i>6,this.sample_depends_on[s]=t>>4&3,this.sample_is_depended_on[s]=t>>2&3,this.sample_has_redundancy[s]=3&t})),u.createFullBoxCtor("senc"),u.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),o.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),i=0;i>31&1,s.referenced_size=2147483647&r,s.subsegment_duration=e.readUint32(),r=e.readUint32(),s.starts_with_SAP=r>>31&1,s.SAP_type=r>>28&7,s.SAP_delta_time=268435455&r}})),u.SingleItemTypeReferenceBox=function(e,t,i,s){u.Box.call(this,e,t),this.hdr_size=i,this.start=s},u.SingleItemTypeReferenceBox.prototype=new u.Box,u.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var i=0;i>4&15,this.sample_sizes[t+1]=15&s}else if(8===this.field_size)for(t=0;t0)for(i=0;i>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=u.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),u.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),u.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),u.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var i=e.readUint32(),s=0;s>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),u.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),u.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),u.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),u.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),u.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),u.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},u.createTrackGroupCtor("msrc"),u.TrackReferenceTypeBox=function(e,t,i,s){u.Box.call(this,e,t),this.hdr_size=i,this.start=s},u.TrackReferenceTypeBox.prototype=new u.Box,u.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},u.trefBox.prototype.parse=function(e){for(var t,i;e.getPosition()t&&this.flags&u.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&u.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var i=0;i>7&1,this.block_pad_lsb=i>>6&1,this.block_little_endian=i>>5&1,this.block_reversed=i>>4&1,this.pad_unknown=i>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),u.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),u.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),u.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),u.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=u.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),u.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),u.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=u.parseHex16(e)})),u.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),u.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),u.createFullBoxCtor("vvcC",(function(e){var t,i,s={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(s.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,i=this.num_sublayers-2;i>=0;--i){var o=s.extract_bits(1);this.ptl_sublayer_present_mask|=o<1;++i)s.extract_bits(1);for(this.sublayer_level_idc=[],i=this.num_sublayers-2;i>=0;--i)this.ptl_sublayer_present_mask&1<>=1;t+=u.decimalToHex(s,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var r=!1,a="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||r)&&(a="."+u.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+a,r=!0);t+=a}return t},u.vvc1SampleEntry.prototype.getCodec=u.vvi1SampleEntry.prototype.getCodec=function(){var e,t=u.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var i="";if(this.vvcC.general_constraint_info){var s,r=[],a=0;for(a|=this.vvcC.ptl_frame_only_constraint<<7,a|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,r.push(a),a&&(s=e),a=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===s)i=".CA";else{i=".C";var o="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",n=0,l=0;for(e=0;e<=s;++e)for(n=n<<8|r[e],l+=8;l>=5;){i+=o[n>>l-5&31],n&=(1<<(l-=5))-1}l&&(i+=o[31&(n<<=5-l)])}}t+=i}return t},u.mp4aSampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),i=this.esds.esd.getAudioConfig();return e+"."+u.decimalToHex(t)+(i?"."+i:"")}return e},u.stxtSampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},u.vp08SampleEntry.prototype.getCodec=u.vp09SampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var i=this.vpcC.bitDepth;return 8==i&&(i="08"),e+".0"+this.vpcC.profile+"."+t+"."+i},u.av01SampleEntry.prototype.getCodec=function(){var e,t=u.SampleEntry.prototype.getCodec.call(this),i=this.av1C.seq_level_idx_0;return i<10&&(i="0"+i),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+i+(this.av1C.seq_tier_0?"H":"M")+"."+e},u.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>d&&(this.size+=8),"uuid"===this.type&&(this.size+=16),o.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>d?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>d&&e.writeUint64(this.size)},u.FullBox.prototype.writeHeader=function(e){this.size+=4,u.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},u.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},u.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},u.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&u.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&u.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&u.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&u.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&u.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},u.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},u.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},u.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&u.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&u.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&u.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&u.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&u.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&u.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&u.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&u.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[i]instanceof u.Box||t[i]instanceof u.Box||void 0===e[i]||void 0===t[i]||"function"==typeof e[i]||"function"==typeof t[i]||e.subBoxNames&&e.subBoxNames.indexOf(i.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(i.slice(0,4))>-1||"data"===i||"start"===i||"size"===i||"creation_time"===i||"modification_time"===i||u.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(i)>-1||e[i]===t[i]))return!1;return!0},u.boxEqual=function(e,t){if(!u.boxEqualFields(e,t))return!1;for(var i=0;i1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},y.prototype.setExtractionOptions=function(e,t,i){var s=this.getTrackById(e);if(s){var r={};this.extractedTracks.push(r),r.id=e,r.user=t,r.trak=s,s.nextSample=0,r.nb_samples=1e3,r.samples=[],i&&i.nbSamples&&(r.nb_samples=i.nbSamples)}},y.prototype.unsetExtractionOptions=function(e){for(var t=-1,i=0;i-1&&this.extractedTracks.splice(t,1)},y.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=u.parseOneBox(this.stream,false)).code===u.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var i;switch(i="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),i){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[i]&&o.warn("ISOFile","Duplicate Box of type: "+i+", overriding previous occurrence"),this[i]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},y.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(o.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(o.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(o.warn("ISOFile","Not ready to start parsing"),!1))},y.prototype.appendBuffer=function(e,t){var i;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(i=this.nextSeekPosition,this.nextSeekPosition=void 0):i=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(i=this.stream.getEndFilePositionAfter(i))):i=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(o.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+i),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),o.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),i},y.prototype.getInfo=function(){var e,t,i,s,r,a,o={},n=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(o.hasMoov=!0,o.duration=this.moov.mvhd.duration,o.timescale=this.moov.mvhd.timescale,o.isFragmented=null!=this.moov.mvex,o.isFragmented&&this.moov.mvex.mehd&&(o.fragment_duration=this.moov.mvex.mehd.fragment_duration),o.isProgressive=this.isProgressive,o.hasIOD=null!=this.moov.iods,o.brands=[],o.brands.push(this.ftyp.major_brand),o.brands=o.brands.concat(this.ftyp.compatible_brands),o.created=new Date(n+1e3*this.moov.mvhd.creation_time),o.modified=new Date(n+1e3*this.moov.mvhd.modification_time),o.tracks=[],o.audioTracks=[],o.videoTracks=[],o.subtitleTracks=[],o.metadataTracks=[],o.hintTracks=[],o.otherTracks=[],e=0;e0?o.mime+='video/mp4; codecs="':o.audioTracks&&o.audioTracks.length>0?o.mime+='audio/mp4; codecs="':o.mime+='application/mp4; codecs="',e=0;e=i.samples.length)&&(o.info("ISOFile","Sending fragmented data on track #"+s.id+" for samples ["+Math.max(0,i.nextSample-s.nb_samples)+","+(i.nextSample-1)+"]"),o.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(s.id,s.user,s.segmentStream.buffer,i.nextSample,e||i.nextSample>=i.samples.length),s.segmentStream=null,s!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=i.samples.length)&&(o.debug("ISOFile","Sending samples on track #"+a.id+" for sample "+i.nextSample),this.onSamples&&this.onSamples(a.id,a.user,a.samples),a.samples=[],a!==this.extractedTracks[t]))break}}}},y.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},y.prototype.getBoxes=function(e,t){var i=[];return y._sweep.call(this,e,i,t),i},y._sweep=function(e,t,i){for(var s in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&i)return;y._sweep.call(this.boxes[s],e,t,i)}},y.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},y.prototype.getTrackSample=function(e,t){var i=this.getTrackById(e);return this.getSample(i,t)},y.prototype.releaseUsedSamples=function(e,t){var i=0,s=this.getTrackById(e);s.lastValidSample||(s.lastValidSample=0);for(var r=s.lastValidSample;re*r.timescale){d=s-1;break}t&&r.is_sync&&(l=s)}for(t&&(d=l),e=i.samples[d].cts,i.nextSample=d;i.samples[d].alreadyRead===i.samples[d].size&&i.samples[d+1];)d++;return a=i.samples[d].offset+i.samples[d].alreadyRead,o.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+i.nextSample+" on track "+i.tkhd.track_id+", time "+o.getDurationString(e,n)+" and offset: "+a),{offset:a,time:e/n}},y.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},y.prototype.seek=function(e,t){var i,s,r,a=this.moov,n={offset:1/0,time:1/0};if(this.moov){for(r=0;rthis.getTrackDuration(i)||((s=this.seekTrack(e,t,i)).offset-1){o=l;break}switch(o){case"Visual":if(r.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),a.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var c=new u.avcCBox;c.parse(new n(t.avcDecoderConfigRecord)),a.addBox(c)}else if(t.hevcDecoderConfigRecord){var p=new u.hvcCBox;p.parse(new n(t.hevcDecoderConfigRecord)),a.addBox(p)}break;case"Audio":r.add("smhd").set("balance",t.balance||0),a.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":r.add("hmhd");break;case"Subtitle":if(r.add("sthd"),"stpp"===t.type)a.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:r.add("nmhd")}t.description&&a.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){a.addBox(e)})),r.add("dinf").add("dref").addEntry((new u["url Box"]).set("flags",1));var f=r.add("stbl");return f.add("stsd").addEntry(a),f.add("stts").set("sample_counts",[]).set("sample_deltas",[]),f.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),f.add("stco").set("chunk_offsets",[]),f.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(i),t.id}},u.Box.prototype.computeSize=function(e){var t=e||new l;t.endianness=l.BIG_ENDIAN,this.write(t)},y.prototype.addSample=function(e,t,i){var s=i||{},r={},a=this.getTrackById(e);if(null!==a){r.number=a.samples.length,r.track_id=a.tkhd.track_id,r.timescale=a.mdia.mdhd.timescale,r.description_index=s.sample_description_index?s.sample_description_index-1:0,r.description=a.mdia.minf.stbl.stsd.entries[r.description_index],r.data=t,r.size=t.byteLength,r.alreadyRead=r.size,r.duration=s.duration||1,r.cts=s.cts||0,r.dts=s.dts||0,r.is_sync=s.is_sync||!1,r.is_leading=s.is_leading||0,r.depends_on=s.depends_on||0,r.is_depended_on=s.is_depended_on||0,r.has_redundancy=s.has_redundancy||0,r.degradation_priority=s.degradation_priority||0,r.offset=0,r.subsamples=s.subsamples,a.samples.push(r),a.samples_size+=r.size,a.samples_duration+=r.duration,void 0===a.first_dts&&(a.first_dts=s.dts),this.processSamples();var o=this.createSingleSampleMoof(r);return this.addBox(o),o.computeSize(),o.trafs[0].truns[0].data_offset=o.size+8,this.add("mdat").data=new Uint8Array(t),r}},y.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var i=new u.moofBox;i.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var s=i.add("traf"),r=this.getTrackById(e.track_id);return s.add("tfhd").set("track_id",e.track_id).set("flags",u.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),s.add("tfdt").set("baseMediaDecodeTime",e.dts-(r.first_dts||0)),s.add("trun").set("flags",u.TRUN_FLAGS_DATA_OFFSET|u.TRUN_FLAGS_DURATION|u.TRUN_FLAGS_SIZE|u.TRUN_FLAGS_FLAGS|u.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),i},y.prototype.lastMoofIndex=0,y.prototype.samplesDataSize=0,y.prototype.resetTables=function(){var e,t,i,s,r,a;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(l=r[o].grouping_type+"/0",(n=new d(r[o].grouping_type,0)).is_fragment=!0,t.sample_groups_info[l]||(t.sample_groups_info[l]=n))}else for(o=0;o=2&&(l=s[o].grouping_type+"/0",n=new d(s[o].grouping_type,0),e.sample_groups_info[l]||(e.sample_groups_info[l]=n))},y.setSampleGroupProperties=function(e,t,i,s){var r,a;for(r in t.sample_groups=[],s){var o;if(t.sample_groups[r]={},t.sample_groups[r].grouping_type=s[r].grouping_type,t.sample_groups[r].grouping_type_parameter=s[r].grouping_type_parameter,i>=s[r].last_sample_in_run&&(s[r].last_sample_in_run<0&&(s[r].last_sample_in_run=0),s[r].entry_index++,s[r].entry_index<=s[r].sbgp.entries.length-1&&(s[r].last_sample_in_run+=s[r].sbgp.entries[s[r].entry_index].sample_count)),s[r].entry_index<=s[r].sbgp.entries.length-1?t.sample_groups[r].group_description_index=s[r].sbgp.entries[s[r].entry_index].group_description_index:t.sample_groups[r].group_description_index=-1,0!==t.sample_groups[r].group_description_index)o=s[r].fragment_description?s[r].fragment_description:s[r].description,t.sample_groups[r].group_description_index>0?(a=t.sample_groups[r].group_description_index>65535?(t.sample_groups[r].group_description_index>>16)-1:t.sample_groups[r].group_description_index-1,o&&a>=0&&(t.sample_groups[r].description=o.entries[a])):o&&o.version>=2&&o.default_group_description_index>0&&(t.sample_groups[r].description=o.entries[o.default_group_description_index-1])}},y.process_sdtp=function(e,t,i){t&&(e?(t.is_leading=e.is_leading[i],t.depends_on=e.sample_depends_on[i],t.is_depended_on=e.sample_is_depended_on[i],t.has_redundancy=e.sample_has_redundancy[i]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},y.prototype.buildSampleLists=function(){var e,t;for(e=0;eb&&(v++,b<0&&(b=0),b+=a.sample_counts[v]),t>0?(e.samples[t-1].duration=a.sample_deltas[v],e.samples_duration+=e.samples[t-1].duration,k.dts=e.samples[t-1].dts+e.samples[t-1].duration):k.dts=0,o?(t>=_&&(S++,_<0&&(_=0),_+=o.sample_counts[S]),k.cts=e.samples[t].dts+o.sample_offsets[S]):k.cts=k.dts,n?(t==n.sample_numbers[w]-1?(k.is_sync=!0,w++):(k.is_sync=!1,k.degradation_priority=0),d&&d.entries[E].sample_delta+T==t+1&&(k.subsamples=d.entries[E].subsamples,T+=d.entries[E].sample_delta,E++)):k.is_sync=!0,y.process_sdtp(e.mdia.minf.stbl.sdtp,k,k.number),k.degradation_priority=u?u.priority[t]:0,d&&d.entries[E].sample_delta+T==t&&(k.subsamples=d.entries[E].subsamples,T+=d.entries[E].sample_delta),(h.length>0||c.length>0)&&y.setSampleGroupProperties(e,k,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},y.prototype.updateSampleLists=function(){var e,t,i,s,r,a,o,n,l,d,h,c,p,f,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&y.initSampleGroups(c,h,h.sbgps,c.mdia.minf.stbl.sgpds,h.sgpds),t=0;t0?f.dts=c.samples[c.samples.length-2].dts+c.samples[c.samples.length-2].duration:(h.tfdt?f.dts=h.tfdt.baseMediaDecodeTime:f.dts=0,c.first_traf_merged=!0),f.cts=f.dts,g.flags&u.TRUN_FLAGS_CTS_OFFSET&&(f.cts=f.dts+g.sample_composition_time_offset[i]),m=o,g.flags&u.TRUN_FLAGS_FLAGS?m=g.sample_flags[i]:0===i&&g.flags&u.TRUN_FLAGS_FIRST_FLAG&&(m=g.first_sample_flags),f.is_sync=!(m>>16&1),f.is_leading=m>>26&3,f.depends_on=m>>24&3,f.is_depended_on=m>>22&3,f.has_redundancy=m>>20&3,f.degradation_priority=65535&m;var A=!!(h.tfhd.flags&u.TFHD_FLAG_BASE_DATA_OFFSET),b=!!(h.tfhd.flags&u.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),v=!!(g.flags&u.TRUN_FLAGS_DATA_OFFSET),_=0;_=A?h.tfhd.base_data_offset:b||0===t?d.start:n,f.offset=0===t&&0===i?v?_+g.data_offset:_:n,n=f.offset+f.size,(h.sbgps.length>0||h.sgpds.length>0||c.mdia.minf.stbl.sbgps.length>0||c.mdia.minf.stbl.sgpds.length>0)&&y.setSampleGroupProperties(c,f,f.number_in_traf,h.sample_groups_info)}}if(h.subs){c.has_fragment_subsamples=!0;var S=h.first_sample_index;for(t=0;t-1))return null;var a=(i=this.stream.buffers[r]).byteLength-(s.offset+s.alreadyRead-i.fileStart);if(s.size-s.alreadyRead<=a)return o.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-i.fileStart)+" read size: "+(s.size-s.alreadyRead)+" full size: "+s.size+")"),l.memcpy(s.data.buffer,s.alreadyRead,i,s.offset+s.alreadyRead-i.fileStart,s.size-s.alreadyRead),i.usedBytes+=s.size-s.alreadyRead,this.stream.logBufferLevel(),s.alreadyRead=s.size,s;if(0===a)return null;o.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-i.fileStart)+" read size: "+a+" full size: "+s.size+")"),l.memcpy(s.data.buffer,s.alreadyRead,i,s.offset+s.alreadyRead-i.fileStart,a),s.alreadyRead+=a,i.usedBytes+=a,this.stream.logBufferLevel()}},y.prototype.releaseSample=function(e,t){var i=e.samples[t];return i.data?(this.samplesDataSize-=i.size,i.data=null,i.alreadyRead=0,i.size):0},y.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},y.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},y.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(i.protection=a.ipro.protections[a.iinf.item_infos[e].protection_index-1]),a.iinf.item_infos[e].item_type?i.type=a.iinf.item_infos[e].item_type:i.type="mime",i.content_type=a.iinf.item_infos[e].content_type,i.content_encoding=a.iinf.item_infos[e].content_encoding;if(a.grpl)for(e=0;e0&&u.property_index-1-1))return null;var n=(t=this.stream.buffers[a]).byteLength-(r.offset+r.alreadyRead-t.fileStart);if(!(r.length-r.alreadyRead<=n))return o.debug("ISOFile","Getting item #"+e+" extent #"+s+" partial data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+n+" full extent size: "+r.length+" full item size: "+i.size+")"),l.memcpy(i.data.buffer,i.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,n),r.alreadyRead+=n,i.alreadyRead+=n,t.usedBytes+=n,this.stream.logBufferLevel(),null;o.debug("ISOFile","Getting item #"+e+" extent #"+s+" data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+(r.length-r.alreadyRead)+" full extent size: "+r.length+" full item size: "+i.size+")"),l.memcpy(i.data.buffer,i.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,r.length-r.alreadyRead),t.usedBytes+=r.length-r.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead+=r.length-r.alreadyRead,r.alreadyRead=r.length}}return i.alreadyRead===i.size?i:null},y.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var i=0;i0?this.moov.traks[e].samples[0].duration:0),t.push(s)}return t},u.Box.prototype.printHeader=function(e){this.size+=8,this.size>d&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},u.FullBox.prototype.printHeader=function(e){this.size+=4,u.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},u.Box.prototype.print=function(e){this.printHeader(e)},u.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},u.tkhdBox.prototype.print=function(e){u.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var A={createFile:function(e,t){var i=void 0===e||e,s=new y(t);return s.discardMdatData=!i,s}};t.createFile=A.createFile}));function $d(e){return e.reduce(((e,t)=>256*e+t))}function Wd(e){const t=[101,103,119,99],i=e.length-28,s=e.slice(i,i+t.length);return t.every(((e,t)=>e===s[t]))}Vd.Log,Vd.MP4BoxStream,Vd.DataStream,Vd.MultiBufferStream,Vd.MPEG4DescriptorParser,Vd.BoxParser,Vd.XMLSubtitlein4Parser,Vd.Textin4Parser,Vd.ISOFile,Vd.createFile;class Jd{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(i+32,i+32+t))]}return null}(t,this.t);if(!i)return e;const s=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(s instanceof Error)return console.error(s.message),this.d=!0,e;this.A=!0,this.u=i[1],Wd(t)&&this.c++,WebAssembly.instantiate(i[2],s).then((e=>{if(!function(e){return"function"==typeof e.parse&&"object"==typeof e.memory}(e.instance.exports))return this.d=!0,void console.error("video_error_3");this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}class qd extends Dd{constructor(e){super(e),this.TAG_NAME="Fmp4Loader",this.player=e,this.mp4Box=Vd.createFile(),this.tempFmp4List=[],this.offset=0,this.videoTrackId=null,this.audioTrackId=null,this.isHevc=!1,this.transportDescarmber=null,this.player._opt.isFmp4Private&&(this.transportDescarmber=new Jd),this._listenMp4Box(),e.debug.log(this.TAG_NAME,"init")}destroy(){this.mp4Box&&(this.mp4Box.stop(),this.mp4Box.flush(),this.mp4Box.destroy(),this.mp4Box=null),this.transportDescarmber&&(this.transportDescarmber.destroy(),this.transportDescarmber=null),this.tempFmp4List=[],this.offset=0,this.videoTrackId=null,this.audioTrackId=null,this.isHevc=!1,this.player.debug.log(this.TAG_NAME,"destroy")}_listenMp4Box(){this.mp4Box.onReady=this.onReady.bind(this),this.mp4Box.onError=this.onError.bind(this),this.mp4Box.onSamples=this.onSamples.bind(this)}onReady(e){this.player.debug.log(this.TAG_NAME,"onReady",e);const t=e.videoTracks[0],i=e.audioTracks[0];if(t){this.videoTrackId=t.id;const e=this.getSeqHeader(t);e&&(this.player.debug.log(this.TAG_NAME,"seqHeader",e),this._doDecodeByFmp4(e,je,0,!0,0)),this.mp4Box.setExtractionOptions(t.id)}if(i&&this.player._opt.hasAudio){this.audioTrackId=i.id;const e=i.audio||{},t=Nr.indexOf(e.sample_rate),s=i.codec.replace("mp4a.40.","");this.mp4Box.setExtractionOptions(i.id);const r={profile:parseInt(s,10),sampleRate:t,channel:e.channel_count},a=jr(r);this.player.debug.log(this.TAG_NAME,"aacADTSHeader",a,"config",r),this._doDecodeByFmp4(a,Ne,0,!1,0)}this.mp4Box.start()}onError(e){this.player.debug.error(this.TAG_NAME,"mp4Box onError",e)}onSamples(e,t,i){if(e===this.videoTrackId)for(const t of i){const i=t.data,s=t.is_sync,r=1e3*t.cts/t.timescale;t.duration,t.timescale,this.player.updateStats({vbps:i.byteLength,dts:r}),s&&this.calcIframeIntervalTimestamp(r);let a=null;a=this.isHevc?jn(i,s):kn(i,s);let o=this.cryptoPayload(a,s);this._doDecodeByFmp4(o,je,r,s,0),this.mp4Box.releaseUsedSamples(e,t.number)}else if(e===this.audioTrackId){if(this.player._opt.hasAudio)for(const t of i){const i=t.data;this.player.updateStats({abps:i.byteLength});const s=1e3*t.cts/t.timescale;t.duration,t.timescale;const r=new Uint8Array(i.byteLength+2);r.set([175,1],0),r.set(i,2),this._doDecodeByFmp4(r,Ne,s,!1,0),this.mp4Box.releaseUsedSamples(e,t.number)}}else this.player.debug.warn(this.TAG_NAME,"onSamples() trackId error",e)}getSeqHeader(e){const t=this.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new Vd.DataStream(void 0,0,Vd.DataStream.BIG_ENDIAN);let i=[];e.avcC?(e.avcC.write(t),i=[23,0,0,0,0]):(this.isHevc=!0,e.hvcC.write(t),i=[28,0,0,0,0]);const s=new Uint8Array(t.buffer,8),r=new Uint8Array(i.length+s.length);return r.set(i,0),r.set(s,i.length),r}return null}dispatch(e){let t=new Uint8Array(e);this.transportDescarmber&&(t=this.transportDescarmber.transport(t)),t.buffer.fileStart=this.offset,this.offset+=t.byteLength,this.mp4Box.appendBuffer(t.buffer)}downloadFmp4File(){const e=new Blob(this.tempFmp4List,{type:'video/mp4; codecs="avc1.640028,mp4a.40.2"'}),t=URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=aa()+".fmp4",i.click(),URL.revokeObjectURL(t)}getInputByteLength(){let e=0;return this.mp4Box&&(e=this.mp4Box.getAllocatedSampleDataSize()),e}}class Kd extends Dd{constructor(e){super(e),zd(this,"LOG_NAME","Mpeg4Loader"),this.player=e,this.player.debug.log(this.LOG_NAME,"init")}destroy(){super.destroy(),this.player.debug.log(this.LOG_NAME,"destroy")}}function Yd(){for(var e=arguments.length,t=new Array(e),i=0;ie+t.byteLength),0));let r=0;return t.forEach((e=>{s.set(e,r),r+=e.byteLength})),s}const Qd=3,Xd=4,Zd=6,eh=15,th=17,ih=129,sh=135,rh=21,ah=134,oh=27,nh=36;class lh{constructor(){this.slices=[],this.total_length=0,this.expected_length=0,this.random_access_indicator=0}}class dh{constructor(){this.pid=null,this.data=null,this.stream_type=null,this.random_access_indicator=null}}class hh{constructor(){this.pid=null,this.stream_id=null,this.len=null,this.data=null,this.pts=null,this.nearest_pts=null,this.dts=null}}const ch=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];class uh{constructor(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}isComplete(){let e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&e&&t}isSeekable(){return!0===this.hasKeyframesIndex}getNearestKeyframe(e){if(null==this.keyframesIndex)return null;let t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}}_search(e,t){let i=0,s=e.length-1,r=0,a=0,o=s;for(t=e[r]&&t=6?(s=5,t=new Array(4),o=r-3):(s=2,t=new Array(2),o=r):-1!==n.indexOf("android")?(s=2,t=new Array(2),o=r):(s=5,o=r,t=new Array(4),r>=6?o=r-3:1===a&&(s=2,t=new Array(2),o=r)),t[0]=s<<3,t[0]|=(15&r)>>>1,t[1]=(15&r)<<7,t[1]|=(15&a)<<3,5===s&&(t[1]|=(15&o)>>>1,t[2]=(1&o)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=ch[r],this.sampling_index=r,this.channel_count=a,this.object_type=s,this.original_object_type=i,this.codec_mimetype="mp4a.40."+s,this.original_codec_mimetype="mp4a.40."+i}}class fh extends Dd{constructor(e){super(e),this.player=e,this.TAG_NAME="TsLoaderV2",this.first_parse_=!0,this.tsPacketSize=0,this.syncOffset=0,this.pmt_=null,this.config_=null,this.media_info_=new uh,this.timescale_=90,this.duration_=0,this.pat_={version_number:0,network_pid:0,program_map_pid:{}},this.current_program_=null,this.current_pmt_pid_=-1,this.program_pmt_map_={},this.pes_slice_queues_={},this.section_slice_queues_={},this.video_metadata_={vps:null,sps:null,pps:null,details:null},this.audio_metadata_={codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},this.last_pcr_=null,this.audio_last_sample_pts_=void 0,this.aac_last_incomplete_data_=null,this.has_video_=!1,this.has_audio_=!1,this.video_init_segment_dispatched_=!1,this.audio_init_segment_dispatched_=!1,this.video_metadata_changed_=!1,this.audio_metadata_changed_=!1,this.loas_previous_frame=null,this.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._remainingPacketData=null,this.player.debug.log(this.TAG_NAME,"init")}destroy(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,this._remainingPacketData=null,super.destroy()}probe(e){let t=new Uint8Array(e),i=-1,s=188;if(t.byteLength<=3*s)return{needMoreData:!0};for(;-1===i;){let e=Math.min(1e3,t.byteLength-3*s);for(let r=0;r=4&&(i-=4),{match:!0,consumed:0,ts_packet_size:s,sync_offset:i})}_initPmt(){return{program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}}dispatch(e){let t=new Uint8Array(e);this._remainingPacketData&&(t=Yd(this._remainingPacketData,t),this._remainingPacketData=null);let i=t.buffer;const s=this.parseChunks(i);s?this._remainingPacketData=t.subarray(s):t.length>>6;i[1];let a=(31&i[1])<<8|i[2],o=(48&i[3])>>>4,n=15&i[3],l=!(!this.pmt_||this.pmt_.pcr_pid!==a),d={},h=4;if(2==o||3==o){let e=i[4];if(e>0&&(l||3==o)){if(d.discontinuity_indicator=(128&i[5])>>>7,d.random_access_indicator=(64&i[5])>>>6,d.elementary_stream_priority_indicator=(32&i[5])>>>5,(16&i[5])>>>4){let e=300*(i[6]<<25|i[7]<<17|i[8]<<9|i[9]<<1|i[10]>>>7)+((1&i[10])<<8|i[11]);this.last_pcr_=e}}if(2==o||5+e===188){t+=188,204===this.tsPacketSize&&(t+=16);continue}h=5+e}if(1==o||3==o)if(0===a||a===this.current_pmt_pid_||null!=this.pmt_&&this.pmt_.pid_stream_type[a]===ah){let i=188-h;this.handleSectionSlice(e,t+h,i,{pid:a,payload_unit_start_indicator:r,continuity_conunter:n,random_access_indicator:d.random_access_indicator})}else if(null!=this.pmt_&&null!=this.pmt_.pid_stream_type[a]){let i=188-h,s=this.pmt_.pid_stream_type[a];a!==this.pmt_.common_pids.h264&&a!==this.pmt_.common_pids.h265&&a!==this.pmt_.common_pids.adts_aac&&a!==this.pmt_.common_pids.loas_aac&&a!==this.pmt_.common_pids.ac3&&a!==this.pmt_.common_pids.eac3&&a!==this.pmt_.common_pids.opus&&a!==this.pmt_.common_pids.mp3&&!0!==this.pmt_.pes_private_data_pids[a]&&!0!==this.pmt_.timed_id3_pids[a]&&!0!==this.pmt_.synchronous_klv_pids[a]&&!0!==this.pmt_.asynchronous_klv_pids[a]||this.handlePESSlice(e,t+h,i,{pid:a,stream_type:s,payload_unit_start_indicator:r,continuity_conunter:n,random_access_indicator:d.random_access_indicator})}t+=188,204===this.tsPacketSize&&(t+=16)}return this.dispatchAudioVideoMediaSegment(),t}handleSectionSlice(e,t,i,s){let r=new Uint8Array(e,t,i),a=this.section_slice_queues_[s.pid];if(s.payload_unit_start_indicator){let o=r[0];if(null!=a&&0!==a.total_length){let r=new Uint8Array(e,t+1,Math.min(i,o));a.slices.push(r),a.total_length+=r.byteLength,a.total_length===a.expected_length?this.emitSectionSlices(a,s):this.clearSlices(a,s)}for(let n=1+o;n=a.expected_length&&this.clearSlices(a,s),n+=l.byteLength}}else if(null!=a&&0!==a.total_length){let r=new Uint8Array(e,t,Math.min(i,a.expected_length-a.total_length));a.slices.push(r),a.total_length+=r.byteLength,a.total_length===a.expected_length?this.emitSectionSlices(a,s):a.total_length>=a.expected_length&&this.clearSlices(a,s)}}handlePESSlice(e,t,i,s){let r=new Uint8Array(e,t,i),a=r[0]<<16|r[1]<<8|r[2];r[3];let o=r[4]<<8|r[5];if(s.payload_unit_start_indicator){if(1!==a)return void this.player.debug.warn(this.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${a}`);let e=this.pes_slice_queues_[s.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?this.emitPESSlices(e,s):this.clearSlices(e,s)),this.pes_slice_queues_[s.pid]=new lh,this.pes_slice_queues_[s.pid].random_access_indicator=s.random_access_indicator}if(null==this.pes_slice_queues_[s.pid])return;let n=this.pes_slice_queues_[s.pid];n.slices.push(r),s.payload_unit_start_indicator&&(n.expected_length=0===o?0:o+6),n.total_length+=r.byteLength,n.expected_length>0&&n.expected_length===n.total_length?this.emitPESSlices(n,s):n.expected_length>0&&n.expected_length>>6,n=t[8];2!==o&&3!==o||(i=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,a=3===o?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:i);let l,d=9+n;if(0!==r){if(r<3+n)return void this.player.debug.warn(this.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");l=r-3-n}else l=t.byteLength-d;let h=t.subarray(d,d+l);switch(e.stream_type){case Qd:case Xd:this.parseMP3Payload(h,i);break;case Zd:this.pmt_.common_pids.opus===e.pid?this.parseOpusPayload(h,i):this.pmt_.common_pids.ac3===e.pid?this.parseAC3Payload(h,i):this.pmt_.common_pids.eac3===e.pid?this.parseEAC3Payload(h,i):this.pmt_.asynchronous_klv_pids[e.pid]?this.parseAsynchronousKLVMetadataPayload(h,e.pid,s):this.pmt_.smpte2038_pids[e.pid]?this.parseSMPTE2038MetadataPayload(h,i,a,e.pid,s):this.parsePESPrivateDataPayload(h,i,a,e.pid,s);break;case eh:this.parseADTSAACPayload(h,i);break;case th:this.parseLOASAACPayload(h,i);break;case ih:this.parseAC3Payload(h,i);break;case sh:this.parseEAC3Payload(h,i);break;case rh:this.pmt_.timed_id3_pids[e.pid]?this.parseTimedID3MetadataPayload(h,i,a,e.pid,s):this.pmt_.synchronous_klv_pids[e.pid]&&this.parseSynchronousKLVMetadataPayload(h,i,a,e.pid,s);break;case oh:this.parseH264Payload(h,i,a,e.random_access_indicator);break;case nh:this.parseH265Payload(h,i,a,e.random_access_indicator)}}else if((188===s||191===s||240===s||241===s||255===s||242===s||248===s)&&e.stream_type===Zd){let i,a=6;i=0!==r?r:t.byteLength-a;let o=t.subarray(a,a+i);this.parsePESPrivateDataPayload(o,void 0,void 0,e.pid,s)}}else this.player.debug.error(this.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${i}`)}parsePAT(e){let t=e[0];if(0!==t)return void Log.e(this.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let i=(15&e[1])<<8|e[2];e[3],e[4];let s=(62&e[5])>>>1,r=1&e[5],a=e[6];e[7];let o=null;if(1===r&&0===a)o={version_number:0,network_pid:0,program_pmt_pid:{}},o.version_number=s;else if(o=this.pat_,null==o)return;let n=i-5-4,l=-1,d=-1;for(let t=8;t<8+n;t+=4){let i=e[t]<<8|e[t+1],s=(31&e[t+2])<<8|e[t+3];0===i?o.network_pid=s:(o.program_pmt_pid[i]=s,-1===l&&(l=i),-1===d&&(d=s))}1===r&&0===a&&(null==this.pat_&&this.player.debug.log(this.TAG_NAME,`Parsed first PAT: ${JSON.stringify(o)}`),this.pat_=o,this.current_program_=l,this.current_pmt_pid_=d)}parsePMT(e){let t=e[0];if(2!==t)return void this.player.debug.error(this.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let i,s=(15&e[1])<<8|e[2],r=e[3]<<8|e[4],a=(62&e[5])>>>1,o=1&e[5],n=e[6];if(e[7],1===o&&0===n)i=this._initPmt(),i.program_number=r,i.version_number=a,this.program_pmt_map_[r]=i;else if(i=this.program_pmt_map_[r],null==i)return;i.pcr_pid=(31&e[8])<<8|e[9];let l=(15&e[10])<<8|e[11],d=12+l,h=s-9-l-4;for(let t=d;t0){for(let s=t+5;s0)for(let s=t+5;s1&&(this.player.debug.warn(this.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${s}ms`),s=e)}}let r,a=new Qr(e),o=null,n=s;for(;null!=(o=a.readNextAACFrame());){i=1024/o.sampling_frequency*1e3;const e={codec:"aac",data:o};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:o.audio_object_type,sampling_freq_index:o.sampling_freq_index,sampling_frequency:o.sampling_frequency,channel_config:o.channel_config},this.dispatchAudioInitSegment(e)):this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)),r=n;let t=Math.floor(n);const s=new Uint8Array(o.data.length+2);s.set([175,1],0),s.set(o.data,2);let a={payload:s,length:s.byteLength,pts:t,dts:t,type:Ne};this.audio_track_.samples.push(a),this.audio_track_.length+=s.byteLength,n+=i}a.hasIncompleteData()&&(this.aac_last_incomplete_data_=a.getIncompleteData()),r&&(this.audio_last_sample_pts_=r)}parseLOASAACPayload(e,t){if(this.has_video_&&!this.video_init_segment_dispatched_)return;if(this.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);t.set(this.aac_last_incomplete_data_,0),t.set(e,this.aac_last_incomplete_data_.byteLength),e=t}let i,s;if(null!=t&&(s=t/this.timescale_),"aac"===this.audio_metadata_.codec){if(null==t&&null!=this.audio_last_sample_pts_)i=1024/this.audio_metadata_.sampling_frequency*1e3,s=this.audio_last_sample_pts_+i;else if(null==t)return void this.player.debug.warn(this.TAG_NAME,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){i=1024/this.audio_metadata_.sampling_frequency*1e3;let e=this.audio_last_sample_pts_+i;Math.abs(e-s)>1&&(this.player.debug.warn(this.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${s}ms`),s=e)}}let r,a=new Xr(e),o=null,n=s;for(;null!=(o=a.readNextAACFrame(La(this.loas_previous_frame)?void 0:this.loas_previous_frame));){this.loas_previous_frame=o,i=1024/o.sampling_frequency*1e3;const e={codec:"aac",data:o};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:o.audio_object_type,sampling_freq_index:o.sampling_freq_index,sampling_frequency:o.sampling_frequency,channel_config:o.channel_config},this.dispatchAudioInitSegment(e)):this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)),r=n;let t=Math.floor(n);const s=new Uint8Array(o.data.length+2);s.set([175,1],0),s.set(o.data,2);let a={payload:s,length:s.byteLength,pts:t,dts:t,type:Ne};this.audio_track_.samples.push(a),this.audio_track_.length+=s.byteLength,n+=i}a.hasIncompleteData()&&(this.aac_last_incomplete_data_=a.getIncompleteData()),r&&(this.audio_last_sample_pts_=r)}parseAC3Payload(e,t){}parseEAC3Payload(e,t){}parseOpusPayload(e,t){}parseMP3Payload(e,t){if(this.has_video_&&!this.video_init_segment_dispatched_)return;let i=[44100,48e3,32e3,0],s=[22050,24e3,16e3,0],r=[11025,12e3,8e3,0],a=e[1]>>>3&3,o=(6&e[1])>>1;e[2];let n=(12&e[2])>>>2,l=3!==(e[3]>>>6&3)?2:1,d=0,h=34;switch(a){case 0:d=r[n];break;case 2:d=s[n];break;case 3:d=i[n]}switch(o){case 1:h=34;break;case 2:h=33;break;case 3:h=32}const c={};c.object_type=h,c.sample_rate=d,c.channel_count=l,c.data=e;const u={codec:"mp3",data:c};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"mp3",object_type:h,sample_rate:d,channel_count:l},this.dispatchAudioInitSegment(u)):this.detectAudioMetadataChange(u)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(u));let p={payload:e,length:e.byteLength,pts:t/this.timescale_,dts:t/this.timescale_,type:Ne};this.audio_track_.samples.push(p),this.audio_track_.length+=e.byteLength}detectAudioMetadataChange(e){if(e.codec!==this.audio_metadata_.codec)return this.player.debug.log(this.TAG_NAME,`Audio: Audio Codecs changed from ${this.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===this.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==this.audio_metadata_.audio_object_type)return this.player.debug.log(this.TAG_NAME,`AAC: AudioObjectType changed from ${this.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return this.player.debug.log(this.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${this.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==this.audio_metadata_.channel_config)return this.player.debug.log(this.TAG_NAME,`AAC: Channel configuration changed from ${this.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===this.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==this.audio_metadata_.sampling_frequency)return this.player.debug.log(this.TAG_NAME,`AC3: Sampling Frequency changed from ${this.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return this.player.debug.log(this.TAG_NAME,`AC3: Bit Stream Identification changed from ${this.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return this.player.debug.log(this.TAG_NAME,`AC3: BitStream Mode changed from ${this.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==this.audio_metadata_.channel_mode)return this.player.debug.log(this.TAG_NAME,`AC3: Channel Mode changed from ${this.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return this.player.debug.log(this.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${this.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===this.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==this.audio_metadata_.sample_rate)return this.player.debug.log(this.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==this.audio_metadata_.channel_count)return this.player.debug.log(this.TAG_NAME,`Opus: Channel count changed from ${this.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===this.audio_metadata_.codec){const t=e.data;if(t.object_type!==this.audio_metadata_.object_type)return this.player.debug.log(this.TAG_NAME,`MP3: AudioObjectType changed from ${this.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==this.audio_metadata_.sample_rate)return this.player.debug.log(this.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==this.audio_metadata_.channel_count)return this.player.debug.log(this.TAG_NAME,`MP3: Channel count changed from ${this.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1}dispatchAudioInitSegment(e){let t={type:"audio"};t.id=this.audio_track_.id,t.timescale=1e3,t.duration=this.duration_;let i="";if("aac"===this.audio_metadata_.codec){let s="aac"===e.codec?e.data:null,r=new ph(s);t.audioSampleRate=r.sampling_rate,t.audioSampleRateIndex=r.sampling_index,t.channelCount=r.channel_count,t.codec=r.codec_mimetype,t.originalCodec=r.original_codec_mimetype,t.config=r.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale,i=Et;const a=jr({profile:this.player._opt.mseDecodeAudio?r.object_type:r.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});console.error("aacADTSHeader",`profile: ${r.object_type}, sampleRate: ${t.audioSampleRateIndex}, channel: ${t.channelCount}`),this._doDecodeByTs(a,Ne,0,!1,0)}else"ac-3"===this.audio_metadata_.codec||"ec-3"===this.audio_metadata_.codec||"opus"===this.audio_metadata_.codec||"mp3"===this.audio_metadata_.codec&&(t.audioSampleRate=this.audio_metadata_.sample_rate,t.channelCount=this.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0,i=Tt);0==this.audio_init_segment_dispatched_&&this.player.debug.log(this.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;let s=this.media_info_;s.hasAudio=!0,s.audioCodec=t.originalCodec,s.audioSampleRate=t.audioSampleRate,s.audioChannelCount=t.channelCount,s.hasVideo&&s.videoCodec?s.mimeType=`video/mp2t; codecs="${s.videoCodec},${s.audioCodec}"`:s.mimeType=`video/mp2t; codecs="${s.audioCodec}"`,i&&this.player.audio.updateAudioInfo({encTypeCode:i,channels:t.channelCount,sampleRate:t.audioSampleRate})}dispatchPESPrivateDataDescriptor(e,t,i){}parsePESPrivateDataPayload(e,t,i,s,r){let a=new hh;if(a.pid=s,a.stream_id=r,a.len=e.byteLength,a.data=e,null!=t){let e=Math.floor(t/this.timescale_);a.pts=e}else a.nearest_pts=this.getNearestTimestampMilliseconds();if(null!=i){let e=Math.floor(i/this.timescale_);a.dts=e}}parseTimedID3MetadataPayload(e,t,i,s,r){this.player.debug.log(this.TAG_NAME,`Timed ID3 Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}parseSynchronousKLVMetadataPayload(e,t,i,s,r){this.player.debug.log(this.TAG_NAME,`Synchronous KLV Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}parseAsynchronousKLVMetadataPayload(e,t,i){this.player.debug.log(this.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${i}`)}parseSMPTE2038MetadataPayload(e,t,i,s,r){this.player.debug.log(this.TAG_NAME,`SMPTE 2038 Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}getNearestTimestampMilliseconds(){if(null!=this.audio_last_sample_pts_)return Math.floor(this.audio_last_sample_pts_);if(null!=this.last_pcr_){return Math.floor(this.last_pcr_/300/this.timescale_)}}_preDoDecode(){const e=this.video_track_,t=this.audio_track_;let i=e.samples;t.samples.length>0&&(i=e.samples.concat(t.samples),i=i.sort(((e,t)=>e.dts-t.dts))),i.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===je?this._doDecodeVideo({...e,payload:t}):e.type===Ne&&this._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?jn(t,e.isIFrame):kn(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength}),e.isIFrame&&this.calcIframeIntervalTimestamp(e.dts);let s=this.cryptoPayload(i,e.isIFrame);this._doDecodeByTs(s,je,e.dts,e.isIFrame,e.cts)}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength});let i=t;uo(this.player._opt.m7sCryptoAudio)&&(i=this.cryptoPayloadAudio(t)),this._doDecodeByTs(i,Ne,e.dts,!1,0)}getInputByteLength(){return this._remainingPacketData&&this._remainingPacketData.byteLength||0}}class mh{constructor(e){return new(mh.getLoaderFactory(e))(e)}static getLoaderFactory(e){const t=e._opt.demuxType;return t===k?Fd:t===T||e.isWebrtcH265()?Ud:t===R?Od:t===D?Gd:t===L?qd:t===P?Kd:t===I?fh:Hd}}class gh extends So{constructor(e){super(),this.player=e,this.TAG_NAME="Webcodecs",this.hasInit=!1,this.isDecodeFirstIIframe=!!po(e._opt.checkFirstIFrame),this.isInitInfo=!1,this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.decoder=null,this.isWidthOrHeightChanged=!1,this.initDecoder(),e.debug.log(this.TAG_NAME,"init")}destroy(){this.decoder&&(po(this.isDecodeStateClosed())&&this.decoder.close(),this.decoder=null),this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.hasInit=!1,this.isInitInfo=!1,this.isDecodeFirstIIframe=!1,this.isWidthOrHeightChanged=!1,this.off(),this.player.debug.log(this.TAG_NAME,"destroy")}initDecoder(){const e=this;this.decoder=new VideoDecoder({output(t){e.handleDecode(t)},error(t){e.handleError(t)}})}handleDecode(e){this.isInitInfo||(this.player.video.updateVideoInfo({width:e.codedWidth,height:e.codedHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0),this.player.isPlayer()?(this.player.updateStats({dfps:!0}),this.player._times.videoStart||(this.player._times.videoStart=aa(),this.player.handlePlayToRenderTimes()),this.player.video.render({videoFrame:e,ts:e.timestamp}),this.player.handleRender()):this.player.isPlayback()&&(this.player.updateStats({dfps:!0}),po(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this.player.playback.isUseFpsRender?this.player.video.pushData({videoFrame:e,ts:e.timestamp}):this.player.video.render$2({videoFrame:e,ts:e.timestamp})):po(this.player.playback.isPlaybackPauseClearCache)&&this.player.playback.isCacheBeforeDecodeForFpsRender&&this.player.playback.isUseFpsRender&&this.player.video.pushData({videoFrame:e,ts:e.timestamp}))}handleError(e){this.player.debug.error(this.TAG_NAME,"VideoDecoder handleError:",e.code,e);const t=e.toString();-1!==t.indexOf(ls)?this.player.emitError(ct.webcodecsUnsupportedConfigurationError,t):-1!==t.indexOf(ds)||-1!==t.indexOf(hs)||-1!==t.indexOf(cs)?this.player.emitError(ct.webcodecsDecodeError,t):-1!==t.indexOf(us)&&this.player.emitError(ct.webcodecsH265NotSupport)}decodeVideo(e,t,i,s){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debug.warn(this.TAG_NAME,"decodeVideo() player is destroyed");else if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(this.isDecodeStateClosed())return void this.player.debug.warn(this.TAG_NAME,"VideoDecoder isDecodeStateClosed true");if(i&&0===e[1]){const t=15&e[0];let i={};if(t===vt){i=En(e.slice(5))}else t===_t&&(i=Un(e));const s=this.player.video.videoInfo;s&&s.width&&s.height&&i&&i.codecWidth&&i.codecHeight&&(i.codecWidth!==s.width||i.codecHeight!==s.height)&&(this.player.debug.warn(this.TAG_NAME,`decodeVideo: video width or height is changed,\n old width is ${s.width}, old height is ${s.height},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),this.isWidthOrHeightChanged=!0,this.player.emitError(ct.wcsWidthOrHeightChange))}if(this.isWidthOrHeightChanged)return void this.player.debug.warn(this.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(co(e))return void this.player.debug.warn(this.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength<12)return void this.player.debug.warn(this.TAG_NAME,`decodeVideo and payload is too small , payload length is ${e.byteLength}`);let s=!1,r=(new Date).getTime();this.prevTimestamp||(this.prevTimestamp=r,s=!0);const a=r-this.prevTimestamp;this.decodeDiffTimestamp=a,a>500&&!s&&this.player.isPlayer()&&this.player.debug.warn(this.TAG_NAME,"decodeVideo diff time is ",a);const o=e.slice(5),n=new EncodedVideoChunk({data:o,timestamp:t,type:i?li:di});this.player.emit(nt.timeUpdate,t);try{this.decoder.decode(n)}catch(e){this.player.debug.error(this.TAG_NAME,"VideoDecoder",e);const t=e.toString();(-1!==t.indexOf(os)||-1!==t.indexOf(ns))&&this.player.emitError(ct.webcodecsDecodeError)}this.prevTimestamp=(new Date).getTime()}else this.player.debug.log(this.TAG_NAME,"VideoDecoder first frame is not iFrame");else if(i&&e[1]===vs){const t=15&e[0];if(this.player.video.updateVideoInfo({encTypeCode:t}),t===_t&&!Ca()){const e=ga();return this.player.debug.warn(this.TAG_NAME,"WebcodecsDecoder not support hevc decode",e.type,e.version),void this.player.emitError(ct.webcodecsH265NotSupport)}this.player._times.decodeStart||(this.player._times.decodeStart=aa());let i=null,s=null;const r=e.slice(5);if(t===vt?(s=En(r),i={codec:s.codec,description:r}):t===_t&&(s=Fn(r),i={codec:s.codec,description:r}),!i||i&&!i.codec)return this.player.debug.warn(this.TAG_NAME,"decodeVideo and webcodecs configure is",JSON.stringify(i)),void this.player.emitError(ct.webcodecsDecodeConfigureError);s&&s.codecWidth&&s.codecHeight&&(i.codedHeight=s.codecHeight,i.codedWidth=s.codecWidth),this.player.recorder&&this.player._opt.recordType===S&&this.player.recorder.initMetaData(e,t),this.player.debug.log(this.TAG_NAME,`decoder.configure() and codec is ${i.codec}`);try{this.decoder.configure(i),this.hasInit=!0}catch(e){this.player.debug.log(this.TAG_NAME,"configure error",e.code,e);-1!==e.toString().indexOf(us)?this.player.emitError(ct.webcodecsH265NotSupport):this.player.emitError(ct.webcodecsDecodeConfigureError)}}}getDecodeDiffTimes(){return this.decodeDiffTimestamp}isDecodeStateClosed(){return"closed"===this.decoder.state}isDecodeStateConfigured(){return"configured"===this.decoder.state}isDecodeStateUnConfigured(){return"unconfigured"===this.decoder.state}}const yh={play:"播放",pause:"暂停",audio:"",mute:"",screenshot:"截图",loading:"",fullscreen:"全屏",fullscreenExit:"退出全屏",record:"录制",recordStop:"停止录制",narrow:"缩小",expand:"放大",ptz:"操作盘",ptzActive:"操作盘激活",zoom:"电子放大",zoomStop:"关闭电子放大",close:"关闭",performance:"性能面板",performanceActive:"性能面板激活",face:"人脸识别",faceActive:"人脸识别激活",object:"物品识别",objectActive:"物品识别激活",occlusion:"遮挡物检查",occlusionActive:"遮挡物检查激活",logSave:"保存日志"};var Ah=Object.keys(yh).reduce(((e,t)=>(e[t]=`\n \n ${yh[t]?`${yh[t]}`:""}\n`,e)),{});function bh(e,t){let i=!1;return e.forEach((e=>{i||e.startTimestamp<=t&&e.endTimestamp>t&&(i=!0)})),i}function vh(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=e.length,r=t.length,a=Math.max(s,r),o=2e3,n=Math.ceil(a/o);let l=0,d=0;function h(){let r="",a="";for(let i=0;i\n ${i.title}\n \n `);const o=t[d];o&&(a+=`\n

${o.title}
\n `),d+=1}r&&i.$playbackTimeListOne.insertAdjacentHTML("beforeend",r),a&&i.$playbackTimeListSecond.insertAdjacentHTML("beforeend",a),l+=1,l0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<1440;s++){const r=s%60==0;let a=!1;i&&(a=bh(e,ja(i,s))),t.push({title:Oa(s),timestamp:s,dataType:"min",hasRecord:a,isStart:r})}return t}(e);vh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0})}return e}(),t)}function Sh(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<1440;s++){let r=60*s,a=r%1800==0,o=!1;i&&(o=bh(e,za(i,r))),t.push({title:Na(r),timestamp:r,dataType:"second",hasRecord:o,isStart:a});let n=60*s+30;a=n%1800==0,i&&(o=bh(e,za(i,n))),t.push({title:Na(n),timestamp:n,dataType:"second",hasRecord:o,isStart:a})}return t}(e);vh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00",s=t+":30";t<10&&(i="0"+i,s="0"+s),e.push({title:i,hour:t,min:0,second:0}),e.push({title:s,hour:t,min:30,second:0})}return e}(),t)}function wh(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<144;s++)for(let r=0;r<60;r++){let a=10*r+600*s,o=a%600==0,n=!1;i&&(n=bh(e,za(i,a))),t.push({title:Na(a),timestamp:a,dataType:"second",isStart:o,hasRecord:n})}return t}(e);vh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0});for(let s=1;s<6;s++){let r=s+"0";e.push({title:i.replace(":00",":"+r),hour:t,min:10*s,second:0})}}return e}(),t)}function Eh(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<288;s++)for(let r=0;r<60;r++){let a=5*r+300*s,o=a%300==0,n=!1;i&&(n=bh(e,za(i,a))),t.push({title:Na(a),timestamp:a,dataType:"second",isStart:o,hasRecord:n})}return t}(e);vh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0}),e.push({title:i.replace(":00",":05"),hour:t,min:5,second:0});for(let s=1;s<6;s++){let r=s+"0",a=s+"5";e.push({title:i.replace(":00",":"+r),hour:t,min:10*s,second:0}),e.push({title:i.replace(":00",":"+a),hour:t,min:10*s+5,second:0})}}return e}(),t)}function Th(e){const t=Math.floor(e/3600),i=Math.floor((e-3600*t)/60),s=Math.floor(e-3600*t-60*i);return(t>0?[t,i,s]:[i,s]).map((e=>e<10?`0${e}`:String(e))).join(":")}function kh(e,t,i){const s=e.$playbackProgress,{left:r}=s.getBoundingClientRect(),a=oa((ua()?i.touches[0].clientX:i.pageX)-r,0,s.clientWidth),o=parseInt(a/s.clientWidth*t,10);return{second:o,time:Th(o),width:a,percentage:oa(a/s.clientWidth,0,1)}}function Ch(e,t){return e.classList.add(t)}function xh(e,t){return t instanceof Element?e.appendChild(t):e.insertAdjacentHTML("beforeend",String(t)),e.lastElementChild||e.lastChild}function Rh(e,t,i){return e&&e.style&&Ba(t)&&(e.style[t]=i),e}function Dh(e,t){return e.composedPath&&e.composedPath().indexOf(t)>-1}function Lh(e){let t=!1;return e&&e.parentNode&&(e.parentNode.removeChild(e),t=!0),t}var Ph=(e,t)=>{const{events:{proxy:i}}=e,s=document.createElement("object");s.setAttribute("aria-hidden","true"),s.setAttribute("tabindex",-1),s.type="text/html",s.data="about:blank",na(s,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"});let r=e.width,a=e.height;const o=wa((()=>{e.width===r&&e.height===a||(r=e.width,a=e.height,e.emit(nt.resize),c())}),500);i(s,"load",(()=>{i(s.contentDocument.defaultView,"resize",(()=>{o()}))})),e.$container.appendChild(s),e.on(nt.destroy,(()=>{e.$container.removeChild(s)})),e.on(nt.volumechange,(()=>{!function(e){if(0===e)na(t.$volumeOn,"display","none"),na(t.$volumeOff,"display","flex"),na(t.$volumeHandle,"top","48px");else if(t.$volumeHandle&&t.$volumePanel){const i=la(t.$volumePanel,"height")||60,s=la(t.$volumeHandle,"height"),r=i-(i-s)*e-s;na(t.$volumeHandle,"top",`${r}px`),na(t.$volumeOn,"display","flex"),na(t.$volumeOff,"display","none")}t.$volumePanelText&&(t.$volumePanelText.innerHTML=parseInt(100*e))}(e.volume)})),e.on(nt.loading,(i=>{na(t.$loading,"display",i?"flex":"none"),(po(e._opt.backgroundLoadingShow)&&uo(i)||po(i))&&na(t.$poster,"display","none"),i&&(na(t.$playBig,"display","none"),na(t.$tipsMessage,"display","none")),i||e._opt.extendDomConfig.showAfterLoading&&t.$extendDom&&na(t.$extendDom,"display","block"),i||e.getRenderType()===$&&po(e._opt.useMSE)&&n()})),e.on(nt.removeLoadingBgImage,(()=>{n()}));const n=()=>{t.$loadingBgImage&&t.$loadingBg&&t.$loadingBgImage.src&&(e.debug&&e.debug.log("Control","remove loading bg image"),t.$loadingBgImage.width=0,t.$loadingBgImage.height=0,t.$loadingBgImage.src="",na(t.$loadingBg,"display","none"))},l=t=>{e.fullscreen?qa(t)===e.$container&&d():d()},d=i=>{let s=Pa(i)?i:e.fullscreen;na(t.$fullscreenExit,"display",s?"flex":"none"),na(t.$fullscreen,"display",s?"none":"flex")},h=()=>e._opt.playType===_&&e._opt.playbackConfig.showControl,c=i=>{ua()&&t.$controls&&e._opt.useWebFullScreen&&setTimeout((()=>{if(e.fullscreen){const i=h()?Yt:Kt;let s=e.height/2-e.width+i/2,r=e.height/2-i/2;if(t.$controls.style.transform=`translateX(${-s}px) translateY(-${r}px) rotate(-90deg)`,t.$zoomControls){const i=156,s=30,r=e.width/2+i/2-s/2;t.$zoomControls.style.transform=`translateX(${-r}px) translateY(${e.height/2}px) rotate(-90deg)`}if(t.$recording){const i=101,s=20,r=e.width/2+i/2-s/2;t.$recording.style.transform=`translateX(${-r}px) translateY(${e.height/2}px) rotate(-90deg)`}}else t.$controls.style.transform="translateX(0) translateY(0) rotate(0)",t.$zoomControls&&(t.$zoomControls.style.transform="translateX(-50%) translateY(0) rotate(0)"),t.$recording&&(t.$recording.style.transform="translateX(-50%) translateY(0) rotate(0)");i&&i()}),10)};try{Mr.on("change",l),e.events.destroys.push((()=>{Mr.off("change",l)}))}catch(e){}e.on(nt.webFullscreen,(e=>{ua()&&(d(e),c((()=>{p()})))})),e.on(nt.recording,(()=>{e.playing&&(na(t.$record,"display",e.recording?"none":"flex"),na(t.$recordStop,"display",e.recording?"flex":"none"),(e._opt.hasControl||e._opt.isShowRecordingUI)&&(na(t.$recording,"display",e.recording?"flex":"none"),po(e.recording)&&t.$recordingTime&&(t.$recordingTime.innerHTML=Fa(0))))})),e.on(nt.recordingTimestamp,(e=>{t.$recordingTime&&(t.$recordingTime.innerHTML=Fa(e))})),e.on(nt.zooming,(()=>{e.playing&&(na(t.$zoom,"display",e.zooming?"none":"flex"),na(t.$zoomStop,"display",e.zooming?"flex":"none"),(e._opt.hasControl||e._opt.isShowZoomingUI)&&na(t.$zoomControls,"display",e.zooming?"flex":"none"))})),e.on(nt.playing,(e=>{u(e)}));const u=i=>{i||e.isPlayFailedAndPaused&&po(e._opt.playFailedAndPausedShowPlayBtn)?(na(t.$play,"display","none"),na(t.$playBig,"display","none")):(na(t.$play,"display","flex"),na(t.$playBig,"display","block")),na(t.$pause,"display",i?"flex":"none"),na(t.$screenshot,"display",i?"flex":"none"),na(t.$record,"display",i?"flex":"none"),na(t.$qualityMenu,"display",i?"flex":"none"),na(t.$volume,"display",i?"flex":"none"),na(t.$ptz,"display",i?"flex":"none"),na(t.$zoom,"display",i?"flex":"none"),na(t.$scaleMenu,"display",i?"flex":"none"),na(t.$faceDetect,"display",i?"flex":"none"),na(t.$objectDetect,"display",i?"flex":"none"),na(t.$occlusionDetect,"display",i?"flex":"none"),na(t.$controlHtml,"display",i?"flex":"none"),e.isPlayback()&&na(t.$speedMenu,"display",i?"flex":"none"),d(),t.extendBtnList.forEach((e=>{e.$iconWrap&&na(e.$iconWrap,"display",i?"flex":"none"),e.$activeIconWrap&&na(e.$activeIconWrap,"display","none")})),e._opt.showPerformance?na(t.$performanceActive,"display",i?"flex":"none"):(na(t.$performance,"display",i?"flex":"none"),na(t.$performanceActive,"display","none")),na(t.$poster,"display","none"),na(t.$ptzActive,"display","none"),na(t.$recordStop,"display","none"),na(t.$zoomStop,"display","none"),na(t.$faceDetectActive,"display","none"),na(t.$objectDetectActive,"display","none"),i||(t.$speed&&(t.$speed.innerHTML=function(e){if(null==e||""===e)return"0 KB/s";let t=parseFloat(e);return t=t.toFixed(2),t+"KB/s"}("")),na(t.$zoomControls,"display","none"),na(t.$recording,"display","none"),t.$ptzControl&&t.$ptzControl.classList.remove("jb-pro-ptz-controls-show")),p(),i&&f()};e.on(nt.playbackPause,(e=>{u(!e)})),e.on(nt.kBps,(i=>{const s=function(e){if(null==e||""===e||0===parseFloat(e)||"NaN"===e)return"0 KB/s";const t=["KB/s","MB/s","GB/s","TB/s","PB/s","EB/s","ZB/s","YB/s"];let i=0;const s=parseFloat(e);i=Math.floor(Math.log(s)/Math.log(1024));let r=s/Math.pow(1024,i);return r=r.toFixed(2),r+(t[i]||t[0])}(i);t.kbpsShow=s,e._opt.showBandwidth&&(t.$speed&&(t.$speed.innerHTML=s),p())}));const p=()=>{if(h()&&e._opt.playbackConfig.controlType===Q.normal){let i=t.controlsInnerRect.width-t.controlsLeftRect.width-t.controlsRightRect.width-t.controlsPlaybackBtnsRect.width;ua()&&e.webFullscreen&&(i=t.controlsInnerRect.height-t.controlsLeftRect.height-t.controlsRightRect.height-t.controlsPlaybackBtnsRect.height),t.$playbackTimeInner.style.width=i+"px"}},f=()=>{if(!h()||e._opt.playbackConfig.controlType!==Q.normal)return;const i=t.$playbackCurrentTime.style.left;let s=parseInt(i,10);const r=t.controlsPlaybackTimeInner.width;s=s-r/2>0?parseInt(s-r/2,10):0,t.$playbackTimeInner.scrollLeft=s};if(h()){const i=()=>{if(h()){let i=0;const s=e.playback&&e.playback.playingTimestamp;if(s){const r=new Date(s),a=r.getHours(),o=r.getMinutes(),n=r.getSeconds();e.playback.is60Min?i=60*a+o:e.playback.is30Min?i=2*(60*a+o)+parseInt(n/30,10):e.playback.is10Min?i=6*(60*a+o)+parseInt(n/10,10):e.playback.is5Min?i=12*(60*a+o)+parseInt(n/5,10):e.playback.is1Min&&(i=60*(60*a+o)+parseInt(n,10)),t.$playbackCurrentTime.style.left=i+"px"}}},s=e=>{t.$playbackNarrow.classList.remove("disabled"),t.$playbackExpand.classList.remove("disabled"),e===Si&&t.$playbackNarrow.classList.add("disabled"),e===Ti&&t.$playbackExpand.classList.add("disabled")};e.on(nt.playbackTime,(s=>{if(e._opt.playbackConfig.controlType===Q.normal)t.$playbackCurrentTimeText&&(t.$playbackCurrentTimeText.innerText=ba(s,"{h}:{i}:{s}")),i();else if(e._opt.playbackConfig.controlType===Q.simple){const i=(r=s,a=e.playback.totalDuration,oa(r/a,0,1));t.$playbackProgressPlayed.style.width=100*i+"%",t.$playbackProgressIndicator.style.left=`calc(${100*i}% - 7px)`,t.$playbackProgressTime.innerText=`${Th(s)} / ${Th(e.playback.totalDuration)}`}var r,a})),e.on(nt.playbackPrecision,((r,a)=>{h()&&e._opt.playbackConfig.controlType===Q.normal&&(t.$playbackTimeScroll.classList.remove(ki.oneHour,ki.halfHour,ki.fiveMin,ki.tenMin),t.$playbackTimeScroll.classList.add(ki[r]),t.rafId&&(window.cancelAnimationFrame(t.rafId),t.rafId=null),t.changePercisitionInterval&&(clearTimeout(t.changePercisitionInterval),t.changePercisitionInterval=null),t.$playbackTimeListOne.innerHTML="",t.$playbackTimeListSecond.innerHTML="",t.changePercisitionInterval=setTimeout((()=>{switch(t.$playbackTimeListOne.innerHTML="",t.$playbackTimeListSecond.innerHTML="",r){case Si:_h(a,t);break;case wi:Sh(a,t);break;case Ei:wh(a,t);break;case Ti:Eh(a,t)}i(),e._opt.playbackConfig.showPrecisionBtn&&s(r),f()}),16))})),e.on(nt.resize,(()=>{p()})),e.on(nt.playbackTimeScroll,(()=>{f()})),p()}if(e._opt.operateBtns.quality&&e._opt.qualityConfig.length>0){e.on(nt.streamQualityChange,(e=>{i(e)}));const i=e=>{t.$qualityText.innerText=e,t.$qualityMenuItems.forEach((t=>{const i=t.dataset.quality;t.classList.remove("jb-pro-quality-menu-item-active"),i===e&&t.classList.add("jb-pro-quality-menu-item-active")}))};(()=>{const i=e._opt.qualityConfig||[];let s="";i.forEach((e=>{s+=`\n
${e}
\n `})),s&&(t.$qualityMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$qualityMenuItems",{value:e.$container.querySelectorAll(".jb-pro-quality-menu-item")}))})(),e.streamQuality&&i(e.streamQuality)}if(e._opt.operateBtns.scale&&e._opt.scaleConfig.length>0){e.on(nt.viewResizeChange,(e=>{i(e)}));const i=i=>{const s=e._opt.scaleConfig[i];t.$scaleText.innerText=s,t.$scaleMenuItems.forEach((e=>{const t=e.dataset.scale;e.classList.remove("jb-pro-scale-menu-item-active"),_a(t)===_a(i)&&e.classList.add("jb-pro-scale-menu-item-active")}))};(()=>{const i=e._opt.scaleConfig||[];let s="";i.forEach(((e,t)=>{s+=`\n
${e}
\n `})),s&&(t.$scaleMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$scaleMenuItems",{value:e.$container.querySelectorAll(".jb-pro-scale-menu-item")}))})(),i(e.scaleType)}if(e.isPlayback()&&e._opt.playbackConfig.showRateBtn&&e._opt.playbackConfig.rateConfig.length>0){e.on(nt.playbackRateChange,(e=>{i(e)}));const i=i=>{const s=e._opt.playbackConfig.rateConfig.find((e=>_a(e.value)===_a(i)));s&&(t.$speedText.innerText=s.label,t.$speedMenuItems.forEach((e=>{const t=e.dataset.speed;e.classList.remove("jb-pro-speed-menu-item-active"),_a(t)===_a(i)&&e.classList.add("jb-pro-speed-menu-item-active")})))};(()=>{const i=e._opt.playbackConfig.rateConfig;let s="";i.forEach(((e,t)=>{s+=`\n
${e.label}
\n `})),s&&(t.$speedMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$speedMenuItems",{value:e.$container.querySelectorAll(".jb-pro-speed-menu-item")}))})();const s=e.playback?e.playback.playbackRate:1;i(s)}e.on(nt.stats,(function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e._opt.showPerformance){na(t.$performancePanel,"display","block"),t.$performancePanel.innerHTML="";const s=ca,r=go(),a=e.getCpuLevel(),o=Ba(a)&&-1!==a?`${lr[a]}`:"",n=e.video&&e.video.videoInfo||{},l=e.audio&&e.audio.audioInfo||{},d=e._times||{},h=e.getRenderType(),c=e.getCanvasRenderType(),u=e.getDecodeType(),p=e.getDemuxType(),f=e.getStreamType(),m=e.getAudioEngineType();let g=e.getRecordingDuration(),y=e.getRecordingByteLength();const A=e.isAudioPlaybackRateSpeed(),b=e.videoIframeIntervalTs;g=Fa(g),y=Ea(y);const v=e.isPlayback()?"录播":"直播";let _=i.isDropping;const S=e._opt.useMSE&&e._opt.mseDecodeAudio,w=e.control?e.control.kbpsShow:"0 KB/s",E=e.getVideoPlaybackQuality(),T=`\n
\n 版本 ${s}\n
\n ${e._opt.isMulti?`\n
\n UUid ${e._opt.debugUuid}\n
\n `:""}\n ${e.isInMulti()?`\n
\n 窗口下标 ${e._opt.multiIndex}\n
\n `:""}\n ${r?`\n
\n 内存大小限制 ${Ea(r.jsHeapSizeLimit)}\n
\n
\n 可使用的内存 ${Ea(r.totalJSHeapSize)}\n
\n
\n 已使用的内存 ${Ea(r.usedJSHeapSize)}\n
\n `:""}\n ${o?`\n
\n CPU压力情况 ${o}\n
\n `:""}\n\n ${r&&r.usedJSHeapSize>r.totalJSHeapSize?'\n
\n 可能内存泄漏 是}\n
\n ':""}\n
\n 播放模式 ${v}\n
\n ${e.isPlayback()?`\n
\n 播放倍率 ${e.playback.rate}倍\n
\n
\n 播放模式 ${e.playback.isUseFpsRender?"固定FPS":"动态FPS"}\n
\n ${e.playback.isUseFpsRender?`\n
\n 固定FPS ${e.video.getStreamFps()}\n
\n `:""}\n `:""}\n
\n 解封装模式 ${M[p]}\n
\n
\n 解码模式 ${u}\n
\n
\n 渲染组件 ${h}\n
\n ${h===$?`\n
\n 渲染引擎 ${c}\n
\n `:""}\n
\n 网络请求组件 ${f}\n
\n
\n 视频格式 ${n.encType||"-"}\n
\n
\n 视频(宽x高) ${n.width||"-"}x${n.height||"-"}\n
\n ${e.isPlayer()?`\n
\n 视频GOP(ms) ${b||"-"}\n
\n `:""}\n
\n 音频格式 ${kt[l.encType]||"-"}\n
\n
\n 音频引擎 ${m||"-"}\n
\n
\n 音频通道 ${l.channels||"-"}\n
\n
\n 音频采样率 ${l.sampleRate||"-"}\n
\n ${e.isPlayer()?`\n
\n 播放器初始化(ms) ${d.playTimestamp}\n
\n
\n 开始请求地址(ms) ${d.streamTimestamp}\n
\n
\n 请求响应(ms) ${d.streamResponseTimestamp}\n
\n
\n 解封装(ms) ${d.demuxTimestamp}\n
\n
\n 解码(ms) ${d.decodeTimestamp}\n
\n
\n 页面开始渲染(ms) ${d.videoTimestamp}\n
\n
\n 初始化到页面渲染(ms) ${d.allTimestamp}\n
\n ${e.recording?`\n
\n 视频录制时间 ${g}\n
\n
\n 视频录制大小 ${y}\n
\n `:""}\n `:""}\n
\n 音频码率(bit) ${i.abps}\n
\n
\n 视频码率(bit) ${i.vbps}\n
\n
\n 视频帧率(fps) ${i.fps}\n
\n
\n 视频峰值帧率(fps) ${i.maxFps}\n
\n
\n 解码帧率(fps) ${i.dfps}\n
\n
\n 音频缓冲帧 ${i.audioBuffer}\n
\n
\n 音频缓冲时长(ms) ${i.audioBufferDelayTs}\n
\n ${e.isPlayer()?`\n
\n 视频待解码帧 ${i.demuxBuffer}\n
\n `:`\n
\n 缓存时长(ms) ${i.playbackCacheDataDuration}\n
\n
\n 视频待渲染帧 ${i.playbackVideoBuffer}\n
\n
\n 视频待解码帧 ${i.demuxBuffer}\n
\n
\n 音频待解码帧 ${i.audioDemuxBuffer}\n
\n `}\n
\n 待解封装数据(byte) ${i.streamBuffer}\n
\n ${e._opt.useMSE?`\n
\n MSE缓冲时长(ms) ${i.mseDelay}\n
\n
\n MSE待解码帧 ${i.msePendingBuffer}\n
\n
\n MSE缓存时长(s) ${i.mseStore}\n
\n
\n MSE解码间隔(ms) ${i.mseDecodeDiffTimes}\n
\n
\n MSE解码时间(ms) ${i.mseTs}\n
\n
\n MSE播放模式 ${i.mseDecodePlaybackRate>1?"加速":"正常"}\n
\n `:""}\n ${e._opt.useWCS?`\n
\n WCS解码间隔(ms) ${i.wcsDecodeDiffTimes}\n
\n `:""}\n ${e.isOldHls()?`
\n HLS缓冲时长(ms) ${i.hlsDelay}\n
\n `:""}\n ${e.isUseHls265()?`
\n HLS缓冲时长(ms) ${i.hlsDelay}\n
\n
\n HLS待解码帧 ${i.hlsDemuxLength}\n
\n
\n HLS待解码视频帧 ${i.hlsDemuxVideoLength}\n
\n
\n HLS待解码音频帧 ${i.hlsDemuxAudioLength}\n
\n `:""}\n ${e.isPlayer()&&E?`\n
\n Video已渲染帧 ${E.renderedVideoFrames}\n
\n
\n Video已丢弃帧 ${E.droppedVideoFrames}\n
\n `:""}\n ${e.isPlayer()?`\n
\n 网络延迟(ms) ${i.netBuf}\n
\n
\n 缓冲时长(ms) ${i.buf}\n
\n
\n 最新缓冲时长(ms) ${i.pushLatestDelay}\n
\n `:""}\n ${e._opt.useMSE||e.isWebrtcH264()||e.isAliyunRtc()?`\n
\n video显示时间(s) ${i.videoCurrentTime}\n
\n
\n video间隔时间(s) ${i.videoCurrentTimeDiff}\n
\n
\n videoBuffer缓存时间(ms) ${i.mseVideoBufferDelayTime}\n
\n `:""}\n
\n 视频显示时间(ms) ${i.currentPts||i.ts}\n
\n ${e._opt.hasAudio&&e.isAudioNotMute()&&po(S)?`\n
\n 音频显示时间(ms) ${i.audioTs}\n
\n ${e._opt.hasVideo?`\n
\n 音视频同步时间戳(ms) ${i.audioSyncVideo}\n
\n `:""}\n
\n 音频播放模式 ${A?"加速":"正常"}\n
\n `:""}\n
\n 视频解码时间(ms) ${i.dts}\n
\n ${e.isPlayer()?`\n
\n 解码前-解码后延迟(ms) ${i.delayTs}\n
\n
\n 总延迟(网络+解码)(ms) ${i.totalDelayTs}\n
\n `:""}\n ${e.isPlayer()&&i.isStreamTsMoreThanLocal?'
\n 是否超过一倍率推流 是\n
\n ':""}\n ${e.isPlayer()?`\n
\n 是否播放流畅 ${i.videoSmooth}\n
\n `:""}\n ${e.isPlayer()?`\n
\n 是否在丢帧 ${_}\n
\n `:""}\n
\n 网速 ${w}\n
\n
\n 播放时长(s) ${Fa(i.pTs)}\n
\n
\n `;t.$performancePanel.insertAdjacentHTML("beforeend",T)}else t.$performancePanel.innerHTML="",na(t.$performancePanel,"display","none")})),e.on(nt.togglePerformancePanel,(e=>{na(t.$performance,"display",e?"none":"flex"),na(t.$performanceActive,"display",e?"flex":"none")})),e.on(nt.faceDetectActive,(e=>{na(t.$faceDetect,"display",e?"none":"flex"),na(t.$faceDetectActive,"display",e?"flex":"none")})),e.on(nt.objectDetectActive,(e=>{na(t.$objectDetect,"display",e?"none":"flex"),na(t.$objectDetectActive,"display",e?"flex":"none")})),e.on(nt.occlusionDetectActive,(e=>{na(t.$occlusionDetect,"display",e?"none":"flex"),na(t.$occlusionDetectActive,"display",e?"flex":"none")}))};function Bh(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var s=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&s.firstChild?s.insertBefore(r,s.firstChild):s.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}Bh('@keyframes rotation{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes magentaPulse{0%{background-color:#630030;-webkit-box-shadow:0 0 9px #333}50%{background-color:#a9014b;-webkit-box-shadow:0 0 18px #a9014b}to{background-color:#630030;-webkit-box-shadow:0 0 9px #333}}.jb-pro-container video::-webkit-media-controls{display:none!important}.jb-pro-container .jb-pro-icon{cursor:pointer;width:16px;height:16px;display:inline-block}.jb-pro-container .jb-pro-ptz-controls{position:absolute;width:156px;height:156px;visibility:hidden;opacity:0;border-radius:78px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4BAMAAAA9UfJZAAAAMFBMVEUAAABHcEy0tLRZWVmysrKoqKi1tbWvr6+2traBgYG1tbWWlpa1tbW1tbVUVFS1tbVGCHqkAAAAD3RSTlMzAO9U3LSWySp3aZcVRDUDw823AAAJYUlEQVR42u3d32sbVxYH8EPHxgg/lBsa7SBkukmpSbwLI2KbEPpgZ5MQtwmM0wRMmgdhP6RgEuwlSVnYlmGMYaEvMU1KKX4QNq0pocVmm7CYfRBaQguFpbgPKRSC/4V2LGliO+bulWKrkvVrftyZ+WbxeTRG+nDnnnNmRjP3EpMR6tMH18du/0Xj1tGz5+9cf/DUlPKx5PsTkr8s3eZ1cX7ym1zkuI/f1wTFunNt9fP+FIno7/98/tFY+Y8ffBUlLrmkl2Cr96guTv27BMxP5iLCqUvi68+tpqhJKPNXBH3SjACnfimm/7Wmsl3fI/FP75lh457oPH+1Da3M+1T8481QcT0T7UetevR618LDPdH4hTlyHLGH3LoZEk6d4PlvyVW8pfNeMwzcDwa/kCKXoTzk9tfB455o1mXyEIOa+0PrFvcFt+fIU8QM/k6guOQifzNFHkN5l/flgsOJVHibfMR9l2nhBqem+VXyFZ/xghkMTp3il8lnDPKiGQROhs2lzjEuKcVW1uWk4ybk2Eq63pxk3CK/RZLiJO+Ti/vZXw3ZX1E+kon7jv+JJMY/+Q15uIRWIKmRthZk4VTDTsnFKYZtSsItWiskObq1Pjm4f8gqIrUF5W8ycAl+nAKIT/iCf1zSKFAgkW4/7drifrLmgsHF2k87alvhblFAcbJttWuDU/VtCiyyedMXbjGfCg6n6H1+cHE+TQFGFx/3jksa2xRoZO2cZ9xsUJn6e8aOeMX1aGco4Biw1jzilm0KPNJb3nBxvhI8rrtVTlCLK5ptCiEyBS+474POhr2c+NA9Lqm/QaHEiXzONW42yN5Q2ydG3OLU4MvI7+XEdImbCWvgSkN3zB1O1YYptOhoNnRNcDM2hRjGMTc4VZsOE9fVZOioyYyjUKPJrKPGNW44XFxX41rXEPc4vFTdS9iLTnFJ4wyFHAO2U1zcSoWNU7RLDnFTb1DocaLoDJfgc+HjYo3uTjTArW9TBJHdcYJTtdEocJ0NCnE97nGBIon0RQc4YzgaXIfdHhdBHdmrJuNtceubFFFkdtrhVG0lKlx3XUrsxz22KbIwLrbBTQ1Hhxsotsb18FR0OIWvtcT9Z5sijOyfW+KM6ShxXXYrXMJKRYlTtIUWuLubFGlknrXAGaPR4jrt5riERRFH7XGtwc1sRo3LHGuKi/qo7j+uhJOr9flKMBW4QR2uxk1NR4/rKjbGRdpXG/bXKtxrAEdVHNfTDXHLf0TAvbLVCJfU5hBwMSvXABfPE0To4w1wP25i4DLPG+CmRjFwncV6nIpQSF4UE7MOd7hAIJG+VIe7u4GCG3pWh0uPouA6C/txMFOuetIR3JSrmnQEN+WqJh2BVbmaSreLS+JMudKky9Xg4jYBRXq8BndoEwmXOVKDWx5GwnVs1eD0OSRcLF+N67EIKrS1Klx8GwuXHa/C/biBhRt6XoVbnsbCdW1V4bDyoZIRZZwKlg8iI8wKLl5Aw73oEWXcoQ003NCRCm59GA3XsVPBTa2g4bqLFZyWQsMp1h6uJ09woa/t4tCaV6WBEWSy7qYrQSbrbroS2MVNzUUOAXbWSnel0sU+AUbpsl/gEjYizlgo4w5vI+Kyl8o4xEryopYI3N1hRFzHszJueRQR17lVxqXnEHGxQhmHd06yd15CgBcQlcsIYokCJi69IHDxbUycOGki9toGJm7otMC9/ism7tXfBA6zBperMIHW4HIVJsDrwsrVIYE2CNEibIHDbBDlFkFJ0AYhWkSOemxUnLFGqN2r1L8ItXuV+hfFN1FxmXH6wwYqbuivdAgXd4RQ+36p8xNq3y91flqfRsV17dD6KCquc4eWcXFbtLyCiusu0hQ0bg4VFytSGhdXICOFilNs0nFx+QOcZ5xGsGEd4DzjOC6OH+A847QD3P9jtuJ2CGjcQeP3gYM+2YQ+TYe+wMG+NETGQd+OgL6RA30LDPrm4eu/ouJe/Q37hjX0rX7oH0mgf16C/mEO+idN6B+DoX9Gx34AAfrRDeiHXqAfF0Lt/OUHrVAfUcucRn+4D/qxSOgHSqEfxcV+iBn68W/EV3AqD85Dv3IA/bIG9GsumC8IaSb+q1XYL6VBv84H/SIk9Cuk0C/fQr+2jP3CN/Sr8tCLDEAvzwC9sAX0kiDYi6lAL0MDvYAP9NJH0ItGYS+3Bb1QGVaP2LfEG/TieNDLCmIvyAi9lCX0IqDQy6diLzwLvWQv9GLH0MtER76rRqWxPgdemtwYf9kWdYdeDh97IwHoLRigN6/A3vYDesMU6K1msDfpgd7eiOmjSEf1ZdpSC3ozMuht3LA3wIPeOjDSTRdfKb7M21VCb/QJvUUq9uay0NvyYm9oHFFKdDvaChp6E23s7cehN25nh5G3vE8aZ8LGDdjMIY49zoc9dPpFx7ikHnIh7sjnHOPYTMj36oxjzDlO1UI9Xe9oUICb49iMDTBwzXCqFuKsG2gycM1wYtaFlrCK3mTgmuJU7UzkA9cUx2bDGjpFH2FucUk9pA57onGNa4lj31uhnJzEtA+ZexxLh3KpkykwL7g4D+GUuJuPe8Kx5RCuJtJbzBuuJ/hyMmCtecSx2aBzIqaNMK+4pBHwtU7WznnGiZwI9Oykq1U2tMWxxSD7hKL3MT84VQ/wwGbzpi8c+47fCsp2kt9g/nDsp6AyNqb1Mb+4pBFQKU7bpm8cS/DjQdg+aXT/wTWOzfLL8m2DfITJwLFFS/oZQHf7CecQpxq25GqnGO0nnEMcS2iSq13WWmCycKLaHZebDDeYPBz7mb8tz3aff8Rk4tiivJQd5H1MLo5NyNIN8t6cbJw6ZV2WYys6tTnHCZ2MsRM2k8nHSdG5srnBMTXNr/qzfcYLLmyucEyd8FdR7vNeNzZ3OJZc5G967mTKu7wvx4LDMfYFtz2efMYM/o7LL3OLY080byVlULNusqBx7AeDX3B9aJWH3P6aBY8rpUX+W3e2t3SXqeAZVzq0/JyLmRe7wt0fUs849t8Jzv/u8Ngq/+K8d42FhxODp/P8VQc85VPxjzc9folXHFO/1Lh1rc3BjT0S//SeycLGCd6Sxvm51abDp8xf4dyaNL1/gw+caBhLuvj6O6v36mWn5scEPe+H5hMn4uP3hUEAr63e6y+PYX//qflHY+U/fvCVzw/3ixPD98vSbV4X5ye/yfn+aP+4MvDpg+tjZ4+K8bKOnr1z/cFTU8rH/g92biFxn2S73AAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;transition:visibility .3s,opacity .3s;right:43px;bottom:135px}.jb-pro-container .jb-pro-ptz-controls.show-vertical{right:43px}.jb-pro-container .jb-pro-ptz-controls.show-vertical .jb-pro-ptz-btns{left:0;top:156px}.jb-pro-container .jb-pro-ptz-controls.show-level{right:163px}.jb-pro-container .jb-pro-ptz-controls.show-level .jb-pro-ptz-btns{min-height:156px;left:144px;top:0;display:flex;flex-direction:column;justify-content:center}.jb-pro-container .jb-pro-ptz-controls.jb-pro-ptz-controls-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-bg-active{visibility:hidden;opacity:0;width:156px;height:156px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4CAMAAAD4oR9YAAAAM1BMVEX///////////////////////////9HcEz///////////////////////////////////85yRS0AAAAEXRSTlO5DCgVgZBxAK2fQDRkBR5XTPLKM/gAABnnSURBVHja7F0Jkqs6DGQPO9z/tD8Jq6WWbCCvIjKfzAGmulrW3ooedr6ui+M4TdP++SXPr1l/SdL3aRrHhv7ZyA5qb9xe0L3Am+DrkzeCL/BeX908MezTuPsfOArdgl3KsZuhq99fk/Tx3waum+ByAHua5QbYilkzY1aP728YhrH5InrfBa57OLAtVjpRbYaumex04dq4APeC7vnVSfo/45bXLe33jGscMx3f0A1vyg3t69e2dRL/NeA6wrgdcCvjyPM2U25mXDt9xVD3f/qN0yi3Mm6P20S54vlXtGPS/R3GPSbYOsC4ZAvmJtiaGiL3Zlzx/Ht+Y/KXTJXbqmaqe9za1VYn3N7YpX/OVGev2qduOLIiB7xqOzGuWCiXFVmWtU3368A5lkqeOJI21I5XXaORxVRnxmUTdNnY/4U3riNvHMJts9XRtdXVUttipdzrK/4x7UyY6sK4Gbo+nU21T1zKcd9AGJetlMvyLKvj3zXVfeqQElMljINx3MK4xVQ3xj2Ry7N/6CiMOIfYyVUXWxUyBx7HuZRbcHt9bf/Lb9zsHlzKzabauJaK47iVcC7jJujS33/joKkmxDnM4QiJ4xDjZuT+DXQW3jgxV012qcPuiePhCGfchlv1/P0D6Czmqmuq2gPGkbIS8Q4ZsNU3dGP3Y2+cW1RyKpkrbAnwqhi3iXHFHrU3bFVV5c3vBsCsOALjkXErAW85F3rjFvBm5Kos+TngCOXYG7fA1ojFER7GPUHbmer0tfGPANeROM6pjvDMQSkrsWQ1d564Fbr61964TvSqDa6O0ELmAtvGuc2rrpQrn/aa/qCpYq+6mSpOVhnjWBy38u2JXFl9yL8acg6CV3Ur5yxVZfW4AsRxG+XKssz6n3njVMYR4Eg8sj1yi3tgtroxrpyhG38gc+h8PYddPQ551dVQW5jju2/cG7kXdB946Uy9cbDnQOpxuCCHcq5dHDcht8D2/K67VxPNGtLJd7qDTcgb1zLGbXEcY9z0Fd39GReTzIH1B/2lcxrGTYxjXnXyqxNyef8zpipVlfDsyCCmDkuumhGvWq6W+vyisqxvDJwwOxJQO6fNmjaQcRt0ZdR2dwWOFZViuculNWtgBZjk+DNq1cq45y+Lf5NxE25B3oEyLueFJWqtT+Ciqr8r48jsCAyAG+2Na53MAdQxX16VhHEL4Z7Ilc2dGad28pskaULiEdDlyijjdqa6gBeNtwSu63AnP3V6NUnAG9cu1RHOuL2hVi5qr6+9Za4qV0dCGcfCEfDIufWRFbsZvKy7KeNgW7XHvRqxWfOGLhO6XCrjoiiPb/rGdZ75uGRfj9u3B1sWAEtdLuxVF/Cq9HaMe4A4TptkZYwLqI44rmGDbUe5E8hZcg54zquRbHXu5NN6HKuO7N84YqwbdGV/Q8YF5arUN7CJTNLkgplD5T5xG+OOI2ehAhxv00ocOlpWwhHwljns5uNg6bxCb9wbueSupip6VTnj2jGudSvnOeqrVo6h7vl2nHM2K8AkV1WyfDYDvHUcWF+1VBl3EDlLKdc2dQ6aNbhXw2eAt14Nf+MqFse5rDuS8tucHUmhqaJppYF6B8440h7E8cjhqMTiLtcaAL+ga9jWZb35hpbHceyNI9WRSmHcE7n4jqbqTp2D2nnzgm154mB1hJQy1cwBIpd3twCOrjnEoDsoTZ2jepybb2VKrhpx3zB92Z29Khpl1ZN8MHWzJV1CdYQHJEeqTMbqcfEMW+obLBwES83w7AgvY0YlMNT3N96GcXEHGQdxG2t3CQ5kDkoFeO8esHd4fc193jinAtxvXhUN3Ywz5VAFGM3cENfgVM4x5YICYRumqu5yIVMdJuhaLXMAFWBKOIhbWFBiO44Dg4Usxx/cCrDyxqESMIYuu4lX1fYcGnVaaVmtKXZxHOzW5Bvfqtk3iLAFuVaLew4HluDUzIH1VYMZF+AgLMZxcAYY1uNYBTgrwPDIaqxOQ1p540IchBFTJW9c2ofNAO99Q+sYaugbJ35Vd4sKsPbGqVM33KsWmdpXLeXqufsVNwhH8FyhOh8n74foKb5WVDr0zFky1Rgt+iaJZyJTWErKMynpqsqgVy4q0xv0VTvZq0pJPq5jzn41zzzVET0aCYjmTO05OLaaBEwWqhvSenUkKtVw5P0N96mOpNr2YCPuh4AJCGEAoioDver7628Sx8WAcU2i1eM259AWhZBzuQEJieN07JR6sCHgXoSLnepI7yo9NqgCLE5A6K4hjHGKsVqK49JYEGyBg4XIq2b7FREUx5Xu2LkXOtmz2pJBW5sOqdjJF3sOjHG5fz7OT7n8DtURwjjPtBKtx7VLOa6Q4zh5Wkn8xhvU4xbG9al/s2bAbxwYkJO7XCGME43VIuMc56Dnqi7hpPE4cVopBLnibozTp5X4DHAQ49iwfsCX3IhxYFoJB8C0y7Xr1iwBSZXDulIUjF11G6+qr5aPALlCmTrfyWfQzCEK49xoPMnnjFMaq3QlX9tzQPuq0QFbLeNbMU6cHRn3Sb60HwJ6NXAhKQi61nzpPAbtQaY8jUUgQnRHSodxZSjjoig161W7HePIRGZDJzJHQXiEzE4DpRtSjotCHzkUkhj2qqJi4V54T1S6cWwVp/nhjAP1JQuDhbs4TtFW0spKTgW4UHJVFv4GQpcZA64jkt1xDNS8lDEv9Y3z5KpRGY4biIINMC7e2lxKNFJDqUfQquGZA2yrHoINUM7G6ZX1iVM2RKDUI08dssVUfduDRyI5QDkbFWCnscrWVWV1/RZ2uaRc9UyKL1LO0r7q1qwBm761WsmEUjdge9ApAB9iHHWslq4kMalHTbHQieO0zXKljHmIc4XdOE695yCpsg7eOE7t5B/4Uqv1uDSGKhDYq0r6yQWYj5NnRw5BNxjOHJAKRJB+nJqr4jcuOki4qOzs5qrgulSDJzJHUcyrCNMdOc44ty5nel815KDZ4HTypeoILAEfZJxbCjYkSpVKgZx/IpOfXgnarDkKXWIrHAm7kiTqxw1er+oQzg2Bj32FTcYJ2kpCIx9PK2XMq1ZCz+EM46LYZK4qaCsdmo+TqiOV5FWPITdYLZ2jOqYa/6LN8kJSZT1dxkSTJEYKmZ2/OuI5aIYYh+UzKn3TN9A9mLjL1cl6LexKkqof575xVJWVx3HRefdgUbGQNGs2U2Ul4HYQ60o+HeBzjCtt9VXVqXMpc3DEzh2NzEJSnr7OuG35wUTpPGjqXN3lQgdE0AWRA2sOHls1eO2yh/uqWM1LbUgvQzeatOhR5NZM39QIBNyQbviBVajYItbOYa56knCbrRrUj0vxTn5QVQlOnUtdrjKKztuqpbMEJ27WtCG3BzX9uMPfYqsmlW7SPnRfFeSqwTrAp9641VZtXi1PlX1VN44THzlvPe4k45aZLys9h+7cvuqsAqEpBAm6I9HJN24pZ9oIRzp5XzVUsVCZOnd0Ry4zbu52GdMBDn7j+NVyYXaEneW6+sbNrQcjtwdJCTh4WmlrSLcF3axRZ4AvMC6zxjj9annty1X9M8BoefBMQGKudB5UjnMnMltQV1JuD5JK5jnGTUU52zeke+4cfMJ7ygxwSZuDJ6EbzDEuZF+VNLnczCETlPdkdf3Tj5yhAHhNVdV9VXgJGV9JyqWjjRdS1fWRs6vmRctK1KuiLD/b22q2KyvlWJT1HOPeo3IWqyNwlwtrxJNrlwW69ZNr0qKnoBsfNrWVcH+w9gzIFXxDeisr5cxSrzCusFVWkpVukH7coF/0zQRt0a2QGZ1HLrfAuIfDOL/uiLOTz9UMMiTmtXMOVXmxW/P+OqM6wPBKEmLcbuiGMw4lq9cmIPbewa5iIb3LdYxxKHMouYDcSeRqcxd9+dS5VFWCGZd3e9DtR5+21dbYRd/1EAaagUC6IzDLV7YHj4pSKbmDkZRLnmRNcHeQ3azZdvLJ9qCUOVyhXGVmQUSpx9GWAzNW6Y0DmYMzrbTeHjzxxTeI41zktugXtQezAsRxon7caUt9VZZMMQ7pAPMnjnTyB5lxJHPgU+enGTeajONUHWB46wfW41jmAE79nHerNiYyFeXpBu/keycyM8983CWv+sxWLe2rsgpwH7qRxPuqb7pl6IKe61RPYpcbvefQy3e58LSSbwY4B071CuNKk31VtswlTyuJ+6oZuss1h3HVCTEDluZb7Ks6prqrjijlOLTLxRlXUhng85RLo+77por7qp5c1fUN8I1Tbw9eqce9ArkvA6eqxOOr5UQGgrdVC1l5GszHnYSuNsC4OKgeF6au73S5Mt983IU3bvwqcN3jAe9y9VgkvvHPskp7DuI9h7PfYOGNw3EcH7rx91XRPbNPT2TOEbCNNw7uJOGhG+naD8+5PG/cJcI9gYu/CxuYVuqd+6reHbgBWqrvavlV5LLvAqfdc6AFYElcyW1IS0eScqg7ch65/MvABXW5ElWvZXDiOL2Tz3VHzn7Vt4F7iNuDobMjwp7DUh3hfKs+EQCbAs43O9KgG9KDrK6vMe5qIPdd4NS7XFLi4NxzADf0eEPa8aqX1lV35REjb5zac1geuYVwtfjGbTmXsJH0qf7g14Hz9xzE9iD0qigewTv5F71qaeKNwz0HXI+jb5zLODABQWaAP+MbXA2SbxdH9KlzMjw9jvAUMr72o6363hQ4VyQ+lU+vkH70ALVFM2cnP8f1uOojhLPgVZnWI7y9Enjtcr+TT/qDJdj0LW9tqlgFQtUdYQfNQupxnHE3dw5aripmDgOcOt90gHOpOvKRF85EOCJKPSrVEa/y9D9QLDQEXKco3UiqVPtdrjZIIxNuSEeX+qomc9U+3S/WUIUgvD2o7nJ9UnfECnAPWQUiSOu8HYKERz6oO2IDuE7THcHOATIO9xzQhnT1IcblVhjnagRp8QjZVw1gHOFb9ZnSuY1OvutVe3/86w4Be7XOc6GvetsuF47jAq5dElFWn9a5oJF5YUDOBHCdds9BzRw2xrWy1jl946qrC6tfb0i7uWoKZ0eaoJs1e8LR+6pQPy66GMiNhqaV4ljbc/DqjrTC1fL8n/RVa0ummiI1r0a/yyUPT2dcXBR08s9Cl9gVpdKvEvgO00LB7qta585g4eP7jIuDxEXdaSV87TID91WdiUx67uf011lkHBTea/R6HN1XhTdr0AmROw9Pd1h5euurJvxKEh2e9uyrfnYn38q4vnp7cLchXXuVbtxdLoFx1UVtpWnv0uLNGudquTCROXj2HHI6riRK791zJakjIxDKRGatMI5fu8z81y4vzU5bE2yJmYLyFsc1jaythPcc+CW4j2grGVi71GTQgnLV1tFrQduDUj3uWvwb27p2Sefjel/PAXXy+QywoFh4IZKrTF67lC6I1H6NTHEGOBeWB88LoVm6dimoGaxO1a+RiafOpX3V8r7yGayOuZfPgGsOQhy3V4Fgew7wSlJ5hXG1aY1Msj2IK8B0BAK8cYIIxBXG9bZuD6ZUlCqk5zC0x/Yczh9YtSVK9ZA3pAN6Dqq6vnAo9ANx3Ndl0LazXPK0kq/n4J06F+45XMkc7Ajv0Sy/VzZrpAsiLUnyhZ38fQX4vOqIOXX9o9cutRlgfZfrSuZgTVxU9KrKPQdQOgd3CZB7OO9VzcnZ4pYDHddnkoVSrprlAXe5ynN5gxF1/Vi7ocenp7XdcueJyxSt8wtjhRYku2EcB3Hb1LxqHMb9192VJTmuw7DxSsfxdv/Tvn7TSceiAEpylqYnH/lWsWBRXABMVLHQ8B4cjvWUfN1xTYU6wJEqqy7y1ynBEIGt8ycqBxe2BGh3JEt3hO3HtXjm0KFJ/kHIOTDCmEUM2RFMH9ygn8N+WoNmDpcLZEgfFuz2pQPMKof7eHBME0RsxAVX3OFS1Y/Zj77jtGQ34nLRWjVeHtFF/pOIc2EvRdf1m/2UKy11s+8qtXzmAKQMhiNNTDefqiWtFIlkQqEbNJFuO7g6oqr84p8PC710IxN0R0bK5VIFV2svTx9CnCPTxspm1iiGiBKeptmh26tAYOXpp+y3HSGuqUwnONzIZN7bRAdYp4bDZpee5qq5OsAKcdTQISjykUjmM/aq3lRZK3rH6a5SOMmPZw5BQ47yQ05rvm3NVVXhkLCs0YqF2EN60A4iw8Ev1dtcNXvmsGK+qukh/QIRtEHE06cK1fXtKRfLqoTLRadcw8Ev1ZkTXBXzVdkdt5k1PvtQo/24I604520lvq0EFAvxXLXlytPHpjUXcRU4tTuiJvkx4EbugxHojrRJTn4p5jY3gcspucLQKW0lVnNhFQhF5ir+VhsvgZsN/Tji9cOcVybD6wcOuQ5MuXpxirhyt0tTea9NTPKLEVf7CdzMaZdZbpd0Pw6LZ1wiN7PhWGpwk1Uz/BzQDsSEnOB6vXT+cLscntoB3sQZ4qiaV/qOixjSJYgrBNwwu0OcSYKzzbe1ExwYrF6InFdpVp3EG+IIJSlsnWv9uEQ/DrMH497IcOgt4hNxC9vXv2b5ElhU32fuuF78IQ4r3XyreV3NST5V86K16uG6YRF3iIt1gJscxRbgE9oG88E2oa5fdMu14h9x5pZX2I9DuaGn+nGXmOdw6PHrvh+X9OWagGdNbzCkI5uk7NhpwHliSDf2sIY4wQHl6ZysWvoaqcUz4hLyGUrsfF85QIZIvASsh1zZsYsA54qTDyuHSAViM7wH+x6NarDWeRHiFpHT3HE1g5zldsk6wEDOdiiwJejFJeKYvaqtWEhFqShfFSkWHikaPHZH0qJUxEOvnK9a4CE9ibvACVQsbMLKwWTWGP6qMeKOAW6o3AWOXHHZ/TiD55BGXHZW3UScfqqPVdbGMjSLa1VVcRG+KmRI53fOOxGnn2piedpgSK9GB5h0MssBVzsM3AwdfXPuuFh3ZGLaonBUk3/J9eIfcXDmcC1RLEwotgTvuDzIDY3LwM1z0kMam/1gjcyWjQePq7VscjrE2YuFxNHMLFWB1vlwKDO4rlX1tj7ROidZNc1XzZJPZh/q73O5BPBVo90R5PaTyKqYPVhcdK3iGXHxJB8RRLT14KZYl1FW7RJa5zkf6uw2cJJ8x5kbmcDsx+yO6NglQreInO+Oy9oBNry348qh2M5hFTkH4sysihA3WXNVvAIciQSVtH2d745kdZUYQ9pa1o8QNxzLqO4m+eFcNRk6BLmWiHZ3gK+a+FZH8Y444q9qbuuTmcMLlad7Ee+Iq9gOcNJ7cFqZDjCXOs98AV9m8Y84OFitI7fLK0VcwHPoqZ+Dks+wPtRhEf+IS4kZ1ElqOZrW3CBH+ar2O24U34GT8rmqntWsif24jjFrrCtuEjkD4qC2kpqrjrQ9cpDLZXlIt+I+cEl/VernsB7Zj9PTQZIYKjkX4iCz5go7mYpZY2qdI77qH+M9MtRyGsQZXC5rrzBWnt77OQCNzKB2YIi7ipwDcZXJ5YJS54p32UM/h84WAmZZdZMTBE435LLt3sm2foajbyqtTnKCwCkVCFMlHnKSpkhev4UdYHDHke5IK2cIXKACYbuWm7UqVp7uzDsOI66bzxE4ogKBZg5ZtWqCIR2+4wDiLtl2s84m+VW8ra+YNXZ3BHaA4VwVvn8vjcipEJezr8/UDOgOMDeYYv24ZGXvtzuS0Y9jO8AT3QHmnPzhz9G4OZs5QKIvFgJW40FYqraAWRP4OQSRK4qbM55Dxpeqd4B/uiNTmj1oVg5ZhZbvKZdi1mBHMyIuanPydXdk97GW4U28GZqFSjdL8h2nkgN+x7E7bo+40rj50AHOkTq3NYIQ4tpolRXKi36/Q0rj5m2uWkV81ZS6/hRvK/XRyIHRHIby95v/d1y9WEk1lmW1uVx4XekWua4SOSHiKuZnZu3HYXV9yh6EPIc74NojBuQe9uMqUz+ujp4jI+2dt6w7Qp3ghuw+krNaNctBrwYqaNB7MHgAdyk/h5K+pdfx4GzusoafKujHRR3gDu/HhfpxfxF3lTMGbrZtCdB+XIi4KDegmQPagbh1zsufIY4QV2ltJcVXDTn5EeKKuFyqcmgrOWng9g05pZG5RFvnd8SNtDuiPKRbw9H3/ztumkVOjrg5ra2kEIe7IxBx4e7IA3DjMwf3eMfhh9xovH/73dZ5n9cBHrpFzhs4hbhgB5iqeaH5IGDWtCazZuhnOXHg5jmdVX9mDte0u9TjAQz9HB6Iu4zPHt2v7kgNe+cb3FbqeVa9qBfw39C1jZw9cMBDmr7jwqHDylzL+5Sfw2V9wcn9Iy5qZFoTaZRV9b7+k1nB55Sr2gEOaysFiFO+tCSrhqsj2yzyjyAu3lYCHnojyap85gAdfV9wu3l+x2V0R36INSvWAUbvuMvzydRprWogTmfVO+AI4uB+XF/JvxK4UHekMZRucHdkQhsQvdqPuwGurV95cl+LhUR3hPfjTN5lkFa78bUH97StdEdcOJC277h0bvgO24ty6RkQV5OtG5Pn0GIy19S8/OCeKofojlu47gjVT+4/EjZvdu9grnq1uVxAB1il1beEzRtBJJQICv1VMeKU93a0OzItbzq5k90RgLhl+XGCqy3ERdYrO0fftXnb2T3VqjfE5aigMbf3YANirN54co93XMjJT20rhWteP5Hrr/NbT+7xjoPMctOzJkqq6/Luk3u84+7vuGUBSzeBweoE3yPTm8Hm444LiA5gyMXuuJU56G3NR07uAXHVwwo5fgBTf1Xo2rjVnzq7r6yK1LwSr5HHHTdt9fy5k5/R7XLcJdX7FbeOy2dP7trPweQ57FRZx7r6+Mndq3ldEzrAY938ysl9uiQ1cJNVa2SO16X6tZP/dj8uDqJW2VfM/O/ftf7FmPkK3OMZ3MAu8G3T6ytiTTU7OK8jxMlfuN1idg/X91/9VUZ81WOVo8P+Bw+0DogP6NDPAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-up{transform:rotate(-90deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left{transform:rotate(180deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-down{transform:rotate(90deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left-up{transform:rotate(-135deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-right-up{transform:rotate(-45deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left-down{transform:rotate(135deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-right-down{transform:rotate(45deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-control{position:absolute;left:53px;top:53px;width:50px;height:50px;background:#fff;border-radius:50%;transition:left .3s,top .3s}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left{left:33px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-up{top:33px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right{left:73px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-down{top:73px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left-up{top:39px;left:39px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left-down{left:39px;top:67px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right-up{top:39px;left:67px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right-down{top:67px;left:67px}.jb-pro-container .jb-pro-ptz-icon{position:relative}.jb-pro-container .jb-pro-ptz-icon:hover .icon-title-tips{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-btns{display:block;position:absolute;left:0;top:156px;width:156px;box-sizing:border-box;padding:0 30px}.jb-pro-container .jb-pro-ptz-btns .jb-pro-ptz-btn{display:flex;justify-content:space-between}.jb-pro-container .jb-pro-ptz-expand .jb-pro-ptz-expand-icon{display:inline-block;width:28px;height:28px;cursor:pointer;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAANlBMVEVfX19fX19fX19fX19fX19fX19fX19HcExfX19fX19fX1/////Pz8+oqKjCwsKhoaHn5+eWlpaOqTaDAAAAC3RSTlP/3CaKxwJiAELtp4ri/s4AAACuSURBVCjPfZPREoUgCERXBdPRyv7/Z6/Z1aQp9oWJMyYLiKUrOIpAJBdGCldgbzBkPM/QEoTI3jBEPBRDhwEvChe08Q1Ge0ImvIq4Qj8ljrLdH77CyQPWlCdHC0Q1e9rmmuC+oQN9Q4LwcQg40L6eyqm0uEpXSUqe3fKpkkqL+Y/o+07SrahNEO0T0LBsvOitf4xsLqiNTB32wtqaVKosGLO2mhUrS93+PZ4D99wPqzMJVcbEyA8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-expand:hover .jb-pro-ptz-expand-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////i4uLZ2dnIyMjExMS8vLy+iXNeAAAACnRSTlMAYomLxwEm9+NCLo6DKwAAALNJREFUKM99k9kWgyAMRIMmEMLm/39tKaVKFJkXl3sYJ4sAXeQ3ZOcYd0+gRYblFBuFLYoS2ot5lpvYn8zJQ65TO2GVNmdCmQq/qczw4gjpejD14BgmhziEIvCjVRlPioftHW6A7xBB1a8CCUMvsuSqEkPM7eZX6h8GrQ67bYpNIbRL6rb4/k2EfVXKsgmqfQrW9qnGq96a28jGQG1ky2HXpVysyYyeDIhWq7le6ua9P36HD6+2GRi8iBZBAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-narrow .jb-pro-ptz-narrow-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/9/f2/v7/y8vLUObqxAAAADXRSTlMA3IrE6SZi9wI+y0gNXAn3CgAAAI5JREFUKM+Fk1kOwyAMBQ04bJHT3P+0JVUMNMWv8zvSk1cipfjAKXHwhR7k6KTjYp7dVuWLug1XWB5wz96T/JD2O3Phmv0k5ypL6lVVFIPYpLOka5WKSSFvS0/BloHYlkza5HkMzrvVLo8ZlRr7mtFYWBBsBQ4BjC//GTxcGVw2PpOVHQ6fJj7qS4936OoN2K4e5yE6N1UAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-narrow:hover .jb-pro-ptz-narrow-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcBAMAAACAI8KnAAAAJ1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v7X19ckk9ihAAAACnRSTlMA9+NCAsuKJsRiPv/2GwAAAJlJREFUGNNjYAAC5gxFoTYDBijw1FoFBIumQHjsUavAYGkBmGu0CgqUwRqlYNyFIO2Fq+BAnIGBJQrBXerAwLkKCUxgYELmKjBYIXMXM2Qhc5cxdCFzVzBoIXMXMYAcsRsMdgEdgs4FKT4DBqdAitGMQrMIzRkojlRB9wKaB9G8z+CMGjgshjCuMCjoWNxRAxYt2KGRYgJiAQAnZcjElaB/xwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-aperture-far .jb-pro-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAASFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+kpKRzc3ODg4PFxcW1tbXW1tbk5OT29vaVlZVmZmZ8vCMFAAAADHRSTlMAxGJ5Mssm9+NCiYtiH91SAAABAklEQVQoz41T7Q6DIAyEJQooUL55/zddhVazzZjdHyqXXo8DhWCYTWqltNyN+MZLuxP69UGti/vAsl6c0e4L+tQ2yv1AEbvecMhO5cXdYhk+6aO3WGrNAMwentlMz/ZAKIlNoRsqY2wtFWu9t8wasc0iYVN0LkQfrG1zbxNyrIBcntOQrH1Ukkb60QcxYF1xMA2dh8zWj6ZDsLCsIrL4Ds5Hm9FMbCEROWUB0COaLXEIZJKV7CKybGO7UuxjxY2C/TkMbxboKBQCxgMN6MCJQ6Ch/QjOZg/B13LGx8FDTe3IFvl+Bc9XBi3UWoex68qeL/vxmdyxyvz3NJ8f9dDef36HN7koIK2LjxB0AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-aperture-far:hover .jb-pro-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v6cnJzr6+u/v7+xsbGlpaXNzc3b29vqh7uRAAAAC3RSTlMAyRjKA59J/3PzPhe1wxwAAAD2SURBVCjPjZPrssMgCIR1mkYtisD7P+zBCyZpM5mzv5hs0M8VnZvaok9BlXzc3FXbO5z0vtifFC5Kn8OL4UfxwVvuHm61d5Z0b6ZGZZwZpQAUosWsjVZntVS1sH3ZFo1IRVYfGXgx+VGwNkkIVbhq9/jm3cAhaNv1Uk3IA8mNn7D3kbQeWK3TLH2jCthrDFcTMwUWaKiClc9mJtJWhS3SF5BpJqMQW1b3xwnkDahMoHYomkeJRgSENA/MFsKML7fgoCBVbGvM+Cx4JcKWbWHKK/h1ZYS1Jy/nK3u8bB3KhzG5deMxtfv3aO7/Heq+9ms8h9fxHP4AHzAWU9zlWNgAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-aperture-near .jb-pro-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+FhYWbm5vz8/Nzc3OwsLDi4uLDw8PW1tZmZmYgm6a+AAAAC3RSTlMAYmOLx4kn9+NCIVJiPGAAAAD+SURBVCjPjVPttoMgDMOJAqOU8uH7v+qKFN2c597lF5LTJg1VqQG3aGuM1bNTV0wWDtjpg3pq+IB+npyzcIE9ejsDXzDCrjccs+tOariF3n2OLyw5xko0vh9MDjNb9Q0hp2GK3cixlIApe4/JD9appR8SFxWAUFLg6n63iB1irnY1Jv0mlrok7nUdcZRa1YeshxBA9iijChlxI6iZEaBgSEL2tkRcymPGGJpqlbZ6uDg0WR/F0DwuMpxDkYwiIXA8hO2uMJdGCCK6teB8RQoY8xGfevQjxYQt25qoRwDT25MRBjZ7GtP/P/afa3LHmrflXa+ruf661Hvv+et3eAF6Fh3v+sSUGgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-aperture-near:hover .jb-pro-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZn///+qqqq9vb3z8/PMzMzo6Oja2tpXGg+mAAAACnRSTlP/JomLxwJiAONCr+rW2wAAAOtJREFUKM99U9sWhCAInEpLBS///7WLEWy7p9O8qEzCMBIOQ15DAlLYsoegS9yFMKQ93skl4Adh+ZI54Q8pG5nxgKzkgkcsk4zhmQxRyN1OPHqtncjOu5AuppcJ6s1EHTA1YzC3Wgq3YmzGqpsmlwZAo7F8oLEVKoeE6+TbSxK0JJ/3FLOwFnUxzXuoltYDDMLoAlmYXLAWIrkqbdZKs+q4KBfkNV1uwGaBim9TdLWS3R7iGRvCNTPB7JvGlc5EXK8cKbrxooint73RzXh7Msl6Oj/uT/b62O9j8sj6gMXX0Xwf6jP3Zr9DtNAHTYMMXrXSK0YAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-focus-far .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAPFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////92dnbs7OyFhYWjo6Pe3t7Ly8uxsbG8vLyG+Q0EAAAAC3RSTlMAiWJjx9wm/0Lti7mfpe0AAADaSURBVCjPfVMJDoQgDERFC/bg8P9/XUSO6CqTqA0TptNDpSrMpC2A1btRT8wrNKzzjdo03KC3zhkLD9imbeAFhd3sG2kvZQ2v0NknfGBJZKkhBM9MxOxDKBV1N4iHi0TRHYjN01Qi7/kK2PtyNDU7DAEJgDAAN0u1jsQEFEkcVVmrqjeXrkWRmC67eqbgG7bJyvkQSQkvUvec7szpek6t9ubWJSK/uJVSm+APzHKCh++DWWuH4plQKNYOpfappcjy2VvJn9744cjGwx6uyXjBxqs5Xuqsvf/9Dj8rLhRg+bQ5VAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-focus-far:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZmZmZn///+xsbGoqKjt7e309PTExMTQ0NDe3t774OlGAAAAC3RSTlP/itxixwImAELtp8B2gZgAAADmSURBVCjPjZMLjsUgCEVpq60G8Lf/xQ62gvNeOmZuUiWeKHC1cKnC5iJAdFuwJXgmf+xg2g//G54OPuTOCUOEL8WgMMCLwgPP+Abj2aF38CrnBR7whw6Bo4fWUk7MMrQ2OrpAq0GspTLLgKg1wTailNITZA0EaTkZGjIAY5NwlATah5CGRMJYj50tFtlWiapsLvAPRdtL/WOmET7QzZyl5ywzp7NWsjBJ1odsragJqeJ9HGFNZoLaJw71hMTm0O7NeDE1Z6YsU5rGL69sedmXXz0ToW8PzA/oV09T8OJR32fb7+B17Qe3WwtC9PVbHAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-focus-near .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAARVBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/////t7e2dnZ3W1tbGxsa3t7eDg4Oqqqri4uKTk5NImu/5AAAADXRSTlMAYieJ3MvE/0Lti4oh87zNagAAAOtJREFUKM+NU1sOwyAMY30FtoWS8Lj/UZe2gWpVh2aJH1wcO0mNqbDj4gDc8rLmiscEDdPji3rP8IX5fXLWwQWuaVu4gbKDuyPdsJMz3GLefcIPbJ6PDCEAFDlUAJiORM3NigQFAXAFlqOeRhWJyFFIHxNGvRrN0mp470U++3axGM2RAmXcXqKnkDSN0a9WIk5Sa01MpDXBQAdVtrA8lBhFnnKpsmoo5VBrhszV0KuJ5N2tP92O50iQjpzcctravoihdoi0Q1NrfN56m0VWzFBoje+OrD/s7pr0F0yUr6s5/LvUu/bz+B2ep+IHdMIV2SUZfCsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-focus-near:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////c3Nz09PTp6enR0dHFxcW7u7uwsLAUKT0cAAAADXRSTlMA3IrE6WIm9wI+y0gNQZpqdwAAAOdJREFUKM99U9GShCAMQ8BF3Cmlpfz/r15dAe88l8zwQiQkoRrTEa3zIXhno7lhWxcYWNbtN/fa4Q/218VFDzf4of0O8A/h3TQfOGU/ytsOj9gPVyt8warkmYEQQAgABYDxTKROz88koS6AVIB1fRCNbSI1cVUy15Jq27LGjTtyzipPeWw40/IXQkrHyZSRmqw3LaQgctFNKYzYyGACfEXossLMojFEj7J0WfdwJ3dD9uY2X25tL0Hj45mTR87Y66u9IQFsDS1bL57o7JbUDNIofvpk08eej8kTe3Hz0ZwP9UFfv8OgfgBUByCEUZhYtAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-cruise-play .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJWSURBVHgBtZe/b9pAFMefbSYWMjCjdOtmYEYqXVC3umMlBFRiT7qxkexITcdKSDUSYna2iqX+E/DG6LCQgcETUiR+5Pv8I3Kc+McF5ysZ3x2++9x79/zuLFEG9Xq9s/1+r8my/AnVJq4z/2LZfB0Oh1tFUQxd1+208aQ0GAa7kCTpMgRJk4kJXk+nU5NEoe12W8PM/wrAotIx2Z+w3MkE7XQ6Q3S4otNlY5zPUZdL7wiMBUsRIK/fDeWvhQ92XS0HrQia83cCsqoIyMug8gQ9Ho/DpF7FYpEajQa9VTBoyIZxWeEfv6IndSqVSjQYDKhcLtNqtaLtdkuigmGSZVn/XKiqqr9wqyZ1YEtbrRZVKhX3zvX1ei0Eh7Ufa7Xan8C9VRIUg9lyQZfzO19VOOugkBpAgaXRtnq97oLZ5ZvNJm0YQkBZ8m63E7YyKl5ntrrf77vlJCF/qzLlKLZ4NBqRpmmuF2LBlLOyBFYBchDKlIeWyyWNx+PUtS2Qtx+eJA6i2WzmQtMEA+8KnA+73a6N+jkJil1pGAbN5/PMfRBIZsGn3+LFvSABMYiBgpnJgZEeFHQD4EzQrOsWI4N/nrY2uPg/eeefV8WvAKfALOsWJ3jzA++rcqjhB25OXAd244nA62AjV4LGxWLhIBk/oPiF8pc9mUy+BZVnyQEzueEZUb5yjyvhBiX6BCw2YTGvdZNyAkYPZsprT/rgO/K2vDcdQQH7jes7gPcv/kvqyCcKbEVX6PxVAG76QWPGPZAIDcEZqGECTQyokpe9wp8VfNqzyA2L9M+KRzm19l1i6ZQBAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-cruise-play:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJ5SURBVHgBtZe7buJAFIYPjsVFAok3wBUlYcUDLNvQISUSDVVCA0IUYZ8gmzcgBeIiJLwdFau8QToaQKygovI20CJBARKX/Y/jICPAF3B+yRpjZvzNOWfOzLGLLKrZbAaXy+WdKIq32+1WcrlcQe0vZb1e/8XvQT6ff7fyLpdZh0qlEr+5uXne7XZxMpciCIKMSfzGBBSyCwVMAqxpEXYEhzdeAJYtQ2u12h2aJq4gXadSLpf7aQptNBoPm81GJofEsc5ms9/0zwT9j3K5HHUSyEJ4ovV6vXkSyjHEyvxDXyCAHxGy4hEUq+4JjWQ02O/30xV65rTbQ9lKNEWjEYFAgFKpFMViMbpQnOfFPRSKWxnldrtVaDqdpnA4THalefMDinx8sDOYrY7H45RIJOy6PMibjch3F24AJEmSeo3HY+p2u7RYLEzHwNqogOUcpSvFrk4mk5Zcjry9FZCX1+46qj5dzvEOhUKGfQVyWAyPRCLqojsnEYtohpiSE5rP59TpdEhRFMN+Itw7Q3DpGq1WKxqNRurF90YC75+gnXszulBsVbvdpl6vZwpkwasDNWVw9r3BWlu5Op1OVdBkMrEzTD11RO1exmUJytb0+30aDodkV7DyjT2rBpNrG8zg3WwQW9ZqtS4CatASt/sVhAC/GA3glWk1bqcEo+TPwm0P5QeYySt9jRS9UQe54vF4fqEZkMNCdXivrw4PoJlMZoad5IeDYE7F+0KhcPC+syVotVotIQ5PdLm4CD8CGkJZfAIhzlw3SWRdM+T9q9frLbHnTnUwrfBZfPCiecQG8v3MBHj/HvAm4/P55HMwW1C9tG8a/RmsGH1CnNJ/17UakVMOx7kAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-cruise-pause .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHySURBVHgBxZc7bsJAEIbHdprQJAU1ckln3FM4J4jTIkSMRB9uQDhBlBPECIk2yQ1MSeeIxg0KZQoKKpSCR/4xtsXTNmA7v2ThHe/ut7M7O7sIFEOGYdzO5/OSJEn3KGp4ZDy33ucxP6vVqo86H71ez47qT4iCLZfLJ0EQmhuQKNlo89rtdk06FVqtVjV49kZrr86RicG2TdMcx4LWarUWGjzT5Rqjn7tdsJAi8Ch4C4op1TGl75S8GKwCPOWC6FsRNDKAL5SOZER30HcAhbFFEUFTLBapXC5v2fL5/J7tiOCXofHLlVfikRhRrSqVChUKBXIchyaTiWtrNBruYLjM9jB5jlmup4vFQqMYyuVydKE03vsuVBTFR8pIcFD317REGQlRXBJ5PSl+iktCskgZC57eZA5l/Q/Uy4lTykjYq1++p5EHb1LC9rRdKA7dT8pO64yERG/SmVM8m81OqW7yckr8Ztv2r6Io1whnLawF59fhcLiVY0ejkWsfDAYUJfRfB+snOE85J2KRvym9RGF2Op06vwRbhg9YHgmlIz7E235B2vwC1x1VVdl7jZLT3nVF2q0BsJUg+ODFTDpU0wP3PfC5a2wB+BD7CuqLgws/TQQYn7cyxYfxfdc6ViEUujMAHUlER4cKHfhbATvPjBUG8/UH1xXJDxHoYGQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-cruise-pause:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAH/SURBVHgBxVY7bsJAEJ01CAkJKUhUULmiDSnpoKYINyBuQIgi3AA4QZQKIQq4QaChhhuQCxAXSERUSDSIb944axSS+CPA5kn27o7X+2Z2dz6CXKDT6URXq1UqGAw+Hg6HDB4V4qj8rAsh9N1uN9rv971KpTJ2Wk84kW2322csVv1BYr+gEGMo8Foul7uWc6w+NJvNjKIoHXRVOgMg74K8AXLdFWm73a7BujpdDh3rZH8TCw8JLYlPSFutVh7NG10feigUetA0bcEDxZTiDFU0L+QN1M1mc1z7SBoIBGrkcGkSiQQlk8kTWSQS+SP7D3CzJ76c3A/yi61kodOP6XSaYrEYzWYzWi6XhiybzVI8HjfGLLeDNGxoWpohF8C50CXgwMK+r0gNCuQTENnyitQgRT4BQSOlyFvrKsRdCapC/uPuFqR0G1IZExfkH94NSzkHkk+Ap4wNUiTqPvmH74gUDoe7dOYWr9dr13M5sfNxBnjQ7/dXuVwuDGHG7ieOr9Pp9CTGzudzQz6ZTMgJ2FFtMBh8HvMpx0Ro/UEeBQq2slgsatw/uoxMsBp5A64WG+bgxE9LpVIPpUWDrgv7csUE4nEdlWCNPCC0JJXEF5Wg8MchHs11CWpCVvZVkBfckksyrneHVnMEuQRXitiqPBS4lwpEJYmORkc7Qju0IzPxBZ2t+3mW/JtqAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-fog-open .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKgSURBVHgBtZe/jtpAEMYH28WJioIa+URDF8MTkAalO6cH4YIiFbk8QXS8QO6oUlCAkGjDtTRHJBoa4nQ0KBZdJApoEAV/Mp9jkAF7bXPcJ5ndtdf725nZWdYxiijDMBKr1SqhKIqKNpdms9mcRxkjFqZTsVjMy7J8x1WdL9WjC6D97Xb73G63m0HjxULAvnI1T+FlMfxBBPeEwoW73Q6we7pcViwWe8+utwKhDFQZ+IOrGr1eAH9ksOkLdSz8Rd5xu1RzBmfdFkvupwz8dmUgBENeYNAZtFQqGVwY9DZSnTVi6+Decrn8h0JYWSgUKJfLHdrL5ZKm0ykNBgOazWbCd9nNt3CzgoZjpUohlEqlKJPJHN3DJHRdp16vR51Ox/ddTiVkw70NlSTp7rRDMpmkWq1G4/HYvmANSpHghXg8To1Gw/M5W1oGVEZD07TvXNy4O8Btw+GQFouFbV06nabRaGRbhbaf8AzvTiYTr8c32Wz2p8KrSuMgJ7x6IEa4AIuivau9tNlsNGm9XqsBY9gxhOvCCi728wa7OCHhRzQAZl2pVGyXRZEoBAoFCDGs1+v2QooiUfpIHE+LBEL+VatVezVfDcp/whYJhAWBVHFvCEFCfz8op6cpORuxJRokajz98tSRae+97OJnUS/RanQLkwNQ4FrzsA2yyU0Gf/br2e12A90LlwYAkS5Pdrm/wRs+/rh1ChAshuV7wTqAQoTAarVat6gorll8YWvzXBXmbdTUcY3/sK/L+4ppmnPeF/9SCGsvAXIsH8+gDthkMFyepyuJgS0GHh3w5NNOzO0zeMHVD/R64BMDP53d93vBORW+0GVnpvmpS0NBXXDDSacwR9K5kxaPok+NUJ8VDlzlQucJvKNj63G2/U3/E78fZqx/rk0w4ggu8jUAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-fog-open:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAK2SURBVHgBtVa9jtpAEB58/EqArqCBBqehorgTVDQxPVJOiD5QAEJUeYLjniBcgRACKeQJQsQDBBoqkIigookraC1BwT+ZcQBBsNd7Ovgk2LV3vd/M7PyZgBPlclnc7XZPFovFv91uRZPJdL9fktfr9W987udyuRbPWSajDUgm3d3dPSOhBMaQUaAXu93eSKVSCryVtFQqPaBWXznJNMlR8zo3aa1W+7zZbIo4vYd3QBCEQjqdfjEkrVarzyhlAa4EvOt6JpNJ6ZJWKpUnHH7A9VHMZrNfLkjJO9Ecv3Aqwg2A1osevFs4vCQP5SF0Op3g9XrPflar1egzut9vCNVHzPS3j8EkcCAcDkMgELh4PxqNoNvtwmw20/tUXC6XSRyLqqZ7LS80CgaDqiY8IEESiQSIoqi7B53qE40qqVYsolTgdrshEokAeh9IkgRGIDPTPhJYC8SD4eg3k52RQNQi7XQ66txms+kepEUcjUah2Wxqrq9Wq6h5Pp8/4CUzD1osFuqPFwfnIsE1IBKbyDqANIzFYhCPx+EtYPmCGQxAppJlGQaDAVwLaFlBgRtAx7T/SNGNZWCg1WqpoeP3+4EX0+kUJpOJNiEqKWA49HGusA6gwPd4PMCLXq+nu4bpsK+6LVV9YMDlcqnkPKD7JyF1oFD+PSSHV9ZB4/EYQqEQGGE4HEK73dZdR+Ua6nh4gWXtD3AkfCL3+XzHZ4pfyrekIQnHApr2A2oqn4YM1TvDWkr3xbozPVAxJ0KaH1MRFllSvQG3gYztz7FtOct/mLqorZDhulD2BVzWJKW2kTZckVjBnviM8IKUQBtQ40ck/w7vAIUhnvGYz+cvwpHZbGNHkcQMwtXGnICs9YrCF/Q2GHb4e3IJBxLgo44ACsY6afbT4XDUWd09N+kpqOhTDT55Jf9/Z0b4C/UJLQCcLGi1AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-fog-close .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIjSURBVHgBtZe9UsJAEMc3l1Q0WvAA2NEp1MyInVbGnoE8AVrSqW+gT2CY4QGwpTEFNcaOEqksKKiYcYYP/xsSJoRwx8f5n7nRu9u73+7lbu8waAc5jnM6m81sIcQlqhcoOZTTsHvAZT6fv5um2XZdd6Caz1DBMNm9YRgPMYhKHhx8brVaHu0LrVQqNjx/2wOWlAtnn9MiT4VWq9VHDHii4zXAPFdJsPGPwK1gIwHk7/dC+sXgAsBjroioFZsmpznCuHKLxeIxqqwirdVqvGmcbaOy2SyVSqW1tuFwGJTRaES7CEGd8TJbXOEo4YkjG8BQ27ZT+7rdLrXbbSUcx4+P3oOIVQ4Wr0Cj0aBMJiO1Q6Q1PvsirFzSkeKVqNfrKjM+8xeCybRMbUcrn88HRSasqs2R5kijisWitB+reiKm0+mhaS5VvMwqCdIs1WYKoJZljUmj+NwqobS8D7Wp1+tJ+5EPvkWYD33SIE4S/X5faoOHgCdC+jsdKc5GnJUUGiNIzwrpbjwh76tOpxMAJ5OJyjTwKp7wP/CnvM06LeFzdPwNd4AFihL+Chom/U86/HmiAr4CGOR4M2r0fX9cKBR+8e816deg2WzeRJW15ABPXvgxRXoVPFfiDWbSAhF7iJiXvUyagMmHmZlmGYK/aXn7HPSNAWui3AH4s9EnG8ibiy94DL6l3W8jL3zvetsMpNCEAw4cKGPCc9r8WeGj/YuBMlikP+yn3EGZYjlWAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-fog-close:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAI5SURBVHgBxZZLjtpAEIbLjUFih8QFnBUrJCIOEHOCROIACStALBhOMMwJMlkgBCyYnCDMCUJWrJCQYB+zBwkJFiBe+QvZyEz86IEezSc1dj/w76pyV5dGEnS73cR6vf4SiUQ+HY9HE0MJu5GmaSNcFrvd7hn3vXK5bIU9TwsTw8Oqh8PhzhGRoIf1tSBxX9F2u12FVfVXiL3ksVgs1khWtNVqfcfljm7HgtW5l1Zrbyh4Fo7FYh8LhcLCGRDu2U6nc69YkDG22+0v98DZ0mazaQgh/tLbUUOMHy9E8eH8treDJ8lkkgzDuBibz+c0m81otVqRBAu4+QO7WecerDSDBB3RbDbrOTcej2kwGFAIvNc5dPVTTLHpv9INpNNpyufzBEsC1yF81dOVf8KslCHIEy4SjUYjIxDLDDoGKYAtDrNW13VT7Pf7azOOJ6lUKnAeySLB7jVIIezmMAS9A/igxIIUwns3VBQ+HpFCLMsKnGcjhX0CKLF2MpnQcrkMXIPzuX+KKax9phthtw6Hw7BlVqVSGel25wntqqy02WxOFnLj+xB6/HNTwmdXTqdTGTHmfKA7lhKSxAOCbPr9g90n82X6AcGfTgVxUTngtKlD+J4UAw/2S6VSzulfJAe8SZ3fiNRiQbTgHvgvI0H4Gxb9IAVwTexVmHmmQbiCD1suHy26En7xaDSa86p/A4ttrpuIT3ohpLcTxw/tAWJ9vzUaSWCLm3DXZzS+z7hELFzYjX/i8fiTu9T04x9LgQk+PbvDKQAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-wiper-open .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAALxSURBVHgBtVYrrBpBFJ0FFAqBqCIrUXRBk5QaUleewBBIlwSDoW1CUlzz0CSlaJJHA8FgqMBg4CWIKkpRuEfQCDAYAvSeYYfsLgss6fYkk5ndmXvP/c1HYjaQTqdjbrf7PQ0VarLWgBW1Cdput3tutVrdW7qka5OZTEZ1uVwfaBhj9jDf7/ePzWazwe4hVFVVPhwOT3cQnRFLkvS20WjMzRMuCzKFyH7/AxkAg18oQp/ME24LsgENfcwBkJfvQqHQejqd/jr905HJGpnMHIYW3iHGp5AS2df/QabpfiKHfCdCVCN1qh1hv9/PIpEIi0ajLBgMskAgcDZfKBTMYjJVL8+nh7MeS/8ioFiQbDYbtlgseA/lXq+Xt9lsxrrdLkulUmw8Hp/poLB+JC+rkpa7FysiKEokEpyo3+/zBiIrr2EU1kKmWCxariMvsy46IRJWZFBSLpf5GApgvZUSYLlcstFoxMfwHnKQN4Mi+cYdDoe/IGpmslKpxJV0Oh223W7ZLcTjcb6uVqtxLxFayJtkfSga2Sycy+X4YnhlBzAQhGI9euTRqnhAaNjkKA5Unl0yALlD0SC0Au12m/fIvx5nRxsEYV2lUrHMgxmiYMwGwmiE1qzDrSiKSv0r8QMxF2Wdz+fZer3mhXAJCP9gMOCGAiBJJpM8h6jqXq9nWO+hLfGH9ohiVoTFIEbxwFqECMoQInwLy4V3mEMe0SB7YWtMJJzoVK7fLnkgKg65BVBM8Bj5gjHwDORoGNfrdUMu9SDnfl7d+HqAEArFCYNQYoxtAODfJSIBimTWpV2Swxt8PLwiRAgjGrwXuEVGmBNXw6MxP5KXMWYTCKs4U+2COH6g59tCu6uG7A7AYxteCcypVU+EmgVZbcJxkO4HcmplIEQuMcGOTz8nyT6T7on4Npw0mMBzgDnkqUZWNfyzWujQM/FB79lVQh2xeudbZ0VE36mvipzdRagjjtFtnSBlr9nxuS9uGCidk1HPdFp1xcvsGv4CcbeEIeSIw9MAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-wiper-open:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAM0SURBVHgBtVa/SyNREJ7dBLVQELU4bdwrtFJOUCxsXEG0Ue4OK6tLKhEb/QsO/4LzChVtvGvE0sPOxtiYJuFyJBBICtOlSSAQCEnIj5tvyC676ybZYPLB4y373ptv5puZt6uQB1xeXup+v/9zs9lc4qHxK621VFAUJYbRaDSeDw4O7rvZUroQBXw+3zcm0ckbMkx8enh4+It6IWQijYlueiByI95g4oxzQXW+OD8/X1JV9e87yACNbbxeXV0dOxcUJxnn6okfx6l/OOHcnr0hhIzsFcg06jNa8obwbErKOfs+CDIhUdUbxrhJiGrknAW8HB4bGyNN02h+fp6mp6dpcnLStj46OkpbW1vOY1q5XJZ8iqTX19dPnYpkZmZGSObm5qharVI+n5cZ5ENDQzKy2SxFIhFaW1ujTCZDqVTKaabA+z4qrdy9uhHB0PLyskSTSCRkVCoV16gRLfYODw/T7e2tOOQE5zKocmRf3Mggzd7eHvEtQnd3dxSNRl3JgGKxaEaE6HEO553gOllXuQ3W3ch2d3fFyMvLS1siKxYXF0XWh4cHOYfzUMgKpE1t3Y026LouhxCVF8DBhYUFcz9m5HF7e9u5VUOV2pp8dnaWpqamPJMBKysrEh2kNRAOh2VG/q14c7XhILzb3993zYMT2IOCcTo4MTEhkqKgrPCx1gGePxgv6vW6EKJYNjc3qVQqSSG0A+RPJpPiKACS1dVVaQ9UdSwWs+33c6n+47ZYchqKx+NCvLOzI80NiWAMEkFyeM75lx5FdFhD4SCXIEJluxRbTLm4uDjmcv3RLgIYgrfILZBOpymXy0m+UImIDLLCATyHQiFbLq1gB/90bHwrcNPAILwGAaREcz8+Pso6CNsRGZDGx0eS8xXqRgh5DYkgIwZuFQPdyGACfwJ+PHGhnHKUOnkEetS4U72Co/uNWdoC3yovUVqBiD1EZW4fGRk5MwkBjjKIBRoAarXa12AwWLARIpdY4McC9RcnR0dHZjPabhosMOkG9S9S2/8MMLDfRKhljawjoYU4wNXby79OgavxJwrEyFlPhBZinasYH+pPPOMaNL4wMJphJZ553Bt/Zp3wHwTYnvHjbDCuAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-wiper-close .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANOSURBVHgBtVc9TCJBFB52r7jYyCXWnhcbO1aru8RErjGXWBxX2BijGG1svNhJo56VhQU2ViQsgdDQYEFDc5rQ0BDoaMgRGhoKaMhdCHDve+6QZVhgMfglm9mdn/e9v3kz6xEusL+/79c0bcvj8fjpc8V6gCY9VXqK3W73MZFIpN3I80wj03X9il79wh2q/X7fJAXvTdNszkQaDAZXaHF0BrIRcvLKERE/OQ3qYwh/06shXg8vRPl8PlEqlZ4nktoIV8QcgBxwItbfitBOvL6+XioWi2XZp8kXIryaN6FNdpSM8spvthRWUmPaJ25vb4vV1VVRqVSGBCwtLYm1tTUeW1hY4KfVak2hFe+J+B+5+QkfnL2Hh4fI1KAq/OLiQlxeXorl5WWxsbEhNjc3RbvdFrVajVvMkcTlclmk02nRaDTGETfJ1Z+wlTxWLP84zQoEAkwEodlslh+QqZDWY36hUGByp3m9Xu88Ho+HNaokfidCCAIh2kgkMlYQAOtyuZy4vb1lBW9ubnidCioa37klkw0nQrgWgpLJJMfXDUAOBbEO66GAAkOS+tSRk5MTXgjr4FIAMXULrIObz87O1CHv8fHxR03thXAkDhbahezt7TlpzkA8sc7uUngIQIhUgNRr70AWQsu7u7uBEPTBdaqboQTcCIUgXL4DUBzjTrHVDcP4BmVlR6fTYVLg9PSU9yC2CIghEG7HHIC2GluJOGYyGR6DYiDCGEKD/iErNS2sU238QnH9rGqDopDP5zm+EIJ3aL6zs8NEUAKCQSiVwxp4BFaHQqGRwkJoRqPRkEZ7tCjGAAJQHED28PDAVkirsX1kUcAc7FEXWc5c7+iQTltnpyMgHNYgUSSZBL5BhqTBHkVMAZnxKsijMbQ6Vf+/FFe/mFLs6/X6IJZ20t3dXXb34uIihwFuTqVSI3Mt0nPia3LtpVLot461V0FWLiiBZwzMWCx2xOSy5+DgIEya/BRvA1xfvlKxr+JjUBwola/Fy81u7iDCX5JwiJSPHNJm3sQWoTnUp06a57XFIrxW+0dug8guutM8EvEHpxPIJRDDH6qFA2UmrSSrg0SO5HJLjhDdUxue+bLtQG7QqR8ggVvC4beCFHumRMSxVJxEJvEfnFm91YrgD/sAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-wiper-close:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANwSURBVHgBtZa/SyNBFMffboJaKAS10SZ7hXqFegGbCyjmUPTAH3eHlZWmULG6u/Kqi/9BLEQRIdoKigf2l1Q2ChGtBLmtFAQloPgL1HvfRyZuJhuzBvOFzezOj/eZee/NZAzyoMXFxYjf7+99enqK8GNxlZVtyhiGYXOZ5vo/MzMzW17sGaVgPp/vN2DkTbZpmqs8wfloNJqh10AZZjEs8QpYAfzx8TE6Ozub9AQFkGf7l55dWLbYTmxqamruRehbAl8CG5UEOvTNmWSmekHCVAgIJVgB9eHHD1bJSTPp7NXe3k68Hejg4CBvdF1dHTU0NFBVVRVdXl7S/f09nZ+fl2BS4Pb29geXMXyIe5eXlxM6FMaHh4dpY2ODGhsbybIsamlpyUFQog/geE5PT2l3d5eurq6KgTPc7x22kpGN5T+3Xl1dXdTa2ipGDw8P5bm7uyvoB3hTU5P0t22b9vb2ZFIu+smxjSOmEbfW2tpaAcJgMpkUQ25ACG4+Ojqi7e1tqq6uprGxMRmvi8P1BaXJLyE34MjIiBja2dmhzs5O8iLAMUGMw3h4yCkOobDYs+YHfXAkEpGBWJ1KJMTUqzAObh4cHNSbAisrK0FTrw0Gg5I4GKiEBAmHwwUzV2pubpZJOV0KD0EIkS6TlxxwViALMcvx8fGcEdQhKzs6OvIGYxLIcEwIxuFSvEP19fXSjpzQ5RsdHf3M5XtV8fDwIFDs0f7+frq+vpYtAjAMwu3oA/X09MgqEcf9/X1pQ/wBQhuyPZ1O56/SNOO+oaGhMAM+6rM5Ozuj4+NjiS+M4B2ZGQqFBHRyckLd3d2USqWor6+Pbm5uZAySqa2tjdbX1+VbU2Z6evoX3JumIoIBHA6ATUxMyCl1cXEhQOxD1ON9c3NT9qjufl2K5a+pqdliA4liHWEc7kOiwMXOvYpvwJA02KOILwS3FoGuoTTlWDKMJJUQ4qwfDmoyAwMDkkiYIBIOsS2iJH7k7MW1JPu3VpbUyYWVw91u4oWtcjyjOSi0tLQU54bvVBnh+vKJry82PnKHAydFDI1UATFwTgHzoIgtZvPW4Cxw1VlX0YtZFhjT6wvOXrgBK+ZnjcqXimHMrbHUZXuSV43kCpE3IUTzvPfjr75s61pYWAgx/Ctndy9/WlxaCsKPzZs+xc8Ww9IvwZT+A8hTw5fcMmXrAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-arrow{cursor:pointer;position:absolute;width:0;height:0}.jb-pro-container .jb-pro-ptz-arrow-up{left:71px;top:15px;border:7px solid transparent;border-bottom:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right{top:71px;right:15px;border:7px solid transparent;border-left:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left{left:15px;top:71px;border:7px solid transparent;border-right:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-down{left:71px;bottom:15px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left-up{transform:rotate(45deg);left:32px;top:33px;border:7px solid transparent;border-right:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right-up{transform:rotate(-45deg);right:32px;top:33px;border:7px solid transparent;border-left:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left-down{transform:rotate(45deg);left:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right-down{transform:rotate(-45deg);right:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-loading-bg{display:none}.jb-pro-container .jb-pro-loading-bg,.jb-pro-container .jb-pro-poster{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;height:100%;width:100%;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jb-pro-container .jb-pro-play-big{position:absolute;display:none;height:100%;width:100%;z-index:1;background:rgba(0,0,0,.4)}.jb-pro-container .jb-pro-play-big:after{cursor:pointer;content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;width:48px;height:48px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC");background-repeat:no-repeat;background-position:50%}.jb-pro-container .jb-pro-play-big:hover:after{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==")}.jb-pro-container .jb-pro-recording{display:none;position:absolute;box-sizing:border-box;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:101px;height:20px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jb-pro-container .jb-pro-recording .jb-pro-recording-red-point{width:8px;height:8px;background:#ff1f1f;border-radius:50%;animation:magentaPulse 1s linear infinite}.jb-pro-container .jb-pro-recording .jb-pro-recording-time{font-size:14px;font-weight:500;color:#ddd}.jb-pro-container .jb-pro-recording .jb-pro-recording-stop{height:100%}.jb-pro-container .jb-pro-recording .jb-pro-icon-recordStop{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-zoom-controls{display:none;position:absolute;box-sizing:border-box;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:156px;height:30px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jb-pro-container .jb-pro-zoom-controls .jb-pro-icon{vertical-align:top}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-narrow{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-tips{font-size:14px;font-weight:500;color:#ddd}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-expand,.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-stop2{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-loading{display:none;flex-direction:column;justify-content:center;align-items:center;position:absolute;z-index:20;left:0;top:0;right:0;bottom:0;width:100%;height:100%;pointer-events:none}.jb-pro-container .jb-pro-loading-text{line-height:20px;font-size:13px;color:#fff;margin-top:10px}.jb-pro-container .jb-pro-controls{background-color:#161616;box-sizing:border-box;display:flex;flex-direction:column;justify-content:flex-end;position:absolute;z-index:40;left:0;right:0;bottom:0;height:38px;width:100%;padding-left:13px;padding-right:13px;font-size:14px;color:#fff;opacity:0;visibility:hidden;transition:all .2s ease-in-out;-webkit-user-select:none;-moz-user-select:none;user-select:none;transition:width .5s ease-in}.jb-pro-container .jb-pro-controls .jb-pro-controls-item{position:relative;display:flex;justify-content:center;padding:0 8px}.jb-pro-container .jb-pro-controls .jb-pro-controls-item:hover .icon-title-tips{visibility:visible;opacity:1}.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-face,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-face-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-fullscreen,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-fullscreen-exit,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-icon-audio,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-microphone-close,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-object,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-object-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-occlusion,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-occlusion-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-pause,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-performance,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-performance-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-play,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-ptz,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-ptz-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-quality-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-record,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-record-stop,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-scale-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-screenshot,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-speed-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-template-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-volume,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-zoom,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-zoom-stop{display:none}.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-speed{padding:0}.jb-pro-container .jb-pro-controls .jb-pro-controls-item-html{position:relative;display:none;justify-content:center}.jb-pro-container .jb-pro-controls .jb-pro-playback-control-time{position:relative;justify-content:center;padding:0 8px}.jb-pro-container .jb-pro-controls .jb-pro-icon-audio,.jb-pro-container .jb-pro-controls .jb-pro-icon-mute{z-index:1}.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom{display:flex;justify-content:space-between;height:100%}.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-left,.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-right{display:flex;align-items:center}.jb-pro-container.jb-pro-controls-show .jb-pro-controls{opacity:1;visibility:visible}.jb-pro-container.jb-pro-controls-show-auto-hide .jb-pro-controls{opacity:.8;visibility:visible;display:none}.jb-pro-container.jb-pro-hide-cursor *{cursor:none!important}.jb-pro-container .jb-pro-icon-loading{width:50px;height:50px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8BAMAAADI0sRBAAAAIVBMVEVHcEx4eHh4eHh4eHh4eHh3d3d4eHh4eHh4eHh4eHh4eHiqaCaRAAAACnRSTlMAikwX3CxpwZ7zIGi5xgAAAZ9JREFUOMt9lb9Lw0AUx2Njqm4iGEqmEnBxslKUdhJctFMVcW5wKZ0CLpJJQRw6iVqQbg3FtPdX+l5+XHJ3796bQj557773fe8ujtOI+6jz5p84dHjTkYD4+RhT9CIRZWRPJr1bChnbY532GhT4oUpbI6HEuqvgIH9544dh9J4/rpr0Ms8oV3zMNT7X1MXSmaznzfHjM4n72moe5n8ryYrW9rKRvgf0S93JA7yKa9lbzUg3keJb8OVCtwkrFmoO4MnsAuj5rGqnZg+GZXUXkl9NjEui9n3YA9XgpMgakLXz6ujMTIgrCkPVv0Jil8KgKQN/wRN69hLcb1vrbR2nQkxwiZTGQ5Teb7TO8PUaS8Q03sE+zkjP8qbjzgJtEhRbV4gnlkOFeM7hDYNdxPbiYFvKSHN6L2NmY5WzMYPtplZdTxncRvn2sI+DHIoug22jWMaA12Y7BrXzrG8BX32XPMDKWVzw1bdMOnH1KNqNi8toqn7JGumZnStXLi0e4tcP6R3I635Nc/mzsMxl9aux9b78UVmn2pve8u6eR50j9c0/ywzyVl5+z84AAAAASUVORK5CYII=");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;animation-name:rotation;animation-duration:1s;animation-timing-function:linear;animation-iteration-count:infinite}.jb-pro-container .jb-pro-icon-screenshot{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEzMzMzMzMzMzMzMzMzNzc3MzMzMzMzNzc3Nzc3MzMzMzMwv5ahDAAAAC3RSTlMAW+8S2UGVwyyZnOTRhEMAAAEfSURBVDjLzZKxbsJADIYdBQpsSCyVMlXAdEuQYGKpWFk6dWHJgsQ7sMDSpUv3PgITAQT0f7ly57ucQ45KXRAZot+/89k+X4ju9KzL4XOhlm3pR0enYrWViSRPXQIQSASkRSkIJEFRimYCuQAHSW89IOv6SH5TCsuAj68Ab1wDzqkAzqoC7AUAPtgsABgkBBgkCJiNHehGok//KRVsHqd+3Dj1/vukt3AH/Jj05s5/AmyZhFVWXDls44iVvfQWkCvgxU6g9ZdJfCLvjJbYaT3GvjOY4mQSG3SJGjhr/Y1Xohp+TGKqqzexZ/1GVGdNCitt6R8zVvb9d+JmKdl8o5sPWbtxT6zFuJcDQtk92MNmYiXHquYlZlVt1j4P6cd7fgHFW7Nhqu29TwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-screenshot:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEz////////////////////////////////////////////////////////NXt0CAAAADnRSTlMAWe+X2TINXUYZvctoYyuS2NgAAAEVSURBVDjLzZKhDsJADIZLCAsEg8WgEGCWGSwCgZxB4MgEAonB8wQEXoBH4BEWXgPJgEBG0mdgR3u77raRYAgnlq+9+/t3TQF+dKbZcJXSYSnzlViT457lRScKmBqILSFA3GoO8S4E+Ex5JiSJ4CbVdyOQdZNomX9D4dl+ko3NC8vFFmhPy8FIsi0ZlwLBW/LY5BxYYreUSgoFAEmhB5Rc9OCbUoXmTmDadQKTn4y6A/XTaoSKdb6KyGU6RJ7eHgpb3ABinAoil303xB6vQnRahNhXvMdre+fzOgxVrokX4jHAnBh8PALU8Eq8BqgTg/vePF8tpuPy9/NFaalSc273RizarYqfkswjifNMQ/TyTGMv4v87L+ks5gqDbc9OAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-play{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-play:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-pause{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEzMzMzHx8fMzMzMzMzOzs7MzMz4IlKVAAAABnRSTlMA6xIU1hVqIuOVAAAAMUlEQVQ4y2NgGFYgLS3RAEQziQFZoxKjEqMSaBJpEAkgIw1ZQlBQRAEs4QhkDeIMDgAWx1gMHyIL4wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-pause:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEz///////////////////////+3ygHaAAAABnRSTlMA7OgSFBXMmAA4AAAAM0lEQVQ4y2NgGFYgLS3JAUQzi6WlJY5KjEqMSqBJpEEkgIw0ZAklJSUDsISikpLQIM7gAJjhWp6XcaOxAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-record{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEVHcEzGxsbMzMzMzMzLy8vMzMzMzMzNzc3MzMzMzMxEZ/aQAAAACXRSTlMADPKKKeBxlV6neZ4mAAAArUlEQVQ4y2NgGDZgJhpowCURAJeYpIQENJEkCgWRgCeShAGyjfgl2EqwS7BFToZJiLg4ICTEImdOh0pwRM6cDJcIjpw5E6aDFeh8B5gECBCUYAkKCoMbNXNSOlyCgUEQ4apJJmxIEkjOVWFgxi4RgEsikGQJnEYp4pLA6VxUDyJLIAUJcRLIwY7qXKSIQvOHWCQODzKIleBPPjgTHM4kijNR48oGkajiYUMykwMAAfmZhUjBISQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-record:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMA8gyMLeRw1x2DBpWGN2QDAAAAt0lEQVQ4y2NgGDbgDBpIwCVRAJc4KIgEZM4EwCU2KSEBHySJCcg29iBJGCBLgHUs24FdYlnNYZiESksDXKJALebMaagES8yZw3CJypgzZ2A6WIHOd4BJgABMgh2XBEtpaBjcqDMHs+ESDFyLEK46aMGGkEB2rgQDJ3aJAFwSUSRL4DQKp+VHcTkXxYMoEkhBQpwEcrCjSCBHFJo/1GIO408MOJMPzgSHM4niTNS4skENqnjYkMzkAEgzyFpeX6L3AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-recordStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAOVBMVEVHcEz///////////////////////////////////////////////////////////////////////99PJZNAAAAEnRSTlMAMPndsnZj1CSYPcmL6wsdoU80pOJLAAABu0lEQVRIx5VV26KEIAhMA++p9f8fezatFDPr8LSrjMxwiWlqzRuMYKW0ENH46c3WuGyVLXEduuO83UyK59fl1jX5EEUXD9DOaSh43XEP5zUIdZ4pAecTofVnWSt3ip4rx7N61vjnY1D30CpH4QQR8vsP+RA5Rs3KpjfMU/pMim/LgbvH7DF2F8sU0owqapKLqgnhuGWwImUagn2zhUX6WQQoYkXG9WxSAJd700/ygsCpAoliaDsPiG48GM1X5Ft/06sfp8DrDE+3DpekWjxM6366fgEcnklC+AIIWYQmPEeAaUmjFOnhCLDfxZRH+w1gU5b/DYjfNcyJ0p7dxX8B+FwxQVtvAGB5ig0d5gFA5KbzS91hI8CenvlHflfN/XvzJQnxbBEko1gbvVnPii+FadSVRUEaYylQfJtpLB+aRG4LY/80yKdUbCraM0lozGR4ewZ0Wtnj1iC7hjWKNnjYmR62W15cLlL3+2pyMR09jccyuyUrHKsvthc5xsY1iWJ0Xk3t+2XP7AnWwrAQmBH6asXubmL1Z5Lz6o992jWiu9lnMSiQsK27FS9NxhCumZgB2fTBPFsFolhZr5B/D3o9sJAI6skAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-recordStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEwimP0imPwimP8imPwimP0imPsimP0imfsimPwimP0imPwimf8imPwimPwimPxLmg1rAAAAD3RSTlMA15sisGUvdz3szYwMT8H+hDJEAAABx0lEQVQ4y3WUO08CQRCADxBQchBiMDE24KswFlw0Wtig/oHzUWglJBZWio3GDjUxlhhrEzT+ABMrO2iptLLVRluDggI+xtmdXW73LkxxNzvfzuzszNwZhhDzdOxqaPGgYrgkOgFczh90ezAJQmpL2v6OHYnqk2aWxOTtAnu/O/Y5XNZXmTZjo3ot7aESwLdFeqAM0MoJkMf9ltwVQJ9PcQN0UFIJogvdJgLQVFMsAlxyBaPmVBDCE8W7qd+2SDsx0q4OwhSrCG134W54jDfKLjDNxaL8/9AAMM/solptRnoALBbwEPWYrOEzLnrZsTGoMW+fBHG2SiLPUNI6KMOH8QS/XsCMBYQekIEv7NGZF/Rht2yqmA4i3UG9O0iTqgMfhirDhRdU8XJZqqEO8tDAqje8IIt1r+I5HmBjfD9AxQ1MgJQRpc6GJRALHOAS1WRlhMs4VaSFzwIWzCUF3op71kdNsNs/FDCuA58YqCQl7IhN3WbDnlLtfjnuON515WM17c7w41QPOuBIzDT5wqi0T4ESGV3gjtTjkuPATwHoX9+cPRlmmvJ57YAir2qKy459QL/UhrS/uAu3xf8KiX3DI+b22t6jc9F/qfaum9E1pJ4AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreen{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEzMzMzOzs7Pz8/MzMzMzMzNzc3MzMzMzMzMzMzMzMzMzMzNzc3MzMzMzMxdHBitAAAADnRSTlMA8AwGYt0aUcg+til5kgmZywUAAAGWSURBVDjL1VM9SwNBEB12IcGkMagxNktQSZFCYimIJAqKpZ3Vco3YBYs0NkKQgBg4ECtLFSFVCGgQrERBsLayPE0Ip7n5De73BdKLTrE3ezPvze6+GYDfsAQKy/Rz0i/OZJjY9XREuohTKulS+ZFGiADfyZXU5uHktI44VH5apDx554aXwJqloiIwiEsStAjCAsRNF1jCmGqa4Vc+BvS4JkjwzyPE6xiwzsxxeTbZxqjkANSWZFkoIj5bQBl4aBDfkPDNpeRRialB+SRAFz8UU1sAaEUjSCDoJ7iukZJ1V+c01bFczM1pWaa+a0Rp7MHn4V8Z1R9vLLCv9WjKdVFfk77JP+bZdz35YAfKXx6KhKp93abUYVbrj49g9aAYSuFCLbPUwzdCsYEWTloXgw1oGwQbENeuKwxzXhxwAADRMFd+zzRc6AAASY6RH8VjUHaXTrlOpDgCUP3gelc01e2d+f16cWbnQ46BGCRNVsWAWQJVw2xGfUXVv2k1OsLfazXqblzS99u1FwKFvBJioXBY2+r82U75Ab7O0ypVV0wKAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreen:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEz///////////////////////////////////////////////////////////////////+GUsxbAAAAEXRSTlMA3clDHfdfDQbsVG00u4Cqkr04dRsAAAGaSURBVEjH7VXLdsQgCPUBAROdjP//s1UTDUxsz3TRTc+wC94bHsLVmP9hkE8LIdvgupt2tFhcpy2CMZyVxNePEoqDp4hwEGz5PTqWoZNzLrmD9riltBEYzzpZQ8bweXy56Qy6Tivsp5JQYtawuMH3eJlSxIJtdSSa4xer4lMB89pK23mKrwjZVpsRzLq35vEE3+r26h6w5EKppcp3fP2lIpTPWJvoXoobeNI1sM3haHvx56tu2sdElJ54GbnPQ7RZ1sCpl8qPEMXBNQ8vN82jNbzLCPzGSDOZj/2Bqd19R1rELIEbDFrUJfKYdlALbDuDMko/hz7t8DqtCfr8h1Vt4rn7eh/6Ph37ch20aW8McsfGCOXzcr+GOlQG1rJ2HSHUDO/4Mu01qVAqTCpCJfgZ3phTS2pKm5aZOMUbs7Q6nk6L8UzRh6W78jH+gD/VRxHokPuNgUGTaPPR+zDR1mrlvcGgwkAVacSbeoN4Z0rb5/6XLrW/2GTLk2NhXHRKzrqAt9cD4rr4ddvae0NAYgOICdZyvPj4UYRf2BdfbB8iWvnTUwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreenExit{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAG1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxi4XDRAAAACHRSTlMAf3WqJmy+7azWNnMAAADNSURBVDjLxZQ9E4IwDIaLfMzCOTDSOz07OjLir5CR0dmJFVHIzzZtnMzbOzcyZHnuaXpJWmO2ji4GhpAzzZeQzw8FKCj1pMHss9OgpwsGOS0YGOcVUMPsfBVkmJoVCBJW0FFB6SFIaMKAlRGDnEiDkuM00lP3SmL6H5QSh+iIr9ZWVWntUV9Z4qWbHAWrhcUYNLC4Wwm3xb1r2mOQYoVn2EKFAVb81KHiQQq6L3vSUoMBUmSzgCKbVeiL3eTp3Odf8H1sxRAZZNZt/Vt8AHcPQbiQQVF+AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreenExit:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAe4Fzh7MZbKPtN8gpX19xAAAA3klEQVQ4y8XUIQ7CQBAF0CWhKQHDGtQKQFcURUgqEARBED0Aoqp3IKnoATAEW8MNOACmhQYKcyi6uyjmr+aLqXj56bSbVoh/J3HBxcw0ZfA2c3FiQLGeQcWh1lOVDDJTAeCbCgAR6QqCDj0xCEU5Bl2BIALKMwhdKjGILRUYfCIOEynlvABANk64M5jabJxHfJY2I76yzYu/ZCc0s1WbNYAQ3jxqwMoGHoqWGHpUQajEgcYYcKWFtjLE4FGJQewoxODRDQOqKPPcHl9sfzSXa/0L349tEDsOsp/8+2/xAY+BZBY9KhM5AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-audio{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzKysrMzMzMzMzMzMzMzMzMzMzMzMzMzMzNzc3MzMz8gU00AAAACnRSTlMAL0jMZKt96hGJsSKv1QAAAJ9JREFUOMvN078KQFAYBfCbJEw2q6SUyWxTnsJT2JTJ6D38Gb6n5PpT6BwbuaNfTnz3fEp9fZwAP7czD0MsGCzBYJcEYsGwBEHQQRB0EII1CMAWdAOzyJUvJ4jyDVyZVHKGpj9guEI2IuhaDFadYnCkIm9I+kPgn8t+kI7kOsT72HcwQnJR9Gofy8DrwwtHK8pLzdeALg5fNb6cdJ1fOjOGYrl5CLFcggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-audio:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAL0TQf2frEaZYt8E+idL4AAAAnUlEQVQ4y2NgoDdgUcAuzr4Hh4TaGQHsBp3BLsG+BoeE2hnsEkCDsEqADMIqATIImwTYICwSEIPQJFhnBjKInUGSUA2CSPCcOcIwB1ki5xRM4iiDDrKEzQlsEuUF2CVY0jbgkDhjMLQkEkj0IM4gQQ1EHMHOOXMiakRpTiQQtXgTA+7kgzvB4UyiuBM17myAM+Pgzmq4MyfO7EwjAAAEf+BAxqI/agAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-mute{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMztXryaAAAAD3RSTlMAHd4P7ztyiy1OnKhdx7uY2gyAAAAB8ElEQVQ4y72Uu0vDQBzHE45C3SJFaSGjUEiRpJRCBifXokkpSv0DfOBrEKxUUSoFH9ClFAUfU7c4OARRCs5WjThIsJuDlLo4ldvPe8SYxGyCt1zgw+dev+8vHPcvYybvfCR2OgUv2CoLdI62bUn3gq5UJxOomZofXPUNrIChJRklfcDSiKK2bYQ6PiCaREk0EQoYPFYa3F73F+DGsBJLmAjBAMBKakG15KAxqIhd2KuK5reRccBDNbqGJhfSlnNc/kBh4OY+vaoR5QrRC0afKgxMrKdXNKI8yxRENpyd+i0VA6wMm5IOBmORCwfAFjGwolofevbuPrvpGhRgpVaqiJflrLuUQQFRToS9l894EMDe7q6yL7/G5wMATc5mQCiAvQo3HAbwLtyYHQZgTxhohgGUa/CP12EA16W2/Ou4ZEj1dNG9oPMkZGiwJWQ8j+huPoJy9Z/XHTfUFSbAURveCtE5px5vs7hQDKS25FSDn2KR5Up1/lRmIHne7BvKd82LMRJbSjr5M40lmaYZ5/PRpiCpizjJyk+CwOGOzACLpSdz02QxkiuRhd8dNOwkV7zl2YX1mcySKJrQiPkXY9klSt6rkJPRwIlmzrcWSGyzHuTb11V/N0y/S6SdwdCR4m/47OIN7XOQCfwJwHGp8IcfyRdBLEZK4Uxp6wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-mute:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAP1BMVEVHcEz///////////////////////////////////////////////////////////////////////////////9KjZoYAAAAFHRSTlMAbk2o8o0P5TsGnVojFi/XHcV9urLaq0oAAAIQSURBVEjH3ZZZkqswDEXxLM8T+1/rkw0BuwM0f131+IvDyZVk6SrL8p88QCHp8UAnWmoWoG8AwQRN4/vOiqwUuwWqiob646MMhEW+KnMLMIXffgiZoODBusb7kCzjByF7OOszkOyp4amJ7fWVPwCN6BpyWRypvANPCvi7u4aTXe13YI+KkYA5bMRTSMlLnSyGwisSH40B0FJOrKVB6iAw2U7sGgPgQ/DTPQjitCOZT4Q6gWCtGwGFbSM34ENUNSpAKTACmC31rnRgJwjDdkFAJpfkAsZcAJvCSVQB2FaWWKdB/ATMAHwIUYL21lRBZRDiC5AnsBHBUqxEyaraFMoz0AnvHNa6xDWS34FGgNf6PYAEZoCt+BroUWFVbeb5HbCqSvB2cToyca+Adjlycdawt0C/HeyScl1W/w3gsU3aAd7JF8AuAN6isr7NAogXAFeq59Ec7ifAm49hF8wCMWfVNXAeCAkjEGuBr6R5ZGJzBrl4gGniBME+w8aMMyCsNZtfaemnmYaAQ6I3Rz0fnDhHJxc93Vrr7sHWjP3XRtTba2L3EkdFVaPC6YmXxKI9DGF1YPLdiwfD2r37cL5nDVw+uKzU5K27hsXCXPtyC2uyyl0D0p2TY7VaIvFYWU0Dm8TdOXmrVp52HG4lU4K/N38PpS/Kw70dbmb/sC0WCcQwNNzzjrzUj7veUyIIyL/4m/EP8V829O8zh5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptz{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAM1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzNzc3MzMzNzc3MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxDm1AzAAAAEXRSTlMAHqw+E8It/gjxc03jhGDTlgAjE2kAAAI6SURBVEjHpVbZkoQgDBwg3Of/f+12gtfMbK1Yy4NampCju4Ov1y8ruNyyo9fyCibVlNW6vUu29GpWQwTVdPTernqwffHex0WP4Nro3k+PrMKCvew/PcZ95aoNsY9yua+cGxTZsnf2K7ch4CAdGnWwYx/5LgKZCgxGdrhH3BeqNmnwviFXPZbQJmcM25HJ5n7/Pczr2QqksMJfO7BJOHLKLWFdMiL1QXYRwFagMklb4GB1zS7s8Le3fqH7Q28tVLkKdIzeaOJB2OKtY8KfTQCUa4++dNsLbrqpTR7xguHGt8hfg8P+seuaEkNdBjahzOD7g1cHP21SL2LtMNBKMdTRJjffTX1wVgrsEb1ITJU6QknwYJAcQky2cE02NbzPp70KyKggtpu9xM7Ik+CBIqY+8FrYyRUkrs+MEm1TG6tG9LZxNDNFGDue63TYGgIHqUUcuNhvhyZtn5LnlDq3Juxa4noCuX0scErOpNMDCrVcHPCS5rFGuQR9KZpxnB6CQ0ZO+AIBcTPk3UdbTx1L7jLEEHsMW7ZYm8NlIFyxn8+xdL7MURYEhzd5k2N2TabxIAORwC2r00QQfNSgrnqTJfh7cDmDu9ggtV0EZFr7kGu4KAxtNDln406TLwF9iZCIwn9EfjPuncRHYm5x3NfK3cFAS5kWxljSnTFlPHBAUFg5HsCCVOd9cdwXq+027un2QJlMjqISJutCDceRtTTuT4+1Q3HWHR8cu0fh9sGvADTYH9iLah/9nPz5+/MDJnQfoIVoAnQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptz:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAQlBMVEVHcEz////////////////////////////////////////////////////////////////////////////////////1bZCPAAAAFXRSTlMAeVoYDS1pBiPv4/g6lkzO2qSxvoixscijAAACi0lEQVRIx51W2ZLcIAwcLnPf+P9/NS2wp5xkq0ziF3ZRC3R0i/l8fvi04oxx89n+RBi1sqB38TKw7lw7lNzDa3U0e57bHhJ4d567HlqGC08eLAj9Gv8XD4/OwtsdhlfCW2s9LfWtuNrMhG1uLWP17Xh14LF4m8dx1OJ9jkm85YCYch5JzDVy81on3MFYkpTNYGmHHloYI+aqlNhlh5ZSvmH1AyBUwPcMX+u/clW3XYvA2YgRGXyZIZX6PXv0l3GlV9Jp9FKcK7mytJIg8xEeBdaBtV4P8tAixexnp73tY7ZBkrk9WEL8t7ZUDqtIA3jXa8sODSeUVqw5aztT+g4QeNAgM0PGTA0+EmfVeUvU0CEW4hX+lt/zseE7jJKDSmi0EUKBhr7EAMKPvNjOA9Fz4Yk/CFgcGRSdkYOHCLRxQfzKRN5SB/b5Ot8SzzQiKqcb6ipFdCfi1JI84OBdxzarhJ8RkpxHOQszl7bpn0GpmnXq6R4OfTkwwlyUWzeQg7rSLNhNUzEUEqJF3DMHeeXgqRIaYwHimLKipK8hMZOYVfJ5oKtIFSgXk5z4KcNx3GOIPGYfPigh9YGHBNQKVKbZhxMnqq+OHfWBHARZfWm1dnfSXfJuXInplse8wy39zkisdQ5kuLY+Bpc5hwGiH8Mx1rE24DFaLqXkfrNVkjk+8JPTPF0bUw+R9MCVuA8ks/xDyF/9orMqpBQeiob5RbIbmv7/TxvoX1Oqa914TsYg7QUWx8Y7R89JQY8mY6Dat1G5GARuMOgYHY9cbL1vNvc++fk67olLk4nrQSl7457OPqdeKn+vEwm4LPzW87DyXvqIyei9znHS+cZz9SxV+Qf8nNbjn37NkDx4+PmCXzHOLUMtjgmUAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptzActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEwgmv8imPwimPwhmP8imP8imPwimPwmmf8imPwimPwhmP0imPwimPwimPwimPsimP0imPoLqfILAAAAEnRSTlMADprCJBnU/gXwh3LiUKxAXjJ/ELXKAAACbklEQVRIx5VW2bbjIAwLa1jM9v8/O7Iht+09MwPlpS2VwLZkJ9f1lxVG1joPdZ0u1ZIxurhv8DH6dMpQI5t439GAEc7xYPgTRnAtV7plReRhd5kDP8+fd+wzt70yPhIJzWT7/6DCJCAYLReZPMIuJC4pClSktHqbNpJO1aTmmAme3cvtWs9NSfq52CPhnJNjlbVHwgmWSWGHeQHcKFjj7fygwidf2fa4mbVOuladcnsoDn9/CKKAWf6HEtpANiJvUp9Fgr0SvocPP/sqjOCK9ktpyCAo4Kt/d4n4/6baseNKAt5XrauPN1A4ZLAd30RUI4kNfELVx+yd3lrXYIg1Bp/B/dGs5N8mPsJoVyiwkofQSlm+K9aiwmoQMDoI4wefoK/rhkESrSuV+BR2i6HZH9juLzxCtBmn6rFmB66gNJQwBOSxncT/N3FAlxAoLQfJDy2+6rMLI3aznl9fhOcGSdZzoNhex2K3TXJEVe3M4Zb6QhHuJc5BWakYIqqietcPw6FK+EHofUHRqtLEQ5X8dKVENXXgEpLOpcjwkFI30YFVHE8fyx2ShZJ/ydTKlZwZ4BCOv/af9uMi0DILe4kieynScgPbhai+DRDckTT6N6zJpI3HMghM3BMg+q9pHmwrbR0Q0D5wc0JHPy0E5Ur7Nf3Rk68LnR0NHfO28/T5P4cNr+uLFR7eEdiNxvMRbd5Onlqsis4iIVdme4di3akWOz+3T0aUnFWHa8QZrO51NO69MeLPafrNuBenxel/3d21j8k/jyxf+75OQabFxOtuT94G3Lpjzb0zBn2Dl0ep/waPidQ/p/XB60Dp7e8F/QO7WSJg4zEzdwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptzActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcExru/9ru/9qu/9ru/9ru/9ru/9ru/9svP9ruv9ru/9ru/9ru/9ru/9ru/9ru/9ru/9ru/+3uxEqAAAAEnRSTlMA5q0cR/PC/ggSKtN5OIhaa5izIOiAAAACV0lEQVRIx5VW2ZLjMAiMToNu/f/PboNsJ5PaKWv8kKRkWkDTQF6v/zyUfO+JX9sP1dKKd/v2acQcm992kbo1R4il7iHIif0BRNtCUOozH4cikAdt2YfjRLTnzN15/8I85wFCI2xDzlnyMLO7R0aFoTzbFGB+jIkYLkyePvmW8d2fs2ZfZuv8It9s6zvV5uSr2LmKb9oVh37QvpjYOcf8fcO3Cb1jGqOU0SvTTd6X2KUBLgKdLzaiDtE2n+isTh8/+AX7E6/Vh/NNSyfVm10RXIe1nxXRapmsDQB7SMnkmE0IxgqvUn0jteEf1T2CHXgr0gjZllGk1HoJL7lD7fRpD20CgJcwQ6EdSh3lLK0zVfuqz2WvPlPJh7HqnCQ4MysxoAYQE0vHub/toRuqzRy5pEUvbg62MzlJQn1MHBe1x7WSAddpNDSN1c9wRMhKfi2jrICwAIsQvHkD7Al41bOrBNC1Y7QdmSg15LDokGETJB/imxYJKfmFMDqI3FjUkDS3NSEDjBaxknRYSb+4nj4kC43W2OKrkqGB8jV2Fq03YiWbhHQTpUV1mMHXWYf8HlNX7ZUQRC6iwBAIK0r0ILr1UxqKsPattAkhwSIiMl76bT/Ft/TbTy2jHQoM7Cz9isHVMb6GILl0H4DGivbw7xNc8rAtiJn3O/qvD6JT/wgs7Y370ZSdWmbZWEKiG1lXImldW7Q1jGMbZW9tUVKZmGjjGvf+EXAqzWiX5OfFSHVp/zjbfGPc3whdcbTF67V2N1e79qYMru2/AnzVYFsdWFt/+nOypv8vQvoHou4gOtSrG5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performance{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTM7OzszMzM3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3NzW8hQDoAAAAMdFJOUwC/gO8ra6tUQNmVEKtAA1gAAAE4SURBVDjLzZMhT8RAEIWnpS3tXcWdQ6wgOJIKfFdUICv6AyruB5w4EuSJCwRXgUBWkGArLsEi6JVuaZkfxawguSWz/p7azLdtdt97C3ASagp+PpeXPDjHVx7McMWDCBc8qPCZB4m44YFIeOBh+ckCf9z+sCCYqi8WvA/5Nwu26cfA+JRBs4h7WmX/tr9AXcQHAPdgzEPZh5idTQBOZ3zyiModISKQGxZ7dd85E0SKfMGjM7vXeI/5AE5LvrwpcK9IOrQYB5BlCsFIvjzgrkaSjsBZbmC9XsGsAxfn8gKXpL9sSlnQFBwFTTuaKWXgI5Ar+sfHTrW6DUDO+2jEEtCNQ9wL6gNujMvvdFS3eugxGT51fBXxTvF1wLLngbT0BGphKalAy0MQ3Z4Ha2V7UoMFJKkFVAWcvH4B0OJfd9YsTl0AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performance:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwD2qdfrViyAwW2XORBGtSCsD6SyAAABN0lEQVRIx+2VzQ7DIAyDYfxToH7/p10CbQ+T2s33Rb1MijM3/qDG/EurolD9zSNRggBU0hFelMABmenfADhGkJDhGUFGgiX6I1AAQlDgZK/td8ELtQORiTmIq42I2bYdCD8NjzPmYQxO+rbn2S5qzEUF6YjkgcJude56X3s0SoL7LRAeylyaVPiFq0Jyx230mpeXmXVOHssRbhackhCq25Sny++xcBW1n6Snqw6BTgrqRP6kzfDcgmRLGonDWSf2OecwB491dOrEVZpNsxiyiHzWJ0Z+BbBwzaoWVb49HrqVfSkxHen7WNznLhzl8xpQlT3E9oHUtYaufB+7NY9g9ctbjFfj/h1DwXUrzDltMn1Ql9M814EQWPLmEBg4R7JSzpFQxTmSBMkLvJKOhFHfKEEnv3L/+qw3DuMPzAFH9pIAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performanceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAtUExURUdwTBGW2xKV2hKW3BKW2xGW3BKW2xGW3BGW2xKW2xKV3RGW2xGW2xGW3BKW2+P2IvgAAAAOdFJOUwC/gCvzq1RAleURc9VmrA9rXAAAAT9JREFUOMvNkzFLw1AUhU+SxtTahnZyC+IsIeAenDuE/oJQcS/FTYTi6hKcHYpDZ/EXBME95BeURpM0Me39Db4Mgk/u23umcL8kvHfOucBBKEr5eW95xoMjeuBBlyY86NOQBwt654HrPPHAca/YuUHrDQsG9eybBWa1+GLBqvS3LJiNX0vGJw/R0N6LJ+/f6x9I3uwG0D+luRU0FnmdCtBy6ZM7KvQdjgXwJYuNZVNrFfqF8IX+nFm/oBvyS2iZ8OWxgH4u1IZmU4kgfoa5E77c0jwhoTYCbTRFGE7QrXFCveCURkK/2cRBCp2gFYiyWk7Jw4AgXOmQZMAqa9uAeCP+JsViihtb9OKIPtBUuvy8jeqyHRpMhvc5X0W6Lvg60HrPg0DREySOoqQJKRbByRWbExaqlSoVwB0rwCLFwesHquttxhcsa64AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performanceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTH3G63zE6n3G7H3F633G7H3F633G633F7H3F7HvG7H3G7H3F6xOzy+EAAAAMdFJOUwC/hKbvK0BT2XURZct0z00AAAE3SURBVDjLzZMhU8NAEIX3LiSUNqI1qBMMChFRgYxAd07E4CI6HQwzEUXgKjC4CH5ABAKJyA+oaHqBJO3+KPaYYSZh9nyfyuyXu7l77x3ASSgu+flYX/HgHOc8kC4wwikPMnzhQaTueKAiHvi43bFg0m4OLPBM9sWCjyb9ZsHm8NkwPiUQT8MjfSX/fn+F/C3syJf9YB7oLsDkjIaiHix5QCNbGBmAFPve+3lXi/0viLB3ZnmDz5g2ICry5daAvCbZhSE2oIsFeC35ssJljiQbgZitIY7nIGu4wLG+xBnpL5tClxQhCANR1Q5TSmCCQK7YjftOVbYNUOxot0EsHl0uwHdFfcD14PJLG9W9HfpMho81X0V8MnwdcHvkgS4cBcqVo6QKHQ9B1a6XY1zAcSiIFg6QlXDy+gEd714RcAqEowAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-face{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTL+/v76+vsDAwL+/v7+/v7+/v8DAwL+/v7+/v96T4QgAAAAJdFJOUwBAgSCbs9hZap+hQJoAAADvSURBVDjLY2AYRkAJCAygbEZBQUEBKJtpJhDAOJpA9kSYxESgKphuIaBuhASqyYzESjC2hDRilQBZ64BFgm2qMLPYNCwSkQpAwlMBWYIRzJsKYrKCxZSRncKSDFYzBSNY2MD2MqRhSFgqgClPAwwJBxwSbAk4jGKZDCKZp2JIsEOcOx0ztjQDYL5ENwsYJKrTsMSvGSgepzVg2pE5qSikPRPT8sopBuDod0ATZ54JsbZyBrJgAVAp1Ax2oPXMykjxYQaLA2CMoERUZQDMrgBUCc8CKIdzAvHJhyQJpLQLSu0TCaV2lPwBSu0KQy+LAwBuJj5UbruNggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-face:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTP///////////////////////////////////////////////w2imYoAAAAMdFJOUwBAgBvfrFmcw4wrbtGliFoAAAD2SURBVDjLY2AYRkAJCAygbEZBQUEBKJvpDBDAODpA9kGYxEGgKphuIaBuhASqyYzESjBu79yIVWIP0NoCLBIsR4WZJY5gkYiZACRqFJAlGMG8EyAmK1hMGdkp7M4gkus4RrCwBIApFwwJmwlgqsYAQ6IAIrEAwygHHEaxngJbfhRDgg0sxHoMM7Z0AmC+RAPsJ4S5NE5gid8VoHg8sgHTDh/PzM60HkzLc44bgKMf3RKuMwoQ+dNIgswJDAycUDPYjhgwMCsjxYcJLA6AMYISUTkBMLsaUCVqEqAcngPEJx+SJJDSLii1HySU2lHyByi1Kwy9LA4AqflRBKNSA88AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-faceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTBCT2xKV2hGY2hKW2xGW2xGW2xGW2xKX3BGX3BKW23povfoAAAAKdFJOUwBAgRybs9hZLG6hrV9tAAAA80lEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTgmZiFViFtBaBywSbEuFmcWWYZGIUgASXgrIEoxg3lIQkxUspozsFJZkEMmxBCNY2MD2MqRhSFgpgCkvAwwJBxwSbAk4jGJZAbZ8KYYEO8S5yzFjSysA5kt0s5YKc6guwxK/baB4XDYB045Vi4pCyrMwLa9aYgCOfgc0cY5VEGurViIJMhcAlULNYF9mwMCsjBQfZrA4AMYISkRVBcDsCkCV8CqAcrgWEJ98SJJASrug1L6QUGpHyR+g1K4w9LI4ALk0RHtSETFcAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-faceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTHzD63zE6n7H7H3F7H3F633G63zF7H3G7H3F7H3F68TinBIAAAAKdFJOUwBAgR+Z31ipwW4yAjb9AAAA+UlEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTmmZiFViFtBaBywSrMuFmSWWYpGoUgASXgrIEowgHtsKEJMDLKaM7BSWYLCaJRjBwloAploxJKwUwJSXAYYE2KUMVRgSrAFgKhTDKPbFIJJ5OYYEG1iIfRlmbGkVwHyJBlhWCDNrrMASvxageFw6AdOOqKCklrQuTMuzlhiAo98BTZx5FcTarJXIgglApVBr2ZYaMDArI8WHKSwOgDGCElFZBTC7GlAlvBKgHK4FxCcfkiSQ0i4otS8klNpR8gcotSsMvSwOAIs+RIlIrewIAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-object{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA51JREFUaEPtmT1oFEEUx9/bnRALGxE70btkZjcR7QMiRisRbCzEQvxCLGyEhCDRBC/RoNaWFgYLFUSwUBAUDKKFFqIQ3OzNJpfCyspS8HaejNyG87J7t7N3l03gttydefP/vbcz8+YNwhZ/cIvrhx5A3hFMjEAQBDwMwzOmAi3LWhBCLDTr5/t+ycSubdtLnPOncX1iAfQAlmXdNBmkru2RVgBSSspg+5kQ4lRjv1iAIAgqRFTIMIju0i2AWNvrAKSUowDwLqP4tACm9rWmbABCiFxXKimlhu0BtPFHtdc19wj4vn/Wtu3XnPOfWVByA5BSngCAuwCwryb8Hud8EhGNltANB/B9/5BlWXcA4GCMx/8g4jjn/H7aaGwYgOd5BxhjcwCgPd/0QcRVAJhM2l3rO3cdQEq5GxFvEdH5VsLX7aKIH8MwLLmu+zapb9cAFhcXt/f3988AwJip8Jj2L2zbLg0MDHxr/NY1gCAIpohIJ2V2BwC0iUd9fX2lQqFQ6cQvtJbICSGOxHhlVOdKjuPMl8vlqzrxI6IdWUAQ8Um1Wp0ZGhryiYghYrUtgDQionxJT0al1IwGkVJeBAANvieNDQB4joglzvmilHIXAIwrpX67rmuUamfKcxoTvnoQ3/dP27Z9g4j2J4C81KBCiC9LS0suY2yMiC7rttoZuQBEQhsiopfT6wAwUvv+hjE2XSwWP0kpRxBxgohO1kPmDhAHEgTBUaVU1XGc98vLy8eVUhoqbpPLPwIx6/wqEV2ovX8AALzZ/Ng0EWgQGa1iLQ8xPYCUyx8YHjt7EWjm2I7sAy0it7ERqNWEDkeiklIJg8pFWwC1ZC6SM9NYc1oXgcaiVlxVYmVlZW8YhlMAcCnFvOkEQPqqRBqASLTneTsZY3pjapZSpwF4Y1nW7ODg4Ie202kTgGiwSqWyrVqtXgOA6Zj0OhGAiF4R0azrup87dqDJAlA/eLlcnkDESQCI0us4gOdEdNtxnK+tfkHjA027AJEgKeUVANBROVd7p3fixwAwJ4T43kp4nR2zylynAOoE/JuAiPiDcx6kFb5pAEwF5zKJ2xXZrH9uc6BTUD0AAGh639Xo6bjUI+G/NglS+p3Y87wCY+y/2ozJSGkuRDLekQFjbEexWPxVryfpjuxhllKhNtwtAESc55xHx9M1hsR0WlcOlFLHTLyv26Ypi5hesyql5oeHh3VBeN2T6TxgCtXN9j2Abno3je0tH4G/KbtRT7VUKs8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-object:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAwdJREFUaEPtmTuIFTEUhv8fLSxsFrET3UIQRHtBRNdKBBsLsRBfiIWNoIisD1xfqLWlhYuFCiJYKAgKLqKFFqIgoiBoYWVlKbjwy4HMJXs3M5Nk7tzZCzfdvZPk/F9OHicnxIgXjrh+jAG69mCpByStB3AgQ+AcybmqdpJmEvv9SvJhqE0QwBm4lGikqD4VAaCMvh+R3NffrgzgB4DJDCPWpC2AYN+LACTtAPAqU3wsQGr/pikPgGSnO5Ukgx0DNJhRzZp27gFJBwE8J/k7B6UzAEl7ANwEsNEJvwVgmmTSFjp0AEnbANwAsDUw4v8AnCZ5O9YbQwOQtBnAdQA28nXlp/NG8HT1G7cOIGkNgKsADtepDnx/C2CG5Muytq0BSFoJ4DKAUxnC+5s8cSCf+j+0CXDBjAJYNgAA6+Keg7AwpldyAXqBHMmpwKjYyThJclbSSQBWfyIT5IF5kuQ3SctJzjcCiBHhxUu2GM24gRx1IGtj+gDw2I34Z0mrbXcC8JdkUqidFecEAj4fZD+A8wA2lYA8NVCSHyRtcGvouKtrg9EJQKHVB7Ht9ByALe7jCwAXSb6TZP+dAbC3D7JzgBDITgDzJF9L2u2gQoectV0yAD7IEffjDgC7plaVJQdgYotdLOYSMwaI2gETr51jD1SN6qDOgSobw/WAywltLxRVhBIxi7LxInaxUCHHFvmCpFkorWInoR8LheqsA2DB3LGIRdPIAznBXC1AIVrSKncwVYXUMQB2Sl8h+SYQOCanVaIBPJAVAM5aqBAIr6sAnjnh78s82aoHQkYlWYwz7YXXIQCLRK+R/Fg3BYcO4HnlhPPKIfefTYX7dm8m+aVOuNdP+1OoSow79KzKL5LfY4UvGYBUwZ0s4qYiazzY7RRqCtfZIm4qfGBrAEDle1e/0FDoUTKvUxiT3gfsaWlBbibFUsyDiKSkBK9nf4LkH19P2RvZ3cxUIVoEmCVZXE97DFXPrJY52JUy+lY3Ji2S8cxq4i3jsahk3QdSodqsPwZoc3Rj+h55D/wH5CHfQHNA9EUAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-objectActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA9JJREFUaEPtmU+IE1ccx7+/N7O0BwUn24UeRKOd7LalvS+I6HoSwYsH8SCtLf1jEqWoyLJVMfEP6nlNIgi6eFChCB4UChaU0h7aQ1GQrnFSdw9e/JNs9LTFzPvJZI27m8xk5k02m13I3sK+33vfz/u9N+/7fo+wzP9ometHF6DTGfTMQF+mYNqwd6sKlFLcK++P3WsWF8nkUyr9stAeTcXN624xrgDVAUgcVxmk1lbaGPIFyFocou9fSonYzvo4d4BsYQLgaIhB0EYA174bAFaNWpuFhrthxDsxQQCMrKXUPwGbvfr2BSglYh39UjmwXYCwy2kh4jqegd5M/itdaL8+i5vPwwB1DMDIWNuJcBbA545wAs4V4+YIiJQ+oYsOYGTzGwniDIANLjP+hkCHiglzNGg2Fg3AGB3/Ugj9NBO2+4ujSSaMeJ2uc+PbDhC5aK1GhU6CeY+/8IZz9E+CnSomBn7zim0bQF/m4QqbPkgDOKgufH4EAzdZaKny3vUP6vtqG0BvtnCUwY4p01oFcOIZuCJ7elKvvo9OtLyESMN7IzeViA3VC3TshiY4Wkz2j0Uyj3+aMX5shAIhuia4kn6Z+DSPu6xjiCotAQQRMeuXaJJYpqsgOetbcBV8TZA+ANxgotRU3Hz48SWr7800DjHL6VJyQMlqh/I5jYZvFsTI5XcRa0cA/sLDv98iieMv98X++Sj7aEBCPwjwD9W2LNMdAqhJnQMyc5D9DGBwRhzukK4fK/647q9I1hoE6DDAO+ZBdh6gEaQ3V9hi27JS3tf/u3Hhv20kpQPldsgthQw0fOcnpc3fVK2EhosEmE33x9LJwKxM54Lj/Ap0SeoCBPz+qVw7uxnwmdQFOge8R1n0DDg1ISaxqSbJy0oE2pTvqhStbOK5FQy2ka6vOTVkoL6o5VaVWHX+yVoh7KMAvvPbNq1mQNmNBgGoiV55fry3R+jOweRpqQMBMO4wxImp5Cd/tGynVQBqg0UvT3z4eroyDMaxenvdHIBvE/GJYnzgb69MtjUDboMa2ceHCTQCoGqvPQBuSOZT5WT/fb8luOgANUFGxkoQYVja+Lq2iQm4ygKnS3tj//oJf9+PamUuzBJqJsY59Jz/9wh6+iJpFoIKXzIAqoI7solbFdksvmN7YKGgugAMNH3vqp9pN+vhtq5VMqT2PpAbjwrW59VmVAYL8iASCfdGBvm/bpQPrCvP1eP+RpYrXA5XKgTaBkA0Voqb1eupL4DToFo5YLlVZfadtkHKIqrPrFLIsXL8s0k3LaHuA6pQ7WzfBWjn7Abpe9ln4C11Qo9Pmb2aMgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-objectActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA8hJREFUaEPtmU1oU1kUx//nvthx4cJqX3RgGLsQBNG1tq8Z7axkwM0sxIX4hbhwIygibfPMeyapunY5iymzGAURZjEDAwoVm8SPhSiIKAjtQtAmiooLiyb3yEtNm76+5L37kjQp5C2Te879/+65H+eeS1jlH61y/egCtDuCNSOQyH3cWirNHVIXKO6kYvqdenbxqVlLxS8J8Txp6Ne9bDwBnA5IiIRKJ5W2LDHsB2BmC6zqmxk3UkP6AbedJ4CZfTsNcL9qJ077VgHU8r0MID5V2EsCk2HEBwbIFdT8M/aGBkgaelt3KtOB7QKEnU9NsGt7BMyp2cOa4P8tY3M+DE/bAC7cK+xnxmUwtjvCCXzFHtRHiEhpC11xADOTjwG4BCLDY8S/MvhsyoheDRqNFQMwc292QmppEPb7i6MZgEdqna7V9i0HSNx/95MscRLgo/7CXS0IWS6VrFRs8+1ati0DSEzm18kesgGcURa+3OAfSGklY5ueuP9qGYCZzceZySKC1gQAgPkvXtNjpXatn258CmlYSOSSg/qwW+B8usH9SSM6Ec/lTxM7iR/3hgEh4Jpk2Kkh/UVikiP2MBUbAggiYjFfchajtB0QM/fuOFg64D8H8QHQTQ3CsowNT8cffdLnPn8+KyXPpWKb1FLtYJ0tbbU84asCyRYOEmiMwTtq+P63JJAYH9AfxTOFbUTlNXRyPlmTdpsAKlIXQZyDDJJGGbx7/l++BSHM5EDfg7HMm91CRM6B+fdqyA4AWA5iZd/++hWymDaid+OZ/G8EGgXB65DrhAi4Jw3NsORj5VRC4A8AW+tN2Q6KwKJM54b2HcD3EtMFCLojqVw7uxHwGdVQ992OjkC5JqSJPRXw2qlEsMpFo1OonMx9/7gE211z8iirLC1qeVUlxrLvtwgU4wBO+K2bpgCoVSX8ASqiRx682hgp/jBaL6UOBsC3pMTFdCyaaUI6HRyg0llicnptqWfdeTBMd3pdH4D/kyQupgf7HtaKZIj7gDpAdefxzOw5IjECoJxeewEQ6CZBpmwj+thvCq44QEWQmZ09BYjzLHFk4SQm/C2KIm3/svGZn/AFP+qVucYi4BbmbLnOb5rGr+zB6MugwjsGQFVwWxZxoyLr2bdtDTQLqgsAQt33LvdIe6UenvNaJUQqJ3Hi3ut+KSNLajMqfQV5EAnzRuZoEF8ivfZw74dqPbXeyP4MVSoE0DoAmkgafeXrqS+A08CpHBDTPpXRd9oGKYuoPrNqETlhD/w446Ul1H1AFaqV7bsArRzdIL5XfQS+AaeCtE+rbksUAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusion{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACCVJREFUaEO9Wn2MXFUVP+e96X5oa9UoYpUszrzzZlqLKDYhgAFaaKU2+M2W9Q8TNUQSQEsiRUjFVaHGNmoBMTUmaPwD2iIhqKR8WEBFGkLFUjbtzDtvpjYrVhpCXAtm1867x5zxvnXm9c28mR13b7LpdO65557fveeez0GYp1Gr1d4VRdF7lL3rui/n8/lX5mMr/H8wDcPwIgC4QkQuAwAVWv9eA4BJy/8sAHg7ALysf4i4DwAe9Tzvj/3uP2cA5XL5CsdxNiLi5QBwUkQeQcRHrNB/JaKZZuGYeRAA3gsAZ4nIBkTcAABLROS3xpjdpVLp0bmA6RlApVI5FxE3OY4zGkXRdkTc6/v+c3PZPAiC80Vkveu6Nxlj9ojIjmKx+GIvvLoGcODAgTctXbp0CwBsEpGHEXEbEf25l83a0TLzh0RkMyJ+AgB2TE1N3b5q1ap/dcO7KwC6AQDsRMQhAPiu53m7umHeK00YhlcDwC0iMg0A13ZzQJkAlKmI3A8ADyDi9Z7nnehVsF7owzA8Q0R+BABXIeJY1mF1BMDM3wSAcRHZ5Pv+nb0I0i9tEARfRcQdxphvFYvF8Xb82gJg5gsA4FkiyrylfoQVEScIgttyudxLhULhwSQvZhYAuJCI9qftkyrckSNHzs7lckdFZJ3v+0/0I2CntRMTEwNDQ0P3i8inAeCUPmLP8/Y2rwmCYC0iPl6v19+3fPnyvyT5nQZAmQ4ODv5aRF70fX/zfAk/OTk5PD09rcbg4/EeiPgPEfkUET2dALENEc+dmZm5cuXKlf9unjsNADNvBYD1AHAJEf1zPgCUy+UljuPsQsSPpfD/m95Is29h5rcAwO8AYC8R3doWgDopx3H2I+IXs17/XIEdOnTobcPDw3ry6zrwCKMo+kypVDoU01hreK8x5oJmZ9dyA0EQ/AwAhnzfH5urgJ3WVSqVd7iuu8vGTB23SLM+QRCoOZ/2ff8Ls2oXf9DYJpfLPSgiH+nGgfQKcGJi4szBwUE9+Uuy1orIQREZKxaL5WZadaiI+Ey9XtfbacROszfAzL8wxtQ62dysjdvNM7MGcSq8Rq1ZY/+pU6fGVqxYcSyNsFKpjDuOkyeizycBHBeRjb7v/z5rh17ma7XaSBRFuwHg/C7WPYWIV3fy9kEQXIyIu4no3bMAqtXqZcaYnUREXWzSNQkzFwBAhf9wF4v2RlG0sVQqncyiZWZ2HOfaQqGwr6FCYRhuE5E3E9F1WYuT83qluVzu74VCYWfzXLlcLuqDBYAPZvEUkYeIaBQR61m0Os/M9yDiG57nbW4AYOZnAeDWpAPJYsbMNwLAD5TOdd2L8/n8Hyy/FfbkV2bxaKgB4s89z5u1LFlrmPlSANhKRBfGAPTBrCGiatbieN7GSpoaDut3IvLa4sWLi8uWLXvVbvBUFi+NchFR00/V6+16ollr7AGpaj5JRCMxAL06VaGWNLATM2ZW4dc00yDinZ7nbdLvrLXQaDZ1iMi9vu9/ySb/BwHgTAC4kYh2ZIGw6ekbRJRDy+AlIjoja2E8X6vVilEUtdhoOzdBROdY4fcYY0Ydx0kDcQ8RXd90m+qVH9P/qwPTf9WcK5+YJmnemfmE67rnIDOfBwA/JaJuLEWDHzNrAPZwGmCNGnO53HYAWA4Aoykgvk9EX0uuDcPwBhG5KwahAjOzqqHqewNYMwhm/hMAXDMnAEEQaP76vTY39v4oiiZd1/0VALyzGYSI3OH7vubVqYOZ9fE3NEENin1LDdqkgZkFMBcVqlarG4wxv0mR4nUiWqLfHz58eGTRokXfdl33tnw+n+pVu1XZNLpZFbIq0fKIm6yIOhX10K8g4t1E9IDSa84wMDBwHBG1WNU8NIObDReY+RYA0EqDhhJqbQ4SkRYI+hotj9gCaDGj1Wp1lTHm+ZRdvk5EDdVh5h9qiaWZBhHXe57XCLKYWVXoygSPk0SksX1fw3r4FjPa4shsVqanP5DcyRhzebFY3Hf06NG31ut1fWQNT4uIWzzPu0M/d3gjTxPR6r6k/+/htDqyMAy/Y4zRPOCmmLn1zprYJ8eriLja87yJSqXyScdxHtKSi4YCVvgxRLyvjZCpFqhXQEEQbHccZ9rzvG/EsdBFIqKmVK1AYzQJl8Z/NH4PzHxV/NkCuAsRb0hb1C4x7xUAMx9GxGu0ONycD0yKyGcTuegLAJD26K4joh+nbczMe7QolZwTkZt939/Wq7BJeq2nIuIviUgr3v9LaDSdFJFjKR7vtMcYOxXVRWPMpY7jCBE1PGiz84k3F5G7fd//Sr/CW80YR8SROK2cvYFOKSUzr0PED2hGZYw5ISLHrafUx9QI2uICmFY1RORsx3FmEPE5EXne8zz1mn2Pjiml1d+ekvrmqHO+K3hWvvZJvb2ensoqCwmgq7KK1eGttnuyNqsSvVAAtGINAE9oF6hjYUsB2EaG6vWx2La3U96FAmAt28jU1NTqZOMjtbhrGxovZJXVFwJAXGYHgPPS6lVtS+dxY6PT41wIAFpe79To6Fj7j9PCdmX2TvF6vzYzLqtrgyX2MWk8M5sXcaNDRLQjeft8Vaxj4bQSLSJbEFHjsraNjZg+E4AS2obHTzRb0kxsvirXVm1vBoAT9Xr9y2kNjeQtdAVAF9kQW5PseW+zzszMjCcbGe1UsmsAMYOURveTc62nap1TRNYsSKM7eQIaO7mu+zkAWAsArwPA45oXdPNTAxutaillsTqoKIruW7CfGqRdpRaHReSj2lvo8scezyDiY1qc7dda9axC3W64UD+3+Q/fZENVhTDr2gAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusion:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABphJREFUaEO9WmnIVVUUXSuiuahopOLLIqTBBgtCC01Ty8JmS/sRVESBNgiVJVZaaag0WBlGYNEPrSyiQdTKskEjpNKSCBqlzAqJSAsbYMV67vt13/3uffe+93pvw+Mb7rn77HXOPntY5xEdEkkHAjgk1G8k+VMnpuL/oVTSaQDOBnBmGG3DfwHwXeg/DMC+ADbGZwWAZSRXtTt/ywAk2eDLAIwAsAXAkvjY6O9J/pk2TtLOAA4FYDDnxmdPAG8AeJbkslbANA1A0gkAbgJwKYA5AJaS/KCVySWdCmA0gFsAPAfgIZLrmtFVGYCk3QBMDeNfAjCb5MfNTFY0VtJJAG4FcL5BALiX5B9VdFcCEBPMB7ALgPtIPlNFebNjJI0DcDuAbQCuq7JApQBC6SIAiwFMJPlzs4Y1M17SAQAeBTAWwPiyxWoIQNJdAKbZbUjObcaQdsdKujHcaTpJ25ArhQAkDQKwmmTpLrVjrKQdANwJ4FOSL2R1SRKAwSTfz5sn1zhJhwP4BsAokq+3Y2CjdyXtBMDueRGAv32ISS7NhN+RAF4D0I/kt1l9fQCE0lcArCPpyNARkbQrAAeD81IT/ArgQpIrMyBmA3D4HkPyr/SzPAAzIzYPJflbJ6yX5ARm48/J0f+DdySdWyTtBeDtyDlTCgFEkrKvXVV2+lsFJmmfMH5UAx1fAriY5CfJmIiGCwAMSie7uh2Q9KRjPcnxrRpY4vP7hfGumcqkT/SR5POyjeSVycu9AKK2cRQ4vUoCKZs9J5ocFMYPrfDu2sgBn2fOgjP2e7E7tdopDeBpAF83irkVJs4dIslFnH3eVWuZ2IWdwDbkDZTknHAEySuyADa5uiT5TtkMzTyX1ONqE4ALtzJ5C8C4Rtle0pCoXg/uBSDJPjmf5FFlMzTzXNKRYfzJFd5z/PcCujRvKJK+iFppRc2FJDnO7k5yQtnLOb7tLf2RpIu9XpHUP9zmxAo6X3R5TvKfCmNt7zwAvztPJQBWA5iSTSBlyiRNAvBAjBtC8t1YkGNi5Y8r0xHPn0pHlrJ3JJ0BYCbJwQkAH5jhJL8qezl5HrWSW0NnVItbyP4kN8cE9ucycVh0+2m/nlM184drvkmyJwHgrbML1bWBjWaXZOOHZ8bMJeluzdts13I1WyQLSF4dzb/DpsPsJJJuaBpKtKd2oR0ZClwJug6vJOHfdTE6XlxPckAY7xbRbWceiHkkJ6Z201l5efw93T8dzkNP7d/Z8C7JfckAAxgI4AmSVSJFTZkkF2BuK/OkX/TKRweALIj7Sd6cfVHS9QAeTkAEALuh/d1Sl5klfQjgmlYBuEqdVQDg2KBTXgawfwbEDJLuq3NFkg9/zRMcUOIsJTuQrVB7AZiAataFTIu8mmPFVpKuNL1LTmB3u1kpyqqV/LUY7HYXisnqDnEqijipOEObVXuEpPtiG+dGxP83WZUWd3C95YIkN+hmGlxKONqsJel6pi2pO8RhUF0YlXQKgDU5s9xGsuY6kh4MiiU9bHRCUEmyC43J6NhC0rV9W5IXRusSWaywV98rnZURJFdI2huAD1mSaaeSnBHgis7ISpLD2rJ+++L1SWT3RB9ghqwmkgzKjX1WNgMYRnK9pAsAuAxYTNLRxu+5l1hYYGRuBGoWkCQzgu4L7kjOgP3WodRRIAGQGJen33VLch7GJr8HAIdCh8Q8yW3MWwDwWS2EkqvS/YBJ2UsyvehHAPIO3QSSj+VNLMkJzKRUViaTdNHYlgSf+jxJk8R1DY3byQ05GS/vMNaSSvii/VEkaxlUUjr5JMY6gt3QluX/eYZLlJ6k+KvUUkpyqj8+OirH300pALWiLSHAJJnVMK/kusqs9RqSTjptS3C0+S1lrF5TTX266uw0gxf2FTf1McDkUWVapZsAKtEqAcIu4FJhZBkT3S0AwVib4lxCspjYCgC+yLBf+0DXYnuRdBGAI5trK+efuouPInLXodMhtCGt3g0AKZp9YB5f1Yhe923JokaHs0sATK8XXnSUXXAkbWEuzd6oXm83ZkpKaPVpSY7J01l6eZFcdESX5cu3jjDWiXHBRLvpcV1WeLGRjC8FEAfbienx6JZmdZC5tttOBuBkeW3ehUZ2FyoBCBAurWv3ZdEPd/Ka1W5Td5FR5JKVAaS2OHvRbX6mJT41eE5TM52/6M6uQNDxlzvhAdga91gusat81cDVquurPQA4QS3s2lcN8rYyyOGzfLdQ8cseLsiWu7NrN1o17UJVJ+zW123+BfogD+TkdLQFAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusionActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACItJREFUaEO9Wn+MVNUV/s59+wOqyM7bFaxAsDBvFqnWak0MYhBQUEqUVssi/aNJawg7bxaKScFqqKyt0gip4sK8XUKqjX/IL43RlqBSxLZWYqwWdWNh3oIlFClkebMUaXfZefc0983MMjv7Zt7MLrvvn93MPec753v33HPuPfcRhukZt+3YeCndCQpeCO3kmWVTTg+HKbocoKHWjpnEuBfMd4GgnJ7ADAcCJzx8iUlE0AGcBOMkiPYz4c1kNPzXodofNAE9fvheQCyBoLvBOA/wHunSHq7CiXM9+BdWGj39nGuxq8dWYyJdxCSh8UKAFoIwBpL/CMidTmzam4MhUzaBmpYjNwmNVoFEA9jdSEx7zzZFPhiM8dotiduYeAFIWw2Wu6TLm7pW1n9SDlbJBK7d+rev/c8du5aAVQC/Lok2dEWNv5djrJBsTat9s2BeA9AiBjaN1s499eXyW/9bCnZJBNIG0AbQKCb8OhkN7ygFvFyZUGvHQ8R4DOBuSWgs5QUFEkiD8nYAuyuJmk5Hw2fKdawc+fGtHeN6mbcAWMxES4NeVlECequ9DoxmMK9yYpHny3FkqLJ6PPFTEG0CyyedWH1zIbyCBPQ2ewYk3ndMI3CWhuTsOhb6uMQTEBWfOdGpr+Zj6ZbNELjdaTQO+tnxda6m9R/XCa74AoLnO42RfUNysJjyuvYqffyo7QA/AKCXQYuSZnhvrorelpgHSW9LSn2jK3r9P/PhBhLY1V6ld1b/HuBPHDOyZricn/jsidEXRnXvIOD+SzaoS7r8/a4Vxrv9SFiJDQDd5NT13IeGGy7mjg0gELLs9QQsQAp3OiuN/wwHgbrfHh4ju8UOEH3XB/9LkvxAbm3RW+yrUIE/MbA3aRqPFyTgFakKcZCJfhK0+gdLbKz1aUjDaJWG5xfCYKADcB9MmtM+zcpksuELMiVn5Ba7fjOgxxMvgjDKMSNLB+tgMb0xW4/UVUpth7dnCnp8so9uJbaD0e3EIj/OqvcR8PY2VPGqJL6jlAISZD9//Op4+zWSqncwcGewLh8il5eeXVF/OFc2XVDpPXDqwezeqY9AyLJfIpbHiuXcYMP+EnqLPREVUGEzMxCDcFC6vUu7mqYf95PV40eamcSUpGn8SI1fmgHLPiUFL+lqjPw50EgZAjVbjk0Wwt0J4LYgNQYOVBE9VKza17QlZglJOx3T+Hofgdq2o3dJKduSpmEEGSlnfOxWe6pwsZOA75Sgt1dUu0s6H552Pkg2ZNm2EKLxbOPU/d4M6FbHBma+IhkzYkHK+ePpKa34d9Kc2pY7VmcdrpfQVNh8OxCT+TVnutGAOZQKlAUQittxIrrgmOE1aQJx+30p8Xh+AQkC01vtR8B4VskxtFlJc8pfPLw2ezokVNjcEIThjRP9zomG+zJLkE7NZnu2EFjvxIzbMzNgH3c1zD233DgapJwd17fYM0DYD8Lo9G/s9GpX1p9ffm2nZ0DDgUAstcsVNAGMWQBtVG80UAeACk3NxTuOaUzOEkg5KVwx4BhYBE237P0A5vYTIXreiYZXpWf1SDNIrCsIwfyCE4s8rA7/qV73EIBrADzimMamQBItdrVegQuOaVSQAui96H6WjBnjAhUzAnXWsXoJt1+Ozgy1O6Zxo+e8JnbBlQ1+JBiIJ02jqW824/Z8EN5KT6R8Uv1R6dzDyTz56T0Ut89UVmk3Ut1W+xZXYlsyapSSKTy4Osu+XwKv+xFWu0aBio1gXA+BhgEkGL9xYsbP8nVrrY4VDG7JklAOhyz7AAGzc3/L6oVa7Y80gWWDIhCKJ9YQ0TO+MybwTVHpnnB7tDcIuDqXBDM/nYxF1haaabX4ZS+8SFAJRa2lrGx+gukjMJgQCllHFxLkH3wc+coxjTHq95otn08mUflLltoTXU1TfKtqqSHrJ9cXQt6Cs+x+izgni6iicgrg0wBtdkxjtwfmHUSqTgGkmlW5jzrB9W0Xai37MQYWAZioml0ADjmmcfNQHPd0cxdxhkC/NFrXdvRWKeWH+YYY+HnSNLzQ0S37OXgtlpyHaYETC3sNqlrLfoOB+/IwzjumcdVQCQxMo/mFzHvD1ertV+UbIynvPttUv7/muS9qRHVK5Xqv0hLT2rOx8NPq/0JrhIF3k6YxZ6gEfApZx68Aqc4Bq7PgqjqDMMPHWCcTzUlGw+211pHvMcRrquXimEZDxvmlRPSyr5MFMlC5hHQrsREQ3Y4Z/oVXyNLNWd7mmMb0LFiOc374Ddn1oFv24r61obCsRAuBVvgpFTqYl0/A/pyJlqnm8KXtdKt9glz+Qe5ZtNayP2ZgwKJjRiwZMyw/w7pl71JNqQHrh/nRZCyyoVxn8+W9fqpGrzhRY5IXupdCJvEiwMfzK57vYswc99KxKGdDCHaihldB+xWfDDiDNyfNyMqhOu8lD6860+TssbKkI6WuSj3oW0yYSZBnwHxKEc3dtGUbYF5Xg/k6CNHDTB9o4A87zfBHl8P5okfKNLvyDvV+BC6Ho4Uwih7qlVK5bZWRJFBSWyUTw+sJtLCSMC+oEz1SBNIda+xj8J6ijS1FQF1kdLtjVYE6ns3thaZ0pAhkMtvkUdq5OfkXHwWau96FxsdBbfWRIJBts0vCLX79qoKt8+zFRrH2+ogQsGwudtFR/IIjeyws0GYvtl8fajbKttVBaM7WGD/MwMuL7EUHwBuRoqeGq2PdV1C9TjSvBWh1sYuNrHwgAS+9pi88tgIYx0TPDFfnOhO2jwI4Iym13O9CI38WSiLgKe1qrwp1VjePxDVrsq6nOf8io1BIlk4gg5B/0S01emew/VSvz+ny3BG56M5/A6odz6T9kIB5DHwFxtsssbuUTw1IYDEI8wm4koF9xO7LI/apgd9UquYwS74HzHeU+LHHeyToLdWcHWq2KjuESjU4Up/b/B9u0kgtWdqPkwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusionActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACJpJREFUaEO9WntsW9UZ/33HaZJCX7S5TmhalQ1NaAzGYJUgvk7pe5QKusGa0v0xaZvQkKBbK60BWl/b8XWKaLWtUJg6IcG0P+hrCMHWlcdK2OLrFPFYGdU0ac+q9BHfFPoC2sQ+33SufVPXvfa1kyaWolg+3+t3zznfd87vu4Qx+nQfONc8yF+0KvP1NPHoxjsm9Y+FK7oSRo2+fh0I3AUpFwHUyoxWIv6EiI4o+8w8m5mmE+EowEchxH4g95rZ1myN1v+IAUR6M3eRwCqAFgM4C8ZeZuyFmHDk9OmpH2+7my4UB7fmj9wwderpWZBDs4mwHOoPmAzwn1hiV7I9+NpIwNQMwOjtvwWC1gLUwVJuIfA+s73lnZE4N3pP3M6gZSTEeoB3Q/JWs735w1psVQ0g/t6xq+T5uogkrCXQKyDebIaCf63FWTlZI525FUydDF4hGFtFYzYZnzvz82psVwVAOSCI7QA3MuMJU9d2VmO8VhnDsh8gwuMAnWfIh6p5QL4AlFEAO5ixp45yj8T1lkytgdUiH7dOBLMceIYIKwGs9ntYFQFELDtGQJyJ1yZDwadqCWS0spF05qfEtJWl7Eq2N8fL2SsLwLBOtgEybeqa7yyNJthYjEVucSYqRN1HCX3GS6W2DMtmQIRMfUaflx/P4GJ9x6+Tsu6/xGJpIjzjzdEEWEk3tvtQvZzVsgPM9zEwJJhXJMLBfcU60dTJJUzyDSGyX+pqu/Z/pfYuAxA7xPXytP17YvowEdY6xyr4dekjEydxo0oG9170QadY8neS7drbl4KwNzPxLWKqdk/XTTRYPHYZgGgqs0kSLQsExJ1dd8w4MxYAOlP25AaCCv5uD/vHIHP3FdeW2IGTU3I5+WfBvC8RDm4oC0AVKRbUR6Af+u3+kQJ7rPfwNXVi4k4CLS1vg/+Vy/H9m+Y1/82VUdmQwc+T5LbiYnfJDBhW5gWAGk1dWz3SACvpxd8705QbHNwJ5kV+9r2yj2HZOwA+b+rBH7j6wwDyZxt6CcThagqIXwCl47GeTIusJ7Vs7vTTZfDBHGVXPxGa+Y9i2ULFTrHk+92z00UAlv1bSPmfSjnXz3G58c6ej2c1TGjYCYLub4P6JAZXd+szD3vJRnr74xDiy0ld+74aHwZgpOzjknhVtx78i7+T6iU2Wp/OEZzdBcLtVWj1BJB7oFK132hl5gmmXWZYu3YYQDQ9sIiZt5u69pUqnFQtErH6rycWKvhv+ioR9l2QWLU5rJ31kzUs+59E9FAi1LTfmYFo2t7MzFebevBhP+XScTWlVCdOmG3a9uKxSMq+QRB2MvANX5vML4shraNrAWV9ZQEYVuZZIvosEdI6HQCGlUmzpA2lBcTPWLTPXscSv3DkmOeZ4WCv+ho7cPLGXC63i0A3+dnIj9NvTL1pOLP46UR67fkkeJOpB0MFAPZhxoSFSX3av/2U3XHD6m9j0H4CTSz89kmgoeGG+NwpA3kH6PGzxcAOAbQyMI8IW9QT9dNR4xHr1PWEobdMXZvjAIik7OzpM01Xl14DKxkzLHs/gIXFMgR6KqE3rXVsqqUlRKy8DX7e1IM/2nCgvzmQFQdBaAFjnRnWtvqBcK6nUwY+S4a1OlLswfnc5x+ZejDop+iOq/VNhEtytLOKwIeSevBmFXxgQt3u3FC2wwsEMT+bCAcfGbZn9S8liNcdG1J2qf8qnTsps/ApTe+Glck0Bq66mWJ99m3MeC4R0vwzRcFYpM++lyRe8QKsTo1STtgC4KsiQB2lIAj4eULXflaqG7UG1jD4aReECthI2z1gzC/+zdWLpu33ifDgiAAYVn8nIJ70BBAQX/siK480CLwKJq0YBIG7E3owUm6mnc0/JJ2VoBKK2ksXZ6DkhOoCGMkSilr2cgb+4BHIOVPXJqvfN1rH5giqT0gORLv1azyrarVL1ktueAl5beKiLKL4nuMg9BPxtkQouEfJOxeR1ubjAKaXbOJ0Qm8aPi5E0gOPE7ACzLMAtBJwMKFrt44mcKV7ySZWPxjWpWk0lrLnSsK7pY4Y9FhSb3KWjpG2fwmGk3HcD5NYlgzNcAgqI22/CsY9JTbOmro2ZbQALkujpYWs8IRVSa8vdUa53OLEvJb9sZ5Pp3F9tsettAyKJPWm7vwDKbNHCG+bIW3BqAFcVsj6BkzkuNEMa+td4woUQG0ezgYCCCyI69MPRdL93yYWLyvKJRnWOpy1n7ZXC8aLXkGWy0C1AjJS9hYE6LzZ1mTkK7EiZ6V4ztS1G11jbnCegRB3uPshms6sdL87+8nKPE2gNV565S7mNQOw7L9DyAcVOXzxOG3ZRyBz3y2+ixqW/QEAj01HD5t606+8HEdS9u4CKVUyLB819ebNtQZbKq/4VIjA70xdm63GigBkXmDJhy+reB6b0b3u5fO0nA8hOKlrTgUtLj7Dmxu8LakHfzLa4J0Zdo4oNMe9VlZ1pYyoUk/i62DSAc6wlMfzpf7ioc0lwAqsxnUEugDB7yCLd8127f0rEXzFK2U+e9R2qfcCcCUCLWej4qXeAVAjrTKeAKqiVRQItQQgaLng3BI/Jnq8ACjGWlLgTUjeW5HYUgCcRsZgfY9UG7qQ28tN6XgBUJlNCJoj6gcXlDY+PMndwmb5wI9WHw8ALs0O4tu8+KoK9Hq+sVGJXh8PAHl6vXyjo3KDo3AtLEezVzqvjzYbubQ6A3G3xpQ5nlR25TY6iLGF6kRyrBhrNwrFRHNWRpiwvlJjw5WvqvuSb3gEfs2gIAFPjhVznU+VeJTAGSFyP/ZqaJQ+7qoAKCXV+OBTdnw82qw0TYuXNjLKrZOqAbgGShvdLOitkfKpiuckyQvHpdFd+gQUHQ9B3yPGEhDOAfwGS9pT1asGgldCNTgYk5igCtSL4/aqgddUKnIY4G8xc7ialz2IKAXQ64qcHW22qnkJVetwvF63+T9nAHfjRfzL0gAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-logSave{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA1RJREFUaEPtmT1oFEEUx9/bFLFKJzG2WiknZObFxlO8RtFC8SuFWlrYGBtRRNCghV9YmFQWgoVaaAS1ULRRRKvbmYBBQezVYBOIGFMkT0ZuYXPufOxdspuDO7jibmfe/H/z3sy8eYvQ4R/scP3QBSjbg8EemJyc3La4uHgUETcx82YAWNum+N8A8IWZrxLR41ZtBQForUeY+Xarg/j6MfMVIrroa5f13AuglOJWDLfQ56aU8mzefk4ApdR9ADiW12ir7RFxXAgxkqe/FUBrvYeZXzQbY+bh3t7ed5VKZTrPQM2eNHYQ8VGGjTtSypOhtq0AcRyPIeKptCEppTfkbAM3AxhbcRwfyYJg5nEiCvKEVZBS6hUA7EoEIeJ+IcTz0JlpbpcFYNrYIBDxlhDijG88lwd+IGJ/YoCZ1xPRd5/BUA/Mzc31VavVWRcEM18jovOuMV0eWLL7tBM+RoBS6isAbEzERFFUHRwc/JD8dnjishDikg2iSIAJADiU8uhdIjqRFuZYEweI6Gmuc8AWs6EhVK/XR3t6eg4zMyKiEQ/MvOSwQsS3iHhhZmbmY61W++UIp/dSyu2FAmit3zDzTjMoItaFEFuVUt8AYCB0ElLtZqWUfYUCZHlQKXUQAJ60AAC2Nbhia8AWglprAoB7jYQwmGXVACSKzRqJomgLAJjvBh/JqgPwCQ7dRAoPIZ/w5HkXIHQGQlOHvCd56PjdEOpoD6TShT/MfD19OXeFQCPnOYeIaxYWFiaGhoZGQ9Pv5nZthVA6XWjkOsMJRGj+b/IhIURtVQCkIUJvYKUCONLf/+67tjuw+T+rLlTYLmSDCDmwbOIbF6CgC1Vba8B3m3JBuMQXDuC4iGQy+MSXAhAKESK+NAAfRKj4UgFsEHnElw5gBGit9wFAUqy9kbco1vY2Gsfxsha2QrbV1K42gIimAPDvw8zTRLQuy0ZhpcU8AMZ7zPws1ee1lHJ3LoDlLu7mAcioZFuLvYWV130AU1NT/fPz8zuyqtWIuFcI8TKXBxo7QaEvOCyQD6SUx20T4K33F/iKKVOj7yrqBWhsiSv6ki8zNBBPCyHGfKEXBGCMrMBr1mZtPxHxEzN/jqLoYbr07oIIBvDNRFnPuwBlzXwybsd74C95KWhPrxIhsgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-logSave:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAthJREFUaEPtmTuMTUEYx3//TrWdeLRUJCrReISGUBCvLVAqNGiEiASh8IoClUKyBQqPBAWhsREqnYRE9NgoV0T3yci5m9mzc2bmnHvvOXuTO8ktbs7MN//ffPP45hsx4kUjrp8xQNcezPaAmW0EDgFrgLXA0j7F/wG+AlckPW5qKwvAzE4At5p2ktHusqTzGfUWVEkCmJk1MdygzQ1Jp+u2iwKY2X3gcF2jfdS/I8l5O7tUApjZTuBlwNIk8E7STHYvQMCTzs6jgI27ko7l2o4B3AaO+4YkJadcVcdlAGfLzA5WQGR7IgbwGtjuCdoj6UXuyJTrhQBcnQjETUmnUv3FAH4CyzwDKyX9SBnM9QAwIWk2AXFV0tlYnzGAebtPP9OnEPkNWO2J2STpQ+9/xBOXJF2ogmgT4Amw3xNyT9JRX1gEYq+kZyGIoQGY2UXgAPyPt5x4V8qH1TRwDvgk6XdkOr2XtLltgLfA1qLTj5I2mNl3YEWDdTQraaJtgAVryMz2AU8bAFC1Boc5hYKbgJmtB6aKgDCbZdEAeLuOWyPrit+qFMmiA0gJrjr4yu1an0Ip4Z6Hss6hMUBu6FD3JB9PodwRGGkPeOHCX+CafzmPDUAR85wBlrgwQ5LbUueV3AHsaxGbmR8uOAGTPYga8f+0pG2LBWAOosYNrFOAqith6L5bdQee81optG7nHIjE8DlnVlB8EVa3AxCJ4VMAleJbB2gAERXfCUANiKT4zgAyILLEdwoQgcgW3zlAIWA30EvWXq+bFBvESTzQxFZqSyqdAe7i7xIAvTIjaXnIRmupxZoAznvPvTZvJO2oCzDQ5G5NgPKbRGWyt7X0egrAzFwedktFtnqXpFe1PFAsxLYfOEIaH0g6UjUAyXx/i09MQY2pq2gSoPDEsB/5QuJPSnLrMFqyAAqIQT+zloX9Aj4DX4CHfuo9RpANkBqJrr6PAboa+V6/I++Bf0in3kCazcMZAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoom{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAkUExURUdwTMDAwL+/v7+/v7+/v76+vr+/v7+/v7+/v7+/v7+/v7+/vxtcv/AAAAALdFJOUwBVdZCpGdZE7C3B0wnY6AAAAV9JREFUOMt1lDtPwzAQx20ghGwVsHVJhQRDlsywWKqEULsw8FhRJ2iWiglGGJvFCw8xIVVCSEwkKU25L4ftpOHs2Cclsu7v370smxCLecRh+xOH8Ja5kGEs/6dtYf1XONcWZurbwwRCQjYZ9l7uHAPAOBHpI1QC/QSY9g84ldmnAn7Z3htwsfZnvSe54eJd5hlcC7gccxTwSETZEr5+714vLRdfkFraVNtetXLpR7ha+mkHCV1Y/q8ZOW8AgDkecsIaAEIcGbIGyLUq4KcBYl0o7QAB4FZACBMrQKpaJOCZQqyAIhgayYEpgD1DZghXCvBTNJFKmCvgzmhcCEsBwMjSRx6BslYftRX0JLYKrAsLqzDC54EFMwvy58QhMM8hFNq0UpwET+sLC9/4BmEBTytyRCIbDoAEiR1Qp1dbRxfoyv9g3ogaKVuXhVZZbtqX6Ez6H23PxG4CM259QDwt/h8ABfK8nDqSAAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoom:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwCCyreU7KZVRCDaZnETLwj6WaYVAAABUUlEQVRIx5WV2Q6EIAxFoVBWxf7/184AOnGUsvTBqDmXrqRCzNou1kwGtyZIQNuiD0P6evWTURFUMtIoPO+iVoGIZPkMqkdKA0jZgoJ6suQc2EoiGBldOoQ9HSDk5+GTs1Fqo9IlcEpvNv3qv0MBhSalIFSv3+MCJCY8fUaCxasycrMu9dp5VTUhubXZ6CqsAvn66ZAsx+e8fON37oT3bZ4aiRU0kDlavGSrQI95HPBZACt8FuCL16IruBVkzBeBW+CLYHvyfiDQd96IpHpOMqP++fAq9VMQ7rwrM5+6gjwG/3y/D/m8ylPYpvpAeqO7DfvwMPO9D6jnBabG56YFZx77fEjD+9AyLdYEhp8nxoNh5wmJtfY8AS+wzIZZrJNcC4h3wV8IH1p87Iyfnc6XVaAd7ICHAsebw97zgDSxZ/yvViiPuYUfTe650knM2+7Ywz9yOCklzohLOwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoomStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwDjmTC6Y0KBVakX8s8iC3JYR1wyAAABVUlEQVRIx62V2baFIAiGcwJRS97/aU/Zbtht0VzrcJOuvl/AAabpXy1RF0F/m2h2PX5mzucEuO9gMon1MY7KlG8w4LImC1XFQmxDGVkm1DYpXi0qS1gXTEGzKoqNS1ajAxPqJDikFLcFS+aukYJffRfXnAj9kYUXFVi86wzzPjuCFRXBwS3KaC/Pt02Ww7uf1jz3BVYtX/OsyDQFDn7yswPXb+Ovs39eJJWwxrOXV4thgC+//QBf/uMAXwAa4AuRBvgdWR58CB2B+eaRG5e8QO7Jn2sIAvzhbdsDnXzev8q0BengGXv8EciH3y1CY5++yI/BRNx82g/La7lc7b0Am/tUC6n3HoZ4SbDyy5BgzSNivV6wbPXeIPOpHlOU+CjkTQKvQOpXdRdJvn+5xttWQa4EZUOzluonT6+q72X6Zb0+T/lNhQd7hg9vm8LWUhW5gT4iN7c/0ZUo8Q3AttYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoomStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAqUExURUdwTBKV2hGW2xKW2xKW2xKW2xGV3BGW2xGW3BGX2xKW3BKW2xCX2xKW2yDN61kAAAANdFJOUwCAVKxm3T/DmhrxKw97YQBGAAABaklEQVQ4y2NgIA6wGqCLMCqAqV4HdIm9F0Ek22UMM9hiG4AkVzQDA+cmx+YyJJnDlw8wMNQaNpfevbu0QgxJgrN3JQPD3VvhjU57kESnOZqvvXuJgcEXxVFMEkDt1w11gZYwoVgue3d5SzaQSgCydZG1TMkBU8vBuq9guBcqNBNDgj0GQrMEb0CVYEmA2ViANRQZ795tQPZduADciXcVUNSthGu4hGrAJawagBIXsWoAClzGqgEocRWrBqDIrQNQDTPRXZ8A0cB41wBNQgGiQfbubTQJAagGDB0GIA0OsnevbkCTCADiu4J374ahW34JqAEIbiXMRJOAgkvMKJYgJBx6717AKiF4F4eOu+jxgQCXGHBIKPDgkBC8JYCURJDtQHYWN4oEcvpZiyR+C9lZtkgSKKG1CyGOGrxItleixjrcLFBWRAYcMIkG9NQMiY67N7AlcxAQwMwA6SBxM2xZQ3jtVRPsRQ83sg8ACMIUxzzE8wsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-close{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-close:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTP///////////////////////////////////8kBMKEAAAAJdFJOUwCt0igUwJdJePGbgLgAAADcSURBVDjL1ZMxEoIwFESTCaOWFDapqeicnAALTiANnaWlnVewDTMW/7b+aCAb8jkAVIHN2/lsNkrt73lf8M08nnF1pAYFR/dFmAAx7SIoi4iDbRrWDMAuQFzmmxAGbjjJgjj6dCjMCAND/o8RWQMzUgIRKYE/wsC5TJIRR74rBUZaqqXwLZEXT0WTDGwLW1aavJWQir9qadw++NgykWoMNtcykh8Q5EECgr5C+jjpGjHjPGhPU5eVzyfPJitfnUyhPg6ywMKZ7BygcYcsPCj1Kc8uXYPqpeSLs6PnC4w8S+8OJ9MLAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-narrow{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABm1JREFUaEPVWWuIVVUUXmvfYRosHzUZUUqKjkSXSe5Z+5qJhfawLELCR5ohPhKjjB4EWgkpkopRSWEPS1Mqy7Gkd0iPGaKy6ey9Z3z0opwEQytSMiS5NZ4Ve7j3dubMOfecO96buf/cx17rW+vba52919oH4RQfeIr7DxUjoLW+BhHHAsAAZh5gPwGghpl/TKVSHZ7n7T9+/Ph+ANg/atQo+1mRcUIEtNYzAWAiM09ExLPK8KgNADYw8wYp5Z9l6PUQ7RWBvON3AMClJ2Kcmb9DxAKR33qDVRYBrfUNzLwQESf0xliUDjPvR8T1RLSsXNzEBIwxc5l5fYSBnxGxxfO8bQCwN5VKHc7lcofr6+tzR44cGcTMg4UQgxDRfp8IAJdH4KwlooXlkEhEQGv9EAAsDQF+GwDWEdE75Rg1xlwFADcx83QAOCOg29SvX79ZDQ0NuSSYsQS01h8BwBUBsF45HnTIGHMBM9uFmR2Ya0bEWxzHORBHoiQBY8xmZp4RAFlNRIvigMuZN8asYOb7Azq7hBCTMpnMvlJYkQSMMUuYeblf2fO8ZdlsNiyVyvE3VNZ13XFCiGb/JCK+6DjOrLIJ2N0GAN4KKG4hIpuzVRtKqf6I+HvAwAIiWhdlNDQCSqntga3yUyK6rGqe+4Db2tqu8zzv3cJfiPiLfQYdx/k6zH4PAvlD6iWf8B7P8yZls9mO/4KAtaG1fhgAHvCReN1xnClJCXweOGFLhrAapJqamlLDhg372H9eMPNMKeXmoL1uEVBKTUXEJp+QJiJZDSfjMIOZgIibHMcJbrfdq1Gt9WMAcI8P/D9f/YJtpVQfW7n6isSDRHReyQhorXcCwMV5oWN1dXWD0un04bjVqta81to+i7bi7RpCiAmZTOYDv71iCu3cuXNQZ2env07fRkSTq+VcEtyQ7XwNEfkz5N8Ucl13khDiDR/b+ZlM5vkkhqopo5Q65Euj74loRGgElFJ3IuIThUnP8xqz2eyeajqXBFtrvR0AiuU7EXXbeIo/tNaPAMB9BVBmrpVS/l3KiDFmBjNPKbMbK0A+6zjOq3EktNavAUAxlUsR2AIA0ywgM3dIKYfFgRtjmph5apxc2Dwz/ySlHBynq7V+wV+tliLwPgBcmwdsJaLRceDGmD3MnI6Ti5j/g4j6x+lqrZ8EgGKTE0nAGPM0M9+Wj8BhKWV9HLjrukuFEPMBoMf+HKdrm3oimhcnFyy1IwkopRYj4soCYF1dXf3JPAMKfiilNiFisaSOJOC67nQhxCu+h3i0lLI1boWqPW+M6WDmoXk7+4io8L3rr+IuZIwZycztPocWEdHqajtYCl8pdSEifuOT2UhEc/w63fZUrfWvADCwixlii+M4408mAa31AgB4xufDHCLaGElAKbUZEf09cAMR/XCySGit7TXO3IJ9IcTQYI8cLKfvQsQ1BYVq9sBxi9La2jqipqbmMwA4Oy8bWtoHCTiIaBua0/JKB5hZSikPxhms9LxSah0i2i26MHoUct0eYt+2tRIRF5/MKGit7YFqD9auYU9tRBwfls49emJjzEBm3gEAxVKCmadJKbdWepWj8LTWHwLAlb75hUS0Nkw+6lbidkTspoCI6aibgUoSU0otR8QlBUxE3Oo4TleNlpiAFQwWUfa/XC7XZ8yYMccq6bAfS2v9OADcHUidqUT0RdkE8iS+BIBsQHkkEe2qNAml1HOIeGsA914isqQiR5LL3aMAcHoAYTIR2av0Ex7t7e3ne563mplvDoIh4le2xC+VurEE8pGwh1m3/sBec3ie96iUcndvWLS3t4/o7OycK4SYw8znRKZIDIlEBPIk7IrfGDB01JIAgJZsNtuShIjruplUKmWdtidsMLK2lFmFiPP8fUapSCQmYJ2L6cDsNfh7iLiXme1VjG3GOwFguOd5DYg4HAAa7O/Q3QTRXiavchxnhzHmIgCw3V6xWYoiURYBa9h13atTqdTssJxNEoEImQeJaIV/LimJsgkUjCilLrGXToho33mFrmoMod2I+LLneW9KKb8Nk01CotcE/AaVUmOFENcz8zgAGAIA54Y4dAgADiCifejtjcQnSSIWRgIAniIi+5q3cm/q/c40NzfX9e3bd4gQ4kxEPFhbW3sgnU7/lcThJJHwV8kViUBvHStHz0aCme2qe7W1tasbGxu7rkFPGQKR50Q5q/B/lP0HjgOoT/ydvaYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-narrow:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABS1JREFUaEPVmgmoVVUUhr+fosKC5ogGSsqIpKQwMqjIBpsICdMGQ7ISo4wGApugJCoxLClssElpNEuaI5okKjOI5onKhEQrSiKiaKA/Vu3zOu+8c88593qvj7fgcO99e6/h33udtdda+4khThri9tM1ALaPAQ4Btso9GwNfAyuBb7JHUnzvCq0XANuTgePSs00bFr0L3BuPpF/b4BswtSMAyfDzgYPXRznweQ7ID53IaguA7ROBGcC4TpRV8IRL3SNpVrtyGwOwfVYoaaHgW2AZsBT4CliXnt+BXYBd02d8D5c7rIWc+ZJigRpTIwC2rwauKZH6NLBA0jONNQK2jwJOAU4FtijwPgpMkRTga6kWgO2XgSMKkjoyvGiN7d3SwpxZGHsVOEPSmjoElQBsPwScVhAyR9LMOsHtjNu+Hri8wPMBMF7SqipZLQHYvgq4tsA8S1KZK7Vjb+lc24cDsfJ5ul/SlLYBpGjzVIFxsaTw2Z6R7S2BnwoKpkta0Epp6Q7YfqEQKl+XdGjPLM8Jtn088GzuT9/FOyjpkzL9AwCkQ+qB3OSPki9GOrBByPZ1wBU5ZY9LOrkpgDcLJ2zlFvYCke2NgFcK58VkSRFU+lG/HbA9EYg4nNE7kkb3wsg6mSWesEhSMdz2z0Zt3wRcnBO+wVc/0217WMpesyRxraSd6nbgfWC/NOm3OP4lRVowKGQ73sXIeDMaJ+nFvDF9LmQ78pR8nr5U0oRBsTwpLQnn8yTlPeR/F7I9HngiZ/A0SXcPJoDQbftHIHOjLyTt1WoHLgBuyQ3uKylC6KBS8UyS1C/w5F3oRuDSnLWbSPqzynrbkSdFfG6nGstE3inpkbrVsf0Y0OfKVQAWA5OSwJWS9mggPEJuhN5OaLWkqBMqyfZ9QF/4rALwPHBskrZC0pgGwsPFRtbNazH+s6TIfeoA3JqqwH/nVQG4HTg3SVsnadsGwiMznQYMiM91vKmgP7tuXjHVrgJwGXBDTuC2g3kGZHbYXhQVWva7CkCkyg/nAIyRtKJuhXo9bjuSyOFJzypJ2ff/XCqHdBTwXs6gmZLm9NrAKvm29wY+zc1ZKGlqnqeYzH0PbJ8mLJM0dpABTAfuyNkwVdLCKgDFGniEpC8HC4TtaONEOyej4cUaubgDFwLzcgw9q4HrFsV2pAxvANuluaWpfRHAAUAUNJsmpmhrjJa0tk5ht8dtRx0cITqjAYlcv5c49zJHKI2QmtEG3wXbcaDGwZrRamBsmTuX1cTxEi8H8qnEJElLur3KreTZfgk4Mjc+Q9L8svmtuhLnAUWGka06A90EZjt6UdGTymiJpCxHG6CqqrHVL4lKnMMkRaXWE7J9M3BRwXUmSnqrlcK61uLbwIEF5lGSou3XVbJ9F3BOQeglkgJUS2rS3P0F2LwgYYKkaKWvN9neGYgT//QSYR9Hil/lurUAQqjtOMyK9UEkWXMlfdgJihTn45CK1GCHChmVIBoBSCBixU8qKIrdmRuXG5LigqOWbO+fjA7jizsbqcxsINLsfJ3REkRjAAlEVQUWbfDncjc0UYz/BewJjCh8lgGNZvJsSctt75MabLUg2gKQQBydSrwyn63dgRYTrpQUdwR91BRE2wAyDbYPSk2nuPOKVW6X4t15EHhS0mdlzE1AdAygsFpxwX0CEJcUuwM7lhgULhW5VRgeHYnXmiBuAeI2SXHN272b+gKgzRKQrYFIBNdI+qOJwQ13oi8/68oOdGpYO3xpJ2LV/45zI/t3hSEDoBXYIQ/gH99H3EBePlczAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-expand{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABvJJREFUaEPVWWmIXEUQrnqzZseYxGM9QBNF4hrJEDfzqieuAY/gFRXPyMYbzUHwQBQUzx+KeBAJKhrRqEhEQWMU75AYXREPlunu3bjxIDGraIwiuJpFkL26pMK84eXtm3lvZieGFAzsTtf1VVd3V9Ug7OOE+7j/0BAAnZ2d2UmTJl2cyWTaAOBA+TDzgYjYDAB/y4eZ5fNjc3Pze7NmzfqlUYEbFwBr7TUAcAEzXwAA2bROIeKnzrkNALBeKWXTysXx1QXAGHMVANwEACePxzgzjyLi057nrczn81vr0VUTAGOMRPtmRDy7HmOVZBDxL+fcyr6+vgc7OjqGatGdGoC19hZmfrKC8t9LafEWAGzLZDL9g4OD/S0tLYM7d+6cyszTPM+biojy97kAcGoFPV8ODw8vbG9v354WRCoAxpiXAUDyPUrvAcAqIno/rUHhs9aeCQALmflyAJgUlkXEf5xzp6U9G4kAjDHcKMejeqy1xzDz/QBwXYyNViL6ISkwVQEYY74AgLkRJcuJ6M4kxbWsW2sfZua7ozJNTU1HtLW1/VFNV0UAxpjlAHBHWNg590ChUJCINZyKxeLpnud1RhSvmzJlyiWtra2DFS+AuAW5bQDg3cja60QkObvHSGstj588fGVi5heVUktqAqC1Xh+5Kj8nolP2mOchxd3d3ec55z6I2JpPROvj7I9JodIj9UqIebNz7qJCodD3fwAQG8aYhwDgnpC99UQ0Py2ALyMv7DIiWvV/OS921qxZk5k+ffon4fcCEZf4vv9i1I/ddkBrfSUivhpiMkSkanXeWnsFAFwCADNHR0fX1nPwYzJhAxGdkwTgJUQM38l1Rd8Y8yYAXFoytoOIjqo1CFrriQDwCyIeEsh6nndsPp//KayrvANbt25tHhgY+AsA9i8x/JvNZqfmcrn+Wo1bazuZ+fRAjogSH8w4G8YYOYtSOAZ0GxE9EQvAGCMRk8gF9BYRLajVeeFvIIDdrnOpt3zfnxcLwFr7CDPfFdqupfl8/oW9CUBsa63/DKXRz0R0TCUAzzDzDcGic25WoVDYvLcBGGPk/i+X7wMDA/vNmzdvJPCrnJvW2leZ+cpggZknKKWGqwGw1l7IzOcg4swoX/gMyNbH6HnO9/3XkgJkjFkLAOVUzmQyM2bPnr1lDABjjJTE58sCM/cppaanUK4BgJL44taZebtSalqSrDHmpXC1ysynKKU+j9uBj5hZ6nShLiJqT1Jurd3MzLkkvgrrfxPRwUmyxpinAODmSqkdTqE3mPmy0g70K6VakpQXi8X7Pc9bCgBHJvHGrEsjtCxJLlpqDw8PTwt3bGEAzzNzuerLZrMt9bwB4lCjrtHSLbQaEa8NgGaz2cm5XO6fuDPwGADcHjrE7UqprqQIxa03EoC1to+Zjy3ZGZN25R3QWt+IiCtDDt1JRNLU1EyNAqC1PgERvws58DYRSY1VpjKA3t7eaUNDQz+Xtybm1UuLpFEAjDFyRp4N2a1cSsTlLgCkaqyjwBoIQMrnRYH+0dHR/Jw5c3pid6B0YO5GxIdDV1ZdPbC19nLn3GOIOAUA1hLR4rS7F/B1dXUd39TUJEOFQ+U7RNzo+/5ZUT3RfsBHRGloZCgrtIOZlVLqt1odGC+/1noVIsoVHdAiIpJHbTcaU+ZqrR9BxHJRtycnEZVAGmOkfVwXOo9bJk+efGLcdGIMAGvtYcz8FQCUSwlm7lBKvTHeqKaVN8ZsBIAz0qRybKMRc6VKDuZ83/82rRP18mmtH0TE+0LyHxNRUOKMUVuxU7LWlkuLQGpwcHDi3Llz/63XuSQ5Y8zjAHBrwMfM/cy8oFAoxFWzu9iSRou/xtQ5bUT0dZIzta5rrZ+XyUNYDhFv931/RTVdVQF0d3e3OufKtXdI0QIiklH6uKmnp+co59zycC8SOrzfAEBHtdRNbLaLxeIMz/O+H3N9Ia52zq1QSvXWg6Knp+f4kZGRRZ7nXc/Mh1fSgYhVQSQCEMW9vb1HDA0NyS0UHS/KLF+2+NNqeRp2rlgs5jOZjDgtL+wBEcdlEv0oIi4O9xnVQKQCIEZkTuN53uqgZ4iJmMxrPkTEbXL4AECaceldj3POtSLicVKayP9x0UZEGSY/6vv+V9ZaaVHXpAGRGkBgtFgsnpXJZK6Ly9l6Uqkkcy8RlUsY+S4tiJoBBE5qrU9CxKvlZ1YA2G3UkRJIr4wxnXPvKKXGnLG0IOoGEHZSnn5EvIiZTwKAowEgrh39U2orRJRDLxOJz9IAjdsJAHiGiORn3sb8Uh91ZNOmTQeMjIwcjYgHIeJvEyZM2JHL5Wr6+TSsMwoCEVf4vr+re2zIDqSJ5Hh5BAQzS9R/IiJpf3fRPgOg4jsx3sjsbfn/AH37LF5g3/BiAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-expand:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABYZJREFUaEPVmXmoVVUUxn8f0WRzVkJlIWVGUmIJWWADTVaUldFclCnSQBQYNv1RSCWGVFRSlkRh0GBS2YBmJWGJUBHNNJiYWQSZfwTRxBfrce5jv/3Ovefc++4z3oKLD/fea61v7bXXdMQQJw1x/ekKANs7AOcA44Ddkt/2wJbk9z2wTNIP3TLcgADYvhw4q/gFiLq0ClgBLJf0Ud1DZfs6AmD7UuA64JiBCAf+BR4GHpH0TSe82gJgO6x9PXBqJ8JanPktQABzJP3VDu/aAGzfADzYhPnPQLjFUuA7YHPx+xPYHxhZ/Bt/nw4c14TP+8CFkjbWBVELgO2ngfD3nJYBCyW9Wldg7LN9cigKXATsnJ39HTi+7tuoBGDb3VI852P7QOBO4MoSGaMlfVtlmJYAbL8HHJsxmSdpdhXjdtZt3wPcWnJmhKRfWvFqCsD2PODm7PBdksJiXSfbJwDvZIzfAM6VFG+plEoBFNHmlezEc5LCZweNbEcSjMSX0iJJ09sFsDwLlaslTRo0zRPGts8AXstkTZYUOvWjfjdQJKnFyc7PgCmS1m0NACHD9t3AbYm8yNiT6wKIWJxm2JmSFm4t5QsA2wBvZ/liuqRFuR59bsD2JcAzyaYPJU1oV3nbF8fjAw4DlnTy8Es8YYWk06oAPJnF5I6sb/tF4LxC2CZJ+3VghGFAVK17JmdHSVqf8uq9AdtR+kZNsmOx4Y9I/5KiLGiLbEc4jLDYQ5IqE2aZANvxFqNwbNBNkh5oBiAsFpZr0FJJU9vSvNjcRQBRPKbhfJWkE5sBuBe4JVmcIemJ/xNAyLb9a+JGGyRF+dFLqQstAK5J1g6XFCG0berWDRQA8py0raR/et2z8YftiD4RhRq0naS/W2lv+2wgIkNEm5x630BRaufrj0l6tso6tpcAqSuPkfR1GYAoic8sFtZJOqgG8w+Ao6r2NVnfKCn6hJZkO4+MkyStLgPwJhB1etBaSRNrMA8XG1u1r8n6Fkl7VJ21/VDRBTa29nHt9A28AJxf7NosaXgN5lGZzgD2rdpbsh6N0MyqcyWl9si0Y0sBPA6kVd/wTnJAKNTlR/wUcEUCdBdJ0bX1UArgPmBWsnGipLVVFipb7zKAKCJHFXL6uV0K4NpiMtDQabakaGrapm4BsH0o8GWiwEuSosbqpRRARIQNyVq/rFcXSRcBxBt5NJHbvJQo812gVmOdA+sigCifpyX8x0v6uPQGCgDRWEeD3aCOemDb0XrGm9q1KKevrnt7jX22DwFiqLBX8X8rJZ2S88n7gSOBaGiiMg3aBEyQ9FO7Cgx0v+1ooiJEN2iapEhqfaispcyLuo5uYSAAbEf7GBOJBkXpcETZdKIMwN7AGiAtJS6QFIluq5DtlcBJdVy52VglD6nBa6ykLwYbge05wB2JnLckNUqcfuJbDbbS0qJxcJik6NQGhWzfD9yYMI9ucKqkGByXUtVo8ceSOmecpE+6jcB2XsqEiFmS5reSVQVgNNBbeyeMwioxSh8w2Y6GPzJ+2os0+H4OxPtr6rqVzbbtMcBXJZpGkTVf0qedoCjifCSpq4B9WvBoCaISQDC2PQKIN5GPF6MqjCuOsqOpn6bK2R5fKB3K75QpHpPouUAkvrTPaAqiFoACRMxpwuqNniE3WsxrXk++0EQzHr3rwVGSZP+WGTymD3MlrbEdLerzdUDUBtCQaDvSeXyQKPPZTrwpztwuKS1h4tZrgWgbQALkaOCy4hNrn1FHTRTxdmKQ8LKksjdWC0THADK/jtQ/BQhQBwBl7Wi4VNRWoXhMJN6tA7TJTSyQFJ95u/OlPlfEdjzOALI7EIVgzEfb+nyaGSh3p4h+Pd1jV26gjiUHuqe4ibD6eklRqvfQkAHQzABDHsB/7aMVT352GH8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-menu-icon-text,.jb-pro-container .jb-pro-quality-icon-text,.jb-pro-container .jb-pro-scale-icon-text,.jb-pro-container .jb-pro-speed-icon-text{font-size:14px;min-width:30px;height:20px;line-height:20px;cursor:pointer;text-align:center}.jb-pro-container .jb-pro-speed{box-sizing:border-box;text-align:center;font-size:14px;color:#fff;width:90px}.jb-pro-container .jb-pro-menu-list,.jb-pro-container .jb-pro-quality-menu-list,.jb-pro-container .jb-pro-scale-menu-list,.jb-pro-container .jb-pro-speed-menu-list{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;overflow:hidden;width:-moz-max-content;width:max-content}.jb-pro-container .jb-pro-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-speed-menu-shown{visibility:visible;opacity:1}.jb-pro-container .icon-title-tips{pointer-events:none;position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:rgba(0,0,0,.5);border-radius:4px}.jb-pro-container .icon-title{display:inline-block;padding:5px 10px;font-size:12px;white-space:nowrap;color:#fff}.jb-pro-container .jb-pro-quality-menu{padding:8px 0}.jb-pro-container .jb-pro-menu-item,.jb-pro-container .jb-pro-quality-menu-item,.jb-pro-container .jb-pro-scale-menu-item,.jb-pro-container .jb-pro-speed-menu-item{display:block;height:25px;line-height:25px;margin:0;padding:0 10px;cursor:pointer;font-size:14px;text-align:center;width:50px;color:hsla(0,0%,100%,.5);transition:color .3s,background-color .3s}.jb-pro-container .jb-pro-menu-item:hover,.jb-pro-container .jb-pro-quality-menu-item:hover,.jb-pro-container .jb-pro-scale-menu-item:hover,.jb-pro-container .jb-pro-speed-menu-item:hover{background-color:hsla(0,0%,100%,.2)}.jb-pro-container .jb-pro-menu-item:focus,.jb-pro-container .jb-pro-quality-menu-item:focus,.jb-pro-container .jb-pro-scale-menu-item:focus,.jb-pro-container .jb-pro-speed-menu-item:focus{outline:none}.jb-pro-container .jb-pro-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-speed-menu-item-active{color:#2298fc}.jb-pro-container .jb-pro-volume-panel-wrap{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%) translateY(22%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;height:120px;width:50px;overflow:hidden}.jb-pro-container .jb-pro-volume-panel-wrap.jb-pro-volume-panel-wrap-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-volume-panel{cursor:pointer;position:absolute;top:21px;height:60px;width:50px;overflow:hidden}.jb-pro-container .jb-pro-volume-panel-text{position:absolute;left:0;top:0;width:50px;height:20px;line-height:20px;text-align:center;color:#fff;font-size:12px}.jb-pro-container .jb-pro-volume-panel-handle{position:absolute;top:48px;left:50%;width:12px;height:12px;border-radius:12px;margin-left:-6px;background:#fff}.jb-pro-container .jb-pro-volume-panel-handle:before{bottom:-54px;background:#fff}.jb-pro-container .jb-pro-volume-panel-handle:after{bottom:6px;background:hsla(0,0%,100%,.2)}.jb-pro-container .jb-pro-volume-panel-handle:after,.jb-pro-container .jb-pro-volume-panel-handle:before{content:"";position:absolute;display:block;left:50%;width:3px;margin-left:-1px;height:60px}.jb-pro-container.jb-pro-fullscreen-web .jb-pro-controls{width:100vh}.jb-pro-container.jb-pro-fullscreen-web .jb-pro-play-big:after{transform:translate(-50%,-50%) rotate(270deg)}.jb-pro-container.jb-pro-fullscreen-web .jb-pro-loading{flex-direction:row}.jb-pro-container.jb-pro-fullscreen-web .jb-pro-loading-text{transform:rotate(270deg)}.jb-pro-container .jb-pro-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;left:10px;top:10px;min-width:200px;padding:5px 0;background-color:rgba(0,0,0,.9);border-radius:3px}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu{cursor:pointer;font-size:12px;display:block;color:#fff;padding:10px 15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-shadow:0 0 2px rgba(0,0,0,.5);border-bottom:1px solid hsla(0,0%,100%,.1)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu a{color:#fff;text-decoration:none}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span{display:inline-block;padding:0 7px}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span.art-current,.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span:hover{color:var(--theme)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu:hover{background-color:hsla(0,0%,100%,.1)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu:last-child{border-bottom:none}.jb-pro-container.jb-pro-contextmenus-show .jb-pro-contextmenus{display:flex}.jb-pro-container .jb-pro-extend-dom{display:block;position:relative;width:100%;height:100%;display:none}.jb-pro-container-playback .jb-pro-controls{height:48px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center{flex:1;display:flex;box-sizing:border-box;justify-content:space-between;font-size:12px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time{box-sizing:border-box;flex:1;position:relative;height:100%}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-inner{width:300px;height:100%;overflow-y:hidden;overflow-x:auto}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-current-time{position:absolute;left:0;top:0;height:15px;width:1px;background-color:red;text-align:center;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-current-time-text{position:absolute;box-sizing:border-box;padding:0 5px;width:60px;left:-25px;top:15px;border:1px solid red;height:15px;line-height:15px;cursor:move;background-color:#fff;color:#000;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll{position:relative;width:1440px;margin:0 auto}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.one-hour{width:1440px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.half-hour{width:2880px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.ten-min{width:8640px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.five-min{width:17280px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.one-min{width:86400px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-list{position:relative;background-color:#ccc;height:48px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-day{height:100%;overflow:hidden}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-one-wrap{height:8px;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-wrap{height:25px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-btns{display:flex;align-items:center}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one{float:left;width:1px;height:8px;margin:0;cursor:default;position:relative;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one.active,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one.active{background-color:orange;cursor:pointer}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one.start,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one.start{background-color:#999}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one:hover .jb-pro-playback-time-title-tips,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one:hover .jb-pro-playback-time-title-tips{visibility:visible;opacity:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips{pointer-events:none;position:absolute;left:0;top:100%;visibility:hidden;opacity:0;transform:translateX(13%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:#000;border-radius:4px;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips.jb-pro-playback-time-title-tips-left{transform:translateX(-100%)}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips .jb-pro-playback-time-title{display:inline-block;padding:2px 5px;font-size:12px;white-space:nowrap;color:#fff}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute{float:left;position:relative;width:60px;box-sizing:border-box;border-top:1px solid #999;-webkit-user-select:none;-moz-user-select:none;user-select:none;text-align:left;height:25px;line-height:25px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:first-child,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:first-child{border-left:0}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:first-child .jb-pro-playback-time-hour-text,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:first-child .jb-pro-playback-time-hour-text{left:0}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:after,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:after{content:"";position:absolute;left:0;top:-8px;width:1px;height:14px;background-color:#999}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour-text,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-text{position:absolute;left:-13px}.jb-pro-container-playback .jb-pro-playback-expand.disabled .jb-pro-icon-expand,.jb-pro-container-playback .jb-pro-playback-narrow.disabled .jb-pro-icon-narrow{cursor:no-drop}.jb-pro-container-playback .jb-pro-control-progress-simple{position:absolute;box-sizing:border-box;left:0;top:-2px;width:100%;display:flex;flex-direction:row;align-items:center;height:8px;cursor:pointer}.jb-pro-container-playback .jb-pro-control-progress-simple:hover{top:0;align-items:flex-start}.jb-pro-container-playback .jb-pro-control-progress-simple:hover .jb-pro-control-progress-inner{height:100%}.jb-pro-container-playback .jb-pro-control-progress-simple:hover .jb-pro-control-progress-inner .jb-pro-progress-indicator{transform:scale(1);visibility:visible}.jb-pro-container-playback .jb-pro-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:all .2s ease;background:hsla(0,0%,100%,.5)}.jb-pro-container-playback .jb-pro-progress-hover{display:none;width:0}.jb-pro-container-playback .jb-pro-progress-played{position:absolute;left:0;top:0;right:0;bottom:0;height:100%;width:0;background-color:orange}.jb-pro-container-playback .jb-pro-progress-indicator{visibility:hidden;align-items:center;justify-content:center;position:absolute;z-index:40;border-radius:50%;transform:scale(.1);transition:transform .1s ease-in-out}.jb-pro-container-playback .jb-pro-progress-indicator .jb-pro-icon{width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container-playback .jb-pro-progress-indicator:hover{transform:scale(1.2)!important}.jb-pro-container-playback .jb-pro-progress-tip{display:none;position:absolute;z-index:50;top:-25px;left:0;height:20px;padding:0 5px;line-height:20px;color:#fff;font-size:12px;text-align:center;background:rgba(0,0,0,.7);border-radius:3px;font-weight:700;white-space:nowrap}.jb-pro-container-playback.jb-pro-fullscreen-web .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-playback-time-inner{overflow-y:auto}.jb-pro-zoom-control{cursor:grab}.jb-pro-performance-panel{position:absolute;box-sizing:border-box;z-index:10000;left:0;top:0;padding:5px;font-size:10px;background:rgba(0,0,0,.2);color:#fff;max-height:100%;overflow-y:auto;display:none}.jb-pro-performance-panel .jb-pro-performance-item{display:flex;align-items:center;margin-top:3px;color:#fff}.jb-pro-performance-panel .jb-pro-performance-item-block{height:10px}.jb-pro-tips-message{position:absolute;top:0;left:0;width:100%;height:100%;background:linear-gradient(180deg,rgba(0,0,0,.8),hsla(0,0%,100%,0));overflow:auto;box-sizing:content-box;display:none}.jb-pro-tips-message:before{color:hsla(0,0%,100%,.3);content:"X";font-family:Arial,Helvetica,sans-serif;font-size:40px;left:0;line-height:1;margin-top:-20px;position:absolute;text-shadow:2em 2em 4em #000;text-align:center;top:50%;vertical-align:middle;width:100%}.jb-pro-tips-message .jb-pro-tips-message-close{position:absolute;z-index:99999;right:0;top:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.jb-pro-tips-message .jb-pro-tips-message-close .jb-pro-tips-message-close-icon{width:20px;height:20px;border-radius:10px;cursor:pointer;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-color:#fff;background-size:100% 100%}.jb-pro-tips-message .jb-pro-tips-message-content{overflow:auto;padding:35px;box-sizing:border-box;width:100%;height:100%}.jb-pro-tips-message .jb-pro-tips-message-content .jb-pro-tips-message-content-item{font-size:14px;color:#fff;text-align:center;line-height:1.5}');class Ih{constructor(e){var t;this.player=e,this.TAG_NAME="Control",this.extendBtnList=[],((e,t)=>{e._opt.hasControl&&e._opt.controlAutoHide?e.$container.classList.add("jb-pro-controls-show-auto-hide"):e.$container.classList.add("jb-pro-controls-show");const i=e._opt,s=i.operateBtns,r=`\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
00:00:00
\n
\n
\n
\n
\n ${i.playbackConfig.showPrecisionBtn?`\n
\n
${Ah.narrow}
\n
${Ah.expand}
\n
\n `:""}\n
\n `;e.$container.insertAdjacentHTML("beforeend",`\n ${i.background?`
`:""}\n
\n \n
\n ${i.loadingIcon?`\n
\n ${Ah.loading}\n
${i.loadingText}
\n
\n `:""}\n ${i.hasControl&&s.play?'
':""}\n ${i.hasControl&&s.ptz?`\n
\n
\n
\n
\n
\n
\n ${i.ptzMoreArrowShow?'\n
\n
\n
\n
\n ':""}\n
\n
\n ${i.ptzZoomShow?'\n
\n
\n \n \n 缩放+\n \n
\n
\n \n \n 缩放-\n \n
\n
\n ':""}\n ${i.ptzApertureShow?'\n
\n
\n \n \n 光圈+\n \n
\n
\n \n \n 光圈-\n \n
\n
\n ':""}\n ${i.ptzFocusShow?'\n
\n
\n \n \n 聚焦+\n \n
\n
\n \n \n 聚焦-\n \n
\n
\n ':""}\n ${i.ptzCruiseShow?'\n
\n
\n \n \n 巡航开\n \n
\n
\n \n \n 巡航关\n \n
\n
\n ':""}\n ${i.ptzFogShow?'\n
\n
\n \n \n 透雾开\n \n
\n
\n \n \n 透雾关\n \n
\n
\n ':""}\n\n ${i.ptzWiperShow?'\n
\n
\n \n \n 雨刷开\n \n
\n
\n \n \n 雨刷关\n \n
\n
\n ':""}\n
\n
\n `:""}\n ${i.hasVideo?`\n
\n
${Ah.narrow}
\n
电子放大
\n
${Ah.expand}
\n
${Ah.zoomStop}
\n
\n
\n
\n
00:00:00
\n
${Ah.recordStop}
\n
\n `:""}\n\n ${i.hasControl?`\n
\n
\n
\n ${i.showBandwidth?'
':""}\n
\n
${i.controlHtml}
\n
\n ${i.playType===_&&i.playbackConfig.showControl&&i.playbackConfig.controlType===Q.normal?r:""}\n ${i.playType===_&&i.playbackConfig.showControl&&i.playbackConfig.controlType===Q.simple?'\n
\n
\n
\n
\n
\n
00:00
\n
\n
\n ':""}\n
\n ${i.playType===_&&i.playbackConfig.showRateBtn?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.close?`
${Ah.close}
`:""}\n ${s.logSave?`
${Ah.logSave}
`:""}\n ${s.performance?`
${Ah.performance}
${Ah.performanceActive}
`:""}\n ${s.aiFace?`
${Ah.face}
${Ah.faceActive}
`:""}\n ${s.aiObject?`
${Ah.object}
${Ah.objectActive}
`:""}\n ${s.aiOcclusion?`
${Ah.occlusion}
${Ah.occlusionActive}
`:""}\n ${s.quality?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.scale?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.audio?`\n
\n
\n ${Ah.audio}\n ${Ah.mute}\n
\n
\n
\n
\n
\n
\n
\n
\n `:""}\n ${s.play?`
${Ah.play}
${Ah.pause}
`:""}\n ${s.screenshot?`
${Ah.screenshot}
`:""}\n ${s.record?`
${Ah.record}
${Ah.recordStop}
`:""}\n ${s.ptz?`
${Ah.ptz}
${Ah.ptzActive}
`:""}\n ${s.zoom?`
${Ah.zoom}
${Ah.zoomStop}
`:""}\n ${s.fullscreen?`
${Ah.fullscreen}
${Ah.fullscreenExit}
`:""}\n
\n
\n
\n `:""}\n
\n
\n
\n
\n
\n
\n
\n
\n `),Object.defineProperty(t,"$poster",{value:e.$container.querySelector(".jb-pro-poster")}),Object.defineProperty(t,"$loadingBg",{value:e.$container.querySelector(".jb-pro-loading-bg")}),Object.defineProperty(t,"$loadingBgImage",{value:e.$container.querySelector(".jb-pro-loading-bg-image")}),Object.defineProperty(t,"$loading",{value:e.$container.querySelector(".jb-pro-loading")}),Object.defineProperty(t,"$loadingText",{value:e.$container.querySelector(".jb-pro-loading-text")}),Object.defineProperty(t,"$play",{value:e.$container.querySelector(".jb-pro-play")}),Object.defineProperty(t,"$playBig",{value:e.$container.querySelector(".jb-pro-play-big")}),Object.defineProperty(t,"$recording",{value:e.$container.querySelector(".jb-pro-recording")}),Object.defineProperty(t,"$recordingTime",{value:e.$container.querySelector(".jb-pro-recording-time")}),Object.defineProperty(t,"$recordingStop",{value:e.$container.querySelector(".jb-pro-recording-stop")}),Object.defineProperty(t,"$pause",{value:e.$container.querySelector(".jb-pro-pause")}),Object.defineProperty(t,"$controls",{value:e.$container.querySelector(".jb-pro-controls")}),Object.defineProperty(t,"$controlsInner",{value:e.$container.querySelector(".jb-pro-controls-bottom")}),Object.defineProperty(t,"$controlsLeft",{value:e.$container.querySelector(".jb-pro-controls-left")}),Object.defineProperty(t,"$controlsRight",{value:e.$container.querySelector(".jb-pro-controls-right")}),Object.defineProperty(t,"$volume",{value:e.$container.querySelector(".jb-pro-volume")}),Object.defineProperty(t,"$volumePanelWrap",{value:e.$container.querySelector(".jb-pro-volume-panel-wrap")}),Object.defineProperty(t,"$volumePanelText",{value:e.$container.querySelector(".jb-pro-volume-panel-text")}),Object.defineProperty(t,"$volumePanel",{value:e.$container.querySelector(".jb-pro-volume-panel")}),Object.defineProperty(t,"$volumeHandle",{value:e.$container.querySelector(".jb-pro-volume-panel-handle")}),Object.defineProperty(t,"$volumeOn",{value:e.$container.querySelector(".jb-pro-icon-audio")}),Object.defineProperty(t,"$volumeOff",{value:e.$container.querySelector(".jb-pro-icon-mute")}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jb-pro-fullscreen")}),Object.defineProperty(t,"$fullscreenExit",{value:e.$container.querySelector(".jb-pro-fullscreen-exit")}),Object.defineProperty(t,"$record",{value:e.$container.querySelector(".jb-pro-record")}),Object.defineProperty(t,"$recordStop",{value:e.$container.querySelector(".jb-pro-record-stop")}),Object.defineProperty(t,"$screenshot",{value:e.$container.querySelector(".jb-pro-screenshot")}),Object.defineProperty(t,"$speed",{value:e.$container.querySelector(".jb-pro-speed")}),Object.defineProperty(t,"$controlHtml",{value:e.$container.querySelector(".jb-pro-controls-item-html")}),Object.defineProperty(t,"$playbackTime",{value:e.$container.querySelector(".jb-pro-controls-playback-time")}),Object.defineProperty(t,"$playbackTimeInner",{value:e.$container.querySelector(".jb-pro-controls-playback-time-inner")}),Object.defineProperty(t,"$playbackTimeScroll",{value:e.$container.querySelector(".jb-pro-controls-playback-time-scroll")}),Object.defineProperty(t,"$playbackTimeList",{value:e.$container.querySelector(".jb-pro-controls-playback-time-list")}),Object.defineProperty(t,"$playbackTimeListOne",{value:e.$container.querySelector(".jb-pro-playback-time-one-wrap")}),Object.defineProperty(t,"$playbackTimeListSecond",{value:e.$container.querySelector(".jb-pro-playback-time-second-wrap")}),Object.defineProperty(t,"$playbackCurrentTime",{value:e.$container.querySelector(".jb-pro-controls-playback-current-time")}),Object.defineProperty(t,"$playbackCurrentTimeText",{value:e.$container.querySelector(".jb-pro-controls-playback-current-time-text")}),Object.defineProperty(t,"$controlsPlaybackBtns",{value:e.$container.querySelector(".jb-pro-controls-playback-btns")}),Object.defineProperty(t,"$playbackNarrow",{value:e.$container.querySelector(".jb-pro-playback-narrow")}),Object.defineProperty(t,"$playbackExpand",{value:e.$container.querySelector(".jb-pro-playback-expand")}),Object.defineProperty(t,"$ptz",{value:e.$container.querySelector(".jb-pro-ptz")}),Object.defineProperty(t,"$ptzActive",{value:e.$container.querySelector(".jb-pro-ptz-active")}),Object.defineProperty(t,"$ptzControl",{value:e.$container.querySelector(".jb-pro-ptz-controls")}),Object.defineProperty(t,"$ptzBgActive",{value:e.$container.querySelector(".jb-pro-ptz-bg-active")}),Object.defineProperty(t,"$ptzControlCircular",{value:e.$container.querySelector(".jb-pro-ptz-control")}),Object.defineProperty(t,"$ptzArrows",{value:e.$container.querySelectorAll(".jb-pro-ptz-arrow")}),Object.defineProperty(t,"$ptzExpand",{value:e.$container.querySelector(".jb-pro-ptz-expand")}),Object.defineProperty(t,"$ptzNarrow",{value:e.$container.querySelector(".jb-pro-ptz-narrow")}),Object.defineProperty(t,"$ptzApertureFar",{value:e.$container.querySelector(".jb-pro-ptz-aperture-far")}),Object.defineProperty(t,"$ptzApertureNear",{value:e.$container.querySelector(".jb-pro-ptz-aperture-near")}),Object.defineProperty(t,"$ptzFocusFar",{value:e.$container.querySelector(".jb-pro-ptz-focus-far")}),Object.defineProperty(t,"$ptzFocusNear",{value:e.$container.querySelector(".jb-pro-ptz-focus-near")}),Object.defineProperty(t,"$ptzCruisePlay",{value:e.$container.querySelector(".jb-pro-ptz-cruise-play")}),Object.defineProperty(t,"$ptzCruisePause",{value:e.$container.querySelector(".jb-pro-ptz-cruise-pause")}),Object.defineProperty(t,"$ptzFogOpen",{value:e.$container.querySelector(".jb-pro-ptz-fog-open")}),Object.defineProperty(t,"$ptzFogClose",{value:e.$container.querySelector(".jb-pro-ptz-fog-close")}),Object.defineProperty(t,"$ptzWiperOpen",{value:e.$container.querySelector(".jb-pro-ptz-wiper-open")}),Object.defineProperty(t,"$ptzWiperClose",{value:e.$container.querySelector(".jb-pro-ptz-wiper-close")}),Object.defineProperty(t,"$qualityText",{value:e.$container.querySelector(".jb-pro-quality-icon-text")}),Object.defineProperty(t,"$qualityMenu",{value:e.$container.querySelector(".jb-pro-quality-menu")}),Object.defineProperty(t,"$qualityMenuList",{value:e.$container.querySelector(".jb-pro-quality-menu-list")}),Object.defineProperty(t,"$scaleText",{value:e.$container.querySelector(".jb-pro-scale-icon-text")}),Object.defineProperty(t,"$scaleMenu",{value:e.$container.querySelector(".jb-pro-scale-menu")}),Object.defineProperty(t,"$scaleMenuList",{value:e.$container.querySelector(".jb-pro-scale-menu-list")}),Object.defineProperty(t,"$zoom",{value:e.$container.querySelector(".jb-pro-zoom")}),Object.defineProperty(t,"$zoomStop",{value:e.$container.querySelector(".jb-pro-zoom-stop")}),Object.defineProperty(t,"$zoomNarrow",{value:e.$container.querySelector(".jb-pro-zoom-narrow")}),Object.defineProperty(t,"$zoomExpand",{value:e.$container.querySelector(".jb-pro-zoom-expand")}),Object.defineProperty(t,"$zoomStop2",{value:e.$container.querySelector(".jb-pro-zoom-stop2")}),Object.defineProperty(t,"$close",{value:e.$container.querySelector(".jb-pro-close")}),Object.defineProperty(t,"$zoomControls",{value:e.$container.querySelector(".jb-pro-zoom-controls")}),Object.defineProperty(t,"$performancePanel",{value:e.$container.querySelector(".jb-pro-performance-panel")}),Object.defineProperty(t,"$performance",{value:e.$container.querySelector(".jb-pro-performance")}),Object.defineProperty(t,"$performanceActive",{value:e.$container.querySelector(".jb-pro-performance-active")}),Object.defineProperty(t,"$faceDetect",{value:e.$container.querySelector(".jb-pro-face")}),Object.defineProperty(t,"$faceDetectActive",{value:e.$container.querySelector(".jb-pro-face-active")}),Object.defineProperty(t,"$objectDetect",{value:e.$container.querySelector(".jb-pro-object")}),Object.defineProperty(t,"$objectDetectActive",{value:e.$container.querySelector(".jb-pro-object-active")}),Object.defineProperty(t,"$occlusionDetect",{value:e.$container.querySelector(".jb-pro-occlusion")}),Object.defineProperty(t,"$occlusionDetectActive",{value:e.$container.querySelector(".jb-pro-occlusion-active")}),Object.defineProperty(t,"$contextmenus",{value:e.$container.querySelector(".jb-pro-contextmenus")}),Object.defineProperty(t,"$speedText",{value:e.$container.querySelector(".jb-pro-speed-icon-text")}),Object.defineProperty(t,"$speedMenu",{value:e.$container.querySelector(".jb-pro-speed-menu")}),Object.defineProperty(t,"$speedMenuList",{value:e.$container.querySelector(".jb-pro-speed-menu-list")}),Object.defineProperty(t,"$logSave",{value:e.$container.querySelector(".jb-pro-logSave")}),Object.defineProperty(t,"$playbackProgress",{value:e.$container.querySelector(".jb-pro-control-progress-simple")}),Object.defineProperty(t,"$playbackProgressTip",{value:e.$container.querySelector(".jb-pro-progress-tip")}),Object.defineProperty(t,"$playbackProgressHover",{value:e.$container.querySelector(".jb-pro-progress-hover")}),Object.defineProperty(t,"$playbackProgressPlayed",{value:e.$container.querySelector(".jb-pro-progress-played")}),Object.defineProperty(t,"$playbackProgressIndicator",{value:e.$container.querySelector(".jb-pro-progress-indicator")}),Object.defineProperty(t,"$playbackProgressTime",{value:e.$container.querySelector(".jb-pro-playback-control-time")}),Object.defineProperty(t,"$tipsMessage",{value:e.$container.querySelector(".jb-pro-tips-message")}),Object.defineProperty(t,"$tipsMessageClose",{value:e.$container.querySelector(".jb-pro-tips-message-close")}),Object.defineProperty(t,"$tipsMessageContent",{value:e.$container.querySelector(".jb-pro-tips-message-content")})})(e,this),e._opt.extendOperateBtns.length>0&&e._opt.extendOperateBtns.forEach((e=>{this.addExtendBtn(e)})),e._opt.extendDomConfig&&e._opt.extendDomConfig.html&&this.addExtendDom(e._opt.extendDomConfig),t=this,Object.defineProperty(t,"controlsRect",{get:()=>t.$controls.getBoundingClientRect()}),Object.defineProperty(t,"controlsInnerRect",{get:()=>t.$controlsInner.getBoundingClientRect()}),Object.defineProperty(t,"controlsLeftRect",{get:()=>t.$controlsLeft.getBoundingClientRect()}),Object.defineProperty(t,"controlsRightRect",{get:()=>t.$controlsRight.getBoundingClientRect()}),Object.defineProperty(t,"controlsPlaybackTimeInner",{get:()=>t.$playbackTimeInner&&t.$playbackTimeInner.getBoundingClientRect()||{}}),Object.defineProperty(t,"controlsPlaybackBtnsRect",{get:()=>t.$controlsPlaybackBtns&&t.$controlsPlaybackBtns.getBoundingClientRect()||{width:0}}),Ph(e,this),((e,t)=>{const{events:{proxy:i},debug:s}=e,r=e._opt,a=r.operateBtns;function o(e){const{bottom:i,height:s}=t.$volumePanel.getBoundingClientRect(),{height:r}=t.$volumeHandle.getBoundingClientRect();return oa(i-e.y-r/2,0,s-r/2)/(s-r)}if(pa()&&i(window,["click","contextmenu"],(i=>{i.composedPath().indexOf(e.$container)>-1?t.isFocus=!0:t.isFocus=!1})),i(t.$controls,"click",(e=>{e.stopPropagation()})),a.play&&(i(t.$pause,"click",(t=>{r.playType===_&&r.playbackConfig.uiUsePlaybackPause?e.playbackPause=!0:Ya(a.pauseFn)?a.pauseFn():e.pauseForControl()})),i(t.$play,"click",(t=>{r.playType===_&&e.playbackPause?e.playbackPause=!1:Ya(a.playFn)?a.playFn():e.playForControl().then((()=>{e.resumeAudioAfterPause()}))}))),i(t.$playBig,"click",(t=>{r.playType===_&&e.playbackPause?e.playbackPause=!1:Ya(a.playFn)?a.playFn():e.playForControl().then((()=>{e.resumeAudioAfterPause()}))})),a.screenshot&&i(t.$screenshot,"click",(t=>{t.stopPropagation(),Ya(a.screenshotFn)?a.screenshotFn():e.video.screenshot()})),a.audio&&(pa()&&(i(t.$volume,"mouseover",(()=>{t.$volumePanelWrap.classList.add("jb-pro-volume-panel-wrap-show")})),i(t.$volume,"mouseout",(()=>{t.$volumePanelWrap.classList.remove("jb-pro-volume-panel-wrap-show")})),i(t.$volumePanel,"click",(t=>{t.stopPropagation(),e.volume=o(t)})),i(t.$volumeHandle,"mousedown",(e=>{e.stopPropagation(),t.isVolumeDroging=!0})),i(t.$volumeHandle,"mousemove",(i=>{t.isVolumeDroging&&(e.volume=o(i))})),i(document,"mouseup",(()=>{t.isVolumeDroging&&(t.isVolumeDroging=!1)}))),i(t.$volumeOn,"click",(i=>{i.stopPropagation(),na(t.$volumeOn,"display","none"),na(t.$volumeOff,"display","block");const s=e.volume;e.volume=0,e._lastVolume=pa()?s:1})),i(t.$volumeOff,"click",(i=>{i.stopPropagation(),na(t.$volumeOn,"display","block"),na(t.$volumeOff,"display","none"),e.volume=pa()?e.lastVolume||.5:1}))),a.record&&(i(t.$record,"click",(t=>{t.stopPropagation(),Ya(a.recordFn)?a.recordFn():e.recording=!0})),i(t.$recordStop,"click",(t=>{t.stopPropagation(),Ya(a.recordStopFn)?a.recordStopFn():e.recording=!1}))),i(t.$recordingStop,"click",(t=>{t.stopPropagation(),Ya(a.recordStopFn)?a.recordStopFn():e.recording=!1})),a.fullscreen&&(i(t.$fullscreen,"click",(t=>{t.stopPropagation(),Ya(a.fullscreenFn)?a.fullscreenFn():e.fullscreen=!0})),i(t.$fullscreenExit,"click",(t=>{t.stopPropagation(),Ya(a.fullscreenExitFn)?a.fullscreenExitFn():e.fullscreen=!1}))),a.ptz){if(i(t.$ptz,"click",(e=>{e.stopPropagation(),na(t.$ptzActive,"display","flex"),na(t.$ptz,"display","none"),t.$ptzControl.classList.add("jb-pro-ptz-controls-show")})),i(t.$ptzActive,"click",(e=>{e.stopPropagation(),na(t.$ptz,"display","flex"),na(t.$ptzActive,"display","none"),t.$ptzControl.classList.remove("jb-pro-ptz-controls-show")})),t.$ptzArrows.forEach((s=>{if(r.ptzClickType===K)i(s,"click",(i=>{i.stopPropagation();const s=i.currentTarget.dataset.arrow;t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-show"),t.$ptzBgActive.classList.add(`jb-pro-ptz-bg-active-${s}`),t.$ptzControlCircular.classList.add(`jb-pro-ptz-control-${s}`),e.emit(nt.ptz,fo(s)),setTimeout((()=>{t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-show"),xi.forEach((e=>{t.$ptzBgActive.classList.remove(`jb-pro-ptz-bg-active-${e}`),t.$ptzControlCircular.classList.remove(`jb-pro-ptz-control-${e}`)})),e.emit(nt.ptz,Ri)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let r=!1;i(s,"mousedown",(i=>{i.stopPropagation(),r=!0;const s=i.currentTarget.dataset.arrow;t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-show"),t.$ptzBgActive.classList.add(`jb-pro-ptz-bg-active-${s}`),t.$ptzControlCircular.classList.add(`jb-pro-ptz-control-${s}`),e.emit(nt.ptz,fo(s))}));const a=()=>{r=!1,t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-show"),xi.forEach((e=>{t.$ptzBgActive.classList.remove(`jb-pro-ptz-bg-active-${e}`),t.$ptzControlCircular.classList.remove(`jb-pro-ptz-control-${e}`)})),e.emit(nt.ptz,Ri)};i(s,"mouseup",(e=>{e.stopPropagation(),r&&a()})),i(window,"mouseup",(e=>{e.stopPropagation(),r&&a()}))}})),r.ptzZoomShow)if(r.ptzClickType===K)i(t.$ptzExpand,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Li),setTimeout((()=>{e.emit(nt.ptz,Ri)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzNarrow,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Pi),setTimeout((()=>{e.emit(nt.ptz,Ri)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let n=!1,l=!1;i(t.$ptzExpand,"mousedown",(t=>{t.stopPropagation(),n=!0,e.emit(nt.ptz,Li)})),i(t.$ptzNarrow,"mousedown",(t=>{t.stopPropagation(),l=!0,e.emit(nt.ptz,Pi)}));const d=()=>{n=!1,l=!1,e.emit(nt.ptz,Ri)};i(t.$ptzExpand,"mouseup",(e=>{e.stopPropagation(),n&&d()})),i(t.$ptzNarrow,"mouseup",(e=>{e.stopPropagation(),l&&d()})),i(window,"mouseup",(e=>{e.stopPropagation(),(n||l)&&d()}))}if(r.ptzApertureShow)if(r.ptzClickType===K)i(t.$ptzApertureFar,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Bi),setTimeout((()=>{e.emit(nt.ptz,Di)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzApertureNear,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Ii),setTimeout((()=>{e.emit(nt.ptz,Di)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let h=!1,c=!1;i(t.$ptzApertureFar,"mousedown",(t=>{t.stopPropagation(),h=!0,e.emit(nt.ptz,Bi)})),i(t.$ptzApertureNear,"mousedown",(t=>{t.stopPropagation(),c=!0,e.emit(nt.ptz,Ii)}));const u=()=>{h=!1,c=!1,e.emit(nt.ptz,Di)};i(t.$ptzApertureFar,"mouseup",(e=>{e.stopPropagation(),h&&u()})),i(t.$ptzApertureNear,"mouseup",(e=>{e.stopPropagation(),c&&u()})),i(window,"mouseup",(e=>{e.stopPropagation(),(h||c)&&u()}))}if(r.ptzFocusShow)if(r.ptzClickType===K)i(t.$ptzFocusFar,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Mi),setTimeout((()=>{e.emit(nt.ptz,Di)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzFocusNear,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Ui),setTimeout((()=>{e.emit(nt.ptz,Di)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let p=!1,f=!1;i(t.$ptzFocusFar,"mousedown",(t=>{t.stopPropagation(),p=!0,e.emit(nt.ptz,Mi)})),i(t.$ptzFocusNear,"mousedown",(t=>{t.stopPropagation(),f=!0,e.emit(nt.ptz,Ui)}));const m=()=>{p=!1,f=!1,e.emit(nt.ptz,Di)};i(t.$ptzFocusFar,"mouseup",(e=>{e.stopPropagation(),p&&m()})),i(t.$ptzFocusNear,"mouseup",(e=>{e.stopPropagation(),f&&m()})),i(window,"mouseup",(e=>{e.stopPropagation(),(p||f)&&m()}))}if(r.ptzCruiseShow&&(i(t.$ptzCruisePlay,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Fi)})),i(t.$ptzCruisePause,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Oi)}))),r.ptzFogShow&&(i(t.$ptzFogOpen,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Ni)})),i(t.$ptzFogClose,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,ji)}))),r.ptzWiperShow&&(i(t.$ptzWiperOpen,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,zi)})),i(t.$ptzWiperClose,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Gi)}))),r.ptzSupportDraggable){function g(){t.isPtzControlDroging&&(t.isPtzControlDroging=!1,t.$ptzControl.style.cursor="grab",t.tempPtzPosition={x:0,y:0})}t.isPtzControlDroging=!1,t.tempPtzPosition={x:0,y:0},i(t.$ptzControl,ua()?"touchstart":"mousedown",(e=>{e.stopPropagation(),t.isPtzControlDroging=!0,t.$ptzControl.style.cursor="grabbing";const{posX:i,posY:s}=Qa(e);t.tempPtzPosition={x:i,y:s}})),i(t.$ptzControl,ua()?"touchmove":"mousemove",(e=>{if(t.isPtzControlDroging){e.stopPropagation();const{posX:i,posY:s}=Qa(e),r=t.tempPtzPosition.x-i,a=t.tempPtzPosition.y-s;t.$ptzControl.style.left=t.$ptzControl.offsetLeft-r+"px",t.$ptzControl.style.top=t.$ptzControl.offsetTop-a+"px",t.tempPtzPosition={x:i,y:s}}})),i(t.$ptzControl,ua()?"touchend":"mouseup",(e=>{e.stopPropagation(),g()})),i(window,ua()?"touchend":"mouseup",(e=>{e.stopPropagation(),g()}))}}if(a.performance&&(i(t.$performance,"click",(t=>{t.stopPropagation(),e.togglePerformancePanel(!0)})),i(t.$performanceActive,"click",(t=>{t.stopPropagation(),e.togglePerformancePanel(!1)}))),a.logSave&&i(t.$logSave,"click",(t=>{t.stopPropagation(),e.downloadMemoryLog()})),a.aiFace&&(i(t.$faceDetect,"click",(t=>{t.stopPropagation(),e.faceDetect(!0)})),i(t.$faceDetectActive,"click",(t=>{t.stopPropagation(),e.faceDetect(!1)}))),a.aiObject&&(i(t.$objectDetect,"click",(t=>{t.stopPropagation(),e.objectDetect(!0)})),i(t.$objectDetectActive,"click",(t=>{t.stopPropagation(),e.objectDetect(!1)}))),a.aiOcclusion&&(i(t.$occlusionDetect,"click",(t=>{t.stopPropagation(),e.occlusionDetect(!0)})),i(t.$occlusionDetectActive,"click",(t=>{t.stopPropagation(),e.occlusionDetect(!1)}))),e._opt.hasControl&&e._opt.controlAutoHide){i(e.$container,"mouseover",(()=>{e.fullscreen||(na(t.$controls,"display","block"),A())})),i(e.$container,"mousemove",(()=>{e.$container&&t.$controls&&(e.fullscreen,"none"===t.$controls.style.display&&(na(t.$controls,"display","block"),A()))})),i(e.$container,"mouseout",(()=>{b(),na(t.$controls,"display","none")}));let y=null;const A=()=>{b(),y=setTimeout((()=>{na(t.$controls,"display","none")}),5e3)},b=()=>{y&&(clearTimeout(y),y=null)}}if(e._opt.playType===_){let v=e._opt.playbackConfig.controlType;e._opt.playbackConfig.showRateBtn&&(i(t.$speedMenu,"mouseover",(()=>{t.$speedMenuList.classList.add("jb-pro-speed-menu-shown")})),i(t.$speedMenu,"mouseout",(()=>{t.$speedMenuList.classList.remove("jb-pro-speed-menu-shown")})),i(t.$speedMenuList,"click",(t=>{const i=qa(t);if(i.matches("div.jb-pro-speed-menu-item")){const t=i.dataset;e.emit(nt.playbackPreRateChange,t.speed)}}))),v===Q.normal?(i(t.$playbackNarrow,"click",(t=>{t.stopPropagation(),e.playback&&e.playback.narrowPrecision()})),i(t.$playbackExpand,"click",(t=>{t.stopPropagation(),e.playback&&e.playback.expandPrecision()})),i(t.$playbackTimeList,"click",(t=>{const i=qa(t);i.matches("div.jb-pro-playback-time-minute-one")&&e.playback&&e.playback.seek(i.dataset)})),e._opt.playbackConfig.supportWheel&&i(t.$playbackTimeInner,"wheel",(t=>{t.preventDefault(),(t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3)>0?e.playback&&e.playback.expandPrecision():e.playback&&e.playback.narrowPrecision()}))):v===Q.simple&&(t.isDroging=!1,i(t.$playbackProgress,"click",(i=>{if(i.target!==t.$playbackProgressIndicator){let s=0,r=0;if(e.isInWebFullscreen())s=i.touches[0].clientY/e.height,r=s*e.playback.totalDuration;else{const a=kh(t,e.playback.totalDuration,i);s=a.percentage,r=a.second}e.playback&&e.playback.seek({time:r})}})),i(t.$playbackProgress,"mousemove",(i=>{na(t.$playbackProgressTip,"display","block");const{width:s,time:r}=kh(t,e.playback.totalDuration,i);t.$playbackProgressTip.innerHTML=r;const a=t.$playbackProgressTip.clientWidth;s<=a/2?na(t.$playbackProgressTip,"left",0):s>t.$playbackProgress.clientWidth-a/2?na(t.$playbackProgressTip,"left",t.$playbackProgress-a+"px"):na(t.$playbackProgressTip,"left",s-a/2+"px")})),i(t.$playbackProgress,"mouseout",(()=>{na(t.$playbackProgressTip,"display","none")})),i(t.$playbackProgressIndicator,"mousedown",(e=>{t.isDroging=!0})),i(t.$playbackProgress,"mousemove",(i=>{if(t.isDroging){const{second:s,percentage:r}=kh(t,e.playback.totalDuration,i);e.playback&&e.playback.seek({time:s})}})),i(t.$playbackProgress,"mouseup",(e=>{t.isDroging&&(t.isDroging=!1)})))}a.quality&&(i(t.$qualityMenu,"mouseover",(()=>{t.$qualityMenuList.classList.add("jb-pro-quality-menu-shown")})),i(t.$qualityMenu,"mouseout",(()=>{t.$qualityMenuList.classList.remove("jb-pro-quality-menu-shown")})),i(t.$qualityMenuList,"click",(t=>{const i=qa(t);if(i.matches("div.jb-pro-quality-menu-item")){const t=i.dataset;e.streamQuality=t.quality}}))),a.scale&&(i(t.$scaleMenu,"mouseover",(()=>{t.$scaleMenuList.classList.add("jb-pro-scale-menu-shown")})),i(t.$scaleMenu,"mouseout",(()=>{t.$scaleMenuList.classList.remove("jb-pro-scale-menu-shown")})),i(t.$scaleMenuList,"click",(t=>{const i=qa(t);if(i.matches("div.jb-pro-scale-menu-item")){const t=i.dataset;e.setScaleMode(t.scale)}}))),a.zoom&&(i(t.$zoom,"click",(t=>{t.stopPropagation(),e.zooming=!0})),i(t.$zoomStop,"click",(t=>{t.stopPropagation(),e.zooming=!1}))),i(t.$zoomExpand,"click",(t=>{t.stopPropagation(),e.zoom&&e.zoom.expandPrecision()})),i(t.$zoomNarrow,"click",(t=>{t.stopPropagation(),e.zoom&&e.zoom.narrowPrecision()})),i(t.$zoomStop2,"click",(t=>{t.stopPropagation(),e.zooming=!1})),a.close&&i(t.$close,"click",(t=>{t.stopPropagation(),e.doDestroy()})),i(t.$tipsMessageClose,"click",(e=>{e.stopPropagation(),t.$tipsMessageContent.innerHTML="",na(t.$tipsMessage,"display","none")}))})(e,this),e._opt.hotKey&&((e,t)=>{const{events:{proxy:i}}=e,s={};function r(e,t){s[e]?s[e].push(t):s[e]=[t]}r(bi,(()=>{e.fullscreen&&(e.fullscreen=!1)})),r(vi,(()=>{e.volume+=.05})),r(_i,(()=>{e.volume-=.05})),i(window,"keydown",(e=>{if(t.isFocus){const t=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==t&&"TEXTAREA"!==t&&""!==i&&"true"!==i){const t=s[e.keyCode];t&&(e.preventDefault(),t.forEach((e=>e())))}}}))})(e,this),this.btnIndex=0,this.initLoadingBackground(),Va(e._opt.loadingIconStyle)&&this.initLoadingIconStyle(e._opt.loadingIconStyle),Va(e._opt.ptzPositionConfig)&&this.updatePtzPosition(e._opt.ptzPositionConfig),this.kbpsShow="0 KB/s",this.player.debug.log("Control","init")}destroy(){if(this.$performancePanel){this.$performancePanel.innerHTML="";if(!Lh(this.$performancePanel)){const e=this.player.$container.querySelector(".jb-pro-performance-panel");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$poster){if(!Lh(this.$poster)){const e=this.player.$container.querySelector(".jb-pro-poster");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$loading){if(!Lh(this.$loading)){const e=this.player.$container.querySelector(".jb-pro-loading");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$loadingBg){if(!Lh(this.$loadingBg)){const e=this.player.$container.querySelector(".jb-pro-loading-bg");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$controls){if(!Lh(this.$controls)){const e=this.player.$container.querySelector(".jb-pro-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$playBig){if(!Lh(this.$playBig)){const e=this.player.$container.querySelector(".jb-pro-play-big");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$recording){if(!Lh(this.$recording)){const e=this.player.$container.querySelector(".jb-pro-recording");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$ptzControl){if(!Lh(this.$ptzControl)){const e=this.player.$container.querySelector(".jb-pro-ptz-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$zoomControls){if(!Lh(this.$zoomControls)){const e=this.player.$container.querySelector(".jb-pro-zoom-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$contextmenus){this.$contextmenus.innerHTML="";if(!Lh(this.$contextmenus)){const e=this.player.$container.querySelector(".jb-pro-contextmenus");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$tipsMessage){if(!Lh(this.$tipsMessage)){const e=this.player.$container.querySelector(".jb-pro-tips-message");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$extendDom){if(!Lh(this.$extendDom)){const e=this.player.$container.querySelector(".jb-pro-extend-dom");e&&this.player.$container&&this.player.$container.removeChild(e)}}this.btnIndex=0,this.extendBtnList=[],this.kbpsShow="0 KB/s",this.player.$container&&(this.player.$container.classList.remove("jb-pro-controls-show-auto-hide"),this.player.$container.classList.remove("jb-pro-controls-show")),this.player.debug.log("Control","destroy")}getBtnIndex(){return this.btnIndex++}autoSize(){const e=this.player;e.$container.style.padding="0 0";const t=e.width,i=e.height,s=t/i,r=e.video.$videoElement.width/e.video.$videoElement.height;if(s>r){const s=(t-i*r)/2;e.$container.style.padding=`0 ${s}px`}else{const s=(i-t/r)/2;e.$container.style.padding=`${s}px 0`}}initLoadingBackground(){const e=this.player;e._opt.loadingBackground&&e._opt.loadingBackgroundWidth&&e._opt.loadingBackgroundHeight&&(e.debug.log("Control","initLoadingBackground()"),"default"===this.player._opt.aspectRatio||ua()?(e.getRenderType()===$||e.getRenderType()===W)&&this._initLoadingBackground():this._initLoadingBackgroundForRatio(),Rh(this.$loadingBg,"display","block"),e._opt.loadingBackground="",e._opt.loadingBackgroundWidth=0,e._opt.loadingBackgroundHeight=0)}initLoadingIconStyle(e){const t=this.player.$container.querySelector(".jb-pro-icon-loading");t&&(e.width&&Rh(t,"width",`${e.width}px`),e.height&&Rh(t,"height",`${e.height}px`),e.background&&Rh(t,"backgroundImage",`url("${e.background}")`),!1===e.hasAnimation&&(Rh(t,"animationName","none"),Rh(t,"animationDuration",0),Rh(t,"animationTimingFunction","ease"),Rh(t,"animationIterationCount",1)))}_initLoadingBackgroundForRatio(){const e=this.player._opt.aspectRatio.split(":").map(Number);let t=this.player.width,i=this.player.height;const s=this.player._opt;let r=0;s.hasControl&&!s.controlAutoHide&&(r=s.playType===_?Yt:Kt,i-=r);const a=this.player._opt.loadingBackgroundWidth,o=this.player._opt.loadingBackgroundHeight,n=a/o,l=e[0]/e[1];if(this.$loadingBgImage.src=this.player._opt.loadingBackground,n>l){const e=l*o/a;this.$loadingBgImage.style.width=100*e+"%",this.$loadingBgImage.style.height=`calc(100% - ${r}px)`,this.$loadingBgImage.style.padding=`0 ${(t-t*e)/2}px`}else{const e=a/l/o;this.$loadingBgImage.style.width="100%",this.$loadingBgImage.style.height=`calc(${100*e}% - ${r}px)`,this.$loadingBgImage.style.padding=(i-i*e)/2+"px 0"}}_initLoadingBackground(){const e=this.player;let t=e.height;const i=e._opt;if(i.hasControl&&!i.controlAutoHide){t-=i.playType===_?Yt:Kt}let s=e.width,r=t;const a=i.rotate;270!==a&&90!==a||(s=t,r=e.width),this.$loadingBgImage.width=s,this.$loadingBgImage.height=r,this.$loadingBgImage.src=e._opt.loadingBackground;let o=(e.width-s)/2,n=(t-r)/2,l="contain";i.isResize||(l="fill"),i.isFullResize&&(l="none");let d="";"none"===i.mirrorRotate&&a&&(d+=" rotate("+a+"deg)"),"level"===i.mirrorRotate?d+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(d+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$loadingBgImage.style.objectFit=l),this.$loadingBgImage.style.transform=d,this.$loadingBgImage.style.padding="0",this.$loadingBgImage.style.left=o+"px",this.$loadingBgImage.style.top=n+"px"}_validateExtendBtn(e){let t=!0;if(e.name||(this.player.debug.warn("Control","extend button name is required"),t=!1),t){-1!==this.extendBtnList.findIndex((t=>t.name===e.name))&&(this.player.debug.warn("Control",`extend button name: ${e.name} is already exist`),t=!1)}return t&&(e.icon||(this.player.debug.warn("Control","extend button icon is required"),t=!1)),t}addExtendBtn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=no(Os);if(e=Object.assign({},t,e),!this._validateExtendBtn(e))return;const i=e.name||"",s=this.$controlsRight,r=e.activeIcon&&e.activeClick,a=`\n
\n ${e.icon?`
\n \n ${e.iconTitle?`\n ${e.iconTitle}\n `:""}\n
`:""}\n ${e.activeIcon?`
\n \n ${e.activeIconTitle?`\n ${e.activeIconTitle}\n `:""}\n
`:""}\n
\n `,o=Array.from(s.children)[e.index];o?o.insertAdjacentHTML("beforebegin",a):xh(s,a);const n=s.querySelector(`.jb-pro-controls-item-wrap-${i}`),l=e.icon?s.querySelector(`.jb-pro-icon-extend-${i}`):null,d=e.icon?s.querySelector(`.jb-pro-control-extend-${i}`):null,h=e.activeIcon?s.querySelector(`.jb-pro-icon-extend-${i}-active`):null,c=e.activeIcon?s.querySelector(`.jb-pro-control-extend-${i}-active`):null,{events:{proxy:u},debug:p}=this.player;e.icon&&(Rh(l,"background",`url(${e.icon}) no-repeat center`),Rh(l,"background-size","100% 100%"),Rh(d,"display","none"),e.iconHover&&(u(l,"mouseover",(()=>{Rh(l,"background",`url(${e.iconHover}) no-repeat center`),Rh(l,"background-size","100% 100%")})),u(l,"mouseout",(()=>{Rh(l,"background",`url(${e.icon}) no-repeat center`),Rh(l,"background-size","100% 100%")})))),e.activeIcon&&(Rh(h,"background",`url(${e.activeIcon}) no-repeat center`),Rh(h,"background-size","100% 100%"),Rh(c,"display","none"),e.activeIconHover&&(u(h,"mouseover",(()=>{Rh(h,"background",`url(${e.activeIconHover}) no-repeat center`),Rh(h,"background-size","100% 100%")})),u(h,"mouseout",(()=>{Rh(h,"background",`url(${e.activeIcon}) no-repeat center`),Rh(h,"background-size","100% 100%")})))),e.click&&l&&u(l,"click",(t=>{t.preventDefault(),r&&(Rh(d,"display","none"),Rh(c,"display","flex")),this.player.isInMulti()?e.click.call(this.player,t,this.player._opt.multiIndex):e.click.call(this.player,t)})),e.activeClick&&h&&u(h,"click",(t=>{t.preventDefault(),Rh(d,"display","flex"),Rh(c,"display","none"),this.player.isInMulti()?e.activeClick.call(this.player,t,this.player._opt.multiIndex):e.activeClick.call(this.player,t)})),this.extendBtnList.push({name:i,$iconContainer:n,$iconWrap:d,$activeIconWrap:c})}addExtendDom(e){if(this.player.debug.log(this.TAG_NAME,"addExtendDom"),e.html){const t=`\n
\n ${e.html}\n
\n `;this.player.$container.insertAdjacentHTML("beforeend",t),Object.defineProperty(this,"$extendDom",{value:this.player.$container.querySelector(".jb-pro-extend-dom")}),e.showBeforePlay&&Rh(this.$extendDom,"display","block")}}toggleExtendDom(e){this.$extendDom&&(Pa(e)||(e="none"===this.$extendDom.style.display),Rh(this.$extendDom,"display",e?"block":"none"))}updateExtendDom(e){this.player.debug.log(this.TAG_NAME,"updateExtendDom"),this.$extendDom&&(this.$extendDom.innerHTML=e)}removeExtendDom(){this.player.debug.log(this.TAG_NAME,"removeExtendDom"),this.$extendDom&&(this.$extendDom.innerHTML="")}updateLoadingText(e){this.$loadingText&&(this.$loadingText.innerText=e)}getExtendBtnList(){return this.extendBtnList}showTipsMessage(e,t){const i=this.$tipsMessage,s=this.$tipsMessageContent;if(i){const r=`\n
${e}
\n ${t?`
Error Type:${t}
`:""}\n `;s.innerHTML=r,Rh(i,"display","block")}}hideTipsMessage(){const e=this.$tipsMessage;e&&($tipsMessageContent.innerHTML="",Rh(e,"display","none"))}updatePtzPosition(e){const t=this.$ptzControl;if(Va(e)&&t){let i="auto";e.left&&(i=Number(e.left)===e.left?e.left+"px":e.left),Rh(t,"left",i);let s="auto";e.top&&(s=Number(e.top)===e.top?e.top+"px":e.top),Rh(t,"top",s);let r="auto";e.bottom&&(r=Number(e.bottom)===e.bottom?e.bottom+"px":e.bottom),Rh(t,"bottom",r);let a="auto";e.right&&(a=Number(e.right)===e.right?e.right+"px":e.right),Rh(t,"right",a)}}}Bh(".jb-pro-container{position:relative;width:100%;height:100%;overflow:hidden}.jb-pro-container.jb-pro-fullscreen-web{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;width:100vw!important;height:100vh!important;background:#000}.jb-pro-container .jb-pro-loading-bg-for-ios{position:absolute;z-index:100;left:0;top:0;right:0;bottom:0;height:100%;width:100%;opacity:0;visibility:hidden;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jb-pro-container .jb-pro-loading-bg-for-ios.show{opacity:1;visibility:visible}");var Mh=e=>{const{_opt:t,debug:i,events:{proxy:s}}=e;if(t.supportDblclickFullscreen&&s(e.$container,"dblclick",(t=>{const i=qa(t).nodeName.toLowerCase();"canvas"!==i&&"video"!==i||(e.fullscreen=!e.fullscreen)})),s(document,"visibilitychange",(()=>{e.visibility="visible"===document.visibilityState,i.log("visibilitychange",document.visibilityState),t.hiddenAutoPause&&(i.log("visibilitychange","hiddenAutoPause is true ",document.visibilityState,e._isPlayingBeforePageHidden),"visible"===document.visibilityState?e._isPlayingBeforePageHidden&&e.play():(e._isPlayingBeforePageHidden=e.playing,e.playing&&e.pause()))})),pa()&&s(document,["click","contextmenu"],(t=>{Dh(t,e.$container)?(uo(e._opt.disableContextmenu)&&"contextmenu"===t.type&&t.preventDefault(),e.isInput="INPUT"===t.target.tagName,e.isFocus=!0,e.emit(nt.focus)):(e.isInput=!1,e.isFocus=!1,e.emit(nt.blur))})),t.isCheckInView){const t=wa((()=>{e.emit(nt.inView,function(e){const t=e.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth,r=t.top<=i&&t.top+t.height>=0,a=t.left<=s&&t.left+t.width>=0;return r&&a}(e.$container))}),200);s(window,"scroll",(()=>t()))}if(t.autoResize){const t=wa((()=>{e.resize()}),500);s(window,["resize","orientationchange"],(()=>{t()})),screen&&screen.orientation&&screen.orientation.onchange&&s(screen.orientation,"change",(()=>{t()}))}};class Uh{static init(){Uh.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in Uh.types)Uh.types.hasOwnProperty(e)&&(Uh.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=Uh.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=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]),e.HDLR_AUDIO=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]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,s=Array.prototype.slice.call(arguments,1),r=s.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let a=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,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]))}static trak(e){return Uh.box(Uh.types.trak,Uh.tkhd(e),Uh.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,s=e.presentWidth,r=e.presentHeight;return Uh.box(Uh.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,r>>>8&255,255&r,0,0]))}static mdia(e){return Uh.box(Uh.types.mdia,Uh.mdhd(e),Uh.hdlr(e),Uh.minf(e))}static mdhd(e){let t=e.timescale,i=e.duration;return Uh.box(Uh.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?Uh.constants.HDLR_AUDIO:Uh.constants.HDLR_VIDEO,Uh.box(Uh.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?Uh.box(Uh.types.smhd,Uh.constants.SMHD):Uh.box(Uh.types.vmhd,Uh.constants.VMHD),Uh.box(Uh.types.minf,t,Uh.dinf(),Uh.stbl(e))}static dinf(){return Uh.box(Uh.types.dinf,Uh.box(Uh.types.dref,Uh.constants.DREF))}static stbl(e){return Uh.box(Uh.types.stbl,Uh.stsd(e),Uh.box(Uh.types.stts,Uh.constants.STTS),Uh.box(Uh.types.stsc,Uh.constants.STSC),Uh.box(Uh.types.stsz,Uh.constants.STSZ),Uh.box(Uh.types.stco,Uh.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?Uh.box(Uh.types.stsd,Uh.constants.STSD_PREFIX,Uh.mp3(e)):Uh.box(Uh.types.stsd,Uh.constants.STSD_PREFIX,Uh.mp4a(e)):"avc"===e.videoType?Uh.box(Uh.types.stsd,Uh.constants.STSD_PREFIX,Uh.avc1(e)):Uh.box(Uh.types.stsd,Uh.constants.STSD_PREFIX,Uh.hvc1(e))}static mp3(e){let t=e.channelCount,i=e.audioSampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return Uh.box(Uh.types[".mp3"],s)}static mp4a(e){let t=e.channelCount,i=e.audioSampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return Uh.box(Uh.types.mp4a,s,Uh.esds(e))}static esds(e){let t=e.config||[],i=t.length,s=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return Uh.box(Uh.types.esds,s)}static avc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=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,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return Uh.box(Uh.types.avc1,r,Uh.box(Uh.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=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,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return Uh.box(Uh.types.hvc1,r,Uh.box(Uh.types.hvcC,t))}static mvex(e){return Uh.box(Uh.types.mvex,Uh.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return Uh.box(Uh.types.trex,i)}static moof(e,t){return Uh.box(Uh.types.moof,Uh.mfhd(e.sequenceNumber),Uh.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return Uh.box(Uh.types.mfhd,t)}static traf(e,t){let i=e.id,s=Uh.box(Uh.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),r=Uh.box(Uh.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),a=Uh.sdtp(e),o=Uh.trun(e,a.byteLength+16+16+8+16+8+8);return Uh.box(Uh.types.traf,s,r,o,a)}static sdtp(e){let t=new Uint8Array(5),i=e.flags;return t[4]=i.isLeading<<6|i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy,Uh.box(Uh.types.sdtp,t)}static trun(e,t){let i=new Uint8Array(28);t+=36,i.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let s=e.duration,r=e.size,a=e.flags,o=e.cts;return i.set([s>>>24&255,s>>>16&255,s>>>8&255,255&s,r>>>24&255,r>>>16&255,r>>>8&255,255&r,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.isNonSync,0,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o],12),Uh.box(Uh.types.trun,i)}static mdat(e){return Uh.box(Uh.types.mdat,e)}}Uh.init();const Fh=[44100,48e3,32e3,0],Oh=[22050,24e3,16e3,0],Nh=[11025,12e3,8e3,0],jh=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],zh=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],Gh=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];class Hh extends So{constructor(e){super(),this.TAG_NAME="MediaSource",this.player=e,this._resetInIt(),this._useManagedMediaSource="ManagedMediaSource"in self&&!("MediaSource"in self),this.mediaSource=this._useManagedMediaSource?new self.ManagedMediaSource:new self.MediaSource,this.isDecodeFirstIIframe=!!po(e._opt.checkFirstIFrame),this.mediaSourceObjectURL=null,this._useManagedMediaSource||(this.mediaSourceObjectURL=window.URL.createObjectURL(this.mediaSource)),this.isSupportVideoFrameCallback=bo(),this.canvasRenderInterval=null,e._opt.mseUseCanvasRender?(this.$videoElement=document.createElement("video"),this._useManagedMediaSource?(this.$videoElement.disableRemotePlayback=!0,this.$videoElement.srcObject=this.mediaSource):this.$videoElement.src=this.mediaSourceObjectURL,this.initVideoEvents()):(this._useManagedMediaSource?(this.player.video.$videoElement.disableRemotePlayback=!0,this.player.video.$videoElement.srcObject=this.mediaSource):this.player.video.$videoElement.src=this.mediaSourceObjectURL,this.$videoElement=this.player.video.$videoElement),this._bindMediaSourceEvents(),this.audioSourceBufferCheckTimeout=null,this.audioSourceNoDataCheckTimeout=null,this.hasPendingEos=!1,this.player.isPlayback()&&this.player.on(nt.playbackPause,(t=>{po(t)?(uo(e._opt.checkFirstIFrame)&&(this.player.debug.log(this.TAG_NAME,"playbackPause is false and _opt.checkFirstIFrame is true so set isDecodeFirstIIframe = false"),this.isDecodeFirstIIframe=!1),this.clearUpAllSourceBuffer(),this.$videoElement.play()):(this.$videoElement.pause(),this.cacheTrack={})})),this._useManagedMediaSource?this.player.debug.log(this.TAG_NAME,"init and using ManagedMediaSource"):this.player.debug.log(this.TAG_NAME,"init")}destroy(){this.stop(),this._clearAudioSourceBufferCheckTimeout(),this._clearAudioNoDataCheckTimeout(),this._stopCanvasRender(),this.eventListenList.length&&(this.eventListenList.forEach((e=>e())),this.eventListenList=[]),this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.$videoElement&&(this.player._opt.mseUseCanvasRender&&this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$videoElement=null),this.mediaSourceObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceObjectURL),this.mediaSourceObjectURL=null),this._resetInIt(),this.mediaSource=null,this.off(),this.player.debug.log(this.TAG_NAME,"destroy")}needInitAudio(){return this.player._opt.hasAudio&&this.player._opt.mseDecodeAudio}_resetInIt(){this.isAvc=null,this.isAAC=null,this.videoMeta={},this.audioMeta={},this.sourceBuffer=null,this.audioSourceBuffer=null,this.hasInit=!1,this.hasAudioInit=!1,this.isInitInfo=!1,this.isAudioInitInfo=!1,this.audioMimeType="",this.videoMimeType="",this.cacheTrack={},this.cacheAudioTrack={},this.sequenceNumber=0,this.audioSequenceNumber=0,this.firstRenderTime=null,this.firstAudioTime=null,this.$videoElement=null,this.mediaSourceAppendBufferFull=!1,this.mediaSourceAppendBufferError=!1,this.mediaSourceAddSourceBufferError=!1,this.mediaSourceBufferError=!1,this.mediaSourceError=!1,this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.prevAudioDts=null,this.prevPayloadBufferSize=0,this.isWidthOrHeightChanged=!1,this.prevTs=null,this.prevAudioTs=null,this.eventListenList=[],this.pendingRemoveRanges=[],this.pendingSegments=[],this.pendingAudioRemoveRanges=[],this.pendingAudioSegments=[],this.supportVideoFrameCallbackHandle=null}get state(){return this.mediaSource&&this.mediaSource.readyState}get isStateOpen(){return this.state===yi}get isStateClosed(){return this.state===Ai}get isStateEnded(){return this.state===gi}get duration(){return this.mediaSource&&this.mediaSource.duration||-1}set duration(e){this.mediaSource.duration=e}_bindMediaSourceEvents(){const{debug:e,events:{proxy:t}}=this.player,i=t(this.mediaSource,Ki,(()=>{this.player.debug.log(this.TAG_NAME,"sourceOpen"),this._onMediaSourceSourceOpen(),this.player.emit(nt.mseSourceOpen)})),s=t(this.mediaSource,qi,(()=>{this.player.debug.log(this.TAG_NAME,"sourceClose"),this.player.emit(nt.mseSourceClose)})),r=t(this.mediaSource,Yi,(()=>{this.player.debug.log(this.TAG_NAME,"sourceended"),this.player.emit(nt.mseSourceended)}));this.eventListenList.push(i,s,r);const a=t(this.$videoElement,is,(e=>{if(po(this.isSupportVideoFrameCallback))if(this.player.checkIsInRender())this.player.handleRender();else{const t=parseInt(e.timeStamp,10);this.player.debug.log(this.TAG_NAME,`mseUseCanvasRender is ${this.player._opt.mseUseCanvasRender} and\n $videoElement ts is ${t}, but not in render and vbps is ${this.player._stats.vbps} and fps is ${this.player._stats.fps}`)}}));if(this.eventListenList.push(a),this._useManagedMediaSource){const e=t(this.mediaSource,Qi,(()=>{this.player.debug.log(this.TAG_NAME,"ManagedMediaSource startstreaming"),this.player.emit(nt.mseSourceStartStreaming)})),i=t(this.mediaSource,Xi,(()=>{this.player.debug.log(this.TAG_NAME,"ManagedMediaSource endstreaming"),this.player.emit(nt.mseSourceEndStreaming)})),s=t(this.mediaSource,Zi,(()=>{this.player.debug.log(this.TAG_NAME,"ManagedMediaSource qualitychange")}));this.eventListenList.push(e,i,s)}}_onMediaSourceSourceOpen(){this.sourceBuffer||(this.player.debug.log("MediaSource","onMediaSourceSourceOpen() sourceBuffer is null and next init"),this._initSourceBuffer()),this.audioSourceBuffer||(this.player.debug.log("MediaSource","onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),this._initAudioSourceBuffer()),this._hasPendingSegments()&&this._doAppendSegments()}initVideoEvents(){const{proxy:e}=this.player.events;this.player.on(nt.visibilityChange,(e=>{e&&setTimeout((()=>{if(this.player.isPlaying()&&this.$videoElement){const e=this.getVideoBufferLastTime();e-this.$videoElement.currentTime>this.getMseBufferMaxDelayTime()&&(this.player.debug.log(this.TAG_NAME,`visibilityChange is true and lastTime is ${e} and currentTime is ${this.$videoElement.currentTime} so set currentTime to lastTime`),this.$videoElement.currentTime=e)}}),300)}));const t=e(this.$videoElement,es,(()=>{this.player.debug.log(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.emit(nt.removeLoadingBgImage),bo()?this.supportVideoFrameCallbackHandle||(this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))):this.player.isUseHls265()&&(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:parseInt(1e3*this.$videoElement.currentTime,10)||0})}),40)),this.player.debug.log(this.TAG_NAME,"video play")})).catch((e=>{this.player.debug.error(this.TAG_NAME,"video play error ",e),this.player.emitError(ct.mediaSourceUseCanvasRenderPlayFailed,e)}))})),i=e(this.$videoElement,ts,(()=>{this.player.debug.log(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,is,(e=>{parseInt(e.timeStamp,10),this.$videoElement.paused&&(this.player.debug.warn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debug.log(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debug.warn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,ss,(()=>{this.player.debug.log(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate),this.$videoElement&&this.$videoElement.paused&&this.player.debug.warn(this.TAG_NAME,"ratechange and video is paused")}));this.eventListenList.push(t,i,s,r)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debug.log(this.TAG_NAME,"videoFrameCallback() player is destroyed");const i=parseInt(1e3*Math.max(t.mediaTime,this.$videoElement.currentTime),10)||0;this.player.handleRender(),this.player.video.render({$video:this.$videoElement,ts:i}),this.player.isUseHls265()&&this.player.updateStats({fps:!0,ts:i}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}decodeVideo(e,t,i,s){const r=this.player;if(r)if(this.player.isDestroyedOrClosed())this.player.debug.warn(this.TAG_NAME,"decodeVideo() player is destroyed");else if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(i&&0===e[1]){const t=15&e[0];let i={};if(t===vt){i=En(e.slice(5))}else t===_t&&(i=Un(e));const s=this.player.video.videoInfo;s&&s.width&&s.height&&i&&i.codecWidth&&i.codecHeight&&(i.codecWidth!==s.width||i.codecHeight!==s.height)&&(this.player.debug.warn(this.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${s.width}, old height is ${s.height},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),this.isWidthOrHeightChanged=!0,this.player.emitError(ct.mseWidthOrHeightChange))}if(this.isWidthOrHeightChanged)return void this.player.debug.warn(this.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(co(e))return void this.player.debug.warn(this.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength<12)return void this.player.debug.warn(this.TAG_NAME,`decodeVideo and payload is too small , payload length is ${e.byteLength}`);let r=t;if(this.player.isPlayer()){if(null===this.firstRenderTime&&(this.firstRenderTime=t),r=t-this.firstRenderTime,r<0&&(this.player.debug.warn(this.TAG_NAME,`decodeVideo\n local dts is < 0 , ts is ${t} and prevTs is ${this.prevTs},\n firstRenderTime is ${this.firstRenderTime} and mseCorrectTimeDuration is ${this.player._opt.mseCorrectTimeDuration}`),r=null===this.prevDts?0:this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t)))return this.player.debug.warn(this.TAG_NAME,`decodeVideo is max diff , ts is ${t} and prevTs is ${this.prevTs}, diff is ${this.prevTs-t} and emit replay`),void this.player.emitError(ct.mediaSourceTsIsMaxDiff,`decodeVideo is max diff, prevTs is ${this.prevTs} and ts is ${t}`);if(null!==this.prevDts&&r<=this.prevDts){if(this.player.debug.warn(this.TAG_NAME,`\n decodeVideo dts is less than(or equal) prev dts ,\n dts is ${r} and prev dts is ${this.prevDts} ,\n and now ts is ${t} and prev ts is ${this.prevTs} ,\n and diff is ${t-this.prevTs} and firstRenderTime is ${this.firstRenderTime} and isIframe is ${i},\n and mseCorrectTimeDuration is ${this.player._opt.mseCorrectTimeDuration},\n and prevPayloadBufferSize is ${this.prevPayloadBufferSize} and payload size is ${e.byteLength}`),r===this.prevDts&&this.prevPayloadBufferSize===e.byteLength)return void this.player.debug.warn(this.TAG_NAME,"decodeVideo dts is equal to prev dts and payload size is equal to prev payload size so drop this frame");if(r=this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t))return this.player.debug.warn(this.TAG_NAME,`decodeVideo is max diff , ts is ${t} and prevTs is ${this.prevTs}, diff is ${this.prevTs-t} and emit replay`),void this.emit(ct.mediaSourceTsIsMaxDiff,`decodeVideo is max diff, prevTs is ${this.prevTs} and ts is ${t}`)}}this.player.isPlayer()?this._decodeVideo(e,r,i,s,t):this.player.isPlayback()&&po(this.player.playbackPause)&&(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this._decodeVideo(e,r,i,s,t)),this.prevDts=r,this.prevPayloadBufferSize=e.byteLength,this.prevTs=t}else this.player.debug.log(this.TAG_NAME,"decodeVideo first frame is not iFrame");else if(i&&e[1]===vs){const s=15&e[0];if(r.video.updateVideoInfo({encTypeCode:s}),s===_t&&po(ka()))return void this.player.emitError(ct.mediaSourceH265NotSupport);r._times.decodeStart||(r._times.decodeStart=aa()),this.hasInit=this._decodeConfigurationRecord(e,t,i,s)}else this.player.debug.warn(this.TAG_NAME,`decodeVideo has not init , isIframe is ${i} , payload is ${e[1]}`)}decodeAudio(e,t){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debug.warn(this.TAG_NAME,"decodeAudio() player is destroyed");else if(po(this.hasAudioInit))this.hasAudioInit=this._decodeAudioConfigurationRecord(e,t);else{let i=t;if(zr(e))return void this.player.debug.log(this.TAG_NAME,"decodeAudio and has already initialized and payload is aac codec packet so drop this frame");if(this._clearAudioNoDataCheckTimeout(),this.isDecodeFirstIIframe){if(this.player.isPlayer()){if(null===this.firstAudioTime&&(this.firstAudioTime=t,null!==this.firstRenderTime&&null!==this.prevTs)){const e=Math.abs(this.firstRenderTime-this.prevTs);e>300&&(this.firstAudioTime-=e,this.player.debug.warn(this.TAG_NAME,`video\n firstAudioTime is ${this.firstRenderTime} and current time is ${this.prevTs}\n play time is ${e} and firstAudioTime ${t} - ${e} = ${this.firstAudioTime}`))}if(i=t-this.firstAudioTime,i<0&&(this.player.debug.warn(this.TAG_NAME,`decodeAudio\n local dts is < 0 , ts is ${t} and prevTs is ${this.prevAudioTs},\n firstAudioTime is ${this.firstAudioTime}`),i=null===this.prevAudioDts?0:this.prevAudioDts+this.player._opt.mseCorrectAudioTimeDuration,this._checkAudioTsIsMaxDiff(t)))return this.player.debug.warn(this.TAG_NAME,`decodeAudio is max diff , ts is ${t} and prevTs is ${this.prevAudioDts}, diff is ${this.prevAudioDts-t} and emit replay`),void this.player.emitError(ct.mediaSourceTsIsMaxDiff,`decodeAudio is max diff, prevTs is ${this.prevAudioDts} and ts is ${t}`);null!==this.prevAudioTs&&i<=this.prevAudioDts&&(this.player.debug.warn(this.TAG_NAME,`\n decodeAudio dts is less than(or equal) prev dts ,\n dts is ${i} and prev dts is ${this.prevAudioDts} ,\n and now ts is ${t} and prev ts is ${this.prevAudioTs} ,\n and diff is ${t-this.prevAudioTs}`),i=this.prevAudioDts+this.player._opt.mseCorrectAudioTimeDuration)}(this.player.isPlayer()||this.player.isPlayback()&&po(this.player.playbackPause))&&this._decodeAudio(e,i,t),this.prevAudioTs=t,this.prevAudioDts=i}else this.player.debug.log(this.TAG_NAME,"decodeAudio first frame is not iFrame")}}_checkTsIsMaxDiff(e){return this.prevTs>0&&eX}_checkAudioTsIsMaxDiff(e){return this.prevAudioTs>0&&eX}_decodeConfigurationRecord(e,t,i,s){let r=e.slice(5),a={};if(s===vt?a=En(r):s===_t&&(a=Fn(r)),Ha(a)||0===a.codecWidth&&0===a.codecHeight)return this.player.debug.warn(this.TAG_NAME,"_decodeConfigurationRecord",a),this.player.emitError(ct.mediaSourceDecoderConfigurationError),!1;this.player.recorder&&this.player._opt.recordType===S&&this.player.recorder.initMetaData(e,s);const o={id:mr,type:"video",timescale:1e3,duration:0,avcc:r,codecWidth:a.codecWidth,codecHeight:a.codecHeight,videoType:a.videoType},n=Uh.generateInitSegment(o);this.isAvc=s===vt;let l=a.codec;return this.videoMimeType=l?`video/mp4; codecs="${a.codec}"`:this.isAvc?hi:ci,this._initSourceBuffer(),this.appendBuffer(n.buffer),this.sequenceNumber=0,this.cacheTrack={},!0}_decodeAudioConfigurationRecord(e,t){const i=e[0]>>4,s=i===Tt,r=i===Et;if(po(r||s))return this.player.debug.warn(this.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${i} ant auto wasm decode`),this.player.emit(ct.mediaSourceAudioG711NotSupport),!1;const a={id:gr,type:"audio",timescale:1e3};let o={};if(zr(e)){if(o=function(e){let t=new Uint8Array(e),i=null,s=0,r=0,a=0,o=null;if(s=r=t[0]>>>3,a=(7&t[0])<<1|t[1]>>>7,a<0||a>=$r.length)return void console.error("Flv: AAC invalid sampling frequency index!");let n=$r[a],l=(120&t[1])>>>3;if(l<0||l>=8)return void console.log("Flv: AAC invalid channel configuration");5===s&&(o=(7&t[1])<<1|t[2]>>>7,t[2]);let d=self.navigator.userAgent.toLowerCase();return-1!==d.indexOf("firefox")?a>=6?(s=5,i=new Array(4),o=a-3):(s=2,i=new Array(2),o=a):-1!==d.indexOf("android")?(s=2,i=new Array(2),o=a):(s=5,o=a,i=new Array(4),a>=6?o=a-3:1===l&&(s=2,i=new Array(2),o=a)),i[0]=s<<3,i[0]|=(15&a)>>>1,i[1]=(15&a)<<7,i[1]|=(15&l)<<3,5===s&&(i[1]|=(15&o)>>>1,i[2]=(1&o)<<7,i[2]|=8,i[3]=0),{audioType:"aac",config:i,sampleRate:n,channelCount:l,objectType:s,codec:"mp4a.40."+s,originalCodec:"mp4a.40."+r}}(e.slice(2)),!o)return!1;a.audioSampleRate=o.sampleRate,a.channelCount=o.channelCount,a.config=o.config,a.refSampleDuration=1024/a.audioSampleRate*a.timescale}else{if(!s)return!1;if(o=function(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),i=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let s=t[1]>>>3&3,r=(6&t[1])>>1,a=(240&t[2])>>>4,o=(12&t[2])>>>2,n=3!=(t[3]>>>6&3)?2:1,l=0,d=0;switch(s){case 0:l=Nh[o];break;case 2:l=Oh[o];break;case 3:l=Fh[o]}switch(r){case 1:a0&&(h+=`;codecs=${l}`),po(this.isAudioInitInfo)&&(this.player.audio.updateAudioInfo({encTypeCode:i,channels:a.channelCount,sampleRate:a.audioSampleRate}),this.isAudioInitInfo=!0),this.audioMimeType=h,this.isAAC=r,this._initAudioSourceBuffer(),this.appendAudioBuffer(d.buffer),!0}_initSourceBuffer(){const{debug:e,events:{proxy:t}}=this.player;if(null===this.sourceBuffer&&null!==this.mediaSource&&this.isStateOpen&&this.videoMimeType){try{this.sourceBuffer=this.mediaSource.addSourceBuffer(this.videoMimeType),e.log(this.TAG_NAME,"_initSourceBuffer() this.mediaSource.addSourceBuffer()",this.videoMimeType)}catch(t){return e.error(this.TAG_NAME,"appendBuffer() this.mediaSource.addSourceBuffer()",t.code,t),this.player.emitError(ct.mseAddSourceBufferError,t),void(this.mediaSourceAddSourceBufferError=!0)}if(this.sourceBuffer){const i=t(this.sourceBuffer,"error",(t=>{this.mediaSourceBufferError=!0,e.error(this.TAG_NAME,"mseSourceBufferError this.sourceBuffer",t),this.player.emitError(ct.mseSourceBufferError,t)})),s=t(this.sourceBuffer,"updateend",(()=>{this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this.hasPendingEos&&(this.player.debug.log(this.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),this.endOfStream())}));this.eventListenList.push(i,s)}}else e.log(this.TAG_NAME,`_initSourceBuffer and this.isStateOpen is ${this.isStateOpen} and this.isAvc === null is ${null===this.isAvc}`)}_initAudioSourceBuffer(){const{debug:e,events:{proxy:t}}=this.player;if(null===this.audioSourceBuffer&&null!==this.mediaSource&&this.isStateOpen&&this.audioMimeType){try{this.audioSourceBuffer=this.mediaSource.addSourceBuffer(this.audioMimeType),this._clearAudioSourceBufferCheckTimeout(),e.log(this.TAG_NAME,"_initAudioSourceBuffer() this.mediaSource.addSourceBuffer()",this.audioMimeType)}catch(t){return e.error(this.TAG_NAME,"appendAudioBuffer() this.mediaSource.addSourceBuffer()",t.code,t),this.player.emitError(ct.mseAddSourceBufferError,t),void(this.mediaSourceAddSourceBufferError=!0)}if(this.audioSourceBuffer){const i=t(this.audioSourceBuffer,"error",(t=>{this.mediaSourceBufferError=!0,e.error(this.TAG_NAME,"mseSourceBufferError this.audioSourceBuffer",t),this.player.emitError(ct.mseSourceBufferError,t)})),s=t(this.audioSourceBuffer,"updateend",(()=>{this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this.hasPendingEos&&(this.player.debug.log(this.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),this.endOfStream())}));this.eventListenList.push(i,s),null===this.audioSourceNoDataCheckTimeout&&(this.audioSourceNoDataCheckTimeout=setTimeout((()=>{this._clearAudioNoDataCheckTimeout(),this.player.emit(ct.mediaSourceAudioNoDataTimeout)}),1e3))}}else e.log(this.TAG_NAME,`_initAudioSourceBuffer and this.isStateOpen is ${this.isStateOpen} and this.audioMimeType is ${this.audioMimeType}`)}_decodeVideo(e,t,i,s,r){const a=this.player;let o=e.slice(5),n=o.byteLength;if(0===n)return void a.debug.warn(this.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let l=(new Date).getTime(),d=!1;this.prevTimestamp||(this.prevTimestamp=l,d=!0);const h=l-this.prevTimestamp;this.decodeDiffTimestamp=h,h>500&&!d&&this.player.isPlayer()&&a.debug.warn(this.TAG_NAME,`_decodeVideo now time is ${l} and prev time is ${this.prevTimestamp}, diff time is ${h} ms`);const c=this.$videoElement;if(this.cacheTrack.id&&t>=this.cacheTrack.dts){let e=8+this.cacheTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(Uh.types.mdat,4),i.set(this.cacheTrack.data,8),this.cacheTrack.duration=t-this.cacheTrack.dts;let s=Uh.moof(this.cacheTrack,this.cacheTrack.dts);this.cacheTrack={};let o=new Uint8Array(s.byteLength+i.byteLength);o.set(s,0),o.set(i,s.byteLength),this.appendBuffer(o.buffer),a.emit(nt.timeUpdate,r),a.isPlayer()?a.isUseHls265()?a.updateStats({dfps:!0,mseTs:t}):a.updateStats({fps:!0,dfps:!0,ts:r,mseTs:t}):a.isPlayback()&&a.playback.updateStats({ts:r}),a._times.videoStart||(a._times.videoStart=aa(),a.handlePlayToRenderTimes())}else a.debug.log(this.TAG_NAME,`cacheTrack = {} now dts is ${t}, and ts is ${r} cacheTrack dts is ${this.cacheTrack&&this.cacheTrack.dts}`),this.cacheTrack={};this.cacheTrack||(this.cacheTrack={}),this.cacheTrack.id=mr,this.cacheTrack.sequenceNumber=++this.sequenceNumber,this.cacheTrack.size=n,this.cacheTrack.dts=t,this.cacheTrack.cts=s,this.cacheTrack.isKeyframe=i,this.cacheTrack.data=o,this.cacheTrack.flags={isLeading:0,dependsOn:i?2:1,isDependedOn:i?1:0,hasRedundancy:0,isNonSync:i?0:1},!this.isInitInfo&&c.videoWidth>0&&c.videoHeight>0&&(a.debug.log(this.TAG_NAME,`updateVideoInfo: ${c.videoWidth},${c.videoHeight}`),a.video.updateVideoInfo({width:c.videoWidth,height:c.videoHeight}),a.video.initCanvasViewSize(),this.isInitInfo=!0),a._opt.mseUseCanvasRender&&po(this.isSupportVideoFrameCallback)&&po(a.isUseHls265())&&a.video.render({$video:c,ts:t}),this.prevTimestamp=(new Date).getTime()}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}_decodeAudio(e,t,i){const s=this.player;let r=this.isAAC?e.slice(2):e.slice(1),a=r.byteLength;if(this.cacheAudioTrack.id&&t>=this.cacheAudioTrack.dts){let e=8+this.cacheAudioTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(Uh.types.mdat,4),i.set(this.cacheAudioTrack.data,8),this.cacheAudioTrack.duration=t-this.cacheAudioTrack.dts;let s=Uh.moof(this.cacheAudioTrack,this.cacheAudioTrack.dts);this.cacheAudioTrack={};let r=new Uint8Array(s.byteLength+i.byteLength);r.set(s,0),r.set(i,s.byteLength),this.appendAudioBuffer(r.buffer)}else s.debug.log(this.TAG_NAME,`cacheAudioTrack = {} now dts is ${t} cacheAudioTrack dts is ${this.cacheAudioTrack&&this.cacheAudioTrack.dts}`),this.cacheAudioTrack={};this.cacheAudioTrack||(this.cacheAudioTrack={}),this.cacheAudioTrack.id=gr,this.cacheAudioTrack.sequenceNumber=++this.audioSequenceNumber,this.cacheAudioTrack.size=a,this.cacheAudioTrack.dts=t,this.cacheAudioTrack.cts=0,this.cacheAudioTrack.data=r,this.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}appendBuffer(e){if(this.player.isDestroyedOrClosed())return void this.player.debug.warn(this.TAG_NAME,"appendBuffer() player is destroyed");const{debug:t,events:{proxy:i}}=this.player;this.mediaSourceAddSourceBufferError?t.warn(this.TAG_NAME,"appendBuffer() this.mediaSourceAddSourceBufferError is true"):this.mediaSourceAppendBufferFull?t.warn(this.TAG_NAME,"appendBuffer() this.mediaSourceAppendBufferFull is true"):this.mediaSourceAppendBufferError?t.warn(this.TAG_NAME,"appendBuffer() this.mediaSourceAppendBufferError is true"):this.mediaSourceBufferError?t.warn(this.TAG_NAME,"appendBuffer() this.mediaSourceBufferError is true"):(this.pendingSegments.push(e),this.sourceBuffer&&(this.player.isPlayer()&&this._handleUpdatePlaybackRate(),this.player.isPlayback()&&(this._handleUpdateBufferDelayTime(),this._checkVideoPlayCurrentTime()),this.player._opt.mseAutoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanUpSourceBuffer(),po(this.getSourceBufferUpdating())&&this.isStateOpen&&po(this._hasPendingRemoveRanges()))?this._doAppendSegments():this.isStateClosed?(this.mediaSourceBufferError=!0,this.player.emitError(ct.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):this.isStateEnded?(this.mediaSourceBufferError=!0,this.player.emitError(ct.mseSourceBufferError,"mediaSource is end")):this._hasPendingRemoveRanges()&&t.log(this.TAG_NAME,`video has pending remove ranges and video length is ${this.pendingRemoveRanges.length}, audio length is ${this.pendingAudioRemoveRanges.length}`))}appendAudioBuffer(e){if(this.player.isDestroyedOrClosed())return void this.player.debug.warn(this.TAG_NAME,"appendAudioBuffer() player is destroyed");const{debug:t,events:{proxy:i}}=this.player;this.mediaSourceAddSourceBufferError?t.warn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAddSourceBufferError is true"):this.mediaSourceAppendBufferFull?t.warn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAppendBufferFull is true"):this.mediaSourceAppendBufferError?t.warn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAppendBufferError is true"):this.mediaSourceBufferError?t.warn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceBufferError is true"):(this.pendingAudioSegments.push(e),this.audioSourceBuffer&&(this.player.isPlayer()&&this._handleUpdatePlaybackRate(),this.player.isPlayback()&&(this._handleUpdateBufferDelayTime(),this._checkVideoPlayCurrentTime()),this.player._opt.mseAutoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanUpSourceBuffer(),po(this.getAudioSourceBufferUpdating())&&this.isStateOpen&&po(this._hasPendingRemoveRanges()))?this._doAppendSegments():this.isStateClosed?(this.mediaSourceBufferError=!0,this.player.emitError(ct.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):this.isStateEnded?(this.mediaSourceBufferError=!0,this.player.emitError(ct.mseSourceBufferError,"mediaSource is end")):this._hasPendingRemoveRanges()&&t.log(this.TAG_NAME,`audio has pending remove ranges and video length is ${this.pendingRemoveRanges.length}, audio length is ${this.pendingAudioRemoveRanges.length}`))}getSourceBufferUpdating(){return this.sourceBuffer&&this.sourceBuffer.updating}getAudioSourceBufferUpdating(){return this.audioSourceBuffer&&this.audioSourceBuffer.updating}stop(){this.abortSourceBuffer(),this.removeSourceBuffer(),this.endOfStream()}checkSourceBufferDelay(){const e=this.$videoElement;let t=0,i=0;return e.buffered.length>0&&(i=e.buffered.end(e.buffered.length-1),t=i-e.currentTime),t<0&&(this.player.debug.warn(this.TAG_NAME,`checkMSESourceBufferDelay ${t} < 0, and buffered is ${i} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${i}`),e.currentTime=i,t=0),t}checkSourceBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.currentTime-e.buffered.start(0)),t}getDecodeDiffTimes(){return this.decodeDiffTimestamp}removeBuffer(e,t){const i=Ka();if(this.player.debug.log(this.TAG_NAME,`removeBuffer() start is ${e} and end is ${t} and _isMacOsFirefox is ${i}`),this.isStateOpen&&po(i)){if(po(this.getSourceBufferUpdating()))try{this.sourceBuffer.remove(e,t)}catch(e){this.player.debug.warn(this.TAG_NAME,"removeBuffer() sourceBuffer error",e)}if(po(this.getAudioSourceBufferUpdating()))try{this.audioSourceBuffer.remove(e,t)}catch(e){this.player.debug.warn(this.TAG_NAME,"removeBuffer() audioSourceBuffer error",e)}}}clearUpAllSourceBuffer(){if(this.sourceBuffer){const e=this.sourceBuffer.buffered;for(let t=0;t=1)if(this.getSourceBufferUpdating()||this.getAudioSourceBufferUpdating())this.hasPendingEos=!0;else{this.hasPendingEos=!1;try{this.player.debug.log(this.TAG_NAME,"endOfStream()"),this.mediaSource.endOfStream()}catch(e){this.player.debug.warn(this.TAG_NAME,"endOfStream() error",e)}}}abortSourceBuffer(){if(this.isStateOpen){if(this.sourceBuffer){try{this.player.debug.log(this.TAG_NAME,"abortSourceBuffer() abort sourceBuffer"),this.sourceBuffer.abort()}catch(e){}po(this.getSourceBufferUpdating())&&this._doRemoveRanges()}if(this.audioSourceBuffer){try{this.player.debug.log(this.TAG_NAME,"abortSourceBuffer() abort audioSourceBuffer"),this.audioSourceBuffer.abort()}catch(e){}po(this.getAudioSourceBufferUpdating())&&this._doRemoveRanges()}}this.sourceBuffer=null,this.audioSourceBuffer=null}removeSourceBuffer(){if(!this.isStateClosed&&this.mediaSource){if(this.sourceBuffer)try{this.player.debug.log(this.TAG_NAME,"removeSourceBuffer() sourceBuffer"),this.mediaSource.removeSourceBuffer(this.sourceBuffer)}catch(e){this.player.debug.error(this.TAG_NAME,"removeSourceBuffer() sourceBuffer error",e)}if(this.audioSourceBuffer)try{this.player.debug.log(this.TAG_NAME,"removeSourceBuffer() audioSourceBuffer"),this.mediaSource.removeSourceBuffer(this.audioSourceBuffer)}catch(e){this.player.debug.error(this.TAG_NAME,"removeSourceBuffer() audioSourceBuffer error",e)}}}_hasPendingSegments(){return this.pendingSegments.length>0||this.pendingAudioSegments.length>0}getPendingSegmentsLength(){return this.pendingSegments.length}_handleUpdatePlaybackRate(){if(!this.$videoElement)return;const e=this.$videoElement;this.player._opt.videoBuffer,this.player._opt.videoBufferDelay;const t=e.buffered;t.length&&t.start(0);const i=t.length?t.end(t.length-1):0;let s=e.currentTime;const r=i-s,a=this.getMseBufferMaxDelayTime();if(this.player.updateStats({mseVideoBufferDelayTime:r}),r>a)this.player.debug.log(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current is ${s} , delay buffer is more than ${a} is ${r} and new time is ${i}`),e.currentTime=i,s=e.currentTime;else if(r<0){if(this.player.debug.warn(this.TAG_NAME,`handleUpdatePlaybackRate and delay buffer is ${i} - current is ${s} = ${r} < 0 and check video is paused : ${e.paused} `),0===i)return void this.player.emit(ct.mediaSourceBufferedIsZeroError,"video.buffered is empty");e.paused&&e.play()}const o=this._getPlaybackRate(i-s);e.playbackRate!==o&&(this.player.debug.log(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current time is ${s} and delay is ${i-s} set playbackRate is ${o} `),e.playbackRate=o)}_handleUpdateBufferDelayTime(){const e=this.getVideoBufferDelayTime();this.player.updateStats({mseVideoBufferDelayTime:e})}_checkVideoPlayCurrentTime(){const e=this.checkSourceBufferStore();if(e<0){const t=this.getVideoBufferStartTime();this.player.debug.warn(this.TAG_NAME,`checkVideoPlayCurrentTime store is ${e} < 0 and set currentTime ${this.$videoElement.currentTime} to ${t}`),this.$videoElement.currentTime=t}}_doAppendSegments(){if(this.isStateClosed||this.isStateEnded)this.player.debug.log(this.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==this.sourceBuffer){if(this.needInitAudio()&&null===this.audioSourceBuffer)return this.player.debug.log(this.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===this.audioSourceBufferCheckTimeout&&(this.audioSourceBufferCheckTimeout=setTimeout((()=>{this._clearAudioSourceBufferCheckTimeout(),this.player.emit(ct.mediaSourceAudioInitTimeout)}),1e3)));if(po(this.getSourceBufferUpdating())&&this.pendingSegments.length>0){const e=this.pendingSegments.shift();try{this.sourceBuffer.appendBuffer(e)}catch(e){this.player.debug.error(this.TAG_NAME,"this.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.player.emitError(ct.mediaSourceFull)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.player.emitError(ct.mediaSourceAppendBufferError)):(this.stop(),this.mediaSourceBufferError=!0,this.player.emitError(nt.mseSourceBufferError,e))}}if(po(this.getAudioSourceBufferUpdating())&&this.pendingAudioSegments.length>0){const e=this.pendingAudioSegments.shift();try{this.audioSourceBuffer.appendBuffer(e)}catch(e){this.player.debug.error(this.TAG_NAME,"this.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.player.emitError(ct.mediaSourceFull)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.player.emitError(ct.mediaSourceAppendBufferError)):(this.stop(),this.mediaSourceBufferError=!0,this.player.emitError(nt.mseSourceBufferError,e))}}}else this.player.debug.log(this.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")}_doCleanUpSourceBuffer(){if(!this.$videoElement)return;const e=this.$videoElement.currentTime;if(this.sourceBuffer){const t=this.sourceBuffer.buffered;let i=!1;for(let s=0;s=this.player._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-this.player._opt.mseAutoCleanupMinBackwardDuration;this.pendingRemoveRanges.push({start:r,end:t})}}else a=this.player._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-this.player._opt.mseAutoCleanupMinBackwardDuration;this.pendingAudioRemoveRanges.push({start:r,end:t})}}else a0||this.pendingAudioRemoveRanges.length>0}_doRemoveRanges(){if(this.sourceBuffer&&po(this.getSourceBufferUpdating())){let e=this.pendingRemoveRanges;for(;e.length&&po(this.getSourceBufferUpdating());){let t=e.shift();try{this.sourceBuffer.remove(t.start,t.end)}catch(e){this.player.debug.warn(this.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e)}}}if(this.audioSourceBuffer&&po(this.getAudioSourceBufferUpdating())){let e=this.pendingAudioRemoveRanges;for(;e.length&&po(this.getAudioSourceBufferUpdating());){let t=e.shift();try{this.audioSourceBuffer.remove(t.start,t.end)}catch(e){this.player.debug.warn(this.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e)}}}}getDecodePlaybackRate(){let e=0;const t=this.$videoElement;return t&&(e=t.playbackRate),e}_getPlaybackRate(e){const t=this.$videoElement;let i=this.player._opt.videoBufferDelay+this.player._opt.videoBuffer;const s=Math.max(i,1e3),r=s/2;return e*=1e3,1===t.playbackRate?e>s?1.2:1:e<=r?1:t.playbackRate}_needCleanupSourceBuffer(){if(po(this.player._opt.mseAutoCleanupSourceBuffer)||!this.$videoElement)return!1;const e=this.$videoElement,t=e.buffered,i=e.currentTime;return t.length>=1&&i-t.start(0)>=this.player._opt.mseAutoCleanupMaxBackwardDuration}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}getVideoBufferLastTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;i.length&&i.start(0);t=i.length?i.end(i.length-1):0}return t}getVideoBufferStartTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;t=i.length?i.start(0):0}return t}getVideoBufferDelayTime(){const e=this.$videoElement;const t=this.getVideoBufferLastTime()-e.currentTime;return t>0?t:0}_clearAudioSourceBufferCheckTimeout(){this.audioSourceBufferCheckTimeout&&(clearTimeout(this.audioSourceBufferCheckTimeout),this.audioSourceBufferCheckTimeout=null)}_clearAudioNoDataCheckTimeout(){this.audioSourceNoDataCheckTimeout&&(clearTimeout(this.audioSourceNoDataCheckTimeout),this.audioSourceNoDataCheckTimeout=null)}getMimeType(){return{video:this.videoMimeType,audio:this.audioMimeType}}getMseBufferMaxDelayTime(){let e=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3;return Math.max(5,e+3)}}const Vh=()=>"wakeLock"in navigator&&-1===window.navigator.userAgent.indexOf("Samsung")&&po(ya());class $h{constructor(e){this.player=e,this.enabled=!1,Vh()?(this.player.debug.log("NoSleep","Native Wake Lock API supported."),this._wakeLock=null,this.handleVisibilityChange=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()},document.addEventListener("visibilitychange",this.handleVisibilityChange),document.addEventListener("fullscreenchange",this.handleVisibilityChange)):(this.player.debug.log("NoSleep","Native Wake Lock API not supported. so use video element."),this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQRChYECGFOAZwEAAAAAABLfEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHYTbuMU6uEElTDZ1OsggGXTbuMU6uEHFO7a1OsghLJ7AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmsirXsYMPQkBNgI1MYXZmNTguNDUuMTAwV0GNTGF2ZjU4LjQ1LjEwMESJiECzmgAAAAAAFlSua0C5rgEAAAAAAABO14EBc8WI9UhIq9EDJPCcgQAitZyDdW5khoVWX1ZQOIOBASPjg4QF9eEA4AEAAAAAAAAbsIIBQLqB8FSwggElVLqB8FWwiFW3gQFVuIECrgEAAAAAAABZ14ECc8WIUEWPA9J/iJ6cgQAitZyDdW5khoZBX09QVVNWqoNjLqBWu4QExLQAg4EC4ZGfgQG1iEDncAAAAAAAYmSBIGOik09wdXNIZWFkAQE4AYC7AAAAAAASVMNnQcJzcwEAAAAAAACXY8CAZ8gBAAAAAAAAFUWji01BSk9SX0JSQU5ERIeEaXNvbWfIAQAAAAAAABZFo41NSU5PUl9WRVJTSU9ORIeDNTEyZ8gBAAAAAAAAJ0WjkUNPTVBBVElCTEVfQlJBTkRTRIeQaXNvbWlzbzJhdmMxbXA0MWfIAQAAAAAAABpFo4dFTkNPREVSRIeNTGF2ZjU4LjQ1LjEwMHNzAQAAAAAAAIZjwItjxYj1SEir0QMk8GfIAQAAAAAAAB5Fo4xIQU5ETEVSX05BTUVEh4xWaWRlb0hhbmRsZXJnyAEAAAAAAAAhRaOHRU5DT0RFUkSHlExhdmM1OC45MS4xMDAgbGlidnB4Z8iiRaOIRFVSQVRJT05Eh5QwMDowMDowNS4wMDcwMDAwMDAAAHNzAQAAAAAAAIdjwItjxYhQRY8D0n+InmfIAQAAAAAAAB5Fo4xIQU5ETEVSX05BTUVEh4xTb3VuZEhhbmRsZXJnyAEAAAAAAAAiRaOHRU5DT0RFUkSHlUxhdmM1OC45MS4xMDAgbGlib3B1c2fIokWjiERVUkFUSU9ORIeUMDA6MDA6MDUuMDE4MDAwMDAwAAAfQ7Z1T2TngQCjh4IAAID4//6jQKSBAAeAMBIAnQEqQAHwAABHCIWFiIWEiAICAAYWBPcGgWSfa9ubJzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh69AD+/6tQgKOHggAVgPj//qOHggApgPj//qOHggA9gPj//qOHggBRgPj//qOHggBlgPj//qOegQBrANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCAHmA+P/+o4eCAI2A+P/+o4eCAKGA+P/+o4eCALWA+P/+o4eCAMmA+P/+o56BAM8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IA3YD4//6jh4IA8YD4//6jh4IBBYD4//6jh4IBGYD4//6jh4IBLYD4//6jnoEBMwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggFBgPj//qOHggFVgPj//qOHggFpgPj//qOHggF9gPj//qOHggGRgPj//qOegQGXANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCAaWA+P/+o4eCAbmA+P/+o4eCAc2A+P/+o4eCAeGA+P/+o4eCAfWA+P/+o56BAfsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4ICCYD4//6jh4ICHYD4//6jh4ICMYD4//6jh4ICRYD4//6jh4ICWYD4//6jnoECXwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggJtgPj//qOHggKBgPj//qOHggKVgPj//qOHggKpgPj//qOHggK9gPj//qOegQLDANECAAUQEBRgAGFgv9AAIgAQzX61yT5xzAAAo4eCAtGA+P/+o4eCAuWA+P/+o4eCAvmA+P/+o4eCAw2A+P/+o4eCAyGA+P/+o56BAycA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IDNYD4//6jh4IDSYD4//6jh4IDXYD4//6jh4IDcYD4//6jh4IDhYD4//6jnoEDiwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggOZgPj//qOHggOtgPj//qOHggPBgPj//qOHggPVgPj//qOHggPpgPj//qOegQPvANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCA/2A+P/+o4eCBBGA+P/+o4eCBCWA+P/+o4eCBDmA+P/+o4eCBE2A+P/+o56BBFMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IEiID4//6jh4IEnID4//6jh4IEsID4//6jnoEEtwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggTEgPj//qOHggTYgPj//qOHggTsgPj//qOHggUAgPj//qOHggUUgPj//qOegQUbANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBSiA+P/+o4eCBTyA+P/+o4eCBVCA+P/+o4eCBWSA+P/+o4eCBXiA+P/+o56BBX8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IFjID4//6jh4IFoID4//6jh4IFtID4//6jh4IFyID4//6jh4IF3ID4//6jnoEF4wDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggXwgPj//qOHggYEgPj//qOHggYYgPj//qOHggYsgPj//qOHggZAgPj//qOegQZHANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBlSA+P/+o4eCBmiA+P/+o4eCBnyA+P/+o4eCBpCA+P/+o4eCBqSA+P/+o56BBqsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IGuID4//6jh4IGzID4//6jh4IG4ID4//6jh4IG9ID4//6jh4IHCID4//6jnoEHDwDRAgAFEBAUYABhYL/QACIAEM1+tck+ccwAAKOHggccgPj//qOHggcwgPj//qOHggdEgPj//qOHggdYgPj//qOHggdsgPj//qOegQdzANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCB4CA+P/+o4eCB5SA+P/+o4eCB6iA+P/+o4eCB7yA+P/+o4eCB9CA+P/+o56BB9cA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IH5ID4//6jh4IH+ID4//6jh4IIDID4//6jh4IIIID4//6jh4IINID4//6jnoEIOwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgghIgPj//qOHgghcgPj//qOHgghwgPj//qOHggiEgPj//qOegQifANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCMCA+P/+o4eCCNSA+P/+o4eCCOiA+P/+o4eCCPyA+P/+o56BCQMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IJEID4//6jh4IJJID4//6jh4IJOID4//6jh4IJTID4//6jh4IJYID4//6jnoEJZwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggl0gPj//qOHggmIgPj//qOHggmcgPj//qOHggmwgPj//qOHggnEgPj//qOegQnLANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCdiA+P/+o4eCCeyA+P/+o4eCCgCA+P/+o4eCChSA+P/+o4eCCiiA+P/+o56BCi8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IKPID4//6jh4IKUID4//6jh4IKZID4//6jh4IKeID4//6jh4IKjID4//6jnoEKkwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggqggPj//qOHggq0gPj//qOHggrIgPj//qOHggrcgPj//qOHggrwgPj//qOegQr3ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCwSA+P/+o4eCCxiA+P/+o4eCCyyA+P/+o4eCC0CA+P/+o4eCC1SA+P/+o56BC1sA0QIABRAQFGAAYWC/0AAiABDNfrXJPnHMAACjh4ILaID4//6jh4ILfID4//6jh4ILkID4//6jh4ILpID4//6jh4ILuID4//6jnoELvwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggvMgPj//qOHggvggPj//qOHggv0gPj//qOHggwIgPj//qOHggwcgPj//qOegQwjANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDDCA+P/+o4eCDESA+P/+o4eCDFiA+P/+o4eCDGyA+P/+o4eCDICA+P/+o56BDIcA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IMlID4//6jh4IMqID4//6jh4IMvID4//6jh4IM0ID4//6jnoEM6wDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgg0MgPj//qOHgg0ggPj//qOHgg00gPj//qOHgg1IgPj//qOegQ1PANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDVyA+P/+o4eCDXCA+P/+o4eCDYSA+P/+o4eCDZiA+P/+o4eCDayA+P/+o56BDbMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4INwID4//6jh4IN1ID4//6jh4IN6ID4//6jh4IN/ID4//6jh4IOEID4//6jnoEOFwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgg4kgPj//qOHgg44gPj//qOHgg5MgPj//qOHgg5ggPj//qOHgg50gPj//qOegQ57ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDoiA+P/+o4eCDpyA+P/+o4eCDrCA+P/+o4eCDsSA+P/+o4eCDtiA+P/+o56BDt8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IO7ID4//6jh4IPAID4//6jh4IPFID4//6jh4IPKID4//6jh4IPPID4//6jnoEPQwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgg9QgPj//qOHgg9kgPj//qOHgg94gPj//qOHgg+MgPj//qOHgg+ggPj//qOegQ+nANECAAUQEBRgAGFgv9AAIgAQzX61yT5xzAAAo4eCD7SA+P/+o4eCD8iA+P/+o4eCD9yA+P/+o4eCD/CA+P/+o4eCEASA+P/+o56BEAsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IQGID4//6jh4IQLID4//6jh4IQQID4//6jh4IQVID4//6jh4IQaID4//6jnoEQbwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghB8gPj//qOHghCQgPj//qOHghCkgPj//qOHghC4gPj//qOHghDMgPj//qOegRDTANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEOCA+P/+o4eCEPSA+P/+o4eCEQiA+P/+o56BETcA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IRQ4D4//6jh4IRV4D4//6jh4IRa4D4//6jh4IRf4D4//6jh4IRk4D4//6jnoERmwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghGngPj//qOHghG7gPj//qOHghHPgPj//qOHghHjgPj//qOHghH3gPj//qOegRH/ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEguA+P/+o4eCEh+A+P/+o4eCEjOA+P/+o4eCEkeA+P/+o4eCEluA+P/+o56BEmMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4ISb4D4//6jh4ISg4D4//6jh4ISl4D4//6jh4ISq4D4//6jh4ISv4D4//6jnoESxwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghLTgPj//qOHghLngPj//qOHghL7gPj//qOHghMPgPj//qOHghMjgPj//qOegRMrANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEzeA+P/+o4eCE0uA+P/+o4eCE1+A+P/+o4eCE3OA+P/+oAEAAAAAAAAPoYeCE4cA+P/+daKDB/KBHFO7a5G7j7OBB7eK94EB8YIDX/CBDA=="),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACORtZGF03gIATGF2YzU4LjM1LjEwMAACMEAOAAACcQYF//9t3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MSByMzAyNyA0MTIxMjc3IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAyMCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTAgcmVmPTMgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9NyBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0xIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MSA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0tMiB0aHJlYWRzPTcgbG9va2FoZWFkX3RocmVhZHM9MSBzbGljZWRfdGhyZWFkcz0wIG5yPTAgZGVjaW1hdGU9MSBpbnRlcmxhY2VkPTAgYmx1cmF5X2NvbXBhdD0wIGNvbnN0cmFpbmVkX2ludHJhPTAgYmZyYW1lcz0wIHdlaWdodHA9MCBrZXlpbnQ9MjUwIGtleWludF9taW49MTAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD00MCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIzLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IGlwX3JhdGlvPTEuNDAgYXE9MToxLjAwAIAAAADvZYiED/JigADD7JycnJycnJycnJycnJycnJycnJ11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111114BGCAHARggBwEYIAcBGCAHARggBwAAAAdBmjgf4BLYARggBwEYIAcBGCAHARggBwAAAAdBmlQH+AS2ARggBwEYIAcBGCAHARggBwAAAAdBmmA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZqAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZrAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0Ga4D/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbAD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbID/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBm0A/wCWwARggBwEYIAcBGCAHAAAAB0GbYD/AJbABGCAHARggBwEYIAcAAAAHQZuAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GboD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbwD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0Gb4D/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBmgA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmiA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmkA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZpgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqgP8AlsAEYIAcBGCAHARggBwAAAAdBmsA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmuA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmwA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZsgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZtAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZtgP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GbgD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GboD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbwD/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBm+A/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmgA/wCWwARggBwEYIAcAAAAHQZogP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GaQD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GaYD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GagD/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBmqA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmsA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmuA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZsAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZsgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZtAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GbYD/AJbABGCAHARggBwAAAAdBm4A/wCWwARggBwEYIAcBGCAHARggBwAAAAdBm6A/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZvAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZvgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZoAO8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GaIDfAJbABGCAHARggBwEYIAcBGCAHAAAMxm1vb3YAAABsbXZoZAAAAAAAAAAAAAAAAAAAA+gAABOgAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAPLdHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAQAAAAAAABOIAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAElVVUA8AAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAATiAAAAAAAAQAAAAADQ21kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAAKAAAAMgAVcQAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kbGVyAAAAAu5taW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAKuc3RibAAAAKpzdHNkAAAAAAAAAAEAAACaYXZjMQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAFAAPAASAAAAEgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj//wAAADRhdmNDAULAC//hABxnQsAL2QFB+/8ACwAMEAAAAwAQAAADAUDxQqSAAQAFaMuDyyAAAAAQcGFzcAAAAAsAAAAMAAAAGHN0dHMAAAAAAAAAAQAAADIAAAQAAAAAFHN0c3MAAAAAAAAAAQAAAAEAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAA3HN0c3oAAAAAAAAAAAAAADIAAANoAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAANhzdGNvAAAAAAAAADIAAABFAAADwQAAA9wAAAP3AAAEFgAABDEAAARMAAAEawAABIYAAAShAAAEwAAABNcAAATuAAAFDQAABSgAAAVDAAAFYgAABX0AAAWYAAAFtwAABdIAAAXtAAAGBAAABh8AAAY6AAAGWQAABnQAAAaPAAAGrgAABskAAAbkAAAHAwAABx4AAAcxAAAHUAAAB2sAAAeGAAAHpQAAB8AAAAfbAAAH+gAACBUAAAgwAAAITwAACGIAAAh9AAAInAAACLcAAAjSAAAI8QAACCV0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAAE6AAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAABOIAAAEAAABAAAAAAedbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAACsRAADYVRVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAAHSG1pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAHDHN0YmwAAABqc3RzZAAAAAAAAAABAAAAWm1wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAACsRAAAAAAANmVzZHMAAAAAA4CAgCUAAgAEgICAF0AVAAAAAAENiAAABVQFgICABRIIVuUABoCAgAECAAAAYHN0dHMAAAAAAAAACgAAAC8AAAQAAAAAAQAACtUAAAAsAAAEAAAAAAEAAArWAAAALAAABAAAAAABAAAK1QAAACwAAAQAAAAAAQAACtUAAAAaAAAEAAAAAAEAAAH/AAABzHN0c2MAAAAAAAAAJQAAAAEAAAABAAAAAQAAAAIAAAAFAAAAAQAAAAMAAAAEAAAAAQAAAAUAAAAFAAAAAQAAAAYAAAAEAAAAAQAAAAgAAAAFAAAAAQAAAAkAAAAEAAAAAQAAAAsAAAAFAAAAAQAAAAwAAAADAAAAAQAAAA4AAAAFAAAAAQAAAA8AAAAEAAAAAQAAABEAAAAFAAAAAQAAABIAAAAEAAAAAQAAABQAAAAFAAAAAQAAABUAAAAEAAAAAQAAABcAAAADAAAAAQAAABgAAAAEAAAAAQAAABoAAAAFAAAAAQAAABsAAAAEAAAAAQAAAB0AAAAFAAAAAQAAAB4AAAAEAAAAAQAAACAAAAAFAAAAAQAAACEAAAAEAAAAAQAAACIAAAACAAAAAQAAACMAAAAFAAAAAQAAACQAAAAEAAAAAQAAACYAAAAFAAAAAQAAACcAAAAEAAAAAQAAACkAAAAFAAAAAQAAACoAAAAEAAAAAQAAACwAAAAFAAAAAQAAAC0AAAACAAAAAQAAAC4AAAAEAAAAAQAAAC8AAAAFAAAAAQAAADAAAAAEAAAAAQAAADIAAAAFAAAAAQAAADMAAAAEAAAAAQAAA1xzdHN6AAAAAAAAAAAAAADSAAAAFQAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAA3HN0Y28AAAAAAAAAMwAAADAAAAOtAAADzAAAA+cAAAQCAAAEIQAABDwAAARXAAAEdgAABJEAAASsAAAEywAABOIAAAT5AAAFGAAABTMAAAVOAAAFbQAABYgAAAWjAAAFwgAABd0AAAX4AAAGDwAABioAAAZFAAAGZAAABn8AAAaaAAAGuQAABtQAAAbvAAAHDgAABykAAAc8AAAHWwAAB3YAAAeRAAAHsAAAB8sAAAfmAAAIBQAACCAAAAg7AAAIWgAACG0AAAiIAAAIpwAACMIAAAjdAAAI/AAAABpzZ3BkAQAAAHJvbGwAAAACAAAAAf//AAAAHHNiZ3AAAAAAcm9sbAAAAAEAAADSAAAAAQAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTguMjAuMTAw"),Object.assign(this.noSleepVideo.style,{position:"absolute",left:"-100%",top:"-100%"}),document.querySelector("body").append(this.noSleepVideo),this.handleNoSleepVideoTimeUpdate=()=>{this.noSleepVideo&&this.noSleepVideo.currentTime>4&&(this.noSleepVideo.currentTime=1)},this.noSleepVideo.addEventListener("timeupdate",this.handleNoSleepVideoTimeUpdate))}destroy(){if(this._wakeLock&&(this._wakeLock.release(),this._wakeLock=null),this.noSleepVideo){this.handleNoSleepVideoTimeUpdate&&this.noSleepVideo.removeEventListener("timeupdate",this.handleNoSleepVideoTimeUpdate);try{this.noSleepVideo.parentNode&&this.noSleepVideo.parentNode.removeChild(this.noSleepVideo)}catch(e){this.player.debug.warn("NoSleep","Failed to remove noSleepVideo element.")}this.noSleepVideo=null}this.handleVisibilityChange&&(document.removeEventListener("visibilitychange",this.handleVisibilityChange),document.removeEventListener("fullscreenchange",this.handleVisibilityChange))}_addSourceToVideo(e,t,i){var s=document.createElement("source");s.src=i,s.type=`video/${t}`,e.appendChild(s)}get isEnabled(){return this.enabled}enable(){const e=this.player.debug;if(Vh())return navigator.wakeLock.request("screen").then((t=>{this._wakeLock=t,this.enabled=!0,e.log("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",(()=>{e.log("wakeLock","Wake Lock released.")}))})).catch((t=>{throw this.enabled=!1,e.warn("wakeLock",`${t.name}, ${t.message}`),t}));return this.noSleepVideo.play().then((t=>(e.log("wakeLock","noSleepVideo Wake Lock active."),this.enabled=!0,t))).catch((t=>{throw e.warn("wakeLock",`noSleepVideo ${t.name}, ${t.message}`),this.enabled=!1,t}))}disable(){Vh()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):this.noSleepVideo&&this.noSleepVideo.pause(),this.enabled=!1,this.player.debug.log("wakeLock","Disabling wake lock.")}}function Wh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jh={exports:{}};!function(e,t){var i,s,r,a,o;i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=o.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=o.normalizePath(r.path),o.buildURLFromParts(r)}var a=o.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return i.alwaysNormalize?(a.path=o.normalizePath(a.path),o.buildURLFromParts(a)):t;var n=o.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");if(!n.netLoc&&n.path&&"/"!==n.path[0]){var l=s.exec(n.path);n.netLoc=l[1],n.path=l[2]}n.netLoc&&!n.path&&(n.path="/");var d={scheme:n.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(d.netLoc=n.netLoc,"/"!==a.path[0]))if(a.path){var h=n.path,c=h.substring(0,h.lastIndexOf("/")+1)+a.path;d.path=o.normalizePath(c)}else d.path=n.path,a.params||(d.params=n.params,a.query||(d.query=n.query));return null===d.path&&(d.path=i.alwaysNormalize?o.normalizePath(a.path):a.path),o.buildURLFromParts(d)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(a,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=o}(Jh);var qh=Jh.exports;function Kh(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function Yh(e){for(var t=1;t`):oc}(t)}))}const hc=lc,cc=/^(\d+)x(\d+)$/,uc=/(.+?)=(".*?"|.*?)(?:,|$)/g;class pc{constructor(e){"string"==typeof e&&(e=pc.parseAttrList(e)),Zh(this,e)}get clientAttrs(){return Object.keys(this).filter((e=>"X-"===e.substring(0,2)))}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;const i=new Uint8Array(t.length/2);for(let e=0;eNumber.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}bool(e){return"YES"===this[e]}decimalResolution(e){const t=cc.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const i={};for(uc.lastIndex=0;null!==(t=uc.exec(e));){let e=t[2];0===e.indexOf('"')&&e.lastIndexOf('"')===e.length-1&&(e=e.slice(1,-1));i[t[1].trim()]=e}return i}}function fc(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e}class mc{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const t in i)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==i[t]){hc.warn(`DATERANGE tag attribute: "${t}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=t;break}e=Zh(new pc({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const e=new Date(this.attr["END-DATE"]);ec(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return null!==e?new Date(this._startDate.getTime()+1e3*e):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(ec(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&ec(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class gc{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var yc="audio",Ac="video",bc="audiovideo";class vc{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[yc]:null,[Ac]:null,[bc]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2);let s;s=1===i.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(i[1]),this._byteRange=[s,parseInt(i[0])+s]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=qh.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class _c extends vc{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new gc,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{const e=Object.keys(this.levelkeys);if(1===e.length)return this._decryptdata=this.levelkeys[e[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;if(!ec(this.programDateTime))return null;const e=ec(this.duration)?this.duration:0;return this.programDateTime+1e3*e}get encrypted(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){const e=Object.keys(this.levelkeys),t=e.length;if(t>1||1===t&&this.levelkeys[e[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}setElementaryStreamInfo(e,t,i,s,r,a=!1){const{elementaryStreams:o}=this,n=o[e];n?(n.startPTS=Math.min(n.startPTS,t),n.endPTS=Math.max(n.endPTS,i),n.startDTS=Math.min(n.startDTS,s),n.endDTS=Math.max(n.endDTS,r)):o[e]={startPTS:t,endPTS:i,startDTS:s,endDTS:r,partial:a}}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[yc]=null,e[Ac]=null,e[bc]=null}}class Sc extends vc{constructor(e,t,i,s,r){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new gc,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=s;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}class wc{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e)return this.advanced=!0,void(this.updated=!0);const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return!!this.fragments.length&&ec(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const e=this.driftEndTime-this.driftStartTime;if(e>0){return 1e3*(this.driftEnd-this.driftStart)/e}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function Ec(e){return Uint8Array.from(atob(e),(e=>e.charCodeAt(0)))}function Tc(e){const t=e.split(":");let i=null;if("data"===t[0]&&2===t.length){const e=t[1].split(";"),s=e[e.length-1].split(",");if(2===s.length){const t="base64"===s[0],r=s[1];t?(e.splice(-1,1),i=Ec(r)):i=function(e){const t=kc(e).subarray(0,16),i=new Uint8Array(16);return i.set(t,16-t.length),i}(r)}}return i}function kc(e){return Uint8Array.from(unescape(encodeURIComponent(e)),(e=>e.charCodeAt(0)))}const Cc="undefined"!=typeof self?self:void 0;var xc={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Rc="org.w3.clearkey",Dc="com.apple.streamingkeydelivery",Lc="com.microsoft.playready",Pc="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function Bc(e){switch(e){case Dc:return xc.FAIRPLAY;case Lc:return xc.PLAYREADY;case Pc:return xc.WIDEVINE;case Rc:return xc.CLEARKEY}}var Ic="edef8ba979d64acea3c827dcd51d21ed";function Mc(e){switch(e){case xc.FAIRPLAY:return Dc;case xc.PLAYREADY:return Lc;case xc.WIDEVINE:return Pc;case xc.CLEARKEY:return Rc}}function Uc(e){const{drmSystems:t,widevineLicenseUrl:i}=e,s=t?[xc.FAIRPLAY,xc.WIDEVINE,xc.PLAYREADY,xc.CLEARKEY].filter((e=>!!t[e])):[];return!s[xc.WIDEVINE]&&i&&s.push(xc.WIDEVINE),s}const Fc=null!=Cc&&null!=(Oc=Cc.navigator)&&Oc.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var Oc;function Nc(e,t,i){return Uint8Array.prototype.slice?e.slice(t,i):new Uint8Array(Array.prototype.slice.call(e,t,i))}const jc=(e,t)=>t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128,zc=(e,t)=>t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128,Gc=(e,t)=>{const i=t;let s=0;for(;jc(e,t);){s+=10;s+=Hc(e,t+6),zc(e,t+10)&&(s+=10),t+=s}if(s>0)return e.subarray(i,i+s)},Hc=(e,t)=>{let i=0;return i=(127&e[t])<<21,i|=(127&e[t+1])<<14,i|=(127&e[t+2])<<7,i|=127&e[t+3],i},Vc=(e,t)=>jc(e,t)&&Hc(e,t+6)+10<=e.length-t,$c=e=>{const t=qc(e);for(let e=0;ee&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info,Jc=e=>{const t=String.fromCharCode(e[0],e[1],e[2],e[3]),i=Hc(e,4);return{type:t,size:i,data:e.subarray(10,10+i)}},qc=e=>{let t=0;const i=[];for(;jc(e,t);){const s=Hc(e,t+6);t+=10;const r=t+s;for(;t+8"PRIV"===e.type?Yc(e):"W"===e.type[0]?Xc(e):Qc(e),Yc=e=>{if(e.size<2)return;const t=eu(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:i.buffer}},Qc=e=>{if(e.size<2)return;if("TXXX"===e.type){let t=1;const i=eu(e.data.subarray(t),!0);t+=i.length+1;const s=eu(e.data.subarray(t));return{key:e.type,info:i,data:s}}const t=eu(e.data.subarray(1));return{key:e.type,data:t}},Xc=e=>{if("WXXX"===e.type){if(e.size<2)return;let t=1;const i=eu(e.data.subarray(t),!0);t+=i.length+1;const s=eu(e.data.subarray(t));return{key:e.type,info:i,data:s}}const t=eu(e.data);return{key:e.type,data:t}},Zc=e=>{if(8===e.data.byteLength){const t=new Uint8Array(e.data),i=1&t[3];let s=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return s/=45,i&&(s+=47721858.84),Math.round(s)}},eu=(e,t=!1)=>{const i=iu();if(i){const s=i.decode(e);if(t){const e=s.indexOf("\0");return-1!==e?s.substring(0,e):s}return s.replace(/\0/g,"")}const s=e.length;let r,a,o,n="",l=0;for(;l>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n+=String.fromCharCode(r);break;case 12:case 13:a=e[l++],n+=String.fromCharCode((31&r)<<6|63&a);break;case 14:a=e[l++],o=e[l++],n+=String.fromCharCode((15&r)<<12|(63&a)<<6|(63&o)<<0)}}return n};let tu;function iu(){if(!navigator.userAgent.includes("PlayStation 4"))return tu||void 0===self.TextDecoder||(tu=new self.TextDecoder("utf-8")),tu}const su=function(e){let t="";for(let i=0;i>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function pu(e,t){const i=[];if(!t.length)return i;const s=e.byteLength;for(let r=0;r1?r+a:s;if(nu(e.subarray(r+4,r+8))===t[0])if(1===t.length)i.push(e.subarray(r+8,o));else{const s=pu(e.subarray(r+8,o),t.slice(1));s.length&&au.apply(i,s)}r=o}return i}function fu(e){const t=[],i=e[0];let s=8;const r=du(e,s);s+=4;let a=0,o=0;0===i?(a=du(e,s),o=du(e,s+4),s+=8):(a=hu(e,s),o=hu(e,s+8),s+=16),s+=2;let n=e.length+o;const l=lu(e,s);s+=2;for(let i=0;i>>31)return hc.warn("SIDX has hierarchical references (not supported)"),null;const l=du(e,i);i+=4,t.push({referenceSize:o,subsegmentDuration:l,info:{duration:l/r,start:n,end:n+o-1}}),n+=o,i+=4,s=i}return{earliestPresentationTime:a,timescale:r,version:i,referencesCount:l,references:t}}function mu(e){const t=[],i=pu(e,["moov","trak"]);for(let e=0;e{const i=du(e,4),s=t[i];s&&(s.default={duration:du(e,12),flags:du(e,20)})})),t}function gu(e){const t=e.subarray(8),i=t.subarray(86),s=nu(t.subarray(4,8));let r=s;const a="enca"===s||"encv"===s;if(a){const e=pu(t,[s])[0];pu(e.subarray("enca"===s?28:78),["sinf"]).forEach((e=>{const t=pu(e,["schm"])[0];if(t){const i=nu(t.subarray(4,8));if("cbcs"===i||"cenc"===i){const t=pu(e,["frma"])[0];t&&(r=nu(t))}}}))}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const e=pu(i,["avcC"])[0];r+="."+Au(e[1])+Au(e[2])+Au(e[3]);break}case"mp4a":{const e=pu(t,[s])[0],i=pu(e.subarray(28),["esds"])[0];if(i&&i.length>12){let e=4;if(3!==i[e++])break;e=yu(i,e),e+=2;const t=i[e++];if(128&t&&(e+=2),64&t&&(e+=i[e++]),4!==i[e++])break;e=yu(i,e);const s=i[e++];if(64!==s)break;if(r+="."+Au(s),e+=12,5!==i[e++])break;e=yu(i,e);const a=i[e++];let o=(248&a)>>3;31===o&&(o+=1+((7&a)<<3)+((224&i[e])>>5)),r+="."+o}break}case"hvc1":case"hev1":{const e=pu(i,["hvcC"])[0],t=e[1],s=["","A","B","C"][t>>6],a=31&t,o=du(e,2),n=(32&t)>>5?"H":"L",l=e[12],d=e.subarray(6,12);r+="."+s+a,r+="."+o.toString(16).toUpperCase(),r+="."+n+l;let h="";for(let e=d.length;e--;){const t=d[e];if(t||h){h="."+t.toString(16).toUpperCase()+h}}r+=h;break}case"dvh1":case"dvhe":{const e=pu(i,["dvcC"])[0],t=e[2]>>1&127,s=e[2]<<5&32|e[3]>>3&31;r+="."+bu(t)+"."+bu(s);break}case"vp09":{const e=pu(i,["vpcC"])[0],t=e[4],s=e[5],a=e[6]>>4&15;r+="."+bu(t)+"."+bu(s)+"."+bu(a);break}case"av01":{const e=pu(i,["av1C"])[0],t=e[1]>>>5,s=31&e[1],a=e[2]>>>7?"H":"M",o=(64&e[2])>>6,n=(32&e[2])>>5,l=2===t&&o?n?12:10:o?10:8,d=(16&e[2])>>4,h=(8&e[2])>>3,c=(4&e[2])>>2,u=3&e[2],p=1,f=1,m=1,g=0;r+="."+t+"."+bu(s)+a+"."+bu(l)+"."+d+"."+h+c+u+"."+bu(p)+"."+bu(f)+"."+bu(m)+"."+g;break}}return{codec:r,encrypted:a}}function yu(e,t){const i=t+5;for(;128&e[t++]&&t{const l=n.byteOffset-8;pu(n,["traf"]).map((n=>{const d=pu(n,["tfdt"]).map((e=>{const t=e[0];let i=du(e,4);return 1===t&&(i*=Math.pow(2,32),i+=du(e,8)),i/r}))[0];return void 0!==d&&(e=d),pu(n,["tfhd"]).map((d=>{const h=du(d,4),c=16777215&du(d,0);let u=0;const p=0!=(16&c);let f=0;const m=0!=(32&c);let g=8;h===a&&(0!=(1&c)&&(g+=8),0!=(2&c)&&(g+=4),0!=(8&c)&&(u=du(d,g),g+=4),p&&(f=du(d,g),g+=4),m&&(g+=4),"video"===t.type&&(o=function(e){if(!e)return!1;const t=e.indexOf("."),i=t<0?e:e.substring(0,t);return"hvc1"===i||"hev1"===i||"dvh1"===i||"dvhe"===i}(t.codec)),pu(n,["trun"]).map((a=>{const n=a[0],d=16777215&du(a,0),h=0!=(1&d);let c=0;const p=0!=(4&d),m=0!=(256&d);let g=0;const y=0!=(512&d);let A=0;const b=0!=(1024&d),v=0!=(2048&d);let _=0;const S=du(a,4);let w=8;h&&(c=du(a,w),w+=4),p&&(w+=4);let E=c+l;for(let l=0;l>1&63;return 39===e||40===e}return 6===(31&t)}function Tu(e,t,i,s){const r=ku(e);let a=0;a+=t;let o=0,n=0,l=0;for(;a=r.length)break;l=r[a++],o+=l}while(255===l);n=0;do{if(a>=r.length)break;l=r[a++],n+=l}while(255===l);const e=r.length-a;let t=a;if(ne){hc.error(`Malformed SEI payload. ${n} is too small, only ${e} bytes left to parse.`);break}if(4===o){if(181===r[t++]){const e=lu(r,t);if(t+=2,49===e){const e=du(r,t);if(t+=4,1195456820===e){const e=r[t++];if(3===e){const a=r[t++],n=31&a,l=64&a,d=l?2+3*n:0,h=new Uint8Array(d);if(l){h[0]=a;for(let e=1;e16){const e=[];for(let i=0;i<16;i++){const s=r[t++].toString(16);e.push(1==s.length?"0"+s:s),3!==i&&5!==i&&7!==i&&9!==i||e.push("-")}const a=n-16,l=new Uint8Array(a);for(let e=0;e0?(a=new Uint8Array(4),t.length>0&&new DataView(a.buffer).setUint32(0,t.length,!1)):a=new Uint8Array;const o=new Uint8Array(4);return i&&i.byteLength>0&&new DataView(o.buffer).setUint32(0,i.byteLength,!1),function(e,...t){const i=t.length;let s=8,r=i;for(;r--;)s+=t[r].byteLength;const a=new Uint8Array(s);for(a[0]=s>>24&255,a[1]=s>>16&255,a[2]=s>>8&255,a[3]=255&s,a.set(e,4),r=0,s=8;r>8*(15-i)&255;return t}(e);return new Ru(this.method,this.uri,"identity",this.keyFormatVersions,t)}const t=Tc(this.uri);if(t)switch(this.keyFormat){case Pc:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Lc:{const e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Cu(e,null,t);const i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),s=String.fromCharCode.apply(null,Array.from(i)),r=s.substring(s.indexOf("<"),s.length),a=(new DOMParser).parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(a){const e=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(e){const t=Ec(e).subarray(0,16);!function(e){const t=function(e,t,i){const s=e[t];e[t]=e[i],e[i]=s};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}(t),this.keyId=t}}break}default:{let e=t.subarray(0,16);if(16!==e.length){const t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e;break}}if(!this.keyId||16!==this.keyId.byteLength){let e=xu[this.uri];if(!e){const t=Object.keys(xu).length%Number.MAX_SAFE_INTEGER;e=new Uint8Array(16);new DataView(e.buffer,12,4).setUint32(0,t),xu[this.uri]=e}this.keyId=e}return this}}const Du=/\{\$([a-zA-Z0-9-_]+)\}/g;function Lu(e){return Du.test(e)}function Pu(e,t,i){if(null!==e.variableList||e.hasVariableRefs)for(let s=i.length;s--;){const r=i[s],a=t[r];a&&(t[r]=Bu(e,a))}}function Bu(e,t){if(null!==e.variableList||e.hasVariableRefs){const i=e.variableList;return t.replace(Du,(t=>{const s=t.substring(2,t.length-1),r=null==i?void 0:i[s];return void 0===r?(e.playlistParsingError||(e.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${s}"`)),t):r}))}return t}function Iu(e,t,i){let s,r,a=e.variableList;if(a||(e.variableList=a={}),"QUERYPARAM"in t){s=t.QUERYPARAM;try{const e=new self.URL(i).searchParams;if(!e.has(s))throw new Error(`"${s}" does not match any query parameter in URI: "${i}"`);r=e.get(s)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${t.message}`))}}else s=t.NAME,r=t.VALUE;s in a?e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):a[s]=r||""}function Mu(e,t,i){const s=t.IMPORT;if(i&&s in i){let t=e.variableList;t||(e.variableList=t={}),t[s]=i[s]}else e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}function Uu(e=!0){if("undefined"==typeof self)return;return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}const Fu={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Ou(e,t,i=!0){return!e.split(",").some((e=>!Nu(e,t,i)))}function Nu(e,t,i=!0){var s;const r=Uu(i);return null!=(s=null==r?void 0:r.isTypeSupported(ju(e,t)))&&s}function ju(e,t){return`${t}/mp4;codecs="${e}"`}function zu(e){if(e){const t=e.substring(0,4);return Fu.video[t]}return 2}function Gu(e){return e.split(",").reduce(((e,t)=>{const i=Fu.video[t];return i?(2*i+e)/(e?3:2):(Fu.audio[t]+e)/(e?2:1)}),0)}const Hu={};const Vu=/flac|opus/i;function $u(e,t=!0){return e.replace(Vu,(e=>function(e,t=!0){if(Hu[e])return Hu[e];const i={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[e];for(let s=0;s0&&s.length({id:e.attrs.AUDIO,audioCodec:e.audioCodec}))),SUBTITLES:a.map((e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec}))),"CLOSED-CAPTIONS":[]};let n=0;for(qu.lastIndex=0;null!==(s=qu.exec(e));){const e=new pc(s[1]),a=e.TYPE;if(a){const s=o[a],l=r[a]||[];r[a]=l,Pu(i,e,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d=e.LANGUAGE,h=e["ASSOC-LANGUAGE"],c=e.CHANNELS,u=e.CHARACTERISTICS,p=e["INSTREAM-ID"],f={attrs:e,bitrate:0,id:n++,groupId:e["GROUP-ID"]||"",name:e.NAME||d||"",type:a,default:e.bool("DEFAULT"),autoselect:e.bool("AUTOSELECT"),forced:e.bool("FORCED"),lang:d,url:e.URI?Xu.resolve(e.URI,t):""};if(h&&(f.assocLang=h),c&&(f.channels=c),u&&(f.characteristics=u),p&&(f.instreamId=p),null!=s&&s.length){const e=Xu.findGroup(s,f.groupId)||s[0];ip(f,e,"audioCodec"),ip(f,e,"textCodec")}l.push(f)}}return r}static parseLevelPlaylist(e,t,i,s,r,a){const o=new wc(t),n=o.fragments;let l,d,h,c=null,u=0,p=0,f=0,m=0,g=null,y=new _c(s,t),A=-1,b=!1,v=null;for(Yu.lastIndex=0,o.m3u8=e,o.hasVariableRefs=Lu(e);null!==(l=Yu.exec(e));){b&&(b=!1,y=new _c(s,t),y.start=f,y.sn=u,y.cc=m,y.level=i,c&&(y.initSegment=c,y.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null,v&&(y.setByteRange(v),v=null)));const e=l[1];if(e){y.duration=parseFloat(e);const t=(" "+l[2]).slice(1);y.title=t||null,y.tagList.push(t?["INF",e,t]:["INF",e])}else if(l[3]){if(ec(y.duration)){y.start=f,h&&ap(y,h,o),y.sn=u,y.level=i,y.cc=m,n.push(y);const e=(" "+l[3]).slice(1);y.relurl=Bu(o,e),sp(y,g),g=y,f+=y.duration,u++,p=0,b=!0}}else if(l[4]){const e=(" "+l[4]).slice(1);g?y.setByteRange(e,g):y.setByteRange(e)}else if(l[5])y.rawProgramDateTime=(" "+l[5]).slice(1),y.tagList.push(["PROGRAM-DATE-TIME",y.rawProgramDateTime]),-1===A&&(A=n.length);else{if(l=l[0].match(Qu),!l){hc.warn("No matches on slow regex match for level playlist!");continue}for(d=1;d0&&e.bool("CAN-SKIP-DATERANGES"),o.partHoldBack=e.optionalFloat("PART-HOLD-BACK",0),o.holdBack=e.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const e=new pc(r);o.partTarget=e.decimalFloatingPoint("PART-TARGET");break}case"PART":{let e=o.partList;e||(e=o.partList=[]);const i=p>0?e[e.length-1]:void 0,s=p++,a=new pc(r);Pu(o,a,["BYTERANGE","URI"]);const n=new Sc(a,y,t,s,i);e.push(n),y.duration+=n.duration;break}case"PRELOAD-HINT":{const e=new pc(r);Pu(o,e,["URI"]),o.preloadHint=e;break}case"RENDITION-REPORT":{const e=new pc(r);Pu(o,e,["URI"]),o.renditionReports=o.renditionReports||[],o.renditionReports.push(e);break}default:hc.warn(`line parsed but not handled: ${l}`)}}}g&&!g.relurl?(n.pop(),f-=g.duration,o.partList&&(o.fragmentHint=g)):o.partList&&(sp(y,g),y.cc=m,o.fragmentHint=y,h&&ap(y,h,o));const _=n.length,S=n[0],w=n[_-1];if(f+=o.skippedSegments*o.targetduration,f>0&&_&&w){o.averagetargetduration=f/_;const e=w.sn;o.endSN="initSegment"!==e?e:0,o.live||(w.endList=!0),S&&(o.startCC=S.cc)}else o.endSN=0,o.startCC=0;return o.fragmentHint&&(f+=o.fragmentHint.duration),o.totalduration=f,o.endCC=m,A>0&&function(e,t){let i=e[t];for(let s=t;s--;){const t=e[s];if(!t)return;t.programDateTime=i.programDateTime-1e3*t.duration,i=t}}(n,A),o}}function Zu(e,t,i){var s,r;const a=new pc(e);Pu(i,a,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const o=null!=(s=a.METHOD)?s:"",n=a.URI,l=a.hexadecimalInteger("IV"),d=a.KEYFORMATVERSIONS,h=null!=(r=a.KEYFORMAT)?r:"identity";n&&a.IV&&!l&&hc.error(`Invalid IV: ${a.IV}`);const c=n?Xu.resolve(n,t):"",u=(d||"1").split("/").map(Number).filter(Number.isFinite);return new Ru(o,c,h,u,l)}function ep(e){const t=new pc(e).decimalFloatingPoint("TIME-OFFSET");return ec(t)?t:null}function tp(e,t){let i=(e||"").split(/[ ,]+/).filter((e=>e));["video","audio","text"].forEach((e=>{const s=i.filter((t=>function(e,t){const i=Fu[t];return!!i&&!!i[e.slice(0,4)]}(t,e)));s.length&&(t[`${e}Codec`]=s.join(","),i=i.filter((e=>-1===s.indexOf(e))))})),t.unknownCodecs=i}function ip(e,t,i){const s=t[i];s&&(e[i]=s)}function sp(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),ec(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function rp(e,t,i,s){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=i,e.sn="initSegment",s&&(e.levelkeys=s),e.initSegment=null}function ap(e,t,i){e.levelkeys=t;const{encryptedFragments:s}=i;s.length&&s[s.length-1].levelkeys===t||!Object.keys(t).some((e=>t[e].isCommonEncryption))||s.push(e)}var op="manifest",np="level",lp="audioTrack",dp="subtitleTrack",hp="main",cp="audio",up="subtitle";function pp(e){const{type:t}=e;switch(t){case lp:return cp;case dp:return up;default:return hp}}function fp(e,t){let i=e.url;return void 0!==i&&0!==i.indexOf("data:")||(i=t.url),i}class mp{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.LEVEL_LOADING,this.onLevelLoading,this),e.on(sc.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(sc.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.LEVEL_LOADING,this.onLevelLoading,this),e.off(sc.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(sc.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,s=t.loader,r=new(i||s)(t);return this.loaders[e.type]=r,r}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:op,url:i,deliveryDirectives:null})}onLevelLoading(e,t){const{id:i,level:s,pathwayId:r,url:a,deliveryDirectives:o}=t;this.load({id:i,level:s,pathwayId:r,responseType:"text",type:np,url:a,deliveryDirectives:o})}onAudioTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:a}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:lp,url:r,deliveryDirectives:a})}onSubtitleTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:a}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:dp,url:r,deliveryDirectives:a})}load(e){var t;const i=this.hls.config;let s,r=this.getInternalLoader(e);if(r){const t=r.context;if(t&&t.url===e.url&&t.level===e.level)return void hc.trace("[playlist-loader]: playlist request ongoing");hc.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}if(s=e.type===op?i.manifestLoadPolicy.default:Zh({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),ec(null==(t=e.deliveryDirectives)?void 0:t.part)){let t;if(e.type===np&&null!==e.level?t=this.hls.levels[e.level].details:e.type===lp&&null!==e.id?t=this.hls.audioTracks[e.id].details:e.type===dp&&null!==e.id&&(t=this.hls.subtitleTracks[e.id].details),t){const e=t.partTarget,i=t.targetduration;if(e&&i){const t=1e3*Math.max(3*e,.8*i);s=Zh({},s,{maxTimeToFirstByteMs:Math.min(t,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,s.maxTimeToFirstByteMs)})}}}const a=s.errorRetry||s.timeoutRetry||{},o={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},n={onSuccess:(e,t,i,s)=>{const r=this.getInternalLoader(i);this.resetInternalLoader(i.type);const a=e.data;0===a.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),Xu.isMediaPlaylist(a)?this.handleTrackOrLevelPlaylist(e,t,i,s||null,r):this.handleMasterPlaylist(e,t,i,s)):this.handleManifestParsingError(e,i,new Error("no EXTM3U delimiter"),s||null,t)},onError:(e,t,i,s)=>{this.handleNetworkError(t,i,!1,e,s)},onTimeout:(e,t,i)=>{this.handleNetworkError(t,i,!0,void 0,e)}};r.load(e,o,n)}handleMasterPlaylist(e,t,i,s){const r=this.hls,a=e.data,o=fp(e,i),n=Xu.parseMasterPlaylist(a,o);if(n.playlistParsingError)return void this.handleManifestParsingError(e,i,n.playlistParsingError,s,t);const{contentSteering:l,levels:d,sessionData:h,sessionKeys:c,startTimeOffset:u,variableList:p}=n;this.variableList=p;const{AUDIO:f=[],SUBTITLES:m,"CLOSED-CAPTIONS":g}=Xu.parseMasterPlaylistMedia(a,o,n);if(f.length){f.some((e=>!e.url))||!d[0].audioCodec||d[0].attrs.AUDIO||(hc.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new pc({}),bitrate:0,url:""}))}r.trigger(sc.MANIFEST_LOADED,{levels:d,audioTracks:f,subtitles:m,captions:g,contentSteering:l,url:o,stats:t,networkDetails:s,sessionData:h,sessionKeys:c,startTimeOffset:u,variableList:p})}handleTrackOrLevelPlaylist(e,t,i,s,r){const a=this.hls,{id:o,level:n,type:l}=i,d=fp(e,i),h=ec(n)?n:ec(o)?o:0,c=pp(i),u=Xu.parseLevelPlaylist(e.data,d,h,c,0,this.variableList);if(l===op){const e={attrs:new pc({}),bitrate:0,details:u,name:"",url:d};a.trigger(sc.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:d,stats:t,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=u,this.handlePlaylistLoaded(u,e,t,i,s,r)}handleManifestParsingError(e,t,i,s,r){this.hls.trigger(sc.ERROR,{type:rc.NETWORK_ERROR,details:ac.MANIFEST_PARSING_ERROR,fatal:t.type===op,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:s,stats:r})}handleNetworkError(e,t,i=!1,s,r){let a=`A network ${i?"timeout":"error"+(s?" (status "+s.code+")":"")} occurred while loading ${e.type}`;e.type===np?a+=`: ${e.level} id: ${e.id}`:e.type!==lp&&e.type!==dp||(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);hc.warn(`[playlist-loader]: ${a}`);let n=ac.UNKNOWN,l=!1;const d=this.getInternalLoader(e);switch(e.type){case op:n=i?ac.MANIFEST_LOAD_TIMEOUT:ac.MANIFEST_LOAD_ERROR,l=!0;break;case np:n=i?ac.LEVEL_LOAD_TIMEOUT:ac.LEVEL_LOAD_ERROR,l=!1;break;case lp:n=i?ac.AUDIO_TRACK_LOAD_TIMEOUT:ac.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case dp:n=i?ac.SUBTITLE_TRACK_LOAD_TIMEOUT:ac.SUBTITLE_LOAD_ERROR,l=!1}d&&this.resetInternalLoader(e.type);const h={type:rc.NETWORK_ERROR,details:n,fatal:l,url:e.url,loader:d,context:e,error:o,networkDetails:t,stats:r};if(s){const i=(null==t?void 0:t.url)||e.url;h.response=Yh({url:i,data:void 0},s)}this.hls.trigger(sc.ERROR,h)}handlePlaylistLoaded(e,t,i,s,r,a){const o=this.hls,{type:n,level:l,id:d,groupId:h,deliveryDirectives:c}=s,u=fp(t,s),p=pp(s),f="number"==typeof s.level&&p===hp?l:void 0;if(!e.fragments.length){const e=new Error("No Segments found in Playlist");return void o.trigger(sc.ERROR,{type:rc.NETWORK_ERROR,details:ac.LEVEL_EMPTY_ERROR,fatal:!1,url:u,error:e,reason:e.message,response:t,context:s,level:f,parent:p,networkDetails:r,stats:i})}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const m=e.playlistParsingError;if(m)o.trigger(sc.ERROR,{type:rc.NETWORK_ERROR,details:ac.LEVEL_PARSING_ERROR,fatal:!1,url:u,error:m,reason:m.message,response:t,context:s,level:f,parent:p,networkDetails:r,stats:i});else switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),a.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),n){case op:case np:o.trigger(sc.LEVEL_LOADED,{details:e,level:f||0,id:d||0,stats:i,networkDetails:r,deliveryDirectives:c});break;case lp:o.trigger(sc.AUDIO_TRACK_LOADED,{details:e,id:d||0,groupId:h||"",stats:i,networkDetails:r,deliveryDirectives:c});break;case dp:o.trigger(sc.SUBTITLE_TRACK_LOADED,{details:e,id:d||0,groupId:h||"",stats:i,networkDetails:r,deliveryDirectives:c})}}}function gp(e,t){let i;try{i=new Event("addtrack")}catch(e){i=document.createEvent("Event"),i.initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function yp(e,t){const i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error(`addCue is failed for: ${t}`)}catch(i){hc.debug(`[texttrack-utils]: ${i}`);try{const i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(e){hc.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${e}`)}}"disabled"===i&&(e.mode=i)}function Ap(e){const t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(let t=e.cues.length;t--;)e.removeCue(e.cues[t]);"disabled"===t&&(e.mode=t)}function bp(e,t,i,s){const r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&e.cues.length>0){const r=function(e,t,i){const s=[],r=function(e,t){if(te[i].endTime)return-1;let s=0,r=i;for(;s<=r;){const a=Math.floor((r+s)/2);if(te[a].startTime&&s-1)for(let a=r,o=e.length;a=t&&r.endTime<=i)s.push(r);else if(r.startTime>i)return s}return s}(e.cues,t,i);for(let t=0;t{const e=Ep();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Cp(e,t){return e.getTime()/1e3-t}class xp{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(sc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(sc.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(sc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(sc.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(Ap(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;tkp&&(s=kp);s-i<=0&&(s=i+.25);for(let e=0;ee.type===_p&&n:"video"===s?e=>e.type===wp&&o:e=>e.type===_p&&n||e.type===wp&&o,bp(r,t,i,e)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:s}=this,{dateRanges:r}=t,a=Object.keys(r);if(s){const e=Object.keys(i).filter((e=>!a.includes(e)));for(let t=e.length;t--;){const r=e[t];Object.keys(i[r].cues).forEach((e=>{s.removeCue(i[r].cues[e])})),delete i[r]}}const o=t.fragments[t.fragments.length-1];if(0===a.length||!ec(null==o?void 0:o.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const n=o.programDateTime/1e3-o.start,l=Ep();for(let e=0;e{if(t!==s.id){const i=r[t];if(i.class===s.class&&i.startDate>s.startDate&&(!e||s.startDatethis.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(null===e)return null;const{holdBack:t,partHoldBack:i,targetduration:s}=e,{liveSyncDuration:r,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,n=this.hls.userConfig;let l=o&&i||t;(n.liveSyncDuration||n.liveSyncDurationCount||0===l)&&(l=void 0!==r?r:a*s);const d=s;return l+Math.min(1*this.stallCount,d)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(null===e||null===t||null===i)return null;const s=i.edge,r=e-t-this.edgeStalled,a=s-i.totalduration,o=s-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(a,r),o)}get drift(){const{levelDetails:e}=this;return null===e?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(null===e)return 0;const t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(sc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(sc.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(sc.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(sc.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(sc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(sc.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(sc.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(sc.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var i;t.details===ac.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(i=this.levelDetails)&&i.live&&hc.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(null===i)return;this._latency=i;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:r}=this.config;if(!s||1===r||!t.live)return;const a=this.targetLatency;if(null===a)return;const o=i-a;if(o.05&&this.forwardBufferLength>1){const t=Math.min(2,Math.max(1,r)),i=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;e.playbackRate=Math.min(t,Math.max(1,i))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return null===e?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}const Dp=["NONE","TYPE-0","TYPE-1",null];const Lp=["SDR","PQ","HLG"];var Pp="",Bp="YES",Ip="v2";class Mp{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){const t=new self.URL(e);return void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class Up{constructor(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter((e=>!!e)).map((e=>e.substring(0,4))).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return Fp(this._audioGroups,e)}hasSubtitleGroup(e){return Fp(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t)if("audio"===e){let e=this._audioGroups;e||(e=this._audioGroups=[]),-1===e.indexOf(t)&&e.push(t)}else if("text"===e){let e=this._subtitleGroups;e||(e=this._subtitleGroups=[]),-1===e.indexOf(t)&&e.push(t)}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return null==(e=this.audioGroups)?void 0:e[0]}get textGroupId(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}addFallback(){}}function Fp(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}function Op(e,t){const i=t.startPTS;if(ec(i)){let s,r=0;t.sn>e.sn?(r=i-e.start,s=e):(r=e.start-i,s=t),s.duration!==r&&(s.duration=r)}else if(t.sn>e.sn){e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration}else t.start=Math.max(e.start-t.duration,0)}function Np(e,t,i,s,r,a){s-i<=0&&(hc.warn("Fragment should have a positive duration",t),s=i+t.duration,a=r+t.duration);let o=i,n=s;const l=t.startPTS,d=t.endPTS;if(ec(l)){const e=Math.abs(l-i);ec(t.deltaPTS)?t.deltaPTS=Math.max(e,t.deltaPTS):t.deltaPTS=e,o=Math.max(i,l),i=Math.min(i,l),r=Math.min(r,t.startDTS),n=Math.min(s,d),s=Math.max(s,d),a=Math.max(a,t.endDTS)}const h=i-t.start;0!==t.start&&(t.start=i),t.duration=s-t.start,t.startPTS=i,t.maxStartPTS=o,t.startDTS=r,t.endPTS=s,t.minEndPTS=n,t.endDTS=a;const c=t.sn;if(!e||ce.endSN)return 0;let u;const p=c-e.startSN,f=e.fragments;for(f[p]=t,u=p;u>0;u--)Op(f[u],f[u-1]);for(u=p;u=0;e--){const t=s[e].initSegment;if(t){i=t;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;let r,a=0;if(function(e,t,i){const s=t.skippedSegments,r=Math.max(e.startSN,t.startSN)-t.startSN,a=(e.fragmentHint?1:0)+(s?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,o=t.startSN-e.startSN,n=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let e=r;e<=a;e++){const r=l[o+e];let a=n[e];s&&!a&&e{e.relurl&&(a=e.cc-s.cc),ec(e.startPTS)&&ec(e.endPTS)&&(s.start=s.startPTS=e.startPTS,s.startDTS=e.startDTS,s.maxStartPTS=e.maxStartPTS,s.endPTS=e.endPTS,s.endDTS=e.endDTS,s.minEndPTS=e.minEndPTS,s.duration=e.endPTS-e.startPTS,s.duration&&(r=s),t.PTSKnown=t.alignedSliding=!0),s.elementaryStreams=e.elementaryStreams,s.loader=e.loader,s.stats=e.stats,e.initSegment&&(s.initSegment=e.initSegment,i=e.initSegment)})),i){(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach((e=>{var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=i)?void 0:t.relurl)||(e.initSegment=i)}))}if(t.skippedSegments)if(t.deltaUpdateFailed=t.fragments.some((e=>!e)),t.deltaUpdateFailed){hc.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let e=t.skippedSegments;e--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}else t.canSkipDateRanges&&(t.dateRanges=function(e,t,i){const s=Zh({},e);i&&i.forEach((e=>{delete s[e]}));return Object.keys(t).forEach((e=>{const i=new mc(t[e].attr,s[e]);i.isValid?s[e]=i:hc.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(t[e].attr)}"`)})),s}(e.dateRanges,t.dateRanges,t.recentlyRemovedDateranges));const o=t.fragments;if(a){hc.warn("discontinuity sliding from playlist, take drift into account");for(let e=0;e{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats})),r?Np(t,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS):zp(e,t),o.length&&(t.totalduration=t.edge-o[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;const n=t.advancedDateTime;if(t.advanced&&n){const e=t.edge;t.driftStart||(t.driftStartTime=n,t.driftStart=e),t.driftEndTime=n,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime}function zp(e,t){const i=t.startSN+t.skippedSegments-e.startSN,s=e.fragments;i<0||i>=s.length||Gp(t,s[i].start)}function Gp(e,t){if(t){const i=e.fragments;for(let s=e.skippedSegments;s{const{details:i}=e;null!=i&&i.fragments&&i.fragments.forEach((e=>{e.level=t}))}))}function Wp(e){switch(e.details){case ac.FRAG_LOAD_TIMEOUT:case ac.KEY_LOAD_TIMEOUT:case ac.LEVEL_LOAD_TIMEOUT:case ac.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Jp(e,t){const i=Wp(t);return e.default[(i?"timeout":"error")+"Retry"]}function qp(e,t){const i="linear"===e.backoff?1:Math.pow(2,t);return Math.min(i*e.retryDelayMs,e.maxRetryDelayMs)}function Kp(e){return Yh(Yh({},e),{errorRetry:null,timeoutRetry:null})}function Yp(e,t,i,s){if(!e)return!1;const r=null==s?void 0:s.code,a=t499)}(r)||!!i);return e.shouldRetry?e.shouldRetry(e,t,i,s,a):a}const Qp=function(e,t){let i=0,s=e.length-1,r=null,a=null;for(;i<=s;){r=(i+s)/2|0,a=e[r];const o=t(a);if(o>0)i=r+1;else{if(!(o<0))return a;s=r-1}}return null};function Xp(e,t,i=0,s=0){let r=null;if(e){r=t[e.sn-t[0].sn+1]||null;const s=e.endDTS-i;s>0&&s<15e-7&&(i+=15e-7)}else 0===i&&0===t[0].start&&(r=t[0]);if(r&&(!e||e.level===r.level)&&0===Zp(i,s,r))return r;const a=Qp(t,Zp.bind(null,i,s));return!a||a===e&&r?r:a}function Zp(e=0,t=0,i){if(i.start<=e&&i.start+i.duration>e)return 0;const s=Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return i.start+i.duration-s<=e?1:i.start-s>e&&i.start?-1:0}function ef(e,t,i){const s=1e3*Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-s>e}var tf=0,sf=2,rf=3,af=5,of=0,nf=1,lf=2;class df{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=hc.log.bind(hc,`${t}:`),this.warn=hc.warn.bind(hc,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t){const i=null==t?void 0:t.renditionReports;if(i){let s=-1;for(let r=0;r=0&&e>t.partTarget&&(a+=1)}return new Mp(r,a>=0?a:void 0,Pp)}}}loadPlaylist(e){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,i){const{details:s,stats:r}=t,a=self.performance.now(),o=r.loading.first?Math.max(0,a-r.loading.first):0;if(s.advancedDateTime=Date.now()-o,s.live||null!=i&&i.live){if(s.reloaded(i),i&&this.log(`live playlist ${e} ${s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:s.updated?"UPDATED":"MISSED"}`),i&&s.fragments.length>0&&jp(i,s),!this.canLoad||!s.live)return;let o,n,l;if(s.canBlockReload&&s.endSN&&s.advanced){const e=this.hls.config.lowLatencyMode,r=s.lastPartSn,a=s.endSN,d=s.lastPartIndex,h=r===a,c=e?0:d;-1!==d?(n=h?a+1:r,l=h?c:d+1):n=a+1;const u=s.age,p=u+s.ageHeader;let f=Math.min(p-s.partTarget,1.5*s.targetduration);if(f>0){if(i&&f>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${f} with playlist age: ${s.age}`),f=0;else{const e=Math.floor(f/s.targetduration);if(n+=e,void 0!==l){l+=Math.round(f%s.targetduration/s.partTarget)}this.log(`CDN Tune-in age: ${s.ageHeader}s last advanced ${u.toFixed(2)}s goal: ${f} skip sn ${e} to part ${l}`)}s.tuneInGoal=f}if(o=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l),e||!h)return void this.loadPlaylist(o)}else(s.canBlockReload||s.canSkipUntil)&&(o=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l));const d=this.hls.mainForwardBufferInfo,h=d?d.end-d.len:0,c=function(e,t=1/0){let i=1e3*e.targetduration;if(e.updated){const s=e.fragments,r=4;if(s.length&&i*r>t){const e=1e3*s[s.length-1].duration;ethis.requestScheduled+c&&(this.requestScheduled=r.loading.start),void 0!==n&&s.canBlockReload?this.requestScheduled=r.loading.first+c-(1e3*s.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+cthis.loadPlaylist(o)),u)}else this.clearTimer()}getDeliveryDirectives(e,t,i,s){let r=function(e,t){const{canSkipUntil:i,canSkipDateRanges:s,endSN:r}=e;return i&&(void 0!==t?t-r:0)=o.maxNumRetry)return!1;if(i&&null!=(l=e.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const e=qp(o,a);this.timer=self.setTimeout((()=>this.loadPlaylist()),e),this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" in ${e}ms`)}e.levelRetry=!0,s.resolved=!0}return n}}class hf{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class cf{constructor(e,t,i,s=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new hf(e),this.fast_=new hf(t),this.defaultTTFB_=s,this.ttfb_=new hf(e)}update(e,t){const{slow_:i,fast_:s,ttfb_:r}=this;i.halfLife!==e&&(this.slow_=new hf(e,i.getEstimate(),i.getTotalWeight())),s.halfLife!==t&&(this.fast_=new hf(t,s.getEstimate(),s.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new hf(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){const i=(e=Math.max(e,this.minDelayMs_))/1e3,s=8*t/i;this.fast_.sample(i,s),this.slow_.sample(i,s)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const uf={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},pf={};function ff(e,t,i,s,r,a){const o=e.audioCodec?e.audioGroups:null,n=null==a?void 0:a.audioCodec,l=null==a?void 0:a.channels,d=l?parseInt(l):n?1/0:2;let h=null;if(null!=o&&o.length)try{h=1===o.length&&o[0]?t.groups[o[0]].channels:o.reduce(((e,i)=>{if(i){const s=t.groups[i];if(!s)throw new Error(`Audio track group ${i} not found`);Object.keys(s.channels).forEach((t=>{e[t]=(e[t]||0)+s.channels[t]}))}return e}),{2:0})}catch(e){return!0}return void 0!==e.videoCodec&&(e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(s,30)||"SDR"!==e.videoRange&&e.videoRange!==i||e.bitrate>Math.max(r,8e6))||!!h&&ec(d)&&Object.keys(h).some((e=>parseInt(e)>d))}function mf(e,t,i){const s=e.videoCodec,r=e.audioCodec;if(!s||!r||!i)return Promise.resolve(uf);const a={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},o=e.videoRange;"SDR"!==o&&(a.transferFunction=o.toLowerCase());const n=s.split(",").map((e=>({type:"media-source",video:Yh(Yh({},a),{},{contentType:ju(e,"video")})})));return r&&e.audioGroups&&e.audioGroups.forEach((e=>{var i;e&&(null==(i=t.groups[e])||i.tracks.forEach((t=>{if(t.groupId===e){const e=t.channels||"",i=parseFloat(e);ec(i)&&i>2&&n.push.apply(n,r.split(",").map((e=>({type:"media-source",audio:{contentType:ju(e,"audio"),channels:""+i}}))))}})))})),Promise.all(n.map((e=>{const t=function(e){const{audio:t,video:i}=e,s=i||t;if(s){const e=s.contentType.split('"')[1];if(i)return`r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${e}_${Math.ceil(i.bitrate/1e5)}`;if(t)return`c${t.channels}${t.spatialRendering?"s":"n"}_${e}`}return""}(e);return pf[t]||(pf[t]=i.decodingInfo(e))}))).then((e=>({supported:!e.some((e=>!e.supported)),configurations:n,decodingInfoResults:e}))).catch((e=>({supported:!1,configurations:n,decodingInfoResults:[],error:e})))}function gf(e,t){let i=!1,s=[];return e&&(i="SDR"!==e,s=[e]),t&&(s=t.allowedVideoRanges||Lp.slice(0),i=void 0!==t.preferHDR?t.preferHDR:function(){if("function"==typeof matchMedia){const e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}(),s=i?s.filter((e=>"SDR"!==e)):["SDR"]),{preferHDR:i,allowedVideoRanges:s}}function yf(e,t){hc.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function Af(e,t,i){if("attrs"in e){const i=t.indexOf(e);if(-1!==i)return i}for(let s=0;s-1===s.indexOf(e)))}(n,t.characteristics))&&(void 0===i||i(e,t))}function vf(e,t){const{audioCodec:i,channels:s}=e;return!(void 0!==i&&(t.audioCodec||"").substring(0,4)!==i.substring(0,4)||void 0!==s&&s!==(t.channels||"2"))}function _f(e,t,i){for(let s=t;s;s--)if(i(e[s]))return s;for(let s=t+1;s1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var wf="NOT_LOADED",Ef="APPENDING",Tf="PARTIAL",kf="OK";class Cf{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(sc.BUFFER_APPENDED,this.onBufferAppended,this),e.on(sc.FRAG_BUFFERED,this.onFragBuffered,this),e.on(sc.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(sc.BUFFER_APPENDED,this.onBufferAppended,this),e.off(sc.FRAG_BUFFERED,this.onFragBuffered,this),e.off(sc.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let t=i.length;t--;){const s=i[t];if(!s)break;const r=s.end;if(s.start<=e&&null!==r&&e<=r)return s}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:i}=this,s=Object.keys(i);for(let r=s.length;r--;){const a=i[s[r]];if((null==a?void 0:a.body.type)===t&&a.buffered){const t=a.body;if(t.start<=e&&e<=t.end)return t}}return null}detectEvictedFragments(e,t,i,s){this.timeRanges&&(this.timeRanges[e]=t);const r=(null==s?void 0:s.fragment.sn)||-1;Object.keys(this.fragments).forEach((s=>{const a=this.fragments[s];if(!a)return;if(r>=a.body.sn)return;if(!a.buffered&&!a.loaded)return void(a.body.type===i&&this.removeFragment(a.body));const o=a.range[e];o&&o.time.some((e=>{const i=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return i&&this.removeFragment(a.body),i}))}))}detectPartialFragments(e){const t=this.timeRanges,{frag:i,part:s}=e;if(!t||"initSegment"===i.sn)return;const r=Rf(i),a=this.fragments[r];if(!a||a.buffered&&i.gap)return;const o=!i.relurl;if(Object.keys(t).forEach((e=>{const r=i.elementaryStreams[e];if(!r)return;const n=t[e],l=o||!0===r.partial;a.range[e]=this.getBufferedTimes(i,s,l,n)})),a.loaded=null,Object.keys(a.range).length){a.buffered=!0;(a.body.endList=i.endList||a.body.endList)&&(this.endListFragments[a.body.type]=a),xf(a)||this.removeParts(i.sn-1,i.type)}else this.removeFragment(a.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter((t=>t.fragment.sn>=e)))}fragBuffered(e,t){const i=Rf(e);let s=this.fragments[i];!s&&t&&(s=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),s&&(s.loaded=null,s.buffered=!0)}getBufferedTimes(e,t,i,s){const r={time:[],partial:i},a=e.start,o=e.end,n=e.minEndPTS||o,l=e.maxStartPTS||a;for(let e=0;e=t&&n<=i){r.time.push({startPTS:Math.max(a,s.start(e)),endPTS:Math.min(o,s.end(e))});break}if(at){const t=Math.max(a,s.start(e)),i=Math.min(o,s.end(e));i>t&&(r.partial=!0,r.time.push({startPTS:t,endPTS:i}))}else if(o<=t)break}return r}getPartialFragment(e){let t,i,s,r=null,a=0;const{bufferPadding:o,fragments:n}=this;return Object.keys(n).forEach((l=>{const d=n[l];d&&xf(d)&&(i=d.body.start-o,s=d.body.end+o,e>=i&&e<=s&&(t=Math.min(e-i,s-e),a<=t&&(r=d.body,a=t)))})),r}isEndListAppended(e){const t=this.endListFragments[e];return void 0!==t&&(t.buffered||xf(t))}getState(e){const t=Rf(e),i=this.fragments[t];return i?i.buffered?xf(i)?Tf:kf:Ef:wf}isTimeBuffered(e,t,i){let s,r;for(let a=0;a=s&&t<=r)return!0;if(t<=s)return!1}return!1}onFragLoaded(e,t){const{frag:i,part:s}=t;if("initSegment"===i.sn||i.bitrateTest)return;const r=s?null:t,a=Rf(i);this.fragments[a]={body:i,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:s,timeRanges:r}=t;if("initSegment"===i.sn)return;const a=i.type;if(s){let e=this.activePartLists[a];e||(this.activePartLists[a]=e=[]),e.push(s)}this.timeRanges=r,Object.keys(r).forEach((e=>{const t=r[e];this.detectEvictedFragments(e,t,a,s)}))}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Rf(e);return!!this.fragments[t]}hasParts(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)}removeFragmentsInRange(e,t,i,s,r){s&&!this.hasGaps||Object.keys(this.fragments).forEach((a=>{const o=this.fragments[a];if(!o)return;const n=o.body;n.type!==i||s&&!n.gap||n.starte&&(o.buffered||r)&&this.removeFragment(n)}))}removeFragment(e){const t=Rf(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const t=e.sn;this.activePartLists[e.type]=i.filter((e=>e.fragment.sn!==t))}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function xf(e){var t,i,s;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(i=e.range.audio)?void 0:i.partial)||(null==(s=e.range.audiovideo)?void 0:s.partial))}function Rf(e){return`${e.type}_${e.level}_${e.sn}`}const Df={length:0,start:()=>0,end:()=>0};class Lf{static isBuffered(e,t){try{if(e){const i=Lf.getBuffered(e);for(let e=0;e=i.start(e)&&t<=i.end(e))return!0}}catch(e){}return!1}static bufferInfo(e,t,i){try{if(e){const s=Lf.getBuffered(e),r=[];let a;for(a=0;aa&&(s[r-1].end=e[t].end):s.push(e[t])}else s.push(e[t])}else s=e;let r,a=0,o=t,n=t;for(let e=0;e=l&&ti.startCC||e&&e.cc{if(this.loader&&this.loader.destroy(),e.gap){if(e.tagList.some((e=>"GAP"===e[0])))return void n(zf(e));e.gap=!1}const l=this.loader=e.loader=r?new r(s):new a(s),d=jf(e),h=Kp(s.fragLoadPolicy.default),c={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:Of};e.stats=l.stats,l.load(d,c,{onSuccess:(t,i,s,r)=>{this.resetLoader(e,l);let a=t.data;s.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(a.slice(0,16)),a=a.slice(16)),o({frag:e,part:null,payload:a,networkDetails:r})},onError:(t,s,r,a)=>{this.resetLoader(e,l),n(new Gf({type:rc.NETWORK_ERROR,details:ac.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Yh({url:i,data:void 0},t),error:new Error(`HTTP Error ${t.code} ${t.text}`),networkDetails:r,stats:a}))},onAbort:(t,i,s)=>{this.resetLoader(e,l),n(new Gf({type:rc.NETWORK_ERROR,details:ac.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:s,stats:t}))},onTimeout:(t,i,s)=>{this.resetLoader(e,l),n(new Gf({type:rc.NETWORK_ERROR,details:ac.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:s,stats:t}))},onProgress:(i,s,r,a)=>{t&&t({frag:e,part:null,payload:r,networkDetails:a})}})}))}loadPart(e,t,i){this.abort();const s=this.config,r=s.fLoader,a=s.loader;return new Promise(((o,n)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap)return void n(zf(e,t));const l=this.loader=e.loader=r?new r(s):new a(s),d=jf(e,t),h=Kp(s.fragLoadPolicy.default),c={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Of};t.stats=l.stats,l.load(d,c,{onSuccess:(s,r,a,n)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const d={frag:e,part:t,payload:s.data,networkDetails:n};i(d),o(d)},onError:(i,s,r,a)=>{this.resetLoader(e,l),n(new Gf({type:rc.NETWORK_ERROR,details:ac.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Yh({url:d.url,data:void 0},i),error:new Error(`HTTP Error ${i.code} ${i.text}`),networkDetails:r,stats:a}))},onAbort:(i,s,r)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),n(new Gf({type:rc.NETWORK_ERROR,details:ac.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:r,stats:i}))},onTimeout:(i,s,r)=>{this.resetLoader(e,l),n(new Gf({type:rc.NETWORK_ERROR,details:ac.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:r,stats:i}))}})}))}updateStatsFromPart(e,t){const i=e.stats,s=t.stats,r=s.total;if(i.loaded+=s.loaded,r){const s=Math.round(e.duration/t.duration),a=Math.min(Math.round(i.loaded/r),s),o=(s-a)*Math.round(i.loaded/a);i.total=i.loaded+o}else i.total=Math.max(i.loaded,i.total);const a=i.loading,o=s.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function jf(e,t=null){const i=t||e,s={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},r=i.byteRangeStartOffset,a=i.byteRangeEndOffset;if(ec(r)&&ec(a)){var o;let t=r,i=a;if("initSegment"===e.sn&&"AES-128"===(null==(o=e.decryptdata)?void 0:o.method)){const e=a-r;e%16&&(i=a+(16-e%16)),0!==r&&(s.resetIV=!0,t=r-16)}s.rangeStart=t,s.rangeEnd=i}return s}function zf(e,t){const i=new Error(`GAP ${e.gap?"tag":"attribute"} found`),s={type:rc.MEDIA_ERROR,details:ac.FRAG_GAP,fatal:!1,frag:e,error:i,networkDetails:null};return t&&(s.part=t),(t||e).stats.aborted=!0,new Gf(s)}class Gf extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Hf{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class Vf{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}class $f{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let e=0;e<4;e++)i[e]=t.getUint32(4*e);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,s=i[0],r=i[1],a=i[2],o=i[3],n=this.invSubMix,l=n[0],d=n[1],h=n[2],c=n[3],u=new Uint32Array(256);let p=0,f=0,m=0;for(m=0;m<256;m++)u[m]=m<128?m<<1:m<<1^283;for(m=0;m<256;m++){let i=f^f<<1^f<<2^f<<3^f<<4;i=i>>>8^255&i^99,e[p]=i,t[i]=p;const n=u[p],m=u[n],g=u[m];let y=257*u[i]^16843008*i;s[p]=y<<24|y>>>8,r[p]=y<<16|y>>>16,a[p]=y<<8|y>>>24,o[p]=y,y=16843009*g^65537*m^257*n^16843008*p,l[i]=y<<24|y>>>8,d[i]=y<<16|y>>>16,h[i]=y<<8|y>>>24,c[i]=y,p?(p=n^u[u[u[g^n]]],f^=u[u[f]]):p=f=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,s=0;for(;s{if(!s)return Promise.reject(new Error("web crypto not initialized"));this.logOnce("WebCrypto AES decrypt");return new Hf(s,new Uint8Array(i)).decrypt(e.buffer,t)})).catch((s=>(hc.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,i))))}onWebCryptoError(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);const s=this.flush();if(s)return s.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%16;return i!==e.length&&(t=Nc(e,0,i),this.remainderData=Nc(e,i)),t}logOnce(e){this.logEnabled&&(hc.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Jf=function(e){let t="";const i=e.length;for(let s=0;so.end){const e=a>r;(a{if(this.fragContextChanged(e))return this.warn(`Fragment ${e.sn}${t.part?" p: "+t.part.index:""} of level ${e.level} was dropped during download.`),void this.fragmentTracker.removeFragment(e);e.stats.chunkCount++,this._handleFragmentLoadProgress(t)})).then((t=>{if(!t)return;const i=this.state;this.fragContextChanged(e)?(i===Qf||!this.fragCurrent&&i===em)&&(this.fragmentTracker.removeFragment(e),this.state=Kf):("payload"in t&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(sc.FRAG_LOADED,t)),this._handleFragmentLoadComplete(t))})).catch((t=>{this.state!==qf&&this.state!==sm&&(this.warn(t),this.resetFragmentLoading(e))}))}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===Ef){const t=e.type,s=this.getFwdBufferInfo(this.mediaBuffer,t),r=Math.max(e.duration,s?s.len:this.config.maxBufferLength);this.reduceMaxBufferLength(r)&&i.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===Tf&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const s={startOffset:e,endOffset:t,type:i};this.hls.trigger(sc.BUFFER_FLUSHING,s)}_loadInitSegment(e,t){this._doFragLoad(e,t).then((t=>{if(!t||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return t})).then((t=>{const{hls:i}=this,{payload:s}=t,r=e.decryptdata;if(s&&s.byteLength>0&&null!=r&&r.key&&r.iv&&"AES-128"===r.method){const a=self.performance.now();return this.decrypter.decrypt(new Uint8Array(s),r.key.buffer,r.iv.buffer).catch((t=>{throw i.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t})).then((s=>{const r=self.performance.now();return i.trigger(sc.FRAG_DECRYPTED,{frag:e,payload:s,stats:{tstart:a,tdecrypt:r}}),t.payload=s,this.completeInitSegmentLoad(t)}))}return this.completeInitSegmentLoad(t)})).catch((t=>{this.state!==qf&&this.state!==sm&&(this.warn(t),this.resetFragmentLoading(e))}))}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state=Kf,e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var i,s,r,a;const o=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===hp?"level":"track"} ${e.level} (frag:[${(null!=(i=e.startPTS)?i:NaN).toFixed(3)}-${(null!=(s=e.endPTS)?s:NaN).toFixed(3)}] > buffer:${o?Jf(Lf.getBuffered(o)):"(detached)"})`),"initSegment"!==e.sn){var n;if(e.type!==up){const t=e.elementaryStreams;if(!Object.keys(t).some((e=>!!t[e])))return void(this.state=Kf)}const t=null==(n=this.levels)?void 0:n[e.level];null!=t&&t.fragmentError&&(this.log(`Resetting level fragment error count of ${t.fragmentError} on frag buffered`),t.fragmentError=0)}this.state=Kf,o&&(!this.loadedmetadata&&e.type==hp&&o.buffered.length&&(null==(r=this.fragCurrent)?void 0:r.sn)===(null==(a=this.fragPrevious)?void 0:a.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:s,partsLoaded:r}=e,a=!r||0===r.length||r.some((e=>!e)),o=new Pf(i.level,i.sn,i.stats.chunkCount+1,0,s?s.index:-1,!a);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,s){var r;const a=null==t?void 0:t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;if(!e.encrypted||null!=(r=e.decryptdata)&&r.key?!e.encrypted&&a.encryptedFragments.length&&this.keyLoader.loadClear(e,a.encryptedFragments):(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${"[stream-controller]"===this.logPrefix?"level":"track"} ${e.level}`),this.state=Yf,this.fragCurrent=e,o=this.keyLoader.load(e).then((e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(sc.KEY_LOADED,e),this.state===Yf&&(this.state=Kf),e})),this.hls.trigger(sc.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&"initSegment"!==e.sn){const r=a.partList;if(r&&s){i>e.end&&a.fragmentHint&&(e=a.fragmentHint);const n=this.getNextPart(r,e,i);if(n>-1){const l=r[n];let d;return this.log(`Loading part sn: ${e.sn} p: ${l.index} cc: ${e.cc} of playlist [${a.startSN}-${a.endSN}] parts [0-${n}-${r.length-1}] ${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=l.start+l.duration,this.state=Qf,d=o?o.then((i=>!i||this.fragContextChanged(i.frag)?null:this.doFragPartsLoad(e,l,t,s))).catch((e=>this.handleFragLoadError(e))):this.doFragPartsLoad(e,l,t,s).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(sc.FRAG_LOADING,{frag:e,part:l,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}if(!e.url||this.loadedEndOfParts(r,i))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${a?"of ["+a.startSN+"-"+a.endSN+"] ":""}${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),ec(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Qf;const n=this.config.progressive;let l;return l=n&&o?o.then((t=>!t||this.fragContextChanged(null==t?void 0:t.frag)?null:this.fragmentLoader.load(e,s))).catch((e=>this.handleFragLoadError(e))):Promise.all([this.fragmentLoader.load(e,n?s:void 0),o]).then((([e])=>(!n&&e&&s&&s(e),e))).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(sc.FRAG_LOADING,{frag:e,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(e,t,i,s){return new Promise(((r,a)=>{var o;const n=[],l=null==(o=i.details)?void 0:o.partList,d=t=>{this.fragmentLoader.loadPart(e,t,s).then((s=>{n[t.index]=s;const a=s.part;this.hls.trigger(sc.FRAG_LOADED,s);const o=Hp(i,e.sn,t.index+1)||Vp(l,e.sn,t.index+1);if(!o)return r({frag:e,part:a,partsLoaded:n});d(o)})).catch(a)};d(t)}))}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===ac.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(sc.ERROR,t)}else this.hls.trigger(sc.ERROR,{type:rc.OTHER_ERROR,details:ac.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==em)return void(this.fragCurrent||this.state===qf||this.state===sm||(this.state=Kf));const{frag:i,part:s,level:r}=t,a=self.performance.now();i.stats.parsing.end=a,s&&(s.stats.parsing.end=a),this.updateLevelTiming(i,s,r,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:s,sn:r,part:a}=e;if(null==t||!t[s])return this.warn(`Levels object was unset while buffering fragment ${r} of level ${s}. The current chunk will not be buffered.`),null;const o=t[s],n=a>-1?Hp(o,r,a):null,l=n?n.fragment:function(e,t,i){if(null==e||!e.details)return null;const s=e.details;let r=s.fragments[t-s.startSN];return r||(r=s.fragmentHint,r&&r.sn===t?r:ta&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){const i=this.getLoadPosition();return ec(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){const{config:{maxBufferHole:s}}=this,r=Lf.bufferInfo(e,t,s);if(0===r.len&&void 0!==r.nextStart){const a=this.fragmentTracker.getBufferedFrag(t,i);if(a&&r.nextStart=i&&(t.maxMaxBufferLength/=2,this.warn(`Reduce max buffer length to ${t.maxMaxBufferLength}s`),!0)}getAppendedFrag(e,t=hp){const i=this.fragmentTracker.getAppendedFrag(e,hp);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,s=i.length;if(!s)return null;const{config:r}=this,a=i[0].start;let o;if(t.live){const n=r.initialLiveManifestSize;if(st}getNextFragmentLoopLoading(e,t,i,s,r){const a=e.gap,o=this.getNextFragment(this.nextLoadPosition,t);if(null===o)return o;if(e=o,a&&e&&!e.gap&&i.nextStart){const t=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,s);if(null!==t&&i.len+t.len>=r)return this.log(`buffer full after gaps in "${s}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment}getNextPart(e,t,i){let s=-1,r=!1,a=!0;for(let o=0,n=e.length;o-1&&ii.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let s=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),s=function(e,t,i){if(null===t||!Array.isArray(e)||!e.length||!ec(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;i=i||0;for(let s=0;s=e.startSN&&r<=e.endSN){const a=t[r-e.startSN];i.cc===a.cc&&(s=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${s.sn}`))}s||(s=function(e,t){return Qp(e,(e=>e.cct?-1:0))}(t,i.cc),s&&this.log(`Live playlist, switching playlist, load frag with same CC: ${s.sn}`))}}else{const t=this.hls.liveSyncPosition;null!==t&&(s=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return s}getFragmentAtPosition(e,t,i){const{config:s}=this;let{fragPrevious:r}=this,{fragments:a,endSN:o}=i;const{fragmentHint:n}=i,l=s.maxFragLookUpTolerance,d=i.partList,h=!!(s.lowLatencyMode&&null!=d&&d.length&&n);let c;if(h&&n&&!this.bitrateTest&&(a=a.concat(n),o=n.sn),et-l?0:l)}else c=a[a.length-1];if(c){const e=c.sn-i.startSN,t=this.fragmentTracker.getState(c);if((t===kf||t===Tf&&c.gap)&&(r=c),r&&c.sn===r.sn&&(!h||d[0].fragment.sn>c.sn)){if(r&&c.level===r.level){const t=a[e+1];c=c.sn=a-t.maxFragLookUpTolerance&&r<=o;if(null!==s&&i.duration>s&&(r${e.startSN} prev-sn: ${r?r.sn:"na"} fragments: ${s}`),a}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}setStartPosition(e,t){let i=this.startPosition;if(i ${null==(s=this.fragCurrent)?void 0:s.url}`);const r=t.details===ac.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(i,!0);const a=t.errorAction,{action:o,retryCount:n=0,retryConfig:l}=a||{};if(a&&o===af&&l){this.resetStartWhenNotLoaded(this.levelLastLoaded);const s=qp(l,n);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${n+1}/${l.maxNumRetry} in ${s}ms`),a.resolved=!0,this.retryDate=self.performance.now()+s,this.state=Xf}else if(l&&a){if(this.resetFragmentErrors(e),!(n.5;s&&this.reduceMaxBufferLength(i.len);const r=!s;return r&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${t} buffer`),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),r}return!1}resetFragmentErrors(e){e===cp&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==qf&&(this.state=Kf)}afterBufferFlushed(e,t,i){if(!e)return;const s=Lf.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,s,i),this.state===im&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Kf}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;null!=t&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,s){var r;const a=i.details;if(!a)return void this.warn("level.details undefined");if(!Object.keys(e.elementaryStreams).reduce(((t,r)=>{const o=e.elementaryStreams[r];if(o){const n=o.endPTS-o.startPTS;if(n<=0)return this.warn(`Could not parse fragment ${e.sn} ${r} duration reliably (${n})`),t||!1;const l=s?0:Np(a,e,o.startPTS,o.endPTS,o.startDTS,o.endDTS);return this.hls.trigger(sc.LEVEL_PTS_UPDATED,{details:a,level:i,drift:l,type:r,frag:e,start:o.startPTS,end:o.endPTS}),!0}return t}),!1)&&null===(null==(r=this.transmuxer)?void 0:r.error)){const t=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(0===i.fragmentError&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(t.message),this.hls.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=tm,this.hls.trigger(sc.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class nm{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;return e.length?(i=1===e.length?e[0]:function(e,t){const i=new Uint8Array(t);let s=0;for(let t=0;t0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:_p,duration:Number.POSITIVE_INFINITY});r{if(ec(e))return 90*e;return 9e4*t+(i?9e4*i.baseTime/i.timescale:0)};function cm(e,t){return 255===e[t]&&240==(246&e[t+1])}function um(e,t){return 1&e[t+1]?7:9}function pm(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function fm(e,t){return t+1=e.length)return!1;const s=pm(e,t);if(s<=i)return!1;const r=t+s;return r===e.length||fm(e,r)}return!1}function gm(e,t,i,s,r){if(!e.samplerate){const a=function(e,t,i,s){let r,a,o,n;const l=navigator.userAgent.toLowerCase(),d=s,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=1+((192&t[i+2])>>>6);const c=(60&t[i+2])>>>2;if(!(c>h.length-1))return o=(1&t[i+2])<<2,o|=(192&t[i+3])>>>6,hc.log(`manifest codec:${s}, ADTS type:${r}, samplingIndex:${c}`),/firefox/i.test(l)?c>=6?(r=5,n=new Array(4),a=c-3):(r=2,n=new Array(2),a=c):-1!==l.indexOf("android")?(r=2,n=new Array(2),a=c):(r=5,n=new Array(4),s&&(-1!==s.indexOf("mp4a.40.29")||-1!==s.indexOf("mp4a.40.5"))||!s&&c>=6?a=c-3:((s&&-1!==s.indexOf("mp4a.40.2")&&(c>=6&&1===o||/vivaldi/i.test(l))||!s&&1===o)&&(r=2,n=new Array(2)),a=c)),n[0]=r<<3,n[0]|=(14&c)>>1,n[1]|=(1&c)<<7,n[1]|=o<<3,5===r&&(n[1]|=(14&a)>>1,n[2]=(1&a)<<7,n[2]|=8,n[3]=0),{config:n,samplerate:h[c],channelCount:o,codec:"mp4a.40."+r,manifestCodec:d};{const t=new Error(`invalid ADTS sampling index:${c}`);e.emit(sc.ERROR,sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message})}}(t,i,s,r);if(!a)return;e.config=a.config,e.samplerate=a.samplerate,e.channelCount=a.channelCount,e.codec=a.codec,e.manifestCodec=a.manifestCodec,hc.log(`parsed codec:${e.codec}, rate:${a.samplerate}, channels:${a.channelCount}`)}}function ym(e){return 9216e4/e}function Am(e,t,i,s,r){const a=s+r*ym(e.samplerate),o=function(e,t){const i=um(e,t);if(t+i<=e.length){const s=pm(e,t)-i;if(s>0)return{headerLength:i,frameLength:s}}}(t,i);let n;if(o){const{frameLength:s,headerLength:r}=o,l=r+s,d=Math.max(0,i+l-t.length);d?(n=new Uint8Array(l-r),n.set(t.subarray(i+r,t.length),0)):n=t.subarray(i+r,i+l);const h={unit:n,pts:a};return d||e.samples.push(h),{sample:h,length:l,missing:d}}const l=t.length-i;n=new Uint8Array(l),n.set(t.subarray(i,t.length),0);return{sample:{unit:n,pts:a},length:l,missing:-1}}let bm=null;const vm=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],_m=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Sm=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],wm=[0,1,1,4];function Em(e,t,i,s,r){if(i+24>t.length)return;const a=Tm(t,i);if(a&&i+a.frameLength<=t.length){const o=s+r*(9e4*a.samplesPerFrame/a.sampleRate),n={unit:t.subarray(i,i+a.frameLength),pts:o,dts:o};return e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(n),{sample:n,length:a.frameLength,missing:0}}}function Tm(e,t){const i=e[t+1]>>3&3,s=e[t+1]>>1&3,r=e[t+2]>>4&15,a=e[t+2]>>2&3;if(1!==i&&0!==r&&15!==r&&3!==a){const o=e[t+2]>>1&1,n=e[t+3]>>6,l=1e3*vm[14*(3===i?3-s:3===s?3:4)+r-1],d=_m[3*(3===i?0:2===i?1:2)+a],h=3===n?1:2,c=Sm[i][s],u=wm[s],p=8*c*u,f=Math.floor(c*l/d+o)*u;if(null===bm){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);bm=e?parseInt(e[1]):0}return!!bm&&bm<=87&&2===s&&l>=224e3&&0===n&&(e[t+3]=128|e[t+3]),{sampleRate:d,channelCount:h,frameLength:f,samplesPerFrame:p}}}function km(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function Cm(e,t){return t+1{let i=0,s=5;t+=s;const r=new Uint32Array(1),a=new Uint32Array(1),o=new Uint8Array(1);for(;s>0;){o[0]=e[t];const n=Math.min(s,8),l=8-n;a[0]=4278190080>>>24+l<>l,i=i?i<t.length)return-1;if(11!==t[i]||119!==t[i+1])return-1;const a=t[i+4]>>6;if(a>=3)return-1;const o=[48e3,44100,32e3][a],n=63&t[i+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*n+a];if(i+l>t.length)return-1;const d=t[i+6]>>5;let h=0;2===d?h+=2:(1&d&&1!==d&&(h+=2),4&d&&(h+=2));const c=(t[i+6]<<8|t[i+7])>>12-h&1,u=[2,1,2,3,3,4,4,5][d]+c,p=t[i+5]>>3,f=7&t[i+5],m=new Uint8Array([a<<6|p<<1|f>>2,(3&f)<<6|d<<3|c<<2|n>>4,n<<4&224]),g=s+r*(1536/o*9e4),y=t.subarray(i,i+l);return e.config=m,e.channelCount=u,e.samplerate=o,e.samples.push({unit:y,pts:g}),l}class Bm{constructor(){this.VideoSample=null}createVideoSample(e,t,i,s){return{key:e,frame:!1,pts:t,dts:i,units:[],debug:s,length:0}}getLastNalUnit(e){var t;let i,s=this.VideoSample;if(s&&0!==s.units.length||(s=e[e.length-1]),null!=(t=s)&&t.units){const e=s.units;i=e[e.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){const i=t.samples,s=i.length;if(!s)return void t.dropped++;{const t=i[s-1];e.pts=t.pts,e.dts=t.dts}}t.samples.push(e)}e.debug.length&&hc.log(e.pts+"/"+e.dts+":"+e.debug)}}class Im{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,s=new Uint8Array(4),r=Math.min(4,t);if(0===r)throw new Error("no bytes available");s.set(e.subarray(i,i+r)),this.word=new DataView(s.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(t=(e-=this.bitsAvailable)>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&hc.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return t=e-t,t>0&&this.bitsAvailable?i<>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t,i=8,s=8;for(let r=0;r{var a;switch(s.type){case 1:{let t=!1;o=!0;const r=s.data;if(l&&r.length>4){const e=new Im(r).readSliceType();2!==e&&4!==e&&7!==e&&9!==e||(t=!0)}var d;if(t)null!=(d=n)&&d.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null);n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),n.frame=!0,n.key=t;break}case 5:o=!0,null!=(a=n)&&a.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null),n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),n.key=!0,n.frame=!0;break;case 6:o=!0,Tu(s.data,1,i.pts,t.samples);break;case 7:{var h,c;o=!0,l=!0;const t=s.data,i=new Im(t).readSPS();if(!e.sps||e.width!==i.width||e.height!==i.height||(null==(h=e.pixelRatio)?void 0:h[0])!==i.pixelRatio[0]||(null==(c=e.pixelRatio)?void 0:c[1])!==i.pixelRatio[1]){e.width=i.width,e.height=i.height,e.pixelRatio=i.pixelRatio,e.sps=[t],e.duration=r;const s=t.subarray(1,4);let a="avc1.";for(let e=0;e<3;e++){let t=s[e].toString(16);t.length<2&&(t="0"+t),a+=t}e.codec=a}break}case 8:o=!0,e.pps=[s.data];break;case 9:o=!0,e.audFound=!0,n&&this.pushAccessUnit(n,e),n=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"");break;case 12:o=!0;break;default:o=!1,n&&(n.debug+="unknown NAL "+s.type+" ")}if(n&&o){n.units.push(s)}})),s&&n&&(this.pushAccessUnit(n,e),this.VideoSample=null)}parseAVCNALu(e,t){const i=t.byteLength;let s=e.naluState||0;const r=s,a=[];let o,n,l,d=0,h=-1,c=0;for(-1===s&&(h=0,c=31&t[0],s=0,d=1);d=0){const e={data:t.subarray(h,n),type:c};a.push(e)}else{const i=this.getLastNalUnit(e.samples);i&&(r&&d<=4-r&&i.state&&(i.data=i.data.subarray(0,i.data.byteLength-r)),n>0&&(i.data=Su(i.data,t.subarray(0,n)),i.state=0))}d=0&&s>=0){const e={data:t.subarray(h,i),type:c,state:s};a.push(e)}if(0===a.length){const i=this.getLastNalUnit(e.samples);i&&(i.data=Su(i.data,t))}return e.naluState=s,a}}class Um{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Wf(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){const s=e[t].unit;if(s.length<=16)return;const r=s.subarray(16,s.length-s.length%16),a=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(a).then((r=>{const a=new Uint8Array(r);s.set(a,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}))}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t);let s=0;for(let t=32;t{r.data=this.getAvcDecryptedUnit(a,o),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,s)}))}decryptAvcSamples(e,t,i,s){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void s();const r=e[t].units;for(;!(i>=r.length);i++){const a=r[i];if(!(a.data.length<=48||1!==a.type&&5!==a.type||(this.decryptAvcSample(e,t,i,s,a),this.decrypter.isSync())))return}}}}const Fm=188;class Om{constructor(e,t,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.videoParser=new Mm}static probe(e){const t=Om.syncOffset(e);return t>0&&hc.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),-1!==t}static syncOffset(e){const t=e.length;let i=Math.min(940,t-Fm)+1,s=0;for(;s1&&(0===a&&o>2||n+Fm>i))return a}s++}return-1}static createTrack(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:ou[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}resetInitSegment(e,t,i,s){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Om.createTrack("video"),this._audioTrack=Om.createTrack("audio",s),this._id3Track=Om.createTrack("id3"),this._txtTrack=Om.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=s}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,s=!1){let r;i||(this.sampleAes=null);const a=this._videoTrack,o=this._audioTrack,n=this._id3Track,l=this._txtTrack;let d=a.pid,h=a.pesData,c=o.pid,u=n.pid,p=o.pesData,f=n.pesData,m=null,g=this.pmtParsed,y=this._pmtId,A=e.length;if(this.remainderData&&(A=(e=Su(this.remainderData,e)).length,this.remainderData=null),A>4>1){if(v=t+5+e[t+4],v===t+Fm)continue}else v=t+4;switch(A){case d:s&&(h&&(r=Hm(h))&&this.videoParser.parseAVCPES(a,l,r,!1,this._duration),h={data:[],size:0}),h&&(h.data.push(e.subarray(v,t+Fm)),h.size+=t+Fm-v);break;case c:if(s){if(p&&(r=Hm(p)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,r);break;case"mp3":this.parseMPEGPES(o,r);break;case"ac3":this.parseAC3PES(o,r)}p={data:[],size:0}}p&&(p.data.push(e.subarray(v,t+Fm)),p.size+=t+Fm-v);break;case u:s&&(f&&(r=Hm(f))&&this.parseID3PES(n,r),f={data:[],size:0}),f&&(f.data.push(e.subarray(v,t+Fm)),f.size+=t+Fm-v);break;case 0:s&&(v+=e[v]+1),y=this._pmtId=jm(e,v);break;case y:{s&&(v+=e[v]+1);const r=zm(e,v,this.typeSupported,i);d=r.videoPid,d>0&&(a.pid=d,a.segmentCodec=r.segmentVideoCodec),c=r.audioPid,c>0&&(o.pid=c,o.segmentCodec=r.segmentAudioCodec),u=r.id3Pid,u>0&&(n.pid=u),null===m||g||(hc.warn(`MPEG-TS PMT found at ${t} after unknown PID '${m}'. Backtracking to sync byte @${b} to parse all TS packets.`),m=null,t=b-188),g=this.pmtParsed=!0;break}case 17:case 8191:break;default:m=A}}else v++;if(v>0){const e=new Error(`Found ${v} TS packet/s that do not start with 0x47`);this.observer.emit(sc.ERROR,sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message})}a.pesData=h,o.pesData=p,n.pesData=f;const _={audioTrack:o,videoTrack:a,id3Track:n,textTrack:l};return s&&this.extractRemainingSamples(_),_}flush(){const{remainderData:e}=this;let t;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:s,textTrack:r}=e,a=i.pesData,o=t.pesData,n=s.pesData;let l;if(a&&(l=Hm(a))?(this.videoParser.parseAVCPES(i,r,l,!0,this._duration),i.pesData=null):i.pesData=a,o&&(l=Hm(o))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l)}t.pesData=null}else null!=o&&o.size&&hc.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;n&&(l=Hm(n))?(this.parseID3PES(s,l),s.pesData=null):s.pesData=n}demuxSampleAes(e,t,i){const s=this.demux(e,i,!0,!this.config.progressive),r=this.sampleAes=new Um(this.observer,this.config,t);return this.decrypt(s,r)}decrypt(e,t){return new Promise((i=>{const{audioTrack:s,videoTrack:r}=e;s.samples&&"aac"===s.segmentCodec?t.decryptAacSamples(s.samples,0,(()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,(()=>{i(e)})):i(e)})):r.samples&&t.decryptAvcSamples(r.samples,0,0,(()=>{i(e)}))}))}destroy(){this._duration=0}parseAACPES(e,t){let i=0;const s=this.aacOverFlow;let r,a,o,n=t.data;if(s){this.aacOverFlow=null;const t=s.missing,r=s.sample.unit.byteLength;if(-1===t)n=Su(s.sample.unit,n);else{const a=r-t;s.sample.unit.set(n.subarray(0,t),a),e.samples.push(s.sample),i=s.missing}}for(r=i,a=n.length;r0;)n+=a}}parseID3PES(e,t){if(void 0===t.pts)return void hc.warn("[tsdemuxer]: ID3 PES unknown PTS");const i=Zh({},t,{type:this._videoTrack?wp:_p,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function Nm(e,t){return((31&e[t+1])<<8)+e[t+2]}function jm(e,t){return(31&e[t+10])<<8|e[t+11]}function zm(e,t,i,s){const r={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t0){let s=t+5,n=o;for(;n>2;){if(106===e[s])!0!==i.ac3?hc.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=a,r.segmentAudioCodec="ac3");const t=e[s+1]+2;s+=t,n-=t}}break;case 194:case 135:hc.warn("Unsupported EC-3 in M2TS found");break;case 36:hc.warn("Unsupported HEVC in M2TS found")}t+=o+5}return r}function Gm(e){hc.log(`${e} with AES-128-CBC encryption found in unencrypted stream`)}function Hm(e){let t,i,s,r,a,o=0;const n=e.data;if(!e||0===e.size)return null;for(;n[0].length<19&&n.length>1;)n[0]=Su(n[0],n[1]),n.splice(1,1);t=n[0];if(1===(t[0]<<16)+(t[1]<<8)+t[2]){if(i=(t[4]<<8)+t[5],i&&i>e.size-6)return null;const l=t[7];192&l&&(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?(a=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2,r-a>54e5&&(hc.warn(`${Math.round((r-a)/9e4)}s delta between PTS and DTS, align them`),r=a)):a=r),s=t[8];let d=s+9;if(e.size<=d)return null;e.size-=d;const h=new Uint8Array(e.size);for(let e=0,i=n.length;ei){d-=i;continue}t=t.subarray(d),i-=d,d=0}h.set(t,o),o+=i}return i&&(i-=s+3),{data:h,pts:r,dts:a,len:i}}return null}class Vm{static getSilentFrame(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}const $m=Math.pow(2,32)-1;class Wm{static init(){let e;for(e in Wm.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},Wm.types)Wm.types.hasOwnProperty(e)&&(Wm.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=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]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);Wm.HDLR_TYPES={video:t,audio:i};const s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);Wm.STTS=Wm.STSC=Wm.STCO=r,Wm.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Wm.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Wm.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Wm.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),n=new Uint8Array([0,0,0,1]);Wm.FTYP=Wm.box(Wm.types.ftyp,a,n,a,o),Wm.DINF=Wm.box(Wm.types.dinf,Wm.box(Wm.types.dref,s))}static box(e,...t){let i=8,s=t.length;const r=s;for(;s--;)i+=t[s].byteLength;const a=new Uint8Array(i);for(a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=255&i,a.set(e,4),s=0,i=8;s>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s,85,196,0,0]))}static mdia(e){return Wm.box(Wm.types.mdia,Wm.mdhd(e.timescale,e.duration),Wm.hdlr(e.type),Wm.minf(e))}static mfhd(e){return Wm.box(Wm.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}static minf(e){return"audio"===e.type?Wm.box(Wm.types.minf,Wm.box(Wm.types.smhd,Wm.SMHD),Wm.DINF,Wm.stbl(e)):Wm.box(Wm.types.minf,Wm.box(Wm.types.vmhd,Wm.VMHD),Wm.DINF,Wm.stbl(e))}static moof(e,t,i){return Wm.box(Wm.types.moof,Wm.mfhd(e),Wm.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=Wm.trak(e[t]);return Wm.box.apply(null,[Wm.types.moov,Wm.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(Wm.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=Wm.trex(e[t]);return Wm.box.apply(null,[Wm.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/($m+1)),s=Math.floor(t%($m+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s,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 Wm.box(Wm.types.mvhd,r)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let s,r;for(s=0;s>>8&255),r.push(255&s),r=r.concat(Array.prototype.slice.call(i));for(t=0;t>>8&255),a.push(255&s),a=a.concat(Array.prototype.slice.call(i));const o=Wm.box(Wm.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(a))),n=e.width,l=e.height,d=e.pixelRatio[0],h=e.pixelRatio[1];return Wm.box(Wm.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,n>>8&255,255&n,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,Wm.box(Wm.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Wm.box(Wm.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,h>>24,h>>16&255,h>>8&255,255&h])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0])}static mp4a(e){return Wm.box(Wm.types.mp4a,Wm.audioStsd(e),Wm.box(Wm.types.esds,Wm.esds(e)))}static mp3(e){return Wm.box(Wm.types[".mp3"],Wm.audioStsd(e))}static ac3(e){return Wm.box(Wm.types["ac-3"],Wm.audioStsd(e),Wm.box(Wm.types.dac3,e.config))}static stsd(e){return"audio"===e.type?"mp3"===e.segmentCodec&&"mp3"===e.codec?Wm.box(Wm.types.stsd,Wm.STSD,Wm.mp3(e)):"ac3"===e.segmentCodec?Wm.box(Wm.types.stsd,Wm.STSD,Wm.ac3(e)):Wm.box(Wm.types.stsd,Wm.STSD,Wm.mp4a(e)):Wm.box(Wm.types.stsd,Wm.STSD,Wm.avc1(e))}static tkhd(e){const t=e.id,i=e.duration*e.timescale,s=e.width,r=e.height,a=Math.floor(i/($m+1)),o=Math.floor(i%($m+1));return Wm.box(Wm.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,o>>24,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>8&255,255&s,0,0,r>>8&255,255&r,0,0]))}static traf(e,t){const i=Wm.sdtp(e),s=e.id,r=Math.floor(t/($m+1)),a=Math.floor(t%($m+1));return Wm.box(Wm.types.traf,Wm.box(Wm.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s])),Wm.box(Wm.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,a>>24,a>>16&255,a>>8&255,255&a])),Wm.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,Wm.box(Wm.types.trak,Wm.tkhd(e),Wm.mdia(e))}static trex(e){const t=e.id;return Wm.box(Wm.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],s=i.length,r=12+16*s,a=new Uint8Array(r);let o,n,l,d,h,c;for(t+=8+r,a.set(["video"===e.type?1:0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,255&s,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),o=0;o>>24&255,l>>>16&255,l>>>8&255,255&l,d>>>24&255,d>>>16&255,d>>>8&255,255&d,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,61440&h.degradPrio,15&h.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*o);return Wm.box(Wm.types.trun,a)}static initSegment(e){Wm.types||Wm.init();const t=Wm.moov(e);return Su(Wm.FTYP,t)}}Wm.types=void 0,Wm.HDLR_TYPES=void 0,Wm.STTS=void 0,Wm.STSC=void 0,Wm.STCO=void 0,Wm.STSZ=void 0,Wm.VMHD=void 0,Wm.SMHD=void 0,Wm.STSD=void 0,Wm.FTYP=void 0,Wm.DINF=void 0;function Jm(e,t,i=1,s=!1){const r=e*t*i;return s?Math.round(r):r}function qm(e,t=!1){return Jm(e,1e3,1/9e4,t)}let Km,Ym=null,Qm=null;class Xm{constructor(e,t,i,s=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,null===Ym){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ym=e?parseInt(e[1]):0}if(null===Qm){const e=navigator.userAgent.match(/Safari\/(\d+)/i);Qm=e?parseInt(e[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){hc.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){hc.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){hc.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e.reduce(((e,i)=>{const s=i.pts-e;return s<-4294967296?(t=!0,Zm(e,i.pts)):s>0?e:i.pts}),e[0].pts);return t&&hc.debug("PTS rollover detected"),i}remux(e,t,i,s,r,a,o,n){let l,d,h,c,u,p,f=r,m=r;const g=e.pid>-1,y=t.pid>-1,A=t.samples.length,b=e.samples.length>0,v=o&&A>0||A>1;if((!g||b)&&(!y||v)||this.ISGenerated||o){if(this.ISGenerated){var _,S,w,E;const e=this.videoTrackConfig;!e||t.width===e.width&&t.height===e.height&&(null==(_=t.pixelRatio)?void 0:_[0])===(null==(S=e.pixelRatio)?void 0:S[0])&&(null==(w=t.pixelRatio)?void 0:w[1])===(null==(E=e.pixelRatio)?void 0:E[1])||this.resetInitSegment()}else h=this.generateIS(e,t,r,a);const i=this.isVideoContiguous;let s,o=-1;if(v&&(o=function(e){for(let t=0;t0){hc.warn(`[mp4-remuxer]: Dropped ${o} out of ${A} video samples due to a missing keyframe`);const e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(o),t.dropped+=o,m+=(t.samples[0].pts-e)/t.inputTimeScale,s=m}else-1===o&&(hc.warn(`[mp4-remuxer]: No keyframe found out of ${A} video samples`),p=!1);if(this.ISGenerated){if(b&&v){const i=this.getVideoStartPts(t.samples),s=(Zm(e.samples[0].pts,i)-i)/t.inputTimeScale;f+=Math.max(0,s),m+=Math.max(0,-s)}if(b){if(e.samplerate||(hc.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,r,a)),d=this.remuxAudio(e,f,this.isAudioContiguous,a,y||v||n===cp?m:void 0),v){const s=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(hc.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(e,t,r,a)),l=this.remuxVideo(t,m,i,s)}}else v&&(l=this.remuxVideo(t,m,i,0));l&&(l.firstKeyFrame=o,l.independent=-1!==o,l.firstKeyFramePTS=s)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(u=eg(i,r,this._initPTS,this._initDTS)),s.samples.length&&(c=tg(s,r,this._initPTS))),{audio:d,video:l,initSegment:h,independent:p,text:c,id3:u}}generateIS(e,t,i,s){const r=e.samples,a=t.samples,o=this.typeSupported,n={},l=this._initPTS;let d,h,c,u=!l||s,p="audio/mp4";if(u&&(d=h=1/0),e.config&&r.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(p="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}n.audio={id:"audio",container:p,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&o.mpeg?new Uint8Array(0):Wm.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(c=e.inputTimeScale,l&&c===l.timescale?u=!1:d=h=r[0].pts-Math.round(c*i))}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,n.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Wm.initSegment([t]),metadata:{width:t.width,height:t.height}},u)if(c=t.inputTimeScale,l&&c===l.timescale)u=!1;else{const e=this.getVideoStartPts(a),t=Math.round(c*i);h=Math.min(h,Zm(a[0].dts,e)-t),d=Math.min(d,e-t)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(n).length)return this.ISGenerated=!0,u?(this._initPTS={baseTime:d,timescale:c},this._initDTS={baseTime:h,timescale:c}):d=c=void 0,{tracks:n,initPTS:d,timescale:c}}remuxVideo(e,t,i,s){const r=e.inputTimeScale,a=e.samples,o=[],n=a.length,l=this._initPTS;let d,h,c=this.nextAvcDts,u=8,p=this.videoSampleDuration,f=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,g=!1;if(!i||null===c){const e=t*r,s=a[0].pts-Zm(a[0].dts,a[0].pts);Ym&&null!==c&&Math.abs(e-s-c)<15e3?i=!0:c=e-s}const y=l.baseTime*r/l.timescale;for(let e=0;e0?e-1:e].dts&&(g=!0)}g&&a.sort((function(e,t){const i=e.dts-t.dts,s=e.pts-t.pts;return i||s})),d=a[0].dts,h=a[a.length-1].dts;const A=h-d,b=A?Math.round(A/(n-1)):p||e.inputTimeScale/30;if(i){const e=d-c,i=e>b,s=e<-1;if((i||s)&&(i?hc.warn(`AVC: ${qm(e,!0)} ms (${e}dts) hole between fragments detected at ${t.toFixed(3)}`):hc.warn(`AVC: ${qm(-e,!0)} ms (${e}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!s||c>=a[0].pts||Ym)){d=c;const t=a[0].pts-e;if(i)a[0].dts=d,a[0].pts=t;else for(let i=0;it);i++)a[i].dts-=e,a[i].pts-=e;hc.log(`Video: Initial PTS/DTS adjusted: ${qm(t,!0)}/${qm(d,!0)}, delta: ${qm(e,!0)} ms`)}}d=Math.max(0,d);let v=0,_=0,S=d;for(let e=0;e0?t.dts-a[e-1].dts:b;if(l=e>0?t.pts-a[e-1].pts:b,i.stretchShortVideoTrack&&null!==this.nextAudioPts){const e=Math.floor(i.maxBufferHole*r),a=(s?f+s*r:this.nextAudioPts)-t.pts;a>e?(p=a-o,p<0?p=o:k=!0,hc.log(`[mp4-remuxer]: It is approximately ${a/90} ms to the next segment; using duration ${p/90} ms for the last video frame.`)):p=o}else p=o}const h=Math.round(t.pts-t.dts);C=Math.min(C,p),R=Math.max(R,p),x=Math.min(x,l),D=Math.max(D,l),o.push(new ig(t.key,p,d,h))}if(o.length)if(Ym){if(Ym<70){const e=o[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(Qm&&D-x0&&(s&&Math.abs(g-m)<9e3||Math.abs(Zm(p[0].pts-y,g)-m)<20*l),p.forEach((function(e){e.pts=Zm(e.pts-y,g)})),!i||m<0){if(p=p.filter((e=>e.pts>=0)),!p.length)return;m=0===r?0:s&&!u?Math.max(0,g):p[0].pts}if("aac"===e.segmentCodec){const t=this.config.maxAudioFramesDrift;for(let i=0,s=m;i=t*l&&d<1e4&&u){let t=Math.round(n/l);s=o-t*l,s<0&&(t--,s+=l),0===i&&(this.nextAudioPts=m=s),hc.warn(`[mp4-remuxer]: Injecting ${t} audio frame @ ${(s/a).toFixed(3)}s due to ${Math.round(1e3*n/a)} ms gap.`);for(let a=0;a0))return;_+=f;try{A=new Uint8Array(_)}catch(e){return void this.observer.emit(sc.ERROR,sc.ERROR,{type:rc.MUX_ERROR,details:ac.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:_,reason:`fail allocating audio mdat ${_}`})}if(!h){new DataView(A.buffer).setUint32(0,_),A.set(Wm.types.mdat,4)}}A.set(r,f);const l=r.byteLength;f+=l,c.push(new ig(!0,n,l,0)),v=a}const w=c.length;if(!w)return;const E=c[c.length-1];this.nextAudioPts=m=v+o*E.duration;const T=h?new Uint8Array(0):Wm.moof(e.sequenceNumber++,b/o,Zh({},e,{samples:c}));e.samples=[];const k=b/a,C=m/a,x={data1:T,data2:A,startPTS:k,endPTS:C,startDTS:k,endDTS:C,type:"audio",hasAudio:!0,hasVideo:!1,nb:w};return this.isAudioContiguous=!0,x}remuxEmptyAudio(e,t,i,s){const r=e.inputTimeScale,a=r/(e.samplerate?e.samplerate:r),o=this.nextAudioPts,n=this._initDTS,l=9e4*n.baseTime/n.timescale,d=(null!==o?o:s.startDTS*r)+l,h=s.endDTS*r+l,c=1024*a,u=Math.ceil((h-d)/c),p=Vm.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(hc.warn("[mp4-remuxer]: remux empty Audio"),!p)return void hc.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");const f=[];for(let e=0;e4294967296;)e+=i;return e}function eg(e,t,i,s){const r=e.samples.length;if(!r)return;const a=e.inputTimeScale;for(let o=0;oe.pts-t.pts));const a=e.samples;return e.samples=[],{samples:a}}class ig{constructor(e,t,i,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=s,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}function sg(e,t){const i=null==e?void 0:e.codec;if(i&&i.length>4)return i;if(t===yc){if("ec-3"===i||"ac-3"===i||"alac"===i)return i;if("fLaC"===i||"Opus"===i){return $u(i,!1)}const e="mp4a.40.5";return hc.info(`Parsed audio codec "${i}" or audio object type not handled. Using "${e}"`),e}return hc.warn(`Unhandled video codec "${i}"`),"hvc1"===i||"hev1"===i?"hvc1.1.6.L120.90":"av01"===i?"av01.0.04M.08":"avc1.42e01e"}try{Km=self.performance.now.bind(self.performance)}catch(e){hc.debug("Unable to use Performance API on this environment"),Km=null==Cc?void 0:Cc.Date.now}const rg=[{demux:class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,s){const r=this.videoTrack=lm("video",1),a=this.audioTrack=lm("audio",1),o=this.txtTrack=lm("text",1);if(this.id3Track=lm("id3",1),this.timeOffset=0,null==e||!e.byteLength)return;const n=mu(e);if(n.video){const{id:e,timescale:t,codec:i}=n.video;r.id=e,r.timescale=o.timescale=t,r.codec=i}if(n.audio){const{id:e,timescale:t,codec:i}=n.audio;a.id=e,a.timescale=t,a.codec=i}o.id=ou.text,r.sampleDuration=0,r.duration=a.duration=s}resetContiguity(){this.remainderData=null}static probe(e){return function(e){const t=e.byteLength;for(let i=0;i8&&109===e[i+4]&&111===e[i+5]&&111===e[i+6]&&102===e[i+7])return!0;i=s>1?i+s:t}return!1}(e)}demux(e,t){this.timeOffset=t;let i=e;const s=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Su(this.remainderData,e));const t=function(e){const t={valid:null,remainder:null},i=pu(e,["moof"]);if(i.length<2)return t.remainder=e,t;const s=i[i.length-1];return t.valid=Nc(e,0,s.byteOffset-8),t.remainder=Nc(e,s.byteOffset-8),t}(i);this.remainderData=t.remainder,s.samples=t.valid||new Uint8Array}else s.samples=i;const a=this.extractID3Track(s,t);return r.samples=wu(t,s),{videoTrack:s,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const s=this.extractID3Track(t,this.timeOffset);return i.samples=wu(e,t),{videoTrack:t,audioTrack:lm(),id3Track:s,textTrack:lm()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const s=pu(e.samples,["emsg"]);s&&s.forEach((e=>{const s=function(e){const t=e[0];let i="",s="",r=0,a=0,o=0,n=0,l=0,d=0;if(0===t){for(;"\0"!==nu(e.subarray(d,d+1));)i+=nu(e.subarray(d,d+1)),d+=1;for(i+=nu(e.subarray(d,d+1)),d+=1;"\0"!==nu(e.subarray(d,d+1));)s+=nu(e.subarray(d,d+1)),d+=1;s+=nu(e.subarray(d,d+1)),d+=1,r=du(e,12),a=du(e,16),n=du(e,20),l=du(e,24),d=28}else if(1===t){d+=4,r=du(e,d),d+=4;const t=du(e,d);d+=4;const a=du(e,d);for(d+=4,o=2**32*t+a,tc(o)||(o=Number.MAX_SAFE_INTEGER,hc.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),n=du(e,d),d+=4,l=du(e,d),d+=4;"\0"!==nu(e.subarray(d,d+1));)i+=nu(e.subarray(d,d+1)),d+=1;for(i+=nu(e.subarray(d,d+1)),d+=1;"\0"!==nu(e.subarray(d,d+1));)s+=nu(e.subarray(d,d+1)),d+=1;s+=nu(e.subarray(d,d+1)),d+=1}return{schemeIdUri:i,value:s,timeScale:r,presentationTime:o,presentationTimeDelta:a,eventDuration:n,id:l,payload:e.subarray(d,e.byteLength)}}(e);if(Rm.test(s.schemeIdUri)){const e=ec(s.presentationTime)?s.presentationTime/s.timeScale:t+s.presentationTimeDelta/s.timeScale;let r=4294967295===s.eventDuration?Number.POSITIVE_INFINITY:s.eventDuration/s.timeScale;r<=.001&&(r=Number.POSITIVE_INFINITY);const a=s.payload;i.samples.push({data:a,len:a.byteLength,dts:e,pts:e,type:wp,duration:r})}}))}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}},remux:class{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,s){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(function(e,t){if(!e||!t)return e;const i=t.keyId;i&&t.isCommonEncryption&&pu(e,["moov","trak"]).forEach((e=>{const t=pu(e,["mdia","minf","stbl","stsd"])[0].subarray(8);let s=pu(t,["enca"]);const r=s.length>0;r||(s=pu(t,["encv"])),s.forEach((e=>{pu(r?e.subarray(28):e.subarray(78),["sinf"]).forEach((e=>{const t=vu(e);if(t){const e=t.subarray(8,24);e.some((e=>0!==e))||(hc.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${su(e)} -> ${su(i)}`),t.set(i,8))}}))}))}));return e}(e,s)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const s=this.initData=mu(e);s.audio&&(t=sg(s.audio,yc)),s.video&&(i=sg(s.video,Ac));const r={};s.audio&&s.video?r.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:s.audio?r.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:s.video?r.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:hc.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r}remux(e,t,i,s,r,a){var o,n;let{initPTS:l,lastEndTime:d}=this;const h={audio:void 0,video:void 0,text:s,id3:i,initSegment:void 0};ec(d)||(d=this.lastEndTime=r||0);const c=t.samples;if(null==c||!c.length)return h;const u={initPTS:void 0,timescale:1};let p=this.initData;if(null!=(o=p)&&o.length||(this.generateInitSegment(c),p=this.initData),null==(n=p)||!n.length)return hc.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(u.tracks=this.initTracks,this.emitInitSegment=!1);const f=function(e,t){let i=0,s=0,r=0;const a=pu(e,["moof","traf"]);for(let e=0;ee+t.info.duration||0),0);i=Math.max(i,e+a.earliestPresentationTime/a.timescale),s=i-t}}if(s&&ec(s))return s}return s||r}(c,p),m=function(e,t){return pu(t,["moof","traf"]).reduce(((t,i)=>{const s=pu(i,["tfdt"])[0],r=s[0],a=pu(i,["tfhd"]).reduce(((t,i)=>{const a=du(i,4),o=e[a];if(o){let e=du(s,4);if(1===r){if(e===ru)return hc.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),t;e*=ru+1,e+=du(s,8)}const i=e/(o.timescale||9e4);if(ec(i)&&(null===t||ir}(l,g,r,f)||u.timescale!==l.timescale&&a)&&(u.initPTS=g-r,l&&1===l.timescale&&hc.warn("Adjusting initPTS by "+(u.initPTS-l.baseTime)),this.initPTS=l={baseTime:u.initPTS,timescale:1});const y=e?g-l.baseTime/l.timescale:d,A=y+f;!function(e,t,i){pu(t,["moof","traf"]).forEach((t=>{pu(t,["tfhd"]).forEach((s=>{const r=du(s,4),a=e[r];if(!a)return;const o=a.timescale||9e4;pu(t,["tfdt"]).forEach((e=>{const t=e[0],s=i*o;if(s){let i=du(e,4);if(0===t)i-=s,i=Math.max(i,0),uu(e,4,i);else{i*=Math.pow(2,32),i+=du(e,8),i-=s,i=Math.max(i,0);const t=Math.floor(i/(ru+1)),r=Math.floor(i%(ru+1));uu(e,4,t),uu(e,8,r)}}}))}))}))}(p,c,l.baseTime/l.timescale),f>0?this.lastEndTime=A:(hc.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const b=!!p.audio,v=!!p.video;let _="";b&&(_+="audio"),v&&(_+="video");const S={data1:c,startPTS:y,startDTS:y,endPTS:A,endDTS:A,type:_,hasAudio:b,hasVideo:v,nb:1,dropped:0};return h.audio="audio"===S.type?S:void 0,h.video="audio"!==S.type?S:void 0,h.initSegment=u,h.id3=eg(i,r,l,l),s.samples.length&&(h.text=tg(s,r,l)),h}}},{demux:Om,remux:Xm},{demux:class extends dm{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,s){super.resetInitSegment(e,t,i,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Gc(e,0);let i=(null==t?void 0:t.length)||0;if(xm(e,i))return!1;for(let t=e.length;i0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(i=t);return i}(a,t);if(b&&"AES-128"===b.method){const e=this.getDecrypter();if(!e.isSync())return this.decryptionPromise=e.webCryptoDecrypt(a,b.key.buffer,b.iv.buffer).then((e=>{const t=this.push(e,null,i);return this.decryptionPromise=null,t})),this.decryptionPromise;{let t=e.softwareDecrypt(a,b.key.buffer,b.iv.buffer);if(i.part>-1&&(t=e.flush()),!t)return r.executeEnd=Km(),og(i);a=new Uint8Array(t)}}const v=this.needsProbing(d,h);if(v){const e=this.configureTransmuxer(a);if(e)return hc.warn(`[transmuxer] ${e.message}`),this.observer.emit(sc.ERROR,sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),r.executeEnd=Km(),og(i)}(d||h||p||v)&&this.resetInitSegment(A,f,m,y,t),(d||p||v)&&this.resetInitialTimestamp(g),l||this.resetContiguity();const _=this.transmux(a,b,u,c,i),S=this.currentTransmuxState;return S.contiguous=!0,S.discontinuity=!1,S.trackSwitch=!1,r.executeEnd=Km(),_}flush(e){const t=e.transmuxing;t.executeStart=Km();const{decrypter:i,currentTransmuxState:s,decryptionPromise:r}=this;if(r)return r.then((()=>this.flush(e)));const a=[],{timeOffset:o}=s;if(i){const t=i.flush();t&&a.push(this.push(t,null,e))}const{demuxer:n,remuxer:l}=this;if(!n||!l)return t.executeEnd=Km(),[og(e)];const d=n.flush(o);return ng(d)?d.then((t=>(this.flushRemux(a,t,e),a))):(this.flushRemux(a,d,e),a)}flushRemux(e,t,i){const{audioTrack:s,videoTrack:r,id3Track:a,textTrack:o}=t,{accurateTimeOffset:n,timeOffset:l}=this.currentTransmuxState;hc.log(`[transmuxer.ts]: Flushed fragment ${i.sn}${i.part>-1?" p: "+i.part:""} of level ${i.level}`);const d=this.remuxer.remux(s,r,a,o,l,n,!0,this.id);e.push({remuxResult:d,chunkMeta:i}),i.transmuxing.executeEnd=Km()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,s,r){const{demuxer:a,remuxer:o}=this;a&&o&&(a.resetInitSegment(e,t,i,s),o.resetInitSegment(e,t,i,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,s,r){let a;return a=t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,s,r):this.transmuxUnencrypted(e,i,s,r),a}transmuxUnencrypted(e,t,i,s){const{audioTrack:r,videoTrack:a,id3Track:o,textTrack:n}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,a,o,n,t,i,!1,this.id),chunkMeta:s}}transmuxSampleAes(e,t,i,s,r){return this.demuxer.demuxSampleAes(e,t,i).then((e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,i,s,!1,this.id),chunkMeta:r})))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:s,vendor:r}=this;let a;for(let t=0,i=rg.length;t({remuxResult:{},chunkMeta:e});function ng(e){return"then"in e&&e.then instanceof Function}class lg{constructor(e,t,i,s,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=s,this.defaultInitPts=r||null}}class dg{constructor(e,t,i,s,r,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=s,this.timeOffset=r,this.initSegmentChange=a}}var hg={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function s(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function a(e,t,s,a,o){if("function"!=typeof s)throw new TypeError("The listener must be a function");var n=new r(s,a||e,o),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],n]:e._events[l].push(n):(e._events[l]=n,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function n(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),n.prototype.eventNames=function(){var e,s,r=[];if(0===this._eventsCount)return r;for(s in e=this._events)t.call(e,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},n.prototype.listeners=function(e){var t=i?i+e:e,s=this._events[t];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,a=s.length,o=new Array(a);r{(t=t||{}).frag=this.frag,t.id=this.id,e===sc.ERROR&&(this.error=t.error),this.hls.trigger(e,t)};this.observer=new cg,this.observer.on(sc.FRAG_DECRYPTED,a),this.observer.on(sc.ERROR,a);const o=Uu(r.preferManagedMediaSource)||{isTypeSupported:()=>!1},n={mpeg:o.isTypeSupported("audio/mpeg"),mp3:o.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:o.isTypeSupported('audio/mp4; codecs="ac-3"')},l=navigator.vendor;if(this.useWorker&&"undefined"!=typeof Worker){if(r.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{r.workerPath?(hc.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=function(e){const t=new self.URL(e,self.location.href).href;return{worker:new self.Worker(t),scriptURL:t}}(r.workerPath)):(hc.log(`injecting Web Worker for "${t}"`),this.workerContext=function(){const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e);return{worker:new self.Worker(t),objectURL:t}}()),this.onwmsg=e=>this.onWorkerMessage(e);const{worker:e}=this.workerContext;e.addEventListener("message",this.onwmsg),e.onerror=e=>{const i=new Error(`${e.message} (${e.filename}:${e.lineno})`);r.enableWorker=!1,hc.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(sc.ERROR,{type:rc.OTHER_ERROR,details:ac.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:i})},e.postMessage({cmd:"init",typeSupported:n,vendor:l,id:t,config:JSON.stringify(r)})}catch(e){hc.warn(`Error setting up "${t}" Web Worker, fallback to inline`,e),this.resetWorker(),this.error=null,this.transmuxer=new ag(this.observer,n,r,l,t)}return}}this.transmuxer=new ag(this.observer,n,r,l,t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,i,s,r,a,o,n,l,d){var h,c;l.transmuxing.start=self.performance.now();const{transmuxer:u}=this,p=a?a.start:r.start,f=r.decryptdata,m=this.frag,g=!(m&&r.cc===m.cc),y=!(m&&l.level===m.level),A=m?l.sn-m.sn:-1,b=this.part?l.part-this.part.index:-1,v=0===A&&l.id>1&&l.id===(null==m?void 0:m.stats.chunkCount),_=!y&&(1===A||0===A&&(1===b||v&&b<=0)),S=self.performance.now();(y||A||0===r.stats.parsing.start)&&(r.stats.parsing.start=S),!a||!b&&_||(a.stats.parsing.start=S);const w=!(m&&(null==(h=r.initSegment)?void 0:h.url)===(null==(c=m.initSegment)?void 0:c.url)),E=new dg(g,_,n,y,p,w);if(!_||g||w){hc.log(`[transmuxer-interface, ${r.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}\n discontinuity: ${g}\n trackSwitch: ${y}\n contiguous: ${_}\n accurateTimeOffset: ${n}\n timeOffset: ${p}\n initSegmentChange: ${w}`);const e=new lg(i,s,t,o,d);this.configureTransmuxer(e)}if(this.frag=r,this.part=a,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:f,chunkMeta:l,state:E},e instanceof ArrayBuffer?[e]:[]);else if(u){const t=u.push(e,f,l,E);ng(t)?(u.async=!0,t.then((e=>{this.handleTransmuxComplete(e)})).catch((e=>{this.transmuxerError(e,l,"transmuxer-interface push error")}))):(u.async=!1,this.handleTransmuxComplete(t))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let i=t.flush(e);ng(i)||t.async?(ng(i)||(i=Promise.resolve(i)),i.then((t=>{this.handleFlushResult(t,e)})).catch((t=>{this.transmuxerError(t,e,"transmuxer-interface flush error")}))):this.handleFlushResult(i,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach((e=>{this.handleTransmuxComplete(e)})),this.onFlush(t)}onWorkerMessage(e){const t=e.data,i=this.hls;switch(t.event){case"init":{var s;const e=null==(s=this.workerContext)?void 0:s.objectURL;e&&self.URL.revokeObjectURL(e);break}case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":hc[t.data.logType]&&hc[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function pg(e,t){if(e.length!==t.length)return!1;for(let i=0;ie[i]!==t[i]))}function mg(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}class gg{constructor(e){this.buffered=void 0;const t=(t,i,s)=>{if((i>>>=0)>s-1)throw new DOMException(`Failed to execute '${t}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return e[i][t]};this.buffered={get length(){return e.length},end:i=>t("end",i,e.length),start:i=>t("start",i,e.length)}}}class yg{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,i){const s=this.queues[t];s.push(e),1!==s.length||i||this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const i=new Promise((e=>{t=e})),s={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(s,e),i}executeNext(e){const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(t){hc.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${t}`),i.onError(t);const s=this.buffers[e];null!=s&&s.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Ag=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;function bg(e){const t=e.querySelectorAll("source");[].slice.call(t).forEach((t=>{e.removeChild(t)}))}const vg={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},_g=function(e){let t=e;return vg.hasOwnProperty(e)&&(t=vg[e]),String.fromCharCode(t)},Sg=15,wg=100,Eg={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Tg={17:2,18:4,21:6,22:8,23:10,19:13,20:15},kg={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Cg={25:2,26:4,29:6,30:8,31:10,27:13,28:15},xg=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Rg{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i="function"==typeof t?t():t;hc.log(`${this.time} [${e}] ${i}`)}}}const Dg=function(e){const t=[];for(let i=0;iwg&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=wg)}moveCursor(e){const t=this.pos+e;if(e>1)for(let e=this.pos+1;e=144&&this.backSpace();const t=_g(e);this.pos>=wg?this.logger.log(0,(()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!")):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))}clearFromPos(e){let t;for(t=e;t"pacData = "+JSON.stringify(e)));let t=e.row-1;if(this.nrRollUpRows&&t"bkgData = "+JSON.stringify(e))),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,(()=>this.getDisplayText()));const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",s=-1;for(let i=0;i0&&(i=e?"["+t.join(" | ")+"]":t.join("\n")),i}getTextAndFormat(){return this.rows}}class Mg{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Ig(i),this.nonDisplayedMemory=new Ig(i),this.lastOutputScreen=new Ig(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,(()=>"MODE="+e)),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let t=0;tt+": "+this.writeScreen.getDisplayText(!0))),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,(()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0))),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(()=>"DISP: "+this.displayedMemory.getDisplayText()))}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,s=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=s[i]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class Ug{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const s=this.logger=new Rg;this.channels=[null,new Mg(e,t,s),new Mg(e+1,i,s)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){let i,s,r,a=!1;this.logger.time=e;for(let e=0;e ("+Dg([s,r])+")"),i=this.parseCmd(s,r),i||(i=this.parseMidrow(s,r)),i||(i=this.parsePAC(s,r)),i||(i=this.parseBackgroundAttributes(s,r)),!i&&(a=this.parseChars(s,r),a)){const e=this.currentChannel;if(e&&e>0){this.channels[e].insertChars(a)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}i||a||this.logger.log(2,"Couldn't parse cleaned data "+Dg([s,r])+" orig: "+Dg([t[e],t[e+1]]))}}parseCmd(e,t){const{cmdHistory:i}=this;if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=33&&t<=35))return!1;if(Og(e,t,i))return Fg(null,null,i),this.logger.log(3,"Repeated command ("+Dg([e,t])+") is dropped"),!0;const s=20===e||21===e||23===e?1:2,r=this.channels[s];return 20===e||21===e||28===e||29===e?32===t?r.ccRCL():33===t?r.ccBS():34===t?r.ccAOF():35===t?r.ccAON():36===t?r.ccDER():37===t?r.ccRU(2):38===t?r.ccRU(3):39===t?r.ccRU(4):40===t?r.ccFON():41===t?r.ccRDC():42===t?r.ccTR():43===t?r.ccRTD():44===t?r.ccEDM():45===t?r.ccCR():46===t?r.ccENM():47===t&&r.ccEOC():r.ccTO(t-32),Fg(e,t,i),this.currentChannel=s,!0}parseMidrow(e,t){let i=0;if((17===e||25===e)&&t>=32&&t<=47){if(i=17===e?1:2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const s=this.channels[i];return!!s&&(s.ccMIDROW(t),this.logger.log(3,"MIDROW ("+Dg([e,t])+")"),!0)}return!1}parsePAC(e,t){let i;const s=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127)&&!((16===e||24===e)&&t>=64&&t<=95))return!1;if(Og(e,t,s))return Fg(null,null,s),!0;const r=e<=23?1:2;i=t>=64&&t<=95?1===r?Eg[e]:kg[e]:1===r?Tg[e]:Cg[e];const a=this.channels[r];return!!a&&(a.setPAC(this.interpretPAC(i,t)),Fg(e,t,s),this.currentChannel=r,!0)}interpretPAC(e,t){let i;const s={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,s.underline=1==(1&i),i<=13?s.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(s.italics=!0,s.color="white"):s.indent=4*Math.floor((i-16)/2),s}parseChars(e,t){let i,s=null,r=null;if(e>=25?(i=2,r=e-8):(i=1,r=e),r>=17&&r<=19){let e;e=17===r?t+80:18===r?t+112:t+144,this.logger.log(2,"Special char '"+_g(e)+"' in channel "+i),s=[e]}else e>=32&&e<=127&&(s=0===t?[e]:[e,t]);if(s){const i=Dg(s);this.logger.log(3,"Char codes = "+i.join(",")),Fg(e,t,this.cmdHistory)}return s}parseBackgroundAttributes(e,t){if(!((16===e||24===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=45&&t<=47))return!1;let i;const s={};16===e||24===e?(i=Math.floor((t-32)/2),s.background=xg[i],t%2==1&&(s.background=s.background+"_semi")):45===t?s.background="transparent":(s.foreground="black",47===t&&(s.underline=!0));const r=e<=23?1:2;return this.channels[r].setBkgData(s),Fg(e,t,this.cmdHistory),!0}reset(){for(let e=0;ee)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var jg=function(){if(null!=Cc&&Cc.VTTCue)return self.VTTCue;const e=["","lr","rl"],t=["start","middle","end","left","right"];function i(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;const i=t.toLowerCase();return!!~e.indexOf(i)&&i}function s(e){return i(t,e)}function r(e,...t){let i=1;for(;i100)throw new Error("Position must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(n,"positionAlign",r({},l,{get:function(){return v},set:function(e){const t=s(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");v=t,this.hasBeenReset=!0}})),Object.defineProperty(n,"size",r({},l,{get:function(){return _},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");_=e,this.hasBeenReset=!0}})),Object.defineProperty(n,"align",r({},l,{get:function(){return S},set:function(e){const t=s(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");S=t,this.hasBeenReset=!0}})),n.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class zg{decode(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Gg(e){function t(e,t,i,s){return 3600*(0|e)+60*(0|t)+(0|i)+parseFloat(s||0)}const i=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?t(i[2],i[3],0,i[4]):t(i[1],i[2],i[3],i[4]):null}class Hg{constructor(){this.values=Object.create(null)}set(e,t){this.get(e)||""===t||(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let s=0;s=0&&i<=100)return this.set(e,i),!0}return!1}}function Vg(e,t,i,s){const r=s?e.split(s):[e];for(const e in r){if("string"!=typeof r[e])continue;const s=r[e].split(i);if(2!==s.length)continue;t(s[0],s[1])}}const $g=new jg(0,0,""),Wg="middle"===$g.align?"middle":"center";function Jg(e,t,i){const s=e;function r(){const t=Gg(e);if(null===t)throw new Error("Malformed timestamp: "+s);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=r(),a(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+s);e=e.slice(3),a(),t.endTime=r(),a(),function(e,t){const s=new Hg;Vg(e,(function(e,t){let r;switch(e){case"region":for(let r=i.length-1;r>=0;r--)if(i[r].id===t){s.set(e,i[r].region);break}break;case"vertical":s.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),s.integer(e,r[0]),s.percent(e,r[0])&&s.set("snapToLines",!1),s.alt(e,r[0],["auto"]),2===r.length&&s.alt("lineAlign",r[1],["start",Wg,"end"]);break;case"position":r=t.split(","),s.percent(e,r[0]),2===r.length&&s.alt("positionAlign",r[1],["start",Wg,"end","line-left","line-right","auto"]);break;case"size":s.percent(e,t);break;case"align":s.alt(e,t,["start",Wg,"end","left","right"])}}),/:/,/\s/),t.region=s.get("region",null),t.vertical=s.get("vertical","");let r=s.get("line","auto");"auto"===r&&-1===$g.line&&(r=-1),t.line=r,t.lineAlign=s.get("lineAlign","start"),t.snapToLines=s.get("snapToLines",!0),t.size=s.get("size",100),t.align=s.get("align",Wg);let a=s.get("position","auto");"auto"===a&&50===$g.position&&(a="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=a}(e,t)}function qg(e){return e.replace(//gi,"\n")}class Kg{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new zg,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;function i(){let e=t.buffer,i=0;for(e=qg(e);i>>0).toString()};function Zg(e,t,i){return Xg(e.toString())+Xg(t.toString())+Xg(i)}function ey(e,t,i,s,r,a,o){const n=new Kg,l=eu(new Uint8Array(e)).trim().replace(Yg,"\n").split("\n"),d=[],h=t?function(e,t=1){return Jm(e,9e4,1/t)}(t.baseTime,t.timescale):0;let c,u="00:00.000",p=0,f=0,m=!0;n.oncue=function(e){const a=i[s];let o=i.ccOffset;const n=(p-h)/9e4;if(null!=a&&a.new&&(void 0!==f?o=i.ccOffset=a.start:function(e,t,i){let s=e[t],r=e[s.prevCC];if(!r||!r.new&&s.new)return e.ccOffset=e.presentationOffset=s.start,void(s.new=!1);for(;null!=(a=r)&&a.new;){var a;e.ccOffset+=s.start-r.start,s.new=!1,s=r,r=e[s.prevCC]}e.presentationOffset=i}(i,s,n)),n){if(!t)return void(c=new Error("Missing initPTS for VTT MPEGTS"));o=n-i.presentationOffset}const l=e.endTime-e.startTime,u=Zm(9e4*(e.startTime+o-f),9e4*r)/9e4;e.startTime=Math.max(u,0),e.endTime=Math.max(u+l,0);const m=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(m)),e.id||(e.id=Zg(e.startTime,e.endTime,m)),e.endTime>0&&d.push(e)},n.onparsingerror=function(e){c=e},n.onflush=function(){c?o(c):a(d)},l.forEach((e=>{if(m){if(Qg(e,"X-TIMESTAMP-MAP=")){m=!1,e.slice(16).split(",").forEach((e=>{Qg(e,"LOCAL:")?u=e.slice(6):Qg(e,"MPEGTS:")&&(p=parseInt(e.slice(7)))}));try{f=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),s=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!(ec(t)&&ec(i)&&ec(s)&&ec(r)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=6e4*s,t+=36e5*r,t}(u)/1e3}catch(e){c=e}return}""===e&&(m=!1)}n.parse(e+"\n")})),n.flush()}const ty="stpp.ttml.im1t",iy=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,sy=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,ry={left:"start",center:"center",right:"end",start:"start",end:"end"};function ay(e,t,i,s){const r=pu(new Uint8Array(e),["mdat"]);if(0===r.length)return void s(new Error("Could not parse IMSC1 mdat"));const a=r.map((e=>eu(e))),o=function(e,t,i=1,s=!1){return Jm(e,t,1/i,s)}(t.baseTime,1,t.timescale);try{a.forEach((e=>i(function(e,t){const i=new DOMParser,s=i.parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(r).reduce(((e,t)=>(e[t]=s.getAttribute(`ttp:${t}`)||r[t],e)),{}),o="preserve"!==s.getAttribute("xml:space"),n=ny(oy(s,"styling","style")),l=ny(oy(s,"layout","region")),d=oy(s,"body","[begin]");return[].map.call(d,(e=>{const i=ly(e,o);if(!i||!e.hasAttribute("begin"))return null;const s=cy(e.getAttribute("begin"),a),r=cy(e.getAttribute("dur"),a);let d=cy(e.getAttribute("end"),a);if(null===s)throw hy(e);if(null===d){if(null===r)throw hy(e);d=s+r}const h=new jg(s-t,d-t,i);h.id=Zg(h.startTime,h.endTime,h.text);const c=function(e,t,i){const s="http://www.w3.org/ns/ttml#styling";let r=null;const a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;o&&i.hasOwnProperty(o)&&(r=i[o]);return a.reduce(((i,a)=>{const o=dy(t,s,a)||dy(e,s,a)||dy(r,s,a);return o&&(i[a]=o),i}),{})}(l[e.getAttribute("region")],n[e.getAttribute("style")],n),{textAlign:u}=c;if(u){const e=ry[u];e&&(h.lineAlign=e),h.align=u}return Zh(h,c),h})).filter((e=>null!==e))}(e,o))))}catch(e){s(e)}}function oy(e,t,i){const s=e.getElementsByTagName(t)[0];return s?[].slice.call(s.querySelectorAll(i)):[]}function ny(e){return e.reduce(((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e}),{})}function ly(e,t){return[].slice.call(e.childNodes).reduce(((e,i,s)=>{var r;return"br"===i.nodeName&&s?e+"\n":null!=(r=i.childNodes)&&r.length?ly(i,t):t?e+i.textContent.trim().replace(/\s+/g," "):e+i.textContent}),"")}function dy(e,t,i){return e&&e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function hy(e){return new Error(`Could not parse ttml timestamp ${e}`)}function cy(e,t){if(!e)return null;let i=Gg(e);return null===i&&(iy.test(e)?i=function(e,t){const i=iy.exec(e),s=(0|i[4])+(0|i[5])/t.subFrameRate;return 3600*(0|i[1])+60*(0|i[2])+(0|i[3])+s/t.frameRate}(e,t):sy.test(e)&&(i=function(e,t){const i=sy.exec(e),s=Number(i[1]);switch(i[2]){case"h":return 3600*s;case"m":return 60*s;case"ms":return 1e3*s;case"f":return s/t.frameRate;case"t":return s/t.tickRate}return s}(e,t))),i}function uy(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function py(e,t){return!!e&&e.kind===uy(t)&&mg(t,e)}class fy{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(sc.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(sc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(sc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(sc.BUFFER_CODECS,this.onBufferCodecs,this),e.on(sc.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(sc.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(sc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(sc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(sc.BUFFER_CODECS,this.onBufferCodecs,this),e.off(sc.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&ec(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&hc.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter(((t,i)=>this.isLevelAllowed(t)&&i<=e));return this.clientRect=null,fy.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return e}isLevelAllowed(e){return!this.restrictedLevels.some((t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height))}static getMaxLevelByMediaSize(e,t,i){if(null==e||!e.length)return-1;let s=e.length-1;const r=Math.max(t,i);for(let t=0;t=r||i.height>=r)&&(a=i,!(o=e[t+1])||a.width!==o.width||a.height!==o.height)){s=t;break}}var a,o;return s}}const my="[eme]";class gy{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=gy.CDMCleanupPromise?[gy.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=hc.debug.bind(hc,my),this.log=hc.log.bind(hc,my),this.warn=hc.warn.bind(hc,my),this.error=hc.error.bind(hc,my),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(sc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(sc.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(sc.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(sc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(sc.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(sc.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,s=t[e];if(s)return s.licenseUrl;if(e===xc.WIDEVINE&&i)return i;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(e,t,i)=>!!e&&i.indexOf(e)===t,s=t.map((e=>e.audioCodec)).filter(i),r=t.map((e=>e.videoCodec)).filter(i);return s.length+r.length===0&&r.push("avc1.42e01e"),new Promise(((t,i)=>{const a=e=>{const o=e.shift();this.getMediaKeysPromise(o,s,r).then((e=>t({keySystem:o,mediaKeys:e}))).catch((t=>{e.length?a(e):i(t instanceof yy?t:new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))}))};a(e)}))}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if("function"!=typeof i){let e=`Configured requestMediaKeySystemAccess is not a function ${i}`;return null===Fc&&"http:"===self.location.protocol&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(e))}return i(e,t)}getMediaKeysPromise(e,t,i){const s=function(e,t,i,s){let r;switch(e){case xc.FAIRPLAY:r=["cenc","sinf"];break;case xc.WIDEVINE:case xc.PLAYREADY:r=["cenc"];break;case xc.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${e}`)}return function(e,t,i,s){return[{initDataTypes:e,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:t.map((e=>({contentType:`audio/mp4; codecs="${e}"`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null}))),videoCapabilities:i.map((e=>({contentType:`video/mp4; codecs="${e}"`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null})))}]}(r,t,i,s)}(e,t,i,this.config.drmSystemOptions),r=this.keySystemAccessPromises[e];let a=null==r?void 0:r.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(s)}`),a=this.requestMediaKeySystemAccess(e,s);const t=this.keySystemAccessPromises[e]={keySystemAccess:a};return a.catch((t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)})),a.then((i=>{this.log(`Access for key-system "${i.keySystem}" obtained`);const s=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),t.mediaKeys=i.createMediaKeys().then((t=>(this.log(`Media-keys created for "${e}"`),s.then((i=>i?this.setMediaKeysServerCertificate(t,e,i):t))))),t.mediaKeys.catch((t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)})),t.mediaKeys}))}return a.then((()=>r.mediaKeys))}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${su(e.keyId||[])}`);const s=i.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:s,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),s=this.getKeyIdString(t),r="cenc";this.keyIdToKeySessionPromise[s]=this.generateRequestWithPreferredKeySession(i,r,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return su(e.keyId)}updateKeySession(e,t){var i;const s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyID ${su((null==(i=e.decryptdata)?void 0:i.keyId)||[])}\n } (data length: ${t?t.byteLength:t})`),s.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise(((t,i)=>{const s=Uc(this.config),r=e.map(Bc).filter((e=>!!e&&-1!==s.indexOf(e)));return this.getKeySystemSelectionPromise(r).then((({keySystem:e})=>{const s=Mc(e);s?t(s):i(new Error(`Unable to find format for key-system "${e}"`))})).catch(i)}))}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),s=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);let r=this.keyIdToKeySessionPromise[i];return r||(r=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(t).then((({keySystem:i,mediaKeys:r})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(i,r).then((()=>{this.throwIfDestroyed();const e=this.createMediaKeySessionContext({keySystem:i,mediaKeys:r,decryptdata:t});return this.generateRequestWithPreferredKeySession(e,"cenc",t.pssh,"playlist-key")}))))),r.catch((e=>this.handleError(e)))),r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof yy?this.hls.trigger(sc.ERROR,e.data):this.hls.trigger(sc.ERROR,{type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const t=Bc(e.keyFormat),i=t?[t]:Uc(this.config);return this.attemptKeySystemAccess(i)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Uc(this.config)),0===e.length)throw new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:i}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),null===i)return;let s,r;if("sinf"===t&&this.config.drmSystems[xc.FAIRPLAY]){const e=nu(new Uint8Array(i));try{const t=Ec(JSON.parse(e).sinf),i=vu(new Uint8Array(t));if(!i)return;s=i.subarray(8,24),r=xc.FAIRPLAY}catch(e){return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{const e=function(e){if(!(e instanceof ArrayBuffer)||e.byteLength<32)return null;const t={version:0,systemId:"",kids:null,data:null},i=new DataView(e),s=i.getUint32(0);if(e.byteLength!==s&&s>44)return null;if(1886614376!==i.getUint32(4))return null;if(t.version=i.getUint32(8)>>>24,t.version>1)return null;t.systemId=su(new Uint8Array(e,12,16));const r=i.getUint32(28);if(0===t.version){if(s-32this.generateRequestWithPreferredKeySession(r,t,i,"encrypted-event-key-match")));break}}l||(l=o[a]=this.getKeySystemSelectionPromise([r]).then((({keySystem:e,mediaKeys:r})=>{var o;this.throwIfDestroyed();const n=new Ru("ISO-23001-7",a,null!=(o=Mc(e))?o:"");return n.pssh=new Uint8Array(i),n.keyId=s,this.attemptSetMediaKeys(e,r).then((()=>{this.throwIfDestroyed();const s=this.createMediaKeySessionContext({decryptdata:n,keySystem:e,mediaKeys:r});return this.generateRequestWithPreferredKeySession(s,t,i,"encrypted-event-no-match")}))}))),l.catch((e=>this.handleError(e)))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const s=Promise.all(i).then((()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)}));return this.setMediaKeysQueue.push(s),s.then((()=>{this.log(`Media-keys set for "${e}"`),i.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter((e=>-1===i.indexOf(e)))}))}generateRequestWithPreferredKeySession(e,t,i,s){var r,a;const o=null==(r=this.config.drmSystems)||null==(a=r[e.keySystem])?void 0:a.generateRequest;if(o)try{const s=o.call(this.hls,t,i,e);if(!s)throw new Error("Invalid response from configured generateRequest filter");t=s.initDataType,i=e.decryptdata.pssh=s.initData?new Uint8Array(s.initData):null}catch(e){var n;if(this.warn(e.message),null!=(n=this.hls)&&n.config.debug)throw e}if(null===i)return this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(e);const l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${s}": ${l} (init data type: ${t} length: ${i?i.byteLength:null})`);const d=new cg,h=e._onmessage=t=>{const i=e.mediaKeysSession;if(!i)return void d.emit("error",new Error("invalid state"));const{messageType:s,message:r}=t;this.log(`"${s}" message event for session "${i.sessionId}" message size: ${r.byteLength}`),"license-request"===s||"license-renewal"===s?this.renewLicense(e,r).catch((e=>{this.handleError(e),d.emit("error",e)})):"license-release"===s?e.keySystem===xc.FAIRPLAY&&(this.updateKeySession(e,kc("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${s}"`)},c=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession)return void d.emit("error",new Error("invalid state"));this.onKeyStatusChange(e);const i=e.keyStatus;d.emit("keyStatus",i),"expired"===i&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",h),e.mediaKeysSession.addEventListener("keystatuseschange",c);const u=new Promise(((e,t)=>{d.on("error",t),d.on("keyStatus",(i=>{i.startsWith("usable")?e():"output-restricted"===i?t(new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===i?t(new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${i}"`)):"expired"===i?t(new Error("key expired while generating request")):this.warn(`unhandled key status change "${i}"`)}))}));return e.mediaKeysSession.generateRequest(t,i).then((()=>{var t;this.log(`Request generated for key-session "${null==(t=e.mediaKeysSession)?void 0:t.sessionId}" keyId: ${l}`)})).catch((e=>{throw new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_NO_SESSION,error:e,fatal:!1},`Error generating key-session request: ${e}`)})).then((()=>u)).catch((t=>{throw d.removeAllListeners(),this.removeSession(e),t})).then((()=>(d.removeAllListeners(),e)))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach(((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${su("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${su(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t}))}fetchServerCertificate(e){const t=this.config,i=new(0,t.loader)(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise(((r,a)=>{const o={responseType:"arraybuffer",url:s},n=t.certLoadPolicy.default,l={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,i,s)=>{r(e.data)},onError:(t,i,r,n)=>{a(new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:Yh({url:o.url,data:void 0},t)},`"${e}" certificate request failed (${s}). Status: ${t.code} (${t.text})`))},onTimeout:(t,i,r)=>{a(new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:o.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(e,t,i)=>{a(new Error("aborted"))}};i.load(o,l,d)}))):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise(((s,r)=>{e.setServerCertificate(i).then((r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${null==i?void 0:i.byteLength}) on "${t}"`),s(e)})).catch((e=>{r(new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))}))}))}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then((t=>this.updateKeySession(e,new Uint8Array(t)).catch((e=>{throw new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:e,fatal:!0},e.message)}))))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const s=(new DOMParser).parseFromString(i,"application/xml"),r=s.querySelectorAll("HttpHeader");if(r.length>0){let t;for(let i=0,s=r.length;i in key message");return kc(atob(l))}setupLicenseXHR(e,t,i,s){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then((()=>{if(!i.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,i,s)})).catch((a=>{if(!i.decryptdata)throw a;return e.open("POST",t,!0),r.call(this.hls,e,t,i,s)})).then((i=>{e.readyState||e.open("POST",t,!0);return{xhr:e,licenseChallenge:i||s}})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise(((s,r)=>{const a=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${a}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(4===o.readyState)if(200===o.status){this._requestLicenseFailureCount=0;let t=o.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);const i=this.config.licenseResponseCallback;if(i)try{t=i.call(this.hls,o,a,e)}catch(e){this.error(e)}s(t)}else{const n=i.errorRetry,l=n?n.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||o.status>=400&&o.status<500)r(new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{const i=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${i} attempts left`),this.requestLicense(e,t).then(s,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then((({xhr:t,licenseChallenge:i})=>{e.keySystem==xc.PLAYREADY&&(i=this.unpackPlayReadyKeyMessage(t,i)),t.send(i)}))}))}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Ru.clearKeyUriToKeyIdMap();const i=t.length;gy.CDMCleanupPromise=Promise.all(t.map((e=>this.removeSession(e))).concat(null==e?void 0:e.setMediaKeys(null).catch((e=>{this.log(`Could not clear media keys: ${e}`)})))).then((()=>{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)})).catch((e=>{this.log(`Could not close sessions and clear media keys: ${e}`)}))}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(t&&this.config.emeEnabled&&!this.keyFormatPromise){const e=t.reduce(((e,t)=>(-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e)),[]);this.log(`Selecting key-system from session-keys ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const s=this.mediaKeySessions.indexOf(e);return s>-1&&this.mediaKeySessions.splice(s,1),t.remove().catch((e=>{this.log(`Could not remove session: ${e}`)})).then((()=>t.close())).catch((e=>{this.log(`Could not close session: ${e}`)}))}}}gy.CDMCleanupPromise=void 0;class yy extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var Ay,by,vy;!function(e){e.MANIFEST="m",e.AUDIO="a",e.VIDEO="v",e.MUXED="av",e.INIT="i",e.CAPTION="c",e.TIMED_TEXT="tt",e.KEY="k",e.OTHER="o"}(Ay||(Ay={})),function(e){e.DASH="d",e.HLS="h",e.SMOOTH="s",e.OTHER="o"}(by||(by={})),function(e){e.OBJECT="CMCD-Object",e.REQUEST="CMCD-Request",e.SESSION="CMCD-Session",e.STATUS="CMCD-Status"}(vy||(vy={}));const _y={[vy.OBJECT]:["br","d","ot","tb"],[vy.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[vy.SESSION]:["cid","pr","sf","sid","st","v"],[vy.STATUS]:["bs","rtp"]};class Sy{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map((e=>e instanceof Sy?e:new Sy(e)))),this.value=e,this.params=t}}class wy{constructor(e){this.description=void 0,this.description=e}}function Ey(e,t,i,s){return new Error(`failed to ${e} "${r=t,Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":"object"==typeof r?JSON.stringify(r):String(r)}" as ${i}`,{cause:s});var r}const Ty="Bare Item";const ky=/[\x00-\x1f\x7f]+/;function Cy(e,t,i){return Ey("serialize",e,t,i)}function xy(e){if(!1===ArrayBuffer.isView(e))throw Cy(e,"Byte Sequence");return`:${t=e,btoa(String.fromCharCode(...t))}:`;var t}function Ry(e){if(function(e){return e<-999999999999999||99999999999999912)throw Cy(e,"Decimal");const i=t.toString();return i.includes(".")?i:`${i}.0`}function Py(e){const t=(i=e).description||i.toString().slice(7,-1);var i;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw Cy(t,"Token");return t}function By(e){switch(typeof e){case"number":if(!ec(e))throw Cy(e,Ty);return Number.isInteger(e)?Ry(e):Ly(e);case"string":return function(e){if(ky.test(e))throw Cy(e,"String");return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(e);case"symbol":return Py(e);case"boolean":return function(e){if("boolean"!=typeof e)throw Cy(e,"Boolean");return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return function(e){return`@${Ry(e.getTime()/1e3)}`}(e);if(e instanceof Uint8Array)return xy(e);if(e instanceof wy)return Py(e);default:throw Cy(e,Ty)}}function Iy(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw Cy(e,"Key");return e}function My(e){return null==e?"":Object.entries(e).map((([e,t])=>!0===t?`;${Iy(e)}`:`;${Iy(e)}=${By(t)}`)).join("")}function Uy(e){return e instanceof Sy?`${By(e.value)}${My(e.params)}`:By(e)}function Fy(e,t={whitespace:!0}){if("object"!=typeof e)throw Cy(e,"Dict");const i=e instanceof Map?e.entries():Object.entries(e),s=null!=t&&t.whitespace?" ":"";return Array.from(i).map((([e,t])=>{t instanceof Sy==!1&&(t=new Sy(t));let i=Iy(e);var s;return!0===t.value?i+=My(t.params):(i+="=",Array.isArray(t.value)?i+=`(${(s=t).value.map(Uy).join(" ")})${My(s.params)}`:i+=Uy(t)),i})).join(`,${s}`)}const Oy=e=>Math.round(e),Ny=e=>100*Oy(e/100),jy={br:Oy,d:Oy,bl:Ny,dl:Ny,mtp:Ny,nor:(e,t)=>(null!=t&&t.baseUrl&&(e=function(e,t){const i=new URL(e),s=new URL(t);if(i.origin!==s.origin)return e;const r=i.pathname.split("/").slice(1),a=s.pathname.split("/").slice(1,-1);for(;r[0]===a[0];)r.shift(),a.shift();for(;a.length;)a.shift(),r.unshift("..");return r.join("/")}(e,t.baseUrl)),encodeURIComponent(e)),rtp:Ny,tb:Oy};function zy(e,t){const i={};if(null==e||"object"!=typeof e)return i;const s=Object.keys(e).sort(),r=Zh({},jy,null==t?void 0:t.formatters),a=null==t?void 0:t.filter;return s.forEach((s=>{if(null!=a&&a(s))return;let o=e[s];const n=r[s];n&&(o=n(o,t)),"v"===s&&1===o||"pr"==s&&1===o||(e=>"number"==typeof e?ec(e):null!=e&&""!==e&&!1!==e)(o)&&((e=>"ot"===e||"sf"===e||"st"===e)(s)&&"string"==typeof o&&(o=new wy(o)),i[s]=o)})),i}function Gy(e,t={}){return e?function(e,t){return Fy(e,t)}(zy(e,t),Zh({whitespace:!1},t)):""}function Hy(e,t,i){return Zh(e,function(e,t={}){if(!e)return{};const i=Object.entries(e),s=Object.entries(_y).concat(Object.entries((null==t?void 0:t.customHeaderMap)||{})),r=i.reduce(((e,t)=>{var i;const[r,a]=t,o=(null==(i=s.find((e=>e[1].includes(r))))?void 0:i[0])||vy.REQUEST;return null!=e[o]||(e[o]={}),e[o][r]=a,e}),{});return Object.entries(r).reduce(((e,[i,s])=>(e[i]=Gy(s,t),e)),{})}(t,i))}const Vy=/CMCD=[^&#]+/;function $y(e,t,i){const s=function(e,t={}){if(!e)return"";const i=Gy(e,t);return`CMCD=${encodeURIComponent(i)}`}(t,i);if(!s)return e;if(Vy.test(e))return e.replace(Vy,s);const r=e.includes("?")?"&":"?";return`${e}${r}${s}`}function Wy(e,t,i,s){e&&Object.keys(t).forEach((r=>{const a=e.filter((e=>e.groupId===r)).map((e=>{const a=Zh({},e);return a.details=void 0,a.attrs=new pc(a.attrs),a.url=a.attrs.URI=Jy(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",i),a.groupId=a.attrs["GROUP-ID"]=t[r],a.attrs["PATHWAY-ID"]=s,a}));e.push(...a)}))}function Jy(e,t,i,s){const{HOST:r,PARAMS:a,[i]:o}=s;let n;t&&(n=null==o?void 0:o[t],n&&(e=n));const l=new self.URL(e);return r&&!n&&(l.host=r),a&&Object.keys(a).sort().forEach((e=>{e&&l.searchParams.set(e,a[e])})),l.href}const qy=/^age:\s*[\d.]+\s*$/im;class Ky{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new gc,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null,this.stats=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then((()=>{if(!this.stats.aborted)return r(i,t.url)})).catch((e=>(i.open("GET",t.url,!0),r(i,t.url)))).then((()=>{this.stats.aborted||this.openAndSendXhr(i,t,e)})).catch((e=>{this.callbacks.onError({code:i.status,text:e.message},t,i,s)})):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const s=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:a}=i.loadPolicy;if(s)for(const t in s)e.setRequestHeader(t,s[t]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=r&&ec(r)?r:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const s=t.readyState,r=this.config;if(!i.aborted&&s>=2&&(0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),4===s)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const s=t.status,a="text"!==t.responseType;if(s>=200&&s<300&&(a&&t.response||null!==t.responseText)){i.loading.end=Math.max(self.performance.now(),i.loading.first);const r=a?t.response:t.responseText,o="arraybuffer"===t.responseType?r.byteLength:r.length;if(i.loaded=i.total=o,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first),!this.callbacks)return;const n=this.callbacks.onProgress;if(n&&n(i,e,r,t),!this.callbacks)return;const l={url:t.responseURL,data:r,code:s};this.callbacks.onSuccess(l,i,e,t)}else{const a=r.loadPolicy.errorRetry;Yp(a,i.retry,!1,{url:e.url,data:void 0,code:s})?this.retry(a):(hc.error(`${s} while loading ${e.url}`),this.callbacks.onError({code:s,text:t.statusText},e,t,i))}}}loadtimeout(){var e;const t=null==(e=this.config)?void 0:e.loadPolicy.timeoutRetry;if(Yp(t,this.stats.retry,!0))this.retry(t);else{var i;hc.warn(`timeout while loading ${null==(i=this.context)?void 0:i.url}`);const e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=qp(e,i.retry),i.retry++,hc.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==t?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&qy.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const Yy=/(\d+)-(\d+)\/(\d+)/;class Qy{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Xy,this.controller=new self.AbortController,this.stats=new gc}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();const r=function(e,t){const i={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(Zh({},e.headers))};e.rangeEnd&&i.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1));return i}(e,this.controller.signal),a=i.onProgress,o="arraybuffer"===e.responseType,n=o?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=l&&ec(l)?l:d,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),i.onTimeout(s,e,this.response)}),t.timeout),self.fetch(this.request).then((r=>{this.response=this.loader=r;const n=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),i.onTimeout(s,e,this.response)}),d-(n-s.loading.start)),!r.ok){const{status:e,statusText:t}=r;throw new Zy(t||"fetch, bad network response",e,r)}return s.loading.first=n,s.total=function(e){const t=e.get("Content-Range");if(t){const e=function(e){const t=Yy.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(ec(e))return e}const i=e.get("Content-Length");if(i)return parseInt(i)}(r.headers)||s.total,a&&ec(t.highWaterMark)?this.loadProgressively(r,s,e,t.highWaterMark,a):o?r.arrayBuffer():"json"===e.responseType?r.json():r.text()})).then((r=>{const o=this.response;if(!o)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const l=r[n];l&&(s.loaded=s.total=l);const d={url:o.url,data:r,code:o.status};a&&!ec(t.highWaterMark)&&a(s,e,r,o),i.onSuccess(d,s,e,o)})).catch((t=>{if(self.clearTimeout(this.requestTimeout),s.aborted)return;const r=t&&t.code||0,a=t?t.message:null;i.onError({code:r,text:a},e,t?t.details:null,s)}))}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,s=0,r){const a=new nm,o=e.body.getReader(),n=()=>o.read().then((o=>{if(o.done)return a.dataLength&&r(t,i,a.flush(),e),Promise.resolve(new ArrayBuffer(0));const l=o.value,d=l.length;return t.loaded+=d,d=s&&r(t,i,a.flush(),e)):r(t,i,l,e),n()})).catch((()=>Promise.reject()));return n()}}function Xy(e,t){return new self.Request(e.url,t)}class Zy extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const eA=/\s/,tA={newCue(e,t,i,s){const r=[];let a,o,n,l,d;const h=self.VTTCue||self.TextTrackCue;for(let u=0;u=16?l--:l++;const s=qg(d.trim()),p=Zg(t,i,s);null!=e&&null!=(c=e.cues)&&c.getCueById(p)||(o=new h(t,i,s),o.id=p,o.line=u+1,o.align="left",o.position=10+Math.min(80,10*Math.floor(8*l/32)),r.push(o))}return e&&r.length&&(r.sort(((e,t)=>"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line)),r.forEach((t=>yp(e,t)))),r}},iA=Yh(Yh({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Ky,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:e,partCurrent:t,hls:i}=this,{autoLevelEnabled:s,media:r}=i;if(!e||!r)return;const a=performance.now(),o=t?t.stats:e.stats,n=t?t.duration:e.duration,l=a-o.loading.start,d=i.minAutoLevel;if(o.aborted||o.loaded&&o.loaded===o.total||e.level<=d)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!s||r.paused||!r.playbackRate||!r.readyState)return;const h=i.mainForwardBufferInfo;if(null===h)return;const c=this.bwEstimator.getEstimateTTFB(),u=Math.abs(r.playbackRate);if(l<=Math.max(c,n/(2*u)*1e3))return;const p=h.len/u,f=o.loading.first?o.loading.first-o.loading.start:-1,m=o.loaded&&f>-1,g=this.getBwEstimate(),y=i.levels,A=y[e.level],b=o.total||Math.max(o.loaded,Math.round(n*A.averageBitrate/8));let v=m?l-f:l;v<1&&m&&(v=Math.min(l,8*o.loaded/g));const _=m?1e3*o.loaded/v:0,S=_?(b-o.loaded)/_:8*b/g+c/1e3;if(S<=p)return;const w=_?8*_:g;let E,T=Number.POSITIVE_INFINITY;for(E=e.level-1;E>d;E--){const e=y[E].maxBitrate;if(T=this.getTimeToLoadFrag(c/1e3,w,n*e,!y[E].details),T=S)return;if(T>10*n)return;i.nextLoadLevel=i.nextAutoLevel=E,m?this.bwEstimator.sample(l-Math.min(c,f),o.loaded):this.bwEstimator.sampleTTFB(l);const k=y[E].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>k&&this.resetEstimator(k),this.clearTimer(),hc.warn(`[abr] Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} is loading too slowly;\n Time to underbuffer: ${p.toFixed(3)} s\n Estimated load time for current fragment: ${S.toFixed(3)} s\n Estimated load time for down switch fragment: ${T.toFixed(3)} s\n TTFB estimate: ${0|f} ms\n Current BW estimate: ${ec(g)?0|g:"Unknown"} bps\n New BW estimate: ${0|this.getBwEstimate()} bps\n Switching to level ${E} @ ${0|k} bps`),i.trigger(sc.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:o})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(hc.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new cf(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.FRAG_LOADING,this.onFragLoading,this),e.on(sc.FRAG_LOADED,this.onFragLoaded,this),e.on(sc.FRAG_BUFFERED,this.onFragBuffered,this),e.on(sc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(sc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(sc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(sc.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(sc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.FRAG_LOADING,this.onFragLoading,this),e.off(sc.FRAG_LOADED,this.onFragLoaded,this),e.off(sc.FRAG_BUFFERED,this.onFragBuffered,this),e.off(sc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(sc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(sc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(sc.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(sc.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){var s;if(!i.bitrateTest)this.fragCurrent=i,this.partCurrent=null!=(s=t.part)?s:null;this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case ac.BUFFER_ADD_CODEC_ERROR:case ac.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case ac.FRAG_LOAD_TIMEOUT:{const e=t.frag,{fragCurrent:i,partCurrent:s}=this;if(e&&i&&e.sn===i.sn&&e.level===i.level){const t=performance.now(),i=s?s.stats:e.stats,r=t-i.loading.start,a=i.loading.first?i.loading.first-i.loading.start:-1;if(i.loaded&&a>-1){const e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(r-Math.min(e,a),i.loaded)}else this.bwEstimator.sampleTTFB(r)}break}}}getTimeToLoadFrag(e,t,i,s){return e+i/t+(s?this.lastLevelLoadSec:0)}onLevelLoaded(e,t){const i=this.hls.config,{loading:s}=t.stats,r=s.end-s.start;ec(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:i}){const s=i?i.stats:t.stats;if(t.type===hp&&this.bwEstimator.sampleTTFB(s.loading.first-s.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const e=i?i.duration:t.duration,r=this.hls.levels[t.level],a=(r.loaded?r.loaded.bytes:0)+s.loaded,o=(r.loaded?r.loaded.duration:0)+e;r.loaded={bytes:a,duration:o},r.realBitrate=Math.round(8*a/o)}if(t.bitrateTest){const e={stats:s,frag:t,part:i,id:t.type};this.onFragBuffered(sc.FRAG_BUFFERED,e),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:s}=t,r=null!=s&&s.stats.loaded?s.stats:i.stats;if(r.aborted)return;if(this.ignoreFragment(i))return;const a=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,r.loaded),r.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==hp||"initSegment"===e.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),s=this.hls.config.maxStarvationDelay,r=this.findBestLevel(i,t,e,0,s,1,1);if(r>-1)return r;const a=this.hls.firstLevel,o=Math.min(Math.max(a,t),e);return hc.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&i&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;const s=t&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){const t=this.hls.levels;if(t.length>Math.max(e,s)&&t[e].loadError<=t[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:s,config:r,minAutoLevel:a}=i,o=t?t.duration:e?e.duration:0,n=this.getBwEstimate(),l=this.getStarvationDelay();let d=r.abrBandWidthFactor,h=r.abrBandWidthUpFactor;if(l){const e=this.findBestLevel(n,a,s,l,0,d,h);if(e>=0)return e}let c=o?Math.min(o,r.maxStarvationDelay):r.maxStarvationDelay;if(!l){const e=this.bitrateTestDelay;if(e){c=(o?Math.min(o,r.maxLoadingDelay):r.maxLoadingDelay)-e,hc.info(`[abr] bitrate test took ${Math.round(1e3*e)}ms, set first fragment max fetchDuration to ${Math.round(1e3*c)} ms`),d=h=1}}const u=this.findBestLevel(n,a,s,l,c,d,h);if(hc.info(`[abr] ${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${u}`),u>-1)return u;const p=i.levels[a],f=i.levels[i.loadLevel];return(null==p?void 0:p.bitrate)<(null==f?void 0:f.bitrate)?a:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,s=e.mainForwardBufferInfo;return(s?s.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,s,r,a,o){var n;const l=s+r,d=this.lastLoadedFragLevel,h=-1===d?this.hls.firstLevel:d,{fragCurrent:c,partCurrent:u}=this,{levels:p,allAudioTracks:f,loadLevel:m,config:g}=this.hls;if(1===p.length)return 0;const y=p[h],A=!(null==y||null==(n=y.details)||!n.live),b=-1===m||-1===d;let v,_="SDR",S=(null==y?void 0:y.frameRate)||0;const{audioPreference:w,videoPreference:E}=g,T=this.audioTracksByGroup||(this.audioTracksByGroup=function(e){return e.reduce(((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const s=t.channels||"2";return i.channels[s]=(i.channels[s]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}(f));if(b){if(-1!==this.firstSelection)return this.firstSelection;const s=this.codecTiers||(this.codecTiers=function(e,t,i,s){return e.slice(i,s+1).reduce(((e,i)=>{if(!i.codecSet)return e;const s=i.audioGroups;let r=e[i.codecSet];r||(e[i.codecSet]=r={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!s,fragmentError:0}),r.minBitrate=Math.min(r.minBitrate,i.bitrate);const a=Math.min(i.height,i.width);return r.minHeight=Math.min(r.minHeight,a),r.minFramerate=Math.min(r.minFramerate,i.frameRate),r.maxScore=Math.max(r.maxScore,i.score),r.fragmentError+=i.fragmentError,r.videoRanges[i.videoRange]=(r.videoRanges[i.videoRange]||0)+1,s&&s.forEach((e=>{if(!e)return;const i=t.groups[e];r.hasDefaultAudio=r.hasDefaultAudio||t.hasDefaultAudio?i.hasDefault:i.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(i.channels).forEach((e=>{r.channels[e]=(r.channels[e]||0)+i.channels[e]}))})),e}),{})}(p,T,t,i)),r=function(e,t,i,s,r){const a=Object.keys(e),o=null==s?void 0:s.channels,n=null==s?void 0:s.audioCodec,l=o&&2===parseInt(o);let d=!0,h=!1,c=1/0,u=1/0,p=1/0,f=0,m=[];const{preferHDR:g,allowedVideoRanges:y}=gf(t,r);for(let t=a.length;t--;){const i=e[a[t]];d=i.channels[2]>0,c=Math.min(c,i.minHeight),u=Math.min(u,i.minFramerate),p=Math.min(p,i.minBitrate);const s=y.filter((e=>i.videoRanges[e]>0));s.length>0&&(h=!0,m=s)}c=ec(c)?c:0,u=ec(u)?u:0;const A=Math.max(1080,c),b=Math.max(30,u);p=ec(p)?p:i,i=Math.max(p,i),h||(t=void 0,m=[]);const v=a.reduce(((t,s)=>{const r=e[s];if(s===t)return t;if(r.minBitrate>i)return yf(s,`min bitrate of ${r.minBitrate} > current estimate of ${i}`),t;if(!r.hasDefaultAudio)return yf(s,"no renditions with default or auto-select sound found"),t;if(n&&s.indexOf(n.substring(0,4))%5!=0)return yf(s,`audio codec preference "${n}" not found`),t;if(o&&!l){if(!r.channels[o])return yf(s,`no renditions with ${o} channel sound found (channels options: ${Object.keys(r.channels)})`),t}else if((!n||l)&&d&&0===r.channels[2])return yf(s,"no renditions with stereo sound found"),t;return r.minHeight>A?(yf(s,`min resolution of ${r.minHeight} > maximum of ${A}`),t):r.minFramerate>b?(yf(s,`min framerate of ${r.minFramerate} > maximum of ${b}`),t):m.some((e=>r.videoRanges[e]>0))?r.maxScore=Gu(t)||r.fragmentError>e[t].fragmentError)?t:(f=r.maxScore,s):(yf(s,`no variants with VIDEO-RANGE of ${JSON.stringify(m)} found`),t)}),void 0);return{codecSet:v,videoRanges:m,preferHDR:g,minFramerate:u,minBitrate:p}}(s,_,e,w,E),{codecSet:a,videoRanges:o,minFramerate:n,minBitrate:l,preferHDR:d}=r;v=a,_=d?o[o.length-1]:o[0],S=n,e=Math.max(e,l),hc.log(`[abr] picked start tier ${JSON.stringify(r)}`)}else v=null==y?void 0:y.codecSet,_=null==y?void 0:y.videoRange;const k=u?u.duration:c?c.duration:0,C=this.bwEstimator.getEstimateTTFB()/1e3,x=[];for(let n=i;n>=t;n--){var R;const t=p[n],c=n>h;if(!t)continue;if(g.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){const i=navigator.mediaCapabilities;"function"==typeof(null==i?void 0:i.decodingInfo)&&ff(t,T,_,S,e,w)?(t.supportedPromise=mf(t,T,i),t.supportedPromise.then((e=>{if(!this.hls)return;t.supportedResult=e;const i=this.hls.levels,s=i.indexOf(t);e.error?hc.warn(`[abr] MediaCapabilities decodingInfo error: "${e.error}" for level ${s} ${JSON.stringify(e)}`):e.supported||(hc.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${s} ${JSON.stringify(e)}`),s>-1&&i.length>1&&(hc.log(`[abr] Removing unsupported level ${s}`),this.hls.removeLevel(s)))}))):t.supportedResult=uf}if(v&&t.codecSet!==v||_&&t.videoRange!==_||c&&S>t.frameRate||!c&&S>0&&S=2*k&&0===r?p[n].averageBitrate:p[n].maxBitrate,P=this.getTimeToLoadFrag(C,D,L*E,void 0===f);if(D>=L&&(n===d||0===t.loadError&&0===t.fragmentError)&&(P<=C||!ec(P)||A&&!this.bitrateTestDelay||P${n} adjustedbw(${Math.round(D)})-bitrate=${Math.round(D-L)} ttfb:${C.toFixed(1)} avgDuration:${E.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${P.toFixed(1)} firstSelection:${b} codecSet:${v} videoRange:${_} hls.loadLevel:${m}`)),b&&(this.firstSelection=n),n}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls,s=Math.min(Math.max(e,i),t);this._nextAutoLevel!==s&&(this.nextAutoLevelKey="",this._nextAutoLevel=s)}},bufferController:class{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=e=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:e,mediaSource:t}=this;this.log("Media source opened"),e&&(e.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(sc.MEDIA_ATTACHED,{media:e,mediaSource:t})),t&&t.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:e,_objectUrl:t}=this;e!==t&&hc.error(`Media element src was set while attaching MediaSource (${t} > ${e})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=e.config.preferManagedMediaSource&&"undefined"!=typeof self&&self.ManagedMediaSource,this.log=hc.log.bind(hc,t),this.warn=hc.warn.bind(hc,t),this.error=hc.error.bind(hc,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(sc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(sc.BUFFER_RESET,this.onBufferReset,this),e.on(sc.BUFFER_APPENDING,this.onBufferAppending,this),e.on(sc.BUFFER_CODECS,this.onBufferCodecs,this),e.on(sc.BUFFER_EOS,this.onBufferEos,this),e.on(sc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(sc.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(sc.FRAG_PARSED,this.onFragParsed,this),e.on(sc.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(sc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(sc.BUFFER_RESET,this.onBufferReset,this),e.off(sc.BUFFER_APPENDING,this.onBufferAppending,this),e.off(sc.BUFFER_CODECS,this.onBufferCodecs,this),e.off(sc.BUFFER_EOS,this.onBufferEos,this),e.off(sc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(sc.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(sc.FRAG_PARSED,this.onFragParsed,this),e.off(sc.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new yg(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const i=this.media=t.media,s=Uu(this.appendSource);if(i&&s){var r;const e=this.mediaSource=new s;this.log(`created media source: ${null==(r=e.constructor)?void 0:r.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming));const t=this._objectUrl=self.URL.createObjectURL(e);if(this.appendSource)try{i.removeAttribute("src");const s=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||s&&e instanceof s,bg(i),function(e,t){const i=self.document.createElement("source");i.type="video/mp4",i.src=t,e.appendChild(i)}(i,t),i.load()}catch(e){i.src=t}else i.src=t;i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(this.log("media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){this.warn(`onMediaDetaching: ${e.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),this.mediaSrc===i?(e.removeAttribute("src"),this.appendSource&&bg(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(sc.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach((e=>{this.resetBuffer(e)})),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{var i;if(t)this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,null!=(i=this.mediaSource)&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}catch(t){this.warn(`onBufferReset ${e}`,t)}}onBufferCodecs(e,t){const i=this.getSourceBufferTypes().length,s=Object.keys(t);if(s.forEach((e=>{if(i){const i=this.tracks[e];if(i&&"function"==typeof i.buffer.changeType){var s;const{id:r,codec:a,levelCodec:o,container:n,metadata:l}=t[e],d=Wu(i.codec,i.levelCodec),h=null==d?void 0:d.replace(Ag,"$1");let c=Wu(a,o);const u=null==(s=c)?void 0:s.replace(Ag,"$1");if(c&&h!==u){"audio"===e.slice(0,5)&&(c=$u(c,this.appendSource));const t=`${n};codecs=${c}`;this.appendChangeType(e,t),this.log(`switching codec ${d} to ${c}`),this.tracks[e]={buffer:i.buffer,codec:a,container:n,levelCodec:o,metadata:l,id:r}}}}else this.pendingTracks[e]=t[e]})),i)return;const r=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==r&&(this.log(`${r} bufferCodec event(s) expected ${s.join(",")}`),this.bufferCodecEventsExpected=r),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:i}=this,s={execute:()=>{const s=this.sourceBuffer[e];s&&(this.log(`changing ${e} sourceBuffer type to ${t}`),s.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn(`Failed to change ${e} SourceBuffer type`,t)}};i.append(s,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:i,operationQueue:s,tracks:r}=this,{data:a,type:o,frag:n,part:l,chunkMeta:d}=t,h=d.buffering[o],c=self.performance.now();h.start=c;const u=n.stats.buffering,p=l?l.stats.buffering:null;0===u.start&&(u.start=c),p&&0===p.start&&(p.start=c);const f=r.audio;let m=!1;"audio"===o&&"audio/mpeg"===(null==f?void 0:f.container)&&(m=!this.lastMpegAudioChunk||1===d.id||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const g=n.start,y={execute:()=>{if(h.executeStart=self.performance.now(),m){const e=this.sourceBuffer[o];if(e){const t=g-e.timestampOffset;Math.abs(t)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${g} (delta: ${t}) sn: ${n.sn})`),e.timestampOffset=g)}}this.appendExecutor(a,o)},onStart:()=>{},onComplete:()=>{const e=self.performance.now();h.executeEnd=h.end=e,0===u.first&&(u.first=e),p&&0===p.first&&(p.first=e);const{sourceBuffer:t}=this,i={};for(const e in t)i[e]=Lf.getBuffered(t[e]);this.appendErrors[o]=0,"audio"===o||"video"===o?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(sc.BUFFER_APPENDED,{type:o,frag:n,part:l,chunkMeta:d,parent:n.type,timeRanges:i})},onError:e=>{const t={type:rc.MEDIA_ERROR,parent:n.type,details:ac.BUFFER_APPEND_ERROR,sourceBufferName:o,frag:n,part:l,chunkMeta:d,error:e,err:e,fatal:!1};if(e.code===DOMException.QUOTA_EXCEEDED_ERR)t.details=ac.BUFFER_FULL_ERROR;else{const e=++this.appendErrors[o];t.details=ac.BUFFER_APPEND_ERROR,this.warn(`Failed ${e}/${i.config.appendErrorMaxRetry} times to append segment in "${o}" sourceBuffer`),e>=i.config.appendErrorMaxRetry&&(t.fatal=!0)}i.trigger(sc.ERROR,t)}};s.append(y,o,!!this.pendingTracks[o])}onBufferFlushing(e,t){const{operationQueue:i}=this,s=e=>({execute:this.removeExecutor.bind(this,e,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(sc.BUFFER_FLUSHED,{type:e})},onError:t=>{this.warn(`Failed to remove from ${e} SourceBuffer`,t)}});t.type?i.append(s(t.type),t.type):this.getSourceBufferTypes().forEach((e=>{i.append(s(e),e)}))}onFragParsed(e,t){const{frag:i,part:s}=t,r=[],a=s?s.elementaryStreams:i.elementaryStreams;a[bc]?r.push("audiovideo"):(a[yc]&&r.push("audio"),a[Ac]&&r.push("video"));0===r.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers((()=>{const e=self.performance.now();i.stats.buffering.end=e,s&&(s.stats.buffering.end=e);const t=s?s.stats:i.stats;this.hls.trigger(sc.FRAG_BUFFERED,{frag:i,part:s,stats:t,id:i.type})}),r)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce(((e,i)=>{const s=this.sourceBuffer[i];return!s||t.type&&t.type!==i||(s.ending=!0,s.ended||(s.ended=!0,this.log(`${i} sourceBuffer now EOS`))),e&&!(s&&!s.ended)}),!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers((()=>{this.getSourceBufferTypes().forEach((e=>{const t=this.sourceBuffer[e];t&&(t.ending=!1)}));const{mediaSource:e}=this;e&&"open"===e.readyState?(this.log("Calling mediaSource.endOfStream()"),e.endOfStream()):e&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${e.readyState}`)})))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||null===t)return;if(!this.getSourceBufferTypes().length)return;const s=e.config,r=i.currentTime,a=t.levelTargetDuration,o=t.live&&null!==s.liveBackBufferLength?s.liveBackBufferLength:s.backBufferLength;if(ec(o)&&o>0){const e=Math.max(o,a),t=Math.floor(r/a)*a-e;this.flushBackBuffer(r,a,t)}if(ec(s.frontBufferFlushThreshold)&&s.frontBufferFlushThreshold>0){const e=Math.max(s.maxBufferLength,s.frontBufferFlushThreshold),t=Math.max(e,a),i=Math.floor(r/a)*a+t;this.flushFrontBuffer(r,a,i)}}flushBackBuffer(e,t,i){const{details:s,sourceBuffer:r}=this;this.getSourceBufferTypes().forEach((a=>{const o=r[a];if(o){const r=Lf.getBuffered(o);if(r.length>0&&i>r.start(0)){if(this.hls.trigger(sc.BACK_BUFFER_REACHED,{bufferEnd:i}),null!=s&&s.live)this.hls.trigger(sc.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(o.ended&&r.end(r.length-1)-e<2*t)return void this.log(`Cannot flush ${a} back buffer while SourceBuffer is in ended state`);this.hls.trigger(sc.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:a})}}}))}flushFrontBuffer(e,t,i){const{sourceBuffer:s}=this;this.getSourceBufferTypes().forEach((r=>{const a=s[r];if(a){const s=Lf.getBuffered(a),o=s.length;if(o<2)return;const n=s.start(o-1),l=s.end(o-1);if(i>n||e>=n&&e<=l)return;if(a.ended&&e-l<2*t)return void this.log(`Cannot flush ${r} front buffer while SourceBuffer is in ended state`);this.hls.trigger(sc.BUFFER_FLUSHING,{startOffset:n,endOffset:1/0,type:r})}}))}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||"open"!==this.mediaSource.readyState)return;const{details:e,hls:t,media:i,mediaSource:s}=this,r=e.fragments[0].start+e.totalduration,a=i.duration,o=ec(s.duration)?s.duration:0;e.live&&t.config.liveDurationInfinity?(s.duration=1/0,this.updateSeekableRange(e)):(r>o&&r>a||!ec(a))&&(this.log(`Updating Media Source duration to ${r.toFixed(3)}`),s.duration=r)}updateSeekableRange(e){const t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&null!=t&&t.setLiveSeekableRange){const s=Math.max(0,i[0].start),r=Math.max(s,s+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${s}-${r}.`),t.setLiveSeekableRange(s,r)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,s=Object.keys(i).length;if(s&&(!e||2===s||"audiovideo"in i)){this.createSourceBuffers(i),this.pendingTracks={};const e=this.getSourceBufferTypes();if(e.length)this.hls.trigger(sc.BUFFER_CREATED,{tracks:this.tracks}),e.forEach((e=>{t.executeNext(e)}));else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const s in e)if(!t[s]){const r=e[s];if(!r)throw Error(`source buffer exists for track ${s}, however track does not`);let a=r.levelCodec||r.codec;a&&"audio"===s.slice(0,5)&&(a=$u(a,this.appendSource));const o=`${r.container};codecs=${a}`;this.log(`creating sourceBuffer(${o})`);try{const e=t[s]=i.addSourceBuffer(o),n=s;this.addBufferListener(n,"updatestart",this._onSBUpdateStart),this.addBufferListener(n,"updateend",this._onSBUpdateEnd),this.addBufferListener(n,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(n,"bufferedchange",((e,t)=>{const i=t.removedRanges;null!=i&&i.length&&this.hls.trigger(sc.BUFFER_FLUSHED,{type:s})})),this.tracks[s]={buffer:e,codec:a,container:r.container,levelCodec:r.levelCodec,metadata:r.metadata,id:r.id}}catch(e){this.error(`error while trying to add sourceBuffer: ${e.message}`),this.hls.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:s,mimeType:o})}}}get mediaSrc(){var e;const t=(null==(e=this.media)?void 0:e.firstChild)||this.media;return null==t?void 0:t.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if("closed"===(null==(t=this.mediaSource)?void 0:t.readyState))return void this.resetBuffer(e);const{operationQueue:i}=this;i.current(e).onComplete(),i.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var i;const s=new Error(`${e} SourceBuffer error. MediaSource readyState: ${null==(i=this.mediaSource)?void 0:i.readyState}`);this.error(`${s}`,t),this.hls.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:s,fatal:!1});const r=this.operationQueue.current(e);r&&r.onError(s)}removeExecutor(e,t,i){const{media:s,mediaSource:r,operationQueue:a,sourceBuffer:o}=this,n=o[e];if(!s||!r||!n)return this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),void a.shiftAndExecuteNext(e);const l=ec(s.duration)?s.duration:1/0,d=ec(r.duration)?r.duration:1/0,h=Math.max(0,t),c=Math.min(i,l,d);c>h&&(!n.ending||n.ended)?(n.ended=!1,this.log(`Removing [${h},${c}] from the ${e} SourceBuffer`),n.remove(h,c)):a.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.sourceBuffer[t];if(i)i.ended=!1,i.appendBuffer(e);else if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);const{operationQueue:i}=this,s=t.map((e=>i.appendBlocker(e)));Promise.all(s).then((()=>{e(),t.forEach((e=>{const t=this.sourceBuffer[e];null!=t&&t.updating||i.shiftAndExecuteNext(e)}))}))}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){const s=this.sourceBuffer[e];if(!s)return;const r=i.bind(this,e);this.listeners[e].push({event:t,listener:r}),s.addEventListener(t,r)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach((e=>{t.removeEventListener(e.event,e.listener)}))}},capLevelController:fy,errorController:class{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=hc.log.bind(hc,"[info]:"),this.warn=hc.warn.bind(hc,"[warning]:"),this.error=hc.error.bind(hc,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(sc.ERROR,this.onError,this),e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(sc.ERROR,this.onError,this),e.off(sc.ERROR,this.onErrorOut,this),e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(null==e?void 0:e.type)===hp?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i,s;if(t.fatal)return;const r=this.hls,a=t.context;switch(t.details){case ac.FRAG_LOAD_ERROR:case ac.FRAG_LOAD_TIMEOUT:case ac.KEY_LOAD_ERROR:case ac.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case ac.FRAG_PARSING_ERROR:if(null!=(i=t.frag)&&i.gap)return void(t.errorAction={action:tf,flags:of});case ac.FRAG_GAP:case ac.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=sf);case ac.LEVEL_EMPTY_ERROR:case ac.LEVEL_PARSING_ERROR:{var o,n;const e=t.parent===hp?t.level:r.loadLevel;t.details===ac.LEVEL_EMPTY_ERROR&&null!=(o=t.context)&&null!=(n=o.levelDetails)&&n.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case ac.LEVEL_LOAD_ERROR:case ac.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==a?void 0:a.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.level)));case ac.AUDIO_TRACK_LOAD_ERROR:case ac.AUDIO_TRACK_LOAD_TIMEOUT:case ac.SUBTITLE_LOAD_ERROR:case ac.SUBTITLE_TRACK_LOAD_TIMEOUT:if(a){const e=r.levels[r.loadLevel];if(e&&(a.type===lp&&e.hasAudioGroup(a.groupId)||a.type===dp&&e.hasSubtitleGroup(a.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=sf,void(t.errorAction.flags=nf)}return;case ac.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const e=r.levels[r.loadLevel],i=null==e?void 0:e.attrs["HDCP-LEVEL"];i?t.errorAction={action:sf,flags:lf,hdcpLevel:i}:this.keySystemError(t)}return;case ac.BUFFER_ADD_CODEC_ERROR:case ac.REMUX_ALLOC_ERROR:case ac.BUFFER_APPEND_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,null!=(s=t.level)?s:r.loadLevel));case ac.INTERNAL_EXCEPTION:case ac.BUFFER_APPENDING_ERROR:case ac.BUFFER_FULL_ERROR:case ac.LEVEL_SWITCH_ERROR:case ac.BUFFER_STALLED_ERROR:case ac.BUFFER_SEEK_OVER_HOLE:case ac.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:tf,flags:of})}t.type===rc.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=Jp(this.hls.config.playlistLoadPolicy,e),s=this.playlistError++;if(Yp(i,s,Wp(e),e.response))return{action:af,flags:of,retryConfig:i,retryCount:s};const r=this.getLevelSwitchAction(e,t);return i&&(r.retryConfig=i,r.retryCount=s),r}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),s=t.levels[i],{fragLoadPolicy:r,keyLoadPolicy:a}=t.config,o=Jp(e.details.startsWith("key")?a:r,e),n=t.levels.reduce(((e,t)=>e+t.fragmentError),0);if(s){e.details!==ac.FRAG_GAP&&s.fragmentError++;if(Yp(o,n,Wp(e),e.response))return{action:af,flags:of,retryConfig:o,retryCount:n}}const l=this.getLevelSwitchAction(e,i);return o&&(l.retryConfig=o,l.retryCount=n),l}getLevelSwitchAction(e,t){const i=this.hls;null==t&&(t=i.loadLevel);const s=this.hls.levels[t];if(s){var r,a;const t=e.details;s.loadError++,t===ac.BUFFER_APPEND_ERROR&&s.fragmentError++;let l=-1;const{levels:d,loadLevel:h,minAutoLevel:c,maxAutoLevel:u}=i;i.autoLevelEnabled||(i.loadLevel=-1);const p=null==(r=e.frag)?void 0:r.type,f=(p===cp&&t===ac.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(t===ac.BUFFER_ADD_CODEC_ERROR||t===ac.BUFFER_APPEND_ERROR))&&d.some((({audioCodec:e})=>s.audioCodec!==e)),m="video"===e.sourceBufferName&&(t===ac.BUFFER_ADD_CODEC_ERROR||t===ac.BUFFER_APPEND_ERROR)&&d.some((({codecSet:e,audioCodec:t})=>s.codecSet!==e&&s.audioCodec===t)),{type:g,groupId:y}=null!=(a=e.context)?a:{};for(let i=d.length;i--;){const r=(i+h)%d.length;if(r!==h&&r>=c&&r<=u&&0===d[r].loadError){var o,n;const i=d[r];if(t===ac.FRAG_GAP&&e.frag){const t=d[r].details;if(t){const i=Xp(e.frag,t.fragments,e.frag.start);if(null!=i&&i.gap)continue}}else{if(g===lp&&i.hasAudioGroup(y)||g===dp&&i.hasSubtitleGroup(y))continue;if(p===cp&&null!=(o=s.audioGroups)&&o.some((e=>i.hasAudioGroup(e)))||p===up&&null!=(n=s.subtitleGroups)&&n.some((e=>i.hasSubtitleGroup(e)))||f&&s.audioCodec===i.audioCodec||!f&&s.audioCodec!==i.audioCodec||m&&s.codecSet===i.codecSet)continue}l=r;break}}if(l>-1&&i.loadLevel!==l)return e.levelRetry=!0,this.playlistError=0,{action:sf,flags:of,nextAutoLevel:l}}return{action:sf,flags:nf}}onErrorOut(e,t){var i;switch(null==(i=t.errorAction)?void 0:i.action){case tf:break;case sf:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===ac.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:s,hdcpLevel:r,nextAutoLevel:a}=i;switch(s){case of:this.switchLevel(e,a);break;case lf:r&&(t.maxHdcpLevel=Dp[Dp.indexOf(r)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`)}i.resolved||this.switchLevel(e,a)}switchLevel(e,t){void 0!==t&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}},fpsController:class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(sc.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(sc.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&"function"==typeof e.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,i){const s=performance.now();if(t){if(this.lastTime){const e=s-this.lastTime,r=i-this.lastDroppedFrames,a=t-this.lastDecodedFrames,o=1e3*r/e,n=this.hls;if(n.trigger(sc.FPS_DROP,{currentDropped:r,currentDecoded:a,totalDroppedFrames:i}),o>0&&r>n.config.fpsDroppedMonitoringThreshold*a){let e=n.currentLevel;hc.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===n.autoLevelCapping||n.autoLevelCapping>=e)&&(e-=1,n.trigger(sc.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:n.currentLevel}),n.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}},stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Fc,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:tA,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends om{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",up),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(sc.ERROR,this.onError,this),e.on(sc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(sc.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(sc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(sc.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(sc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(sc.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(sc.ERROR,this.onError,this),e.off(sc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(sc.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(sc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(sc.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(sc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(sc.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=Kf,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:s}=t;if(this.fragPrevious=i,this.state=Kf,!s)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let a;const o=i.start;for(let e=0;e=r[e].start&&o<=r[e].end){a=r[e];break}const n=i.start+i.duration;a?a.end=n:(a={start:o,end:n},r.push(a)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null)}onBufferFlushing(e,t){const{startOffset:i,endOffset:s}=t;if(0===i&&s!==Number.POSITIVE_INFINITY){const e=s-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach((t=>{for(let i=0;inew Up(e))):(this.tracksBuffered=[],this.levels=t.map((e=>{const t=new Up(e);return this.tracksBuffered[t.id]=[],t})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,up),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,null==(i=this.levels)||!i.length||-1===this.currentTrackId)return void this.clearInterval();const s=this.levels[this.currentTrackId];null!=s&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.setInterval(500)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:s,levels:r}=this,{details:a,id:o}=t;if(!r)return void this.warn(`Subtitle tracks were reset while loading level ${o}`);const n=r[s];if(o>=r.length||o!==s||!n)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(a.live||null!=(i=n.details)&&i.live){const e=this.mainDetails;if(a.deltaUpdateFailed||!e)return;const t=e.fragments[0];var d;if(n.details)l=this.alignPlaylists(a,n.details,null==(d=this.levelLastLoaded)?void 0:d.details),0===l&&t&&(l=t.start,Gp(a,l));else a.hasProgramDateTime&&e.hasProgramDateTime?(Ff(a,e),l=a.fragments[0].start):t&&(l=t.start,Gp(a,l))}if(n.details=a,this.levelLastLoaded=n,this.startFragRequested||!this.mainDetails&&a.live||this.setStartPosition(this.mainDetails||a,l),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===Kf){Xp(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),n.details=void 0)}}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,s=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&null!=s&&s.key&&s.iv&&"AES-128"===s.method){const e=performance.now();this.decrypter.decrypt(new Uint8Array(i),s.key.buffer,s.iv.buffer).catch((e=>{throw r.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e})).then((i=>{const s=performance.now();r.trigger(sc.FRAG_DECRYPTED,{frag:t,payload:i,stats:{tstart:e,tdecrypt:s}})})).catch((e=>{this.warn(`${e.name}: ${e.message}`),this.state=Kf}))}}doTick(){if(this.media){if(this.state===Kf){const{currentTrackId:e,levels:t}=this,i=null==t?void 0:t[e];if(!i||!t.length||!i.details)return;const{config:s}=this,r=this.getLoadPosition(),a=Lf.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,s.maxBufferHole),{end:o,len:n}=a,l=this.getFwdBufferInfo(this.media,hp),d=i.details;if(n>this.getMaxBufferLength(null==l?void 0:l.len)+d.levelTargetDuration)return;const h=d.fragments,c=h.length,u=d.edge;let p=null;const f=this.fragPrevious;if(ou-e?0:e;p=Xp(f,h,Math.max(h[0].start,o),t),!p&&f&&f.startthis.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=null;const t=vp(this.media.textTracks);for(let i=0;i-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(sc.LEVEL_LOADING,this.onLevelLoading,this),e.on(sc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(sc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(sc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(sc.LEVEL_LOADING,this.onLevelLoading,this),e.off(sc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(sc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(sc.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);vp(this.media.textTracks).forEach((e=>{Ap(e)})),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:s,details:r}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==s)return void this.warn(`Subtitle track with id:${i} and group:${s} not found in active group ${null==a?void 0:a.groupId}`);const o=a.details;a.details=t.details,this.log(`Subtitle track ${i} "${a.name}" lang:${a.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(null==s?void 0:s.length)!==(null==i?void 0:i.length)||null!=i&&i.some((e=>-1===(null==s?void 0:s.indexOf(e))))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!i||-1!==i.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.subtitlePreference;if(!r&&t){this.selectDefaultTrack=!1;const i=Af(t,e);if(i>-1)r=e[i];else{const e=Af(t,this.tracks);r=this.tracks[e]}}let s=this.findTrackId(r);-1===s&&r&&(s=this.findTrackId(null));const a={subtitleTracks:e};this.log(`Updating subtitle tracks, ${e.length} track(s) found in "${null==i?void 0:i.join(",")}" group-id`),this.hls.trigger(sc.SUBTITLE_TRACKS_UPDATED,a),-1!==s&&-1===this.trackId&&this.setSubtitleTrack(s)}else this.shouldReloadPlaylist(r)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let s=0;s-1){const e=this.tracksInGroup[s];return this.setSubtitleTrack(s),e}if(i)return null;{const i=Af(e,t);if(i>-1)return t[i]}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const i=t.id,s=t.groupId;let r=t.url;if(e)try{r=e.addDirectives(r)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(sc.SUBTITLE_TRACK_LOADING,{url:r,id:i,groupId:s,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=vp(e.textTracks),i=this.currentTrack;let s;if(i&&(s=t.filter((e=>mg(i,e)))[0],s||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach((e=>{"disabled"!==e.mode&&e!==s&&(e.mode="disabled")})),s){const e=this.subtitleDisplay?"showing":"hidden";s.mode!==e&&(s.mode=e)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=e);if(e<-1||e>=t.length||!ec(e))return void this.warn(`Invalid subtitle track id: ${e}`);this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e]||null;if(this.trackId=e,this.currentTrack=s,this.toggleTrackModes(),!s)return void this.hls.trigger(sc.SUBTITLE_TRACK_SWITCH,{id:e});const r=!!s.details&&!s.details.live;if(e===this.trackId&&s===i&&r)return;this.log(`Switching to subtitle-track ${e}`+(s?` "${s.name}" lang:${s.lang} group:${s.groupId}`:""));const{id:a,groupId:o="",name:n,type:l,url:d}=s;this.hls.trigger(sc.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:n,type:l,url:d});const h=this.switchParams(s.url,null==i?void 0:i.details);this.loadPlaylist(h)}},timelineController:class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(sc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(sc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(sc.FRAG_LOADING,this.onFragLoading,this),e.on(sc.FRAG_LOADED,this.onFragLoaded,this),e.on(sc.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(sc.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(sc.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(sc.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(sc.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(sc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(sc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(sc.FRAG_LOADING,this.onFragLoading,this),e.off(sc.FRAG_LOADED,this.onFragLoaded,this),e.off(sc.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(sc.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(sc.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(sc.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(sc.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new Ng(this,"textTrack1"),t=new Ng(this,"textTrack2"),i=new Ng(this,"textTrack3"),s=new Ng(this,"textTrack4");this.cea608Parser1=new Ug(1,e,t),this.cea608Parser2=new Ug(3,i,s)}}addCues(e,t,i,s,r){let a=!1;for(let e=r.length;e--;){const s=r[e],h=(o=s[0],n=s[1],l=t,d=i,Math.min(n,d)-Math.max(o,l));if(h>=0&&(s[0]=Math.min(s[0],t),s[1]=Math.max(s[1],i),a=!0,h/(i-t)>.5))return}var o,n,l,d;if(a||r.push([t,i]),this.config.renderTextTracksNatively){const r=this.captionsTracks[e];this.Cues.newCue(r,t,i,s)}else{const r=this.Cues.newCue(null,t,i,s);this.hls.trigger(sc.CUES_PARSED,{type:"captions",cues:r,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:s,timescale:r}){const{unparsedVttFrags:a}=this;"main"===i&&(this.initPTS[t.cc]={baseTime:s,timescale:r}),a.length&&(this.unparsedVttFrags=[],a.forEach((e=>{this.onFragLoaded(sc.FRAG_LOADED,e)})))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let s=0;s{Ap(e[t]),delete e[t]})),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let e=0;ee.textCodec===ty));if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(pg(this.tracks,i))return void(this.tracks=i);if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const e=this.media,t=e?vp(e.textTracks):null;if(this.tracks.forEach(((e,i)=>{let s;if(t){let i=null;for(let s=0;snull!==e)).map((e=>e.label));e.length&&hc.warn(`Media element contains unused subtitle tracks: ${e.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const e=this.tracks.map((e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e})));this.hls.trigger(sc.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach((e=>{const t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;const i=`textTrack${t[1]}`,s=this.captionsProperties[i];s&&(s.label=e.name,e.lang&&(s.languageCode=e.lang),s.media=e)}))}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:s,lastCc:r,lastSn:a,lastPartIndex:o}=this;if(this.enabled&&i&&s&&t.frag.type===hp){var n,l;const{cc:e,sn:d}=t.frag,h=null!=(n=null==t||null==(l=t.part)?void 0:l.index)?n:-1;d===a+1||d===a&&h===o+1||e===r||(i.reset(),s.reset()),this.lastCc=e,this.lastSn=d,this.lastPartIndex=h}}onFragLoaded(e,t){const{frag:i,payload:s}=t;if(i.type===up)if(s.byteLength){const e=i.decryptdata,r="stats"in t;if(null==e||!e.encrypted||r){const e=this.tracks[i.level],r=this.vttCCs;r[i.cc]||(r[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),e&&e.textCodec===ty?this._parseIMSC1(i,s):this._parseVTTs(t)}}else this.hls.trigger(sc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;ay(t,this.initPTS[e.cc],(t=>{this._appendCues(t,e.level),i.trigger(sc.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(t=>{hc.log(`Failed to parse IMSC1: ${t}`),i.trigger(sc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))}_parseVTTs(e){var t;const{frag:i,payload:s}=e,{initPTS:r,unparsedVttFrags:a}=this,o=r.length-1;if(!r[i.cc]&&-1===o)return void a.push(e);const n=this.hls;ey(null!=(t=i.initSegment)&&t.data?Su(i.initSegment.data,new Uint8Array(s)):s,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,(e=>{this._appendCues(e,i.level),n.trigger(sc.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})}),(t=>{const r="Missing initPTS for VTT MPEGTS"===t.message;r?a.push(e):this._fallbackToIMSC1(i,s),hc.log(`Failed to parse VTT cue: ${t}`),r&&o>i.cc||n.trigger(sc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:t})}))}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||ay(t,this.initPTS[e.cc],(()=>{i.textCodec=ty,this._parseIMSC1(e,t)}),(()=>{i.textCodec="wvtt"}))}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||"disabled"===i.mode)return;e.forEach((e=>yp(i,e)))}else{const s=this.tracks[t];if(!s)return;const r=s.default?"default":"subtitles"+t;i.trigger(sc.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===up&&this.onFragLoaded(sc.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:s}=this;if(!this.enabled||!i||!s)return;const{frag:r,samples:a}=t;if(r.type!==hp||"NONE"!==this.closedCaptionsForLevel(r))for(let e=0;ebp(e[s],t,i)))}if(this.config.renderTextTracksNatively&&0===t&&void 0!==s){const{textTracks:e}=this;Object.keys(e).forEach((i=>bp(e[i],t,s)))}}}extractCea608Data(e){const t=[[],[]],i=31&e[0];let s=2;for(let r=0;r0&&-1===e?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=Kf):(this.loadedmetadata=!1,this.state=Zf),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case Kf:this.doTickIdle();break;case Zf:{var e;const{levels:t,trackId:i}=this,s=null==t||null==(e=t[i])?void 0:e.details;if(s){if(this.waitForCdnTuneIn(s))break;this.state=rm}break}case Xf:{var t;const e=performance.now(),i=this.retryDate;if(!i||e>=i||null!=(t=this.media)&&t.seeking){const{levels:e,trackId:t}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==e?void 0:e[t])||null),this.state=Kf}break}case rm:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:s,complete:r}=e;if(void 0!==this.initPTS[t.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=Qf;const e={frag:t,part:i,payload:s.flush(),networkDetails:null};this._handleFragmentLoadProgress(e),r&&super._handleFragmentLoadComplete(e)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${t.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const e=this.getLoadPosition(),i=Lf.bufferInfo(this.mediaBuffer,e,this.config.maxBufferHole);Zp(i.end,this.config.maxFragLookUpTolerance,t)<0&&(this.log(`Waiting fragment cc (${t.cc}) @ ${t.start} cancelled because another fragment at ${i.end} is needed`),this.clearWaitingFragment())}}else this.state=Kf}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Kf)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:i,trackId:s}=this,r=e.config;if(!i&&(this.startFragRequested||!r.startFragPrefetch)||null==t||!t[s])return;const a=t[s],o=a.details;if(!o||o.live&&this.levelLastLoaded!==a||this.waitForCdnTuneIn(o))return void(this.state=Zf);const n=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&n&&(this.bufferFlushed=!1,this.afterBufferFlushed(n,yc,cp));const l=this.getFwdBufferInfo(n,cp);if(null===l)return;const{bufferedTrack:d,switchingTrack:h}=this;if(!h&&this._streamEnded(l,o))return e.trigger(sc.BUFFER_EOS,{type:"audio"}),void(this.state=im);const c=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,hp),u=l.len,p=this.getMaxBufferLength(null==c?void 0:c.len),f=o.fragments,m=f[0].start;let g=this.flushing?this.getLoadPosition():l.end;if(h&&i){const e=this.getLoadPosition();d&&!fg(h.attrs,d.attrs)&&(g=e),o.PTSKnown&&em||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=m+.05)}if(u>=p&&!h&&gc.end+o.targetduration;if(b||(null==c||!c.len)&&l.len){const e=this.getAppendedFrag(y.start,hp);if(null===e)return;if(A||(A=!!e.gap||!!b&&0===c.len),b&&!A||A&&l.nextStart&&l.nextStartnew Up(e)))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:s}=this;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),i?this.setInterval(100):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=Kf,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=qf),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(sc.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i;if(null==this.mainDetails)return void(this.cachedTrackLoadedData=t);const{levels:s}=this,{details:r,id:a}=t;if(!s)return void this.warn(`Audio tracks were reset while loading level ${a}`);this.log(`Audio track ${a} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const o=s[a];let n=0;if(r.live||null!=(i=o.details)&&i.live){this.checkLiveUpdate(r);const e=this.mainDetails;if(r.deltaUpdateFailed||!e)return;var l;if(!o.details&&r.hasProgramDateTime&&e.hasProgramDateTime)Ff(r,e),n=r.fragments[0].start;else n=this.alignPlaylists(r,o.details,null==(l=this.levelLastLoaded)?void 0:l.details)}o.details=r,this.levelLastLoaded=o,this.startFragRequested||!this.mainDetails&&r.live||this.setStartPosition(this.mainDetails||r,n),this.state!==Zf||this.waitForCdnTuneIn(r)||(this.state=Kf),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:s,payload:r}=e,{config:a,trackId:o,levels:n}=this;if(!n)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const l=n[o];if(!l)return void this.warn("Audio track is undefined on fragment load progress");const d=l.details;if(!d)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(i.start);const h=a.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let c=this.transmuxer;c||(c=this.transmuxer=new ug(this.hls,cp,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const u=this.initPTS[i.cc],p=null==(t=i.initSegment)?void 0:t.data;if(void 0!==u){const e=!1,t=s?s.index:-1,a=-1!==t,o=new Pf(i.level,i.sn,i.stats.chunkCount,r.byteLength,t,a);c.push(r,p,h,"",i,s,d.totalduration,e,o,u)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${d.startSN} ,${d.endSN}],track ${o}`);const{cache:e}=this.waitingData=this.waitingData||{frag:i,part:s,cache:new nm,complete:!1};e.push(new Uint8Array(r)),this.waitingVideoCC=this.videoTrackCC,this.state=rm}}_handleFragmentLoadComplete(e){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:i,part:s}=t;if(i.type===cp)if(this.fragContextChanged(i))this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if("initSegment"!==i.sn){this.fragPrevious=i;const e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(sc.AUDIO_TRACK_SWITCHED,Yh({},e)))}this.fragBufferedComplete(i,s)}else if(!this.loadedmetadata&&i.type===hp){const e=this.videoBuffer||this.media;if(e){Lf.getBuffered(e).length&&(this.loadedmetadata=!0)}}}onError(e,t){var i;if(t.fatal)this.state=sm;else switch(t.details){case ac.FRAG_GAP:case ac.FRAG_PARSING_ERROR:case ac.FRAG_DECRYPT_ERROR:case ac.FRAG_LOAD_ERROR:case ac.FRAG_LOAD_TIMEOUT:case ac.KEY_LOAD_ERROR:case ac.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(cp,t);break;case ac.AUDIO_TRACK_LOAD_ERROR:case ac.AUDIO_TRACK_LOAD_TIMEOUT:case ac.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Zf||(null==(i=t.context)?void 0:i.type)!==lp||(this.state=Kf);break;case ac.BUFFER_APPEND_ERROR:case ac.BUFFER_FULL_ERROR:if(!t.parent||"audio"!==t.parent)return;if(t.details===ac.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case ac.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushing(e,{type:t}){t!==Ac&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Ac){this.flushing=!1,this.bufferFlushed=!0,this.state===im&&(this.state=Kf);const e=this.mediaBuffer||this.media;e&&(this.afterBufferFlushed(e,t,cp),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:s}=this,{remuxResult:r,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o)return void this.resetWhenMissingContext(a);const{frag:n,part:l,level:d}=o,{details:h}=d,{audio:c,text:u,id3:p,initSegment:f}=r;if(!this.fragContextChanged(n)&&h){if(this.state=em,this.switchingTrack&&c&&this.completeAudioSwitch(this.switchingTrack),null!=f&&f.tracks){const e=n.initSegment||n;this._bufferInitSegment(d,f.tracks,e,a),s.trigger(sc.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:f.tracks})}if(c){const{startPTS:e,endPTS:t,startDTS:i,endDTS:s}=c;l&&(l.elementaryStreams[yc]={startPTS:e,endPTS:t,startDTS:i,endDTS:s}),n.setElementaryStreamInfo(yc,e,t,i,s),this.bufferFragmentData(c,n,l,a)}if(null!=p&&null!=(t=p.samples)&&t.length){const e=Zh({id:i,frag:n,details:h},p);s.trigger(sc.FRAG_PARSING_METADATA,e)}if(u){const e=Zh({id:i,frag:n,details:h},u);s.trigger(sc.FRAG_PARSING_USERDATA,e)}}else this.fragmentTracker.removeFragment(n)}_bufferInitSegment(e,t,i,s){if(this.state!==em)return;t.video&&delete t.video;const r=t.audio;if(!r)return;r.id="audio";const a=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${a}/${r.codec}]`),a&&1===a.split(",").length&&(r.levelCodec=a),this.hls.trigger(sc.BUFFER_CODECS,t);const o=r.initSegment;if(null!=o&&o.byteLength){const e={type:"audio",frag:i,part:null,chunkMeta:s,parent:i.type,data:o};this.hls.trigger(sc.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);var r;if(this.fragCurrent=e,this.switchingTrack||s===wf||s===Tf)if("initSegment"===e.sn)this._loadInitSegment(e,t);else if(null!=(r=t.details)&&r.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=rm;const i=this.mainDetails;i&&i.fragments[0].start!==t.details.fragments[0].start&&Ff(t.details,i)}else this.startFragRequested=!0,super.loadFragment(e,t,i);else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:i}=this,s=null==i?void 0:i.attrs,r=e.attrs;t&&s&&(s.CHANNELS!==r.CHANNELS||i.name!==e.name||i.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(sc.AUDIO_TRACK_SWITCHED,Yh({},e))}},audioTrackController:class extends df{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(sc.LEVEL_LOADING,this.onLevelLoading,this),e.on(sc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(sc.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(sc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(sc.LEVEL_LOADING,this.onLevelLoading,this),e.off(sc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(sc.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(sc.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:s,details:r}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==s)return void this.warn(`Audio track with id:${i} and group:${s} not found in active group ${null==a?void 0:a.groupId}`);const o=a.details;a.details=t.details,this.log(`Audio track ${i} "${a.name}" lang:${a.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(null==s?void 0:s.length)!==(null==i?void 0:i.length)||null!=i&&i.some((e=>-1===(null==s?void 0:s.indexOf(e))))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!i||-1!==i.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.audioPreference;if(!r&&t){const i=Af(t,e,vf);if(i>-1)r=e[i];else{const e=Af(t,this.tracks);r=this.tracks[e]}}let s=this.findTrackId(r);-1===s&&r&&(s=this.findTrackId(null));const o={audioTracks:e};this.log(`Updating audio tracks, ${e.length} track(s) found in group(s): ${null==i?void 0:i.join(",")}`),this.hls.trigger(sc.AUDIO_TRACKS_UPDATED,o);const n=this.trackId;if(-1!==s&&-1===n)this.setAudioTrack(s);else if(e.length&&-1===n){var a;const t=new Error(`No audio track selected for current audio group-ID(s): ${null==(a=this.groupIds)?void 0:a.join(",")} track count: ${e.length}`);this.warn(t.message),this.hls.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}else this.shouldReloadPlaylist(r)&&this.setAudioTrack(this.trackId)}onError(e,t){!t.fatal&&t.context&&(t.context.type!==lp||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||(this.requestScheduled=-1,this.checkRetry(t)))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const s=this.currentTrack;if(s&&bf(e,s,vf))return s;const r=Af(e,this.tracksInGroup,vf);if(r>-1){const e=this.tracksInGroup[r];return this.setAudioTrack(r),e}if(s){let s=t.loadLevel;-1===s&&(s=t.firstAutoLevel);const r=function(e,t,i,s,r){const a=t[s],o=t.reduce(((e,t,i)=>{const s=t.uri;return(e[s]||(e[s]=[])).push(i),e}),{})[a.uri];o.length>1&&(s=Math.max.apply(Math,o));const n=a.videoRange,l=a.frameRate,d=a.codecSet.substring(0,4),h=_f(t,s,(t=>{if(t.videoRange!==n||t.frameRate!==l||t.codecSet.substring(0,4)!==d)return!1;const s=t.audioGroups,a=i.filter((e=>!s||-1!==s.indexOf(e.groupId)));return Af(e,a,r)>-1}));return h>-1?h:_f(t,s,(t=>{const s=t.audioGroups,a=i.filter((e=>!s||-1!==s.indexOf(e.groupId)));return Af(e,a,r)>-1}))}(e,t.levels,i,s,vf);if(-1===r)return null;t.nextLoadLevel=r}if(e.channels||e.audioCodec){const t=Af(e,i);if(t>-1)return i[t]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length)return void this.warn(`Invalid audio track id: ${e}`);this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e],r=s.details&&!s.details.live;if(e===this.trackId&&s===i&&r)return;if(this.log(`Switching to audio-track ${e} "${s.name}" lang:${s.lang} group:${s.groupId} channels:${s.channels}`),this.trackId=e,this.currentTrack=s,this.hls.trigger(sc.AUDIO_TRACK_SWITCHING,Yh({},s)),r)return;const a=this.switchParams(s.url,null==i?void 0:i.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:Ay.MANIFEST,su:!this.initialized})}catch(e){hc.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=e=>{try{const t=e.frag,i=this.hls.levels[t.level],s=this.getObjectType(t),r={d:1e3*t.duration,ot:s};s!==Ay.VIDEO&&s!==Ay.AUDIO&&s!=Ay.MUXED||(r.br=i.bitrate/1e3,r.tb=this.getTopBandwidth(s)/1e3,r.bl=this.getBufferLength(s)),this.apply(e,r)}catch(e){hc.warn("Could not generate segment CMCD data.",e)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;null!=i&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||function(){try{return crypto.randomUUID()}catch(e){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){let t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:3&i|8).toString(16)}))}}}(),this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(sc.MEDIA_DETACHED,this.onMediaDetached,this),e.on(sc.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(sc.MEDIA_DETACHED,this.onMediaDetached,this),e.off(sc.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,s;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(s=t.tracks.video)?void 0:s.buffer}createData(){var e;return{v:1,sf:by.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Zh(t,this.createData());const i=t.ot===Ay.INIT||t.ot===Ay.VIDEO||t.ot===Ay.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);const{includeKeys:s}=this;s&&(t=Object.keys(t).reduce(((e,i)=>(s.includes(i)&&(e[i]=t[i]),e)),{})),this.useHeaders?(e.headers||(e.headers={}),Hy(e.headers,t)):e.url=$y(e.url,t)}getObjectType(e){const{type:t}=e;return"subtitle"===t?Ay.TIMED_TEXT:"initSegment"===e.sn?Ay.INIT:"audio"===t?Ay.AUDIO:"main"===t?this.hls.audioTracks.length?Ay.VIDEO:Ay.MUXED:void 0}getTopBandwidth(e){let t,i=0;const s=this.hls;if(e===Ay.AUDIO)t=s.audioTracks;else{const e=s.maxAutoLevel,i=e>-1?e+1:s.levels.length;t=s.levels.slice(0,i)}for(const e of t)e.bitrate>i&&(i=e.bitrate);return i>0?i:NaN}getBufferLength(e){const t=this.hls.media,i=e===Ay.AUDIO?this.audioBuffer:this.videoBuffer;if(!i||!t)return NaN;return 1e3*Lf.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,s){t(e),this.loader.load(e,i,s)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,s){t(e),this.loader.load(e,i,s)}}}},contentSteeringController:class{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=hc.log.bind(hc,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(sc.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(sc.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter((t=>t!==e)))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;null!==i&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((null==i?void 0:i.action)===sf&&i.flags===nf){const e=this.levels;let s=this.pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:i,pathwayId:s,type:a}=t.context;i&&e?r=this.getPathwayForGroupId(i,a,r):s&&(r=s)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!s&&e&&(s=e.reduce(((e,t)=>(-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e)),[])),s&&s.length>1&&(this.updatePathwayPriority(s),i.resolved=this.pathwayId!==r),i.resolved||hc.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${e?e.length:e} priorities: ${JSON.stringify(s)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return null===this.levels?[]:this.levels.filter((t=>e===t.pathwayId))}updatePathwayPriority(e){let t;this.pathwayPriority=e;const i=this.penalizedPathways,s=performance.now();Object.keys(i).forEach((e=>{s-i[e]>3e5&&delete i[e]}));for(let s=0;s0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,$p(t),this.hls.trigger(sc.LEVELS_UPDATED,{levels:t});const e=this.hls.levels[a];o&&e&&this.levels&&(e.attrs["STABLE-VARIANT-ID"]!==o.attrs["STABLE-VARIANT-ID"]&&e.bitrate!==o.bitrate&&this.log(`Unstable Pathways change from bitrate ${o.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,i){const s=this.getLevelsForPathway(i).concat(this.levels||[]);for(let i=0;i{const{ID:r,"BASE-ID":a,"URI-REPLACEMENT":o}=e;if(t.some((e=>e.pathwayId===r)))return;const n=this.getLevelsForPathway(a).map((e=>{const t=new pc(e.attrs);t["PATHWAY-ID"]=r;const a=t.AUDIO&&`${t.AUDIO}_clone_${r}`,n=t.SUBTITLES&&`${t.SUBTITLES}_clone_${r}`;a&&(i[t.AUDIO]=a,t.AUDIO=a),n&&(s[t.SUBTITLES]=n,t.SUBTITLES=n);const l=Jy(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",o),d=new Up({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:l,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t{this.log(`Loaded steering manifest: "${s}"`);const a=e.data;if(1!==a.VERSION)return void this.log(`Steering VERSION ${a.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=a.TTL;const{"RELOAD-URI":o,"PATHWAY-CLONES":n,"PATHWAY-PRIORITY":l}=a;if(o)try{this.uri=new self.URL(o,s).href}catch(e){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${o}`)}this.scheduleRefresh(this.uri||i.url),n&&this.clonePathways(n);const d={steeringManifest:a,url:s.toString()};this.hls.trigger(sc.STEERING_MANIFEST_LOADED,d),l&&this.updatePathwayPriority(l)},onError:(e,t,i,s)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),410===e.code)return this.enabled=!1,void this.log(`Steering manifest ${t.url} no longer available`);let r=1e3*this.timeToLoad;if(429!==e.code)this.scheduleRefresh(this.uri||t.url,r);else{const e=this.loader;if("function"==typeof(null==e?void 0:e.getResponseHeader)){const t=e.getResponseHeader("Retry-After");t&&(r=1e3*parseFloat(t))}this.log(`Steering manifest ${t.url} rate limited`)}},onTimeout:(e,t,i)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(r,n,l)}scheduleRefresh(e,t=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout((()=>{var t;const i=null==(t=this.hls)?void 0:t.media;!i||i.ended?this.scheduleRefresh(e,1e3*this.timeToLoad):this.loadSteeringManifest(e)}),t)}}});function sA(e){return e&&"object"==typeof e?Array.isArray(e)?e.map(sA):Object.keys(e).reduce(((t,i)=>(t[i]=sA(e[i]),t)),{}):e}function rA(e){const t=e.loader;if(t!==Qy&&t!==Ky)hc.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1})()&&(e.loader=Qy,e.progressive=!0,e.enableSoftwareAES=!0,hc.log("[config]: Progressive streaming enabled, using FetchLoader"))}}let aA;class oA extends df{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(sc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(sc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(sc.FRAG_BUFFERED,this.onFragBuffered,this),e.on(sc.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(sc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(sc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(sc.FRAG_BUFFERED,this.onFragBuffered,this),e.off(sc.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach((e=>{e.loadError=0,e.fragmentError=0})),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,s=[],r={},a={};let o=!1,n=!1,l=!1;t.levels.forEach((e=>{var t,d;const h=e.attrs;let{audioCodec:c,videoCodec:u}=e;-1!==(null==(t=c)?void 0:t.indexOf("mp4a.40.34"))&&(aA||(aA=/chrome|firefox/i.test(navigator.userAgent)),aA&&(e.audioCodec=c=void 0)),c&&(e.audioCodec=c=$u(c,i)),0===(null==(d=u)?void 0:d.indexOf("avc1"))&&(u=e.videoCodec=function(e){const t=e.split(".");if(t.length>2){let e=t.shift()+".";return e+=parseInt(t.shift()).toString(16),e+=("000"+parseInt(t.shift()).toString(16)).slice(-4),e}return e}(u));const{width:p,height:f,unknownCodecs:m}=e;if(o||(o=!(!p||!f)),n||(n=!!u),l||(l=!!c),null!=m&&m.length||c&&!Ou(c,"audio",i)||u&&!Ou(u,"video",i))return;const{CODECS:g,"FRAME-RATE":y,"HDCP-LEVEL":A,"PATHWAY-ID":b,RESOLUTION:v,"VIDEO-RANGE":_}=h,S=`${`${b||"."}-`}${e.bitrate}-${v}-${y}-${g}-${_}-${A}`;if(r[S])if(r[S].uri===e.url||e.attrs["PATHWAY-ID"])r[S].addGroupId("audio",h.AUDIO),r[S].addGroupId("text",h.SUBTITLES);else{const t=a[S]+=1;e.attrs["PATHWAY-ID"]=new Array(t+1).join(".");const i=new Up(e);r[S]=i,s.push(i)}else{const t=new Up(e);r[S]=t,a[S]=1,s.push(t)}})),this.filterAndSortMediaOptions(s,t,o,n,l)}filterAndSortMediaOptions(e,t,i,s,r){let a=[],o=[],n=e;if((i||s)&&r&&(n=n.filter((({videoCodec:e,videoRange:t,width:i,height:s})=>{return(!!e||!(!i||!s))&&(!!(r=t)&&Lp.indexOf(r)>-1);var r}))),0===n.length)return void Promise.resolve().then((()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const e=new Error("no level with compatible codecs found in manifest");this.hls.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}}));if(t.audioTracks){const{preferManagedMediaSource:e}=this.hls.config;a=t.audioTracks.filter((t=>!t.audioCodec||Ou(t.audioCodec,"audio",e))),nA(a)}t.subtitles&&(o=t.subtitles,nA(o));const l=n.slice(0);n.sort(((e,t)=>{if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return Lp.indexOf(e.videoRange)-Lp.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){const i=zu(e.videoCodec),s=zu(t.videoCodec);if(i!==s)return s-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){const i=Gu(e.codecSet),s=Gu(t.codecSet);if(i!==s)return s-i}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0}));let d=l[0];if(this.steering&&(n=this.steering.filterParsedLevels(n),n.length!==l.length))for(let e=0;ei&&i===iA.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}const c=r&&!s,u={levels:n,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:s,altAudio:!c&&a.some((e=>!!e.url))};this.hls.trigger(sc.MANIFEST_PARSED,u),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return 0===this._levels.length?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(0===t.length)return;if(e<0||e>=t.length){const i=new Error("invalid level idx"),s=e<0;if(this.hls.trigger(sc.ERROR,{type:rc.OTHER_ERROR,details:ac.LEVEL_SWITCH_ERROR,level:e,fatal:s,error:i,reason:i.message}),s)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,s=this.currentLevel,r=s?s.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,i===e&&a.details&&s&&r===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${i}${r?" with Pathway "+r:""}`);const n={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(sc.LEVEL_SWITCHING,n);const l=a.details;if(!l||l.live){const e=this.switchParams(a.uri,null==s?void 0:s.details);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(void 0===this._startLevel){const e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){!t.fatal&&t.context&&t.context.type===np&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(void 0!==t&&t.type===hp){const e=t.elementaryStreams;if(!Object.keys(e).some((t=>!!e[t])))return;const i=this._levels[t.level];null!=i&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var i;const{level:s,details:r}=t,a=this._levels[s];var o;if(!a)return this.warn(`Invalid level index ${s}`),void(null!=(o=t.deliveryDirectives)&&o.skip&&(r.deltaUpdateFailed=!0));s===this.currentLevelIndex?(0===a.fragmentError&&(a.loadError=0),this.playlistLoaded(s,t,a.details)):null!=(i=t.deliveryDirectives)&&i.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){let s=i.uri;if(e)try{s=e.addDirectives(s)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}const r=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${void 0!==(null==e?void 0:e.msn)?" at sn "+e.msn+" part "+e.part:""} with${r?" Pathway "+r:""} ${s}`),this.clearTimer(),this.hls.trigger(sc.LEVEL_LOADING,{url:s,level:t,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const i=this._levels.filter(((t,i)=>i!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach((e=>e.level=-1))),!1)));$p(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(sc.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(sc.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function nA(e){const t={};e.forEach((e=>{const i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++}))}class lA{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const s=this.keyUriToKeyInfo[i].loader;if(s){var t;if(e&&e!==(null==(t=s.context)?void 0:t.frag.type))return;s.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=ac.KEY_LOAD_ERROR,i,s,r){return new Gf({type:rc.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:i,networkDetails:s})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:s}=e;for(let e=0;e{r.setKeyFormat(e)}));break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then((t=>this.loadInternal(e,t))):this.loadInternal(e)}loadInternal(e,t){var i,s;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const i=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,ac.KEY_LOAD_ERROR,i))}const a=r.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,ac.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));let o=this.keyUriToKeyInfo[a];if(null!=(i=o)&&i.decryptdata.key)return r.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});var n;if(null!=(s=o)&&s.keyLoadPromise)switch(null==(n=o.mediaKeySessionContext)?void 0:n.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then((t=>(r.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:o})))}switch(o=this.keyUriToKeyInfo[a]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===r.keyFormat?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,ac.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const t=this.emeController.loadKey(i);if(t)return(e.keyLoadPromise=t.then((t=>(e.mediaKeySessionContext=t,i)))).catch((t=>{throw e.keyLoadPromise=null,t}))}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,s=new(0,i.loader)(i);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise(((r,a)=>{const o={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},n=i.keyLoadPolicy.default,l={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,i,s)=>{const{frag:o,keyInfo:n,url:l}=i;if(!o.decryptdata||n!==this.keyUriToKeyInfo[l])return a(this.createKeyLoadError(o,ac.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),s));n.decryptdata.key=o.decryptdata.key=new Uint8Array(e.data),o.keyLoader=null,n.loader=null,r({frag:o,keyInfo:n})},onError:(e,i,s,r)=>{this.resetLoader(i),a(this.createKeyLoadError(t,ac.KEY_LOAD_ERROR,new Error(`HTTP Error ${e.code} loading key ${e.text}`),s,Yh({url:o.url,data:void 0},e)))},onTimeout:(e,i,s)=>{this.resetLoader(i),a(this.createKeyLoadError(t,ac.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),s))},onAbort:(e,i,s)=>{this.resetLoader(i),a(this.createKeyLoadError(t,ac.INTERNAL_ABORTED,new Error("key loading aborted"),s))}};s.load(o,l,d)}))}resetLoader(e){const{frag:t,keyInfo:i,url:s}=e,r=i.loader;t.keyLoader===r&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[s],r&&r.destroy()}}function dA(){return self.SourceBuffer||self.WebKitSourceBuffer}function hA(){if(!Uu())return!1;const e=dA();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}class cA{constructor(e,t,i,s){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=s}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:i,media:s,stalled:r}=this;if(null===s)return;const{currentTime:a,seeking:o}=s,n=this.seeking&&!o,l=!this.seeking&&o;if(this.seeking=o,a!==e){if(this.moved=!0,o||(this.nudgeRetry=0),null!==r){if(this.stallReported){const e=self.performance.now()-r;hc.warn(`playback not stuck anymore @${a}, after ${Math.round(e)}ms`),this.stallReported=!1}this.stalled=null}return}if(l||n)return void(this.stalled=null);if(s.paused&&!o||s.ended||0===s.playbackRate||!Lf.getBuffered(s).length)return void(this.nudgeRetry=0);const d=Lf.bufferInfo(s,a,0),h=d.nextStart||0;if(o){const e=d.len>2,i=!h||t&&t.start<=a||h-a>2&&!this.fragmentTracker.getPartialFragment(a);if(e||i)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var c;if(!(d.len>0)&&!h)return;const e=Math.max(h,d.start||0)-a,t=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,i=(null==t||null==(c=t.details)?void 0:c.live)?2*t.details.targetduration:2,r=this.fragmentTracker.getPartialFragment(a);if(e>0&&(e<=i||r))return void(s.paused||this._trySkipBufferHole(r))}const u=self.performance.now();if(null===r)return void(this.stalled=u);const p=u-r;if(!o&&p>=250&&(this._reportStall(d),!this.media))return;const f=Lf.bufferInfo(s,a,i.maxBufferHole);this._tryFixBufferStall(f,p)}_tryFixBufferStall(e,t){const{config:i,fragmentTracker:s,media:r}=this;if(null===r)return;const a=r.currentTime,o=s.getPartialFragment(a);if(o){if(this._trySkipBufferHole(o)||!this.media)return}(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-a1e3*i.highBufferWatchdogPeriod&&(hc.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:i,stallReported:s}=this;if(!s&&i){this.stallReported=!0;const s=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(e)})`);hc.warn(s.message),t.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.BUFFER_STALLED_ERROR,fatal:!1,error:s,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:i,media:s}=this;if(null===s)return 0;const r=s.currentTime,a=Lf.bufferInfo(s,r,0),o=r0&&a.len<1&&s.readyState<3,d=o-r;if(d>0&&(n||l)){if(d>t.maxBufferHole){const{fragmentTracker:t}=this;let i=!1;if(0===r){const e=t.getAppendedFrag(0,hp);e&&o1?(e=0,this.bitrateTest=!0):e=i.firstAutoLevel),i.nextLoadLevel=e,this.level=i.loadLevel,this.loadedmetadata=!1}t>0&&-1===e&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=Kf,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=qf}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case am:{const{levels:e,level:t}=this,i=null==e?void 0:e[t],s=null==i?void 0:i.details;if(s&&(!s.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(s))break;this.state=Kf;break}if(this.hls.nextLoadLevel!==this.level){this.state=Kf;break}break}case Xf:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||null!=(e=this.media)&&e.seeking){const{levels:e,level:t}=this,i=null==e?void 0:e[t];this.resetStartWhenNotLoaded(i||null),this.state=Kf}}}this.state===Kf&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:s}=this;if(null===t||!s&&(this.startFragRequested||!e.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const r=e.nextLoadLevel;if(null==i||!i[r])return;const a=i[r],o=this.getMainFwdBufferInfo();if(null===o)return;const n=this.getLevelDetails();if(n&&this._streamEnded(o,n)){const e={};return this.altAudio&&(e.type="video"),this.hls.trigger(sc.BUFFER_EOS,e),void(this.state=im)}e.loadLevel!==r&&-1===e.manualLevel&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const l=a.details;if(!l||this.state===am||l.live&&this.levelLastLoaded!==a)return this.level=r,void(this.state=am);const d=o.len,h=this.getMaxBufferLength(a.maxBitrate);if(d>=h)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const c=this.backtrackFragment?this.backtrackFragment.start:o.end;let u=this.getNextFragment(c,l);if(this.couldBacktrack&&!this.fragPrevious&&u&&"initSegment"!==u.sn&&this.fragmentTracker.getState(u)!==kf){var p;const e=(null!=(p=this.backtrackFragment)?p:u).sn-l.startSN,t=l.fragments[e-1];t&&u.cc===t.cc&&(u=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(u&&this.isLoopLoading(u,c)){if(!u.gap){const e=this.audioOnly&&!this.altAudio?yc:Ac,t=(e===Ac?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,hp)}u=this.getNextFragmentLoopLoading(u,l,o,hp,h)}u&&(!u.initSegment||u.initSegment.data||this.bitrateTest||(u=u.initSegment),this.loadFragment(u,a,c))}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);this.fragCurrent=e,s===wf||s===Tf?"initSegment"===e.sn?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,i)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,hp)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(null!=t&&t.readyState){let i;const s=this.getAppendedFrag(t.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);const r=this.getLevelDetails();if(null!=r&&r.live){const e=this.getMainFwdBufferInfo();if(!e||e.len<2*r.targetduration)return}if(!t.paused&&e){const t=e[this.hls.nextLoadLevel],s=this.fragLastKbps;i=s&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*s)+1:0}else i=0;const a=this.getBufferedFrag(t.currentTime+i);if(a){const e=this.followingBufferedFrag(a);if(e){this.abortCurrentFrag();const t=e.maxStartPTS?e.maxStartPTS:e.start,i=e.duration,s=Math.max(a.end,t+Math.min(Math.max(i-this.config.maxFragLookUpTolerance,i*(this.couldBacktrack?.5:.125)),i*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(s,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Yf:case Qf:case Xf:case em:case tm:this.state=Kf}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new cA(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;ec(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const i=this.getMainFwdBufferInfo();null!==i&&0!==i.len?this.tick():this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`)}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(sc.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let i=!1,s=!1;t.levels.forEach((e=>{const t=e.audioCodec;t&&(i=i||-1!==t.indexOf("mp4a.40.2"),s=s||-1!==t.indexOf("mp4a.40.5"))})),this.audioCodecSwitch=i&&s&&!function(){var e;const t=dA();return"function"==typeof(null==t||null==(e=t.prototype)?void 0:e.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==Kf)return;const s=i[t.level];(!s.details||s.details.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(s.details))&&(this.state=am)}onLevelLoaded(e,t){var i;const{levels:s}=this,r=t.level,a=t.details,o=a.totalduration;if(!s)return void this.warn(`Levels were reset while loading level ${r}`);this.log(`Level ${r} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""}, cc [${a.startCC}, ${a.endCC}] duration:${o}`);const n=s[r],l=this.fragCurrent;!l||this.state!==Qf&&this.state!==Xf||l.level!==t.level&&l.loader&&this.abortCurrentFrag();let d=0;if(a.live||null!=(i=n.details)&&i.live){var h;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;d=this.alignPlaylists(a,n.details,null==(h=this.levelLastLoaded)?void 0:h.details)}if(n.details=a,this.levelLastLoaded=n,this.hls.trigger(sc.LEVEL_UPDATED,{details:a,level:r}),this.state===am){if(this.waitForCdnTuneIn(a))return;this.state=Kf}this.startFragRequested?a.live&&this.synchronizeToLiveEdge(a):this.setStartPosition(a,d),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:s,payload:r}=e,{levels:a}=this;if(!a)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const o=a[i.level],n=o.details;if(!n)return this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),void this.fragmentTracker.removeFragment(i);const l=o.videoCodec,d=n.PTSKnown||!n.live,h=null==(t=i.initSegment)?void 0:t.data,c=this._getAudioCodec(o),u=this.transmuxer=this.transmuxer||new ug(this.hls,hp,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=s?s.index:-1,f=-1!==p,m=new Pf(i.level,i.sn,i.stats.chunkCount,r.byteLength,p,f),g=this.initPTS[i.cc];u.push(r,h,c,l,i,s,n.totalduration,d,m,g)}onAudioTrackSwitching(e,t){const i=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const e=this.fragCurrent;e&&(this.log("Switching to main audio track, cancel main fragment load"),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const e=this.hls;i&&(e.trigger(sc.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),e.trigger(sc.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=t.id,s=!!this.hls.audioTracks[i].url;if(s){const e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e)}this.altAudio=s,this.tick()}onBufferCreated(e,t){const i=t.tracks;let s,r,a=!1;for(const e in i){const t=i[e];if("main"===t.id){if(r=e,s=t,"video"===e){const t=i[e];t&&(this.videoBuffer=t.buffer)}}else a=!0}a&&s?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:s}=t;if(i&&i.type!==hp)return;if(this.fragContextChanged(i))return this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===tm&&(this.state=Kf));const r=s?s.stats:i.stats;this.fragLastKbps=Math.round(8*r.total/(r.buffering.end-r.loading.first)),"initSegment"!==i.sn&&(this.fragPrevious=i),this.fragBufferedComplete(i,s)}onError(e,t){var i;if(t.fatal)this.state=sm;else switch(t.details){case ac.FRAG_GAP:case ac.FRAG_PARSING_ERROR:case ac.FRAG_DECRYPT_ERROR:case ac.FRAG_LOAD_ERROR:case ac.FRAG_LOAD_TIMEOUT:case ac.KEY_LOAD_ERROR:case ac.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(hp,t);break;case ac.LEVEL_LOAD_ERROR:case ac.LEVEL_LOAD_TIMEOUT:case ac.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==am||(null==(i=t.context)?void 0:i.type)!==np||(this.state=Kf);break;case ac.BUFFER_APPEND_ERROR:case ac.BUFFER_FULL_ERROR:if(!t.parent||"main"!==t.parent)return;if(t.details===ac.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case ac.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}checkBuffer(){const{media:e,gapController:t}=this;if(e&&t&&e.readyState){if(this.loadedmetadata||!Lf.getBuffered(e).length){const e=this.state!==Kf?this.fragCurrent:null;t.poll(this.lastCurrentTime,e)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=Kf,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==yc||this.audioOnly&&!this.altAudio){const e=(t===Ac?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(e,t,hp),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t0&&(r{const{hls:s}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=Kf,this.startFragRequested=!1,this.bitrateTest=!1;const r=e.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),s.trigger(sc.FRAG_LOADED,i),e.bitrateTest=!1}))}_handleTransmuxComplete(e){var t;const i="main",{hls:s}=this,{remuxResult:r,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o)return void this.resetWhenMissingContext(a);const{frag:n,part:l,level:d}=o,{video:h,text:c,id3:u,initSegment:p}=r,{details:f}=d,m=this.altAudio?void 0:r.audio;if(this.fragContextChanged(n))this.fragmentTracker.removeFragment(n);else{if(this.state=em,p){if(null!=p&&p.tracks){const e=n.initSegment||n;this._bufferInitSegment(d,p.tracks,e,a),s.trigger(sc.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:p.tracks})}const e=p.initPTS,t=p.timescale;ec(e)&&(this.initPTS[n.cc]={baseTime:e,timescale:t},s.trigger(sc.INIT_PTS_FOUND,{frag:n,id:i,initPTS:e,timescale:t}))}if(h&&f&&"initSegment"!==n.sn){const e=f.fragments[n.sn-1-f.startSN],t=n.sn===f.startSN,i=!e||n.cc>e.cc;if(!1!==r.independent){const{startPTS:e,endPTS:s,startDTS:r,endDTS:o}=h;if(l)l.elementaryStreams[h.type]={startPTS:e,endPTS:s,startDTS:r,endDTS:o};else if(h.firstKeyFrame&&h.independent&&1===a.id&&!i&&(this.couldBacktrack=!0),h.dropped&&h.independent){const r=this.getMainFwdBufferInfo(),a=(r?r.end:this.getLoadPosition())+this.config.maxBufferHole,l=h.firstKeyFramePTS?h.firstKeyFramePTS:e;if(!t&&a2&&(n.gap=!0);n.setElementaryStreamInfo(h.type,e,s,r,o),this.backtrackFragment&&(this.backtrackFragment=n),this.bufferFragmentData(h,n,l,a,t||i)}else{if(!t&&!i)return void this.backtrack(n);n.gap=!0}}if(m){const{startPTS:e,endPTS:t,startDTS:i,endDTS:s}=m;l&&(l.elementaryStreams[yc]={startPTS:e,endPTS:t,startDTS:i,endDTS:s}),n.setElementaryStreamInfo(yc,e,t,i,s),this.bufferFragmentData(m,n,l,a)}if(f&&null!=u&&null!=(t=u.samples)&&t.length){const e={id:i,frag:n,details:f,samples:u.samples};s.trigger(sc.FRAG_PARSING_METADATA,e)}if(f&&c){const e={id:i,frag:n,details:f,samples:c.samples};s.trigger(sc.FRAG_PARSING_USERDATA,e)}}}_bufferInitSegment(e,t,i,s){if(this.state!==em)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:r,video:a,audiovideo:o}=t;if(r){let t=e.audioCodec;const i=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(t&&(t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==r.metadata.channelCount&&-1===i.indexOf("firefox")&&(t="mp4a.40.5")),t&&-1!==t.indexOf("mp4a.40.5")&&-1!==i.indexOf("android")&&"audio/mpeg"!==r.container&&(t="mp4a.40.2",this.log(`Android: force audio codec to ${t}`)),e.audioCodec&&e.audioCodec!==t&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${t}"`),r.levelCodec=t,r.id="main",this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${t||""}/${e.audioCodec||""}/${r.codec}]`)}a&&(a.levelCodec=e.videoCodec,a.id="main",this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${a.codec}]`)),o&&this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),this.hls.trigger(sc.BUFFER_CODECS,t),Object.keys(t).forEach((e=>{const r=t[e].initSegment;null!=r&&r.byteLength&&this.hls.trigger(sc.BUFFER_APPENDING,{type:e,data:r,frag:i,part:null,chunkMeta:s,parent:i.type})})),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,hp)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=Kf}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&!1===e.seeking){const i=e.currentTime;if(Lf.isBuffered(e,i)?t=this.getAppendedFrag(i):Lf.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const e=this.fragPlaying,i=t.level;e&&t.sn===e.sn&&e.level===i||(this.fragPlaying=t,this.hls.trigger(sc.FRAG_CHANGED,{frag:t}),e&&e.level===i||this.hls.trigger(sc.LEVEL_SWITCHED,{level:i}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,i=this.currentFrag;if(i&&ec(t)&&ec(i.programDateTime)){const e=i.programDateTime+1e3*(t-i.start);return new Date(e)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class pA{static get version(){return"1.5.7"}static isMSESupported(){return hA()}static isSupported(){return function(){if(!hA())return!1;const e=Uu();return"function"==typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some((t=>e.isTypeSupported(ju(t,"video"))))||["mp4a.40.2","fLaC"].some((t=>e.isTypeSupported(ju(t,"audio")))))}()}static getMediaSource(){return Uu()}static get Events(){return sc}static get ErrorTypes(){return rc}static get ErrorDetails(){return ac}static get DefaultConfig(){return pA.defaultConfig?pA.defaultConfig:iA}static set DefaultConfig(e){pA.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new cg,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,function(e,t){if("object"==typeof console&&!0===e||"object"==typeof e){dc(e,"debug","log","info","warn","error");try{lc.log(`Debug logs enabled for "${t}" in hls.js version 1.5.7`)}catch(e){lc=nc}}else lc=nc}(e.debug||!1,"Hls instance");const t=this.config=function(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=sA(e),s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((e=>{const r=`${"level"===e?"playlist":e}LoadPolicy`,a=void 0===t[r],o=[];s.forEach((s=>{const n=`${e}Loading${s}`,l=t[n];if(void 0!==l&&a){o.push(n);const e=i[r].default;switch(t[r]={default:e},s){case"TimeOut":e.maxLoadTimeMs=l,e.maxTimeToFirstByteMs=l;break;case"MaxRetry":e.errorRetry.maxNumRetry=l,e.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":e.errorRetry.retryDelayMs=l,e.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":e.errorRetry.maxRetryDelayMs=l,e.timeoutRetry.maxRetryDelayMs=l}}})),o.length&&hc.warn(`hls.js config: "${o.join('", "')}" setting(s) are deprecated, use "${r}": ${JSON.stringify(t[r])}`)})),Yh(Yh({},i),t)}(pA.DefaultConfig,e);this.userConfig=e,t.progressive&&rA(t);const{abrController:i,bufferController:s,capLevelController:r,errorController:a,fpsController:o}=t,n=new a(this),l=this.abrController=new i(this),d=this.bufferController=new s(this),h=this.capLevelController=new r(this),c=new o(this),u=new mp(this),p=new xp(this),f=t.contentSteeringController,m=f?new f(this):null,g=this.levelController=new oA(this,m),y=new Cf(this),A=new lA(this.config),b=this.streamController=new uA(this,y,A);h.setStreamController(b),c.setStreamController(b);const v=[u,g,b];m&&v.splice(1,0,m),this.networkControllers=v;const _=[l,d,h,c,p,y];this.audioTrackController=this.createController(t.audioTrackController,v);const S=t.audioStreamController;S&&v.push(new S(this,y,A)),this.subtitleTrackController=this.createController(t.subtitleTrackController,v);const w=t.subtitleStreamController;w&&v.push(new w(this,y,A)),this.createController(t.timelineController,_),A.emeController=this.emeController=this.createController(t.emeController,_),this.cmcdController=this.createController(t.cmcdController,_),this.latencyController=this.createController(Rp,_),this.coreComponents=_,v.push(n);const E=n.onErrorOut;"function"==typeof E&&this.on(sc.ERROR,E,n)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,s){this._emitter.off(e,t,i,s)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(hc.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;const i=e===sc.ERROR;this.trigger(sc.ERROR,{type:rc.OTHER_ERROR,details:ac.INTERNAL_EXCEPTION,fatal:i,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){hc.log("destroy"),this.trigger(sc.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((e=>e.destroy())),this.networkControllers.length=0,this.coreComponents.forEach((e=>e.destroy())),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){hc.log("attachMedia"),this._media=e,this.trigger(sc.MEDIA_ATTACHING,{media:e})}detachMedia(){hc.log("detachMedia"),this.trigger(sc.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,i=this.url,s=this.url=qh.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,hc.log(`loadSource:${s}`),t&&i&&(i!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(sc.MANIFEST_LOADING,{url:e})}startLoad(e=-1){hc.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach((t=>{t.startLoad(e)}))}stopLoad(){hc.log("stopLoad"),this.started=!1,this.networkControllers.forEach((e=>{e.stopLoad()}))}resumeBuffering(){this.started&&this.networkControllers.forEach((e=>{"fragmentLoader"in e&&e.startLoad(-1)}))}pauseBuffering(){this.networkControllers.forEach((e=>{"fragmentLoader"in e&&e.stopLoad()}))}swapAudioCodec(){hc.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){hc.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){hc.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){hc.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){hc.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){hc.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){hc.log(`set startLevel:${e}`),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(hc.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){(function(e){return Dp.indexOf(e)>-1})(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let s=0;s=t)return s;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let s;if(s=-1===t&&null!=e&&e.length?e.length-1:t,i)for(let t=s;t--;){const s=e[t].attrs["HDCP-LEVEL"];if(s&&s<=i)return t}return s}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return null==(t=this.audioTrackController)?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return null==(t=this.subtitleTrackController)||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return!!e&&e.subtitleDisplay}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}pA.defaultConfig=void 0;class fA extends So{constructor(e){super(),this.player=e,this.TAG_NAME="HlsDecoder",e._opt,this.canVideoPlay=!1,this.$videoElement=null,this.canvasRenderInterval=null,this.bandwidthEstimateInterval=null,this.fpsInterval=null,this.hlsFps=0,this.hlsPrevFrams=0,this.isInitInfo=!1,this.eventsDestroy=[],this.supportVideoFrameCallbackHandle=null,this.player.isHlsCanVideoPlay()?(this.$videoElement=this.player.video.$videoElement,this.canVideoPlay=!0):pA.isSupported()?(this.$videoElement=this.player.video.$videoElement,this.hls=new pA({}),this._initHls(),this._bindEvents()):this.player.debug.error(this.TAG_NAME,"init hls error ,not support "),this.player.debug.log(this.TAG_NAME,"init")}destroy(){return new Promise(((e,t)=>{this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.hls&&(this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.isInitInfo=!1,this._stopCanvasRender(),this._stopBandwidthEstimateInterval(),this._stopFpsInterval(),this.$videoElement=null,this.hlsFps=0,this.player.debug.log(this.TAG_NAME,"destroy"),setTimeout((()=>{e()}),0)}))}checkHlsBufferedDelay(){const e=this.$videoElement;let t=0;const i=e.buffered,s=i.length?i.end(i.length-1):0;return t=s-e.currentTime,t<0&&(this.player.debug.warn(this.TAG_NAME,`checkHlsBufferedDelay ${t} < 0, and buffered is ${s} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${s}`),e.currentTime=s,t=0),t}getFps(){return this.hlsFps}_startCanvasRender(){bo()?this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)):(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:parseInt(1e3*this.$videoElement.currentTime,10)||0})}),40))}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debug.log(this.TAG_NAME,"videoFrameCallback() player is destroyed");const i=parseInt(1e3*Math.max(t.mediaTime,this.$videoElement.currentTime),10)||0;this.player.video.render({$video:this.$videoElement,ts:i}),this.player.handleRender(),this.player.updateStats({dts:i}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}_startBandwidthEstimateInterval(){this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{let e=0;this.hls.bandwidthEstimate&&(e=this.hls.bandwidthEstimate),this.player.emit(nt.kBps,(e/1024/8/10).toFixed(2))}),1e3)}_stopBandwidthEstimateInterval(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}_startFpsInterval(){this._stopCanvasRender(),this.fpsInterval=setInterval((()=>{if(this.$videoElement)if(Ya(this.$videoElement.getVideoPlaybackQuality)){const e=this.$videoElement.getVideoPlaybackQuality();this.hlsFps=e.totalVideoFrames-this.hlsPrevFrams,this.hlsPrevFrams=e.totalVideoFrames}else{const e=this.$videoElement.webkitDecodedFrameCount||0;this.hlsFps=e-this.hlsPrevFrams,this.hlsPrevFrams=e}}),1e3)}_stopFpsInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_initHls(){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.$videoElement.muted=!0,Aa()&&(this.$videoElement.style.position="absolute"),this.initVideoEvents()),this.hls.attachMedia(this.$videoElement)}_bindEvents(){const e=this.player,{proxy:t}=this.player.events;this.hls;const i=this.$videoElement,s=bo(),r=t(i,is,(t=>{if(this.hls){const i=parseInt(t.timeStamp,10);this.player._opt.useCanvasRender&&po(s)&&e.updateStats({ts:i,dts:i})}}));this.eventsDestroy.push(r),this._startBandwidthEstimateInterval(),this._startFpsInterval(),this.hls.on(pA.Events.ERROR,((e,t)=>{if(t.fatal)switch(t.type){case pA.ErrorTypes.NETWORK_ERROR:this.player.debug.warn(this.TAG_NAME,"fatal network error encountered, try to recover"),this.hls.startLoad();break;case pA.ErrorTypes.MEDIA_ERROR:this.player.debug.warn(this.TAG_NAME,"fatal media error encountered, try to recover"),this.hls.recoverMediaError()}})),this.hls.on(pA.Events.MEDIA_ATTACHING,(()=>{})),this.hls.on(pA.Events.MEDIA_ATTACHED,(()=>{})),this.hls.on(pA.Events.MEDIA_DETACHING,(()=>{})),this.hls.on(pA.Events.MEDIA_DETACHED,(()=>{})),this.hls.on(pA.Events.BUFFER_RESET,(()=>{})),this.hls.on(pA.Events.BUFFER_CODECS,(()=>{})),this.hls.on(pA.Events.BUFFER_CREATED,(()=>{})),this.hls.on(pA.Events.BUFFER_APPENDING,((e,t)=>{this.player.debug.log(this.TAG_NAME,"BUFFER_APPENDING",t.type)})),this.hls.on(pA.Events.BUFFER_APPENDED,(()=>{})),this.hls.on(pA.Events.BUFFER_EOS,(()=>{})),this.hls.on(pA.Events.BUFFER_FLUSHING,(()=>{})),this.hls.on(pA.Events.BUFFER_FLUSHED,(()=>{})),this.hls.on(pA.Events.MANIFEST_LOADING,(()=>{this.player.debug.log(this.TAG_NAME,"MANIFEST_LOADING 开始加载playlist m3u8资源")})),this.hls.on(pA.Events.MANIFEST_LOADED,((e,t)=>{this.player.debug.log(this.TAG_NAME,"MANIFEST_LOADED playlist m3u8文件加载完成",t.url)})),this.hls.on(pA.Events.MANIFEST_PARSED,(()=>{this.player.debug.log(this.TAG_NAME,"MANIFEST_PARSED playlist m3u8解析完成"),e._times.demuxStart||(e._times.demuxStart=aa())})),this.hls.on(pA.Events.LEVEL_LOADING,(()=>{})),this.hls.on(pA.Events.LEVEL_LOADED,((e,t)=>{})),this.hls.on(pA.Events.FRAG_LOADING,(()=>{})),this.hls.on(pA.Events.FRAG_LOADED,((t,i)=>{e._times.decodeStart||(e._times.decodeStart=aa())})),this.hls.on(pA.Events.BUFFER_APPENDING,(()=>{e._times.videoStart||(e._times.videoStart=aa(),e.handlePlayToRenderTimes())})),this.hls.on(pA.Events.FRAG_DECRYPTED,(()=>{})),this.hls.on(pA.Events.KEY_LOADING,(()=>{})),this.hls.on(pA.Events.KEY_LOADING,(()=>{})),this.hls.on(pA.Events.FPS_DROP,(e=>{})),this.hls.on(pA.Events.FPS_DROP_LEVEL_CAPPING,(e=>{})),this.hls.on(pA.Events.FRAG_PARSING_INIT_SEGMENT,((e,t)=>{this.player.debug.log(this.TAG_NAME,"FRAG_PARSING_INIT_SEGMENT",t);const i=!!(t&&t.tracks&&t.tracks.audio),s=!!(t&&t.tracks&&t.tracks.video);if(i&&t.tracks.audio){let e=t.tracks.audio;const i=e.metadata&&e.metadata.channelCount?e.metadata.channelCount:0,s=e.codec;this.player.audio&&this.player.audio.updateAudioInfo({encType:s,channels:i,sampleRate:44100})}if(s&&t.tracks.video){let e=t.tracks.video;const i={encTypeCode:-1!==e.codec.indexOf("avc")?vt:_t};e.metadata&&(i.width=e.metadata.width,i.height=e.metadata.height),this.player.video&&this.player.video.updateVideoInfo(i)}}))}initVideoPlay(e){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.initVideoEvents()),this.$videoElement.autoplay=!0,this.$videoElement.muted=!0,this.$videoElement.src=e}_initRenderSize(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}initVideoEvents(){const{proxy:e}=this.player.events,t=e(this.$videoElement,es,(()=>{this.player.debug.log(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.debug.log(this.TAG_NAME,"video play"),this._startCanvasRender(),this._initRenderSize()})).catch((e=>{this.player.debug.warn(this.TAG_NAME,"video play error ",e)}))})),i=e(this.$videoElement,ts,(()=>{this.player.debug.log(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,is,(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t}),this.$videoElement.paused&&(this.player.debug.warn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debug.log(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debug.warn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,ss,(()=>{this.player.debug.log(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)}));this.eventsDestroy.push(t,i,s,r)}loadSource(e){return new Promise(((t,i)=>{this.canVideoPlay?(this.initVideoPlay(e),t()):this.hls.on(pA.Events.MEDIA_ATTACHED,(()=>{this.hls.loadSource(e),t()}))}))}}const mA=2097152,gA="fetch",yA="xhr",AA="arraybuffer",bA="text",vA="json",_A="real_time_speed",SA=Object.prototype.toString;function wA(e){if("[object Object]"!==SA.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function EA(e){if(!e||null===e[0]||void 0===e[0]||0===e[0]&&(null===e[1]||void 0===e[1]))return;let t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}function TA(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function kA(e,t){if(!e)return;if(!t)return e;let i;const s=Object.keys(t).map((e=>{if(i=t[e],null!=i)return Array.isArray(i)?e+="[]":i=[i],i.map((t=>{var i;return i=t,"[object Date]"===SA.call(i)?t=t.toISOString():function(e){return null!==e&&"object"==typeof e}(t)&&(t=JSON.stringify(t)),`${TA(e)}=${TA(t)}`})).join("&")})).filter(Boolean).join("&");if(s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}function CA(e,t,i,s,r,a,o,n,l,d,h){r=null!=r?parseFloat(r):null,s=parseInt(s||"0",10),Number.isNaN(s)&&(s=0);return{data:e,done:t,option:{range:l,vid:d,index:n,contentLength:s,age:r,startTime:a,firstByteTime:o,endTime:Date.now(),priOptions:h},response:i}}function xA(e,t){return Math.round(8*e*1e3/t/1024)}class RA extends Error{constructor(e,t,i,s){super(s),zd(this,"retryCount",0),zd(this,"isTimeout",!1),zd(this,"loaderType",gA),zd(this,"startTime",0),zd(this,"endTime",0),zd(this,"options",{}),this.url=e,this.request=t,this.response=i}}class DA extends So{constructor(e){super(),zd(this,"_abortController",null),zd(this,"_timeoutTimer",null),zd(this,"_reader",null),zd(this,"_response",null),zd(this,"_aborted",!1),zd(this,"_index",-1),zd(this,"_range",null),zd(this,"_receivedLength",0),zd(this,"_running",!1),zd(this,"_logger",null),zd(this,"_vid",""),zd(this,"_onProcessMinLen",0),zd(this,"_onCancel",null),zd(this,"_priOptions",null),zd(this,"TAG_NAME","FetchLoader"),this.player=e}load(e){var t;let{url:i,vid:s,timeout:r,responseType:a,onProgress:o,index:n,onTimeout:l,onCancel:d,range:h,transformResponse:c,request:u,params:p,logger:f,method:m,headers:g,body:y,mode:A,credentials:b,cache:v,redirect:_,referrer:S,referrerPolicy:w,onProcessMinLen:E,priOptions:T}=e;this._aborted=!1,this._onProcessMinLen=E,this._onCancel=d,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=n,this._range=h||[0,0],this._vid=s||i,this._priOptions=T||{};const k={method:m,headers:g,body:y,mode:A,credentials:b,cache:v,redirect:_,referrer:S,referrerPolicy:w,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal};let C=!1;clearTimeout(this._timeoutTimer),i=kA(i,p);const x=EA(h);x&&(g=u?u.headers:k.headers=k.headers||(Headers?new Headers:{}),Headers&&g instanceof Headers?g.append("Range",x):g.Range=x),r&&(this._timeoutTimer=setTimeout((()=>{if(C=!0,this.cancel(),l){const e=new RA(i,k,null,"timeout");e.isTimeout=!0,l(e,{index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})}}),r));const R=Date.now();return(Ba(n)||Ba(h))&&this.player.debug.log(this.TAG_NAME,"[fetch load start], index,",n,",range,",h),new Promise(((e,t)=>{fetch(u||i,u?void 0:k).then((async s=>{if(clearTimeout(this._timeoutTimer),this._response=s,this._aborted||!this._running)return;if(c&&(s=c(s,i)||s),!s.ok)throw new RA(i,k,s,"bad network response");const r=Date.now();let l;if(a===bA)l=await s.text(),this._running=!1;else if(a===vA)l=await s.json(),this._running=!1;else{if(o)return this.resolve=e,this.reject=t,void this._loadChunk(s,o,R,r);{l=await s.arrayBuffer(),l=new Uint8Array(l),this._running=!1;const e=Date.now()-R,t=xA(l.byteLength,e);this.emit(_A,{speed:t,len:l.byteLength,time:e,vid:this._vid,index:this._index,range:this._range,priOptions:this._priOptions})}}(Ba(n)||Ba(h))&&this.player.debug.log(this.TAG_NAME,"[fetch load end], index,",n,",range,",h),e(CA(l,!0,s,s.headers.get("Content-Length"),s.headers.get("age"),R,r,n,h,this._vid,this._priOptions))})).catch((e=>{var s;clearTimeout(this._timeoutTimer),this._running=!1,this._aborted&&!C||((e=e instanceof RA?e:new RA(i,k,null,null===(s=e)||void 0===s?void 0:s.message)).startTime=R,e.endTime=Date.now(),e.isTimeout=C,e.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},t(e))}))}))}async cancel(){if(!this._aborted){if(this._aborted=!0,this._running=!1,this._response){try{this._reader&&await this._reader.cancel()}catch(e){}this._response=this._reader=null}if(this._abortController){try{this._abortController.abort()}catch(e){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})}}_loadChunk(e,t,i,s){if(!e.body||!e.body.getReader){this._running=!1;const t=new RA(e.url,"",e,"onProgress of bad response.body.getReader");return t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(t)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(mA),this._writeIdx=0);const r=this._reader=e.body.getReader();let a,o,n;const l=async()=>{var d;o=Date.now();try{a=await r.read(),n=Date.now()}catch(e){return n=Date.now(),void(this._aborted||(this._running=!1,e.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this.reject(e)))}const h=(null===(d=this._range)||void 0===d?void 0:d.length)>0?this._range[0]:0,c=h+this._receivedLength;if(this._aborted)return this._running=!1,void t(void 0,!1,{range:[c,c],vid:this._vid,index:this._index,startTime:o,endTime:n,st:i,firstByteTime:s,priOptions:this._priOptions},e);const u=a.value?a.value.byteLength:0;let p;if(this._receivedLength+=u,this.player.debug.log(this.TAG_NAME,"【fetchLoader,onProgress call】,task,",this._range,", start,",c,", end,",h+this._receivedLength,", done,",a.done),this._onProcessMinLen>0){if(this._writeIdx+u>=this._onProcessMinLen||a.done)p=new Uint8Array(this._writeIdx+u),p.set(this._cache.slice(0,this._writeIdx),0),u>0&&p.set(a.value,this._writeIdx),this._writeIdx=0,this.player.debug.log(this.TAG_NAME,"【fetchLoader,onProgress enough】,done,",a.done,",len,",p.byteLength,", writeIdx,",this._writeIdx);else if(u>0&&this._writeIdx+u0){const e=new Uint8Array(this._writeIdx+u+2048);this.player.debug.log(this.TAG_NAME,"【fetchLoader,onProgress extra start】,size,",this._writeIdx+u+2048,", datalen,",u,", writeIdx,",this._writeIdx),e.set(this._cache.slice(0,this._writeIdx),0),u>0&&e.set(a.value,this._writeIdx),this._writeIdx+=u,delete this._cache,this._cache=e,this.player.debug.log(this.TAG_NAME,"【fetchLoader,onProgress extra end】,len,",u,", writeIdx,",this._writeIdx)}}else p=a.value;if((p&&p.byteLength>0||a.done)&&t(p,a.done,{range:[this._range[0]+this._receivedLength-(p?p.byteLength:0),this._range[0]+this._receivedLength],vid:this._vid,index:this._index,startTime:o,endTime:n,st:i,firstByteTime:s,priOptions:this._priOptions},e),a.done){const t=Date.now()-i,r=xA(this._receivedLength,t);this.emit(_A,{speed:r,len:this._receivedLength,time:t,vid:this._vid,index:this._index,range:this._range,priOptions:this._priOptions}),this._running=!1,this.player.debug.log(this.TAG_NAME,"[fetchLoader onProgress end],task,",this._range,",done,",a.done),this.resolve(CA(a,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),i,s,this._index,this._range,this._vid,this._priOptions))}else l()};l()}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}static isSupported(){return!("undefined"==typeof fetch)}}class LA{constructor(e,t,i){zd(this,"TAG_NAME","Task"),this.promise=function(){let e,t;const i=new Promise(((i,s)=>{e=i,t=s}));return i.used=!1,i.resolve=function(){return i.used=!0,e(...arguments)},i.reject=function(){return i.used=!0,t(...arguments)},i}(),this.alive=!!t.onProgress,this._loaderType=e,this.player=i,this._loader=e===gA&&window.fetch?new DA(i):new PA(i),this._config=t,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=t.retryCheckFunc}exec(){const{retry:e,retryDelay:t,onRetryError:i,transformError:s,...r}=this._config,a=async()=>{try{const e=await this._loader.load(r);this.promise.resolve(e)}catch(o){if(this._loader.running=!1,this.player.debug.log(this.TAG_NAME,"[task request catch err]",o),this._canceled)return;o.loaderType=this._loaderType,o.retryCount=this._retryCount;let n=o;s&&(n=s(n)||n),i&&this._retryCount>0&&i(n,this._retryCount,{index:r.index,vid:r.vid,range:r.range,priOptions:r.priOptions}),this._retryCount++;let l=!0;if(this._retryCheckFunc&&(l=this._retryCheckFunc(o)),l&&this._retryCount<=e)return clearTimeout(this._retryTimer),this.player.debug.log(this.TAG_NAME,"[task request setTimeout],retry",this._retryCount,",retry range,",r.range),void(this._retryTimer=setTimeout(a,t));this.promise.reject(n)}};return a(),this.promise}async cancel(){return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,this._loader.cancel()}get running(){return this._loader&&this._loader.running}get loader(){return this._loader}}class PA extends So{constructor(e){super(),zd(this,"_xhr",null),zd(this,"_aborted",!1),zd(this,"_timeoutTimer",null),zd(this,"_range",null),zd(this,"_receivedLength",0),zd(this,"_url",null),zd(this,"_onProgress",null),zd(this,"_index",-1),zd(this,"_headers",null),zd(this,"_currentChunkSizeKB",384),zd(this,"_timeout",null),zd(this,"_xhr",null),zd(this,"_withCredentials",null),zd(this,"_startTime",-1),zd(this,"_loadCompleteResolve",null),zd(this,"_loadCompleteReject",null),zd(this,"_runing",!1),zd(this,"_logger",!1),zd(this,"_vid",""),zd(this,"_responseType",void 0),zd(this,"_credentials",void 0),zd(this,"_method",void 0),zd(this,"_transformResponse",void 0),zd(this,"_firstRtt",void 0),zd(this,"_onCancel",null),zd(this,"_priOptions",null),zd(this,"TAG_NAME","XhrLoader"),this.player=e}load(e){clearTimeout(this._timeoutTimer),this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this.player.debug.log(this.TAG_NAME,"【xhrLoader task】, range",this._range),this._url=kA(e.url,e.params);const t=Date.now();return new Promise(((e,t)=>{this._loadCompleteResolve=e,this._loadCompleteReject=t,this._startLoad()})).catch((e=>{if(clearTimeout(this._timeoutTimer),this._runing=!1,!this._aborted)throw(e=e instanceof RA?e:new RA(this._url,this._request)).startTime=t,e.endTime=Date.now(),e.options={index:this._index,vid:this._vid,priOptions:this._priOptions},e}))}_startLoad(){let e=null;if(this._responseType===AA&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;const t=1024*this._currentChunkSizeKB,i=this._range[0]+this._receivedLength;let s=this._range[1];t],tast :",this._range,", SubRange, ",e)}else e=this._range,this.player.debug.log(this.TAG_NAME,"[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}_internalOpen(e){try{this._startTime=Date.now();const t=this._xhr=new XMLHttpRequest;t.open(this._method||"GET",this._url,!0),t.responseType=this._responseType,this._timeout&&(t.timeout=this._timeout),t.withCredentials=this._withCredentials,t.onload=this._onLoad.bind(this),t.onreadystatechange=this._onReadyStatechange.bind(this),t.onerror=e=>{var t,i,s;this._running=!1;const r=new RA(this._url,this._request,null==e||null===(t=e.currentTarget)||void 0===t?void 0:t.response,"xhr.onerror.status:"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.status)+",statusText,"+(null==e||null===(s=e.currentTarget)||void 0===s?void 0:s.statusText));r.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(r)},t.ontimeout=e=>{this.cancel();const t=new RA(this._url,this._request,{status:408},"timeout");this._onTimeout&&(t.isTimeout=!0,this._onTimeout(t,{index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})),t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)};const i=this._headers||{},s=EA(e);s&&(i.Range=s),i&&Object.keys(i).forEach((e=>{t.setRequestHeader(e,i[e])})),this.player.debug.log(this.TAG_NAME,"[xhr.send->] tast,",this._range,",load sub range, ",e),t.send(this._body)}catch(t){t.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}}_onReadyStatechange(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}_onLoad(e){var t;const i=e.target.status;if(i<200||i>299){const t=new RA(this._url,null,{...e.target.response,status:i},"bad response,status:"+i);return t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}let s,r=null,a=!1;const o=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===AA){var n;const t=new Uint8Array(e.target.response);if(s=o+this._receivedLength,t&&t.byteLength>0){this._receivedLength+=t.byteLength;const e=Date.now()-this._startTime,i=xA(this._receivedLength,e);this.emit(_A,{speed:i,len:this._receivedLength,time:e,vid:this._vid,index:this._index,range:[s,o+this._receivedLength],priOptions:this._priOptions})}r=t,a=!((null===(n=this._range)||void 0===n?void 0:n.length)>1&&this._range[1]&&this._receivedLength], tast :",this._range,", start",s,"end ",o+this._receivedLength,",dataLen,",t?t.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",a)}else a=!0,r=e.target.response;let l={ok:i>=200&&i<300,status:i,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(l=this._transformResponse(l,this._url)||l),this._onProgress&&this._onProgress(r,a,{index:this._index,vid:this._vid,range:[s,o+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},l),a?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(CA(this._onProgress?null:r,a,l,l.headers["content-length"],l.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}cancel(){if(!this._aborted)return this._aborted=!0,this._runing=!1,super.removeAllListeners(),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}static isSupported(){return"undefined"!=typeof XMLHttpRequest}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}_getHeaders(e){const t=e.getAllResponseHeaders().trim().split("\r\n"),i={};for(const e of t){const t=e.split(": ");i[t[0].toLowerCase()]=t.slice(1).join(": ")}return i}}class BA extends So{constructor(e,t){super(),zd(this,"type",gA),zd(this,"_queue",[]),zd(this,"_alive",[]),zd(this,"_currentTask",null),zd(this,"_config",void 0),this.player=t,this._config=function(e){return{loaderType:gA,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:bA,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0,...e}}(e),this._config.loaderType!==yA&&DA.isSupported()||(this.type=yA)}destroy(){this._queue=[],this._alive=[],this._currentTask=null}isFetch(){return this.type===gA}static isFetchSupport(){return DA.isSupported()}load(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?t=e:t.url=e||t.url||this._config.url,t=Object.assign({},this._config,t),t.params&&(t.params=Object.assign({},t.params)),t.headers&&wA(t.headers)&&(t.headers=Object.assign({},t.headers)),t.body&&wA(t.body)&&(t.body=Object.assign({},t.body)),t.transformRequest&&(t=t.transformRequest(t)||t);const i=new LA(this.type,t,this.player);return i.loader.on(_A,(e=>{this.emit(_A,e)})),this._queue.push(i),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),i.promise}async cancel(){const e=this._queue.map((e=>e.cancel())).concat(this._alive.map((e=>e.cancel())));this._currentTask&&e.push(this._currentTask.cancel()),this._queue=[],this._alive=[],await Promise.all(e),await function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((t=>setTimeout(t,e)))}()}_processTask(){if(this._currentTask=this._queue.shift(),!this._currentTask)return;this._currentTask.alive&&this._alive.push(this._currentTask);const e=this._currentTask.exec().catch((e=>{}));e&&"function"==typeof e.finally&&e.finally((()=>{var e,t;null!==(e=this._currentTask)&&void 0!==e&&e.alive&&(null===(t=this._alive)||void 0===t?void 0:t.length)>0&&(this._alive=this._alive.filter((e=>e&&e!==this._currentTask))),this._processTask()}))}}const IA="network",MA="network_timeout",UA="other",FA="manifest",OA="hls",NA="demux";class jA extends Error{constructor(e,t,i,s,r){super(r||(null==i?void 0:i.message)),this.errorType=e===MA?IA:e,this.originError=i,this.ext=s,this.errorMessage=this.message}static create(e,t,i,s,r){return e instanceof jA?e:(e instanceof Error&&(i=e,e=""),e||(e=UA),new jA(e,t,i,s,r))}static network(e){var t;return new jA(null!=e&&e.isTimeout?MA:IA,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}const zA=/^#(EXT[^:]*)(?::(.*))?$/,GA=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g,HA=/^(?:[a-zA-Z0-9+\-.]+:)?\/\//,VA=/^((?:[a-zA-Z0-9+\-.]+:)?\/\/[^/?#]*)?([^?#]*\/)?/;function $A(e){const t=e.match(zA);if(t&&t[1])return[t[1].replace("EXT-X-",""),t[2]]}function WA(e){const t={};let i=GA.exec(e);for(;i;)t[i[1]]=i[2]||i[3],i=GA.exec(e);return t}function JA(e,t){if(!t||!e||HA.test(e))return e;const i=VA.exec(t);return i?"/"===e[0]?i[1]+e:i[1]+i[2]+e:e}const qA={audio:[/^mp4a/,/^vorbis$/,/^opus$/,/^flac$/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]};function KA(e,t){const i=qA[e];if(i&&t&&t.length)for(let e=0;e>8*(15-t)&255}}}class ob{static parse(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!e.includes("#EXTM3U"))throw new Error("Invalid m3u8 file");const i=function(e){return e.split(/[\r\n]/).map((e=>e.trim())).filter(Boolean)}(e);return ob.isMediaPlaylist(e)?function(e,t){const i=new sb;i.url=t;let s,r=new rb,a=null,o=null,n=0,l=0,d=0,h=0,c=!1;for(;(s=e[h++])&&!c;){if("#"!==s[0]){r.sn=l,r.cc=d,r.url=JA(s,t),o&&(r.key=o.clone(l)),a&&(r.initSegment=a),i.segments.push(r),r=new rb,l++;continue}const e=$A(s);if(!e)continue;const[h,u]=e;switch(h){case"VERSION":i.version=parseInt(u);break;case"PLAYLIST-TYPE":i.type=null==u?void 0:u.toUpperCase();break;case"TARGETDURATION":i.targetDuration=parseFloat(u);break;case"ENDLIST":{const e=i.segments[i.segments.length-1];e&&(e.isLast=!0),i.live=!1,c=!0}break;case"MEDIA-SEQUENCE":l=i.startSN=parseInt(u);break;case"DISCONTINUITY-SEQUENCE":d=i.startCC=parseInt(u);break;case"DISCONTINUITY":d++;break;case"BYTERANGE":r.setByteRange(u,i.segments[i.segments.length-1]);break;case"EXTINF":{const[e,t]=u.split(",");r.start=n,r.duration=parseFloat(e),n+=r.duration,r.title=t}break;case"KEY":{const e=WA(u);if("NONE"===e.METHOD){o=null;break}if("AES-128"!==e.METHOD)throw new Error(`encrypt ${e.METHOD}/${e.KEYFORMAT} is not supported`);if(o=new ab,o.method=e.METHOD,o.url=/^blob:/.test(e.URI)?e.URI:JA(e.URI,t),o.keyFormat=e.KEYFORMAT||"identity",o.keyFormatVersions=e.KEYFORMATVERSIONS,e.IV){let t=e.IV.slice(2);t=(1&t.length?"0":"")+t,o.iv=new Uint8Array(t.length/2);for(let e=0,i=t.length/2;e{e.id=t})),a.length&&(a.forEach(((e,t)=>{e.id=t})),i.streams.forEach((e=>{e.audioGroup&&(e.audioStreams=a.filter((t=>t.group===e.audioGroup)))}))),o.length&&(o.forEach(((e,t)=>{e.id=t})),i.streams.forEach((e=>{e.subtitleGroup&&(e.subtitleStreams=o.filter((t=>t.group===e.subtitleGroup)))}))),i}(i,t)}static isMediaPlaylist(e){return e.includes("#EXTINF:")||e.includes("#EXT-X-TARGETDURATION:")}}class nb{constructor(e){zd(this,"_onLoaderRetry",((e,t)=>{this.hls.emit(qs,{error:jA.network(e),retryTime:t})})),this.hls=e,this.player=e.player,this.TAG_NAME="HlsManifestLoader",this._timer=null;const{retryCount:t,retryDelay:i,loadTimeout:s,fetchOptions:r}=this.hls.config;this._loader=new BA({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._audioLoader=new BA({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._subtitleLoader=new BA({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player)}async destroy(){await this.stopPoll(),this._audioLoader&&(this._audioLoader.destroy(),this._audioLoader=null),this._subtitleLoader&&(this._subtitleLoader.destroy(),this._subtitleLoader=null),this._loader&&(this._loader.destroy(),this._loader=null)}async load(e,t,i){this.player.debug.log(this.TAG_NAME,"load()",e,t,i);const s=[this._loader.load(e)];let r,a,o,n,l,d;t&&s.push(this._audioLoader.load(t)),i&&s.push(this._subtitleLoader.load(i));try{const[e,i,n]=await Promise.all(s);if(!e)return[];r=e.data,t?(a=null==i?void 0:i.data,o=null==n?void 0:n.data):o=null==i?void 0:i.data}catch(e){throw jA.network(e)}try{var h;if(n=ob.parse(r,e),!1===(null===(h=n)||void 0===h?void 0:h.live)&&n.segments&&!n.segments.length)throw new Error("empty segments list");a&&(l=ob.parse(a,t)),o&&(d=ob.parse(o,i))}catch(e){throw new jA(FA,OA,e)}return n&&(n.isMaster?this.hls.emit(Gs,{playlist:n}):this.hls.emit(Hs,{playlist:n})),[n,l,d]}poll(e,t,i,s,r,a){clearTimeout(this._timer),a=a||3e3;let o=this.hls.config.pollRetryCount;const n=async()=>{clearTimeout(this._timer);try{const r=await this.load(e,t,i);if(!r[0])return;o=this.hls.config.pollRetryCount,s(r[0],r[1],r[2])}catch(e){o--,o<=0&&r(e)}this._timer=setTimeout(n,a)};this._timer=setTimeout(n,a)}stopPoll(){return clearTimeout(this._timer),this.cancel()}cancel(){return Promise.all([this._loader.cancel(),this._audioLoader.cancel()])}}class lb{constructor(){zd(this,"_chunkSpeeds",[]),zd(this,"_speeds",[])}addRecord(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}addChunkRecord(e,t){e&&t&&(this._chunkSpeeds.push(8e3*e/t),this._chunkSpeeds=this._chunkSpeeds.slice(-100))}getAvgSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds.reduce(((e,t)=>e+t))/this._speeds.length:this._chunkSpeeds.reduce(((e,t)=>e+t))/this._chunkSpeeds.length:0}getLatestSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeeds[this._chunkSpeeds.length-1]:0}reset(){this._chunkSpeeds=[],this._speeds=[]}}class db{constructor(e){zd(this,"_emitOnLoaded",((e,t)=>{const{data:i,response:s,option:r}=e,{firstByteTime:a,startTime:o,endTime:n,contentLength:l}=r||{},d=n-o;this._bandwidthService.addRecord(l||i.byteLength,d),this.hls.emit(Ys,{time:d,byteLength:l,url:t}),this.hls.emit(Qs,{url:t,elapsed:d||0}),this.hls.emit(Js,{url:t,responseUrl:s.url,elapsed:a-o}),this.hls.emit(Xs,{headers:s.headers})})),zd(this,"_onLoaderRetry",((e,t)=>{this.hls.emit(qs,{error:jA.network(e),retryTime:t})})),this.hls=e,this.player=e.player,this._bandwidthService=new lb;const{retryCount:t,retryDelay:i,loadTimeout:s,fetchOptions:r}=this.hls.config;this._segmentLoader=new BA({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._audioSegmentLoader=new BA({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._keyLoader=new BA({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player)}destroy(){this.reset(),this._keyLoader&&(this._keyLoader.destroy(),this._keyLoader=null),this._audioSegmentLoader&&(this._audioSegmentLoader.destroy(),this._audioSegmentLoader=null),this._segmentLoader&&(this._segmentLoader.destroy(),this._segmentLoader=null)}speedInfo(){return{speed:this._bandwidthService.getLatestSpeed(),avgSpeed:this._bandwidthService.getAvgSpeed()}}resetBandwidth(){this._bandwidthService.reset()}load(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:i;const r=[];return e&&(r[0]=this.loadVideoSegment(e,i)),t&&(r[1]=this.loadAudioSegment(t,s)),Promise.all(r)}loadVideoSegment(e,t){return this._loadSegment(this._segmentLoader,e,t)}loadAudioSegment(e,t){return this._loadSegment(this._audioSegmentLoader,e,t)}async _loadSegment(e,t,i){var s;let r,a,o,n,l;const d=[];if(this.hls.emit(Ks,{url:t.url}),d[0]=e.load(t.url),i&&t.initSegment){var h;const i=t.initSegment.url;r=this._mapCache[i],r||(this.hls.emit(Ks,{url:i}),d[1]=e.load(i).then((e=>{if(e){Object.keys(this._mapCache)>30&&(this._mapCache={}),r=this._mapCache[i]=e.data,this._emitOnLoaded(e,i)}})));const s=null===(h=t.initSegment.key)||void 0===h?void 0:h.url;s&&(l=t.initSegment.key.iv,n=this._keyCache[s],n||(this.hls.emit(Ks,{url:s}),d[2]=this._keyLoader.load(s).then((e=>{e&&(n=this._keyCache[s]=e.data,this._emitOnLoaded(e,s))}))))}const c=null===(s=t.key)||void 0===s?void 0:s.url;c&&(o=t.key.iv,a=this._keyCache[c],a||(this.hls.emit(Ks,{url:c}),d[3]=this._keyLoader.load(c).then((e=>{e&&(a=this._keyCache[c]=e.data,this._emitOnLoaded(e,c))}))));const[u]=await Promise.all(d);if(!u)return;const p=u.data;return this._emitOnLoaded(u,t.url),{data:p,map:r,key:a,mapKey:n,keyIv:o,mapKeyIv:l}}reset(){this.error=null,this._mapCache={},this._keyCache={},this._bandwidthService.reset()}async cancel(){await Promise.all([this._keyLoader.cancel(),this._segmentLoader.cancel(),this._audioSegmentLoader.cancel()])}}class hb{constructor(e,t,i){this.live=void 0,this.id=0,this.bitrate=0,this.width=0,this.height=0,this.name="",this.url="",this.audioCodec="",this.videoCodec="",this.textCodec="",this.startCC=0,this.endCC=0,this.startSN=0,this.endSN=-1,this.totalDuration=0,this.targetDuration=0,this.snDiff=null,this.segments=[],this.audioStreams=[],this.subtitleStreams=[],this.closedCaptions=[],this.currentAudioStream=null,this.currentSubtitleStream=null,this.TAG_NAME="HlsStream",this.update(e,t,i)}get lastSegment(){return this.segments.length?this.segments[this.segments.length-1]:null}get segmentDuration(){var e;return this.targetDuration||(null===(e=this.segments[0])||void 0===e?void 0:e.duration)||0}get liveEdge(){return this.endTime}get endTime(){var e;return(null===(e=this.lastSegment)||void 0===e?void 0:e.end)||0}get currentSubtitleEndSn(){var e;return(null===(e=this.currentSubtitleStream)||void 0===e?void 0:e.endSN)||0}clearOldSegment(e,t){return this._clearSegments(e,t)}getAudioSegment(e){if(!e||!this.currentAudioStream)return;const t=e.sn-this.snDiff;return this.currentAudioStream.segments.find((e=>e.sn===t))}update(e,t){this.url=e.url,Array.isArray(e.segments)?(null!==this.live&&void 0!==this.live||(this.live=e.live),this._updateSegments(e,this),this.startCC=e.startCC,this.endCC=e.endCC,this.startSN=e.startSN,this.endSN=e.endSN||-1,this.totalDuration=e.totalDuration,this.targetDuration=e.targetDuration,this.live=e.live,t&&this.currentAudioStream&&Array.isArray(t.segments)&&(this._updateSegments(t,this.currentAudioStream),(null===this.snDiff||void 0===this.snDiff)&&e.segments.length&&t.segments.length&&(this.snDiff=e.segments[0].sn-t.segments[0].sn))):(this.id=e.id,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.name=e.name,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.textCodec=e.textCodec,this.audioStreams=e.audioStreams,this.subtitleStreams=e.subtitleStreams,!this.currentAudioStream&&this.audioStreams.length&&(this.currentAudioStream=this.audioStreams.find((e=>e.default))||this.audioStreams[0]),!this.currentSubtitleStream&&this.subtitleStreams.length&&(this.currentSubtitleStream=this.subtitleStreams.find((e=>e.default))||this.subtitleStreams[0]))}updateSubtitle(e){if(!(e&&this.currentSubtitleStream&&Array.isArray(e.segments)))return;const t=this._updateSegments(e,this.currentSubtitleStream),i=this.currentSubtitleStream.segments;return i.length>100&&(this.currentSubtitleStream.segments=i.slice(100)),t?t.map((e=>({sn:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end,lang:this.currentSubtitleStream.lang}))):void 0}switchSubtitle(e){const t=this.subtitleStreams.find((t=>t.lang===e)),i=this.currentSubtitleStream;t&&(this.currentSubtitleStream=t,i.segments=[])}_clearSegments(e,t){let i=0;const s=this.segments;for(let t=0,r=s.length;t=e){i=t;break}return i>t&&(i=t),i&&(this.segments=this.segments.slice(i),this.currentAudioStream&&(this.currentAudioStream.segments=this.currentAudioStream.segments.slice(i))),t-i}_updateSegments(e,t){const i=t.segments;if(this.live){const s=i[i.length-1],r=(null==s?void 0:s.sn)||-1;if(re.sn===r)),o=a<0?e.segments:e.segments.slice(a+1);if(i.length&&o.length){let e=s.end;o.forEach((t=>{t.start=e,e=t.end}));const t=(null==s?void 0:s.cc)||-1;t>o[0].cc&&o.forEach((e=>e.cc+=t))}return t.endSN=e.endSN,t.segments=i.concat(o),o}}else t.segments=e.segments}}class cb{constructor(e){this.hls=e,this.player=e.player,this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1,this.TAG_NAME="HlsPlaylist"}destroy(){this.reset()}get lastSegment(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.lastSegment}get currentSegment(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer]}get nextSegment(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer+1]}get currentSegments(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.segments}get currentSubtitleEndSn(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.currentSubtitleEndSn}get liveEdge(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.liveEdge}get totalDuration(){var e;return(null===(e=this.currentStream)||void 0===e?void 0:e.totalDuration)||0}get seekRange(){const e=this.currentSegments;if(e&&e.length)return[e[0].start,e[e.length-1].end]}get isEmpty(){var e;return!(null!==(e=this.currentSegments)&&void 0!==e&&e.length)}get isLive(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.live}get hasSubtitle(){var e;return!(null===(e=this.currentStream)||void 0===e||!e.currentSubtitleStream)}getAudioSegment(e){var t;return null===(t=this.currentStream)||void 0===t?void 0:t.getAudioSegment(e)}moveSegmentPointer(e){var t;null==e&&(e=this._segmentPointer+1),this._segmentPointer=oa(e,-1,null===(t=this.currentSegments)||void 0===t?void 0:t.length),this.player.debug.log(this.TAG_NAME,`moveSegmentPointer() and param pos is ${e} and clamp result is ${this._segmentPointer}`)}reset(){this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1}getSegmentByIndex(e){var t;return null===(t=this.currentSegments)||void 0===t?void 0:t[e]}setNextSegmentByIndex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._segmentPointer=e-1,this.player.debug.log(this.TAG_NAME,"setNextSegmentByIndex()",e,this._segmentPointer)}findSegmentIndexByTime(e){const t=this.currentSegments;if(t){for(let i,s=0,r=t.length;s=i.start&&ee.url)).forEach(((e,t)=>{this.streams[t]?this.streams[t].update(e):this.streams[t]=new hb(e)})),this.currentStream=this.streams[0];else if(Array.isArray(e.segments)){const s=this.currentStream;if(s){s.update(e,t,i);const r=s.updateSubtitle(i);r&&this.hls.emit(zs,{list:r})}else this.reset(),this.currentStream=this.streams[0]=new hb(e,t,i)}this.currentStream&&this.hls.isLive&&!this.dvrWindow&&(this.dvrWindow=this.currentSegments.reduce(((e,t)=>e+=t.duration),0))}switchSubtitle(e){var t;null===(t=this.currentStream)||void 0===t||t.switchSubtitle(e)}clearOldSegment(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;const t=this.currentStream;if(!this.dvrWindow||!t)return;const i=t.endTime-this.dvrWindow;if(i<=0)return void this.player.debug.log(this.TAG_NAME,`clearOldSegment() stream.endTime:${t.endTime}, this.dvrWindow:${this.dvrWindow} startTime <= 0`);const s=t.segments;if(s.length<=e)return void this.player.debug.log(this.TAG_NAME,`clearOldSegment() segments.length:${s.length} <= maxPlaylistSize:${e}`);const r=this._segmentPointer;this._segmentPointer=t.clearOldSegment(i,r),this.player.debug.log(this.TAG_NAME,"clearOldSegment() update _segmentPointer:",r,this._segmentPointer),this.player.debug.log(this.TAG_NAME,"currentSegments",this.currentSegments)}checkSegmentTrackChange(e,t){const i=this.findSegmentIndexByTime(e),s=this.getSegmentByIndex(i);if(!s)return;if(!s.hasAudio&&!s.hasVideo)return;if(2!==t&&s.hasAudio&&s.hasVideo)return s;if(s.end-e>.3)return;const r=this.getSegmentByIndex(i+1);return r&&(r.hasAudio||r.hasVideo)&&(r.hasAudio!==s.hasAudio||r.hasVideo!==s.hasVideo)?r:void 0}}class ub{constructor(e,t){this.hls=e,this.player=t;const i=window.crypto||window.msCrypto;this.subtle=i&&(i.subtle||i.webkitSubtle),this.externalDecryptor=null}decrypt(e,t){if(!e&&!t)return;const i=[];return e&&(i[0]=this._decryptSegment(e)),t&&(i[1]=this._decryptSegment(t)),Promise.all(i)}async _decryptSegment(e){let t=e.data;return e.key&&(t=await this._decryptData(e.data,e.key,e.keyIv)),e.map?Yd(e.map,t):t}async _decryptData(e,t,i){if(this.externalDecryptor)return await this.externalDecryptor.decrypt(e,t,i);if(this.subtle){const s=await this.subtle.importKey("raw",t,{name:"AES-CBC"},!1,["encrypt","decrypt"]),r=await this.subtle.decrypt({name:"AES-CBC",iv:i},s,e);return new Uint8Array(r)}e=ud(e),t=ud(t),i=ud(i);return function(e){const{words:t}=e,{sigBytes:i}=e,s=new Uint8Array(i);for(let e=0;e>>2]>>>24-e%4*8&255;return s}(hd.AES.decrypt({ciphertext:e},t,{iv:i,mode:hd.mode.CBC}))}}class pb extends Dd{constructor(e){super(e),this.player=e,this._pmtId=-1,this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[],this._gopId=0,this._videoPid=-1,this._audioPid=-1,this._codecType=vt,this._audioCodecType=Et,this._vps=null,this._sps=null,this._pps=null,this.TAG_NAME="HlsTsLoader",this._isForHls=!0,this.videoTrack=pb.initVideoTrack(),this.audioTrack=pb.initAudioTrack(),this._baseDts=-1,this._baseDtsInited=!1,this._basefps=25,this._baseFpsInterval=null,this._tempSampleTsList=[],this._hasAudio=!1,this._hasVideo=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._isSendAACSeqHeader=!1,this.workerClearTimeout=null,this.workerUrl=null,this.loopWorker=null,this.tempSampleListInfo={},this._isUseWorker()&&this._initLoopWorker(),this.player.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.loopWorker&&(this.loopWorker.postMessage({cmd:"destroy"}),this.loopWorker.terminate(),this.loopWorker=null),this._stopDecodeLoopInterval(),this.videoTrack=null,this.audioTrack=null,this.tempSampleListInfo={},this._baseDts=-1,this._baseDtsInited=!1,this._basefps=25,this._hasCalcFps=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._isForHls=!0,this._isSendAACSeqHeader=!1,this.player.debug.log(this.TAG_NAME,"destroy")}static initVideoTrack(){return{samples:[]}}static initAudioTrack(){return{samples:[]}}static probe(e){return!!e.length&&(71===e[0]&&71===e[188]&&71===e[376])}_parsePES(e){const t=e[8];if(null==t||e.lengthe.length-6)return;let r,a;const o=e[7];return 192&o&&(r=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&o?(a=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,r-a>54e5&&(r=a)):a=r),{data:e.subarray(9+t),pts:r,dts:a,originalPts:r,originalDts:a}}_demux(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t&&(this._pmtId=-1,this.videoTrack=pb.initVideoTrack(),this.audioTrack=pb.initAudioTrack()),!i||t?(this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[]):(this.videoTrack.samples=[],this.audioTrack.samples=[],this._remainingPacketData&&(e=Yd(this._remainingPacketData,e),this._remainingPacketData=null));let s=e.length;const r=s%188;r&&(this._remainingPacketData=e.subarray(s-r),s-=r);for(let t=0;t>4>1){if(r=t+5+e[t+4],r===t+188)continue}else r=t+4;switch(s){case 0:i&&(r+=e[r]+1),this._pmtId=(31&e[r+10])<<8|e[r+11];break;case this._pmtId:{i&&(r+=e[r]+1);const t=r+3+((15&e[r+1])<<8|e[r+2])-4;for(r+=12+((15&e[r+10])<<8|e[r+11]);r=t)return[];const r=[];for(;s{const t=s?e[0]>>>1&63:31&e[0];switch(t){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!s&&5!==t||s&&5===t)break;r.isIFrame=!0,this._gopId++;break;case 6:case 39:case 40:if(!s&&6!==t||s&&6===t)break;return void function(e,t){const i=e.length;let s=t?2:1,r=0,a=0,o="";for(;255===e[s];)r+=255,s++;for(r+=e[s++];255===e[s];)a+=255,s++;if(a+=e[s++],5===r&&i>s+16)for(let t=0;t<16;t++)o+=e[s].toString(16),s++;e.subarray(s)}(function(e){const t=e.byteLength,i=[];let s=1;for(;s=i)return;const r=s,a=[],o=(60&e[s+2])>>>2,n=Fr[o];if(!n)throw new Error(`Invalid sampling index: ${o}`);const l=1+((192&e[s+2])>>>6),d=(1&e[s+2])<<2|(192&e[s+3])>>>6;let h,c,u=0;const p=Vr(n);for(;s+7>5,i-s=i?void 0:e.subarray(s),frames:a,samplingFrequencyIndex:o,sampleRate:n,objectType:l,channelCount:d,originCodec:`mp4a.40.${l}`}}(e.data,e.originalPts);if(t){if(this.audioTrack.codec=t.codec,this.audioTrack.sampleRate=t.sampleRate,this.audioTrack.channelCount=t.channelCount,!this._isSendAACSeqHeader){const e=jr({profile:t.objectType,sampleRate:t.samplingFrequencyIndex,channel:t.channelCount});this._isSendAACSeqHeader=!0,this.player.debug.log(this.TAG_NAME,"aac seq header",`profile: ${t.objectType}, sampleRate:${t.sampleRate},sampleRateIndex: ${t.samplingFrequencyIndex}, channel: ${t.channelCount}`),this._doDecodeByHls(e,Ne,0,!1,0)}if(this._isSendAACSeqHeader){const e=[];t.frames.forEach((t=>{const i=t.pts,s=new Uint8Array(t.data.length+2);s.set([175,1],0),s.set(t.data,2);const r={type:Ne,pts:i,dts:i,payload:s};e.push(r)})),this.audioTrack.samples=this.audioTrack.samples.concat(e)}else this.player.debug.warn(this.TAG_NAME,"aac seq header not send")}else this.player.debug.warn(this.TAG_NAME,"aac parseADTS error")}this._audioPesData=[]}else e&&"startPrefixError"===e.code&&(this._audioPesData=[])}_fix(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e=Math.round(9e4*e);const s=this.videoTrack,r=this.audioTrack,a=s.samples,o=r.samples;if(!a.length&&!o.length)return;const n=a[0],l=o[0];let d=0;if(a.length&&o.length&&(d=n.dts-l.pts),this._baseDtsInited||this._calculateBaseDts(),t&&(this._calculateBaseDts(),this._baseDts-=e),!i){this._videoNextDts=d>0?e+d:e,this._audioNextPts=d>0?e:e-d;const t=n?n.dts-this._baseDts-this._videoNextDts:0,i=l?l.pts-this._baseDts-this._audioNextPts:0;Math.abs(t||i)>xr&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=e)}this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(r),this._fixVideo(s);let h=s.samples.concat(r.samples);h=h.map((e=>(e.dts=Math.round(e.dts/90),e.pts=Math.round(e.pts/90),e.cts=e.pts-e.dts,e))).sort(((e,t)=>e.dts-t.dts)),h.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,this._isUseWorker()?this.loopWorker.postMessage({...e,payload:t,cmd:"sample"},[t.buffer]):e.type===je?this._doDecodeVideo({...e,payload:t}):e.type===Ne&&this._doDecodeAudio({...e,payload:t})})),po(this._hasCalcFps)&&this._isUseWorker()&&(this._hasCalcFps=!0,this._calcDecodeFps(h))}_isUseWorker(){return!this.player.isUseMSE()&&this.isForHls()}_calculateBaseDts(){const e=this.audioTrack,t=this.videoTrack,i=e.samples,s=t.samples;if(!i.length&&!s.length)return!1;let r=1/0,a=1/0;i.length&&(e.baseDts=r=i[0].pts),s.length&&(t.baseDts=a=s[0].dts),this._baseDts=Math.min(r,a);const o=a-r;return Number.isFinite(o)&&Math.abs(o)>45e3&&this.player.debug.warn(this.TAG_NAME,`large av first frame gap,\n video pts: ${a},\n audio pts: ${r},\n base dts: ${this._baseDts},\n detect is: ${o}`),this._baseDtsInited=!0,!0}_resetBaseDtsWhenStreamBreaked(){if(this._baseDtsInited&&this._videoTimestampBreak&&this._audioTimestampBreak){if(!this._calculateBaseDts(this.audioTrack,this.videoTrack))return;this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts),this._audioLastSample=null,this._videoLastSample=null,this._videoTimestampBreak=!1,this._audioTimestampBreak=!1}}_fixAudio(e){const t=e.samples;t.length&&(t.forEach((e=>{e.pts-=this._baseDts,e.dts=e.pts})),this._doFixAudioInternal(e,t,9e4))}_fixVideo(e){const t=e.samples;if(!t.length)return;if(t.forEach((e=>{e.dts-=this._baseDts,e.pts-=this._baseDts})),void 0===this._videoNextDts){const e=t[0];this._videoNextDts=e.dts}const i=t.length;let s=0;const r=t[0],a=t[1],o=this._videoNextDts-r.dts;let n;Math.abs(o)>45e3&&(r.dts+=o,r.pts+=o,this.player.debug.warn(this.TAG_NAME,`large video gap between chunk,\n next dts is ${this._videoNextDts},\n first dts is ${r.dts},\n next dts is ${a.dts},\n duration is ${o}`),a&&Math.abs(a.dts-r.dts)>xr&&(this._videoTimestampBreak=!0,t.forEach(((e,t)=>{0!==t&&(e.dts+=o,e.pts+=o)}))));const l=e.samples[0],d=e.samples[i-1];n=1===i?9e3:Math.floor((d.dts-l.dts)/(i-1));for(let r=0;rxr||s<0){this._videoTimestampBreak=!0,s=this._audioTimestampBreak?n:Math.max(s,2700);const i=this._audioNextPts||0;o&&o.dts>i&&(s=n),this.player.debug.warn(this.TAG_NAME,`large video gap between frames,\n time is ${a/e.timescale},\n dts is ${a},\n origin dts is ${t[r].originalDts},\n next dts is ${this._videoNextDts},\n sample Duration is ${s} ,\n ref Sample DurationInt is ${n}`)}t[r].duration=s,this._videoNextDts+=s}}_doFixAudioInternal(e,t,i){e.sampleDuration||(e.sampleDuration=Vr(e.timescale,i));const s=e.sampleDuration;if(void 0===this._audioNextPts){const e=t[0];this._audioNextPts=e.pts}for(let i=0;i=3*s&&o<=kr&&!Aa()){Hr(e.codec,e.channelCount)||t[0].data.subarray();const n=Math.floor(o/s);Math.abs(a.pts-this._lastAudioExceptionGapDot)>Cr&&(this._lastAudioExceptionGapDot=a.pts),this.player.debug.warn(this.TAG_NAME,`audio gap detected,\n pts is ${t.pts},\n originPts is ${t.originalPts},\n count is ${n},\n nextPts is ${r},\n ref sample duration is ${s}`);for(let e=0;e=-9e4?(Math.abs(a.pts-this._lastAudioExceptionOverlapDot)>Cr&&(this._lastAudioExceptionOverlapDot=a.pts,this.player.debug.warn(this.TAG_NAME,`audio overlap detected,\n pts is ${a.pts},\n originPts is ${a.originalPts},\n nextPts is ${r},\n ref sample duration is ${s}`)),t.splice(i,1),i--):(Math.abs(o)>=kr&&(this._audioTimestampBreak=!0,Math.abs(a.pts-this._lastAudioExceptionLargeGapDot)>Cr&&(this._lastAudioExceptionLargeGapDot=a.pts,this.player.debug.warn(this.TAG_NAME,`large audio gap detected,\n time is ${a.pts/1e3}\n pts is ${a.pts},\n originPts is ${a.originalPts},\n nextPts is ${r},\n sample duration is ${o}\n ref sample duration is ${s}`))),a.dts=a.pts=r,this._audioNextPts+=s)}}_calcDecodeFps(e){const t=ro(e.map((e=>({ts:e.dts||e.pts,type:e.type}))),je);t&&(this.player.debug.log(this.TAG_NAME,`_calcDecodeFps() video fps is ${t}, update base fps is ${this._basefps}`),this._basefps=t),this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps})}_initLoopWorker(){this.player.debug.log(this.TAG_NAME,"_initLoopWorker()");const e=Ao(function(){const e=1,t=2;let i=new class{constructor(){this.baseFps=0,this.fpsInterval=null,this.preLoopTimestamp=null,this.startBpsTime=null,this.allSampleList=[]}destroy(){this._clearInterval(),this.baseFps=0,this.allSampleList=[],this.preLoopTimestamp=null,this.startBpsTime=null}updateBaseFps(e){this.baseFps=e,this._clearInterval(),this._startInterval()}pushSample(e){delete e.cmd,this.allSampleList.push(e)}_startInterval(){const e=Math.ceil(1e3/this.baseFps);this.fpsInterval=setInterval((()=>{let t=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=t),this.startBpsTime||(this.startBpsTime=t);const i=t-this.preLoopTimestamp;if(i>2*e&&console.warn(`JbPro:[TsLoader LoopWorker] loop interval is ${i}ms, more than ${e} * 2ms`),this._loop(),this.preLoopTimestamp=(new Date).getTime(),this.startBpsTime){t-this.startBpsTime>=1e3&&(this._calcSampleList(),this.startBpsTime=t)}}),e)}_clearInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_calcSampleList(){const i={buferredDuration:0,allListLength:this.allSampleList.length,audioListLength:0,videoListLength:0};this.allSampleList.forEach((s=>{s.type===t?(i.videoListLength++,s.duration&&(i.buferredDuration+=Math.round(s.duration/90))):s.type===e&&i.audioListLength++})),postMessage({cmd:"sampleListInfo",...i})}_loop(){let i=null;if(this.allSampleList.length)if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]);let t=this.allSampleList[0];for(;t&&t.type===e;)i=this.allSampleList.shift(),postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),t=this.allSampleList[0]}else i.type===e&&(postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),this.allSampleList.length&&this.allSampleList[0].type===t&&(i=this.allSampleList.shift(),postMessage({cmd:"decodeVideo",...i},[i.payload.buffer])))}};self.onmessage=e=>{const t=e.data;switch(t.cmd){case"updateBaseFps":i.updateBaseFps(t.baseFps);break;case"sample":i.pushSample(t);break;case"destroy":i.destroy(),i=null}}}.toString()),t=new Blob([e],{type:"text/javascript"}),i=URL.createObjectURL(t);let s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te),s.onmessage=e=>{const t=e.data;switch(t.cmd){case"decodeVideo":this._doDecodeVideo(t);break;case"decodeAudio":this._doDecodeAudio(t);break;case"sampleListInfo":this.tempSampleListInfo=t}},this.loopWorker=s}_postMessageToLoopWorker(e,t){this._isUseWorker()&&(this.loopWorker?this.loopWorker.postMessage({cmd:e,...t}):this.player.debug.warn(this.TAG_NAME,"loop worker is not init, can not post message"))}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength});let i=t;uo(this.player._opt.m7sCryptoAudio)&&(i=this.cryptoPayloadAudio(t)),this.isForHls()?this._doDecodeByHls(i,Ne,e.dts,!1,0):this._doDecodeByTs(i,Ne,e.dts,!1,0)}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?jn(t,e.isIFrame):kn(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength});const s=e.pts-e.dts;let r=this.cryptoPayload(i,e.isIFrame);this.isForHls()?this._doDecodeByHls(r,je,e.dts,e.isIFrame,s):this._doDecodeByTs(r,je,e.dts,e.isIFrame,s)}_stopDecodeLoopInterval(){this._baseFpsInterval&&(clearInterval(this._baseFpsInterval),this._baseFpsInterval=null)}getBuferredDuration(){return this.tempSampleListInfo.buferredDuration||0}getSampleListLength(){return this.tempSampleListInfo.allListLength||0}getSampleAudioListLength(){return this.tempSampleListInfo.audioListLength||0}getSampleVideoListLength(){return this.tempSampleListInfo.videoListLength||0}isForHls(){return this._isForHls}getInputByteLength(){return this._remainingPacketData&&this._remainingPacketData.byteLength||0}}function fb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function mb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function gb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=Math.pow(2,32);return mb(e,t)*i+mb(e,t+4)}const yb="aac",Ab="g7110a",bb="g7110m",vb="avc",_b="hevc";class Sb{static getFrameDuration(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}static getRateIndexByRate(e){return Sb.FREQ.indexOf(e)}}function wb(e,t,i,s,r,a){const o=[],n=null==r?void 0:r.entries,l=t.entries,d=s.entries,h=i.entrySizes,c=null==a?void 0:a.entries;let u,p,f;c&&(u={},c.forEach((e=>{u[e-1]=!0}))),n&&(p=[],n.forEach((e=>{let{count:t,offset:i}=e;for(let e=0;e{let{count:t,delta:s}=e;for(let e=0;e=S&&(b++,S=l[b+1]?l[b+1].firstChunk-1:1/0),_+=l[b].samplesPerChunk)})),o}function Eb(e,t){return e.dataReferenceIndex=fb(t,6),e.width=fb(t,24),e.height=fb(t,26),e.horizresolution=mb(t,28),e.vertresolution=mb(t,32),e.frameCount=fb(t,40),e.depth=fb(t,74),78}function Tb(e,t){return e.dataReferenceIndex=fb(t,6),e.channelCount=fb(t,16),e.sampleSize=fb(t,18),e.sampleRate=mb(t,24)/65536,28}function kb(e,t,i){if(!e)return;if(e.size!==e.data.length)throw new Error(`box ${e.type} size !== data.length`);const s={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(s.version=e.data[e.headerSize],s.flags=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),s.headerSize+=4),i(s,e.data.subarray(s.headerSize),s.start+s.headerSize),s}zd(Sb,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);const Cb=function(e,t,i){const s=String(i),r=t>>0;let a=Math.ceil(r/s.length);const o=[],n=String(e);for(;a--;)o.push(s);return o.join("").substring(0,r-n.length)+n},xb=function(){const e=[];for(var t=arguments.length,i=new Array(t),s=0;s{e.push(Cb(Number(t).toString(16),2,0))})),e[0]};class Rb{static probe(e){return!!Rb.findBox(e,["ftyp"])}static findBox(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=[];if(!e)return s;let r=0,a="",o=0;for(;e.length>7;){if(r=mb(e),a=String.fromCharCode.apply(null,e.subarray(4,8)),o=8,1===r?(r=gb(e,8),o+=8):r||(r=e.length),!t[0]||a===t[0]){const n=e.subarray(0,r);if(!(t.length<2))return Rb.findBox(n.subarray(o),t.slice(1),i+o);s.push({start:i,size:r,headerSize:o,type:a,data:n})}i+=r,e=e.subarray(r)}return s}static tfhd(e){return kb(e,!0,((e,t)=>{e.trackId=mb(t);let i=4;const s=1&e.flags,r=2&e.flags,a=8&e.flags,o=16&e.flags,n=32&e.flags;s&&(i+=4,e.baseDataOffset=mb(t,i),i+=4),r&&(e.sampleDescriptionIndex=mb(t,i),i+=4),a&&(e.defaultSampleDuration=mb(t,i),i+=4),o&&(e.defaultSampleSize=mb(t,i),i+=4),n&&(e.defaultSampleFlags=mb(t,i))}))}static sidx(e){return kb(e,!0,((e,t)=>{let i=0;e.reference_ID=mb(t,i),i+=4,e.timescale=mb(t,i),i+=4,0===e.version?(e.earliest_presentation_time=mb(t,i),i+=4,e.first_offset=mb(t,i),i+=4):(e.earliest_presentation_time=gb(t,i),i+=8,e.first_offset=gb(t,i),i+=8),i+=2,e.references=[];const s=fb(t,i);i+=2;for(let r=0;r>31&1,s.referenced_size=2147483647&r,s.subsegment_duration=mb(t,i),i+=4,r=mb(t,i),i+=4,s.starts_with_SAP=r>>31&1,s.SAP_type=r>>28&7,s.SAP_delta_time=268435455&r}}))}static moov(e){return kb(e,!1,((e,t,i)=>{e.mvhd=Rb.mvhd(Rb.findBox(t,["mvhd"],i)[0]),e.trak=Rb.findBox(t,["trak"],i).map((e=>Rb.trak(e))),e.pssh=Rb.pssh(Rb.findBox(t,["pssh"],i)[0])}))}static mvhd(e){return kb(e,!0,((e,t)=>{let i=0;1===e.version?(e.timescale=mb(t,16),e.duration=gb(t,20),i+=28):(e.timescale=mb(t,8),e.duration=mb(t,12),i+=16),e.nextTrackId=mb(t,i+76)}))}static trak(e){return kb(e,!1,((e,t,i)=>{e.tkhd=Rb.tkhd(Rb.findBox(t,["tkhd"],i)[0]),e.mdia=Rb.mdia(Rb.findBox(t,["mdia"],i)[0])}))}static tkhd(e){return kb(e,!0,((e,t)=>{let i=0;1===e.version?(e.trackId=mb(t,16),e.duration=gb(t,24),i+=32):(e.trackId=mb(t,8),e.duration=mb(t,16),i+=20),e.width=mb(t,i+52),e.height=mb(t,i+56)}))}static mdia(e){return kb(e,!1,((e,t,i)=>{e.mdhd=Rb.mdhd(Rb.findBox(t,["mdhd"],i)[0]),e.hdlr=Rb.hdlr(Rb.findBox(t,["hdlr"],i)[0]),e.minf=Rb.minf(Rb.findBox(t,["minf"],i)[0])}))}static mdhd(e){return kb(e,!0,((e,t)=>{let i=0;1===e.version?(e.timescale=mb(t,16),e.duration=gb(t,20),i+=28):(e.timescale=mb(t,8),e.duration=mb(t,12),i+=16);const s=fb(t,i);e.language=String.fromCharCode(96+(s>>10&31),96+(s>>5&31),96+(31&s))}))}static hdlr(e){return kb(e,!0,((e,t)=>{0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}static minf(e){return kb(e,!1,((e,t,i)=>{e.vmhd=Rb.vmhd(Rb.findBox(t,["vmhd"],i)[0]),e.smhd=Rb.smhd(Rb.findBox(t,["smhd"],i)[0]),e.stbl=Rb.stbl(Rb.findBox(t,["stbl"],i)[0])}))}static vmhd(e){return kb(e,!0,((e,t)=>{e.graphicsmode=fb(t),e.opcolor=[fb(t,2),fb(t,4),fb(t,6)]}))}static smhd(e){return kb(e,!0,((e,t)=>{e.balance=fb(t)}))}static stbl(e){return kb(e,!1,((e,t,i)=>{var s,r,a;e.stsd=Rb.stsd(Rb.findBox(t,["stsd"],i)[0]),e.stts=Rb.stts(Rb.findBox(t,["stts"],i)[0]),e.ctts=Rb.ctts(Rb.findBox(t,["ctts"],i)[0]),e.stsc=Rb.stsc(Rb.findBox(t,["stsc"],i)[0]),e.stsz=Rb.stsz(Rb.findBox(t,["stsz"],i)[0]),e.stco=Rb.stco(Rb.findBox(t,["stco"],i)[0]),e.stco||(e.co64=Rb.co64(Rb.findBox(t,["co64"],i)[0]),e.stco=e.co64);const o=null===(s=e.stsd.entries[0])||void 0===s||null===(r=s.sinf)||void 0===r||null===(a=r.schi)||void 0===a?void 0:a.tenc.default_IV_size;e.stss=Rb.stss(Rb.findBox(t,["stss"],i)[0]),e.senc=Rb.senc(Rb.findBox(t,["senc"],i)[0],o)}))}static senc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return kb(e,!0,((e,i)=>{let s=0;const r=mb(i,s);s+=4,e.samples=[];for(let a=0;a{const i=[],s=[];let r=0;for(let e=0;e<16;e++)s.push(xb(t[r+e]));if(r+=16,e.version>0){const e=mb(t,r);r+=4;for(let s=0;s<(""+e).length;s++)for(let e=0;e<16;e++){const e=t[r];r+=1,i.push(xb(e))}}const a=mb(t,r);e.data_size=a,r+=4,e.kid=i,e.system_id=s,e.buffer=t}))}static stsd(e){return kb(e,!0,((e,t,i)=>{e.entryCount=mb(t),e.entries=Rb.findBox(t.subarray(4),[],i+4).map((e=>{switch(e.type){case"avc1":case"avc2":case"avc3":case"avc4":return Rb.avc1(e);case"hvc1":case"hev1":return Rb.hvc1(e);case"mp4a":return Rb.mp4a(e);case"alaw":case"ulaw":return Rb.alaw(e);case"enca":return kb(e,!1,((e,t,i)=>{e.channelCount=fb(t,16),e.samplesize=fb(t,18),e.sampleRate=mb(t,24)/65536,t=t.subarray(28),e.sinf=Rb.sinf(Rb.findBox(t,["sinf"],i)[0]),e.esds=Rb.esds(Rb.findBox(t,["esds"],i)[0])}));case"encv":return kb(e,!1,((e,t,i)=>{e.width=fb(t,24),e.height=fb(t,26),e.horizresolution=mb(t,28),e.vertresolution=mb(t,32),t=t.subarray(78),e.sinf=Rb.sinf(Rb.findBox(t,["sinf"],i)[0]),e.avcC=Rb.avcC(Rb.findBox(t,["avcC"],i)[0]),e.hvcC=Rb.hvcC(Rb.findBox(t,["hvcC"],i)[0]),e.pasp=Rb.pasp(Rb.findBox(t,["pasp"],i)[0])}))}})).filter(Boolean)}))}static tenc(e){return kb(e,!1,((e,t)=>{let i=6;e.default_IsEncrypted=t[i],i+=1,e.default_IV_size=t[i],i+=1,e.default_KID=[];for(let s=0;s<16;s++)e.default_KID.push(xb(t[i])),i+=1}))}static schi(e){return kb(e,!1,((e,t,i)=>{e.tenc=Rb.tenc(Rb.findBox(t,["tenc"],i)[0])}))}static sinf(e){return kb(e,!1,((e,t,i)=>{e.schi=Rb.schi(Rb.findBox(t,["schi"],i)[0]),e.frma=Rb.frma(Rb.findBox(t,["frma"],i)[0])}))}static frma(e){return kb(e,!1,((e,t)=>{e.data_format="";for(let i=0;i<4;i++)e.data_format+=String.fromCharCode(t[i])}))}static avc1(e){return kb(e,!1,((e,t,i)=>{const s=Eb(e,t),r=t.subarray(s);i+=s,e.avcC=Rb.avcC(Rb.findBox(r,["avcC"],i)[0]),e.pasp=Rb.pasp(Rb.findBox(r,["pasp"],i)[0])}))}static avcC(e){return kb(e,!1,((e,t)=>{e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=function(e){let t,i="avc1.";for(let s=0;s<3;s++)t=e[s].toString(16),t.length<2&&(t=`0${t}`),i+=t;return i}([t[1],t[2],t[3]]),e.lengthSizeMinusOne=3&t[4],e.spsLength=31&t[5],e.sps=[];let i=6;for(let s=0;s{const s=Eb(e,t),r=t.subarray(s);i+=s,e.hvcC=Rb.hvcC(Rb.findBox(r,["hvcC"],i)[0]),e.pasp=Rb.pasp(Rb.findBox(r,["pasp"],i)[0])}))}static hvcC(e){return kb(e,!1,((t,i)=>{t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=i[0];const s=i[1];t.generalProfileSpace=s>>6,t.generalTierFlag=(32&s)>>5,t.generalProfileIdc=31&s,t.generalProfileCompatibility=mb(i,2),t.generalConstraintIndicatorFlags=i.subarray(6,12),t.generalLevelIdc=i[12],t.avgFrameRate=fb(i,19),t.numOfArrays=i[22],t.vps=[],t.sps=[],t.pps=[];let r=23,a=0,o=0,n=0;for(let e=0;e{e.hSpacing=mb(t),e.vSpacing=mb(t,4)}))}static mp4a(e){return kb(e,!1,((e,t,i)=>{const s=Tb(e,t);e.esds=Rb.esds(Rb.findBox(t.subarray(s),["esds"],i+s)[0])}))}static esds(e){return kb(e,!0,((e,t)=>{e.codec="mp4a.";let i=0,s=0,r=0,a=0;for(;t.length;){for(i=0,a=t[i],s=t[i+1],i+=2;128&s;)r=(127&s)<<7,s=t[i],i+=1;if(r+=127&s,3===a)t=t.subarray(i+3);else{if(4!==a){if(5===a){const s=e.config=t.subarray(i,i+r);let a=(248&s[0])>>3;return 31===a&&s.length>=2&&(a=32+((7&s[0])<<3)+((224&s[1])>>5)),e.objectType=a,e.codec+=a.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[i].toString(16)+".").padStart(3,"0"),t=t.subarray(i+13)}}}))}static alaw(e){return kb(e,!1,((e,t)=>{Tb(e,t)}))}static stts(e){return kb(e,!0,((e,t)=>{const i=mb(t),s=[];let r=4;for(let e=0;e{const i=mb(t),s=[];let r=4;if(1===e.version)for(let e=0;e{const i=mb(t),s=[];let r=4;for(let e=0;e{const i=mb(t),s=mb(t,4),r=[];if(!i){let e=8;for(let i=0;i{const i=mb(t),s=[];let r=4;for(let e=0;e{const i=mb(t),s=[];let r=4;for(let e=0;e{const i=mb(t),s=[];let r=4;for(let e=0;e{e.mfhd=Rb.mfhd(Rb.findBox(t,["mfhd"],i)[0]),e.traf=Rb.findBox(t,["traf"],i).map((e=>Rb.traf(e)))}))}static mfhd(e){return kb(e,!0,((e,t)=>{e.sequenceNumber=mb(t)}))}static traf(e){return kb(e,!1,((e,t,i)=>{e.tfhd=Rb.tfhd(Rb.findBox(t,["tfhd"],i)[0]),e.tfdt=Rb.tfdt(Rb.findBox(t,["tfdt"],i)[0]),e.trun=Rb.trun(Rb.findBox(t,["trun"],i)[0])}))}static trun(e){return kb(e,!0,((e,t)=>{const{version:i,flags:s}=e,r=t.length,a=e.sampleCount=mb(t);let o=4;if(r>o&&1&s&&(e.dataOffset=-(1+~mb(t,o)),o+=4),r>o&&4&s&&(e.firstSampleFlags=mb(t,o),o+=4),e.samples=[],r>o){let r;for(let n=0;n{1===e.version?e.baseMediaDecodeTime=gb(t):e.baseMediaDecodeTime=mb(t)}))}static probe(e){return!!Rb.findBox(e,["ftyp"])}static parseSampleFlags(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}static moovToTrack(e,t,i){var s,r;const a=e.trak;if(!a||!a.length)return;const o=a.find((e=>{var t,i;return"vide"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)})),n=a.find((e=>{var t,i;return"soun"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)}));if(o&&t){var l,d,h,c,u,p,f;const i=t,s=null===(l=o.tkhd)||void 0===l?void 0:l.trackId;null!=s&&(i.id=o.tkhd.trackId),i.tkhdDuration=o.tkhd.duration,i.mvhdDurtion=e.mvhd.duration,i.mvhdTimecale=e.mvhd.timescale,i.timescale=i.formatTimescale=o.mdia.mdhd.timescale,i.duration=o.mdia.mdhd.duration||i.mvhdDurtion/i.mvhdTimecale*i.timescale;const r=o.mdia.minf.stbl.stsd.entries[0];if(i.width=r.width,i.height=r.height,r.pasp&&(i.sarRatio=[r.pasp.hSpacing,r.pasp.vSpacing]),r.hvcC)i.codecType=_b,i.codec=r.hvcC.codec,i.vps=r.hvcC.vps,i.sps=r.hvcC.sps,i.pps=r.hvcC.pps,i.hvcC=r.hvcC.data;else{if(!r.avcC)throw new Error("unknown video stsd entry");i.codecType=vb,i.codec=r.avcC.codec,i.sps=r.avcC.sps,i.pps=r.avcC.pps}var m,g,y,A,b,v,_,S;if(i.present=!0,i.ext={},i.ext.stss=null===(d=o.mdia)||void 0===d||null===(h=d.minf)||void 0===h||null===(c=h.stbl)||void 0===c?void 0:c.stss,i.ext.ctts=null===(u=o.mdia)||void 0===u||null===(p=u.minf)||void 0===p||null===(f=p.stbl)||void 0===f?void 0:f.ctts,r&&"encv"===r.type)i.isVideoEncryption=!0,r.default_KID=null===(m=r.sinf)||void 0===m||null===(g=m.schi)||void 0===g?void 0:g.tenc.default_KID,r.default_IsEncrypted=null===(y=r.sinf)||void 0===y||null===(A=y.schi)||void 0===A?void 0:A.tenc.default_IsEncrypted,r.default_IV_size=null===(b=r.sinf)||void 0===b||null===(v=b.schi)||void 0===v?void 0:v.tenc.default_IV_size,i.videoSenc=o.mdia.minf.stbl.senc&&o.mdia.minf.stbl.senc.samples,r.data_format=null===(_=r.sinf)||void 0===_||null===(S=_.frma)||void 0===S?void 0:S.data_format,i.useEME=e.useEME,i.kidValue=e.kidValue,i.pssh=e.pssh,i.encv=r}if(n&&i){var w,E,T,k,C,x,R,D,L;const t=i,a=null===(w=n.tkhd)||void 0===w?void 0:w.trackId;null!=a&&(t.id=n.tkhd.trackId),t.tkhdDuration=n.tkhd.duration,t.mvhdDurtion=e.mvhd.duration,t.mvhdTimecale=e.mvhd.timescale,t.timescale=t.formatTimescale=n.mdia.mdhd.timescale,t.duration=n.mdia.mdhd.duration||t.mvhdDurtion/t.mvhdTimecale*t.timescale;const o=n.mdia.minf.stbl.stsd.entries[0];switch(t.sampleSize=o.sampleSize,t.sampleRate=o.sampleRate,t.channelCount=o.channelCount,t.present=!0,o.type){case"alaw":t.codecType=t.codec=Ab,t.sampleRate=8e3;break;case"ulaw":t.codecType=t.codec=bb,t.sampleRate=8e3;break;default:t.codecType=yb,t.sampleDuration=Sb.getFrameDuration(t.sampleRate,t.timescale),t.sampleRateIndex=Sb.getRateIndexByRate(t.sampleRate),t.objectType=(null===(s=o.esds)||void 0===s?void 0:s.objectType)||2,o.esds&&(t.config=Array.from(o.esds.config)),t.codec=(null===(r=o.esds)||void 0===r?void 0:r.codec)||"mp4a.40.2"}var P,B,I,M,U,F,O,N;if(t.sampleDuration=Sb.getFrameDuration(t.sampleRate,t.timescale),t.objectType=(null===(E=o.esds)||void 0===E?void 0:E.objectType)||2,o.esds&&(o.esds.config?t.config=Array.from(o.esds.config):console.warn("esds config is null")),t.codec=(null===(T=o.esds)||void 0===T?void 0:T.codec)||"mp4a.40.2",t.sampleRateIndex=Sb.getRateIndexByRate(t.sampleRate),t.ext={},t.ext.stss=null===(k=n.mdia)||void 0===k||null===(C=k.minf)||void 0===C||null===(x=C.stbl)||void 0===x?void 0:x.stss,t.ext.ctts=null===(R=n.mdia)||void 0===R||null===(D=R.minf)||void 0===D||null===(L=D.stbl)||void 0===L?void 0:L.ctts,t.present=!0,o&&"enca"===o.type)t.isAudioEncryption=!0,o.data_format=null===(P=o.sinf)||void 0===P||null===(B=P.frma)||void 0===B?void 0:B.data_format,o.default_KID=null===(I=o.sinf)||void 0===I||null===(M=I.schi)||void 0===M?void 0:M.tenc.default_KID,o.default_IsEncrypted=null===(U=o.sinf)||void 0===U||null===(F=U.schi)||void 0===F?void 0:F.tenc.default_IsEncrypted,o.default_IV_size=null===(O=o.sinf)||void 0===O||null===(N=O.schi)||void 0===N?void 0:N.tenc.default_IV_size,t.audioSenc=n.mdia.minf.stbl.senc&&n.mdia.minf.stbl.senc.samples,t.useEME=e.useEME,t.kidValue=e.kidValue,t.enca=o}if(i&&(i.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!i&&i.isAudioEncryption),null!=t&&t.encv||null!=i&&i.enca){var j,z;const e=null==t||null===(j=t.encv)||void 0===j?void 0:j.default_KID,s=null==i||null===(z=i.enca)||void 0===z?void 0:z.default_KID,r=e||s?(e||s).join(""):null;t&&(t.kid=r),i&&(i.kid=r)}return t&&(t.flags=3841),i&&(i.flags=1793),{videoTrack:t,audioTrack:i}}static evaluateDefaultDuration(e,t,i){var s;const r=null==t||null===(s=t.samples)||void 0===s?void 0:s.length;if(!r)return 1024;return 1024*r/t.timescale*e.timescale/i}static moofToSamples(e,t,i){const s={};return e.mfhd&&(t&&(t.sequenceNumber=e.mfhd.sequenceNumber),i&&(i.sequenceNumber=e.mfhd.sequenceNumber)),e.traf.forEach((e=>{let{tfhd:r,tfdt:a,trun:o}=e;if(!r||!o)return;a&&(t&&t.id===r.trackId&&(t.baseMediaDecodeTime=a.baseMediaDecodeTime),i&&i.id===r.trackId&&(i.baseMediaDecodeTime=a.baseMediaDecodeTime));const n=r.defaultSampleSize||0,l=r.defaultSampleDuration||Rb.evaluateDefaultDuration(t,i,o.samples.length||o.sampleCount);let d=o.dataOffset||0,h=0,c=-1;if(!o.samples.length&&o.sampleCount){s[r.trackId]=[];for(let e=0;e((e={offset:d,dts:h,pts:h+(e.cts||0),duration:e.duration||l,size:e.size||n,gopId:c,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(c++,e.gopId=c),h+=e.duration,d+=e.size,e)))})),s}static moovToSamples(e){const t=e.trak;if(!t||!t.length)return;const i=t.find((e=>{var t,i;return"vide"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)})),s=t.find((e=>{var t,i;return"soun"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)}));if(!i&&!s)return;let r,a;if(i){var o,n;const e=null===(o=i.mdia)||void 0===o||null===(n=o.minf)||void 0===n?void 0:n.stbl;if(!e)return;const{stts:t,stsc:s,stsz:a,stco:l,stss:d,ctts:h}=e;if(!(t&&s&&a&&l&&d))return;r=wb(t,s,a,l,h,d)}if(s){var l,d,h;const e=null===(l=s.mdia)||void 0===l||null===(d=l.minf)||void 0===d?void 0:d.stbl;if(!e)return;const t=null===(h=s.mdia.mdhd)||void 0===h?void 0:h.timescale,{stts:i,stsc:r,stsz:o,stco:n}=e;if(!(t&&i&&r&&o&&n))return;a=wb(i,r,o,n)}return{videoSamples:r,audioSamples:a}}}class Db extends Dd{constructor(e){super(e),this.player=e,this.TAG_NAME="HlsFmp4Loader",this.tempSampleListInfo={},this.isInitVideo=!1,this.isInitAudio=!1,this.videoTrack={id:1,samples:[],sps:[],pps:[],vps:[],codec:""},this.audioTrack={id:2,samples:[],sampleRate:0,channelCount:0,codec:"",codecType:""},this.workerClearTimeout=null,this.workerUrl=null,this.loopWorker=null,this._hasCalcFps=!1,this._basefps=25,this.player.isUseMSE()||this._initLoopWorker(),e.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.loopWorker&&(this.loopWorker.postMessage({cmd:"destroy"}),this.loopWorker.terminate(),this.loopWorker=null),this._hasCalcFps=!1,this.videoTrack=null,this.audioTrack=null,this.isInitVideo=!1,this.isInitAudio=!1,this._basefps=25,this.player.debug.log(this.TAG_NAME,"destroy")}demux(e,t){let i=this.audioTrack,s=this.videoTrack;if(this.checkInitAudio(),this.checkInitVideo(),i.samples=[],s.samples=[],t){if(this.player.updateStats({abps:t.byteLength}),po(this.isInitAudio)){const e=Rb.findBox(t,["moov"])[0];if(!e)return void this.player.debug.error(this.TAG_NAME,"cannot found moov box");Rb.moovToTrack(Rb.moov(e),null,i),this.checkInitAudio()&&(this.player.debug.log(this.TAG_NAME,"audioData audio init success"),this._sendAccADTSHeader(i))}const e=Rb.findBox(t,["moof"])[0];if(e){const s=Rb.moofToSamples(Rb.moof(e),null,i)[i.id],r=i.baseMediaDecodeTime;if(s){const a=e.start;s.map((e=>{e.offset+=a;const s=t.subarray(e.offset,e.offset+e.size),o=e.dts+r,n=new Uint8Array(s.length+2);n.set([175,1],0),n.set(s,2),i.samples.push({type:Ne,pts:o,dts:o,payload:n,duration:e.duration,size:n.byteLength})}))}}}if(e){if(this.player.updateStats({vbps:e.byteLength}),po(this.isInitVideo)&&po(this.isInitAudio)){const t=Rb.findBox(e,["moov"])[0];if(!t)throw new Error("cannot found moov box");if(Rb.moovToTrack(Rb.moov(t),s,i),po(this.isInitAudio)&&this.checkInitAudio()&&(this.player.debug.log(this.TAG_NAME,"videoData audio init success",i),this._sendAccADTSHeader(i)),this.checkInitVideo()){this.player.debug.log(this.TAG_NAME,"video init success");let e=null;s.codecType===as?s.sps.length&&s.vps.length&&s.pps.length&&(e=Nn({sps:s.sps[0],pps:s.pps[0],vps:s.vps[0]})):s.sps.length&&s.pps.length&&(e=Tn({sps:s.sps[0],pps:s.pps[0]})),e&&(this.player.debug.log(this.TAG_NAME,"seqHeader"),this._doDecodeByHls(e,je,0,!0,0))}}const t=Rb.findBox(e,["moof"])[0];if(t){const r=Rb.moofToSamples(Rb.moof(t),s,i),a=s.baseMediaDecodeTime,o=i.baseMediaDecodeTime,n=t.start;Object.keys(r).forEach((t=>{s.id==t?r[t].map((t=>{t.offset+=n;const i={type:je,pts:(t.pts||t.dts)+a,dts:t.dts+a,units:[],payload:null,isIFrame:!1};i.duration=t.duration,i.gopId=t.gopId,t.keyframe&&(i.isIFrame=!0);const r=e.subarray(t.offset,t.offset+t.size);i.payload=r,s.samples.push(i)})):i.id==t&&r[t].map((t=>{t.offset+=n;const s=e.subarray(t.offset,t.offset+t.size),r=t.dts+o,a=new Uint8Array(s.length+2);a.set([175,1],0),a.set(s,2),i.samples.push({type:Ne,pts:r,dts:r,payload:a,duration:t.duration,size:a.byteLength})}))}))}}const r=s.samples.concat(i.samples);r.sort(((e,t)=>e.dts-t.dts)),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,this.player.isUseMSE()?e.type===je?this._doDecodeVideo({...e,payload:t}):e.type===Ne&&this._doDecodeAudio({...e,payload:t}):this.loopWorker.postMessage({...e,payload:t,cmd:"sample"},[t.buffer])})),po(this._hasCalcFps)&&(this._hasCalcFps=!0,this._calcDecodeFps(r))}checkInitAudio(){return this.isInitAudio=!!(this.audioTrack.sampleRate&&this.audioTrack.channelCount&&this.audioTrack.codec&&"aac"===this.audioTrack.codecType),this.isInitAudio}checkInitVideo(){return this.isInitVideo=!!(this.videoTrack.pps.length&&this.videoTrack.sps.length&&this.videoTrack.codec),this.isInitVideo}_sendAccADTSHeader(e){const t=jr({profile:e.objectType,sampleRate:e.sampleRateIndex,channel:e.channelCount});this._doDecodeByHls(t,Ne,0,!0,0)}_calcDecodeFps(e){const t=ro(e.map((e=>({ts:e.dts||e.pts,type:e.type}))),je);t&&(this.player.debug.log(this.TAG_NAME,`_calcDecodeFps() video fps is ${t}, update base fps is ${this._basefps}`),this._basefps=t),this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps})}_initLoopWorker(){this.player.debug.log(this.TAG_NAME,"_initLoopWorker()");const e=Ao(function(){const e=1,t=2;let i=new class{constructor(){this.baseFps=0,this.fpsInterval=null,this.preLoopTimestamp=null,this.startBpsTime=null,this.allSampleList=[]}destroy(){this._clearInterval(),this.baseFps=0,this.allSampleList=[],this.preLoopTimestamp=null,this.startBpsTime=null}updateBaseFps(e){this.baseFps=e,this._clearInterval(),this._startInterval()}pushSample(e){delete e.cmd,this.allSampleList.push(e)}_startInterval(){const e=Math.ceil(1e3/this.baseFps);this.fpsInterval=setInterval((()=>{let t=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=t),this.startBpsTime||(this.startBpsTime=t);const i=t-this.preLoopTimestamp;if(i>2*e&&console.warn(`JbPro:[HlsFmp4Loader LoopWorker] loop interval is ${i}ms, more than ${e} * 2ms`),this._loop(),this.preLoopTimestamp=(new Date).getTime(),this.startBpsTime){t-this.startBpsTime>=1e3&&(this._calcSampleList(),this.startBpsTime=t)}}),e)}_clearInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_calcSampleList(){const i={buferredDuration:0,allListLength:this.allSampleList.length,audioListLength:0,videoListLength:0};this.allSampleList.forEach((s=>{s.type===t?(i.videoListLength++,s.duration&&(i.buferredDuration+=s.duration)):s.type===e&&i.audioListLength++})),postMessage({cmd:"sampleListInfo",...i})}_loop(){let i=null;if(this.allSampleList.length)if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]);let t=this.allSampleList[0];for(;t&&t.type===e;)i=this.allSampleList.shift(),postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),t=this.allSampleList[0]}else i.type===e&&(postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),this.allSampleList.length&&this.allSampleList[0].type===t&&(i=this.allSampleList.shift(),postMessage({cmd:"decodeVideo",...i},[i.payload.buffer])))}};self.onmessage=e=>{const t=e.data;switch(t.cmd){case"updateBaseFps":i.updateBaseFps(t.baseFps);break;case"sample":i.pushSample(t);break;case"destroy":i.destroy(),i=null}}}.toString()),t=new Blob([e],{type:"text/javascript"}),i=URL.createObjectURL(t);let s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te),s.onmessage=e=>{const t=e.data;switch(t.cmd){case"decodeVideo":this._doDecodeVideo(t);break;case"decodeAudio":this._doDecodeAudio(t);break;case"sampleListInfo":this.tempSampleListInfo=t}},this.loopWorker=s}_postMessageToLoopWorker(e,t){this.player.isUseMSE()||(this.loopWorker?this.loopWorker.postMessage({cmd:e,...t}):this.player.debug.warn(this.TAG_NAME,"loop worker is not init, can not post message"))}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this._doDecodeByHls(t,Ne,e.dts,!1,0)}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?jn(t,e.isIFrame):kn(t,e.isIFrame),this.player.updateStats({dts:e.dts});const s=e.pts-e.dts;this._doDecodeByHls(i,je,e.dts,e.isIFrame,s)}getBuferredDuration(){return this.tempSampleListInfo.buferredDuration||0}getSampleListLength(){return this.tempSampleListInfo.allListLength||0}getSampleAudioListLength(){return this.tempSampleListInfo.audioListLength||0}getSampleVideoListLength(){return this.tempSampleListInfo.videoListLength||0}}class Lb{constructor(e,t){this.hls=e,this.player=this.hls.player,this.isMP4=t,this._initSegmentId="",this.TAG_NAME="HlsTransmuxer",this._demuxer=t?new Db(this.hls.player):new pb(this.hls.player),this.player.debug.log(this.TAG_NAME,`init and isMP4 is ${t}`)}destroy(){this._demuxer&&(this._demuxer.destroy(),this._demuxer=null)}transmux(e,t,i,s,r,a){this.player.debug.log(this.TAG_NAME,`transmux videoChunk:${e&&e.byteLength}, audioChunk:${t&&t.byteLength}, discontinuity:${i}, contiguous:${s}, startTime:${r}, needInit:${a}`);const o=this._demuxer;try{this.isMP4?o.demux(e,t):o.demuxAndFix(Yd(e,t),i,s,r)}catch(e){throw new jA(NA,OA,e)}}}class Pb{constructor(e){this.hls=e,this.player=e.player,this._decryptor=new ub(this.hls,this.player),this._transmuxer=null,this._mse=null,this._softVideo=null,this._sourceCreated=!1,this._needInitSegment=!0,this._directAppend=!1,this.TAG_NAME="HlsBufferService"}async destroy(){this._softVideo=null,this._transmuxer&&(this._transmuxer.destroy(),this._transmuxer=null)}get baseDts(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t._baseDts}get nbSb(){return 0}async updateDuration(e){this.player.debug.log(this.TAG_NAME,"updateDuration()",e)}getBuferredDuration(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getBuferredDuration()}getBufferedSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleListLength()}getBufferedAudioSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleAudioListLength()}getBufferedVideoSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleVideoListLength()}createSource(e,t,i,s){if(this._sourceCreated)return;const r=e||t;r&&(pb.probe(r)?this._transmuxer||(this._transmuxer=new Lb(this.hls,!1)):Rb.probe(r)?this._transmuxer||(this._transmuxer=new Lb(this.hls,!0)):this.player.debug.error(this.TAG_NAME,"createSource error: chunk is not ts"))}async appendBuffer(e,t,i,s,r,a,o){if(null!=i&&i.length||null!=s&&s.length)return this._needInitSegment,this._transmuxer.transmux(i,s,r,a,o,this._needInitSegment||r),!0}async clearAllBuffer(){this.player.debug.log(this.TAG_NAME,"clearAllBuffer")}decryptBuffer(e,t){return this._decryptor.decrypt(e,t)}async reset(){this._transmuxer=null,this._needInitSegment=!0,this._directAppend=!1}async endOfStream(){this._softVideo&&this._softVideo.endOfStream()}async setLiveSeekableRange(e,t){}seamlessSwitch(){this._needInitSegment=!0}}class Bb{constructor(e){this.emitter=e,this._seiSet=new Set,e.on(Zs,(e=>{e&&this._seiSet.add(e)}))}throw(e){if(null==e||!this._seiSet.size)return;const t=e-.2,i=e+.2,s=[];this._seiSet.forEach((e=>{e.time>=t&&e.time<=i&&s.push(e)})),s.forEach((e=>{this._seiSet.delete(e),this.emitter.emit(er,e)}))}reset(){this._seiSet.clear()}}class Ib{constructor(e){this._timescale=e,this.encodeType="",this.audioCodec="",this.videoCodec="",this.domain="",this.fps=0,this.bitrate=0,this.width=0,this.height=0,this.samplerate=0,this.channelCount=0,this.gop=0,this._bitsAccumulateSize=0,this._bitsAccumulateDuration=0}getStats(){return{encodeType:this.encodeType,audioCodec:this.audioCodec,videoCodec:this.videoCodec,domain:this.domain,fps:this.fps,bitrate:this.bitrate,width:this.width,height:this.height,samplerate:this.samplerate,channelCount:this.channelCount,gop:this.gop}}setEncodeType(e){this.encodeType=e}setFpsFromScriptData(e){var t;let{data:i}=e;const s=null==i||null===(t=i.onMetaData)||void 0===t?void 0:t.framerate;s&&s>0&&s<100&&(this.fps=s)}setVideoMeta(e){if(this.width=e.width,this.height=e.height,this.videoCodec=e.codec,this.encodeType=e.codecType,e.fpsNum&&e.fpsDen){const t=e.fpsNum/e.fpsDen;t>0&&t<100&&(this.fps=t)}}setAudioMeta(e){this.audioCodec=e.codec,this.samplerate=e.sampleRate,this.channelCount=e.channelCount}setDomain(e){this.domain=e.split("/").slice(2,3)[0]}updateBitrate(e){if((!this.fps||this.fps>=100)&&e.length){const t=e.reduce(((e,t)=>e+t.duration),0)/e.length;this.fps=Math.round(this._timescale/t)}e.forEach((e=>{1===e.gopId&&this.gop++,this._bitsAccumulateDuration+=e.duration/(this._timescale/1e3),this._bitsAccumulateSize+=e.units.reduce(((e,t)=>e+t.length),0),this._bitsAccumulateDuration>=1e3&&(this.bitrate=8*this._bitsAccumulateSize,this._bitsAccumulateDuration=0,this._bitsAccumulateSize=0)}))}}class Mb{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;zd(this,"_core",null),zd(this,"_samples",[]),this._core=e,this._timescale=t,this._stats=new Ib(t),this._bindEvents()}getStats(){var e,t,i,s,r,a,o;const{currentTime:n=0,decodeFps:l=0}=(null===(e=this._core)||void 0===e?void 0:e.media)||{};return{...this._stats.getStats(),downloadSpeed:(null===(t=this._core)||void 0===t||null===(i=t.speedInfo)||void 0===i?void 0:i.call(t).speed)||0,avgSpeed:(null===(s=this._core)||void 0===s||null===(r=s.speedInfo)||void 0===r?void 0:r.call(s).avgSpeed)||0,currentTime:n,bufferEnd:(null===(a=this._core)||void 0===a||null===(o=a.bufferInfo())||void 0===o?void 0:o.remaining)||0,decodeFps:l}}_bindEvents(){this._core.on(Vs,(e=>this._stats.updateBitrate(e.samples))),this._core.on($s,(e=>{this._stats.setFpsFromScriptData(e)})),this._core.on(Ws,(e=>{"video"===e.type?this._stats.setVideoMeta(e.track):this._stats.setAudioMeta(e.track)})),this._core.on(Js,(e=>{this._stats.setDomain(e.responseUrl)}))}reset(){this._samples=[],this._stats=new Ib(this._timescale)}}class Ub extends So{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),zd(this,"_loadSegment",(async()=>{if(this._segmentProcessing)return void this.player.debug.warn("_loadSegment()","_segmentProcessing is ture and return");if(!this._playlist)return void this.player.debug.warn("_loadSegment()","this._playlist is null and return");const e=this._playlist.currentSegment,t=this._playlist.nextSegment;if(this.player.debug.log(this.TAG_NAME,"_loadSegment()","curSeg",e&&e.url,"nextSeg",t&&t.url),t)return this._loadSegmentDirect();this.player.debug.log(this.TAG_NAME,"nextSeg is null and return")})),this.player=e,this.config=null,this._manifestLoader=null,this._segmentLoader=null,this._playlist=null,this._bufferService=null,this._seiService=null,this._stats=null,this._prevSegSn=null,this._prevSegCc=null,this._tickTimer=null,this._tickInterval=500,this._segmentProcessing=!1,this._reloadOnPlay=!1,this._switchUrlOpts=null,this._disconnectTimer=null,this.TAG_NAME="Hls256",this.canVideoPlay=!1,this.$videoElement=null,this.config=t=function(e){return{isLive:!0,maxPlaylistSize:50,retryCount:3,retryDelay:1e3,pollRetryCount:2,loadTimeout:1e4,preloadTime:30,softDecode:!1,bufferBehind:10,maxJumpDistance:3,startTime:0,targetLatency:10,maxLatency:20,allowedStreamTrackChange:!0,...e}}(t),this._manifestLoader=new nb(this),this._segmentLoader=new db(this),this._playlist=new cb(this),this._bufferService=new Pb(this),this._seiService=new Bb(this),this._stats=new Mb(this,9e4),this.player.debug.log(this.TAG_NAME,"init")}async destroy(){this.player.debug.log(this.TAG_NAME,"destroy()"),this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),await Promise.all([this._clear(),this._bufferService.destroy()]),this._manifestLoader&&(await this._manifestLoader.destroy(),this._manifestLoader=null),this._segmentLoader&&(this._segmentLoader.destroy(),this._segmentLoader=null),this._playlist&&(this._playlist.destroy(),this._playlist=null),this.player.debug.log(this.TAG_NAME,"destroy end")}_startTick(){this._stopTick(),this._tickTimer=setTimeout((()=>{this._tick()}),this._tickInterval)}_stopTick(){this._tickTimer&&clearTimeout(this._tickTimer),this._tickTimer=null}_tick(){this.player.isDestroyedOrClosed()?this.player.debug.log(this.TAG_NAME,"_tick() player is destroyed"):(this._startTick(),this._loadSegment())}get isLive(){return this._playlist.isLive}get streams(){return this._playlist.streams}get currentStream(){return this._playlist.currentStream}get hasSubtitle(){return this._playlist.hasSubtitle}get baseDts(){var e;return null===(e=this._bufferService)||void 0===e?void 0:e.baseDts}speedInfo(){return this._segmentLoader.speedInfo()}resetBandwidth(){this._segmentLoader.resetBandwidth()}getStats(){return this._stats.getStats()}async loadSource(e){return await this._reset(),await this._loadData(e),this._startTick(),!0}async _loadData(e){try{e&&(e=e.trim())}catch(e){}if(!e)throw this._emitError(new jA(UA,UA,null,null,"m3u8 url is missing"));const t=await this._loadM3U8(e),{currentStream:i}=this._playlist;if(this._urlSwitching){var s,r;if(0===i.bitrate&&null!==(s=this._switchUrlOpts)&&void 0!==s&&s.bitrate)i.bitrate=null===(r=this._switchUrlOpts)||void 0===r?void 0:r.bitrate;const e=this._getSeamlessSwitchPoint();this.config.startTime=e;const t=this._playlist.findSegmentIndexByTime(e),a=this._playlist.getSegmentByIndex(t+1);if(a){const e=a.start;this.player.debug.warn(this.TAG_NAME,`clear buffer from ${e}`)}}t&&(this.isLive?(this.player.debug.log(this.TAG_NAME,"is live"),this._bufferService.setLiveSeekableRange(0,4294967295),this.config.targetLatency{let[t,i,o]=e;t?(this._playlist.upsertPlaylist(t,i,o),this.isLive&&this._pollM3U8(s,r,a)):this.player.debug.warn(this.TAG_NAME,"_refreshM3U8() mediaPlaylist is empty")})).catch((e=>{throw this._emitError(jA.create(e))}))}_pollM3U8(e,t,i){var s;let r=this._playlist.isEmpty;this._manifestLoader.poll(e,t,i,((e,t,i)=>{this._playlist.upsertPlaylist(e,t,i),this._playlist.clearOldSegment(),e&&r&&!this._playlist.isEmpty&&this._loadSegment(),r&&(r=this._playlist.isEmpty)}),(e=>{this._emitError(jA.create(e))}),1e3*((null===(s=this._playlist.lastSegment)||void 0===s?void 0:s.duration)||0))}async _loadSegmentDirect(){const e=this._playlist.nextSegment;if(!e)return void this.player.debug.log(this.TAG_NAME,"_loadSegmentDirect() !seg");let t=!1,i=null;try{this._segmentProcessing=!0,t=await this._reqAndBufferSegment(e,this._playlist.getAudioSegment(e))}catch(e){i=e}finally{this._segmentProcessing=!1}return i?this._emitError(jA.create(i)):(t?(this._urlSwitching&&(this._urlSwitching=!1,this.emit(ir,{url:this.config.url})),this._playlist.moveSegmentPointer(),this.player.debug.log(this.TAG_NAME,"_loadSegmentDirect()","seg.isLast",e.isLast),e.isLast?(this.player.debug.log(this.TAG_NAME,"_loadSegmentDirect()","seg.isLast"),this._end()):(this.player.debug.log(this.TAG_NAME,"_loadSegmentDirect()","and next _loadSegment()"),this._loadSegment())):this.player.debug.log(this.TAG_NAME,"_loadSegmentDirect() not appended"),t)}async _reqAndBufferSegment(e,t){this.player.debug.log(this.TAG_NAME,"video seg",e&&e.url,"audio seg",t&&t.url);const i=e?e.cc:t.cc,s=this._prevSegCc!==i;let r=[];try{r=await this._segmentLoader.load(e,t,s)}catch(e){throw e.fatal=!1,this._segmentLoader.error=e,e}if(!r[0])return;const a=await this._bufferService.decryptBuffer(...r);if(!a)return void this.player.debug.log(this.TAG_NAME,"decryptBuffer return null");const o=e?e.sn:t.sn,n=e?e.start:t.start,l=this._playlist.currentStream;return this._bufferService.createSource(a[0],a[1],null==l?void 0:l.videoCodec,null==l?void 0:l.audioCodec),await this._bufferService.appendBuffer(e,t,a[0],a[1],s,this._prevSegSn===o-1,n),this._prevSegCc=i,this._prevSegSn=o,!0}async _clear(){this.player.debug.log(this.TAG_NAME,"_clear()"),clearTimeout(this._disconnectTimer),this._stopTick(),await Promise.all([this._segmentLoader.cancel(),this._manifestLoader.stopPoll()]),this._segmentProcessing=!1}async _reset(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.player.debug.log(this.TAG_NAME,"_reset()"),this._reloadOnPlay=!1,this._prevSegSn=null,this._prevSegCc=null,this._switchUrlOpts=null,this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),this._stats.reset(),await this._clear(),this._bufferService.reset(e)}_end(){this.player.debug.log(this.TAG_NAME,"_end()"),this._clear()}_emitError(e){var t;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;!1===(null===(t=e.originError)||void 0===t?void 0:t.fatal)?console.warn(e):(console.table(e),console.error(e),console.error(null===(s=this.media)||void 0===s?void 0:s.error),this._stopTick(),this._urlSwitching&&(this._urlSwitching=!1,this.emit(tr,e)),i&&this._end(),this._seiService.reset(),this.emit(ar,e));return e}_getSeamlessSwitchPoint(){const{media:e}=this;let t=e.currentTime;if(!e.paused){var i;const s=this._playlist.findSegmentIndexByTime(e.currentTime),r=this._playlist.getSegmentByIndex(s),a=null===(i=this._stats)||void 0===i?void 0:i.getStats().downloadSpeed;if(a&&r){t+=r.duration*this._playlist.currentStream.bitrate/a+1}else t+=5}return t}getDemuxBuferredDuration(){return this._bufferService.getBuferredDuration()||0}getDemuxBufferedListLength(){return this._bufferService.getBufferedSegments()||0}getDemuxAudioBufferedListLength(){return this._bufferService.getBufferedAudioSegments()||0}getDemuxVideoBufferedListLength(){return this._bufferService.getBufferedVideoSegments()||0}}class Fb extends So{constructor(e){super(),zd(this,"TAG_NAME","Hls256Decoder"),this.player=e,this.$videoElement=this.player.video.$videoElement,this.hls=null,this.eventsDestroy=[],this.bandwidthEstimateInterval=null,this.hls=new Ub(e),this._bindEvents()}async destroy(){return this._stopBandwidthEstimateInterval(),this.hls&&(await this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.$videoElement=null,this.player.debug.log(this.TAG_NAME,"destroy"),!0}_bindEvents(){this.hls.on(ar,(e=>{this.player.emitError(ct.hlsError,e)})),this._startBandwidthEstimateInterval()}_startBandwidthEstimateInterval(){this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{const e=this.hls.speedInfo();this.player.emit(nt.kBps,(e.avgSpeed/1024/8).toFixed(2)),this.hls.resetBandwidth()}),1e3)}_stopBandwidthEstimateInterval(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}async loadSource(e){return this.url=e,await this.hls.loadSource(e),!0}checkHlsBufferedDelay(){let e=0;return this.hls&&(e=this.hls.getDemuxBuferredDuration()),e}getDemuxBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxBufferedListLength()),e}getDemuxAudioBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxAudioBufferedListLength()),e}getDemuxVideoBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxVideoBufferedListLength()),e}}class Ob extends So{constructor(e){super(),this.player=e,this.TAG_NAME="CommonWebrtc",this.rtcPeerConnection=null,this.videoStream=null,this.isDisconnected=!1,this.isH264=this.player.isWebrtcH264(),this.eventsDestroy=[],this.supportVideoFrameCallbackHandle=null,this.isInitInfo=!1,this.$videoElement=this.player.video.$videoElement,this.bandwidthEstimateInterval=null,this.rtcPeerTrackVideoReceiver=null,this.rtcPeerTrackAudioReceiver=null,this.prevWebrtcVideoStats={},this.prevWebrtcAudioStats={},this.currentWebrtcStats={},this.player._opt.webrtcUseCanvasRender&&this.isH264&&(this.$videoElement=document.createElement("video"),Aa()&&(this.$videoElement.style.position="absolute"),this._initVideoEvents()),this.$videoElement.muted=!0,this._initRtcPeerConnection()}destroy(){this.isDisconnected=!1,this.isInitInfo=!1,this.prevWebrtcVideoStats={},this.currentWebrtcStats={},this.rtcPeerTrackVideoReceiver=null,this.rtcPeerTrackAudioReceiver=null,this._stopBandwidthEstimateInterval(),this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.isH264&&(this.videoStream&&(this.videoStream.getTracks().forEach((e=>e.stop())),this.videoStream=null),this.$videoElement.srcObject=null),this.rtcPeerConnection&&(this.rtcPeerConnection.onicecandidate=ta,this.rtcPeerConnection.ontrack=ta,this.rtcPeerConnection.onconnectionstatechange=ta,this.rtcPeerConnection.ondatachannel=ta,this.rtcPeerConnection.close(),this.rtcPeerConnection=null)}_initVideoEvents(){const{proxy:e}=this.player.events,t=e(this.$videoElement,es,(()=>{this.player.debug.log(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.debug.log(this.TAG_NAME,"video play"),this._startCanvasRender(),this._initRenderSize()})).catch((e=>{this.player.debug.warn(this.TAG_NAME,"video play error ",e)}))})),i=e(this.$videoElement,ts,(()=>{this.player.debug.log("HlsDecoder","video waiting")})),s=e(this.$videoElement,is,(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t}),this.$videoElement.paused&&(this.player.debug.warn("HlsDecoder","video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debug.log("HlsDecoder","video is paused and replay success")})).catch((e=>{this.player.debug.warn("HlsDecoder","video is paused and replay error ",e)})))})),r=e(this.$videoElement,ss,(()=>{this.player.debug.log("HlsDecoder","video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)}));this.eventsDestroy.push(t,i,s,r)}_initRtcPeerConnection(){const e=new RTCPeerConnection,t=this.player;e.addTransceiver("video",{direction:"recvonly"}),e.addTransceiver("audio",{direction:"recvonly"}),e.onsignalingstatechange=e=>{this.player.debug.log(this.TAG_NAME,"onsignalingstatechange",e)},e.oniceconnectionstatechange=i=>{this.player.debug.log(this.TAG_NAME,"oniceconnectionstatechange",e.iceConnectionState);const s=e.iceConnectionState;switch(this.player.emit(nt.webrtcOnIceConnectionStateChange,s),this.isDisconnected="disconnected"===s,e.iceConnectionState){case"new":case"checking":case"closed":case"connected":case"completed":break;case"failed":t.emit(nt.webrtcFailed);break;case"disconnected":t.emit(nt.webrtcDisconnect);break;case"closed":t.emit(nt.webrtcClosed)}},e.onicecandidate=e=>{this.player.debug.log(this.TAG_NAME,"onicecandidate",e),e.candidate&&this.player.debug.log(this.TAG_NAME,"Remote ICE candidate: ",e.candidate.candidate)},e.ontrack=t=>{if(this.player.debug.log(this.TAG_NAME,"ontrack",t),"video"===t.track.kind){this.player.debug.log(this.TAG_NAME,"ontrack video"),this.rtcPeerTrackVideoReceiver=e.getReceivers().find((function(e){return e.track===t.track})),this.rtcPeerTrackVideoReceiver&&this._startBandwidthEstimateInterval();let i=t.streams[0];this.$videoElement.autoplay=!0,this.$videoElement.srcObject=i,this.videoStream=i}else"audio"===t.track.kind&&(this.player.debug.log(this.TAG_NAME,"ontrack audio"),this.rtcPeerTrackAudioReceiver=e.getReceivers().find((function(e){return e.track===t.track})),this.rtcPeerTrackAudioReceiver&&this._startBandwidthEstimateInterval())},e.onicecandidateerror=e=>{this.player.debug.log(this.TAG_NAME,"onicecandidateerror",e),this.player.emitError(ct.webrtcIceCandidateError,e)},e.onconnectionstatechange=i=>{switch(this.player.debug.log(this.TAG_NAME,"onconnectionstatechange",i),this.player.emit(nt.webrtcOnConnectionStateChange,e.connectionState),e.connectionState){case"new":case"connecting":case"connected":case"disconnected":break;case"failed":this.isDisconnected&&t.emit(nt.webrtcFailed)}},this.rtcPeerConnection=e}_startBandwidthEstimateInterval(){this.player.debug.log(this.TAG_NAME,"_startBandwidthEstimateInterval"),this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{this.rtcPeerTrackVideoReceiver&&this.rtcPeerTrackVideoReceiver.getStats().then((e=>{let t={},i=0;e.forEach((e=>{if(e)switch(e.type){case _r:("succeeded"===e.state||e.bytesReceived)&&(this.currentWebrtcStats.timestamp=e.timestamp,this.currentWebrtcStats.rtt=e.currentRoundTripTime||-1,this.currentWebrtcStats.bytesReceived=e.bytesReceived||0,this.currentWebrtcStats.bytesSent=e.bytesSent||0);break;case Er:this.currentWebrtcStats.remoteCandidate=e||{};break;case wr:this.currentWebrtcStats.localCandidate=e||{};break;case Sr:this.currentWebrtcStats.lastTimeStamp=e.timestamp;const s=((e.timestamp||0)-(this.prevWebrtcVideoStats.timestamp||0))/1e3,r=Number(e.bytesReceived||0)-Number(this.prevWebrtcVideoStats.bytesReceived||0),a=Math.floor(r/s);i+=a,t.vbps=a,this.prevWebrtcVideoStats=e;break;case Tr:e.frameWidth&&e.frameHeight&&(this.currentWebrtcStats.frameWidth=e.frameWidth||0,this.currentWebrtcStats.frameHeight=e.frameHeight||0)}})),this.rtcPeerTrackAudioReceiver?this.rtcPeerTrackAudioReceiver.getStats().then((e=>{e.forEach((e=>{if(e&&e.type===Sr){this.currentWebrtcStats.lastTimeStamp=e.timestamp;const s=((e.timestamp||0)-(this.prevWebrtcAudioStats.timestamp||0))/1e3,r=Number(e.bytesReceived||0)-Number(this.prevWebrtcAudioStats.bytesReceived||0),a=Math.floor(r/s);i+=a,t.abps=a,this.prevWebrtcAudioStats=e}})),this.player.updateStats(t),this.player.emit(nt.kBps,(i/1024).toFixed(2))})):(this.player.updateStats(t),this.player.emit(nt.kBps,(i/1024).toFixed(2)))}))}),1e3)}_stopBandwidthEstimateInterval(){this.player.debug.log(this.TAG_NAME,"_stopBandwidthEstimateInterval"),this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}_startCanvasRender(){bo()?this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)):(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:0})}),40))}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player.isDestroyedOrClosed()?this.player.debug.log(this.TAG_NAME,"videoFrameCallback() player is destroyed"):(this.player.video.render({$video:this.$videoElement,ts:t.mediaTime||0}),this.player.updateStats({dts:t.mediaTime||0}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)))}_initRenderSize(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}}class Nb extends Ob{constructor(e){super(e),this.rtcPeerConnectionDataChannel=null,this.player.isWebrtcH265()&&(this.streamRate=ha((t=>{e.emit(nt.kBps,(t/1024).toFixed(2))}))),this.TAG_NAME="WebrtcForM7SDecoder",this.player.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.stopStreamRateInterval(),this.rtcPeerConnectionDataChannel&&(this.rtcPeerConnectionDataChannel.onopen=ta,this.rtcPeerConnectionDataChannel.onclose=ta,this.rtcPeerConnectionDataChannel.onmessage=ta,this.rtcPeerConnectionDataChannel.close(),this.rtcPeerConnectionDataChannel=null),this.player.debug.log(this.TAG_NAME,"destroy")}_initRtcPeerConnection(){const e=new RTCPeerConnection,t=this.player;e.addTransceiver("video",{direction:"recvonly"}),e.addTransceiver("audio",{direction:"recvonly"}),e.onsignalingstatechange=e=>{this.player.debug.log(this.TAG_NAME,"onsignalingstatechange",e)},e.oniceconnectionstatechange=i=>{this.player.debug.log(this.TAG_NAME,"oniceconnectionstatechange",e.iceConnectionState);const s=e.iceConnectionState;switch(this.player.emit(nt.webrtcOnIceConnectionStateChange,s),this.isDisconnected="disconnected"===s,e.iceConnectionState){case"new":case"checking":case"closed":case"connected":case"completed":break;case"failed":t.emit(nt.webrtcFailed);break;case"disconnected":t.emit(nt.webrtcDisconnect);break;case"closed":t.emit(nt.webrtcClosed)}},e.onicecandidate=e=>{this.player.debug.log(this.TAG_NAME,"onicecandidate",e),e.candidate&&this.player.debug.log(this.TAG_NAME,"Remote ICE candidate: ",e.candidate.candidate)},e.ontrack=i=>{this.player.debug.log(this.TAG_NAME,"ontrack",i);const s=t.video.$videoElement;if(t.isWebrtcH264())if("video"===i.track.kind){this.player.debug.log(this.TAG_NAME,"ontrack video"),this.rtcPeerTrackVideoReceiver=e.getReceivers().find((function(e){return e.track===i.track})),this.rtcPeerTrackVideoReceiver&&this._startBandwidthEstimateInterval();let t=i.streams[0];s.autoplay=!0,s.srcObject=t,this.videoStream=t}else"audio"===i.track.kind&&(this.player.debug.log(this.TAG_NAME,"ontrack audio"),this.rtcPeerTrackAudioReceiver=e.getReceivers().find((function(e){return e.track===i.track})),this.rtcPeerTrackAudioReceiver&&this._startBandwidthEstimateInterval())},e.onicecandidateerror=e=>{this.player.debug.log(this.TAG_NAME,"onicecandidateerror",e),this.player.emitError(ct.webrtcIceCandidateError,e)},e.onconnectionstatechange=i=>{switch(t.debug.log(this.TAG_NAME,`sdp connect status ${e.connectionState}`),e.connectionState){case"new":case"connecting":case"connected":case"disconnected":break;case"failed":this.isDisconnected&&t.emit(nt.webrtcFailed)}},e.ondatachannel=e=>{const t=e.channel;this.player.debug.log(this.TAG_NAME,"ondatachannel"),t.onopen=()=>{this.player.debug.log(this.TAG_NAME,"ondatachannel and onopen")},t.onmessage=e=>{const t=e.data;if(this.player.isWebrtcH264())return this.player.debug.warn(this.TAG_NAME,"ondatachannel is H265 but decode is h264 so emit webrtcStreamH265 "),void this.player.emit(nt.webrtcStreamH265);this.player.isDestroyedOrClosed()?this.player.debug.warn(this.TAG_NAME,"ondatachannel and player is destroyed"):(this.streamRate&&this.streamRate(t.byteLength),this.player.demux&&this.player.demux.dispatch(t))},t.onclose=()=>{this.player.debug.warn(this.TAG_NAME,"ondatachannel and onclose")},this.rtcPeerConnectionDataChannel=t};e.createDataChannel("signal").onmessage=e=>{this.player.debug.log(this.TAG_NAME,"signalChannel,onmessage",e);JSON.parse(e.data).type},this.rtcPeerConnection=e}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}loadSource(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{const r=this.rtcPeerConnection;r.createOffer().then((a=>{r.setLocalDescription(a),this.player.debug.log(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t,i){let s={"Content-Type":"application/sdp"};return i.username&&i.password&&(s.Authorization="Basic "+btoa(i.username+":"+i.password)),fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:s,body:t})}(e,a.sdp,t).then((e=>{e.text().then((e=>{this.player.debug.log(this.TAG_NAME,"getWebRtcRemoteSdp response"),e?r.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then((()=>{this.player.isWebrtcH265()&&this.startStreamRateInterval(),i()})).catch((e=>{s(e)})):s("sdp is null")})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource response.text() error",e),s(e)}))})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e),s(e)}))})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e),s(e)}))}))}}class jb extends Ob{constructor(e){super(e),this.TAG_NAME="WebrtcForZLMDecoder",this.player.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debug.log(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debug.log(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return bl({url:e,type:"POST",data:t,contentType:"text/plain;charset=utf-8",processData:!1,dataType:"json"})}(e,r.sdp).then((e=>{this.player.debug.log(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`);const r=e;if(r&&0!==r.code)return i(r.msg);r&&r.sdp?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:r.sdp})).then((()=>{t()})).catch((e=>{i(e)})):i("sdp is null")})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e),i(e)}))})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e),i(e)}))}))}}class zb extends So{constructor(e,t){if(super(),this.player=e,this.player.$container.classList.add("jb-pro-container-playback"),this._showPrecision=null,this._startTime=null,this._playStartTime=null,this._playingTimestamp=null,this._fps=parseInt(t.fps,10)||e._opt.playbackFps,this._isUseFpsRender=!!uo(t.isUseFpsRender),this._rate=1,this._audioTimestamp=0,this._videoTimestamp=0,this.controlType=t.controlType||Q.normal,t.controlType&&-1===[Q.normal,Q.simple].indexOf(t.controlType)&&(this.player.debug.warn("Playback","constructor()","controlType is not in [normal,simple]",t.controlType),this.controlType=Q.normal),this._currentLocalTimestamp=0,this._localOneFrameTimestamp=t.localOneFrameTimestamp||40,this._localCalculateTimeInterval=null,this._isUseLocalCalculateTime=!!uo(t.isUseLocalCalculateTime),this._isPlaybackPauseClearCache=!po(t.isPlaybackPauseClearCache),this._isCacheBeforeDecodeForFpsRender=!!uo(t.isCacheBeforeDecodeForFpsRender),this._startfpsTime=null,this._startFpsTimestamp=null,this._checkStatsInterval=null,this._playbackTs=0,this._renderFps=0,this._isUseLocalCalculateTime?this._startLocalCalculateTime():this._listen(),this.playbackList=[],this._playbackListStartTimestamp=null,this._totalDuration=0,t.controlType===Q.normal)this.initPlaybackList(t.playList,t.showPrecision,t.startTime);else if(t.controlType===Q.simple){t.duration&&(this._totalDuration=1e3*t.duration);let e=t.startTime||0;e>this.totalDuration&&(e=this.totalDuration),this.setStartTime(e)}this.player.on(nt.playbackPause,(e=>{e?this.pause():this.resume()}));const i={fps:this._fps,isUseFpsRender:this._isUseFpsRender,localOneFrameTimestamp:this._localOneFrameTimestamp,isUseLocalCalculateTime:this._isUseLocalCalculateTime,uiUsePlaybackPause:t.uiUsePlaybackPause,showControl:t.showControl};e.debug.log("Playback","init",JSON.stringify(i))}destroy(){this._startTime=null,this._showPrecision=null,this._playStartTime=null,this._playingTimestamp=null,this._totalDuration=0,this._audioTimestamp=0,this._videoTimestamp=0,this._fps=null,this._isUseFpsRender=!1,this._rate=1,this.playbackList=[],this._playbackListStartTimestamp=null,this._localCalculateTimeInterval=null,this._currentLocalTimestamp=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._renderFps=0,this._playbackTs=0,this._stopLocalCalculateTime(),this.clearStatsInterval(),this.player.$container&&this.player.$container.classList.remove("jb-pro-container-playback"),this.off(),this.player.debug.log("Playback","destroy")}_listen(){this.player.on(nt.stats,(e=>{const t=e.ts;this._playStartTime||(this._playStartTime=t-1e3);let i=t-this._playStartTime;this.setPlayingTimestamp(i)}))}pause(){this.clearStatsInterval()}resume(){this.startCheckStatsInterval()}updateStats(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._startFpsTimestamp||(this._startFpsTimestamp=aa()),Ba(e.ts)&&(this.player.updateStats({fps:!0,ts:e.ts}),this._playbackTs=e.ts,this._startfpsTime||(this._startfpsTime=e.ts),this._renderFps+=1);const t=aa(),i=t-this._startFpsTimestamp;if(i<1e3)return;let s=null;this._startfpsTime&&(s=this._playbackTs-this._startfpsTime),this.player.emit(nt.playbackStats,{fps:this._renderFps,rate:this.rate,start:this._startfpsTime,end:this._playbackTs,timestamp:i,dataTimestamp:s,audioBufferSize:this.player.audio?this.player.audio.bufferSize:0,videoBufferSize:this.player.video?this.player.video.bufferSize:0,ts:this._playbackTs}),this._renderFps=0,this._startfpsTime=this._playbackTs,this._startFpsTimestamp=t}updateLocalOneFrameTimestamp(e){this._localOneFrameTimestamp=e}_startLocalCalculateTime(){this._stopLocalCalculateTime(),this._localCalculateTimeInterval=setInterval((()=>{const e=this._currentLocalTimestamp;this._playStartTime||(this._playStartTime=e-1e3);let t=e-this._playStartTime;this.setPlayingTimestamp(t)}),1e3)}startCheckStatsInterval(){this.clearStatsInterval(),this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}_stopLocalCalculateTime(){this._localCalculateTimeInterval&&(clearInterval(this._localCalculateTimeInterval),this._localCalculateTimeInterval=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}increaseLocalTimestamp(){this._isUseLocalCalculateTime&&(this._currentLocalTimestamp+=this._localOneFrameTimestamp)}initPlaybackList(e,t,i){this.playbackList=e||[];let s=0;if(this.playbackList.forEach(((e,t)=>{10===Ga(e.start)&&(e.startTimestamp=1e3*e.start,e.startTime=ba(e.startTimestamp)),10===Ga(e.end)&&(e.endTimestamp=1e3*e.end,e.endTime=ba(e.endTimestamp)),e.duration=e.end-e.start,s+=e.duration})),this._totalDuration=s,this.player.debug.log("Playback",this.playbackList),this.playbackList.length>0){const e=this.playbackList[0].startTimestamp;this._playbackListStartTimestamp=e;let t=e;i&&(10===Ga(i)&&(i*=1e3),this._isTimeInPlaybackList(i)&&(t=i)),this.setStartTime(t)}const r=t||Si;this.setShowPrecision(r)}get totalDuration(){return(this._totalDuration||0)/1e3}get startTime(){return this._startTime||0}setStartTime(e){this._startTime=e,this._playingTimestamp=e,this._playStartTime=null}setRate(e){this._rate=e,this.player.emit(nt.playbackRateChange,e)}get fps(){return this._fps}get rate(){return this._rate}get isUseFpsRender(){return this._isUseFpsRender}get isUseLocalCalculateTime(){return this._isUseLocalCalculateTime}get showPrecision(){return this._showPrecision}get is60Min(){return this.showPrecision===Si}get is30Min(){return this.showPrecision===wi}get is10Min(){return this.showPrecision===Ei}get is5Min(){return this.showPrecision===Ti}get is1Min(){return this.showPrecision===Ti}get isPlaybackPauseClearCache(){return this._isPlaybackPauseClearCache}get isCacheBeforeDecodeForFpsRender(){return this._isCacheBeforeDecodeForFpsRender}setShowPrecision(e){Ci.includes(e)||(this.player.debug.warn("Playback","setShowPrecision()","type is not in PLAYBACK_CONTROL_TIME_PRECISION_ARRAY",e),e=Si),this._showPrecision&&this._showPrecision===e||(this._showPrecision=e,this.player.emit(nt.playbackPrecision,this._showPrecision,this.playbackList),this.player.emit(nt.playbackShowPrecisionChange,this._showPrecision))}setPlayingTimestamp(e){let t;if(this.controlType===Q.normal){t=this.startTime+e,this._playingTimestamp=t,this.player.emit(nt.playbackTime,t);const i=new Date(t);this.player.emit(nt.playbackTimestamp,{ts:t,hour:i.getHours(),min:i.getMinutes(),second:i.getSeconds()})}else this.controlType===Q.simple&&(t=this.startTime+Math.round(e/1e3),t>this.totalDuration&&(this.player.debug.log("Playback","setPlayingTimestamp()",`timestamp ${t} > this.totalDuration ${this.totalDuration}`),t=this.totalDuration),this._playingTimestamp=t,this.player.emit(nt.playbackTime,t),this.player.emit(nt.playbackTimestamp,{ts:t}))}get playingTimestamp(){return this._playingTimestamp}narrowPrecision(){const e=Ci.indexOf(this.showPrecision)-1;if(e>=0){const t=Ci[e];this.setShowPrecision(t)}}expandPrecision(){const e=Ci.indexOf(this.showPrecision)+1;if(e<=Ci.length-1){const t=Ci[e];this.setShowPrecision(t)}}seek(e){if(this.player.debug.log("Playback","seek()",e),this.controlType===Q.normal){if("true"===e.hasRecord){let t=e.time;"min"===e.type&&(t=60*e.time);let i=function(e){let t={};e>-1&&(t={hour:Math.floor(e/60/60)%60,min:Math.floor(e/60)%60,second:e%60});return t}(t);if(this._playbackListStartTimestamp){const e=new Date(this._playbackListStartTimestamp).setHours(i.hour,i.min,i.second,0);i.timestamp=e;const t=this._findMoreInfoByTimestamp(e);i&&t.more&&(i.more=t.more)}this.player.emit(nt.playbackSeek,i)}}else if(this.controlType===Q.simple){let t=e.time;this.player.emit(nt.playbackSeek,{ts:t})}}currentTimeScroll(){this.player.emit(nt.playbackTimeScroll)}_findMoreInfoByTimestamp(e){let t=null;return this.playbackList.forEach(((i,s)=>{i.startTimestamp<=e&&i.endTimestamp>=e&&(t=i)})),t}_isTimeInPlaybackList(e){let t=!1;return this.playbackList.forEach(((i,s)=>{i.startTimestamp<=e&&i.endTimestamp>=e&&(t=!0)})),t}getControlType(){return this.controlType}isControlTypeNormal(){return this.controlType===Q.normal}isControlTypeSimple(){return this.controlType===Q.simple}}class Gb extends So{constructor(e){super(),this.player=e,this.TAG_NAME="zoom",this.bindEvents=[],this.isDragging=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.maxScale=5,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0};const{events:{proxy:t},debug:i}=this.player;this.player.on(nt.zooming,(e=>{if(e){this.player.$container.classList.add("jb-pro-zoom-control"),this._bindEvents();const e=this.player.video.$videoElement.style.transform;let t=this.player.video.$videoElement.offsetLeft,i=this.player.video.$videoElement.offsetTop;t=parseFloat(t),i=parseFloat(i),t&&(this.videoPosition.left=t),i&&(this.videoPosition.top=i),this.prevVideoElementStyleTransform=e;let s=e.match(/scale\([0-9., ]*\)/g);if(s&&s[0]){let e=s[0].replace("scale(","").replace(")","");this.prevVideoElementStyleScale=e.split(",")}}else{this.player.$container.classList.remove("jb-pro-zoom-control"),this._unbindEvents(),this._resetVideoPosition(),this.player.$container.style.cursor="auto";let e=this.prevVideoElementStyleTransform;this.player.video.$videoElement.style.transform=e,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,ua()&&this.player._opt.useWebFullScreen&&this.player.resize()}}));const s=t(window,ua()?"touchend":"mouseup",(e=>{this.handleMouseUp(e)}));this.bindEvents.push(s),e.debug.log("zoom","init")}destroy(){this.bindEvents=[],this.isDragging=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.off(),this.player.debug.log("zoom","destroy")}_bindEvents(){const{events:{proxy:e},debug:t}=this.player,i=e(this.player.$container,ua()?"touchmove":"mousemove",(e=>{this.handleMouseMove(e)}));this.bindEvents.push(i);const s=e(this.player.$container,ua()?"touchstart":"mousedown",(e=>{this.handleMouseDown(e)}));this.bindEvents.push(s);const r=e(window,ua()?"touchend":"mouseup",(e=>{this.handleMouseUp(e)}));this.bindEvents.push(r)}_unbindEvents(){this.bindEvents.forEach((e=>{e&&e()}))}handleMouseMove(e){if(e.stopPropagation(),this.isDragging&&this.player.zooming){e.preventDefault();const{posX:t,posY:i}=Qa(e),s=this.tempPosition.x-t,r=this.tempPosition.y-i;this.videoPosition.left=this.videoPosition.left-s,this.videoPosition.top=this.videoPosition.top-r,this.tempPosition.x=t,this.tempPosition.y=i,this.updateVideoPosition()}}handleMouseDown(e){e.stopPropagation();const t=qa(e);if(this.player.zooming&&(t.matches("video")||t.matches("canvas"))){e.preventDefault();const{posX:t,posY:i}=Qa(e);this.player.$container.style.cursor="grabbing",this.tempPosition.x=t,this.tempPosition.y=i,this.isDragging=!0,this.player.debug.log("zoom","handleMouseDown is dragging true")}}handleMouseUp(e){e.stopPropagation(),this.isDragging&&this.player.zooming&&(e.preventDefault(),this.tempPosition={x:0,y:0},this.isDragging=!1,this.player.$container.style.cursor="grab",this.player.debug.log("zoom","handleMouseUp is dragging false"))}updateVideoPosition(){const e=this.player.video.$videoElement;e.style.left=this.videoPosition.left+"px",e.style.top=this.videoPosition.top+"px"}_resetVideoPosition(){this.player.resize(),this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.currentZoom=1,this.isDragging=!1}narrowPrecision(){this.currentZoom<=1||(this.currentZoom-=1,this.updateVideoElementScale())}expandPrecision(){this.currentZoom>=this.maxScale||(this.currentZoom+=1,this.updateVideoElementScale())}updatePrevVideoElementStyleScale(e){this.prevVideoElementStyleScale=e}updateVideoElementScale(){const e=this.player.video.$videoElement;let t=e.style.transform,i=1,s=1;if(this.prevVideoElementStyleScale){const e=this.prevVideoElementStyleScale[0];void 0!==e&&(i=e,s=e);const t=this.prevVideoElementStyleScale[1];void 0!==t&&(s=t)}s=_a(s),i=_a(i);const r=.5*i*(this.currentZoom-1)+i,a=.5*s*(this.currentZoom-1)+s;let o;o=-1===t.indexOf("scale(")?t+` scale(${r},${a})`:t.replace(/scale\([0-9., ]*\)/,`scale(${r},${a})`),this.player.debug.log("zoom",`updateVideoElementScale end is ${r}, ${a} style is ${o}`),e.style.transform=o}}class Hb extends So{constructor(e){super(),this.player=e,this.faceDetector=null,this.objectDetector=null,this.imageDetector=null,this.occlusionDetector=null,this.initFaceDetector(),this.initObjectDetector(),this.initImageDetector(),this.initOcclusionDetector();let t="init";this.faceDetector&&(t+=" and use faceDetector"),this.objectDetector&&(t+=" and use objectDetector"),this.imageDetector&&(t+=" and use imageDetector"),this.occlusionDetector&&(t+=" and use occlusionDetector"),this.player.debug.log("AiLoader",t)}destroy(){this.off(),this.faceDetector&&(this.faceDetector.destroy(),this.faceDetector=null),this.objectDetector&&(this.objectDetector.destroy(),this.objectDetector=null),this.imageDetector&&(this.imageDetector.destroy(),this.imageDetector=null),this.occlusionDetector&&(this.occlusionDetector.destroy(),this.occlusionDetector=null),this.player.debug.log("AiLoader","destroy")}initFaceDetector(){if(this.player._opt.useFaceDetector&&window.JessibucaProFaceDetector){const e=new JessibucaProFaceDetector({detectWidth:this.player._opt.aiFaceDetectWidth,showRect:!1,debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debug.log("AiLoader","init face detector success"),this.faceDetector=e,this.faceDetector.on("jessibuca-pro-face-detector-info",(e=>{if(this.player.emit(nt.aiFaceDetectorInfo,e),this.player._opt.aiFaceDetectShowRect){const t=this.player._opt.aiFaceDetectRectConfig||{},i=(e.list||[]).map((e=>(e.type="rect",e.color=t.borderColor||"#0000FF",e.lineWidth=t.borderWidth||2,e)));this.player.video&&this.player.video.addAiContentToCanvas(i)}}))}))}}initObjectDetector(){if(this.player._opt.useObjectDetector&&window.JessibucaProObjectDetector){const e=new JessibucaProObjectDetector({detectWidth:this.player._opt.aiObjectDetectWidth,showRect:!1,debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debug.log("AiLoader","init object detector success"),this.objectDetector=e,this.objectDetector.on("jessibuca-pro-object-detector-info",(e=>{if(this.player.emit(nt.aiObjectDetectorInfo,e),this.player._opt.aiObjectDetectShowRect){const t=[],i=this.player._opt.aiObjectDetectRectConfig||{};(e.list||[]).forEach((e=>{const s={type:"rect",color:i.borderColor||"#0000FF",lineWidth:i.borderWidth||2,x:e.rect.x,y:e.rect.y,width:e.rect.width,height:e.rect.height},r={type:"text",color:i.color||"#000",fontSize:i.fontSize||14,text:e.zh,x:e.rect.x,y:e.rect.y-25};t.push(s,r)})),this.player.video&&this.player.video.addAiContentToCanvas(t)}}))}))}}initImageDetector(){if(this.player._opt.useImageDetector&&window.JessibucaProImageDetector){const e=new JessibucaProImageDetector({debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debug.log("AiLoader","init image detector success"),this.imageDetector=e}))}}initOcclusionDetector(){if(this.player._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector){const e=new JessibucaProOcclusionDetector({debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debug.log("AiLoader","init occlusion detector success"),this.occlusionDetector=e}))}}updateFaceDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.faceDetector&&this.faceDetector.updateConfig(e)}updateObjectDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.objectDetector&&this.objectDetector.updateConfig(e)}updateImageDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.imageDetector&&this.imageDetector.updateConfig(e)}updateOcclusionDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.occlusionDetector&&this.occlusionDetector.updateConfig(e)}}class Vb extends So{constructor(e){super(),this.player=e,this.LOG_NAME="Contextmenu",this.menuList=[],this.$contextmenus=e.control.$contextmenus,ua()?this.player.debug.warn(this.LOG_NAME,"not support mobile"):this.init(),e.debug.log(this.LOG_NAME,"init")}destroy(){this.menuList=[],this.player.debug.log(this.LOG_NAME,"destroy")}get isShow(){return e=this.player.$container,t="jb-pro-contextmenus-show",e.classList.contains(t);var e,t}show(){Ch(this.player.$container,"jb-pro-contextmenus-show")}hide(){var e,t;e=this.player.$container,t="jb-pro-contextmenus-show",e.classList.remove(t)}init(){const{events:{proxy:e},debug:t}=this.player;this.player._opt.contextmenuBtns.length>0&&this.player._opt.contextmenuBtns.forEach((e=>{this.addMenuItem(e)})),e(this.player.$container,"contextmenu",(e=>{e.preventDefault(),this.show();const t=e.clientX,i=e.clientY,{height:s,width:r,left:a,top:o}=this.player.$container.getBoundingClientRect(),{height:n,width:l}=this.$contextmenus.getBoundingClientRect();let d=t-a,h=i-o;t+l>a+r&&(d=r-l),i+n>o+s&&(h=s-n),na(this.$contextmenus,{left:`${d}px`,top:`${h}px`})})),e(this.player.$container,"click",(e=>{Dh(e,this.$contextmenus)||this.hide()})),this.player.on(nt.blur,(()=>{this.hide()}))}_validateMenuItem(e){let t=!0;return e.content||(this.player.debug.warn(this.LOG_NAME,"content is required"),t=!1),t}addMenuItem(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=no(Ns);if(e=Object.assign({},t,e),!this._validateMenuItem(e))return;const{events:{proxy:i},debug:s}=this.player,r=Sa(),a=`\n
\n ${e.content}\n
\n `,o=Array.from(this.$contextmenus.children)[e.index];o?o.insertAdjacentHTML("beforebegin",a):xh(this.$contextmenus,a);const n=this.$contextmenus.querySelector(`.jb-pro-contextmenu-${r}`);e.click&&i(n,"click",(t=>{t.preventDefault(),e.click.call(this.player,this,t),this.hide()})),this.menuList.push({uuid:r,$menuItem:n})}}class $b extends Ob{constructor(e){super(e),this.TAG_NAME="WebrtcForSRSDecoder",this.player.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debug.log(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debug.log(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:t})}(e,r.sdp).then((e=>{this.player.debug.log(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`);const r=e;if(r&&0!==r.code)return i(r.msg);r?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:r})).then((()=>{t()})).catch((e=>{i(e)})):i("sdp is null")})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e),i(e)}))})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e),i(e)}))}))}}class Wb extends Ob{constructor(e){super(e),this.TAG_NAME="WebrtcForOthersDecoder",this.player.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debug.log(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debug.log(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:t})}(e,r.sdp).then((e=>{this.player.debug.log(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`),e.text().then((e=>{this.player.debug.log(this.TAG_NAME,"getWebRtcRemoteSdp response");try{let t=JSON.parse(e);this.player.debug.log(this.TAG_NAME,"this is json sdp response"),0!=t.code&&(this.player.debug.log(this.TAG_NAME,`response json code ${t.code}`),i(new Error(`response sdp json code: ${t.code}`))),e=t.sdp}catch(e){this.player.debug.log(this.TAG_NAME,"this is raw sdp response")}e?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then((()=>{t()})).catch((e=>{i(e)})):i("sdp is null")})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource response.text() error",e),i(e)}))})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e),i(e)}))})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e),i(e)}))}))}}class Jb extends So{constructor(e){if(super(),this.TAG_NAME="AliyunRtc",this.player=e,!window.AliRTS)throw new Error("AliyunRtc is not defined");this.aliyunRtc=window.AliRTS.createClient(),this.aliyunRtcRemoteStream=null,this.$videoElement=this.player.video.$videoElement,this.listenEvents(),this.player.debug.log(this.TAG_NAME,"init")}destroy(){this.aliyunRtc&&(this.aliyunRtcRemoteStream&&(this.aliyunRtcRemoteStream=null),this.aliyunRtc.unsubscribe(),this.aliyunRtc=null),this.off(),this.player.debug.log(this.TAG_NAME,"destroy")}listenEvents(){this.aliyunRtc.on("onError",(e=>{this.player.debug.log(this.TAG_NAME,`onError and code is ${e.errorCode} and message: ${e.message}`),10400!==e.errorCode&&(this.player.debug.error(this.TAG_NAME,`onError and code is ${e.errorCode} and message: ${e.message}`),this.player.emitError(ct.aliyunRtcError,e))})),this.aliyunRtc.on("reconnect",(e=>{this.player.debug.log(this.TAG_NAME,"reconnect",e)}));const e="canplay",t="waiting",i="playing",s="media";this.aliyunRtc.on("onPlayEvent",(r=>{if(r.event===e)this.player.debug.log(this.TAG_NAME,"onPlayEvent and canplay");else if(r.event===t)this.player.debug.log(this.TAG_NAME,"onPlayEvent and playing - > waiting");else if(r.event===i)this.player.debug.log(this.TAG_NAME,"onPlayEvent and waiting -> playing");else if(r.event===s){const e=r.data;let t={},i=0;if(e.audio){const s=Math.floor(e.audio.bytesReceivedPerSecond);i+=s,t.abps=s}if(e.video){const s=Math.floor(e.video.bytesReceivedPerSecond);i+=s,t.vbps=s}this.player.updateStats(t),this.player.emit(nt.kBps,(i/1024).toFixed(2))}}))}loadSource(e){return new Promise(((t,i)=>{this.aliyunRtc.isSupport({isReceiveVideo:!0}).then((()=>{this.aliyunRtc.subscribe(e,{}).then((e=>{this.aliyunRtcRemoteStream=e,e.play(this.$videoElement),t()})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource and subscribe is not success: ",e.message),i(e.message)}))})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource and is not support: ",e.message),i(e.message)}))}))}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}}class qb{constructor(e){this.player=e,this.TAG_NAME="PressureObserverCpu",this.observer=null,this.latestCpuInfo=null,this.currentLevel=-1,this._init(),this.player.debug.log(this.TAG_NAME,"init")}destroy(){this.observer&&(this.observer.disconnect(),this.observer=null),this.latestCpuInfo=null,this.currentLevel=-1,this.player.debug.log(this.TAG_NAME,"destroy")}getCurrentCpuState(){return this.currentLevel}_init(){po(vo())?this.player.debug.log(this.TAG_NAME,"not support PressureObserver"):(this.observer=new PressureObserver((e=>{const t=(e||[]).find((e=>"cpu"===e.source));if(t){switch(this.latestCpuInfo=t,t.state){case"nominal":this.currentLevel=0;break;case"fair":this.currentLevel=1;break;case"serious":this.currentLevel=2;break;case"critical":this.currentLevel=3;break;default:this.currentLevel=-1}this.player.emit(nt.pressureObserverCpu,this.currentLevel)}})),this.observer&&this.observer.observe("cpu"))}}class Kb extends Po{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e),this.TAG_NAME="DynamicWatermark",this.isPauseAnimation=!1,this.isStopAnimation=!1,this.rafID=null,this.speed=t.speed||.2,this.isDynamic=!0,this.shadowRootDynamicDom=null,this.isGhost=!0===t.isGhost,this.ghostConfig={on:t.on||5,off:t.off||5},this.waterMarkWillRemove=!1,this.waterMarkWillAdd=!1,this.player.once(nt.start,(()=>{const e=t.content;let i=this.player.getVideoInfo();i||(i={width:200,height:200}),this.update({text:{content:e,fontSize:t.fontSize||18,color:t.color||"white"},left:i.width*Math.random(),top:i.height*Math.random(),opacity:t.opacity||.15}),this.startAnimation()})),this.player.debug.log(this.TAG_NAME,"int")}destroy(){super.destroy(),this.shadowRootDynamicDom=null,this.stopAnimation(),this.rafID&&(cancelAnimationFrame(this.rafID),this.rafID=null)}startAnimation(){if(!this.rafID){let e=1,t=1,i=Math.random(),s={width:0,height:0};const r=()=>{try{if(po(this.isPauseAnimation)&&this.shadowRootDynamicDom&&this.shadowRootInnerDom){const a=this.shadowRootInnerDom,o=this.shadowRootDynamicDom,n=a.getBoundingClientRect(),l=o.getBoundingClientRect();if(l.width&&l.height&&(s.width=l.width,s.height=l.height),!this.shadowRootInnerDom.contains(this.shadowRootDynamicDom))return this.isGhost?po(this.waterMarkWillAdd)&&(this.waterMarkWillAdd=!0,setTimeout((()=>{this._addDom(n,s),this.waterMarkWillAdd=!1}),1e3*this.ghostConfig.off)):this._addDom(n,s),void(0!==this.speed&&requestAnimationFrame(r));const d=Math.min(1,0===this.speed?0:this.speed?this.speed:.2);let h=l.left-n.left,c=l.top-n.top;h+=d*t*i,c+=d*e*(1-i),h+s.width>n.width?(t=-1,i=Math.random()):h<0&&(t=1,i=Math.random()),c+s.height>n.height?(e=-1,i=Math.random()):c<0&&(e=1,i=Math.random()),h=Math.min(n.width-s.width,h),c=Math.min(n.height-s.height,c);const u=h/n.width*100,p=c/n.height*100;this.shadowRootDynamicDom.style.left=`${u}%`,this.shadowRootDynamicDom.style.top=`${p}%`,po(this.waterMarkWillRemove)&&this.isGhost&&(this.waterMarkWillRemove=!0,setTimeout((()=>{this._removeDom(),this.waterMarkWillRemove=!1}),1e3*this.ghostConfig.on))}}catch(e){}if(this.isStopAnimation)return this.isStopAnimation=!1,cancelAnimationFrame(this.rafID),void(this.rafID=null);0!==this.speed&&requestAnimationFrame(r)};this.rafID=requestAnimationFrame(r)}}_addDom(e,t){if(this.shadowRootInnerDom&&this.shadowRootDynamicDom){this.shadowRootInnerDom.appendChild(this.shadowRootDynamicDom);let i=e.width*Math.random(),s=e.height*Math.random();i=Math.min(e.width-2*t.width,i),s=Math.min(e.height-2*t.height,s),this.shadowRootDynamicDom.style.left=`${i}px`,this.shadowRootDynamicDom.style.top=`${s}px`}}resumeAnimation(){this.isPauseAnimation=!1}pauseAnimation(){this.isPauseAnimation=!0}stopAnimation(){this.isStopAnimation=!0}}class Yb extends So{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this._opt={},this.TAG_NAME="Player",this.$container=e;const i=ho();if(this._opt=Object.assign({},i,t),this.debug=new Pr(this),this.debug.log(this.TAG_NAME,"init"),this._opt.forceNoOffscreen=!0,this._canPlayAppleMpegurl=!1,(Aa()||ya())&&(this._canPlayAppleMpegurl=Xa(),this.debug.log(this.TAG_NAME,"isIOS or isSafari and canPlayAppleMpegurl",this._canPlayAppleMpegurl)),ua()&&(this.debug.log(this.TAG_NAME,"isMobile and set _opt.controlAutoHide false"),this._opt.controlAutoHide=!1,uo(Mr.isEnabled)&&uo(this._opt.useWebFullScreen)&&(this.debug.log(this.TAG_NAME,"screenfull.isEnabled is true and _opt.useWebFullScreen is true , set _opt.useWebFullScreen false"),this._opt.useWebFullScreen=!1),po(Mr.isEnabled)&&po(this._opt.useWebFullScreen)&&(this.debug.log(this.TAG_NAME,"screenfull.isEnabled is false and _opt.useWebFullScreen is false , set _opt.useWebFullScreen true"),this._opt.useWebFullScreen=!0)),mo()&&(this.debug.log(this.TAG_NAME,"isIphone and set _opt.videoRenderSupportScale false"),this._opt.videoRenderSupportScale=!1,Wa()&&uo(this._opt.isHls)&&po(this._opt.supportHls265)&&(this.debug.log(this.TAG_NAME,"isIphone and is in wechat and is hls so set supportHls265 true"),this._opt.supportHls265=!0)),po(this._opt.playFailedAndReplay)&&(this.debug.log(this.TAG_NAME,"_opt.playFailedAndReplay is false and set others replay params false"),this._opt.webglAlignmentErrorReplay=!1,this._opt.webglContextLostErrorReplay=!1,this._opt.autoWasm=!1,this._opt.mseDecodeErrorReplay=!1,this._opt.mediaSourceTsIsMaxDiffReplay=!1,this._opt.wcsDecodeErrorReplay=!1,this._opt.wasmDecodeErrorReplay=!1,this._opt.simdDecodeErrorReplay=!1,this._opt.videoElementPlayingFailedReplay=!1,this._opt.networkDelayTimeoutReplay=!1,this._opt.widthOrHeightChangeReplay=!1,this._opt.simdH264DecodeVideoWidthIsTooLargeReplay=!1,this._opt.mediaSourceUseCanvasRenderPlayFailedReplay=!1,this._opt.heartTimeoutReplay=!1,this._opt.loadingTimeoutReplay=!1,this._opt.websocket1006ErrorReplay=!1,this._opt.streamErrorReplay=!1,this._opt.streamEndReplay=!1),this._opt.hiddenControl&&(this.debug.log(this.TAG_NAME,"_opt.hiddenControl is true and set others show btn to false"),Object.keys(this._opt.operateBtns).forEach((e=>{this._opt.operateBtns[e]&&-1===(""+e).indexOf("Fn")&&(this._opt.operateBtns[e]=!1)})),this._opt.showBandwidth=!1,this._opt.extendOperateBtns=[],this._opt.controlHtml="",this.isPlayback()&&(this._opt.playbackConfig.showControl=!1)),this._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(this._opt.forceNoOffscreen=!0,this._opt.useOffscreen=!1):this._opt.useOffscreen=!0),this._opt.isMpeg4&&(this.debug.log(this.TAG_NAME,"isMpeg4 is true, so set _opt.useWasm true and others params false"),this._opt.useWCS=!1,this._opt.useMSE=!1,this._opt.isNakedFlow=!1,this._opt.useSIMD=!1,this._opt.isFmp4=!1,this._opt.useWasm=!0),this.isPlayback()&&(this._opt.mseDecoderUseWorker=!1),this._opt.poster&&(this._opt.background=this._opt.poster),po(this._opt.muted)&&(this._opt.isNotMute=!0),this._opt.mseDecoderUseWorker&&(this._opt.mseDecoderUseWorker=!!(self.Worker&&self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker),po(this._opt.mseDecoderUseWorker)&&this.debug.log(this.TAG_NAME,"mseDecoderUseWorker is true but not support so set _opt.mseDecoderUseWorker = false")),(this.isOldHls()||this.isWebrtcH264()||this.isAliyunRtc())&&(this.debug.log(this.TAG_NAME,"isOldHls or isWebrtcH264 or isAliyunRtc is true, so set some params false and _opt.recordType is webm"),this._opt.useWCS=!1,this._opt.useMSE=!1,this._opt.isNakedFlow=!1,this._opt.useSIMD=!1,this._opt.isFmp4=!1,this._opt.useWasm=!1,this._opt.recordType=w),this._opt.isNakedFlow&&(this.debug.log(this.TAG_NAME,"isNakedFlow is true, so set _opt.mseDecodeAudio false"),this._opt.mseDecodeAudio=!1),ma()&&(this.debug.log(this.TAG_NAME,"isFirefox is true, so set _opt.mseDecodeAudio false"),this._opt.mseDecodeAudio=!1),!this.isOldHls()&&!this.isWebrtcH264()){if(this._opt.useWCS){const e="VideoEncoder"in window,t=Ca();this._opt.useWCS=e,this._opt.useWCS&&this._opt.isH265&&(this._opt.useWCS=t),this._opt.useWCS||this.debug.warn(this.TAG_NAME,`\n useWCS is true,\n and supportWCS is ${e}, supportHevcWCS is ${t} , _opt.isH265 is ${this._opt.isH265}\n so set useWCS false`),this._opt.useWCS&&(this._opt.useOffscreen?this._opt.wcsUseVideoRender=!1:this._opt.wcsUseVideoRender&&(this._opt.wcsUseVideoRender=xa()&&Ra(),this._opt.wcsUseVideoRender||this.debug.warn(this.TAG_NAME,"wcsUseVideoRender is true, but not support so set wcsUseVideoRender false")))}if(this._opt.useMSE){const e=function(){let e=!1;return"MediaSource"in self&&(e=!0),e}()||function(){let e=!1;return!("MediaSource"in self)&&"ManagedMediaSource"in self&&(e=!0),e}(),t=ka()||function(){let e=!1;return!("MediaSource"in self)&&"ManagedMediaSource"in self&&(self.ManagedMediaSource.isTypeSupported(ci)||self.ManagedMediaSource.isTypeSupported(ui)||self.ManagedMediaSource.isTypeSupported(pi)||self.ManagedMediaSource.isTypeSupported(fi)||self.ManagedMediaSource.isTypeSupported(mi))&&(e=!0),e}();this._opt.useMSE=e,this._opt.useMSE&&this._opt.isH265&&(this._opt.useMSE=t),this._opt.useMSE||this.debug.warn(this.TAG_NAME,`\n useMSE is true,\n and supportMSE is ${e}, supportHevcMSE is ${t} , _opt.isH265 is ${this._opt.isH265}\n so set useMSE false`)}}if(po(this._opt.useMSE)&&(this._opt.mseDecodeAudio=!1),this._opt.useMSE?(this._opt.useWCS&&this.debug.warn(this.TAG_NAME,"useMSE is true and useWCS is true then useWCS set true->false"),this._opt.forceNoOffscreen||this.debug.warn(this.TAG_NAME,"useMSE is true and forceNoOffscreen is false then forceNoOffscreen set false->true"),this._opt.useWCS=!1,this._opt.forceNoOffscreen=!0):this._opt.useWCS,this._opt.isWebrtc&&this._opt.demuxUseWorker&&(this.debug.warn(this.TAG_NAME,"isWebrtc is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.isHls&&this._opt.demuxUseWorker&&(this.debug.warn(this.TAG_NAME,"isHls is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.isAliyunRtc&&this._opt.demuxUseWorker&&(this.debug.warn(this.TAG_NAME,"isAliyunRtc is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this.isStreamWebTransport()&&this._opt.demuxUseWorker&&(this.debug.warn(this.TAG_NAME,"is stream use webTransport is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),po(this._opt.demuxUseWorker)&&(this._opt.mseDecoderUseWorker=!1),this.isPlayback()&&(this._opt.mseDecoderUseWorker=!1),this._opt.useMThreading&&(this._opt.useMThreading="undefined"!=typeof SharedArrayBuffer,this._opt.useMThreading||this.debug.warn(this.TAG_NAME,"useMThreading is true, but not support so set useMThreading false")),this._opt.useSIMD||-1!==this._opt.decoder.indexOf("-simd")){const e=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),t=mo();this._opt.useSIMD=e&&po(t),this._opt.useSIMD||this.debug.warn(this.TAG_NAME,`useSIMD is true, but not support(isSupportSimd is ${e} ,isIphone is ${t}) so set useSIMD false`)}var s;if(this._opt.useSIMD?-1===this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-simd-mt.js"):this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-simd.js"):this._opt.useMThreading&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-simd-mt.js")):-1!==this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-mt.js"):this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro.js"):this._opt.useMThreading&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-mt.js")),-1!==this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-hard-not-wasm.js")):(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-hard-not-wasm.js")):this._opt.useMThreading?(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-hard-not-wasm.js")):(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro.js","decoder-pro-hard-not-wasm.js")),po(this._opt.hasAudio)&&(this._opt.operateBtns.audio=!1),po(this._opt.hasVideo)&&(this._opt.operateBtns.fullscreen=!1,this._opt.operateBtns.screenshot=!1,this._opt.operateBtns.record=!1,this._opt.operateBtns.ptz=!1,this._opt.operateBtns.quality=!1,this._opt.operateBtns.zoom=!1),this._opt.qualityConfig&&0===this._opt.qualityConfig.length&&this._opt.operateBtns.quality&&(this._opt.operateBtns.quality=!1,this.debug.warn(this.TAG_NAME,"_opt.qualityConfig is empty, so set operateBtns.quality false")),uo(this._opt.useWebGPU)&&(this._opt.useWebGPU=function(){let e=!1;return"gpu"in navigator&&(e=!0),e}(),po(this._opt.useWebGPU)&&this.debug.warn(this.TAG_NAME,"useWebGPU is true, but not support so set useWebGPU false")),this._opt.hasControl=this._hasControl(),this._loading=!1,this._playing=!1,this._playbackPause=!1,this._hasLoaded=!1,this._zooming=!1,this._destroyed=!1,this._closed=!1,this._checkHeartTimeout=null,this._checkLoadingTimeout=null,this._checkStatsInterval=null,this._checkVisibleHiddenTimeout=null,this._startBpsTime=null,this._isPlayingBeforePageHidden=!1,this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,currentPts:0,pTs:0,dts:0,mseVideoBufferDelayTime:0,isDropping:!1},this._allStatsData={},this._faceDetectActive=!1,this._objectDetectActive=!1,this._occlusionDetectActive=!1,this._imageDetectActive=!1,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this._videoTimestamp=0,this._audioTimestamp=0,this._latestAudioTimestamp=0,this._videoIframeIntervalTs=0,this._streamQuality=this._opt.defaultStreamQuality||"",!this._streamQuality&&this._opt.qualityConfig.length>0&&(this._streamQuality=this._opt.qualityConfig[0]||""),this._visibility=!0,this._lastestVisibilityChangeTimestamp=null,this._tempWorkerStats=null,this._historyFpsList=[],this._historyVideoDiffList=[],this._tempStreamList=[],this._tempInnerPlayBgobj=null,this._flvMetaData=null,this._flvMetaDataFps=null,this._mseWorkerData={},po(this._opt.useMSE)&&po(this._opt.useWCS)&&!this.isWebrtcH264()&&!this.isOldHls()&&(this._opt.useWasm=!0),(this.isOldHls()||this.isWebrtcH264())&&(this._opt.hasVideo=!0,this._opt.hasAudio=!0),this._opt.hasVideo||(this._opt.useMSE=!1,this._opt.useWCS=!1),this._opt.useWasm&&(this._opt.useOffscreen?this._opt.wasmUseVideoRender=!1:this._opt.wasmUseVideoRender&&(this._opt.wasmUseVideoRender=va()&&xa()&&Ra(),this._opt.wasmUseVideoRender||this.debug.warn(this.TAG_NAME,"use wasm video render, but not support so set wasmUseVideoRender false")),this._opt.useSIMD?this.debug.log(this.TAG_NAME,"use simd wasm"):this.debug.log(this.TAG_NAME,"use wasm")),this._opt.useWasm&&(this._opt.useFaceDetector&&window.JessibucaProFaceDetector||this._opt.useObjectDetector&&window.JessibucaProObjectDetector||this._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector||this._opt.useImageDetector&&window.JessibucaProImageDetector)?(this.ai=new Hb(this),this._opt.useFaceDetector&&window.JessibucaProFaceDetector||(this._opt.operateBtns.aiFace=!1),this._opt.useObjectDetector&&window.JessibucaProObjectDetector||(this._opt.operateBtns.aiObject=!1),this._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector||(this._opt.operateBtns.aiOcclusion=!1),this._opt.useImageDetector&&this._opt.aiImageDetectActive&&window.JessibucaProImageDetector&&(this.imageDetectActive=!0)):(this._opt.operateBtns.aiObject=!1,this._opt.operateBtns.aiFace=!1,this._opt.operateBtns.aiOcclusion=!1),this._opt.useFaceDetector&&(this._opt.useWasm&&window.JessibucaProFaceDetector||this.debug.warn(this.TAG_NAME,`use face detector, useWasm is ${this._opt.useWasm} and window.JbProFaceDetector is null`)),this._opt.useObjectDetector&&(this._opt.useWasm&&window.JessibucaProObjectDetector||this.debug.warn(this.TAG_NAME,`use object detector, useWasm is ${this._opt.useWasm} and window.JbProObjectDetector is null`)),this._opt.useOcclusionDetector&&(this._opt.useWasm&&window.JessibucaProOcclusionDetector||this.debug.warn(this.TAG_NAME,`use occlusion detector, useWasm is ${this._opt.useWasm} and window.JessibucaProOcclusionDetector is null`)),this._opt.useImageDetector&&(this._opt.useWasm&&window.JessibucaProImageDetector||this.debug.warn(this.TAG_NAME,`use image detector, useWasm is ${this._opt.useWasm} and window.JessibucaProImageDetector is null`)),this._opt.useVideoRender&&(this._opt.useWasm&&!this._opt.useOffscreen?(this._opt.wasmUseVideoRender=va()&&xa()&&Ra(),this._opt.wasmUseVideoRender||this.debug.warn(this.TAG_NAME,"use wasm video render, but not support so set wasmUseVideoRender false")):this._opt.useWCS&&!this._opt.useOffscreen&&(this._opt.wcsUseVideoRender=xa()&&Ra(),this._opt.wcsUseVideoRender||this.debug.warn(this.TAG_NAME,"use wcs video render, but not support so set wcsUseVideoRender false"))),this._opt.useCanvasRender&&(this._opt.useMSE&&po(this._opt.mseDecoderUseWorker)&&(this._opt.mseUseCanvasRender=!0),this._opt.useWasm&&(this._opt.wasmUseVideoRender=!1),this._opt.useWCS&&(this._opt.wcsUseVideoRender=!1),this.isOldHls()&&!Aa()&&(this._opt.hlsUseCanvasRender=!0),this.isWebrtcH264()&&(this._opt.webrtcUseCanvasRender=!0)),this._opt.useVideoRender=!1,this._opt.useCanvasRender=!1,this._opt.useWasm?this._opt.wasmUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useWCS?this._opt.wcsUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useMSE?this._opt.mseUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this.isOldHls()?this._opt.hlsUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this.isWebrtcH264()&&(this._opt.webrtcUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0),s=this,Object.defineProperty(s,"rect",{get:()=>{let e={};return s.$container&&(e=s.$container.getBoundingClientRect(),e.width=Math.max(e.width,s.$container.clientWidth),e.height=Math.max(e.height,s.$container.clientHeight)),e}}),["bottom","height","left","right","top","width"].forEach((e=>{Object.defineProperty(s,e,{get:()=>s.rect[e]||0})})),this.events=new _o(this),this._opt.hasVideo&&(this.video=new $o(this),this.recorder=new el(this)),this.isOldHls()?(this.hlsDecoder=new fA(this),this.loaded=!0):this.isWebrtcH264()?(this._opt.isWebrtcForZLM?this.webrtc=new jb(this):this._opt.isWebrtcForSRS?this.webrtc=new $b(this):this._opt.isWebrtcForOthers?this.webrtc=new Wb(this):this.webrtc=new Nb(this),this.loaded=!0):this.isAliyunRtc()?(this.aliyunRtcDecoder=new Jb(this),this.loaded=!0):(this.isUseHls265()&&(this.hlsDecoder=new Fb(this)),this.isWebrtcH265()&&(this.webrtc=new Nb(this)),po(Za(this._opt))?this.decoderWorker=new ol(this):this.loaded=!0),this._opt.hasAudio&&(this.audio=new cn(this)),this.stream=null,this.demux=null,this._lastVolume=null,this._isMute=null,this._isInZoom=!1,this._playingStartTimestamp=null,this.isMSEVideoDecoderInitializationFailedNotSupportHevc=!1,this.isMSEAudioDecoderError=!1,this.isMSEPlaybackRateChangePause=!1,this.isPlayFailedAndPaused=!1,this._opt.useWCS&&(this.webcodecsDecoder=new gh(this),!this._opt.hasAudio&&po(this._opt.demuxUseWorker)&&(this.loaded=!0)),this._opt.useMSE&&po(this._opt.mseDecoderUseWorker)&&(this.mseDecoder=new Hh(this),!this._opt.hasAudio&&po(this._opt.demuxUseWorker)&&(this.loaded=!0)),this.control=new Ih(this),this._opt.contextmenuBtns.length>0&&po(this._opt.disableContextmenu)&&pa()?this.contextmenu=new Vb(this):uo(this._opt.disableContextmenu)&&this._opt.contextmenuBtns.length>0&&pa()&&this.debug.warn(this.TAG_NAME,"disableContextmenu is true, but contextmenuBtns is not empty, so Contextmenu can not be created,please check"),this.isPlayback()&&(this.playback=new zb(this,this._opt.playbackConfig)),this._opt.operateBtns.zoom&&(this.zoom=new Gb(this)),/(iphone|ipad|ipod|ios|android)/i.test(window.navigator.userAgent.toLowerCase())&&po(this._opt.supportLockScreenPlayAudio&&ya())&&(this.keepScreenOn=new $h(this)),(e=>{try{const t=t=>{qa(t)===e.$container&&(e.emit(lt.fullscreen,e.fullscreen),e.fullscreen?e._opt.useMSE&&e.resize():e.resize())};Mr.on("change",t),e.events.destroys.push((()=>{Mr.off("change",t)}))}catch(e){}if(e.on(nt.decoderWorkerInit,(()=>{e.debug.log("player","listen decoderWorkerInit and set loaded true"),e.loaded=!0})),e.on(nt.play,(()=>{e.loading=!1})),e.on(nt.fullscreen,(t=>{if(t)try{Mr.request(e.$container).then((()=>{})).catch((t=>{e.debug.error("player","fullscreen request error",t),ua()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}))}catch(t){ua()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}else try{Mr.exit().then((()=>{e.webFullscreen&&(e.webFullscreen=!1)})).catch((t=>{e.debug.error("player","fullscreen exit error",t),e.webFullscreen&&(e.webFullscreen=!1)}))}catch(t){e.webFullscreen&&(e.webFullscreen=!1)}})),ua()&&e.on(nt.webFullscreen,(t=>{t?e.$container.classList.add("jb-pro-fullscreen-web"):e.$container.classList.remove("jb-pro-fullscreen-web"),e.emit(lt.fullscreen,e.fullscreen)})),e.on(nt.resize,(()=>{e.video&&e.video.resize()})),e._opt.debug){const t=[nt.timeUpdate,nt.currentPts,nt.videoSEI],i=[nt.stats,nt.playbackStats,nt.playbackTimestamp,nt.flvMetaData,nt.playToRenderTimes,nt.audioInfo,nt.videoInfo];Object.keys(nt).forEach((s=>{e.on(nt[s],(function(r){if(!t.includes(s)){i.includes(s)&&(r=JSON.stringify(r));for(var a=arguments.length,o=new Array(a>1?a-1:0),n=1;n{e.on(ct[t],(function(){for(var i=arguments.length,s=new Array(i),r=0;r{this.updateOption({rotate:e?270:0}),this.resize()}),10)}get webFullscreen(){return this.$container.classList.contains("jb-pro-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded||this.isOldHls()||this.isWebrtcH264()||this._opt.useMSE&&po(this._opt.hasAudio)&&po(this._opt.demuxUseWorker)||this._opt.useWCS&&!this._opt.hasAudio&&po(this._opt.demuxUseWorker)}set playing(e){this.isClosed()&&e?this.debug.log(this.TAG_NAME,"player is closed, so can not play"):(e&&uo(this.loading)&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(nt.playing,e),this.emit(nt.volumechange,this.volume),e?this.emit(nt.play):this.emit(nt.pause)))}get playing(){return this._playing}get volume(){return this.audio&&this.audio.volume||0}set volume(e){e!==this.volume&&(this.audio?(this.audio.setVolume(e),this._lastVolume=this.volume,this._isMute=0===this.volume):this.debug.warn(this.TAG_NAME,"set volume error, audio is null"))}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(nt.loading,this._loading))}get loading(){return this._loading}set zooming(e){this.zooming!==e&&(this.zoom||(this.zoom=new Gb(this)),this._zooming=e,this.emit(nt.zooming,this.zooming))}get zooming(){return this._zooming}set recording(e){e?this.playing&&!this.recording&&(this.recorder&&this.recorder.startRecord(),this.isDemuxInWorker()&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!0})):this.recording&&(this.isDemuxInWorker()&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder&&this.recorder.stopRecordAndSave().then((()=>{})).catch((e=>{})))}get recording(){return!!this.recorder&&this.recorder.isRecording}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set latestAudioTimestamp(e){null!==e&&(this._latestAudioTimestamp=e)}get latestAudioTimestamp(){return this._latestAudioTimestamp}get videoTimestamp(){return this._stats.currentPts||this._stats.ts}set streamQuality(e){this.streamQuality!==e&&(this._streamQuality=e,this.emit(nt.streamQualityChange,e))}get streamQuality(){return this._streamQuality}get isDebug(){return uo(this._opt.debug)}get scaleType(){const e=this._opt,t=e.isResize,i=e.isFullResize;let s=Qt;return po(i)&&po(t)?s=Qt:po(i)&&uo(t)?s=Xt:uo(i)&&uo(t)&&(s=Zt),s}set visibility(e){this._visibility!==e&&(this._visibility=e,this.emit(nt.visibilityChange,e),this._lastestVisibilityChangeTimestamp=aa(),e?this.clearVisibilityHiddenTimeout():this.startVisibilityHiddenTimeout())}get visibility(){return this._visibility}set playbackPause(e){this._playbackPause!==e&&(this._playbackPause=e,this.emit(nt.playbackPause,e),this.emit(nt.playbackPauseOrResume,e))}get playbackPause(){return this.isPlayback()&&this._playbackPause}set videoIframeIntervalTs(e){this._videoIframeIntervalTs=e}get videoIframeIntervalTs(){return this._videoIframeIntervalTs}set faceDetectActive(e){this._faceDetectActive!==e&&(this._faceDetectActive=e,this.emit(nt.faceDetectActive,e))}get faceDetectActive(){return this._faceDetectActive}set objectDetectActive(e){this._objectDetectActive!==e&&(this._objectDetectActive=e,this.emit(nt.objectDetectActive,e))}get objectDetectActive(){return this._objectDetectActive}set occlusionDetectActive(e){this._occlusionDetectActive!==e&&(this._occlusionDetectActive=e,this.emit(nt.occlusionDetectActive,e))}get occlusionDetectActive(){return this._occlusionDetectActive}set imageDetectActive(e){this._imageDetectActive!==e&&(this._imageDetectActive=e)}get imageDetectActive(){return this._imageDetectActive}get isUseWorkerDemuxAndDecode(){return this.stream&&this.stream.getStreamType()===y}isDestroyed(){return this._destroyed}isClosed(){return this._closed}isDestroyedOrClosed(){return this.isDestroyed()||this.isClosed()}isPlaying(){let e=!1;return this._opt.playType===b?e=this.playing:this._opt.playType===_&&(e=po(this.playbackPause)&&this.playing),e}updateOption(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._opt=Object.assign({},this._opt,e),uo(t)&&this.decoderWorker&&Object.keys(e).forEach((t=>{this.decoderWorker.updateWorkConfig({key:t,value:e[t]})}))}init(){return new Promise(((e,t)=>{this.video||this._opt.hasVideo&&(this.video=new $o(this)),this.audio||this._opt.hasAudio&&(this.audio=new cn(this)),this.stream||(this.stream=new vn(this)),this.isOldHls()?(this.hlsDecoder||(this.hlsDecoder=new fA(this),this.loaded=!0),e()):this.isWebrtcH264()?(this.webrtc||(this._opt.isWebrtcForZLM?this.webrtc=new jb(this):this._opt.isWebrtcForSRS?this.webrtc=new $b(this):this._opt.isWebrtcForOthers?this.webrtc=new Wb(this):this.webrtc=new Nb(this),this.loaded=!0),e()):this.isAliyunRtc()?(this.aliyunRtcDecoder||(this.aliyunRtcDecoder=new Jb(this),this.loaded=!0),e()):(this.demux||this._opt.hasVideo&&!this.isUseWorkerDemuxAndDecode&&(this.demux=new mh(this)),this._opt.useWCS&&(this.webcodecsDecoder||(this.webcodecsDecoder=new gh(this))),this._opt.useMSE&&po(this._opt.mseDecoderUseWorker)&&(this.mseDecoder||(this.mseDecoder=new Hh(this))),this.isUseHls265()&&(this.hlsDecoder||(this.hlsDecoder=new Fb(this))),this.isWebrtcH265()&&(this.webrtc||(this.webrtc=new Nb(this))),this.decoderWorker?this.loaded?e():this.once(nt.decoderWorkerInit,(()=>{this.isDestroyedOrClosed()?(this.debug.error(this.TAG_NAME,"init() failed and player is destroyed"),t("init() failed and player is destroyed")):(this.loaded=!0,e())})):Za(this._opt)?e():(this.decoderWorker=new ol(this),this.once(nt.decoderWorkerInit,(()=>{this.isDestroyedOrClosed()?(this.debug.error(this.TAG_NAME,"init() failed and player is destroyed"),t("init() failed and player is destroyed")):(this.loaded=!0,e())}))))}))}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(!e&&!this._opt.url)return s("url is empty");this._closed=!1,this.loading=!0,this.playing=!1,this._times.playInitStart=aa(),e||(e=this._opt.url),this._opt.url=e,this.control&&this._opt.loadingBackground&&this.control.initLoadingBackground(),this.init().then((()=>{this.debug.log(this.TAG_NAME,"play() init and next fetch stream"),this._times.playStart=aa(),this._opt.isNotMute&&this.mute(!1),this.enableWakeLock(),this.checkLoadingTimeout(),this.stream?(this.stream.once(ct.fetchError,(e=>{this.emitError(ct.fetchError,e)})),this.stream.once(ct.websocketError,(e=>{this.emitError(ct.websocketError,e)})),this.stream.once(nt.streamEnd,(e=>{this.emit(nt.streamEnd,e)})),this.stream.once(ct.hlsError,(e=>{this.emitError(ct.hlsError,e)})),this.stream.once(ct.webrtcError,(e=>{this.emitError(ct.webrtcError,e)})),this.stream.once(nt.streamSuccess,(()=>{i(),this._times.streamResponse=aa(),this.video&&this.video.play(),this.checkStatsInterval(),this.isPlayback()&&this.playback&&this.playback.startCheckStatsInterval()})),this.stream.fetchStream(e,t)):(this.debug.warn(this.TAG_NAME,`play() this.stream is null and is isDestroyedOrClosed is ${this.isDestroyedOrClosed()}`),s("this.stream is null"))})).catch((e=>{s(e)}))}))}playForControl(){return new Promise(((e,t)=>{this.debug.log(this.TAG_NAME,`playForControl() and pauseAndNextPlayUseLastFrameShow is ${this._opt.pauseAndNextPlayUseLastFrameShow}`),this._opt.pauseAndNextPlayUseLastFrameShow&&this._tempInnerPlayBgobj&&this._tempInnerPlayBgobj.loadingBackground&&this.updateOption({loadingBackground:this._tempInnerPlayBgobj.loadingBackground,loadingBackgroundWidth:this._tempInnerPlayBgobj.loadingBackgroundWidth,loadingBackgroundHeight:this._tempInnerPlayBgobj.loadingBackgroundHeight}),this.play().then((t=>{e(t)})).catch((e=>{t(e)}))}))}close(){return new Promise(((e,t)=>{this._close().then((()=>{this.video&&this.video.clearView(),e()})).catch((e=>{t(e)}))}))}resumeAudioAfterPause(){this.lastVolume&&po(this._isMute)&&(this.volume=this.lastVolume)}async _close(){this._closed=!0,this.video&&(this.video.resetInit(),this.video.pause(!0)),this.loading=!1,this.recording=!1,this.zooming=!1,this.playing=!1,this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.isPlayback()&&this.playback&&this.playback.clearStatsInterval(),this.releaseWakeLock(),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.decoderWorker&&(await this.decoderWorker.destroy(),this.decoderWorker=null),this.stream&&(await this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.webcodecsDecoder&&(this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.hlsDecoder&&(await this.hlsDecoder.destroy(),this.hlsDecoder=null),this.webrtc&&(this.webrtc.destroy(),this.webrtc=null),this.aliyunRtcDecoder&&(this.aliyunRtcDecoder.destroy(),this.aliyunRtcDecoder=null),this.audio&&(await this.audio.destroy(),this.audio=null)}pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{e?this.close().then((()=>{t()})).catch((e=>{i(e)})):this._close().then((()=>{t()})).catch((e=>{i(e)}))}))}pauseForControl(){return new Promise(((e,t)=>{if(this.debug.log(this.TAG_NAME,"_pauseInner()"),this._opt.pauseAndNextPlayUseLastFrameShow&&this.video){const e=this.video.screenshot("","png",.92,"base64");if(e){const t=this.getVideoInfo();t?(this.debug.log(this.TAG_NAME,`pauseForControl() and loadingBackground width is ${t.width} and height is ${t.height}`),this._tempInnerPlayBgobj={loadingBackground:e,loadingBackgroundWidth:t.width,loadingBackgroundHeight:t.height}):this.debug.warn(this.TAG_NAME,"pauseForControl() and videoInfo is null")}else this.debug.warn(this.TAG_NAME,"pauseForControl() and loadingBackground is null")}this.pause().then((t=>{e(t)})).catch((e=>{t(e)}))}))}isAudioMute(){let e=!0;return this.audio&&(e=this.audio.isMute),e}isAudioNotMute(){return!this.isAudioMute()}mute(e){this.audio&&this.audio.mute(e)}resize(){this.video&&this.video.resize()}startRecord(e,t){this.recording||(this.recorder.setFileName(e,t),this.recording=!0)}stopRecordAndSave(e,t){return new Promise(((i,s)=>{this.recorder||s("recorder is null"),this.recording?(this._opt.useWasm&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder.stopRecordAndSave(e,t).then((e=>{i(e)})).catch((e=>{s(e)}))):s("recorder is not recording")}))}_hasControl(){let e=!1,t=!1;return Object.keys(this._opt.operateBtns).forEach((e=>{this._opt.operateBtns[e]&&-1===(""+e).indexOf("Fn")&&(t=!0)})),(this._opt.showBandwidth||t)&&(e=!0),this._opt.extendOperateBtns&&this._opt.extendOperateBtns.length>0&&(e=!0),this.isPlayback()&&this._opt.playbackConfig.showControl&&(e=!0),this._opt.controlHtml&&(e=!0),e}useWasmDecode(){return po(this._opt.useMSE)&&po(this._opt.useWCS)}canVideoTrackWritter(){const e=this._opt;return!this.isOldHls()&&!this.isWebrtcH264()&&po(e.useMSE)&&!this.isAliyunRtc()&&(e.useWCS&&po(e.useOffscreen)&&e.wcsUseVideoRender||this.useWasmDecode())}checkHeartTimeout$2(){if(po(this.playbackPause)&&this.playing){if(this.isDestroyedOrClosed())return void(this.debug&&this.debug.warn(this.TAG_NAME,"checkHeartTimeout$2 but player is destroyed"));if(po(this.isHistoryFpsListAllZero()))return void(this.debug&&this.debug.warn(this.TAG_NAME,"checkHeartTimeout$2 but fps is not all zero"));if(0!==this._stats.fps)return void(this.debug&&this.debug.warn(this.TAG_NAME,`checkHeartTimeout$2 but fps is ${this._stats.fps}`));if(po(this.visibility)&&0!==this._stats.vbps)return void(this.debug&&this.debug.warn(this.TAG_NAME,`checkHeartTimeout$2 but page is not visibility and vbps is ${this._stats.vbps}`));const e=this._historyFpsList.join(",");this.debug.warn(this.TAG_NAME,`checkHeartTimeout$2 and\n pause and emit delayTimeout event and\n current vbps is ${this._stats.vbps} and\n current fps is ${this._stats.fps} and\n history FpsList is ${e} and\n current visibility is ${this.visibility} and`),this.emit(nt.timeout,nt.delayTimeout),this.emit(nt.delayTimeout)}else this.debug.log(this.TAG_NAME,`checkHeartTimeout$2 playbackPause is ${this.playbackPause}, playing is ${this.playing}`)}checkStatsInterval(){this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout((()=>{this.playing?this.debug.warn(this.TAG_NAME,`checkLoadingTimeout but loading is ${this.loading} and playing is ${this.playing}`):this.isDestroyedOrClosed()?this.debug&&this.debug.warn(this.TAG_NAME,"checkLoadingTimeout but player is destroyed"):(this.debug.warn(this.TAG_NAME,"checkLoadingTimeout and pause and emit loadingTimeout event"),this.emit(nt.timeout,nt.loadingTimeout),this.emit(nt.loadingTimeout))}),1e3*this._opt.loadingTimeout)}clearCheckLoadingTimeout(){this._checkLoadingTimeout&&(this.debug.log(this.TAG_NAME,"clearCheckLoadingTimeout"),clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}handleRender(){this.isDestroyedOrClosed()?this.debug&&this.debug.warn(this.TAG_NAME,"handleRender but player is destroyed"):(this.loading&&(this.clearCheckLoadingTimeout(),this.loading=!1,this.emit(nt.start)),this.playing||(this.playing=!0))}updateStats(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._startBpsTime||(this._startBpsTime=aa()),Ba(e.ts)){const t=parseInt(e.ts,10);this._stats.ts=t,null===this._playingStartTimestamp&&t>0&&(this._playingStartTimestamp=t)}Ba(e.dts)&&(this._stats.dts=parseInt(e.dts,10)),Ba(e.mseTs)&&(this._stats.mseTs=e.mseTs),Ba(e.buf)&&(this._stats.buf=e.buf),Ba(e.netBuf)&&(this._stats.netBuf=e.netBuf),Ba(e.currentPts)&&(this._stats.currentPts=e.currentPts),e.fps&&(this._stats.fps+=1),e.dfps&&(this._stats.dfps+=1),e.abps&&(this._stats.abps+=e.abps),e.vbps&&(this._stats.vbps+=e.vbps),e.workerStats&&(this._tempWorkerStats=e.workerStats),e.isDropping&&(this._stats.isDropping=e.isDropping),e.mseVideoBufferDelayTime&&(this._stats.mseVideoBufferDelayTime=parseInt(1e3*e.mseVideoBufferDelayTime,10));const t=aa();if(t-this._startBpsTime<1e3)return;null!==this._playingStartTimestamp&&this._stats.fps>0&&(this._stats.pTs+=1);let i=0,s=0,r=0,a=0,o=0;this._opt.useMSE&&(this.mseDecoder?(i=this.mseDecoder.checkSourceBufferDelay(),i=parseInt(1e3*i,10),s=this.mseDecoder.checkSourceBufferStore(),s=s.toFixed(2),r=this.mseDecoder.getDecodeDiffTimes(),a=this.mseDecoder.getDecodePlaybackRate(),o=this.mseDecoder.getPendingSegmentsLength()):this.isMseDecoderUseWorker()&&(i=this.video.checkSourceBufferDelay(),i=parseInt(1e3*i,10),s=this.video.checkSourceBufferStore(),s=s.toFixed(2),a=this.video.getDecodePlaybackRate())),this._opt.useWCS&&this.webcodecsDecoder&&(r=this.webcodecsDecoder.getDecodeDiffTimes()),this.isOldHls()&&this.hlsDecoder&&(i=this.hlsDecoder.checkHlsBufferedDelay(),i=parseInt(1e3*i,10));let n=0,l=0,d=0;this.isUseHls265()&&this.hlsDecoder&&(i=this.hlsDecoder.checkHlsBufferedDelay(),i=i.toFixed(2),n=this.hlsDecoder.getDemuxBufferedListLength(),d=this.hlsDecoder.getDemuxVideoBufferedListLength(),l=this.hlsDecoder.getDemuxAudioBufferedListLength());let h=0,c=0,u=0,p=!1,f=0;this._opt.useWasm||this._opt.demuxUseWorker?this._tempWorkerStats&&(c=this._tempWorkerStats.demuxBufferDelay,u=this._tempWorkerStats.audioDemuxBufferDelay,h=this._tempWorkerStats.streamBufferByteLength,this._stats.netBuf=this._tempWorkerStats.netBuf,f=this._tempWorkerStats.pushLatestDelay,p=this._tempWorkerStats.isStreamTsMoreThanLocal,this._stats.buf=this._tempWorkerStats.latestDelay):this.demux&&(h=this.demux.getInputByteLength(),f=this.demux.getPushLatestDelay(),p=this.demux.getIsStreamTsMoreThanLocal(),this.demux.bufferList&&(c=this.demux.bufferList.length));let m=0,g=0;this.audio&&this.audio.bufferList&&(m=this.audio.bufferList.length,g=parseInt(m*this.audio.oneBufferDuration,10));let y=0,A=0;if(this.isPlayback()&&this.video){this._opt.playbackConfig.isUseFpsRender&&(y=this.video.bufferList&&this.video.bufferList.length||0);let e=this.video.getStreamFps();const t=e>0?1e3/e:0;A=parseInt(t*y+t*c,10)}let b=0;this.videoTimestamp>0&&(b=this._stats.dts-this.videoTimestamp);const v=b+this._stats.netBuf;this.isOldHls()&&(this._stats.fps=this.hlsDecoder.getFps()),this._stats.fps>this._stats.maxFps&&(this._stats.maxFps=this._stats.fps);let _=this.getVideoCurrentTime();const S=this._stats.videoCurrentTime;let w=-1;S&&_&&(w=(_-S).toFixed(2),_=_.toFixed(2));let E=0;this.audioTimestamp>0&&(E=this.audioTimestamp-this.getRenderCurrentPts()),this._allStatsData=Object.assign(this._stats,{audioBuffer:m,audioBufferDelayTs:g,audioTs:this.audioTimestamp,latestAudioTs:this.latestAudioTimestamp,playbackVideoBuffer:y,playbackVideoWaitingBuffer:0,playbackAudioWaitingBuffer:0,playbackCacheDataDuration:A,demuxBuffer:c,pushLatestDelay:f,audioDemuxBuffer:u,streamBuffer:h,mseDelay:i,mseStore:s,mseDecodeDiffTimes:r,mseDecodePlaybackRate:a,msePendingBuffer:o,wcsDecodeDiffTimes:r,hlsDelay:i,hlsDemuxLength:n,hlsDemuxAudioLength:l,hlsDemuxVideoLength:d,delayTs:b,totalDelayTs:v,isStreamTsMoreThanLocal:p,videoCurrentTime:_,videoCurrentTimeDiff:w,audioSyncVideo:E});let k=null,C=null,x="";if(this.isPlayer()&&this._opt.hasVideo&&this.playing){k=function(e,t){let i=3;const s=t||25;return e<.33*s?i=0:e<.5*s?i=1:e<.83*s&&(i=2),i}(this._stats.fps,this._flvMetaDataFps),this._allStatsData.performance=k;const e=this.checkVideoSmooth(this._allStatsData);x=e.reason,C=e.result,this._allStatsData.videoSmooth=C}this.emit(nt.stats,this._allStatsData),this._allStatsData.streamBuffer>this._opt.flvDemuxBufferSizeMaxLarge&&this.getDemuxType()===T&&this.emit(ct.flvDemuxBufferSizeTooLarge,this._allStatsData.streamBuffer),this._opt.hasVideo?(this.updateHistoryFpsList(this._stats.fps,this._stats.videoCurrentTimeDiff),Ba(k)&&this.emit(nt.performance,k),Ba(C)&&this.emit(nt.videoSmooth,C,x)):this._opt.hasAudio&&this.updateHistoryFpsList(this._stats.abps,0),this._stats.fps=0,this._stats.dfps=0,this._stats.abps=0,this._stats.vbps=0,this._stats.isDropping=!1,this._startBpsTime=t}resetStats(){this._startBpsTime=null,this._playingStartTimestamp=null,this._historyFpsList=[],this._historyVideoDiffList=[],this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,currentPts:0,pTs:0,dts:0,mseVideoBufferDelayTime:0,isDropping:!1},this._allStatsData={}}checkVideoSmooth(e){let t=!0,i="";if(this._opt.videoBuffer,this._opt.videoBufferDelay,this.isWebrtcH264()||this.isOldHls())return{result:t,reason:i};if(0===e.vbps&&po(this._opt.isHls)&&(i="vbpsIsZero",this.debug.log(this.TAG_NAME,`checkVideoSmooth false because ${i}`),t=!1),t&&e.isDropping&&(i="isDroppingIsTrue",this.debug.log(this.TAG_NAME,`checkVideoSmooth false because ${i}`),t=!1),t&&this.visibility&&this._historyFpsList.length>=this._opt.heartTimeout){const s=function(e){const t=Math.max(...e),i=Math.min(...e);return e.filter((e=>e!==t&&e!==i))}(this._historyFpsList),r=s.reduce(((e,t)=>e+t),0)/s.length,a=.83*r;e.fps=1.5||e.videoCurrentTimeDiff<=.5)&&-1!==e.videoCurrentTimeDiff&&(i="videoCurrentTimeDiffIsNotNormal",this.debug.log(this.TAG_NAME,`checkVideoSmooth false because videoCurrentTimeDiff is ${e.videoCurrentTimeDiff}`),t=!1),{result:t,reason:i}}enableWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()}releaseWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()}clearBufferDelay(){this._opt.useWasm?this.decoderWorker&&this.decoderWorker.clearWorkBuffer(!0):this.demux&&this.demux.clearBuffer(!0)}doDestroy(){this.emit(nt.beforeDestroy)}handlePlayToRenderTimes(){if(this.isDestroyedOrClosed())return void this.debug.log(this.TAG_NAME,"handlePlayToRenderTimes but player is closed or destroyed");const e=this.getPlayToRenderTimes();this.emit(nt.playToRenderTimes,e)}getPlayToRenderTimes(){const e=this._times;return e.playTimestamp=e.playStart-e.playInitStart,e.streamTimestamp=e.streamStart-e.playStart,e.streamResponseTimestamp=e.streamResponse-e.streamStart>0?e.streamResponse-e.streamStart:0,e.demuxTimestamp=e.demuxStart-e.streamResponse>0?e.demuxStart-e.streamResponse:0,e.decodeTimestamp=e.decodeStart-e.demuxStart>0?e.decodeStart-e.demuxStart:0,e.videoTimestamp=e.videoStart-e.decodeStart,e.allTimestamp=e.videoStart-e.playInitStart,e}getOption(){return this._opt}getPlayType(){return this._opt.playType}isPlayer(){return this._opt.playType===b}isPlayback(){return this._opt.playType===_}isDemuxSetCodecInit(){let e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=!!this.webcodecsDecoder&&this.webcodecsDecoder.hasInit:t.useMSE&&(e=!!this.mseDecoder&&this.mseDecoder.hasInit),e}isDemuxDecodeFirstIIframeInit(){let e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=!!this.webcodecsDecoder&&this.webcodecsDecoder.isDecodeFirstIIframe:t.useMSE&&(e=!!this.mseDecoder&&this.mseDecoder.isDecodeFirstIIframe),e}isAudioPlaybackRateSpeed(){let e=!1;return this.audio&&(e=this.audio.isPlaybackRateSpeed()),e}getPlayingTimestamp(){return this._stats.pTs}getRecordingType(){let e=null;return this.recorder&&(e=this.recorder.getType()),e}getRecordingByteLength(){let e=0;return this.recording&&(e=this.recorder.getToTalByteLength()),e}getRecordingDuration(){let e=0;return this.recording&&(e=this.recorder.getTotalDuration()),e}getDecodeType(){let e="";const t=this.getOption();return this.isWebrtcH264()?G:this.isAliyunRtc()?V:this.isOldHls()?H:(t.useMSE&&(e+=U+" ",t.mseDecoderUseWorker&&(e+="worker")),t.useWCS&&(e+=F+" "),t.useWasm&&(e+=N+" ",t.useSIMD&&(e+=j+" "),t.useMThreading&&(e+=z+" ")),t.useOffscreen&&(e+=O+" "),e)}getDemuxType(){return this._opt.demuxType}getRenderType(){let e="";return this.video&&(e=this.video.getType()),e}getCanvasRenderType(){let e="";return this.video&&(e=this.video.getCanvasType()),e}getAudioEngineType(){let e="";return this.audio&&(e=this.audio.getEngineType()),e}getStreamType(){let e="";return this.stream&&(e=this.stream.getStreamType()),e}getAllStatsData(){return this._allStatsData}isFlvDemux(){return this._opt.demuxType===T}isM7SDemux(){return this._opt.demuxType===k}isNakedFlowDemux(){return this._opt.demuxType===D}isMpeg4Demux(){return this._opt.demuxType===P}isTsDemux(){return this._opt.demuxType===I}isFmp4Demux(){return this._opt.demuxType===L}togglePerformancePanel(e){this.updateOption({showPerformance:e}),this.emit(nt.togglePerformancePanel,e)}setScaleMode(e){let t={isFullResize:!1,isResize:!1,aspectRatio:"default"};switch(e=Number(e)){case Qt:t.isFullResize=!1,t.isResize=!1;break;case Xt:t.isFullResize=!1,t.isResize=!0;break;case Zt:t.isFullResize=!0,t.isResize=!0}this.updateOption(t),this.resize(),this.emit(nt.viewResizeChange,e)}startVisibilityHiddenTimeout(){this.clearVisibilityHiddenTimeout(),this._opt.pageVisibilityHiddenTimeout>0&&(this.visibilityHiddenTimeout=setTimeout((()=>{this.emit(nt.visibilityHiddenTimeout)}),1e3*this._opt.pageVisibilityHiddenTimeout))}clearVisibilityHiddenTimeout(){this._checkVisibleHiddenTimeout&&(clearTimeout(this._checkVisibleHiddenTimeout),this._checkVisibleHiddenTimeout=null)}faceDetect(e){this.faceDetectActive=e,po(e)&&this.video&&this.video.addAiContentToCanvas([])}objectDetect(e){this.objectDetectActive=e,po(e)&&this.video&&this.video.addAiContentToCanvas([])}occlusionDetect(e){this.occlusionDetectActive=e}downloadNakedFlowFile(){this.demux&&this.demux.downloadNakedFlowFile&&this.demux.downloadNakedFlowFile()}downloadFmp4File(){this.demux&&this.demux.downloadFmp4File&&this.demux.downloadFmp4File()}downloadMpeg4File(){const e=new Blob([this._tempStreamList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".mpeg4",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadMpeg4File",e)}}hasCacheOnGopBuffer(){const e=this.videoIframeIntervalTs,t=this._allStatsData.demuxBuffer,i=this._allStatsData.maxFps;let s=!1;if(e&&t&&i){s=1e3/i*t>e}return s}addContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.video&&this.video.addContentToCanvas(e)}addContentToContainer(){}sendWebsocketMessage(e){const t=this.getStreamType();t===f||t===y+" "+f?this.stream.sendMessage(e):this.debug.warn(this.TAG_NAME,`sendWebsocketMessage: stream type is not websocket, current stream type is ${this.getStreamType()}`)}checkIsInRender(){const e=this._stats;return e.vbps>0&&e.fps>0}setControlHtml(e){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML=e)}clearControlHtml(){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML="")}updateWatermark(e){this.singleWatermark&&this.singleWatermark.update(e)}removeWatermark(){this.singleWatermark&&this.singleWatermark.remove()}getVideoInfo(){let e=null;return this.video&&(e=this.video.getVideoInfo()),e}getAudioInfo(){let e=null;return this.audio&&(e=this.audio.getAudioInfo()),e}getVideoPlaybackQuality(){let e=null;return this.video&&(e=this.video.getPlaybackQuality()),e}emitError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.emit(nt.error,e,t),this.emit(e,t)}updateHistoryFpsList(e,t){this.playbackPause||(this._historyFpsList.length>this._opt.heartTimeout&&(this._historyFpsList.shift(),this._historyVideoDiffList.shift()),this._historyFpsList.push(e),this._historyVideoDiffList.push(t),this.isHistoryFpsListAllZero()&&this.checkHeartTimeout$2())}isHistoryFpsListAllZero(){let e=!0;if(this._historyFpsList.length0){e=!1;break}if(e)for(let t=0;t0){e=!1;break}return e}isUseHls265(){return uo(this._opt.isHls)&&uo(this._opt.supportHls265)}isHls(){return uo(this._opt.isHls)}isOldHls(){return uo(this._opt.isHls)&&po(this._opt.supportHls265)}isWebrtcNotH265(){return uo(this._opt.isWebrtc)&&po(this._opt.isWebrtcH265)}isWebrtcH264(){return uo(this._opt.isWebrtc)&&po(this._opt.isWebrtcH265)}isWebrtcH265(){return uo(this._opt.isWebrtc)&&uo(this._opt.isWebrtcH265)}isAliyunRtc(){return uo(this._opt.isAliyunRtc)}isUseHls265UseMse(){return this.isUseHls265()&&this.isUseMSE()}isStreamWebTransport(){return this.getStreamType()===g}isPlaybackCacheBeforeDecodeForFpsRender(){return this.isPlayback()&&uo(this._opt.playbackConfig.isCacheBeforeDecodeForFpsRender)&&uo(this._opt.useWCS)}isPlaybackUseWCS(){return this.isPlayback()&&uo(this._opt.useWCS)}isPlaybackUseMSE(){return this.isPlayback()&&uo(this._opt.useMSE)}isPlayUseMSE(){return this.isPlayer()&&uo(this._opt.useMSE)}isInWebFullscreen(){return this._opt.useWebFullScreen&&ua()&&this.fullscreen}getPlaybackRate(){let e=1;return uo(this.isPlayback())&&this.playback&&(e=this.playback.rate),e}isPlaybackOnlyDecodeIFrame(){return uo(this.isPlayback())&&this.getPlaybackRate()>=this._opt.playbackForwardMaxRateDecodeIFrame}pushTempStream(e){const t=new Uint8Array(e);this._tempStreamList.push(t)}updateLoadingText(e){this.loading&&this.control&&this.control.updateLoadingText(e)}getVideoCurrentTime(){let e=0;return this.video&&(this._opt.useMSE?this.mseDecoder?e=this.mseDecoder.getVideoCurrentTime():this.isMseDecoderUseWorker()&&(e=this.video.getVideoCurrentTime()):this.isWebrtcH264()&&this.webrtc?e=this.webrtc.getVideoCurrentTime():this.isAliyunRtc()&&this.aliyunRtcDecoder&&(e=this.aliyunRtcDecoder.getVideoCurrentTime())),e}addMemoryLog(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s0){const e=t/1e3;this._flvMetaDataFps=e}}Pa(e.hasAudio)&&po(e.hasAudio)&&(this.debug.log("updateMetaData","hasAudio",e.hasAudio,"and update _opt.hasAudio"),this._opt.hasAudio=e.hasAudio),Pa(e.hasVideo)&&po(e.hasVideo)&&(this.debug.log("updateMetaData","hasVideo",e.hasVideo,"and update _opt.hasVideo"),this._opt.hasVideo=e.hasVideo)}this.emit(nt.flvMetaData,e)}getMetaData(){return this._flvMetaData}getExtendBtnList(){return this.control.getExtendBtnList().map((e=>({name:e.name,$container:e.$iconContainer,$btn:e.$iconWrap,$activeBtn:e.$activeIconWrap})))}getCpuLevel(){let e=null;return this.pressureObserverCpu&&(e=this.pressureObserverCpu.getCurrentCpuState()),e}isRecordTypeFlv(){return this.recorder&&this._opt.recordType===E}isRecordTypeMp4(){return this.recorder&&this._opt.recordType===S}isRecordTypeWebm(){return this.recorder&&this._opt.recordType===w}isDemuxInWorker(){return this._opt.useWasm||this._opt.demuxUseWorker}isUseMSE(){return uo(this._opt.useMSE)}isUseWCS(){return uo(this._opt.useWCS)}isUseWASM(){return uo(this._opt.useWasm)}isMseDecoderUseWorker(){return this.isUseMSE()&&uo(this._opt.mseDecoderUseWorker)}getAudioSyncVideoDiff(){return this.audioTimestamp-this.getRenderCurrentPts()}getMseVideoBufferDelayTime(){let e=0;return this._opt.useMSE&&this.mseDecoder&&(this.mseDecoder?e=this.mseDecoder.getVideoBufferDelayTime():this.isMseDecoderUseWorker()&&(e=this.video.getVideoBufferDelayTime()),e=parseInt(1e3*e,10)),e}updateCurrentPts(e){this.updateStats({currentPts:e}),this.emit(nt.currentPts,e)}getRenderCurrentPts(){let e=0;return e=this._stats.currentPts?this._stats.currentPts:this.videoTimestamp-this.getMseVideoBufferDelayTime(),e}openSyncAudioAndVideo(){return this._opt.syncAudioAndVideo&&this._opt.hasVideo}showTipsMessageByCode(e){if(this.control){const t=this._opt.showMessageConfig[e]||"未知异常";this.control.showTipsMessage(t,e)}}showTipsMessageByContent(e){this.control&&e&&this.control.showTipsMessage(e)}hideTipsMessage(){this.control&&this.control.hideTipsMessage()}decoderCheckFirstIFrame(){uo(this._opt.checkFirstIFrame)&&(this.mseDecoder?this.mseDecoder.isDecodeFirstIIframe=!1:this.webcodecsDecoder&&(this.webcodecsDecoder.isDecodeFirstIIframe=!1))}isHlsCanVideoPlay(){return this._canPlayAppleMpegurl&&this.isOldHls()}setPtzPosition(e){this.control&&this.control.updatePtzPosition(e)}setPlayFailedAndPaused(){this.isPlayFailedAndPaused=!0}getMseMineType(){let e={};return this.mseDecoder&&(e=this.mseDecoder.getMimeType()),e}getMaxDelayTs(){return this._opt.videoBuffer+this._opt.videoBufferDelay}isMseVideoStateInited(){return!this.video||this.video.getReadyStateInited()}}class Qb{constructor(e){const{fromSampleRate:t,toSampleRate:i,channels:s,inputBufferSize:r}=e;if(!t||!i||!s)throw new Error("Invalid settings specified for the resampler.");this.resampler=null,this.fromSampleRate=t,this.toSampleRate=i,this.channels=s||0,this.inputBufferSize=r,this.initialize()}initialize(){this.fromSampleRate==this.toSampleRate?(this.resampler=e=>e,this.ratioWeight=1):(this.fromSampleRate{let t,i,s,r,a,o,n,l,d,h=e.length,c=this.channels;if(h%c!=0)throw new Error("Buffer was of incorrect sample length.");if(h<=0)return[];for(t=this.outputBufferSize,i=this.ratioWeight,s=this.lastWeight,r=0,a=0,o=0,n=0,l=this.outputBuffer;s<1;s+=i)for(a=s%1,r=1-a,this.lastWeight=s%1,d=0;d0?d:0)]*r+e[o+(c+d)]*a;s+=i,o=Math.floor(s)*c}for(d=0;d{let t,i,s,r,a,o,n,l,d,h,c,u=e.length,p=this.channels;if(u%p!=0)throw new Error("Buffer was of incorrect sample length.");if(u<=0)return[];for(t=this.outputBufferSize,i=[],s=this.ratioWeight,r=0,o=0,n=0,l=!this.tailExists,this.tailExists=!1,d=this.outputBuffer,h=0,c=0,a=0;a0&&o=n)){for(a=0;a0?a:0)]*r;c+=r,r=0;break}for(a=0;a{t[i]=function(e){let t,i,s;return e>=0?t=213:(t=85,(e=-e-1)<0&&(e=32767)),i=Zb(e,Xb,8),i>=8?127^t:(s=i<<4,s|=i<2?e>>4&15:e>>i+3&15,s^t)}(e)})),t}function tv(e){const t=[];return Array.prototype.slice.call(e).forEach(((e,i)=>{t[i]=function(e){let t=0;e<0?(e=132-e,t=127):(e+=132,t=255);let i=Zb(e,Xb,8);return i>=8?127^t:(i<<4|e>>i+3&15)^t}(e)})),t}class iv extends So{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this._opt={},e&&(this.player=e),this.TAG_NAME="talk";const i=no(Is);this._opt=Object.assign({},i,t),this._opt.sampleRate=parseInt(this._opt.sampleRate,10),this._opt.sampleBitsWidth=parseInt(this._opt.sampleBitsWidth,10),this.audioContext=null,this.gainNode=null,this.recorder=null,this.workletRecorder=null,this.biquadFilter=null,this.userMediaStream=null,this.clearWorkletUrlTimeout=null,this.bufferSize=512,this._opt.audioBufferLength=this.calcAudioBufferLength(),this.audioBufferList=[],this.socket=null,this.socketStatus=ut,this.mediaStreamSource=null,this.heartInterval=null,this.checkGetUserMediaTimeout=null,this.wsUrl=null,this.startTimestamp=0,this.sequenceId=0,this.tempTimestamp=null,this.tempG711BufferList=[],this.tempRtpBufferList=[],this.tempPcmBufferList=[],this.events=new _o(this),this._initTalk(),this.player||(this.debug=new Pr(this)),this._opt.encType!==Hi&&this._opt.encType!==Vi||8e3===this._opt.sampleRate&&16===this._opt.sampleBitsWidth||this.warn(this.TAG_NAME,`\n encType is ${this._opt.encType} and sampleBitsWidth is ${this._opt.sampleBitsWidth}, set sampleBitsWidth to ${this._opt.sampleBitsWidth}。\n ${this._opt.encType} only support sampleRate 8000 and sampleBitsWidth 16`),this.log(this.TAG_NAME,"init",JSON.stringify(this._opt))}destroy(){this.clearWorkletUrlTimeout&&(clearTimeout(this.clearWorkletUrlTimeout),this.clearWorkletUrlTimeout=null),this.userMediaStream&&(this.userMediaStream.getTracks&&this.userMediaStream.getTracks().forEach((e=>{e.stop()})),this.userMediaStream=null),this.mediaStreamSource&&(this.mediaStreamSource.disconnect(),this.mediaStreamSource=null),this.recorder&&(this.recorder.disconnect(),this.recorder.onaudioprocess=null,this.recorder=null),this.biquadFilter&&(this.biquadFilter.disconnect(),this.biquadFilter=null),this.gainNode&&(this.gainNode.disconnect(),this.gainNode=null),this.workletRecorder&&(this.workletRecorder.disconnect(),this.workletRecorder=null),this.socket&&(this.socketStatus===pt&&this._sendClose(),this.socket.close(),this.socket=null),this._stopHeartInterval(),this._stopCheckGetUserMediaTimeout(),this.audioContext=null,this.gainNode=null,this.recorder=null,this.audioBufferList=[],this.sequenceId=0,this.wsUrl=null,this.tempTimestamp=null,this.tempRtpBufferList=[],this.tempG711BufferList=[],this.tempPcmBufferList=[],this.startTimestamp=0,this.log(this.TAG_NAME,"destroy")}addRtpToBuffer(e){const t=e.length+this.tempRtpBufferList.length,i=new Uint8Array(t);i.set(this.tempRtpBufferList,0),i.set(e,this.tempRtpBufferList.length),this.tempRtpBufferList=i}addG711ToBuffer(e){const t=e.length+this.tempG711BufferList.length,i=new Uint8Array(t);i.set(this.tempG711BufferList,0),i.set(e,this.tempG711BufferList.length),this.tempG711BufferList=i}addPcmToBuffer(e){const t=e.length+this.tempPcmBufferList.length,i=new Uint8Array(t);i.set(this.tempPcmBufferList,0),i.set(e,this.tempPcmBufferList.length),this.tempG711ButempPcmBufferListfferList=i}downloadRtpFile(){this.debug.log(this.TAG_NAME,"downloadRtpFile");const e=new Blob([this.tempRtpBufferList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".rtp",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadRtpFile",e)}}downloadG711File(){this.debug.log(this.TAG_NAME,"downloadG711File");const e=new Blob([this.tempG711BufferList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+"."+this._opt.encType,t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadG711File",e)}}downloadPcmFile(){this.debug.log(this.TAG_NAME,"downloadPcmFile");const e=new Blob([this.tempPcmBufferList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+"."+this._opt.encType,t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadRtpFile",e)}}downloadFile(){this._opt.packetType===ks?this.downloadRtpFile():this._opt.encType===Hi||this._opt.encType===Vi?this.downloadG711File():this.downloadPcmFile()}calcAudioBufferLength(){const{sampleRate:e,sampleBitsWidth:t}=this._opt;return 8*e*.02/8}get socketStatusOpen(){return this.socketStatus===pt}log(){for(var e=arguments.length,t=new Array(e),i=0;i1?t-1:0),s=1;s{const i=this.events.proxy;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer",this.emit(nt.talkStreamStart),i(this.socket,xs,(()=>{this.socketStatus=pt,this.log(this.TAG_NAME,"websocket open -> do talk"),this.emit(nt.talkStreamOpen),e(),this._doTalk()})),i(this.socket,Ls,(e=>{this.log(this.TAG_NAME,"websocket message",e.data)})),i(this.socket,Rs,(e=>{this.socketStatus=ft,this.warn(this.TAG_NAME,"websocket close -> reject",e),this.emit(nt.talkStreamClose),t(e)})),i(this.socket,Ds,(e=>{this.socketStatus=mt,this.error(this.TAG_NAME,"websocket error -> reject",e),this.emit(nt.talkStreamError,e),t(e)}))}))}_sendClose(){}_initTalk(){this._initMethods(),this._opt.engine===Ps?this._initWorklet():this._opt.engine===Bs&&this._initScriptProcessor(),this.log(this.TAG_NAME,"audioContext samplerate",this.audioContext.sampleRate)}_initMethods(){this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:48e3}),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=1,this.biquadFilter=this.audioContext.createBiquadFilter(),this.biquadFilter.type="lowpass",this.biquadFilter.frequency.value=3e3,this.resampler=new Qb({fromSampleRate:this.audioContext.sampleRate,toSampleRate:this._opt.sampleRate,channels:this._opt.numberChannels,inputBufferSize:this.bufferSize})}_initScriptProcessor(){const e=this.audioContext.createScriptProcessor||this.audioContext.createJavaScriptNode;this.recorder=e.apply(this.audioContext,[this.bufferSize,this._opt.numberChannels,this._opt.numberChannels]),this.recorder.onaudioprocess=e=>this._onaudioprocess(e)}_initWorklet(){const e=eo((function(){class e extends AudioWorkletProcessor{constructor(e){super(),this._cursor=0,this._bufferSize=e.processorOptions.bufferSize,this._buffer=new Float32Array(this._bufferSize)}process(e,t,i){if(!e.length||!e[0].length)return!0;for(let t=0;t{const e=new AudioWorkletNode(this.audioContext,"talk-processor",{processorOptions:{bufferSize:this.bufferSize}});e.connect(this.gainNode),e.port.onmessage=e=>{"data"===e.data.eventType&&this._encodeAudioData(e.data.buffer)},this.workletRecorder=e})),this.clearWorkletUrlTimeout=setTimeout((()=>{URL.revokeObjectURL(e),this.clearWorkletUrlTimeout=null}),te)}_onaudioprocess(e){const t=e.inputBuffer.getChannelData(0);this._encodeAudioData(new Float32Array(t))}_encodeAudioData(e){if(0===e[0]&&0===e[1])return void this.log(this.TAG_NAME,"empty audio data");const t=this.resampler.resample(e);let i=t;if(16===this._opt.sampleBitsWidth?i=function(e){let t=e.length,i=new Int16Array(t);for(;t--;){let s=Math.max(-1,Math.min(1,e[t]));i[t]=s<0?32768*s:32767*s}return i}(t):8===this._opt.sampleBitsWidth&&(i=function(e){let t=e.length,i=new Int8Array(t);for(;t--;){let s=Math.max(-1,Math.min(1,e[t]));const r=s<0?32768*s:32767*s;i[t]=parseInt(255/(65535/(32768+r)),10)}return i}(t)),null!==i.buffer){let e=null;this._opt.encType===Hi?e=ev(i):this._opt.encType===Vi?e=tv(i):this._opt.encType===$i&&(e=i);const t=new Uint8Array(e);for(let e=0;e>8,t[n++]=255&e>>0}t[n++]=128,t[n++]=128+i,t[n++]=s/256,t[n++]=s%256,t[n++]=r/65536/256,t[n++]=r/65536%256,t[n++]=r%65536/256,t[n++]=r%65536%256,t[n++]=a/65536/256,t[n++]=a/65536%256,t[n++]=a%65536/256,t[n++]=a%65536%256;let l=t.concat([...e]),d=new Uint8Array(l.length);for(let e=0;e{this.log(this.TAG_NAME,"getUserMedia success"),this.userMediaStream=e,this.mediaStreamSource=this.audioContext.createMediaStreamSource(e),this.mediaStreamSource.connect(this.biquadFilter),this.recorder?(this.biquadFilter.connect(this.recorder),this.recorder.connect(this.gainNode)):this.workletRecorder&&(this.biquadFilter.connect(this.workletRecorder),this.workletRecorder.connect(this.gainNode)),this.gainNode.connect(this.audioContext.destination),this.emit(nt.talkGetUserMediaSuccess),null===e.oninactive&&(e.oninactive=e=>{this._handleStreamInactive(e)})})).catch((e=>{this.error(this.TAG_NAME,"getUserMedia error",e.toString()),this.emit(nt.talkGetUserMediaFail,e.toString())})).finally((()=>{this.log(this.TAG_NAME,"getUserMedia finally"),this._stopCheckGetUserMediaTimeout()}))}_getUserMedia2(){this.log(this.TAG_NAME,"getUserMedia"),navigator.mediaDevices?navigator.mediaDevices.getUserMedia({audio:!0}).then((e=>{this.log(this.TAG_NAME,"getUserMedia2 success")})):navigator.getUserMedia({audio:!0},this.log(this.TAG_NAME,"getUserMedia2 success"),this.log(this.TAG_NAME,"getUserMedia2 fail"))}async _getUserMedia3(){this.log(this.TAG_NAME,"getUserMedia3");try{const e=await navigator.mediaDevices.getUserMedia({audio:{latency:!0,noiseSuppression:!0,autoGainControl:!0,echoCancellation:!0,sampleRate:48e3,channelCount:1},video:!1});console.log("getUserMedia() got stream:",e),this.log(this.TAG_NAME,"getUserMedia3 success")}catch(e){this.log(this.TAG_NAME,"getUserMedia3 fail")}}_handleStreamInactive(e){this.userMediaStream&&(this.warn(this.TAG_NAME,"stream oninactive",e),this.emit(nt.talkStreamInactive))}_startCheckGetUserMediaTimeout(){this._stopCheckGetUserMediaTimeout(),this.checkGetUserMediaTimeout=setTimeout((()=>{this.log(this.TAG_NAME,"check getUserMedia timeout"),this.emit(nt.talkGetUserMediaTimeout)}),this._opt.getUserMediaTimeout)}_stopCheckGetUserMediaTimeout(){this.checkGetUserMediaTimeout&&(this.log(this.TAG_NAME,"stop checkGetUserMediaTimeout"),clearTimeout(this.checkGetUserMediaTimeout),this.checkGetUserMediaTimeout=null)}_startHeartInterval(){this.heartInterval=setInterval((()=>{this.log(this.TAG_NAME,"heart interval");let e=[35,36,0,0,0,0,0,0];e=new Uint8Array(e),this.socket.send(e.buffer)}),15e3)}_stopHeartInterval(){this.heartInterval&&(this.log(this.TAG_NAME,"stop heart interval"),clearInterval(this.heartInterval),this.heartInterval=null)}startTalk(e){return new Promise(((t,i)=>{if(!function(){let e=!1;const t=window.navigator;return t&&(e=!(!t.mediaDevices||!t.mediaDevices.getUserMedia),e||(e=!!(t.getUserMedia||t.webkitGetUserMedia||t.mozGetUserMedia||t.msGetUserMedia))),e}())return i("not support getUserMedia");if(this.wsUrl=e,this._opt.testMicrophone)this._doTalk();else{if(!this.wsUrl)return i("wsUrl is null");this._createWebSocket().catch((e=>{i(e)}))}this.once(nt.talkGetUserMediaFail,(()=>{i("getUserMedia fail")})),this.once(nt.talkGetUserMediaSuccess,(()=>{t()}))}))}setVolume(e){e=parseFloat(e).toFixed(2),isNaN(e)||(e=oa(e,0,1),this.gainNode.gain.value=e)}getOption(){return this._opt}get volume(){return this.gainNode?parseFloat(100*this.gainNode.gain.value).toFixed(0):null}}class sv{constructor(e){this.player=e,this.globalSetting=null;const t=Sa();this.defaultSettings={watermark_id:`JbPro_${t}`,watermark_prefix:`JbPro_mask_${t}`,watermark_txt:"JbPro 测试水印",watermark_x:0,watermark_y:0,watermark_rows:0,watermark_cols:0,watermark_x_space:0,watermark_y_space:0,watermark_font:"微软雅黑",watermark_color:"black",watermark_fontsize:"18px",watermark_alpha:.15,watermark_width:150,watermark_height:100,watermark_angle:15,watermark_parent_width:0,watermark_parent_height:0,watermark_parent_node:null},this.player.debug.log("Watermark","int")}destroy(){this._removeMark(),this.globalSetting=null,this.defaultSettings=null,this.player.debug.log("Watermark","destroy")}remove(){this._removeMark()}load(e){this.globalSetting=e,this._loadMark(e)}resize(){this.player.debug.log("Watermark","resize()"),this.globalSetting&&this._loadMark(this.globalSetting)}_loadMark(){let e=this.defaultSettings;if(1===arguments.length&&"object"==typeof arguments[0]){var t=arguments[0]||{};for(let i in t)t[i]&&e[i]&&t[i]===e[i]||(t[i]||0===t[i])&&(e[i]=t[i])}var i=document.getElementById(e.watermark_id);i&&i.parentNode&&i.parentNode.removeChild(i);var s="string"==typeof e.watermark_parent_node?document.getElementById(e.watermark_parent_node):e.watermark_parent_node,r=s||document.body;const a=r.getBoundingClientRect();var o=Math.max(r.scrollWidth,r.clientWidth,a.width),n=Math.max(r.scrollHeight,r.clientHeight,a.height),l=arguments[0]||{},d=r;(l.watermark_parent_width||l.watermark_parent_height)&&d&&(e.watermark_x=e.watermark_x+0,e.watermark_y=e.watermark_y+0);var h=document.getElementById(e.watermark_id),c=null;if(h)h.shadowRoot&&(c=h.shadowRoot);else{(h=document.createElement("div")).id=e.watermark_id,h.setAttribute("style","pointer-events: none !important; display: block !important"),c="function"==typeof h.attachShadow?h.attachShadow({mode:"open"}):h;var u=r.children,p=Math.floor(Math.random()*(u.length-1))+1;u[p]?r.insertBefore(h,u[p]):r.appendChild(h)}e.watermark_cols=parseInt((o-e.watermark_x)/(e.watermark_width+e.watermark_x_space));var f,m=parseInt((o-e.watermark_x-e.watermark_width*e.watermark_cols)/e.watermark_cols);e.watermark_x_space=m?e.watermark_x_space:m,e.watermark_rows=parseInt((n-e.watermark_y)/(e.watermark_height+e.watermark_y_space));var g,y,A,b=parseInt((n-e.watermark_y-e.watermark_height*e.watermark_rows)/e.watermark_rows);e.watermark_y_space=b?e.watermark_y_space:b,s?(f=e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),g=e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1)):(f=0+e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),g=0+e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1));for(var v=0;v\n \n \n ${m.watermark_txt}\n \n \n ${m.watermark_txt}\n \n \n \n \n `,_=window.btoa(unescape(encodeURIComponent(v)));var S=document.createElement("div");S.style.position="absolute",S.style.left="0px",S.style.top="0px",S.style.overflow="hidden",S.style.zIndex="9999999",S.style.width=o+"px",S.style.height=n+"px",S.style.display="block",S.style["-ms-user-select"]="none",S.style.backgroundImage=`url(data:image/svg+xml;base64,${_})`,c.appendChild(S)}_removeMark(){const e=this.defaultSettings;var t=document.getElementById(e.watermark_id);if(t){var i=t.parentNode;i&&i.removeChild(t)}}_calcTextSize(){const{watermark_txt:e,watermark_font:t,watermark_fontsize:i}=this.globalSetting,s=document.createElement("span");s.innerHTML=e,s.setAttribute("style",`font-family: ${t}; font-size: ${i}px; visibility: hidden; display: inline-block`),document.querySelector("body").appendChild(s);const r={width:s.offsetWidth,height:s.offsetHeight};return s.remove(),r}}const av="right",ov="left",nv="up",lv="down",dv="leftUp",hv="leftDown",cv="rightUp",uv="rightDown",pv="zoomExpand",fv="zoomNarrow",mv="apertureFar",gv="apertureNear",yv="focusFar",Av="focusNear",bv="setPos",vv="calPos",_v="delPos",Sv="wiperOpen",wv="wiperClose",Ev="cruiseStart",Tv={stop:0,fiStop:0,right:1,left:2,up:8,down:4,leftUp:10,leftDown:6,rightUp:9,rightDown:5,zoomExpand:16,zoomNarrow:32,apertureFar:72,apertureNear:68,focusFar:66,focusNear:65,setPos:129,calPos:130,delPos:131,wiperOpen:140,wiperClose:141,setCruise:132,decCruise:133,cruiseStart:136,cruiseStop:0},kv=[25,50,75,100,125,150,175,200,225,250],Cv=[1,2,3,4,5,6,7,8,9,16],xv=[16,48,80,112,144,160,176,192,208,224];function Rv(e){const{type:t,speed:i=5,index:s=0}=e,r=function(e){return kv[(e=e||5)-1]||kv[4]}(i);let a,o,n,l;if(a=Tv[t],!a)return"";switch(t){case nv:case lv:case mv:case gv:n=r;break;case av:case ov:case yv:case Av:o=r;break;case dv:case hv:case cv:case uv:o=r,n=r;break;case pv:case fv:l=function(e){return xv[(e=e||5)-1]||xv[4]}(i);break;case vv:case _v:case bv:n=Dv(s);break;case wv:case Sv:o=1;break;case Ev:o=Dv(s)}return function(e,t,i,s){let r=[];r[0]=165,r[1]=15,r[2]=1,r[3]=0,r[4]=0,r[5]=0,r[6]=0,e&&(r[3]=e);t&&(r[4]=t);i&&(r[5]=i);s&&(r[6]=s);return r[7]=(r[0]+r[1]+r[2]+r[3]+r[4]+r[5]+r[6])%256,function(e){let t="";for(let i=0;it)){for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i===t?s[r]=Pv(e[r]):"object"==typeof e[r]?s[r]=Bv(e[r],t,i+1):s[r]=e[r]);return s}}function Iv(){return(new Date).toLocaleString()}class Mv{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player=e,this.TAG_NAME="MemoryLogger",this.logMaxSize=(null==t?void 0:t.logMaxSize)||204800,this.logSize=0,this.logTextArray=[],this.player.debug.log(this.TAG_NAME,"init")}destroy(){this.clear(),this.player.debug.log(this.TAG_NAME,"destroy")}clear(){this.logSize=0,this.logTextArray=[]}logCache(){let e="";try{for(var t=arguments.length,i=new Array(t),s=0;sBv(e)));e="[JbPro] "+Iv()+JSON.stringify(r)}catch(e){return}if(this.logSize+=e.length,this.logTextArray.push(e),this.logSize>this.logMaxSize){const e=this.logTextArray.shift();this.logSize-=e.length}}getLog(){return this.logTextArray.join("\n")}getLogBlob(){const e=this.getLog();return new Blob([e],{type:"text/plain"})}download(){const e=this.getLog();this.clear();const t=new Blob([e],{type:"text/plain"});No(t,"JbPro-"+Iv()+".log")}}class Uv extends So{constructor(e){super(),this.player=e,this.TAG_NAME="Network",this.online=this.isOnline(),this.prevOnline=this.online,this.interval=null,this._initListener(),this.player.debug.log(this.TAG_NAME,"init")}destroy(){this.off(),this._stopCheck(),window.removeEventListener("online",this._updateOnlineStatus),window.removeEventListener("offline",this._updateOfflineStatus),this.player.debug.log(this.TAG_NAME,"destroy")}_initListener(){window.addEventListener("online",this._updateOnlineStatus.bind(this)),window.addEventListener("offline",this._updateOfflineStatus.bind(this))}_stopCheck(){this.interval&&(clearInterval(this.interval),this.interval=null)}_startCheck(){this.interval=setInterval((()=>{this.isOnline()!==this.prevOnline&&(this.isOnline()?this._updateOnlineStatus():this._updateOfflineStatus())}),1e3)}_updateOnlineStatus(){this.prevOnline=this.online,this.online=!0,this.logStatus(),this.emit("online")}_updateOfflineStatus(){this.prevOnline=this.online,this.online=!1,this.logStatus(),this.emit("offline")}logStatus(){const e=this.prevOnline?"online":"offline",t=this.online?"online":"offline";this.player.debug.log(this.TAG_NAME,`prevOnline: ${this.prevOnline}, online: ${this.online}, status: ${e} -> ${t}`)}isOnline(){return void 0===navigator.onLine||navigator.onLine}isOffline(){return!this.isOnline()}}class Fv extends So{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this._opt={},this.TAG_NAME="JbPro",this.$container=null,Object.keys(e).forEach((t=>{if(void 0===e[t])throw new Error(`JbPro option "${t}" can not be undefined`)})),this.originalOptions=e;const t=lo();let i=Object.assign({},t,e);i.url="",i.isMulti&&(i.debugUuid="xxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))),this.debug=new Pr(this),this.debug.log("JbPro","init");let s=e.container;if("string"==typeof e.container&&(s=document.querySelector(e.container)),!s)throw this.debug.error("JbPro","JbPro need container option and now container is",e.container),new Error("JbPro need container option");if(i.decoder&&po(-1!==i.decoder.indexOf("decoder-pro.js")||-1!==i.decoder.indexOf("decoder-pro-simd.js")))throw this.debug.error("JbPro",`JbPro decoder ${i.decoder} must be decoder-pro.js or decoder-pro-simd.js`),new Error(`JbPro decoder ${i.decoder} must be decoder-pro.js or decoder-pro-simd.js`);if("CANVAS"===s.nodeName||"VIDEO"===s.nodeName)throw this.debug.error("JbPro",`JbPro container type can not be ${s.nodeName} type`),new Error(`JbPro container type can not be ${s.nodeName} type`);if(i.videoBuffer>=i.heartTimeout)throw this.debug.error("JbPro",`JbPro videoBuffer ${i.videoBuffer}s must be less than heartTimeout ${i.heartTimeout}s`),new Error(`JbPro videoBuffer ${i.videoBuffer}s must be less than heartTimeout ${i.heartTimeout}s`);if(this._checkHasCreated(s))throw this.debug.error("JbPro","JbPro container has been created and can not be created again",s),new Error("JbPro container has been created and can not be created again",s);if(!s.classList)throw this.debug.error(this.TAG_NAME,"JbPro container is invalid, must be a DOM Element",s),new Error("JbPro container is invalid, must be a DOM Element",s);var r,a,o;if(i.videoBuffer>10&&console.warn("JbPro",`videoBuffer ${i.videoBuffer}s is too long, will black screen for ${i.videoBuffer}s , it is recommended to set it to less than 10s`),s.classList.add("jb-pro-container"),r=s,a=ee,o=Sa(),r&&(r.dataset?r.dataset[a]=o:r.setAttribute("data-"+a,o)),po(i.isLive)){const e=document.createElement("video");return e.muted=!0,e.setAttribute("controlsList","nodownload"),e.disablePictureInPicture="disablePictureInPicture",e.style.position="absolute",e.style.top=0,e.style.left=0,e.style.height="100%",e.style.width="100%",s.appendChild(e),this.$videoElement=e,this.$container=s,void(this._opt=i)}if(delete i.container,Ba(i.videoBuffer)&&(i.videoBuffer=1e3*Number(i.videoBuffer)),Ba(i.videoBufferDelay)&&(i.videoBufferDelay=1e3*Number(i.videoBufferDelay)),Ba(i.networkDelay)&&(i.networkDelay=1e3*Number(i.networkDelay)),Ba(i.aiFaceDetectInterval)&&(i.aiFaceDetectInterval=1e3*Number(i.aiFaceDetectInterval)),Ba(i.aiObjectDetectInterval)&&(i.aiObjectDetectInterval=1e3*Number(i.aiObjectDetectInterval)),Ba(i.timeout)&&(La(i.loadingTimeout)&&(i.loadingTimeout=i.timeout),La(i.heartTimeout)&&(i.heartTimeout=i.timeout)),Ba(i.autoWasm)&&(La(i.decoderErrorAutoWasm)&&(i.decoderErrorAutoWasm=i.autoWasm),La(i.hardDecodingNotSupportAutoWasm)&&(i.hardDecodingNotSupportAutoWasm=i.autoWasm)),Ba(i.aiFaceDetectLevel)&&La(i.aiFaceDetectWidth)){const e=or[i.aiFaceDetectLevel];e&&(i.aiFaceDetectWidth=e)}if(Ba(i.aiObjectDetectLevel)&&La(i.aiObjectDetectWidth)){const e=nr[i.aiObjectDetectLevel];e&&(i.aiObjectDetectWidth=e)}uo(i.isCrypto)&&(i.isM7sCrypto=!0),this._opt=i,this._destroyed=!1,this.$container=s,this._tempPlayBgObj={},this._tempVideoLastIframeInfo={},this._tempPlayerIsMute=!0,this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this._streamErrorReplayTimes=0,this._streamEndReplayTimes=0,this._websocket1006ErrorReplayTimes=0,this.events=new _o(this),this._opt.isUseNewFullscreenWatermark?this.watermark=new rv(this):this.watermark=new sv(this),this.memoryLogger=new Mv(this),this.network=new Uv(this),this._websocket1006ErrorRetryLog=[],this._mseDecodeErrorRetryLog=[],this._wcsDecodeErrorRetryLog=[],this._isNetworkOfflinePaused=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this.widthOrHeightChangeReplayDelayTimeout=null,this.streamErrorReplayDelayTimeout=null,this.streamEndReplayDelayTimeout=null,this.$loadingBgImage=null,this.$loadingBg=null,this._initPlayer(s,i),this._initWatermark(),this._initNetwork(),this.debug.log("JbPro",'init success and version is "4-1-2024"'),console.log('JbPro Version is "4-1-2024"')}destroy(){return new Promise(((e,t)=>{this.debug.log("JbPro","destroy()"),this._destroyed=!0,this.off(),this._removeTimeout(),this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$container&&this.$container.removeChild(this.$videoElement),this.$videoElement=null),this._removeLoadingBackgroundForIOS(),this.player?this.player.destroy().then((()=>{this.player=null,this._destroy(),e()})).catch((()=>{t()})):(this._destroy(),e())}))}_removeTimeout(){this.widthOrHeightChangeReplayDelayTimeout&&(clearTimeout(this.widthOrHeightChangeReplayDelayTimeout),this.widthOrHeightChangeReplayDelayTimeout=null),this.streamErrorReplayDelayTimeout&&(clearTimeout(this.streamErrorReplayDelayTimeout),this.streamErrorReplayDelayTimeout=null),this.streamEndReplayDelayTimeout&&(clearTimeout(this.streamEndReplayDelayTimeout),this.streamEndReplayDelayTimeout=null)}_destroy(){var e,t;this.events&&(this.events.destroy(),this.events=null),this.talk&&(this.talk.destroy(),this.talk=null),this.watermark&&(this.watermark.destroy(),this.watermark=null),this.network&&(this.network.destroy(),this.network=null),this.memoryLogger&&(this.memoryLogger.destroy(),this.memoryLogger=null),this.$container&&(this.$container.classList.remove("jb-pro-container"),this.$container.classList.remove("jb-pro-fullscreen-web"),e=this.$container,t=ee,e&&(e.dataset?delete e.dataset[t]:e.removeAttribute("data-"+t)),this.$container=null),this._tempPlayBgObj=null,this._tempVideoLastIframeInfo=null,this._isNetworkOfflinePaused=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this._tempPlayerIsMute=!0,this._resetReplayTimes(),this.debug&&this.debug.log("JbPro","destroy end"),this._opt=null,this.debug=null}_resetReplayTimes(){this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this._streamErrorReplayTimes=0,this._streamEndReplayTimes=0,this._websocket1006ErrorReplayTimes=0,this._websocket1006ErrorRetryLog=[],this._mseDecodeErrorRetryLog=[],this._wcsDecodeErrorRetryLog=[]}_getOriginalOpt(){const e=lo();return Object.assign({},e,this.originalOptions)}_initPlayer(e,t){this.player=new Yb(e,t),this._bindEvents()}_initTalk(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.talk&&(this.talk.destroy(),this.talk=null),this.player&&(e.debug=this.player._opt.debug),this.talk=new iv(this.player,e),this.debug.log("JbPro","_initTalk",this.talk.getOption()),this._bindTalkEvents()}_resetPlayer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(((t,i)=>{this.debug.log(this.TAG_NAME,"_resetPlayer()",JSON.stringify(e));const s=()=>{this._opt.url="",this._opt.playOptions={},this._opt=Object.assign(this._opt,e),this._initPlayer(this.$container,this._opt)};this.player?this.player.destroy().then((()=>{this.player=null,s(),this.debug.log(this.TAG_NAME,"_resetPlayer() end"),t()})).catch((()=>{i()})):(s(),this.debug.log(this.TAG_NAME,"_resetPlayer() end"),t())}))}_bindEvents(){var e=this;Object.keys(lt).forEach((t=>{this.player.on(lt[t],(function(){for(var i=arguments.length,s=new Array(i),r=0;r{this.player&&this.player.showTipsMessageByCode(e)})),this.player.once(nt.beforeDestroy,(()=>{this.emit(nt.close),this.destroy().then((()=>{})).catch((e=>{}))})),this.player.on(nt.resize,(()=>{this.watermark&&this.watermark.resize()})),this.player.on(nt.fullscreen,(()=>{this.watermark&&this.watermark.resize()})),this.player.on(nt.videoInfo,(()=>{this.player&&(this.player.singleWatermark&&this.player.singleWatermark.resize(),this.player.ghostWatermark&&this.player.ghostWatermark.resize(),this.player.dynamicWatermark&&this.player.dynamicWatermark.resize())})),this.player.on(nt.memoryLog,(function(){e.memoryLogger.logCache(...arguments)})),this.player.on(nt.downloadMemoryLog,(()=>{this.downloadMemoryLog()}))}_bindTalkEvents(){Object.keys(dt).forEach((e=>{this.player.on(dt[e],(t=>{this.emit(e,t)}))}))}_initWatermark(){if(Va(this._opt.fullscreenWatermarkConfig)){const e=Ma(this.$container,this._opt.fullscreenWatermarkConfig);if(!e.watermark_txt)return void this.debug.warn("JbPro","fullscreenWatermarkConfig text is empty");this.watermark.load(e)}}_initNetwork(){this.network.on(nt.online,(()=>{if(this.emit(nt.networkState,nt.online),this.isDestroyed())this.debug.log(this.TAG_NAME,"network online and JbPro is destroyed");else if(this._isNetworkOfflinePaused&&this._isNetworkOfflinePausedAndNextPlayConfig&&this._isNetworkOfflinePausedAndNextPlayConfig.url){const e=this._isNetworkOfflinePausedAndNextPlayConfig.url,t=this._isNetworkOfflinePausedAndNextPlayConfig.playOptions;this._streamErrorReplayTimes++;const i=this._isNetworkOfflinePausedAndNextPlayConfig.type||"unknown";this._isNetworkOfflinePaused=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this.debug.log(this.TAG_NAME,`${i} and network online and reset player and play`),this.play(e,t).then((()=>{this.debug.log(this.TAG_NAME,`${i} and network online and play success`)})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.fetchError,{},error),this.debug.error(this.TAG_NAME,`${i} and network online and play error`,e)}))}})),this.network.on(nt.offline,(()=>{this.emit(nt.networkState,nt.offline)}))}_checkHasCreated(e){if(!e)return!1;const t=function(e,t){return e?e.dataset?e.dataset[t]:e.getAttribute("data-"+t):""}(e,ee);return!!t}isDestroyed(){return this._destroyed}getOption(){return this.player?this.player.getOption():{}}setDebug(e){this.debug.log("JbPro",`setDebug() ${e}`),this._opt.debug=!!e,this.player?this.player.updateOption({debug:!!e},!0):this.debug.warn("JbPro","player is not init")}getIsDebug(){let e=!1;return this.player&&(e=this.player._opt.debug),e}mute(){this.debug.log("JbPro","mute()"),this.player&&this.player.mute(!0)}cancelMute(){this.debug.log("JbPro","cancelMute()"),this.player&&this.player.mute(!1)}setVolume(e){this.debug.log("JbPro",`setVolume() ${e}`),this.player&&(this.player.volume=e)}getVolume(){let e=null;return this.player&&(e=this.player.volume,e=parseFloat(e).toFixed(2)),e}audioResume(){this.debug.log("JbPro","audioResume()"),this.player&&this.player.audio?this.player.audio.audioEnabled(!0):this.debug.warn("JbPro","audioResume error")}setTimeout(e){this.debug.log("JbPro",`setTimeout() ${e}`),e=Number(e),isNaN(e)?this.debug.warn("JbPro",`setTimeout error: ${e} is not a number`):(this._opt.timeout=e,this._opt.loadingTimeout=e,this._opt.heartTimeout=e,this.player&&this.player.updateOption({timeout:e,loadingTimeout:e,heartTimeout:e}))}setScaleMode(e){this.debug.log("JbPro",`setScaleMode() ${e}`),this.player?this.player.setScaleMode(e):this.debug.warn("JbPro","setScaleMode() player is null")}pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{this.debug.log("JbPro",`pause() ${e}`),(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&(this._tempPlayBgObj=this._getVideoLastIframeInfo()),this._tempPlayerIsMute=this.isMute(),this._pause(e).then((e=>{t(e)})).catch((e=>{i(e)}))}))}_pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{if(this.debug.log("JbPro",`_pause() ${e}`),this.isDestroyed())return i("JbPro is destroyed");this._resetReplayTimes(),this.player?this.player.pause(e).then((e=>{t(e)})).catch((e=>{i(e)})):i("player is null")}))}close(){return new Promise(((e,t)=>{this.debug.log("JbPro","close()"),this._opt.url="",this._resetReplayTimes(),this.player?this.player.close().then((()=>{e()})).catch((e=>{t(e)})):t("player is null")}))}clearView(){this.debug.log("JbPro","clearView()"),this.player&&this.player.video?this.getRenderType()===$?this.player.video.clearView():this.debug.warn("JbPro","clearView","render type is video, not support clearView, please use canvas render type"):this.debug.warn("JbPro","clearView","player is null")}play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(this.debug.log("JbPro",`play() ${e}`,JSON.stringify(t)),!e&&!this._opt.url)return this.emit(nt.error,ct.playError),void s("url is null and this._opt.url is null");if(e&&(e=(""+e).trim(),-1===e.indexOf("http:")&&-1===e.indexOf("https:")&&-1===e.indexOf("webrtc:")&&-1===e.indexOf("ws:")&&-1===e.indexOf("wss:")&&-1===e.indexOf("wt:")&&-1===e.indexOf("artc:")))return s(`url ${e} must be "http:" or "https:" or "webrtc:" or "ws:" or "wss:" or "wt:" or "artc:" protocol`);if(po(this._opt.isLive))return this.$videoElement.controls="controls",this.$videoElement.muted=!1,this.$videoElement.src=e,this.$videoElement.play(),void i(this.$videoElement);if(this._opt.isM7sCrypto){let r=t.cryptoKey||this._opt.playOptions.cryptoKey,a=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.m7sCryptoKey&&(!r||!a)){const e=this._opt.m7sCryptoKey.split(".");r=ao(e[0]),a=ao(e[1])}if(!r||!a){const r=e||this._opt.url;return void this._cryptoPlay(r).then((r=>{let{cryptoIV:a,cryptoKey:o}=r;this._opt.playOptions.cryptoKey=o,this._opt.playOptions.cryptoIV=a,t.cryptoIV=a,t.cryptoKey=o,this._playBefore(e,t).then((()=>{i()})).catch((e=>{s(e)}))})).catch((e=>{s(e)}))}this._opt.playOptions.cryptoKey=r,this._opt.playOptions.cryptoIV=a,t.cryptoIV=a,t.cryptoKey=r}else if(this._opt.isXorCrypto){let e=t.cryptoKey||this._opt.playOptions.cryptoKey,i=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.xorCryptoKey&&(!e||!i)){const t=this._opt.xorCryptoKey.split(".");e=ao(t[0]),i=ao(t[1])}e&&i&&(this._opt.playOptions.cryptoKey=e,this._opt.playOptions.cryptoIV=i,t.cryptoIV=i,t.cryptoKey=e)}this._playBefore(e,t).then((()=>{i()})).catch((e=>{s(e)}))}))}_playBefore(e,t){return new Promise(((i,s)=>{if(this.player)if(e)if(this._opt.url)if(e===this._opt.url)if(this.player.playing)this.debug.log("JbPro","_playBefore","playing and resolve()"),i();else{this.debug.log("JbPro","_playBefore","this._opt.url === url and pause -> play and destroy play");let e=this._getOriginalOpt();(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&this._tempPlayBgObj&&this._tempPlayBgObj.loadingBackground&&(e=Object.assign(e,this._tempPlayBgObj)),po(this._tempPlayerIsMute)&&(e.isNotMute=!0,this._tempPlayerIsMute=!0);const t=this._opt.url,r=this._opt.playOptions;this._resetPlayer(e).then((()=>{this._play(t,r).then((()=>{i()})).catch((e=>{this.debug.error("JbPro","_playBefore this.player.play error",e),this.emit(nt.crashLog,this.getCrashLog("this.player.play 1",e)),s(e)}))})).catch((e=>{this.debug.error("JbPro","_resetPlayer error",e)}))}else{this.debug.log("JbPro","_playBefore",`\n this._url.url is ${this._opt.url}\n and new url is ${e}\n and destroy and play new url`);const r=this._getOriginalOpt();this._resetPlayer(r).then((()=>{this._play(e,t).then((()=>{i()})).catch((e=>{this.debug.error("JbPro","_playBefore _play error",e),this.emit(nt.crashLog,this.getCrashLog("this.player.play 2",e)),s(e)}))})).catch((e=>{this.debug.error("JbPro","_resetPlayer error",e)}))}else this._play(e,t).then((()=>{i()})).catch((e=>{this.debug.error("JbPro","_playBefore _play error",e),this.emit(nt.crashLog,this.getCrashLog("this.player.play 3",e)),s(e)}));else{let e=this._getOriginalOpt();(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&this._tempPlayBgObj&&this._tempPlayBgObj.loadingBackground&&(e=Object.assign(e,this._tempPlayBgObj)),po(this._tempPlayerIsMute)&&(e.isNotMute=!0,this._tempPlayerIsMute=!0);const t=this._opt.url,r=this._opt.playOptions;this._resetPlayer(e).then((()=>{this._play(t,r).then((()=>{i()})).catch((e=>{this.debug.error("JbPro","_playBefore _play error",e),this.emit(nt.crashLog,this.getCrashLog("this.player.play 4",e)),s(e)}))})).catch((e=>{this.debug.error("JbPro","_resetPlayer error",e)}))}else e?this._play(e,t).then((()=>{i()})).catch((e=>{this.debug.error("JbPro","_playBefore _play error",e),this.emit(nt.crashLog,this.getCrashLog("this.player.play 5",e)),s(e)})):this._play(this._opt.url,this._opt.playOptions).then((()=>{i()})).catch((e=>{this.debug.error("JbPro","_playBefore _play error",e),this.emit(nt.crashLog,this.getCrashLog("this.player.play 6",e)),s(e)}))}))}_cryptoPlay(e){return new Promise(((t,i)=>{const s=function(e){const t=(e||document.location.toString()).split("//"),i=t[1].indexOf("/");let s=t[1].substring(i);return-1!=s.indexOf("?")&&(s=s.split("?")[0]),s}(e);let r=this._opt.cryptoKeyUrl,a="";const o=oo(e);if(r){if(a=r,this._opt.isM7sCrypto&&-1===a.indexOf("/crypto/?stream=")){const e=oo(r);a=e.origin+Z+`?stream=${s}`}}else r=o.origin+Z,a=r+`?stream=${s}`;var n;this.player.debug.log("JbPro",`_cryptoPlay() cryptoKeyUrl: ${a} and opt.cryptoKeyUrl: ${this._opt.cryptoKeyUrl}`),(n=a,new Promise(((e,t)=>{bl.get(n).then((t=>{e(t)})).catch((e=>{t(e)}))}))).then((e=>{if(e){const s=e.split("."),r=ao(s[0]),a=ao(s[1]);a&&r?t({cryptoIV:a,cryptoKey:r}):i("get cryptoIV or cryptoKey error")}else i(`cryptoKeyUrl: getM7SCryptoStreamKey ${a} res is null`)})).catch((e=>{i(e)}))}))}playback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(this.debug.log("JbPro",`playback() ${e}, options: ${JSON.stringify(t)}`),po(this._opt.isLive))return s("this._opt.isLive is false, can not playback");const r=ho(),a=Object.assign({},r.playbackConfig,this._opt.playbackConfig,t);a.isUseFpsRender||a.isCacheBeforeDecodeForFpsRender&&(a.isCacheBeforeDecodeForFpsRender=!1,this.debug.warn("JbPro","playbackConfig.isUseFpsRender is false, isCacheBeforeDecodeForFpsRender can not be ture, isCacheBeforeDecodeForFpsRender is set to false")),0===a.rateConfig.length&&a.showRateBtn&&(a.showRateBtn=!1,this.debug.warn("JbPro","playbackConfig.rateConfig.length is 0, showRateBtn can not be ture, showRateBtn is set to false")),a.controlType,Q.simple,this._resetPlayer({videoBuffer:0,playbackConfig:a,playType:_,openWebglAlignment:!0,useMSE:a.useMSE,useWCS:a.useWCS,useSIMD:!0}).then((()=>{this.play(e,t).then((()=>{i()})).catch((e=>{s(e)}))})).catch((e=>{s(e)}))}))}playbackPause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.debug.log("JbPro",`playbackPause() ${e}`),this._opt.playType===b?Promise.reject("playType is player, can not call playbackPause method"):new Promise(((t,i)=>{if(!this.player)return i("player is null");uo(e)?this._pause().then((()=>{t()})).catch((e=>{i(e)})):(this.player.playbackPause=!0,t())}))}playbackResume(){return this.debug.log("JbPro","playbackResume()"),this._opt.playType===b?Promise.reject("playType is player, can not call playbackResume method"):new Promise(((e,t)=>{if(!this.player)return t("player is null");this.player.playbackPause=!1,e()}))}forward(e){return this.debug.log("JbPro",`forward() ${e}`),po(this._opt.isLive)||this._opt.playType===b?Promise.reject("forward() method only just for playback type"):Ta(Number(e))?new Promise(((t,i)=>{this.player?(e=oa(Number(e),.1,32),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"playbackRate",value:e}),this.player.playback.setRate(e),this.player.video&&this.player.video.setRate(e),this.player.audio&&this.player.audio.setRate(e),(this.player.isPlaybackUseWCS()||this.player.isPlaybackUseMSE())&&(this.player.demux.dropBuffer$2(),this.player.isPlaybackCacheBeforeDecodeForFpsRender()&&this.player.demux.initPlaybackCacheLoop()),t()):i("player is not playing")})):Promise.reject(`forward() params "rate": ${e} must be number type`)}playbackForward(e){return this.forward(e)}normal(){return this.forward(1)}playbackNormal(){return this.normal()}updatePlaybackForwardMaxRateDecodeIFrame(e){this.debug.log("JbPro",`updatePlaybackForwardMaxRateDecodeIFrame() ${e}`),e=Number(e),e=oa(e=parseInt(e,10),1,8),this._opt.playbackForwardMaxRateDecodeIFrame=e,this.player?this.player.updateOption({playbackForwardMaxRateDecodeIFrame:e},!0):this.debug.warn("JbPro","updatePlaybackForwardMaxRateDecodeIFrame() player is null")}setPlaybackStartTime(e){this.debug.log("JbPro",`setPlaybackStartTime() ${e}`);const t=Ga(e);this.player?this.player.isPlayback()?t<10&&0!==e&&this.player.playback.isControlTypeNormal()?this.debug.warn("JbPro",`setPlaybackStartTime() control type is normal and timestamp: ${e} is not valid`):this.player.playback.isControlTypeSimple()&&e>this.player.playback.totalDuration?this.debug.warn("JbPro",`setPlaybackStartTime() control type is simple and timestamp: ${e} is more than ${this.player.playback.totalDuration}`):this.player.playing&&(this.player.playback.isControlTypeNormal()&&10===t&&(e*=1e3),this.player.playback.setStartTime(e),this.playbackClearCacheBuffer()):this.debug.warn("JbPro","setPlaybackStartTime() playType is not playback"):this.debug.warn("JbPro","setPlaybackStartTime() player is null")}setPlaybackShowPrecision(e){this.debug.log("JbPro",`setPlaybackShowPrecision() ${e}`),this.player?this.player.isPlayback()?this.player.playback.isControlTypeNormal()?this.player.playback.setShowPrecision(e):this.debug.warn("JbPro","control type is not normal , not support!"):this.debug.warn("JbPro","playType is not playback"):this.debug.warn("JbPro","player is null")}playbackCurrentTimeScroll(){this.debug.log("JbPro","playbackCurrentTimeScroll()"),this.player?this.player.isPlayback()?this.player.playback.isControlTypeNormal()?this.player.playback.currentTimeScroll():this.debug.warn("JbPro","control type is not normal , not support!"):this.debug.warn("JbPro","playType is not playback"):this.debug.warn("JbPro","player is null")}playbackClearCacheBuffer(){this.debug.log("JbPro","playbackClearCacheBuffer()"),this.player?this.player.isPlayback()?(this.player.video&&this.player.video.clear(),this.player.audio&&this.player.audio.clear(),this.clearBufferDelay()):this.debug.warn("JbPro","playType is not playback"):this.debug.warn("JbPro","player is null")}getPlaybackCurrentRate(){if(this.player){if(this.player.isPlayback())return this.player.getPlaybackRate();this.debug.warn("JbPro","playType is not playback")}else this.debug.warn("JbPro","player is null")}updatePlaybackLocalOneFrameTimestamp(e){this.debug.log("JbPro",`updatePlaybackLocalOneFrameTimestamp() ${e}`),this.player?this.player.isPlayback()?this.player.playback.updateLocalOneFrameTimestamp(e):this.debug.warn("JbPro","playType is not playback"):this.debug.warn("JbPro","player is null")}setStreamQuality(e){if(this.debug.log("JbPro",`setStreamQuality() ${e}`),!this.player)return void this.debug.warn("JbPro","player is null");if(!this.player._opt.operateBtns.quality)return void this.debug.warn("JbPro","player._opt.operateBtns.quality is false");(this.player._opt.qualityConfig||[]).includes(e)?this.player.streamQuality=e:this.debug.warn("JbPro",`quality: ${e} is not in qualityList`)}_play(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((s,r)=>{if(!this.player)return r("player is null");let u=!1;this._opt.url&&this._opt.url!==t&&(u=!0),this._opt.url=t,this._opt.playOptions=i;const p=t.split("?")[0],f=p.startsWith("http://")||p.startsWith("https://"),m=p.startsWith("webrtc://"),g=p.startsWith("artc://"),y=p.startsWith("wt://"),A=p.startsWith("ws://")||p.startsWith("wss://"),b=f||A,v=f&&p.endsWith(".m3u8"),_=b&&p.endsWith(".flv"),S=b&&(p.endsWith(".fmp4")||p.endsWith(".mp4")),w=b&&p.endsWith(".mpeg4"),E=b&&(p.endsWith(".h264")||p.endsWith(".h265")),M=b&&p.endsWith(".ts");let U=this._opt.isWebrtcForZLM||!1,F=this._opt.isWebrtcForSRS||!1,O=this._opt.isWebrtcForOthers||!1;m&&(-1!==t.indexOf("/index/api/webrtc")?(U=!0,F=!1,O=!1):-1!==t.indexOf("/rtc/v1/play/")&&(F=!0,U=!1,O=!1));let j=null,z=null;if(_&&po(this._opt.isFlv)&&this._resetDemuxType("isFlv"),S&&po(this._opt.isFmp4)&&this._resetDemuxType("isFmp4"),w&&po(this._opt.isMpeg4)&&this._resetDemuxType("isMpeg4"),E&&po(this._opt.isNakedFlow)&&this._resetDemuxType("isNakedFlow"),M&&po(this._opt.isTs)&&this._resetDemuxType("isTs"),f?j=v?n:o:y?j=d:m?j=l:g?j=h:A&&(j=a),this._opt.isNakedFlow?z=D:this._opt.isFmp4?z=L:this._opt.isMpeg4?z=P:this._opt.isFlv?z=T:this._opt.isTs?z=I:v?z=C:m?z=x:g?z=B:y?z=R:A&&(z=k),!j||!z)return this._opt.playFailedAndPausedShowMessage&&this.showErrorMessageTips("url is not support"),r(`play url ${t} is invalid, protocol is ${c[j]}, demuxType is ${z}`);this.debug.log("JbPro",`play url ${t} protocol is ${c[j]}, demuxType is ${z}`);const G=()=>{this.player.once(ct.webglAlignmentError,(e=>{if(this.isDestroyed())this.debug.log("JbPro","webglAlignmentError but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.webglAlignmentError,e)),this.player&&this.player._opt.webglAlignmentErrorReplay){this.debug.log("JbPro","webglAlignmentError");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({openWebglAlignment:!0}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","webglAlignmentError and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webglAlignmentError,{},e),this.debug.error("JbPro","webglAlignmentError and play error",t)}))})).catch((e=>{this.debug.error("JbPro","webglAlignmentError and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.webglAlignmentError,{},e),this.debug.log("JbPro","webglAlignmentError and webglAlignmentErrorReplay is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webglAlignmentError,{},e),this.debug.error("JbPro","webglAlignmentError and pause error",t)}))}})),this.player.once(ct.webglContextLostError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","webglContextLostError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.webglContextLostError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.webglContextLostErrorReplay){this.debug.log("JbPro","webglContextLostError");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","webglContextLostError and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.webglContextLostError,t,e),this.debug.error("JbPro","webglContextLostError and play error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.webglContextLostError,t,e),this.debug.error("JbPro","webglContextLostError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.webglContextLostError,t,e),this.debug.log("JbPro","webglContextLostError and webglContextLostErrorReplay is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.webglContextLostError,t,e),this.debug.error("JbPro","webglAlignmentError and pause error",i)}))}})),this.player.once(ct.mediaSourceH265NotSupport,(e=>{if(this.isDestroyed())this.debug.log("JbPro","mediaSourceH265NotSupport but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.mediaSourceH265NotSupport,e)),this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debug.log("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceH265NotSupport,e),this.debug.error("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceH265NotSupport,{},e),this.debug.error("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceH265NotSupport,{},e),this.debug.log("JbPro","mediaSourceH265NotSupport and autoWasm is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceH265NotSupport,{},e),this.debug.error("JbPro","mediaSourceH265NotSupport and pause error",t)}))}})),this.player.once(ct.mediaSourceFull,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","mediaSourceFull but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.mediaSourceFull,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},a=this.player._opt.decoderErrorAutoWasm,o=!0;a?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(Dr)?this._mseDecodeErrorRetryLog.push(aa()):(a=!0,o=!1,r={useMSE:!1,useWCS:!1}),this.debug.log("JbPro",`mediaSourceFull and auto wasm ${po(o)?" and is not meaningful Retry":""} [mse-> ${a?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","mediaSourceFull and reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceFull,t,e),this.debug.error("JbPro","mediaSourceFull and reset player and play error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceFull,t,e),this.debug.error("JbPro","mediaSourceFull and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceFull,t,e),this.debug.log("JbPro","mediaSourceFull and autoWasm is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceFull,t,e),this.debug.error("JbPro","mediaSourceFull and pause error",i)}))}})),this.player.once(ct.mediaSourceAppendBufferError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","mediaSourceAppendBufferError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.mediaSourceAppendBufferError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},a=this.player._opt.decoderErrorAutoWasm,o=!0;a?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(Dr)?this._mseDecodeErrorRetryLog.push(aa()):(a=!0,o=!1,r={useMSE:!1,useWCS:!1}),this.player.isMSEAudioDecoderError&&(this.player.debug.log("JbPro","mediaSourceAppendBufferError and isMSEAudioDecoderError is true so set mseDecodeAudio = false"),r.mseDecodeAudio=!1),this.debug.log("JbPro",`mediaSourceAppendBufferError and auto wasm ${po(o)?" and is not meaningful Retry":""} [mse-> ${a?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","mediaSourceAppendBufferError and reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAppendBufferError,t,e),this.debug.error("JbPro","mediaSourceAppendBufferError and reset player and play error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAppendBufferError,t,e),this.debug.error("JbPro","mediaSourceAppendBufferError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAppendBufferError,t,e),this.debug.log("JbPro","mediaSourceAppendBufferError and autoWasm is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAppendBufferError,t,e),this.debug.error("JbPro","mediaSourceAppendBufferError and pause error",i)}))}})),this.player.once(ct.mseSourceBufferError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","mseSourceBufferError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.mseSourceBufferError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={};if(this.player._opt.mseDecoderUseWorker)r={mseDecoderUseWorker:!1},this.debug.log("JbPro","mseSourceBufferError auto wasm [mse worker -> mse] reset player and play");else{let e=this.player._opt.decoderErrorAutoWasm,t=!0;e?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(Dr)?this._mseDecodeErrorRetryLog.push(aa()):(e=!0,t=!1,r={useMSE:!1,useWCS:!1}),this.player.isMSEVideoDecoderInitializationFailedNotSupportHevc&&(this.debug.log("JbPro","mseSourceBufferError and isMSEVideoDecoderInitializationFailedNotSupportHevc is true so auto wasm"),r={useMSE:!1,useWCS:!1}),this.debug.log("JbPro",`mseSourceBufferError auto wasm ${po(t)?" and is not meaningful Retry":""} [mse-> ${e?"wasm":"mse"}] reset player and play`)}this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","mseSourceBufferError reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mseSourceBufferError,t,e),this.debug.error("JbPro","mseSourceBufferError reset player and play error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mseSourceBufferError,t,e),this.debug.error("JbPro","mseSourceBufferError _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.mseSourceBufferError,t,e),this.debug.log("JbPro","mseSourceBufferError and autoWasm is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mseSourceBufferError,t,e),this.debug.error("JbPro","mseSourceBufferError and pause error:",i)}))}})),this.player.once(ct.mediaSourceBufferedIsZeroError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","mediaSourceBufferedIsZeroError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.mediaSourceBufferedIsZeroError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},a=this.player._opt.decoderErrorAutoWasm,o=!0;a?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(Dr)?this._mseDecodeErrorRetryLog.push(aa()):(a=!0,o=!1,r={useMSE:!1,useWCS:!1}),this.debug.log("JbPro",`mediaSourceBufferedIsZeroError auto wasm ${po(o)?" and is not meaningful Retry":""} [mse-> ${a?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","mediaSourceBufferedIsZeroError reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceBufferedIsZeroError,t,e),this.debug.error("JbPro","mediaSourceBufferedIsZeroError reset player and play error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceBufferedIsZeroError,t,e),this.debug.error("JbPro","mediaSourceBufferedIsZeroError _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceBufferedIsZeroError,t,e),this.debug.log("JbPro","mediaSourceBufferedIsZeroError and autoWasm is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceBufferedIsZeroError,t,e),this.debug.error("JbPro","mediaSourceBufferedIsZeroError and pause error:",i)}))}})),this.player.once(ct.mseAddSourceBufferError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","mseAddSourceBufferError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.mseAddSourceBufferError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debug.log("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={useMSE:!1,useWCS:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mseAddSourceBufferError,t,e),this.debug.error("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mseAddSourceBufferError,t,e),this.debug.error("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.mseAddSourceBufferError,t,e),this.debug.log("JbPro","mseAddSourceBufferError and autoWasm is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mseAddSourceBufferError,t,e),this.debug.error("JbPro","mseAddSourceBufferError and pause error",i)}))}})),this.player.once(ct.mediaSourceDecoderConfigurationError,(e=>{if(this.isDestroyed())this.debug.log("JbPro","mediaSourceDecoderConfigurationError but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.mediaSourceDecoderConfigurationError,e)),this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debug.log("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;let s={useMSE:!1,useWCS:!1};this._resetPlayer(s).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceDecoderConfigurationError,e),this.debug.error("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceDecoderConfigurationError,e),this.debug.error("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceDecoderConfigurationError,e),this.debug.log("JbPro","mediaSourceDecoderConfigurationError and autoWasm is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceDecoderConfigurationError,e),this.debug.error("JbPro","mediaSourceDecoderConfigurationError and pause error",t)}))}})),this.player.once(ct.mediaSourceTsIsMaxDiff,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","mediaSourceTsIsMaxDiff but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.mediaSourceTsIsMaxDiff,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mediaSourceTsIsMaxDiffReplay){this.debug.log("JbPro","mediaSourceTsIsMaxDiff reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","mediaSourceTsIsMaxDiff replay success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceTsIsMaxDiff,t,e),this.debug.error("JbPro","mediaSourceTsIsMaxDiff replay error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceTsIsMaxDiff,t,e),this.debug.error("JbPro","mediaSourceTsIsMaxDiff _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceTsIsMaxDiff,t,e),this.debug.log("JbPro","mediaSourceTsIsMaxDiff and replay is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceTsIsMaxDiff,t,e),this.debug.error("JbPro","mediaSourceTsIsMaxDiff and pause error",i)}))}})),this.player.once(ct.mseWidthOrHeightChange,(t=>{if(this.isDestroyed())return void this.debug.log("JbPro","mseWidthOrHeightChange but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.mseWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.widthOrHeightChangeReplay){this.debug.log("JbPro","mseWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.player._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.isDestroyed()?this.debug.log("JbPro","mseWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debug.log("JbPro","mseWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mseWidthOrHeightChange,i,t),this.debug.error("JbPro","mseWidthOrHeightChange and reset player and play error",e)}))}),1e3*this.player._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debug.log("JbPro","mseWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mseWidthOrHeightChange,i,t),this.debug.error("JbPro","mseWidthOrHeightChange and reset player and play error",e)}))})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mseWidthOrHeightChange,i,t),this.debug.error("JbPro","mseWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(nt.playFailedAndPaused,ct.mseWidthOrHeightChange,i,t),this.debug.error("JbPro","mseWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mseWidthOrHeightChange,i,t),this.debug.error("JbPro","mseWidthOrHeightChange error and pause error",e)}))}})),this.player.once(ct.mediaSourceAudioG711NotSupport,(t=>{if(this.isDestroyed())return void this.debug.log("JbPro","mediaSourceAudioG711NotSupport but player is destroyed");const i=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mediaSourceAudioG711NotSupportReplay){this.debug.log("JbPro","mediaSourceAudioG711NotSupport and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debug.log("JbPro","mediaSourceAudioG711NotSupport and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioG711NotSupport,i,t),this.debug.error("JbPro","mediaSourceAudioG711NotSupport and reset player and play error",e)}))})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioG711NotSupport,i,t),this.debug.error("JbPro","mediaSourceAudioG711NotSupport and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioG711NotSupport,i,t),this.debug.error("JbPro","mediaSourceAudioG711NotSupport and _resetPlayer error",e)})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioG711NotSupport,i,t),this.debug.error("JbPro","mediaSourceAudioG711NotSupport error and pause error",e)}))}})),this.player.once(ct.mediaSourceAudioInitTimeout,(t=>{if(this.isDestroyed())return void this.debug.log("JbPro","mediaSourceAudioInitTimeout but player is destroyed");const i=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mediaSourceAudioInitTimeoutReplay){this.debug.log("JbPro","mediaSourceAudioInitTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debug.log("JbPro","mediaSourceAudioInitTimeout and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioInitTimeout,i,t),this.debug.error("JbPro","mediaSourceAudioInitTimeout and reset player and play error",e)}))})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioInitTimeout,i,t),this.debug.error("JbPro","mediaSourceAudioInitTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioInitTimeout,i),this.debug.error("JbPro","mediaSourceAudioInitTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioInitTimeout,i),this.debug.error("JbPro","mediaSourceAudioInitTimeout error and pause error",e)}))}})),this.player.once(ct.mediaSourceAudioNoDataTimeout,(t=>{if(this.isDestroyed())return void this.debug.log("JbPro","mediaSourceAudioNoDataTimeout but player is destroyed");const i=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mediaSourceAudioInitTimeoutReplay){this.debug.log("JbPro","mediaSourceAudioNoDataTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debug.log("JbPro","mediaSourceAudioNoDataTimeout and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioNoDataTimeout,i,t),this.debug.error("JbPro","mediaSourceAudioNoDataTimeout and reset player and play error",e)}))})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioNoDataTimeout,i,t),this.debug.error("JbPro","mediaSourceAudioNoDataTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioNoDataTimeout,i),this.debug.error("JbPro","mediaSourceAudioNoDataTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioNoDataTimeout,i),this.debug.error("JbPro","mediaSourceAudioNoDataTimeout error and pause error",e)}))}})),this.player.once(ct.mediaSourceUseCanvasRenderPlayFailed,(e=>{if(this.isDestroyed())this.debug.log("JbPro","mediaSourceUseCanvasRenderPlayFailed but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.mediaSourceUseCanvasRenderPlayFailed,e)),this.player&&this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplay&&this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType){this.debug.log("JbPro",`mediaSourceUseCanvasRenderPlayFailed relayType is ${this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType} and reset player and play`);const t=this._opt.url,i=this._opt.playOptions;let s={};const r=this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType;r===$?s={useMSE:!1,useWCS:!1}:r===W&&(s={useVideoRender:!0,useCanvasRender:!1}),this._resetPlayer(s).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceUseCanvasRenderPlayFailed,e),this.debug.error("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player and play error",t)}))})).catch((e=>{this.debug.error("JbPro","mediaSourceUseCanvasRenderPlayFailed auto and _resetPlayer and play error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.debug.log("JbPro","mediaSourceUseCanvasRenderPlayFailed and pause player success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceUseCanvasRenderPlayFailed,e),this.debug.error("JbPro","mediaSourceUseCanvasRenderPlayFailed and pause",t)}))}})),this.player.once(ct.webcodecsH265NotSupport,(e=>{if(this.isDestroyed())this.debug.log("JbPro","webcodecsH265NotSupport but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.webcodecsH265NotSupport,e)),this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debug.log("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsH265NotSupport,e),this.debug.error("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play error",t)}))})).catch((e=>{this.debug.error("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] _resetPlayer and play error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.webcodecsH265NotSupport,e),this.debug.log("JbPro","webcodecsH265NotSupport and autoWasm is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsH265NotSupport,e),this.debug.error("JbPro","webcodecsH265NotSupport and pause error",t)}))}})),this.player.once(ct.webcodecsUnsupportedConfigurationError,(e=>{if(this.isDestroyed())this.debug.log("JbPro","webcodecsUnsupportedConfigurationError but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.webcodecsUnsupportedConfigurationError,e)),this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debug.log("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsUnsupportedConfigurationError,e),this.debug.error("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsUnsupportedConfigurationError,e),this.debug.error("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.webcodecsUnsupportedConfigurationError,e),this.debug.log("JbPro","webcodecsUnsupportedConfigurationError and autoWasm is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsUnsupportedConfigurationError,e),this.debug.error("JbPro","webcodecsUnsupportedConfigurationError and pause error",t)}))}})),this.player.once(ct.webcodecsDecodeConfigureError,(e=>{if(this.isDestroyed())this.debug.log("JbPro","webcodecsDecodeConfigureError but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.webcodecsDecodeConfigureError,e)),this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debug.log("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeConfigureError,e),this.debug.error("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeConfigureError,e),this.debug.error("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeConfigureError,e),this.debug.log("JbPro","webcodecsDecodeConfigureError and autoWasm is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeConfigureError,e),this.debug.error("JbPro","webcodecsDecodeConfigureError and pause error",t)}))}})),this.player.once(ct.webcodecsDecodeError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","webcodecsDecodeError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.webcodecsDecodeError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.wcsDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},a=this.player._opt.decoderErrorAutoWasm,o=!0;a?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(Lr)?this._wcsDecodeErrorRetryLog.push(aa()):(a=!0,o=!1,r={useMSE:!1,useWCS:!1}),this.debug.log("JbPro",`webcodecs decode error autoWasm ${po(o)?" and is not meaningful Retry":""} [wcs-> ${a?"wasm":"wcs"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","webcodecs decode error reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeError,t,e),this.debug.error("JbPro","webcodecs decode error reset player and play error",i)}))})).catch((()=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeError,t,e),this.debug.error("JbPro","webcodecs decode error _resetPlayer error")}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeError,t,e),this.debug.log("JbPro","webcodecs decode error and autoWasm is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeError,t,e),this.debug.error("JbPro","webcodecs decode error and pause error",i)}))}})),this.player.once(ct.wcsWidthOrHeightChange,(t=>{if(this.isDestroyed())return void this.debug.log("JbPro","wcsWidthOrHeightChange but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.wcsWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.widthOrHeightChangeReplay){this.debug.log("JbPro","wcsWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.isDestroyed()?this.debug.log("JbPro","wcsWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debug.log("JbPro","wcsWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wcsWidthOrHeightChange,i,t),this.debug.error("JbPro","wcsWidthOrHeightChange and reset player and play error",e)}))}),1e3*this._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debug.log("JbPro","wcsWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wcsWidthOrHeightChange,i,t),this.debug.error("JbPro","wcsWidthOrHeightChange and reset player and play error",e)}))})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wcsWidthOrHeightChange,i,t),this.debug.error("JbPro","wcsWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(nt.playFailedAndPaused,ct.wcsWidthOrHeightChange,i,t),this.debug.error("JbPro","wcsWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wcsWidthOrHeightChange,i,t),this.debug.error("JbPro","wcsWidthOrHeightChange error and pause error",e)}))}})),this.player.once(ct.wasmDecodeError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","wasmDecodeError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.wasmDecodeError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.wasmDecodeErrorReplay){this.debug.log("JbPro","wasm decode error and reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","wasm decode error and reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.wasmDecodeError,t,e),this.debug.error("JbPro","wasm decode error and reset player and play error",i)}))})).catch((()=>{this.emit(nt.playFailedAndPaused,ct.wasmDecodeError,t,e),this.debug.error("JbPro","wasm decode error and _resetPlayer error")}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.wasmDecodeError,t,e),this.debug.log("JbPro","wasm decode error and wasmDecodeErrorReplay is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.wasmDecodeError,t,e),this.debug.error("JbPro","wasm decode error and pause error",i)}))}})),this.player.once(ct.simdDecodeError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","simdDecodeError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.simdDecodeError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.simdDecodeErrorReplay){this.debug.log("JbPro",`simdDecodeError error simdDecodeErrorReplayType is ${this.player._opt.simdDecodeErrorReplayType} and reset player and play`);const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.simdDecodeErrorReplayType===N&&(r={useSIMD:!1}),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","simdDecodeError and reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.simdDecodeError,t,e),this.debug.error("JbPro","simdDecodeError and reset player and play error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.simdDecodeError,t,e),this.debug.error("JbPro","simdDecodeError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.simdDecodeError,t,e),this.debug.error("JbPro","simdDecodeError and simdDecodeErrorReplay is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.simdDecodeError,t,e),this.debug.error("JbPro","simdDecodeError error and pause error",i)}))}})),this.player.once(ct.wasmWidthOrHeightChange,(t=>{if(this.isDestroyed())return void this.debug.log("JbPro","wasmWidthOrHeightChange but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.wasmWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.widthOrHeightChangeReplay){this.debug.log("JbPro","wasmWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.isDestroyed()?this.debug.log("JbPro","wasmWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debug.log("JbPro","wasmWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wasmWidthOrHeightChange,i,t),this.debug.error("JbPro","wasmWidthOrHeightChange and reset player and play error",e)}))}),1e3*this._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debug.log("JbPro","wasmWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wasmWidthOrHeightChange,i,t),this.debug.error("JbPro","wasmWidthOrHeightChange and reset player and play error",e)}))})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wasmWidthOrHeightChange,i,t),this.debug.error("JbPro","wasmWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(nt.playFailedAndPaused,ct.wasmWidthOrHeightChange,i,t),this.debug.error("JbPro","wasmWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wasmWidthOrHeightChange,i),this.debug.error("JbPro","wasmWidthOrHeightChange error and pause error",e)}))}})),this.player.once(ct.wasmUseVideoRenderError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","wasmUseVideoRenderError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.wasmUseVideoRenderError,e)),this.debug.log("JbPro","wasmUseVideoRenderError and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useVideoRender:!1,useCanvasRender:!0}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","wasmUseVideoRenderError and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.wasmUseVideoRenderError,{},e),this.debug.error("JbPro","wasmUseVideoRenderError and reset player and play error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.wasmUseVideoRenderError,{},e),this.debug.error("JbPro","wasmUseVideoRenderError and _resetPlayer error",t)}))})),this.player.once(ct.videoElementPlayingFailed,(e=>{if(this.isDestroyed())this.debug.log("JbPro","videoElementPlayingFailed but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.videoElementPlayingFailed,e)),this.player&&this.player._opt.videoElementPlayingFailedReplay){this.debug.log("JbPro",`videoElementPlayingFailed and useMSE is ${this._opt.useMSE} and reset player and play`);const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useVideoRender:!1,useCanvasRender:!0}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","videoElementPlayingFailed and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.videoElementPlayingFailed,{},e),this.debug.error("JbPro","videoElementPlayingFailed and reset player and play error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.videoElementPlayingFailed,{},e),this.debug.error("JbPro","videoElementPlayingFailed and _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.videoElementPlayingFailed,{},e),this.debug.error("JbPro","videoElementPlayingFailed and videoElementPlayingFailedReplay is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.videoElementPlayingFailed,{},e),this.debug.error("JbPro","videoElementPlayingFailed and _pause error",t)}))}})),this.player.once(ct.simdH264DecodeVideoWidthIsTooLarge,(e=>{if(this.isDestroyed())this.debug.log("JbPro","simdH264DecodeVideoWidthIsTooLarge but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.simdH264DecodeVideoWidthIsTooLarge,e)),this.player&&this.player._opt.simdH264DecodeVideoWidthIsTooLargeReplay){this.debug.log("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useSIMD:!1}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debug.error("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debug.error("JbPro","simdH264DecodeVideoWidthIsTooLarge and _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debug.error("JbPro","simdH264DecodeVideoWidthIsTooLarge and simdDecodeErrorReplay is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debug.error("JbPro","simdH264DecodeVideoWidthIsTooLarge and pause error",t)}))}})),this.player.once(nt.networkDelayTimeout,(e=>{if(this.player._opt.networkDelayTimeoutReplay){if(this.isDestroyed())return void this.debug.log("JbPro","networkDelayTimeout but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(nt.networkDelayTimeout,e));const t=this._getVideoLastIframeInfo();this.debug.log("JbPro","network delay time out and reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player&&this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","wasm decode error and reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,nt.networkDelayTimeout,t,e),this.debug.error("JbPro","wasm decode error and reset player and play error",i)}))})).catch((()=>{this.emit(nt.playFailedAndPaused,nt.networkDelayTimeout,t,e),this.debug.error("JbPro","wasm decode error and _resetPlayer error")}))}})),this.player.once(nt.flvDemuxBufferSizeTooLarge,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","flvDemuxBufferSizeTooLarge but player is destroyed");const t=this._getVideoLastIframeInfo();if(this.player._opt.flvDemuxBufferSizeTooLargeReplay){this.emit(nt.crashLog,this.getCrashLog(nt.flvDemuxBufferSizeTooLarge,e)),this.debug.log("JbPro","flv Demux Buffer Size Too Large and flvDemuxBufferSizeTooLargeReplay = true and reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player&&this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log(this.TAG_NAME,"flv Demux Buffer Size Too Large and reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,nt.flvDemuxBufferSizeTooLarge,t,e),this.debug.error(this.TAG_NAME,"flv Demux Buffer Size Too Large and reset player and play error",i)}))})).catch((()=>{this.emit(nt.playFailedAndPaused,nt.flvDemuxBufferSizeTooLarge,t,e),this.debug.error(this.TAG_NAME,"flv Demux Buffer Size Too Large and _resetPlayer error")}))}else if(this._opt.flvDemuxBufferSizeTooLargeEmitFailed){this.debug.log(this.TAG_NAME,"flv Demux Buffer Size Too Large and flvDemuxBufferSizeTooLargeEmitFailed = true and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.flvDemuxBufferSizeTooLarge,t,e)})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.flvDemuxBufferSizeTooLarge,t,e),this.debug.error(this.TAG_NAME,"flv Demux Buffer Size Too Large",i)}))}})),this.player.once(ct.fetchError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","fetchError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.fetchError,e));const t=this._getVideoLastIframeInfo(),i=this._isNeedNetworkDisconnectReplay();if(this.player._opt.streamErrorReplay||i){i?this.debug.log("JbPro","fetch error and network is disconnect and reset player and play"):this.debug.log("JbPro",`fetch error and streamErrorReplay is true and _streamErrorReplayTimes is ${this._streamErrorReplayTimes}, streamErrorReplayDelayTime is ${this._opt.streamErrorReplayDelayTime}, next replay`);let s={};this.player._opt.replayUseLastFrameShow&&(s=Object.assign({},s,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(s.isNotMute=!0);const r=this._opt.playOptions,a=this._opt.url,o=i?1:this._opt.streamErrorReplayDelayTime;this._resetPlayer(s).then((()=>{this.streamErrorReplayDelayTimeout=setTimeout((()=>{if(this.isDestroyed())this.debug.log("JbPro","fetch error and _resetPlayer but player is destroyed and return");else{if(this.network.isOffline())return this.debug.log("JbPro","fetch error and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:a,options:r,type:ct.fetchError});this._streamErrorReplayTimes++,this.play(a,r).then((()=>{this.debug.log("JbPro","fetch error and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.fetchError,{},e),this.debug.error("JbPro","fetch error and reset player and play error",t)}))}}),1e3*o)})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.fetchError,{},e),this.debug.error("JbPro","fetch error and _resetPlayer error",t)}))}else{this.debug.log("JbPro","fetch error and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.fetchError,t,e)})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.fetchError,t,e),this.debug.error("JbPro","fetch error and pause",i)}))}})),this.player.once(nt.streamEnd,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","streamEnd but player is destroyed and return");this.emit(nt.crashLog,this.getCrashLog(nt.streamEnd,e));const t=this._getVideoLastIframeInfo(),i=this._checkIsMeaningfulRetry(Rr),s=""+e=="1006"&&this.player._opt.websocket1006ErrorReplay,r=s&&i,a=this.player._opt.streamEndReplay,o=this._isNeedNetworkDisconnectReplay();if(r||a||o){o?this.debug.log("JbPro","streamEnd and network is disconnect and reset player and play"):r?this.debug.log("JbPro",`streamEnd and websocket1006ErrorReplay is true and error is 1006 and _websocket1006ErrorReplayTimes is ${this._websocket1006ErrorReplayTimes} , delay ${this._opt.websocket1006ErrorReplayDelayTime}s reset player and play`):this.debug.log("JbPro",`streamEnd and isStreamEndReplay is true and and _streamEndReplayTimes is ${this._streamEndReplayTimes} , delay ${this._opt.streamEndReplayDelayTime}s reset player and play`);const i=this._opt.playOptions,s=this._opt.url;this._websocket1006ErrorRetryLog.push(aa());let a={};this.player._opt.replayUseLastFrameShow&&(a=Object.assign({},a,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(a.isNotMute=!0);let n=r?this._opt.websocket1006ErrorReplayDelayTime:this._opt.streamEndReplayDelayTime;o&&(n=1),this._initLoadingBackgroundForIOS(t),this._resetPlayer(a).then((()=>{this.streamEndReplayDelayTimeout=setTimeout((()=>{if(this._removeLoadingBackgroundForIOS(),this.isDestroyed())o?this.debug.log("JbPro","streamEnd and network is disconnect and _resetPlayer() but player is destroyed and return"):r?this.debug.log("JbPro","streamEnd and 1006 error and _resetPlayer() but player is destroyed and return"):this.debug.log("JbPro","streamEnd and _resetPlayer() but player is destroyed and return");else{if(this.network.isOffline())return r?this.debug.log("JbPro","streamEnd and 1006 error network is offline and wait network online to play , so return"):this.debug.log("JbPro","streamEnd and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:s,options:i,type:r?ct.websocket1006Error:ct.streamEnd});r?this._websocket1006ErrorReplayTimes++:this._streamEndReplayTimes++,this.play(s,i).then((()=>{r?this.debug.log("JbPro","streamEnd and 1006 error and reset player and play success"):this.debug.log("JbPro","streamEnd and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.streamEnd,{},e),r?this.debug.error("JbPro","streamEnd and 1006 error and reset player and play error",t):this.debug.error("JbPro","streamEnd and reset player and play error",t)}))}}),1e3*n)})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.streamEnd,{},e),r?this.debug.error("JbPro","streamEnd and 1006 and _resetPlayer error",t):this.debug.error("JbPro","streamEnd and _resetPlayer error",t)}))}else{s?this.debug.log("JbPro","streamEnd pause player "+(po(i)?"and is not meaningful retry":"")):this.debug.log("JbPro","streamEnd pause player");const r=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(r).then((()=>{this.emit(nt.playFailedAndPaused,nt.streamEnd,t,e)})).catch((i=>{this.emit(nt.playFailedAndPaused,nt.streamEnd,t,e),this.debug.error("JbPro","streamEnd pause",i)}))}})),this.player.once(ct.websocketError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","websocketError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.websocketError,e));const t=this._getVideoLastIframeInfo(),i=this._isNeedNetworkDisconnectReplay();if(this.player._opt.streamErrorReplay||i){i?this.debug.log("JbPro","websocketError error and network is disconnect and reset player and play"):this.debug.log("JbPro",`websocketError error and streamErrorReplay is true and _streamErrorReplayTimes is ${this._streamErrorReplayTimes} and streamErrorReplayDelayTime is ${this._opt.streamErrorReplayDelayTime}, next replay`);let s={};this.player._opt.replayUseLastFrameShow&&(s=Object.assign({},s,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(s.isNotMute=!0);const r=this._opt.playOptions,a=this._opt.url,o=i?1:this._opt.streamErrorReplayDelayTime;this._resetPlayer(s).then((()=>{this.streamErrorReplayDelayTimeout=setTimeout((()=>{if(this.isDestroyed())i?this.debug.log("JbPro","websocketError error and network is disconnect and _resetPlayer() but player is destroyed and return"):this.debug.log("JbPro","websocketError error and _resetPlayer() but player is destroyed and return");else{if(this.network.isOffline())return this.debug.log("JbPro","websocketError error and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:a,options:r,type:ct.websocketError});this._streamErrorReplayTimes++,this.play(a,r).then((()=>{this.debug.log("JbPro","websocketError error and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.fetchError,{},e),this.debug.error("JbPro","websocketError error and reset player and play error",t)}))}}),1e3*o)})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.fetchError,{},e),this.debug.error("JbPro","websocketError error and _resetPlayer error",t)}))}else{this.debug.log("JbPro","websocketError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.websocketError,t,e)})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.websocketError,t,e),this.debug.error("JbPro","websocketError and pause",i)}))}})),this.player.once(ct.webrtcError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","webrtcError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.webrtcError,e));const t=this._getVideoLastIframeInfo();this.debug.log("JbPro","webrtcError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.webrtcError,t,e)})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.webrtcError,t,e),this.debug.error("JbPro","webrtcError and pause",i)}))})),this.player.once(ct.hlsError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","hlsError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.hlsError,e));const t=this._getVideoLastIframeInfo();this.debug.log("JbPro","hlsError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.hlsError,t,e)})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.hlsError,t,e),this.debug.error("JbPro","hlsError and pause",i)}))})),this.player.once(ct.aliyunRtcError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","aliyunRtcError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.aliyunRtcError,e));const t=this._getVideoLastIframeInfo();this.debug.log("JbPro","aliyunRtcError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.aliyunRtcError,t,e)})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.aliyunRtcError,t,e),this.debug.error("JbPro","aliyunRtcError and pause",i)}))})),this.player.once(ct.decoderWorkerInitError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","decoderWorkerInitError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.decoderWorkerInitError,e)),this.debug.log("JbPro","decoderWorkerInitError and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.decoderWorkerInitError,{},e)})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.decoderWorkerInitError,{},e),this.debug.error("JbPro","decoderWorkerInitError and pause",t)}))})),this.player.once(ct.videoElementPlayingFailedForWebrtc,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","videoElementPlayingFailedForWebrtc but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.videoElementPlayingFailedForWebrtc,e)),this.debug.log("JbPro","videoElementPlayingFailedForWebrtc and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.videoElementPlayingFailedForWebrtc,{},e)})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.videoElementPlayingFailedForWebrtc,{},e),this.debug.error("JbPro","videoElementPlayingFailedForWebrtc and pause",t)}))})),this.player.once(ct.videoInfoError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","videoInfoError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.videoInfoError,e)),this.debug.log("JbPro","videoInfoError and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.videoInfoError,{},e)})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.videoInfoError,{},e),this.debug.error("JbPro","videoInfoError and pause",t)}))})),this.player.once(nt.webrtcStreamH265,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","webrtcStreamH265 but player is destroyed");this.debug.log("JbPro","webrtcStreamH265 and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({isWebrtcH265:!0}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","webrtcStreamH265 and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,nt.webrtcStreamH265,{},e),this.debug.error("JbPro","webrtcStreamH265 and reset player and play error",t)}))})).catch((()=>{this.emit(nt.playFailedAndPaused,nt.webrtcStreamH265,{},e),this.debug.error("JbPro","webrtcStreamH265 and _resetPlayer error")}))})),this.player.on(nt.delayTimeout,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","delay timeout but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(nt.delayTimeout,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.heartTimeoutReplay&&(this._heartTimeoutReplayTimes{if(this._isNeedNetworkDisconnectReplay())return this.debug.log("JbPro","delayTimeout and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:i,options:s,type:nt.delayTimeout});this.play(i,s).then((()=>{})).catch((i=>{this.emit(nt.playFailedAndPaused,nt.delayTimeout,t,e),this.debug.error("JbPro","delay timeout replay error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,nt.delayTimeout,t,e),this.debug.error("JbPro","delay timeout _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,nt.delayTimeout,t,e),this.player&&(this.emit(nt.delayTimeoutRetryEnd),this.emit(nt.playFailedAndPaused,nt.delayTimeoutRetryEnd)),this.debug.warn("JbPro",`delayTimeoutRetryEnd and\n opt.heartTimeout is ${this.player&&this.player._opt.heartTimeout} and\n opt.heartTimeoutReplay is ${this.player&&this.player._opt.heartTimeoutReplay} and\n opt.heartTimeoutReplayTimes is ${this.player&&this.player._opt.heartTimeoutReplayTimes},and\n local._heartTimeoutReplayTimes is ${this._heartTimeoutReplayTimes}`)})).catch((i=>{this.emit(nt.playFailedAndPaused,nt.delayTimeout,t,e),this.debug.error("JbPro","delay timeout and pause error",i)}))}})),this.player.on(nt.loadingTimeout,(e=>{if(this.emit(nt.crashLog,this.getCrashLog(nt.loadingTimeout,e)),this.isDestroyed())this.debug.log("JbPro","loading timeout but player is destroyed");else if(this.player&&this.player._opt.loadingTimeoutReplay&&(this._loadingTimeoutReplayTimes{if(this._isNeedNetworkDisconnectReplay())return this.debug.log("JbPro","loadingTimeout and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:t,options:i,type:nt.loadingTimeout});this.play(t,i).then((()=>{})).catch((t=>{this.emit(nt.playFailedAndPaused,nt.loadingTimeout,{},e),this.debug.error("JbPro","loading timeout replay error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,nt.loadingTimeout,{},e),this.debug.error("JbPro","loading timeout _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,nt.loadingTimeout,{},e),this.player&&(this.emit(nt.loadingTimeoutRetryEnd),this.emit(nt.playFailedAndPaused,nt.loadingTimeoutRetryEnd,{},e)),this.debug.log("JbPro",`loadingTimeoutRetryEnd and\n opt.loadingTimeout is ${this.player&&this.player._opt.loadingTimeout} and\n opt.loadingTimeoutReplay is ${this.player&&this.player._opt.loadingTimeoutReplay} and\n local._loadingTimeoutReplayTimes time is ${this._loadingTimeoutReplayTimes} and\n opt.loadingTimeoutReplayTimes is ${this.player&&this.player._opt.loadingTimeoutReplayTimes}`)})).catch((t=>{this.emit(nt.playFailedAndPaused,nt.loadingTimeout,{},e),this.debug.error("JbPro","loading timeout and pause error",t)}))}})),this._hasLoaded()?this.player.play(t,i).then((()=>{s()})).catch((e=>{this.debug.error("JbPro","_hasLoaded() and play error",e),this.emit(nt.crashLog,this.getCrashLog("_hasLoaded() and play error",e)),this.player&&this.player.pause().then((()=>{r(e)})).catch((e=>{r(e),this.debug.error("JbPro","_hasLoaded() and play error and next pause error",e)}))})):this.player.once(nt.decoderWorkerInit,(()=>{this.player.play(t,i).then((()=>{s()})).catch((e=>{this.debug.error("JbPro","decoderWorkerInit and play error",e),this.emit(nt.crashLog,this.getCrashLog("decoderWorkerInit and play error",e)),this.player&&this.player.pause().then((()=>{r(e)})).catch((e=>{r(e),this.debug.error("JbPro","decoderWorkerInit and play error and next pause error",e)}))}))}))},H=this.player.getOption(),V=v&&po(this._opt.supportHls265),J=m&&po(this._opt.isWebrtcH265),q=v&&!!Xa(),K=v&&H.demuxUseWorker;if(V||J||g||u||w||q||K)this.debug.log("JbPro",`need reset player and\n isOldHls is ${V} and isOldWebrtc is ${J} and\n isAliyunRtc is ${g} and\n needResetPlayer(url change) is ${u} and\n isMpeg4 is ${w} and\n isHlsCanVideoPlay is ${q} and\n isHlsButDemuxUseWorker is ${K}`),this._resetPlayer({protocol:j,demuxType:z,isHls:v,isWebrtc:m,isWebrtcForZLM:U,isWebrtcForSRS:F,isWebrtcForOthers:O,isAliyunRtc:g,cryptoKey:i.cryptoKey||"",cryptoIV:i.cryptoIV||"",url:t,playOptions:i}).then((()=>{G()})).catch((e=>{r("reset player error")}));else{const e={protocol:j,demuxType:z,isHls:v,isWebrtc:m,isAliyunRtc:g,isFlv:this._opt.isFlv,isFmp4:this._opt.isFmp4,isMpeg4:this._opt.isMpeg4,isNakedFlow:this._opt.isNakedFlow,isTs:this._opt.isTs,cryptoKey:i.cryptoKey||"",cryptoIV:i.cryptoIV||""};this._opt.isNakedFlow&&(e.mseDecodeAudio=!1),this.player.updateOption(e),i.cryptoKey&&i.cryptoIV&&this.player.decoderWorker&&(this.player.decoderWorker.updateWorkConfig({key:"cryptoKey",value:i.cryptoKey}),this.player.decoderWorker.updateWorkConfig({key:"cryptoIV",value:i.cryptoIV})),G()}}))}_resetDemuxType(e){this._opt.isFlv=!1,this._opt.isFmp4=!1,this._opt.isMpeg4=!1,this._opt.isNakedFlow=!1,this._opt.isHls=!1,this._opt.isWebrtc=!1,this._opt.isWebrtcForZLM=!1,this._opt.isWebrtcForSRS=!1,this._opt.isWebrtcForOthers=!1,this._opt.isAliyunRtc=!1,this._opt.isTs=!1,e&&(this._opt[e]=!0),"isFmp4"!==e&&(this._opt.isFmp4Private=!1)}resize(){this.debug.log("JbPro","resize()"),this.player&&this.player.resize()}setBufferTime(e){this.debug.log("JbPro",`setBufferTime() ${e}`),(e=Number(e))>10&&this.debug.warn("JbPro",`setBufferTime() buffer time is ${e} second, is too large, video will show blank screen until cache ${e} second buffer data`);const t=1e3*e;this._opt.videoBuffer=t,this.player?this.player.updateOption({videoBuffer:t},!0):this.debug.warn("JbPro","setBufferTime() player is null")}setBufferDelayTime(e){this.debug.log("JbPro",`setBufferDelayTime() ${e}`),(e=Number(e))<.2&&this.debug.warn("JbPro",`setBufferDelayTime() buffer time delay is ${e} second, is too small`);const t=1e3*(e=oa(e,.2,100));this._opt.videoBufferDelay=t,this.player?this.player.updateOption({videoBufferDelay:t},!0):this.debug.warn("JbPro","setBufferDelayTime() player is null")}setRotate(e){this.debug.log("JbPro",`setRotate() ${e}`),e=parseInt(e,10);this._opt.rotate!==e&&-1!==[0,90,180,270].indexOf(e)?(this._opt.rotate=e,this.player?(this.player.updateOption({rotate:e}),this.resize()):this.debug.warn("JbPro","setRotate() player is null")):this.debug.warn("JbPro",`setRotate() rotate is ${e} and this._opt.rotate is ${this._opt.rotate}`)}setMirrorRotate(e){this.debug.log("JbPro",`setMirrorRotate() ${e}`);e||(e="none"),this._opt.mirrorRotate!==e&&-1!==["none","level","vertical"].indexOf(e)?(this._opt.mirrorRotate=e,this.player?(this.player.updateOption({mirrorRotate:e}),this.resize()):this.debug.warn("JbPro","setMirrorRotate() player is null")):this.debug.warn("JbPro",`setMirrorRotate() mirrorRotate is ${e} and this._opt.mirrorRotate is ${this._opt.mirrorRotate}`)}setAspectRatio(e){this.debug.log("JbPro",`setAspectRatio() ${e}`);e||(e="default"),this._opt.aspectRatio!==e&&-1!==["default","4:3","16:9"].indexOf(e)?(this._opt.aspectRatio=e,this.player?(this.player.updateOption({aspectRatio:e}),this.resize()):this.debug.warn("JbPro","setAspectRatio() player is null")):this.debug.warn("JbPro",`setAspectRatio() aspectRatio is ${e} and this._opt.aspectRatio is ${this._opt.mirrorRotate}`)}hasLoaded(){return!0}_hasLoaded(){return this.player&&this.player.loaded||!1}setKeepScreenOn(){this.debug.log("JbPro","setKeepScreenOn()"),this._opt.keepScreenOn=!0,this.player?this.player.updateOption({keepScreenOn:!0}):this.debug.warn("JbPro","setKeepScreenOn() player is not ready")}setFullscreen(e){this.debug.log("JbPro",`setFullscreen() ${e}`);const t=!!e;this.player?this.player.fullscreen!==t?this.player.fullscreen=t:this.debug.warn("JbPro",`setFullscreen() fullscreen is ${t} and this.player.fullscreen is ${this.player.fullscreen}`):this.debug.warn("JbPro","setFullscreen() player is not ready")}setWebFullscreen(e){this.debug.log("JbPro",`setWebFullscreen() ${e}`);const t=!!e;this.player?this.player.webFullscreen=t:this.debug.warn("JbPro","setWebFullscreen() player is not ready")}screenshot(e,t,i,s){return this.debug.log("JbPro",`screenshot() ${e} ${t} ${i} ${s}`),this.player&&this.player.video?this.player.video.screenshot(e,t,i,s):(this.debug.warn("JbPro","screenshot() player is not ready"),null)}screenshotWatermark(e){return new Promise(((t,i)=>{this.debug.log("JbPro","screenshotWatermark()",e),this.player&&this.player.video?this.player.video.screenshotWatermark(e).then((e=>{t(e)})).catch((e=>{i(e)})):(this.debug.warn("JbPro","screenshotWatermark() player is not ready"),i("player is not ready"))}))}startRecord(e,t){return new Promise(((i,s)=>{if(this.debug.log("JbPro",`startRecord() ${e} ${t}`),!this.player)return this.debug.warn("JbPro","startRecord() player is not ready"),s("player is not ready");this.player.playing?(this.player.startRecord(e,t),i()):(this.debug.warn("JbPro","startRecord() player is not playing"),s("not playing"))}))}stopRecordAndSave(e,t){return new Promise(((i,s)=>{this.debug.log("JbPro",`stopRecordAndSave() ${e} ${t}`),this.player&&this.player.recording?this.player.stopRecordAndSave(e,t).then((e=>{i(e)})).catch((e=>{s(e)})):s("not recording")}))}isPlaying(){let e=!1;return this.player&&(e=this.player.isPlaying()),e}isLoading(){return!!this.player&&this.player.loading}isPause(){let e=!1;return this._opt.playType===b?e=!this.isPlaying()&&!this.isLoading():this._opt.playType===_&&this.player&&(e=this.player.playbackPause),e}isPaused(){return this.isPause()}isPlaybackPause(){let e=!1;return this._opt.playType===_&&this.player&&(e=this.player.playbackPause),e}isMute(){let e=!0;return this.player&&(e=this.player.isAudioMute()),e}isRecording(){return this.player&&this.player.recorder&&this.player.recorder.recording||!1}isFullscreen(){let e=!1;return this.player&&(e=this.player.fullscreen),e}isWebFullscreen(){let e=!1;return this.player&&(e=this.player.webFullscreen),e}clearBufferDelay(){this.debug.log("JbPro","clearBufferDelay()"),this.player?this.player.clearBufferDelay():this.debug.warn("JbPro","clearBufferDelay() player is not init")}setNetworkDelayTime(e){this.debug.log("JbPro",`setNetworkDelayTime() ${e}`),(e=Number(e))<1&&this.debug.warn("JbPro",`setNetworkDelayTime() network delay is ${e} second, is too small`);const t=1e3*(e=oa(e,1,100));this._opt.networkDelay=t,this.player?this.player.updateOption({networkDelay:t},!0):this.debug.warn("JbPro","setNetworkDelayTime() player is null")}getDecodeType(){let e="";return this.player&&(e=this.player.getDecodeType()),e}getRenderType(){let e="";return this.player&&(e=this.player.getRenderType()),e}getAudioEngineType(){let e="";return this.player&&(e=this.player.getAudioEngineType()),e}getPlayingTimestamp(){let e=0;return this.player&&(e=this.player.getPlayingTimestamp()),e}getStatus(){let e=bs;return this.player&&(e=this.player.loading?gs:this.player.playing?ys:As),e}getPlayType(){return this.player?this.player._opt.playType:b}togglePerformancePanel(e){this.debug.log("JbPro",`togglePerformancePanel() ${e}`);const t=this.player._opt.showPerformance;let i=!t;Pa(e)&&(i=e),i!==t?this.player?this.player.togglePerformancePanel(i):this.debug.warn("JbPro","togglePerformancePanel() failed, this.player is not init"):this.debug.warn("JbPro",`togglePerformancePanel() failed, showPerformance is prev: ${t} === now: ${i}`)}openZoom(){this.debug.log("JbPro","openZoom()"),this.player?this.player.zooming=!0:this.debug.warn("JbPro","openZoom() failed, this.player is not init")}closeZoom(){this.debug.log("JbPro","closeZoom()"),this.player?this.player.zooming=!1:this.debug.warn("JbPro","closeZoom() failed, this.player is not init")}isZoomOpen(){let e=!1;return this.player&&(e=this.player.zooming),e}toggleZoom(e){this.debug.log("JbPro",`toggleZoom() ${e}`),Pa(e)||(e=!this.isZoomOpen()),uo(e)?this.openZoom():po(!1)&&this.closeZoom()}expandZoom(){this.debug.log("JbPro","expandZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.expandPrecision():this.debug.warn("JbPro","expandZoom() failed, zoom is not open or not init")}narrowZoom(){this.debug.log("JbPro","narrowZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.narrowPrecision():this.debug.warn("JbPro","narrowZoom failed, zoom is not open or not init")}getCurrentZoomIndex(){let e=1;return this.player&&this.player.zoom&&(e=this.player.zoom.currentZoom),e}startTalk(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{this.debug.log("JbPro","startTalk()",e,t),this._initTalk(t),this.talk.startTalk(e).then((()=>{i(),this.talk.once(nt.talkStreamClose,(()=>{this.debug.warn("JbPro","talk stream close"),this.stopTalk().catch((e=>{}))})),this.talk.once(nt.talkStreamError,(e=>{this.debug.warn("JbPro","talk stream error",e),this.stopTalk().catch((e=>{}))})),this.talk.once(nt.talkStreamInactive,(()=>{this.debug.warn("JbPro","talk stream inactive"),this.stopTalk().catch((e=>{}))}))})).catch((e=>{s(e)}))}))}stopTalk(){return new Promise(((e,t)=>{if(this.debug.log("JbPro","stopTalk()"),!this.talk)return t("stopTalk() talk is not init");this.talk.destroy(),e()}))}getTalkVolume(){return new Promise(((e,t)=>{if(!this.talk)return t("getTalkVolume() talk is not init");e(this.talk.volume)}))}setTalkVolume(e){return new Promise(((t,i)=>{if(this.debug.log("JbPro","setTalkVolume()",e),!this.talk)return i("setTalkVolume() talk is not init");this.talk.setVolume(e/100),t()}))}setNakedFlowFps(e){return new Promise(((t,i)=>{if(this.debug.log("JbPro","setNakedFlowFps()",e),La(e))return i("setNakedFlowFps() fps is empty");let s=Number(e);s=oa(s,1,100),this._opt.nakedFlowFps=s,this.player?this.player.updateOption({nakedFlowFps:s}):this.debug.warn("JbPro","setNakedFlowFps() player is null"),t()}))}getCrashLog(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!this.player)return;const i=this.player.getAllStatsData(),s=this.player;let r={url:this._opt.url,playType:s.isPlayback()?"playback":"live",demuxType:s.getDemuxType(),decoderType:s.getDecodeType(),renderType:s.getRenderType(),videoInfo:{encType:"",width:"",height:""},audioInfo:{encType:"",sampleRate:"",channels:""},audioEngine:s.getAudioEngineType(),allTimes:i.pTs,timestamp:aa(),type:e,error:so(t)||e};if(s.video){const e=s.video.videoInfo||{};r.videoInfo={encType:e.encType||"",width:e.width||"",height:e.height||""}}if(s.audio){const e=s.audio.audioInfo||{};r.audioInfo={encType:e.encType||"",sampleRate:e.sampleRate||"",channels:e.channels||""}}return r}updateDebugLevel(e){this.debug.log("JbPro","updateDebugLevel()",e),e===J||e===q?e!==this.player._opt.debugLevel?(this._opt.debugLevel=e,this.player?this.player.updateOption({debugLevel:e},!0):this.debug.warn("JbPro","updateDebugLevel() player is null")):this.debug.warn("JbPro",`updateDebugLevel() level is same, level: ${e}`):this.debug.warn("JbPro",`updateDebugLevel() level is not valid, level: ${e}`)}updateWatermark(e){this.debug.log("JbPro","updateWatermark()",e),this.player?this.player.updateWatermark(e):this.debug.warn("JbPro","updateWatermark() player is not init")}removeWatermark(){this.debug.log("JbPro","removeWatermark()"),this.player?this.player.removeWatermark():this.debug.warn("JbPro","removeWatermark() player is not init")}updateFullscreenWatermark(e){if(this.debug.log("JbPro","updateFullscreenWatermark()",e),Va(e)){this._opt.fullscreenWatermarkConfig=e;const t=Ma(this.$container,e);if(!t.watermark_txt)return void this.debug.warn("JbPro","fullscreenWatermarkConfig text is empty");this.watermark.load(t)}else this.debug.warn("JbPro",`updateFullscreenWatermark() config is not valid, config: ${e}`)}removeFullscreenWatermark(){this.debug.log("JbPro","removeFullscreenWatermark()"),this.watermark?this.watermark.remove():this.debug.warn("JbPro","removeFullscreenWatermark() watermark is not init")}faceDetectOpen(){this.debug.log("JbPro","faceDetectOpen()"),this.player?this.player.faceDetect(!0):this.debug.warn("JbPro","faceDetectOpen() player is not init")}faceDetectClose(){this.debug.log("JbPro","faceDetectClose()"),this.player?this.player.faceDetect(!1):this.debug.warn("JbPro","faceDetectClose() player is not init")}objectDetectOpen(){this.debug.log("JbPro","objectDetectOpen()"),this.player?this.player.objectDetect(!0):this.debug.warn("JbPro","objectDetectOpen() player is not init")}objectDetectClose(){this.debug.log("JbPro","objectDetectClose()"),this.player?this.player.objectDetect(!1):this.debug.warn("JbPro","objectDetectClose() player is not init")}sendWebsocketMessage(e){this.debug.log("JbPro","sendWebsocketMessage()",e),this.player?this.player.sendWebsocketMessage(e):this.debug.warn("JbPro","sendWebsocketMessage() player is not init")}addContentToCanvas(e){this.debug.log("JbPro","addContentToCanvas()"),this.player?this.player.addContentToCanvas(e):this.debug.warn("JbPro","addContentToCanvas() player is not init")}clearContentToCanvas(){this.debug.log("JbPro","clearContentToCanvas()"),this.player?this.player.addContentToCanvas([]):this.debug.warn("JbPro","clearContentToCanvas() player is not init")}addContentToContainer(e){this.debug.log("JbPro","addContentToContainer()"),this.player?this.player.addContentToContainer(e):this.debug.warn("JbPro","addContentToContainer() player is not init")}clearContentToContainer(){this.debug.log("JbPro","clearContentToContainer()"),this.player?this.player.addContentToContainer([]):this.debug.warn("JbPro","clearContentToContainer() player is not init")}setControlHtml(e){this.debug.log("JbPro","setControlHtml()",e),this.player?this.player.setControlHtml(e):this.debug.warn("JbPro","setControlHtml() player is not init")}clearControlHtml(){this.debug.log("JbPro","clearControlHtml()"),this.player?this.player.clearControlHtml():this.debug.warn("JbPro","clearControlHtml() player is not init")}getVideoInfo(){let e=null;return this.player&&(e=this.player.getVideoInfo()),e}getAudioInfo(){let e=null;return this.player&&(e=this.player.getAudioInfo()),e}setSm4CryptoKey(e){this.debug.log("JbPro","setSm4CryptoKey()",e),32===(e=""+e).length?(this._opt.sm4CryptoKey=e,this.player?this.player.updateOption({sm4CryptoKey:e},!0):this.debug.warn("JbPro","setSm4CryptoKey() player is null")):this.debug.warn("JbPro",`setSm4CryptoKey() key is invalid and length is ${e.length} !== 32`)}setM7sCryptoKey(e){this.debug.log("JbPro","setM7sCryptoKey()",e),e=""+e,this._opt.m7sCryptoKey=e,this.player?this.player.updateOption({m7sCryptoKey:e},!0):this.debug.warn("JbPro","setM7sCryptoKey() player is null")}setXorCryptoKey(e){this.debug.log("JbPro","setXorCryptoKey()",e),e=""+e,this._opt.xorCryptoKey=e,this.player?this.player.updateOption({xorCryptoKey:e},!0):this.debug.warn("JbPro","setXorCryptoKey() player is null")}updateLoadingText(e){this.debug.log("JbPro","updateLoadingText()",e),this.player?this.player.updateLoadingText(e):this.debug.warn("JbPro","updateLoadingText() player is null")}updateIsEmitSEI(e){this.debug.log("JbPro","updateIsEmitSEI()",e),this._opt.isEmitSEI=e,this.player?this.player.updateOption({isEmitSEI:e},!0):this.debug.warn("JbPro","updateIsEmitSEI() player is null")}getPTZCmd(e,t){if(this.debug.log("JbPro","getPTZCmd()",e),e)return this.player?Rv({type:e,index:0,speed:t}):void this.debug.warn("JbPro","getPTZCmd() player is null");this.debug.warn("JbPro","getPTZCmd() ptz is null")}downloadTempNakedFlowFile(){return new Promise(((e,t)=>{this.player?(this.player.downloadNakedFlowFile(),e()):t("player is not init")}))}downloadTempFmp4File(){return new Promise(((e,t)=>{this.player?(this.player.downloadFmp4File(),e()):t("player is not init")}))}downloadTempMpeg4File(){return new Promise(((e,t)=>{this.player?(this.player.downloadMpeg4File(),e()):t("player is not init")}))}downloadTempRtpFile(){return new Promise(((e,t)=>{this.talk?(this.talk.downloadRtpFile(),e()):t("talk is not init")}))}downloadMemoryLog(){this.memoryLogger&&this.memoryLogger.download()}_getVideoLastIframeInfo(){const e=this.getVideoInfo()||{},t={loadingBackground:this.screenshot("","png",.92,"base64"),loadingBackgroundWidth:e.width||0,loadingBackgroundHeight:e.height||0};return t.loadingBackground&&t.loadingBackgroundWidth&&t.loadingBackgroundHeight&&(this._tempVideoLastIframeInfo=t),this._tempVideoLastIframeInfo||{}}getExtendBtnList(){this.debug.log("JbPro","getExtendBtnList()");let e=[];return this.player?e=this.player.getExtendBtnList():this.debug.warn("JbPro","getExtendBtnList() player is null"),e}getFlvMetaData(){this.debug.log("JbPro","getFlvMetaData()");let e=null;return this.player?e=this.player.getMetaData():this.debug.warn("JbPro","getFlvMetaData() player is null"),e}updateAiFaceDetectInterval(e){this.debug.log("JbPro","updateAiFaceDetectInterval()",e);const t=1e3*(e=Number(e));this._opt.aiFaceDetectInterval=t,this.player?this.player.updateOption({aiFaceDetectInterval:t}):this.debug.warn("JbPro","updateAiFaceDetectInterval() player is null")}updateAiFaceDetectLevel(e){if(this.debug.log("JbPro","updateAiFaceDetectLevel()",e),!or[e])return void this.debug.warn("JbPro",`'updateAiFaceDetectLevel() level ${e} is invalid'`);const t=or[e];this._opt.aiFaceDetectWidth=t,this.player?(this.player.updateOption({aiFaceDetectWidth:t}),this.player.ai&&this.player.ai.updateFaceDetectorConfig({detectWidth:t})):this.debug.warn("JbPro","updateAiFaceDetectLevel() player is null")}updateAiObjectDetectInterval(e){this.debug.log("JbPro","updateAiObjectDetectInterval()",e);const t=1e3*(e=Number(e));this._opt.aiObjectDetectInterval=t,this.player?this.player.updateOption({aiObjectDetectInterval:t}):this.debug.warn("JbPro","updateAiObjectDetectInterval() player is null")}updateAiObjectDetectLevel(e){if(this.debug.log("JbPro","updateAiObjectDetectLevel()",e),!nr[e])return void this.debug.warn("JbPro",`'updateAiObjectDetectLevel() level ${e} is invalid'`);const t=nr[e];this._opt.aiObjectDetectWidth=t,this.player?(this.player.updateOption({aiObjectDetectWidth:t}),this.player.ai&&this.player.ai.updateObjectDetectorConfig({detectWidth:t})):this.debug.warn("JbPro","updateAiObjectDetectLevel() player is null")}setCryptoKeyUrl(e){this.debug.log("JbPro","setCryptoKeyUrl()",e),e&&(this._opt.cryptoKeyUrl=e)}showErrorMessageTips(e){this.debug.log("JbPro","showErrorMessageTips()",e),e&&(this.player?this.player.showTipsMessageByContent(e):this.debug.warn("JbPro","showErrorMessageTips() player is null"))}setPtzPosition(e){this.debug.log("JbPro","setPtzPosition()",e),e&&!Ha(e)&&(this.player?this.player.setPtzPosition(e):this.debug.warn("JbPro","setPtzPosition() player is null"))}hideErrorMessageTips(){this.debug.log("JbPro","hideErrorMessageTips()"),this.player?this.player.hideTipsMessage():this.debug.warn("JbPro","hideErrorMessageTips() player is null")}getContainerRect(){return this._getContainerRect()}proxy(e,t,i,s){return this.events.proxy(e,t,i,s)}_checkIsMeaningfulRetry(e){let t=!0,i=[];if(e===Rr?i=this._websocket1006ErrorRetryLog:e===Dr?i=this._mseDecodeErrorRetryLog:e===Lr&&(i=this._wcsDecodeErrorRetryLog),this.debug.log(this.TAG_NAME,`_checkIsMeaningfulRetry() type is ${e}, and retryLog is ${i.join(",")}`),i.length>=5){const s=i[0],r=i[i.length-1],a=r-s;a<=1e4&&(this.debug.warn(this.TAG_NAME,`retry type is ${e}, and retry length is ${i.length}, and start is ${s} and end is ${r} and diff is ${a}`),t=!1)}return t}_initLoadingBackgroundForIOS(e){(ya()||Aa())&&e.loadingBackground&&e.loadingBackgroundWidth&&e.loadingBackgroundHeight&&(this.debug.log(this.TAG_NAME,"_initLoadingBackgroundForIOS"),this._initLoadingBg(),"default"===this.player._opt.aspectRatio||ua()?this._doInitLoadingBackground(e):this._doInitLoadingBackgroundForRatio(e))}_doInitLoadingBackground(e){const t=this._getContainerRect();let i=t.height;const s=this.player._opt;if(s.hasControl&&!s.controlAutoHide){i-=s.playType===_?Yt:Kt}let r=t.width,a=i;const o=s.rotate;270!==o&&90!==o||(r=i,a=t.width),this.$loadingBgImage.width=r,this.$loadingBgImage.height=a,this.$loadingBgImage.src=e.loadingBackground;let n=(t.width-r)/2,l=(i-a)/2,d="contain";s.isResize||(d="fill"),s.isFullResize&&(d="none");let h="";"none"===s.mirrorRotate&&o&&(h+=" rotate("+o+"deg)"),"level"===s.mirrorRotate?h+=" rotateY(180deg)":"vertical"===s.mirrorRotate&&(h+=" rotateX(180deg)"),this._opt.videoRenderSupportScale&&(this.$loadingBgImage.style.objectFit=d),this.$loadingBgImage.style.transform=h,this.$loadingBgImage.style.padding="0",this.$loadingBgImage.style.left=n+"px",this.$loadingBgImage.style.top=l+"px",this.$loadingBgImage.complete?Ch(this.$loadingBg,"show"):this.$loadingBgImage.onload=()=>{Ch(this.$loadingBg,"show"),this.$loadingBgImage.onload=null}}_doInitLoadingBackgroundForRatio(e){const t=this.player._opt.aspectRatio.split(":").map(Number),i=this._getContainerRect();let s=i.width,r=i.height;const a=this.player._opt;let o=0;a.hasControl&&!a.controlAutoHide&&(o=a.playType===_?Yt:Kt,r-=o);const n=e.loadingBackgroundWidth,l=e.loadingBackgroundHeight,d=n/l,h=t[0]/t[1];if(this.$loadingBgImage.src=e.loadingBackground,d>h){const e=h*l/n;this.$loadingBgImage.style.width=100*e+"%",this.$loadingBgImage.style.height=`calc(100% - ${o}px)`,this.$loadingBgImage.style.padding=`0 ${(s-s*e)/2}px`}else{const e=n/h/l;this.$loadingBgImage.style.width="100%",this.$loadingBgImage.style.height=`calc(${100*e}% - ${o}px)`,this.$loadingBgImage.style.padding=(r-r*e)/2+"px 0"}this.$loadingBgImage.complete?Ch(this.$loadingBg,"show"):this.$loadingBgImage.onload=()=>{Ch(this.$loadingBg,"show"),this.$loadingBgImage.onload=null}}_initLoadingBg(){if(!this.$loadingBg){const e=document.createElement("div"),t=document.createElement("img");e.className="jb-pro-loading-bg-for-ios",this.$loadingBg=e,this.$loadingBgImage=t,e.appendChild(t),this.$container.appendChild(e)}}_removeLoadingBackgroundForIOS(){if(this.$loadingBg){this.debug.log(this.TAG_NAME,"_removeLoadingBackgroundForIOS()");if(!Lh(this.$loadingBg)){const e=this.$container.querySelector(".jb-pro-loading-bg-for-ios");e&&this.$container&&this.$container.removeChild(e)}this.$loadingBg=null,this.$loadingBgImage=null}}_getContainerRect(){let e={};return this.$container&&(e=this.$container.getBoundingClientRect(),e.width=Math.max(e.width,this.$container.clientWidth),e.height=Math.max(e.height,this.$container.clientHeight)),e}_isNeedNetworkDisconnectReplay(){return this._opt.networkDisconnectReplay&&this.network.isOffline()}}return Fv.ERROR=ct,Fv.EVENTS=lt,window.JessibucaPro=Fv,window.JbPro=Fv,window.WebPlayerPro=Fv,Fv})); diff --git a/pages_player/static/app-plus/mobile-demo.html b/pages_player/static/app-plus/mobile-demo.html new file mode 100644 index 0000000..215cf8a --- /dev/null +++ b/pages_player/static/app-plus/mobile-demo.html @@ -0,0 +1,203 @@ + + + + + + + jessibuca pro mobile demo + + + + + + +
+
+
+
+
+ 当前浏览器: + + + + +
+
+
+
+ 当前浏览器: + + + + +
+
+
+
+ 当前浏览器: + + +
+
+
+
+ 使用web全屏 +
+ +
+
+
输入URL:
+ + + +
+
+ + + +
+
+
+ + + + + diff --git a/pages_player/static/app-plus/uni.webview.1.5.5.js b/pages_player/static/app-plus/uni.webview.1.5.5.js new file mode 100644 index 0000000..2c9b980 --- /dev/null +++ b/pages_player/static/app-plus/uni.webview.1.5.5.js @@ -0,0 +1 @@ +!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).uni=n()}(this,(function(){"use strict";try{var e={};Object.defineProperty(e,"passive",{get:function(){!0}}),window.addEventListener("test-passive",null,e)}catch(e){}var n=Object.prototype.hasOwnProperty;function i(e,i){return n.call(e,i)}var t=[];function o(){return window.__dcloud_weex_postMessage||window.__dcloud_weex_}function a(){return window.__uniapp_x_postMessage||window.__uniapp_x_}var r=function(e,n){var i={options:{timestamp:+new Date},name:e,arg:n};if(a()){if("postMessage"===e){var r={data:n};return window.__uniapp_x_postMessage?window.__uniapp_x_postMessage(r):window.__uniapp_x_.postMessage(JSON.stringify(r))}var d={type:"WEB_INVOKE_APPSERVICE",args:{data:i,webviewIds:t}};window.__uniapp_x_postMessage?window.__uniapp_x_postMessageToService(d):window.__uniapp_x_.postMessageToService(JSON.stringify(d))}else if(o()){if("postMessage"===e){var s={data:[n]};return window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessage(s):window.__dcloud_weex_.postMessage(JSON.stringify(s))}var w={type:"WEB_INVOKE_APPSERVICE",args:{data:i,webviewIds:t}};window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessageToService(w):window.__dcloud_weex_.postMessageToService(JSON.stringify(w))}else{if(!window.plus)return window.parent.postMessage({type:"WEB_INVOKE_APPSERVICE",data:i,pageId:""},"*");if(0===t.length){var u=plus.webview.currentWebview();if(!u)throw new Error("plus.webview.currentWebview() is undefined");var g=u.parent(),v="";v=g?g.id:u.id,t.push(v)}if(plus.webview.getWebviewById("__uniapp__service"))plus.webview.postMessageToUniNView({type:"WEB_INVOKE_APPSERVICE",args:{data:i,webviewIds:t}},"__uniapp__service");else{var c=JSON.stringify(i);plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat("WEB_INVOKE_APPSERVICE",'",').concat(c,",").concat(JSON.stringify(t),");"))}}},d={navigateTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("navigateTo",{url:encodeURI(n)})},navigateBack:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.delta;r("navigateBack",{delta:parseInt(n)||1})},switchTab:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("switchTab",{url:encodeURI(n)})},reLaunch:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("reLaunch",{url:encodeURI(n)})},redirectTo:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.url;r("redirectTo",{url:encodeURI(n)})},getEnv:function(e){a()?e({uvue:!0}):o()?e({nvue:!0}):window.plus?e({plus:!0}):e({h5:!0})},postMessage:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r("postMessage",e.data||{})}},s=/uni-app/i.test(navigator.userAgent),w=/Html5Plus/i.test(navigator.userAgent),u=/complete|loaded|interactive/;var g=window.my&&navigator.userAgent.indexOf(["t","n","e","i","l","C","y","a","p","i","l","A"].reverse().join(""))>-1;var v=window.swan&&window.swan.webView&&/swan/i.test(navigator.userAgent);var c=window.qq&&window.qq.miniProgram&&/QQ/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var p=window.tt&&window.tt.miniProgram&&/toutiaomicroapp/i.test(navigator.userAgent);var _=window.wx&&window.wx.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var m=window.qa&&/quickapp/i.test(navigator.userAgent);var f=window.ks&&window.ks.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var l=window.tt&&window.tt.miniProgram&&/Lark|Feishu/i.test(navigator.userAgent);var E=window.jd&&window.jd.miniProgram&&/micromessenger/i.test(navigator.userAgent)&&/miniProgram/i.test(navigator.userAgent);var x=window.xhs&&window.xhs.miniProgram&&/xhsminiapp/i.test(navigator.userAgent);for(var S,h=function(){window.UniAppJSBridge=!0,document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady",{bubbles:!0,cancelable:!0}))},y=[function(e){if(s||w)return window.__uniapp_x_postMessage||window.__uniapp_x_||window.__dcloud_weex_postMessage||window.__dcloud_weex_?document.addEventListener("DOMContentLoaded",e):window.plus&&u.test(document.readyState)?setTimeout(e,0):document.addEventListener("plusready",e),d},function(e){if(_)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.wx.miniProgram},function(e){if(c)return window.QQJSBridge&&window.QQJSBridge.invoke?setTimeout(e,0):document.addEventListener("QQJSBridgeReady",e),window.qq.miniProgram},function(e){if(g){document.addEventListener("DOMContentLoaded",e);var n=window.my;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(v)return document.addEventListener("DOMContentLoaded",e),window.swan.webView},function(e){if(p)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(m){window.QaJSBridge&&window.QaJSBridge.invoke?setTimeout(e,0):document.addEventListener("QaJSBridgeReady",e);var n=window.qa;return{navigateTo:n.navigateTo,navigateBack:n.navigateBack,switchTab:n.switchTab,reLaunch:n.reLaunch,redirectTo:n.redirectTo,postMessage:n.postMessage,getEnv:n.getEnv}}},function(e){if(f)return window.WeixinJSBridge&&window.WeixinJSBridge.invoke?setTimeout(e,0):document.addEventListener("WeixinJSBridgeReady",e),window.ks.miniProgram},function(e){if(l)return document.addEventListener("DOMContentLoaded",e),window.tt.miniProgram},function(e){if(E)return window.JDJSBridgeReady&&window.JDJSBridgeReady.invoke?setTimeout(e,0):document.addEventListener("JDJSBridgeReady",e),window.jd.miniProgram},function(e){if(x)return window.xhs.miniProgram},function(e){return document.addEventListener("DOMContentLoaded",e),d}],M=0;M=0?n:null}(t);return[null==n?"":";path="+n,null==e?"":";domain="+e,null==o?"":";expires="+o.toUTCString(),void 0===r||!1===r?"":";secure",null===i?"":";SameSite="+i].join("")};n.formatCookie=function(t,n,o){return[encodeURIComponent(t),"=",encodeURIComponent(n),e(o)].join("")}},6025:function(t,n,e){"use strict";var o=e(8406);Object.defineProperty(n,"eR",{enumerable:!0,get:function(){return o.CookieStorage}});var r=e(9390);var i=e(4370)},4370:function(t,n){"use strict";function e(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var e=[],o=!0,r=!1,i=void 0;try{for(var c,a=t[Symbol.iterator]();!(o=(c=a.next()).done)&&(e.push(c.value),!n||e.length!==n);o=!0);}catch(t){r=!0,i=t}finally{try{o||null==a.return||a.return()}finally{if(r)throw i}}return e}(t,n)||function(t,n){if(!t)return;if("string"==typeof t)return o(t,n);var e=Object.prototype.toString.call(t).slice(8,-1);"Object"===e&&t.constructor&&(e=t.constructor.name);if("Map"===e||"Set"===e)return Array.from(t);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return o(t,n)}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,o=new Array(n);es;)if((a=l[s++])!=a)return!0}else for(;u>s;s++)if((t||s in l)&&l[s]===e)return t||s||0;return!t&&-1}};t.exports={includes:c(!0),indexOf:c(!1)}},4805:function(t,n,e){var o=e(2938),r=e(5044),i=e(1324),c=e(97),a=e(4822),l=[].push,u=function(t){var n=1==t,e=2==t,u=3==t,s=4==t,f=6==t,d=7==t,v=5==t||f;return function(p,h,_,g){for(var m,b,y=i(p),E=r(y),w=o(h,_,3),O=c(E.length),L=0,C=g||a,T=n?C(p,O):e||d?C(p,0):void 0;O>L;L++)if((v||L in E)&&(b=w(m=E[L],L,y),t))if(n)T[L]=b;else if(b)switch(t){case 3:return!0;case 5:return m;case 6:return L;case 2:l.call(T,m)}else switch(t){case 4:return!1;case 7:l.call(T,m)}return f?-1:u||s?s:T}};t.exports={forEach:u(0),map:u(1),filter:u(2),some:u(3),every:u(4),find:u(5),findIndex:u(6),filterOut:u(7)}},9269:function(t,n,e){var o=e(6544),r=e(3649),i=e(4061),c=r("species");t.exports=function(t){return i>=51||!o((function(){var n=[];return(n.constructor={})[c]=function(){return{foo:1}},1!==n[t](Boolean).foo}))}},4822:function(t,n,e){var o=e(794),r=e(4521),i=e(3649)("species");t.exports=function(t,n){var e;return r(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!r(e.prototype)?o(e)&&null===(e=e[i])&&(e=void 0):e=void 0),new(void 0===e?Array:e)(0===n?0:n)}},9624:function(t){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},3058:function(t,n,e){var o=e(8191),r=e(9624),i=e(3649)("toStringTag"),c="Arguments"==r(function(){return arguments}());t.exports=o?r:function(t){var n,e,o;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=function(t,n){try{return t[n]}catch(t){}}(n=Object(t),i))?e:c?r(n):"Object"==(o=r(n))&&"function"==typeof n.callee?"Arguments":o}},3478:function(t,n,e){var o=e(4402),r=e(929),i=e(6683),c=e(4615);t.exports=function(t,n){for(var e=r(n),a=c.f,l=i.f,u=0;u=74)&&(o=c.match(/Chrome\/(\d+)/))&&(r=o[1]),t.exports=r&&+r},5690:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},7263:function(t,n,e){var o=e(7583),r=e(6683).f,i=e(57),c=e(1270),a=e(460),l=e(3478),u=e(4451);t.exports=function(t,n){var e,s,f,d,v,p=t.target,h=t.global,_=t.stat;if(e=h?o:_?o[p]||a(p,{}):(o[p]||{}).prototype)for(s in n){if(d=n[s],f=t.noTargetGet?(v=r(e,s))&&v.value:e[s],!u(h?s:p+(_?".":"#")+s,t.forced)&&void 0!==f){if(typeof d==typeof f)continue;l(d,f)}(t.sham||f&&f.sham)&&i(d,"sham",!0),c(e,s,d,t)}}},6544:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},2938:function(t,n,e){var o=e(6163);t.exports=function(t,n,e){if(o(t),void 0===n)return t;switch(e){case 0:return function(){return t.call(n)};case 1:return function(e){return t.call(n,e)};case 2:return function(e,o){return t.call(n,e,o)};case 3:return function(e,o,r){return t.call(n,e,o,r)}}return function(){return t.apply(n,arguments)}}},5897:function(t,n,e){var o=e(1287),r=e(7583),i=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,n){return arguments.length<2?i(o[t])||i(r[t]):o[t]&&o[t][n]||r[t]&&r[t][n]}},7583:function(t,n,e){var o=function(t){return t&&t.Math==Math&&t};t.exports=o("object"==typeof globalThis&&globalThis)||o("object"==typeof window&&window)||o("object"==typeof self&&self)||o("object"==typeof e.g&&e.g)||function(){return this}()||Function("return this")()},4402:function(t,n,e){var o=e(1324),r={}.hasOwnProperty;t.exports=Object.hasOwn||function(t,n){return r.call(o(t),n)}},4639:function(t){t.exports={}},482:function(t,n,e){var o=e(5897);t.exports=o("document","documentElement")},275:function(t,n,e){var o=e(8494),r=e(6544),i=e(6668);t.exports=!o&&!r((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},5044:function(t,n,e){var o=e(6544),r=e(9624),i="".split;t.exports=o((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==r(t)?i.call(t,""):Object(t)}:Object},9734:function(t,n,e){var o=e(1314),r=Function.toString;"function"!=typeof o.inspectSource&&(o.inspectSource=function(t){return r.call(t)}),t.exports=o.inspectSource},2743:function(t,n,e){var o,r,i,c=e(9491),a=e(7583),l=e(794),u=e(57),s=e(4402),f=e(1314),d=e(9137),v=e(4639),p="Object already initialized",h=a.WeakMap;if(c||f.state){var _=f.state||(f.state=new h),g=_.get,m=_.has,b=_.set;o=function(t,n){if(m.call(_,t))throw new TypeError(p);return n.facade=t,b.call(_,t,n),n},r=function(t){return g.call(_,t)||{}},i=function(t){return m.call(_,t)}}else{var y=d("state");v[y]=!0,o=function(t,n){if(s(t,y))throw new TypeError(p);return n.facade=t,u(t,y,n),n},r=function(t){return s(t,y)?t[y]:{}},i=function(t){return s(t,y)}}t.exports={set:o,get:r,has:i,enforce:function(t){return i(t)?r(t):o(t,{})},getterFor:function(t){return function(n){var e;if(!l(n)||(e=r(n)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return e}}}},4521:function(t,n,e){var o=e(9624);t.exports=Array.isArray||function(t){return"Array"==o(t)}},4451:function(t,n,e){var o=e(6544),r=/#|\.prototype\./,i=function(t,n){var e=a[c(t)];return e==u||e!=l&&("function"==typeof n?o(n):!!n)},c=i.normalize=function(t){return String(t).replace(r,".").toLowerCase()},a=i.data={},l=i.NATIVE="N",u=i.POLYFILL="P";t.exports=i},794:function(t){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},6268:function(t){t.exports=!1},8640:function(t,n,e){var o=e(4061),r=e(6544);t.exports=!!Object.getOwnPropertySymbols&&!r((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&o&&o<41}))},9491:function(t,n,e){var o=e(7583),r=e(9734),i=o.WeakMap;t.exports="function"==typeof i&&/native code/.test(r(i))},3590:function(t,n,e){var o,r=e(2569),i=e(8728),c=e(5690),a=e(4639),l=e(482),u=e(6668),s=e(9137),f=s("IE_PROTO"),d=function(){},v=function(t){return" + + + + +
+
+
+
+
+ + + + + + + + diff --git a/pages_player/static/app-plus/webview-demo.html b/pages_player/static/app-plus/webview-demo.html new file mode 100644 index 0000000..f96ab94 --- /dev/null +++ b/pages_player/static/app-plus/webview-demo.html @@ -0,0 +1,135 @@ + + + + + + webview-demo + + + +

web-view 组件加载网络 html 示例。点击下列按钮,跳转至其它页面。

+
+ + + + + +
+
+

网页向应用发送消息,注意:小程序端应用会在此页面后退时接收到消息。

+
+ +
+
+ + + + + + + \ No newline at end of file diff --git a/pages_player/static/h5/js/ZLMRTCClient.js b/pages_player/static/h5/js/ZLMRTCClient.js new file mode 100644 index 0000000..7ed4dd8 --- /dev/null +++ b/pages_player/static/h5/js/ZLMRTCClient.js @@ -0,0 +1,9466 @@ +var ZLMRTCClient = (function (exports) { + 'use strict'; + + const Events$1 = { + WEBRTC_NOT_SUPPORT: 'WEBRTC_NOT_SUPPORT', + WEBRTC_ICE_CANDIDATE_ERROR: 'WEBRTC_ICE_CANDIDATE_ERROR', + WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED: 'WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED', + WEBRTC_ON_REMOTE_STREAMS: 'WEBRTC_ON_REMOTE_STREAMS', + WEBRTC_ON_LOCAL_STREAM: 'WEBRTC_ON_LOCAL_STREAM', + WEBRTC_ON_CONNECTION_STATE_CHANGE: 'WEBRTC_ON_CONNECTION_STATE_CHANGE', + WEBRTC_ON_DATA_CHANNEL_OPEN: 'WEBRTC_ON_DATA_CHANNEL_OPEN', + WEBRTC_ON_DATA_CHANNEL_CLOSE: 'WEBRTC_ON_DATA_CHANNEL_CLOSE', + WEBRTC_ON_DATA_CHANNEL_ERR: 'WEBRTC_ON_DATA_CHANNEL_ERR', + WEBRTC_ON_DATA_CHANNEL_MSG: 'WEBRTC_ON_DATA_CHANNEL_MSG', + CAPTURE_STREAM_FAILED: 'CAPTURE_STREAM_FAILED' + }; + + const VERSION$1 = '1.1.0'; + const BUILD_DATE = 'Thu Jun 20 2024 16:15:41 GMT+0800 (China Standard Time)'; + + // Copyright (C) <2018> Intel Corporation + // + // SPDX-License-Identifier: Apache-2.0 + + // eslint-disable-next-line require-jsdoc + function isFirefox() { + return window.navigator.userAgent.match('Firefox') !== null; + } + // eslint-disable-next-line require-jsdoc + function isChrome() { + return window.navigator.userAgent.match('Chrome') !== null; + } + // eslint-disable-next-line require-jsdoc + function isEdge() { + return window.navigator.userAgent.match(/Edge\/(\d+).(\d+)$/) !== null; + } + + // Copyright (C) <2018> Intel Corporation + + /** + * @class AudioSourceInfo + * @classDesc Source info about an audio track. Values: 'mic', 'screen-cast', 'file', 'mixed'. + * @memberOf Owt.Base + * @readonly + * @enum {string} + */ + const AudioSourceInfo = { + MIC: 'mic', + SCREENCAST: 'screen-cast', + FILE: 'file', + MIXED: 'mixed' + }; + + /** + * @class VideoSourceInfo + * @classDesc Source info about a video track. Values: 'camera', 'screen-cast', 'file', 'mixed'. + * @memberOf Owt.Base + * @readonly + * @enum {string} + */ + const VideoSourceInfo = { + CAMERA: 'camera', + SCREENCAST: 'screen-cast', + FILE: 'file', + MIXED: 'mixed' + }; + + /** + * @class TrackKind + * @classDesc Kind of a track. Values: 'audio' for audio track, 'video' for video track, 'av' for both audio and video tracks. + * @memberOf Owt.Base + * @readonly + * @enum {string} + */ + const TrackKind = { + /** + * Audio tracks. + * @type string + */ + AUDIO: 'audio', + /** + * Video tracks. + * @type string + */ + VIDEO: 'video', + /** + * Both audio and video tracks. + * @type string + */ + AUDIO_AND_VIDEO: 'av' + }; + /** + * @class Resolution + * @memberOf Owt.Base + * @classDesc The Resolution defines the size of a rectangle. + * @constructor + * @param {number} width + * @param {number} height + */ + class Resolution { + // eslint-disable-next-line require-jsdoc + constructor(width, height) { + /** + * @member {number} width + * @instance + * @memberof Owt.Base.Resolution + */ + this.width = width; + /** + * @member {number} height + * @instance + * @memberof Owt.Base.Resolution + */ + this.height = height; + } + } + + /* + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + + let logDisabled_ = true; + let deprecationWarnings_ = true; + + /** + * Extract browser version out of the provided user agent string. + * + * @param {!string} uastring userAgent string. + * @param {!string} expr Regular expression used as match criteria. + * @param {!number} pos position in the version string to be returned. + * @return {!number} browser version. + */ + function extractVersion(uastring, expr, pos) { + const match = uastring.match(expr); + return match && match.length >= pos && parseInt(match[pos], 10); + } + + // Wraps the peerconnection event eventNameToWrap in a function + // which returns the modified event object (or false to prevent + // the event). + function wrapPeerConnectionEvent(window, eventNameToWrap, wrapper) { + if (!window.RTCPeerConnection) { + return; + } + const proto = window.RTCPeerConnection.prototype; + const nativeAddEventListener = proto.addEventListener; + proto.addEventListener = function(nativeEventName, cb) { + if (nativeEventName !== eventNameToWrap) { + return nativeAddEventListener.apply(this, arguments); + } + const wrappedCallback = (e) => { + const modifiedEvent = wrapper(e); + if (modifiedEvent) { + if (cb.handleEvent) { + cb.handleEvent(modifiedEvent); + } else { + cb(modifiedEvent); + } + } + }; + this._eventMap = this._eventMap || {}; + if (!this._eventMap[eventNameToWrap]) { + this._eventMap[eventNameToWrap] = new Map(); + } + this._eventMap[eventNameToWrap].set(cb, wrappedCallback); + return nativeAddEventListener.apply(this, [nativeEventName, + wrappedCallback]); + }; + + const nativeRemoveEventListener = proto.removeEventListener; + proto.removeEventListener = function(nativeEventName, cb) { + if (nativeEventName !== eventNameToWrap || !this._eventMap + || !this._eventMap[eventNameToWrap]) { + return nativeRemoveEventListener.apply(this, arguments); + } + if (!this._eventMap[eventNameToWrap].has(cb)) { + return nativeRemoveEventListener.apply(this, arguments); + } + const unwrappedCb = this._eventMap[eventNameToWrap].get(cb); + this._eventMap[eventNameToWrap].delete(cb); + if (this._eventMap[eventNameToWrap].size === 0) { + delete this._eventMap[eventNameToWrap]; + } + if (Object.keys(this._eventMap).length === 0) { + delete this._eventMap; + } + return nativeRemoveEventListener.apply(this, [nativeEventName, + unwrappedCb]); + }; + + Object.defineProperty(proto, 'on' + eventNameToWrap, { + get() { + return this['_on' + eventNameToWrap]; + }, + set(cb) { + if (this['_on' + eventNameToWrap]) { + this.removeEventListener(eventNameToWrap, + this['_on' + eventNameToWrap]); + delete this['_on' + eventNameToWrap]; + } + if (cb) { + this.addEventListener(eventNameToWrap, + this['_on' + eventNameToWrap] = cb); + } + }, + enumerable: true, + configurable: true + }); + } + + function disableLog(bool) { + if (typeof bool !== 'boolean') { + return new Error('Argument type: ' + typeof bool + + '. Please use a boolean.'); + } + logDisabled_ = bool; + return (bool) ? 'adapter.js logging disabled' : + 'adapter.js logging enabled'; + } + + /** + * Disable or enable deprecation warnings + * @param {!boolean} bool set to true to disable warnings. + */ + function disableWarnings(bool) { + if (typeof bool !== 'boolean') { + return new Error('Argument type: ' + typeof bool + + '. Please use a boolean.'); + } + deprecationWarnings_ = !bool; + return 'adapter.js deprecation warnings ' + (bool ? 'disabled' : 'enabled'); + } + + function log$1() { + if (typeof window === 'object') { + if (logDisabled_) { + return; + } + if (typeof console !== 'undefined' && typeof console.log === 'function') { + console.log.apply(console, arguments); + } + } + } + + /** + * Shows a deprecation warning suggesting the modern and spec-compatible API. + */ + function deprecated(oldMethod, newMethod) { + if (!deprecationWarnings_) { + return; + } + console.warn(oldMethod + ' is deprecated, please use ' + newMethod + + ' instead.'); + } + + /** + * Browser detector. + * + * @return {object} result containing browser and version + * properties. + */ + function detectBrowser(window) { + // Returned result object. + const result = {browser: null, version: null}; + + // Fail early if it's not a browser + if (typeof window === 'undefined' || !window.navigator) { + result.browser = 'Not a browser.'; + return result; + } + + const {navigator} = window; + + if (navigator.mozGetUserMedia) { // Firefox. + result.browser = 'firefox'; + result.version = extractVersion(navigator.userAgent, + /Firefox\/(\d+)\./, 1); + } else if (navigator.webkitGetUserMedia || + (window.isSecureContext === false && window.webkitRTCPeerConnection && + !window.RTCIceGatherer)) { + // Chrome, Chromium, Webview, Opera. + // Version matches Chrome/WebRTC version. + // Chrome 74 removed webkitGetUserMedia on http as well so we need the + // more complicated fallback to webkitRTCPeerConnection. + result.browser = 'chrome'; + result.version = extractVersion(navigator.userAgent, + /Chrom(e|ium)\/(\d+)\./, 2); + } else if (navigator.mediaDevices && + navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)) { // Edge. + result.browser = 'edge'; + result.version = extractVersion(navigator.userAgent, + /Edge\/(\d+).(\d+)$/, 2); + } else if (window.RTCPeerConnection && + navigator.userAgent.match(/AppleWebKit\/(\d+)\./)) { // Safari. + result.browser = 'safari'; + result.version = extractVersion(navigator.userAgent, + /AppleWebKit\/(\d+)\./, 1); + result.supportsUnifiedPlan = window.RTCRtpTransceiver && + 'currentDirection' in window.RTCRtpTransceiver.prototype; + } else { // Default fallthrough: not supported. + result.browser = 'Not a supported browser.'; + return result; + } + + return result; + } + + /** + * Checks if something is an object. + * + * @param {*} val The something you want to check. + * @return true if val is an object, false otherwise. + */ + function isObject$1(val) { + return Object.prototype.toString.call(val) === '[object Object]'; + } + + /** + * Remove all empty objects and undefined values + * from a nested object -- an enhanced and vanilla version + * of Lodash's `compact`. + */ + function compactObject(data) { + if (!isObject$1(data)) { + return data; + } + + return Object.keys(data).reduce(function(accumulator, key) { + const isObj = isObject$1(data[key]); + const value = isObj ? compactObject(data[key]) : data[key]; + const isEmptyObject = isObj && !Object.keys(value).length; + if (value === undefined || isEmptyObject) { + return accumulator; + } + return Object.assign(accumulator, {[key]: value}); + }, {}); + } + + /* iterates the stats graph recursively. */ + function walkStats(stats, base, resultSet) { + if (!base || resultSet.has(base.id)) { + return; + } + resultSet.set(base.id, base); + Object.keys(base).forEach(name => { + if (name.endsWith('Id')) { + walkStats(stats, stats.get(base[name]), resultSet); + } else if (name.endsWith('Ids')) { + base[name].forEach(id => { + walkStats(stats, stats.get(id), resultSet); + }); + } + }); + } + + /* filter getStats for a sender/receiver track. */ + function filterStats(result, track, outbound) { + const streamStatsType = outbound ? 'outbound-rtp' : 'inbound-rtp'; + const filteredResult = new Map(); + if (track === null) { + return filteredResult; + } + const trackStats = []; + result.forEach(value => { + if (value.type === 'track' && + value.trackIdentifier === track.id) { + trackStats.push(value); + } + }); + trackStats.forEach(trackStat => { + result.forEach(stats => { + if (stats.type === streamStatsType && stats.trackId === trackStat.id) { + walkStats(result, stats, filteredResult); + } + }); + }); + return filteredResult; + } + + /* + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + const logging = log$1; + + function shimGetUserMedia$3(window, browserDetails) { + const navigator = window && window.navigator; + + if (!navigator.mediaDevices) { + return; + } + + const constraintsToChrome_ = function(c) { + if (typeof c !== 'object' || c.mandatory || c.optional) { + return c; + } + const cc = {}; + Object.keys(c).forEach(key => { + if (key === 'require' || key === 'advanced' || key === 'mediaSource') { + return; + } + const r = (typeof c[key] === 'object') ? c[key] : {ideal: c[key]}; + if (r.exact !== undefined && typeof r.exact === 'number') { + r.min = r.max = r.exact; + } + const oldname_ = function(prefix, name) { + if (prefix) { + return prefix + name.charAt(0).toUpperCase() + name.slice(1); + } + return (name === 'deviceId') ? 'sourceId' : name; + }; + if (r.ideal !== undefined) { + cc.optional = cc.optional || []; + let oc = {}; + if (typeof r.ideal === 'number') { + oc[oldname_('min', key)] = r.ideal; + cc.optional.push(oc); + oc = {}; + oc[oldname_('max', key)] = r.ideal; + cc.optional.push(oc); + } else { + oc[oldname_('', key)] = r.ideal; + cc.optional.push(oc); + } + } + if (r.exact !== undefined && typeof r.exact !== 'number') { + cc.mandatory = cc.mandatory || {}; + cc.mandatory[oldname_('', key)] = r.exact; + } else { + ['min', 'max'].forEach(mix => { + if (r[mix] !== undefined) { + cc.mandatory = cc.mandatory || {}; + cc.mandatory[oldname_(mix, key)] = r[mix]; + } + }); + } + }); + if (c.advanced) { + cc.optional = (cc.optional || []).concat(c.advanced); + } + return cc; + }; + + const shimConstraints_ = function(constraints, func) { + if (browserDetails.version >= 61) { + return func(constraints); + } + constraints = JSON.parse(JSON.stringify(constraints)); + if (constraints && typeof constraints.audio === 'object') { + const remap = function(obj, a, b) { + if (a in obj && !(b in obj)) { + obj[b] = obj[a]; + delete obj[a]; + } + }; + constraints = JSON.parse(JSON.stringify(constraints)); + remap(constraints.audio, 'autoGainControl', 'googAutoGainControl'); + remap(constraints.audio, 'noiseSuppression', 'googNoiseSuppression'); + constraints.audio = constraintsToChrome_(constraints.audio); + } + if (constraints && typeof constraints.video === 'object') { + // Shim facingMode for mobile & surface pro. + let face = constraints.video.facingMode; + face = face && ((typeof face === 'object') ? face : {ideal: face}); + const getSupportedFacingModeLies = browserDetails.version < 66; + + if ((face && (face.exact === 'user' || face.exact === 'environment' || + face.ideal === 'user' || face.ideal === 'environment')) && + !(navigator.mediaDevices.getSupportedConstraints && + navigator.mediaDevices.getSupportedConstraints().facingMode && + !getSupportedFacingModeLies)) { + delete constraints.video.facingMode; + let matches; + if (face.exact === 'environment' || face.ideal === 'environment') { + matches = ['back', 'rear']; + } else if (face.exact === 'user' || face.ideal === 'user') { + matches = ['front']; + } + if (matches) { + // Look for matches in label, or use last cam for back (typical). + return navigator.mediaDevices.enumerateDevices() + .then(devices => { + devices = devices.filter(d => d.kind === 'videoinput'); + let dev = devices.find(d => matches.some(match => + d.label.toLowerCase().includes(match))); + if (!dev && devices.length && matches.includes('back')) { + dev = devices[devices.length - 1]; // more likely the back cam + } + if (dev) { + constraints.video.deviceId = face.exact ? {exact: dev.deviceId} : + {ideal: dev.deviceId}; + } + constraints.video = constraintsToChrome_(constraints.video); + logging('chrome: ' + JSON.stringify(constraints)); + return func(constraints); + }); + } + } + constraints.video = constraintsToChrome_(constraints.video); + } + logging('chrome: ' + JSON.stringify(constraints)); + return func(constraints); + }; + + const shimError_ = function(e) { + if (browserDetails.version >= 64) { + return e; + } + return { + name: { + PermissionDeniedError: 'NotAllowedError', + PermissionDismissedError: 'NotAllowedError', + InvalidStateError: 'NotAllowedError', + DevicesNotFoundError: 'NotFoundError', + ConstraintNotSatisfiedError: 'OverconstrainedError', + TrackStartError: 'NotReadableError', + MediaDeviceFailedDueToShutdown: 'NotAllowedError', + MediaDeviceKillSwitchOn: 'NotAllowedError', + TabCaptureError: 'AbortError', + ScreenCaptureError: 'AbortError', + DeviceCaptureError: 'AbortError' + }[e.name] || e.name, + message: e.message, + constraint: e.constraint || e.constraintName, + toString() { + return this.name + (this.message && ': ') + this.message; + } + }; + }; + + const getUserMedia_ = function(constraints, onSuccess, onError) { + shimConstraints_(constraints, c => { + navigator.webkitGetUserMedia(c, onSuccess, e => { + if (onError) { + onError(shimError_(e)); + } + }); + }); + }; + navigator.getUserMedia = getUserMedia_.bind(navigator); + + // Even though Chrome 45 has navigator.mediaDevices and a getUserMedia + // function which returns a Promise, it does not accept spec-style + // constraints. + if (navigator.mediaDevices.getUserMedia) { + const origGetUserMedia = navigator.mediaDevices.getUserMedia. + bind(navigator.mediaDevices); + navigator.mediaDevices.getUserMedia = function(cs) { + return shimConstraints_(cs, c => origGetUserMedia(c).then(stream => { + if (c.audio && !stream.getAudioTracks().length || + c.video && !stream.getVideoTracks().length) { + stream.getTracks().forEach(track => { + track.stop(); + }); + throw new DOMException('', 'NotFoundError'); + } + return stream; + }, e => Promise.reject(shimError_(e)))); + }; + } + } + + /* + * Copyright (c) 2018 The adapter.js project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + function shimGetDisplayMedia$2(window, getSourceId) { + if (window.navigator.mediaDevices && + 'getDisplayMedia' in window.navigator.mediaDevices) { + return; + } + if (!(window.navigator.mediaDevices)) { + return; + } + // getSourceId is a function that returns a promise resolving with + // the sourceId of the screen/window/tab to be shared. + if (typeof getSourceId !== 'function') { + console.error('shimGetDisplayMedia: getSourceId argument is not ' + + 'a function'); + return; + } + window.navigator.mediaDevices.getDisplayMedia = + function getDisplayMedia(constraints) { + return getSourceId(constraints) + .then(sourceId => { + const widthSpecified = constraints.video && constraints.video.width; + const heightSpecified = constraints.video && + constraints.video.height; + const frameRateSpecified = constraints.video && + constraints.video.frameRate; + constraints.video = { + mandatory: { + chromeMediaSource: 'desktop', + chromeMediaSourceId: sourceId, + maxFrameRate: frameRateSpecified || 3 + } + }; + if (widthSpecified) { + constraints.video.mandatory.maxWidth = widthSpecified; + } + if (heightSpecified) { + constraints.video.mandatory.maxHeight = heightSpecified; + } + return window.navigator.mediaDevices.getUserMedia(constraints); + }); + }; + } + + /* + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + + function shimMediaStream(window) { + window.MediaStream = window.MediaStream || window.webkitMediaStream; + } + + function shimOnTrack$1(window) { + if (typeof window === 'object' && window.RTCPeerConnection && !('ontrack' in + window.RTCPeerConnection.prototype)) { + Object.defineProperty(window.RTCPeerConnection.prototype, 'ontrack', { + get() { + return this._ontrack; + }, + set(f) { + if (this._ontrack) { + this.removeEventListener('track', this._ontrack); + } + this.addEventListener('track', this._ontrack = f); + }, + enumerable: true, + configurable: true + }); + const origSetRemoteDescription = + window.RTCPeerConnection.prototype.setRemoteDescription; + window.RTCPeerConnection.prototype.setRemoteDescription = + function setRemoteDescription() { + if (!this._ontrackpoly) { + this._ontrackpoly = (e) => { + // onaddstream does not fire when a track is added to an existing + // stream. But stream.onaddtrack is implemented so we use that. + e.stream.addEventListener('addtrack', te => { + let receiver; + if (window.RTCPeerConnection.prototype.getReceivers) { + receiver = this.getReceivers() + .find(r => r.track && r.track.id === te.track.id); + } else { + receiver = {track: te.track}; + } + + const event = new Event('track'); + event.track = te.track; + event.receiver = receiver; + event.transceiver = {receiver}; + event.streams = [e.stream]; + this.dispatchEvent(event); + }); + e.stream.getTracks().forEach(track => { + let receiver; + if (window.RTCPeerConnection.prototype.getReceivers) { + receiver = this.getReceivers() + .find(r => r.track && r.track.id === track.id); + } else { + receiver = {track}; + } + const event = new Event('track'); + event.track = track; + event.receiver = receiver; + event.transceiver = {receiver}; + event.streams = [e.stream]; + this.dispatchEvent(event); + }); + }; + this.addEventListener('addstream', this._ontrackpoly); + } + return origSetRemoteDescription.apply(this, arguments); + }; + } else { + // even if RTCRtpTransceiver is in window, it is only used and + // emitted in unified-plan. Unfortunately this means we need + // to unconditionally wrap the event. + wrapPeerConnectionEvent(window, 'track', e => { + if (!e.transceiver) { + Object.defineProperty(e, 'transceiver', + {value: {receiver: e.receiver}}); + } + return e; + }); + } + } + + function shimGetSendersWithDtmf(window) { + // Overrides addTrack/removeTrack, depends on shimAddTrackRemoveTrack. + if (typeof window === 'object' && window.RTCPeerConnection && + !('getSenders' in window.RTCPeerConnection.prototype) && + 'createDTMFSender' in window.RTCPeerConnection.prototype) { + const shimSenderWithDtmf = function(pc, track) { + return { + track, + get dtmf() { + if (this._dtmf === undefined) { + if (track.kind === 'audio') { + this._dtmf = pc.createDTMFSender(track); + } else { + this._dtmf = null; + } + } + return this._dtmf; + }, + _pc: pc + }; + }; + + // augment addTrack when getSenders is not available. + if (!window.RTCPeerConnection.prototype.getSenders) { + window.RTCPeerConnection.prototype.getSenders = function getSenders() { + this._senders = this._senders || []; + return this._senders.slice(); // return a copy of the internal state. + }; + const origAddTrack = window.RTCPeerConnection.prototype.addTrack; + window.RTCPeerConnection.prototype.addTrack = + function addTrack(track, stream) { + let sender = origAddTrack.apply(this, arguments); + if (!sender) { + sender = shimSenderWithDtmf(this, track); + this._senders.push(sender); + } + return sender; + }; + + const origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack; + window.RTCPeerConnection.prototype.removeTrack = + function removeTrack(sender) { + origRemoveTrack.apply(this, arguments); + const idx = this._senders.indexOf(sender); + if (idx !== -1) { + this._senders.splice(idx, 1); + } + }; + } + const origAddStream = window.RTCPeerConnection.prototype.addStream; + window.RTCPeerConnection.prototype.addStream = function addStream(stream) { + this._senders = this._senders || []; + origAddStream.apply(this, [stream]); + stream.getTracks().forEach(track => { + this._senders.push(shimSenderWithDtmf(this, track)); + }); + }; + + const origRemoveStream = window.RTCPeerConnection.prototype.removeStream; + window.RTCPeerConnection.prototype.removeStream = + function removeStream(stream) { + this._senders = this._senders || []; + origRemoveStream.apply(this, [stream]); + + stream.getTracks().forEach(track => { + const sender = this._senders.find(s => s.track === track); + if (sender) { // remove sender + this._senders.splice(this._senders.indexOf(sender), 1); + } + }); + }; + } else if (typeof window === 'object' && window.RTCPeerConnection && + 'getSenders' in window.RTCPeerConnection.prototype && + 'createDTMFSender' in window.RTCPeerConnection.prototype && + window.RTCRtpSender && + !('dtmf' in window.RTCRtpSender.prototype)) { + const origGetSenders = window.RTCPeerConnection.prototype.getSenders; + window.RTCPeerConnection.prototype.getSenders = function getSenders() { + const senders = origGetSenders.apply(this, []); + senders.forEach(sender => sender._pc = this); + return senders; + }; + + Object.defineProperty(window.RTCRtpSender.prototype, 'dtmf', { + get() { + if (this._dtmf === undefined) { + if (this.track.kind === 'audio') { + this._dtmf = this._pc.createDTMFSender(this.track); + } else { + this._dtmf = null; + } + } + return this._dtmf; + } + }); + } + } + + function shimGetStats(window) { + if (!window.RTCPeerConnection) { + return; + } + + const origGetStats = window.RTCPeerConnection.prototype.getStats; + window.RTCPeerConnection.prototype.getStats = function getStats() { + const [selector, onSucc, onErr] = arguments; + + // If selector is a function then we are in the old style stats so just + // pass back the original getStats format to avoid breaking old users. + if (arguments.length > 0 && typeof selector === 'function') { + return origGetStats.apply(this, arguments); + } + + // When spec-style getStats is supported, return those when called with + // either no arguments or the selector argument is null. + if (origGetStats.length === 0 && (arguments.length === 0 || + typeof selector !== 'function')) { + return origGetStats.apply(this, []); + } + + const fixChromeStats_ = function(response) { + const standardReport = {}; + const reports = response.result(); + reports.forEach(report => { + const standardStats = { + id: report.id, + timestamp: report.timestamp, + type: { + localcandidate: 'local-candidate', + remotecandidate: 'remote-candidate' + }[report.type] || report.type + }; + report.names().forEach(name => { + standardStats[name] = report.stat(name); + }); + standardReport[standardStats.id] = standardStats; + }); + + return standardReport; + }; + + // shim getStats with maplike support + const makeMapStats = function(stats) { + return new Map(Object.keys(stats).map(key => [key, stats[key]])); + }; + + if (arguments.length >= 2) { + const successCallbackWrapper_ = function(response) { + onSucc(makeMapStats(fixChromeStats_(response))); + }; + + return origGetStats.apply(this, [successCallbackWrapper_, + selector]); + } + + // promise-support + return new Promise((resolve, reject) => { + origGetStats.apply(this, [ + function(response) { + resolve(makeMapStats(fixChromeStats_(response))); + }, reject]); + }).then(onSucc, onErr); + }; + } + + function shimSenderReceiverGetStats(window) { + if (!(typeof window === 'object' && window.RTCPeerConnection && + window.RTCRtpSender && window.RTCRtpReceiver)) { + return; + } + + // shim sender stats. + if (!('getStats' in window.RTCRtpSender.prototype)) { + const origGetSenders = window.RTCPeerConnection.prototype.getSenders; + if (origGetSenders) { + window.RTCPeerConnection.prototype.getSenders = function getSenders() { + const senders = origGetSenders.apply(this, []); + senders.forEach(sender => sender._pc = this); + return senders; + }; + } + + const origAddTrack = window.RTCPeerConnection.prototype.addTrack; + if (origAddTrack) { + window.RTCPeerConnection.prototype.addTrack = function addTrack() { + const sender = origAddTrack.apply(this, arguments); + sender._pc = this; + return sender; + }; + } + window.RTCRtpSender.prototype.getStats = function getStats() { + const sender = this; + return this._pc.getStats().then(result => + /* Note: this will include stats of all senders that + * send a track with the same id as sender.track as + * it is not possible to identify the RTCRtpSender. + */ + filterStats(result, sender.track, true)); + }; + } + + // shim receiver stats. + if (!('getStats' in window.RTCRtpReceiver.prototype)) { + const origGetReceivers = window.RTCPeerConnection.prototype.getReceivers; + if (origGetReceivers) { + window.RTCPeerConnection.prototype.getReceivers = + function getReceivers() { + const receivers = origGetReceivers.apply(this, []); + receivers.forEach(receiver => receiver._pc = this); + return receivers; + }; + } + wrapPeerConnectionEvent(window, 'track', e => { + e.receiver._pc = e.srcElement; + return e; + }); + window.RTCRtpReceiver.prototype.getStats = function getStats() { + const receiver = this; + return this._pc.getStats().then(result => + filterStats(result, receiver.track, false)); + }; + } + + if (!('getStats' in window.RTCRtpSender.prototype && + 'getStats' in window.RTCRtpReceiver.prototype)) { + return; + } + + // shim RTCPeerConnection.getStats(track). + const origGetStats = window.RTCPeerConnection.prototype.getStats; + window.RTCPeerConnection.prototype.getStats = function getStats() { + if (arguments.length > 0 && + arguments[0] instanceof window.MediaStreamTrack) { + const track = arguments[0]; + let sender; + let receiver; + let err; + this.getSenders().forEach(s => { + if (s.track === track) { + if (sender) { + err = true; + } else { + sender = s; + } + } + }); + this.getReceivers().forEach(r => { + if (r.track === track) { + if (receiver) { + err = true; + } else { + receiver = r; + } + } + return r.track === track; + }); + if (err || (sender && receiver)) { + return Promise.reject(new DOMException( + 'There are more than one sender or receiver for the track.', + 'InvalidAccessError')); + } else if (sender) { + return sender.getStats(); + } else if (receiver) { + return receiver.getStats(); + } + return Promise.reject(new DOMException( + 'There is no sender or receiver for the track.', + 'InvalidAccessError')); + } + return origGetStats.apply(this, arguments); + }; + } + + function shimAddTrackRemoveTrackWithNative(window) { + // shim addTrack/removeTrack with native variants in order to make + // the interactions with legacy getLocalStreams behave as in other browsers. + // Keeps a mapping stream.id => [stream, rtpsenders...] + window.RTCPeerConnection.prototype.getLocalStreams = + function getLocalStreams() { + this._shimmedLocalStreams = this._shimmedLocalStreams || {}; + return Object.keys(this._shimmedLocalStreams) + .map(streamId => this._shimmedLocalStreams[streamId][0]); + }; + + const origAddTrack = window.RTCPeerConnection.prototype.addTrack; + window.RTCPeerConnection.prototype.addTrack = + function addTrack(track, stream) { + if (!stream) { + return origAddTrack.apply(this, arguments); + } + this._shimmedLocalStreams = this._shimmedLocalStreams || {}; + + const sender = origAddTrack.apply(this, arguments); + if (!this._shimmedLocalStreams[stream.id]) { + this._shimmedLocalStreams[stream.id] = [stream, sender]; + } else if (this._shimmedLocalStreams[stream.id].indexOf(sender) === -1) { + this._shimmedLocalStreams[stream.id].push(sender); + } + return sender; + }; + + const origAddStream = window.RTCPeerConnection.prototype.addStream; + window.RTCPeerConnection.prototype.addStream = function addStream(stream) { + this._shimmedLocalStreams = this._shimmedLocalStreams || {}; + + stream.getTracks().forEach(track => { + const alreadyExists = this.getSenders().find(s => s.track === track); + if (alreadyExists) { + throw new DOMException('Track already exists.', + 'InvalidAccessError'); + } + }); + const existingSenders = this.getSenders(); + origAddStream.apply(this, arguments); + const newSenders = this.getSenders() + .filter(newSender => existingSenders.indexOf(newSender) === -1); + this._shimmedLocalStreams[stream.id] = [stream].concat(newSenders); + }; + + const origRemoveStream = window.RTCPeerConnection.prototype.removeStream; + window.RTCPeerConnection.prototype.removeStream = + function removeStream(stream) { + this._shimmedLocalStreams = this._shimmedLocalStreams || {}; + delete this._shimmedLocalStreams[stream.id]; + return origRemoveStream.apply(this, arguments); + }; + + const origRemoveTrack = window.RTCPeerConnection.prototype.removeTrack; + window.RTCPeerConnection.prototype.removeTrack = + function removeTrack(sender) { + this._shimmedLocalStreams = this._shimmedLocalStreams || {}; + if (sender) { + Object.keys(this._shimmedLocalStreams).forEach(streamId => { + const idx = this._shimmedLocalStreams[streamId].indexOf(sender); + if (idx !== -1) { + this._shimmedLocalStreams[streamId].splice(idx, 1); + } + if (this._shimmedLocalStreams[streamId].length === 1) { + delete this._shimmedLocalStreams[streamId]; + } + }); + } + return origRemoveTrack.apply(this, arguments); + }; + } + + function shimAddTrackRemoveTrack(window, browserDetails) { + if (!window.RTCPeerConnection) { + return; + } + // shim addTrack and removeTrack. + if (window.RTCPeerConnection.prototype.addTrack && + browserDetails.version >= 65) { + return shimAddTrackRemoveTrackWithNative(window); + } + + // also shim pc.getLocalStreams when addTrack is shimmed + // to return the original streams. + const origGetLocalStreams = window.RTCPeerConnection.prototype + .getLocalStreams; + window.RTCPeerConnection.prototype.getLocalStreams = + function getLocalStreams() { + const nativeStreams = origGetLocalStreams.apply(this); + this._reverseStreams = this._reverseStreams || {}; + return nativeStreams.map(stream => this._reverseStreams[stream.id]); + }; + + const origAddStream = window.RTCPeerConnection.prototype.addStream; + window.RTCPeerConnection.prototype.addStream = function addStream(stream) { + this._streams = this._streams || {}; + this._reverseStreams = this._reverseStreams || {}; + + stream.getTracks().forEach(track => { + const alreadyExists = this.getSenders().find(s => s.track === track); + if (alreadyExists) { + throw new DOMException('Track already exists.', + 'InvalidAccessError'); + } + }); + // Add identity mapping for consistency with addTrack. + // Unless this is being used with a stream from addTrack. + if (!this._reverseStreams[stream.id]) { + const newStream = new window.MediaStream(stream.getTracks()); + this._streams[stream.id] = newStream; + this._reverseStreams[newStream.id] = stream; + stream = newStream; + } + origAddStream.apply(this, [stream]); + }; + + const origRemoveStream = window.RTCPeerConnection.prototype.removeStream; + window.RTCPeerConnection.prototype.removeStream = + function removeStream(stream) { + this._streams = this._streams || {}; + this._reverseStreams = this._reverseStreams || {}; + + origRemoveStream.apply(this, [(this._streams[stream.id] || stream)]); + delete this._reverseStreams[(this._streams[stream.id] ? + this._streams[stream.id].id : stream.id)]; + delete this._streams[stream.id]; + }; + + window.RTCPeerConnection.prototype.addTrack = + function addTrack(track, stream) { + if (this.signalingState === 'closed') { + throw new DOMException( + 'The RTCPeerConnection\'s signalingState is \'closed\'.', + 'InvalidStateError'); + } + const streams = [].slice.call(arguments, 1); + if (streams.length !== 1 || + !streams[0].getTracks().find(t => t === track)) { + // this is not fully correct but all we can manage without + // [[associated MediaStreams]] internal slot. + throw new DOMException( + 'The adapter.js addTrack polyfill only supports a single ' + + ' stream which is associated with the specified track.', + 'NotSupportedError'); + } + + const alreadyExists = this.getSenders().find(s => s.track === track); + if (alreadyExists) { + throw new DOMException('Track already exists.', + 'InvalidAccessError'); + } + + this._streams = this._streams || {}; + this._reverseStreams = this._reverseStreams || {}; + const oldStream = this._streams[stream.id]; + if (oldStream) { + // this is using odd Chrome behaviour, use with caution: + // https://bugs.chromium.org/p/webrtc/issues/detail?id=7815 + // Note: we rely on the high-level addTrack/dtmf shim to + // create the sender with a dtmf sender. + oldStream.addTrack(track); + + // Trigger ONN async. + Promise.resolve().then(() => { + this.dispatchEvent(new Event('negotiationneeded')); + }); + } else { + const newStream = new window.MediaStream([track]); + this._streams[stream.id] = newStream; + this._reverseStreams[newStream.id] = stream; + this.addStream(newStream); + } + return this.getSenders().find(s => s.track === track); + }; + + // replace the internal stream id with the external one and + // vice versa. + function replaceInternalStreamId(pc, description) { + let sdp = description.sdp; + Object.keys(pc._reverseStreams || []).forEach(internalId => { + const externalStream = pc._reverseStreams[internalId]; + const internalStream = pc._streams[externalStream.id]; + sdp = sdp.replace(new RegExp(internalStream.id, 'g'), + externalStream.id); + }); + return new RTCSessionDescription({ + type: description.type, + sdp + }); + } + function replaceExternalStreamId(pc, description) { + let sdp = description.sdp; + Object.keys(pc._reverseStreams || []).forEach(internalId => { + const externalStream = pc._reverseStreams[internalId]; + const internalStream = pc._streams[externalStream.id]; + sdp = sdp.replace(new RegExp(externalStream.id, 'g'), + internalStream.id); + }); + return new RTCSessionDescription({ + type: description.type, + sdp + }); + } + ['createOffer', 'createAnswer'].forEach(function(method) { + const nativeMethod = window.RTCPeerConnection.prototype[method]; + const methodObj = {[method]() { + const args = arguments; + const isLegacyCall = arguments.length && + typeof arguments[0] === 'function'; + if (isLegacyCall) { + return nativeMethod.apply(this, [ + (description) => { + const desc = replaceInternalStreamId(this, description); + args[0].apply(null, [desc]); + }, + (err) => { + if (args[1]) { + args[1].apply(null, err); + } + }, arguments[2] + ]); + } + return nativeMethod.apply(this, arguments) + .then(description => replaceInternalStreamId(this, description)); + }}; + window.RTCPeerConnection.prototype[method] = methodObj[method]; + }); + + const origSetLocalDescription = + window.RTCPeerConnection.prototype.setLocalDescription; + window.RTCPeerConnection.prototype.setLocalDescription = + function setLocalDescription() { + if (!arguments.length || !arguments[0].type) { + return origSetLocalDescription.apply(this, arguments); + } + arguments[0] = replaceExternalStreamId(this, arguments[0]); + return origSetLocalDescription.apply(this, arguments); + }; + + // TODO: mangle getStats: https://w3c.github.io/webrtc-stats/#dom-rtcmediastreamstats-streamidentifier + + const origLocalDescription = Object.getOwnPropertyDescriptor( + window.RTCPeerConnection.prototype, 'localDescription'); + Object.defineProperty(window.RTCPeerConnection.prototype, + 'localDescription', { + get() { + const description = origLocalDescription.get.apply(this); + if (description.type === '') { + return description; + } + return replaceInternalStreamId(this, description); + } + }); + + window.RTCPeerConnection.prototype.removeTrack = + function removeTrack(sender) { + if (this.signalingState === 'closed') { + throw new DOMException( + 'The RTCPeerConnection\'s signalingState is \'closed\'.', + 'InvalidStateError'); + } + // We can not yet check for sender instanceof RTCRtpSender + // since we shim RTPSender. So we check if sender._pc is set. + if (!sender._pc) { + throw new DOMException('Argument 1 of RTCPeerConnection.removeTrack ' + + 'does not implement interface RTCRtpSender.', 'TypeError'); + } + const isLocal = sender._pc === this; + if (!isLocal) { + throw new DOMException('Sender was not created by this connection.', + 'InvalidAccessError'); + } + + // Search for the native stream the senders track belongs to. + this._streams = this._streams || {}; + let stream; + Object.keys(this._streams).forEach(streamid => { + const hasTrack = this._streams[streamid].getTracks() + .find(track => sender.track === track); + if (hasTrack) { + stream = this._streams[streamid]; + } + }); + + if (stream) { + if (stream.getTracks().length === 1) { + // if this is the last track of the stream, remove the stream. This + // takes care of any shimmed _senders. + this.removeStream(this._reverseStreams[stream.id]); + } else { + // relying on the same odd chrome behaviour as above. + stream.removeTrack(sender.track); + } + this.dispatchEvent(new Event('negotiationneeded')); + } + }; + } + + function shimPeerConnection$2(window, browserDetails) { + if (!window.RTCPeerConnection && window.webkitRTCPeerConnection) { + // very basic support for old versions. + window.RTCPeerConnection = window.webkitRTCPeerConnection; + } + if (!window.RTCPeerConnection) { + return; + } + + // shim implicit creation of RTCSessionDescription/RTCIceCandidate + if (browserDetails.version < 53) { + ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'] + .forEach(function(method) { + const nativeMethod = window.RTCPeerConnection.prototype[method]; + const methodObj = {[method]() { + arguments[0] = new ((method === 'addIceCandidate') ? + window.RTCIceCandidate : + window.RTCSessionDescription)(arguments[0]); + return nativeMethod.apply(this, arguments); + }}; + window.RTCPeerConnection.prototype[method] = methodObj[method]; + }); + } + } + + // Attempt to fix ONN in plan-b mode. + function fixNegotiationNeeded(window, browserDetails) { + wrapPeerConnectionEvent(window, 'negotiationneeded', e => { + const pc = e.target; + if (browserDetails.version < 72 || (pc.getConfiguration && + pc.getConfiguration().sdpSemantics === 'plan-b')) { + if (pc.signalingState !== 'stable') { + return; + } + } + return e; + }); + } + + var chromeShim = /*#__PURE__*/Object.freeze({ + __proto__: null, + shimMediaStream: shimMediaStream, + shimOnTrack: shimOnTrack$1, + shimGetSendersWithDtmf: shimGetSendersWithDtmf, + shimGetStats: shimGetStats, + shimSenderReceiverGetStats: shimSenderReceiverGetStats, + shimAddTrackRemoveTrackWithNative: shimAddTrackRemoveTrackWithNative, + shimAddTrackRemoveTrack: shimAddTrackRemoveTrack, + shimPeerConnection: shimPeerConnection$2, + fixNegotiationNeeded: fixNegotiationNeeded, + shimGetUserMedia: shimGetUserMedia$3, + shimGetDisplayMedia: shimGetDisplayMedia$2 + }); + + /* + * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + // Edge does not like + // 1) stun: filtered after 14393 unless ?transport=udp is present + // 2) turn: that does not have all of turn:host:port?transport=udp + // 3) turn: with ipv6 addresses + // 4) turn: occurring muliple times + function filterIceServers$1(iceServers, edgeVersion) { + let hasTurn = false; + iceServers = JSON.parse(JSON.stringify(iceServers)); + return iceServers.filter(server => { + if (server && (server.urls || server.url)) { + let urls = server.urls || server.url; + if (server.url && !server.urls) { + deprecated('RTCIceServer.url', 'RTCIceServer.urls'); + } + const isString = typeof urls === 'string'; + if (isString) { + urls = [urls]; + } + urls = urls.filter(url => { + // filter STUN unconditionally. + if (url.indexOf('stun:') === 0) { + return false; + } + + const validTurn = url.startsWith('turn') && + !url.startsWith('turn:[') && + url.includes('transport=udp'); + if (validTurn && !hasTurn) { + hasTurn = true; + return true; + } + return validTurn && !hasTurn; + }); + + delete server.url; + server.urls = isString ? urls[0] : urls; + return !!urls.length; + } + }); + } + + var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + + function createCommonjsModule(fn) { + var module = { exports: {} }; + return fn(module, module.exports), module.exports; + } + + function commonjsRequire (path) { + throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); + } + + /* eslint-env node */ + + var sdp = createCommonjsModule(function (module) { + + // SDP helpers. + var SDPUtils = {}; + + // Generate an alphanumeric identifier for cname or mids. + // TODO: use UUIDs instead? https://gist.github.com/jed/982883 + SDPUtils.generateIdentifier = function() { + return Math.random().toString(36).substr(2, 10); + }; + + // The RTCP CNAME used by all peerconnections from the same JS. + SDPUtils.localCName = SDPUtils.generateIdentifier(); + + // Splits SDP into lines, dealing with both CRLF and LF. + SDPUtils.splitLines = function(blob) { + return blob.trim().split('\n').map(function(line) { + return line.trim(); + }); + }; + // Splits SDP into sessionpart and mediasections. Ensures CRLF. + SDPUtils.splitSections = function(blob) { + var parts = blob.split('\nm='); + return parts.map(function(part, index) { + return (index > 0 ? 'm=' + part : part).trim() + '\r\n'; + }); + }; + + // returns the session description. + SDPUtils.getDescription = function(blob) { + var sections = SDPUtils.splitSections(blob); + return sections && sections[0]; + }; + + // returns the individual media sections. + SDPUtils.getMediaSections = function(blob) { + var sections = SDPUtils.splitSections(blob); + sections.shift(); + return sections; + }; + + // Returns lines that start with a certain prefix. + SDPUtils.matchPrefix = function(blob, prefix) { + return SDPUtils.splitLines(blob).filter(function(line) { + return line.indexOf(prefix) === 0; + }); + }; + + // Parses an ICE candidate line. Sample input: + // candidate:702786350 2 udp 41819902 8.8.8.8 60769 typ relay raddr 8.8.8.8 + // rport 55996" + SDPUtils.parseCandidate = function(line) { + var parts; + // Parse both variants. + if (line.indexOf('a=candidate:') === 0) { + parts = line.substring(12).split(' '); + } else { + parts = line.substring(10).split(' '); + } + + var candidate = { + foundation: parts[0], + component: parseInt(parts[1], 10), + protocol: parts[2].toLowerCase(), + priority: parseInt(parts[3], 10), + ip: parts[4], + address: parts[4], // address is an alias for ip. + port: parseInt(parts[5], 10), + // skip parts[6] == 'typ' + type: parts[7] + }; + + for (var i = 8; i < parts.length; i += 2) { + switch (parts[i]) { + case 'raddr': + candidate.relatedAddress = parts[i + 1]; + break; + case 'rport': + candidate.relatedPort = parseInt(parts[i + 1], 10); + break; + case 'tcptype': + candidate.tcpType = parts[i + 1]; + break; + case 'ufrag': + candidate.ufrag = parts[i + 1]; // for backward compability. + candidate.usernameFragment = parts[i + 1]; + break; + default: // extension handling, in particular ufrag + candidate[parts[i]] = parts[i + 1]; + break; + } + } + return candidate; + }; + + // Translates a candidate object into SDP candidate attribute. + SDPUtils.writeCandidate = function(candidate) { + var sdp = []; + sdp.push(candidate.foundation); + sdp.push(candidate.component); + sdp.push(candidate.protocol.toUpperCase()); + sdp.push(candidate.priority); + sdp.push(candidate.address || candidate.ip); + sdp.push(candidate.port); + + var type = candidate.type; + sdp.push('typ'); + sdp.push(type); + if (type !== 'host' && candidate.relatedAddress && + candidate.relatedPort) { + sdp.push('raddr'); + sdp.push(candidate.relatedAddress); + sdp.push('rport'); + sdp.push(candidate.relatedPort); + } + if (candidate.tcpType && candidate.protocol.toLowerCase() === 'tcp') { + sdp.push('tcptype'); + sdp.push(candidate.tcpType); + } + if (candidate.usernameFragment || candidate.ufrag) { + sdp.push('ufrag'); + sdp.push(candidate.usernameFragment || candidate.ufrag); + } + return 'candidate:' + sdp.join(' '); + }; + + // Parses an ice-options line, returns an array of option tags. + // a=ice-options:foo bar + SDPUtils.parseIceOptions = function(line) { + return line.substr(14).split(' '); + }; + + // Parses an rtpmap line, returns RTCRtpCoddecParameters. Sample input: + // a=rtpmap:111 opus/48000/2 + SDPUtils.parseRtpMap = function(line) { + var parts = line.substr(9).split(' '); + var parsed = { + payloadType: parseInt(parts.shift(), 10) // was: id + }; + + parts = parts[0].split('/'); + + parsed.name = parts[0]; + parsed.clockRate = parseInt(parts[1], 10); // was: clockrate + parsed.channels = parts.length === 3 ? parseInt(parts[2], 10) : 1; + // legacy alias, got renamed back to channels in ORTC. + parsed.numChannels = parsed.channels; + return parsed; + }; + + // Generate an a=rtpmap line from RTCRtpCodecCapability or + // RTCRtpCodecParameters. + SDPUtils.writeRtpMap = function(codec) { + var pt = codec.payloadType; + if (codec.preferredPayloadType !== undefined) { + pt = codec.preferredPayloadType; + } + var channels = codec.channels || codec.numChannels || 1; + return 'a=rtpmap:' + pt + ' ' + codec.name + '/' + codec.clockRate + + (channels !== 1 ? '/' + channels : '') + '\r\n'; + }; + + // Parses an a=extmap line (headerextension from RFC 5285). Sample input: + // a=extmap:2 urn:ietf:params:rtp-hdrext:toffset + // a=extmap:2/sendonly urn:ietf:params:rtp-hdrext:toffset + SDPUtils.parseExtmap = function(line) { + var parts = line.substr(9).split(' '); + return { + id: parseInt(parts[0], 10), + direction: parts[0].indexOf('/') > 0 ? parts[0].split('/')[1] : 'sendrecv', + uri: parts[1] + }; + }; + + // Generates a=extmap line from RTCRtpHeaderExtensionParameters or + // RTCRtpHeaderExtension. + SDPUtils.writeExtmap = function(headerExtension) { + return 'a=extmap:' + (headerExtension.id || headerExtension.preferredId) + + (headerExtension.direction && headerExtension.direction !== 'sendrecv' + ? '/' + headerExtension.direction + : '') + + ' ' + headerExtension.uri + '\r\n'; + }; + + // Parses an ftmp line, returns dictionary. Sample input: + // a=fmtp:96 vbr=on;cng=on + // Also deals with vbr=on; cng=on + SDPUtils.parseFmtp = function(line) { + var parsed = {}; + var kv; + var parts = line.substr(line.indexOf(' ') + 1).split(';'); + for (var j = 0; j < parts.length; j++) { + kv = parts[j].trim().split('='); + parsed[kv[0].trim()] = kv[1]; + } + return parsed; + }; + + // Generates an a=ftmp line from RTCRtpCodecCapability or RTCRtpCodecParameters. + SDPUtils.writeFmtp = function(codec) { + var line = ''; + var pt = codec.payloadType; + if (codec.preferredPayloadType !== undefined) { + pt = codec.preferredPayloadType; + } + if (codec.parameters && Object.keys(codec.parameters).length) { + var params = []; + Object.keys(codec.parameters).forEach(function(param) { + if (codec.parameters[param]) { + params.push(param + '=' + codec.parameters[param]); + } else { + params.push(param); + } + }); + line += 'a=fmtp:' + pt + ' ' + params.join(';') + '\r\n'; + } + return line; + }; + + // Parses an rtcp-fb line, returns RTCPRtcpFeedback object. Sample input: + // a=rtcp-fb:98 nack rpsi + SDPUtils.parseRtcpFb = function(line) { + var parts = line.substr(line.indexOf(' ') + 1).split(' '); + return { + type: parts.shift(), + parameter: parts.join(' ') + }; + }; + // Generate a=rtcp-fb lines from RTCRtpCodecCapability or RTCRtpCodecParameters. + SDPUtils.writeRtcpFb = function(codec) { + var lines = ''; + var pt = codec.payloadType; + if (codec.preferredPayloadType !== undefined) { + pt = codec.preferredPayloadType; + } + if (codec.rtcpFeedback && codec.rtcpFeedback.length) { + // FIXME: special handling for trr-int? + codec.rtcpFeedback.forEach(function(fb) { + lines += 'a=rtcp-fb:' + pt + ' ' + fb.type + + (fb.parameter && fb.parameter.length ? ' ' + fb.parameter : '') + + '\r\n'; + }); + } + return lines; + }; + + // Parses an RFC 5576 ssrc media attribute. Sample input: + // a=ssrc:3735928559 cname:something + SDPUtils.parseSsrcMedia = function(line) { + var sp = line.indexOf(' '); + var parts = { + ssrc: parseInt(line.substr(7, sp - 7), 10) + }; + var colon = line.indexOf(':', sp); + if (colon > -1) { + parts.attribute = line.substr(sp + 1, colon - sp - 1); + parts.value = line.substr(colon + 1); + } else { + parts.attribute = line.substr(sp + 1); + } + return parts; + }; + + SDPUtils.parseSsrcGroup = function(line) { + var parts = line.substr(13).split(' '); + return { + semantics: parts.shift(), + ssrcs: parts.map(function(ssrc) { + return parseInt(ssrc, 10); + }) + }; + }; + + // Extracts the MID (RFC 5888) from a media section. + // returns the MID or undefined if no mid line was found. + SDPUtils.getMid = function(mediaSection) { + var mid = SDPUtils.matchPrefix(mediaSection, 'a=mid:')[0]; + if (mid) { + return mid.substr(6); + } + }; + + SDPUtils.parseFingerprint = function(line) { + var parts = line.substr(14).split(' '); + return { + algorithm: parts[0].toLowerCase(), // algorithm is case-sensitive in Edge. + value: parts[1] + }; + }; + + // Extracts DTLS parameters from SDP media section or sessionpart. + // FIXME: for consistency with other functions this should only + // get the fingerprint line as input. See also getIceParameters. + SDPUtils.getDtlsParameters = function(mediaSection, sessionpart) { + var lines = SDPUtils.matchPrefix(mediaSection + sessionpart, + 'a=fingerprint:'); + // Note: a=setup line is ignored since we use the 'auto' role. + // Note2: 'algorithm' is not case sensitive except in Edge. + return { + role: 'auto', + fingerprints: lines.map(SDPUtils.parseFingerprint) + }; + }; + + // Serializes DTLS parameters to SDP. + SDPUtils.writeDtlsParameters = function(params, setupType) { + var sdp = 'a=setup:' + setupType + '\r\n'; + params.fingerprints.forEach(function(fp) { + sdp += 'a=fingerprint:' + fp.algorithm + ' ' + fp.value + '\r\n'; + }); + return sdp; + }; + + // Parses a=crypto lines into + // https://rawgit.com/aboba/edgertc/master/msortc-rs4.html#dictionary-rtcsrtpsdesparameters-members + SDPUtils.parseCryptoLine = function(line) { + var parts = line.substr(9).split(' '); + return { + tag: parseInt(parts[0], 10), + cryptoSuite: parts[1], + keyParams: parts[2], + sessionParams: parts.slice(3), + }; + }; + + SDPUtils.writeCryptoLine = function(parameters) { + return 'a=crypto:' + parameters.tag + ' ' + + parameters.cryptoSuite + ' ' + + (typeof parameters.keyParams === 'object' + ? SDPUtils.writeCryptoKeyParams(parameters.keyParams) + : parameters.keyParams) + + (parameters.sessionParams ? ' ' + parameters.sessionParams.join(' ') : '') + + '\r\n'; + }; + + // Parses the crypto key parameters into + // https://rawgit.com/aboba/edgertc/master/msortc-rs4.html#rtcsrtpkeyparam* + SDPUtils.parseCryptoKeyParams = function(keyParams) { + if (keyParams.indexOf('inline:') !== 0) { + return null; + } + var parts = keyParams.substr(7).split('|'); + return { + keyMethod: 'inline', + keySalt: parts[0], + lifeTime: parts[1], + mkiValue: parts[2] ? parts[2].split(':')[0] : undefined, + mkiLength: parts[2] ? parts[2].split(':')[1] : undefined, + }; + }; + + SDPUtils.writeCryptoKeyParams = function(keyParams) { + return keyParams.keyMethod + ':' + + keyParams.keySalt + + (keyParams.lifeTime ? '|' + keyParams.lifeTime : '') + + (keyParams.mkiValue && keyParams.mkiLength + ? '|' + keyParams.mkiValue + ':' + keyParams.mkiLength + : ''); + }; + + // Extracts all SDES paramters. + SDPUtils.getCryptoParameters = function(mediaSection, sessionpart) { + var lines = SDPUtils.matchPrefix(mediaSection + sessionpart, + 'a=crypto:'); + return lines.map(SDPUtils.parseCryptoLine); + }; + + // Parses ICE information from SDP media section or sessionpart. + // FIXME: for consistency with other functions this should only + // get the ice-ufrag and ice-pwd lines as input. + SDPUtils.getIceParameters = function(mediaSection, sessionpart) { + var ufrag = SDPUtils.matchPrefix(mediaSection + sessionpart, + 'a=ice-ufrag:')[0]; + var pwd = SDPUtils.matchPrefix(mediaSection + sessionpart, + 'a=ice-pwd:')[0]; + if (!(ufrag && pwd)) { + return null; + } + return { + usernameFragment: ufrag.substr(12), + password: pwd.substr(10), + }; + }; + + // Serializes ICE parameters to SDP. + SDPUtils.writeIceParameters = function(params) { + return 'a=ice-ufrag:' + params.usernameFragment + '\r\n' + + 'a=ice-pwd:' + params.password + '\r\n'; + }; + + // Parses the SDP media section and returns RTCRtpParameters. + SDPUtils.parseRtpParameters = function(mediaSection) { + var description = { + codecs: [], + headerExtensions: [], + fecMechanisms: [], + rtcp: [] + }; + var lines = SDPUtils.splitLines(mediaSection); + var mline = lines[0].split(' '); + for (var i = 3; i < mline.length; i++) { // find all codecs from mline[3..] + var pt = mline[i]; + var rtpmapline = SDPUtils.matchPrefix( + mediaSection, 'a=rtpmap:' + pt + ' ')[0]; + if (rtpmapline) { + var codec = SDPUtils.parseRtpMap(rtpmapline); + var fmtps = SDPUtils.matchPrefix( + mediaSection, 'a=fmtp:' + pt + ' '); + // Only the first a=fmtp: is considered. + codec.parameters = fmtps.length ? SDPUtils.parseFmtp(fmtps[0]) : {}; + codec.rtcpFeedback = SDPUtils.matchPrefix( + mediaSection, 'a=rtcp-fb:' + pt + ' ') + .map(SDPUtils.parseRtcpFb); + description.codecs.push(codec); + // parse FEC mechanisms from rtpmap lines. + switch (codec.name.toUpperCase()) { + case 'RED': + case 'ULPFEC': + description.fecMechanisms.push(codec.name.toUpperCase()); + break; + } + } + } + SDPUtils.matchPrefix(mediaSection, 'a=extmap:').forEach(function(line) { + description.headerExtensions.push(SDPUtils.parseExtmap(line)); + }); + // FIXME: parse rtcp. + return description; + }; + + // Generates parts of the SDP media section describing the capabilities / + // parameters. + SDPUtils.writeRtpDescription = function(kind, caps) { + var sdp = ''; + + // Build the mline. + sdp += 'm=' + kind + ' '; + sdp += caps.codecs.length > 0 ? '9' : '0'; // reject if no codecs. + sdp += ' UDP/TLS/RTP/SAVPF '; + sdp += caps.codecs.map(function(codec) { + if (codec.preferredPayloadType !== undefined) { + return codec.preferredPayloadType; + } + return codec.payloadType; + }).join(' ') + '\r\n'; + + sdp += 'c=IN IP4 0.0.0.0\r\n'; + sdp += 'a=rtcp:9 IN IP4 0.0.0.0\r\n'; + + // Add a=rtpmap lines for each codec. Also fmtp and rtcp-fb. + caps.codecs.forEach(function(codec) { + sdp += SDPUtils.writeRtpMap(codec); + sdp += SDPUtils.writeFmtp(codec); + sdp += SDPUtils.writeRtcpFb(codec); + }); + var maxptime = 0; + caps.codecs.forEach(function(codec) { + if (codec.maxptime > maxptime) { + maxptime = codec.maxptime; + } + }); + if (maxptime > 0) { + sdp += 'a=maxptime:' + maxptime + '\r\n'; + } + sdp += 'a=rtcp-mux\r\n'; + + if (caps.headerExtensions) { + caps.headerExtensions.forEach(function(extension) { + sdp += SDPUtils.writeExtmap(extension); + }); + } + // FIXME: write fecMechanisms. + return sdp; + }; + + // Parses the SDP media section and returns an array of + // RTCRtpEncodingParameters. + SDPUtils.parseRtpEncodingParameters = function(mediaSection) { + var encodingParameters = []; + var description = SDPUtils.parseRtpParameters(mediaSection); + var hasRed = description.fecMechanisms.indexOf('RED') !== -1; + var hasUlpfec = description.fecMechanisms.indexOf('ULPFEC') !== -1; + + // filter a=ssrc:... cname:, ignore PlanB-msid + var ssrcs = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:') + .map(function(line) { + return SDPUtils.parseSsrcMedia(line); + }) + .filter(function(parts) { + return parts.attribute === 'cname'; + }); + var primarySsrc = ssrcs.length > 0 && ssrcs[0].ssrc; + var secondarySsrc; + + var flows = SDPUtils.matchPrefix(mediaSection, 'a=ssrc-group:FID') + .map(function(line) { + var parts = line.substr(17).split(' '); + return parts.map(function(part) { + return parseInt(part, 10); + }); + }); + if (flows.length > 0 && flows[0].length > 1 && flows[0][0] === primarySsrc) { + secondarySsrc = flows[0][1]; + } + + description.codecs.forEach(function(codec) { + if (codec.name.toUpperCase() === 'RTX' && codec.parameters.apt) { + var encParam = { + ssrc: primarySsrc, + codecPayloadType: parseInt(codec.parameters.apt, 10) + }; + if (primarySsrc && secondarySsrc) { + encParam.rtx = {ssrc: secondarySsrc}; + } + encodingParameters.push(encParam); + if (hasRed) { + encParam = JSON.parse(JSON.stringify(encParam)); + encParam.fec = { + ssrc: primarySsrc, + mechanism: hasUlpfec ? 'red+ulpfec' : 'red' + }; + encodingParameters.push(encParam); + } + } + }); + if (encodingParameters.length === 0 && primarySsrc) { + encodingParameters.push({ + ssrc: primarySsrc + }); + } + + // we support both b=AS and b=TIAS but interpret AS as TIAS. + var bandwidth = SDPUtils.matchPrefix(mediaSection, 'b='); + if (bandwidth.length) { + if (bandwidth[0].indexOf('b=TIAS:') === 0) { + bandwidth = parseInt(bandwidth[0].substr(7), 10); + } else if (bandwidth[0].indexOf('b=AS:') === 0) { + // use formula from JSEP to convert b=AS to TIAS value. + bandwidth = parseInt(bandwidth[0].substr(5), 10) * 1000 * 0.95 + - (50 * 40 * 8); + } else { + bandwidth = undefined; + } + encodingParameters.forEach(function(params) { + params.maxBitrate = bandwidth; + }); + } + return encodingParameters; + }; + + // parses http://draft.ortc.org/#rtcrtcpparameters* + SDPUtils.parseRtcpParameters = function(mediaSection) { + var rtcpParameters = {}; + + // Gets the first SSRC. Note tha with RTX there might be multiple + // SSRCs. + var remoteSsrc = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:') + .map(function(line) { + return SDPUtils.parseSsrcMedia(line); + }) + .filter(function(obj) { + return obj.attribute === 'cname'; + })[0]; + if (remoteSsrc) { + rtcpParameters.cname = remoteSsrc.value; + rtcpParameters.ssrc = remoteSsrc.ssrc; + } + + // Edge uses the compound attribute instead of reducedSize + // compound is !reducedSize + var rsize = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-rsize'); + rtcpParameters.reducedSize = rsize.length > 0; + rtcpParameters.compound = rsize.length === 0; + + // parses the rtcp-mux attrіbute. + // Note that Edge does not support unmuxed RTCP. + var mux = SDPUtils.matchPrefix(mediaSection, 'a=rtcp-mux'); + rtcpParameters.mux = mux.length > 0; + + return rtcpParameters; + }; + + // parses either a=msid: or a=ssrc:... msid lines and returns + // the id of the MediaStream and MediaStreamTrack. + SDPUtils.parseMsid = function(mediaSection) { + var parts; + var spec = SDPUtils.matchPrefix(mediaSection, 'a=msid:'); + if (spec.length === 1) { + parts = spec[0].substr(7).split(' '); + return {stream: parts[0], track: parts[1]}; + } + var planB = SDPUtils.matchPrefix(mediaSection, 'a=ssrc:') + .map(function(line) { + return SDPUtils.parseSsrcMedia(line); + }) + .filter(function(msidParts) { + return msidParts.attribute === 'msid'; + }); + if (planB.length > 0) { + parts = planB[0].value.split(' '); + return {stream: parts[0], track: parts[1]}; + } + }; + + // SCTP + // parses draft-ietf-mmusic-sctp-sdp-26 first and falls back + // to draft-ietf-mmusic-sctp-sdp-05 + SDPUtils.parseSctpDescription = function(mediaSection) { + var mline = SDPUtils.parseMLine(mediaSection); + var maxSizeLine = SDPUtils.matchPrefix(mediaSection, 'a=max-message-size:'); + var maxMessageSize; + if (maxSizeLine.length > 0) { + maxMessageSize = parseInt(maxSizeLine[0].substr(19), 10); + } + if (isNaN(maxMessageSize)) { + maxMessageSize = 65536; + } + var sctpPort = SDPUtils.matchPrefix(mediaSection, 'a=sctp-port:'); + if (sctpPort.length > 0) { + return { + port: parseInt(sctpPort[0].substr(12), 10), + protocol: mline.fmt, + maxMessageSize: maxMessageSize + }; + } + var sctpMapLines = SDPUtils.matchPrefix(mediaSection, 'a=sctpmap:'); + if (sctpMapLines.length > 0) { + var parts = SDPUtils.matchPrefix(mediaSection, 'a=sctpmap:')[0] + .substr(10) + .split(' '); + return { + port: parseInt(parts[0], 10), + protocol: parts[1], + maxMessageSize: maxMessageSize + }; + } + }; + + // SCTP + // outputs the draft-ietf-mmusic-sctp-sdp-26 version that all browsers + // support by now receiving in this format, unless we originally parsed + // as the draft-ietf-mmusic-sctp-sdp-05 format (indicated by the m-line + // protocol of DTLS/SCTP -- without UDP/ or TCP/) + SDPUtils.writeSctpDescription = function(media, sctp) { + var output = []; + if (media.protocol !== 'DTLS/SCTP') { + output = [ + 'm=' + media.kind + ' 9 ' + media.protocol + ' ' + sctp.protocol + '\r\n', + 'c=IN IP4 0.0.0.0\r\n', + 'a=sctp-port:' + sctp.port + '\r\n' + ]; + } else { + output = [ + 'm=' + media.kind + ' 9 ' + media.protocol + ' ' + sctp.port + '\r\n', + 'c=IN IP4 0.0.0.0\r\n', + 'a=sctpmap:' + sctp.port + ' ' + sctp.protocol + ' 65535\r\n' + ]; + } + if (sctp.maxMessageSize !== undefined) { + output.push('a=max-message-size:' + sctp.maxMessageSize + '\r\n'); + } + return output.join(''); + }; + + // Generate a session ID for SDP. + // https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-20#section-5.2.1 + // recommends using a cryptographically random +ve 64-bit value + // but right now this should be acceptable and within the right range + SDPUtils.generateSessionId = function() { + return Math.random().toString().substr(2, 21); + }; + + // Write boilder plate for start of SDP + // sessId argument is optional - if not supplied it will + // be generated randomly + // sessVersion is optional and defaults to 2 + // sessUser is optional and defaults to 'thisisadapterortc' + SDPUtils.writeSessionBoilerplate = function(sessId, sessVer, sessUser) { + var sessionId; + var version = sessVer !== undefined ? sessVer : 2; + if (sessId) { + sessionId = sessId; + } else { + sessionId = SDPUtils.generateSessionId(); + } + var user = sessUser || 'thisisadapterortc'; + // FIXME: sess-id should be an NTP timestamp. + return 'v=0\r\n' + + 'o=' + user + ' ' + sessionId + ' ' + version + + ' IN IP4 127.0.0.1\r\n' + + 's=-\r\n' + + 't=0 0\r\n'; + }; + + SDPUtils.writeMediaSection = function(transceiver, caps, type, stream) { + var sdp = SDPUtils.writeRtpDescription(transceiver.kind, caps); + + // Map ICE parameters (ufrag, pwd) to SDP. + sdp += SDPUtils.writeIceParameters( + transceiver.iceGatherer.getLocalParameters()); + + // Map DTLS parameters to SDP. + sdp += SDPUtils.writeDtlsParameters( + transceiver.dtlsTransport.getLocalParameters(), + type === 'offer' ? 'actpass' : 'active'); + + sdp += 'a=mid:' + transceiver.mid + '\r\n'; + + if (transceiver.direction) { + sdp += 'a=' + transceiver.direction + '\r\n'; + } else if (transceiver.rtpSender && transceiver.rtpReceiver) { + sdp += 'a=sendrecv\r\n'; + } else if (transceiver.rtpSender) { + sdp += 'a=sendonly\r\n'; + } else if (transceiver.rtpReceiver) { + sdp += 'a=recvonly\r\n'; + } else { + sdp += 'a=inactive\r\n'; + } + + if (transceiver.rtpSender) { + // spec. + var msid = 'msid:' + stream.id + ' ' + + transceiver.rtpSender.track.id + '\r\n'; + sdp += 'a=' + msid; + + // for Chrome. + sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + + ' ' + msid; + if (transceiver.sendEncodingParameters[0].rtx) { + sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + + ' ' + msid; + sdp += 'a=ssrc-group:FID ' + + transceiver.sendEncodingParameters[0].ssrc + ' ' + + transceiver.sendEncodingParameters[0].rtx.ssrc + + '\r\n'; + } + } + // FIXME: this should be written by writeRtpDescription. + sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + + ' cname:' + SDPUtils.localCName + '\r\n'; + if (transceiver.rtpSender && transceiver.sendEncodingParameters[0].rtx) { + sdp += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + + ' cname:' + SDPUtils.localCName + '\r\n'; + } + return sdp; + }; + + // Gets the direction from the mediaSection or the sessionpart. + SDPUtils.getDirection = function(mediaSection, sessionpart) { + // Look for sendrecv, sendonly, recvonly, inactive, default to sendrecv. + var lines = SDPUtils.splitLines(mediaSection); + for (var i = 0; i < lines.length; i++) { + switch (lines[i]) { + case 'a=sendrecv': + case 'a=sendonly': + case 'a=recvonly': + case 'a=inactive': + return lines[i].substr(2); + // FIXME: What should happen here? + } + } + if (sessionpart) { + return SDPUtils.getDirection(sessionpart); + } + return 'sendrecv'; + }; + + SDPUtils.getKind = function(mediaSection) { + var lines = SDPUtils.splitLines(mediaSection); + var mline = lines[0].split(' '); + return mline[0].substr(2); + }; + + SDPUtils.isRejected = function(mediaSection) { + return mediaSection.split(' ', 2)[1] === '0'; + }; + + SDPUtils.parseMLine = function(mediaSection) { + var lines = SDPUtils.splitLines(mediaSection); + var parts = lines[0].substr(2).split(' '); + return { + kind: parts[0], + port: parseInt(parts[1], 10), + protocol: parts[2], + fmt: parts.slice(3).join(' ') + }; + }; + + SDPUtils.parseOLine = function(mediaSection) { + var line = SDPUtils.matchPrefix(mediaSection, 'o=')[0]; + var parts = line.substr(2).split(' '); + return { + username: parts[0], + sessionId: parts[1], + sessionVersion: parseInt(parts[2], 10), + netType: parts[3], + addressType: parts[4], + address: parts[5] + }; + }; + + // a very naive interpretation of a valid SDP. + SDPUtils.isValidSDP = function(blob) { + if (typeof blob !== 'string' || blob.length === 0) { + return false; + } + var lines = SDPUtils.splitLines(blob); + for (var i = 0; i < lines.length; i++) { + if (lines[i].length < 2 || lines[i].charAt(1) !== '=') { + return false; + } + // TODO: check the modifier a bit more. + } + return true; + }; + + // Expose public methods. + { + module.exports = SDPUtils; + } + }); + + /* + * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + + + + function fixStatsType(stat) { + return { + inboundrtp: 'inbound-rtp', + outboundrtp: 'outbound-rtp', + candidatepair: 'candidate-pair', + localcandidate: 'local-candidate', + remotecandidate: 'remote-candidate' + }[stat.type] || stat.type; + } + + function writeMediaSection(transceiver, caps, type, stream, dtlsRole) { + var sdp$1 = sdp.writeRtpDescription(transceiver.kind, caps); + + // Map ICE parameters (ufrag, pwd) to SDP. + sdp$1 += sdp.writeIceParameters( + transceiver.iceGatherer.getLocalParameters()); + + // Map DTLS parameters to SDP. + sdp$1 += sdp.writeDtlsParameters( + transceiver.dtlsTransport.getLocalParameters(), + type === 'offer' ? 'actpass' : dtlsRole || 'active'); + + sdp$1 += 'a=mid:' + transceiver.mid + '\r\n'; + + if (transceiver.rtpSender && transceiver.rtpReceiver) { + sdp$1 += 'a=sendrecv\r\n'; + } else if (transceiver.rtpSender) { + sdp$1 += 'a=sendonly\r\n'; + } else if (transceiver.rtpReceiver) { + sdp$1 += 'a=recvonly\r\n'; + } else { + sdp$1 += 'a=inactive\r\n'; + } + + if (transceiver.rtpSender) { + var trackId = transceiver.rtpSender._initialTrackId || + transceiver.rtpSender.track.id; + transceiver.rtpSender._initialTrackId = trackId; + // spec. + var msid = 'msid:' + (stream ? stream.id : '-') + ' ' + + trackId + '\r\n'; + sdp$1 += 'a=' + msid; + // for Chrome. Legacy should no longer be required. + sdp$1 += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + + ' ' + msid; + + // RTX + if (transceiver.sendEncodingParameters[0].rtx) { + sdp$1 += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + + ' ' + msid; + sdp$1 += 'a=ssrc-group:FID ' + + transceiver.sendEncodingParameters[0].ssrc + ' ' + + transceiver.sendEncodingParameters[0].rtx.ssrc + + '\r\n'; + } + } + // FIXME: this should be written by writeRtpDescription. + sdp$1 += 'a=ssrc:' + transceiver.sendEncodingParameters[0].ssrc + + ' cname:' + sdp.localCName + '\r\n'; + if (transceiver.rtpSender && transceiver.sendEncodingParameters[0].rtx) { + sdp$1 += 'a=ssrc:' + transceiver.sendEncodingParameters[0].rtx.ssrc + + ' cname:' + sdp.localCName + '\r\n'; + } + return sdp$1; + } + + // Edge does not like + // 1) stun: filtered after 14393 unless ?transport=udp is present + // 2) turn: that does not have all of turn:host:port?transport=udp + // 3) turn: with ipv6 addresses + // 4) turn: occurring muliple times + function filterIceServers(iceServers, edgeVersion) { + var hasTurn = false; + iceServers = JSON.parse(JSON.stringify(iceServers)); + return iceServers.filter(function(server) { + if (server && (server.urls || server.url)) { + var urls = server.urls || server.url; + if (server.url && !server.urls) { + console.warn('RTCIceServer.url is deprecated! Use urls instead.'); + } + var isString = typeof urls === 'string'; + if (isString) { + urls = [urls]; + } + urls = urls.filter(function(url) { + var validTurn = url.indexOf('turn:') === 0 && + url.indexOf('transport=udp') !== -1 && + url.indexOf('turn:[') === -1 && + !hasTurn; + + if (validTurn) { + hasTurn = true; + return true; + } + return url.indexOf('stun:') === 0 && edgeVersion >= 14393 && + url.indexOf('?transport=udp') === -1; + }); + + delete server.url; + server.urls = isString ? urls[0] : urls; + return !!urls.length; + } + }); + } + + // Determines the intersection of local and remote capabilities. + function getCommonCapabilities(localCapabilities, remoteCapabilities) { + var commonCapabilities = { + codecs: [], + headerExtensions: [], + fecMechanisms: [] + }; + + var findCodecByPayloadType = function(pt, codecs) { + pt = parseInt(pt, 10); + for (var i = 0; i < codecs.length; i++) { + if (codecs[i].payloadType === pt || + codecs[i].preferredPayloadType === pt) { + return codecs[i]; + } + } + }; + + var rtxCapabilityMatches = function(lRtx, rRtx, lCodecs, rCodecs) { + var lCodec = findCodecByPayloadType(lRtx.parameters.apt, lCodecs); + var rCodec = findCodecByPayloadType(rRtx.parameters.apt, rCodecs); + return lCodec && rCodec && + lCodec.name.toLowerCase() === rCodec.name.toLowerCase(); + }; + + localCapabilities.codecs.forEach(function(lCodec) { + for (var i = 0; i < remoteCapabilities.codecs.length; i++) { + var rCodec = remoteCapabilities.codecs[i]; + if (lCodec.name.toLowerCase() === rCodec.name.toLowerCase() && + lCodec.clockRate === rCodec.clockRate) { + if (lCodec.name.toLowerCase() === 'rtx' && + lCodec.parameters && rCodec.parameters.apt) { + // for RTX we need to find the local rtx that has a apt + // which points to the same local codec as the remote one. + if (!rtxCapabilityMatches(lCodec, rCodec, + localCapabilities.codecs, remoteCapabilities.codecs)) { + continue; + } + } + rCodec = JSON.parse(JSON.stringify(rCodec)); // deepcopy + // number of channels is the highest common number of channels + rCodec.numChannels = Math.min(lCodec.numChannels, + rCodec.numChannels); + // push rCodec so we reply with offerer payload type + commonCapabilities.codecs.push(rCodec); + + // determine common feedback mechanisms + rCodec.rtcpFeedback = rCodec.rtcpFeedback.filter(function(fb) { + for (var j = 0; j < lCodec.rtcpFeedback.length; j++) { + if (lCodec.rtcpFeedback[j].type === fb.type && + lCodec.rtcpFeedback[j].parameter === fb.parameter) { + return true; + } + } + return false; + }); + // FIXME: also need to determine .parameters + // see https://github.com/openpeer/ortc/issues/569 + break; + } + } + }); + + localCapabilities.headerExtensions.forEach(function(lHeaderExtension) { + for (var i = 0; i < remoteCapabilities.headerExtensions.length; + i++) { + var rHeaderExtension = remoteCapabilities.headerExtensions[i]; + if (lHeaderExtension.uri === rHeaderExtension.uri) { + commonCapabilities.headerExtensions.push(rHeaderExtension); + break; + } + } + }); + + // FIXME: fecMechanisms + return commonCapabilities; + } + + // is action=setLocalDescription with type allowed in signalingState + function isActionAllowedInSignalingState(action, type, signalingState) { + return { + offer: { + setLocalDescription: ['stable', 'have-local-offer'], + setRemoteDescription: ['stable', 'have-remote-offer'] + }, + answer: { + setLocalDescription: ['have-remote-offer', 'have-local-pranswer'], + setRemoteDescription: ['have-local-offer', 'have-remote-pranswer'] + } + }[type][action].indexOf(signalingState) !== -1; + } + + function maybeAddCandidate(iceTransport, candidate) { + // Edge's internal representation adds some fields therefore + // not all fieldѕ are taken into account. + var alreadyAdded = iceTransport.getRemoteCandidates() + .find(function(remoteCandidate) { + return candidate.foundation === remoteCandidate.foundation && + candidate.ip === remoteCandidate.ip && + candidate.port === remoteCandidate.port && + candidate.priority === remoteCandidate.priority && + candidate.protocol === remoteCandidate.protocol && + candidate.type === remoteCandidate.type; + }); + if (!alreadyAdded) { + iceTransport.addRemoteCandidate(candidate); + } + return !alreadyAdded; + } + + + function makeError(name, description) { + var e = new Error(description); + e.name = name; + // legacy error codes from https://heycam.github.io/webidl/#idl-DOMException-error-names + e.code = { + NotSupportedError: 9, + InvalidStateError: 11, + InvalidAccessError: 15, + TypeError: undefined, + OperationError: undefined + }[name]; + return e; + } + + var rtcpeerconnection = function(window, edgeVersion) { + // https://w3c.github.io/mediacapture-main/#mediastream + // Helper function to add the track to the stream and + // dispatch the event ourselves. + function addTrackToStreamAndFireEvent(track, stream) { + stream.addTrack(track); + stream.dispatchEvent(new window.MediaStreamTrackEvent('addtrack', + {track: track})); + } + + function removeTrackFromStreamAndFireEvent(track, stream) { + stream.removeTrack(track); + stream.dispatchEvent(new window.MediaStreamTrackEvent('removetrack', + {track: track})); + } + + function fireAddTrack(pc, track, receiver, streams) { + var trackEvent = new Event('track'); + trackEvent.track = track; + trackEvent.receiver = receiver; + trackEvent.transceiver = {receiver: receiver}; + trackEvent.streams = streams; + window.setTimeout(function() { + pc._dispatchEvent('track', trackEvent); + }); + } + + var RTCPeerConnection = function(config) { + var pc = this; + + var _eventTarget = document.createDocumentFragment(); + ['addEventListener', 'removeEventListener', 'dispatchEvent'] + .forEach(function(method) { + pc[method] = _eventTarget[method].bind(_eventTarget); + }); + + this.canTrickleIceCandidates = null; + + this.needNegotiation = false; + + this.localStreams = []; + this.remoteStreams = []; + + this._localDescription = null; + this._remoteDescription = null; + + this.signalingState = 'stable'; + this.iceConnectionState = 'new'; + this.connectionState = 'new'; + this.iceGatheringState = 'new'; + + config = JSON.parse(JSON.stringify(config || {})); + + this.usingBundle = config.bundlePolicy === 'max-bundle'; + if (config.rtcpMuxPolicy === 'negotiate') { + throw(makeError('NotSupportedError', + 'rtcpMuxPolicy \'negotiate\' is not supported')); + } else if (!config.rtcpMuxPolicy) { + config.rtcpMuxPolicy = 'require'; + } + + switch (config.iceTransportPolicy) { + case 'all': + case 'relay': + break; + default: + config.iceTransportPolicy = 'all'; + break; + } + + switch (config.bundlePolicy) { + case 'balanced': + case 'max-compat': + case 'max-bundle': + break; + default: + config.bundlePolicy = 'balanced'; + break; + } + + config.iceServers = filterIceServers(config.iceServers || [], edgeVersion); + + this._iceGatherers = []; + if (config.iceCandidatePoolSize) { + for (var i = config.iceCandidatePoolSize; i > 0; i--) { + this._iceGatherers.push(new window.RTCIceGatherer({ + iceServers: config.iceServers, + gatherPolicy: config.iceTransportPolicy + })); + } + } else { + config.iceCandidatePoolSize = 0; + } + + this._config = config; + + // per-track iceGathers, iceTransports, dtlsTransports, rtpSenders, ... + // everything that is needed to describe a SDP m-line. + this.transceivers = []; + + this._sdpSessionId = sdp.generateSessionId(); + this._sdpSessionVersion = 0; + + this._dtlsRole = undefined; // role for a=setup to use in answers. + + this._isClosed = false; + }; + + Object.defineProperty(RTCPeerConnection.prototype, 'localDescription', { + configurable: true, + get: function() { + return this._localDescription; + } + }); + Object.defineProperty(RTCPeerConnection.prototype, 'remoteDescription', { + configurable: true, + get: function() { + return this._remoteDescription; + } + }); + + // set up event handlers on prototype + RTCPeerConnection.prototype.onicecandidate = null; + RTCPeerConnection.prototype.onaddstream = null; + RTCPeerConnection.prototype.ontrack = null; + RTCPeerConnection.prototype.onremovestream = null; + RTCPeerConnection.prototype.onsignalingstatechange = null; + RTCPeerConnection.prototype.oniceconnectionstatechange = null; + RTCPeerConnection.prototype.onconnectionstatechange = null; + RTCPeerConnection.prototype.onicegatheringstatechange = null; + RTCPeerConnection.prototype.onnegotiationneeded = null; + RTCPeerConnection.prototype.ondatachannel = null; + + RTCPeerConnection.prototype._dispatchEvent = function(name, event) { + if (this._isClosed) { + return; + } + this.dispatchEvent(event); + if (typeof this['on' + name] === 'function') { + this['on' + name](event); + } + }; + + RTCPeerConnection.prototype._emitGatheringStateChange = function() { + var event = new Event('icegatheringstatechange'); + this._dispatchEvent('icegatheringstatechange', event); + }; + + RTCPeerConnection.prototype.getConfiguration = function() { + return this._config; + }; + + RTCPeerConnection.prototype.getLocalStreams = function() { + return this.localStreams; + }; + + RTCPeerConnection.prototype.getRemoteStreams = function() { + return this.remoteStreams; + }; + + // internal helper to create a transceiver object. + // (which is not yet the same as the WebRTC 1.0 transceiver) + RTCPeerConnection.prototype._createTransceiver = function(kind, doNotAdd) { + var hasBundleTransport = this.transceivers.length > 0; + var transceiver = { + track: null, + iceGatherer: null, + iceTransport: null, + dtlsTransport: null, + localCapabilities: null, + remoteCapabilities: null, + rtpSender: null, + rtpReceiver: null, + kind: kind, + mid: null, + sendEncodingParameters: null, + recvEncodingParameters: null, + stream: null, + associatedRemoteMediaStreams: [], + wantReceive: true + }; + if (this.usingBundle && hasBundleTransport) { + transceiver.iceTransport = this.transceivers[0].iceTransport; + transceiver.dtlsTransport = this.transceivers[0].dtlsTransport; + } else { + var transports = this._createIceAndDtlsTransports(); + transceiver.iceTransport = transports.iceTransport; + transceiver.dtlsTransport = transports.dtlsTransport; + } + if (!doNotAdd) { + this.transceivers.push(transceiver); + } + return transceiver; + }; + + RTCPeerConnection.prototype.addTrack = function(track, stream) { + if (this._isClosed) { + throw makeError('InvalidStateError', + 'Attempted to call addTrack on a closed peerconnection.'); + } + + var alreadyExists = this.transceivers.find(function(s) { + return s.track === track; + }); + + if (alreadyExists) { + throw makeError('InvalidAccessError', 'Track already exists.'); + } + + var transceiver; + for (var i = 0; i < this.transceivers.length; i++) { + if (!this.transceivers[i].track && + this.transceivers[i].kind === track.kind) { + transceiver = this.transceivers[i]; + } + } + if (!transceiver) { + transceiver = this._createTransceiver(track.kind); + } + + this._maybeFireNegotiationNeeded(); + + if (this.localStreams.indexOf(stream) === -1) { + this.localStreams.push(stream); + } + + transceiver.track = track; + transceiver.stream = stream; + transceiver.rtpSender = new window.RTCRtpSender(track, + transceiver.dtlsTransport); + return transceiver.rtpSender; + }; + + RTCPeerConnection.prototype.addStream = function(stream) { + var pc = this; + if (edgeVersion >= 15025) { + stream.getTracks().forEach(function(track) { + pc.addTrack(track, stream); + }); + } else { + // Clone is necessary for local demos mostly, attaching directly + // to two different senders does not work (build 10547). + // Fixed in 15025 (or earlier) + var clonedStream = stream.clone(); + stream.getTracks().forEach(function(track, idx) { + var clonedTrack = clonedStream.getTracks()[idx]; + track.addEventListener('enabled', function(event) { + clonedTrack.enabled = event.enabled; + }); + }); + clonedStream.getTracks().forEach(function(track) { + pc.addTrack(track, clonedStream); + }); + } + }; + + RTCPeerConnection.prototype.removeTrack = function(sender) { + if (this._isClosed) { + throw makeError('InvalidStateError', + 'Attempted to call removeTrack on a closed peerconnection.'); + } + + if (!(sender instanceof window.RTCRtpSender)) { + throw new TypeError('Argument 1 of RTCPeerConnection.removeTrack ' + + 'does not implement interface RTCRtpSender.'); + } + + var transceiver = this.transceivers.find(function(t) { + return t.rtpSender === sender; + }); + + if (!transceiver) { + throw makeError('InvalidAccessError', + 'Sender was not created by this connection.'); + } + var stream = transceiver.stream; + + transceiver.rtpSender.stop(); + transceiver.rtpSender = null; + transceiver.track = null; + transceiver.stream = null; + + // remove the stream from the set of local streams + var localStreams = this.transceivers.map(function(t) { + return t.stream; + }); + if (localStreams.indexOf(stream) === -1 && + this.localStreams.indexOf(stream) > -1) { + this.localStreams.splice(this.localStreams.indexOf(stream), 1); + } + + this._maybeFireNegotiationNeeded(); + }; + + RTCPeerConnection.prototype.removeStream = function(stream) { + var pc = this; + stream.getTracks().forEach(function(track) { + var sender = pc.getSenders().find(function(s) { + return s.track === track; + }); + if (sender) { + pc.removeTrack(sender); + } + }); + }; + + RTCPeerConnection.prototype.getSenders = function() { + return this.transceivers.filter(function(transceiver) { + return !!transceiver.rtpSender; + }) + .map(function(transceiver) { + return transceiver.rtpSender; + }); + }; + + RTCPeerConnection.prototype.getReceivers = function() { + return this.transceivers.filter(function(transceiver) { + return !!transceiver.rtpReceiver; + }) + .map(function(transceiver) { + return transceiver.rtpReceiver; + }); + }; + + + RTCPeerConnection.prototype._createIceGatherer = function(sdpMLineIndex, + usingBundle) { + var pc = this; + if (usingBundle && sdpMLineIndex > 0) { + return this.transceivers[0].iceGatherer; + } else if (this._iceGatherers.length) { + return this._iceGatherers.shift(); + } + var iceGatherer = new window.RTCIceGatherer({ + iceServers: this._config.iceServers, + gatherPolicy: this._config.iceTransportPolicy + }); + Object.defineProperty(iceGatherer, 'state', + {value: 'new', writable: true} + ); + + this.transceivers[sdpMLineIndex].bufferedCandidateEvents = []; + this.transceivers[sdpMLineIndex].bufferCandidates = function(event) { + var end = !event.candidate || Object.keys(event.candidate).length === 0; + // polyfill since RTCIceGatherer.state is not implemented in + // Edge 10547 yet. + iceGatherer.state = end ? 'completed' : 'gathering'; + if (pc.transceivers[sdpMLineIndex].bufferedCandidateEvents !== null) { + pc.transceivers[sdpMLineIndex].bufferedCandidateEvents.push(event); + } + }; + iceGatherer.addEventListener('localcandidate', + this.transceivers[sdpMLineIndex].bufferCandidates); + return iceGatherer; + }; + + // start gathering from an RTCIceGatherer. + RTCPeerConnection.prototype._gather = function(mid, sdpMLineIndex) { + var pc = this; + var iceGatherer = this.transceivers[sdpMLineIndex].iceGatherer; + if (iceGatherer.onlocalcandidate) { + return; + } + var bufferedCandidateEvents = + this.transceivers[sdpMLineIndex].bufferedCandidateEvents; + this.transceivers[sdpMLineIndex].bufferedCandidateEvents = null; + iceGatherer.removeEventListener('localcandidate', + this.transceivers[sdpMLineIndex].bufferCandidates); + iceGatherer.onlocalcandidate = function(evt) { + if (pc.usingBundle && sdpMLineIndex > 0) { + // if we know that we use bundle we can drop candidates with + // ѕdpMLineIndex > 0. If we don't do this then our state gets + // confused since we dispose the extra ice gatherer. + return; + } + var event = new Event('icecandidate'); + event.candidate = {sdpMid: mid, sdpMLineIndex: sdpMLineIndex}; + + var cand = evt.candidate; + // Edge emits an empty object for RTCIceCandidateComplete‥ + var end = !cand || Object.keys(cand).length === 0; + if (end) { + // polyfill since RTCIceGatherer.state is not implemented in + // Edge 10547 yet. + if (iceGatherer.state === 'new' || iceGatherer.state === 'gathering') { + iceGatherer.state = 'completed'; + } + } else { + if (iceGatherer.state === 'new') { + iceGatherer.state = 'gathering'; + } + // RTCIceCandidate doesn't have a component, needs to be added + cand.component = 1; + // also the usernameFragment. TODO: update SDP to take both variants. + cand.ufrag = iceGatherer.getLocalParameters().usernameFragment; + + var serializedCandidate = sdp.writeCandidate(cand); + event.candidate = Object.assign(event.candidate, + sdp.parseCandidate(serializedCandidate)); + + event.candidate.candidate = serializedCandidate; + event.candidate.toJSON = function() { + return { + candidate: event.candidate.candidate, + sdpMid: event.candidate.sdpMid, + sdpMLineIndex: event.candidate.sdpMLineIndex, + usernameFragment: event.candidate.usernameFragment + }; + }; + } + + // update local description. + var sections = sdp.getMediaSections(pc._localDescription.sdp); + if (!end) { + sections[event.candidate.sdpMLineIndex] += + 'a=' + event.candidate.candidate + '\r\n'; + } else { + sections[event.candidate.sdpMLineIndex] += + 'a=end-of-candidates\r\n'; + } + pc._localDescription.sdp = + sdp.getDescription(pc._localDescription.sdp) + + sections.join(''); + var complete = pc.transceivers.every(function(transceiver) { + return transceiver.iceGatherer && + transceiver.iceGatherer.state === 'completed'; + }); + + if (pc.iceGatheringState !== 'gathering') { + pc.iceGatheringState = 'gathering'; + pc._emitGatheringStateChange(); + } + + // Emit candidate. Also emit null candidate when all gatherers are + // complete. + if (!end) { + pc._dispatchEvent('icecandidate', event); + } + if (complete) { + pc._dispatchEvent('icecandidate', new Event('icecandidate')); + pc.iceGatheringState = 'complete'; + pc._emitGatheringStateChange(); + } + }; + + // emit already gathered candidates. + window.setTimeout(function() { + bufferedCandidateEvents.forEach(function(e) { + iceGatherer.onlocalcandidate(e); + }); + }, 0); + }; + + // Create ICE transport and DTLS transport. + RTCPeerConnection.prototype._createIceAndDtlsTransports = function() { + var pc = this; + var iceTransport = new window.RTCIceTransport(null); + iceTransport.onicestatechange = function() { + pc._updateIceConnectionState(); + pc._updateConnectionState(); + }; + + var dtlsTransport = new window.RTCDtlsTransport(iceTransport); + dtlsTransport.ondtlsstatechange = function() { + pc._updateConnectionState(); + }; + dtlsTransport.onerror = function() { + // onerror does not set state to failed by itself. + Object.defineProperty(dtlsTransport, 'state', + {value: 'failed', writable: true}); + pc._updateConnectionState(); + }; + + return { + iceTransport: iceTransport, + dtlsTransport: dtlsTransport + }; + }; + + // Destroy ICE gatherer, ICE transport and DTLS transport. + // Without triggering the callbacks. + RTCPeerConnection.prototype._disposeIceAndDtlsTransports = function( + sdpMLineIndex) { + var iceGatherer = this.transceivers[sdpMLineIndex].iceGatherer; + if (iceGatherer) { + delete iceGatherer.onlocalcandidate; + delete this.transceivers[sdpMLineIndex].iceGatherer; + } + var iceTransport = this.transceivers[sdpMLineIndex].iceTransport; + if (iceTransport) { + delete iceTransport.onicestatechange; + delete this.transceivers[sdpMLineIndex].iceTransport; + } + var dtlsTransport = this.transceivers[sdpMLineIndex].dtlsTransport; + if (dtlsTransport) { + delete dtlsTransport.ondtlsstatechange; + delete dtlsTransport.onerror; + delete this.transceivers[sdpMLineIndex].dtlsTransport; + } + }; + + // Start the RTP Sender and Receiver for a transceiver. + RTCPeerConnection.prototype._transceive = function(transceiver, + send, recv) { + var params = getCommonCapabilities(transceiver.localCapabilities, + transceiver.remoteCapabilities); + if (send && transceiver.rtpSender) { + params.encodings = transceiver.sendEncodingParameters; + params.rtcp = { + cname: sdp.localCName, + compound: transceiver.rtcpParameters.compound + }; + if (transceiver.recvEncodingParameters.length) { + params.rtcp.ssrc = transceiver.recvEncodingParameters[0].ssrc; + } + transceiver.rtpSender.send(params); + } + if (recv && transceiver.rtpReceiver && params.codecs.length > 0) { + // remove RTX field in Edge 14942 + if (transceiver.kind === 'video' + && transceiver.recvEncodingParameters + && edgeVersion < 15019) { + transceiver.recvEncodingParameters.forEach(function(p) { + delete p.rtx; + }); + } + if (transceiver.recvEncodingParameters.length) { + params.encodings = transceiver.recvEncodingParameters; + } else { + params.encodings = [{}]; + } + params.rtcp = { + compound: transceiver.rtcpParameters.compound + }; + if (transceiver.rtcpParameters.cname) { + params.rtcp.cname = transceiver.rtcpParameters.cname; + } + if (transceiver.sendEncodingParameters.length) { + params.rtcp.ssrc = transceiver.sendEncodingParameters[0].ssrc; + } + transceiver.rtpReceiver.receive(params); + } + }; + + RTCPeerConnection.prototype.setLocalDescription = function(description) { + var pc = this; + + // Note: pranswer is not supported. + if (['offer', 'answer'].indexOf(description.type) === -1) { + return Promise.reject(makeError('TypeError', + 'Unsupported type "' + description.type + '"')); + } + + if (!isActionAllowedInSignalingState('setLocalDescription', + description.type, pc.signalingState) || pc._isClosed) { + return Promise.reject(makeError('InvalidStateError', + 'Can not set local ' + description.type + + ' in state ' + pc.signalingState)); + } + + var sections; + var sessionpart; + if (description.type === 'offer') { + // VERY limited support for SDP munging. Limited to: + // * changing the order of codecs + sections = sdp.splitSections(description.sdp); + sessionpart = sections.shift(); + sections.forEach(function(mediaSection, sdpMLineIndex) { + var caps = sdp.parseRtpParameters(mediaSection); + pc.transceivers[sdpMLineIndex].localCapabilities = caps; + }); + + pc.transceivers.forEach(function(transceiver, sdpMLineIndex) { + pc._gather(transceiver.mid, sdpMLineIndex); + }); + } else if (description.type === 'answer') { + sections = sdp.splitSections(pc._remoteDescription.sdp); + sessionpart = sections.shift(); + var isIceLite = sdp.matchPrefix(sessionpart, + 'a=ice-lite').length > 0; + sections.forEach(function(mediaSection, sdpMLineIndex) { + var transceiver = pc.transceivers[sdpMLineIndex]; + var iceGatherer = transceiver.iceGatherer; + var iceTransport = transceiver.iceTransport; + var dtlsTransport = transceiver.dtlsTransport; + var localCapabilities = transceiver.localCapabilities; + var remoteCapabilities = transceiver.remoteCapabilities; + + // treat bundle-only as not-rejected. + var rejected = sdp.isRejected(mediaSection) && + sdp.matchPrefix(mediaSection, 'a=bundle-only').length === 0; + + if (!rejected && !transceiver.rejected) { + var remoteIceParameters = sdp.getIceParameters( + mediaSection, sessionpart); + var remoteDtlsParameters = sdp.getDtlsParameters( + mediaSection, sessionpart); + if (isIceLite) { + remoteDtlsParameters.role = 'server'; + } + + if (!pc.usingBundle || sdpMLineIndex === 0) { + pc._gather(transceiver.mid, sdpMLineIndex); + if (iceTransport.state === 'new') { + iceTransport.start(iceGatherer, remoteIceParameters, + isIceLite ? 'controlling' : 'controlled'); + } + if (dtlsTransport.state === 'new') { + dtlsTransport.start(remoteDtlsParameters); + } + } + + // Calculate intersection of capabilities. + var params = getCommonCapabilities(localCapabilities, + remoteCapabilities); + + // Start the RTCRtpSender. The RTCRtpReceiver for this + // transceiver has already been started in setRemoteDescription. + pc._transceive(transceiver, + params.codecs.length > 0, + false); + } + }); + } + + pc._localDescription = { + type: description.type, + sdp: description.sdp + }; + if (description.type === 'offer') { + pc._updateSignalingState('have-local-offer'); + } else { + pc._updateSignalingState('stable'); + } + + return Promise.resolve(); + }; + + RTCPeerConnection.prototype.setRemoteDescription = function(description) { + var pc = this; + + // Note: pranswer is not supported. + if (['offer', 'answer'].indexOf(description.type) === -1) { + return Promise.reject(makeError('TypeError', + 'Unsupported type "' + description.type + '"')); + } + + if (!isActionAllowedInSignalingState('setRemoteDescription', + description.type, pc.signalingState) || pc._isClosed) { + return Promise.reject(makeError('InvalidStateError', + 'Can not set remote ' + description.type + + ' in state ' + pc.signalingState)); + } + + var streams = {}; + pc.remoteStreams.forEach(function(stream) { + streams[stream.id] = stream; + }); + var receiverList = []; + var sections = sdp.splitSections(description.sdp); + var sessionpart = sections.shift(); + var isIceLite = sdp.matchPrefix(sessionpart, + 'a=ice-lite').length > 0; + var usingBundle = sdp.matchPrefix(sessionpart, + 'a=group:BUNDLE ').length > 0; + pc.usingBundle = usingBundle; + var iceOptions = sdp.matchPrefix(sessionpart, + 'a=ice-options:')[0]; + if (iceOptions) { + pc.canTrickleIceCandidates = iceOptions.substr(14).split(' ') + .indexOf('trickle') >= 0; + } else { + pc.canTrickleIceCandidates = false; + } + + sections.forEach(function(mediaSection, sdpMLineIndex) { + var lines = sdp.splitLines(mediaSection); + var kind = sdp.getKind(mediaSection); + // treat bundle-only as not-rejected. + var rejected = sdp.isRejected(mediaSection) && + sdp.matchPrefix(mediaSection, 'a=bundle-only').length === 0; + var protocol = lines[0].substr(2).split(' ')[2]; + + var direction = sdp.getDirection(mediaSection, sessionpart); + var remoteMsid = sdp.parseMsid(mediaSection); + + var mid = sdp.getMid(mediaSection) || sdp.generateIdentifier(); + + // Reject datachannels which are not implemented yet. + if (rejected || (kind === 'application' && (protocol === 'DTLS/SCTP' || + protocol === 'UDP/DTLS/SCTP'))) { + // TODO: this is dangerous in the case where a non-rejected m-line + // becomes rejected. + pc.transceivers[sdpMLineIndex] = { + mid: mid, + kind: kind, + protocol: protocol, + rejected: true + }; + return; + } + + if (!rejected && pc.transceivers[sdpMLineIndex] && + pc.transceivers[sdpMLineIndex].rejected) { + // recycle a rejected transceiver. + pc.transceivers[sdpMLineIndex] = pc._createTransceiver(kind, true); + } + + var transceiver; + var iceGatherer; + var iceTransport; + var dtlsTransport; + var rtpReceiver; + var sendEncodingParameters; + var recvEncodingParameters; + var localCapabilities; + + var track; + // FIXME: ensure the mediaSection has rtcp-mux set. + var remoteCapabilities = sdp.parseRtpParameters(mediaSection); + var remoteIceParameters; + var remoteDtlsParameters; + if (!rejected) { + remoteIceParameters = sdp.getIceParameters(mediaSection, + sessionpart); + remoteDtlsParameters = sdp.getDtlsParameters(mediaSection, + sessionpart); + remoteDtlsParameters.role = 'client'; + } + recvEncodingParameters = + sdp.parseRtpEncodingParameters(mediaSection); + + var rtcpParameters = sdp.parseRtcpParameters(mediaSection); + + var isComplete = sdp.matchPrefix(mediaSection, + 'a=end-of-candidates', sessionpart).length > 0; + var cands = sdp.matchPrefix(mediaSection, 'a=candidate:') + .map(function(cand) { + return sdp.parseCandidate(cand); + }) + .filter(function(cand) { + return cand.component === 1; + }); + + // Check if we can use BUNDLE and dispose transports. + if ((description.type === 'offer' || description.type === 'answer') && + !rejected && usingBundle && sdpMLineIndex > 0 && + pc.transceivers[sdpMLineIndex]) { + pc._disposeIceAndDtlsTransports(sdpMLineIndex); + pc.transceivers[sdpMLineIndex].iceGatherer = + pc.transceivers[0].iceGatherer; + pc.transceivers[sdpMLineIndex].iceTransport = + pc.transceivers[0].iceTransport; + pc.transceivers[sdpMLineIndex].dtlsTransport = + pc.transceivers[0].dtlsTransport; + if (pc.transceivers[sdpMLineIndex].rtpSender) { + pc.transceivers[sdpMLineIndex].rtpSender.setTransport( + pc.transceivers[0].dtlsTransport); + } + if (pc.transceivers[sdpMLineIndex].rtpReceiver) { + pc.transceivers[sdpMLineIndex].rtpReceiver.setTransport( + pc.transceivers[0].dtlsTransport); + } + } + if (description.type === 'offer' && !rejected) { + transceiver = pc.transceivers[sdpMLineIndex] || + pc._createTransceiver(kind); + transceiver.mid = mid; + + if (!transceiver.iceGatherer) { + transceiver.iceGatherer = pc._createIceGatherer(sdpMLineIndex, + usingBundle); + } + + if (cands.length && transceiver.iceTransport.state === 'new') { + if (isComplete && (!usingBundle || sdpMLineIndex === 0)) { + transceiver.iceTransport.setRemoteCandidates(cands); + } else { + cands.forEach(function(candidate) { + maybeAddCandidate(transceiver.iceTransport, candidate); + }); + } + } + + localCapabilities = window.RTCRtpReceiver.getCapabilities(kind); + + // filter RTX until additional stuff needed for RTX is implemented + // in adapter.js + if (edgeVersion < 15019) { + localCapabilities.codecs = localCapabilities.codecs.filter( + function(codec) { + return codec.name !== 'rtx'; + }); + } + + sendEncodingParameters = transceiver.sendEncodingParameters || [{ + ssrc: (2 * sdpMLineIndex + 2) * 1001 + }]; + + // TODO: rewrite to use http://w3c.github.io/webrtc-pc/#set-associated-remote-streams + var isNewTrack = false; + if (direction === 'sendrecv' || direction === 'sendonly') { + isNewTrack = !transceiver.rtpReceiver; + rtpReceiver = transceiver.rtpReceiver || + new window.RTCRtpReceiver(transceiver.dtlsTransport, kind); + + if (isNewTrack) { + var stream; + track = rtpReceiver.track; + // FIXME: does not work with Plan B. + if (remoteMsid && remoteMsid.stream === '-') ; else if (remoteMsid) { + if (!streams[remoteMsid.stream]) { + streams[remoteMsid.stream] = new window.MediaStream(); + Object.defineProperty(streams[remoteMsid.stream], 'id', { + get: function() { + return remoteMsid.stream; + } + }); + } + Object.defineProperty(track, 'id', { + get: function() { + return remoteMsid.track; + } + }); + stream = streams[remoteMsid.stream]; + } else { + if (!streams.default) { + streams.default = new window.MediaStream(); + } + stream = streams.default; + } + if (stream) { + addTrackToStreamAndFireEvent(track, stream); + transceiver.associatedRemoteMediaStreams.push(stream); + } + receiverList.push([track, rtpReceiver, stream]); + } + } else if (transceiver.rtpReceiver && transceiver.rtpReceiver.track) { + transceiver.associatedRemoteMediaStreams.forEach(function(s) { + var nativeTrack = s.getTracks().find(function(t) { + return t.id === transceiver.rtpReceiver.track.id; + }); + if (nativeTrack) { + removeTrackFromStreamAndFireEvent(nativeTrack, s); + } + }); + transceiver.associatedRemoteMediaStreams = []; + } + + transceiver.localCapabilities = localCapabilities; + transceiver.remoteCapabilities = remoteCapabilities; + transceiver.rtpReceiver = rtpReceiver; + transceiver.rtcpParameters = rtcpParameters; + transceiver.sendEncodingParameters = sendEncodingParameters; + transceiver.recvEncodingParameters = recvEncodingParameters; + + // Start the RTCRtpReceiver now. The RTPSender is started in + // setLocalDescription. + pc._transceive(pc.transceivers[sdpMLineIndex], + false, + isNewTrack); + } else if (description.type === 'answer' && !rejected) { + transceiver = pc.transceivers[sdpMLineIndex]; + iceGatherer = transceiver.iceGatherer; + iceTransport = transceiver.iceTransport; + dtlsTransport = transceiver.dtlsTransport; + rtpReceiver = transceiver.rtpReceiver; + sendEncodingParameters = transceiver.sendEncodingParameters; + localCapabilities = transceiver.localCapabilities; + + pc.transceivers[sdpMLineIndex].recvEncodingParameters = + recvEncodingParameters; + pc.transceivers[sdpMLineIndex].remoteCapabilities = + remoteCapabilities; + pc.transceivers[sdpMLineIndex].rtcpParameters = rtcpParameters; + + if (cands.length && iceTransport.state === 'new') { + if ((isIceLite || isComplete) && + (!usingBundle || sdpMLineIndex === 0)) { + iceTransport.setRemoteCandidates(cands); + } else { + cands.forEach(function(candidate) { + maybeAddCandidate(transceiver.iceTransport, candidate); + }); + } + } + + if (!usingBundle || sdpMLineIndex === 0) { + if (iceTransport.state === 'new') { + iceTransport.start(iceGatherer, remoteIceParameters, + 'controlling'); + } + if (dtlsTransport.state === 'new') { + dtlsTransport.start(remoteDtlsParameters); + } + } + + // If the offer contained RTX but the answer did not, + // remove RTX from sendEncodingParameters. + var commonCapabilities = getCommonCapabilities( + transceiver.localCapabilities, + transceiver.remoteCapabilities); + + var hasRtx = commonCapabilities.codecs.filter(function(c) { + return c.name.toLowerCase() === 'rtx'; + }).length; + if (!hasRtx && transceiver.sendEncodingParameters[0].rtx) { + delete transceiver.sendEncodingParameters[0].rtx; + } + + pc._transceive(transceiver, + direction === 'sendrecv' || direction === 'recvonly', + direction === 'sendrecv' || direction === 'sendonly'); + + // TODO: rewrite to use http://w3c.github.io/webrtc-pc/#set-associated-remote-streams + if (rtpReceiver && + (direction === 'sendrecv' || direction === 'sendonly')) { + track = rtpReceiver.track; + if (remoteMsid) { + if (!streams[remoteMsid.stream]) { + streams[remoteMsid.stream] = new window.MediaStream(); + } + addTrackToStreamAndFireEvent(track, streams[remoteMsid.stream]); + receiverList.push([track, rtpReceiver, streams[remoteMsid.stream]]); + } else { + if (!streams.default) { + streams.default = new window.MediaStream(); + } + addTrackToStreamAndFireEvent(track, streams.default); + receiverList.push([track, rtpReceiver, streams.default]); + } + } else { + // FIXME: actually the receiver should be created later. + delete transceiver.rtpReceiver; + } + } + }); + + if (pc._dtlsRole === undefined) { + pc._dtlsRole = description.type === 'offer' ? 'active' : 'passive'; + } + + pc._remoteDescription = { + type: description.type, + sdp: description.sdp + }; + if (description.type === 'offer') { + pc._updateSignalingState('have-remote-offer'); + } else { + pc._updateSignalingState('stable'); + } + Object.keys(streams).forEach(function(sid) { + var stream = streams[sid]; + if (stream.getTracks().length) { + if (pc.remoteStreams.indexOf(stream) === -1) { + pc.remoteStreams.push(stream); + var event = new Event('addstream'); + event.stream = stream; + window.setTimeout(function() { + pc._dispatchEvent('addstream', event); + }); + } + + receiverList.forEach(function(item) { + var track = item[0]; + var receiver = item[1]; + if (stream.id !== item[2].id) { + return; + } + fireAddTrack(pc, track, receiver, [stream]); + }); + } + }); + receiverList.forEach(function(item) { + if (item[2]) { + return; + } + fireAddTrack(pc, item[0], item[1], []); + }); + + // check whether addIceCandidate({}) was called within four seconds after + // setRemoteDescription. + window.setTimeout(function() { + if (!(pc && pc.transceivers)) { + return; + } + pc.transceivers.forEach(function(transceiver) { + if (transceiver.iceTransport && + transceiver.iceTransport.state === 'new' && + transceiver.iceTransport.getRemoteCandidates().length > 0) { + console.warn('Timeout for addRemoteCandidate. Consider sending ' + + 'an end-of-candidates notification'); + transceiver.iceTransport.addRemoteCandidate({}); + } + }); + }, 4000); + + return Promise.resolve(); + }; + + RTCPeerConnection.prototype.close = function() { + this.transceivers.forEach(function(transceiver) { + /* not yet + if (transceiver.iceGatherer) { + transceiver.iceGatherer.close(); + } + */ + if (transceiver.iceTransport) { + transceiver.iceTransport.stop(); + } + if (transceiver.dtlsTransport) { + transceiver.dtlsTransport.stop(); + } + if (transceiver.rtpSender) { + transceiver.rtpSender.stop(); + } + if (transceiver.rtpReceiver) { + transceiver.rtpReceiver.stop(); + } + }); + // FIXME: clean up tracks, local streams, remote streams, etc + this._isClosed = true; + this._updateSignalingState('closed'); + }; + + // Update the signaling state. + RTCPeerConnection.prototype._updateSignalingState = function(newState) { + this.signalingState = newState; + var event = new Event('signalingstatechange'); + this._dispatchEvent('signalingstatechange', event); + }; + + // Determine whether to fire the negotiationneeded event. + RTCPeerConnection.prototype._maybeFireNegotiationNeeded = function() { + var pc = this; + if (this.signalingState !== 'stable' || this.needNegotiation === true) { + return; + } + this.needNegotiation = true; + window.setTimeout(function() { + if (pc.needNegotiation) { + pc.needNegotiation = false; + var event = new Event('negotiationneeded'); + pc._dispatchEvent('negotiationneeded', event); + } + }, 0); + }; + + // Update the ice connection state. + RTCPeerConnection.prototype._updateIceConnectionState = function() { + var newState; + var states = { + 'new': 0, + closed: 0, + checking: 0, + connected: 0, + completed: 0, + disconnected: 0, + failed: 0 + }; + this.transceivers.forEach(function(transceiver) { + if (transceiver.iceTransport && !transceiver.rejected) { + states[transceiver.iceTransport.state]++; + } + }); + + newState = 'new'; + if (states.failed > 0) { + newState = 'failed'; + } else if (states.checking > 0) { + newState = 'checking'; + } else if (states.disconnected > 0) { + newState = 'disconnected'; + } else if (states.new > 0) { + newState = 'new'; + } else if (states.connected > 0) { + newState = 'connected'; + } else if (states.completed > 0) { + newState = 'completed'; + } + + if (newState !== this.iceConnectionState) { + this.iceConnectionState = newState; + var event = new Event('iceconnectionstatechange'); + this._dispatchEvent('iceconnectionstatechange', event); + } + }; + + // Update the connection state. + RTCPeerConnection.prototype._updateConnectionState = function() { + var newState; + var states = { + 'new': 0, + closed: 0, + connecting: 0, + connected: 0, + completed: 0, + disconnected: 0, + failed: 0 + }; + this.transceivers.forEach(function(transceiver) { + if (transceiver.iceTransport && transceiver.dtlsTransport && + !transceiver.rejected) { + states[transceiver.iceTransport.state]++; + states[transceiver.dtlsTransport.state]++; + } + }); + // ICETransport.completed and connected are the same for this purpose. + states.connected += states.completed; + + newState = 'new'; + if (states.failed > 0) { + newState = 'failed'; + } else if (states.connecting > 0) { + newState = 'connecting'; + } else if (states.disconnected > 0) { + newState = 'disconnected'; + } else if (states.new > 0) { + newState = 'new'; + } else if (states.connected > 0) { + newState = 'connected'; + } + + if (newState !== this.connectionState) { + this.connectionState = newState; + var event = new Event('connectionstatechange'); + this._dispatchEvent('connectionstatechange', event); + } + }; + + RTCPeerConnection.prototype.createOffer = function() { + var pc = this; + + if (pc._isClosed) { + return Promise.reject(makeError('InvalidStateError', + 'Can not call createOffer after close')); + } + + var numAudioTracks = pc.transceivers.filter(function(t) { + return t.kind === 'audio'; + }).length; + var numVideoTracks = pc.transceivers.filter(function(t) { + return t.kind === 'video'; + }).length; + + // Determine number of audio and video tracks we need to send/recv. + var offerOptions = arguments[0]; + if (offerOptions) { + // Reject Chrome legacy constraints. + if (offerOptions.mandatory || offerOptions.optional) { + throw new TypeError( + 'Legacy mandatory/optional constraints not supported.'); + } + if (offerOptions.offerToReceiveAudio !== undefined) { + if (offerOptions.offerToReceiveAudio === true) { + numAudioTracks = 1; + } else if (offerOptions.offerToReceiveAudio === false) { + numAudioTracks = 0; + } else { + numAudioTracks = offerOptions.offerToReceiveAudio; + } + } + if (offerOptions.offerToReceiveVideo !== undefined) { + if (offerOptions.offerToReceiveVideo === true) { + numVideoTracks = 1; + } else if (offerOptions.offerToReceiveVideo === false) { + numVideoTracks = 0; + } else { + numVideoTracks = offerOptions.offerToReceiveVideo; + } + } + } + + pc.transceivers.forEach(function(transceiver) { + if (transceiver.kind === 'audio') { + numAudioTracks--; + if (numAudioTracks < 0) { + transceiver.wantReceive = false; + } + } else if (transceiver.kind === 'video') { + numVideoTracks--; + if (numVideoTracks < 0) { + transceiver.wantReceive = false; + } + } + }); + + // Create M-lines for recvonly streams. + while (numAudioTracks > 0 || numVideoTracks > 0) { + if (numAudioTracks > 0) { + pc._createTransceiver('audio'); + numAudioTracks--; + } + if (numVideoTracks > 0) { + pc._createTransceiver('video'); + numVideoTracks--; + } + } + + var sdp$1 = sdp.writeSessionBoilerplate(pc._sdpSessionId, + pc._sdpSessionVersion++); + pc.transceivers.forEach(function(transceiver, sdpMLineIndex) { + // For each track, create an ice gatherer, ice transport, + // dtls transport, potentially rtpsender and rtpreceiver. + var track = transceiver.track; + var kind = transceiver.kind; + var mid = transceiver.mid || sdp.generateIdentifier(); + transceiver.mid = mid; + + if (!transceiver.iceGatherer) { + transceiver.iceGatherer = pc._createIceGatherer(sdpMLineIndex, + pc.usingBundle); + } + + var localCapabilities = window.RTCRtpSender.getCapabilities(kind); + // filter RTX until additional stuff needed for RTX is implemented + // in adapter.js + if (edgeVersion < 15019) { + localCapabilities.codecs = localCapabilities.codecs.filter( + function(codec) { + return codec.name !== 'rtx'; + }); + } + localCapabilities.codecs.forEach(function(codec) { + // work around https://bugs.chromium.org/p/webrtc/issues/detail?id=6552 + // by adding level-asymmetry-allowed=1 + if (codec.name === 'H264' && + codec.parameters['level-asymmetry-allowed'] === undefined) { + codec.parameters['level-asymmetry-allowed'] = '1'; + } + + // for subsequent offers, we might have to re-use the payload + // type of the last offer. + if (transceiver.remoteCapabilities && + transceiver.remoteCapabilities.codecs) { + transceiver.remoteCapabilities.codecs.forEach(function(remoteCodec) { + if (codec.name.toLowerCase() === remoteCodec.name.toLowerCase() && + codec.clockRate === remoteCodec.clockRate) { + codec.preferredPayloadType = remoteCodec.payloadType; + } + }); + } + }); + localCapabilities.headerExtensions.forEach(function(hdrExt) { + var remoteExtensions = transceiver.remoteCapabilities && + transceiver.remoteCapabilities.headerExtensions || []; + remoteExtensions.forEach(function(rHdrExt) { + if (hdrExt.uri === rHdrExt.uri) { + hdrExt.id = rHdrExt.id; + } + }); + }); + + // generate an ssrc now, to be used later in rtpSender.send + var sendEncodingParameters = transceiver.sendEncodingParameters || [{ + ssrc: (2 * sdpMLineIndex + 1) * 1001 + }]; + if (track) { + // add RTX + if (edgeVersion >= 15019 && kind === 'video' && + !sendEncodingParameters[0].rtx) { + sendEncodingParameters[0].rtx = { + ssrc: sendEncodingParameters[0].ssrc + 1 + }; + } + } + + if (transceiver.wantReceive) { + transceiver.rtpReceiver = new window.RTCRtpReceiver( + transceiver.dtlsTransport, kind); + } + + transceiver.localCapabilities = localCapabilities; + transceiver.sendEncodingParameters = sendEncodingParameters; + }); + + // always offer BUNDLE and dispose on return if not supported. + if (pc._config.bundlePolicy !== 'max-compat') { + sdp$1 += 'a=group:BUNDLE ' + pc.transceivers.map(function(t) { + return t.mid; + }).join(' ') + '\r\n'; + } + sdp$1 += 'a=ice-options:trickle\r\n'; + + pc.transceivers.forEach(function(transceiver, sdpMLineIndex) { + sdp$1 += writeMediaSection(transceiver, transceiver.localCapabilities, + 'offer', transceiver.stream, pc._dtlsRole); + sdp$1 += 'a=rtcp-rsize\r\n'; + + if (transceiver.iceGatherer && pc.iceGatheringState !== 'new' && + (sdpMLineIndex === 0 || !pc.usingBundle)) { + transceiver.iceGatherer.getLocalCandidates().forEach(function(cand) { + cand.component = 1; + sdp$1 += 'a=' + sdp.writeCandidate(cand) + '\r\n'; + }); + + if (transceiver.iceGatherer.state === 'completed') { + sdp$1 += 'a=end-of-candidates\r\n'; + } + } + }); + + var desc = new window.RTCSessionDescription({ + type: 'offer', + sdp: sdp$1 + }); + return Promise.resolve(desc); + }; + + RTCPeerConnection.prototype.createAnswer = function() { + var pc = this; + + if (pc._isClosed) { + return Promise.reject(makeError('InvalidStateError', + 'Can not call createAnswer after close')); + } + + if (!(pc.signalingState === 'have-remote-offer' || + pc.signalingState === 'have-local-pranswer')) { + return Promise.reject(makeError('InvalidStateError', + 'Can not call createAnswer in signalingState ' + pc.signalingState)); + } + + var sdp$1 = sdp.writeSessionBoilerplate(pc._sdpSessionId, + pc._sdpSessionVersion++); + if (pc.usingBundle) { + sdp$1 += 'a=group:BUNDLE ' + pc.transceivers.map(function(t) { + return t.mid; + }).join(' ') + '\r\n'; + } + sdp$1 += 'a=ice-options:trickle\r\n'; + + var mediaSectionsInOffer = sdp.getMediaSections( + pc._remoteDescription.sdp).length; + pc.transceivers.forEach(function(transceiver, sdpMLineIndex) { + if (sdpMLineIndex + 1 > mediaSectionsInOffer) { + return; + } + if (transceiver.rejected) { + if (transceiver.kind === 'application') { + if (transceiver.protocol === 'DTLS/SCTP') { // legacy fmt + sdp$1 += 'm=application 0 DTLS/SCTP 5000\r\n'; + } else { + sdp$1 += 'm=application 0 ' + transceiver.protocol + + ' webrtc-datachannel\r\n'; + } + } else if (transceiver.kind === 'audio') { + sdp$1 += 'm=audio 0 UDP/TLS/RTP/SAVPF 0\r\n' + + 'a=rtpmap:0 PCMU/8000\r\n'; + } else if (transceiver.kind === 'video') { + sdp$1 += 'm=video 0 UDP/TLS/RTP/SAVPF 120\r\n' + + 'a=rtpmap:120 VP8/90000\r\n'; + } + sdp$1 += 'c=IN IP4 0.0.0.0\r\n' + + 'a=inactive\r\n' + + 'a=mid:' + transceiver.mid + '\r\n'; + return; + } + + // FIXME: look at direction. + if (transceiver.stream) { + var localTrack; + if (transceiver.kind === 'audio') { + localTrack = transceiver.stream.getAudioTracks()[0]; + } else if (transceiver.kind === 'video') { + localTrack = transceiver.stream.getVideoTracks()[0]; + } + if (localTrack) { + // add RTX + if (edgeVersion >= 15019 && transceiver.kind === 'video' && + !transceiver.sendEncodingParameters[0].rtx) { + transceiver.sendEncodingParameters[0].rtx = { + ssrc: transceiver.sendEncodingParameters[0].ssrc + 1 + }; + } + } + } + + // Calculate intersection of capabilities. + var commonCapabilities = getCommonCapabilities( + transceiver.localCapabilities, + transceiver.remoteCapabilities); + + var hasRtx = commonCapabilities.codecs.filter(function(c) { + return c.name.toLowerCase() === 'rtx'; + }).length; + if (!hasRtx && transceiver.sendEncodingParameters[0].rtx) { + delete transceiver.sendEncodingParameters[0].rtx; + } + + sdp$1 += writeMediaSection(transceiver, commonCapabilities, + 'answer', transceiver.stream, pc._dtlsRole); + if (transceiver.rtcpParameters && + transceiver.rtcpParameters.reducedSize) { + sdp$1 += 'a=rtcp-rsize\r\n'; + } + }); + + var desc = new window.RTCSessionDescription({ + type: 'answer', + sdp: sdp$1 + }); + return Promise.resolve(desc); + }; + + RTCPeerConnection.prototype.addIceCandidate = function(candidate) { + var pc = this; + var sections; + if (candidate && !(candidate.sdpMLineIndex !== undefined || + candidate.sdpMid)) { + return Promise.reject(new TypeError('sdpMLineIndex or sdpMid required')); + } + + // TODO: needs to go into ops queue. + return new Promise(function(resolve, reject) { + if (!pc._remoteDescription) { + return reject(makeError('InvalidStateError', + 'Can not add ICE candidate without a remote description')); + } else if (!candidate || candidate.candidate === '') { + for (var j = 0; j < pc.transceivers.length; j++) { + if (pc.transceivers[j].rejected) { + continue; + } + pc.transceivers[j].iceTransport.addRemoteCandidate({}); + sections = sdp.getMediaSections(pc._remoteDescription.sdp); + sections[j] += 'a=end-of-candidates\r\n'; + pc._remoteDescription.sdp = + sdp.getDescription(pc._remoteDescription.sdp) + + sections.join(''); + if (pc.usingBundle) { + break; + } + } + } else { + var sdpMLineIndex = candidate.sdpMLineIndex; + if (candidate.sdpMid) { + for (var i = 0; i < pc.transceivers.length; i++) { + if (pc.transceivers[i].mid === candidate.sdpMid) { + sdpMLineIndex = i; + break; + } + } + } + var transceiver = pc.transceivers[sdpMLineIndex]; + if (transceiver) { + if (transceiver.rejected) { + return resolve(); + } + var cand = Object.keys(candidate.candidate).length > 0 ? + sdp.parseCandidate(candidate.candidate) : {}; + // Ignore Chrome's invalid candidates since Edge does not like them. + if (cand.protocol === 'tcp' && (cand.port === 0 || cand.port === 9)) { + return resolve(); + } + // Ignore RTCP candidates, we assume RTCP-MUX. + if (cand.component && cand.component !== 1) { + return resolve(); + } + // when using bundle, avoid adding candidates to the wrong + // ice transport. And avoid adding candidates added in the SDP. + if (sdpMLineIndex === 0 || (sdpMLineIndex > 0 && + transceiver.iceTransport !== pc.transceivers[0].iceTransport)) { + if (!maybeAddCandidate(transceiver.iceTransport, cand)) { + return reject(makeError('OperationError', + 'Can not add ICE candidate')); + } + } + + // update the remoteDescription. + var candidateString = candidate.candidate.trim(); + if (candidateString.indexOf('a=') === 0) { + candidateString = candidateString.substr(2); + } + sections = sdp.getMediaSections(pc._remoteDescription.sdp); + sections[sdpMLineIndex] += 'a=' + + (cand.type ? candidateString : 'end-of-candidates') + + '\r\n'; + pc._remoteDescription.sdp = + sdp.getDescription(pc._remoteDescription.sdp) + + sections.join(''); + } else { + return reject(makeError('OperationError', + 'Can not add ICE candidate')); + } + } + resolve(); + }); + }; + + RTCPeerConnection.prototype.getStats = function(selector) { + if (selector && selector instanceof window.MediaStreamTrack) { + var senderOrReceiver = null; + this.transceivers.forEach(function(transceiver) { + if (transceiver.rtpSender && + transceiver.rtpSender.track === selector) { + senderOrReceiver = transceiver.rtpSender; + } else if (transceiver.rtpReceiver && + transceiver.rtpReceiver.track === selector) { + senderOrReceiver = transceiver.rtpReceiver; + } + }); + if (!senderOrReceiver) { + throw makeError('InvalidAccessError', 'Invalid selector.'); + } + return senderOrReceiver.getStats(); + } + + var promises = []; + this.transceivers.forEach(function(transceiver) { + ['rtpSender', 'rtpReceiver', 'iceGatherer', 'iceTransport', + 'dtlsTransport'].forEach(function(method) { + if (transceiver[method]) { + promises.push(transceiver[method].getStats()); + } + }); + }); + return Promise.all(promises).then(function(allStats) { + var results = new Map(); + allStats.forEach(function(stats) { + stats.forEach(function(stat) { + results.set(stat.id, stat); + }); + }); + return results; + }); + }; + + // fix low-level stat names and return Map instead of object. + var ortcObjects = ['RTCRtpSender', 'RTCRtpReceiver', 'RTCIceGatherer', + 'RTCIceTransport', 'RTCDtlsTransport']; + ortcObjects.forEach(function(ortcObjectName) { + var obj = window[ortcObjectName]; + if (obj && obj.prototype && obj.prototype.getStats) { + var nativeGetstats = obj.prototype.getStats; + obj.prototype.getStats = function() { + return nativeGetstats.apply(this) + .then(function(nativeStats) { + var mapStats = new Map(); + Object.keys(nativeStats).forEach(function(id) { + nativeStats[id].type = fixStatsType(nativeStats[id]); + mapStats.set(id, nativeStats[id]); + }); + return mapStats; + }); + }; + } + }); + + // legacy callback shims. Should be moved to adapter.js some days. + var methods = ['createOffer', 'createAnswer']; + methods.forEach(function(method) { + var nativeMethod = RTCPeerConnection.prototype[method]; + RTCPeerConnection.prototype[method] = function() { + var args = arguments; + if (typeof args[0] === 'function' || + typeof args[1] === 'function') { // legacy + return nativeMethod.apply(this, [arguments[2]]) + .then(function(description) { + if (typeof args[0] === 'function') { + args[0].apply(null, [description]); + } + }, function(error) { + if (typeof args[1] === 'function') { + args[1].apply(null, [error]); + } + }); + } + return nativeMethod.apply(this, arguments); + }; + }); + + methods = ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate']; + methods.forEach(function(method) { + var nativeMethod = RTCPeerConnection.prototype[method]; + RTCPeerConnection.prototype[method] = function() { + var args = arguments; + if (typeof args[1] === 'function' || + typeof args[2] === 'function') { // legacy + return nativeMethod.apply(this, arguments) + .then(function() { + if (typeof args[1] === 'function') { + args[1].apply(null); + } + }, function(error) { + if (typeof args[2] === 'function') { + args[2].apply(null, [error]); + } + }); + } + return nativeMethod.apply(this, arguments); + }; + }); + + // getStats is special. It doesn't have a spec legacy method yet we support + // getStats(something, cb) without error callbacks. + ['getStats'].forEach(function(method) { + var nativeMethod = RTCPeerConnection.prototype[method]; + RTCPeerConnection.prototype[method] = function() { + var args = arguments; + if (typeof args[1] === 'function') { + return nativeMethod.apply(this, arguments) + .then(function() { + if (typeof args[1] === 'function') { + args[1].apply(null); + } + }); + } + return nativeMethod.apply(this, arguments); + }; + }); + + return RTCPeerConnection; + }; + + /* + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + + function shimGetUserMedia$2(window) { + const navigator = window && window.navigator; + + const shimError_ = function(e) { + return { + name: {PermissionDeniedError: 'NotAllowedError'}[e.name] || e.name, + message: e.message, + constraint: e.constraint, + toString() { + return this.name; + } + }; + }; + + // getUserMedia error shim. + const origGetUserMedia = navigator.mediaDevices.getUserMedia. + bind(navigator.mediaDevices); + navigator.mediaDevices.getUserMedia = function(c) { + return origGetUserMedia(c).catch(e => Promise.reject(shimError_(e))); + }; + } + + /* + * Copyright (c) 2018 The adapter.js project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + + function shimGetDisplayMedia$1(window) { + if (!('getDisplayMedia' in window.navigator)) { + return; + } + if (!(window.navigator.mediaDevices)) { + return; + } + if (window.navigator.mediaDevices && + 'getDisplayMedia' in window.navigator.mediaDevices) { + return; + } + window.navigator.mediaDevices.getDisplayMedia = + window.navigator.getDisplayMedia.bind(window.navigator); + } + + /* + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + + function shimPeerConnection$1(window, browserDetails) { + if (window.RTCIceGatherer) { + if (!window.RTCIceCandidate) { + window.RTCIceCandidate = function RTCIceCandidate(args) { + return args; + }; + } + if (!window.RTCSessionDescription) { + window.RTCSessionDescription = function RTCSessionDescription(args) { + return args; + }; + } + // this adds an additional event listener to MediaStrackTrack that signals + // when a tracks enabled property was changed. Workaround for a bug in + // addStream, see below. No longer required in 15025+ + if (browserDetails.version < 15025) { + const origMSTEnabled = Object.getOwnPropertyDescriptor( + window.MediaStreamTrack.prototype, 'enabled'); + Object.defineProperty(window.MediaStreamTrack.prototype, 'enabled', { + set(value) { + origMSTEnabled.set.call(this, value); + const ev = new Event('enabled'); + ev.enabled = value; + this.dispatchEvent(ev); + } + }); + } + } + + // ORTC defines the DTMF sender a bit different. + // https://github.com/w3c/ortc/issues/714 + if (window.RTCRtpSender && !('dtmf' in window.RTCRtpSender.prototype)) { + Object.defineProperty(window.RTCRtpSender.prototype, 'dtmf', { + get() { + if (this._dtmf === undefined) { + if (this.track.kind === 'audio') { + this._dtmf = new window.RTCDtmfSender(this); + } else if (this.track.kind === 'video') { + this._dtmf = null; + } + } + return this._dtmf; + } + }); + } + // Edge currently only implements the RTCDtmfSender, not the + // RTCDTMFSender alias. See http://draft.ortc.org/#rtcdtmfsender2* + if (window.RTCDtmfSender && !window.RTCDTMFSender) { + window.RTCDTMFSender = window.RTCDtmfSender; + } + + const RTCPeerConnectionShim = rtcpeerconnection(window, + browserDetails.version); + window.RTCPeerConnection = function RTCPeerConnection(config) { + if (config && config.iceServers) { + config.iceServers = filterIceServers$1(config.iceServers, + browserDetails.version); + log$1('ICE servers after filtering:', config.iceServers); + } + return new RTCPeerConnectionShim(config); + }; + window.RTCPeerConnection.prototype = RTCPeerConnectionShim.prototype; + } + + function shimReplaceTrack(window) { + // ORTC has replaceTrack -- https://github.com/w3c/ortc/issues/614 + if (window.RTCRtpSender && + !('replaceTrack' in window.RTCRtpSender.prototype)) { + window.RTCRtpSender.prototype.replaceTrack = + window.RTCRtpSender.prototype.setTrack; + } + } + + var edgeShim = /*#__PURE__*/Object.freeze({ + __proto__: null, + shimPeerConnection: shimPeerConnection$1, + shimReplaceTrack: shimReplaceTrack, + shimGetUserMedia: shimGetUserMedia$2, + shimGetDisplayMedia: shimGetDisplayMedia$1 + }); + + /* + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + + function shimGetUserMedia$1(window, browserDetails) { + const navigator = window && window.navigator; + const MediaStreamTrack = window && window.MediaStreamTrack; + + navigator.getUserMedia = function(constraints, onSuccess, onError) { + // Replace Firefox 44+'s deprecation warning with unprefixed version. + deprecated('navigator.getUserMedia', + 'navigator.mediaDevices.getUserMedia'); + navigator.mediaDevices.getUserMedia(constraints).then(onSuccess, onError); + }; + + if (!(browserDetails.version > 55 && + 'autoGainControl' in navigator.mediaDevices.getSupportedConstraints())) { + const remap = function(obj, a, b) { + if (a in obj && !(b in obj)) { + obj[b] = obj[a]; + delete obj[a]; + } + }; + + const nativeGetUserMedia = navigator.mediaDevices.getUserMedia. + bind(navigator.mediaDevices); + navigator.mediaDevices.getUserMedia = function(c) { + if (typeof c === 'object' && typeof c.audio === 'object') { + c = JSON.parse(JSON.stringify(c)); + remap(c.audio, 'autoGainControl', 'mozAutoGainControl'); + remap(c.audio, 'noiseSuppression', 'mozNoiseSuppression'); + } + return nativeGetUserMedia(c); + }; + + if (MediaStreamTrack && MediaStreamTrack.prototype.getSettings) { + const nativeGetSettings = MediaStreamTrack.prototype.getSettings; + MediaStreamTrack.prototype.getSettings = function() { + const obj = nativeGetSettings.apply(this, arguments); + remap(obj, 'mozAutoGainControl', 'autoGainControl'); + remap(obj, 'mozNoiseSuppression', 'noiseSuppression'); + return obj; + }; + } + + if (MediaStreamTrack && MediaStreamTrack.prototype.applyConstraints) { + const nativeApplyConstraints = + MediaStreamTrack.prototype.applyConstraints; + MediaStreamTrack.prototype.applyConstraints = function(c) { + if (this.kind === 'audio' && typeof c === 'object') { + c = JSON.parse(JSON.stringify(c)); + remap(c, 'autoGainControl', 'mozAutoGainControl'); + remap(c, 'noiseSuppression', 'mozNoiseSuppression'); + } + return nativeApplyConstraints.apply(this, [c]); + }; + } + } + } + + /* + * Copyright (c) 2018 The adapter.js project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + + function shimGetDisplayMedia(window, preferredMediaSource) { + if (window.navigator.mediaDevices && + 'getDisplayMedia' in window.navigator.mediaDevices) { + return; + } + if (!(window.navigator.mediaDevices)) { + return; + } + window.navigator.mediaDevices.getDisplayMedia = + function getDisplayMedia(constraints) { + if (!(constraints && constraints.video)) { + const err = new DOMException('getDisplayMedia without video ' + + 'constraints is undefined'); + err.name = 'NotFoundError'; + // from https://heycam.github.io/webidl/#idl-DOMException-error-names + err.code = 8; + return Promise.reject(err); + } + if (constraints.video === true) { + constraints.video = {mediaSource: preferredMediaSource}; + } else { + constraints.video.mediaSource = preferredMediaSource; + } + return window.navigator.mediaDevices.getUserMedia(constraints); + }; + } + + /* + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + + function shimOnTrack(window) { + if (typeof window === 'object' && window.RTCTrackEvent && + ('receiver' in window.RTCTrackEvent.prototype) && + !('transceiver' in window.RTCTrackEvent.prototype)) { + Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', { + get() { + return {receiver: this.receiver}; + } + }); + } + } + + function shimPeerConnection(window, browserDetails) { + if (typeof window !== 'object' || + !(window.RTCPeerConnection || window.mozRTCPeerConnection)) { + return; // probably media.peerconnection.enabled=false in about:config + } + if (!window.RTCPeerConnection && window.mozRTCPeerConnection) { + // very basic support for old versions. + window.RTCPeerConnection = window.mozRTCPeerConnection; + } + + if (browserDetails.version < 53) { + // shim away need for obsolete RTCIceCandidate/RTCSessionDescription. + ['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'] + .forEach(function(method) { + const nativeMethod = window.RTCPeerConnection.prototype[method]; + const methodObj = {[method]() { + arguments[0] = new ((method === 'addIceCandidate') ? + window.RTCIceCandidate : + window.RTCSessionDescription)(arguments[0]); + return nativeMethod.apply(this, arguments); + }}; + window.RTCPeerConnection.prototype[method] = methodObj[method]; + }); + } + + const modernStatsTypes = { + inboundrtp: 'inbound-rtp', + outboundrtp: 'outbound-rtp', + candidatepair: 'candidate-pair', + localcandidate: 'local-candidate', + remotecandidate: 'remote-candidate' + }; + + const nativeGetStats = window.RTCPeerConnection.prototype.getStats; + window.RTCPeerConnection.prototype.getStats = function getStats() { + const [selector, onSucc, onErr] = arguments; + return nativeGetStats.apply(this, [selector || null]) + .then(stats => { + if (browserDetails.version < 53 && !onSucc) { + // Shim only promise getStats with spec-hyphens in type names + // Leave callback version alone; misc old uses of forEach before Map + try { + stats.forEach(stat => { + stat.type = modernStatsTypes[stat.type] || stat.type; + }); + } catch (e) { + if (e.name !== 'TypeError') { + throw e; + } + // Avoid TypeError: "type" is read-only, in old versions. 34-43ish + stats.forEach((stat, i) => { + stats.set(i, Object.assign({}, stat, { + type: modernStatsTypes[stat.type] || stat.type + })); + }); + } + } + return stats; + }) + .then(onSucc, onErr); + }; + } + + function shimSenderGetStats(window) { + if (!(typeof window === 'object' && window.RTCPeerConnection && + window.RTCRtpSender)) { + return; + } + if (window.RTCRtpSender && 'getStats' in window.RTCRtpSender.prototype) { + return; + } + const origGetSenders = window.RTCPeerConnection.prototype.getSenders; + if (origGetSenders) { + window.RTCPeerConnection.prototype.getSenders = function getSenders() { + const senders = origGetSenders.apply(this, []); + senders.forEach(sender => sender._pc = this); + return senders; + }; + } + + const origAddTrack = window.RTCPeerConnection.prototype.addTrack; + if (origAddTrack) { + window.RTCPeerConnection.prototype.addTrack = function addTrack() { + const sender = origAddTrack.apply(this, arguments); + sender._pc = this; + return sender; + }; + } + window.RTCRtpSender.prototype.getStats = function getStats() { + return this.track ? this._pc.getStats(this.track) : + Promise.resolve(new Map()); + }; + } + + function shimReceiverGetStats(window) { + if (!(typeof window === 'object' && window.RTCPeerConnection && + window.RTCRtpSender)) { + return; + } + if (window.RTCRtpSender && 'getStats' in window.RTCRtpReceiver.prototype) { + return; + } + const origGetReceivers = window.RTCPeerConnection.prototype.getReceivers; + if (origGetReceivers) { + window.RTCPeerConnection.prototype.getReceivers = function getReceivers() { + const receivers = origGetReceivers.apply(this, []); + receivers.forEach(receiver => receiver._pc = this); + return receivers; + }; + } + wrapPeerConnectionEvent(window, 'track', e => { + e.receiver._pc = e.srcElement; + return e; + }); + window.RTCRtpReceiver.prototype.getStats = function getStats() { + return this._pc.getStats(this.track); + }; + } + + function shimRemoveStream(window) { + if (!window.RTCPeerConnection || + 'removeStream' in window.RTCPeerConnection.prototype) { + return; + } + window.RTCPeerConnection.prototype.removeStream = + function removeStream(stream) { + deprecated('removeStream', 'removeTrack'); + this.getSenders().forEach(sender => { + if (sender.track && stream.getTracks().includes(sender.track)) { + this.removeTrack(sender); + } + }); + }; + } + + function shimRTCDataChannel(window) { + // rename DataChannel to RTCDataChannel (native fix in FF60): + // https://bugzilla.mozilla.org/show_bug.cgi?id=1173851 + if (window.DataChannel && !window.RTCDataChannel) { + window.RTCDataChannel = window.DataChannel; + } + } + + function shimAddTransceiver(window) { + // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647 + // Firefox ignores the init sendEncodings options passed to addTransceiver + // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918 + if (!(typeof window === 'object' && window.RTCPeerConnection)) { + return; + } + const origAddTransceiver = window.RTCPeerConnection.prototype.addTransceiver; + if (origAddTransceiver) { + window.RTCPeerConnection.prototype.addTransceiver = + function addTransceiver() { + this.setParametersPromises = []; + const initParameters = arguments[1]; + const shouldPerformCheck = initParameters && + 'sendEncodings' in initParameters; + if (shouldPerformCheck) { + // If sendEncodings params are provided, validate grammar + initParameters.sendEncodings.forEach((encodingParam) => { + if ('rid' in encodingParam) { + const ridRegex = /^[a-z0-9]{0,16}$/i; + if (!ridRegex.test(encodingParam.rid)) { + throw new TypeError('Invalid RID value provided.'); + } + } + if ('scaleResolutionDownBy' in encodingParam) { + if (!(parseFloat(encodingParam.scaleResolutionDownBy) >= 1.0)) { + throw new RangeError('scale_resolution_down_by must be >= 1.0'); + } + } + if ('maxFramerate' in encodingParam) { + if (!(parseFloat(encodingParam.maxFramerate) >= 0)) { + throw new RangeError('max_framerate must be >= 0.0'); + } + } + }); + } + const transceiver = origAddTransceiver.apply(this, arguments); + if (shouldPerformCheck) { + // Check if the init options were applied. If not we do this in an + // asynchronous way and save the promise reference in a global object. + // This is an ugly hack, but at the same time is way more robust than + // checking the sender parameters before and after the createOffer + // Also note that after the createoffer we are not 100% sure that + // the params were asynchronously applied so we might miss the + // opportunity to recreate offer. + const {sender} = transceiver; + const params = sender.getParameters(); + if (!('encodings' in params) || + // Avoid being fooled by patched getParameters() below. + (params.encodings.length === 1 && + Object.keys(params.encodings[0]).length === 0)) { + params.encodings = initParameters.sendEncodings; + sender.sendEncodings = initParameters.sendEncodings; + this.setParametersPromises.push(sender.setParameters(params) + .then(() => { + delete sender.sendEncodings; + }).catch(() => { + delete sender.sendEncodings; + }) + ); + } + } + return transceiver; + }; + } + } + + function shimGetParameters(window) { + if (!(typeof window === 'object' && window.RTCRtpSender)) { + return; + } + const origGetParameters = window.RTCRtpSender.prototype.getParameters; + if (origGetParameters) { + window.RTCRtpSender.prototype.getParameters = + function getParameters() { + const params = origGetParameters.apply(this, arguments); + if (!('encodings' in params)) { + params.encodings = [].concat(this.sendEncodings || [{}]); + } + return params; + }; + } + } + + function shimCreateOffer(window) { + // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647 + // Firefox ignores the init sendEncodings options passed to addTransceiver + // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918 + if (!(typeof window === 'object' && window.RTCPeerConnection)) { + return; + } + const origCreateOffer = window.RTCPeerConnection.prototype.createOffer; + window.RTCPeerConnection.prototype.createOffer = function createOffer() { + if (this.setParametersPromises && this.setParametersPromises.length) { + return Promise.all(this.setParametersPromises) + .then(() => { + return origCreateOffer.apply(this, arguments); + }) + .finally(() => { + this.setParametersPromises = []; + }); + } + return origCreateOffer.apply(this, arguments); + }; + } + + function shimCreateAnswer(window) { + // https://github.com/webrtcHacks/adapter/issues/998#issuecomment-516921647 + // Firefox ignores the init sendEncodings options passed to addTransceiver + // https://bugzilla.mozilla.org/show_bug.cgi?id=1396918 + if (!(typeof window === 'object' && window.RTCPeerConnection)) { + return; + } + const origCreateAnswer = window.RTCPeerConnection.prototype.createAnswer; + window.RTCPeerConnection.prototype.createAnswer = function createAnswer() { + if (this.setParametersPromises && this.setParametersPromises.length) { + return Promise.all(this.setParametersPromises) + .then(() => { + return origCreateAnswer.apply(this, arguments); + }) + .finally(() => { + this.setParametersPromises = []; + }); + } + return origCreateAnswer.apply(this, arguments); + }; + } + + var firefoxShim = /*#__PURE__*/Object.freeze({ + __proto__: null, + shimOnTrack: shimOnTrack, + shimPeerConnection: shimPeerConnection, + shimSenderGetStats: shimSenderGetStats, + shimReceiverGetStats: shimReceiverGetStats, + shimRemoveStream: shimRemoveStream, + shimRTCDataChannel: shimRTCDataChannel, + shimAddTransceiver: shimAddTransceiver, + shimGetParameters: shimGetParameters, + shimCreateOffer: shimCreateOffer, + shimCreateAnswer: shimCreateAnswer, + shimGetUserMedia: shimGetUserMedia$1, + shimGetDisplayMedia: shimGetDisplayMedia + }); + + /* + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + + function shimLocalStreamsAPI(window) { + if (typeof window !== 'object' || !window.RTCPeerConnection) { + return; + } + if (!('getLocalStreams' in window.RTCPeerConnection.prototype)) { + window.RTCPeerConnection.prototype.getLocalStreams = + function getLocalStreams() { + if (!this._localStreams) { + this._localStreams = []; + } + return this._localStreams; + }; + } + if (!('addStream' in window.RTCPeerConnection.prototype)) { + const _addTrack = window.RTCPeerConnection.prototype.addTrack; + window.RTCPeerConnection.prototype.addStream = function addStream(stream) { + if (!this._localStreams) { + this._localStreams = []; + } + if (!this._localStreams.includes(stream)) { + this._localStreams.push(stream); + } + // Try to emulate Chrome's behaviour of adding in audio-video order. + // Safari orders by track id. + stream.getAudioTracks().forEach(track => _addTrack.call(this, track, + stream)); + stream.getVideoTracks().forEach(track => _addTrack.call(this, track, + stream)); + }; + + window.RTCPeerConnection.prototype.addTrack = + function addTrack(track, ...streams) { + if (streams) { + streams.forEach((stream) => { + if (!this._localStreams) { + this._localStreams = [stream]; + } else if (!this._localStreams.includes(stream)) { + this._localStreams.push(stream); + } + }); + } + return _addTrack.apply(this, arguments); + }; + } + if (!('removeStream' in window.RTCPeerConnection.prototype)) { + window.RTCPeerConnection.prototype.removeStream = + function removeStream(stream) { + if (!this._localStreams) { + this._localStreams = []; + } + const index = this._localStreams.indexOf(stream); + if (index === -1) { + return; + } + this._localStreams.splice(index, 1); + const tracks = stream.getTracks(); + this.getSenders().forEach(sender => { + if (tracks.includes(sender.track)) { + this.removeTrack(sender); + } + }); + }; + } + } + + function shimRemoteStreamsAPI(window) { + if (typeof window !== 'object' || !window.RTCPeerConnection) { + return; + } + if (!('getRemoteStreams' in window.RTCPeerConnection.prototype)) { + window.RTCPeerConnection.prototype.getRemoteStreams = + function getRemoteStreams() { + return this._remoteStreams ? this._remoteStreams : []; + }; + } + if (!('onaddstream' in window.RTCPeerConnection.prototype)) { + Object.defineProperty(window.RTCPeerConnection.prototype, 'onaddstream', { + get() { + return this._onaddstream; + }, + set(f) { + if (this._onaddstream) { + this.removeEventListener('addstream', this._onaddstream); + this.removeEventListener('track', this._onaddstreampoly); + } + this.addEventListener('addstream', this._onaddstream = f); + this.addEventListener('track', this._onaddstreampoly = (e) => { + e.streams.forEach(stream => { + if (!this._remoteStreams) { + this._remoteStreams = []; + } + if (this._remoteStreams.includes(stream)) { + return; + } + this._remoteStreams.push(stream); + const event = new Event('addstream'); + event.stream = stream; + this.dispatchEvent(event); + }); + }); + } + }); + const origSetRemoteDescription = + window.RTCPeerConnection.prototype.setRemoteDescription; + window.RTCPeerConnection.prototype.setRemoteDescription = + function setRemoteDescription() { + const pc = this; + if (!this._onaddstreampoly) { + this.addEventListener('track', this._onaddstreampoly = function(e) { + e.streams.forEach(stream => { + if (!pc._remoteStreams) { + pc._remoteStreams = []; + } + if (pc._remoteStreams.indexOf(stream) >= 0) { + return; + } + pc._remoteStreams.push(stream); + const event = new Event('addstream'); + event.stream = stream; + pc.dispatchEvent(event); + }); + }); + } + return origSetRemoteDescription.apply(pc, arguments); + }; + } + } + + function shimCallbacksAPI(window) { + if (typeof window !== 'object' || !window.RTCPeerConnection) { + return; + } + const prototype = window.RTCPeerConnection.prototype; + const origCreateOffer = prototype.createOffer; + const origCreateAnswer = prototype.createAnswer; + const setLocalDescription = prototype.setLocalDescription; + const setRemoteDescription = prototype.setRemoteDescription; + const addIceCandidate = prototype.addIceCandidate; + + prototype.createOffer = + function createOffer(successCallback, failureCallback) { + const options = (arguments.length >= 2) ? arguments[2] : arguments[0]; + const promise = origCreateOffer.apply(this, [options]); + if (!failureCallback) { + return promise; + } + promise.then(successCallback, failureCallback); + return Promise.resolve(); + }; + + prototype.createAnswer = + function createAnswer(successCallback, failureCallback) { + const options = (arguments.length >= 2) ? arguments[2] : arguments[0]; + const promise = origCreateAnswer.apply(this, [options]); + if (!failureCallback) { + return promise; + } + promise.then(successCallback, failureCallback); + return Promise.resolve(); + }; + + let withCallback = function(description, successCallback, failureCallback) { + const promise = setLocalDescription.apply(this, [description]); + if (!failureCallback) { + return promise; + } + promise.then(successCallback, failureCallback); + return Promise.resolve(); + }; + prototype.setLocalDescription = withCallback; + + withCallback = function(description, successCallback, failureCallback) { + const promise = setRemoteDescription.apply(this, [description]); + if (!failureCallback) { + return promise; + } + promise.then(successCallback, failureCallback); + return Promise.resolve(); + }; + prototype.setRemoteDescription = withCallback; + + withCallback = function(candidate, successCallback, failureCallback) { + const promise = addIceCandidate.apply(this, [candidate]); + if (!failureCallback) { + return promise; + } + promise.then(successCallback, failureCallback); + return Promise.resolve(); + }; + prototype.addIceCandidate = withCallback; + } + + function shimGetUserMedia(window) { + const navigator = window && window.navigator; + + if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { + // shim not needed in Safari 12.1 + const mediaDevices = navigator.mediaDevices; + const _getUserMedia = mediaDevices.getUserMedia.bind(mediaDevices); + navigator.mediaDevices.getUserMedia = (constraints) => { + return _getUserMedia(shimConstraints(constraints)); + }; + } + + if (!navigator.getUserMedia && navigator.mediaDevices && + navigator.mediaDevices.getUserMedia) { + navigator.getUserMedia = function getUserMedia(constraints, cb, errcb) { + navigator.mediaDevices.getUserMedia(constraints) + .then(cb, errcb); + }.bind(navigator); + } + } + + function shimConstraints(constraints) { + if (constraints && constraints.video !== undefined) { + return Object.assign({}, + constraints, + {video: compactObject(constraints.video)} + ); + } + + return constraints; + } + + function shimRTCIceServerUrls(window) { + if (!window.RTCPeerConnection) { + return; + } + // migrate from non-spec RTCIceServer.url to RTCIceServer.urls + const OrigPeerConnection = window.RTCPeerConnection; + window.RTCPeerConnection = + function RTCPeerConnection(pcConfig, pcConstraints) { + if (pcConfig && pcConfig.iceServers) { + const newIceServers = []; + for (let i = 0; i < pcConfig.iceServers.length; i++) { + let server = pcConfig.iceServers[i]; + if (!server.hasOwnProperty('urls') && + server.hasOwnProperty('url')) { + deprecated('RTCIceServer.url', 'RTCIceServer.urls'); + server = JSON.parse(JSON.stringify(server)); + server.urls = server.url; + delete server.url; + newIceServers.push(server); + } else { + newIceServers.push(pcConfig.iceServers[i]); + } + } + pcConfig.iceServers = newIceServers; + } + return new OrigPeerConnection(pcConfig, pcConstraints); + }; + window.RTCPeerConnection.prototype = OrigPeerConnection.prototype; + // wrap static methods. Currently just generateCertificate. + if ('generateCertificate' in OrigPeerConnection) { + Object.defineProperty(window.RTCPeerConnection, 'generateCertificate', { + get() { + return OrigPeerConnection.generateCertificate; + } + }); + } + } + + function shimTrackEventTransceiver(window) { + // Add event.transceiver member over deprecated event.receiver + if (typeof window === 'object' && window.RTCTrackEvent && + 'receiver' in window.RTCTrackEvent.prototype && + !('transceiver' in window.RTCTrackEvent.prototype)) { + Object.defineProperty(window.RTCTrackEvent.prototype, 'transceiver', { + get() { + return {receiver: this.receiver}; + } + }); + } + } + + function shimCreateOfferLegacy(window) { + const origCreateOffer = window.RTCPeerConnection.prototype.createOffer; + window.RTCPeerConnection.prototype.createOffer = + function createOffer(offerOptions) { + if (offerOptions) { + if (typeof offerOptions.offerToReceiveAudio !== 'undefined') { + // support bit values + offerOptions.offerToReceiveAudio = + !!offerOptions.offerToReceiveAudio; + } + const audioTransceiver = this.getTransceivers().find(transceiver => + transceiver.receiver.track.kind === 'audio'); + if (offerOptions.offerToReceiveAudio === false && audioTransceiver) { + if (audioTransceiver.direction === 'sendrecv') { + if (audioTransceiver.setDirection) { + audioTransceiver.setDirection('sendonly'); + } else { + audioTransceiver.direction = 'sendonly'; + } + } else if (audioTransceiver.direction === 'recvonly') { + if (audioTransceiver.setDirection) { + audioTransceiver.setDirection('inactive'); + } else { + audioTransceiver.direction = 'inactive'; + } + } + } else if (offerOptions.offerToReceiveAudio === true && + !audioTransceiver) { + this.addTransceiver('audio'); + } + + if (typeof offerOptions.offerToReceiveVideo !== 'undefined') { + // support bit values + offerOptions.offerToReceiveVideo = + !!offerOptions.offerToReceiveVideo; + } + const videoTransceiver = this.getTransceivers().find(transceiver => + transceiver.receiver.track.kind === 'video'); + if (offerOptions.offerToReceiveVideo === false && videoTransceiver) { + if (videoTransceiver.direction === 'sendrecv') { + if (videoTransceiver.setDirection) { + videoTransceiver.setDirection('sendonly'); + } else { + videoTransceiver.direction = 'sendonly'; + } + } else if (videoTransceiver.direction === 'recvonly') { + if (videoTransceiver.setDirection) { + videoTransceiver.setDirection('inactive'); + } else { + videoTransceiver.direction = 'inactive'; + } + } + } else if (offerOptions.offerToReceiveVideo === true && + !videoTransceiver) { + this.addTransceiver('video'); + } + } + return origCreateOffer.apply(this, arguments); + }; + } + + function shimAudioContext(window) { + if (typeof window !== 'object' || window.AudioContext) { + return; + } + window.AudioContext = window.webkitAudioContext; + } + + var safariShim = /*#__PURE__*/Object.freeze({ + __proto__: null, + shimLocalStreamsAPI: shimLocalStreamsAPI, + shimRemoteStreamsAPI: shimRemoteStreamsAPI, + shimCallbacksAPI: shimCallbacksAPI, + shimGetUserMedia: shimGetUserMedia, + shimConstraints: shimConstraints, + shimRTCIceServerUrls: shimRTCIceServerUrls, + shimTrackEventTransceiver: shimTrackEventTransceiver, + shimCreateOfferLegacy: shimCreateOfferLegacy, + shimAudioContext: shimAudioContext + }); + + /* + * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + + function shimRTCIceCandidate(window) { + // foundation is arbitrarily chosen as an indicator for full support for + // https://w3c.github.io/webrtc-pc/#rtcicecandidate-interface + if (!window.RTCIceCandidate || (window.RTCIceCandidate && 'foundation' in + window.RTCIceCandidate.prototype)) { + return; + } + + const NativeRTCIceCandidate = window.RTCIceCandidate; + window.RTCIceCandidate = function RTCIceCandidate(args) { + // Remove the a= which shouldn't be part of the candidate string. + if (typeof args === 'object' && args.candidate && + args.candidate.indexOf('a=') === 0) { + args = JSON.parse(JSON.stringify(args)); + args.candidate = args.candidate.substr(2); + } + + if (args.candidate && args.candidate.length) { + // Augment the native candidate with the parsed fields. + const nativeCandidate = new NativeRTCIceCandidate(args); + const parsedCandidate = sdp.parseCandidate(args.candidate); + const augmentedCandidate = Object.assign(nativeCandidate, + parsedCandidate); + + // Add a serializer that does not serialize the extra attributes. + augmentedCandidate.toJSON = function toJSON() { + return { + candidate: augmentedCandidate.candidate, + sdpMid: augmentedCandidate.sdpMid, + sdpMLineIndex: augmentedCandidate.sdpMLineIndex, + usernameFragment: augmentedCandidate.usernameFragment, + }; + }; + return augmentedCandidate; + } + return new NativeRTCIceCandidate(args); + }; + window.RTCIceCandidate.prototype = NativeRTCIceCandidate.prototype; + + // Hook up the augmented candidate in onicecandidate and + // addEventListener('icecandidate', ...) + wrapPeerConnectionEvent(window, 'icecandidate', e => { + if (e.candidate) { + Object.defineProperty(e, 'candidate', { + value: new window.RTCIceCandidate(e.candidate), + writable: 'false' + }); + } + return e; + }); + } + + function shimMaxMessageSize(window, browserDetails) { + if (!window.RTCPeerConnection) { + return; + } + + if (!('sctp' in window.RTCPeerConnection.prototype)) { + Object.defineProperty(window.RTCPeerConnection.prototype, 'sctp', { + get() { + return typeof this._sctp === 'undefined' ? null : this._sctp; + } + }); + } + + const sctpInDescription = function(description) { + if (!description || !description.sdp) { + return false; + } + const sections = sdp.splitSections(description.sdp); + sections.shift(); + return sections.some(mediaSection => { + const mLine = sdp.parseMLine(mediaSection); + return mLine && mLine.kind === 'application' + && mLine.protocol.indexOf('SCTP') !== -1; + }); + }; + + const getRemoteFirefoxVersion = function(description) { + // TODO: Is there a better solution for detecting Firefox? + const match = description.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/); + if (match === null || match.length < 2) { + return -1; + } + const version = parseInt(match[1], 10); + // Test for NaN (yes, this is ugly) + return version !== version ? -1 : version; + }; + + const getCanSendMaxMessageSize = function(remoteIsFirefox) { + // Every implementation we know can send at least 64 KiB. + // Note: Although Chrome is technically able to send up to 256 KiB, the + // data does not reach the other peer reliably. + // See: https://bugs.chromium.org/p/webrtc/issues/detail?id=8419 + let canSendMaxMessageSize = 65536; + if (browserDetails.browser === 'firefox') { + if (browserDetails.version < 57) { + if (remoteIsFirefox === -1) { + // FF < 57 will send in 16 KiB chunks using the deprecated PPID + // fragmentation. + canSendMaxMessageSize = 16384; + } else { + // However, other FF (and RAWRTC) can reassemble PPID-fragmented + // messages. Thus, supporting ~2 GiB when sending. + canSendMaxMessageSize = 2147483637; + } + } else if (browserDetails.version < 60) { + // Currently, all FF >= 57 will reset the remote maximum message size + // to the default value when a data channel is created at a later + // stage. :( + // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831 + canSendMaxMessageSize = + browserDetails.version === 57 ? 65535 : 65536; + } else { + // FF >= 60 supports sending ~2 GiB + canSendMaxMessageSize = 2147483637; + } + } + return canSendMaxMessageSize; + }; + + const getMaxMessageSize = function(description, remoteIsFirefox) { + // Note: 65536 bytes is the default value from the SDP spec. Also, + // every implementation we know supports receiving 65536 bytes. + let maxMessageSize = 65536; + + // FF 57 has a slightly incorrect default remote max message size, so + // we need to adjust it here to avoid a failure when sending. + // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1425697 + if (browserDetails.browser === 'firefox' + && browserDetails.version === 57) { + maxMessageSize = 65535; + } + + const match = sdp.matchPrefix(description.sdp, + 'a=max-message-size:'); + if (match.length > 0) { + maxMessageSize = parseInt(match[0].substr(19), 10); + } else if (browserDetails.browser === 'firefox' && + remoteIsFirefox !== -1) { + // If the maximum message size is not present in the remote SDP and + // both local and remote are Firefox, the remote peer can receive + // ~2 GiB. + maxMessageSize = 2147483637; + } + return maxMessageSize; + }; + + const origSetRemoteDescription = + window.RTCPeerConnection.prototype.setRemoteDescription; + window.RTCPeerConnection.prototype.setRemoteDescription = + function setRemoteDescription() { + this._sctp = null; + // Chrome decided to not expose .sctp in plan-b mode. + // As usual, adapter.js has to do an 'ugly worakaround' + // to cover up the mess. + if (browserDetails.browser === 'chrome' && browserDetails.version >= 76) { + const {sdpSemantics} = this.getConfiguration(); + if (sdpSemantics === 'plan-b') { + Object.defineProperty(this, 'sctp', { + get() { + return typeof this._sctp === 'undefined' ? null : this._sctp; + }, + enumerable: true, + configurable: true, + }); + } + } + + if (sctpInDescription(arguments[0])) { + // Check if the remote is FF. + const isFirefox = getRemoteFirefoxVersion(arguments[0]); + + // Get the maximum message size the local peer is capable of sending + const canSendMMS = getCanSendMaxMessageSize(isFirefox); + + // Get the maximum message size of the remote peer. + const remoteMMS = getMaxMessageSize(arguments[0], isFirefox); + + // Determine final maximum message size + let maxMessageSize; + if (canSendMMS === 0 && remoteMMS === 0) { + maxMessageSize = Number.POSITIVE_INFINITY; + } else if (canSendMMS === 0 || remoteMMS === 0) { + maxMessageSize = Math.max(canSendMMS, remoteMMS); + } else { + maxMessageSize = Math.min(canSendMMS, remoteMMS); + } + + // Create a dummy RTCSctpTransport object and the 'maxMessageSize' + // attribute. + const sctp = {}; + Object.defineProperty(sctp, 'maxMessageSize', { + get() { + return maxMessageSize; + } + }); + this._sctp = sctp; + } + + return origSetRemoteDescription.apply(this, arguments); + }; + } + + function shimSendThrowTypeError(window) { + if (!(window.RTCPeerConnection && + 'createDataChannel' in window.RTCPeerConnection.prototype)) { + return; + } + + // Note: Although Firefox >= 57 has a native implementation, the maximum + // message size can be reset for all data channels at a later stage. + // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1426831 + + function wrapDcSend(dc, pc) { + const origDataChannelSend = dc.send; + dc.send = function send() { + const data = arguments[0]; + const length = data.length || data.size || data.byteLength; + if (dc.readyState === 'open' && + pc.sctp && length > pc.sctp.maxMessageSize) { + throw new TypeError('Message too large (can send a maximum of ' + + pc.sctp.maxMessageSize + ' bytes)'); + } + return origDataChannelSend.apply(dc, arguments); + }; + } + const origCreateDataChannel = + window.RTCPeerConnection.prototype.createDataChannel; + window.RTCPeerConnection.prototype.createDataChannel = + function createDataChannel() { + const dataChannel = origCreateDataChannel.apply(this, arguments); + wrapDcSend(dataChannel, this); + return dataChannel; + }; + wrapPeerConnectionEvent(window, 'datachannel', e => { + wrapDcSend(e.channel, e.target); + return e; + }); + } + + + /* shims RTCConnectionState by pretending it is the same as iceConnectionState. + * See https://bugs.chromium.org/p/webrtc/issues/detail?id=6145#c12 + * for why this is a valid hack in Chrome. In Firefox it is slightly incorrect + * since DTLS failures would be hidden. See + * https://bugzilla.mozilla.org/show_bug.cgi?id=1265827 + * for the Firefox tracking bug. + */ + function shimConnectionState(window) { + if (!window.RTCPeerConnection || + 'connectionState' in window.RTCPeerConnection.prototype) { + return; + } + const proto = window.RTCPeerConnection.prototype; + Object.defineProperty(proto, 'connectionState', { + get() { + return { + completed: 'connected', + checking: 'connecting' + }[this.iceConnectionState] || this.iceConnectionState; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(proto, 'onconnectionstatechange', { + get() { + return this._onconnectionstatechange || null; + }, + set(cb) { + if (this._onconnectionstatechange) { + this.removeEventListener('connectionstatechange', + this._onconnectionstatechange); + delete this._onconnectionstatechange; + } + if (cb) { + this.addEventListener('connectionstatechange', + this._onconnectionstatechange = cb); + } + }, + enumerable: true, + configurable: true + }); + + ['setLocalDescription', 'setRemoteDescription'].forEach((method) => { + const origMethod = proto[method]; + proto[method] = function() { + if (!this._connectionstatechangepoly) { + this._connectionstatechangepoly = e => { + const pc = e.target; + if (pc._lastConnectionState !== pc.connectionState) { + pc._lastConnectionState = pc.connectionState; + const newEvent = new Event('connectionstatechange', e); + pc.dispatchEvent(newEvent); + } + return e; + }; + this.addEventListener('iceconnectionstatechange', + this._connectionstatechangepoly); + } + return origMethod.apply(this, arguments); + }; + }); + } + + function removeExtmapAllowMixed(window, browserDetails) { + /* remove a=extmap-allow-mixed for webrtc.org < M71 */ + if (!window.RTCPeerConnection) { + return; + } + if (browserDetails.browser === 'chrome' && browserDetails.version >= 71) { + return; + } + if (browserDetails.browser === 'safari' && browserDetails.version >= 605) { + return; + } + const nativeSRD = window.RTCPeerConnection.prototype.setRemoteDescription; + window.RTCPeerConnection.prototype.setRemoteDescription = + function setRemoteDescription(desc) { + if (desc && desc.sdp && desc.sdp.indexOf('\na=extmap-allow-mixed') !== -1) { + const sdp = desc.sdp.split('\n').filter((line) => { + return line.trim() !== 'a=extmap-allow-mixed'; + }).join('\n'); + // Safari enforces read-only-ness of RTCSessionDescription fields. + if (window.RTCSessionDescription && + desc instanceof window.RTCSessionDescription) { + arguments[0] = new window.RTCSessionDescription({ + type: desc.type, + sdp, + }); + } else { + desc.sdp = sdp; + } + } + return nativeSRD.apply(this, arguments); + }; + } + + function shimAddIceCandidateNullOrEmpty(window, browserDetails) { + // Support for addIceCandidate(null or undefined) + // as well as addIceCandidate({candidate: "", ...}) + // https://bugs.chromium.org/p/chromium/issues/detail?id=978582 + // Note: must be called before other polyfills which change the signature. + if (!(window.RTCPeerConnection && window.RTCPeerConnection.prototype)) { + return; + } + const nativeAddIceCandidate = + window.RTCPeerConnection.prototype.addIceCandidate; + if (!nativeAddIceCandidate || nativeAddIceCandidate.length === 0) { + return; + } + window.RTCPeerConnection.prototype.addIceCandidate = + function addIceCandidate() { + if (!arguments[0]) { + if (arguments[1]) { + arguments[1].apply(null); + } + return Promise.resolve(); + } + // Firefox 68+ emits and processes {candidate: "", ...}, ignore + // in older versions. + // Native support for ignoring exists for Chrome M77+. + // Safari ignores as well, exact version unknown but works in the same + // version that also ignores addIceCandidate(null). + if (((browserDetails.browser === 'chrome' && browserDetails.version < 78) + || (browserDetails.browser === 'firefox' + && browserDetails.version < 68) + || (browserDetails.browser === 'safari')) + && arguments[0] && arguments[0].candidate === '') { + return Promise.resolve(); + } + return nativeAddIceCandidate.apply(this, arguments); + }; + } + + var commonShim = /*#__PURE__*/Object.freeze({ + __proto__: null, + shimRTCIceCandidate: shimRTCIceCandidate, + shimMaxMessageSize: shimMaxMessageSize, + shimSendThrowTypeError: shimSendThrowTypeError, + shimConnectionState: shimConnectionState, + removeExtmapAllowMixed: removeExtmapAllowMixed, + shimAddIceCandidateNullOrEmpty: shimAddIceCandidateNullOrEmpty + }); + + /* + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + + // Shimming starts here. + function adapterFactory({window} = {}, options = { + shimChrome: true, + shimFirefox: true, + shimEdge: true, + shimSafari: true, + }) { + // Utils. + const logging = log$1; + const browserDetails = detectBrowser(window); + + const adapter = { + browserDetails, + commonShim, + extractVersion: extractVersion, + disableLog: disableLog, + disableWarnings: disableWarnings + }; + + // Shim browser if found. + switch (browserDetails.browser) { + case 'chrome': + if (!chromeShim || !shimPeerConnection$2 || + !options.shimChrome) { + logging('Chrome shim is not included in this adapter release.'); + return adapter; + } + if (browserDetails.version === null) { + logging('Chrome shim can not determine version, not shimming.'); + return adapter; + } + logging('adapter.js shimming chrome.'); + // Export to the adapter global object visible in the browser. + adapter.browserShim = chromeShim; + + // Must be called before shimPeerConnection. + shimAddIceCandidateNullOrEmpty(window, browserDetails); + + shimGetUserMedia$3(window, browserDetails); + shimMediaStream(window); + shimPeerConnection$2(window, browserDetails); + shimOnTrack$1(window); + shimAddTrackRemoveTrack(window, browserDetails); + shimGetSendersWithDtmf(window); + shimGetStats(window); + shimSenderReceiverGetStats(window); + fixNegotiationNeeded(window, browserDetails); + + shimRTCIceCandidate(window); + shimConnectionState(window); + shimMaxMessageSize(window, browserDetails); + shimSendThrowTypeError(window); + removeExtmapAllowMixed(window, browserDetails); + break; + case 'firefox': + if (!firefoxShim || !shimPeerConnection || + !options.shimFirefox) { + logging('Firefox shim is not included in this adapter release.'); + return adapter; + } + logging('adapter.js shimming firefox.'); + // Export to the adapter global object visible in the browser. + adapter.browserShim = firefoxShim; + + // Must be called before shimPeerConnection. + shimAddIceCandidateNullOrEmpty(window, browserDetails); + + shimGetUserMedia$1(window, browserDetails); + shimPeerConnection(window, browserDetails); + shimOnTrack(window); + shimRemoveStream(window); + shimSenderGetStats(window); + shimReceiverGetStats(window); + shimRTCDataChannel(window); + shimAddTransceiver(window); + shimGetParameters(window); + shimCreateOffer(window); + shimCreateAnswer(window); + + shimRTCIceCandidate(window); + shimConnectionState(window); + shimMaxMessageSize(window, browserDetails); + shimSendThrowTypeError(window); + break; + case 'edge': + if (!edgeShim || !shimPeerConnection$1 || !options.shimEdge) { + logging('MS edge shim is not included in this adapter release.'); + return adapter; + } + logging('adapter.js shimming edge.'); + // Export to the adapter global object visible in the browser. + adapter.browserShim = edgeShim; + + shimGetUserMedia$2(window); + shimGetDisplayMedia$1(window); + shimPeerConnection$1(window, browserDetails); + shimReplaceTrack(window); + + // the edge shim implements the full RTCIceCandidate object. + + shimMaxMessageSize(window, browserDetails); + shimSendThrowTypeError(window); + break; + case 'safari': + if (!safariShim || !options.shimSafari) { + logging('Safari shim is not included in this adapter release.'); + return adapter; + } + logging('adapter.js shimming safari.'); + // Export to the adapter global object visible in the browser. + adapter.browserShim = safariShim; + + // Must be called before shimCallbackAPI. + shimAddIceCandidateNullOrEmpty(window, browserDetails); + + shimRTCIceServerUrls(window); + shimCreateOfferLegacy(window); + shimCallbacksAPI(window); + shimLocalStreamsAPI(window); + shimRemoteStreamsAPI(window); + shimTrackEventTransceiver(window); + shimGetUserMedia(window); + shimAudioContext(window); + + shimRTCIceCandidate(window); + shimMaxMessageSize(window, browserDetails); + shimSendThrowTypeError(window); + removeExtmapAllowMixed(window, browserDetails); + break; + default: + logging('Unsupported browser!'); + break; + } + + return adapter; + } + + /* + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. + */ + + adapterFactory({window: typeof window === 'undefined' ? undefined : window}); + + /** + * @class AudioTrackConstraints + * @classDesc Constraints for creating an audio MediaStreamTrack. + * @memberof Owt.Base + * @constructor + * @param {Owt.Base.AudioSourceInfo} source Source info of this audio track. + */ + class AudioTrackConstraints { + // eslint-disable-next-line require-jsdoc + constructor(source) { + if (!Object.values(AudioSourceInfo).some(v => v === source)) { + throw new TypeError('Invalid source.'); + } + /** + * @member {string} source + * @memberof Owt.Base.AudioTrackConstraints + * @desc Values could be "mic", "screen-cast", "file" or "mixed". + * @instance + */ + this.source = source; + /** + * @member {string} deviceId + * @memberof Owt.Base.AudioTrackConstraints + * @desc Do not provide deviceId if source is not "mic". + * @instance + * @see https://w3c.github.io/mediacapture-main/#def-constraint-deviceId + */ + this.deviceId = undefined; + } + } + + /** + * @class VideoTrackConstraints + * @classDesc Constraints for creating a video MediaStreamTrack. + * @memberof Owt.Base + * @constructor + * @param {Owt.Base.VideoSourceInfo} source Source info of this video track. + */ + class VideoTrackConstraints { + // eslint-disable-next-line require-jsdoc + constructor(source) { + if (!Object.values(VideoSourceInfo).some(v => v === source)) { + throw new TypeError('Invalid source.'); + } + /** + * @member {string} source + * @memberof Owt.Base.VideoTrackConstraints + * @desc Values could be "camera", "screen-cast", "file" or "mixed". + * @instance + */ + this.source = source; + /** + * @member {string} deviceId + * @memberof Owt.Base.VideoTrackConstraints + * @desc Do not provide deviceId if source is not "camera". + * @instance + * @see https://w3c.github.io/mediacapture-main/#def-constraint-deviceId + */ + + this.deviceId = undefined; + + /** + * @member {Owt.Base.Resolution} resolution + * @memberof Owt.Base.VideoTrackConstraints + * @instance + */ + this.resolution = undefined; + + /** + * @member {number} frameRate + * @memberof Owt.Base.VideoTrackConstraints + * @instance + */ + this.frameRate = undefined; + } + } + /** + * @class StreamConstraints + * @classDesc Constraints for creating a MediaStream from screen mic and camera. + * @memberof Owt.Base + * @constructor + * @param {?Owt.Base.AudioTrackConstraints} audioConstraints + * @param {?Owt.Base.VideoTrackConstraints} videoConstraints + */ + class StreamConstraints { + // eslint-disable-next-line require-jsdoc + constructor(audioConstraints = false, videoConstraints = false) { + /** + * @member {Owt.Base.MediaStreamTrackDeviceConstraintsForAudio} audio + * @memberof Owt.Base.MediaStreamDeviceConstraints + * @instance + */ + this.audio = audioConstraints; + /** + * @member {Owt.Base.MediaStreamTrackDeviceConstraintsForVideo} Video + * @memberof Owt.Base.MediaStreamDeviceConstraints + * @instance + */ + this.video = videoConstraints; + } + } + + // eslint-disable-next-line require-jsdoc + function isVideoConstrainsForScreenCast(constraints) { + return typeof constraints.video === 'object' && constraints.video.source === VideoSourceInfo.SCREENCAST; + } + + /** + * @class MediaStreamFactory + * @classDesc A factory to create MediaStream. You can also create MediaStream by yourself. + * @memberof Owt.Base + */ + class MediaStreamFactory { + /** + * @function createMediaStream + * @static + * @desc Create a MediaStream with given constraints. If you want to create a MediaStream for screen cast, please make sure both audio and video's source are "screen-cast". + * @memberof Owt.Base.MediaStreamFactory + * @return {Promise} Return a promise that is resolved when stream is successfully created, or rejected if one of the following error happened: + * - One or more parameters cannot be satisfied. + * - Specified device is busy. + * - Cannot obtain necessary permission or operation is canceled by user. + * - Video source is screen cast, while audio source is not. + * - Audio source is screen cast, while video source is disabled. + * @param {Owt.Base.StreamConstraints} constraints + */ + static createMediaStream(constraints) { + if (typeof constraints !== 'object' || !constraints.audio && !constraints.video) { + return Promise.reject(new TypeError('Invalid constrains')); + } + if (!isVideoConstrainsForScreenCast(constraints) && typeof constraints.audio === 'object' && constraints.audio.source === AudioSourceInfo.SCREENCAST) { + return Promise.reject(new TypeError('Cannot share screen without video.')); + } + if (isVideoConstrainsForScreenCast(constraints) && !isChrome() && !isFirefox()) { + return Promise.reject(new TypeError('Screen sharing only supports Chrome and Firefox.')); + } + if (isVideoConstrainsForScreenCast(constraints) && typeof constraints.audio === 'object' && constraints.audio.source !== AudioSourceInfo.SCREENCAST) { + return Promise.reject(new TypeError('Cannot capture video from screen cast while capture audio from' + ' other source.')); + } + + // Check and convert constraints. + if (!constraints.audio && !constraints.video) { + return Promise.reject(new TypeError('At least one of audio and video must be requested.')); + } + const mediaConstraints = Object.create({}); + if (typeof constraints.audio === 'object' && constraints.audio.source === AudioSourceInfo.MIC) { + mediaConstraints.audio = Object.create({}); + if (isEdge()) { + mediaConstraints.audio.deviceId = constraints.audio.deviceId; + } else { + mediaConstraints.audio.deviceId = { + exact: constraints.audio.deviceId + }; + } + } else { + if (constraints.audio.source === AudioSourceInfo.SCREENCAST) { + mediaConstraints.audio = true; + } else { + mediaConstraints.audio = constraints.audio; + } + } + if (typeof constraints.video === 'object') { + mediaConstraints.video = Object.create({}); + if (typeof constraints.video.frameRate === 'number') { + mediaConstraints.video.frameRate = constraints.video.frameRate; + } + if (constraints.video.resolution && constraints.video.resolution.width && constraints.video.resolution.height) { + if (constraints.video.source === VideoSourceInfo.SCREENCAST) { + mediaConstraints.video.width = constraints.video.resolution.width; + mediaConstraints.video.height = constraints.video.resolution.height; + } else { + mediaConstraints.video.width = Object.create({}); + mediaConstraints.video.width.exact = constraints.video.resolution.width; + mediaConstraints.video.height = Object.create({}); + mediaConstraints.video.height.exact = constraints.video.resolution.height; + } + } + if (typeof constraints.video.deviceId === 'string') { + mediaConstraints.video.deviceId = { + exact: constraints.video.deviceId + }; + } + if (isFirefox() && constraints.video.source === VideoSourceInfo.SCREENCAST) { + mediaConstraints.video.mediaSource = 'screen'; + } + } else { + mediaConstraints.video = constraints.video; + } + if (isVideoConstrainsForScreenCast(constraints)) { + return navigator.mediaDevices.getDisplayMedia(mediaConstraints); + } else { + return navigator.mediaDevices.getUserMedia(mediaConstraints); + } + } + } + + // Copyright (C) <2018> Intel Corporation + + var media = /*#__PURE__*/Object.freeze({ + __proto__: null, + AudioTrackConstraints: AudioTrackConstraints, + VideoTrackConstraints: VideoTrackConstraints, + StreamConstraints: StreamConstraints, + MediaStreamFactory: MediaStreamFactory, + AudioSourceInfo: AudioSourceInfo, + VideoSourceInfo: VideoSourceInfo, + TrackKind: TrackKind, + Resolution: Resolution + }); + + let logger; + let errorLogger; + function setLogger() { + /*eslint-disable */ + logger = console.log; + errorLogger = console.error; + /*eslint-enable */ + } + function log(message, ...optionalParams) { + if (logger) { + logger(message, ...optionalParams); + } + } + function error(message, ...optionalParams) { + if (errorLogger) { + errorLogger(message, ...optionalParams); + } + } + + class Event$1 { + constructor(type) { + this.listener = {}; + this.type = type | ''; + } + on(event, fn) { + if (!this.listener[event]) { + this.listener[event] = []; + } + this.listener[event].push(fn); + return true; + } + off(event, fn) { + if (this.listener[event]) { + var index = this.listener[event].indexOf(fn); + if (index > -1) { + this.listener[event].splice(index, 1); + } + return true; + } + return false; + } + offAll() { + this.listener = {}; + } + dispatch(event, data) { + if (this.listener[event]) { + this.listener[event].map(each => { + each.apply(null, [data]); + }); + return true; + } + return false; + } + } + + var bind = function bind(fn, thisArg) { + return function wrap() { + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } + return fn.apply(thisArg, args); + }; + }; + + // utils is a library of generic helper functions non-specific to axios + + var toString = Object.prototype.toString; + + // eslint-disable-next-line func-names + var kindOf = (function(cache) { + // eslint-disable-next-line func-names + return function(thing) { + var str = toString.call(thing); + return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase()); + }; + })(Object.create(null)); + + function kindOfTest(type) { + type = type.toLowerCase(); + return function isKindOf(thing) { + return kindOf(thing) === type; + }; + } + + /** + * Determine if a value is an Array + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an Array, otherwise false + */ + function isArray(val) { + return Array.isArray(val); + } + + /** + * Determine if a value is undefined + * + * @param {Object} val The value to test + * @returns {boolean} True if the value is undefined, otherwise false + */ + function isUndefined(val) { + return typeof val === 'undefined'; + } + + /** + * Determine if a value is a Buffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Buffer, otherwise false + */ + function isBuffer(val) { + return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) + && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val); + } + + /** + * Determine if a value is an ArrayBuffer + * + * @function + * @param {Object} val The value to test + * @returns {boolean} True if value is an ArrayBuffer, otherwise false + */ + var isArrayBuffer = kindOfTest('ArrayBuffer'); + + + /** + * Determine if a value is a view on an ArrayBuffer + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false + */ + function isArrayBufferView(val) { + var result; + if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) { + result = ArrayBuffer.isView(val); + } else { + result = (val) && (val.buffer) && (isArrayBuffer(val.buffer)); + } + return result; + } + + /** + * Determine if a value is a String + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a String, otherwise false + */ + function isString(val) { + return typeof val === 'string'; + } + + /** + * Determine if a value is a Number + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Number, otherwise false + */ + function isNumber(val) { + return typeof val === 'number'; + } + + /** + * Determine if a value is an Object + * + * @param {Object} val The value to test + * @returns {boolean} True if value is an Object, otherwise false + */ + function isObject(val) { + return val !== null && typeof val === 'object'; + } + + /** + * Determine if a value is a plain Object + * + * @param {Object} val The value to test + * @return {boolean} True if value is a plain Object, otherwise false + */ + function isPlainObject(val) { + if (kindOf(val) !== 'object') { + return false; + } + + var prototype = Object.getPrototypeOf(val); + return prototype === null || prototype === Object.prototype; + } + + /** + * Determine if a value is a Date + * + * @function + * @param {Object} val The value to test + * @returns {boolean} True if value is a Date, otherwise false + */ + var isDate = kindOfTest('Date'); + + /** + * Determine if a value is a File + * + * @function + * @param {Object} val The value to test + * @returns {boolean} True if value is a File, otherwise false + */ + var isFile = kindOfTest('File'); + + /** + * Determine if a value is a Blob + * + * @function + * @param {Object} val The value to test + * @returns {boolean} True if value is a Blob, otherwise false + */ + var isBlob = kindOfTest('Blob'); + + /** + * Determine if a value is a FileList + * + * @function + * @param {Object} val The value to test + * @returns {boolean} True if value is a File, otherwise false + */ + var isFileList = kindOfTest('FileList'); + + /** + * Determine if a value is a Function + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Function, otherwise false + */ + function isFunction(val) { + return toString.call(val) === '[object Function]'; + } + + /** + * Determine if a value is a Stream + * + * @param {Object} val The value to test + * @returns {boolean} True if value is a Stream, otherwise false + */ + function isStream(val) { + return isObject(val) && isFunction(val.pipe); + } + + /** + * Determine if a value is a FormData + * + * @param {Object} thing The value to test + * @returns {boolean} True if value is an FormData, otherwise false + */ + function isFormData(thing) { + var pattern = '[object FormData]'; + return thing && ( + (typeof FormData === 'function' && thing instanceof FormData) || + toString.call(thing) === pattern || + (isFunction(thing.toString) && thing.toString() === pattern) + ); + } + + /** + * Determine if a value is a URLSearchParams object + * @function + * @param {Object} val The value to test + * @returns {boolean} True if value is a URLSearchParams object, otherwise false + */ + var isURLSearchParams = kindOfTest('URLSearchParams'); + + /** + * Trim excess whitespace off the beginning and end of a string + * + * @param {String} str The String to trim + * @returns {String} The String freed of excess whitespace + */ + function trim(str) { + return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, ''); + } + + /** + * Determine if we're running in a standard browser environment + * + * This allows axios to run in a web worker, and react-native. + * Both environments support XMLHttpRequest, but not fully standard globals. + * + * web workers: + * typeof window -> undefined + * typeof document -> undefined + * + * react-native: + * navigator.product -> 'ReactNative' + * nativescript + * navigator.product -> 'NativeScript' or 'NS' + */ + function isStandardBrowserEnv() { + if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || + navigator.product === 'NativeScript' || + navigator.product === 'NS')) { + return false; + } + return ( + typeof window !== 'undefined' && + typeof document !== 'undefined' + ); + } + + /** + * Iterate over an Array or an Object invoking a function for each item. + * + * If `obj` is an Array callback will be called passing + * the value, index, and complete array for each item. + * + * If 'obj' is an Object callback will be called passing + * the value, key, and complete object for each property. + * + * @param {Object|Array} obj The object to iterate + * @param {Function} fn The callback to invoke for each item + */ + function forEach(obj, fn) { + // Don't bother if no value provided + if (obj === null || typeof obj === 'undefined') { + return; + } + + // Force an array if not already something iterable + if (typeof obj !== 'object') { + /*eslint no-param-reassign:0*/ + obj = [obj]; + } + + if (isArray(obj)) { + // Iterate over array values + for (var i = 0, l = obj.length; i < l; i++) { + fn.call(null, obj[i], i, obj); + } + } else { + // Iterate over object keys + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + fn.call(null, obj[key], key, obj); + } + } + } + } + + /** + * Accepts varargs expecting each argument to be an object, then + * immutably merges the properties of each object and returns result. + * + * When multiple objects contain the same key the later object in + * the arguments list will take precedence. + * + * Example: + * + * ```js + * var result = merge({foo: 123}, {foo: 456}); + * console.log(result.foo); // outputs 456 + * ``` + * + * @param {Object} obj1 Object to merge + * @returns {Object} Result of all merge properties + */ + function merge(/* obj1, obj2, obj3, ... */) { + var result = {}; + function assignValue(val, key) { + if (isPlainObject(result[key]) && isPlainObject(val)) { + result[key] = merge(result[key], val); + } else if (isPlainObject(val)) { + result[key] = merge({}, val); + } else if (isArray(val)) { + result[key] = val.slice(); + } else { + result[key] = val; + } + } + + for (var i = 0, l = arguments.length; i < l; i++) { + forEach(arguments[i], assignValue); + } + return result; + } + + /** + * Extends object a by mutably adding to it the properties of object b. + * + * @param {Object} a The object to be extended + * @param {Object} b The object to copy properties from + * @param {Object} thisArg The object to bind function to + * @return {Object} The resulting value of object a + */ + function extend(a, b, thisArg) { + forEach(b, function assignValue(val, key) { + if (thisArg && typeof val === 'function') { + a[key] = bind(val, thisArg); + } else { + a[key] = val; + } + }); + return a; + } + + /** + * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM) + * + * @param {string} content with BOM + * @return {string} content value without BOM + */ + function stripBOM(content) { + if (content.charCodeAt(0) === 0xFEFF) { + content = content.slice(1); + } + return content; + } + + /** + * Inherit the prototype methods from one constructor into another + * @param {function} constructor + * @param {function} superConstructor + * @param {object} [props] + * @param {object} [descriptors] + */ + + function inherits(constructor, superConstructor, props, descriptors) { + constructor.prototype = Object.create(superConstructor.prototype, descriptors); + constructor.prototype.constructor = constructor; + props && Object.assign(constructor.prototype, props); + } + + /** + * Resolve object with deep prototype chain to a flat object + * @param {Object} sourceObj source object + * @param {Object} [destObj] + * @param {Function} [filter] + * @returns {Object} + */ + + function toFlatObject(sourceObj, destObj, filter) { + var props; + var i; + var prop; + var merged = {}; + + destObj = destObj || {}; + + do { + props = Object.getOwnPropertyNames(sourceObj); + i = props.length; + while (i-- > 0) { + prop = props[i]; + if (!merged[prop]) { + destObj[prop] = sourceObj[prop]; + merged[prop] = true; + } + } + sourceObj = Object.getPrototypeOf(sourceObj); + } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype); + + return destObj; + } + + /* + * determines whether a string ends with the characters of a specified string + * @param {String} str + * @param {String} searchString + * @param {Number} [position= 0] + * @returns {boolean} + */ + function endsWith(str, searchString, position) { + str = String(str); + if (position === undefined || position > str.length) { + position = str.length; + } + position -= searchString.length; + var lastIndex = str.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; + } + + + /** + * Returns new array from array like object + * @param {*} [thing] + * @returns {Array} + */ + function toArray(thing) { + if (!thing) return null; + var i = thing.length; + if (isUndefined(i)) return null; + var arr = new Array(i); + while (i-- > 0) { + arr[i] = thing[i]; + } + return arr; + } + + // eslint-disable-next-line func-names + var isTypedArray = (function(TypedArray) { + // eslint-disable-next-line func-names + return function(thing) { + return TypedArray && thing instanceof TypedArray; + }; + })(typeof Uint8Array !== 'undefined' && Object.getPrototypeOf(Uint8Array)); + + var utils = { + isArray: isArray, + isArrayBuffer: isArrayBuffer, + isBuffer: isBuffer, + isFormData: isFormData, + isArrayBufferView: isArrayBufferView, + isString: isString, + isNumber: isNumber, + isObject: isObject, + isPlainObject: isPlainObject, + isUndefined: isUndefined, + isDate: isDate, + isFile: isFile, + isBlob: isBlob, + isFunction: isFunction, + isStream: isStream, + isURLSearchParams: isURLSearchParams, + isStandardBrowserEnv: isStandardBrowserEnv, + forEach: forEach, + merge: merge, + extend: extend, + trim: trim, + stripBOM: stripBOM, + inherits: inherits, + toFlatObject: toFlatObject, + kindOf: kindOf, + kindOfTest: kindOfTest, + endsWith: endsWith, + toArray: toArray, + isTypedArray: isTypedArray, + isFileList: isFileList + }; + + function encode(val) { + return encodeURIComponent(val). + replace(/%3A/gi, ':'). + replace(/%24/g, '$'). + replace(/%2C/gi, ','). + replace(/%20/g, '+'). + replace(/%5B/gi, '['). + replace(/%5D/gi, ']'); + } + + /** + * Build a URL by appending params to the end + * + * @param {string} url The base of the url (e.g., http://www.google.com) + * @param {object} [params] The params to be appended + * @returns {string} The formatted url + */ + var buildURL = function buildURL(url, params, paramsSerializer) { + /*eslint no-param-reassign:0*/ + if (!params) { + return url; + } + + var serializedParams; + if (paramsSerializer) { + serializedParams = paramsSerializer(params); + } else if (utils.isURLSearchParams(params)) { + serializedParams = params.toString(); + } else { + var parts = []; + + utils.forEach(params, function serialize(val, key) { + if (val === null || typeof val === 'undefined') { + return; + } + + if (utils.isArray(val)) { + key = key + '[]'; + } else { + val = [val]; + } + + utils.forEach(val, function parseValue(v) { + if (utils.isDate(v)) { + v = v.toISOString(); + } else if (utils.isObject(v)) { + v = JSON.stringify(v); + } + parts.push(encode(key) + '=' + encode(v)); + }); + }); + + serializedParams = parts.join('&'); + } + + if (serializedParams) { + var hashmarkIndex = url.indexOf('#'); + if (hashmarkIndex !== -1) { + url = url.slice(0, hashmarkIndex); + } + + url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams; + } + + return url; + }; + + function InterceptorManager() { + this.handlers = []; + } + + /** + * Add a new interceptor to the stack + * + * @param {Function} fulfilled The function to handle `then` for a `Promise` + * @param {Function} rejected The function to handle `reject` for a `Promise` + * + * @return {Number} An ID used to remove interceptor later + */ + InterceptorManager.prototype.use = function use(fulfilled, rejected, options) { + this.handlers.push({ + fulfilled: fulfilled, + rejected: rejected, + synchronous: options ? options.synchronous : false, + runWhen: options ? options.runWhen : null + }); + return this.handlers.length - 1; + }; + + /** + * Remove an interceptor from the stack + * + * @param {Number} id The ID that was returned by `use` + */ + InterceptorManager.prototype.eject = function eject(id) { + if (this.handlers[id]) { + this.handlers[id] = null; + } + }; + + /** + * Iterate over all the registered interceptors + * + * This method is particularly useful for skipping over any + * interceptors that may have become `null` calling `eject`. + * + * @param {Function} fn The function to call for each interceptor + */ + InterceptorManager.prototype.forEach = function forEach(fn) { + utils.forEach(this.handlers, function forEachHandler(h) { + if (h !== null) { + fn(h); + } + }); + }; + + var InterceptorManager_1 = InterceptorManager; + + var normalizeHeaderName = function normalizeHeaderName(headers, normalizedName) { + utils.forEach(headers, function processHeader(value, name) { + if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) { + headers[normalizedName] = value; + delete headers[name]; + } + }); + }; + + /** + * Create an Error with the specified message, config, error code, request and response. + * + * @param {string} message The error message. + * @param {string} [code] The error code (for example, 'ECONNABORTED'). + * @param {Object} [config] The config. + * @param {Object} [request] The request. + * @param {Object} [response] The response. + * @returns {Error} The created error. + */ + function AxiosError(message, code, config, request, response) { + Error.call(this); + this.message = message; + this.name = 'AxiosError'; + code && (this.code = code); + config && (this.config = config); + request && (this.request = request); + response && (this.response = response); + } + + utils.inherits(AxiosError, Error, { + toJSON: function toJSON() { + return { + // Standard + message: this.message, + name: this.name, + // Microsoft + description: this.description, + number: this.number, + // Mozilla + fileName: this.fileName, + lineNumber: this.lineNumber, + columnNumber: this.columnNumber, + stack: this.stack, + // Axios + config: this.config, + code: this.code, + status: this.response && this.response.status ? this.response.status : null + }; + } + }); + + var prototype = AxiosError.prototype; + var descriptors = {}; + + [ + 'ERR_BAD_OPTION_VALUE', + 'ERR_BAD_OPTION', + 'ECONNABORTED', + 'ETIMEDOUT', + 'ERR_NETWORK', + 'ERR_FR_TOO_MANY_REDIRECTS', + 'ERR_DEPRECATED', + 'ERR_BAD_RESPONSE', + 'ERR_BAD_REQUEST', + 'ERR_CANCELED' + // eslint-disable-next-line func-names + ].forEach(function(code) { + descriptors[code] = {value: code}; + }); + + Object.defineProperties(AxiosError, descriptors); + Object.defineProperty(prototype, 'isAxiosError', {value: true}); + + // eslint-disable-next-line func-names + AxiosError.from = function(error, code, config, request, response, customProps) { + var axiosError = Object.create(prototype); + + utils.toFlatObject(error, axiosError, function filter(obj) { + return obj !== Error.prototype; + }); + + AxiosError.call(axiosError, error.message, code, config, request, response); + + axiosError.name = error.name; + + customProps && Object.assign(axiosError, customProps); + + return axiosError; + }; + + var AxiosError_1 = AxiosError; + + var transitional = { + silentJSONParsing: true, + forcedJSONParsing: true, + clarifyTimeoutError: false + }; + + /** + * Convert a data object to FormData + * @param {Object} obj + * @param {?Object} [formData] + * @returns {Object} + **/ + + function toFormData(obj, formData) { + // eslint-disable-next-line no-param-reassign + formData = formData || new FormData(); + + var stack = []; + + function convertValue(value) { + if (value === null) return ''; + + if (utils.isDate(value)) { + return value.toISOString(); + } + + if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) { + return typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value); + } + + return value; + } + + function build(data, parentKey) { + if (utils.isPlainObject(data) || utils.isArray(data)) { + if (stack.indexOf(data) !== -1) { + throw Error('Circular reference detected in ' + parentKey); + } + + stack.push(data); + + utils.forEach(data, function each(value, key) { + if (utils.isUndefined(value)) return; + var fullKey = parentKey ? parentKey + '.' + key : key; + var arr; + + if (value && !parentKey && typeof value === 'object') { + if (utils.endsWith(key, '{}')) { + // eslint-disable-next-line no-param-reassign + value = JSON.stringify(value); + } else if (utils.endsWith(key, '[]') && (arr = utils.toArray(value))) { + // eslint-disable-next-line func-names + arr.forEach(function(el) { + !utils.isUndefined(el) && formData.append(fullKey, convertValue(el)); + }); + return; + } + } + + build(value, fullKey); + }); + + stack.pop(); + } else { + formData.append(parentKey, convertValue(data)); + } + } + + build(obj); + + return formData; + } + + var toFormData_1 = toFormData; + + /** + * Resolve or reject a Promise based on response status. + * + * @param {Function} resolve A function that resolves the promise. + * @param {Function} reject A function that rejects the promise. + * @param {object} response The response. + */ + var settle = function settle(resolve, reject, response) { + var validateStatus = response.config.validateStatus; + if (!response.status || !validateStatus || validateStatus(response.status)) { + resolve(response); + } else { + reject(new AxiosError_1( + 'Request failed with status code ' + response.status, + [AxiosError_1.ERR_BAD_REQUEST, AxiosError_1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], + response.config, + response.request, + response + )); + } + }; + + var cookies = ( + utils.isStandardBrowserEnv() ? + + // Standard browser envs support document.cookie + (function standardBrowserEnv() { + return { + write: function write(name, value, expires, path, domain, secure) { + var cookie = []; + cookie.push(name + '=' + encodeURIComponent(value)); + + if (utils.isNumber(expires)) { + cookie.push('expires=' + new Date(expires).toGMTString()); + } + + if (utils.isString(path)) { + cookie.push('path=' + path); + } + + if (utils.isString(domain)) { + cookie.push('domain=' + domain); + } + + if (secure === true) { + cookie.push('secure'); + } + + document.cookie = cookie.join('; '); + }, + + read: function read(name) { + var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)')); + return (match ? decodeURIComponent(match[3]) : null); + }, + + remove: function remove(name) { + this.write(name, '', Date.now() - 86400000); + } + }; + })() : + + // Non standard browser env (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return { + write: function write() {}, + read: function read() { return null; }, + remove: function remove() {} + }; + })() + ); + + /** + * Determines whether the specified URL is absolute + * + * @param {string} url The URL to test + * @returns {boolean} True if the specified URL is absolute, otherwise false + */ + var isAbsoluteURL = function isAbsoluteURL(url) { + // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL). + // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed + // by any combination of letters, digits, plus, period, or hyphen. + return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url); + }; + + /** + * Creates a new URL by combining the specified URLs + * + * @param {string} baseURL The base URL + * @param {string} relativeURL The relative URL + * @returns {string} The combined URL + */ + var combineURLs = function combineURLs(baseURL, relativeURL) { + return relativeURL + ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '') + : baseURL; + }; + + /** + * Creates a new URL by combining the baseURL with the requestedURL, + * only when the requestedURL is not already an absolute URL. + * If the requestURL is absolute, this function returns the requestedURL untouched. + * + * @param {string} baseURL The base URL + * @param {string} requestedURL Absolute or relative URL to combine + * @returns {string} The combined full path + */ + var buildFullPath = function buildFullPath(baseURL, requestedURL) { + if (baseURL && !isAbsoluteURL(requestedURL)) { + return combineURLs(baseURL, requestedURL); + } + return requestedURL; + }; + + // Headers whose duplicates are ignored by node + // c.f. https://nodejs.org/api/http.html#http_message_headers + var ignoreDuplicateOf = [ + 'age', 'authorization', 'content-length', 'content-type', 'etag', + 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', + 'last-modified', 'location', 'max-forwards', 'proxy-authorization', + 'referer', 'retry-after', 'user-agent' + ]; + + /** + * Parse headers into an object + * + * ``` + * Date: Wed, 27 Aug 2014 08:58:49 GMT + * Content-Type: application/json + * Connection: keep-alive + * Transfer-Encoding: chunked + * ``` + * + * @param {String} headers Headers needing to be parsed + * @returns {Object} Headers parsed into an object + */ + var parseHeaders = function parseHeaders(headers) { + var parsed = {}; + var key; + var val; + var i; + + if (!headers) { return parsed; } + + utils.forEach(headers.split('\n'), function parser(line) { + i = line.indexOf(':'); + key = utils.trim(line.substr(0, i)).toLowerCase(); + val = utils.trim(line.substr(i + 1)); + + if (key) { + if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) { + return; + } + if (key === 'set-cookie') { + parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]); + } else { + parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val; + } + } + }); + + return parsed; + }; + + var isURLSameOrigin = ( + utils.isStandardBrowserEnv() ? + + // Standard browser envs have full support of the APIs needed to test + // whether the request URL is of the same origin as current location. + (function standardBrowserEnv() { + var msie = /(msie|trident)/i.test(navigator.userAgent); + var urlParsingNode = document.createElement('a'); + var originURL; + + /** + * Parse a URL to discover it's components + * + * @param {String} url The URL to be parsed + * @returns {Object} + */ + function resolveURL(url) { + var href = url; + + if (msie) { + // IE needs attribute set twice to normalize properties + urlParsingNode.setAttribute('href', href); + href = urlParsingNode.href; + } + + urlParsingNode.setAttribute('href', href); + + // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils + return { + href: urlParsingNode.href, + protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '', + host: urlParsingNode.host, + search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '', + hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '', + hostname: urlParsingNode.hostname, + port: urlParsingNode.port, + pathname: (urlParsingNode.pathname.charAt(0) === '/') ? + urlParsingNode.pathname : + '/' + urlParsingNode.pathname + }; + } + + originURL = resolveURL(window.location.href); + + /** + * Determine if a URL shares the same origin as the current location + * + * @param {String} requestURL The URL to test + * @returns {boolean} True if URL shares the same origin, otherwise false + */ + return function isURLSameOrigin(requestURL) { + var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL; + return (parsed.protocol === originURL.protocol && + parsed.host === originURL.host); + }; + })() : + + // Non standard browser envs (web workers, react-native) lack needed support. + (function nonStandardBrowserEnv() { + return function isURLSameOrigin() { + return true; + }; + })() + ); + + /** + * A `CanceledError` is an object that is thrown when an operation is canceled. + * + * @class + * @param {string=} message The message. + */ + function CanceledError(message) { + // eslint-disable-next-line no-eq-null,eqeqeq + AxiosError_1.call(this, message == null ? 'canceled' : message, AxiosError_1.ERR_CANCELED); + this.name = 'CanceledError'; + } + + utils.inherits(CanceledError, AxiosError_1, { + __CANCEL__: true + }); + + var CanceledError_1 = CanceledError; + + var parseProtocol = function parseProtocol(url) { + var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url); + return match && match[1] || ''; + }; + + var xhr = function xhrAdapter(config) { + return new Promise(function dispatchXhrRequest(resolve, reject) { + var requestData = config.data; + var requestHeaders = config.headers; + var responseType = config.responseType; + var onCanceled; + function done() { + if (config.cancelToken) { + config.cancelToken.unsubscribe(onCanceled); + } + + if (config.signal) { + config.signal.removeEventListener('abort', onCanceled); + } + } + + if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) { + delete requestHeaders['Content-Type']; // Let the browser set it + } + + var request = new XMLHttpRequest(); + + // HTTP basic authentication + if (config.auth) { + var username = config.auth.username || ''; + var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : ''; + requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password); + } + + var fullPath = buildFullPath(config.baseURL, config.url); + + request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true); + + // Set the request timeout in MS + request.timeout = config.timeout; + + function onloadend() { + if (!request) { + return; + } + // Prepare the response + var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null; + var responseData = !responseType || responseType === 'text' || responseType === 'json' ? + request.responseText : request.response; + var response = { + data: responseData, + status: request.status, + statusText: request.statusText, + headers: responseHeaders, + config: config, + request: request + }; + + settle(function _resolve(value) { + resolve(value); + done(); + }, function _reject(err) { + reject(err); + done(); + }, response); + + // Clean up request + request = null; + } + + if ('onloadend' in request) { + // Use onloadend if available + request.onloadend = onloadend; + } else { + // Listen for ready state to emulate onloadend + request.onreadystatechange = function handleLoad() { + if (!request || request.readyState !== 4) { + return; + } + + // The request errored out and we didn't get a response, this will be + // handled by onerror instead + // With one exception: request that using file: protocol, most browsers + // will return status as 0 even though it's a successful request + if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) { + return; + } + // readystate handler is calling before onerror or ontimeout handlers, + // so we should call onloadend on the next 'tick' + setTimeout(onloadend); + }; + } + + // Handle browser request cancellation (as opposed to a manual cancellation) + request.onabort = function handleAbort() { + if (!request) { + return; + } + + reject(new AxiosError_1('Request aborted', AxiosError_1.ECONNABORTED, config, request)); + + // Clean up request + request = null; + }; + + // Handle low level network errors + request.onerror = function handleError() { + // Real errors are hidden from us by the browser + // onerror should only fire if it's a network error + reject(new AxiosError_1('Network Error', AxiosError_1.ERR_NETWORK, config, request, request)); + + // Clean up request + request = null; + }; + + // Handle timeout + request.ontimeout = function handleTimeout() { + var timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded'; + var transitional$1 = config.transitional || transitional; + if (config.timeoutErrorMessage) { + timeoutErrorMessage = config.timeoutErrorMessage; + } + reject(new AxiosError_1( + timeoutErrorMessage, + transitional$1.clarifyTimeoutError ? AxiosError_1.ETIMEDOUT : AxiosError_1.ECONNABORTED, + config, + request)); + + // Clean up request + request = null; + }; + + // Add xsrf header + // This is only done if running in a standard browser environment. + // Specifically not if we're in a web worker, or react-native. + if (utils.isStandardBrowserEnv()) { + // Add xsrf header + var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ? + cookies.read(config.xsrfCookieName) : + undefined; + + if (xsrfValue) { + requestHeaders[config.xsrfHeaderName] = xsrfValue; + } + } + + // Add headers to the request + if ('setRequestHeader' in request) { + utils.forEach(requestHeaders, function setRequestHeader(val, key) { + if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') { + // Remove Content-Type if data is undefined + delete requestHeaders[key]; + } else { + // Otherwise add header to the request + request.setRequestHeader(key, val); + } + }); + } + + // Add withCredentials to request if needed + if (!utils.isUndefined(config.withCredentials)) { + request.withCredentials = !!config.withCredentials; + } + + // Add responseType to request if needed + if (responseType && responseType !== 'json') { + request.responseType = config.responseType; + } + + // Handle progress if needed + if (typeof config.onDownloadProgress === 'function') { + request.addEventListener('progress', config.onDownloadProgress); + } + + // Not all browsers support upload events + if (typeof config.onUploadProgress === 'function' && request.upload) { + request.upload.addEventListener('progress', config.onUploadProgress); + } + + if (config.cancelToken || config.signal) { + // Handle cancellation + // eslint-disable-next-line func-names + onCanceled = function(cancel) { + if (!request) { + return; + } + reject(!cancel || (cancel && cancel.type) ? new CanceledError_1() : cancel); + request.abort(); + request = null; + }; + + config.cancelToken && config.cancelToken.subscribe(onCanceled); + if (config.signal) { + config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled); + } + } + + if (!requestData) { + requestData = null; + } + + var protocol = parseProtocol(fullPath); + + if (protocol && [ 'http', 'https', 'file' ].indexOf(protocol) === -1) { + reject(new AxiosError_1('Unsupported protocol ' + protocol + ':', AxiosError_1.ERR_BAD_REQUEST, config)); + return; + } + + + // Send the request + request.send(requestData); + }); + }; + + // eslint-disable-next-line strict + var _null = null; + + var DEFAULT_CONTENT_TYPE = { + 'Content-Type': 'application/x-www-form-urlencoded' + }; + + function setContentTypeIfUnset(headers, value) { + if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) { + headers['Content-Type'] = value; + } + } + + function getDefaultAdapter() { + var adapter; + if (typeof XMLHttpRequest !== 'undefined') { + // For browsers use XHR adapter + adapter = xhr; + } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') { + // For node use HTTP adapter + adapter = xhr; + } + return adapter; + } + + function stringifySafely(rawValue, parser, encoder) { + if (utils.isString(rawValue)) { + try { + (parser || JSON.parse)(rawValue); + return utils.trim(rawValue); + } catch (e) { + if (e.name !== 'SyntaxError') { + throw e; + } + } + } + + return (encoder || JSON.stringify)(rawValue); + } + + var defaults = { + + transitional: transitional, + + adapter: getDefaultAdapter(), + + transformRequest: [function transformRequest(data, headers) { + normalizeHeaderName(headers, 'Accept'); + normalizeHeaderName(headers, 'Content-Type'); + + if (utils.isFormData(data) || + utils.isArrayBuffer(data) || + utils.isBuffer(data) || + utils.isStream(data) || + utils.isFile(data) || + utils.isBlob(data) + ) { + return data; + } + if (utils.isArrayBufferView(data)) { + return data.buffer; + } + if (utils.isURLSearchParams(data)) { + setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8'); + return data.toString(); + } + + var isObjectPayload = utils.isObject(data); + var contentType = headers && headers['Content-Type']; + + var isFileList; + + if ((isFileList = utils.isFileList(data)) || (isObjectPayload && contentType === 'multipart/form-data')) { + var _FormData = this.env && this.env.FormData; + return toFormData_1(isFileList ? {'files[]': data} : data, _FormData && new _FormData()); + } else if (isObjectPayload || contentType === 'application/json') { + setContentTypeIfUnset(headers, 'application/json'); + return stringifySafely(data); + } + + return data; + }], + + transformResponse: [function transformResponse(data) { + var transitional = this.transitional || defaults.transitional; + var silentJSONParsing = transitional && transitional.silentJSONParsing; + var forcedJSONParsing = transitional && transitional.forcedJSONParsing; + var strictJSONParsing = !silentJSONParsing && this.responseType === 'json'; + + if (strictJSONParsing || (forcedJSONParsing && utils.isString(data) && data.length)) { + try { + return JSON.parse(data); + } catch (e) { + if (strictJSONParsing) { + if (e.name === 'SyntaxError') { + throw AxiosError_1.from(e, AxiosError_1.ERR_BAD_RESPONSE, this, null, this.response); + } + throw e; + } + } + } + + return data; + }], + + /** + * A timeout in milliseconds to abort a request. If set to 0 (default) a + * timeout is not created. + */ + timeout: 0, + + xsrfCookieName: 'XSRF-TOKEN', + xsrfHeaderName: 'X-XSRF-TOKEN', + + maxContentLength: -1, + maxBodyLength: -1, + + env: { + FormData: _null + }, + + validateStatus: function validateStatus(status) { + return status >= 200 && status < 300; + }, + + headers: { + common: { + 'Accept': 'application/json, text/plain, */*' + } + } + }; + + utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) { + defaults.headers[method] = {}; + }); + + utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE); + }); + + var defaults_1 = defaults; + + /** + * Transform the data for a request or a response + * + * @param {Object|String} data The data to be transformed + * @param {Array} headers The headers for the request or response + * @param {Array|Function} fns A single function or Array of functions + * @returns {*} The resulting transformed data + */ + var transformData = function transformData(data, headers, fns) { + var context = this || defaults_1; + /*eslint no-param-reassign:0*/ + utils.forEach(fns, function transform(fn) { + data = fn.call(context, data, headers); + }); + + return data; + }; + + var isCancel = function isCancel(value) { + return !!(value && value.__CANCEL__); + }; + + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + function throwIfCancellationRequested(config) { + if (config.cancelToken) { + config.cancelToken.throwIfRequested(); + } + + if (config.signal && config.signal.aborted) { + throw new CanceledError_1(); + } + } + + /** + * Dispatch a request to the server using the configured adapter. + * + * @param {object} config The config that is to be used for the request + * @returns {Promise} The Promise to be fulfilled + */ + var dispatchRequest = function dispatchRequest(config) { + throwIfCancellationRequested(config); + + // Ensure headers exist + config.headers = config.headers || {}; + + // Transform request data + config.data = transformData.call( + config, + config.data, + config.headers, + config.transformRequest + ); + + // Flatten headers + config.headers = utils.merge( + config.headers.common || {}, + config.headers[config.method] || {}, + config.headers + ); + + utils.forEach( + ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], + function cleanHeaderConfig(method) { + delete config.headers[method]; + } + ); + + var adapter = config.adapter || defaults_1.adapter; + + return adapter(config).then(function onAdapterResolution(response) { + throwIfCancellationRequested(config); + + // Transform response data + response.data = transformData.call( + config, + response.data, + response.headers, + config.transformResponse + ); + + return response; + }, function onAdapterRejection(reason) { + if (!isCancel(reason)) { + throwIfCancellationRequested(config); + + // Transform response data + if (reason && reason.response) { + reason.response.data = transformData.call( + config, + reason.response.data, + reason.response.headers, + config.transformResponse + ); + } + } + + return Promise.reject(reason); + }); + }; + + /** + * Config-specific merge-function which creates a new config-object + * by merging two configuration objects together. + * + * @param {Object} config1 + * @param {Object} config2 + * @returns {Object} New object resulting from merging config2 to config1 + */ + var mergeConfig = function mergeConfig(config1, config2) { + // eslint-disable-next-line no-param-reassign + config2 = config2 || {}; + var config = {}; + + function getMergedValue(target, source) { + if (utils.isPlainObject(target) && utils.isPlainObject(source)) { + return utils.merge(target, source); + } else if (utils.isPlainObject(source)) { + return utils.merge({}, source); + } else if (utils.isArray(source)) { + return source.slice(); + } + return source; + } + + // eslint-disable-next-line consistent-return + function mergeDeepProperties(prop) { + if (!utils.isUndefined(config2[prop])) { + return getMergedValue(config1[prop], config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + return getMergedValue(undefined, config1[prop]); + } + } + + // eslint-disable-next-line consistent-return + function valueFromConfig2(prop) { + if (!utils.isUndefined(config2[prop])) { + return getMergedValue(undefined, config2[prop]); + } + } + + // eslint-disable-next-line consistent-return + function defaultToConfig2(prop) { + if (!utils.isUndefined(config2[prop])) { + return getMergedValue(undefined, config2[prop]); + } else if (!utils.isUndefined(config1[prop])) { + return getMergedValue(undefined, config1[prop]); + } + } + + // eslint-disable-next-line consistent-return + function mergeDirectKeys(prop) { + if (prop in config2) { + return getMergedValue(config1[prop], config2[prop]); + } else if (prop in config1) { + return getMergedValue(undefined, config1[prop]); + } + } + + var mergeMap = { + 'url': valueFromConfig2, + 'method': valueFromConfig2, + 'data': valueFromConfig2, + 'baseURL': defaultToConfig2, + 'transformRequest': defaultToConfig2, + 'transformResponse': defaultToConfig2, + 'paramsSerializer': defaultToConfig2, + 'timeout': defaultToConfig2, + 'timeoutMessage': defaultToConfig2, + 'withCredentials': defaultToConfig2, + 'adapter': defaultToConfig2, + 'responseType': defaultToConfig2, + 'xsrfCookieName': defaultToConfig2, + 'xsrfHeaderName': defaultToConfig2, + 'onUploadProgress': defaultToConfig2, + 'onDownloadProgress': defaultToConfig2, + 'decompress': defaultToConfig2, + 'maxContentLength': defaultToConfig2, + 'maxBodyLength': defaultToConfig2, + 'beforeRedirect': defaultToConfig2, + 'transport': defaultToConfig2, + 'httpAgent': defaultToConfig2, + 'httpsAgent': defaultToConfig2, + 'cancelToken': defaultToConfig2, + 'socketPath': defaultToConfig2, + 'responseEncoding': defaultToConfig2, + 'validateStatus': mergeDirectKeys + }; + + utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) { + var merge = mergeMap[prop] || mergeDeepProperties; + var configValue = merge(prop); + (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue); + }); + + return config; + }; + + var data = { + "version": "0.27.2" + }; + + var VERSION = data.version; + + + var validators$1 = {}; + + // eslint-disable-next-line func-names + ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) { + validators$1[type] = function validator(thing) { + return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type; + }; + }); + + var deprecatedWarnings = {}; + + /** + * Transitional option validator + * @param {function|boolean?} validator - set to false if the transitional option has been removed + * @param {string?} version - deprecated version / removed since version + * @param {string?} message - some message with additional info + * @returns {function} + */ + validators$1.transitional = function transitional(validator, version, message) { + function formatMessage(opt, desc) { + return '[Axios v' + VERSION + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : ''); + } + + // eslint-disable-next-line func-names + return function(value, opt, opts) { + if (validator === false) { + throw new AxiosError_1( + formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), + AxiosError_1.ERR_DEPRECATED + ); + } + + if (version && !deprecatedWarnings[opt]) { + deprecatedWarnings[opt] = true; + // eslint-disable-next-line no-console + console.warn( + formatMessage( + opt, + ' has been deprecated since v' + version + ' and will be removed in the near future' + ) + ); + } + + return validator ? validator(value, opt, opts) : true; + }; + }; + + /** + * Assert object's properties type + * @param {object} options + * @param {object} schema + * @param {boolean?} allowUnknown + */ + + function assertOptions(options, schema, allowUnknown) { + if (typeof options !== 'object') { + throw new AxiosError_1('options must be an object', AxiosError_1.ERR_BAD_OPTION_VALUE); + } + var keys = Object.keys(options); + var i = keys.length; + while (i-- > 0) { + var opt = keys[i]; + var validator = schema[opt]; + if (validator) { + var value = options[opt]; + var result = value === undefined || validator(value, opt, options); + if (result !== true) { + throw new AxiosError_1('option ' + opt + ' must be ' + result, AxiosError_1.ERR_BAD_OPTION_VALUE); + } + continue; + } + if (allowUnknown !== true) { + throw new AxiosError_1('Unknown option ' + opt, AxiosError_1.ERR_BAD_OPTION); + } + } + } + + var validator = { + assertOptions: assertOptions, + validators: validators$1 + }; + + var validators = validator.validators; + /** + * Create a new instance of Axios + * + * @param {Object} instanceConfig The default config for the instance + */ + function Axios(instanceConfig) { + this.defaults = instanceConfig; + this.interceptors = { + request: new InterceptorManager_1(), + response: new InterceptorManager_1() + }; + } + + /** + * Dispatch a request + * + * @param {Object} config The config specific for this request (merged with this.defaults) + */ + Axios.prototype.request = function request(configOrUrl, config) { + /*eslint no-param-reassign:0*/ + // Allow for axios('example/url'[, config]) a la fetch API + if (typeof configOrUrl === 'string') { + config = config || {}; + config.url = configOrUrl; + } else { + config = configOrUrl || {}; + } + + config = mergeConfig(this.defaults, config); + + // Set config.method + if (config.method) { + config.method = config.method.toLowerCase(); + } else if (this.defaults.method) { + config.method = this.defaults.method.toLowerCase(); + } else { + config.method = 'get'; + } + + var transitional = config.transitional; + + if (transitional !== undefined) { + validator.assertOptions(transitional, { + silentJSONParsing: validators.transitional(validators.boolean), + forcedJSONParsing: validators.transitional(validators.boolean), + clarifyTimeoutError: validators.transitional(validators.boolean) + }, false); + } + + // filter out skipped interceptors + var requestInterceptorChain = []; + var synchronousRequestInterceptors = true; + this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) { + if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) { + return; + } + + synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous; + + requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected); + }); + + var responseInterceptorChain = []; + this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) { + responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected); + }); + + var promise; + + if (!synchronousRequestInterceptors) { + var chain = [dispatchRequest, undefined]; + + Array.prototype.unshift.apply(chain, requestInterceptorChain); + chain = chain.concat(responseInterceptorChain); + + promise = Promise.resolve(config); + while (chain.length) { + promise = promise.then(chain.shift(), chain.shift()); + } + + return promise; + } + + + var newConfig = config; + while (requestInterceptorChain.length) { + var onFulfilled = requestInterceptorChain.shift(); + var onRejected = requestInterceptorChain.shift(); + try { + newConfig = onFulfilled(newConfig); + } catch (error) { + onRejected(error); + break; + } + } + + try { + promise = dispatchRequest(newConfig); + } catch (error) { + return Promise.reject(error); + } + + while (responseInterceptorChain.length) { + promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift()); + } + + return promise; + }; + + Axios.prototype.getUri = function getUri(config) { + config = mergeConfig(this.defaults, config); + var fullPath = buildFullPath(config.baseURL, config.url); + return buildURL(fullPath, config.params, config.paramsSerializer); + }; + + // Provide aliases for supported request methods + utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) { + /*eslint func-names:0*/ + Axios.prototype[method] = function(url, config) { + return this.request(mergeConfig(config || {}, { + method: method, + url: url, + data: (config || {}).data + })); + }; + }); + + utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) { + /*eslint func-names:0*/ + + function generateHTTPMethod(isForm) { + return function httpMethod(url, data, config) { + return this.request(mergeConfig(config || {}, { + method: method, + headers: isForm ? { + 'Content-Type': 'multipart/form-data' + } : {}, + url: url, + data: data + })); + }; + } + + Axios.prototype[method] = generateHTTPMethod(); + + Axios.prototype[method + 'Form'] = generateHTTPMethod(true); + }); + + var Axios_1 = Axios; + + /** + * A `CancelToken` is an object that can be used to request cancellation of an operation. + * + * @class + * @param {Function} executor The executor function. + */ + function CancelToken(executor) { + if (typeof executor !== 'function') { + throw new TypeError('executor must be a function.'); + } + + var resolvePromise; + + this.promise = new Promise(function promiseExecutor(resolve) { + resolvePromise = resolve; + }); + + var token = this; + + // eslint-disable-next-line func-names + this.promise.then(function(cancel) { + if (!token._listeners) return; + + var i; + var l = token._listeners.length; + + for (i = 0; i < l; i++) { + token._listeners[i](cancel); + } + token._listeners = null; + }); + + // eslint-disable-next-line func-names + this.promise.then = function(onfulfilled) { + var _resolve; + // eslint-disable-next-line func-names + var promise = new Promise(function(resolve) { + token.subscribe(resolve); + _resolve = resolve; + }).then(onfulfilled); + + promise.cancel = function reject() { + token.unsubscribe(_resolve); + }; + + return promise; + }; + + executor(function cancel(message) { + if (token.reason) { + // Cancellation has already been requested + return; + } + + token.reason = new CanceledError_1(message); + resolvePromise(token.reason); + }); + } + + /** + * Throws a `CanceledError` if cancellation has been requested. + */ + CancelToken.prototype.throwIfRequested = function throwIfRequested() { + if (this.reason) { + throw this.reason; + } + }; + + /** + * Subscribe to the cancel signal + */ + + CancelToken.prototype.subscribe = function subscribe(listener) { + if (this.reason) { + listener(this.reason); + return; + } + + if (this._listeners) { + this._listeners.push(listener); + } else { + this._listeners = [listener]; + } + }; + + /** + * Unsubscribe from the cancel signal + */ + + CancelToken.prototype.unsubscribe = function unsubscribe(listener) { + if (!this._listeners) { + return; + } + var index = this._listeners.indexOf(listener); + if (index !== -1) { + this._listeners.splice(index, 1); + } + }; + + /** + * Returns an object that contains a new `CancelToken` and a function that, when called, + * cancels the `CancelToken`. + */ + CancelToken.source = function source() { + var cancel; + var token = new CancelToken(function executor(c) { + cancel = c; + }); + return { + token: token, + cancel: cancel + }; + }; + + var CancelToken_1 = CancelToken; + + /** + * Syntactic sugar for invoking a function and expanding an array for arguments. + * + * Common use case would be to use `Function.prototype.apply`. + * + * ```js + * function f(x, y, z) {} + * var args = [1, 2, 3]; + * f.apply(null, args); + * ``` + * + * With `spread` this example can be re-written. + * + * ```js + * spread(function(x, y, z) {})([1, 2, 3]); + * ``` + * + * @param {Function} callback + * @returns {Function} + */ + var spread = function spread(callback) { + return function wrap(arr) { + return callback.apply(null, arr); + }; + }; + + /** + * Determines whether the payload is an error thrown by Axios + * + * @param {*} payload The value to test + * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false + */ + var isAxiosError = function isAxiosError(payload) { + return utils.isObject(payload) && (payload.isAxiosError === true); + }; + + /** + * Create an instance of Axios + * + * @param {Object} defaultConfig The default config for the instance + * @return {Axios} A new instance of Axios + */ + function createInstance(defaultConfig) { + var context = new Axios_1(defaultConfig); + var instance = bind(Axios_1.prototype.request, context); + + // Copy axios.prototype to instance + utils.extend(instance, Axios_1.prototype, context); + + // Copy context to instance + utils.extend(instance, context); + + // Factory for creating new instances + instance.create = function create(instanceConfig) { + return createInstance(mergeConfig(defaultConfig, instanceConfig)); + }; + + return instance; + } + + // Create the default instance to be exported + var axios$1 = createInstance(defaults_1); + + // Expose Axios class to allow class inheritance + axios$1.Axios = Axios_1; + + // Expose Cancel & CancelToken + axios$1.CanceledError = CanceledError_1; + axios$1.CancelToken = CancelToken_1; + axios$1.isCancel = isCancel; + axios$1.VERSION = data.version; + axios$1.toFormData = toFormData_1; + + // Expose AxiosError class + axios$1.AxiosError = AxiosError_1; + + // alias for CanceledError for backward compatibility + axios$1.Cancel = axios$1.CanceledError; + + // Expose all/spread + axios$1.all = function all(promises) { + return Promise.all(promises); + }; + axios$1.spread = spread; + + // Expose isAxiosError + axios$1.isAxiosError = isAxiosError; + + var axios_1 = axios$1; + + // Allow use of default import syntax in TypeScript + var _default = axios$1; + axios_1.default = _default; + + var axios = axios_1; + + /*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE + * @version v4.2.8+1e68dce6 + */ + + var es6Promise = createCommonjsModule(function (module, exports) { + (function (global, factory) { + module.exports = factory() ; + }(commonjsGlobal, (function () { + function objectOrFunction(x) { + var type = typeof x; + return x !== null && (type === 'object' || type === 'function'); + } + + function isFunction(x) { + return typeof x === 'function'; + } + + + + var _isArray = void 0; + if (Array.isArray) { + _isArray = Array.isArray; + } else { + _isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } + + var isArray = _isArray; + + var len = 0; + var vertxNext = void 0; + var customSchedulerFn = void 0; + + var asap = function asap(callback, arg) { + queue[len] = callback; + queue[len + 1] = arg; + len += 2; + if (len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + if (customSchedulerFn) { + customSchedulerFn(flush); + } else { + scheduleFlush(); + } + } + }; + + function setScheduler(scheduleFn) { + customSchedulerFn = scheduleFn; + } + + function setAsap(asapFn) { + asap = asapFn; + } + + var browserWindow = typeof window !== 'undefined' ? window : undefined; + var browserGlobal = browserWindow || {}; + var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; + var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; + + // node + function useNextTick() { + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // see https://github.com/cujojs/when/issues/410 for details + return function () { + return process.nextTick(flush); + }; + } + + // vertx + function useVertxTimer() { + if (typeof vertxNext !== 'undefined') { + return function () { + vertxNext(flush); + }; + } + + return useSetTimeout(); + } + + function useMutationObserver() { + var iterations = 0; + var observer = new BrowserMutationObserver(flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function () { + node.data = iterations = ++iterations % 2; + }; + } + + // web worker + function useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = flush; + return function () { + return channel.port2.postMessage(0); + }; + } + + function useSetTimeout() { + // Store setTimeout reference so es6-promise will be unaffected by + // other code modifying setTimeout (like sinon.useFakeTimers()) + var globalSetTimeout = setTimeout; + return function () { + return globalSetTimeout(flush, 1); + }; + } + + var queue = new Array(1000); + function flush() { + for (var i = 0; i < len; i += 2) { + var callback = queue[i]; + var arg = queue[i + 1]; + + callback(arg); + + queue[i] = undefined; + queue[i + 1] = undefined; + } + + len = 0; + } + + function attemptVertx() { + try { + var vertx = Function('return this')().require('vertx'); + vertxNext = vertx.runOnLoop || vertx.runOnContext; + return useVertxTimer(); + } catch (e) { + return useSetTimeout(); + } + } + + var scheduleFlush = void 0; + // Decide what async method to use to triggering processing of queued callbacks: + if (isNode) { + scheduleFlush = useNextTick(); + } else if (BrowserMutationObserver) { + scheduleFlush = useMutationObserver(); + } else if (isWorker) { + scheduleFlush = useMessageChannel(); + } else if (browserWindow === undefined && typeof commonjsRequire === 'function') { + scheduleFlush = attemptVertx(); + } else { + scheduleFlush = useSetTimeout(); + } + + function then(onFulfillment, onRejection) { + var parent = this; + + var child = new this.constructor(noop); + + if (child[PROMISE_ID] === undefined) { + makePromise(child); + } + + var _state = parent._state; + + + if (_state) { + var callback = arguments[_state - 1]; + asap(function () { + return invokeCallback(_state, child, callback, parent._result); + }); + } else { + subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + } + + /** + `Promise.resolve` returns a promise that will become resolved with the + passed `value`. It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + resolve(1); + }); + + promise.then(function(value){ + // value === 1 + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.resolve(1); + + promise.then(function(value){ + // value === 1 + }); + ``` + + @method resolve + @static + @param {Any} value value that the returned promise will be resolved with + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` + */ + function resolve$1(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(noop); + resolve(promise, object); + return promise; + } + + var PROMISE_ID = Math.random().toString(36).substring(2); + + function noop() {} + + var PENDING = void 0; + var FULFILLED = 1; + var REJECTED = 2; + + function selfFulfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { + try { + then$$1.call(value, fulfillmentHandler, rejectionHandler); + } catch (e) { + return e; + } + } + + function handleForeignThenable(promise, thenable, then$$1) { + asap(function (promise) { + var sealed = false; + var error = tryThen(then$$1, thenable, function (value) { + if (sealed) { + return; + } + sealed = true; + if (thenable !== value) { + resolve(promise, value); + } else { + fulfill(promise, value); + } + }, function (reason) { + if (sealed) { + return; + } + sealed = true; + + reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + reject(promise, error); + } + }, promise); + } + + function handleOwnThenable(promise, thenable) { + if (thenable._state === FULFILLED) { + fulfill(promise, thenable._result); + } else if (thenable._state === REJECTED) { + reject(promise, thenable._result); + } else { + subscribe(thenable, undefined, function (value) { + return resolve(promise, value); + }, function (reason) { + return reject(promise, reason); + }); + } + } + + function handleMaybeThenable(promise, maybeThenable, then$$1) { + if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { + handleOwnThenable(promise, maybeThenable); + } else { + if (then$$1 === undefined) { + fulfill(promise, maybeThenable); + } else if (isFunction(then$$1)) { + handleForeignThenable(promise, maybeThenable, then$$1); + } else { + fulfill(promise, maybeThenable); + } + } + } + + function resolve(promise, value) { + if (promise === value) { + reject(promise, selfFulfillment()); + } else if (objectOrFunction(value)) { + var then$$1 = void 0; + try { + then$$1 = value.then; + } catch (error) { + reject(promise, error); + return; + } + handleMaybeThenable(promise, value, then$$1); + } else { + fulfill(promise, value); + } + } + + function publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + publish(promise); + } + + function fulfill(promise, value) { + if (promise._state !== PENDING) { + return; + } + + promise._result = value; + promise._state = FULFILLED; + + if (promise._subscribers.length !== 0) { + asap(publish, promise); + } + } + + function reject(promise, reason) { + if (promise._state !== PENDING) { + return; + } + promise._state = REJECTED; + promise._result = reason; + + asap(publishRejection, promise); + } + + function subscribe(parent, child, onFulfillment, onRejection) { + var _subscribers = parent._subscribers; + var length = _subscribers.length; + + + parent._onerror = null; + + _subscribers[length] = child; + _subscribers[length + FULFILLED] = onFulfillment; + _subscribers[length + REJECTED] = onRejection; + + if (length === 0 && parent._state) { + asap(publish, parent); + } + } + + function publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { + return; + } + + var child = void 0, + callback = void 0, + detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function invokeCallback(settled, promise, callback, detail) { + var hasCallback = isFunction(callback), + value = void 0, + error = void 0, + succeeded = true; + + if (hasCallback) { + try { + value = callback(detail); + } catch (e) { + succeeded = false; + error = e; + } + + if (promise === value) { + reject(promise, cannotReturnOwn()); + return; + } + } else { + value = detail; + } + + if (promise._state !== PENDING) ; else if (hasCallback && succeeded) { + resolve(promise, value); + } else if (succeeded === false) { + reject(promise, error); + } else if (settled === FULFILLED) { + fulfill(promise, value); + } else if (settled === REJECTED) { + reject(promise, value); + } + } + + function initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value) { + resolve(promise, value); + }, function rejectPromise(reason) { + reject(promise, reason); + }); + } catch (e) { + reject(promise, e); + } + } + + var id = 0; + function nextId() { + return id++; + } + + function makePromise(promise) { + promise[PROMISE_ID] = id++; + promise._state = undefined; + promise._result = undefined; + promise._subscribers = []; + } + + function validationError() { + return new Error('Array Methods must be provided an Array'); + } + + var Enumerator = function () { + function Enumerator(Constructor, input) { + this._instanceConstructor = Constructor; + this.promise = new Constructor(noop); + + if (!this.promise[PROMISE_ID]) { + makePromise(this.promise); + } + + if (isArray(input)) { + this.length = input.length; + this._remaining = input.length; + + this._result = new Array(this.length); + + if (this.length === 0) { + fulfill(this.promise, this._result); + } else { + this.length = this.length || 0; + this._enumerate(input); + if (this._remaining === 0) { + fulfill(this.promise, this._result); + } + } + } else { + reject(this.promise, validationError()); + } + } + + Enumerator.prototype._enumerate = function _enumerate(input) { + for (var i = 0; this._state === PENDING && i < input.length; i++) { + this._eachEntry(input[i], i); + } + }; + + Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { + var c = this._instanceConstructor; + var resolve$$1 = c.resolve; + + + if (resolve$$1 === resolve$1) { + var _then = void 0; + var error = void 0; + var didError = false; + try { + _then = entry.then; + } catch (e) { + didError = true; + error = e; + } + + if (_then === then && entry._state !== PENDING) { + this._settledAt(entry._state, i, entry._result); + } else if (typeof _then !== 'function') { + this._remaining--; + this._result[i] = entry; + } else if (c === Promise$1) { + var promise = new c(noop); + if (didError) { + reject(promise, error); + } else { + handleMaybeThenable(promise, entry, _then); + } + this._willSettleAt(promise, i); + } else { + this._willSettleAt(new c(function (resolve$$1) { + return resolve$$1(entry); + }), i); + } + } else { + this._willSettleAt(resolve$$1(entry), i); + } + }; + + Enumerator.prototype._settledAt = function _settledAt(state, i, value) { + var promise = this.promise; + + + if (promise._state === PENDING) { + this._remaining--; + + if (state === REJECTED) { + reject(promise, value); + } else { + this._result[i] = value; + } + } + + if (this._remaining === 0) { + fulfill(promise, this._result); + } + }; + + Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { + var enumerator = this; + + subscribe(promise, undefined, function (value) { + return enumerator._settledAt(FULFILLED, i, value); + }, function (reason) { + return enumerator._settledAt(REJECTED, i, reason); + }); + }; + + return Enumerator; + }(); + + /** + `Promise.all` accepts an array of promises, and returns a new promise which + is fulfilled with an array of fulfillment values for the passed promises, or + rejected with the reason of the first passed promise to be rejected. It casts all + elements of the passed iterable to promises as it runs this algorithm. + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = resolve(2); + let promise3 = resolve(3); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // The array here would be [ 1, 2, 3 ]; + }); + ``` + + If any of the `promises` given to `all` are rejected, the first promise + that is rejected will be given as an argument to the returned promises's + rejection handler. For example: + + Example: + + ```javascript + let promise1 = resolve(1); + let promise2 = reject(new Error("2")); + let promise3 = reject(new Error("3")); + let promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // Code here never runs because there are rejected promises! + }, function(error) { + // error.message === "2" + }); + ``` + + @method all + @static + @param {Array} entries array of promises + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} promise that is fulfilled when all `promises` have been + fulfilled, or rejected if any of them become rejected. + @static + */ + function all(entries) { + return new Enumerator(this, entries).promise; + } + + /** + `Promise.race` returns a new promise which is settled in the same way as the + first passed promise to settle. + + Example: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 2'); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // result === 'promise 2' because it was resolved before promise1 + // was resolved. + }); + ``` + + `Promise.race` is deterministic in that only the state of the first + settled promise matters. For example, even if other promises given to the + `promises` array argument are resolved, but the first settled promise has + become rejected before the other promises became fulfilled, the returned + promise will become rejected: + + ```javascript + let promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + let promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + reject(new Error('promise 2')); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // Code here never runs + }, function(reason){ + // reason.message === 'promise 2' because promise 2 became rejected before + // promise 1 became fulfilled + }); + ``` + + An example real-world use case is implementing timeouts: + + ```javascript + Promise.race([ajax('foo.json'), timeout(5000)]) + ``` + + @method race + @static + @param {Array} promises array of promises to observe + Useful for tooling. + @return {Promise} a promise which settles in the same way as the first passed + promise to settle. + */ + function race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + if (!isArray(entries)) { + return new Constructor(function (_, reject) { + return reject(new TypeError('You must pass an array to race.')); + }); + } else { + return new Constructor(function (resolve, reject) { + var length = entries.length; + for (var i = 0; i < length; i++) { + Constructor.resolve(entries[i]).then(resolve, reject); + } + }); + } + } + + /** + `Promise.reject` returns a promise rejected with the passed `reason`. + It is shorthand for the following: + + ```javascript + let promise = new Promise(function(resolve, reject){ + reject(new Error('WHOOPS')); + }); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + let promise = Promise.reject(new Error('WHOOPS')); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + @method reject + @static + @param {Any} reason value that the returned promise will be rejected with. + Useful for tooling. + @return {Promise} a promise rejected with the given `reason`. + */ + function reject$1(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(noop); + reject(promise, reason); + return promise; + } + + function needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise's eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + let promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + let xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {Function} resolver + Useful for tooling. + @constructor + */ + + var Promise$1 = function () { + function Promise(resolver) { + this[PROMISE_ID] = nextId(); + this._result = this._state = undefined; + this._subscribers = []; + + if (noop !== resolver) { + typeof resolver !== 'function' && needsResolver(); + this instanceof Promise ? initializePromise(this, resolver) : needsNew(); + } + } + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + Chaining + -------- + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + Assimilation + ------------ + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + If the assimliated promise rejects, then the downstream promise will also reject. + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + Simple Example + -------------- + Synchronous Example + ```javascript + let result; + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + Promise Example; + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + Advanced Example + -------------- + Synchronous Example + ```javascript + let author, books; + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + Errback Example + ```js + function foundBooks(books) { + } + function failure(reason) { + } + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + Promise Example; + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + + + Promise.prototype.catch = function _catch(onRejection) { + return this.then(null, onRejection); + }; + + /** + `finally` will be invoked regardless of the promise's fate just as native + try/catch/finally behaves + + Synchronous example: + + ```js + findAuthor() { + if (Math.random() > 0.5) { + throw new Error(); + } + return new Author(); + } + + try { + return findAuthor(); // succeed or fail + } catch(error) { + return findOtherAuther(); + } finally { + // always runs + // doesn't affect the return value + } + ``` + + Asynchronous example: + + ```js + findAuthor().catch(function(reason){ + return findOtherAuther(); + }).finally(function(){ + // author was either found, or not + }); + ``` + + @method finally + @param {Function} callback + @return {Promise} + */ + + + Promise.prototype.finally = function _finally(callback) { + var promise = this; + var constructor = promise.constructor; + + if (isFunction(callback)) { + return promise.then(function (value) { + return constructor.resolve(callback()).then(function () { + return value; + }); + }, function (reason) { + return constructor.resolve(callback()).then(function () { + throw reason; + }); + }); + } + + return promise.then(callback, callback); + }; + + return Promise; + }(); + + Promise$1.prototype.then = then; + Promise$1.all = all; + Promise$1.race = race; + Promise$1.resolve = resolve$1; + Promise$1.reject = reject$1; + Promise$1._setScheduler = setScheduler; + Promise$1._setAsap = setAsap; + Promise$1._asap = asap; + + /*global self*/ + function polyfill() { + var local = void 0; + + if (typeof commonjsGlobal !== 'undefined') { + local = commonjsGlobal; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P) { + var promiseToString = null; + try { + promiseToString = Object.prototype.toString.call(P.resolve()); + } catch (e) { + // silently ignored + } + + if (promiseToString === '[object Promise]' && !P.cast) { + return; + } + } + + local.Promise = Promise$1; + } + + // Strange compat.. + Promise$1.polyfill = polyfill; + Promise$1.Promise = Promise$1; + + return Promise$1; + + }))); + + + + + }); + + class RTCEndpoint extends Event$1 { + constructor(options) { + super('RTCPusherPlayer'); + this.TAG = '[RTCPusherPlayer]'; + let defaults = { + element: '', + // html video element + debug: false, + // if output debug log + zlmsdpUrl: '', + simulcast: false, + useCamera: true, + audioEnable: true, + videoEnable: true, + recvOnly: false, + resolution: { + w: 0, + h: 0 + }, + usedatachannel: false, + videoId: '', + audioId: '' + }; + this.options = Object.assign({}, defaults, options); + if (this.options.debug) { + setLogger(); + } + this.e = { + onicecandidate: this._onIceCandidate.bind(this), + ontrack: this._onTrack.bind(this), + onicecandidateerror: this._onIceCandidateError.bind(this), + onconnectionstatechange: this._onconnectionstatechange.bind(this), + ondatachannelopen: this._onDataChannelOpen.bind(this), + ondatachannelmsg: this._onDataChannelMsg.bind(this), + ondatachannelerr: this._onDataChannelErr.bind(this), + ondatachannelclose: this._onDataChannelClose.bind(this) + }; + this._remoteStream = null; + this._localStream = null; + this._tracks = []; + this.pc = new RTCPeerConnection(null); + this.pc.onicecandidate = this.e.onicecandidate; + this.pc.onicecandidateerror = this.e.onicecandidateerror; + this.pc.ontrack = this.e.ontrack; + this.pc.onconnectionstatechange = this.e.onconnectionstatechange; + this.datachannel = null; + if (this.options.usedatachannel) { + this.datachannel = this.pc.createDataChannel('chat'); + this.datachannel.onclose = this.e.ondatachannelclose; + this.datachannel.onerror = this.e.ondatachannelerr; + this.datachannel.onmessage = this.e.ondatachannelmsg; + this.datachannel.onopen = this.e.ondatachannelopen; + } + if (!this.options.recvOnly && (this.options.audioEnable || this.options.videoEnable)) this.start();else this.receive(); + } + receive() { + + //debug.error(this.TAG,'this not implement'); + const AudioTransceiverInit = { + direction: 'recvonly', + sendEncodings: [] + }; + const VideoTransceiverInit = { + direction: 'recvonly', + sendEncodings: [] + }; + if (this.options.videoEnable) { + this.pc.addTransceiver('video', VideoTransceiverInit); + } + if (this.options.audioEnable) { + this.pc.addTransceiver('audio', AudioTransceiverInit); + } + this.pc.createOffer().then(desc => { + log(this.TAG, 'offer:', desc.sdp); + this.pc.setLocalDescription(desc).then(() => { + axios({ + method: 'post', + url: this.options.zlmsdpUrl, + responseType: 'json', + data: desc.sdp, + headers: { + 'Content-Type': 'text/plain;charset=utf-8' + } + }).then(response => { + let ret = response.data; //JSON.parse(response.data); + if (ret.code != 0) { + // mean failed for offer/anwser exchange + this.dispatch(Events$1.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED, ret); + return; + } + let anwser = {}; + anwser.sdp = ret.sdp; + anwser.type = 'answer'; + log(this.TAG, 'answer:', ret.sdp); + this.pc.setRemoteDescription(anwser).then(() => { + log(this.TAG, 'set remote sucess'); + }).catch(e => { + error(this.TAG, e); + }); + }); + }); + }).catch(e => { + error(this.TAG, e); + }); + } + start() { + let videoConstraints = false; + let audioConstraints = false; + if (this.options.useCamera) { + if (this.options.videoEnable) videoConstraints = new VideoTrackConstraints(VideoSourceInfo.CAMERA); + if (this.options.audioEnable) audioConstraints = new AudioTrackConstraints(AudioSourceInfo.MIC); + } else { + if (this.options.videoEnable) { + videoConstraints = new VideoTrackConstraints(VideoSourceInfo.SCREENCAST); + if (this.options.audioEnable) audioConstraints = new AudioTrackConstraints(AudioSourceInfo.SCREENCAST); + } else { + if (this.options.audioEnable) audioConstraints = new AudioTrackConstraints(AudioSourceInfo.MIC);else { + // error shared display media not only audio + error(this.TAG, 'error paramter'); + } + } + } + if (this.options.resolution.w != 0 && this.options.resolution.h != 0 && typeof videoConstraints == 'object') { + videoConstraints.resolution = new Resolution(this.options.resolution.w, this.options.resolution.h); + } + if (typeof videoConstraints == 'object' && this.options.videoId != '') { + videoConstraints.deviceId = this.options.videoId; + } + if (typeof audioConstraints == 'object' && this.options.audioId != '') { + audioConstraints.deviceId = this.options.audioId; + } + MediaStreamFactory.createMediaStream(new StreamConstraints(audioConstraints, videoConstraints)).then(stream => { + this._localStream = stream; + this.dispatch(Events$1.WEBRTC_ON_LOCAL_STREAM, stream); + const AudioTransceiverInit = { + direction: 'sendrecv', + sendEncodings: [] + }; + const VideoTransceiverInit = { + direction: 'sendrecv', + sendEncodings: [] + }; + if (this.options.simulcast && stream.getVideoTracks().length > 0) { + VideoTransceiverInit.sendEncodings = [{ + rid: 'h', + active: true, + maxBitrate: 1000000 + }, { + rid: 'm', + active: true, + maxBitrate: 500000, + scaleResolutionDownBy: 2 + }, { + rid: 'l', + active: true, + maxBitrate: 200000, + scaleResolutionDownBy: 4 + }]; + } + if (this.options.audioEnable) { + if (stream.getAudioTracks().length > 0) { + this.pc.addTransceiver(stream.getAudioTracks()[0], AudioTransceiverInit); + } else { + AudioTransceiverInit.direction = 'recvonly'; + this.pc.addTransceiver('audio', AudioTransceiverInit); + } + } + if (this.options.videoEnable) { + if (stream.getVideoTracks().length > 0) { + this.pc.addTransceiver(stream.getVideoTracks()[0], VideoTransceiverInit); + } else { + VideoTransceiverInit.direction = 'recvonly'; + this.pc.addTransceiver('video', VideoTransceiverInit); + } + } + + /* + stream.getTracks().forEach((track,idx)=>{ + debug.log(this.TAG,track); + this.pc.addTrack(track); + }); + */ + this.pc.createOffer().then(desc => { + log(this.TAG, 'offer:', desc.sdp); + this.pc.setLocalDescription(desc).then(() => { + axios({ + method: 'post', + url: this.options.zlmsdpUrl, + responseType: 'json', + data: desc.sdp, + headers: { + 'Content-Type': 'text/plain;charset=utf-8' + } + }).then(response => { + let ret = response.data; //JSON.parse(response.data); + if (ret.code != 0) { + // mean failed for offer/anwser exchange + this.dispatch(Events$1.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED, ret); + return; + } + let anwser = {}; + anwser.sdp = ret.sdp; + anwser.type = 'answer'; + log(this.TAG, 'answer:', ret.sdp); + this.pc.setRemoteDescription(anwser).then(() => { + log(this.TAG, 'set remote sucess'); + }).catch(e => { + error(this.TAG, e); + }); + }); + }); + }).catch(e => { + error(this.TAG, e); + }); + }).catch(e => { + this.dispatch(Events$1.CAPTURE_STREAM_FAILED); + //debug.error(this.TAG,e); + }); + + //const offerOptions = {}; + /* + if (typeof this.pc.addTransceiver === 'function') { + // |direction| seems not working on Safari. + this.pc.addTransceiver('audio', { direction: 'recvonly' }); + this.pc.addTransceiver('video', { direction: 'recvonly' }); + } else { + offerOptions.offerToReceiveAudio = true; + offerOptions.offerToReceiveVideo = true; + } + */ + } + _onIceCandidate(event) { + if (event.candidate) { + log(this.TAG, 'Remote ICE candidate: \n ' + event.candidate.candidate); + // Send the candidate to the remote peer + } + } + _onTrack(event) { + this._tracks.push(event.track); + if (this.options.element && event.streams && event.streams.length > 0) { + this.options.element.srcObject = event.streams[0]; + this._remoteStream = event.streams[0]; + this.dispatch(Events$1.WEBRTC_ON_REMOTE_STREAMS, event); + } else { + if (this.pc.getReceivers().length == this._tracks.length) { + log(this.TAG, 'play remote stream '); + this._remoteStream = new MediaStream(this._tracks); + this.options.element.srcObject = this._remoteStream; + } else { + error(this.TAG, 'wait stream track finish'); + } + } + } + _onIceCandidateError(event) { + this.dispatch(Events$1.WEBRTC_ICE_CANDIDATE_ERROR, event); + } + _onconnectionstatechange(event) { + this.dispatch(Events$1.WEBRTC_ON_CONNECTION_STATE_CHANGE, this.pc.connectionState); + } + _onDataChannelOpen(event) { + log(this.TAG, 'ondatachannel open:', event); + this.dispatch(Events$1.WEBRTC_ON_DATA_CHANNEL_OPEN, event); + } + _onDataChannelMsg(event) { + log(this.TAG, 'ondatachannel msg:', event); + this.dispatch(Events$1.WEBRTC_ON_DATA_CHANNEL_MSG, event); + } + _onDataChannelErr(event) { + log(this.TAG, 'ondatachannel err:', event); + this.dispatch(Events$1.WEBRTC_ON_DATA_CHANNEL_ERR, event); + } + _onDataChannelClose(event) { + log(this.TAG, 'ondatachannel close:', event); + this.dispatch(Events$1.WEBRTC_ON_DATA_CHANNEL_CLOSE, event); + } + sendMsg(data) { + if (this.datachannel != null) { + this.datachannel.send(data); + } else { + error(this.TAG, 'data channel is null'); + } + } + switchVideo(useCamera, deviceId) { + let videoConstraints = false; + if (useCamera) { + videoConstraints = new VideoTrackConstraints(VideoSourceInfo.CAMERA); + videoConstraints.deviceId = deviceId; + } else { + videoConstraints = new VideoTrackConstraints(VideoSourceInfo.SCREENCAST); + } + return MediaStreamFactory.createMediaStream(new StreamConstraints(false, videoConstraints)).then(stream => { + const videosender = this.pc.getSenders().find(e => e.track.kind === 'video'); + if (videosender != null && stream.getVideoTracks().length > 0) { + this._localStream.removeTrack(videosender.track); + this._localStream.addTrack(stream.getVideoTracks()[0]); + // stream change + this.dispatch(Events$1.WEBRTC_ON_LOCAL_STREAM, this._localStream); + return videosender.replaceTrack(stream.getVideoTracks()[0]); + } + return es6Promise.Promise.reject('video not exist or deviceid not vaild'); + }); + } + switcAudio(useMic, deviceId) { + let audioConstraints = false; + if (useMic) { + audioConstraints = new AudioTrackConstraints(AudioSourceInfo.MIC); + audioConstraints.deviceId = deviceId; + } else { + audioConstraints = new AudioTrackConstraints(AudioSourceInfo.SCREENCAST); + } + return MediaStreamFactory.createMediaStream(new StreamConstraints(audioConstraints, false)).then(stream => { + const audiosender = this.pc.getSenders().find(e => e.track.kind === 'audio'); + if (audiosender != null && stream.getAudioTracks().length > 0) { + this._localStream.removeTrack(audiosender.track); + this._localStream.addTrack(stream.getAudioTracks()[0]); + // stream change + this.dispatch(Events$1.WEBRTC_ON_LOCAL_STREAM, this._localStream); + return audiosender.replaceTrack(stream.getAudioTracks()[0]); + } + return es6Promise.Promise.reject('audio not exist or deviceid not vaild'); + }); + } + closeDataChannel() { + if (this.datachannel) { + this.datachannel.close(); + this.datachannel = null; + } + } + close() { + this.closeDataChannel(); + if (this.pc) { + this.pc.close(); + this.pc = null; + } + if (this.options) { + this.options = null; + } + if (this._localStream) { + this._localStream.getTracks().forEach((track, idx) => { + track.stop(); + }); + } + if (this._remoteStream) { + this._remoteStream.getTracks().forEach((track, idx) => { + track.stop(); + }); + } + this._tracks.forEach((track, idx) => { + track.stop(); + }); + this._tracks = []; + } + get remoteStream() { + return this._remoteStream; + } + get localStream() { + return this._localStream; + } + } + + const quickScan = [{ + 'label': '4K(UHD)', + 'width': 3840, + 'height': 2160 + }, { + 'label': '1080p(FHD)', + 'width': 1920, + 'height': 1080 + }, { + 'label': 'UXGA', + 'width': 1600, + 'height': 1200, + 'ratio': '4:3' + }, { + 'label': '720p(HD)', + 'width': 1280, + 'height': 720 + }, { + 'label': 'SVGA', + 'width': 800, + 'height': 600 + }, { + 'label': 'VGA', + 'width': 640, + 'height': 480 + }, { + 'label': '360p(nHD)', + 'width': 640, + 'height': 360 + }, { + 'label': 'CIF', + 'width': 352, + 'height': 288 + }, { + 'label': 'QVGA', + 'width': 320, + 'height': 240 + }, { + 'label': 'QCIF', + 'width': 176, + 'height': 144 + }, { + 'label': 'QQVGA', + 'width': 160, + 'height': 120 + }]; + function GetSupportCameraResolutions$1() { + return new Promise(function (resolve, reject) { + let resolutions = []; + let ok = 0; + let err = 0; + for (let i = 0; i < quickScan.length; ++i) { + let videoConstraints = new VideoTrackConstraints(VideoSourceInfo.CAMERA); + videoConstraints.resolution = new Resolution(quickScan[i].width, quickScan[i].height); + MediaStreamFactory.createMediaStream(new StreamConstraints(false, videoConstraints)).then(stream => { + stream.getVideoTracks().forEach(track => track.stop()); + resolutions.push(quickScan[i]); + ok++; + if (ok + err == quickScan.length) { + resolve(resolutions); + } + }).catch(e => { + err++; + if (ok + err == quickScan.length) { + resolve(resolutions); + } + }); + } + }); + } + function GetAllScanResolution$1() { + return quickScan; + } + function isSupportResolution$1(w, h) { + return new Promise(function (resolve, reject) { + let videoConstraints = new VideoTrackConstraints(VideoSourceInfo.CAMERA); + videoConstraints.resolution = new Resolution(w, h); + MediaStreamFactory.createMediaStream(new StreamConstraints(false, videoConstraints)).then(stream => { + stream.getVideoTracks().forEach(track => track.stop()); + resolve(); + }).catch(e => { + reject(e); + }); + }); + } + + function GetAllMediaDevice$1() { + return new Promise(function (resolve, reject) { + if (typeof navigator.mediaDevices != 'object' || typeof navigator.mediaDevices.enumerateDevices != 'function') { + reject('enumerateDevices() not supported.'); + } else { + // List cameras and microphones. + navigator.mediaDevices.enumerateDevices().then(devices => { + resolve(devices); + }).catch(err => { + reject(`${err.name}: ${err.message}`); + }); + } + }); + } + + console.log('build date:', BUILD_DATE); + console.log('version:', VERSION$1); + const Events = Events$1; + const Media = media; + const Endpoint = RTCEndpoint; + const GetSupportCameraResolutions = GetSupportCameraResolutions$1; + const GetAllScanResolution = GetAllScanResolution$1; + const isSupportResolution = isSupportResolution$1; + const GetAllMediaDevice = GetAllMediaDevice$1; + + exports.Endpoint = Endpoint; + exports.Events = Events; + exports.GetAllMediaDevice = GetAllMediaDevice; + exports.GetAllScanResolution = GetAllScanResolution; + exports.GetSupportCameraResolutions = GetSupportCameraResolutions; + exports.Media = Media; + exports.isSupportResolution = isSupportResolution; + + Object.defineProperty(exports, '__esModule', { value: true }); + + return exports; + +})({}); +//# sourceMappingURL=ZLMRTCClient.js.map diff --git a/pages_player/static/h5/js/jessibuca-pro.js b/pages_player/static/h5/js/jessibuca-pro.js new file mode 100644 index 0000000..a0b8ba6 --- /dev/null +++ b/pages_player/static/h5/js/jessibuca-pro.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("crypto")):"function"==typeof define&&define.amd?define(["crypto"],t):(e="undefined"!=typeof globalThis?globalThis:e||self)["jessibuca-pro"]=t(e.crypto$1)}(this,(function(t){"use strict";function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=s(t);const a=1,o=2,n=3,l=4,d=5,h=6,c=["","websocket","fetch","hls","webrtc","webTransport","aliyunRtc","ts"],u="fetch",p="hls",f="websocket",m="webrtc",g="webTransport",y="worker",A="aliyunRtc",b="player",v="playerAudio",_="playbackTF",S="mp4",w="webm",E="flv",T="flv",k="m7s",C="hls",x="webrtc",R="webTransport",D="nakedFlow",L="fmp4",P="mpeg4",B="aliyunRtc",I="ts",M={flv:"FLV",m7s:"M7S",hls:"HLS",fmp4:"FMP4",mpeg4:"MPEG4",webrtc:"Webrtc",webTransport:"WebTransport",nakedFlow:"裸流",aliyunRtc:"AliyunRtc",ts:"TS"},U="mse",F="wcs",O="offscreen",N="wasm",j="simd",z="mt",G="webrtc",H="hls",V="aliyunRtc",$="canvas",W="video",J="debug",q="warn",K="click",Y="mouseDownAndUp",Q={normal:"normal",simple:"simple"},X=36e5,Z="/crypto/",ee="jbprov",te=1e4,ie={url:"",playbackConfig:{},fullscreenWatermarkConfig:{},playType:b,playbackForwardMaxRateDecodeIFrame:4,playOptions:{},isLive:!0,isMulti:!0,isM7sCrypto:!1,supportHls265:!1,playFailedUseLastFrameShow:!0,playFailedAndPausedShowMessage:!1,pauseAndNextPlayUseLastFrameShow:!1,widthOrHeightChangeReplayDelayTime:0,isUseNewFullscreenWatermark:!1,websocket1006ErrorReplay:!1,websocket1006ErrorReplayDelayTime:1,streamErrorReplay:!1,streamErrorReplayDelayTime:1,streamEndReplay:!1,streamEndReplayDelayTime:1,networkDisconnectReplay:!1},se={playType:b,container:"",videoBuffer:1e3,videoBufferDelay:1e3,networkDelay:1e4,isResize:!0,isFullResize:!1,isFlv:!1,isHls:!1,isFmp4:!1,isFmp4Private:!1,isWebrtc:!1,isWebrtcForZLM:!1,isWebrtcForSRS:!1,isWebrtcForOthers:!1,isNakedFlow:!1,isMpeg4:!1,isAliyunRtc:!1,isTs:!1,debug:!1,debugLevel:q,debugUuid:"",isMulti:!0,multiIndex:-1,hotKey:!1,loadingTimeout:10,heartTimeout:10,timeout:10,pageVisibilityHiddenTimeout:300,loadingTimeoutReplay:!0,heartTimeoutReplay:!0,loadingTimeoutReplayTimes:3,heartTimeoutReplayTimes:3,heartTimeoutReplayUseLastFrameShow:!0,replayUseLastFrameShow:!0,replayShowLoadingIcon:!1,supportDblclickFullscreen:!1,showBandwidth:!1,showPerformance:!1,mseCorrectTimeDuration:20,mseCorrectAudioTimeDuration:20,keepScreenOn:!0,isNotMute:!1,muted:!0,hasAudio:!0,hasVideo:!0,operateBtns:{fullscreen:!1,screenshot:!1,play:!1,audio:!1,record:!1,ptz:!1,quality:!1,zoom:!1,close:!1,scale:!1,performance:!1,logSave:!1,aiFace:!1,aiObject:!1,aiOcclusion:!1,fullscreenFn:null,fullscreenExitFn:null,screenshotFn:null,playFn:null,pauseFn:null,recordFn:null,recordStopFn:null},extendOperateBtns:[],contextmenuBtns:[],watermarkConfig:{},controlAutoHide:!1,hasControl:!1,loadingIcon:!0,loadingIconStyle:{},loadingText:"",background:"",poster:"",backgroundLoadingShow:!0,loadingBackground:"",loadingBackgroundWidth:0,loadingBackgroundHeight:0,decoder:"decoder-pro.js",decoderAudio:"decoder-pro-audio.js",decoderHard:"decoder-pro-hard.js",decoderHardNotWasm:"decoder-pro-hard-not-wasm.js",wasmMp4RecorderDecoder:"jessibuca-pro-mp4-recorder-decoder.js",decoderWASM:"",isDecoderUseCDN:!1,url:"",rotate:0,mirrorRotate:"none",aspectRatio:"default",playbackConfig:{playList:[],fps:"",showControl:!0,controlType:Q.normal,duration:0,startTime:"",showRateBtn:!1,rateConfig:[],showPrecision:"",showPrecisionBtn:!0,isCacheBeforeDecodeForFpsRender:!1,uiUsePlaybackPause:!1,isPlaybackPauseClearCache:!0,isUseFpsRender:!1,isUseLocalCalculateTime:!1,localOneFrameTimestamp:40,supportWheel:!1,useWCS:!1,useMSE:!1},qualityConfig:[],defaultStreamQuality:"",scaleConfig:["拉伸","缩放","正常"],forceNoOffscreen:!0,hiddenAutoPause:!1,protocol:o,demuxType:T,useWasm:!1,useMSE:!1,useWCS:!1,useSIMD:!0,useMThreading:!1,wcsUseVideoRender:!0,wcsUseWebgl2Render:!0,wasmUseVideoRender:!0,mseUseCanvasRender:!1,hlsUseCanvasRender:!1,webrtcUseCanvasRender:!1,useOffscreen:!1,useWebGPU:!1,mseDecodeErrorReplay:!0,wcsDecodeErrorReplay:!0,wasmDecodeErrorReplay:!0,simdDecodeErrorReplay:!0,simdDecodeErrorReplayType:N,autoWasm:!0,decoderErrorAutoWasm:!0,hardDecodingNotSupportAutoWasm:!0,webglAlignmentErrorReplay:!0,webglContextLostErrorReplay:!0,openWebglAlignment:!1,syncAudioAndVideo:!1,syncAudioAndVideoDiff:500,playbackDelayTime:1e3,playbackFps:25,playbackForwardMaxRateDecodeIFrame:4,playbackCurrentTimeMove:!0,useVideoRender:!0,useCanvasRender:!1,networkDelayTimeoutReplay:!1,recordType:S,checkFirstIFrame:!0,nakedFlowFps:25,audioEngine:null,isShowRecordingUI:!0,isShowZoomingUI:!0,useFaceDetector:!1,useObjectDetector:!1,useImageDetector:!1,useOcclusionDetector:!1,ptzPositionConfig:{},ptzShowType:"vertical",ptzClickType:K,ptzStopEmitDelay:.3,ptzZoomShow:!1,ptzApertureShow:!1,ptzFocusShow:!1,ptzMoreArrowShow:!1,ptzCruiseShow:!1,ptzFogShow:!1,ptzWiperShow:!1,ptzSupportDraggable:!1,weiXinInAndroidAudioBufferSize:4800,isM7sCrypto:!1,m7sCryptoAudio:!1,isSm4Crypto:!1,isXorCrypto:!1,sm4CryptoKey:"",m7sCryptoKey:"",xorCryptoKey:"",cryptoKey:"",cryptoIV:"",cryptoKeyUrl:"",autoResize:!1,useWebFullScreen:!1,ptsMaxDiff:3600,aiFaceDetectLevel:2,aiFaceDetectWidth:240,aiFaceDetectShowRect:!0,aiFaceDetectInterval:1e3,aiFaceDetectRectConfig:{},aiObjectDetectLevel:2,aiObjectDetectWidth:240,aiObjectDetectShowRect:!0,aiObjectDetectInterval:1e3,aiObjectDetectRectConfig:{},aiOcclusionDetectInterval:1e3,aiImageDetectDrop:!1,aiImageDetectActive:!1,videoRenderSupportScale:!0,mediaSourceTsIsMaxDiffReplay:!0,controlHtml:"",isH265:!1,isWebrtcH265:!1,supportLockScreenPlayAudio:!0,supportHls265:!1,isEmitSEI:!1,pauseAndNextPlayUseLastFrameShow:!1,demuxUseWorker:!0,playFailedAndReplay:!0,showMessageConfig:{webglAlignmentError:"Webgl 渲染失败",webglContextLostError:"webgl 上下文丢失",mediaSourceH265NotSupport:"不支持硬解码H265",mediaSourceFull:"缓冲区已满",mediaSourceAppendBufferError:"初始化解码器失败",mseSourceBufferError:"解码失败",mseAddSourceBufferError:"初始化解码器失败",mediaSourceDecoderConfigurationError:"初始化解码器失败",mediaSourceTsIsMaxDiff:"流异常",mseWidthOrHeightChange:"流异常",mediaSourceAudioG711NotSupport:"硬解码不支持G711a/u音频格式",mediaSourceUseCanvasRenderPlayFailed:"MediaSource解码使用canvas渲染失败",webcodecsH265NotSupport:"不支持硬解码H265",webcodecsUnsupportedConfigurationError:"初始化解码器失败",webcodecsDecodeConfigureError:"初始化解码器失败",webcodecsDecodeError:"解码失败",wcsWidthOrHeightChange:"解码失败",wasmDecodeError:"解码失败",simdDecodeError:"解码失败",wasmWidthOrHeightChange:"流异常",wasmUseVideoRenderError:"video自动渲染失败",videoElementPlayingFailed:"video自动渲染失败",simdH264DecodeVideoWidthIsTooLarge:"不支持该分辨率的视频",networkDelayTimeout:"网络超时重播失败",fetchError:"请求失败",streamEnd:"请求结束",websocketError:"请求失败",webrtcError:"请求失败",hlsError:"请求失败",decoderWorkerInitError:"初始化worker失败",videoElementPlayingFailedForWebrtc:"video自动渲染失败",videoInfoError:"解析视频分辨率失败",webrtcStreamH265:"webrtc不支持H265",delayTimeout:"播放超时重播失败",loadingTimeout:"加载超时重播失败",loadingTimeoutRetryEnd:"加载超时重播失败",delayTimeoutRetryEnd:"播放超时重播失败"},videoElementPlayingFailedReplay:!0,mp4RecordUseWasm:!0,mseAutoCleanupSourceBuffer:!0,mseAutoCleanupMaxBackwardDuration:30,mseAutoCleanupMinBackwardDuration:10,widthOrHeightChangeReplay:!0,simdH264DecodeVideoWidthIsTooLargeReplay:!0,mediaSourceAudioG711NotSupportReplay:!0,mediaSourceAudioInitTimeoutReplay:!0,mediaSourceUseCanvasRenderPlayFailedReplay:!0,mediaSourceUseCanvasRenderPlayFailedReplayType:W,widthOrHeightChangeReplayDelayTime:0,ghostWatermarkConfig:{on:5,off:5,content:"",fontSize:12,color:"white",opacity:.15,speed:.2},dynamicWatermarkConfig:{content:"",speed:.2,fontSize:12,color:"white",opacity:.15},isDropSameTimestampGop:!1,mseDecodeAudio:!1,nakedFlowH265DemuxUseNew:!0,extendDomConfig:{html:"",showBeforePlay:!1,showAfterLoading:!0},disableContextmenu:!1,mseDecoderUseWorker:!1,openMemoryLog:!1,mainThreadFetchUseWorker:!0,playFailedAndPausedShowPlayBtn:!0,mseCorrectionTimestamp:!0,flvDemuxBufferSizeTooLargeReplay:!1,flvDemuxBufferSizeTooLargeEmitFailed:!1,flvDemuxBufferSizeMaxLarge:1048576,isCheckInView:!1,hiddenControl:!1},re="init",ae="initVideo",oe="render",ne="playAudio",le="initAudio",de="audioCode",he="audioNalu",ce="audioAACSequenceHeader",ue="videoCode",pe="videoCodec",fe="videoNalu",me="videoPayload",ge="audioPayload",ye="wasmError",Ae="workerFetch",be="iframeIntervalTs",ve="isDropping",_e="workerEnd",Se="playbackStreamVideoFps",we="wasmDecodeVideoNoResponseError",Ee="wasmWidthOrHeightChange",Te="simdDecodeError",ke="simdH264DecodeVideoWidthIsTooLarge",Ce="closeEnd",xe="tempStream",Re="videoSEI",De="flvScriptData",Le="aacSequenceHeader",Pe="videoSequenceHeader",Be="flvBufferData",Ie="checkFirstIFrame",Me="mseHandle",Ue="mseFirstRenderTime",Fe="mseError",Oe="Invalid NAL unit size",Ne=1,je=2,ze=8,Ge=9,He=18,Ve="init",$e="decode",We="audioDecode",Je="videoDecode",qe="close",Ke="updateConfig",Ye="clearBuffer",Qe="fetchStream",Xe="sendWsMessage",Ze="mseUpdateVideoTimestamp",et="fetch",tt="destroy",it="destroyEnd",st="buffer",rt="fetchError",at="fetchClose",ot="fetchSuccess",nt={fullscreen:"fullscreen$2",webFullscreen:"webFullscreen",decoderWorkerInit:"decoderWorkerInit",play:"play",playing:"playing",pause:"pause",mute:"mute",load:"load",loading:"loading",zooming:"zooming",videoInfo:"videoInfo",timeUpdate:"timeUpdate",audioInfo:"audioInfo",log:"log",error:"error",kBps:"kBps",timeout:"timeout",delayTimeout:"delayTimeout",delayTimeoutRetryEnd:"delayTimeoutRetryEnd",loadingTimeout:"loadingTimeout",loadingTimeoutRetryEnd:"loadingTimeoutRetryEnd",stats:"stats",performance:"performance",videoSmooth:"videoSmooth",faceDetectActive:"faceDetectActive",objectDetectActive:"objectDetectActive",occlusionDetectActive:"occlusionDetectActive",imageDetectActive:"imageDetectActive",record:"record",recording:"recording",recordingTimestamp:"recordingTimestamp",recordStart:"recordStart",recordEnd:"recordEnd",recordCreateError:"recordCreateError",recordBlob:"recordBlob",buffer:"buffer",videoFrame:"videoFrame",videoSEI:"videoSEI",start:"start",metadata:"metadata",resize:"resize",volumechange:"volumechange",volume:"volume",destroy:"destroy",beforeDestroy:"beforeDestroy",streamEnd:"streamEnd",streamRate:"streamRate",streamAbps:"streamAbps",streamVbps:"streamVbps",streamDts:"streamDts",streamSuccess:"streamSuccess",streamMessage:"streamMessage",streamError:"streamError",streamStats:"streamStats",mseSourceOpen:"mseSourceOpen",mseSourceClose:"mseSourceClose",mseSourceended:"mseSourceended",mseSourceStartStreaming:"mseSourceStartStreaming",mseSourceEndStreaming:"mseSourceEndStreaming",mseSourceBufferError:"mseSourceBufferError",mseAddSourceBufferError:"mseAddSourceBufferError",mseSourceBufferBusy:"mseSourceBufferBusy",mseSourceBufferFull:"mseSourceBufferFull",videoWaiting:"videoWaiting",videoTimeUpdate:"videoTimeUpdate",videoSyncAudio:"videoSyncAudio",playToRenderTimes:"playToRenderTimes",playbackTime:"playbackTime",playbackTimestamp:"playbackTimestamp",playbackTimeScroll:"playbackTimeScroll",playbackPrecision:"playbackPrecision",playbackShowPrecisionChange:"playbackShowPrecisionChange",playbackJustTime:"playbackJustTime",playbackStats:"playbackStats",playbackSeek:"playbackSeek",playbackPause:"playbackPause",playbackPauseOrResume:"playbackPauseOrResume",playbackRateChange:"playbackRateChange",playbackPreRateChange:"playbackPreRateChange",ptz:"ptz",streamQualityChange:"streamQualityChange",visibilityChange:"visibilityChange",netBuf:"netBuf",close:"close",networkDelayTimeout:"networkDelayTimeout",togglePerformancePanel:"togglePerformancePanel",viewResizeChange:"viewResizeChange",flvDemuxBufferSizeTooLarge:"flvDemuxBufferSizeTooLarge",talkGetUserMediaSuccess:"talkGetUserMediaSuccess",talkGetUserMediaFail:"talkGetUserMediaFail",talkGetUserMediaTimeout:"talkGetUserMediaTimeout",talkStreamStart:"talkStreamStart",talkStreamOpen:"talkStreamOpen",talkStreamClose:"talkStreamClose",talkStreamError:"talkStreamError",talkStreamInactive:"talkStreamInactive",webrtcDisconnect:"webrtcDisconnect",webrtcFailed:"webrtcFailed",webrtcClosed:"webrtcClosed",webrtcOnConnectionStateChange:"webrtcOnConnectionStateChange",webrtcOnIceConnectionStateChange:"webrtcOnIceConnectionStateChange",crashLog:"crashLog",focus:"focus",blur:"blur",inView:"inView",visibilityHiddenTimeout:"visibilityHiddenTimeout",websocketOpen:"websocketOpen",websocketClose:"websocketClose",websocketError:"websocketError",websocketMessage:"websocketMessage",aiObjectDetectorInfo:"aiObjectDetectorInfo",aiFaceDetectorInfo:"aiFaceDetectorInfo",aiOcclusionDetectResult:"aiOcclusionDetectResult",aiImageDetectResult:"aiImageDetectResult",playFailedAndPaused:"playFailedAndPaused",audioResumeState:"audioResumeState",webrtcStreamH265:"webrtcStreamH265",flvMetaData:"flvMetaData",talkFailedAndStop:"talkFailedAndStop",removeLoadingBgImage:"removeLoadingBgImage",memoryLog:"memoryLog",downloadMemoryLog:"downloadMemoryLog",pressureObserverCpu:"pressureObserverCpu",currentPts:"currentPts",online:"online",offline:"offline",networkState:"networkState"},lt={load:nt.load,timeUpdate:nt.timeUpdate,videoInfo:nt.videoInfo,audioInfo:nt.audioInfo,error:nt.error,kBps:nt.kBps,start:nt.start,timeout:nt.timeout,loadingTimeout:nt.loadingTimeout,loadingTimeoutRetryEnd:nt.loadingTimeoutRetryEnd,delayTimeout:nt.delayTimeout,delayTimeoutRetryEnd:nt.delayTimeoutRetryEnd,fullscreen:"fullscreen",webFullscreen:nt.webFullscreen,play:nt.play,pause:nt.pause,mute:nt.mute,stats:nt.stats,performance:nt.performance,recordingTimestamp:nt.recordingTimestamp,recordStart:nt.recordStart,recordCreateError:nt.recordCreateError,recordEnd:nt.recordEnd,recordBlob:nt.recordBlob,playToRenderTimes:nt.playToRenderTimes,playbackSeek:nt.playbackSeek,playbackStats:nt.playbackStats,playbackTimestamp:nt.playbackTimestamp,playbackPauseOrResume:nt.playbackPauseOrResume,playbackPreRateChange:nt.playbackPreRateChange,playbackRateChange:nt.playbackRateChange,playbackShowPrecisionChange:nt.playbackShowPrecisionChange,ptz:nt.ptz,streamQualityChange:nt.streamQualityChange,zooming:nt.zooming,crashLog:nt.crashLog,focus:nt.focus,blur:nt.blur,visibilityHiddenTimeout:nt.visibilityHiddenTimeout,visibilityChange:nt.visibilityChange,websocketOpen:nt.websocketOpen,websocketClose:nt.websocketClose,networkDelayTimeout:nt.networkDelayTimeout,aiObjectDetectorInfo:nt.aiObjectDetectorInfo,aiFaceDetectorInfo:nt.aiFaceDetectorInfo,aiOcclusionDetectResult:nt.aiOcclusionDetectResult,aiImageDetectResult:nt.aiImageDetectResult,playFailedAndPaused:nt.playFailedAndPaused,streamEnd:nt.streamEnd,audioResumeState:nt.audioResumeState,videoSEI:nt.videoSEI,flvMetaData:nt.flvMetaData,webrtcOnConnectionStateChange:nt.webrtcOnConnectionStateChange,webrtcOnIceConnectionStateChange:nt.webrtcOnIceConnectionStateChange,currentPts:nt.currentPts,videoSmooth:nt.videoSmooth,networkState:nt.networkState,volume:nt.volume},dt={talkStreamClose:nt.talkStreamClose,talkStreamError:nt.talkStreamError,talkStreamInactive:nt.talkStreamInactive,talkGetUserMediaTimeout:nt.talkGetUserMediaTimeout,talkFailedAndStop:nt.talkFailedAndStop},ht={talkStreamError:nt.talkStreamError,talkStreamClose:nt.talkStreamClose},ct={playError:"playIsNotPauseOrUrlIsNull",fetchError:"fetchError",websocketError:"websocketError",webcodecsH265NotSupport:"webcodecsH265NotSupport",webcodecsDecodeError:"webcodecsDecodeError",webcodecsUnsupportedConfigurationError:"webcodecsUnsupportedConfigurationError",webcodecsDecodeConfigureError:"webcodecsDecodeConfigureError",mediaSourceH265NotSupport:"mediaSourceH265NotSupport",mediaSourceAudioG711NotSupport:"mediaSourceAudioG711NotSupport",mediaSourceAudioInitTimeout:"mediaSourceAudioInitTimeout",mediaSourceAudioNoDataTimeout:"mediaSourceAudioNoDataTimeout",mediaSourceDecoderConfigurationError:"mediaSourceDecoderConfigurationError",mediaSourceFull:nt.mseSourceBufferFull,mseSourceBufferError:nt.mseSourceBufferError,mseAddSourceBufferError:nt.mseAddSourceBufferError,mediaSourceAppendBufferError:"mediaSourceAppendBufferError",mediaSourceTsIsMaxDiff:"mediaSourceTsIsMaxDiff",mediaSourceUseCanvasRenderPlayFailed:"mediaSourceUseCanvasRenderPlayFailed",mediaSourceBufferedIsZeroError:"mediaSourceBufferedIsZeroError",wasmDecodeError:"wasmDecodeError",wasmUseVideoRenderError:"wasmUseVideoRenderError",hlsError:"hlsError",webrtcError:"webrtcError",webrtcClosed:nt.webrtcClosed,webrtcIceCandidateError:"webrtcIceCandidateError",webglAlignmentError:"webglAlignmentError",wasmWidthOrHeightChange:"wasmWidthOrHeightChange",mseWidthOrHeightChange:"mseWidthOrHeightChange",wcsWidthOrHeightChange:"wcsWidthOrHeightChange",widthOrHeightChange:"widthOrHeightChange",tallWebsocketClosedByError:"tallWebsocketClosedByError",flvDemuxBufferSizeTooLarge:nt.flvDemuxBufferSizeTooLarge,wasmDecodeVideoNoResponseError:"wasmDecodeVideoNoResponseError",audioChannelError:"audioChannelError",simdH264DecodeVideoWidthIsTooLarge:"simdH264DecodeVideoWidthIsTooLarge",simdDecodeError:"simdDecodeError",webglContextLostError:"webglContextLostError",videoElementPlayingFailed:"videoElementPlayingFailed",videoElementPlayingFailedForWebrtc:"videoElementPlayingFailedForWebrtc",decoderWorkerInitError:"decoderWorkerInitError",videoInfoError:"videoInfoError",videoCodecIdError:"videoCodecIdError",streamEnd:nt.streamEnd,websocket1006Error:"websocket1006Error",delayTimeout:nt.delayTimeout,loadingTimeout:nt.loadingTimeout,networkDelayTimeout:nt.networkDelayTimeout,aliyunRtcError:"aliyunRtcError",...ht},ut="notConnect",pt="open",ft="close",mt="error",gt={download:"download",base64:"base64",blob:"blob"},yt="download",At="blob",bt={7:"H264(AVC)",12:"H265(HEVC)",99:"MPEG4"},vt=7,_t=12,St="H264(AVC)",wt="H265(HEVC)",Et=10,Tt=2,kt={AAC:"AAC",ALAW:"ALAW(g711a)",MULAW:"MULAW(g711u)",MP3:"MP3"},Ct={10:"AAC",7:"ALAW",8:"MULAW",2:"MP3"},xt=7,Rt=8,Dt=5,Lt=1,Pt=5,Bt=6,It=7,Mt=8,Ut=14,Ft=19,Ot=20,Nt=21,jt=32,zt=32,Gt=33,Ht=33,Vt=34,$t=34,Wt=39,Jt=39,qt=40,Kt=38,Yt=48,Qt=0,Xt=1,Zt=2,ei="webcodecs",ti="webgl",ii="webgl2",si="webgpu",ri="offscreen",ai="mse",oi="hls",ni="webrtc",li="key",di="delta",hi='video/mp4; codecs="avc1.64002A"',ci='video/mp4; codecs="hev1.1.6.L123.b0"',ui='video/mp4;codecs="hev1.1.6.L120.90"',pi='video/mp4;codecs="hev1.2.4.L120.90"',fi='video/mp4;codecs="hev1.3.E.L120.90"',mi='video/mp4;codecs="hev1.4.10.L120.90"',gi="ended",yi="open",Ai="closed",bi=27,vi=38,_i=40,Si="oneHour",wi="halfHour",Ei="tenMin",Ti="fiveMin",ki={oneHour:"one-hour",halfHour:"half-hour",tenMin:"ten-min",fiveMin:"five-min"},Ci=["oneHour","halfHour","tenMin","fiveMin"],xi=["up","right","down","left","left-up","right-up","left-down","right-down"],Ri="stop",Di="fiStop",Li="zoomExpand",Pi="zoomNarrow",Bi="apertureFar",Ii="apertureNear",Mi="focusFar",Ui="focusNear",Fi="cruiseStart",Oi="cruiseStop",Ni="fogOpen",ji="fogClose",zi="wiperOpen",Gi="wiperClose",Hi="g711a",Vi="g711u",$i="pcm",Wi="opus",Ji={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"},qi="sourceclose",Ki="sourceopen",Yi="sourceended",Qi="startstreaming",Xi="endstreaming",Zi="qualitychange",es="canplay",ts="waiting",is="timeupdate",ss="ratechange",rs="avc",as="hevc",os="A key frame is required after configure() or flush()",ns="Cannot call 'decode' on a closed codec",ls="Unsupported configuration",ds="Decoder failure",hs="Decoding error",cs="Decoder error",us="HEVC decoding is not supported",ps="The user aborted a request",fs="AbortError",ms="AbortError",gs="loading",ys="playing",As="paused",bs="destroy",vs=0,_s=1,Ss=8,ws=0,Es=98,Ts="empty",ks="rtp",Cs="tcp",xs="open",Rs="close",Ds="error",Ls="message",Ps="worklet",Bs="script",Is={encType:Hi,packetType:ks,packetTcpSendType:Cs,rtpSsrc:"0000000000",numberChannels:1,sampleRate:8e3,sampleBitsWidth:16,sendInterval:20,debug:!1,debugLevel:q,testMicrophone:!1,saveToTempFile:!1,audioBufferLength:160,engine:Ps,checkGetUserMediaTimeout:!1,getUserMediaTimeout:1e4,audioConstraints:{latency:!0,noiseSuppression:!0,autoGainControl:!0,echoCancellation:!0,sampleRate:48e3,channelCount:1}},Ms="worklet",Us="script",Fs="active",Os={name:"",index:0,icon:"",iconHover:"",iconTitle:"",activeIcon:"",activeIconHover:"",activeIconTitle:"",click:null,activeClick:null},Ns={content:"",click:null,index:0},js=1,zs="subtitle-segments",Gs="hls-manifest-loaded",Hs="hls-level-loaded",Vs="demuxed-track",$s="flv-script-data",Ws="metadata-parsed",Js="ttfb",qs="load-retry",Ks="load-start",Ys="speed",Qs="load-complete",Xs="load-response-headers",Zs="sei",er="sei-in-time",tr="switch-url-failed",ir="switch-url-success",sr="subtitle-playlist",rr="stream-parsed",ar="error",or=[0,160,240,320,480,640],nr=[0,160,240,320,480,640],lr=["轻松","正常","较高","高"],dr="idle",hr="buffering",cr="complete",ur={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"},pr="video decoder initialization failed",fr="audio packet",mr=1,gr=2,yr=0,Ar=1,br=3,vr=16,_r="candidate-pair",Sr="inbound-rtp",wr="local-candidate",Er="remote-candidate",Tr="track",kr=9e4,Cr=45e4,xr=9e4,Rr="ws1006",Dr="mseDecodeError",Lr="wcsDecodeError";class Pr{constructor(e){this.log=function(t){if(e._opt.debug&&e._opt.debugLevel==J){const a=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var i=arguments.length,s=new Array(i>1?i-1:0),r=1;r1?i-1:0),r=1;r1?s-1:0),a=1;a32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let i=e-this._current_word_bits_left;this._fillCurrentWord();let s=Math.min(i,this._current_word_bits_left),r=this._current_word>>>32-s;return this._current_word<<=s,this._current_word_bits_left-=s,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Fr=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Or=Fr,Nr=Fr;function jr(e){let{profile:t,sampleRate:i,channel:s}=e;return new Uint8Array([175,0,t<<3|(14&i)>>1,(1&i)<<7|s<<3])}function zr(e){return Gr(e)&&e[1]===vs}function Gr(e){return e[0]>>4===Et}function Hr(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}function Vr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return 1024*t/e}const $r=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];class Wr{constructor(e){this.buffer=e,this.buflen=e.length,this.bufpos=0,this.bufoff=0,this.iserro=!1}read(e){let t=0,i=0;for(;e;){if(e<0||this.bufpos>=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=this.bufoff+e>8?8-this.bufoff:e,t<<=i,t+=this.buffer[this.bufpos]>>8-this.bufoff-i&255>>8-i,this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,i=this.bufoff,s=this.read(e);return this.bufpos=t,this.bufoff=i,s}read_golomb(){let e;for(e=0;0==this.read(1)&&!this.iserro;e++);return(1<=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(4095===(i[t+0]<<8|i[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let i=this.current_syncword_offset_,s=(8&e[i+1])>>>3,r=(6&e[i+1])>>>1,a=1&e[i+1],o=(192&e[i+2])>>>6,n=(60&e[i+2])>>>2,l=(1&e[i+2])<<2|(192&e[i+3])>>>6,d=(3&e[i+3])<<11|e[i+4]<<3|(224&e[i+5])>>>5;if(e[i+6],i+d>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let h=1===a?7:9,c=d-h;i+=h;let u=this.findNextSyncwordOffset(i+c);if(this.current_syncword_offset_=u,0!==s&&1!==s||0!==r)continue;let p=e.subarray(i,i+c);t={},t.audio_object_type=o+1,t.sampling_freq_index=n,t.sampling_frequency=Or[n],t.channel_config=l,t.data=p}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Xr{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,i=this.data_;for(;;){if(t+1>=i.byteLength)return this.eof_flag_=!0,i.byteLength;if(695===(i[t+0]<<3|i[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),i=0;for(let s=0;s<=t;s++)i<<=8,i|=e.readByte();return i}readNextAACFrame(e){let t=this.data_,i=null;for(;null==i&&!this.eof_flag_;){let s=this.current_syncword_offset_,r=(31&t[s+1])<<8|t[s+2];if(s+3+r>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let a=new Ur(t.subarray(s+3,s+3+r)),o=null;if(a.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(s+3+r),a.destroy();continue}o=e}else{let e=a.readBool();if(e&&a.readBool()){console.error("audioMuxVersionA is Not Supported"),a.destroy();break}if(e&&this.getLATMValue(a),!a.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),a.destroy();break}if(0!==a.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),a.destroy();break}if(0!==a.readBits(4)){console.error("more than 2 numProgram Not Supported"),a.destroy();break}if(0!==a.readBits(3)){console.error("more than 2 numLayer Not Supported"),a.destroy();break}let t=e?this.getLATMValue(a):0,i=a.readBits(5);t-=5;let s=a.readBits(4);t-=4;let r=a.readBits(4);t-=4,a.readBits(3),t-=3,t>0&&a.readBits(t);let n=a.readBits(3);if(0!==n){console.error(`frameLengthType = ${n}. Only frameLengthType = 0 Supported`),a.destroy();break}a.readByte();let l=a.readBool();if(l)if(e)this.getLATMValue(a);else{let e=0;for(;;){e<<=8;let t=a.readBool();if(e+=a.readByte(),!t)break}console.log(e)}a.readBool()&&a.readByte(),o={},o.audio_object_type=i,o.sampling_freq_index=s,o.sampling_frequency=Or[o.sampling_freq_index],o.channel_config=r,o.other_data_present=l}let n=0;for(;;){let e=a.readByte();if(n+=e,255!==e)break}let l=new Uint8Array(n);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function ea(e){const t=e.byteLength,i=new Uint8Array(4);i[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t;const s=new Uint8Array(t+4);return s.set(i,0),s.set(e,4),s}function ta(){}function ia(e){let t=null;const i=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let s=0;for(;!t&&s0&&void 0!==arguments[0]?arguments[0]:"";const t=e.split(","),i=atob(t[1]),s=t[0].replace("data:","").replace(";base64","");let r=i.length,a=new Uint8Array(r);for(;r--;)a[r]=i.charCodeAt(r);return new File([a],"file",{type:s})}function aa(){return(new Date).getTime()}function oa(e,t,i){return Math.max(Math.min(e,Math.max(t,i)),Math.min(t,i))}function na(e,t,i){if(e)return"object"==typeof t&&Object.keys(t).forEach((i=>{na(e,i,t[i])})),e.style[t]=i,e}function la(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!e)return 0;const s=getComputedStyle(e,null).getPropertyValue(t);return i?parseFloat(s):s}function da(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function ha(e){let t=0,i=da();return s=>{if(!Ta(s))return;t+=s;const r=da(),a=r-i;a>=1e3&&(e(t/a*1e3),i=r,t=0)}}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();const ca='"4-1-2024"';function ua(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function pa(){return!(ua()||/ipad|android(?!.*mobile)|tablet|kindle|silk/i.test(window.navigator.userAgent.toLowerCase()))}function fa(){const e=window.navigator.userAgent.toLowerCase();return/android/i.test(e)}function ma(){const e=window.navigator.userAgent.toLowerCase();return/firefox/i.test(e)}function ga(){const e=window.navigator.userAgent.toLowerCase()||"",t={type:"",version:""},i={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:e.indexOf("chrome")>-1&&e.indexOf("safari")>-1,Firefox:e.indexOf("firefox")>-1,Opera:e.indexOf("opera")>-1,Safari:e.indexOf("safari")>-1&&-1==e.indexOf("chrome"),Edge:e.indexOf("edge")>-1,QQBrowser:/qqbrowser/.test(e),WeixinBrowser:/MicroMessenger/i.test(e)};for(let s in i)if(i[s]){let i="";if("IE"===s){const t=e.match(/(msie\s|trident.*rv:)([\w.]+)/);t&&t.length>2&&(i=e.match(/(msie\s|trident.*rv:)([\w.]+)/)[2])}else if("Chrome"===s){for(let e in navigator.mimeTypes)"application/360softmgrplugin"===navigator.mimeTypes[e].type&&(s="360");const t=e.match(/chrome\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Firefox"===s){const t=e.match(/firefox\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Opera"===s){const t=e.match(/opera\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Safari"===s){const t=e.match(/version\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("Edge"===s){const t=e.match(/edge\/([\d.]+)/);t&&t.length>1&&(i=t[1])}else if("QQBrowser"===s){const t=e.match(/qqbrowser\/([\d.]+)/);t&&t.length>1&&(i=t[1])}t.type=s,t.version=parseInt(i)}return t}function ya(){const e=window.navigator.userAgent.toLowerCase();return e&&/iphone|ipad|ipod|ios/.test(e)}function Aa(){const e=window.navigator.userAgent;return!e.match(/Chrome/gi)&&!!e.match(/Safari/gi)}function ba(e,t){if(0===arguments.length)return null;var i,s=t||"{y}-{m}-{d} {h}:{i}:{s}";"object"==typeof e?i=e:(10===(""+e).length&&(e=1e3*parseInt(e)),e=+e,i=new Date(e));var r={y:i.getFullYear(),m:i.getMonth()+1,d:i.getDate(),h:i.getHours(),i:i.getMinutes(),s:i.getSeconds(),a:i.getDay()},a=s.replace(/{(y|m|d|h|i|s|a)+}/g,((e,t)=>{var i=r[t];return"a"===t?["一","二","三","四","五","六","日"][i-1]:(e.length>0&&i<10&&(i="0"+i),i||0)}));return a}function va(){return"VideoFrame"in window}function _a(e){if("string"!=typeof e)return e;var t=Number(e);return isNaN(t)?e:t}function Sa(){return"xxxxxxxxxxxx4xxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}function wa(e,t){let i,s,r=!1;return function a(){for(var o=arguments.length,n=new Array(o),l=0;l{r=!1,i&&(a.apply(s,i),i=null,s=null)}),t)}}function Ea(e){if(null==e||""==e)return"0 Bytes";const t=new Array("Bytes","KB","MB","GB","TB","PB","EB","ZB","YB");let i=0;const s=parseFloat(e);i=Math.floor(Math.log(s)/Math.log(1024));var r=s/Math.pow(1024,i);return(r=r.toFixed(2))+t[i]}function Ta(e){return"[object Number]"===Object.prototype.toString.call(e)}function ka(){let e=!1;return"MediaSource"in self&&(self.MediaSource.isTypeSupported(ci)||self.MediaSource.isTypeSupported(ui)||self.MediaSource.isTypeSupported(pi)||self.MediaSource.isTypeSupported(fi)||self.MediaSource.isTypeSupported(mi))&&(e=!0),e}function Ca(){const e=ga();return"chrome"===e.type.toLowerCase()&&e.version>=107}function xa(){let e=!1;return"MediaStreamTrackGenerator"in window&&(e=!0),e}function Ra(){let e=!1;return"MediaStream"in window&&(e=!0),e}function Da(e,t){let i=window.URL.createObjectURL(t),s=window.document.createElement("a");s.download=e,s.href=i;let r=window.document.createEvent("MouseEvents");r.initEvent("click",!0,!0),s.dispatchEvent(r),setTimeout((()=>{window.URL.revokeObjectURL(i)}),ya()?1e3:0)}function La(e){return null==e}function Pa(e){return!0===e||!1===e}function Ba(e){return!La(e)}function Ia(e){let t={left:"",right:"",top:"",bottom:"",opacity:1,backgroundColor:"",image:{src:"",width:"100",height:"60"},text:{content:"",fontSize:"14",color:"#000",width:"",height:""},rect:{color:"green",lineWidth:2,width:"",height:"",fill:"",fillOpacity:.2},line:{x1:"",y1:"",x2:"",y2:"",color:"green",lineWidth:2},polygon:{color:"green",lineWidth:2,list:[],fill:"",fillOpacity:.2},html:""};const i=Object.assign(t.image,e.image||{}),s=Object.assign(t.text,e.text||{}),r=Object.assign(t.rect,e.rect||{}),a=Object.assign(t.line,e.line||{});return t=Object.assign(t,e,{image:i,text:s,rect:r,line:a}),t}function Ma(e,t){let i={container:e||"",text:"",opacity:"",angle:"",color:"",fontSize:"",fontFamily:""};return i=Object.assign(i,t),{watermark_parent_node:i.container,watermark_alpha:i.opacity,watermark_angle:i.angle,watermark_fontsize:i.fontSize,watermark_color:i.color,watermark_font:i.fontFamily,watermark_txt:i.text}}function Ua(e,t){return new Promise(((i,s)=>{let r=Ia(t);if(!r.image.src&&!r.text.content)return i(e);let a=document.createElement("canvas");a.width=t.width,a.height=t.height;let o=a.getContext("2d"),n=0,l=0;Ta(r.left)?n=r.left:Ta(r.right)&&(n=a.width-r.right),Ta(r.top)?l=r.top:Ta(r.bottom)&&(l=a.height-r.bottom);const d=new Image;d.src=e,d.onload=()=>{if(o.drawImage(d,0,0),r.image&&r.image.src){const e=new Image;e.src=r.image.src,e.setAttribute("crossOrigin","Anonymous"),e.onload=()=>{n-=r.image.width,o.drawImage(e,n,l,r.image.width,r.image.height),i(a.toDataURL(t.format,t.quality))},e.onerror=e=>{s()}}else r.text&&r.text.content&&(o.font=r.text.fontSize+"px 宋体",o.fillStyle=r.text.color,o.textAlign="right",o.fillText(r.text.content,n,l),i(a.toDataURL(t.format,t.quality)))},d.onerror=e=>{s(e)}}))}function Fa(e){var t;if(e>-1){var i=Math.floor(e/3600),s=Math.floor(e/60)%60,r=e%60;t=i<10?"0"+i+":":i+":",s<10&&(t+="0"),t+=s+":",(r=Math.round(r))<10&&(t+="0"),t+=r.toFixed(0)}return t}function Oa(e,t){let i="";if(e>-1){const s=Math.floor(e/60)%60;let r=e%60;r=Math.round(r),i=s<10?"0"+s+":":s+":",r<10&&(i+="0"),i+=r,La(t)||(t<10&&(t="0"+t),i+=":"+t)}return i}function Na(e){let t="";if(e>-1){const i=Math.floor(e/60/60)%60;let s=Math.floor(e/60)%60,r=e%60;s=Math.round(s),t=i<10?"0"+i+":":i+":",s<10&&(t+="0"),t+=s+":",r<10&&(t+="0"),t+=r}return t}function ja(e,t){const i=Math.floor(t/60)%60,s=Math.floor(t%60);return new Date(e).setHours(i,s,0,0)}function za(e,t){const i=Math.floor(t/60/60)%60,s=Math.floor(t/60)%60,r=t%60;return new Date(e).setHours(i,s,r,0)}function Ga(e){return(""+e).length}function Ha(e){return e&&0===Object.keys(e).length}function Va(e){return!Ha(e)}function $a(e){return"string"==typeof e}const Wa=()=>{const e=window.navigator.userAgent;return/MicroMessenger/i.test(e)},Ja=()=>{const e=window.navigator.userAgent;return/Chrome/i.test(e)};function qa(e){const t=e||window.event;return t.target||t.srcElement}function Ka(){return ma()&&function(){const e=navigator.userAgent.toLowerCase();return/macintosh|mac os x/i.test(e)}()}function Ya(e){return"function"==typeof e}function Qa(e){if(ua()){let t=0,i=0;if(1===e.touches.length){let s=e.touches[0];t=s.clientX,i=s.clientY}return{posX:t,posY:i}}let t=0,i=0;const s=e||window.event;return s.pageX||s.pageY?(t=s.pageX,i=s.pageY):(s.clientX||s.clientY)&&(t=e.clientX+document.documentElement.scrollLeft+document.body.scrollLeft,i=e.clientY+document.documentElement.scrollTop+document.body.scrollTop),{posX:t,posY:i}}function Xa(){let e=document.createElement("video"),t=e.canPlayType("application/vnd.apple.mpegurl");return e=null,t}function Za(e){let t=po(e.hasAudio)&&(e.useMSE||e.useWCS&&!e.useOffscreen)&&po(e.demuxUseWorker);return!!(po(t)&&e.useMSE&&e.mseDecodeAudio&&po(e.demuxUseWorker))||t}function eo(e){const t=e.toString().trim().match(/^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/)[1];const i=new Blob([t],{type:"application/javascript"});return URL.createObjectURL(i)}function to(e){e.close()}function io(){return"https:"===window.location.protocol||"localhost"===window.location.hostname}function so(e){const t=Object.prototype.toString;return function(e){switch(t.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:try{return e instanceof Error}catch(e){return!1}}}(e)?e.message:null==e?"":"object"==typeof e?JSON.stringify(e,null,2):String(e)}function ro(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let i=e[0],s=null,r=1;if(e.length>0){let t=e[1];t&&t.ts-i.ts>1e5&&(i=t,r=2)}if(i)for(let a=r;a=1e3){e[a-1].ts-i.ts<1e3&&(s=a+1)}}}return s}function ao(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),i=window.atob(t),s=new Uint8Array(i.length),r=0;r>4===_s&&e[1]===vs}function uo(e){return!0===e||"true"===e}function po(e){return!0!==e&&"true"!==e}function fo(e){return e.replace(/-([a-z])/g,(function(e,t){return t.toUpperCase()}))}function mo(){return/iphone/i.test(navigator.userAgent)}function go(){return window.performance&&window.performance.memory?window.performance.memory:null}function yo(){try{var e=document.createElement("canvas");return!(!window.WebGL2RenderingContext||!e.getContext("webgl2"))}catch(e){return!1}}function Ao(e){return e.trim().match(/^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/)[1]}function bo(){let e=!1;return"requestVideoFrameCallback"in HTMLVideoElement.prototype&&(e=!0),e}function vo(){let e=!1;return"PressureObserver"in window&&(e=!0),e}class _o{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,i,s)));e.addEventListener(t,i,s);const r=()=>{Ya(e.removeEventListener)&&e.removeEventListener(t,i,s)};return this.destroys.push(r),r}destroy(){this.master.debug&&this.master.debug.log("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class So{on(e,t,i){const s=this.e||(this.e={});return(s[e]||(s[e]=[])).push({fn:t,ctx:i}),this}once(e,t,i){const s=this;function r(){s.off(e,r);for(var a=arguments.length,o=new Array(a),n=0;n1?i-1:0),r=1;r{delete i[e]})),void delete this.e;const s=i[e],r=[];if(s&&t)for(let e=0,i=s.length;e0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=this.gl.createProgram();return this.gl.attachShader(i,e),this.gl.attachShader(i,t),this.gl.linkProgram(i),this.gl.getProgramParameter(i,this.gl.LINK_STATUS)?i:(console.log("Unable to initialize the shader program: "+this.gl.getProgramInfoLog(i)),null)}_loadShader(e,t){const i=this.gl,s=i.createShader(e);return i.shaderSource(s,t),i.compileShader(s),i.getShaderParameter(s,i.COMPILE_STATUS)?s:(console.log("An error occurred compiling the shaders: "+i.getShaderInfoLog(s)),i.deleteShader(s),null)}_initBuffers(){const e=this.gl,t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);const i=[-1,-1,1,-1,1,1,-1,1];e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW);var s=[];s=s.concat([0,1],[1,1],[1,0],[0,0]);const r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array(s),e.STATIC_DRAW);const a=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,a);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{positions:i,position:t,texPosition:r,indices:a}}_createTexture(){let e=this.gl.createTexture();return this.gl.bindTexture(this.gl.TEXTURE_2D,e),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),e}_drawScene(e,t,i){this.gl.viewport(0,0,e,t),this.gl.enable(this.gl.BLEND),this.gl.blendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.position),this.gl.bufferData(this.gl.ARRAY_BUFFER,new Float32Array(this._buffers.positions),this.gl.STATIC_DRAW),this.gl.vertexAttribPointer(this._programInfo.attribLocations.vertexPosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.vertexPosition),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this._buffers.texPosition),this.gl.vertexAttribPointer(this._programInfo.attribLocations.texturePosition,2,this.gl.FLOAT,!1,0,0),this.gl.enableVertexAttribArray(this._programInfo.attribLocations.texturePosition),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this._buffers.indices);i?(this.gl.activeTexture(this.gl.TEXTURE0+3),this.gl.bindTexture(this.gl.TEXTURE_2D,this._ytexture),this.gl.activeTexture(this.gl.TEXTURE0+4),this.gl.bindTexture(this.gl.TEXTURE_2D,this._utexture),this.gl.activeTexture(this.gl.TEXTURE0+5),this.gl.bindTexture(this.gl.TEXTURE_2D,this._vtexture)):(this.gl.activeTexture(this.gl.TEXTURE0+2),this.gl.bindTexture(this.gl.TEXTURE_2D,this._rgbatexture)),this.gl.useProgram(this._programInfo.program),this.gl.uniform1i(this._programInfo.uniformLocations.rgbatexture,2),this.gl.uniform1i(this._programInfo.uniformLocations.ytexture,3),this.gl.uniform1i(this._programInfo.uniformLocations.utexture,4),this.gl.uniform1i(this._programInfo.uniformLocations.vtexture,5),this.gl.uniform1i(this._programInfo.uniformLocations.isyuv,i?1:0),this.gl.drawElements(this.gl.TRIANGLES,6,this.gl.UNSIGNED_SHORT,0)}_calRect(e,t,i,s,r,a){let o=2*e/r-1,n=2*(a-t-s)/a-1,l=2*(e+i)/r-1,d=2*(a-t)/a-1;return[o,n,l,n,l,d,o,d]}_clear(){this.gl.clearColor(0,0,0,1),this.gl.clearDepth(1),this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT)}render(e,t,i,s,r){const a=this.gl;this._clear(),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._ytexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e,t,0,a.LUMINANCE,a.UNSIGNED_BYTE,i),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,this._utexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,s),a.activeTexture(a.TEXTURE2),a.bindTexture(a.TEXTURE_2D,this._vtexture),a.texImage2D(a.TEXTURE_2D,0,a.LUMINANCE,e/2,t/2,0,a.LUMINANCE,a.UNSIGNED_BYTE,r),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}renderYUV(e,t,i){let s=i.slice(0,e*t),r=i.slice(e*t,e*t*5/4),a=i.slice(e*t*5/4,e*t*3/2);const o=this.gl;this._clear(),o.activeTexture(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,this._ytexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e,t,0,o.LUMINANCE,o.UNSIGNED_BYTE,s),o.activeTexture(o.TEXTURE1),o.bindTexture(o.TEXTURE_2D,this._utexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e/2,t/2,0,o.LUMINANCE,o.UNSIGNED_BYTE,r),o.activeTexture(o.TEXTURE2),o.bindTexture(o.TEXTURE_2D,this._vtexture),o.texImage2D(o.TEXTURE_2D,0,o.LUMINANCE,e/2,t/2,0,o.LUMINANCE,o.UNSIGNED_BYTE,a),this._buffers.positions=[-1,-1,1,-1,1,1,-1,1],this._drawScene(e,t,!0)}drawDom(e,t,i,s,r){const a=this.gl;a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,this._rgbatexture),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,r),this._buffers.positions=this._calRect(i,s,r.width,r.height,e,t),this._drawScene(e,t,!1)}}class Lo{constructor(e){this.gpu=e,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null,this.hasInited=!1,this.buffers=this._initBuffer(),this._initPipeline().then((e=>{this.pipeline=e,this.matrixGroupInfo=this._initMatrixGroupInfo(),this.hasInited=!0}))}destroy(){this.gpu&&(this.gpu.device.destroy(),this.gpu=null),this.hasInited=!1,this.pipeline=null,this.matrixGroupInfo=null,this.depthTexture=null,this.textureGroupInfo=null}_initBuffer(){const e=this.gpu.device,t=new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),i=e.createBuffer({size:t.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST});e.queue.writeBuffer(i,0,t);const s=new Float32Array([0,1,1,1,1,0,0,0]),r=e.createBuffer({size:s.byteLength,usage:window.GPUBufferUsage.VERTEX|window.GPUBufferUsage.COPY_DST});e.queue.writeBuffer(r,0,s);const a=new Uint16Array([0,1,2,0,2,3]),o=e.createBuffer({size:a.byteLength,usage:window.GPUBufferUsage.INDEX|window.GPUBufferUsage.COPY_DST});return e.queue.writeBuffer(o,0,a),{positionBuffer:i,texpositionBuffer:r,indexBuffer:o}}_initPipeline(){return new Promise(((e,t)=>{const i=this.gpu.device,s=this.gpu.format,r={layout:"auto",vertex:{module:i.createShaderModule({code:"\n\n @binding(0) @group(0) var uModelMatrix : mat4x4;\n @binding(1) @group(0) var uViewMatrix : mat4x4;\n @binding(2) @group(0) var uProjectionMatrix : mat4x4;\n\n struct VertexOutput {\n @builtin(position) Position : vec4,\n @location(0) vTexturePosition : vec2,\n }\n\n @vertex\n fn main(\n @location(0) aVertexPosition : vec4,\n @location(1) aTexturePosition : vec2\n ) -> VertexOutput {\n var output : VertexOutput;\n var tmppos : vec4 = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n output.Position = vec4(tmppos.x, tmppos.y, (tmppos.z+1.)/2., tmppos.w); // webgl z [-1, 1], webgpu z [0, 1], 这里z做下调整 z-webgpu = (z-webgl+1)/2\n output.vTexturePosition = aTexturePosition;\n return output;\n }\n\n "}),entryPoint:"main",buffers:[{arrayStride:12,attributes:[{shaderLocation:0,offset:0,format:"float32x3"}]},{arrayStride:8,attributes:[{shaderLocation:1,offset:0,format:"float32x2"}]}]},primitive:{topology:"triangle-list"},fragment:{module:i.createShaderModule({code:"\n @group(1) @binding(0) var mySampler: sampler;\n @group(1) @binding(1) var yTexture: texture_2d;\n @group(1) @binding(2) var uTexture: texture_2d;\n @group(1) @binding(3) var vTexture: texture_2d;\n\n const YUV2RGB : mat4x4 = mat4x4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n @fragment\n fn main(\n @location(0) vTexturePosition: vec2\n ) -> @location(0) vec4 {\n\n var y : f32= textureSample(yTexture, mySampler, vTexturePosition).r;\n var u : f32 = textureSample(uTexture, mySampler, vTexturePosition).r;\n var v : f32 = textureSample(vTexture, mySampler, vTexturePosition).r;\n\n return vec4(y, u, v, 1.0)*YUV2RGB;\n }\n\n "}),entryPoint:"main",targets:[{format:s}]},depthStencil:{depthWriteEnabled:!0,depthCompare:"less",format:"depth24plus"}};i.createRenderPipelineAsync(r).then((t=>{e(t)})).catch((e=>{t(e)}))}))}_initMatrixGroupInfo(){const e=this.gpu.device,t=this.pipeline,i=To();xo(i,-1,1,-1,1,.1,100);const s=To();ko(s);const r=To();!function(e,t,i,s){var r,a,o,n,l,d,h,c,u,p,f=t[0],m=t[1],g=t[2],y=s[0],A=s[1],b=s[2],v=i[0],_=i[1],S=i[2];Math.abs(f-v)Ia(e)));this.configList=i,this._updateDom()}_resizeDomForVideo(){const e=this.player.width,t=this.player.height,i=this.player.getVideoInfo();if(!(i&&i.height>0&&i.width>0))return;let s=i.width,r=i.height;const a=this.player._opt;let o=t,n=e;if(a.hasControl&&!a.controlAutoHide){const e=a.playType===_?Yt:Kt;ua()&&this.player.fullscreen&&a.useWebFullScreen?n-=e:o-=e}const l=a.rotate;let d=(n-s)/2,h=(o-r)/2;270!==l&&90!==l||(s=i.height,r=i.width);const c=n/s,u=o/r;let p=c>u?u:c;a.isResize||c!==u&&(p=c+","+u),a.isFullResize&&(p=c>u?c:u);let f="scale("+p+")";"none"===a.mirrorRotate&&l&&(f+=" rotate("+l+"deg)"),"level"===a.mirrorRotate?f+=" rotateY(180deg)":"vertical"===a.mirrorRotate&&(f+=" rotateX(180deg)"),this.scale=-1!==(""+p).indexOf(",")?c:p,this.shadowRootInnerDom.style.transform=f,this.shadowRootInnerDom.style.left=d+"px",this.shadowRootInnerDom.style.top=h+"px",this.shadowRootInnerDom.style.width=i.width+"px",this.shadowRootInnerDom.style.height=i.height+"px",this.shadowRootInnerDom.style.display="block"}_resizeDomForCanvas(){const e=this.player.getVideoInfo();if(!(e&&e.height>0&&e.width>0))return;const t=this.player._opt;let i=this.player.width,s=this.player.height;if(t.hasControl&&!t.controlAutoHide){const e=t.playType===_?Yt:Kt;ua()&&this.player.fullscreen&&t.useWebFullScreen?i-=e:s-=e}let r=e.width,a=e.height;const o=t.rotate;let n=(i-r)/2,l=(s-a)/2;270!==o&&90!==o||(r=e.height,a=e.width);const d=i/r,h=s/a;let c=d>h?h:d;t.isResize||d!==h&&(c=d+","+h),t.isFullResize&&(c=d>h?d:h);let u="scale("+c+")";"none"===t.mirrorRotate&&o&&(u+=" rotate("+o+"deg)"),"level"===t.mirrorRotate?u+=" rotateY(180deg)":"vertical"===t.mirrorRotate&&(u+=" rotateX(180deg)"),this.shadowRootInnerDom.style.height=e.height+"px",this.shadowRootInnerDom.style.width=e.width+"px",this.shadowRootInnerDom.style.padding="0",this.shadowRootInnerDom.style.transform=u,this.shadowRootInnerDom.style.left=n+"px",this.shadowRootInnerDom.style.top=l+"px",this.shadowRootInnerDom.style.display="block"}_resizeDomRatio(){const e=this.player.getVideoInfo();if(!(e&&e.height>0&&e.width>0))return;const t=this.player._opt.aspectRatio.split(":").map(Number);let i=this.player.width,s=this.player.height;const r=this.player._opt;let a=0;r.hasControl&&!r.controlAutoHide&&(a=r.playType===_?Yt:Kt,s-=a);const o=e.width/e.height,n=t[0]/t[1];if(o>n){const t=n*e.height/e.width;this.shadowRootInnerDom.style.width=100*t+"%",this.shadowRootInnerDom.style.height=`calc(100% - ${a}px)`,this.shadowRootInnerDom.style.padding=`0 ${(i-i*t)/2}px`}else{const t=e.width/n/e.height;this.shadowRootInnerDom.style.width="100%",this.shadowRootInnerDom.style.height=`calc(${100*t}% - ${a}px)`,this.shadowRootInnerDom.style.padding=(s-s*t)/2+"px 0"}this.shadowRootInnerDom.style.display="block"}_updateDom(){this.shadowRoot&&this.configList.forEach((e=>{const t=document.createElement("div");let i=null;if(e.image&&e.image.src?(i=document.createElement("img"),i.style.height="100%",i.style.width="100%",i.style.objectFit="contain",i.src=e.image.src):e.text&&e.text.content?i=document.createTextNode(e.text.content):(e.rect&&e.rect.color&&e.rect.width||e.html||e.line&&e.line.x1&&e.line.y1&&e.line.x2&&e.line.y2||e.polygon&&e.polygon.list&&e.polygon.list.length>=3)&&(i=document.createElement("div")),i){if(t.appendChild(i),t.style.visibility="",t.style.position="absolute",t.style.display="block",t.style["-ms-user-select"]="none",t.style["-moz-user-select"]="none",t.style["-webkit-user-select"]="none",t.style["-o-user-select"]="none",t.style["user-select"]="none",t.style["-webkit-touch-callout"]="none",t.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",t.style["-webkit-text-size-adjust"]="none",t.style["-webkit-touch-callout"]="none",t.style.opacity=e.opacity,Ba(e.left)&&(Ta(e.left)?t.style.left=e.left+"px":t.style.left=e.left),Ba(e.right)&&(Ta(e.right)?t.style.right=e.right+"px":t.style.right=e.right),Ba(e.top)&&(Ta(e.top)?t.style.top=e.top+"px":t.style.top=e.top),Ba(e.bottom)&&(Ta(e.bottom)?t.style.bottom=e.bottom+"px":t.style.bottom=e.bottom),e.backgroundColor&&(t.style.backgroundColor=e.backgroundColor),t.style.overflow="hidden",t.style.zIndex="9999999",e.image&&e.image.src)t.style.width=e.image.width+"px",t.style.height=e.image.height+"px";else if(e.text&&e.text.content)t.style.fontSize=e.text.fontSize+"px",t.style.color=e.text.color,e.text.width&&(t.style.width=e.text.width+"px"),e.text.height&&(t.style.height=e.text.height+"px");else if(e.rect&&e.rect.color&&e.rect.width){if(t.style.width=e.rect.width+"px",t.style.height=e.rect.height+"px",t.style.borderWidth=e.rect.lineWidth+"px",t.style.borderStyle="solid",t.style.borderColor=e.rect.color,e.rect.fill){const i=document.createElement("div");i.style.position="absolute",i.style.width="100%",i.style.height="100%",i.style.backgroundColor=e.rect.fill,e.rect.fillOpacity&&(i.style.opacity=e.rect.fillOpacity),t.appendChild(i)}}else if(e.html)t.style.width="100%",t.style.height="100%",t.innerHTML=e.html;else if(e.line&&e.line.x1&&e.line.y1&&e.line.x2&&e.line.y2)this.settingLine(t,e.line);else if(e.polygon&&e.polygon.list&&e.polygon.list.length>=3){t.style.width="100%",t.style.height="100%";let i=e.polygon.list;const s=e.polygon.color,r=e.polygon.lineWidth;if(i=i.sort(((e,t)=>(e.index||0)-(t.index||0))),e.polygon.fill){const s=document.createElement("div");s.style.position="absolute",s.style.width="100%",s.style.height="100%";const r="polygon("+i.map((e=>`${e.x}px ${e.y}px`)).join(", ")+")";s.style.clipPath=r,s.style.backgroundColor=e.polygon.fill,e.polygon.fillOpacity&&(s.style.opacity=e.polygon.fillOpacity),t.appendChild(s)}i.forEach(((e,a)=>{const o=document.createElement("div");if(a===i.length-1){const a=i[0],n={x1:e.x,y1:e.y,x2:a.x,y2:a.y,color:s,lineWidth:r};return this.settingLine(o,n),void t.appendChild(o)}const n=i[a+1],l={x1:e.x,y1:e.y,x2:n.x,y2:n.y,color:s,lineWidth:r};this.settingLine(o,l),t.appendChild(o)}))}this.isDynamic&&(this.shadowRootDynamicDom=t),this.shadowRootInnerDom.appendChild(t)}}))}settingLine(e,t){const i=t.x1,s=t.y1,r=t.x2,a=t.y2;var o=Math.sqrt((i-r)**2+(s-a)**2),n=180*Math.atan2(a-s,r-i)/Math.PI;e.style.backgroundColor=t.color,e.style.width=o+"px",e.style.height=t.lineWidth+"px",e.style.position="absolute",e.style.top=s+"px",e.style.left=i+"px",e.style.transform="rotate("+n+"deg)",e.style.transformOrigin="0 0"}remove(){this._removeDom()}_removeDom(){this.shadowRootInnerDom&&(this.shadowRootInnerDom.innerHTML="")}}class Bo extends So{constructor(){super(),this.videoInfo={width:null,height:null,encType:null,encTypeCode:null},this.init=!1,this.prevAiFaceDetectTime=null,this.prevAiObjectDetectTime=null,this.prevOcclusionDetectTime=null,this.contentWatermark=null,this.aiContentWatermark=null,this.tempContentList=[],this.tempAiContentList=[],this.streamFps=0}destroy(){this.resetInit(),this.contentWatermark&&(this.contentWatermark.destroy(),this.contentWatermark=null),this.tempContentList=[],this.aiContentWatermark&&(this.aiContentWatermark.destroy(),this.aiContentWatermark=null),this.tempAiContentList=[],this.prevAiFaceDetectTime=null,this.prevAiObjectDetectTime=null,this.streamFps=0,this.off()}resetInit(){this.videoInfo={width:null,height:null,encType:null,encTypeCode:null},this.init=!1}getHasInit(){return this.init}updateVideoInfo(e){Ba(e.encTypeCode)&&(this.videoInfo.encType=bt[e.encTypeCode],this.videoInfo.encTypeCode=e.encTypeCode),Ba(e.encType)&&(this.videoInfo.encType=e.encType),Ba(e.width)&&(this.videoInfo.width=e.width),Ba(e.height)&&(this.videoInfo.height=e.height),Ba(this.videoInfo.encType)&&Ba(this.videoInfo.height)&&Ba(this.videoInfo.width)&&!this.init&&(this.player.emit(nt.videoInfo,this.videoInfo),this.init=!0)}getVideoInfo(){return this.videoInfo}clearView(){this.tempContentList=[],this.tempAiContentList=[]}resize(){if(this.player.debug.log("CommonVideo","resize()"),"default"===this.player._opt.aspectRatio||ua()?this._resize():this._resizeRatio(),this.contentWatermark&&this.contentWatermark.resize(),this.aiContentWatermark&&this.aiContentWatermark.resize(),this.player.singleWatermark&&this.player.singleWatermark.resize(),this.player.ghostWatermark&&this.player.ghostWatermark.resize(),this.player.dynamicWatermark&&this.player.dynamicWatermark.resize(),this.player.zoom&&this.player.zooming){const e=this._getStyleScale();this.player.zoom.updatePrevVideoElementStyleScale(e),this.player.zoom.updateVideoElementScale()}}_resizeRatio(){this.player.debug.log("CommonVideo","_resizeRatio()");const e=this.player._opt.aspectRatio.split(":").map(Number);let t=this.player.width,i=this.player.height;const s=this.player._opt;let r=0;s.hasControl&&!s.controlAutoHide&&(r=s.playType===_?Yt:Kt,i-=r);const a=this.videoInfo,o=a.width/a.height,n=e[0]/e[1];if(this.getType()===$&&(this.$videoElement.style.left="0",this.$videoElement.style.top="0",this.$videoElement.style.transform="none"),this.getType()===W&&this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit="fill"),o>n){const e=n*a.height/a.width;this.$videoElement.style.width=100*e+"%",this.$videoElement.style.height=`calc(100% - ${r}px)`,this.$videoElement.style.padding=`0 ${(t-t*e)/2}px`}else{const e=a.width/n/a.height;this.$videoElement.style.width="100%",this.$videoElement.style.height=`calc(${100*e}% - ${r}px)`,this.$videoElement.style.padding=(i-i*e)/2+"px 0"}}play(){}pause(){}setRate(e){}getType(){return""}getCanvasType(){return""}getCurrentTime(){return 0}getStreamFps(){return this.streamFps}isPlaying(){return!0}getPlaybackQuality(){return null}setStreamFps(e){this.player.debug.log("CommonVideo","setStreamFps",e),this.streamFps=e}addContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.tempContentList=e}addAiContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.tempAiContentList=e}doAddContentToWatermark(){if(this.tempContentList.length>0){this.contentWatermark||(this.contentWatermark=new Po(this.player),this.contentWatermark.resize());const e=[];this.tempContentList.forEach((t=>{let i={left:t.x||0,top:t.y||0};"text"===t.type?i.text={content:t.text,fontSize:t.fontSize||"14",color:t.color||"#000"}:"rect"===t.type?i.rect={width:t.width,height:t.height,color:t.color||"green",lineWidth:t.lineWidth||2,fill:t.fill||"",fillOpacity:t.fillOpacity||.2}:"polygon"===t.type?i.polygon={list:t.list,color:t.color||"green",lineWidth:t.lineWidth||2,fill:t.fill,fillOpacity:t.fillOpacity||.2}:"line"===t.type&&(i.line={color:t.color||"green",lineWidth:t.lineWidth||2,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2}),e.push(i)})),this.contentWatermark.update(e)}else this.contentWatermark&&this.contentWatermark.remove()}doAddAiContentToWatermark(){if(this.tempAiContentList.length>0){this.aiContentWatermark||(this.aiContentWatermark=new Po(this.player),this.aiContentWatermark.resize());const e=this.tempAiContentList.map((e=>{let t={left:e.x,top:e.y};return"text"===e.type?t.text={content:e.text,fontSize:e.fontSize,color:e.color}:"rect"===e.type&&(t.rect={width:e.width,height:e.height,color:e.color,lineWidth:e.lineWidth}),t}));this.aiContentWatermark.update(e)}else this.aiContentWatermark&&this.aiContentWatermark.remove()}_getStyleScale(){let e=this.$videoElement.style.transform.match(/scale\([0-9., ]*\)/g),t="";if(e&&e[0]){t=e[0].replace("scale(","").replace(")","").split(",")}return t}getReadyStateInited(){return!0}}var Io="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0;function Mo(e,t,i){var s=new XMLHttpRequest;s.open("GET",e),s.responseType="blob",s.onload=function(){No(s.response,t,i)},s.onerror=function(){console.error("could not download file")},s.send()}function Uo(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return t.status>=200&&t.status<=299}function Fo(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(i){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var Oo=Io.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),No="object"!=typeof window||window!==Io?function(){}:"download"in HTMLAnchorElement.prototype&&!Oo?function(e,t,i){var s=Io.URL||Io.webkitURL,r=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",r.download=t,r.rel="noopener","string"==typeof e?(r.href=e,r.origin!==location.origin?Uo(r.href)?Mo(e,t,i):Fo(r,r.target="_blank"):Fo(r)):(r.href=s.createObjectURL(e),setTimeout((function(){s.revokeObjectURL(r.href)}),4e4),setTimeout((function(){Fo(r)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download","string"==typeof e)if(Uo(e))Mo(e,t,i);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout((function(){Fo(s)}))}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,i),t)}:function(e,t,i,s){if((s=s||open("","_blank"))&&(s.document.title=s.document.body.innerText="downloading..."),"string"==typeof e)return Mo(e,t,i);var r="application/octet-stream"===e.type,a=/constructor/i.test(Io.HTMLElement)||Io.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);if((o||r&&a||Oo)&&"undefined"!=typeof FileReader){var n=new FileReader;n.onloadend=function(){var e=n.result;e=o?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),s?s.location.href=e:location=e,s=null},n.readAsDataURL(e)}else{var l=Io.URL||Io.webkitURL,d=l.createObjectURL(e);s?s.location=d:location.href=d,s=null,setTimeout((function(){l.revokeObjectURL(d)}),4e4)}};class jo{constructor(e,t){this.canvas=e,this.gl=t;const i=t.createShader(t.VERTEX_SHADER);if(t.shaderSource(i,"\n attribute vec2 xy;\n varying highp vec2 uv;\n void main(void) {\n gl_Position = vec4(xy, 0.0, 1.0);\n // Map vertex coordinates (-1 to +1) to UV coordinates (0 to 1).\n // UV coordinates are Y-flipped relative to vertex coordinates.\n uv = vec2((1.0 + xy.x) / 2.0, (1.0 - xy.y) / 2.0);\n }\n "),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS))throw t.getShaderInfoLog(i);const s=t.createShader(t.FRAGMENT_SHADER);if(t.shaderSource(s,"\n varying highp vec2 uv;\n uniform sampler2D texture;\n void main(void) {\n gl_FragColor = texture2D(texture, uv);\n }\n "),t.compileShader(s),!t.getShaderParameter(s,t.COMPILE_STATUS))throw t.getShaderInfoLog(s);const r=t.createProgram();if(t.attachShader(r,i),t.attachShader(r,s),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS))throw t.getProgramInfoLog(r);t.useProgram(r);const a=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,a),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),t.STATIC_DRAW);const o=t.getAttribLocation(r,"xy");t.vertexAttribPointer(o,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o);const n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this.program=r,this.buffer=a,this.vertexShader=i,this.fragmentShader=s,this.texture=n}destroy(){this.gl.deleteProgram(this.program),this.gl.deleteBuffer(this.buffer),this.gl.deleteTexture(this.texture),this.gl.deleteShader(this.vertexShader),this.gl.deleteShader(this.fragmentShader),this.program=null,this.buffer=null,this.vertexShader=null,this.fragmentShader=null,this.texture=null}render(e){this.canvas.width=e.displayWidth,this.canvas.height=e.displayHeight;const t=this.gl;t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight),t.clearColor(1,0,0,1),t.clear(t.COLOR_BUFFER_BIT),t.drawArrays(t.TRIANGLE_FAN,0,4)}}class zo extends Bo{constructor(e){super(),this.player=e;const t=document.createElement("canvas");t.style.position="absolute",t.style.top=0,t.style.left=0,this.$videoElement=t,e.$container.appendChild(this.$videoElement),this.context2D=null,this.contextGl=null,this.webglRender=null,this.webglRectRender=null,this.webGPURender=null,this.isWebglContextLost=!1,this.isWcsWebgl2=!1,this.bitmaprenderer=null,this.renderType=null,this.controlHeight=0,this.proxyDestroyList=[],this._initCanvasRender()}destroy(){super.destroy(),this.proxyDestroyList.length>0&&(this.proxyDestroyList.forEach((e=>{e&&e()})),this.proxyDestroyList=[]),this.contextGl&&(this.contextGl=null),this.context2D&&(this.context2D=null),this.webglRender&&(this.webglRender.destroy(),this.webglRender=null),this.webglRectRender&&(this.webglRectRender.destroy(),this.webglRectRender=null),this.webGPURender&&(this.webGPURender.destroy(),this.webGPURender=null),this.bitmaprenderer&&(this.bitmaprenderer=null),this.renderType=null,this.isWebglContextLost=!1,this.videoInfo={width:"",height:"",encType:""},this.player.$container.removeChild(this.$videoElement),this.init=!1,this.off()}_initContext2D(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.context2D=this.$videoElement.getContext("2d",e)}_initContextGl(){if(this.player.events,this.contextGl=ia(this.$videoElement),!this.contextGl)throw this.player.debug.error("CommonCanvasLoader","_initContextGl() createContextGL error"),new Error("CommonCanvasLoader and _initContextGl createContextGL error");this._bindContextGlEvents(),this.webglRender=new Do(this.contextGl,this.player._opt.openWebglAlignment)}_initContextGl2(){if(this.contextGl=sa(this.$videoElement),this.contextGl){this._bindContextGlEvents(2);try{this.webglRender=new jo(this.$videoElement,this.contextGl)}catch(e){this.player.debug.error("CommonCanvasLoader",`create webgl2Render error is ${e} and next use context2d.draw render`),this.contextGl=null,this.webglRender=null,this._initContext2D()}}else this.player.debug.error("CommonCanvasLoader","_initContextGl2() createContextGL2 error")}_bindContextGlEvents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const{proxy:t}=this.player.events,i=t(this.$videoElement,"webglcontextlost",(t=>{t.preventDefault(),this.player.debug.error("canvasVideo","webglcontextlost error",t),this.isWebglContextLost=!0,this.webglRender&&(this.player.debug.log("CommonCanvasLoader","webglcontextlost error and destroy webglRender"),this.webglRender.destroy(),this.webglRender=null),this.webglRectRender&&(this.player.debug.log("CommonCanvasLoader","webglcontextlost error and destroy webglRectRender"),this.webglRectRender.destroy(),this.webglRectRender=null),this.contextGl=null,setTimeout((()=>{if(this.player.debug.log("CommonCanvasLoader",`createContextGL() version ${e}`),1===e?this.contextGl=ia(this.$videoElement):2===e&&(this.contextGl=sa(this.$videoElement)),this.player.debug.log("CommonCanvasLoader","createContextGL success"),this.contextGl&&this.contextGl.getContextAttributes){const t=this.contextGl.getContextAttributes();t&&t.stencil?(1===e?this.webglRender=new Do(this.contextGl,this.player._opt.openWebglAlignment):2===e&&(this.webglRender=new jo(this.$videoElement,this.contextGl)),this.isWebglContextLost=!1,this.player.debug.log("CommonCanvasLoader","webglcontextlost error reset and getContextAttributes().stencil is true")):(this.player.debug.error("CommonCanvasLoader","webglcontextlost error, getContextAttributes().stencil is false"),this.player.emitError(ct.webglContextLostError))}else this.player.debug.error("CommonCanvasLoader","webglcontextlost error, getContextAttributes().stencil is false"),this.player.emitError(ct.webglContextLostError)}),500)})),s=t(this.$videoElement,"webglcontextrestored",(e=>{e.preventDefault(),this.player.debug.log("CommonCanvasLoader","webglcontextrestored ",e)}));this.proxyDestroyList.push(i,s)}_initContextGPU(){var t;(t=this.$videoElement,new Promise(((e,i)=>{navigator.gpu?navigator.gpu.requestAdapter().then((s=>{s?s.requestDevice().then((r=>{if(r){const a=t.getContext("webgpu");if(a){const t=navigator.gpu.getPreferredCanvasFormat();a.configure({device:r,format:t,alphaMode:"opaque"}),e({adapter:s,device:r,context:a,format:t})}else i('WebGPU "context" create fail')}else i('WebGPU "device" request fail')})).catch((e=>{i('WebGPU "adapter.requestDevice()" fail')})):i('WebGPU "adapter" request fail is empty')})).catch((e=>{i('WebGPU "navigator.gpu.requestAdapter()" fail')})):i("WebGPU not support!!")}))).then((t=>{t?(this.webGPURender=new Lo(t),this.player.debug.log("CommonCanvasLoader","webGPURender init success")):(this.player.debug.warn("CommonCanvasLoader",`createWebGPUContext error is ${e} and next use webgl render`),this.renderType=ti,this._initContextGl())})).catch((e=>{this.player.debug.warn("CommonCanvasLoader",`createWebGPUContext error is ${e} and next use webgl render`),this.renderType=ti,this._initContextGl()}))}initCanvasViewSize(){this.$videoElement.width=this.videoInfo.width,this.$videoElement.height=this.videoInfo.height,this.resize()}screenshot(e,t,i,s){e=e||aa(),s=s||gt.download;let r=.92;!Ji[t]&>[t]&&(s=t,t="png",i=void 0),"string"==typeof i&&(s=i,i=void 0),void 0!==i&&(r=Number(i));const a=Ji[t]||Ji.png,o=this.$videoElement.toDataURL(a,r);if(s===gt.base64)return o;{const t=ra(o);if(s===gt.blob)return t;if(s===gt.download){const i=a.split("/")[1];No(t,e+"."+i)}}}screenshotWatermark(e){return new Promise(((t,i)=>{$a(e)&&(e={filename:e}),(e=e||{}).width=this.videoInfo.width,e.height=this.videoInfo.height,e.filename=e.filename||aa(),e.format=e.format?Ji[e.format]:Ji.png,e.quality=Number(e.quality)||.92,e.type=e.type||gt.download;const s=this.$videoElement.toDataURL(e.format,e.quality);Ua(s,e).then((i=>{if(e.type===gt.base64)t(s);else{const s=ra(i);if(e.type===gt.blob)t(s);else if(e.type===gt.download){t();const i=e.format.split("/")[1];No(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}render(){}clearView(){super.clearView()}play(){}pause(){}_resize(){this.player.debug.log("canvasVideo","_resize()");const e=this.player._opt;let t=this.player.width,i=this.player.height;if(e.hasControl&&!e.controlAutoHide){const s=this.controlHeight;ua()&&this.player.fullscreen&&e.useWebFullScreen?t-=s:i-=s}let s=this.$videoElement.width,r=this.$videoElement.height;const a=e.rotate;let o=(t-s)/2,n=(i-r)/2;270!==a&&90!==a||(s=this.$videoElement.height,r=this.$videoElement.width);const l=t/s,d=i/r;let h=l>d?d:l;po(e.isResize)&&l!==d&&(h=l+","+d),e.isFullResize&&(h=l>d?l:d);let c="scale("+h+")";"none"===e.mirrorRotate&&a&&(c+=" rotate("+a+"deg)"),"level"===e.mirrorRotate?c+=" rotateY(180deg)":"vertical"===e.mirrorRotate&&(c+=" rotateX(180deg)"),this.$videoElement.style.height=this.videoInfo.height+"px",this.$videoElement.style.width=this.videoInfo.width+"px",this.$videoElement.style.padding="0",this.$videoElement.style.transform=c,this.$videoElement.style.left=o+"px",this.$videoElement.style.top=n+"px"}initFps(){}setStreamFps(e){}getStreamFps(){return 25}getType(){return $}getCanvasType(){let e=this.renderType===si?si:ti;return this.isWcsWebgl2&&(e=ii),e}}class Go extends zo{constructor(e){super(e),this.yuvList=[],this.controlHeight=Kt,this.tempTextCanvas=null,this.tempTextCanvasCtx=null,this.player.debug.log("CanvasVideo","init")}async destroy(){super.destroy(),this.yuvList=[],this.tempTextCanvas&&(this.tempTextCanvasCtx.clearRect(0,0,this.tempTextCanvas.width,this.tempTextCanvas.height),this.tempTextCanvas.width=0,this.tempTextCanvas.height=0,this.tempTextCanvas=null),this.player.debug.log("CanvasVideoLoader","destroy")}_initCanvasRender(){this.player._opt.useWCS&&!this._supportOffscreen()?(this.renderType=ei,yo()&&this.player._opt.wcsUseWebgl2Render?(this._initContextGl2(),this.webglRender&&(this.isWcsWebgl2=!0)):this._initContext2D()):this.player._opt.useMSE&&this.player._opt.mseUseCanvasRender?(this.renderType=ai,this._initContext2D()):this.player.isOldHls()&&this.player._opt.useCanvasRender?(this.renderType=oi,this._initContext2D()):this.player.isWebrtcH264()&&this.player._opt.webrtcUseCanvasRender?(this.renderType=ni,this._initContext2D()):this._supportOffscreen()?(this.renderType=ri,this._bindOffscreen()):this.player._opt.useWebGPU?(this.renderType=si,this._initContextGPU()):(this.renderType=ti,this._initContextGl())}_supportOffscreen(){return"function"==typeof this.$videoElement.transferControlToOffscreen&&this.player._opt.useOffscreen}_bindOffscreen(){this.bitmaprenderer=this.$videoElement.getContext("bitmaprenderer")}render(e){this.yuvList.push(e),this.startRender()}startRender(){for(;!(this.yuvList.length<=0);){const e=this.yuvList.shift();this.doRender(e)}}doRender(e){if(this.renderType!==ai){const t={ts:e.ts||0,fps:!0};this.player.updateStats(t)}switch(this.renderType){case ri:this.bitmaprenderer.transferFromImageBitmap(e.buffer);break;case ti:case si:if(this.isWebglContextLost)return void this.player.debug.warn("CanvasVideoLoader","doRender() and webgl context is lost");let t=e.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector){null===this.prevAiFaceDetectTime&&(this.prevAiFaceDetectTime=aa());const i=aa();i-this.prevAiFaceDetectTime>=this.player._opt.aiFaceDetectInterval&&(t=this.player.ai.faceDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output,ts:e.ts||0}),this.prevAiFaceDetectTime=i)}if(this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector){null===this.prevAiObjectDetectTime&&(this.prevAiObjectDetectTime=aa());const i=aa();i-this.prevAiObjectDetectTime>=this.player._opt.aiObjectDetectInterval&&(t=this.player.ai.objectDetector.detect({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output,ts:e.ts||0}),this.prevAiObjectDetectTime=i)}if(this.player.occlusionDetectActive&&this.player.ai&&this.player.ai.occlusionDetector){null===this.prevAiOcclusionDetectTime&&(this.prevAiOcclusionDetectTime=aa());const t=aa();if(t-this.prevAiOcclusionDetectTime>=this.player._opt.aiOcclusionDetectInterval){const i=this.player.ai.occlusionDetector.check({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output});this.prevAiOcclusionDetectTime=t,i&&this.player.emit(nt.aiOcclusionDetectResult,{ts:e.ts||0})}}if(this.player.imageDetectActive&&this.player.ai&&this.player.ai.imageDetector){const t=this.player.ai.imageDetector.check({width:this.$videoElement.width,height:this.$videoElement.height,data:e.output});if(t&&t.data&&(this.player.emit(nt.aiOcclusionDetectResult,{type:t.type,ts:e.ts||0}),this.player._opt.aiImageDetectDrop))return void this.player.debug.log("CanvasVideoLoader",`doRender() and ai image detect result type is ${t.type} and drop`)}if(this.renderType===si)try{if(!this.webGPURender)return void this.player.debug.warn("CanvasVideoLoader","doRender webgpu render is not init");this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,t)}catch(e){this.player.debug.error("CanvasVideoLoader",`doRender webgpu render and error: ${e.toString()}`)}else if(this.renderType===ti)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,t)}catch(e){this.player.debug.error("CanvasVideoLoader",`doRender webgl render context is lost ${this.contextGl&&this.contextGl.isContextLost()} and error: ${e.toString()}`)}break;case ei:if(this.webglRender)this.webglRender.render(e.videoFrame),to(e.videoFrame);else if(this.context2D)if(Ya(e.videoFrame.createImageBitmap))try{e.videoFrame.createImageBitmap().then((t=>{this.context2D.drawImage(t,0,0,this.$videoElement.width,this.$videoElement.height),to(e.videoFrame)}))}catch(e){}else this.context2D.drawImage(e.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),to(e.videoFrame);else this.player.debug.warn("CanvasVideoLoader","doRender() and webcodecs context is lost");break;case ai:case oi:case ni:this.context2D.drawImage(e.$video,0,0,this.$videoElement.width,this.$videoElement.height)}let t=e.ts||0;this.renderType===ai&&(t=parseInt(1e3*e.$video.currentTime,10)+(this.player.mseDecoder.firstRenderTime||0)),this.player.updateCurrentPts(t),this.doAddContentToWatermark(),this.doAddAiContentToWatermark()}clearView(){switch(super.clearView(),this.renderType){case ri:(function(e,t){const i=document.createElement("canvas");i.width=e,i.height=t;const s=window.createImageBitmap(i,0,0,e,t);return i.width=0,i.height=0,s})(this.$videoElement.width,this.$videoElement.height).then((e=>{this.bitmaprenderer.transferFromImageBitmap(e)}));break;case ti:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case si:this.webGPURender.clear();break;case ei:this.contextGl?this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT):this.context2D&&this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height);break;case ai:case oi:case ni:this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}}_initTempTextCanvas(){this.tempTextCanvas=document.createElement("canvas"),this.tempTextCanvasCtx=this.tempTextCanvas.getContext("2d"),this.tempTextCanvas.width=600,this.tempTextCanvas.height=20}doAddContentToCanvas(){this.tempContentList.length>0&&this.context2D&&function(e){let{ctx:t,list:i}=e;t.save(),(i||[]).forEach((e=>{"text"===e.type?(t.font=`${e.fontSize||12}px Arial`,t.fillStyle=e.color||"green",t.fillText(e.text,e.x,e.y)):"rect"===e.type&&(t.strokeStyle=e.color||"green",t.lineWidth=e.lineWidth||2,t.strokeRect(e.x,e.y,e.width,e.height))})),t.restore()}({ctx:this.context2D,list:this.tempContentList})}doAddContentToWebGlCanvas(){this.tempContentList.length>0&&this.contextGl&&this.webglRectRender&&this.tempContentList.forEach((e=>{const t=e.x,i=e.y;if("rect"===e.type){const r=e.width,a=e.height,o=(s=e.color||"#008000",[parseInt(s.substring(1,3),16)/255,parseInt(s.substring(3,5),16)/255,parseInt(s.substring(5,7),16)/255,1]),n=e.lineWidth||4;if(!r||!a)return;this.webglRectRender.drawBox({x:t,y:i,width:r,height:a,lineColor:o,lineWidth:n,canvasWidth:this.$videoElement.width,canvasHeight:this.$videoElement.height})}else if("text"===e.type){const s=e.text||"";if(!s)return;const r=e.fontSize||20,a=e.color||"#008000";this.tempTextCanvas||this._initTempTextCanvas(),this.tempTextCanvasCtx.clearRect(0,0,this.tempTextCanvas.width,this.tempTextCanvas.height),this.tempTextCanvasCtx.font=`${r}px Arial`,this.tempTextCanvasCtx.fillStyle=a,this.tempTextCanvasCtx.textBaseline="top",this.tempTextCanvasCtx.fillText(s,0,0),this.webglRender.drawDom(this.$videoElement.width,this.$videoElement.height,t,i,this.tempTextCanvas)}var s}))}}class Ho extends Bo{constructor(e){super(),this.player=e,this.TAG_NAME="Video";const t=document.createElement("video"),i=document.createElement("canvas");t.muted=!0,t.style.position="absolute",t.style.top=0,t.style.left=0,this._delayPlay=!1,e.$container.appendChild(t),this.$videoElement=t,this.$canvasElement=i,this.canvasContext=i.getContext("2d"),this.mediaStream=null,this.vwriter=null,e.canVideoTrackWritter()&&xa()&&Ra()&&(this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),this.mediaStream=new MediaStream([this.trackGenerator]),t.srcObject=this.mediaStream,this.vwriter=this.trackGenerator.writable.getWriter()),this.fixChromeVideoFlashBug(),this.fixMobileAutoFullscreen(),this.resize(),this.eventListenList=[],this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes=0,this.isRetryPlaying=!1,this.isRetryPlayingTimes=0,this.canplayReceived=!1,this.progressProxyDestroy=null,this.checkVideoCanplayTimeout=null;const s=bo();this.supportVideoFrameCallbackHandle=null;const{proxy:r}=this.player.events,a=r(this.$videoElement,"canplay",(()=>{this.player.debug.log("Video","canplay"),this.player.isDestroyedOrClosed()||(this.canplayReceived=!0,this._delayPlay?(this.clearCheckVideoCanplayTimeout(),this._play(),bo()?this.supportVideoFrameCallbackHandle||(this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))):this.player.debug.warn("Video","not support requestVideoFrameCallback and use timeupdate event to update stats")):this.$videoElement.paused&&this.player.isMSEPlaybackRateChangePause&&(this.player.debug.log("Video",`canplay and video is paused and isMSEPlaybackRateChangePause is ${this.player.isMSEPlaybackRateChangePause} so next try to play`),this.player.isMSEPlaybackRateChangePause=!1,this.$videoElement.play()))})),o=r(this.$videoElement,"waiting",(()=>{this.player.debug.log("Video","waiting")})),n=r(this.$videoElement,"loadedmetadata",(()=>{this.player.debug.log("Video","loadedmetadata")})),l=r(this.$videoElement,"timeupdate",(t=>{if(!this.player.isDestroyedOrClosed()){if(po(s)){const t=parseInt(1e3*this.getCurrentTime(),10);(e.isWebrtcH264()||this.player.isOldHls()||this.player.isAliyunRtc())&&(this.player.emit(nt.timeUpdate,t),e.handleRender(),e.updateStats({fps:!0,ts:t,dts:t}))}this.player.isMseDecoderUseWorker()&&(this.player.decoderWorker.updateVideoTimestamp(this.getCurrentTime()),this._handleUpdatePlaybackRate())}})),d=r(this.$videoElement,"error",(()=>{let e={};if(this.player.isUseMSE()&&(e=this.player.getMseMineType()),this.player.debug.error("Video","Error Code "+this.$videoElement.error.code+" "+ur[this.$videoElement.error.code]+"; Details: "+this.$videoElement.error.message+"; Video Info: "+JSON.stringify(this.videoInfo)+"; Mse Mine Type: "+e.video+"; "),this.player.isUseMSE()){this.$videoElement.error.code;const e=this.$videoElement.error.message;-1!==e.indexOf(pr)&&(this.player.isMSEVideoDecoderInitializationFailedNotSupportHevc=!0),-1!==e.indexOf(fr)&&(this.player.isMSEAudioDecoderError=!0)}this.player.isHlsCanVideoPlay()})),h=r(this.$videoElement,"stalled",(()=>{this._detectAndFixStuckPlayback(!0)}));if(this.progressProxyDestroy=r(this.$videoElement,"progress",(()=>{this._detectAndFixStuckPlayback()})),this.eventListenList.push(a,o,l,d,n,h),this.player.isUseMSE()){const e=r(this.$videoElement,ss,(()=>{this.player.debug.log(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate),this.$videoElement&&this.$videoElement.paused&&(this.player.debug.warn(this.TAG_NAME,"ratechange and video is paused and sent isMSEPlaybackRateChangePause true"),this.player.isMSEPlaybackRateChangePause=!0)}));this.eventListenList.push(e),this.player.on(nt.visibilityChange,(e=>{e&&setTimeout((()=>{if(this.player.isPlaying()&&this.$videoElement){const e=this.getVideoBufferLastTime();e-this.$videoElement.currentTime>this.getBufferMaxDelayTime()&&(this.player.debug.log(this.TAG_NAME,`visibilityChange is true and lastTime is ${e} and currentTime is ${this.$videoElement.currentTime} so set currentTime to lastTime`),this.$videoElement.currentTime=e)}}),300)}))}this.player.debug.log("Video","init")}async destroy(){if(super.destroy(),this.clearCheckVideoCanplayTimeout(),this._cancelVideoFrameCallback(),this._removeProgressProxyDestroy(),this.eventListenList.length&&(this.eventListenList.forEach((e=>{e()})),this.eventListenList=[]),this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes=0,this.isRetryPlaying=!1,this.isRetryPlayingTimes=0,this.canplayReceived=!1,this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()){const e=this.player.$container;e.style.backdropFilter="none",e.style.transform="none"}if(this.$canvasElement.height=0,this.$canvasElement.width=0,this.$canvasElement=null,this.canvasContext=null,this.$videoElement){this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src"));try{this.$videoElement.load()}catch(e){}this.player.$container.removeChild(this.$videoElement),this.$videoElement=null}this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.vwriter&&(await this.vwriter.close(),this.vwriter=null),this._delayPlay=!1,this.mediaStream&&(this.mediaStream.getTracks().forEach((e=>e.stop())),this.mediaStream=null),this.off(),this.player.debug.log("Video","destroy")}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debug.log("Video","videoFrameCallback() and isDestroyedOrClosed and return");this.player.handleRender();const i=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)||0;if(this.player.isUseHls265UseMse())this.player.updateStats({fps:!0,ts:i});else if(this.player.isMseDecoderUseWorker()){this.player._times.videoStart||(this.player._times.videoStart=aa(),this.player.handlePlayToRenderTimes());const e=i+(this.player._mseWorkerData.firstRenderTime||0);if(this.player.updateStats({fps:!0,dfps:!0,ts:e,mseTs:i}),this.player.emit(nt.timeUpdate,e),po(this.getHasInit())&&t.width&&t.height){const e={width:t.width,height:t.height};this.updateVideoInfo(e),this.initCanvasViewSize()}}if(this.player.isWebrtcH264()||this.player.isOldHls()||this.player.isAliyunRtc()){if(this.player.emit(nt.timeUpdate,i),po(this.getHasInit())&&t.width&&t.height){const e={width:t.width,height:t.height};this.videoInfo.encTypeCode||this.player.isOldHls()||(e.encTypeCode=vt),this.updateVideoInfo(e)}this.player.updateStats({fps:!0,ts:i,dts:i}),this.player.updateCurrentPts(i),this.doAddContentToWatermark()}else if(uo(this.player._opt.useMSE)&&po(this.player._opt.mseUseCanvasRender)){if(this.player.mseDecoder){let e=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)+(this.player.mseDecoder.firstRenderTime||0);this.player.updateCurrentPts(e)}else if(this.player._opt.mseDecoderUseWorker){let e=parseInt(1e3*Math.max(t.mediaTime,this.getCurrentTime()),10)+(this.player._mseWorkerData.firstRenderTime||0);this.player.updateCurrentPts(e)}this.doAddContentToWatermark()}this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}fixChromeVideoFlashBug(){if(this.player._opt.videoRenderSupportScale&&this._isNeedAddBackDropFilter()){const e=this.player.$container;e.style.backdropFilter="blur(0px)",e.style.transform="translateZ(0)"}}fixMobileAutoFullscreen(){const e=ya(),t=fa();(e||t)&&(this.player.debug.log("Video",`fixMobileAutoFullscreen and isIOS ${e} and isAndroid ${t}`),this.$videoElement.setAttribute("webkit-playsinline","true"),this.$videoElement.setAttribute("playsinline","true"),this.$videoElement.setAttribute("x5-video-player-type","h5-page"))}_detectAndFixStuckPlayback(e){const t=this.$videoElement,i=t.buffered,s=t.readyState;this.player.debug.log(this.TAG_NAME,`_detectAndFixStuckPlayback() and isStalled is ${e} ,canplayReceived is ${this.canplayReceived} ,videoReadyState is ${s}`),e||po(this.canplayReceived)||s<2?i.length>0&&t.currentTime{if(this.clearCheckVideoCanplayTimeout(),!this.player.isDestroyedOrClosed()&&po(this.isPlaying())){const e=this._getBufferStore();this.player.debug.warn("Video",`checkVideoCanplayTimeout and video is not playing and buffer store is ${e} and retry play`),this.$videoElement.currentTime=e,this._replay()}}),1e3)));this._play()}}_play(){this.$videoElement&&this.$videoElement.play().then((()=>{this._delayPlay=!1,this.player.debug.log("Video","_play success"),this.isPlaying()?(this.player.emit(nt.removeLoadingBgImage),this.isRetryPlayingTimes=0,this.isRetryPlaying=!1):setTimeout((()=>{this._replay()}),100)})).catch((e=>{this.player.isDestroyedOrClosed()?this.player.debug.log("Video","_play error and player is isDestroyedOrClosed and return"):(this.player.debug.error("Video","_play error",e),this.isRetryPlaying=!1,setTimeout((()=>{this._replay()}),100))}))}_replay(){if(!this.isPlaying()&&po(this.player.isDestroyedOrClosed())&&po(this.isRetryPlaying)){if(this.isRetryPlaying=!0,this.isRetryPlayingTimes>=3)return void(this.player.isWebrtcH264()?(this.player.debug.error("Video",`_replay(webrtc H264) then but not playing and retry play times is ${this.isRetryPlayingTimes} and emit error`),this.player.emitError(ct.videoElementPlayingFailedForWebrtc)):(this.player.debug.error("Video",`_replay then but not playing and retry play times is ${this.isRetryPlayingTimes} and emit error to use canvas render`),this.player.emitError(ct.videoElementPlayingFailed)));this.player.debug.warn("Video",`_play then but not playing and retry play and isRetryPlayingTimes is ${this.isRetryPlayingTimes}`),this._play(),this.isRetryPlayingTimes++}else this.player.debug.log("Video",`_replay() and isPlaying is ${this.isPlaying()} and isRetryPlaying is ${this.isRetryPlaying} and isDestroyedOrClosed is ${this.player.isDestroyedOrClosed()} and return;`)}pause(e){this.player.debug.log(this.TAG_NAME,"pause and isNow is "+e),this.isPlaying()&&(e?(this.$videoElement&&this.$videoElement.pause(),this._cancelVideoFrameCallback()):setTimeout((()=>{this.$videoElement&&this.$videoElement.pause(),this._cancelVideoFrameCallback()}),100))}clearView(){super.clearView(),this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")))}screenshot(e,t,i,s){if(!this._canScreenshot())return this.player.debug.warn("Video",`screenshot failed, video is not ready and stats is ${this._getVideoReadyState()}`),null;e=e||aa(),s=s||gt.download;let r=.92;!Ji[t]&>[t]&&(s=t,t="png",i=void 0),"string"==typeof i&&(s=i,i=void 0),void 0!==i&&(r=Number(i));const a=this.$videoElement;let o=this.$canvasElement;o.width=a.videoWidth,o.height=a.videoHeight,this.canvasContext.drawImage(a,0,0,o.width,o.height);const n=Ji[t]||Ji.png,l=o.toDataURL(n,r);if(this.canvasContext.clearRect(0,0,o.width,o.height),o.width=0,o.height=0,s===gt.base64)return l;{const t=ra(l);if(s===gt.blob)return t;if(s===gt.download){const i=n.split("/")[1];No(t,e+"."+i)}}}screenshotWatermark(e){return new Promise(((t,i)=>{if($a(e)&&(e={filename:e}),!this._canScreenshot())return this.player.debug.warn("Video","screenshot failed, video is not ready"),i("screenshot failed, video is not ready");const s=this.$videoElement;(e=e||{}).width=s.videoWidth,e.height=s.videoHeight,e.filename=e.filename||aa(),e.format=e.format?Ji[e.format]:Ji.png,e.quality=Number(e.quality)||.92,e.type=e.type||gt.download;let r=this.$canvasElement;r.width=s.videoWidth,r.height=s.videoHeight,this.canvasContext.drawImage(s,0,0,r.width,r.height);const a=r.toDataURL(e.format,e.quality);this.canvasContext.clearRect(0,0,r.width,r.height),r.width=0,r.height=0,Ua(a,e).then((i=>{if(e.type===gt.base64)t(a);else{const s=ra(i);if(e.type===gt.blob)t(s);else if(e.type===gt.download){t();const i=e.format.split("/")[1];No(s,e.filename+"."+i)}}})).catch((e=>{i(e)}))}))}initCanvasViewSize(){this.resize()}clear(){const e=this.$videoElement,t=e.buffered,i=t.length?t.end(t.length-1):0;e.currentTime=i}render(e){if(this.vwriter){if(this.$videoElement.srcObject||(this.$videoElement.srcObject=this.mediaStream),this.isPaused()){const e=this._getVideoReadyState();if(this.player.debug.warn("Video","render() error, video is paused and readyState is "+e),4===e&&po(this.isRenderRetryPlaying)){if(this.isRenderRetryPlaying=!0,this.isRenderRetryPlayingTimes>3)return this.player.debug.error("Video","render() error, video is paused and readyState is "+e+", retry times is "+this.isRenderRetryPlayingTimes+", emit error and use canvas render"),void this.player.emitError(ct.videoElementPlayingFailed);this.$videoElement.play().then((()=>{this.isRenderRetryPlayingTimes=0,this.isRenderRetryPlaying=!1,this.player.debug.log("Video","render() video is paused and replay success")})).catch((e=>{this.isRenderRetryPlaying=!1,this.isRenderRetryPlayingTimes++,this.player.debug.warn("Video","render() error, video is paused and replay error ",e)}))}}if(this.player.updateStats({fps:!0,ts:e.ts||0}),e.videoFrame)this.vwriter.write(e.videoFrame),to(e.videoFrame);else if(e.output){let s=e.output;if(this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector){null===this.prevAiFaceDetectTime&&(this.prevAiFaceDetectTime=aa());const t=aa();t-this.prevAiFaceDetectTime>this.player._opt.aiFaceDetectInterval&&(s=this.player.ai.faceDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0}),this.prevAiFaceDetectTime=t)}if(this.player.objectDetectActive&&this.player.ai&&this.player.ai.objectDetector){null===this.prevAiObjectDetectTime&&(this.prevAiObjectDetectTime=aa());const t=aa();t-this.prevAiObjectDetectTime>this.player._opt.aiObjectDetectInterval&&(s=this.player.ai.objectDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0}),this.prevAiObjectDetectTime=t)}if(this.player.occlusionDetectActive&&this.player.ai&&this.player.ai.occlusionDetector){null===this.prevAiOcclusionDetectTime&&(this.prevAiOcclusionDetectTime=aa());const t=aa();if(t-this.prevAiOcclusionDetectTime>=this.player._opt.aiOcclusionDetectInterval){const i=this.player.ai.occlusionDetector.check({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0});this.prevAiOcclusionDetectTime=t,i&&(this.player.debug.log("Video","render() and ai occlusion detect result is true"),this.player.emit(nt.aiOcclusionDetectResult,{ts:e.ts||0}))}}if(this.player.imageDetectActive&&this.player.ai&&this.player.ai.imageDetector){const t=this.player.ai.imageDetector.check({width:this.videoInfo.width,height:this.videoInfo.height,data:e.output,ts:e.ts||0});if(t&&t.data&&(this.player.emit(nt.aiOcclusionDetectResult,{type:t.type,ts:e.ts||0}),this.player._opt.aiImageDetectDrop))return void this.player.debug.log("Video",`render() and ai image detect result type is ${t.type} and drop`)}try{const r=(t=s,i={format:"I420",codedWidth:this.videoInfo.width,codedHeight:this.videoInfo.height,timestamp:e.ts},new VideoFrame(t,i));this.vwriter.write(r),to(r)}catch(e){this.player.debug.error("Video","render error",e),this.player.emitError(ct.wasmUseVideoRenderError,e)}}this.player.updateCurrentPts(e.ts||0),this.doAddContentToWatermark(),this.doAddAiContentToWatermark()}else this.player.debug.warn("Video","render and this.vwriter is null");var t,i}_resize(){this.player.debug.log("Video","_resize()");let e=this.player.width,t=this.player.height;const i=this.player._opt,s=i.rotate;if(i.hasControl&&!i.controlAutoHide){const s=i.playType===_?Yt:Kt;ua()&&this.player.fullscreen&&i.useWebFullScreen?e-=s:t-=s}this.$videoElement.width=e,this.$videoElement.height=t,this.$videoElement.style.width=e+"px",this.$videoElement.style.height=t+"px",270!==s&&90!==s||(this.$videoElement.width=t,this.$videoElement.height=e,this.$videoElement.style.width=t+"px",this.$videoElement.style.height=e+"px");let r=(e-this.$videoElement.width)/2,a=(t-this.$videoElement.height)/2,o="contain";po(i.isResize)&&(o="fill"),i.isFullResize&&(o="none");let n="";"none"===i.mirrorRotate&&s&&(n+=" rotate("+s+"deg)"),"level"===i.mirrorRotate?n+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(n+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$videoElement.style.objectFit=o),this.$videoElement.style.transform=n,this.$videoElement.style.padding="0",this.$videoElement.style.left=r+"px",this.$videoElement.style.top=a+"px"}getType(){return W}getCurrentTime(){return this.$videoElement.currentTime}isPlaying(){return this.$videoElement&&po(this.$videoElement.paused)&&po(this.$videoElement.ended)&&0!==this.$videoElement.playbackRate&&0!==this.$videoElement.readyState}_canScreenshot(){return this.$videoElement&&this.$videoElement.readyState>=1}getPlaybackQuality(){let e=null;if(this.$videoElement){if(Ya(this.$videoElement.getVideoPlaybackQuality)){const t=this.$videoElement.getVideoPlaybackQuality();e={droppedVideoFrames:t.droppedVideoFrames||t.corruptedVideoFrames,totalVideoFrames:t.totalVideoFrames,creationTime:t.creationTime}}else e={droppedVideoFrames:this.$videoElement.webkitDroppedFrameCount,totalVideoFrames:this.$videoElement.webkitDecodedFrameCount,creationTime:aa()};e&&(e.renderedVideoFrames=e.totalVideoFrames-e.droppedVideoFrames)}return e}setRate(e){this.$videoElement&&(this.$videoElement.playbackRate=e)}get rate(){let e=1;return this.$videoElement&&(e=this.$videoElement.playbackRate),e}clearCheckVideoCanplayTimeout(){this.checkVideoCanplayTimeout&&(clearTimeout(this.checkVideoCanplayTimeout),this.checkVideoCanplayTimeout=null)}_cancelVideoFrameCallback(){this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null)}_getBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.buffered.start(0)),t}_handleUpdatePlaybackRate(){const e=this.$videoElement,t=e.buffered;t.length&&t.start(0);const i=t.length?t.end(t.length-1):0;let s=e.currentTime;const r=i-s,a=this.getBufferMaxDelayTime();if(this.player.updateStats({mseVideoBufferDelayTime:r}),r>a)this.player.debug.log(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current is ${s} , delay buffer is more than ${a} is ${r} and new time is ${i}`),e.currentTime=i,s=e.currentTime;else if(r<0){if(this.player.debug.warn(this.TAG_NAME,`handleUpdatePlaybackRate and delay buffer is ${i} - current is ${s} = ${r} < 0 and check video is paused : ${e.paused} `),0===i)return void this.player.emit(ct.mediaSourceBufferedIsZeroError,"video.buffered is empty");e.paused&&e.play()}const o=this._getPlaybackRate(i-s);e.playbackRate!==o&&(this.player.debug.log(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current time is ${s} and delay is ${i-s} set playbackRate is ${o} `),e.playbackRate=o)}_getPlaybackRate(e){const t=this.$videoElement;let i=this.player._opt.videoBufferDelay+this.player._opt.videoBuffer;const s=Math.max(i,1e3),r=s/2;return e*=1e3,1===t.playbackRate?e>s?1.2:1:e<=r?1:t.playbackRate}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}getVideoBufferLastTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;i.length&&i.start(0);t=i.length?i.end(i.length-1):0}return t}getVideoBufferDelayTime(){const e=this.$videoElement;const t=this.getVideoBufferLastTime()-e.currentTime;return t>0?t:0}checkSourceBufferDelay(){const e=this.$videoElement;let t=0,i=0;return e.buffered.length>0&&(i=e.buffered.end(e.buffered.length-1),t=i-e.currentTime),t<0&&(this.player.debug.warn(this.TAG_NAME,`checkVideoSourceBufferDelay ${t} < 0, and buffered is ${i} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${i}`),e.currentTime=i,t=0),t}checkSourceBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.currentTime-e.buffered.start(0)),t}getDecodePlaybackRate(){let e=0;const t=this.$videoElement;return t&&(e=t.playbackRate),e}getBufferMaxDelayTime(){let e=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3;return Math.max(5,e+3)}getReadyStateInited(){return this._getVideoReadyState()>=1}}class Vo extends zo{constructor(e){super(e),this.controlHeight=Yt,this.bufferList=[],this.playing=!1,this.playInterval=null,this.fps=1,this.preFps=1,this.streamFps=0,this.playbackRate=1,this._firstTimestamp=null,this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,this.player.on(nt.playbackPause,(e=>{e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()})),this.player.debug.log("CanvasPlaybackLoader","init")}async destroy(){this._stopSync(),this._firstTimestamp=null,this.playing=!1,this.playbackRate=1,this.fps=1,this.preFps=1,this.bufferList=[],this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,super.destroy(),this.player.debug.log("CanvasPlaybackLoader","destroy")}_initCanvasRender(){this.player._opt.useWCS?(this.renderType=ei,yo()&&this.player._opt.wcsUseWebgl2Render?(this._initContextGl2(),this.webglRender&&(this.isWcsWebgl2=!0)):this._initContext2D()):this.player._opt.useWebGPU?(this.renderType=si,this._initContextGPU()):(this.renderType=ti,this._initContextGl())}_sync(){this._stopSync(),this._doPlay(),this.playInterval=setInterval((()=>{this._doPlay()}),this.fragDuration)}_doPlay(){if(this.bufferList.length>0&&!this.player.seeking){const e=this.bufferList.shift();e&&e.buffer&&(this._doRender(e.buffer),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:e.tfTs}))}}_stopSync(){this.playInterval&&(clearInterval(this.playInterval),this.playInterval=null)}_doRender(e){if(this.player._opt.useWCS)if(this.webglRender)this.webglRender.render(e),to(e);else if(Ya(e.createImageBitmap))try{e.createImageBitmap().then((t=>{this.context2D.drawImage(t,0,0,this.$videoElement.width,this.$videoElement.height),to(e)}))}catch(e){}else this.context2D.drawImage(e,0,0,this.$videoElement.width,this.$videoElement.height),to(e);else if(this.getCanvasType()===ti)try{this.webglRender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(e){this.player.debug.error("CanvasPlaybackLoader",`doRender webgl render context is lost ${this.contextGl&&this.contextGl.isContextLost()} and error: ${e.toString()}`)}else if(this.getCanvasType()===si)try{if(!this.webGPURender)return void this.player.debug.warn("CanvasVideoLoader","doRender webgpu render is not init");this.webGPURender.renderYUV(this.$videoElement.width,this.$videoElement.height,e)}catch(e){this.player.debug.error("CanvasPlaybackLoader",`doRender webgpu render and error: ${e.toString()}`)}}get rate(){return this.playbackRate}get fragDuration(){return Math.ceil(1e3/(this.fps*this.playbackRate))}get bufferSize(){return this.bufferList.length}getStreamFps(){return this.streamFps}initFps(){this._hasCalcFps?this.player.debug.log("CanvasPlaybackLoader","initFps, has calc fps"):(this.preFps=oa(this.player.playback.fps,1,100),this.fps=this.preFps)}setFps(e){e!==this.fps?(e>100&&this.player.debug.warn("CanvasPlaybackLoader","setFps max",e),e<0&&this.player.debug.warn("CanvasPlaybackLoader","setFps min",e),this.fps=oa(e,1,100),this.player.debug.log("CanvasPlaybackLoader",`setFps ${this.preFps} -> ${this.fps}`),this.player.playback.isUseFpsRender&&this._sync()):this.player.debug.log("CanvasPlaybackLoader",`setFps, same fps ${e}`)}setStreamFps(e){this.player.debug.log("CanvasPlaybackLoader","setStreamFps",e),this._hasCalcFps=!0,this.streamFps=e,this.preFps=e,this.setFps(e)}setRate(e){e!==this.playbackRate&&(this.playbackRate=e,this.player.playback.isUseFpsRender&&this._sync())}render$2(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);const t={tfTs:e.ts-this._firstTimestamp,ts:e.ts};e.videoFrame?t.buffer=e.videoFrame:t.buffer=e.output,this.bufferList.push(t),this.startRender(),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:t.tfTs})}startRender(){for(;!(this.bufferList.length<=0);){const e=this.bufferList.shift();this._doRender(e.buffer)}}pushData(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);const t={tfTs:e.ts-this._firstTimestamp,ts:e.ts};e.videoFrame?t.buffer=e.videoFrame:t.buffer=e.output;const i=this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender;if(i||this.bufferSize>this.fps*this.playbackRate*2&&(this.player.debug.warn("CanvasPlaybackLoader",`buffer size is ${this.bufferSize}`),this._doPlay()),this.bufferList.push(t),!this._hasCalcFps){const e=ro(this.bufferList);null!==e&&e!==this.preFps&&(this.player.debug.log("CanvasPlaybackLoader",`calc fps is ${e} pre fps is ${this.preFps} and updatePreFps`),this.setStreamFps(e))}if(!i){const e=this.bufferList.length,t=e/(this.fps*this.playbackRate);this.player.debug.log("CanvasPlaybackLoader","rate is",t),t<=1?this.setFps(this.preFps):(this.setFps(this.fps+Math.floor(t*this.playbackRate)),this.player.debug.warn("CanvasPlaybackLoader","rate is",t,"fps is",this.fps,"bufferListLength is",e))}}initVideo(){this.player.playback&&this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}initVideoDelay(){const e=this.player._opt.playbackDelayTime;e>0?this.delayTimeout=setTimeout((()=>{this.initVideo()}),e):this.initVideo()}clearView(){super.clearView(),this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT)}clear(){this.player._opt.useWCS&&this.bufferList.forEach((e=>{e.buffer&&to(e.buffer)})),this.bufferList=[]}resume(){this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}pause(){this.player.playback.isUseFpsRender&&this._stopSync(),this.playing=!1}}class $o{constructor(e){return new($o.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.useMSE?e.mseUseCanvasRender?Go:Ho:e.isHls&&po(e.supportHls265)||e.isWebrtc&&po(e.isWebrtcH265)?e.useCanvasRender?Go:Ho:e.isAliyunRtc?Ho:e.useWCS?e.playType===_?Vo:!e.useOffscreen&&e.wcsUseVideoRender?Ho:Go:e.playType===_?Vo:e.wasmUseVideoRender&&!e.useOffscreen?Ho:Go}}class Wo extends So{constructor(e){super(),this.bufferList=[],this.player=e,this.$audio=null,this.scriptNode=null,this.workletProcessorNode=null,this.workletWorkerCloseTimeout=null,this.hasInitScriptNode=!1,this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:48e3}),this.gainNode=this.audioContext.createGain();const t=this.audioContext.createBufferSource();t.buffer=this.audioContext.createBuffer(1,1,22050),t.connect(this.audioContext.destination),t.noteOn?t.noteOn(0):t.start(0),this.audioBufferSourceNode=t,this.mediaStreamAudioDestinationNode=this.audioContext.createMediaStreamDestination(),this.gainNode.gain.value=0,this._prevVolume=null,this.playing=!1,this.audioInfo={encTypeCode:"",encType:"",channels:"",sampleRate:"",depth:""},this.init=!1,this.hasAudio=!1,this.audioResumeStateTimeout=null}async destroy(){return this.closeAudio(),this.resetInit(),this.clearAudioResumeStateTimeout(),this.audioContext&&(await this.audioContext.close(),this.audioContext=null),this.gainNode&&(this.gainNode.disconnect(),this.gainNode=null),this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.disconnect(),this.scriptNode.onaudioprocess=ta,this.scriptNode=null),await this._destroyWorklet(),this.workletProcessorNode&&(this.workletProcessorNode.disconnect(),this.workletProcessorNode.port.onmessage=ta,this.workletProcessorNode=null),this.audioBufferSourceNode&&(this.audioBufferSourceNode.stop(),this.audioBufferSourceNode=null),this.mediaStreamAudioDestinationNode&&(this.mediaStreamAudioDestinationNode.disconnect(),this.mediaStreamAudioDestinationNode=null),this.hasInitScriptNode=!1,this._prevVolume=null,this.off(),!0}_destroyWorklet(){return new Promise(((e,t)=>{this.workletProcessorNode?(this.workletProcessorNode.port.postMessage({type:"destroy"}),this.workletWorkerCloseTimeout=setTimeout((()=>{this.player.debug.log(this.TAG_NAME,"send close and wait 10ms destroy directly"),this.workletWorkerCloseTimeout&&(clearTimeout(this.workletWorkerCloseTimeout),this.workletWorkerCloseTimeout=null),e()}),10)):e()}))}resetInit(){this.audioInfo={encTypeCode:"",encType:"",channels:"",sampleRate:"",depth:""},this.init=!1}getAudioInfo(){return this.audioInfo}updateAudioInfo(e){e.encTypeCode&&(this.audioInfo.encTypeCode=e.encTypeCode,this.audioInfo.encType=Ct[e.encTypeCode]),e.channels&&(this.audioInfo.channels=e.channels),e.sampleRate&&(this.audioInfo.sampleRate=e.sampleRate),e.depth&&(this.audioInfo.depth=e.depth),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(nt.audioInfo,this.audioInfo),this.init=!0)}get isPlaying(){return this.playing}get isMute(){return 0===this.gainNode.gain.value}get volume(){return this.gainNode.gain.value}get bufferSize(){return this.bufferList.length}get audioContextState(){let e=null;return this.audioContext&&(e=this.audioContext.state),e}initScriptNode(){}initMobileScriptNode(){}initWorkletScriptNode(){}getEngineType(){return""}mute(e){e?(this.setVolume(0),this.clear()):this.setVolume(this.player.lastVolume||.5)}setVolume(e){e=parseFloat(e).toFixed(2),isNaN(e)||(this.audioEnabled(!0),e=oa(e,0,1),null===this._prevVolume?this.player.emit(nt.mute,0===e):0===this._prevVolume&&e>0?this.player.emit(nt.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(nt.mute,!0),this.gainNode.gain.value=e,this.player.emit(nt.volumechange,this.player.volume),this.player.emit(nt.volume,this.player.volume),this._prevVolume=e)}closeAudio(){this.hasInitScriptNode&&(this.scriptNode&&this.scriptNode.disconnect(this.gainNode),this.workletProcessorNode&&this.workletProcessorNode.disconnect(this.gainNode),this.gainNode&&(this.gainNode.disconnect(this.mediaStreamAudioDestinationNode),this.$audio||this.gainNode.disconnect(this.audioContext.destination))),this.clear()}audioEnabled(e){e?this.isStateSuspended()&&(this.audioContext.resume().then((()=>{this.player.emit(nt.audioResumeState,{state:this.audioContextState,isRunning:this.isStateRunning()})})),this.audioResumeStateTimeout=setTimeout((()=>{this.clearAudioResumeStateTimeout(),this.isStateSuspended()&&this.player.emit(nt.audioResumeState,{state:this.audioContextState,isRunning:this.isStateRunning()})}),1e3)):this.isStateRunning()&&this.audioContext.suspend()}isStateRunning(){return"running"===this.audioContextState}isStateSuspended(){return"suspended"===this.audioContextState}clearAudioResumeStateTimeout(){this.audioResumeStateTimeout&&(clearTimeout(this.audioResumeStateTimeout),this.audioResumeStateTimeout=null)}clear(){this.bufferList=[]}play(e,t){}pause(){this.playing=!1}resume(){this.playing=!0}setRate(e){}getAudioBufferSize(){return 0}}class Jo{constructor(e,t,i,s){this.player=e,this.audio=t,this.channel=i,this.bufferSize=s}destroy(){this.buffer=null,this.channel=null}extract(e,t){let i=this.provide(t);for(let t=0;t=o){try{for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:0;const s=2*(t=t||0);i>=0||(i=(e.length-s)/2);const r=2*i;this.ensureCapacity(i+this._frameCount);const a=this.endIndex;this.vector.set(e.subarray(s,s+r),a),this._frameCount+=i}putBuffer(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t=t||0,i>=0||(i=e.frameCount-t),this.putSamples(e.vector,e.position+t,i)}receive(e){e>=0&&!(e>this._frameCount)||(e=this.frameCount),this._frameCount-=e,this._position+=e}receiveSamples(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=2*t,s=this.startIndex;e.set(this._vector.subarray(s,s+i)),this.receive(t)}extract(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.startIndex+2*t,r=2*i;e.set(this._vector.subarray(s,s+r))}ensureCapacity(){const e=parseInt(2*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0));if(this._vector.length0&&void 0!==arguments[0]?arguments[0]:0;this.ensureCapacity(this._frameCount+e)}rewind(){this._position>0&&(this._vector.set(this._vector.subarray(this.startIndex,this.endIndex)),this._position=0)}}class Ko{constructor(e){e?(this._inputBuffer=new qo,this._outputBuffer=new qo):this._inputBuffer=this._outputBuffer=null}destroy(){this.clear(),this._outputBuffer&&(this._outputBuffer.destroy(),this._outputBuffer=null),this._inputBuffer&&(this._inputBuffer.destroy(),this._inputBuffer=null)}get inputBuffer(){return this._inputBuffer}set inputBuffer(e){this._inputBuffer=e}get outputBuffer(){return this._outputBuffer}set outputBuffer(e){this._outputBuffer=e}clear(){this._inputBuffer.clear(),this._outputBuffer.clear()}}class Yo extends Ko{constructor(e){super(e),this.reset(),this._rate=1}destroy(){super.destroy()}set rate(e){this._rate=e}reset(){this.slopeCount=0,this.prevSampleL=0,this.prevSampleR=0}clone(){const e=new Yo;return e.rate=this._rate,e}process(){const e=this._inputBuffer.frameCount;this._outputBuffer.ensureAdditionalCapacity(e/this._rate+1);const t=this.transpose(e);this._inputBuffer.receive(),this._outputBuffer.put(t)}transpose(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(0===e)return 0;const t=this._inputBuffer.vector,i=this._inputBuffer.startIndex,s=this._outputBuffer.vector,r=this._outputBuffer.endIndex;let a=0,o=0;for(;this.slopeCount<1;)s[r+2*o]=(1-this.slopeCount)*this.prevSampleL+this.slopeCount*t[i],s[r+2*o+1]=(1-this.slopeCount)*this.prevSampleR+this.slopeCount*t[i+1],o+=1,this.slopeCount+=this._rate;if(this.slopeCount-=1,1!==e)e:for(;;){for(;this.slopeCount>1;)if(this.slopeCount-=1,a+=1,a>=e-1)break e;const n=i+2*a;s[r+2*o]=(1-this.slopeCount)*t[n]+this.slopeCount*t[n+2],s[r+2*o+1]=(1-this.slopeCount)*t[n+1]+this.slopeCount*t[n+3],o+=1,this.slopeCount+=this._rate}return this.prevSampleL=t[i+2*e-2],this.prevSampleR=t[i+2*e-1],o}}class Qo{constructor(e){this._pipe=e}destroy(){}get pipe(){return this._pipe}get inputBuffer(){return this._pipe.inputBuffer}get outputBuffer(){return this._pipe.outputBuffer}fillInputBuffer(){throw new Error("fillInputBuffer() not overridden")}fillOutputBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;for(;this.outputBuffer.frameCount2&&void 0!==arguments[2]?arguments[2]:Xo;super(t),this.callback=i,this.sourceSound=e,this.historyBufferSize=22050,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}destroy(){this.clear(),this.sourceSound.destroy(),this.sourceSound=null,this._sourcePosition=0,this.outputBufferPosition=0,this._position=0}get position(){return this._position}set position(e){if(e>this._position)throw new RangeError("New position may not be greater than current position");const t=this.outputBufferPosition-(this._position-e);if(t<0)throw new RangeError("New position falls outside of history buffer");this.outputBufferPosition=t,this._position=e}get sourcePosition(){return this._sourcePosition}set sourcePosition(e){this.clear(),this._sourcePosition=e}onEnd(){this.callback()}fillInputBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=new Float32Array(2*e),i=this.sourceSound.extract(t,e,this._sourcePosition);this._sourcePosition+=i,this.inputBuffer.putSamples(t,0,i)}extract(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillOutputBuffer(this.outputBufferPosition+t);const i=Math.min(t,this.outputBuffer.frameCount-this.outputBufferPosition);this.outputBuffer.extract(e,this.outputBufferPosition,i);const s=this.outputBufferPosition+i;return this.outputBufferPosition=Math.min(this.historyBufferSize,s),this.outputBuffer.receive(Math.max(s-this.historyBufferSize,0)),this._position+=i,i}handleSampleData(e){this.extract(e.data,4096)}clear(){super.clear(),this.outputBufferPosition=0}}const en=[[124,186,248,310,372,434,496,558,620,682,744,806,868,930,992,1054,1116,1178,1240,1302,1364,1426,1488,0],[-100,-75,-50,-25,25,50,75,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-20,-15,-10,-5,5,10,15,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-4,-3,-2,-1,1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],tn=-10/1.5;class sn extends Ko{constructor(e){super(e),this._quickSeek=!0,this.midBufferDirty=!1,this.midBuffer=null,this.refMidBuffer=null,this.overlapLength=0,this.autoSeqSetting=!0,this.autoSeekSetting=!0,this._tempo=1,this.setParameters(44100,0,0,8)}destroy(){this.clear(),super.destroy()}clear(){super.clear(),this.clearMidBuffer(),this.refMidBuffer=null}clearMidBuffer(){this.midBufferDirty&&(this.midBufferDirty=!1),this.midBuffer=null}setParameters(e,t,i,s){e>0&&(this.sampleRate=e),s>0&&(this.overlapMs=s),t>0?(this.sequenceMs=t,this.autoSeqSetting=!1):this.autoSeqSetting=!0,i>0?(this.seekWindowMs=i,this.autoSeekSetting=!1):this.autoSeekSetting=!0,this.calculateSequenceParameters(),this.calculateOverlapLength(this.overlapMs),this.tempo=this._tempo}set tempo(e){let t;this._tempo=e,this.calculateSequenceParameters(),this.nominalSkip=this._tempo*(this.seekWindowLength-this.overlapLength),this.skipFract=0,t=Math.floor(this.nominalSkip+.5),this.sampleReq=Math.max(t+this.overlapLength,this.seekWindowLength)+this.seekLength}get tempo(){return this._tempo}get inputChunkSize(){return this.sampleReq}get outputChunkSize(){return this.overlapLength+Math.max(0,this.seekWindowLength-2*this.overlapLength)}calculateOverlapLength(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;e=this.sampleRate*t/1e3,e=e<16?16:e,e-=e%8,this.overlapLength=e,this.refMidBuffer=new Float32Array(2*this.overlapLength),this.midBuffer=new Float32Array(2*this.overlapLength)}checkLimits(e,t,i){return ei?i:e}calculateSequenceParameters(){let e,t;this.autoSeqSetting&&(e=150+-50*this._tempo,e=this.checkLimits(e,50,125),this.sequenceMs=Math.floor(e+.5)),this.autoSeekSetting&&(t=28.333333333333332+tn*this._tempo,t=this.checkLimits(t,15,25),this.seekWindowMs=Math.floor(t+.5)),this.seekWindowLength=Math.floor(this.sampleRate*this.sequenceMs/1e3),this.seekLength=Math.floor(this.sampleRate*this.seekWindowMs/1e3)}set quickSeek(e){this._quickSeek=e}clone(){const e=new sn;return e.tempo=this._tempo,e.setParameters(this.sampleRate,this.sequenceMs,this.seekWindowMs,this.overlapMs),e}seekBestOverlapPosition(){return this._quickSeek?this.seekBestOverlapPositionStereoQuick():this.seekBestOverlapPositionStereo()}seekBestOverlapPositionStereo(){let e,t,i,s=0;for(this.preCalculateCorrelationReferenceStereo(),e=0,t=Number.MIN_VALUE;st&&(t=i,e=s);return e}seekBestOverlapPositionStereoQuick(){let e,t,i,s,r,a=0;for(this.preCalculateCorrelationReferenceStereo(),t=Number.MIN_VALUE,e=0,s=0,r=0;a<4;a+=1){let o=0;for(;en[a][o]&&(r=s+en[a][o],!(r>=this.seekLength));)i=this.calculateCrossCorrelationStereo(2*r,this.refMidBuffer),i>t&&(t=i,e=r),o+=1;s=e}return e}preCalculateCorrelationReferenceStereo(){let e,t,i=0;for(;i=this.sampleReq;){e=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(e)),this._outputBuffer.put(this.overlapLength),t=this.seekWindowLength-2*this.overlapLength,t>0&&this._outputBuffer.putBuffer(this._inputBuffer,e+this.overlapLength,t);const s=this._inputBuffer.startIndex+2*(e+this.seekWindowLength-this.overlapLength);this.midBuffer.set(this._inputBuffer.vector.subarray(s,s+2*this.overlapLength)),this.skipFract+=this.nominalSkip,i=Math.floor(this.skipFract),this.skipFract-=i,this._inputBuffer.receive(i)}}}const rn=function(e,t){return(e>t?e-t:t-e)>1e-10};class an{constructor(){this.transposer=new Yo(!1),this.stretch=new sn(!1),this._inputBuffer=new qo,this._intermediateBuffer=new qo,this._outputBuffer=new qo,this._rate=0,this._tempo=0,this.virtualPitch=1,this.virtualRate=1,this.virtualTempo=1,this.calculateEffectiveRateAndTempo()}destroy(){this.clear(),this._inputBuffer.destroy(),this._intermediateBuffer.destroy(),this._outputBuffer.destroy(),this._inputBuffer=null,this._intermediateBuffer=null,this._outputBuffer=null}clear(){this.transposer.clear(),this.stretch.clear()}clone(){const e=new an;return e.rate=this.rate,e.tempo=this.tempo,e}get rate(){return this._rate}set rate(e){this.virtualRate=e,this.calculateEffectiveRateAndTempo()}set rateChange(e){this._rate=1+.01*e}get tempo(){return this._tempo}set tempo(e){this.virtualTempo=e,this.calculateEffectiveRateAndTempo()}set tempoChange(e){this.tempo=1+.01*e}set pitch(e){this.virtualPitch=e,this.calculateEffectiveRateAndTempo()}set pitchOctaves(e){this.pitch=Math.exp(.69314718056*e),this.calculateEffectiveRateAndTempo()}set pitchSemitones(e){this.pitchOctaves=e/12}get inputBuffer(){return this._inputBuffer}get outputBuffer(){return this._outputBuffer}calculateEffectiveRateAndTempo(){const e=this._tempo,t=this._rate;this._tempo=this.virtualTempo/this.virtualPitch,this._rate=this.virtualRate*this.virtualPitch,rn(this._tempo,e)&&(this.stretch.tempo=this._tempo),rn(this._rate,t)&&(this.transposer.rate=this._rate),this._rate>1?this._outputBuffer!=this.transposer.outputBuffer&&(this.stretch.inputBuffer=this._inputBuffer,this.stretch.outputBuffer=this._intermediateBuffer,this.transposer.inputBuffer=this._intermediateBuffer,this.transposer.outputBuffer=this._outputBuffer):this._outputBuffer!=this.stretch.outputBuffer&&(this.transposer.inputBuffer=this._inputBuffer,this.transposer.outputBuffer=this._intermediateBuffer,this.stretch.inputBuffer=this._intermediateBuffer,this.stretch.outputBuffer=this._outputBuffer)}process(){this._rate>1?(this.stretch.process(),this.transposer.process()):(this.transposer.process(),this.stretch.process())}}class on{constructor(e,t,i){this.player=e,this.audio=t,this.soundTouch=new an,this.soundTouch.tempo=1,this.soundTouch.rate=1,this.filter=new Zo(i,this.soundTouch)}destroy(){this.filter&&(this.filter.destroy(),this.filter=null),this.soundTouch&&(this.soundTouch.destroy(),this.soundTouch=null)}setRate(e){e!==this.soundTouch.rate&&(this.soundTouch.tempo=e)}provide(e){let t=new Float32Array(2*e),i=this.filter.extract(t,e),s=new Float32Array(i),r=new Float32Array(i);for(let e=0;e{e()})),this.eventListenList=[]),this.$audio&&(this.$audio.pause(),this.$audio.srcObject=null,this.$audio.parentNode&&this.$audio.parentNode.removeChild(this.$audio),this.$audio=null),this.processor&&(this.processor.destroy(),this.processor=null),this.rateProcessor&&(this.rateProcessor.destroy(),this.rateProcessor=null),this.scriptNodeInterval&&(clearInterval(this.scriptNodeInterval),this.scriptNodeInterval=null),this.defaultPlaybackRate=1,this.playbackRate=1,this.scriptStartTime=0,this.audioBufferSize=0,this.engineType=Us,this.player.debug.log("AudioContext","destroy"),!0}isAudioPlaying(){return this.$audio&&po(this.$audio.paused)&&po(this.$audio.ended)&&0!==this.$audio.playbackRate&&0!==this.$audio.readyState}_bindAudioProxy(){const{proxy:e}=this.player.events,t=e(this.$audio,"canplay",(()=>{this.player.debug.log("AudioContext","canplay"),this._delayPlay&&this._audioElementPlay()}));this.eventListenList.push(t)}_getAudioElementReadyState(){let e=0;return this.$audio&&(e=this.$audio.readyState),e}audioElementPlay(){if(this.$audio){const e=this._getAudioElementReadyState();if(this.player.debug.log("AudioContext",`play and readyState: ${e}`),!(0!==e||Wa()&&ya()))return this.player.debug.warn("AudioContext","readyState is 0 and set _delayPlay to true"),void(this._delayPlay=!0);this._audioElementPlay()}}_audioElementPlay(){this.$audio&&this.$audio.play().then((()=>{this._delayPlay=!1,this.player.debug.log("AudioContext","_audioElementPlay success"),setTimeout((()=>{this.isAudioPlaying()||(this.player.debug.warn("AudioContext","play failed and retry play"),this._audioElementPlay())}),100),this.isAudioPlaying()&&(this.player.debug.log("AudioContext","play success and remove document click event listener"),document.removeEventListener("click",this._audioElementPlay.bind(this)))})).catch((e=>{this.player.debug.error("AudioContext","_audioElementPlay error",e),document.addEventListener("click",this._audioElementPlay.bind(this))}))}getAudioBufferSize(){return this.audioBufferSize}get oneBufferDuration(){return this.audioBufferSize/this.audioContext.sampleRate*1e3}get isActiveEngineType(){return this.engineType===Fs}getBufferListDuration(){return this.bufferList.length*this.oneBufferDuration}isMoreThanMinBufferDuration(){return this.getBufferListDuration()>=100*this.playbackRate}initProcessor(){this.processor=new Jo(this.player,this,this.audioInfo.channels,this.audioBufferSize),this.rateProcessor=new on(this.player,this,this.processor)}getAutoAudioEngineType(){let e=this.player._opt.audioEngine||Us;const t=()=>{e=Wa()&&fa()?Fs:(ya()&&this.player._opt.supportLockScreenPlayAudio||io()&&this.supportAudioWorklet(),Us)};return this.player._opt.audioEngine?this.player._opt.audioEngine===Ms&&io()&&this.supportAudioWorklet()?e=Ms:this.player._opt.audioEngine===Fs?e=Fs:this.player._opt.audioEngine===Us?e=Us:t():t(),e}getAudioBufferSizeByType(){const e=this.engineType;this.player._opt.hasVideo;const t=this.player._opt.weiXinInAndroidAudioBufferSize;return e===Ms?1024:e===Fs?t||4800:1024}supportAudioWorklet(){return this.audioContext&&this.audioContext.audioWorklet}initScriptNode(){this.playing=!0,this.hasInitScriptNode||(this.initProcessor(),this.engineType===Ms?this.initWorkletScriptNode():this.engineType===Fs?this.initIntervalScriptNode():this.engineType===Us&&this.initProcessScriptNode(),this.audioElementPlay())}getEngineType(){return this.engineType}isPlaybackRateSpeed(){return this.playbackRate>this.defaultPlaybackRate}initProcessScriptNode(){const e=this.audioContext.createScriptProcessor(this.audioBufferSize,0,this.audioInfo.channels);e.onaudioprocess=e=>{const t=e.outputBuffer;this.handleScriptNodeCallback(t)},e.connect(this.gainNode),this.scriptNode=e,this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0}initIntervalScriptNode(){this.scriptStartTime=0;const e=1e3*this.audioBufferSize/this.audioContext.sampleRate;this.scriptNodeInterval=setInterval((()=>{if(0===this.bufferList.length||po(this.playing)||this.isMute)return void(this.playing&&po(this.isMute)&&this.player.debug.log("AudioContext",`interval script node and bufferList is ${this.bufferList.length} or playing is ${this.playing}`));const e=this.audioContext.createBufferSource(),t=this.audioContext.createBuffer(this.audioInfo.channels,this.audioBufferSize,this.audioContext.sampleRate);this.handleScriptNodeCallback(t,(()=>{this.scriptStartTime{"init"===e.data.message?(this.audioBufferSize=e.data.audioBufferSize,this.start=e.data.start,this.channels=e.data.channels,this.state=0,this.offset=0,this.samplesArray=[]):"stop"===e.data.message?(this.state=0,this.start=!1,this.offset=0,this.samplesArray=[]):"data"===e.data.message?this.samplesArray.push(e.data.buffer):"zero"===e.data.message&&this.samplesArray.push({left:new Float32Array(this.audioBufferSize).fill(0),right:new Float32Array(this.audioBufferSize).fill(0)})}}process(e,t,i){const s=t[0][0],r=t[0][1];if(0===this.offset&&this.port.postMessage({message:"beep"}),0===this.state)this.state=1;else if(1===this.state&&this.samplesArray.length>=4)this.state=2;else if(2===this.state){const e=this.samplesArray[0];for(let t=0;t{if(this.player.isDestroyedOrClosed())return void this.player.debug.log("AudioContext","initWorkletScriptNode() player is destroyed");if(!this.audioContext)return void this.player.debug.warn("AudioContext","initWorkletScriptNode audioContext is null");let e=[1];2===this.audioInfo.channels&&(e=[1,1]);try{this.workletProcessorNode=new AudioWorkletNode(this.audioContext,"worklet-processor",{numberOfOutputs:this.audioInfo.channels,outputChannelCount:e})}catch(e){this.player.debug.error("AudioContext","initWorkletScriptNode error",e),this.workletProcessorNode=null,this.tierDownToProcessScript()}this.workletProcessorNode&&(this.workletProcessorNode.connect(this.gainNode),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.$audio?this.$audio.srcObject=this.mediaStreamAudioDestinationNode.stream:this.gainNode.connect(this.audioContext.destination),this.hasInitScriptNode=!0,this.workletProcessorNode.port.postMessage({message:"init",audioBufferSize:this.audioBufferSize,start:!0,channels:this.audioInfo.channels}),this.workletProcessorNode.port.onmessage=e=>{this.workletProcessorNode?this.audioContext?this.handleScriptNodeCallback(this.workletProcessorNode,null,!0):this.workletProcessorNode.port.postMessage({message:"zero"}):this.player.debug.error("AudioContext","workletProcessorNode is null")})})),this.clearWorkletUrlTimeout=setTimeout((()=>{URL.revokeObjectURL(this.workletUrl),this.workletUrl=null,this.clearWorkletUrlTimeout=null}),te)}tierDownToProcessScript(){this.player.debug.log("AudioContext","tierDownToProcessScript"),this.engineType=Us,this.audioBufferSize=this.getAudioBufferSizeByType(),this.initProcessScriptNode(),this.audioElementPlay()}handleScriptNodeCallback(e,t){let i,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t=t||ta;let r=e.length;s&&(i=e,r=this.audioBufferSize);const a=this.audioInfo.channels;if(this.playing&&this.isMoreThanMinBufferDuration()){if(this.player._opt,this.player.openSyncAudioAndVideo()&&uo(this.player.visibility)){this.calcPlaybackRateBySync();const r=this.player.getAudioSyncVideoDiff();if(r>this.player._opt.syncAudioAndVideoDiff)return this.player.debug.warn("AudioContext",`audioSyncVideoOption more than diff :${r}, waiting and bufferList is ${this.bufferList.length}`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,a),void t()}let o=this._provide(r);if(0===o.size)return po(this.player.isPlaybackOnlyDecodeIFrame())&&this.player.debug.warn("AudioContext",`bufferList size is ${this.bufferList.length} outputBufferLength is ${r},and bufferItem.size is 0`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,a),void t();o&&o.ts&&(this.player.audioTimestamp=o.ts),s?i.port.postMessage({message:"data",buffer:o}):this.fillScriptNodeOutputBuffer(e,a,o),t()}else 0===this.bufferList.length&&this.playing&&po(this.isMute)&&po(this.player.isPlaybackOnlyDecodeIFrame())&&this.player.debug.warn("AudioContext",`bufferList size is 0 and outputBufferLength is ${r}`),s?i.port.postMessage({message:"zero"}):this.fillScriptNodeOutputBuffer(e,a),t()}fillScriptNodeOutputBuffer(e,t,i){if(1===t){const t=e.getChannelData(0);i?0===i.size?t.fill(0):t.set(i.left):t.fill(0)}else if(2===t){const t=e.getChannelData(0),s=e.getChannelData(1);i?0===i.size?(t.fill(0),s.fill(0)):(t.set(i.left),s.set(i.right)):(t.fill(0),s.fill(0))}}play(e,t){this.isMute||(this.hasInitScriptNode?(this.hasAudio=!0,this.player.latestAudioTimestamp=t,this.bufferList.push({buffer:e,ts:t}),po(this.player.openSyncAudioAndVideo())&&this.calcPlaybackRateByBuffer()):this.player.debug.warn("AudioContext","play has not init script node"))}calcPlaybackRateBySync(){if(this.isMute)return;if(!this.playing)return;const e=Math.floor(2e3/this.oneBufferDuration);if(this.bufferList.length>e)return this.player.debug.warn("AudioContext",`bufferList length ${this.bufferList.length} more than ${e}, and drop`),void this.clear();const t=this.player.getAudioSyncVideoDiff();if(this.getEngineType()===Fs){if(t<-this.player._opt.syncAudioAndVideoDiff){this.player.debug.warn("AudioContext",`engine active , audioSyncVideoOption ${-this.player._opt.syncAudioAndVideoDiff} less than diff :${t},\n and bufferlist is ${this.bufferList.length}`);const e=this.player.getRenderCurrentPts();for(;this.bufferList.length>0;){const t=this.bufferList[0],i=t.ts-e;if(i>-this.player._opt.syncAudioAndVideoDiff/2){this.player.audioTimestamp=t.ts,this.player.debug.log("AudioContext",`engine active , audioSyncVideoOption\n item.ts is ${t.ts} and currentVideoTimestamp is ${e}, diff is ${i} > -${this.player._opt.syncAudioAndVideoDiff/2} and end`);break}this.bufferList.shift(),this.player.audioTimestamp=t.ts}}}else{let e=this.playbackRate;t<-this.player._opt.syncAudioAndVideoDiff?e===this.defaultPlaybackRate&&(this.player.debug.log("AudioContext",`audioSyncVideoOption ${-this.player._opt.syncAudioAndVideoDiff} less than diff :${t},\n speed up, playbackRate is ${e},\n and bufferList is ${this.bufferList.length}`),e=this.defaultPlaybackRate+.2):t>-this.player._opt.syncAudioAndVideoDiff/2&&e!==this.defaultPlaybackRate&&(this.player.debug.log("AudioContext",`diff is ${t} > -${this.player._opt.syncAudioAndVideoDiff/2} and speed to 1`),e=this.defaultPlaybackRate),this.updatePlaybackRate(e)}}calcPlaybackRateByBuffer(){if(this.isMute)return;if(!this.playing)return;let e=this.playbackRate,t=1e3,i=5e3;this.isAudioPlayer&&(t=this.player._opt.videoBufferDelay,i=this.player._opt.videoBufferMax);const s=Math.floor(t/this.oneBufferDuration),r=Math.floor(i/this.oneBufferDuration);if(this.bufferList.length>r)return this.player.debug.warn("AudioContext",`bufferList length ${this.bufferList.length} more than ${r}, and drop`),void this.clear();this.getEngineType()!==Fs&&(this.bufferList.length>s?(e=this.defaultPlaybackRate+.2,this.player.debug.log("AudioContext",`bufferList length ${this.bufferList.length} more than ${s}, speed up, playbackRate is ${e}`)):this.bufferList.length0?this.player.emit(nt.mute,!1):this._prevVolume>0&&0===e&&this.player.emit(nt.mute,!0),this.$video.volume=e,this.player.emit(nt.volumechange,this.player.volume),this.player.emit(nt.volume,this.player.volume),this._prevVolume=e)}clear(){}play(){}pause(){}resume(){}getEngineType(){return"audio"}isPlaybackRateSpeed(){return!1}getAudioBufferSize(){return 0}setRate(){}initScriptNode(){}initScriptNodeDelay(){}audioEnabled(){this.mute(!1)}}class dn extends nn{constructor(e){super(e),this.delayTimeout=null,this.player.on(nt.playbackPause,(e=>{this.listenPlaybackPause(e)})),this.player.debug.log("AudioPlaybackContext","init")}async destroy(){return this.delayTimeout&&(clearTimeout(this.delayTimeout),this.delayTimeout=null),await super.destroy(),this.player.debug.log("AudioPlaybackLoader","destroy"),!0}listenPlaybackPause(e){e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()}initScriptNodeDelay(){const e=this.player._opt.playbackDelayTime;e>0?this.delayTimeout=setTimeout((()=>{this.initScriptNode()}),e):this.initScriptNode()}setRate(e){e!==this.defaultPlaybackRate&&this.rateProcessor&&(this.player.debug.log("AudioPlaybackContext","setRate",e),this.defaultPlaybackRate=e,this.updatePlaybackRate(e))}}class hn extends nn{constructor(e){super(e),this.TAG_NAME="AudioPlayerLoader",this.isAudioPlayer=!0,this.player.debug.log(this.TAG_NAME,"init")}async destroy(){return await super.destroy(),this.player.debug.log(this.TAG_NAME,"destroy"),!0}play(e,t){po(this.playing)||super.play(e,t)}pause(){this.player.debug.log(this.TAG_NAME,"pause"),this.playing=!1,this.clear()}resume(){this.player.debug.log(this.TAG_NAME,"resume"),this.playing=!0}}class cn{constructor(e){return new(cn.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.playType===_?e.useMSE&&e.mseDecodeAudio?ln:dn:e.playType===v?hn:e.isHls&&po(e.supportHls265)||e.isWebrtc&&po(e.isWebrtcH265)||e.useMSE&&e.mseDecodeAudio||e.isAliyunRtc?ln:nn}}class un extends So{constructor(e){super(),this.player=e,this.playing=!1,this._requestAbort=!1,this._status=dr,this.writableStream=null,this.abortController=new AbortController,this.streamRate=ha((t=>{e.emit(nt.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debug.log("FetchStream","init")}async destroy(){return this.abort(),this.writableStream&&po(this.writableStream.locked)&&this.writableStream.close().catch((e=>{this.player.debug.log("FetchStream","destroy and writableStream.close()",e)})),this.writableStream=null,this.off(),this._status=dr,this.streamRate=null,this.stopStreamRateInterval(),this.player.debug.log("FetchStream","destroy"),!0}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{demux:i}=this.player;this.player._times.streamStart=aa();const s=Object.assign({signal:this.abortController.signal},{headers:t.headers||{}});fetch(e,s).then((e=>{if(this._requestAbort)return this._status=dr,void e.body.cancel();if(!function(e){return e.ok&&e.status>=200&&e.status<=299}(e))return this.player.debug.error("FetchStream",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),this.abort(),void this.emit(ct.fetchError,`fetch response status is ${e.status} and ok is ${e.ok}`);if(this.emit(nt.streamSuccess),this.startStreamRateInterval(),"undefined"!=typeof WritableStream)this.player.debug.log("FetchStream","use WritableStream() to read stream"),this.writableStream=new WritableStream({write:e=>this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?(this.player.debug.log("FetchStream","writableStream.write() and this.abortController.signal.aborted so return"),void(this._status=cr)):uo(this._requestAbort)?(this.player.debug.log("FetchStream","writableStream.write() and this._requestAbort is true so return"),void(this._status=cr)):"string"!=typeof e?(this._status=hr,this.streamRate&&this.streamRate(e.byteLength),i.dispatch(e)):void this.player.debug.warn("FetchStream",`writableStream.write() and value is "${e}" string so return`),close:()=>{this._status=cr,i.close(),this.emit(nt.streamEnd,"fetch done")},abort:e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return this.player.debug.log("FetchStream","writableStream.abort() and this.abortController.signal.aborted so return"),void(this._status=cr);i.close();const t=e.toString();-1===t.indexOf(ps)&&-1===t.indexOf(fs)&&e.name!==ms&&(this.abort(),this.emit(ct.fetchError,e))}}),e.body.pipeTo(this.writableStream);else{this.player.debug.log("FetchStream","not support WritableStream and use getReader() to read stream");const t=e.body.getReader(),s=()=>{t.read().then((e=>{let{done:t,value:r}=e;return t?(this._status=cr,i.close(),void this.emit(nt.streamEnd,"fetch done")):this.abortController&&this.abortController.signal&&this.abortController.signal.aborted?(this.player.debug.log("FetchStream","reader.read() and this.abortController.signal.aborted so return"),void(this._status=cr)):uo(this._requestAbort)?(this.player.debug.log("FetchStream","reader.read() and this._requestAbort is true so return"),void(this._status=cr)):void("string"!=typeof r?(this._status=hr,this.streamRate&&this.streamRate(r.byteLength),i.dispatch(r),s()):this.player.debug.warn("FetchStream",`reader.read() and value is "${r}" string so return`))})).catch((e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return this.player.debug.log("FetchStream","reader.read().catch() and this.abortController.signal.aborted so return"),void(this._status=cr);i.close();const t=e.toString();-1===t.indexOf(ps)&&-1===t.indexOf(fs)&&e.name!==ms&&(this.abort(),this.emit(ct.fetchError,e))}))};s()}})).catch((e=>{this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||"AbortError"!==e.name&&(i.close(),this.abort(),this.emit(ct.fetchError,e))}))}abort(){this._requestAbort=!0;const e=Ja();if(this._status!==hr||po(e)){if(this.abortController){try{this.abortController.abort()}catch(e){}this.abortController=null}}else this.abortController=null,this.player.debug.log("FetchStream",`abort() and not abortController.abort() _status is ${this._status} and _isChrome is ${e}`)}getStreamType(){return u}}class pn extends So{constructor(e){super(),this.TAG_NAME="FetchWorkerLoader",this.player=e,this.playing=!1,this.fetchWorker=null,this.workerClearTimeout=null,this.workerUrl=null,this.destroyResolve=null,this.decoderWorkerCloseTimeout=null,this.abortController=new AbortController,this.streamRate=ha((t=>{e.emit(nt.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,this._initFetchWorker(),e.debug.log(this.TAG_NAME,"init")}destroy(){return new Promise(((e,t)=>{this.fetchWorker?(this.player.debug.log(this.TAG_NAME,"send destroy"),this.fetchWorker.postMessage({cmd:tt}),this.destroyResolve=e,this.decoderWorkerCloseTimeout=setTimeout((()=>{this.player.debug.warn(this.TAG_NAME,"send close but not response and destroy directly"),this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this._destroy(),setTimeout((()=>{e()}),0)}),2e3)):(this._destroy(),setTimeout((()=>{e()}),0))}))}_destroy(){this.off(),this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this.workerUrl&&(window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this._stopStreamRateInterval(),this.streamRate=null,this.fetchWorker&&(this.fetchWorker.terminate(),this.fetchWorker.onmessage=null,this.fetchWorker=null),this.destroyResolve&&(this.destroyResolve(),this.destroyResolve=null),this.player.debug.log(this.TAG_NAME,"destroy")}_initFetchWorker(){const e=Ao(function(){function e(e){return!0===e||"true"===e}function t(e){return!1===e||"false"===e}const i="The user aborted a request",s="AbortError",r="AbortError",a="fetch",o="destroy",n="destroyEnd",l="buffer",d="fetchError",h="fetchClose",c="fetchSuccess",u="idle",p="buffering",f="complete";let m=new class{constructor(){this._requestAbort=!1,this._status=u,this.writableStream=null,this.isChrome=!1,this.abortController=new AbortController}destroy(){this.abort(),this.writableStream&&t(this.writableStream.locked)&&this.writableStream.close().catch((e=>{})),this.writableStream=null,this._status=u}fetchStream(t){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=Object.assign({signal:this.abortController.signal},{headers:a.headers||{}});fetch(t,o).then((t=>{if(this._requestAbort)return this._status=u,void t.body.cancel();if(!function(e){return e.ok&&e.status>=200&&e.status<=299}(t))return this.abort(),void postMessage({cmd:d,message:`fetch response status is ${t.status} and ok is ${t.ok}`});if(postMessage({cmd:c}),"undefined"!=typeof WritableStream)this.writableStream=new WritableStream({write:t=>{this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||e(this._requestAbort)?this._status=f:"string"!=typeof t&&(this._status=p,postMessage({cmd:l,buffer:t},[t.buffer]))},close:()=>{this._status=f,postMessage({cmd:h})},abort:e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return void(this._status=f);const t=e.toString();-1===t.indexOf(i)&&-1===t.indexOf(s)&&e.name!==r&&(this.abort(),postMessage({cmd:d,message:e.toString()}))}}),t.body.pipeTo(this.writableStream);else{const a=t.body.getReader(),o=()=>{a.read().then((t=>{let{done:i,value:s}=t;if(i)return this._status=f,void postMessage({cmd:h});this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||e(this._requestAbort)?this._status=f:"string"!=typeof s&&(this._status=p,postMessage({cmd:l,buffer:s},[s.buffer]),o())})).catch((e=>{if(this.abortController&&this.abortController.signal&&this.abortController.signal.aborted)return void(this._status=f);const t=e.toString();-1===t.indexOf(i)&&-1===t.indexOf(s)&&e.name!==r&&(this.abort(),postMessage({cmd:d,message:e.toString()}))}))};o()}})).catch((e=>{this.abortController&&this.abortController.signal&&this.abortController.signal.aborted||"AbortError"!==e.name&&(this.abort(),postMessage({cmd:d,message:e.toString()}))}))}abort(){if(this._requestAbort=!0,this._status!==p||t(m.isChrome)){if(this.abortController){try{this.abortController.abort()}catch(e){}this.abortController=null}}else this.abortController=null}};self.onmessage=t=>{const i=t.data;switch(i.cmd){case a:m.isChrome=e(i.isChrome),m.fetchStream(i.url,JSON.parse(i.options));break;case o:m.destroy(),m=null,postMessage({cmd:n})}}}.toString()),t=new Blob([e],{type:"text/javascript"});let i=URL.createObjectURL(t);const s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te),s.onmessage=e=>{const{demux:t}=this.player,i=e.data;switch(i.cmd){case st:this.streamRate&&this.streamRate(i.buffer.byteLength),t.dispatch(i.buffer);break;case ot:this.emit(nt.streamSuccess),this._startStreamRateInterval();break;case at:t.close(),this.emit(nt.streamEnd,"fetch done");break;case rt:t.close(),this.emit(ct.fetchError,i.message);break;case it:this._destroy()}},this.fetchWorker=s}_startStreamRateInterval(){this._stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}_stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player._times.streamStart=aa(),this.fetchWorker.postMessage({cmd:et,url:e,isChrome:Ja(),options:JSON.stringify(t)})}getStreamType(){return u}}class fn extends So{constructor(e){super(),this.player=e,this.socket=null,this.socketStatus=ut,this.wsUrl=null,this.requestAbort=!1,this.socketDestroyFnList=[],this.streamRate=ha((t=>{e.emit(nt.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debug.log("WebsocketStream","init")}async destroy(){this._closeWebSocket(),this.stopStreamRateInterval(),this.wsUrl=null,this.off(),this.player.debug.log("WebsocketStream","destroy")}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebSocket(){const e=this.player,{debug:t,events:{proxy:i},demux:s}=e;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer";const r=i(this.socket,"open",(()=>{t.log("WebsocketStream","socket open"),this.socketStatus=pt,this.emit(nt.streamSuccess),this.player.emit(nt.websocketOpen),this.startStreamRateInterval()})),a=i(this.socket,"message",(e=>{"string"!=typeof e.data?(this.streamRate&&this.streamRate(e.data.byteLength),this._handleMessage(e.data)):this.player.debug.warn("WebsocketStream",`websocket handle message message is "${e.data}" string so return`)})),o=i(this.socket,"close",(e=>{if(this.socketStatus!==mt){if(t.log("WebsocketStream",`socket close and code is ${e.code}`),1006===e.code&&t.error("WebsocketStream",`socket close abnormally and code is ${e.code}`),uo(this.requestAbort))return this.requestAbort=!1,void t.log("WebsocketStream","socket close and requestAbort is true");s.close(),this.socketStatus=ft,this.player.emit(nt.websocketClose,e.code),this.emit(nt.streamEnd,e.code)}else t.log("WebsocketStream","socket close and status is error, so return")})),n=i(this.socket,"error",(e=>{t.error("WebsocketStream","socket error",e),this.socketStatus=mt,this.emit(ct.websocketError,e),s.close(),t.log("WebsocketStream","socket error:",e.isTrusted?"websocket user aborted":"websocket error")}));this.socketDestroyFnList.push(r,a,o,n)}_closeWebSocket(){this.socketDestroyFnList.forEach((e=>e())),!this.socket||0!==this.socket.readyState&&1!==this.socket.readyState?this.socket&&this.player.debug.log("WebsocketStream",`_closeWebSocket() socket is null or socket status is ${this.socket&&this.socket.readyState}`):(this.requestAbort=!0,this.socket.close(1e3,"Client disconnecting")),this.socket=null,this.socketStatus=ut,this.streamRate=null}_handleMessage(e){const{demux:t}=this.player;t?t.dispatch(e):this.player.debug.warn("WebsocketStream","websocket handle message demux is null so return")}fetchStream(e,t){this.player._times.streamStart=aa(),this.wsUrl=e,this._createWebSocket()}sendMessage(e){this.socket?this.socketStatus===pt?this.socket.send(e):this.player.debug.error("WebsocketStream",`websocket send message error and socket status is ${this.socketStatus}`):this.player.debug.error("WebsocketStream","websocket send message socket is null")}resetFetchStream(){this._closeWebSocket(),this._createWebSocket()}getStreamType(){return f}}class mn extends So{constructor(e){super(),this.player=e,e.debug.log("HlsStream","init")}async destroy(){return this.off(),this.player.debug.log("HlsStream","destroy"),!0}fetchStream(e){const{hlsDecoder:t,debug:i}=this.player;this.player._times.streamStart=aa(),t.loadSource(e).then((()=>{this.player.debug.log("HlsStream","loadSource success"),this.emit(nt.streamSuccess)})).catch((e=>{this.emit(ct.hlsError,e)}))}getStreamType(){return p}}class gn extends So{constructor(e){super(),this.player=e,this.webrctUrl=null,e.debug.log("WebrtcStream","init")}async destroy(){return this.webrctUrl=null,this.off(),this.player.debug.log("WebrtcStream","destroy"),!0}fetchStream(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{webrtc:i,debug:s}=this.player;if(this.player._times.streamStart=aa(),this.webrctUrl=e.replace("webrtc:",window.location.protocol),-1===this.webrctUrl.indexOf("/webrtc/play")&&this.player.isWebrtcForM7S()){const t=new URL(this.webrctUrl),i="/webrtc/play"+t.pathname;this.webrctUrl=t.origin+i+t.search,this.player.debug.log("WebrtcStream",`original url is ${e}, and new url is: ${this.webrctUrl}`)}i.loadSource(this.webrctUrl,t).then((()=>{this.player.debug.log("WebrtcStream","loadSource success"),this.emit(nt.streamSuccess)})).catch((e=>{this.player.debug.error("WebrtcStream","loadSource error",e),this.emit(ct.webrtcError,e)}))}getStreamType(){return m}}class yn extends So{constructor(e){super(),this.player=e,this.transport=null,this.wtUrl=null,this.streamRate=ha((t=>{e.emit(nt.kBps,(t/1024).toFixed(2))})),this.streamRateInterval=null,e.debug.log("WebTransportLoader","init")}async destroy(){return this.abort(),this.off(),this.player.debug.log("WebTransportLoader","destroy"),!0}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebTransport(){const e=this.player,{debug:t,events:{proxy:i},demux:s}=e;try{this.transport=new WebTransport(this.wtUrl),this.transport.ready.then((()=>{this.emit(nt.streamSuccess),this.startStreamRateInterval(),this.transport.createBidirectionalStream().then((e=>{e.readable.pipeTo(new WritableStream(s.input))}))})).catch((e=>{this.player.debug.warn("WebTransportLoader","_createWebTransport-ready",e)}))}catch(e){this.player.debug.warn("WebTransportLoader","_createWebTransport",e)}}fetchStream(e){this.player._times.streamStart=aa(),this.wtUrl=e.replace(/^wt:/,"https:"),this._createWebTransport()}abort(){if(this.transport)try{this.transport.close(),this.transport=null}catch(e){this.transport=null}}getStreamType(){return g}}class An extends So{constructor(e){super(),this.player=e,this.workUrl=null,e.debug.log("WorkerStream","init")}async destroy(){return this.workUrl=null,this.off(),this.player.debug.log("WorkerStream","destroy"),!0}sendMessage(e){this.player.decoderWorker.workerSendMessage(e)}fetchStream(e){this.workUrl=e,this.player._times.streamStart=aa(),this.player.decoderWorker.workerFetchStream(e)}getStreamType(){const e=this.player._opt.protocol;return y+" "+(e===o?u:f)}}class bn extends So{constructor(e){super(),this.TAG_NAME="AliyunRtcLoader",this.player=e,e.debug.log(this.TAG_NAME,"init")}async destroy(){return this.off(),this.player.debug.log(this.TAG_NAME,"destroy"),!0}fetchStream(e){const{aliyunRtcDecoder:t}=this.player;this.player._times.streamStart=aa(),t.loadSource(e).then((()=>{this.player.debug.log(this.TAG_NAME,"loadSource success"),this.emit(nt.streamSuccess)})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource error",e),this.emit(ct.aliyunRtcError,e)}))}getStreamType(){return A}}class vn{constructor(e){return new(vn.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){const{protocol:t,useWasm:i,playType:s,useWCS:r,useMSE:c,demuxUseWorker:u,mainThreadFetchUseWorker:p}=e;return t===o?s===v?An:s===b?i&&!Za(e)||u?An:p?pn:un:r||c?u?An:p?pn:un:An:t===a?s===v?An:s===b?i&&!Za(e)||u?An:fn:r||c?u?An:fn:An:t===n?mn:t===l?gn:t===d?yn:t===h?bn:void 0}}var _n=Ir((function(e){function t(e,r){if(!e)throw"First parameter is required.";r=new i(e,r=r||{type:"video"});var a=this;function o(t){t&&(r.initCallback=function(){t(),t=r.initCallback=null});var i=new s(e,r);(p=new i(e,r)).record(),u("recording"),r.disableLogs||console.log("Initialized recorderType:",p.constructor.name,"for output-type:",r.type)}function n(e){if(e=e||function(){},p){if("paused"===a.state)return a.resumeRecording(),void setTimeout((function(){n(e)}),1);"recording"===a.state||r.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',a.state),r.disableLogs||console.log("Stopped recording "+r.type+" stream."),"gif"!==r.type?p.stop(t):(p.stop(),t()),u("stopped")}else m();function t(t){if(p){Object.keys(p).forEach((function(e){"function"!=typeof p[e]&&(a[e]=p[e])}));var i=p.blob;if(!i){if(!t)throw"Recording failed.";p.blob=i=t}if(i&&!r.disableLogs&&console.log(i.type,"->",y(i.size)),e){var s;try{s=h.createObjectURL(i)}catch(e){}"function"==typeof e.call?e.call(a,s):e(s)}r.autoWriteToDisk&&d((function(e){var t={};t[r.type+"Blob"]=e,R.Store(t)}))}else"function"==typeof e.call?e.call(a,""):e("")}}function l(e){postMessage((new FileReaderSync).readAsDataURL(e))}function d(e,t){if(!e)throw"Pass a callback function over getDataURL.";var i=t?t.blob:(p||{}).blob;if(!i)return r.disableLogs||console.warn("Blob encoder did not finish its job yet."),void setTimeout((function(){d(e,t)}),1e3);if("undefined"==typeof Worker||navigator.mozGetUserMedia){var s=new FileReader;s.readAsDataURL(i),s.onload=function(t){e(t.target.result)}}else{var a=function(e){try{var t=h.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"})),i=new Worker(t);return h.revokeObjectURL(t),i}catch(e){}}(l);a.onmessage=function(t){e(t.data)},a.postMessage(i)}}function c(e){e=e||0,"paused"!==a.state?"stopped"!==a.state&&(e>=a.recordingDuration?n(a.onRecordingStopped):(e+=1e3,setTimeout((function(){c(e)}),1e3))):setTimeout((function(){c(e)}),1e3)}function u(e){a&&(a.state=e,"function"==typeof a.onStateChanged.call?a.onStateChanged.call(a,e):a.onStateChanged(e))}var p,f='It seems that recorder is destroyed or "startRecording" is not invoked for '+r.type+" recorder.";function m(){!0!==r.disableLogs&&console.warn(f)}var g={startRecording:function(t){return r.disableLogs||console.log("RecordRTC version: ",a.version),t&&(r=new i(e,t)),r.disableLogs||console.log("started recording "+r.type+" stream."),p?(p.clearRecordedData(),p.record(),u("recording"),a.recordingDuration&&c(),a):(o((function(){a.recordingDuration&&c()})),a)},stopRecording:n,pauseRecording:function(){p?"recording"===a.state?(u("paused"),p.pause(),r.disableLogs||console.log("Paused recording.")):r.disableLogs||console.warn("Unable to pause the recording. Recording state: ",a.state):m()},resumeRecording:function(){p?"paused"===a.state?(u("recording"),p.resume(),r.disableLogs||console.log("Resumed recording.")):r.disableLogs||console.warn("Unable to resume the recording. Recording state: ",a.state):m()},initRecorder:o,setRecordingDuration:function(e,t){if(void 0===e)throw"recordingDuration is required.";if("number"!=typeof e)throw"recordingDuration must be a number.";return a.recordingDuration=e,a.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){a.onRecordingStopped=e}}},clearRecordedData:function(){p?(p.clearRecordedData(),r.disableLogs||console.log("Cleared old recorded data.")):m()},getBlob:function(){if(p)return p.blob;m()},getDataURL:d,toURL:function(){if(p)return h.createObjectURL(p.blob);m()},getInternalRecorder:function(){return p},save:function(e){p?A(p.blob,e):m()},getFromDisk:function(e){p?t.getFromDisk(r.type,e):m()},setAdvertisementArray:function(e){r.advertisement=[];for(var t=e.length,i=0;i-1&&"netscape"in window&&/ rv:/.test(navigator.userAgent),f=!u&&!c&&!!navigator.webkitGetUserMedia||b()||-1!==navigator.userAgent.toLowerCase().indexOf("chrome/"),m=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);m&&!f&&-1!==navigator.userAgent.indexOf("CriOS")&&(m=!1,f=!0);var g=window.MediaStream;function y(e){if(0===e)return"0 Bytes";var t=parseInt(Math.floor(Math.log(e)/Math.log(1e3)),10);return(e/Math.pow(1e3,t)).toPrecision(3)+" "+["Bytes","KB","MB","GB","TB"][t]}function A(e,t){if(!e)throw"Blob object is required.";if(!e.type)try{e.type="video/webm"}catch(e){}var i=(e.type||"video/webm").split("/")[1];if(-1!==i.indexOf(";")&&(i=i.split(";")[0]),t&&-1!==t.indexOf(".")){var s=t.split(".");t=s[0],i=s[1]}var r=(t||Math.round(9999999999*Math.random())+888888888)+"."+i;if(void 0!==navigator.msSaveOrOpenBlob)return navigator.msSaveOrOpenBlob(e,r);if(void 0!==navigator.msSaveBlob)return navigator.msSaveBlob(e,r);var a=document.createElement("a");a.href=h.createObjectURL(e),a.download=r,a.style="display:none;opacity:0;color:transparent;",(document.body||document.documentElement).appendChild(a),"function"==typeof a.click?a.click():(a.target="_blank",a.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0}))),h.revokeObjectURL(a.href)}function b(){return"undefined"!=typeof window&&"object"==typeof window.process&&"renderer"===window.process.type||(!("undefined"==typeof process||"object"!=typeof process.versions||!process.versions.electron)||"object"==typeof navigator&&"string"==typeof navigator.userAgent&&navigator.userAgent.indexOf("Electron")>=0)}function v(e,t){return e&&e.getTracks?e.getTracks().filter((function(e){return e.kind===(t||"audio")})):[]}function _(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}void 0===g&&"undefined"!=typeof webkitMediaStream&&(g=webkitMediaStream),void 0!==g&&void 0===g.prototype.stop&&(g.prototype.stop=function(){this.getTracks().forEach((function(e){e.stop()}))}),t.invokeSaveAsDialog=A,t.getTracks=v,t.getSeekableBlob=function(e,t){if("undefined"==typeof EBML)throw new Error("Please link: https://www.webrtc-experiment.com/EBML.js");var i=new EBML.Reader,s=new EBML.Decoder,r=EBML.tools,a=new FileReader;a.onload=function(e){s.decode(this.result).forEach((function(e){i.read(e)})),i.stop();var a=r.makeMetadataSeekable(i.metadatas,i.duration,i.cues),o=this.result.slice(i.metadataSize),n=new Blob([a,o],{type:"video/webm"});t(n)},a.readAsArrayBuffer(e)},t.bytesToSize=y,t.isElectron=b;var S={};function w(){if(p||m||c)return!0;var e,t,i=navigator.userAgent,s=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10);return(f||u)&&(e=i.indexOf("Chrome"),s=i.substring(e+7)),-1!==(t=s.indexOf(";"))&&(s=s.substring(0,t)),-1!==(t=s.indexOf(" "))&&(s=s.substring(0,t)),r=parseInt(""+s,10),isNaN(r)&&(s=""+parseFloat(navigator.appVersion),r=parseInt(navigator.appVersion,10)),r>=49}function E(e,t){var i=this;if(void 0===e)throw'First argument "MediaStream" is required.';if("undefined"==typeof MediaRecorder)throw"Your browser does not support the Media Recorder API. Please try other modules e.g. WhammyRecorder or StereoAudioRecorder.";if("audio"===(t=t||{mimeType:"video/webm"}).type){var s;if(v(e,"video").length&&v(e,"audio").length)navigator.mozGetUserMedia?(s=new g).addTrack(v(e,"audio")[0]):s=new g(v(e,"audio")),e=s;t.mimeType&&-1!==t.mimeType.toString().toLowerCase().indexOf("audio")||(t.mimeType=f?"audio/webm":"audio/ogg"),t.mimeType&&"audio/ogg"!==t.mimeType.toString().toLowerCase()&&navigator.mozGetUserMedia&&(t.mimeType="audio/ogg")}var r,a=[];function o(){i.timestamps.push((new Date).getTime()),"function"==typeof t.onTimeStamp&&t.onTimeStamp(i.timestamps[i.timestamps.length-1],i.timestamps)}function n(e){return r&&r.mimeType?r.mimeType:e.mimeType||"video/webm"}function l(){a=[],r=null,i.timestamps=[]}this.getArrayOfBlobs=function(){return a},this.record=function(){i.blob=null,i.clearRecordedData(),i.timestamps=[],d=[],a=[];var s=t;t.disableLogs||console.log("Passing following config over MediaRecorder API.",s),r&&(r=null),f&&!w()&&(s="video/vp8"),"function"==typeof MediaRecorder.isTypeSupported&&s.mimeType&&(MediaRecorder.isTypeSupported(s.mimeType)||(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",s.mimeType),s.mimeType="audio"===t.type?"audio/webm":"video/webm"));try{r=new MediaRecorder(e,s),t.mimeType=s.mimeType}catch(t){r=new MediaRecorder(e)}s.mimeType&&!MediaRecorder.isTypeSupported&&"canRecordMimeType"in r&&!1===r.canRecordMimeType(s.mimeType)&&(t.disableLogs||console.warn("MediaRecorder API seems unable to record mimeType:",s.mimeType)),r.ondataavailable=function(e){if(e.data&&d.push("ondataavailable: "+y(e.data.size)),"number"!=typeof t.timeSlice)!e.data||!e.data.size||e.data.size<100||i.blob?i.recordingCallback&&(i.recordingCallback(new Blob([],{type:n(s)})),i.recordingCallback=null):(i.blob=t.getNativeBlob?e.data:new Blob([e.data],{type:n(s)}),i.recordingCallback&&(i.recordingCallback(i.blob),i.recordingCallback=null));else if(e.data&&e.data.size&&(a.push(e.data),o(),"function"==typeof t.ondataavailable)){var r=t.getNativeBlob?e.data:new Blob([e.data],{type:n(s)});t.ondataavailable(r)}},r.onstart=function(){d.push("started")},r.onpause=function(){d.push("paused")},r.onresume=function(){d.push("resumed")},r.onstop=function(){d.push("stopped")},r.onerror=function(e){e&&(e.name||(e.name="UnknownError"),d.push("error: "+e),t.disableLogs||(-1!==e.name.toString().toLowerCase().indexOf("invalidstate")?console.error("The MediaRecorder is not in a state in which the proposed operation is allowed to be executed.",e):-1!==e.name.toString().toLowerCase().indexOf("notsupported")?console.error("MIME type (",s.mimeType,") is not supported.",e):-1!==e.name.toString().toLowerCase().indexOf("security")?console.error("MediaRecorder security error",e):"OutOfMemory"===e.name?console.error("The UA has exhaused the available memory. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"IllegalStreamModification"===e.name?console.error("A modification to the stream has occurred that makes it impossible to continue recording. An example would be the addition of a Track while recording is occurring. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"OtherRecordingError"===e.name?console.error("Used for an fatal error other than those listed above. User agents SHOULD provide as much additional information as possible in the message attribute.",e):"GenericError"===e.name?console.error("The UA cannot provide the codec or recording option that has been requested.",e):console.error("MediaRecorder Error",e)),function(e){if(!i.manuallyStopped&&r&&"inactive"===r.state)return delete t.timeslice,void r.start(6e5);setTimeout(void 0,1e3)}(),"inactive"!==r.state&&"stopped"!==r.state&&r.stop())},"number"==typeof t.timeSlice?(o(),r.start(t.timeSlice)):r.start(36e5),t.initCallback&&t.initCallback()},this.timestamps=[],this.stop=function(e){e=e||function(){},i.manuallyStopped=!0,r&&(this.recordingCallback=e,"recording"===r.state&&r.stop(),"number"==typeof t.timeSlice&&setTimeout((function(){i.blob=new Blob(a,{type:n(t)}),i.recordingCallback(i.blob)}),100))},this.pause=function(){r&&"recording"===r.state&&r.pause()},this.resume=function(){r&&"paused"===r.state&&r.resume()},this.clearRecordedData=function(){r&&"recording"===r.state&&i.stop(l),l()},this.getInternalRecorder=function(){return r},this.blob=null,this.getState=function(){return r&&r.state||"inactive"};var d=[];this.getAllStates=function(){return d},void 0===t.checkForInactiveTracks&&(t.checkForInactiveTracks=!1);i=this;!function s(){if(r&&!1!==t.checkForInactiveTracks)return!1===function(){if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}()?(t.disableLogs||console.log("MediaStream seems stopped."),void i.stop()):void setTimeout(s,1e3)}(),this.name="MediaStreamRecorder",this.toString=function(){return this.name}}function T(e,i){if(!v(e,"audio").length)throw"Your stream has no audio tracks.";var s,r=this,a=[],o=[],n=!1,l=0,d=2,c=(i=i||{}).desiredSampRate;function u(){if(!1===i.checkForInactiveTracks)return!0;if("active"in e){if(!e.active)return!1}else if("ended"in e&&e.ended)return!1;return!0}function p(e,t){function i(e,t){var i,s=e.numberOfAudioChannels,r=e.leftBuffers.slice(0),a=e.rightBuffers.slice(0),o=e.sampleRate,n=e.internalInterleavedLength,l=e.desiredSampRate;function d(e,t,i){var s=Math.round(e.length*(t/i)),r=[],a=Number((e.length-1)/(s-1));r[0]=e[0];for(var o=1;o96e3)&&(i.disableLogs||console.log("sample-rate must be under range 22050 and 96000.")),i.disableLogs||i.desiredSampRate&&console.log("Desired sample-rate: "+i.desiredSampRate);var b=!1;function _(){a=[],o=[],l=0,w=!1,n=!1,b=!1,f=null,r.leftchannel=a,r.rightchannel=o,r.numberOfAudioChannels=d,r.desiredSampRate=c,r.sampleRate=A,r.recordingLength=l,E={left:[],right:[],recordingLength:0}}function S(){s&&(s.onaudioprocess=null,s.disconnect(),s=null),m&&(m.disconnect(),m=null),_()}this.pause=function(){b=!0},this.resume=function(){if(!1===u())throw"Please make sure MediaStream is active.";if(!n)return i.disableLogs||console.log("Seems recording has been restarted."),void this.record();b=!1},this.clearRecordedData=function(){i.checkForInactiveTracks=!1,n&&this.stop(S),S()},this.name="StereoAudioRecorder",this.toString=function(){return this.name};var w=!1;s.onaudioprocess=function(e){if(!b)if(!1===u()&&(i.disableLogs||console.log("MediaStream seems stopped."),s.disconnect(),n=!1),n){w||(w=!0,i.onAudioProcessStarted&&i.onAudioProcessStarted(),i.initCallback&&i.initCallback());var t=e.inputBuffer.getChannelData(0),h=new Float32Array(t);if(a.push(h),2===d){var c=e.inputBuffer.getChannelData(1),p=new Float32Array(c);o.push(p)}l+=y,r.recordingLength=l,void 0!==i.timeSlice&&(E.recordingLength+=y,E.left.push(h),2===d&&E.right.push(p))}else m&&(m.disconnect(),m=null)},f.createMediaStreamDestination?s.connect(f.createMediaStreamDestination()):s.connect(f.destination),this.leftchannel=a,this.rightchannel=o,this.numberOfAudioChannels=d,this.desiredSampRate=c,this.sampleRate=A,r.recordingLength=l;var E={left:[],right:[],recordingLength:0};function T(){n&&"function"==typeof i.ondataavailable&&void 0!==i.timeSlice&&(E.left.length?(p({desiredSampRate:c,sampleRate:A,numberOfAudioChannels:d,internalInterleavedLength:E.recordingLength,leftBuffers:E.left,rightBuffers:1===d?[]:E.right},(function(e,t){var s=new Blob([t],{type:"audio/wav"});i.ondataavailable(s),setTimeout(T,i.timeSlice)})),E={left:[],right:[],recordingLength:0}):setTimeout(T,i.timeSlice))}}function k(e,t){if("undefined"==typeof html2canvas)throw"Please link: https://www.webrtc-experiment.com/screenshot.js";(t=t||{}).frameInterval||(t.frameInterval=10);var i=!1;["captureStream","mozCaptureStream","webkitCaptureStream"].forEach((function(e){e in document.createElement("canvas")&&(i=!0)}));var s,r,a,o=!(!window.webkitRTCPeerConnection&&!window.webkitGetUserMedia||!window.chrome),n=50,l=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);if(o&&l&&l[2]&&(n=parseInt(l[2],10)),o&&n<52&&(i=!1),t.useWhammyRecorder&&(i=!1),i)if(t.disableLogs||console.log("Your browser supports both MediRecorder API and canvas.captureStream!"),e instanceof HTMLCanvasElement)s=e;else{if(!(e instanceof CanvasRenderingContext2D))throw"Please pass either HTMLCanvasElement or CanvasRenderingContext2D.";s=e.canvas}else navigator.mozGetUserMedia&&(t.disableLogs||console.error("Canvas recording is NOT supported in Firefox."));this.record=function(){if(a=!0,i&&!t.useWhammyRecorder){var e;"captureStream"in s?e=s.captureStream(25):"mozCaptureStream"in s?e=s.mozCaptureStream(25):"webkitCaptureStream"in s&&(e=s.webkitCaptureStream(25));try{var o=new g;o.addTrack(v(e,"video")[0]),e=o}catch(e){}if(!e)throw"captureStream API are NOT available.";(r=new E(e,{mimeType:t.mimeType||"video/webm"})).record()}else p.frames=[],u=(new Date).getTime(),c();t.initCallback&&t.initCallback()},this.getWebPImages=function(i){if("canvas"===e.nodeName.toLowerCase()){var s=p.frames.length;p.frames.forEach((function(e,i){var r=s-i;t.disableLogs||console.log(r+"/"+s+" frames remaining"),t.onEncodingCallback&&t.onEncodingCallback(r,s);var a=e.image.toDataURL("image/webp",1);p.frames[i].image=a})),t.disableLogs||console.log("Generating WebM"),i()}else i()},this.stop=function(e){a=!1;var s=this;i&&r?r.stop(e):this.getWebPImages((function(){p.compile((function(i){t.disableLogs||console.log("Recording finished!"),s.blob=i,s.blob.forEach&&(s.blob=new Blob([],{type:"video/webm"})),e&&e(s.blob),p.frames=[]}))}))};var d=!1;function h(){p.frames=[],a=!1,d=!1}function c(){if(d)return u=(new Date).getTime(),setTimeout(c,500);if("canvas"===e.nodeName.toLowerCase()){var i=(new Date).getTime()-u;return u=(new Date).getTime(),p.frames.push({image:(s=document.createElement("canvas"),r=s.getContext("2d"),s.width=e.width,s.height=e.height,r.drawImage(e,0,0),s),duration:i}),void(a&&setTimeout(c,t.frameInterval))}var s,r;html2canvas(e,{grabMouse:void 0===t.showMousePointer||t.showMousePointer,onrendered:function(e){var i=(new Date).getTime()-u;if(!i)return setTimeout(c,t.frameInterval);u=(new Date).getTime(),p.frames.push({image:e.toDataURL("image/webp",1),duration:i}),a&&setTimeout(c,t.frameInterval)}})}this.pause=function(){d=!0,r instanceof E&&r.pause()},this.resume=function(){d=!1,r instanceof E?r.resume():a||this.record()},this.clearRecordedData=function(){a&&this.stop(h),h()},this.name="CanvasRecorder",this.toString=function(){return this.name};var u=(new Date).getTime(),p=new x.Video(100)}function C(e,t){function i(e){e=void 0!==e?e:10;var t=(new Date).getTime()-l;return t?a?(l=(new Date).getTime(),setTimeout(i,100)):(l=(new Date).getTime(),n.paused&&n.play(),c.drawImage(n,0,0,h.width,h.height),d.frames.push({duration:t,image:h.toDataURL("image/webp")}),void(r||setTimeout(i,e,e))):setTimeout(i,e,e)}function s(e,t,i,s,r){var a=document.createElement("canvas");a.width=h.width,a.height=h.height;var o=a.getContext("2d"),n=[],l=-1===t,d=t&&t>0&&t<=e.length?t:e.length,c=0,u=0,p=0,f=Math.sqrt(Math.pow(255,2)+Math.pow(255,2)+Math.pow(255,2)),m=i&&i>=0&&i<=1?i:0,g=s&&s>=0&&s<=1?s:0,y=!1;!function(e){var t=-1,i=e.length;!function s(){++t!==i?setTimeout((function(){e.functionToLoop(s,t)}),1):e.callback()}()}({length:d,functionToLoop:function(t,i){var s,r,a,d=function(){!y&&a-s<=a*g||(l&&(y=!0),n.push(e[i])),t()};if(y)d();else{var A=new Image;A.onload=function(){o.drawImage(A,0,0,h.width,h.height);var e=o.getImageData(0,0,h.width,h.height);s=0,r=e.data.length,a=e.data.length/4;for(var t=0;t127)throw"TrackNumber > 127 not supported";return[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map((function(e){return String.fromCharCode(e)})).join("")+e.frame}({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(t)});return t+=e.duration,{data:i,id:163}})))}function i(e){for(var t=[];e>0;)t.push(255&e),e>>=8;return new Uint8Array(t.reverse())}function s(e){var t=[];e=(e.length%8?new Array(9-e.length%8).join("0"):"")+e;for(var i=0;i1?2*a[0].width:a[0].width;var n=1;3!==e&&4!==e||(n=2),5!==e&&6!==e||(n=3),7!==e&&8!==e||(n=4),9!==e&&10!==e||(n=5),r.height=a[0].height*n}else r.width=o.width||360,r.height=o.height||240;t&&t instanceof HTMLVideoElement&&u(t),a.forEach((function(e,t){u(e,t)})),setTimeout(c,o.frameInterval)}}function u(e,t){if(!s){var i=0,r=0,o=e.width,n=e.height;1===t&&(i=e.width),2===t&&(r=e.height),3===t&&(i=e.width,r=e.height),4===t&&(r=2*e.height),5===t&&(i=e.width,r=2*e.height),6===t&&(r=3*e.height),7===t&&(i=e.width,r=3*e.height),void 0!==e.stream.left&&(i=e.stream.left),void 0!==e.stream.top&&(r=e.stream.top),void 0!==e.stream.width&&(o=e.stream.width),void 0!==e.stream.height&&(n=e.stream.height),a.drawImage(e,i,r,o,n),"function"==typeof e.stream.onRender&&e.stream.onRender(a,i,r,o,n,t)}}function p(e){var i=document.createElement("video");return function(e,t){"srcObject"in t?t.srcObject=e:"mozSrcObject"in t?t.mozSrcObject=e:t.srcObject=e}(e,i),i.className=t,i.muted=!0,i.volume=0,i.width=e.width||o.width||360,i.height=e.height||o.height||240,i.play(),i}function f(t){i=[],(t=t||e).forEach((function(e){if(e.getTracks().filter((function(e){return"video"===e.kind})).length){var t=p(e);t.stream=e,i.push(t)}}))}void 0!==n?h.AudioContext=n:"undefined"!=typeof webkitAudioContext&&(h.AudioContext=webkitAudioContext),this.startDrawingFrames=function(){c()},this.appendStreams=function(t){if(!t)throw"First parameter is required.";t instanceof Array||(t=[t]),t.forEach((function(t){var s=new d;if(t.getTracks().filter((function(e){return"video"===e.kind})).length){var r=p(t);r.stream=t,i.push(r),s.addTrack(t.getTracks().filter((function(e){return"video"===e.kind}))[0])}if(t.getTracks().filter((function(e){return"audio"===e.kind})).length){var a=o.audioContext.createMediaStreamSource(t);o.audioDestination=o.audioContext.createMediaStreamDestination(),a.connect(o.audioDestination),s.addTrack(o.audioDestination.stream.getTracks().filter((function(e){return"audio"===e.kind}))[0])}e.push(s)}))},this.releaseStreams=function(){i=[],s=!0,o.gainNode&&(o.gainNode.disconnect(),o.gainNode=null),o.audioSources.length&&(o.audioSources.forEach((function(e){e.disconnect()})),o.audioSources=[]),o.audioDestination&&(o.audioDestination.disconnect(),o.audioDestination=null),o.audioContext&&o.audioContext.close(),o.audioContext=null,a.clearRect(0,0,r.width,r.height),r.stream&&(r.stream.stop(),r.stream=null)},this.resetVideoStreams=function(e){!e||e instanceof Array||(e=[e]),f(e)},this.name="MultiStreamsMixer",this.toString=function(){return this.name},this.getMixedStream=function(){s=!1;var t=function(){var e;f(),"captureStream"in r?e=r.captureStream():"mozCaptureStream"in r?e=r.mozCaptureStream():o.disableLogs||console.error("Upgrade to latest Chrome or otherwise enable this flag: chrome://flags/#enable-experimental-web-platform-features");var t=new d;return e.getTracks().filter((function(e){return"video"===e.kind})).forEach((function(e){t.addTrack(e)})),r.stream=t,t}(),i=function(){h.AudioContextConstructor||(h.AudioContextConstructor=new h.AudioContext);o.audioContext=h.AudioContextConstructor,o.audioSources=[],!0===o.useGainNode&&(o.gainNode=o.audioContext.createGain(),o.gainNode.connect(o.audioContext.destination),o.gainNode.gain.value=0);var t=0;if(e.forEach((function(e){if(e.getTracks().filter((function(e){return"audio"===e.kind})).length){t++;var i=o.audioContext.createMediaStreamSource(e);!0===o.useGainNode&&i.connect(o.gainNode),o.audioSources.push(i)}})),!t)return;return o.audioDestination=o.audioContext.createMediaStreamDestination(),o.audioSources.forEach((function(e){e.connect(o.audioDestination)})),o.audioDestination.stream}();return i&&i.getTracks().filter((function(e){return"audio"===e.kind})).forEach((function(e){t.addTrack(e)})),e.forEach((function(e){e.fullcanvas})),t}}function P(e,t){e=e||[];var i,s,r=this;(t=t||{elementClass:"multi-streams-mixer",mimeType:"video/webm",video:{width:360,height:240}}).frameInterval||(t.frameInterval=10),t.video||(t.video={}),t.video.width||(t.video.width=360),t.video.height||(t.video.height=240),this.record=function(){var r;i=new L(e,t.elementClass||"multi-streams-mixer"),(r=[],e.forEach((function(e){v(e,"video").forEach((function(e){r.push(e)}))})),r).length&&(i.frameInterval=t.frameInterval||10,i.width=t.video.width||360,i.height=t.video.height||240,i.startDrawingFrames()),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()),(s=new E(i.getMixedStream(),t)).record()},this.stop=function(e){s&&s.stop((function(t){r.blob=t,e(t),r.clearRecordedData()}))},this.pause=function(){s&&s.pause()},this.resume=function(){s&&s.resume()},this.clearRecordedData=function(){s&&(s.clearRecordedData(),s=null),i&&(i.releaseStreams(),i=null)},this.addStreams=function(r){if(!r)throw"First parameter is required.";r instanceof Array||(r=[r]),e.concat(r),s&&i&&(i.appendStreams(r),t.previewStream&&"function"==typeof t.previewStream&&t.previewStream(i.getMixedStream()))},this.resetVideoStreams=function(e){i&&(!e||e instanceof Array||(e=[e]),i.resetVideoStreams(e))},this.getMixer=function(){return i},this.name="MultiStreamRecorder",this.toString=function(){return this.name}}function B(e,t){var i,s,r;function a(){return new ReadableStream({start:function(s){var r=document.createElement("canvas"),a=document.createElement("video"),o=!0;a.srcObject=e,a.muted=!0,a.height=t.height,a.width=t.width,a.volume=0,a.onplaying=function(){r.width=t.width,r.height=t.height;var e=r.getContext("2d"),n=1e3/t.frameRate,l=setInterval((function(){if(i&&(clearInterval(l),s.close()),o&&(o=!1,t.onVideoProcessStarted&&t.onVideoProcessStarted()),e.drawImage(a,0,0),"closed"!==s._controlledReadableStream.state)try{s.enqueue(e.getImageData(0,0,t.width,t.height))}catch(e){}}),n)},a.play()}})}function o(e,l){if(!t.workerPath&&!l)return i=!1,void fetch("https://unpkg.com/webm-wasm@latest/dist/webm-worker.js").then((function(t){t.arrayBuffer().then((function(t){o(e,t)}))}));if(!t.workerPath&&l instanceof ArrayBuffer){var d=new Blob([l],{type:"text/javascript"});t.workerPath=h.createObjectURL(d)}t.workerPath||console.error("workerPath parameter is missing."),(s=new Worker(t.workerPath)).postMessage(t.webAssemblyPath||"https://unpkg.com/webm-wasm@latest/dist/webm-wasm.wasm"),s.addEventListener("message",(function(e){"READY"===e.data?(s.postMessage({width:t.width,height:t.height,bitrate:t.bitrate||1200,timebaseDen:t.frameRate||30,realtime:t.realtime}),a().pipeTo(new WritableStream({write:function(e){i?console.error("Got image, but recorder is finished!"):s.postMessage(e.data.buffer,[e.data.buffer])}}))):e.data&&(r||n.push(e.data))}))}"undefined"!=typeof ReadableStream&&"undefined"!=typeof WritableStream||console.error("Following polyfill is strongly recommended: https://unpkg.com/@mattiasbuelens/web-streams-polyfill/dist/polyfill.min.js"),(t=t||{}).width=t.width||640,t.height=t.height||480,t.frameRate=t.frameRate||30,t.bitrate=t.bitrate||1200,t.realtime=t.realtime||!0,this.record=function(){n=[],r=!1,this.blob=null,o(e),"function"==typeof t.initCallback&&t.initCallback()},this.pause=function(){r=!0},this.resume=function(){r=!1};var n=[];this.stop=function(e){i=!0;var t=this;!function(e){s?(s.addEventListener("message",(function(t){null===t.data&&(s.terminate(),s=null,e&&e())})),s.postMessage(null)):e&&e()}((function(){t.blob=new Blob(n,{type:"video/webm"}),e(t.blob)}))},this.name="WebAssemblyRecorder",this.toString=function(){return this.name},this.clearRecordedData=function(){n=[],r=!1,this.blob=null},this.blob=null}t.DiskStorage=R,t.GifRecorder=D,t.MultiStreamRecorder=P,t.RecordRTCPromisesHandler=function(e,i){if(!this)throw'Use "new RecordRTCPromisesHandler()"';if(void 0===e)throw'First argument "MediaStream" is required.';var s=this;s.recordRTC=new t(e,i),this.startRecording=function(){return new Promise((function(e,t){try{s.recordRTC.startRecording(),e()}catch(e){t(e)}}))},this.stopRecording=function(){return new Promise((function(e,t){try{s.recordRTC.stopRecording((function(i){s.blob=s.recordRTC.getBlob(),s.blob&&s.blob.size?e(i):t("Empty blob.",s.blob)}))}catch(e){t(e)}}))},this.pauseRecording=function(){return new Promise((function(e,t){try{s.recordRTC.pauseRecording(),e()}catch(e){t(e)}}))},this.resumeRecording=function(){return new Promise((function(e,t){try{s.recordRTC.resumeRecording(),e()}catch(e){t(e)}}))},this.getDataURL=function(e){return new Promise((function(e,t){try{s.recordRTC.getDataURL((function(t){e(t)}))}catch(e){t(e)}}))},this.getBlob=function(){return new Promise((function(e,t){try{e(s.recordRTC.getBlob())}catch(e){t(e)}}))},this.getInternalRecorder=function(){return new Promise((function(e,t){try{e(s.recordRTC.getInternalRecorder())}catch(e){t(e)}}))},this.reset=function(){return new Promise((function(e,t){try{e(s.recordRTC.reset())}catch(e){t(e)}}))},this.destroy=function(){return new Promise((function(e,t){try{e(s.recordRTC.destroy())}catch(e){t(e)}}))},this.getState=function(){return new Promise((function(e,t){try{e(s.recordRTC.getState())}catch(e){t(e)}}))},this.blob=null,this.version="5.6.2"},t.WebAssemblyRecorder=B}));class Sn{static _ebsp2rbsp(e){let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)}static parseSPS(e){let t=Sn._ebsp2rbsp(e),i=new Ur(t);i.readByte();let s=i.readByte();i.readByte();let r=i.readByte();i.readUEG();let a=Sn.getProfileString(s),o=Sn.getLevelString(r),n=1,l=420,d=[0,420,422,444],h=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(n=i.readUEG(),3===n&&i.readBits(1),n<=3&&(l=d[n]),h=i.readUEG()+8,i.readUEG(),i.readBits(1),i.readBool())){let e=3!==n?8:12;for(let t=0;t0&&e<16?(v=t[e-1],_=s[e-1]):255===e&&(v=i.readByte()<<8|i.readByte(),_=i.readByte()<<8|i.readByte())}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(4),i.readBool()&&i.readBits(24)),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool()){let e=i.readBits(32),t=i.readBits(32);w=i.readBool(),E=t,T=2*e,S=E/T}}let k=1;1===v&&1===_||(k=v/_);let C=0,x=0;if(0===n)C=1,x=2-m;else{C=3===n?1:2,x=(1===n?2:1)*(2-m)}let R=16*(p+1),D=16*(f+1)*(2-m);R-=(g+y)*C,D-=(A+b)*x;let L=Math.ceil(R*k);return i.destroy(),i=null,{profile_string:a,level_string:o,bit_depth:h,ref_frames:u,chroma_format:l,chroma_format_string:Sn.getChromaFormatString(l),frame_rate:{fixed:w,fps:S,fps_den:T,fps_num:E},sar_ratio:{width:v,height:_},codec_size:{width:R,height:D},present_size:{width:L,height:D}}}static parseSPS$2(e){let t=e.subarray(1,4),i="avc1.";for(let e=0;e<3;e++){let s=t[e].toString(16);s.length<2&&(s="0"+s),i+=s}let s=Sn._ebsp2rbsp(e),r=new Ur(s);r.readByte();let a=r.readByte();r.readByte();let o=r.readByte();r.readUEG();let n=Sn.getProfileString(a),l=Sn.getLevelString(o),d=1,h=420,c=[0,420,422,444],u=8,p=8;if((100===a||110===a||122===a||244===a||44===a||83===a||86===a||118===a||128===a||138===a||144===a)&&(d=r.readUEG(),3===d&&r.readBits(1),d<=3&&(h=c[d]),u=r.readUEG()+8,p=r.readUEG()+8,r.readBits(1),r.readBool())){let e=3!==d?8:12;for(let t=0;t0&&e<16?(w=t[e-1],E=i[e-1]):255===e&&(w=r.readByte()<<8|r.readByte(),E=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);k=r.readBool(),C=t,x=2*e,T=C/x}}let R=1;1===w&&1===E||(R=w/E);let D=0,L=0;if(0===d)D=1,L=2-A;else{D=3===d?1:2,L=(1===d?2:1)*(2-A)}let P=16*(g+1),B=16*(y+1)*(2-A);P-=(b+v)*D,B-=(_+S)*L;let I=Math.ceil(P*R);return r.destroy(),r=null,{codec_mimetype:i,profile_idc:a,level_idc:o,profile_string:n,level_string:l,chroma_format_idc:d,bit_depth:u,bit_depth_luma:u,bit_depth_chroma:p,ref_frames:m,chroma_format:h,chroma_format_string:Sn.getChromaFormatString(h),frame_rate:{fixed:k,fps:T,fps_den:x,fps_num:C},sar_ratio:{width:w,height:E},codec_size:{width:P,height:B},present_size:{width:I,height:B}}}static _skipScalingList(e,t){let i=8,s=8,r=0;for(let a=0;a=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=this.bufoff+e>8?8-this.bufoff:e,t<<=i,t+=this.buffer[this.bufpos]>>8-this.bufoff-i&255>>8-i,this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,i=this.bufoff,s=this.read(e);return this.bufpos=t,this.bufoff=i,s}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),s=new Uint8Array(e+4);s.set(i,0),s.set(t.sps,4),t.sps=s}if(t.pps){const e=t.pps.byteLength,i=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),s=new Uint8Array(e+4);s.set(i,0),s.set(t.pps,4),t.pps=s}return t}function Tn(e){let{sps:t,pps:i}=e,s=8+t.byteLength+1+2+i.byteLength,r=!1;const a=Sn.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(r=!0,s+=4);let o=new Uint8Array(s);o[0]=1,o[1]=t[1],o[2]=t[2],o[3]=t[3],o[4]=255,o[5]=225;let n=t.byteLength;o[6]=n>>>8,o[7]=255&n;let l=8;o.set(t,8),l+=n,o[l]=1;let d=i.byteLength;o[l+1]=d>>>8,o[l+2]=255&d,o.set(i,l+3),l+=3+d,r&&(o[l]=252|a.chroma_format_idc,o[l+1]=248|a.bit_depth_luma-8,o[l+2]=248|a.bit_depth_chroma-8,o[l+3]=0,l+=4);const h=[23,0,0,0,0],c=new Uint8Array(h.length+o.byteLength);return c.set(h,0),c.set(o,h.length),c}function kn(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}function Cn(e){return 31&e[0]}function xn(e){return e===Bt}function Rn(e){return!function(e){return e===xt||e===Rt}(e)&&!xn(e)}function Dn(e){return e===Dt}class Ln{constructor(e){this.data=e,this.eofFlag=!1,this.currentStartcodeOffset=this.findNextStartCodeOffset(0),this.eofFlag&&console.error("Could not find H264 startcode until payload end!")}findNextStartCodeOffset(e){let t=e,i=this.data;for(;;){if(t+3>=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],s=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===s)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let s=31&e[i],r=(128&e[i])>>>7,a=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=a,s>=Ut||0===r&&(t={type:s,data:e.subarray(i,a)})}return t}}class Pn{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Bn=e=>{let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)},In=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Mn{static _ebsp2rbsp(e){let t=e,i=t.byteLength,s=new Uint8Array(i),r=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(s[r]=t[e],r++);return new Uint8Array(s.buffer,0,r)}static parseVPS(e){let t=Mn._ebsp2rbsp(e),i=new Ur(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}}static parseSPS(e){let t=Mn._ebsp2rbsp(e),i=new Ur(t);i.readByte(),i.readByte();let s=0,r=0,a=0,o=0;i.readBits(4);let n=i.readBits(3);i.readBool();let l=i.readBits(2),d=i.readBool(),h=i.readBits(5),c=i.readByte(),u=i.readByte(),p=i.readByte(),f=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),A=i.readByte(),b=i.readByte(),v=i.readByte(),_=i.readByte(),S=[],w=[];for(let e=0;e0)for(let e=n;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<=16?(I=t[e-1],M=s[e-1]):255===e&&(I=i.readBits(16),M=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()){i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())}if(i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),P=i.readBool(),P&&(i.readUEG(),i.readUEG(),i.readUEG(),i.readUEG()),i.readBool()){if(F=i.readBits(32),O=i.readBits(32),i.readBool()&&i.readUEG(),i.readBool()){let e=!1,t=!1,s=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(s=i.readBool(),s&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),s&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let r=0;r<=n;r++){let r=i.readBool();U=r;let a=!0,o=1;r||(a=i.readBool());let n=!1;if(a?i.readUEG():n=i.readBool(),n||(o=i.readUEG()+1),e){for(let e=0;e>6&3,i.general_tier_flag=e[1]>>5&1,i.general_profile_idc=31&e[1],i.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],i.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],i.general_constraint_indicator_flags=i.general_constraint_indicator_flags<<16|e[10]<<8|e[11],i.general_level_idc=e[12],i.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],i.parallelismType=3&e[15],i.chromaFormat=3&e[16],i.bitDepthLumaMinus8=7&e[17],i.bitDepthChromaMinus8=7&e[18],i.avgFrameRate=e[19]<<8|e[20],i.constantFrameRate=e[21]>>6&3,i.numTemporalLayers=e[21]>>3&7,i.temporalIdNested=e[21]>>2&1,i.lengthSizeMinusOne=3&e[21];let s=e[22],r=e.slice(23);for(let e=0;e0)for(let t=i;t<8;t++)e.read(2);s.sub_layer_profile_space=[],s.sub_layer_tier_flag=[],s.sub_layer_profile_idc=[],s.sub_layer_profile_compatibility_flag=[],s.sub_layer_progressive_source_flag=[],s.sub_layer_interlaced_source_flag=[],s.sub_layer_non_packed_constraint_flag=[],s.sub_layer_frame_only_constraint_flag=[],s.sub_layer_level_idc=[];for(let t=0;t{let t=Bn(e),i=new Ur(t);return i.readByte(),i.readByte(),i.readBits(4),i.readBits(2),i.readBits(6),{num_temporal_layers:i.readBits(3)+1,temporal_id_nested:i.readBool()}})(t),o=(e=>{let t=Bn(e),i=new Ur(t);i.readByte(),i.readByte();let s=0,r=0,a=0,o=0;i.readBits(4);let n=i.readBits(3);i.readBool();let l=i.readBits(2),d=i.readBool(),h=i.readBits(5),c=i.readByte(),u=i.readByte(),p=i.readByte(),f=i.readByte(),m=i.readByte(),g=i.readByte(),y=i.readByte(),A=i.readByte(),b=i.readByte(),v=i.readByte(),_=i.readByte(),S=[],w=[];for(let e=0;e0)for(let e=n;e<8;e++)i.readBits(2);for(let e=0;e1&&i.readSEG();for(let e=0;e0&&e<16?(I=t[e-1],M=s[e-1]):255===e&&(I=i.readBits(16),M=i.readBits(16))}if(i.readBool()&&i.readBool(),i.readBool()&&(i.readBits(3),i.readBool(),i.readBool()&&(i.readByte(),i.readByte(),i.readByte())),i.readBool()&&(i.readUEG(),i.readUEG()),i.readBool(),i.readBool(),i.readBool(),P=i.readBool(),P&&(s+=i.readUEG(),r+=i.readUEG(),a+=i.readUEG(),o+=i.readUEG()),i.readBool()&&(F=i.readBits(32),O=i.readBits(32),i.readBool()&&(i.readUEG(),i.readBool()))){let e=!1,t=!1,s=!1;e=i.readBool(),t=i.readBool(),(e||t)&&(s=i.readBool(),s&&(i.readByte(),i.readBits(5),i.readBool(),i.readBits(5)),i.readBits(4),i.readBits(4),s&&i.readBits(4),i.readBits(5),i.readBits(5),i.readBits(5));for(let r=0;r<=n;r++){let r=i.readBool();U=r;let a=!1,o=1;r||(a=i.readBool());let n=!1;if(a?i.readSEG():n=i.readBool(),n||(cpbcnt=i.readUEG()+1),e)for(let e=0;e{let t=Bn(e),i=new Ur(t);i.readByte(),i.readByte(),i.readUEG(),i.readUEG(),i.readBool(),i.readBool(),i.readBits(3),i.readBool(),i.readBool(),i.readUEG(),i.readUEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool()&&i.readUEG(),i.readSEG(),i.readSEG(),i.readBool(),i.readBool(),i.readBool(),i.readBool();let s=i.readBool(),r=i.readBool(),a=1;return r&&s?a=0:r?a=3:s&&(a=2),{parallelismType:a}})(i);r=Object.assign(r,a,o,n);let l=23+(5+t.byteLength)+(5+s.byteLength)+(5+i.byteLength),d=new Uint8Array(l);d[0]=1,d[1]=(3&r.general_profile_space)<<6|(r.general_tier_flag?1:0)<<5|31&r.general_profile_idc,d[2]=r.general_profile_compatibility_flags_1||0,d[3]=r.general_profile_compatibility_flags_2||0,d[4]=r.general_profile_compatibility_flags_3||0,d[5]=r.general_profile_compatibility_flags_4||0,d[6]=r.general_constraint_indicator_flags_1||0,d[7]=r.general_constraint_indicator_flags_2||0,d[8]=r.general_constraint_indicator_flags_3||0,d[9]=r.general_constraint_indicator_flags_4||0,d[10]=r.general_constraint_indicator_flags_5||0,d[11]=r.general_constraint_indicator_flags_6||0,d[12]=60,d[13]=240|(3840&r.min_spatial_segmentation_idc)>>8,d[14]=255&r.min_spatial_segmentation_idc,d[15]=252|3&r.parallelismType,d[16]=252|3&r.chroma_format_idc,d[17]=248|7&r.bit_depth_luma_minus8,d[18]=248|7&r.bit_depth_chroma_minus8,d[19]=0,d[20]=0,d[21]=(3&r.constant_frame_rate)<<6|(7&r.num_temporal_layers)<<3|(r.temporal_id_nested?1:0)<<2|3,d[22]=3,d[23]=128|jt,d[24]=0,d[25]=1,d[26]=(65280&t.byteLength)>>8,d[27]=(255&t.byteLength)>>0,d.set(t,28),d[23+(5+t.byteLength)+0]=128|Gt,d[23+(5+t.byteLength)+1]=0,d[23+(5+t.byteLength)+2]=1,d[23+(5+t.byteLength)+3]=(65280&s.byteLength)>>8,d[23+(5+t.byteLength)+4]=(255&s.byteLength)>>0,d.set(s,23+(5+t.byteLength)+5),d[23+(5+t.byteLength+5+s.byteLength)+0]=128|Vt,d[23+(5+t.byteLength+5+s.byteLength)+1]=0,d[23+(5+t.byteLength+5+s.byteLength)+2]=1,d[23+(5+t.byteLength+5+s.byteLength)+3]=(65280&i.byteLength)>>8,d[23+(5+t.byteLength+5+s.byteLength)+4]=(255&i.byteLength)>>0,d.set(i,23+(5+t.byteLength+5+s.byteLength)+5);const h=[28,0,0,0,0],c=new Uint8Array(h.length+d.byteLength);return c.set(h,0),c.set(d,h.length),c}function jn(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}function zn(e){return(126&e[0])>>1}function Gn(e){return!function(e){return e>=32&&e<=40}(e)}function Hn(e){return e>=16&&e<=21}class Vn{constructor(e){this.data=e,this.eofFlag=!1,this.currentStartcodeOffset=this.findNextStartCodeOffset(0),this.eofFlag&&console.error("Could not find H265 startcode until payload end!")}findNextStartCodeOffset(e){let t=e,i=this.data;for(;;){if(t+3>=i.byteLength)return this.eofFlag=!0,i.byteLength;let e=i[t+0]<<24|i[t+1]<<16|i[t+2]<<8|i[t+3],s=i[t+0]<<16|i[t+1]<<8|i[t+2];if(1===e||1===s)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let i=this.currentStartcodeOffset;i+=1===(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])?4:3;let s=e[i]>>1&63,r=(128&e[i])>>>7,a=this.findNextStartCodeOffset(i);this.currentStartcodeOffset=a,0===r&&(t={type:s,data:e.subarray(i,a)})}return t}}class $n{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}class Wn extends So{constructor(e){super(),this.TAG_NAME="recorderCommon",this.player=e,this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.recordingInterval=null,this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.audioCodeId=null,this.metaInfo={codecWidth:0,codecHeight:0,presentWidth:0,presentHeight:0,refSampleDuration:0,timescale:1e3,avcc:null,videoType:""},this.audioMetaInfo={timescale:1e3,sampleRate:0,refSampleDuration:0,channelCount:0,codec:"",originalCodec:"",audioType:"",extraData:new Uint8Array(0)}}destroy(){this._reset(),this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.audioCodeId=null,this.metaInfo=null,this.audioMetaInfo=null}get isH264(){return this.codecId===vt}get isH265(){return this.codecId===_t}setFileName(e){this.fileName=e}get isRecording(){return this._isRecording}get recording(){return this._isRecording}get recordTime(){return this._recordingTimestamp}startRecord(){}handleAddNaluTrack(e,t,i,s){}handleAddAudioTrack(e,t){}handleAddTrack(e){}stopRecordAndSave(){}startRecordingInterval(){}isWasmMp4(){return!1}stopRecordingInterval(){this.recordingInterval&&clearInterval(this.recordingInterval),this.recordingInterval=null}getToTalByteLength(){return 0}_reset(){this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.stopRecordingInterval()}initMetaData(e,t){let i;const s=e.slice(5);if(this.codecId=t,this.metaInfo.avcc=s,t===vt)i=En(s);else if(t===_t){i=function(e){let t=23;const i=e[t];if((63&i)!==jt)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and vpsTag is ${i}`),{};t+=2,t+=1;const s=e[t+1]|e[t]<<8;t+=2;const r=e.slice(t,t+s);t+=s;const a=e[t];if((63&a)!==Gt)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and sps tag is ${a}`),{};t+=2,t+=1;const o=e[t+1]|e[t]<<8;t+=2;const n=e.slice(t,t+o);t+=o;const l=e[t];if((63&l)!==Vt)return console.warn(`parseHEVCDecoderVPSAndSPSAndPPS and pps tag is ${l}`),{};t+=2,t+=1;const d=e[t+1]|e[t]<<8;t+=2;const h=e.slice(t,t+d),c=new Uint8Array([o>>>24&255,o>>>16&255,o>>>8&255,255&o]),u=new Uint8Array([d>>>24&255,d>>>16&255,d>>>8&255,255&d]),p=new Uint8Array([s>>>24&255,s>>>16&255,s>>>8&255,255&s]),f=new Uint8Array(o+4);f.set(c,0),f.set(n,4);const m=new Uint8Array(d+4);m.set(u,0),m.set(h,4);const g=new Uint8Array(s+4);return g.set(p,0),g.set(r,4),{sps:f,pps:m,vps:g}}(s);const t=Un(e);i=Object.assign(i,t)}i&&(i.vps&&(this.vps=i.vps),i.pps&&(this.pps=i.pps),i.sps&&(this.sps=i.sps),i.presentWidth&&(this.metaInfo.presentWidth=i.presentWidth),i.presentHeight&&(this.metaInfo.presentHeight=i.presentHeight),i.codecWidth&&(this.metaInfo.codecWidth=i.codecWidth),i.codecHeight&&(this.metaInfo.codecHeight=i.codecHeight),i.timescale&&(this.metaInfo.timescale=i.timescale),i.refSampleDuration&&(this.metaInfo.refSampleDuration=i.refSampleDuration),i.videoType&&(this.metaInfo.videoType=i.videoType))}initAudioMetaData(e,t){this.audioCodeId=t;const i=e[0]>>1&1;let s=null;t===Et?(s=function(e){let t={},i=new Wr(e);return i.read(16),t.object_type=Jr(i),t.sample_rate=qr(i,t),t.chan_config=i.read(4),t.chan_config{r.onload=function(e){i.decode(this.result).forEach((function(e){t.read(e)})),t.stop();const r=s.makeMetadataSeekable(t.metadatas,t.duration,t.cues),o=this.result.slice(t.metadataSize),n=new Blob([r,o],{type:"video/webm"});a(n)},r.readAsArrayBuffer(e)}))}startRecord(){const e=this.player.debug,t={type:"video",mimeType:"video/webm;codecs=h264",timeSlice:1e3,onTimeStamp:t=>{e.log("RecorderRTC","record timestamp :"+t),null===this._startRecordingTimestamp&&(this._startRecordingTimestamp=t),this._recordingTimestamp=(t-this._startRecordingTimestamp)/1e3},ondataavailable:t=>{this.totalByteLength+=t.size,e.log("RecorderRTC","ondataavailable",t.size)},disableLogs:!this.player._opt.debug};try{let i=null;if(this.player.getRenderType()===$?i=this.player.video.$videoElement.captureStream(25):this.player.video.mediaStream?i=this.player.video.mediaStream:this.player.isOldHls()||this.player._opt.useMSE||this.player._opt.useWCS?i=this.player.video.$videoElement.captureStream(25):this.player.isWebrtcH264()?i=this.player.webrtc.videoStream:this.player.isAliyunRtc()&&(i=this.player.video.$videoElement.captureStream(25)),!i)return e.error("RecorderRTC","startRecord error and can not create stream"),void this.player.emitError(nt.recordCreateError,"can not create stream");if(this.player.audio&&this.player.audio.mediaStreamAudioDestinationNode&&this.player.audio.mediaStreamAudioDestinationNode.stream&&!this.player.audio.isStateSuspended()&&this.player.audio.hasAudio&&this.player._opt.hasAudio){const e=this.player.audio.mediaStreamAudioDestinationNode.stream;if(e.getAudioTracks().length>0){const t=e.getAudioTracks()[0];t&&t.enabled&&i.addTrack(t)}}this.recorder=_n(i,t)}catch(t){return e.error("RecorderRTC","startRecord error",t),void this.player.emitError(nt.recordCreateError,t)}this.recorder&&(this._isRecording=!0,this.player.emit(nt.recording,!0),this.recorder.startRecording(),e.log("RecorderRTC","start recording"),this.player.emit(nt.recordStart),this.startRecordingInterval())}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(nt.recordingTimestamp,this._recordingTimestamp)}),1e3)}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{this.recorder&&this._isRecording||s("recorder is not ready"),t&&this.setFileName(t),this.recorder.stopRecording((()=>{this.player.debug.log("RecorderRTC","stop recording");const t=(this.fileName||aa())+"."+w;if(this.recorder.getBlob(),e===At){const e=this.recorder.getBlob();i(e),this.player.emit(nt.recordBlob,e)}else i(),this.recorder.save(t);this.player.emit(nt.recordEnd),this._reset(),this.player.emit(nt.recording,!1)}))}))}getToTalByteLength(){return this.totalByteLength}getTotalDuration(){return this.recordTime}getType(){return w}initMetaData(){}}class qn{static init(){qn.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],free:[],edts:[],elst:[],stss:[]};for(let e in qn.types)qn.types.hasOwnProperty(e)&&(qn.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=qn.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,97,118,99,49,109,112,52,49,0,0,0,0]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=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]),e.HDLR_AUDIO=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]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,s=Array.prototype.slice.call(arguments,1),r=s.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let a=8;for(let e=0;e=Math.pow(2,32)-1?(a=16,o=new Uint8Array(i+a),o.set(new Uint8Array([0,0,0,1]),0),o.set(qn.types.mdat,4),o.set(new Uint8Array([i+8>>>56&255,i+8>>>48&255,i+8>>>40&255,i+8>>>32&255,i+8>>>24&255,i+8>>>16&255,i+8>>>8&255,i+8&255]),8)):(o=new Uint8Array(i+a),o[0]=i+8>>>24&255,o[1]=i+8>>>16&255,o[2]=i+8>>>8&255,o[3]=i+8&255,o.set(qn.types.mdat,4));for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,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,0,0,0,3]))}static trak(e){return qn.box(qn.types.trak,qn.tkhd(e),qn.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,s=e.presentWidth,r=e.presentHeight;return qn.box(qn.types.tkhd,new Uint8Array([0,0,0,15,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,r>>>8&255,255&r,0,0]))}static edts(e,t){return qn.box(qn.types.edts,qn.elst(e,t))}static elst(e,t){let i=0;for(let s=0;s>>24&255,i>>>16&255,i>>>8&255,255&i,255,255,255,255,0,1,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,0,0,0,0,0,1,0,0]))}static mdia(e){return qn.box(qn.types.mdia,qn.mdhd(e),qn.hdlr(e),qn.minf(e))}static mdhd(e){let t=e.timescale/e.refSampleDuration,i=t*e.duration/e.timescale;return qn.box(qn.types.mdhd,new Uint8Array([0,0,0,0,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t=qn.constants.HDLR_VIDEO,qn.box(qn.types.hdlr,t)}static minf(e){let t=null;return t=qn.box(qn.types.vmhd,qn.constants.VMHD),qn.box(qn.types.minf,t,qn.dinf(),qn.stbl(e))}static dinf(){return qn.box(qn.types.dinf,qn.box(qn.types.dref,qn.constants.DREF))}static stbl(e){let t=e.samples,i=[{No:1,num:0,sampleDelte:1,chunkNo:1,duration:t[0].duration}],s=[t[0].duration],r=t.length;for(let e=0;e>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+8*t);r.set(i,0);for(let i=0;i>>24&255,e[i].num>>>16&255,e[i].num>>>8&255,255&e[i].num,e[i].sampleDelte>>>24&255,e[i].sampleDelte>>>16&255,e[i].sampleDelte>>>8&255,255&e[i].sampleDelte]),s),s+=8;return qn.box(qn.types.stts,r)}static stss(e){let t=[],i=e.length;for(let s=0;s>>24&255,s>>>16&255,s>>>8&255,255&s]),a=r.byteLength,o=new Uint8Array(a+4*s);o.set(r,0);for(let e=0;e>>24&255,t[e]>>>16&255,t[e]>>>8&255,255&t[e]]),a),a+=4;return qn.box(qn.types.stss,o)}static stsc(e){let t=e.length,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+12*t);r.set(i,0);for(let i=0;i>>24&255,t>>>16&255,t>>>8&255,255&t,a>>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o]),s),s+=12}return qn.box(qn.types.stsc,r)}static stsz(e){let t=e.length,i=new Uint8Array([0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t]),s=i.byteLength,r=new Uint8Array(s+4*t);r.set(i,0);for(let i=0;i>>24&255,t>>>16&255,t>>>8&255,255&t]),s),s+=4}return qn.box(qn.types.stsz,r)}static stco(e,t){let i=t[0].chunkOffset;return qn.box(qn.types.stco,new Uint8Array([0,0,0,0,0,0,0,1,i>>>24&255,i>>>16&255,i>>>8&255,255&i]))}static stsd(e){return"audio"===e.type?"mp3"===e.codec?qn.box(qn.types.stsd,qn.constants.STSD_PREFIX,qn.mp3(e)):qn.box(qn.types.stsd,qn.constants.STSD_PREFIX,qn.mp4a(e)):"avc"===e.videoType?qn.box(qn.types.stsd,qn.constants.STSD_PREFIX,qn.avc1(e)):qn.box(qn.types.stsd,qn.constants.STSD_PREFIX,qn.hvc1(e))}static mp3(e){let t=e.channelCount,i=e.sampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return qn.box(qn.types[".mp3"],s)}static mp4a(e){let t=e.channelCount,i=e.sampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return qn.box(qn.types.mp4a,s,qn.esds(e))}static esds(e){let t=e.config||[],i=t.length,s=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return qn.box(qn.types.esds,s)}static avc1(e){let t=e.avcc,i=e.codecWidth,s=e.codecHeight,r=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,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return qn.box(qn.types.avc1,r,qn.box(qn.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=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,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return qn.box(qn.types.hvc1,r,qn.box(qn.types.hvcC,t))}static mvex(e){return qn.box(qn.types.mvex,qn.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return qn.box(qn.types.trex,i)}static moof(e,t){return qn.box(qn.types.moof,qn.mfhd(e.sequenceNumber),qn.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return qn.box(qn.types.mfhd,t)}static traf(e,t){let i=e.id,s=qn.box(qn.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),r=qn.box(qn.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),a=qn.sdtp(e),o=qn.trun(e,a.byteLength+16+16+8+16+8+8);return qn.box(qn.types.traf,s,r,o,a)}static sdtp(e){let t=e.samples||[],i=t.length,s=new Uint8Array(4+i);for(let e=0;e>>24&255,s>>>16&255,s>>>8&255,255&s,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);for(let e=0;e>>24&255,t>>>16&255,t>>>8&255,255&t,s>>>24&255,s>>>16&255,s>>>8&255,255&s,r.isLeading<<2|r.dependsOn,r.isDependedOn<<6|r.hasRedundancy<<4|r.isNonSync,0,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o],12+16*e)}return qn.box(qn.types.trun,a)}static mdat(e){return qn.box(qn.types.mdat,e)}}qn.init();class Kn extends Wn{constructor(e){super(e),this.TAG_NAME="recorderMP4",this._reset(),e.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this._reset(),this.player.debug.log(this.TAG_NAME,"destroy")}_reset(){super._reset(),this.totalDuration=0,this.totalAudioDuration=0,this.totalByteLength=0,this.totalAudioByteLength=0,this.bufferList=[],this.audioBufferList=[],this.cacheTrack={},this.audioCacheTrack={},this.sequenceNumber=0,this.audioSequenceNumber=0}startRecord(){const e=this.player.debug;this._isRecording=!0,this.player.emit(nt.recording,!0),e.log(this.TAG_NAME,"start recording"),this.player.emit(nt.recordStart),this.startRecordingInterval()}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(nt.recordingTimestamp,this.getTotalDuration())}),1e3)}formatFmp4Track(e,t,i,s){return{id:1,sequenceNumber:++this.sequenceNumber,size:e.byteLength,dts:i,cts:s,isKeyframe:t,data:e,duration:0,flags:{isLeading:0,dependsOn:t?2:1,isDependedOn:t?1:0,hasRedundancy:0,isNonSync:t?0:1}}}formatAudioFmp4Track(e,t){return{id:2,sequenceNumber:++this.audioSequenceNumber,size:e.byteLength,dts:t,pts:t,cts:0,data:new Uint8Array(e),duration:0,originalDts:t,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}}handleAddNaluTrack(e,t,i,s){this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.handleAddFmp4Track(this.cacheTrack)):this.cacheTrack={},this.cacheTrack=this.formatFmp4Track(e,t,i,s)}handleAddAudioTrack(e,t){}handleAddFmp4Track(e){if(!this.isRecording)return void this.player.debug.error(this.TAG_NAME,"handleAddFmp4Track, isRecording is false ");if((null===this.sps||null===this.pps)&&this.isH264)return void this.player.debug.error(this.TAG_NAME,"handleAddFmp4Track, is h264 and this.sps or this.pps is null ");if((null===this.sps||null===this.pps||null===this.vps)&&this.isH265)return void this.player.debug.error(this.TAG_NAME,"handleAddFmp4Track, is h265 and this.sps or this.pps or this.vps is null ");const t=Object.assign({},e);t.pts=t.dts+t.cts;const i=t.data;if(t.isKeyframe)if(this.isH264){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength);e.set(this.sps,0),e.set(this.pps,this.sps.byteLength);const s=new Uint8Array(e.byteLength+i.byteLength);s.set(e,0),s.set(i,e.byteLength),t.data=s}else if(this.isH265){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength+this.vps.byteLength);e.set(this.vps,0),e.set(this.sps,this.vps.byteLength),e.set(this.pps,this.vps.byteLength+this.sps.byteLength);const s=new Uint8Array(e.byteLength+i.byteLength);s.set(e,0),s.set(i,e.byteLength),t.data=s}t.size=t.data.byteLength,this.totalDuration+=t.duration,this.totalByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.bufferList.push(t)}handleAddFmp4AudioTrack(e){const t=Object.assign({},e);t.pts=t.dts+t.cts,t.size=t.data.byteLength,this.totalAudioDuration+=t.duration,this.totalAudioByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.audioBufferList.push(t)}getTotalDuration(){return this.totalDuration/1e3}getType(){return S}getToTalByteLength(){return this.totalByteLength+this.totalAudioByteLength}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{if(!this.isRecording)return this.player.debug.error(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false ");if(0===this.bufferList.length)return this.player.debug.error(this.TAG_NAME,"stop recording fail, this.bufferList.length is 0 "),s("stop recording fail, this.bufferList.length is 0 ");t&&this.setFileName(t);const r={id:1,type:"video",sps:this.sps,pps:this.pps,samples:this.bufferList,sequenceNumber:this.bufferList.length,length:0,addSampleNum:1,duration:0,...this.metaInfo},a={id:2,type:"audio",sequenceNumber:this.audioBufferList.length,samples:this.audioBufferList,...this.audioMetaInfo},o=[r];a.samples.length>0&&o.push(a),this.player.debug.log(this.TAG_NAME,`trackList length is ${o.length}`);const n=qn.generateInitSegment({timescale:1e3,duration:this.totalDuration},o,this.totalByteLength+this.totalAudioByteLength);this.player.debug.log(this.TAG_NAME,"stop recording");const l=new Blob([n],{type:"application/octet-stream"});if(e===At)i(l),this.player.emit(nt.recordBlob,l);else{i();Da((this.fileName||aa())+"."+S,l)}this._reset(),this.player.emit(nt.recording,!1)}))}}class Yn extends Wn{constructor(e){super(e),this.TAG_NAME="FlvRecorderLoader",this.player=e,this._init(),this.player.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this._init(),this.player.debug.log(this.TAG_NAME,"destroy")}_init(){this.hasAudio=!1,this.hasVideo=!1,this.startTime=null,this.currentTime=0,this.prevTimestamp=0,this.totalByteLength=0,this.totalDuration=0,this.flvMetaData=null,this.aacSequenceHeader=null,this.videoSequenceHeader=null,this.bufferList=[]}_reset(){super._reset(),this._init()}startRecord(){const e=this.player.debug;this._isRecording=!0,this.player.emit(nt.recording,!0),e.log(this.TAG_NAME,"start recording"),this.player.emit(nt.recordStart),this.startRecordingInterval()}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(nt.recordingTimestamp,this.getTotalDuration())}),1e3)}addMetaData(e){this.flvMetaData=e}addAACSequenceHeader(e){this.aacSequenceHeader=e}addVideoSequenceHeader(e){this.videoSequenceHeader=e}addVideo(e,t){this._setStartTime(t);const i=this._getBufferTs(t);this.hasVideo=!0,this._createBufferItem(e,Ge,i)}addAudio(e,t){this._setStartTime(t);const i=this._getBufferTs(t);this.hasAudio=!0,this._createBufferItem(e,ze,i)}_setStartTime(e){null===this.startTime&&this._isRecording&&(this.startTime=e,this.player.debug.log(this.TAG_NAME,`_setStartTime is ${e}`))}_getBufferTs(e){e>this.currentTime&&(this.currentTime=e);let t=0;return this.startTime&&e>=this.startTime&&(t=e-this.startTime),t>this.prevTimestamp?this.prevTimestamp=t:t=this.prevTimestamp,t}_createBufferItem(e,t,i){const s=this._createFlvPacket(e,t,i),r=this._createFlvTag(s);this.totalByteLength+=r.byteLength,this.bufferList.push(r)}_createFlvTag(e){let t=11+e.header.length,i=new Uint8Array(t+4);i[0]=e.header.type;let s=new DataView(i.buffer);return i[1]=e.header.length>>16&255,i[2]=e.header.length>>8&255,i[3]=255&e.header.length,i[4]=e.header.timestamp>>16&255,i[5]=e.header.timestamp>>8&255,i[6]=255&e.header.timestamp,i[7]=e.header.timestamp>>24&255,i[8]=0,i[9]=0,i[10]=0,s.setUint32(t,t),i.set(e.payload.subarray(0,e.header.length),11),i}_createFlvPacket(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{header:{length:e?e.length:0,timestamp:i,type:t},payload:e}}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>{if(!this.isRecording)return this.player.debug.error(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false ");if(0===this.bufferList.length)return this.player.debug.error(this.TAG_NAME,"stop recording fail, this.bufferList.length is 0 "),s("stop recording fail, this.bufferList.length is 0 ");t&&this.setFileName(t);const r=new Uint8Array([70,76,86,1,0,0,0,0,9,0,0,0,0]);this.hasVideo&&(r[4]|=1),this.hasAudio&&(r[4]|=4);let a=[r];if(this.flvMetaData){const e=this._createFlvPacket(this.flvMetaData,He),t=this._createFlvTag(e);a.push(t)}if(this.videoSequenceHeader){const e=this._createFlvPacket(this.videoSequenceHeader,Ge),t=this._createFlvTag(e);a.push(t)}if(this.aacSequenceHeader){const e=this._createFlvPacket(this.aacSequenceHeader,ze),t=this._createFlvTag(e);a.push(t)}const o=function(e){const t=e[0].constructor;return e.reduce(((e,i)=>{const s=new t((0|e.byteLength)+(0|i.byteLength));return s.set(e,0),s.set(i,0|e.byteLength),s}),new t)}(a.concat(this.bufferList));this.player.debug.log(this.TAG_NAME,"stop recording");const n=new Blob([o],{type:"application/octet-stream"});if(e===At)i(n),this.player.emit(nt.recordBlob,n);else{i();Da((this.fileName||aa())+"."+E,n)}this._reset(),this.player.emit(nt.recording,!1)}))}getTotalDuration(){let e=0;return null!==this.startTime&&null!==this.currentTime&&(e=this.currentTime-this.startTime),Math.round(e/1e3)}getType(){return E}getToTalByteLength(){return this.totalByteLength}}const Qn={init:0,findFirstStartCode:1,findSecondStartCode:2};class Xn extends So{constructor(e){super(),this.player=e,this.isDestroyed=!1,this.reset()}destroy(){this.isDestroyed=!1,this.off(),this.reset()}reset(){this.stats=Qn.init,this.tempBuffer=new Uint8Array(0),this.parsedOffset=0,this.versionLayer=0}dispatch(e,t){let i=new Uint8Array(this.tempBuffer.length+e.length);for(i.set(this.tempBuffer,0),i.set(e,this.tempBuffer.length),this.tempBuffer=i;!this.isDestroyed;){if(this.state==Qn.Init){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=Qn.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==Qn.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=Qn.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==Qn.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=Qn.findFirstStartCode}}}}class Zn extends Wn{constructor(e){super(e),this.TAG_NAME="recorderWasmMP4",this._reset(),this.wasmMp4Recorder=new window.JessibucaProMp4Recorder({debug:e._opt.debug,debugLevel:e._opt.debugLevel,debugUuid:e._opt.debugUuid,decoder:e._opt.wasmMp4RecorderDecoder}),this.wasmMp4Recorder.on("recordingTimestamp",(e=>{this._recordingTimestamp=e/1e3})),this.mp3Demuxer=null,e.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.mp3Demuxer&&(this.mp3Demuxer.destroy(),this.mp3Demuxer=null),this._reset(),this.player.debug.log(this.TAG_NAME,"destroy")}_reset(){super._reset(),this.cacheTrack={},this.audioCacheTrack={},this.totalDuration=0,this.totalAudioDuration=0,this.totalByteLength=0,this.totalAudioByteLength=0,this.hasAudio=!1,this.hasVideo=!1}getType(){return S}isWasmMp4(){return!0}getTotalDuration(){return this.totalDuration/1e3}getToTalByteLength(){return this.totalByteLength+this.totalAudioByteLength}startRecord(){const e=this.player.debug,t=this.player.getAudioInfo(),i=this.player.getVideoInfo(),s={};if(this.codecId){const e={type:this.codecId,width:i.width,height:i.height,extraData:this.metaInfo.avcc};s.video=e,this.hasVideo=!0}if(t.encTypeCode){const e={type:t.encTypeCode,sampleRate:t.sampleRate,channels:t.channels,extraData:this.audioMetaInfo.extraData,depth:t.depth};this.audioCodeId=t.encTypeCode,s.audio=e,this.hasAudio=!0}this.wasmMp4Recorder.startRecord(s).then((()=>{this._isRecording=!0,this.player.emit(nt.recording,!0),e.log(this.TAG_NAME,"start recording"),this.player.emit(nt.recordStart),this.startRecordingInterval()})).catch((t=>{e.error(this.TAG_NAME,"startRecord error",t),this.player.emitError(nt.recordCreateError,t)}))}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval((()=>{this.player.emit(nt.recordingTimestamp,this.recordTime)}),1e3)}stopRecordAndSave(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:yt,t=arguments.length>1?arguments[1]:void 0;return new Promise(((i,s)=>this.isRecording?0===this.totalDuration?(this.player.debug.error(this.TAG_NAME,"stop recording fail, totalDuration is 0 "),s("stop recording fail, totalDuration is 0 ")):(t&&this.setFileName(t),void this.wasmMp4Recorder.stopRecord().then((t=>{if(e===At)i(t),this.player.emit(nt.recordBlob,t);else{i();Da((this.fileName||aa())+"."+S,t)}})).catch((e=>{this.player.debug.error(this.TAG_NAME,"stopRecord error",e),s(e)})).finally((()=>{this._reset(),this.player.emit(nt.recording,!1)}))):(this.player.debug.error(this.TAG_NAME,"stop recording fail, isRecording is false "),s("stop recording fail, isRecording is false "))))}handleAddAudioTrack(e,t){this.audioCodeId===Tt?(this.mp3Demuxer||(this.mp3Demuxer=new Xn(this.player),this.mp3Demuxer.on("data",((e,t)=>{this._handleAddAudioTrack(e,t)}))),this.mp3Demuxer.dispatch(e,t)):this._handleAddAudioTrack(e,t)}_handleAddAudioTrack(e,t){po(this.hasAudio)||(this.audioCacheTrack.id&&t>=this.audioCacheTrack.dts?(this.audioCacheTrack.duration=t-this.audioCacheTrack.dts,this.totalAudioDuration+=this.audioCacheTrack.duration,this.totalAudioByteLength+=this.audioCacheTrack.payload.byteLength,this.wasmMp4Recorder.sendAudioFrame(this.audioCacheTrack.payload,this.audioCacheTrack.dts)):this.audioCacheTrack={},this.audioCacheTrack={id:2,payload:e,dts:t})}handleAddNaluTrack(e,t,i,s){po(this.hasVideo)||(this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.totalDuration+=this.cacheTrack.duration,this.totalByteLength+=this.cacheTrack.payload.byteLength,this.wasmMp4Recorder.sendVideoFrame(this.cacheTrack.payload,this.cacheTrack.isIFrame,this.cacheTrack.dts,this.cacheTrack.cts)):this.cacheTrack={},this.cacheTrack={id:1,payload:e,isIFrame:t,dts:i,cts:s})}}class el{constructor(e){return new(el.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){if(e.recordType===S){if(e.useWasm||e.useMSE||e.useWCS)return window.JessibucaProMp4Recorder&&e.mp4RecordUseWasm?Zn:Kn}else if(e.recordType===E)return Yn;return Jn}}function tl(e,t,i){let s=e;if(t+i=128){t.push(String.fromCharCode(65535&e)),s+=2;continue}}}else if(i[s]<240){if(tl(i,s,2)){let e=(15&i[s])<<12|(63&i[s+1])<<6|63&i[s+2];if(e>=2048&&55296!=(63488&e)){t.push(String.fromCharCode(65535&e)),s+=3;continue}}}else if(i[s]<248&&tl(i,s,3)){let e=(7&i[s])<<18|(63&i[s+1])<<12|(63&i[s+2])<<6|63&i[s+3];if(e>65536&&e<1114112){e-=65536,t.push(String.fromCharCode(e>>>10|55296)),t.push(String.fromCharCode(1023&e|56320)),s+=4;continue}}t.push(String.fromCharCode(65533)),++s}return t.join("")}let sl=function(){let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}();class rl{static parseScriptData(e,t,i){let s={};try{let r=rl.parseValue(e,t,i),a=rl.parseValue(e,t+r.size,i-r.size);s[r.data]=a.data}catch(e){console.error("AMF",e.toString())}return s}static parseObject(e,t,i){let s=rl.parseString(e,t,i),r=rl.parseValue(e,t+s.size,i-s.size),a=r.objectEnd;return{data:{name:s.data,value:r.data},size:s.size+r.size,objectEnd:a}}static parseVariable(e,t,i){return rl.parseObject(e,t,i)}static parseString(e,t,i){let s,r=new DataView(e,t,i).getUint16(0,!sl);return s=r>0?il(new Uint8Array(e,t+2,r)):"",{data:s,size:2+r}}static parseLongString(e,t,i){let s,r=new DataView(e,t,i).getUint32(0,!sl);return s=r>0?il(new Uint8Array(e,t+4,r)):"",{data:s,size:4+r}}static parseDate(e,t,i){let s=new DataView(e,t,i),r=s.getFloat64(0,!sl);return r+=60*s.getInt16(8,!sl)*1e3,{data:new Date(r),size:10}}static parseValue(e,t,i){let s,r=new DataView(e,t,i),a=1,o=r.getUint8(0),n=!1;try{switch(o){case 0:s=r.getFloat64(1,!sl),a+=8;break;case 1:s=!!r.getUint8(1),a+=1;break;case 2:{let r=rl.parseString(e,t+1,i-1);s=r.data,a+=r.size;break}case 3:{s={};let o=0;for(9==(16777215&r.getUint32(i-4,!sl))&&(o=3);a{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te)}this.decoderWorker=new Worker(t),this._initDecoderWorker(),e.debug.log("decoderWorker",`init and decoder url is ${t}`),e.on(nt.visibilityChange,(()=>{this.updateWorkConfig({key:"visibility",value:e.visibility})}))}destroy(){return new Promise(((e,t)=>{if(this.player.loaded)if(this.player.debug.log("decoderWorker","has loaded and post message to destroy"),this.decoderWorker){const t={};this.player.isMseDecoderUseWorker()&&(t.isVideoInited=this.player.isMseVideoStateInited()),this.decoderWorker.postMessage({cmd:qe,options:t}),this.destroyResolve=e,this.decoderWorkerCloseTimeout=setTimeout((()=>{this.player.debug.warn("decoderWorker","send close but not response and destroy directly"),this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this._destroy(),setTimeout((()=>{e()}),0)}),2e3)}else this.player.debug.warn("decoderWorker","has loaded but decoderWorker is null and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0);else this.player.debug.log("decoderWorker","has not loaded and destroy directly"),this._destroy(),setTimeout((()=>{e()}),0)}))}_destroy(){this.decoderWorkerCloseTimeout&&(clearTimeout(this.decoderWorkerCloseTimeout),this.decoderWorkerCloseTimeout=null),this.workerUrl&&(window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.decoderWorker&&(this.decoderWorker.terminate(),this.decoderWorker.onerror=null,this.decoderWorker.onmessageerror=null,this.decoderWorker.onmessage=null,this.decoderWorker=null),this.player.debug.log("decoderWorker","destroy"),this.destroyResolve&&(this.destroyResolve(),this.destroyResolve=null)}_initDecoderWorker(){const{debug:e,events:{proxy:t}}=this.player;this.decoderWorker.onerror=e=>{this.player.debug.error("decoderWorker","onerror",e),this.player.emitError(ct.decoderWorkerInitError,e)},this.decoderWorker.onmessageerror=e=>{this.player.debug.error("decoderWorker","onmessageerror",e)},this.decoderWorker.onmessage=t=>{const i=t.data;switch(i.cmd){case re:e.log("decoderWorker","onmessage:",re),this.decoderWorker&&this._initWork(),this.player.loaded||this.player.emit(nt.load),this.player.emit(nt.decoderWorkerInit);break;case ue:e.log("decoderWorker","onmessage:",ue,i.code),this.player._times.decodeStart||(this.player._times.decodeStart=aa()),this.player.video.updateVideoInfo({encTypeCode:i.code});break;case pe:e.log("decoderWorker","onmessage:",pe,i.codecId),this.player.recorder&&this.player.recorder.initMetaData(i.buffer,i.codecId),this.player.video.updateVideoInfo({encTypeCode:i.codecId});break;case de:e.log("decoderWorker","onmessage:",de,i.code),this.player.audio&&this.player.audio.updateAudioInfo({encTypeCode:i.code});break;case ce:e.log("decoderWorker","onmessage:",ce),this.player.recorder&&this.player.recorder.initAudioAacExtraData(i.buffer);break;case ae:if(e.log("decoderWorker","onmessage:",ae,`width:${i.w},height:${i.h}`),La(i.w)||La(i.h))return void this.player.emitError(ct.videoInfoError,`video width ${i.w} or height ${i.h} is empty`);if(this.player.video.updateVideoInfo({width:i.w,height:i.h}),!this.player._opt.openWebglAlignment&&i.w/2%4!=0&&this.player.getRenderType()===$)return void this.player.emitError(ct.webglAlignmentError);this.player.video.initCanvasViewSize(),this.player._opt.playType===_&&(this.player.video.initFps(),this.player.video.initVideoDelay());break;case le:if(e.log("decoderWorker","onmessage:",le,`channels:${i.channels},sampleRate:${i.sampleRate}`),i.channels>2)return void this.player.emitError(ct.audioChannelError,`audio channel is ${i.channels}, max is 2`);this.player.audio&&(this.player.audio.updateAudioInfo(i),this.player._opt.playType===b?this.player.audio.initScriptNode():this.player._opt.playType===_&&this.player.audio.initScriptNodeDelay());break;case oe:if(!this.player.video)return void e.warn("decoderWorker","onmessage render but video is null");if(this.player.isPlayer()){if(po(this.player.video.getHasInit()))return void e.warn("decoderWorker","onmessage render but video has not init");this.player.video.render(i),this.player.handleRender(),this.player.emit(nt.timeUpdate,i.ts),this.player.updateStats({dfps:!0,buf:i.delay}),this.player._times.videoStart||(this.player._times.videoStart=aa(),this.player.handlePlayToRenderTimes())}else this.player.isPlayback()&&(this.player.updateStats({dfps:!0}),po(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this.player.playback.isUseFpsRender?this.player.video.pushData(i):this.player.video.render$2(i)):!this.player.playback.isPlaybackPauseClearCache&&this.player.playback.isCacheBeforeDecodeForFpsRender&&this.player.playback.isUseFpsRender&&this.player.video.pushData(i));break;case fe:this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===S&&this.player.recorder.handleAddNaluTrack(i.buffer,i.isIFrame,i.ts,i.cts);break;case he:this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===S&&this.player.recorder.isWasmMp4()&&this.player.recorder.handleAddAudioTrack(i.buffer,i.ts);break;case me:const{webcodecsDecoder:t,mseDecoder:s}=this.player;this.player.updateStats({buf:i.delay});const r=new Uint8Array(i.payload);this.player._opt.useWCS&&!this.player._opt.useOffscreen?t.decodeVideo(r,i.ts,i.isIFrame,i.cts):this.player._opt.useMSE&&s.decodeVideo(r,i.ts,i.isIFrame,i.cts);break;case ge:if(this.player._opt.useMSE){const e=new Uint8Array(i.payload);this.player.mseDecoder.decodeAudio(e,i.ts,i.cts)}break;case ne:if(!this.player.audio)return void e.warn("decoderWorker","onmessage playAudio but audio is null");(this.player.playing&&this.player.audio||!this.player.video)&&(this.player._opt.hasVideo||this.player.handleRender(),(this.player._opt.playType===b||this.player._opt.playType===_&&(po(this.player.playbackPause)||!this.player.playback.isPlaybackPauseClearCache&&this.player.playback.isCacheBeforeDecodeForFpsRender&&this.player.playback.isUseFpsRender))&&this.player.audio.play(i.buffer,i.ts));break;case Ae:if(i.type===nt.streamSuccess)this.player.stream?this.player.stream.emit(nt.streamSuccess):e.warn("decoderWorker","onmessage and workerFetch response stream success but stream is null");else if(i.type===nt.streamRate)this.player.emit(nt.kBps,(i.value/1024).toFixed(2));else if(i.type===nt.streamEnd)this.player?(i.value===f&&this.player.emit(nt.websocketClose,i.msg),this.player.stream?this.player.stream.emit(nt.streamEnd,i.msg):e&&e.warn("decoderWorker","onmessage and workerFetch response stream end but player.stream is null")):e&&e.warn("decoderWorker","onmessage and workerFetch response stream end but player is null");else if(i.type===ct.websocketError)this.player&&this.player.stream?this.player.stream.emit(ct.websocketError,i.value):e&&e.warn("decoderWorker","onmessage and workerFetch response websocket error but stream is null");else if(i.type===ct.fetchError)this.player&&this.player.stream?this.player.stream.emit(ct.fetchError,i.value):e&&e.warn("decoderWorker","onmessage and workerFetch response fetch error but stream is null");else if(i.type===nt.streamAbps)this.player.updateStats({abps:i.value});else if(i.type===nt.streamVbps)this.player._times.demuxStart||(this.player._times.demuxStart=aa()),this.player.updateStats({vbps:i.value});else if(i.type===nt.streamDts)this.player.updateStats({dts:i.value});else if(i.type===nt.netBuf)this.player.updateStats({netBuf:i.value});else if(i.type===nt.networkDelayTimeout)this.player.emit(nt.networkDelayTimeout,i.value);else if(i.type===nt.streamStats){const e=JSON.parse(i.value);this.player.updateStats({workerStats:e})}else i.type===nt.websocketOpen&&this.player.emit(nt.websocketOpen);break;case be:this.player&&(this.player.videoIframeIntervalTs=i.value);break;case ve:this.player&&this.player.updateStats({isDropping:!0});break;case Ie:this.player.decoderCheckFirstIFrame();break;case Se:this.player&&this.player.video&&this.player.video.setStreamFps(i.value);break;case ye:i.message&&-1!==i.message.indexOf(Oe)&&this.player.emitError(ct.wasmDecodeError,"");break;case we:this.player.emitError(ct.wasmDecodeVideoNoResponseError);break;case ke:this.player.emitError(ct.simdH264DecodeVideoWidthIsTooLarge);break;case Ee:this.player.emitError(ct.wasmWidthOrHeightChange);break;case Te:this.player.emitError(ct.simdDecodeError);break;case _e:e.log("decoderWorker","onmessage:",_e);break;case Ce:e.log("decoderWorker","onmessage:",Ce),this._destroy();break;case xe:this.player&&this.player.pushTempStream(i.buffer);break;case Re:this.player&&this.player.emit(nt.videoSEI,{ts:i.ts,data:new Uint8Array(i.buffer)});break;case De:if(this.player){if(this.player.isRecordTypeFlv()){const e=new Uint8Array(i.buffer);this.player.recorder.addMetaData(e)}const e=al(new Uint8Array(i.buffer));e&&e.onMetaData&&this.player.updateMetaData(e.onMetaData)}break;case Le:if(this.player&&this.player.isRecordTypeFlv()){const e=new Uint8Array(i.buffer);this.player.recorder.addAACSequenceHeader(e,i.ts)}break;case Pe:if(this.player&&this.player.isRecordTypeFlv()){const e=new Uint8Array(i.buffer);this.player.recorder.addVideoSequenceHeader(e,i.ts)}break;case Be:if(this.player&&this.player.isRecordTypeFlv()&&this.player.recording){const e=new Uint8Array(i.buffer);i.type===je?this.player.recorder.addVideo(e,i.ts):i.type===Ne&&this.player.recorder.addAudio(e,i.ts)}break;case Me:this.player&&(this.player.debug.log("decoderWorker","onmessage:",Me),this.player.video.$videoElement.srcObject=i.mseHandle);break;case Ue:this.player&&(this.player.debug.log("decoderWorker","onmessage:",Ue,i.value),this.player._mseWorkerData.firstRenderTime=Number(i.value));break;case Fe:this.player&&(this.player.debug.log("decoderWorker","onmessage:",Fe,i.value,i.msg),this.player.emitError(i.value,i.msg));break;default:this.player[i.cmd]&&this.player[i.cmd](i)}}}_initWork(){const e={debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid,useOffscreen:this.player._opt.useOffscreen,useWCS:this.player._opt.useWCS,useMSE:this.player._opt.useMSE,videoBuffer:this.player._opt.videoBuffer,videoBufferDelay:this.player._opt.videoBufferDelay,openWebglAlignment:this.player._opt.openWebglAlignment,playType:this.player._opt.playType,hasAudio:this.player._opt.hasAudio,hasVideo:this.player._opt.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:this.player._opt.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:this.player.audio&&this.player.audio.audioContext&&this.player.audio.audioContext.sampleRate||0,audioBufferSize:this.player.audio&&this.player.audio.getAudioBufferSize()||1024,networkDelay:this.player._opt.networkDelay,visibility:this.player.visibility,useSIMD:this.player._opt.useSIMD,recordType:this.player._opt.recordType,checkFirstIFrame:this.player._opt.checkFirstIFrame,isM7sCrypto:this.player._opt.isM7sCrypto,isXorCrypto:this.player._opt.isXorCrypto,isSm4Crypto:this.player._opt.isSm4Crypto,sm4CryptoKey:this.player._opt.sm4CryptoKey,m7sCryptoAudio:this.player._opt.m7sCryptoAudio,isFlv:this.player._opt.isFlv,isFmp4:this.player._opt.isFmp4,isMpeg4:this.player._opt.isMpeg4,isTs:this.player._opt.isTs,isNakedFlow:this.player._opt.isNakedFlow,isHls265:this.player.isUseHls265(),isFmp4Private:this.player._opt.isFmp4Private,isEmitSEI:this.player._opt.isEmitSEI,isRecordTypeFlv:this.player.isRecordTypeFlv(),isWasmMp4:this.player.recorder&&this.player.recorder.isWasmMp4()||!1,isChrome:Ja(),isDropSameTimestampGop:this.player._opt.isDropSameTimestampGop,mseDecodeAudio:this.player._opt.mseDecodeAudio,nakedFlowH265DemuxUseNew:this.player._opt.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:this.player._opt.mseDecoderUseWorker,mseAutoCleanupMinBackwardDuration:this.player._opt.mseAutoCleanupMinBackwardDuration,mseAutoCleanupMaxBackwardDuration:this.player._opt.mseAutoCleanupMaxBackwardDuration,mseCorrectTimeDuration:this.player._opt.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:this.player._opt.mseCorrectAudioTimeDuration};this.decoderWorker.postMessage({cmd:Ve,opt:JSON.stringify(e)}),this.player._opt.isM7sCrypto&&(this.updateWorkConfig({key:"cryptoKey",value:this.player._opt.cryptoKey}),this.updateWorkConfig({key:"cryptoIV",value:this.player._opt.cryptoIV}))}decodeVideo(e,t,i){this.player._opt.playType===b?this.player.isUseHls265()?this._decodeVideoNoDelay(e,t,i):this._decodeVideo(e,t,i):this.player._opt.playType===_&&(this.player.video.rate>=this.player._opt.playbackForwardMaxRateDecodeIFrame?i&&(this.player.debug.log("decoderWorker",`current rate is ${this.player.video.rate},only decode i frame`),this._decodeVideoNoDelay(e,t,i)):1===this.player.video.rate?this._decodeVideo(e,t,i):this._decodeVideoNoDelay(e,t,i))}_decodeVideo(e,t,i){const s={type:je,ts:Math.max(t,0),isIFrame:i};this.decoderWorker.postMessage({cmd:$e,buffer:e,options:s},[e.buffer])}_decodeVideoNoDelay(e,t,i){this.decoderWorker.postMessage({cmd:Je,buffer:e,ts:Math.max(t,0),isIFrame:i},[e.buffer])}decodeAudio(e,t){this.player._opt.playType===b?this.player._opt.useWCS||this.player._opt.useMSE||this.player.isUseHls265()?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t):this.player._opt.playType===_&&(1===this.player.video.rate?this._decodeAudio(e,t):this._decodeAudioNoDelay(e,t))}_decodeAudio(e,t){const i={type:Ne,ts:Math.max(t,0)};this.decoderWorker.postMessage({cmd:$e,buffer:e,options:i},[e.buffer])}_decodeAudioNoDelay(e,t){this.decoderWorker.postMessage({cmd:We,buffer:e,ts:Math.max(t,0)},[e.buffer])}updateWorkConfig(e){this.decoderWorker&&this.decoderWorker.postMessage({cmd:Ke,key:e.key,value:e.value})}workerFetchStream(e){const{_opt:t}=this.player,i={protocol:t.protocol,isFlv:t.isFlv,isFmp4:t.isFmp4,isMpeg4:t.isMpeg4,isNakedFlow:t.isNakedFlow,isTs:t.isTs};this.decoderWorker.postMessage({cmd:Qe,url:e,opt:JSON.stringify(i)})}clearWorkBuffer(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.decoderWorker.postMessage({cmd:Ye,needClear:e})}workerSendMessage(e){this.decoderWorker.postMessage({cmd:Xe,message:e})}updateVideoTimestamp(e){this.decoderWorker.postMessage({cmd:Ze,message:e})}}var nl,ll="application/json, text/javascript",dl="text/html",hl=/^(?:text|application)\/xml/i,cl=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,ul=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,pl=/^\s*$/,fl={},ml={},gl="",yl={type:"GET",beforeSend:Al,success:Al,error:Al,complete:Al,context:null,xhr:function(){return new window.XMLHttpRequest},accepts:{json:ll,xml:"application/xml, text/xml",html:dl,text:"text/plain","*":"*/".concat("*")},crossDomain:!1,timeout:0,username:null,password:null,processData:!0,promise:Al,contentType:"application/x-www-form-urlencoded; charset=UTF-8"};function Al(){}var bl=function(e,t){"object"==typeof e&&(t=e,e=void 0);var i=Cl({},t=t||{});for(var s in yl)void 0===i[s]&&(i[s]=yl[s]);try{var r={},a=new Promise((function(e,t){r.resolve=e,r.reject=t}));a.resolve=r.resolve,a.reject=r.reject,i.promise=a}catch(e){i.promise={resolve:Al,reject:Al}}var o=ul.exec(window.location.href.toLowerCase())||[];i.url=((e||i.url||window.location.href)+"").replace(/#.*$/,"").replace(/^\/\//,o[1]+"//");var n=i.url;i.crossDomain||(i.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(i.url)&&RegExp.$2!==window.location.href);var l=i.dataType;if("jsonp"===l){if(!/=\?/.test(i.url)){var d=(i.jsonp||"callback")+"=?";i.url=El(i.url,d)}return function(e){var t,i=e.jsonpCallback||"jsonp"+Dl(),s=window.document.createElement("script"),r={abort:function(){i in window&&(window[i]=Al)}},a=window.document.getElementsByTagName("head")[0]||window.document.documentElement;function o(i){window.clearTimeout(t),r.abort(),Sl(i.type,r,i.type,e),n()}s.onerror=function(e){o(e)},window[i]=function(i){window.clearTimeout(t),vl(i,r,e),n()},Tl(e),s.src=e.url.replace(/=\?/,"="+i),s.src=El(s.src,"_="+(new Date).getTime()),s.async=!0,e.scriptCharset&&(s.charset=e.scriptCharset);a.insertBefore(s,a.firstChild),e.timeout>0&&(t=window.setTimeout((function(){r.abort(),Sl("timeout",r,"timeout",e),n()}),e.timeout));function n(){s.clearAttributes?s.clearAttributes():s.onload=s.onreadystatechange=s.onerror=null,s.parentNode&&s.parentNode.removeChild(s),s=null,delete window[i]}return e.promise.abort=function(){r.abort()},e.promise.xhr=r,e.promise}(i)}Tl(i);var h=i.accepts[l]||i.accepts["*"],c={};/^([\w-]+:)\/\//.test(i.url)?RegExp.$1:window.location.protocol;var u,p=yl.xhr();i.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest"),i.ifModified&&(fl[n]&&(c["If-Modified-Since"]=fl[n]),ml[n]&&(c["If-None-Match"]=ml[n])),h&&(c.Accept=h,h.indexOf(",")>-1&&(h=h.split(",",2)[0]),p.overrideMimeType&&p.overrideMimeType(h));var f=!/^(?:GET|HEAD)$/.test(i.type.toUpperCase());if((i.data&&f&&!1!==i.contentType||t.contentType)&&(c["Content-Type"]=i.contentType),!1===i.cache&&!f){var m=/([?&])_=[^&]*/;i.url=m.test(n)?n.replace(m,"$1_="+Dl()):n+(/\?/.test(n)?"&":"?")+"_="+Dl()}i.headers=Cl(c,i.headers||{}),p.onreadystatechange=function(){if(4===p.readyState){var e;clearTimeout(u);var t=!1;if(p.status>=200&&p.status<300||304===p.status){if(gl=p.getAllResponseHeaders(),i.ifModified){var s=wl("Last-Modified");s&&(fl[n]=s),(s=wl("etag"))&&(ml[n]=s)}l=l||function(e){return e&&(e===dl?"html":e===ll?"json":hl.test(e)&&"xml")||"text"}(p.getResponseHeader("content-type")),e=p.responseText;try{"xml"===l?e=p.responseXML:"json"===l&&(e=pl.test(e)?null:JSON.parse(e))}catch(e){t=e}t?Sl(t,"parseerror",p,i):vl(e,p,i)}else Sl(null,"error",p,i)}};var g=!("async"in i)||i.async;if(p.open(i.type,i.url,g,i.username,i.password),i.xhrFields)for(var y in i.xhrFields)p[y]=i.xhrFields[y];for(var y in i.mimeType&&p.overrideMimeType&&p.overrideMimeType(i.mimeType),i.headers)void 0!==i.headers[y]&&p.setRequestHeader(y,i.headers[y]+"");return!1===function(e,t){var i=t.context;if(!1===t.beforeSend.call(i,e,t))return!1}(p,i)?(p.abort(),!1):(i.timeout>0&&(u=window.setTimeout((function(){p.onreadystatechange=Al,p.abort(),Sl(null,"timeout",p,i)}),i.timeout)),p.send(i.data?i.data:null),i.promise.abort=function(){p.abort()},i.promise)};function vl(e,t,i){var s=i.context,r="success";i.success.call(s,e,r,t),i.promise.resolve(e,r,t),_l(r,t,i)}function _l(e,t,i){var s=i.context;i.complete.call(s,t,e)}function Sl(e,t,i,s){var r=s.context;s.error.call(r,i,t,e),s.promise.reject(i,t,e),_l(t,i,s)}function wl(e){var t;if(!nl){for(nl={};t=cl.exec(gl);)nl[t[1].toLowerCase()]=t[2];t=nl[e.toLowerCase()]}return null===t?null:t}function El(e,t){return(e+"&"+t).replace(/[&?]{1,2}/,"?")}function Tl(e){!xl(e)||e.data instanceof FormData||!e.processData||(e.data=function(e,t){var i=[];return i.add=function(e,t){this.push(encodeURIComponent(e)+"="+encodeURIComponent(t))},kl(i,e,t),i.join("&").replace("%20","+")}(e.data)),!e.data||e.type&&"GET"!==e.type.toUpperCase()||(e.url=El(e.url,e.data))}function kl(e,t,i,s){var r=function(e){return"[object Array]"===Object.prototype.toString.call(e)}(t);for(var a in t){var o=t[a];s&&(a=i?s:s+"["+(r?"":a)+"]"),!s&&r?e.add(o.name,o.value):(i?r(o):xl(o))?kl(e,o,i,a):e.add(a,o)}}function Cl(e){for(var t=Array.prototype.slice,i=t.call(arguments,1),s=0,r=i.length;s255)return!1;return!0}function Bl(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!Pl(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(Ll(e.length)&&Pl(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function Il(e){return new Uint8Array(e)}function Ml(e,t,i,s,r){null==s&&null==r||(e=e.slice?e.slice(s,r):Array.prototype.slice.call(e,s,r)),t.set(e,i)}bl.get=function(e,t,i,s){return Rl(t)&&(s=s||i,i=t,t=void 0),bl({url:e,data:t,success:i,dataType:s})},bl.post=function(e,t,i,s){return Rl(t)&&(s=s||i,i=t,t=void 0),bl({type:"POST",url:e,data:t,success:i,dataType:s})},bl.getJSON=function(e,t,i){return Rl(t)&&(i=t,t=void 0),bl({url:e,data:t,success:i,dataType:"json"})},bl.ajaxSetup=function(e,t){return t?Cl(Cl(e,yl),t):Cl(yl,e)};var Ul={toBytes:function(e){var t=[],i=0;for(e=encodeURI(e);i191&&s<224?(t.push(String.fromCharCode((31&s)<<6|63&e[i+1])),i+=2):(t.push(String.fromCharCode((15&s)<<12|(63&e[i+1])<<6|63&e[i+2])),i+=3)}return t.join("")}},Fl=function(){var e="0123456789abcdef";return{toBytes:function(e){for(var t=[],i=0;i>4]+e[15&r])}return i.join("")}}}(),Ol={16:10,24:12,32:14},Nl=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],jl=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],zl=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],Gl=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],Hl=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],Vl=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],$l=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],Wl=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Jl=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],ql=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Kl=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Yl=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ql=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Xl=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Zl=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function ed(e){for(var t=[],i=0;i>2,this._Ke[i][t%4]=a[t],this._Kd[e-i][t%4]=a[t];for(var o,n=0,l=r;l>16&255]<<24^jl[o>>8&255]<<16^jl[255&o]<<8^jl[o>>24&255]^Nl[n]<<24,n+=1,8!=r)for(t=1;t>8&255]<<8^jl[o>>16&255]<<16^jl[o>>24&255]<<24;for(t=r/2+1;t>2,h=l%4,this._Ke[d][h]=a[t],this._Kd[e-d][h]=a[t++],l++}for(var d=1;d>24&255]^Ql[o>>16&255]^Xl[o>>8&255]^Zl[255&o]},td.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,i=[0,0,0,0],s=ed(e),r=0;r<4;r++)s[r]^=this._Ke[0][r];for(var a=1;a>24&255]^Hl[s[(r+1)%4]>>16&255]^Vl[s[(r+2)%4]>>8&255]^$l[255&s[(r+3)%4]]^this._Ke[a][r];s=i.slice()}var o,n=Il(16);for(r=0;r<4;r++)o=this._Ke[t][r],n[4*r]=255&(jl[s[r]>>24&255]^o>>24),n[4*r+1]=255&(jl[s[(r+1)%4]>>16&255]^o>>16),n[4*r+2]=255&(jl[s[(r+2)%4]>>8&255]^o>>8),n[4*r+3]=255&(jl[255&s[(r+3)%4]]^o);return n},td.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,i=[0,0,0,0],s=ed(e),r=0;r<4;r++)s[r]^=this._Kd[0][r];for(var a=1;a>24&255]^Jl[s[(r+3)%4]>>16&255]^ql[s[(r+2)%4]>>8&255]^Kl[255&s[(r+1)%4]]^this._Kd[a][r];s=i.slice()}var o,n=Il(16);for(r=0;r<4;r++)o=this._Kd[t][r],n[4*r]=255&(zl[s[r]>>24&255]^o>>24),n[4*r+1]=255&(zl[s[(r+3)%4]>>16&255]^o>>16),n[4*r+2]=255&(zl[s[(r+2)%4]>>8&255]^o>>8),n[4*r+3]=255&(zl[255&s[(r+1)%4]]^o);return n};var id=function(e){if(!(this instanceof id))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new td(e)};id.prototype.encrypt=function(e){if((e=Bl(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=Il(e.length),i=Il(16),s=0;sNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},od.prototype.setBytes=function(e){if(16!=(e=Bl(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},od.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var nd=function(e,t){if(!(this instanceof nd))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof od||(t=new od(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new td(e)};nd.prototype.encrypt=function(e){for(var t=Bl(e,!0),i=0;i16)throw new Error("PKCS#7 padding byte out of range");for(var i=e.length-t,s=0;s>>2]>>>24-a%4*8&255;t[s+a>>>2]|=o<<24-(s+a)%4*8}else for(var n=0;n>>2]=i[n>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=l.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i>>2]>>>24-r%4*8&255;s.push((a>>>4).toString(16)),s.push((15&a).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new d.init(i,t/2)}},u=h.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],r=0;r>>2]>>>24-r%4*8&255;s.push(String.fromCharCode(a))}return s.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s>>2]|=(255&e.charCodeAt(s))<<24-s%4*8;return new d.init(i,t)}},p=h.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},f=n.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i,s=this._data,r=s.words,a=s.sigBytes,o=this.blockSize,n=a/(4*o),l=(n=t?e.ceil(n):e.max((0|n)-this._minBufferSize,0))*o,h=e.min(4*l,a);if(l){for(var c=0;c>>2]|=e[r]<<24-r%4*8;t.call(this,s,i)}else t.apply(this,arguments)};s.prototype=e}}(),i.lib.WordArray)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.WordArray,s=e.enc;function r(e){return e<<8&4278255360|e>>>8&16711935}s.Utf16=s.Utf16BE={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],r=0;r>>2]>>>16-r%4*8&65535;s.push(String.fromCharCode(a))}return s.join("")},parse:function(e){for(var i=e.length,s=[],r=0;r>>1]|=e.charCodeAt(r)<<16-r%2*16;return t.create(s,2*i)}},s.Utf16LE={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],a=0;a>>2]>>>16-a%4*8&65535);s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var i=e.length,s=[],a=0;a>>1]|=r(e.charCodeAt(a)<<16-a%2*16);return t.create(s,2*i)}}}(),i.enc.Utf16)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.WordArray;function s(e,i,s){for(var r=[],a=0,o=0;o>>6-o%4*2;r[a>>>2]|=n<<24-a%4*8,a++}return t.create(r,a)}e.enc.Base64={stringify:function(e){var t=e.words,i=e.sigBytes,s=this._map;e.clamp();for(var r=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,n=0;n<4&&a+.75*n>>6*(3-n)&63));var l=s.charAt(64);if(l)for(;r.length%4;)r.push(l);return r.join("")},parse:function(e){var t=e.length,i=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var a=0;a>>6-o%4*2;r[a>>>2]|=n<<24-a%4*8,a++}return t.create(r,a)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var i=e.words,s=e.sigBytes,r=t?this._safe_map:this._map;e.clamp();for(var a=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(i[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|i[o+2>>>2]>>>24-(o+2)%4*8&255,l=0;l<4&&o+.75*l>>6*(3-l)&63));var d=r.charAt(64);if(d)for(;a.length%4;)a.push(d);return a.join("")},parse:function(e,t){void 0===t&&(t=!0);var i=e.length,r=t?this._safe_map:this._map,a=this._reverseMap;if(!a){a=this._reverseMap=[];for(var o=0;o>>24)|4278255360&(r<<24|r>>>8)}var a=this._hash.words,o=e[t+0],l=e[t+1],p=e[t+2],f=e[t+3],m=e[t+4],g=e[t+5],y=e[t+6],A=e[t+7],b=e[t+8],v=e[t+9],_=e[t+10],S=e[t+11],w=e[t+12],E=e[t+13],T=e[t+14],k=e[t+15],C=a[0],x=a[1],R=a[2],D=a[3];C=d(C,x,R,D,o,7,n[0]),D=d(D,C,x,R,l,12,n[1]),R=d(R,D,C,x,p,17,n[2]),x=d(x,R,D,C,f,22,n[3]),C=d(C,x,R,D,m,7,n[4]),D=d(D,C,x,R,g,12,n[5]),R=d(R,D,C,x,y,17,n[6]),x=d(x,R,D,C,A,22,n[7]),C=d(C,x,R,D,b,7,n[8]),D=d(D,C,x,R,v,12,n[9]),R=d(R,D,C,x,_,17,n[10]),x=d(x,R,D,C,S,22,n[11]),C=d(C,x,R,D,w,7,n[12]),D=d(D,C,x,R,E,12,n[13]),R=d(R,D,C,x,T,17,n[14]),C=h(C,x=d(x,R,D,C,k,22,n[15]),R,D,l,5,n[16]),D=h(D,C,x,R,y,9,n[17]),R=h(R,D,C,x,S,14,n[18]),x=h(x,R,D,C,o,20,n[19]),C=h(C,x,R,D,g,5,n[20]),D=h(D,C,x,R,_,9,n[21]),R=h(R,D,C,x,k,14,n[22]),x=h(x,R,D,C,m,20,n[23]),C=h(C,x,R,D,v,5,n[24]),D=h(D,C,x,R,T,9,n[25]),R=h(R,D,C,x,f,14,n[26]),x=h(x,R,D,C,b,20,n[27]),C=h(C,x,R,D,E,5,n[28]),D=h(D,C,x,R,p,9,n[29]),R=h(R,D,C,x,A,14,n[30]),C=c(C,x=h(x,R,D,C,w,20,n[31]),R,D,g,4,n[32]),D=c(D,C,x,R,b,11,n[33]),R=c(R,D,C,x,S,16,n[34]),x=c(x,R,D,C,T,23,n[35]),C=c(C,x,R,D,l,4,n[36]),D=c(D,C,x,R,m,11,n[37]),R=c(R,D,C,x,A,16,n[38]),x=c(x,R,D,C,_,23,n[39]),C=c(C,x,R,D,E,4,n[40]),D=c(D,C,x,R,o,11,n[41]),R=c(R,D,C,x,f,16,n[42]),x=c(x,R,D,C,y,23,n[43]),C=c(C,x,R,D,v,4,n[44]),D=c(D,C,x,R,w,11,n[45]),R=c(R,D,C,x,k,16,n[46]),C=u(C,x=c(x,R,D,C,p,23,n[47]),R,D,o,6,n[48]),D=u(D,C,x,R,A,10,n[49]),R=u(R,D,C,x,T,15,n[50]),x=u(x,R,D,C,g,21,n[51]),C=u(C,x,R,D,w,6,n[52]),D=u(D,C,x,R,f,10,n[53]),R=u(R,D,C,x,_,15,n[54]),x=u(x,R,D,C,l,21,n[55]),C=u(C,x,R,D,b,6,n[56]),D=u(D,C,x,R,k,10,n[57]),R=u(R,D,C,x,y,15,n[58]),x=u(x,R,D,C,E,21,n[59]),C=u(C,x,R,D,m,6,n[60]),D=u(D,C,x,R,S,10,n[61]),R=u(R,D,C,x,p,15,n[62]),x=u(x,R,D,C,v,21,n[63]),a[0]=a[0]+C|0,a[1]=a[1]+x|0,a[2]=a[2]+R|0,a[3]=a[3]+D|0},_doFinalize:function(){var t=this._data,i=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;i[r>>>5]|=128<<24-r%32;var a=e.floor(s/4294967296),o=s;i[15+(r+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),i[14+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(i.length+1),this._process();for(var n=this._hash,l=n.words,d=0;d<4;d++){var h=l[d];l[d]=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8)}return n},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function d(e,t,i,s,r,a,o){var n=e+(t&i|~t&s)+r+o;return(n<>>32-a)+t}function h(e,t,i,s,r,a,o){var n=e+(t&s|i&~s)+r+o;return(n<>>32-a)+t}function c(e,t,i,s,r,a,o){var n=e+(t^i^s)+r+o;return(n<>>32-a)+t}function u(e,t,i,s,r,a,o){var n=e+(i^(t|~s))+r+o;return(n<>>32-a)+t}t.MD5=a._createHelper(l),t.HmacMD5=a._createHmacHelper(l)}(Math),i.MD5)})),Ir((function(e,t){var i,s,r,a,o,n,l,d;e.exports=(s=(i=d=dd).lib,r=s.WordArray,a=s.Hasher,o=i.algo,n=[],l=o.SHA1=a.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],a=i[2],o=i[3],l=i[4],d=0;d<80;d++){if(d<16)n[d]=0|e[t+d];else{var h=n[d-3]^n[d-8]^n[d-14]^n[d-16];n[d]=h<<1|h>>>31}var c=(s<<5|s>>>27)+l+n[d];c+=d<20?1518500249+(r&a|~r&o):d<40?1859775393+(r^a^o):d<60?(r&a|r&o|a&o)-1894007588:(r^a^o)-899497514,l=o,o=a,a=r<<30|r>>>2,r=s,s=c}i[0]=i[0]+s|0,i[1]=i[1]+r|0,i[2]=i[2]+a|0,i[3]=i[3]+o|0,i[4]=i[4]+l|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;return t[s>>>5]|=128<<24-s%32,t[14+(s+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(s+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}}),i.SHA1=a._createHelper(l),i.HmacSHA1=a._createHmacHelper(l),d.SHA1)})),Ir((function(e,t){var i;e.exports=(i=dd,function(e){var t=i,s=t.lib,r=s.WordArray,a=s.Hasher,o=t.algo,n=[],l=[];!function(){function t(t){for(var i=e.sqrt(t),s=2;s<=i;s++)if(!(t%s))return!1;return!0}function i(e){return 4294967296*(e-(0|e))|0}for(var s=2,r=0;r<64;)t(s)&&(r<8&&(n[r]=i(e.pow(s,.5))),l[r]=i(e.pow(s,1/3)),r++),s++}();var d=[],h=o.SHA256=a.extend({_doReset:function(){this._hash=new r.init(n.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],a=i[2],o=i[3],n=i[4],h=i[5],c=i[6],u=i[7],p=0;p<64;p++){if(p<16)d[p]=0|e[t+p];else{var f=d[p-15],m=(f<<25|f>>>7)^(f<<14|f>>>18)^f>>>3,g=d[p-2],y=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;d[p]=m+d[p-7]+y+d[p-16]}var A=s&r^s&a^r&a,b=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),v=u+((n<<26|n>>>6)^(n<<21|n>>>11)^(n<<7|n>>>25))+(n&h^~n&c)+l[p]+d[p];u=c,c=h,h=n,n=o+v|0,o=a,a=r,r=s,s=v+(b+A)|0}i[0]=i[0]+s|0,i[1]=i[1]+r|0,i[2]=i[2]+a|0,i[3]=i[3]+o|0,i[4]=i[4]+n|0,i[5]=i[5]+h|0,i[6]=i[6]+c|0,i[7]=i[7]+u|0},_doFinalize:function(){var t=this._data,i=t.words,s=8*this._nDataBytes,r=8*t.sigBytes;return i[r>>>5]|=128<<24-r%32,i[14+(r+64>>>9<<4)]=e.floor(s/4294967296),i[15+(r+64>>>9<<4)]=s,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=a._createHelper(h),t.HmacSHA256=a._createHmacHelper(h)}(Math),i.SHA256)})),Ir((function(e,t){var i,s,r,a,o,n;e.exports=(s=(i=n=dd).lib.WordArray,r=i.algo,a=r.SHA256,o=r.SHA224=a.extend({_doReset:function(){this._hash=new s.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=4,e}}),i.SHA224=a._createHelper(o),i.HmacSHA224=a._createHmacHelper(o),n.SHA224)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.Hasher,s=e.x64,r=s.Word,a=s.WordArray,o=e.algo;function n(){return r.create.apply(r,arguments)}var l=[n(1116352408,3609767458),n(1899447441,602891725),n(3049323471,3964484399),n(3921009573,2173295548),n(961987163,4081628472),n(1508970993,3053834265),n(2453635748,2937671579),n(2870763221,3664609560),n(3624381080,2734883394),n(310598401,1164996542),n(607225278,1323610764),n(1426881987,3590304994),n(1925078388,4068182383),n(2162078206,991336113),n(2614888103,633803317),n(3248222580,3479774868),n(3835390401,2666613458),n(4022224774,944711139),n(264347078,2341262773),n(604807628,2007800933),n(770255983,1495990901),n(1249150122,1856431235),n(1555081692,3175218132),n(1996064986,2198950837),n(2554220882,3999719339),n(2821834349,766784016),n(2952996808,2566594879),n(3210313671,3203337956),n(3336571891,1034457026),n(3584528711,2466948901),n(113926993,3758326383),n(338241895,168717936),n(666307205,1188179964),n(773529912,1546045734),n(1294757372,1522805485),n(1396182291,2643833823),n(1695183700,2343527390),n(1986661051,1014477480),n(2177026350,1206759142),n(2456956037,344077627),n(2730485921,1290863460),n(2820302411,3158454273),n(3259730800,3505952657),n(3345764771,106217008),n(3516065817,3606008344),n(3600352804,1432725776),n(4094571909,1467031594),n(275423344,851169720),n(430227734,3100823752),n(506948616,1363258195),n(659060556,3750685593),n(883997877,3785050280),n(958139571,3318307427),n(1322822218,3812723403),n(1537002063,2003034995),n(1747873779,3602036899),n(1955562222,1575990012),n(2024104815,1125592928),n(2227730452,2716904306),n(2361852424,442776044),n(2428436474,593698344),n(2756734187,3733110249),n(3204031479,2999351573),n(3329325298,3815920427),n(3391569614,3928383900),n(3515267271,566280711),n(3940187606,3454069534),n(4118630271,4000239992),n(116418474,1914138554),n(174292421,2731055270),n(289380356,3203993006),n(460393269,320620315),n(685471733,587496836),n(852142971,1086792851),n(1017036298,365543100),n(1126000580,2618297676),n(1288033470,3409855158),n(1501505948,4234509866),n(1607167915,987167468),n(1816402316,1246189591)],d=[];!function(){for(var e=0;e<80;e++)d[e]=n()}();var h=o.SHA512=t.extend({_doReset:function(){this._hash=new a.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],r=i[1],a=i[2],o=i[3],n=i[4],h=i[5],c=i[6],u=i[7],p=s.high,f=s.low,m=r.high,g=r.low,y=a.high,A=a.low,b=o.high,v=o.low,_=n.high,S=n.low,w=h.high,E=h.low,T=c.high,k=c.low,C=u.high,x=u.low,R=p,D=f,L=m,P=g,B=y,I=A,M=b,U=v,F=_,O=S,N=w,j=E,z=T,G=k,H=C,V=x,$=0;$<80;$++){var W,J,q=d[$];if($<16)J=q.high=0|e[t+2*$],W=q.low=0|e[t+2*$+1];else{var K=d[$-15],Y=K.high,Q=K.low,X=(Y>>>1|Q<<31)^(Y>>>8|Q<<24)^Y>>>7,Z=(Q>>>1|Y<<31)^(Q>>>8|Y<<24)^(Q>>>7|Y<<25),ee=d[$-2],te=ee.high,ie=ee.low,se=(te>>>19|ie<<13)^(te<<3|ie>>>29)^te>>>6,re=(ie>>>19|te<<13)^(ie<<3|te>>>29)^(ie>>>6|te<<26),ae=d[$-7],oe=ae.high,ne=ae.low,le=d[$-16],de=le.high,he=le.low;J=(J=(J=X+oe+((W=Z+ne)>>>0>>0?1:0))+se+((W+=re)>>>0>>0?1:0))+de+((W+=he)>>>0>>0?1:0),q.high=J,q.low=W}var ce,ue=F&N^~F&z,pe=O&j^~O&G,fe=R&L^R&B^L&B,me=D&P^D&I^P&I,ge=(R>>>28|D<<4)^(R<<30|D>>>2)^(R<<25|D>>>7),ye=(D>>>28|R<<4)^(D<<30|R>>>2)^(D<<25|R>>>7),Ae=(F>>>14|O<<18)^(F>>>18|O<<14)^(F<<23|O>>>9),be=(O>>>14|F<<18)^(O>>>18|F<<14)^(O<<23|F>>>9),ve=l[$],_e=ve.high,Se=ve.low,we=H+Ae+((ce=V+be)>>>0>>0?1:0),Ee=ye+me;H=z,V=G,z=N,G=j,N=F,j=O,F=M+(we=(we=(we=we+ue+((ce+=pe)>>>0>>0?1:0))+_e+((ce+=Se)>>>0>>0?1:0))+J+((ce+=W)>>>0>>0?1:0))+((O=U+ce|0)>>>0>>0?1:0)|0,M=B,U=I,B=L,I=P,L=R,P=D,R=we+(ge+fe+(Ee>>>0>>0?1:0))+((D=ce+Ee|0)>>>0>>0?1:0)|0}f=s.low=f+D,s.high=p+R+(f>>>0>>0?1:0),g=r.low=g+P,r.high=m+L+(g>>>0

>>0?1:0),A=a.low=A+I,a.high=y+B+(A>>>0>>0?1:0),v=o.low=v+U,o.high=b+M+(v>>>0>>0?1:0),S=n.low=S+O,n.high=_+F+(S>>>0>>0?1:0),E=h.low=E+j,h.high=w+N+(E>>>0>>0?1:0),k=c.low=k+G,c.high=T+z+(k>>>0>>0?1:0),x=u.low=x+V,u.high=C+H+(x>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;return t[s>>>5]|=128<<24-s%32,t[30+(s+128>>>10<<5)]=Math.floor(i/4294967296),t[31+(s+128>>>10<<5)]=i,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(h),e.HmacSHA512=t._createHmacHelper(h)}(),i.SHA512)})),Ir((function(e,t){var i,s,r,a,o,n,l,d;e.exports=(s=(i=d=dd).x64,r=s.Word,a=s.WordArray,o=i.algo,n=o.SHA512,l=o.SHA384=n.extend({_doReset:function(){this._hash=new a.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=16,e}}),i.SHA384=n._createHelper(l),i.HmacSHA384=n._createHmacHelper(l),d.SHA384)})),Ir((function(e,t){var i;e.exports=(i=dd,function(e){var t=i,s=t.lib,r=s.WordArray,a=s.Hasher,o=t.x64.Word,n=t.algo,l=[],d=[],h=[];!function(){for(var e=1,t=0,i=0;i<24;i++){l[e+5*t]=(i+1)*(i+2)/2%64;var s=(2*e+3*t)%5;e=t%5,t=s}for(e=0;e<5;e++)for(t=0;t<5;t++)d[e+5*t]=t+(2*e+3*t)%5*5;for(var r=1,a=0;a<24;a++){for(var n=0,c=0,u=0;u<7;u++){if(1&r){var p=(1<>>24)|4278255360&(a<<24|a>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(x=i[r]).high^=o,x.low^=a}for(var n=0;n<24;n++){for(var u=0;u<5;u++){for(var p=0,f=0,m=0;m<5;m++)p^=(x=i[u+5*m]).high,f^=x.low;var g=c[u];g.high=p,g.low=f}for(u=0;u<5;u++){var y=c[(u+4)%5],A=c[(u+1)%5],b=A.high,v=A.low;for(p=y.high^(b<<1|v>>>31),f=y.low^(v<<1|b>>>31),m=0;m<5;m++)(x=i[u+5*m]).high^=p,x.low^=f}for(var _=1;_<25;_++){var S=(x=i[_]).high,w=x.low,E=l[_];E<32?(p=S<>>32-E,f=w<>>32-E):(p=w<>>64-E,f=S<>>64-E);var T=c[d[_]];T.high=p,T.low=f}var k=c[0],C=i[0];for(k.high=C.high,k.low=C.low,u=0;u<5;u++)for(m=0;m<5;m++){var x=i[_=u+5*m],R=c[_],D=c[(u+1)%5+5*m],L=c[(u+2)%5+5*m];x.high=R.high^~D.high&L.high,x.low=R.low^~D.low&L.low}x=i[0];var P=h[n];x.high^=P.high,x.low^=P.low}},_doFinalize:function(){var t=this._data,i=t.words;this._nDataBytes;var s=8*t.sigBytes,a=32*this.blockSize;i[s>>>5]|=1<<24-s%32,i[(e.ceil((s+1)/a)*a>>>5)-1]|=128,t.sigBytes=4*i.length,this._process();for(var o=this._state,n=this.cfg.outputLength/8,l=n/8,d=[],h=0;h>>24)|4278255360&(u<<24|u>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),d.push(p),d.push(u)}return new r.init(d,n)},clone:function(){for(var e=a.clone.call(this),t=e._state=this._state.slice(0),i=0;i<25;i++)t[i]=t[i].clone();return e}});t.SHA3=a._createHelper(u),t.HmacSHA3=a._createHmacHelper(u)}(Math),i.SHA3)})),Ir((function(e,t){var i;e.exports=(i=dd,function(e){var t=i,s=t.lib,r=s.WordArray,a=s.Hasher,o=t.algo,n=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),l=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),d=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),h=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),c=r.create([0,1518500249,1859775393,2400959708,2840853838]),u=r.create([1352829926,1548603684,1836072691,2053994217,0]),p=o.RIPEMD160=a.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=0;i<16;i++){var s=t+i,r=e[s];e[s]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var a,o,p,v,_,S,w,E,T,k,C,x=this._hash.words,R=c.words,D=u.words,L=n.words,P=l.words,B=d.words,I=h.words;for(S=a=x[0],w=o=x[1],E=p=x[2],T=v=x[3],k=_=x[4],i=0;i<80;i+=1)C=a+e[t+L[i]]|0,C+=i<16?f(o,p,v)+R[0]:i<32?m(o,p,v)+R[1]:i<48?g(o,p,v)+R[2]:i<64?y(o,p,v)+R[3]:A(o,p,v)+R[4],C=(C=b(C|=0,B[i]))+_|0,a=_,_=v,v=b(p,10),p=o,o=C,C=S+e[t+P[i]]|0,C+=i<16?A(w,E,T)+D[0]:i<32?y(w,E,T)+D[1]:i<48?g(w,E,T)+D[2]:i<64?m(w,E,T)+D[3]:f(w,E,T)+D[4],C=(C=b(C|=0,I[i]))+k|0,S=k,k=T,T=b(E,10),E=w,w=C;C=x[1]+p+T|0,x[1]=x[2]+v+k|0,x[2]=x[3]+_+S|0,x[3]=x[4]+a+w|0,x[4]=x[0]+o+E|0,x[0]=C},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;t[s>>>5]|=128<<24-s%32,t[14+(s+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(t.length+1),this._process();for(var r=this._hash,a=r.words,o=0;o<5;o++){var n=a[o];a[o]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}return r},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}});function f(e,t,i){return e^t^i}function m(e,t,i){return e&t|~e&i}function g(e,t,i){return(e|~t)^i}function y(e,t,i){return e&i|t&~i}function A(e,t,i){return e^(t|~i)}function b(e,t){return e<>>32-t}t.RIPEMD160=a._createHelper(p),t.HmacRIPEMD160=a._createHmacHelper(p)}(),i.RIPEMD160)})),Ir((function(e,t){var i,s,r;e.exports=(s=(i=dd).lib.Base,r=i.enc.Utf8,void(i.algo.HMAC=s.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var i=e.blockSize,s=4*i;t.sigBytes>s&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),o=this._iKey=t.clone(),n=a.words,l=o.words,d=0;d>>2];e.sigBytes-=t}};s.BlockCipher=h.extend({cfg:h.cfg.extend({mode:p,padding:f}),reset:function(){var e;h.reset.call(this);var t=this.cfg,i=t.iv,s=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=s.createEncryptor:(e=s.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,i&&i.words):(this._mode=e.call(s,this,i&&i.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=s.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,i=e.salt;return(i?a.create([1398893684,1701076831]).concat(i).concat(t):t).toString(l)},parse:function(e){var t,i=l.parse(e),s=i.words;return 1398893684==s[0]&&1701076831==s[1]&&(t=a.create(s.slice(2,4)),s.splice(0,4),i.sigBytes-=16),m.create({ciphertext:i,salt:t})}},y=s.SerializableCipher=r.extend({cfg:r.extend({format:g}),encrypt:function(e,t,i,s){s=this.cfg.extend(s);var r=e.createEncryptor(i,s),a=r.finalize(t),o=r.cfg;return m.create({ciphertext:a,key:i,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:s.format})},decrypt:function(e,t,i,s){return s=this.cfg.extend(s),t=this._parse(t,s.format),e.createDecryptor(i,s).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),A=(t.kdf={}).OpenSSL={execute:function(e,t,i,s,r){if(s||(s=a.random(8)),r)o=d.create({keySize:t+i,hasher:r}).compute(e,s);else var o=d.create({keySize:t+i}).compute(e,s);var n=a.create(o.words.slice(t),4*i);return o.sigBytes=4*t,m.create({key:o,iv:n,salt:s})}},b=s.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:A}),encrypt:function(e,t,i,s){var r=(s=this.cfg.extend(s)).kdf.execute(i,e.keySize,e.ivSize,s.salt,s.hasher);s.iv=r.iv;var a=y.encrypt.call(this,e,t,r.key,s);return a.mixIn(r),a},decrypt:function(e,t,i,s){s=this.cfg.extend(s),t=this._parse(t,s.format);var r=s.kdf.execute(i,e.keySize,e.ivSize,t.salt,s.hasher);return s.iv=r.iv,y.decrypt.call(this,e,t,r.key,s)}})}())})),Ir((function(e,t){var i;e.exports=((i=dd).mode.CFB=function(){var e=i.lib.BlockCipherMode.extend();function t(e,t,i,s){var r,a=this._iv;a?(r=a.slice(0),this._iv=void 0):r=this._prevBlock,s.encryptBlock(r,0);for(var o=0;o>24&255)){var t=e>>16&255,i=e>>8&255,s=255&e;255===t?(t=0,255===i?(i=0,255===s?s=0:++s):++i):++t,e=0,e+=t<<16,e+=i<<8,e+=s}else e+=1<<24;return e}function s(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var r=e.Encryptor=e.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize,a=this._iv,o=this._counter;a&&(o=this._counter=a.slice(0),this._iv=void 0),s(o);var n=o.slice(0);i.encryptBlock(n,0);for(var l=0;l>>2]|=r<<24-a%4*8,e.sigBytes+=r},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Ansix923)})),Ir((function(e,t){var i;e.exports=((i=dd).pad.Iso10126={pad:function(e,t){var s=4*t,r=s-e.sigBytes%s;e.concat(i.lib.WordArray.random(r-1)).concat(i.lib.WordArray.create([r<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Iso10126)})),Ir((function(e,t){var i;e.exports=((i=dd).pad.Iso97971={pad:function(e,t){e.concat(i.lib.WordArray.create([2147483648],1)),i.pad.ZeroPadding.pad(e,t)},unpad:function(e){i.pad.ZeroPadding.unpad(e),e.sigBytes--}},i.pad.Iso97971)})),Ir((function(e,t){var i;e.exports=((i=dd).pad.ZeroPadding={pad:function(e,t){var i=4*t;e.clamp(),e.sigBytes+=i-(e.sigBytes%i||i)},unpad:function(e){var t=e.words,i=e.sigBytes-1;for(i=e.sigBytes-1;i>=0;i--)if(t[i>>>2]>>>24-i%4*8&255){e.sigBytes=i+1;break}}},i.pad.ZeroPadding)})),Ir((function(e,t){var i;e.exports=((i=dd).pad.NoPadding={pad:function(){},unpad:function(){}},i.pad.NoPadding)})),Ir((function(e,t){var i;e.exports=(i=dd,function(e){var t=i,s=t.lib.CipherParams,r=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(r)},parse:function(e){var t=r.parse(e);return s.create({ciphertext:t})}}}(),i.format.Hex)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.BlockCipher,s=e.algo,r=[],a=[],o=[],n=[],l=[],d=[],h=[],c=[],u=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var i=0,s=0;for(t=0;t<256;t++){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,r[i]=f,a[f]=i;var m=e[i],g=e[m],y=e[g],A=257*e[f]^16843008*f;o[i]=A<<24|A>>>8,n[i]=A<<16|A>>>16,l[i]=A<<8|A>>>24,d[i]=A,A=16843009*y^65537*g^257*m^16843008*i,h[f]=A<<24|A>>>8,c[f]=A<<16|A>>>16,u[f]=A<<8|A>>>24,p[f]=A,i?(i=m^e[e[e[y^m]]],s^=e[e[s]]):i=s=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],m=s.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,i=e.sigBytes/4,s=4*((this._nRounds=i+6)+1),a=this._keySchedule=[],o=0;o6&&o%i==4&&(d=r[d>>>24]<<24|r[d>>>16&255]<<16|r[d>>>8&255]<<8|r[255&d]):(d=r[(d=d<<8|d>>>24)>>>24]<<24|r[d>>>16&255]<<16|r[d>>>8&255]<<8|r[255&d],d^=f[o/i|0]<<24),a[o]=a[o-i]^d);for(var n=this._invKeySchedule=[],l=0;l>>24]]^c[r[d>>>16&255]]^u[r[d>>>8&255]]^p[r[255&d]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,n,l,d,r)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,h,c,u,p,a),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,s,r,a,o,n){for(var l=this._nRounds,d=e[t]^i[0],h=e[t+1]^i[1],c=e[t+2]^i[2],u=e[t+3]^i[3],p=4,f=1;f>>24]^r[h>>>16&255]^a[c>>>8&255]^o[255&u]^i[p++],g=s[h>>>24]^r[c>>>16&255]^a[u>>>8&255]^o[255&d]^i[p++],y=s[c>>>24]^r[u>>>16&255]^a[d>>>8&255]^o[255&h]^i[p++],A=s[u>>>24]^r[d>>>16&255]^a[h>>>8&255]^o[255&c]^i[p++];d=m,h=g,c=y,u=A}m=(n[d>>>24]<<24|n[h>>>16&255]<<16|n[c>>>8&255]<<8|n[255&u])^i[p++],g=(n[h>>>24]<<24|n[c>>>16&255]<<16|n[u>>>8&255]<<8|n[255&d])^i[p++],y=(n[c>>>24]<<24|n[u>>>16&255]<<16|n[d>>>8&255]<<8|n[255&h])^i[p++],A=(n[u>>>24]<<24|n[d>>>16&255]<<16|n[h>>>8&255]<<8|n[255&c])^i[p++],e[t]=m,e[t+1]=g,e[t+2]=y,e[t+3]=A},keySize:8});e.AES=t._createHelper(m)}(),i.AES)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib,s=t.WordArray,r=t.BlockCipher,a=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],n=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],d=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],c=a.DES=r.extend({_doReset:function(){for(var e=this._key.words,t=[],i=0;i<56;i++){var s=o[i]-1;t[i]=e[s>>>5]>>>31-s%32&1}for(var r=this._subKeys=[],a=0;a<16;a++){var d=r[a]=[],h=l[a];for(i=0;i<24;i++)d[i/6|0]|=t[(n[i]-1+h)%28]<<31-i%6,d[4+(i/6|0)]|=t[28+(n[i+24]-1+h)%28]<<31-i%6;for(d[0]=d[0]<<1|d[0]>>>31,i=1;i<7;i++)d[i]=d[i]>>>4*(i-1)+3;d[7]=d[7]<<5|d[7]>>>27}var c=this._invSubKeys=[];for(i=0;i<16;i++)c[i]=r[15-i]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,i){this._lBlock=e[t],this._rBlock=e[t+1],u.call(this,4,252645135),u.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),u.call(this,1,1431655765);for(var s=0;s<16;s++){for(var r=i[s],a=this._lBlock,o=this._rBlock,n=0,l=0;l<8;l++)n|=d[l][((o^r[l])&h[l])>>>0];this._lBlock=o,this._rBlock=a^n}var c=this._lBlock;this._lBlock=this._rBlock,this._rBlock=c,u.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),u.call(this,16,65535),u.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function u(e,t){var i=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=i,this._lBlock^=i<>>e^this._lBlock)&t;this._lBlock^=i,this._rBlock^=i<192.");var t=e.slice(0,2),i=e.length<4?e.slice(0,2):e.slice(2,4),r=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=c.createEncryptor(s.create(t)),this._des2=c.createEncryptor(s.create(i)),this._des3=c.createEncryptor(s.create(r))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=r._createHelper(f)}(),i.TripleDES)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=s.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,i=e.sigBytes,s=this._S=[],r=0;r<256;r++)s[r]=r;r=0;for(var a=0;r<256;r++){var o=r%i,n=t[o>>>2]>>>24-o%4*8&255;a=(a+s[r]+n)%256;var l=s[r];s[r]=s[a],s[a]=l}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=a.call(this)},keySize:8,ivSize:0});function a(){for(var e=this._S,t=this._i,i=this._j,s=0,r=0;r<4;r++){i=(i+e[t=(t+1)%256])%256;var a=e[t];e[t]=e[i],e[i]=a,s|=e[(e[t]+e[i])%256]<<24-8*r}return this._i=t,this._j=i,s}e.RC4=t._createHelper(r);var o=s.RC4Drop=r.extend({cfg:r.cfg.extend({drop:192}),_doReset:function(){r._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)a.call(this)}});e.RC4Drop=t._createHelper(o)}(),i.RC4)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=[],a=[],o=[],n=s.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,i=0;i<4;i++)e[i]=16711935&(e[i]<<8|e[i]>>>24)|4278255360&(e[i]<<24|e[i]>>>8);var s=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,i=0;i<4;i++)l.call(this);for(i=0;i<8;i++)r[i]^=s[i+4&7];if(t){var a=t.words,o=a[0],n=a[1],d=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),h=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=d>>>16|4294901760&h,u=h<<16|65535&d;for(r[0]^=d,r[1]^=c,r[2]^=h,r[3]^=u,r[4]^=d,r[5]^=c,r[6]^=h,r[7]^=u,i=0;i<4;i++)l.call(this)}},_doProcessBlock:function(e,t){var i=this._X;l.call(this),r[0]=i[0]^i[5]>>>16^i[3]<<16,r[1]=i[2]^i[7]>>>16^i[5]<<16,r[2]=i[4]^i[1]>>>16^i[7]<<16,r[3]=i[6]^i[3]>>>16^i[1]<<16;for(var s=0;s<4;s++)r[s]=16711935&(r[s]<<8|r[s]>>>24)|4278255360&(r[s]<<24|r[s]>>>8),e[t+s]^=r[s]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,i=0;i<8;i++)a[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var s=e[i]+t[i],r=65535&s,n=s>>>16,l=((r*r>>>17)+r*n>>>15)+n*n,d=((4294901760&s)*s|0)+((65535&s)*s|0);o[i]=l^d}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=t._createHelper(n)}(),i.Rabbit)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.StreamCipher,s=e.algo,r=[],a=[],o=[],n=s.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],s=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var r=0;r<4;r++)l.call(this);for(r=0;r<8;r++)s[r]^=i[r+4&7];if(t){var a=t.words,o=a[0],n=a[1],d=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),h=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),c=d>>>16|4294901760&h,u=h<<16|65535&d;for(s[0]^=d,s[1]^=c,s[2]^=h,s[3]^=u,s[4]^=d,s[5]^=c,s[6]^=h,s[7]^=u,r=0;r<4;r++)l.call(this)}},_doProcessBlock:function(e,t){var i=this._X;l.call(this),r[0]=i[0]^i[5]>>>16^i[3]<<16,r[1]=i[2]^i[7]>>>16^i[5]<<16,r[2]=i[4]^i[1]>>>16^i[7]<<16,r[3]=i[6]^i[3]>>>16^i[1]<<16;for(var s=0;s<4;s++)r[s]=16711935&(r[s]<<8|r[s]>>>24)|4278255360&(r[s]<<24|r[s]>>>8),e[t+s]^=r[s]},blockSize:4,ivSize:2});function l(){for(var e=this._X,t=this._C,i=0;i<8;i++)a[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,i=0;i<8;i++){var s=e[i]+t[i],r=65535&s,n=s>>>16,l=((r*r>>>17)+r*n>>>15)+n*n,d=((4294901760&s)*s|0)+((65535&s)*s|0);o[i]=l^d}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=t._createHelper(n)}(),i.RabbitLegacy)})),Ir((function(e,t){var i;e.exports=(i=dd,function(){var e=i,t=e.lib.BlockCipher,s=e.algo;const r=16,a=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],o=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var n={pbox:[],sbox:[]};function l(e,t){let i=t>>24&255,s=t>>16&255,r=t>>8&255,a=255&t,o=e.sbox[0][i]+e.sbox[1][s];return o^=e.sbox[2][r],o+=e.sbox[3][a],o}function d(e,t,i){let s,a=t,o=i;for(let t=0;t1;--t)a^=e.pbox[t],o=l(e,a)^o,s=a,a=o,o=s;return s=a,a=o,o=s,o^=e.pbox[1],a^=e.pbox[0],{left:a,right:o}}function c(e,t,i){for(let t=0;t<4;t++){e.sbox[t]=[];for(let i=0;i<256;i++)e.sbox[t][i]=o[t][i]}let s=0;for(let o=0;o=i&&(s=0);let n=0,l=0,h=0;for(let t=0;t>>2]|=e[i]<<24-i%4*8;return hd.lib.WordArray.create(t,e.length)}const pd=16,fd=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],md=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function gd(e){const t=[];for(let i=0,s=e.length;i1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Ad(e){const t=[];for(let i=0,s=e.length;i>>6),t.push(128|63&s);else if(s<=55295||s>=57344&&s<=65535)t.push(224|s>>>12),t.push(128|s>>>6&63),t.push(128|63&s);else{if(!(s>=65536&&s<=1114111))throw t.push(s),new Error("input is not supported");i++,t.push(240|s>>>18&28),t.push(128|s>>>12&63),t.push(128|s>>>6&63),t.push(128|63&s)}}return t}function bd(e){const t=[];for(let i=0,s=e.length;i=240&&e[i]<=247?(t.push(String.fromCodePoint(((7&e[i])<<18)+((63&e[i+1])<<12)+((63&e[i+2])<<6)+(63&e[i+3]))),i+=3):e[i]>=224&&e[i]<=239?(t.push(String.fromCodePoint(((15&e[i])<<12)+((63&e[i+1])<<6)+(63&e[i+2]))),i+=2):e[i]>=192&&e[i]<=223?(t.push(String.fromCodePoint(((31&e[i])<<6)+(63&e[i+1]))),i++):t.push(String.fromCodePoint(e[i]));return t.join("")}function vd(e,t){const i=31&t;return e<>>32-i}function _d(e){return(255&fd[e>>>24&255])<<24|(255&fd[e>>>16&255])<<16|(255&fd[e>>>8&255])<<8|255&fd[255&e]}function Sd(e){return e^vd(e,2)^vd(e,10)^vd(e,18)^vd(e,24)}function wd(e){return e^vd(e,13)^vd(e,23)}function Ed(e,t,i){const s=new Array(4),r=new Array(4);for(let t=0;t<4;t++)r[0]=255&e[4*t],r[1]=255&e[4*t+1],r[2]=255&e[4*t+2],r[3]=255&e[4*t+3],s[t]=r[0]<<24|r[1]<<16|r[2]<<8|r[3];for(let e,t=0;t<32;t+=4)e=s[1]^s[2]^s[3]^i[t+0],s[0]^=Sd(_d(e)),e=s[2]^s[3]^s[0]^i[t+1],s[1]^=Sd(_d(e)),e=s[3]^s[0]^s[1]^i[t+2],s[2]^=Sd(_d(e)),e=s[0]^s[1]^s[2]^i[t+3],s[3]^=Sd(_d(e));for(let e=0;e<16;e+=4)t[e]=s[3-e/4]>>>24&255,t[e+1]=s[3-e/4]>>>16&255,t[e+2]=s[3-e/4]>>>8&255,t[e+3]=255&s[3-e/4]}function Td(e,t,i){const s=new Array(4),r=new Array(4);for(let t=0;t<4;t++)r[0]=255&e[0+4*t],r[1]=255&e[1+4*t],r[2]=255&e[2+4*t],r[3]=255&e[3+4*t],s[t]=r[0]<<24|r[1]<<16|r[2]<<8|r[3];s[0]^=2746333894,s[1]^=1453994832,s[2]^=1736282519,s[3]^=2993693404;for(let e,i=0;i<32;i+=4)e=s[1]^s[2]^s[3]^md[i+0],t[i+0]=s[0]^=wd(_d(e)),e=s[2]^s[3]^s[0]^md[i+1],t[i+1]=s[1]^=wd(_d(e)),e=s[3]^s[0]^s[1]^md[i+2],t[i+2]=s[2]^=wd(_d(e)),e=s[0]^s[1]^s[2]^md[i+3],t[i+3]=s[3]^=wd(_d(e));if(0===i)for(let e,i=0;i<16;i++)e=t[i],t[i]=t[31-i],t[31-i]=e}function kd(e,t,i){let{padding:s="pkcs#7",mode:r,iv:a=[],output:o="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===r&&("string"==typeof a&&(a=gd(a)),16!==a.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=gd(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==i?Ad(e):gd(e):[...e],("pkcs#5"===s||"pkcs#7"===s)&&0!==i){const t=pd-e.length%pd;for(let i=0;i=pd;){const t=e.slice(c,c+16),s=new Array(16);if("cbc"===r)for(let e=0;ee)return this.preDelayTimestamp-e>1e3&&this.player.debug.warn("CommonDemux",`getDelay() and preDelayTimestamp is ${this.preDelayTimestamp} > timestamp is ${e} more than ${this.preDelayTimestamp-e}ms and return ${this.delay}`),this.preDelayTimestamp=e,this.delay;if(this.firstTimestamp){if(e){const t=Date.now()-this.startTimestamp,i=e-this.firstTimestamp;t>=i?(this.isStreamTsMoreThanLocal=!1,this.delay=t-i):(this.isStreamTsMoreThanLocal=!0,this.delay=i-t)}}else this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1;return this.preDelayTimestamp=e,this.delay}getDelayNotUpdateDelay(e,t){if(!e||!this.player.isDemuxDecodeFirstIIframeInit())return-1;if(t===Ne)return this.pushLatestDelay;if(this.preDelayTimestamp&&this.preDelayTimestamp-e>1e3)return this.player.debug.warn("CommonDemux",`getDelayNotUpdateDelay() and preDelayTimestamp is ${this.preDelayTimestamp} > timestamp is ${e} more than ${this.preDelayTimestamp-e}ms and return -1`),-1;if(this.firstTimestamp){let t=-1;if(e){const i=Date.now()-this.startTimestamp,s=e-this.firstTimestamp;t=i>=s?i-s:s-i}return t}return-1}resetDelay(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}resetAllDelay(){this.resetDelay(),this.preDelayTimestamp=null}initInterval(){this.player.isUseHls265()?this.player.debug.log("CommonDemux","initInterval() and is hls and support hls265 so return"):-1===this.player.getStreamType().indexOf(y)?this.player.isPlaybackCacheBeforeDecodeForFpsRender()?this.player.debug.log("CommonDemux","initInterval() and playback and playbackIsCacheBeforeDecodeForFpsRender is true so return"):(this.player.debug.log("CommonDemux","setInterval()"),this._loop(),this.stopId=setInterval((()=>{let e=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=e);const t=e-this.preLoopTimestamp;this.updateHistoryIntervalDiffTimeList(t),t>100&&this.player.debug.warn("CommonDemux",`loop demux diff time is ${t}`),this._loop(),this.preLoopTimestamp=(new Date).getTime()}),20)):this.player.debug.log("CommonDemux","initInterval() and is worker stream so return")}clearStopInterval(){this.stopId&&(clearInterval(this.stopId),this.stopId=null)}updateHistoryIntervalDiffTimeList(e){this.historyIntervalDiffTimeList.length>5&&this.historyIntervalDiffTimeList.shift(),this.historyIntervalDiffTimeList.push(e)}isHistoryIntervalDiffTimeAllLarge(){if(this.historyIntervalDiffTimeList.length<5)return!1;for(let e=0;e{let e=null;this.bufferList.length&&(e=this.bufferList.shift(),this._doDecoderDecode(e))};e();const t=Math.ceil(1e3/(this.playbackStreamFps*this.player.getPlaybackRate()));this.player.debug.log("CommonDemux",`initPlaybackCacheLoop() and fragDuration is ${t}, playbackStreamFps is ${this.playbackStreamFps}, playbackRate is ${this.player.getPlaybackRate()}`),this.stopId=setInterval(e,t)}_loop(){let e;const t=this.player._opt.videoBuffer,i=this.player._opt.videoBufferDelay,s=this.player._opt.playType===b;if(this.bufferList.length){if(this.isPushDropping)return void this.player.debug.warn("CommonDemux",`_loop isPushDropping is true and bufferList length is ${this.bufferList.length}`);if(this.dropping){for(e=this.bufferList.shift(),this.player.debug.warn("CommonDemux",`_loop is dropping and data.ts is ${e.ts}, data.type is ${e.type}, data.isIFrame is ${e.isIFrame}, delay is ${this.delay} ,buffer list is ${this.bufferList.length}`);!e.isIFrame&&this.bufferList.length;)e=this.bufferList.shift();const t=this.getDelayNotUpdateDelay(e.ts,e.type);e.isIFrame&&t<=this.getNotDroppingDelayTs()&&(this.player.debug.log("CommonDemux",`_loop data isIFrame is true and delay is ${this.delay}`),this.dropping=!1,this._doDecoderDecode(e),this._decodeNext(e))}else if(this.player.isPlayback()||this.player.isPlayUseMSE()||0===t)for(;this.bufferList.length;)e=this.bufferList.shift(),this._doDecoderDecode(e);else if(e=this.bufferList[0],-1===this.getDelay(e.ts,e.type))this.player.debug.log("CommonDemux",`delay is -1 and data.ts is ${e.ts} data.type is ${e.type}`),this.bufferList.shift(),this._doDecoderDecode(e),this._decodeNext(e);else if(this.delay>i+t&&s)this.hasIframeInBufferList()?(this.player.debug.warn("CommonDemux",`_loop delay is ${this.delay}, set dropping is true`),this.resetAllDelay(),this.dropping=!0,this.player.updateStats({isDropping:!0})):(this.bufferList.shift(),this._doDecoderDecode(e),this._decodeNext(e));else for(;this.bufferList.length;){if(e=this.bufferList[0],!(this.getDelay(e.ts,e.type)>t)){this.delay<0&&this.player.debug.warn("CommonDemux",`_loop delay is ${this.delay} bufferList is ${this.bufferList}`);break}this.bufferList.shift(),this._doDecoderDecode(e)}}else-1!==this.delay&&this.player.debug.log("CommonDemux","loop() bufferList is empty and reset delay"),this.resetAllDelay()}_doDecode(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;const a=this.player;let o={ts:i,cts:r,type:t,isIFrame:!1};this.player.isPlayer()?(t===je&&a._opt.playType===b&&this.calcNetworkDelay(i),a._opt.useWCS&&!a._opt.useOffscreen||a._opt.useMSE?(t===je&&(o.isIFrame=s),this.pushBuffer(e,o)):t===je?a.decoderWorker&&a.decoderWorker.decodeVideo(e,i,s):t===Ne&&a._opt.hasAudio&&a.decoderWorker&&a.decoderWorker.decodeAudio(e,i)):this.player.isPlayback()&&(t===je&&(o.isIFrame=s),this.player.isPlaybackOnlyDecodeIFrame()?t===je&&s&&this.pushBuffer(e,o):this.player.isPlaybackCacheBeforeDecodeForFpsRender()||1===this.player.getPlaybackRate()?this.pushBuffer(e,o):this.pushBuffer(e,o,!1))}_doDecodeByHls(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=!1;if(t===Ne&&zr(e)&&(this.player.debug.log("CommonDemux",`hls pushBuffer audio ts is ${i}, isAacCodecPacket is true`),a=!0,this.player.isRecordTypeFlv())){const t=new Uint8Array(e);this.player.recorder.addAACSequenceHeader(t,i)}let o=!1;if(t===je&&s&&co(e)&&(this.player.debug.log("CommonDemux",`hls pushBuffer video ts is ${i}, isVideoSequenceHeader is true`),o=!0,this.player.isRecordTypeFlv())){const t=new Uint8Array(e);this.player.recorder.addVideoSequenceHeader(t,i)}this.player.recording&&po(o)&&po(a)&&this.handleRecording(e,t,i,s,r),t===je?this._doDecoderDecode({ts:i,cts:r,payload:e,type:je,isIFrame:s}):t===Ne&&this._doDecoderDecode({ts:i,payload:e,type:Ne})}_doDecodeByFmp4(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_doDecodeByTs(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_doDecodeByPs(e,t,i,s){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;this._doDecode(e,t,i,s,r)}_decodeNext(e){const t=e.ts;if(0===this.bufferList.length)return;let i=this.bufferList[0];const s=i.ts-t,r=e.type===je&&i.type===Ne,a=e.type===je&&co(e.payload);(s<=20||r||a)&&(this.player.debug.log("CommonDemux",`decode data type is ${e.type} and\n ts is ${t} next data type is ${i.type} ts is ${i.ts}\n diff is ${s} and isVideoAndNextAudio is ${r} and isVideoSqeHeader is ${a}`),this.bufferList.shift(),this._doDecoderDecode(i))}_doDecoderDecode(e){const t=this.player,{webcodecsDecoder:i,mseDecoder:s}=t;this.player.isPlayer()&&this.player.updateStats({buf:this.delay}),e.type===Ne?t._opt.hasAudio&&(t._opt.useMSE&&t._opt.mseDecodeAudio?s.decodeAudio(e.payload,e.ts):t.decoderWorker&&t.decoderWorker.decodeAudio(e.payload,e.ts)):e.type===je&&(t._opt.isEmitSEI&&this.findSei(e.payload,e.ts),t._opt.useWCS&&!t._opt.useOffscreen?i.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t._opt.useMSE?s.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):t.decoderWorker&&t.decoderWorker.decodeVideo(e.payload,e.ts,e.isIFrame))}pushBuffer(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=this.player._opt.videoBuffer,r=this.player._opt.videoBufferDelay,a=this.player.isPlayer();if(t.type===Ne&&zr(e)){if(this.player.debug.log("CommonDemux",`pushBuffer() audio ts is ${t.ts}, isAacCodecPacket is true`),this.player.isRecordTypeFlv()){const i=new Uint8Array(e);this.player.recorder.addAACSequenceHeader(i,t.ts)}this._doDecoderDecode({ts:t.ts,payload:e,type:Ne})}else if(t.type===je&&t.isIFrame&&co(e)){if(this.player.debug.log("CommonDemux",`pushBuffer() video ts is ${t.ts}, isVideoSequenceHeader is true`),this.player.isRecordTypeFlv()){const i=new Uint8Array(e);this.player.recorder.addVideoSequenceHeader(i,t.ts)}this._doDecoderDecode({ts:t.ts,payload:e,type:je,isIFrame:t.isIFrame,cts:t.cts})}else{if(this.player.recording&&this.handleRecording(e,t.type,t.ts,t.isIFrame,t.cts),a){if(this.preTimestampDuration>0&&this.preTimestamp>0&&t.type===je){const e=t.ts-this.preTimestamp,i=this.preTimestampDuration+this.preTimestampDuration/2;e>=i&&this.player.debug.log("CommonDemux",`pushBuffer() video\n ts is ${t.ts}, preTimestamp is ${this.preTimestamp},\n diff is ${e} and preTimestampDuration is ${this.preTimestampDuration} and maxDiff is ${i}\n maybe trigger black screen or flower screen`)}if(this.preTimestamp>0&&t.tsX&&(this.player.debug.warn("CommonDemux",`pushBuffer() video\n ts is ${t.ts}, preTimestamp is ${this.preTimestamp},\n diff is ${this.preTimestamp-t.ts} more than 3600000\n and resetAllDelay()`),this.resetAllDelay()),t.ts<=this.preTimestamp&&this.preTimestamp>0&&t.type===je&&(this.player.debug.warn("CommonDemux",`pushBuffer() video and isIFrame is ${t.isIFrame} and\n ts is ${t.ts} less than (or equal) preTimestamp is ${this.preTimestamp} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${this.prevPayloadBufferSize}`),this.player._opt.isDropSameTimestampGop&&po(t.isIFrame)&&this.player.isDemuxDecodeFirstIIframeInit())){const e=this.hasIframeInBufferList(),t=po(this.isPushDropping);return this.player.debug.log("CommonDemux",`pushBuffer(), isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next drop buffer`),void(e&&t?this.dropBuffer$2():this.clearBuffer(!0))}if(this.player.isDemuxDecodeFirstIIframeInit()){let e=this.getDelayNotUpdateDelay(t.ts,t.type);this.pushLatestDelay=e;const i=r+s;this.player._opt.useMSE?e>i&&this.delay0&&this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debug.warn("CommonDemux",`useMSE, pushLatestDelay is ${e} > ${r+s}, bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()):e>i&&this.delay0&&this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debug.warn("CommonDemux",`useWCS, pushLatestDelay is ${e} > ${r+s},bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()),this.isHistoryIntervalDiffTimeAllLarge()&&po(this.player.visibility)&&(this.player._opt.useMSE?this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debug.warn("CommonDemux",`useMSE, page visibility is false and\n history interval diff is ${this.historyIntervalDiffTimeList.join(",")} and\n bufferList is ${this.bufferList.length},\n delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()):this.hasIframeInBufferList()&&!1===this.isPushDropping&&(this.player.debug.warn("CommonDemux",`useWCS, page visibility is false and\n history interval diff is ${this.historyIntervalDiffTimeList.join(",")} and\n bufferList is ${this.bufferList.length},\n delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()))}t.type===je&&(this.preTimestamp>0&&(this.preTimestampDuration=t.ts-this.preTimestamp),this.prevPayloadBufferSize=e.byteLength,this.preTimestamp=t.ts)}if(i?t.type===Ne?this.bufferList.push({ts:t.ts,payload:e,type:Ne}):t.type===je&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:je,isIFrame:t.isIFrame}):t.type===je?this._doDecoderDecode({ts:t.ts,cts:t.cts,payload:e,type:je,isIFrame:t.isIFrame}):t.type===Ne&&this._doDecoderDecode({ts:t.ts,payload:e,type:Ne}),this.player.isPlaybackCacheBeforeDecodeForFpsRender()&&(La(this.playbackStreamVideoFps)||La(this.playbackStreamAudioFps))){let e=this.playbackStreamVideoFps,t=this.playbackStreamAudioFps;if(La(this.playbackStreamVideoFps)&&(e=ro(this.bufferList,je),e>0&&(this.playbackStreamVideoFps=e,this.player.video&&this.player.video.setStreamFps(this.playbackStreamVideoFps),this.playbackStreamFps=t?e+t:e,po(this.player._opt.hasAudio)&&(this.player.debug.log(this.TAG_NAME,"playbackCacheBeforeDecodeForFpsRender,_opt.hasAudio is false and set streamAudioFps is 0"),this.playbackStreamAudioFps=0),this.initPlaybackCacheLoop())),La(this.playbackStreamAudioFps)&&(t=ro(this.bufferList,Ne),t>0&&(this.playbackStreamAudioFps=t,this.playbackStreamFps=e?e+t:t,this.initPlaybackCacheLoop())),La(this.playbackStreamVideoFps)&&La(this.playbackStreamAudioFps)){const i=this.bufferList.map((e=>({type:e.type,ts:e.ts})));this.player.debug.log("CommonDemux",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${this.bufferList.length} and ts list is ${JSON.stringify(i)}`)}const i=this.getAudioBufferLength()>0,s=i?60:40;this.bufferList.length>=s&&(this.debug.warn("CommonDemux",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${this.bufferList.length} more than ${s}, and hasAudio is ${i} an set streamFps is 25`),this.playbackStreamVideoFps=e,this.player.video&&this.player.video.setStreamFps(this.playbackStreamVideoFps),i?(this.playbackStreamAudioFps=25,this.playbackStreamFps=this.playbackStreamVideoFps+this.playbackStreamAudioFps):this.playbackStreamFps=this.playbackStreamVideoFps,this.initPlaybackCacheLoop())}}}dropBuffer$2(){if(this.bufferList.length>0){let e=this.bufferList.findIndex((e=>uo(e.isIFrame)&&e.type===je));if(this.isAllIframeInBufferList())for(let t=0;t=this.getNotDroppingDelayTs()){this.player.debug.log("CommonDemux",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${s} and notDroppingDelayTs is ${this.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){this.isPushDropping=!0,this.player.updateStats({isDropping:!0});const t=this.bufferList.length;this.bufferList=this.bufferList.slice(e);const i=this.bufferList.shift();this.resetAllDelay(),this.getDelay(i.ts,i.type),this._doDecoderDecode(i),this.isPushDropping=!1,this.player.debug.log("CommonDemux",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,and new bufferList length is ${this.bufferList.length} and new delay is ${this.delay} `)}else this.isPushDropping=!1}0===this.bufferList.length&&(this.isPushDropping=!1)}clearBuffer(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.player.debug.log("CommonDemux",`clearBuffer,buffer length is ${this.bufferList.length}, need clear is ${e} and _opt.checkFirstIFrame is ${this.player._opt.checkFirstIFrame}`),e&&(this.bufferList=[]),this.player.isPlayer()&&(this.resetAllDelay(),uo(this.player._opt.checkFirstIFrame)&&(this.dropping=!0,this.player.updateStats({isDropping:!0}))),this.player.decoderCheckFirstIFrame()}calcNetworkDelay(e){if(!(this.player.isDemuxDecodeFirstIIframeInit()&&e>0))return;null===this.bufferStartDts?(this.bufferStartDts=e,this.bufferStartLocalTs=aa()):et?i-t:0;s>this.player._opt.networkDelay&&this.player._opt.playType===b&&(this.player.debug.warn("CommonDemux",`delay is more than networkDelay and now dts:${e},start dts is ${this.bufferStartDts}, vs start is ${t},local diff is ${i} ,delay is ${s}, _opt.networkDelay is ${this.player._opt.networkDelay}`),this.player.emit(nt.networkDelayTimeout,s)),this.player.updateStats({netBuf:s})}calcIframeIntervalTimestamp(e){if(null===this.preIframeTs)this.preIframeTs=e;else if(this.preIframeTs{t.type===je&&(e+=1)})),e}getAudioBufferLength(){let e=0;return this.bufferList.forEach((t=>{t.type===Ne&&(e+=1)})),e}hasIframeInBufferList(){return this.bufferList.some((e=>e.type===je&&e.isIFrame))}isAllIframeInBufferList(){const e=this.getVideoBufferLength();let t=0;return this.bufferList.forEach((e=>{e.type===je&&e.isIFrame&&(t+=1)})),e===t}getInputByteLength(){return 0}getIsStreamTsMoreThanLocal(){return this.isStreamTsMoreThanLocal}close(){}reset(){}findSei(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=4;Ba(this.nalUnitSize)&&(s=this.nalUnitSize);const r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return;const i=e.length,s=[];let r,a=0;for(;a+t>>=8),a+=t,r){if(a+r>i)break;s.push(e.subarray(a,a+r)),a+=r}return s}(e.slice(5),s);if(po(i)){const e=this.player.getVideoInfo();e&&e.encType&&(i=e.encType===wt)}r.forEach((e=>{const s=i?e[0]>>>1&63:31&e[0];(i&&(s===qt||s===Jt)||po(i)&&s===Bt)&&this.player.emit(nt.videoSEI,{ts:t,data:e})}))}handleRecording(e,t,i,s,r){if(this.player.isRecordTypeFlv()){const s=new Uint8Array(e);t===je?this.player.recorder.addVideo(s,i):t===Ne&&this.player.recorder.addAudio(s,i)}else if(this.player.isRecordTypeMp4()){const a=new Uint8Array(e);if(this.player.recorder.isWasmMp4()){if(t===je)this.player.recorder.handleAddNaluTrack(a.slice(5),s,i,r);else if(t===Ne){const t=new Uint8Array(e);this.player.recorder.handleAddAudioTrack(Gr(t)?t.slice(2):t.slice(1),i)}}else t===je&&this.player.recorder.handleAddNaluTrack(a.slice(5),s,i,r)}}updateNalUnitSize(e){const t=15&e[0];this.player.video.updateVideoInfo({encTypeCode:t});const i=t===_t;this.nalUnitSize=function(e,t){let i=null;return t?e.length>=28&&(i=1+(3&e[26])):e.length>=12&&(i=1+(3&e[9])),i}(e,i),this.player.debug.log(this.TAG_NAME,`demux() isVideoSequenceHeader is true and isHevc is ${i} and nalUnitSize is ${this.nalUnitSize}`)}cryptoPayload(e,t){let i=e,s=this.player;if(s._opt.isM7sCrypto)if(s._opt.cryptoKey&&s._opt.cryptoKey.byteLength>0&&s._opt.cryptoIV&&s._opt.cryptoIV.byteLength>0){const t=this.player.video.getVideoInfo();t.encTypeCode?i=function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),i=new Uint8Array(i);const r=e.byteLength;let a=5;for(;ar)break;let n=e[a+4],l=!1;if(s?(n=n>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(n)):(n&=31,l=1===n||5===n),l){const s=e.slice(a+4+2,a+4+o);let r=new ld.ModeOfOperation.ctr(t,new ld.Counter(i));const n=r.decrypt(s);r=null,e.set(n,a+4+2)}a=a+4+o}return e}(e,s._opt.cryptoKey,s._opt.cryptoIV,t.encTypeCode===_t):s.debug.warn(this.TAG_NAME,`videoInfo.encTypeCode is ${t.encTypeCode}`)}else s.debug.error(this.TAG_NAME,`isM7sCrypto cryptoKey.length is ${s._opt.cryptoKey&&s._opt.cryptoKey.byteLength} or cryptoIV.length is ${s._opt.cryptoIV&&s._opt.cryptoIV.byteLength} null`);else if(s._opt.isSm4Crypto)s._opt.sm4CryptoKey&&t?i=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const s=e.byteLength;let r=5;for(;rs)break;let o=e[r+4],n=!1;if(i?(o=o>>>1&63,n=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,n=1===o||5===o),n){const i=kd(e.slice(r+4+2,r+4+a),t,0,{padding:"none",output:"array"});e.set(i,r+4+2)}r=r+4+a}return e}(e,s._opt.sm4CryptoKey):s._opt.sm4CryptoKey||s.debug.error(this.TAG_NAME,"isSm4Crypto opt.sm4CryptoKey is null");else if(s._opt.isXorCrypto)if(s._opt.cryptoKey&&s._opt.cryptoKey.byteLength>0&&s._opt.cryptoIV&&s._opt.cryptoIV.byteLength>0){const t=this.player.video.getVideoInfo();i=function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=e.byteLength;let a=5;for(;ar)break;let n=e[a+4],l=!1;if(s?(n=n>>>1&63,l=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(n)):(n&=31,l=1===n||5===n),l){const s=xd(e.slice(a+4,a+4+o),t,i);e.set(s,a+4)}a=a+4+o}return e}(e,s._opt.cryptoKey,s._opt.cryptoIV,t.encTypeCode===_t)}else s.debug.error(this.TAG_NAME,"isXorCrypto opt.xorCryptoKey is null");return i}cryptoPayloadAudio(e){let t=e,i=this.player;if(i._opt.isM7sCrypto)if(i._opt.cryptoKey&&i._opt.cryptoKey.byteLength>0&&i._opt.cryptoIV&&i._opt.cryptoIV.byteLength>0){e[0]>>4===Et&&(t=function(e,t,i){if(e.byteLength<=30)return e;const s=e.slice(32);let r=new ld.ModeOfOperation.ctr(t,new ld.Counter(i));const a=r.decrypt(s);return r=null,e.set(a,32),e}(e,i._opt.cryptoKey,i._opt.cryptoIV))}else i.debug.error(this.TAG_NAME,`isM7sCrypto cryptoKey.length is ${i._opt.cryptoKey&&i._opt.cryptoKey.byteLength} or cryptoIV.length is ${i._opt.cryptoIV&&i._opt.cryptoIV.byteLength} null`);return t}_decodeEnhancedH265Video(e,t){const i=e[0],s=48&i,r=15&i,a=e.slice(1,5),o=new ArrayBuffer(4),n=new Uint32Array(o),l="a"==String.fromCharCode(a[0]);if(r===yr){if(s===vr){const t=e.slice(5);if(l);else{const e=new Uint8Array(5+t.length);e.set([28,0,0,0,0],0),e.set(t,5),this.updateNalUnitSize(e),this.player.debug.log(this.TAG_NAME,`demux() isVideoSequenceHeader(enhancedH265) is true and nalUnitSize is ${this.nalUnitSize}`),this._doDecode(e,je,0,!0,0)}}}else if(r===Ar){let i=e,r=0;const a=s===vr;if(a&&this.calcIframeIntervalTimestamp(t),l);else{n[0]=e[4],n[1]=e[3],n[2]=e[2],n[3]=0,r=n[0];i=jn(e.slice(8),a),i=this.cryptoPayload(i,a),this._doDecode(i,je,t,a,r)}}else if(r===br){const i=s===vr,r=e.slice(5);i&&this.calcIframeIntervalTimestamp(t);let a=jn(r,i);a=this.cryptoPayload(a,i),this._doDecode(a,je,t,i,0)}}_isEnhancedH265Header(e){return 128==(128&e)}}var Ld=function(e,t,i,s){return new(i||(i=Promise))((function(r,a){function o(e){try{l(s.next(e))}catch(e){a(e)}}function n(e){try{l(s.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,n)}l((s=s.apply(e,t||[])).next())}))};const Pd=Symbol(32),Bd=Symbol(16),Id=Symbol(8);class Md{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return Ld(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,i)=>{var s;this.reject=i,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(s=this.pull)||void 0===s||s.call(this,e)}))}))}readU32(){return this.read(Pd)}readU16(){return this.read(Bd)}readU8(){return this.read(Id)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let i=0;const s=e=>t.length<(i=e);if("number"==typeof this.need){if(s(this.need))return;e=t.subarray(0,i)}else if(this.need===Pd){if(s(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Bd){if(s(2))return;e=t[0]<<8|t[1]}else if(this.need===Id){if(s(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(s(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,i)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(s(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,i)),e=this.need}return this.consumed+=i,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{const e=new Uint8Array(i);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}}Md.U32=Pd,Md.U16=Bd,Md.U8=Id;class Ud extends Dd{constructor(e){super(e),this.TAG_NAME="FlvDemux",this.input=new Md(this.demux()),e.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.input=null,this.player.debug.log(this.TAG_NAME,"destroy")}dispatch(e){this.input?this.input.write(e):this.player&&this.player.debug.warn(this.TAG_NAME,"dispatch() this.input is null")}*demux(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),i=new Uint32Array(e),s=this.player;for(;;){if(!this.input)return;t[3]=0;const e=yield 15,r=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const a=i[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let o=i[0];const n=(yield a).slice();if(!s)return;switch(r){case ze:if(s._opt.hasAudio&&(s.updateStats({abps:n.byteLength}),n.byteLength>0)){let e=n;uo(this.player._opt.m7sCryptoAudio)&&(e=this.cryptoPayloadAudio(n)),this._doDecode(e,Ne,o)}break;case Ge:if(s._opt.hasVideo&&n.length>=6){let e=o;s.updateStats({vbps:n.byteLength,dts:e}),s._times.demuxStart||(s._times.demuxStart=aa());const t=n[0];if(this._isEnhancedH265Header(t))this._decodeEnhancedH265Video(n,e);else{const e=15&t;let s=(t>>4&15)===js;const r=e===vt;if(po(e===_t||r))return void this.player.debug.warn(this.TAG_NAME,`demux() codecId is ${e} and ignore`);s&&(this.calcIframeIntervalTimestamp(o),null===this.nalUnitSize&&co(n)&&this.updateNalUnitSize(n)),i[0]=n[4],i[1]=n[3],i[2]=n[2],i[3]=0;let a=i[0],l=this.cryptoPayload(n,s);this._doDecode(l,je,o,s,a)}}else n.length<6&&s.debug.warn(this.TAG_NAME,`payload.length is ${n.length} less than 6 and ignore`);break;case He:if(this.player.isRecordTypeFlv()){const e=new Uint8Array(n);this.player.recorder.addMetaData(e)}const e=al(n);e&&e.onMetaData&&s.updateMetaData(e.onMetaData);break;default:s.debug.log(this.TAG_NAME,`demux() type is ${r}`)}}}close(){this.input=null}getInputByteLength(){let e=0;return this.input&&this.input.buffer&&(e=this.input.buffer.byteLength),e}}class Fd extends Dd{constructor(e){super(e),this.TAG_NAME="M7sDemux",e.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debug.log(this.TAG_NAME,"destroy")}dispatch(e){const t=this.player,i=new DataView(e),s=i.getUint8(0),r=i.getUint32(1,!1),a=new ArrayBuffer(4),o=new Uint32Array(a);switch(s){case Ne:if(t._opt.hasAudio){const i=new Uint8Array(e,5);t.updateStats({abps:i.byteLength}),i.byteLength>0&&this._doDecode(i,s,r)}break;case je:if(t._opt.hasVideo)if(t._times.demuxStart||(t._times.demuxStart=aa()),i.byteLength>=11){const a=new Uint8Array(e,5);let n=r;t.updateStats({vbps:a.byteLength,dts:n});const l=a[0];if(this._isEnhancedH265Header(l))this._decodeEnhancedH265Video(a,r);else{const e=i.getUint8(5)>>4==1;e&&this.calcIframeIntervalTimestamp(r),o[0]=a[4],o[1]=a[3],o[2]=a[2],o[3]=0;let t=o[0],n=this.cryptoPayload(a,e);this._doDecode(n,s,r,e,t)}}else this.player.debug.warn(this.TAG_NAME,"dispatch","dv byteLength is",i.byteLength,"and return")}}}class Od extends Ud{constructor(e){super(e),e.debug.log("WebTransportDemux","init")}destroy(){this.player.debug.log("WebTransportDemux","destroy"),super.destroy()}}var Nd,jd=Ir((function(e){e.exports=function(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e},e.exports.__esModule=!0,e.exports.default=e.exports})),zd=(Nd=jd)&&Nd.__esModule&&Object.prototype.hasOwnProperty.call(Nd,"default")?Nd.default:Nd;class Gd extends Dd{constructor(e){super(e),zd(this,"TAG_NAME","NakedFlowDemux"),this.lastBuf=null,this.vps=null,this.sps=null,this.pps=null,this.streamVideoType=null,this.streamAudioType=null,this.tempNaluBufferList=new Uint8Array(0),this.localDts=0,this.isSendSeqHeader=!1,this.isSendAACSeqHeader=!1,e.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.lastBuf=null,this.vps=null,this.sps=null,this.pps=null,this.streamVideoType=null,this.streamAudioType=null,this.tempNaluBufferList=new Uint8Array(0),this.localDts=0,this.localAudioDts=0,this.isSendSeqHeader=!1,this.isSendAACSeqHeader=!1,this.player.debug.log(this.TAG_NAME,"destroy")}dispatch(e){this.player;const t=new Uint8Array(e);this.extractNALu$2(t)}addNaluToBuffer(e){const t=e.byteLength+this.tempNaluBufferList.byteLength,i=new Uint8Array(t);i.set(this.tempNaluBufferList,0),i.set(e,this.tempNaluBufferList.byteLength),this.tempNaluBufferList=i}downloadNakedFlowFile(){const e=new Blob([this.tempNaluBufferList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".h264",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadTempNalu",e)}}getNaluDts(){const e=this.player._opt.nakedFlowFps;return this.localDts=this.localDts+parseInt(1e3/e),this.localDts}getNaluAudioDts(){const e=this.player.audio.audioContext.sampleRate,t=this.player.audio.audioBufferSize;return this.localDts+parseInt(t/e*1e3)}extractNALu(e){let t,i,s=0,r=e.byteLength,a=0,o=[];for(;s1)for(let e=0;e>1,i!==jt&&i!==Gt&&i!==Vt||(t=wt)),t}(t)),this.streamVideoType===St){const e=this.handleAddNaluStartCode(t),i=this.extractNALu(e);if(0===i.length)return void this.player.debug.warn(this.TAG_NAME,"handleVideoNalu","naluList.length === 0");const s=[];if(i.forEach((e=>{const t=Cn(e);t===Rt||t===xt?this.handleVideoH264Nalu(e):Rn(t)&&s.push(e)})),1===s.length)this.handleVideoH264Nalu(s[0]);else{const e=function(e){if(0===e.length)return!1;const t=Cn(e[0]);for(let i=1;i{this.handleVideoH264Nalu(e)}))}}else if(this.streamVideoType===wt)if(this.player._opt.nakedFlowH265DemuxUseNew){const e=this.handleAddNaluStartCode(t),i=this.extractNALu(e);if(0===i.length)return void this.player.debug.warn(this.TAG_NAME,"handleVideoNalu","h265 naluList.length === 0");const s=[];if(i.forEach((e=>{const t=zn(e);t===Vt||t===Gt||t===jt?this.handleVideoH265Nalu(e):Gn(t)&&s.push(e)})),1===s.length)this.handleVideoH265Nalu(s[0]);else{const e=function(e){if(0===e.length)return!1;const t=zn(e[0]);for(let i=1;i{this.handleVideoH265Nalu(e)}))}}else{zn(t)===Vt?this.extractH265PPS(t):this.handleVideoH265Nalu(t)}else this.player.debug.error(this.TAG_NAME," this.streamVideoType is null")}extractH264PPS(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{xn(Cn(e))?this.extractH264SEI(e):this.handleVideoH264Nalu(e)}))}extractH265PPS(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{const t=zn(e);t===Wt?this.extractH265SEI(e):this.handleVideoH265Nalu(e)}))}extractH264SEI(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{this.handleVideoH264Nalu(e)}))}extractH265SEI(e){const t=this.handleAddNaluStartCode(e);this.extractNALu(t).forEach((e=>{this.handleVideoH265Nalu(e)}))}handleAddNaluStartCode(e){const t=[0,0,0,1],i=new Uint8Array(e.length+t.length);return i.set(t),i.set(e,t.length),i}handleAudioAACNalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=kt.AAC);let t=new Uint8Array(e);const i=t.slice(0,7);if(t=t.slice(7),!this.isSendAACSeqHeader){const e=(192&i[2])>>6,t=(60&i[2])>>2,s=(1&i[2])<<2|(192&i[3])>>6,r=new Uint8Array([175,0,e<<3|(14&t)>>1,(1&t)<<7|s<<3]);this.isSendAACSeqHeader=!0,this._doDecode(r,Ne,0,!1,0)}const s=this.getNaluAudioDts(),r=new Uint8Array(t.length+2);r.set([175,1],0),r.set(t,2),this._doDecode(r,Ne,s,!1,0)}handleAudioG711ANalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=kt.ALAW);let t=new Uint8Array(e);const i=this.getNaluAudioDts(),s=new Uint8Array(t.length+1);s.set([114],0),s.set(t,1),this._doDecode(s,Ne,i,!1,0)}handleAudioG711UNalu(e){if(!e||e.byteLength<1)return;this.streamAudioType||(this.streamAudioType=kt.MULAW);let t=new Uint8Array(e);const i=this.getNaluAudioDts(),s=new Uint8Array(t.length+1);s.set([130],0),s.set(t,1),this._doDecode(s,Ne,i,!1,0)}handleVideoH264Nalu(e){const t=Cn(e);switch(t){case xt:this.sps=e;break;case Rt:this.pps=e}if(this.isSendSeqHeader){if(this.sps&&this.pps){const e=Tn({sps:this.sps,pps:this.pps}),t=this.getNaluDts();this._doDecode(e,je,t,!0,0),this.sps=null,this.pps=null}if(Rn(t)){this.player._times.demuxStart||(this.player._times.demuxStart=aa());const i=Dn(t),s=this.getNaluDts(),r=function(e,t){let i=[];i[0]=t?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}(e,i);this._preDoDecode(r,je,s,i,0)}else this.player.debug.warn(this.TAG_NAME,`handleVideoH264Nalu is avc seq head nalType is ${t}`)}else if(this.sps&&this.pps){this.isSendSeqHeader=!0;const e=Tn({sps:this.sps,pps:this.pps});this._doDecode(e,je,0,!0,0),this.sps=null,this.pps=null}}handleVideoH264NaluList(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=aa());const i=this.getNaluDts(),s=kn(e.reduce(((e,t)=>{const i=ea(e),s=ea(t),r=new Uint8Array(i.byteLength+s.byteLength);return r.set(i,0),r.set(s,i.byteLength),r})),t);this._preDoDecode(s,je,i,t,0)}else this.player.debug.warn(this.TAG_NAME,"handleVideoH264NaluList isSendSeqHeader is false")}handleVideoH265Nalu(e){const t=zn(e);switch(t){case jt:this.vps=e;break;case Gt:this.sps=e;break;case Vt:this.pps=e}if(this.isSendSeqHeader){if(this.vps&&this.sps&&this.pps){const e=Nn({vps:this.vps,sps:this.sps,pps:this.pps}),t=this.getNaluDts();this._doDecode(e,je,t,!0,0),this.vps=null,this.sps=null,this.pps=null}if(Gn(t)){this.player._times.demuxStart||(this.player._times.demuxStart=aa());const i=Hn(t),s=this.getNaluDts(),r=function(e,t){let i=[];i[0]=t?28:44,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=e.byteLength>>24&255,i[6]=e.byteLength>>16&255,i[7]=e.byteLength>>8&255,i[8]=255&e.byteLength;const s=new Uint8Array(i.length+e.byteLength);return s.set(i,0),s.set(e,i.length),s}(e,i);this._preDoDecode(r,je,s,i,0)}}else if(this.vps&&this.sps&&this.pps){this.isSendSeqHeader=!0;const e=Nn({vps:this.vps,sps:this.sps,pps:this.pps});this._doDecode(e,je,0,!0,0),this.vps=null,this.sps=null,this.pps=null}}handleVideoH265NaluList(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=aa());const i=this.getNaluDts(),s=jn(e.reduce(((e,t)=>{const i=ea(e),s=ea(t),r=new Uint8Array(i.byteLength+s.byteLength);return r.set(i,0),r.set(s,i.byteLength),r})),t);this._preDoDecode(s,je,i,t,0)}else this.player.debug.warn(this.TAG_NAME,"handleVideoH265NaluList isSendSeqHeader is false")}_preDoDecode(e,t,i,s,r){this.player.updateStats({vbps:e.byteLength,dts:i}),s&&this.calcIframeIntervalTimestamp(i),this._doDecode(e,je,i,s,r)}getInputByteLength(){let e=0;return this.lastBuf&&(e=this.lastBuf.byteLength),e}}class Hd extends Dd{constructor(e){super(e),this.player=e,e.debug.log("EmptyDemux","init")}destroy(){super.destroy(),this.player.debug.log("EmptyDemux","destroy")}}var Vd=Ir((function(e,t){var s,r,a,o=(s=new Date,r=4,a={setLogLevel:function(e){r=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=r&&console.debug("["+o.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=r&&console.info("["+o.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=r&&console.warn("["+o.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=r&&console.error("["+o.getDurationString(new Date-s,1e3)+"]","["+e+"]",t)}},a);o.getDurationString=function(e,t){var i;function s(e,t){for(var i=(""+e).split(".");i[0].length0){for(var i="",s=0;s0&&(i+=","),i+="["+o.getDurationString(e.start(s))+","+o.getDurationString(e.end(s))+"]";return i}return"(empty)"},t.Log=o;var n=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};n.prototype.getPosition=function(){return this.position},n.prototype.getEndPosition=function(){return this.buffer.byteLength},n.prototype.getLength=function(){return this.buffer.byteLength},n.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},n.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},n.prototype.readAnyInt=function(e,t){var i=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:i=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:i=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";i=this.dataview.getUint8(this.position)<<16,i|=this.dataview.getUint8(this.position+1)<<8,i|=this.dataview.getUint8(this.position+2);break;case 4:i=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";i=this.dataview.getUint32(this.position)<<32,i|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,i}throw"Not enough bytes in buffer"},n.prototype.readUint8=function(){return this.readAnyInt(1,!1)},n.prototype.readUint16=function(){return this.readAnyInt(2,!1)},n.prototype.readUint24=function(){return this.readAnyInt(3,!1)},n.prototype.readUint32=function(){return this.readAnyInt(4,!1)},n.prototype.readUint64=function(){return this.readAnyInt(8,!1)},n.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",i=0;ithis._byteLength&&(this._byteLength=t);else{for(i<1&&(i=1);t>i;)i*=2;var s=new ArrayBuffer(i),r=new Uint8Array(this._buffer);new Uint8Array(s,0,r.length).set(r),this.buffer=s,this._byteLength=t}}},l.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),i=new Uint8Array(this._buffer,0,t.length);t.set(i),this.buffer=e}},l.BIG_ENDIAN=!1,l.LITTLE_ENDIAN=!0,l.prototype._byteLength=0,Object.defineProperty(l.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(l.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(l.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(l.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),l.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},l.prototype.isEof=function(){return this.position>=this._byteLength},l.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},l.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Int32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Int16Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return l.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},l.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Uint32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var i=new Uint16Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return l.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},l.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var i=new Float64Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var i=new Float32Array(e);return l.memcpy(i.buffer,0,this.buffer,this.byteOffset+this.position,e*i.BYTES_PER_ELEMENT),l.arrayToNative(i,null==t?this.endianness:t),this.position+=i.byteLength,i},l.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},l.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},l.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},l.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},l.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},l.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},l.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,l.memcpy=function(e,t,i,s,r){var a=new Uint8Array(e,t,r),o=new Uint8Array(i,s,r);a.set(o)},l.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},l.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},l.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i=0;ir;s--,r++){var a=t[r];t[r]=t[s],t[s]=a}return e},l.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],i=0;i>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},l.prototype.adjustUint32=function(e,t){var i=this.position;this.seek(e),this.writeUint32(t),this.seek(i)},l.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var i=new Int32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},l.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var i=new Int16Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},l.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},l.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var i=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i},l.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var i=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=2*e,i},l.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var i=new Float64Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=8*e,i},l.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var i=new Float32Array(this._buffer,this.byteOffset+this.position,e);return l.arrayToNative(i,null==t?this.endianness:t),this.position+=4*e,i};var h=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(h.prototype=new l(new ArrayBuffer,0,l.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,o.debug("MultiBufferStream","Stream ready for parsing"),!0):(o.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(o.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){o.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var i=new Uint8Array(e.byteLength+t.byteLength);return i.set(new Uint8Array(e),0),i.set(new Uint8Array(t),e.byteLength),i.buffer},h.prototype.reduceBuffer=function(e,t,i){var s;return(s=new Uint8Array(i)).set(new Uint8Array(e,t,i)),s.buffer.fileStart=e.fileStart+t,s.buffer.usedBytes=0,s.buffer},h.prototype.insertBuffer=function(e){for(var t=!0,i=0;is.byteLength){this.buffers.splice(i,1),i--;continue}o.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=s.fileStart||(e=this.reduceBuffer(e,0,s.fileStart-e.fileStart)),o.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(i,0,e),0===i&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,r,a)}}t&&(o.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===i&&(this.buffer=e))},h.prototype.logBufferLevel=function(e){var t,i,s,r,a,n=[],l="";for(s=0,r=0,t=0;t0&&(l+=a.end-1+"]");var d=e?o.info:o.debug;0===this.buffers.length?d("MultiBufferStream","No more buffer in memory"):d("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+s+"/"+r+" bytes), continuous ranges: "+l)},h.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},h.prototype.findPosition=function(e,t,i){var s,r=null,a=-1;for(s=!0===e?0:this.bufferIndex;s=t?(o.debug("MultiBufferStream","Found position in existing buffer #"+a),a):-1},h.prototype.findEndContiguousBuf=function(e){var t,i,s,r=void 0!==e?e:this.bufferIndex;if(i=this.buffers[r],this.buffers.length>r+1)for(t=r+1;t>3;return 31===s&&i.data.length>=2&&(s=32+((7&i.data[0])<<3)+((224&i.data[1])>>5)),s}return null},i.DecoderConfigDescriptor=function(e){i.Descriptor.call(this,4,e)},i.DecoderConfigDescriptor.prototype=new i.Descriptor,i.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},i.DecoderSpecificInfo=function(e){i.Descriptor.call(this,5,e)},i.DecoderSpecificInfo.prototype=new i.Descriptor,i.SLConfigDescriptor=function(e){i.Descriptor.call(this,6,e)},i.SLConfigDescriptor.prototype=new i.Descriptor,this};t.MPEG4DescriptorParser=c;var u={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){u.FullBox.prototype=new u.Box,u.ContainerBox.prototype=new u.Box,u.SampleEntry.prototype=new u.Box,u.TrackGroupTypeBox.prototype=new u.FullBox,u.BASIC_BOXES.forEach((function(e){u.createBoxCtor(e)})),u.FULL_BOXES.forEach((function(e){u.createFullBoxCtor(e)})),u.CONTAINER_BOXES.forEach((function(e){u.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,i){this.type=e,this.size=t,this.uuid=i},FullBox:function(e,t,i){u.Box.call(this,e,t,i),this.flags=0,this.version=0},ContainerBox:function(e,t,i){u.Box.call(this,e,t,i),this.boxes=[]},SampleEntry:function(e,t,i,s){u.ContainerBox.call(this,e,t),this.hdr_size=i,this.start=s},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){u.FullBox.call(this,e,t)},createBoxCtor:function(e,t){u.boxCodes.push(e),u[e+"Box"]=function(t){u.Box.call(this,e,t)},u[e+"Box"].prototype=new u.Box,t&&(u[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){u[e+"Box"]=function(t){u.FullBox.call(this,e,t)},u[e+"Box"].prototype=new u.FullBox,u[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,i=0;ii?(o.error("BoxParser","Box of type '"+h+"' has a size "+d+" greater than its container size "+i),{code:u.ERR_NOT_ENOUGH_DATA,type:h,size:d,hdr_size:l,start:n}):0!==d&&n+d>e.getEndPosition()?(e.seek(n),o.info("BoxParser","Not enough data in stream to parse the entire '"+h+"' box"),{code:u.ERR_NOT_ENOUGH_DATA,type:h,size:d,hdr_size:l,start:n}):t?{code:u.OK,type:h,size:d,hdr_size:l,start:n}:(u[h+"Box"]?s=new u[h+"Box"](d):"uuid"!==h?(o.warn("BoxParser","Unknown box type: '"+h+"'"),(s=new u.Box(h,d)).has_unparsed_data=!0):u.UUIDBoxes[a]?s=new u.UUIDBoxes[a](d):(o.warn("BoxParser","Unknown uuid type: '"+a+"'"),(s=new u.Box(h,d)).uuid=a,s.has_unparsed_data=!0),s.hdr_size=l,s.start=n,s.write===u.Box.prototype.write&&"mdat"!==s.type&&(o.info("BoxParser","'"+c+"' box writing not yet implemented, keeping unparsed data in memory for later write"),s.parseDataAndRewind(e)),s.parse(e),(r=e.getPosition()-(s.start+s.size))<0?(o.warn("BoxParser","Parsing of box '"+c+"' did not read the entire indicated box data size (missing "+-r+" bytes), seeking forward"),e.seek(s.start+s.size)):r>0&&(o.error("BoxParser","Parsing of box '"+c+"' read "+r+" more bytes than the indicated box data size, seeking backwards"),0!==s.size&&e.seek(s.start+s.size)),{code:u.OK,box:s,size:s.size})},u.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},u.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},u.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},u.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},u.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},u.ContainerBox.prototype.parse=function(e){for(var t,i;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},u.SAMPLE_ENTRY_TYPE_VISUAL="Visual",u.SAMPLE_ENTRY_TYPE_AUDIO="Audio",u.SAMPLE_ENTRY_TYPE_HINT="Hint",u.SAMPLE_ENTRY_TYPE_METADATA="Metadata",u.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",u.SAMPLE_ENTRY_TYPE_SYSTEM="System",u.SAMPLE_ENTRY_TYPE_TEXT="Text",u.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},u.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},u.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},u.SampleEntry.prototype.parseFooter=function(e){u.ContainerBox.prototype.parse.call(this,e)},u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_HINT),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_METADATA),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SUBTITLE),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SYSTEM),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_TEXT),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),u.createMediaSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),u.createSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_TEXT,"enct"),u.createEncryptedSampleEntryCtor(u.SAMPLE_ENTRY_TYPE_METADATA,"encm"),u.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var i=0;i<3;i++)this.layer_size[i]=16==t?e.readUint16():e.readUint32()})),u.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),u.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),u.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)o.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void o.error("av1C reserved_2 parsing problem");var i=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(i)}else o.error("av1C reserved_1 parsing problem");else o.error("av1C version "+this.version+" not supported")})),u.createBoxCtor("avcC",(function(e){var t,i;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),i=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(i))})),u.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),u.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),u.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),u.createFullBoxCtor("co64",(function(e){var t,i;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(i=0;i>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),u.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),u.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),u.createFullBoxCtor("ctts",(function(e){var t,i;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(i=0;i>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|i>>6&3,this.acmod=i>>3&7,this.lfeon=i>>2&1,this.bit_rate_code=3&i|s>>5&7})),u.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var i=0;i>6,s.bsid=r>>1&31,s.bsmod=(1&r)<<4|a>>4&15,s.acmod=a>>1&7,s.lfeon=1&a,s.num_dep_sub=o>>1&15,s.num_dep_sub>0&&(s.chan_loc=(1&o)<<8|e.readUint8())}})),u.createFullBoxCtor("dfLa",(function(e){var t=[],i=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var s=e.readUint8(),r=Math.min(127&s,i.length-1);if(r?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(i[r]),128&s)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),u.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),u.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),u.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),u.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[i]=e.readString(4),t-=4,i++})),u.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),u.createBoxCtor("hvcC",(function(e){var t,i,s,r;this.configurationVersion=e.readUint8(),r=e.readUint8(),this.general_profile_space=r>>6,this.general_tier_flag=(32&r)>>5,this.general_profile_idc=31&r,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),r=e.readUint8(),this.constantFrameRate=r>>6,this.numTemporalLayers=(13&r)>>3,this.temporalIdNested=(4&r)>>2,this.lengthSizeMinusOne=3&r,this.nalu_arrays=[];var a=e.readUint8();for(t=0;t>7,o.nalu_type=63&r;var n=e.readUint16();for(i=0;i>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var i=0;if(this.version<2)i=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";i=e.readUint32()}for(var s=0;s>7,this.axis=1&t})),u.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),o.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),u.createFullBoxCtor("ipma",(function(e){var t,i;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?o.property_index=(127&a)<<8|e.readUint8():o.property_index=127&a}}})),u.createFullBoxCtor("iref",(function(e){var t,i;for(this.references=[];e.getPosition()>7,s.assignment_type=127&r,s.assignment_type){case 0:s.grouping_type=e.readString(4);break;case 1:s.grouping_type=e.readString(4),s.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:s.sub_track_id=e.readUint32();break;default:o.warn("BoxParser","Unknown leva assignement type")}}})),u.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),u.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),p.prototype.toString=function(){return"("+this.x+","+this.y+")"},u.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new p(e.readUint16(),e.readUint16()),this.display_primaries[1]=new p(e.readUint16(),e.readUint16()),this.display_primaries[2]=new p(e.readUint16(),e.readUint16()),this.white_point=new p(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),u.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),u.createFullBoxCtor("mehd",(function(e){1&this.flags&&(o.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),u.createFullBoxCtor("meta",(function(e){this.boxes=[],u.ContainerBox.prototype.parse.call(this,e)})),u.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),u.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),u.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),u.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),u.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),u.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),u.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var i=0;i0){var t=e.readUint32();this.kid=[];for(var i=0;i0&&(this.data=e.readUint8Array(s))})),u.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),u.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),u.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),u.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var i=0;i>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var i=e.readUint8(),s=0;s>7,this.num_leading_samples=127&t})),u.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)o.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=u.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),u.createSampleGroupCtor("stsa",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),u.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),u.createSampleGroupCtor("tsas",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("tscl",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createSampleGroupCtor("vipr",(function(e){o.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),u.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),i=0;i>6,this.sample_depends_on[s]=t>>4&3,this.sample_is_depended_on[s]=t>>2&3,this.sample_has_redundancy[s]=3&t})),u.createFullBoxCtor("senc"),u.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),o.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),i=0;i>31&1,s.referenced_size=2147483647&r,s.subsegment_duration=e.readUint32(),r=e.readUint32(),s.starts_with_SAP=r>>31&1,s.SAP_type=r>>28&7,s.SAP_delta_time=268435455&r}})),u.SingleItemTypeReferenceBox=function(e,t,i,s){u.Box.call(this,e,t),this.hdr_size=i,this.start=s},u.SingleItemTypeReferenceBox.prototype=new u.Box,u.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var i=0;i>4&15,this.sample_sizes[t+1]=15&s}else if(8===this.field_size)for(t=0;t0)for(i=0;i>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=u.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),u.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),u.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&u.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),u.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var i=e.readUint32(),s=0;s>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),u.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),u.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),u.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),u.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),u.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),u.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},u.createTrackGroupCtor("msrc"),u.TrackReferenceTypeBox=function(e,t,i,s){u.Box.call(this,e,t),this.hdr_size=i,this.start=s},u.TrackReferenceTypeBox.prototype=new u.Box,u.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},u.trefBox.prototype.parse=function(e){for(var t,i;e.getPosition()t&&this.flags&u.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&u.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var i=0;i>7&1,this.block_pad_lsb=i>>6&1,this.block_little_endian=i>>5&1,this.block_reversed=i>>4&1,this.pad_unknown=i>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),u.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),u.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),u.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),u.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=u.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),u.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),u.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=u.parseHex16(e)})),u.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),u.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),u.createFullBoxCtor("vvcC",(function(e){var t,i,s={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(s.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,i=this.num_sublayers-2;i>=0;--i){var o=s.extract_bits(1);this.ptl_sublayer_present_mask|=o<1;++i)s.extract_bits(1);for(this.sublayer_level_idc=[],i=this.num_sublayers-2;i>=0;--i)this.ptl_sublayer_present_mask&1<>=1;t+=u.decimalToHex(s,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var r=!1,a="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||r)&&(a="."+u.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+a,r=!0);t+=a}return t},u.vvc1SampleEntry.prototype.getCodec=u.vvi1SampleEntry.prototype.getCodec=function(){var e,t=u.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var i="";if(this.vvcC.general_constraint_info){var s,r=[],a=0;for(a|=this.vvcC.ptl_frame_only_constraint<<7,a|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,r.push(a),a&&(s=e),a=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===s)i=".CA";else{i=".C";var o="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",n=0,l=0;for(e=0;e<=s;++e)for(n=n<<8|r[e],l+=8;l>=5;){i+=o[n>>l-5&31],n&=(1<<(l-=5))-1}l&&(i+=o[31&(n<<=5-l)])}}t+=i}return t},u.mp4aSampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),i=this.esds.esd.getAudioConfig();return e+"."+u.decimalToHex(t)+(i?"."+i:"")}return e},u.stxtSampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},u.vp08SampleEntry.prototype.getCodec=u.vp09SampleEntry.prototype.getCodec=function(){var e=u.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var i=this.vpcC.bitDepth;return 8==i&&(i="08"),e+".0"+this.vpcC.profile+"."+t+"."+i},u.av01SampleEntry.prototype.getCodec=function(){var e,t=u.SampleEntry.prototype.getCodec.call(this),i=this.av1C.seq_level_idx_0;return i<10&&(i="0"+i),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+i+(this.av1C.seq_tier_0?"H":"M")+"."+e},u.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>d&&(this.size+=8),"uuid"===this.type&&(this.size+=16),o.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>d?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>d&&e.writeUint64(this.size)},u.FullBox.prototype.writeHeader=function(e){this.size+=4,u.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},u.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},u.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},u.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&u.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&u.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&u.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&u.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&u.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&u.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&u.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},u.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},u.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},u.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&u.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&u.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&u.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&u.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&u.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&u.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&u.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&u.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[i]instanceof u.Box||t[i]instanceof u.Box||void 0===e[i]||void 0===t[i]||"function"==typeof e[i]||"function"==typeof t[i]||e.subBoxNames&&e.subBoxNames.indexOf(i.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(i.slice(0,4))>-1||"data"===i||"start"===i||"size"===i||"creation_time"===i||"modification_time"===i||u.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(i)>-1||e[i]===t[i]))return!1;return!0},u.boxEqual=function(e,t){if(!u.boxEqualFields(e,t))return!1;for(var i=0;i1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},y.prototype.setExtractionOptions=function(e,t,i){var s=this.getTrackById(e);if(s){var r={};this.extractedTracks.push(r),r.id=e,r.user=t,r.trak=s,s.nextSample=0,r.nb_samples=1e3,r.samples=[],i&&i.nbSamples&&(r.nb_samples=i.nbSamples)}},y.prototype.unsetExtractionOptions=function(e){for(var t=-1,i=0;i-1&&this.extractedTracks.splice(t,1)},y.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=u.parseOneBox(this.stream,false)).code===u.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var i;switch(i="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),i){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[i]&&o.warn("ISOFile","Duplicate Box of type: "+i+", overriding previous occurrence"),this[i]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},y.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(o.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(o.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(o.warn("ISOFile","Not ready to start parsing"),!1))},y.prototype.appendBuffer=function(e,t){var i;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(i=this.nextSeekPosition,this.nextSeekPosition=void 0):i=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(i=this.stream.getEndFilePositionAfter(i))):i=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(o.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+i),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),o.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),i},y.prototype.getInfo=function(){var e,t,i,s,r,a,o={},n=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(o.hasMoov=!0,o.duration=this.moov.mvhd.duration,o.timescale=this.moov.mvhd.timescale,o.isFragmented=null!=this.moov.mvex,o.isFragmented&&this.moov.mvex.mehd&&(o.fragment_duration=this.moov.mvex.mehd.fragment_duration),o.isProgressive=this.isProgressive,o.hasIOD=null!=this.moov.iods,o.brands=[],o.brands.push(this.ftyp.major_brand),o.brands=o.brands.concat(this.ftyp.compatible_brands),o.created=new Date(n+1e3*this.moov.mvhd.creation_time),o.modified=new Date(n+1e3*this.moov.mvhd.modification_time),o.tracks=[],o.audioTracks=[],o.videoTracks=[],o.subtitleTracks=[],o.metadataTracks=[],o.hintTracks=[],o.otherTracks=[],e=0;e0?o.mime+='video/mp4; codecs="':o.audioTracks&&o.audioTracks.length>0?o.mime+='audio/mp4; codecs="':o.mime+='application/mp4; codecs="',e=0;e=i.samples.length)&&(o.info("ISOFile","Sending fragmented data on track #"+s.id+" for samples ["+Math.max(0,i.nextSample-s.nb_samples)+","+(i.nextSample-1)+"]"),o.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(s.id,s.user,s.segmentStream.buffer,i.nextSample,e||i.nextSample>=i.samples.length),s.segmentStream=null,s!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=i.samples.length)&&(o.debug("ISOFile","Sending samples on track #"+a.id+" for sample "+i.nextSample),this.onSamples&&this.onSamples(a.id,a.user,a.samples),a.samples=[],a!==this.extractedTracks[t]))break}}}},y.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},y.prototype.getBoxes=function(e,t){var i=[];return y._sweep.call(this,e,i,t),i},y._sweep=function(e,t,i){for(var s in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&i)return;y._sweep.call(this.boxes[s],e,t,i)}},y.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},y.prototype.getTrackSample=function(e,t){var i=this.getTrackById(e);return this.getSample(i,t)},y.prototype.releaseUsedSamples=function(e,t){var i=0,s=this.getTrackById(e);s.lastValidSample||(s.lastValidSample=0);for(var r=s.lastValidSample;re*r.timescale){d=s-1;break}t&&r.is_sync&&(l=s)}for(t&&(d=l),e=i.samples[d].cts,i.nextSample=d;i.samples[d].alreadyRead===i.samples[d].size&&i.samples[d+1];)d++;return a=i.samples[d].offset+i.samples[d].alreadyRead,o.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+i.nextSample+" on track "+i.tkhd.track_id+", time "+o.getDurationString(e,n)+" and offset: "+a),{offset:a,time:e/n}},y.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},y.prototype.seek=function(e,t){var i,s,r,a=this.moov,n={offset:1/0,time:1/0};if(this.moov){for(r=0;rthis.getTrackDuration(i)||((s=this.seekTrack(e,t,i)).offset-1){o=l;break}switch(o){case"Visual":if(r.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),a.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var c=new u.avcCBox;c.parse(new n(t.avcDecoderConfigRecord)),a.addBox(c)}else if(t.hevcDecoderConfigRecord){var p=new u.hvcCBox;p.parse(new n(t.hevcDecoderConfigRecord)),a.addBox(p)}break;case"Audio":r.add("smhd").set("balance",t.balance||0),a.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":r.add("hmhd");break;case"Subtitle":if(r.add("sthd"),"stpp"===t.type)a.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:r.add("nmhd")}t.description&&a.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){a.addBox(e)})),r.add("dinf").add("dref").addEntry((new u["url Box"]).set("flags",1));var f=r.add("stbl");return f.add("stsd").addEntry(a),f.add("stts").set("sample_counts",[]).set("sample_deltas",[]),f.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),f.add("stco").set("chunk_offsets",[]),f.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(i),t.id}},u.Box.prototype.computeSize=function(e){var t=e||new l;t.endianness=l.BIG_ENDIAN,this.write(t)},y.prototype.addSample=function(e,t,i){var s=i||{},r={},a=this.getTrackById(e);if(null!==a){r.number=a.samples.length,r.track_id=a.tkhd.track_id,r.timescale=a.mdia.mdhd.timescale,r.description_index=s.sample_description_index?s.sample_description_index-1:0,r.description=a.mdia.minf.stbl.stsd.entries[r.description_index],r.data=t,r.size=t.byteLength,r.alreadyRead=r.size,r.duration=s.duration||1,r.cts=s.cts||0,r.dts=s.dts||0,r.is_sync=s.is_sync||!1,r.is_leading=s.is_leading||0,r.depends_on=s.depends_on||0,r.is_depended_on=s.is_depended_on||0,r.has_redundancy=s.has_redundancy||0,r.degradation_priority=s.degradation_priority||0,r.offset=0,r.subsamples=s.subsamples,a.samples.push(r),a.samples_size+=r.size,a.samples_duration+=r.duration,void 0===a.first_dts&&(a.first_dts=s.dts),this.processSamples();var o=this.createSingleSampleMoof(r);return this.addBox(o),o.computeSize(),o.trafs[0].truns[0].data_offset=o.size+8,this.add("mdat").data=new Uint8Array(t),r}},y.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var i=new u.moofBox;i.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var s=i.add("traf"),r=this.getTrackById(e.track_id);return s.add("tfhd").set("track_id",e.track_id).set("flags",u.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),s.add("tfdt").set("baseMediaDecodeTime",e.dts-(r.first_dts||0)),s.add("trun").set("flags",u.TRUN_FLAGS_DATA_OFFSET|u.TRUN_FLAGS_DURATION|u.TRUN_FLAGS_SIZE|u.TRUN_FLAGS_FLAGS|u.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),i},y.prototype.lastMoofIndex=0,y.prototype.samplesDataSize=0,y.prototype.resetTables=function(){var e,t,i,s,r,a;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(l=r[o].grouping_type+"/0",(n=new d(r[o].grouping_type,0)).is_fragment=!0,t.sample_groups_info[l]||(t.sample_groups_info[l]=n))}else for(o=0;o=2&&(l=s[o].grouping_type+"/0",n=new d(s[o].grouping_type,0),e.sample_groups_info[l]||(e.sample_groups_info[l]=n))},y.setSampleGroupProperties=function(e,t,i,s){var r,a;for(r in t.sample_groups=[],s){var o;if(t.sample_groups[r]={},t.sample_groups[r].grouping_type=s[r].grouping_type,t.sample_groups[r].grouping_type_parameter=s[r].grouping_type_parameter,i>=s[r].last_sample_in_run&&(s[r].last_sample_in_run<0&&(s[r].last_sample_in_run=0),s[r].entry_index++,s[r].entry_index<=s[r].sbgp.entries.length-1&&(s[r].last_sample_in_run+=s[r].sbgp.entries[s[r].entry_index].sample_count)),s[r].entry_index<=s[r].sbgp.entries.length-1?t.sample_groups[r].group_description_index=s[r].sbgp.entries[s[r].entry_index].group_description_index:t.sample_groups[r].group_description_index=-1,0!==t.sample_groups[r].group_description_index)o=s[r].fragment_description?s[r].fragment_description:s[r].description,t.sample_groups[r].group_description_index>0?(a=t.sample_groups[r].group_description_index>65535?(t.sample_groups[r].group_description_index>>16)-1:t.sample_groups[r].group_description_index-1,o&&a>=0&&(t.sample_groups[r].description=o.entries[a])):o&&o.version>=2&&o.default_group_description_index>0&&(t.sample_groups[r].description=o.entries[o.default_group_description_index-1])}},y.process_sdtp=function(e,t,i){t&&(e?(t.is_leading=e.is_leading[i],t.depends_on=e.sample_depends_on[i],t.is_depended_on=e.sample_is_depended_on[i],t.has_redundancy=e.sample_has_redundancy[i]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},y.prototype.buildSampleLists=function(){var e,t;for(e=0;eb&&(v++,b<0&&(b=0),b+=a.sample_counts[v]),t>0?(e.samples[t-1].duration=a.sample_deltas[v],e.samples_duration+=e.samples[t-1].duration,k.dts=e.samples[t-1].dts+e.samples[t-1].duration):k.dts=0,o?(t>=_&&(S++,_<0&&(_=0),_+=o.sample_counts[S]),k.cts=e.samples[t].dts+o.sample_offsets[S]):k.cts=k.dts,n?(t==n.sample_numbers[w]-1?(k.is_sync=!0,w++):(k.is_sync=!1,k.degradation_priority=0),d&&d.entries[E].sample_delta+T==t+1&&(k.subsamples=d.entries[E].subsamples,T+=d.entries[E].sample_delta,E++)):k.is_sync=!0,y.process_sdtp(e.mdia.minf.stbl.sdtp,k,k.number),k.degradation_priority=u?u.priority[t]:0,d&&d.entries[E].sample_delta+T==t&&(k.subsamples=d.entries[E].subsamples,T+=d.entries[E].sample_delta),(h.length>0||c.length>0)&&y.setSampleGroupProperties(e,k,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},y.prototype.updateSampleLists=function(){var e,t,i,s,r,a,o,n,l,d,h,c,p,f,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&y.initSampleGroups(c,h,h.sbgps,c.mdia.minf.stbl.sgpds,h.sgpds),t=0;t0?f.dts=c.samples[c.samples.length-2].dts+c.samples[c.samples.length-2].duration:(h.tfdt?f.dts=h.tfdt.baseMediaDecodeTime:f.dts=0,c.first_traf_merged=!0),f.cts=f.dts,g.flags&u.TRUN_FLAGS_CTS_OFFSET&&(f.cts=f.dts+g.sample_composition_time_offset[i]),m=o,g.flags&u.TRUN_FLAGS_FLAGS?m=g.sample_flags[i]:0===i&&g.flags&u.TRUN_FLAGS_FIRST_FLAG&&(m=g.first_sample_flags),f.is_sync=!(m>>16&1),f.is_leading=m>>26&3,f.depends_on=m>>24&3,f.is_depended_on=m>>22&3,f.has_redundancy=m>>20&3,f.degradation_priority=65535&m;var A=!!(h.tfhd.flags&u.TFHD_FLAG_BASE_DATA_OFFSET),b=!!(h.tfhd.flags&u.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),v=!!(g.flags&u.TRUN_FLAGS_DATA_OFFSET),_=0;_=A?h.tfhd.base_data_offset:b||0===t?d.start:n,f.offset=0===t&&0===i?v?_+g.data_offset:_:n,n=f.offset+f.size,(h.sbgps.length>0||h.sgpds.length>0||c.mdia.minf.stbl.sbgps.length>0||c.mdia.minf.stbl.sgpds.length>0)&&y.setSampleGroupProperties(c,f,f.number_in_traf,h.sample_groups_info)}}if(h.subs){c.has_fragment_subsamples=!0;var S=h.first_sample_index;for(t=0;t-1))return null;var a=(i=this.stream.buffers[r]).byteLength-(s.offset+s.alreadyRead-i.fileStart);if(s.size-s.alreadyRead<=a)return o.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-i.fileStart)+" read size: "+(s.size-s.alreadyRead)+" full size: "+s.size+")"),l.memcpy(s.data.buffer,s.alreadyRead,i,s.offset+s.alreadyRead-i.fileStart,s.size-s.alreadyRead),i.usedBytes+=s.size-s.alreadyRead,this.stream.logBufferLevel(),s.alreadyRead=s.size,s;if(0===a)return null;o.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+s.alreadyRead+" offset: "+(s.offset+s.alreadyRead-i.fileStart)+" read size: "+a+" full size: "+s.size+")"),l.memcpy(s.data.buffer,s.alreadyRead,i,s.offset+s.alreadyRead-i.fileStart,a),s.alreadyRead+=a,i.usedBytes+=a,this.stream.logBufferLevel()}},y.prototype.releaseSample=function(e,t){var i=e.samples[t];return i.data?(this.samplesDataSize-=i.size,i.data=null,i.alreadyRead=0,i.size):0},y.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},y.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},y.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(i.protection=a.ipro.protections[a.iinf.item_infos[e].protection_index-1]),a.iinf.item_infos[e].item_type?i.type=a.iinf.item_infos[e].item_type:i.type="mime",i.content_type=a.iinf.item_infos[e].content_type,i.content_encoding=a.iinf.item_infos[e].content_encoding;if(a.grpl)for(e=0;e0&&u.property_index-1-1))return null;var n=(t=this.stream.buffers[a]).byteLength-(r.offset+r.alreadyRead-t.fileStart);if(!(r.length-r.alreadyRead<=n))return o.debug("ISOFile","Getting item #"+e+" extent #"+s+" partial data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+n+" full extent size: "+r.length+" full item size: "+i.size+")"),l.memcpy(i.data.buffer,i.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,n),r.alreadyRead+=n,i.alreadyRead+=n,t.usedBytes+=n,this.stream.logBufferLevel(),null;o.debug("ISOFile","Getting item #"+e+" extent #"+s+" data (alreadyRead: "+r.alreadyRead+" offset: "+(r.offset+r.alreadyRead-t.fileStart)+" read size: "+(r.length-r.alreadyRead)+" full extent size: "+r.length+" full item size: "+i.size+")"),l.memcpy(i.data.buffer,i.alreadyRead,t,r.offset+r.alreadyRead-t.fileStart,r.length-r.alreadyRead),t.usedBytes+=r.length-r.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead+=r.length-r.alreadyRead,r.alreadyRead=r.length}}return i.alreadyRead===i.size?i:null},y.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var i=0;i0?this.moov.traks[e].samples[0].duration:0),t.push(s)}return t},u.Box.prototype.printHeader=function(e){this.size+=8,this.size>d&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},u.FullBox.prototype.printHeader=function(e){this.size+=4,u.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},u.Box.prototype.print=function(e){this.printHeader(e)},u.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},u.tkhdBox.prototype.print=function(e){u.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var A={createFile:function(e,t){var i=void 0===e||e,s=new y(t);return s.discardMdatData=!i,s}};t.createFile=A.createFile}));function $d(e){return e.reduce(((e,t)=>256*e+t))}function Wd(e){const t=[101,103,119,99],i=e.length-28,s=e.slice(i,i+t.length);return t.every(((e,t)=>e===s[t]))}Vd.Log,Vd.MP4BoxStream,Vd.DataStream,Vd.MultiBufferStream,Vd.MPEG4DescriptorParser,Vd.BoxParser,Vd.XMLSubtitlein4Parser,Vd.Textin4Parser,Vd.ISOFile,Vd.createFile;class Jd{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(i+32,i+32+t))]}return null}(t,this.t);if(!i)return e;const s=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(s instanceof Error)return console.error(s.message),this.d=!0,e;this.A=!0,this.u=i[1],Wd(t)&&this.c++,WebAssembly.instantiate(i[2],s).then((e=>{if(!function(e){return"function"==typeof e.parse&&"object"==typeof e.memory}(e.instance.exports))return this.d=!0,void console.error("video_error_3");this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}class qd extends Dd{constructor(e){super(e),this.TAG_NAME="Fmp4Loader",this.player=e,this.mp4Box=Vd.createFile(),this.tempFmp4List=[],this.offset=0,this.videoTrackId=null,this.audioTrackId=null,this.isHevc=!1,this.transportDescarmber=null,this.player._opt.isFmp4Private&&(this.transportDescarmber=new Jd),this._listenMp4Box(),e.debug.log(this.TAG_NAME,"init")}destroy(){this.mp4Box&&(this.mp4Box.stop(),this.mp4Box.flush(),this.mp4Box.destroy(),this.mp4Box=null),this.transportDescarmber&&(this.transportDescarmber.destroy(),this.transportDescarmber=null),this.tempFmp4List=[],this.offset=0,this.videoTrackId=null,this.audioTrackId=null,this.isHevc=!1,this.player.debug.log(this.TAG_NAME,"destroy")}_listenMp4Box(){this.mp4Box.onReady=this.onReady.bind(this),this.mp4Box.onError=this.onError.bind(this),this.mp4Box.onSamples=this.onSamples.bind(this)}onReady(e){this.player.debug.log(this.TAG_NAME,"onReady",e);const t=e.videoTracks[0],i=e.audioTracks[0];if(t){this.videoTrackId=t.id;const e=this.getSeqHeader(t);e&&(this.player.debug.log(this.TAG_NAME,"seqHeader",e),this._doDecodeByFmp4(e,je,0,!0,0)),this.mp4Box.setExtractionOptions(t.id)}if(i&&this.player._opt.hasAudio){this.audioTrackId=i.id;const e=i.audio||{},t=Nr.indexOf(e.sample_rate),s=i.codec.replace("mp4a.40.","");this.mp4Box.setExtractionOptions(i.id);const r={profile:parseInt(s,10),sampleRate:t,channel:e.channel_count},a=jr(r);this.player.debug.log(this.TAG_NAME,"aacADTSHeader",a,"config",r),this._doDecodeByFmp4(a,Ne,0,!1,0)}this.mp4Box.start()}onError(e){this.player.debug.error(this.TAG_NAME,"mp4Box onError",e)}onSamples(e,t,i){if(e===this.videoTrackId)for(const t of i){const i=t.data,s=t.is_sync,r=1e3*t.cts/t.timescale;t.duration,t.timescale,this.player.updateStats({vbps:i.byteLength,dts:r}),s&&this.calcIframeIntervalTimestamp(r);let a=null;a=this.isHevc?jn(i,s):kn(i,s);let o=this.cryptoPayload(a,s);this._doDecodeByFmp4(o,je,r,s,0),this.mp4Box.releaseUsedSamples(e,t.number)}else if(e===this.audioTrackId){if(this.player._opt.hasAudio)for(const t of i){const i=t.data;this.player.updateStats({abps:i.byteLength});const s=1e3*t.cts/t.timescale;t.duration,t.timescale;const r=new Uint8Array(i.byteLength+2);r.set([175,1],0),r.set(i,2),this._doDecodeByFmp4(r,Ne,s,!1,0),this.mp4Box.releaseUsedSamples(e,t.number)}}else this.player.debug.warn(this.TAG_NAME,"onSamples() trackId error",e)}getSeqHeader(e){const t=this.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new Vd.DataStream(void 0,0,Vd.DataStream.BIG_ENDIAN);let i=[];e.avcC?(e.avcC.write(t),i=[23,0,0,0,0]):(this.isHevc=!0,e.hvcC.write(t),i=[28,0,0,0,0]);const s=new Uint8Array(t.buffer,8),r=new Uint8Array(i.length+s.length);return r.set(i,0),r.set(s,i.length),r}return null}dispatch(e){let t=new Uint8Array(e);this.transportDescarmber&&(t=this.transportDescarmber.transport(t)),t.buffer.fileStart=this.offset,this.offset+=t.byteLength,this.mp4Box.appendBuffer(t.buffer)}downloadFmp4File(){const e=new Blob(this.tempFmp4List,{type:'video/mp4; codecs="avc1.640028,mp4a.40.2"'}),t=URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=aa()+".fmp4",i.click(),URL.revokeObjectURL(t)}getInputByteLength(){let e=0;return this.mp4Box&&(e=this.mp4Box.getAllocatedSampleDataSize()),e}}class Kd extends Dd{constructor(e){super(e),zd(this,"LOG_NAME","Mpeg4Loader"),this.player=e,this.player.debug.log(this.LOG_NAME,"init")}destroy(){super.destroy(),this.player.debug.log(this.LOG_NAME,"destroy")}}function Yd(){for(var e=arguments.length,t=new Array(e),i=0;ie+t.byteLength),0));let r=0;return t.forEach((e=>{s.set(e,r),r+=e.byteLength})),s}const Qd=3,Xd=4,Zd=6,eh=15,th=17,ih=129,sh=135,rh=21,ah=134,oh=27,nh=36;class lh{constructor(){this.slices=[],this.total_length=0,this.expected_length=0,this.random_access_indicator=0}}class dh{constructor(){this.pid=null,this.data=null,this.stream_type=null,this.random_access_indicator=null}}class hh{constructor(){this.pid=null,this.stream_id=null,this.len=null,this.data=null,this.pts=null,this.nearest_pts=null,this.dts=null}}const ch=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];class uh{constructor(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}isComplete(){let e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&e&&t}isSeekable(){return!0===this.hasKeyframesIndex}getNearestKeyframe(e){if(null==this.keyframesIndex)return null;let t=this.keyframesIndex,i=this._search(t.times,e);return{index:i,milliseconds:t.times[i],fileposition:t.filepositions[i]}}_search(e,t){let i=0,s=e.length-1,r=0,a=0,o=s;for(t=e[r]&&t=6?(s=5,t=new Array(4),o=r-3):(s=2,t=new Array(2),o=r):-1!==n.indexOf("android")?(s=2,t=new Array(2),o=r):(s=5,o=r,t=new Array(4),r>=6?o=r-3:1===a&&(s=2,t=new Array(2),o=r)),t[0]=s<<3,t[0]|=(15&r)>>>1,t[1]=(15&r)<<7,t[1]|=(15&a)<<3,5===s&&(t[1]|=(15&o)>>>1,t[2]=(1&o)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=ch[r],this.sampling_index=r,this.channel_count=a,this.object_type=s,this.original_object_type=i,this.codec_mimetype="mp4a.40."+s,this.original_codec_mimetype="mp4a.40."+i}}class fh extends Dd{constructor(e){super(e),this.player=e,this.TAG_NAME="TsLoaderV2",this.first_parse_=!0,this.tsPacketSize=0,this.syncOffset=0,this.pmt_=null,this.config_=null,this.media_info_=new uh,this.timescale_=90,this.duration_=0,this.pat_={version_number:0,network_pid:0,program_map_pid:{}},this.current_program_=null,this.current_pmt_pid_=-1,this.program_pmt_map_={},this.pes_slice_queues_={},this.section_slice_queues_={},this.video_metadata_={vps:null,sps:null,pps:null,details:null},this.audio_metadata_={codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},this.last_pcr_=null,this.audio_last_sample_pts_=void 0,this.aac_last_incomplete_data_=null,this.has_video_=!1,this.has_audio_=!1,this.video_init_segment_dispatched_=!1,this.audio_init_segment_dispatched_=!1,this.video_metadata_changed_=!1,this.audio_metadata_changed_=!1,this.loas_previous_frame=null,this.video_track_={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this.audio_track_={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._remainingPacketData=null,this.player.debug.log(this.TAG_NAME,"init")}destroy(){this.media_info_=null,this.pes_slice_queues_=null,this.section_slice_queues_=null,this.video_metadata_=null,this.audio_metadata_=null,this.aac_last_incomplete_data_=null,this.video_track_=null,this.audio_track_=null,this._remainingPacketData=null,super.destroy()}probe(e){let t=new Uint8Array(e),i=-1,s=188;if(t.byteLength<=3*s)return{needMoreData:!0};for(;-1===i;){let e=Math.min(1e3,t.byteLength-3*s);for(let r=0;r=4&&(i-=4),{match:!0,consumed:0,ts_packet_size:s,sync_offset:i})}_initPmt(){return{program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}}dispatch(e){let t=new Uint8Array(e);this._remainingPacketData&&(t=Yd(this._remainingPacketData,t),this._remainingPacketData=null);let i=t.buffer;const s=this.parseChunks(i);s?this._remainingPacketData=t.subarray(s):t.length>>6;i[1];let a=(31&i[1])<<8|i[2],o=(48&i[3])>>>4,n=15&i[3],l=!(!this.pmt_||this.pmt_.pcr_pid!==a),d={},h=4;if(2==o||3==o){let e=i[4];if(e>0&&(l||3==o)){if(d.discontinuity_indicator=(128&i[5])>>>7,d.random_access_indicator=(64&i[5])>>>6,d.elementary_stream_priority_indicator=(32&i[5])>>>5,(16&i[5])>>>4){let e=300*(i[6]<<25|i[7]<<17|i[8]<<9|i[9]<<1|i[10]>>>7)+((1&i[10])<<8|i[11]);this.last_pcr_=e}}if(2==o||5+e===188){t+=188,204===this.tsPacketSize&&(t+=16);continue}h=5+e}if(1==o||3==o)if(0===a||a===this.current_pmt_pid_||null!=this.pmt_&&this.pmt_.pid_stream_type[a]===ah){let i=188-h;this.handleSectionSlice(e,t+h,i,{pid:a,payload_unit_start_indicator:r,continuity_conunter:n,random_access_indicator:d.random_access_indicator})}else if(null!=this.pmt_&&null!=this.pmt_.pid_stream_type[a]){let i=188-h,s=this.pmt_.pid_stream_type[a];a!==this.pmt_.common_pids.h264&&a!==this.pmt_.common_pids.h265&&a!==this.pmt_.common_pids.adts_aac&&a!==this.pmt_.common_pids.loas_aac&&a!==this.pmt_.common_pids.ac3&&a!==this.pmt_.common_pids.eac3&&a!==this.pmt_.common_pids.opus&&a!==this.pmt_.common_pids.mp3&&!0!==this.pmt_.pes_private_data_pids[a]&&!0!==this.pmt_.timed_id3_pids[a]&&!0!==this.pmt_.synchronous_klv_pids[a]&&!0!==this.pmt_.asynchronous_klv_pids[a]||this.handlePESSlice(e,t+h,i,{pid:a,stream_type:s,payload_unit_start_indicator:r,continuity_conunter:n,random_access_indicator:d.random_access_indicator})}t+=188,204===this.tsPacketSize&&(t+=16)}return this.dispatchAudioVideoMediaSegment(),t}handleSectionSlice(e,t,i,s){let r=new Uint8Array(e,t,i),a=this.section_slice_queues_[s.pid];if(s.payload_unit_start_indicator){let o=r[0];if(null!=a&&0!==a.total_length){let r=new Uint8Array(e,t+1,Math.min(i,o));a.slices.push(r),a.total_length+=r.byteLength,a.total_length===a.expected_length?this.emitSectionSlices(a,s):this.clearSlices(a,s)}for(let n=1+o;n=a.expected_length&&this.clearSlices(a,s),n+=l.byteLength}}else if(null!=a&&0!==a.total_length){let r=new Uint8Array(e,t,Math.min(i,a.expected_length-a.total_length));a.slices.push(r),a.total_length+=r.byteLength,a.total_length===a.expected_length?this.emitSectionSlices(a,s):a.total_length>=a.expected_length&&this.clearSlices(a,s)}}handlePESSlice(e,t,i,s){let r=new Uint8Array(e,t,i),a=r[0]<<16|r[1]<<8|r[2];r[3];let o=r[4]<<8|r[5];if(s.payload_unit_start_indicator){if(1!==a)return void this.player.debug.warn(this.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${a}`);let e=this.pes_slice_queues_[s.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?this.emitPESSlices(e,s):this.clearSlices(e,s)),this.pes_slice_queues_[s.pid]=new lh,this.pes_slice_queues_[s.pid].random_access_indicator=s.random_access_indicator}if(null==this.pes_slice_queues_[s.pid])return;let n=this.pes_slice_queues_[s.pid];n.slices.push(r),s.payload_unit_start_indicator&&(n.expected_length=0===o?0:o+6),n.total_length+=r.byteLength,n.expected_length>0&&n.expected_length===n.total_length?this.emitPESSlices(n,s):n.expected_length>0&&n.expected_length>>6,n=t[8];2!==o&&3!==o||(i=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,a=3===o?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:i);let l,d=9+n;if(0!==r){if(r<3+n)return void this.player.debug.warn(this.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");l=r-3-n}else l=t.byteLength-d;let h=t.subarray(d,d+l);switch(e.stream_type){case Qd:case Xd:this.parseMP3Payload(h,i);break;case Zd:this.pmt_.common_pids.opus===e.pid?this.parseOpusPayload(h,i):this.pmt_.common_pids.ac3===e.pid?this.parseAC3Payload(h,i):this.pmt_.common_pids.eac3===e.pid?this.parseEAC3Payload(h,i):this.pmt_.asynchronous_klv_pids[e.pid]?this.parseAsynchronousKLVMetadataPayload(h,e.pid,s):this.pmt_.smpte2038_pids[e.pid]?this.parseSMPTE2038MetadataPayload(h,i,a,e.pid,s):this.parsePESPrivateDataPayload(h,i,a,e.pid,s);break;case eh:this.parseADTSAACPayload(h,i);break;case th:this.parseLOASAACPayload(h,i);break;case ih:this.parseAC3Payload(h,i);break;case sh:this.parseEAC3Payload(h,i);break;case rh:this.pmt_.timed_id3_pids[e.pid]?this.parseTimedID3MetadataPayload(h,i,a,e.pid,s):this.pmt_.synchronous_klv_pids[e.pid]&&this.parseSynchronousKLVMetadataPayload(h,i,a,e.pid,s);break;case oh:this.parseH264Payload(h,i,a,e.random_access_indicator);break;case nh:this.parseH265Payload(h,i,a,e.random_access_indicator)}}else if((188===s||191===s||240===s||241===s||255===s||242===s||248===s)&&e.stream_type===Zd){let i,a=6;i=0!==r?r:t.byteLength-a;let o=t.subarray(a,a+i);this.parsePESPrivateDataPayload(o,void 0,void 0,e.pid,s)}}else this.player.debug.error(this.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${i}`)}parsePAT(e){let t=e[0];if(0!==t)return void Log.e(this.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let i=(15&e[1])<<8|e[2];e[3],e[4];let s=(62&e[5])>>>1,r=1&e[5],a=e[6];e[7];let o=null;if(1===r&&0===a)o={version_number:0,network_pid:0,program_pmt_pid:{}},o.version_number=s;else if(o=this.pat_,null==o)return;let n=i-5-4,l=-1,d=-1;for(let t=8;t<8+n;t+=4){let i=e[t]<<8|e[t+1],s=(31&e[t+2])<<8|e[t+3];0===i?o.network_pid=s:(o.program_pmt_pid[i]=s,-1===l&&(l=i),-1===d&&(d=s))}1===r&&0===a&&(null==this.pat_&&this.player.debug.log(this.TAG_NAME,`Parsed first PAT: ${JSON.stringify(o)}`),this.pat_=o,this.current_program_=l,this.current_pmt_pid_=d)}parsePMT(e){let t=e[0];if(2!==t)return void this.player.debug.error(this.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let i,s=(15&e[1])<<8|e[2],r=e[3]<<8|e[4],a=(62&e[5])>>>1,o=1&e[5],n=e[6];if(e[7],1===o&&0===n)i=this._initPmt(),i.program_number=r,i.version_number=a,this.program_pmt_map_[r]=i;else if(i=this.program_pmt_map_[r],null==i)return;i.pcr_pid=(31&e[8])<<8|e[9];let l=(15&e[10])<<8|e[11],d=12+l,h=s-9-l-4;for(let t=d;t0){for(let s=t+5;s0)for(let s=t+5;s1&&(this.player.debug.warn(this.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${s}ms`),s=e)}}let r,a=new Qr(e),o=null,n=s;for(;null!=(o=a.readNextAACFrame());){i=1024/o.sampling_frequency*1e3;const e={codec:"aac",data:o};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:o.audio_object_type,sampling_freq_index:o.sampling_freq_index,sampling_frequency:o.sampling_frequency,channel_config:o.channel_config},this.dispatchAudioInitSegment(e)):this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)),r=n;let t=Math.floor(n);const s=new Uint8Array(o.data.length+2);s.set([175,1],0),s.set(o.data,2);let a={payload:s,length:s.byteLength,pts:t,dts:t,type:Ne};this.audio_track_.samples.push(a),this.audio_track_.length+=s.byteLength,n+=i}a.hasIncompleteData()&&(this.aac_last_incomplete_data_=a.getIncompleteData()),r&&(this.audio_last_sample_pts_=r)}parseLOASAACPayload(e,t){if(this.has_video_&&!this.video_init_segment_dispatched_)return;if(this.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+this.aac_last_incomplete_data_.byteLength);t.set(this.aac_last_incomplete_data_,0),t.set(e,this.aac_last_incomplete_data_.byteLength),e=t}let i,s;if(null!=t&&(s=t/this.timescale_),"aac"===this.audio_metadata_.codec){if(null==t&&null!=this.audio_last_sample_pts_)i=1024/this.audio_metadata_.sampling_frequency*1e3,s=this.audio_last_sample_pts_+i;else if(null==t)return void this.player.debug.warn(this.TAG_NAME,"AAC: Unknown pts");if(this.aac_last_incomplete_data_&&this.audio_last_sample_pts_){i=1024/this.audio_metadata_.sampling_frequency*1e3;let e=this.audio_last_sample_pts_+i;Math.abs(e-s)>1&&(this.player.debug.warn(this.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${s}ms`),s=e)}}let r,a=new Xr(e),o=null,n=s;for(;null!=(o=a.readNextAACFrame(La(this.loas_previous_frame)?void 0:this.loas_previous_frame));){this.loas_previous_frame=o,i=1024/o.sampling_frequency*1e3;const e={codec:"aac",data:o};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"aac",audio_object_type:o.audio_object_type,sampling_freq_index:o.sampling_freq_index,sampling_frequency:o.sampling_frequency,channel_config:o.channel_config},this.dispatchAudioInitSegment(e)):this.detectAudioMetadataChange(e)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(e)),r=n;let t=Math.floor(n);const s=new Uint8Array(o.data.length+2);s.set([175,1],0),s.set(o.data,2);let a={payload:s,length:s.byteLength,pts:t,dts:t,type:Ne};this.audio_track_.samples.push(a),this.audio_track_.length+=s.byteLength,n+=i}a.hasIncompleteData()&&(this.aac_last_incomplete_data_=a.getIncompleteData()),r&&(this.audio_last_sample_pts_=r)}parseAC3Payload(e,t){}parseEAC3Payload(e,t){}parseOpusPayload(e,t){}parseMP3Payload(e,t){if(this.has_video_&&!this.video_init_segment_dispatched_)return;let i=[44100,48e3,32e3,0],s=[22050,24e3,16e3,0],r=[11025,12e3,8e3,0],a=e[1]>>>3&3,o=(6&e[1])>>1;e[2];let n=(12&e[2])>>>2,l=3!==(e[3]>>>6&3)?2:1,d=0,h=34;switch(a){case 0:d=r[n];break;case 2:d=s[n];break;case 3:d=i[n]}switch(o){case 1:h=34;break;case 2:h=33;break;case 3:h=32}const c={};c.object_type=h,c.sample_rate=d,c.channel_count=l,c.data=e;const u={codec:"mp3",data:c};0==this.audio_init_segment_dispatched_?(this.audio_metadata_={codec:"mp3",object_type:h,sample_rate:d,channel_count:l},this.dispatchAudioInitSegment(u)):this.detectAudioMetadataChange(u)&&(this.dispatchAudioMediaSegment(),this.dispatchAudioInitSegment(u));let p={payload:e,length:e.byteLength,pts:t/this.timescale_,dts:t/this.timescale_,type:Ne};this.audio_track_.samples.push(p),this.audio_track_.length+=e.byteLength}detectAudioMetadataChange(e){if(e.codec!==this.audio_metadata_.codec)return this.player.debug.log(this.TAG_NAME,`Audio: Audio Codecs changed from ${this.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===this.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==this.audio_metadata_.audio_object_type)return this.player.debug.log(this.TAG_NAME,`AAC: AudioObjectType changed from ${this.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==this.audio_metadata_.sampling_freq_index)return this.player.debug.log(this.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${this.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==this.audio_metadata_.channel_config)return this.player.debug.log(this.TAG_NAME,`AAC: Channel configuration changed from ${this.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===this.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==this.audio_metadata_.sampling_frequency)return this.player.debug.log(this.TAG_NAME,`AC3: Sampling Frequency changed from ${this.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==this.audio_metadata_.bit_stream_identification)return this.player.debug.log(this.TAG_NAME,`AC3: Bit Stream Identification changed from ${this.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==this.audio_metadata_.bit_stream_mode)return this.player.debug.log(this.TAG_NAME,`AC3: BitStream Mode changed from ${this.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==this.audio_metadata_.channel_mode)return this.player.debug.log(this.TAG_NAME,`AC3: Channel Mode changed from ${this.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==this.audio_metadata_.low_frequency_effects_channel_on)return this.player.debug.log(this.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${this.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===this.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==this.audio_metadata_.sample_rate)return this.player.debug.log(this.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==this.audio_metadata_.channel_count)return this.player.debug.log(this.TAG_NAME,`Opus: Channel count changed from ${this.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===this.audio_metadata_.codec){const t=e.data;if(t.object_type!==this.audio_metadata_.object_type)return this.player.debug.log(this.TAG_NAME,`MP3: AudioObjectType changed from ${this.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==this.audio_metadata_.sample_rate)return this.player.debug.log(this.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${this.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==this.audio_metadata_.channel_count)return this.player.debug.log(this.TAG_NAME,`MP3: Channel count changed from ${this.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1}dispatchAudioInitSegment(e){let t={type:"audio"};t.id=this.audio_track_.id,t.timescale=1e3,t.duration=this.duration_;let i="";if("aac"===this.audio_metadata_.codec){let s="aac"===e.codec?e.data:null,r=new ph(s);t.audioSampleRate=r.sampling_rate,t.audioSampleRateIndex=r.sampling_index,t.channelCount=r.channel_count,t.codec=r.codec_mimetype,t.originalCodec=r.original_codec_mimetype,t.config=r.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale,i=Et;const a=jr({profile:this.player._opt.mseDecodeAudio?r.object_type:r.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});console.error("aacADTSHeader",`profile: ${r.object_type}, sampleRate: ${t.audioSampleRateIndex}, channel: ${t.channelCount}`),this._doDecodeByTs(a,Ne,0,!1,0)}else"ac-3"===this.audio_metadata_.codec||"ec-3"===this.audio_metadata_.codec||"opus"===this.audio_metadata_.codec||"mp3"===this.audio_metadata_.codec&&(t.audioSampleRate=this.audio_metadata_.sample_rate,t.channelCount=this.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0,i=Tt);0==this.audio_init_segment_dispatched_&&this.player.debug.log(this.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),this.audio_init_segment_dispatched_=!0,this.video_metadata_changed_=!1;let s=this.media_info_;s.hasAudio=!0,s.audioCodec=t.originalCodec,s.audioSampleRate=t.audioSampleRate,s.audioChannelCount=t.channelCount,s.hasVideo&&s.videoCodec?s.mimeType=`video/mp2t; codecs="${s.videoCodec},${s.audioCodec}"`:s.mimeType=`video/mp2t; codecs="${s.audioCodec}"`,i&&this.player.audio.updateAudioInfo({encTypeCode:i,channels:t.channelCount,sampleRate:t.audioSampleRate})}dispatchPESPrivateDataDescriptor(e,t,i){}parsePESPrivateDataPayload(e,t,i,s,r){let a=new hh;if(a.pid=s,a.stream_id=r,a.len=e.byteLength,a.data=e,null!=t){let e=Math.floor(t/this.timescale_);a.pts=e}else a.nearest_pts=this.getNearestTimestampMilliseconds();if(null!=i){let e=Math.floor(i/this.timescale_);a.dts=e}}parseTimedID3MetadataPayload(e,t,i,s,r){this.player.debug.log(this.TAG_NAME,`Timed ID3 Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}parseSynchronousKLVMetadataPayload(e,t,i,s,r){this.player.debug.log(this.TAG_NAME,`Synchronous KLV Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}parseAsynchronousKLVMetadataPayload(e,t,i){this.player.debug.log(this.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${i}`)}parseSMPTE2038MetadataPayload(e,t,i,s,r){this.player.debug.log(this.TAG_NAME,`SMPTE 2038 Metadata: pid=${s}, pts=${t}, dts=${i}, stream_id=${r}`)}getNearestTimestampMilliseconds(){if(null!=this.audio_last_sample_pts_)return Math.floor(this.audio_last_sample_pts_);if(null!=this.last_pcr_){return Math.floor(this.last_pcr_/300/this.timescale_)}}_preDoDecode(){const e=this.video_track_,t=this.audio_track_;let i=e.samples;t.samples.length>0&&(i=e.samples.concat(t.samples),i=i.sort(((e,t)=>e.dts-t.dts))),i.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===je?this._doDecodeVideo({...e,payload:t}):e.type===Ne&&this._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?jn(t,e.isIFrame):kn(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength}),e.isIFrame&&this.calcIframeIntervalTimestamp(e.dts);let s=this.cryptoPayload(i,e.isIFrame);this._doDecodeByTs(s,je,e.dts,e.isIFrame,e.cts)}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength});let i=t;uo(this.player._opt.m7sCryptoAudio)&&(i=this.cryptoPayloadAudio(t)),this._doDecodeByTs(i,Ne,e.dts,!1,0)}getInputByteLength(){return this._remainingPacketData&&this._remainingPacketData.byteLength||0}}class mh{constructor(e){return new(mh.getLoaderFactory(e))(e)}static getLoaderFactory(e){const t=e._opt.demuxType;return t===k?Fd:t===T||e.isWebrtcH265()?Ud:t===R?Od:t===D?Gd:t===L?qd:t===P?Kd:t===I?fh:Hd}}class gh extends So{constructor(e){super(),this.player=e,this.TAG_NAME="Webcodecs",this.hasInit=!1,this.isDecodeFirstIIframe=!!po(e._opt.checkFirstIFrame),this.isInitInfo=!1,this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.decoder=null,this.isWidthOrHeightChanged=!1,this.initDecoder(),e.debug.log(this.TAG_NAME,"init")}destroy(){this.decoder&&(po(this.isDecodeStateClosed())&&this.decoder.close(),this.decoder=null),this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.hasInit=!1,this.isInitInfo=!1,this.isDecodeFirstIIframe=!1,this.isWidthOrHeightChanged=!1,this.off(),this.player.debug.log(this.TAG_NAME,"destroy")}initDecoder(){const e=this;this.decoder=new VideoDecoder({output(t){e.handleDecode(t)},error(t){e.handleError(t)}})}handleDecode(e){this.isInitInfo||(this.player.video.updateVideoInfo({width:e.codedWidth,height:e.codedHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0),this.player.isPlayer()?(this.player.updateStats({dfps:!0}),this.player._times.videoStart||(this.player._times.videoStart=aa(),this.player.handlePlayToRenderTimes()),this.player.video.render({videoFrame:e,ts:e.timestamp}),this.player.handleRender()):this.player.isPlayback()&&(this.player.updateStats({dfps:!0}),po(this.player.playbackPause)?(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this.player.playback.isUseFpsRender?this.player.video.pushData({videoFrame:e,ts:e.timestamp}):this.player.video.render$2({videoFrame:e,ts:e.timestamp})):po(this.player.playback.isPlaybackPauseClearCache)&&this.player.playback.isCacheBeforeDecodeForFpsRender&&this.player.playback.isUseFpsRender&&this.player.video.pushData({videoFrame:e,ts:e.timestamp}))}handleError(e){this.player.debug.error(this.TAG_NAME,"VideoDecoder handleError:",e.code,e);const t=e.toString();-1!==t.indexOf(ls)?this.player.emitError(ct.webcodecsUnsupportedConfigurationError,t):-1!==t.indexOf(ds)||-1!==t.indexOf(hs)||-1!==t.indexOf(cs)?this.player.emitError(ct.webcodecsDecodeError,t):-1!==t.indexOf(us)&&this.player.emitError(ct.webcodecsH265NotSupport)}decodeVideo(e,t,i,s){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debug.warn(this.TAG_NAME,"decodeVideo() player is destroyed");else if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(this.isDecodeStateClosed())return void this.player.debug.warn(this.TAG_NAME,"VideoDecoder isDecodeStateClosed true");if(i&&0===e[1]){const t=15&e[0];let i={};if(t===vt){i=En(e.slice(5))}else t===_t&&(i=Un(e));const s=this.player.video.videoInfo;s&&s.width&&s.height&&i&&i.codecWidth&&i.codecHeight&&(i.codecWidth!==s.width||i.codecHeight!==s.height)&&(this.player.debug.warn(this.TAG_NAME,`decodeVideo: video width or height is changed,\n old width is ${s.width}, old height is ${s.height},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),this.isWidthOrHeightChanged=!0,this.player.emitError(ct.wcsWidthOrHeightChange))}if(this.isWidthOrHeightChanged)return void this.player.debug.warn(this.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(co(e))return void this.player.debug.warn(this.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength<12)return void this.player.debug.warn(this.TAG_NAME,`decodeVideo and payload is too small , payload length is ${e.byteLength}`);let s=!1,r=(new Date).getTime();this.prevTimestamp||(this.prevTimestamp=r,s=!0);const a=r-this.prevTimestamp;this.decodeDiffTimestamp=a,a>500&&!s&&this.player.isPlayer()&&this.player.debug.warn(this.TAG_NAME,"decodeVideo diff time is ",a);const o=e.slice(5),n=new EncodedVideoChunk({data:o,timestamp:t,type:i?li:di});this.player.emit(nt.timeUpdate,t);try{this.decoder.decode(n)}catch(e){this.player.debug.error(this.TAG_NAME,"VideoDecoder",e);const t=e.toString();(-1!==t.indexOf(os)||-1!==t.indexOf(ns))&&this.player.emitError(ct.webcodecsDecodeError)}this.prevTimestamp=(new Date).getTime()}else this.player.debug.log(this.TAG_NAME,"VideoDecoder first frame is not iFrame");else if(i&&e[1]===vs){const t=15&e[0];if(this.player.video.updateVideoInfo({encTypeCode:t}),t===_t&&!Ca()){const e=ga();return this.player.debug.warn(this.TAG_NAME,"WebcodecsDecoder not support hevc decode",e.type,e.version),void this.player.emitError(ct.webcodecsH265NotSupport)}this.player._times.decodeStart||(this.player._times.decodeStart=aa());let i=null,s=null;const r=e.slice(5);if(t===vt?(s=En(r),i={codec:s.codec,description:r}):t===_t&&(s=Fn(r),i={codec:s.codec,description:r}),!i||i&&!i.codec)return this.player.debug.warn(this.TAG_NAME,"decodeVideo and webcodecs configure is",JSON.stringify(i)),void this.player.emitError(ct.webcodecsDecodeConfigureError);s&&s.codecWidth&&s.codecHeight&&(i.codedHeight=s.codecHeight,i.codedWidth=s.codecWidth),this.player.recorder&&this.player._opt.recordType===S&&this.player.recorder.initMetaData(e,t),this.player.debug.log(this.TAG_NAME,`decoder.configure() and codec is ${i.codec}`);try{this.decoder.configure(i),this.hasInit=!0}catch(e){this.player.debug.log(this.TAG_NAME,"configure error",e.code,e);-1!==e.toString().indexOf(us)?this.player.emitError(ct.webcodecsH265NotSupport):this.player.emitError(ct.webcodecsDecodeConfigureError)}}}getDecodeDiffTimes(){return this.decodeDiffTimestamp}isDecodeStateClosed(){return"closed"===this.decoder.state}isDecodeStateConfigured(){return"configured"===this.decoder.state}isDecodeStateUnConfigured(){return"unconfigured"===this.decoder.state}}const yh={play:"播放",pause:"暂停",audio:"",mute:"",screenshot:"截图",loading:"",fullscreen:"全屏",fullscreenExit:"退出全屏",record:"录制",recordStop:"停止录制",narrow:"缩小",expand:"放大",ptz:"操作盘",ptzActive:"操作盘激活",zoom:"电子放大",zoomStop:"关闭电子放大",close:"关闭",performance:"性能面板",performanceActive:"性能面板激活",face:"人脸识别",faceActive:"人脸识别激活",object:"物品识别",objectActive:"物品识别激活",occlusion:"遮挡物检查",occlusionActive:"遮挡物检查激活",logSave:"保存日志"};var Ah=Object.keys(yh).reduce(((e,t)=>(e[t]=`\n \n ${yh[t]?`${yh[t]}`:""}\n`,e)),{});function bh(e,t){let i=!1;return e.forEach((e=>{i||e.startTimestamp<=t&&e.endTimestamp>t&&(i=!0)})),i}function vh(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=e.length,r=t.length,a=Math.max(s,r),o=2e3,n=Math.ceil(a/o);let l=0,d=0;function h(){let r="",a="";for(let i=0;i\n ${i.title}\n \n `);const o=t[d];o&&(a+=`\n

${o.title}
\n `),d+=1}r&&i.$playbackTimeListOne.insertAdjacentHTML("beforeend",r),a&&i.$playbackTimeListSecond.insertAdjacentHTML("beforeend",a),l+=1,l0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<1440;s++){const r=s%60==0;let a=!1;i&&(a=bh(e,ja(i,s))),t.push({title:Oa(s),timestamp:s,dataType:"min",hasRecord:a,isStart:r})}return t}(e);vh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0})}return e}(),t)}function Sh(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<1440;s++){let r=60*s,a=r%1800==0,o=!1;i&&(o=bh(e,za(i,r))),t.push({title:Na(r),timestamp:r,dataType:"second",hasRecord:o,isStart:a});let n=60*s+30;a=n%1800==0,i&&(o=bh(e,za(i,n))),t.push({title:Na(n),timestamp:n,dataType:"second",hasRecord:o,isStart:a})}return t}(e);vh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00",s=t+":30";t<10&&(i="0"+i,s="0"+s),e.push({title:i,hour:t,min:0,second:0}),e.push({title:s,hour:t,min:30,second:0})}return e}(),t)}function wh(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<144;s++)for(let r=0;r<60;r++){let a=10*r+600*s,o=a%600==0,n=!1;i&&(n=bh(e,za(i,a))),t.push({title:Na(a),timestamp:a,dataType:"second",isStart:o,hasRecord:n})}return t}(e);vh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0});for(let s=1;s<6;s++){let r=s+"0";e.push({title:i.replace(":00",":"+r),hour:t,min:10*s,second:0})}}return e}(),t)}function Eh(e,t){const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=[];const i=(e[0]||{}).startTimestamp;for(let s=0;s<288;s++)for(let r=0;r<60;r++){let a=5*r+300*s,o=a%300==0,n=!1;i&&(n=bh(e,za(i,a))),t.push({title:Na(a),timestamp:a,dataType:"second",isStart:o,hasRecord:n})}return t}(e);vh(i,function(){let e=[];for(let t=0;t<24;t++){let i=t+":00";t<10&&(i="0"+i),e.push({title:i,hour:t,min:0,second:0}),e.push({title:i.replace(":00",":05"),hour:t,min:5,second:0});for(let s=1;s<6;s++){let r=s+"0",a=s+"5";e.push({title:i.replace(":00",":"+r),hour:t,min:10*s,second:0}),e.push({title:i.replace(":00",":"+a),hour:t,min:10*s+5,second:0})}}return e}(),t)}function Th(e){const t=Math.floor(e/3600),i=Math.floor((e-3600*t)/60),s=Math.floor(e-3600*t-60*i);return(t>0?[t,i,s]:[i,s]).map((e=>e<10?`0${e}`:String(e))).join(":")}function kh(e,t,i){const s=e.$playbackProgress,{left:r}=s.getBoundingClientRect(),a=oa((ua()?i.touches[0].clientX:i.pageX)-r,0,s.clientWidth),o=parseInt(a/s.clientWidth*t,10);return{second:o,time:Th(o),width:a,percentage:oa(a/s.clientWidth,0,1)}}function Ch(e,t){return e.classList.add(t)}function xh(e,t){return t instanceof Element?e.appendChild(t):e.insertAdjacentHTML("beforeend",String(t)),e.lastElementChild||e.lastChild}function Rh(e,t,i){return e&&e.style&&Ba(t)&&(e.style[t]=i),e}function Dh(e,t){return e.composedPath&&e.composedPath().indexOf(t)>-1}function Lh(e){let t=!1;return e&&e.parentNode&&(e.parentNode.removeChild(e),t=!0),t}var Ph=(e,t)=>{const{events:{proxy:i}}=e,s=document.createElement("object");s.setAttribute("aria-hidden","true"),s.setAttribute("tabindex",-1),s.type="text/html",s.data="about:blank",na(s,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"});let r=e.width,a=e.height;const o=wa((()=>{e.width===r&&e.height===a||(r=e.width,a=e.height,e.emit(nt.resize),c())}),500);i(s,"load",(()=>{i(s.contentDocument.defaultView,"resize",(()=>{o()}))})),e.$container.appendChild(s),e.on(nt.destroy,(()=>{e.$container.removeChild(s)})),e.on(nt.volumechange,(()=>{!function(e){if(0===e)na(t.$volumeOn,"display","none"),na(t.$volumeOff,"display","flex"),na(t.$volumeHandle,"top","48px");else if(t.$volumeHandle&&t.$volumePanel){const i=la(t.$volumePanel,"height")||60,s=la(t.$volumeHandle,"height"),r=i-(i-s)*e-s;na(t.$volumeHandle,"top",`${r}px`),na(t.$volumeOn,"display","flex"),na(t.$volumeOff,"display","none")}t.$volumePanelText&&(t.$volumePanelText.innerHTML=parseInt(100*e))}(e.volume)})),e.on(nt.loading,(i=>{na(t.$loading,"display",i?"flex":"none"),(po(e._opt.backgroundLoadingShow)&&uo(i)||po(i))&&na(t.$poster,"display","none"),i&&(na(t.$playBig,"display","none"),na(t.$tipsMessage,"display","none")),i||e._opt.extendDomConfig.showAfterLoading&&t.$extendDom&&na(t.$extendDom,"display","block"),i||e.getRenderType()===$&&po(e._opt.useMSE)&&n()})),e.on(nt.removeLoadingBgImage,(()=>{n()}));const n=()=>{t.$loadingBgImage&&t.$loadingBg&&t.$loadingBgImage.src&&(e.debug&&e.debug.log("Control","remove loading bg image"),t.$loadingBgImage.width=0,t.$loadingBgImage.height=0,t.$loadingBgImage.src="",na(t.$loadingBg,"display","none"))},l=t=>{e.fullscreen?qa(t)===e.$container&&d():d()},d=i=>{let s=Pa(i)?i:e.fullscreen;na(t.$fullscreenExit,"display",s?"flex":"none"),na(t.$fullscreen,"display",s?"none":"flex")},h=()=>e._opt.playType===_&&e._opt.playbackConfig.showControl,c=i=>{ua()&&t.$controls&&e._opt.useWebFullScreen&&setTimeout((()=>{if(e.fullscreen){const i=h()?Yt:Kt;let s=e.height/2-e.width+i/2,r=e.height/2-i/2;if(t.$controls.style.transform=`translateX(${-s}px) translateY(-${r}px) rotate(-90deg)`,t.$zoomControls){const i=156,s=30,r=e.width/2+i/2-s/2;t.$zoomControls.style.transform=`translateX(${-r}px) translateY(${e.height/2}px) rotate(-90deg)`}if(t.$recording){const i=101,s=20,r=e.width/2+i/2-s/2;t.$recording.style.transform=`translateX(${-r}px) translateY(${e.height/2}px) rotate(-90deg)`}}else t.$controls.style.transform="translateX(0) translateY(0) rotate(0)",t.$zoomControls&&(t.$zoomControls.style.transform="translateX(-50%) translateY(0) rotate(0)"),t.$recording&&(t.$recording.style.transform="translateX(-50%) translateY(0) rotate(0)");i&&i()}),10)};try{Mr.on("change",l),e.events.destroys.push((()=>{Mr.off("change",l)}))}catch(e){}e.on(nt.webFullscreen,(e=>{ua()&&(d(e),c((()=>{p()})))})),e.on(nt.recording,(()=>{e.playing&&(na(t.$record,"display",e.recording?"none":"flex"),na(t.$recordStop,"display",e.recording?"flex":"none"),(e._opt.hasControl||e._opt.isShowRecordingUI)&&(na(t.$recording,"display",e.recording?"flex":"none"),po(e.recording)&&t.$recordingTime&&(t.$recordingTime.innerHTML=Fa(0))))})),e.on(nt.recordingTimestamp,(e=>{t.$recordingTime&&(t.$recordingTime.innerHTML=Fa(e))})),e.on(nt.zooming,(()=>{e.playing&&(na(t.$zoom,"display",e.zooming?"none":"flex"),na(t.$zoomStop,"display",e.zooming?"flex":"none"),(e._opt.hasControl||e._opt.isShowZoomingUI)&&na(t.$zoomControls,"display",e.zooming?"flex":"none"))})),e.on(nt.playing,(e=>{u(e)}));const u=i=>{i||e.isPlayFailedAndPaused&&po(e._opt.playFailedAndPausedShowPlayBtn)?(na(t.$play,"display","none"),na(t.$playBig,"display","none")):(na(t.$play,"display","flex"),na(t.$playBig,"display","block")),na(t.$pause,"display",i?"flex":"none"),na(t.$screenshot,"display",i?"flex":"none"),na(t.$record,"display",i?"flex":"none"),na(t.$qualityMenu,"display",i?"flex":"none"),na(t.$volume,"display",i?"flex":"none"),na(t.$ptz,"display",i?"flex":"none"),na(t.$zoom,"display",i?"flex":"none"),na(t.$scaleMenu,"display",i?"flex":"none"),na(t.$faceDetect,"display",i?"flex":"none"),na(t.$objectDetect,"display",i?"flex":"none"),na(t.$occlusionDetect,"display",i?"flex":"none"),na(t.$controlHtml,"display",i?"flex":"none"),e.isPlayback()&&na(t.$speedMenu,"display",i?"flex":"none"),d(),t.extendBtnList.forEach((e=>{e.$iconWrap&&na(e.$iconWrap,"display",i?"flex":"none"),e.$activeIconWrap&&na(e.$activeIconWrap,"display","none")})),e._opt.showPerformance?na(t.$performanceActive,"display",i?"flex":"none"):(na(t.$performance,"display",i?"flex":"none"),na(t.$performanceActive,"display","none")),na(t.$poster,"display","none"),na(t.$ptzActive,"display","none"),na(t.$recordStop,"display","none"),na(t.$zoomStop,"display","none"),na(t.$faceDetectActive,"display","none"),na(t.$objectDetectActive,"display","none"),i||(t.$speed&&(t.$speed.innerHTML=function(e){if(null==e||""===e)return"0 KB/s";let t=parseFloat(e);return t=t.toFixed(2),t+"KB/s"}("")),na(t.$zoomControls,"display","none"),na(t.$recording,"display","none"),t.$ptzControl&&t.$ptzControl.classList.remove("jb-pro-ptz-controls-show")),p(),i&&f()};e.on(nt.playbackPause,(e=>{u(!e)})),e.on(nt.kBps,(i=>{const s=function(e){if(null==e||""===e||0===parseFloat(e)||"NaN"===e)return"0 KB/s";const t=["KB/s","MB/s","GB/s","TB/s","PB/s","EB/s","ZB/s","YB/s"];let i=0;const s=parseFloat(e);i=Math.floor(Math.log(s)/Math.log(1024));let r=s/Math.pow(1024,i);return r=r.toFixed(2),r+(t[i]||t[0])}(i);t.kbpsShow=s,e._opt.showBandwidth&&(t.$speed&&(t.$speed.innerHTML=s),p())}));const p=()=>{if(h()&&e._opt.playbackConfig.controlType===Q.normal){let i=t.controlsInnerRect.width-t.controlsLeftRect.width-t.controlsRightRect.width-t.controlsPlaybackBtnsRect.width;ua()&&e.webFullscreen&&(i=t.controlsInnerRect.height-t.controlsLeftRect.height-t.controlsRightRect.height-t.controlsPlaybackBtnsRect.height),t.$playbackTimeInner.style.width=i+"px"}},f=()=>{if(!h()||e._opt.playbackConfig.controlType!==Q.normal)return;const i=t.$playbackCurrentTime.style.left;let s=parseInt(i,10);const r=t.controlsPlaybackTimeInner.width;s=s-r/2>0?parseInt(s-r/2,10):0,t.$playbackTimeInner.scrollLeft=s};if(h()){const i=()=>{if(h()){let i=0;const s=e.playback&&e.playback.playingTimestamp;if(s){const r=new Date(s),a=r.getHours(),o=r.getMinutes(),n=r.getSeconds();e.playback.is60Min?i=60*a+o:e.playback.is30Min?i=2*(60*a+o)+parseInt(n/30,10):e.playback.is10Min?i=6*(60*a+o)+parseInt(n/10,10):e.playback.is5Min?i=12*(60*a+o)+parseInt(n/5,10):e.playback.is1Min&&(i=60*(60*a+o)+parseInt(n,10)),t.$playbackCurrentTime.style.left=i+"px"}}},s=e=>{t.$playbackNarrow.classList.remove("disabled"),t.$playbackExpand.classList.remove("disabled"),e===Si&&t.$playbackNarrow.classList.add("disabled"),e===Ti&&t.$playbackExpand.classList.add("disabled")};e.on(nt.playbackTime,(s=>{if(e._opt.playbackConfig.controlType===Q.normal)t.$playbackCurrentTimeText&&(t.$playbackCurrentTimeText.innerText=ba(s,"{h}:{i}:{s}")),i();else if(e._opt.playbackConfig.controlType===Q.simple){const i=(r=s,a=e.playback.totalDuration,oa(r/a,0,1));t.$playbackProgressPlayed.style.width=100*i+"%",t.$playbackProgressIndicator.style.left=`calc(${100*i}% - 7px)`,t.$playbackProgressTime.innerText=`${Th(s)} / ${Th(e.playback.totalDuration)}`}var r,a})),e.on(nt.playbackPrecision,((r,a)=>{h()&&e._opt.playbackConfig.controlType===Q.normal&&(t.$playbackTimeScroll.classList.remove(ki.oneHour,ki.halfHour,ki.fiveMin,ki.tenMin),t.$playbackTimeScroll.classList.add(ki[r]),t.rafId&&(window.cancelAnimationFrame(t.rafId),t.rafId=null),t.changePercisitionInterval&&(clearTimeout(t.changePercisitionInterval),t.changePercisitionInterval=null),t.$playbackTimeListOne.innerHTML="",t.$playbackTimeListSecond.innerHTML="",t.changePercisitionInterval=setTimeout((()=>{switch(t.$playbackTimeListOne.innerHTML="",t.$playbackTimeListSecond.innerHTML="",r){case Si:_h(a,t);break;case wi:Sh(a,t);break;case Ei:wh(a,t);break;case Ti:Eh(a,t)}i(),e._opt.playbackConfig.showPrecisionBtn&&s(r),f()}),16))})),e.on(nt.resize,(()=>{p()})),e.on(nt.playbackTimeScroll,(()=>{f()})),p()}if(e._opt.operateBtns.quality&&e._opt.qualityConfig.length>0){e.on(nt.streamQualityChange,(e=>{i(e)}));const i=e=>{t.$qualityText.innerText=e,t.$qualityMenuItems.forEach((t=>{const i=t.dataset.quality;t.classList.remove("jb-pro-quality-menu-item-active"),i===e&&t.classList.add("jb-pro-quality-menu-item-active")}))};(()=>{const i=e._opt.qualityConfig||[];let s="";i.forEach((e=>{s+=`\n
${e}
\n `})),s&&(t.$qualityMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$qualityMenuItems",{value:e.$container.querySelectorAll(".jb-pro-quality-menu-item")}))})(),e.streamQuality&&i(e.streamQuality)}if(e._opt.operateBtns.scale&&e._opt.scaleConfig.length>0){e.on(nt.viewResizeChange,(e=>{i(e)}));const i=i=>{const s=e._opt.scaleConfig[i];t.$scaleText.innerText=s,t.$scaleMenuItems.forEach((e=>{const t=e.dataset.scale;e.classList.remove("jb-pro-scale-menu-item-active"),_a(t)===_a(i)&&e.classList.add("jb-pro-scale-menu-item-active")}))};(()=>{const i=e._opt.scaleConfig||[];let s="";i.forEach(((e,t)=>{s+=`\n
${e}
\n `})),s&&(t.$scaleMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$scaleMenuItems",{value:e.$container.querySelectorAll(".jb-pro-scale-menu-item")}))})(),i(e.scaleType)}if(e.isPlayback()&&e._opt.playbackConfig.showRateBtn&&e._opt.playbackConfig.rateConfig.length>0){e.on(nt.playbackRateChange,(e=>{i(e)}));const i=i=>{const s=e._opt.playbackConfig.rateConfig.find((e=>_a(e.value)===_a(i)));s&&(t.$speedText.innerText=s.label,t.$speedMenuItems.forEach((e=>{const t=e.dataset.speed;e.classList.remove("jb-pro-speed-menu-item-active"),_a(t)===_a(i)&&e.classList.add("jb-pro-speed-menu-item-active")})))};(()=>{const i=e._opt.playbackConfig.rateConfig;let s="";i.forEach(((e,t)=>{s+=`\n
${e.label}
\n `})),s&&(t.$speedMenuList.insertAdjacentHTML("beforeend",s),Object.defineProperty(t,"$speedMenuItems",{value:e.$container.querySelectorAll(".jb-pro-speed-menu-item")}))})();const s=e.playback?e.playback.playbackRate:1;i(s)}e.on(nt.stats,(function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e._opt.showPerformance){na(t.$performancePanel,"display","block"),t.$performancePanel.innerHTML="";const s=ca,r=go(),a=e.getCpuLevel(),o=Ba(a)&&-1!==a?`${lr[a]}`:"",n=e.video&&e.video.videoInfo||{},l=e.audio&&e.audio.audioInfo||{},d=e._times||{},h=e.getRenderType(),c=e.getCanvasRenderType(),u=e.getDecodeType(),p=e.getDemuxType(),f=e.getStreamType(),m=e.getAudioEngineType();let g=e.getRecordingDuration(),y=e.getRecordingByteLength();const A=e.isAudioPlaybackRateSpeed(),b=e.videoIframeIntervalTs;g=Fa(g),y=Ea(y);const v=e.isPlayback()?"录播":"直播";let _=i.isDropping;const S=e._opt.useMSE&&e._opt.mseDecodeAudio,w=e.control?e.control.kbpsShow:"0 KB/s",E=e.getVideoPlaybackQuality(),T=`\n
\n 版本 ${s}\n
\n ${e._opt.isMulti?`\n
\n UUid ${e._opt.debugUuid}\n
\n `:""}\n ${e.isInMulti()?`\n
\n 窗口下标 ${e._opt.multiIndex}\n
\n `:""}\n ${r?`\n
\n 内存大小限制 ${Ea(r.jsHeapSizeLimit)}\n
\n
\n 可使用的内存 ${Ea(r.totalJSHeapSize)}\n
\n
\n 已使用的内存 ${Ea(r.usedJSHeapSize)}\n
\n `:""}\n ${o?`\n
\n CPU压力情况 ${o}\n
\n `:""}\n\n ${r&&r.usedJSHeapSize>r.totalJSHeapSize?'\n
\n 可能内存泄漏 是}\n
\n ':""}\n
\n 播放模式 ${v}\n
\n ${e.isPlayback()?`\n
\n 播放倍率 ${e.playback.rate}倍\n
\n
\n 播放模式 ${e.playback.isUseFpsRender?"固定FPS":"动态FPS"}\n
\n ${e.playback.isUseFpsRender?`\n
\n 固定FPS ${e.video.getStreamFps()}\n
\n `:""}\n `:""}\n
\n 解封装模式 ${M[p]}\n
\n
\n 解码模式 ${u}\n
\n
\n 渲染组件 ${h}\n
\n ${h===$?`\n
\n 渲染引擎 ${c}\n
\n `:""}\n
\n 网络请求组件 ${f}\n
\n
\n 视频格式 ${n.encType||"-"}\n
\n
\n 视频(宽x高) ${n.width||"-"}x${n.height||"-"}\n
\n ${e.isPlayer()?`\n
\n 视频GOP(ms) ${b||"-"}\n
\n `:""}\n
\n 音频格式 ${kt[l.encType]||"-"}\n
\n
\n 音频引擎 ${m||"-"}\n
\n
\n 音频通道 ${l.channels||"-"}\n
\n
\n 音频采样率 ${l.sampleRate||"-"}\n
\n ${e.isPlayer()?`\n
\n 播放器初始化(ms) ${d.playTimestamp}\n
\n
\n 开始请求地址(ms) ${d.streamTimestamp}\n
\n
\n 请求响应(ms) ${d.streamResponseTimestamp}\n
\n
\n 解封装(ms) ${d.demuxTimestamp}\n
\n
\n 解码(ms) ${d.decodeTimestamp}\n
\n
\n 页面开始渲染(ms) ${d.videoTimestamp}\n
\n
\n 初始化到页面渲染(ms) ${d.allTimestamp}\n
\n ${e.recording?`\n
\n 视频录制时间 ${g}\n
\n
\n 视频录制大小 ${y}\n
\n `:""}\n `:""}\n
\n 音频码率(bit) ${i.abps}\n
\n
\n 视频码率(bit) ${i.vbps}\n
\n
\n 视频帧率(fps) ${i.fps}\n
\n
\n 视频峰值帧率(fps) ${i.maxFps}\n
\n
\n 解码帧率(fps) ${i.dfps}\n
\n
\n 音频缓冲帧 ${i.audioBuffer}\n
\n
\n 音频缓冲时长(ms) ${i.audioBufferDelayTs}\n
\n ${e.isPlayer()?`\n
\n 视频待解码帧 ${i.demuxBuffer}\n
\n `:`\n
\n 缓存时长(ms) ${i.playbackCacheDataDuration}\n
\n
\n 视频待渲染帧 ${i.playbackVideoBuffer}\n
\n
\n 视频待解码帧 ${i.demuxBuffer}\n
\n
\n 音频待解码帧 ${i.audioDemuxBuffer}\n
\n `}\n
\n 待解封装数据(byte) ${i.streamBuffer}\n
\n ${e._opt.useMSE?`\n
\n MSE缓冲时长(ms) ${i.mseDelay}\n
\n
\n MSE待解码帧 ${i.msePendingBuffer}\n
\n
\n MSE缓存时长(s) ${i.mseStore}\n
\n
\n MSE解码间隔(ms) ${i.mseDecodeDiffTimes}\n
\n
\n MSE解码时间(ms) ${i.mseTs}\n
\n
\n MSE播放模式 ${i.mseDecodePlaybackRate>1?"加速":"正常"}\n
\n `:""}\n ${e._opt.useWCS?`\n
\n WCS解码间隔(ms) ${i.wcsDecodeDiffTimes}\n
\n `:""}\n ${e.isOldHls()?`
\n HLS缓冲时长(ms) ${i.hlsDelay}\n
\n `:""}\n ${e.isUseHls265()?`
\n HLS缓冲时长(ms) ${i.hlsDelay}\n
\n
\n HLS待解码帧 ${i.hlsDemuxLength}\n
\n
\n HLS待解码视频帧 ${i.hlsDemuxVideoLength}\n
\n
\n HLS待解码音频帧 ${i.hlsDemuxAudioLength}\n
\n `:""}\n ${e.isPlayer()&&E?`\n
\n Video已渲染帧 ${E.renderedVideoFrames}\n
\n
\n Video已丢弃帧 ${E.droppedVideoFrames}\n
\n `:""}\n ${e.isPlayer()?`\n
\n 网络延迟(ms) ${i.netBuf}\n
\n
\n 缓冲时长(ms) ${i.buf}\n
\n
\n 最新缓冲时长(ms) ${i.pushLatestDelay}\n
\n `:""}\n ${e._opt.useMSE||e.isWebrtcH264()||e.isAliyunRtc()?`\n
\n video显示时间(s) ${i.videoCurrentTime}\n
\n
\n video间隔时间(s) ${i.videoCurrentTimeDiff}\n
\n
\n videoBuffer缓存时间(ms) ${i.mseVideoBufferDelayTime}\n
\n `:""}\n
\n 视频显示时间(ms) ${i.currentPts||i.ts}\n
\n ${e._opt.hasAudio&&e.isAudioNotMute()&&po(S)?`\n
\n 音频显示时间(ms) ${i.audioTs}\n
\n ${e._opt.hasVideo?`\n
\n 音视频同步时间戳(ms) ${i.audioSyncVideo}\n
\n `:""}\n
\n 音频播放模式 ${A?"加速":"正常"}\n
\n `:""}\n
\n 视频解码时间(ms) ${i.dts}\n
\n ${e.isPlayer()?`\n
\n 解码前-解码后延迟(ms) ${i.delayTs}\n
\n
\n 总延迟(网络+解码)(ms) ${i.totalDelayTs}\n
\n `:""}\n ${e.isPlayer()&&i.isStreamTsMoreThanLocal?'
\n 是否超过一倍率推流 是\n
\n ':""}\n ${e.isPlayer()?`\n
\n 是否播放流畅 ${i.videoSmooth}\n
\n `:""}\n ${e.isPlayer()?`\n
\n 是否在丢帧 ${_}\n
\n `:""}\n
\n 网速 ${w}\n
\n
\n 播放时长(s) ${Fa(i.pTs)}\n
\n
\n `;t.$performancePanel.insertAdjacentHTML("beforeend",T)}else t.$performancePanel.innerHTML="",na(t.$performancePanel,"display","none")})),e.on(nt.togglePerformancePanel,(e=>{na(t.$performance,"display",e?"none":"flex"),na(t.$performanceActive,"display",e?"flex":"none")})),e.on(nt.faceDetectActive,(e=>{na(t.$faceDetect,"display",e?"none":"flex"),na(t.$faceDetectActive,"display",e?"flex":"none")})),e.on(nt.objectDetectActive,(e=>{na(t.$objectDetect,"display",e?"none":"flex"),na(t.$objectDetectActive,"display",e?"flex":"none")})),e.on(nt.occlusionDetectActive,(e=>{na(t.$occlusionDetect,"display",e?"none":"flex"),na(t.$occlusionDetectActive,"display",e?"flex":"none")}))};function Bh(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var s=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===i&&s.firstChild?s.insertBefore(r,s.firstChild):s.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}}Bh('@keyframes rotation{0%{-webkit-transform:rotate(0deg)}to{-webkit-transform:rotate(1turn)}}@keyframes magentaPulse{0%{background-color:#630030;-webkit-box-shadow:0 0 9px #333}50%{background-color:#a9014b;-webkit-box-shadow:0 0 18px #a9014b}to{background-color:#630030;-webkit-box-shadow:0 0 9px #333}}.jb-pro-container video::-webkit-media-controls{display:none!important}.jb-pro-container .jb-pro-icon{cursor:pointer;width:16px;height:16px;display:inline-block}.jb-pro-container .jb-pro-ptz-controls{position:absolute;width:156px;height:156px;visibility:hidden;opacity:0;border-radius:78px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4BAMAAAA9UfJZAAAAMFBMVEUAAABHcEy0tLRZWVmysrKoqKi1tbWvr6+2traBgYG1tbWWlpa1tbW1tbVUVFS1tbVGCHqkAAAAD3RSTlMzAO9U3LSWySp3aZcVRDUDw823AAAJYUlEQVR42u3d32sbVxYH8EPHxgg/lBsa7SBkukmpSbwLI2KbEPpgZ5MQtwmM0wRMmgdhP6RgEuwlSVnYlmGMYaEvMU1KKX4QNq0pocVmm7CYfRBaQguFpbgPKRSC/4V2LGliO+bulWKrkvVrftyZ+WbxeTRG+nDnnnNmRjP3EpMR6tMH18du/0Xj1tGz5+9cf/DUlPKx5PsTkr8s3eZ1cX7ym1zkuI/f1wTFunNt9fP+FIno7/98/tFY+Y8ffBUlLrmkl2Cr96guTv27BMxP5iLCqUvi68+tpqhJKPNXBH3SjACnfimm/7Wmsl3fI/FP75lh457oPH+1Da3M+1T8481QcT0T7UetevR618LDPdH4hTlyHLGH3LoZEk6d4PlvyVW8pfNeMwzcDwa/kCKXoTzk9tfB455o1mXyEIOa+0PrFvcFt+fIU8QM/k6guOQifzNFHkN5l/flgsOJVHibfMR9l2nhBqem+VXyFZ/xghkMTp3il8lnDPKiGQROhs2lzjEuKcVW1uWk4ybk2Eq63pxk3CK/RZLiJO+Ti/vZXw3ZX1E+kon7jv+JJMY/+Q15uIRWIKmRthZk4VTDTsnFKYZtSsItWiskObq1Pjm4f8gqIrUF5W8ycAl+nAKIT/iCf1zSKFAgkW4/7drifrLmgsHF2k87alvhblFAcbJttWuDU/VtCiyyedMXbjGfCg6n6H1+cHE+TQFGFx/3jksa2xRoZO2cZ9xsUJn6e8aOeMX1aGco4Biw1jzilm0KPNJb3nBxvhI8rrtVTlCLK5ptCiEyBS+474POhr2c+NA9Lqm/QaHEiXzONW42yN5Q2ydG3OLU4MvI7+XEdImbCWvgSkN3zB1O1YYptOhoNnRNcDM2hRjGMTc4VZsOE9fVZOioyYyjUKPJrKPGNW44XFxX41rXEPc4vFTdS9iLTnFJ4wyFHAO2U1zcSoWNU7RLDnFTb1DocaLoDJfgc+HjYo3uTjTArW9TBJHdcYJTtdEocJ0NCnE97nGBIon0RQc4YzgaXIfdHhdBHdmrJuNtceubFFFkdtrhVG0lKlx3XUrsxz22KbIwLrbBTQ1Hhxsotsb18FR0OIWvtcT9Z5sijOyfW+KM6ShxXXYrXMJKRYlTtIUWuLubFGlknrXAGaPR4jrt5riERRFH7XGtwc1sRo3LHGuKi/qo7j+uhJOr9flKMBW4QR2uxk1NR4/rKjbGRdpXG/bXKtxrAEdVHNfTDXHLf0TAvbLVCJfU5hBwMSvXABfPE0To4w1wP25i4DLPG+CmRjFwncV6nIpQSF4UE7MOd7hAIJG+VIe7u4GCG3pWh0uPouA6C/txMFOuetIR3JSrmnQEN+WqJh2BVbmaSreLS+JMudKky9Xg4jYBRXq8BndoEwmXOVKDWx5GwnVs1eD0OSRcLF+N67EIKrS1Klx8GwuXHa/C/biBhRt6XoVbnsbCdW1V4bDyoZIRZZwKlg8iI8wKLl5Aw73oEWXcoQ003NCRCm59GA3XsVPBTa2g4bqLFZyWQsMp1h6uJ09woa/t4tCaV6WBEWSy7qYrQSbrbroS2MVNzUUOAXbWSnel0sU+AUbpsl/gEjYizlgo4w5vI+Kyl8o4xEryopYI3N1hRFzHszJueRQR17lVxqXnEHGxQhmHd06yd15CgBcQlcsIYokCJi69IHDxbUycOGki9toGJm7otMC9/ism7tXfBA6zBperMIHW4HIVJsDrwsrVIYE2CNEibIHDbBDlFkFJ0AYhWkSOemxUnLFGqN2r1L8ItXuV+hfFN1FxmXH6wwYqbuivdAgXd4RQ+36p8xNq3y91flqfRsV17dD6KCquc4eWcXFbtLyCiusu0hQ0bg4VFytSGhdXICOFilNs0nFx+QOcZ5xGsGEd4DzjOC6OH+A847QD3P9jtuJ2CGjcQeP3gYM+2YQ+TYe+wMG+NETGQd+OgL6RA30LDPrm4eu/ouJe/Q37hjX0rX7oH0mgf16C/mEO+idN6B+DoX9Gx34AAfrRDeiHXqAfF0Lt/OUHrVAfUcucRn+4D/qxSOgHSqEfxcV+iBn68W/EV3AqD85Dv3IA/bIG9GsumC8IaSb+q1XYL6VBv84H/SIk9Cuk0C/fQr+2jP3CN/Sr8tCLDEAvzwC9sAX0kiDYi6lAL0MDvYAP9NJH0ItGYS+3Bb1QGVaP2LfEG/TieNDLCmIvyAi9lCX0IqDQy6diLzwLvWQv9GLH0MtER76rRqWxPgdemtwYf9kWdYdeDh97IwHoLRigN6/A3vYDesMU6K1msDfpgd7eiOmjSEf1ZdpSC3ozMuht3LA3wIPeOjDSTRdfKb7M21VCb/QJvUUq9uay0NvyYm9oHFFKdDvaChp6E23s7cehN25nh5G3vE8aZ8LGDdjMIY49zoc9dPpFx7ikHnIh7sjnHOPYTMj36oxjzDlO1UI9Xe9oUICb49iMDTBwzXCqFuKsG2gycM1wYtaFlrCK3mTgmuJU7UzkA9cUx2bDGjpFH2FucUk9pA57onGNa4lj31uhnJzEtA+ZexxLh3KpkykwL7g4D+GUuJuPe8Kx5RCuJtJbzBuuJ/hyMmCtecSx2aBzIqaNMK+4pBHwtU7WznnGiZwI9Oykq1U2tMWxxSD7hKL3MT84VQ/wwGbzpi8c+47fCsp2kt9g/nDsp6AyNqb1Mb+4pBFQKU7bpm8cS/DjQdg+aXT/wTWOzfLL8m2DfITJwLFFS/oZQHf7CecQpxq25GqnGO0nnEMcS2iSq13WWmCycKLaHZebDDeYPBz7mb8tz3aff8Rk4tiivJQd5H1MLo5NyNIN8t6cbJw6ZV2WYys6tTnHCZ2MsRM2k8nHSdG5srnBMTXNr/qzfcYLLmyucEyd8FdR7vNeNzZ3OJZc5G967mTKu7wvx4LDMfYFtz2efMYM/o7LL3OLY080byVlULNusqBx7AeDX3B9aJWH3P6aBY8rpUX+W3e2t3SXqeAZVzq0/JyLmRe7wt0fUs849t8Jzv/u8Ngq/+K8d42FhxODp/P8VQc85VPxjzc9folXHFO/1Lh1rc3BjT0S//SeycLGCd6Sxvm51abDp8xf4dyaNL1/gw+caBhLuvj6O6v36mWn5scEPe+H5hMn4uP3hUEAr63e6y+PYX//qflHY+U/fvCVzw/3ixPD98vSbV4X5ye/yfn+aP+4MvDpg+tjZ4+K8bKOnr1z/cFTU8rH/g92biFxn2S73AAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;transition:visibility .3s,opacity .3s;right:43px;bottom:135px}.jb-pro-container .jb-pro-ptz-controls.show-vertical{right:43px}.jb-pro-container .jb-pro-ptz-controls.show-vertical .jb-pro-ptz-btns{left:0;top:156px}.jb-pro-container .jb-pro-ptz-controls.show-level{right:163px}.jb-pro-container .jb-pro-ptz-controls.show-level .jb-pro-ptz-btns{min-height:156px;left:144px;top:0;display:flex;flex-direction:column;justify-content:center}.jb-pro-container .jb-pro-ptz-controls.jb-pro-ptz-controls-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-bg-active{visibility:hidden;opacity:0;width:156px;height:156px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATgAAAE4CAMAAAD4oR9YAAAAM1BMVEX///////////////////////////9HcEz///////////////////////////////////85yRS0AAAAEXRSTlO5DCgVgZBxAK2fQDRkBR5XTPLKM/gAABnnSURBVHja7F0Jkqs6DGQPO9z/tD8Jq6WWbCCvIjKfzAGmulrW3ooedr6ui+M4TdP++SXPr1l/SdL3aRrHhv7ZyA5qb9xe0L3Am+DrkzeCL/BeX908MezTuPsfOArdgl3KsZuhq99fk/Tx3waum+ByAHua5QbYilkzY1aP728YhrH5InrfBa57OLAtVjpRbYaumex04dq4APeC7vnVSfo/45bXLe33jGscMx3f0A1vyg3t69e2dRL/NeA6wrgdcCvjyPM2U25mXDt9xVD3f/qN0yi3Mm6P20S54vlXtGPS/R3GPSbYOsC4ZAvmJtiaGiL3Zlzx/Ht+Y/KXTJXbqmaqe9za1VYn3N7YpX/OVGev2qduOLIiB7xqOzGuWCiXFVmWtU3368A5lkqeOJI21I5XXaORxVRnxmUTdNnY/4U3riNvHMJts9XRtdXVUttipdzrK/4x7UyY6sK4Gbo+nU21T1zKcd9AGJetlMvyLKvj3zXVfeqQElMljINx3MK4xVQ3xj2Ry7N/6CiMOIfYyVUXWxUyBx7HuZRbcHt9bf/Lb9zsHlzKzabauJaK47iVcC7jJujS33/joKkmxDnM4QiJ4xDjZuT+DXQW3jgxV012qcPuiePhCGfchlv1/P0D6Czmqmuq2gPGkbIS8Q4ZsNU3dGP3Y2+cW1RyKpkrbAnwqhi3iXHFHrU3bFVV5c3vBsCsOALjkXErAW85F3rjFvBm5Kos+TngCOXYG7fA1ojFER7GPUHbmer0tfGPANeROM6pjvDMQSkrsWQ1d564Fbr61964TvSqDa6O0ELmAtvGuc2rrpQrn/aa/qCpYq+6mSpOVhnjWBy38u2JXFl9yL8acg6CV3Ur5yxVZfW4AsRxG+XKssz6n3njVMYR4Eg8sj1yi3tgtroxrpyhG38gc+h8PYddPQ551dVQW5jju2/cG7kXdB946Uy9cbDnQOpxuCCHcq5dHDcht8D2/K67VxPNGtLJd7qDTcgb1zLGbXEcY9z0Fd39GReTzIH1B/2lcxrGTYxjXnXyqxNyef8zpipVlfDsyCCmDkuumhGvWq6W+vyisqxvDJwwOxJQO6fNmjaQcRt0ZdR2dwWOFZViuculNWtgBZjk+DNq1cq45y+Lf5NxE25B3oEyLueFJWqtT+Ciqr8r48jsCAyAG+2Na53MAdQxX16VhHEL4Z7Ilc2dGad28pskaULiEdDlyijjdqa6gBeNtwSu63AnP3V6NUnAG9cu1RHOuL2hVi5qr6+9Za4qV0dCGcfCEfDIufWRFbsZvKy7KeNgW7XHvRqxWfOGLhO6XCrjoiiPb/rGdZ75uGRfj9u3B1sWAEtdLuxVF/Cq9HaMe4A4TptkZYwLqI44rmGDbUe5E8hZcg54zquRbHXu5NN6HKuO7N84YqwbdGV/Q8YF5arUN7CJTNLkgplD5T5xG+OOI2ehAhxv00ocOlpWwhHwljns5uNg6bxCb9wbueSupip6VTnj2jGudSvnOeqrVo6h7vl2nHM2K8AkV1WyfDYDvHUcWF+1VBl3EDlLKdc2dQ6aNbhXw2eAt14Nf+MqFse5rDuS8tucHUmhqaJppYF6B8440h7E8cjhqMTiLtcaAL+ga9jWZb35hpbHceyNI9WRSmHcE7n4jqbqTp2D2nnzgm154mB1hJQy1cwBIpd3twCOrjnEoDsoTZ2jepybb2VKrhpx3zB92Z29Khpl1ZN8MHWzJV1CdYQHJEeqTMbqcfEMW+obLBwES83w7AgvY0YlMNT3N96GcXEHGQdxG2t3CQ5kDkoFeO8esHd4fc193jinAtxvXhUN3Ywz5VAFGM3cENfgVM4x5YICYRumqu5yIVMdJuhaLXMAFWBKOIhbWFBiO44Dg4Usxx/cCrDyxqESMIYuu4lX1fYcGnVaaVmtKXZxHOzW5Bvfqtk3iLAFuVaLew4HluDUzIH1VYMZF+AgLMZxcAYY1uNYBTgrwPDIaqxOQ1p540IchBFTJW9c2ofNAO99Q+sYaugbJ35Vd4sKsPbGqVM33KsWmdpXLeXqufsVNwhH8FyhOh8n74foKb5WVDr0zFky1Rgt+iaJZyJTWErKMynpqsqgVy4q0xv0VTvZq0pJPq5jzn41zzzVET0aCYjmTO05OLaaBEwWqhvSenUkKtVw5P0N96mOpNr2YCPuh4AJCGEAoioDver7628Sx8WAcU2i1eM259AWhZBzuQEJieN07JR6sCHgXoSLnepI7yo9NqgCLE5A6K4hjHGKsVqK49JYEGyBg4XIq2b7FREUx5Xu2LkXOtmz2pJBW5sOqdjJF3sOjHG5fz7OT7n8DtURwjjPtBKtx7VLOa6Q4zh5Wkn8xhvU4xbG9al/s2bAbxwYkJO7XCGME43VIuMc56Dnqi7hpPE4cVopBLnibozTp5X4DHAQ49iwfsCX3IhxYFoJB8C0y7Xr1iwBSZXDulIUjF11G6+qr5aPALlCmTrfyWfQzCEK49xoPMnnjFMaq3QlX9tzQPuq0QFbLeNbMU6cHRn3Sb60HwJ6NXAhKQi61nzpPAbtQaY8jUUgQnRHSodxZSjjoig161W7HePIRGZDJzJHQXiEzE4DpRtSjotCHzkUkhj2qqJi4V54T1S6cWwVp/nhjAP1JQuDhbs4TtFW0spKTgW4UHJVFv4GQpcZA64jkt1xDNS8lDEv9Y3z5KpRGY4biIINMC7e2lxKNFJDqUfQquGZA2yrHoINUM7G6ZX1iVM2RKDUI08dssVUfduDRyI5QDkbFWCnscrWVWV1/RZ2uaRc9UyKL1LO0r7q1qwBm761WsmEUjdge9ApAB9iHHWslq4kMalHTbHQieO0zXKljHmIc4XdOE695yCpsg7eOE7t5B/4Uqv1uDSGKhDYq0r6yQWYj5NnRw5BNxjOHJAKRJB+nJqr4jcuOki4qOzs5qrgulSDJzJHUcyrCNMdOc44ty5nel815KDZ4HTypeoILAEfZJxbCjYkSpVKgZx/IpOfXgnarDkKXWIrHAm7kiTqxw1er+oQzg2Bj32FTcYJ2kpCIx9PK2XMq1ZCz+EM46LYZK4qaCsdmo+TqiOV5FWPITdYLZ2jOqYa/6LN8kJSZT1dxkSTJEYKmZ2/OuI5aIYYh+UzKn3TN9A9mLjL1cl6LexKkqof575xVJWVx3HRefdgUbGQNGs2U2Ul4HYQ60o+HeBzjCtt9VXVqXMpc3DEzh2NzEJSnr7OuG35wUTpPGjqXN3lQgdE0AWRA2sOHls1eO2yh/uqWM1LbUgvQzeatOhR5NZM39QIBNyQbviBVajYItbOYa56knCbrRrUj0vxTn5QVQlOnUtdrjKKztuqpbMEJ27WtCG3BzX9uMPfYqsmlW7SPnRfFeSqwTrAp9641VZtXi1PlX1VN44THzlvPe4k45aZLys9h+7cvuqsAqEpBAm6I9HJN24pZ9oIRzp5XzVUsVCZOnd0Ry4zbu52GdMBDn7j+NVyYXaEneW6+sbNrQcjtwdJCTh4WmlrSLcF3axRZ4AvMC6zxjj9annty1X9M8BoefBMQGKudB5UjnMnMltQV1JuD5JK5jnGTUU52zeke+4cfMJ7ygxwSZuDJ6EbzDEuZF+VNLnczCETlPdkdf3Tj5yhAHhNVdV9VXgJGV9JyqWjjRdS1fWRs6vmRctK1KuiLD/b22q2KyvlWJT1HOPeo3IWqyNwlwtrxJNrlwW69ZNr0qKnoBsfNrWVcH+w9gzIFXxDeisr5cxSrzCusFVWkpVukH7coF/0zQRt0a2QGZ1HLrfAuIfDOL/uiLOTz9UMMiTmtXMOVXmxW/P+OqM6wPBKEmLcbuiGMw4lq9cmIPbewa5iIb3LdYxxKHMouYDcSeRqcxd9+dS5VFWCGZd3e9DtR5+21dbYRd/1EAaagUC6IzDLV7YHj4pSKbmDkZRLnmRNcHeQ3azZdvLJ9qCUOVyhXGVmQUSpx9GWAzNW6Y0DmYMzrbTeHjzxxTeI41zktugXtQezAsRxon7caUt9VZZMMQ7pAPMnjnTyB5lxJHPgU+enGTeajONUHWB46wfW41jmAE79nHerNiYyFeXpBu/keycyM8983CWv+sxWLe2rsgpwH7qRxPuqb7pl6IKe61RPYpcbvefQy3e58LSSbwY4B071CuNKk31VtswlTyuJ+6oZuss1h3HVCTEDluZb7Ks6prqrjijlOLTLxRlXUhng85RLo+77por7qp5c1fUN8I1Tbw9eqce9ArkvA6eqxOOr5UQGgrdVC1l5GszHnYSuNsC4OKgeF6au73S5Mt983IU3bvwqcN3jAe9y9VgkvvHPskp7DuI9h7PfYOGNw3EcH7rx91XRPbNPT2TOEbCNNw7uJOGhG+naD8+5PG/cJcI9gYu/CxuYVuqd+6reHbgBWqrvavlV5LLvAqfdc6AFYElcyW1IS0eScqg7ch65/MvABXW5ElWvZXDiOL2Tz3VHzn7Vt4F7iNuDobMjwp7DUh3hfKs+EQCbAs43O9KgG9KDrK6vMe5qIPdd4NS7XFLi4NxzADf0eEPa8aqX1lV35REjb5zac1geuYVwtfjGbTmXsJH0qf7g14Hz9xzE9iD0qigewTv5F71qaeKNwz0HXI+jb5zLODABQWaAP+MbXA2SbxdH9KlzMjw9jvAUMr72o6363hQ4VyQ+lU+vkH70ALVFM2cnP8f1uOojhLPgVZnWI7y9Enjtcr+TT/qDJdj0LW9tqlgFQtUdYQfNQupxnHE3dw5aripmDgOcOt90gHOpOvKRF85EOCJKPSrVEa/y9D9QLDQEXKco3UiqVPtdrjZIIxNuSEeX+qomc9U+3S/WUIUgvD2o7nJ9UnfECnAPWQUiSOu8HYKERz6oO2IDuE7THcHOATIO9xzQhnT1IcblVhjnagRp8QjZVw1gHOFb9ZnSuY1OvutVe3/86w4Be7XOc6GvetsuF47jAq5dElFWn9a5oJF5YUDOBHCdds9BzRw2xrWy1jl946qrC6tfb0i7uWoKZ0eaoJs1e8LR+6pQPy66GMiNhqaV4ljbc/DqjrTC1fL8n/RVa0ummiI1r0a/yyUPT2dcXBR08s9Cl9gVpdKvEvgO00LB7qta585g4eP7jIuDxEXdaSV87TID91WdiUx67uf011lkHBTea/R6HN1XhTdr0AmROw9Pd1h5euurJvxKEh2e9uyrfnYn38q4vnp7cLchXXuVbtxdLoFx1UVtpWnv0uLNGudquTCROXj2HHI6riRK791zJakjIxDKRGatMI5fu8z81y4vzU5bE2yJmYLyFsc1jaythPcc+CW4j2grGVi71GTQgnLV1tFrQduDUj3uWvwb27p2Sefjel/PAXXy+QywoFh4IZKrTF67lC6I1H6NTHEGOBeWB88LoVm6dimoGaxO1a+RiafOpX3V8r7yGayOuZfPgGsOQhy3V4Fgew7wSlJ5hXG1aY1Msj2IK8B0BAK8cYIIxBXG9bZuD6ZUlCqk5zC0x/Yczh9YtSVK9ZA3pAN6Dqq6vnAo9ANx3Ndl0LazXPK0kq/n4J06F+45XMkc7Ajv0Sy/VzZrpAsiLUnyhZ38fQX4vOqIOXX9o9cutRlgfZfrSuZgTVxU9KrKPQdQOgd3CZB7OO9VzcnZ4pYDHddnkoVSrprlAXe5ynN5gxF1/Vi7ocenp7XdcueJyxSt8wtjhRYku2EcB3Hb1LxqHMb9192VJTmuw7DxSsfxdv/Tvn7TSceiAEpylqYnH/lWsWBRXABMVLHQ8B4cjvWUfN1xTYU6wJEqqy7y1ynBEIGt8ycqBxe2BGh3JEt3hO3HtXjm0KFJ/kHIOTDCmEUM2RFMH9ygn8N+WoNmDpcLZEgfFuz2pQPMKof7eHBME0RsxAVX3OFS1Y/Zj77jtGQ34nLRWjVeHtFF/pOIc2EvRdf1m/2UKy11s+8qtXzmAKQMhiNNTDefqiWtFIlkQqEbNJFuO7g6oqr84p8PC710IxN0R0bK5VIFV2svTx9CnCPTxspm1iiGiBKeptmh26tAYOXpp+y3HSGuqUwnONzIZN7bRAdYp4bDZpee5qq5OsAKcdTQISjykUjmM/aq3lRZK3rH6a5SOMmPZw5BQ47yQ05rvm3NVVXhkLCs0YqF2EN60A4iw8Ev1dtcNXvmsGK+qukh/QIRtEHE06cK1fXtKRfLqoTLRadcw8Ev1ZkTXBXzVdkdt5k1PvtQo/24I604520lvq0EFAvxXLXlytPHpjUXcRU4tTuiJvkx4EbugxHojrRJTn4p5jY3gcspucLQKW0lVnNhFQhF5ir+VhsvgZsN/Tji9cOcVybD6wcOuQ5MuXpxirhyt0tTea9NTPKLEVf7CdzMaZdZbpd0Pw6LZ1wiN7PhWGpwk1Uz/BzQDsSEnOB6vXT+cLscntoB3sQZ4qiaV/qOixjSJYgrBNwwu0OcSYKzzbe1ExwYrF6InFdpVp3EG+IIJSlsnWv9uEQ/DrMH497IcOgt4hNxC9vXv2b5ElhU32fuuF78IQ4r3XyreV3NST5V86K16uG6YRF3iIt1gJscxRbgE9oG88E2oa5fdMu14h9x5pZX2I9DuaGn+nGXmOdw6PHrvh+X9OWagGdNbzCkI5uk7NhpwHliSDf2sIY4wQHl6ZysWvoaqcUz4hLyGUrsfF85QIZIvASsh1zZsYsA54qTDyuHSAViM7wH+x6NarDWeRHiFpHT3HE1g5zldsk6wEDOdiiwJejFJeKYvaqtWEhFqShfFSkWHikaPHZH0qJUxEOvnK9a4CE9ibvACVQsbMLKwWTWGP6qMeKOAW6o3AWOXHHZ/TiD55BGXHZW3UScfqqPVdbGMjSLa1VVcRG+KmRI53fOOxGnn2piedpgSK9GB5h0MssBVzsM3AwdfXPuuFh3ZGLaonBUk3/J9eIfcXDmcC1RLEwotgTvuDzIDY3LwM1z0kMam/1gjcyWjQePq7VscjrE2YuFxNHMLFWB1vlwKDO4rlX1tj7ROidZNc1XzZJPZh/q73O5BPBVo90R5PaTyKqYPVhcdK3iGXHxJB8RRLT14KZYl1FW7RJa5zkf6uw2cJJ8x5kbmcDsx+yO6NglQreInO+Oy9oBNry348qh2M5hFTkH4sysihA3WXNVvAIciQSVtH2d745kdZUYQ9pa1o8QNxzLqO4m+eFcNRk6BLmWiHZ3gK+a+FZH8Y444q9qbuuTmcMLlad7Ee+Iq9gOcNJ7cFqZDjCXOs98AV9m8Y84OFitI7fLK0VcwHPoqZ+Dks+wPtRhEf+IS4kZ1ElqOZrW3CBH+ar2O24U34GT8rmqntWsif24jjFrrCtuEjkD4qC2kpqrjrQ9cpDLZXlIt+I+cEl/VernsB7Zj9PTQZIYKjkX4iCz5go7mYpZY2qdI77qH+M9MtRyGsQZXC5rrzBWnt77OQCNzKB2YIi7ipwDcZXJ5YJS54p32UM/h84WAmZZdZMTBE435LLt3sm2foajbyqtTnKCwCkVCFMlHnKSpkhev4UdYHDHke5IK2cIXKACYbuWm7UqVp7uzDsOI66bzxE4ogKBZg5ZtWqCIR2+4wDiLtl2s84m+VW8ra+YNXZ3BHaA4VwVvn8vjcipEJezr8/UDOgOMDeYYv24ZGXvtzuS0Y9jO8AT3QHmnPzhz9G4OZs5QKIvFgJW40FYqraAWRP4OQSRK4qbM55Dxpeqd4B/uiNTmj1oVg5ZhZbvKZdi1mBHMyIuanPydXdk97GW4U28GZqFSjdL8h2nkgN+x7E7bo+40rj50AHOkTq3NYIQ4tpolRXKi36/Q0rj5m2uWkV81ZS6/hRvK/XRyIHRHIby95v/d1y9WEk1lmW1uVx4XekWua4SOSHiKuZnZu3HYXV9yh6EPIc74NojBuQe9uMqUz+ujp4jI+2dt6w7Qp3ghuw+krNaNctBrwYqaNB7MHgAdyk/h5K+pdfx4GzusoafKujHRR3gDu/HhfpxfxF3lTMGbrZtCdB+XIi4KDegmQPagbh1zsufIY4QV2ltJcVXDTn5EeKKuFyqcmgrOWng9g05pZG5RFvnd8SNtDuiPKRbw9H3/ztumkVOjrg5ra2kEIe7IxBx4e7IA3DjMwf3eMfhh9xovH/73dZ5n9cBHrpFzhs4hbhgB5iqeaH5IGDWtCazZuhnOXHg5jmdVX9mDte0u9TjAQz9HB6Iu4zPHt2v7kgNe+cb3FbqeVa9qBfw39C1jZw9cMBDmr7jwqHDylzL+5Sfw2V9wcn9Iy5qZFoTaZRV9b7+k1nB55Sr2gEOaysFiFO+tCSrhqsj2yzyjyAu3lYCHnojyap85gAdfV9wu3l+x2V0R36INSvWAUbvuMvzydRprWogTmfVO+AI4uB+XF/JvxK4UHekMZRucHdkQhsQvdqPuwGurV95cl+LhUR3hPfjTN5lkFa78bUH97StdEdcOJC277h0bvgO24ty6RkQV5OtG5Pn0GIy19S8/OCeKofojlu47gjVT+4/EjZvdu9grnq1uVxAB1il1beEzRtBJJQICv1VMeKU93a0OzItbzq5k90RgLhl+XGCqy3ERdYrO0fftXnb2T3VqjfE5aigMbf3YANirN54co93XMjJT20rhWteP5Hrr/NbT+7xjoPMctOzJkqq6/Luk3u84+7vuGUBSzeBweoE3yPTm8Hm444LiA5gyMXuuJU56G3NR07uAXHVwwo5fgBTf1Xo2rjVnzq7r6yK1LwSr5HHHTdt9fy5k5/R7XLcJdX7FbeOy2dP7trPweQ57FRZx7r6+Mndq3ldEzrAY938ysl9uiQ1cJNVa2SO16X6tZP/dj8uDqJW2VfM/O/ftf7FmPkK3OMZ3MAu8G3T6ytiTTU7OK8jxMlfuN1idg/X91/9VUZ81WOVo8P+Bw+0DogP6NDPAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-up{transform:rotate(-90deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left{transform:rotate(180deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-down{transform:rotate(90deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left-up{transform:rotate(-135deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-right-up{transform:rotate(-45deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-left-down{transform:rotate(135deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-right-down{transform:rotate(45deg)}.jb-pro-container .jb-pro-ptz-bg-active.jb-pro-ptz-bg-active-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-control{position:absolute;left:53px;top:53px;width:50px;height:50px;background:#fff;border-radius:50%;transition:left .3s,top .3s}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left{left:33px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-up{top:33px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right{left:73px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-down{top:73px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left-up{top:39px;left:39px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-left-down{left:39px;top:67px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right-up{top:39px;left:67px}.jb-pro-container .jb-pro-ptz-control.jb-pro-ptz-control-right-down{top:67px;left:67px}.jb-pro-container .jb-pro-ptz-icon{position:relative}.jb-pro-container .jb-pro-ptz-icon:hover .icon-title-tips{visibility:visible;opacity:1}.jb-pro-container .jb-pro-ptz-btns{display:block;position:absolute;left:0;top:156px;width:156px;box-sizing:border-box;padding:0 30px}.jb-pro-container .jb-pro-ptz-btns .jb-pro-ptz-btn{display:flex;justify-content:space-between}.jb-pro-container .jb-pro-ptz-expand .jb-pro-ptz-expand-icon{display:inline-block;width:28px;height:28px;cursor:pointer;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAANlBMVEVfX19fX19fX19fX19fX19fX19fX19HcExfX19fX19fX1/////Pz8+oqKjCwsKhoaHn5+eWlpaOqTaDAAAAC3RSTlP/3CaKxwJiAELtp4ri/s4AAACuSURBVCjPfZPREoUgCERXBdPRyv7/Z6/Z1aQp9oWJMyYLiKUrOIpAJBdGCldgbzBkPM/QEoTI3jBEPBRDhwEvChe08Q1Ge0ImvIq4Qj8ljrLdH77CyQPWlCdHC0Q1e9rmmuC+oQN9Q4LwcQg40L6eyqm0uEpXSUqe3fKpkkqL+Y/o+07SrahNEO0T0LBsvOitf4xsLqiNTB32wtqaVKosGLO2mhUrS93+PZ4D99wPqzMJVcbEyA8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-expand:hover .jb-pro-ptz-expand-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////i4uLZ2dnIyMjExMS8vLy+iXNeAAAACnRSTlMAYomLxwEm9+NCLo6DKwAAALNJREFUKM99k9kWgyAMRIMmEMLm/39tKaVKFJkXl3sYJ4sAXeQ3ZOcYd0+gRYblFBuFLYoS2ot5lpvYn8zJQ65TO2GVNmdCmQq/qczw4gjpejD14BgmhziEIvCjVRlPioftHW6A7xBB1a8CCUMvsuSqEkPM7eZX6h8GrQ67bYpNIbRL6rb4/k2EfVXKsgmqfQrW9qnGq96a28jGQG1ky2HXpVysyYyeDIhWq7le6ua9P36HD6+2GRi8iBZBAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-narrow .jb-pro-ptz-narrow-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/9/f2/v7/y8vLUObqxAAAADXRSTlMA3IrE6SZi9wI+y0gNXAn3CgAAAI5JREFUKM+Fk1kOwyAMBQ04bJHT3P+0JVUMNMWv8zvSk1cipfjAKXHwhR7k6KTjYp7dVuWLug1XWB5wz96T/JD2O3Phmv0k5ypL6lVVFIPYpLOka5WKSSFvS0/BloHYlkza5HkMzrvVLo8ZlRr7mtFYWBBsBQ4BjC//GTxcGVw2PpOVHQ6fJj7qS4936OoN2K4e5yE6N1UAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-narrow:hover .jb-pro-ptz-narrow-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcBAMAAACAI8KnAAAAJ1BMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v7X19ckk9ihAAAACnRSTlMA9+NCAsuKJsRiPv/2GwAAAJlJREFUGNNjYAAC5gxFoTYDBijw1FoFBIumQHjsUavAYGkBmGu0CgqUwRqlYNyFIO2Fq+BAnIGBJQrBXerAwLkKCUxgYELmKjBYIXMXM2Qhc5cxdCFzVzBoIXMXMYAcsRsMdgEdgs4FKT4DBqdAitGMQrMIzRkojlRB9wKaB9G8z+CMGjgshjCuMCjoWNxRAxYt2KGRYgJiAQAnZcjElaB/xwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-aperture-far .jb-pro-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAASFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+kpKRzc3ODg4PFxcW1tbXW1tbk5OT29vaVlZVmZmZ8vCMFAAAADHRSTlMAxGJ5Mssm9+NCiYtiH91SAAABAklEQVQoz41T7Q6DIAyEJQooUL55/zddhVazzZjdHyqXXo8DhWCYTWqltNyN+MZLuxP69UGti/vAsl6c0e4L+tQ2yv1AEbvecMhO5cXdYhk+6aO3WGrNAMwentlMz/ZAKIlNoRsqY2wtFWu9t8wasc0iYVN0LkQfrG1zbxNyrIBcntOQrH1Ukkb60QcxYF1xMA2dh8zWj6ZDsLCsIrL4Ds5Hm9FMbCEROWUB0COaLXEIZJKV7CKybGO7UuxjxY2C/TkMbxboKBQCxgMN6MCJQ6Ch/QjOZg/B13LGx8FDTe3IFvl+Bc9XBi3UWoex68qeL/vxmdyxyvz3NJ8f9dDef36HN7koIK2LjxB0AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-aperture-far:hover .jb-pro-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn+/v6cnJzr6+u/v7+xsbGlpaXNzc3b29vqh7uRAAAAC3RSTlMAyRjKA59J/3PzPhe1wxwAAAD2SURBVCjPjZPrssMgCIR1mkYtisD7P+zBCyZpM5mzv5hs0M8VnZvaok9BlXzc3FXbO5z0vtifFC5Kn8OL4UfxwVvuHm61d5Z0b6ZGZZwZpQAUosWsjVZntVS1sH3ZFo1IRVYfGXgx+VGwNkkIVbhq9/jm3cAhaNv1Uk3IA8mNn7D3kbQeWK3TLH2jCthrDFcTMwUWaKiClc9mJtJWhS3SF5BpJqMQW1b3xwnkDahMoHYomkeJRgSENA/MFsKML7fgoCBVbGvM+Cx4JcKWbWHKK/h1ZYS1Jy/nK3u8bB3KhzG5deMxtfv3aO7/Heq+9ms8h9fxHP4AHzAWU9zlWNgAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-aperture-near .jb-pro-ptz-aperture-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////9fX1+FhYWbm5vz8/Nzc3OwsLDi4uLDw8PW1tZmZmYgm6a+AAAAC3RSTlMAYmOLx4kn9+NCIVJiPGAAAAD+SURBVCjPjVPttoMgDMOJAqOU8uH7v+qKFN2c597lF5LTJg1VqQG3aGuM1bNTV0wWDtjpg3pq+IB+npyzcIE9ejsDXzDCrjccs+tOariF3n2OLyw5xko0vh9MDjNb9Q0hp2GK3cixlIApe4/JD9appR8SFxWAUFLg6n63iB1irnY1Jv0mlrok7nUdcZRa1YeshxBA9iijChlxI6iZEaBgSEL2tkRcymPGGJpqlbZ6uDg0WR/F0DwuMpxDkYwiIXA8hO2uMJdGCCK6teB8RQoY8xGfevQjxYQt25qoRwDT25MRBjZ7GtP/P/afa3LHmrflXa+ruf661Hvv+et3eAF6Fh3v+sSUGgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-aperture-near:hover .jb-pro-ptz-aperture-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAM1BMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZn///+qqqq9vb3z8/PMzMzo6Oja2tpXGg+mAAAACnRSTlP/JomLxwJiAONCr+rW2wAAAOtJREFUKM99U9sWhCAInEpLBS///7WLEWy7p9O8qEzCMBIOQ15DAlLYsoegS9yFMKQ93skl4Adh+ZI54Q8pG5nxgKzkgkcsk4zhmQxRyN1OPHqtncjOu5AuppcJ6s1EHTA1YzC3Wgq3YmzGqpsmlwZAo7F8oLEVKoeE6+TbSxK0JJ/3FLOwFnUxzXuoltYDDMLoAlmYXLAWIrkqbdZKs+q4KBfkNV1uwGaBim9TdLWS3R7iGRvCNTPB7JvGlc5EXK8cKbrxooint73RzXh7Msl6Oj/uT/b62O9j8sj6gMXX0Xwf6jP3Zr9DtNAHTYMMXrXSK0YAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-focus-far .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAPFBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX1////92dnbs7OyFhYWjo6Pe3t7Ly8uxsbG8vLyG+Q0EAAAAC3RSTlMAiWJjx9wm/0Lti7mfpe0AAADaSURBVCjPfVMJDoQgDERFC/bg8P9/XUSO6CqTqA0TptNDpSrMpC2A1btRT8wrNKzzjdo03KC3zhkLD9imbeAFhd3sG2kvZQ2v0NknfGBJZKkhBM9MxOxDKBV1N4iHi0TRHYjN01Qi7/kK2PtyNDU7DAEJgDAAN0u1jsQEFEkcVVmrqjeXrkWRmC67eqbgG7bJyvkQSQkvUvec7szpek6t9ubWJSK/uJVSm+APzHKCh++DWWuH4plQKNYOpfappcjy2VvJn9744cjGwx6uyXjBxqs5Xuqsvf/9Dj8rLhRg+bQ5VAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-focus-far:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAOVBMVEWZmZmZmZmZmZmZmZmZmZmZmZmZmZlHcEyZmZmZmZmZmZn///+xsbGoqKjt7e309PTExMTQ0NDe3t774OlGAAAAC3RSTlP/itxixwImAELtp8B2gZgAAADmSURBVCjPjZMLjsUgCEVpq60G8Lf/xQ62gvNeOmZuUiWeKHC1cKnC5iJAdFuwJXgmf+xg2g//G54OPuTOCUOEL8WgMMCLwgPP+Abj2aF38CrnBR7whw6Bo4fWUk7MMrQ2OrpAq0GspTLLgKg1wTailNITZA0EaTkZGjIAY5NwlATah5CGRMJYj50tFtlWiapsLvAPRdtL/WOmET7QzZyl5ywzp7NWsjBJ1odsragJqeJ9HGFNZoLaJw71hMTm0O7NeDE1Z6YsU5rGL69sedmXXz0ToW8PzA/oV09T8OJR32fb7+B17Qe3WwtC9PVbHAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-focus-near .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAARVBMVEVHcExfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX1/////t7e2dnZ3W1tbGxsa3t7eDg4Oqqqri4uKTk5NImu/5AAAADXRSTlMAYieJ3MvE/0Lti4oh87zNagAAAOtJREFUKM+NU1sOwyAMY30FtoWS8Lj/UZe2gWpVh2aJH1wcO0mNqbDj4gDc8rLmiscEDdPji3rP8IX5fXLWwQWuaVu4gbKDuyPdsJMz3GLefcIPbJ6PDCEAFDlUAJiORM3NigQFAXAFlqOeRhWJyFFIHxNGvRrN0mp470U++3axGM2RAmXcXqKnkDSN0a9WIk5Sa01MpDXBQAdVtrA8lBhFnnKpsmoo5VBrhszV0KuJ5N2tP92O50iQjpzcctravoihdoi0Q1NrfN56m0VWzFBoje+OrD/s7pr0F0yUr6s5/LvUu/bz+B2ep+IHdMIV2SUZfCsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-focus-near:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAAAQlBMVEVHcEyZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZn////c3Nz09PTp6enR0dHFxcW7u7uwsLAUKT0cAAAADXRSTlMA3IrE6WIm9wI+y0gNQZpqdwAAAOdJREFUKM99U9GShCAMQ8BF3Cmlpfz/r15dAe88l8zwQiQkoRrTEa3zIXhno7lhWxcYWNbtN/fa4Q/218VFDzf4of0O8A/h3TQfOGU/ytsOj9gPVyt8warkmYEQQAgABYDxTKROz88koS6AVIB1fRCNbSI1cVUy15Jq27LGjTtyzipPeWw40/IXQkrHyZSRmqw3LaQgctFNKYzYyGACfEXossLMojFEj7J0WfdwJ3dD9uY2X25tL0Hj45mTR87Y66u9IQFsDS1bL57o7JbUDNIofvpk08eej8kTe3Hz0ZwP9UFfv8OgfgBUByCEUZhYtAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-cruise-play .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJWSURBVHgBtZe/b9pAFMefbSYWMjCjdOtmYEYqXVC3umMlBFRiT7qxkexITcdKSDUSYna2iqX+E/DG6LCQgcETUiR+5Pv8I3Kc+McF5ysZ3x2++9x79/zuLFEG9Xq9s/1+r8my/AnVJq4z/2LZfB0Oh1tFUQxd1+208aQ0GAa7kCTpMgRJk4kJXk+nU5NEoe12W8PM/wrAotIx2Z+w3MkE7XQ6Q3S4otNlY5zPUZdL7wiMBUsRIK/fDeWvhQ92XS0HrQia83cCsqoIyMug8gQ9Ho/DpF7FYpEajQa9VTBoyIZxWeEfv6IndSqVSjQYDKhcLtNqtaLtdkuigmGSZVn/XKiqqr9wqyZ1YEtbrRZVKhX3zvX1ei0Eh7Ufa7Xan8C9VRIUg9lyQZfzO19VOOugkBpAgaXRtnq97oLZ5ZvNJm0YQkBZ8m63E7YyKl5ntrrf77vlJCF/qzLlKLZ4NBqRpmmuF2LBlLOyBFYBchDKlIeWyyWNx+PUtS2Qtx+eJA6i2WzmQtMEA+8KnA+73a6N+jkJil1pGAbN5/PMfRBIZsGn3+LFvSABMYiBgpnJgZEeFHQD4EzQrOsWI4N/nrY2uPg/eeefV8WvAKfALOsWJ3jzA++rcqjhB25OXAd244nA62AjV4LGxWLhIBk/oPiF8pc9mUy+BZVnyQEzueEZUb5yjyvhBiX6BCw2YTGvdZNyAkYPZsprT/rgO/K2vDcdQQH7jes7gPcv/kvqyCcKbEVX6PxVAG76QWPGPZAIDcEZqGECTQyokpe9wp8VfNqzyA2L9M+KRzm19l1i6ZQBAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-cruise-play:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJ5SURBVHgBtZe7buJAFIYPjsVFAok3wBUlYcUDLNvQISUSDVVCA0IUYZ8gmzcgBeIiJLwdFau8QToaQKygovI20CJBARKX/Y/jICPAF3B+yRpjZvzNOWfOzLGLLKrZbAaXy+WdKIq32+1WcrlcQe0vZb1e/8XvQT6ff7fyLpdZh0qlEr+5uXne7XZxMpciCIKMSfzGBBSyCwVMAqxpEXYEhzdeAJYtQ2u12h2aJq4gXadSLpf7aQptNBoPm81GJofEsc5ms9/0zwT9j3K5HHUSyEJ4ovV6vXkSyjHEyvxDXyCAHxGy4hEUq+4JjWQ02O/30xV65rTbQ9lKNEWjEYFAgFKpFMViMbpQnOfFPRSKWxnldrtVaDqdpnA4THalefMDinx8sDOYrY7H45RIJOy6PMibjch3F24AJEmSeo3HY+p2u7RYLEzHwNqogOUcpSvFrk4mk5Zcjry9FZCX1+46qj5dzvEOhUKGfQVyWAyPRCLqojsnEYtohpiSE5rP59TpdEhRFMN+Itw7Q3DpGq1WKxqNRurF90YC75+gnXszulBsVbvdpl6vZwpkwasDNWVw9r3BWlu5Op1OVdBkMrEzTD11RO1exmUJytb0+30aDodkV7DyjT2rBpNrG8zg3WwQW9ZqtS4CatASt/sVhAC/GA3glWk1bqcEo+TPwm0P5QeYySt9jRS9UQe54vF4fqEZkMNCdXivrw4PoJlMZoad5IeDYE7F+0KhcPC+syVotVotIQ5PdLm4CD8CGkJZfAIhzlw3SWRdM+T9q9frLbHnTnUwrfBZfPCiecQG8v3MBHj/HvAm4/P55HMwW1C9tG8a/RmsGH1CnNJ/17UakVMOx7kAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-cruise-pause .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAHySURBVHgBxZc7bsJAEIbHdprQJAU1ckln3FM4J4jTIkSMRB9uQDhBlBPECIk2yQ1MSeeIxg0KZQoKKpSCR/4xtsXTNmA7v2ThHe/ut7M7O7sIFEOGYdzO5/OSJEn3KGp4ZDy33ucxP6vVqo86H71ez47qT4iCLZfLJ0EQmhuQKNlo89rtdk06FVqtVjV49kZrr86RicG2TdMcx4LWarUWGjzT5Rqjn7tdsJAi8Ch4C4op1TGl75S8GKwCPOWC6FsRNDKAL5SOZER30HcAhbFFEUFTLBapXC5v2fL5/J7tiOCXofHLlVfikRhRrSqVChUKBXIchyaTiWtrNBruYLjM9jB5jlmup4vFQqMYyuVydKE03vsuVBTFR8pIcFD317REGQlRXBJ5PSl+iktCskgZC57eZA5l/Q/Uy4lTykjYq1++p5EHb1LC9rRdKA7dT8pO64yERG/SmVM8m81OqW7yckr8Ztv2r6Io1whnLawF59fhcLiVY0ejkWsfDAYUJfRfB+snOE85J2KRvym9RGF2Op06vwRbhg9YHgmlIz7E235B2vwC1x1VVdl7jZLT3nVF2q0BsJUg+ODFTDpU0wP3PfC5a2wB+BD7CuqLgws/TQQYn7cyxYfxfdc6ViEUujMAHUlER4cKHfhbATvPjBUG8/UH1xXJDxHoYGQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-cruise-pause:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAH/SURBVHgBxVY7bsJAEJ01CAkJKUhUULmiDSnpoKYINyBuQIgi3AA4QZQKIQq4QaChhhuQCxAXSERUSDSIb944axSS+CPA5kn27o7X+2Z2dz6CXKDT6URXq1UqGAw+Hg6HDB4V4qj8rAsh9N1uN9rv971KpTJ2Wk84kW2322csVv1BYr+gEGMo8Foul7uWc6w+NJvNjKIoHXRVOgMg74K8AXLdFWm73a7BujpdDh3rZH8TCw8JLYlPSFutVh7NG10feigUetA0bcEDxZTiDFU0L+QN1M1mc1z7SBoIBGrkcGkSiQQlk8kTWSQS+SP7D3CzJ76c3A/yi61kodOP6XSaYrEYzWYzWi6XhiybzVI8HjfGLLeDNGxoWpohF8C50CXgwMK+r0gNCuQTENnyitQgRT4BQSOlyFvrKsRdCapC/uPuFqR0G1IZExfkH94NSzkHkk+Ap4wNUiTqPvmH74gUDoe7dOYWr9dr13M5sfNxBnjQ7/dXuVwuDGHG7ieOr9Pp9CTGzudzQz6ZTMgJ2FFtMBh8HvMpx0Ro/UEeBQq2slgsatw/uoxMsBp5A64WG+bgxE9LpVIPpUWDrgv7csUE4nEdlWCNPCC0JJXEF5Wg8MchHs11CWpCVvZVkBfckksyrneHVnMEuQRXitiqPBS4lwpEJYmORkc7Qju0IzPxBZ2t+3mW/JtqAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-fog-open .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAKgSURBVHgBtZe/jtpAEMYH28WJioIa+URDF8MTkAalO6cH4YIiFbk8QXS8QO6oUlCAkGjDtTRHJBoa4nQ0KBZdJApoEAV/Mp9jkAF7bXPcJ5ndtdf725nZWdYxiijDMBKr1SqhKIqKNpdms9mcRxkjFqZTsVjMy7J8x1WdL9WjC6D97Xb73G63m0HjxULAvnI1T+FlMfxBBPeEwoW73Q6we7pcViwWe8+utwKhDFQZ+IOrGr1eAH9ksOkLdSz8Rd5xu1RzBmfdFkvupwz8dmUgBENeYNAZtFQqGVwY9DZSnTVi6+Decrn8h0JYWSgUKJfLHdrL5ZKm0ykNBgOazWbCd9nNt3CzgoZjpUohlEqlKJPJHN3DJHRdp16vR51Ox/ddTiVkw70NlSTp7rRDMpmkWq1G4/HYvmANSpHghXg8To1Gw/M5W1oGVEZD07TvXNy4O8Btw+GQFouFbV06nabRaGRbhbaf8AzvTiYTr8c32Wz2p8KrSuMgJ7x6IEa4AIuivau9tNlsNGm9XqsBY9gxhOvCCi728wa7OCHhRzQAZl2pVGyXRZEoBAoFCDGs1+v2QooiUfpIHE+LBEL+VatVezVfDcp/whYJhAWBVHFvCEFCfz8op6cpORuxJRokajz98tSRae+97OJnUS/RanQLkwNQ4FrzsA2yyU0Gf/br2e12A90LlwYAkS5Pdrm/wRs+/rh1ChAshuV7wTqAQoTAarVat6gorll8YWvzXBXmbdTUcY3/sK/L+4ppmnPeF/9SCGsvAXIsH8+gDthkMFyepyuJgS0GHh3w5NNOzO0zeMHVD/R64BMDP53d93vBORW+0GVnpvmpS0NBXXDDSacwR9K5kxaPok+NUJ8VDlzlQucJvKNj63G2/U3/E78fZqx/rk0w4ggu8jUAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-fog-open:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAdCAYAAABWk2cPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAK2SURBVHgBtVa9jtpAEB58/EqArqCBBqehorgTVDQxPVJOiD5QAEJUeYLjniBcgRACKeQJQsQDBBoqkIigookraC1BwT+ZcQBBsNd7Ovgk2LV3vd/M7PyZgBPlclnc7XZPFovFv91uRZPJdL9fktfr9W987udyuRbPWSajDUgm3d3dPSOhBMaQUaAXu93eSKVSCryVtFQqPaBWXznJNMlR8zo3aa1W+7zZbIo4vYd3QBCEQjqdfjEkrVarzyhlAa4EvOt6JpNJ6ZJWKpUnHH7A9VHMZrNfLkjJO9Ecv3Aqwg2A1osevFs4vCQP5SF0Op3g9XrPflar1egzut9vCNVHzPS3j8EkcCAcDkMgELh4PxqNoNvtwmw20/tUXC6XSRyLqqZ7LS80CgaDqiY8IEESiQSIoqi7B53qE40qqVYsolTgdrshEokAeh9IkgRGIDPTPhJYC8SD4eg3k52RQNQi7XQ66txms+kepEUcjUah2Wxqrq9Wq6h5Pp8/4CUzD1osFuqPFwfnIsE1IBKbyDqANIzFYhCPx+EtYPmCGQxAppJlGQaDAVwLaFlBgRtAx7T/SNGNZWCg1WqpoeP3+4EX0+kUJpOJNiEqKWA49HGusA6gwPd4PMCLXq+nu4bpsK+6LVV9YMDlcqnkPKD7JyF1oFD+PSSHV9ZB4/EYQqEQGGE4HEK73dZdR+Ua6nh4gWXtD3AkfCL3+XzHZ4pfyrekIQnHApr2A2oqn4YM1TvDWkr3xbozPVAxJ0KaH1MRFllSvQG3gYztz7FtOct/mLqorZDhulD2BVzWJKW2kTZckVjBnviM8IKUQBtQ40ck/w7vAIUhnvGYz+cvwpHZbGNHkcQMwtXGnICs9YrCF/Q2GHb4e3IJBxLgo44ACsY6afbT4XDUWd09N+kpqOhTDT55Jf9/Z0b4C/UJLQCcLGi1AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-fog-close .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIjSURBVHgBtZe9UsJAEMc3l1Q0WvAA2NEp1MyInVbGnoE8AVrSqW+gT2CY4QGwpTEFNcaOEqksKKiYcYYP/xsSJoRwx8f5n7nRu9u73+7lbu8waAc5jnM6m81sIcQlqhcoOZTTsHvAZT6fv5um2XZdd6Caz1DBMNm9YRgPMYhKHhx8brVaHu0LrVQqNjx/2wOWlAtnn9MiT4VWq9VHDHii4zXAPFdJsPGPwK1gIwHk7/dC+sXgAsBjroioFZsmpznCuHKLxeIxqqwirdVqvGmcbaOy2SyVSqW1tuFwGJTRaES7CEGd8TJbXOEo4YkjG8BQ27ZT+7rdLrXbbSUcx4+P3oOIVQ4Wr0Cj0aBMJiO1Q6Q1PvsirFzSkeKVqNfrKjM+8xeCybRMbUcrn88HRSasqs2R5kijisWitB+reiKm0+mhaS5VvMwqCdIs1WYKoJZljUmj+NwqobS8D7Wp1+tJ+5EPvkWYD33SIE4S/X5faoOHgCdC+jsdKc5GnJUUGiNIzwrpbjwh76tOpxMAJ5OJyjTwKp7wP/CnvM06LeFzdPwNd4AFihL+Chom/U86/HmiAr4CGOR4M2r0fX9cKBR+8e816deg2WzeRJW15ABPXvgxRXoVPFfiDWbSAhF7iJiXvUyagMmHmZlmGYK/aXn7HPSNAWui3AH4s9EnG8ibiy94DL6l3W8jL3zvetsMpNCEAw4cKGPCc9r8WeGj/YuBMlikP+yn3EGZYjlWAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-fog-close:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAI5SURBVHgBxZZLjtpAEIbLjUFih8QFnBUrJCIOEHOCROIACStALBhOMMwJMlkgBCyYnCDMCUJWrJCQYB+zBwkJFiBe+QvZyEz86IEezSc1dj/w76pyV5dGEnS73cR6vf4SiUQ+HY9HE0MJu5GmaSNcFrvd7hn3vXK5bIU9TwsTw8Oqh8PhzhGRoIf1tSBxX9F2u12FVfVXiL3ksVgs1khWtNVqfcfljm7HgtW5l1Zrbyh4Fo7FYh8LhcLCGRDu2U6nc69YkDG22+0v98DZ0mazaQgh/tLbUUOMHy9E8eH8treDJ8lkkgzDuBibz+c0m81otVqRBAu4+QO7WecerDSDBB3RbDbrOTcej2kwGFAIvNc5dPVTTLHpv9INpNNpyufzBEsC1yF81dOVf8KslCHIEy4SjUYjIxDLDDoGKYAtDrNW13VT7Pf7azOOJ6lUKnAeySLB7jVIIezmMAS9A/igxIIUwns3VBQ+HpFCLMsKnGcjhX0CKLF2MpnQcrkMXIPzuX+KKax9phthtw6Hw7BlVqVSGel25wntqqy02WxOFnLj+xB6/HNTwmdXTqdTGTHmfKA7lhKSxAOCbPr9g90n82X6AcGfTgVxUTngtKlD+J4UAw/2S6VSzulfJAe8SZ3fiNRiQbTgHvgvI0H4Gxb9IAVwTexVmHmmQbiCD1suHy26En7xaDSa86p/A4ttrpuIT3ohpLcTxw/tAWJ9vzUaSWCLm3DXZzS+z7hELFzYjX/i8fiTu9T04x9LgQk+PbvDKQAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-wiper-open .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAALxSURBVHgBtVYrrBpBFJ0FFAqBqCIrUXRBk5QaUleewBBIlwSDoW1CUlzz0CSlaJJHA8FgqMBg4CWIKkpRuEfQCDAYAvSeYYfsLgss6fYkk5ndmXvP/c1HYjaQTqdjbrf7PQ0VarLWgBW1Cdput3tutVrdW7qka5OZTEZ1uVwfaBhj9jDf7/ePzWazwe4hVFVVPhwOT3cQnRFLkvS20WjMzRMuCzKFyH7/AxkAg18oQp/ME24LsgENfcwBkJfvQqHQejqd/jr905HJGpnMHIYW3iHGp5AS2df/QabpfiKHfCdCVCN1qh1hv9/PIpEIi0ajLBgMskAgcDZfKBTMYjJVL8+nh7MeS/8ioFiQbDYbtlgseA/lXq+Xt9lsxrrdLkulUmw8Hp/poLB+JC+rkpa7FysiKEokEpyo3+/zBiIrr2EU1kKmWCxariMvsy46IRJWZFBSLpf5GApgvZUSYLlcstFoxMfwHnKQN4Mi+cYdDoe/IGpmslKpxJV0Oh223W7ZLcTjcb6uVqtxLxFayJtkfSga2Sycy+X4YnhlBzAQhGI9euTRqnhAaNjkKA5Unl0yALlD0SC0Au12m/fIvx5nRxsEYV2lUrHMgxmiYMwGwmiE1qzDrSiKSv0r8QMxF2Wdz+fZer3mhXAJCP9gMOCGAiBJJpM8h6jqXq9nWO+hLfGH9ohiVoTFIEbxwFqECMoQInwLy4V3mEMe0SB7YWtMJJzoVK7fLnkgKg65BVBM8Bj5gjHwDORoGNfrdUMu9SDnfl7d+HqAEArFCYNQYoxtAODfJSIBimTWpV2Swxt8PLwiRAgjGrwXuEVGmBNXw6MxP5KXMWYTCKs4U+2COH6g59tCu6uG7A7AYxteCcypVU+EmgVZbcJxkO4HcmplIEQuMcGOTz8nyT6T7on4Npw0mMBzgDnkqUZWNfyzWujQM/FB79lVQh2xeudbZ0VE36mvipzdRagjjtFtnSBlr9nxuS9uGCidk1HPdFp1xcvsGv4CcbeEIeSIw9MAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-wiper-open:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAM0SURBVHgBtVa/SyNREJ7dBLVQELU4bdwrtFJOUCxsXEG0Ue4OK6tLKhEb/QsO/4LzChVtvGvE0sPOxtiYJuFyJBBICtOlSSAQCEnIj5tvyC676ybZYPLB4y373ptv5puZt6uQB1xeXup+v/9zs9lc4qHxK621VFAUJYbRaDSeDw4O7rvZUroQBXw+3zcm0ckbMkx8enh4+It6IWQijYlueiByI95g4oxzQXW+OD8/X1JV9e87yACNbbxeXV0dOxcUJxnn6okfx6l/OOHcnr0hhIzsFcg06jNa8obwbErKOfs+CDIhUdUbxrhJiGrknAW8HB4bGyNN02h+fp6mp6dpcnLStj46OkpbW1vOY1q5XJZ8iqTX19dPnYpkZmZGSObm5qharVI+n5cZ5ENDQzKy2SxFIhFaW1ujTCZDqVTKaabA+z4qrdy9uhHB0PLyskSTSCRkVCoV16gRLfYODw/T7e2tOOQE5zKocmRf3Mggzd7eHvEtQnd3dxSNRl3JgGKxaEaE6HEO553gOllXuQ3W3ch2d3fFyMvLS1siKxYXF0XWh4cHOYfzUMgKpE1t3Y026LouhxCVF8DBhYUFcz9m5HF7e9u5VUOV2pp8dnaWpqamPJMBKysrEh2kNRAOh2VG/q14c7XhILzb3993zYMT2IOCcTo4MTEhkqKgrPCx1gGePxgv6vW6EKJYNjc3qVQqSSG0A+RPJpPiKACS1dVVaQ9UdSwWs+33c6n+47ZYchqKx+NCvLOzI80NiWAMEkFyeM75lx5FdFhD4SCXIEJluxRbTLm4uDjmcv3RLgIYgrfILZBOpymXy0m+UImIDLLCATyHQiFbLq1gB/90bHwrcNPAILwGAaREcz8+Pso6CNsRGZDGx0eS8xXqRgh5DYkgIwZuFQPdyGACfwJ+PHGhnHKUOnkEetS4U72Co/uNWdoC3yovUVqBiD1EZW4fGRk5MwkBjjKIBRoAarXa12AwWLARIpdY4McC9RcnR0dHZjPabhosMOkG9S9S2/8MMLDfRKhljawjoYU4wNXby79OgavxJwrEyFlPhBZinasYH+pPPOMaNL4wMJphJZ553Bt/Zp3wHwTYnvHjbDCuAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-wiper-close .jb-pro-ptz-focus-icon{display:inline-block;width:28px;height:28px;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANOSURBVHgBtVc9TCJBFB52r7jYyCXWnhcbO1aru8RErjGXWBxX2BijGG1svNhJo56VhQU2ViQsgdDQYEFDc5rQ0BDoaMgRGhoKaMhdCHDve+6QZVhgMfglm9mdn/e9v3kz6xEusL+/79c0bcvj8fjpc8V6gCY9VXqK3W73MZFIpN3I80wj03X9il79wh2q/X7fJAXvTdNszkQaDAZXaHF0BrIRcvLKERE/OQ3qYwh/06shXg8vRPl8PlEqlZ4nktoIV8QcgBxwItbfitBOvL6+XioWi2XZp8kXIryaN6FNdpSM8spvthRWUmPaJ25vb4vV1VVRqVSGBCwtLYm1tTUeW1hY4KfVak2hFe+J+B+5+QkfnL2Hh4fI1KAq/OLiQlxeXorl5WWxsbEhNjc3RbvdFrVajVvMkcTlclmk02nRaDTGETfJ1Z+wlTxWLP84zQoEAkwEodlslh+QqZDWY36hUGByp3m9Xu88Ho+HNaokfidCCAIh2kgkMlYQAOtyuZy4vb1lBW9ubnidCioa37klkw0nQrgWgpLJJMfXDUAOBbEO66GAAkOS+tSRk5MTXgjr4FIAMXULrIObz87O1CHv8fHxR03thXAkDhbahezt7TlpzkA8sc7uUngIQIhUgNRr70AWQsu7u7uBEPTBdaqboQTcCIUgXL4DUBzjTrHVDcP4BmVlR6fTYVLg9PSU9yC2CIghEG7HHIC2GluJOGYyGR6DYiDCGEKD/iErNS2sU238QnH9rGqDopDP5zm+EIJ3aL6zs8NEUAKCQSiVwxp4BFaHQqGRwkJoRqPRkEZ7tCjGAAJQHED28PDAVkirsX1kUcAc7FEXWc5c7+iQTltnpyMgHNYgUSSZBL5BhqTBHkVMAZnxKsijMbQ6Vf+/FFe/mFLs6/X6IJZ20t3dXXb34uIihwFuTqVSI3Mt0nPia3LtpVLot461V0FWLiiBZwzMWCx2xOSy5+DgIEya/BRvA1xfvlKxr+JjUBwola/Fy81u7iDCX5JwiJSPHNJm3sQWoTnUp06a57XFIrxW+0dug8guutM8EvEHpxPIJRDDH6qFA2UmrSSrg0SO5HJLjhDdUxue+bLtQG7QqR8ggVvC4beCFHumRMSxVJxEJvEfnFm91YrgD/sAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%;cursor:pointer}.jb-pro-container .jb-pro-ptz-wiper-close:hover .jb-pro-ptz-focus-icon{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANwSURBVHgBtZa/SyNBFMffboJaKAS10SZ7hXqFegGbCyjmUPTAH3eHlZWmULG6u/Kqi/9BLEQRIdoKigf2l1Q2ChGtBLmtFAQloPgL1HvfRyZuJhuzBvOFzezOj/eZee/NZAzyoMXFxYjf7+99enqK8GNxlZVtyhiGYXOZ5vo/MzMzW17sGaVgPp/vN2DkTbZpmqs8wfloNJqh10AZZjEs8QpYAfzx8TE6Ozub9AQFkGf7l55dWLbYTmxqamruRehbAl8CG5UEOvTNmWSmekHCVAgIJVgB9eHHD1bJSTPp7NXe3k68Hejg4CBvdF1dHTU0NFBVVRVdXl7S/f09nZ+fl2BS4Pb29geXMXyIe5eXlxM6FMaHh4dpY2ODGhsbybIsamlpyUFQog/geE5PT2l3d5eurq6KgTPc7x22kpGN5T+3Xl1dXdTa2ipGDw8P5bm7uyvoB3hTU5P0t22b9vb2ZFIu+smxjSOmEbfW2tpaAcJgMpkUQ25ACG4+Ojqi7e1tqq6uprGxMRmvi8P1BaXJLyE34MjIiBja2dmhzs5O8iLAMUGMw3h4yCkOobDYs+YHfXAkEpGBWJ1KJMTUqzAObh4cHNSbAisrK0FTrw0Gg5I4GKiEBAmHwwUzV2pubpZJOV0KD0EIkS6TlxxwViALMcvx8fGcEdQhKzs6OvIGYxLIcEwIxuFSvEP19fXSjpzQ5RsdHf3M5XtV8fDwIFDs0f7+frq+vpYtAjAMwu3oA/X09MgqEcf9/X1pQ/wBQhuyPZ1O56/SNOO+oaGhMAM+6rM5Ozuj4+NjiS+M4B2ZGQqFBHRyckLd3d2USqWor6+Pbm5uZAySqa2tjdbX1+VbU2Z6evoX3JumIoIBHA6ATUxMyCl1cXEhQOxD1ON9c3NT9qjufl2K5a+pqdliA4liHWEc7kOiwMXOvYpvwJA02KOILwS3FoGuoTTlWDKMJJUQ4qwfDmoyAwMDkkiYIBIOsS2iJH7k7MW1JPu3VpbUyYWVw91u4oWtcjyjOSi0tLQU54bvVBnh+vKJry82PnKHAydFDI1UATFwTgHzoIgtZvPW4Cxw1VlX0YtZFhjT6wvOXrgBK+ZnjcqXimHMrbHUZXuSV43kCpE3IUTzvPfjr75s61pYWAgx/Ctndy9/WlxaCsKPzZs+xc8Ww9IvwZT+A8hTw5fcMmXrAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-ptz-arrow{cursor:pointer;position:absolute;width:0;height:0}.jb-pro-container .jb-pro-ptz-arrow-up{left:71px;top:15px;border:7px solid transparent;border-bottom:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right{top:71px;right:15px;border:7px solid transparent;border-left:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left{left:15px;top:71px;border:7px solid transparent;border-right:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-down{left:71px;bottom:15px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left-up{transform:rotate(45deg);left:32px;top:33px;border:7px solid transparent;border-right:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right-up{transform:rotate(-45deg);right:32px;top:33px;border:7px solid transparent;border-left:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-left-down{transform:rotate(45deg);left:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-ptz-arrow-right-down{transform:rotate(-45deg);right:32px;bottom:33px;border:7px solid transparent;border-top:10px solid #fff}.jb-pro-container .jb-pro-loading-bg{display:none}.jb-pro-container .jb-pro-loading-bg,.jb-pro-container .jb-pro-poster{position:absolute;z-index:10;left:0;top:0;right:0;bottom:0;height:100%;width:100%;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jb-pro-container .jb-pro-play-big{position:absolute;display:none;height:100%;width:100%;z-index:1;background:rgba(0,0,0,.4)}.jb-pro-container .jb-pro-play-big:after{cursor:pointer;content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;width:48px;height:48px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC");background-repeat:no-repeat;background-position:50%}.jb-pro-container .jb-pro-play-big:hover:after{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==")}.jb-pro-container .jb-pro-recording{display:none;position:absolute;box-sizing:border-box;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:101px;height:20px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jb-pro-container .jb-pro-recording .jb-pro-recording-red-point{width:8px;height:8px;background:#ff1f1f;border-radius:50%;animation:magentaPulse 1s linear infinite}.jb-pro-container .jb-pro-recording .jb-pro-recording-time{font-size:14px;font-weight:500;color:#ddd}.jb-pro-container .jb-pro-recording .jb-pro-recording-stop{height:100%}.jb-pro-container .jb-pro-recording .jb-pro-icon-recordStop{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-zoom-controls{display:none;position:absolute;box-sizing:border-box;left:50%;top:0;padding:0 3px;transform:translateX(-50%);justify-content:space-around;align-items:center;width:156px;height:30px;background:#000;opacity:1;border-radius:0 0 8px 8px;z-index:1}.jb-pro-container .jb-pro-zoom-controls .jb-pro-icon{vertical-align:top}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-narrow{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-tips{font-size:14px;font-weight:500;color:#ddd}.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-expand,.jb-pro-container .jb-pro-zoom-controls .jb-pro-zoom-stop2{width:16px;height:16px;cursor:pointer}.jb-pro-container .jb-pro-loading{display:none;flex-direction:column;justify-content:center;align-items:center;position:absolute;z-index:20;left:0;top:0;right:0;bottom:0;width:100%;height:100%;pointer-events:none}.jb-pro-container .jb-pro-loading-text{line-height:20px;font-size:13px;color:#fff;margin-top:10px}.jb-pro-container .jb-pro-controls{background-color:#161616;box-sizing:border-box;display:flex;flex-direction:column;justify-content:flex-end;position:absolute;z-index:40;left:0;right:0;bottom:0;height:38px;width:100%;padding-left:13px;padding-right:13px;font-size:14px;color:#fff;opacity:0;visibility:hidden;transition:all .2s ease-in-out;-webkit-user-select:none;-moz-user-select:none;user-select:none;transition:width .5s ease-in}.jb-pro-container .jb-pro-controls .jb-pro-controls-item{position:relative;display:flex;justify-content:center;padding:0 8px}.jb-pro-container .jb-pro-controls .jb-pro-controls-item:hover .icon-title-tips{visibility:visible;opacity:1}.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-face,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-face-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-fullscreen,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-fullscreen-exit,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-icon-audio,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-microphone-close,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-object,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-object-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-occlusion,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-occlusion-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-pause,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-performance,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-performance-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-play,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-ptz,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-ptz-active,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-quality-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-record,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-record-stop,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-scale-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-screenshot,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-speed-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-template-menu,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-volume,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-zoom,.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-zoom-stop{display:none}.jb-pro-container .jb-pro-controls .jb-pro-controls-item.jb-pro-speed{padding:0}.jb-pro-container .jb-pro-controls .jb-pro-controls-item-html{position:relative;display:none;justify-content:center}.jb-pro-container .jb-pro-controls .jb-pro-playback-control-time{position:relative;justify-content:center;padding:0 8px}.jb-pro-container .jb-pro-controls .jb-pro-icon-audio,.jb-pro-container .jb-pro-controls .jb-pro-icon-mute{z-index:1}.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom{display:flex;justify-content:space-between;height:100%}.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-left,.jb-pro-container .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-right{display:flex;align-items:center}.jb-pro-container.jb-pro-controls-show .jb-pro-controls{opacity:1;visibility:visible}.jb-pro-container.jb-pro-controls-show-auto-hide .jb-pro-controls{opacity:.8;visibility:visible;display:none}.jb-pro-container.jb-pro-hide-cursor *{cursor:none!important}.jb-pro-container .jb-pro-icon-loading{width:50px;height:50px;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8BAMAAADI0sRBAAAAIVBMVEVHcEx4eHh4eHh4eHh4eHh3d3d4eHh4eHh4eHh4eHh4eHiqaCaRAAAACnRSTlMAikwX3CxpwZ7zIGi5xgAAAZ9JREFUOMt9lb9Lw0AUx2Njqm4iGEqmEnBxslKUdhJctFMVcW5wKZ0CLpJJQRw6iVqQbg3FtPdX+l5+XHJ3796bQj557773fe8ujtOI+6jz5p84dHjTkYD4+RhT9CIRZWRPJr1bChnbY532GhT4oUpbI6HEuqvgIH9544dh9J4/rpr0Ms8oV3zMNT7X1MXSmaznzfHjM4n72moe5n8ryYrW9rKRvgf0S93JA7yKa9lbzUg3keJb8OVCtwkrFmoO4MnsAuj5rGqnZg+GZXUXkl9NjEui9n3YA9XgpMgakLXz6ujMTIgrCkPVv0Jil8KgKQN/wRN69hLcb1vrbR2nQkxwiZTGQ5Teb7TO8PUaS8Q03sE+zkjP8qbjzgJtEhRbV4gnlkOFeM7hDYNdxPbiYFvKSHN6L2NmY5WzMYPtplZdTxncRvn2sI+DHIoug22jWMaA12Y7BrXzrG8BX32XPMDKWVzw1bdMOnH1KNqNi8toqn7JGumZnStXLi0e4tcP6R3I635Nc/mzsMxl9aux9b78UVmn2pve8u6eR50j9c0/ywzyVl5+z84AAAAASUVORK5CYII=");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;animation-name:rotation;animation-duration:1s;animation-timing-function:linear;animation-iteration-count:infinite}.jb-pro-container .jb-pro-icon-screenshot{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEzMzMzMzMzMzMzMzMzNzc3MzMzMzMzNzc3Nzc3MzMzMzMwv5ahDAAAAC3RSTlMAW+8S2UGVwyyZnOTRhEMAAAEfSURBVDjLzZKxbsJADIYdBQpsSCyVMlXAdEuQYGKpWFk6dWHJgsQ7sMDSpUv3PgITAQT0f7ly57ucQ45KXRAZot+/89k+X4ju9KzL4XOhlm3pR0enYrWViSRPXQIQSASkRSkIJEFRimYCuQAHSW89IOv6SH5TCsuAj68Ab1wDzqkAzqoC7AUAPtgsABgkBBgkCJiNHehGok//KRVsHqd+3Dj1/vukt3AH/Jj05s5/AmyZhFVWXDls44iVvfQWkCvgxU6g9ZdJfCLvjJbYaT3GvjOY4mQSG3SJGjhr/Y1Xohp+TGKqqzexZ/1GVGdNCitt6R8zVvb9d+JmKdl8o5sPWbtxT6zFuJcDQtk92MNmYiXHquYlZlVt1j4P6cd7fgHFW7Nhqu29TwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-screenshot:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEz////////////////////////////////////////////////////////NXt0CAAAADnRSTlMAWe+X2TINXUYZvctoYyuS2NgAAAEVSURBVDjLzZKhDsJADIZLCAsEg8WgEGCWGSwCgZxB4MgEAonB8wQEXoBH4BEWXgPJgEBG0mdgR3u77raRYAgnlq+9+/t3TQF+dKbZcJXSYSnzlViT457lRScKmBqILSFA3GoO8S4E+Ex5JiSJ4CbVdyOQdZNomX9D4dl+ko3NC8vFFmhPy8FIsi0ZlwLBW/LY5BxYYreUSgoFAEmhB5Rc9OCbUoXmTmDadQKTn4y6A/XTaoSKdb6KyGU6RJ7eHgpb3ABinAoil303xB6vQnRahNhXvMdre+fzOgxVrokX4jHAnBh8PALU8Eq8BqgTg/vePF8tpuPy9/NFaalSc273RizarYqfkswjifNMQ/TyTGMv4v87L+ks5gqDbc9OAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-play{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzMzMzMzMzNzc3MzMzPz8/Nzc3MzMzMzMzMzMzMzMzLVn6fAAAACnRSTlMA+duduRUwSGSD8toSsAAAAI9JREFUOMvV07ENgzAQhWG3lLSp6MwCViYIRSpG8AiM4FWMaPymDBKESMF/cQ0S136F353vnLuo3gp1kOYEoCXW4LFKIZAnqAXYICeASoAdzgG+cApwgF4EfwF+oDkCqIwA6gnyAKA8AaizQhsBAjzuqUHofInGIQbjRxXjMrTJuHDestR4Bng4eGrN0929PqNfzC6h06weAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-play:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEVHcEz///////////////////////////////////////////8Uel1nAAAAC3RSTlMA+rbVFUecgC7rYhEEz+4AAACbSURBVDjL1dMhDsJAEIXhdeiGpKYWQVKDWc8ReojFc4ReAlPFFQazad7lIGkb0jK/WEPSsZ+YN5mZEP5UrZIP0vgE0Kv3oPlIJlAk8AJM4ASYwAkww2+ABfQg0ImgugPYsfNBVl99kA0AsjOArAPQpRTGHiBB8whxM0y+3skXNltsvMYriIWrpWPA80mFJ5qL3gAfB1/tcAt7rzdiV+HEgs1oBgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-pause{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEzMzMzHx8fMzMzMzMzOzs7MzMz4IlKVAAAABnRSTlMA6xIU1hVqIuOVAAAAMUlEQVQ4y2NgGFYgLS3RAEQziQFZoxKjEqMSaBJpEAkgIw1ZQlBQRAEs4QhkDeIMDgAWx1gMHyIL4wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-pause:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEVHcEz///////////////////////+3ygHaAAAABnRSTlMA7OgSFBXMmAA4AAAAM0lEQVQ4y2NgGFYgLS3JAUQzi6WlJY5KjEqMSqBJpEEkgIw0ZAklJSUDsISikpLQIM7gAJjhWp6XcaOxAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-record{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAHlBMVEVHcEzGxsbMzMzMzMzLy8vMzMzMzMzNzc3MzMzMzMxEZ/aQAAAACXRSTlMADPKKKeBxlV6neZ4mAAAArUlEQVQ4y2NgGDZgJhpowCURAJeYpIQENJEkCgWRgCeShAGyjfgl2EqwS7BFToZJiLg4ICTEImdOh0pwRM6cDJcIjpw5E6aDFeh8B5gECBCUYAkKCoMbNXNSOlyCgUEQ4apJJmxIEkjOVWFgxi4RgEsikGQJnEYp4pLA6VxUDyJLIAUJcRLIwY7qXKSIQvOHWCQODzKIleBPPjgTHM4kijNR48oGkajiYUMykwMAAfmZhUjBISQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-record:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMA8gyMLeRw1x2DBpWGN2QDAAAAt0lEQVQ4y2NgGDbgDBpIwCVRAJc4KIgEZM4EwCU2KSEBHySJCcg29iBJGCBLgHUs24FdYlnNYZiESksDXKJALebMaagES8yZw3CJypgzZ2A6WIHOd4BJgABMgh2XBEtpaBjcqDMHs+ESDFyLEK46aMGGkEB2rgQDJ3aJAFwSUSRL4DQKp+VHcTkXxYMoEkhBQpwEcrCjSCBHFJo/1GIO408MOJMPzgSHM4niTNS4skENqnjYkMzkAEgzyFpeX6L3AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-recordStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAOVBMVEVHcEz///////////////////////////////////////////////////////////////////////99PJZNAAAAEnRSTlMAMPndsnZj1CSYPcmL6wsdoU80pOJLAAABu0lEQVRIx5VV26KEIAhMA++p9f8fezatFDPr8LSrjMxwiWlqzRuMYKW0ENH46c3WuGyVLXEduuO83UyK59fl1jX5EEUXD9DOaSh43XEP5zUIdZ4pAecTofVnWSt3ip4rx7N61vjnY1D30CpH4QQR8vsP+RA5Rs3KpjfMU/pMim/LgbvH7DF2F8sU0owqapKLqgnhuGWwImUagn2zhUX6WQQoYkXG9WxSAJd700/ygsCpAoliaDsPiG48GM1X5Ft/06sfp8DrDE+3DpekWjxM6366fgEcnklC+AIIWYQmPEeAaUmjFOnhCLDfxZRH+w1gU5b/DYjfNcyJ0p7dxX8B+FwxQVtvAGB5ig0d5gFA5KbzS91hI8CenvlHflfN/XvzJQnxbBEko1gbvVnPii+FadSVRUEaYylQfJtpLB+aRG4LY/80yKdUbCraM0lozGR4ewZ0Wtnj1iC7hjWKNnjYmR62W15cLlL3+2pyMR09jccyuyUrHKsvthc5xsY1iWJ0Xk3t+2XP7AnWwrAQmBH6asXubmL1Z5Lz6o992jWiu9lnMSiQsK27FS9NxhCumZgB2fTBPFsFolhZr5B/D3o9sJAI6skAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-recordStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEwimP0imPwimP8imPwimP0imPsimP0imfsimPwimP0imPwimf8imPwimPwimPxLmg1rAAAAD3RSTlMA15sisGUvdz3szYwMT8H+hDJEAAABx0lEQVQ4y3WUO08CQRCADxBQchBiMDE24KswFlw0Wtig/oHzUWglJBZWio3GDjUxlhhrEzT+ABMrO2iptLLVRluDggI+xtmdXW73LkxxNzvfzuzszNwZhhDzdOxqaPGgYrgkOgFczh90ezAJQmpL2v6OHYnqk2aWxOTtAnu/O/Y5XNZXmTZjo3ot7aESwLdFeqAM0MoJkMf9ltwVQJ9PcQN0UFIJogvdJgLQVFMsAlxyBaPmVBDCE8W7qd+2SDsx0q4OwhSrCG134W54jDfKLjDNxaL8/9AAMM/solptRnoALBbwEPWYrOEzLnrZsTGoMW+fBHG2SiLPUNI6KMOH8QS/XsCMBYQekIEv7NGZF/Rht2yqmA4i3UG9O0iTqgMfhirDhRdU8XJZqqEO8tDAqje8IIt1r+I5HmBjfD9AxQ1MgJQRpc6GJRALHOAS1WRlhMs4VaSFzwIWzCUF3op71kdNsNs/FDCuA58YqCQl7IhN3WbDnlLtfjnuON515WM17c7w41QPOuBIzDT5wqi0T4ESGV3gjtTjkuPATwHoX9+cPRlmmvJ57YAir2qKy459QL/UhrS/uAu3xf8KiX3DI+b22t6jc9F/qfaum9E1pJ4AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreen{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAALVBMVEVHcEzMzMzOzs7Pz8/MzMzMzMzNzc3MzMzMzMzMzMzMzMzMzMzNzc3MzMzMzMxdHBitAAAADnRSTlMA8AwGYt0aUcg+til5kgmZywUAAAGWSURBVDjL1VM9SwNBEB12IcGkMagxNktQSZFCYimIJAqKpZ3Vco3YBYs0NkKQgBg4ECtLFSFVCGgQrERBsLayPE0Ip7n5De73BdKLTrE3ezPvze6+GYDfsAQKy/Rz0i/OZJjY9XREuohTKulS+ZFGiADfyZXU5uHktI44VH5apDx554aXwJqloiIwiEsStAjCAsRNF1jCmGqa4Vc+BvS4JkjwzyPE6xiwzsxxeTbZxqjkANSWZFkoIj5bQBl4aBDfkPDNpeRRialB+SRAFz8UU1sAaEUjSCDoJ7iukZJ1V+c01bFczM1pWaa+a0Rp7MHn4V8Z1R9vLLCv9WjKdVFfk77JP+bZdz35YAfKXx6KhKp93abUYVbrj49g9aAYSuFCLbPUwzdCsYEWTloXgw1oGwQbENeuKwxzXhxwAADRMFd+zzRc6AAASY6RH8VjUHaXTrlOpDgCUP3gelc01e2d+f16cWbnQ46BGCRNVsWAWQJVw2xGfUXVv2k1OsLfazXqblzS99u1FwKFvBJioXBY2+r82U75Ab7O0ypVV0wKAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreen:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEz///////////////////////////////////////////////////////////////////+GUsxbAAAAEXRSTlMA3clDHfdfDQbsVG00u4Cqkr04dRsAAAGaSURBVEjH7VXLdsQgCPUBAROdjP//s1UTDUxsz3TRTc+wC94bHsLVmP9hkE8LIdvgupt2tFhcpy2CMZyVxNePEoqDp4hwEGz5PTqWoZNzLrmD9riltBEYzzpZQ8bweXy56Qy6Tivsp5JQYtawuMH3eJlSxIJtdSSa4xer4lMB89pK23mKrwjZVpsRzLq35vEE3+r26h6w5EKppcp3fP2lIpTPWJvoXoobeNI1sM3haHvx56tu2sdElJ54GbnPQ7RZ1sCpl8qPEMXBNQ8vN82jNbzLCPzGSDOZj/2Bqd19R1rELIEbDFrUJfKYdlALbDuDMko/hz7t8DqtCfr8h1Vt4rn7eh/6Ph37ch20aW8McsfGCOXzcr+GOlQG1rJ2HSHUDO/4Mu01qVAqTCpCJfgZ3phTS2pKm5aZOMUbs7Q6nk6L8UzRh6W78jH+gD/VRxHokPuNgUGTaPPR+zDR1mrlvcGgwkAVacSbeoN4Z0rb5/6XLrW/2GTLk2NhXHRKzrqAt9cD4rr4ddvae0NAYgOICdZyvPj4UYRf2BdfbB8iWvnTUwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreenExit{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAG1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxi4XDRAAAACHRSTlMAf3WqJmy+7azWNnMAAADNSURBVDjLxZQ9E4IwDIaLfMzCOTDSOz07OjLir5CR0dmJFVHIzzZtnMzbOzcyZHnuaXpJWmO2ji4GhpAzzZeQzw8FKCj1pMHss9OgpwsGOS0YGOcVUMPsfBVkmJoVCBJW0FFB6SFIaMKAlRGDnEiDkuM00lP3SmL6H5QSh+iIr9ZWVWntUV9Z4qWbHAWrhcUYNLC4Wwm3xb1r2mOQYoVn2EKFAVb81KHiQQq6L3vSUoMBUmSzgCKbVeiL3eTp3Odf8H1sxRAZZNZt/Vt8AHcPQbiQQVF+AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-fullscreenExit:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAe4Fzh7MZbKPtN8gpX19xAAAA3klEQVQ4y8XUIQ7CQBAF0CWhKQHDGtQKQFcURUgqEARBED0Aoqp3IKnoATAEW8MNOACmhQYKcyi6uyjmr+aLqXj56bSbVoh/J3HBxcw0ZfA2c3FiQLGeQcWh1lOVDDJTAeCbCgAR6QqCDj0xCEU5Bl2BIALKMwhdKjGILRUYfCIOEynlvABANk64M5jabJxHfJY2I76yzYu/ZCc0s1WbNYAQ3jxqwMoGHoqWGHpUQajEgcYYcKWFtjLE4FGJQewoxODRDQOqKPPcHl9sfzSXa/0L349tEDsOsp/8+2/xAY+BZBY9KhM5AAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-audio{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEVHcEzKysrMzMzMzMzMzMzMzMzMzMzMzMzMzMzNzc3MzMz8gU00AAAACnRSTlMAL0jMZKt96hGJsSKv1QAAAJ9JREFUOMvN078KQFAYBfCbJEw2q6SUyWxTnsJT2JTJ6D38Gb6n5PpT6BwbuaNfTnz3fEp9fZwAP7czD0MsGCzBYJcEYsGwBEHQQRB0EII1CMAWdAOzyJUvJ4jyDVyZVHKGpj9guEI2IuhaDFadYnCkIm9I+kPgn8t+kI7kOsT72HcwQnJR9Gofy8DrwwtHK8pLzdeALg5fNb6cdJ1fOjOGYrl5CLFcggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-audio:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJ1BMVEVHcEz///////////////////////////////////////////////8NopmKAAAADHRSTlMAL0TQf2frEaZYt8E+idL4AAAAnUlEQVQ4y2NgoDdgUcAuzr4Hh4TaGQHsBp3BLsG+BoeE2hnsEkCDsEqADMIqATIImwTYICwSEIPQJFhnBjKInUGSUA2CSPCcOcIwB1ki5xRM4iiDDrKEzQlsEuUF2CVY0jbgkDhjMLQkEkj0IM4gQQ1EHMHOOXMiakRpTiQQtXgTA+7kgzvB4UyiuBM17myAM+Pgzmq4MyfO7EwjAAAEf+BAxqI/agAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-mute{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEVHcEzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMztXryaAAAAD3RSTlMAHd4P7ztyiy1OnKhdx7uY2gyAAAAB8ElEQVQ4y72Uu0vDQBzHE45C3SJFaSGjUEiRpJRCBifXokkpSv0DfOBrEKxUUSoFH9ClFAUfU7c4OARRCs5WjThIsJuDlLo4ldvPe8SYxGyCt1zgw+dev+8vHPcvYybvfCR2OgUv2CoLdI62bUn3gq5UJxOomZofXPUNrIChJRklfcDSiKK2bYQ6PiCaREk0EQoYPFYa3F73F+DGsBJLmAjBAMBKakG15KAxqIhd2KuK5reRccBDNbqGJhfSlnNc/kBh4OY+vaoR5QrRC0afKgxMrKdXNKI8yxRENpyd+i0VA6wMm5IOBmORCwfAFjGwolofevbuPrvpGhRgpVaqiJflrLuUQQFRToS9l894EMDe7q6yL7/G5wMATc5mQCiAvQo3HAbwLtyYHQZgTxhohgGUa/CP12EA16W2/Ou4ZEj1dNG9oPMkZGiwJWQ8j+huPoJy9Z/XHTfUFSbAURveCtE5px5vs7hQDKS25FSDn2KR5Up1/lRmIHne7BvKd82LMRJbSjr5M40lmaYZ5/PRpiCpizjJyk+CwOGOzACLpSdz02QxkiuRhd8dNOwkV7zl2YX1mcySKJrQiPkXY9klSt6rkJPRwIlmzrcWSGyzHuTb11V/N0y/S6SdwdCR4m/47OIN7XOQCfwJwHGp8IcfyRdBLEZK4Uxp6wAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-mute:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAP1BMVEVHcEz///////////////////////////////////////////////////////////////////////////////9KjZoYAAAAFHRSTlMAbk2o8o0P5TsGnVojFi/XHcV9urLaq0oAAAIQSURBVEjH3ZZZkqswDEXxLM8T+1/rkw0BuwM0f131+IvDyZVk6SrL8p88QCHp8UAnWmoWoG8AwQRN4/vOiqwUuwWqiob646MMhEW+KnMLMIXffgiZoODBusb7kCzjByF7OOszkOyp4amJ7fWVPwCN6BpyWRypvANPCvi7u4aTXe13YI+KkYA5bMRTSMlLnSyGwisSH40B0FJOrKVB6iAw2U7sGgPgQ/DTPQjitCOZT4Q6gWCtGwGFbSM34ENUNSpAKTACmC31rnRgJwjDdkFAJpfkAsZcAJvCSVQB2FaWWKdB/ATMAHwIUYL21lRBZRDiC5AnsBHBUqxEyaraFMoz0AnvHNa6xDWS34FGgNf6PYAEZoCt+BroUWFVbeb5HbCqSvB2cToyca+Adjlycdawt0C/HeyScl1W/w3gsU3aAd7JF8AuAN6isr7NAogXAFeq59Ec7ifAm49hF8wCMWfVNXAeCAkjEGuBr6R5ZGJzBrl4gGniBME+w8aMMyCsNZtfaemnmYaAQ6I3Rz0fnDhHJxc93Vrr7sHWjP3XRtTba2L3EkdFVaPC6YmXxKI9DGF1YPLdiwfD2r37cL5nDVw+uKzU5K27hsXCXPtyC2uyyl0D0p2TY7VaIvFYWU0Dm8TdOXmrVp52HG4lU4K/N38PpS/Kw70dbmb/sC0WCcQwNNzzjrzUj7veUyIIyL/4m/EP8V829O8zh5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptz{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAM1BMVEVHcEzMzMzMzMzMzMzMzMzMzMzNzc3MzMzNzc3MzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMxDm1AzAAAAEXRSTlMAHqw+E8It/gjxc03jhGDTlgAjE2kAAAI6SURBVEjHpVbZkoQgDBwg3Of/f+12gtfMbK1Yy4NampCju4Ov1y8ruNyyo9fyCibVlNW6vUu29GpWQwTVdPTernqwffHex0WP4Nro3k+PrMKCvew/PcZ95aoNsY9yua+cGxTZsnf2K7ch4CAdGnWwYx/5LgKZCgxGdrhH3BeqNmnwviFXPZbQJmcM25HJ5n7/Pczr2QqksMJfO7BJOHLKLWFdMiL1QXYRwFagMklb4GB1zS7s8Le3fqH7Q28tVLkKdIzeaOJB2OKtY8KfTQCUa4++dNsLbrqpTR7xguHGt8hfg8P+seuaEkNdBjahzOD7g1cHP21SL2LtMNBKMdTRJjffTX1wVgrsEb1ITJU6QknwYJAcQky2cE02NbzPp70KyKggtpu9xM7Ik+CBIqY+8FrYyRUkrs+MEm1TG6tG9LZxNDNFGDue63TYGgIHqUUcuNhvhyZtn5LnlDq3Juxa4noCuX0scErOpNMDCrVcHPCS5rFGuQR9KZpxnB6CQ0ZO+AIBcTPk3UdbTx1L7jLEEHsMW7ZYm8NlIFyxn8+xdL7MURYEhzd5k2N2TabxIAORwC2r00QQfNSgrnqTJfh7cDmDu9ggtV0EZFr7kGu4KAxtNDln406TLwF9iZCIwn9EfjPuncRHYm5x3NfK3cFAS5kWxljSnTFlPHBAUFg5HsCCVOd9cdwXq+027un2QJlMjqISJutCDceRtTTuT4+1Q3HWHR8cu0fh9sGvADTYH9iLah/9nPz5+/MDJnQfoIVoAnQAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptz:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAQlBMVEVHcEz////////////////////////////////////////////////////////////////////////////////////1bZCPAAAAFXRSTlMAeVoYDS1pBiPv4/g6lkzO2qSxvoixscijAAACi0lEQVRIx51W2ZLcIAwcLnPf+P9/NS2wp5xkq0ziF3ZRC3R0i/l8fvi04oxx89n+RBi1sqB38TKw7lw7lNzDa3U0e57bHhJ4d567HlqGC08eLAj9Gv8XD4/OwtsdhlfCW2s9LfWtuNrMhG1uLWP17Xh14LF4m8dx1OJ9jkm85YCYch5JzDVy81on3MFYkpTNYGmHHloYI+aqlNhlh5ZSvmH1AyBUwPcMX+u/clW3XYvA2YgRGXyZIZX6PXv0l3GlV9Jp9FKcK7mytJIg8xEeBdaBtV4P8tAixexnp73tY7ZBkrk9WEL8t7ZUDqtIA3jXa8sODSeUVqw5aztT+g4QeNAgM0PGTA0+EmfVeUvU0CEW4hX+lt/zseE7jJKDSmi0EUKBhr7EAMKPvNjOA9Fz4Yk/CFgcGRSdkYOHCLRxQfzKRN5SB/b5Ot8SzzQiKqcb6ipFdCfi1JI84OBdxzarhJ8RkpxHOQszl7bpn0GpmnXq6R4OfTkwwlyUWzeQg7rSLNhNUzEUEqJF3DMHeeXgqRIaYwHimLKipK8hMZOYVfJ5oKtIFSgXk5z4KcNx3GOIPGYfPigh9YGHBNQKVKbZhxMnqq+OHfWBHARZfWm1dnfSXfJuXInplse8wy39zkisdQ5kuLY+Bpc5hwGiH8Mx1rE24DFaLqXkfrNVkjk+8JPTPF0bUw+R9MCVuA8ks/xDyF/9orMqpBQeiob5RbIbmv7/TxvoX1Oqa914TsYg7QUWx8Y7R89JQY8mY6Dat1G5GARuMOgYHY9cbL1vNvc++fk67olLk4nrQSl7457OPqdeKn+vEwm4LPzW87DyXvqIyei9znHS+cZz9SxV+Qf8nNbjn37NkDx4+PmCXzHOLUMtjgmUAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptzActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcEwgmv8imPwimPwhmP8imP8imPwimPwmmf8imPwimPwhmP0imPwimPwimPwimPsimP0imPoLqfILAAAAEnRSTlMADprCJBnU/gXwh3LiUKxAXjJ/ELXKAAACbklEQVRIx5VW2bbjIAwLa1jM9v8/O7Iht+09MwPlpS2VwLZkJ9f1lxVG1joPdZ0u1ZIxurhv8DH6dMpQI5t439GAEc7xYPgTRnAtV7plReRhd5kDP8+fd+wzt70yPhIJzWT7/6DCJCAYLReZPMIuJC4pClSktHqbNpJO1aTmmAme3cvtWs9NSfq52CPhnJNjlbVHwgmWSWGHeQHcKFjj7fygwidf2fa4mbVOuladcnsoDn9/CKKAWf6HEtpANiJvUp9Fgr0SvocPP/sqjOCK9ktpyCAo4Kt/d4n4/6baseNKAt5XrauPN1A4ZLAd30RUI4kNfELVx+yd3lrXYIg1Bp/B/dGs5N8mPsJoVyiwkofQSlm+K9aiwmoQMDoI4wefoK/rhkESrSuV+BR2i6HZH9juLzxCtBmn6rFmB66gNJQwBOSxncT/N3FAlxAoLQfJDy2+6rMLI3aznl9fhOcGSdZzoNhex2K3TXJEVe3M4Zb6QhHuJc5BWakYIqqietcPw6FK+EHofUHRqtLEQ5X8dKVENXXgEpLOpcjwkFI30YFVHE8fyx2ShZJ/ydTKlZwZ4BCOv/af9uMi0DILe4kieynScgPbhai+DRDckTT6N6zJpI3HMghM3BMg+q9pHmwrbR0Q0D5wc0JHPy0E5Ur7Nf3Rk68LnR0NHfO28/T5P4cNr+uLFR7eEdiNxvMRbd5Onlqsis4iIVdme4di3akWOz+3T0aUnFWHa8QZrO51NO69MeLPafrNuBenxel/3d21j8k/jyxf+75OQabFxOtuT94G3Lpjzb0zBn2Dl0ep/waPidQ/p/XB60Dp7e8F/QO7WSJg4zEzdwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-ptzActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAANlBMVEVHcExru/9ru/9qu/9ru/9ru/9ru/9ru/9svP9ruv9ru/9ru/9ru/9ru/9ru/9ru/9ru/9ru/+3uxEqAAAAEnRSTlMA5q0cR/PC/ggSKtN5OIhaa5izIOiAAAACV0lEQVRIx5VW2ZLjMAiMToNu/f/PboNsJ5PaKWv8kKRkWkDTQF6v/zyUfO+JX9sP1dKKd/v2acQcm992kbo1R4il7iHIif0BRNtCUOozH4cikAdt2YfjRLTnzN15/8I85wFCI2xDzlnyMLO7R0aFoTzbFGB+jIkYLkyePvmW8d2fs2ZfZuv8It9s6zvV5uSr2LmKb9oVh37QvpjYOcf8fcO3Cb1jGqOU0SvTTd6X2KUBLgKdLzaiDtE2n+isTh8/+AX7E6/Vh/NNSyfVm10RXIe1nxXRapmsDQB7SMnkmE0IxgqvUn0jteEf1T2CHXgr0gjZllGk1HoJL7lD7fRpD20CgJcwQ6EdSh3lLK0zVfuqz2WvPlPJh7HqnCQ4MysxoAYQE0vHub/toRuqzRy5pEUvbg62MzlJQn1MHBe1x7WSAddpNDSN1c9wRMhKfi2jrICwAIsQvHkD7Al41bOrBNC1Y7QdmSg15LDokGETJB/imxYJKfmFMDqI3FjUkDS3NSEDjBaxknRYSb+4nj4kC43W2OKrkqGB8jV2Fq03YiWbhHQTpUV1mMHXWYf8HlNX7ZUQRC6iwBAIK0r0ILr1UxqKsPattAkhwSIiMl76bT/Ft/TbTy2jHQoM7Cz9isHVMb6GILl0H4DGivbw7xNc8rAtiJn3O/qvD6JT/wgs7Y370ZSdWmbZWEKiG1lXImldW7Q1jGMbZW9tUVKZmGjjGvf+EXAqzWiX5OfFSHVp/zjbfGPc3whdcbTF67V2N1e79qYMru2/AnzVYFsdWFt/+nOypv8vQvoHou4gOtSrG5EAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performance{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTM7OzszMzM3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3NzW8hQDoAAAAMdFJOUwC/gO8ra6tUQNmVEKtAA1gAAAE4SURBVDjLzZMhT8RAEIWnpS3tXcWdQ6wgOJIKfFdUICv6AyruB5w4EuSJCwRXgUBWkGArLsEi6JVuaZkfxawguSWz/p7azLdtdt97C3ASagp+PpeXPDjHVx7McMWDCBc8qPCZB4m44YFIeOBh+ckCf9z+sCCYqi8WvA/5Nwu26cfA+JRBs4h7WmX/tr9AXcQHAPdgzEPZh5idTQBOZ3zyiModISKQGxZ7dd85E0SKfMGjM7vXeI/5AE5LvrwpcK9IOrQYB5BlCsFIvjzgrkaSjsBZbmC9XsGsAxfn8gKXpL9sSlnQFBwFTTuaKWXgI5Ar+sfHTrW6DUDO+2jEEtCNQ9wL6gNujMvvdFS3eugxGT51fBXxTvF1wLLngbT0BGphKalAy0MQ3Z4Ha2V7UoMFJKkFVAWcvH4B0OJfd9YsTl0AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performance:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwD2qdfrViyAwW2XORBGtSCsD6SyAAABN0lEQVRIx+2VzQ7DIAyDYfxToH7/p10CbQ+T2s33Rb1MijM3/qDG/EurolD9zSNRggBU0hFelMABmenfADhGkJDhGUFGgiX6I1AAQlDgZK/td8ELtQORiTmIq42I2bYdCD8NjzPmYQxO+rbn2S5qzEUF6YjkgcJude56X3s0SoL7LRAeylyaVPiFq0Jyx230mpeXmXVOHssRbhackhCq25Sny++xcBW1n6Snqw6BTgrqRP6kzfDcgmRLGonDWSf2OecwB491dOrEVZpNsxiyiHzWJ0Z+BbBwzaoWVb49HrqVfSkxHen7WNznLhzl8xpQlT3E9oHUtYaufB+7NY9g9ctbjFfj/h1DwXUrzDltMn1Ql9M814EQWPLmEBg4R7JSzpFQxTmSBMkLvJKOhFHfKEEnv3L/+qw3DuMPzAFH9pIAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performanceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAtUExURUdwTBGW2xKV2hKW3BKW2xGW3BKW2xGW3BGW2xKW2xKV3RGW2xGW2xGW3BKW2+P2IvgAAAAOdFJOUwC/gCvzq1RAleURc9VmrA9rXAAAAT9JREFUOMvNkzFLw1AUhU+SxtTahnZyC+IsIeAenDuE/oJQcS/FTYTi6hKcHYpDZ/EXBME95BeURpM0Me39Db4Mgk/u23umcL8kvHfOucBBKEr5eW95xoMjeuBBlyY86NOQBwt654HrPPHAca/YuUHrDQsG9eybBWa1+GLBqvS3LJiNX0vGJw/R0N6LJ+/f6x9I3uwG0D+luRU0FnmdCtBy6ZM7KvQdjgXwJYuNZVNrFfqF8IX+nFm/oBvyS2iZ8OWxgH4u1IZmU4kgfoa5E77c0jwhoTYCbTRFGE7QrXFCveCURkK/2cRBCp2gFYiyWk7Jw4AgXOmQZMAqa9uAeCP+JsViihtb9OKIPtBUuvy8jeqyHRpMhvc5X0W6Lvg60HrPg0DREySOoqQJKRbByRWbExaqlSoVwB0rwCLFwesHquttxhcsa64AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-performanceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTH3G63zE6n3G7H3F633G7H3F633G633F7H3F7HvG7H3G7H3F6xOzy+EAAAAMdFJOUwC/hKbvK0BT2XURZct0z00AAAE3SURBVDjLzZMhU8NAEIX3LiSUNqI1qBMMChFRgYxAd07E4CI6HQwzEUXgKjC4CH5ABAKJyA+oaHqBJO3+KPaYYSZh9nyfyuyXu7l77x3ASSgu+flYX/HgHOc8kC4wwikPMnzhQaTueKAiHvi43bFg0m4OLPBM9sWCjyb9ZsHm8NkwPiUQT8MjfSX/fn+F/C3syJf9YB7oLsDkjIaiHix5QCNbGBmAFPve+3lXi/0viLB3ZnmDz5g2ICry5daAvCbZhSE2oIsFeC35ssJljiQbgZitIY7nIGu4wLG+xBnpL5tClxQhCANR1Q5TSmCCQK7YjftOVbYNUOxot0EsHl0uwHdFfcD14PJLG9W9HfpMho81X0V8MnwdcHvkgS4cBcqVo6QKHQ9B1a6XY1zAcSiIFg6QlXDy+gEd714RcAqEowAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-face{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTL+/v76+vsDAwL+/v7+/v7+/v8DAwL+/v7+/v96T4QgAAAAJdFJOUwBAgSCbs9hZap+hQJoAAADvSURBVDjLY2AYRkAJCAygbEZBQUEBKJtpJhDAOJpA9kSYxESgKphuIaBuhASqyYzESjC2hDRilQBZ64BFgm2qMLPYNCwSkQpAwlMBWYIRzJsKYrKCxZSRncKSDFYzBSNY2MD2MqRhSFgqgClPAwwJBxwSbAk4jGKZDCKZp2JIsEOcOx0ztjQDYL5ENwsYJKrTsMSvGSgepzVg2pE5qSikPRPT8sopBuDod0ATZ54JsbZyBrJgAVAp1Ax2oPXMykjxYQaLA2CMoERUZQDMrgBUCc8CKIdzAvHJhyQJpLQLSu0TCaV2lPwBSu0KQy+LAwBuJj5UbruNggAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-face:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURUdwTP///////////////////////////////////////////////w2imYoAAAAMdFJOUwBAgBvfrFmcw4wrbtGliFoAAAD2SURBVDjLY2AYRkAJCAygbEZBQUEBKJvpDBDAODpA9kGYxEGgKphuIaBuhASqyYzESjBu79yIVWIP0NoCLBIsR4WZJY5gkYiZACRqFJAlGMG8EyAmK1hMGdkp7M4gkus4RrCwBIApFwwJmwlgqsYAQ6IAIrEAwygHHEaxngJbfhRDgg0sxHoMM7Z0AmC+RAPsJ4S5NE5gid8VoHg8sgHTDh/PzM60HkzLc44bgKMf3RKuMwoQ+dNIgswJDAycUDPYjhgwMCsjxYcJLA6AMYISUTkBMLsaUCVqEqAcngPEJx+SJJDSLii1HySU2lHyByi1Kwy9LA4AqflRBKNSA88AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-faceActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTBCT2xKV2hGY2hKW2xGW2xGW2xGW2xKX3BGX3BKW23povfoAAAAKdFJOUwBAgRybs9hZLG6hrV9tAAAA80lEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTgmZiFViFtBaBywSbEuFmcWWYZGIUgASXgrIEoxg3lIQkxUspozsFJZkEMmxBCNY2MD2MqRhSFgpgCkvAwwJBxwSbAk4jGJZAbZ8KYYEO8S5yzFjSysA5kt0s5YKc6guwxK/baB4XDYB045Vi4pCyrMwLa9aYgCOfgc0cY5VEGurViIJMhcAlULNYF9mwMCsjBQfZrA4AMYISkRVBcDsCkCV8CqAcrgWEJ98SJJASrug1L6QUGpHyR+g1K4w9LI4ALk0RHtSETFcAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-faceActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAhUExURUdwTHzD63zE6n7H7H3F7H3F633G63zF7H3G7H3F7H3F68TinBIAAAAKdFJOUwBAgR+Z31ipwW4yAjb9AAAA+UlEQVQ4y2NgGEZACQgMoGxGQUFBASibaRUQwDhaQPZCmMRCoCqYbiGgboQEqsmMxEowTmmZiFViFtBaBywSrMuFmSWWYpGoUgASXgrIEowgHtsKEJMDLKaM7BSWYLCaJRjBwloAploxJKwUwJSXAYYE2KUMVRgSrAFgKhTDKPbFIJJ5OYYEG1iIfRlmbGkVwHyJBlhWCDNrrMASvxageFw6AdOOqKCklrQuTMuzlhiAo98BTZx5FcTarJXIgglApVBr2ZYaMDArI8WHKSwOgDGCElFZBTC7GlAlvBKgHK4FxCcfkiSQ0i4otS8klNpR8gcotSsMvSwOAIs+RIlIrewIAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-object{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA51JREFUaEPtmT1oFEEUx9/bnRALGxE70btkZjcR7QMiRisRbCzEQvxCLGyEhCDRBC/RoNaWFgYLFUSwUBAUDKKFFqIQ3OzNJpfCyspS8HaejNyG87J7t7N3l03gttydefP/vbcz8+YNwhZ/cIvrhx5A3hFMjEAQBDwMwzOmAi3LWhBCLDTr5/t+ycSubdtLnPOncX1iAfQAlmXdNBmkru2RVgBSSspg+5kQ4lRjv1iAIAgqRFTIMIju0i2AWNvrAKSUowDwLqP4tACm9rWmbABCiFxXKimlhu0BtPFHtdc19wj4vn/Wtu3XnPOfWVByA5BSngCAuwCwryb8Hud8EhGNltANB/B9/5BlWXcA4GCMx/8g4jjn/H7aaGwYgOd5BxhjcwCgPd/0QcRVAJhM2l3rO3cdQEq5GxFvEdH5VsLX7aKIH8MwLLmu+zapb9cAFhcXt/f3988AwJip8Jj2L2zbLg0MDHxr/NY1gCAIpohIJ2V2BwC0iUd9fX2lQqFQ6cQvtJbICSGOxHhlVOdKjuPMl8vlqzrxI6IdWUAQ8Um1Wp0ZGhryiYghYrUtgDQionxJT0al1IwGkVJeBAANvieNDQB4joglzvmilHIXAIwrpX67rmuUamfKcxoTvnoQ3/dP27Z9g4j2J4C81KBCiC9LS0suY2yMiC7rttoZuQBEQhsiopfT6wAwUvv+hjE2XSwWP0kpRxBxgohO1kPmDhAHEgTBUaVU1XGc98vLy8eVUhoqbpPLPwIx6/wqEV2ovX8AALzZ/Ng0EWgQGa1iLQ8xPYCUyx8YHjt7EWjm2I7sAy0it7ERqNWEDkeiklIJg8pFWwC1ZC6SM9NYc1oXgcaiVlxVYmVlZW8YhlMAcCnFvOkEQPqqRBqASLTneTsZY3pjapZSpwF4Y1nW7ODg4Ie202kTgGiwSqWyrVqtXgOA6Zj0OhGAiF4R0azrup87dqDJAlA/eLlcnkDESQCI0us4gOdEdNtxnK+tfkHjA027AJEgKeUVANBROVd7p3fixwAwJ4T43kp4nR2zylynAOoE/JuAiPiDcx6kFb5pAEwF5zKJ2xXZrH9uc6BTUD0AAGh639Xo6bjUI+G/NglS+p3Y87wCY+y/2ozJSGkuRDLekQFjbEexWPxVryfpjuxhllKhNtwtAESc55xHx9M1hsR0WlcOlFLHTLyv26Ypi5hesyql5oeHh3VBeN2T6TxgCtXN9j2Abno3je0tH4G/KbtRT7VUKs8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-object:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAwdJREFUaEPtmTuIFTEUhv8fLSxsFrET3UIQRHtBRNdKBBsLsRBfiIWNoIisD1xfqLWlhYuFCiJYKAgKLqKFFqIgoiBoYWVlKbjwy4HMJXs3M5Nk7tzZCzfdvZPk/F9OHicnxIgXjrh+jAG69mCpByStB3AgQ+AcybmqdpJmEvv9SvJhqE0QwBm4lGikqD4VAaCMvh+R3NffrgzgB4DJDCPWpC2AYN+LACTtAPAqU3wsQGr/pikPgGSnO5Ukgx0DNJhRzZp27gFJBwE8J/k7B6UzAEl7ANwEsNEJvwVgmmTSFjp0AEnbANwAsDUw4v8AnCZ5O9YbQwOQtBnAdQA28nXlp/NG8HT1G7cOIGkNgKsADtepDnx/C2CG5Muytq0BSFoJ4DKAUxnC+5s8cSCf+j+0CXDBjAJYNgAA6+Keg7AwpldyAXqBHMmpwKjYyThJclbSSQBWfyIT5IF5kuQ3SctJzjcCiBHhxUu2GM24gRx1IGtj+gDw2I34Z0mrbXcC8JdkUqidFecEAj4fZD+A8wA2lYA8NVCSHyRtcGvouKtrg9EJQKHVB7Ht9ByALe7jCwAXSb6TZP+dAbC3D7JzgBDITgDzJF9L2u2gQoectV0yAD7IEffjDgC7plaVJQdgYotdLOYSMwaI2gETr51jD1SN6qDOgSobw/WAywltLxRVhBIxi7LxInaxUCHHFvmCpFkorWInoR8LheqsA2DB3LGIRdPIAznBXC1AIVrSKncwVYXUMQB2Sl8h+SYQOCanVaIBPJAVAM5aqBAIr6sAnjnh78s82aoHQkYlWYwz7YXXIQCLRK+R/Fg3BYcO4HnlhPPKIfefTYX7dm8m+aVOuNdP+1OoSow79KzKL5LfY4UvGYBUwZ0s4qYiazzY7RRqCtfZIm4qfGBrAEDle1e/0FDoUTKvUxiT3gfsaWlBbibFUsyDiKSkBK9nf4LkH19P2RvZ3cxUIVoEmCVZXE97DFXPrJY52JUy+lY3Ji2S8cxq4i3jsahk3QdSodqsPwZoc3Rj+h55D/wH5CHfQHNA9EUAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-objectActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA9JJREFUaEPtmU+IE1ccx7+/N7O0BwUn24UeRKOd7LalvS+I6HoSwYsH8SCtLf1jEqWoyLJVMfEP6nlNIgi6eFChCB4UChaU0h7aQ1GQrnFSdw9e/JNs9LTFzPvJZI27m8xk5k02m13I3sK+33vfz/u9N+/7fo+wzP9ometHF6DTGfTMQF+mYNqwd6sKlFLcK++P3WsWF8nkUyr9stAeTcXN624xrgDVAUgcVxmk1lbaGPIFyFocou9fSonYzvo4d4BsYQLgaIhB0EYA174bAFaNWpuFhrthxDsxQQCMrKXUPwGbvfr2BSglYh39UjmwXYCwy2kh4jqegd5M/itdaL8+i5vPwwB1DMDIWNuJcBbA545wAs4V4+YIiJQ+oYsOYGTzGwniDIANLjP+hkCHiglzNGg2Fg3AGB3/Ugj9NBO2+4ujSSaMeJ2uc+PbDhC5aK1GhU6CeY+/8IZz9E+CnSomBn7zim0bQF/m4QqbPkgDOKgufH4EAzdZaKny3vUP6vtqG0BvtnCUwY4p01oFcOIZuCJ7elKvvo9OtLyESMN7IzeViA3VC3TshiY4Wkz2j0Uyj3+aMX5shAIhuia4kn6Z+DSPu6xjiCotAQQRMeuXaJJYpqsgOetbcBV8TZA+ANxgotRU3Hz48SWr7800DjHL6VJyQMlqh/I5jYZvFsTI5XcRa0cA/sLDv98iieMv98X++Sj7aEBCPwjwD9W2LNMdAqhJnQMyc5D9DGBwRhzukK4fK/647q9I1hoE6DDAO+ZBdh6gEaQ3V9hi27JS3tf/u3Hhv20kpQPldsgthQw0fOcnpc3fVK2EhosEmE33x9LJwKxM54Lj/Ap0SeoCBPz+qVw7uxnwmdQFOge8R1n0DDg1ISaxqSbJy0oE2pTvqhStbOK5FQy2ka6vOTVkoL6o5VaVWHX+yVoh7KMAvvPbNq1mQNmNBgGoiV55fry3R+jOweRpqQMBMO4wxImp5Cd/tGynVQBqg0UvT3z4eroyDMaxenvdHIBvE/GJYnzgb69MtjUDboMa2ceHCTQCoGqvPQBuSOZT5WT/fb8luOgANUFGxkoQYVja+Lq2iQm4ygKnS3tj//oJf9+PamUuzBJqJsY59Jz/9wh6+iJpFoIKXzIAqoI7solbFdksvmN7YKGgugAMNH3vqp9pN+vhtq5VMqT2PpAbjwrW59VmVAYL8iASCfdGBvm/bpQPrCvP1eP+RpYrXA5XKgTaBkA0Voqb1eupL4DToFo5YLlVZfadtkHKIqrPrFLIsXL8s0k3LaHuA6pQ7WzfBWjn7Abpe9ln4C11Qo9Pmb2aMgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-objectActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA8hJREFUaEPtmU1oU1kUx//nvthx4cJqX3RgGLsQBNG1tq8Z7axkwM0sxIX4hbhwIygibfPMeyapunY5iymzGAURZjEDAwoVm8SPhSiIKAjtQtAmiooLiyb3yEtNm76+5L37kjQp5C2Te879/+65H+eeS1jlH61y/egCtDuCNSOQyH3cWirNHVIXKO6kYvqdenbxqVlLxS8J8Txp6Ne9bDwBnA5IiIRKJ5W2LDHsB2BmC6zqmxk3UkP6AbedJ4CZfTsNcL9qJ077VgHU8r0MID5V2EsCk2HEBwbIFdT8M/aGBkgaelt3KtOB7QKEnU9NsGt7BMyp2cOa4P8tY3M+DE/bAC7cK+xnxmUwtjvCCXzFHtRHiEhpC11xADOTjwG4BCLDY8S/MvhsyoheDRqNFQMwc292QmppEPb7i6MZgEdqna7V9i0HSNx/95MscRLgo/7CXS0IWS6VrFRs8+1ati0DSEzm18kesgGcURa+3OAfSGklY5ueuP9qGYCZzceZySKC1gQAgPkvXtNjpXatn258CmlYSOSSg/qwW+B8usH9SSM6Ec/lTxM7iR/3hgEh4Jpk2Kkh/UVikiP2MBUbAggiYjFfchajtB0QM/fuOFg64D8H8QHQTQ3CsowNT8cffdLnPn8+KyXPpWKb1FLtYJ0tbbU84asCyRYOEmiMwTtq+P63JJAYH9AfxTOFbUTlNXRyPlmTdpsAKlIXQZyDDJJGGbx7/l++BSHM5EDfg7HMm91CRM6B+fdqyA4AWA5iZd/++hWymDaid+OZ/G8EGgXB65DrhAi4Jw3NsORj5VRC4A8AW+tN2Q6KwKJM54b2HcD3EtMFCLojqVw7uxHwGdVQ992OjkC5JqSJPRXw2qlEsMpFo1OonMx9/7gE211z8iirLC1qeVUlxrLvtwgU4wBO+K2bpgCoVSX8ASqiRx682hgp/jBaL6UOBsC3pMTFdCyaaUI6HRyg0llicnptqWfdeTBMd3pdH4D/kyQupgf7HtaKZIj7gDpAdefxzOw5IjECoJxeewEQ6CZBpmwj+thvCq44QEWQmZ09BYjzLHFk4SQm/C2KIm3/svGZn/AFP+qVucYi4BbmbLnOb5rGr+zB6MugwjsGQFVwWxZxoyLr2bdtDTQLqgsAQt33LvdIe6UenvNaJUQqJ3Hi3ut+KSNLajMqfQV5EAnzRuZoEF8ivfZw74dqPbXeyP4MVSoE0DoAmkgafeXrqS+A08CpHBDTPpXRd9oGKYuoPrNqETlhD/w446Ul1H1AFaqV7bsArRzdIL5XfQS+AaeCtE+rbksUAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusion{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACCVJREFUaEO9Wn2MXFUVP+e96X5oa9UoYpUszrzzZlqLKDYhgAFaaKU2+M2W9Q8TNUQSQEsiRUjFVaHGNmoBMTUmaPwD2iIhqKR8WEBFGkLFUjbtzDtvpjYrVhpCXAtm1867x5zxvnXm9c28mR13b7LpdO65557fveeez0GYp1Gr1d4VRdF7lL3rui/n8/lX5mMr/H8wDcPwIgC4QkQuAwAVWv9eA4BJy/8sAHg7ALysf4i4DwAe9Tzvj/3uP2cA5XL5CsdxNiLi5QBwUkQeQcRHrNB/JaKZZuGYeRAA3gsAZ4nIBkTcAABLROS3xpjdpVLp0bmA6RlApVI5FxE3OY4zGkXRdkTc6/v+c3PZPAiC80Vkveu6Nxlj9ojIjmKx+GIvvLoGcODAgTctXbp0CwBsEpGHEXEbEf25l83a0TLzh0RkMyJ+AgB2TE1N3b5q1ap/dcO7KwC6AQDsRMQhAPiu53m7umHeK00YhlcDwC0iMg0A13ZzQJkAlKmI3A8ADyDi9Z7nnehVsF7owzA8Q0R+BABXIeJY1mF1BMDM3wSAcRHZ5Pv+nb0I0i9tEARfRcQdxphvFYvF8Xb82gJg5gsA4FkiyrylfoQVEScIgttyudxLhULhwSQvZhYAuJCI9qftkyrckSNHzs7lckdFZJ3v+0/0I2CntRMTEwNDQ0P3i8inAeCUPmLP8/Y2rwmCYC0iPl6v19+3fPnyvyT5nQZAmQ4ODv5aRF70fX/zfAk/OTk5PD09rcbg4/EeiPgPEfkUET2dALENEc+dmZm5cuXKlf9unjsNADNvBYD1AHAJEf1zPgCUy+UljuPsQsSPpfD/m95Is29h5rcAwO8AYC8R3doWgDopx3H2I+IXs17/XIEdOnTobcPDw3ry6zrwCKMo+kypVDoU01hreK8x5oJmZ9dyA0EQ/AwAhnzfH5urgJ3WVSqVd7iuu8vGTB23SLM+QRCoOZ/2ff8Ls2oXf9DYJpfLPSgiH+nGgfQKcGJi4szBwUE9+Uuy1orIQREZKxaL5WZadaiI+Ey9XtfbacROszfAzL8wxtQ62dysjdvNM7MGcSq8Rq1ZY/+pU6fGVqxYcSyNsFKpjDuOkyeizycBHBeRjb7v/z5rh17ma7XaSBRFuwHg/C7WPYWIV3fy9kEQXIyIu4no3bMAqtXqZcaYnUREXWzSNQkzFwBAhf9wF4v2RlG0sVQqncyiZWZ2HOfaQqGwr6FCYRhuE5E3E9F1WYuT83qluVzu74VCYWfzXLlcLuqDBYAPZvEUkYeIaBQR61m0Os/M9yDiG57nbW4AYOZnAeDWpAPJYsbMNwLAD5TOdd2L8/n8Hyy/FfbkV2bxaKgB4s89z5u1LFlrmPlSANhKRBfGAPTBrCGiatbieN7GSpoaDut3IvLa4sWLi8uWLXvVbvBUFi+NchFR00/V6+16ollr7AGpaj5JRCMxAL06VaGWNLATM2ZW4dc00yDinZ7nbdLvrLXQaDZ1iMi9vu9/ySb/BwHgTAC4kYh2ZIGw6ekbRJRDy+AlIjoja2E8X6vVilEUtdhoOzdBROdY4fcYY0Ydx0kDcQ8RXd90m+qVH9P/qwPTf9WcK5+YJmnemfmE67rnIDOfBwA/JaJuLEWDHzNrAPZwGmCNGnO53HYAWA4Aoykgvk9EX0uuDcPwBhG5KwahAjOzqqHqewNYMwhm/hMAXDMnAEEQaP76vTY39v4oiiZd1/0VALyzGYSI3OH7vubVqYOZ9fE3NEENin1LDdqkgZkFMBcVqlarG4wxv0mR4nUiWqLfHz58eGTRokXfdl33tnw+n+pVu1XZNLpZFbIq0fKIm6yIOhX10K8g4t1E9IDSa84wMDBwHBG1WNU8NIObDReY+RYA0EqDhhJqbQ4SkRYI+hotj9gCaDGj1Wp1lTHm+ZRdvk5EDdVh5h9qiaWZBhHXe57XCLKYWVXoygSPk0SksX1fw3r4FjPa4shsVqanP5DcyRhzebFY3Hf06NG31ut1fWQNT4uIWzzPu0M/d3gjTxPR6r6k/+/htDqyMAy/Y4zRPOCmmLn1zprYJ8eriLja87yJSqXyScdxHtKSi4YCVvgxRLyvjZCpFqhXQEEQbHccZ9rzvG/EsdBFIqKmVK1AYzQJl8Z/NH4PzHxV/NkCuAsRb0hb1C4x7xUAMx9GxGu0ONycD0yKyGcTuegLAJD26K4joh+nbczMe7QolZwTkZt939/Wq7BJeq2nIuIviUgr3v9LaDSdFJFjKR7vtMcYOxXVRWPMpY7jCBE1PGiz84k3F5G7fd//Sr/CW80YR8SROK2cvYFOKSUzr0PED2hGZYw5ISLHrafUx9QI2uICmFY1RORsx3FmEPE5EXne8zz1mn2Pjiml1d+ekvrmqHO+K3hWvvZJvb2ensoqCwmgq7KK1eGttnuyNqsSvVAAtGINAE9oF6hjYUsB2EaG6vWx2La3U96FAmAt28jU1NTqZOMjtbhrGxovZJXVFwJAXGYHgPPS6lVtS+dxY6PT41wIAFpe79To6Fj7j9PCdmX2TvF6vzYzLqtrgyX2MWk8M5sXcaNDRLQjeft8Vaxj4bQSLSJbEFHjsraNjZg+E4AS2obHTzRb0kxsvirXVm1vBoAT9Xr9y2kNjeQtdAVAF9kQW5PseW+zzszMjCcbGe1UsmsAMYOURveTc62nap1TRNYsSKM7eQIaO7mu+zkAWAsArwPA45oXdPNTAxutaillsTqoKIruW7CfGqRdpRaHReSj2lvo8scezyDiY1qc7dda9axC3W64UD+3+Q/fZENVhTDr2gAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusion:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABphJREFUaEO9WmnIVVUUXSuiuahopOLLIqTBBgtCC01Ty8JmS/sRVESBNgiVJVZaaag0WBlGYNEPrSyiQdTKskEjpNKSCBqlzAqJSAsbYMV67vt13/3uffe+93pvw+Mb7rn77HXOPntY5xEdEkkHAjgk1G8k+VMnpuL/oVTSaQDOBnBmGG3DfwHwXeg/DMC+ADbGZwWAZSRXtTt/ywAk2eDLAIwAsAXAkvjY6O9J/pk2TtLOAA4FYDDnxmdPAG8AeJbkslbANA1A0gkAbgJwKYA5AJaS/KCVySWdCmA0gFsAPAfgIZLrmtFVGYCk3QBMDeNfAjCb5MfNTFY0VtJJAG4FcL5BALiX5B9VdFcCEBPMB7ALgPtIPlNFebNjJI0DcDuAbQCuq7JApQBC6SIAiwFMJPlzs4Y1M17SAQAeBTAWwPiyxWoIQNJdAKbZbUjObcaQdsdKujHcaTpJ25ArhQAkDQKwmmTpLrVjrKQdANwJ4FOSL2R1SRKAwSTfz5sn1zhJhwP4BsAokq+3Y2CjdyXtBMDueRGAv32ISS7NhN+RAF4D0I/kt1l9fQCE0lcArCPpyNARkbQrAAeD81IT/ArgQpIrMyBmA3D4HkPyr/SzPAAzIzYPJflbJ6yX5ARm48/J0f+DdySdWyTtBeDtyDlTCgFEkrKvXVV2+lsFJmmfMH5UAx1fAriY5CfJmIiGCwAMSie7uh2Q9KRjPcnxrRpY4vP7hfGumcqkT/SR5POyjeSVycu9AKK2cRQ4vUoCKZs9J5ocFMYPrfDu2sgBn2fOgjP2e7E7tdopDeBpAF83irkVJs4dIslFnH3eVWuZ2IWdwDbkDZTknHAEySuyADa5uiT5TtkMzTyX1ONqE4ALtzJ5C8C4Rtle0pCoXg/uBSDJPjmf5FFlMzTzXNKRYfzJFd5z/PcCujRvKJK+iFppRc2FJDnO7k5yQtnLOb7tLf2RpIu9XpHUP9zmxAo6X3R5TvKfCmNt7zwAvztPJQBWA5iSTSBlyiRNAvBAjBtC8t1YkGNi5Y8r0xHPn0pHlrJ3JJ0BYCbJwQkAH5jhJL8qezl5HrWSW0NnVItbyP4kN8cE9ucycVh0+2m/nlM184drvkmyJwHgrbML1bWBjWaXZOOHZ8bMJeluzdts13I1WyQLSF4dzb/DpsPsJJJuaBpKtKd2oR0ZClwJug6vJOHfdTE6XlxPckAY7xbRbWceiHkkJ6Z201l5efw93T8dzkNP7d/Z8C7JfckAAxgI4AmSVSJFTZkkF2BuK/OkX/TKRweALIj7Sd6cfVHS9QAeTkAEALuh/d1Sl5klfQjgmlYBuEqdVQDg2KBTXgawfwbEDJLuq3NFkg9/zRMcUOIsJTuQrVB7AZiAataFTIu8mmPFVpKuNL1LTmB3u1kpyqqV/LUY7HYXisnqDnEqijipOEObVXuEpPtiG+dGxP83WZUWd3C95YIkN+hmGlxKONqsJel6pi2pO8RhUF0YlXQKgDU5s9xGsuY6kh4MiiU9bHRCUEmyC43J6NhC0rV9W5IXRusSWaywV98rnZURJFdI2huAD1mSaaeSnBHgis7ISpLD2rJ+++L1SWT3RB9ghqwmkgzKjX1WNgMYRnK9pAsAuAxYTNLRxu+5l1hYYGRuBGoWkCQzgu4L7kjOgP3WodRRIAGQGJen33VLch7GJr8HAIdCh8Q8yW3MWwDwWS2EkqvS/YBJ2UsyvehHAPIO3QSSj+VNLMkJzKRUViaTdNHYlgSf+jxJk8R1DY3byQ05GS/vMNaSSvii/VEkaxlUUjr5JMY6gt3QluX/eYZLlJ6k+KvUUkpyqj8+OirH300pALWiLSHAJJnVMK/kusqs9RqSTjptS3C0+S1lrF5TTX266uw0gxf2FTf1McDkUWVapZsAKtEqAcIu4FJhZBkT3S0AwVib4lxCspjYCgC+yLBf+0DXYnuRdBGAI5trK+efuouPInLXodMhtCGt3g0AKZp9YB5f1Yhe923JokaHs0sATK8XXnSUXXAkbWEuzd6oXm83ZkpKaPVpSY7J01l6eZFcdESX5cu3jjDWiXHBRLvpcV1WeLGRjC8FEAfbienx6JZmdZC5tttOBuBkeW3ehUZ2FyoBCBAurWv3ZdEPd/Ka1W5Td5FR5JKVAaS2OHvRbX6mJT41eE5TM52/6M6uQNDxlzvhAdga91gusat81cDVquurPQA4QS3s2lcN8rYyyOGzfLdQ8cseLsiWu7NrN1o17UJVJ+zW123+BfogD+TkdLQFAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusionActive{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACItJREFUaEO9Wn+MVNUV/s59+wOqyM7bFaxAsDBvFqnWak0MYhBQUEqUVssi/aNJawg7bxaKScFqqKyt0gip4sK8XUKqjX/IL43RlqBSxLZWYqwWdWNh3oIlFClkebMUaXfZefc0983MMjv7Zt7MLrvvn93MPec753v33HPuPfcRhukZt+3YeCndCQpeCO3kmWVTTg+HKbocoKHWjpnEuBfMd4GgnJ7ADAcCJzx8iUlE0AGcBOMkiPYz4c1kNPzXodofNAE9fvheQCyBoLvBOA/wHunSHq7CiXM9+BdWGj39nGuxq8dWYyJdxCSh8UKAFoIwBpL/CMidTmzam4MhUzaBmpYjNwmNVoFEA9jdSEx7zzZFPhiM8dotiduYeAFIWw2Wu6TLm7pW1n9SDlbJBK7d+rev/c8du5aAVQC/Lok2dEWNv5djrJBsTat9s2BeA9AiBjaN1s499eXyW/9bCnZJBNIG0AbQKCb8OhkN7ygFvFyZUGvHQ8R4DOBuSWgs5QUFEkiD8nYAuyuJmk5Hw2fKdawc+fGtHeN6mbcAWMxES4NeVlECequ9DoxmMK9yYpHny3FkqLJ6PPFTEG0CyyedWH1zIbyCBPQ2ewYk3ndMI3CWhuTsOhb6uMQTEBWfOdGpr+Zj6ZbNELjdaTQO+tnxda6m9R/XCa74AoLnO42RfUNysJjyuvYqffyo7QA/AKCXQYuSZnhvrorelpgHSW9LSn2jK3r9P/PhBhLY1V6ld1b/HuBPHDOyZricn/jsidEXRnXvIOD+SzaoS7r8/a4Vxrv9SFiJDQDd5NT13IeGGy7mjg0gELLs9QQsQAp3OiuN/wwHgbrfHh4ju8UOEH3XB/9LkvxAbm3RW+yrUIE/MbA3aRqPFyTgFakKcZCJfhK0+gdLbKz1aUjDaJWG5xfCYKADcB9MmtM+zcpksuELMiVn5Ba7fjOgxxMvgjDKMSNLB+tgMb0xW4/UVUpth7dnCnp8so9uJbaD0e3EIj/OqvcR8PY2VPGqJL6jlAISZD9//Op4+zWSqncwcGewLh8il5eeXVF/OFc2XVDpPXDqwezeqY9AyLJfIpbHiuXcYMP+EnqLPREVUGEzMxCDcFC6vUu7mqYf95PV40eamcSUpGn8SI1fmgHLPiUFL+lqjPw50EgZAjVbjk0Wwt0J4LYgNQYOVBE9VKza17QlZglJOx3T+Hofgdq2o3dJKduSpmEEGSlnfOxWe6pwsZOA75Sgt1dUu0s6H552Pkg2ZNm2EKLxbOPU/d4M6FbHBma+IhkzYkHK+ePpKa34d9Kc2pY7VmcdrpfQVNh8OxCT+TVnutGAOZQKlAUQittxIrrgmOE1aQJx+30p8Xh+AQkC01vtR8B4VskxtFlJc8pfPLw2ezokVNjcEIThjRP9zomG+zJLkE7NZnu2EFjvxIzbMzNgH3c1zD233DgapJwd17fYM0DYD8Lo9G/s9GpX1p9ffm2nZ0DDgUAstcsVNAGMWQBtVG80UAeACk3NxTuOaUzOEkg5KVwx4BhYBE237P0A5vYTIXreiYZXpWf1SDNIrCsIwfyCE4s8rA7/qV73EIBrADzimMamQBItdrVegQuOaVSQAui96H6WjBnjAhUzAnXWsXoJt1+Ozgy1O6Zxo+e8JnbBlQ1+JBiIJ02jqW824/Z8EN5KT6R8Uv1R6dzDyTz56T0Ut89UVmk3Ut1W+xZXYlsyapSSKTy4Osu+XwKv+xFWu0aBio1gXA+BhgEkGL9xYsbP8nVrrY4VDG7JklAOhyz7AAGzc3/L6oVa7Y80gWWDIhCKJ9YQ0TO+MybwTVHpnnB7tDcIuDqXBDM/nYxF1haaabX4ZS+8SFAJRa2lrGx+gukjMJgQCllHFxLkH3wc+coxjTHq95otn08mUflLltoTXU1TfKtqqSHrJ9cXQt6Cs+x+izgni6iicgrg0wBtdkxjtwfmHUSqTgGkmlW5jzrB9W0Xai37MQYWAZioml0ADjmmcfNQHPd0cxdxhkC/NFrXdvRWKeWH+YYY+HnSNLzQ0S37OXgtlpyHaYETC3sNqlrLfoOB+/IwzjumcdVQCQxMo/mFzHvD1ertV+UbIynvPttUv7/muS9qRHVK5Xqv0hLT2rOx8NPq/0JrhIF3k6YxZ6gEfApZx68Aqc4Bq7PgqjqDMMPHWCcTzUlGw+211pHvMcRrquXimEZDxvmlRPSyr5MFMlC5hHQrsREQ3Y4Z/oVXyNLNWd7mmMb0LFiOc374Ddn1oFv24r61obCsRAuBVvgpFTqYl0/A/pyJlqnm8KXtdKt9glz+Qe5ZtNayP2ZgwKJjRiwZMyw/w7pl71JNqQHrh/nRZCyyoVxn8+W9fqpGrzhRY5IXupdCJvEiwMfzK57vYswc99KxKGdDCHaihldB+xWfDDiDNyfNyMqhOu8lD6860+TssbKkI6WuSj3oW0yYSZBnwHxKEc3dtGUbYF5Xg/k6CNHDTB9o4A87zfBHl8P5okfKNLvyDvV+BC6Ho4Uwih7qlVK5bZWRJFBSWyUTw+sJtLCSMC+oEz1SBNIda+xj8J6ijS1FQF1kdLtjVYE6ns3thaZ0pAhkMtvkUdq5OfkXHwWau96FxsdBbfWRIJBts0vCLX79qoKt8+zFRrH2+ogQsGwudtFR/IIjeyws0GYvtl8fajbKttVBaM7WGD/MwMuL7EUHwBuRoqeGq2PdV1C9TjSvBWh1sYuNrHwgAS+9pi88tgIYx0TPDFfnOhO2jwI4Iym13O9CI38WSiLgKe1qrwp1VjePxDVrsq6nOf8io1BIlk4gg5B/0S01emew/VSvz+ny3BG56M5/A6odz6T9kIB5DHwFxtsssbuUTw1IYDEI8wm4koF9xO7LI/apgd9UquYwS74HzHeU+LHHeyToLdWcHWq2KjuESjU4Up/b/B9u0kgtWdqPkwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-occlusionActive:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAACJpJREFUaEO9WntsW9UZ/33HaZJCX7S5TmhalQ1NaAzGYJUgvk7pe5QKusGa0v0xaZvQkKBbK60BWl/b8XWKaLWtUJg6IcG0P+hrCMHWlcdK2OLrFPFYGdU0ac+q9BHfFPoC2sQ+33SufVPXvfa1kyaWolg+3+t3zznfd87vu4Qx+nQfONc8yF+0KvP1NPHoxjsm9Y+FK7oSRo2+fh0I3AUpFwHUyoxWIv6EiI4o+8w8m5mmE+EowEchxH4g95rZ1myN1v+IAUR6M3eRwCqAFgM4C8ZeZuyFmHDk9OmpH2+7my4UB7fmj9wwderpWZBDs4mwHOoPmAzwn1hiV7I9+NpIwNQMwOjtvwWC1gLUwVJuIfA+s73lnZE4N3pP3M6gZSTEeoB3Q/JWs735w1psVQ0g/t6xq+T5uogkrCXQKyDebIaCf63FWTlZI525FUydDF4hGFtFYzYZnzvz82psVwVAOSCI7QA3MuMJU9d2VmO8VhnDsh8gwuMAnWfIh6p5QL4AlFEAO5ixp45yj8T1lkytgdUiH7dOBLMceIYIKwGs9ntYFQFELDtGQJyJ1yZDwadqCWS0spF05qfEtJWl7Eq2N8fL2SsLwLBOtgEybeqa7yyNJthYjEVucSYqRN1HCX3GS6W2DMtmQIRMfUaflx/P4GJ9x6+Tsu6/xGJpIjzjzdEEWEk3tvtQvZzVsgPM9zEwJJhXJMLBfcU60dTJJUzyDSGyX+pqu/Z/pfYuAxA7xPXytP17YvowEdY6xyr4dekjEydxo0oG9170QadY8neS7drbl4KwNzPxLWKqdk/XTTRYPHYZgGgqs0kSLQsExJ1dd8w4MxYAOlP25AaCCv5uD/vHIHP3FdeW2IGTU3I5+WfBvC8RDm4oC0AVKRbUR6Af+u3+kQJ7rPfwNXVi4k4CLS1vg/+Vy/H9m+Y1/82VUdmQwc+T5LbiYnfJDBhW5gWAGk1dWz3SACvpxd8705QbHNwJ5kV+9r2yj2HZOwA+b+rBH7j6wwDyZxt6CcThagqIXwCl47GeTIusJ7Vs7vTTZfDBHGVXPxGa+Y9i2ULFTrHk+92z00UAlv1bSPmfSjnXz3G58c6ej2c1TGjYCYLub4P6JAZXd+szD3vJRnr74xDiy0ld+74aHwZgpOzjknhVtx78i7+T6iU2Wp/OEZzdBcLtVWj1BJB7oFK132hl5gmmXWZYu3YYQDQ9sIiZt5u69pUqnFQtErH6rycWKvhv+ioR9l2QWLU5rJ31kzUs+59E9FAi1LTfmYFo2t7MzFebevBhP+XScTWlVCdOmG3a9uKxSMq+QRB2MvANX5vML4shraNrAWV9ZQEYVuZZIvosEdI6HQCGlUmzpA2lBcTPWLTPXscSv3DkmOeZ4WCv+ho7cPLGXC63i0A3+dnIj9NvTL1pOLP46UR67fkkeJOpB0MFAPZhxoSFSX3av/2U3XHD6m9j0H4CTSz89kmgoeGG+NwpA3kH6PGzxcAOAbQyMI8IW9QT9dNR4xHr1PWEobdMXZvjAIik7OzpM01Xl14DKxkzLHs/gIXFMgR6KqE3rXVsqqUlRKy8DX7e1IM/2nCgvzmQFQdBaAFjnRnWtvqBcK6nUwY+S4a1OlLswfnc5x+ZejDop+iOq/VNhEtytLOKwIeSevBmFXxgQt3u3FC2wwsEMT+bCAcfGbZn9S8liNcdG1J2qf8qnTsps/ApTe+Glck0Bq66mWJ99m3MeC4R0vwzRcFYpM++lyRe8QKsTo1STtgC4KsiQB2lIAj4eULXflaqG7UG1jD4aReECthI2z1gzC/+zdWLpu33ifDgiAAYVn8nIJ70BBAQX/siK480CLwKJq0YBIG7E3owUm6mnc0/JJ2VoBKK2ksXZ6DkhOoCGMkSilr2cgb+4BHIOVPXJqvfN1rH5giqT0gORLv1azyrarVL1ktueAl5beKiLKL4nuMg9BPxtkQouEfJOxeR1ubjAKaXbOJ0Qm8aPi5E0gOPE7ACzLMAtBJwMKFrt44mcKV7ySZWPxjWpWk0lrLnSsK7pY4Y9FhSb3KWjpG2fwmGk3HcD5NYlgzNcAgqI22/CsY9JTbOmro2ZbQALkujpYWs8IRVSa8vdUa53OLEvJb9sZ5Pp3F9tsettAyKJPWm7vwDKbNHCG+bIW3BqAFcVsj6BkzkuNEMa+td4woUQG0ezgYCCCyI69MPRdL93yYWLyvKJRnWOpy1n7ZXC8aLXkGWy0C1AjJS9hYE6LzZ1mTkK7EiZ6V4ztS1G11jbnCegRB3uPshms6sdL87+8nKPE2gNV565S7mNQOw7L9DyAcVOXzxOG3ZRyBz3y2+ixqW/QEAj01HD5t606+8HEdS9u4CKVUyLB819ebNtQZbKq/4VIjA70xdm63GigBkXmDJhy+reB6b0b3u5fO0nA8hOKlrTgUtLj7Dmxu8LakHfzLa4J0Zdo4oNMe9VlZ1pYyoUk/i62DSAc6wlMfzpf7ioc0lwAqsxnUEugDB7yCLd8127f0rEXzFK2U+e9R2qfcCcCUCLWej4qXeAVAjrTKeAKqiVRQItQQgaLng3BI/Jnq8ACjGWlLgTUjeW5HYUgCcRsZgfY9UG7qQ28tN6XgBUJlNCJoj6gcXlDY+PMndwmb5wI9WHw8ALs0O4tu8+KoK9Hq+sVGJXh8PAHl6vXyjo3KDo3AtLEezVzqvjzYbubQ6A3G3xpQ5nlR25TY6iLGF6kRyrBhrNwrFRHNWRpiwvlJjw5WvqvuSb3gEfs2gIAFPjhVznU+VeJTAGSFyP/ZqaJQ+7qoAKCXV+OBTdnw82qw0TYuXNjLKrZOqAbgGShvdLOitkfKpiuckyQvHpdFd+gQUHQ9B3yPGEhDOAfwGS9pT1asGgldCNTgYk5igCtSL4/aqgddUKnIY4G8xc7ialz2IKAXQ64qcHW22qnkJVetwvF63+T9nAHfjRfzL0gAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-logSave{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA1RJREFUaEPtmT1oFEEUx9/bFLFKJzG2WiknZObFxlO8RtFC8SuFWlrYGBtRRNCghV9YmFQWgoVaaAS1ULRRRKvbmYBBQezVYBOIGFMkT0ZuYXPufOxdspuDO7jibmfe/H/z3sy8eYvQ4R/scP3QBSjbg8EemJyc3La4uHgUETcx82YAWNum+N8A8IWZrxLR41ZtBQForUeY+Xarg/j6MfMVIrroa5f13AuglOJWDLfQ56aU8mzefk4ApdR9ADiW12ir7RFxXAgxkqe/FUBrvYeZXzQbY+bh3t7ed5VKZTrPQM2eNHYQ8VGGjTtSypOhtq0AcRyPIeKptCEppTfkbAM3AxhbcRwfyYJg5nEiCvKEVZBS6hUA7EoEIeJ+IcTz0JlpbpcFYNrYIBDxlhDijG88lwd+IGJ/YoCZ1xPRd5/BUA/Mzc31VavVWRcEM18jovOuMV0eWLL7tBM+RoBS6isAbEzERFFUHRwc/JD8dnjishDikg2iSIAJADiU8uhdIjqRFuZYEweI6Gmuc8AWs6EhVK/XR3t6eg4zMyKiEQ/MvOSwQsS3iHhhZmbmY61W++UIp/dSyu2FAmit3zDzTjMoItaFEFuVUt8AYCB0ElLtZqWUfYUCZHlQKXUQAJ60AAC2Nbhia8AWglprAoB7jYQwmGXVACSKzRqJomgLAJjvBh/JqgPwCQ7dRAoPIZ/w5HkXIHQGQlOHvCd56PjdEOpoD6TShT/MfD19OXeFQCPnOYeIaxYWFiaGhoZGQ9Pv5nZthVA6XWjkOsMJRGj+b/IhIURtVQCkIUJvYKUCONLf/+67tjuw+T+rLlTYLmSDCDmwbOIbF6CgC1Vba8B3m3JBuMQXDuC4iGQy+MSXAhAKESK+NAAfRKj4UgFsEHnElw5gBGit9wFAUqy9kbco1vY2Gsfxsha2QrbV1K42gIimAPDvw8zTRLQuy0ZhpcU8AMZ7zPws1ee1lHJ3LoDlLu7mAcioZFuLvYWV130AU1NT/fPz8zuyqtWIuFcI8TKXBxo7QaEvOCyQD6SUx20T4K33F/iKKVOj7yrqBWhsiSv6ki8zNBBPCyHGfKEXBGCMrMBr1mZtPxHxEzN/jqLoYbr07oIIBvDNRFnPuwBlzXwybsd74C95KWhPrxIhsgAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-logSave:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAthJREFUaEPtmTuMTUEYx3//TrWdeLRUJCrReISGUBCvLVAqNGiEiASh8IoClUKyBQqPBAWhsREqnYRE9NgoV0T3yci5m9mzc2bmnHvvOXuTO8ktbs7MN//ffPP45hsx4kUjrp8xQNcezPaAmW0EDgFrgLXA0j7F/wG+AlckPW5qKwvAzE4At5p2ktHusqTzGfUWVEkCmJk1MdygzQ1Jp+u2iwKY2X3gcF2jfdS/I8l5O7tUApjZTuBlwNIk8E7STHYvQMCTzs6jgI27ko7l2o4B3AaO+4YkJadcVcdlAGfLzA5WQGR7IgbwGtjuCdoj6UXuyJTrhQBcnQjETUmnUv3FAH4CyzwDKyX9SBnM9QAwIWk2AXFV0tlYnzGAebtPP9OnEPkNWO2J2STpQ+9/xBOXJF2ogmgT4Amw3xNyT9JRX1gEYq+kZyGIoQGY2UXgAPyPt5x4V8qH1TRwDvgk6XdkOr2XtLltgLfA1qLTj5I2mNl3YEWDdTQraaJtgAVryMz2AU8bAFC1Boc5hYKbgJmtB6aKgDCbZdEAeLuOWyPrit+qFMmiA0gJrjr4yu1an0Ip4Z6Hss6hMUBu6FD3JB9PodwRGGkPeOHCX+CafzmPDUAR85wBlrgwQ5LbUueV3AHsaxGbmR8uOAGTPYga8f+0pG2LBWAOosYNrFOAqith6L5bdQee81optG7nHIjE8DlnVlB8EVa3AxCJ4VMAleJbB2gAERXfCUANiKT4zgAyILLEdwoQgcgW3zlAIWA30EvWXq+bFBvESTzQxFZqSyqdAe7i7xIAvTIjaXnIRmupxZoAznvPvTZvJO2oCzDQ5G5NgPKbRGWyt7X0egrAzFwedktFtnqXpFe1PFAsxLYfOEIaH0g6UjUAyXx/i09MQY2pq2gSoPDEsB/5QuJPSnLrMFqyAAqIQT+zloX9Aj4DX4CHfuo9RpANkBqJrr6PAboa+V6/I++Bf0in3kCazcMZAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoom{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAkUExURUdwTMDAwL+/v7+/v7+/v76+vr+/v7+/v7+/v7+/v7+/v7+/vxtcv/AAAAALdFJOUwBVdZCpGdZE7C3B0wnY6AAAAV9JREFUOMt1lDtPwzAQx20ghGwVsHVJhQRDlsywWKqEULsw8FhRJ2iWiglGGJvFCw8xIVVCSEwkKU25L4ftpOHs2Cclsu7v370smxCLecRh+xOH8Ja5kGEs/6dtYf1XONcWZurbwwRCQjYZ9l7uHAPAOBHpI1QC/QSY9g84ldmnAn7Z3htwsfZnvSe54eJd5hlcC7gccxTwSETZEr5+714vLRdfkFraVNtetXLpR7ha+mkHCV1Y/q8ZOW8AgDkecsIaAEIcGbIGyLUq4KcBYl0o7QAB4FZACBMrQKpaJOCZQqyAIhgayYEpgD1DZghXCvBTNJFKmCvgzmhcCEsBwMjSRx6BslYftRX0JLYKrAsLqzDC54EFMwvy58QhMM8hFNq0UpwET+sLC9/4BmEBTytyRCIbDoAEiR1Qp1dbRxfoyv9g3ogaKVuXhVZZbtqX6Ez6H23PxG4CM259QDwt/h8ABfK8nDqSAAAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoom:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwCCyreU7KZVRCDaZnETLwj6WaYVAAABUUlEQVRIx5WV2Q6EIAxFoVBWxf7/184AOnGUsvTBqDmXrqRCzNou1kwGtyZIQNuiD0P6evWTURFUMtIoPO+iVoGIZPkMqkdKA0jZgoJ6suQc2EoiGBldOoQ9HSDk5+GTs1Fqo9IlcEpvNv3qv0MBhSalIFSv3+MCJCY8fUaCxasycrMu9dp5VTUhubXZ6CqsAvn66ZAsx+e8fON37oT3bZ4aiRU0kDlavGSrQI95HPBZACt8FuCL16IruBVkzBeBW+CLYHvyfiDQd96IpHpOMqP++fAq9VMQ7rwrM5+6gjwG/3y/D/m8ylPYpvpAeqO7DfvwMPO9D6jnBabG56YFZx77fEjD+9AyLdYEhp8nxoNh5wmJtfY8AS+wzIZZrJNcC4h3wV8IH1p87Iyfnc6XVaAd7ICHAsebw97zgDSxZ/yvViiPuYUfTe650knM2+7Ywz9yOCklzohLOwAAAABJRU5ErkJggg==") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoomStop{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAzUExURUdwTP///////////////////////////////////////////////////////////////8/RimEAAAAQdFJOUwDjmTC6Y0KBVakX8s8iC3JYR1wyAAABVUlEQVRIx62V2baFIAiGcwJRS97/aU/Zbtht0VzrcJOuvl/AAabpXy1RF0F/m2h2PX5mzucEuO9gMon1MY7KlG8w4LImC1XFQmxDGVkm1DYpXi0qS1gXTEGzKoqNS1ajAxPqJDikFLcFS+aukYJffRfXnAj9kYUXFVi86wzzPjuCFRXBwS3KaC/Pt02Ww7uf1jz3BVYtX/OsyDQFDn7yswPXb+Ovs39eJJWwxrOXV4thgC+//QBf/uMAXwAa4AuRBvgdWR58CB2B+eaRG5e8QO7Jn2sIAvzhbdsDnXzev8q0BengGXv8EciH3y1CY5++yI/BRNx82g/La7lc7b0Am/tUC6n3HoZ4SbDyy5BgzSNivV6wbPXeIPOpHlOU+CjkTQKvQOpXdRdJvn+5xttWQa4EZUOzluonT6+q72X6Zb0+T/lNhQd7hg9vm8LWUhW5gT4iN7c/0ZUo8Q3AttYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-zoomStop:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAqUExURUdwTBKV2hGW2xKW2xKW2xKW2xGV3BGW2xGW3BGX2xKW3BKW2xCX2xKW2yDN61kAAAANdFJOUwCAVKxm3T/DmhrxKw97YQBGAAABaklEQVQ4y2NgIA6wGqCLMCqAqV4HdIm9F0Ek22UMM9hiG4AkVzQDA+cmx+YyJJnDlw8wMNQaNpfevbu0QgxJgrN3JQPD3VvhjU57kESnOZqvvXuJgcEXxVFMEkDt1w11gZYwoVgue3d5SzaQSgCydZG1TMkBU8vBuq9guBcqNBNDgj0GQrMEb0CVYEmA2ViANRQZ795tQPZduADciXcVUNSthGu4hGrAJawagBIXsWoAClzGqgEocRWrBqDIrQNQDTPRXZ8A0cB41wBNQgGiQfbubTQJAagGDB0GIA0OsnevbkCTCADiu4J374ahW34JqAEIbiXMRJOAgkvMKJYgJBx6717AKiF4F4eOu+jxgQCXGHBIKPDgkBC8JYCURJDtQHYWN4oEcvpZiyR+C9lZtkgSKKG1CyGOGrxItleixjrcLFBWRAYcMIkG9NQMiY67N7AlcxAQwMwA6SBxM2xZQ3jtVRPsRQ83sg8ACMIUxzzE8wsAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-close{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-close:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTP///////////////////////////////////8kBMKEAAAAJdFJOUwCt0igUwJdJePGbgLgAAADcSURBVDjL1ZMxEoIwFESTCaOWFDapqeicnAALTiANnaWlnVewDTMW/7b+aCAb8jkAVIHN2/lsNkrt73lf8M08nnF1pAYFR/dFmAAx7SIoi4iDbRrWDMAuQFzmmxAGbjjJgjj6dCjMCAND/o8RWQMzUgIRKYE/wsC5TJIRR74rBUZaqqXwLZEXT0WTDGwLW1aavJWQir9qadw++NgykWoMNtcykh8Q5EECgr5C+jjpGjHjPGhPU5eVzyfPJitfnUyhPg6ywMKZ7BygcYcsPCj1Kc8uXYPqpeSLs6PnC4w8S+8OJ9MLAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-narrow{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABm1JREFUaEPVWWuIVVUUXmvfYRosHzUZUUqKjkSXSe5Z+5qJhfawLELCR5ohPhKjjB4EWgkpkopRSWEPS1Mqy7Gkd0iPGaKy6ey9Z3z0opwEQytSMiS5NZ4Ve7j3dubMOfecO96buf/cx17rW+vba52919oH4RQfeIr7DxUjoLW+BhHHAsAAZh5gPwGghpl/TKVSHZ7n7T9+/Ph+ANg/atQo+1mRcUIEtNYzAWAiM09ExLPK8KgNADYw8wYp5Z9l6PUQ7RWBvON3AMClJ2Kcmb9DxAKR33qDVRYBrfUNzLwQESf0xliUDjPvR8T1RLSsXNzEBIwxc5l5fYSBnxGxxfO8bQCwN5VKHc7lcofr6+tzR44cGcTMg4UQgxDRfp8IAJdH4KwlooXlkEhEQGv9EAAsDQF+GwDWEdE75Rg1xlwFADcx83QAOCOg29SvX79ZDQ0NuSSYsQS01h8BwBUBsF45HnTIGHMBM9uFmR2Ya0bEWxzHORBHoiQBY8xmZp4RAFlNRIvigMuZN8asYOb7Azq7hBCTMpnMvlJYkQSMMUuYeblf2fO8ZdlsNiyVyvE3VNZ13XFCiGb/JCK+6DjOrLIJ2N0GAN4KKG4hIpuzVRtKqf6I+HvAwAIiWhdlNDQCSqntga3yUyK6rGqe+4Db2tqu8zzv3cJfiPiLfQYdx/k6zH4PAvlD6iWf8B7P8yZls9mO/4KAtaG1fhgAHvCReN1xnClJCXweOGFLhrAapJqamlLDhg372H9eMPNMKeXmoL1uEVBKTUXEJp+QJiJZDSfjMIOZgIibHMcJbrfdq1Gt9WMAcI8P/D9f/YJtpVQfW7n6isSDRHReyQhorXcCwMV5oWN1dXWD0un04bjVqta81to+i7bi7RpCiAmZTOYDv71iCu3cuXNQZ2env07fRkSTq+VcEtyQ7XwNEfkz5N8Ucl13khDiDR/b+ZlM5vkkhqopo5Q65Euj74loRGgElFJ3IuIThUnP8xqz2eyeajqXBFtrvR0AiuU7EXXbeIo/tNaPAMB9BVBmrpVS/l3KiDFmBjNPKbMbK0A+6zjOq3EktNavAUAxlUsR2AIA0ywgM3dIKYfFgRtjmph5apxc2Dwz/ySlHBynq7V+wV+tliLwPgBcmwdsJaLRceDGmD3MnI6Ti5j/g4j6x+lqrZ8EgGKTE0nAGPM0M9+Wj8BhKWV9HLjrukuFEPMBoMf+HKdrm3oimhcnFyy1IwkopRYj4soCYF1dXf3JPAMKfiilNiFisaSOJOC67nQhxCu+h3i0lLI1boWqPW+M6WDmoXk7+4io8L3rr+IuZIwZycztPocWEdHqajtYCl8pdSEifuOT2UhEc/w63fZUrfWvADCwixlii+M4408mAa31AgB4xufDHCLaGElAKbUZEf09cAMR/XCySGit7TXO3IJ9IcTQYI8cLKfvQsQ1BYVq9sBxi9La2jqipqbmMwA4Oy8bWtoHCTiIaBua0/JKB5hZSikPxhms9LxSah0i2i26MHoUct0eYt+2tRIRF5/MKGit7YFqD9auYU9tRBwfls49emJjzEBm3gEAxVKCmadJKbdWepWj8LTWHwLAlb75hUS0Nkw+6lbidkTspoCI6aibgUoSU0otR8QlBUxE3Oo4TleNlpiAFQwWUfa/XC7XZ8yYMccq6bAfS2v9OADcHUidqUT0RdkE8iS+BIBsQHkkEe2qNAml1HOIeGsA914isqQiR5LL3aMAcHoAYTIR2av0Ex7t7e3ne563mplvDoIh4le2xC+VurEE8pGwh1m3/sBec3ie96iUcndvWLS3t4/o7OycK4SYw8znRKZIDIlEBPIk7IrfGDB01JIAgJZsNtuShIjruplUKmWdtidsMLK2lFmFiPP8fUapSCQmYJ2L6cDsNfh7iLiXme1VjG3GOwFguOd5DYg4HAAa7O/Q3QTRXiavchxnhzHmIgCw3V6xWYoiURYBa9h13atTqdTssJxNEoEImQeJaIV/LimJsgkUjCilLrGXToho33mFrmoMod2I+LLneW9KKb8Nk01CotcE/AaVUmOFENcz8zgAGAIA54Y4dAgADiCifejtjcQnSSIWRgIAniIi+5q3cm/q/c40NzfX9e3bd4gQ4kxEPFhbW3sgnU7/lcThJJHwV8kViUBvHStHz0aCme2qe7W1tasbGxu7rkFPGQKR50Q5q/B/lP0HjgOoT/ydvaYAAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-narrow:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABS1JREFUaEPVmgmoVVUUhr+fosKC5ogGSsqIpKQwMqjIBpsICdMGQ7ISo4wGApugJCoxLClssElpNEuaI5okKjOI5onKhEQrSiKiaKA/Vu3zOu+8c88593qvj7fgcO99e6/h33udtdda+4khThri9tM1ALaPAQ4Btso9GwNfAyuBb7JHUnzvCq0XANuTgePSs00bFr0L3BuPpF/b4BswtSMAyfDzgYPXRznweQ7ID53IaguA7ROBGcC4TpRV8IRL3SNpVrtyGwOwfVYoaaHgW2AZsBT4CliXnt+BXYBd02d8D5c7rIWc+ZJigRpTIwC2rwauKZH6NLBA0jONNQK2jwJOAU4FtijwPgpMkRTga6kWgO2XgSMKkjoyvGiN7d3SwpxZGHsVOEPSmjoElQBsPwScVhAyR9LMOsHtjNu+Hri8wPMBMF7SqipZLQHYvgq4tsA8S1KZK7Vjb+lc24cDsfJ5ul/SlLYBpGjzVIFxsaTw2Z6R7S2BnwoKpkta0Epp6Q7YfqEQKl+XdGjPLM8Jtn088GzuT9/FOyjpkzL9AwCkQ+qB3OSPki9GOrBByPZ1wBU5ZY9LOrkpgDcLJ2zlFvYCke2NgFcK58VkSRFU+lG/HbA9EYg4nNE7kkb3wsg6mSWesEhSMdz2z0Zt3wRcnBO+wVc/0217WMpesyRxraSd6nbgfWC/NOm3OP4lRVowKGQ73sXIeDMaJ+nFvDF9LmQ78pR8nr5U0oRBsTwpLQnn8yTlPeR/F7I9HngiZ/A0SXcPJoDQbftHIHOjLyTt1WoHLgBuyQ3uKylC6KBS8UyS1C/w5F3oRuDSnLWbSPqzynrbkSdFfG6nGstE3inpkbrVsf0Y0OfKVQAWA5OSwJWS9mggPEJuhN5OaLWkqBMqyfZ9QF/4rALwPHBskrZC0pgGwsPFRtbNazH+s6TIfeoA3JqqwH/nVQG4HTg3SVsnadsGwiMznQYMiM91vKmgP7tuXjHVrgJwGXBDTuC2g3kGZHbYXhQVWva7CkCkyg/nAIyRtKJuhXo9bjuSyOFJzypJ2ff/XCqHdBTwXs6gmZLm9NrAKvm29wY+zc1ZKGlqnqeYzH0PbJ8mLJM0dpABTAfuyNkwVdLCKgDFGniEpC8HC4TtaONEOyej4cUaubgDFwLzcgw9q4HrFsV2pAxvANuluaWpfRHAAUAUNJsmpmhrjJa0tk5ht8dtRx0cITqjAYlcv5c49zJHKI2QmtEG3wXbcaDGwZrRamBsmTuX1cTxEi8H8qnEJElLur3KreTZfgk4Mjc+Q9L8svmtuhLnAUWGka06A90EZjt6UdGTymiJpCxHG6CqqrHVL4lKnMMkRaXWE7J9M3BRwXUmSnqrlcK61uLbwIEF5lGSou3XVbJ9F3BOQeglkgJUS2rS3P0F2LwgYYKkaKWvN9neGYgT//QSYR9Hil/lurUAQqjtOMyK9UEkWXMlfdgJihTn45CK1GCHChmVIBoBSCBixU8qKIrdmRuXG5LigqOWbO+fjA7jizsbqcxsINLsfJ3REkRjAAlEVQUWbfDncjc0UYz/BewJjCh8lgGNZvJsSctt75MabLUg2gKQQBydSrwyn63dgRYTrpQUdwR91BRE2wAyDbYPSk2nuPOKVW6X4t15EHhS0mdlzE1AdAygsFpxwX0CEJcUuwM7lhgULhW5VRgeHYnXmiBuAeI2SXHN272b+gKgzRKQrYFIBNdI+qOJwQ13oi8/68oOdGpYO3xpJ2LV/45zI/t3hSEDoBXYIQ/gH99H3EBePlczAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-expand{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABvJJREFUaEPVWWmIXEUQrnqzZseYxGM9QBNF4hrJEDfzqieuAY/gFRXPyMYbzUHwQBQUzx+KeBAJKhrRqEhEQWMU75AYXREPlunu3bjxIDGraIwiuJpFkL26pMK84eXtm3lvZieGFAzsTtf1VVd3V9Ug7OOE+7j/0BAAnZ2d2UmTJl2cyWTaAOBA+TDzgYjYDAB/y4eZ5fNjc3Pze7NmzfqlUYEbFwBr7TUAcAEzXwAA2bROIeKnzrkNALBeKWXTysXx1QXAGHMVANwEACePxzgzjyLi057nrczn81vr0VUTAGOMRPtmRDy7HmOVZBDxL+fcyr6+vgc7OjqGatGdGoC19hZmfrKC8t9LafEWAGzLZDL9g4OD/S0tLYM7d+6cyszTPM+biojy97kAcGoFPV8ODw8vbG9v354WRCoAxpiXAUDyPUrvAcAqIno/rUHhs9aeCQALmflyAJgUlkXEf5xzp6U9G4kAjDHcKMejeqy1xzDz/QBwXYyNViL6ISkwVQEYY74AgLkRJcuJ6M4kxbWsW2sfZua7ozJNTU1HtLW1/VFNV0UAxpjlAHBHWNg590ChUJCINZyKxeLpnud1RhSvmzJlyiWtra2DFS+AuAW5bQDg3cja60QkObvHSGstj588fGVi5heVUktqAqC1Xh+5Kj8nolP2mOchxd3d3ec55z6I2JpPROvj7I9JodIj9UqIebNz7qJCodD3fwAQG8aYhwDgnpC99UQ0Py2ALyMv7DIiWvV/OS921qxZk5k+ffon4fcCEZf4vv9i1I/ddkBrfSUivhpiMkSkanXeWnsFAFwCADNHR0fX1nPwYzJhAxGdkwTgJUQM38l1Rd8Y8yYAXFoytoOIjqo1CFrriQDwCyIeEsh6nndsPp//KayrvANbt25tHhgY+AsA9i8x/JvNZqfmcrn+Wo1bazuZ+fRAjogSH8w4G8YYOYtSOAZ0GxE9EQvAGCMRk8gF9BYRLajVeeFvIIDdrnOpt3zfnxcLwFr7CDPfFdqupfl8/oW9CUBsa63/DKXRz0R0TCUAzzDzDcGic25WoVDYvLcBGGPk/i+X7wMDA/vNmzdvJPCrnJvW2leZ+cpggZknKKWGqwGw1l7IzOcg4swoX/gMyNbH6HnO9/3XkgJkjFkLAOVUzmQyM2bPnr1lDABjjJTE58sCM/cppaanUK4BgJL44taZebtSalqSrDHmpXC1ysynKKU+j9uBj5hZ6nShLiJqT1Jurd3MzLkkvgrrfxPRwUmyxpinAODmSqkdTqE3mPmy0g70K6VakpQXi8X7Pc9bCgBHJvHGrEsjtCxJLlpqDw8PTwt3bGEAzzNzuerLZrMt9bwB4lCjrtHSLbQaEa8NgGaz2cm5XO6fuDPwGADcHjrE7UqprqQIxa03EoC1to+Zjy3ZGZN25R3QWt+IiCtDDt1JRNLU1EyNAqC1PgERvws58DYRSY1VpjKA3t7eaUNDQz+Xtybm1UuLpFEAjDFyRp4N2a1cSsTlLgCkaqyjwBoIQMrnRYH+0dHR/Jw5c3pid6B0YO5GxIdDV1ZdPbC19nLn3GOIOAUA1hLR4rS7F/B1dXUd39TUJEOFQ+U7RNzo+/5ZUT3RfsBHRGloZCgrtIOZlVLqt1odGC+/1noVIsoVHdAiIpJHbTcaU+ZqrR9BxHJRtycnEZVAGmOkfVwXOo9bJk+efGLcdGIMAGvtYcz8FQCUSwlm7lBKvTHeqKaVN8ZsBIAz0qRybKMRc6VKDuZ83/82rRP18mmtH0TE+0LyHxNRUOKMUVuxU7LWlkuLQGpwcHDi3Llz/63XuSQ5Y8zjAHBrwMfM/cy8oFAoxFWzu9iSRou/xtQ5bUT0dZIzta5rrZ+XyUNYDhFv931/RTVdVQF0d3e3OufKtXdI0QIiklH6uKmnp+co59zycC8SOrzfAEBHtdRNbLaLxeIMz/O+H3N9Ia52zq1QSvXWg6Knp+f4kZGRRZ7nXc/Mh1fSgYhVQSQCEMW9vb1HDA0NyS0UHS/KLF+2+NNqeRp2rlgs5jOZjDgtL+wBEcdlEv0oIi4O9xnVQKQCIEZkTuN53uqgZ4iJmMxrPkTEbXL4AECaceldj3POtSLicVKayP9x0UZEGSY/6vv+V9ZaaVHXpAGRGkBgtFgsnpXJZK6Ly9l6Uqkkcy8RlUsY+S4tiJoBBE5qrU9CxKvlZ1YA2G3UkRJIr4wxnXPvKKXGnLG0IOoGEHZSnn5EvIiZTwKAowEgrh39U2orRJRDLxOJz9IAjdsJAHiGiORn3sb8Uh91ZNOmTQeMjIwcjYgHIeJvEyZM2JHL5Wr6+TSsMwoCEVf4vr+re2zIDqSJ5Hh5BAQzS9R/IiJpf3fRPgOg4jsx3sjsbfn/AH37LF5g3/BiAAAAAElFTkSuQmCC") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-icon-expand:hover{background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAABYZJREFUaEPVmXmoVVUUxn8f0WRzVkJlIWVGUmIJWWADTVaUldFclCnSQBQYNv1RSCWGVFRSlkRh0GBS2YBmJWGJUBHNNJiYWQSZfwTRxBfrce5jv/3Ovefc++4z3oKLD/fea61v7bXXdMQQJw1x/ekKANs7AOcA44Ddkt/2wJbk9z2wTNIP3TLcgADYvhw4q/gFiLq0ClgBLJf0Ud1DZfs6AmD7UuA64JiBCAf+BR4GHpH0TSe82gJgO6x9PXBqJ8JanPktQABzJP3VDu/aAGzfADzYhPnPQLjFUuA7YHPx+xPYHxhZ/Bt/nw4c14TP+8CFkjbWBVELgO2ngfD3nJYBCyW9Wldg7LN9cigKXATsnJ39HTi+7tuoBGDb3VI852P7QOBO4MoSGaMlfVtlmJYAbL8HHJsxmSdpdhXjdtZt3wPcWnJmhKRfWvFqCsD2PODm7PBdksJiXSfbJwDvZIzfAM6VFG+plEoBFNHmlezEc5LCZweNbEcSjMSX0iJJ09sFsDwLlaslTRo0zRPGts8AXstkTZYUOvWjfjdQJKnFyc7PgCmS1m0NACHD9t3AbYm8yNiT6wKIWJxm2JmSFm4t5QsA2wBvZ/liuqRFuR59bsD2JcAzyaYPJU1oV3nbF8fjAw4DlnTy8Es8YYWk06oAPJnF5I6sb/tF4LxC2CZJ+3VghGFAVK17JmdHSVqf8uq9AdtR+kZNsmOx4Y9I/5KiLGiLbEc4jLDYQ5IqE2aZANvxFqNwbNBNkh5oBiAsFpZr0FJJU9vSvNjcRQBRPKbhfJWkE5sBuBe4JVmcIemJ/xNAyLb9a+JGGyRF+dFLqQstAK5J1g6XFCG0berWDRQA8py0raR/et2z8YftiD4RhRq0naS/W2lv+2wgIkNEm5x630BRaufrj0l6tso6tpcAqSuPkfR1GYAoic8sFtZJOqgG8w+Ao6r2NVnfKCn6hJZkO4+MkyStLgPwJhB1etBaSRNrMA8XG1u1r8n6Fkl7VJ21/VDRBTa29nHt9A28AJxf7NosaXgN5lGZzgD2rdpbsh6N0MyqcyWl9si0Y0sBPA6kVd/wTnJAKNTlR/wUcEUCdBdJ0bX1UArgPmBWsnGipLVVFipb7zKAKCJHFXL6uV0K4NpiMtDQabakaGrapm4BsH0o8GWiwEuSosbqpRRARIQNyVq/rFcXSRcBxBt5NJHbvJQo812gVmOdA+sigCifpyX8x0v6uPQGCgDRWEeD3aCOemDb0XrGm9q1KKevrnt7jX22DwFiqLBX8X8rJZ2S88n7gSOBaGiiMg3aBEyQ9FO7Cgx0v+1ooiJEN2iapEhqfaispcyLuo5uYSAAbEf7GBOJBkXpcETZdKIMwN7AGiAtJS6QFIluq5DtlcBJdVy52VglD6nBa6ykLwYbge05wB2JnLckNUqcfuJbDbbS0qJxcJik6NQGhWzfD9yYMI9ucKqkGByXUtVo8ceSOmecpE+6jcB2XsqEiFmS5reSVQVgNNBbeyeMwioxSh8w2Y6GPzJ+2os0+H4OxPtr6rqVzbbtMcBXJZpGkTVf0qedoCjifCSpq4B9WvBoCaISQDC2PQKIN5GPF6MqjCuOsqOpn6bK2R5fKB3K75QpHpPouUAkvrTPaAqiFoACRMxpwuqNniE3WsxrXk++0EQzHr3rwVGSZP+WGTymD3MlrbEdLerzdUDUBtCQaDvSeXyQKPPZTrwpztwuKS1h4tZrgWgbQALkaOCy4hNrn1FHTRTxdmKQ8LKksjdWC0THADK/jtQ/BQhQBwBl7Wi4VNRWoXhMJN6tA7TJTSyQFJ95u/OlPlfEdjzOALI7EIVgzEfb+nyaGSh3p4h+Pd1jV26gjiUHuqe4ibD6eklRqvfQkAHQzABDHsB/7aMVT352GH8AAAAASUVORK5CYII=") no-repeat 50%;background-size:100% 100%}.jb-pro-container .jb-pro-menu-icon-text,.jb-pro-container .jb-pro-quality-icon-text,.jb-pro-container .jb-pro-scale-icon-text,.jb-pro-container .jb-pro-speed-icon-text{font-size:14px;min-width:30px;height:20px;line-height:20px;cursor:pointer;text-align:center}.jb-pro-container .jb-pro-speed{box-sizing:border-box;text-align:center;font-size:14px;color:#fff;width:90px}.jb-pro-container .jb-pro-menu-list,.jb-pro-container .jb-pro-quality-menu-list,.jb-pro-container .jb-pro-scale-menu-list,.jb-pro-container .jb-pro-speed-menu-list{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;overflow:hidden;width:-moz-max-content;width:max-content}.jb-pro-container .jb-pro-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-quality-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-scale-menu-list.jb-pro-speed-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-quality-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-scale-menu-shown,.jb-pro-container .jb-pro-speed-menu-list.jb-pro-speed-menu-shown{visibility:visible;opacity:1}.jb-pro-container .icon-title-tips{pointer-events:none;position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:rgba(0,0,0,.5);border-radius:4px}.jb-pro-container .icon-title{display:inline-block;padding:5px 10px;font-size:12px;white-space:nowrap;color:#fff}.jb-pro-container .jb-pro-quality-menu{padding:8px 0}.jb-pro-container .jb-pro-menu-item,.jb-pro-container .jb-pro-quality-menu-item,.jb-pro-container .jb-pro-scale-menu-item,.jb-pro-container .jb-pro-speed-menu-item{display:block;height:25px;line-height:25px;margin:0;padding:0 10px;cursor:pointer;font-size:14px;text-align:center;width:50px;color:hsla(0,0%,100%,.5);transition:color .3s,background-color .3s}.jb-pro-container .jb-pro-menu-item:hover,.jb-pro-container .jb-pro-quality-menu-item:hover,.jb-pro-container .jb-pro-scale-menu-item:hover,.jb-pro-container .jb-pro-speed-menu-item:hover{background-color:hsla(0,0%,100%,.2)}.jb-pro-container .jb-pro-menu-item:focus,.jb-pro-container .jb-pro-quality-menu-item:focus,.jb-pro-container .jb-pro-scale-menu-item:focus,.jb-pro-container .jb-pro-speed-menu-item:focus{outline:none}.jb-pro-container .jb-pro-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-quality-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-scale-menu-item.jb-pro-speed-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-quality-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-scale-menu-item-active,.jb-pro-container .jb-pro-speed-menu-item.jb-pro-speed-menu-item-active{color:#2298fc}.jb-pro-container .jb-pro-volume-panel-wrap{position:absolute;left:50%;bottom:100%;visibility:hidden;opacity:0;transform:translateX(-50%) translateY(22%);transition:visibility .3s,opacity .3s;background-color:rgba(0,0,0,.5);border-radius:4px;height:120px;width:50px;overflow:hidden}.jb-pro-container .jb-pro-volume-panel-wrap.jb-pro-volume-panel-wrap-show{visibility:visible;opacity:1}.jb-pro-container .jb-pro-volume-panel{cursor:pointer;position:absolute;top:21px;height:60px;width:50px;overflow:hidden}.jb-pro-container .jb-pro-volume-panel-text{position:absolute;left:0;top:0;width:50px;height:20px;line-height:20px;text-align:center;color:#fff;font-size:12px}.jb-pro-container .jb-pro-volume-panel-handle{position:absolute;top:48px;left:50%;width:12px;height:12px;border-radius:12px;margin-left:-6px;background:#fff}.jb-pro-container .jb-pro-volume-panel-handle:before{bottom:-54px;background:#fff}.jb-pro-container .jb-pro-volume-panel-handle:after{bottom:6px;background:hsla(0,0%,100%,.2)}.jb-pro-container .jb-pro-volume-panel-handle:after,.jb-pro-container .jb-pro-volume-panel-handle:before{content:"";position:absolute;display:block;left:50%;width:3px;margin-left:-1px;height:60px}.jb-pro-container.jb-pro-fullscreen-web .jb-pro-controls{width:100vh}.jb-pro-container.jb-pro-fullscreen-web .jb-pro-play-big:after{transform:translate(-50%,-50%) rotate(270deg)}.jb-pro-container.jb-pro-fullscreen-web .jb-pro-loading{flex-direction:row}.jb-pro-container.jb-pro-fullscreen-web .jb-pro-loading-text{transform:rotate(270deg)}.jb-pro-container .jb-pro-contextmenus{display:none;flex-direction:column;position:absolute;z-index:120;left:10px;top:10px;min-width:200px;padding:5px 0;background-color:rgba(0,0,0,.9);border-radius:3px}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu{cursor:pointer;font-size:12px;display:block;color:#fff;padding:10px 15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-shadow:0 0 2px rgba(0,0,0,.5);border-bottom:1px solid hsla(0,0%,100%,.1)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu a{color:#fff;text-decoration:none}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span{display:inline-block;padding:0 7px}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span.art-current,.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu span:hover{color:var(--theme)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu:hover{background-color:hsla(0,0%,100%,.1)}.jb-pro-container .jb-pro-contextmenus .jb-pro-contextmenu:last-child{border-bottom:none}.jb-pro-container.jb-pro-contextmenus-show .jb-pro-contextmenus{display:flex}.jb-pro-container .jb-pro-extend-dom{display:block;position:relative;width:100%;height:100%;display:none}.jb-pro-container-playback .jb-pro-controls{height:48px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center{flex:1;display:flex;box-sizing:border-box;justify-content:space-between;font-size:12px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time{box-sizing:border-box;flex:1;position:relative;height:100%}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-inner{width:300px;height:100%;overflow-y:hidden;overflow-x:auto}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-current-time{position:absolute;left:0;top:0;height:15px;width:1px;background-color:red;text-align:center;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-current-time-text{position:absolute;box-sizing:border-box;padding:0 5px;width:60px;left:-25px;top:15px;border:1px solid red;height:15px;line-height:15px;cursor:move;background-color:#fff;color:#000;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll{position:relative;width:1440px;margin:0 auto}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.one-hour{width:1440px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.half-hour{width:2880px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.ten-min{width:8640px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.five-min{width:17280px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-scroll.one-min{width:86400px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-time-list{position:relative;background-color:#ccc;height:48px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-day{height:100%;overflow:hidden}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-one-wrap{height:8px;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-wrap{height:25px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-controls-playback-btns{display:flex;align-items:center}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one{float:left;width:1px;height:8px;margin:0;cursor:default;position:relative;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one.active,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one.active{background-color:orange;cursor:pointer}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one.start,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one.start{background-color:#999}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-one:hover .jb-pro-playback-time-title-tips,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-second-one:hover .jb-pro-playback-time-title-tips{visibility:visible;opacity:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips{pointer-events:none;position:absolute;left:0;top:100%;visibility:hidden;opacity:0;transform:translateX(13%);transition:visibility .3s ease 0s,opacity .3s ease 0s;background-color:#000;border-radius:4px;z-index:1}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips.jb-pro-playback-time-title-tips-left{transform:translateX(-100%)}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-title-tips .jb-pro-playback-time-title{display:inline-block;padding:2px 5px;font-size:12px;white-space:nowrap;color:#fff}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute{float:left;position:relative;width:60px;box-sizing:border-box;border-top:1px solid #999;-webkit-user-select:none;-moz-user-select:none;user-select:none;text-align:left;height:25px;line-height:25px}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:first-child,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:first-child{border-left:0}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:first-child .jb-pro-playback-time-hour-text,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:first-child .jb-pro-playback-time-hour-text{left:0}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour:after,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute:after{content:"";position:absolute;left:0;top:-8px;width:1px;height:14px;background-color:#999}.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-hour-text,.jb-pro-container-playback .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-center .jb-pro-playback-time-minute-text{position:absolute;left:-13px}.jb-pro-container-playback .jb-pro-playback-expand.disabled .jb-pro-icon-expand,.jb-pro-container-playback .jb-pro-playback-narrow.disabled .jb-pro-icon-narrow{cursor:no-drop}.jb-pro-container-playback .jb-pro-control-progress-simple{position:absolute;box-sizing:border-box;left:0;top:-2px;width:100%;display:flex;flex-direction:row;align-items:center;height:8px;cursor:pointer}.jb-pro-container-playback .jb-pro-control-progress-simple:hover{top:0;align-items:flex-start}.jb-pro-container-playback .jb-pro-control-progress-simple:hover .jb-pro-control-progress-inner{height:100%}.jb-pro-container-playback .jb-pro-control-progress-simple:hover .jb-pro-control-progress-inner .jb-pro-progress-indicator{transform:scale(1);visibility:visible}.jb-pro-container-playback .jb-pro-control-progress-inner{display:flex;align-items:center;position:relative;height:50%;width:100%;transition:all .2s ease;background:hsla(0,0%,100%,.5)}.jb-pro-container-playback .jb-pro-progress-hover{display:none;width:0}.jb-pro-container-playback .jb-pro-progress-played{position:absolute;left:0;top:0;right:0;bottom:0;height:100%;width:0;background-color:orange}.jb-pro-container-playback .jb-pro-progress-indicator{visibility:hidden;align-items:center;justify-content:center;position:absolute;z-index:40;border-radius:50%;transform:scale(.1);transition:transform .1s ease-in-out}.jb-pro-container-playback .jb-pro-progress-indicator .jb-pro-icon{width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.jb-pro-container-playback .jb-pro-progress-indicator:hover{transform:scale(1.2)!important}.jb-pro-container-playback .jb-pro-progress-tip{display:none;position:absolute;z-index:50;top:-25px;left:0;height:20px;padding:0 5px;line-height:20px;color:#fff;font-size:12px;text-align:center;background:rgba(0,0,0,.7);border-radius:3px;font-weight:700;white-space:nowrap}.jb-pro-container-playback.jb-pro-fullscreen-web .jb-pro-controls .jb-pro-controls-bottom .jb-pro-controls-playback-time-inner{overflow-y:auto}.jb-pro-zoom-control{cursor:grab}.jb-pro-performance-panel{position:absolute;box-sizing:border-box;z-index:10000;left:0;top:0;padding:5px;font-size:10px;background:rgba(0,0,0,.2);color:#fff;max-height:100%;overflow-y:auto;display:none}.jb-pro-performance-panel .jb-pro-performance-item{display:flex;align-items:center;margin-top:3px;color:#fff}.jb-pro-performance-panel .jb-pro-performance-item-block{height:10px}.jb-pro-tips-message{position:absolute;top:0;left:0;width:100%;height:100%;background:linear-gradient(180deg,rgba(0,0,0,.8),hsla(0,0%,100%,0));overflow:auto;box-sizing:content-box;display:none}.jb-pro-tips-message:before{color:hsla(0,0%,100%,.3);content:"X";font-family:Arial,Helvetica,sans-serif;font-size:40px;left:0;line-height:1;margin-top:-20px;position:absolute;text-shadow:2em 2em 4em #000;text-align:center;top:50%;vertical-align:middle;width:100%}.jb-pro-tips-message .jb-pro-tips-message-close{position:absolute;z-index:99999;right:0;top:0;width:40px;height:40px;display:flex;align-items:center;justify-content:center}.jb-pro-tips-message .jb-pro-tips-message-close .jb-pro-tips-message-close-icon{width:20px;height:20px;border-radius:10px;cursor:pointer;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAeUExURUdwTM3Nzc7Ozs7Ozs3Nzc3NzcrKys3Nzc3Nzc3NzePZJxkAAAAJdFJOUwCtKdPBGAmNTt3jdDcAAADfSURBVDjL1dOxDoIwEADQgwR07GTCZtI/IGHgAzBhM9EPkMTB0Y3V0ZXIcn/rtRR6pefgSKeSu3ellyvA9lZ/5F9p/3K7PZY8oPG5BD6MpPUSgIITzdIStifAshjRQV1PCFT8TxaicTzzwEwINOEdHVmDmcTAkRhMhMAp7iQRjcMtDhCp8SA1v0ARGIIK/gnkv0p1OBTS4QRUIpE7DiYYXTBrzcld3JIrAarXrps4AVNwRSZgExoJmIyAaAdsShUMn/JF2fh4YEkpAcgvnuwYCIb6EbbbP4PsDfLD2dD6Av1qTvAQlzUTAAAAAElFTkSuQmCC") no-repeat 50%;background-color:#fff;background-size:100% 100%}.jb-pro-tips-message .jb-pro-tips-message-content{overflow:auto;padding:35px;box-sizing:border-box;width:100%;height:100%}.jb-pro-tips-message .jb-pro-tips-message-content .jb-pro-tips-message-content-item{font-size:14px;color:#fff;text-align:center;line-height:1.5}');class Ih{constructor(e){var t;this.player=e,this.TAG_NAME="Control",this.extendBtnList=[],((e,t)=>{e._opt.hasControl&&e._opt.controlAutoHide?e.$container.classList.add("jb-pro-controls-show-auto-hide"):e.$container.classList.add("jb-pro-controls-show");const i=e._opt,s=i.operateBtns,r=`\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
00:00:00
\n
\n
\n
\n
\n ${i.playbackConfig.showPrecisionBtn?`\n
\n
${Ah.narrow}
\n
${Ah.expand}
\n
\n `:""}\n
\n `;e.$container.insertAdjacentHTML("beforeend",`\n ${i.background?`
`:""}\n
\n \n
\n ${i.loadingIcon?`\n
\n ${Ah.loading}\n
${i.loadingText}
\n
\n `:""}\n ${i.hasControl&&s.play?'
':""}\n ${i.hasControl&&s.ptz?`\n
\n
\n
\n
\n
\n
\n ${i.ptzMoreArrowShow?'\n
\n
\n
\n
\n ':""}\n
\n
\n ${i.ptzZoomShow?'\n
\n
\n \n \n 缩放+\n \n
\n
\n \n \n 缩放-\n \n
\n
\n ':""}\n ${i.ptzApertureShow?'\n
\n
\n \n \n 光圈+\n \n
\n
\n \n \n 光圈-\n \n
\n
\n ':""}\n ${i.ptzFocusShow?'\n
\n
\n \n \n 聚焦+\n \n
\n
\n \n \n 聚焦-\n \n
\n
\n ':""}\n ${i.ptzCruiseShow?'\n
\n
\n \n \n 巡航开\n \n
\n
\n \n \n 巡航关\n \n
\n
\n ':""}\n ${i.ptzFogShow?'\n
\n
\n \n \n 透雾开\n \n
\n
\n \n \n 透雾关\n \n
\n
\n ':""}\n\n ${i.ptzWiperShow?'\n
\n
\n \n \n 雨刷开\n \n
\n
\n \n \n 雨刷关\n \n
\n
\n ':""}\n
\n
\n `:""}\n ${i.hasVideo?`\n
\n
${Ah.narrow}
\n
电子放大
\n
${Ah.expand}
\n
${Ah.zoomStop}
\n
\n
\n
\n
00:00:00
\n
${Ah.recordStop}
\n
\n `:""}\n\n ${i.hasControl?`\n
\n
\n
\n ${i.showBandwidth?'
':""}\n
\n
${i.controlHtml}
\n
\n ${i.playType===_&&i.playbackConfig.showControl&&i.playbackConfig.controlType===Q.normal?r:""}\n ${i.playType===_&&i.playbackConfig.showControl&&i.playbackConfig.controlType===Q.simple?'\n
\n
\n
\n
\n
\n
00:00
\n
\n
\n ':""}\n
\n ${i.playType===_&&i.playbackConfig.showRateBtn?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.close?`
${Ah.close}
`:""}\n ${s.logSave?`
${Ah.logSave}
`:""}\n ${s.performance?`
${Ah.performance}
${Ah.performanceActive}
`:""}\n ${s.aiFace?`
${Ah.face}
${Ah.faceActive}
`:""}\n ${s.aiObject?`
${Ah.object}
${Ah.objectActive}
`:""}\n ${s.aiOcclusion?`
${Ah.occlusion}
${Ah.occlusionActive}
`:""}\n ${s.quality?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.scale?'\n
\n
\n
\n
\n
\n
\n ':""}\n ${s.audio?`\n
\n
\n ${Ah.audio}\n ${Ah.mute}\n
\n
\n
\n
\n
\n
\n
\n
\n `:""}\n ${s.play?`
${Ah.play}
${Ah.pause}
`:""}\n ${s.screenshot?`
${Ah.screenshot}
`:""}\n ${s.record?`
${Ah.record}
${Ah.recordStop}
`:""}\n ${s.ptz?`
${Ah.ptz}
${Ah.ptzActive}
`:""}\n ${s.zoom?`
${Ah.zoom}
${Ah.zoomStop}
`:""}\n ${s.fullscreen?`
${Ah.fullscreen}
${Ah.fullscreenExit}
`:""}\n
\n
\n
\n `:""}\n
\n
\n
\n
\n
\n
\n
\n
\n `),Object.defineProperty(t,"$poster",{value:e.$container.querySelector(".jb-pro-poster")}),Object.defineProperty(t,"$loadingBg",{value:e.$container.querySelector(".jb-pro-loading-bg")}),Object.defineProperty(t,"$loadingBgImage",{value:e.$container.querySelector(".jb-pro-loading-bg-image")}),Object.defineProperty(t,"$loading",{value:e.$container.querySelector(".jb-pro-loading")}),Object.defineProperty(t,"$loadingText",{value:e.$container.querySelector(".jb-pro-loading-text")}),Object.defineProperty(t,"$play",{value:e.$container.querySelector(".jb-pro-play")}),Object.defineProperty(t,"$playBig",{value:e.$container.querySelector(".jb-pro-play-big")}),Object.defineProperty(t,"$recording",{value:e.$container.querySelector(".jb-pro-recording")}),Object.defineProperty(t,"$recordingTime",{value:e.$container.querySelector(".jb-pro-recording-time")}),Object.defineProperty(t,"$recordingStop",{value:e.$container.querySelector(".jb-pro-recording-stop")}),Object.defineProperty(t,"$pause",{value:e.$container.querySelector(".jb-pro-pause")}),Object.defineProperty(t,"$controls",{value:e.$container.querySelector(".jb-pro-controls")}),Object.defineProperty(t,"$controlsInner",{value:e.$container.querySelector(".jb-pro-controls-bottom")}),Object.defineProperty(t,"$controlsLeft",{value:e.$container.querySelector(".jb-pro-controls-left")}),Object.defineProperty(t,"$controlsRight",{value:e.$container.querySelector(".jb-pro-controls-right")}),Object.defineProperty(t,"$volume",{value:e.$container.querySelector(".jb-pro-volume")}),Object.defineProperty(t,"$volumePanelWrap",{value:e.$container.querySelector(".jb-pro-volume-panel-wrap")}),Object.defineProperty(t,"$volumePanelText",{value:e.$container.querySelector(".jb-pro-volume-panel-text")}),Object.defineProperty(t,"$volumePanel",{value:e.$container.querySelector(".jb-pro-volume-panel")}),Object.defineProperty(t,"$volumeHandle",{value:e.$container.querySelector(".jb-pro-volume-panel-handle")}),Object.defineProperty(t,"$volumeOn",{value:e.$container.querySelector(".jb-pro-icon-audio")}),Object.defineProperty(t,"$volumeOff",{value:e.$container.querySelector(".jb-pro-icon-mute")}),Object.defineProperty(t,"$fullscreen",{value:e.$container.querySelector(".jb-pro-fullscreen")}),Object.defineProperty(t,"$fullscreenExit",{value:e.$container.querySelector(".jb-pro-fullscreen-exit")}),Object.defineProperty(t,"$record",{value:e.$container.querySelector(".jb-pro-record")}),Object.defineProperty(t,"$recordStop",{value:e.$container.querySelector(".jb-pro-record-stop")}),Object.defineProperty(t,"$screenshot",{value:e.$container.querySelector(".jb-pro-screenshot")}),Object.defineProperty(t,"$speed",{value:e.$container.querySelector(".jb-pro-speed")}),Object.defineProperty(t,"$controlHtml",{value:e.$container.querySelector(".jb-pro-controls-item-html")}),Object.defineProperty(t,"$playbackTime",{value:e.$container.querySelector(".jb-pro-controls-playback-time")}),Object.defineProperty(t,"$playbackTimeInner",{value:e.$container.querySelector(".jb-pro-controls-playback-time-inner")}),Object.defineProperty(t,"$playbackTimeScroll",{value:e.$container.querySelector(".jb-pro-controls-playback-time-scroll")}),Object.defineProperty(t,"$playbackTimeList",{value:e.$container.querySelector(".jb-pro-controls-playback-time-list")}),Object.defineProperty(t,"$playbackTimeListOne",{value:e.$container.querySelector(".jb-pro-playback-time-one-wrap")}),Object.defineProperty(t,"$playbackTimeListSecond",{value:e.$container.querySelector(".jb-pro-playback-time-second-wrap")}),Object.defineProperty(t,"$playbackCurrentTime",{value:e.$container.querySelector(".jb-pro-controls-playback-current-time")}),Object.defineProperty(t,"$playbackCurrentTimeText",{value:e.$container.querySelector(".jb-pro-controls-playback-current-time-text")}),Object.defineProperty(t,"$controlsPlaybackBtns",{value:e.$container.querySelector(".jb-pro-controls-playback-btns")}),Object.defineProperty(t,"$playbackNarrow",{value:e.$container.querySelector(".jb-pro-playback-narrow")}),Object.defineProperty(t,"$playbackExpand",{value:e.$container.querySelector(".jb-pro-playback-expand")}),Object.defineProperty(t,"$ptz",{value:e.$container.querySelector(".jb-pro-ptz")}),Object.defineProperty(t,"$ptzActive",{value:e.$container.querySelector(".jb-pro-ptz-active")}),Object.defineProperty(t,"$ptzControl",{value:e.$container.querySelector(".jb-pro-ptz-controls")}),Object.defineProperty(t,"$ptzBgActive",{value:e.$container.querySelector(".jb-pro-ptz-bg-active")}),Object.defineProperty(t,"$ptzControlCircular",{value:e.$container.querySelector(".jb-pro-ptz-control")}),Object.defineProperty(t,"$ptzArrows",{value:e.$container.querySelectorAll(".jb-pro-ptz-arrow")}),Object.defineProperty(t,"$ptzExpand",{value:e.$container.querySelector(".jb-pro-ptz-expand")}),Object.defineProperty(t,"$ptzNarrow",{value:e.$container.querySelector(".jb-pro-ptz-narrow")}),Object.defineProperty(t,"$ptzApertureFar",{value:e.$container.querySelector(".jb-pro-ptz-aperture-far")}),Object.defineProperty(t,"$ptzApertureNear",{value:e.$container.querySelector(".jb-pro-ptz-aperture-near")}),Object.defineProperty(t,"$ptzFocusFar",{value:e.$container.querySelector(".jb-pro-ptz-focus-far")}),Object.defineProperty(t,"$ptzFocusNear",{value:e.$container.querySelector(".jb-pro-ptz-focus-near")}),Object.defineProperty(t,"$ptzCruisePlay",{value:e.$container.querySelector(".jb-pro-ptz-cruise-play")}),Object.defineProperty(t,"$ptzCruisePause",{value:e.$container.querySelector(".jb-pro-ptz-cruise-pause")}),Object.defineProperty(t,"$ptzFogOpen",{value:e.$container.querySelector(".jb-pro-ptz-fog-open")}),Object.defineProperty(t,"$ptzFogClose",{value:e.$container.querySelector(".jb-pro-ptz-fog-close")}),Object.defineProperty(t,"$ptzWiperOpen",{value:e.$container.querySelector(".jb-pro-ptz-wiper-open")}),Object.defineProperty(t,"$ptzWiperClose",{value:e.$container.querySelector(".jb-pro-ptz-wiper-close")}),Object.defineProperty(t,"$qualityText",{value:e.$container.querySelector(".jb-pro-quality-icon-text")}),Object.defineProperty(t,"$qualityMenu",{value:e.$container.querySelector(".jb-pro-quality-menu")}),Object.defineProperty(t,"$qualityMenuList",{value:e.$container.querySelector(".jb-pro-quality-menu-list")}),Object.defineProperty(t,"$scaleText",{value:e.$container.querySelector(".jb-pro-scale-icon-text")}),Object.defineProperty(t,"$scaleMenu",{value:e.$container.querySelector(".jb-pro-scale-menu")}),Object.defineProperty(t,"$scaleMenuList",{value:e.$container.querySelector(".jb-pro-scale-menu-list")}),Object.defineProperty(t,"$zoom",{value:e.$container.querySelector(".jb-pro-zoom")}),Object.defineProperty(t,"$zoomStop",{value:e.$container.querySelector(".jb-pro-zoom-stop")}),Object.defineProperty(t,"$zoomNarrow",{value:e.$container.querySelector(".jb-pro-zoom-narrow")}),Object.defineProperty(t,"$zoomExpand",{value:e.$container.querySelector(".jb-pro-zoom-expand")}),Object.defineProperty(t,"$zoomStop2",{value:e.$container.querySelector(".jb-pro-zoom-stop2")}),Object.defineProperty(t,"$close",{value:e.$container.querySelector(".jb-pro-close")}),Object.defineProperty(t,"$zoomControls",{value:e.$container.querySelector(".jb-pro-zoom-controls")}),Object.defineProperty(t,"$performancePanel",{value:e.$container.querySelector(".jb-pro-performance-panel")}),Object.defineProperty(t,"$performance",{value:e.$container.querySelector(".jb-pro-performance")}),Object.defineProperty(t,"$performanceActive",{value:e.$container.querySelector(".jb-pro-performance-active")}),Object.defineProperty(t,"$faceDetect",{value:e.$container.querySelector(".jb-pro-face")}),Object.defineProperty(t,"$faceDetectActive",{value:e.$container.querySelector(".jb-pro-face-active")}),Object.defineProperty(t,"$objectDetect",{value:e.$container.querySelector(".jb-pro-object")}),Object.defineProperty(t,"$objectDetectActive",{value:e.$container.querySelector(".jb-pro-object-active")}),Object.defineProperty(t,"$occlusionDetect",{value:e.$container.querySelector(".jb-pro-occlusion")}),Object.defineProperty(t,"$occlusionDetectActive",{value:e.$container.querySelector(".jb-pro-occlusion-active")}),Object.defineProperty(t,"$contextmenus",{value:e.$container.querySelector(".jb-pro-contextmenus")}),Object.defineProperty(t,"$speedText",{value:e.$container.querySelector(".jb-pro-speed-icon-text")}),Object.defineProperty(t,"$speedMenu",{value:e.$container.querySelector(".jb-pro-speed-menu")}),Object.defineProperty(t,"$speedMenuList",{value:e.$container.querySelector(".jb-pro-speed-menu-list")}),Object.defineProperty(t,"$logSave",{value:e.$container.querySelector(".jb-pro-logSave")}),Object.defineProperty(t,"$playbackProgress",{value:e.$container.querySelector(".jb-pro-control-progress-simple")}),Object.defineProperty(t,"$playbackProgressTip",{value:e.$container.querySelector(".jb-pro-progress-tip")}),Object.defineProperty(t,"$playbackProgressHover",{value:e.$container.querySelector(".jb-pro-progress-hover")}),Object.defineProperty(t,"$playbackProgressPlayed",{value:e.$container.querySelector(".jb-pro-progress-played")}),Object.defineProperty(t,"$playbackProgressIndicator",{value:e.$container.querySelector(".jb-pro-progress-indicator")}),Object.defineProperty(t,"$playbackProgressTime",{value:e.$container.querySelector(".jb-pro-playback-control-time")}),Object.defineProperty(t,"$tipsMessage",{value:e.$container.querySelector(".jb-pro-tips-message")}),Object.defineProperty(t,"$tipsMessageClose",{value:e.$container.querySelector(".jb-pro-tips-message-close")}),Object.defineProperty(t,"$tipsMessageContent",{value:e.$container.querySelector(".jb-pro-tips-message-content")})})(e,this),e._opt.extendOperateBtns.length>0&&e._opt.extendOperateBtns.forEach((e=>{this.addExtendBtn(e)})),e._opt.extendDomConfig&&e._opt.extendDomConfig.html&&this.addExtendDom(e._opt.extendDomConfig),t=this,Object.defineProperty(t,"controlsRect",{get:()=>t.$controls.getBoundingClientRect()}),Object.defineProperty(t,"controlsInnerRect",{get:()=>t.$controlsInner.getBoundingClientRect()}),Object.defineProperty(t,"controlsLeftRect",{get:()=>t.$controlsLeft.getBoundingClientRect()}),Object.defineProperty(t,"controlsRightRect",{get:()=>t.$controlsRight.getBoundingClientRect()}),Object.defineProperty(t,"controlsPlaybackTimeInner",{get:()=>t.$playbackTimeInner&&t.$playbackTimeInner.getBoundingClientRect()||{}}),Object.defineProperty(t,"controlsPlaybackBtnsRect",{get:()=>t.$controlsPlaybackBtns&&t.$controlsPlaybackBtns.getBoundingClientRect()||{width:0}}),Ph(e,this),((e,t)=>{const{events:{proxy:i},debug:s}=e,r=e._opt,a=r.operateBtns;function o(e){const{bottom:i,height:s}=t.$volumePanel.getBoundingClientRect(),{height:r}=t.$volumeHandle.getBoundingClientRect();return oa(i-e.y-r/2,0,s-r/2)/(s-r)}if(pa()&&i(window,["click","contextmenu"],(i=>{i.composedPath().indexOf(e.$container)>-1?t.isFocus=!0:t.isFocus=!1})),i(t.$controls,"click",(e=>{e.stopPropagation()})),a.play&&(i(t.$pause,"click",(t=>{r.playType===_&&r.playbackConfig.uiUsePlaybackPause?e.playbackPause=!0:Ya(a.pauseFn)?a.pauseFn():e.pauseForControl()})),i(t.$play,"click",(t=>{r.playType===_&&e.playbackPause?e.playbackPause=!1:Ya(a.playFn)?a.playFn():e.playForControl().then((()=>{e.resumeAudioAfterPause()}))}))),i(t.$playBig,"click",(t=>{r.playType===_&&e.playbackPause?e.playbackPause=!1:Ya(a.playFn)?a.playFn():e.playForControl().then((()=>{e.resumeAudioAfterPause()}))})),a.screenshot&&i(t.$screenshot,"click",(t=>{t.stopPropagation(),Ya(a.screenshotFn)?a.screenshotFn():e.video.screenshot()})),a.audio&&(pa()&&(i(t.$volume,"mouseover",(()=>{t.$volumePanelWrap.classList.add("jb-pro-volume-panel-wrap-show")})),i(t.$volume,"mouseout",(()=>{t.$volumePanelWrap.classList.remove("jb-pro-volume-panel-wrap-show")})),i(t.$volumePanel,"click",(t=>{t.stopPropagation(),e.volume=o(t)})),i(t.$volumeHandle,"mousedown",(e=>{e.stopPropagation(),t.isVolumeDroging=!0})),i(t.$volumeHandle,"mousemove",(i=>{t.isVolumeDroging&&(e.volume=o(i))})),i(document,"mouseup",(()=>{t.isVolumeDroging&&(t.isVolumeDroging=!1)}))),i(t.$volumeOn,"click",(i=>{i.stopPropagation(),na(t.$volumeOn,"display","none"),na(t.$volumeOff,"display","block");const s=e.volume;e.volume=0,e._lastVolume=pa()?s:1})),i(t.$volumeOff,"click",(i=>{i.stopPropagation(),na(t.$volumeOn,"display","block"),na(t.$volumeOff,"display","none"),e.volume=pa()?e.lastVolume||.5:1}))),a.record&&(i(t.$record,"click",(t=>{t.stopPropagation(),Ya(a.recordFn)?a.recordFn():e.recording=!0})),i(t.$recordStop,"click",(t=>{t.stopPropagation(),Ya(a.recordStopFn)?a.recordStopFn():e.recording=!1}))),i(t.$recordingStop,"click",(t=>{t.stopPropagation(),Ya(a.recordStopFn)?a.recordStopFn():e.recording=!1})),a.fullscreen&&(i(t.$fullscreen,"click",(t=>{t.stopPropagation(),Ya(a.fullscreenFn)?a.fullscreenFn():e.fullscreen=!0})),i(t.$fullscreenExit,"click",(t=>{t.stopPropagation(),Ya(a.fullscreenExitFn)?a.fullscreenExitFn():e.fullscreen=!1}))),a.ptz){if(i(t.$ptz,"click",(e=>{e.stopPropagation(),na(t.$ptzActive,"display","flex"),na(t.$ptz,"display","none"),t.$ptzControl.classList.add("jb-pro-ptz-controls-show")})),i(t.$ptzActive,"click",(e=>{e.stopPropagation(),na(t.$ptz,"display","flex"),na(t.$ptzActive,"display","none"),t.$ptzControl.classList.remove("jb-pro-ptz-controls-show")})),t.$ptzArrows.forEach((s=>{if(r.ptzClickType===K)i(s,"click",(i=>{i.stopPropagation();const s=i.currentTarget.dataset.arrow;t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-show"),t.$ptzBgActive.classList.add(`jb-pro-ptz-bg-active-${s}`),t.$ptzControlCircular.classList.add(`jb-pro-ptz-control-${s}`),e.emit(nt.ptz,fo(s)),setTimeout((()=>{t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-show"),xi.forEach((e=>{t.$ptzBgActive.classList.remove(`jb-pro-ptz-bg-active-${e}`),t.$ptzControlCircular.classList.remove(`jb-pro-ptz-control-${e}`)})),e.emit(nt.ptz,Ri)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let r=!1;i(s,"mousedown",(i=>{i.stopPropagation(),r=!0;const s=i.currentTarget.dataset.arrow;t.$ptzBgActive.classList.add("jb-pro-ptz-bg-active-show"),t.$ptzBgActive.classList.add(`jb-pro-ptz-bg-active-${s}`),t.$ptzControlCircular.classList.add(`jb-pro-ptz-control-${s}`),e.emit(nt.ptz,fo(s))}));const a=()=>{r=!1,t.$ptzBgActive.classList.remove("jb-pro-ptz-bg-active-show"),xi.forEach((e=>{t.$ptzBgActive.classList.remove(`jb-pro-ptz-bg-active-${e}`),t.$ptzControlCircular.classList.remove(`jb-pro-ptz-control-${e}`)})),e.emit(nt.ptz,Ri)};i(s,"mouseup",(e=>{e.stopPropagation(),r&&a()})),i(window,"mouseup",(e=>{e.stopPropagation(),r&&a()}))}})),r.ptzZoomShow)if(r.ptzClickType===K)i(t.$ptzExpand,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Li),setTimeout((()=>{e.emit(nt.ptz,Ri)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzNarrow,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Pi),setTimeout((()=>{e.emit(nt.ptz,Ri)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let n=!1,l=!1;i(t.$ptzExpand,"mousedown",(t=>{t.stopPropagation(),n=!0,e.emit(nt.ptz,Li)})),i(t.$ptzNarrow,"mousedown",(t=>{t.stopPropagation(),l=!0,e.emit(nt.ptz,Pi)}));const d=()=>{n=!1,l=!1,e.emit(nt.ptz,Ri)};i(t.$ptzExpand,"mouseup",(e=>{e.stopPropagation(),n&&d()})),i(t.$ptzNarrow,"mouseup",(e=>{e.stopPropagation(),l&&d()})),i(window,"mouseup",(e=>{e.stopPropagation(),(n||l)&&d()}))}if(r.ptzApertureShow)if(r.ptzClickType===K)i(t.$ptzApertureFar,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Bi),setTimeout((()=>{e.emit(nt.ptz,Di)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzApertureNear,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Ii),setTimeout((()=>{e.emit(nt.ptz,Di)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let h=!1,c=!1;i(t.$ptzApertureFar,"mousedown",(t=>{t.stopPropagation(),h=!0,e.emit(nt.ptz,Bi)})),i(t.$ptzApertureNear,"mousedown",(t=>{t.stopPropagation(),c=!0,e.emit(nt.ptz,Ii)}));const u=()=>{h=!1,c=!1,e.emit(nt.ptz,Di)};i(t.$ptzApertureFar,"mouseup",(e=>{e.stopPropagation(),h&&u()})),i(t.$ptzApertureNear,"mouseup",(e=>{e.stopPropagation(),c&&u()})),i(window,"mouseup",(e=>{e.stopPropagation(),(h||c)&&u()}))}if(r.ptzFocusShow)if(r.ptzClickType===K)i(t.$ptzFocusFar,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Mi),setTimeout((()=>{e.emit(nt.ptz,Di)}),1e3*r.ptzStopEmitDelay)})),i(t.$ptzFocusNear,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Ui),setTimeout((()=>{e.emit(nt.ptz,Di)}),1e3*r.ptzStopEmitDelay)}));else if(r.ptzClickType===Y){let p=!1,f=!1;i(t.$ptzFocusFar,"mousedown",(t=>{t.stopPropagation(),p=!0,e.emit(nt.ptz,Mi)})),i(t.$ptzFocusNear,"mousedown",(t=>{t.stopPropagation(),f=!0,e.emit(nt.ptz,Ui)}));const m=()=>{p=!1,f=!1,e.emit(nt.ptz,Di)};i(t.$ptzFocusFar,"mouseup",(e=>{e.stopPropagation(),p&&m()})),i(t.$ptzFocusNear,"mouseup",(e=>{e.stopPropagation(),f&&m()})),i(window,"mouseup",(e=>{e.stopPropagation(),(p||f)&&m()}))}if(r.ptzCruiseShow&&(i(t.$ptzCruisePlay,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Fi)})),i(t.$ptzCruisePause,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Oi)}))),r.ptzFogShow&&(i(t.$ptzFogOpen,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Ni)})),i(t.$ptzFogClose,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,ji)}))),r.ptzWiperShow&&(i(t.$ptzWiperOpen,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,zi)})),i(t.$ptzWiperClose,"click",(t=>{t.stopPropagation(),e.emit(nt.ptz,Gi)}))),r.ptzSupportDraggable){function g(){t.isPtzControlDroging&&(t.isPtzControlDroging=!1,t.$ptzControl.style.cursor="grab",t.tempPtzPosition={x:0,y:0})}t.isPtzControlDroging=!1,t.tempPtzPosition={x:0,y:0},i(t.$ptzControl,ua()?"touchstart":"mousedown",(e=>{e.stopPropagation(),t.isPtzControlDroging=!0,t.$ptzControl.style.cursor="grabbing";const{posX:i,posY:s}=Qa(e);t.tempPtzPosition={x:i,y:s}})),i(t.$ptzControl,ua()?"touchmove":"mousemove",(e=>{if(t.isPtzControlDroging){e.stopPropagation();const{posX:i,posY:s}=Qa(e),r=t.tempPtzPosition.x-i,a=t.tempPtzPosition.y-s;t.$ptzControl.style.left=t.$ptzControl.offsetLeft-r+"px",t.$ptzControl.style.top=t.$ptzControl.offsetTop-a+"px",t.tempPtzPosition={x:i,y:s}}})),i(t.$ptzControl,ua()?"touchend":"mouseup",(e=>{e.stopPropagation(),g()})),i(window,ua()?"touchend":"mouseup",(e=>{e.stopPropagation(),g()}))}}if(a.performance&&(i(t.$performance,"click",(t=>{t.stopPropagation(),e.togglePerformancePanel(!0)})),i(t.$performanceActive,"click",(t=>{t.stopPropagation(),e.togglePerformancePanel(!1)}))),a.logSave&&i(t.$logSave,"click",(t=>{t.stopPropagation(),e.downloadMemoryLog()})),a.aiFace&&(i(t.$faceDetect,"click",(t=>{t.stopPropagation(),e.faceDetect(!0)})),i(t.$faceDetectActive,"click",(t=>{t.stopPropagation(),e.faceDetect(!1)}))),a.aiObject&&(i(t.$objectDetect,"click",(t=>{t.stopPropagation(),e.objectDetect(!0)})),i(t.$objectDetectActive,"click",(t=>{t.stopPropagation(),e.objectDetect(!1)}))),a.aiOcclusion&&(i(t.$occlusionDetect,"click",(t=>{t.stopPropagation(),e.occlusionDetect(!0)})),i(t.$occlusionDetectActive,"click",(t=>{t.stopPropagation(),e.occlusionDetect(!1)}))),e._opt.hasControl&&e._opt.controlAutoHide){i(e.$container,"mouseover",(()=>{e.fullscreen||(na(t.$controls,"display","block"),A())})),i(e.$container,"mousemove",(()=>{e.$container&&t.$controls&&(e.fullscreen,"none"===t.$controls.style.display&&(na(t.$controls,"display","block"),A()))})),i(e.$container,"mouseout",(()=>{b(),na(t.$controls,"display","none")}));let y=null;const A=()=>{b(),y=setTimeout((()=>{na(t.$controls,"display","none")}),5e3)},b=()=>{y&&(clearTimeout(y),y=null)}}if(e._opt.playType===_){let v=e._opt.playbackConfig.controlType;e._opt.playbackConfig.showRateBtn&&(i(t.$speedMenu,"mouseover",(()=>{t.$speedMenuList.classList.add("jb-pro-speed-menu-shown")})),i(t.$speedMenu,"mouseout",(()=>{t.$speedMenuList.classList.remove("jb-pro-speed-menu-shown")})),i(t.$speedMenuList,"click",(t=>{const i=qa(t);if(i.matches("div.jb-pro-speed-menu-item")){const t=i.dataset;e.emit(nt.playbackPreRateChange,t.speed)}}))),v===Q.normal?(i(t.$playbackNarrow,"click",(t=>{t.stopPropagation(),e.playback&&e.playback.narrowPrecision()})),i(t.$playbackExpand,"click",(t=>{t.stopPropagation(),e.playback&&e.playback.expandPrecision()})),i(t.$playbackTimeList,"click",(t=>{const i=qa(t);i.matches("div.jb-pro-playback-time-minute-one")&&e.playback&&e.playback.seek(i.dataset)})),e._opt.playbackConfig.supportWheel&&i(t.$playbackTimeInner,"wheel",(t=>{t.preventDefault(),(t.wheelDelta?t.wheelDelta/120:-(t.detail||0)/3)>0?e.playback&&e.playback.expandPrecision():e.playback&&e.playback.narrowPrecision()}))):v===Q.simple&&(t.isDroging=!1,i(t.$playbackProgress,"click",(i=>{if(i.target!==t.$playbackProgressIndicator){let s=0,r=0;if(e.isInWebFullscreen())s=i.touches[0].clientY/e.height,r=s*e.playback.totalDuration;else{const a=kh(t,e.playback.totalDuration,i);s=a.percentage,r=a.second}e.playback&&e.playback.seek({time:r})}})),i(t.$playbackProgress,"mousemove",(i=>{na(t.$playbackProgressTip,"display","block");const{width:s,time:r}=kh(t,e.playback.totalDuration,i);t.$playbackProgressTip.innerHTML=r;const a=t.$playbackProgressTip.clientWidth;s<=a/2?na(t.$playbackProgressTip,"left",0):s>t.$playbackProgress.clientWidth-a/2?na(t.$playbackProgressTip,"left",t.$playbackProgress-a+"px"):na(t.$playbackProgressTip,"left",s-a/2+"px")})),i(t.$playbackProgress,"mouseout",(()=>{na(t.$playbackProgressTip,"display","none")})),i(t.$playbackProgressIndicator,"mousedown",(e=>{t.isDroging=!0})),i(t.$playbackProgress,"mousemove",(i=>{if(t.isDroging){const{second:s,percentage:r}=kh(t,e.playback.totalDuration,i);e.playback&&e.playback.seek({time:s})}})),i(t.$playbackProgress,"mouseup",(e=>{t.isDroging&&(t.isDroging=!1)})))}a.quality&&(i(t.$qualityMenu,"mouseover",(()=>{t.$qualityMenuList.classList.add("jb-pro-quality-menu-shown")})),i(t.$qualityMenu,"mouseout",(()=>{t.$qualityMenuList.classList.remove("jb-pro-quality-menu-shown")})),i(t.$qualityMenuList,"click",(t=>{const i=qa(t);if(i.matches("div.jb-pro-quality-menu-item")){const t=i.dataset;e.streamQuality=t.quality}}))),a.scale&&(i(t.$scaleMenu,"mouseover",(()=>{t.$scaleMenuList.classList.add("jb-pro-scale-menu-shown")})),i(t.$scaleMenu,"mouseout",(()=>{t.$scaleMenuList.classList.remove("jb-pro-scale-menu-shown")})),i(t.$scaleMenuList,"click",(t=>{const i=qa(t);if(i.matches("div.jb-pro-scale-menu-item")){const t=i.dataset;e.setScaleMode(t.scale)}}))),a.zoom&&(i(t.$zoom,"click",(t=>{t.stopPropagation(),e.zooming=!0})),i(t.$zoomStop,"click",(t=>{t.stopPropagation(),e.zooming=!1}))),i(t.$zoomExpand,"click",(t=>{t.stopPropagation(),e.zoom&&e.zoom.expandPrecision()})),i(t.$zoomNarrow,"click",(t=>{t.stopPropagation(),e.zoom&&e.zoom.narrowPrecision()})),i(t.$zoomStop2,"click",(t=>{t.stopPropagation(),e.zooming=!1})),a.close&&i(t.$close,"click",(t=>{t.stopPropagation(),e.doDestroy()})),i(t.$tipsMessageClose,"click",(e=>{e.stopPropagation(),t.$tipsMessageContent.innerHTML="",na(t.$tipsMessage,"display","none")}))})(e,this),e._opt.hotKey&&((e,t)=>{const{events:{proxy:i}}=e,s={};function r(e,t){s[e]?s[e].push(t):s[e]=[t]}r(bi,(()=>{e.fullscreen&&(e.fullscreen=!1)})),r(vi,(()=>{e.volume+=.05})),r(_i,(()=>{e.volume-=.05})),i(window,"keydown",(e=>{if(t.isFocus){const t=document.activeElement.tagName.toUpperCase(),i=document.activeElement.getAttribute("contenteditable");if("INPUT"!==t&&"TEXTAREA"!==t&&""!==i&&"true"!==i){const t=s[e.keyCode];t&&(e.preventDefault(),t.forEach((e=>e())))}}}))})(e,this),this.btnIndex=0,this.initLoadingBackground(),Va(e._opt.loadingIconStyle)&&this.initLoadingIconStyle(e._opt.loadingIconStyle),Va(e._opt.ptzPositionConfig)&&this.updatePtzPosition(e._opt.ptzPositionConfig),this.kbpsShow="0 KB/s",this.player.debug.log("Control","init")}destroy(){if(this.$performancePanel){this.$performancePanel.innerHTML="";if(!Lh(this.$performancePanel)){const e=this.player.$container.querySelector(".jb-pro-performance-panel");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$poster){if(!Lh(this.$poster)){const e=this.player.$container.querySelector(".jb-pro-poster");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$loading){if(!Lh(this.$loading)){const e=this.player.$container.querySelector(".jb-pro-loading");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$loadingBg){if(!Lh(this.$loadingBg)){const e=this.player.$container.querySelector(".jb-pro-loading-bg");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$controls){if(!Lh(this.$controls)){const e=this.player.$container.querySelector(".jb-pro-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$playBig){if(!Lh(this.$playBig)){const e=this.player.$container.querySelector(".jb-pro-play-big");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$recording){if(!Lh(this.$recording)){const e=this.player.$container.querySelector(".jb-pro-recording");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$ptzControl){if(!Lh(this.$ptzControl)){const e=this.player.$container.querySelector(".jb-pro-ptz-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$zoomControls){if(!Lh(this.$zoomControls)){const e=this.player.$container.querySelector(".jb-pro-zoom-controls");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$contextmenus){this.$contextmenus.innerHTML="";if(!Lh(this.$contextmenus)){const e=this.player.$container.querySelector(".jb-pro-contextmenus");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$tipsMessage){if(!Lh(this.$tipsMessage)){const e=this.player.$container.querySelector(".jb-pro-tips-message");e&&this.player.$container&&this.player.$container.removeChild(e)}}if(this.$extendDom){if(!Lh(this.$extendDom)){const e=this.player.$container.querySelector(".jb-pro-extend-dom");e&&this.player.$container&&this.player.$container.removeChild(e)}}this.btnIndex=0,this.extendBtnList=[],this.kbpsShow="0 KB/s",this.player.$container&&(this.player.$container.classList.remove("jb-pro-controls-show-auto-hide"),this.player.$container.classList.remove("jb-pro-controls-show")),this.player.debug.log("Control","destroy")}getBtnIndex(){return this.btnIndex++}autoSize(){const e=this.player;e.$container.style.padding="0 0";const t=e.width,i=e.height,s=t/i,r=e.video.$videoElement.width/e.video.$videoElement.height;if(s>r){const s=(t-i*r)/2;e.$container.style.padding=`0 ${s}px`}else{const s=(i-t/r)/2;e.$container.style.padding=`${s}px 0`}}initLoadingBackground(){const e=this.player;e._opt.loadingBackground&&e._opt.loadingBackgroundWidth&&e._opt.loadingBackgroundHeight&&(e.debug.log("Control","initLoadingBackground()"),"default"===this.player._opt.aspectRatio||ua()?(e.getRenderType()===$||e.getRenderType()===W)&&this._initLoadingBackground():this._initLoadingBackgroundForRatio(),Rh(this.$loadingBg,"display","block"),e._opt.loadingBackground="",e._opt.loadingBackgroundWidth=0,e._opt.loadingBackgroundHeight=0)}initLoadingIconStyle(e){const t=this.player.$container.querySelector(".jb-pro-icon-loading");t&&(e.width&&Rh(t,"width",`${e.width}px`),e.height&&Rh(t,"height",`${e.height}px`),e.background&&Rh(t,"backgroundImage",`url("${e.background}")`),!1===e.hasAnimation&&(Rh(t,"animationName","none"),Rh(t,"animationDuration",0),Rh(t,"animationTimingFunction","ease"),Rh(t,"animationIterationCount",1)))}_initLoadingBackgroundForRatio(){const e=this.player._opt.aspectRatio.split(":").map(Number);let t=this.player.width,i=this.player.height;const s=this.player._opt;let r=0;s.hasControl&&!s.controlAutoHide&&(r=s.playType===_?Yt:Kt,i-=r);const a=this.player._opt.loadingBackgroundWidth,o=this.player._opt.loadingBackgroundHeight,n=a/o,l=e[0]/e[1];if(this.$loadingBgImage.src=this.player._opt.loadingBackground,n>l){const e=l*o/a;this.$loadingBgImage.style.width=100*e+"%",this.$loadingBgImage.style.height=`calc(100% - ${r}px)`,this.$loadingBgImage.style.padding=`0 ${(t-t*e)/2}px`}else{const e=a/l/o;this.$loadingBgImage.style.width="100%",this.$loadingBgImage.style.height=`calc(${100*e}% - ${r}px)`,this.$loadingBgImage.style.padding=(i-i*e)/2+"px 0"}}_initLoadingBackground(){const e=this.player;let t=e.height;const i=e._opt;if(i.hasControl&&!i.controlAutoHide){t-=i.playType===_?Yt:Kt}let s=e.width,r=t;const a=i.rotate;270!==a&&90!==a||(s=t,r=e.width),this.$loadingBgImage.width=s,this.$loadingBgImage.height=r,this.$loadingBgImage.src=e._opt.loadingBackground;let o=(e.width-s)/2,n=(t-r)/2,l="contain";i.isResize||(l="fill"),i.isFullResize&&(l="none");let d="";"none"===i.mirrorRotate&&a&&(d+=" rotate("+a+"deg)"),"level"===i.mirrorRotate?d+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(d+=" rotateX(180deg)"),this.player._opt.videoRenderSupportScale&&(this.$loadingBgImage.style.objectFit=l),this.$loadingBgImage.style.transform=d,this.$loadingBgImage.style.padding="0",this.$loadingBgImage.style.left=o+"px",this.$loadingBgImage.style.top=n+"px"}_validateExtendBtn(e){let t=!0;if(e.name||(this.player.debug.warn("Control","extend button name is required"),t=!1),t){-1!==this.extendBtnList.findIndex((t=>t.name===e.name))&&(this.player.debug.warn("Control",`extend button name: ${e.name} is already exist`),t=!1)}return t&&(e.icon||(this.player.debug.warn("Control","extend button icon is required"),t=!1)),t}addExtendBtn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=no(Os);if(e=Object.assign({},t,e),!this._validateExtendBtn(e))return;const i=e.name||"",s=this.$controlsRight,r=e.activeIcon&&e.activeClick,a=`\n
\n ${e.icon?`
\n \n ${e.iconTitle?`\n ${e.iconTitle}\n `:""}\n
`:""}\n ${e.activeIcon?`
\n \n ${e.activeIconTitle?`\n ${e.activeIconTitle}\n `:""}\n
`:""}\n
\n `,o=Array.from(s.children)[e.index];o?o.insertAdjacentHTML("beforebegin",a):xh(s,a);const n=s.querySelector(`.jb-pro-controls-item-wrap-${i}`),l=e.icon?s.querySelector(`.jb-pro-icon-extend-${i}`):null,d=e.icon?s.querySelector(`.jb-pro-control-extend-${i}`):null,h=e.activeIcon?s.querySelector(`.jb-pro-icon-extend-${i}-active`):null,c=e.activeIcon?s.querySelector(`.jb-pro-control-extend-${i}-active`):null,{events:{proxy:u},debug:p}=this.player;e.icon&&(Rh(l,"background",`url(${e.icon}) no-repeat center`),Rh(l,"background-size","100% 100%"),Rh(d,"display","none"),e.iconHover&&(u(l,"mouseover",(()=>{Rh(l,"background",`url(${e.iconHover}) no-repeat center`),Rh(l,"background-size","100% 100%")})),u(l,"mouseout",(()=>{Rh(l,"background",`url(${e.icon}) no-repeat center`),Rh(l,"background-size","100% 100%")})))),e.activeIcon&&(Rh(h,"background",`url(${e.activeIcon}) no-repeat center`),Rh(h,"background-size","100% 100%"),Rh(c,"display","none"),e.activeIconHover&&(u(h,"mouseover",(()=>{Rh(h,"background",`url(${e.activeIconHover}) no-repeat center`),Rh(h,"background-size","100% 100%")})),u(h,"mouseout",(()=>{Rh(h,"background",`url(${e.activeIcon}) no-repeat center`),Rh(h,"background-size","100% 100%")})))),e.click&&l&&u(l,"click",(t=>{t.preventDefault(),r&&(Rh(d,"display","none"),Rh(c,"display","flex")),this.player.isInMulti()?e.click.call(this.player,t,this.player._opt.multiIndex):e.click.call(this.player,t)})),e.activeClick&&h&&u(h,"click",(t=>{t.preventDefault(),Rh(d,"display","flex"),Rh(c,"display","none"),this.player.isInMulti()?e.activeClick.call(this.player,t,this.player._opt.multiIndex):e.activeClick.call(this.player,t)})),this.extendBtnList.push({name:i,$iconContainer:n,$iconWrap:d,$activeIconWrap:c})}addExtendDom(e){if(this.player.debug.log(this.TAG_NAME,"addExtendDom"),e.html){const t=`\n
\n ${e.html}\n
\n `;this.player.$container.insertAdjacentHTML("beforeend",t),Object.defineProperty(this,"$extendDom",{value:this.player.$container.querySelector(".jb-pro-extend-dom")}),e.showBeforePlay&&Rh(this.$extendDom,"display","block")}}toggleExtendDom(e){this.$extendDom&&(Pa(e)||(e="none"===this.$extendDom.style.display),Rh(this.$extendDom,"display",e?"block":"none"))}updateExtendDom(e){this.player.debug.log(this.TAG_NAME,"updateExtendDom"),this.$extendDom&&(this.$extendDom.innerHTML=e)}removeExtendDom(){this.player.debug.log(this.TAG_NAME,"removeExtendDom"),this.$extendDom&&(this.$extendDom.innerHTML="")}updateLoadingText(e){this.$loadingText&&(this.$loadingText.innerText=e)}getExtendBtnList(){return this.extendBtnList}showTipsMessage(e,t){const i=this.$tipsMessage,s=this.$tipsMessageContent;if(i){const r=`\n
${e}
\n ${t?`
Error Type:${t}
`:""}\n `;s.innerHTML=r,Rh(i,"display","block")}}hideTipsMessage(){const e=this.$tipsMessage;e&&($tipsMessageContent.innerHTML="",Rh(e,"display","none"))}updatePtzPosition(e){const t=this.$ptzControl;if(Va(e)&&t){let i="auto";e.left&&(i=Number(e.left)===e.left?e.left+"px":e.left),Rh(t,"left",i);let s="auto";e.top&&(s=Number(e.top)===e.top?e.top+"px":e.top),Rh(t,"top",s);let r="auto";e.bottom&&(r=Number(e.bottom)===e.bottom?e.bottom+"px":e.bottom),Rh(t,"bottom",r);let a="auto";e.right&&(a=Number(e.right)===e.right?e.right+"px":e.right),Rh(t,"right",a)}}}Bh(".jb-pro-container{position:relative;width:100%;height:100%;overflow:hidden}.jb-pro-container.jb-pro-fullscreen-web{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;width:100vw!important;height:100vh!important;background:#000}.jb-pro-container .jb-pro-loading-bg-for-ios{position:absolute;z-index:100;left:0;top:0;right:0;bottom:0;height:100%;width:100%;opacity:0;visibility:hidden;background-position:50%;background-repeat:no-repeat;background-size:contain;pointer-events:none}.jb-pro-container .jb-pro-loading-bg-for-ios.show{opacity:1;visibility:visible}");var Mh=e=>{const{_opt:t,debug:i,events:{proxy:s}}=e;if(t.supportDblclickFullscreen&&s(e.$container,"dblclick",(t=>{const i=qa(t).nodeName.toLowerCase();"canvas"!==i&&"video"!==i||(e.fullscreen=!e.fullscreen)})),s(document,"visibilitychange",(()=>{e.visibility="visible"===document.visibilityState,i.log("visibilitychange",document.visibilityState),t.hiddenAutoPause&&(i.log("visibilitychange","hiddenAutoPause is true ",document.visibilityState,e._isPlayingBeforePageHidden),"visible"===document.visibilityState?e._isPlayingBeforePageHidden&&e.play():(e._isPlayingBeforePageHidden=e.playing,e.playing&&e.pause()))})),pa()&&s(document,["click","contextmenu"],(t=>{Dh(t,e.$container)?(uo(e._opt.disableContextmenu)&&"contextmenu"===t.type&&t.preventDefault(),e.isInput="INPUT"===t.target.tagName,e.isFocus=!0,e.emit(nt.focus)):(e.isInput=!1,e.isFocus=!1,e.emit(nt.blur))})),t.isCheckInView){const t=wa((()=>{e.emit(nt.inView,function(e){const t=e.getBoundingClientRect(),i=window.innerHeight||document.documentElement.clientHeight,s=window.innerWidth||document.documentElement.clientWidth,r=t.top<=i&&t.top+t.height>=0,a=t.left<=s&&t.left+t.width>=0;return r&&a}(e.$container))}),200);s(window,"scroll",(()=>t()))}if(t.autoResize){const t=wa((()=>{e.resize()}),500);s(window,["resize","orientationchange"],(()=>{t()})),screen&&screen.orientation&&screen.orientation.onchange&&s(screen.orientation,"change",(()=>{t()}))}};class Uh{static init(){Uh.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in Uh.types)Uh.types.hasOwnProperty(e)&&(Uh.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=Uh.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=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]),e.HDLR_AUDIO=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]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,s=Array.prototype.slice.call(arguments,1),r=s.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let a=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,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]))}static trak(e){return Uh.box(Uh.types.trak,Uh.tkhd(e),Uh.mdia(e))}static tkhd(e){let t=e.id,i=e.duration,s=e.presentWidth,r=e.presentHeight;return Uh.box(Uh.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>>8&255,255&s,0,0,r>>>8&255,255&r,0,0]))}static mdia(e){return Uh.box(Uh.types.mdia,Uh.mdhd(e),Uh.hdlr(e),Uh.minf(e))}static mdhd(e){let t=e.timescale,i=e.duration;return Uh.box(Uh.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,i>>>24&255,i>>>16&255,i>>>8&255,255&i,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?Uh.constants.HDLR_AUDIO:Uh.constants.HDLR_VIDEO,Uh.box(Uh.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?Uh.box(Uh.types.smhd,Uh.constants.SMHD):Uh.box(Uh.types.vmhd,Uh.constants.VMHD),Uh.box(Uh.types.minf,t,Uh.dinf(),Uh.stbl(e))}static dinf(){return Uh.box(Uh.types.dinf,Uh.box(Uh.types.dref,Uh.constants.DREF))}static stbl(e){return Uh.box(Uh.types.stbl,Uh.stsd(e),Uh.box(Uh.types.stts,Uh.constants.STTS),Uh.box(Uh.types.stsc,Uh.constants.STSC),Uh.box(Uh.types.stsz,Uh.constants.STSZ),Uh.box(Uh.types.stco,Uh.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?Uh.box(Uh.types.stsd,Uh.constants.STSD_PREFIX,Uh.mp3(e)):Uh.box(Uh.types.stsd,Uh.constants.STSD_PREFIX,Uh.mp4a(e)):"avc"===e.videoType?Uh.box(Uh.types.stsd,Uh.constants.STSD_PREFIX,Uh.avc1(e)):Uh.box(Uh.types.stsd,Uh.constants.STSD_PREFIX,Uh.hvc1(e))}static mp3(e){let t=e.channelCount,i=e.audioSampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return Uh.box(Uh.types[".mp3"],s)}static mp4a(e){let t=e.channelCount,i=e.audioSampleRate,s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return Uh.box(Uh.types.mp4a,s,Uh.esds(e))}static esds(e){let t=e.config||[],i=t.length,s=new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([i]).concat(t).concat([6,1,2]));return Uh.box(Uh.types.esds,s)}static avc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=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,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return Uh.box(Uh.types.avc1,r,Uh.box(Uh.types.avcC,t))}static hvc1(e){let t=e.avcc;const i=e.codecWidth,s=e.codecHeight;let r=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,i>>>8&255,255&i,s>>>8&255,255&s,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return Uh.box(Uh.types.hvc1,r,Uh.box(Uh.types.hvcC,t))}static mvex(e){return Uh.box(Uh.types.mvex,Uh.trex(e))}static trex(e){let t=e.id,i=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return Uh.box(Uh.types.trex,i)}static moof(e,t){return Uh.box(Uh.types.moof,Uh.mfhd(e.sequenceNumber),Uh.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return Uh.box(Uh.types.mfhd,t)}static traf(e,t){let i=e.id,s=Uh.box(Uh.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),r=Uh.box(Uh.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),a=Uh.sdtp(e),o=Uh.trun(e,a.byteLength+16+16+8+16+8+8);return Uh.box(Uh.types.traf,s,r,o,a)}static sdtp(e){let t=new Uint8Array(5),i=e.flags;return t[4]=i.isLeading<<6|i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy,Uh.box(Uh.types.sdtp,t)}static trun(e,t){let i=new Uint8Array(28);t+=36,i.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let s=e.duration,r=e.size,a=e.flags,o=e.cts;return i.set([s>>>24&255,s>>>16&255,s>>>8&255,255&s,r>>>24&255,r>>>16&255,r>>>8&255,255&r,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.isNonSync,0,0,o>>>24&255,o>>>16&255,o>>>8&255,255&o],12),Uh.box(Uh.types.trun,i)}static mdat(e){return Uh.box(Uh.types.mdat,e)}}Uh.init();const Fh=[44100,48e3,32e3,0],Oh=[22050,24e3,16e3,0],Nh=[11025,12e3,8e3,0],jh=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],zh=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],Gh=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];class Hh extends So{constructor(e){super(),this.TAG_NAME="MediaSource",this.player=e,this._resetInIt(),this._useManagedMediaSource="ManagedMediaSource"in self&&!("MediaSource"in self),this.mediaSource=this._useManagedMediaSource?new self.ManagedMediaSource:new self.MediaSource,this.isDecodeFirstIIframe=!!po(e._opt.checkFirstIFrame),this.mediaSourceObjectURL=null,this._useManagedMediaSource||(this.mediaSourceObjectURL=window.URL.createObjectURL(this.mediaSource)),this.isSupportVideoFrameCallback=bo(),this.canvasRenderInterval=null,e._opt.mseUseCanvasRender?(this.$videoElement=document.createElement("video"),this._useManagedMediaSource?(this.$videoElement.disableRemotePlayback=!0,this.$videoElement.srcObject=this.mediaSource):this.$videoElement.src=this.mediaSourceObjectURL,this.initVideoEvents()):(this._useManagedMediaSource?(this.player.video.$videoElement.disableRemotePlayback=!0,this.player.video.$videoElement.srcObject=this.mediaSource):this.player.video.$videoElement.src=this.mediaSourceObjectURL,this.$videoElement=this.player.video.$videoElement),this._bindMediaSourceEvents(),this.audioSourceBufferCheckTimeout=null,this.audioSourceNoDataCheckTimeout=null,this.hasPendingEos=!1,this.player.isPlayback()&&this.player.on(nt.playbackPause,(t=>{po(t)?(uo(e._opt.checkFirstIFrame)&&(this.player.debug.log(this.TAG_NAME,"playbackPause is false and _opt.checkFirstIFrame is true so set isDecodeFirstIIframe = false"),this.isDecodeFirstIIframe=!1),this.clearUpAllSourceBuffer(),this.$videoElement.play()):(this.$videoElement.pause(),this.cacheTrack={})})),this._useManagedMediaSource?this.player.debug.log(this.TAG_NAME,"init and using ManagedMediaSource"):this.player.debug.log(this.TAG_NAME,"init")}destroy(){this.stop(),this._clearAudioSourceBufferCheckTimeout(),this._clearAudioNoDataCheckTimeout(),this._stopCanvasRender(),this.eventListenList.length&&(this.eventListenList.forEach((e=>e())),this.eventListenList=[]),this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.$videoElement&&(this.player._opt.mseUseCanvasRender&&this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$videoElement=null),this.mediaSourceObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceObjectURL),this.mediaSourceObjectURL=null),this._resetInIt(),this.mediaSource=null,this.off(),this.player.debug.log(this.TAG_NAME,"destroy")}needInitAudio(){return this.player._opt.hasAudio&&this.player._opt.mseDecodeAudio}_resetInIt(){this.isAvc=null,this.isAAC=null,this.videoMeta={},this.audioMeta={},this.sourceBuffer=null,this.audioSourceBuffer=null,this.hasInit=!1,this.hasAudioInit=!1,this.isInitInfo=!1,this.isAudioInitInfo=!1,this.audioMimeType="",this.videoMimeType="",this.cacheTrack={},this.cacheAudioTrack={},this.sequenceNumber=0,this.audioSequenceNumber=0,this.firstRenderTime=null,this.firstAudioTime=null,this.$videoElement=null,this.mediaSourceAppendBufferFull=!1,this.mediaSourceAppendBufferError=!1,this.mediaSourceAddSourceBufferError=!1,this.mediaSourceBufferError=!1,this.mediaSourceError=!1,this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.prevAudioDts=null,this.prevPayloadBufferSize=0,this.isWidthOrHeightChanged=!1,this.prevTs=null,this.prevAudioTs=null,this.eventListenList=[],this.pendingRemoveRanges=[],this.pendingSegments=[],this.pendingAudioRemoveRanges=[],this.pendingAudioSegments=[],this.supportVideoFrameCallbackHandle=null}get state(){return this.mediaSource&&this.mediaSource.readyState}get isStateOpen(){return this.state===yi}get isStateClosed(){return this.state===Ai}get isStateEnded(){return this.state===gi}get duration(){return this.mediaSource&&this.mediaSource.duration||-1}set duration(e){this.mediaSource.duration=e}_bindMediaSourceEvents(){const{debug:e,events:{proxy:t}}=this.player,i=t(this.mediaSource,Ki,(()=>{this.player.debug.log(this.TAG_NAME,"sourceOpen"),this._onMediaSourceSourceOpen(),this.player.emit(nt.mseSourceOpen)})),s=t(this.mediaSource,qi,(()=>{this.player.debug.log(this.TAG_NAME,"sourceClose"),this.player.emit(nt.mseSourceClose)})),r=t(this.mediaSource,Yi,(()=>{this.player.debug.log(this.TAG_NAME,"sourceended"),this.player.emit(nt.mseSourceended)}));this.eventListenList.push(i,s,r);const a=t(this.$videoElement,is,(e=>{if(po(this.isSupportVideoFrameCallback))if(this.player.checkIsInRender())this.player.handleRender();else{const t=parseInt(e.timeStamp,10);this.player.debug.log(this.TAG_NAME,`mseUseCanvasRender is ${this.player._opt.mseUseCanvasRender} and\n $videoElement ts is ${t}, but not in render and vbps is ${this.player._stats.vbps} and fps is ${this.player._stats.fps}`)}}));if(this.eventListenList.push(a),this._useManagedMediaSource){const e=t(this.mediaSource,Qi,(()=>{this.player.debug.log(this.TAG_NAME,"ManagedMediaSource startstreaming"),this.player.emit(nt.mseSourceStartStreaming)})),i=t(this.mediaSource,Xi,(()=>{this.player.debug.log(this.TAG_NAME,"ManagedMediaSource endstreaming"),this.player.emit(nt.mseSourceEndStreaming)})),s=t(this.mediaSource,Zi,(()=>{this.player.debug.log(this.TAG_NAME,"ManagedMediaSource qualitychange")}));this.eventListenList.push(e,i,s)}}_onMediaSourceSourceOpen(){this.sourceBuffer||(this.player.debug.log("MediaSource","onMediaSourceSourceOpen() sourceBuffer is null and next init"),this._initSourceBuffer()),this.audioSourceBuffer||(this.player.debug.log("MediaSource","onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),this._initAudioSourceBuffer()),this._hasPendingSegments()&&this._doAppendSegments()}initVideoEvents(){const{proxy:e}=this.player.events;this.player.on(nt.visibilityChange,(e=>{e&&setTimeout((()=>{if(this.player.isPlaying()&&this.$videoElement){const e=this.getVideoBufferLastTime();e-this.$videoElement.currentTime>this.getMseBufferMaxDelayTime()&&(this.player.debug.log(this.TAG_NAME,`visibilityChange is true and lastTime is ${e} and currentTime is ${this.$videoElement.currentTime} so set currentTime to lastTime`),this.$videoElement.currentTime=e)}}),300)}));const t=e(this.$videoElement,es,(()=>{this.player.debug.log(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.emit(nt.removeLoadingBgImage),bo()?this.supportVideoFrameCallbackHandle||(this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))):this.player.isUseHls265()&&(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:parseInt(1e3*this.$videoElement.currentTime,10)||0})}),40)),this.player.debug.log(this.TAG_NAME,"video play")})).catch((e=>{this.player.debug.error(this.TAG_NAME,"video play error ",e),this.player.emitError(ct.mediaSourceUseCanvasRenderPlayFailed,e)}))})),i=e(this.$videoElement,ts,(()=>{this.player.debug.log(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,is,(e=>{parseInt(e.timeStamp,10),this.$videoElement.paused&&(this.player.debug.warn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debug.log(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debug.warn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,ss,(()=>{this.player.debug.log(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate),this.$videoElement&&this.$videoElement.paused&&this.player.debug.warn(this.TAG_NAME,"ratechange and video is paused")}));this.eventListenList.push(t,i,s,r)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debug.log(this.TAG_NAME,"videoFrameCallback() player is destroyed");const i=parseInt(1e3*Math.max(t.mediaTime,this.$videoElement.currentTime),10)||0;this.player.handleRender(),this.player.video.render({$video:this.$videoElement,ts:i}),this.player.isUseHls265()&&this.player.updateStats({fps:!0,ts:i}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}decodeVideo(e,t,i,s){const r=this.player;if(r)if(this.player.isDestroyedOrClosed())this.player.debug.warn(this.TAG_NAME,"decodeVideo() player is destroyed");else if(this.hasInit)if(!this.isDecodeFirstIIframe&&i&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){if(i&&0===e[1]){const t=15&e[0];let i={};if(t===vt){i=En(e.slice(5))}else t===_t&&(i=Un(e));const s=this.player.video.videoInfo;s&&s.width&&s.height&&i&&i.codecWidth&&i.codecHeight&&(i.codecWidth!==s.width||i.codecHeight!==s.height)&&(this.player.debug.warn(this.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${s.width}, old height is ${s.height},\n new width is ${i.codecWidth}, new height is ${i.codecHeight},\n and emit change event`),this.isWidthOrHeightChanged=!0,this.player.emitError(ct.mseWidthOrHeightChange))}if(this.isWidthOrHeightChanged)return void this.player.debug.warn(this.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(co(e))return void this.player.debug.warn(this.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength<12)return void this.player.debug.warn(this.TAG_NAME,`decodeVideo and payload is too small , payload length is ${e.byteLength}`);let r=t;if(this.player.isPlayer()){if(null===this.firstRenderTime&&(this.firstRenderTime=t),r=t-this.firstRenderTime,r<0&&(this.player.debug.warn(this.TAG_NAME,`decodeVideo\n local dts is < 0 , ts is ${t} and prevTs is ${this.prevTs},\n firstRenderTime is ${this.firstRenderTime} and mseCorrectTimeDuration is ${this.player._opt.mseCorrectTimeDuration}`),r=null===this.prevDts?0:this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t)))return this.player.debug.warn(this.TAG_NAME,`decodeVideo is max diff , ts is ${t} and prevTs is ${this.prevTs}, diff is ${this.prevTs-t} and emit replay`),void this.player.emitError(ct.mediaSourceTsIsMaxDiff,`decodeVideo is max diff, prevTs is ${this.prevTs} and ts is ${t}`);if(null!==this.prevDts&&r<=this.prevDts){if(this.player.debug.warn(this.TAG_NAME,`\n decodeVideo dts is less than(or equal) prev dts ,\n dts is ${r} and prev dts is ${this.prevDts} ,\n and now ts is ${t} and prev ts is ${this.prevTs} ,\n and diff is ${t-this.prevTs} and firstRenderTime is ${this.firstRenderTime} and isIframe is ${i},\n and mseCorrectTimeDuration is ${this.player._opt.mseCorrectTimeDuration},\n and prevPayloadBufferSize is ${this.prevPayloadBufferSize} and payload size is ${e.byteLength}`),r===this.prevDts&&this.prevPayloadBufferSize===e.byteLength)return void this.player.debug.warn(this.TAG_NAME,"decodeVideo dts is equal to prev dts and payload size is equal to prev payload size so drop this frame");if(r=this.prevDts+this.player._opt.mseCorrectTimeDuration,this._checkTsIsMaxDiff(t))return this.player.debug.warn(this.TAG_NAME,`decodeVideo is max diff , ts is ${t} and prevTs is ${this.prevTs}, diff is ${this.prevTs-t} and emit replay`),void this.emit(ct.mediaSourceTsIsMaxDiff,`decodeVideo is max diff, prevTs is ${this.prevTs} and ts is ${t}`)}}this.player.isPlayer()?this._decodeVideo(e,r,i,s,t):this.player.isPlayback()&&po(this.player.playbackPause)&&(this.player.playback.isUseLocalCalculateTime&&this.player.playback.increaseLocalTimestamp(),this._decodeVideo(e,r,i,s,t)),this.prevDts=r,this.prevPayloadBufferSize=e.byteLength,this.prevTs=t}else this.player.debug.log(this.TAG_NAME,"decodeVideo first frame is not iFrame");else if(i&&e[1]===vs){const s=15&e[0];if(r.video.updateVideoInfo({encTypeCode:s}),s===_t&&po(ka()))return void this.player.emitError(ct.mediaSourceH265NotSupport);r._times.decodeStart||(r._times.decodeStart=aa()),this.hasInit=this._decodeConfigurationRecord(e,t,i,s)}else this.player.debug.warn(this.TAG_NAME,`decodeVideo has not init , isIframe is ${i} , payload is ${e[1]}`)}decodeAudio(e,t){if(this.player)if(this.player.isDestroyedOrClosed())this.player.debug.warn(this.TAG_NAME,"decodeAudio() player is destroyed");else if(po(this.hasAudioInit))this.hasAudioInit=this._decodeAudioConfigurationRecord(e,t);else{let i=t;if(zr(e))return void this.player.debug.log(this.TAG_NAME,"decodeAudio and has already initialized and payload is aac codec packet so drop this frame");if(this._clearAudioNoDataCheckTimeout(),this.isDecodeFirstIIframe){if(this.player.isPlayer()){if(null===this.firstAudioTime&&(this.firstAudioTime=t,null!==this.firstRenderTime&&null!==this.prevTs)){const e=Math.abs(this.firstRenderTime-this.prevTs);e>300&&(this.firstAudioTime-=e,this.player.debug.warn(this.TAG_NAME,`video\n firstAudioTime is ${this.firstRenderTime} and current time is ${this.prevTs}\n play time is ${e} and firstAudioTime ${t} - ${e} = ${this.firstAudioTime}`))}if(i=t-this.firstAudioTime,i<0&&(this.player.debug.warn(this.TAG_NAME,`decodeAudio\n local dts is < 0 , ts is ${t} and prevTs is ${this.prevAudioTs},\n firstAudioTime is ${this.firstAudioTime}`),i=null===this.prevAudioDts?0:this.prevAudioDts+this.player._opt.mseCorrectAudioTimeDuration,this._checkAudioTsIsMaxDiff(t)))return this.player.debug.warn(this.TAG_NAME,`decodeAudio is max diff , ts is ${t} and prevTs is ${this.prevAudioDts}, diff is ${this.prevAudioDts-t} and emit replay`),void this.player.emitError(ct.mediaSourceTsIsMaxDiff,`decodeAudio is max diff, prevTs is ${this.prevAudioDts} and ts is ${t}`);null!==this.prevAudioTs&&i<=this.prevAudioDts&&(this.player.debug.warn(this.TAG_NAME,`\n decodeAudio dts is less than(or equal) prev dts ,\n dts is ${i} and prev dts is ${this.prevAudioDts} ,\n and now ts is ${t} and prev ts is ${this.prevAudioTs} ,\n and diff is ${t-this.prevAudioTs}`),i=this.prevAudioDts+this.player._opt.mseCorrectAudioTimeDuration)}(this.player.isPlayer()||this.player.isPlayback()&&po(this.player.playbackPause))&&this._decodeAudio(e,i,t),this.prevAudioTs=t,this.prevAudioDts=i}else this.player.debug.log(this.TAG_NAME,"decodeAudio first frame is not iFrame")}}_checkTsIsMaxDiff(e){return this.prevTs>0&&eX}_checkAudioTsIsMaxDiff(e){return this.prevAudioTs>0&&eX}_decodeConfigurationRecord(e,t,i,s){let r=e.slice(5),a={};if(s===vt?a=En(r):s===_t&&(a=Fn(r)),Ha(a)||0===a.codecWidth&&0===a.codecHeight)return this.player.debug.warn(this.TAG_NAME,"_decodeConfigurationRecord",a),this.player.emitError(ct.mediaSourceDecoderConfigurationError),!1;this.player.recorder&&this.player._opt.recordType===S&&this.player.recorder.initMetaData(e,s);const o={id:mr,type:"video",timescale:1e3,duration:0,avcc:r,codecWidth:a.codecWidth,codecHeight:a.codecHeight,videoType:a.videoType},n=Uh.generateInitSegment(o);this.isAvc=s===vt;let l=a.codec;return this.videoMimeType=l?`video/mp4; codecs="${a.codec}"`:this.isAvc?hi:ci,this._initSourceBuffer(),this.appendBuffer(n.buffer),this.sequenceNumber=0,this.cacheTrack={},!0}_decodeAudioConfigurationRecord(e,t){const i=e[0]>>4,s=i===Tt,r=i===Et;if(po(r||s))return this.player.debug.warn(this.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${i} ant auto wasm decode`),this.player.emit(ct.mediaSourceAudioG711NotSupport),!1;const a={id:gr,type:"audio",timescale:1e3};let o={};if(zr(e)){if(o=function(e){let t=new Uint8Array(e),i=null,s=0,r=0,a=0,o=null;if(s=r=t[0]>>>3,a=(7&t[0])<<1|t[1]>>>7,a<0||a>=$r.length)return void console.error("Flv: AAC invalid sampling frequency index!");let n=$r[a],l=(120&t[1])>>>3;if(l<0||l>=8)return void console.log("Flv: AAC invalid channel configuration");5===s&&(o=(7&t[1])<<1|t[2]>>>7,t[2]);let d=self.navigator.userAgent.toLowerCase();return-1!==d.indexOf("firefox")?a>=6?(s=5,i=new Array(4),o=a-3):(s=2,i=new Array(2),o=a):-1!==d.indexOf("android")?(s=2,i=new Array(2),o=a):(s=5,o=a,i=new Array(4),a>=6?o=a-3:1===l&&(s=2,i=new Array(2),o=a)),i[0]=s<<3,i[0]|=(15&a)>>>1,i[1]=(15&a)<<7,i[1]|=(15&l)<<3,5===s&&(i[1]|=(15&o)>>>1,i[2]=(1&o)<<7,i[2]|=8,i[3]=0),{audioType:"aac",config:i,sampleRate:n,channelCount:l,objectType:s,codec:"mp4a.40."+s,originalCodec:"mp4a.40."+r}}(e.slice(2)),!o)return!1;a.audioSampleRate=o.sampleRate,a.channelCount=o.channelCount,a.config=o.config,a.refSampleDuration=1024/a.audioSampleRate*a.timescale}else{if(!s)return!1;if(o=function(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),i=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let s=t[1]>>>3&3,r=(6&t[1])>>1,a=(240&t[2])>>>4,o=(12&t[2])>>>2,n=3!=(t[3]>>>6&3)?2:1,l=0,d=0;switch(s){case 0:l=Nh[o];break;case 2:l=Oh[o];break;case 3:l=Fh[o]}switch(r){case 1:a0&&(h+=`;codecs=${l}`),po(this.isAudioInitInfo)&&(this.player.audio.updateAudioInfo({encTypeCode:i,channels:a.channelCount,sampleRate:a.audioSampleRate}),this.isAudioInitInfo=!0),this.audioMimeType=h,this.isAAC=r,this._initAudioSourceBuffer(),this.appendAudioBuffer(d.buffer),!0}_initSourceBuffer(){const{debug:e,events:{proxy:t}}=this.player;if(null===this.sourceBuffer&&null!==this.mediaSource&&this.isStateOpen&&this.videoMimeType){try{this.sourceBuffer=this.mediaSource.addSourceBuffer(this.videoMimeType),e.log(this.TAG_NAME,"_initSourceBuffer() this.mediaSource.addSourceBuffer()",this.videoMimeType)}catch(t){return e.error(this.TAG_NAME,"appendBuffer() this.mediaSource.addSourceBuffer()",t.code,t),this.player.emitError(ct.mseAddSourceBufferError,t),void(this.mediaSourceAddSourceBufferError=!0)}if(this.sourceBuffer){const i=t(this.sourceBuffer,"error",(t=>{this.mediaSourceBufferError=!0,e.error(this.TAG_NAME,"mseSourceBufferError this.sourceBuffer",t),this.player.emitError(ct.mseSourceBufferError,t)})),s=t(this.sourceBuffer,"updateend",(()=>{this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this.hasPendingEos&&(this.player.debug.log(this.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),this.endOfStream())}));this.eventListenList.push(i,s)}}else e.log(this.TAG_NAME,`_initSourceBuffer and this.isStateOpen is ${this.isStateOpen} and this.isAvc === null is ${null===this.isAvc}`)}_initAudioSourceBuffer(){const{debug:e,events:{proxy:t}}=this.player;if(null===this.audioSourceBuffer&&null!==this.mediaSource&&this.isStateOpen&&this.audioMimeType){try{this.audioSourceBuffer=this.mediaSource.addSourceBuffer(this.audioMimeType),this._clearAudioSourceBufferCheckTimeout(),e.log(this.TAG_NAME,"_initAudioSourceBuffer() this.mediaSource.addSourceBuffer()",this.audioMimeType)}catch(t){return e.error(this.TAG_NAME,"appendAudioBuffer() this.mediaSource.addSourceBuffer()",t.code,t),this.player.emitError(ct.mseAddSourceBufferError,t),void(this.mediaSourceAddSourceBufferError=!0)}if(this.audioSourceBuffer){const i=t(this.audioSourceBuffer,"error",(t=>{this.mediaSourceBufferError=!0,e.error(this.TAG_NAME,"mseSourceBufferError this.audioSourceBuffer",t),this.player.emitError(ct.mseSourceBufferError,t)})),s=t(this.audioSourceBuffer,"updateend",(()=>{this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this.hasPendingEos&&(this.player.debug.log(this.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),this.endOfStream())}));this.eventListenList.push(i,s),null===this.audioSourceNoDataCheckTimeout&&(this.audioSourceNoDataCheckTimeout=setTimeout((()=>{this._clearAudioNoDataCheckTimeout(),this.player.emit(ct.mediaSourceAudioNoDataTimeout)}),1e3))}}else e.log(this.TAG_NAME,`_initAudioSourceBuffer and this.isStateOpen is ${this.isStateOpen} and this.audioMimeType is ${this.audioMimeType}`)}_decodeVideo(e,t,i,s,r){const a=this.player;let o=e.slice(5),n=o.byteLength;if(0===n)return void a.debug.warn(this.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let l=(new Date).getTime(),d=!1;this.prevTimestamp||(this.prevTimestamp=l,d=!0);const h=l-this.prevTimestamp;this.decodeDiffTimestamp=h,h>500&&!d&&this.player.isPlayer()&&a.debug.warn(this.TAG_NAME,`_decodeVideo now time is ${l} and prev time is ${this.prevTimestamp}, diff time is ${h} ms`);const c=this.$videoElement;if(this.cacheTrack.id&&t>=this.cacheTrack.dts){let e=8+this.cacheTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(Uh.types.mdat,4),i.set(this.cacheTrack.data,8),this.cacheTrack.duration=t-this.cacheTrack.dts;let s=Uh.moof(this.cacheTrack,this.cacheTrack.dts);this.cacheTrack={};let o=new Uint8Array(s.byteLength+i.byteLength);o.set(s,0),o.set(i,s.byteLength),this.appendBuffer(o.buffer),a.emit(nt.timeUpdate,r),a.isPlayer()?a.isUseHls265()?a.updateStats({dfps:!0,mseTs:t}):a.updateStats({fps:!0,dfps:!0,ts:r,mseTs:t}):a.isPlayback()&&a.playback.updateStats({ts:r}),a._times.videoStart||(a._times.videoStart=aa(),a.handlePlayToRenderTimes())}else a.debug.log(this.TAG_NAME,`cacheTrack = {} now dts is ${t}, and ts is ${r} cacheTrack dts is ${this.cacheTrack&&this.cacheTrack.dts}`),this.cacheTrack={};this.cacheTrack||(this.cacheTrack={}),this.cacheTrack.id=mr,this.cacheTrack.sequenceNumber=++this.sequenceNumber,this.cacheTrack.size=n,this.cacheTrack.dts=t,this.cacheTrack.cts=s,this.cacheTrack.isKeyframe=i,this.cacheTrack.data=o,this.cacheTrack.flags={isLeading:0,dependsOn:i?2:1,isDependedOn:i?1:0,hasRedundancy:0,isNonSync:i?0:1},!this.isInitInfo&&c.videoWidth>0&&c.videoHeight>0&&(a.debug.log(this.TAG_NAME,`updateVideoInfo: ${c.videoWidth},${c.videoHeight}`),a.video.updateVideoInfo({width:c.videoWidth,height:c.videoHeight}),a.video.initCanvasViewSize(),this.isInitInfo=!0),a._opt.mseUseCanvasRender&&po(this.isSupportVideoFrameCallback)&&po(a.isUseHls265())&&a.video.render({$video:c,ts:t}),this.prevTimestamp=(new Date).getTime()}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}_decodeAudio(e,t,i){const s=this.player;let r=this.isAAC?e.slice(2):e.slice(1),a=r.byteLength;if(this.cacheAudioTrack.id&&t>=this.cacheAudioTrack.dts){let e=8+this.cacheAudioTrack.size,i=new Uint8Array(e);i[0]=e>>>24&255,i[1]=e>>>16&255,i[2]=e>>>8&255,i[3]=255&e,i.set(Uh.types.mdat,4),i.set(this.cacheAudioTrack.data,8),this.cacheAudioTrack.duration=t-this.cacheAudioTrack.dts;let s=Uh.moof(this.cacheAudioTrack,this.cacheAudioTrack.dts);this.cacheAudioTrack={};let r=new Uint8Array(s.byteLength+i.byteLength);r.set(s,0),r.set(i,s.byteLength),this.appendAudioBuffer(r.buffer)}else s.debug.log(this.TAG_NAME,`cacheAudioTrack = {} now dts is ${t} cacheAudioTrack dts is ${this.cacheAudioTrack&&this.cacheAudioTrack.dts}`),this.cacheAudioTrack={};this.cacheAudioTrack||(this.cacheAudioTrack={}),this.cacheAudioTrack.id=gr,this.cacheAudioTrack.sequenceNumber=++this.audioSequenceNumber,this.cacheAudioTrack.size=a,this.cacheAudioTrack.dts=t,this.cacheAudioTrack.cts=0,this.cacheAudioTrack.data=r,this.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}appendBuffer(e){if(this.player.isDestroyedOrClosed())return void this.player.debug.warn(this.TAG_NAME,"appendBuffer() player is destroyed");const{debug:t,events:{proxy:i}}=this.player;this.mediaSourceAddSourceBufferError?t.warn(this.TAG_NAME,"appendBuffer() this.mediaSourceAddSourceBufferError is true"):this.mediaSourceAppendBufferFull?t.warn(this.TAG_NAME,"appendBuffer() this.mediaSourceAppendBufferFull is true"):this.mediaSourceAppendBufferError?t.warn(this.TAG_NAME,"appendBuffer() this.mediaSourceAppendBufferError is true"):this.mediaSourceBufferError?t.warn(this.TAG_NAME,"appendBuffer() this.mediaSourceBufferError is true"):(this.pendingSegments.push(e),this.sourceBuffer&&(this.player.isPlayer()&&this._handleUpdatePlaybackRate(),this.player.isPlayback()&&(this._handleUpdateBufferDelayTime(),this._checkVideoPlayCurrentTime()),this.player._opt.mseAutoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanUpSourceBuffer(),po(this.getSourceBufferUpdating())&&this.isStateOpen&&po(this._hasPendingRemoveRanges()))?this._doAppendSegments():this.isStateClosed?(this.mediaSourceBufferError=!0,this.player.emitError(ct.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):this.isStateEnded?(this.mediaSourceBufferError=!0,this.player.emitError(ct.mseSourceBufferError,"mediaSource is end")):this._hasPendingRemoveRanges()&&t.log(this.TAG_NAME,`video has pending remove ranges and video length is ${this.pendingRemoveRanges.length}, audio length is ${this.pendingAudioRemoveRanges.length}`))}appendAudioBuffer(e){if(this.player.isDestroyedOrClosed())return void this.player.debug.warn(this.TAG_NAME,"appendAudioBuffer() player is destroyed");const{debug:t,events:{proxy:i}}=this.player;this.mediaSourceAddSourceBufferError?t.warn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAddSourceBufferError is true"):this.mediaSourceAppendBufferFull?t.warn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAppendBufferFull is true"):this.mediaSourceAppendBufferError?t.warn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceAppendBufferError is true"):this.mediaSourceBufferError?t.warn(this.TAG_NAME,"appendAudioBuffer() this.mediaSourceBufferError is true"):(this.pendingAudioSegments.push(e),this.audioSourceBuffer&&(this.player.isPlayer()&&this._handleUpdatePlaybackRate(),this.player.isPlayback()&&(this._handleUpdateBufferDelayTime(),this._checkVideoPlayCurrentTime()),this.player._opt.mseAutoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanUpSourceBuffer(),po(this.getAudioSourceBufferUpdating())&&this.isStateOpen&&po(this._hasPendingRemoveRanges()))?this._doAppendSegments():this.isStateClosed?(this.mediaSourceBufferError=!0,this.player.emitError(ct.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):this.isStateEnded?(this.mediaSourceBufferError=!0,this.player.emitError(ct.mseSourceBufferError,"mediaSource is end")):this._hasPendingRemoveRanges()&&t.log(this.TAG_NAME,`audio has pending remove ranges and video length is ${this.pendingRemoveRanges.length}, audio length is ${this.pendingAudioRemoveRanges.length}`))}getSourceBufferUpdating(){return this.sourceBuffer&&this.sourceBuffer.updating}getAudioSourceBufferUpdating(){return this.audioSourceBuffer&&this.audioSourceBuffer.updating}stop(){this.abortSourceBuffer(),this.removeSourceBuffer(),this.endOfStream()}checkSourceBufferDelay(){const e=this.$videoElement;let t=0,i=0;return e.buffered.length>0&&(i=e.buffered.end(e.buffered.length-1),t=i-e.currentTime),t<0&&(this.player.debug.warn(this.TAG_NAME,`checkMSESourceBufferDelay ${t} < 0, and buffered is ${i} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${i}`),e.currentTime=i,t=0),t}checkSourceBufferStore(){const e=this.$videoElement;let t=0;return e.buffered.length>0&&(t=e.currentTime-e.buffered.start(0)),t}getDecodeDiffTimes(){return this.decodeDiffTimestamp}removeBuffer(e,t){const i=Ka();if(this.player.debug.log(this.TAG_NAME,`removeBuffer() start is ${e} and end is ${t} and _isMacOsFirefox is ${i}`),this.isStateOpen&&po(i)){if(po(this.getSourceBufferUpdating()))try{this.sourceBuffer.remove(e,t)}catch(e){this.player.debug.warn(this.TAG_NAME,"removeBuffer() sourceBuffer error",e)}if(po(this.getAudioSourceBufferUpdating()))try{this.audioSourceBuffer.remove(e,t)}catch(e){this.player.debug.warn(this.TAG_NAME,"removeBuffer() audioSourceBuffer error",e)}}}clearUpAllSourceBuffer(){if(this.sourceBuffer){const e=this.sourceBuffer.buffered;for(let t=0;t=1)if(this.getSourceBufferUpdating()||this.getAudioSourceBufferUpdating())this.hasPendingEos=!0;else{this.hasPendingEos=!1;try{this.player.debug.log(this.TAG_NAME,"endOfStream()"),this.mediaSource.endOfStream()}catch(e){this.player.debug.warn(this.TAG_NAME,"endOfStream() error",e)}}}abortSourceBuffer(){if(this.isStateOpen){if(this.sourceBuffer){try{this.player.debug.log(this.TAG_NAME,"abortSourceBuffer() abort sourceBuffer"),this.sourceBuffer.abort()}catch(e){}po(this.getSourceBufferUpdating())&&this._doRemoveRanges()}if(this.audioSourceBuffer){try{this.player.debug.log(this.TAG_NAME,"abortSourceBuffer() abort audioSourceBuffer"),this.audioSourceBuffer.abort()}catch(e){}po(this.getAudioSourceBufferUpdating())&&this._doRemoveRanges()}}this.sourceBuffer=null,this.audioSourceBuffer=null}removeSourceBuffer(){if(!this.isStateClosed&&this.mediaSource){if(this.sourceBuffer)try{this.player.debug.log(this.TAG_NAME,"removeSourceBuffer() sourceBuffer"),this.mediaSource.removeSourceBuffer(this.sourceBuffer)}catch(e){this.player.debug.error(this.TAG_NAME,"removeSourceBuffer() sourceBuffer error",e)}if(this.audioSourceBuffer)try{this.player.debug.log(this.TAG_NAME,"removeSourceBuffer() audioSourceBuffer"),this.mediaSource.removeSourceBuffer(this.audioSourceBuffer)}catch(e){this.player.debug.error(this.TAG_NAME,"removeSourceBuffer() audioSourceBuffer error",e)}}}_hasPendingSegments(){return this.pendingSegments.length>0||this.pendingAudioSegments.length>0}getPendingSegmentsLength(){return this.pendingSegments.length}_handleUpdatePlaybackRate(){if(!this.$videoElement)return;const e=this.$videoElement;this.player._opt.videoBuffer,this.player._opt.videoBufferDelay;const t=e.buffered;t.length&&t.start(0);const i=t.length?t.end(t.length-1):0;let s=e.currentTime;const r=i-s,a=this.getMseBufferMaxDelayTime();if(this.player.updateStats({mseVideoBufferDelayTime:r}),r>a)this.player.debug.log(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current is ${s} , delay buffer is more than ${a} is ${r} and new time is ${i}`),e.currentTime=i,s=e.currentTime;else if(r<0){if(this.player.debug.warn(this.TAG_NAME,`handleUpdatePlaybackRate and delay buffer is ${i} - current is ${s} = ${r} < 0 and check video is paused : ${e.paused} `),0===i)return void this.player.emit(ct.mediaSourceBufferedIsZeroError,"video.buffered is empty");e.paused&&e.play()}const o=this._getPlaybackRate(i-s);e.playbackRate!==o&&(this.player.debug.log(this.TAG_NAME,`handleUpdatePlaybackRate and buffered is ${i} and current time is ${s} and delay is ${i-s} set playbackRate is ${o} `),e.playbackRate=o)}_handleUpdateBufferDelayTime(){const e=this.getVideoBufferDelayTime();this.player.updateStats({mseVideoBufferDelayTime:e})}_checkVideoPlayCurrentTime(){const e=this.checkSourceBufferStore();if(e<0){const t=this.getVideoBufferStartTime();this.player.debug.warn(this.TAG_NAME,`checkVideoPlayCurrentTime store is ${e} < 0 and set currentTime ${this.$videoElement.currentTime} to ${t}`),this.$videoElement.currentTime=t}}_doAppendSegments(){if(this.isStateClosed||this.isStateEnded)this.player.debug.log(this.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==this.sourceBuffer){if(this.needInitAudio()&&null===this.audioSourceBuffer)return this.player.debug.log(this.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===this.audioSourceBufferCheckTimeout&&(this.audioSourceBufferCheckTimeout=setTimeout((()=>{this._clearAudioSourceBufferCheckTimeout(),this.player.emit(ct.mediaSourceAudioInitTimeout)}),1e3)));if(po(this.getSourceBufferUpdating())&&this.pendingSegments.length>0){const e=this.pendingSegments.shift();try{this.sourceBuffer.appendBuffer(e)}catch(e){this.player.debug.error(this.TAG_NAME,"this.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.player.emitError(ct.mediaSourceFull)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.player.emitError(ct.mediaSourceAppendBufferError)):(this.stop(),this.mediaSourceBufferError=!0,this.player.emitError(nt.mseSourceBufferError,e))}}if(po(this.getAudioSourceBufferUpdating())&&this.pendingAudioSegments.length>0){const e=this.pendingAudioSegments.shift();try{this.audioSourceBuffer.appendBuffer(e)}catch(e){this.player.debug.error(this.TAG_NAME,"this.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.player.emitError(ct.mediaSourceFull)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.player.emitError(ct.mediaSourceAppendBufferError)):(this.stop(),this.mediaSourceBufferError=!0,this.player.emitError(nt.mseSourceBufferError,e))}}}else this.player.debug.log(this.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")}_doCleanUpSourceBuffer(){if(!this.$videoElement)return;const e=this.$videoElement.currentTime;if(this.sourceBuffer){const t=this.sourceBuffer.buffered;let i=!1;for(let s=0;s=this.player._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-this.player._opt.mseAutoCleanupMinBackwardDuration;this.pendingRemoveRanges.push({start:r,end:t})}}else a=this.player._opt.mseAutoCleanupMaxBackwardDuration){i=!0;let t=e-this.player._opt.mseAutoCleanupMinBackwardDuration;this.pendingAudioRemoveRanges.push({start:r,end:t})}}else a0||this.pendingAudioRemoveRanges.length>0}_doRemoveRanges(){if(this.sourceBuffer&&po(this.getSourceBufferUpdating())){let e=this.pendingRemoveRanges;for(;e.length&&po(this.getSourceBufferUpdating());){let t=e.shift();try{this.sourceBuffer.remove(t.start,t.end)}catch(e){this.player.debug.warn(this.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e)}}}if(this.audioSourceBuffer&&po(this.getAudioSourceBufferUpdating())){let e=this.pendingAudioRemoveRanges;for(;e.length&&po(this.getAudioSourceBufferUpdating());){let t=e.shift();try{this.audioSourceBuffer.remove(t.start,t.end)}catch(e){this.player.debug.warn(this.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e)}}}}getDecodePlaybackRate(){let e=0;const t=this.$videoElement;return t&&(e=t.playbackRate),e}_getPlaybackRate(e){const t=this.$videoElement;let i=this.player._opt.videoBufferDelay+this.player._opt.videoBuffer;const s=Math.max(i,1e3),r=s/2;return e*=1e3,1===t.playbackRate?e>s?1.2:1:e<=r?1:t.playbackRate}_needCleanupSourceBuffer(){if(po(this.player._opt.mseAutoCleanupSourceBuffer)||!this.$videoElement)return!1;const e=this.$videoElement,t=e.buffered,i=e.currentTime;return t.length>=1&&i-t.start(0)>=this.player._opt.mseAutoCleanupMaxBackwardDuration}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}getVideoBufferLastTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;i.length&&i.start(0);t=i.length?i.end(i.length-1):0}return t}getVideoBufferStartTime(){const e=this.$videoElement;let t=0;if(e){const i=e.buffered;t=i.length?i.start(0):0}return t}getVideoBufferDelayTime(){const e=this.$videoElement;const t=this.getVideoBufferLastTime()-e.currentTime;return t>0?t:0}_clearAudioSourceBufferCheckTimeout(){this.audioSourceBufferCheckTimeout&&(clearTimeout(this.audioSourceBufferCheckTimeout),this.audioSourceBufferCheckTimeout=null)}_clearAudioNoDataCheckTimeout(){this.audioSourceNoDataCheckTimeout&&(clearTimeout(this.audioSourceNoDataCheckTimeout),this.audioSourceNoDataCheckTimeout=null)}getMimeType(){return{video:this.videoMimeType,audio:this.audioMimeType}}getMseBufferMaxDelayTime(){let e=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3;return Math.max(5,e+3)}}const Vh=()=>"wakeLock"in navigator&&-1===window.navigator.userAgent.indexOf("Samsung")&&po(ya());class $h{constructor(e){this.player=e,this.enabled=!1,Vh()?(this.player.debug.log("NoSleep","Native Wake Lock API supported."),this._wakeLock=null,this.handleVisibilityChange=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()},document.addEventListener("visibilitychange",this.handleVisibilityChange),document.addEventListener("fullscreenchange",this.handleVisibilityChange)):(this.player.debug.log("NoSleep","Native Wake Lock API not supported. so use video element."),this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQRChYECGFOAZwEAAAAAABLfEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHYTbuMU6uEElTDZ1OsggGXTbuMU6uEHFO7a1OsghLJ7AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmsirXsYMPQkBNgI1MYXZmNTguNDUuMTAwV0GNTGF2ZjU4LjQ1LjEwMESJiECzmgAAAAAAFlSua0C5rgEAAAAAAABO14EBc8WI9UhIq9EDJPCcgQAitZyDdW5khoVWX1ZQOIOBASPjg4QF9eEA4AEAAAAAAAAbsIIBQLqB8FSwggElVLqB8FWwiFW3gQFVuIECrgEAAAAAAABZ14ECc8WIUEWPA9J/iJ6cgQAitZyDdW5khoZBX09QVVNWqoNjLqBWu4QExLQAg4EC4ZGfgQG1iEDncAAAAAAAYmSBIGOik09wdXNIZWFkAQE4AYC7AAAAAAASVMNnQcJzcwEAAAAAAACXY8CAZ8gBAAAAAAAAFUWji01BSk9SX0JSQU5ERIeEaXNvbWfIAQAAAAAAABZFo41NSU5PUl9WRVJTSU9ORIeDNTEyZ8gBAAAAAAAAJ0WjkUNPTVBBVElCTEVfQlJBTkRTRIeQaXNvbWlzbzJhdmMxbXA0MWfIAQAAAAAAABpFo4dFTkNPREVSRIeNTGF2ZjU4LjQ1LjEwMHNzAQAAAAAAAIZjwItjxYj1SEir0QMk8GfIAQAAAAAAAB5Fo4xIQU5ETEVSX05BTUVEh4xWaWRlb0hhbmRsZXJnyAEAAAAAAAAhRaOHRU5DT0RFUkSHlExhdmM1OC45MS4xMDAgbGlidnB4Z8iiRaOIRFVSQVRJT05Eh5QwMDowMDowNS4wMDcwMDAwMDAAAHNzAQAAAAAAAIdjwItjxYhQRY8D0n+InmfIAQAAAAAAAB5Fo4xIQU5ETEVSX05BTUVEh4xTb3VuZEhhbmRsZXJnyAEAAAAAAAAiRaOHRU5DT0RFUkSHlUxhdmM1OC45MS4xMDAgbGlib3B1c2fIokWjiERVUkFUSU9ORIeUMDA6MDA6MDUuMDE4MDAwMDAwAAAfQ7Z1T2TngQCjh4IAAID4//6jQKSBAAeAMBIAnQEqQAHwAABHCIWFiIWEiAICAAYWBPcGgWSfa9ubJzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh7Jzh69AD+/6tQgKOHggAVgPj//qOHggApgPj//qOHggA9gPj//qOHggBRgPj//qOHggBlgPj//qOegQBrANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCAHmA+P/+o4eCAI2A+P/+o4eCAKGA+P/+o4eCALWA+P/+o4eCAMmA+P/+o56BAM8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IA3YD4//6jh4IA8YD4//6jh4IBBYD4//6jh4IBGYD4//6jh4IBLYD4//6jnoEBMwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggFBgPj//qOHggFVgPj//qOHggFpgPj//qOHggF9gPj//qOHggGRgPj//qOegQGXANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCAaWA+P/+o4eCAbmA+P/+o4eCAc2A+P/+o4eCAeGA+P/+o4eCAfWA+P/+o56BAfsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4ICCYD4//6jh4ICHYD4//6jh4ICMYD4//6jh4ICRYD4//6jh4ICWYD4//6jnoECXwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggJtgPj//qOHggKBgPj//qOHggKVgPj//qOHggKpgPj//qOHggK9gPj//qOegQLDANECAAUQEBRgAGFgv9AAIgAQzX61yT5xzAAAo4eCAtGA+P/+o4eCAuWA+P/+o4eCAvmA+P/+o4eCAw2A+P/+o4eCAyGA+P/+o56BAycA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IDNYD4//6jh4IDSYD4//6jh4IDXYD4//6jh4IDcYD4//6jh4IDhYD4//6jnoEDiwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggOZgPj//qOHggOtgPj//qOHggPBgPj//qOHggPVgPj//qOHggPpgPj//qOegQPvANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCA/2A+P/+o4eCBBGA+P/+o4eCBCWA+P/+o4eCBDmA+P/+o4eCBE2A+P/+o56BBFMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IEiID4//6jh4IEnID4//6jh4IEsID4//6jnoEEtwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggTEgPj//qOHggTYgPj//qOHggTsgPj//qOHggUAgPj//qOHggUUgPj//qOegQUbANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBSiA+P/+o4eCBTyA+P/+o4eCBVCA+P/+o4eCBWSA+P/+o4eCBXiA+P/+o56BBX8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IFjID4//6jh4IFoID4//6jh4IFtID4//6jh4IFyID4//6jh4IF3ID4//6jnoEF4wDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggXwgPj//qOHggYEgPj//qOHggYYgPj//qOHggYsgPj//qOHggZAgPj//qOegQZHANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCBlSA+P/+o4eCBmiA+P/+o4eCBnyA+P/+o4eCBpCA+P/+o4eCBqSA+P/+o56BBqsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IGuID4//6jh4IGzID4//6jh4IG4ID4//6jh4IG9ID4//6jh4IHCID4//6jnoEHDwDRAgAFEBAUYABhYL/QACIAEM1+tck+ccwAAKOHggccgPj//qOHggcwgPj//qOHggdEgPj//qOHggdYgPj//qOHggdsgPj//qOegQdzANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCB4CA+P/+o4eCB5SA+P/+o4eCB6iA+P/+o4eCB7yA+P/+o4eCB9CA+P/+o56BB9cA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IH5ID4//6jh4IH+ID4//6jh4IIDID4//6jh4IIIID4//6jh4IINID4//6jnoEIOwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgghIgPj//qOHgghcgPj//qOHgghwgPj//qOHggiEgPj//qOegQifANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCMCA+P/+o4eCCNSA+P/+o4eCCOiA+P/+o4eCCPyA+P/+o56BCQMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IJEID4//6jh4IJJID4//6jh4IJOID4//6jh4IJTID4//6jh4IJYID4//6jnoEJZwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggl0gPj//qOHggmIgPj//qOHggmcgPj//qOHggmwgPj//qOHggnEgPj//qOegQnLANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCdiA+P/+o4eCCeyA+P/+o4eCCgCA+P/+o4eCChSA+P/+o4eCCiiA+P/+o56BCi8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IKPID4//6jh4IKUID4//6jh4IKZID4//6jh4IKeID4//6jh4IKjID4//6jnoEKkwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggqggPj//qOHggq0gPj//qOHggrIgPj//qOHggrcgPj//qOHggrwgPj//qOegQr3ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCCwSA+P/+o4eCCxiA+P/+o4eCCyyA+P/+o4eCC0CA+P/+o4eCC1SA+P/+o56BC1sA0QIABRAQFGAAYWC/0AAiABDNfrXJPnHMAACjh4ILaID4//6jh4ILfID4//6jh4ILkID4//6jh4ILpID4//6jh4ILuID4//6jnoELvwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHggvMgPj//qOHggvggPj//qOHggv0gPj//qOHggwIgPj//qOHggwcgPj//qOegQwjANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDDCA+P/+o4eCDESA+P/+o4eCDFiA+P/+o4eCDGyA+P/+o4eCDICA+P/+o56BDIcA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IMlID4//6jh4IMqID4//6jh4IMvID4//6jh4IM0ID4//6jnoEM6wDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgg0MgPj//qOHgg0ggPj//qOHgg00gPj//qOHgg1IgPj//qOegQ1PANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDVyA+P/+o4eCDXCA+P/+o4eCDYSA+P/+o4eCDZiA+P/+o4eCDayA+P/+o56BDbMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4INwID4//6jh4IN1ID4//6jh4IN6ID4//6jh4IN/ID4//6jh4IOEID4//6jnoEOFwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgg4kgPj//qOHgg44gPj//qOHgg5MgPj//qOHgg5ggPj//qOHgg50gPj//qOegQ57ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCDoiA+P/+o4eCDpyA+P/+o4eCDrCA+P/+o4eCDsSA+P/+o4eCDtiA+P/+o56BDt8A0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IO7ID4//6jh4IPAID4//6jh4IPFID4//6jh4IPKID4//6jh4IPPID4//6jnoEPQwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHgg9QgPj//qOHgg9kgPj//qOHgg94gPj//qOHgg+MgPj//qOHgg+ggPj//qOegQ+nANECAAUQEBRgAGFgv9AAIgAQzX61yT5xzAAAo4eCD7SA+P/+o4eCD8iA+P/+o4eCD9yA+P/+o4eCD/CA+P/+o4eCEASA+P/+o56BEAsA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IQGID4//6jh4IQLID4//6jh4IQQID4//6jh4IQVID4//6jh4IQaID4//6jnoEQbwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghB8gPj//qOHghCQgPj//qOHghCkgPj//qOHghC4gPj//qOHghDMgPj//qOegRDTANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEOCA+P/+o4eCEPSA+P/+o4eCEQiA+P/+o56BETcA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4IRQ4D4//6jh4IRV4D4//6jh4IRa4D4//6jh4IRf4D4//6jh4IRk4D4//6jnoERmwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghGngPj//qOHghG7gPj//qOHghHPgPj//qOHghHjgPj//qOHghH3gPj//qOegRH/ANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEguA+P/+o4eCEh+A+P/+o4eCEjOA+P/+o4eCEkeA+P/+o4eCEluA+P/+o56BEmMA0QIABRCsABgAGFgv9AAIgAQzX61yT5xzAACjh4ISb4D4//6jh4ISg4D4//6jh4ISl4D4//6jh4ISq4D4//6jh4ISv4D4//6jnoESxwDRAgAFEKwAGAAYWC/0AAiABDNfrXJPnHMAAKOHghLTgPj//qOHghLngPj//qOHghL7gPj//qOHghMPgPj//qOHghMjgPj//qOegRMrANECAAUQrAAYABhYL/QACIAEM1+tck+ccwAAo4eCEzeA+P/+o4eCE0uA+P/+o4eCE1+A+P/+o4eCE3OA+P/+oAEAAAAAAAAPoYeCE4cA+P/+daKDB/KBHFO7a5G7j7OBB7eK94EB8YIDX/CBDA=="),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACORtZGF03gIATGF2YzU4LjM1LjEwMAACMEAOAAACcQYF//9t3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2MSByMzAyNyA0MTIxMjc3IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAyMCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTAgcmVmPTMgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9NyBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0xIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MSA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0tMiB0aHJlYWRzPTcgbG9va2FoZWFkX3RocmVhZHM9MSBzbGljZWRfdGhyZWFkcz0wIG5yPTAgZGVjaW1hdGU9MSBpbnRlcmxhY2VkPTAgYmx1cmF5X2NvbXBhdD0wIGNvbnN0cmFpbmVkX2ludHJhPTAgYmZyYW1lcz0wIHdlaWdodHA9MCBrZXlpbnQ9MjUwIGtleWludF9taW49MTAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD00MCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIzLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IGlwX3JhdGlvPTEuNDAgYXE9MToxLjAwAIAAAADvZYiED/JigADD7JycnJycnJycnJycnJycnJycnJ11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111114BGCAHARggBwEYIAcBGCAHARggBwAAAAdBmjgf4BLYARggBwEYIAcBGCAHARggBwAAAAdBmlQH+AS2ARggBwEYIAcBGCAHARggBwAAAAdBmmA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZqAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZrAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0Ga4D/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbAD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbID/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBm0A/wCWwARggBwEYIAcBGCAHAAAAB0GbYD/AJbABGCAHARggBwEYIAcAAAAHQZuAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GboD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbwD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0Gb4D/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBmgA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmiA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmkA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZpgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZqgP8AlsAEYIAcBGCAHARggBwAAAAdBmsA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmuA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmwA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZsgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZtAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZtgP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GbgD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GboD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GbwD/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBm+A/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmgA/wCWwARggBwEYIAcAAAAHQZogP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GaQD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GaYD/AJbABGCAHARggBwEYIAcBGCAHAAAAB0GagD/AJbABGCAHARggBwEYIAcBGCAHARggBwAAAAdBmqA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmsA/wCWwARggBwEYIAcBGCAHARggBwAAAAdBmuA/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZsAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZsgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZtAP8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GbYD/AJbABGCAHARggBwAAAAdBm4A/wCWwARggBwEYIAcBGCAHARggBwAAAAdBm6A/wCWwARggBwEYIAcBGCAHARggBwEYIAcAAAAHQZvAP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZvgP8AlsAEYIAcBGCAHARggBwEYIAcAAAAHQZoAO8AlsAEYIAcBGCAHARggBwEYIAcBGCAHAAAAB0GaIDfAJbABGCAHARggBwEYIAcBGCAHAAAMxm1vb3YAAABsbXZoZAAAAAAAAAAAAAAAAAAAA+gAABOgAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAPLdHJhawAAAFx0a2hkAAAAAwAAAAAAAAAAAAAAAQAAAAAAABOIAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAElVVUA8AAAAAAAJGVkdHMAAAAcZWxzdAAAAAAAAAABAAATiAAAAAAAAQAAAAADQ21kaWEAAAAgbWRoZAAAAAAAAAAAAAAAAAAAKAAAAMgAVcQAAAAAAC1oZGxyAAAAAAAAAAB2aWRlAAAAAAAAAAAAAAAAVmlkZW9IYW5kbGVyAAAAAu5taW5mAAAAFHZtaGQAAAABAAAAAAAAAAAAAAAkZGluZgAAABxkcmVmAAAAAAAAAAEAAAAMdXJsIAAAAAEAAAKuc3RibAAAAKpzdHNkAAAAAAAAAAEAAACaYXZjMQAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAFAAPAASAAAAEgAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABj//wAAADRhdmNDAULAC//hABxnQsAL2QFB+/8ACwAMEAAAAwAQAAADAUDxQqSAAQAFaMuDyyAAAAAQcGFzcAAAAAsAAAAMAAAAGHN0dHMAAAAAAAAAAQAAADIAAAQAAAAAFHN0c3MAAAAAAAAAAQAAAAEAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAA3HN0c3oAAAAAAAAAAAAAADIAAANoAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAAAsAAAALAAAACwAAANhzdGNvAAAAAAAAADIAAABFAAADwQAAA9wAAAP3AAAEFgAABDEAAARMAAAEawAABIYAAAShAAAEwAAABNcAAATuAAAFDQAABSgAAAVDAAAFYgAABX0AAAWYAAAFtwAABdIAAAXtAAAGBAAABh8AAAY6AAAGWQAABnQAAAaPAAAGrgAABskAAAbkAAAHAwAABx4AAAcxAAAHUAAAB2sAAAeGAAAHpQAAB8AAAAfbAAAH+gAACBUAAAgwAAAITwAACGIAAAh9AAAInAAACLcAAAjSAAAI8QAACCV0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAAE6AAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAABOIAAAEAAABAAAAAAedbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAACsRAADYVRVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAAHSG1pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAHDHN0YmwAAABqc3RzZAAAAAAAAAABAAAAWm1wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAACsRAAAAAAANmVzZHMAAAAAA4CAgCUAAgAEgICAF0AVAAAAAAENiAAABVQFgICABRIIVuUABoCAgAECAAAAYHN0dHMAAAAAAAAACgAAAC8AAAQAAAAAAQAACtUAAAAsAAAEAAAAAAEAAArWAAAALAAABAAAAAABAAAK1QAAACwAAAQAAAAAAQAACtUAAAAaAAAEAAAAAAEAAAH/AAABzHN0c2MAAAAAAAAAJQAAAAEAAAABAAAAAQAAAAIAAAAFAAAAAQAAAAMAAAAEAAAAAQAAAAUAAAAFAAAAAQAAAAYAAAAEAAAAAQAAAAgAAAAFAAAAAQAAAAkAAAAEAAAAAQAAAAsAAAAFAAAAAQAAAAwAAAADAAAAAQAAAA4AAAAFAAAAAQAAAA8AAAAEAAAAAQAAABEAAAAFAAAAAQAAABIAAAAEAAAAAQAAABQAAAAFAAAAAQAAABUAAAAEAAAAAQAAABcAAAADAAAAAQAAABgAAAAEAAAAAQAAABoAAAAFAAAAAQAAABsAAAAEAAAAAQAAAB0AAAAFAAAAAQAAAB4AAAAEAAAAAQAAACAAAAAFAAAAAQAAACEAAAAEAAAAAQAAACIAAAACAAAAAQAAACMAAAAFAAAAAQAAACQAAAAEAAAAAQAAACYAAAAFAAAAAQAAACcAAAAEAAAAAQAAACkAAAAFAAAAAQAAACoAAAAEAAAAAQAAACwAAAAFAAAAAQAAAC0AAAACAAAAAQAAAC4AAAAEAAAAAQAAAC8AAAAFAAAAAQAAADAAAAAEAAAAAQAAADIAAAAFAAAAAQAAADMAAAAEAAAAAQAAA1xzdHN6AAAAAAAAAAAAAADSAAAAFQAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAABAAAAAQAAAAEAAAA3HN0Y28AAAAAAAAAMwAAADAAAAOtAAADzAAAA+cAAAQCAAAEIQAABDwAAARXAAAEdgAABJEAAASsAAAEywAABOIAAAT5AAAFGAAABTMAAAVOAAAFbQAABYgAAAWjAAAFwgAABd0AAAX4AAAGDwAABioAAAZFAAAGZAAABn8AAAaaAAAGuQAABtQAAAbvAAAHDgAABykAAAc8AAAHWwAAB3YAAAeRAAAHsAAAB8sAAAfmAAAIBQAACCAAAAg7AAAIWgAACG0AAAiIAAAIpwAACMIAAAjdAAAI/AAAABpzZ3BkAQAAAHJvbGwAAAACAAAAAf//AAAAHHNiZ3AAAAAAcm9sbAAAAAEAAADSAAAAAQAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTguMjAuMTAw"),Object.assign(this.noSleepVideo.style,{position:"absolute",left:"-100%",top:"-100%"}),document.querySelector("body").append(this.noSleepVideo),this.handleNoSleepVideoTimeUpdate=()=>{this.noSleepVideo&&this.noSleepVideo.currentTime>4&&(this.noSleepVideo.currentTime=1)},this.noSleepVideo.addEventListener("timeupdate",this.handleNoSleepVideoTimeUpdate))}destroy(){if(this._wakeLock&&(this._wakeLock.release(),this._wakeLock=null),this.noSleepVideo){this.handleNoSleepVideoTimeUpdate&&this.noSleepVideo.removeEventListener("timeupdate",this.handleNoSleepVideoTimeUpdate);try{this.noSleepVideo.parentNode&&this.noSleepVideo.parentNode.removeChild(this.noSleepVideo)}catch(e){this.player.debug.warn("NoSleep","Failed to remove noSleepVideo element.")}this.noSleepVideo=null}this.handleVisibilityChange&&(document.removeEventListener("visibilitychange",this.handleVisibilityChange),document.removeEventListener("fullscreenchange",this.handleVisibilityChange))}_addSourceToVideo(e,t,i){var s=document.createElement("source");s.src=i,s.type=`video/${t}`,e.appendChild(s)}get isEnabled(){return this.enabled}enable(){const e=this.player.debug;if(Vh())return navigator.wakeLock.request("screen").then((t=>{this._wakeLock=t,this.enabled=!0,e.log("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",(()=>{e.log("wakeLock","Wake Lock released.")}))})).catch((t=>{throw this.enabled=!1,e.warn("wakeLock",`${t.name}, ${t.message}`),t}));return this.noSleepVideo.play().then((t=>(e.log("wakeLock","noSleepVideo Wake Lock active."),this.enabled=!0,t))).catch((t=>{throw e.warn("wakeLock",`noSleepVideo ${t.name}, ${t.message}`),this.enabled=!1,t}))}disable(){Vh()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):this.noSleepVideo&&this.noSleepVideo.pause(),this.enabled=!1,this.player.debug.log("wakeLock","Disabling wake lock.")}}function Wh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Jh={exports:{}};!function(e,t){var i,s,r,a,o;i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=o.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=o.normalizePath(r.path),o.buildURLFromParts(r)}var a=o.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return i.alwaysNormalize?(a.path=o.normalizePath(a.path),o.buildURLFromParts(a)):t;var n=o.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");if(!n.netLoc&&n.path&&"/"!==n.path[0]){var l=s.exec(n.path);n.netLoc=l[1],n.path=l[2]}n.netLoc&&!n.path&&(n.path="/");var d={scheme:n.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(d.netLoc=n.netLoc,"/"!==a.path[0]))if(a.path){var h=n.path,c=h.substring(0,h.lastIndexOf("/")+1)+a.path;d.path=o.normalizePath(c)}else d.path=n.path,a.params||(d.params=n.params,a.query||(d.query=n.query));return null===d.path&&(d.path=i.alwaysNormalize?o.normalizePath(a.path):a.path),o.buildURLFromParts(d)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(a,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=o}(Jh);var qh=Jh.exports;function Kh(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,s)}return i}function Yh(e){for(var t=1;t`):oc}(t)}))}const hc=lc,cc=/^(\d+)x(\d+)$/,uc=/(.+?)=(".*?"|.*?)(?:,|$)/g;class pc{constructor(e){"string"==typeof e&&(e=pc.parseAttrList(e)),Zh(this,e)}get clientAttrs(){return Object.keys(this).filter((e=>"X-"===e.substring(0,2)))}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;const i=new Uint8Array(t.length/2);for(let e=0;eNumber.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}bool(e){return"YES"===this[e]}decimalResolution(e){const t=cc.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const i={};for(uc.lastIndex=0;null!==(t=uc.exec(e));){let e=t[2];0===e.indexOf('"')&&e.lastIndexOf('"')===e.length-1&&(e=e.slice(1,-1));i[t[1].trim()]=e}return i}}function fc(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e}class mc{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const t in i)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==i[t]){hc.warn(`DATERANGE tag attribute: "${t}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=t;break}e=Zh(new pc({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const e=new Date(this.attr["END-DATE"]);ec(e.getTime())&&(this._endDate=e)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return null!==e?new Date(this._startDate.getTime()+1e3*e):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(ec(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&ec(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class gc{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var yc="audio",Ac="video",bc="audiovideo";class vc{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[yc]:null,[Ac]:null,[bc]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2);let s;s=1===i.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(i[1]),this._byteRange=[s,parseInt(i[0])+s]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=qh.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class _c extends vc{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new gc,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{const e=Object.keys(this.levelkeys);if(1===e.length)return this._decryptdata=this.levelkeys[e[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;if(!ec(this.programDateTime))return null;const e=ec(this.duration)?this.duration:0;return this.programDateTime+1e3*e}get encrypted(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){const e=Object.keys(this.levelkeys),t=e.length;if(t>1||1===t&&this.levelkeys[e[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}setElementaryStreamInfo(e,t,i,s,r,a=!1){const{elementaryStreams:o}=this,n=o[e];n?(n.startPTS=Math.min(n.startPTS,t),n.endPTS=Math.max(n.endPTS,i),n.startDTS=Math.min(n.startDTS,s),n.endDTS=Math.max(n.endDTS,r)):o[e]={startPTS:t,endPTS:i,startDTS:s,endDTS:r,partial:a}}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[yc]=null,e[Ac]=null,e[bc]=null}}class Sc extends vc{constructor(e,t,i,s,r){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new gc,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=s;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}class wc{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e)return this.advanced=!0,void(this.updated=!0);const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return!!this.fragments.length&&ec(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const e=this.driftEndTime-this.driftStartTime;if(e>0){return 1e3*(this.driftEnd-this.driftStart)/e}return 1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function Ec(e){return Uint8Array.from(atob(e),(e=>e.charCodeAt(0)))}function Tc(e){const t=e.split(":");let i=null;if("data"===t[0]&&2===t.length){const e=t[1].split(";"),s=e[e.length-1].split(",");if(2===s.length){const t="base64"===s[0],r=s[1];t?(e.splice(-1,1),i=Ec(r)):i=function(e){const t=kc(e).subarray(0,16),i=new Uint8Array(16);return i.set(t,16-t.length),i}(r)}}return i}function kc(e){return Uint8Array.from(unescape(encodeURIComponent(e)),(e=>e.charCodeAt(0)))}const Cc="undefined"!=typeof self?self:void 0;var xc={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Rc="org.w3.clearkey",Dc="com.apple.streamingkeydelivery",Lc="com.microsoft.playready",Pc="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function Bc(e){switch(e){case Dc:return xc.FAIRPLAY;case Lc:return xc.PLAYREADY;case Pc:return xc.WIDEVINE;case Rc:return xc.CLEARKEY}}var Ic="edef8ba979d64acea3c827dcd51d21ed";function Mc(e){switch(e){case xc.FAIRPLAY:return Dc;case xc.PLAYREADY:return Lc;case xc.WIDEVINE:return Pc;case xc.CLEARKEY:return Rc}}function Uc(e){const{drmSystems:t,widevineLicenseUrl:i}=e,s=t?[xc.FAIRPLAY,xc.WIDEVINE,xc.PLAYREADY,xc.CLEARKEY].filter((e=>!!t[e])):[];return!s[xc.WIDEVINE]&&i&&s.push(xc.WIDEVINE),s}const Fc=null!=Cc&&null!=(Oc=Cc.navigator)&&Oc.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var Oc;function Nc(e,t,i){return Uint8Array.prototype.slice?e.slice(t,i):new Uint8Array(Array.prototype.slice.call(e,t,i))}const jc=(e,t)=>t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128,zc=(e,t)=>t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128,Gc=(e,t)=>{const i=t;let s=0;for(;jc(e,t);){s+=10;s+=Hc(e,t+6),zc(e,t+10)&&(s+=10),t+=s}if(s>0)return e.subarray(i,i+s)},Hc=(e,t)=>{let i=0;return i=(127&e[t])<<21,i|=(127&e[t+1])<<14,i|=(127&e[t+2])<<7,i|=127&e[t+3],i},Vc=(e,t)=>jc(e,t)&&Hc(e,t+6)+10<=e.length-t,$c=e=>{const t=qc(e);for(let e=0;ee&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info,Jc=e=>{const t=String.fromCharCode(e[0],e[1],e[2],e[3]),i=Hc(e,4);return{type:t,size:i,data:e.subarray(10,10+i)}},qc=e=>{let t=0;const i=[];for(;jc(e,t);){const s=Hc(e,t+6);t+=10;const r=t+s;for(;t+8"PRIV"===e.type?Yc(e):"W"===e.type[0]?Xc(e):Qc(e),Yc=e=>{if(e.size<2)return;const t=eu(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:i.buffer}},Qc=e=>{if(e.size<2)return;if("TXXX"===e.type){let t=1;const i=eu(e.data.subarray(t),!0);t+=i.length+1;const s=eu(e.data.subarray(t));return{key:e.type,info:i,data:s}}const t=eu(e.data.subarray(1));return{key:e.type,data:t}},Xc=e=>{if("WXXX"===e.type){if(e.size<2)return;let t=1;const i=eu(e.data.subarray(t),!0);t+=i.length+1;const s=eu(e.data.subarray(t));return{key:e.type,info:i,data:s}}const t=eu(e.data);return{key:e.type,data:t}},Zc=e=>{if(8===e.data.byteLength){const t=new Uint8Array(e.data),i=1&t[3];let s=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return s/=45,i&&(s+=47721858.84),Math.round(s)}},eu=(e,t=!1)=>{const i=iu();if(i){const s=i.decode(e);if(t){const e=s.indexOf("\0");return-1!==e?s.substring(0,e):s}return s.replace(/\0/g,"")}const s=e.length;let r,a,o,n="",l=0;for(;l>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:n+=String.fromCharCode(r);break;case 12:case 13:a=e[l++],n+=String.fromCharCode((31&r)<<6|63&a);break;case 14:a=e[l++],o=e[l++],n+=String.fromCharCode((15&r)<<12|(63&a)<<6|(63&o)<<0)}}return n};let tu;function iu(){if(!navigator.userAgent.includes("PlayStation 4"))return tu||void 0===self.TextDecoder||(tu=new self.TextDecoder("utf-8")),tu}const su=function(e){let t="";for(let i=0;i>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function pu(e,t){const i=[];if(!t.length)return i;const s=e.byteLength;for(let r=0;r1?r+a:s;if(nu(e.subarray(r+4,r+8))===t[0])if(1===t.length)i.push(e.subarray(r+8,o));else{const s=pu(e.subarray(r+8,o),t.slice(1));s.length&&au.apply(i,s)}r=o}return i}function fu(e){const t=[],i=e[0];let s=8;const r=du(e,s);s+=4;let a=0,o=0;0===i?(a=du(e,s),o=du(e,s+4),s+=8):(a=hu(e,s),o=hu(e,s+8),s+=16),s+=2;let n=e.length+o;const l=lu(e,s);s+=2;for(let i=0;i>>31)return hc.warn("SIDX has hierarchical references (not supported)"),null;const l=du(e,i);i+=4,t.push({referenceSize:o,subsegmentDuration:l,info:{duration:l/r,start:n,end:n+o-1}}),n+=o,i+=4,s=i}return{earliestPresentationTime:a,timescale:r,version:i,referencesCount:l,references:t}}function mu(e){const t=[],i=pu(e,["moov","trak"]);for(let e=0;e{const i=du(e,4),s=t[i];s&&(s.default={duration:du(e,12),flags:du(e,20)})})),t}function gu(e){const t=e.subarray(8),i=t.subarray(86),s=nu(t.subarray(4,8));let r=s;const a="enca"===s||"encv"===s;if(a){const e=pu(t,[s])[0];pu(e.subarray("enca"===s?28:78),["sinf"]).forEach((e=>{const t=pu(e,["schm"])[0];if(t){const i=nu(t.subarray(4,8));if("cbcs"===i||"cenc"===i){const t=pu(e,["frma"])[0];t&&(r=nu(t))}}}))}switch(r){case"avc1":case"avc2":case"avc3":case"avc4":{const e=pu(i,["avcC"])[0];r+="."+Au(e[1])+Au(e[2])+Au(e[3]);break}case"mp4a":{const e=pu(t,[s])[0],i=pu(e.subarray(28),["esds"])[0];if(i&&i.length>12){let e=4;if(3!==i[e++])break;e=yu(i,e),e+=2;const t=i[e++];if(128&t&&(e+=2),64&t&&(e+=i[e++]),4!==i[e++])break;e=yu(i,e);const s=i[e++];if(64!==s)break;if(r+="."+Au(s),e+=12,5!==i[e++])break;e=yu(i,e);const a=i[e++];let o=(248&a)>>3;31===o&&(o+=1+((7&a)<<3)+((224&i[e])>>5)),r+="."+o}break}case"hvc1":case"hev1":{const e=pu(i,["hvcC"])[0],t=e[1],s=["","A","B","C"][t>>6],a=31&t,o=du(e,2),n=(32&t)>>5?"H":"L",l=e[12],d=e.subarray(6,12);r+="."+s+a,r+="."+o.toString(16).toUpperCase(),r+="."+n+l;let h="";for(let e=d.length;e--;){const t=d[e];if(t||h){h="."+t.toString(16).toUpperCase()+h}}r+=h;break}case"dvh1":case"dvhe":{const e=pu(i,["dvcC"])[0],t=e[2]>>1&127,s=e[2]<<5&32|e[3]>>3&31;r+="."+bu(t)+"."+bu(s);break}case"vp09":{const e=pu(i,["vpcC"])[0],t=e[4],s=e[5],a=e[6]>>4&15;r+="."+bu(t)+"."+bu(s)+"."+bu(a);break}case"av01":{const e=pu(i,["av1C"])[0],t=e[1]>>>5,s=31&e[1],a=e[2]>>>7?"H":"M",o=(64&e[2])>>6,n=(32&e[2])>>5,l=2===t&&o?n?12:10:o?10:8,d=(16&e[2])>>4,h=(8&e[2])>>3,c=(4&e[2])>>2,u=3&e[2],p=1,f=1,m=1,g=0;r+="."+t+"."+bu(s)+a+"."+bu(l)+"."+d+"."+h+c+u+"."+bu(p)+"."+bu(f)+"."+bu(m)+"."+g;break}}return{codec:r,encrypted:a}}function yu(e,t){const i=t+5;for(;128&e[t++]&&t{const l=n.byteOffset-8;pu(n,["traf"]).map((n=>{const d=pu(n,["tfdt"]).map((e=>{const t=e[0];let i=du(e,4);return 1===t&&(i*=Math.pow(2,32),i+=du(e,8)),i/r}))[0];return void 0!==d&&(e=d),pu(n,["tfhd"]).map((d=>{const h=du(d,4),c=16777215&du(d,0);let u=0;const p=0!=(16&c);let f=0;const m=0!=(32&c);let g=8;h===a&&(0!=(1&c)&&(g+=8),0!=(2&c)&&(g+=4),0!=(8&c)&&(u=du(d,g),g+=4),p&&(f=du(d,g),g+=4),m&&(g+=4),"video"===t.type&&(o=function(e){if(!e)return!1;const t=e.indexOf("."),i=t<0?e:e.substring(0,t);return"hvc1"===i||"hev1"===i||"dvh1"===i||"dvhe"===i}(t.codec)),pu(n,["trun"]).map((a=>{const n=a[0],d=16777215&du(a,0),h=0!=(1&d);let c=0;const p=0!=(4&d),m=0!=(256&d);let g=0;const y=0!=(512&d);let A=0;const b=0!=(1024&d),v=0!=(2048&d);let _=0;const S=du(a,4);let w=8;h&&(c=du(a,w),w+=4),p&&(w+=4);let E=c+l;for(let l=0;l>1&63;return 39===e||40===e}return 6===(31&t)}function Tu(e,t,i,s){const r=ku(e);let a=0;a+=t;let o=0,n=0,l=0;for(;a=r.length)break;l=r[a++],o+=l}while(255===l);n=0;do{if(a>=r.length)break;l=r[a++],n+=l}while(255===l);const e=r.length-a;let t=a;if(ne){hc.error(`Malformed SEI payload. ${n} is too small, only ${e} bytes left to parse.`);break}if(4===o){if(181===r[t++]){const e=lu(r,t);if(t+=2,49===e){const e=du(r,t);if(t+=4,1195456820===e){const e=r[t++];if(3===e){const a=r[t++],n=31&a,l=64&a,d=l?2+3*n:0,h=new Uint8Array(d);if(l){h[0]=a;for(let e=1;e16){const e=[];for(let i=0;i<16;i++){const s=r[t++].toString(16);e.push(1==s.length?"0"+s:s),3!==i&&5!==i&&7!==i&&9!==i||e.push("-")}const a=n-16,l=new Uint8Array(a);for(let e=0;e0?(a=new Uint8Array(4),t.length>0&&new DataView(a.buffer).setUint32(0,t.length,!1)):a=new Uint8Array;const o=new Uint8Array(4);return i&&i.byteLength>0&&new DataView(o.buffer).setUint32(0,i.byteLength,!1),function(e,...t){const i=t.length;let s=8,r=i;for(;r--;)s+=t[r].byteLength;const a=new Uint8Array(s);for(a[0]=s>>24&255,a[1]=s>>16&255,a[2]=s>>8&255,a[3]=255&s,a.set(e,4),r=0,s=8;r>8*(15-i)&255;return t}(e);return new Ru(this.method,this.uri,"identity",this.keyFormatVersions,t)}const t=Tc(this.uri);if(t)switch(this.keyFormat){case Pc:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Lc:{const e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Cu(e,null,t);const i=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),s=String.fromCharCode.apply(null,Array.from(i)),r=s.substring(s.indexOf("<"),s.length),a=(new DOMParser).parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(a){const e=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(e){const t=Ec(e).subarray(0,16);!function(e){const t=function(e,t,i){const s=e[t];e[t]=e[i],e[i]=s};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}(t),this.keyId=t}}break}default:{let e=t.subarray(0,16);if(16!==e.length){const t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e;break}}if(!this.keyId||16!==this.keyId.byteLength){let e=xu[this.uri];if(!e){const t=Object.keys(xu).length%Number.MAX_SAFE_INTEGER;e=new Uint8Array(16);new DataView(e.buffer,12,4).setUint32(0,t),xu[this.uri]=e}this.keyId=e}return this}}const Du=/\{\$([a-zA-Z0-9-_]+)\}/g;function Lu(e){return Du.test(e)}function Pu(e,t,i){if(null!==e.variableList||e.hasVariableRefs)for(let s=i.length;s--;){const r=i[s],a=t[r];a&&(t[r]=Bu(e,a))}}function Bu(e,t){if(null!==e.variableList||e.hasVariableRefs){const i=e.variableList;return t.replace(Du,(t=>{const s=t.substring(2,t.length-1),r=null==i?void 0:i[s];return void 0===r?(e.playlistParsingError||(e.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${s}"`)),t):r}))}return t}function Iu(e,t,i){let s,r,a=e.variableList;if(a||(e.variableList=a={}),"QUERYPARAM"in t){s=t.QUERYPARAM;try{const e=new self.URL(i).searchParams;if(!e.has(s))throw new Error(`"${s}" does not match any query parameter in URI: "${i}"`);r=e.get(s)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${t.message}`))}}else s=t.NAME,r=t.VALUE;s in a?e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):a[s]=r||""}function Mu(e,t,i){const s=t.IMPORT;if(i&&s in i){let t=e.variableList;t||(e.variableList=t={}),t[s]=i[s]}else e.playlistParsingError||(e.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}function Uu(e=!0){if("undefined"==typeof self)return;return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}const Fu={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Ou(e,t,i=!0){return!e.split(",").some((e=>!Nu(e,t,i)))}function Nu(e,t,i=!0){var s;const r=Uu(i);return null!=(s=null==r?void 0:r.isTypeSupported(ju(e,t)))&&s}function ju(e,t){return`${t}/mp4;codecs="${e}"`}function zu(e){if(e){const t=e.substring(0,4);return Fu.video[t]}return 2}function Gu(e){return e.split(",").reduce(((e,t)=>{const i=Fu.video[t];return i?(2*i+e)/(e?3:2):(Fu.audio[t]+e)/(e?2:1)}),0)}const Hu={};const Vu=/flac|opus/i;function $u(e,t=!0){return e.replace(Vu,(e=>function(e,t=!0){if(Hu[e])return Hu[e];const i={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[e];for(let s=0;s0&&s.length({id:e.attrs.AUDIO,audioCodec:e.audioCodec}))),SUBTITLES:a.map((e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec}))),"CLOSED-CAPTIONS":[]};let n=0;for(qu.lastIndex=0;null!==(s=qu.exec(e));){const e=new pc(s[1]),a=e.TYPE;if(a){const s=o[a],l=r[a]||[];r[a]=l,Pu(i,e,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const d=e.LANGUAGE,h=e["ASSOC-LANGUAGE"],c=e.CHANNELS,u=e.CHARACTERISTICS,p=e["INSTREAM-ID"],f={attrs:e,bitrate:0,id:n++,groupId:e["GROUP-ID"]||"",name:e.NAME||d||"",type:a,default:e.bool("DEFAULT"),autoselect:e.bool("AUTOSELECT"),forced:e.bool("FORCED"),lang:d,url:e.URI?Xu.resolve(e.URI,t):""};if(h&&(f.assocLang=h),c&&(f.channels=c),u&&(f.characteristics=u),p&&(f.instreamId=p),null!=s&&s.length){const e=Xu.findGroup(s,f.groupId)||s[0];ip(f,e,"audioCodec"),ip(f,e,"textCodec")}l.push(f)}}return r}static parseLevelPlaylist(e,t,i,s,r,a){const o=new wc(t),n=o.fragments;let l,d,h,c=null,u=0,p=0,f=0,m=0,g=null,y=new _c(s,t),A=-1,b=!1,v=null;for(Yu.lastIndex=0,o.m3u8=e,o.hasVariableRefs=Lu(e);null!==(l=Yu.exec(e));){b&&(b=!1,y=new _c(s,t),y.start=f,y.sn=u,y.cc=m,y.level=i,c&&(y.initSegment=c,y.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null,v&&(y.setByteRange(v),v=null)));const e=l[1];if(e){y.duration=parseFloat(e);const t=(" "+l[2]).slice(1);y.title=t||null,y.tagList.push(t?["INF",e,t]:["INF",e])}else if(l[3]){if(ec(y.duration)){y.start=f,h&&ap(y,h,o),y.sn=u,y.level=i,y.cc=m,n.push(y);const e=(" "+l[3]).slice(1);y.relurl=Bu(o,e),sp(y,g),g=y,f+=y.duration,u++,p=0,b=!0}}else if(l[4]){const e=(" "+l[4]).slice(1);g?y.setByteRange(e,g):y.setByteRange(e)}else if(l[5])y.rawProgramDateTime=(" "+l[5]).slice(1),y.tagList.push(["PROGRAM-DATE-TIME",y.rawProgramDateTime]),-1===A&&(A=n.length);else{if(l=l[0].match(Qu),!l){hc.warn("No matches on slow regex match for level playlist!");continue}for(d=1;d0&&e.bool("CAN-SKIP-DATERANGES"),o.partHoldBack=e.optionalFloat("PART-HOLD-BACK",0),o.holdBack=e.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const e=new pc(r);o.partTarget=e.decimalFloatingPoint("PART-TARGET");break}case"PART":{let e=o.partList;e||(e=o.partList=[]);const i=p>0?e[e.length-1]:void 0,s=p++,a=new pc(r);Pu(o,a,["BYTERANGE","URI"]);const n=new Sc(a,y,t,s,i);e.push(n),y.duration+=n.duration;break}case"PRELOAD-HINT":{const e=new pc(r);Pu(o,e,["URI"]),o.preloadHint=e;break}case"RENDITION-REPORT":{const e=new pc(r);Pu(o,e,["URI"]),o.renditionReports=o.renditionReports||[],o.renditionReports.push(e);break}default:hc.warn(`line parsed but not handled: ${l}`)}}}g&&!g.relurl?(n.pop(),f-=g.duration,o.partList&&(o.fragmentHint=g)):o.partList&&(sp(y,g),y.cc=m,o.fragmentHint=y,h&&ap(y,h,o));const _=n.length,S=n[0],w=n[_-1];if(f+=o.skippedSegments*o.targetduration,f>0&&_&&w){o.averagetargetduration=f/_;const e=w.sn;o.endSN="initSegment"!==e?e:0,o.live||(w.endList=!0),S&&(o.startCC=S.cc)}else o.endSN=0,o.startCC=0;return o.fragmentHint&&(f+=o.fragmentHint.duration),o.totalduration=f,o.endCC=m,A>0&&function(e,t){let i=e[t];for(let s=t;s--;){const t=e[s];if(!t)return;t.programDateTime=i.programDateTime-1e3*t.duration,i=t}}(n,A),o}}function Zu(e,t,i){var s,r;const a=new pc(e);Pu(i,a,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const o=null!=(s=a.METHOD)?s:"",n=a.URI,l=a.hexadecimalInteger("IV"),d=a.KEYFORMATVERSIONS,h=null!=(r=a.KEYFORMAT)?r:"identity";n&&a.IV&&!l&&hc.error(`Invalid IV: ${a.IV}`);const c=n?Xu.resolve(n,t):"",u=(d||"1").split("/").map(Number).filter(Number.isFinite);return new Ru(o,c,h,u,l)}function ep(e){const t=new pc(e).decimalFloatingPoint("TIME-OFFSET");return ec(t)?t:null}function tp(e,t){let i=(e||"").split(/[ ,]+/).filter((e=>e));["video","audio","text"].forEach((e=>{const s=i.filter((t=>function(e,t){const i=Fu[t];return!!i&&!!i[e.slice(0,4)]}(t,e)));s.length&&(t[`${e}Codec`]=s.join(","),i=i.filter((e=>-1===s.indexOf(e))))})),t.unknownCodecs=i}function ip(e,t,i){const s=t[i];s&&(e[i]=s)}function sp(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),ec(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function rp(e,t,i,s){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=i,e.sn="initSegment",s&&(e.levelkeys=s),e.initSegment=null}function ap(e,t,i){e.levelkeys=t;const{encryptedFragments:s}=i;s.length&&s[s.length-1].levelkeys===t||!Object.keys(t).some((e=>t[e].isCommonEncryption))||s.push(e)}var op="manifest",np="level",lp="audioTrack",dp="subtitleTrack",hp="main",cp="audio",up="subtitle";function pp(e){const{type:t}=e;switch(t){case lp:return cp;case dp:return up;default:return hp}}function fp(e,t){let i=e.url;return void 0!==i&&0!==i.indexOf("data:")||(i=t.url),i}class mp{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.LEVEL_LOADING,this.onLevelLoading,this),e.on(sc.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(sc.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.LEVEL_LOADING,this.onLevelLoading,this),e.off(sc.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(sc.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,i=t.pLoader,s=t.loader,r=new(i||s)(t);return this.loaders[e.type]=r,r}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:op,url:i,deliveryDirectives:null})}onLevelLoading(e,t){const{id:i,level:s,pathwayId:r,url:a,deliveryDirectives:o}=t;this.load({id:i,level:s,pathwayId:r,responseType:"text",type:np,url:a,deliveryDirectives:o})}onAudioTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:a}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:lp,url:r,deliveryDirectives:a})}onSubtitleTrackLoading(e,t){const{id:i,groupId:s,url:r,deliveryDirectives:a}=t;this.load({id:i,groupId:s,level:null,responseType:"text",type:dp,url:r,deliveryDirectives:a})}load(e){var t;const i=this.hls.config;let s,r=this.getInternalLoader(e);if(r){const t=r.context;if(t&&t.url===e.url&&t.level===e.level)return void hc.trace("[playlist-loader]: playlist request ongoing");hc.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),r.abort()}if(s=e.type===op?i.manifestLoadPolicy.default:Zh({},i.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),ec(null==(t=e.deliveryDirectives)?void 0:t.part)){let t;if(e.type===np&&null!==e.level?t=this.hls.levels[e.level].details:e.type===lp&&null!==e.id?t=this.hls.audioTracks[e.id].details:e.type===dp&&null!==e.id&&(t=this.hls.subtitleTracks[e.id].details),t){const e=t.partTarget,i=t.targetduration;if(e&&i){const t=1e3*Math.max(3*e,.8*i);s=Zh({},s,{maxTimeToFirstByteMs:Math.min(t,s.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,s.maxTimeToFirstByteMs)})}}}const a=s.errorRetry||s.timeoutRetry||{},o={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},n={onSuccess:(e,t,i,s)=>{const r=this.getInternalLoader(i);this.resetInternalLoader(i.type);const a=e.data;0===a.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),Xu.isMediaPlaylist(a)?this.handleTrackOrLevelPlaylist(e,t,i,s||null,r):this.handleMasterPlaylist(e,t,i,s)):this.handleManifestParsingError(e,i,new Error("no EXTM3U delimiter"),s||null,t)},onError:(e,t,i,s)=>{this.handleNetworkError(t,i,!1,e,s)},onTimeout:(e,t,i)=>{this.handleNetworkError(t,i,!0,void 0,e)}};r.load(e,o,n)}handleMasterPlaylist(e,t,i,s){const r=this.hls,a=e.data,o=fp(e,i),n=Xu.parseMasterPlaylist(a,o);if(n.playlistParsingError)return void this.handleManifestParsingError(e,i,n.playlistParsingError,s,t);const{contentSteering:l,levels:d,sessionData:h,sessionKeys:c,startTimeOffset:u,variableList:p}=n;this.variableList=p;const{AUDIO:f=[],SUBTITLES:m,"CLOSED-CAPTIONS":g}=Xu.parseMasterPlaylistMedia(a,o,n);if(f.length){f.some((e=>!e.url))||!d[0].audioCodec||d[0].attrs.AUDIO||(hc.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),f.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new pc({}),bitrate:0,url:""}))}r.trigger(sc.MANIFEST_LOADED,{levels:d,audioTracks:f,subtitles:m,captions:g,contentSteering:l,url:o,stats:t,networkDetails:s,sessionData:h,sessionKeys:c,startTimeOffset:u,variableList:p})}handleTrackOrLevelPlaylist(e,t,i,s,r){const a=this.hls,{id:o,level:n,type:l}=i,d=fp(e,i),h=ec(n)?n:ec(o)?o:0,c=pp(i),u=Xu.parseLevelPlaylist(e.data,d,h,c,0,this.variableList);if(l===op){const e={attrs:new pc({}),bitrate:0,details:u,name:"",url:d};a.trigger(sc.MANIFEST_LOADED,{levels:[e],audioTracks:[],url:d,stats:t,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=u,this.handlePlaylistLoaded(u,e,t,i,s,r)}handleManifestParsingError(e,t,i,s,r){this.hls.trigger(sc.ERROR,{type:rc.NETWORK_ERROR,details:ac.MANIFEST_PARSING_ERROR,fatal:t.type===op,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:s,stats:r})}handleNetworkError(e,t,i=!1,s,r){let a=`A network ${i?"timeout":"error"+(s?" (status "+s.code+")":"")} occurred while loading ${e.type}`;e.type===np?a+=`: ${e.level} id: ${e.id}`:e.type!==lp&&e.type!==dp||(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);hc.warn(`[playlist-loader]: ${a}`);let n=ac.UNKNOWN,l=!1;const d=this.getInternalLoader(e);switch(e.type){case op:n=i?ac.MANIFEST_LOAD_TIMEOUT:ac.MANIFEST_LOAD_ERROR,l=!0;break;case np:n=i?ac.LEVEL_LOAD_TIMEOUT:ac.LEVEL_LOAD_ERROR,l=!1;break;case lp:n=i?ac.AUDIO_TRACK_LOAD_TIMEOUT:ac.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case dp:n=i?ac.SUBTITLE_TRACK_LOAD_TIMEOUT:ac.SUBTITLE_LOAD_ERROR,l=!1}d&&this.resetInternalLoader(e.type);const h={type:rc.NETWORK_ERROR,details:n,fatal:l,url:e.url,loader:d,context:e,error:o,networkDetails:t,stats:r};if(s){const i=(null==t?void 0:t.url)||e.url;h.response=Yh({url:i,data:void 0},s)}this.hls.trigger(sc.ERROR,h)}handlePlaylistLoaded(e,t,i,s,r,a){const o=this.hls,{type:n,level:l,id:d,groupId:h,deliveryDirectives:c}=s,u=fp(t,s),p=pp(s),f="number"==typeof s.level&&p===hp?l:void 0;if(!e.fragments.length){const e=new Error("No Segments found in Playlist");return void o.trigger(sc.ERROR,{type:rc.NETWORK_ERROR,details:ac.LEVEL_EMPTY_ERROR,fatal:!1,url:u,error:e,reason:e.message,response:t,context:s,level:f,parent:p,networkDetails:r,stats:i})}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const m=e.playlistParsingError;if(m)o.trigger(sc.ERROR,{type:rc.NETWORK_ERROR,details:ac.LEVEL_PARSING_ERROR,fatal:!1,url:u,error:m,reason:m.message,response:t,context:s,level:f,parent:p,networkDetails:r,stats:i});else switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),a.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),n){case op:case np:o.trigger(sc.LEVEL_LOADED,{details:e,level:f||0,id:d||0,stats:i,networkDetails:r,deliveryDirectives:c});break;case lp:o.trigger(sc.AUDIO_TRACK_LOADED,{details:e,id:d||0,groupId:h||"",stats:i,networkDetails:r,deliveryDirectives:c});break;case dp:o.trigger(sc.SUBTITLE_TRACK_LOADED,{details:e,id:d||0,groupId:h||"",stats:i,networkDetails:r,deliveryDirectives:c})}}}function gp(e,t){let i;try{i=new Event("addtrack")}catch(e){i=document.createEvent("Event"),i.initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function yp(e,t){const i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error(`addCue is failed for: ${t}`)}catch(i){hc.debug(`[texttrack-utils]: ${i}`);try{const i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(e){hc.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${e}`)}}"disabled"===i&&(e.mode=i)}function Ap(e){const t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(let t=e.cues.length;t--;)e.removeCue(e.cues[t]);"disabled"===t&&(e.mode=t)}function bp(e,t,i,s){const r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&e.cues.length>0){const r=function(e,t,i){const s=[],r=function(e,t){if(te[i].endTime)return-1;let s=0,r=i;for(;s<=r;){const a=Math.floor((r+s)/2);if(te[a].startTime&&s-1)for(let a=r,o=e.length;a=t&&r.endTime<=i)s.push(r);else if(r.startTime>i)return s}return s}(e.cues,t,i);for(let t=0;t{const e=Ep();try{e&&new e(0,Number.POSITIVE_INFINITY,"")}catch(e){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Cp(e,t){return e.getTime()/1e3-t}class xp{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(sc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(sc.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(sc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(sc.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(Ap(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;tkp&&(s=kp);s-i<=0&&(s=i+.25);for(let e=0;ee.type===_p&&n:"video"===s?e=>e.type===wp&&o:e=>e.type===_p&&n||e.type===wp&&o,bp(r,t,i,e)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:i,id3Track:s}=this,{dateRanges:r}=t,a=Object.keys(r);if(s){const e=Object.keys(i).filter((e=>!a.includes(e)));for(let t=e.length;t--;){const r=e[t];Object.keys(i[r].cues).forEach((e=>{s.removeCue(i[r].cues[e])})),delete i[r]}}const o=t.fragments[t.fragments.length-1];if(0===a.length||!ec(null==o?void 0:o.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const n=o.programDateTime/1e3-o.start,l=Ep();for(let e=0;e{if(t!==s.id){const i=r[t];if(i.class===s.class&&i.startDate>s.startDate&&(!e||s.startDatethis.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(null===e)return null;const{holdBack:t,partHoldBack:i,targetduration:s}=e,{liveSyncDuration:r,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,n=this.hls.userConfig;let l=o&&i||t;(n.liveSyncDuration||n.liveSyncDurationCount||0===l)&&(l=void 0!==r?r:a*s);const d=s;return l+Math.min(1*this.stallCount,d)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,i=this.levelDetails;if(null===e||null===t||null===i)return null;const s=i.edge,r=e-t-this.edgeStalled,a=s-i.totalduration,o=s-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(a,r),o)}get drift(){const{levelDetails:e}=this;return null===e?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(null===e)return 0;const t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(sc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(sc.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(sc.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(sc.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(sc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(sc.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(sc.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(sc.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var i;t.details===ac.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(i=this.levelDetails)&&i.live&&hc.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const i=this.computeLatency();if(null===i)return;this._latency=i;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:r}=this.config;if(!s||1===r||!t.live)return;const a=this.targetLatency;if(null===a)return;const o=i-a;if(o.05&&this.forwardBufferLength>1){const t=Math.min(2,Math.max(1,r)),i=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;e.playbackRate=Math.min(t,Math.max(1,i))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return null===e?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}}const Dp=["NONE","TYPE-0","TYPE-1",null];const Lp=["SDR","PQ","HLG"];var Pp="",Bp="YES",Ip="v2";class Mp{constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}addDirectives(e){const t=new self.URL(e);return void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class Up{constructor(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter((e=>!!e)).map((e=>e.substring(0,4))).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return Fp(this._audioGroups,e)}hasSubtitleGroup(e){return Fp(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t)if("audio"===e){let e=this._audioGroups;e||(e=this._audioGroups=[]),-1===e.indexOf(t)&&e.push(t)}else if("text"===e){let e=this._subtitleGroups;e||(e=this._subtitleGroups=[]),-1===e.indexOf(t)&&e.push(t)}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return null==(e=this.audioGroups)?void 0:e[0]}get textGroupId(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}addFallback(){}}function Fp(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}function Op(e,t){const i=t.startPTS;if(ec(i)){let s,r=0;t.sn>e.sn?(r=i-e.start,s=e):(r=e.start-i,s=t),s.duration!==r&&(s.duration=r)}else if(t.sn>e.sn){e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration}else t.start=Math.max(e.start-t.duration,0)}function Np(e,t,i,s,r,a){s-i<=0&&(hc.warn("Fragment should have a positive duration",t),s=i+t.duration,a=r+t.duration);let o=i,n=s;const l=t.startPTS,d=t.endPTS;if(ec(l)){const e=Math.abs(l-i);ec(t.deltaPTS)?t.deltaPTS=Math.max(e,t.deltaPTS):t.deltaPTS=e,o=Math.max(i,l),i=Math.min(i,l),r=Math.min(r,t.startDTS),n=Math.min(s,d),s=Math.max(s,d),a=Math.max(a,t.endDTS)}const h=i-t.start;0!==t.start&&(t.start=i),t.duration=s-t.start,t.startPTS=i,t.maxStartPTS=o,t.startDTS=r,t.endPTS=s,t.minEndPTS=n,t.endDTS=a;const c=t.sn;if(!e||ce.endSN)return 0;let u;const p=c-e.startSN,f=e.fragments;for(f[p]=t,u=p;u>0;u--)Op(f[u],f[u-1]);for(u=p;u=0;e--){const t=s[e].initSegment;if(t){i=t;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;let r,a=0;if(function(e,t,i){const s=t.skippedSegments,r=Math.max(e.startSN,t.startSN)-t.startSN,a=(e.fragmentHint?1:0)+(s?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,o=t.startSN-e.startSN,n=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments;for(let e=r;e<=a;e++){const r=l[o+e];let a=n[e];s&&!a&&e{e.relurl&&(a=e.cc-s.cc),ec(e.startPTS)&&ec(e.endPTS)&&(s.start=s.startPTS=e.startPTS,s.startDTS=e.startDTS,s.maxStartPTS=e.maxStartPTS,s.endPTS=e.endPTS,s.endDTS=e.endDTS,s.minEndPTS=e.minEndPTS,s.duration=e.endPTS-e.startPTS,s.duration&&(r=s),t.PTSKnown=t.alignedSliding=!0),s.elementaryStreams=e.elementaryStreams,s.loader=e.loader,s.stats=e.stats,e.initSegment&&(s.initSegment=e.initSegment,i=e.initSegment)})),i){(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach((e=>{var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=i)?void 0:t.relurl)||(e.initSegment=i)}))}if(t.skippedSegments)if(t.deltaUpdateFailed=t.fragments.some((e=>!e)),t.deltaUpdateFailed){hc.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let e=t.skippedSegments;e--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}else t.canSkipDateRanges&&(t.dateRanges=function(e,t,i){const s=Zh({},e);i&&i.forEach((e=>{delete s[e]}));return Object.keys(t).forEach((e=>{const i=new mc(t[e].attr,s[e]);i.isValid?s[e]=i:hc.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(t[e].attr)}"`)})),s}(e.dateRanges,t.dateRanges,t.recentlyRemovedDateranges));const o=t.fragments;if(a){hc.warn("discontinuity sliding from playlist, take drift into account");for(let e=0;e{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats})),r?Np(t,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS):zp(e,t),o.length&&(t.totalduration=t.edge-o[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;const n=t.advancedDateTime;if(t.advanced&&n){const e=t.edge;t.driftStart||(t.driftStartTime=n,t.driftStart=e),t.driftEndTime=n,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime}function zp(e,t){const i=t.startSN+t.skippedSegments-e.startSN,s=e.fragments;i<0||i>=s.length||Gp(t,s[i].start)}function Gp(e,t){if(t){const i=e.fragments;for(let s=e.skippedSegments;s{const{details:i}=e;null!=i&&i.fragments&&i.fragments.forEach((e=>{e.level=t}))}))}function Wp(e){switch(e.details){case ac.FRAG_LOAD_TIMEOUT:case ac.KEY_LOAD_TIMEOUT:case ac.LEVEL_LOAD_TIMEOUT:case ac.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function Jp(e,t){const i=Wp(t);return e.default[(i?"timeout":"error")+"Retry"]}function qp(e,t){const i="linear"===e.backoff?1:Math.pow(2,t);return Math.min(i*e.retryDelayMs,e.maxRetryDelayMs)}function Kp(e){return Yh(Yh({},e),{errorRetry:null,timeoutRetry:null})}function Yp(e,t,i,s){if(!e)return!1;const r=null==s?void 0:s.code,a=t499)}(r)||!!i);return e.shouldRetry?e.shouldRetry(e,t,i,s,a):a}const Qp=function(e,t){let i=0,s=e.length-1,r=null,a=null;for(;i<=s;){r=(i+s)/2|0,a=e[r];const o=t(a);if(o>0)i=r+1;else{if(!(o<0))return a;s=r-1}}return null};function Xp(e,t,i=0,s=0){let r=null;if(e){r=t[e.sn-t[0].sn+1]||null;const s=e.endDTS-i;s>0&&s<15e-7&&(i+=15e-7)}else 0===i&&0===t[0].start&&(r=t[0]);if(r&&(!e||e.level===r.level)&&0===Zp(i,s,r))return r;const a=Qp(t,Zp.bind(null,i,s));return!a||a===e&&r?r:a}function Zp(e=0,t=0,i){if(i.start<=e&&i.start+i.duration>e)return 0;const s=Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return i.start+i.duration-s<=e?1:i.start-s>e&&i.start?-1:0}function ef(e,t,i){const s=1e3*Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-s>e}var tf=0,sf=2,rf=3,af=5,of=0,nf=1,lf=2;class df{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=hc.log.bind(hc,`${t}:`),this.warn=hc.warn.bind(hc,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t){const i=null==t?void 0:t.renditionReports;if(i){let s=-1;for(let r=0;r=0&&e>t.partTarget&&(a+=1)}return new Mp(r,a>=0?a:void 0,Pp)}}}loadPlaylist(e){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,i){const{details:s,stats:r}=t,a=self.performance.now(),o=r.loading.first?Math.max(0,a-r.loading.first):0;if(s.advancedDateTime=Date.now()-o,s.live||null!=i&&i.live){if(s.reloaded(i),i&&this.log(`live playlist ${e} ${s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:s.updated?"UPDATED":"MISSED"}`),i&&s.fragments.length>0&&jp(i,s),!this.canLoad||!s.live)return;let o,n,l;if(s.canBlockReload&&s.endSN&&s.advanced){const e=this.hls.config.lowLatencyMode,r=s.lastPartSn,a=s.endSN,d=s.lastPartIndex,h=r===a,c=e?0:d;-1!==d?(n=h?a+1:r,l=h?c:d+1):n=a+1;const u=s.age,p=u+s.ageHeader;let f=Math.min(p-s.partTarget,1.5*s.targetduration);if(f>0){if(i&&f>i.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${i.tuneInGoal} to: ${f} with playlist age: ${s.age}`),f=0;else{const e=Math.floor(f/s.targetduration);if(n+=e,void 0!==l){l+=Math.round(f%s.targetduration/s.partTarget)}this.log(`CDN Tune-in age: ${s.ageHeader}s last advanced ${u.toFixed(2)}s goal: ${f} skip sn ${e} to part ${l}`)}s.tuneInGoal=f}if(o=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l),e||!h)return void this.loadPlaylist(o)}else(s.canBlockReload||s.canSkipUntil)&&(o=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l));const d=this.hls.mainForwardBufferInfo,h=d?d.end-d.len:0,c=function(e,t=1/0){let i=1e3*e.targetduration;if(e.updated){const s=e.fragments,r=4;if(s.length&&i*r>t){const e=1e3*s[s.length-1].duration;ethis.requestScheduled+c&&(this.requestScheduled=r.loading.start),void 0!==n&&s.canBlockReload?this.requestScheduled=r.loading.first+c-(1e3*s.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+cthis.loadPlaylist(o)),u)}else this.clearTimer()}getDeliveryDirectives(e,t,i,s){let r=function(e,t){const{canSkipUntil:i,canSkipDateRanges:s,endSN:r}=e;return i&&(void 0!==t?t-r:0)=o.maxNumRetry)return!1;if(i&&null!=(l=e.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const e=qp(o,a);this.timer=self.setTimeout((()=>this.loadPlaylist()),e),this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" in ${e}ms`)}e.levelRetry=!0,s.resolved=!0}return n}}class hf{constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}sample(e,t){const i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class cf{constructor(e,t,i,s=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new hf(e),this.fast_=new hf(t),this.defaultTTFB_=s,this.ttfb_=new hf(e)}update(e,t){const{slow_:i,fast_:s,ttfb_:r}=this;i.halfLife!==e&&(this.slow_=new hf(e,i.getEstimate(),i.getTotalWeight())),s.halfLife!==t&&(this.fast_=new hf(t,s.getEstimate(),s.getTotalWeight())),r.halfLife!==e&&(this.ttfb_=new hf(e,r.getEstimate(),r.getTotalWeight()))}sample(e,t){const i=(e=Math.max(e,this.minDelayMs_))/1e3,s=8*t/i;this.fast_.sample(i,s),this.slow_.sample(i,s)}sampleTTFB(e){const t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const uf={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},pf={};function ff(e,t,i,s,r,a){const o=e.audioCodec?e.audioGroups:null,n=null==a?void 0:a.audioCodec,l=null==a?void 0:a.channels,d=l?parseInt(l):n?1/0:2;let h=null;if(null!=o&&o.length)try{h=1===o.length&&o[0]?t.groups[o[0]].channels:o.reduce(((e,i)=>{if(i){const s=t.groups[i];if(!s)throw new Error(`Audio track group ${i} not found`);Object.keys(s.channels).forEach((t=>{e[t]=(e[t]||0)+s.channels[t]}))}return e}),{2:0})}catch(e){return!0}return void 0!==e.videoCodec&&(e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(s,30)||"SDR"!==e.videoRange&&e.videoRange!==i||e.bitrate>Math.max(r,8e6))||!!h&&ec(d)&&Object.keys(h).some((e=>parseInt(e)>d))}function mf(e,t,i){const s=e.videoCodec,r=e.audioCodec;if(!s||!r||!i)return Promise.resolve(uf);const a={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},o=e.videoRange;"SDR"!==o&&(a.transferFunction=o.toLowerCase());const n=s.split(",").map((e=>({type:"media-source",video:Yh(Yh({},a),{},{contentType:ju(e,"video")})})));return r&&e.audioGroups&&e.audioGroups.forEach((e=>{var i;e&&(null==(i=t.groups[e])||i.tracks.forEach((t=>{if(t.groupId===e){const e=t.channels||"",i=parseFloat(e);ec(i)&&i>2&&n.push.apply(n,r.split(",").map((e=>({type:"media-source",audio:{contentType:ju(e,"audio"),channels:""+i}}))))}})))})),Promise.all(n.map((e=>{const t=function(e){const{audio:t,video:i}=e,s=i||t;if(s){const e=s.contentType.split('"')[1];if(i)return`r${i.height}x${i.width}f${Math.ceil(i.framerate)}${i.transferFunction||"sd"}_${e}_${Math.ceil(i.bitrate/1e5)}`;if(t)return`c${t.channels}${t.spatialRendering?"s":"n"}_${e}`}return""}(e);return pf[t]||(pf[t]=i.decodingInfo(e))}))).then((e=>({supported:!e.some((e=>!e.supported)),configurations:n,decodingInfoResults:e}))).catch((e=>({supported:!1,configurations:n,decodingInfoResults:[],error:e})))}function gf(e,t){let i=!1,s=[];return e&&(i="SDR"!==e,s=[e]),t&&(s=t.allowedVideoRanges||Lp.slice(0),i=void 0!==t.preferHDR?t.preferHDR:function(){if("function"==typeof matchMedia){const e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}(),s=i?s.filter((e=>"SDR"!==e)):["SDR"]),{preferHDR:i,allowedVideoRanges:s}}function yf(e,t){hc.log(`[abr] start candidates with "${e}" ignored because ${t}`)}function Af(e,t,i){if("attrs"in e){const i=t.indexOf(e);if(-1!==i)return i}for(let s=0;s-1===s.indexOf(e)))}(n,t.characteristics))&&(void 0===i||i(e,t))}function vf(e,t){const{audioCodec:i,channels:s}=e;return!(void 0!==i&&(t.audioCodec||"").substring(0,4)!==i.substring(0,4)||void 0!==s&&s!==(t.channels||"2"))}function _f(e,t,i){for(let s=t;s;s--)if(i(e[s]))return s;for(let s=t+1;s1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var wf="NOT_LOADED",Ef="APPENDING",Tf="PARTIAL",kf="OK";class Cf{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(sc.BUFFER_APPENDED,this.onBufferAppended,this),e.on(sc.FRAG_BUFFERED,this.onFragBuffered,this),e.on(sc.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(sc.BUFFER_APPENDED,this.onBufferAppended,this),e.off(sc.FRAG_BUFFERED,this.onFragBuffered,this),e.off(sc.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const i=this.activePartLists[t];if(i)for(let t=i.length;t--;){const s=i[t];if(!s)break;const r=s.end;if(s.start<=e&&null!==r&&e<=r)return s}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:i}=this,s=Object.keys(i);for(let r=s.length;r--;){const a=i[s[r]];if((null==a?void 0:a.body.type)===t&&a.buffered){const t=a.body;if(t.start<=e&&e<=t.end)return t}}return null}detectEvictedFragments(e,t,i,s){this.timeRanges&&(this.timeRanges[e]=t);const r=(null==s?void 0:s.fragment.sn)||-1;Object.keys(this.fragments).forEach((s=>{const a=this.fragments[s];if(!a)return;if(r>=a.body.sn)return;if(!a.buffered&&!a.loaded)return void(a.body.type===i&&this.removeFragment(a.body));const o=a.range[e];o&&o.time.some((e=>{const i=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return i&&this.removeFragment(a.body),i}))}))}detectPartialFragments(e){const t=this.timeRanges,{frag:i,part:s}=e;if(!t||"initSegment"===i.sn)return;const r=Rf(i),a=this.fragments[r];if(!a||a.buffered&&i.gap)return;const o=!i.relurl;if(Object.keys(t).forEach((e=>{const r=i.elementaryStreams[e];if(!r)return;const n=t[e],l=o||!0===r.partial;a.range[e]=this.getBufferedTimes(i,s,l,n)})),a.loaded=null,Object.keys(a.range).length){a.buffered=!0;(a.body.endList=i.endList||a.body.endList)&&(this.endListFragments[a.body.type]=a),xf(a)||this.removeParts(i.sn-1,i.type)}else this.removeFragment(a.body)}removeParts(e,t){const i=this.activePartLists[t];i&&(this.activePartLists[t]=i.filter((t=>t.fragment.sn>=e)))}fragBuffered(e,t){const i=Rf(e);let s=this.fragments[i];!s&&t&&(s=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),s&&(s.loaded=null,s.buffered=!0)}getBufferedTimes(e,t,i,s){const r={time:[],partial:i},a=e.start,o=e.end,n=e.minEndPTS||o,l=e.maxStartPTS||a;for(let e=0;e=t&&n<=i){r.time.push({startPTS:Math.max(a,s.start(e)),endPTS:Math.min(o,s.end(e))});break}if(at){const t=Math.max(a,s.start(e)),i=Math.min(o,s.end(e));i>t&&(r.partial=!0,r.time.push({startPTS:t,endPTS:i}))}else if(o<=t)break}return r}getPartialFragment(e){let t,i,s,r=null,a=0;const{bufferPadding:o,fragments:n}=this;return Object.keys(n).forEach((l=>{const d=n[l];d&&xf(d)&&(i=d.body.start-o,s=d.body.end+o,e>=i&&e<=s&&(t=Math.min(e-i,s-e),a<=t&&(r=d.body,a=t)))})),r}isEndListAppended(e){const t=this.endListFragments[e];return void 0!==t&&(t.buffered||xf(t))}getState(e){const t=Rf(e),i=this.fragments[t];return i?i.buffered?xf(i)?Tf:kf:Ef:wf}isTimeBuffered(e,t,i){let s,r;for(let a=0;a=s&&t<=r)return!0;if(t<=s)return!1}return!1}onFragLoaded(e,t){const{frag:i,part:s}=t;if("initSegment"===i.sn||i.bitrateTest)return;const r=s?null:t,a=Rf(i);this.fragments[a]={body:i,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:i,part:s,timeRanges:r}=t;if("initSegment"===i.sn)return;const a=i.type;if(s){let e=this.activePartLists[a];e||(this.activePartLists[a]=e=[]),e.push(s)}this.timeRanges=r,Object.keys(r).forEach((e=>{const t=r[e];this.detectEvictedFragments(e,t,a,s)}))}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=Rf(e);return!!this.fragments[t]}hasParts(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)}removeFragmentsInRange(e,t,i,s,r){s&&!this.hasGaps||Object.keys(this.fragments).forEach((a=>{const o=this.fragments[a];if(!o)return;const n=o.body;n.type!==i||s&&!n.gap||n.starte&&(o.buffered||r)&&this.removeFragment(n)}))}removeFragment(e){const t=Rf(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const i=this.activePartLists[e.type];if(i){const t=e.sn;this.activePartLists[e.type]=i.filter((e=>e.fragment.sn!==t))}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function xf(e){var t,i,s;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(i=e.range.audio)?void 0:i.partial)||(null==(s=e.range.audiovideo)?void 0:s.partial))}function Rf(e){return`${e.type}_${e.level}_${e.sn}`}const Df={length:0,start:()=>0,end:()=>0};class Lf{static isBuffered(e,t){try{if(e){const i=Lf.getBuffered(e);for(let e=0;e=i.start(e)&&t<=i.end(e))return!0}}catch(e){}return!1}static bufferInfo(e,t,i){try{if(e){const s=Lf.getBuffered(e),r=[];let a;for(a=0;aa&&(s[r-1].end=e[t].end):s.push(e[t])}else s.push(e[t])}else s=e;let r,a=0,o=t,n=t;for(let e=0;e=l&&ti.startCC||e&&e.cc{if(this.loader&&this.loader.destroy(),e.gap){if(e.tagList.some((e=>"GAP"===e[0])))return void n(zf(e));e.gap=!1}const l=this.loader=e.loader=r?new r(s):new a(s),d=jf(e),h=Kp(s.fragLoadPolicy.default),c={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:Of};e.stats=l.stats,l.load(d,c,{onSuccess:(t,i,s,r)=>{this.resetLoader(e,l);let a=t.data;s.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(a.slice(0,16)),a=a.slice(16)),o({frag:e,part:null,payload:a,networkDetails:r})},onError:(t,s,r,a)=>{this.resetLoader(e,l),n(new Gf({type:rc.NETWORK_ERROR,details:ac.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Yh({url:i,data:void 0},t),error:new Error(`HTTP Error ${t.code} ${t.text}`),networkDetails:r,stats:a}))},onAbort:(t,i,s)=>{this.resetLoader(e,l),n(new Gf({type:rc.NETWORK_ERROR,details:ac.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:s,stats:t}))},onTimeout:(t,i,s)=>{this.resetLoader(e,l),n(new Gf({type:rc.NETWORK_ERROR,details:ac.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:s,stats:t}))},onProgress:(i,s,r,a)=>{t&&t({frag:e,part:null,payload:r,networkDetails:a})}})}))}loadPart(e,t,i){this.abort();const s=this.config,r=s.fLoader,a=s.loader;return new Promise(((o,n)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap)return void n(zf(e,t));const l=this.loader=e.loader=r?new r(s):new a(s),d=jf(e,t),h=Kp(s.fragLoadPolicy.default),c={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Of};t.stats=l.stats,l.load(d,c,{onSuccess:(s,r,a,n)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);const d={frag:e,part:t,payload:s.data,networkDetails:n};i(d),o(d)},onError:(i,s,r,a)=>{this.resetLoader(e,l),n(new Gf({type:rc.NETWORK_ERROR,details:ac.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:Yh({url:d.url,data:void 0},i),error:new Error(`HTTP Error ${i.code} ${i.text}`),networkDetails:r,stats:a}))},onAbort:(i,s,r)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),n(new Gf({type:rc.NETWORK_ERROR,details:ac.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:r,stats:i}))},onTimeout:(i,s,r)=>{this.resetLoader(e,l),n(new Gf({type:rc.NETWORK_ERROR,details:ac.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${c.timeout}ms`),networkDetails:r,stats:i}))}})}))}updateStatsFromPart(e,t){const i=e.stats,s=t.stats,r=s.total;if(i.loaded+=s.loaded,r){const s=Math.round(e.duration/t.duration),a=Math.min(Math.round(i.loaded/r),s),o=(s-a)*Math.round(i.loaded/a);i.total=i.loaded+o}else i.total=Math.max(i.loaded,i.total);const a=i.loading,o=s.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function jf(e,t=null){const i=t||e,s={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},r=i.byteRangeStartOffset,a=i.byteRangeEndOffset;if(ec(r)&&ec(a)){var o;let t=r,i=a;if("initSegment"===e.sn&&"AES-128"===(null==(o=e.decryptdata)?void 0:o.method)){const e=a-r;e%16&&(i=a+(16-e%16)),0!==r&&(s.resetIV=!0,t=r-16)}s.rangeStart=t,s.rangeEnd=i}return s}function zf(e,t){const i=new Error(`GAP ${e.gap?"tag":"attribute"} found`),s={type:rc.MEDIA_ERROR,details:ac.FRAG_GAP,fatal:!1,frag:e,error:i,networkDetails:null};return t&&(s.part=t),(t||e).stats.aborted=!0,new Gf(s)}class Gf extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Hf{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class Vf{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}class $f{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),i=new Uint32Array(4);for(let e=0;e<4;e++)i[e]=t.getUint32(4*e);return i}initTable(){const e=this.sBox,t=this.invSBox,i=this.subMix,s=i[0],r=i[1],a=i[2],o=i[3],n=this.invSubMix,l=n[0],d=n[1],h=n[2],c=n[3],u=new Uint32Array(256);let p=0,f=0,m=0;for(m=0;m<256;m++)u[m]=m<128?m<<1:m<<1^283;for(m=0;m<256;m++){let i=f^f<<1^f<<2^f<<3^f<<4;i=i>>>8^255&i^99,e[p]=i,t[i]=p;const n=u[p],m=u[n],g=u[m];let y=257*u[i]^16843008*i;s[p]=y<<24|y>>>8,r[p]=y<<16|y>>>16,a[p]=y<<8|y>>>24,o[p]=y,y=16843009*g^65537*m^257*n^16843008*p,l[i]=y<<24|y>>>8,d[i]=y<<16|y>>>16,h[i]=y<<8|y>>>24,c[i]=y,p?(p=n^u[u[u[g^n]]],f^=u[u[f]]):p=f=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let i=!0,s=0;for(;s{if(!s)return Promise.reject(new Error("web crypto not initialized"));this.logOnce("WebCrypto AES decrypt");return new Hf(s,new Uint8Array(i)).decrypt(e.buffer,t)})).catch((s=>(hc.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,i))))}onWebCryptoError(e,t,i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i);const s=this.flush();if(s)return s.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const i=e.length-e.length%16;return i!==e.length&&(t=Nc(e,0,i),this.remainderData=Nc(e,i)),t}logOnce(e){this.logEnabled&&(hc.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const Jf=function(e){let t="";const i=e.length;for(let s=0;so.end){const e=a>r;(a{if(this.fragContextChanged(e))return this.warn(`Fragment ${e.sn}${t.part?" p: "+t.part.index:""} of level ${e.level} was dropped during download.`),void this.fragmentTracker.removeFragment(e);e.stats.chunkCount++,this._handleFragmentLoadProgress(t)})).then((t=>{if(!t)return;const i=this.state;this.fragContextChanged(e)?(i===Qf||!this.fragCurrent&&i===em)&&(this.fragmentTracker.removeFragment(e),this.state=Kf):("payload"in t&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(sc.FRAG_LOADED,t)),this._handleFragmentLoadComplete(t))})).catch((t=>{this.state!==qf&&this.state!==sm&&(this.warn(t),this.resetFragmentLoading(e))}))}clearTrackerIfNeeded(e){var t;const{fragmentTracker:i}=this;if(i.getState(e)===Ef){const t=e.type,s=this.getFwdBufferInfo(this.mediaBuffer,t),r=Math.max(e.duration,s?s.len:this.config.maxBufferLength);this.reduceMaxBufferLength(r)&&i.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===Tf&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,i=null){if(!(e-t))return;const s={startOffset:e,endOffset:t,type:i};this.hls.trigger(sc.BUFFER_FLUSHING,s)}_loadInitSegment(e,t){this._doFragLoad(e,t).then((t=>{if(!t||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return t})).then((t=>{const{hls:i}=this,{payload:s}=t,r=e.decryptdata;if(s&&s.byteLength>0&&null!=r&&r.key&&r.iv&&"AES-128"===r.method){const a=self.performance.now();return this.decrypter.decrypt(new Uint8Array(s),r.key.buffer,r.iv.buffer).catch((t=>{throw i.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t})).then((s=>{const r=self.performance.now();return i.trigger(sc.FRAG_DECRYPTED,{frag:e,payload:s,stats:{tstart:a,tdecrypt:r}}),t.payload=s,this.completeInitSegmentLoad(t)}))}return this.completeInitSegmentLoad(t)})).catch((t=>{this.state!==qf&&this.state!==sm&&(this.warn(t),this.resetFragmentLoading(e))}))}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const i=e.frag.stats;this.state=Kf,e.frag.data=new Uint8Array(e.payload),i.parsing.start=i.buffering.start=self.performance.now(),i.parsing.end=i.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var i,s,r,a;const o=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===hp?"level":"track"} ${e.level} (frag:[${(null!=(i=e.startPTS)?i:NaN).toFixed(3)}-${(null!=(s=e.endPTS)?s:NaN).toFixed(3)}] > buffer:${o?Jf(Lf.getBuffered(o)):"(detached)"})`),"initSegment"!==e.sn){var n;if(e.type!==up){const t=e.elementaryStreams;if(!Object.keys(t).some((e=>!!t[e])))return void(this.state=Kf)}const t=null==(n=this.levels)?void 0:n[e.level];null!=t&&t.fragmentError&&(this.log(`Resetting level fragment error count of ${t.fragmentError} on frag buffered`),t.fragmentError=0)}this.state=Kf,o&&(!this.loadedmetadata&&e.type==hp&&o.buffered.length&&(null==(r=this.fragCurrent)?void 0:r.sn)===(null==(a=this.fragPrevious)?void 0:a.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:i,part:s,partsLoaded:r}=e,a=!r||0===r.length||r.some((e=>!e)),o=new Pf(i.level,i.sn,i.stats.chunkCount+1,0,s?s.index:-1,!a);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,i=null,s){var r;const a=null==t?void 0:t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;if(!e.encrypted||null!=(r=e.decryptdata)&&r.key?!e.encrypted&&a.encryptedFragments.length&&this.keyLoader.loadClear(e,a.encryptedFragments):(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${"[stream-controller]"===this.logPrefix?"level":"track"} ${e.level}`),this.state=Yf,this.fragCurrent=e,o=this.keyLoader.load(e).then((e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(sc.KEY_LOADED,e),this.state===Yf&&(this.state=Kf),e})),this.hls.trigger(sc.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),i=Math.max(e.start,i||0),this.config.lowLatencyMode&&"initSegment"!==e.sn){const r=a.partList;if(r&&s){i>e.end&&a.fragmentHint&&(e=a.fragmentHint);const n=this.getNextPart(r,e,i);if(n>-1){const l=r[n];let d;return this.log(`Loading part sn: ${e.sn} p: ${l.index} cc: ${e.cc} of playlist [${a.startSN}-${a.endSN}] parts [0-${n}-${r.length-1}] ${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),this.nextLoadPosition=l.start+l.duration,this.state=Qf,d=o?o.then((i=>!i||this.fragContextChanged(i.frag)?null:this.doFragPartsLoad(e,l,t,s))).catch((e=>this.handleFragLoadError(e))):this.doFragPartsLoad(e,l,t,s).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(sc.FRAG_LOADING,{frag:e,part:l,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):d}if(!e.url||this.loadedEndOfParts(r,i))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${a?"of ["+a.startSN+"-"+a.endSN+"] ":""}${"[stream-controller]"===this.logPrefix?"level":"track"}: ${e.level}, target: ${parseFloat(i.toFixed(3))}`),ec(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Qf;const n=this.config.progressive;let l;return l=n&&o?o.then((t=>!t||this.fragContextChanged(null==t?void 0:t.frag)?null:this.fragmentLoader.load(e,s))).catch((e=>this.handleFragLoadError(e))):Promise.all([this.fragmentLoader.load(e,n?s:void 0),o]).then((([e])=>(!n&&e&&s&&s(e),e))).catch((e=>this.handleFragLoadError(e))),this.hls.trigger(sc.FRAG_LOADING,{frag:e,targetBufferTime:i}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(e,t,i,s){return new Promise(((r,a)=>{var o;const n=[],l=null==(o=i.details)?void 0:o.partList,d=t=>{this.fragmentLoader.loadPart(e,t,s).then((s=>{n[t.index]=s;const a=s.part;this.hls.trigger(sc.FRAG_LOADED,s);const o=Hp(i,e.sn,t.index+1)||Vp(l,e.sn,t.index+1);if(!o)return r({frag:e,part:a,partsLoaded:n});d(o)})).catch(a)};d(t)}))}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===ac.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(sc.ERROR,t)}else this.hls.trigger(sc.ERROR,{type:rc.OTHER_ERROR,details:ac.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==em)return void(this.fragCurrent||this.state===qf||this.state===sm||(this.state=Kf));const{frag:i,part:s,level:r}=t,a=self.performance.now();i.stats.parsing.end=a,s&&(s.stats.parsing.end=a),this.updateLevelTiming(i,s,r,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:i}=this,{level:s,sn:r,part:a}=e;if(null==t||!t[s])return this.warn(`Levels object was unset while buffering fragment ${r} of level ${s}. The current chunk will not be buffered.`),null;const o=t[s],n=a>-1?Hp(o,r,a):null,l=n?n.fragment:function(e,t,i){if(null==e||!e.details)return null;const s=e.details;let r=s.fragments[t-s.startSN];return r||(r=s.fragmentHint,r&&r.sn===t?r:ta&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){const i=this.getLoadPosition();return ec(i)?this.getFwdBufferInfoAtPos(e,i,t):null}getFwdBufferInfoAtPos(e,t,i){const{config:{maxBufferHole:s}}=this,r=Lf.bufferInfo(e,t,s);if(0===r.len&&void 0!==r.nextStart){const a=this.fragmentTracker.getBufferedFrag(t,i);if(a&&r.nextStart=i&&(t.maxMaxBufferLength/=2,this.warn(`Reduce max buffer length to ${t.maxMaxBufferLength}s`),!0)}getAppendedFrag(e,t=hp){const i=this.fragmentTracker.getAppendedFrag(e,hp);return i&&"fragment"in i?i.fragment:i}getNextFragment(e,t){const i=t.fragments,s=i.length;if(!s)return null;const{config:r}=this,a=i[0].start;let o;if(t.live){const n=r.initialLiveManifestSize;if(st}getNextFragmentLoopLoading(e,t,i,s,r){const a=e.gap,o=this.getNextFragment(this.nextLoadPosition,t);if(null===o)return o;if(e=o,a&&e&&!e.gap&&i.nextStart){const t=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,s);if(null!==t&&i.len+t.len>=r)return this.log(`buffer full after gaps in "${s}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment}getNextPart(e,t,i){let s=-1,r=!1,a=!0;for(let o=0,n=e.length;o-1&&ii.start&&i.loaded}getInitialLiveFragment(e,t){const i=this.fragPrevious;let s=null;if(i){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${i.programDateTime}`),s=function(e,t,i){if(null===t||!Array.isArray(e)||!e.length||!ec(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;i=i||0;for(let s=0;s=e.startSN&&r<=e.endSN){const a=t[r-e.startSN];i.cc===a.cc&&(s=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${s.sn}`))}s||(s=function(e,t){return Qp(e,(e=>e.cct?-1:0))}(t,i.cc),s&&this.log(`Live playlist, switching playlist, load frag with same CC: ${s.sn}`))}}else{const t=this.hls.liveSyncPosition;null!==t&&(s=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return s}getFragmentAtPosition(e,t,i){const{config:s}=this;let{fragPrevious:r}=this,{fragments:a,endSN:o}=i;const{fragmentHint:n}=i,l=s.maxFragLookUpTolerance,d=i.partList,h=!!(s.lowLatencyMode&&null!=d&&d.length&&n);let c;if(h&&n&&!this.bitrateTest&&(a=a.concat(n),o=n.sn),et-l?0:l)}else c=a[a.length-1];if(c){const e=c.sn-i.startSN,t=this.fragmentTracker.getState(c);if((t===kf||t===Tf&&c.gap)&&(r=c),r&&c.sn===r.sn&&(!h||d[0].fragment.sn>c.sn)){if(r&&c.level===r.level){const t=a[e+1];c=c.sn=a-t.maxFragLookUpTolerance&&r<=o;if(null!==s&&i.duration>s&&(r${e.startSN} prev-sn: ${r?r.sn:"na"} fragments: ${s}`),a}return r}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}setStartPosition(e,t){let i=this.startPosition;if(i ${null==(s=this.fragCurrent)?void 0:s.url}`);const r=t.details===ac.FRAG_GAP;r&&this.fragmentTracker.fragBuffered(i,!0);const a=t.errorAction,{action:o,retryCount:n=0,retryConfig:l}=a||{};if(a&&o===af&&l){this.resetStartWhenNotLoaded(this.levelLastLoaded);const s=qp(l,n);this.warn(`Fragment ${i.sn} of ${e} ${i.level} errored with ${t.details}, retrying loading ${n+1}/${l.maxNumRetry} in ${s}ms`),a.resolved=!0,this.retryDate=self.performance.now()+s,this.state=Xf}else if(l&&a){if(this.resetFragmentErrors(e),!(n.5;s&&this.reduceMaxBufferLength(i.len);const r=!s;return r&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${t} buffer`),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),r}return!1}resetFragmentErrors(e){e===cp&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==qf&&(this.state=Kf)}afterBufferFlushed(e,t,i){if(!e)return;const s=Lf.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,s,i),this.state===im&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Kf}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;null!=t&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,s){var r;const a=i.details;if(!a)return void this.warn("level.details undefined");if(!Object.keys(e.elementaryStreams).reduce(((t,r)=>{const o=e.elementaryStreams[r];if(o){const n=o.endPTS-o.startPTS;if(n<=0)return this.warn(`Could not parse fragment ${e.sn} ${r} duration reliably (${n})`),t||!1;const l=s?0:Np(a,e,o.startPTS,o.endPTS,o.startDTS,o.endDTS);return this.hls.trigger(sc.LEVEL_PTS_UPDATED,{details:a,level:i,drift:l,type:r,frag:e,start:o.startPTS,end:o.endPTS}),!0}return t}),!1)&&null===(null==(r=this.transmuxer)?void 0:r.error)){const t=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(0===i.fragmentError&&(i.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(t.message),this.hls.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.FRAG_PARSING_ERROR,fatal:!1,error:t,frag:e,reason:`Found no media in msn ${e.sn} of level "${i.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=tm,this.hls.trigger(sc.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class nm{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let i;return e.length?(i=1===e.length?e[0]:function(e,t){const i=new Uint8Array(t);let s=0;for(let t=0;t0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:s,type:_p,duration:Number.POSITIVE_INFINITY});r{if(ec(e))return 90*e;return 9e4*t+(i?9e4*i.baseTime/i.timescale:0)};function cm(e,t){return 255===e[t]&&240==(246&e[t+1])}function um(e,t){return 1&e[t+1]?7:9}function pm(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function fm(e,t){return t+1=e.length)return!1;const s=pm(e,t);if(s<=i)return!1;const r=t+s;return r===e.length||fm(e,r)}return!1}function gm(e,t,i,s,r){if(!e.samplerate){const a=function(e,t,i,s){let r,a,o,n;const l=navigator.userAgent.toLowerCase(),d=s,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];r=1+((192&t[i+2])>>>6);const c=(60&t[i+2])>>>2;if(!(c>h.length-1))return o=(1&t[i+2])<<2,o|=(192&t[i+3])>>>6,hc.log(`manifest codec:${s}, ADTS type:${r}, samplingIndex:${c}`),/firefox/i.test(l)?c>=6?(r=5,n=new Array(4),a=c-3):(r=2,n=new Array(2),a=c):-1!==l.indexOf("android")?(r=2,n=new Array(2),a=c):(r=5,n=new Array(4),s&&(-1!==s.indexOf("mp4a.40.29")||-1!==s.indexOf("mp4a.40.5"))||!s&&c>=6?a=c-3:((s&&-1!==s.indexOf("mp4a.40.2")&&(c>=6&&1===o||/vivaldi/i.test(l))||!s&&1===o)&&(r=2,n=new Array(2)),a=c)),n[0]=r<<3,n[0]|=(14&c)>>1,n[1]|=(1&c)<<7,n[1]|=o<<3,5===r&&(n[1]|=(14&a)>>1,n[2]=(1&a)<<7,n[2]|=8,n[3]=0),{config:n,samplerate:h[c],channelCount:o,codec:"mp4a.40."+r,manifestCodec:d};{const t=new Error(`invalid ADTS sampling index:${c}`);e.emit(sc.ERROR,sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message})}}(t,i,s,r);if(!a)return;e.config=a.config,e.samplerate=a.samplerate,e.channelCount=a.channelCount,e.codec=a.codec,e.manifestCodec=a.manifestCodec,hc.log(`parsed codec:${e.codec}, rate:${a.samplerate}, channels:${a.channelCount}`)}}function ym(e){return 9216e4/e}function Am(e,t,i,s,r){const a=s+r*ym(e.samplerate),o=function(e,t){const i=um(e,t);if(t+i<=e.length){const s=pm(e,t)-i;if(s>0)return{headerLength:i,frameLength:s}}}(t,i);let n;if(o){const{frameLength:s,headerLength:r}=o,l=r+s,d=Math.max(0,i+l-t.length);d?(n=new Uint8Array(l-r),n.set(t.subarray(i+r,t.length),0)):n=t.subarray(i+r,i+l);const h={unit:n,pts:a};return d||e.samples.push(h),{sample:h,length:l,missing:d}}const l=t.length-i;n=new Uint8Array(l),n.set(t.subarray(i,t.length),0);return{sample:{unit:n,pts:a},length:l,missing:-1}}let bm=null;const vm=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],_m=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Sm=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],wm=[0,1,1,4];function Em(e,t,i,s,r){if(i+24>t.length)return;const a=Tm(t,i);if(a&&i+a.frameLength<=t.length){const o=s+r*(9e4*a.samplesPerFrame/a.sampleRate),n={unit:t.subarray(i,i+a.frameLength),pts:o,dts:o};return e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(n),{sample:n,length:a.frameLength,missing:0}}}function Tm(e,t){const i=e[t+1]>>3&3,s=e[t+1]>>1&3,r=e[t+2]>>4&15,a=e[t+2]>>2&3;if(1!==i&&0!==r&&15!==r&&3!==a){const o=e[t+2]>>1&1,n=e[t+3]>>6,l=1e3*vm[14*(3===i?3-s:3===s?3:4)+r-1],d=_m[3*(3===i?0:2===i?1:2)+a],h=3===n?1:2,c=Sm[i][s],u=wm[s],p=8*c*u,f=Math.floor(c*l/d+o)*u;if(null===bm){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);bm=e?parseInt(e[1]):0}return!!bm&&bm<=87&&2===s&&l>=224e3&&0===n&&(e[t+3]=128|e[t+3]),{sampleRate:d,channelCount:h,frameLength:f,samplesPerFrame:p}}}function km(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function Cm(e,t){return t+1{let i=0,s=5;t+=s;const r=new Uint32Array(1),a=new Uint32Array(1),o=new Uint8Array(1);for(;s>0;){o[0]=e[t];const n=Math.min(s,8),l=8-n;a[0]=4278190080>>>24+l<>l,i=i?i<t.length)return-1;if(11!==t[i]||119!==t[i+1])return-1;const a=t[i+4]>>6;if(a>=3)return-1;const o=[48e3,44100,32e3][a],n=63&t[i+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*n+a];if(i+l>t.length)return-1;const d=t[i+6]>>5;let h=0;2===d?h+=2:(1&d&&1!==d&&(h+=2),4&d&&(h+=2));const c=(t[i+6]<<8|t[i+7])>>12-h&1,u=[2,1,2,3,3,4,4,5][d]+c,p=t[i+5]>>3,f=7&t[i+5],m=new Uint8Array([a<<6|p<<1|f>>2,(3&f)<<6|d<<3|c<<2|n>>4,n<<4&224]),g=s+r*(1536/o*9e4),y=t.subarray(i,i+l);return e.config=m,e.channelCount=u,e.samplerate=o,e.samples.push({unit:y,pts:g}),l}class Bm{constructor(){this.VideoSample=null}createVideoSample(e,t,i,s){return{key:e,frame:!1,pts:t,dts:i,units:[],debug:s,length:0}}getLastNalUnit(e){var t;let i,s=this.VideoSample;if(s&&0!==s.units.length||(s=e[e.length-1]),null!=(t=s)&&t.units){const e=s.units;i=e[e.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){const i=t.samples,s=i.length;if(!s)return void t.dropped++;{const t=i[s-1];e.pts=t.pts,e.dts=t.dts}}t.samples.push(e)}e.debug.length&&hc.log(e.pts+"/"+e.dts+":"+e.debug)}}class Im{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,i=e.byteLength-t,s=new Uint8Array(4),r=Math.min(4,t);if(0===r)throw new Error("no bytes available");s.set(e.subarray(i,i+r)),this.word=new DataView(s.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}skipBits(e){let t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(t=(e-=this.bitsAvailable)>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const i=this.word>>>32-t;if(e>32&&hc.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return t=e-t,t>0&&this.bitsAvailable?i<>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t,i=8,s=8;for(let r=0;r{var a;switch(s.type){case 1:{let t=!1;o=!0;const r=s.data;if(l&&r.length>4){const e=new Im(r).readSliceType();2!==e&&4!==e&&7!==e&&9!==e||(t=!0)}var d;if(t)null!=(d=n)&&d.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null);n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),n.frame=!0,n.key=t;break}case 5:o=!0,null!=(a=n)&&a.frame&&!n.key&&(this.pushAccessUnit(n,e),n=this.VideoSample=null),n||(n=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts,"")),n.key=!0,n.frame=!0;break;case 6:o=!0,Tu(s.data,1,i.pts,t.samples);break;case 7:{var h,c;o=!0,l=!0;const t=s.data,i=new Im(t).readSPS();if(!e.sps||e.width!==i.width||e.height!==i.height||(null==(h=e.pixelRatio)?void 0:h[0])!==i.pixelRatio[0]||(null==(c=e.pixelRatio)?void 0:c[1])!==i.pixelRatio[1]){e.width=i.width,e.height=i.height,e.pixelRatio=i.pixelRatio,e.sps=[t],e.duration=r;const s=t.subarray(1,4);let a="avc1.";for(let e=0;e<3;e++){let t=s[e].toString(16);t.length<2&&(t="0"+t),a+=t}e.codec=a}break}case 8:o=!0,e.pps=[s.data];break;case 9:o=!0,e.audFound=!0,n&&this.pushAccessUnit(n,e),n=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts,"");break;case 12:o=!0;break;default:o=!1,n&&(n.debug+="unknown NAL "+s.type+" ")}if(n&&o){n.units.push(s)}})),s&&n&&(this.pushAccessUnit(n,e),this.VideoSample=null)}parseAVCNALu(e,t){const i=t.byteLength;let s=e.naluState||0;const r=s,a=[];let o,n,l,d=0,h=-1,c=0;for(-1===s&&(h=0,c=31&t[0],s=0,d=1);d=0){const e={data:t.subarray(h,n),type:c};a.push(e)}else{const i=this.getLastNalUnit(e.samples);i&&(r&&d<=4-r&&i.state&&(i.data=i.data.subarray(0,i.data.byteLength-r)),n>0&&(i.data=Su(i.data,t.subarray(0,n)),i.state=0))}d=0&&s>=0){const e={data:t.subarray(h,i),type:c,state:s};a.push(e)}if(0===a.length){const i=this.getLastNalUnit(e.samples);i&&(i.data=Su(i.data,t))}return e.naluState=s,a}}class Um{constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new Wf(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,i){const s=e[t].unit;if(s.length<=16)return;const r=s.subarray(16,s.length-s.length%16),a=r.buffer.slice(r.byteOffset,r.byteOffset+r.length);this.decryptBuffer(a).then((r=>{const a=new Uint8Array(r);s.set(a,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}))}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t);let s=0;for(let t=32;t{r.data=this.getAvcDecryptedUnit(a,o),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,s)}))}decryptAvcSamples(e,t,i,s){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void s();const r=e[t].units;for(;!(i>=r.length);i++){const a=r[i];if(!(a.data.length<=48||1!==a.type&&5!==a.type||(this.decryptAvcSample(e,t,i,s,a),this.decrypter.isSync())))return}}}}const Fm=188;class Om{constructor(e,t,i){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.videoParser=new Mm}static probe(e){const t=Om.syncOffset(e);return t>0&&hc.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),-1!==t}static syncOffset(e){const t=e.length;let i=Math.min(940,t-Fm)+1,s=0;for(;s1&&(0===a&&o>2||n+Fm>i))return a}s++}return-1}static createTrack(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:ou[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}resetInitSegment(e,t,i,s){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Om.createTrack("video"),this._audioTrack=Om.createTrack("audio",s),this._id3Track=Om.createTrack("id3"),this._txtTrack=Om.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,this._duration=s}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i=!1,s=!1){let r;i||(this.sampleAes=null);const a=this._videoTrack,o=this._audioTrack,n=this._id3Track,l=this._txtTrack;let d=a.pid,h=a.pesData,c=o.pid,u=n.pid,p=o.pesData,f=n.pesData,m=null,g=this.pmtParsed,y=this._pmtId,A=e.length;if(this.remainderData&&(A=(e=Su(this.remainderData,e)).length,this.remainderData=null),A>4>1){if(v=t+5+e[t+4],v===t+Fm)continue}else v=t+4;switch(A){case d:s&&(h&&(r=Hm(h))&&this.videoParser.parseAVCPES(a,l,r,!1,this._duration),h={data:[],size:0}),h&&(h.data.push(e.subarray(v,t+Fm)),h.size+=t+Fm-v);break;case c:if(s){if(p&&(r=Hm(p)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,r);break;case"mp3":this.parseMPEGPES(o,r);break;case"ac3":this.parseAC3PES(o,r)}p={data:[],size:0}}p&&(p.data.push(e.subarray(v,t+Fm)),p.size+=t+Fm-v);break;case u:s&&(f&&(r=Hm(f))&&this.parseID3PES(n,r),f={data:[],size:0}),f&&(f.data.push(e.subarray(v,t+Fm)),f.size+=t+Fm-v);break;case 0:s&&(v+=e[v]+1),y=this._pmtId=jm(e,v);break;case y:{s&&(v+=e[v]+1);const r=zm(e,v,this.typeSupported,i);d=r.videoPid,d>0&&(a.pid=d,a.segmentCodec=r.segmentVideoCodec),c=r.audioPid,c>0&&(o.pid=c,o.segmentCodec=r.segmentAudioCodec),u=r.id3Pid,u>0&&(n.pid=u),null===m||g||(hc.warn(`MPEG-TS PMT found at ${t} after unknown PID '${m}'. Backtracking to sync byte @${b} to parse all TS packets.`),m=null,t=b-188),g=this.pmtParsed=!0;break}case 17:case 8191:break;default:m=A}}else v++;if(v>0){const e=new Error(`Found ${v} TS packet/s that do not start with 0x47`);this.observer.emit(sc.ERROR,sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message})}a.pesData=h,o.pesData=p,n.pesData=f;const _={audioTrack:o,videoTrack:a,id3Track:n,textTrack:l};return s&&this.extractRemainingSamples(_),_}flush(){const{remainderData:e}=this;let t;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:i,id3Track:s,textTrack:r}=e,a=i.pesData,o=t.pesData,n=s.pesData;let l;if(a&&(l=Hm(a))?(this.videoParser.parseAVCPES(i,r,l,!0,this._duration),i.pesData=null):i.pesData=a,o&&(l=Hm(o))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,l);break;case"mp3":this.parseMPEGPES(t,l);break;case"ac3":this.parseAC3PES(t,l)}t.pesData=null}else null!=o&&o.size&&hc.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;n&&(l=Hm(n))?(this.parseID3PES(s,l),s.pesData=null):s.pesData=n}demuxSampleAes(e,t,i){const s=this.demux(e,i,!0,!this.config.progressive),r=this.sampleAes=new Um(this.observer,this.config,t);return this.decrypt(s,r)}decrypt(e,t){return new Promise((i=>{const{audioTrack:s,videoTrack:r}=e;s.samples&&"aac"===s.segmentCodec?t.decryptAacSamples(s.samples,0,(()=>{r.samples?t.decryptAvcSamples(r.samples,0,0,(()=>{i(e)})):i(e)})):r.samples&&t.decryptAvcSamples(r.samples,0,0,(()=>{i(e)}))}))}destroy(){this._duration=0}parseAACPES(e,t){let i=0;const s=this.aacOverFlow;let r,a,o,n=t.data;if(s){this.aacOverFlow=null;const t=s.missing,r=s.sample.unit.byteLength;if(-1===t)n=Su(s.sample.unit,n);else{const a=r-t;s.sample.unit.set(n.subarray(0,t),a),e.samples.push(s.sample),i=s.missing}}for(r=i,a=n.length;r0;)n+=a}}parseID3PES(e,t){if(void 0===t.pts)return void hc.warn("[tsdemuxer]: ID3 PES unknown PTS");const i=Zh({},t,{type:this._videoTrack?wp:_p,duration:Number.POSITIVE_INFINITY});e.samples.push(i)}}function Nm(e,t){return((31&e[t+1])<<8)+e[t+2]}function jm(e,t){return(31&e[t+10])<<8|e[t+11]}function zm(e,t,i,s){const r={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t0){let s=t+5,n=o;for(;n>2;){if(106===e[s])!0!==i.ac3?hc.log("AC-3 audio found, not supported in this browser for now"):(r.audioPid=a,r.segmentAudioCodec="ac3");const t=e[s+1]+2;s+=t,n-=t}}break;case 194:case 135:hc.warn("Unsupported EC-3 in M2TS found");break;case 36:hc.warn("Unsupported HEVC in M2TS found")}t+=o+5}return r}function Gm(e){hc.log(`${e} with AES-128-CBC encryption found in unencrypted stream`)}function Hm(e){let t,i,s,r,a,o=0;const n=e.data;if(!e||0===e.size)return null;for(;n[0].length<19&&n.length>1;)n[0]=Su(n[0],n[1]),n.splice(1,1);t=n[0];if(1===(t[0]<<16)+(t[1]<<8)+t[2]){if(i=(t[4]<<8)+t[5],i&&i>e.size-6)return null;const l=t[7];192&l&&(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?(a=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2,r-a>54e5&&(hc.warn(`${Math.round((r-a)/9e4)}s delta between PTS and DTS, align them`),r=a)):a=r),s=t[8];let d=s+9;if(e.size<=d)return null;e.size-=d;const h=new Uint8Array(e.size);for(let e=0,i=n.length;ei){d-=i;continue}t=t.subarray(d),i-=d,d=0}h.set(t,o),o+=i}return i&&(i-=s+3),{data:h,pts:r,dts:a,len:i}}return null}class Vm{static getSilentFrame(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===t)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===t)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}const $m=Math.pow(2,32)-1;class Wm{static init(){let e;for(e in Wm.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},Wm.types)Wm.types.hasOwnProperty(e)&&(Wm.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=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]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);Wm.HDLR_TYPES={video:t,audio:i};const s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),r=new Uint8Array([0,0,0,0,0,0,0,0]);Wm.STTS=Wm.STSC=Wm.STCO=r,Wm.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Wm.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Wm.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Wm.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),n=new Uint8Array([0,0,0,1]);Wm.FTYP=Wm.box(Wm.types.ftyp,a,n,a,o),Wm.DINF=Wm.box(Wm.types.dinf,Wm.box(Wm.types.dref,s))}static box(e,...t){let i=8,s=t.length;const r=s;for(;s--;)i+=t[s].byteLength;const a=new Uint8Array(i);for(a[0]=i>>24&255,a[1]=i>>16&255,a[2]=i>>8&255,a[3]=255&i,a.set(e,4),s=0,i=8;s>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s,85,196,0,0]))}static mdia(e){return Wm.box(Wm.types.mdia,Wm.mdhd(e.timescale,e.duration),Wm.hdlr(e.type),Wm.minf(e))}static mfhd(e){return Wm.box(Wm.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}static minf(e){return"audio"===e.type?Wm.box(Wm.types.minf,Wm.box(Wm.types.smhd,Wm.SMHD),Wm.DINF,Wm.stbl(e)):Wm.box(Wm.types.minf,Wm.box(Wm.types.vmhd,Wm.VMHD),Wm.DINF,Wm.stbl(e))}static moof(e,t,i){return Wm.box(Wm.types.moof,Wm.mfhd(e),Wm.traf(i,t))}static moov(e){let t=e.length;const i=[];for(;t--;)i[t]=Wm.trak(e[t]);return Wm.box.apply(null,[Wm.types.moov,Wm.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(Wm.mvex(e)))}static mvex(e){let t=e.length;const i=[];for(;t--;)i[t]=Wm.trex(e[t]);return Wm.box.apply(null,[Wm.types.mvex,...i])}static mvhd(e,t){t*=e;const i=Math.floor(t/($m+1)),s=Math.floor(t%($m+1)),r=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s,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 Wm.box(Wm.types.mvhd,r)}static sdtp(e){const t=e.samples||[],i=new Uint8Array(4+t.length);let s,r;for(s=0;s>>8&255),r.push(255&s),r=r.concat(Array.prototype.slice.call(i));for(t=0;t>>8&255),a.push(255&s),a=a.concat(Array.prototype.slice.call(i));const o=Wm.box(Wm.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(a))),n=e.width,l=e.height,d=e.pixelRatio[0],h=e.pixelRatio[1];return Wm.box(Wm.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,n>>8&255,255&n,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,Wm.box(Wm.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Wm.box(Wm.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,h>>24,h>>16&255,h>>8&255,255&h])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0])}static mp4a(e){return Wm.box(Wm.types.mp4a,Wm.audioStsd(e),Wm.box(Wm.types.esds,Wm.esds(e)))}static mp3(e){return Wm.box(Wm.types[".mp3"],Wm.audioStsd(e))}static ac3(e){return Wm.box(Wm.types["ac-3"],Wm.audioStsd(e),Wm.box(Wm.types.dac3,e.config))}static stsd(e){return"audio"===e.type?"mp3"===e.segmentCodec&&"mp3"===e.codec?Wm.box(Wm.types.stsd,Wm.STSD,Wm.mp3(e)):"ac3"===e.segmentCodec?Wm.box(Wm.types.stsd,Wm.STSD,Wm.ac3(e)):Wm.box(Wm.types.stsd,Wm.STSD,Wm.mp4a(e)):Wm.box(Wm.types.stsd,Wm.STSD,Wm.avc1(e))}static tkhd(e){const t=e.id,i=e.duration*e.timescale,s=e.width,r=e.height,a=Math.floor(i/($m+1)),o=Math.floor(i%($m+1));return Wm.box(Wm.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,o>>24,o>>16&255,o>>8&255,255&o,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>8&255,255&s,0,0,r>>8&255,255&r,0,0]))}static traf(e,t){const i=Wm.sdtp(e),s=e.id,r=Math.floor(t/($m+1)),a=Math.floor(t%($m+1));return Wm.box(Wm.types.traf,Wm.box(Wm.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s])),Wm.box(Wm.types.tfdt,new Uint8Array([1,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,a>>24,a>>16&255,a>>8&255,255&a])),Wm.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||4294967295,Wm.box(Wm.types.trak,Wm.tkhd(e),Wm.mdia(e))}static trex(e){const t=e.id;return Wm.box(Wm.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const i=e.samples||[],s=i.length,r=12+16*s,a=new Uint8Array(r);let o,n,l,d,h,c;for(t+=8+r,a.set(["video"===e.type?1:0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,255&s,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),o=0;o>>24&255,l>>>16&255,l>>>8&255,255&l,d>>>24&255,d>>>16&255,d>>>8&255,255&d,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,61440&h.degradPrio,15&h.degradPrio,c>>>24&255,c>>>16&255,c>>>8&255,255&c],12+16*o);return Wm.box(Wm.types.trun,a)}static initSegment(e){Wm.types||Wm.init();const t=Wm.moov(e);return Su(Wm.FTYP,t)}}Wm.types=void 0,Wm.HDLR_TYPES=void 0,Wm.STTS=void 0,Wm.STSC=void 0,Wm.STCO=void 0,Wm.STSZ=void 0,Wm.VMHD=void 0,Wm.SMHD=void 0,Wm.STSD=void 0,Wm.FTYP=void 0,Wm.DINF=void 0;function Jm(e,t,i=1,s=!1){const r=e*t*i;return s?Math.round(r):r}function qm(e,t=!1){return Jm(e,1e3,1/9e4,t)}let Km,Ym=null,Qm=null;class Xm{constructor(e,t,i,s=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1,null===Ym){const e=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ym=e?parseInt(e[1]):0}if(null===Qm){const e=navigator.userAgent.match(/Safari\/(\d+)/i);Qm=e?parseInt(e[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){hc.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){hc.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){hc.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const i=e.reduce(((e,i)=>{const s=i.pts-e;return s<-4294967296?(t=!0,Zm(e,i.pts)):s>0?e:i.pts}),e[0].pts);return t&&hc.debug("PTS rollover detected"),i}remux(e,t,i,s,r,a,o,n){let l,d,h,c,u,p,f=r,m=r;const g=e.pid>-1,y=t.pid>-1,A=t.samples.length,b=e.samples.length>0,v=o&&A>0||A>1;if((!g||b)&&(!y||v)||this.ISGenerated||o){if(this.ISGenerated){var _,S,w,E;const e=this.videoTrackConfig;!e||t.width===e.width&&t.height===e.height&&(null==(_=t.pixelRatio)?void 0:_[0])===(null==(S=e.pixelRatio)?void 0:S[0])&&(null==(w=t.pixelRatio)?void 0:w[1])===(null==(E=e.pixelRatio)?void 0:E[1])||this.resetInitSegment()}else h=this.generateIS(e,t,r,a);const i=this.isVideoContiguous;let s,o=-1;if(v&&(o=function(e){for(let t=0;t0){hc.warn(`[mp4-remuxer]: Dropped ${o} out of ${A} video samples due to a missing keyframe`);const e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(o),t.dropped+=o,m+=(t.samples[0].pts-e)/t.inputTimeScale,s=m}else-1===o&&(hc.warn(`[mp4-remuxer]: No keyframe found out of ${A} video samples`),p=!1);if(this.ISGenerated){if(b&&v){const i=this.getVideoStartPts(t.samples),s=(Zm(e.samples[0].pts,i)-i)/t.inputTimeScale;f+=Math.max(0,s),m+=Math.max(0,-s)}if(b){if(e.samplerate||(hc.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(e,t,r,a)),d=this.remuxAudio(e,f,this.isAudioContiguous,a,y||v||n===cp?m:void 0),v){const s=d?d.endPTS-d.startPTS:0;t.inputTimeScale||(hc.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(e,t,r,a)),l=this.remuxVideo(t,m,i,s)}}else v&&(l=this.remuxVideo(t,m,i,0));l&&(l.firstKeyFrame=o,l.independent=-1!==o,l.firstKeyFramePTS=s)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(u=eg(i,r,this._initPTS,this._initDTS)),s.samples.length&&(c=tg(s,r,this._initPTS))),{audio:d,video:l,initSegment:h,independent:p,text:c,id3:u}}generateIS(e,t,i,s){const r=e.samples,a=t.samples,o=this.typeSupported,n={},l=this._initPTS;let d,h,c,u=!l||s,p="audio/mp4";if(u&&(d=h=1/0),e.config&&r.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(p="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}n.audio={id:"audio",container:p,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&o.mpeg?new Uint8Array(0):Wm.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(c=e.inputTimeScale,l&&c===l.timescale?u=!1:d=h=r[0].pts-Math.round(c*i))}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,n.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:Wm.initSegment([t]),metadata:{width:t.width,height:t.height}},u)if(c=t.inputTimeScale,l&&c===l.timescale)u=!1;else{const e=this.getVideoStartPts(a),t=Math.round(c*i);h=Math.min(h,Zm(a[0].dts,e)-t),d=Math.min(d,e-t)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(n).length)return this.ISGenerated=!0,u?(this._initPTS={baseTime:d,timescale:c},this._initDTS={baseTime:h,timescale:c}):d=c=void 0,{tracks:n,initPTS:d,timescale:c}}remuxVideo(e,t,i,s){const r=e.inputTimeScale,a=e.samples,o=[],n=a.length,l=this._initPTS;let d,h,c=this.nextAvcDts,u=8,p=this.videoSampleDuration,f=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY,g=!1;if(!i||null===c){const e=t*r,s=a[0].pts-Zm(a[0].dts,a[0].pts);Ym&&null!==c&&Math.abs(e-s-c)<15e3?i=!0:c=e-s}const y=l.baseTime*r/l.timescale;for(let e=0;e0?e-1:e].dts&&(g=!0)}g&&a.sort((function(e,t){const i=e.dts-t.dts,s=e.pts-t.pts;return i||s})),d=a[0].dts,h=a[a.length-1].dts;const A=h-d,b=A?Math.round(A/(n-1)):p||e.inputTimeScale/30;if(i){const e=d-c,i=e>b,s=e<-1;if((i||s)&&(i?hc.warn(`AVC: ${qm(e,!0)} ms (${e}dts) hole between fragments detected at ${t.toFixed(3)}`):hc.warn(`AVC: ${qm(-e,!0)} ms (${e}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!s||c>=a[0].pts||Ym)){d=c;const t=a[0].pts-e;if(i)a[0].dts=d,a[0].pts=t;else for(let i=0;it);i++)a[i].dts-=e,a[i].pts-=e;hc.log(`Video: Initial PTS/DTS adjusted: ${qm(t,!0)}/${qm(d,!0)}, delta: ${qm(e,!0)} ms`)}}d=Math.max(0,d);let v=0,_=0,S=d;for(let e=0;e0?t.dts-a[e-1].dts:b;if(l=e>0?t.pts-a[e-1].pts:b,i.stretchShortVideoTrack&&null!==this.nextAudioPts){const e=Math.floor(i.maxBufferHole*r),a=(s?f+s*r:this.nextAudioPts)-t.pts;a>e?(p=a-o,p<0?p=o:k=!0,hc.log(`[mp4-remuxer]: It is approximately ${a/90} ms to the next segment; using duration ${p/90} ms for the last video frame.`)):p=o}else p=o}const h=Math.round(t.pts-t.dts);C=Math.min(C,p),R=Math.max(R,p),x=Math.min(x,l),D=Math.max(D,l),o.push(new ig(t.key,p,d,h))}if(o.length)if(Ym){if(Ym<70){const e=o[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(Qm&&D-x0&&(s&&Math.abs(g-m)<9e3||Math.abs(Zm(p[0].pts-y,g)-m)<20*l),p.forEach((function(e){e.pts=Zm(e.pts-y,g)})),!i||m<0){if(p=p.filter((e=>e.pts>=0)),!p.length)return;m=0===r?0:s&&!u?Math.max(0,g):p[0].pts}if("aac"===e.segmentCodec){const t=this.config.maxAudioFramesDrift;for(let i=0,s=m;i=t*l&&d<1e4&&u){let t=Math.round(n/l);s=o-t*l,s<0&&(t--,s+=l),0===i&&(this.nextAudioPts=m=s),hc.warn(`[mp4-remuxer]: Injecting ${t} audio frame @ ${(s/a).toFixed(3)}s due to ${Math.round(1e3*n/a)} ms gap.`);for(let a=0;a0))return;_+=f;try{A=new Uint8Array(_)}catch(e){return void this.observer.emit(sc.ERROR,sc.ERROR,{type:rc.MUX_ERROR,details:ac.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:_,reason:`fail allocating audio mdat ${_}`})}if(!h){new DataView(A.buffer).setUint32(0,_),A.set(Wm.types.mdat,4)}}A.set(r,f);const l=r.byteLength;f+=l,c.push(new ig(!0,n,l,0)),v=a}const w=c.length;if(!w)return;const E=c[c.length-1];this.nextAudioPts=m=v+o*E.duration;const T=h?new Uint8Array(0):Wm.moof(e.sequenceNumber++,b/o,Zh({},e,{samples:c}));e.samples=[];const k=b/a,C=m/a,x={data1:T,data2:A,startPTS:k,endPTS:C,startDTS:k,endDTS:C,type:"audio",hasAudio:!0,hasVideo:!1,nb:w};return this.isAudioContiguous=!0,x}remuxEmptyAudio(e,t,i,s){const r=e.inputTimeScale,a=r/(e.samplerate?e.samplerate:r),o=this.nextAudioPts,n=this._initDTS,l=9e4*n.baseTime/n.timescale,d=(null!==o?o:s.startDTS*r)+l,h=s.endDTS*r+l,c=1024*a,u=Math.ceil((h-d)/c),p=Vm.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(hc.warn("[mp4-remuxer]: remux empty Audio"),!p)return void hc.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");const f=[];for(let e=0;e4294967296;)e+=i;return e}function eg(e,t,i,s){const r=e.samples.length;if(!r)return;const a=e.inputTimeScale;for(let o=0;oe.pts-t.pts));const a=e.samples;return e.samples=[],{samples:a}}class ig{constructor(e,t,i,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=i,this.cts=s,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}function sg(e,t){const i=null==e?void 0:e.codec;if(i&&i.length>4)return i;if(t===yc){if("ec-3"===i||"ac-3"===i||"alac"===i)return i;if("fLaC"===i||"Opus"===i){return $u(i,!1)}const e="mp4a.40.5";return hc.info(`Parsed audio codec "${i}" or audio object type not handled. Using "${e}"`),e}return hc.warn(`Unhandled video codec "${i}"`),"hvc1"===i||"hev1"===i?"hvc1.1.6.L120.90":"av01"===i?"av01.0.04M.08":"avc1.42e01e"}try{Km=self.performance.now.bind(self.performance)}catch(e){hc.debug("Unable to use Performance API on this environment"),Km=null==Cc?void 0:Cc.Date.now}const rg=[{demux:class{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,i,s){const r=this.videoTrack=lm("video",1),a=this.audioTrack=lm("audio",1),o=this.txtTrack=lm("text",1);if(this.id3Track=lm("id3",1),this.timeOffset=0,null==e||!e.byteLength)return;const n=mu(e);if(n.video){const{id:e,timescale:t,codec:i}=n.video;r.id=e,r.timescale=o.timescale=t,r.codec=i}if(n.audio){const{id:e,timescale:t,codec:i}=n.audio;a.id=e,a.timescale=t,a.codec=i}o.id=ou.text,r.sampleDuration=0,r.duration=a.duration=s}resetContiguity(){this.remainderData=null}static probe(e){return function(e){const t=e.byteLength;for(let i=0;i8&&109===e[i+4]&&111===e[i+5]&&111===e[i+6]&&102===e[i+7])return!0;i=s>1?i+s:t}return!1}(e)}demux(e,t){this.timeOffset=t;let i=e;const s=this.videoTrack,r=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Su(this.remainderData,e));const t=function(e){const t={valid:null,remainder:null},i=pu(e,["moof"]);if(i.length<2)return t.remainder=e,t;const s=i[i.length-1];return t.valid=Nc(e,0,s.byteOffset-8),t.remainder=Nc(e,s.byteOffset-8),t}(i);this.remainderData=t.remainder,s.samples=t.valid||new Uint8Array}else s.samples=i;const a=this.extractID3Track(s,t);return r.samples=wu(t,s),{videoTrack:s,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,i=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const s=this.extractID3Track(t,this.timeOffset);return i.samples=wu(e,t),{videoTrack:t,audioTrack:lm(),id3Track:s,textTrack:lm()}}extractID3Track(e,t){const i=this.id3Track;if(e.samples.length){const s=pu(e.samples,["emsg"]);s&&s.forEach((e=>{const s=function(e){const t=e[0];let i="",s="",r=0,a=0,o=0,n=0,l=0,d=0;if(0===t){for(;"\0"!==nu(e.subarray(d,d+1));)i+=nu(e.subarray(d,d+1)),d+=1;for(i+=nu(e.subarray(d,d+1)),d+=1;"\0"!==nu(e.subarray(d,d+1));)s+=nu(e.subarray(d,d+1)),d+=1;s+=nu(e.subarray(d,d+1)),d+=1,r=du(e,12),a=du(e,16),n=du(e,20),l=du(e,24),d=28}else if(1===t){d+=4,r=du(e,d),d+=4;const t=du(e,d);d+=4;const a=du(e,d);for(d+=4,o=2**32*t+a,tc(o)||(o=Number.MAX_SAFE_INTEGER,hc.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),n=du(e,d),d+=4,l=du(e,d),d+=4;"\0"!==nu(e.subarray(d,d+1));)i+=nu(e.subarray(d,d+1)),d+=1;for(i+=nu(e.subarray(d,d+1)),d+=1;"\0"!==nu(e.subarray(d,d+1));)s+=nu(e.subarray(d,d+1)),d+=1;s+=nu(e.subarray(d,d+1)),d+=1}return{schemeIdUri:i,value:s,timeScale:r,presentationTime:o,presentationTimeDelta:a,eventDuration:n,id:l,payload:e.subarray(d,e.byteLength)}}(e);if(Rm.test(s.schemeIdUri)){const e=ec(s.presentationTime)?s.presentationTime/s.timeScale:t+s.presentationTimeDelta/s.timeScale;let r=4294967295===s.eventDuration?Number.POSITIVE_INFINITY:s.eventDuration/s.timeScale;r<=.001&&(r=Number.POSITIVE_INFINITY);const a=s.payload;i.samples.push({data:a,len:a.byteLength,dts:e,pts:e,type:wp,duration:r})}}))}return i}demuxSampleAes(e,t,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}},remux:class{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,i,s){this.audioCodec=t,this.videoCodec=i,this.generateInitSegment(function(e,t){if(!e||!t)return e;const i=t.keyId;i&&t.isCommonEncryption&&pu(e,["moov","trak"]).forEach((e=>{const t=pu(e,["mdia","minf","stbl","stsd"])[0].subarray(8);let s=pu(t,["enca"]);const r=s.length>0;r||(s=pu(t,["encv"])),s.forEach((e=>{pu(r?e.subarray(28):e.subarray(78),["sinf"]).forEach((e=>{const t=vu(e);if(t){const e=t.subarray(8,24);e.some((e=>0!==e))||(hc.log(`[eme] Patching keyId in 'enc${r?"a":"v"}>sinf>>tenc' box: ${su(e)} -> ${su(i)}`),t.set(i,8))}}))}))}));return e}(e,s)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:i}=this;if(null==e||!e.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const s=this.initData=mu(e);s.audio&&(t=sg(s.audio,yc)),s.video&&(i=sg(s.video,Ac));const r={};s.audio&&s.video?r.audiovideo={container:"video/mp4",codec:t+","+i,initSegment:e,id:"main"}:s.audio?r.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:s.video?r.video={container:"video/mp4",codec:i,initSegment:e,id:"main"}:hc.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=r}remux(e,t,i,s,r,a){var o,n;let{initPTS:l,lastEndTime:d}=this;const h={audio:void 0,video:void 0,text:s,id3:i,initSegment:void 0};ec(d)||(d=this.lastEndTime=r||0);const c=t.samples;if(null==c||!c.length)return h;const u={initPTS:void 0,timescale:1};let p=this.initData;if(null!=(o=p)&&o.length||(this.generateInitSegment(c),p=this.initData),null==(n=p)||!n.length)return hc.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),h;this.emitInitSegment&&(u.tracks=this.initTracks,this.emitInitSegment=!1);const f=function(e,t){let i=0,s=0,r=0;const a=pu(e,["moof","traf"]);for(let e=0;ee+t.info.duration||0),0);i=Math.max(i,e+a.earliestPresentationTime/a.timescale),s=i-t}}if(s&&ec(s))return s}return s||r}(c,p),m=function(e,t){return pu(t,["moof","traf"]).reduce(((t,i)=>{const s=pu(i,["tfdt"])[0],r=s[0],a=pu(i,["tfhd"]).reduce(((t,i)=>{const a=du(i,4),o=e[a];if(o){let e=du(s,4);if(1===r){if(e===ru)return hc.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),t;e*=ru+1,e+=du(s,8)}const i=e/(o.timescale||9e4);if(ec(i)&&(null===t||ir}(l,g,r,f)||u.timescale!==l.timescale&&a)&&(u.initPTS=g-r,l&&1===l.timescale&&hc.warn("Adjusting initPTS by "+(u.initPTS-l.baseTime)),this.initPTS=l={baseTime:u.initPTS,timescale:1});const y=e?g-l.baseTime/l.timescale:d,A=y+f;!function(e,t,i){pu(t,["moof","traf"]).forEach((t=>{pu(t,["tfhd"]).forEach((s=>{const r=du(s,4),a=e[r];if(!a)return;const o=a.timescale||9e4;pu(t,["tfdt"]).forEach((e=>{const t=e[0],s=i*o;if(s){let i=du(e,4);if(0===t)i-=s,i=Math.max(i,0),uu(e,4,i);else{i*=Math.pow(2,32),i+=du(e,8),i-=s,i=Math.max(i,0);const t=Math.floor(i/(ru+1)),r=Math.floor(i%(ru+1));uu(e,4,t),uu(e,8,r)}}}))}))}))}(p,c,l.baseTime/l.timescale),f>0?this.lastEndTime=A:(hc.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const b=!!p.audio,v=!!p.video;let _="";b&&(_+="audio"),v&&(_+="video");const S={data1:c,startPTS:y,startDTS:y,endPTS:A,endDTS:A,type:_,hasAudio:b,hasVideo:v,nb:1,dropped:0};return h.audio="audio"===S.type?S:void 0,h.video="audio"!==S.type?S:void 0,h.initSegment=u,h.id3=eg(i,r,l,l),s.samples.length&&(h.text=tg(s,r,l)),h}}},{demux:Om,remux:Xm},{demux:class extends dm{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,i,s){super.resetInitSegment(e,t,i,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Gc(e,0);let i=(null==t?void 0:t.length)||0;if(xm(e,i))return!1;for(let t=e.length;i0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(i=t);return i}(a,t);if(b&&"AES-128"===b.method){const e=this.getDecrypter();if(!e.isSync())return this.decryptionPromise=e.webCryptoDecrypt(a,b.key.buffer,b.iv.buffer).then((e=>{const t=this.push(e,null,i);return this.decryptionPromise=null,t})),this.decryptionPromise;{let t=e.softwareDecrypt(a,b.key.buffer,b.iv.buffer);if(i.part>-1&&(t=e.flush()),!t)return r.executeEnd=Km(),og(i);a=new Uint8Array(t)}}const v=this.needsProbing(d,h);if(v){const e=this.configureTransmuxer(a);if(e)return hc.warn(`[transmuxer] ${e.message}`),this.observer.emit(sc.ERROR,sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.FRAG_PARSING_ERROR,fatal:!1,error:e,reason:e.message}),r.executeEnd=Km(),og(i)}(d||h||p||v)&&this.resetInitSegment(A,f,m,y,t),(d||p||v)&&this.resetInitialTimestamp(g),l||this.resetContiguity();const _=this.transmux(a,b,u,c,i),S=this.currentTransmuxState;return S.contiguous=!0,S.discontinuity=!1,S.trackSwitch=!1,r.executeEnd=Km(),_}flush(e){const t=e.transmuxing;t.executeStart=Km();const{decrypter:i,currentTransmuxState:s,decryptionPromise:r}=this;if(r)return r.then((()=>this.flush(e)));const a=[],{timeOffset:o}=s;if(i){const t=i.flush();t&&a.push(this.push(t,null,e))}const{demuxer:n,remuxer:l}=this;if(!n||!l)return t.executeEnd=Km(),[og(e)];const d=n.flush(o);return ng(d)?d.then((t=>(this.flushRemux(a,t,e),a))):(this.flushRemux(a,d,e),a)}flushRemux(e,t,i){const{audioTrack:s,videoTrack:r,id3Track:a,textTrack:o}=t,{accurateTimeOffset:n,timeOffset:l}=this.currentTransmuxState;hc.log(`[transmuxer.ts]: Flushed fragment ${i.sn}${i.part>-1?" p: "+i.part:""} of level ${i.level}`);const d=this.remuxer.remux(s,r,a,o,l,n,!0,this.id);e.push({remuxResult:d,chunkMeta:i}),i.transmuxing.executeEnd=Km()}resetInitialTimestamp(e){const{demuxer:t,remuxer:i}=this;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,s,r){const{demuxer:a,remuxer:o}=this;a&&o&&(a.resetInitSegment(e,t,i,s),o.resetInitSegment(e,t,i,r))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,i,s,r){let a;return a=t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,i,s,r):this.transmuxUnencrypted(e,i,s,r),a}transmuxUnencrypted(e,t,i,s){const{audioTrack:r,videoTrack:a,id3Track:o,textTrack:n}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(r,a,o,n,t,i,!1,this.id),chunkMeta:s}}transmuxSampleAes(e,t,i,s,r){return this.demuxer.demuxSampleAes(e,t,i).then((e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,i,s,!1,this.id),chunkMeta:r})))}configureTransmuxer(e){const{config:t,observer:i,typeSupported:s,vendor:r}=this;let a;for(let t=0,i=rg.length;t({remuxResult:{},chunkMeta:e});function ng(e){return"then"in e&&e.then instanceof Function}class lg{constructor(e,t,i,s,r){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=s,this.defaultInitPts=r||null}}class dg{constructor(e,t,i,s,r,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=s,this.timeOffset=r,this.initSegmentChange=a}}var hg={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function s(){}function r(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function a(e,t,s,a,o){if("function"!=typeof s)throw new TypeError("The listener must be a function");var n=new r(s,a||e,o),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],n]:e._events[l].push(n):(e._events[l]=n,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function n(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),n.prototype.eventNames=function(){var e,s,r=[];if(0===this._eventsCount)return r;for(s in e=this._events)t.call(e,s)&&r.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},n.prototype.listeners=function(e){var t=i?i+e:e,s=this._events[t];if(!s)return[];if(s.fn)return[s.fn];for(var r=0,a=s.length,o=new Array(a);r{(t=t||{}).frag=this.frag,t.id=this.id,e===sc.ERROR&&(this.error=t.error),this.hls.trigger(e,t)};this.observer=new cg,this.observer.on(sc.FRAG_DECRYPTED,a),this.observer.on(sc.ERROR,a);const o=Uu(r.preferManagedMediaSource)||{isTypeSupported:()=>!1},n={mpeg:o.isTypeSupported("audio/mpeg"),mp3:o.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:o.isTypeSupported('audio/mp4; codecs="ac-3"')},l=navigator.vendor;if(this.useWorker&&"undefined"!=typeof Worker){if(r.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{r.workerPath?(hc.log(`loading Web Worker ${r.workerPath} for "${t}"`),this.workerContext=function(e){const t=new self.URL(e,self.location.href).href;return{worker:new self.Worker(t),scriptURL:t}}(r.workerPath)):(hc.log(`injecting Web Worker for "${t}"`),this.workerContext=function(){const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),t=self.URL.createObjectURL(e);return{worker:new self.Worker(t),objectURL:t}}()),this.onwmsg=e=>this.onWorkerMessage(e);const{worker:e}=this.workerContext;e.addEventListener("message",this.onwmsg),e.onerror=e=>{const i=new Error(`${e.message} (${e.filename}:${e.lineno})`);r.enableWorker=!1,hc.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(sc.ERROR,{type:rc.OTHER_ERROR,details:ac.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:i})},e.postMessage({cmd:"init",typeSupported:n,vendor:l,id:t,config:JSON.stringify(r)})}catch(e){hc.warn(`Error setting up "${t}" Web Worker, fallback to inline`,e),this.resetWorker(),this.error=null,this.transmuxer=new ag(this.observer,n,r,l,t)}return}}this.transmuxer=new ag(this.observer,n,r,l,t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,i,s,r,a,o,n,l,d){var h,c;l.transmuxing.start=self.performance.now();const{transmuxer:u}=this,p=a?a.start:r.start,f=r.decryptdata,m=this.frag,g=!(m&&r.cc===m.cc),y=!(m&&l.level===m.level),A=m?l.sn-m.sn:-1,b=this.part?l.part-this.part.index:-1,v=0===A&&l.id>1&&l.id===(null==m?void 0:m.stats.chunkCount),_=!y&&(1===A||0===A&&(1===b||v&&b<=0)),S=self.performance.now();(y||A||0===r.stats.parsing.start)&&(r.stats.parsing.start=S),!a||!b&&_||(a.stats.parsing.start=S);const w=!(m&&(null==(h=r.initSegment)?void 0:h.url)===(null==(c=m.initSegment)?void 0:c.url)),E=new dg(g,_,n,y,p,w);if(!_||g||w){hc.log(`[transmuxer-interface, ${r.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}\n discontinuity: ${g}\n trackSwitch: ${y}\n contiguous: ${_}\n accurateTimeOffset: ${n}\n timeOffset: ${p}\n initSegmentChange: ${w}`);const e=new lg(i,s,t,o,d);this.configureTransmuxer(e)}if(this.frag=r,this.part=a,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:f,chunkMeta:l,state:E},e instanceof ArrayBuffer?[e]:[]);else if(u){const t=u.push(e,f,l,E);ng(t)?(u.async=!0,t.then((e=>{this.handleTransmuxComplete(e)})).catch((e=>{this.transmuxerError(e,l,"transmuxer-interface push error")}))):(u.async=!1,this.handleTransmuxComplete(t))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let i=t.flush(e);ng(i)||t.async?(ng(i)||(i=Promise.resolve(i)),i.then((t=>{this.handleFlushResult(t,e)})).catch((t=>{this.transmuxerError(t,e,"transmuxer-interface flush error")}))):this.handleFlushResult(i,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach((e=>{this.handleTransmuxComplete(e)})),this.onFlush(t)}onWorkerMessage(e){const t=e.data,i=this.hls;switch(t.event){case"init":{var s;const e=null==(s=this.workerContext)?void 0:s.objectURL;e&&self.URL.revokeObjectURL(e);break}case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":hc[t.data.logType]&&hc[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}function pg(e,t){if(e.length!==t.length)return!1;for(let i=0;ie[i]!==t[i]))}function mg(e,t){return t.label.toLowerCase()===e.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(e.lang||"").toLowerCase())}class gg{constructor(e){this.buffered=void 0;const t=(t,i,s)=>{if((i>>>=0)>s-1)throw new DOMException(`Failed to execute '${t}' on 'TimeRanges': The index provided (${i}) is greater than the maximum bound (${s})`);return e[i][t]};this.buffered={get length(){return e.length},end:i=>t("end",i,e.length),start:i=>t("start",i,e.length)}}}class yg{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,i){const s=this.queues[t];s.push(e),1!==s.length||i||this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const i=new Promise((e=>{t=e})),s={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(s,e),i}executeNext(e){const t=this.queues[e];if(t.length){const i=t[0];try{i.execute()}catch(t){hc.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${t}`),i.onError(t);const s=this.buffers[e];null!=s&&s.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Ag=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;function bg(e){const t=e.querySelectorAll("source");[].slice.call(t).forEach((t=>{e.removeChild(t)}))}const vg={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},_g=function(e){let t=e;return vg.hasOwnProperty(e)&&(t=vg[e]),String.fromCharCode(t)},Sg=15,wg=100,Eg={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Tg={17:2,18:4,21:6,22:8,23:10,19:13,20:15},kg={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},Cg={25:2,26:4,29:6,30:8,31:10,27:13,28:15},xg=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class Rg{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const i="function"==typeof t?t():t;hc.log(`${this.time} [${e}] ${i}`)}}}const Dg=function(e){const t=[];for(let i=0;iwg&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=wg)}moveCursor(e){const t=this.pos+e;if(e>1)for(let e=this.pos+1;e=144&&this.backSpace();const t=_g(e);this.pos>=wg?this.logger.log(0,(()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!")):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))}clearFromPos(e){let t;for(t=e;t"pacData = "+JSON.stringify(e)));let t=e.row-1;if(this.nrRollUpRows&&t"bkgData = "+JSON.stringify(e))),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,(()=>this.getDisplayText()));const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let i="",s=-1;for(let i=0;i0&&(i=e?"["+t.join(" | ")+"]":t.join("\n")),i}getTextAndFormat(){return this.rows}}class Mg{constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new Ig(i),this.nonDisplayedMemory=new Ig(i),this.lastOutputScreen=new Ig(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,(()=>"MODE="+e)),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let t=0;tt+": "+this.writeScreen.getDisplayText(!0))),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,(()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0))),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(()=>"DISP: "+this.displayedMemory.getDisplayText()))}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{const i=Math.floor(e/2)-16,s=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=s[i]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class Ug{constructor(e,t,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const s=this.logger=new Rg;this.channels=[null,new Mg(e,t,s),new Mg(e+1,i,s)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){let i,s,r,a=!1;this.logger.time=e;for(let e=0;e ("+Dg([s,r])+")"),i=this.parseCmd(s,r),i||(i=this.parseMidrow(s,r)),i||(i=this.parsePAC(s,r)),i||(i=this.parseBackgroundAttributes(s,r)),!i&&(a=this.parseChars(s,r),a)){const e=this.currentChannel;if(e&&e>0){this.channels[e].insertChars(a)}else this.logger.log(2,"No channel found yet. TEXT-MODE?")}i||a||this.logger.log(2,"Couldn't parse cleaned data "+Dg([s,r])+" orig: "+Dg([t[e],t[e+1]]))}}parseCmd(e,t){const{cmdHistory:i}=this;if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=33&&t<=35))return!1;if(Og(e,t,i))return Fg(null,null,i),this.logger.log(3,"Repeated command ("+Dg([e,t])+") is dropped"),!0;const s=20===e||21===e||23===e?1:2,r=this.channels[s];return 20===e||21===e||28===e||29===e?32===t?r.ccRCL():33===t?r.ccBS():34===t?r.ccAOF():35===t?r.ccAON():36===t?r.ccDER():37===t?r.ccRU(2):38===t?r.ccRU(3):39===t?r.ccRU(4):40===t?r.ccFON():41===t?r.ccRDC():42===t?r.ccTR():43===t?r.ccRTD():44===t?r.ccEDM():45===t?r.ccCR():46===t?r.ccENM():47===t&&r.ccEOC():r.ccTO(t-32),Fg(e,t,i),this.currentChannel=s,!0}parseMidrow(e,t){let i=0;if((17===e||25===e)&&t>=32&&t<=47){if(i=17===e?1:2,i!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const s=this.channels[i];return!!s&&(s.ccMIDROW(t),this.logger.log(3,"MIDROW ("+Dg([e,t])+")"),!0)}return!1}parsePAC(e,t){let i;const s=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127)&&!((16===e||24===e)&&t>=64&&t<=95))return!1;if(Og(e,t,s))return Fg(null,null,s),!0;const r=e<=23?1:2;i=t>=64&&t<=95?1===r?Eg[e]:kg[e]:1===r?Tg[e]:Cg[e];const a=this.channels[r];return!!a&&(a.setPAC(this.interpretPAC(i,t)),Fg(e,t,s),this.currentChannel=r,!0)}interpretPAC(e,t){let i;const s={color:null,italics:!1,indent:null,underline:!1,row:e};return i=t>95?t-96:t-64,s.underline=1==(1&i),i<=13?s.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(s.italics=!0,s.color="white"):s.indent=4*Math.floor((i-16)/2),s}parseChars(e,t){let i,s=null,r=null;if(e>=25?(i=2,r=e-8):(i=1,r=e),r>=17&&r<=19){let e;e=17===r?t+80:18===r?t+112:t+144,this.logger.log(2,"Special char '"+_g(e)+"' in channel "+i),s=[e]}else e>=32&&e<=127&&(s=0===t?[e]:[e,t]);if(s){const i=Dg(s);this.logger.log(3,"Char codes = "+i.join(",")),Fg(e,t,this.cmdHistory)}return s}parseBackgroundAttributes(e,t){if(!((16===e||24===e)&&t>=32&&t<=47)&&!((23===e||31===e)&&t>=45&&t<=47))return!1;let i;const s={};16===e||24===e?(i=Math.floor((t-32)/2),s.background=xg[i],t%2==1&&(s.background=s.background+"_semi")):45===t?s.background="transparent":(s.foreground="black",47===t&&(s.underline=!0));const r=e<=23?1:2;return this.channels[r].setBkgData(s),Fg(e,t,this.cmdHistory),!0}reset(){for(let e=0;ee)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var jg=function(){if(null!=Cc&&Cc.VTTCue)return self.VTTCue;const e=["","lr","rl"],t=["start","middle","end","left","right"];function i(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;const i=t.toLowerCase();return!!~e.indexOf(i)&&i}function s(e){return i(t,e)}function r(e,...t){let i=1;for(;i100)throw new Error("Position must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(n,"positionAlign",r({},l,{get:function(){return v},set:function(e){const t=s(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");v=t,this.hasBeenReset=!0}})),Object.defineProperty(n,"size",r({},l,{get:function(){return _},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");_=e,this.hasBeenReset=!0}})),Object.defineProperty(n,"align",r({},l,{get:function(){return S},set:function(e){const t=s(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");S=t,this.hasBeenReset=!0}})),n.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class zg{decode(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Gg(e){function t(e,t,i,s){return 3600*(0|e)+60*(0|t)+(0|i)+parseFloat(s||0)}const i=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?t(i[2],i[3],0,i[4]):t(i[1],i[2],i[3],i[4]):null}class Hg{constructor(){this.values=Object.create(null)}set(e,t){this.get(e)||""===t||(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let s=0;s=0&&i<=100)return this.set(e,i),!0}return!1}}function Vg(e,t,i,s){const r=s?e.split(s):[e];for(const e in r){if("string"!=typeof r[e])continue;const s=r[e].split(i);if(2!==s.length)continue;t(s[0],s[1])}}const $g=new jg(0,0,""),Wg="middle"===$g.align?"middle":"center";function Jg(e,t,i){const s=e;function r(){const t=Gg(e);if(null===t)throw new Error("Malformed timestamp: "+s);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=r(),a(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+s);e=e.slice(3),a(),t.endTime=r(),a(),function(e,t){const s=new Hg;Vg(e,(function(e,t){let r;switch(e){case"region":for(let r=i.length-1;r>=0;r--)if(i[r].id===t){s.set(e,i[r].region);break}break;case"vertical":s.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),s.integer(e,r[0]),s.percent(e,r[0])&&s.set("snapToLines",!1),s.alt(e,r[0],["auto"]),2===r.length&&s.alt("lineAlign",r[1],["start",Wg,"end"]);break;case"position":r=t.split(","),s.percent(e,r[0]),2===r.length&&s.alt("positionAlign",r[1],["start",Wg,"end","line-left","line-right","auto"]);break;case"size":s.percent(e,t);break;case"align":s.alt(e,t,["start",Wg,"end","left","right"])}}),/:/,/\s/),t.region=s.get("region",null),t.vertical=s.get("vertical","");let r=s.get("line","auto");"auto"===r&&-1===$g.line&&(r=-1),t.line=r,t.lineAlign=s.get("lineAlign","start"),t.snapToLines=s.get("snapToLines",!0),t.size=s.get("size",100),t.align=s.get("align",Wg);let a=s.get("position","auto");"auto"===a&&50===$g.position&&(a="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=a}(e,t)}function qg(e){return e.replace(//gi,"\n")}class Kg{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new zg,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;function i(){let e=t.buffer,i=0;for(e=qg(e);i>>0).toString()};function Zg(e,t,i){return Xg(e.toString())+Xg(t.toString())+Xg(i)}function ey(e,t,i,s,r,a,o){const n=new Kg,l=eu(new Uint8Array(e)).trim().replace(Yg,"\n").split("\n"),d=[],h=t?function(e,t=1){return Jm(e,9e4,1/t)}(t.baseTime,t.timescale):0;let c,u="00:00.000",p=0,f=0,m=!0;n.oncue=function(e){const a=i[s];let o=i.ccOffset;const n=(p-h)/9e4;if(null!=a&&a.new&&(void 0!==f?o=i.ccOffset=a.start:function(e,t,i){let s=e[t],r=e[s.prevCC];if(!r||!r.new&&s.new)return e.ccOffset=e.presentationOffset=s.start,void(s.new=!1);for(;null!=(a=r)&&a.new;){var a;e.ccOffset+=s.start-r.start,s.new=!1,s=r,r=e[s.prevCC]}e.presentationOffset=i}(i,s,n)),n){if(!t)return void(c=new Error("Missing initPTS for VTT MPEGTS"));o=n-i.presentationOffset}const l=e.endTime-e.startTime,u=Zm(9e4*(e.startTime+o-f),9e4*r)/9e4;e.startTime=Math.max(u,0),e.endTime=Math.max(u+l,0);const m=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(m)),e.id||(e.id=Zg(e.startTime,e.endTime,m)),e.endTime>0&&d.push(e)},n.onparsingerror=function(e){c=e},n.onflush=function(){c?o(c):a(d)},l.forEach((e=>{if(m){if(Qg(e,"X-TIMESTAMP-MAP=")){m=!1,e.slice(16).split(",").forEach((e=>{Qg(e,"LOCAL:")?u=e.slice(6):Qg(e,"MPEGTS:")&&(p=parseInt(e.slice(7)))}));try{f=function(e){let t=parseInt(e.slice(-3));const i=parseInt(e.slice(-6,-4)),s=parseInt(e.slice(-9,-7)),r=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!(ec(t)&&ec(i)&&ec(s)&&ec(r)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*i,t+=6e4*s,t+=36e5*r,t}(u)/1e3}catch(e){c=e}return}""===e&&(m=!1)}n.parse(e+"\n")})),n.flush()}const ty="stpp.ttml.im1t",iy=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,sy=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,ry={left:"start",center:"center",right:"end",start:"start",end:"end"};function ay(e,t,i,s){const r=pu(new Uint8Array(e),["mdat"]);if(0===r.length)return void s(new Error("Could not parse IMSC1 mdat"));const a=r.map((e=>eu(e))),o=function(e,t,i=1,s=!1){return Jm(e,t,1/i,s)}(t.baseTime,1,t.timescale);try{a.forEach((e=>i(function(e,t){const i=new DOMParser,s=i.parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(r).reduce(((e,t)=>(e[t]=s.getAttribute(`ttp:${t}`)||r[t],e)),{}),o="preserve"!==s.getAttribute("xml:space"),n=ny(oy(s,"styling","style")),l=ny(oy(s,"layout","region")),d=oy(s,"body","[begin]");return[].map.call(d,(e=>{const i=ly(e,o);if(!i||!e.hasAttribute("begin"))return null;const s=cy(e.getAttribute("begin"),a),r=cy(e.getAttribute("dur"),a);let d=cy(e.getAttribute("end"),a);if(null===s)throw hy(e);if(null===d){if(null===r)throw hy(e);d=s+r}const h=new jg(s-t,d-t,i);h.id=Zg(h.startTime,h.endTime,h.text);const c=function(e,t,i){const s="http://www.w3.org/ns/ttml#styling";let r=null;const a=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;o&&i.hasOwnProperty(o)&&(r=i[o]);return a.reduce(((i,a)=>{const o=dy(t,s,a)||dy(e,s,a)||dy(r,s,a);return o&&(i[a]=o),i}),{})}(l[e.getAttribute("region")],n[e.getAttribute("style")],n),{textAlign:u}=c;if(u){const e=ry[u];e&&(h.lineAlign=e),h.align=u}return Zh(h,c),h})).filter((e=>null!==e))}(e,o))))}catch(e){s(e)}}function oy(e,t,i){const s=e.getElementsByTagName(t)[0];return s?[].slice.call(s.querySelectorAll(i)):[]}function ny(e){return e.reduce(((e,t)=>{const i=t.getAttribute("xml:id");return i&&(e[i]=t),e}),{})}function ly(e,t){return[].slice.call(e.childNodes).reduce(((e,i,s)=>{var r;return"br"===i.nodeName&&s?e+"\n":null!=(r=i.childNodes)&&r.length?ly(i,t):t?e+i.textContent.trim().replace(/\s+/g," "):e+i.textContent}),"")}function dy(e,t,i){return e&&e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function hy(e){return new Error(`Could not parse ttml timestamp ${e}`)}function cy(e,t){if(!e)return null;let i=Gg(e);return null===i&&(iy.test(e)?i=function(e,t){const i=iy.exec(e),s=(0|i[4])+(0|i[5])/t.subFrameRate;return 3600*(0|i[1])+60*(0|i[2])+(0|i[3])+s/t.frameRate}(e,t):sy.test(e)&&(i=function(e,t){const i=sy.exec(e),s=Number(i[1]);switch(i[2]){case"h":return 3600*s;case"m":return 60*s;case"ms":return 1e3*s;case"f":return s/t.frameRate;case"t":return s/t.tickRate}return s}(e,t))),i}function uy(e){return e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles"}function py(e,t){return!!e&&e.kind===uy(t)&&mg(t,e)}class fy{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(sc.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(sc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(sc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(sc.BUFFER_CODECS,this.onBufferCodecs,this),e.on(sc.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(sc.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(sc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(sc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(sc.BUFFER_CODECS,this.onBufferCodecs,this),e.off(sc.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const i=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,i.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&ec(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const e=this.hls.levels;if(e.length){const t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&hc.log(`Setting autoLevelCapping to ${i}: ${e[i].height}p@${e[i].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=i,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const i=t.filter(((t,i)=>this.isLevelAllowed(t)&&i<=e));return this.clientRect=null,fy.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return e}isLevelAllowed(e){return!this.restrictedLevels.some((t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height))}static getMaxLevelByMediaSize(e,t,i){if(null==e||!e.length)return-1;let s=e.length-1;const r=Math.max(t,i);for(let t=0;t=r||i.height>=r)&&(a=i,!(o=e[t+1])||a.width!==o.width||a.height!==o.height)){s=t;break}}var a,o;return s}}const my="[eme]";class gy{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=gy.CDMCleanupPromise?[gy.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=hc.debug.bind(hc,my),this.log=hc.log.bind(hc,my),this.warn=hc.warn.bind(hc,my),this.error=hc.error.bind(hc,my),this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null}registerListeners(){this.hls.on(sc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(sc.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(sc.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(sc.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(sc.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(sc.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:i}=this.config,s=t[e];if(s)return s.licenseUrl;if(e===xc.WIDEVINE&&i)return i;throw new Error(`no license server URL configured for key-system "${e}"`)}getServerCertificateUrl(e){const{drmSystems:t}=this.config,i=t[e];if(i)return i.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,i=(e,t,i)=>!!e&&i.indexOf(e)===t,s=t.map((e=>e.audioCodec)).filter(i),r=t.map((e=>e.videoCodec)).filter(i);return s.length+r.length===0&&r.push("avc1.42e01e"),new Promise(((t,i)=>{const a=e=>{const o=e.shift();this.getMediaKeysPromise(o,s,r).then((e=>t({keySystem:o,mediaKeys:e}))).catch((t=>{e.length?a(e):i(t instanceof yy?t:new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))}))};a(e)}))}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:i}=this.config;if("function"!=typeof i){let e=`Configured requestMediaKeySystemAccess is not a function ${i}`;return null===Fc&&"http:"===self.location.protocol&&(e=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(e))}return i(e,t)}getMediaKeysPromise(e,t,i){const s=function(e,t,i,s){let r;switch(e){case xc.FAIRPLAY:r=["cenc","sinf"];break;case xc.WIDEVINE:case xc.PLAYREADY:r=["cenc"];break;case xc.CLEARKEY:r=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${e}`)}return function(e,t,i,s){return[{initDataTypes:e,persistentState:s.persistentState||"optional",distinctiveIdentifier:s.distinctiveIdentifier||"optional",sessionTypes:s.sessionTypes||[s.sessionType||"temporary"],audioCapabilities:t.map((e=>({contentType:`audio/mp4; codecs="${e}"`,robustness:s.audioRobustness||"",encryptionScheme:s.audioEncryptionScheme||null}))),videoCapabilities:i.map((e=>({contentType:`video/mp4; codecs="${e}"`,robustness:s.videoRobustness||"",encryptionScheme:s.videoEncryptionScheme||null})))}]}(r,t,i,s)}(e,t,i,this.config.drmSystemOptions),r=this.keySystemAccessPromises[e];let a=null==r?void 0:r.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(s)}`),a=this.requestMediaKeySystemAccess(e,s);const t=this.keySystemAccessPromises[e]={keySystemAccess:a};return a.catch((t=>{this.log(`Failed to obtain access to key-system "${e}": ${t}`)})),a.then((i=>{this.log(`Access for key-system "${i.keySystem}" obtained`);const s=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),t.mediaKeys=i.createMediaKeys().then((t=>(this.log(`Media-keys created for "${e}"`),s.then((i=>i?this.setMediaKeysServerCertificate(t,e,i):t))))),t.mediaKeys.catch((t=>{this.error(`Failed to create media-keys for "${e}"}: ${t}`)})),t.mediaKeys}))}return a.then((()=>r.mediaKeys))}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:i}){this.log(`Creating key-system session "${t}" keyId: ${su(e.keyId||[])}`);const s=i.createSession(),r={decryptdata:e,keySystem:t,mediaKeys:i,mediaKeysSession:s,keyStatus:"status-pending"};return this.mediaKeySessions.push(r),r}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const i=this.createMediaKeySessionContext(e),s=this.getKeyIdString(t),r="cenc";this.keyIdToKeySessionPromise[s]=this.generateRequestWithPreferredKeySession(i,r,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return su(e.keyId)}updateKeySession(e,t){var i;const s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyID ${su((null==(i=e.decryptdata)?void 0:i.keyId)||[])}\n } (data length: ${t?t.byteLength:t})`),s.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise(((t,i)=>{const s=Uc(this.config),r=e.map(Bc).filter((e=>!!e&&-1!==s.indexOf(e)));return this.getKeySystemSelectionPromise(r).then((({keySystem:e})=>{const s=Mc(e);s?t(s):i(new Error(`Unable to find format for key-system "${e}"`))})).catch(i)}))}loadKey(e){const t=e.keyInfo.decryptdata,i=this.getKeyIdString(t),s=`(keyId: ${i} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);let r=this.keyIdToKeySessionPromise[i];return r||(r=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(t).then((({keySystem:i,mediaKeys:r})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(i,r).then((()=>{this.throwIfDestroyed();const e=this.createMediaKeySessionContext({keySystem:i,mediaKeys:r,decryptdata:t});return this.generateRequestWithPreferredKeySession(e,"cenc",t.pssh,"playlist-key")}))))),r.catch((e=>this.handleError(e)))),r}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof yy?this.hls.trigger(sc.ERROR,e.data):this.hls.trigger(sc.ERROR,{type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),i=this.keyIdToKeySessionPromise[t];if(!i){const t=Bc(e.keyFormat),i=t?[t]:Uc(this.config);return this.attemptKeySystemAccess(i)}return i}getKeySystemSelectionPromise(e){if(e.length||(e=Uc(this.config)),0===e.length)throw new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}_onMediaEncrypted(e){const{initDataType:t,initData:i}=e;if(this.debug(`"${e.type}" event: init data type: "${t}"`),null===i)return;let s,r;if("sinf"===t&&this.config.drmSystems[xc.FAIRPLAY]){const e=nu(new Uint8Array(i));try{const t=Ec(JSON.parse(e).sinf),i=vu(new Uint8Array(t));if(!i)return;s=i.subarray(8,24),r=xc.FAIRPLAY}catch(e){return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{const e=function(e){if(!(e instanceof ArrayBuffer)||e.byteLength<32)return null;const t={version:0,systemId:"",kids:null,data:null},i=new DataView(e),s=i.getUint32(0);if(e.byteLength!==s&&s>44)return null;if(1886614376!==i.getUint32(4))return null;if(t.version=i.getUint32(8)>>>24,t.version>1)return null;t.systemId=su(new Uint8Array(e,12,16));const r=i.getUint32(28);if(0===t.version){if(s-32this.generateRequestWithPreferredKeySession(r,t,i,"encrypted-event-key-match")));break}}l||(l=o[a]=this.getKeySystemSelectionPromise([r]).then((({keySystem:e,mediaKeys:r})=>{var o;this.throwIfDestroyed();const n=new Ru("ISO-23001-7",a,null!=(o=Mc(e))?o:"");return n.pssh=new Uint8Array(i),n.keyId=s,this.attemptSetMediaKeys(e,r).then((()=>{this.throwIfDestroyed();const s=this.createMediaKeySessionContext({decryptdata:n,keySystem:e,mediaKeys:r});return this.generateRequestWithPreferredKeySession(s,t,i,"encrypted-event-no-match")}))}))),l.catch((e=>this.handleError(e)))}_onWaitingForKey(e){this.log(`"${e.type}" event`)}attemptSetMediaKeys(e,t){const i=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const s=Promise.all(i).then((()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)}));return this.setMediaKeysQueue.push(s),s.then((()=>{this.log(`Media-keys set for "${e}"`),i.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter((e=>-1===i.indexOf(e)))}))}generateRequestWithPreferredKeySession(e,t,i,s){var r,a;const o=null==(r=this.config.drmSystems)||null==(a=r[e.keySystem])?void 0:a.generateRequest;if(o)try{const s=o.call(this.hls,t,i,e);if(!s)throw new Error("Invalid response from configured generateRequest filter");t=s.initDataType,i=e.decryptdata.pssh=s.initData?new Uint8Array(s.initData):null}catch(e){var n;if(this.warn(e.message),null!=(n=this.hls)&&n.config.debug)throw e}if(null===i)return this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(e);const l=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${s}": ${l} (init data type: ${t} length: ${i?i.byteLength:null})`);const d=new cg,h=e._onmessage=t=>{const i=e.mediaKeysSession;if(!i)return void d.emit("error",new Error("invalid state"));const{messageType:s,message:r}=t;this.log(`"${s}" message event for session "${i.sessionId}" message size: ${r.byteLength}`),"license-request"===s||"license-renewal"===s?this.renewLicense(e,r).catch((e=>{this.handleError(e),d.emit("error",e)})):"license-release"===s?e.keySystem===xc.FAIRPLAY&&(this.updateKeySession(e,kc("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${s}"`)},c=e._onkeystatuseschange=t=>{if(!e.mediaKeysSession)return void d.emit("error",new Error("invalid state"));this.onKeyStatusChange(e);const i=e.keyStatus;d.emit("keyStatus",i),"expired"===i&&(this.warn(`${e.keySystem} expired for key ${l}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",h),e.mediaKeysSession.addEventListener("keystatuseschange",c);const u=new Promise(((e,t)=>{d.on("error",t),d.on("keyStatus",(i=>{i.startsWith("usable")?e():"output-restricted"===i?t(new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===i?t(new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${i}"`)):"expired"===i?t(new Error("key expired while generating request")):this.warn(`unhandled key status change "${i}"`)}))}));return e.mediaKeysSession.generateRequest(t,i).then((()=>{var t;this.log(`Request generated for key-session "${null==(t=e.mediaKeysSession)?void 0:t.sessionId}" keyId: ${l}`)})).catch((e=>{throw new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_NO_SESSION,error:e,fatal:!1},`Error generating key-session request: ${e}`)})).then((()=>u)).catch((t=>{throw d.removeAllListeners(),this.removeSession(e),t})).then((()=>(d.removeAllListeners(),e)))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach(((t,i)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${su("buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i))} session keyId: ${su(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t}))}fetchServerCertificate(e){const t=this.config,i=new(0,t.loader)(t),s=this.getServerCertificateUrl(e);return s?(this.log(`Fetching server certificate for "${e}"`),new Promise(((r,a)=>{const o={responseType:"arraybuffer",url:s},n=t.certLoadPolicy.default,l={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,i,s)=>{r(e.data)},onError:(t,i,r,n)=>{a(new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:Yh({url:o.url,data:void 0},t)},`"${e}" certificate request failed (${s}). Status: ${t.code} (${t.text})`))},onTimeout:(t,i,r)=>{a(new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:r,response:{url:o.url,data:void 0}},`"${e}" certificate request timed out (${s})`))},onAbort:(e,t,i)=>{a(new Error("aborted"))}};i.load(o,l,d)}))):Promise.resolve()}setMediaKeysServerCertificate(e,t,i){return new Promise(((s,r)=>{e.setServerCertificate(i).then((r=>{this.log(`setServerCertificate ${r?"success":"not supported by CDM"} (${null==i?void 0:i.byteLength}) on "${t}"`),s(e)})).catch((e=>{r(new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))}))}))}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then((t=>this.updateKeySession(e,new Uint8Array(t)).catch((e=>{throw new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:e,fatal:!0},e.message)}))))}unpackPlayReadyKeyMessage(e,t){const i=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const s=(new DOMParser).parseFromString(i,"application/xml"),r=s.querySelectorAll("HttpHeader");if(r.length>0){let t;for(let i=0,s=r.length;i in key message");return kc(atob(l))}setupLicenseXHR(e,t,i,s){const r=this.config.licenseXhrSetup;return r?Promise.resolve().then((()=>{if(!i.decryptdata)throw new Error("Key removed");return r.call(this.hls,e,t,i,s)})).catch((a=>{if(!i.decryptdata)throw a;return e.open("POST",t,!0),r.call(this.hls,e,t,i,s)})).then((i=>{e.readyState||e.open("POST",t,!0);return{xhr:e,licenseChallenge:i||s}})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}requestLicense(e,t){const i=this.config.keyLoadPolicy.default;return new Promise(((s,r)=>{const a=this.getLicenseServerUrl(e.keySystem);this.log(`Sending license request to URL: ${a}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return r(new Error("invalid state"));if(4===o.readyState)if(200===o.status){this._requestLicenseFailureCount=0;let t=o.response;this.log(`License received ${t instanceof ArrayBuffer?t.byteLength:t}`);const i=this.config.licenseResponseCallback;if(i)try{t=i.call(this.hls,o,a,e)}catch(e){this.error(e)}s(t)}else{const n=i.errorRetry,l=n?n.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||o.status>=400&&o.status<500)r(new yy({type:rc.KEY_SYSTEM_ERROR,details:ac.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{const i=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${i} attempts left`),this.requestLicense(e,t).then(s,r)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then((({xhr:t,licenseChallenge:i})=>{e.keySystem==xc.PLAYREADY&&(i=this.unpackPlayReadyKeyMessage(t,i)),t.send(i)}))}))}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const i=t.media;this.media=i,i.addEventListener("encrypted",this.onMediaEncrypted),i.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Ru.clearKeyUriToKeyIdMap();const i=t.length;gy.CDMCleanupPromise=Promise.all(t.map((e=>this.removeSession(e))).concat(null==e?void 0:e.setMediaKeys(null).catch((e=>{this.log(`Could not clear media keys: ${e}`)})))).then((()=>{i&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)})).catch((e=>{this.log(`Could not close sessions and clear media keys: ${e}`)}))}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(t&&this.config.emeEnabled&&!this.keyFormatPromise){const e=t.reduce(((e,t)=>(-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e)),[]);this.log(`Selecting key-system from session-keys ${e.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(e)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:i}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const s=this.mediaKeySessions.indexOf(e);return s>-1&&this.mediaKeySessions.splice(s,1),t.remove().catch((e=>{this.log(`Could not remove session: ${e}`)})).then((()=>t.close())).catch((e=>{this.log(`Could not close session: ${e}`)}))}}}gy.CDMCleanupPromise=void 0;class yy extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var Ay,by,vy;!function(e){e.MANIFEST="m",e.AUDIO="a",e.VIDEO="v",e.MUXED="av",e.INIT="i",e.CAPTION="c",e.TIMED_TEXT="tt",e.KEY="k",e.OTHER="o"}(Ay||(Ay={})),function(e){e.DASH="d",e.HLS="h",e.SMOOTH="s",e.OTHER="o"}(by||(by={})),function(e){e.OBJECT="CMCD-Object",e.REQUEST="CMCD-Request",e.SESSION="CMCD-Session",e.STATUS="CMCD-Status"}(vy||(vy={}));const _y={[vy.OBJECT]:["br","d","ot","tb"],[vy.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[vy.SESSION]:["cid","pr","sf","sid","st","v"],[vy.STATUS]:["bs","rtp"]};class Sy{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map((e=>e instanceof Sy?e:new Sy(e)))),this.value=e,this.params=t}}class wy{constructor(e){this.description=void 0,this.description=e}}function Ey(e,t,i,s){return new Error(`failed to ${e} "${r=t,Array.isArray(r)?JSON.stringify(r):r instanceof Map?"Map{}":r instanceof Set?"Set{}":"object"==typeof r?JSON.stringify(r):String(r)}" as ${i}`,{cause:s});var r}const Ty="Bare Item";const ky=/[\x00-\x1f\x7f]+/;function Cy(e,t,i){return Ey("serialize",e,t,i)}function xy(e){if(!1===ArrayBuffer.isView(e))throw Cy(e,"Byte Sequence");return`:${t=e,btoa(String.fromCharCode(...t))}:`;var t}function Ry(e){if(function(e){return e<-999999999999999||99999999999999912)throw Cy(e,"Decimal");const i=t.toString();return i.includes(".")?i:`${i}.0`}function Py(e){const t=(i=e).description||i.toString().slice(7,-1);var i;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw Cy(t,"Token");return t}function By(e){switch(typeof e){case"number":if(!ec(e))throw Cy(e,Ty);return Number.isInteger(e)?Ry(e):Ly(e);case"string":return function(e){if(ky.test(e))throw Cy(e,"String");return`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(e);case"symbol":return Py(e);case"boolean":return function(e){if("boolean"!=typeof e)throw Cy(e,"Boolean");return e?"?1":"?0"}(e);case"object":if(e instanceof Date)return function(e){return`@${Ry(e.getTime()/1e3)}`}(e);if(e instanceof Uint8Array)return xy(e);if(e instanceof wy)return Py(e);default:throw Cy(e,Ty)}}function Iy(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw Cy(e,"Key");return e}function My(e){return null==e?"":Object.entries(e).map((([e,t])=>!0===t?`;${Iy(e)}`:`;${Iy(e)}=${By(t)}`)).join("")}function Uy(e){return e instanceof Sy?`${By(e.value)}${My(e.params)}`:By(e)}function Fy(e,t={whitespace:!0}){if("object"!=typeof e)throw Cy(e,"Dict");const i=e instanceof Map?e.entries():Object.entries(e),s=null!=t&&t.whitespace?" ":"";return Array.from(i).map((([e,t])=>{t instanceof Sy==!1&&(t=new Sy(t));let i=Iy(e);var s;return!0===t.value?i+=My(t.params):(i+="=",Array.isArray(t.value)?i+=`(${(s=t).value.map(Uy).join(" ")})${My(s.params)}`:i+=Uy(t)),i})).join(`,${s}`)}const Oy=e=>Math.round(e),Ny=e=>100*Oy(e/100),jy={br:Oy,d:Oy,bl:Ny,dl:Ny,mtp:Ny,nor:(e,t)=>(null!=t&&t.baseUrl&&(e=function(e,t){const i=new URL(e),s=new URL(t);if(i.origin!==s.origin)return e;const r=i.pathname.split("/").slice(1),a=s.pathname.split("/").slice(1,-1);for(;r[0]===a[0];)r.shift(),a.shift();for(;a.length;)a.shift(),r.unshift("..");return r.join("/")}(e,t.baseUrl)),encodeURIComponent(e)),rtp:Ny,tb:Oy};function zy(e,t){const i={};if(null==e||"object"!=typeof e)return i;const s=Object.keys(e).sort(),r=Zh({},jy,null==t?void 0:t.formatters),a=null==t?void 0:t.filter;return s.forEach((s=>{if(null!=a&&a(s))return;let o=e[s];const n=r[s];n&&(o=n(o,t)),"v"===s&&1===o||"pr"==s&&1===o||(e=>"number"==typeof e?ec(e):null!=e&&""!==e&&!1!==e)(o)&&((e=>"ot"===e||"sf"===e||"st"===e)(s)&&"string"==typeof o&&(o=new wy(o)),i[s]=o)})),i}function Gy(e,t={}){return e?function(e,t){return Fy(e,t)}(zy(e,t),Zh({whitespace:!1},t)):""}function Hy(e,t,i){return Zh(e,function(e,t={}){if(!e)return{};const i=Object.entries(e),s=Object.entries(_y).concat(Object.entries((null==t?void 0:t.customHeaderMap)||{})),r=i.reduce(((e,t)=>{var i;const[r,a]=t,o=(null==(i=s.find((e=>e[1].includes(r))))?void 0:i[0])||vy.REQUEST;return null!=e[o]||(e[o]={}),e[o][r]=a,e}),{});return Object.entries(r).reduce(((e,[i,s])=>(e[i]=Gy(s,t),e)),{})}(t,i))}const Vy=/CMCD=[^&#]+/;function $y(e,t,i){const s=function(e,t={}){if(!e)return"";const i=Gy(e,t);return`CMCD=${encodeURIComponent(i)}`}(t,i);if(!s)return e;if(Vy.test(e))return e.replace(Vy,s);const r=e.includes("?")?"&":"?";return`${e}${r}${s}`}function Wy(e,t,i,s){e&&Object.keys(t).forEach((r=>{const a=e.filter((e=>e.groupId===r)).map((e=>{const a=Zh({},e);return a.details=void 0,a.attrs=new pc(a.attrs),a.url=a.attrs.URI=Jy(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",i),a.groupId=a.attrs["GROUP-ID"]=t[r],a.attrs["PATHWAY-ID"]=s,a}));e.push(...a)}))}function Jy(e,t,i,s){const{HOST:r,PARAMS:a,[i]:o}=s;let n;t&&(n=null==o?void 0:o[t],n&&(e=n));const l=new self.URL(e);return r&&!n&&(l.host=r),a&&Object.keys(a).sort().forEach((e=>{e&&l.searchParams.set(e,a[e])})),l.href}const qy=/^age:\s*[\d.]+\s*$/im;class Ky{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new gc,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null,this.stats=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const i=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const r=this.xhrSetup;r?Promise.resolve().then((()=>{if(!this.stats.aborted)return r(i,t.url)})).catch((e=>(i.open("GET",t.url,!0),r(i,t.url)))).then((()=>{this.stats.aborted||this.openAndSendXhr(i,t,e)})).catch((e=>{this.callbacks.onError({code:i.status,text:e.message},t,i,s)})):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);const s=t.headers,{maxTimeToFirstByteMs:r,maxLoadTimeMs:a}=i.loadPolicy;if(s)for(const t in s)e.setRequestHeader(t,s[t]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=r&&ec(r)?r:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:i}=this;if(!e||!t)return;const s=t.readyState,r=this.config;if(!i.aborted&&s>=2&&(0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),r.timeout!==r.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),r.timeout=r.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),4===s)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const s=t.status,a="text"!==t.responseType;if(s>=200&&s<300&&(a&&t.response||null!==t.responseText)){i.loading.end=Math.max(self.performance.now(),i.loading.first);const r=a?t.response:t.responseText,o="arraybuffer"===t.responseType?r.byteLength:r.length;if(i.loaded=i.total=o,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first),!this.callbacks)return;const n=this.callbacks.onProgress;if(n&&n(i,e,r,t),!this.callbacks)return;const l={url:t.responseURL,data:r,code:s};this.callbacks.onSuccess(l,i,e,t)}else{const a=r.loadPolicy.errorRetry;Yp(a,i.retry,!1,{url:e.url,data:void 0,code:s})?this.retry(a):(hc.error(`${s} while loading ${e.url}`),this.callbacks.onError({code:s,text:t.statusText},e,t,i))}}}loadtimeout(){var e;const t=null==(e=this.config)?void 0:e.loadPolicy.timeoutRetry;if(Yp(t,this.stats.retry,!0))this.retry(t);else{var i;hc.warn(`timeout while loading ${null==(i=this.context)?void 0:i.url}`);const e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:i}=this;this.retryDelay=qp(e,i.retry),i.retry++,hc.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==t?void 0:t.url}, retrying ${i.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&qy.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const Yy=/(\d+)-(\d+)\/(\d+)/;class Qy{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Xy,this.controller=new self.AbortController,this.stats=new gc}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,i){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();const r=function(e,t){const i={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(Zh({},e.headers))};e.rangeEnd&&i.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1));return i}(e,this.controller.signal),a=i.onProgress,o="arraybuffer"===e.responseType,n=o?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:d}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=i,this.request=this.fetchSetup(e,r),self.clearTimeout(this.requestTimeout),t.timeout=l&&ec(l)?l:d,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),i.onTimeout(s,e,this.response)}),t.timeout),self.fetch(this.request).then((r=>{this.response=this.loader=r;const n=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=d,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),i.onTimeout(s,e,this.response)}),d-(n-s.loading.start)),!r.ok){const{status:e,statusText:t}=r;throw new Zy(t||"fetch, bad network response",e,r)}return s.loading.first=n,s.total=function(e){const t=e.get("Content-Range");if(t){const e=function(e){const t=Yy.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(ec(e))return e}const i=e.get("Content-Length");if(i)return parseInt(i)}(r.headers)||s.total,a&&ec(t.highWaterMark)?this.loadProgressively(r,s,e,t.highWaterMark,a):o?r.arrayBuffer():"json"===e.responseType?r.json():r.text()})).then((r=>{const o=this.response;if(!o)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const l=r[n];l&&(s.loaded=s.total=l);const d={url:o.url,data:r,code:o.status};a&&!ec(t.highWaterMark)&&a(s,e,r,o),i.onSuccess(d,s,e,o)})).catch((t=>{if(self.clearTimeout(this.requestTimeout),s.aborted)return;const r=t&&t.code||0,a=t?t.message:null;i.onError({code:r,text:a},e,t?t.details:null,s)}))}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i,s=0,r){const a=new nm,o=e.body.getReader(),n=()=>o.read().then((o=>{if(o.done)return a.dataLength&&r(t,i,a.flush(),e),Promise.resolve(new ArrayBuffer(0));const l=o.value,d=l.length;return t.loaded+=d,d=s&&r(t,i,a.flush(),e)):r(t,i,l,e),n()})).catch((()=>Promise.reject()));return n()}}function Xy(e,t){return new self.Request(e.url,t)}class Zy extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}const eA=/\s/,tA={newCue(e,t,i,s){const r=[];let a,o,n,l,d;const h=self.VTTCue||self.TextTrackCue;for(let u=0;u=16?l--:l++;const s=qg(d.trim()),p=Zg(t,i,s);null!=e&&null!=(c=e.cues)&&c.getCueById(p)||(o=new h(t,i,s),o.id=p,o.line=u+1,o.align="left",o.position=10+Math.min(80,10*Math.floor(8*l/32)),r.push(o))}return e&&r.length&&(r.sort(((e,t)=>"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line)),r.forEach((t=>yp(e,t)))),r}},iA=Yh(Yh({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Ky,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:e,partCurrent:t,hls:i}=this,{autoLevelEnabled:s,media:r}=i;if(!e||!r)return;const a=performance.now(),o=t?t.stats:e.stats,n=t?t.duration:e.duration,l=a-o.loading.start,d=i.minAutoLevel;if(o.aborted||o.loaded&&o.loaded===o.total||e.level<=d)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!s||r.paused||!r.playbackRate||!r.readyState)return;const h=i.mainForwardBufferInfo;if(null===h)return;const c=this.bwEstimator.getEstimateTTFB(),u=Math.abs(r.playbackRate);if(l<=Math.max(c,n/(2*u)*1e3))return;const p=h.len/u,f=o.loading.first?o.loading.first-o.loading.start:-1,m=o.loaded&&f>-1,g=this.getBwEstimate(),y=i.levels,A=y[e.level],b=o.total||Math.max(o.loaded,Math.round(n*A.averageBitrate/8));let v=m?l-f:l;v<1&&m&&(v=Math.min(l,8*o.loaded/g));const _=m?1e3*o.loaded/v:0,S=_?(b-o.loaded)/_:8*b/g+c/1e3;if(S<=p)return;const w=_?8*_:g;let E,T=Number.POSITIVE_INFINITY;for(E=e.level-1;E>d;E--){const e=y[E].maxBitrate;if(T=this.getTimeToLoadFrag(c/1e3,w,n*e,!y[E].details),T=S)return;if(T>10*n)return;i.nextLoadLevel=i.nextAutoLevel=E,m?this.bwEstimator.sample(l-Math.min(c,f),o.loaded):this.bwEstimator.sampleTTFB(l);const k=y[E].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>k&&this.resetEstimator(k),this.clearTimer(),hc.warn(`[abr] Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} is loading too slowly;\n Time to underbuffer: ${p.toFixed(3)} s\n Estimated load time for current fragment: ${S.toFixed(3)} s\n Estimated load time for down switch fragment: ${T.toFixed(3)} s\n TTFB estimate: ${0|f} ms\n Current BW estimate: ${ec(g)?0|g:"Unknown"} bps\n New BW estimate: ${0|this.getBwEstimate()} bps\n Switching to level ${E} @ ${0|k} bps`),i.trigger(sc.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:t,stats:o})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(hc.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new cf(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.FRAG_LOADING,this.onFragLoading,this),e.on(sc.FRAG_LOADED,this.onFragLoaded,this),e.on(sc.FRAG_BUFFERED,this.onFragBuffered,this),e.on(sc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(sc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(sc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(sc.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(sc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.FRAG_LOADING,this.onFragLoading,this),e.off(sc.FRAG_LOADED,this.onFragLoaded,this),e.off(sc.FRAG_BUFFERED,this.onFragBuffered,this),e.off(sc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(sc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(sc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(sc.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(sc.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const i=t.frag;if(!this.ignoreFragment(i)){var s;if(!i.bitrateTest)this.fragCurrent=i,this.partCurrent=null!=(s=t.part)?s:null;this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case ac.BUFFER_ADD_CODEC_ERROR:case ac.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case ac.FRAG_LOAD_TIMEOUT:{const e=t.frag,{fragCurrent:i,partCurrent:s}=this;if(e&&i&&e.sn===i.sn&&e.level===i.level){const t=performance.now(),i=s?s.stats:e.stats,r=t-i.loading.start,a=i.loading.first?i.loading.first-i.loading.start:-1;if(i.loaded&&a>-1){const e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(r-Math.min(e,a),i.loaded)}else this.bwEstimator.sampleTTFB(r)}break}}}getTimeToLoadFrag(e,t,i,s){return e+i/t+(s?this.lastLevelLoadSec:0)}onLevelLoaded(e,t){const i=this.hls.config,{loading:s}=t.stats,r=s.end-s.start;ec(r)&&(this.lastLevelLoadSec=r/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:i}){const s=i?i.stats:t.stats;if(t.type===hp&&this.bwEstimator.sampleTTFB(s.loading.first-s.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const e=i?i.duration:t.duration,r=this.hls.levels[t.level],a=(r.loaded?r.loaded.bytes:0)+s.loaded,o=(r.loaded?r.loaded.duration:0)+e;r.loaded={bytes:a,duration:o},r.realBitrate=Math.round(8*a/o)}if(t.bitrateTest){const e={stats:s,frag:t,part:i,id:t.type};this.onFragBuffered(sc.FRAG_BUFFERED,e),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:i,part:s}=t,r=null!=s&&s.stats.loaded?s.stats:i.stats;if(r.aborted)return;if(this.ignoreFragment(i))return;const a=r.parsing.end-r.loading.start-Math.min(r.loading.first-r.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,r.loaded),r.bwEstimate=this.getBwEstimate(),i.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==hp||"initSegment"===e.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,i=this.getBwEstimate(),s=this.hls.config.maxStarvationDelay,r=this.findBestLevel(i,t,e,0,s,1,1);if(r>-1)return r;const a=this.hls.firstLevel,o=Math.min(Math.max(a,t),e);return hc.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&i&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;const s=t&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){const t=this.hls.levels;if(t.length>Math.max(e,s)&&t[e].loadError<=t[s].loadError)return e}return this._nextAutoLevel=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:i}=this,{maxAutoLevel:s,config:r,minAutoLevel:a}=i,o=t?t.duration:e?e.duration:0,n=this.getBwEstimate(),l=this.getStarvationDelay();let d=r.abrBandWidthFactor,h=r.abrBandWidthUpFactor;if(l){const e=this.findBestLevel(n,a,s,l,0,d,h);if(e>=0)return e}let c=o?Math.min(o,r.maxStarvationDelay):r.maxStarvationDelay;if(!l){const e=this.bitrateTestDelay;if(e){c=(o?Math.min(o,r.maxLoadingDelay):r.maxLoadingDelay)-e,hc.info(`[abr] bitrate test took ${Math.round(1e3*e)}ms, set first fragment max fetchDuration to ${Math.round(1e3*c)} ms`),d=h=1}}const u=this.findBestLevel(n,a,s,l,c,d,h);if(hc.info(`[abr] ${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${u}`),u>-1)return u;const p=i.levels[a],f=i.levels[i.loadLevel];return(null==p?void 0:p.bitrate)<(null==f?void 0:f.bitrate)?a:i.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const i=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,s=e.mainForwardBufferInfo;return(s?s.len:0)/i}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,i,s,r,a,o){var n;const l=s+r,d=this.lastLoadedFragLevel,h=-1===d?this.hls.firstLevel:d,{fragCurrent:c,partCurrent:u}=this,{levels:p,allAudioTracks:f,loadLevel:m,config:g}=this.hls;if(1===p.length)return 0;const y=p[h],A=!(null==y||null==(n=y.details)||!n.live),b=-1===m||-1===d;let v,_="SDR",S=(null==y?void 0:y.frameRate)||0;const{audioPreference:w,videoPreference:E}=g,T=this.audioTracksByGroup||(this.audioTracksByGroup=function(e){return e.reduce(((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);const s=t.channels||"2";return i.channels[s]=(i.channels[s]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}(f));if(b){if(-1!==this.firstSelection)return this.firstSelection;const s=this.codecTiers||(this.codecTiers=function(e,t,i,s){return e.slice(i,s+1).reduce(((e,i)=>{if(!i.codecSet)return e;const s=i.audioGroups;let r=e[i.codecSet];r||(e[i.codecSet]=r={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!s,fragmentError:0}),r.minBitrate=Math.min(r.minBitrate,i.bitrate);const a=Math.min(i.height,i.width);return r.minHeight=Math.min(r.minHeight,a),r.minFramerate=Math.min(r.minFramerate,i.frameRate),r.maxScore=Math.max(r.maxScore,i.score),r.fragmentError+=i.fragmentError,r.videoRanges[i.videoRange]=(r.videoRanges[i.videoRange]||0)+1,s&&s.forEach((e=>{if(!e)return;const i=t.groups[e];r.hasDefaultAudio=r.hasDefaultAudio||t.hasDefaultAudio?i.hasDefault:i.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(i.channels).forEach((e=>{r.channels[e]=(r.channels[e]||0)+i.channels[e]}))})),e}),{})}(p,T,t,i)),r=function(e,t,i,s,r){const a=Object.keys(e),o=null==s?void 0:s.channels,n=null==s?void 0:s.audioCodec,l=o&&2===parseInt(o);let d=!0,h=!1,c=1/0,u=1/0,p=1/0,f=0,m=[];const{preferHDR:g,allowedVideoRanges:y}=gf(t,r);for(let t=a.length;t--;){const i=e[a[t]];d=i.channels[2]>0,c=Math.min(c,i.minHeight),u=Math.min(u,i.minFramerate),p=Math.min(p,i.minBitrate);const s=y.filter((e=>i.videoRanges[e]>0));s.length>0&&(h=!0,m=s)}c=ec(c)?c:0,u=ec(u)?u:0;const A=Math.max(1080,c),b=Math.max(30,u);p=ec(p)?p:i,i=Math.max(p,i),h||(t=void 0,m=[]);const v=a.reduce(((t,s)=>{const r=e[s];if(s===t)return t;if(r.minBitrate>i)return yf(s,`min bitrate of ${r.minBitrate} > current estimate of ${i}`),t;if(!r.hasDefaultAudio)return yf(s,"no renditions with default or auto-select sound found"),t;if(n&&s.indexOf(n.substring(0,4))%5!=0)return yf(s,`audio codec preference "${n}" not found`),t;if(o&&!l){if(!r.channels[o])return yf(s,`no renditions with ${o} channel sound found (channels options: ${Object.keys(r.channels)})`),t}else if((!n||l)&&d&&0===r.channels[2])return yf(s,"no renditions with stereo sound found"),t;return r.minHeight>A?(yf(s,`min resolution of ${r.minHeight} > maximum of ${A}`),t):r.minFramerate>b?(yf(s,`min framerate of ${r.minFramerate} > maximum of ${b}`),t):m.some((e=>r.videoRanges[e]>0))?r.maxScore=Gu(t)||r.fragmentError>e[t].fragmentError)?t:(f=r.maxScore,s):(yf(s,`no variants with VIDEO-RANGE of ${JSON.stringify(m)} found`),t)}),void 0);return{codecSet:v,videoRanges:m,preferHDR:g,minFramerate:u,minBitrate:p}}(s,_,e,w,E),{codecSet:a,videoRanges:o,minFramerate:n,minBitrate:l,preferHDR:d}=r;v=a,_=d?o[o.length-1]:o[0],S=n,e=Math.max(e,l),hc.log(`[abr] picked start tier ${JSON.stringify(r)}`)}else v=null==y?void 0:y.codecSet,_=null==y?void 0:y.videoRange;const k=u?u.duration:c?c.duration:0,C=this.bwEstimator.getEstimateTTFB()/1e3,x=[];for(let n=i;n>=t;n--){var R;const t=p[n],c=n>h;if(!t)continue;if(g.useMediaCapabilities&&!t.supportedResult&&!t.supportedPromise){const i=navigator.mediaCapabilities;"function"==typeof(null==i?void 0:i.decodingInfo)&&ff(t,T,_,S,e,w)?(t.supportedPromise=mf(t,T,i),t.supportedPromise.then((e=>{if(!this.hls)return;t.supportedResult=e;const i=this.hls.levels,s=i.indexOf(t);e.error?hc.warn(`[abr] MediaCapabilities decodingInfo error: "${e.error}" for level ${s} ${JSON.stringify(e)}`):e.supported||(hc.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${s} ${JSON.stringify(e)}`),s>-1&&i.length>1&&(hc.log(`[abr] Removing unsupported level ${s}`),this.hls.removeLevel(s)))}))):t.supportedResult=uf}if(v&&t.codecSet!==v||_&&t.videoRange!==_||c&&S>t.frameRate||!c&&S>0&&S=2*k&&0===r?p[n].averageBitrate:p[n].maxBitrate,P=this.getTimeToLoadFrag(C,D,L*E,void 0===f);if(D>=L&&(n===d||0===t.loadError&&0===t.fragmentError)&&(P<=C||!ec(P)||A&&!this.bitrateTestDelay||P${n} adjustedbw(${Math.round(D)})-bitrate=${Math.round(D-L)} ttfb:${C.toFixed(1)} avgDuration:${E.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${P.toFixed(1)} firstSelection:${b} codecSet:${v} videoRange:${_} hls.loadLevel:${m}`)),b&&(this.firstSelection=n),n}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:i}=this.hls,s=Math.min(Math.max(e,i),t);this._nextAutoLevel!==s&&(this.nextAutoLevelKey="",this._nextAutoLevel=s)}},bufferController:class{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=e=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:e,mediaSource:t}=this;this.log("Media source opened"),e&&(e.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(sc.MEDIA_ATTACHED,{media:e,mediaSource:t})),t&&t.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:e,_objectUrl:t}=this;e!==t&&hc.error(`Media element src was set while attaching MediaSource (${t} > ${e})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=e.config.preferManagedMediaSource&&"undefined"!=typeof self&&self.ManagedMediaSource,this.log=hc.log.bind(hc,t),this.warn=hc.warn.bind(hc,t),this.error=hc.error.bind(hc,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(sc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(sc.BUFFER_RESET,this.onBufferReset,this),e.on(sc.BUFFER_APPENDING,this.onBufferAppending,this),e.on(sc.BUFFER_CODECS,this.onBufferCodecs,this),e.on(sc.BUFFER_EOS,this.onBufferEos,this),e.on(sc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(sc.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(sc.FRAG_PARSED,this.onFragParsed,this),e.on(sc.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(sc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(sc.BUFFER_RESET,this.onBufferReset,this),e.off(sc.BUFFER_APPENDING,this.onBufferAppending,this),e.off(sc.BUFFER_CODECS,this.onBufferCodecs,this),e.off(sc.BUFFER_EOS,this.onBufferEos,this),e.off(sc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(sc.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(sc.FRAG_PARSED,this.onFragParsed,this),e.off(sc.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new yg(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let i=2;(t.audio&&!t.video||!t.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const i=this.media=t.media,s=Uu(this.appendSource);if(i&&s){var r;const e=this.mediaSource=new s;this.log(`created media source: ${null==(r=e.constructor)?void 0:r.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming));const t=this._objectUrl=self.URL.createObjectURL(e);if(this.appendSource)try{i.removeAttribute("src");const s=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||s&&e instanceof s,bg(i),function(e,t){const i=self.document.createElement("source");i.type="video/mp4",i.src=t,e.appendChild(i)}(i,t),i.load()}catch(e){i.src=t}else i.src=t;i.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:i}=this;if(t){if(this.log("media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){this.warn(`onMediaDetaching: ${e.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),i&&self.URL.revokeObjectURL(i),this.mediaSrc===i?(e.removeAttribute("src"),this.appendSource&&bg(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(sc.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach((e=>{this.resetBuffer(e)})),this._initSourceBuffer()}resetBuffer(e){const t=this.sourceBuffer[e];try{var i;if(t)this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,null!=(i=this.mediaSource)&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}catch(t){this.warn(`onBufferReset ${e}`,t)}}onBufferCodecs(e,t){const i=this.getSourceBufferTypes().length,s=Object.keys(t);if(s.forEach((e=>{if(i){const i=this.tracks[e];if(i&&"function"==typeof i.buffer.changeType){var s;const{id:r,codec:a,levelCodec:o,container:n,metadata:l}=t[e],d=Wu(i.codec,i.levelCodec),h=null==d?void 0:d.replace(Ag,"$1");let c=Wu(a,o);const u=null==(s=c)?void 0:s.replace(Ag,"$1");if(c&&h!==u){"audio"===e.slice(0,5)&&(c=$u(c,this.appendSource));const t=`${n};codecs=${c}`;this.appendChangeType(e,t),this.log(`switching codec ${d} to ${c}`),this.tracks[e]={buffer:i.buffer,codec:a,container:n,levelCodec:o,metadata:l,id:r}}}}else this.pendingTracks[e]=t[e]})),i)return;const r=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==r&&(this.log(`${r} bufferCodec event(s) expected ${s.join(",")}`),this.bufferCodecEventsExpected=r),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:i}=this,s={execute:()=>{const s=this.sourceBuffer[e];s&&(this.log(`changing ${e} sourceBuffer type to ${t}`),s.changeType(t)),i.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn(`Failed to change ${e} SourceBuffer type`,t)}};i.append(s,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:i,operationQueue:s,tracks:r}=this,{data:a,type:o,frag:n,part:l,chunkMeta:d}=t,h=d.buffering[o],c=self.performance.now();h.start=c;const u=n.stats.buffering,p=l?l.stats.buffering:null;0===u.start&&(u.start=c),p&&0===p.start&&(p.start=c);const f=r.audio;let m=!1;"audio"===o&&"audio/mpeg"===(null==f?void 0:f.container)&&(m=!this.lastMpegAudioChunk||1===d.id||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const g=n.start,y={execute:()=>{if(h.executeStart=self.performance.now(),m){const e=this.sourceBuffer[o];if(e){const t=g-e.timestampOffset;Math.abs(t)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${g} (delta: ${t}) sn: ${n.sn})`),e.timestampOffset=g)}}this.appendExecutor(a,o)},onStart:()=>{},onComplete:()=>{const e=self.performance.now();h.executeEnd=h.end=e,0===u.first&&(u.first=e),p&&0===p.first&&(p.first=e);const{sourceBuffer:t}=this,i={};for(const e in t)i[e]=Lf.getBuffered(t[e]);this.appendErrors[o]=0,"audio"===o||"video"===o?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(sc.BUFFER_APPENDED,{type:o,frag:n,part:l,chunkMeta:d,parent:n.type,timeRanges:i})},onError:e=>{const t={type:rc.MEDIA_ERROR,parent:n.type,details:ac.BUFFER_APPEND_ERROR,sourceBufferName:o,frag:n,part:l,chunkMeta:d,error:e,err:e,fatal:!1};if(e.code===DOMException.QUOTA_EXCEEDED_ERR)t.details=ac.BUFFER_FULL_ERROR;else{const e=++this.appendErrors[o];t.details=ac.BUFFER_APPEND_ERROR,this.warn(`Failed ${e}/${i.config.appendErrorMaxRetry} times to append segment in "${o}" sourceBuffer`),e>=i.config.appendErrorMaxRetry&&(t.fatal=!0)}i.trigger(sc.ERROR,t)}};s.append(y,o,!!this.pendingTracks[o])}onBufferFlushing(e,t){const{operationQueue:i}=this,s=e=>({execute:this.removeExecutor.bind(this,e,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(sc.BUFFER_FLUSHED,{type:e})},onError:t=>{this.warn(`Failed to remove from ${e} SourceBuffer`,t)}});t.type?i.append(s(t.type),t.type):this.getSourceBufferTypes().forEach((e=>{i.append(s(e),e)}))}onFragParsed(e,t){const{frag:i,part:s}=t,r=[],a=s?s.elementaryStreams:i.elementaryStreams;a[bc]?r.push("audiovideo"):(a[yc]&&r.push("audio"),a[Ac]&&r.push("video"));0===r.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${i.type} level: ${i.level} sn: ${i.sn}`),this.blockBuffers((()=>{const e=self.performance.now();i.stats.buffering.end=e,s&&(s.stats.buffering.end=e);const t=s?s.stats:i.stats;this.hls.trigger(sc.FRAG_BUFFERED,{frag:i,part:s,stats:t,id:i.type})}),r)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce(((e,i)=>{const s=this.sourceBuffer[i];return!s||t.type&&t.type!==i||(s.ending=!0,s.ended||(s.ended=!0,this.log(`${i} sourceBuffer now EOS`))),e&&!(s&&!s.ended)}),!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers((()=>{this.getSourceBufferTypes().forEach((e=>{const t=this.sourceBuffer[e];t&&(t.ending=!1)}));const{mediaSource:e}=this;e&&"open"===e.readyState?(this.log("Calling mediaSource.endOfStream()"),e.endOfStream()):e&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${e.readyState}`)})))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:i}=this;if(!i||null===t)return;if(!this.getSourceBufferTypes().length)return;const s=e.config,r=i.currentTime,a=t.levelTargetDuration,o=t.live&&null!==s.liveBackBufferLength?s.liveBackBufferLength:s.backBufferLength;if(ec(o)&&o>0){const e=Math.max(o,a),t=Math.floor(r/a)*a-e;this.flushBackBuffer(r,a,t)}if(ec(s.frontBufferFlushThreshold)&&s.frontBufferFlushThreshold>0){const e=Math.max(s.maxBufferLength,s.frontBufferFlushThreshold),t=Math.max(e,a),i=Math.floor(r/a)*a+t;this.flushFrontBuffer(r,a,i)}}flushBackBuffer(e,t,i){const{details:s,sourceBuffer:r}=this;this.getSourceBufferTypes().forEach((a=>{const o=r[a];if(o){const r=Lf.getBuffered(o);if(r.length>0&&i>r.start(0)){if(this.hls.trigger(sc.BACK_BUFFER_REACHED,{bufferEnd:i}),null!=s&&s.live)this.hls.trigger(sc.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(o.ended&&r.end(r.length-1)-e<2*t)return void this.log(`Cannot flush ${a} back buffer while SourceBuffer is in ended state`);this.hls.trigger(sc.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:a})}}}))}flushFrontBuffer(e,t,i){const{sourceBuffer:s}=this;this.getSourceBufferTypes().forEach((r=>{const a=s[r];if(a){const s=Lf.getBuffered(a),o=s.length;if(o<2)return;const n=s.start(o-1),l=s.end(o-1);if(i>n||e>=n&&e<=l)return;if(a.ended&&e-l<2*t)return void this.log(`Cannot flush ${r} front buffer while SourceBuffer is in ended state`);this.hls.trigger(sc.BUFFER_FLUSHING,{startOffset:n,endOffset:1/0,type:r})}}))}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||"open"!==this.mediaSource.readyState)return;const{details:e,hls:t,media:i,mediaSource:s}=this,r=e.fragments[0].start+e.totalduration,a=i.duration,o=ec(s.duration)?s.duration:0;e.live&&t.config.liveDurationInfinity?(s.duration=1/0,this.updateSeekableRange(e)):(r>o&&r>a||!ec(a))&&(this.log(`Updating Media Source duration to ${r.toFixed(3)}`),s.duration=r)}updateSeekableRange(e){const t=this.mediaSource,i=e.fragments;if(i.length&&e.live&&null!=t&&t.setLiveSeekableRange){const s=Math.max(0,i[0].start),r=Math.max(s,s+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${s}-${r}.`),t.setLiveSeekableRange(s,r)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:i}=this,s=Object.keys(i).length;if(s&&(!e||2===s||"audiovideo"in i)){this.createSourceBuffers(i),this.pendingTracks={};const e=this.getSourceBufferTypes();if(e.length)this.hls.trigger(sc.BUFFER_CREATED,{tracks:this.tracks}),e.forEach((e=>{t.executeNext(e)}));else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(const s in e)if(!t[s]){const r=e[s];if(!r)throw Error(`source buffer exists for track ${s}, however track does not`);let a=r.levelCodec||r.codec;a&&"audio"===s.slice(0,5)&&(a=$u(a,this.appendSource));const o=`${r.container};codecs=${a}`;this.log(`creating sourceBuffer(${o})`);try{const e=t[s]=i.addSourceBuffer(o),n=s;this.addBufferListener(n,"updatestart",this._onSBUpdateStart),this.addBufferListener(n,"updateend",this._onSBUpdateEnd),this.addBufferListener(n,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(n,"bufferedchange",((e,t)=>{const i=t.removedRanges;null!=i&&i.length&&this.hls.trigger(sc.BUFFER_FLUSHED,{type:s})})),this.tracks[s]={buffer:e,codec:a,container:r.container,levelCodec:r.levelCodec,metadata:r.metadata,id:r.id}}catch(e){this.error(`error while trying to add sourceBuffer: ${e.message}`),this.hls.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:s,mimeType:o})}}}get mediaSrc(){var e;const t=(null==(e=this.media)?void 0:e.firstChild)||this.media;return null==t?void 0:t.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if("closed"===(null==(t=this.mediaSource)?void 0:t.readyState))return void this.resetBuffer(e);const{operationQueue:i}=this;i.current(e).onComplete(),i.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var i;const s=new Error(`${e} SourceBuffer error. MediaSource readyState: ${null==(i=this.mediaSource)?void 0:i.readyState}`);this.error(`${s}`,t),this.hls.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:s,fatal:!1});const r=this.operationQueue.current(e);r&&r.onError(s)}removeExecutor(e,t,i){const{media:s,mediaSource:r,operationQueue:a,sourceBuffer:o}=this,n=o[e];if(!s||!r||!n)return this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),void a.shiftAndExecuteNext(e);const l=ec(s.duration)?s.duration:1/0,d=ec(r.duration)?r.duration:1/0,h=Math.max(0,t),c=Math.min(i,l,d);c>h&&(!n.ending||n.ended)?(n.ended=!1,this.log(`Removing [${h},${c}] from the ${e} SourceBuffer`),n.remove(h,c)):a.shiftAndExecuteNext(e)}appendExecutor(e,t){const i=this.sourceBuffer[t];if(i)i.ended=!1,i.appendBuffer(e);else if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);const{operationQueue:i}=this,s=t.map((e=>i.appendBlocker(e)));Promise.all(s).then((()=>{e(),t.forEach((e=>{const t=this.sourceBuffer[e];null!=t&&t.updating||i.shiftAndExecuteNext(e)}))}))}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,i){const s=this.sourceBuffer[e];if(!s)return;const r=i.bind(this,e);this.listeners[e].push({event:t,listener:r}),s.addEventListener(t,r)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach((e=>{t.removeEventListener(e.event,e.listener)}))}},capLevelController:fy,errorController:class{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=hc.log.bind(hc,"[info]:"),this.warn=hc.warn.bind(hc,"[warning]:"),this.error=hc.error.bind(hc,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(sc.ERROR,this.onError,this),e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(sc.ERROR,this.onError,this),e.off(sc.ERROR,this.onErrorOut,this),e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(null==e?void 0:e.type)===hp?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var i,s;if(t.fatal)return;const r=this.hls,a=t.context;switch(t.details){case ac.FRAG_LOAD_ERROR:case ac.FRAG_LOAD_TIMEOUT:case ac.KEY_LOAD_ERROR:case ac.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case ac.FRAG_PARSING_ERROR:if(null!=(i=t.frag)&&i.gap)return void(t.errorAction={action:tf,flags:of});case ac.FRAG_GAP:case ac.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=sf);case ac.LEVEL_EMPTY_ERROR:case ac.LEVEL_PARSING_ERROR:{var o,n;const e=t.parent===hp?t.level:r.loadLevel;t.details===ac.LEVEL_EMPTY_ERROR&&null!=(o=t.context)&&null!=(n=o.levelDetails)&&n.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case ac.LEVEL_LOAD_ERROR:case ac.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==a?void 0:a.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.level)));case ac.AUDIO_TRACK_LOAD_ERROR:case ac.AUDIO_TRACK_LOAD_TIMEOUT:case ac.SUBTITLE_LOAD_ERROR:case ac.SUBTITLE_TRACK_LOAD_TIMEOUT:if(a){const e=r.levels[r.loadLevel];if(e&&(a.type===lp&&e.hasAudioGroup(a.groupId)||a.type===dp&&e.hasSubtitleGroup(a.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r.loadLevel),t.errorAction.action=sf,void(t.errorAction.flags=nf)}return;case ac.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const e=r.levels[r.loadLevel],i=null==e?void 0:e.attrs["HDCP-LEVEL"];i?t.errorAction={action:sf,flags:lf,hdcpLevel:i}:this.keySystemError(t)}return;case ac.BUFFER_ADD_CODEC_ERROR:case ac.REMUX_ALLOC_ERROR:case ac.BUFFER_APPEND_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,null!=(s=t.level)?s:r.loadLevel));case ac.INTERNAL_EXCEPTION:case ac.BUFFER_APPENDING_ERROR:case ac.BUFFER_FULL_ERROR:case ac.LEVEL_SWITCH_ERROR:case ac.BUFFER_STALLED_ERROR:case ac.BUFFER_SEEK_OVER_HOLE:case ac.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:tf,flags:of})}t.type===rc.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const i=Jp(this.hls.config.playlistLoadPolicy,e),s=this.playlistError++;if(Yp(i,s,Wp(e),e.response))return{action:af,flags:of,retryConfig:i,retryCount:s};const r=this.getLevelSwitchAction(e,t);return i&&(r.retryConfig=i,r.retryCount=s),r}getFragRetryOrSwitchAction(e){const t=this.hls,i=this.getVariantLevelIndex(e.frag),s=t.levels[i],{fragLoadPolicy:r,keyLoadPolicy:a}=t.config,o=Jp(e.details.startsWith("key")?a:r,e),n=t.levels.reduce(((e,t)=>e+t.fragmentError),0);if(s){e.details!==ac.FRAG_GAP&&s.fragmentError++;if(Yp(o,n,Wp(e),e.response))return{action:af,flags:of,retryConfig:o,retryCount:n}}const l=this.getLevelSwitchAction(e,i);return o&&(l.retryConfig=o,l.retryCount=n),l}getLevelSwitchAction(e,t){const i=this.hls;null==t&&(t=i.loadLevel);const s=this.hls.levels[t];if(s){var r,a;const t=e.details;s.loadError++,t===ac.BUFFER_APPEND_ERROR&&s.fragmentError++;let l=-1;const{levels:d,loadLevel:h,minAutoLevel:c,maxAutoLevel:u}=i;i.autoLevelEnabled||(i.loadLevel=-1);const p=null==(r=e.frag)?void 0:r.type,f=(p===cp&&t===ac.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(t===ac.BUFFER_ADD_CODEC_ERROR||t===ac.BUFFER_APPEND_ERROR))&&d.some((({audioCodec:e})=>s.audioCodec!==e)),m="video"===e.sourceBufferName&&(t===ac.BUFFER_ADD_CODEC_ERROR||t===ac.BUFFER_APPEND_ERROR)&&d.some((({codecSet:e,audioCodec:t})=>s.codecSet!==e&&s.audioCodec===t)),{type:g,groupId:y}=null!=(a=e.context)?a:{};for(let i=d.length;i--;){const r=(i+h)%d.length;if(r!==h&&r>=c&&r<=u&&0===d[r].loadError){var o,n;const i=d[r];if(t===ac.FRAG_GAP&&e.frag){const t=d[r].details;if(t){const i=Xp(e.frag,t.fragments,e.frag.start);if(null!=i&&i.gap)continue}}else{if(g===lp&&i.hasAudioGroup(y)||g===dp&&i.hasSubtitleGroup(y))continue;if(p===cp&&null!=(o=s.audioGroups)&&o.some((e=>i.hasAudioGroup(e)))||p===up&&null!=(n=s.subtitleGroups)&&n.some((e=>i.hasSubtitleGroup(e)))||f&&s.audioCodec===i.audioCodec||!f&&s.audioCodec!==i.audioCodec||m&&s.codecSet===i.codecSet)continue}l=r;break}}if(l>-1&&i.loadLevel!==l)return e.levelRetry=!0,this.playlistError=0,{action:sf,flags:of,nextAutoLevel:l}}return{action:sf,flags:nf}}onErrorOut(e,t){var i;switch(null==(i=t.errorAction)?void 0:i.action){case tf:break;case sf:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===ac.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(e){const t=this.hls,i=e.errorAction;if(!i)return;const{flags:s,hdcpLevel:r,nextAutoLevel:a}=i;switch(s){case of:this.switchLevel(e,a);break;case lf:r&&(t.maxHdcpLevel=Dp[Dp.indexOf(r)-1],i.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`)}i.resolved||this.switchLevel(e,a)}switchLevel(e,t){void 0!==t&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}},fpsController:class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(sc.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(sc.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const i=this.hls.config;if(i.capLevelOnFPSDrop){const e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&"function"==typeof e.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,i){const s=performance.now();if(t){if(this.lastTime){const e=s-this.lastTime,r=i-this.lastDroppedFrames,a=t-this.lastDecodedFrames,o=1e3*r/e,n=this.hls;if(n.trigger(sc.FPS_DROP,{currentDropped:r,currentDecoded:a,totalDroppedFrames:i}),o>0&&r>n.config.fpsDroppedMonitoringThreshold*a){let e=n.currentLevel;hc.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===n.autoLevelCapping||n.autoLevelCapping>=e)&&(e-=1,n.trigger(sc.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:n.currentLevel}),n.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}},stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Fc,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:tA,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends om{constructor(e,t,i){super(e,t,i,"[subtitle-stream-controller]",up),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(sc.ERROR,this.onError,this),e.on(sc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(sc.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(sc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(sc.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(sc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(sc.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(sc.ERROR,this.onError,this),e.off(sc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(sc.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(sc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(sc.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(sc.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(sc.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=Kf,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:i,success:s}=t;if(this.fragPrevious=i,this.state=Kf,!s)return;const r=this.tracksBuffered[this.currentTrackId];if(!r)return;let a;const o=i.start;for(let e=0;e=r[e].start&&o<=r[e].end){a=r[e];break}const n=i.start+i.duration;a?a.end=n:(a={start:o,end:n},r.push(a)),this.fragmentTracker.fragBuffered(i),this.fragBufferedComplete(i,null)}onBufferFlushing(e,t){const{startOffset:i,endOffset:s}=t;if(0===i&&s!==Number.POSITIVE_INFINITY){const e=s-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach((t=>{for(let i=0;inew Up(e))):(this.tracksBuffered=[],this.levels=t.map((e=>{const t=new Up(e);return this.tracksBuffered[t.id]=[],t})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,up),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,null==(i=this.levels)||!i.length||-1===this.currentTrackId)return void this.clearInterval();const s=this.levels[this.currentTrackId];null!=s&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.setInterval(500)}onSubtitleTrackLoaded(e,t){var i;const{currentTrackId:s,levels:r}=this,{details:a,id:o}=t;if(!r)return void this.warn(`Subtitle tracks were reset while loading level ${o}`);const n=r[s];if(o>=r.length||o!==s||!n)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(a.live||null!=(i=n.details)&&i.live){const e=this.mainDetails;if(a.deltaUpdateFailed||!e)return;const t=e.fragments[0];var d;if(n.details)l=this.alignPlaylists(a,n.details,null==(d=this.levelLastLoaded)?void 0:d.details),0===l&&t&&(l=t.start,Gp(a,l));else a.hasProgramDateTime&&e.hasProgramDateTime?(Ff(a,e),l=a.fragments[0].start):t&&(l=t.start,Gp(a,l))}if(n.details=a,this.levelLastLoaded=n,this.startFragRequested||!this.mainDetails&&a.live||this.setStartPosition(this.mainDetails||a,l),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===Kf){Xp(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),n.details=void 0)}}_handleFragmentLoadComplete(e){const{frag:t,payload:i}=e,s=t.decryptdata,r=this.hls;if(!this.fragContextChanged(t)&&i&&i.byteLength>0&&null!=s&&s.key&&s.iv&&"AES-128"===s.method){const e=performance.now();this.decrypter.decrypt(new Uint8Array(i),s.key.buffer,s.iv.buffer).catch((e=>{throw r.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e})).then((i=>{const s=performance.now();r.trigger(sc.FRAG_DECRYPTED,{frag:t,payload:i,stats:{tstart:e,tdecrypt:s}})})).catch((e=>{this.warn(`${e.name}: ${e.message}`),this.state=Kf}))}}doTick(){if(this.media){if(this.state===Kf){const{currentTrackId:e,levels:t}=this,i=null==t?void 0:t[e];if(!i||!t.length||!i.details)return;const{config:s}=this,r=this.getLoadPosition(),a=Lf.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],r,s.maxBufferHole),{end:o,len:n}=a,l=this.getFwdBufferInfo(this.media,hp),d=i.details;if(n>this.getMaxBufferLength(null==l?void 0:l.len)+d.levelTargetDuration)return;const h=d.fragments,c=h.length,u=d.edge;let p=null;const f=this.fragPrevious;if(ou-e?0:e;p=Xp(f,h,Math.max(h[0].start,o),t),!p&&f&&f.startthis.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let e=null;const t=vp(this.media.textTracks);for(let i=0;i-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(sc.LEVEL_LOADING,this.onLevelLoading,this),e.on(sc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(sc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(sc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(sc.LEVEL_LOADING,this.onLevelLoading,this),e.off(sc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(sc.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(sc.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId);vp(this.media.textTracks).forEach((e=>{Ap(e)})),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:i,groupId:s,details:r}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==s)return void this.warn(`Subtitle track with id:${i} and group:${s} not found in active group ${null==a?void 0:a.groupId}`);const o=a.details;a.details=t.details,this.log(`Subtitle track ${i} "${a.name}" lang:${a.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.subtitleGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(null==s?void 0:s.length)!==(null==i?void 0:i.length)||null!=i&&i.some((e=>-1===(null==s?void 0:s.indexOf(e))))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!i||-1!==i.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.subtitlePreference;if(!r&&t){this.selectDefaultTrack=!1;const i=Af(t,e);if(i>-1)r=e[i];else{const e=Af(t,this.tracks);r=this.tracks[e]}}let s=this.findTrackId(r);-1===s&&r&&(s=this.findTrackId(null));const a={subtitleTracks:e};this.log(`Updating subtitle tracks, ${e.length} track(s) found in "${null==i?void 0:i.join(",")}" group-id`),this.hls.trigger(sc.SUBTITLE_TRACKS_UPDATED,a),-1!==s&&-1===this.trackId&&this.setSubtitleTrack(s)}else this.shouldReloadPlaylist(r)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,i=this.selectDefaultTrack;for(let s=0;s-1){const e=this.tracksInGroup[s];return this.setSubtitleTrack(s),e}if(i)return null;{const i=Af(e,t);if(i>-1)return t[i]}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const i=t.id,s=t.groupId;let r=t.url;if(e)try{r=e.addDirectives(r)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}this.log(`Loading subtitle playlist for id ${i}`),this.hls.trigger(sc.SUBTITLE_TRACK_LOADING,{url:r,id:i,groupId:s,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=vp(e.textTracks),i=this.currentTrack;let s;if(i&&(s=t.filter((e=>mg(i,e)))[0],s||this.warn(`Unable to find subtitle TextTrack with name "${i.name}" and language "${i.lang}"`)),[].slice.call(t).forEach((e=>{"disabled"!==e.mode&&e!==s&&(e.mode="disabled")})),s){const e=this.subtitleDisplay?"showing":"hidden";s.mode!==e&&(s.mode=e)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=e);if(e<-1||e>=t.length||!ec(e))return void this.warn(`Invalid subtitle track id: ${e}`);this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e]||null;if(this.trackId=e,this.currentTrack=s,this.toggleTrackModes(),!s)return void this.hls.trigger(sc.SUBTITLE_TRACK_SWITCH,{id:e});const r=!!s.details&&!s.details.live;if(e===this.trackId&&s===i&&r)return;this.log(`Switching to subtitle-track ${e}`+(s?` "${s.name}" lang:${s.lang} group:${s.groupId}`:""));const{id:a,groupId:o="",name:n,type:l,url:d}=s;this.hls.trigger(sc.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:n,type:l,url:d});const h=this.switchParams(s.url,null==i?void 0:i.details);this.loadPlaylist(h)}},timelineController:class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(sc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(sc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(sc.FRAG_LOADING,this.onFragLoading,this),e.on(sc.FRAG_LOADED,this.onFragLoaded,this),e.on(sc.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(sc.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(sc.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(sc.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(sc.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(sc.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(sc.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(sc.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(sc.FRAG_LOADING,this.onFragLoading,this),e.off(sc.FRAG_LOADED,this.onFragLoaded,this),e.off(sc.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(sc.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(sc.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(sc.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(sc.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new Ng(this,"textTrack1"),t=new Ng(this,"textTrack2"),i=new Ng(this,"textTrack3"),s=new Ng(this,"textTrack4");this.cea608Parser1=new Ug(1,e,t),this.cea608Parser2=new Ug(3,i,s)}}addCues(e,t,i,s,r){let a=!1;for(let e=r.length;e--;){const s=r[e],h=(o=s[0],n=s[1],l=t,d=i,Math.min(n,d)-Math.max(o,l));if(h>=0&&(s[0]=Math.min(s[0],t),s[1]=Math.max(s[1],i),a=!0,h/(i-t)>.5))return}var o,n,l,d;if(a||r.push([t,i]),this.config.renderTextTracksNatively){const r=this.captionsTracks[e];this.Cues.newCue(r,t,i,s)}else{const r=this.Cues.newCue(null,t,i,s);this.hls.trigger(sc.CUES_PARSED,{type:"captions",cues:r,track:e})}}onInitPtsFound(e,{frag:t,id:i,initPTS:s,timescale:r}){const{unparsedVttFrags:a}=this;"main"===i&&(this.initPTS[t.cc]={baseTime:s,timescale:r}),a.length&&(this.unparsedVttFrags=[],a.forEach((e=>{this.onFragLoaded(sc.FRAG_LOADED,e)})))}getExistingTrack(e,t){const{media:i}=this;if(i)for(let s=0;s{Ap(e[t]),delete e[t]})),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let e=0;ee.textCodec===ty));if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(pg(this.tracks,i))return void(this.tracks=i);if(this.textTracks=[],this.tracks=i,this.config.renderTextTracksNatively){const e=this.media,t=e?vp(e.textTracks):null;if(this.tracks.forEach(((e,i)=>{let s;if(t){let i=null;for(let s=0;snull!==e)).map((e=>e.label));e.length&&hc.warn(`Media element contains unused subtitle tracks: ${e.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const e=this.tracks.map((e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e})));this.hls.trigger(sc.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach((e=>{const t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;const i=`textTrack${t[1]}`,s=this.captionsProperties[i];s&&(s.label=e.name,e.lang&&(s.languageCode=e.lang),s.media=e)}))}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:s,lastCc:r,lastSn:a,lastPartIndex:o}=this;if(this.enabled&&i&&s&&t.frag.type===hp){var n,l;const{cc:e,sn:d}=t.frag,h=null!=(n=null==t||null==(l=t.part)?void 0:l.index)?n:-1;d===a+1||d===a&&h===o+1||e===r||(i.reset(),s.reset()),this.lastCc=e,this.lastSn=d,this.lastPartIndex=h}}onFragLoaded(e,t){const{frag:i,payload:s}=t;if(i.type===up)if(s.byteLength){const e=i.decryptdata,r="stats"in t;if(null==e||!e.encrypted||r){const e=this.tracks[i.level],r=this.vttCCs;r[i.cc]||(r[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),e&&e.textCodec===ty?this._parseIMSC1(i,s):this._parseVTTs(t)}}else this.hls.trigger(sc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const i=this.hls;ay(t,this.initPTS[e.cc],(t=>{this._appendCues(t,e.level),i.trigger(sc.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})}),(t=>{hc.log(`Failed to parse IMSC1: ${t}`),i.trigger(sc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:t})}))}_parseVTTs(e){var t;const{frag:i,payload:s}=e,{initPTS:r,unparsedVttFrags:a}=this,o=r.length-1;if(!r[i.cc]&&-1===o)return void a.push(e);const n=this.hls;ey(null!=(t=i.initSegment)&&t.data?Su(i.initSegment.data,new Uint8Array(s)):s,this.initPTS[i.cc],this.vttCCs,i.cc,i.start,(e=>{this._appendCues(e,i.level),n.trigger(sc.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i})}),(t=>{const r="Missing initPTS for VTT MPEGTS"===t.message;r?a.push(e):this._fallbackToIMSC1(i,s),hc.log(`Failed to parse VTT cue: ${t}`),r&&o>i.cc||n.trigger(sc.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:t})}))}_fallbackToIMSC1(e,t){const i=this.tracks[e.level];i.textCodec||ay(t,this.initPTS[e.cc],(()=>{i.textCodec=ty,this._parseIMSC1(e,t)}),(()=>{i.textCodec="wvtt"}))}_appendCues(e,t){const i=this.hls;if(this.config.renderTextTracksNatively){const i=this.textTracks[t];if(!i||"disabled"===i.mode)return;e.forEach((e=>yp(i,e)))}else{const s=this.tracks[t];if(!s)return;const r=s.default?"default":"subtitles"+t;i.trigger(sc.CUES_PARSED,{type:"subtitles",cues:e,track:r})}}onFragDecrypted(e,t){const{frag:i}=t;i.type===up&&this.onFragLoaded(sc.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:i,cea608Parser2:s}=this;if(!this.enabled||!i||!s)return;const{frag:r,samples:a}=t;if(r.type!==hp||"NONE"!==this.closedCaptionsForLevel(r))for(let e=0;ebp(e[s],t,i)))}if(this.config.renderTextTracksNatively&&0===t&&void 0!==s){const{textTracks:e}=this;Object.keys(e).forEach((i=>bp(e[i],t,s)))}}}extractCea608Data(e){const t=[[],[]],i=31&e[0];let s=2;for(let r=0;r0&&-1===e?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=Kf):(this.loadedmetadata=!1,this.state=Zf),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case Kf:this.doTickIdle();break;case Zf:{var e;const{levels:t,trackId:i}=this,s=null==t||null==(e=t[i])?void 0:e.details;if(s){if(this.waitForCdnTuneIn(s))break;this.state=rm}break}case Xf:{var t;const e=performance.now(),i=this.retryDate;if(!i||e>=i||null!=(t=this.media)&&t.seeking){const{levels:e,trackId:t}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==e?void 0:e[t])||null),this.state=Kf}break}case rm:{const e=this.waitingData;if(e){const{frag:t,part:i,cache:s,complete:r}=e;if(void 0!==this.initPTS[t.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=Qf;const e={frag:t,part:i,payload:s.flush(),networkDetails:null};this._handleFragmentLoadProgress(e),r&&super._handleFragmentLoadComplete(e)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${t.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const e=this.getLoadPosition(),i=Lf.bufferInfo(this.mediaBuffer,e,this.config.maxBufferHole);Zp(i.end,this.config.maxFragLookUpTolerance,t)<0&&(this.log(`Waiting fragment cc (${t.cc}) @ ${t.start} cancelled because another fragment at ${i.end} is needed`),this.clearWaitingFragment())}}else this.state=Kf}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Kf)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:i,trackId:s}=this,r=e.config;if(!i&&(this.startFragRequested||!r.startFragPrefetch)||null==t||!t[s])return;const a=t[s],o=a.details;if(!o||o.live&&this.levelLastLoaded!==a||this.waitForCdnTuneIn(o))return void(this.state=Zf);const n=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&n&&(this.bufferFlushed=!1,this.afterBufferFlushed(n,yc,cp));const l=this.getFwdBufferInfo(n,cp);if(null===l)return;const{bufferedTrack:d,switchingTrack:h}=this;if(!h&&this._streamEnded(l,o))return e.trigger(sc.BUFFER_EOS,{type:"audio"}),void(this.state=im);const c=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,hp),u=l.len,p=this.getMaxBufferLength(null==c?void 0:c.len),f=o.fragments,m=f[0].start;let g=this.flushing?this.getLoadPosition():l.end;if(h&&i){const e=this.getLoadPosition();d&&!fg(h.attrs,d.attrs)&&(g=e),o.PTSKnown&&em||l.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),i.currentTime=m+.05)}if(u>=p&&!h&&gc.end+o.targetduration;if(b||(null==c||!c.len)&&l.len){const e=this.getAppendedFrag(y.start,hp);if(null===e)return;if(A||(A=!!e.gap||!!b&&0===c.len),b&&!A||A&&l.nextStart&&l.nextStartnew Up(e)))}onAudioTrackSwitching(e,t){const i=!!t.url;this.trackId=t.id;const{fragCurrent:s}=this;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),i?this.setInterval(100):this.resetTransmuxer(),i?(this.switchingTrack=t,this.state=Kf,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=qf),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(sc.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var i;if(null==this.mainDetails)return void(this.cachedTrackLoadedData=t);const{levels:s}=this,{details:r,id:a}=t;if(!s)return void this.warn(`Audio tracks were reset while loading level ${a}`);this.log(`Audio track ${a} loaded [${r.startSN},${r.endSN}]${r.lastPartSn?`[part-${r.lastPartSn}-${r.lastPartIndex}]`:""},duration:${r.totalduration}`);const o=s[a];let n=0;if(r.live||null!=(i=o.details)&&i.live){this.checkLiveUpdate(r);const e=this.mainDetails;if(r.deltaUpdateFailed||!e)return;var l;if(!o.details&&r.hasProgramDateTime&&e.hasProgramDateTime)Ff(r,e),n=r.fragments[0].start;else n=this.alignPlaylists(r,o.details,null==(l=this.levelLastLoaded)?void 0:l.details)}o.details=r,this.levelLastLoaded=o,this.startFragRequested||!this.mainDetails&&r.live||this.setStartPosition(this.mainDetails||r,n),this.state!==Zf||this.waitForCdnTuneIn(r)||(this.state=Kf),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:s,payload:r}=e,{config:a,trackId:o,levels:n}=this;if(!n)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const l=n[o];if(!l)return void this.warn("Audio track is undefined on fragment load progress");const d=l.details;if(!d)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(i.start);const h=a.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let c=this.transmuxer;c||(c=this.transmuxer=new ug(this.hls,cp,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const u=this.initPTS[i.cc],p=null==(t=i.initSegment)?void 0:t.data;if(void 0!==u){const e=!1,t=s?s.index:-1,a=-1!==t,o=new Pf(i.level,i.sn,i.stats.chunkCount,r.byteLength,t,a);c.push(r,p,h,"",i,s,d.totalduration,e,o,u)}else{this.log(`Unknown video PTS for cc ${i.cc}, waiting for video PTS before demuxing audio frag ${i.sn} of [${d.startSN} ,${d.endSN}],track ${o}`);const{cache:e}=this.waitingData=this.waitingData||{frag:i,part:s,cache:new nm,complete:!1};e.push(new Uint8Array(r)),this.waitingVideoCC=this.videoTrackCC,this.state=rm}}_handleFragmentLoadComplete(e){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:i,part:s}=t;if(i.type===cp)if(this.fragContextChanged(i))this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if("initSegment"!==i.sn){this.fragPrevious=i;const e=this.switchingTrack;e&&(this.bufferedTrack=e,this.switchingTrack=null,this.hls.trigger(sc.AUDIO_TRACK_SWITCHED,Yh({},e)))}this.fragBufferedComplete(i,s)}else if(!this.loadedmetadata&&i.type===hp){const e=this.videoBuffer||this.media;if(e){Lf.getBuffered(e).length&&(this.loadedmetadata=!0)}}}onError(e,t){var i;if(t.fatal)this.state=sm;else switch(t.details){case ac.FRAG_GAP:case ac.FRAG_PARSING_ERROR:case ac.FRAG_DECRYPT_ERROR:case ac.FRAG_LOAD_ERROR:case ac.FRAG_LOAD_TIMEOUT:case ac.KEY_LOAD_ERROR:case ac.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(cp,t);break;case ac.AUDIO_TRACK_LOAD_ERROR:case ac.AUDIO_TRACK_LOAD_TIMEOUT:case ac.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Zf||(null==(i=t.context)?void 0:i.type)!==lp||(this.state=Kf);break;case ac.BUFFER_APPEND_ERROR:case ac.BUFFER_FULL_ERROR:if(!t.parent||"audio"!==t.parent)return;if(t.details===ac.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case ac.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushing(e,{type:t}){t!==Ac&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Ac){this.flushing=!1,this.bufferFlushed=!0,this.state===im&&(this.state=Kf);const e=this.mediaBuffer||this.media;e&&(this.afterBufferFlushed(e,t,cp),this.tick())}}_handleTransmuxComplete(e){var t;const i="audio",{hls:s}=this,{remuxResult:r,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o)return void this.resetWhenMissingContext(a);const{frag:n,part:l,level:d}=o,{details:h}=d,{audio:c,text:u,id3:p,initSegment:f}=r;if(!this.fragContextChanged(n)&&h){if(this.state=em,this.switchingTrack&&c&&this.completeAudioSwitch(this.switchingTrack),null!=f&&f.tracks){const e=n.initSegment||n;this._bufferInitSegment(d,f.tracks,e,a),s.trigger(sc.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:f.tracks})}if(c){const{startPTS:e,endPTS:t,startDTS:i,endDTS:s}=c;l&&(l.elementaryStreams[yc]={startPTS:e,endPTS:t,startDTS:i,endDTS:s}),n.setElementaryStreamInfo(yc,e,t,i,s),this.bufferFragmentData(c,n,l,a)}if(null!=p&&null!=(t=p.samples)&&t.length){const e=Zh({id:i,frag:n,details:h},p);s.trigger(sc.FRAG_PARSING_METADATA,e)}if(u){const e=Zh({id:i,frag:n,details:h},u);s.trigger(sc.FRAG_PARSING_USERDATA,e)}}else this.fragmentTracker.removeFragment(n)}_bufferInitSegment(e,t,i,s){if(this.state!==em)return;t.video&&delete t.video;const r=t.audio;if(!r)return;r.id="audio";const a=e.audioCodec;this.log(`Init audio buffer, container:${r.container}, codecs[level/parsed]=[${a}/${r.codec}]`),a&&1===a.split(",").length&&(r.levelCodec=a),this.hls.trigger(sc.BUFFER_CODECS,t);const o=r.initSegment;if(null!=o&&o.byteLength){const e={type:"audio",frag:i,part:null,chunkMeta:s,parent:i.type,data:o};this.hls.trigger(sc.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);var r;if(this.fragCurrent=e,this.switchingTrack||s===wf||s===Tf)if("initSegment"===e.sn)this._loadInitSegment(e,t);else if(null!=(r=t.details)&&r.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=rm;const i=this.mainDetails;i&&i.fragments[0].start!==t.details.fragments[0].start&&Ff(t.details,i)}else this.startFragRequested=!0,super.loadFragment(e,t,i);else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){const{media:t,bufferedTrack:i}=this,s=null==i?void 0:i.attrs,r=e.attrs;t&&s&&(s.CHANNELS!==r.CHANNELS||i.name!==e.name||i.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(sc.AUDIO_TRACK_SWITCHED,Yh({},e))}},audioTrackController:class extends df{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(sc.LEVEL_LOADING,this.onLevelLoading,this),e.on(sc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(sc.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(sc.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(sc.LEVEL_LOADING,this.onLevelLoading,this),e.off(sc.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(sc.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(sc.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:i,groupId:s,details:r}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==s)return void this.warn(`Audio track with id:${i} and group:${s} not found in active group ${null==a?void 0:a.groupId}`);const o=a.details;a.details=t.details,this.log(`Audio track ${i} "${a.name}" lang:${a.lang} group:${s} loaded [${r.startSN}-${r.endSN}]`),i===this.trackId&&this.playlistLoaded(i,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const i=t.audioGroups||null,s=this.groupIds;let r=this.currentTrack;if(!i||(null==s?void 0:s.length)!==(null==i?void 0:i.length)||null!=i&&i.some((e=>-1===(null==s?void 0:s.indexOf(e))))){this.groupIds=i,this.trackId=-1,this.currentTrack=null;const e=this.tracks.filter((e=>!i||-1!==i.indexOf(e.groupId)));if(e.length)this.selectDefaultTrack&&!e.some((e=>e.default))&&(this.selectDefaultTrack=!1),e.forEach(((e,t)=>{e.id=t}));else if(!r&&!this.tracksInGroup.length)return;this.tracksInGroup=e;const t=this.hls.config.audioPreference;if(!r&&t){const i=Af(t,e,vf);if(i>-1)r=e[i];else{const e=Af(t,this.tracks);r=this.tracks[e]}}let s=this.findTrackId(r);-1===s&&r&&(s=this.findTrackId(null));const o={audioTracks:e};this.log(`Updating audio tracks, ${e.length} track(s) found in group(s): ${null==i?void 0:i.join(",")}`),this.hls.trigger(sc.AUDIO_TRACKS_UPDATED,o);const n=this.trackId;if(-1!==s&&-1===n)this.setAudioTrack(s);else if(e.length&&-1===n){var a;const t=new Error(`No audio track selected for current audio group-ID(s): ${null==(a=this.groupIds)?void 0:a.join(",")} track count: ${e.length}`);this.warn(t.message),this.hls.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}else this.shouldReloadPlaylist(r)&&this.setAudioTrack(this.trackId)}onError(e,t){!t.fatal&&t.context&&(t.context.type!==lp||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||(this.requestScheduled=-1,this.checkRetry(t)))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const i=this.allAudioTracks;if(this.selectDefaultTrack=!1,i.length){const s=this.currentTrack;if(s&&bf(e,s,vf))return s;const r=Af(e,this.tracksInGroup,vf);if(r>-1){const e=this.tracksInGroup[r];return this.setAudioTrack(r),e}if(s){let s=t.loadLevel;-1===s&&(s=t.firstAutoLevel);const r=function(e,t,i,s,r){const a=t[s],o=t.reduce(((e,t,i)=>{const s=t.uri;return(e[s]||(e[s]=[])).push(i),e}),{})[a.uri];o.length>1&&(s=Math.max.apply(Math,o));const n=a.videoRange,l=a.frameRate,d=a.codecSet.substring(0,4),h=_f(t,s,(t=>{if(t.videoRange!==n||t.frameRate!==l||t.codecSet.substring(0,4)!==d)return!1;const s=t.audioGroups,a=i.filter((e=>!s||-1!==s.indexOf(e.groupId)));return Af(e,a,r)>-1}));return h>-1?h:_f(t,s,(t=>{const s=t.audioGroups,a=i.filter((e=>!s||-1!==s.indexOf(e.groupId)));return Af(e,a,r)>-1}))}(e,t.levels,i,s,vf);if(-1===r)return null;t.nextLoadLevel=r}if(e.channels||e.audioCodec){const t=Af(e,i);if(t>-1)return i[t]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length)return void this.warn(`Invalid audio track id: ${e}`);this.clearTimer(),this.selectDefaultTrack=!1;const i=this.currentTrack,s=t[e],r=s.details&&!s.details.live;if(e===this.trackId&&s===i&&r)return;if(this.log(`Switching to audio-track ${e} "${s.name}" lang:${s.lang} group:${s.groupId} channels:${s.channels}`),this.trackId=e,this.currentTrack=s,this.hls.trigger(sc.AUDIO_TRACK_SWITCHING,Yh({},s)),r)return;const a=this.switchParams(s.url,null==i?void 0:i.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let i=0;i{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=e=>{try{this.apply(e,{ot:Ay.MANIFEST,su:!this.initialized})}catch(e){hc.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=e=>{try{const t=e.frag,i=this.hls.levels[t.level],s=this.getObjectType(t),r={d:1e3*t.duration,ot:s};s!==Ay.VIDEO&&s!==Ay.AUDIO&&s!=Ay.MUXED||(r.br=i.bitrate/1e3,r.tb=this.getTopBandwidth(s)/1e3,r.bl=this.getBufferLength(s)),this.apply(e,r)}catch(e){hc.warn("Could not generate segment CMCD data.",e)}},this.hls=e;const t=this.config=e.config,{cmcd:i}=t;null!=i&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||function(){try{return crypto.randomUUID()}catch(e){try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){let t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const i=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?i:3&i|8).toString(16)}))}}}(),this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.includeKeys=i.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(sc.MEDIA_DETACHED,this.onMediaDetached,this),e.on(sc.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(sc.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(sc.MEDIA_DETACHED,this.onMediaDetached,this),e.off(sc.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var i,s;this.audioBuffer=null==(i=t.tracks.audio)?void 0:i.buffer,this.videoBuffer=null==(s=t.tracks.video)?void 0:s.buffer}createData(){var e;return{v:1,sf:by.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){Zh(t,this.createData());const i=t.ot===Ay.INIT||t.ot===Ay.VIDEO||t.ot===Ay.MUXED;this.starved&&i&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);const{includeKeys:s}=this;s&&(t=Object.keys(t).reduce(((e,i)=>(s.includes(i)&&(e[i]=t[i]),e)),{})),this.useHeaders?(e.headers||(e.headers={}),Hy(e.headers,t)):e.url=$y(e.url,t)}getObjectType(e){const{type:t}=e;return"subtitle"===t?Ay.TIMED_TEXT:"initSegment"===e.sn?Ay.INIT:"audio"===t?Ay.AUDIO:"main"===t?this.hls.audioTracks.length?Ay.VIDEO:Ay.MUXED:void 0}getTopBandwidth(e){let t,i=0;const s=this.hls;if(e===Ay.AUDIO)t=s.audioTracks;else{const e=s.maxAutoLevel,i=e>-1?e+1:s.levels.length;t=s.levels.slice(0,i)}for(const e of t)e.bitrate>i&&(i=e.bitrate);return i>0?i:NaN}getBufferLength(e){const t=this.hls.media,i=e===Ay.AUDIO?this.audioBuffer:this.videoBuffer;if(!i||!t)return NaN;return 1e3*Lf.bufferInfo(i,t.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,s){t(e),this.loader.load(e,i,s)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,i=e||this.config.loader;return class{constructor(e){this.loader=void 0,this.loader=new i(e)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,s){t(e),this.loader.load(e,i,s)}}}},contentSteeringController:class{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=hc.log.bind(hc,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.on(sc.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(sc.MANIFEST_PARSED,this.onManifestParsed,this),e.off(sc.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter((t=>t!==e)))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:i}=t;null!==i&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:i}=t;if((null==i?void 0:i.action)===sf&&i.flags===nf){const e=this.levels;let s=this.pathwayPriority,r=this.pathwayId;if(t.context){const{groupId:i,pathwayId:s,type:a}=t.context;i&&e?r=this.getPathwayForGroupId(i,a,r):s&&(r=s)}r in this.penalizedPathways||(this.penalizedPathways[r]=performance.now()),!s&&e&&(s=e.reduce(((e,t)=>(-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e)),[])),s&&s.length>1&&(this.updatePathwayPriority(s),i.resolved=this.pathwayId!==r),i.resolved||hc.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${r} levels: ${e?e.length:e} priorities: ${JSON.stringify(s)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){const i=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${i}"`),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length?(this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t):e}getLevelsForPathway(e){return null===this.levels?[]:this.levels.filter((t=>e===t.pathwayId))}updatePathwayPriority(e){let t;this.pathwayPriority=e;const i=this.penalizedPathways,s=performance.now();Object.keys(i).forEach((e=>{s-i[e]>3e5&&delete i[e]}));for(let s=0;s0){this.log(`Setting Pathway to "${r}"`),this.pathwayId=r,$p(t),this.hls.trigger(sc.LEVELS_UPDATED,{levels:t});const e=this.hls.levels[a];o&&e&&this.levels&&(e.attrs["STABLE-VARIANT-ID"]!==o.attrs["STABLE-VARIANT-ID"]&&e.bitrate!==o.bitrate&&this.log(`Unstable Pathways change from bitrate ${o.bitrate} to ${e.bitrate}`),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,i){const s=this.getLevelsForPathway(i).concat(this.levels||[]);for(let i=0;i{const{ID:r,"BASE-ID":a,"URI-REPLACEMENT":o}=e;if(t.some((e=>e.pathwayId===r)))return;const n=this.getLevelsForPathway(a).map((e=>{const t=new pc(e.attrs);t["PATHWAY-ID"]=r;const a=t.AUDIO&&`${t.AUDIO}_clone_${r}`,n=t.SUBTITLES&&`${t.SUBTITLES}_clone_${r}`;a&&(i[t.AUDIO]=a,t.AUDIO=a),n&&(s[t.SUBTITLES]=n,t.SUBTITLES=n);const l=Jy(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",o),d=new Up({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:l,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t{this.log(`Loaded steering manifest: "${s}"`);const a=e.data;if(1!==a.VERSION)return void this.log(`Steering VERSION ${a.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=a.TTL;const{"RELOAD-URI":o,"PATHWAY-CLONES":n,"PATHWAY-PRIORITY":l}=a;if(o)try{this.uri=new self.URL(o,s).href}catch(e){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${o}`)}this.scheduleRefresh(this.uri||i.url),n&&this.clonePathways(n);const d={steeringManifest:a,url:s.toString()};this.hls.trigger(sc.STEERING_MANIFEST_LOADED,d),l&&this.updatePathwayPriority(l)},onError:(e,t,i,s)=>{if(this.log(`Error loading steering manifest: ${e.code} ${e.text} (${t.url})`),this.stopLoad(),410===e.code)return this.enabled=!1,void this.log(`Steering manifest ${t.url} no longer available`);let r=1e3*this.timeToLoad;if(429!==e.code)this.scheduleRefresh(this.uri||t.url,r);else{const e=this.loader;if("function"==typeof(null==e?void 0:e.getResponseHeader)){const t=e.getResponseHeader("Retry-After");t&&(r=1e3*parseFloat(t))}this.log(`Steering manifest ${t.url} rate limited`)}},onTimeout:(e,t,i)=>{this.log(`Timeout loading steering manifest (${t.url})`),this.scheduleRefresh(this.uri||t.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(r,n,l)}scheduleRefresh(e,t=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout((()=>{var t;const i=null==(t=this.hls)?void 0:t.media;!i||i.ended?this.scheduleRefresh(e,1e3*this.timeToLoad):this.loadSteeringManifest(e)}),t)}}});function sA(e){return e&&"object"==typeof e?Array.isArray(e)?e.map(sA):Object.keys(e).reduce(((t,i)=>(t[i]=sA(e[i]),t)),{}):e}function rA(e){const t=e.loader;if(t!==Qy&&t!==Ky)hc.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1;else{(function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1})()&&(e.loader=Qy,e.progressive=!0,e.enableSoftwareAES=!0,hc.log("[config]: Progressive streaming enabled, using FetchLoader"))}}let aA;class oA extends df{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.on(sc.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(sc.LEVEL_LOADED,this.onLevelLoaded,this),e.on(sc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(sc.FRAG_BUFFERED,this.onFragBuffered,this),e.on(sc.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(sc.MANIFEST_LOADING,this.onManifestLoading,this),e.off(sc.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(sc.LEVEL_LOADED,this.onLevelLoaded,this),e.off(sc.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(sc.FRAG_BUFFERED,this.onFragBuffered,this),e.off(sc.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach((e=>{e.loadError=0,e.fragmentError=0})),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const i=this.hls.config.preferManagedMediaSource,s=[],r={},a={};let o=!1,n=!1,l=!1;t.levels.forEach((e=>{var t,d;const h=e.attrs;let{audioCodec:c,videoCodec:u}=e;-1!==(null==(t=c)?void 0:t.indexOf("mp4a.40.34"))&&(aA||(aA=/chrome|firefox/i.test(navigator.userAgent)),aA&&(e.audioCodec=c=void 0)),c&&(e.audioCodec=c=$u(c,i)),0===(null==(d=u)?void 0:d.indexOf("avc1"))&&(u=e.videoCodec=function(e){const t=e.split(".");if(t.length>2){let e=t.shift()+".";return e+=parseInt(t.shift()).toString(16),e+=("000"+parseInt(t.shift()).toString(16)).slice(-4),e}return e}(u));const{width:p,height:f,unknownCodecs:m}=e;if(o||(o=!(!p||!f)),n||(n=!!u),l||(l=!!c),null!=m&&m.length||c&&!Ou(c,"audio",i)||u&&!Ou(u,"video",i))return;const{CODECS:g,"FRAME-RATE":y,"HDCP-LEVEL":A,"PATHWAY-ID":b,RESOLUTION:v,"VIDEO-RANGE":_}=h,S=`${`${b||"."}-`}${e.bitrate}-${v}-${y}-${g}-${_}-${A}`;if(r[S])if(r[S].uri===e.url||e.attrs["PATHWAY-ID"])r[S].addGroupId("audio",h.AUDIO),r[S].addGroupId("text",h.SUBTITLES);else{const t=a[S]+=1;e.attrs["PATHWAY-ID"]=new Array(t+1).join(".");const i=new Up(e);r[S]=i,s.push(i)}else{const t=new Up(e);r[S]=t,a[S]=1,s.push(t)}})),this.filterAndSortMediaOptions(s,t,o,n,l)}filterAndSortMediaOptions(e,t,i,s,r){let a=[],o=[],n=e;if((i||s)&&r&&(n=n.filter((({videoCodec:e,videoRange:t,width:i,height:s})=>{return(!!e||!(!i||!s))&&(!!(r=t)&&Lp.indexOf(r)>-1);var r}))),0===n.length)return void Promise.resolve().then((()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const e=new Error("no level with compatible codecs found in manifest");this.hls.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}}));if(t.audioTracks){const{preferManagedMediaSource:e}=this.hls.config;a=t.audioTracks.filter((t=>!t.audioCodec||Ou(t.audioCodec,"audio",e))),nA(a)}t.subtitles&&(o=t.subtitles,nA(o));const l=n.slice(0);n.sort(((e,t)=>{if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return Lp.indexOf(e.videoRange)-Lp.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){const i=zu(e.videoCodec),s=zu(t.videoCodec);if(i!==s)return s-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){const i=Gu(e.codecSet),s=Gu(t.codecSet);if(i!==s)return s-i}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0}));let d=l[0];if(this.steering&&(n=this.steering.filterParsedLevels(n),n.length!==l.length))for(let e=0;ei&&i===iA.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}const c=r&&!s,u={levels:n,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:r,video:s,altAudio:!c&&a.some((e=>!!e.url))};this.hls.trigger(sc.MANIFEST_PARSED,u),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return 0===this._levels.length?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(0===t.length)return;if(e<0||e>=t.length){const i=new Error("invalid level idx"),s=e<0;if(this.hls.trigger(sc.ERROR,{type:rc.OTHER_ERROR,details:ac.LEVEL_SWITCH_ERROR,level:e,fatal:s,error:i,reason:i.message}),s)return;e=Math.min(e,t.length-1)}const i=this.currentLevelIndex,s=this.currentLevel,r=s?s.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,i===e&&a.details&&s&&r===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${i}${r?" with Pathway "+r:""}`);const n={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(sc.LEVEL_SWITCHING,n);const l=a.details;if(!l||l.live){const e=this.switchParams(a.uri,null==s?void 0:s.details);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(void 0===this._startLevel){const e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){!t.fatal&&t.context&&t.context.type===np&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(void 0!==t&&t.type===hp){const e=t.elementaryStreams;if(!Object.keys(e).some((t=>!!e[t])))return;const i=this._levels[t.level];null!=i&&i.loadError&&(this.log(`Resetting level error count of ${i.loadError} on frag buffered`),i.loadError=0)}}onLevelLoaded(e,t){var i;const{level:s,details:r}=t,a=this._levels[s];var o;if(!a)return this.warn(`Invalid level index ${s}`),void(null!=(o=t.deliveryDirectives)&&o.skip&&(r.deltaUpdateFailed=!0));s===this.currentLevelIndex?(0===a.fragmentError&&(a.loadError=0),this.playlistLoaded(s,t,a.details)):null!=(i=t.deliveryDirectives)&&i.skip&&(r.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){let s=i.uri;if(e)try{s=e.addDirectives(s)}catch(e){this.warn(`Could not construct new URL with HLS Delivery Directives: ${e}`)}const r=i.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${void 0!==(null==e?void 0:e.msn)?" at sn "+e.msn+" part "+e.part:""} with${r?" Pathway "+r:""} ${s}`),this.clearTimer(),this.hls.trigger(sc.LEVEL_LOADING,{url:s,level:t,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const i=this._levels.filter(((t,i)=>i!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach((e=>e.level=-1))),!1)));$p(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(sc.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(sc.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}}function nA(e){const t={};e.forEach((e=>{const i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++}))}class lA{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const i in this.keyUriToKeyInfo){const s=this.keyUriToKeyInfo[i].loader;if(s){var t;if(e&&e!==(null==(t=s.context)?void 0:t.frag.type))return;s.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=ac.KEY_LOAD_ERROR,i,s,r){return new Gf({type:rc.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:r,error:i,networkDetails:s})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:i,cc:s}=e;for(let e=0;e{r.setKeyFormat(e)}));break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(e).then((t=>this.loadInternal(e,t))):this.loadInternal(e)}loadInternal(e,t){var i,s;t&&e.setKeyFormat(t);const r=e.decryptdata;if(!r){const i=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,ac.KEY_LOAD_ERROR,i))}const a=r.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,ac.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));let o=this.keyUriToKeyInfo[a];if(null!=(i=o)&&i.decryptdata.key)return r.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});var n;if(null!=(s=o)&&s.keyLoadPromise)switch(null==(n=o.mediaKeySessionContext)?void 0:n.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then((t=>(r.key=t.keyInfo.decryptdata.key,{frag:e,keyInfo:o})))}switch(o=this.keyUriToKeyInfo[a]={decryptdata:r,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},r.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===r.keyFormat?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,ac.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${r.method}"`)))}}loadKeyEME(e,t){const i={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const t=this.emeController.loadKey(i);if(t)return(e.keyLoadPromise=t.then((t=>(e.mediaKeySessionContext=t,i)))).catch((t=>{throw e.keyLoadPromise=null,t}))}return Promise.resolve(i)}loadKeyHTTP(e,t){const i=this.config,s=new(0,i.loader)(i);return t.keyLoader=e.loader=s,e.keyLoadPromise=new Promise(((r,a)=>{const o={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},n=i.keyLoadPolicy.default,l={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},d={onSuccess:(e,t,i,s)=>{const{frag:o,keyInfo:n,url:l}=i;if(!o.decryptdata||n!==this.keyUriToKeyInfo[l])return a(this.createKeyLoadError(o,ac.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),s));n.decryptdata.key=o.decryptdata.key=new Uint8Array(e.data),o.keyLoader=null,n.loader=null,r({frag:o,keyInfo:n})},onError:(e,i,s,r)=>{this.resetLoader(i),a(this.createKeyLoadError(t,ac.KEY_LOAD_ERROR,new Error(`HTTP Error ${e.code} loading key ${e.text}`),s,Yh({url:o.url,data:void 0},e)))},onTimeout:(e,i,s)=>{this.resetLoader(i),a(this.createKeyLoadError(t,ac.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),s))},onAbort:(e,i,s)=>{this.resetLoader(i),a(this.createKeyLoadError(t,ac.INTERNAL_ABORTED,new Error("key loading aborted"),s))}};s.load(o,l,d)}))}resetLoader(e){const{frag:t,keyInfo:i,url:s}=e,r=i.loader;t.keyLoader===r&&(t.keyLoader=null,i.loader=null),delete this.keyUriToKeyInfo[s],r&&r.destroy()}}function dA(){return self.SourceBuffer||self.WebKitSourceBuffer}function hA(){if(!Uu())return!1;const e=dA();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}class cA{constructor(e,t,i,s){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=i,this.hls=s}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:i,media:s,stalled:r}=this;if(null===s)return;const{currentTime:a,seeking:o}=s,n=this.seeking&&!o,l=!this.seeking&&o;if(this.seeking=o,a!==e){if(this.moved=!0,o||(this.nudgeRetry=0),null!==r){if(this.stallReported){const e=self.performance.now()-r;hc.warn(`playback not stuck anymore @${a}, after ${Math.round(e)}ms`),this.stallReported=!1}this.stalled=null}return}if(l||n)return void(this.stalled=null);if(s.paused&&!o||s.ended||0===s.playbackRate||!Lf.getBuffered(s).length)return void(this.nudgeRetry=0);const d=Lf.bufferInfo(s,a,0),h=d.nextStart||0;if(o){const e=d.len>2,i=!h||t&&t.start<=a||h-a>2&&!this.fragmentTracker.getPartialFragment(a);if(e||i)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var c;if(!(d.len>0)&&!h)return;const e=Math.max(h,d.start||0)-a,t=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,i=(null==t||null==(c=t.details)?void 0:c.live)?2*t.details.targetduration:2,r=this.fragmentTracker.getPartialFragment(a);if(e>0&&(e<=i||r))return void(s.paused||this._trySkipBufferHole(r))}const u=self.performance.now();if(null===r)return void(this.stalled=u);const p=u-r;if(!o&&p>=250&&(this._reportStall(d),!this.media))return;const f=Lf.bufferInfo(s,a,i.maxBufferHole);this._tryFixBufferStall(f,p)}_tryFixBufferStall(e,t){const{config:i,fragmentTracker:s,media:r}=this;if(null===r)return;const a=r.currentTime,o=s.getPartialFragment(a);if(o){if(this._trySkipBufferHole(o)||!this.media)return}(e.len>i.maxBufferHole||e.nextStart&&e.nextStart-a1e3*i.highBufferWatchdogPeriod&&(hc.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:i,stallReported:s}=this;if(!s&&i){this.stallReported=!0;const s=new Error(`Playback stalling at @${i.currentTime} due to low buffer (${JSON.stringify(e)})`);hc.warn(s.message),t.trigger(sc.ERROR,{type:rc.MEDIA_ERROR,details:ac.BUFFER_STALLED_ERROR,fatal:!1,error:s,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:i,media:s}=this;if(null===s)return 0;const r=s.currentTime,a=Lf.bufferInfo(s,r,0),o=r0&&a.len<1&&s.readyState<3,d=o-r;if(d>0&&(n||l)){if(d>t.maxBufferHole){const{fragmentTracker:t}=this;let i=!1;if(0===r){const e=t.getAppendedFrag(0,hp);e&&o1?(e=0,this.bitrateTest=!0):e=i.firstAutoLevel),i.nextLoadLevel=e,this.level=i.loadLevel,this.loadedmetadata=!1}t>0&&-1===e&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=Kf,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=qf}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case am:{const{levels:e,level:t}=this,i=null==e?void 0:e[t],s=null==i?void 0:i.details;if(s&&(!s.live||this.levelLastLoaded===i)){if(this.waitForCdnTuneIn(s))break;this.state=Kf;break}if(this.hls.nextLoadLevel!==this.level){this.state=Kf;break}break}case Xf:{var e;const t=self.performance.now(),i=this.retryDate;if(!i||t>=i||null!=(e=this.media)&&e.seeking){const{levels:e,level:t}=this,i=null==e?void 0:e[t];this.resetStartWhenNotLoaded(i||null),this.state=Kf}}}this.state===Kf&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:i,media:s}=this;if(null===t||!s&&(this.startFragRequested||!e.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const r=e.nextLoadLevel;if(null==i||!i[r])return;const a=i[r],o=this.getMainFwdBufferInfo();if(null===o)return;const n=this.getLevelDetails();if(n&&this._streamEnded(o,n)){const e={};return this.altAudio&&(e.type="video"),this.hls.trigger(sc.BUFFER_EOS,e),void(this.state=im)}e.loadLevel!==r&&-1===e.manualLevel&&this.log(`Adapting to level ${r} from level ${this.level}`),this.level=e.nextLoadLevel=r;const l=a.details;if(!l||this.state===am||l.live&&this.levelLastLoaded!==a)return this.level=r,void(this.state=am);const d=o.len,h=this.getMaxBufferLength(a.maxBitrate);if(d>=h)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const c=this.backtrackFragment?this.backtrackFragment.start:o.end;let u=this.getNextFragment(c,l);if(this.couldBacktrack&&!this.fragPrevious&&u&&"initSegment"!==u.sn&&this.fragmentTracker.getState(u)!==kf){var p;const e=(null!=(p=this.backtrackFragment)?p:u).sn-l.startSN,t=l.fragments[e-1];t&&u.cc===t.cc&&(u=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);if(u&&this.isLoopLoading(u,c)){if(!u.gap){const e=this.audioOnly&&!this.altAudio?yc:Ac,t=(e===Ac?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e,hp)}u=this.getNextFragmentLoopLoading(u,l,o,hp,h)}u&&(!u.initSegment||u.initSegment.data||this.bitrateTest||(u=u.initSegment),this.loadFragment(u,a,c))}loadFragment(e,t,i){const s=this.fragmentTracker.getState(e);this.fragCurrent=e,s===wf||s===Tf?"initSegment"===e.sn?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,i)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,hp)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(null!=t&&t.readyState){let i;const s=this.getAppendedFrag(t.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);const r=this.getLevelDetails();if(null!=r&&r.live){const e=this.getMainFwdBufferInfo();if(!e||e.len<2*r.targetduration)return}if(!t.paused&&e){const t=e[this.hls.nextLoadLevel],s=this.fragLastKbps;i=s&&this.fragCurrent?this.fragCurrent.duration*t.maxBitrate/(1e3*s)+1:0}else i=0;const a=this.getBufferedFrag(t.currentTime+i);if(a){const e=this.followingBufferedFrag(a);if(e){this.abortCurrentFrag();const t=e.maxStartPTS?e.maxStartPTS:e.start,i=e.duration,s=Math.max(a.end,t+Math.min(Math.max(i-this.config.maxFragLookUpTolerance,i*(this.couldBacktrack?.5:.125)),i*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(s,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Yf:case Qf:case Xf:case em:case tm:this.state=Kf}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const i=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new cA(this.config,i,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;ec(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const i=this.getMainFwdBufferInfo();null!==i&&0!==i.len?this.tick():this.warn(`Main forward buffer length on "seeked" event ${i?i.len:"empty"})`)}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(sc.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let i=!1,s=!1;t.levels.forEach((e=>{const t=e.audioCodec;t&&(i=i||-1!==t.indexOf("mp4a.40.2"),s=s||-1!==t.indexOf("mp4a.40.5"))})),this.audioCodecSwitch=i&&s&&!function(){var e;const t=dA();return"function"==typeof(null==t||null==(e=t.prototype)?void 0:e.changeType)}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:i}=this;if(!i||this.state!==Kf)return;const s=i[t.level];(!s.details||s.details.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(s.details))&&(this.state=am)}onLevelLoaded(e,t){var i;const{levels:s}=this,r=t.level,a=t.details,o=a.totalduration;if(!s)return void this.warn(`Levels were reset while loading level ${r}`);this.log(`Level ${r} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""}, cc [${a.startCC}, ${a.endCC}] duration:${o}`);const n=s[r],l=this.fragCurrent;!l||this.state!==Qf&&this.state!==Xf||l.level!==t.level&&l.loader&&this.abortCurrentFrag();let d=0;if(a.live||null!=(i=n.details)&&i.live){var h;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;d=this.alignPlaylists(a,n.details,null==(h=this.levelLastLoaded)?void 0:h.details)}if(n.details=a,this.levelLastLoaded=n,this.hls.trigger(sc.LEVEL_UPDATED,{details:a,level:r}),this.state===am){if(this.waitForCdnTuneIn(a))return;this.state=Kf}this.startFragRequested?a.live&&this.synchronizeToLiveEdge(a):this.setStartPosition(a,d),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:i,part:s,payload:r}=e,{levels:a}=this;if(!a)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${i.sn} of level ${i.level} will not be buffered`);const o=a[i.level],n=o.details;if(!n)return this.warn(`Dropping fragment ${i.sn} of level ${i.level} after level details were reset`),void this.fragmentTracker.removeFragment(i);const l=o.videoCodec,d=n.PTSKnown||!n.live,h=null==(t=i.initSegment)?void 0:t.data,c=this._getAudioCodec(o),u=this.transmuxer=this.transmuxer||new ug(this.hls,hp,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=s?s.index:-1,f=-1!==p,m=new Pf(i.level,i.sn,i.stats.chunkCount,r.byteLength,p,f),g=this.initPTS[i.cc];u.push(r,h,c,l,i,s,n.totalduration,d,m,g)}onAudioTrackSwitching(e,t){const i=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const e=this.fragCurrent;e&&(this.log("Switching to main audio track, cancel main fragment load"),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const e=this.hls;i&&(e.trigger(sc.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),e.trigger(sc.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const i=t.id,s=!!this.hls.audioTracks[i].url;if(s){const e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e)}this.altAudio=s,this.tick()}onBufferCreated(e,t){const i=t.tracks;let s,r,a=!1;for(const e in i){const t=i[e];if("main"===t.id){if(r=e,s=t,"video"===e){const t=i[e];t&&(this.videoBuffer=t.buffer)}}else a=!0}a&&s?(this.log(`Alternate track found, use ${r}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:i,part:s}=t;if(i&&i.type!==hp)return;if(this.fragContextChanged(i))return this.warn(`Fragment ${i.sn}${s?" p: "+s.index:""} of level ${i.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===tm&&(this.state=Kf));const r=s?s.stats:i.stats;this.fragLastKbps=Math.round(8*r.total/(r.buffering.end-r.loading.first)),"initSegment"!==i.sn&&(this.fragPrevious=i),this.fragBufferedComplete(i,s)}onError(e,t){var i;if(t.fatal)this.state=sm;else switch(t.details){case ac.FRAG_GAP:case ac.FRAG_PARSING_ERROR:case ac.FRAG_DECRYPT_ERROR:case ac.FRAG_LOAD_ERROR:case ac.FRAG_LOAD_TIMEOUT:case ac.KEY_LOAD_ERROR:case ac.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(hp,t);break;case ac.LEVEL_LOAD_ERROR:case ac.LEVEL_LOAD_TIMEOUT:case ac.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==am||(null==(i=t.context)?void 0:i.type)!==np||(this.state=Kf);break;case ac.BUFFER_APPEND_ERROR:case ac.BUFFER_FULL_ERROR:if(!t.parent||"main"!==t.parent)return;if(t.details===ac.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case ac.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}checkBuffer(){const{media:e,gapController:t}=this;if(e&&t&&e.readyState){if(this.loadedmetadata||!Lf.getBuffered(e).length){const e=this.state!==Kf?this.fragCurrent:null;t.poll(this.lastCurrentTime,e)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=Kf,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==yc||this.audioOnly&&!this.altAudio){const e=(t===Ac?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(e,t,hp),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let i=this.startPosition;if(i>=0&&t0&&(r{const{hls:s}=this;if(!i||this.fragContextChanged(e))return;t.fragmentError=0,this.state=Kf,this.startFragRequested=!1,this.bitrateTest=!1;const r=e.stats;r.parsing.start=r.parsing.end=r.buffering.start=r.buffering.end=self.performance.now(),s.trigger(sc.FRAG_LOADED,i),e.bitrateTest=!1}))}_handleTransmuxComplete(e){var t;const i="main",{hls:s}=this,{remuxResult:r,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o)return void this.resetWhenMissingContext(a);const{frag:n,part:l,level:d}=o,{video:h,text:c,id3:u,initSegment:p}=r,{details:f}=d,m=this.altAudio?void 0:r.audio;if(this.fragContextChanged(n))this.fragmentTracker.removeFragment(n);else{if(this.state=em,p){if(null!=p&&p.tracks){const e=n.initSegment||n;this._bufferInitSegment(d,p.tracks,e,a),s.trigger(sc.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:p.tracks})}const e=p.initPTS,t=p.timescale;ec(e)&&(this.initPTS[n.cc]={baseTime:e,timescale:t},s.trigger(sc.INIT_PTS_FOUND,{frag:n,id:i,initPTS:e,timescale:t}))}if(h&&f&&"initSegment"!==n.sn){const e=f.fragments[n.sn-1-f.startSN],t=n.sn===f.startSN,i=!e||n.cc>e.cc;if(!1!==r.independent){const{startPTS:e,endPTS:s,startDTS:r,endDTS:o}=h;if(l)l.elementaryStreams[h.type]={startPTS:e,endPTS:s,startDTS:r,endDTS:o};else if(h.firstKeyFrame&&h.independent&&1===a.id&&!i&&(this.couldBacktrack=!0),h.dropped&&h.independent){const r=this.getMainFwdBufferInfo(),a=(r?r.end:this.getLoadPosition())+this.config.maxBufferHole,l=h.firstKeyFramePTS?h.firstKeyFramePTS:e;if(!t&&a2&&(n.gap=!0);n.setElementaryStreamInfo(h.type,e,s,r,o),this.backtrackFragment&&(this.backtrackFragment=n),this.bufferFragmentData(h,n,l,a,t||i)}else{if(!t&&!i)return void this.backtrack(n);n.gap=!0}}if(m){const{startPTS:e,endPTS:t,startDTS:i,endDTS:s}=m;l&&(l.elementaryStreams[yc]={startPTS:e,endPTS:t,startDTS:i,endDTS:s}),n.setElementaryStreamInfo(yc,e,t,i,s),this.bufferFragmentData(m,n,l,a)}if(f&&null!=u&&null!=(t=u.samples)&&t.length){const e={id:i,frag:n,details:f,samples:u.samples};s.trigger(sc.FRAG_PARSING_METADATA,e)}if(f&&c){const e={id:i,frag:n,details:f,samples:c.samples};s.trigger(sc.FRAG_PARSING_USERDATA,e)}}}_bufferInitSegment(e,t,i,s){if(this.state!==em)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:r,video:a,audiovideo:o}=t;if(r){let t=e.audioCodec;const i=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(t&&(t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==r.metadata.channelCount&&-1===i.indexOf("firefox")&&(t="mp4a.40.5")),t&&-1!==t.indexOf("mp4a.40.5")&&-1!==i.indexOf("android")&&"audio/mpeg"!==r.container&&(t="mp4a.40.2",this.log(`Android: force audio codec to ${t}`)),e.audioCodec&&e.audioCodec!==t&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${t}"`),r.levelCodec=t,r.id="main",this.log(`Init audio buffer, container:${r.container}, codecs[selected/level/parsed]=[${t||""}/${e.audioCodec||""}/${r.codec}]`)}a&&(a.levelCodec=e.videoCodec,a.id="main",this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${a.codec}]`)),o&&this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),this.hls.trigger(sc.BUFFER_CODECS,t),Object.keys(t).forEach((e=>{const r=t[e].initSegment;null!=r&&r.byteLength&&this.hls.trigger(sc.BUFFER_APPENDING,{type:e,data:r,frag:i,part:null,chunkMeta:s,parent:i.type})})),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,hp)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=Kf}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&!1===e.seeking){const i=e.currentTime;if(Lf.isBuffered(e,i)?t=this.getAppendedFrag(i):Lf.isBuffered(e,i+.1)&&(t=this.getAppendedFrag(i+.1)),t){this.backtrackFragment=null;const e=this.fragPlaying,i=t.level;e&&t.sn===e.sn&&e.level===i||(this.fragPlaying=t,this.hls.trigger(sc.FRAG_CHANGED,{frag:t}),e&&e.level===i||this.hls.trigger(sc.LEVEL_SWITCHED,{level:i}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,i=this.currentFrag;if(i&&ec(t)&&ec(i.programDateTime)){const e=i.programDateTime+1e3*(t-i.start);return new Date(e)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class pA{static get version(){return"1.5.7"}static isMSESupported(){return hA()}static isSupported(){return function(){if(!hA())return!1;const e=Uu();return"function"==typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some((t=>e.isTypeSupported(ju(t,"video"))))||["mp4a.40.2","fLaC"].some((t=>e.isTypeSupported(ju(t,"audio")))))}()}static getMediaSource(){return Uu()}static get Events(){return sc}static get ErrorTypes(){return rc}static get ErrorDetails(){return ac}static get DefaultConfig(){return pA.defaultConfig?pA.defaultConfig:iA}static set DefaultConfig(e){pA.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new cg,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,function(e,t){if("object"==typeof console&&!0===e||"object"==typeof e){dc(e,"debug","log","info","warn","error");try{lc.log(`Debug logs enabled for "${t}" in hls.js version 1.5.7`)}catch(e){lc=nc}}else lc=nc}(e.debug||!1,"Hls instance");const t=this.config=function(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const i=sA(e),s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((e=>{const r=`${"level"===e?"playlist":e}LoadPolicy`,a=void 0===t[r],o=[];s.forEach((s=>{const n=`${e}Loading${s}`,l=t[n];if(void 0!==l&&a){o.push(n);const e=i[r].default;switch(t[r]={default:e},s){case"TimeOut":e.maxLoadTimeMs=l,e.maxTimeToFirstByteMs=l;break;case"MaxRetry":e.errorRetry.maxNumRetry=l,e.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":e.errorRetry.retryDelayMs=l,e.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":e.errorRetry.maxRetryDelayMs=l,e.timeoutRetry.maxRetryDelayMs=l}}})),o.length&&hc.warn(`hls.js config: "${o.join('", "')}" setting(s) are deprecated, use "${r}": ${JSON.stringify(t[r])}`)})),Yh(Yh({},i),t)}(pA.DefaultConfig,e);this.userConfig=e,t.progressive&&rA(t);const{abrController:i,bufferController:s,capLevelController:r,errorController:a,fpsController:o}=t,n=new a(this),l=this.abrController=new i(this),d=this.bufferController=new s(this),h=this.capLevelController=new r(this),c=new o(this),u=new mp(this),p=new xp(this),f=t.contentSteeringController,m=f?new f(this):null,g=this.levelController=new oA(this,m),y=new Cf(this),A=new lA(this.config),b=this.streamController=new uA(this,y,A);h.setStreamController(b),c.setStreamController(b);const v=[u,g,b];m&&v.splice(1,0,m),this.networkControllers=v;const _=[l,d,h,c,p,y];this.audioTrackController=this.createController(t.audioTrackController,v);const S=t.audioStreamController;S&&v.push(new S(this,y,A)),this.subtitleTrackController=this.createController(t.subtitleTrackController,v);const w=t.subtitleStreamController;w&&v.push(new w(this,y,A)),this.createController(t.timelineController,_),A.emeController=this.emeController=this.createController(t.emeController,_),this.cmcdController=this.createController(t.cmcdController,_),this.latencyController=this.createController(Rp,_),this.coreComponents=_,v.push(n);const E=n.onErrorOut;"function"==typeof E&&this.on(sc.ERROR,E,n)}createController(e,t){if(e){const i=new e(this);return t&&t.push(i),i}return null}on(e,t,i=this){this._emitter.on(e,t,i)}once(e,t,i=this){this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,i=this,s){this._emitter.off(e,t,i,s)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(hc.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;const i=e===sc.ERROR;this.trigger(sc.ERROR,{type:rc.OTHER_ERROR,details:ac.INTERNAL_EXCEPTION,fatal:i,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){hc.log("destroy"),this.trigger(sc.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((e=>e.destroy())),this.networkControllers.length=0,this.coreComponents.forEach((e=>e.destroy())),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){hc.log("attachMedia"),this._media=e,this.trigger(sc.MEDIA_ATTACHING,{media:e})}detachMedia(){hc.log("detachMedia"),this.trigger(sc.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,i=this.url,s=this.url=qh.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,hc.log(`loadSource:${s}`),t&&i&&(i!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(sc.MANIFEST_LOADING,{url:e})}startLoad(e=-1){hc.log(`startLoad(${e})`),this.started=!0,this.networkControllers.forEach((t=>{t.startLoad(e)}))}stopLoad(){hc.log("stopLoad"),this.started=!1,this.networkControllers.forEach((e=>{e.stopLoad()}))}resumeBuffering(){this.started&&this.networkControllers.forEach((e=>{"fragmentLoader"in e&&e.startLoad(-1)}))}pauseBuffering(){this.networkControllers.forEach((e=>{"fragmentLoader"in e&&e.stopLoad()}))}swapAudioCodec(){hc.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){hc.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){hc.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){hc.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){hc.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){hc.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){hc.log(`set startLevel:${e}`),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(hc.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){(function(e){return Dp.indexOf(e)>-1})(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const i=e.length;for(let s=0;s=t)return s;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:i}=this;let s;if(s=-1===t&&null!=e&&e.length?e.length-1:t,i)for(let t=s;t--;){const s=e[t].attrs["HDCP-LEVEL"];if(s&&s<=i)return t}return s}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return null==(t=this.audioTrackController)?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return null==(t=this.subtitleTrackController)||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return!!e&&e.subtitleDisplay}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}pA.defaultConfig=void 0;class fA extends So{constructor(e){super(),this.player=e,this.TAG_NAME="HlsDecoder",e._opt,this.canVideoPlay=!1,this.$videoElement=null,this.canvasRenderInterval=null,this.bandwidthEstimateInterval=null,this.fpsInterval=null,this.hlsFps=0,this.hlsPrevFrams=0,this.isInitInfo=!1,this.eventsDestroy=[],this.supportVideoFrameCallbackHandle=null,this.player.isHlsCanVideoPlay()?(this.$videoElement=this.player.video.$videoElement,this.canVideoPlay=!0):pA.isSupported()?(this.$videoElement=this.player.video.$videoElement,this.hls=new pA({}),this._initHls(),this._bindEvents()):this.player.debug.error(this.TAG_NAME,"init hls error ,not support "),this.player.debug.log(this.TAG_NAME,"init")}destroy(){return new Promise(((e,t)=>{this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.hls&&(this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.isInitInfo=!1,this._stopCanvasRender(),this._stopBandwidthEstimateInterval(),this._stopFpsInterval(),this.$videoElement=null,this.hlsFps=0,this.player.debug.log(this.TAG_NAME,"destroy"),setTimeout((()=>{e()}),0)}))}checkHlsBufferedDelay(){const e=this.$videoElement;let t=0;const i=e.buffered,s=i.length?i.end(i.length-1):0;return t=s-e.currentTime,t<0&&(this.player.debug.warn(this.TAG_NAME,`checkHlsBufferedDelay ${t} < 0, and buffered is ${s} ,currentTime is ${e.currentTime} , try to seek ${e.currentTime} to ${s}`),e.currentTime=s,t=0),t}getFps(){return this.hlsFps}_startCanvasRender(){bo()?this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)):(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:parseInt(1e3*this.$videoElement.currentTime,10)||0})}),40))}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.player.isDestroyedOrClosed())return void this.player.debug.log(this.TAG_NAME,"videoFrameCallback() player is destroyed");const i=parseInt(1e3*Math.max(t.mediaTime,this.$videoElement.currentTime),10)||0;this.player.video.render({$video:this.$videoElement,ts:i}),this.player.handleRender(),this.player.updateStats({dts:i}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this))}_startBandwidthEstimateInterval(){this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{let e=0;this.hls.bandwidthEstimate&&(e=this.hls.bandwidthEstimate),this.player.emit(nt.kBps,(e/1024/8/10).toFixed(2))}),1e3)}_stopBandwidthEstimateInterval(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}_startFpsInterval(){this._stopCanvasRender(),this.fpsInterval=setInterval((()=>{if(this.$videoElement)if(Ya(this.$videoElement.getVideoPlaybackQuality)){const e=this.$videoElement.getVideoPlaybackQuality();this.hlsFps=e.totalVideoFrames-this.hlsPrevFrams,this.hlsPrevFrams=e.totalVideoFrames}else{const e=this.$videoElement.webkitDecodedFrameCount||0;this.hlsFps=e-this.hlsPrevFrams,this.hlsPrevFrams=e}}),1e3)}_stopFpsInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_initHls(){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.$videoElement.muted=!0,Aa()&&(this.$videoElement.style.position="absolute"),this.initVideoEvents()),this.hls.attachMedia(this.$videoElement)}_bindEvents(){const e=this.player,{proxy:t}=this.player.events;this.hls;const i=this.$videoElement,s=bo(),r=t(i,is,(t=>{if(this.hls){const i=parseInt(t.timeStamp,10);this.player._opt.useCanvasRender&&po(s)&&e.updateStats({ts:i,dts:i})}}));this.eventsDestroy.push(r),this._startBandwidthEstimateInterval(),this._startFpsInterval(),this.hls.on(pA.Events.ERROR,((e,t)=>{if(t.fatal)switch(t.type){case pA.ErrorTypes.NETWORK_ERROR:this.player.debug.warn(this.TAG_NAME,"fatal network error encountered, try to recover"),this.hls.startLoad();break;case pA.ErrorTypes.MEDIA_ERROR:this.player.debug.warn(this.TAG_NAME,"fatal media error encountered, try to recover"),this.hls.recoverMediaError()}})),this.hls.on(pA.Events.MEDIA_ATTACHING,(()=>{})),this.hls.on(pA.Events.MEDIA_ATTACHED,(()=>{})),this.hls.on(pA.Events.MEDIA_DETACHING,(()=>{})),this.hls.on(pA.Events.MEDIA_DETACHED,(()=>{})),this.hls.on(pA.Events.BUFFER_RESET,(()=>{})),this.hls.on(pA.Events.BUFFER_CODECS,(()=>{})),this.hls.on(pA.Events.BUFFER_CREATED,(()=>{})),this.hls.on(pA.Events.BUFFER_APPENDING,((e,t)=>{this.player.debug.log(this.TAG_NAME,"BUFFER_APPENDING",t.type)})),this.hls.on(pA.Events.BUFFER_APPENDED,(()=>{})),this.hls.on(pA.Events.BUFFER_EOS,(()=>{})),this.hls.on(pA.Events.BUFFER_FLUSHING,(()=>{})),this.hls.on(pA.Events.BUFFER_FLUSHED,(()=>{})),this.hls.on(pA.Events.MANIFEST_LOADING,(()=>{this.player.debug.log(this.TAG_NAME,"MANIFEST_LOADING 开始加载playlist m3u8资源")})),this.hls.on(pA.Events.MANIFEST_LOADED,((e,t)=>{this.player.debug.log(this.TAG_NAME,"MANIFEST_LOADED playlist m3u8文件加载完成",t.url)})),this.hls.on(pA.Events.MANIFEST_PARSED,(()=>{this.player.debug.log(this.TAG_NAME,"MANIFEST_PARSED playlist m3u8解析完成"),e._times.demuxStart||(e._times.demuxStart=aa())})),this.hls.on(pA.Events.LEVEL_LOADING,(()=>{})),this.hls.on(pA.Events.LEVEL_LOADED,((e,t)=>{})),this.hls.on(pA.Events.FRAG_LOADING,(()=>{})),this.hls.on(pA.Events.FRAG_LOADED,((t,i)=>{e._times.decodeStart||(e._times.decodeStart=aa())})),this.hls.on(pA.Events.BUFFER_APPENDING,(()=>{e._times.videoStart||(e._times.videoStart=aa(),e.handlePlayToRenderTimes())})),this.hls.on(pA.Events.FRAG_DECRYPTED,(()=>{})),this.hls.on(pA.Events.KEY_LOADING,(()=>{})),this.hls.on(pA.Events.KEY_LOADING,(()=>{})),this.hls.on(pA.Events.FPS_DROP,(e=>{})),this.hls.on(pA.Events.FPS_DROP_LEVEL_CAPPING,(e=>{})),this.hls.on(pA.Events.FRAG_PARSING_INIT_SEGMENT,((e,t)=>{this.player.debug.log(this.TAG_NAME,"FRAG_PARSING_INIT_SEGMENT",t);const i=!!(t&&t.tracks&&t.tracks.audio),s=!!(t&&t.tracks&&t.tracks.video);if(i&&t.tracks.audio){let e=t.tracks.audio;const i=e.metadata&&e.metadata.channelCount?e.metadata.channelCount:0,s=e.codec;this.player.audio&&this.player.audio.updateAudioInfo({encType:s,channels:i,sampleRate:44100})}if(s&&t.tracks.video){let e=t.tracks.video;const i={encTypeCode:-1!==e.codec.indexOf("avc")?vt:_t};e.metadata&&(i.width=e.metadata.width,i.height=e.metadata.height),this.player.video&&this.player.video.updateVideoInfo(i)}}))}initVideoPlay(e){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.initVideoEvents()),this.$videoElement.autoplay=!0,this.$videoElement.muted=!0,this.$videoElement.src=e}_initRenderSize(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}initVideoEvents(){const{proxy:e}=this.player.events,t=e(this.$videoElement,es,(()=>{this.player.debug.log(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.debug.log(this.TAG_NAME,"video play"),this._startCanvasRender(),this._initRenderSize()})).catch((e=>{this.player.debug.warn(this.TAG_NAME,"video play error ",e)}))})),i=e(this.$videoElement,ts,(()=>{this.player.debug.log(this.TAG_NAME,"video waiting")})),s=e(this.$videoElement,is,(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t}),this.$videoElement.paused&&(this.player.debug.warn(this.TAG_NAME,"video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debug.log(this.TAG_NAME,"video is paused and replay success")})).catch((e=>{this.player.debug.warn(this.TAG_NAME,"video is paused and replay error ",e)})))})),r=e(this.$videoElement,ss,(()=>{this.player.debug.log(this.TAG_NAME,"video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)}));this.eventsDestroy.push(t,i,s,r)}loadSource(e){return new Promise(((t,i)=>{this.canVideoPlay?(this.initVideoPlay(e),t()):this.hls.on(pA.Events.MEDIA_ATTACHED,(()=>{this.hls.loadSource(e),t()}))}))}}const mA=2097152,gA="fetch",yA="xhr",AA="arraybuffer",bA="text",vA="json",_A="real_time_speed",SA=Object.prototype.toString;function wA(e){if("[object Object]"!==SA.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function EA(e){if(!e||null===e[0]||void 0===e[0]||0===e[0]&&(null===e[1]||void 0===e[1]))return;let t="bytes="+e[0]+"-";return e[1]&&(t+=e[1]),t}function TA(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function kA(e,t){if(!e)return;if(!t)return e;let i;const s=Object.keys(t).map((e=>{if(i=t[e],null!=i)return Array.isArray(i)?e+="[]":i=[i],i.map((t=>{var i;return i=t,"[object Date]"===SA.call(i)?t=t.toISOString():function(e){return null!==e&&"object"==typeof e}(t)&&(t=JSON.stringify(t)),`${TA(e)}=${TA(t)}`})).join("&")})).filter(Boolean).join("&");if(s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}function CA(e,t,i,s,r,a,o,n,l,d,h){r=null!=r?parseFloat(r):null,s=parseInt(s||"0",10),Number.isNaN(s)&&(s=0);return{data:e,done:t,option:{range:l,vid:d,index:n,contentLength:s,age:r,startTime:a,firstByteTime:o,endTime:Date.now(),priOptions:h},response:i}}function xA(e,t){return Math.round(8*e*1e3/t/1024)}class RA extends Error{constructor(e,t,i,s){super(s),zd(this,"retryCount",0),zd(this,"isTimeout",!1),zd(this,"loaderType",gA),zd(this,"startTime",0),zd(this,"endTime",0),zd(this,"options",{}),this.url=e,this.request=t,this.response=i}}class DA extends So{constructor(e){super(),zd(this,"_abortController",null),zd(this,"_timeoutTimer",null),zd(this,"_reader",null),zd(this,"_response",null),zd(this,"_aborted",!1),zd(this,"_index",-1),zd(this,"_range",null),zd(this,"_receivedLength",0),zd(this,"_running",!1),zd(this,"_logger",null),zd(this,"_vid",""),zd(this,"_onProcessMinLen",0),zd(this,"_onCancel",null),zd(this,"_priOptions",null),zd(this,"TAG_NAME","FetchLoader"),this.player=e}load(e){var t;let{url:i,vid:s,timeout:r,responseType:a,onProgress:o,index:n,onTimeout:l,onCancel:d,range:h,transformResponse:c,request:u,params:p,logger:f,method:m,headers:g,body:y,mode:A,credentials:b,cache:v,redirect:_,referrer:S,referrerPolicy:w,onProcessMinLen:E,priOptions:T}=e;this._aborted=!1,this._onProcessMinLen=E,this._onCancel=d,this._abortController="undefined"!=typeof AbortController&&new AbortController,this._running=!0,this._index=n,this._range=h||[0,0],this._vid=s||i,this._priOptions=T||{};const k={method:m,headers:g,body:y,mode:A,credentials:b,cache:v,redirect:_,referrer:S,referrerPolicy:w,signal:null===(t=this._abortController)||void 0===t?void 0:t.signal};let C=!1;clearTimeout(this._timeoutTimer),i=kA(i,p);const x=EA(h);x&&(g=u?u.headers:k.headers=k.headers||(Headers?new Headers:{}),Headers&&g instanceof Headers?g.append("Range",x):g.Range=x),r&&(this._timeoutTimer=setTimeout((()=>{if(C=!0,this.cancel(),l){const e=new RA(i,k,null,"timeout");e.isTimeout=!0,l(e,{index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})}}),r));const R=Date.now();return(Ba(n)||Ba(h))&&this.player.debug.log(this.TAG_NAME,"[fetch load start], index,",n,",range,",h),new Promise(((e,t)=>{fetch(u||i,u?void 0:k).then((async s=>{if(clearTimeout(this._timeoutTimer),this._response=s,this._aborted||!this._running)return;if(c&&(s=c(s,i)||s),!s.ok)throw new RA(i,k,s,"bad network response");const r=Date.now();let l;if(a===bA)l=await s.text(),this._running=!1;else if(a===vA)l=await s.json(),this._running=!1;else{if(o)return this.resolve=e,this.reject=t,void this._loadChunk(s,o,R,r);{l=await s.arrayBuffer(),l=new Uint8Array(l),this._running=!1;const e=Date.now()-R,t=xA(l.byteLength,e);this.emit(_A,{speed:t,len:l.byteLength,time:e,vid:this._vid,index:this._index,range:this._range,priOptions:this._priOptions})}}(Ba(n)||Ba(h))&&this.player.debug.log(this.TAG_NAME,"[fetch load end], index,",n,",range,",h),e(CA(l,!0,s,s.headers.get("Content-Length"),s.headers.get("age"),R,r,n,h,this._vid,this._priOptions))})).catch((e=>{var s;clearTimeout(this._timeoutTimer),this._running=!1,this._aborted&&!C||((e=e instanceof RA?e:new RA(i,k,null,null===(s=e)||void 0===s?void 0:s.message)).startTime=R,e.endTime=Date.now(),e.isTimeout=C,e.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},t(e))}))}))}async cancel(){if(!this._aborted){if(this._aborted=!0,this._running=!1,this._response){try{this._reader&&await this._reader.cancel()}catch(e){}this._response=this._reader=null}if(this._abortController){try{this._abortController.abort()}catch(e){}this._abortController=null}this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})}}_loadChunk(e,t,i,s){if(!e.body||!e.body.getReader){this._running=!1;const t=new RA(e.url,"",e,"onProgress of bad response.body.getReader");return t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},void this.reject(t)}this._onProcessMinLen>0&&(this._cache=new Uint8Array(mA),this._writeIdx=0);const r=this._reader=e.body.getReader();let a,o,n;const l=async()=>{var d;o=Date.now();try{a=await r.read(),n=Date.now()}catch(e){return n=Date.now(),void(this._aborted||(this._running=!1,e.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this.reject(e)))}const h=(null===(d=this._range)||void 0===d?void 0:d.length)>0?this._range[0]:0,c=h+this._receivedLength;if(this._aborted)return this._running=!1,void t(void 0,!1,{range:[c,c],vid:this._vid,index:this._index,startTime:o,endTime:n,st:i,firstByteTime:s,priOptions:this._priOptions},e);const u=a.value?a.value.byteLength:0;let p;if(this._receivedLength+=u,this.player.debug.log(this.TAG_NAME,"【fetchLoader,onProgress call】,task,",this._range,", start,",c,", end,",h+this._receivedLength,", done,",a.done),this._onProcessMinLen>0){if(this._writeIdx+u>=this._onProcessMinLen||a.done)p=new Uint8Array(this._writeIdx+u),p.set(this._cache.slice(0,this._writeIdx),0),u>0&&p.set(a.value,this._writeIdx),this._writeIdx=0,this.player.debug.log(this.TAG_NAME,"【fetchLoader,onProgress enough】,done,",a.done,",len,",p.byteLength,", writeIdx,",this._writeIdx);else if(u>0&&this._writeIdx+u0){const e=new Uint8Array(this._writeIdx+u+2048);this.player.debug.log(this.TAG_NAME,"【fetchLoader,onProgress extra start】,size,",this._writeIdx+u+2048,", datalen,",u,", writeIdx,",this._writeIdx),e.set(this._cache.slice(0,this._writeIdx),0),u>0&&e.set(a.value,this._writeIdx),this._writeIdx+=u,delete this._cache,this._cache=e,this.player.debug.log(this.TAG_NAME,"【fetchLoader,onProgress extra end】,len,",u,", writeIdx,",this._writeIdx)}}else p=a.value;if((p&&p.byteLength>0||a.done)&&t(p,a.done,{range:[this._range[0]+this._receivedLength-(p?p.byteLength:0),this._range[0]+this._receivedLength],vid:this._vid,index:this._index,startTime:o,endTime:n,st:i,firstByteTime:s,priOptions:this._priOptions},e),a.done){const t=Date.now()-i,r=xA(this._receivedLength,t);this.emit(_A,{speed:r,len:this._receivedLength,time:t,vid:this._vid,index:this._index,range:this._range,priOptions:this._priOptions}),this._running=!1,this.player.debug.log(this.TAG_NAME,"[fetchLoader onProgress end],task,",this._range,",done,",a.done),this.resolve(CA(a,!0,e,e.headers.get("Content-Length"),e.headers.get("age"),i,s,this._index,this._range,this._vid,this._priOptions))}else l()};l()}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}static isSupported(){return!("undefined"==typeof fetch)}}class LA{constructor(e,t,i){zd(this,"TAG_NAME","Task"),this.promise=function(){let e,t;const i=new Promise(((i,s)=>{e=i,t=s}));return i.used=!1,i.resolve=function(){return i.used=!0,e(...arguments)},i.reject=function(){return i.used=!0,t(...arguments)},i}(),this.alive=!!t.onProgress,this._loaderType=e,this.player=i,this._loader=e===gA&&window.fetch?new DA(i):new PA(i),this._config=t,this._retryCount=0,this._retryTimer=null,this._canceled=!1,this._retryCheckFunc=t.retryCheckFunc}exec(){const{retry:e,retryDelay:t,onRetryError:i,transformError:s,...r}=this._config,a=async()=>{try{const e=await this._loader.load(r);this.promise.resolve(e)}catch(o){if(this._loader.running=!1,this.player.debug.log(this.TAG_NAME,"[task request catch err]",o),this._canceled)return;o.loaderType=this._loaderType,o.retryCount=this._retryCount;let n=o;s&&(n=s(n)||n),i&&this._retryCount>0&&i(n,this._retryCount,{index:r.index,vid:r.vid,range:r.range,priOptions:r.priOptions}),this._retryCount++;let l=!0;if(this._retryCheckFunc&&(l=this._retryCheckFunc(o)),l&&this._retryCount<=e)return clearTimeout(this._retryTimer),this.player.debug.log(this.TAG_NAME,"[task request setTimeout],retry",this._retryCount,",retry range,",r.range),void(this._retryTimer=setTimeout(a,t));this.promise.reject(n)}};return a(),this.promise}async cancel(){return clearTimeout(this._retryTimer),this._canceled=!0,this._loader.running=!1,this._loader.cancel()}get running(){return this._loader&&this._loader.running}get loader(){return this._loader}}class PA extends So{constructor(e){super(),zd(this,"_xhr",null),zd(this,"_aborted",!1),zd(this,"_timeoutTimer",null),zd(this,"_range",null),zd(this,"_receivedLength",0),zd(this,"_url",null),zd(this,"_onProgress",null),zd(this,"_index",-1),zd(this,"_headers",null),zd(this,"_currentChunkSizeKB",384),zd(this,"_timeout",null),zd(this,"_xhr",null),zd(this,"_withCredentials",null),zd(this,"_startTime",-1),zd(this,"_loadCompleteResolve",null),zd(this,"_loadCompleteReject",null),zd(this,"_runing",!1),zd(this,"_logger",!1),zd(this,"_vid",""),zd(this,"_responseType",void 0),zd(this,"_credentials",void 0),zd(this,"_method",void 0),zd(this,"_transformResponse",void 0),zd(this,"_firstRtt",void 0),zd(this,"_onCancel",null),zd(this,"_priOptions",null),zd(this,"TAG_NAME","XhrLoader"),this.player=e}load(e){clearTimeout(this._timeoutTimer),this._range=e.range,this._onProgress=e.onProgress,this._index=e.index,this._headers=e.headers,this._withCredentials="include"===e.credentials||"same-origin"===e.credentials,this._body=e.body||null,e.method&&(this._method=e.method),this._timeout=e.timeout||null,this._runing=!0,this._vid=e.vid||e.url,this._responseType=e.responseType,this._firstRtt=-1,this._onTimeout=e.onTimeout,this._onCancel=e.onCancel,this._request=e.request,this._priOptions=e.priOptions||{},this.player.debug.log(this.TAG_NAME,"【xhrLoader task】, range",this._range),this._url=kA(e.url,e.params);const t=Date.now();return new Promise(((e,t)=>{this._loadCompleteResolve=e,this._loadCompleteReject=t,this._startLoad()})).catch((e=>{if(clearTimeout(this._timeoutTimer),this._runing=!1,!this._aborted)throw(e=e instanceof RA?e:new RA(this._url,this._request)).startTime=t,e.endTime=Date.now(),e.options={index:this._index,vid:this._vid,priOptions:this._priOptions},e}))}_startLoad(){let e=null;if(this._responseType===AA&&this._range&&this._range.length>1)if(this._onProgress){this._firstRtt=-1;const t=1024*this._currentChunkSizeKB,i=this._range[0]+this._receivedLength;let s=this._range[1];t],tast :",this._range,", SubRange, ",e)}else e=this._range,this.player.debug.log(this.TAG_NAME,"[xhr_loader->],tast :",this._range,", allRange, ",e);this._internalOpen(e)}_internalOpen(e){try{this._startTime=Date.now();const t=this._xhr=new XMLHttpRequest;t.open(this._method||"GET",this._url,!0),t.responseType=this._responseType,this._timeout&&(t.timeout=this._timeout),t.withCredentials=this._withCredentials,t.onload=this._onLoad.bind(this),t.onreadystatechange=this._onReadyStatechange.bind(this),t.onerror=e=>{var t,i,s;this._running=!1;const r=new RA(this._url,this._request,null==e||null===(t=e.currentTarget)||void 0===t?void 0:t.response,"xhr.onerror.status:"+(null==e||null===(i=e.currentTarget)||void 0===i?void 0:i.status)+",statusText,"+(null==e||null===(s=e.currentTarget)||void 0===s?void 0:s.statusText));r.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(r)},t.ontimeout=e=>{this.cancel();const t=new RA(this._url,this._request,{status:408},"timeout");this._onTimeout&&(t.isTimeout=!0,this._onTimeout(t,{index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions})),t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)};const i=this._headers||{},s=EA(e);s&&(i.Range=s),i&&Object.keys(i).forEach((e=>{t.setRequestHeader(e,i[e])})),this.player.debug.log(this.TAG_NAME,"[xhr.send->] tast,",this._range,",load sub range, ",e),t.send(this._body)}catch(t){t.options={index:this._index,range:e,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}}_onReadyStatechange(e){2===e.target.readyState&&this._firstRtt<0&&(this._firstRtt=Date.now())}_onLoad(e){var t;const i=e.target.status;if(i<200||i>299){const t=new RA(this._url,null,{...e.target.response,status:i},"bad response,status:"+i);return t.options={index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions},this._loadCompleteReject(t)}let s,r=null,a=!1;const o=(null===(t=this._range)||void 0===t?void 0:t.length)>0?this._range[0]:0;if(this._responseType===AA){var n;const t=new Uint8Array(e.target.response);if(s=o+this._receivedLength,t&&t.byteLength>0){this._receivedLength+=t.byteLength;const e=Date.now()-this._startTime,i=xA(this._receivedLength,e);this.emit(_A,{speed:i,len:this._receivedLength,time:e,vid:this._vid,index:this._index,range:[s,o+this._receivedLength],priOptions:this._priOptions})}r=t,a=!((null===(n=this._range)||void 0===n?void 0:n.length)>1&&this._range[1]&&this._receivedLength], tast :",this._range,", start",s,"end ",o+this._receivedLength,",dataLen,",t?t.byteLength:0,",receivedLength",this._receivedLength,",index,",this._index,", done,",a)}else a=!0,r=e.target.response;let l={ok:i>=200&&i<300,status:i,statusText:this._xhr.statusText,url:this._xhr.responseURL,headers:this._getHeaders(this._xhr),body:this._xhr.response};this._transformResponse&&(l=this._transformResponse(l,this._url)||l),this._onProgress&&this._onProgress(r,a,{index:this._index,vid:this._vid,range:[s,o+this._receivedLength],startTime:this._startTime,endTime:Date.now(),priOptions:this._priOptions},l),a?(this._runing=!1,this._loadCompleteResolve&&this._loadCompleteResolve(CA(this._onProgress?null:r,a,l,l.headers["content-length"],l.headers.age,this._startTime,this._firstRtt,this._index,this._range,this._vid,this._priOptions))):this._startLoad()}cancel(){if(!this._aborted)return this._aborted=!0,this._runing=!1,super.removeAllListeners(),this._onCancel&&this._onCancel({index:this._index,range:this._range,vid:this._vid,priOptions:this._priOptions}),this._xhr?this._xhr.abort():void 0}static isSupported(){return"undefined"!=typeof XMLHttpRequest}get receiveLen(){return this._receivedLength}get running(){return this._running}set running(e){this._running=e}_getHeaders(e){const t=e.getAllResponseHeaders().trim().split("\r\n"),i={};for(const e of t){const t=e.split(": ");i[t[0].toLowerCase()]=t.slice(1).join(": ")}return i}}class BA extends So{constructor(e,t){super(),zd(this,"type",gA),zd(this,"_queue",[]),zd(this,"_alive",[]),zd(this,"_currentTask",null),zd(this,"_config",void 0),this.player=t,this._config=function(e){return{loaderType:gA,retry:0,retryDelay:0,timeout:0,request:null,onTimeout:void 0,onProgress:void 0,onRetryError:void 0,transformRequest:void 0,transformResponse:void 0,transformError:void 0,responseType:bA,range:void 0,url:"",params:void 0,method:"GET",headers:{},body:void 0,mode:void 0,credentials:void 0,cache:void 0,redirect:void 0,referrer:void 0,referrerPolicy:void 0,integrity:void 0,onProcessMinLen:0,...e}}(e),this._config.loaderType!==yA&&DA.isSupported()||(this.type=yA)}destroy(){this._queue=[],this._alive=[],this._currentTask=null}isFetch(){return this.type===gA}static isFetchSupport(){return DA.isSupported()}load(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"string"!=typeof e&&e?t=e:t.url=e||t.url||this._config.url,t=Object.assign({},this._config,t),t.params&&(t.params=Object.assign({},t.params)),t.headers&&wA(t.headers)&&(t.headers=Object.assign({},t.headers)),t.body&&wA(t.body)&&(t.body=Object.assign({},t.body)),t.transformRequest&&(t=t.transformRequest(t)||t);const i=new LA(this.type,t,this.player);return i.loader.on(_A,(e=>{this.emit(_A,e)})),this._queue.push(i),1!==this._queue.length||this._currentTask&&this._currentTask.running||this._processTask(),i.promise}async cancel(){const e=this._queue.map((e=>e.cancel())).concat(this._alive.map((e=>e.cancel())));this._currentTask&&e.push(this._currentTask.cancel()),this._queue=[],this._alive=[],await Promise.all(e),await function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((t=>setTimeout(t,e)))}()}_processTask(){if(this._currentTask=this._queue.shift(),!this._currentTask)return;this._currentTask.alive&&this._alive.push(this._currentTask);const e=this._currentTask.exec().catch((e=>{}));e&&"function"==typeof e.finally&&e.finally((()=>{var e,t;null!==(e=this._currentTask)&&void 0!==e&&e.alive&&(null===(t=this._alive)||void 0===t?void 0:t.length)>0&&(this._alive=this._alive.filter((e=>e&&e!==this._currentTask))),this._processTask()}))}}const IA="network",MA="network_timeout",UA="other",FA="manifest",OA="hls",NA="demux";class jA extends Error{constructor(e,t,i,s,r){super(r||(null==i?void 0:i.message)),this.errorType=e===MA?IA:e,this.originError=i,this.ext=s,this.errorMessage=this.message}static create(e,t,i,s,r){return e instanceof jA?e:(e instanceof Error&&(i=e,e=""),e||(e=UA),new jA(e,t,i,s,r))}static network(e){var t;return new jA(null!=e&&e.isTimeout?MA:IA,null,e instanceof Error?e:null,{url:null==e?void 0:e.url,response:null==e?void 0:e.response,httpCode:null==e||null===(t=e.response)||void 0===t?void 0:t.status})}}const zA=/^#(EXT[^:]*)(?::(.*))?$/,GA=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g,HA=/^(?:[a-zA-Z0-9+\-.]+:)?\/\//,VA=/^((?:[a-zA-Z0-9+\-.]+:)?\/\/[^/?#]*)?([^?#]*\/)?/;function $A(e){const t=e.match(zA);if(t&&t[1])return[t[1].replace("EXT-X-",""),t[2]]}function WA(e){const t={};let i=GA.exec(e);for(;i;)t[i[1]]=i[2]||i[3],i=GA.exec(e);return t}function JA(e,t){if(!t||!e||HA.test(e))return e;const i=VA.exec(t);return i?"/"===e[0]?i[1]+e:i[1]+i[2]+e:e}const qA={audio:[/^mp4a/,/^vorbis$/,/^opus$/,/^flac$/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]};function KA(e,t){const i=qA[e];if(i&&t&&t.length)for(let e=0;e>8*(15-t)&255}}}class ob{static parse(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!e.includes("#EXTM3U"))throw new Error("Invalid m3u8 file");const i=function(e){return e.split(/[\r\n]/).map((e=>e.trim())).filter(Boolean)}(e);return ob.isMediaPlaylist(e)?function(e,t){const i=new sb;i.url=t;let s,r=new rb,a=null,o=null,n=0,l=0,d=0,h=0,c=!1;for(;(s=e[h++])&&!c;){if("#"!==s[0]){r.sn=l,r.cc=d,r.url=JA(s,t),o&&(r.key=o.clone(l)),a&&(r.initSegment=a),i.segments.push(r),r=new rb,l++;continue}const e=$A(s);if(!e)continue;const[h,u]=e;switch(h){case"VERSION":i.version=parseInt(u);break;case"PLAYLIST-TYPE":i.type=null==u?void 0:u.toUpperCase();break;case"TARGETDURATION":i.targetDuration=parseFloat(u);break;case"ENDLIST":{const e=i.segments[i.segments.length-1];e&&(e.isLast=!0),i.live=!1,c=!0}break;case"MEDIA-SEQUENCE":l=i.startSN=parseInt(u);break;case"DISCONTINUITY-SEQUENCE":d=i.startCC=parseInt(u);break;case"DISCONTINUITY":d++;break;case"BYTERANGE":r.setByteRange(u,i.segments[i.segments.length-1]);break;case"EXTINF":{const[e,t]=u.split(",");r.start=n,r.duration=parseFloat(e),n+=r.duration,r.title=t}break;case"KEY":{const e=WA(u);if("NONE"===e.METHOD){o=null;break}if("AES-128"!==e.METHOD)throw new Error(`encrypt ${e.METHOD}/${e.KEYFORMAT} is not supported`);if(o=new ab,o.method=e.METHOD,o.url=/^blob:/.test(e.URI)?e.URI:JA(e.URI,t),o.keyFormat=e.KEYFORMAT||"identity",o.keyFormatVersions=e.KEYFORMATVERSIONS,e.IV){let t=e.IV.slice(2);t=(1&t.length?"0":"")+t,o.iv=new Uint8Array(t.length/2);for(let e=0,i=t.length/2;e{e.id=t})),a.length&&(a.forEach(((e,t)=>{e.id=t})),i.streams.forEach((e=>{e.audioGroup&&(e.audioStreams=a.filter((t=>t.group===e.audioGroup)))}))),o.length&&(o.forEach(((e,t)=>{e.id=t})),i.streams.forEach((e=>{e.subtitleGroup&&(e.subtitleStreams=o.filter((t=>t.group===e.subtitleGroup)))}))),i}(i,t)}static isMediaPlaylist(e){return e.includes("#EXTINF:")||e.includes("#EXT-X-TARGETDURATION:")}}class nb{constructor(e){zd(this,"_onLoaderRetry",((e,t)=>{this.hls.emit(qs,{error:jA.network(e),retryTime:t})})),this.hls=e,this.player=e.player,this.TAG_NAME="HlsManifestLoader",this._timer=null;const{retryCount:t,retryDelay:i,loadTimeout:s,fetchOptions:r}=this.hls.config;this._loader=new BA({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._audioLoader=new BA({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._subtitleLoader=new BA({...r,responseType:"text",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player)}async destroy(){await this.stopPoll(),this._audioLoader&&(this._audioLoader.destroy(),this._audioLoader=null),this._subtitleLoader&&(this._subtitleLoader.destroy(),this._subtitleLoader=null),this._loader&&(this._loader.destroy(),this._loader=null)}async load(e,t,i){this.player.debug.log(this.TAG_NAME,"load()",e,t,i);const s=[this._loader.load(e)];let r,a,o,n,l,d;t&&s.push(this._audioLoader.load(t)),i&&s.push(this._subtitleLoader.load(i));try{const[e,i,n]=await Promise.all(s);if(!e)return[];r=e.data,t?(a=null==i?void 0:i.data,o=null==n?void 0:n.data):o=null==i?void 0:i.data}catch(e){throw jA.network(e)}try{var h;if(n=ob.parse(r,e),!1===(null===(h=n)||void 0===h?void 0:h.live)&&n.segments&&!n.segments.length)throw new Error("empty segments list");a&&(l=ob.parse(a,t)),o&&(d=ob.parse(o,i))}catch(e){throw new jA(FA,OA,e)}return n&&(n.isMaster?this.hls.emit(Gs,{playlist:n}):this.hls.emit(Hs,{playlist:n})),[n,l,d]}poll(e,t,i,s,r,a){clearTimeout(this._timer),a=a||3e3;let o=this.hls.config.pollRetryCount;const n=async()=>{clearTimeout(this._timer);try{const r=await this.load(e,t,i);if(!r[0])return;o=this.hls.config.pollRetryCount,s(r[0],r[1],r[2])}catch(e){o--,o<=0&&r(e)}this._timer=setTimeout(n,a)};this._timer=setTimeout(n,a)}stopPoll(){return clearTimeout(this._timer),this.cancel()}cancel(){return Promise.all([this._loader.cancel(),this._audioLoader.cancel()])}}class lb{constructor(){zd(this,"_chunkSpeeds",[]),zd(this,"_speeds",[])}addRecord(e,t){e&&t&&(this._speeds.push(8e3*e/t),this._speeds=this._speeds.slice(-3))}addChunkRecord(e,t){e&&t&&(this._chunkSpeeds.push(8e3*e/t),this._chunkSpeeds=this._chunkSpeeds.slice(-100))}getAvgSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds.reduce(((e,t)=>e+t))/this._speeds.length:this._chunkSpeeds.reduce(((e,t)=>e+t))/this._chunkSpeeds.length:0}getLatestSpeed(){return this._chunkSpeeds.length||this._speeds.length?this._speeds.length?this._speeds[this._speeds.length-1]:this._chunkSpeeds[this._chunkSpeeds.length-1]:0}reset(){this._chunkSpeeds=[],this._speeds=[]}}class db{constructor(e){zd(this,"_emitOnLoaded",((e,t)=>{const{data:i,response:s,option:r}=e,{firstByteTime:a,startTime:o,endTime:n,contentLength:l}=r||{},d=n-o;this._bandwidthService.addRecord(l||i.byteLength,d),this.hls.emit(Ys,{time:d,byteLength:l,url:t}),this.hls.emit(Qs,{url:t,elapsed:d||0}),this.hls.emit(Js,{url:t,responseUrl:s.url,elapsed:a-o}),this.hls.emit(Xs,{headers:s.headers})})),zd(this,"_onLoaderRetry",((e,t)=>{this.hls.emit(qs,{error:jA.network(e),retryTime:t})})),this.hls=e,this.player=e.player,this._bandwidthService=new lb;const{retryCount:t,retryDelay:i,loadTimeout:s,fetchOptions:r}=this.hls.config;this._segmentLoader=new BA({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._audioSegmentLoader=new BA({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player),this._keyLoader=new BA({...r,responseType:"arraybuffer",retry:t,retryDelay:i,timeout:s,onRetryError:this._onLoaderRetry},this.player)}destroy(){this.reset(),this._keyLoader&&(this._keyLoader.destroy(),this._keyLoader=null),this._audioSegmentLoader&&(this._audioSegmentLoader.destroy(),this._audioSegmentLoader=null),this._segmentLoader&&(this._segmentLoader.destroy(),this._segmentLoader=null)}speedInfo(){return{speed:this._bandwidthService.getLatestSpeed(),avgSpeed:this._bandwidthService.getAvgSpeed()}}resetBandwidth(){this._bandwidthService.reset()}load(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:i;const r=[];return e&&(r[0]=this.loadVideoSegment(e,i)),t&&(r[1]=this.loadAudioSegment(t,s)),Promise.all(r)}loadVideoSegment(e,t){return this._loadSegment(this._segmentLoader,e,t)}loadAudioSegment(e,t){return this._loadSegment(this._audioSegmentLoader,e,t)}async _loadSegment(e,t,i){var s;let r,a,o,n,l;const d=[];if(this.hls.emit(Ks,{url:t.url}),d[0]=e.load(t.url),i&&t.initSegment){var h;const i=t.initSegment.url;r=this._mapCache[i],r||(this.hls.emit(Ks,{url:i}),d[1]=e.load(i).then((e=>{if(e){Object.keys(this._mapCache)>30&&(this._mapCache={}),r=this._mapCache[i]=e.data,this._emitOnLoaded(e,i)}})));const s=null===(h=t.initSegment.key)||void 0===h?void 0:h.url;s&&(l=t.initSegment.key.iv,n=this._keyCache[s],n||(this.hls.emit(Ks,{url:s}),d[2]=this._keyLoader.load(s).then((e=>{e&&(n=this._keyCache[s]=e.data,this._emitOnLoaded(e,s))}))))}const c=null===(s=t.key)||void 0===s?void 0:s.url;c&&(o=t.key.iv,a=this._keyCache[c],a||(this.hls.emit(Ks,{url:c}),d[3]=this._keyLoader.load(c).then((e=>{e&&(a=this._keyCache[c]=e.data,this._emitOnLoaded(e,c))}))));const[u]=await Promise.all(d);if(!u)return;const p=u.data;return this._emitOnLoaded(u,t.url),{data:p,map:r,key:a,mapKey:n,keyIv:o,mapKeyIv:l}}reset(){this.error=null,this._mapCache={},this._keyCache={},this._bandwidthService.reset()}async cancel(){await Promise.all([this._keyLoader.cancel(),this._segmentLoader.cancel(),this._audioSegmentLoader.cancel()])}}class hb{constructor(e,t,i){this.live=void 0,this.id=0,this.bitrate=0,this.width=0,this.height=0,this.name="",this.url="",this.audioCodec="",this.videoCodec="",this.textCodec="",this.startCC=0,this.endCC=0,this.startSN=0,this.endSN=-1,this.totalDuration=0,this.targetDuration=0,this.snDiff=null,this.segments=[],this.audioStreams=[],this.subtitleStreams=[],this.closedCaptions=[],this.currentAudioStream=null,this.currentSubtitleStream=null,this.TAG_NAME="HlsStream",this.update(e,t,i)}get lastSegment(){return this.segments.length?this.segments[this.segments.length-1]:null}get segmentDuration(){var e;return this.targetDuration||(null===(e=this.segments[0])||void 0===e?void 0:e.duration)||0}get liveEdge(){return this.endTime}get endTime(){var e;return(null===(e=this.lastSegment)||void 0===e?void 0:e.end)||0}get currentSubtitleEndSn(){var e;return(null===(e=this.currentSubtitleStream)||void 0===e?void 0:e.endSN)||0}clearOldSegment(e,t){return this._clearSegments(e,t)}getAudioSegment(e){if(!e||!this.currentAudioStream)return;const t=e.sn-this.snDiff;return this.currentAudioStream.segments.find((e=>e.sn===t))}update(e,t){this.url=e.url,Array.isArray(e.segments)?(null!==this.live&&void 0!==this.live||(this.live=e.live),this._updateSegments(e,this),this.startCC=e.startCC,this.endCC=e.endCC,this.startSN=e.startSN,this.endSN=e.endSN||-1,this.totalDuration=e.totalDuration,this.targetDuration=e.targetDuration,this.live=e.live,t&&this.currentAudioStream&&Array.isArray(t.segments)&&(this._updateSegments(t,this.currentAudioStream),(null===this.snDiff||void 0===this.snDiff)&&e.segments.length&&t.segments.length&&(this.snDiff=e.segments[0].sn-t.segments[0].sn))):(this.id=e.id,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.name=e.name,this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.textCodec=e.textCodec,this.audioStreams=e.audioStreams,this.subtitleStreams=e.subtitleStreams,!this.currentAudioStream&&this.audioStreams.length&&(this.currentAudioStream=this.audioStreams.find((e=>e.default))||this.audioStreams[0]),!this.currentSubtitleStream&&this.subtitleStreams.length&&(this.currentSubtitleStream=this.subtitleStreams.find((e=>e.default))||this.subtitleStreams[0]))}updateSubtitle(e){if(!(e&&this.currentSubtitleStream&&Array.isArray(e.segments)))return;const t=this._updateSegments(e,this.currentSubtitleStream),i=this.currentSubtitleStream.segments;return i.length>100&&(this.currentSubtitleStream.segments=i.slice(100)),t?t.map((e=>({sn:e.sn,url:e.url,duration:e.duration,start:e.start,end:e.end,lang:this.currentSubtitleStream.lang}))):void 0}switchSubtitle(e){const t=this.subtitleStreams.find((t=>t.lang===e)),i=this.currentSubtitleStream;t&&(this.currentSubtitleStream=t,i.segments=[])}_clearSegments(e,t){let i=0;const s=this.segments;for(let t=0,r=s.length;t=e){i=t;break}return i>t&&(i=t),i&&(this.segments=this.segments.slice(i),this.currentAudioStream&&(this.currentAudioStream.segments=this.currentAudioStream.segments.slice(i))),t-i}_updateSegments(e,t){const i=t.segments;if(this.live){const s=i[i.length-1],r=(null==s?void 0:s.sn)||-1;if(re.sn===r)),o=a<0?e.segments:e.segments.slice(a+1);if(i.length&&o.length){let e=s.end;o.forEach((t=>{t.start=e,e=t.end}));const t=(null==s?void 0:s.cc)||-1;t>o[0].cc&&o.forEach((e=>e.cc+=t))}return t.endSN=e.endSN,t.segments=i.concat(o),o}}else t.segments=e.segments}}class cb{constructor(e){this.hls=e,this.player=e.player,this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1,this.TAG_NAME="HlsPlaylist"}destroy(){this.reset()}get lastSegment(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.lastSegment}get currentSegment(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer]}get nextSegment(){var e;return null===(e=this.currentSegments)||void 0===e?void 0:e[this._segmentPointer+1]}get currentSegments(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.segments}get currentSubtitleEndSn(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.currentSubtitleEndSn}get liveEdge(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.liveEdge}get totalDuration(){var e;return(null===(e=this.currentStream)||void 0===e?void 0:e.totalDuration)||0}get seekRange(){const e=this.currentSegments;if(e&&e.length)return[e[0].start,e[e.length-1].end]}get isEmpty(){var e;return!(null!==(e=this.currentSegments)&&void 0!==e&&e.length)}get isLive(){var e;return null===(e=this.currentStream)||void 0===e?void 0:e.live}get hasSubtitle(){var e;return!(null===(e=this.currentStream)||void 0===e||!e.currentSubtitleStream)}getAudioSegment(e){var t;return null===(t=this.currentStream)||void 0===t?void 0:t.getAudioSegment(e)}moveSegmentPointer(e){var t;null==e&&(e=this._segmentPointer+1),this._segmentPointer=oa(e,-1,null===(t=this.currentSegments)||void 0===t?void 0:t.length),this.player.debug.log(this.TAG_NAME,`moveSegmentPointer() and param pos is ${e} and clamp result is ${this._segmentPointer}`)}reset(){this.streams=[],this.currentStream=null,this.dvrWindow=0,this._segmentPointer=-1}getSegmentByIndex(e){var t;return null===(t=this.currentSegments)||void 0===t?void 0:t[e]}setNextSegmentByIndex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._segmentPointer=e-1,this.player.debug.log(this.TAG_NAME,"setNextSegmentByIndex()",e,this._segmentPointer)}findSegmentIndexByTime(e){const t=this.currentSegments;if(t){for(let i,s=0,r=t.length;s=i.start&&ee.url)).forEach(((e,t)=>{this.streams[t]?this.streams[t].update(e):this.streams[t]=new hb(e)})),this.currentStream=this.streams[0];else if(Array.isArray(e.segments)){const s=this.currentStream;if(s){s.update(e,t,i);const r=s.updateSubtitle(i);r&&this.hls.emit(zs,{list:r})}else this.reset(),this.currentStream=this.streams[0]=new hb(e,t,i)}this.currentStream&&this.hls.isLive&&!this.dvrWindow&&(this.dvrWindow=this.currentSegments.reduce(((e,t)=>e+=t.duration),0))}switchSubtitle(e){var t;null===(t=this.currentStream)||void 0===t||t.switchSubtitle(e)}clearOldSegment(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50;const t=this.currentStream;if(!this.dvrWindow||!t)return;const i=t.endTime-this.dvrWindow;if(i<=0)return void this.player.debug.log(this.TAG_NAME,`clearOldSegment() stream.endTime:${t.endTime}, this.dvrWindow:${this.dvrWindow} startTime <= 0`);const s=t.segments;if(s.length<=e)return void this.player.debug.log(this.TAG_NAME,`clearOldSegment() segments.length:${s.length} <= maxPlaylistSize:${e}`);const r=this._segmentPointer;this._segmentPointer=t.clearOldSegment(i,r),this.player.debug.log(this.TAG_NAME,"clearOldSegment() update _segmentPointer:",r,this._segmentPointer),this.player.debug.log(this.TAG_NAME,"currentSegments",this.currentSegments)}checkSegmentTrackChange(e,t){const i=this.findSegmentIndexByTime(e),s=this.getSegmentByIndex(i);if(!s)return;if(!s.hasAudio&&!s.hasVideo)return;if(2!==t&&s.hasAudio&&s.hasVideo)return s;if(s.end-e>.3)return;const r=this.getSegmentByIndex(i+1);return r&&(r.hasAudio||r.hasVideo)&&(r.hasAudio!==s.hasAudio||r.hasVideo!==s.hasVideo)?r:void 0}}class ub{constructor(e,t){this.hls=e,this.player=t;const i=window.crypto||window.msCrypto;this.subtle=i&&(i.subtle||i.webkitSubtle),this.externalDecryptor=null}decrypt(e,t){if(!e&&!t)return;const i=[];return e&&(i[0]=this._decryptSegment(e)),t&&(i[1]=this._decryptSegment(t)),Promise.all(i)}async _decryptSegment(e){let t=e.data;return e.key&&(t=await this._decryptData(e.data,e.key,e.keyIv)),e.map?Yd(e.map,t):t}async _decryptData(e,t,i){if(this.externalDecryptor)return await this.externalDecryptor.decrypt(e,t,i);if(this.subtle){const s=await this.subtle.importKey("raw",t,{name:"AES-CBC"},!1,["encrypt","decrypt"]),r=await this.subtle.decrypt({name:"AES-CBC",iv:i},s,e);return new Uint8Array(r)}e=ud(e),t=ud(t),i=ud(i);return function(e){const{words:t}=e,{sigBytes:i}=e,s=new Uint8Array(i);for(let e=0;e>>2]>>>24-e%4*8&255;return s}(hd.AES.decrypt({ciphertext:e},t,{iv:i,mode:hd.mode.CBC}))}}class pb extends Dd{constructor(e){super(e),this.player=e,this._pmtId=-1,this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[],this._gopId=0,this._videoPid=-1,this._audioPid=-1,this._codecType=vt,this._audioCodecType=Et,this._vps=null,this._sps=null,this._pps=null,this.TAG_NAME="HlsTsLoader",this._isForHls=!0,this.videoTrack=pb.initVideoTrack(),this.audioTrack=pb.initAudioTrack(),this._baseDts=-1,this._baseDtsInited=!1,this._basefps=25,this._baseFpsInterval=null,this._tempSampleTsList=[],this._hasAudio=!1,this._hasVideo=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._isSendAACSeqHeader=!1,this.workerClearTimeout=null,this.workerUrl=null,this.loopWorker=null,this.tempSampleListInfo={},this._isUseWorker()&&this._initLoopWorker(),this.player.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.loopWorker&&(this.loopWorker.postMessage({cmd:"destroy"}),this.loopWorker.terminate(),this.loopWorker=null),this._stopDecodeLoopInterval(),this.videoTrack=null,this.audioTrack=null,this.tempSampleListInfo={},this._baseDts=-1,this._baseDtsInited=!1,this._basefps=25,this._hasCalcFps=!1,this._audioNextPts=void 0,this._videoNextDts=void 0,this._audioTimestampBreak=!1,this._videoTimestampBreak=!1,this._lastAudioExceptionGapDot=0,this._lastAudioExceptionOverlapDot=0,this._lastAudioExceptionLargeGapDot=0,this._isForHls=!0,this._isSendAACSeqHeader=!1,this.player.debug.log(this.TAG_NAME,"destroy")}static initVideoTrack(){return{samples:[]}}static initAudioTrack(){return{samples:[]}}static probe(e){return!!e.length&&(71===e[0]&&71===e[188]&&71===e[376])}_parsePES(e){const t=e[8];if(null==t||e.lengthe.length-6)return;let r,a;const o=e[7];return 192&o&&(r=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&o?(a=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,r-a>54e5&&(r=a)):a=r),{data:e.subarray(9+t),pts:r,dts:a,originalPts:r,originalDts:a}}_demux(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];t&&(this._pmtId=-1,this.videoTrack=pb.initVideoTrack(),this.audioTrack=pb.initAudioTrack()),!i||t?(this._remainingPacketData=null,this._videoPesData=[],this._audioPesData=[]):(this.videoTrack.samples=[],this.audioTrack.samples=[],this._remainingPacketData&&(e=Yd(this._remainingPacketData,e),this._remainingPacketData=null));let s=e.length;const r=s%188;r&&(this._remainingPacketData=e.subarray(s-r),s-=r);for(let t=0;t>4>1){if(r=t+5+e[t+4],r===t+188)continue}else r=t+4;switch(s){case 0:i&&(r+=e[r]+1),this._pmtId=(31&e[r+10])<<8|e[r+11];break;case this._pmtId:{i&&(r+=e[r]+1);const t=r+3+((15&e[r+1])<<8|e[r+2])-4;for(r+=12+((15&e[r+10])<<8|e[r+11]);r=t)return[];const r=[];for(;s{const t=s?e[0]>>>1&63:31&e[0];switch(t){case 5:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:if(!s&&5!==t||s&&5===t)break;r.isIFrame=!0,this._gopId++;break;case 6:case 39:case 40:if(!s&&6!==t||s&&6===t)break;return void function(e,t){const i=e.length;let s=t?2:1,r=0,a=0,o="";for(;255===e[s];)r+=255,s++;for(r+=e[s++];255===e[s];)a+=255,s++;if(a+=e[s++],5===r&&i>s+16)for(let t=0;t<16;t++)o+=e[s].toString(16),s++;e.subarray(s)}(function(e){const t=e.byteLength,i=[];let s=1;for(;s=i)return;const r=s,a=[],o=(60&e[s+2])>>>2,n=Fr[o];if(!n)throw new Error(`Invalid sampling index: ${o}`);const l=1+((192&e[s+2])>>>6),d=(1&e[s+2])<<2|(192&e[s+3])>>>6;let h,c,u=0;const p=Vr(n);for(;s+7>5,i-s=i?void 0:e.subarray(s),frames:a,samplingFrequencyIndex:o,sampleRate:n,objectType:l,channelCount:d,originCodec:`mp4a.40.${l}`}}(e.data,e.originalPts);if(t){if(this.audioTrack.codec=t.codec,this.audioTrack.sampleRate=t.sampleRate,this.audioTrack.channelCount=t.channelCount,!this._isSendAACSeqHeader){const e=jr({profile:t.objectType,sampleRate:t.samplingFrequencyIndex,channel:t.channelCount});this._isSendAACSeqHeader=!0,this.player.debug.log(this.TAG_NAME,"aac seq header",`profile: ${t.objectType}, sampleRate:${t.sampleRate},sampleRateIndex: ${t.samplingFrequencyIndex}, channel: ${t.channelCount}`),this._doDecodeByHls(e,Ne,0,!1,0)}if(this._isSendAACSeqHeader){const e=[];t.frames.forEach((t=>{const i=t.pts,s=new Uint8Array(t.data.length+2);s.set([175,1],0),s.set(t.data,2);const r={type:Ne,pts:i,dts:i,payload:s};e.push(r)})),this.audioTrack.samples=this.audioTrack.samples.concat(e)}else this.player.debug.warn(this.TAG_NAME,"aac seq header not send")}else this.player.debug.warn(this.TAG_NAME,"aac parseADTS error")}this._audioPesData=[]}else e&&"startPrefixError"===e.code&&(this._audioPesData=[])}_fix(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e=Math.round(9e4*e);const s=this.videoTrack,r=this.audioTrack,a=s.samples,o=r.samples;if(!a.length&&!o.length)return;const n=a[0],l=o[0];let d=0;if(a.length&&o.length&&(d=n.dts-l.pts),this._baseDtsInited||this._calculateBaseDts(),t&&(this._calculateBaseDts(),this._baseDts-=e),!i){this._videoNextDts=d>0?e+d:e,this._audioNextPts=d>0?e:e-d;const t=n?n.dts-this._baseDts-this._videoNextDts:0,i=l?l.pts-this._baseDts-this._audioNextPts:0;Math.abs(t||i)>xr&&(this._calculateBaseDts(this.audioTrack,this.videoTrack),this._baseDts-=e)}this._resetBaseDtsWhenStreamBreaked(),this._fixAudio(r),this._fixVideo(s);let h=s.samples.concat(r.samples);h=h.map((e=>(e.dts=Math.round(e.dts/90),e.pts=Math.round(e.pts/90),e.cts=e.pts-e.dts,e))).sort(((e,t)=>e.dts-t.dts)),h.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,this._isUseWorker()?this.loopWorker.postMessage({...e,payload:t,cmd:"sample"},[t.buffer]):e.type===je?this._doDecodeVideo({...e,payload:t}):e.type===Ne&&this._doDecodeAudio({...e,payload:t})})),po(this._hasCalcFps)&&this._isUseWorker()&&(this._hasCalcFps=!0,this._calcDecodeFps(h))}_isUseWorker(){return!this.player.isUseMSE()&&this.isForHls()}_calculateBaseDts(){const e=this.audioTrack,t=this.videoTrack,i=e.samples,s=t.samples;if(!i.length&&!s.length)return!1;let r=1/0,a=1/0;i.length&&(e.baseDts=r=i[0].pts),s.length&&(t.baseDts=a=s[0].dts),this._baseDts=Math.min(r,a);const o=a-r;return Number.isFinite(o)&&Math.abs(o)>45e3&&this.player.debug.warn(this.TAG_NAME,`large av first frame gap,\n video pts: ${a},\n audio pts: ${r},\n base dts: ${this._baseDts},\n detect is: ${o}`),this._baseDtsInited=!0,!0}_resetBaseDtsWhenStreamBreaked(){if(this._baseDtsInited&&this._videoTimestampBreak&&this._audioTimestampBreak){if(!this._calculateBaseDts(this.audioTrack,this.videoTrack))return;this._baseDts-=Math.min(this._audioNextPts,this._videoNextDts),this._audioLastSample=null,this._videoLastSample=null,this._videoTimestampBreak=!1,this._audioTimestampBreak=!1}}_fixAudio(e){const t=e.samples;t.length&&(t.forEach((e=>{e.pts-=this._baseDts,e.dts=e.pts})),this._doFixAudioInternal(e,t,9e4))}_fixVideo(e){const t=e.samples;if(!t.length)return;if(t.forEach((e=>{e.dts-=this._baseDts,e.pts-=this._baseDts})),void 0===this._videoNextDts){const e=t[0];this._videoNextDts=e.dts}const i=t.length;let s=0;const r=t[0],a=t[1],o=this._videoNextDts-r.dts;let n;Math.abs(o)>45e3&&(r.dts+=o,r.pts+=o,this.player.debug.warn(this.TAG_NAME,`large video gap between chunk,\n next dts is ${this._videoNextDts},\n first dts is ${r.dts},\n next dts is ${a.dts},\n duration is ${o}`),a&&Math.abs(a.dts-r.dts)>xr&&(this._videoTimestampBreak=!0,t.forEach(((e,t)=>{0!==t&&(e.dts+=o,e.pts+=o)}))));const l=e.samples[0],d=e.samples[i-1];n=1===i?9e3:Math.floor((d.dts-l.dts)/(i-1));for(let r=0;rxr||s<0){this._videoTimestampBreak=!0,s=this._audioTimestampBreak?n:Math.max(s,2700);const i=this._audioNextPts||0;o&&o.dts>i&&(s=n),this.player.debug.warn(this.TAG_NAME,`large video gap between frames,\n time is ${a/e.timescale},\n dts is ${a},\n origin dts is ${t[r].originalDts},\n next dts is ${this._videoNextDts},\n sample Duration is ${s} ,\n ref Sample DurationInt is ${n}`)}t[r].duration=s,this._videoNextDts+=s}}_doFixAudioInternal(e,t,i){e.sampleDuration||(e.sampleDuration=Vr(e.timescale,i));const s=e.sampleDuration;if(void 0===this._audioNextPts){const e=t[0];this._audioNextPts=e.pts}for(let i=0;i=3*s&&o<=kr&&!Aa()){Hr(e.codec,e.channelCount)||t[0].data.subarray();const n=Math.floor(o/s);Math.abs(a.pts-this._lastAudioExceptionGapDot)>Cr&&(this._lastAudioExceptionGapDot=a.pts),this.player.debug.warn(this.TAG_NAME,`audio gap detected,\n pts is ${t.pts},\n originPts is ${t.originalPts},\n count is ${n},\n nextPts is ${r},\n ref sample duration is ${s}`);for(let e=0;e=-9e4?(Math.abs(a.pts-this._lastAudioExceptionOverlapDot)>Cr&&(this._lastAudioExceptionOverlapDot=a.pts,this.player.debug.warn(this.TAG_NAME,`audio overlap detected,\n pts is ${a.pts},\n originPts is ${a.originalPts},\n nextPts is ${r},\n ref sample duration is ${s}`)),t.splice(i,1),i--):(Math.abs(o)>=kr&&(this._audioTimestampBreak=!0,Math.abs(a.pts-this._lastAudioExceptionLargeGapDot)>Cr&&(this._lastAudioExceptionLargeGapDot=a.pts,this.player.debug.warn(this.TAG_NAME,`large audio gap detected,\n time is ${a.pts/1e3}\n pts is ${a.pts},\n originPts is ${a.originalPts},\n nextPts is ${r},\n sample duration is ${o}\n ref sample duration is ${s}`))),a.dts=a.pts=r,this._audioNextPts+=s)}}_calcDecodeFps(e){const t=ro(e.map((e=>({ts:e.dts||e.pts,type:e.type}))),je);t&&(this.player.debug.log(this.TAG_NAME,`_calcDecodeFps() video fps is ${t}, update base fps is ${this._basefps}`),this._basefps=t),this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps})}_initLoopWorker(){this.player.debug.log(this.TAG_NAME,"_initLoopWorker()");const e=Ao(function(){const e=1,t=2;let i=new class{constructor(){this.baseFps=0,this.fpsInterval=null,this.preLoopTimestamp=null,this.startBpsTime=null,this.allSampleList=[]}destroy(){this._clearInterval(),this.baseFps=0,this.allSampleList=[],this.preLoopTimestamp=null,this.startBpsTime=null}updateBaseFps(e){this.baseFps=e,this._clearInterval(),this._startInterval()}pushSample(e){delete e.cmd,this.allSampleList.push(e)}_startInterval(){const e=Math.ceil(1e3/this.baseFps);this.fpsInterval=setInterval((()=>{let t=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=t),this.startBpsTime||(this.startBpsTime=t);const i=t-this.preLoopTimestamp;if(i>2*e&&console.warn(`JbPro:[TsLoader LoopWorker] loop interval is ${i}ms, more than ${e} * 2ms`),this._loop(),this.preLoopTimestamp=(new Date).getTime(),this.startBpsTime){t-this.startBpsTime>=1e3&&(this._calcSampleList(),this.startBpsTime=t)}}),e)}_clearInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_calcSampleList(){const i={buferredDuration:0,allListLength:this.allSampleList.length,audioListLength:0,videoListLength:0};this.allSampleList.forEach((s=>{s.type===t?(i.videoListLength++,s.duration&&(i.buferredDuration+=Math.round(s.duration/90))):s.type===e&&i.audioListLength++})),postMessage({cmd:"sampleListInfo",...i})}_loop(){let i=null;if(this.allSampleList.length)if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]);let t=this.allSampleList[0];for(;t&&t.type===e;)i=this.allSampleList.shift(),postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),t=this.allSampleList[0]}else i.type===e&&(postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),this.allSampleList.length&&this.allSampleList[0].type===t&&(i=this.allSampleList.shift(),postMessage({cmd:"decodeVideo",...i},[i.payload.buffer])))}};self.onmessage=e=>{const t=e.data;switch(t.cmd){case"updateBaseFps":i.updateBaseFps(t.baseFps);break;case"sample":i.pushSample(t);break;case"destroy":i.destroy(),i=null}}}.toString()),t=new Blob([e],{type:"text/javascript"}),i=URL.createObjectURL(t);let s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te),s.onmessage=e=>{const t=e.data;switch(t.cmd){case"decodeVideo":this._doDecodeVideo(t);break;case"decodeAudio":this._doDecodeAudio(t);break;case"sampleListInfo":this.tempSampleListInfo=t}},this.loopWorker=s}_postMessageToLoopWorker(e,t){this._isUseWorker()&&(this.loopWorker?this.loopWorker.postMessage({cmd:e,...t}):this.player.debug.warn(this.TAG_NAME,"loop worker is not init, can not post message"))}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this.player.updateStats({abps:t.byteLength});let i=t;uo(this.player._opt.m7sCryptoAudio)&&(i=this.cryptoPayloadAudio(t)),this.isForHls()?this._doDecodeByHls(i,Ne,e.dts,!1,0):this._doDecodeByTs(i,Ne,e.dts,!1,0)}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?jn(t,e.isIFrame):kn(t,e.isIFrame),this.player.updateStats({dts:e.dts,vbps:i.byteLength});const s=e.pts-e.dts;let r=this.cryptoPayload(i,e.isIFrame);this.isForHls()?this._doDecodeByHls(r,je,e.dts,e.isIFrame,s):this._doDecodeByTs(r,je,e.dts,e.isIFrame,s)}_stopDecodeLoopInterval(){this._baseFpsInterval&&(clearInterval(this._baseFpsInterval),this._baseFpsInterval=null)}getBuferredDuration(){return this.tempSampleListInfo.buferredDuration||0}getSampleListLength(){return this.tempSampleListInfo.allListLength||0}getSampleAudioListLength(){return this.tempSampleListInfo.audioListLength||0}getSampleVideoListLength(){return this.tempSampleListInfo.videoListLength||0}isForHls(){return this._isForHls}getInputByteLength(){return this._remainingPacketData&&this._remainingPacketData.byteLength||0}}function fb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<8)+(e[t+1]||0)}function mb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function gb(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const i=Math.pow(2,32);return mb(e,t)*i+mb(e,t+4)}const yb="aac",Ab="g7110a",bb="g7110m",vb="avc",_b="hevc";class Sb{static getFrameDuration(e){return 1024*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4)/e}static getRateIndexByRate(e){return Sb.FREQ.indexOf(e)}}function wb(e,t,i,s,r,a){const o=[],n=null==r?void 0:r.entries,l=t.entries,d=s.entries,h=i.entrySizes,c=null==a?void 0:a.entries;let u,p,f;c&&(u={},c.forEach((e=>{u[e-1]=!0}))),n&&(p=[],n.forEach((e=>{let{count:t,offset:i}=e;for(let e=0;e{let{count:t,delta:s}=e;for(let e=0;e=S&&(b++,S=l[b+1]?l[b+1].firstChunk-1:1/0),_+=l[b].samplesPerChunk)})),o}function Eb(e,t){return e.dataReferenceIndex=fb(t,6),e.width=fb(t,24),e.height=fb(t,26),e.horizresolution=mb(t,28),e.vertresolution=mb(t,32),e.frameCount=fb(t,40),e.depth=fb(t,74),78}function Tb(e,t){return e.dataReferenceIndex=fb(t,6),e.channelCount=fb(t,16),e.sampleSize=fb(t,18),e.sampleRate=mb(t,24)/65536,28}function kb(e,t,i){if(!e)return;if(e.size!==e.data.length)throw new Error(`box ${e.type} size !== data.length`);const s={start:e.start,size:e.size,headerSize:e.headerSize,type:e.type};return t&&(s.version=e.data[e.headerSize],s.flags=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<16)+(e[t+1]<<8)+(e[t+2]||0)}(e.data,e.headerSize+1),s.headerSize+=4),i(s,e.data.subarray(s.headerSize),s.start+s.headerSize),s}zd(Sb,"FREQ",[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]);const Cb=function(e,t,i){const s=String(i),r=t>>0;let a=Math.ceil(r/s.length);const o=[],n=String(e);for(;a--;)o.push(s);return o.join("").substring(0,r-n.length)+n},xb=function(){const e=[];for(var t=arguments.length,i=new Array(t),s=0;s{e.push(Cb(Number(t).toString(16),2,0))})),e[0]};class Rb{static probe(e){return!!Rb.findBox(e,["ftyp"])}static findBox(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=[];if(!e)return s;let r=0,a="",o=0;for(;e.length>7;){if(r=mb(e),a=String.fromCharCode.apply(null,e.subarray(4,8)),o=8,1===r?(r=gb(e,8),o+=8):r||(r=e.length),!t[0]||a===t[0]){const n=e.subarray(0,r);if(!(t.length<2))return Rb.findBox(n.subarray(o),t.slice(1),i+o);s.push({start:i,size:r,headerSize:o,type:a,data:n})}i+=r,e=e.subarray(r)}return s}static tfhd(e){return kb(e,!0,((e,t)=>{e.trackId=mb(t);let i=4;const s=1&e.flags,r=2&e.flags,a=8&e.flags,o=16&e.flags,n=32&e.flags;s&&(i+=4,e.baseDataOffset=mb(t,i),i+=4),r&&(e.sampleDescriptionIndex=mb(t,i),i+=4),a&&(e.defaultSampleDuration=mb(t,i),i+=4),o&&(e.defaultSampleSize=mb(t,i),i+=4),n&&(e.defaultSampleFlags=mb(t,i))}))}static sidx(e){return kb(e,!0,((e,t)=>{let i=0;e.reference_ID=mb(t,i),i+=4,e.timescale=mb(t,i),i+=4,0===e.version?(e.earliest_presentation_time=mb(t,i),i+=4,e.first_offset=mb(t,i),i+=4):(e.earliest_presentation_time=gb(t,i),i+=8,e.first_offset=gb(t,i),i+=8),i+=2,e.references=[];const s=fb(t,i);i+=2;for(let r=0;r>31&1,s.referenced_size=2147483647&r,s.subsegment_duration=mb(t,i),i+=4,r=mb(t,i),i+=4,s.starts_with_SAP=r>>31&1,s.SAP_type=r>>28&7,s.SAP_delta_time=268435455&r}}))}static moov(e){return kb(e,!1,((e,t,i)=>{e.mvhd=Rb.mvhd(Rb.findBox(t,["mvhd"],i)[0]),e.trak=Rb.findBox(t,["trak"],i).map((e=>Rb.trak(e))),e.pssh=Rb.pssh(Rb.findBox(t,["pssh"],i)[0])}))}static mvhd(e){return kb(e,!0,((e,t)=>{let i=0;1===e.version?(e.timescale=mb(t,16),e.duration=gb(t,20),i+=28):(e.timescale=mb(t,8),e.duration=mb(t,12),i+=16),e.nextTrackId=mb(t,i+76)}))}static trak(e){return kb(e,!1,((e,t,i)=>{e.tkhd=Rb.tkhd(Rb.findBox(t,["tkhd"],i)[0]),e.mdia=Rb.mdia(Rb.findBox(t,["mdia"],i)[0])}))}static tkhd(e){return kb(e,!0,((e,t)=>{let i=0;1===e.version?(e.trackId=mb(t,16),e.duration=gb(t,24),i+=32):(e.trackId=mb(t,8),e.duration=mb(t,16),i+=20),e.width=mb(t,i+52),e.height=mb(t,i+56)}))}static mdia(e){return kb(e,!1,((e,t,i)=>{e.mdhd=Rb.mdhd(Rb.findBox(t,["mdhd"],i)[0]),e.hdlr=Rb.hdlr(Rb.findBox(t,["hdlr"],i)[0]),e.minf=Rb.minf(Rb.findBox(t,["minf"],i)[0])}))}static mdhd(e){return kb(e,!0,((e,t)=>{let i=0;1===e.version?(e.timescale=mb(t,16),e.duration=gb(t,20),i+=28):(e.timescale=mb(t,8),e.duration=mb(t,12),i+=16);const s=fb(t,i);e.language=String.fromCharCode(96+(s>>10&31),96+(s>>5&31),96+(31&s))}))}static hdlr(e){return kb(e,!0,((e,t)=>{0===e.version&&(e.handlerType=String.fromCharCode.apply(null,t.subarray(4,8)))}))}static minf(e){return kb(e,!1,((e,t,i)=>{e.vmhd=Rb.vmhd(Rb.findBox(t,["vmhd"],i)[0]),e.smhd=Rb.smhd(Rb.findBox(t,["smhd"],i)[0]),e.stbl=Rb.stbl(Rb.findBox(t,["stbl"],i)[0])}))}static vmhd(e){return kb(e,!0,((e,t)=>{e.graphicsmode=fb(t),e.opcolor=[fb(t,2),fb(t,4),fb(t,6)]}))}static smhd(e){return kb(e,!0,((e,t)=>{e.balance=fb(t)}))}static stbl(e){return kb(e,!1,((e,t,i)=>{var s,r,a;e.stsd=Rb.stsd(Rb.findBox(t,["stsd"],i)[0]),e.stts=Rb.stts(Rb.findBox(t,["stts"],i)[0]),e.ctts=Rb.ctts(Rb.findBox(t,["ctts"],i)[0]),e.stsc=Rb.stsc(Rb.findBox(t,["stsc"],i)[0]),e.stsz=Rb.stsz(Rb.findBox(t,["stsz"],i)[0]),e.stco=Rb.stco(Rb.findBox(t,["stco"],i)[0]),e.stco||(e.co64=Rb.co64(Rb.findBox(t,["co64"],i)[0]),e.stco=e.co64);const o=null===(s=e.stsd.entries[0])||void 0===s||null===(r=s.sinf)||void 0===r||null===(a=r.schi)||void 0===a?void 0:a.tenc.default_IV_size;e.stss=Rb.stss(Rb.findBox(t,["stss"],i)[0]),e.senc=Rb.senc(Rb.findBox(t,["senc"],i)[0],o)}))}static senc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return kb(e,!0,((e,i)=>{let s=0;const r=mb(i,s);s+=4,e.samples=[];for(let a=0;a{const i=[],s=[];let r=0;for(let e=0;e<16;e++)s.push(xb(t[r+e]));if(r+=16,e.version>0){const e=mb(t,r);r+=4;for(let s=0;s<(""+e).length;s++)for(let e=0;e<16;e++){const e=t[r];r+=1,i.push(xb(e))}}const a=mb(t,r);e.data_size=a,r+=4,e.kid=i,e.system_id=s,e.buffer=t}))}static stsd(e){return kb(e,!0,((e,t,i)=>{e.entryCount=mb(t),e.entries=Rb.findBox(t.subarray(4),[],i+4).map((e=>{switch(e.type){case"avc1":case"avc2":case"avc3":case"avc4":return Rb.avc1(e);case"hvc1":case"hev1":return Rb.hvc1(e);case"mp4a":return Rb.mp4a(e);case"alaw":case"ulaw":return Rb.alaw(e);case"enca":return kb(e,!1,((e,t,i)=>{e.channelCount=fb(t,16),e.samplesize=fb(t,18),e.sampleRate=mb(t,24)/65536,t=t.subarray(28),e.sinf=Rb.sinf(Rb.findBox(t,["sinf"],i)[0]),e.esds=Rb.esds(Rb.findBox(t,["esds"],i)[0])}));case"encv":return kb(e,!1,((e,t,i)=>{e.width=fb(t,24),e.height=fb(t,26),e.horizresolution=mb(t,28),e.vertresolution=mb(t,32),t=t.subarray(78),e.sinf=Rb.sinf(Rb.findBox(t,["sinf"],i)[0]),e.avcC=Rb.avcC(Rb.findBox(t,["avcC"],i)[0]),e.hvcC=Rb.hvcC(Rb.findBox(t,["hvcC"],i)[0]),e.pasp=Rb.pasp(Rb.findBox(t,["pasp"],i)[0])}))}})).filter(Boolean)}))}static tenc(e){return kb(e,!1,((e,t)=>{let i=6;e.default_IsEncrypted=t[i],i+=1,e.default_IV_size=t[i],i+=1,e.default_KID=[];for(let s=0;s<16;s++)e.default_KID.push(xb(t[i])),i+=1}))}static schi(e){return kb(e,!1,((e,t,i)=>{e.tenc=Rb.tenc(Rb.findBox(t,["tenc"],i)[0])}))}static sinf(e){return kb(e,!1,((e,t,i)=>{e.schi=Rb.schi(Rb.findBox(t,["schi"],i)[0]),e.frma=Rb.frma(Rb.findBox(t,["frma"],i)[0])}))}static frma(e){return kb(e,!1,((e,t)=>{e.data_format="";for(let i=0;i<4;i++)e.data_format+=String.fromCharCode(t[i])}))}static avc1(e){return kb(e,!1,((e,t,i)=>{const s=Eb(e,t),r=t.subarray(s);i+=s,e.avcC=Rb.avcC(Rb.findBox(r,["avcC"],i)[0]),e.pasp=Rb.pasp(Rb.findBox(r,["pasp"],i)[0])}))}static avcC(e){return kb(e,!1,((e,t)=>{e.configurationVersion=t[0],e.AVCProfileIndication=t[1],e.profileCompatibility=t[2],e.AVCLevelIndication=t[3],e.codec=function(e){let t,i="avc1.";for(let s=0;s<3;s++)t=e[s].toString(16),t.length<2&&(t=`0${t}`),i+=t;return i}([t[1],t[2],t[3]]),e.lengthSizeMinusOne=3&t[4],e.spsLength=31&t[5],e.sps=[];let i=6;for(let s=0;s{const s=Eb(e,t),r=t.subarray(s);i+=s,e.hvcC=Rb.hvcC(Rb.findBox(r,["hvcC"],i)[0]),e.pasp=Rb.pasp(Rb.findBox(r,["pasp"],i)[0])}))}static hvcC(e){return kb(e,!1,((t,i)=>{t.data=e.data,t.codec="hev1.1.6.L93.B0",t.configurationVersion=i[0];const s=i[1];t.generalProfileSpace=s>>6,t.generalTierFlag=(32&s)>>5,t.generalProfileIdc=31&s,t.generalProfileCompatibility=mb(i,2),t.generalConstraintIndicatorFlags=i.subarray(6,12),t.generalLevelIdc=i[12],t.avgFrameRate=fb(i,19),t.numOfArrays=i[22],t.vps=[],t.sps=[],t.pps=[];let r=23,a=0,o=0,n=0;for(let e=0;e{e.hSpacing=mb(t),e.vSpacing=mb(t,4)}))}static mp4a(e){return kb(e,!1,((e,t,i)=>{const s=Tb(e,t);e.esds=Rb.esds(Rb.findBox(t.subarray(s),["esds"],i+s)[0])}))}static esds(e){return kb(e,!0,((e,t)=>{e.codec="mp4a.";let i=0,s=0,r=0,a=0;for(;t.length;){for(i=0,a=t[i],s=t[i+1],i+=2;128&s;)r=(127&s)<<7,s=t[i],i+=1;if(r+=127&s,3===a)t=t.subarray(i+3);else{if(4!==a){if(5===a){const s=e.config=t.subarray(i,i+r);let a=(248&s[0])>>3;return 31===a&&s.length>=2&&(a=32+((7&s[0])<<3)+((224&s[1])>>5)),e.objectType=a,e.codec+=a.toString(16),void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}return void("."===e.codec[e.codec.length-1]&&(e.codec=e.codec.substring(0,e.codec.length-1)))}e.codec+=(t[i].toString(16)+".").padStart(3,"0"),t=t.subarray(i+13)}}}))}static alaw(e){return kb(e,!1,((e,t)=>{Tb(e,t)}))}static stts(e){return kb(e,!0,((e,t)=>{const i=mb(t),s=[];let r=4;for(let e=0;e{const i=mb(t),s=[];let r=4;if(1===e.version)for(let e=0;e{const i=mb(t),s=[];let r=4;for(let e=0;e{const i=mb(t),s=mb(t,4),r=[];if(!i){let e=8;for(let i=0;i{const i=mb(t),s=[];let r=4;for(let e=0;e{const i=mb(t),s=[];let r=4;for(let e=0;e{const i=mb(t),s=[];let r=4;for(let e=0;e{e.mfhd=Rb.mfhd(Rb.findBox(t,["mfhd"],i)[0]),e.traf=Rb.findBox(t,["traf"],i).map((e=>Rb.traf(e)))}))}static mfhd(e){return kb(e,!0,((e,t)=>{e.sequenceNumber=mb(t)}))}static traf(e){return kb(e,!1,((e,t,i)=>{e.tfhd=Rb.tfhd(Rb.findBox(t,["tfhd"],i)[0]),e.tfdt=Rb.tfdt(Rb.findBox(t,["tfdt"],i)[0]),e.trun=Rb.trun(Rb.findBox(t,["trun"],i)[0])}))}static trun(e){return kb(e,!0,((e,t)=>{const{version:i,flags:s}=e,r=t.length,a=e.sampleCount=mb(t);let o=4;if(r>o&&1&s&&(e.dataOffset=-(1+~mb(t,o)),o+=4),r>o&&4&s&&(e.firstSampleFlags=mb(t,o),o+=4),e.samples=[],r>o){let r;for(let n=0;n{1===e.version?e.baseMediaDecodeTime=gb(t):e.baseMediaDecodeTime=mb(t)}))}static probe(e){return!!Rb.findBox(e,["ftyp"])}static parseSampleFlags(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}}static moovToTrack(e,t,i){var s,r;const a=e.trak;if(!a||!a.length)return;const o=a.find((e=>{var t,i;return"vide"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)})),n=a.find((e=>{var t,i;return"soun"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)}));if(o&&t){var l,d,h,c,u,p,f;const i=t,s=null===(l=o.tkhd)||void 0===l?void 0:l.trackId;null!=s&&(i.id=o.tkhd.trackId),i.tkhdDuration=o.tkhd.duration,i.mvhdDurtion=e.mvhd.duration,i.mvhdTimecale=e.mvhd.timescale,i.timescale=i.formatTimescale=o.mdia.mdhd.timescale,i.duration=o.mdia.mdhd.duration||i.mvhdDurtion/i.mvhdTimecale*i.timescale;const r=o.mdia.minf.stbl.stsd.entries[0];if(i.width=r.width,i.height=r.height,r.pasp&&(i.sarRatio=[r.pasp.hSpacing,r.pasp.vSpacing]),r.hvcC)i.codecType=_b,i.codec=r.hvcC.codec,i.vps=r.hvcC.vps,i.sps=r.hvcC.sps,i.pps=r.hvcC.pps,i.hvcC=r.hvcC.data;else{if(!r.avcC)throw new Error("unknown video stsd entry");i.codecType=vb,i.codec=r.avcC.codec,i.sps=r.avcC.sps,i.pps=r.avcC.pps}var m,g,y,A,b,v,_,S;if(i.present=!0,i.ext={},i.ext.stss=null===(d=o.mdia)||void 0===d||null===(h=d.minf)||void 0===h||null===(c=h.stbl)||void 0===c?void 0:c.stss,i.ext.ctts=null===(u=o.mdia)||void 0===u||null===(p=u.minf)||void 0===p||null===(f=p.stbl)||void 0===f?void 0:f.ctts,r&&"encv"===r.type)i.isVideoEncryption=!0,r.default_KID=null===(m=r.sinf)||void 0===m||null===(g=m.schi)||void 0===g?void 0:g.tenc.default_KID,r.default_IsEncrypted=null===(y=r.sinf)||void 0===y||null===(A=y.schi)||void 0===A?void 0:A.tenc.default_IsEncrypted,r.default_IV_size=null===(b=r.sinf)||void 0===b||null===(v=b.schi)||void 0===v?void 0:v.tenc.default_IV_size,i.videoSenc=o.mdia.minf.stbl.senc&&o.mdia.minf.stbl.senc.samples,r.data_format=null===(_=r.sinf)||void 0===_||null===(S=_.frma)||void 0===S?void 0:S.data_format,i.useEME=e.useEME,i.kidValue=e.kidValue,i.pssh=e.pssh,i.encv=r}if(n&&i){var w,E,T,k,C,x,R,D,L;const t=i,a=null===(w=n.tkhd)||void 0===w?void 0:w.trackId;null!=a&&(t.id=n.tkhd.trackId),t.tkhdDuration=n.tkhd.duration,t.mvhdDurtion=e.mvhd.duration,t.mvhdTimecale=e.mvhd.timescale,t.timescale=t.formatTimescale=n.mdia.mdhd.timescale,t.duration=n.mdia.mdhd.duration||t.mvhdDurtion/t.mvhdTimecale*t.timescale;const o=n.mdia.minf.stbl.stsd.entries[0];switch(t.sampleSize=o.sampleSize,t.sampleRate=o.sampleRate,t.channelCount=o.channelCount,t.present=!0,o.type){case"alaw":t.codecType=t.codec=Ab,t.sampleRate=8e3;break;case"ulaw":t.codecType=t.codec=bb,t.sampleRate=8e3;break;default:t.codecType=yb,t.sampleDuration=Sb.getFrameDuration(t.sampleRate,t.timescale),t.sampleRateIndex=Sb.getRateIndexByRate(t.sampleRate),t.objectType=(null===(s=o.esds)||void 0===s?void 0:s.objectType)||2,o.esds&&(t.config=Array.from(o.esds.config)),t.codec=(null===(r=o.esds)||void 0===r?void 0:r.codec)||"mp4a.40.2"}var P,B,I,M,U,F,O,N;if(t.sampleDuration=Sb.getFrameDuration(t.sampleRate,t.timescale),t.objectType=(null===(E=o.esds)||void 0===E?void 0:E.objectType)||2,o.esds&&(o.esds.config?t.config=Array.from(o.esds.config):console.warn("esds config is null")),t.codec=(null===(T=o.esds)||void 0===T?void 0:T.codec)||"mp4a.40.2",t.sampleRateIndex=Sb.getRateIndexByRate(t.sampleRate),t.ext={},t.ext.stss=null===(k=n.mdia)||void 0===k||null===(C=k.minf)||void 0===C||null===(x=C.stbl)||void 0===x?void 0:x.stss,t.ext.ctts=null===(R=n.mdia)||void 0===R||null===(D=R.minf)||void 0===D||null===(L=D.stbl)||void 0===L?void 0:L.ctts,t.present=!0,o&&"enca"===o.type)t.isAudioEncryption=!0,o.data_format=null===(P=o.sinf)||void 0===P||null===(B=P.frma)||void 0===B?void 0:B.data_format,o.default_KID=null===(I=o.sinf)||void 0===I||null===(M=I.schi)||void 0===M?void 0:M.tenc.default_KID,o.default_IsEncrypted=null===(U=o.sinf)||void 0===U||null===(F=U.schi)||void 0===F?void 0:F.tenc.default_IsEncrypted,o.default_IV_size=null===(O=o.sinf)||void 0===O||null===(N=O.schi)||void 0===N?void 0:N.tenc.default_IV_size,t.audioSenc=n.mdia.minf.stbl.senc&&n.mdia.minf.stbl.senc.samples,t.useEME=e.useEME,t.kidValue=e.kidValue,t.enca=o}if(i&&(i.isVideoEncryption=!!t&&t.isVideoEncryption),t&&(t.isAudioEncryption=!!i&&i.isAudioEncryption),null!=t&&t.encv||null!=i&&i.enca){var j,z;const e=null==t||null===(j=t.encv)||void 0===j?void 0:j.default_KID,s=null==i||null===(z=i.enca)||void 0===z?void 0:z.default_KID,r=e||s?(e||s).join(""):null;t&&(t.kid=r),i&&(i.kid=r)}return t&&(t.flags=3841),i&&(i.flags=1793),{videoTrack:t,audioTrack:i}}static evaluateDefaultDuration(e,t,i){var s;const r=null==t||null===(s=t.samples)||void 0===s?void 0:s.length;if(!r)return 1024;return 1024*r/t.timescale*e.timescale/i}static moofToSamples(e,t,i){const s={};return e.mfhd&&(t&&(t.sequenceNumber=e.mfhd.sequenceNumber),i&&(i.sequenceNumber=e.mfhd.sequenceNumber)),e.traf.forEach((e=>{let{tfhd:r,tfdt:a,trun:o}=e;if(!r||!o)return;a&&(t&&t.id===r.trackId&&(t.baseMediaDecodeTime=a.baseMediaDecodeTime),i&&i.id===r.trackId&&(i.baseMediaDecodeTime=a.baseMediaDecodeTime));const n=r.defaultSampleSize||0,l=r.defaultSampleDuration||Rb.evaluateDefaultDuration(t,i,o.samples.length||o.sampleCount);let d=o.dataOffset||0,h=0,c=-1;if(!o.samples.length&&o.sampleCount){s[r.trackId]=[];for(let e=0;e((e={offset:d,dts:h,pts:h+(e.cts||0),duration:e.duration||l,size:e.size||n,gopId:c,keyframe:0===t||null!==e.flags&&void 0!==e.flags&&(65536&e.flags)>>>0!=65536}).keyframe&&(c++,e.gopId=c),h+=e.duration,d+=e.size,e)))})),s}static moovToSamples(e){const t=e.trak;if(!t||!t.length)return;const i=t.find((e=>{var t,i;return"vide"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)})),s=t.find((e=>{var t,i;return"soun"===(null===(t=e.mdia)||void 0===t||null===(i=t.hdlr)||void 0===i?void 0:i.handlerType)}));if(!i&&!s)return;let r,a;if(i){var o,n;const e=null===(o=i.mdia)||void 0===o||null===(n=o.minf)||void 0===n?void 0:n.stbl;if(!e)return;const{stts:t,stsc:s,stsz:a,stco:l,stss:d,ctts:h}=e;if(!(t&&s&&a&&l&&d))return;r=wb(t,s,a,l,h,d)}if(s){var l,d,h;const e=null===(l=s.mdia)||void 0===l||null===(d=l.minf)||void 0===d?void 0:d.stbl;if(!e)return;const t=null===(h=s.mdia.mdhd)||void 0===h?void 0:h.timescale,{stts:i,stsc:r,stsz:o,stco:n}=e;if(!(t&&i&&r&&o&&n))return;a=wb(i,r,o,n)}return{videoSamples:r,audioSamples:a}}}class Db extends Dd{constructor(e){super(e),this.player=e,this.TAG_NAME="HlsFmp4Loader",this.tempSampleListInfo={},this.isInitVideo=!1,this.isInitAudio=!1,this.videoTrack={id:1,samples:[],sps:[],pps:[],vps:[],codec:""},this.audioTrack={id:2,samples:[],sampleRate:0,channelCount:0,codec:"",codecType:""},this.workerClearTimeout=null,this.workerUrl=null,this.loopWorker=null,this._hasCalcFps=!1,this._basefps=25,this.player.isUseMSE()||this._initLoopWorker(),e.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.workerUrl&&(URL.revokeObjectURL(this.workerUrl),this.workerUrl=null),this.workerClearTimeout&&(clearTimeout(this.workerClearTimeout),this.workerClearTimeout=null),this.loopWorker&&(this.loopWorker.postMessage({cmd:"destroy"}),this.loopWorker.terminate(),this.loopWorker=null),this._hasCalcFps=!1,this.videoTrack=null,this.audioTrack=null,this.isInitVideo=!1,this.isInitAudio=!1,this._basefps=25,this.player.debug.log(this.TAG_NAME,"destroy")}demux(e,t){let i=this.audioTrack,s=this.videoTrack;if(this.checkInitAudio(),this.checkInitVideo(),i.samples=[],s.samples=[],t){if(this.player.updateStats({abps:t.byteLength}),po(this.isInitAudio)){const e=Rb.findBox(t,["moov"])[0];if(!e)return void this.player.debug.error(this.TAG_NAME,"cannot found moov box");Rb.moovToTrack(Rb.moov(e),null,i),this.checkInitAudio()&&(this.player.debug.log(this.TAG_NAME,"audioData audio init success"),this._sendAccADTSHeader(i))}const e=Rb.findBox(t,["moof"])[0];if(e){const s=Rb.moofToSamples(Rb.moof(e),null,i)[i.id],r=i.baseMediaDecodeTime;if(s){const a=e.start;s.map((e=>{e.offset+=a;const s=t.subarray(e.offset,e.offset+e.size),o=e.dts+r,n=new Uint8Array(s.length+2);n.set([175,1],0),n.set(s,2),i.samples.push({type:Ne,pts:o,dts:o,payload:n,duration:e.duration,size:n.byteLength})}))}}}if(e){if(this.player.updateStats({vbps:e.byteLength}),po(this.isInitVideo)&&po(this.isInitAudio)){const t=Rb.findBox(e,["moov"])[0];if(!t)throw new Error("cannot found moov box");if(Rb.moovToTrack(Rb.moov(t),s,i),po(this.isInitAudio)&&this.checkInitAudio()&&(this.player.debug.log(this.TAG_NAME,"videoData audio init success",i),this._sendAccADTSHeader(i)),this.checkInitVideo()){this.player.debug.log(this.TAG_NAME,"video init success");let e=null;s.codecType===as?s.sps.length&&s.vps.length&&s.pps.length&&(e=Nn({sps:s.sps[0],pps:s.pps[0],vps:s.vps[0]})):s.sps.length&&s.pps.length&&(e=Tn({sps:s.sps[0],pps:s.pps[0]})),e&&(this.player.debug.log(this.TAG_NAME,"seqHeader"),this._doDecodeByHls(e,je,0,!0,0))}}const t=Rb.findBox(e,["moof"])[0];if(t){const r=Rb.moofToSamples(Rb.moof(t),s,i),a=s.baseMediaDecodeTime,o=i.baseMediaDecodeTime,n=t.start;Object.keys(r).forEach((t=>{s.id==t?r[t].map((t=>{t.offset+=n;const i={type:je,pts:(t.pts||t.dts)+a,dts:t.dts+a,units:[],payload:null,isIFrame:!1};i.duration=t.duration,i.gopId=t.gopId,t.keyframe&&(i.isIFrame=!0);const r=e.subarray(t.offset,t.offset+t.size);i.payload=r,s.samples.push(i)})):i.id==t&&r[t].map((t=>{t.offset+=n;const s=e.subarray(t.offset,t.offset+t.size),r=t.dts+o,a=new Uint8Array(s.length+2);a.set([175,1],0),a.set(s,2),i.samples.push({type:Ne,pts:r,dts:r,payload:a,duration:t.duration,size:a.byteLength})}))}))}}const r=s.samples.concat(i.samples);r.sort(((e,t)=>e.dts-t.dts)),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,this.player.isUseMSE()?e.type===je?this._doDecodeVideo({...e,payload:t}):e.type===Ne&&this._doDecodeAudio({...e,payload:t}):this.loopWorker.postMessage({...e,payload:t,cmd:"sample"},[t.buffer])})),po(this._hasCalcFps)&&(this._hasCalcFps=!0,this._calcDecodeFps(r))}checkInitAudio(){return this.isInitAudio=!!(this.audioTrack.sampleRate&&this.audioTrack.channelCount&&this.audioTrack.codec&&"aac"===this.audioTrack.codecType),this.isInitAudio}checkInitVideo(){return this.isInitVideo=!!(this.videoTrack.pps.length&&this.videoTrack.sps.length&&this.videoTrack.codec),this.isInitVideo}_sendAccADTSHeader(e){const t=jr({profile:e.objectType,sampleRate:e.sampleRateIndex,channel:e.channelCount});this._doDecodeByHls(t,Ne,0,!0,0)}_calcDecodeFps(e){const t=ro(e.map((e=>({ts:e.dts||e.pts,type:e.type}))),je);t&&(this.player.debug.log(this.TAG_NAME,`_calcDecodeFps() video fps is ${t}, update base fps is ${this._basefps}`),this._basefps=t),this._postMessageToLoopWorker("updateBaseFps",{baseFps:this._basefps})}_initLoopWorker(){this.player.debug.log(this.TAG_NAME,"_initLoopWorker()");const e=Ao(function(){const e=1,t=2;let i=new class{constructor(){this.baseFps=0,this.fpsInterval=null,this.preLoopTimestamp=null,this.startBpsTime=null,this.allSampleList=[]}destroy(){this._clearInterval(),this.baseFps=0,this.allSampleList=[],this.preLoopTimestamp=null,this.startBpsTime=null}updateBaseFps(e){this.baseFps=e,this._clearInterval(),this._startInterval()}pushSample(e){delete e.cmd,this.allSampleList.push(e)}_startInterval(){const e=Math.ceil(1e3/this.baseFps);this.fpsInterval=setInterval((()=>{let t=(new Date).getTime();this.preLoopTimestamp||(this.preLoopTimestamp=t),this.startBpsTime||(this.startBpsTime=t);const i=t-this.preLoopTimestamp;if(i>2*e&&console.warn(`JbPro:[HlsFmp4Loader LoopWorker] loop interval is ${i}ms, more than ${e} * 2ms`),this._loop(),this.preLoopTimestamp=(new Date).getTime(),this.startBpsTime){t-this.startBpsTime>=1e3&&(this._calcSampleList(),this.startBpsTime=t)}}),e)}_clearInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_calcSampleList(){const i={buferredDuration:0,allListLength:this.allSampleList.length,audioListLength:0,videoListLength:0};this.allSampleList.forEach((s=>{s.type===t?(i.videoListLength++,s.duration&&(i.buferredDuration+=s.duration)):s.type===e&&i.audioListLength++})),postMessage({cmd:"sampleListInfo",...i})}_loop(){let i=null;if(this.allSampleList.length)if(i=this.allSampleList.shift(),i.type===t){postMessage({cmd:"decodeVideo",...i},[i.payload.buffer]);let t=this.allSampleList[0];for(;t&&t.type===e;)i=this.allSampleList.shift(),postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),t=this.allSampleList[0]}else i.type===e&&(postMessage({cmd:"decodeAudio",...i},[i.payload.buffer]),this.allSampleList.length&&this.allSampleList[0].type===t&&(i=this.allSampleList.shift(),postMessage({cmd:"decodeVideo",...i},[i.payload.buffer])))}};self.onmessage=e=>{const t=e.data;switch(t.cmd){case"updateBaseFps":i.updateBaseFps(t.baseFps);break;case"sample":i.pushSample(t);break;case"destroy":i.destroy(),i=null}}}.toString()),t=new Blob([e],{type:"text/javascript"}),i=URL.createObjectURL(t);let s=new Worker(i);this.workerUrl=i,this.workerClearTimeout=setTimeout((()=>{window.URL.revokeObjectURL(this.workerUrl),this.workerUrl=null,this.workerClearTimeout=null}),te),s.onmessage=e=>{const t=e.data;switch(t.cmd){case"decodeVideo":this._doDecodeVideo(t);break;case"decodeAudio":this._doDecodeAudio(t);break;case"sampleListInfo":this.tempSampleListInfo=t}},this.loopWorker=s}_postMessageToLoopWorker(e,t){this.player.isUseMSE()||(this.loopWorker?this.loopWorker.postMessage({cmd:e,...t}):this.player.debug.warn(this.TAG_NAME,"loop worker is not init, can not post message"))}_doDecodeAudio(e){const t=new Uint8Array(e.payload);this._doDecodeByHls(t,Ne,e.dts,!1,0)}_doDecodeVideo(e){const t=new Uint8Array(e.payload);let i=null;i=e.isHevc?jn(t,e.isIFrame):kn(t,e.isIFrame),this.player.updateStats({dts:e.dts});const s=e.pts-e.dts;this._doDecodeByHls(i,je,e.dts,e.isIFrame,s)}getBuferredDuration(){return this.tempSampleListInfo.buferredDuration||0}getSampleListLength(){return this.tempSampleListInfo.allListLength||0}getSampleAudioListLength(){return this.tempSampleListInfo.audioListLength||0}getSampleVideoListLength(){return this.tempSampleListInfo.videoListLength||0}}class Lb{constructor(e,t){this.hls=e,this.player=this.hls.player,this.isMP4=t,this._initSegmentId="",this.TAG_NAME="HlsTransmuxer",this._demuxer=t?new Db(this.hls.player):new pb(this.hls.player),this.player.debug.log(this.TAG_NAME,`init and isMP4 is ${t}`)}destroy(){this._demuxer&&(this._demuxer.destroy(),this._demuxer=null)}transmux(e,t,i,s,r,a){this.player.debug.log(this.TAG_NAME,`transmux videoChunk:${e&&e.byteLength}, audioChunk:${t&&t.byteLength}, discontinuity:${i}, contiguous:${s}, startTime:${r}, needInit:${a}`);const o=this._demuxer;try{this.isMP4?o.demux(e,t):o.demuxAndFix(Yd(e,t),i,s,r)}catch(e){throw new jA(NA,OA,e)}}}class Pb{constructor(e){this.hls=e,this.player=e.player,this._decryptor=new ub(this.hls,this.player),this._transmuxer=null,this._mse=null,this._softVideo=null,this._sourceCreated=!1,this._needInitSegment=!0,this._directAppend=!1,this.TAG_NAME="HlsBufferService"}async destroy(){this._softVideo=null,this._transmuxer&&(this._transmuxer.destroy(),this._transmuxer=null)}get baseDts(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t._baseDts}get nbSb(){return 0}async updateDuration(e){this.player.debug.log(this.TAG_NAME,"updateDuration()",e)}getBuferredDuration(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getBuferredDuration()}getBufferedSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleListLength()}getBufferedAudioSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleAudioListLength()}getBufferedVideoSegments(){var e,t;return null===(e=this._transmuxer)||void 0===e||null===(t=e._demuxer)||void 0===t?void 0:t.getSampleVideoListLength()}createSource(e,t,i,s){if(this._sourceCreated)return;const r=e||t;r&&(pb.probe(r)?this._transmuxer||(this._transmuxer=new Lb(this.hls,!1)):Rb.probe(r)?this._transmuxer||(this._transmuxer=new Lb(this.hls,!0)):this.player.debug.error(this.TAG_NAME,"createSource error: chunk is not ts"))}async appendBuffer(e,t,i,s,r,a,o){if(null!=i&&i.length||null!=s&&s.length)return this._needInitSegment,this._transmuxer.transmux(i,s,r,a,o,this._needInitSegment||r),!0}async clearAllBuffer(){this.player.debug.log(this.TAG_NAME,"clearAllBuffer")}decryptBuffer(e,t){return this._decryptor.decrypt(e,t)}async reset(){this._transmuxer=null,this._needInitSegment=!0,this._directAppend=!1}async endOfStream(){this._softVideo&&this._softVideo.endOfStream()}async setLiveSeekableRange(e,t){}seamlessSwitch(){this._needInitSegment=!0}}class Bb{constructor(e){this.emitter=e,this._seiSet=new Set,e.on(Zs,(e=>{e&&this._seiSet.add(e)}))}throw(e){if(null==e||!this._seiSet.size)return;const t=e-.2,i=e+.2,s=[];this._seiSet.forEach((e=>{e.time>=t&&e.time<=i&&s.push(e)})),s.forEach((e=>{this._seiSet.delete(e),this.emitter.emit(er,e)}))}reset(){this._seiSet.clear()}}class Ib{constructor(e){this._timescale=e,this.encodeType="",this.audioCodec="",this.videoCodec="",this.domain="",this.fps=0,this.bitrate=0,this.width=0,this.height=0,this.samplerate=0,this.channelCount=0,this.gop=0,this._bitsAccumulateSize=0,this._bitsAccumulateDuration=0}getStats(){return{encodeType:this.encodeType,audioCodec:this.audioCodec,videoCodec:this.videoCodec,domain:this.domain,fps:this.fps,bitrate:this.bitrate,width:this.width,height:this.height,samplerate:this.samplerate,channelCount:this.channelCount,gop:this.gop}}setEncodeType(e){this.encodeType=e}setFpsFromScriptData(e){var t;let{data:i}=e;const s=null==i||null===(t=i.onMetaData)||void 0===t?void 0:t.framerate;s&&s>0&&s<100&&(this.fps=s)}setVideoMeta(e){if(this.width=e.width,this.height=e.height,this.videoCodec=e.codec,this.encodeType=e.codecType,e.fpsNum&&e.fpsDen){const t=e.fpsNum/e.fpsDen;t>0&&t<100&&(this.fps=t)}}setAudioMeta(e){this.audioCodec=e.codec,this.samplerate=e.sampleRate,this.channelCount=e.channelCount}setDomain(e){this.domain=e.split("/").slice(2,3)[0]}updateBitrate(e){if((!this.fps||this.fps>=100)&&e.length){const t=e.reduce(((e,t)=>e+t.duration),0)/e.length;this.fps=Math.round(this._timescale/t)}e.forEach((e=>{1===e.gopId&&this.gop++,this._bitsAccumulateDuration+=e.duration/(this._timescale/1e3),this._bitsAccumulateSize+=e.units.reduce(((e,t)=>e+t.length),0),this._bitsAccumulateDuration>=1e3&&(this.bitrate=8*this._bitsAccumulateSize,this._bitsAccumulateDuration=0,this._bitsAccumulateSize=0)}))}}class Mb{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;zd(this,"_core",null),zd(this,"_samples",[]),this._core=e,this._timescale=t,this._stats=new Ib(t),this._bindEvents()}getStats(){var e,t,i,s,r,a,o;const{currentTime:n=0,decodeFps:l=0}=(null===(e=this._core)||void 0===e?void 0:e.media)||{};return{...this._stats.getStats(),downloadSpeed:(null===(t=this._core)||void 0===t||null===(i=t.speedInfo)||void 0===i?void 0:i.call(t).speed)||0,avgSpeed:(null===(s=this._core)||void 0===s||null===(r=s.speedInfo)||void 0===r?void 0:r.call(s).avgSpeed)||0,currentTime:n,bufferEnd:(null===(a=this._core)||void 0===a||null===(o=a.bufferInfo())||void 0===o?void 0:o.remaining)||0,decodeFps:l}}_bindEvents(){this._core.on(Vs,(e=>this._stats.updateBitrate(e.samples))),this._core.on($s,(e=>{this._stats.setFpsFromScriptData(e)})),this._core.on(Ws,(e=>{"video"===e.type?this._stats.setVideoMeta(e.track):this._stats.setAudioMeta(e.track)})),this._core.on(Js,(e=>{this._stats.setDomain(e.responseUrl)}))}reset(){this._samples=[],this._stats=new Ib(this._timescale)}}class Ub extends So{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),zd(this,"_loadSegment",(async()=>{if(this._segmentProcessing)return void this.player.debug.warn("_loadSegment()","_segmentProcessing is ture and return");if(!this._playlist)return void this.player.debug.warn("_loadSegment()","this._playlist is null and return");const e=this._playlist.currentSegment,t=this._playlist.nextSegment;if(this.player.debug.log(this.TAG_NAME,"_loadSegment()","curSeg",e&&e.url,"nextSeg",t&&t.url),t)return this._loadSegmentDirect();this.player.debug.log(this.TAG_NAME,"nextSeg is null and return")})),this.player=e,this.config=null,this._manifestLoader=null,this._segmentLoader=null,this._playlist=null,this._bufferService=null,this._seiService=null,this._stats=null,this._prevSegSn=null,this._prevSegCc=null,this._tickTimer=null,this._tickInterval=500,this._segmentProcessing=!1,this._reloadOnPlay=!1,this._switchUrlOpts=null,this._disconnectTimer=null,this.TAG_NAME="Hls256",this.canVideoPlay=!1,this.$videoElement=null,this.config=t=function(e){return{isLive:!0,maxPlaylistSize:50,retryCount:3,retryDelay:1e3,pollRetryCount:2,loadTimeout:1e4,preloadTime:30,softDecode:!1,bufferBehind:10,maxJumpDistance:3,startTime:0,targetLatency:10,maxLatency:20,allowedStreamTrackChange:!0,...e}}(t),this._manifestLoader=new nb(this),this._segmentLoader=new db(this),this._playlist=new cb(this),this._bufferService=new Pb(this),this._seiService=new Bb(this),this._stats=new Mb(this,9e4),this.player.debug.log(this.TAG_NAME,"init")}async destroy(){this.player.debug.log(this.TAG_NAME,"destroy()"),this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),await Promise.all([this._clear(),this._bufferService.destroy()]),this._manifestLoader&&(await this._manifestLoader.destroy(),this._manifestLoader=null),this._segmentLoader&&(this._segmentLoader.destroy(),this._segmentLoader=null),this._playlist&&(this._playlist.destroy(),this._playlist=null),this.player.debug.log(this.TAG_NAME,"destroy end")}_startTick(){this._stopTick(),this._tickTimer=setTimeout((()=>{this._tick()}),this._tickInterval)}_stopTick(){this._tickTimer&&clearTimeout(this._tickTimer),this._tickTimer=null}_tick(){this.player.isDestroyedOrClosed()?this.player.debug.log(this.TAG_NAME,"_tick() player is destroyed"):(this._startTick(),this._loadSegment())}get isLive(){return this._playlist.isLive}get streams(){return this._playlist.streams}get currentStream(){return this._playlist.currentStream}get hasSubtitle(){return this._playlist.hasSubtitle}get baseDts(){var e;return null===(e=this._bufferService)||void 0===e?void 0:e.baseDts}speedInfo(){return this._segmentLoader.speedInfo()}resetBandwidth(){this._segmentLoader.resetBandwidth()}getStats(){return this._stats.getStats()}async loadSource(e){return await this._reset(),await this._loadData(e),this._startTick(),!0}async _loadData(e){try{e&&(e=e.trim())}catch(e){}if(!e)throw this._emitError(new jA(UA,UA,null,null,"m3u8 url is missing"));const t=await this._loadM3U8(e),{currentStream:i}=this._playlist;if(this._urlSwitching){var s,r;if(0===i.bitrate&&null!==(s=this._switchUrlOpts)&&void 0!==s&&s.bitrate)i.bitrate=null===(r=this._switchUrlOpts)||void 0===r?void 0:r.bitrate;const e=this._getSeamlessSwitchPoint();this.config.startTime=e;const t=this._playlist.findSegmentIndexByTime(e),a=this._playlist.getSegmentByIndex(t+1);if(a){const e=a.start;this.player.debug.warn(this.TAG_NAME,`clear buffer from ${e}`)}}t&&(this.isLive?(this.player.debug.log(this.TAG_NAME,"is live"),this._bufferService.setLiveSeekableRange(0,4294967295),this.config.targetLatency{let[t,i,o]=e;t?(this._playlist.upsertPlaylist(t,i,o),this.isLive&&this._pollM3U8(s,r,a)):this.player.debug.warn(this.TAG_NAME,"_refreshM3U8() mediaPlaylist is empty")})).catch((e=>{throw this._emitError(jA.create(e))}))}_pollM3U8(e,t,i){var s;let r=this._playlist.isEmpty;this._manifestLoader.poll(e,t,i,((e,t,i)=>{this._playlist.upsertPlaylist(e,t,i),this._playlist.clearOldSegment(),e&&r&&!this._playlist.isEmpty&&this._loadSegment(),r&&(r=this._playlist.isEmpty)}),(e=>{this._emitError(jA.create(e))}),1e3*((null===(s=this._playlist.lastSegment)||void 0===s?void 0:s.duration)||0))}async _loadSegmentDirect(){const e=this._playlist.nextSegment;if(!e)return void this.player.debug.log(this.TAG_NAME,"_loadSegmentDirect() !seg");let t=!1,i=null;try{this._segmentProcessing=!0,t=await this._reqAndBufferSegment(e,this._playlist.getAudioSegment(e))}catch(e){i=e}finally{this._segmentProcessing=!1}return i?this._emitError(jA.create(i)):(t?(this._urlSwitching&&(this._urlSwitching=!1,this.emit(ir,{url:this.config.url})),this._playlist.moveSegmentPointer(),this.player.debug.log(this.TAG_NAME,"_loadSegmentDirect()","seg.isLast",e.isLast),e.isLast?(this.player.debug.log(this.TAG_NAME,"_loadSegmentDirect()","seg.isLast"),this._end()):(this.player.debug.log(this.TAG_NAME,"_loadSegmentDirect()","and next _loadSegment()"),this._loadSegment())):this.player.debug.log(this.TAG_NAME,"_loadSegmentDirect() not appended"),t)}async _reqAndBufferSegment(e,t){this.player.debug.log(this.TAG_NAME,"video seg",e&&e.url,"audio seg",t&&t.url);const i=e?e.cc:t.cc,s=this._prevSegCc!==i;let r=[];try{r=await this._segmentLoader.load(e,t,s)}catch(e){throw e.fatal=!1,this._segmentLoader.error=e,e}if(!r[0])return;const a=await this._bufferService.decryptBuffer(...r);if(!a)return void this.player.debug.log(this.TAG_NAME,"decryptBuffer return null");const o=e?e.sn:t.sn,n=e?e.start:t.start,l=this._playlist.currentStream;return this._bufferService.createSource(a[0],a[1],null==l?void 0:l.videoCodec,null==l?void 0:l.audioCodec),await this._bufferService.appendBuffer(e,t,a[0],a[1],s,this._prevSegSn===o-1,n),this._prevSegCc=i,this._prevSegSn=o,!0}async _clear(){this.player.debug.log(this.TAG_NAME,"_clear()"),clearTimeout(this._disconnectTimer),this._stopTick(),await Promise.all([this._segmentLoader.cancel(),this._manifestLoader.stopPoll()]),this._segmentProcessing=!1}async _reset(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.player.debug.log(this.TAG_NAME,"_reset()"),this._reloadOnPlay=!1,this._prevSegSn=null,this._prevSegCc=null,this._switchUrlOpts=null,this._playlist.reset(),this._segmentLoader.reset(),this._seiService.reset(),this._stats.reset(),await this._clear(),this._bufferService.reset(e)}_end(){this.player.debug.log(this.TAG_NAME,"_end()"),this._clear()}_emitError(e){var t;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var s;!1===(null===(t=e.originError)||void 0===t?void 0:t.fatal)?console.warn(e):(console.table(e),console.error(e),console.error(null===(s=this.media)||void 0===s?void 0:s.error),this._stopTick(),this._urlSwitching&&(this._urlSwitching=!1,this.emit(tr,e)),i&&this._end(),this._seiService.reset(),this.emit(ar,e));return e}_getSeamlessSwitchPoint(){const{media:e}=this;let t=e.currentTime;if(!e.paused){var i;const s=this._playlist.findSegmentIndexByTime(e.currentTime),r=this._playlist.getSegmentByIndex(s),a=null===(i=this._stats)||void 0===i?void 0:i.getStats().downloadSpeed;if(a&&r){t+=r.duration*this._playlist.currentStream.bitrate/a+1}else t+=5}return t}getDemuxBuferredDuration(){return this._bufferService.getBuferredDuration()||0}getDemuxBufferedListLength(){return this._bufferService.getBufferedSegments()||0}getDemuxAudioBufferedListLength(){return this._bufferService.getBufferedAudioSegments()||0}getDemuxVideoBufferedListLength(){return this._bufferService.getBufferedVideoSegments()||0}}class Fb extends So{constructor(e){super(),zd(this,"TAG_NAME","Hls256Decoder"),this.player=e,this.$videoElement=this.player.video.$videoElement,this.hls=null,this.eventsDestroy=[],this.bandwidthEstimateInterval=null,this.hls=new Ub(e),this._bindEvents()}async destroy(){return this._stopBandwidthEstimateInterval(),this.hls&&(await this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.$videoElement=null,this.player.debug.log(this.TAG_NAME,"destroy"),!0}_bindEvents(){this.hls.on(ar,(e=>{this.player.emitError(ct.hlsError,e)})),this._startBandwidthEstimateInterval()}_startBandwidthEstimateInterval(){this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{const e=this.hls.speedInfo();this.player.emit(nt.kBps,(e.avgSpeed/1024/8).toFixed(2)),this.hls.resetBandwidth()}),1e3)}_stopBandwidthEstimateInterval(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}async loadSource(e){return this.url=e,await this.hls.loadSource(e),!0}checkHlsBufferedDelay(){let e=0;return this.hls&&(e=this.hls.getDemuxBuferredDuration()),e}getDemuxBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxBufferedListLength()),e}getDemuxAudioBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxAudioBufferedListLength()),e}getDemuxVideoBufferedListLength(){let e=0;return this.hls&&(e=this.hls.getDemuxVideoBufferedListLength()),e}}class Ob extends So{constructor(e){super(),this.player=e,this.TAG_NAME="CommonWebrtc",this.rtcPeerConnection=null,this.videoStream=null,this.isDisconnected=!1,this.isH264=this.player.isWebrtcH264(),this.eventsDestroy=[],this.supportVideoFrameCallbackHandle=null,this.isInitInfo=!1,this.$videoElement=this.player.video.$videoElement,this.bandwidthEstimateInterval=null,this.rtcPeerTrackVideoReceiver=null,this.rtcPeerTrackAudioReceiver=null,this.prevWebrtcVideoStats={},this.prevWebrtcAudioStats={},this.currentWebrtcStats={},this.player._opt.webrtcUseCanvasRender&&this.isH264&&(this.$videoElement=document.createElement("video"),Aa()&&(this.$videoElement.style.position="absolute"),this._initVideoEvents()),this.$videoElement.muted=!0,this._initRtcPeerConnection()}destroy(){this.isDisconnected=!1,this.isInitInfo=!1,this.prevWebrtcVideoStats={},this.currentWebrtcStats={},this.rtcPeerTrackVideoReceiver=null,this.rtcPeerTrackAudioReceiver=null,this._stopBandwidthEstimateInterval(),this.supportVideoFrameCallbackHandle&&this.$videoElement&&(this.$videoElement.cancelVideoFrameCallback(this.supportVideoFrameCallbackHandle),this.supportVideoFrameCallbackHandle=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach((e=>e())),this.eventsDestroy=[]),this.isH264&&(this.videoStream&&(this.videoStream.getTracks().forEach((e=>e.stop())),this.videoStream=null),this.$videoElement.srcObject=null),this.rtcPeerConnection&&(this.rtcPeerConnection.onicecandidate=ta,this.rtcPeerConnection.ontrack=ta,this.rtcPeerConnection.onconnectionstatechange=ta,this.rtcPeerConnection.ondatachannel=ta,this.rtcPeerConnection.close(),this.rtcPeerConnection=null)}_initVideoEvents(){const{proxy:e}=this.player.events,t=e(this.$videoElement,es,(()=>{this.player.debug.log(this.TAG_NAME,"video canplay"),this.$videoElement.play().then((()=>{this.player.debug.log(this.TAG_NAME,"video play"),this._startCanvasRender(),this._initRenderSize()})).catch((e=>{this.player.debug.warn(this.TAG_NAME,"video play error ",e)}))})),i=e(this.$videoElement,ts,(()=>{this.player.debug.log("HlsDecoder","video waiting")})),s=e(this.$videoElement,is,(e=>{const t=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:t}),this.$videoElement.paused&&(this.player.debug.warn("HlsDecoder","video is paused and next try to replay"),this.$videoElement.play().then((()=>{this.player.debug.log("HlsDecoder","video is paused and replay success")})).catch((e=>{this.player.debug.warn("HlsDecoder","video is paused and replay error ",e)})))})),r=e(this.$videoElement,ss,(()=>{this.player.debug.log("HlsDecoder","video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)}));this.eventsDestroy.push(t,i,s,r)}_initRtcPeerConnection(){const e=new RTCPeerConnection,t=this.player;e.addTransceiver("video",{direction:"recvonly"}),e.addTransceiver("audio",{direction:"recvonly"}),e.onsignalingstatechange=e=>{this.player.debug.log(this.TAG_NAME,"onsignalingstatechange",e)},e.oniceconnectionstatechange=i=>{this.player.debug.log(this.TAG_NAME,"oniceconnectionstatechange",e.iceConnectionState);const s=e.iceConnectionState;switch(this.player.emit(nt.webrtcOnIceConnectionStateChange,s),this.isDisconnected="disconnected"===s,e.iceConnectionState){case"new":case"checking":case"closed":case"connected":case"completed":break;case"failed":t.emit(nt.webrtcFailed);break;case"disconnected":t.emit(nt.webrtcDisconnect);break;case"closed":t.emit(nt.webrtcClosed)}},e.onicecandidate=e=>{this.player.debug.log(this.TAG_NAME,"onicecandidate",e),e.candidate&&this.player.debug.log(this.TAG_NAME,"Remote ICE candidate: ",e.candidate.candidate)},e.ontrack=t=>{if(this.player.debug.log(this.TAG_NAME,"ontrack",t),"video"===t.track.kind){this.player.debug.log(this.TAG_NAME,"ontrack video"),this.rtcPeerTrackVideoReceiver=e.getReceivers().find((function(e){return e.track===t.track})),this.rtcPeerTrackVideoReceiver&&this._startBandwidthEstimateInterval();let i=t.streams[0];this.$videoElement.autoplay=!0,this.$videoElement.srcObject=i,this.videoStream=i}else"audio"===t.track.kind&&(this.player.debug.log(this.TAG_NAME,"ontrack audio"),this.rtcPeerTrackAudioReceiver=e.getReceivers().find((function(e){return e.track===t.track})),this.rtcPeerTrackAudioReceiver&&this._startBandwidthEstimateInterval())},e.onicecandidateerror=e=>{this.player.debug.log(this.TAG_NAME,"onicecandidateerror",e),this.player.emitError(ct.webrtcIceCandidateError,e)},e.onconnectionstatechange=i=>{switch(this.player.debug.log(this.TAG_NAME,"onconnectionstatechange",i),this.player.emit(nt.webrtcOnConnectionStateChange,e.connectionState),e.connectionState){case"new":case"connecting":case"connected":case"disconnected":break;case"failed":this.isDisconnected&&t.emit(nt.webrtcFailed)}},this.rtcPeerConnection=e}_startBandwidthEstimateInterval(){this.player.debug.log(this.TAG_NAME,"_startBandwidthEstimateInterval"),this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval((()=>{this.rtcPeerTrackVideoReceiver&&this.rtcPeerTrackVideoReceiver.getStats().then((e=>{let t={},i=0;e.forEach((e=>{if(e)switch(e.type){case _r:("succeeded"===e.state||e.bytesReceived)&&(this.currentWebrtcStats.timestamp=e.timestamp,this.currentWebrtcStats.rtt=e.currentRoundTripTime||-1,this.currentWebrtcStats.bytesReceived=e.bytesReceived||0,this.currentWebrtcStats.bytesSent=e.bytesSent||0);break;case Er:this.currentWebrtcStats.remoteCandidate=e||{};break;case wr:this.currentWebrtcStats.localCandidate=e||{};break;case Sr:this.currentWebrtcStats.lastTimeStamp=e.timestamp;const s=((e.timestamp||0)-(this.prevWebrtcVideoStats.timestamp||0))/1e3,r=Number(e.bytesReceived||0)-Number(this.prevWebrtcVideoStats.bytesReceived||0),a=Math.floor(r/s);i+=a,t.vbps=a,this.prevWebrtcVideoStats=e;break;case Tr:e.frameWidth&&e.frameHeight&&(this.currentWebrtcStats.frameWidth=e.frameWidth||0,this.currentWebrtcStats.frameHeight=e.frameHeight||0)}})),this.rtcPeerTrackAudioReceiver?this.rtcPeerTrackAudioReceiver.getStats().then((e=>{e.forEach((e=>{if(e&&e.type===Sr){this.currentWebrtcStats.lastTimeStamp=e.timestamp;const s=((e.timestamp||0)-(this.prevWebrtcAudioStats.timestamp||0))/1e3,r=Number(e.bytesReceived||0)-Number(this.prevWebrtcAudioStats.bytesReceived||0),a=Math.floor(r/s);i+=a,t.abps=a,this.prevWebrtcAudioStats=e}})),this.player.updateStats(t),this.player.emit(nt.kBps,(i/1024).toFixed(2))})):(this.player.updateStats(t),this.player.emit(nt.kBps,(i/1024).toFixed(2)))}))}),1e3)}_stopBandwidthEstimateInterval(){this.player.debug.log(this.TAG_NAME,"_stopBandwidthEstimateInterval"),this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}_startCanvasRender(){bo()?this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)):(this._stopCanvasRender(),this.canvasRenderInterval=setInterval((()=>{this.player.video.render({$video:this.$videoElement,ts:0})}),40))}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}videoFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player.isDestroyedOrClosed()?this.player.debug.log(this.TAG_NAME,"videoFrameCallback() player is destroyed"):(this.player.video.render({$video:this.$videoElement,ts:t.mediaTime||0}),this.player.updateStats({dts:t.mediaTime||0}),this.supportVideoFrameCallbackHandle=this.$videoElement.requestVideoFrameCallback(this.videoFrameCallback.bind(this)))}_initRenderSize(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}}class Nb extends Ob{constructor(e){super(e),this.rtcPeerConnectionDataChannel=null,this.player.isWebrtcH265()&&(this.streamRate=ha((t=>{e.emit(nt.kBps,(t/1024).toFixed(2))}))),this.TAG_NAME="WebrtcForM7SDecoder",this.player.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.stopStreamRateInterval(),this.rtcPeerConnectionDataChannel&&(this.rtcPeerConnectionDataChannel.onopen=ta,this.rtcPeerConnectionDataChannel.onclose=ta,this.rtcPeerConnectionDataChannel.onmessage=ta,this.rtcPeerConnectionDataChannel.close(),this.rtcPeerConnectionDataChannel=null),this.player.debug.log(this.TAG_NAME,"destroy")}_initRtcPeerConnection(){const e=new RTCPeerConnection,t=this.player;e.addTransceiver("video",{direction:"recvonly"}),e.addTransceiver("audio",{direction:"recvonly"}),e.onsignalingstatechange=e=>{this.player.debug.log(this.TAG_NAME,"onsignalingstatechange",e)},e.oniceconnectionstatechange=i=>{this.player.debug.log(this.TAG_NAME,"oniceconnectionstatechange",e.iceConnectionState);const s=e.iceConnectionState;switch(this.player.emit(nt.webrtcOnIceConnectionStateChange,s),this.isDisconnected="disconnected"===s,e.iceConnectionState){case"new":case"checking":case"closed":case"connected":case"completed":break;case"failed":t.emit(nt.webrtcFailed);break;case"disconnected":t.emit(nt.webrtcDisconnect);break;case"closed":t.emit(nt.webrtcClosed)}},e.onicecandidate=e=>{this.player.debug.log(this.TAG_NAME,"onicecandidate",e),e.candidate&&this.player.debug.log(this.TAG_NAME,"Remote ICE candidate: ",e.candidate.candidate)},e.ontrack=i=>{this.player.debug.log(this.TAG_NAME,"ontrack",i);const s=t.video.$videoElement;if(t.isWebrtcH264())if("video"===i.track.kind){this.player.debug.log(this.TAG_NAME,"ontrack video"),this.rtcPeerTrackVideoReceiver=e.getReceivers().find((function(e){return e.track===i.track})),this.rtcPeerTrackVideoReceiver&&this._startBandwidthEstimateInterval();let t=i.streams[0];s.autoplay=!0,s.srcObject=t,this.videoStream=t}else"audio"===i.track.kind&&(this.player.debug.log(this.TAG_NAME,"ontrack audio"),this.rtcPeerTrackAudioReceiver=e.getReceivers().find((function(e){return e.track===i.track})),this.rtcPeerTrackAudioReceiver&&this._startBandwidthEstimateInterval())},e.onicecandidateerror=e=>{this.player.debug.log(this.TAG_NAME,"onicecandidateerror",e),this.player.emitError(ct.webrtcIceCandidateError,e)},e.onconnectionstatechange=i=>{switch(t.debug.log(this.TAG_NAME,`sdp connect status ${e.connectionState}`),e.connectionState){case"new":case"connecting":case"connected":case"disconnected":break;case"failed":this.isDisconnected&&t.emit(nt.webrtcFailed)}},e.ondatachannel=e=>{const t=e.channel;this.player.debug.log(this.TAG_NAME,"ondatachannel"),t.onopen=()=>{this.player.debug.log(this.TAG_NAME,"ondatachannel and onopen")},t.onmessage=e=>{const t=e.data;if(this.player.isWebrtcH264())return this.player.debug.warn(this.TAG_NAME,"ondatachannel is H265 but decode is h264 so emit webrtcStreamH265 "),void this.player.emit(nt.webrtcStreamH265);this.player.isDestroyedOrClosed()?this.player.debug.warn(this.TAG_NAME,"ondatachannel and player is destroyed"):(this.streamRate&&this.streamRate(t.byteLength),this.player.demux&&this.player.demux.dispatch(t))},t.onclose=()=>{this.player.debug.warn(this.TAG_NAME,"ondatachannel and onclose")},this.rtcPeerConnectionDataChannel=t};e.createDataChannel("signal").onmessage=e=>{this.player.debug.log(this.TAG_NAME,"signalChannel,onmessage",e);JSON.parse(e.data).type},this.rtcPeerConnection=e}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval((()=>{this.streamRate&&this.streamRate(0)}),1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}loadSource(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{const r=this.rtcPeerConnection;r.createOffer().then((a=>{r.setLocalDescription(a),this.player.debug.log(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t,i){let s={"Content-Type":"application/sdp"};return i.username&&i.password&&(s.Authorization="Basic "+btoa(i.username+":"+i.password)),fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:s,body:t})}(e,a.sdp,t).then((e=>{e.text().then((e=>{this.player.debug.log(this.TAG_NAME,"getWebRtcRemoteSdp response"),e?r.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then((()=>{this.player.isWebrtcH265()&&this.startStreamRateInterval(),i()})).catch((e=>{s(e)})):s("sdp is null")})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource response.text() error",e),s(e)}))})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e),s(e)}))})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e),s(e)}))}))}}class jb extends Ob{constructor(e){super(e),this.TAG_NAME="WebrtcForZLMDecoder",this.player.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debug.log(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debug.log(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return bl({url:e,type:"POST",data:t,contentType:"text/plain;charset=utf-8",processData:!1,dataType:"json"})}(e,r.sdp).then((e=>{this.player.debug.log(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`);const r=e;if(r&&0!==r.code)return i(r.msg);r&&r.sdp?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:r.sdp})).then((()=>{t()})).catch((e=>{i(e)})):i("sdp is null")})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e),i(e)}))})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e),i(e)}))}))}}class zb extends So{constructor(e,t){if(super(),this.player=e,this.player.$container.classList.add("jb-pro-container-playback"),this._showPrecision=null,this._startTime=null,this._playStartTime=null,this._playingTimestamp=null,this._fps=parseInt(t.fps,10)||e._opt.playbackFps,this._isUseFpsRender=!!uo(t.isUseFpsRender),this._rate=1,this._audioTimestamp=0,this._videoTimestamp=0,this.controlType=t.controlType||Q.normal,t.controlType&&-1===[Q.normal,Q.simple].indexOf(t.controlType)&&(this.player.debug.warn("Playback","constructor()","controlType is not in [normal,simple]",t.controlType),this.controlType=Q.normal),this._currentLocalTimestamp=0,this._localOneFrameTimestamp=t.localOneFrameTimestamp||40,this._localCalculateTimeInterval=null,this._isUseLocalCalculateTime=!!uo(t.isUseLocalCalculateTime),this._isPlaybackPauseClearCache=!po(t.isPlaybackPauseClearCache),this._isCacheBeforeDecodeForFpsRender=!!uo(t.isCacheBeforeDecodeForFpsRender),this._startfpsTime=null,this._startFpsTimestamp=null,this._checkStatsInterval=null,this._playbackTs=0,this._renderFps=0,this._isUseLocalCalculateTime?this._startLocalCalculateTime():this._listen(),this.playbackList=[],this._playbackListStartTimestamp=null,this._totalDuration=0,t.controlType===Q.normal)this.initPlaybackList(t.playList,t.showPrecision,t.startTime);else if(t.controlType===Q.simple){t.duration&&(this._totalDuration=1e3*t.duration);let e=t.startTime||0;e>this.totalDuration&&(e=this.totalDuration),this.setStartTime(e)}this.player.on(nt.playbackPause,(e=>{e?this.pause():this.resume()}));const i={fps:this._fps,isUseFpsRender:this._isUseFpsRender,localOneFrameTimestamp:this._localOneFrameTimestamp,isUseLocalCalculateTime:this._isUseLocalCalculateTime,uiUsePlaybackPause:t.uiUsePlaybackPause,showControl:t.showControl};e.debug.log("Playback","init",JSON.stringify(i))}destroy(){this._startTime=null,this._showPrecision=null,this._playStartTime=null,this._playingTimestamp=null,this._totalDuration=0,this._audioTimestamp=0,this._videoTimestamp=0,this._fps=null,this._isUseFpsRender=!1,this._rate=1,this.playbackList=[],this._playbackListStartTimestamp=null,this._localCalculateTimeInterval=null,this._currentLocalTimestamp=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._renderFps=0,this._playbackTs=0,this._stopLocalCalculateTime(),this.clearStatsInterval(),this.player.$container&&this.player.$container.classList.remove("jb-pro-container-playback"),this.off(),this.player.debug.log("Playback","destroy")}_listen(){this.player.on(nt.stats,(e=>{const t=e.ts;this._playStartTime||(this._playStartTime=t-1e3);let i=t-this._playStartTime;this.setPlayingTimestamp(i)}))}pause(){this.clearStatsInterval()}resume(){this.startCheckStatsInterval()}updateStats(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this._startFpsTimestamp||(this._startFpsTimestamp=aa()),Ba(e.ts)&&(this.player.updateStats({fps:!0,ts:e.ts}),this._playbackTs=e.ts,this._startfpsTime||(this._startfpsTime=e.ts),this._renderFps+=1);const t=aa(),i=t-this._startFpsTimestamp;if(i<1e3)return;let s=null;this._startfpsTime&&(s=this._playbackTs-this._startfpsTime),this.player.emit(nt.playbackStats,{fps:this._renderFps,rate:this.rate,start:this._startfpsTime,end:this._playbackTs,timestamp:i,dataTimestamp:s,audioBufferSize:this.player.audio?this.player.audio.bufferSize:0,videoBufferSize:this.player.video?this.player.video.bufferSize:0,ts:this._playbackTs}),this._renderFps=0,this._startfpsTime=this._playbackTs,this._startFpsTimestamp=t}updateLocalOneFrameTimestamp(e){this._localOneFrameTimestamp=e}_startLocalCalculateTime(){this._stopLocalCalculateTime(),this._localCalculateTimeInterval=setInterval((()=>{const e=this._currentLocalTimestamp;this._playStartTime||(this._playStartTime=e-1e3);let t=e-this._playStartTime;this.setPlayingTimestamp(t)}),1e3)}startCheckStatsInterval(){this.clearStatsInterval(),this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}_stopLocalCalculateTime(){this._localCalculateTimeInterval&&(clearInterval(this._localCalculateTimeInterval),this._localCalculateTimeInterval=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}increaseLocalTimestamp(){this._isUseLocalCalculateTime&&(this._currentLocalTimestamp+=this._localOneFrameTimestamp)}initPlaybackList(e,t,i){this.playbackList=e||[];let s=0;if(this.playbackList.forEach(((e,t)=>{10===Ga(e.start)&&(e.startTimestamp=1e3*e.start,e.startTime=ba(e.startTimestamp)),10===Ga(e.end)&&(e.endTimestamp=1e3*e.end,e.endTime=ba(e.endTimestamp)),e.duration=e.end-e.start,s+=e.duration})),this._totalDuration=s,this.player.debug.log("Playback",this.playbackList),this.playbackList.length>0){const e=this.playbackList[0].startTimestamp;this._playbackListStartTimestamp=e;let t=e;i&&(10===Ga(i)&&(i*=1e3),this._isTimeInPlaybackList(i)&&(t=i)),this.setStartTime(t)}const r=t||Si;this.setShowPrecision(r)}get totalDuration(){return(this._totalDuration||0)/1e3}get startTime(){return this._startTime||0}setStartTime(e){this._startTime=e,this._playingTimestamp=e,this._playStartTime=null}setRate(e){this._rate=e,this.player.emit(nt.playbackRateChange,e)}get fps(){return this._fps}get rate(){return this._rate}get isUseFpsRender(){return this._isUseFpsRender}get isUseLocalCalculateTime(){return this._isUseLocalCalculateTime}get showPrecision(){return this._showPrecision}get is60Min(){return this.showPrecision===Si}get is30Min(){return this.showPrecision===wi}get is10Min(){return this.showPrecision===Ei}get is5Min(){return this.showPrecision===Ti}get is1Min(){return this.showPrecision===Ti}get isPlaybackPauseClearCache(){return this._isPlaybackPauseClearCache}get isCacheBeforeDecodeForFpsRender(){return this._isCacheBeforeDecodeForFpsRender}setShowPrecision(e){Ci.includes(e)||(this.player.debug.warn("Playback","setShowPrecision()","type is not in PLAYBACK_CONTROL_TIME_PRECISION_ARRAY",e),e=Si),this._showPrecision&&this._showPrecision===e||(this._showPrecision=e,this.player.emit(nt.playbackPrecision,this._showPrecision,this.playbackList),this.player.emit(nt.playbackShowPrecisionChange,this._showPrecision))}setPlayingTimestamp(e){let t;if(this.controlType===Q.normal){t=this.startTime+e,this._playingTimestamp=t,this.player.emit(nt.playbackTime,t);const i=new Date(t);this.player.emit(nt.playbackTimestamp,{ts:t,hour:i.getHours(),min:i.getMinutes(),second:i.getSeconds()})}else this.controlType===Q.simple&&(t=this.startTime+Math.round(e/1e3),t>this.totalDuration&&(this.player.debug.log("Playback","setPlayingTimestamp()",`timestamp ${t} > this.totalDuration ${this.totalDuration}`),t=this.totalDuration),this._playingTimestamp=t,this.player.emit(nt.playbackTime,t),this.player.emit(nt.playbackTimestamp,{ts:t}))}get playingTimestamp(){return this._playingTimestamp}narrowPrecision(){const e=Ci.indexOf(this.showPrecision)-1;if(e>=0){const t=Ci[e];this.setShowPrecision(t)}}expandPrecision(){const e=Ci.indexOf(this.showPrecision)+1;if(e<=Ci.length-1){const t=Ci[e];this.setShowPrecision(t)}}seek(e){if(this.player.debug.log("Playback","seek()",e),this.controlType===Q.normal){if("true"===e.hasRecord){let t=e.time;"min"===e.type&&(t=60*e.time);let i=function(e){let t={};e>-1&&(t={hour:Math.floor(e/60/60)%60,min:Math.floor(e/60)%60,second:e%60});return t}(t);if(this._playbackListStartTimestamp){const e=new Date(this._playbackListStartTimestamp).setHours(i.hour,i.min,i.second,0);i.timestamp=e;const t=this._findMoreInfoByTimestamp(e);i&&t.more&&(i.more=t.more)}this.player.emit(nt.playbackSeek,i)}}else if(this.controlType===Q.simple){let t=e.time;this.player.emit(nt.playbackSeek,{ts:t})}}currentTimeScroll(){this.player.emit(nt.playbackTimeScroll)}_findMoreInfoByTimestamp(e){let t=null;return this.playbackList.forEach(((i,s)=>{i.startTimestamp<=e&&i.endTimestamp>=e&&(t=i)})),t}_isTimeInPlaybackList(e){let t=!1;return this.playbackList.forEach(((i,s)=>{i.startTimestamp<=e&&i.endTimestamp>=e&&(t=!0)})),t}getControlType(){return this.controlType}isControlTypeNormal(){return this.controlType===Q.normal}isControlTypeSimple(){return this.controlType===Q.simple}}class Gb extends So{constructor(e){super(),this.player=e,this.TAG_NAME="zoom",this.bindEvents=[],this.isDragging=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.maxScale=5,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0};const{events:{proxy:t},debug:i}=this.player;this.player.on(nt.zooming,(e=>{if(e){this.player.$container.classList.add("jb-pro-zoom-control"),this._bindEvents();const e=this.player.video.$videoElement.style.transform;let t=this.player.video.$videoElement.offsetLeft,i=this.player.video.$videoElement.offsetTop;t=parseFloat(t),i=parseFloat(i),t&&(this.videoPosition.left=t),i&&(this.videoPosition.top=i),this.prevVideoElementStyleTransform=e;let s=e.match(/scale\([0-9., ]*\)/g);if(s&&s[0]){let e=s[0].replace("scale(","").replace(")","");this.prevVideoElementStyleScale=e.split(",")}}else{this.player.$container.classList.remove("jb-pro-zoom-control"),this._unbindEvents(),this._resetVideoPosition(),this.player.$container.style.cursor="auto";let e=this.prevVideoElementStyleTransform;this.player.video.$videoElement.style.transform=e,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,ua()&&this.player._opt.useWebFullScreen&&this.player.resize()}}));const s=t(window,ua()?"touchend":"mouseup",(e=>{this.handleMouseUp(e)}));this.bindEvents.push(s),e.debug.log("zoom","init")}destroy(){this.bindEvents=[],this.isDragging=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.off(),this.player.debug.log("zoom","destroy")}_bindEvents(){const{events:{proxy:e},debug:t}=this.player,i=e(this.player.$container,ua()?"touchmove":"mousemove",(e=>{this.handleMouseMove(e)}));this.bindEvents.push(i);const s=e(this.player.$container,ua()?"touchstart":"mousedown",(e=>{this.handleMouseDown(e)}));this.bindEvents.push(s);const r=e(window,ua()?"touchend":"mouseup",(e=>{this.handleMouseUp(e)}));this.bindEvents.push(r)}_unbindEvents(){this.bindEvents.forEach((e=>{e&&e()}))}handleMouseMove(e){if(e.stopPropagation(),this.isDragging&&this.player.zooming){e.preventDefault();const{posX:t,posY:i}=Qa(e),s=this.tempPosition.x-t,r=this.tempPosition.y-i;this.videoPosition.left=this.videoPosition.left-s,this.videoPosition.top=this.videoPosition.top-r,this.tempPosition.x=t,this.tempPosition.y=i,this.updateVideoPosition()}}handleMouseDown(e){e.stopPropagation();const t=qa(e);if(this.player.zooming&&(t.matches("video")||t.matches("canvas"))){e.preventDefault();const{posX:t,posY:i}=Qa(e);this.player.$container.style.cursor="grabbing",this.tempPosition.x=t,this.tempPosition.y=i,this.isDragging=!0,this.player.debug.log("zoom","handleMouseDown is dragging true")}}handleMouseUp(e){e.stopPropagation(),this.isDragging&&this.player.zooming&&(e.preventDefault(),this.tempPosition={x:0,y:0},this.isDragging=!1,this.player.$container.style.cursor="grab",this.player.debug.log("zoom","handleMouseUp is dragging false"))}updateVideoPosition(){const e=this.player.video.$videoElement;e.style.left=this.videoPosition.left+"px",e.style.top=this.videoPosition.top+"px"}_resetVideoPosition(){this.player.resize(),this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.currentZoom=1,this.isDragging=!1}narrowPrecision(){this.currentZoom<=1||(this.currentZoom-=1,this.updateVideoElementScale())}expandPrecision(){this.currentZoom>=this.maxScale||(this.currentZoom+=1,this.updateVideoElementScale())}updatePrevVideoElementStyleScale(e){this.prevVideoElementStyleScale=e}updateVideoElementScale(){const e=this.player.video.$videoElement;let t=e.style.transform,i=1,s=1;if(this.prevVideoElementStyleScale){const e=this.prevVideoElementStyleScale[0];void 0!==e&&(i=e,s=e);const t=this.prevVideoElementStyleScale[1];void 0!==t&&(s=t)}s=_a(s),i=_a(i);const r=.5*i*(this.currentZoom-1)+i,a=.5*s*(this.currentZoom-1)+s;let o;o=-1===t.indexOf("scale(")?t+` scale(${r},${a})`:t.replace(/scale\([0-9., ]*\)/,`scale(${r},${a})`),this.player.debug.log("zoom",`updateVideoElementScale end is ${r}, ${a} style is ${o}`),e.style.transform=o}}class Hb extends So{constructor(e){super(),this.player=e,this.faceDetector=null,this.objectDetector=null,this.imageDetector=null,this.occlusionDetector=null,this.initFaceDetector(),this.initObjectDetector(),this.initImageDetector(),this.initOcclusionDetector();let t="init";this.faceDetector&&(t+=" and use faceDetector"),this.objectDetector&&(t+=" and use objectDetector"),this.imageDetector&&(t+=" and use imageDetector"),this.occlusionDetector&&(t+=" and use occlusionDetector"),this.player.debug.log("AiLoader",t)}destroy(){this.off(),this.faceDetector&&(this.faceDetector.destroy(),this.faceDetector=null),this.objectDetector&&(this.objectDetector.destroy(),this.objectDetector=null),this.imageDetector&&(this.imageDetector.destroy(),this.imageDetector=null),this.occlusionDetector&&(this.occlusionDetector.destroy(),this.occlusionDetector=null),this.player.debug.log("AiLoader","destroy")}initFaceDetector(){if(this.player._opt.useFaceDetector&&window.JessibucaProFaceDetector){const e=new JessibucaProFaceDetector({detectWidth:this.player._opt.aiFaceDetectWidth,showRect:!1,debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debug.log("AiLoader","init face detector success"),this.faceDetector=e,this.faceDetector.on("jessibuca-pro-face-detector-info",(e=>{if(this.player.emit(nt.aiFaceDetectorInfo,e),this.player._opt.aiFaceDetectShowRect){const t=this.player._opt.aiFaceDetectRectConfig||{},i=(e.list||[]).map((e=>(e.type="rect",e.color=t.borderColor||"#0000FF",e.lineWidth=t.borderWidth||2,e)));this.player.video&&this.player.video.addAiContentToCanvas(i)}}))}))}}initObjectDetector(){if(this.player._opt.useObjectDetector&&window.JessibucaProObjectDetector){const e=new JessibucaProObjectDetector({detectWidth:this.player._opt.aiObjectDetectWidth,showRect:!1,debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debug.log("AiLoader","init object detector success"),this.objectDetector=e,this.objectDetector.on("jessibuca-pro-object-detector-info",(e=>{if(this.player.emit(nt.aiObjectDetectorInfo,e),this.player._opt.aiObjectDetectShowRect){const t=[],i=this.player._opt.aiObjectDetectRectConfig||{};(e.list||[]).forEach((e=>{const s={type:"rect",color:i.borderColor||"#0000FF",lineWidth:i.borderWidth||2,x:e.rect.x,y:e.rect.y,width:e.rect.width,height:e.rect.height},r={type:"text",color:i.color||"#000",fontSize:i.fontSize||14,text:e.zh,x:e.rect.x,y:e.rect.y-25};t.push(s,r)})),this.player.video&&this.player.video.addAiContentToCanvas(t)}}))}))}}initImageDetector(){if(this.player._opt.useImageDetector&&window.JessibucaProImageDetector){const e=new JessibucaProImageDetector({debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debug.log("AiLoader","init image detector success"),this.imageDetector=e}))}}initOcclusionDetector(){if(this.player._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector){const e=new JessibucaProOcclusionDetector({debug:this.player._opt.debug,debugLevel:this.player._opt.debugLevel,debugUuid:this.player._opt.debugUuid});e.load().then((()=>{this.player.debug.log("AiLoader","init occlusion detector success"),this.occlusionDetector=e}))}}updateFaceDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.faceDetector&&this.faceDetector.updateConfig(e)}updateObjectDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.objectDetector&&this.objectDetector.updateConfig(e)}updateImageDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.imageDetector&&this.imageDetector.updateConfig(e)}updateOcclusionDetectorConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.occlusionDetector&&this.occlusionDetector.updateConfig(e)}}class Vb extends So{constructor(e){super(),this.player=e,this.LOG_NAME="Contextmenu",this.menuList=[],this.$contextmenus=e.control.$contextmenus,ua()?this.player.debug.warn(this.LOG_NAME,"not support mobile"):this.init(),e.debug.log(this.LOG_NAME,"init")}destroy(){this.menuList=[],this.player.debug.log(this.LOG_NAME,"destroy")}get isShow(){return e=this.player.$container,t="jb-pro-contextmenus-show",e.classList.contains(t);var e,t}show(){Ch(this.player.$container,"jb-pro-contextmenus-show")}hide(){var e,t;e=this.player.$container,t="jb-pro-contextmenus-show",e.classList.remove(t)}init(){const{events:{proxy:e},debug:t}=this.player;this.player._opt.contextmenuBtns.length>0&&this.player._opt.contextmenuBtns.forEach((e=>{this.addMenuItem(e)})),e(this.player.$container,"contextmenu",(e=>{e.preventDefault(),this.show();const t=e.clientX,i=e.clientY,{height:s,width:r,left:a,top:o}=this.player.$container.getBoundingClientRect(),{height:n,width:l}=this.$contextmenus.getBoundingClientRect();let d=t-a,h=i-o;t+l>a+r&&(d=r-l),i+n>o+s&&(h=s-n),na(this.$contextmenus,{left:`${d}px`,top:`${h}px`})})),e(this.player.$container,"click",(e=>{Dh(e,this.$contextmenus)||this.hide()})),this.player.on(nt.blur,(()=>{this.hide()}))}_validateMenuItem(e){let t=!0;return e.content||(this.player.debug.warn(this.LOG_NAME,"content is required"),t=!1),t}addMenuItem(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=no(Ns);if(e=Object.assign({},t,e),!this._validateMenuItem(e))return;const{events:{proxy:i},debug:s}=this.player,r=Sa(),a=`\n
\n ${e.content}\n
\n `,o=Array.from(this.$contextmenus.children)[e.index];o?o.insertAdjacentHTML("beforebegin",a):xh(this.$contextmenus,a);const n=this.$contextmenus.querySelector(`.jb-pro-contextmenu-${r}`);e.click&&i(n,"click",(t=>{t.preventDefault(),e.click.call(this.player,this,t),this.hide()})),this.menuList.push({uuid:r,$menuItem:n})}}class $b extends Ob{constructor(e){super(e),this.TAG_NAME="WebrtcForSRSDecoder",this.player.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debug.log(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debug.log(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:t})}(e,r.sdp).then((e=>{this.player.debug.log(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`);const r=e;if(r&&0!==r.code)return i(r.msg);r?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:r})).then((()=>{t()})).catch((e=>{i(e)})):i("sdp is null")})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e),i(e)}))})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e),i(e)}))}))}}class Wb extends Ob{constructor(e){super(e),this.TAG_NAME="WebrtcForOthersDecoder",this.player.debug.log(this.TAG_NAME,"init")}destroy(){super.destroy(),this.player.debug.log(this.TAG_NAME,"destroy")}loadSource(e){return new Promise(((t,i)=>{const s=this.rtcPeerConnection;s.createOffer().then((r=>{s.setLocalDescription(r),this.player.debug.log(this.TAG_NAME,"getWebRtcRemoteSdp loadSource"),function(e,t){return fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:t})}(e,r.sdp).then((e=>{this.player.debug.log(this.TAG_NAME,`getWebRtcRemoteSdp response and code is ${e.code}`),e.text().then((e=>{this.player.debug.log(this.TAG_NAME,"getWebRtcRemoteSdp response");try{let t=JSON.parse(e);this.player.debug.log(this.TAG_NAME,"this is json sdp response"),0!=t.code&&(this.player.debug.log(this.TAG_NAME,`response json code ${t.code}`),i(new Error(`response sdp json code: ${t.code}`))),e=t.sdp}catch(e){this.player.debug.log(this.TAG_NAME,"this is raw sdp response")}e?s.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})).then((()=>{t()})).catch((e=>{i(e)})):i("sdp is null")})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource response.text() error",e),i(e)}))})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource getWebRtcRemoteSdp response error",e),i(e)}))})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource rtcPeerConnection.createOffer() error",e),i(e)}))}))}}class Jb extends So{constructor(e){if(super(),this.TAG_NAME="AliyunRtc",this.player=e,!window.AliRTS)throw new Error("AliyunRtc is not defined");this.aliyunRtc=window.AliRTS.createClient(),this.aliyunRtcRemoteStream=null,this.$videoElement=this.player.video.$videoElement,this.listenEvents(),this.player.debug.log(this.TAG_NAME,"init")}destroy(){this.aliyunRtc&&(this.aliyunRtcRemoteStream&&(this.aliyunRtcRemoteStream=null),this.aliyunRtc.unsubscribe(),this.aliyunRtc=null),this.off(),this.player.debug.log(this.TAG_NAME,"destroy")}listenEvents(){this.aliyunRtc.on("onError",(e=>{this.player.debug.log(this.TAG_NAME,`onError and code is ${e.errorCode} and message: ${e.message}`),10400!==e.errorCode&&(this.player.debug.error(this.TAG_NAME,`onError and code is ${e.errorCode} and message: ${e.message}`),this.player.emitError(ct.aliyunRtcError,e))})),this.aliyunRtc.on("reconnect",(e=>{this.player.debug.log(this.TAG_NAME,"reconnect",e)}));const e="canplay",t="waiting",i="playing",s="media";this.aliyunRtc.on("onPlayEvent",(r=>{if(r.event===e)this.player.debug.log(this.TAG_NAME,"onPlayEvent and canplay");else if(r.event===t)this.player.debug.log(this.TAG_NAME,"onPlayEvent and playing - > waiting");else if(r.event===i)this.player.debug.log(this.TAG_NAME,"onPlayEvent and waiting -> playing");else if(r.event===s){const e=r.data;let t={},i=0;if(e.audio){const s=Math.floor(e.audio.bytesReceivedPerSecond);i+=s,t.abps=s}if(e.video){const s=Math.floor(e.video.bytesReceivedPerSecond);i+=s,t.vbps=s}this.player.updateStats(t),this.player.emit(nt.kBps,(i/1024).toFixed(2))}}))}loadSource(e){return new Promise(((t,i)=>{this.aliyunRtc.isSupport({isReceiveVideo:!0}).then((()=>{this.aliyunRtc.subscribe(e,{}).then((e=>{this.aliyunRtcRemoteStream=e,e.play(this.$videoElement),t()})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource and subscribe is not success: ",e.message),i(e.message)}))})).catch((e=>{this.player.debug.error(this.TAG_NAME,"loadSource and is not support: ",e.message),i(e.message)}))}))}getVideoCurrentTime(){let e=0;return this.$videoElement&&(e=this.$videoElement.currentTime),e}}class qb{constructor(e){this.player=e,this.TAG_NAME="PressureObserverCpu",this.observer=null,this.latestCpuInfo=null,this.currentLevel=-1,this._init(),this.player.debug.log(this.TAG_NAME,"init")}destroy(){this.observer&&(this.observer.disconnect(),this.observer=null),this.latestCpuInfo=null,this.currentLevel=-1,this.player.debug.log(this.TAG_NAME,"destroy")}getCurrentCpuState(){return this.currentLevel}_init(){po(vo())?this.player.debug.log(this.TAG_NAME,"not support PressureObserver"):(this.observer=new PressureObserver((e=>{const t=(e||[]).find((e=>"cpu"===e.source));if(t){switch(this.latestCpuInfo=t,t.state){case"nominal":this.currentLevel=0;break;case"fair":this.currentLevel=1;break;case"serious":this.currentLevel=2;break;case"critical":this.currentLevel=3;break;default:this.currentLevel=-1}this.player.emit(nt.pressureObserverCpu,this.currentLevel)}})),this.observer&&this.observer.observe("cpu"))}}class Kb extends Po{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e),this.TAG_NAME="DynamicWatermark",this.isPauseAnimation=!1,this.isStopAnimation=!1,this.rafID=null,this.speed=t.speed||.2,this.isDynamic=!0,this.shadowRootDynamicDom=null,this.isGhost=!0===t.isGhost,this.ghostConfig={on:t.on||5,off:t.off||5},this.waterMarkWillRemove=!1,this.waterMarkWillAdd=!1,this.player.once(nt.start,(()=>{const e=t.content;let i=this.player.getVideoInfo();i||(i={width:200,height:200}),this.update({text:{content:e,fontSize:t.fontSize||18,color:t.color||"white"},left:i.width*Math.random(),top:i.height*Math.random(),opacity:t.opacity||.15}),this.startAnimation()})),this.player.debug.log(this.TAG_NAME,"int")}destroy(){super.destroy(),this.shadowRootDynamicDom=null,this.stopAnimation(),this.rafID&&(cancelAnimationFrame(this.rafID),this.rafID=null)}startAnimation(){if(!this.rafID){let e=1,t=1,i=Math.random(),s={width:0,height:0};const r=()=>{try{if(po(this.isPauseAnimation)&&this.shadowRootDynamicDom&&this.shadowRootInnerDom){const a=this.shadowRootInnerDom,o=this.shadowRootDynamicDom,n=a.getBoundingClientRect(),l=o.getBoundingClientRect();if(l.width&&l.height&&(s.width=l.width,s.height=l.height),!this.shadowRootInnerDom.contains(this.shadowRootDynamicDom))return this.isGhost?po(this.waterMarkWillAdd)&&(this.waterMarkWillAdd=!0,setTimeout((()=>{this._addDom(n,s),this.waterMarkWillAdd=!1}),1e3*this.ghostConfig.off)):this._addDom(n,s),void(0!==this.speed&&requestAnimationFrame(r));const d=Math.min(1,0===this.speed?0:this.speed?this.speed:.2);let h=l.left-n.left,c=l.top-n.top;h+=d*t*i,c+=d*e*(1-i),h+s.width>n.width?(t=-1,i=Math.random()):h<0&&(t=1,i=Math.random()),c+s.height>n.height?(e=-1,i=Math.random()):c<0&&(e=1,i=Math.random()),h=Math.min(n.width-s.width,h),c=Math.min(n.height-s.height,c);const u=h/n.width*100,p=c/n.height*100;this.shadowRootDynamicDom.style.left=`${u}%`,this.shadowRootDynamicDom.style.top=`${p}%`,po(this.waterMarkWillRemove)&&this.isGhost&&(this.waterMarkWillRemove=!0,setTimeout((()=>{this._removeDom(),this.waterMarkWillRemove=!1}),1e3*this.ghostConfig.on))}}catch(e){}if(this.isStopAnimation)return this.isStopAnimation=!1,cancelAnimationFrame(this.rafID),void(this.rafID=null);0!==this.speed&&requestAnimationFrame(r)};this.rafID=requestAnimationFrame(r)}}_addDom(e,t){if(this.shadowRootInnerDom&&this.shadowRootDynamicDom){this.shadowRootInnerDom.appendChild(this.shadowRootDynamicDom);let i=e.width*Math.random(),s=e.height*Math.random();i=Math.min(e.width-2*t.width,i),s=Math.min(e.height-2*t.height,s),this.shadowRootDynamicDom.style.left=`${i}px`,this.shadowRootDynamicDom.style.top=`${s}px`}}resumeAnimation(){this.isPauseAnimation=!1}pauseAnimation(){this.isPauseAnimation=!0}stopAnimation(){this.isStopAnimation=!0}}class Yb extends So{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this._opt={},this.TAG_NAME="Player",this.$container=e;const i=ho();if(this._opt=Object.assign({},i,t),this.debug=new Pr(this),this.debug.log(this.TAG_NAME,"init"),this._opt.forceNoOffscreen=!0,this._canPlayAppleMpegurl=!1,(Aa()||ya())&&(this._canPlayAppleMpegurl=Xa(),this.debug.log(this.TAG_NAME,"isIOS or isSafari and canPlayAppleMpegurl",this._canPlayAppleMpegurl)),ua()&&(this.debug.log(this.TAG_NAME,"isMobile and set _opt.controlAutoHide false"),this._opt.controlAutoHide=!1,uo(Mr.isEnabled)&&uo(this._opt.useWebFullScreen)&&(this.debug.log(this.TAG_NAME,"screenfull.isEnabled is true and _opt.useWebFullScreen is true , set _opt.useWebFullScreen false"),this._opt.useWebFullScreen=!1),po(Mr.isEnabled)&&po(this._opt.useWebFullScreen)&&(this.debug.log(this.TAG_NAME,"screenfull.isEnabled is false and _opt.useWebFullScreen is false , set _opt.useWebFullScreen true"),this._opt.useWebFullScreen=!0)),mo()&&(this.debug.log(this.TAG_NAME,"isIphone and set _opt.videoRenderSupportScale false"),this._opt.videoRenderSupportScale=!1,Wa()&&uo(this._opt.isHls)&&po(this._opt.supportHls265)&&(this.debug.log(this.TAG_NAME,"isIphone and is in wechat and is hls so set supportHls265 true"),this._opt.supportHls265=!0)),po(this._opt.playFailedAndReplay)&&(this.debug.log(this.TAG_NAME,"_opt.playFailedAndReplay is false and set others replay params false"),this._opt.webglAlignmentErrorReplay=!1,this._opt.webglContextLostErrorReplay=!1,this._opt.autoWasm=!1,this._opt.mseDecodeErrorReplay=!1,this._opt.mediaSourceTsIsMaxDiffReplay=!1,this._opt.wcsDecodeErrorReplay=!1,this._opt.wasmDecodeErrorReplay=!1,this._opt.simdDecodeErrorReplay=!1,this._opt.videoElementPlayingFailedReplay=!1,this._opt.networkDelayTimeoutReplay=!1,this._opt.widthOrHeightChangeReplay=!1,this._opt.simdH264DecodeVideoWidthIsTooLargeReplay=!1,this._opt.mediaSourceUseCanvasRenderPlayFailedReplay=!1,this._opt.heartTimeoutReplay=!1,this._opt.loadingTimeoutReplay=!1,this._opt.websocket1006ErrorReplay=!1,this._opt.streamErrorReplay=!1,this._opt.streamEndReplay=!1),this._opt.hiddenControl&&(this.debug.log(this.TAG_NAME,"_opt.hiddenControl is true and set others show btn to false"),Object.keys(this._opt.operateBtns).forEach((e=>{this._opt.operateBtns[e]&&-1===(""+e).indexOf("Fn")&&(this._opt.operateBtns[e]=!1)})),this._opt.showBandwidth=!1,this._opt.extendOperateBtns=[],this._opt.controlHtml="",this.isPlayback()&&(this._opt.playbackConfig.showControl=!1)),this._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(this._opt.forceNoOffscreen=!0,this._opt.useOffscreen=!1):this._opt.useOffscreen=!0),this._opt.isMpeg4&&(this.debug.log(this.TAG_NAME,"isMpeg4 is true, so set _opt.useWasm true and others params false"),this._opt.useWCS=!1,this._opt.useMSE=!1,this._opt.isNakedFlow=!1,this._opt.useSIMD=!1,this._opt.isFmp4=!1,this._opt.useWasm=!0),this.isPlayback()&&(this._opt.mseDecoderUseWorker=!1),this._opt.poster&&(this._opt.background=this._opt.poster),po(this._opt.muted)&&(this._opt.isNotMute=!0),this._opt.mseDecoderUseWorker&&(this._opt.mseDecoderUseWorker=!!(self.Worker&&self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker),po(this._opt.mseDecoderUseWorker)&&this.debug.log(this.TAG_NAME,"mseDecoderUseWorker is true but not support so set _opt.mseDecoderUseWorker = false")),(this.isOldHls()||this.isWebrtcH264()||this.isAliyunRtc())&&(this.debug.log(this.TAG_NAME,"isOldHls or isWebrtcH264 or isAliyunRtc is true, so set some params false and _opt.recordType is webm"),this._opt.useWCS=!1,this._opt.useMSE=!1,this._opt.isNakedFlow=!1,this._opt.useSIMD=!1,this._opt.isFmp4=!1,this._opt.useWasm=!1,this._opt.recordType=w),this._opt.isNakedFlow&&(this.debug.log(this.TAG_NAME,"isNakedFlow is true, so set _opt.mseDecodeAudio false"),this._opt.mseDecodeAudio=!1),ma()&&(this.debug.log(this.TAG_NAME,"isFirefox is true, so set _opt.mseDecodeAudio false"),this._opt.mseDecodeAudio=!1),!this.isOldHls()&&!this.isWebrtcH264()){if(this._opt.useWCS){const e="VideoEncoder"in window,t=Ca();this._opt.useWCS=e,this._opt.useWCS&&this._opt.isH265&&(this._opt.useWCS=t),this._opt.useWCS||this.debug.warn(this.TAG_NAME,`\n useWCS is true,\n and supportWCS is ${e}, supportHevcWCS is ${t} , _opt.isH265 is ${this._opt.isH265}\n so set useWCS false`),this._opt.useWCS&&(this._opt.useOffscreen?this._opt.wcsUseVideoRender=!1:this._opt.wcsUseVideoRender&&(this._opt.wcsUseVideoRender=xa()&&Ra(),this._opt.wcsUseVideoRender||this.debug.warn(this.TAG_NAME,"wcsUseVideoRender is true, but not support so set wcsUseVideoRender false")))}if(this._opt.useMSE){const e=function(){let e=!1;return"MediaSource"in self&&(e=!0),e}()||function(){let e=!1;return!("MediaSource"in self)&&"ManagedMediaSource"in self&&(e=!0),e}(),t=ka()||function(){let e=!1;return!("MediaSource"in self)&&"ManagedMediaSource"in self&&(self.ManagedMediaSource.isTypeSupported(ci)||self.ManagedMediaSource.isTypeSupported(ui)||self.ManagedMediaSource.isTypeSupported(pi)||self.ManagedMediaSource.isTypeSupported(fi)||self.ManagedMediaSource.isTypeSupported(mi))&&(e=!0),e}();this._opt.useMSE=e,this._opt.useMSE&&this._opt.isH265&&(this._opt.useMSE=t),this._opt.useMSE||this.debug.warn(this.TAG_NAME,`\n useMSE is true,\n and supportMSE is ${e}, supportHevcMSE is ${t} , _opt.isH265 is ${this._opt.isH265}\n so set useMSE false`)}}if(po(this._opt.useMSE)&&(this._opt.mseDecodeAudio=!1),this._opt.useMSE?(this._opt.useWCS&&this.debug.warn(this.TAG_NAME,"useMSE is true and useWCS is true then useWCS set true->false"),this._opt.forceNoOffscreen||this.debug.warn(this.TAG_NAME,"useMSE is true and forceNoOffscreen is false then forceNoOffscreen set false->true"),this._opt.useWCS=!1,this._opt.forceNoOffscreen=!0):this._opt.useWCS,this._opt.isWebrtc&&this._opt.demuxUseWorker&&(this.debug.warn(this.TAG_NAME,"isWebrtc is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.isHls&&this._opt.demuxUseWorker&&(this.debug.warn(this.TAG_NAME,"isHls is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this._opt.isAliyunRtc&&this._opt.demuxUseWorker&&(this.debug.warn(this.TAG_NAME,"isAliyunRtc is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),this.isStreamWebTransport()&&this._opt.demuxUseWorker&&(this.debug.warn(this.TAG_NAME,"is stream use webTransport is true and demuxUseWorker is true then demuxUseWorker set true->false"),this._opt.demuxUseWorker=!1),po(this._opt.demuxUseWorker)&&(this._opt.mseDecoderUseWorker=!1),this.isPlayback()&&(this._opt.mseDecoderUseWorker=!1),this._opt.useMThreading&&(this._opt.useMThreading="undefined"!=typeof SharedArrayBuffer,this._opt.useMThreading||this.debug.warn(this.TAG_NAME,"useMThreading is true, but not support so set useMThreading false")),this._opt.useSIMD||-1!==this._opt.decoder.indexOf("-simd")){const e=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),t=mo();this._opt.useSIMD=e&&po(t),this._opt.useSIMD||this.debug.warn(this.TAG_NAME,`useSIMD is true, but not support(isSupportSimd is ${e} ,isIphone is ${t}) so set useSIMD false`)}var s;if(this._opt.useSIMD?-1===this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-simd-mt.js"):this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-simd.js"):this._opt.useMThreading&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-simd-mt.js")):-1!==this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-mt.js"):this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro.js"):this._opt.useMThreading&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro.js","decoder-pro-mt.js")),-1!==this._opt.decoder.indexOf("-simd")?this._opt.useMThreading?(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-simd-mt.js","decoder-pro-hard-not-wasm.js")):(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-simd.js","decoder-pro-hard-not-wasm.js")):this._opt.useMThreading?(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro-mt.js","decoder-pro-hard-not-wasm.js")):(this._opt.decoderAudio=this._opt.decoder.replace("decoder-pro.js","decoder-pro-audio.js"),this._opt.decoderHard=this._opt.decoder.replace("decoder-pro.js","decoder-pro-hard.js"),this._opt.decoderHardNotWasm=this._opt.decoder.replace("decoder-pro.js","decoder-pro-hard-not-wasm.js")),po(this._opt.hasAudio)&&(this._opt.operateBtns.audio=!1),po(this._opt.hasVideo)&&(this._opt.operateBtns.fullscreen=!1,this._opt.operateBtns.screenshot=!1,this._opt.operateBtns.record=!1,this._opt.operateBtns.ptz=!1,this._opt.operateBtns.quality=!1,this._opt.operateBtns.zoom=!1),this._opt.qualityConfig&&0===this._opt.qualityConfig.length&&this._opt.operateBtns.quality&&(this._opt.operateBtns.quality=!1,this.debug.warn(this.TAG_NAME,"_opt.qualityConfig is empty, so set operateBtns.quality false")),uo(this._opt.useWebGPU)&&(this._opt.useWebGPU=function(){let e=!1;return"gpu"in navigator&&(e=!0),e}(),po(this._opt.useWebGPU)&&this.debug.warn(this.TAG_NAME,"useWebGPU is true, but not support so set useWebGPU false")),this._opt.hasControl=this._hasControl(),this._loading=!1,this._playing=!1,this._playbackPause=!1,this._hasLoaded=!1,this._zooming=!1,this._destroyed=!1,this._closed=!1,this._checkHeartTimeout=null,this._checkLoadingTimeout=null,this._checkStatsInterval=null,this._checkVisibleHiddenTimeout=null,this._startBpsTime=null,this._isPlayingBeforePageHidden=!1,this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,currentPts:0,pTs:0,dts:0,mseVideoBufferDelayTime:0,isDropping:!1},this._allStatsData={},this._faceDetectActive=!1,this._objectDetectActive=!1,this._occlusionDetectActive=!1,this._imageDetectActive=!1,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this._videoTimestamp=0,this._audioTimestamp=0,this._latestAudioTimestamp=0,this._videoIframeIntervalTs=0,this._streamQuality=this._opt.defaultStreamQuality||"",!this._streamQuality&&this._opt.qualityConfig.length>0&&(this._streamQuality=this._opt.qualityConfig[0]||""),this._visibility=!0,this._lastestVisibilityChangeTimestamp=null,this._tempWorkerStats=null,this._historyFpsList=[],this._historyVideoDiffList=[],this._tempStreamList=[],this._tempInnerPlayBgobj=null,this._flvMetaData=null,this._flvMetaDataFps=null,this._mseWorkerData={},po(this._opt.useMSE)&&po(this._opt.useWCS)&&!this.isWebrtcH264()&&!this.isOldHls()&&(this._opt.useWasm=!0),(this.isOldHls()||this.isWebrtcH264())&&(this._opt.hasVideo=!0,this._opt.hasAudio=!0),this._opt.hasVideo||(this._opt.useMSE=!1,this._opt.useWCS=!1),this._opt.useWasm&&(this._opt.useOffscreen?this._opt.wasmUseVideoRender=!1:this._opt.wasmUseVideoRender&&(this._opt.wasmUseVideoRender=va()&&xa()&&Ra(),this._opt.wasmUseVideoRender||this.debug.warn(this.TAG_NAME,"use wasm video render, but not support so set wasmUseVideoRender false")),this._opt.useSIMD?this.debug.log(this.TAG_NAME,"use simd wasm"):this.debug.log(this.TAG_NAME,"use wasm")),this._opt.useWasm&&(this._opt.useFaceDetector&&window.JessibucaProFaceDetector||this._opt.useObjectDetector&&window.JessibucaProObjectDetector||this._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector||this._opt.useImageDetector&&window.JessibucaProImageDetector)?(this.ai=new Hb(this),this._opt.useFaceDetector&&window.JessibucaProFaceDetector||(this._opt.operateBtns.aiFace=!1),this._opt.useObjectDetector&&window.JessibucaProObjectDetector||(this._opt.operateBtns.aiObject=!1),this._opt.useOcclusionDetector&&window.JessibucaProOcclusionDetector||(this._opt.operateBtns.aiOcclusion=!1),this._opt.useImageDetector&&this._opt.aiImageDetectActive&&window.JessibucaProImageDetector&&(this.imageDetectActive=!0)):(this._opt.operateBtns.aiObject=!1,this._opt.operateBtns.aiFace=!1,this._opt.operateBtns.aiOcclusion=!1),this._opt.useFaceDetector&&(this._opt.useWasm&&window.JessibucaProFaceDetector||this.debug.warn(this.TAG_NAME,`use face detector, useWasm is ${this._opt.useWasm} and window.JbProFaceDetector is null`)),this._opt.useObjectDetector&&(this._opt.useWasm&&window.JessibucaProObjectDetector||this.debug.warn(this.TAG_NAME,`use object detector, useWasm is ${this._opt.useWasm} and window.JbProObjectDetector is null`)),this._opt.useOcclusionDetector&&(this._opt.useWasm&&window.JessibucaProOcclusionDetector||this.debug.warn(this.TAG_NAME,`use occlusion detector, useWasm is ${this._opt.useWasm} and window.JessibucaProOcclusionDetector is null`)),this._opt.useImageDetector&&(this._opt.useWasm&&window.JessibucaProImageDetector||this.debug.warn(this.TAG_NAME,`use image detector, useWasm is ${this._opt.useWasm} and window.JessibucaProImageDetector is null`)),this._opt.useVideoRender&&(this._opt.useWasm&&!this._opt.useOffscreen?(this._opt.wasmUseVideoRender=va()&&xa()&&Ra(),this._opt.wasmUseVideoRender||this.debug.warn(this.TAG_NAME,"use wasm video render, but not support so set wasmUseVideoRender false")):this._opt.useWCS&&!this._opt.useOffscreen&&(this._opt.wcsUseVideoRender=xa()&&Ra(),this._opt.wcsUseVideoRender||this.debug.warn(this.TAG_NAME,"use wcs video render, but not support so set wcsUseVideoRender false"))),this._opt.useCanvasRender&&(this._opt.useMSE&&po(this._opt.mseDecoderUseWorker)&&(this._opt.mseUseCanvasRender=!0),this._opt.useWasm&&(this._opt.wasmUseVideoRender=!1),this._opt.useWCS&&(this._opt.wcsUseVideoRender=!1),this.isOldHls()&&!Aa()&&(this._opt.hlsUseCanvasRender=!0),this.isWebrtcH264()&&(this._opt.webrtcUseCanvasRender=!0)),this._opt.useVideoRender=!1,this._opt.useCanvasRender=!1,this._opt.useWasm?this._opt.wasmUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useWCS?this._opt.wcsUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useMSE?this._opt.mseUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this.isOldHls()?this._opt.hlsUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this.isWebrtcH264()&&(this._opt.webrtcUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0),s=this,Object.defineProperty(s,"rect",{get:()=>{let e={};return s.$container&&(e=s.$container.getBoundingClientRect(),e.width=Math.max(e.width,s.$container.clientWidth),e.height=Math.max(e.height,s.$container.clientHeight)),e}}),["bottom","height","left","right","top","width"].forEach((e=>{Object.defineProperty(s,e,{get:()=>s.rect[e]||0})})),this.events=new _o(this),this._opt.hasVideo&&(this.video=new $o(this),this.recorder=new el(this)),this.isOldHls()?(this.hlsDecoder=new fA(this),this.loaded=!0):this.isWebrtcH264()?(this._opt.isWebrtcForZLM?this.webrtc=new jb(this):this._opt.isWebrtcForSRS?this.webrtc=new $b(this):this._opt.isWebrtcForOthers?this.webrtc=new Wb(this):this.webrtc=new Nb(this),this.loaded=!0):this.isAliyunRtc()?(this.aliyunRtcDecoder=new Jb(this),this.loaded=!0):(this.isUseHls265()&&(this.hlsDecoder=new Fb(this)),this.isWebrtcH265()&&(this.webrtc=new Nb(this)),po(Za(this._opt))?this.decoderWorker=new ol(this):this.loaded=!0),this._opt.hasAudio&&(this.audio=new cn(this)),this.stream=null,this.demux=null,this._lastVolume=null,this._isMute=null,this._isInZoom=!1,this._playingStartTimestamp=null,this.isMSEVideoDecoderInitializationFailedNotSupportHevc=!1,this.isMSEAudioDecoderError=!1,this.isMSEPlaybackRateChangePause=!1,this.isPlayFailedAndPaused=!1,this._opt.useWCS&&(this.webcodecsDecoder=new gh(this),!this._opt.hasAudio&&po(this._opt.demuxUseWorker)&&(this.loaded=!0)),this._opt.useMSE&&po(this._opt.mseDecoderUseWorker)&&(this.mseDecoder=new Hh(this),!this._opt.hasAudio&&po(this._opt.demuxUseWorker)&&(this.loaded=!0)),this.control=new Ih(this),this._opt.contextmenuBtns.length>0&&po(this._opt.disableContextmenu)&&pa()?this.contextmenu=new Vb(this):uo(this._opt.disableContextmenu)&&this._opt.contextmenuBtns.length>0&&pa()&&this.debug.warn(this.TAG_NAME,"disableContextmenu is true, but contextmenuBtns is not empty, so Contextmenu can not be created,please check"),this.isPlayback()&&(this.playback=new zb(this,this._opt.playbackConfig)),this._opt.operateBtns.zoom&&(this.zoom=new Gb(this)),/(iphone|ipad|ipod|ios|android)/i.test(window.navigator.userAgent.toLowerCase())&&po(this._opt.supportLockScreenPlayAudio&&ya())&&(this.keepScreenOn=new $h(this)),(e=>{try{const t=t=>{qa(t)===e.$container&&(e.emit(lt.fullscreen,e.fullscreen),e.fullscreen?e._opt.useMSE&&e.resize():e.resize())};Mr.on("change",t),e.events.destroys.push((()=>{Mr.off("change",t)}))}catch(e){}if(e.on(nt.decoderWorkerInit,(()=>{e.debug.log("player","listen decoderWorkerInit and set loaded true"),e.loaded=!0})),e.on(nt.play,(()=>{e.loading=!1})),e.on(nt.fullscreen,(t=>{if(t)try{Mr.request(e.$container).then((()=>{})).catch((t=>{e.debug.error("player","fullscreen request error",t),ua()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}))}catch(t){ua()&&e._opt.useWebFullScreen&&(e.webFullscreen=!0)}else try{Mr.exit().then((()=>{e.webFullscreen&&(e.webFullscreen=!1)})).catch((t=>{e.debug.error("player","fullscreen exit error",t),e.webFullscreen&&(e.webFullscreen=!1)}))}catch(t){e.webFullscreen&&(e.webFullscreen=!1)}})),ua()&&e.on(nt.webFullscreen,(t=>{t?e.$container.classList.add("jb-pro-fullscreen-web"):e.$container.classList.remove("jb-pro-fullscreen-web"),e.emit(lt.fullscreen,e.fullscreen)})),e.on(nt.resize,(()=>{e.video&&e.video.resize()})),e._opt.debug){const t=[nt.timeUpdate,nt.currentPts,nt.videoSEI],i=[nt.stats,nt.playbackStats,nt.playbackTimestamp,nt.flvMetaData,nt.playToRenderTimes,nt.audioInfo,nt.videoInfo];Object.keys(nt).forEach((s=>{e.on(nt[s],(function(r){if(!t.includes(s)){i.includes(s)&&(r=JSON.stringify(r));for(var a=arguments.length,o=new Array(a>1?a-1:0),n=1;n{e.on(ct[t],(function(){for(var i=arguments.length,s=new Array(i),r=0;r{this.updateOption({rotate:e?270:0}),this.resize()}),10)}get webFullscreen(){return this.$container.classList.contains("jb-pro-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded||this.isOldHls()||this.isWebrtcH264()||this._opt.useMSE&&po(this._opt.hasAudio)&&po(this._opt.demuxUseWorker)||this._opt.useWCS&&!this._opt.hasAudio&&po(this._opt.demuxUseWorker)}set playing(e){this.isClosed()&&e?this.debug.log(this.TAG_NAME,"player is closed, so can not play"):(e&&uo(this.loading)&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(nt.playing,e),this.emit(nt.volumechange,this.volume),e?this.emit(nt.play):this.emit(nt.pause)))}get playing(){return this._playing}get volume(){return this.audio&&this.audio.volume||0}set volume(e){e!==this.volume&&(this.audio?(this.audio.setVolume(e),this._lastVolume=this.volume,this._isMute=0===this.volume):this.debug.warn(this.TAG_NAME,"set volume error, audio is null"))}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(nt.loading,this._loading))}get loading(){return this._loading}set zooming(e){this.zooming!==e&&(this.zoom||(this.zoom=new Gb(this)),this._zooming=e,this.emit(nt.zooming,this.zooming))}get zooming(){return this._zooming}set recording(e){e?this.playing&&!this.recording&&(this.recorder&&this.recorder.startRecord(),this.isDemuxInWorker()&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!0})):this.recording&&(this.isDemuxInWorker()&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder&&this.recorder.stopRecordAndSave().then((()=>{})).catch((e=>{})))}get recording(){return!!this.recorder&&this.recorder.isRecording}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set latestAudioTimestamp(e){null!==e&&(this._latestAudioTimestamp=e)}get latestAudioTimestamp(){return this._latestAudioTimestamp}get videoTimestamp(){return this._stats.currentPts||this._stats.ts}set streamQuality(e){this.streamQuality!==e&&(this._streamQuality=e,this.emit(nt.streamQualityChange,e))}get streamQuality(){return this._streamQuality}get isDebug(){return uo(this._opt.debug)}get scaleType(){const e=this._opt,t=e.isResize,i=e.isFullResize;let s=Qt;return po(i)&&po(t)?s=Qt:po(i)&&uo(t)?s=Xt:uo(i)&&uo(t)&&(s=Zt),s}set visibility(e){this._visibility!==e&&(this._visibility=e,this.emit(nt.visibilityChange,e),this._lastestVisibilityChangeTimestamp=aa(),e?this.clearVisibilityHiddenTimeout():this.startVisibilityHiddenTimeout())}get visibility(){return this._visibility}set playbackPause(e){this._playbackPause!==e&&(this._playbackPause=e,this.emit(nt.playbackPause,e),this.emit(nt.playbackPauseOrResume,e))}get playbackPause(){return this.isPlayback()&&this._playbackPause}set videoIframeIntervalTs(e){this._videoIframeIntervalTs=e}get videoIframeIntervalTs(){return this._videoIframeIntervalTs}set faceDetectActive(e){this._faceDetectActive!==e&&(this._faceDetectActive=e,this.emit(nt.faceDetectActive,e))}get faceDetectActive(){return this._faceDetectActive}set objectDetectActive(e){this._objectDetectActive!==e&&(this._objectDetectActive=e,this.emit(nt.objectDetectActive,e))}get objectDetectActive(){return this._objectDetectActive}set occlusionDetectActive(e){this._occlusionDetectActive!==e&&(this._occlusionDetectActive=e,this.emit(nt.occlusionDetectActive,e))}get occlusionDetectActive(){return this._occlusionDetectActive}set imageDetectActive(e){this._imageDetectActive!==e&&(this._imageDetectActive=e)}get imageDetectActive(){return this._imageDetectActive}get isUseWorkerDemuxAndDecode(){return this.stream&&this.stream.getStreamType()===y}isDestroyed(){return this._destroyed}isClosed(){return this._closed}isDestroyedOrClosed(){return this.isDestroyed()||this.isClosed()}isPlaying(){let e=!1;return this._opt.playType===b?e=this.playing:this._opt.playType===_&&(e=po(this.playbackPause)&&this.playing),e}updateOption(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._opt=Object.assign({},this._opt,e),uo(t)&&this.decoderWorker&&Object.keys(e).forEach((t=>{this.decoderWorker.updateWorkConfig({key:t,value:e[t]})}))}init(){return new Promise(((e,t)=>{this.video||this._opt.hasVideo&&(this.video=new $o(this)),this.audio||this._opt.hasAudio&&(this.audio=new cn(this)),this.stream||(this.stream=new vn(this)),this.isOldHls()?(this.hlsDecoder||(this.hlsDecoder=new fA(this),this.loaded=!0),e()):this.isWebrtcH264()?(this.webrtc||(this._opt.isWebrtcForZLM?this.webrtc=new jb(this):this._opt.isWebrtcForSRS?this.webrtc=new $b(this):this._opt.isWebrtcForOthers?this.webrtc=new Wb(this):this.webrtc=new Nb(this),this.loaded=!0),e()):this.isAliyunRtc()?(this.aliyunRtcDecoder||(this.aliyunRtcDecoder=new Jb(this),this.loaded=!0),e()):(this.demux||this._opt.hasVideo&&!this.isUseWorkerDemuxAndDecode&&(this.demux=new mh(this)),this._opt.useWCS&&(this.webcodecsDecoder||(this.webcodecsDecoder=new gh(this))),this._opt.useMSE&&po(this._opt.mseDecoderUseWorker)&&(this.mseDecoder||(this.mseDecoder=new Hh(this))),this.isUseHls265()&&(this.hlsDecoder||(this.hlsDecoder=new Fb(this))),this.isWebrtcH265()&&(this.webrtc||(this.webrtc=new Nb(this))),this.decoderWorker?this.loaded?e():this.once(nt.decoderWorkerInit,(()=>{this.isDestroyedOrClosed()?(this.debug.error(this.TAG_NAME,"init() failed and player is destroyed"),t("init() failed and player is destroyed")):(this.loaded=!0,e())})):Za(this._opt)?e():(this.decoderWorker=new ol(this),this.once(nt.decoderWorkerInit,(()=>{this.isDestroyedOrClosed()?(this.debug.error(this.TAG_NAME,"init() failed and player is destroyed"),t("init() failed and player is destroyed")):(this.loaded=!0,e())}))))}))}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(!e&&!this._opt.url)return s("url is empty");this._closed=!1,this.loading=!0,this.playing=!1,this._times.playInitStart=aa(),e||(e=this._opt.url),this._opt.url=e,this.control&&this._opt.loadingBackground&&this.control.initLoadingBackground(),this.init().then((()=>{this.debug.log(this.TAG_NAME,"play() init and next fetch stream"),this._times.playStart=aa(),this._opt.isNotMute&&this.mute(!1),this.enableWakeLock(),this.checkLoadingTimeout(),this.stream?(this.stream.once(ct.fetchError,(e=>{this.emitError(ct.fetchError,e)})),this.stream.once(ct.websocketError,(e=>{this.emitError(ct.websocketError,e)})),this.stream.once(nt.streamEnd,(e=>{this.emit(nt.streamEnd,e)})),this.stream.once(ct.hlsError,(e=>{this.emitError(ct.hlsError,e)})),this.stream.once(ct.webrtcError,(e=>{this.emitError(ct.webrtcError,e)})),this.stream.once(nt.streamSuccess,(()=>{i(),this._times.streamResponse=aa(),this.video&&this.video.play(),this.checkStatsInterval(),this.isPlayback()&&this.playback&&this.playback.startCheckStatsInterval()})),this.stream.fetchStream(e,t)):(this.debug.warn(this.TAG_NAME,`play() this.stream is null and is isDestroyedOrClosed is ${this.isDestroyedOrClosed()}`),s("this.stream is null"))})).catch((e=>{s(e)}))}))}playForControl(){return new Promise(((e,t)=>{this.debug.log(this.TAG_NAME,`playForControl() and pauseAndNextPlayUseLastFrameShow is ${this._opt.pauseAndNextPlayUseLastFrameShow}`),this._opt.pauseAndNextPlayUseLastFrameShow&&this._tempInnerPlayBgobj&&this._tempInnerPlayBgobj.loadingBackground&&this.updateOption({loadingBackground:this._tempInnerPlayBgobj.loadingBackground,loadingBackgroundWidth:this._tempInnerPlayBgobj.loadingBackgroundWidth,loadingBackgroundHeight:this._tempInnerPlayBgobj.loadingBackgroundHeight}),this.play().then((t=>{e(t)})).catch((e=>{t(e)}))}))}close(){return new Promise(((e,t)=>{this._close().then((()=>{this.video&&this.video.clearView(),e()})).catch((e=>{t(e)}))}))}resumeAudioAfterPause(){this.lastVolume&&po(this._isMute)&&(this.volume=this.lastVolume)}async _close(){this._closed=!0,this.video&&(this.video.resetInit(),this.video.pause(!0)),this.loading=!1,this.recording=!1,this.zooming=!1,this.playing=!1,this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.isPlayback()&&this.playback&&this.playback.clearStatsInterval(),this.releaseWakeLock(),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this.decoderWorker&&(await this.decoderWorker.destroy(),this.decoderWorker=null),this.stream&&(await this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.webcodecsDecoder&&(this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.hlsDecoder&&(await this.hlsDecoder.destroy(),this.hlsDecoder=null),this.webrtc&&(this.webrtc.destroy(),this.webrtc=null),this.aliyunRtcDecoder&&(this.aliyunRtcDecoder.destroy(),this.aliyunRtcDecoder=null),this.audio&&(await this.audio.destroy(),this.audio=null)}pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{e?this.close().then((()=>{t()})).catch((e=>{i(e)})):this._close().then((()=>{t()})).catch((e=>{i(e)}))}))}pauseForControl(){return new Promise(((e,t)=>{if(this.debug.log(this.TAG_NAME,"_pauseInner()"),this._opt.pauseAndNextPlayUseLastFrameShow&&this.video){const e=this.video.screenshot("","png",.92,"base64");if(e){const t=this.getVideoInfo();t?(this.debug.log(this.TAG_NAME,`pauseForControl() and loadingBackground width is ${t.width} and height is ${t.height}`),this._tempInnerPlayBgobj={loadingBackground:e,loadingBackgroundWidth:t.width,loadingBackgroundHeight:t.height}):this.debug.warn(this.TAG_NAME,"pauseForControl() and videoInfo is null")}else this.debug.warn(this.TAG_NAME,"pauseForControl() and loadingBackground is null")}this.pause().then((t=>{e(t)})).catch((e=>{t(e)}))}))}isAudioMute(){let e=!0;return this.audio&&(e=this.audio.isMute),e}isAudioNotMute(){return!this.isAudioMute()}mute(e){this.audio&&this.audio.mute(e)}resize(){this.video&&this.video.resize()}startRecord(e,t){this.recording||(this.recorder.setFileName(e,t),this.recording=!0)}stopRecordAndSave(e,t){return new Promise(((i,s)=>{this.recorder||s("recorder is null"),this.recording?(this._opt.useWasm&&this.decoderWorker&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder.stopRecordAndSave(e,t).then((e=>{i(e)})).catch((e=>{s(e)}))):s("recorder is not recording")}))}_hasControl(){let e=!1,t=!1;return Object.keys(this._opt.operateBtns).forEach((e=>{this._opt.operateBtns[e]&&-1===(""+e).indexOf("Fn")&&(t=!0)})),(this._opt.showBandwidth||t)&&(e=!0),this._opt.extendOperateBtns&&this._opt.extendOperateBtns.length>0&&(e=!0),this.isPlayback()&&this._opt.playbackConfig.showControl&&(e=!0),this._opt.controlHtml&&(e=!0),e}useWasmDecode(){return po(this._opt.useMSE)&&po(this._opt.useWCS)}canVideoTrackWritter(){const e=this._opt;return!this.isOldHls()&&!this.isWebrtcH264()&&po(e.useMSE)&&!this.isAliyunRtc()&&(e.useWCS&&po(e.useOffscreen)&&e.wcsUseVideoRender||this.useWasmDecode())}checkHeartTimeout$2(){if(po(this.playbackPause)&&this.playing){if(this.isDestroyedOrClosed())return void(this.debug&&this.debug.warn(this.TAG_NAME,"checkHeartTimeout$2 but player is destroyed"));if(po(this.isHistoryFpsListAllZero()))return void(this.debug&&this.debug.warn(this.TAG_NAME,"checkHeartTimeout$2 but fps is not all zero"));if(0!==this._stats.fps)return void(this.debug&&this.debug.warn(this.TAG_NAME,`checkHeartTimeout$2 but fps is ${this._stats.fps}`));if(po(this.visibility)&&0!==this._stats.vbps)return void(this.debug&&this.debug.warn(this.TAG_NAME,`checkHeartTimeout$2 but page is not visibility and vbps is ${this._stats.vbps}`));const e=this._historyFpsList.join(",");this.debug.warn(this.TAG_NAME,`checkHeartTimeout$2 and\n pause and emit delayTimeout event and\n current vbps is ${this._stats.vbps} and\n current fps is ${this._stats.fps} and\n history FpsList is ${e} and\n current visibility is ${this.visibility} and`),this.emit(nt.timeout,nt.delayTimeout),this.emit(nt.delayTimeout)}else this.debug.log(this.TAG_NAME,`checkHeartTimeout$2 playbackPause is ${this.playbackPause}, playing is ${this.playing}`)}checkStatsInterval(){this._checkStatsInterval=setInterval((()=>{this.updateStats()}),1e3)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout((()=>{this.playing?this.debug.warn(this.TAG_NAME,`checkLoadingTimeout but loading is ${this.loading} and playing is ${this.playing}`):this.isDestroyedOrClosed()?this.debug&&this.debug.warn(this.TAG_NAME,"checkLoadingTimeout but player is destroyed"):(this.debug.warn(this.TAG_NAME,"checkLoadingTimeout and pause and emit loadingTimeout event"),this.emit(nt.timeout,nt.loadingTimeout),this.emit(nt.loadingTimeout))}),1e3*this._opt.loadingTimeout)}clearCheckLoadingTimeout(){this._checkLoadingTimeout&&(this.debug.log(this.TAG_NAME,"clearCheckLoadingTimeout"),clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}handleRender(){this.isDestroyedOrClosed()?this.debug&&this.debug.warn(this.TAG_NAME,"handleRender but player is destroyed"):(this.loading&&(this.clearCheckLoadingTimeout(),this.loading=!1,this.emit(nt.start)),this.playing||(this.playing=!0))}updateStats(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._startBpsTime||(this._startBpsTime=aa()),Ba(e.ts)){const t=parseInt(e.ts,10);this._stats.ts=t,null===this._playingStartTimestamp&&t>0&&(this._playingStartTimestamp=t)}Ba(e.dts)&&(this._stats.dts=parseInt(e.dts,10)),Ba(e.mseTs)&&(this._stats.mseTs=e.mseTs),Ba(e.buf)&&(this._stats.buf=e.buf),Ba(e.netBuf)&&(this._stats.netBuf=e.netBuf),Ba(e.currentPts)&&(this._stats.currentPts=e.currentPts),e.fps&&(this._stats.fps+=1),e.dfps&&(this._stats.dfps+=1),e.abps&&(this._stats.abps+=e.abps),e.vbps&&(this._stats.vbps+=e.vbps),e.workerStats&&(this._tempWorkerStats=e.workerStats),e.isDropping&&(this._stats.isDropping=e.isDropping),e.mseVideoBufferDelayTime&&(this._stats.mseVideoBufferDelayTime=parseInt(1e3*e.mseVideoBufferDelayTime,10));const t=aa();if(t-this._startBpsTime<1e3)return;null!==this._playingStartTimestamp&&this._stats.fps>0&&(this._stats.pTs+=1);let i=0,s=0,r=0,a=0,o=0;this._opt.useMSE&&(this.mseDecoder?(i=this.mseDecoder.checkSourceBufferDelay(),i=parseInt(1e3*i,10),s=this.mseDecoder.checkSourceBufferStore(),s=s.toFixed(2),r=this.mseDecoder.getDecodeDiffTimes(),a=this.mseDecoder.getDecodePlaybackRate(),o=this.mseDecoder.getPendingSegmentsLength()):this.isMseDecoderUseWorker()&&(i=this.video.checkSourceBufferDelay(),i=parseInt(1e3*i,10),s=this.video.checkSourceBufferStore(),s=s.toFixed(2),a=this.video.getDecodePlaybackRate())),this._opt.useWCS&&this.webcodecsDecoder&&(r=this.webcodecsDecoder.getDecodeDiffTimes()),this.isOldHls()&&this.hlsDecoder&&(i=this.hlsDecoder.checkHlsBufferedDelay(),i=parseInt(1e3*i,10));let n=0,l=0,d=0;this.isUseHls265()&&this.hlsDecoder&&(i=this.hlsDecoder.checkHlsBufferedDelay(),i=i.toFixed(2),n=this.hlsDecoder.getDemuxBufferedListLength(),d=this.hlsDecoder.getDemuxVideoBufferedListLength(),l=this.hlsDecoder.getDemuxAudioBufferedListLength());let h=0,c=0,u=0,p=!1,f=0;this._opt.useWasm||this._opt.demuxUseWorker?this._tempWorkerStats&&(c=this._tempWorkerStats.demuxBufferDelay,u=this._tempWorkerStats.audioDemuxBufferDelay,h=this._tempWorkerStats.streamBufferByteLength,this._stats.netBuf=this._tempWorkerStats.netBuf,f=this._tempWorkerStats.pushLatestDelay,p=this._tempWorkerStats.isStreamTsMoreThanLocal,this._stats.buf=this._tempWorkerStats.latestDelay):this.demux&&(h=this.demux.getInputByteLength(),f=this.demux.getPushLatestDelay(),p=this.demux.getIsStreamTsMoreThanLocal(),this.demux.bufferList&&(c=this.demux.bufferList.length));let m=0,g=0;this.audio&&this.audio.bufferList&&(m=this.audio.bufferList.length,g=parseInt(m*this.audio.oneBufferDuration,10));let y=0,A=0;if(this.isPlayback()&&this.video){this._opt.playbackConfig.isUseFpsRender&&(y=this.video.bufferList&&this.video.bufferList.length||0);let e=this.video.getStreamFps();const t=e>0?1e3/e:0;A=parseInt(t*y+t*c,10)}let b=0;this.videoTimestamp>0&&(b=this._stats.dts-this.videoTimestamp);const v=b+this._stats.netBuf;this.isOldHls()&&(this._stats.fps=this.hlsDecoder.getFps()),this._stats.fps>this._stats.maxFps&&(this._stats.maxFps=this._stats.fps);let _=this.getVideoCurrentTime();const S=this._stats.videoCurrentTime;let w=-1;S&&_&&(w=(_-S).toFixed(2),_=_.toFixed(2));let E=0;this.audioTimestamp>0&&(E=this.audioTimestamp-this.getRenderCurrentPts()),this._allStatsData=Object.assign(this._stats,{audioBuffer:m,audioBufferDelayTs:g,audioTs:this.audioTimestamp,latestAudioTs:this.latestAudioTimestamp,playbackVideoBuffer:y,playbackVideoWaitingBuffer:0,playbackAudioWaitingBuffer:0,playbackCacheDataDuration:A,demuxBuffer:c,pushLatestDelay:f,audioDemuxBuffer:u,streamBuffer:h,mseDelay:i,mseStore:s,mseDecodeDiffTimes:r,mseDecodePlaybackRate:a,msePendingBuffer:o,wcsDecodeDiffTimes:r,hlsDelay:i,hlsDemuxLength:n,hlsDemuxAudioLength:l,hlsDemuxVideoLength:d,delayTs:b,totalDelayTs:v,isStreamTsMoreThanLocal:p,videoCurrentTime:_,videoCurrentTimeDiff:w,audioSyncVideo:E});let k=null,C=null,x="";if(this.isPlayer()&&this._opt.hasVideo&&this.playing){k=function(e,t){let i=3;const s=t||25;return e<.33*s?i=0:e<.5*s?i=1:e<.83*s&&(i=2),i}(this._stats.fps,this._flvMetaDataFps),this._allStatsData.performance=k;const e=this.checkVideoSmooth(this._allStatsData);x=e.reason,C=e.result,this._allStatsData.videoSmooth=C}this.emit(nt.stats,this._allStatsData),this._allStatsData.streamBuffer>this._opt.flvDemuxBufferSizeMaxLarge&&this.getDemuxType()===T&&this.emit(ct.flvDemuxBufferSizeTooLarge,this._allStatsData.streamBuffer),this._opt.hasVideo?(this.updateHistoryFpsList(this._stats.fps,this._stats.videoCurrentTimeDiff),Ba(k)&&this.emit(nt.performance,k),Ba(C)&&this.emit(nt.videoSmooth,C,x)):this._opt.hasAudio&&this.updateHistoryFpsList(this._stats.abps,0),this._stats.fps=0,this._stats.dfps=0,this._stats.abps=0,this._stats.vbps=0,this._stats.isDropping=!1,this._startBpsTime=t}resetStats(){this._startBpsTime=null,this._playingStartTimestamp=null,this._historyFpsList=[],this._historyVideoDiffList=[],this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,currentPts:0,pTs:0,dts:0,mseVideoBufferDelayTime:0,isDropping:!1},this._allStatsData={}}checkVideoSmooth(e){let t=!0,i="";if(this._opt.videoBuffer,this._opt.videoBufferDelay,this.isWebrtcH264()||this.isOldHls())return{result:t,reason:i};if(0===e.vbps&&po(this._opt.isHls)&&(i="vbpsIsZero",this.debug.log(this.TAG_NAME,`checkVideoSmooth false because ${i}`),t=!1),t&&e.isDropping&&(i="isDroppingIsTrue",this.debug.log(this.TAG_NAME,`checkVideoSmooth false because ${i}`),t=!1),t&&this.visibility&&this._historyFpsList.length>=this._opt.heartTimeout){const s=function(e){const t=Math.max(...e),i=Math.min(...e);return e.filter((e=>e!==t&&e!==i))}(this._historyFpsList),r=s.reduce(((e,t)=>e+t),0)/s.length,a=.83*r;e.fps=1.5||e.videoCurrentTimeDiff<=.5)&&-1!==e.videoCurrentTimeDiff&&(i="videoCurrentTimeDiffIsNotNormal",this.debug.log(this.TAG_NAME,`checkVideoSmooth false because videoCurrentTimeDiff is ${e.videoCurrentTimeDiff}`),t=!1),{result:t,reason:i}}enableWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.enable()}releaseWakeLock(){this._opt.keepScreenOn&&this.keepScreenOn&&this.keepScreenOn.disable()}clearBufferDelay(){this._opt.useWasm?this.decoderWorker&&this.decoderWorker.clearWorkBuffer(!0):this.demux&&this.demux.clearBuffer(!0)}doDestroy(){this.emit(nt.beforeDestroy)}handlePlayToRenderTimes(){if(this.isDestroyedOrClosed())return void this.debug.log(this.TAG_NAME,"handlePlayToRenderTimes but player is closed or destroyed");const e=this.getPlayToRenderTimes();this.emit(nt.playToRenderTimes,e)}getPlayToRenderTimes(){const e=this._times;return e.playTimestamp=e.playStart-e.playInitStart,e.streamTimestamp=e.streamStart-e.playStart,e.streamResponseTimestamp=e.streamResponse-e.streamStart>0?e.streamResponse-e.streamStart:0,e.demuxTimestamp=e.demuxStart-e.streamResponse>0?e.demuxStart-e.streamResponse:0,e.decodeTimestamp=e.decodeStart-e.demuxStart>0?e.decodeStart-e.demuxStart:0,e.videoTimestamp=e.videoStart-e.decodeStart,e.allTimestamp=e.videoStart-e.playInitStart,e}getOption(){return this._opt}getPlayType(){return this._opt.playType}isPlayer(){return this._opt.playType===b}isPlayback(){return this._opt.playType===_}isDemuxSetCodecInit(){let e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=!!this.webcodecsDecoder&&this.webcodecsDecoder.hasInit:t.useMSE&&(e=!!this.mseDecoder&&this.mseDecoder.hasInit),e}isDemuxDecodeFirstIIframeInit(){let e=!0,t=this._opt;return t.useWCS&&!t.useOffscreen?e=!!this.webcodecsDecoder&&this.webcodecsDecoder.isDecodeFirstIIframe:t.useMSE&&(e=!!this.mseDecoder&&this.mseDecoder.isDecodeFirstIIframe),e}isAudioPlaybackRateSpeed(){let e=!1;return this.audio&&(e=this.audio.isPlaybackRateSpeed()),e}getPlayingTimestamp(){return this._stats.pTs}getRecordingType(){let e=null;return this.recorder&&(e=this.recorder.getType()),e}getRecordingByteLength(){let e=0;return this.recording&&(e=this.recorder.getToTalByteLength()),e}getRecordingDuration(){let e=0;return this.recording&&(e=this.recorder.getTotalDuration()),e}getDecodeType(){let e="";const t=this.getOption();return this.isWebrtcH264()?G:this.isAliyunRtc()?V:this.isOldHls()?H:(t.useMSE&&(e+=U+" ",t.mseDecoderUseWorker&&(e+="worker")),t.useWCS&&(e+=F+" "),t.useWasm&&(e+=N+" ",t.useSIMD&&(e+=j+" "),t.useMThreading&&(e+=z+" ")),t.useOffscreen&&(e+=O+" "),e)}getDemuxType(){return this._opt.demuxType}getRenderType(){let e="";return this.video&&(e=this.video.getType()),e}getCanvasRenderType(){let e="";return this.video&&(e=this.video.getCanvasType()),e}getAudioEngineType(){let e="";return this.audio&&(e=this.audio.getEngineType()),e}getStreamType(){let e="";return this.stream&&(e=this.stream.getStreamType()),e}getAllStatsData(){return this._allStatsData}isFlvDemux(){return this._opt.demuxType===T}isM7SDemux(){return this._opt.demuxType===k}isNakedFlowDemux(){return this._opt.demuxType===D}isMpeg4Demux(){return this._opt.demuxType===P}isTsDemux(){return this._opt.demuxType===I}isFmp4Demux(){return this._opt.demuxType===L}togglePerformancePanel(e){this.updateOption({showPerformance:e}),this.emit(nt.togglePerformancePanel,e)}setScaleMode(e){let t={isFullResize:!1,isResize:!1,aspectRatio:"default"};switch(e=Number(e)){case Qt:t.isFullResize=!1,t.isResize=!1;break;case Xt:t.isFullResize=!1,t.isResize=!0;break;case Zt:t.isFullResize=!0,t.isResize=!0}this.updateOption(t),this.resize(),this.emit(nt.viewResizeChange,e)}startVisibilityHiddenTimeout(){this.clearVisibilityHiddenTimeout(),this._opt.pageVisibilityHiddenTimeout>0&&(this.visibilityHiddenTimeout=setTimeout((()=>{this.emit(nt.visibilityHiddenTimeout)}),1e3*this._opt.pageVisibilityHiddenTimeout))}clearVisibilityHiddenTimeout(){this._checkVisibleHiddenTimeout&&(clearTimeout(this._checkVisibleHiddenTimeout),this._checkVisibleHiddenTimeout=null)}faceDetect(e){this.faceDetectActive=e,po(e)&&this.video&&this.video.addAiContentToCanvas([])}objectDetect(e){this.objectDetectActive=e,po(e)&&this.video&&this.video.addAiContentToCanvas([])}occlusionDetect(e){this.occlusionDetectActive=e}downloadNakedFlowFile(){this.demux&&this.demux.downloadNakedFlowFile&&this.demux.downloadNakedFlowFile()}downloadFmp4File(){this.demux&&this.demux.downloadFmp4File&&this.demux.downloadFmp4File()}downloadMpeg4File(){const e=new Blob([this._tempStreamList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".mpeg4",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadMpeg4File",e)}}hasCacheOnGopBuffer(){const e=this.videoIframeIntervalTs,t=this._allStatsData.demuxBuffer,i=this._allStatsData.maxFps;let s=!1;if(e&&t&&i){s=1e3/i*t>e}return s}addContentToCanvas(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.video&&this.video.addContentToCanvas(e)}addContentToContainer(){}sendWebsocketMessage(e){const t=this.getStreamType();t===f||t===y+" "+f?this.stream.sendMessage(e):this.debug.warn(this.TAG_NAME,`sendWebsocketMessage: stream type is not websocket, current stream type is ${this.getStreamType()}`)}checkIsInRender(){const e=this._stats;return e.vbps>0&&e.fps>0}setControlHtml(e){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML=e)}clearControlHtml(){this.control&&this.control.$controlHtml&&(this.control.$controlHtml.innerHTML="")}updateWatermark(e){this.singleWatermark&&this.singleWatermark.update(e)}removeWatermark(){this.singleWatermark&&this.singleWatermark.remove()}getVideoInfo(){let e=null;return this.video&&(e=this.video.getVideoInfo()),e}getAudioInfo(){let e=null;return this.audio&&(e=this.audio.getAudioInfo()),e}getVideoPlaybackQuality(){let e=null;return this.video&&(e=this.video.getPlaybackQuality()),e}emitError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";this.emit(nt.error,e,t),this.emit(e,t)}updateHistoryFpsList(e,t){this.playbackPause||(this._historyFpsList.length>this._opt.heartTimeout&&(this._historyFpsList.shift(),this._historyVideoDiffList.shift()),this._historyFpsList.push(e),this._historyVideoDiffList.push(t),this.isHistoryFpsListAllZero()&&this.checkHeartTimeout$2())}isHistoryFpsListAllZero(){let e=!0;if(this._historyFpsList.length0){e=!1;break}if(e)for(let t=0;t0){e=!1;break}return e}isUseHls265(){return uo(this._opt.isHls)&&uo(this._opt.supportHls265)}isHls(){return uo(this._opt.isHls)}isOldHls(){return uo(this._opt.isHls)&&po(this._opt.supportHls265)}isWebrtcNotH265(){return uo(this._opt.isWebrtc)&&po(this._opt.isWebrtcH265)}isWebrtcH264(){return uo(this._opt.isWebrtc)&&po(this._opt.isWebrtcH265)}isWebrtcH265(){return uo(this._opt.isWebrtc)&&uo(this._opt.isWebrtcH265)}isAliyunRtc(){return uo(this._opt.isAliyunRtc)}isUseHls265UseMse(){return this.isUseHls265()&&this.isUseMSE()}isStreamWebTransport(){return this.getStreamType()===g}isPlaybackCacheBeforeDecodeForFpsRender(){return this.isPlayback()&&uo(this._opt.playbackConfig.isCacheBeforeDecodeForFpsRender)&&uo(this._opt.useWCS)}isPlaybackUseWCS(){return this.isPlayback()&&uo(this._opt.useWCS)}isPlaybackUseMSE(){return this.isPlayback()&&uo(this._opt.useMSE)}isPlayUseMSE(){return this.isPlayer()&&uo(this._opt.useMSE)}isInWebFullscreen(){return this._opt.useWebFullScreen&&ua()&&this.fullscreen}getPlaybackRate(){let e=1;return uo(this.isPlayback())&&this.playback&&(e=this.playback.rate),e}isPlaybackOnlyDecodeIFrame(){return uo(this.isPlayback())&&this.getPlaybackRate()>=this._opt.playbackForwardMaxRateDecodeIFrame}pushTempStream(e){const t=new Uint8Array(e);this._tempStreamList.push(t)}updateLoadingText(e){this.loading&&this.control&&this.control.updateLoadingText(e)}getVideoCurrentTime(){let e=0;return this.video&&(this._opt.useMSE?this.mseDecoder?e=this.mseDecoder.getVideoCurrentTime():this.isMseDecoderUseWorker()&&(e=this.video.getVideoCurrentTime()):this.isWebrtcH264()&&this.webrtc?e=this.webrtc.getVideoCurrentTime():this.isAliyunRtc()&&this.aliyunRtcDecoder&&(e=this.aliyunRtcDecoder.getVideoCurrentTime())),e}addMemoryLog(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s0){const e=t/1e3;this._flvMetaDataFps=e}}Pa(e.hasAudio)&&po(e.hasAudio)&&(this.debug.log("updateMetaData","hasAudio",e.hasAudio,"and update _opt.hasAudio"),this._opt.hasAudio=e.hasAudio),Pa(e.hasVideo)&&po(e.hasVideo)&&(this.debug.log("updateMetaData","hasVideo",e.hasVideo,"and update _opt.hasVideo"),this._opt.hasVideo=e.hasVideo)}this.emit(nt.flvMetaData,e)}getMetaData(){return this._flvMetaData}getExtendBtnList(){return this.control.getExtendBtnList().map((e=>({name:e.name,$container:e.$iconContainer,$btn:e.$iconWrap,$activeBtn:e.$activeIconWrap})))}getCpuLevel(){let e=null;return this.pressureObserverCpu&&(e=this.pressureObserverCpu.getCurrentCpuState()),e}isRecordTypeFlv(){return this.recorder&&this._opt.recordType===E}isRecordTypeMp4(){return this.recorder&&this._opt.recordType===S}isRecordTypeWebm(){return this.recorder&&this._opt.recordType===w}isDemuxInWorker(){return this._opt.useWasm||this._opt.demuxUseWorker}isUseMSE(){return uo(this._opt.useMSE)}isUseWCS(){return uo(this._opt.useWCS)}isUseWASM(){return uo(this._opt.useWasm)}isMseDecoderUseWorker(){return this.isUseMSE()&&uo(this._opt.mseDecoderUseWorker)}getAudioSyncVideoDiff(){return this.audioTimestamp-this.getRenderCurrentPts()}getMseVideoBufferDelayTime(){let e=0;return this._opt.useMSE&&this.mseDecoder&&(this.mseDecoder?e=this.mseDecoder.getVideoBufferDelayTime():this.isMseDecoderUseWorker()&&(e=this.video.getVideoBufferDelayTime()),e=parseInt(1e3*e,10)),e}updateCurrentPts(e){this.updateStats({currentPts:e}),this.emit(nt.currentPts,e)}getRenderCurrentPts(){let e=0;return e=this._stats.currentPts?this._stats.currentPts:this.videoTimestamp-this.getMseVideoBufferDelayTime(),e}openSyncAudioAndVideo(){return this._opt.syncAudioAndVideo&&this._opt.hasVideo}showTipsMessageByCode(e){if(this.control){const t=this._opt.showMessageConfig[e]||"未知异常";this.control.showTipsMessage(t,e)}}showTipsMessageByContent(e){this.control&&e&&this.control.showTipsMessage(e)}hideTipsMessage(){this.control&&this.control.hideTipsMessage()}decoderCheckFirstIFrame(){uo(this._opt.checkFirstIFrame)&&(this.mseDecoder?this.mseDecoder.isDecodeFirstIIframe=!1:this.webcodecsDecoder&&(this.webcodecsDecoder.isDecodeFirstIIframe=!1))}isHlsCanVideoPlay(){return this._canPlayAppleMpegurl&&this.isOldHls()}setPtzPosition(e){this.control&&this.control.updatePtzPosition(e)}setPlayFailedAndPaused(){this.isPlayFailedAndPaused=!0}getMseMineType(){let e={};return this.mseDecoder&&(e=this.mseDecoder.getMimeType()),e}getMaxDelayTs(){return this._opt.videoBuffer+this._opt.videoBufferDelay}isMseVideoStateInited(){return!this.video||this.video.getReadyStateInited()}}class Qb{constructor(e){const{fromSampleRate:t,toSampleRate:i,channels:s,inputBufferSize:r}=e;if(!t||!i||!s)throw new Error("Invalid settings specified for the resampler.");this.resampler=null,this.fromSampleRate=t,this.toSampleRate=i,this.channels=s||0,this.inputBufferSize=r,this.initialize()}initialize(){this.fromSampleRate==this.toSampleRate?(this.resampler=e=>e,this.ratioWeight=1):(this.fromSampleRate{let t,i,s,r,a,o,n,l,d,h=e.length,c=this.channels;if(h%c!=0)throw new Error("Buffer was of incorrect sample length.");if(h<=0)return[];for(t=this.outputBufferSize,i=this.ratioWeight,s=this.lastWeight,r=0,a=0,o=0,n=0,l=this.outputBuffer;s<1;s+=i)for(a=s%1,r=1-a,this.lastWeight=s%1,d=0;d0?d:0)]*r+e[o+(c+d)]*a;s+=i,o=Math.floor(s)*c}for(d=0;d{let t,i,s,r,a,o,n,l,d,h,c,u=e.length,p=this.channels;if(u%p!=0)throw new Error("Buffer was of incorrect sample length.");if(u<=0)return[];for(t=this.outputBufferSize,i=[],s=this.ratioWeight,r=0,o=0,n=0,l=!this.tailExists,this.tailExists=!1,d=this.outputBuffer,h=0,c=0,a=0;a0&&o=n)){for(a=0;a0?a:0)]*r;c+=r,r=0;break}for(a=0;a{t[i]=function(e){let t,i,s;return e>=0?t=213:(t=85,(e=-e-1)<0&&(e=32767)),i=Zb(e,Xb,8),i>=8?127^t:(s=i<<4,s|=i<2?e>>4&15:e>>i+3&15,s^t)}(e)})),t}function tv(e){const t=[];return Array.prototype.slice.call(e).forEach(((e,i)=>{t[i]=function(e){let t=0;e<0?(e=132-e,t=127):(e+=132,t=255);let i=Zb(e,Xb,8);return i>=8?127^t:(i<<4|e>>i+3&15)^t}(e)})),t}class iv extends So{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this._opt={},e&&(this.player=e),this.TAG_NAME="talk";const i=no(Is);this._opt=Object.assign({},i,t),this._opt.sampleRate=parseInt(this._opt.sampleRate,10),this._opt.sampleBitsWidth=parseInt(this._opt.sampleBitsWidth,10),this.audioContext=null,this.gainNode=null,this.recorder=null,this.workletRecorder=null,this.biquadFilter=null,this.userMediaStream=null,this.clearWorkletUrlTimeout=null,this.bufferSize=512,this._opt.audioBufferLength=this.calcAudioBufferLength(),this.audioBufferList=[],this.socket=null,this.socketStatus=ut,this.mediaStreamSource=null,this.heartInterval=null,this.checkGetUserMediaTimeout=null,this.wsUrl=null,this.startTimestamp=0,this.sequenceId=0,this.tempTimestamp=null,this.tempG711BufferList=[],this.tempRtpBufferList=[],this.tempPcmBufferList=[],this.events=new _o(this),this._initTalk(),this.player||(this.debug=new Pr(this)),this._opt.encType!==Hi&&this._opt.encType!==Vi||8e3===this._opt.sampleRate&&16===this._opt.sampleBitsWidth||this.warn(this.TAG_NAME,`\n encType is ${this._opt.encType} and sampleBitsWidth is ${this._opt.sampleBitsWidth}, set sampleBitsWidth to ${this._opt.sampleBitsWidth}。\n ${this._opt.encType} only support sampleRate 8000 and sampleBitsWidth 16`),this.log(this.TAG_NAME,"init",JSON.stringify(this._opt))}destroy(){this.clearWorkletUrlTimeout&&(clearTimeout(this.clearWorkletUrlTimeout),this.clearWorkletUrlTimeout=null),this.userMediaStream&&(this.userMediaStream.getTracks&&this.userMediaStream.getTracks().forEach((e=>{e.stop()})),this.userMediaStream=null),this.mediaStreamSource&&(this.mediaStreamSource.disconnect(),this.mediaStreamSource=null),this.recorder&&(this.recorder.disconnect(),this.recorder.onaudioprocess=null,this.recorder=null),this.biquadFilter&&(this.biquadFilter.disconnect(),this.biquadFilter=null),this.gainNode&&(this.gainNode.disconnect(),this.gainNode=null),this.workletRecorder&&(this.workletRecorder.disconnect(),this.workletRecorder=null),this.socket&&(this.socketStatus===pt&&this._sendClose(),this.socket.close(),this.socket=null),this._stopHeartInterval(),this._stopCheckGetUserMediaTimeout(),this.audioContext=null,this.gainNode=null,this.recorder=null,this.audioBufferList=[],this.sequenceId=0,this.wsUrl=null,this.tempTimestamp=null,this.tempRtpBufferList=[],this.tempG711BufferList=[],this.tempPcmBufferList=[],this.startTimestamp=0,this.log(this.TAG_NAME,"destroy")}addRtpToBuffer(e){const t=e.length+this.tempRtpBufferList.length,i=new Uint8Array(t);i.set(this.tempRtpBufferList,0),i.set(e,this.tempRtpBufferList.length),this.tempRtpBufferList=i}addG711ToBuffer(e){const t=e.length+this.tempG711BufferList.length,i=new Uint8Array(t);i.set(this.tempG711BufferList,0),i.set(e,this.tempG711BufferList.length),this.tempG711BufferList=i}addPcmToBuffer(e){const t=e.length+this.tempPcmBufferList.length,i=new Uint8Array(t);i.set(this.tempPcmBufferList,0),i.set(e,this.tempPcmBufferList.length),this.tempG711ButempPcmBufferListfferList=i}downloadRtpFile(){this.debug.log(this.TAG_NAME,"downloadRtpFile");const e=new Blob([this.tempRtpBufferList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".rtp",t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadRtpFile",e)}}downloadG711File(){this.debug.log(this.TAG_NAME,"downloadG711File");const e=new Blob([this.tempG711BufferList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+"."+this._opt.encType,t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadG711File",e)}}downloadPcmFile(){this.debug.log(this.TAG_NAME,"downloadPcmFile");const e=new Blob([this.tempPcmBufferList]);try{const t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+"."+this._opt.encType,t.click(),window.URL.revokeObjectURL(t.href)}catch(e){console.error("downloadRtpFile",e)}}downloadFile(){this._opt.packetType===ks?this.downloadRtpFile():this._opt.encType===Hi||this._opt.encType===Vi?this.downloadG711File():this.downloadPcmFile()}calcAudioBufferLength(){const{sampleRate:e,sampleBitsWidth:t}=this._opt;return 8*e*.02/8}get socketStatusOpen(){return this.socketStatus===pt}log(){for(var e=arguments.length,t=new Array(e),i=0;i1?t-1:0),s=1;s{const i=this.events.proxy;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer",this.emit(nt.talkStreamStart),i(this.socket,xs,(()=>{this.socketStatus=pt,this.log(this.TAG_NAME,"websocket open -> do talk"),this.emit(nt.talkStreamOpen),e(),this._doTalk()})),i(this.socket,Ls,(e=>{this.log(this.TAG_NAME,"websocket message",e.data)})),i(this.socket,Rs,(e=>{this.socketStatus=ft,this.warn(this.TAG_NAME,"websocket close -> reject",e),this.emit(nt.talkStreamClose),t(e)})),i(this.socket,Ds,(e=>{this.socketStatus=mt,this.error(this.TAG_NAME,"websocket error -> reject",e),this.emit(nt.talkStreamError,e),t(e)}))}))}_sendClose(){}_initTalk(){this._initMethods(),this._opt.engine===Ps?this._initWorklet():this._opt.engine===Bs&&this._initScriptProcessor(),this.log(this.TAG_NAME,"audioContext samplerate",this.audioContext.sampleRate)}_initMethods(){this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:48e3}),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=1,this.biquadFilter=this.audioContext.createBiquadFilter(),this.biquadFilter.type="lowpass",this.biquadFilter.frequency.value=3e3,this.resampler=new Qb({fromSampleRate:this.audioContext.sampleRate,toSampleRate:this._opt.sampleRate,channels:this._opt.numberChannels,inputBufferSize:this.bufferSize})}_initScriptProcessor(){const e=this.audioContext.createScriptProcessor||this.audioContext.createJavaScriptNode;this.recorder=e.apply(this.audioContext,[this.bufferSize,this._opt.numberChannels,this._opt.numberChannels]),this.recorder.onaudioprocess=e=>this._onaudioprocess(e)}_initWorklet(){const e=eo((function(){class e extends AudioWorkletProcessor{constructor(e){super(),this._cursor=0,this._bufferSize=e.processorOptions.bufferSize,this._buffer=new Float32Array(this._bufferSize)}process(e,t,i){if(!e.length||!e[0].length)return!0;for(let t=0;t{const e=new AudioWorkletNode(this.audioContext,"talk-processor",{processorOptions:{bufferSize:this.bufferSize}});e.connect(this.gainNode),e.port.onmessage=e=>{"data"===e.data.eventType&&this._encodeAudioData(e.data.buffer)},this.workletRecorder=e})),this.clearWorkletUrlTimeout=setTimeout((()=>{URL.revokeObjectURL(e),this.clearWorkletUrlTimeout=null}),te)}_onaudioprocess(e){const t=e.inputBuffer.getChannelData(0);this._encodeAudioData(new Float32Array(t))}_encodeAudioData(e){if(0===e[0]&&0===e[1])return void this.log(this.TAG_NAME,"empty audio data");const t=this.resampler.resample(e);let i=t;if(16===this._opt.sampleBitsWidth?i=function(e){let t=e.length,i=new Int16Array(t);for(;t--;){let s=Math.max(-1,Math.min(1,e[t]));i[t]=s<0?32768*s:32767*s}return i}(t):8===this._opt.sampleBitsWidth&&(i=function(e){let t=e.length,i=new Int8Array(t);for(;t--;){let s=Math.max(-1,Math.min(1,e[t]));const r=s<0?32768*s:32767*s;i[t]=parseInt(255/(65535/(32768+r)),10)}return i}(t)),null!==i.buffer){let e=null;this._opt.encType===Hi?e=ev(i):this._opt.encType===Vi?e=tv(i):this._opt.encType===$i&&(e=i);const t=new Uint8Array(e);for(let e=0;e>8,t[n++]=255&e>>0}t[n++]=128,t[n++]=128+i,t[n++]=s/256,t[n++]=s%256,t[n++]=r/65536/256,t[n++]=r/65536%256,t[n++]=r%65536/256,t[n++]=r%65536%256,t[n++]=a/65536/256,t[n++]=a/65536%256,t[n++]=a%65536/256,t[n++]=a%65536%256;let l=t.concat([...e]),d=new Uint8Array(l.length);for(let e=0;e{this.log(this.TAG_NAME,"getUserMedia success"),this.userMediaStream=e,this.mediaStreamSource=this.audioContext.createMediaStreamSource(e),this.mediaStreamSource.connect(this.biquadFilter),this.recorder?(this.biquadFilter.connect(this.recorder),this.recorder.connect(this.gainNode)):this.workletRecorder&&(this.biquadFilter.connect(this.workletRecorder),this.workletRecorder.connect(this.gainNode)),this.gainNode.connect(this.audioContext.destination),this.emit(nt.talkGetUserMediaSuccess),null===e.oninactive&&(e.oninactive=e=>{this._handleStreamInactive(e)})})).catch((e=>{this.error(this.TAG_NAME,"getUserMedia error",e.toString()),this.emit(nt.talkGetUserMediaFail,e.toString())})).finally((()=>{this.log(this.TAG_NAME,"getUserMedia finally"),this._stopCheckGetUserMediaTimeout()}))}_getUserMedia2(){this.log(this.TAG_NAME,"getUserMedia"),navigator.mediaDevices?navigator.mediaDevices.getUserMedia({audio:!0}).then((e=>{this.log(this.TAG_NAME,"getUserMedia2 success")})):navigator.getUserMedia({audio:!0},this.log(this.TAG_NAME,"getUserMedia2 success"),this.log(this.TAG_NAME,"getUserMedia2 fail"))}async _getUserMedia3(){this.log(this.TAG_NAME,"getUserMedia3");try{const e=await navigator.mediaDevices.getUserMedia({audio:{latency:!0,noiseSuppression:!0,autoGainControl:!0,echoCancellation:!0,sampleRate:48e3,channelCount:1},video:!1});console.log("getUserMedia() got stream:",e),this.log(this.TAG_NAME,"getUserMedia3 success")}catch(e){this.log(this.TAG_NAME,"getUserMedia3 fail")}}_handleStreamInactive(e){this.userMediaStream&&(this.warn(this.TAG_NAME,"stream oninactive",e),this.emit(nt.talkStreamInactive))}_startCheckGetUserMediaTimeout(){this._stopCheckGetUserMediaTimeout(),this.checkGetUserMediaTimeout=setTimeout((()=>{this.log(this.TAG_NAME,"check getUserMedia timeout"),this.emit(nt.talkGetUserMediaTimeout)}),this._opt.getUserMediaTimeout)}_stopCheckGetUserMediaTimeout(){this.checkGetUserMediaTimeout&&(this.log(this.TAG_NAME,"stop checkGetUserMediaTimeout"),clearTimeout(this.checkGetUserMediaTimeout),this.checkGetUserMediaTimeout=null)}_startHeartInterval(){this.heartInterval=setInterval((()=>{this.log(this.TAG_NAME,"heart interval");let e=[35,36,0,0,0,0,0,0];e=new Uint8Array(e),this.socket.send(e.buffer)}),15e3)}_stopHeartInterval(){this.heartInterval&&(this.log(this.TAG_NAME,"stop heart interval"),clearInterval(this.heartInterval),this.heartInterval=null)}startTalk(e){return new Promise(((t,i)=>{if(!function(){let e=!1;const t=window.navigator;return t&&(e=!(!t.mediaDevices||!t.mediaDevices.getUserMedia),e||(e=!!(t.getUserMedia||t.webkitGetUserMedia||t.mozGetUserMedia||t.msGetUserMedia))),e}())return i("not support getUserMedia");if(this.wsUrl=e,this._opt.testMicrophone)this._doTalk();else{if(!this.wsUrl)return i("wsUrl is null");this._createWebSocket().catch((e=>{i(e)}))}this.once(nt.talkGetUserMediaFail,(()=>{i("getUserMedia fail")})),this.once(nt.talkGetUserMediaSuccess,(()=>{t()}))}))}setVolume(e){e=parseFloat(e).toFixed(2),isNaN(e)||(e=oa(e,0,1),this.gainNode.gain.value=e)}getOption(){return this._opt}get volume(){return this.gainNode?parseFloat(100*this.gainNode.gain.value).toFixed(0):null}}class sv{constructor(e){this.player=e,this.globalSetting=null;const t=Sa();this.defaultSettings={watermark_id:`JbPro_${t}`,watermark_prefix:`JbPro_mask_${t}`,watermark_txt:"JbPro 测试水印",watermark_x:0,watermark_y:0,watermark_rows:0,watermark_cols:0,watermark_x_space:0,watermark_y_space:0,watermark_font:"微软雅黑",watermark_color:"black",watermark_fontsize:"18px",watermark_alpha:.15,watermark_width:150,watermark_height:100,watermark_angle:15,watermark_parent_width:0,watermark_parent_height:0,watermark_parent_node:null},this.player.debug.log("Watermark","int")}destroy(){this._removeMark(),this.globalSetting=null,this.defaultSettings=null,this.player.debug.log("Watermark","destroy")}remove(){this._removeMark()}load(e){this.globalSetting=e,this._loadMark(e)}resize(){this.player.debug.log("Watermark","resize()"),this.globalSetting&&this._loadMark(this.globalSetting)}_loadMark(){let e=this.defaultSettings;if(1===arguments.length&&"object"==typeof arguments[0]){var t=arguments[0]||{};for(let i in t)t[i]&&e[i]&&t[i]===e[i]||(t[i]||0===t[i])&&(e[i]=t[i])}var i=document.getElementById(e.watermark_id);i&&i.parentNode&&i.parentNode.removeChild(i);var s="string"==typeof e.watermark_parent_node?document.getElementById(e.watermark_parent_node):e.watermark_parent_node,r=s||document.body;const a=r.getBoundingClientRect();var o=Math.max(r.scrollWidth,r.clientWidth,a.width),n=Math.max(r.scrollHeight,r.clientHeight,a.height),l=arguments[0]||{},d=r;(l.watermark_parent_width||l.watermark_parent_height)&&d&&(e.watermark_x=e.watermark_x+0,e.watermark_y=e.watermark_y+0);var h=document.getElementById(e.watermark_id),c=null;if(h)h.shadowRoot&&(c=h.shadowRoot);else{(h=document.createElement("div")).id=e.watermark_id,h.setAttribute("style","pointer-events: none !important; display: block !important"),c="function"==typeof h.attachShadow?h.attachShadow({mode:"open"}):h;var u=r.children,p=Math.floor(Math.random()*(u.length-1))+1;u[p]?r.insertBefore(h,u[p]):r.appendChild(h)}e.watermark_cols=parseInt((o-e.watermark_x)/(e.watermark_width+e.watermark_x_space));var f,m=parseInt((o-e.watermark_x-e.watermark_width*e.watermark_cols)/e.watermark_cols);e.watermark_x_space=m?e.watermark_x_space:m,e.watermark_rows=parseInt((n-e.watermark_y)/(e.watermark_height+e.watermark_y_space));var g,y,A,b=parseInt((n-e.watermark_y-e.watermark_height*e.watermark_rows)/e.watermark_rows);e.watermark_y_space=b?e.watermark_y_space:b,s?(f=e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),g=e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1)):(f=0+e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),g=0+e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1));for(var v=0;v\n \n \n ${m.watermark_txt}\n \n \n ${m.watermark_txt}\n \n \n \n \n `,_=window.btoa(unescape(encodeURIComponent(v)));var S=document.createElement("div");S.style.position="absolute",S.style.left="0px",S.style.top="0px",S.style.overflow="hidden",S.style.zIndex="9999999",S.style.width=o+"px",S.style.height=n+"px",S.style.display="block",S.style["-ms-user-select"]="none",S.style.backgroundImage=`url(data:image/svg+xml;base64,${_})`,c.appendChild(S)}_removeMark(){const e=this.defaultSettings;var t=document.getElementById(e.watermark_id);if(t){var i=t.parentNode;i&&i.removeChild(t)}}_calcTextSize(){const{watermark_txt:e,watermark_font:t,watermark_fontsize:i}=this.globalSetting,s=document.createElement("span");s.innerHTML=e,s.setAttribute("style",`font-family: ${t}; font-size: ${i}px; visibility: hidden; display: inline-block`),document.querySelector("body").appendChild(s);const r={width:s.offsetWidth,height:s.offsetHeight};return s.remove(),r}}const av="right",ov="left",nv="up",lv="down",dv="leftUp",hv="leftDown",cv="rightUp",uv="rightDown",pv="zoomExpand",fv="zoomNarrow",mv="apertureFar",gv="apertureNear",yv="focusFar",Av="focusNear",bv="setPos",vv="calPos",_v="delPos",Sv="wiperOpen",wv="wiperClose",Ev="cruiseStart",Tv={stop:0,fiStop:0,right:1,left:2,up:8,down:4,leftUp:10,leftDown:6,rightUp:9,rightDown:5,zoomExpand:16,zoomNarrow:32,apertureFar:72,apertureNear:68,focusFar:66,focusNear:65,setPos:129,calPos:130,delPos:131,wiperOpen:140,wiperClose:141,setCruise:132,decCruise:133,cruiseStart:136,cruiseStop:0},kv=[25,50,75,100,125,150,175,200,225,250],Cv=[1,2,3,4,5,6,7,8,9,16],xv=[16,48,80,112,144,160,176,192,208,224];function Rv(e){const{type:t,speed:i=5,index:s=0}=e,r=function(e){return kv[(e=e||5)-1]||kv[4]}(i);let a,o,n,l;if(a=Tv[t],!a)return"";switch(t){case nv:case lv:case mv:case gv:n=r;break;case av:case ov:case yv:case Av:o=r;break;case dv:case hv:case cv:case uv:o=r,n=r;break;case pv:case fv:l=function(e){return xv[(e=e||5)-1]||xv[4]}(i);break;case vv:case _v:case bv:n=Dv(s);break;case wv:case Sv:o=1;break;case Ev:o=Dv(s)}return function(e,t,i,s){let r=[];r[0]=165,r[1]=15,r[2]=1,r[3]=0,r[4]=0,r[5]=0,r[6]=0,e&&(r[3]=e);t&&(r[4]=t);i&&(r[5]=i);s&&(r[6]=s);return r[7]=(r[0]+r[1]+r[2]+r[3]+r[4]+r[5]+r[6])%256,function(e){let t="";for(let i=0;it)){for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i===t?s[r]=Pv(e[r]):"object"==typeof e[r]?s[r]=Bv(e[r],t,i+1):s[r]=e[r]);return s}}function Iv(){return(new Date).toLocaleString()}class Mv{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.player=e,this.TAG_NAME="MemoryLogger",this.logMaxSize=(null==t?void 0:t.logMaxSize)||204800,this.logSize=0,this.logTextArray=[],this.player.debug.log(this.TAG_NAME,"init")}destroy(){this.clear(),this.player.debug.log(this.TAG_NAME,"destroy")}clear(){this.logSize=0,this.logTextArray=[]}logCache(){let e="";try{for(var t=arguments.length,i=new Array(t),s=0;sBv(e)));e="[JbPro] "+Iv()+JSON.stringify(r)}catch(e){return}if(this.logSize+=e.length,this.logTextArray.push(e),this.logSize>this.logMaxSize){const e=this.logTextArray.shift();this.logSize-=e.length}}getLog(){return this.logTextArray.join("\n")}getLogBlob(){const e=this.getLog();return new Blob([e],{type:"text/plain"})}download(){const e=this.getLog();this.clear();const t=new Blob([e],{type:"text/plain"});No(t,"JbPro-"+Iv()+".log")}}class Uv extends So{constructor(e){super(),this.player=e,this.TAG_NAME="Network",this.online=this.isOnline(),this.prevOnline=this.online,this.interval=null,this._initListener(),this.player.debug.log(this.TAG_NAME,"init")}destroy(){this.off(),this._stopCheck(),window.removeEventListener("online",this._updateOnlineStatus),window.removeEventListener("offline",this._updateOfflineStatus),this.player.debug.log(this.TAG_NAME,"destroy")}_initListener(){window.addEventListener("online",this._updateOnlineStatus.bind(this)),window.addEventListener("offline",this._updateOfflineStatus.bind(this))}_stopCheck(){this.interval&&(clearInterval(this.interval),this.interval=null)}_startCheck(){this.interval=setInterval((()=>{this.isOnline()!==this.prevOnline&&(this.isOnline()?this._updateOnlineStatus():this._updateOfflineStatus())}),1e3)}_updateOnlineStatus(){this.prevOnline=this.online,this.online=!0,this.logStatus(),this.emit("online")}_updateOfflineStatus(){this.prevOnline=this.online,this.online=!1,this.logStatus(),this.emit("offline")}logStatus(){const e=this.prevOnline?"online":"offline",t=this.online?"online":"offline";this.player.debug.log(this.TAG_NAME,`prevOnline: ${this.prevOnline}, online: ${this.online}, status: ${e} -> ${t}`)}isOnline(){return void 0===navigator.onLine||navigator.onLine}isOffline(){return!this.isOnline()}}class Fv extends So{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this._opt={},this.TAG_NAME="JbPro",this.$container=null,Object.keys(e).forEach((t=>{if(void 0===e[t])throw new Error(`JbPro option "${t}" can not be undefined`)})),this.originalOptions=e;const t=lo();let i=Object.assign({},t,e);i.url="",i.isMulti&&(i.debugUuid="xxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))),this.debug=new Pr(this),this.debug.log("JbPro","init");let s=e.container;if("string"==typeof e.container&&(s=document.querySelector(e.container)),!s)throw this.debug.error("JbPro","JbPro need container option and now container is",e.container),new Error("JbPro need container option");if(i.decoder&&po(-1!==i.decoder.indexOf("decoder-pro.js")||-1!==i.decoder.indexOf("decoder-pro-simd.js")))throw this.debug.error("JbPro",`JbPro decoder ${i.decoder} must be decoder-pro.js or decoder-pro-simd.js`),new Error(`JbPro decoder ${i.decoder} must be decoder-pro.js or decoder-pro-simd.js`);if("CANVAS"===s.nodeName||"VIDEO"===s.nodeName)throw this.debug.error("JbPro",`JbPro container type can not be ${s.nodeName} type`),new Error(`JbPro container type can not be ${s.nodeName} type`);if(i.videoBuffer>=i.heartTimeout)throw this.debug.error("JbPro",`JbPro videoBuffer ${i.videoBuffer}s must be less than heartTimeout ${i.heartTimeout}s`),new Error(`JbPro videoBuffer ${i.videoBuffer}s must be less than heartTimeout ${i.heartTimeout}s`);if(this._checkHasCreated(s))throw this.debug.error("JbPro","JbPro container has been created and can not be created again",s),new Error("JbPro container has been created and can not be created again",s);if(!s.classList)throw this.debug.error(this.TAG_NAME,"JbPro container is invalid, must be a DOM Element",s),new Error("JbPro container is invalid, must be a DOM Element",s);var r,a,o;if(i.videoBuffer>10&&console.warn("JbPro",`videoBuffer ${i.videoBuffer}s is too long, will black screen for ${i.videoBuffer}s , it is recommended to set it to less than 10s`),s.classList.add("jb-pro-container"),r=s,a=ee,o=Sa(),r&&(r.dataset?r.dataset[a]=o:r.setAttribute("data-"+a,o)),po(i.isLive)){const e=document.createElement("video");return e.muted=!0,e.setAttribute("controlsList","nodownload"),e.disablePictureInPicture="disablePictureInPicture",e.style.position="absolute",e.style.top=0,e.style.left=0,e.style.height="100%",e.style.width="100%",s.appendChild(e),this.$videoElement=e,this.$container=s,void(this._opt=i)}if(delete i.container,Ba(i.videoBuffer)&&(i.videoBuffer=1e3*Number(i.videoBuffer)),Ba(i.videoBufferDelay)&&(i.videoBufferDelay=1e3*Number(i.videoBufferDelay)),Ba(i.networkDelay)&&(i.networkDelay=1e3*Number(i.networkDelay)),Ba(i.aiFaceDetectInterval)&&(i.aiFaceDetectInterval=1e3*Number(i.aiFaceDetectInterval)),Ba(i.aiObjectDetectInterval)&&(i.aiObjectDetectInterval=1e3*Number(i.aiObjectDetectInterval)),Ba(i.timeout)&&(La(i.loadingTimeout)&&(i.loadingTimeout=i.timeout),La(i.heartTimeout)&&(i.heartTimeout=i.timeout)),Ba(i.autoWasm)&&(La(i.decoderErrorAutoWasm)&&(i.decoderErrorAutoWasm=i.autoWasm),La(i.hardDecodingNotSupportAutoWasm)&&(i.hardDecodingNotSupportAutoWasm=i.autoWasm)),Ba(i.aiFaceDetectLevel)&&La(i.aiFaceDetectWidth)){const e=or[i.aiFaceDetectLevel];e&&(i.aiFaceDetectWidth=e)}if(Ba(i.aiObjectDetectLevel)&&La(i.aiObjectDetectWidth)){const e=nr[i.aiObjectDetectLevel];e&&(i.aiObjectDetectWidth=e)}uo(i.isCrypto)&&(i.isM7sCrypto=!0),this._opt=i,this._destroyed=!1,this.$container=s,this._tempPlayBgObj={},this._tempVideoLastIframeInfo={},this._tempPlayerIsMute=!0,this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this._streamErrorReplayTimes=0,this._streamEndReplayTimes=0,this._websocket1006ErrorReplayTimes=0,this.events=new _o(this),this._opt.isUseNewFullscreenWatermark?this.watermark=new rv(this):this.watermark=new sv(this),this.memoryLogger=new Mv(this),this.network=new Uv(this),this._websocket1006ErrorRetryLog=[],this._mseDecodeErrorRetryLog=[],this._wcsDecodeErrorRetryLog=[],this._isNetworkOfflinePaused=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this.widthOrHeightChangeReplayDelayTimeout=null,this.streamErrorReplayDelayTimeout=null,this.streamEndReplayDelayTimeout=null,this.$loadingBgImage=null,this.$loadingBg=null,this._initPlayer(s,i),this._initWatermark(),this._initNetwork(),this.debug.log("JbPro",'init success and version is "4-1-2024"'),console.log('JbPro Version is "4-1-2024"')}destroy(){return new Promise(((e,t)=>{this.debug.log("JbPro","destroy()"),this._destroyed=!0,this.off(),this._removeTimeout(),this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$container&&this.$container.removeChild(this.$videoElement),this.$videoElement=null),this._removeLoadingBackgroundForIOS(),this.player?this.player.destroy().then((()=>{this.player=null,this._destroy(),e()})).catch((()=>{t()})):(this._destroy(),e())}))}_removeTimeout(){this.widthOrHeightChangeReplayDelayTimeout&&(clearTimeout(this.widthOrHeightChangeReplayDelayTimeout),this.widthOrHeightChangeReplayDelayTimeout=null),this.streamErrorReplayDelayTimeout&&(clearTimeout(this.streamErrorReplayDelayTimeout),this.streamErrorReplayDelayTimeout=null),this.streamEndReplayDelayTimeout&&(clearTimeout(this.streamEndReplayDelayTimeout),this.streamEndReplayDelayTimeout=null)}_destroy(){var e,t;this.events&&(this.events.destroy(),this.events=null),this.talk&&(this.talk.destroy(),this.talk=null),this.watermark&&(this.watermark.destroy(),this.watermark=null),this.network&&(this.network.destroy(),this.network=null),this.memoryLogger&&(this.memoryLogger.destroy(),this.memoryLogger=null),this.$container&&(this.$container.classList.remove("jb-pro-container"),this.$container.classList.remove("jb-pro-fullscreen-web"),e=this.$container,t=ee,e&&(e.dataset?delete e.dataset[t]:e.removeAttribute("data-"+t)),this.$container=null),this._tempPlayBgObj=null,this._tempVideoLastIframeInfo=null,this._isNetworkOfflinePaused=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this._tempPlayerIsMute=!0,this._resetReplayTimes(),this.debug&&this.debug.log("JbPro","destroy end"),this._opt=null,this.debug=null}_resetReplayTimes(){this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this._streamErrorReplayTimes=0,this._streamEndReplayTimes=0,this._websocket1006ErrorReplayTimes=0,this._websocket1006ErrorRetryLog=[],this._mseDecodeErrorRetryLog=[],this._wcsDecodeErrorRetryLog=[]}_getOriginalOpt(){const e=lo();return Object.assign({},e,this.originalOptions)}_initPlayer(e,t){this.player=new Yb(e,t),this._bindEvents()}_initTalk(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.talk&&(this.talk.destroy(),this.talk=null),this.player&&(e.debug=this.player._opt.debug),this.talk=new iv(this.player,e),this.debug.log("JbPro","_initTalk",this.talk.getOption()),this._bindTalkEvents()}_resetPlayer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise(((t,i)=>{this.debug.log(this.TAG_NAME,"_resetPlayer()",JSON.stringify(e));const s=()=>{this._opt.url="",this._opt.playOptions={},this._opt=Object.assign(this._opt,e),this._initPlayer(this.$container,this._opt)};this.player?this.player.destroy().then((()=>{this.player=null,s(),this.debug.log(this.TAG_NAME,"_resetPlayer() end"),t()})).catch((()=>{i()})):(s(),this.debug.log(this.TAG_NAME,"_resetPlayer() end"),t())}))}_bindEvents(){var e=this;Object.keys(lt).forEach((t=>{this.player.on(lt[t],(function(){for(var i=arguments.length,s=new Array(i),r=0;r{this.player&&this.player.showTipsMessageByCode(e)})),this.player.once(nt.beforeDestroy,(()=>{this.emit(nt.close),this.destroy().then((()=>{})).catch((e=>{}))})),this.player.on(nt.resize,(()=>{this.watermark&&this.watermark.resize()})),this.player.on(nt.fullscreen,(()=>{this.watermark&&this.watermark.resize()})),this.player.on(nt.videoInfo,(()=>{this.player&&(this.player.singleWatermark&&this.player.singleWatermark.resize(),this.player.ghostWatermark&&this.player.ghostWatermark.resize(),this.player.dynamicWatermark&&this.player.dynamicWatermark.resize())})),this.player.on(nt.memoryLog,(function(){e.memoryLogger.logCache(...arguments)})),this.player.on(nt.downloadMemoryLog,(()=>{this.downloadMemoryLog()}))}_bindTalkEvents(){Object.keys(dt).forEach((e=>{this.player.on(dt[e],(t=>{this.emit(e,t)}))}))}_initWatermark(){if(Va(this._opt.fullscreenWatermarkConfig)){const e=Ma(this.$container,this._opt.fullscreenWatermarkConfig);if(!e.watermark_txt)return void this.debug.warn("JbPro","fullscreenWatermarkConfig text is empty");this.watermark.load(e)}}_initNetwork(){this.network.on(nt.online,(()=>{if(this.emit(nt.networkState,nt.online),this.isDestroyed())this.debug.log(this.TAG_NAME,"network online and JbPro is destroyed");else if(this._isNetworkOfflinePaused&&this._isNetworkOfflinePausedAndNextPlayConfig&&this._isNetworkOfflinePausedAndNextPlayConfig.url){const e=this._isNetworkOfflinePausedAndNextPlayConfig.url,t=this._isNetworkOfflinePausedAndNextPlayConfig.playOptions;this._streamErrorReplayTimes++;const i=this._isNetworkOfflinePausedAndNextPlayConfig.type||"unknown";this._isNetworkOfflinePaused=!1,this._isNetworkOfflinePausedAndNextPlayConfig={},this.debug.log(this.TAG_NAME,`${i} and network online and reset player and play`),this.play(e,t).then((()=>{this.debug.log(this.TAG_NAME,`${i} and network online and play success`)})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.fetchError,{},error),this.debug.error(this.TAG_NAME,`${i} and network online and play error`,e)}))}})),this.network.on(nt.offline,(()=>{this.emit(nt.networkState,nt.offline)}))}_checkHasCreated(e){if(!e)return!1;const t=function(e,t){return e?e.dataset?e.dataset[t]:e.getAttribute("data-"+t):""}(e,ee);return!!t}isDestroyed(){return this._destroyed}getOption(){return this.player?this.player.getOption():{}}setDebug(e){this.debug.log("JbPro",`setDebug() ${e}`),this._opt.debug=!!e,this.player?this.player.updateOption({debug:!!e},!0):this.debug.warn("JbPro","player is not init")}getIsDebug(){let e=!1;return this.player&&(e=this.player._opt.debug),e}mute(){this.debug.log("JbPro","mute()"),this.player&&this.player.mute(!0)}cancelMute(){this.debug.log("JbPro","cancelMute()"),this.player&&this.player.mute(!1)}setVolume(e){this.debug.log("JbPro",`setVolume() ${e}`),this.player&&(this.player.volume=e)}getVolume(){let e=null;return this.player&&(e=this.player.volume,e=parseFloat(e).toFixed(2)),e}audioResume(){this.debug.log("JbPro","audioResume()"),this.player&&this.player.audio?this.player.audio.audioEnabled(!0):this.debug.warn("JbPro","audioResume error")}setTimeout(e){this.debug.log("JbPro",`setTimeout() ${e}`),e=Number(e),isNaN(e)?this.debug.warn("JbPro",`setTimeout error: ${e} is not a number`):(this._opt.timeout=e,this._opt.loadingTimeout=e,this._opt.heartTimeout=e,this.player&&this.player.updateOption({timeout:e,loadingTimeout:e,heartTimeout:e}))}setScaleMode(e){this.debug.log("JbPro",`setScaleMode() ${e}`),this.player?this.player.setScaleMode(e):this.debug.warn("JbPro","setScaleMode() player is null")}pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{this.debug.log("JbPro",`pause() ${e}`),(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&(this._tempPlayBgObj=this._getVideoLastIframeInfo()),this._tempPlayerIsMute=this.isMute(),this._pause(e).then((e=>{t(e)})).catch((e=>{i(e)}))}))}_pause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new Promise(((t,i)=>{if(this.debug.log("JbPro",`_pause() ${e}`),this.isDestroyed())return i("JbPro is destroyed");this._resetReplayTimes(),this.player?this.player.pause(e).then((e=>{t(e)})).catch((e=>{i(e)})):i("player is null")}))}close(){return new Promise(((e,t)=>{this.debug.log("JbPro","close()"),this._opt.url="",this._resetReplayTimes(),this.player?this.player.close().then((()=>{e()})).catch((e=>{t(e)})):t("player is null")}))}clearView(){this.debug.log("JbPro","clearView()"),this.player&&this.player.video?this.getRenderType()===$?this.player.video.clearView():this.debug.warn("JbPro","clearView","render type is video, not support clearView, please use canvas render type"):this.debug.warn("JbPro","clearView","player is null")}play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(this.debug.log("JbPro",`play() ${e}`,JSON.stringify(t)),!e&&!this._opt.url)return this.emit(nt.error,ct.playError),void s("url is null and this._opt.url is null");if(e&&(e=(""+e).trim(),-1===e.indexOf("http:")&&-1===e.indexOf("https:")&&-1===e.indexOf("webrtc:")&&-1===e.indexOf("ws:")&&-1===e.indexOf("wss:")&&-1===e.indexOf("wt:")&&-1===e.indexOf("artc:")))return s(`url ${e} must be "http:" or "https:" or "webrtc:" or "ws:" or "wss:" or "wt:" or "artc:" protocol`);if(po(this._opt.isLive))return this.$videoElement.controls="controls",this.$videoElement.muted=!1,this.$videoElement.src=e,this.$videoElement.play(),void i(this.$videoElement);if(this._opt.isM7sCrypto){let r=t.cryptoKey||this._opt.playOptions.cryptoKey,a=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.m7sCryptoKey&&(!r||!a)){const e=this._opt.m7sCryptoKey.split(".");r=ao(e[0]),a=ao(e[1])}if(!r||!a){const r=e||this._opt.url;return void this._cryptoPlay(r).then((r=>{let{cryptoIV:a,cryptoKey:o}=r;this._opt.playOptions.cryptoKey=o,this._opt.playOptions.cryptoIV=a,t.cryptoIV=a,t.cryptoKey=o,this._playBefore(e,t).then((()=>{i()})).catch((e=>{s(e)}))})).catch((e=>{s(e)}))}this._opt.playOptions.cryptoKey=r,this._opt.playOptions.cryptoIV=a,t.cryptoIV=a,t.cryptoKey=r}else if(this._opt.isXorCrypto){let e=t.cryptoKey||this._opt.playOptions.cryptoKey,i=t.cryptoIV||this._opt.playOptions.cryptoIV;if(this._opt.xorCryptoKey&&(!e||!i)){const t=this._opt.xorCryptoKey.split(".");e=ao(t[0]),i=ao(t[1])}e&&i&&(this._opt.playOptions.cryptoKey=e,this._opt.playOptions.cryptoIV=i,t.cryptoIV=i,t.cryptoKey=e)}this._playBefore(e,t).then((()=>{i()})).catch((e=>{s(e)}))}))}_playBefore(e,t){return new Promise(((i,s)=>{if(this.player)if(e)if(this._opt.url)if(e===this._opt.url)if(this.player.playing)this.debug.log("JbPro","_playBefore","playing and resolve()"),i();else{this.debug.log("JbPro","_playBefore","this._opt.url === url and pause -> play and destroy play");let e=this._getOriginalOpt();(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&this._tempPlayBgObj&&this._tempPlayBgObj.loadingBackground&&(e=Object.assign(e,this._tempPlayBgObj)),po(this._tempPlayerIsMute)&&(e.isNotMute=!0,this._tempPlayerIsMute=!0);const t=this._opt.url,r=this._opt.playOptions;this._resetPlayer(e).then((()=>{this._play(t,r).then((()=>{i()})).catch((e=>{this.debug.error("JbPro","_playBefore this.player.play error",e),this.emit(nt.crashLog,this.getCrashLog("this.player.play 1",e)),s(e)}))})).catch((e=>{this.debug.error("JbPro","_resetPlayer error",e)}))}else{this.debug.log("JbPro","_playBefore",`\n this._url.url is ${this._opt.url}\n and new url is ${e}\n and destroy and play new url`);const r=this._getOriginalOpt();this._resetPlayer(r).then((()=>{this._play(e,t).then((()=>{i()})).catch((e=>{this.debug.error("JbPro","_playBefore _play error",e),this.emit(nt.crashLog,this.getCrashLog("this.player.play 2",e)),s(e)}))})).catch((e=>{this.debug.error("JbPro","_resetPlayer error",e)}))}else this._play(e,t).then((()=>{i()})).catch((e=>{this.debug.error("JbPro","_playBefore _play error",e),this.emit(nt.crashLog,this.getCrashLog("this.player.play 3",e)),s(e)}));else{let e=this._getOriginalOpt();(this._opt.pauseAndNextPlayUseLastFrameShow||this._opt.replayUseLastFrameShow)&&this._tempPlayBgObj&&this._tempPlayBgObj.loadingBackground&&(e=Object.assign(e,this._tempPlayBgObj)),po(this._tempPlayerIsMute)&&(e.isNotMute=!0,this._tempPlayerIsMute=!0);const t=this._opt.url,r=this._opt.playOptions;this._resetPlayer(e).then((()=>{this._play(t,r).then((()=>{i()})).catch((e=>{this.debug.error("JbPro","_playBefore _play error",e),this.emit(nt.crashLog,this.getCrashLog("this.player.play 4",e)),s(e)}))})).catch((e=>{this.debug.error("JbPro","_resetPlayer error",e)}))}else e?this._play(e,t).then((()=>{i()})).catch((e=>{this.debug.error("JbPro","_playBefore _play error",e),this.emit(nt.crashLog,this.getCrashLog("this.player.play 5",e)),s(e)})):this._play(this._opt.url,this._opt.playOptions).then((()=>{i()})).catch((e=>{this.debug.error("JbPro","_playBefore _play error",e),this.emit(nt.crashLog,this.getCrashLog("this.player.play 6",e)),s(e)}))}))}_cryptoPlay(e){return new Promise(((t,i)=>{const s=function(e){const t=(e||document.location.toString()).split("//"),i=t[1].indexOf("/");let s=t[1].substring(i);return-1!=s.indexOf("?")&&(s=s.split("?")[0]),s}(e);let r=this._opt.cryptoKeyUrl,a="";const o=oo(e);if(r){if(a=r,this._opt.isM7sCrypto&&-1===a.indexOf("/crypto/?stream=")){const e=oo(r);a=e.origin+Z+`?stream=${s}`}}else r=o.origin+Z,a=r+`?stream=${s}`;var n;this.player.debug.log("JbPro",`_cryptoPlay() cryptoKeyUrl: ${a} and opt.cryptoKeyUrl: ${this._opt.cryptoKeyUrl}`),(n=a,new Promise(((e,t)=>{bl.get(n).then((t=>{e(t)})).catch((e=>{t(e)}))}))).then((e=>{if(e){const s=e.split("."),r=ao(s[0]),a=ao(s[1]);a&&r?t({cryptoIV:a,cryptoKey:r}):i("get cryptoIV or cryptoKey error")}else i(`cryptoKeyUrl: getM7SCryptoStreamKey ${a} res is null`)})).catch((e=>{i(e)}))}))}playback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{if(this.debug.log("JbPro",`playback() ${e}, options: ${JSON.stringify(t)}`),po(this._opt.isLive))return s("this._opt.isLive is false, can not playback");const r=ho(),a=Object.assign({},r.playbackConfig,this._opt.playbackConfig,t);a.isUseFpsRender||a.isCacheBeforeDecodeForFpsRender&&(a.isCacheBeforeDecodeForFpsRender=!1,this.debug.warn("JbPro","playbackConfig.isUseFpsRender is false, isCacheBeforeDecodeForFpsRender can not be ture, isCacheBeforeDecodeForFpsRender is set to false")),0===a.rateConfig.length&&a.showRateBtn&&(a.showRateBtn=!1,this.debug.warn("JbPro","playbackConfig.rateConfig.length is 0, showRateBtn can not be ture, showRateBtn is set to false")),a.controlType,Q.simple,this._resetPlayer({videoBuffer:0,playbackConfig:a,playType:_,openWebglAlignment:!0,useMSE:a.useMSE,useWCS:a.useWCS,useSIMD:!0}).then((()=>{this.play(e,t).then((()=>{i()})).catch((e=>{s(e)}))})).catch((e=>{s(e)}))}))}playbackPause(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.debug.log("JbPro",`playbackPause() ${e}`),this._opt.playType===b?Promise.reject("playType is player, can not call playbackPause method"):new Promise(((t,i)=>{if(!this.player)return i("player is null");uo(e)?this._pause().then((()=>{t()})).catch((e=>{i(e)})):(this.player.playbackPause=!0,t())}))}playbackResume(){return this.debug.log("JbPro","playbackResume()"),this._opt.playType===b?Promise.reject("playType is player, can not call playbackResume method"):new Promise(((e,t)=>{if(!this.player)return t("player is null");this.player.playbackPause=!1,e()}))}forward(e){return this.debug.log("JbPro",`forward() ${e}`),po(this._opt.isLive)||this._opt.playType===b?Promise.reject("forward() method only just for playback type"):Ta(Number(e))?new Promise(((t,i)=>{this.player?(e=oa(Number(e),.1,32),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"playbackRate",value:e}),this.player.playback.setRate(e),this.player.video&&this.player.video.setRate(e),this.player.audio&&this.player.audio.setRate(e),(this.player.isPlaybackUseWCS()||this.player.isPlaybackUseMSE())&&(this.player.demux.dropBuffer$2(),this.player.isPlaybackCacheBeforeDecodeForFpsRender()&&this.player.demux.initPlaybackCacheLoop()),t()):i("player is not playing")})):Promise.reject(`forward() params "rate": ${e} must be number type`)}playbackForward(e){return this.forward(e)}normal(){return this.forward(1)}playbackNormal(){return this.normal()}updatePlaybackForwardMaxRateDecodeIFrame(e){this.debug.log("JbPro",`updatePlaybackForwardMaxRateDecodeIFrame() ${e}`),e=Number(e),e=oa(e=parseInt(e,10),1,8),this._opt.playbackForwardMaxRateDecodeIFrame=e,this.player?this.player.updateOption({playbackForwardMaxRateDecodeIFrame:e},!0):this.debug.warn("JbPro","updatePlaybackForwardMaxRateDecodeIFrame() player is null")}setPlaybackStartTime(e){this.debug.log("JbPro",`setPlaybackStartTime() ${e}`);const t=Ga(e);this.player?this.player.isPlayback()?t<10&&0!==e&&this.player.playback.isControlTypeNormal()?this.debug.warn("JbPro",`setPlaybackStartTime() control type is normal and timestamp: ${e} is not valid`):this.player.playback.isControlTypeSimple()&&e>this.player.playback.totalDuration?this.debug.warn("JbPro",`setPlaybackStartTime() control type is simple and timestamp: ${e} is more than ${this.player.playback.totalDuration}`):this.player.playing&&(this.player.playback.isControlTypeNormal()&&10===t&&(e*=1e3),this.player.playback.setStartTime(e),this.playbackClearCacheBuffer()):this.debug.warn("JbPro","setPlaybackStartTime() playType is not playback"):this.debug.warn("JbPro","setPlaybackStartTime() player is null")}setPlaybackShowPrecision(e){this.debug.log("JbPro",`setPlaybackShowPrecision() ${e}`),this.player?this.player.isPlayback()?this.player.playback.isControlTypeNormal()?this.player.playback.setShowPrecision(e):this.debug.warn("JbPro","control type is not normal , not support!"):this.debug.warn("JbPro","playType is not playback"):this.debug.warn("JbPro","player is null")}playbackCurrentTimeScroll(){this.debug.log("JbPro","playbackCurrentTimeScroll()"),this.player?this.player.isPlayback()?this.player.playback.isControlTypeNormal()?this.player.playback.currentTimeScroll():this.debug.warn("JbPro","control type is not normal , not support!"):this.debug.warn("JbPro","playType is not playback"):this.debug.warn("JbPro","player is null")}playbackClearCacheBuffer(){this.debug.log("JbPro","playbackClearCacheBuffer()"),this.player?this.player.isPlayback()?(this.player.video&&this.player.video.clear(),this.player.audio&&this.player.audio.clear(),this.clearBufferDelay()):this.debug.warn("JbPro","playType is not playback"):this.debug.warn("JbPro","player is null")}getPlaybackCurrentRate(){if(this.player){if(this.player.isPlayback())return this.player.getPlaybackRate();this.debug.warn("JbPro","playType is not playback")}else this.debug.warn("JbPro","player is null")}updatePlaybackLocalOneFrameTimestamp(e){this.debug.log("JbPro",`updatePlaybackLocalOneFrameTimestamp() ${e}`),this.player?this.player.isPlayback()?this.player.playback.updateLocalOneFrameTimestamp(e):this.debug.warn("JbPro","playType is not playback"):this.debug.warn("JbPro","player is null")}setStreamQuality(e){if(this.debug.log("JbPro",`setStreamQuality() ${e}`),!this.player)return void this.debug.warn("JbPro","player is null");if(!this.player._opt.operateBtns.quality)return void this.debug.warn("JbPro","player._opt.operateBtns.quality is false");(this.player._opt.qualityConfig||[]).includes(e)?this.player.streamQuality=e:this.debug.warn("JbPro",`quality: ${e} is not in qualityList`)}_play(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((s,r)=>{if(!this.player)return r("player is null");let u=!1;this._opt.url&&this._opt.url!==t&&(u=!0),this._opt.url=t,this._opt.playOptions=i;const p=t.split("?")[0],f=p.startsWith("http://")||p.startsWith("https://"),m=p.startsWith("webrtc://"),g=p.startsWith("artc://"),y=p.startsWith("wt://"),A=p.startsWith("ws://")||p.startsWith("wss://"),b=f||A,v=f&&p.endsWith(".m3u8"),_=b&&p.endsWith(".flv"),S=b&&(p.endsWith(".fmp4")||p.endsWith(".mp4")),w=b&&p.endsWith(".mpeg4"),E=b&&(p.endsWith(".h264")||p.endsWith(".h265")),M=b&&p.endsWith(".ts");let U=this._opt.isWebrtcForZLM||!1,F=this._opt.isWebrtcForSRS||!1,O=this._opt.isWebrtcForOthers||!1;m&&(-1!==t.indexOf("/index/api/webrtc")?(U=!0,F=!1,O=!1):-1!==t.indexOf("/rtc/v1/play/")&&(F=!0,U=!1,O=!1));let j=null,z=null;if(_&&po(this._opt.isFlv)&&this._resetDemuxType("isFlv"),S&&po(this._opt.isFmp4)&&this._resetDemuxType("isFmp4"),w&&po(this._opt.isMpeg4)&&this._resetDemuxType("isMpeg4"),E&&po(this._opt.isNakedFlow)&&this._resetDemuxType("isNakedFlow"),M&&po(this._opt.isTs)&&this._resetDemuxType("isTs"),f?j=v?n:o:y?j=d:m?j=l:g?j=h:A&&(j=a),this._opt.isNakedFlow?z=D:this._opt.isFmp4?z=L:this._opt.isMpeg4?z=P:this._opt.isFlv?z=T:this._opt.isTs?z=I:v?z=C:m?z=x:g?z=B:y?z=R:A&&(z=k),!j||!z)return this._opt.playFailedAndPausedShowMessage&&this.showErrorMessageTips("url is not support"),r(`play url ${t} is invalid, protocol is ${c[j]}, demuxType is ${z}`);this.debug.log("JbPro",`play url ${t} protocol is ${c[j]}, demuxType is ${z}`);const G=()=>{this.player.once(ct.webglAlignmentError,(e=>{if(this.isDestroyed())this.debug.log("JbPro","webglAlignmentError but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.webglAlignmentError,e)),this.player&&this.player._opt.webglAlignmentErrorReplay){this.debug.log("JbPro","webglAlignmentError");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({openWebglAlignment:!0}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","webglAlignmentError and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webglAlignmentError,{},e),this.debug.error("JbPro","webglAlignmentError and play error",t)}))})).catch((e=>{this.debug.error("JbPro","webglAlignmentError and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.webglAlignmentError,{},e),this.debug.log("JbPro","webglAlignmentError and webglAlignmentErrorReplay is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webglAlignmentError,{},e),this.debug.error("JbPro","webglAlignmentError and pause error",t)}))}})),this.player.once(ct.webglContextLostError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","webglContextLostError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.webglContextLostError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.webglContextLostErrorReplay){this.debug.log("JbPro","webglContextLostError");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","webglContextLostError and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.webglContextLostError,t,e),this.debug.error("JbPro","webglContextLostError and play error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.webglContextLostError,t,e),this.debug.error("JbPro","webglContextLostError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.webglContextLostError,t,e),this.debug.log("JbPro","webglContextLostError and webglContextLostErrorReplay is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.webglContextLostError,t,e),this.debug.error("JbPro","webglAlignmentError and pause error",i)}))}})),this.player.once(ct.mediaSourceH265NotSupport,(e=>{if(this.isDestroyed())this.debug.log("JbPro","mediaSourceH265NotSupport but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.mediaSourceH265NotSupport,e)),this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debug.log("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceH265NotSupport,e),this.debug.error("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceH265NotSupport,{},e),this.debug.error("JbPro","mediaSourceH265NotSupport auto wasm [mse-> wasm] _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceH265NotSupport,{},e),this.debug.log("JbPro","mediaSourceH265NotSupport and autoWasm is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceH265NotSupport,{},e),this.debug.error("JbPro","mediaSourceH265NotSupport and pause error",t)}))}})),this.player.once(ct.mediaSourceFull,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","mediaSourceFull but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.mediaSourceFull,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},a=this.player._opt.decoderErrorAutoWasm,o=!0;a?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(Dr)?this._mseDecodeErrorRetryLog.push(aa()):(a=!0,o=!1,r={useMSE:!1,useWCS:!1}),this.debug.log("JbPro",`mediaSourceFull and auto wasm ${po(o)?" and is not meaningful Retry":""} [mse-> ${a?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","mediaSourceFull and reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceFull,t,e),this.debug.error("JbPro","mediaSourceFull and reset player and play error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceFull,t,e),this.debug.error("JbPro","mediaSourceFull and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceFull,t,e),this.debug.log("JbPro","mediaSourceFull and autoWasm is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceFull,t,e),this.debug.error("JbPro","mediaSourceFull and pause error",i)}))}})),this.player.once(ct.mediaSourceAppendBufferError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","mediaSourceAppendBufferError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.mediaSourceAppendBufferError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},a=this.player._opt.decoderErrorAutoWasm,o=!0;a?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(Dr)?this._mseDecodeErrorRetryLog.push(aa()):(a=!0,o=!1,r={useMSE:!1,useWCS:!1}),this.player.isMSEAudioDecoderError&&(this.player.debug.log("JbPro","mediaSourceAppendBufferError and isMSEAudioDecoderError is true so set mseDecodeAudio = false"),r.mseDecodeAudio=!1),this.debug.log("JbPro",`mediaSourceAppendBufferError and auto wasm ${po(o)?" and is not meaningful Retry":""} [mse-> ${a?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","mediaSourceAppendBufferError and reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAppendBufferError,t,e),this.debug.error("JbPro","mediaSourceAppendBufferError and reset player and play error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAppendBufferError,t,e),this.debug.error("JbPro","mediaSourceAppendBufferError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAppendBufferError,t,e),this.debug.log("JbPro","mediaSourceAppendBufferError and autoWasm is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAppendBufferError,t,e),this.debug.error("JbPro","mediaSourceAppendBufferError and pause error",i)}))}})),this.player.once(ct.mseSourceBufferError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","mseSourceBufferError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.mseSourceBufferError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={};if(this.player._opt.mseDecoderUseWorker)r={mseDecoderUseWorker:!1},this.debug.log("JbPro","mseSourceBufferError auto wasm [mse worker -> mse] reset player and play");else{let e=this.player._opt.decoderErrorAutoWasm,t=!0;e?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(Dr)?this._mseDecodeErrorRetryLog.push(aa()):(e=!0,t=!1,r={useMSE:!1,useWCS:!1}),this.player.isMSEVideoDecoderInitializationFailedNotSupportHevc&&(this.debug.log("JbPro","mseSourceBufferError and isMSEVideoDecoderInitializationFailedNotSupportHevc is true so auto wasm"),r={useMSE:!1,useWCS:!1}),this.debug.log("JbPro",`mseSourceBufferError auto wasm ${po(t)?" and is not meaningful Retry":""} [mse-> ${e?"wasm":"mse"}] reset player and play`)}this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","mseSourceBufferError reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mseSourceBufferError,t,e),this.debug.error("JbPro","mseSourceBufferError reset player and play error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mseSourceBufferError,t,e),this.debug.error("JbPro","mseSourceBufferError _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.mseSourceBufferError,t,e),this.debug.log("JbPro","mseSourceBufferError and autoWasm is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mseSourceBufferError,t,e),this.debug.error("JbPro","mseSourceBufferError and pause error:",i)}))}})),this.player.once(ct.mediaSourceBufferedIsZeroError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","mediaSourceBufferedIsZeroError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.mediaSourceBufferedIsZeroError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mseDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},a=this.player._opt.decoderErrorAutoWasm,o=!0;a?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(Dr)?this._mseDecodeErrorRetryLog.push(aa()):(a=!0,o=!1,r={useMSE:!1,useWCS:!1}),this.debug.log("JbPro",`mediaSourceBufferedIsZeroError auto wasm ${po(o)?" and is not meaningful Retry":""} [mse-> ${a?"wasm":"mse"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","mediaSourceBufferedIsZeroError reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceBufferedIsZeroError,t,e),this.debug.error("JbPro","mediaSourceBufferedIsZeroError reset player and play error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceBufferedIsZeroError,t,e),this.debug.error("JbPro","mediaSourceBufferedIsZeroError _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceBufferedIsZeroError,t,e),this.debug.log("JbPro","mediaSourceBufferedIsZeroError and autoWasm is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceBufferedIsZeroError,t,e),this.debug.error("JbPro","mediaSourceBufferedIsZeroError and pause error:",i)}))}})),this.player.once(ct.mseAddSourceBufferError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","mseAddSourceBufferError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.mseAddSourceBufferError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debug.log("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={useMSE:!1,useWCS:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mseAddSourceBufferError,t,e),this.debug.error("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] reset player and play error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mseAddSourceBufferError,t,e),this.debug.error("JbPro","mseAddSourceBufferError auto wasm [mse-> wasm] _resetPlayer and play error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.mseAddSourceBufferError,t,e),this.debug.log("JbPro","mseAddSourceBufferError and autoWasm is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mseAddSourceBufferError,t,e),this.debug.error("JbPro","mseAddSourceBufferError and pause error",i)}))}})),this.player.once(ct.mediaSourceDecoderConfigurationError,(e=>{if(this.isDestroyed())this.debug.log("JbPro","mediaSourceDecoderConfigurationError but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.mediaSourceDecoderConfigurationError,e)),this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debug.log("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;let s={useMSE:!1,useWCS:!1};this._resetPlayer(s).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceDecoderConfigurationError,e),this.debug.error("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceDecoderConfigurationError,e),this.debug.error("JbPro","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceDecoderConfigurationError,e),this.debug.log("JbPro","mediaSourceDecoderConfigurationError and autoWasm is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceDecoderConfigurationError,e),this.debug.error("JbPro","mediaSourceDecoderConfigurationError and pause error",t)}))}})),this.player.once(ct.mediaSourceTsIsMaxDiff,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","mediaSourceTsIsMaxDiff but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.mediaSourceTsIsMaxDiff,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mediaSourceTsIsMaxDiffReplay){this.debug.log("JbPro","mediaSourceTsIsMaxDiff reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","mediaSourceTsIsMaxDiff replay success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceTsIsMaxDiff,t,e),this.debug.error("JbPro","mediaSourceTsIsMaxDiff replay error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceTsIsMaxDiff,t,e),this.debug.error("JbPro","mediaSourceTsIsMaxDiff _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceTsIsMaxDiff,t,e),this.debug.log("JbPro","mediaSourceTsIsMaxDiff and replay is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceTsIsMaxDiff,t,e),this.debug.error("JbPro","mediaSourceTsIsMaxDiff and pause error",i)}))}})),this.player.once(ct.mseWidthOrHeightChange,(t=>{if(this.isDestroyed())return void this.debug.log("JbPro","mseWidthOrHeightChange but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.mseWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.widthOrHeightChangeReplay){this.debug.log("JbPro","mseWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.player._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.isDestroyed()?this.debug.log("JbPro","mseWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debug.log("JbPro","mseWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mseWidthOrHeightChange,i,t),this.debug.error("JbPro","mseWidthOrHeightChange and reset player and play error",e)}))}),1e3*this.player._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debug.log("JbPro","mseWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mseWidthOrHeightChange,i,t),this.debug.error("JbPro","mseWidthOrHeightChange and reset player and play error",e)}))})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mseWidthOrHeightChange,i,t),this.debug.error("JbPro","mseWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(nt.playFailedAndPaused,ct.mseWidthOrHeightChange,i,t),this.debug.error("JbPro","mseWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mseWidthOrHeightChange,i,t),this.debug.error("JbPro","mseWidthOrHeightChange error and pause error",e)}))}})),this.player.once(ct.mediaSourceAudioG711NotSupport,(t=>{if(this.isDestroyed())return void this.debug.log("JbPro","mediaSourceAudioG711NotSupport but player is destroyed");const i=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mediaSourceAudioG711NotSupportReplay){this.debug.log("JbPro","mediaSourceAudioG711NotSupport and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debug.log("JbPro","mediaSourceAudioG711NotSupport and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioG711NotSupport,i,t),this.debug.error("JbPro","mediaSourceAudioG711NotSupport and reset player and play error",e)}))})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioG711NotSupport,i,t),this.debug.error("JbPro","mediaSourceAudioG711NotSupport and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioG711NotSupport,i,t),this.debug.error("JbPro","mediaSourceAudioG711NotSupport and _resetPlayer error",e)})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioG711NotSupport,i,t),this.debug.error("JbPro","mediaSourceAudioG711NotSupport error and pause error",e)}))}})),this.player.once(ct.mediaSourceAudioInitTimeout,(t=>{if(this.isDestroyed())return void this.debug.log("JbPro","mediaSourceAudioInitTimeout but player is destroyed");const i=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mediaSourceAudioInitTimeoutReplay){this.debug.log("JbPro","mediaSourceAudioInitTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debug.log("JbPro","mediaSourceAudioInitTimeout and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioInitTimeout,i,t),this.debug.error("JbPro","mediaSourceAudioInitTimeout and reset player and play error",e)}))})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioInitTimeout,i,t),this.debug.error("JbPro","mediaSourceAudioInitTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioInitTimeout,i),this.debug.error("JbPro","mediaSourceAudioInitTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioInitTimeout,i),this.debug.error("JbPro","mediaSourceAudioInitTimeout error and pause error",e)}))}})),this.player.once(ct.mediaSourceAudioNoDataTimeout,(t=>{if(this.isDestroyed())return void this.debug.log("JbPro","mediaSourceAudioNoDataTimeout but player is destroyed");const i=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.mediaSourceAudioInitTimeoutReplay){this.debug.log("JbPro","mediaSourceAudioNoDataTimeout and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={mseDecodeAudio:!1};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(e,s).then((()=>{this.debug.log("JbPro","mediaSourceAudioNoDataTimeout and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioNoDataTimeout,i,t),this.debug.error("JbPro","mediaSourceAudioNoDataTimeout and reset player and play error",e)}))})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioNoDataTimeout,i,t),this.debug.error("JbPro","mediaSourceAudioNoDataTimeout and _resetPlayer error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioNoDataTimeout,i),this.debug.error("JbPro","mediaSourceAudioNoDataTimeout and _resetPlayer error",e)})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceAudioNoDataTimeout,i),this.debug.error("JbPro","mediaSourceAudioNoDataTimeout error and pause error",e)}))}})),this.player.once(ct.mediaSourceUseCanvasRenderPlayFailed,(e=>{if(this.isDestroyed())this.debug.log("JbPro","mediaSourceUseCanvasRenderPlayFailed but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.mediaSourceUseCanvasRenderPlayFailed,e)),this.player&&this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplay&&this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType){this.debug.log("JbPro",`mediaSourceUseCanvasRenderPlayFailed relayType is ${this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType} and reset player and play`);const t=this._opt.url,i=this._opt.playOptions;let s={};const r=this.player._opt.mediaSourceUseCanvasRenderPlayFailedReplayType;r===$?s={useMSE:!1,useWCS:!1}:r===W&&(s={useVideoRender:!0,useCanvasRender:!1}),this._resetPlayer(s).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceUseCanvasRenderPlayFailed,e),this.debug.error("JbPro","mediaSourceUseCanvasRenderPlayFailed and reset player and play error",t)}))})).catch((e=>{this.debug.error("JbPro","mediaSourceUseCanvasRenderPlayFailed auto and _resetPlayer and play error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.debug.log("JbPro","mediaSourceUseCanvasRenderPlayFailed and pause player success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.mediaSourceUseCanvasRenderPlayFailed,e),this.debug.error("JbPro","mediaSourceUseCanvasRenderPlayFailed and pause",t)}))}})),this.player.once(ct.webcodecsH265NotSupport,(e=>{if(this.isDestroyed())this.debug.log("JbPro","webcodecsH265NotSupport but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.webcodecsH265NotSupport,e)),this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debug.log("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsH265NotSupport,e),this.debug.error("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play error",t)}))})).catch((e=>{this.debug.error("JbPro","webcodecsH265NotSupport auto wasm [wcs-> wasm] _resetPlayer and play error",e)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.webcodecsH265NotSupport,e),this.debug.log("JbPro","webcodecsH265NotSupport and autoWasm is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsH265NotSupport,e),this.debug.error("JbPro","webcodecsH265NotSupport and pause error",t)}))}})),this.player.once(ct.webcodecsUnsupportedConfigurationError,(e=>{if(this.isDestroyed())this.debug.log("JbPro","webcodecsUnsupportedConfigurationError but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.webcodecsUnsupportedConfigurationError,e)),this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debug.log("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsUnsupportedConfigurationError,e),this.debug.error("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] reset player and play error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsUnsupportedConfigurationError,e),this.debug.error("JbPro","webcodecsUnsupportedConfigurationError auto wasm [wcs-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.webcodecsUnsupportedConfigurationError,e),this.debug.log("JbPro","webcodecsUnsupportedConfigurationError and autoWasm is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsUnsupportedConfigurationError,e),this.debug.error("JbPro","webcodecsUnsupportedConfigurationError and pause error",t)}))}})),this.player.once(ct.webcodecsDecodeConfigureError,(e=>{if(this.isDestroyed())this.debug.log("JbPro","webcodecsDecodeConfigureError but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.webcodecsDecodeConfigureError,e)),this.player&&this.player._opt.hardDecodingNotSupportAutoWasm){this.debug.log("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useWCS:!1}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeConfigureError,e),this.debug.error("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] reset player and play error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeConfigureError,e),this.debug.error("JbPro","webcodecsDecodeConfigureError auto wasm [wcs-> wasm] _resetPlayer and play error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeConfigureError,e),this.debug.log("JbPro","webcodecsDecodeConfigureError and autoWasm is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeConfigureError,e),this.debug.error("JbPro","webcodecsDecodeConfigureError and pause error",t)}))}})),this.player.once(ct.webcodecsDecodeError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","webcodecsDecodeError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.webcodecsDecodeError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.wcsDecodeErrorReplay){const i=this._opt.url,s=this._opt.playOptions;let r={},a=this.player._opt.decoderErrorAutoWasm,o=!0;a?r={useMSE:!1,useWCS:!1}:this._checkIsMeaningfulRetry(Lr)?this._wcsDecodeErrorRetryLog.push(aa()):(a=!0,o=!1,r={useMSE:!1,useWCS:!1}),this.debug.log("JbPro",`webcodecs decode error autoWasm ${po(o)?" and is not meaningful Retry":""} [wcs-> ${a?"wasm":"wcs"}] reset player and play`),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","webcodecs decode error reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeError,t,e),this.debug.error("JbPro","webcodecs decode error reset player and play error",i)}))})).catch((()=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeError,t,e),this.debug.error("JbPro","webcodecs decode error _resetPlayer error")}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeError,t,e),this.debug.log("JbPro","webcodecs decode error and autoWasm is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.webcodecsDecodeError,t,e),this.debug.error("JbPro","webcodecs decode error and pause error",i)}))}})),this.player.once(ct.wcsWidthOrHeightChange,(t=>{if(this.isDestroyed())return void this.debug.log("JbPro","wcsWidthOrHeightChange but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.wcsWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.widthOrHeightChangeReplay){this.debug.log("JbPro","wcsWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.isDestroyed()?this.debug.log("JbPro","wcsWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debug.log("JbPro","wcsWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wcsWidthOrHeightChange,i,t),this.debug.error("JbPro","wcsWidthOrHeightChange and reset player and play error",e)}))}),1e3*this._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debug.log("JbPro","wcsWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wcsWidthOrHeightChange,i,t),this.debug.error("JbPro","wcsWidthOrHeightChange and reset player and play error",e)}))})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wcsWidthOrHeightChange,i,t),this.debug.error("JbPro","wcsWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(nt.playFailedAndPaused,ct.wcsWidthOrHeightChange,i,t),this.debug.error("JbPro","wcsWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wcsWidthOrHeightChange,i,t),this.debug.error("JbPro","wcsWidthOrHeightChange error and pause error",e)}))}})),this.player.once(ct.wasmDecodeError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","wasmDecodeError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.wasmDecodeError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.wasmDecodeErrorReplay){this.debug.log("JbPro","wasm decode error and reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","wasm decode error and reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.wasmDecodeError,t,e),this.debug.error("JbPro","wasm decode error and reset player and play error",i)}))})).catch((()=>{this.emit(nt.playFailedAndPaused,ct.wasmDecodeError,t,e),this.debug.error("JbPro","wasm decode error and _resetPlayer error")}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.wasmDecodeError,t,e),this.debug.log("JbPro","wasm decode error and wasmDecodeErrorReplay is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.wasmDecodeError,t,e),this.debug.error("JbPro","wasm decode error and pause error",i)}))}})),this.player.once(ct.simdDecodeError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","simdDecodeError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.simdDecodeError,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.simdDecodeErrorReplay){this.debug.log("JbPro",`simdDecodeError error simdDecodeErrorReplayType is ${this.player._opt.simdDecodeErrorReplayType} and reset player and play`);const i=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.simdDecodeErrorReplayType===N&&(r={useSIMD:!1}),this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","simdDecodeError and reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.simdDecodeError,t,e),this.debug.error("JbPro","simdDecodeError and reset player and play error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.simdDecodeError,t,e),this.debug.error("JbPro","simdDecodeError and _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.simdDecodeError,t,e),this.debug.error("JbPro","simdDecodeError and simdDecodeErrorReplay is false")})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.simdDecodeError,t,e),this.debug.error("JbPro","simdDecodeError error and pause error",i)}))}})),this.player.once(ct.wasmWidthOrHeightChange,(t=>{if(this.isDestroyed())return void this.debug.log("JbPro","wasmWidthOrHeightChange but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.wasmWidthOrHeightChange,t));const i=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.widthOrHeightChangeReplay){this.debug.log("JbPro","wasmWidthOrHeightChange and reset player and play");const e=this._opt.url,s=this._opt.playOptions;let r={};this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,i,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this._opt.widthOrHeightChangeReplayDelayTime>0?this.widthOrHeightChangeReplayDelayTimeout=setTimeout((()=>{this.isDestroyed()?this.debug.log("JbPro","wasmWidthOrHeightChange and widthOrHeightChangeReplayDelayTime but player is destroyed"):this.play(e,s).then((()=>{this.debug.log("JbPro","wasmWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wasmWidthOrHeightChange,i,t),this.debug.error("JbPro","wasmWidthOrHeightChange and reset player and play error",e)}))}),1e3*this._opt.widthOrHeightChangeReplayDelayTime):this.play(e,s).then((()=>{this.debug.log("JbPro","wasmWidthOrHeightChange and reset player and play success")})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wasmWidthOrHeightChange,i,t),this.debug.error("JbPro","wasmWidthOrHeightChange and reset player and play error",e)}))})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wasmWidthOrHeightChange,i,t),this.debug.error("JbPro","wasmWidthOrHeightChange and _resetPlayer error",e)}))}else{const s=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(s).then((()=>{this.emit(nt.playFailedAndPaused,ct.wasmWidthOrHeightChange,i,t),this.debug.error("JbPro","wasmWidthOrHeightChange and _resetPlayer error",e)})).catch((e=>{this.emit(nt.playFailedAndPaused,ct.wasmWidthOrHeightChange,i),this.debug.error("JbPro","wasmWidthOrHeightChange error and pause error",e)}))}})),this.player.once(ct.wasmUseVideoRenderError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","wasmUseVideoRenderError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.wasmUseVideoRenderError,e)),this.debug.log("JbPro","wasmUseVideoRenderError and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useVideoRender:!1,useCanvasRender:!0}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","wasmUseVideoRenderError and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.wasmUseVideoRenderError,{},e),this.debug.error("JbPro","wasmUseVideoRenderError and reset player and play error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.wasmUseVideoRenderError,{},e),this.debug.error("JbPro","wasmUseVideoRenderError and _resetPlayer error",t)}))})),this.player.once(ct.videoElementPlayingFailed,(e=>{if(this.isDestroyed())this.debug.log("JbPro","videoElementPlayingFailed but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.videoElementPlayingFailed,e)),this.player&&this.player._opt.videoElementPlayingFailedReplay){this.debug.log("JbPro",`videoElementPlayingFailed and useMSE is ${this._opt.useMSE} and reset player and play`);const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useMSE:!1,useVideoRender:!1,useCanvasRender:!0}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","videoElementPlayingFailed and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.videoElementPlayingFailed,{},e),this.debug.error("JbPro","videoElementPlayingFailed and reset player and play error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.videoElementPlayingFailed,{},e),this.debug.error("JbPro","videoElementPlayingFailed and _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.videoElementPlayingFailed,{},e),this.debug.error("JbPro","videoElementPlayingFailed and videoElementPlayingFailedReplay is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.videoElementPlayingFailed,{},e),this.debug.error("JbPro","videoElementPlayingFailed and _pause error",t)}))}})),this.player.once(ct.simdH264DecodeVideoWidthIsTooLarge,(e=>{if(this.isDestroyed())this.debug.log("JbPro","simdH264DecodeVideoWidthIsTooLarge but player is destroyed");else if(this.emit(nt.crashLog,this.getCrashLog(ct.simdH264DecodeVideoWidthIsTooLarge,e)),this.player&&this.player._opt.simdH264DecodeVideoWidthIsTooLargeReplay){this.debug.log("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({useSIMD:!1}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debug.error("JbPro","simdH264DecodeVideoWidthIsTooLarge and reset player and play error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debug.error("JbPro","simdH264DecodeVideoWidthIsTooLarge and _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debug.error("JbPro","simdH264DecodeVideoWidthIsTooLarge and simdDecodeErrorReplay is false")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.simdH264DecodeVideoWidthIsTooLarge,{},e),this.debug.error("JbPro","simdH264DecodeVideoWidthIsTooLarge and pause error",t)}))}})),this.player.once(nt.networkDelayTimeout,(e=>{if(this.player._opt.networkDelayTimeoutReplay){if(this.isDestroyed())return void this.debug.log("JbPro","networkDelayTimeout but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(nt.networkDelayTimeout,e));const t=this._getVideoLastIframeInfo();this.debug.log("JbPro","network delay time out and reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player&&this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log("JbPro","wasm decode error and reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,nt.networkDelayTimeout,t,e),this.debug.error("JbPro","wasm decode error and reset player and play error",i)}))})).catch((()=>{this.emit(nt.playFailedAndPaused,nt.networkDelayTimeout,t,e),this.debug.error("JbPro","wasm decode error and _resetPlayer error")}))}})),this.player.once(nt.flvDemuxBufferSizeTooLarge,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","flvDemuxBufferSizeTooLarge but player is destroyed");const t=this._getVideoLastIframeInfo();if(this.player._opt.flvDemuxBufferSizeTooLargeReplay){this.emit(nt.crashLog,this.getCrashLog(nt.flvDemuxBufferSizeTooLarge,e)),this.debug.log("JbPro","flv Demux Buffer Size Too Large and flvDemuxBufferSizeTooLargeReplay = true and reset player and play");const i=this._opt.url,s=this._opt.playOptions;let r={};this.player&&this.player._opt.replayUseLastFrameShow&&(r=Object.assign({},r,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(r.isNotMute=!0),this._resetPlayer(r).then((()=>{this.play(i,s).then((()=>{this.debug.log(this.TAG_NAME,"flv Demux Buffer Size Too Large and reset player and play success")})).catch((i=>{this.emit(nt.playFailedAndPaused,nt.flvDemuxBufferSizeTooLarge,t,e),this.debug.error(this.TAG_NAME,"flv Demux Buffer Size Too Large and reset player and play error",i)}))})).catch((()=>{this.emit(nt.playFailedAndPaused,nt.flvDemuxBufferSizeTooLarge,t,e),this.debug.error(this.TAG_NAME,"flv Demux Buffer Size Too Large and _resetPlayer error")}))}else if(this._opt.flvDemuxBufferSizeTooLargeEmitFailed){this.debug.log(this.TAG_NAME,"flv Demux Buffer Size Too Large and flvDemuxBufferSizeTooLargeEmitFailed = true and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.flvDemuxBufferSizeTooLarge,t,e)})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.flvDemuxBufferSizeTooLarge,t,e),this.debug.error(this.TAG_NAME,"flv Demux Buffer Size Too Large",i)}))}})),this.player.once(ct.fetchError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","fetchError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.fetchError,e));const t=this._getVideoLastIframeInfo(),i=this._isNeedNetworkDisconnectReplay();if(this.player._opt.streamErrorReplay||i){i?this.debug.log("JbPro","fetch error and network is disconnect and reset player and play"):this.debug.log("JbPro",`fetch error and streamErrorReplay is true and _streamErrorReplayTimes is ${this._streamErrorReplayTimes}, streamErrorReplayDelayTime is ${this._opt.streamErrorReplayDelayTime}, next replay`);let s={};this.player._opt.replayUseLastFrameShow&&(s=Object.assign({},s,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(s.isNotMute=!0);const r=this._opt.playOptions,a=this._opt.url,o=i?1:this._opt.streamErrorReplayDelayTime;this._resetPlayer(s).then((()=>{this.streamErrorReplayDelayTimeout=setTimeout((()=>{if(this.isDestroyed())this.debug.log("JbPro","fetch error and _resetPlayer but player is destroyed and return");else{if(this.network.isOffline())return this.debug.log("JbPro","fetch error and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:a,options:r,type:ct.fetchError});this._streamErrorReplayTimes++,this.play(a,r).then((()=>{this.debug.log("JbPro","fetch error and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.fetchError,{},e),this.debug.error("JbPro","fetch error and reset player and play error",t)}))}}),1e3*o)})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.fetchError,{},e),this.debug.error("JbPro","fetch error and _resetPlayer error",t)}))}else{this.debug.log("JbPro","fetch error and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.fetchError,t,e)})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.fetchError,t,e),this.debug.error("JbPro","fetch error and pause",i)}))}})),this.player.once(nt.streamEnd,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","streamEnd but player is destroyed and return");this.emit(nt.crashLog,this.getCrashLog(nt.streamEnd,e));const t=this._getVideoLastIframeInfo(),i=this._checkIsMeaningfulRetry(Rr),s=""+e=="1006"&&this.player._opt.websocket1006ErrorReplay,r=s&&i,a=this.player._opt.streamEndReplay,o=this._isNeedNetworkDisconnectReplay();if(r||a||o){o?this.debug.log("JbPro","streamEnd and network is disconnect and reset player and play"):r?this.debug.log("JbPro",`streamEnd and websocket1006ErrorReplay is true and error is 1006 and _websocket1006ErrorReplayTimes is ${this._websocket1006ErrorReplayTimes} , delay ${this._opt.websocket1006ErrorReplayDelayTime}s reset player and play`):this.debug.log("JbPro",`streamEnd and isStreamEndReplay is true and and _streamEndReplayTimes is ${this._streamEndReplayTimes} , delay ${this._opt.streamEndReplayDelayTime}s reset player and play`);const i=this._opt.playOptions,s=this._opt.url;this._websocket1006ErrorRetryLog.push(aa());let a={};this.player._opt.replayUseLastFrameShow&&(a=Object.assign({},a,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(a.isNotMute=!0);let n=r?this._opt.websocket1006ErrorReplayDelayTime:this._opt.streamEndReplayDelayTime;o&&(n=1),this._initLoadingBackgroundForIOS(t),this._resetPlayer(a).then((()=>{this.streamEndReplayDelayTimeout=setTimeout((()=>{if(this._removeLoadingBackgroundForIOS(),this.isDestroyed())o?this.debug.log("JbPro","streamEnd and network is disconnect and _resetPlayer() but player is destroyed and return"):r?this.debug.log("JbPro","streamEnd and 1006 error and _resetPlayer() but player is destroyed and return"):this.debug.log("JbPro","streamEnd and _resetPlayer() but player is destroyed and return");else{if(this.network.isOffline())return r?this.debug.log("JbPro","streamEnd and 1006 error network is offline and wait network online to play , so return"):this.debug.log("JbPro","streamEnd and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:s,options:i,type:r?ct.websocket1006Error:ct.streamEnd});r?this._websocket1006ErrorReplayTimes++:this._streamEndReplayTimes++,this.play(s,i).then((()=>{r?this.debug.log("JbPro","streamEnd and 1006 error and reset player and play success"):this.debug.log("JbPro","streamEnd and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.streamEnd,{},e),r?this.debug.error("JbPro","streamEnd and 1006 error and reset player and play error",t):this.debug.error("JbPro","streamEnd and reset player and play error",t)}))}}),1e3*n)})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.streamEnd,{},e),r?this.debug.error("JbPro","streamEnd and 1006 and _resetPlayer error",t):this.debug.error("JbPro","streamEnd and _resetPlayer error",t)}))}else{s?this.debug.log("JbPro","streamEnd pause player "+(po(i)?"and is not meaningful retry":"")):this.debug.log("JbPro","streamEnd pause player");const r=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(r).then((()=>{this.emit(nt.playFailedAndPaused,nt.streamEnd,t,e)})).catch((i=>{this.emit(nt.playFailedAndPaused,nt.streamEnd,t,e),this.debug.error("JbPro","streamEnd pause",i)}))}})),this.player.once(ct.websocketError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","websocketError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.websocketError,e));const t=this._getVideoLastIframeInfo(),i=this._isNeedNetworkDisconnectReplay();if(this.player._opt.streamErrorReplay||i){i?this.debug.log("JbPro","websocketError error and network is disconnect and reset player and play"):this.debug.log("JbPro",`websocketError error and streamErrorReplay is true and _streamErrorReplayTimes is ${this._streamErrorReplayTimes} and streamErrorReplayDelayTime is ${this._opt.streamErrorReplayDelayTime}, next replay`);let s={};this.player._opt.replayUseLastFrameShow&&(s=Object.assign({},s,t,{loadingIcon:this.player._opt.replayShowLoadingIcon})),po(this.isMute())&&(s.isNotMute=!0);const r=this._opt.playOptions,a=this._opt.url,o=i?1:this._opt.streamErrorReplayDelayTime;this._resetPlayer(s).then((()=>{this.streamErrorReplayDelayTimeout=setTimeout((()=>{if(this.isDestroyed())i?this.debug.log("JbPro","websocketError error and network is disconnect and _resetPlayer() but player is destroyed and return"):this.debug.log("JbPro","websocketError error and _resetPlayer() but player is destroyed and return");else{if(this.network.isOffline())return this.debug.log("JbPro","websocketError error and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:a,options:r,type:ct.websocketError});this._streamErrorReplayTimes++,this.play(a,r).then((()=>{this.debug.log("JbPro","websocketError error and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.fetchError,{},e),this.debug.error("JbPro","websocketError error and reset player and play error",t)}))}}),1e3*o)})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.fetchError,{},e),this.debug.error("JbPro","websocketError error and _resetPlayer error",t)}))}else{this.debug.log("JbPro","websocketError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.websocketError,t,e)})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.websocketError,t,e),this.debug.error("JbPro","websocketError and pause",i)}))}})),this.player.once(ct.webrtcError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","webrtcError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.webrtcError,e));const t=this._getVideoLastIframeInfo();this.debug.log("JbPro","webrtcError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.webrtcError,t,e)})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.webrtcError,t,e),this.debug.error("JbPro","webrtcError and pause",i)}))})),this.player.once(ct.hlsError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","hlsError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.hlsError,e));const t=this._getVideoLastIframeInfo();this.debug.log("JbPro","hlsError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.hlsError,t,e)})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.hlsError,t,e),this.debug.error("JbPro","hlsError and pause",i)}))})),this.player.once(ct.aliyunRtcError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","aliyunRtcError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.aliyunRtcError,e));const t=this._getVideoLastIframeInfo();this.debug.log("JbPro","aliyunRtcError and pause player");const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,ct.aliyunRtcError,t,e)})).catch((i=>{this.emit(nt.playFailedAndPaused,ct.aliyunRtcError,t,e),this.debug.error("JbPro","aliyunRtcError and pause",i)}))})),this.player.once(ct.decoderWorkerInitError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","decoderWorkerInitError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.decoderWorkerInitError,e)),this.debug.log("JbPro","decoderWorkerInitError and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.decoderWorkerInitError,{},e)})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.decoderWorkerInitError,{},e),this.debug.error("JbPro","decoderWorkerInitError and pause",t)}))})),this.player.once(ct.videoElementPlayingFailedForWebrtc,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","videoElementPlayingFailedForWebrtc but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.videoElementPlayingFailedForWebrtc,e)),this.debug.log("JbPro","videoElementPlayingFailedForWebrtc and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.videoElementPlayingFailedForWebrtc,{},e)})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.videoElementPlayingFailedForWebrtc,{},e),this.debug.error("JbPro","videoElementPlayingFailedForWebrtc and pause",t)}))})),this.player.once(ct.videoInfoError,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","videoInfoError but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(ct.videoInfoError,e)),this.debug.log("JbPro","videoInfoError and pause player");const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,ct.videoInfoError,{},e)})).catch((t=>{this.emit(nt.playFailedAndPaused,ct.videoInfoError,{},e),this.debug.error("JbPro","videoInfoError and pause",t)}))})),this.player.once(nt.webrtcStreamH265,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","webrtcStreamH265 but player is destroyed");this.debug.log("JbPro","webrtcStreamH265 and reset player and play");const t=this._opt.url,i=this._opt.playOptions;this._resetPlayer({isWebrtcH265:!0}).then((()=>{this.play(t,i).then((()=>{this.debug.log("JbPro","webrtcStreamH265 and reset player and play success")})).catch((t=>{this.emit(nt.playFailedAndPaused,nt.webrtcStreamH265,{},e),this.debug.error("JbPro","webrtcStreamH265 and reset player and play error",t)}))})).catch((()=>{this.emit(nt.playFailedAndPaused,nt.webrtcStreamH265,{},e),this.debug.error("JbPro","webrtcStreamH265 and _resetPlayer error")}))})),this.player.on(nt.delayTimeout,(e=>{if(this.isDestroyed())return void this.debug.log("JbPro","delay timeout but player is destroyed");this.emit(nt.crashLog,this.getCrashLog(nt.delayTimeout,e));const t=this._getVideoLastIframeInfo();if(this.player&&this.player._opt.heartTimeoutReplay&&(this._heartTimeoutReplayTimes{if(this._isNeedNetworkDisconnectReplay())return this.debug.log("JbPro","delayTimeout and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:i,options:s,type:nt.delayTimeout});this.play(i,s).then((()=>{})).catch((i=>{this.emit(nt.playFailedAndPaused,nt.delayTimeout,t,e),this.debug.error("JbPro","delay timeout replay error",i)}))})).catch((i=>{this.emit(nt.playFailedAndPaused,nt.delayTimeout,t,e),this.debug.error("JbPro","delay timeout _resetPlayer error",i)}))}else{const i=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(i).then((()=>{this.emit(nt.playFailedAndPaused,nt.delayTimeout,t,e),this.player&&(this.emit(nt.delayTimeoutRetryEnd),this.emit(nt.playFailedAndPaused,nt.delayTimeoutRetryEnd)),this.debug.warn("JbPro",`delayTimeoutRetryEnd and\n opt.heartTimeout is ${this.player&&this.player._opt.heartTimeout} and\n opt.heartTimeoutReplay is ${this.player&&this.player._opt.heartTimeoutReplay} and\n opt.heartTimeoutReplayTimes is ${this.player&&this.player._opt.heartTimeoutReplayTimes},and\n local._heartTimeoutReplayTimes is ${this._heartTimeoutReplayTimes}`)})).catch((i=>{this.emit(nt.playFailedAndPaused,nt.delayTimeout,t,e),this.debug.error("JbPro","delay timeout and pause error",i)}))}})),this.player.on(nt.loadingTimeout,(e=>{if(this.emit(nt.crashLog,this.getCrashLog(nt.loadingTimeout,e)),this.isDestroyed())this.debug.log("JbPro","loading timeout but player is destroyed");else if(this.player&&this.player._opt.loadingTimeoutReplay&&(this._loadingTimeoutReplayTimes{if(this._isNeedNetworkDisconnectReplay())return this.debug.log("JbPro","loadingTimeout and network is offline and wait network online to play , so return"),this._isNetworkOfflinePaused=!0,void(this._isNetworkOfflinePausedAndNextPlayConfig={url:t,options:i,type:nt.loadingTimeout});this.play(t,i).then((()=>{})).catch((t=>{this.emit(nt.playFailedAndPaused,nt.loadingTimeout,{},e),this.debug.error("JbPro","loading timeout replay error",t)}))})).catch((t=>{this.emit(nt.playFailedAndPaused,nt.loadingTimeout,{},e),this.debug.error("JbPro","loading timeout _resetPlayer error",t)}))}else{const t=!1===this._opt.playFailedUseLastFrameShow;this.player.setPlayFailedAndPaused(),this._pause(t).then((()=>{this.emit(nt.playFailedAndPaused,nt.loadingTimeout,{},e),this.player&&(this.emit(nt.loadingTimeoutRetryEnd),this.emit(nt.playFailedAndPaused,nt.loadingTimeoutRetryEnd,{},e)),this.debug.log("JbPro",`loadingTimeoutRetryEnd and\n opt.loadingTimeout is ${this.player&&this.player._opt.loadingTimeout} and\n opt.loadingTimeoutReplay is ${this.player&&this.player._opt.loadingTimeoutReplay} and\n local._loadingTimeoutReplayTimes time is ${this._loadingTimeoutReplayTimes} and\n opt.loadingTimeoutReplayTimes is ${this.player&&this.player._opt.loadingTimeoutReplayTimes}`)})).catch((t=>{this.emit(nt.playFailedAndPaused,nt.loadingTimeout,{},e),this.debug.error("JbPro","loading timeout and pause error",t)}))}})),this._hasLoaded()?this.player.play(t,i).then((()=>{s()})).catch((e=>{this.debug.error("JbPro","_hasLoaded() and play error",e),this.emit(nt.crashLog,this.getCrashLog("_hasLoaded() and play error",e)),this.player&&this.player.pause().then((()=>{r(e)})).catch((e=>{r(e),this.debug.error("JbPro","_hasLoaded() and play error and next pause error",e)}))})):this.player.once(nt.decoderWorkerInit,(()=>{this.player.play(t,i).then((()=>{s()})).catch((e=>{this.debug.error("JbPro","decoderWorkerInit and play error",e),this.emit(nt.crashLog,this.getCrashLog("decoderWorkerInit and play error",e)),this.player&&this.player.pause().then((()=>{r(e)})).catch((e=>{r(e),this.debug.error("JbPro","decoderWorkerInit and play error and next pause error",e)}))}))}))},H=this.player.getOption(),V=v&&po(this._opt.supportHls265),J=m&&po(this._opt.isWebrtcH265),q=v&&!!Xa(),K=v&&H.demuxUseWorker;if(V||J||g||u||w||q||K)this.debug.log("JbPro",`need reset player and\n isOldHls is ${V} and isOldWebrtc is ${J} and\n isAliyunRtc is ${g} and\n needResetPlayer(url change) is ${u} and\n isMpeg4 is ${w} and\n isHlsCanVideoPlay is ${q} and\n isHlsButDemuxUseWorker is ${K}`),this._resetPlayer({protocol:j,demuxType:z,isHls:v,isWebrtc:m,isWebrtcForZLM:U,isWebrtcForSRS:F,isWebrtcForOthers:O,isAliyunRtc:g,cryptoKey:i.cryptoKey||"",cryptoIV:i.cryptoIV||"",url:t,playOptions:i}).then((()=>{G()})).catch((e=>{r("reset player error")}));else{const e={protocol:j,demuxType:z,isHls:v,isWebrtc:m,isAliyunRtc:g,isFlv:this._opt.isFlv,isFmp4:this._opt.isFmp4,isMpeg4:this._opt.isMpeg4,isNakedFlow:this._opt.isNakedFlow,isTs:this._opt.isTs,cryptoKey:i.cryptoKey||"",cryptoIV:i.cryptoIV||""};this._opt.isNakedFlow&&(e.mseDecodeAudio=!1),this.player.updateOption(e),i.cryptoKey&&i.cryptoIV&&this.player.decoderWorker&&(this.player.decoderWorker.updateWorkConfig({key:"cryptoKey",value:i.cryptoKey}),this.player.decoderWorker.updateWorkConfig({key:"cryptoIV",value:i.cryptoIV})),G()}}))}_resetDemuxType(e){this._opt.isFlv=!1,this._opt.isFmp4=!1,this._opt.isMpeg4=!1,this._opt.isNakedFlow=!1,this._opt.isHls=!1,this._opt.isWebrtc=!1,this._opt.isWebrtcForZLM=!1,this._opt.isWebrtcForSRS=!1,this._opt.isWebrtcForOthers=!1,this._opt.isAliyunRtc=!1,this._opt.isTs=!1,e&&(this._opt[e]=!0),"isFmp4"!==e&&(this._opt.isFmp4Private=!1)}resize(){this.debug.log("JbPro","resize()"),this.player&&this.player.resize()}setBufferTime(e){this.debug.log("JbPro",`setBufferTime() ${e}`),(e=Number(e))>10&&this.debug.warn("JbPro",`setBufferTime() buffer time is ${e} second, is too large, video will show blank screen until cache ${e} second buffer data`);const t=1e3*e;this._opt.videoBuffer=t,this.player?this.player.updateOption({videoBuffer:t},!0):this.debug.warn("JbPro","setBufferTime() player is null")}setBufferDelayTime(e){this.debug.log("JbPro",`setBufferDelayTime() ${e}`),(e=Number(e))<.2&&this.debug.warn("JbPro",`setBufferDelayTime() buffer time delay is ${e} second, is too small`);const t=1e3*(e=oa(e,.2,100));this._opt.videoBufferDelay=t,this.player?this.player.updateOption({videoBufferDelay:t},!0):this.debug.warn("JbPro","setBufferDelayTime() player is null")}setRotate(e){this.debug.log("JbPro",`setRotate() ${e}`),e=parseInt(e,10);this._opt.rotate!==e&&-1!==[0,90,180,270].indexOf(e)?(this._opt.rotate=e,this.player?(this.player.updateOption({rotate:e}),this.resize()):this.debug.warn("JbPro","setRotate() player is null")):this.debug.warn("JbPro",`setRotate() rotate is ${e} and this._opt.rotate is ${this._opt.rotate}`)}setMirrorRotate(e){this.debug.log("JbPro",`setMirrorRotate() ${e}`);e||(e="none"),this._opt.mirrorRotate!==e&&-1!==["none","level","vertical"].indexOf(e)?(this._opt.mirrorRotate=e,this.player?(this.player.updateOption({mirrorRotate:e}),this.resize()):this.debug.warn("JbPro","setMirrorRotate() player is null")):this.debug.warn("JbPro",`setMirrorRotate() mirrorRotate is ${e} and this._opt.mirrorRotate is ${this._opt.mirrorRotate}`)}setAspectRatio(e){this.debug.log("JbPro",`setAspectRatio() ${e}`);e||(e="default"),this._opt.aspectRatio!==e&&-1!==["default","4:3","16:9"].indexOf(e)?(this._opt.aspectRatio=e,this.player?(this.player.updateOption({aspectRatio:e}),this.resize()):this.debug.warn("JbPro","setAspectRatio() player is null")):this.debug.warn("JbPro",`setAspectRatio() aspectRatio is ${e} and this._opt.aspectRatio is ${this._opt.mirrorRotate}`)}hasLoaded(){return!0}_hasLoaded(){return this.player&&this.player.loaded||!1}setKeepScreenOn(){this.debug.log("JbPro","setKeepScreenOn()"),this._opt.keepScreenOn=!0,this.player?this.player.updateOption({keepScreenOn:!0}):this.debug.warn("JbPro","setKeepScreenOn() player is not ready")}setFullscreen(e){this.debug.log("JbPro",`setFullscreen() ${e}`);const t=!!e;this.player?this.player.fullscreen!==t?this.player.fullscreen=t:this.debug.warn("JbPro",`setFullscreen() fullscreen is ${t} and this.player.fullscreen is ${this.player.fullscreen}`):this.debug.warn("JbPro","setFullscreen() player is not ready")}setWebFullscreen(e){this.debug.log("JbPro",`setWebFullscreen() ${e}`);const t=!!e;this.player?this.player.webFullscreen=t:this.debug.warn("JbPro","setWebFullscreen() player is not ready")}screenshot(e,t,i,s){return this.debug.log("JbPro",`screenshot() ${e} ${t} ${i} ${s}`),this.player&&this.player.video?this.player.video.screenshot(e,t,i,s):(this.debug.warn("JbPro","screenshot() player is not ready"),null)}screenshotWatermark(e){return new Promise(((t,i)=>{this.debug.log("JbPro","screenshotWatermark()",e),this.player&&this.player.video?this.player.video.screenshotWatermark(e).then((e=>{t(e)})).catch((e=>{i(e)})):(this.debug.warn("JbPro","screenshotWatermark() player is not ready"),i("player is not ready"))}))}startRecord(e,t){return new Promise(((i,s)=>{if(this.debug.log("JbPro",`startRecord() ${e} ${t}`),!this.player)return this.debug.warn("JbPro","startRecord() player is not ready"),s("player is not ready");this.player.playing?(this.player.startRecord(e,t),i()):(this.debug.warn("JbPro","startRecord() player is not playing"),s("not playing"))}))}stopRecordAndSave(e,t){return new Promise(((i,s)=>{this.debug.log("JbPro",`stopRecordAndSave() ${e} ${t}`),this.player&&this.player.recording?this.player.stopRecordAndSave(e,t).then((e=>{i(e)})).catch((e=>{s(e)})):s("not recording")}))}isPlaying(){let e=!1;return this.player&&(e=this.player.isPlaying()),e}isLoading(){return!!this.player&&this.player.loading}isPause(){let e=!1;return this._opt.playType===b?e=!this.isPlaying()&&!this.isLoading():this._opt.playType===_&&this.player&&(e=this.player.playbackPause),e}isPaused(){return this.isPause()}isPlaybackPause(){let e=!1;return this._opt.playType===_&&this.player&&(e=this.player.playbackPause),e}isMute(){let e=!0;return this.player&&(e=this.player.isAudioMute()),e}isRecording(){return this.player&&this.player.recorder&&this.player.recorder.recording||!1}isFullscreen(){let e=!1;return this.player&&(e=this.player.fullscreen),e}isWebFullscreen(){let e=!1;return this.player&&(e=this.player.webFullscreen),e}clearBufferDelay(){this.debug.log("JbPro","clearBufferDelay()"),this.player?this.player.clearBufferDelay():this.debug.warn("JbPro","clearBufferDelay() player is not init")}setNetworkDelayTime(e){this.debug.log("JbPro",`setNetworkDelayTime() ${e}`),(e=Number(e))<1&&this.debug.warn("JbPro",`setNetworkDelayTime() network delay is ${e} second, is too small`);const t=1e3*(e=oa(e,1,100));this._opt.networkDelay=t,this.player?this.player.updateOption({networkDelay:t},!0):this.debug.warn("JbPro","setNetworkDelayTime() player is null")}getDecodeType(){let e="";return this.player&&(e=this.player.getDecodeType()),e}getRenderType(){let e="";return this.player&&(e=this.player.getRenderType()),e}getAudioEngineType(){let e="";return this.player&&(e=this.player.getAudioEngineType()),e}getPlayingTimestamp(){let e=0;return this.player&&(e=this.player.getPlayingTimestamp()),e}getStatus(){let e=bs;return this.player&&(e=this.player.loading?gs:this.player.playing?ys:As),e}getPlayType(){return this.player?this.player._opt.playType:b}togglePerformancePanel(e){this.debug.log("JbPro",`togglePerformancePanel() ${e}`);const t=this.player._opt.showPerformance;let i=!t;Pa(e)&&(i=e),i!==t?this.player?this.player.togglePerformancePanel(i):this.debug.warn("JbPro","togglePerformancePanel() failed, this.player is not init"):this.debug.warn("JbPro",`togglePerformancePanel() failed, showPerformance is prev: ${t} === now: ${i}`)}openZoom(){this.debug.log("JbPro","openZoom()"),this.player?this.player.zooming=!0:this.debug.warn("JbPro","openZoom() failed, this.player is not init")}closeZoom(){this.debug.log("JbPro","closeZoom()"),this.player?this.player.zooming=!1:this.debug.warn("JbPro","closeZoom() failed, this.player is not init")}isZoomOpen(){let e=!1;return this.player&&(e=this.player.zooming),e}toggleZoom(e){this.debug.log("JbPro",`toggleZoom() ${e}`),Pa(e)||(e=!this.isZoomOpen()),uo(e)?this.openZoom():po(!1)&&this.closeZoom()}expandZoom(){this.debug.log("JbPro","expandZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.expandPrecision():this.debug.warn("JbPro","expandZoom() failed, zoom is not open or not init")}narrowZoom(){this.debug.log("JbPro","narrowZoom()"),this.player&&this.player.zoom&&this.player.zooming?this.player.zoom.narrowPrecision():this.debug.warn("JbPro","narrowZoom failed, zoom is not open or not init")}getCurrentZoomIndex(){let e=1;return this.player&&this.player.zoom&&(e=this.player.zoom.currentZoom),e}startTalk(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(((i,s)=>{this.debug.log("JbPro","startTalk()",e,t),this._initTalk(t),this.talk.startTalk(e).then((()=>{i(),this.talk.once(nt.talkStreamClose,(()=>{this.debug.warn("JbPro","talk stream close"),this.stopTalk().catch((e=>{}))})),this.talk.once(nt.talkStreamError,(e=>{this.debug.warn("JbPro","talk stream error",e),this.stopTalk().catch((e=>{}))})),this.talk.once(nt.talkStreamInactive,(()=>{this.debug.warn("JbPro","talk stream inactive"),this.stopTalk().catch((e=>{}))}))})).catch((e=>{s(e)}))}))}stopTalk(){return new Promise(((e,t)=>{if(this.debug.log("JbPro","stopTalk()"),!this.talk)return t("stopTalk() talk is not init");this.talk.destroy(),e()}))}getTalkVolume(){return new Promise(((e,t)=>{if(!this.talk)return t("getTalkVolume() talk is not init");e(this.talk.volume)}))}setTalkVolume(e){return new Promise(((t,i)=>{if(this.debug.log("JbPro","setTalkVolume()",e),!this.talk)return i("setTalkVolume() talk is not init");this.talk.setVolume(e/100),t()}))}setNakedFlowFps(e){return new Promise(((t,i)=>{if(this.debug.log("JbPro","setNakedFlowFps()",e),La(e))return i("setNakedFlowFps() fps is empty");let s=Number(e);s=oa(s,1,100),this._opt.nakedFlowFps=s,this.player?this.player.updateOption({nakedFlowFps:s}):this.debug.warn("JbPro","setNakedFlowFps() player is null"),t()}))}getCrashLog(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!this.player)return;const i=this.player.getAllStatsData(),s=this.player;let r={url:this._opt.url,playType:s.isPlayback()?"playback":"live",demuxType:s.getDemuxType(),decoderType:s.getDecodeType(),renderType:s.getRenderType(),videoInfo:{encType:"",width:"",height:""},audioInfo:{encType:"",sampleRate:"",channels:""},audioEngine:s.getAudioEngineType(),allTimes:i.pTs,timestamp:aa(),type:e,error:so(t)||e};if(s.video){const e=s.video.videoInfo||{};r.videoInfo={encType:e.encType||"",width:e.width||"",height:e.height||""}}if(s.audio){const e=s.audio.audioInfo||{};r.audioInfo={encType:e.encType||"",sampleRate:e.sampleRate||"",channels:e.channels||""}}return r}updateDebugLevel(e){this.debug.log("JbPro","updateDebugLevel()",e),e===J||e===q?e!==this.player._opt.debugLevel?(this._opt.debugLevel=e,this.player?this.player.updateOption({debugLevel:e},!0):this.debug.warn("JbPro","updateDebugLevel() player is null")):this.debug.warn("JbPro",`updateDebugLevel() level is same, level: ${e}`):this.debug.warn("JbPro",`updateDebugLevel() level is not valid, level: ${e}`)}updateWatermark(e){this.debug.log("JbPro","updateWatermark()",e),this.player?this.player.updateWatermark(e):this.debug.warn("JbPro","updateWatermark() player is not init")}removeWatermark(){this.debug.log("JbPro","removeWatermark()"),this.player?this.player.removeWatermark():this.debug.warn("JbPro","removeWatermark() player is not init")}updateFullscreenWatermark(e){if(this.debug.log("JbPro","updateFullscreenWatermark()",e),Va(e)){this._opt.fullscreenWatermarkConfig=e;const t=Ma(this.$container,e);if(!t.watermark_txt)return void this.debug.warn("JbPro","fullscreenWatermarkConfig text is empty");this.watermark.load(t)}else this.debug.warn("JbPro",`updateFullscreenWatermark() config is not valid, config: ${e}`)}removeFullscreenWatermark(){this.debug.log("JbPro","removeFullscreenWatermark()"),this.watermark?this.watermark.remove():this.debug.warn("JbPro","removeFullscreenWatermark() watermark is not init")}faceDetectOpen(){this.debug.log("JbPro","faceDetectOpen()"),this.player?this.player.faceDetect(!0):this.debug.warn("JbPro","faceDetectOpen() player is not init")}faceDetectClose(){this.debug.log("JbPro","faceDetectClose()"),this.player?this.player.faceDetect(!1):this.debug.warn("JbPro","faceDetectClose() player is not init")}objectDetectOpen(){this.debug.log("JbPro","objectDetectOpen()"),this.player?this.player.objectDetect(!0):this.debug.warn("JbPro","objectDetectOpen() player is not init")}objectDetectClose(){this.debug.log("JbPro","objectDetectClose()"),this.player?this.player.objectDetect(!1):this.debug.warn("JbPro","objectDetectClose() player is not init")}sendWebsocketMessage(e){this.debug.log("JbPro","sendWebsocketMessage()",e),this.player?this.player.sendWebsocketMessage(e):this.debug.warn("JbPro","sendWebsocketMessage() player is not init")}addContentToCanvas(e){this.debug.log("JbPro","addContentToCanvas()"),this.player?this.player.addContentToCanvas(e):this.debug.warn("JbPro","addContentToCanvas() player is not init")}clearContentToCanvas(){this.debug.log("JbPro","clearContentToCanvas()"),this.player?this.player.addContentToCanvas([]):this.debug.warn("JbPro","clearContentToCanvas() player is not init")}addContentToContainer(e){this.debug.log("JbPro","addContentToContainer()"),this.player?this.player.addContentToContainer(e):this.debug.warn("JbPro","addContentToContainer() player is not init")}clearContentToContainer(){this.debug.log("JbPro","clearContentToContainer()"),this.player?this.player.addContentToContainer([]):this.debug.warn("JbPro","clearContentToContainer() player is not init")}setControlHtml(e){this.debug.log("JbPro","setControlHtml()",e),this.player?this.player.setControlHtml(e):this.debug.warn("JbPro","setControlHtml() player is not init")}clearControlHtml(){this.debug.log("JbPro","clearControlHtml()"),this.player?this.player.clearControlHtml():this.debug.warn("JbPro","clearControlHtml() player is not init")}getVideoInfo(){let e=null;return this.player&&(e=this.player.getVideoInfo()),e}getAudioInfo(){let e=null;return this.player&&(e=this.player.getAudioInfo()),e}setSm4CryptoKey(e){this.debug.log("JbPro","setSm4CryptoKey()",e),32===(e=""+e).length?(this._opt.sm4CryptoKey=e,this.player?this.player.updateOption({sm4CryptoKey:e},!0):this.debug.warn("JbPro","setSm4CryptoKey() player is null")):this.debug.warn("JbPro",`setSm4CryptoKey() key is invalid and length is ${e.length} !== 32`)}setM7sCryptoKey(e){this.debug.log("JbPro","setM7sCryptoKey()",e),e=""+e,this._opt.m7sCryptoKey=e,this.player?this.player.updateOption({m7sCryptoKey:e},!0):this.debug.warn("JbPro","setM7sCryptoKey() player is null")}setXorCryptoKey(e){this.debug.log("JbPro","setXorCryptoKey()",e),e=""+e,this._opt.xorCryptoKey=e,this.player?this.player.updateOption({xorCryptoKey:e},!0):this.debug.warn("JbPro","setXorCryptoKey() player is null")}updateLoadingText(e){this.debug.log("JbPro","updateLoadingText()",e),this.player?this.player.updateLoadingText(e):this.debug.warn("JbPro","updateLoadingText() player is null")}updateIsEmitSEI(e){this.debug.log("JbPro","updateIsEmitSEI()",e),this._opt.isEmitSEI=e,this.player?this.player.updateOption({isEmitSEI:e},!0):this.debug.warn("JbPro","updateIsEmitSEI() player is null")}getPTZCmd(e,t){if(this.debug.log("JbPro","getPTZCmd()",e),e)return this.player?Rv({type:e,index:0,speed:t}):void this.debug.warn("JbPro","getPTZCmd() player is null");this.debug.warn("JbPro","getPTZCmd() ptz is null")}downloadTempNakedFlowFile(){return new Promise(((e,t)=>{this.player?(this.player.downloadNakedFlowFile(),e()):t("player is not init")}))}downloadTempFmp4File(){return new Promise(((e,t)=>{this.player?(this.player.downloadFmp4File(),e()):t("player is not init")}))}downloadTempMpeg4File(){return new Promise(((e,t)=>{this.player?(this.player.downloadMpeg4File(),e()):t("player is not init")}))}downloadTempRtpFile(){return new Promise(((e,t)=>{this.talk?(this.talk.downloadRtpFile(),e()):t("talk is not init")}))}downloadMemoryLog(){this.memoryLogger&&this.memoryLogger.download()}_getVideoLastIframeInfo(){const e=this.getVideoInfo()||{},t={loadingBackground:this.screenshot("","png",.92,"base64"),loadingBackgroundWidth:e.width||0,loadingBackgroundHeight:e.height||0};return t.loadingBackground&&t.loadingBackgroundWidth&&t.loadingBackgroundHeight&&(this._tempVideoLastIframeInfo=t),this._tempVideoLastIframeInfo||{}}getExtendBtnList(){this.debug.log("JbPro","getExtendBtnList()");let e=[];return this.player?e=this.player.getExtendBtnList():this.debug.warn("JbPro","getExtendBtnList() player is null"),e}getFlvMetaData(){this.debug.log("JbPro","getFlvMetaData()");let e=null;return this.player?e=this.player.getMetaData():this.debug.warn("JbPro","getFlvMetaData() player is null"),e}updateAiFaceDetectInterval(e){this.debug.log("JbPro","updateAiFaceDetectInterval()",e);const t=1e3*(e=Number(e));this._opt.aiFaceDetectInterval=t,this.player?this.player.updateOption({aiFaceDetectInterval:t}):this.debug.warn("JbPro","updateAiFaceDetectInterval() player is null")}updateAiFaceDetectLevel(e){if(this.debug.log("JbPro","updateAiFaceDetectLevel()",e),!or[e])return void this.debug.warn("JbPro",`'updateAiFaceDetectLevel() level ${e} is invalid'`);const t=or[e];this._opt.aiFaceDetectWidth=t,this.player?(this.player.updateOption({aiFaceDetectWidth:t}),this.player.ai&&this.player.ai.updateFaceDetectorConfig({detectWidth:t})):this.debug.warn("JbPro","updateAiFaceDetectLevel() player is null")}updateAiObjectDetectInterval(e){this.debug.log("JbPro","updateAiObjectDetectInterval()",e);const t=1e3*(e=Number(e));this._opt.aiObjectDetectInterval=t,this.player?this.player.updateOption({aiObjectDetectInterval:t}):this.debug.warn("JbPro","updateAiObjectDetectInterval() player is null")}updateAiObjectDetectLevel(e){if(this.debug.log("JbPro","updateAiObjectDetectLevel()",e),!nr[e])return void this.debug.warn("JbPro",`'updateAiObjectDetectLevel() level ${e} is invalid'`);const t=nr[e];this._opt.aiObjectDetectWidth=t,this.player?(this.player.updateOption({aiObjectDetectWidth:t}),this.player.ai&&this.player.ai.updateObjectDetectorConfig({detectWidth:t})):this.debug.warn("JbPro","updateAiObjectDetectLevel() player is null")}setCryptoKeyUrl(e){this.debug.log("JbPro","setCryptoKeyUrl()",e),e&&(this._opt.cryptoKeyUrl=e)}showErrorMessageTips(e){this.debug.log("JbPro","showErrorMessageTips()",e),e&&(this.player?this.player.showTipsMessageByContent(e):this.debug.warn("JbPro","showErrorMessageTips() player is null"))}setPtzPosition(e){this.debug.log("JbPro","setPtzPosition()",e),e&&!Ha(e)&&(this.player?this.player.setPtzPosition(e):this.debug.warn("JbPro","setPtzPosition() player is null"))}hideErrorMessageTips(){this.debug.log("JbPro","hideErrorMessageTips()"),this.player?this.player.hideTipsMessage():this.debug.warn("JbPro","hideErrorMessageTips() player is null")}getContainerRect(){return this._getContainerRect()}proxy(e,t,i,s){return this.events.proxy(e,t,i,s)}_checkIsMeaningfulRetry(e){let t=!0,i=[];if(e===Rr?i=this._websocket1006ErrorRetryLog:e===Dr?i=this._mseDecodeErrorRetryLog:e===Lr&&(i=this._wcsDecodeErrorRetryLog),this.debug.log(this.TAG_NAME,`_checkIsMeaningfulRetry() type is ${e}, and retryLog is ${i.join(",")}`),i.length>=5){const s=i[0],r=i[i.length-1],a=r-s;a<=1e4&&(this.debug.warn(this.TAG_NAME,`retry type is ${e}, and retry length is ${i.length}, and start is ${s} and end is ${r} and diff is ${a}`),t=!1)}return t}_initLoadingBackgroundForIOS(e){(ya()||Aa())&&e.loadingBackground&&e.loadingBackgroundWidth&&e.loadingBackgroundHeight&&(this.debug.log(this.TAG_NAME,"_initLoadingBackgroundForIOS"),this._initLoadingBg(),"default"===this.player._opt.aspectRatio||ua()?this._doInitLoadingBackground(e):this._doInitLoadingBackgroundForRatio(e))}_doInitLoadingBackground(e){const t=this._getContainerRect();let i=t.height;const s=this.player._opt;if(s.hasControl&&!s.controlAutoHide){i-=s.playType===_?Yt:Kt}let r=t.width,a=i;const o=s.rotate;270!==o&&90!==o||(r=i,a=t.width),this.$loadingBgImage.width=r,this.$loadingBgImage.height=a,this.$loadingBgImage.src=e.loadingBackground;let n=(t.width-r)/2,l=(i-a)/2,d="contain";s.isResize||(d="fill"),s.isFullResize&&(d="none");let h="";"none"===s.mirrorRotate&&o&&(h+=" rotate("+o+"deg)"),"level"===s.mirrorRotate?h+=" rotateY(180deg)":"vertical"===s.mirrorRotate&&(h+=" rotateX(180deg)"),this._opt.videoRenderSupportScale&&(this.$loadingBgImage.style.objectFit=d),this.$loadingBgImage.style.transform=h,this.$loadingBgImage.style.padding="0",this.$loadingBgImage.style.left=n+"px",this.$loadingBgImage.style.top=l+"px",this.$loadingBgImage.complete?Ch(this.$loadingBg,"show"):this.$loadingBgImage.onload=()=>{Ch(this.$loadingBg,"show"),this.$loadingBgImage.onload=null}}_doInitLoadingBackgroundForRatio(e){const t=this.player._opt.aspectRatio.split(":").map(Number),i=this._getContainerRect();let s=i.width,r=i.height;const a=this.player._opt;let o=0;a.hasControl&&!a.controlAutoHide&&(o=a.playType===_?Yt:Kt,r-=o);const n=e.loadingBackgroundWidth,l=e.loadingBackgroundHeight,d=n/l,h=t[0]/t[1];if(this.$loadingBgImage.src=e.loadingBackground,d>h){const e=h*l/n;this.$loadingBgImage.style.width=100*e+"%",this.$loadingBgImage.style.height=`calc(100% - ${o}px)`,this.$loadingBgImage.style.padding=`0 ${(s-s*e)/2}px`}else{const e=n/h/l;this.$loadingBgImage.style.width="100%",this.$loadingBgImage.style.height=`calc(${100*e}% - ${o}px)`,this.$loadingBgImage.style.padding=(r-r*e)/2+"px 0"}this.$loadingBgImage.complete?Ch(this.$loadingBg,"show"):this.$loadingBgImage.onload=()=>{Ch(this.$loadingBg,"show"),this.$loadingBgImage.onload=null}}_initLoadingBg(){if(!this.$loadingBg){const e=document.createElement("div"),t=document.createElement("img");e.className="jb-pro-loading-bg-for-ios",this.$loadingBg=e,this.$loadingBgImage=t,e.appendChild(t),this.$container.appendChild(e)}}_removeLoadingBackgroundForIOS(){if(this.$loadingBg){this.debug.log(this.TAG_NAME,"_removeLoadingBackgroundForIOS()");if(!Lh(this.$loadingBg)){const e=this.$container.querySelector(".jb-pro-loading-bg-for-ios");e&&this.$container&&this.$container.removeChild(e)}this.$loadingBg=null,this.$loadingBgImage=null}}_getContainerRect(){let e={};return this.$container&&(e=this.$container.getBoundingClientRect(),e.width=Math.max(e.width,this.$container.clientWidth),e.height=Math.max(e.height,this.$container.clientHeight)),e}_isNeedNetworkDisconnectReplay(){return this._opt.networkDisconnectReplay&&this.network.isOffline()}}return Fv.ERROR=ct,Fv.EVENTS=lt,window.JessibucaPro=Fv,window.JbPro=Fv,window.WebPlayerPro=Fv,Fv})); diff --git a/pages_player/static/h5/js/jessibuca-pro/decoder-pro-audio.js b/pages_player/static/h5/js/jessibuca-pro/decoder-pro-audio.js new file mode 100644 index 0000000..60d69dd --- /dev/null +++ b/pages_player/static/h5/js/jessibuca-pro/decoder-pro-audio.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("crypto")):"function"==typeof define&&define.amd?define(["crypto"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).crypto$1)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r,n=t(e),s=(r="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-audio.js",document.baseURI).href,function(e){var t,i;(e=void 0!==(e=e||{})?e:{}).ready=new Promise((function(e,r){t=e,i=r})),(e=void 0!==e?e:{}).locateFile=function(e){return"decoder-pro-audio.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_AUDIO_WASM_URL&&""!=JESSIBUCA_PRO_AUDIO_WASM_URL?JESSIBUCA_PRO_AUDIO_WASM_URL:e};var n,s,a,o,d,l,c=Object.assign({},e),u="./this.program",h="object"==typeof window,f="function"==typeof importScripts,p="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,_="";p?(_=f?require("path").dirname(_)+"/":__dirname+"/",l=()=>{d||(o=require("fs"),d=require("path"))},n=function(e,t){return l(),e=d.normalize(e),o.readFileSync(e,t?void 0:"utf8")},a=e=>{var t=n(e,!0);return t.buffer||(t=new Uint8Array(t)),t},s=(e,t,r)=>{l(),e=d.normalize(e),o.readFile(e,(function(e,i){e?r(e):t(i.buffer)}))},process.argv.length>1&&(u=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(e){if(!(e instanceof J))throw e})),process.on("unhandledRejection",(function(e){throw e})),e.inspect=function(){return"[Emscripten Module object]"}):(h||f)&&(f?_=self.location.href:"undefined"!=typeof document&&document.currentScript&&(_=document.currentScript.src),r&&(_=r),_=0!==_.indexOf("blob:")?_.substr(0,_.replace(/[?#].*/,"").lastIndexOf("/")+1):"",n=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},f&&(a=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),s=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var m,g,y=e.print||console.log.bind(console),v=e.printErr||console.warn.bind(console);Object.assign(e,c),c=null,e.arguments&&e.arguments,e.thisProgram&&(u=e.thisProgram),e.quit&&e.quit,e.wasmBinary&&(m=e.wasmBinary),e.noExitRuntime,"object"!=typeof WebAssembly&&Y("no native wasm support detected");var b=!1;function w(e,t){e||Y(t)}var S,E,A,B,x,U,T,k,C,D,I="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function F(e,t,r){for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&I)return I.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&a)<<6|o)}else s+=String.fromCharCode(a)}return s}function P(e,t){return e?F(A,e,t):""}function L(e,t,r,i){if(!(i>0))return 0;for(var n=r,s=r+i-1,a=0;a=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),o<=127){if(r>=s)break;t[r++]=o}else if(o<=2047){if(r+1>=s)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=s)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=s)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-n}function M(e){for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t}e.INITIAL_MEMORY;var R,z,N,O,G=[],H=[],$=[],V=0,W=null;function j(t){V++,e.monitorRunDependencies&&e.monitorRunDependencies(V)}function q(t){if(V--,e.monitorRunDependencies&&e.monitorRunDependencies(V),0==V&&W){var r=W;W=null,r()}}function Y(t){e.onAbort&&e.onAbort(t),v(t="Aborted("+t+")"),b=!0,t+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(t);throw i(r),r}function K(e){return e.startsWith("data:application/octet-stream;base64,")}function X(e){return e.startsWith("file://")}function Z(e){try{if(e==R&&m)return new Uint8Array(m);if(a)return a(e);throw"both async and sync fetching of the wasm failed"}catch(e){Y(e)}}function J(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Q(t){for(;t.length>0;)t.shift()(e)}function ee(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){T[this.ptr+4>>2]=e},this.get_type=function(){return T[this.ptr+4>>2]},this.set_destructor=function(e){T[this.ptr+8>>2]=e},this.get_destructor=function(){return T[this.ptr+8>>2]},this.set_refcount=function(e){U[this.ptr>>2]=e},this.set_caught=function(e){e=e?1:0,E[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=E[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,E[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=E[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var e=U[this.ptr>>2];U[this.ptr>>2]=e+1},this.release_ref=function(){var e=U[this.ptr>>2];return U[this.ptr>>2]=e-1,1===e},this.set_adjusted_ptr=function(e){T[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return T[this.ptr+16>>2]},this.get_exception_ptr=function(){if(jt(this.get_type()))return T[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}e.locateFile?K(R="decoder-pro-audio.wasm")||(z=R,R=e.locateFile?e.locateFile(z,_):_+z):R=new URL("decoder-pro-audio.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-audio.js",document.baseURI).href).toString();var te={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=te.isAbs(e),r="/"===e.substr(-1);return(e=te.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=te.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=te.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments,0);return te.normalize(e.join("/"))},join2:(e,t)=>te.normalize(e+"/"+t)},re={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:oe.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=te.isAbs(i)}return(t?"/":"")+(e=te.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=re.resolve(e).substr(1),t=re.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),s=Math.min(i.length,n.length),a=s,o=0;o0?r:M(e)+1,n=new Array(i),s=L(e,n,0,n.length);return t&&(n.length=s),n}var ne={ttys:[],init:function(){},shutdown:function(){},register:function(e,t){ne.ttys[e]={input:[],output:[],ops:t},oe.registerDevice(e,ne.stream_ops)},stream_ops:{open:function(e){var t=ne.ttys[e.node.rdev];if(!t)throw new oe.ErrnoError(43);e.tty=t,e.seekable=!1},close:function(e){e.tty.ops.flush(e.tty)},flush:function(e){e.tty.ops.flush(e.tty)},read:function(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new oe.ErrnoError(60);for(var s=0,a=0;a0?r.slice(0,i).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(t=window.prompt("Input: "))&&(t+="\n"):"function"==typeof readline&&null!==(t=readline())&&(t+="\n");if(!t)return null;e.input=ie(t,!0)}return e.input.shift()},put_char:function(e,t){null===t||10===t?(y(F(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(y(F(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,t){null===t||10===t?(v(F(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(v(F(e.output,0)),e.output=[])}}};function se(e){e=function(e,t){return Math.ceil(e/t)*t}(e,65536);var t=Wt(65536,e);return t?(function(e,t){A.fill(0,e,e+t)}(t,e),t):0}var ae={ops_table:null,mount:function(e){return ae.createNode(null,"/",16895,0)},createNode:function(e,t,r,i){if(oe.isBlkdev(r)||oe.isFIFO(r))throw new oe.ErrnoError(63);ae.ops_table||(ae.ops_table={dir:{node:{getattr:ae.node_ops.getattr,setattr:ae.node_ops.setattr,lookup:ae.node_ops.lookup,mknod:ae.node_ops.mknod,rename:ae.node_ops.rename,unlink:ae.node_ops.unlink,rmdir:ae.node_ops.rmdir,readdir:ae.node_ops.readdir,symlink:ae.node_ops.symlink},stream:{llseek:ae.stream_ops.llseek}},file:{node:{getattr:ae.node_ops.getattr,setattr:ae.node_ops.setattr},stream:{llseek:ae.stream_ops.llseek,read:ae.stream_ops.read,write:ae.stream_ops.write,allocate:ae.stream_ops.allocate,mmap:ae.stream_ops.mmap,msync:ae.stream_ops.msync}},link:{node:{getattr:ae.node_ops.getattr,setattr:ae.node_ops.setattr,readlink:ae.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ae.node_ops.getattr,setattr:ae.node_ops.setattr},stream:oe.chrdev_stream_ops}});var n=oe.createNode(e,t,r,i);return oe.isDir(n.mode)?(n.node_ops=ae.ops_table.dir.node,n.stream_ops=ae.ops_table.dir.stream,n.contents={}):oe.isFile(n.mode)?(n.node_ops=ae.ops_table.file.node,n.stream_ops=ae.ops_table.file.stream,n.usedBytes=0,n.contents=null):oe.isLink(n.mode)?(n.node_ops=ae.ops_table.link.node,n.stream_ops=ae.ops_table.link.stream):oe.isChrdev(n.mode)&&(n.node_ops=ae.ops_table.chrdev.node,n.stream_ops=ae.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage:function(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr:function(e){var t={};return t.dev=oe.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,oe.isDir(e.mode)?t.size=4096:oe.isFile(e.mode)?t.size=e.usedBytes:oe.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr:function(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&ae.resizeFileStorage(e,t.size)},lookup:function(e,t){throw oe.genericErrors[44]},mknod:function(e,t,r,i){return ae.createNode(e,t,r,i)},rename:function(e,t,r){if(oe.isDir(e.mode)){var i;try{i=oe.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new oe.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink:function(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir:function(e,t){var r=oe.lookupNode(e,t);for(var i in r.contents)throw new oe.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir:function(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink:function(e,t,r){var i=ae.createNode(e,t,41471,0);return i.link=r,i},readlink:function(e){if(!oe.isLink(e.mode))throw new oe.ErrnoError(28);return e.link}},stream_ops:{read:function(e,t,r,i,n){var s=e.node.contents;if(n>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-n,i);if(a>8&&s.subarray)t.set(s.subarray(n,n+a),r);else for(var o=0;o0||r+t1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=re.resolve(oe.cwd(),e)))return{path:"",node:null};var r={follow_mount:!0,recurse_count:0};if(t=Object.assign(r,t),t.recurse_count>8)throw new oe.ErrnoError(32);for(var i=te.normalizeArray(e.split("/").filter((e=>!!e)),!1),n=oe.root,s="/",a=0;a40)throw new oe.ErrnoError(32)}}return{path:s,node:n}},getPath:e=>{for(var t;;){if(oe.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?r+"/"+t:r+t:r}t=t?e.name+"/"+t:e.name,e=e.parent}},hashName:(e,t)=>{for(var r=0,i=0;i>>0)%oe.nameTable.length},hashAddNode:e=>{var t=oe.hashName(e.parent.id,e.name);e.name_next=oe.nameTable[t],oe.nameTable[t]=e},hashRemoveNode:e=>{var t=oe.hashName(e.parent.id,e.name);if(oe.nameTable[t]===e)oe.nameTable[t]=e.name_next;else for(var r=oe.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode:(e,t)=>{var r=oe.mayLookup(e);if(r)throw new oe.ErrnoError(r,e);for(var i=oe.hashName(e.id,t),n=oe.nameTable[i];n;n=n.name_next){var s=n.name;if(n.parent.id===e.id&&s===t)return n}return oe.lookup(e,t)},createNode:(e,t,r,i)=>{var n=new oe.FSNode(e,t,r,i);return oe.hashAddNode(n),n},destroyNode:e=>{oe.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:e=>{var t=oe.flagModes[e];if(void 0===t)throw new Error("Unknown file open mode: "+e);return t},flagsToPermissionString:e=>{var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>oe.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup:e=>{var t=oe.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate:(e,t)=>{try{return oe.lookupNode(e,t),20}catch(e){}return oe.nodePermissions(e,"wx")},mayDelete:(e,t,r)=>{var i;try{i=oe.lookupNode(e,t)}catch(e){return e.errno}var n=oe.nodePermissions(e,"wx");if(n)return n;if(r){if(!oe.isDir(i.mode))return 54;if(oe.isRoot(i)||oe.getPath(i)===oe.cwd())return 10}else if(oe.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?oe.isLink(e.mode)?32:oe.isDir(e.mode)&&("r"!==oe.flagsToPermissionString(t)||512&t)?31:oe.nodePermissions(e,oe.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oe.MAX_OPEN_FDS;for(var r=e;r<=t;r++)if(!oe.streams[r])return r;throw new oe.ErrnoError(33)},getStream:e=>oe.streams[e],createStream:(e,t,r)=>{oe.FSStream||(oe.FSStream=function(){this.shared={}},oe.FSStream.prototype={},Object.defineProperties(oe.FSStream.prototype,{object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}},flags:{get:function(){return this.shared.flags},set:function(e){this.shared.flags=e}},position:{get:function(){return this.shared.position},set:function(e){this.shared.position=e}}})),e=Object.assign(new oe.FSStream,e);var i=oe.nextfd(t,r);return e.fd=i,oe.streams[i]=e,e},closeStream:e=>{oe.streams[e]=null},chrdev_stream_ops:{open:e=>{var t=oe.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:()=>{throw new oe.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice:(e,t)=>{oe.devices[e]={stream_ops:t}},getDevice:e=>oe.devices[e],getMounts:e=>{for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs:(e,t)=>{"function"==typeof e&&(t=e,e=!1),oe.syncFSRequests++,oe.syncFSRequests>1&&v("warning: "+oe.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var r=oe.getMounts(oe.root.mount),i=0;function n(e){return oe.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount:(e,t,r)=>{var i,n="/"===r,s=!r;if(n&&oe.root)throw new oe.ErrnoError(10);if(!n&&!s){var a=oe.lookupPath(r,{follow_mount:!1});if(r=a.path,i=a.node,oe.isMountpoint(i))throw new oe.ErrnoError(10);if(!oe.isDir(i.mode))throw new oe.ErrnoError(54)}var o={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(o);return d.mount=o,o.root=d,n?oe.root=d:i&&(i.mounted=o,i.mount&&i.mount.mounts.push(o)),d},unmount:e=>{var t=oe.lookupPath(e,{follow_mount:!1});if(!oe.isMountpoint(t.node))throw new oe.ErrnoError(28);var r=t.node,i=r.mounted,n=oe.getMounts(i);Object.keys(oe.nameTable).forEach((e=>{for(var t=oe.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&oe.destroyNode(t),t=r}})),r.mounted=null;var s=r.mount.mounts.indexOf(i);r.mount.mounts.splice(s,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod:(e,t,r)=>{var i=oe.lookupPath(e,{parent:!0}).node,n=te.basename(e);if(!n||"."===n||".."===n)throw new oe.ErrnoError(28);var s=oe.mayCreate(i,n);if(s)throw new oe.ErrnoError(s);if(!i.node_ops.mknod)throw new oe.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,oe.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,oe.mknod(e,t,0)),mkdirTree:(e,t)=>{for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,oe.mknod(e,t,r)),symlink:(e,t)=>{if(!re.resolve(e))throw new oe.ErrnoError(44);var r=oe.lookupPath(t,{parent:!0}).node;if(!r)throw new oe.ErrnoError(44);var i=te.basename(t),n=oe.mayCreate(r,i);if(n)throw new oe.ErrnoError(n);if(!r.node_ops.symlink)throw new oe.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename:(e,t)=>{var r,i,n=te.dirname(e),s=te.dirname(t),a=te.basename(e),o=te.basename(t);if(r=oe.lookupPath(e,{parent:!0}).node,i=oe.lookupPath(t,{parent:!0}).node,!r||!i)throw new oe.ErrnoError(44);if(r.mount!==i.mount)throw new oe.ErrnoError(75);var d,l=oe.lookupNode(r,a),c=re.relative(e,s);if("."!==c.charAt(0))throw new oe.ErrnoError(28);if("."!==(c=re.relative(t,n)).charAt(0))throw new oe.ErrnoError(55);try{d=oe.lookupNode(i,o)}catch(e){}if(l!==d){var u=oe.isDir(l.mode),h=oe.mayDelete(r,a,u);if(h)throw new oe.ErrnoError(h);if(h=d?oe.mayDelete(i,o,u):oe.mayCreate(i,o))throw new oe.ErrnoError(h);if(!r.node_ops.rename)throw new oe.ErrnoError(63);if(oe.isMountpoint(l)||d&&oe.isMountpoint(d))throw new oe.ErrnoError(10);if(i!==r&&(h=oe.nodePermissions(r,"w")))throw new oe.ErrnoError(h);oe.hashRemoveNode(l);try{r.node_ops.rename(l,i,o)}catch(e){throw e}finally{oe.hashAddNode(l)}}},rmdir:e=>{var t=oe.lookupPath(e,{parent:!0}).node,r=te.basename(e),i=oe.lookupNode(t,r),n=oe.mayDelete(t,r,!0);if(n)throw new oe.ErrnoError(n);if(!t.node_ops.rmdir)throw new oe.ErrnoError(63);if(oe.isMountpoint(i))throw new oe.ErrnoError(10);t.node_ops.rmdir(t,r),oe.destroyNode(i)},readdir:e=>{var t=oe.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new oe.ErrnoError(54);return t.node_ops.readdir(t)},unlink:e=>{var t=oe.lookupPath(e,{parent:!0}).node;if(!t)throw new oe.ErrnoError(44);var r=te.basename(e),i=oe.lookupNode(t,r),n=oe.mayDelete(t,r,!1);if(n)throw new oe.ErrnoError(n);if(!t.node_ops.unlink)throw new oe.ErrnoError(63);if(oe.isMountpoint(i))throw new oe.ErrnoError(10);t.node_ops.unlink(t,r),oe.destroyNode(i)},readlink:e=>{var t=oe.lookupPath(e).node;if(!t)throw new oe.ErrnoError(44);if(!t.node_ops.readlink)throw new oe.ErrnoError(28);return re.resolve(oe.getPath(t.parent),t.node_ops.readlink(t))},stat:(e,t)=>{var r=oe.lookupPath(e,{follow:!t}).node;if(!r)throw new oe.ErrnoError(44);if(!r.node_ops.getattr)throw new oe.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>oe.stat(e,!0),chmod:(e,t,r)=>{var i;if(!(i="string"==typeof e?oe.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new oe.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod:(e,t)=>{oe.chmod(e,t,!0)},fchmod:(e,t)=>{var r=oe.getStream(e);if(!r)throw new oe.ErrnoError(8);oe.chmod(r.node,t)},chown:(e,t,r,i)=>{var n;if(!(n="string"==typeof e?oe.lookupPath(e,{follow:!i}).node:e).node_ops.setattr)throw new oe.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown:(e,t,r)=>{oe.chown(e,t,r,!0)},fchown:(e,t,r)=>{var i=oe.getStream(e);if(!i)throw new oe.ErrnoError(8);oe.chown(i.node,t,r)},truncate:(e,t)=>{if(t<0)throw new oe.ErrnoError(28);var r;if(!(r="string"==typeof e?oe.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new oe.ErrnoError(63);if(oe.isDir(r.mode))throw new oe.ErrnoError(31);if(!oe.isFile(r.mode))throw new oe.ErrnoError(28);var i=oe.nodePermissions(r,"w");if(i)throw new oe.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate:(e,t)=>{var r=oe.getStream(e);if(!r)throw new oe.ErrnoError(8);if(0==(2097155&r.flags))throw new oe.ErrnoError(28);oe.truncate(r.node,t)},utime:(e,t,r)=>{var i=oe.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open:(t,r,i)=>{if(""===t)throw new oe.ErrnoError(44);var n;if(i=void 0===i?438:i,i=64&(r="string"==typeof r?oe.modeStringToFlags(r):r)?4095&i|32768:0,"object"==typeof t)n=t;else{t=te.normalize(t);try{n=oe.lookupPath(t,{follow:!(131072&r)}).node}catch(e){}}var s=!1;if(64&r)if(n){if(128&r)throw new oe.ErrnoError(20)}else n=oe.mknod(t,i,0),s=!0;if(!n)throw new oe.ErrnoError(44);if(oe.isChrdev(n.mode)&&(r&=-513),65536&r&&!oe.isDir(n.mode))throw new oe.ErrnoError(54);if(!s){var a=oe.mayOpen(n,r);if(a)throw new oe.ErrnoError(a)}512&r&&!s&&oe.truncate(n,0),r&=-131713;var o=oe.createStream({node:n,path:oe.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return o.stream_ops.open&&o.stream_ops.open(o),!e.logReadFiles||1&r||(oe.readFiles||(oe.readFiles={}),t in oe.readFiles||(oe.readFiles[t]=1)),o},close:e=>{if(oe.isClosed(e))throw new oe.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{oe.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek:(e,t,r)=>{if(oe.isClosed(e))throw new oe.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new oe.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new oe.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read:(e,t,r,i,n)=>{if(i<0||n<0)throw new oe.ErrnoError(28);if(oe.isClosed(e))throw new oe.ErrnoError(8);if(1==(2097155&e.flags))throw new oe.ErrnoError(8);if(oe.isDir(e.node.mode))throw new oe.ErrnoError(31);if(!e.stream_ops.read)throw new oe.ErrnoError(28);var s=void 0!==n;if(s){if(!e.seekable)throw new oe.ErrnoError(70)}else n=e.position;var a=e.stream_ops.read(e,t,r,i,n);return s||(e.position+=a),a},write:(e,t,r,i,n,s)=>{if(i<0||n<0)throw new oe.ErrnoError(28);if(oe.isClosed(e))throw new oe.ErrnoError(8);if(0==(2097155&e.flags))throw new oe.ErrnoError(8);if(oe.isDir(e.node.mode))throw new oe.ErrnoError(31);if(!e.stream_ops.write)throw new oe.ErrnoError(28);e.seekable&&1024&e.flags&&oe.llseek(e,0,2);var a=void 0!==n;if(a){if(!e.seekable)throw new oe.ErrnoError(70)}else n=e.position;var o=e.stream_ops.write(e,t,r,i,n,s);return a||(e.position+=o),o},allocate:(e,t,r)=>{if(oe.isClosed(e))throw new oe.ErrnoError(8);if(t<0||r<=0)throw new oe.ErrnoError(28);if(0==(2097155&e.flags))throw new oe.ErrnoError(8);if(!oe.isFile(e.node.mode)&&!oe.isDir(e.node.mode))throw new oe.ErrnoError(43);if(!e.stream_ops.allocate)throw new oe.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap:(e,t,r,i,n)=>{if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new oe.ErrnoError(2);if(1==(2097155&e.flags))throw new oe.ErrnoError(2);if(!e.stream_ops.mmap)throw new oe.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e&&e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl:(e,t,r)=>{if(!e.stream_ops.ioctl)throw new oe.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error('Invalid encoding type "'+t.encoding+'"');var r,i=oe.open(e,t.flags),n=oe.stat(e),s=n.size,a=new Uint8Array(s);return oe.read(i,a,0,s,0),"utf8"===t.encoding?r=F(a,0):"binary"===t.encoding&&(r=a),oe.close(i),r},writeFile:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=oe.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(M(t)+1),s=L(t,n,0,n.length);oe.write(i,n,0,s,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");oe.write(i,t,0,t.byteLength,void 0,r.canOwn)}oe.close(i)},cwd:()=>oe.currentPath,chdir:e=>{var t=oe.lookupPath(e,{follow:!0});if(null===t.node)throw new oe.ErrnoError(44);if(!oe.isDir(t.node.mode))throw new oe.ErrnoError(54);var r=oe.nodePermissions(t.node,"x");if(r)throw new oe.ErrnoError(r);oe.currentPath=t.path},createDefaultDirectories:()=>{oe.mkdir("/tmp"),oe.mkdir("/home"),oe.mkdir("/home/web_user")},createDefaultDevices:()=>{oe.mkdir("/dev"),oe.registerDevice(oe.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),oe.mkdev("/dev/null",oe.makedev(1,3)),ne.register(oe.makedev(5,0),ne.default_tty_ops),ne.register(oe.makedev(6,0),ne.default_tty1_ops),oe.mkdev("/dev/tty",oe.makedev(5,0)),oe.mkdev("/dev/tty1",oe.makedev(6,0));var e=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var e=new Uint8Array(1);return()=>(crypto.getRandomValues(e),e[0])}if(p)try{var t=require("crypto");return()=>t.randomBytes(1)[0]}catch(e){}return()=>Y("randomDevice")}();oe.createDevice("/dev","random",e),oe.createDevice("/dev","urandom",e),oe.mkdir("/dev/shm"),oe.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{oe.mkdir("/proc");var e=oe.mkdir("/proc/self");oe.mkdir("/proc/self/fd"),oe.mount({mount:()=>{var t=oe.createNode(e,"fd",16895,73);return t.node_ops={lookup:(e,t)=>{var r=+t,i=oe.getStream(r);if(!i)throw new oe.ErrnoError(8);var n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams:()=>{e.stdin?oe.createDevice("/dev","stdin",e.stdin):oe.symlink("/dev/tty","/dev/stdin"),e.stdout?oe.createDevice("/dev","stdout",null,e.stdout):oe.symlink("/dev/tty","/dev/stdout"),e.stderr?oe.createDevice("/dev","stderr",null,e.stderr):oe.symlink("/dev/tty1","/dev/stderr"),oe.open("/dev/stdin",0),oe.open("/dev/stdout",1),oe.open("/dev/stderr",1)},ensureErrnoError:()=>{oe.ErrnoError||(oe.ErrnoError=function(e,t){this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},oe.ErrnoError.prototype=new Error,oe.ErrnoError.prototype.constructor=oe.ErrnoError,[44].forEach((e=>{oe.genericErrors[e]=new oe.ErrnoError(e),oe.genericErrors[e].stack=""})))},staticInit:()=>{oe.ensureErrnoError(),oe.nameTable=new Array(4096),oe.mount(ae,{},"/"),oe.createDefaultDirectories(),oe.createDefaultDevices(),oe.createSpecialDirectories(),oe.filesystems={MEMFS:ae}},init:(t,r,i)=>{oe.init.initialized=!0,oe.ensureErrnoError(),e.stdin=t||e.stdin,e.stdout=r||e.stdout,e.stderr=i||e.stderr,oe.createStandardStreams()},quit:()=>{oe.init.initialized=!1;for(var e=0;e{var r=0;return e&&(r|=365),t&&(r|=146),r},findObject:(e,t)=>{var r=oe.analyzePath(e,t);return r.exists?r.object:null},analyzePath:(e,t)=>{try{e=(i=oe.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var i=oe.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=i.path,r.parentObject=i.node,r.name=te.basename(e),i=oe.lookupPath(e,{follow:!t}),r.exists=!0,r.path=i.path,r.object=i.node,r.name=i.node.name,r.isRoot="/"===i.path}catch(e){r.error=e.errno}return r},createPath:(e,t,r,i)=>{e="string"==typeof e?e:oe.getPath(e);for(var n=t.split("/").reverse();n.length;){var s=n.pop();if(s){var a=te.join2(e,s);try{oe.mkdir(a)}catch(e){}e=a}}return a},createFile:(e,t,r,i,n)=>{var s=te.join2("string"==typeof e?e:oe.getPath(e),t),a=oe.getMode(i,n);return oe.create(s,a)},createDataFile:(e,t,r,i,n,s)=>{var a=t;e&&(e="string"==typeof e?e:oe.getPath(e),a=t?te.join2(e,t):e);var o=oe.getMode(i,n),d=oe.create(a,o);if(r){if("string"==typeof r){for(var l=new Array(r.length),c=0,u=r.length;c{var n=te.join2("string"==typeof e?e:oe.getPath(e),t),s=oe.getMode(!!r,!!i);oe.createDevice.major||(oe.createDevice.major=64);var a=oe.makedev(oe.createDevice.major++,0);return oe.registerDevice(a,{open:e=>{e.seekable=!1},close:e=>{i&&i.buffer&&i.buffer.length&&i(10)},read:(e,t,i,n,s)=>{for(var a=0,o=0;o{for(var a=0;a{if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!n)throw new Error("Cannot load without read() or XMLHttpRequest.");try{e.contents=ie(n(e.url),!0),e.usedBytes=e.contents.length}catch(e){throw new oe.ErrnoError(29)}},createLazyFile:(e,t,r,i,n)=>{function s(){this.lengthKnown=!1,this.chunks=[]}if(s.prototype.get=function(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;n||(a=i);var o=this;o.setDataGetter((e=>{var t=e*a,n=(e+1)*a-1;if(n=Math.min(n,i-1),void 0===o.chunks[e]&&(o.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==a&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ie(n.responseText||"",!0)})(t,n)),void 0===o.chunks[e])throw new Error("doXHR failed!");return o.chunks[e]})),!s&&i||(a=i=1,i=this.getter(0).length,a=i,y("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!f)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new s;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var o={isDevice:!1,contents:a}}else o={isDevice:!1,url:r};var d=oe.createFile(e,t,o,i,n);o.contents?d.contents=o.contents:o.url&&(d.contents=null,d.url=o.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,n){var s=e.node.contents;if(n>=s.length)return 0;var a=Math.min(s.length-n,i);if(s.slice)for(var o=0;o{var t=d.stream_ops[e];l[e]=function(){return oe.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>(oe.forceLoadFile(d),c(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{oe.forceLoadFile(d);var s=se(t);if(!s)throw new oe.ErrnoError(48);return c(e,E,s,t,r),{ptr:s,allocated:!0}},d.stream_ops=l,d},createPreloadedFile:(e,t,r,i,n,a,o,d,l,c)=>{var u=t?re.resolve(te.join2(e,t)):e;function h(r){function s(r){c&&c(),d||oe.createDataFile(e,t,r,i,n,l),a&&a(),q()}Browser.handledByPreloadPlugin(r,u,s,(()=>{o&&o(),q()}))||s(r)}j(),"string"==typeof r?function(e,t,r,i){var n=i?"":"al "+e;s(e,(r=>{w(r,'Loading data file "'+e+'" failed (no arrayBuffer).'),t(new Uint8Array(r)),n&&q()}),(t=>{if(!r)throw'Loading data file "'+e+'" failed.';r()})),n&&j()}(r,(e=>h(e)),o):h(r)},indexedDB:()=>window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,DB_NAME:()=>"EM_FS_"+window.location.pathname,DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(e,t,r)=>{t=t||(()=>{}),r=r||(()=>{});var i=oe.indexedDB();try{var n=i.open(oe.DB_NAME(),oe.DB_VERSION)}catch(e){return r(e)}n.onupgradeneeded=()=>{y("creating db"),n.result.createObjectStore(oe.DB_STORE_NAME)},n.onsuccess=()=>{var i=n.result.transaction([oe.DB_STORE_NAME],"readwrite"),s=i.objectStore(oe.DB_STORE_NAME),a=0,o=0,d=e.length;function l(){0==o?t():r()}e.forEach((e=>{var t=s.put(oe.analyzePath(e).object.contents,e);t.onsuccess=()=>{++a+o==d&&l()},t.onerror=()=>{o++,a+o==d&&l()}})),i.onerror=r},n.onerror=r},loadFilesFromDB:(e,t,r)=>{t=t||(()=>{}),r=r||(()=>{});var i=oe.indexedDB();try{var n=i.open(oe.DB_NAME(),oe.DB_VERSION)}catch(e){return r(e)}n.onupgradeneeded=r,n.onsuccess=()=>{var i=n.result;try{var s=i.transaction([oe.DB_STORE_NAME],"readonly")}catch(e){return void r(e)}var a=s.objectStore(oe.DB_STORE_NAME),o=0,d=0,l=e.length;function c(){0==d?t():r()}e.forEach((e=>{var t=a.get(e);t.onsuccess=()=>{oe.analyzePath(e).exists&&oe.unlink(e),oe.createDataFile(te.dirname(e),te.basename(e),t.result,!0,!0,!0),++o+d==l&&c()},t.onerror=()=>{d++,o+d==l&&c()}})),s.onerror=r},n.onerror=r}},de={DEFAULT_POLLMASK:5,calculateAt:function(e,t,r){if(te.isAbs(t))return t;var i;if(-100===e)i=oe.cwd();else{var n=oe.getStream(e);if(!n)throw new oe.ErrnoError(8);i=n.path}if(0==t.length){if(!r)throw new oe.ErrnoError(44);return i}return te.join2(i,t)},doStat:function(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&te.normalize(t)!==te.normalize(oe.getPath(e.node)))return-54;throw e}return U[r>>2]=i.dev,U[r+4>>2]=0,U[r+8>>2]=i.ino,U[r+12>>2]=i.mode,U[r+16>>2]=i.nlink,U[r+20>>2]=i.uid,U[r+24>>2]=i.gid,U[r+28>>2]=i.rdev,U[r+32>>2]=0,O=[i.size>>>0,(N=i.size,+Math.abs(N)>=1?N>0?(0|Math.min(+Math.floor(N/4294967296),4294967295))>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[r+40>>2]=O[0],U[r+44>>2]=O[1],U[r+48>>2]=4096,U[r+52>>2]=i.blocks,O=[Math.floor(i.atime.getTime()/1e3)>>>0,(N=Math.floor(i.atime.getTime()/1e3),+Math.abs(N)>=1?N>0?(0|Math.min(+Math.floor(N/4294967296),4294967295))>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[r+56>>2]=O[0],U[r+60>>2]=O[1],U[r+64>>2]=0,O=[Math.floor(i.mtime.getTime()/1e3)>>>0,(N=Math.floor(i.mtime.getTime()/1e3),+Math.abs(N)>=1?N>0?(0|Math.min(+Math.floor(N/4294967296),4294967295))>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[r+72>>2]=O[0],U[r+76>>2]=O[1],U[r+80>>2]=0,O=[Math.floor(i.ctime.getTime()/1e3)>>>0,(N=Math.floor(i.ctime.getTime()/1e3),+Math.abs(N)>=1?N>0?(0|Math.min(+Math.floor(N/4294967296),4294967295))>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[r+88>>2]=O[0],U[r+92>>2]=O[1],U[r+96>>2]=0,O=[i.ino>>>0,(N=i.ino,+Math.abs(N)>=1?N>0?(0|Math.min(+Math.floor(N/4294967296),4294967295))>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[r+104>>2]=O[0],U[r+108>>2]=O[1],0},doMsync:function(e,t,r,i,n){var s=A.slice(e,e+r);oe.msync(t,s,n,r,i)},varargs:void 0,get:function(){return de.varargs+=4,U[de.varargs-4>>2]},getStr:function(e){return P(e)},getStreamFromFD:function(e){var t=oe.getStream(e);if(!t)throw new oe.ErrnoError(8);return t}};function le(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}var ce=void 0;function ue(e){for(var t="",r=e;A[r];)t+=ce[A[r++]];return t}var he={},fe={},pe={};function _e(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?"_"+e:e}function me(e,t){return e=_e(e),new Function("body","return function "+e+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(t)}function ge(e,t){var r=me(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},r}var ye=void 0;function ve(e){throw new ye(e)}var be=void 0;function we(e){throw new be(e)}function Se(e,t,r){function i(t){var i=r(t);i.length!==e.length&&we("Mismatched type converter count");for(var n=0;n{fe.hasOwnProperty(e)?n[t]=fe[e]:(s.push(e),he.hasOwnProperty(e)||(he[e]=[]),he[e].push((()=>{n[t]=fe[e],++a===s.length&&i(n)})))})),0===s.length&&i(n)}function Ee(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var i=t.name;if(e||ve('type "'+i+'" must have a positive integer typeid pointer'),fe.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;ve("Cannot register type '"+i+"' twice")}if(fe[e]=t,delete pe[e],he.hasOwnProperty(e)){var n=he[e];delete he[e],n.forEach((e=>e()))}}function Ae(e){if(!(this instanceof je))return!1;if(!(e instanceof je))return!1;for(var t=this.$$.ptrType.registeredClass,r=this.$$.ptr,i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n}function Be(e){ve(e.$$.ptrType.registeredClass.name+" instance already deleted")}var xe=!1;function Ue(e){}function Te(e){e.count.value-=1,0===e.count.value&&function(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}(e)}function ke(e,t,r){if(t===r)return e;if(void 0===r.baseClass)return null;var i=ke(e,t,r.baseClass);return null===i?null:r.downcast(i)}var Ce={};function De(){return Object.keys(Re).length}function Ie(){var e=[];for(var t in Re)Re.hasOwnProperty(t)&&e.push(Re[t]);return e}var Fe=[];function Pe(){for(;Fe.length;){var e=Fe.pop();e.$$.deleteScheduled=!1,e.delete()}}var Le=void 0;function Me(e){Le=e,Fe.length&&Le&&Le(Pe)}var Re={};function ze(e,t){return t=function(e,t){for(void 0===t&&ve("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}(e,t),Re[t]}function Ne(e,t){return t.ptrType&&t.ptr||we("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&we("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Ge(Object.create(e,{$$:{value:t}}))}function Oe(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ze(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?Ne(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Ne(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,a=this.registeredClass.getActualType(t),o=Ce[a];if(!o)return n.call(this);s=this.isConst?o.constPointerType:o.pointerType;var d=ke(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?Ne(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):Ne(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}function Ge(e){return"undefined"==typeof FinalizationRegistry?(Ge=e=>e,e):(xe=new FinalizationRegistry((e=>{Te(e.$$)})),Ge=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};xe.register(e,r,e)}return e},Ue=e=>xe.unregister(e),Ge(e))}function He(){if(this.$$.ptr||Be(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=Ge(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}function $e(){this.$$.ptr||Be(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ve("Object already scheduled for deletion"),Ue(this),Te(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Ve(){return!this.$$.ptr}function We(){return this.$$.ptr||Be(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ve("Object already scheduled for deletion"),Fe.push(this),1===Fe.length&&Le&&Le(Pe),this.$$.deleteScheduled=!0,this}function je(){}function qe(e,t,r){if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||ve("Function '"+r+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}}function Ye(e,t,r,i,n,s,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}function Ke(e,t,r){for(;t!==r;)t.upcast||ve("Expected null or instance of "+r.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function Xe(e,t){if(null===t)return this.isReference&&ve("null is not a valid "+this.name),0;t.$$||ve('Cannot pass "'+wt(t)+'" as a '+this.name),t.$$.ptr||ve("Cannot pass deleted object as a pointer of type "+this.name);var r=t.$$.ptrType.registeredClass;return Ke(t.$$.ptr,r,this.registeredClass)}function Ze(e,t){var r;if(null===t)return this.isReference&&ve("null is not a valid "+this.name),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||ve('Cannot pass "'+wt(t)+'" as a '+this.name),t.$$.ptr||ve("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&ve("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var i=t.$$.ptrType.registeredClass;if(r=Ke(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&ve("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:ve("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,bt.toHandle((function(){n.delete()}))),null!==e&&e.push(this.rawDestructor,r)}break;default:ve("Unsupporting sharing policy")}return r}function Je(e,t){if(null===t)return this.isReference&&ve("null is not a valid "+this.name),0;t.$$||ve('Cannot pass "'+wt(t)+'" as a '+this.name),t.$$.ptr||ve("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&ve("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var r=t.$$.ptrType.registeredClass;return Ke(t.$$.ptr,r,this.registeredClass)}function Qe(e){return this.fromWireType(U[e>>2])}function et(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function tt(e){this.rawDestructor&&this.rawDestructor(e)}function rt(e){null!==e&&e.delete()}function it(e,t,r,i,n,s,a,o,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=Ze:i?(this.toWireType=Xe,this.destructorFunction=null):(this.toWireType=Je,this.destructorFunction=null)}var nt=[];function st(e){var t=nt[e];return t||(e>=nt.length&&(nt.length=e+1),nt[e]=t=D.get(e)),t}function at(t,r,i){return t.includes("j")?function(t,r,i){var n=e["dynCall_"+t];return i&&i.length?n.apply(null,[r].concat(i)):n.call(null,r)}(t,r,i):st(r).apply(null,i)}function ot(e,t){var r,i,n,s=(e=ue(e)).includes("j")?(r=e,i=t,n=[],function(){return n.length=0,Object.assign(n,arguments),at(r,i,n)}):st(t);return"function"!=typeof s&&ve("unknown function pointer with signature "+e+": "+t),s}var dt=void 0;function lt(e){var t=Ht(e),r=ue(t);return Ot(t),r}function ct(e,t){var r=[],i={};throw t.forEach((function e(t){i[t]||fe[t]||(pe[t]?pe[t].forEach(e):(r.push(t),i[t]=!0))})),new dt(e+": "+r.map(lt).join([", "]))}function ut(e,t){for(var r=[],i=0;i>2]);return r}function ht(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function ft(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var r=me(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function pt(e,t,r,i,n){var s=t.length;s<2&&ve("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==r,o=!1,d=1;d0?", ":"")+u),h+=(l?"var rv = ":"")+"invoker(fn"+(u.length>0?", ":"")+u+");\n",o)h+="runDestructors(destructors);\n";else for(d=a?1:2;d4&&0==--mt[e].refcount&&(mt[e]=void 0,_t.push(e))}function yt(){for(var e=0,t=5;t(e||ve("Cannot use deleted val. handle = "+e),mt[e].value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var t=_t.length?_t.pop():mt.length;return mt[t]={refcount:1,value:e},t}}};function wt(e){if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e}function St(e,t){switch(t){case 2:return function(e){return this.fromWireType(k[e>>2])};case 3:return function(e){return this.fromWireType(C[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Et(e,t,r){switch(t){case 0:return r?function(e){return E[e]}:function(e){return A[e]};case 1:return r?function(e){return B[e>>1]}:function(e){return x[e>>1]};case 2:return r?function(e){return U[e>>2]}:function(e){return T[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}var At="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function Bt(e,t){for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&x[i];)++i;if((r=i<<1)-e>32&&At)return At.decode(A.subarray(e,r));for(var s="",a=0;!(a>=t/2);++a){var o=B[e+2*a>>1];if(0==o)break;s+=String.fromCharCode(o)}return s}function xt(e,t,r){if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=a,t+=2}return B[t>>1]=0,t-i}function Ut(e){return 2*e.length}function Tt(e,t){for(var r=0,i="";!(r>=t/4);){var n=U[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i}function kt(e,t,r){if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s)),U[t>>2]=a,(t+=4)+4>n)break}return U[t>>2]=0,t-i}function Ct(e){for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t}var Dt={},It=[],Ft=[],Pt={};function Lt(){if(!Lt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"};for(var t in Pt)void 0===Pt[t]?delete e[t]:e[t]=Pt[t];var r=[];for(var t in e)r.push(t+"="+e[t]);Lt.strings=r}return Lt.strings}var Mt=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=oe.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},Rt=365,zt=146;Object.defineProperties(Mt.prototype,{read:{get:function(){return(this.mode&Rt)===Rt},set:function(e){e?this.mode|=Rt:this.mode&=-366}},write:{get:function(){return(this.mode&zt)===zt},set:function(e){e?this.mode|=zt:this.mode&=-147}},isFolder:{get:function(){return oe.isDir(this.mode)}},isDevice:{get:function(){return oe.isChrdev(this.mode)}}}),oe.FSNode=Mt,oe.staticInit(),function(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);ce=e}(),ye=e.BindingError=ge(Error,"BindingError"),be=e.InternalError=ge(Error,"InternalError"),je.prototype.isAliasOf=Ae,je.prototype.clone=He,je.prototype.delete=$e,je.prototype.isDeleted=Ve,je.prototype.deleteLater=We,e.getInheritedInstanceCount=De,e.getLiveInheritedInstances=Ie,e.flushPendingDeletes=Pe,e.setDelayFunction=Me,it.prototype.getPointee=et,it.prototype.destructor=tt,it.prototype.argPackAdvance=8,it.prototype.readValueFromPointer=Qe,it.prototype.deleteObject=rt,it.prototype.fromWireType=Oe,dt=e.UnboundTypeError=ge(Error,"UnboundTypeError"),e.count_emval_handles=yt,e.get_first_emval=vt;var Nt={q:function(e){return Vt(e+24)+24},p:function(e,t,r){throw new ee(e).init(t,r),e},C:function(e,t,r){de.varargs=r;try{var i=de.getStreamFromFD(e);switch(t){case 0:return(n=de.get())<0?-28:oe.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=de.get();return i.flags|=n,0;case 5:return n=de.get(),B[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return s=28,U[Gt()>>2]=s,-1}}catch(e){if(void 0===oe||!(e instanceof oe.ErrnoError))throw e;return-e.errno}var s},w:function(e,t,r,i){de.varargs=i;try{t=de.getStr(t),t=de.calculateAt(e,t);var n=i?de.get():0;return oe.open(t,r,n).fd}catch(e){if(void 0===oe||!(e instanceof oe.ErrnoError))throw e;return-e.errno}},u:function(e,t,r,i,n){},E:function(e,t,r,i,n){var s=le(r);Ee(e,{name:t=ue(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?i:n},argPackAdvance:8,readValueFromPointer:function(e){var i;if(1===r)i=E;else if(2===r)i=B;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+t);i=U}return this.fromWireType(i[e>>s])},destructorFunction:null})},t:function(t,r,i,n,s,a,o,d,l,c,u,h,f){u=ue(u),a=ot(s,a),d&&(d=ot(o,d)),c&&(c=ot(l,c)),f=ot(h,f);var p=_e(u);!function(t,r,i){e.hasOwnProperty(t)?((void 0===i||void 0!==e[t].overloadTable&&void 0!==e[t].overloadTable[i])&&ve("Cannot register public name '"+t+"' twice"),qe(e,t,t),e.hasOwnProperty(i)&&ve("Cannot register multiple overloads of a function with the same number of arguments ("+i+")!"),e[t].overloadTable[i]=r):(e[t]=r,void 0!==i&&(e[t].numArguments=i))}(p,(function(){ct("Cannot construct "+u+" due to unbound types",[n])})),Se([t,r,i],n?[n]:[],(function(r){var i,s;r=r[0],s=n?(i=r.registeredClass).instancePrototype:je.prototype;var o=me(p,(function(){if(Object.getPrototypeOf(this)!==l)throw new ye("Use 'new' to construct "+u);if(void 0===h.constructor_body)throw new ye(u+" has no accessible constructor");var e=h.constructor_body[arguments.length];if(void 0===e)throw new ye("Tried to invoke ctor of "+u+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(h.constructor_body).toString()+") parameters instead!");return e.apply(this,arguments)})),l=Object.create(s,{constructor:{value:o}});o.prototype=l;var h=new Ye(u,o,l,f,i,a,d,c),_=new it(u,h,!0,!1,!1),m=new it(u+"*",h,!1,!1,!1),g=new it(u+" const*",h,!1,!0,!1);return Ce[t]={pointerType:m,constPointerType:g},function(t,r,i){e.hasOwnProperty(t)||we("Replacing nonexistant public symbol"),void 0!==e[t].overloadTable&&void 0!==i?e[t].overloadTable[i]=r:(e[t]=r,e[t].argCount=i)}(p,o),[_,m,g]}))},r:function(e,t,r,i,n,s){w(t>0);var a=ut(t,r);n=ot(i,n),Se([],[e],(function(e){var r="constructor "+(e=e[0]).name;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new ye("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+e.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return e.registeredClass.constructor_body[t-1]=()=>{ct("Cannot construct "+e.name+" due to unbound types",a)},Se([],a,(function(i){return i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=pt(r,i,null,n,s),[]})),[]}))},d:function(e,t,r,i,n,s,a,o){var d=ut(r,i);t=ue(t),s=ot(n,s),Se([],[e],(function(e){var i=(e=e[0]).name+"."+t;function n(){ct("Cannot call "+i+" due to unbound types",d)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var l=e.registeredClass.instancePrototype,c=l[t];return void 0===c||void 0===c.overloadTable&&c.className!==e.name&&c.argCount===r-2?(n.argCount=r-2,n.className=e.name,l[t]=n):(qe(l,t,i),l[t].overloadTable[r-2]=n),Se([],d,(function(n){var o=pt(i,n,e,s,a);return void 0===l[t].overloadTable?(o.argCount=r-2,l[t]=o):l[t].overloadTable[r-2]=o,[]})),[]}))},D:function(e,t){Ee(e,{name:t=ue(t),fromWireType:function(e){var t=bt.toValue(e);return gt(e),t},toWireType:function(e,t){return bt.toHandle(t)},argPackAdvance:8,readValueFromPointer:Qe,destructorFunction:null})},n:function(e,t,r){var i=le(r);Ee(e,{name:t=ue(t),fromWireType:function(e){return e},toWireType:function(e,t){return t},argPackAdvance:8,readValueFromPointer:St(t,i),destructorFunction:null})},c:function(e,t,r,i,n){t=ue(t);var s=le(r),a=e=>e;if(0===i){var o=32-8*r;a=e=>e<>>o}var d=t.includes("unsigned");Ee(e,{name:t,fromWireType:a,toWireType:d?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:8,readValueFromPointer:Et(t,s,0!==i),destructorFunction:null})},b:function(e,t,r){var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=T,r=t[e>>=2],n=t[e+1];return new i(S,n,r)}Ee(e,{name:r=ue(r),fromWireType:n,argPackAdvance:8,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},m:function(e,t){var r="std::string"===(t=ue(t));Ee(e,{name:t,fromWireType:function(e){var t,i=T[e>>2],n=e+4;if(r)for(var s=n,a=0;a<=i;++a){var o=n+a;if(a==i||0==A[o]){var d=P(s,o-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=o+1}}else{var l=new Array(i);for(a=0;a>2]=i,r&&n)L(t,A,a,i+1);else if(n)for(var o=0;o255&&(Ot(a),ve("String has UTF-16 code units that do not fit in 8 bits")),A[a+o]=d}else for(o=0;ox,o=1):4===t&&(i=Tt,n=kt,a=Ct,s=()=>T,o=2),Ee(e,{name:r,fromWireType:function(e){for(var r,n=T[e>>2],a=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==a[c>>o]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return Ot(e),r},toWireType:function(e,i){"string"!=typeof i&&ve("Cannot pass non-string to C++ string type "+r);var s=a(i),d=Vt(4+s+t);return T[d>>2]=s>>o,n(i,d+4,s+t),null!==e&&e.push(Ot,d),d},argPackAdvance:8,readValueFromPointer:Qe,destructorFunction:function(e){Ot(e)}})},o:function(e,t){Ee(e,{isVoid:!0,name:t=ue(t),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})},f:function(){return Date.now()},g:function(e,t,r,i){var n,s;(e=It[e])(t=bt.toValue(t),r=void 0===(s=Dt[n=r])?ue(n):s,null,i)},j:gt,i:function(e,t){var r=function(e,t){for(var r,i,n,s=new Array(e),a=0;a>2],i="parameter "+a,n=void 0,void 0===(n=fe[r])&&ve(i+" has unknown type "+lt(r)),n);return s}(e,t),i=r[0],n=i.name+"_$"+r.slice(1).map((function(e){return e.name})).join("_")+"$",s=Ft[n];if(void 0!==s)return s;for(var a=["retType"],o=[i],d="",l=0;l>2]=s,function(e,t,r){for(var i=0;i>0]=e.charCodeAt(i);r||(E[t>>0]=0)}(i,s),r+=i.length+1})),0},z:function(e,t){var r=Lt();T[e>>2]=r.length;var i=0;return r.forEach((function(e){i+=e.length+1})),T[t>>2]=i,0},l:function(e){try{var t=de.getStreamFromFD(e);return oe.close(t),0}catch(e){if(void 0===oe||!(e instanceof oe.ErrnoError))throw e;return e.errno}},x:function(e,t){try{var r=de.getStreamFromFD(e),i=r.tty?2:oe.isDir(r.mode)?3:oe.isLink(r.mode)?7:4;return E[t>>0]=i,0}catch(e){if(void 0===oe||!(e instanceof oe.ErrnoError))throw e;return e.errno}},B:function(e,t,r,i){try{var n=function(e,t,r,i){for(var n=0,s=0;s>2],o=T[t+4>>2];t+=8;var d=oe.read(e,E,a,o,i);if(d<0)return-1;if(n+=d,d>2]=n,0}catch(e){if(void 0===oe||!(e instanceof oe.ErrnoError))throw e;return e.errno}},s:function(e,t,r,i,n){try{var s=(d=r)+2097152>>>0<4194305-!!(o=t)?(o>>>0)+4294967296*d:NaN;if(isNaN(s))return 61;var a=de.getStreamFromFD(e);return oe.llseek(a,s,i),O=[a.position>>>0,(N=a.position,+Math.abs(N)>=1?N>0?(0|Math.min(+Math.floor(N/4294967296),4294967295))>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[n>>2]=O[0],U[n+4>>2]=O[1],a.getdents&&0===s&&0===i&&(a.getdents=null),0}catch(e){if(void 0===oe||!(e instanceof oe.ErrnoError))throw e;return e.errno}var o,d},k:function(e,t,r,i){try{var n=function(e,t,r,i){for(var n=0,s=0;s>2],o=T[t+4>>2];t+=8;var d=oe.write(e,E,a,o,i);if(d<0)return-1;n+=d}return n}(de.getStreamFromFD(e),t,r);return T[i>>2]=n,0}catch(e){if(void 0===oe||!(e instanceof oe.ErrnoError))throw e;return e.errno}},e:function(e){}};!function(){var t={a:Nt};function r(t,r){var i,n,s=t.exports;e.asm=s,g=e.asm.F,i=g.buffer,S=i,e.HEAP8=E=new Int8Array(i),e.HEAP16=B=new Int16Array(i),e.HEAP32=U=new Int32Array(i),e.HEAPU8=A=new Uint8Array(i),e.HEAPU16=x=new Uint16Array(i),e.HEAPU32=T=new Uint32Array(i),e.HEAPF32=k=new Float32Array(i),e.HEAPF64=C=new Float64Array(i),D=e.asm.I,n=e.asm.G,H.unshift(n),q()}function n(e){r(e.instance)}function a(e){return function(){if(!m&&(h||f)){if("function"==typeof fetch&&!X(R))return fetch(R,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+R+"'";return e.arrayBuffer()})).catch((function(){return Z(R)}));if(s)return new Promise((function(e,t){s(R,(function(t){e(new Uint8Array(t))}),t)}))}return Promise.resolve().then((function(){return Z(R)}))}().then((function(e){return WebAssembly.instantiate(e,t)})).then((function(e){return e})).then(e,(function(e){v("failed to asynchronously prepare wasm: "+e),Y(e)}))}if(j(),e.instantiateWasm)try{return e.instantiateWasm(t,r)}catch(e){return v("Module.instantiateWasm callback failed with error: "+e),!1}(m||"function"!=typeof WebAssembly.instantiateStreaming||K(R)||X(R)||p||"function"!=typeof fetch?a(n):fetch(R,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,t).then(n,(function(e){return v("wasm streaming compile failed: "+e),v("falling back to ArrayBuffer instantiation"),a(n)}))}))).catch(i)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.G).apply(null,arguments)};var Ot=e._free=function(){return(Ot=e._free=e.asm.H).apply(null,arguments)},Gt=e.___errno_location=function(){return(Gt=e.___errno_location=e.asm.J).apply(null,arguments)},Ht=e.___getTypeName=function(){return(Ht=e.___getTypeName=e.asm.K).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.L).apply(null,arguments)};var $t,Vt=e._malloc=function(){return(Vt=e._malloc=e.asm.M).apply(null,arguments)},Wt=e._emscripten_builtin_memalign=function(){return(Wt=e._emscripten_builtin_memalign=e.asm.N).apply(null,arguments)},jt=e.___cxa_is_pointer_type=function(){return(jt=e.___cxa_is_pointer_type=e.asm.O).apply(null,arguments)};function qt(r){function i(){$t||($t=!0,e.calledRun=!0,b||(e.noFSInit||oe.init.initialized||oe.init(),oe.ignorePermissions=!1,Q(H),t(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),function(){if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)t=e.postRun.shift(),$.unshift(t);var t;Q($)}()))}V>0||(function(){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)t=e.preRun.shift(),G.unshift(t);var t;Q(G)}(),V>0||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),i()}),1)):i()))}if(e.dynCall_viiijj=function(){return(e.dynCall_viiijj=e.asm.P).apply(null,arguments)},e.dynCall_jij=function(){return(e.dynCall_jij=e.asm.Q).apply(null,arguments)},e.dynCall_jii=function(){return(e.dynCall_jii=e.asm.R).apply(null,arguments)},e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.S).apply(null,arguments)},W=function e(){$t||qt(),$t||(W=e)},e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return qt(),e.ready}),a=1e-6,o="undefined"!=typeof Float32Array?Float32Array:Array;function d(){var e=new o(16);return o!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function l(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var c,u=function(e,t,r,i,n,s,a){var o=1/(t-r),d=1/(i-n),l=1/(s-a);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*o,e[13]=(n+i)*d,e[14]=(a+s)*l,e[15]=1,e};function h(e,t,r){var i=new o(3);return i[0]=e,i[1]=t,i[2]=r,i}c=new o(3),o!=Float32Array&&(c[0]=0,c[1]=0,c[2]=0);var f=(e,t)=>{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const r=function(){const t=_(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=_(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(i)),null;return i}();let i={program:r,attribLocations:{vertexPosition:e.getAttribLocation(r,"aVertexPosition"),texturePosition:e.getAttribLocation(r,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(r,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(r,"uModelMatrix"),viewMatrix:e.getUniformLocation(r,"uViewMatrix"),rgbatexture:e.getUniformLocation(r,"rgbaTexture"),ytexture:e.getUniformLocation(r,"yTexture"),utexture:e.getUniformLocation(r,"uTexture"),vtexture:e.getUniformLocation(r,"vTexture"),isyuv:e.getUniformLocation(r,"isyuv")}},n=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var r=[];r=r.concat([0,1],[1,1],[1,0],[0,0]);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);const n=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:i,indices:n}}(),s=p(),o=p(),c=p(),f=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function _(t,r){const i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(i)),e.deleteShader(i),null)}function m(t,r){e.viewport(0,0,t,r),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const s=d();u(s,-1,1,-1,1,.1,100);const p=d();l(p);const _=d();!function(e,t,r,i){var n,s,o,d,c,u,h,f,p,_,m=t[0],g=t[1],y=t[2],v=i[0],b=i[1],w=i[2],S=r[0],E=r[1],A=r[2];Math.abs(m-S)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let r=e-this._current_word_bits_left;this._fillCurrentWord();let i=Math.min(r,this._current_word_bits_left),n=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Gt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Ht=Gt,$t=Gt;function Vt(e){let{profile:t,sampleRate:r,channel:i}=e;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function Wt(e){return jt(e)&&e[1]===Bt}function jt(e){return e[0]>>4===Re}const qt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Yt(e){let t=new Uint8Array(e),r=null,i=0,n=0,s=0,a=null;if(i=n=t[0]>>>3,s=(7&t[0])<<1|t[1]>>>7,s<0||s>=qt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let o=qt[s],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===i&&(a=(7&t[1])<<1|t[2]>>>7,t[2]);let l=self.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?s>=6?(i=5,r=new Array(4),a=s-3):(i=2,r=new Array(2),a=s):-1!==l.indexOf("android")?(i=2,r=new Array(2),a=s):(i=5,a=s,r=new Array(4),s>=6?a=s-3:1===d&&(i=2,r=new Array(2),a=s)),r[0]=i<<3,r[0]|=(15&s)>>>1,r[1]=(15&s)<<7,r[1]|=(15&d)<<3,5===i&&(r[1]|=(15&a)>>>1,r[2]=(1&a)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:o,channelCount:d,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+n}}class Kt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+7>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,n=(6&e[r+1])>>>1,s=1&e[r+1],a=(192&e[r+2])>>>6,o=(60&e[r+2])>>>2,d=(1&e[r+2])<<2|(192&e[r+3])>>>6,l=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===s?7:9,u=l-c;r+=c;let h=this.findNextSyncwordOffset(r+u);if(this.current_syncword_offset_=h,0!==i&&1!==i||0!==n)continue;let f=e.subarray(r,r+u);t={},t.audio_object_type=a+1,t.sampling_freq_index=o,t.sampling_frequency=Ht[o],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Xt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),r=0;for(let i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}readNextAACFrame(e){let t=this.data_,r=null;for(;null==r&&!this.eof_flag_;){let i=this.current_syncword_offset_,n=(31&t[i+1])<<8|t[i+2];if(i+3+n>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let s=new Ot(t.subarray(i+3,i+3+n)),a=null;if(s.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+n),s.destroy();continue}a=e}else{let e=s.readBool();if(e&&s.readBool()){console.error("audioMuxVersionA is Not Supported"),s.destroy();break}if(e&&this.getLATMValue(s),!s.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),s.destroy();break}if(0!==s.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),s.destroy();break}if(0!==s.readBits(4)){console.error("more than 2 numProgram Not Supported"),s.destroy();break}if(0!==s.readBits(3)){console.error("more than 2 numLayer Not Supported"),s.destroy();break}let t=e?this.getLATMValue(s):0,r=s.readBits(5);t-=5;let i=s.readBits(4);t-=4;let n=s.readBits(4);t-=4,s.readBits(3),t-=3,t>0&&s.readBits(t);let o=s.readBits(3);if(0!==o){console.error(`frameLengthType = ${o}. Only frameLengthType = 0 Supported`),s.destroy();break}s.readByte();let d=s.readBool();if(d)if(e)this.getLATMValue(s);else{let e=0;for(;;){e<<=8;let t=s.readBool();if(e+=s.readByte(),!t)break}console.log(e)}s.readBool()&&s.readByte(),a={},a.audio_object_type=r,a.sampling_freq_index=i,a.sampling_frequency=Ht[a.sampling_freq_index],a.channel_config=n,a.other_data_present=d}let o=0;for(;;){let e=s.readByte();if(o+=e,255!==e)break}let d=new Uint8Array(o);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function Jt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return;const r=e.length,i=[];let n,s=0;for(;s+t>>=8),s+=t,n){if(s+n>r)break;i.push(e.subarray(s,s+n)),s+=n}return i}function Qt(e){const t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;const i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function er(e,t){let r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}function tr(){return(new Date).getTime()}function rr(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function ir(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function nr(e){let t=0,r=ir();return i=>{if(n=i,"[object Number]"!==Object.prototype.toString.call(n))return;var n;t+=i;const s=ir(),a=s-r;a>=1e3&&(e(t/a*1e3),r=s,t=0)}}function sr(){const e=window.navigator.userAgent.toLowerCase();return/firefox/i.test(e)}function ar(){let e=!1;return"MediaSource"in self&&(self.MediaSource.isTypeSupported(ut)||self.MediaSource.isTypeSupported(ht)||self.MediaSource.isTypeSupported(ft)||self.MediaSource.isTypeSupported(pt)||self.MediaSource.isTypeSupported(_t))&&(e=!0),e}function or(e){return null==e}function dr(e){return!or(e)}function lr(e){return"function"==typeof e}function cr(e){let t=null,r=31&e[0];return r!==Ge&&r!==He||(t=Le),t||(r=(126&e[0])>>1,r!==Qe&&r!==tt&&r!==it||(t=Me)),t}function ur(){return"undefined"!=typeof WritableStream}function hr(e){e.close()}function fr(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let r=e[0],i=null,n=1;if(e.length>0){let t=e[1];t&&t.ts-r.ts>1e5&&(r=t,n=2)}if(r)for(let s=n;s=1e3){e[s-1].ts-r.ts<1e3&&(i=s+1)}}}return i}function pr(e){return e.ok&&e.status>=200&&e.status<=299}function _r(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(r){t=e}else t=e;return t}(x)}function mr(e){return e[0]>>4===xt&&e[1]===Bt}function gr(e){return!0===e||"true"===e}function yr(e){return!0!==e&&"true"!==e}function vr(){return!!(self.Worker&&self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker)}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();var br=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function a(e){try{d(i.next(e))}catch(e){s(e)}}function o(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}d((i=i.apply(e,t||[])).next())}))};const wr=Symbol(32),Sr=Symbol(16),Er=Symbol(8);class Ar{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return br(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,r)=>{var i;this.reject=r,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(i=this.pull)||void 0===i||i.call(this,e)}))}))}readU32(){return this.read(wr)}readU16(){return this.read(Sr)}readU8(){return this.read(Er)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let r=0;const i=e=>t.length<(r=e);if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===wr){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Sr){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===Er){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{const e=new Uint8Array(r);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}Ar.U32=wr,Ar.U16=Sr,Ar.U8=Er;class Br{constructor(e){this.log=function(t){if(e._opt.debug&&e._opt.debugLevel==w){const s=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n1?r-1:0),n=1;n1?i-1:0),s=1;s=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseSPS(e){let t=xr._ebsp2rbsp(e),r=new Ot(t);r.readByte();let i=r.readByte();r.readByte();let n=r.readByte();r.readUEG();let s=xr.getProfileString(i),a=xr.getLevelString(n),o=1,d=420,l=[0,420,422,444],c=8;if((100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i)&&(o=r.readUEG(),3===o&&r.readBits(1),o<=3&&(d=l[o]),c=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool())){let e=3!==o?8:12;for(let t=0;t0&&e<16?(b=t[e-1],w=i[e-1]):255===e&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);E=r.readBool(),A=t,B=2*e,S=A/B}}let x=1;1===b&&1===w||(x=b/w);let U=0,T=0;if(0===o)U=1,T=2-_;else{U=3===o?1:2,T=(1===o?2:1)*(2-_)}let k=16*(f+1),C=16*(p+1)*(2-_);k-=(m+g)*U,C-=(y+v)*T;let D=Math.ceil(k*x);return r.destroy(),r=null,{profile_string:s,level_string:a,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:xr.getChromaFormatString(d),frame_rate:{fixed:E,fps:S,fps_den:B,fps_num:A},sar_ratio:{width:b,height:w},codec_size:{width:k,height:C},present_size:{width:D,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),r="avc1.";for(let e=0;e<3;e++){let i=t[e].toString(16);i.length<2&&(i="0"+i),r+=i}let i=xr._ebsp2rbsp(e),n=new Ot(i);n.readByte();let s=n.readByte();n.readByte();let a=n.readByte();n.readUEG();let o=xr.getProfileString(s),d=xr.getLevelString(a),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(l=n.readUEG(),3===l&&n.readBits(1),l<=3&&(c=u[l]),h=n.readUEG()+8,f=n.readUEG()+8,n.readBits(1),n.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(E=t[e-1],A=r[e-1]):255===e&&(E=n.readByte()<<8|n.readByte(),A=n.readByte()<<8|n.readByte())}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(4),n.readBool()&&n.readBits(24)),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool()){let e=n.readBits(32),t=n.readBits(32);x=n.readBool(),U=t,T=2*e,B=U/T}}let k=1;1===E&&1===A||(k=E/A);let C=0,D=0;if(0===l)C=1,D=2-y;else{C=3===l?1:2,D=(1===l?2:1)*(2-y)}let I=16*(m+1),F=16*(g+1)*(2-y);I-=(v+b)*C,F-=(w+S)*D;let P=Math.ceil(I*k);return n.destroy(),n=null,{codec_mimetype:r,profile_idc:s,level_idc:a,profile_string:o,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:_,chroma_format:c,chroma_format_string:xr.getChromaFormatString(c),frame_rate:{fixed:x,fps:B,fps_den:T,fps_num:U},sar_ratio:{width:E,height:A},codec_size:{width:I,height:F},present_size:{width:P,height:F}}}static _skipScalingList(e,t){let r=8,i=8,n=0;for(let s=0;s=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.sps,4),t.sps=i}if(t.pps){const e=t.pps.byteLength,r=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.pps,4),t.pps=i}return t}function kr(e){let{sps:t,pps:r}=e;const i=[23,0,0,0,0,1,66,0,30,255];i[0]=23,i[6]=t[1],i[7]=t[2],i[8]=t[3],i[10]=225,i[11]=t.byteLength>>8&255,i[12]=255&t.byteLength,i.push(...t,1,r.byteLength>>8&255,255&r.byteLength,...r);return new Uint8Array(i)}function Cr(e){let{sps:t,pps:r}=e,i=8+t.byteLength+1+2+r.byteLength,n=!1;const s=xr.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(n=!0,i+=4);let a=new Uint8Array(i);a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225;let o=t.byteLength;a[6]=o>>>8,a[7]=255&o;let d=8;a.set(t,8),d+=o,a[d]=1;let l=r.byteLength;a[d+1]=l>>>8,a[d+2]=255&l,a.set(r,d+3),d+=3+l,n&&(a[d]=252|s.chroma_format_idc,a[d+1]=248|s.bit_depth_luma-8,a[d+2]=248|s.bit_depth_chroma-8,a[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+a.byteLength);return u.set(c,0),u.set(a,c.length),u}function Dr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Ir(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Fr(e){return 31&e[0]}function Pr(e){return e===je}function Lr(e){return!function(e){return e===Ge||e===He}(e)&&!Pr(e)}function Mr(e){return e===$e}function Rr(e){if(0===e.length)return!1;const t=Fr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=31&e[r],n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,i>=Ke||0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class Nr{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Or=e=>{let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)},Gr=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Hr{static _ebsp2rbsp(e){let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseVPS(e){let t=Hr._ebsp2rbsp(e),r=new Ot(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}}static parseSPS(e){let t=Hr._ebsp2rbsp(e),r=new Ot(t);r.readByte(),r.readByte();let i=0,n=0,s=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),_=r.readByte(),m=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<=16?(P=t[e-1],L=i[e-1]):255===e&&(P=r.readBits(16),L=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()){r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())}if(r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),I=r.readBool(),I&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()){if(R=r.readBits(32),z=r.readBits(32),r.readBool()&&r.readUEG(),r.readBool()){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=o;n++){let n=r.readBool();M=n;let s=!0,a=1;n||(s=r.readBool());let o=!1;if(s?r.readUEG():o=r.readBool(),o||(a=r.readUEG()+1),e){for(let e=0;e>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];let i=e[22],n=e.slice(23);for(let e=0;e0)for(let t=r;t<8;t++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(let t=0;t{let t=Or(e),r=new Ot(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}})(t),a=(e=>{let t=Or(e),r=new Ot(t);r.readByte(),r.readByte();let i=0,n=0,s=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),_=r.readByte(),m=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<16?(P=t[e-1],L=i[e-1]):255===e&&(P=r.readBits(16),L=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),I=r.readBool(),I&&(i+=r.readUEG(),n+=r.readUEG(),s+=r.readUEG(),a+=r.readUEG()),r.readBool()&&(R=r.readBits(32),z=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=o;n++){let n=r.readBool();M=n;let s=!1,a=1;n||(s=r.readBool());let o=!1;if(s?r.readSEG():o=r.readBool(),o||(cpbcnt=r.readUEG()+1),e)for(let e=0;e{let t=Or(e),r=new Ot(t);r.readByte(),r.readByte(),r.readUEG(),r.readUEG(),r.readBool(),r.readBool(),r.readBits(3),r.readBool(),r.readBool(),r.readUEG(),r.readUEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool()&&r.readUEG(),r.readSEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool(),r.readBool();let i=r.readBool(),n=r.readBool(),s=1;return n&&i?s=0:n?s=3:i&&(s=2),{parallelismType:s}})(r);n=Object.assign(n,s,a,o);let d=23+(5+t.byteLength)+(5+i.byteLength)+(5+r.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,l[2]=n.general_profile_compatibility_flags_1||0,l[3]=n.general_profile_compatibility_flags_2||0,l[4]=n.general_profile_compatibility_flags_3||0,l[5]=n.general_profile_compatibility_flags_4||0,l[6]=n.general_constraint_indicator_flags_1||0,l[7]=n.general_constraint_indicator_flags_2||0,l[8]=n.general_constraint_indicator_flags_3||0,l[9]=n.general_constraint_indicator_flags_4||0,l[10]=n.general_constraint_indicator_flags_5||0,l[11]=n.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,l[14]=255&n.min_spatial_segmentation_idc,l[15]=252|3&n.parallelismType,l[16]=252|3&n.chroma_format_idc,l[17]=248|7&n.bit_depth_luma_minus8,l[18]=248|7&n.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|Qe,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|tt,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+i.byteLength)+0]=128|it,l[23+(5+t.byteLength+5+i.byteLength)+1]=0,l[23+(5+t.byteLength+5+i.byteLength)+2]=1,l[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength+5+i.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function qr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Yr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Kr(e){return(126&e[0])>>1}function Xr(e){return e===st}function Zr(e){return!function(e){return e>=32&&e<=40}(e)}function Jr(e){return e>=16&&e<=21}function Qr(e){if(0===e.length)return!1;const t=Kr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=e[r]>>1&63,n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class ti{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function ri(e){return parseInt(e)===e}function ii(e){if(!ri(e.length))return!1;for(var t=0;t255)return!1;return!0}function ni(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!ii(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(ri(e.length)&&ii(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function si(e){return new Uint8Array(e)}function ai(e,t,r,i,n){null==i&&null==n||(e=e.slice?e.slice(i,n):Array.prototype.slice.call(e,i,n)),t.set(e,r)}var oi,di={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},li=(oi="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+oi[15&i])}return t.join("")}}),ci={16:10,24:12,32:14},ui=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],hi=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],fi=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],pi=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],_i=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],mi=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],gi=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],yi=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],vi=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],bi=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],wi=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Si=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ei=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Ai=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Bi=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function xi(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=s[t],this._Kd[e-r][t%4]=s[t];for(var a,o=0,d=n;d>16&255]<<24^hi[a>>8&255]<<16^hi[255&a]<<8^hi[a>>24&255]^ui[o]<<24,o+=1,8!=n)for(t=1;t>8&255]<<8^hi[a>>16&255]<<16^hi[a>>24&255]<<24;for(t=n/2+1;t>2,c=d%4,this._Ke[l][c]=s[t],this._Kd[e-l][c]=s[t++],d++}for(var l=1;l>24&255]^Ei[a>>16&255]^Ai[a>>8&255]^Bi[255&a]},Ui.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=xi(e),n=0;n<4;n++)i[n]^=this._Ke[0][n];for(var s=1;s>24&255]^_i[i[(n+1)%4]>>16&255]^mi[i[(n+2)%4]>>8&255]^gi[255&i[(n+3)%4]]^this._Ke[s][n];i=r.slice()}var a,o=si(16);for(n=0;n<4;n++)a=this._Ke[t][n],o[4*n]=255&(hi[i[n]>>24&255]^a>>24),o[4*n+1]=255&(hi[i[(n+1)%4]>>16&255]^a>>16),o[4*n+2]=255&(hi[i[(n+2)%4]>>8&255]^a>>8),o[4*n+3]=255&(hi[255&i[(n+3)%4]]^a);return o},Ui.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=xi(e),n=0;n<4;n++)i[n]^=this._Kd[0][n];for(var s=1;s>24&255]^vi[i[(n+3)%4]>>16&255]^bi[i[(n+2)%4]>>8&255]^wi[255&i[(n+1)%4]]^this._Kd[s][n];i=r.slice()}var a,o=si(16);for(n=0;n<4;n++)a=this._Kd[t][n],o[4*n]=255&(fi[i[n]>>24&255]^a>>24),o[4*n+1]=255&(fi[i[(n+3)%4]>>16&255]^a>>16),o[4*n+2]=255&(fi[i[(n+2)%4]>>8&255]^a>>8),o[4*n+3]=255&(fi[255&i[(n+1)%4]]^a);return o};var Ti=function(e){if(!(this instanceof Ti))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new Ui(e)};Ti.prototype.encrypt=function(e){if((e=ni(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=si(e.length),r=si(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Ii.prototype.setBytes=function(e){if(16!=(e=ni(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Ii.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Fi=function(e,t){if(!(this instanceof Fi))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Ii||(t=new Ii(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new Ui(e)};Fi.prototype.encrypt=function(e){for(var t=ni(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-s%4*8&255;t[i+s>>>2]|=a<<24-(i+s)%4*8}else for(var o=0;o>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,a=this.blockSize,o=s/(4*a),d=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*a,c=e.min(4*d,s);if(d){for(var u=0;u>>2]|=e[n]<<24-n%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),Nt((function(e,t){var r;e.exports=(r=Li,function(){var e=r,t=e.lib.WordArray,i=e.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=e.charCodeAt(n)<<16-n%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(e){for(var r=e.length,i=[],s=0;s>>1]|=n(e.charCodeAt(s)<<16-s%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),Nt((function(e,t){var r;e.exports=(r=Li,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var n=[],s=0,a=0;a>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,o=0;o<4&&s+.75*o>>6*(3-o)&63));var d=i.charAt(64);if(d)for(;n.length%4;)n.push(d);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var s=0;s>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,d=0;d<4&&a+.75*d>>6*(3-d)&63));var l=n.charAt(64);if(l)for(;s.length%4;)s.push(l);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,n=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(n<<24|n>>>8)}var s=this._hash.words,a=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],_=e[t+4],m=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],B=e[t+14],x=e[t+15],U=s[0],T=s[1],k=s[2],C=s[3];U=l(U,T,k,C,a,7,o[0]),C=l(C,U,T,k,d,12,o[1]),k=l(k,C,U,T,f,17,o[2]),T=l(T,k,C,U,p,22,o[3]),U=l(U,T,k,C,_,7,o[4]),C=l(C,U,T,k,m,12,o[5]),k=l(k,C,U,T,g,17,o[6]),T=l(T,k,C,U,y,22,o[7]),U=l(U,T,k,C,v,7,o[8]),C=l(C,U,T,k,b,12,o[9]),k=l(k,C,U,T,w,17,o[10]),T=l(T,k,C,U,S,22,o[11]),U=l(U,T,k,C,E,7,o[12]),C=l(C,U,T,k,A,12,o[13]),k=l(k,C,U,T,B,17,o[14]),U=c(U,T=l(T,k,C,U,x,22,o[15]),k,C,d,5,o[16]),C=c(C,U,T,k,g,9,o[17]),k=c(k,C,U,T,S,14,o[18]),T=c(T,k,C,U,a,20,o[19]),U=c(U,T,k,C,m,5,o[20]),C=c(C,U,T,k,w,9,o[21]),k=c(k,C,U,T,x,14,o[22]),T=c(T,k,C,U,_,20,o[23]),U=c(U,T,k,C,b,5,o[24]),C=c(C,U,T,k,B,9,o[25]),k=c(k,C,U,T,p,14,o[26]),T=c(T,k,C,U,v,20,o[27]),U=c(U,T,k,C,A,5,o[28]),C=c(C,U,T,k,f,9,o[29]),k=c(k,C,U,T,y,14,o[30]),U=u(U,T=c(T,k,C,U,E,20,o[31]),k,C,m,4,o[32]),C=u(C,U,T,k,v,11,o[33]),k=u(k,C,U,T,S,16,o[34]),T=u(T,k,C,U,B,23,o[35]),U=u(U,T,k,C,d,4,o[36]),C=u(C,U,T,k,_,11,o[37]),k=u(k,C,U,T,y,16,o[38]),T=u(T,k,C,U,w,23,o[39]),U=u(U,T,k,C,A,4,o[40]),C=u(C,U,T,k,a,11,o[41]),k=u(k,C,U,T,p,16,o[42]),T=u(T,k,C,U,g,23,o[43]),U=u(U,T,k,C,b,4,o[44]),C=u(C,U,T,k,E,11,o[45]),k=u(k,C,U,T,x,16,o[46]),U=h(U,T=u(T,k,C,U,f,23,o[47]),k,C,a,6,o[48]),C=h(C,U,T,k,y,10,o[49]),k=h(k,C,U,T,B,15,o[50]),T=h(T,k,C,U,m,21,o[51]),U=h(U,T,k,C,E,6,o[52]),C=h(C,U,T,k,p,10,o[53]),k=h(k,C,U,T,w,15,o[54]),T=h(T,k,C,U,d,21,o[55]),U=h(U,T,k,C,v,6,o[56]),C=h(C,U,T,k,x,10,o[57]),k=h(k,C,U,T,g,15,o[58]),T=h(T,k,C,U,A,21,o[59]),U=h(U,T,k,C,_,6,o[60]),C=h(C,U,T,k,S,10,o[61]),k=h(k,C,U,T,f,15,o[62]),T=h(T,k,C,U,b,21,o[63]),s[0]=s[0]+U|0,s[1]=s[1]+T|0,s[2]=s[2]+k|0,s[3]=s[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var s=e.floor(i/4294967296),a=i;r[15+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var o=this._hash,d=o.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return o},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,n,s,a){var o=e+(t&r|~t&i)+n+a;return(o<>>32-s)+t}function c(e,t,r,i,n,s,a){var o=e+(t&i|r&~i)+n+a;return(o<>>32-s)+t}function u(e,t,r,i,n,s,a){var o=e+(t^r^i)+n+a;return(o<>>32-s)+t}function h(e,t,r,i,n,s,a){var o=e+(r^(t|~i))+n+a;return(o<>>32-s)+t}t.MD5=s._createHelper(d),t.HmacMD5=s._createHmacHelper(d)}(Math),r.MD5)})),Nt((function(e,t){var r,i,n,s,a,o,d,l;e.exports=(i=(r=l=Li).lib,n=i.WordArray,s=i.Hasher,a=r.algo,o=[],d=a.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],d=r[4],l=0;l<80;l++){if(l<16)o[l]=0|e[t+l];else{var c=o[l-3]^o[l-8]^o[l-14]^o[l-16];o[l]=c<<1|c>>>31}var u=(i<<5|i>>>27)+d+o[l];u+=l<20?1518500249+(n&s|~n&a):l<40?1859775393+(n^s^a):l<60?(n&s|n&a|s&a)-1894007588:(n^s^a)-899497514,d=a,a=s,s=n<<30|n>>>2,n=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=s._createHelper(d),r.HmacSHA1=s._createHmacHelper(d),l.SHA1)})),Nt((function(e,t){var r;e.exports=(r=Li,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.algo,o=[],d=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(o[n]=r(e.pow(i,.5))),d[n]=r(e.pow(i,1/3)),n++),i++}();var l=[],c=a.SHA256=s.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],_=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,m=l[f-2],g=(m<<15|m>>>17)^(m<<13|m>>>19)^m>>>10;l[f]=_+l[f-7]+g+l[f-16]}var y=i&n^i&s^n&s,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&c^~o&u)+d[f]+l[f];h=u,u=c,c=o,o=a+b|0,a=s,s=n,n=i,i=b+(v+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=s._createHelper(c),t.HmacSHA256=s._createHmacHelper(c)}(Math),r.SHA256)})),Nt((function(e,t){var r,i,n,s,a,o;e.exports=(i=(r=o=Li).lib.WordArray,n=r.algo,s=n.SHA256,a=n.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=s._createHelper(a),r.HmacSHA224=s._createHmacHelper(a),o.SHA224)})),Nt((function(e,t){var r;e.exports=(r=Li,function(){var e=r,t=e.lib.Hasher,i=e.x64,n=i.Word,s=i.WordArray,a=e.algo;function o(){return n.create.apply(n,arguments)}var d=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=o()}();var c=a.SHA512=t.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=i.high,p=i.low,_=n.high,m=n.low,g=s.high,y=s.low,v=a.high,b=a.low,w=o.high,S=o.low,E=c.high,A=c.low,B=u.high,x=u.low,U=h.high,T=h.low,k=f,C=p,D=_,I=m,F=g,P=y,L=v,M=b,R=w,z=S,N=E,O=A,G=B,H=x,$=U,V=T,W=0;W<80;W++){var j,q,Y=l[W];if(W<16)q=Y.high=0|e[t+2*W],j=Y.low=0|e[t+2*W+1];else{var K=l[W-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[W-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=l[W-7],ae=se.high,oe=se.low,de=l[W-16],le=de.high,ce=de.low;q=(q=(q=J+ae+((j=Q+oe)>>>0>>0?1:0))+ie+((j+=ne)>>>0>>0?1:0))+le+((j+=ce)>>>0>>0?1:0),Y.high=q,Y.low=j}var ue,he=R&N^~R&G,fe=z&O^~z&H,pe=k&D^k&F^D&F,_e=C&I^C&P^I&P,me=(k>>>28|C<<4)^(k<<30|C>>>2)^(k<<25|C>>>7),ge=(C>>>28|k<<4)^(C<<30|k>>>2)^(C<<25|k>>>7),ye=(R>>>14|z<<18)^(R>>>18|z<<14)^(R<<23|z>>>9),ve=(z>>>14|R<<18)^(z>>>18|R<<14)^(z<<23|R>>>9),be=d[W],we=be.high,Se=be.low,Ee=$+ye+((ue=V+ve)>>>0>>0?1:0),Ae=ge+_e;$=G,V=H,G=N,H=O,N=R,O=z,R=L+(Ee=(Ee=(Ee=Ee+he+((ue+=fe)>>>0>>0?1:0))+we+((ue+=Se)>>>0>>0?1:0))+q+((ue+=j)>>>0>>0?1:0))+((z=M+ue|0)>>>0>>0?1:0)|0,L=F,M=P,F=D,P=I,D=k,I=C,k=Ee+(me+pe+(Ae>>>0>>0?1:0))+((C=ue+Ae|0)>>>0>>0?1:0)|0}p=i.low=p+C,i.high=f+k+(p>>>0>>0?1:0),m=n.low=m+I,n.high=_+D+(m>>>0>>0?1:0),y=s.low=y+P,s.high=g+F+(y>>>0

>>0?1:0),b=a.low=b+M,a.high=v+L+(b>>>0>>0?1:0),S=o.low=S+z,o.high=w+R+(S>>>0>>0?1:0),A=c.low=A+O,c.high=E+N+(A>>>0>>0?1:0),x=u.low=x+H,u.high=B+G+(x>>>0>>0?1:0),T=h.low=T+V,h.high=U+$+(T>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),r.SHA512)})),Nt((function(e,t){var r,i,n,s,a,o,d,l;e.exports=(i=(r=l=Li).x64,n=i.Word,s=i.WordArray,a=r.algo,o=a.SHA512,d=a.SHA384=o.extend({_doReset:function(){this._hash=new s.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=o._createHelper(d),r.HmacSHA384=o._createHmacHelper(d),l.SHA384)})),Nt((function(e,t){var r;e.exports=(r=Li,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.x64.Word,o=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){d[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,s=0;s<24;s++){for(var o=0,u=0,h=0;h<7;h++){if(1&n){var f=(1<>>24)|4278255360&(s<<24|s>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(T=r[n]).high^=a,T.low^=s}for(var o=0;o<24;o++){for(var h=0;h<5;h++){for(var f=0,p=0,_=0;_<5;_++)f^=(T=r[h+5*_]).high,p^=T.low;var m=u[h];m.high=f,m.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],v=y.high,b=y.low;for(f=g.high^(v<<1|b>>>31),p=g.low^(b<<1|v>>>31),_=0;_<5;_++)(T=r[h+5*_]).high^=f,T.low^=p}for(var w=1;w<25;w++){var S=(T=r[w]).high,E=T.low,A=d[w];A<32?(f=S<>>32-A,p=E<>>32-A):(f=E<>>64-A,p=S<>>64-A);var B=u[l[w]];B.high=f,B.low=p}var x=u[0],U=r[0];for(x.high=U.high,x.low=U.low,h=0;h<5;h++)for(_=0;_<5;_++){var T=r[w=h+5*_],k=u[w],C=u[(h+1)%5+5*_],D=u[(h+2)%5+5*_];T.high=k.high^~C.high&D.high,T.low=k.low^~C.low&D.low}T=r[0];var I=c[o];T.high^=I.high,T.low^=I.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,s=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/s)*s>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,d=o/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new n.init(l,o)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=s._createHelper(h),t.HmacSHA3=s._createHmacHelper(h)}(Math),r.SHA3)})),Nt((function(e,t){var r;e.exports=(r=Li,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.algo,o=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=n.create([0,1518500249,1859775393,2400959708,2840853838]),h=n.create([1352829926,1548603684,1836072691,2053994217,0]),f=a.RIPEMD160=s.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s,a,f,b,w,S,E,A,B,x,U,T=this._hash.words,k=u.words,C=h.words,D=o.words,I=d.words,F=l.words,P=c.words;for(S=s=T[0],E=a=T[1],A=f=T[2],B=b=T[3],x=w=T[4],r=0;r<80;r+=1)U=s+e[t+D[r]]|0,U+=r<16?p(a,f,b)+k[0]:r<32?_(a,f,b)+k[1]:r<48?m(a,f,b)+k[2]:r<64?g(a,f,b)+k[3]:y(a,f,b)+k[4],U=(U=v(U|=0,F[r]))+w|0,s=w,w=b,b=v(f,10),f=a,a=U,U=S+e[t+I[r]]|0,U+=r<16?y(E,A,B)+C[0]:r<32?g(E,A,B)+C[1]:r<48?m(E,A,B)+C[2]:r<64?_(E,A,B)+C[3]:p(E,A,B)+C[4],U=(U=v(U|=0,P[r]))+x|0,S=x,x=B,B=v(A,10),A=E,E=U;U=T[1]+f+B|0,T[1]=T[2]+b+x|0,T[2]=T[3]+w+S|0,T[3]=T[4]+s+E|0,T[4]=T[0]+a+A|0,T[0]=U},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,s=n.words,a=0;a<5;a++){var o=s[a];s[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return n},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function _(e,t,r){return e&t|~e&r}function m(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=s._createHelper(f),t.HmacRIPEMD160=s._createHmacHelper(f)}(),r.RIPEMD160)})),Nt((function(e,t){var r,i,n;e.exports=(i=(r=Li).lib.Base,n=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),a=this._iKey=t.clone(),o=s.words,d=a.words,l=0;l>>2];e.sigBytes-=t}};i.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var _=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),m=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(d)},parse:function(e){var t,r=d.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=s.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),_.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=n.extend({cfg:n.extend({format:m}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),a=n.cfg;return _.create({ciphertext:s,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=s.random(8)),n)a=l.create({keySize:t+r,hasher:n}).compute(e,i);else var a=l.create({keySize:t+r}).compute(e,i);var o=s.create(a.words.slice(t),4*r);return a.sigBytes=4*t,_.create({key:a,iv:o,salt:i})}},v=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var s=g.encrypt.call(this,e,t,n.key,i);return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,g.decrypt.call(this,e,t,n.key,i)}})}())})),Nt((function(e,t){var r;e.exports=((r=Li).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var a=0;a>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var n=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,s=this._iv,a=this._counter;s&&(a=this._counter=s.slice(0),this._iv=void 0),i(a);var o=a.slice(0);r.encryptBlock(o,0);for(var d=0;d>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),Nt((function(e,t){var r;e.exports=((r=Li).pad.Iso10126={pad:function(e,t){var i=4*t,n=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(n-1)).concat(r.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),Nt((function(e,t){var r;e.exports=((r=Li).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),Nt((function(e,t){var r;e.exports=((r=Li).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),Nt((function(e,t){var r;e.exports=((r=Li).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),Nt((function(e,t){var r;e.exports=(r=Li,function(e){var t=r,i=t.lib.CipherParams,n=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),Nt((function(e,t){var r;e.exports=(r=Li,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,n=[],s=[],a=[],o=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,s[p]=r;var _=e[r],m=e[_],g=e[m],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,d[r]=y<<8|y>>>24,l[r]=y,y=16843009*g^65537*m^257*_^16843008*r,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=_^e[e[e[g^_]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],_=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],a=0;a6&&a%r==4&&(l=n[l>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l]):(l=n[(l=l<<8|l>>>24)>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l],l^=p[a/r|0]<<24),s[a]=s[a-r]^l);for(var o=this._invKeySchedule=[],d=0;d>>24]]^u[n[l>>>16&255]]^h[n[l>>>8&255]]^f[n[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,d,l,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,a,o){for(var d=this._nRounds,l=e[t]^r[0],c=e[t+1]^r[1],u=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p>>24]^n[c>>>16&255]^s[u>>>8&255]^a[255&h]^r[f++],m=i[c>>>24]^n[u>>>16&255]^s[h>>>8&255]^a[255&l]^r[f++],g=i[u>>>24]^n[h>>>16&255]^s[l>>>8&255]^a[255&c]^r[f++],y=i[h>>>24]^n[l>>>16&255]^s[c>>>8&255]^a[255&u]^r[f++];l=_,c=m,u=g,h=y}_=(o[l>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^r[f++],m=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&l])^r[f++],g=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[l>>>8&255]<<8|o[255&c])^r[f++],y=(o[h>>>24]<<24|o[l>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],e[t]=_,e[t+1]=m,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(_)}(),r.AES)})),Nt((function(e,t){var r;e.exports=(r=Li,function(){var e=r,t=e.lib,i=t.WordArray,n=t.BlockCipher,s=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=s.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=a[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){var l=n[s]=[],c=d[s];for(r=0;r<24;r++)l[r/6|0]|=t[(o[r]-1+c)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(o[r+24]-1+c)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,a=this._rBlock,o=0,d=0;d<8;d++)o|=l[d][((a^n[d])&c[d])>>>0];this._lBlock=a,this._rBlock=s^o}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(i.create(t)),this._des2=u.createEncryptor(i.create(r)),this._des3=u.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(p)}(),r.TripleDES)})),Nt((function(e,t){var r;e.exports=(r=Li,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var s=0;n<256;n++){var a=n%r,o=t[a>>>2]>>>24-a%4*8&255;s=(s+i[n]+o)%256;var d=i[n];i[n]=i[s],i[s]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}e.RC4=t._createHelper(n);var a=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});e.RC4Drop=t._createHelper(a)}(),r.RC4)})),Nt((function(e,t){var r;e.exports=(r=Li,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],a=[],o=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)d.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,a=s[0],o=s[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(n[0]^=l,n[1]^=u,n[2]^=c,n[3]^=h,n[4]^=l,n[5]^=u,n[6]^=c,n[7]^=h,r=0;r<4;r++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,d=((n*n>>>17)+n*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(o)}(),r.Rabbit)})),Nt((function(e,t){var r;e.exports=(r=Li,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],a=[],o=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)d.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,a=s[0],o=s[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(i[0]^=l,i[1]^=u,i[2]^=c,i[3]^=h,i[4]^=l,i[5]^=u,i[6]^=c,i[7]^=h,n=0;n<4;n++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,d=((n*n>>>17)+n*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(o)}(),r.RabbitLegacy)})),Nt((function(e,t){var r;e.exports=(r=Li,function(){var e=r,t=e.lib.BlockCipher,i=e.algo;const n=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function d(e,t){let r=t>>24&255,i=t>>16&255,n=t>>8&255,s=255&t,a=e.sbox[0][r]+e.sbox[1][i];return a^=e.sbox[2][n],a+=e.sbox[3][s],a}function l(e,t,r){let i,s=t,a=r;for(let t=0;t1;--t)s^=e.pbox[t],a=d(e,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=e.pbox[1],s^=e.pbox[0],{left:s,right:a}}function u(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let i=0;for(let a=0;a=r&&(i=0);let o=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);const n=e.byteLength;let s=5;for(;sn)break;let o=e[s+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=e.slice(s+4+2,s+4+a);let n=new Pi.ModeOfOperation.ctr(t,new Pi.Counter(r));const o=n.decrypt(i);n=null,e.set(o,s+4+2)}s=s+4+a}return e}function zi(e,t,r){if(e.byteLength<=30)return e;const i=e.slice(32);let n=new Pi.ModeOfOperation.ctr(t,new Pi.Counter(r));const s=n.decrypt(i);return n=null,e.set(s,32),e}Nt((function(e,t){e.exports=Li}));var Ni=Nt((function(e,t){var r,n,s,a=(r=new Date,n=4,s={setLogLevel:function(e){n=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=n&&console.debug("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=n&&console.info("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=n&&console.warn("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=n&&console.error("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},s);a.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+a.getDurationString(e.start(i))+","+a.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=a;var o=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};o.prototype.getPosition=function(){return this.position},o.prototype.getEndPosition=function(){return this.buffer.byteLength},o.prototype.getLength=function(){return this.buffer.byteLength},o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},o.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},o.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},o.prototype.readUint8=function(){return this.readAnyInt(1,!1)},o.prototype.readUint16=function(){return this.readAnyInt(2,!1)},o.prototype.readUint24=function(){return this.readAnyInt(3,!1)},o.prototype.readUint32=function(){return this.readAnyInt(4,!1)},o.prototype.readUint64=function(){return this.readAnyInt(8,!1)},o.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),n=new Uint8Array(this._buffer);new Uint8Array(i,0,n.length).set(n),this.buffer=i,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,r,i,n){var s=new Uint8Array(e,t,n),a=new Uint8Array(r,i,n);s.set(a)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;rn;i--,n++){var s=t[n];t[n]=t[i],t[i]=s}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,a.debug("MultiBufferStream","Stream ready for parsing"),!0):(a.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(a.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){a.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},c.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}a.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,n,s)}}t&&(a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,r,i,n,s,o=[],d="";for(i=0,n=0,t=0;t0&&(d+=s.end-1+"]");var l=e?a.info:a.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+n+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,r){var i,n=null,s=-1;for(i=!0===e?0:this.bufferIndex;i=t?(a.debug("MultiBufferStream","Found position in existing buffer #"+s),s):-1},c.prototype.findEndContiguousBuf=function(e){var t,r,i,n=void 0!==e?e:this.bufferIndex;if(r=this.buffers[n],this.buffers.length>n+1)for(t=n+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){h.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){h.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){h.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(a.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+r),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):0!==l&&o+l>e.getEndPosition()?(e.seek(o),a.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:o}:(h[c+"Box"]?i=new h[c+"Box"](l):"uuid"!==c?(a.warn("BoxParser","Unknown box type: '"+c+"'"),(i=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[s]?i=new h.UUIDBoxes[s](l):(a.warn("BoxParser","Unknown uuid type: '"+s+"'"),(i=new h.Box(c,l)).uuid=s,i.has_unparsed_data=!0),i.hdr_size=d,i.start=o,i.write===h.Box.prototype.write&&"mdat"!==i.type&&(a.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(n=e.getPosition()-(i.start+i.size))<0?(a.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-n+" bytes), seeking forward"),e.seek(i.start+i.size)):n>0&&(a.error("BoxParser","Parsing of box '"+u+"' read "+n+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:h.OK,box:i,size:i.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)a.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void a.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else a.error("av1C reserved_1 parsing problem");else a.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=n>>1&31,i.bsmod=(1&n)<<4|s>>4&15,i.acmod=s>>1&7,i.lfeon=1&s,i.num_dep_sub=a>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&a)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),n=Math.min(127&i,r.length-1);if(n?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[n]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,r,i,n;this.configurationVersion=e.readUint8(),n=e.readUint8(),this.general_profile_space=n>>6,this.general_tier_flag=(32&n)>>5,this.general_profile_idc=31&n,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),n=e.readUint8(),this.constantFrameRate=n>>6,this.numTemporalLayers=(13&n)>>3,this.temporalIdNested=(4&n)>>2,this.lengthSizeMinusOne=3&n,this.nalu_arrays=[];var s=e.readUint8();for(t=0;t>7,a.nalu_type=63&n;var o=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),a.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?a.property_index=(127&s)<<8|e.readUint8():a.property_index=127&s}}})),h.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&n,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:a.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(a.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)a.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),a.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&n,i.subsegment_duration=e.readUint32(),n=e.readUint32(),i.starts_with_SAP=n>>31&1,i.SAP_type=n>>28&7,i.SAP_delta_time=268435455&n}})),h.SingleItemTypeReferenceBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var a=i.extract_bits(1);this.ptl_sublayer_present_mask|=a<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var n=!1,s="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||n)&&(s="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+s,n=!0);t+=s}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,n=[],s=0;for(s|=this.vvcC.ptl_frame_only_constraint<<7,s|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,n.push(s),s&&(i=e),s=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",o=0,d=0;for(e=0;e<=i;++e)for(o=o<<8|n[e],d+=8;d>=5;){r+=a[o>>d-5&31],o&=(1<<(d-=5))-1}d&&(r+=a[31&(o<<=5-d)])}}t+=r}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(r?"."+r:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),a.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof h.Box||t[r]instanceof h.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var n={};this.extractedTracks.push(n),n.id=e,n.user=t,n.trak=i,i.nextSample=0,n.nb_samples=1e3,n.samples=[],r&&r.nbSamples&&(n.nb_samples=r.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&a.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(a.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(a.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(a.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(a.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},g.prototype.getInfo=function(){var e,t,r,i,n,s,a={},o=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(o+1e3*this.moov.mvhd.creation_time),a.modified=new Date(o+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(a.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(a.debug("ISOFile","Sending samples on track #"+s.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(s.id,s.user,s.samples),s.samples=[],s!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var r=[];return g._sweep.call(this,e,r,t),r},g._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;g._sweep.call(this.boxes[i],e,t,r)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},g.prototype.releaseUsedSamples=function(e,t){var r=0,i=this.getTrackById(e);i.lastValidSample||(i.lastValidSample=0);for(var n=i.lastValidSample;ne*n.timescale){l=i-1;break}t&&n.is_sync&&(d=i)}for(t&&(l=d),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return s=r.samples[l].offset+r.samples[l].alreadyRead,a.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+a.getDurationString(e,o)+" and offset: "+s),{offset:s,time:e/o}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var r,i,n,s=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(n=0;nthis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){a=d;break}switch(a){case"Visual":if(n.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),s.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new o(t.avcDecoderConfigRecord)),s.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new o(t.hevcDecoderConfigRecord)),s.addBox(f)}break;case"Audio":n.add("smhd").set("balance",t.balance||0),s.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":n.add("hmhd");break;case"Subtitle":if(n.add("sthd"),"stpp"===t.type)s.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:n.add("nmhd")}t.description&&s.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){s.addBox(e)})),n.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=n.add("stbl");return p.add("stsd").addEntry(s),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,r){var i=r||{},n={},s=this.getTrackById(e);if(null!==s){n.number=s.samples.length,n.track_id=s.tkhd.track_id,n.timescale=s.mdia.mdhd.timescale,n.description_index=i.sample_description_index?i.sample_description_index-1:0,n.description=s.mdia.minf.stbl.stsd.entries[n.description_index],n.data=t,n.size=t.byteLength,n.alreadyRead=n.size,n.duration=i.duration||1,n.cts=i.cts||0,n.dts=i.dts||0,n.is_sync=i.is_sync||!1,n.is_leading=i.is_leading||0,n.depends_on=i.depends_on||0,n.is_depended_on=i.is_depended_on||0,n.has_redundancy=i.has_redundancy||0,n.degradation_priority=i.degradation_priority||0,n.offset=0,n.subsamples=i.subsamples,s.samples.push(n),s.samples_size+=n.size,s.samples_duration+=n.duration,void 0===s.first_dts&&(s.first_dts=i.dts),this.processSamples();var a=this.createSingleSampleMoof(n);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(t),n}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new h.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),n=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(n.first_dts||0)),i.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,r,i,n,s;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=n[a].grouping_type+"/0",(o=new l(n[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=o))}else for(a=0;a=2&&(d=i[a].grouping_type+"/0",o=new l(i[a].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=o))},g.setSampleGroupProperties=function(e,t,r,i){var n,s;for(n in t.sample_groups=[],i){var a;if(t.sample_groups[n]={},t.sample_groups[n].grouping_type=i[n].grouping_type,t.sample_groups[n].grouping_type_parameter=i[n].grouping_type_parameter,r>=i[n].last_sample_in_run&&(i[n].last_sample_in_run<0&&(i[n].last_sample_in_run=0),i[n].entry_index++,i[n].entry_index<=i[n].sbgp.entries.length-1&&(i[n].last_sample_in_run+=i[n].sbgp.entries[i[n].entry_index].sample_count)),i[n].entry_index<=i[n].sbgp.entries.length-1?t.sample_groups[n].group_description_index=i[n].sbgp.entries[i[n].entry_index].group_description_index:t.sample_groups[n].group_description_index=-1,0!==t.sample_groups[n].group_description_index)a=i[n].fragment_description?i[n].fragment_description:i[n].description,t.sample_groups[n].group_description_index>0?(s=t.sample_groups[n].group_description_index>65535?(t.sample_groups[n].group_description_index>>16)-1:t.sample_groups[n].group_description_index-1,a&&s>=0&&(t.sample_groups[n].description=a.entries[s])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[n].description=a.entries[a.default_group_description_index-1])}},g.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;ev&&(b++,v<0&&(v=0),v+=s.sample_counts[b]),t>0?(e.samples[t-1].duration=s.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,x.dts=e.samples[t-1].dts+e.samples[t-1].duration):x.dts=0,a?(t>=w&&(S++,w<0&&(w=0),w+=a.sample_counts[S]),x.cts=e.samples[t].dts+a.sample_offsets[S]):x.cts=x.dts,o?(t==o.sample_numbers[E]-1?(x.is_sync=!0,E++):(x.is_sync=!1,x.degradation_priority=0),l&&l.entries[A].sample_delta+B==t+1&&(x.subsamples=l.entries[A].subsamples,B+=l.entries[A].sample_delta,A++)):x.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,x,x.number),x.degradation_priority=h?h.priority[t]:0,l&&l.entries[A].sample_delta+B==t&&(x.subsamples=l.entries[A].subsamples,B+=l.entries[A].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,x,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,r,i,n,s,a,o,d,l,c,u,f,p,_;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,m.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+m.sample_composition_time_offset[r]),_=a,m.flags&h.TRUN_FLAGS_FLAGS?_=m.sample_flags[r]:0===r&&m.flags&h.TRUN_FLAGS_FIRST_FLAG&&(_=m.first_sample_flags),p.is_sync=!(_>>16&1),p.is_leading=_>>26&3,p.depends_on=_>>24&3,p.is_depended_on=_>>22&3,p.has_redundancy=_>>20&3,p.degradation_priority=65535&_;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),v=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(m.flags&h.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:v||0===t?l.start:o,p.offset=0===t&&0===r?b?w+m.data_offset:w:o,o=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var S=c.first_sample_index;for(t=0;t-1))return null;var s=(r=this.stream.buffers[n]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=s)return a.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===s)return null;a.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+s+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,s),i.alreadyRead+=s,r.usedBytes+=s,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.alreadyRead=0,r.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=s.ipro.protections[s.iinf.item_infos[e].protection_index-1]),s.iinf.item_infos[e].item_type?r.type=s.iinf.item_infos[e].item_type:r.type="mime",r.content_type=s.iinf.item_infos[e].content_type,r.content_encoding=s.iinf.item_infos[e].content_encoding;if(s.grpl)for(e=0;e0&&h.property_index-1-1))return null;var o=(t=this.stream.buffers[s]).byteLength-(n.offset+n.alreadyRead-t.fileStart);if(!(n.length-n.alreadyRead<=o))return a.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+o+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,o),n.alreadyRead+=o,r.alreadyRead+=o,t.usedBytes+=o,this.stream.logBufferLevel(),null;a.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+(n.length-n.alreadyRead)+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,n.length-n.alreadyRead),t.usedBytes+=n.length-n.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=n.length-n.alreadyRead,n.alreadyRead=n.length}}return r.alreadyRead===r.size?r:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var r=void 0===e||e,i=new g(t);return i.discardMdatData=!r,i}};t.createFile=y.createFile}));function Oi(e){return e.reduce(((e,t)=>256*e+t))}function Gi(e){const t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every(((e,t)=>e===i[t]))}Ni.Log,Ni.MP4BoxStream,Ni.DataStream,Ni.MultiBufferStream,Ni.MPEG4DescriptorParser,Ni.BoxParser,Ni.XMLSubtitlein4Parser,Ni.Textin4Parser,Ni.ISOFile,Ni.createFile;class Hi{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(r+32,r+32+t))]}return null}(t,this.t);if(!r)return e;const i=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(i instanceof Error)return console.error(i.message),this.d=!0,e;this.A=!0,this.u=r[1],Gi(t)&&this.c++,WebAssembly.instantiate(r[2],i).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}const $i=16,Vi=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],Wi=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function ji(e){const t=[];for(let r=0,i=e.length;r1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Yi(e){const t=[];for(let r=0,i=e.length;r>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function Ki(e){const t=[];for(let r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function Xi(e,t){const r=31&t;return e<>>32-r}function Zi(e){return(255&Vi[e>>>24&255])<<24|(255&Vi[e>>>16&255])<<16|(255&Vi[e>>>8&255])<<8|255&Vi[255&e]}function Ji(e){return e^Xi(e,2)^Xi(e,10)^Xi(e,18)^Xi(e,24)}function Qi(e){return e^Xi(e,13)^Xi(e,23)}function en(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[4*t],n[1]=255&e[4*t+1],n[2]=255&e[4*t+2],n[3]=255&e[4*t+3],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(let e,t=0;t<32;t+=4)e=i[1]^i[2]^i[3]^r[t+0],i[0]^=Ji(Zi(e)),e=i[2]^i[3]^i[0]^r[t+1],i[1]^=Ji(Zi(e)),e=i[3]^i[0]^i[1]^r[t+2],i[2]^=Ji(Zi(e)),e=i[0]^i[1]^i[2]^r[t+3],i[3]^=Ji(Zi(e));for(let e=0;e<16;e+=4)t[e]=i[3-e/4]>>>24&255,t[e+1]=i[3-e/4]>>>16&255,t[e+2]=i[3-e/4]>>>8&255,t[e+3]=255&i[3-e/4]}function tn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[0+4*t],n[1]=255&e[1+4*t],n[2]=255&e[2+4*t],n[3]=255&e[3+4*t],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let e,r=0;r<32;r+=4)e=i[1]^i[2]^i[3]^Wi[r+0],t[r+0]=i[0]^=Qi(Zi(e)),e=i[2]^i[3]^i[0]^Wi[r+1],t[r+1]=i[1]^=Qi(Zi(e)),e=i[3]^i[0]^i[1]^Wi[r+2],t[r+2]=i[2]^=Qi(Zi(e)),e=i[0]^i[1]^i[2]^Wi[r+3],t[r+3]=i[3]^=Qi(Zi(e));if(0===r)for(let e,r=0;r<16;r++)e=t[r],t[r]=t[31-r],t[31-r]=e}function rn(e,t,r){let{padding:i="pkcs#7",mode:n,iv:s=[],output:a="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===n&&("string"==typeof s&&(s=ji(s)),16!==s.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=ji(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Yi(e):ji(e):[...e],("pkcs#5"===i||"pkcs#7"===i)&&0!==r){const t=$i-e.length%$i;for(let r=0;r=$i;){const t=e.slice(u,u+16),i=new Array(16);if("cbc"===n)for(let e=0;e<$i;e++)0!==r&&(t[e]^=l[e]);en(t,i,o);for(let e=0;e<$i;e++)"cbc"===n&&0===r&&(i[e]^=l[e]),d[u+e]=i[e];"cbc"===n&&(l=0!==r?i:t),c-=$i,u+=$i}if(("pkcs#5"===i||"pkcs#7"===i)&&0===r){const e=d.length,t=d[e-1];for(let r=1;r<=t;r++)if(d[e-r]!==t)throw new Error("padding is invalid");d.splice(e-t,t)}return"array"!==a?0!==r?qi(d):Ki(d):d}function nn(e){return e[3]|e[2]<<8|e[1]<<16|e[0]<<24}function sn(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=e.byteLength;let n=5;for(;ni)break;let a=e[n+4],o=!1;if(r?(a=a>>>1&63,o=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(a)):(a&=31,o=1===a||5===a),o){const r=rn(e.slice(n+4+2,n+4+s),t,0,{padding:"none",output:"array"});e.set(r,n+4+2)}n=n+4+s}return e}class an{on(e,t,r){const i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){const i=this;function n(){i.off(e,n);for(var s=arguments.length,a=new Array(s),o=0;o1?r-1:0),n=1;n{delete r[e]})),void delete this.e;const i=r[e],n=[];if(i&&t)for(let e=0,r=i.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=on.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==on.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=on.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==on.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=on.findFirstStartCode}}}}function ln(e,t,r){for(let i=2;i3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=5;for(;sn)break;let o=e[s+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=ln(e.slice(s+4,s+4+a),t,r);e.set(i,s+4)}s=s+4+a}return e}function hn(){for(var e=arguments.length,t=new Array(e),r=0;re+t.byteLength),0));let n=0;return t.forEach((e=>{i.set(e,n),n+=e.byteLength})),i}class fn{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,r,i)));e.addEventListener(t,r,i);const n=()=>{lr(e.removeEventListener)&&e.removeEventListener(t,r,i)};return this.destroys.push(n),n}destroy(){this.master.debug&&this.master.debug.log("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class pn{static init(){pn.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in pn.types)pn.types.hasOwnProperty(e)&&(pn.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=pn.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=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]),e.HDLR_AUDIO=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]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,r=null,i=Array.prototype.slice.call(arguments,1),n=i.length;for(let e=0;e>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);let s=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,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]))}static trak(e){return pn.box(pn.types.trak,pn.tkhd(e),pn.mdia(e))}static tkhd(e){let t=e.id,r=e.duration,i=e.presentWidth,n=e.presentHeight;return pn.box(pn.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,n>>>8&255,255&n,0,0]))}static mdia(e){return pn.box(pn.types.mdia,pn.mdhd(e),pn.hdlr(e),pn.minf(e))}static mdhd(e){let t=e.timescale,r=e.duration;return pn.box(pn.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?pn.constants.HDLR_AUDIO:pn.constants.HDLR_VIDEO,pn.box(pn.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?pn.box(pn.types.smhd,pn.constants.SMHD):pn.box(pn.types.vmhd,pn.constants.VMHD),pn.box(pn.types.minf,t,pn.dinf(),pn.stbl(e))}static dinf(){return pn.box(pn.types.dinf,pn.box(pn.types.dref,pn.constants.DREF))}static stbl(e){return pn.box(pn.types.stbl,pn.stsd(e),pn.box(pn.types.stts,pn.constants.STTS),pn.box(pn.types.stsc,pn.constants.STSC),pn.box(pn.types.stsz,pn.constants.STSZ),pn.box(pn.types.stco,pn.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?pn.box(pn.types.stsd,pn.constants.STSD_PREFIX,pn.mp3(e)):pn.box(pn.types.stsd,pn.constants.STSD_PREFIX,pn.mp4a(e)):"avc"===e.videoType?pn.box(pn.types.stsd,pn.constants.STSD_PREFIX,pn.avc1(e)):pn.box(pn.types.stsd,pn.constants.STSD_PREFIX,pn.hvc1(e))}static mp3(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return pn.box(pn.types[".mp3"],i)}static mp4a(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return pn.box(pn.types.mp4a,i,pn.esds(e))}static esds(e){let t=e.config||[],r=t.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(t).concat([6,1,2]));return pn.box(pn.types.esds,i)}static avc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=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,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return pn.box(pn.types.avc1,n,pn.box(pn.types.avcC,t))}static hvc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=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,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return pn.box(pn.types.hvc1,n,pn.box(pn.types.hvcC,t))}static mvex(e){return pn.box(pn.types.mvex,pn.trex(e))}static trex(e){let t=e.id,r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return pn.box(pn.types.trex,r)}static moof(e,t){return pn.box(pn.types.moof,pn.mfhd(e.sequenceNumber),pn.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return pn.box(pn.types.mfhd,t)}static traf(e,t){let r=e.id,i=pn.box(pn.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),n=pn.box(pn.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),s=pn.sdtp(e),a=pn.trun(e,s.byteLength+16+16+8+16+8+8);return pn.box(pn.types.traf,i,n,a,s)}static sdtp(e){let t=new Uint8Array(5),r=e.flags;return t[4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy,pn.box(pn.types.sdtp,t)}static trun(e,t){let r=new Uint8Array(28);t+=36,r.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let i=e.duration,n=e.size,s=e.flags,a=e.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),pn.box(pn.types.trun,r)}static mdat(e){return pn.box(pn.types.mdat,e)}}pn.init();var _n,mn=Nt((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(_n=mn)&&_n.__esModule&&Object.prototype.hasOwnProperty.call(_n,"default")&&_n.default;const gn=[44100,48e3,32e3,0],yn=[22050,24e3,16e3,0],vn=[11025,12e3,8e3,0],bn=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],wn=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],Sn=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function En(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),r=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let i=t[1]>>>3&3,n=(6&t[1])>>1,s=(240&t[2])>>>4,a=(12&t[2])>>>2,o=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(i){case 0:d=vn[a];break;case 2:d=yn[a];break;case 3:d=gn[a]}switch(n){case 1:s=e[n]&&t=6?(i=5,t=new Array(4),a=n-3):(i=2,t=new Array(2),a=n):-1!==o.indexOf("android")?(i=2,t=new Array(2),a=n):(i=5,a=n,t=new Array(4),n>=6?a=n-3:1===s&&(i=2,t=new Array(2),a=n)),t[0]=i<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&s)<<3,5===i&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=zn[n],this.sampling_index=n,this.channel_count=s,this.object_type=i,this.original_object_type=r,this.codec_mimetype="mp4a.40."+i,this.original_codec_mimetype="mp4a.40."+r}}Date.now||(Date.now=function(){return(new Date).getTime()}),s({printErr:function(e){console.warn("JbPro[❌❌❌][worker]:",e)}}).then((e=>{!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],n=[],s={},a=new AbortController,o=null,d=null,l=null,c=null,u=!1,h=null,w=null,S=!1,x=!1,ve=!!gr(r),be=!1,$e=null,Ke=null,st=null,ht=[],ft=null,pt=null,_t=0,St=0,Et=null,xt=null,zt=0,Nt=0,Ot=!1,Gt=!1,Ht=!1,qt=null,Zt=null,ir=null,br=!1,wr=!0,Sr=()=>{const e=_r();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration}};"VideoEncoder"in self&&(s={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:new VideoDecoder({output:function(e){if(s.isEmitInfo||(ii.debug.log("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:T,w:e.codedWidth,h:e.codedHeight}),s.isEmitInfo=!0,s.offscreenCanvas=new OffscreenCanvas(e.codedWidth,e.codedHeight),s.offscreenCanvasCtx=s.offscreenCanvas.getContext("2d")),lr(e.createImageBitmap))e.createImageBitmap().then((t=>{s.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let r=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:k,buffer:r,delay:ii.delay,ts:0},[r]),hr(e)}));else{s.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:k,buffer:t,delay:ii.delay,ts:0},[t]),hr(e)}},error:function(e){ii.debug.error("worker","VideoDecoder error",e)}}),decode:function(e,t,r){const i=e[0]>>4==1;if(s.hasInit){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?dt:lt});s.decoder.decode(r)}else if(i&&0===e[1]){const t=15&e[0];postMessage({cmd:L,code:t});const r=new Uint8Array(e);postMessage({cmd:M,buffer:r,codecId:t},[r.buffer]);let i=null,n=null;const a=e.slice(5);t===Ie?(n=Tr(a),i={codec:n.codec,description:a}):t===Fe&&(n=Vr(a),i={codec:n.codec,description:a}),n&&n.codecWidth&&n.codecHeight&&(i.codedHeight=n.codecHeight,i.codedWidth=n.codecWidth);try{s.decoder.configure(i),s.hasInit=!0}catch(e){ii.debug.log("worker","VideoDecoder configure error",e.code,e)}}},reset(){s.hasInit=!1,s.isEmitInfo=!1,s.offscreenCanvas=null,s.offscreenCanvasCtx=null}});let Er=function(){if(br=!0,ii.fetchStatus!==kt||yr(ii._opt.isChrome)){if(a)try{a.abort(),a=null}catch(e){ii.debug.log("worker","abort catch",e)}}else a=null,ii.debug.log("worker",`abort() and not abortController.abort() _status is ${ii.fetchStatus} and _isChrome is ${ii._opt.isChrome}`)},Ur={init(){Ur.lastBuf=null,Ur.vps=null,Ur.sps=null,Ur.pps=null,Ur.streamType=null,Ur.localDts=0,Ur.isSendSeqHeader=!1},destroy(){Ur.lastBuf=null,Ur.vps=null,Ur.sps=null,Ur.pps=null,Ur.streamType=null,Ur.localDts=0,Ur.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);Ur.extractNALu$2(t)},getNaluDts(){let e=Ur.localDts;return Ur.localDts=Ur.localDts+40,e},getNaluAudioDts(){const e=ii._opt.sampleRate,t=ii._opt.audioBufferSize;return Ur.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,r,i=0,n=e.byteLength,s=0,a=[];for(;i1)for(let e=0;e{const t=Fr(e);t===He||t===Ge?Ur.handleVideoH264Nalu(e):Lr(t)&&i.push(e)})),1===i.length)Ur.handleVideoH264Nalu(i[0]);else if(Rr(i)){const e=Fr(i[0]),t=Mr(e);Ur.handleVideoH264NaluList(i,t,e)}else i.forEach((e=>{Ur.handleVideoH264Nalu(e)}))}else if(Ur.streamType===Me)if(ii._opt.nakedFlowH265DemuxUseNew){const t=Ur.handleAddNaluStartCode(e),r=Ur.extractNALu(t);if(0===r.length)return void ii.debug.warn("worker","handleVideoNalu","h265 naluList.length === 0");const i=[];if(r.forEach((e=>{const t=Kr(e);t===it||t===tt||t===Qe?Ur.handleVideoH265Nalu(e):Zr(t)&&i.push(e)})),1===i.length)Ur.handleVideoH265Nalu(i[0]);else if(Qr(i)){const e=Kr(i[0]),t=Jr(e);Ur.handleVideoH265NaluList(i,t,e)}else i.forEach((e=>{Ur.handleVideoH265Nalu(e)}))}else Kr(e)===it?Ur.extractH265PPS(e):Ur.handleVideoH265Nalu(e)},extractH264PPS(e){const t=Ur.handleAddNaluStartCode(e);Ur.extractNALu(t).forEach((e=>{Pr(Fr(e))?Ur.extractH264SEI(e):Ur.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=Ur.handleAddNaluStartCode(e);Ur.extractNALu(t).forEach((e=>{Xr(Kr(e))?Ur.extractH265SEI(e):Ur.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=Ur.handleAddNaluStartCode(e);Ur.extractNALu(t).forEach((e=>{Ur.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=Ur.handleAddNaluStartCode(e);Ur.extractNALu(t).forEach((e=>{Ur.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],r=new Uint8Array(e.length+t.length);return r.set(t),r.set(e,t.length),r},handleVideoH264Nalu(e){const t=Fr(e);switch(t){case Ge:Ur.sps=e;break;case He:Ur.pps=e}if(Ur.isSendSeqHeader){if(Ur.sps&&Ur.pps){const e=kr({sps:Ur.sps,pps:Ur.pps}),t=Ur.getNaluDts();ii.decode(e,{type:se,ts:t,isIFrame:!0,cts:0}),Ur.sps=null,Ur.pps=null}if(Lr(t)){const r=Mr(t),i=Ur.getNaluDts(),n=Dr(e,r);Ur.doDecode(n,{type:se,ts:i,isIFrame:r,cts:0})}else ii.debug.warn("work",`handleVideoH264Nalu Avc Seq Head is ${t}`)}else if(Ur.sps&&Ur.pps){Ur.isSendSeqHeader=!0;const e=kr({sps:Ur.sps,pps:Ur.pps});ii.decode(e,{type:se,ts:0,isIFrame:!0,cts:0}),Ur.sps=null,Ur.pps=null}},handleVideoH264NaluList(e,t,r){if(Ur.isSendSeqHeader){const i=Ur.getNaluDts(),n=Ir(e.reduce(((e,t)=>{const r=Qt(e),i=Qt(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Ur.doDecode(n,{type:se,ts:i,isIFrame:t,cts:0}),ii.debug.log("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}else ii.debug.warn("worker","handleVideoH264NaluList isSendSeqHeader is false")},handleVideoH265Nalu(e){const t=Kr(e);switch(t){case Qe:Ur.vps=e;break;case tt:Ur.sps=e;break;case it:Ur.pps=e}if(Ur.isSendSeqHeader){if(Ur.vps&&Ur.sps&&Ur.pps){const e=jr({vps:Ur.vps,sps:Ur.sps,pps:Ur.pps}),t=Ur.getNaluDts();ii.decode(e,{type:se,ts:t,isIFrame:!0,cts:0}),Ur.vps=null,Ur.sps=null,Ur.pps=null}if(Zr(t)){const r=Jr(t),i=Ur.getNaluDts(),n=qr(e,r);Ur.doDecode(n,{type:se,ts:i,isIFrame:r,cts:0})}else ii.debug.warn("work",`handleVideoH265Nalu HevcSeqHead is ${t}`)}else if(Ur.vps&&Ur.sps&&Ur.pps){Ur.isSendSeqHeader=!0;const e=jr({vps:Ur.vps,sps:Ur.sps,pps:Ur.pps});ii.decode(e,{type:se,ts:0,isIFrame:!0,cts:0}),Ur.vps=null,Ur.sps=null,Ur.pps=null}},handleVideoH265NaluList(e,t,r){if(Ur.isSendSeqHeader){const i=Ur.getNaluDts(),n=Yr(e.reduce(((e,t)=>{const r=Qt(e),i=Qt(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Ur.doDecode(n,{type:se,ts:i,isIFrame:t,cts:0}),ii.debug.log("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}else ii.debug.warn("worker","handleVideoH265NaluList isSendSeqHeader is false")},doDecode(e,t){ii.calcNetworkDelay(t.ts),t.isIFrame&&ii.calcIframeIntervalTimestamp(t.ts),ii.decode(e,t)}},Or={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){Or.mp4Box=Ni.createFile(),Or.mp4Box.onReady=Or.onReady,Or.mp4Box.onError=Or.onError,Or.mp4Box.onSamples=Or.onSamples},initTransportDescarmber(){Or.transportDescarmber=new Hi},_getSeqHeader(e){const t=Or.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new Ni.DataStream(void 0,0,Ni.DataStream.BIG_ENDIAN);let r=[];e.avcC?(e.avcC.write(t),r=[23,0,0,0,0]):(Or.isHevc=!0,qt=!0,e.hvcC.write(t),r=[28,0,0,0,0]);const i=new Uint8Array(t.buffer,8),n=new Uint8Array(r.length+i.length);return n.set(r,0),n.set(i,r.length),n}return null},onReady(e){ii.debug.log(Or.LOG_NAME,"onReady()");const t=e.videoTracks[0],r=e.audioTracks[0];if(t){Or.videoTrackId=t.id;const e=Or._getSeqHeader(t);e&&(ii.debug.log(Or.LOG_NAME,"seqHeader"),ii.decodeVideo(e,0,!0,0)),Or.mp4Box.setExtractionOptions(t.id)}if(r&&ii._opt.hasAudio){Or.audioTrackId=r.id;const e=r.audio||{},t=$t.indexOf(e.sample_rate),i=r.codec.replace("mp4a.40.","");Or.mp4Box.setExtractionOptions(r.id);const n=Vt({profile:parseInt(i,10),sampleRate:t,channel:e.channel_count});ii.debug.log(Or.LOG_NAME,"aacADTSHeader"),ii.decodeAudio(n,0)}Or.mp4Box.start()},onError(e){ii.debug.error(Or.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,r){if(e===Or.videoTrackId)for(const t of r){const r=t.data,i=t.is_sync,n=1e3*t.cts/t.timescale;t.duration,t.timescale,i&&ii.calcIframeIntervalTimestamp(n);let s=null;s=Or.isHevc?Yr(r,i):Ir(r,i),ii.decode(s,{type:se,ts:n,isIFrame:i,cts:0}),Or.mp4Box.releaseUsedSamples(e,t.number)}else if(e===Or.audioTrackId){if(ii._opt.hasAudio)for(const t of r){const r=t.data,i=1e3*t.cts/t.timescale;t.duration,t.timescale;const n=new Uint8Array(r.byteLength+2);n.set([175,1],0),n.set(r,2),ii.decode(n,{type:ne,ts:i,isIFrame:!1,cts:0}),Or.mp4Box.releaseUsedSamples(e,t.number)}}else ii.debug.warn(Or.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);Or.transportDescarmber&&(t=Or.transportDescarmber.transport(t)),t.buffer.fileStart=Or.offset,Or.offset+=t.byteLength,Or.mp4Box.appendBuffer(t.buffer)},destroy(){Or.mp4Box&&(Or.mp4Box.stop(),Or.mp4Box.flush(),Or.mp4Box.destroy(),Or.mp4Box=null),Or.transportDescarmber&&(Or.transportDescarmber.destroy(),Or.transportDescarmber=null),Or.offset=0,Or.videoTrackId=null,Or.audioTrackId=null,Or.isHevc=!1}},Gr={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);Gr.extractNALu(t)},destroy(){Gr.lastBuffer=new Uint8Array(0),Gr.parsedOffset=0,Gr.firstStartCodeOffset=0,Gr.secondStartCodeOffset=0,Gr.state="init",Gr.hasInitVideoCodec=!1,Gr.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void ii.debug.warn(Gr.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(Gr.lastBuffer.length+e.length);for(t.set(Gr.lastBuffer,0),t.set(new Uint8Array(e),Gr.lastBuffer.length),Gr.lastBuffer=t;;){if("init"===Gr.state){let e=!1;for(;Gr.lastBuffer.length-Gr.parsedOffset>=4;)if(0===Gr.lastBuffer[Gr.parsedOffset])if(0===Gr.lastBuffer[Gr.parsedOffset+1])if(1===Gr.lastBuffer[Gr.parsedOffset+2]){if(182===Gr.lastBuffer[Gr.parsedOffset+3]){Gr.state="findFirstStartCode",Gr.firstStartCodeOffset=Gr.parsedOffset,Gr.parsedOffset+=4,e=!0;break}Gr.parsedOffset++}else Gr.parsedOffset++;else Gr.parsedOffset++;else Gr.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===Gr.state){let e=!1;for(;Gr.lastBuffer.length-Gr.parsedOffset>=4;)if(0===Gr.lastBuffer[Gr.parsedOffset])if(0===Gr.lastBuffer[Gr.parsedOffset+1])if(1===Gr.lastBuffer[Gr.parsedOffset+2]){if(182===Gr.lastBuffer[Gr.parsedOffset+3]){Gr.state="findSecondStartCode",Gr.secondStartCodeOffset=Gr.parsedOffset,Gr.parsedOffset+=4,e=!0;break}Gr.parsedOffset++}else Gr.parsedOffset++;else Gr.parsedOffset++;else Gr.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===Gr.state){if(!(Gr.lastBuffer.length-Gr.parsedOffset>0))break;{let e,t,r=192&Gr.lastBuffer[Gr.parsedOffset];e=0==r?Gr.secondStartCodeOffset-14:Gr.secondStartCodeOffset;let i=0==(192&Gr.lastBuffer[Gr.firstStartCodeOffset+4]);if(i){if(Gr.firstStartCodeOffset-14<0)return void ii.debug.warn(Gr.LOG_NAME,"firstStartCodeOffset -14 is",Gr.firstStartCodeOffset-14);Gr.hasInitVideoCodec||(Gr.hasInitVideoCodec=!0,ii.debug.log(Gr.LOG_NAME,"setCodec"),si.setCodec(Pe,"")),t=Gr.lastBuffer.subarray(Gr.firstStartCodeOffset-14,e)}else t=Gr.lastBuffer.subarray(Gr.firstStartCodeOffset,e);let n=Gr.getNaluDts();Gr.hasInitVideoCodec?(postMessage({cmd:O,type:Ae,value:t.byteLength}),postMessage({cmd:O,type:Be,value:n}),si.decode(t,i?1:0,n)):ii.debug.warn(Gr.LOG_NAME,"has not init video codec"),Gr.lastBuffer=Gr.lastBuffer.subarray(e),Gr.firstStartCodeOffset=0==r?14:0,Gr.parsedOffset=Gr.firstStartCodeOffset+4,Gr.state="findFirstStartCode"}}}},getNaluDts(){let e=Gr.localDts;return Gr.localDts=Gr.localDts+40,e}},Wr={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new Nn,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){Wr.media_info_=null,Wr.pes_slice_queues_=null,Wr.section_slice_queues_=null,Wr.video_metadata_=null,Wr.audio_metadata_=null,Wr.aac_last_incomplete_data_=null,Wr.video_track_=null,Wr.audio_track_=null,Wr._remainingPacketData=null},probe(e){let t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){let e=Math.min(1e3,t.byteLength-3*i);for(let n=0;n=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){Wr._remainingPacketData&&(e=hn(Wr._remainingPacketData,e),Wr._remainingPacketData=null);let t=e.buffer;const r=Wr.parseChunks(t);r?Wr._remainingPacketData=e.subarray(r):e.length>>6;r[1];let s=(31&r[1])<<8|r[2],a=(48&r[3])>>>4,o=15&r[3],d=!(!Wr.pmt_||Wr.pmt_.pcr_pid!==s),l={},c=4;if(2==a||3==a){let e=r[4];if(e>0&&(d||3==a)&&(l.discontinuity_indicator=(128&r[5])>>>7,l.random_access_indicator=(64&r[5])>>>6,l.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){let e=300*(r[6]<<25|r[7]<<17|r[8]<<9|r[9]<<1|r[10]>>>7)+((1&r[10])<<8|r[11]);Wr.last_pcr_=e}if(2==a||5+e===188){t+=188,204===Wr.tsPacketSize&&(t+=16);continue}c=5+e}if(1==a||3==a)if(0===s||s===Wr.current_pmt_pid_||null!=Wr.pmt_&&Wr.pmt_.pid_stream_type[s]===In){let r=188-c;Wr.handleSectionSlice(e,t+c,r,{pid:s,payload_unit_start_indicator:n,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}else if(null!=Wr.pmt_&&null!=Wr.pmt_.pid_stream_type[s]){let r=188-c,i=Wr.pmt_.pid_stream_type[s];s!==Wr.pmt_.common_pids.h264&&s!==Wr.pmt_.common_pids.h265&&s!==Wr.pmt_.common_pids.adts_aac&&s!==Wr.pmt_.common_pids.loas_aac&&s!==Wr.pmt_.common_pids.ac3&&s!==Wr.pmt_.common_pids.eac3&&s!==Wr.pmt_.common_pids.opus&&s!==Wr.pmt_.common_pids.mp3&&!0!==Wr.pmt_.pes_private_data_pids[s]&&!0!==Wr.pmt_.timed_id3_pids[s]&&!0!==Wr.pmt_.synchronous_klv_pids[s]&&!0!==Wr.pmt_.asynchronous_klv_pids[s]||Wr.handlePESSlice(e,t+c,r,{pid:s,stream_type:i,payload_unit_start_indicator:n,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}t+=188,204===Wr.tsPacketSize&&(t+=16)}return Wr.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=Wr.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){let a=n[0];if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t+1,Math.min(r,a));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?Wr.emitSectionSlices(s,i):Wr.clearSlices(s,i)}for(let o=1+a;o=s.expected_length&&Wr.clearSlices(s,i),o+=d.byteLength}}else if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t,Math.min(r,s.expected_length-s.total_length));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?Wr.emitSectionSlices(s,i):s.total_length>=s.expected_length&&Wr.clearSlices(s,i)}},handlePESSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=n[0]<<16|n[1]<<8|n[2];n[3];let a=n[4]<<8|n[5];if(i.payload_unit_start_indicator){if(1!==s)return void ii.debug.warn(Wr.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${s}`);let e=Wr.pes_slice_queues_[i.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?Wr.emitPESSlices(e,i):Wr.clearSlices(e,i)),Wr.pes_slice_queues_[i.pid]=new Ln,Wr.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null==Wr.pes_slice_queues_[i.pid])return;let o=Wr.pes_slice_queues_[i.pid];o.slices.push(n),i.payload_unit_start_indicator&&(o.expected_length=0===a?0:a+6),o.total_length+=n.byteLength,o.expected_length>0&&o.expected_length===o.total_length?Wr.emitPESSlices(o,i):o.expected_length>0&&o.expected_length>>6,o=t[8];2!==a&&3!==a||(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,s=3===a?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:r);let d,l=9+o;if(0!==n){if(n<3+o)return void ii.debug.warn(Wr.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=n-3-o}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case An:case Bn:Wr.parseMP3Payload(c,r);break;case xn:Wr.pmt_.common_pids.opus===e.pid||Wr.pmt_.common_pids.ac3===e.pid||Wr.pmt_.common_pids.eac3===e.pid||(Wr.pmt_.asynchronous_klv_pids[e.pid]?Wr.parseAsynchronousKLVMetadataPayload(c,e.pid,i):Wr.pmt_.smpte2038_pids[e.pid]?Wr.parseSMPTE2038MetadataPayload(c,r,s,e.pid,i):Wr.parsePESPrivateDataPayload(c,r,s,e.pid,i));break;case Un:Wr.parseADTSAACPayload(c,r);break;case Tn:Wr.parseLOASAACPayload(c,r);break;case kn:case Cn:break;case Dn:Wr.pmt_.timed_id3_pids[e.pid]?Wr.parseTimedID3MetadataPayload(c,r,s,e.pid,i):Wr.pmt_.synchronous_klv_pids[e.pid]&&Wr.parseSynchronousKLVMetadataPayload(c,r,s,e.pid,i);break;case Fn:Wr.parseH264Payload(c,r,s,e.random_access_indicator);break;case Pn:Wr.parseH265Payload(c,r,s,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===xn){let r,s=6;r=0!==n?n:t.byteLength-s;let a=t.subarray(s,s+r);Wr.parsePESPrivateDataPayload(a,void 0,void 0,e.pid,i)}}else ii.debug.error(Wr.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${r}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(Wr.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let r=(15&e[1])<<8|e[2];e[3],e[4];let i=(62&e[5])>>>1,n=1&e[5],s=e[6];e[7];let a=null;if(1===n&&0===s)a={version_number:0,network_pid:0,program_pmt_pid:{}},a.version_number=i;else if(a=Wr.pat_,null==a)return;let o=r-5-4,d=-1,l=-1;for(let t=8;t<8+o;t+=4){let r=e[t]<<8|e[t+1],i=(31&e[t+2])<<8|e[t+3];0===r?a.network_pid=i:(a.program_pmt_pid[r]=i,-1===d&&(d=r),-1===l&&(l=i))}1===n&&0===s&&(null==Wr.pat_&&ii.debug.log(Wr.TAG_NAME,`Parsed first PAT: ${JSON.stringify(a)}`),Wr.pat_=a,Wr.current_program_=d,Wr.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void ii.debug.error(Wr.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let r,i=(15&e[1])<<8|e[2],n=e[3]<<8|e[4],s=(62&e[5])>>>1,a=1&e[5],o=e[6];if(e[7],1===a&&0===o)r=Wr._initPmt(),r.program_number=n,r.version_number=s,Wr.program_pmt_map_[n]=r;else if(r=Wr.program_pmt_map_[n],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=i-9-d-4;for(let t=l;t0){for(let i=t+5;i0)for(let i=t+5;iWr.has_video_&&Wr.has_audio_?Wr.video_init_segment_dispatched_&&Wr.audio_init_segment_dispatched_:Wr.has_video_&&!Wr.has_audio_?Wr.video_init_segment_dispatched_:!(Wr.has_video_||!Wr.has_audio_)&&Wr.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=Wr.video_metadata_.details,t={type:"video"};t.id=Wr.video_track_.id,t.timescale=1e3,t.duration=Wr.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let r=t.frameRate.fps_den,i=t.frameRate.fps_num;if(t.refSampleDuration=r/i*1e3,t.codec=e.codec_mimetype,Wr.video_metadata_.vps){let e=Wr.video_metadata_.vps.data.subarray(4),r=Wr.video_metadata_.sps.data.subarray(4),i=Wr.video_metadata_.pps.data.subarray(4);t.hvcc=jr({vps:e,sps:r,pps:i}),0==Wr.video_init_segment_dispatched_&&ii.debug.log(Wr.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&ii.decodeVideo(t.hvcc,0,!0,0)}else{let e=Wr.video_metadata_.sps.data.subarray(4),r=Wr.video_metadata_.pps.data.subarray(4);t.avcc=Cr({sps:e,pps:r}),0==Wr.video_init_segment_dispatched_&&ii.debug.log(Wr.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&ii.decodeVideo(t.avcc,0,!0,0)}Wr.video_init_segment_dispatched_=!0,Wr.video_metadata_changed_=!1;let n=Wr.media_info_;n.hasVideo=!0,n.width=t.codecWidth,n.height=t.codecHeight,n.fps=t.frameRate.fps,n.profile=t.profile,n.level=t.level,n.refFrames=e.ref_frames,n.chromaFormat=e.chroma_format_string,n.sarNum=t.sarRatio.width,n.sarDen=t.sarRatio.height,n.videoCodec=t.codec,n.hasAudio&&n.audioCodec?n.mimeType=`video/mp2t; codecs="${n.videoCodec},${n.audioCodec}"`:n.mimeType=`video/mp2t; codecs="${n.videoCodec}"`},dispatchVideoMediaSegment(){Wr.isInitSegmentDispatched()&&Wr.video_track_.length&&Wr._preDoDecode()},dispatchAudioMediaSegment(){Wr.isInitSegmentDispatched()&&Wr.audio_track_.length&&Wr._preDoDecode()},dispatchAudioVideoMediaSegment(){Wr.isInitSegmentDispatched()&&(Wr.audio_track_.length||Wr.video_track_.length)&&Wr._preDoDecode()},parseADTSAACPayload(e,t){if(Wr.has_video_&&!Wr.video_init_segment_dispatched_)return;if(Wr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+Wr.aac_last_incomplete_data_.byteLength);t.set(Wr.aac_last_incomplete_data_,0),t.set(e,Wr.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/Wr.timescale_),"aac"===Wr.audio_metadata_.codec){if(null==t&&null!=Wr.audio_last_sample_pts_)r=1024/Wr.audio_metadata_.sampling_frequency*1e3,i=Wr.audio_last_sample_pts_+r;else if(null==t)return void ii.debug.warn(Wr.TAG_NAME,"AAC: Unknown pts");if(Wr.aac_last_incomplete_data_&&Wr.audio_last_sample_pts_){r=1024/Wr.audio_metadata_.sampling_frequency*1e3;let e=Wr.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(ii.debug.warn(Wr.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Kt(e),a=null,o=i;for(;null!=(a=s.readNextAACFrame());){r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==Wr.audio_init_segment_dispatched_?(Wr.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},Wr.dispatchAudioInitSegment(e)):Wr.detectAudioMetadataChange(e)&&(Wr.dispatchAudioMediaSegment(),Wr.dispatchAudioInitSegment(e)),n=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:ne};Wr.audio_track_.samples.push(s),Wr.audio_track_.length+=i.byteLength,o+=r}s.hasIncompleteData()&&(Wr.aac_last_incomplete_data_=s.getIncompleteData()),n&&(Wr.audio_last_sample_pts_=n)},parseLOASAACPayload(e,t){if(Wr.has_video_&&!Wr.video_init_segment_dispatched_)return;if(Wr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+Wr.aac_last_incomplete_data_.byteLength);t.set(Wr.aac_last_incomplete_data_,0),t.set(e,Wr.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/Wr.timescale_),"aac"===Wr.audio_metadata_.codec){if(null==t&&null!=Wr.audio_last_sample_pts_)r=1024/Wr.audio_metadata_.sampling_frequency*1e3,i=Wr.audio_last_sample_pts_+r;else if(null==t)return void ii.debug.warn(Wr.TAG_NAME,"AAC: Unknown pts");if(Wr.aac_last_incomplete_data_&&Wr.audio_last_sample_pts_){r=1024/Wr.audio_metadata_.sampling_frequency*1e3;let e=Wr.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(ii.debug.warn(Wr.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Xt(e),a=null,o=i;for(;null!=(a=s.readNextAACFrame(or(this.loas_previous_frame)?void 0:this.loas_previous_frame));){Wr.loas_previous_frame=a,r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==Wr.audio_init_segment_dispatched_?(Wr.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},Wr.dispatchAudioInitSegment(e)):Wr.detectAudioMetadataChange(e)&&(Wr.dispatchAudioMediaSegment(),Wr.dispatchAudioInitSegment(e)),n=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:ne};Wr.audio_track_.samples.push(s),Wr.audio_track_.length+=i.byteLength,o+=r}s.hasIncompleteData()&&(Wr.aac_last_incomplete_data_=s.getIncompleteData()),n&&(Wr.audio_last_sample_pts_=n)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(Wr.has_video_&&!Wr.video_init_segment_dispatched_)return;let r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],n=[11025,12e3,8e3,0],s=e[1]>>>3&3,a=(6&e[1])>>1;e[2];let o=(12&e[2])>>>2,d=3!=(e[3]>>>6&3)?2:1,l=0,c=34;switch(s){case 0:l=n[o];break;case 2:l=i[o];break;case 3:l=r[o]}switch(a){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==Wr.audio_init_segment_dispatched_?(Wr.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},Wr.dispatchAudioInitSegment(h)):Wr.detectAudioMetadataChange(h)&&(Wr.dispatchAudioMediaSegment(),Wr.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/Wr.timescale_,dts:t/Wr.timescale_,type:ne};Wr.audio_track_.samples.push(f),Wr.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==Wr.audio_metadata_.codec)return ii.debug.log(Wr.TAG_NAME,`Audio: Audio Codecs changed from ${Wr.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===Wr.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==Wr.audio_metadata_.audio_object_type)return ii.debug.log(Wr.TAG_NAME,`AAC: AudioObjectType changed from ${Wr.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==Wr.audio_metadata_.sampling_freq_index)return ii.debug.log(Wr.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${Wr.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==Wr.audio_metadata_.channel_config)return ii.debug.log(Wr.TAG_NAME,`AAC: Channel configuration changed from ${Wr.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===Wr.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==Wr.audio_metadata_.sampling_frequency)return ii.debug.log(Wr.TAG_NAME,`AC3: Sampling Frequency changed from ${Wr.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==Wr.audio_metadata_.bit_stream_identification)return ii.debug.log(Wr.TAG_NAME,`AC3: Bit Stream Identification changed from ${Wr.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==Wr.audio_metadata_.bit_stream_mode)return ii.debug.log(Wr.TAG_NAME,`AC3: BitStream Mode changed from ${Wr.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==Wr.audio_metadata_.channel_mode)return ii.debug.log(Wr.TAG_NAME,`AC3: Channel Mode changed from ${Wr.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==Wr.audio_metadata_.low_frequency_effects_channel_on)return ii.debug.log(Wr.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${Wr.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===Wr.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==Wr.audio_metadata_.sample_rate)return ii.debug.log(Wr.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${Wr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==Wr.audio_metadata_.channel_count)return ii.debug.log(Wr.TAG_NAME,`Opus: Channel count changed from ${Wr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===Wr.audio_metadata_.codec){const t=e.data;if(t.object_type!==Wr.audio_metadata_.object_type)return ii.debug.log(Wr.TAG_NAME,`MP3: AudioObjectType changed from ${Wr.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==Wr.audio_metadata_.sample_rate)return ii.debug.log(Wr.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${Wr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==Wr.audio_metadata_.channel_count)return ii.debug.log(Wr.TAG_NAME,`MP3: Channel count changed from ${Wr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=Wr.audio_track_.id,t.timescale=1e3,t.duration=Wr.duration_,"aac"===Wr.audio_metadata_.codec){let r="aac"===e.codec?e.data:null,i=new On(r);t.audioSampleRate=i.sampling_rate,t.audioSampleRateIndex=i.sampling_index,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const n=Vt({profile:ii._opt.mseDecodeAudio?i.object_type:i.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});ii.decodeAudio(n,0)}else"ac-3"===Wr.audio_metadata_.codec||"ec-3"===Wr.audio_metadata_.codec||"opus"===Wr.audio_metadata_.codec||"mp3"===Wr.audio_metadata_.codec&&(t.audioSampleRate=Wr.audio_metadata_.sample_rate,t.channelCount=Wr.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==Wr.audio_init_segment_dispatched_&&ii.debug.log(Wr.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),Wr.audio_init_segment_dispatched_=!0,Wr.video_metadata_changed_=!1;let r=Wr.media_info_;r.hasAudio=!0,r.audioCodec=t.originalCodec,r.audioSampleRate=t.audioSampleRate,r.audioChannelCount=t.channelCount,r.hasVideo&&r.videoCodec?r.mimeType=`video/mp2t; codecs="${r.videoCodec},${r.audioCodec}"`:r.mimeType=`video/mp2t; codecs="${r.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,r){},parsePESPrivateDataPayload(e,t,r,i,n){let s=new Rn;if(s.pid=i,s.stream_id=n,s.len=e.byteLength,s.data=e,null!=t){let e=Math.floor(t/Wr.timescale_);s.pts=e}else s.nearest_pts=Wr.getNearestTimestampMilliseconds();if(null!=r){let e=Math.floor(r/Wr.timescale_);s.dts=e}},parseTimedID3MetadataPayload(e,t,r,i,n){ii.debug.log(Wr.TAG_NAME,`Timed ID3 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseSynchronousKLVMetadataPayload(e,t,r,i,n){ii.debug.log(Wr.TAG_NAME,`Synchronous KLV Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseAsynchronousKLVMetadataPayload(e,t,r){ii.debug.log(Wr.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${r}`)},parseSMPTE2038MetadataPayload(e,t,r,i,n){ii.debug.log(Wr.TAG_NAME,`SMPTE 2038 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},getNearestTimestampMilliseconds:()=>null!=Wr.audio_last_sample_pts_?Math.floor(Wr.audio_last_sample_pts_):null!=Wr.last_pcr_?Math.floor(Wr.last_pcr_/300/Wr.timescale_):void 0,_preDoDecode(){const e=Wr.video_track_,t=Wr.audio_track_;let r=e.samples;t.samples.length>0&&(r=e.samples.concat(t.samples),r=r.sort(((e,t)=>e.dts-t.dts))),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===se?Wr._doDecodeVideo({...e,payload:t}):e.type===ne&&Wr._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let r=null;r=e.isHevc?Yr(t,e.isIFrame):Ir(t,e.isIFrame),e.isIFrame&&ii.calcIframeIntervalTimestamp(e.dts);let i=ii.cryptoPayload(r,e.isIFrame);ii.decode(i,{type:se,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let r=t;gr(ii._opt.m7sCryptoAudio)&&(r=ii.cryptoPayloadAudio(t)),ii.decode(r,{type:ne,ts:e.dts,isIFrame:!1,cts:0})}},ri=null;vr()&&(ri={TAG_NAME:"worker MediaSource",_resetInIt(){ri.isAvc=null,ri.isAAC=null,ri.videoInfo={},ri.videoMeta={},ri.audioMeta={},ri.sourceBuffer=null,ri.audioSourceBuffer=null,ri.hasInit=!1,ri.hasAudioInit=!1,ri.isAudioInitInfo=!1,ri.videoMimeType="",ri.audioMimeType="",ri.cacheTrack={},ri.cacheAudioTrack={},ri.timeInit=!1,ri.sequenceNumber=0,ri.audioSequenceNumber=0,ri.firstRenderTime=null,ri.firstAudioTime=null,ri.mediaSourceAppendBufferFull=!1,ri.mediaSourceAppendBufferError=!1,ri.mediaSourceAddSourceBufferError=!1,ri.mediaSourceBufferError=!1,ri.mediaSourceError=!1,ri.prevTimestamp=null,ri.decodeDiffTimestamp=null,ri.prevDts=null,ri.prevAudioDts=null,ri.prevPayloadBufferSize=0,ri.isWidthOrHeightChanged=!1,ri.prevTs=null,ri.prevAudioTs=null,ri.eventListenList=[],ri.pendingRemoveRanges=[],ri.pendingSegments=[],ri.pendingAudioRemoveRanges=[],ri.pendingAudioSegments=[],ri.supportVideoFrameCallbackHandle=null,ri.audioSourceBufferCheckTimeout=null,ri.audioSourceNoDataCheckTimeout=null,ri.hasPendingEos=!1,ri.$video={currentTime:0,readyState:0}},init(){ri.events=new fn,ri._resetInIt(),ri.mediaSource=new self.MediaSource,ri.isDecodeFirstIIframe=!!yr(ii._opt.checkFirstIFrame),ri._bindMediaSourceEvents()},destroy(){ri.stop(),ri._clearAudioSourceBufferCheckTimeout(),ri.eventListenList&&ri.eventListenList.length&&(ri.eventListenList.forEach((e=>e())),ri.eventListenList=[]),ri._resetInIt(),ri.mediaSource=null},getState:()=>ri.mediaSource&&ri.mediaSource.readyState,isStateOpen:()=>ri.getState()===gt,isStateClosed:()=>ri.getState()===yt,isStateEnded:()=>ri.getState()===mt,_bindMediaSourceEvents(){const{proxy:e}=ri.events,t=e(ri.mediaSource,bt,(()=>{ii.debug.log(ri.TAG_NAME,"sourceOpen"),ri._onMediaSourceSourceOpen()})),r=e(ri.mediaSource,vt,(()=>{ii.debug.log(ri.TAG_NAME,"sourceClose")})),i=e(ri.mediaSource,wt,(()=>{ii.debug.log(ri.TAG_NAME,"sourceended")}));ri.eventListenList.push(t,r,i)},_onMediaSourceSourceOpen(){ri.sourceBuffer||(ii.debug.log(ri.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),ri._initSourceBuffer()),ri.audioSourceBuffer||(ii.debug.log(ri.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),ri._initAudioSourceBuffer()),ri._hasPendingSegments()&&ri._doAppendSegments()},decodeVideo(e,t,r,i){if(ii.isDestroyed)ii.debug.warn(ri.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(yr(ri.hasInit))if(r&&e[1]===Bt){const i=15&e[0];if(i===Fe&&yr(ar()))return void ri.emitError(Ce.mediaSourceH265NotSupport);ri.videoInfo.codec=i,postMessage({cmd:L,code:i});const n=new Uint8Array(e);postMessage({cmd:M,buffer:n,codecId:i},[n.buffer]),ri.hasInit=ri._decodeConfigurationRecord(e,t,r,i)}else ii.debug.warn(ri.TAG_NAME,`decodeVideo has not init , isIframe is ${r} , payload is ${e[1]}`);else if(!ri.isDecodeFirstIIframe&&r&&(ri.isDecodeFirstIIframe=!0),ri.isDecodeFirstIIframe){if(r&&0===e[1]){const t=15&e[0];let r={};t===Ie?r=Tr(e.slice(5)):t===Fe&&(r=$r(e));const i=ri.videoInfo;i&&i.codecWidth&&i.codecWidth&&r&&r.codecWidth&&r.codecHeight&&(r.codecWidth!==i.codecWidth||r.codecHeight!==i.codecWidth)&&(ii.debug.warn(ri.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${i.codecWidth}, old height is ${i.codecWidth},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),ri.isWidthOrHeightChanged=!0,ri.emitError(Ce.mseWidthOrHeightChange))}if(ri.isWidthOrHeightChanged)return void ii.debug.warn(ri.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(mr(e))return void ii.debug.warn(ri.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength300&&(ri.firstAudioTime-=e,ii.debug.warn(ri.TAG_NAME,`video\n firstAudioTime is ${ri.firstRenderTime} and current time is ${ri.prevTs}\n play time is ${e} and firstAudioTime ${t} - ${e} = ${ri.firstAudioTime}`))}r=t-ri.firstAudioTime,r<0&&(ii.debug.warn(ri.TAG_NAME,`decodeAudio\n local dts is < 0 , ts is ${t} and prevTs is ${ri.prevAudioTs},\n firstAudioTime is ${ri.firstAudioTime}`),r=null===ri.prevAudioDts?0:ri.prevAudioDts+ii._opt.mseCorrectAudioTimeDuration),null!==ri.prevAudioTs&&r<=ri.prevAudioDts&&(ii.debug.warn(ri.TAG_NAME,`\n decodeAudio dts is less than(or equal) prev dts ,\n dts is ${r} and prev dts is ${ri.prevAudioDts} ,\n and now ts is ${t} and prev ts is ${ri.prevAudioTs} ,\n and diff is ${t-ri.prevAudioTs}`),r=ri.prevAudioDts+ii._opt.mseCorrectAudioTimeDuration)}ii.isPlayer?ri._decodeAudio(e,r,t):ii.isPlayback,ri.prevAudioTs=t,ri.prevAudioDts=r}else ii.debug.log(ri.TAG_NAME,"decodeAudio first frame is not iFrame")}},_checkTsIsMaxDiff:e=>ri.prevTs>0&&eE,_decodeConfigurationRecord(e,t,r,i){let n=e.slice(5),s={};if(i===Ie?s=Tr(n):i===Fe&&(s=Vr(n)),ri.videoInfo.width=s.codecWidth,ri.videoInfo.height=s.codecHeight,0===s.codecWidth&&0===s.codecHeight)return ii.debug.warn(ri.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(s)),ri.emitError(Ce.mediaSourceDecoderConfigurationError),!1;const a={id:Dt,type:"video",timescale:1e3,duration:0,avcc:n,codecWidth:s.codecWidth,codecHeight:s.codecHeight,videoType:s.videoType},o=pn.generateInitSegment(a);ri.isAvc=i===Ie;let d=s.codec;return ri.videoMimeType=d?`video/mp4; codecs="${s.codec}"`:ri.isAvc?ct:ut,postMessage({cmd:T,w:s.codecWidth,h:s.codecHeight}),ri._initSourceBuffer(),ri.appendBuffer(o.buffer),ri.sequenceNumber=0,ri.cacheTrack={},ri.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const r=e[0]>>4,i=e[0]>>1&1,n=r===Oe,s=r===Re;if(yr(s||n))return ii.debug.warn(ri.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${r} ant auto wasm decode`),ri.emitError(Ce.mediaSourceAudioG711NotSupport),!1;const a={id:It,type:"audio",timescale:1e3};let o={};if(Wt(e)){if(o=Yt(e.slice(2)),!o)return!1;a.audioSampleRate=o.sampleRate,a.channelCount=o.channelCount,a.config=o.config,a.refSampleDuration=1024/a.audioSampleRate*a.timescale}else{if(!n)return!1;if(o=En(e),!o)return!1;a.audioSampleRate=o.samplingRate,a.channelCount=o.channelCount,a.refSampleDuration=1152/a.audioSampleRate*a.timescale}a.codec=o.codec,a.duration=0;let d="mp4",l=o.codec,c=null;n&&yr(sr())?(d="mpeg",l="",c=new Uint8Array):c=pn.generateInitSegment(a);let u=`${a.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),yr(ri.isAudioInitInfo)&&(ir=r===Re?i?16:8:0===i?8:16,postMessage({cmd:I,code:r}),postMessage({cmd:D,sampleRate:a.audioSampleRate,channels:a.channelCount,depth:ir}),ri.isAudioInitInfo=!0),ri.audioMimeType=u,ri.isAAC=s,ri._initAudioSourceBuffer(),ri.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=ri.events;if(null===ri.sourceBuffer&&null!==ri.mediaSource&&ri.isStateOpen()&&ri.videoMimeType){try{ri.sourceBuffer=ri.mediaSource.addSourceBuffer(ri.videoMimeType),ii.debug.log(ri.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ri.videoMimeType)}catch(e){return ii.debug.error(ri.TAG_NAME,"appendBuffer() mseDecoder.mediaSource.addSourceBuffer()",e.code,e),ri.emitError(Ce.mseAddSourceBufferError,e.code),void(ri.mediaSourceAddSourceBufferError=!0)}if(ri.sourceBuffer){const t=e(ri.sourceBuffer,"error",(e=>{ri.mediaSourceBufferError=!0,ii.debug.error(ri.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e),ri.emitError(Ce.mseSourceBufferError,e.code)})),r=e(ri.sourceBuffer,"updateend",(()=>{ri._hasPendingRemoveRanges()?ri._doRemoveRanges():ri._hasPendingSegments()?ri._doAppendSegments():ri.hasPendingEos&&(ii.debug.log(ri.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ri.endOfStream())}));ri.eventListenList.push(t,r)}}else ii.debug.log(ri.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${ri.isStateOpen()} and mseDecoder.isAvc === null is ${null===ri.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=ri.events;if(null===ri.audioSourceBuffer&&null!==ri.mediaSource&&ri.isStateOpen()&&ri.audioMimeType){try{ri.audioSourceBuffer=ri.mediaSource.addSourceBuffer(ri.audioMimeType),ri._clearAudioSourceBufferCheckTimeout(),ii.debug.log(ri.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",ri.audioMimeType)}catch(e){return ii.debug.error(ri.TAG_NAME,"appendAudioBuffer() mseDecoder.mediaSource.addSourceBuffer()",e.code,e),ri.emitError(Ce.mseAddSourceBufferError,e.code),void(ri.mediaSourceAddSourceBufferError=!0)}if(ri.audioSourceBuffer){const t=e(ri.audioSourceBuffer,"error",(e=>{ri.mediaSourceBufferError=!0,ii.debug.error(ri.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e),ri.emitError(Ce.mseSourceBufferError,e.code)})),r=e(ri.audioSourceBuffer,"updateend",(()=>{ri._hasPendingRemoveRanges()?ri._doRemoveRanges():ri._hasPendingSegments()?ri._doAppendSegments():ri.hasPendingEos&&(ii.debug.log(ri.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),ri.endOfStream())}));ri.eventListenList.push(t,r),null===ri.audioSourceNoDataCheckTimeout&&(ri.audioSourceNoDataCheckTimeout=setTimeout((()=>{ri._clearAudioNoDataCheckTimeout(),ri.emitError(Ce.mediaSourceAudioNoDataTimeout)}),1e3))}}else ii.debug.log(ri.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${ri.isStateOpen()} and mseDecoder.audioMimeType is ${ri.audioMimeType}`)},_decodeVideo(e,t,r,i,n){let s=e.slice(5),a=s.byteLength;if(0===a)return void ii.debug.warn(ri.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let o=(new Date).getTime(),d=!1;ri.prevTimestamp||(ri.prevTimestamp=o,d=!0);const l=o-ri.prevTimestamp;if(ri.decodeDiffTimestamp=l,l>500&&!d&&ii.isPlayer&&ii.debug.warn(ri.TAG_NAME,`_decodeVideo now time is ${o} and prev time is ${ri.prevTimestamp}, diff time is ${l} ms`),ri.cacheTrack.id&&t>=ri.cacheTrack.dts){let e=8+ri.cacheTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(pn.types.mdat,4),r.set(ri.cacheTrack.data,8),ri.cacheTrack.duration=t-ri.cacheTrack.dts;let i=pn.moof(ri.cacheTrack,ri.cacheTrack.dts);ri.cacheTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ri.appendBuffer(n.buffer)}else ii.debug.log(ri.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${n} cacheTrack dts is ${ri.cacheTrack&&ri.cacheTrack.dts}`),ri.timeInit=!1,ri.cacheTrack={};ri.cacheTrack||(ri.cacheTrack={}),ri.cacheTrack.id=Dt,ri.cacheTrack.sequenceNumber=++ri.sequenceNumber,ri.cacheTrack.size=a,ri.cacheTrack.dts=t,ri.cacheTrack.cts=i,ri.cacheTrack.isKeyframe=r,ri.cacheTrack.data=s,ri.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},ri.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,r){let i=ri.isAAC?e.slice(2):e.slice(1),n=i.byteLength;if(ri.cacheAudioTrack.id&&t>=ri.cacheAudioTrack.dts){let e=8+ri.cacheAudioTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(pn.types.mdat,4),r.set(ri.cacheAudioTrack.data,8),ri.cacheAudioTrack.duration=t-ri.cacheAudioTrack.dts;let i=pn.moof(ri.cacheAudioTrack,ri.cacheAudioTrack.dts);ri.cacheAudioTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),ri.appendAudioBuffer(n.buffer)}else ri.cacheAudioTrack={};ri.cacheAudioTrack||(ri.cacheAudioTrack={}),ri.cacheAudioTrack.id=It,ri.cacheAudioTrack.sequenceNumber=++ri.audioSequenceNumber,ri.cacheAudioTrack.size=n,ri.cacheAudioTrack.dts=t,ri.cacheAudioTrack.cts=0,ri.cacheAudioTrack.data=i,ri.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){ii.isDestroyed?ii.debug.warn(ri.TAG_NAME,"appendBuffer() player is destroyed"):ri.mediaSourceAddSourceBufferError?ii.debug.warn(ri.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ri.mediaSourceAppendBufferFull?ii.debug.warn(ri.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ri.mediaSourceAppendBufferError?ii.debug.warn(ri.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ri.mediaSourceBufferError?ii.debug.warn(ri.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ri.pendingSegments.push(e),ri.sourceBuffer&&(ii._opt.mseAutoCleanupSourceBuffer&&ri._needCleanupSourceBuffer()&&ri._doCleanUpSourceBuffer(),yr(ri.getSourceBufferUpdating())&&ri.isStateOpen()&&yr(ri._hasPendingRemoveRanges()))?ri._doAppendSegments():ri.isStateClosed()?(ri.mediaSourceBufferError=!0,ri.emitError(Ce.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ri.isStateEnded()?(ri.mediaSourceBufferError=!0,ri.emitError(Ce.mseSourceBufferError,"mediaSource is end")):ri._hasPendingRemoveRanges()&&ii.debug.log(ri.TAG_NAME,`video has pending remove ranges and video length is ${ri.pendingRemoveRanges.length}, audio length is ${ri.pendingAudioRemoveRanges.length}`))},appendAudioBuffer(e){ii.isDestroyed?ii.debug.warn(ri.TAG_NAME,"appendAudioBuffer() player is destroyed"):ri.mediaSourceAddSourceBufferError?ii.debug.warn(ri.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):ri.mediaSourceAppendBufferFull?ii.debug.warn(ri.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):ri.mediaSourceAppendBufferError?ii.debug.warn(ri.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):ri.mediaSourceBufferError?ii.debug.warn(ri.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(ri.pendingAudioSegments.push(e),ri.audioSourceBuffer&&(ii._opt.mseAutoCleanupSourceBuffer&&ri._needCleanupSourceBuffer()&&ri._doCleanUpSourceBuffer(),yr(ri.getAudioSourceBufferUpdating())&&ri.isStateOpen()&&yr(ri._hasPendingRemoveRanges()))?ri._doAppendSegments():ri.isStateClosed()?(ri.mediaSourceBufferError=!0,ri.emitError(Ce.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):ri.isStateEnded()?(ri.mediaSourceBufferError=!0,ri.emitError(Ce.mseSourceBufferError,"mediaSource is end")):ri._hasPendingRemoveRanges()&&ii.debug.log(ri.TAG_NAME,`audio has pending remove ranges and video length is ${ri.pendingRemoveRanges.length}, audio length is ${ri.pendingAudioRemoveRanges.length}`))},getSourceBufferUpdating:()=>ri.sourceBuffer&&ri.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>ri.audioSourceBuffer&&ri.audioSourceBuffer.updating,stop(){ri.abortSourceBuffer(),ri.removeSourceBuffer(),ri.endOfStream()},clearUpAllSourceBuffer(){if(ri.sourceBuffer){const e=ri.sourceBuffer.buffered;for(let t=0;tri.pendingSegments.length>0||ri.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>ri.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(ri.isStateClosed()||ri.isStateEnded())ii.debug.log(ri.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==ri.sourceBuffer){if(ri.needInitAudio()&&null===ri.audioSourceBuffer)return ii.debug.log(ri.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===ri.audioSourceBufferCheckTimeout&&(ri.audioSourceBufferCheckTimeout=setTimeout((()=>{ri._clearAudioSourceBufferCheckTimeout(),ri.emitError(Ce.mediaSourceAudioInitTimeout)}),1e3)));if(yr(ri.getSourceBufferUpdating())&&ri.pendingSegments.length>0){const e=ri.pendingSegments.shift();try{ri.sourceBuffer.appendBuffer(e)}catch(e){ii.debug.error(ri.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(ri.stop(),ri.mediaSourceAppendBufferFull=!0,ri.emitError(Ce.mediaSourceFull)):11===e.code?(ri.stop(),ri.mediaSourceAppendBufferError=!0,ri.emitError(Ce.mediaSourceAppendBufferError)):(ri.stop(),ri.mediaSourceBufferError=!0,ri.emitError(Ce.mseSourceBufferError,e.code))}}if(yr(ri.getAudioSourceBufferUpdating())&&ri.pendingAudioSegments.length>0){const e=ri.pendingAudioSegments.shift();try{ri.audioSourceBuffer.appendBuffer(e)}catch(e){ii.debug.error(ri.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(ri.stop(),ri.mediaSourceAppendBufferFull=!0,ri.emitError(Ce.mediaSourceFull)):11===e.code?(ri.stop(),ri.mediaSourceAppendBufferError=!0,ri.emitError(Ce.mediaSourceAppendBufferError)):(ri.stop(),ri.mediaSourceBufferError=!0,ri.emitError(Ce.mseSourceBufferError,e.code))}}}else ii.debug.log(ri.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=ri.$video.currentTime;if(ri.sourceBuffer){const t=ri.sourceBuffer.buffered;let r=!1;for(let i=0;i=ii._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-ii._opt.mseAutoCleanupMinBackwardDuration;ri.pendingRemoveRanges.push({start:n,end:t})}}else s=ii._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-ii._opt.mseAutoCleanupMinBackwardDuration;ri.pendingAudioRemoveRanges.push({start:n,end:t})}}else sri.pendingRemoveRanges.length>0||ri.pendingAudioRemoveRanges.length>0,needInitAudio:()=>ii._opt.hasAudio&&ii._opt.mseDecodeAudio,_doRemoveRanges(){if(ri.sourceBuffer&&yr(ri.getSourceBufferUpdating())){let e=ri.pendingRemoveRanges;for(;e.length&&yr(ri.getSourceBufferUpdating());){let t=e.shift();try{ri.sourceBuffer.remove(t.start,t.end)}catch(e){ii.debug.warn(ri.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e)}}}if(ri.audioSourceBuffer&&yr(ri.getAudioSourceBufferUpdating())){let e=ri.pendingAudioRemoveRanges;for(;e.length&&yr(ri.getAudioSourceBufferUpdating());){let t=e.shift();try{ri.audioSourceBuffer.remove(t.start,t.end)}catch(e){ii.debug.warn(ri.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e)}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(yr(ii._opt.mseAutoCleanupSourceBuffer))return!1;const e=ri.$video.currentTime;if(ri.sourceBuffer){let t=ri.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ii._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(ri.audioSourceBuffer){let t=ri.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ii._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){ri.audioSourceBufferCheckTimeout&&(clearTimeout(ri.audioSourceBufferCheckTimeout),ri.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){ri.audioSourceNoDataCheckTimeout&&(clearTimeout(ri.audioSourceNoDataCheckTimeout),ri.audioSourceNoDataCheckTimeout=null)},getHandle:()=>ri.mediaSource.handle,emitError(e){postMessage({cmd:ie,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let ii={isPlayer:!0,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Tt,_opt:Sr(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){ii.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:ii.getVideoBufferLength(),audioDemuxBufferDelay:ii.getAudioBufferLength(),streamBufferByteLength:ii.getStreamBufferLength(),netBuf:ii.networkDelay||0,pushLatestDelay:ii.pushLatestDelay||0,latestDelay:ii.delay,isStreamTsMoreThanLocal:be});postMessage({cmd:O,type:Ue,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return ii._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||ii._opt.hasVideo&&!ve)return-1;if(t===ne)return ii.delay;if(ii.preDelayTimestamp&&ii.preDelayTimestamp>e)return ii.preDelayTimestamp-e>1e3&&ii.debug.warn("worker",`getDelay() and preDelayTimestamp is ${ii.preDelayTimestamp} > timestamp is ${e} more than ${ii.preDelayTimestamp-e}ms and return ${ii.delay}`),ii.preDelayTimestamp=e,ii.delay;if(ii.firstTimestamp){if(e){const t=Date.now()-ii.startTimestamp,r=e-ii.firstTimestamp;t>=r?(be=!1,ii.delay=t-r):(be=!0,ii.delay=r-t)}}else ii.firstTimestamp=e,ii.startTimestamp=Date.now(),ii.delay=-1;return ii.preDelayTimestamp=e,ii.delay},getDelayNotUpdateDelay:function(e,t){if(!e||ii._opt.hasVideo&&!ve)return-1;if(t===ne)return ii.pushLatestDelay;if(ii.preDelayTimestamp&&ii.preDelayTimestamp-e>1e3)return ii.debug.warn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${ii.preDelayTimestamp} > timestamp is ${e} more than ${ii.preDelayTimestamp-e}ms and return -1`),-1;if(ii.firstTimestamp){let t=-1;if(e){const r=Date.now()-ii.startTimestamp,i=e-ii.firstTimestamp;r>=i?(be=!1,t=r-i):(be=!0,t=i-r)}return t}return-1},resetDelay:function(){ii.firstTimestamp=null,ii.startTimestamp=null,ii.delay=-1,ii.dropping=!1},resetAllDelay:function(){ii.resetDelay(),ii.preDelayTimestamp=null},doDecode:function(e){ii._opt.isEmitSEI&&e.type===se&&ii.isWorkerFetch&&ii.findSei(e.payload,e.ts),ii.isPlayUseMSEAndDecoderInWorker()?e.type===ne?ii._opt.mseDecodeAudio?ri.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===se&&ri.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):ii._opt.useWCS&&ii.useOffscreen()&&e.type===se&&s.decode?s.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===i.length)return;const t=e.ts,n=i[0],s=e.type===se&&mr(e.payload);if(yr(r))s&&(ii.debug.log("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n isVideoSqeHeader is ${s}`),i.shift(),ii.doDecode(n));else{const r=n.ts-t,a=n.type===ne&&e.type===se;(r<=20||a||s)&&(ii.debug.log("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n diff is ${r} and isVideoAndNextAudio is ${a} and isVideoSqeHeader is ${s}`),i.shift(),ii.doDecode(n))}},init:function(){ii.debug.log("worker","init and opt is",JSON.stringify(ii._opt));const e=ii._opt.playType===y,t=ii._opt.playType===v;if(Ur.init(),ii.isPlayer=e,ii.isPlayback=t,ii.isPlayUseMSEAndDecoderInWorker()&&ri&&ri.init(),ii.isPlaybackCacheBeforeDecodeForFpsRender())ii.debug.log("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");else{ii.debug.log("worker","setInterval()");const t=ii._opt.videoBuffer+ii._opt.videoBufferDelay,r=()=>{let r=null;if(i.length){if(ii.isPushDropping)return void ii.debug.warn("worker",`loop() isPushDropping is true and bufferList length is ${i.length}`);if(ii.dropping){for(r=i.shift(),ii.debug.warn("worker",`loop() dropBuffer is dropping and isIFrame ${r.isIFrame} and delay is ${ii.delay} and bufferlist is ${i.length}`);!r.isIFrame&&i.length;)r=i.shift();const e=ii.getDelayNotUpdateDelay(r.ts,r.type);r.isIFrame&&e<=ii.getNotDroppingDelayTs()&&(ii.debug.log("worker","loop() is dropping = false, is iFrame"),ii.dropping=!1,ii.doDecode(r),ii.decodeNext(r))}else if(ii.isPlayback||ii.isPlayUseMSE()||0===ii._opt.videoBuffer)for(;i.length;)r=i.shift(),ii.doDecode(r);else if(r=i[0],-1===ii.getDelay(r.ts,r.type))ii.debug.log("worker","loop() common dumex delay is -1 ,data.ts is",r.ts),i.shift(),ii.doDecode(r),ii.decodeNext(r);else if(ii.delay>t&&e)ii.hasIframeInBufferList()?(ii.debug.log("worker",`delay is ${ii.delay} > maxDelay ${t}, set dropping is true`),ii.resetAllDelay(),ii.dropping=!0,postMessage({cmd:H})):(i.shift(),ii.doDecode(r),ii.decodeNext(r));else for(;i.length;){if(r=i[0],!(ii.getDelay(r.ts,r.type)>ii._opt.videoBuffer)){ii.delay<0&&ii.debug.warn("worker",`loop() do not decode and delay is ${ii.delay}, bufferList is ${i.length}`);break}i.shift(),ii.doDecode(r)}}else-1!==ii.delay&&ii.debug.log("worker","loop() bufferList is empty and reset delay"),ii.resetAllDelay()};ii.stopId=setInterval((()=>{let e=(new Date).getTime();$e||($e=e);const t=e-$e;t>100&&ii.debug.warn("worker",`loop demux diff time is ${t}`),r(),$e=(new Date).getTime()}),20)}if(yr(ii._opt.checkFirstIFrame)&&(ve=!0),ii.isPlayUseMSEAndDecoderInWorker()&&ri){const e=ri.getHandle();e&&postMessage({cmd:te,mseHandle:e},[e])}},playbackCacheLoop:function(){ii.stopId&&(clearInterval(ii.stopId),ii.stopId=null);const e=()=>{let e=null;i.length&&(e=i.shift(),ii.doDecode(e))};e();const t=Math.ceil(1e3/(ii.streamFps*ii._opt.playbackRate));ii.debug.log("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${ii.streamFps}, streamAudioFps is ${ii.streamAudioFps} ,streamVideoFps is ${ii.streamVideoFps} playbackRate is ${ii._opt.playbackRate}`),ii.stopId=setInterval(e,t)},close:function(){if(ii.debug.log("worker","close"),ii.isDestroyed=!0,Er(),!o||1!==o.readyState&&2!==o.readyState?o&&ii.debug.log("worker",`close() and socket.readyState is ${o.readyState}`):(br=!0,o.close(1e3,"Client disconnecting")),o=null,ii.stopStreamRateAndStatsInterval(),ii.stopId&&(clearInterval(ii.stopId),ii.stopId=null),ii.mp3Demuxer&&(ii.mp3Demuxer.destroy(),ii.mp3Demuxer=null),ii.writableStream&&yr(ii.writableStream.locked)&&ii.writableStream.close().catch((e=>{ii.debug.log("worker","close() and writableStream.close() error",e)})),ii.writableStream=null,ni)try{ni.clear&&ni.clear(),ni=null}catch(e){ii.debug.warn("worker","close() and audioDecoder.clear error",e)}if(si)try{si.clear&&si.clear(),si=null}catch(e){ii.debug.warn("worker","close() and videoDecoder.clear error",e)}d=null,$e=null,be=!1,s&&(s.reset&&s.reset(),s=null),ri&&(ri.destroy(),ri=null),ii.firstTimestamp=null,ii.startTimestamp=null,ii.networkDelay=0,ii.streamFps=null,ii.streamAudioFps=null,ii.streamVideoFps=null,ii.delay=-1,ii.pushLatestDelay=-1,ii.preDelayTimestamp=null,ii.dropping=!1,ii.isPushDropping=!1,ii.isPlayer=!0,ii.isPlayback=!1,ii.isWorkerFetch=!1,ii._opt=Sr(),ii.webglObj&&(ii.webglObj.destroy(),ii.offscreenCanvas.removeEventListener("webglcontextlost",ii.onOffscreenCanvasWebglContextLost),ii.offscreenCanvas.removeEventListener("webglcontextrestored",ii.onOffscreenCanvasWebglContextRestored),ii.offscreenCanvas=null,ii.offscreenCanvasGL=null,ii.offscreenCanvasCtx=null),i=[],n=[],c&&(c.buffer=null,c=null),h=null,w=null,S=!1,x=!1,ve=!1,Ot=!1,Gt=!1,Ht=!1,qt=null,Zt=null,ht=[],_t=0,St=0,Ke=null,st=null,Et=null,xt=null,ir=null,zt=0,Nt=0,ft=null,pt=null,ii.fetchStatus=Tt,wr=!0,Ur.destroy(),Or.destroy(),Gr.destroy(),Wr.destroy(),postMessage({cmd:q})},pushBuffer:function(e,t){if(t.type===ne&&Wt(e)){if(ii.debug.log("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),ii._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Z,buffer:t},[t.buffer])}ii.decodeAudio(e,t.ts)}else if(t.type===se&&t.isIFrame&&mr(e)){if(ii.debug.log("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),ii._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:J,buffer:t},[t.buffer])}ii.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(ii._opt.isRecording)if(ii._opt.isRecordTypeFlv){const r=new Uint8Array(e);postMessage({cmd:Q,type:t.type,buffer:r,ts:t.ts},[r.buffer])}else if(ii._opt.recordType===b)if(t.type===se){const r=new Uint8Array(e).slice(5);postMessage({cmd:R,buffer:r,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[r.buffer])}else if(t.type===ne&&ii._opt.isWasmMp4){const r=new Uint8Array(e),i=jt(r)?r.slice(2):r.slice(1);postMessage({cmd:F,buffer:i,ts:t.ts},[i.buffer])}if(ii.isPlayer&&zt>0&&xt>0&&t.type===se){const e=t.ts-xt,r=zt+zt/2;e>r&&ii.debug.log("worker",`pushBuffer video\n ts is ${t.ts}, preTimestamp is ${xt},\n diff is ${e} and preTimestampDuration is ${zt} and maxDiff is ${r}\n maybe trigger black screen or flower screen\n `)}if(ii.isPlayer&&xt>0&&t.type===se&&t.tsE&&(ii.debug.warn("worker",`pushBuffer,\n preTimestamp is ${xt}, options.ts is ${t.ts},\n diff is ${xt-t.ts} more than 3600000,\n and resetAllDelay`),ii.resetAllDelay(),xt=null,zt=0),ii.isPlayer&&xt>0&&t.ts<=xt&&t.type===se&&(ii.debug.warn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTimestamp is ${xt} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Nt}`),ii._opt.isDropSameTimestampGop&&yr(t.isIFrame)&&ve)){const e=ii.hasIframeInBufferList(),t=yr(ii.isPushDropping);return ii.debug.log("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?ii.dropBuffer$2():(ii.clearBuffer(!0),gr(ii._opt.checkFirstIFrame)&&gr(r)&&(ii.isPlayUseMSEAndDecoderInWorker()?ri.isDecodeFirstIIframe=!1:postMessage({cmd:ee}))))}if(ii.isPlayer&&ve){const e=ii._opt.videoBuffer+ii._opt.videoBufferDelay,r=ii.getDelayNotUpdateDelay(t.ts,t.type);ii.pushLatestDelay=r,r>e&&ii.delay0&&ii.hasIframeInBufferList()&&!1===ii.isPushDropping&&(ii.debug.log("worker",`pushBuffer(), pushLatestDelay is ${r} more than ${e} and decoder.delay is ${ii.delay} and has iIframe and next decoder.dropBuffer$2()`),ii.dropBuffer$2())}if(ii.isPlayer&&t.type===se&&(xt>0&&(zt=t.ts-xt),Nt=e.byteLength,xt=t.ts),t.type===ne?i.push({ts:t.ts,payload:e,decoder:{decode:ii.decodeAudio},type:ne,isIFrame:!1}):t.type===se&&i.push({ts:t.ts,cts:t.cts,payload:e,decoder:{decode:ii.decodeVideo},type:se,isIFrame:t.isIFrame}),ii.isPlaybackCacheBeforeDecodeForFpsRender()&&(or(ii.streamVideoFps)||or(ii.streamAudioFps))){let e=ii.streamVideoFps,t=ii.streamAudioFps;if(or(ii.streamVideoFps)&&(e=fr(i,se),e&&(ii.streamVideoFps=e,postMessage({cmd:$,value:ii.streamVideoFps}),ii.streamFps=t?e+t:e,yr(ii._opt.hasAudio)&&(ii.debug.log("worker","playbackCacheBeforeDecodeForFpsRender, _opt.hasAudio is false and set streamAudioFps is 0"),ii.streamAudioFps=0),ii.playbackCacheLoop())),or(ii.streamAudioFps)&&(t=fr(i,ne),t&&(ii.streamAudioFps=t,ii.streamFps=e?e+t:t,ii.playbackCacheLoop())),or(ii.streamVideoFps)&&or(ii.streamAudioFps)){const r=i.map((e=>({type:e.type,ts:e.ts})));ii.debug.log("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${i.length}, and ts list is ${JSON.stringify(r)}`)}const r=ii.getAudioBufferLength()>0,n=r?60:40;i.length>=n&&(ii.debug.warn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${i.length} more than ${n}, and hasAudio is ${r} an set streamFps is 25`),ii.streamVideoFps=25,postMessage({cmd:$,value:ii.streamVideoFps}),r?(ii.streamAudioFps=25,ii.streamFps=ii.streamVideoFps+ii.streamAudioFps):ii.streamFps=ii.streamVideoFps,ii.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return i.forEach((t=>{t.type===se&&(e+=1)})),e},hasIframeInBufferList:()=>i.some((e=>e.type===se&&e.isIFrame)),isAllIframeInBufferList(){const e=ii.getVideoBufferLength();let t=0;return i.forEach((e=>{e.type===se&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>ii._opt.videoBuffer+ii._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return i.forEach((t=>{t.type===ne&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),ii._opt.isNakedFlow?Ur.lastBuf&&(e=Ur.lastBuf.byteLength):ii._opt.isTs?Wr._remainingPacketData&&(e=Wr._remainingPacketData.byteLength):ii._opt.isFmp4&&Or.mp4Box&&(e=Or.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){ii.debug.log("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),ii.isWorkerFetch=!0,t.isFlv?ii._opt.isFlv=!0:t.isFmp4?ii._opt.isFmp4=!0:t.isMpeg4?ii._opt.isMpeg4=!0:t.isNakedFlow?ii._opt.isNakedFlow=!0:t.isTs&&(ii._opt.isTs=!0),d=nr((e=>{postMessage({cmd:O,type:Se,value:e})})),ii.startStreamRateAndStatsInterval(),t.isFmp4&&(Or.listenMp4Box(),ii._opt.isFmp4Private&&Or.initTransportDescarmber()),t.protocol===_?(c=new Ar(ii.demuxFlv()),fetch(e,{signal:a.signal}).then((e=>{if(gr(br))return ii.debug.log("worker","request abort and run res.body.cancel()"),ii.fetchStatus=Tt,void e.body.cancel();if(!pr(e))return ii.debug.warn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),Er(),void postMessage({cmd:O,type:Ce.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:O,type:xe}),ur())ii.writableStream=new WritableStream({write:e=>a&&a.signal&&a.signal.aborted?(ii.debug.log("worker","writableStream write() and abortController.signal.aborted is true so return"),void(ii.fetchStatus=Ct)):gr(br)?(ii.debug.log("worker","writableStream write() and requestAbort is true so return"),void(ii.fetchStatus=Ct)):void("string"!=typeof e?(ii.fetchStatus=kt,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?ii.demuxFmp4(e):t.isMpeg4?ii.demuxMpeg4(e):t.isTs&&ii.demuxTs(e)):ii.debug.warn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{ii.debug.log("worker","writableStream close()"),ii.fetchStatus=Ct,c=null,Er(),postMessage({cmd:O,type:we,value:m,msg:"fetch done"})},abort:e=>{if(a&&a.signal&&a.signal.aborted)return ii.debug.log("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(ii.fetchStatus=Ct);c=null,e.name!==At?(ii.debug.log("worker",`writableStream abort() and e is ${e.toString()}`),Er(),postMessage({cmd:O,type:Ce.fetchError,value:e.toString()})):ii.debug.log("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(ii.writableStream);else{const r=e.body.getReader(),i=()=>{r.read().then((e=>{let{done:r,value:n}=e;return r?(ii.debug.log("worker","fetchNext().then() and done is true"),ii.fetchStatus=Ct,c=null,Er(),void postMessage({cmd:O,type:we,value:m,msg:"fetch done"})):a&&a.signal&&a.signal.aborted?(ii.debug.log("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(ii.fetchStatus=Ct)):gr(br)?(ii.debug.log("worker","fetchNext().then() and requestAbort is true so return"),void(ii.fetchStatus=Ct)):void("string"!=typeof n?(ii.fetchStatus=kt,d(n.byteLength),t.isFlv?c.write(n):t.isFmp4?ii.demuxFmp4(n):t.isMpeg4&&ii.demuxMpeg4(n),i()):ii.debug.warn("worker",`fetchNext().then() and value "${n}" is string so return`))})).catch((e=>{if(a&&a.signal&&a.signal.aborted)return ii.debug.log("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(ii.fetchStatus=Ct);c=null,e.name!==At?(ii.debug.log("worker",`fetchNext().catch() and e is ${e.toString()}`),Er(),postMessage({cmd:O,type:Ce.fetchError,value:e.toString()})):ii.debug.log("worker","fetchNext().catch() and e.name is AbortError so return")}))};i()}})).catch((e=>{a&&a.signal&&a.signal.aborted?ii.debug.log("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==At?(ii.debug.log("worker",`fetch().catch() and e is ${e.toString()}`),Er(),postMessage({cmd:O,type:Ce.fetchError,value:e.toString()}),c=null):ii.debug.log("worker","fetch().catch() and e.name is AbortError so return")}))):t.protocol===p&&(t.isFlv&&(c=new Ar(ii.demuxFlv())),o=new WebSocket(e),o.binaryType="arraybuffer",o.onopen=()=>{ii.debug.log("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:O,type:xe}),postMessage({cmd:O,type:ke})},o.onclose=e=>{u?ii.debug.log("worker","fetchStream, WebsocketStream socket close and isSocketError is true , so return"):(ii.debug.log("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&ii.debug.error("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),gr(br)?ii.debug.log("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c=null,postMessage({cmd:O,type:we,value:g,msg:e.code})))},o.onerror=e=>{ii.debug.error("worker","fetchStream, WebsocketStream socket error",e),u=!0,c=null,postMessage({cmd:O,type:Ce.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},o.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?ii.demuxFmp4(e.data):t.isMpeg4?ii.demuxMpeg4(e.data):ii._opt.isNakedFlow?ii.demuxNakedFlow(e.data):ii.demuxM7s(e.data)):ii.debug.warn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,i=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const n=r[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let s=r[0];const a=(yield n).slice();switch(i){case ae:if(a.byteLength>0){let e=a;gr(ii._opt.m7sCryptoAudio)&&(e=ii.cryptoPayloadAudio(a)),ii.decode(e,{type:ne,ts:s})}else ii.debug.warn("worker",`demuxFlv() type is audio and payload.byteLength is ${a.byteLength} and return`);break;case oe:if(a.byteLength>=6){const e=a[0];if(ii._isEnhancedH265Header(e))ii._decodeEnhancedH265Video(a,s);else{a[0];let e=a[0]>>4===Ut;if(e&&mr(a)&&null===qt){const e=15&a[0];qt=e===Fe,Zt=er(a,qt),ii.debug.log("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${qt} and nalUnitSize is ${Zt}`)}e&&ii.calcIframeIntervalTimestamp(s),ii.isPlayer&&ii.calcNetworkDelay(s),r[0]=a[4],r[1]=a[3],r[2]=a[2],r[3]=0;let t=r[0],i=ii.cryptoPayload(a,e);ii.decode(i,{type:se,ts:s,isIFrame:e,cts:t})}}else ii.debug.warn("worker",`demuxFlv() type is video and payload.byteLength is ${a.byteLength} and return`);break;case de:postMessage({cmd:X,buffer:a},[a.buffer]);break;default:ii.debug.log("worker",`demuxFlv() type is ${i}`)}}},decode:function(e,t){t.type===ne?ii._opt.hasAudio&&(postMessage({cmd:O,type:Ee,value:e.byteLength}),ii.isPlayer?ii.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):ii.isPlayback&&(ii.isPlaybackOnlyDecodeIFrame()||(ii.isPlaybackCacheBeforeDecodeForFpsRender(),ii.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===se&&ii._opt.hasVideo&&(postMessage({cmd:O,type:Ae,value:e.byteLength}),postMessage({cmd:O,type:Be,value:t.ts}),ii.isPlayer?ii.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):ii.isPlayback&&(ii.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&ii.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(ii.isPlaybackCacheBeforeDecodeForFpsRender(),ii.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let r=e;return ii._opt.isM7sCrypto?ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength>0&&ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength>0?r=Ri(e,ii._opt.cryptoKey,ii._opt.cryptoIV,qt):ii.debug.error("worker",`isM7sCrypto cryptoKey.length is ${ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength} or cryptoIV.length is ${ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength} null`):ii._opt.isSm4Crypto?ii._opt.sm4CryptoKey&&t?r=sn(e,ii._opt.sm4CryptoKey):ii._opt.sm4CryptoKey||ii.debug.error("worker","isSm4Crypto opt.sm4CryptoKey is null"):ii._opt.isXorCrypto&&(ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength>0&&ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength>0?r=un(e,ii._opt.cryptoKey,ii._opt.cryptoIV,qt):ii.debug.error("worker",`isXorCrypto cryptoKey.length is ${ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength} or cryptoIV.length is ${ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength} null`)),r},cryptoPayloadAudio:function(e){let t=e;return ii._opt.isM7sCrypto&&(ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength>0&&ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength>0?e[0]>>4===Re&&(t=zi(e,ii._opt.cryptoKey,ii._opt.cryptoIV)):ii.debug.error("worker",`isM7sCrypto cryptoKey.length is ${ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength} or cryptoIV.length is ${ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength} null`)),t},setCodecAudio:function(e,t){const r=e[0]>>4,i=e[0]>>1&1;if(ir=r===Re?i?16:8:0===i?8:16,ni&&ni.setCodec)if(Wt(e)||r===ze||r===Ne||r===Oe){ii.debug.log("worker",`setCodecAudio: init audio codec, codeId is ${r}`);const i=r===Re?e.slice(2):new Uint8Array(0);ni.setCodec(r,ii._opt.sampleRate,i),r===Re&&postMessage({cmd:P,buffer:i},[i.buffer]),x=!0,r!==Re&&(r===Oe?(ii.mp3Demuxer||(ii.mp3Demuxer=new dn(ii),ii.mp3Demuxer.on("data",((e,t)=>{ni.decode(e,t)}))),ii.mp3Demuxer.dispatch(e.slice(1),t)):ni.decode(e.slice(1),t))}else ii.debug.warn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",r);else ii.debug.error("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(ii.isDestroyed)ii.debug.log("worker","decodeAudio, decoder is destroyed and return");else if(ii.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())ri.decodeAudio(e,t);else if(gr(r)&&gr(ii._opt.mseDecodeAudio))postMessage({cmd:N,payload:e,ts:t,cts:t},[e.buffer]);else{const r=e[0]>>4;if(x){if(Wt(e))return void ii.debug.log("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");r===Oe?ii.mp3Demuxer.dispatch(e.slice(1),t):ni.decode(r===Re?e.slice(2):e.slice(1),t)}else ii.setCodecAudio(e,t)}},setCodecVideo:function(e){const t=15&e[0];if(si&&si.setCodec)if(mr(e))if(t===Ie||t===Fe){ii.debug.log("worker",`setCodecVideo: init video codec , codecId is ${t}`);const r=e.slice(5);if(t===Ie&&ii._opt.useSIMD){const e=Tr(r);if(e.codecWidth>A||e.codecHeight>A)return postMessage({cmd:j}),void ii.debug.warn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const i=new Uint8Array(e);S=!0,si.setCodec(t,r),postMessage({cmd:L,code:t}),postMessage({cmd:M,buffer:i,codecId:t},[i.buffer])}else ii.debug.warn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${t} is not H264 or H265`);else ii.debug.warn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${t} and frameType is ${e[0]>>4} and packetType is ${e[1]}`);else ii.debug.error("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(ii.isDestroyed)ii.debug.log("worker","decodeVideo, decoder is destroyed and return");else if(ii.isPlayUseMSEAndDecoderInWorker())ri.decodeVideo(e,t,i,n);else if(gr(r))postMessage({cmd:z,payload:e,isIFrame:i,ts:t,cts:n,delay:ii.delay},[e.buffer]);else if(S)if(!ve&&i&&(ve=!0),ve){if(i&&mr(e)){const t=15&e[0];let r={};t===Ie?r=Tr(e.slice(5)):t===Fe&&(r=$r(e)),r.codecWidth&&r.codecHeight&&h&&w&&(r.codecWidth!==h||r.codecHeight!==w)&&(ii.debug.warn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${h}, old height is ${w},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),Gt=!0,postMessage({cmd:V}))}if(Gt)return void ii.debug.warn("worker","decodeVideo: video width or height is changed, and return");if(Ht)return void ii.debug.warn("worker","decodeVideo: simd decode error, and return");if(mr(e))return void ii.debug.warn("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];ii.debug.log("worker",`clearBuffer,bufferList length is ${i.length}, need clear is ${e}`),e&&(i=[]),ii.isPlayer&&(ii.resetAllDelay(),gr(ii._opt.checkFirstIFrame)&&(ii.dropping=!0,postMessage({cmd:H}))),gr(ii._opt.checkFirstIFrame)&&yr(r)&&(ve=!1)},dropBuffer$2:function(){if(i.length>0){let e=i.findIndex((e=>gr(e.isIFrame)&&e.type===se));if(ii.isAllIframeInBufferList())for(let t=0;t=ii.getNotDroppingDelayTs()){ii.debug.log("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${n} and notDroppingDelayTs is ${ii.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){ii.isPushDropping=!0,postMessage({cmd:H});const t=i.length;i=i.slice(e);const r=i.shift();ii.resetAllDelay(),ii.getDelay(r.ts,r.type),ii.doDecode(r),ii.isPushDropping=!1,ii.debug.log("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${i.length} and new delay is ${ii.delay} `)}else ii.isPushDropping=!1}0===i.length&&(ii.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),r=t.getUint32(1,!1),i=t.getUint8(0),n=new ArrayBuffer(4),s=new Uint32Array(n);switch(i){case ne:ii.decode(new Uint8Array(e,5),{type:ne,ts:r});break;case se:if(t.byteLength>=11){const i=new Uint8Array(e,5),n=i[0];if(ii._isEnhancedH265Header(n))ii._decodeEnhancedH265Video(i,r);else{const e=t.getUint8(5)>>4==1;if(e&&(ii.calcIframeIntervalTimestamp(r),mr(i)&&null===qt)){const e=15&i[0];qt=e===Fe}ii.isPlayer&&ii.calcNetworkDelay(r),s[0]=i[4],s[1]=i[3],s[2]=i[2],s[3]=0;let n=s[0],a=ii.cryptoPayload(i,e);ii.decode(a,{type:se,ts:r,isIFrame:e,cts:n})}}else ii.debug.warn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){Ur.dispatch(e)},demuxFmp4:function(e){Or.dispatch(e)},demuxMpeg4:function(e){Gr.dispatch(e)},demuxTs:function(e){Wr.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const r=e[0],i=48&r,n=15&r,s=e.slice(1,5),a=new ArrayBuffer(4),o=new Uint32Array(a),d="a"==String.fromCharCode(s[0]);if(qt=yr(d),n===Pt){if(i===Rt){const r=e.slice(5);if(d);else{const i=new Uint8Array(5+r.length);i.set([28,0,0,0,0],0),i.set(r,5),Zt=er(e,qt),ii.debug.log("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${qt} and nalUnitSize is ${Zt}`),ii.decode(i,{type:se,ts:t,isIFrame:!0,cts:0})}}}else if(n===Lt){let r=e,n=0;const s=i===Rt;s&&ii.calcIframeIntervalTimestamp(t),d||(o[0]=e[4],o[1]=e[3],o[2]=e[2],o[3]=0,n=o[0],r=Yr(e.slice(8),s),r=ii.cryptoPayload(r,s),ii.decode(r,{type:se,ts:t,isIFrame:s,cts:n}))}else if(n===Mt){const r=i===Rt;r&&ii.calcIframeIntervalTimestamp(t);let n=Yr(e.slice(5),r);n=ii.cryptoPayload(n,r),ii.decode(n,{type:se,ts:t,isIFrame:r,cts:0})}},_isEnhancedH265Header:function(e){return(e&Ft)===Ft},findSei:function(e,t){let r=4;dr(Zt)&&(r=Zt),Jt(e.slice(5),r).forEach((e=>{const r=qt?e[0]>>>1&63:31&e[0];(qt&&(r===ot||r===at)||yr(qt)&&r===je)&&postMessage({cmd:K,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(ve&&e>0))return;null===Ke?(Ke=e,st=tr()):et?r-t:0;ii.networkDelay=i,i>ii._opt.networkDelay&&ii._opt.playType===y&&(ii.debug.warn("worker",`calcNetworkDelay now dts:${e}, start dts is ${Ke} vs start is ${t},local diff is ${r} ,delay is ${i}`),postMessage({cmd:O,type:Te,value:i}))},calcIframeIntervalTimestamp:function(e){null===Et?Et=e:Et=ii._opt.playbackForwardMaxRateDecodeIFrame},isPlayUseMSE:function(){return ii.isPlayer&&ii._opt.useMSE&&gr(r)},isPlayUseMSEAndDecoderInWorker:function(){return ii.isPlayUseMSE()&&ii._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return ii.isPlayUseMSEAndDecoderInWorker()&&ii._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){ii.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){ii.debug.error("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Ot=!0,ii.webglObj.destroy(),ii.webglObj=null,ii.offscreenCanvasGL=null,setTimeout((()=>{ii.offscreenCanvasGL=ii.offscreenCanvas.getContext("webgl"),ii.offscreenCanvasGL&&ii.offscreenCanvasGL.getContextAttributes().stencil?(ii.webglObj=f(ii.offscreenCanvasGL,ii._opt.openWebglAlignment),Ot=!1):ii.debug.error("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){ii.debug.log("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,r){postMessage({cmd:L,code:e}),postMessage({cmd:T,w:t,h:r}),h=t,w=r,ii.useOffscreen()&&(ii.offscreenCanvas=new OffscreenCanvas(t,r),ii.offscreenCanvasGL=ii.offscreenCanvas.getContext("webgl"),ii.webglObj=f(ii.offscreenCanvasGL,ii._opt.openWebglAlignment),ii.offscreenCanvas.addEventListener("webglcontextlost",ii.onOffscreenCanvasWebglContextLost,!1),ii.offscreenCanvas.addEventListener("webglcontextrestored",ii.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,r){postMessage({cmd:I,code:e}),postMessage({cmd:D,sampleRate:t,channels:r,depth:ir}),St=r},yuvData:function(t,r){if(ii.isDestroyed)return void ii.debug.log("worker","yuvData, decoder is destroyed and return");const i=h*w*3/2;let n=e.HEAPU8.subarray(t,t+i),s=new Uint8Array(n);if(ft=null,ii.useOffscreen())try{if(Ot)return;ii.webglObj.renderYUV(h,w,s);let e=ii.offscreenCanvas.transferToImageBitmap();postMessage({cmd:k,buffer:e,delay:ii.delay,ts:r},[e])}catch(e){ii.debug.error("worker","yuvData, transferToImageBitmap error is",e)}else postMessage({cmd:k,output:s,delay:ii.delay,ts:r},[s.buffer])},pcmData:function(e,r,i){if(ii.isDestroyed)return void ii.debug.log("worker","pcmData, decoder is destroyed and return");let s=r,a=[],o=0,d=ii._opt.audioBufferSize;for(let r=0;r<2;r++){let i=t.HEAPU32[(e>>2)+r]>>2;a[r]=t.HEAPF32.subarray(i,i+s)}if(_t){if(!(s>=(r=d-_t)))return _t+=s,n[0]=Float32Array.of(...n[0],...a[0]),void(2==St&&(n[1]=Float32Array.of(...n[1],...a[1])));ht[0]=Float32Array.of(...n[0],...a[0].subarray(0,r)),2==St&&(ht[1]=Float32Array.of(...n[1],...a[1].subarray(0,r))),postMessage({cmd:C,buffer:ht,ts:i},ht.map((e=>e.buffer))),o=r,s-=r}for(_t=s;_t>=d;_t-=d)ht[0]=a[0].slice(o,o+=d),2==St&&(ht[1]=a[1].slice(o-d,o)),postMessage({cmd:C,buffer:ht,ts:i},ht.map((e=>e.buffer)));_t&&(n[0]=a[0].slice(o),2==St&&(n[1]=a[1].slice(o))),a=[]},errorInfo:function(e){null===ft&&(ft=tr());const t=tr(),r=rr(pt>0?2*pt:5e3,1e3,5e3),i=t-ft;i>r&&(ii.debug.warn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${pt} and diff is ${i} and maxDiff is ${r}\n and replay`),Ht=!0,postMessage({cmd:W}))},sendWebsocketMessage:function(e){o?o.readyState===De?o.send(e):ii.debug.error("worker","socket is not open"):ii.debug.error("worker","socket is null")},timeEnd:function(){},postStreamToMain(e,t){postMessage({cmd:Y,type:t,buffer:e},[e.buffer])}};ii.debug=new Br(ii);let ni=null;t.AudioDecoder&&(ni=new t.AudioDecoder(ii));let si=null;e.VideoDecoder&&(si=new e.VideoDecoder(ii)),postMessage({cmd:U}),self.onmessage=function(e){let t=e.data;switch(t.cmd){case le:try{ii._opt=Object.assign(ii._opt,JSON.parse(t.opt))}catch(e){}ii.init();break;case ce:ii.pushBuffer(t.buffer,t.options);break;case ue:ii.decodeAudio(t.buffer,t.ts);break;case he:ii.decodeVideo(t.buffer,t.ts,t.isIFrame);break;case _e:ii.clearBuffer(t.needClear);break;case me:ii.fetchStream(t.url,JSON.parse(t.opt));break;case fe:ii.debug.log("worker","close",JSON.stringify(t.options)),t.options&&yr(t.options.isVideoInited)&&(wr=t.options.isVideoInited),ii.close();break;case pe:ii.debug.log("worker","updateConfig",t.key,t.value),ii._opt[t.key]=t.value,"playbackRate"===t.key&&(ii.playbackUpdatePlaybackRate(),ii.isPlaybackCacheBeforeDecodeForFpsRender()&&ii.playbackCacheLoop());break;case ge:ii.sendWebsocketMessage(t.message);break;case ye:ri.$video.currentTime=Number(t.message)}}}(e,e)}))})); diff --git a/pages_player/static/h5/js/jessibuca-pro/decoder-pro-audio.wasm b/pages_player/static/h5/js/jessibuca-pro/decoder-pro-audio.wasm new file mode 100644 index 0000000..362b51d Binary files /dev/null and b/pages_player/static/h5/js/jessibuca-pro/decoder-pro-audio.wasm differ diff --git a/pages_player/static/h5/js/jessibuca-pro/decoder-pro-simd.js b/pages_player/static/h5/js/jessibuca-pro/decoder-pro-simd.js new file mode 100644 index 0000000..d230868 --- /dev/null +++ b/pages_player/static/h5/js/jessibuca-pro/decoder-pro-simd.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("crypto")):"function"==typeof define&&define.amd?define(["crypto"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).crypto$1)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r,n=t(e),s=(r="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href,async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var t,i,n;(n=e).ready=new Promise(((e,r)=>{t=e,i=r})),(n=void 0!==n?n:{}).locateFile=function(e){return"decoder-pro-simd.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_SIMD_WASM_URL&&""!=JESSIBUCA_PRO_SIMD_WASM_URL?JESSIBUCA_PRO_SIMD_WASM_URL:e};var s,a,o,d=Object.assign({},n),l="object"==typeof window,c="function"==typeof importScripts,u="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,h="";function f(e){return n.locateFile?n.locateFile(e,h):h+e}if(u){const{createRequire:e}=await import("module");var p=e("undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href),m=p("fs"),_=p("path");h=c?_.dirname(h)+"/":p("url").fileURLToPath(new URL("./","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href)),s=(e,t)=>(e=Y(e)?new URL(e):_.normalize(e),m.readFileSync(e,t?void 0:"utf8")),o=e=>{var t=s(e,!0);return t.buffer||(t=new Uint8Array(t)),t},a=function(e,t,r){let i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];e=Y(e)?new URL(e):_.normalize(e),m.readFile(e,i?void 0:"utf8",((e,n)=>{e?r(e):t(i?n.buffer:n)}))},!n.thisProgram&&process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),n.inspect=()=>"[Emscripten Module object]"}else(l||c)&&(c?h=self.location.href:"undefined"!=typeof document&&document.currentScript&&(h=document.currentScript.src),r&&(h=r),h=0!==h.indexOf("blob:")?h.substr(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},c&&(o=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),a=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var g,y,v=n.print||console.log.bind(console),b=n.printErr||console.error.bind(console);Object.assign(n,d),d=null,n.arguments&&n.arguments,n.thisProgram&&n.thisProgram,n.quit&&n.quit,n.wasmBinary&&(g=n.wasmBinary),"object"!=typeof WebAssembly&&V("no native wasm support detected");var w,S,E,A,B,x,U,T,k=!1;function C(){var e=y.buffer;n.HEAP8=w=new Int8Array(e),n.HEAP16=E=new Int16Array(e),n.HEAPU8=S=new Uint8Array(e),n.HEAPU16=A=new Uint16Array(e),n.HEAP32=B=new Int32Array(e),n.HEAPU32=x=new Uint32Array(e),n.HEAPF32=U=new Float32Array(e),n.HEAPF64=T=new Float64Array(e)}var D=[],P=[],I=[];function F(){if(n.preRun)for("function"==typeof n.preRun&&(n.preRun=[n.preRun]);n.preRun.length;)M(n.preRun.shift());ee(D)}function L(){ee(P)}function R(){if(n.postRun)for("function"==typeof n.postRun&&(n.postRun=[n.postRun]);n.postRun.length;)N(n.postRun.shift());ee(I)}function M(e){D.unshift(e)}function z(e){P.unshift(e)}function N(e){I.unshift(e)}var O=0,$=null;function G(e){O++,n.monitorRunDependencies&&n.monitorRunDependencies(O)}function H(e){if(O--,n.monitorRunDependencies&&n.monitorRunDependencies(O),0==O&&$){var t=$;$=null,t()}}function V(e){n.onAbort&&n.onAbort(e),b(e="Aborted("+e+")"),k=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw i(t),t}var W,j="data:application/octet-stream;base64,",q=e=>e.startsWith(j),Y=e=>e.startsWith("file://");function K(e){if(e==W&&g)return new Uint8Array(g);if(o)return o(e);throw"both async and sync fetching of the wasm failed"}function X(e){if(!g&&(l||c)){if("function"==typeof fetch&&!Y(e))return fetch(e,{credentials:"same-origin"}).then((t=>{if(!t.ok)throw"failed to load wasm binary file at '"+e+"'";return t.arrayBuffer()})).catch((()=>K(e)));if(a)return new Promise(((t,r)=>{a(e,(e=>t(new Uint8Array(e))),r)}))}return Promise.resolve().then((()=>K(e)))}function Z(e,t,r){return X(e).then((e=>WebAssembly.instantiate(e,t))).then((e=>e)).then(r,(e=>{b(`failed to asynchronously prepare wasm: ${e}`),V(e)}))}function J(e,t,r,i){return e||"function"!=typeof WebAssembly.instantiateStreaming||q(t)||Y(t)||u||"function"!=typeof fetch?Z(t,r,i):fetch(t,{credentials:"same-origin"}).then((e=>WebAssembly.instantiateStreaming(e,r).then(i,(function(e){return b(`wasm streaming compile failed: ${e}`),b("falling back to ArrayBuffer instantiation"),Z(t,r,i)}))))}function Q(){var e={a:Ar};function t(e,t){return Br=e.exports,y=Br.C,C(),rt=Br.G,z(Br.D),H(),Br}if(G(),n.instantiateWasm)try{return n.instantiateWasm(e,t)}catch(e){b(`Module.instantiateWasm callback failed with error: ${e}`),i(e)}return J(g,W,e,(function(e){t(e.instance)})).catch(i),{}}n.locateFile?q(W="decoder-pro-simd.wasm")||(W=f(W)):W=new URL("decoder-pro-simd.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href).href;var ee=e=>{for(;e.length>0;)e.shift()(n)};function te(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){x[this.ptr+4>>2]=e},this.get_type=function(){return x[this.ptr+4>>2]},this.set_destructor=function(e){x[this.ptr+8>>2]=e},this.get_destructor=function(){return x[this.ptr+8>>2]},this.set_caught=function(e){e=e?1:0,w[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=w[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,w[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=w[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)},this.set_adjusted_ptr=function(e){x[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return x[this.ptr+16>>2]},this.get_exception_ptr=function(){if(kr(this.get_type()))return x[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}n.noExitRuntime;var re,ie,ne,se=(e,t,r)=>{throw new te(e).init(t,r),e},ae=(e,t,r,i,n)=>{},oe=()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);re=e},de=e=>{for(var t="",r=e;S[r];)t+=re[S[r++]];return t},le={},ce={},ue={},he=e=>{throw new ie(e)},fe=e=>{throw new ne(e)},pe=(e,t,r)=>{function i(t){var i=r(t);i.length!==e.length&&fe("Mismatched type converter count");for(var n=0;n{ce.hasOwnProperty(e)?n[t]=ce[e]:(s.push(e),le.hasOwnProperty(e)||(le[e]=[]),le[e].push((()=>{n[t]=ce[e],++a===s.length&&i(n)})))})),0===s.length&&i(n)};function me(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i=t.name;if(e||he(`type "${i}" must have a positive integer typeid pointer`),ce.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;he(`Cannot register type '${i}' twice`)}if(ce[e]=t,delete ue[e],le.hasOwnProperty(e)){var n=le[e];delete le[e],n.forEach((e=>e()))}}function _e(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return me(e,t,r)}var ge,ye=8,ve=(e,t,r,i)=>{_e(e,{name:t=de(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:i},argPackAdvance:ye,readValueFromPointer:function(e){return this.fromWireType(S[e])},destructorFunction:null})},be=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),we=e=>{he(e.$$.ptrType.registeredClass.name+" instance already deleted")},Se=!1,Ee=e=>{},Ae=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},Be=e=>{e.count.value-=1,0===e.count.value&&Ae(e)},xe=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var i=xe(e,t,r.baseClass);return null===i?null:r.downcast(i)},Ue={},Te=()=>Object.keys(Fe).length,ke=()=>{var e=[];for(var t in Fe)Fe.hasOwnProperty(t)&&e.push(Fe[t]);return e},Ce=[],De=()=>{for(;Ce.length;){var e=Ce.pop();e.$$.deleteScheduled=!1,e.delete()}},Pe=e=>{ge=e,Ce.length&&ge&&ge(De)},Ie=()=>{n.getInheritedInstanceCount=Te,n.getLiveInheritedInstances=ke,n.flushPendingDeletes=De,n.setDelayFunction=Pe},Fe={},Le=(e,t)=>{for(void 0===t&&he("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},Re=(e,t)=>(t=Le(e,t),Fe[t]),Me=(e,t)=>(t.ptrType&&t.ptr||fe("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&fe("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Ne(Object.create(e,{$$:{value:t}})));function ze(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=Re(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?Me(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Me(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,a=this.registeredClass.getActualType(t),o=Ue[a];if(!o)return n.call(this);s=this.isConst?o.constPointerType:o.pointerType;var d=xe(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?Me(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):Me(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}var Ne=e=>"undefined"==typeof FinalizationRegistry?(Ne=e=>e,e):(Se=new FinalizationRegistry((e=>{Be(e.$$)})),Ne=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};Se.register(e,r,e)}return e},Ee=e=>Se.unregister(e),Ne(e)),Oe=()=>{Object.assign($e.prototype,{isAliasOf(e){if(!(this instanceof $e))return!1;if(!(e instanceof $e))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n},clone(){if(this.$$.ptr||we(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Ne(Object.create(Object.getPrototypeOf(this),{$$:{value:be(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||we(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&he("Object already scheduled for deletion"),Ee(this),Be(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||we(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&he("Object already scheduled for deletion"),Ce.push(this),1===Ce.length&&ge&&ge(De),this.$$.deleteScheduled=!0,this}})};function $e(){}var Ge=(e,t)=>Object.defineProperty(t,"name",{value:e}),He=(e,t,r)=>{if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||he(`Function '${r}' called with an invalid number of arguments (${arguments.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}},Ve=(e,t,r)=>{n.hasOwnProperty(e)?((void 0===r||void 0!==n[e].overloadTable&&void 0!==n[e].overloadTable[r])&&he(`Cannot register public name '${e}' twice`),He(n,e,e),n.hasOwnProperty(r)&&he(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,void 0!==r&&(n[e].numArguments=r))},We=48,je=57,qe=e=>{if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=We&&t<=je?`_${e}`:e};function Ye(e,t,r,i,n,s,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}var Ke=(e,t,r)=>{for(;t!==r;)t.upcast||he(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e};function Xe(e,t){if(null===t)return this.isReference&&he(`null is not a valid ${this.name}`),0;t.$$||he(`Cannot pass "${Pt(t)}" as a ${this.name}`),t.$$.ptr||he(`Cannot pass deleted object as a pointer of type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ke(t.$$.ptr,r,this.registeredClass)}function Ze(e,t){var r;if(null===t)return this.isReference&&he(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||he(`Cannot pass "${Pt(t)}" as a ${this.name}`),t.$$.ptr||he(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&he(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var i=t.$$.ptrType.registeredClass;if(r=Ke(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&he("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:he(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,Tt.toHandle((()=>n.delete()))),null!==e&&e.push(this.rawDestructor,r)}break;default:he("Unsupporting sharing policy")}return r}function Je(e,t){if(null===t)return this.isReference&&he(`null is not a valid ${this.name}`),0;t.$$||he(`Cannot pass "${Pt(t)}" as a ${this.name}`),t.$$.ptr||he(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&he(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;return Ke(t.$$.ptr,r,this.registeredClass)}function Qe(e){return this.fromWireType(x[e>>2])}var et=()=>{Object.assign(tt.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor&&this.rawDestructor(e)},argPackAdvance:ye,readValueFromPointer:Qe,deleteObject(e){null!==e&&e.delete()},fromWireType:ze})};function tt(e,t,r,i,n,s,a,o,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=Ze:i?(this.toWireType=Xe,this.destructorFunction=null):(this.toWireType=Je,this.destructorFunction=null)}var rt,it,nt=(e,t,r)=>{n.hasOwnProperty(e)||fe("Replacing nonexistant public symbol"),void 0!==n[e].overloadTable&&void 0!==r?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},st=(e,t,r)=>{var i=n["dynCall_"+e];return r&&r.length?i.apply(null,[t].concat(r)):i.call(null,t)},at=[],ot=e=>{var t=at[e];return t||(e>=at.length&&(at.length=e+1),at[e]=t=rt.get(e)),t},dt=(e,t,r)=>e.includes("j")?st(e,t,r):ot(t).apply(null,r),lt=(e,t)=>{var r=[];return function(){return r.length=0,Object.assign(r,arguments),dt(e,t,r)}},ct=(e,t)=>{var r=(e=de(e)).includes("j")?lt(e,t):ot(t);return"function"!=typeof r&&he(`unknown function pointer with signature ${e}: ${t}`),r},ut=(e,t)=>{var r=Ge(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},r},ht=e=>{var t=Tr(e),r=de(t);return xr(t),r},ft=(e,t)=>{var r=[],i={};throw t.forEach((function e(t){i[t]||ce[t]||(ue[t]?ue[t].forEach(e):(r.push(t),i[t]=!0))})),new it(`${e}: `+r.map(ht).join([", "]))},pt=(e,t,r,i,n,s,a,o,d,l,c,u,h)=>{c=de(c),s=ct(n,s),o&&(o=ct(a,o)),l&&(l=ct(d,l)),h=ct(u,h);var f=qe(c);Ve(f,(function(){ft(`Cannot construct ${c} due to unbound types`,[i])})),pe([e,t,r],i?[i]:[],(function(t){var r,n;t=t[0],n=i?(r=t.registeredClass).instancePrototype:$e.prototype;var a=Ge(c,(function(){if(Object.getPrototypeOf(this)!==d)throw new ie("Use 'new' to construct "+c);if(void 0===u.constructor_body)throw new ie(c+" has no accessible constructor");var e=u.constructor_body[arguments.length];if(void 0===e)throw new ie(`Tried to invoke ctor of ${c} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(u.constructor_body).toString()}) parameters instead!`);return e.apply(this,arguments)})),d=Object.create(n,{constructor:{value:a}});a.prototype=d;var u=new Ye(c,a,d,h,r,s,o,l);u.baseClass&&(void 0===u.baseClass.__derivedClasses&&(u.baseClass.__derivedClasses=[]),u.baseClass.__derivedClasses.push(u));var p=new tt(c,u,!0,!1,!1),m=new tt(c+"*",u,!1,!1,!1),_=new tt(c+" const*",u,!1,!0,!1);return Ue[e]={pointerType:m,constPointerType:_},nt(f,a),[p,m,_]}))},mt=(e,t)=>{for(var r=[],i=0;i>2]);return r},_t=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function gt(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=Ge(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function yt(e,t,r,i,n,s){var a=t.length;a<2&&he("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,d=!1,l=1;l0?", ":"")+h),f+=(c||s?"var rv = ":"")+"invoker(fn"+(h.length>0?", ":"")+h+");\n",d)f+="runDestructors(destructors);\n";else for(l=o?1:2;l{var a=mt(t,r);n=ct(i,n),pe([],[e],(function(e){var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new ie(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{ft(`Cannot construct ${e.name} due to unbound types`,a)},pe([],a,(i=>(i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=yt(r,i,null,n,s),[]))),[]}))},bt=e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?e.substr(0,t):e},wt=(e,t,r,i,n,s,a,o,d)=>{var l=mt(r,i);t=de(t),t=bt(t),s=ct(n,s),pe([],[e],(function(e){var i=`${(e=e[0]).name}.${t}`;function n(){ft(`Cannot call ${i} due to unbound types`,l)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var c=e.registeredClass.instancePrototype,u=c[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,c[t]=n):(He(c,t,i),c[t].overloadTable[r-2]=n),pe([],l,(function(n){var o=yt(i,n,e,s,a,d);return void 0===c[t].overloadTable?(o.argCount=r-2,c[t]=o):c[t].overloadTable[r-2]=o,[]})),[]}))};function St(){Object.assign(Et.prototype,{get(e){return this.allocated[e]},has(e){return void 0!==this.allocated[e]},allocate(e){var t=this.freelist.pop()||this.allocated.length;return this.allocated[t]=e,t},free(e){this.allocated[e]=void 0,this.freelist.push(e)}})}function Et(){this.allocated=[void 0],this.freelist=[]}var At=new Et,Bt=e=>{e>=At.reserved&&0==--At.get(e).refcount&&At.free(e)},xt=()=>{for(var e=0,t=At.reserved;t{At.allocated.push({value:void 0},{value:null},{value:!0},{value:!1}),At.reserved=At.allocated.length,n.count_emval_handles=xt},Tt={toValue:e=>(e||he("Cannot use deleted val. handle = "+e),At.get(e).value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:return At.allocate({refcount:1,value:e})}}};function kt(e){return this.fromWireType(B[e>>2])}var Ct,Dt=(e,t)=>{_e(e,{name:t=de(t),fromWireType:e=>{var t=Tt.toValue(e);return Bt(e),t},toWireType:(e,t)=>Tt.toHandle(t),argPackAdvance:ye,readValueFromPointer:kt,destructorFunction:null})},Pt=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},It=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(U[e>>2])};case 8:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Ft=(e,t,r)=>{_e(e,{name:t=de(t),fromWireType:e=>e,toWireType:(e,t)=>t,argPackAdvance:ye,readValueFromPointer:It(t,r),destructorFunction:null})},Lt=(e,t,r)=>{switch(t){case 1:return r?e=>w[e>>0]:e=>S[e>>0];case 2:return r?e=>E[e>>1]:e=>A[e>>1];case 4:return r?e=>B[e>>2]:e=>x[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Rt=(e,t,r,i,n)=>{t=de(t);var s=e=>e;if(0===i){var a=32-8*r;s=e=>e<>>a}var o=t.includes("unsigned");_e(e,{name:t,fromWireType:s,toWireType:o?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:ye,readValueFromPointer:Lt(t,r,0!==i),destructorFunction:null})},Mt=(e,t,r)=>{var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=x[e>>2],r=x[e+4>>2];return new i(w.buffer,r,t)}_e(e,{name:r=de(r),fromWireType:n,argPackAdvance:ye,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},zt=(e,t,r,i)=>{if(!(i>0))return 0;for(var n=r,s=r+i-1,a=0;a=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),o<=127){if(r>=s)break;t[r++]=o}else if(o<=2047){if(r+1>=s)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=s)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=s)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-n},Nt=(e,t,r)=>zt(e,S,t,r),Ot=e=>{for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t},$t="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,Gt=(e,t,r)=>{for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&$t)return $t.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&a)<<6|o)}else s+=String.fromCharCode(a)}return s},Ht=(e,t)=>e?Gt(S,e,t):"",Vt=(e,t)=>{var r="std::string"===(t=de(t));_e(e,{name:t,fromWireType(e){var t,i=x[e>>2],n=e+4;if(r)for(var s=n,a=0;a<=i;++a){var o=n+a;if(a==i||0==S[o]){var d=Ht(s,o-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=o+1}}else{var l=new Array(i);for(a=0;a>2]=i,r&&n)Nt(t,a,i+1);else if(n)for(var o=0;o255&&(xr(a),he("String has UTF-16 code units that do not fit in 8 bits")),S[a+o]=d}else for(o=0;o{for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&A[i];)++i;if((r=i<<1)-e>32&&Wt)return Wt.decode(S.subarray(e,r));for(var s="",a=0;!(a>=t/2);++a){var o=E[e+2*a>>1];if(0==o)break;s+=String.fromCharCode(o)}return s},qt=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=a,t+=2}return E[t>>1]=0,t-i},Yt=e=>2*e.length,Kt=(e,t)=>{for(var r=0,i="";!(r>=t/4);){var n=B[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i},Xt=(e,t,r)=>{if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s)),B[t>>2]=a,(t+=4)+4>n)break}return B[t>>2]=0,t-i},Zt=e=>{for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t},Jt=(e,t,r)=>{var i,n,s,a,o;r=de(r),2===t?(i=jt,n=qt,a=Yt,s=()=>A,o=1):4===t&&(i=Kt,n=Xt,a=Zt,s=()=>x,o=2),_e(e,{name:r,fromWireType:e=>{for(var r,n=x[e>>2],a=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==a[c>>o]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return xr(e),r},toWireType:(e,i)=>{"string"!=typeof i&&he(`Cannot pass non-string to C++ string type ${r}`);var s=a(i),d=Ur(4+s+t);return x[d>>2]=s>>o,n(i,d+4,s+t),null!==e&&e.push(xr,d),d},argPackAdvance:ye,readValueFromPointer:kt,destructorFunction(e){xr(e)}})},Qt=(e,t)=>{_e(e,{isVoid:!0,name:t=de(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},er={},tr=e=>{var t=er[e];return void 0===t?de(e):t},rr=[],ir=(e,t,r,i,n)=>(e=rr[e])(t=Tt.toValue(t),t[r=tr(r)],i,n),nr=e=>{var t=rr.length;return rr.push(e),t},sr=(e,t)=>{var r=ce[e];return void 0===r&&he(t+" has unknown type "+ht(e)),r},ar=(e,t)=>{for(var r=new Array(e),i=0;i>2],"parameter "+i);return r},or=(e,t,r)=>{var i=[],n=e.toWireType(i,r);return i.length&&(x[t>>2]=Tt.toHandle(i)),n},dr=(e,t,r)=>{var i=ar(e,t),n=i.shift();e--;var s="return function (obj, func, destructorsRef, args) {\n",a=0,o=[];0===r&&o.push("obj");for(var d=["retType"],l=[n],c=0;ce.name)).join(", ")}) => ${n.name}>`;return nr(Ge(h,u))},lr=e=>{e>4&&(At.get(e).refcount+=1)},cr=e=>Tt.toHandle(tr(e)),ur=()=>Tt.toHandle({}),hr=e=>Tt.toHandle(Ht(e)),fr=e=>{var t=Tt.toValue(e);_t(t),Bt(e)},pr=(e,t,r)=>{e=Tt.toValue(e),t=Tt.toValue(t),r=Tt.toValue(r),e[t]=r},mr=(e,t)=>{var r=(e=sr(e,"_emval_take_value")).readValueFromPointer(t);return Tt.toHandle(r)},_r=()=>{V("")};Ct=()=>performance.now();var gr=(e,t,r)=>S.copyWithin(e,t,t+r),yr=e=>{V("OOM")},vr=e=>{S.length,yr()},br=[null,[],[]],wr=(e,t)=>{var r=br[e];0===t||10===t?((1===e?v:b)(Gt(r,0)),r.length=0):r.push(t)},Sr=(e,t,r,i)=>{for(var n=0,s=0;s>2],o=x[t+4>>2];t+=8;for(var d=0;d>2]=n,0};oe(),ie=n.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},ne=n.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},Oe(),Ie(),et(),it=n.UnboundTypeError=ut(Error,"UnboundTypeError"),St(),Ut();var Er,Ar={o:se,r:ae,x:ve,q:pt,p:vt,h:wt,w:Dt,k:Ft,b:Rt,a:Mt,l:Vt,i:Jt,y:Qt,g:ir,c:Bt,f:dr,z:lr,m:cr,B:ur,v:hr,e:fr,n:pr,A:mr,j:_r,d:Ct,u:gr,s:vr,t:Sr},Br=Q(),xr=e=>(xr=Br.E)(e),Ur=e=>(Ur=Br.F)(e),Tr=e=>(Tr=Br.H)(e),kr=e=>(kr=Br.I)(e);function Cr(){function e(){Er||(Er=!0,n.calledRun=!0,k||(L(),t(n),n.onRuntimeInitialized&&n.onRuntimeInitialized(),R()))}O>0||(F(),O>0||(n.setStatus?(n.setStatus("Running..."),setTimeout((function(){setTimeout((function(){n.setStatus("")}),1),e()}),1)):e()))}if(n.dynCall_jiji=(e,t,r,i,s)=>(n.dynCall_jiji=Br.J)(e,t,r,i,s),n.___start_em_js=143452,n.___stop_em_js=143509,$=function e(){Er||Cr(),Er||($=e)},n.preInit)for("function"==typeof n.preInit&&(n.preInit=[n.preInit]);n.preInit.length>0;)n.preInit.pop()();return Cr(),e.ready}),a=(()=>{var e="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href;return function(t){var r,i;(t=void 0!==(t=t||{})?t:{}).ready=new Promise((function(e,t){r=e,i=t})),(t=void 0!==t?t:{}).locateFile=function(e){return"decoder-pro-audio.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_AUDIO_WASM_URL&&""!=JESSIBUCA_PRO_AUDIO_WASM_URL?JESSIBUCA_PRO_AUDIO_WASM_URL:e};var n,s,a,o,d,l,c=Object.assign({},t),u="./this.program",h="object"==typeof window,f="function"==typeof importScripts,p="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,m="";p?(m=f?require("path").dirname(m)+"/":__dirname+"/",l=()=>{d||(o=require("fs"),d=require("path"))},n=function(e,t){return l(),e=d.normalize(e),o.readFileSync(e,t?void 0:"utf8")},a=e=>{var t=n(e,!0);return t.buffer||(t=new Uint8Array(t)),t},s=(e,t,r)=>{l(),e=d.normalize(e),o.readFile(e,(function(e,i){e?r(e):t(i.buffer)}))},process.argv.length>1&&(u=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(e){if(!(e instanceof J))throw e})),process.on("unhandledRejection",(function(e){throw e})),t.inspect=function(){return"[Emscripten Module object]"}):(h||f)&&(f?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),e&&(m=e),m=0!==m.indexOf("blob:")?m.substr(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1):"",n=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},f&&(a=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),s=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var _=t.print||console.log.bind(console),g=t.printErr||console.warn.bind(console);Object.assign(t,c),c=null,t.arguments&&t.arguments,t.thisProgram&&(u=t.thisProgram),t.quit&&t.quit;var y,v;t.wasmBinary&&(y=t.wasmBinary),t.noExitRuntime,"object"!=typeof WebAssembly&&V("no native wasm support detected");var b=!1;function w(e,t){e||V(t)}var S,E,A,B,x,U,T,k,C,D,P="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function I(e,t,r){for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&P)return P.decode(e.subarray(t,n));for(var s="";t>10,56320|1023&l)}}else s+=String.fromCharCode((31&a)<<6|o)}else s+=String.fromCharCode(a)}return s}function F(e,t){return e?I(A,e,t):""}function L(e,t,r,i){if(!(i>0))return 0;for(var n=r,s=r+i-1,a=0;a=55296&&o<=57343)o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a);if(o<=127){if(r>=s)break;t[r++]=o}else if(o<=2047){if(r+1>=s)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=s)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=s)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-n}function R(e){for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t}t.INITIAL_MEMORY;var M=[],z=[],N=[];var O=0,$=null;function G(e){O++,t.monitorRunDependencies&&t.monitorRunDependencies(O)}function H(e){if(O--,t.monitorRunDependencies&&t.monitorRunDependencies(O),0==O&&$){var r=$;$=null,r()}}function V(e){t.onAbort&&t.onAbort(e),g(e="Aborted("+e+")"),b=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw i(r),r}var W,j,q,Y;function K(e){return e.startsWith("data:application/octet-stream;base64,")}function X(e){return e.startsWith("file://")}function Z(e){try{if(e==W&&y)return new Uint8Array(y);if(a)return a(e);throw"both async and sync fetching of the wasm failed"}catch(e){V(e)}}function J(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Q(e){for(;e.length>0;)e.shift()(t)}function ee(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){T[this.ptr+4>>2]=e},this.get_type=function(){return T[this.ptr+4>>2]},this.set_destructor=function(e){T[this.ptr+8>>2]=e},this.get_destructor=function(){return T[this.ptr+8>>2]},this.set_refcount=function(e){U[this.ptr>>2]=e},this.set_caught=function(e){e=e?1:0,E[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=E[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,E[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=E[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var e=U[this.ptr>>2];U[this.ptr>>2]=e+1},this.release_ref=function(){var e=U[this.ptr>>2];return U[this.ptr>>2]=e-1,1===e},this.set_adjusted_ptr=function(e){T[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return T[this.ptr+16>>2]},this.get_exception_ptr=function(){if(jt(this.get_type()))return T[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}t.locateFile?K(W="decoder-pro-audio.wasm")||(j=W,W=t.locateFile?t.locateFile(j,m):m+j):W=new URL("decoder-pro-audio.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro-simd.js",document.baseURI).href).toString();var te={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=te.isAbs(e),r="/"===e.substr(-1);return(e=te.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=te.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=te.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments,0);return te.normalize(e.join("/"))},join2:(e,t)=>te.normalize(e+"/"+t)};var re={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:oe.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=te.isAbs(i)}return(t?"/":"")+(e=te.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=re.resolve(e).substr(1),t=re.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),s=Math.min(i.length,n.length),a=s,o=0;o0?r:R(e)+1,n=new Array(i),s=L(e,n,0,n.length);return t&&(n.length=s),n}var ne={ttys:[],init:function(){},shutdown:function(){},register:function(e,t){ne.ttys[e]={input:[],output:[],ops:t},oe.registerDevice(e,ne.stream_ops)},stream_ops:{open:function(e){var t=ne.ttys[e.node.rdev];if(!t)throw new oe.ErrnoError(43);e.tty=t,e.seekable=!1},close:function(e){e.tty.ops.flush(e.tty)},flush:function(e){e.tty.ops.flush(e.tty)},read:function(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new oe.ErrnoError(60);for(var s=0,a=0;a0?r.slice(0,i).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(t=window.prompt("Input: "))&&(t+="\n"):"function"==typeof readline&&null!==(t=readline())&&(t+="\n");if(!t)return null;e.input=ie(t,!0)}return e.input.shift()},put_char:function(e,t){null===t||10===t?(_(I(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(_(I(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,t){null===t||10===t?(g(I(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(g(I(e.output,0)),e.output=[])}}};function se(e){e=function(e,t){return Math.ceil(e/t)*t}(e,65536);var t=Wt(65536,e);return t?(function(e,t){A.fill(0,e,e+t)}(t,e),t):0}var ae={ops_table:null,mount:function(e){return ae.createNode(null,"/",16895,0)},createNode:function(e,t,r,i){if(oe.isBlkdev(r)||oe.isFIFO(r))throw new oe.ErrnoError(63);ae.ops_table||(ae.ops_table={dir:{node:{getattr:ae.node_ops.getattr,setattr:ae.node_ops.setattr,lookup:ae.node_ops.lookup,mknod:ae.node_ops.mknod,rename:ae.node_ops.rename,unlink:ae.node_ops.unlink,rmdir:ae.node_ops.rmdir,readdir:ae.node_ops.readdir,symlink:ae.node_ops.symlink},stream:{llseek:ae.stream_ops.llseek}},file:{node:{getattr:ae.node_ops.getattr,setattr:ae.node_ops.setattr},stream:{llseek:ae.stream_ops.llseek,read:ae.stream_ops.read,write:ae.stream_ops.write,allocate:ae.stream_ops.allocate,mmap:ae.stream_ops.mmap,msync:ae.stream_ops.msync}},link:{node:{getattr:ae.node_ops.getattr,setattr:ae.node_ops.setattr,readlink:ae.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ae.node_ops.getattr,setattr:ae.node_ops.setattr},stream:oe.chrdev_stream_ops}});var n=oe.createNode(e,t,r,i);return oe.isDir(n.mode)?(n.node_ops=ae.ops_table.dir.node,n.stream_ops=ae.ops_table.dir.stream,n.contents={}):oe.isFile(n.mode)?(n.node_ops=ae.ops_table.file.node,n.stream_ops=ae.ops_table.file.stream,n.usedBytes=0,n.contents=null):oe.isLink(n.mode)?(n.node_ops=ae.ops_table.link.node,n.stream_ops=ae.ops_table.link.stream):oe.isChrdev(n.mode)&&(n.node_ops=ae.ops_table.chrdev.node,n.stream_ops=ae.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage:function(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr:function(e){var t={};return t.dev=oe.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,oe.isDir(e.mode)?t.size=4096:oe.isFile(e.mode)?t.size=e.usedBytes:oe.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr:function(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&ae.resizeFileStorage(e,t.size)},lookup:function(e,t){throw oe.genericErrors[44]},mknod:function(e,t,r,i){return ae.createNode(e,t,r,i)},rename:function(e,t,r){if(oe.isDir(e.mode)){var i;try{i=oe.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new oe.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink:function(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir:function(e,t){var r=oe.lookupNode(e,t);for(var i in r.contents)throw new oe.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir:function(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink:function(e,t,r){var i=ae.createNode(e,t,41471,0);return i.link=r,i},readlink:function(e){if(!oe.isLink(e.mode))throw new oe.ErrnoError(28);return e.link}},stream_ops:{read:function(e,t,r,i,n){var s=e.node.contents;if(n>=e.node.usedBytes)return 0;var a=Math.min(e.node.usedBytes-n,i);if(a>8&&s.subarray)t.set(s.subarray(n,n+a),r);else for(var o=0;o0||r+t1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=re.resolve(oe.cwd(),e)))return{path:"",node:null};var r={follow_mount:!0,recurse_count:0};if(t=Object.assign(r,t),t.recurse_count>8)throw new oe.ErrnoError(32);for(var i=te.normalizeArray(e.split("/").filter((e=>!!e)),!1),n=oe.root,s="/",a=0;a40)throw new oe.ErrnoError(32)}}return{path:s,node:n}},getPath:e=>{for(var t;;){if(oe.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?r+"/"+t:r+t:r}t=t?e.name+"/"+t:e.name,e=e.parent}},hashName:(e,t)=>{for(var r=0,i=0;i>>0)%oe.nameTable.length},hashAddNode:e=>{var t=oe.hashName(e.parent.id,e.name);e.name_next=oe.nameTable[t],oe.nameTable[t]=e},hashRemoveNode:e=>{var t=oe.hashName(e.parent.id,e.name);if(oe.nameTable[t]===e)oe.nameTable[t]=e.name_next;else for(var r=oe.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode:(e,t)=>{var r=oe.mayLookup(e);if(r)throw new oe.ErrnoError(r,e);for(var i=oe.hashName(e.id,t),n=oe.nameTable[i];n;n=n.name_next){var s=n.name;if(n.parent.id===e.id&&s===t)return n}return oe.lookup(e,t)},createNode:(e,t,r,i)=>{var n=new oe.FSNode(e,t,r,i);return oe.hashAddNode(n),n},destroyNode:e=>{oe.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:e=>{var t=oe.flagModes[e];if(void 0===t)throw new Error("Unknown file open mode: "+e);return t},flagsToPermissionString:e=>{var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>oe.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup:e=>{var t=oe.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate:(e,t)=>{try{oe.lookupNode(e,t);return 20}catch(e){}return oe.nodePermissions(e,"wx")},mayDelete:(e,t,r)=>{var i;try{i=oe.lookupNode(e,t)}catch(e){return e.errno}var n=oe.nodePermissions(e,"wx");if(n)return n;if(r){if(!oe.isDir(i.mode))return 54;if(oe.isRoot(i)||oe.getPath(i)===oe.cwd())return 10}else if(oe.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?oe.isLink(e.mode)?32:oe.isDir(e.mode)&&("r"!==oe.flagsToPermissionString(t)||512&t)?31:oe.nodePermissions(e,oe.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:oe.MAX_OPEN_FDS;for(var r=e;r<=t;r++)if(!oe.streams[r])return r;throw new oe.ErrnoError(33)},getStream:e=>oe.streams[e],createStream:(e,t,r)=>{oe.FSStream||(oe.FSStream=function(){this.shared={}},oe.FSStream.prototype={},Object.defineProperties(oe.FSStream.prototype,{object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}},flags:{get:function(){return this.shared.flags},set:function(e){this.shared.flags=e}},position:{get:function(){return this.shared.position},set:function(e){this.shared.position=e}}})),e=Object.assign(new oe.FSStream,e);var i=oe.nextfd(t,r);return e.fd=i,oe.streams[i]=e,e},closeStream:e=>{oe.streams[e]=null},chrdev_stream_ops:{open:e=>{var t=oe.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:()=>{throw new oe.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice:(e,t)=>{oe.devices[e]={stream_ops:t}},getDevice:e=>oe.devices[e],getMounts:e=>{for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs:(e,t)=>{"function"==typeof e&&(t=e,e=!1),oe.syncFSRequests++,oe.syncFSRequests>1&&g("warning: "+oe.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var r=oe.getMounts(oe.root.mount),i=0;function n(e){return oe.syncFSRequests--,t(e)}function s(e){if(e)return s.errored?void 0:(s.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return s(null);t.type.syncfs(t,e,s)}))},mount:(e,t,r)=>{var i,n="/"===r,s=!r;if(n&&oe.root)throw new oe.ErrnoError(10);if(!n&&!s){var a=oe.lookupPath(r,{follow_mount:!1});if(r=a.path,i=a.node,oe.isMountpoint(i))throw new oe.ErrnoError(10);if(!oe.isDir(i.mode))throw new oe.ErrnoError(54)}var o={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(o);return d.mount=o,o.root=d,n?oe.root=d:i&&(i.mounted=o,i.mount&&i.mount.mounts.push(o)),d},unmount:e=>{var t=oe.lookupPath(e,{follow_mount:!1});if(!oe.isMountpoint(t.node))throw new oe.ErrnoError(28);var r=t.node,i=r.mounted,n=oe.getMounts(i);Object.keys(oe.nameTable).forEach((e=>{for(var t=oe.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&oe.destroyNode(t),t=r}})),r.mounted=null;var s=r.mount.mounts.indexOf(i);r.mount.mounts.splice(s,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod:(e,t,r)=>{var i=oe.lookupPath(e,{parent:!0}).node,n=te.basename(e);if(!n||"."===n||".."===n)throw new oe.ErrnoError(28);var s=oe.mayCreate(i,n);if(s)throw new oe.ErrnoError(s);if(!i.node_ops.mknod)throw new oe.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,oe.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,oe.mknod(e,t,0)),mkdirTree:(e,t)=>{for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,oe.mknod(e,t,r)),symlink:(e,t)=>{if(!re.resolve(e))throw new oe.ErrnoError(44);var r=oe.lookupPath(t,{parent:!0}).node;if(!r)throw new oe.ErrnoError(44);var i=te.basename(t),n=oe.mayCreate(r,i);if(n)throw new oe.ErrnoError(n);if(!r.node_ops.symlink)throw new oe.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename:(e,t)=>{var r,i,n=te.dirname(e),s=te.dirname(t),a=te.basename(e),o=te.basename(t);if(r=oe.lookupPath(e,{parent:!0}).node,i=oe.lookupPath(t,{parent:!0}).node,!r||!i)throw new oe.ErrnoError(44);if(r.mount!==i.mount)throw new oe.ErrnoError(75);var d,l=oe.lookupNode(r,a),c=re.relative(e,s);if("."!==c.charAt(0))throw new oe.ErrnoError(28);if("."!==(c=re.relative(t,n)).charAt(0))throw new oe.ErrnoError(55);try{d=oe.lookupNode(i,o)}catch(e){}if(l!==d){var u=oe.isDir(l.mode),h=oe.mayDelete(r,a,u);if(h)throw new oe.ErrnoError(h);if(h=d?oe.mayDelete(i,o,u):oe.mayCreate(i,o))throw new oe.ErrnoError(h);if(!r.node_ops.rename)throw new oe.ErrnoError(63);if(oe.isMountpoint(l)||d&&oe.isMountpoint(d))throw new oe.ErrnoError(10);if(i!==r&&(h=oe.nodePermissions(r,"w")))throw new oe.ErrnoError(h);oe.hashRemoveNode(l);try{r.node_ops.rename(l,i,o)}catch(e){throw e}finally{oe.hashAddNode(l)}}},rmdir:e=>{var t=oe.lookupPath(e,{parent:!0}).node,r=te.basename(e),i=oe.lookupNode(t,r),n=oe.mayDelete(t,r,!0);if(n)throw new oe.ErrnoError(n);if(!t.node_ops.rmdir)throw new oe.ErrnoError(63);if(oe.isMountpoint(i))throw new oe.ErrnoError(10);t.node_ops.rmdir(t,r),oe.destroyNode(i)},readdir:e=>{var t=oe.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new oe.ErrnoError(54);return t.node_ops.readdir(t)},unlink:e=>{var t=oe.lookupPath(e,{parent:!0}).node;if(!t)throw new oe.ErrnoError(44);var r=te.basename(e),i=oe.lookupNode(t,r),n=oe.mayDelete(t,r,!1);if(n)throw new oe.ErrnoError(n);if(!t.node_ops.unlink)throw new oe.ErrnoError(63);if(oe.isMountpoint(i))throw new oe.ErrnoError(10);t.node_ops.unlink(t,r),oe.destroyNode(i)},readlink:e=>{var t=oe.lookupPath(e).node;if(!t)throw new oe.ErrnoError(44);if(!t.node_ops.readlink)throw new oe.ErrnoError(28);return re.resolve(oe.getPath(t.parent),t.node_ops.readlink(t))},stat:(e,t)=>{var r=oe.lookupPath(e,{follow:!t}).node;if(!r)throw new oe.ErrnoError(44);if(!r.node_ops.getattr)throw new oe.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>oe.stat(e,!0),chmod:(e,t,r)=>{var i;"string"==typeof e?i=oe.lookupPath(e,{follow:!r}).node:i=e;if(!i.node_ops.setattr)throw new oe.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod:(e,t)=>{oe.chmod(e,t,!0)},fchmod:(e,t)=>{var r=oe.getStream(e);if(!r)throw new oe.ErrnoError(8);oe.chmod(r.node,t)},chown:(e,t,r,i)=>{var n;"string"==typeof e?n=oe.lookupPath(e,{follow:!i}).node:n=e;if(!n.node_ops.setattr)throw new oe.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown:(e,t,r)=>{oe.chown(e,t,r,!0)},fchown:(e,t,r)=>{var i=oe.getStream(e);if(!i)throw new oe.ErrnoError(8);oe.chown(i.node,t,r)},truncate:(e,t)=>{if(t<0)throw new oe.ErrnoError(28);var r;"string"==typeof e?r=oe.lookupPath(e,{follow:!0}).node:r=e;if(!r.node_ops.setattr)throw new oe.ErrnoError(63);if(oe.isDir(r.mode))throw new oe.ErrnoError(31);if(!oe.isFile(r.mode))throw new oe.ErrnoError(28);var i=oe.nodePermissions(r,"w");if(i)throw new oe.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate:(e,t)=>{var r=oe.getStream(e);if(!r)throw new oe.ErrnoError(8);if(0==(2097155&r.flags))throw new oe.ErrnoError(28);oe.truncate(r.node,t)},utime:(e,t,r)=>{var i=oe.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open:(e,r,i)=>{if(""===e)throw new oe.ErrnoError(44);var n;if(i=void 0===i?438:i,i=64&(r="string"==typeof r?oe.modeStringToFlags(r):r)?4095&i|32768:0,"object"==typeof e)n=e;else{e=te.normalize(e);try{n=oe.lookupPath(e,{follow:!(131072&r)}).node}catch(e){}}var s=!1;if(64&r)if(n){if(128&r)throw new oe.ErrnoError(20)}else n=oe.mknod(e,i,0),s=!0;if(!n)throw new oe.ErrnoError(44);if(oe.isChrdev(n.mode)&&(r&=-513),65536&r&&!oe.isDir(n.mode))throw new oe.ErrnoError(54);if(!s){var a=oe.mayOpen(n,r);if(a)throw new oe.ErrnoError(a)}512&r&&!s&&oe.truncate(n,0),r&=-131713;var o=oe.createStream({node:n,path:oe.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return o.stream_ops.open&&o.stream_ops.open(o),!t.logReadFiles||1&r||(oe.readFiles||(oe.readFiles={}),e in oe.readFiles||(oe.readFiles[e]=1)),o},close:e=>{if(oe.isClosed(e))throw new oe.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{oe.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek:(e,t,r)=>{if(oe.isClosed(e))throw new oe.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new oe.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new oe.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read:(e,t,r,i,n)=>{if(i<0||n<0)throw new oe.ErrnoError(28);if(oe.isClosed(e))throw new oe.ErrnoError(8);if(1==(2097155&e.flags))throw new oe.ErrnoError(8);if(oe.isDir(e.node.mode))throw new oe.ErrnoError(31);if(!e.stream_ops.read)throw new oe.ErrnoError(28);var s=void 0!==n;if(s){if(!e.seekable)throw new oe.ErrnoError(70)}else n=e.position;var a=e.stream_ops.read(e,t,r,i,n);return s||(e.position+=a),a},write:(e,t,r,i,n,s)=>{if(i<0||n<0)throw new oe.ErrnoError(28);if(oe.isClosed(e))throw new oe.ErrnoError(8);if(0==(2097155&e.flags))throw new oe.ErrnoError(8);if(oe.isDir(e.node.mode))throw new oe.ErrnoError(31);if(!e.stream_ops.write)throw new oe.ErrnoError(28);e.seekable&&1024&e.flags&&oe.llseek(e,0,2);var a=void 0!==n;if(a){if(!e.seekable)throw new oe.ErrnoError(70)}else n=e.position;var o=e.stream_ops.write(e,t,r,i,n,s);return a||(e.position+=o),o},allocate:(e,t,r)=>{if(oe.isClosed(e))throw new oe.ErrnoError(8);if(t<0||r<=0)throw new oe.ErrnoError(28);if(0==(2097155&e.flags))throw new oe.ErrnoError(8);if(!oe.isFile(e.node.mode)&&!oe.isDir(e.node.mode))throw new oe.ErrnoError(43);if(!e.stream_ops.allocate)throw new oe.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap:(e,t,r,i,n)=>{if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new oe.ErrnoError(2);if(1==(2097155&e.flags))throw new oe.ErrnoError(2);if(!e.stream_ops.mmap)throw new oe.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e&&e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl:(e,t,r)=>{if(!e.stream_ops.ioctl)throw new oe.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error('Invalid encoding type "'+t.encoding+'"');var r,i=oe.open(e,t.flags),n=oe.stat(e),s=n.size,a=new Uint8Array(s);return oe.read(i,a,0,s,0),"utf8"===t.encoding?r=I(a,0):"binary"===t.encoding&&(r=a),oe.close(i),r},writeFile:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=oe.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(R(t)+1),s=L(t,n,0,n.length);oe.write(i,n,0,s,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");oe.write(i,t,0,t.byteLength,void 0,r.canOwn)}oe.close(i)},cwd:()=>oe.currentPath,chdir:e=>{var t=oe.lookupPath(e,{follow:!0});if(null===t.node)throw new oe.ErrnoError(44);if(!oe.isDir(t.node.mode))throw new oe.ErrnoError(54);var r=oe.nodePermissions(t.node,"x");if(r)throw new oe.ErrnoError(r);oe.currentPath=t.path},createDefaultDirectories:()=>{oe.mkdir("/tmp"),oe.mkdir("/home"),oe.mkdir("/home/web_user")},createDefaultDevices:()=>{oe.mkdir("/dev"),oe.registerDevice(oe.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),oe.mkdev("/dev/null",oe.makedev(1,3)),ne.register(oe.makedev(5,0),ne.default_tty_ops),ne.register(oe.makedev(6,0),ne.default_tty1_ops),oe.mkdev("/dev/tty",oe.makedev(5,0)),oe.mkdev("/dev/tty1",oe.makedev(6,0));var e=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var e=new Uint8Array(1);return()=>(crypto.getRandomValues(e),e[0])}if(p)try{var t=require("crypto");return()=>t.randomBytes(1)[0]}catch(e){}return()=>V("randomDevice")}();oe.createDevice("/dev","random",e),oe.createDevice("/dev","urandom",e),oe.mkdir("/dev/shm"),oe.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{oe.mkdir("/proc");var e=oe.mkdir("/proc/self");oe.mkdir("/proc/self/fd"),oe.mount({mount:()=>{var t=oe.createNode(e,"fd",16895,73);return t.node_ops={lookup:(e,t)=>{var r=+t,i=oe.getStream(r);if(!i)throw new oe.ErrnoError(8);var n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams:()=>{t.stdin?oe.createDevice("/dev","stdin",t.stdin):oe.symlink("/dev/tty","/dev/stdin"),t.stdout?oe.createDevice("/dev","stdout",null,t.stdout):oe.symlink("/dev/tty","/dev/stdout"),t.stderr?oe.createDevice("/dev","stderr",null,t.stderr):oe.symlink("/dev/tty1","/dev/stderr"),oe.open("/dev/stdin",0),oe.open("/dev/stdout",1),oe.open("/dev/stderr",1)},ensureErrnoError:()=>{oe.ErrnoError||(oe.ErrnoError=function(e,t){this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},oe.ErrnoError.prototype=new Error,oe.ErrnoError.prototype.constructor=oe.ErrnoError,[44].forEach((e=>{oe.genericErrors[e]=new oe.ErrnoError(e),oe.genericErrors[e].stack=""})))},staticInit:()=>{oe.ensureErrnoError(),oe.nameTable=new Array(4096),oe.mount(ae,{},"/"),oe.createDefaultDirectories(),oe.createDefaultDevices(),oe.createSpecialDirectories(),oe.filesystems={MEMFS:ae}},init:(e,r,i)=>{oe.init.initialized=!0,oe.ensureErrnoError(),t.stdin=e||t.stdin,t.stdout=r||t.stdout,t.stderr=i||t.stderr,oe.createStandardStreams()},quit:()=>{oe.init.initialized=!1;for(var e=0;e{var r=0;return e&&(r|=365),t&&(r|=146),r},findObject:(e,t)=>{var r=oe.analyzePath(e,t);return r.exists?r.object:null},analyzePath:(e,t)=>{try{e=(i=oe.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var i=oe.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=i.path,r.parentObject=i.node,r.name=te.basename(e),i=oe.lookupPath(e,{follow:!t}),r.exists=!0,r.path=i.path,r.object=i.node,r.name=i.node.name,r.isRoot="/"===i.path}catch(e){r.error=e.errno}return r},createPath:(e,t,r,i)=>{e="string"==typeof e?e:oe.getPath(e);for(var n=t.split("/").reverse();n.length;){var s=n.pop();if(s){var a=te.join2(e,s);try{oe.mkdir(a)}catch(e){}e=a}}return a},createFile:(e,t,r,i,n)=>{var s=te.join2("string"==typeof e?e:oe.getPath(e),t),a=oe.getMode(i,n);return oe.create(s,a)},createDataFile:(e,t,r,i,n,s)=>{var a=t;e&&(e="string"==typeof e?e:oe.getPath(e),a=t?te.join2(e,t):e);var o=oe.getMode(i,n),d=oe.create(a,o);if(r){if("string"==typeof r){for(var l=new Array(r.length),c=0,u=r.length;c{var n=te.join2("string"==typeof e?e:oe.getPath(e),t),s=oe.getMode(!!r,!!i);oe.createDevice.major||(oe.createDevice.major=64);var a=oe.makedev(oe.createDevice.major++,0);return oe.registerDevice(a,{open:e=>{e.seekable=!1},close:e=>{i&&i.buffer&&i.buffer.length&&i(10)},read:(e,t,i,n,s)=>{for(var a=0,o=0;o{for(var a=0;a{if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!n)throw new Error("Cannot load without read() or XMLHttpRequest.");try{e.contents=ie(n(e.url),!0),e.usedBytes=e.contents.length}catch(e){throw new oe.ErrnoError(29)}},createLazyFile:(e,t,r,i,n)=>{function s(){this.lengthKnown=!1,this.chunks=[]}if(s.prototype.get=function(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},s.prototype.setDataGetter=function(e){this.getter=e},s.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,s=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,a=1048576;n||(a=i);var o=this;o.setDataGetter((e=>{var t=e*a,n=(e+1)*a-1;if(n=Math.min(n,i-1),void 0===o.chunks[e]&&(o.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==a&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ie(n.responseText||"",!0)})(t,n)),void 0===o.chunks[e])throw new Error("doXHR failed!");return o.chunks[e]})),!s&&i||(a=i=1,i=this.getter(0).length,a=i,_("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=a,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!f)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var a=new s;Object.defineProperties(a,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var o={isDevice:!1,contents:a}}else o={isDevice:!1,url:r};var d=oe.createFile(e,t,o,i,n);o.contents?d.contents=o.contents:o.url&&(d.contents=null,d.url=o.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,t,r,i,n){var s=e.node.contents;if(n>=s.length)return 0;var a=Math.min(s.length-n,i);if(s.slice)for(var o=0;o{var t=d.stream_ops[e];l[e]=function(){return oe.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>(oe.forceLoadFile(d),c(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{oe.forceLoadFile(d);var s=se(t);if(!s)throw new oe.ErrnoError(48);return c(e,E,s,t,r),{ptr:s,allocated:!0}},d.stream_ops=l,d},createPreloadedFile:(e,t,r,i,n,a,o,d,l,c)=>{var u=t?re.resolve(te.join2(e,t)):e;function h(r){function s(r){c&&c(),d||oe.createDataFile(e,t,r,i,n,l),a&&a(),H()}Browser.handledByPreloadPlugin(r,u,s,(()=>{o&&o(),H()}))||s(r)}G(),"string"==typeof r?function(e,t,r,i){var n=i?"":"al "+e;s(e,(r=>{w(r,'Loading data file "'+e+'" failed (no arrayBuffer).'),t(new Uint8Array(r)),n&&H()}),(t=>{if(!r)throw'Loading data file "'+e+'" failed.';r()})),n&&G()}(r,(e=>h(e)),o):h(r)},indexedDB:()=>window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,DB_NAME:()=>"EM_FS_"+window.location.pathname,DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(e,t,r)=>{t=t||(()=>{}),r=r||(()=>{});var i=oe.indexedDB();try{var n=i.open(oe.DB_NAME(),oe.DB_VERSION)}catch(e){return r(e)}n.onupgradeneeded=()=>{_("creating db"),n.result.createObjectStore(oe.DB_STORE_NAME)},n.onsuccess=()=>{var i=n.result.transaction([oe.DB_STORE_NAME],"readwrite"),s=i.objectStore(oe.DB_STORE_NAME),a=0,o=0,d=e.length;function l(){0==o?t():r()}e.forEach((e=>{var t=s.put(oe.analyzePath(e).object.contents,e);t.onsuccess=()=>{++a+o==d&&l()},t.onerror=()=>{o++,a+o==d&&l()}})),i.onerror=r},n.onerror=r},loadFilesFromDB:(e,t,r)=>{t=t||(()=>{}),r=r||(()=>{});var i=oe.indexedDB();try{var n=i.open(oe.DB_NAME(),oe.DB_VERSION)}catch(e){return r(e)}n.onupgradeneeded=r,n.onsuccess=()=>{var i=n.result;try{var s=i.transaction([oe.DB_STORE_NAME],"readonly")}catch(e){return void r(e)}var a=s.objectStore(oe.DB_STORE_NAME),o=0,d=0,l=e.length;function c(){0==d?t():r()}e.forEach((e=>{var t=a.get(e);t.onsuccess=()=>{oe.analyzePath(e).exists&&oe.unlink(e),oe.createDataFile(te.dirname(e),te.basename(e),t.result,!0,!0,!0),++o+d==l&&c()},t.onerror=()=>{d++,o+d==l&&c()}})),s.onerror=r},n.onerror=r}},de={DEFAULT_POLLMASK:5,calculateAt:function(e,t,r){if(te.isAbs(t))return t;var i;if(-100===e)i=oe.cwd();else{var n=oe.getStream(e);if(!n)throw new oe.ErrnoError(8);i=n.path}if(0==t.length){if(!r)throw new oe.ErrnoError(44);return i}return te.join2(i,t)},doStat:function(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&te.normalize(t)!==te.normalize(oe.getPath(e.node)))return-54;throw e}return U[r>>2]=i.dev,U[r+4>>2]=0,U[r+8>>2]=i.ino,U[r+12>>2]=i.mode,U[r+16>>2]=i.nlink,U[r+20>>2]=i.uid,U[r+24>>2]=i.gid,U[r+28>>2]=i.rdev,U[r+32>>2]=0,Y=[i.size>>>0,(q=i.size,+Math.abs(q)>=1?q>0?(0|Math.min(+Math.floor(q/4294967296),4294967295))>>>0:~~+Math.ceil((q-+(~~q>>>0))/4294967296)>>>0:0)],U[r+40>>2]=Y[0],U[r+44>>2]=Y[1],U[r+48>>2]=4096,U[r+52>>2]=i.blocks,Y=[Math.floor(i.atime.getTime()/1e3)>>>0,(q=Math.floor(i.atime.getTime()/1e3),+Math.abs(q)>=1?q>0?(0|Math.min(+Math.floor(q/4294967296),4294967295))>>>0:~~+Math.ceil((q-+(~~q>>>0))/4294967296)>>>0:0)],U[r+56>>2]=Y[0],U[r+60>>2]=Y[1],U[r+64>>2]=0,Y=[Math.floor(i.mtime.getTime()/1e3)>>>0,(q=Math.floor(i.mtime.getTime()/1e3),+Math.abs(q)>=1?q>0?(0|Math.min(+Math.floor(q/4294967296),4294967295))>>>0:~~+Math.ceil((q-+(~~q>>>0))/4294967296)>>>0:0)],U[r+72>>2]=Y[0],U[r+76>>2]=Y[1],U[r+80>>2]=0,Y=[Math.floor(i.ctime.getTime()/1e3)>>>0,(q=Math.floor(i.ctime.getTime()/1e3),+Math.abs(q)>=1?q>0?(0|Math.min(+Math.floor(q/4294967296),4294967295))>>>0:~~+Math.ceil((q-+(~~q>>>0))/4294967296)>>>0:0)],U[r+88>>2]=Y[0],U[r+92>>2]=Y[1],U[r+96>>2]=0,Y=[i.ino>>>0,(q=i.ino,+Math.abs(q)>=1?q>0?(0|Math.min(+Math.floor(q/4294967296),4294967295))>>>0:~~+Math.ceil((q-+(~~q>>>0))/4294967296)>>>0:0)],U[r+104>>2]=Y[0],U[r+108>>2]=Y[1],0},doMsync:function(e,t,r,i,n){var s=A.slice(e,e+r);oe.msync(t,s,n,r,i)},varargs:void 0,get:function(){return de.varargs+=4,U[de.varargs-4>>2]},getStr:function(e){return F(e)},getStreamFromFD:function(e){var t=oe.getStream(e);if(!t)throw new oe.ErrnoError(8);return t}};function le(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}var ce=void 0;function ue(e){for(var t="",r=e;A[r];)t+=ce[A[r++]];return t}var he={},fe={},pe={};function me(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?"_"+e:e}function _e(e,t){return e=me(e),new Function("body","return function "+e+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(t)}function ge(e,t){var r=_e(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},r}var ye=void 0;function ve(e){throw new ye(e)}var be=void 0;function we(e){throw new be(e)}function Se(e,t,r){function i(t){var i=r(t);i.length!==e.length&&we("Mismatched type converter count");for(var n=0;n{fe.hasOwnProperty(e)?n[t]=fe[e]:(s.push(e),he.hasOwnProperty(e)||(he[e]=[]),he[e].push((()=>{n[t]=fe[e],++a===s.length&&i(n)})))})),0===s.length&&i(n)}function Ee(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var i=t.name;if(e||ve('type "'+i+'" must have a positive integer typeid pointer'),fe.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;ve("Cannot register type '"+i+"' twice")}if(fe[e]=t,delete pe[e],he.hasOwnProperty(e)){var n=he[e];delete he[e],n.forEach((e=>e()))}}function Ae(e){if(!(this instanceof je))return!1;if(!(e instanceof je))return!1;for(var t=this.$$.ptrType.registeredClass,r=this.$$.ptr,i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n}function Be(e){ve(e.$$.ptrType.registeredClass.name+" instance already deleted")}var xe=!1;function Ue(e){}function Te(e){e.count.value-=1,0===e.count.value&&function(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}(e)}function ke(e,t,r){if(t===r)return e;if(void 0===r.baseClass)return null;var i=ke(e,t,r.baseClass);return null===i?null:r.downcast(i)}var Ce={};function De(){return Object.keys(Me).length}function Pe(){var e=[];for(var t in Me)Me.hasOwnProperty(t)&&e.push(Me[t]);return e}var Ie=[];function Fe(){for(;Ie.length;){var e=Ie.pop();e.$$.deleteScheduled=!1,e.delete()}}var Le=void 0;function Re(e){Le=e,Ie.length&&Le&&Le(Fe)}var Me={};function ze(e,t){return t=function(e,t){for(void 0===t&&ve("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}(e,t),Me[t]}function Ne(e,t){return t.ptrType&&t.ptr||we("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!==!!t.smartPtr&&we("Both smartPtrType and smartPtr must be specified"),t.count={value:1},$e(Object.create(e,{$$:{value:t}}))}function Oe(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ze(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?Ne(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Ne(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var s,a=this.registeredClass.getActualType(t),o=Ce[a];if(!o)return n.call(this);s=this.isConst?o.constPointerType:o.pointerType;var d=ke(t,this.registeredClass,s.registeredClass);return null===d?n.call(this):this.isSmartPointer?Ne(s.registeredClass.instancePrototype,{ptrType:s,ptr:d,smartPtrType:this,smartPtr:e}):Ne(s.registeredClass.instancePrototype,{ptrType:s,ptr:d})}function $e(e){return"undefined"==typeof FinalizationRegistry?($e=e=>e,e):(xe=new FinalizationRegistry((e=>{Te(e.$$)})),$e=e=>{var t=e.$$;if(!!t.smartPtr){var r={$$:t};xe.register(e,r,e)}return e},Ue=e=>xe.unregister(e),$e(e))}function Ge(){if(this.$$.ptr||Be(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=$e(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}function He(){this.$$.ptr||Be(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ve("Object already scheduled for deletion"),Ue(this),Te(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Ve(){return!this.$$.ptr}function We(){return this.$$.ptr||Be(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ve("Object already scheduled for deletion"),Ie.push(this),1===Ie.length&&Le&&Le(Fe),this.$$.deleteScheduled=!0,this}function je(){}function qe(e,t,r){if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||ve("Function '"+r+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}}function Ye(e,t,r,i,n,s,a,o){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=s,this.upcast=a,this.downcast=o,this.pureVirtualFunctions=[]}function Ke(e,t,r){for(;t!==r;)t.upcast||ve("Expected null or instance of "+r.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function Xe(e,t){if(null===t)return this.isReference&&ve("null is not a valid "+this.name),0;t.$$||ve('Cannot pass "'+wt(t)+'" as a '+this.name),t.$$.ptr||ve("Cannot pass deleted object as a pointer of type "+this.name);var r=t.$$.ptrType.registeredClass;return Ke(t.$$.ptr,r,this.registeredClass)}function Ze(e,t){var r;if(null===t)return this.isReference&&ve("null is not a valid "+this.name),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||ve('Cannot pass "'+wt(t)+'" as a '+this.name),t.$$.ptr||ve("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&ve("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var i=t.$$.ptrType.registeredClass;if(r=Ke(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&ve("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:ve("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,bt.toHandle((function(){n.delete()}))),null!==e&&e.push(this.rawDestructor,r)}break;default:ve("Unsupporting sharing policy")}return r}function Je(e,t){if(null===t)return this.isReference&&ve("null is not a valid "+this.name),0;t.$$||ve('Cannot pass "'+wt(t)+'" as a '+this.name),t.$$.ptr||ve("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&ve("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var r=t.$$.ptrType.registeredClass;return Ke(t.$$.ptr,r,this.registeredClass)}function Qe(e){return this.fromWireType(U[e>>2])}function et(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function tt(e){this.rawDestructor&&this.rawDestructor(e)}function rt(e){null!==e&&e.delete()}function it(e,t,r,i,n,s,a,o,d,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=s,this.sharingPolicy=a,this.rawGetPointee=o,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=c,n||void 0!==t.baseClass?this.toWireType=Ze:i?(this.toWireType=Xe,this.destructorFunction=null):(this.toWireType=Je,this.destructorFunction=null)}var nt=[];function st(e){var t=nt[e];return t||(e>=nt.length&&(nt.length=e+1),nt[e]=t=D.get(e)),t}function at(e,r,i){return e.includes("j")?function(e,r,i){var n=t["dynCall_"+e];return i&&i.length?n.apply(null,[r].concat(i)):n.call(null,r)}(e,r,i):st(r).apply(null,i)}function ot(e,t){var r,i,n,s=(e=ue(e)).includes("j")?(r=e,i=t,n=[],function(){return n.length=0,Object.assign(n,arguments),at(r,i,n)}):st(t);return"function"!=typeof s&&ve("unknown function pointer with signature "+e+": "+t),s}var dt=void 0;function lt(e){var t=Gt(e),r=ue(t);return Ot(t),r}function ct(e,t){var r=[],i={};throw t.forEach((function e(t){i[t]||fe[t]||(pe[t]?pe[t].forEach(e):(r.push(t),i[t]=!0))})),new dt(e+": "+r.map(lt).join([", "]))}function ut(e,t){for(var r=[],i=0;i>2]);return r}function ht(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function ft(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var r=_e(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function pt(e,t,r,i,n){var s=t.length;s<2&&ve("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==r,o=!1,d=1;d0?", ":"")+u),h+=(l?"var rv = ":"")+"invoker(fn"+(u.length>0?", ":"")+u+");\n",o)h+="runDestructors(destructors);\n";else for(d=a?1:2;d4&&0==--_t[e].refcount&&(_t[e]=void 0,mt.push(e))}function yt(){for(var e=0,t=5;t<_t.length;++t)void 0!==_t[t]&&++e;return e}function vt(){for(var e=5;e<_t.length;++e)if(void 0!==_t[e])return _t[e];return null}var bt={toValue:e=>(e||ve("Cannot use deleted val. handle = "+e),_t[e].value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var t=mt.length?mt.pop():_t.length;return _t[t]={refcount:1,value:e},t}}};function wt(e){if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e}function St(e,t){switch(t){case 2:return function(e){return this.fromWireType(k[e>>2])};case 3:return function(e){return this.fromWireType(C[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Et(e,t,r){switch(t){case 0:return r?function(e){return E[e]}:function(e){return A[e]};case 1:return r?function(e){return B[e>>1]}:function(e){return x[e>>1]};case 2:return r?function(e){return U[e>>2]}:function(e){return T[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}var At="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function Bt(e,t){for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&x[i];)++i;if((r=i<<1)-e>32&&At)return At.decode(A.subarray(e,r));for(var s="",a=0;!(a>=t/2);++a){var o=B[e+2*a>>1];if(0==o)break;s+=String.fromCharCode(o)}return s}function xt(e,t,r){if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,s=0;s>1]=a,t+=2}return B[t>>1]=0,t-i}function Ut(e){return 2*e.length}function Tt(e,t){for(var r=0,i="";!(r>=t/4);){var n=U[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var s=n-65536;i+=String.fromCharCode(55296|s>>10,56320|1023&s)}else i+=String.fromCharCode(n)}return i}function kt(e,t,r){if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,s=0;s=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s);if(U[t>>2]=a,(t+=4)+4>n)break}return U[t>>2]=0,t-i}function Ct(e){for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t}var Dt={};var Pt=[];var It=[];var Ft={};function Lt(){if(!Lt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:u||"./this.program"};for(var t in Ft)void 0===Ft[t]?delete e[t]:e[t]=Ft[t];var r=[];for(var t in e)r.push(t+"="+e[t]);Lt.strings=r}return Lt.strings}var Rt=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=oe.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},Mt=365,zt=146;Object.defineProperties(Rt.prototype,{read:{get:function(){return(this.mode&Mt)===Mt},set:function(e){e?this.mode|=Mt:this.mode&=-366}},write:{get:function(){return(this.mode&zt)===zt},set:function(e){e?this.mode|=zt:this.mode&=-147}},isFolder:{get:function(){return oe.isDir(this.mode)}},isDevice:{get:function(){return oe.isChrdev(this.mode)}}}),oe.FSNode=Rt,oe.staticInit(),function(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);ce=e}(),ye=t.BindingError=ge(Error,"BindingError"),be=t.InternalError=ge(Error,"InternalError"),je.prototype.isAliasOf=Ae,je.prototype.clone=Ge,je.prototype.delete=He,je.prototype.isDeleted=Ve,je.prototype.deleteLater=We,t.getInheritedInstanceCount=De,t.getLiveInheritedInstances=Pe,t.flushPendingDeletes=Fe,t.setDelayFunction=Re,it.prototype.getPointee=et,it.prototype.destructor=tt,it.prototype.argPackAdvance=8,it.prototype.readValueFromPointer=Qe,it.prototype.deleteObject=rt,it.prototype.fromWireType=Oe,dt=t.UnboundTypeError=ge(Error,"UnboundTypeError"),t.count_emval_handles=yt,t.get_first_emval=vt;var Nt={q:function(e){return Vt(e+24)+24},p:function(e,t,r){throw new ee(e).init(t,r),e},C:function(e,t,r){de.varargs=r;try{var i=de.getStreamFromFD(e);switch(t){case 0:return(n=de.get())<0?-28:oe.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=de.get();return i.flags|=n,0;case 5:n=de.get();return B[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return s=28,U[$t()>>2]=s,-1}}catch(e){if(void 0===oe||!(e instanceof oe.ErrnoError))throw e;return-e.errno}var s},w:function(e,t,r,i){de.varargs=i;try{t=de.getStr(t),t=de.calculateAt(e,t);var n=i?de.get():0;return oe.open(t,r,n).fd}catch(e){if(void 0===oe||!(e instanceof oe.ErrnoError))throw e;return-e.errno}},u:function(e,t,r,i,n){},E:function(e,t,r,i,n){var s=le(r);Ee(e,{name:t=ue(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?i:n},argPackAdvance:8,readValueFromPointer:function(e){var i;if(1===r)i=E;else if(2===r)i=B;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+t);i=U}return this.fromWireType(i[e>>s])},destructorFunction:null})},t:function(e,r,i,n,s,a,o,d,l,c,u,h,f){u=ue(u),a=ot(s,a),d&&(d=ot(o,d)),c&&(c=ot(l,c)),f=ot(h,f);var p=me(u);!function(e,r,i){t.hasOwnProperty(e)?((void 0===i||void 0!==t[e].overloadTable&&void 0!==t[e].overloadTable[i])&&ve("Cannot register public name '"+e+"' twice"),qe(t,e,e),t.hasOwnProperty(i)&&ve("Cannot register multiple overloads of a function with the same number of arguments ("+i+")!"),t[e].overloadTable[i]=r):(t[e]=r,void 0!==i&&(t[e].numArguments=i))}(p,(function(){ct("Cannot construct "+u+" due to unbound types",[n])})),Se([e,r,i],n?[n]:[],(function(r){var i,s;r=r[0],s=n?(i=r.registeredClass).instancePrototype:je.prototype;var o=_e(p,(function(){if(Object.getPrototypeOf(this)!==l)throw new ye("Use 'new' to construct "+u);if(void 0===h.constructor_body)throw new ye(u+" has no accessible constructor");var e=h.constructor_body[arguments.length];if(void 0===e)throw new ye("Tried to invoke ctor of "+u+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(h.constructor_body).toString()+") parameters instead!");return e.apply(this,arguments)})),l=Object.create(s,{constructor:{value:o}});o.prototype=l;var h=new Ye(u,o,l,f,i,a,d,c),m=new it(u,h,!0,!1,!1),_=new it(u+"*",h,!1,!1,!1),g=new it(u+" const*",h,!1,!0,!1);return Ce[e]={pointerType:_,constPointerType:g},function(e,r,i){t.hasOwnProperty(e)||we("Replacing nonexistant public symbol"),void 0!==t[e].overloadTable&&void 0!==i?t[e].overloadTable[i]=r:(t[e]=r,t[e].argCount=i)}(p,o),[m,_,g]}))},r:function(e,t,r,i,n,s){w(t>0);var a=ut(t,r);n=ot(i,n),Se([],[e],(function(e){var r="constructor "+(e=e[0]).name;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new ye("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+e.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return e.registeredClass.constructor_body[t-1]=()=>{ct("Cannot construct "+e.name+" due to unbound types",a)},Se([],a,(function(i){return i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=pt(r,i,null,n,s),[]})),[]}))},d:function(e,t,r,i,n,s,a,o){var d=ut(r,i);t=ue(t),s=ot(n,s),Se([],[e],(function(e){var i=(e=e[0]).name+"."+t;function n(){ct("Cannot call "+i+" due to unbound types",d)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),o&&e.registeredClass.pureVirtualFunctions.push(t);var l=e.registeredClass.instancePrototype,c=l[t];return void 0===c||void 0===c.overloadTable&&c.className!==e.name&&c.argCount===r-2?(n.argCount=r-2,n.className=e.name,l[t]=n):(qe(l,t,i),l[t].overloadTable[r-2]=n),Se([],d,(function(n){var o=pt(i,n,e,s,a);return void 0===l[t].overloadTable?(o.argCount=r-2,l[t]=o):l[t].overloadTable[r-2]=o,[]})),[]}))},D:function(e,t){Ee(e,{name:t=ue(t),fromWireType:function(e){var t=bt.toValue(e);return gt(e),t},toWireType:function(e,t){return bt.toHandle(t)},argPackAdvance:8,readValueFromPointer:Qe,destructorFunction:null})},n:function(e,t,r){var i=le(r);Ee(e,{name:t=ue(t),fromWireType:function(e){return e},toWireType:function(e,t){return t},argPackAdvance:8,readValueFromPointer:St(t,i),destructorFunction:null})},c:function(e,t,r,i,n){t=ue(t);var s=le(r),a=e=>e;if(0===i){var o=32-8*r;a=e=>e<>>o}var d=t.includes("unsigned");Ee(e,{name:t,fromWireType:a,toWireType:d?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:8,readValueFromPointer:Et(t,s,0!==i),destructorFunction:null})},b:function(e,t,r){var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=T,r=t[e>>=2],n=t[e+1];return new i(S,n,r)}Ee(e,{name:r=ue(r),fromWireType:n,argPackAdvance:8,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},m:function(e,t){var r="std::string"===(t=ue(t));Ee(e,{name:t,fromWireType:function(e){var t,i=T[e>>2],n=e+4;if(r)for(var s=n,a=0;a<=i;++a){var o=n+a;if(a==i||0==A[o]){var d=F(s,o-s);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),s=o+1}}else{var l=new Array(i);for(a=0;a>2]=i,r&&n)L(t,A,a,i+1);else if(n)for(var o=0;o255&&(Ot(a),ve("String has UTF-16 code units that do not fit in 8 bits")),A[a+o]=d}else for(o=0;ox,o=1):4===t&&(i=Tt,n=kt,a=Ct,s=()=>T,o=2),Ee(e,{name:r,fromWireType:function(e){for(var r,n=T[e>>2],a=s(),d=e+4,l=0;l<=n;++l){var c=e+4+l*t;if(l==n||0==a[c>>o]){var u=i(d,c-d);void 0===r?r=u:(r+=String.fromCharCode(0),r+=u),d=c+t}}return Ot(e),r},toWireType:function(e,i){"string"!=typeof i&&ve("Cannot pass non-string to C++ string type "+r);var s=a(i),d=Vt(4+s+t);return T[d>>2]=s>>o,n(i,d+4,s+t),null!==e&&e.push(Ot,d),d},argPackAdvance:8,readValueFromPointer:Qe,destructorFunction:function(e){Ot(e)}})},o:function(e,t){Ee(e,{isVoid:!0,name:t=ue(t),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})},f:function(){return Date.now()},g:function(e,t,r,i){var n,s;(e=Pt[e])(t=bt.toValue(t),r=void 0===(s=Dt[n=r])?ue(n):s,null,i)},j:gt,i:function(e,t){var r=function(e,t){for(var r,i,n,s=new Array(e),a=0;a>2],i="parameter "+a,n=void 0,void 0===(n=fe[r])&&ve(i+" has unknown type "+lt(r)),n);return s}(e,t),i=r[0],n=i.name+"_$"+r.slice(1).map((function(e){return e.name})).join("_")+"$",s=It[n];if(void 0!==s)return s;for(var a=["retType"],o=[i],d="",l=0;l>2]=s,function(e,t,r){for(var i=0;i>0]=e.charCodeAt(i);r||(E[t>>0]=0)}(i,s),r+=i.length+1})),0},z:function(e,t){var r=Lt();T[e>>2]=r.length;var i=0;return r.forEach((function(e){i+=e.length+1})),T[t>>2]=i,0},l:function(e){try{var t=de.getStreamFromFD(e);return oe.close(t),0}catch(e){if(void 0===oe||!(e instanceof oe.ErrnoError))throw e;return e.errno}},x:function(e,t){try{var r=de.getStreamFromFD(e),i=r.tty?2:oe.isDir(r.mode)?3:oe.isLink(r.mode)?7:4;return E[t>>0]=i,0}catch(e){if(void 0===oe||!(e instanceof oe.ErrnoError))throw e;return e.errno}},B:function(e,t,r,i){try{var n=function(e,t,r,i){for(var n=0,s=0;s>2],o=T[t+4>>2];t+=8;var d=oe.read(e,E,a,o,i);if(d<0)return-1;if(n+=d,d>2]=n,0}catch(e){if(void 0===oe||!(e instanceof oe.ErrnoError))throw e;return e.errno}},s:function(e,t,r,i,n){try{var s=(d=r)+2097152>>>0<4194305-!!(o=t)?(o>>>0)+4294967296*d:NaN;if(isNaN(s))return 61;var a=de.getStreamFromFD(e);return oe.llseek(a,s,i),Y=[a.position>>>0,(q=a.position,+Math.abs(q)>=1?q>0?(0|Math.min(+Math.floor(q/4294967296),4294967295))>>>0:~~+Math.ceil((q-+(~~q>>>0))/4294967296)>>>0:0)],U[n>>2]=Y[0],U[n+4>>2]=Y[1],a.getdents&&0===s&&0===i&&(a.getdents=null),0}catch(e){if(void 0===oe||!(e instanceof oe.ErrnoError))throw e;return e.errno}var o,d},k:function(e,t,r,i){try{var n=function(e,t,r,i){for(var n=0,s=0;s>2],o=T[t+4>>2];t+=8;var d=oe.write(e,E,a,o,i);if(d<0)return-1;n+=d}return n}(de.getStreamFromFD(e),t,r);return T[i>>2]=n,0}catch(e){if(void 0===oe||!(e instanceof oe.ErrnoError))throw e;return e.errno}},e:function(e){}};!function(){var e={a:Nt};function r(e,r){var i,n,s=e.exports;t.asm=s,v=t.asm.F,i=v.buffer,S=i,t.HEAP8=E=new Int8Array(i),t.HEAP16=B=new Int16Array(i),t.HEAP32=U=new Int32Array(i),t.HEAPU8=A=new Uint8Array(i),t.HEAPU16=x=new Uint16Array(i),t.HEAPU32=T=new Uint32Array(i),t.HEAPF32=k=new Float32Array(i),t.HEAPF64=C=new Float64Array(i),D=t.asm.I,n=t.asm.G,z.unshift(n),H()}function n(e){r(e.instance)}function a(t){return function(){if(!y&&(h||f)){if("function"==typeof fetch&&!X(W))return fetch(W,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+W+"'";return e.arrayBuffer()})).catch((function(){return Z(W)}));if(s)return new Promise((function(e,t){s(W,(function(t){e(new Uint8Array(t))}),t)}))}return Promise.resolve().then((function(){return Z(W)}))}().then((function(t){return WebAssembly.instantiate(t,e)})).then((function(e){return e})).then(t,(function(e){g("failed to asynchronously prepare wasm: "+e),V(e)}))}if(G(),t.instantiateWasm)try{return t.instantiateWasm(e,r)}catch(e){return g("Module.instantiateWasm callback failed with error: "+e),!1}(y||"function"!=typeof WebAssembly.instantiateStreaming||K(W)||X(W)||p||"function"!=typeof fetch?a(n):fetch(W,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,e).then(n,(function(e){return g("wasm streaming compile failed: "+e),g("falling back to ArrayBuffer instantiation"),a(n)}))}))).catch(i)}(),t.___wasm_call_ctors=function(){return(t.___wasm_call_ctors=t.asm.G).apply(null,arguments)};var Ot=t._free=function(){return(Ot=t._free=t.asm.H).apply(null,arguments)},$t=t.___errno_location=function(){return($t=t.___errno_location=t.asm.J).apply(null,arguments)},Gt=t.___getTypeName=function(){return(Gt=t.___getTypeName=t.asm.K).apply(null,arguments)};t.___embind_register_native_and_builtin_types=function(){return(t.___embind_register_native_and_builtin_types=t.asm.L).apply(null,arguments)};var Ht,Vt=t._malloc=function(){return(Vt=t._malloc=t.asm.M).apply(null,arguments)},Wt=t._emscripten_builtin_memalign=function(){return(Wt=t._emscripten_builtin_memalign=t.asm.N).apply(null,arguments)},jt=t.___cxa_is_pointer_type=function(){return(jt=t.___cxa_is_pointer_type=t.asm.O).apply(null,arguments)};function qt(e){function i(){Ht||(Ht=!0,t.calledRun=!0,b||(t.noFSInit||oe.init.initialized||oe.init(),oe.ignorePermissions=!1,Q(z),r(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),function(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)e=t.postRun.shift(),N.unshift(e);var e;Q(N)}()))}O>0||(!function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)e=t.preRun.shift(),M.unshift(e);var e;Q(M)}(),O>0||(t.setStatus?(t.setStatus("Running..."),setTimeout((function(){setTimeout((function(){t.setStatus("")}),1),i()}),1)):i()))}if(t.dynCall_viiijj=function(){return(t.dynCall_viiijj=t.asm.P).apply(null,arguments)},t.dynCall_jij=function(){return(t.dynCall_jij=t.asm.Q).apply(null,arguments)},t.dynCall_jii=function(){return(t.dynCall_jii=t.asm.R).apply(null,arguments)},t.dynCall_jiji=function(){return(t.dynCall_jiji=t.asm.S).apply(null,arguments)},$=function e(){Ht||qt(),Ht||($=e)},t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return qt(),t.ready}})(),o=1e-6,d="undefined"!=typeof Float32Array?Float32Array:Array;function l(){var e=new d(16);return d!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function c(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var u,h=function(e,t,r,i,n,s,a){var o=1/(t-r),d=1/(i-n),l=1/(s-a);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*o,e[13]=(n+i)*d,e[14]=(a+s)*l,e[15]=1,e};function f(e,t,r){var i=new d(3);return i[0]=e,i[1]=t,i[2]=r,i}u=new d(3),d!=Float32Array&&(u[0]=0,u[1]=0,u[2]=0);var p=(e,t)=>{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const r=function(){const t=m(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=m(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(i)),null;return i}();let i={program:r,attribLocations:{vertexPosition:e.getAttribLocation(r,"aVertexPosition"),texturePosition:e.getAttribLocation(r,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(r,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(r,"uModelMatrix"),viewMatrix:e.getUniformLocation(r,"uViewMatrix"),rgbatexture:e.getUniformLocation(r,"rgbaTexture"),ytexture:e.getUniformLocation(r,"yTexture"),utexture:e.getUniformLocation(r,"uTexture"),vtexture:e.getUniformLocation(r,"vTexture"),isyuv:e.getUniformLocation(r,"isyuv")}},n=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var r=[];r=r.concat([0,1],[1,1],[1,0],[0,0]);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);const n=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:i,indices:n}}(),s=p(),a=p(),d=p(),u=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function m(t,r){const i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(i)),e.deleteShader(i),null)}function _(t,r){e.viewport(0,0,t,r),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const s=l();h(s,-1,1,-1,1,.1,100);const p=l();c(p);const m=l();!function(e,t,r,i){var n,s,a,d,l,u,h,f,p,m,_=t[0],g=t[1],y=t[2],v=i[0],b=i[1],w=i[2],S=r[0],E=r[1],A=r[2];Math.abs(_-S)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let r=e-this._current_word_bits_left;this._fillCurrentWord();let i=Math.min(r,this._current_word_bits_left),n=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const Gt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Ht=Gt,Vt=Gt;function Wt(e){let{profile:t,sampleRate:r,channel:i}=e;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function jt(e){return qt(e)&&e[1]===xt}function qt(e){return e[0]>>4===ze}const Yt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Kt(e){let t=new Uint8Array(e),r=null,i=0,n=0,s=0,a=null;if(i=n=t[0]>>>3,s=(7&t[0])<<1|t[1]>>>7,s<0||s>=Yt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let o=Yt[s],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===i&&(a=(7&t[1])<<1|t[2]>>>7,t[2]);let l=self.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?s>=6?(i=5,r=new Array(4),a=s-3):(i=2,r=new Array(2),a=s):-1!==l.indexOf("android")?(i=2,r=new Array(2),a=s):(i=5,a=s,r=new Array(4),s>=6?a=s-3:1===d&&(i=2,r=new Array(2),a=s)),r[0]=i<<3,r[0]|=(15&s)>>>1,r[1]=(15&s)<<7,r[1]|=(15&d)<<3,5===i&&(r[1]|=(15&a)>>>1,r[2]=(1&a)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:o,channelCount:d,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+n}}class Xt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+7>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,n=(6&e[r+1])>>>1,s=1&e[r+1],a=(192&e[r+2])>>>6,o=(60&e[r+2])>>>2,d=(1&e[r+2])<<2|(192&e[r+3])>>>6,l=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let c=1===s?7:9,u=l-c;r+=c;let h=this.findNextSyncwordOffset(r+u);if(this.current_syncword_offset_=h,0!==i&&1!==i||0!==n)continue;let f=e.subarray(r,r+u);t={},t.audio_object_type=a+1,t.sampling_freq_index=o,t.sampling_frequency=Ht[o],t.channel_config=d,t.data=f}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Zt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),r=0;for(let i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}readNextAACFrame(e){let t=this.data_,r=null;for(;null==r&&!this.eof_flag_;){let i=this.current_syncword_offset_,n=(31&t[i+1])<<8|t[i+2];if(i+3+n>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let s=new $t(t.subarray(i+3,i+3+n)),a=null;if(s.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+n),s.destroy();continue}a=e}else{let e=s.readBool();if(e&&s.readBool()){console.error("audioMuxVersionA is Not Supported"),s.destroy();break}if(e&&this.getLATMValue(s),!s.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),s.destroy();break}if(0!==s.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),s.destroy();break}if(0!==s.readBits(4)){console.error("more than 2 numProgram Not Supported"),s.destroy();break}if(0!==s.readBits(3)){console.error("more than 2 numLayer Not Supported"),s.destroy();break}let t=e?this.getLATMValue(s):0,r=s.readBits(5);t-=5;let i=s.readBits(4);t-=4;let n=s.readBits(4);t-=4,s.readBits(3),t-=3,t>0&&s.readBits(t);let o=s.readBits(3);if(0!==o){console.error(`frameLengthType = ${o}. Only frameLengthType = 0 Supported`),s.destroy();break}s.readByte();let d=s.readBool();if(d)if(e)this.getLATMValue(s);else{let e=0;for(;;){e<<=8;let t=s.readBool();if(e+=s.readByte(),!t)break}console.log(e)}s.readBool()&&s.readByte(),a={},a.audio_object_type=r,a.sampling_freq_index=i,a.sampling_frequency=Ht[a.sampling_freq_index],a.channel_config=n,a.other_data_present=d}let o=0;for(;;){let e=s.readByte();if(o+=e,255!==e)break}let d=new Uint8Array(o);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function Qt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return;const r=e.length,i=[];let n,s=0;for(;s+t>>=8),s+=t,n){if(s+n>r)break;i.push(e.subarray(s,s+n)),s+=n}return i}function er(e){const t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;const i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function tr(e,t){let r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}function rr(){return(new Date).getTime()}function ir(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function nr(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function sr(e){let t=0,r=nr();return i=>{if(n=i,"[object Number]"!==Object.prototype.toString.call(n))return;var n;t+=i;const s=nr(),a=s-r;a>=1e3&&(e(t/a*1e3),r=s,t=0)}}function ar(){const e=window.navigator.userAgent.toLowerCase();return/firefox/i.test(e)}function or(){let e=!1;return"MediaSource"in self&&(self.MediaSource.isTypeSupported(ht)||self.MediaSource.isTypeSupported(ft)||self.MediaSource.isTypeSupported(pt)||self.MediaSource.isTypeSupported(mt)||self.MediaSource.isTypeSupported(_t))&&(e=!0),e}function dr(e){return null==e}function lr(e){return!dr(e)}function cr(e){return"function"==typeof e}function ur(e){let t=null,r=31&e[0];return r!==Ge&&r!==He||(t=Re),t||(r=(126&e[0])>>1,r!==et&&r!==rt&&r!==nt||(t=Me)),t}function hr(){return"undefined"!=typeof WritableStream}function fr(e){e.close()}function pr(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let r=e[0],i=null,n=1;if(e.length>0){let t=e[1];t&&t.ts-r.ts>1e5&&(r=t,n=2)}if(r)for(let s=n;s=1e3){e[s-1].ts-r.ts<1e3&&(i=s+1)}}}return i}function mr(e){return e.ok&&e.status>=200&&e.status<=299}function _r(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(r){t=e}else t=e;return t}(U)}function gr(e){return e[0]>>4===Ut&&e[1]===xt}function yr(e){return!0===e||"true"===e}function vr(e){return!0!==e&&"true"!==e}function br(){return!!(self.Worker&&self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker)}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();var wr=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function a(e){try{d(i.next(e))}catch(e){s(e)}}function o(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}d((i=i.apply(e,t||[])).next())}))};const Sr=Symbol(32),Er=Symbol(16),Ar=Symbol(8);class Br{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return wr(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,r)=>{var i;this.reject=r,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(i=this.pull)||void 0===i||i.call(this,e)}))}))}readU32(){return this.read(Sr)}readU16(){return this.read(Er)}readU8(){return this.read(Ar)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let r=0;const i=e=>t.length<(r=e);if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===Sr){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Er){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===Ar){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{const e=new Uint8Array(r);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}Br.U32=Sr,Br.U16=Er,Br.U8=Ar;class xr{constructor(e){this.log=function(t){if(e._opt.debug&&e._opt.debugLevel==S){const s=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n1?r-1:0),n=1;n1?i-1:0),s=1;s=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseSPS(e){let t=Ur._ebsp2rbsp(e),r=new $t(t);r.readByte();let i=r.readByte();r.readByte();let n=r.readByte();r.readUEG();let s=Ur.getProfileString(i),a=Ur.getLevelString(n),o=1,d=420,l=[0,420,422,444],c=8;if((100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i)&&(o=r.readUEG(),3===o&&r.readBits(1),o<=3&&(d=l[o]),c=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool())){let e=3!==o?8:12;for(let t=0;t0&&e<16?(b=t[e-1],w=i[e-1]):255===e&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);E=r.readBool(),A=t,B=2*e,S=A/B}}let x=1;1===b&&1===w||(x=b/w);let U=0,T=0;if(0===o)U=1,T=2-m;else{U=3===o?1:2,T=(1===o?2:1)*(2-m)}let k=16*(f+1),C=16*(p+1)*(2-m);k-=(_+g)*U,C-=(y+v)*T;let D=Math.ceil(k*x);return r.destroy(),r=null,{profile_string:s,level_string:a,bit_depth:c,ref_frames:h,chroma_format:d,chroma_format_string:Ur.getChromaFormatString(d),frame_rate:{fixed:E,fps:S,fps_den:B,fps_num:A},sar_ratio:{width:b,height:w},codec_size:{width:k,height:C},present_size:{width:D,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),r="avc1.";for(let e=0;e<3;e++){let i=t[e].toString(16);i.length<2&&(i="0"+i),r+=i}let i=Ur._ebsp2rbsp(e),n=new $t(i);n.readByte();let s=n.readByte();n.readByte();let a=n.readByte();n.readUEG();let o=Ur.getProfileString(s),d=Ur.getLevelString(a),l=1,c=420,u=[0,420,422,444],h=8,f=8;if((100===s||110===s||122===s||244===s||44===s||83===s||86===s||118===s||128===s||138===s||144===s)&&(l=n.readUEG(),3===l&&n.readBits(1),l<=3&&(c=u[l]),h=n.readUEG()+8,f=n.readUEG()+8,n.readBits(1),n.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(E=t[e-1],A=r[e-1]):255===e&&(E=n.readByte()<<8|n.readByte(),A=n.readByte()<<8|n.readByte())}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(4),n.readBool()&&n.readBits(24)),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool()){let e=n.readBits(32),t=n.readBits(32);x=n.readBool(),U=t,T=2*e,B=U/T}}let k=1;1===E&&1===A||(k=E/A);let C=0,D=0;if(0===l)C=1,D=2-y;else{C=3===l?1:2,D=(1===l?2:1)*(2-y)}let P=16*(_+1),I=16*(g+1)*(2-y);P-=(v+b)*C,I-=(w+S)*D;let F=Math.ceil(P*k);return n.destroy(),n=null,{codec_mimetype:r,profile_idc:s,level_idc:a,profile_string:o,level_string:d,chroma_format_idc:l,bit_depth:h,bit_depth_luma:h,bit_depth_chroma:f,ref_frames:m,chroma_format:c,chroma_format_string:Ur.getChromaFormatString(c),frame_rate:{fixed:x,fps:B,fps_den:T,fps_num:U},sar_ratio:{width:E,height:A},codec_size:{width:P,height:I},present_size:{width:F,height:I}}}static _skipScalingList(e,t){let r=8,i=8,n=0;for(let s=0;s=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.sps,4),t.sps=i}if(t.pps){const e=t.pps.byteLength,r=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.pps,4),t.pps=i}return t}function Cr(e){let{sps:t,pps:r}=e;const i=[23,0,0,0,0,1,66,0,30,255];i[0]=23,i[6]=t[1],i[7]=t[2],i[8]=t[3],i[10]=225,i[11]=t.byteLength>>8&255,i[12]=255&t.byteLength,i.push(...t,1,r.byteLength>>8&255,255&r.byteLength,...r);return new Uint8Array(i)}function Dr(e){let{sps:t,pps:r}=e,i=8+t.byteLength+1+2+r.byteLength,n=!1;const s=Ur.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(n=!0,i+=4);let a=new Uint8Array(i);a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225;let o=t.byteLength;a[6]=o>>>8,a[7]=255&o;let d=8;a.set(t,8),d+=o,a[d]=1;let l=r.byteLength;a[d+1]=l>>>8,a[d+2]=255&l,a.set(r,d+3),d+=3+l,n&&(a[d]=252|s.chroma_format_idc,a[d+1]=248|s.bit_depth_luma-8,a[d+2]=248|s.bit_depth_chroma-8,a[d+3]=0,d+=4);const c=[23,0,0,0,0],u=new Uint8Array(c.length+a.byteLength);return u.set(c,0),u.set(a,c.length),u}function Pr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Ir(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Fr(e){return 31&e[0]}function Lr(e){return e===qe}function Rr(e){return!function(e){return e===Ge||e===He}(e)&&!Lr(e)}function Mr(e){return e===Ve}function zr(e){if(0===e.length)return!1;const t=Fr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=31&e[r],n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,i>=Xe||0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class Or{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const $r=e=>{let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)},Gr=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Hr{static _ebsp2rbsp(e){let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseVPS(e){let t=Hr._ebsp2rbsp(e),r=new $t(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}}static parseSPS(e){let t=Hr._ebsp2rbsp(e),r=new $t(t);r.readByte(),r.readByte();let i=0,n=0,s=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<=16?(F=t[e-1],L=i[e-1]):255===e&&(F=r.readBits(16),L=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()){r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())}if(r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()){if(M=r.readBits(32),z=r.readBits(32),r.readBool()&&r.readUEG(),r.readBool()){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=o;n++){let n=r.readBool();R=n;let s=!0,a=1;n||(s=r.readBool());let o=!1;if(s?r.readUEG():o=r.readBool(),o||(a=r.readUEG()+1),e){for(let e=0;e>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];let i=e[22],n=e.slice(23);for(let e=0;e0)for(let t=r;t<8;t++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(let t=0;t{let t=$r(e),r=new $t(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}})(t),a=(e=>{let t=$r(e),r=new $t(t);r.readByte(),r.readByte();let i=0,n=0,s=0,a=0;r.readBits(4);let o=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),c=r.readBits(5),u=r.readByte(),h=r.readByte(),f=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=o;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<16?(F=t[e-1],L=i[e-1]):255===e&&(F=r.readBits(16),L=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(i+=r.readUEG(),n+=r.readUEG(),s+=r.readUEG(),a+=r.readUEG()),r.readBool()&&(M=r.readBits(32),z=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=o;n++){let n=r.readBool();R=n;let s=!1,a=1;n||(s=r.readBool());let o=!1;if(s?r.readSEG():o=r.readBool(),o||(cpbcnt=r.readUEG()+1),e)for(let e=0;e{let t=$r(e),r=new $t(t);r.readByte(),r.readByte(),r.readUEG(),r.readUEG(),r.readBool(),r.readBool(),r.readBits(3),r.readBool(),r.readBool(),r.readUEG(),r.readUEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool()&&r.readUEG(),r.readSEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool(),r.readBool();let i=r.readBool(),n=r.readBool(),s=1;return n&&i?s=0:n?s=3:i&&(s=2),{parallelismType:s}})(r);n=Object.assign(n,s,a,o);let d=23+(5+t.byteLength)+(5+i.byteLength)+(5+r.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,l[2]=n.general_profile_compatibility_flags_1||0,l[3]=n.general_profile_compatibility_flags_2||0,l[4]=n.general_profile_compatibility_flags_3||0,l[5]=n.general_profile_compatibility_flags_4||0,l[6]=n.general_constraint_indicator_flags_1||0,l[7]=n.general_constraint_indicator_flags_2||0,l[8]=n.general_constraint_indicator_flags_3||0,l[9]=n.general_constraint_indicator_flags_4||0,l[10]=n.general_constraint_indicator_flags_5||0,l[11]=n.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,l[14]=255&n.min_spatial_segmentation_idc,l[15]=252|3&n.parallelismType,l[16]=252|3&n.chroma_format_idc,l[17]=248|7&n.bit_depth_luma_minus8,l[18]=248|7&n.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|et,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|rt,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+i.byteLength)+0]=128|nt,l[23+(5+t.byteLength+5+i.byteLength)+1]=0,l[23+(5+t.byteLength+5+i.byteLength)+2]=1,l[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength+5+i.byteLength)+5);const c=[28,0,0,0,0],u=new Uint8Array(c.length+l.byteLength);return u.set(c,0),u.set(l,c.length),u}function Yr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Kr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Xr(e){return(126&e[0])>>1}function Zr(e){return e===at}function Jr(e){return!function(e){return e>=32&&e<=40}(e)}function Qr(e){return e>=16&&e<=21}function ei(e){if(0===e.length)return!1;const t=Xr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=e[r]>>1&63,n=(128&e[r])>>>7,s=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=s,0===n&&(t={type:i,data:e.subarray(r,s)})}return t}}class ri{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function ii(e){return parseInt(e)===e}function ni(e){if(!ii(e.length))return!1;for(var t=0;t255)return!1;return!0}function si(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!ni(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(ii(e.length)&&ni(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function ai(e){return new Uint8Array(e)}function oi(e,t,r,i,n){null==i&&null==n||(e=e.slice?e.slice(i,n):Array.prototype.slice.call(e,i,n)),t.set(e,r)}var di,li={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},ci=(di="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+di[15&i])}return t.join("")}}),ui={16:10,24:12,32:14},hi=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],fi=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],pi=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],mi=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],_i=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],gi=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],yi=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],vi=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],bi=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],wi=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Si=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ei=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ai=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Bi=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],xi=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Ui(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=s[t],this._Kd[e-r][t%4]=s[t];for(var a,o=0,d=n;d>16&255]<<24^fi[a>>8&255]<<16^fi[255&a]<<8^fi[a>>24&255]^hi[o]<<24,o+=1,8!=n)for(t=1;t>8&255]<<8^fi[a>>16&255]<<16^fi[a>>24&255]<<24;for(t=n/2+1;t>2,c=d%4,this._Ke[l][c]=s[t],this._Kd[e-l][c]=s[t++],d++}for(var l=1;l>24&255]^Ai[a>>16&255]^Bi[a>>8&255]^xi[255&a]},Ti.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=Ui(e),n=0;n<4;n++)i[n]^=this._Ke[0][n];for(var s=1;s>24&255]^_i[i[(n+1)%4]>>16&255]^gi[i[(n+2)%4]>>8&255]^yi[255&i[(n+3)%4]]^this._Ke[s][n];i=r.slice()}var a,o=ai(16);for(n=0;n<4;n++)a=this._Ke[t][n],o[4*n]=255&(fi[i[n]>>24&255]^a>>24),o[4*n+1]=255&(fi[i[(n+1)%4]>>16&255]^a>>16),o[4*n+2]=255&(fi[i[(n+2)%4]>>8&255]^a>>8),o[4*n+3]=255&(fi[255&i[(n+3)%4]]^a);return o},Ti.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=Ui(e),n=0;n<4;n++)i[n]^=this._Kd[0][n];for(var s=1;s>24&255]^bi[i[(n+3)%4]>>16&255]^wi[i[(n+2)%4]>>8&255]^Si[255&i[(n+1)%4]]^this._Kd[s][n];i=r.slice()}var a,o=ai(16);for(n=0;n<4;n++)a=this._Kd[t][n],o[4*n]=255&(pi[i[n]>>24&255]^a>>24),o[4*n+1]=255&(pi[i[(n+3)%4]>>16&255]^a>>16),o[4*n+2]=255&(pi[i[(n+2)%4]>>8&255]^a>>8),o[4*n+3]=255&(pi[255&i[(n+1)%4]]^a);return o};var ki=function(e){if(!(this instanceof ki))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new Ti(e)};ki.prototype.encrypt=function(e){if((e=si(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=ai(e.length),r=ai(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Ii.prototype.setBytes=function(e){if(16!=(e=si(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Ii.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Fi=function(e,t){if(!(this instanceof Fi))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Ii||(t=new Ii(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new Ti(e)};Fi.prototype.encrypt=function(e){for(var t=si(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-s%4*8&255;t[i+s>>>2]|=a<<24-(i+s)%4*8}else for(var o=0;o>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-n%4*8&255;i.push((s>>>4).toString(16)),i.push((15&s).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,s=i.sigBytes,a=this.blockSize,o=s/(4*a),d=(o=t?e.ceil(o):e.max((0|o)-this._minBufferSize,0))*a,c=e.min(4*d,s);if(d){for(var u=0;u>>2]|=e[n]<<24-n%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.WordArray,i=e.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=e.charCodeAt(n)<<16-n%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],s=0;s>>2]>>>16-s%4*8&65535);i.push(String.fromCharCode(a))}return i.join("")},parse:function(e){for(var r=e.length,i=[],s=0;s>>1]|=n(e.charCodeAt(s)<<16-s%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var n=[],s=0,a=0;a>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],s=0;s>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,o=0;o<4&&s+.75*o>>6*(3-o)&63));var d=i.charAt(64);if(d)for(;n.length%4;)n.push(d);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var s=0;s>>6-a%4*2;n[s>>>2]|=o<<24-s%4*8,s++}return t.create(n,s)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var s=[],a=0;a>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,d=0;d<4&&a+.75*d>>6*(3-d)&63));var l=n.charAt(64);if(l)for(;s.length%4;)s.push(l);return s.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,n=t?this._safe_map:this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var a=0;a>>24)|4278255360&(n<<24|n>>>8)}var s=this._hash.words,a=e[t+0],d=e[t+1],f=e[t+2],p=e[t+3],m=e[t+4],_=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],B=e[t+14],x=e[t+15],U=s[0],T=s[1],k=s[2],C=s[3];U=l(U,T,k,C,a,7,o[0]),C=l(C,U,T,k,d,12,o[1]),k=l(k,C,U,T,f,17,o[2]),T=l(T,k,C,U,p,22,o[3]),U=l(U,T,k,C,m,7,o[4]),C=l(C,U,T,k,_,12,o[5]),k=l(k,C,U,T,g,17,o[6]),T=l(T,k,C,U,y,22,o[7]),U=l(U,T,k,C,v,7,o[8]),C=l(C,U,T,k,b,12,o[9]),k=l(k,C,U,T,w,17,o[10]),T=l(T,k,C,U,S,22,o[11]),U=l(U,T,k,C,E,7,o[12]),C=l(C,U,T,k,A,12,o[13]),k=l(k,C,U,T,B,17,o[14]),U=c(U,T=l(T,k,C,U,x,22,o[15]),k,C,d,5,o[16]),C=c(C,U,T,k,g,9,o[17]),k=c(k,C,U,T,S,14,o[18]),T=c(T,k,C,U,a,20,o[19]),U=c(U,T,k,C,_,5,o[20]),C=c(C,U,T,k,w,9,o[21]),k=c(k,C,U,T,x,14,o[22]),T=c(T,k,C,U,m,20,o[23]),U=c(U,T,k,C,b,5,o[24]),C=c(C,U,T,k,B,9,o[25]),k=c(k,C,U,T,p,14,o[26]),T=c(T,k,C,U,v,20,o[27]),U=c(U,T,k,C,A,5,o[28]),C=c(C,U,T,k,f,9,o[29]),k=c(k,C,U,T,y,14,o[30]),U=u(U,T=c(T,k,C,U,E,20,o[31]),k,C,_,4,o[32]),C=u(C,U,T,k,v,11,o[33]),k=u(k,C,U,T,S,16,o[34]),T=u(T,k,C,U,B,23,o[35]),U=u(U,T,k,C,d,4,o[36]),C=u(C,U,T,k,m,11,o[37]),k=u(k,C,U,T,y,16,o[38]),T=u(T,k,C,U,w,23,o[39]),U=u(U,T,k,C,A,4,o[40]),C=u(C,U,T,k,a,11,o[41]),k=u(k,C,U,T,p,16,o[42]),T=u(T,k,C,U,g,23,o[43]),U=u(U,T,k,C,b,4,o[44]),C=u(C,U,T,k,E,11,o[45]),k=u(k,C,U,T,x,16,o[46]),U=h(U,T=u(T,k,C,U,f,23,o[47]),k,C,a,6,o[48]),C=h(C,U,T,k,y,10,o[49]),k=h(k,C,U,T,B,15,o[50]),T=h(T,k,C,U,_,21,o[51]),U=h(U,T,k,C,E,6,o[52]),C=h(C,U,T,k,p,10,o[53]),k=h(k,C,U,T,w,15,o[54]),T=h(T,k,C,U,d,21,o[55]),U=h(U,T,k,C,v,6,o[56]),C=h(C,U,T,k,x,10,o[57]),k=h(k,C,U,T,g,15,o[58]),T=h(T,k,C,U,A,21,o[59]),U=h(U,T,k,C,m,6,o[60]),C=h(C,U,T,k,S,10,o[61]),k=h(k,C,U,T,f,15,o[62]),T=h(T,k,C,U,b,21,o[63]),s[0]=s[0]+U|0,s[1]=s[1]+T|0,s[2]=s[2]+k|0,s[3]=s[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var s=e.floor(i/4294967296),a=i;r[15+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var o=this._hash,d=o.words,l=0;l<4;l++){var c=d[l];d[l]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return o},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,n,s,a){var o=e+(t&r|~t&i)+n+a;return(o<>>32-s)+t}function c(e,t,r,i,n,s,a){var o=e+(t&i|r&~i)+n+a;return(o<>>32-s)+t}function u(e,t,r,i,n,s,a){var o=e+(t^r^i)+n+a;return(o<>>32-s)+t}function h(e,t,r,i,n,s,a){var o=e+(r^(t|~i))+n+a;return(o<>>32-s)+t}t.MD5=s._createHelper(d),t.HmacMD5=s._createHmacHelper(d)}(Math),r.MD5)})),Ot((function(e,t){var r,i,n,s,a,o,d,l;e.exports=(i=(r=l=Ri).lib,n=i.WordArray,s=i.Hasher,a=r.algo,o=[],d=a.SHA1=s.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],d=r[4],l=0;l<80;l++){if(l<16)o[l]=0|e[t+l];else{var c=o[l-3]^o[l-8]^o[l-14]^o[l-16];o[l]=c<<1|c>>>31}var u=(i<<5|i>>>27)+d+o[l];u+=l<20?1518500249+(n&s|~n&a):l<40?1859775393+(n^s^a):l<60?(n&s|n&a|s&a)-1894007588:(n^s^a)-899497514,d=a,a=s,s=n<<30|n>>>2,n=i,i=u}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=s._createHelper(d),r.HmacSHA1=s._createHmacHelper(d),l.SHA1)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.algo,o=[],d=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(o[n]=r(e.pow(i,.5))),d[n]=r(e.pow(i,1/3)),n++),i++}();var l=[],c=a.SHA256=s.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=l[f-2],g=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;l[f]=m+l[f-7]+g+l[f-16]}var y=i&n^i&s^n&s,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&c^~o&u)+d[f]+l[f];h=u,u=c,c=o,o=a+b|0,a=s,s=n,n=i,i=b+(v+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0,r[5]=r[5]+c|0,r[6]=r[6]+u|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=s._createHelper(c),t.HmacSHA256=s._createHmacHelper(c)}(Math),r.SHA256)})),Ot((function(e,t){var r,i,n,s,a,o;e.exports=(i=(r=o=Ri).lib.WordArray,n=r.algo,s=n.SHA256,a=n.SHA224=s.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=s._createHelper(a),r.HmacSHA224=s._createHmacHelper(a),o.SHA224)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.Hasher,i=e.x64,n=i.Word,s=i.WordArray,a=e.algo;function o(){return n.create.apply(n,arguments)}var d=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=o()}();var c=a.SHA512=t.extend({_doReset:function(){this._hash=new s.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],s=r[2],a=r[3],o=r[4],c=r[5],u=r[6],h=r[7],f=i.high,p=i.low,m=n.high,_=n.low,g=s.high,y=s.low,v=a.high,b=a.low,w=o.high,S=o.low,E=c.high,A=c.low,B=u.high,x=u.low,U=h.high,T=h.low,k=f,C=p,D=m,P=_,I=g,F=y,L=v,R=b,M=w,z=S,N=E,O=A,$=B,G=x,H=U,V=T,W=0;W<80;W++){var j,q,Y=l[W];if(W<16)q=Y.high=0|e[t+2*W],j=Y.low=0|e[t+2*W+1];else{var K=l[W-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[W-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),se=l[W-7],ae=se.high,oe=se.low,de=l[W-16],le=de.high,ce=de.low;q=(q=(q=J+ae+((j=Q+oe)>>>0>>0?1:0))+ie+((j+=ne)>>>0>>0?1:0))+le+((j+=ce)>>>0>>0?1:0),Y.high=q,Y.low=j}var ue,he=M&N^~M&$,fe=z&O^~z&G,pe=k&D^k&I^D&I,me=C&P^C&F^P&F,_e=(k>>>28|C<<4)^(k<<30|C>>>2)^(k<<25|C>>>7),ge=(C>>>28|k<<4)^(C<<30|k>>>2)^(C<<25|k>>>7),ye=(M>>>14|z<<18)^(M>>>18|z<<14)^(M<<23|z>>>9),ve=(z>>>14|M<<18)^(z>>>18|M<<14)^(z<<23|M>>>9),be=d[W],we=be.high,Se=be.low,Ee=H+ye+((ue=V+ve)>>>0>>0?1:0),Ae=ge+me;H=$,V=G,$=N,G=O,N=M,O=z,M=L+(Ee=(Ee=(Ee=Ee+he+((ue+=fe)>>>0>>0?1:0))+we+((ue+=Se)>>>0>>0?1:0))+q+((ue+=j)>>>0>>0?1:0))+((z=R+ue|0)>>>0>>0?1:0)|0,L=I,R=F,I=D,F=P,D=k,P=C,k=Ee+(_e+pe+(Ae>>>0>>0?1:0))+((C=ue+Ae|0)>>>0>>0?1:0)|0}p=i.low=p+C,i.high=f+k+(p>>>0>>0?1:0),_=n.low=_+P,n.high=m+D+(_>>>0

>>0?1:0),y=s.low=y+F,s.high=g+I+(y>>>0>>0?1:0),b=a.low=b+R,a.high=v+L+(b>>>0>>0?1:0),S=o.low=S+z,o.high=w+M+(S>>>0>>0?1:0),A=c.low=A+O,c.high=E+N+(A>>>0>>0?1:0),x=u.low=x+G,u.high=B+$+(x>>>0>>0?1:0),T=h.low=T+V,h.high=U+H+(T>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(c),e.HmacSHA512=t._createHmacHelper(c)}(),r.SHA512)})),Ot((function(e,t){var r,i,n,s,a,o,d,l;e.exports=(i=(r=l=Ri).x64,n=i.Word,s=i.WordArray,a=r.algo,o=a.SHA512,d=a.SHA384=o.extend({_doReset:function(){this._hash=new s.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=o._createHelper(d),r.HmacSHA384=o._createHmacHelper(d),l.SHA384)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.x64.Word,o=t.algo,d=[],l=[],c=[];!function(){for(var e=1,t=0,r=0;r<24;r++){d[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,s=0;s<24;s++){for(var o=0,u=0,h=0;h<7;h++){if(1&n){var f=(1<>>24)|4278255360&(s<<24|s>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(T=r[n]).high^=a,T.low^=s}for(var o=0;o<24;o++){for(var h=0;h<5;h++){for(var f=0,p=0,m=0;m<5;m++)f^=(T=r[h+5*m]).high,p^=T.low;var _=u[h];_.high=f,_.low=p}for(h=0;h<5;h++){var g=u[(h+4)%5],y=u[(h+1)%5],v=y.high,b=y.low;for(f=g.high^(v<<1|b>>>31),p=g.low^(b<<1|v>>>31),m=0;m<5;m++)(T=r[h+5*m]).high^=f,T.low^=p}for(var w=1;w<25;w++){var S=(T=r[w]).high,E=T.low,A=d[w];A<32?(f=S<>>32-A,p=E<>>32-A):(f=E<>>64-A,p=S<>>64-A);var B=u[l[w]];B.high=f,B.low=p}var x=u[0],U=r[0];for(x.high=U.high,x.low=U.low,h=0;h<5;h++)for(m=0;m<5;m++){var T=r[w=h+5*m],k=u[w],C=u[(h+1)%5+5*m],D=u[(h+2)%5+5*m];T.high=k.high^~C.high&D.high,T.low=k.low^~C.low&D.low}T=r[0];var P=c[o];T.high^=P.high,T.low^=P.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,s=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/s)*s>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,d=o/8,l=[],c=0;c>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(h)}return new n.init(l,o)},clone:function(){for(var e=s.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=s._createHelper(h),t.HmacSHA3=s._createHmacHelper(h)}(Math),r.SHA3)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib,n=i.WordArray,s=i.Hasher,a=t.algo,o=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=n.create([0,1518500249,1859775393,2400959708,2840853838]),h=n.create([1352829926,1548603684,1836072691,2053994217,0]),f=a.RIPEMD160=s.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var s,a,f,b,w,S,E,A,B,x,U,T=this._hash.words,k=u.words,C=h.words,D=o.words,P=d.words,I=l.words,F=c.words;for(S=s=T[0],E=a=T[1],A=f=T[2],B=b=T[3],x=w=T[4],r=0;r<80;r+=1)U=s+e[t+D[r]]|0,U+=r<16?p(a,f,b)+k[0]:r<32?m(a,f,b)+k[1]:r<48?_(a,f,b)+k[2]:r<64?g(a,f,b)+k[3]:y(a,f,b)+k[4],U=(U=v(U|=0,I[r]))+w|0,s=w,w=b,b=v(f,10),f=a,a=U,U=S+e[t+P[r]]|0,U+=r<16?y(E,A,B)+C[0]:r<32?g(E,A,B)+C[1]:r<48?_(E,A,B)+C[2]:r<64?m(E,A,B)+C[3]:p(E,A,B)+C[4],U=(U=v(U|=0,F[r]))+x|0,S=x,x=B,B=v(A,10),A=E,E=U;U=T[1]+f+B|0,T[1]=T[2]+b+x|0,T[2]=T[3]+w+S|0,T[3]=T[4]+s+E|0,T[4]=T[0]+a+A|0,T[0]=U},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,s=n.words,a=0;a<5;a++){var o=s[a];s[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return n},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function _(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=s._createHelper(f),t.HmacRIPEMD160=s._createHmacHelper(f)}(),r.RIPEMD160)})),Ot((function(e,t){var r,i,n;e.exports=(i=(r=Ri).lib.Base,n=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),a=this._iKey=t.clone(),o=s.words,d=a.words,l=0;l>>2];e.sigBytes-=t}};i.BlockCipher=c.extend({cfg:c.cfg.extend({mode:f,padding:p}),reset:function(){var e;c.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(d)},parse:function(e){var t,r=d.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=s.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=n.extend({cfg:n.extend({format:_}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),s=n.finalize(t),a=n.cfg;return m.create({ciphertext:s,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=s.random(8)),n)a=l.create({keySize:t+r,hasher:n}).compute(e,i);else var a=l.create({keySize:t+r}).compute(e,i);var o=s.create(a.words.slice(t),4*r);return a.sigBytes=4*t,m.create({key:a,iv:o,salt:i})}},v=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var s=g.encrypt.call(this,e,t,n.key,i);return s.mixIn(n),s},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,g.decrypt.call(this,e,t,n.key,i)}})}())})),Ot((function(e,t){var r;e.exports=((r=Ri).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var n,s=this._iv;s?(n=s.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var a=0;a>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var n=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,s=this._iv,a=this._counter;s&&(a=this._counter=s.slice(0),this._iv=void 0),i(a);var o=a.slice(0);r.encryptBlock(o,0);for(var d=0;d>>2]|=n<<24-s%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),Ot((function(e,t){var r;e.exports=((r=Ri).pad.Iso10126={pad:function(e,t){var i=4*t,n=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(n-1)).concat(r.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),Ot((function(e,t){var r;e.exports=((r=Ri).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),Ot((function(e,t){var r;e.exports=((r=Ri).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),Ot((function(e,t){var r;e.exports=((r=Ri).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(e){var t=r,i=t.lib.CipherParams,n=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,n=[],s=[],a=[],o=[],d=[],l=[],c=[],u=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,s[p]=r;var m=e[r],_=e[m],g=e[_],y=257*e[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,d[r]=y<<8|y>>>24,l[r]=y,y=16843009*g^65537*_^257*m^16843008*r,c[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,h[p]=y<<8|y>>>24,f[p]=y,r?(r=m^e[e[e[g^m]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],a=0;a6&&a%r==4&&(l=n[l>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l]):(l=n[(l=l<<8|l>>>24)>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l],l^=p[a/r|0]<<24),s[a]=s[a-r]^l);for(var o=this._invKeySchedule=[],d=0;d>>24]]^u[n[l>>>16&255]]^h[n[l>>>8&255]]^f[n[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,d,l,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,c,u,h,f,s),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,s,a,o){for(var d=this._nRounds,l=e[t]^r[0],c=e[t+1]^r[1],u=e[t+2]^r[2],h=e[t+3]^r[3],f=4,p=1;p>>24]^n[c>>>16&255]^s[u>>>8&255]^a[255&h]^r[f++],_=i[c>>>24]^n[u>>>16&255]^s[h>>>8&255]^a[255&l]^r[f++],g=i[u>>>24]^n[h>>>16&255]^s[l>>>8&255]^a[255&c]^r[f++],y=i[h>>>24]^n[l>>>16&255]^s[c>>>8&255]^a[255&u]^r[f++];l=m,c=_,u=g,h=y}m=(o[l>>>24]<<24|o[c>>>16&255]<<16|o[u>>>8&255]<<8|o[255&h])^r[f++],_=(o[c>>>24]<<24|o[u>>>16&255]<<16|o[h>>>8&255]<<8|o[255&l])^r[f++],g=(o[u>>>24]<<24|o[h>>>16&255]<<16|o[l>>>8&255]<<8|o[255&c])^r[f++],y=(o[h>>>24]<<24|o[l>>>16&255]<<16|o[c>>>8&255]<<8|o[255&u])^r[f++],e[t]=m,e[t+1]=_,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib,i=t.WordArray,n=t.BlockCipher,s=e.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],u=s.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=a[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],s=0;s<16;s++){var l=n[s]=[],c=d[s];for(r=0;r<24;r++)l[r/6|0]|=t[(o[r]-1+c)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(o[r+24]-1+c)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var u=this._invSubKeys=[];for(r=0;r<16;r++)u[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],s=this._lBlock,a=this._rBlock,o=0,d=0;d<8;d++)o|=l[d][((a^n[d])&c[d])>>>0];this._lBlock=a,this._rBlock=s^o}var u=this._lBlock;this._lBlock=this._rBlock,this._rBlock=u,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=u.createEncryptor(i.create(t)),this._des2=u.createEncryptor(i.create(r)),this._des3=u.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(p)}(),r.TripleDES)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var s=0;n<256;n++){var a=n%r,o=t[a>>>2]>>>24-a%4*8&255;s=(s+i[n]+o)%256;var d=i[n];i[n]=i[s],i[s]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var s=e[t];e[t]=e[r],e[r]=s,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}e.RC4=t._createHelper(n);var a=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)s.call(this)}});e.RC4Drop=t._createHelper(a)}(),r.RC4)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],a=[],o=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)d.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var s=t.words,a=s[0],o=s[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(n[0]^=l,n[1]^=u,n[2]^=c,n[3]^=h,n[4]^=l,n[5]^=u,n[6]^=c,n[7]^=h,r=0;r<4;r++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,d=((n*n>>>17)+n*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=t._createHelper(o)}(),r.Rabbit)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],s=[],a=[],o=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)d.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var s=t.words,a=s[0],o=s[1],l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=l>>>16|4294901760&c,h=c<<16|65535&l;for(i[0]^=l,i[1]^=u,i[2]^=c,i[3]^=h,i[4]^=l,i[5]^=u,i[6]^=c,i[7]^=h,n=0;n<4;n++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)s[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,o=i>>>16,d=((n*n>>>17)+n*o>>>15)+o*o,l=((4294901760&i)*i|0)+((65535&i)*i|0);a[r]=d^l}e[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,e[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,e[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,e[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,e[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,e[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,e[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,e[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=t._createHelper(o)}(),r.RabbitLegacy)})),Ot((function(e,t){var r;e.exports=(r=Ri,function(){var e=r,t=e.lib.BlockCipher,i=e.algo;const n=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function d(e,t){let r=t>>24&255,i=t>>16&255,n=t>>8&255,s=255&t,a=e.sbox[0][r]+e.sbox[1][i];return a^=e.sbox[2][n],a+=e.sbox[3][s],a}function l(e,t,r){let i,s=t,a=r;for(let t=0;t1;--t)s^=e.pbox[t],a=d(e,s)^a,i=s,s=a,a=i;return i=s,s=a,a=i,a^=e.pbox[1],s^=e.pbox[0],{left:s,right:a}}function u(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=a[t][r]}let i=0;for(let a=0;a=r&&(i=0);let o=0,d=0,c=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);const n=e.byteLength;let s=5;for(;sn)break;let o=e[s+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=e.slice(s+4+2,s+4+a);let n=new Li.ModeOfOperation.ctr(t,new Li.Counter(r));const o=n.decrypt(i);n=null,e.set(o,s+4+2)}s=s+4+a}return e}function Ni(e,t,r){if(e.byteLength<=30)return e;const i=e.slice(32);let n=new Li.ModeOfOperation.ctr(t,new Li.Counter(r));const s=n.decrypt(i);return n=null,e.set(s,32),e}Ot((function(e,t){e.exports=Ri}));var Oi=Ot((function(e,t){var r,n,s,a=(r=new Date,n=4,s={setLogLevel:function(e){n=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=n&&console.debug("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=n&&console.info("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=n&&console.warn("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=n&&console.error("["+a.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},s);a.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+a.getDurationString(e.start(i))+","+a.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=a;var o=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};o.prototype.getPosition=function(){return this.position},o.prototype.getEndPosition=function(){return this.buffer.byteLength},o.prototype.getLength=function(){return this.buffer.byteLength},o.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},o.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},o.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},o.prototype.readUint8=function(){return this.readAnyInt(1,!1)},o.prototype.readUint16=function(){return this.readAnyInt(2,!1)},o.prototype.readUint24=function(){return this.readAnyInt(3,!1)},o.prototype.readUint32=function(){return this.readAnyInt(4,!1)},o.prototype.readUint64=function(){return this.readAnyInt(8,!1)},o.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),n=new Uint8Array(this._buffer);new Uint8Array(i,0,n.length).set(n),this.buffer=i,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,r,i,n){var s=new Uint8Array(e,t,n),a=new Uint8Array(r,i,n);s.set(a)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;rn;i--,n++){var s=t[n];t[n]=t[i],t[i]=s}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var c=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(c.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,a.debug("MultiBufferStream","Stream ready for parsing"),!0):(a.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(a.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){a.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},c.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},c.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}a.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,n,s)}}t&&(a.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},c.prototype.logBufferLevel=function(e){var t,r,i,n,s,o=[],d="";for(i=0,n=0,t=0;t0&&(d+=s.end-1+"]");var l=e?a.info:a.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+n+" bytes), continuous ranges: "+d)},c.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},c.prototype.findPosition=function(e,t,r){var i,n=null,s=-1;for(i=!0===e?0:this.bufferIndex;i=t?(a.debug("MultiBufferStream","Found position in existing buffer #"+s),s):-1},c.prototype.findEndContiguousBuf=function(e){var t,r,i,n=void 0!==e?e:this.bufferIndex;if(r=this.buffers[n],this.buffers.length>n+1)for(t=n+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=u;var h={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){h.FullBox.prototype=new h.Box,h.ContainerBox.prototype=new h.Box,h.SampleEntry.prototype=new h.Box,h.TrackGroupTypeBox.prototype=new h.FullBox,h.BASIC_BOXES.forEach((function(e){h.createBoxCtor(e)})),h.FULL_BOXES.forEach((function(e){h.createFullBoxCtor(e)})),h.CONTAINER_BOXES.forEach((function(e){h.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){h.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){h.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){h.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){h.FullBox.call(this,e,t)},createBoxCtor:function(e,t){h.boxCodes.push(e),h[e+"Box"]=function(t){h.Box.call(this,e,t)},h[e+"Box"].prototype=new h.Box,t&&(h[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){h[e+"Box"]=function(t){h.FullBox.call(this,e,t)},h[e+"Box"].prototype=new h.FullBox,h[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(a.error("BoxParser","Box of type '"+c+"' has a size "+l+" greater than its container size "+r),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):0!==l&&o+l>e.getEndPosition()?(e.seek(o),a.info("BoxParser","Not enough data in stream to parse the entire '"+c+"' box"),{code:h.ERR_NOT_ENOUGH_DATA,type:c,size:l,hdr_size:d,start:o}):t?{code:h.OK,type:c,size:l,hdr_size:d,start:o}:(h[c+"Box"]?i=new h[c+"Box"](l):"uuid"!==c?(a.warn("BoxParser","Unknown box type: '"+c+"'"),(i=new h.Box(c,l)).has_unparsed_data=!0):h.UUIDBoxes[s]?i=new h.UUIDBoxes[s](l):(a.warn("BoxParser","Unknown uuid type: '"+s+"'"),(i=new h.Box(c,l)).uuid=s,i.has_unparsed_data=!0),i.hdr_size=d,i.start=o,i.write===h.Box.prototype.write&&"mdat"!==i.type&&(a.info("BoxParser","'"+u+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(n=e.getPosition()-(i.start+i.size))<0?(a.warn("BoxParser","Parsing of box '"+u+"' did not read the entire indicated box data size (missing "+-n+" bytes), seeking forward"),e.seek(i.start+i.size)):n>0&&(a.error("BoxParser","Parsing of box '"+u+"' read "+n+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:h.OK,box:i,size:i.size})},h.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},h.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},h.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},h.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},h.SAMPLE_ENTRY_TYPE_VISUAL="Visual",h.SAMPLE_ENTRY_TYPE_AUDIO="Audio",h.SAMPLE_ENTRY_TYPE_HINT="Hint",h.SAMPLE_ENTRY_TYPE_METADATA="Metadata",h.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",h.SAMPLE_ENTRY_TYPE_SYSTEM="System",h.SAMPLE_ENTRY_TYPE_TEXT="Text",h.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},h.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},h.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},h.SampleEntry.prototype.parseFooter=function(e){h.ContainerBox.prototype.parse.call(this,e)},h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_HINT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),h.createMediaSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),h.createSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_TEXT,"enct"),h.createEncryptedSampleEntryCtor(h.SAMPLE_ENTRY_TYPE_METADATA,"encm"),h.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),h.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),h.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),h.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)a.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void a.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else a.error("av1C reserved_1 parsing problem");else a.error("av1C version "+this.version+" not supported")})),h.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),h.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),h.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),h.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),h.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),h.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),h.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),h.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),h.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=n>>1&31,i.bsmod=(1&n)<<4|s>>4&15,i.acmod=s>>1&7,i.lfeon=1&s,i.num_dep_sub=a>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&a)<<8|e.readUint8())}})),h.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),n=Math.min(127&i,r.length-1);if(n?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[n]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),h.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),h.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),h.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),h.createBoxCtor("hvcC",(function(e){var t,r,i,n;this.configurationVersion=e.readUint8(),n=e.readUint8(),this.general_profile_space=n>>6,this.general_tier_flag=(32&n)>>5,this.general_profile_idc=31&n,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),n=e.readUint8(),this.constantFrameRate=n>>6,this.numTemporalLayers=(13&n)>>3,this.temporalIdNested=(4&n)>>2,this.lengthSizeMinusOne=3&n,this.nalu_arrays=[];var s=e.readUint8();for(t=0;t>7,a.nalu_type=63&n;var o=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),h.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),a.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),h.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?a.property_index=(127&s)<<8|e.readUint8():a.property_index=127&s}}})),h.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&n,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:a.warn("BoxParser","Unknown leva assignement type")}}})),h.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),h.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),f.prototype.toString=function(){return"("+this.x+","+this.y+")"},h.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new f(e.readUint16(),e.readUint16()),this.display_primaries[1]=new f(e.readUint16(),e.readUint16()),this.display_primaries[2]=new f(e.readUint16(),e.readUint16()),this.white_point=new f(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),h.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),h.createFullBoxCtor("mehd",(function(e){1&this.flags&&(a.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),h.createFullBoxCtor("meta",(function(e){this.boxes=[],h.ContainerBox.prototype.parse.call(this,e)})),h.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),h.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),h.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),h.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),h.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),h.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),h.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),h.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),h.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),h.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),h.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),h.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)a.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=h.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),h.createSampleGroupCtor("stsa",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),h.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),h.createSampleGroupCtor("tsas",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("tscl",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createSampleGroupCtor("vipr",(function(e){a.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),h.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),h.createFullBoxCtor("senc"),h.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),a.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&n,i.subsegment_duration=e.readUint32(),n=e.readUint32(),i.starts_with_SAP=n>>31&1,i.SAP_type=n>>28&7,i.SAP_delta_time=268435455&n}})),h.SingleItemTypeReferenceBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.SingleItemTypeReferenceBox.prototype=new h.Box,h.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=h.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),h.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),h.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&h.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),h.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),h.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),h.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),h.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),h.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),h.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},h.createTrackGroupCtor("msrc"),h.TrackReferenceTypeBox=function(e,t,r,i){h.Box.call(this,e,t),this.hdr_size=r,this.start=i},h.TrackReferenceTypeBox.prototype=new h.Box,h.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},h.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&h.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&h.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),h.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),h.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),h.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),h.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=h.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),h.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),h.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=h.parseHex16(e)})),h.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),h.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),h.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var a=i.extract_bits(1);this.ptl_sublayer_present_mask|=a<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=h.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var n=!1,s="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||n)&&(s="."+h.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+s,n=!0);t+=s}return t},h.vvc1SampleEntry.prototype.getCodec=h.vvi1SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,n=[],s=0;for(s|=this.vvcC.ptl_frame_only_constraint<<7,s|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,n.push(s),s&&(i=e),s=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var a="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",o=0,d=0;for(e=0;e<=i;++e)for(o=o<<8|n[e],d+=8;d>=5;){r+=a[o>>d-5&31],o&=(1<<(d-=5))-1}d&&(r+=a[31&(o<<=5-d)])}}t+=r}return t},h.mp4aSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+h.decimalToHex(t)+(r?"."+r:"")}return e},h.stxtSampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},h.vp08SampleEntry.prototype.getCodec=h.vp09SampleEntry.prototype.getCodec=function(){var e=h.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},h.av01SampleEntry.prototype.getCodec=function(){var e,t=h.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},h.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),a.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},h.FullBox.prototype.writeHeader=function(e){this.size+=4,h.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},h.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},h.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},h.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&h.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&h.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&h.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&h.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&h.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},h.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},h.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},h.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&h.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&h.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&h.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&h.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&h.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&h.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof h.Box||t[r]instanceof h.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||h.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},h.boxEqual=function(e,t){if(!h.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var n={};this.extractedTracks.push(n),n.id=e,n.user=t,n.trak=i,i.nextSample=0,n.nb_samples=1e3,n.samples=[],r&&r.nbSamples&&(n.nb_samples=r.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=h.parseOneBox(this.stream,false)).code===h.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&a.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(a.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(a.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(a.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(a.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},g.prototype.getInfo=function(){var e,t,r,i,n,s,a={},o=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(a.hasMoov=!0,a.duration=this.moov.mvhd.duration,a.timescale=this.moov.mvhd.timescale,a.isFragmented=null!=this.moov.mvex,a.isFragmented&&this.moov.mvex.mehd&&(a.fragment_duration=this.moov.mvex.mehd.fragment_duration),a.isProgressive=this.isProgressive,a.hasIOD=null!=this.moov.iods,a.brands=[],a.brands.push(this.ftyp.major_brand),a.brands=a.brands.concat(this.ftyp.compatible_brands),a.created=new Date(o+1e3*this.moov.mvhd.creation_time),a.modified=new Date(o+1e3*this.moov.mvhd.modification_time),a.tracks=[],a.audioTracks=[],a.videoTracks=[],a.subtitleTracks=[],a.metadataTracks=[],a.hintTracks=[],a.otherTracks=[],e=0;e0?a.mime+='video/mp4; codecs="':a.audioTracks&&a.audioTracks.length>0?a.mime+='audio/mp4; codecs="':a.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(a.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),a.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(a.debug("ISOFile","Sending samples on track #"+s.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(s.id,s.user,s.samples),s.samples=[],s!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var r=[];return g._sweep.call(this,e,r,t),r},g._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;g._sweep.call(this.boxes[i],e,t,r)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},g.prototype.releaseUsedSamples=function(e,t){var r=0,i=this.getTrackById(e);i.lastValidSample||(i.lastValidSample=0);for(var n=i.lastValidSample;ne*n.timescale){l=i-1;break}t&&n.is_sync&&(d=i)}for(t&&(l=d),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return s=r.samples[l].offset+r.samples[l].alreadyRead,a.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+a.getDurationString(e,o)+" and offset: "+s),{offset:s,time:e/o}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var r,i,n,s=this.moov,o={offset:1/0,time:1/0};if(this.moov){for(n=0;nthis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){a=d;break}switch(a){case"Visual":if(n.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),s.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var u=new h.avcCBox;u.parse(new o(t.avcDecoderConfigRecord)),s.addBox(u)}else if(t.hevcDecoderConfigRecord){var f=new h.hvcCBox;f.parse(new o(t.hevcDecoderConfigRecord)),s.addBox(f)}break;case"Audio":n.add("smhd").set("balance",t.balance||0),s.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":n.add("hmhd");break;case"Subtitle":if(n.add("sthd"),"stpp"===t.type)s.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:n.add("nmhd")}t.description&&s.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){s.addBox(e)})),n.add("dinf").add("dref").addEntry((new h["url Box"]).set("flags",1));var p=n.add("stbl");return p.add("stsd").addEntry(s),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},h.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,r){var i=r||{},n={},s=this.getTrackById(e);if(null!==s){n.number=s.samples.length,n.track_id=s.tkhd.track_id,n.timescale=s.mdia.mdhd.timescale,n.description_index=i.sample_description_index?i.sample_description_index-1:0,n.description=s.mdia.minf.stbl.stsd.entries[n.description_index],n.data=t,n.size=t.byteLength,n.alreadyRead=n.size,n.duration=i.duration||1,n.cts=i.cts||0,n.dts=i.dts||0,n.is_sync=i.is_sync||!1,n.is_leading=i.is_leading||0,n.depends_on=i.depends_on||0,n.is_depended_on=i.is_depended_on||0,n.has_redundancy=i.has_redundancy||0,n.degradation_priority=i.degradation_priority||0,n.offset=0,n.subsamples=i.subsamples,s.samples.push(n),s.samples_size+=n.size,s.samples_duration+=n.duration,void 0===s.first_dts&&(s.first_dts=i.dts),this.processSamples();var a=this.createSingleSampleMoof(n);return this.addBox(a),a.computeSize(),a.trafs[0].truns[0].data_offset=a.size+8,this.add("mdat").data=new Uint8Array(t),n}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new h.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),n=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(n.first_dts||0)),i.add("trun").set("flags",h.TRUN_FLAGS_DATA_OFFSET|h.TRUN_FLAGS_DURATION|h.TRUN_FLAGS_SIZE|h.TRUN_FLAGS_FLAGS|h.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,r,i,n,s;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=n[a].grouping_type+"/0",(o=new l(n[a].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=o))}else for(a=0;a=2&&(d=i[a].grouping_type+"/0",o=new l(i[a].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=o))},g.setSampleGroupProperties=function(e,t,r,i){var n,s;for(n in t.sample_groups=[],i){var a;if(t.sample_groups[n]={},t.sample_groups[n].grouping_type=i[n].grouping_type,t.sample_groups[n].grouping_type_parameter=i[n].grouping_type_parameter,r>=i[n].last_sample_in_run&&(i[n].last_sample_in_run<0&&(i[n].last_sample_in_run=0),i[n].entry_index++,i[n].entry_index<=i[n].sbgp.entries.length-1&&(i[n].last_sample_in_run+=i[n].sbgp.entries[i[n].entry_index].sample_count)),i[n].entry_index<=i[n].sbgp.entries.length-1?t.sample_groups[n].group_description_index=i[n].sbgp.entries[i[n].entry_index].group_description_index:t.sample_groups[n].group_description_index=-1,0!==t.sample_groups[n].group_description_index)a=i[n].fragment_description?i[n].fragment_description:i[n].description,t.sample_groups[n].group_description_index>0?(s=t.sample_groups[n].group_description_index>65535?(t.sample_groups[n].group_description_index>>16)-1:t.sample_groups[n].group_description_index-1,a&&s>=0&&(t.sample_groups[n].description=a.entries[s])):a&&a.version>=2&&a.default_group_description_index>0&&(t.sample_groups[n].description=a.entries[a.default_group_description_index-1])}},g.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;ev&&(b++,v<0&&(v=0),v+=s.sample_counts[b]),t>0?(e.samples[t-1].duration=s.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,x.dts=e.samples[t-1].dts+e.samples[t-1].duration):x.dts=0,a?(t>=w&&(S++,w<0&&(w=0),w+=a.sample_counts[S]),x.cts=e.samples[t].dts+a.sample_offsets[S]):x.cts=x.dts,o?(t==o.sample_numbers[E]-1?(x.is_sync=!0,E++):(x.is_sync=!1,x.degradation_priority=0),l&&l.entries[A].sample_delta+B==t+1&&(x.subsamples=l.entries[A].subsamples,B+=l.entries[A].sample_delta,A++)):x.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,x,x.number),x.degradation_priority=h?h.priority[t]:0,l&&l.entries[A].sample_delta+B==t&&(x.subsamples=l.entries[A].subsamples,B+=l.entries[A].sample_delta),(c.length>0||u.length>0)&&g.setSampleGroupProperties(e,x,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,r,i,n,s,a,o,d,l,c,u,f,p,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(u,c,c.sbgps,u.mdia.minf.stbl.sgpds,c.sgpds),t=0;t0?p.dts=u.samples[u.samples.length-2].dts+u.samples[u.samples.length-2].duration:(c.tfdt?p.dts=c.tfdt.baseMediaDecodeTime:p.dts=0,u.first_traf_merged=!0),p.cts=p.dts,_.flags&h.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+_.sample_composition_time_offset[r]),m=a,_.flags&h.TRUN_FLAGS_FLAGS?m=_.sample_flags[r]:0===r&&_.flags&h.TRUN_FLAGS_FIRST_FLAG&&(m=_.first_sample_flags),p.is_sync=!(m>>16&1),p.is_leading=m>>26&3,p.depends_on=m>>24&3,p.is_depended_on=m>>22&3,p.has_redundancy=m>>20&3,p.degradation_priority=65535&m;var y=!!(c.tfhd.flags&h.TFHD_FLAG_BASE_DATA_OFFSET),v=!!(c.tfhd.flags&h.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(_.flags&h.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?c.tfhd.base_data_offset:v||0===t?l.start:o,p.offset=0===t&&0===r?b?w+_.data_offset:w:o,o=p.offset+p.size,(c.sbgps.length>0||c.sgpds.length>0||u.mdia.minf.stbl.sbgps.length>0||u.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(u,p,p.number_in_traf,c.sample_groups_info)}}if(c.subs){u.has_fragment_subsamples=!0;var S=c.first_sample_index;for(t=0;t-1))return null;var s=(r=this.stream.buffers[n]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=s)return a.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===s)return null;a.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+s+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,s),i.alreadyRead+=s,r.usedBytes+=s,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.alreadyRead=0,r.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=s.ipro.protections[s.iinf.item_infos[e].protection_index-1]),s.iinf.item_infos[e].item_type?r.type=s.iinf.item_infos[e].item_type:r.type="mime",r.content_type=s.iinf.item_infos[e].content_type,r.content_encoding=s.iinf.item_infos[e].content_encoding;if(s.grpl)for(e=0;e0&&h.property_index-1-1))return null;var o=(t=this.stream.buffers[s]).byteLength-(n.offset+n.alreadyRead-t.fileStart);if(!(n.length-n.alreadyRead<=o))return a.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+o+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,o),n.alreadyRead+=o,r.alreadyRead+=o,t.usedBytes+=o,this.stream.logBufferLevel(),null;a.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+(n.length-n.alreadyRead)+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,n.length-n.alreadyRead),t.usedBytes+=n.length-n.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=n.length-n.alreadyRead,n.alreadyRead=n.length}}return r.alreadyRead===r.size?r:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},h.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},h.FullBox.prototype.printHeader=function(e){this.size+=4,h.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},h.Box.prototype.print=function(e){this.printHeader(e)},h.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},h.tkhdBox.prototype.print=function(e){h.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var r=void 0===e||e,i=new g(t);return i.discardMdatData=!r,i}};t.createFile=y.createFile}));function $i(e){return e.reduce(((e,t)=>256*e+t))}function Gi(e){const t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every(((e,t)=>e===i[t]))}Oi.Log,Oi.MP4BoxStream,Oi.DataStream,Oi.MultiBufferStream,Oi.MPEG4DescriptorParser,Oi.BoxParser,Oi.XMLSubtitlein4Parser,Oi.Textin4Parser,Oi.ISOFile,Oi.createFile;class Hi{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(r+32,r+32+t))]}return null}(t,this.t);if(!r)return e;const i=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(i instanceof Error)return console.error(i.message),this.d=!0,e;this.A=!0,this.u=r[1],Gi(t)&&this.c++,WebAssembly.instantiate(r[2],i).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}const Vi=16,Wi=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],ji=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function qi(e){const t=[];for(let r=0,i=e.length;r1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Ki(e){const t=[];for(let r=0,i=e.length;r>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function Xi(e){const t=[];for(let r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function Zi(e,t){const r=31&t;return e<>>32-r}function Ji(e){return(255&Wi[e>>>24&255])<<24|(255&Wi[e>>>16&255])<<16|(255&Wi[e>>>8&255])<<8|255&Wi[255&e]}function Qi(e){return e^Zi(e,2)^Zi(e,10)^Zi(e,18)^Zi(e,24)}function en(e){return e^Zi(e,13)^Zi(e,23)}function tn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[4*t],n[1]=255&e[4*t+1],n[2]=255&e[4*t+2],n[3]=255&e[4*t+3],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(let e,t=0;t<32;t+=4)e=i[1]^i[2]^i[3]^r[t+0],i[0]^=Qi(Ji(e)),e=i[2]^i[3]^i[0]^r[t+1],i[1]^=Qi(Ji(e)),e=i[3]^i[0]^i[1]^r[t+2],i[2]^=Qi(Ji(e)),e=i[0]^i[1]^i[2]^r[t+3],i[3]^=Qi(Ji(e));for(let e=0;e<16;e+=4)t[e]=i[3-e/4]>>>24&255,t[e+1]=i[3-e/4]>>>16&255,t[e+2]=i[3-e/4]>>>8&255,t[e+3]=255&i[3-e/4]}function rn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[0+4*t],n[1]=255&e[1+4*t],n[2]=255&e[2+4*t],n[3]=255&e[3+4*t],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let e,r=0;r<32;r+=4)e=i[1]^i[2]^i[3]^ji[r+0],t[r+0]=i[0]^=en(Ji(e)),e=i[2]^i[3]^i[0]^ji[r+1],t[r+1]=i[1]^=en(Ji(e)),e=i[3]^i[0]^i[1]^ji[r+2],t[r+2]=i[2]^=en(Ji(e)),e=i[0]^i[1]^i[2]^ji[r+3],t[r+3]=i[3]^=en(Ji(e));if(0===r)for(let e,r=0;r<16;r++)e=t[r],t[r]=t[31-r],t[31-r]=e}function nn(e,t,r){let{padding:i="pkcs#7",mode:n,iv:s=[],output:a="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===n&&("string"==typeof s&&(s=qi(s)),16!==s.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=qi(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Ki(e):qi(e):[...e],("pkcs#5"===i||"pkcs#7"===i)&&0!==r){const t=Vi-e.length%Vi;for(let r=0;r=Vi;){const t=e.slice(u,u+16),i=new Array(16);if("cbc"===n)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2];const i=e.byteLength;let n=5;for(;ni)break;let a=e[n+4],o=!1;if(r?(a=a>>>1&63,o=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(a)):(a&=31,o=1===a||5===a),o){const r=nn(e.slice(n+4+2,n+4+s),t,0,{padding:"none",output:"array"});e.set(r,n+4+2)}n=n+4+s}return e}class on{on(e,t,r){const i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){const i=this;function n(){i.off(e,n);for(var s=arguments.length,a=new Array(s),o=0;o1?r-1:0),n=1;n{delete r[e]})),void delete this.e;const i=r[e],n=[];if(i&&t)for(let e=0,r=i.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=dn.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==dn.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=dn.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==dn.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=dn.findFirstStartCode}}}}function cn(e,t,r){for(let i=2;i3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let s=5;for(;sn)break;let o=e[s+4],d=!1;if(i?(o=o>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(o)):(o&=31,d=1===o||5===o),d){const i=cn(e.slice(s+4,s+4+a),t,r);e.set(i,s+4)}s=s+4+a}return e}function fn(){for(var e=arguments.length,t=new Array(e),r=0;re+t.byteLength),0));let n=0;return t.forEach((e=>{i.set(e,n),n+=e.byteLength})),i}class pn{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,r,i)));e.addEventListener(t,r,i);const n=()=>{cr(e.removeEventListener)&&e.removeEventListener(t,r,i)};return this.destroys.push(n),n}destroy(){this.master.debug&&this.master.debug.log("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class mn{static init(){mn.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in mn.types)mn.types.hasOwnProperty(e)&&(mn.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=mn.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=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]),e.HDLR_AUDIO=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]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,r=null,i=Array.prototype.slice.call(arguments,1),n=i.length;for(let e=0;e>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);let s=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,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]))}static trak(e){return mn.box(mn.types.trak,mn.tkhd(e),mn.mdia(e))}static tkhd(e){let t=e.id,r=e.duration,i=e.presentWidth,n=e.presentHeight;return mn.box(mn.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,n>>>8&255,255&n,0,0]))}static mdia(e){return mn.box(mn.types.mdia,mn.mdhd(e),mn.hdlr(e),mn.minf(e))}static mdhd(e){let t=e.timescale,r=e.duration;return mn.box(mn.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?mn.constants.HDLR_AUDIO:mn.constants.HDLR_VIDEO,mn.box(mn.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?mn.box(mn.types.smhd,mn.constants.SMHD):mn.box(mn.types.vmhd,mn.constants.VMHD),mn.box(mn.types.minf,t,mn.dinf(),mn.stbl(e))}static dinf(){return mn.box(mn.types.dinf,mn.box(mn.types.dref,mn.constants.DREF))}static stbl(e){return mn.box(mn.types.stbl,mn.stsd(e),mn.box(mn.types.stts,mn.constants.STTS),mn.box(mn.types.stsc,mn.constants.STSC),mn.box(mn.types.stsz,mn.constants.STSZ),mn.box(mn.types.stco,mn.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.mp3(e)):mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.mp4a(e)):"avc"===e.videoType?mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.avc1(e)):mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.hvc1(e))}static mp3(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return mn.box(mn.types[".mp3"],i)}static mp4a(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return mn.box(mn.types.mp4a,i,mn.esds(e))}static esds(e){let t=e.config||[],r=t.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(t).concat([6,1,2]));return mn.box(mn.types.esds,i)}static avc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=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,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return mn.box(mn.types.avc1,n,mn.box(mn.types.avcC,t))}static hvc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=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,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return mn.box(mn.types.hvc1,n,mn.box(mn.types.hvcC,t))}static mvex(e){return mn.box(mn.types.mvex,mn.trex(e))}static trex(e){let t=e.id,r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return mn.box(mn.types.trex,r)}static moof(e,t){return mn.box(mn.types.moof,mn.mfhd(e.sequenceNumber),mn.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return mn.box(mn.types.mfhd,t)}static traf(e,t){let r=e.id,i=mn.box(mn.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),n=mn.box(mn.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),s=mn.sdtp(e),a=mn.trun(e,s.byteLength+16+16+8+16+8+8);return mn.box(mn.types.traf,i,n,a,s)}static sdtp(e){let t=new Uint8Array(5),r=e.flags;return t[4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy,mn.box(mn.types.sdtp,t)}static trun(e,t){let r=new Uint8Array(28);t+=36,r.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let i=e.duration,n=e.size,s=e.flags,a=e.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.isNonSync,0,0,a>>>24&255,a>>>16&255,a>>>8&255,255&a],12),mn.box(mn.types.trun,r)}static mdat(e){return mn.box(mn.types.mdat,e)}}mn.init();var _n,gn=Ot((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(_n=gn)&&_n.__esModule&&Object.prototype.hasOwnProperty.call(_n,"default")&&_n.default;const yn=[44100,48e3,32e3,0],vn=[22050,24e3,16e3,0],bn=[11025,12e3,8e3,0],wn=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],Sn=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],En=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function An(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),r=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let i=t[1]>>>3&3,n=(6&t[1])>>1,s=(240&t[2])>>>4,a=(12&t[2])>>>2,o=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(i){case 0:d=bn[a];break;case 2:d=vn[a];break;case 3:d=yn[a]}switch(n){case 1:s=e[n]&&t=6?(i=5,t=new Array(4),a=n-3):(i=2,t=new Array(2),a=n):-1!==o.indexOf("android")?(i=2,t=new Array(2),a=n):(i=5,a=n,t=new Array(4),n>=6?a=n-3:1===s&&(i=2,t=new Array(2),a=n)),t[0]=i<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&s)<<3,5===i&&(t[1]|=(15&a)>>>1,t[2]=(1&a)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=Nn[n],this.sampling_index=n,this.channel_count=s,this.object_type=i,this.original_object_type=r,this.codec_mimetype="mp4a.40."+i,this.original_codec_mimetype="mp4a.40."+r}}Date.now||(Date.now=function(){return(new Date).getTime()});const Gn=[];Gn.push(a({printErr:function(e){console.warn("JbPro[❌❌❌][worker]:",e)}}),s({printErr:function(e){console.warn("JbPro[❌❌❌][worker]:",e)}})),Promise.all(Gn).then((e=>{const t=e[0];!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],n=[],s={},a=new AbortController,o=null,d=null,l=null,c=null,u=!1,h=null,f=null,S=!1,E=!1,U=!!yr(r),be=!1,we=null,Ve=null,Xe=null,at=[],ft=null,pt=null,mt=0,_t=0,Et=null,At=null,Ut=0,Nt=0,Ot=!1,$t=!1,Gt=!1,Ht=null,Yt=null,Jt=null,nr=!1,wr=!0,Sr=()=>{const e=_r();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration}};"VideoEncoder"in self&&(s={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:new VideoDecoder({output:function(e){if(s.isEmitInfo||(ii.debug.log("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:k,w:e.codedWidth,h:e.codedHeight}),s.isEmitInfo=!0,s.offscreenCanvas=new OffscreenCanvas(e.codedWidth,e.codedHeight),s.offscreenCanvasCtx=s.offscreenCanvas.getContext("2d")),cr(e.createImageBitmap))e.createImageBitmap().then((t=>{s.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let r=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:r,delay:ii.delay,ts:0},[r]),fr(e)}));else{s.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=s.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:t,delay:ii.delay,ts:0},[t]),fr(e)}},error:function(e){ii.debug.error("worker","VideoDecoder error",e)}}),decode:function(e,t,r){const i=e[0]>>4==1;if(s.hasInit){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?lt:ct});s.decoder.decode(r)}else if(i&&0===e[1]){const t=15&e[0];postMessage({cmd:R,code:t});const r=new Uint8Array(e);postMessage({cmd:M,buffer:r,codecId:t},[r.buffer]);let i=null,n=null;const a=e.slice(5);t===Ie?(n=kr(a),i={codec:n.codec,description:a}):t===Fe&&(n=Wr(a),i={codec:n.codec,description:a}),n&&n.codecWidth&&n.codecHeight&&(i.codedHeight=n.codecHeight,i.codedWidth=n.codecWidth);try{s.decoder.configure(i),s.hasInit=!0}catch(e){ii.debug.log("worker","VideoDecoder configure error",e.code,e)}}},reset(){s.hasInit=!1,s.isEmitInfo=!1,s.offscreenCanvas=null,s.offscreenCanvasCtx=null}});let Er=function(){if(nr=!0,ii.fetchStatus!==Ct||vr(ii._opt.isChrome)){if(a)try{a.abort(),a=null}catch(e){ii.debug.log("worker","abort catch",e)}}else a=null,ii.debug.log("worker",`abort() and not abortController.abort() _status is ${ii.fetchStatus} and _isChrome is ${ii._opt.isChrome}`)},Ar={init(){Ar.lastBuf=null,Ar.vps=null,Ar.sps=null,Ar.pps=null,Ar.streamType=null,Ar.localDts=0,Ar.isSendSeqHeader=!1},destroy(){Ar.lastBuf=null,Ar.vps=null,Ar.sps=null,Ar.pps=null,Ar.streamType=null,Ar.localDts=0,Ar.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);Ar.extractNALu$2(t)},getNaluDts(){let e=Ar.localDts;return Ar.localDts=Ar.localDts+40,e},getNaluAudioDts(){const e=ii._opt.sampleRate,t=ii._opt.audioBufferSize;return Ar.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,r,i=0,n=e.byteLength,s=0,a=[];for(;i1)for(let e=0;e{const t=Fr(e);t===He||t===Ge?Ar.handleVideoH264Nalu(e):Rr(t)&&i.push(e)})),1===i.length)Ar.handleVideoH264Nalu(i[0]);else if(zr(i)){const e=Fr(i[0]),t=Mr(e);Ar.handleVideoH264NaluList(i,t,e)}else i.forEach((e=>{Ar.handleVideoH264Nalu(e)}))}else if(Ar.streamType===Me)if(ii._opt.nakedFlowH265DemuxUseNew){const t=Ar.handleAddNaluStartCode(e),r=Ar.extractNALu(t);if(0===r.length)return void ii.debug.warn("worker","handleVideoNalu","h265 naluList.length === 0");const i=[];if(r.forEach((e=>{const t=Xr(e);t===nt||t===rt||t===et?Ar.handleVideoH265Nalu(e):Jr(t)&&i.push(e)})),1===i.length)Ar.handleVideoH265Nalu(i[0]);else if(ei(i)){const e=Xr(i[0]),t=Qr(e);Ar.handleVideoH265NaluList(i,t,e)}else i.forEach((e=>{Ar.handleVideoH265Nalu(e)}))}else Xr(e)===nt?Ar.extractH265PPS(e):Ar.handleVideoH265Nalu(e)},extractH264PPS(e){const t=Ar.handleAddNaluStartCode(e);Ar.extractNALu(t).forEach((e=>{Lr(Fr(e))?Ar.extractH264SEI(e):Ar.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=Ar.handleAddNaluStartCode(e);Ar.extractNALu(t).forEach((e=>{Zr(Xr(e))?Ar.extractH265SEI(e):Ar.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=Ar.handleAddNaluStartCode(e);Ar.extractNALu(t).forEach((e=>{Ar.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=Ar.handleAddNaluStartCode(e);Ar.extractNALu(t).forEach((e=>{Ar.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],r=new Uint8Array(e.length+t.length);return r.set(t),r.set(e,t.length),r},handleVideoH264Nalu(e){const t=Fr(e);switch(t){case Ge:Ar.sps=e;break;case He:Ar.pps=e}if(Ar.isSendSeqHeader){if(Ar.sps&&Ar.pps){const e=Cr({sps:Ar.sps,pps:Ar.pps}),t=Ar.getNaluDts();ii.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Ar.sps=null,Ar.pps=null}if(Rr(t)){const r=Mr(t),i=Ar.getNaluDts(),n=Pr(e,r);Ar.doDecode(n,{type:ae,ts:i,isIFrame:r,cts:0})}else ii.debug.warn("work",`handleVideoH264Nalu Avc Seq Head is ${t}`)}else if(Ar.sps&&Ar.pps){Ar.isSendSeqHeader=!0;const e=Cr({sps:Ar.sps,pps:Ar.pps});ii.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Ar.sps=null,Ar.pps=null}},handleVideoH264NaluList(e,t,r){if(Ar.isSendSeqHeader){const i=Ar.getNaluDts(),n=Ir(e.reduce(((e,t)=>{const r=er(e),i=er(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Ar.doDecode(n,{type:ae,ts:i,isIFrame:t,cts:0}),ii.debug.log("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}else ii.debug.warn("worker","handleVideoH264NaluList isSendSeqHeader is false")},handleVideoH265Nalu(e){const t=Xr(e);switch(t){case et:Ar.vps=e;break;case rt:Ar.sps=e;break;case nt:Ar.pps=e}if(Ar.isSendSeqHeader){if(Ar.vps&&Ar.sps&&Ar.pps){const e=qr({vps:Ar.vps,sps:Ar.sps,pps:Ar.pps}),t=Ar.getNaluDts();ii.decode(e,{type:ae,ts:t,isIFrame:!0,cts:0}),Ar.vps=null,Ar.sps=null,Ar.pps=null}if(Jr(t)){const r=Qr(t),i=Ar.getNaluDts(),n=Yr(e,r);Ar.doDecode(n,{type:ae,ts:i,isIFrame:r,cts:0})}else ii.debug.warn("work",`handleVideoH265Nalu HevcSeqHead is ${t}`)}else if(Ar.vps&&Ar.sps&&Ar.pps){Ar.isSendSeqHeader=!0;const e=qr({vps:Ar.vps,sps:Ar.sps,pps:Ar.pps});ii.decode(e,{type:ae,ts:0,isIFrame:!0,cts:0}),Ar.vps=null,Ar.sps=null,Ar.pps=null}},handleVideoH265NaluList(e,t,r){if(Ar.isSendSeqHeader){const i=Ar.getNaluDts(),n=Kr(e.reduce(((e,t)=>{const r=er(e),i=er(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Ar.doDecode(n,{type:ae,ts:i,isIFrame:t,cts:0}),ii.debug.log("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}else ii.debug.warn("worker","handleVideoH265NaluList isSendSeqHeader is false")},doDecode(e,t){ii.calcNetworkDelay(t.ts),t.isIFrame&&ii.calcIframeIntervalTimestamp(t.ts),ii.decode(e,t)}},Tr={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){Tr.mp4Box=Oi.createFile(),Tr.mp4Box.onReady=Tr.onReady,Tr.mp4Box.onError=Tr.onError,Tr.mp4Box.onSamples=Tr.onSamples},initTransportDescarmber(){Tr.transportDescarmber=new Hi},_getSeqHeader(e){const t=Tr.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new Oi.DataStream(void 0,0,Oi.DataStream.BIG_ENDIAN);let r=[];e.avcC?(e.avcC.write(t),r=[23,0,0,0,0]):(Tr.isHevc=!0,Ht=!0,e.hvcC.write(t),r=[28,0,0,0,0]);const i=new Uint8Array(t.buffer,8),n=new Uint8Array(r.length+i.length);return n.set(r,0),n.set(i,r.length),n}return null},onReady(e){ii.debug.log(Tr.LOG_NAME,"onReady()");const t=e.videoTracks[0],r=e.audioTracks[0];if(t){Tr.videoTrackId=t.id;const e=Tr._getSeqHeader(t);e&&(ii.debug.log(Tr.LOG_NAME,"seqHeader"),ii.decodeVideo(e,0,!0,0)),Tr.mp4Box.setExtractionOptions(t.id)}if(r&&ii._opt.hasAudio){Tr.audioTrackId=r.id;const e=r.audio||{},t=Vt.indexOf(e.sample_rate),i=r.codec.replace("mp4a.40.","");Tr.mp4Box.setExtractionOptions(r.id);const n=Wt({profile:parseInt(i,10),sampleRate:t,channel:e.channel_count});ii.debug.log(Tr.LOG_NAME,"aacADTSHeader"),ii.decodeAudio(n,0)}Tr.mp4Box.start()},onError(e){ii.debug.error(Tr.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,r){if(e===Tr.videoTrackId)for(const t of r){const r=t.data,i=t.is_sync,n=1e3*t.cts/t.timescale;t.duration,t.timescale,i&&ii.calcIframeIntervalTimestamp(n);let s=null;s=Tr.isHevc?Kr(r,i):Ir(r,i),ii.decode(s,{type:ae,ts:n,isIFrame:i,cts:0}),Tr.mp4Box.releaseUsedSamples(e,t.number)}else if(e===Tr.audioTrackId){if(ii._opt.hasAudio)for(const t of r){const r=t.data,i=1e3*t.cts/t.timescale;t.duration,t.timescale;const n=new Uint8Array(r.byteLength+2);n.set([175,1],0),n.set(r,2),ii.decode(n,{type:se,ts:i,isIFrame:!1,cts:0}),Tr.mp4Box.releaseUsedSamples(e,t.number)}}else ii.debug.warn(Tr.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);Tr.transportDescarmber&&(t=Tr.transportDescarmber.transport(t)),t.buffer.fileStart=Tr.offset,Tr.offset+=t.byteLength,Tr.mp4Box.appendBuffer(t.buffer)},destroy(){Tr.mp4Box&&(Tr.mp4Box.stop(),Tr.mp4Box.flush(),Tr.mp4Box.destroy(),Tr.mp4Box=null),Tr.transportDescarmber&&(Tr.transportDescarmber.destroy(),Tr.transportDescarmber=null),Tr.offset=0,Tr.videoTrackId=null,Tr.audioTrackId=null,Tr.isHevc=!1}},$r={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);$r.extractNALu(t)},destroy(){$r.lastBuffer=new Uint8Array(0),$r.parsedOffset=0,$r.firstStartCodeOffset=0,$r.secondStartCodeOffset=0,$r.state="init",$r.hasInitVideoCodec=!1,$r.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void ii.debug.warn($r.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array($r.lastBuffer.length+e.length);for(t.set($r.lastBuffer,0),t.set(new Uint8Array(e),$r.lastBuffer.length),$r.lastBuffer=t;;){if("init"===$r.state){let e=!1;for(;$r.lastBuffer.length-$r.parsedOffset>=4;)if(0===$r.lastBuffer[$r.parsedOffset])if(0===$r.lastBuffer[$r.parsedOffset+1])if(1===$r.lastBuffer[$r.parsedOffset+2]){if(182===$r.lastBuffer[$r.parsedOffset+3]){$r.state="findFirstStartCode",$r.firstStartCodeOffset=$r.parsedOffset,$r.parsedOffset+=4,e=!0;break}$r.parsedOffset++}else $r.parsedOffset++;else $r.parsedOffset++;else $r.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===$r.state){let e=!1;for(;$r.lastBuffer.length-$r.parsedOffset>=4;)if(0===$r.lastBuffer[$r.parsedOffset])if(0===$r.lastBuffer[$r.parsedOffset+1])if(1===$r.lastBuffer[$r.parsedOffset+2]){if(182===$r.lastBuffer[$r.parsedOffset+3]){$r.state="findSecondStartCode",$r.secondStartCodeOffset=$r.parsedOffset,$r.parsedOffset+=4,e=!0;break}$r.parsedOffset++}else $r.parsedOffset++;else $r.parsedOffset++;else $r.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===$r.state){if(!($r.lastBuffer.length-$r.parsedOffset>0))break;{let e,t,r=192&$r.lastBuffer[$r.parsedOffset];e=0==r?$r.secondStartCodeOffset-14:$r.secondStartCodeOffset;let i=0==(192&$r.lastBuffer[$r.firstStartCodeOffset+4]);if(i){if($r.firstStartCodeOffset-14<0)return void ii.debug.warn($r.LOG_NAME,"firstStartCodeOffset -14 is",$r.firstStartCodeOffset-14);$r.hasInitVideoCodec||($r.hasInitVideoCodec=!0,ii.debug.log($r.LOG_NAME,"setCodec"),si.setCodec(Le,"")),t=$r.lastBuffer.subarray($r.firstStartCodeOffset-14,e)}else t=$r.lastBuffer.subarray($r.firstStartCodeOffset,e);let n=$r.getNaluDts();$r.hasInitVideoCodec?(postMessage({cmd:$,type:Be,value:t.byteLength}),postMessage({cmd:$,type:xe,value:n}),si.decode(t,i?1:0,n)):ii.debug.warn($r.LOG_NAME,"has not init video codec"),$r.lastBuffer=$r.lastBuffer.subarray(e),$r.firstStartCodeOffset=0==r?14:0,$r.parsedOffset=$r.firstStartCodeOffset+4,$r.state="findFirstStartCode"}}}},getNaluDts(){let e=$r.localDts;return $r.localDts=$r.localDts+40,e}},Gr={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new On,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){Gr.media_info_=null,Gr.pes_slice_queues_=null,Gr.section_slice_queues_=null,Gr.video_metadata_=null,Gr.audio_metadata_=null,Gr.aac_last_incomplete_data_=null,Gr.video_track_=null,Gr.audio_track_=null,Gr._remainingPacketData=null},probe(e){let t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){let e=Math.min(1e3,t.byteLength-3*i);for(let n=0;n=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){Gr._remainingPacketData&&(e=fn(Gr._remainingPacketData,e),Gr._remainingPacketData=null);let t=e.buffer;const r=Gr.parseChunks(t);r?Gr._remainingPacketData=e.subarray(r):e.length>>6;r[1];let s=(31&r[1])<<8|r[2],a=(48&r[3])>>>4,o=15&r[3],d=!(!Gr.pmt_||Gr.pmt_.pcr_pid!==s),l={},c=4;if(2==a||3==a){let e=r[4];if(e>0&&(d||3==a)&&(l.discontinuity_indicator=(128&r[5])>>>7,l.random_access_indicator=(64&r[5])>>>6,l.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){let e=300*(r[6]<<25|r[7]<<17|r[8]<<9|r[9]<<1|r[10]>>>7)+((1&r[10])<<8|r[11]);Gr.last_pcr_=e}if(2==a||5+e===188){t+=188,204===Gr.tsPacketSize&&(t+=16);continue}c=5+e}if(1==a||3==a)if(0===s||s===Gr.current_pmt_pid_||null!=Gr.pmt_&&Gr.pmt_.pid_stream_type[s]===In){let r=188-c;Gr.handleSectionSlice(e,t+c,r,{pid:s,payload_unit_start_indicator:n,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}else if(null!=Gr.pmt_&&null!=Gr.pmt_.pid_stream_type[s]){let r=188-c,i=Gr.pmt_.pid_stream_type[s];s!==Gr.pmt_.common_pids.h264&&s!==Gr.pmt_.common_pids.h265&&s!==Gr.pmt_.common_pids.adts_aac&&s!==Gr.pmt_.common_pids.loas_aac&&s!==Gr.pmt_.common_pids.ac3&&s!==Gr.pmt_.common_pids.eac3&&s!==Gr.pmt_.common_pids.opus&&s!==Gr.pmt_.common_pids.mp3&&!0!==Gr.pmt_.pes_private_data_pids[s]&&!0!==Gr.pmt_.timed_id3_pids[s]&&!0!==Gr.pmt_.synchronous_klv_pids[s]&&!0!==Gr.pmt_.asynchronous_klv_pids[s]||Gr.handlePESSlice(e,t+c,r,{pid:s,stream_type:i,payload_unit_start_indicator:n,continuity_conunter:o,random_access_indicator:l.random_access_indicator})}t+=188,204===Gr.tsPacketSize&&(t+=16)}return Gr.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=Gr.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){let a=n[0];if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t+1,Math.min(r,a));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?Gr.emitSectionSlices(s,i):Gr.clearSlices(s,i)}for(let o=1+a;o=s.expected_length&&Gr.clearSlices(s,i),o+=d.byteLength}}else if(null!=s&&0!==s.total_length){let n=new Uint8Array(e,t,Math.min(r,s.expected_length-s.total_length));s.slices.push(n),s.total_length+=n.byteLength,s.total_length===s.expected_length?Gr.emitSectionSlices(s,i):s.total_length>=s.expected_length&&Gr.clearSlices(s,i)}},handlePESSlice(e,t,r,i){let n=new Uint8Array(e,t,r),s=n[0]<<16|n[1]<<8|n[2];n[3];let a=n[4]<<8|n[5];if(i.payload_unit_start_indicator){if(1!==s)return void ii.debug.warn(Gr.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${s}`);let e=Gr.pes_slice_queues_[i.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?Gr.emitPESSlices(e,i):Gr.clearSlices(e,i)),Gr.pes_slice_queues_[i.pid]=new Rn,Gr.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null==Gr.pes_slice_queues_[i.pid])return;let o=Gr.pes_slice_queues_[i.pid];o.slices.push(n),i.payload_unit_start_indicator&&(o.expected_length=0===a?0:a+6),o.total_length+=n.byteLength,o.expected_length>0&&o.expected_length===o.total_length?Gr.emitPESSlices(o,i):o.expected_length>0&&o.expected_length>>6,o=t[8];2!==a&&3!==a||(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,s=3===a?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:r);let d,l=9+o;if(0!==n){if(n<3+o)return void ii.debug.warn(Gr.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=n-3-o}else d=t.byteLength-l;let c=t.subarray(l,l+d);switch(e.stream_type){case Bn:case xn:Gr.parseMP3Payload(c,r);break;case Un:Gr.pmt_.common_pids.opus===e.pid||Gr.pmt_.common_pids.ac3===e.pid||Gr.pmt_.common_pids.eac3===e.pid||(Gr.pmt_.asynchronous_klv_pids[e.pid]?Gr.parseAsynchronousKLVMetadataPayload(c,e.pid,i):Gr.pmt_.smpte2038_pids[e.pid]?Gr.parseSMPTE2038MetadataPayload(c,r,s,e.pid,i):Gr.parsePESPrivateDataPayload(c,r,s,e.pid,i));break;case Tn:Gr.parseADTSAACPayload(c,r);break;case kn:Gr.parseLOASAACPayload(c,r);break;case Cn:case Dn:break;case Pn:Gr.pmt_.timed_id3_pids[e.pid]?Gr.parseTimedID3MetadataPayload(c,r,s,e.pid,i):Gr.pmt_.synchronous_klv_pids[e.pid]&&Gr.parseSynchronousKLVMetadataPayload(c,r,s,e.pid,i);break;case Fn:Gr.parseH264Payload(c,r,s,e.random_access_indicator);break;case Ln:Gr.parseH265Payload(c,r,s,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===Un){let r,s=6;r=0!==n?n:t.byteLength-s;let a=t.subarray(s,s+r);Gr.parsePESPrivateDataPayload(a,void 0,void 0,e.pid,i)}}else ii.debug.error(Gr.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${r}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e(Gr.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let r=(15&e[1])<<8|e[2];e[3],e[4];let i=(62&e[5])>>>1,n=1&e[5],s=e[6];e[7];let a=null;if(1===n&&0===s)a={version_number:0,network_pid:0,program_pmt_pid:{}},a.version_number=i;else if(a=Gr.pat_,null==a)return;let o=r-5-4,d=-1,l=-1;for(let t=8;t<8+o;t+=4){let r=e[t]<<8|e[t+1],i=(31&e[t+2])<<8|e[t+3];0===r?a.network_pid=i:(a.program_pmt_pid[r]=i,-1===d&&(d=r),-1===l&&(l=i))}1===n&&0===s&&(null==Gr.pat_&&ii.debug.log(Gr.TAG_NAME,`Parsed first PAT: ${JSON.stringify(a)}`),Gr.pat_=a,Gr.current_program_=d,Gr.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void ii.debug.error(Gr.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let r,i=(15&e[1])<<8|e[2],n=e[3]<<8|e[4],s=(62&e[5])>>>1,a=1&e[5],o=e[6];if(e[7],1===a&&0===o)r=Gr._initPmt(),r.program_number=n,r.version_number=s,Gr.program_pmt_map_[n]=r;else if(r=Gr.program_pmt_map_[n],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,c=i-9-d-4;for(let t=l;t0){for(let i=t+5;i0)for(let i=t+5;iGr.has_video_&&Gr.has_audio_?Gr.video_init_segment_dispatched_&&Gr.audio_init_segment_dispatched_:Gr.has_video_&&!Gr.has_audio_?Gr.video_init_segment_dispatched_:!(Gr.has_video_||!Gr.has_audio_)&&Gr.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=Gr.video_metadata_.details,t={type:"video"};t.id=Gr.video_track_.id,t.timescale=1e3,t.duration=Gr.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let r=t.frameRate.fps_den,i=t.frameRate.fps_num;if(t.refSampleDuration=r/i*1e3,t.codec=e.codec_mimetype,Gr.video_metadata_.vps){let e=Gr.video_metadata_.vps.data.subarray(4),r=Gr.video_metadata_.sps.data.subarray(4),i=Gr.video_metadata_.pps.data.subarray(4);t.hvcc=qr({vps:e,sps:r,pps:i}),0==Gr.video_init_segment_dispatched_&&ii.debug.log(Gr.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&ii.decodeVideo(t.hvcc,0,!0,0)}else{let e=Gr.video_metadata_.sps.data.subarray(4),r=Gr.video_metadata_.pps.data.subarray(4);t.avcc=Dr({sps:e,pps:r}),0==Gr.video_init_segment_dispatched_&&ii.debug.log(Gr.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&ii.decodeVideo(t.avcc,0,!0,0)}Gr.video_init_segment_dispatched_=!0,Gr.video_metadata_changed_=!1;let n=Gr.media_info_;n.hasVideo=!0,n.width=t.codecWidth,n.height=t.codecHeight,n.fps=t.frameRate.fps,n.profile=t.profile,n.level=t.level,n.refFrames=e.ref_frames,n.chromaFormat=e.chroma_format_string,n.sarNum=t.sarRatio.width,n.sarDen=t.sarRatio.height,n.videoCodec=t.codec,n.hasAudio&&n.audioCodec?n.mimeType=`video/mp2t; codecs="${n.videoCodec},${n.audioCodec}"`:n.mimeType=`video/mp2t; codecs="${n.videoCodec}"`},dispatchVideoMediaSegment(){Gr.isInitSegmentDispatched()&&Gr.video_track_.length&&Gr._preDoDecode()},dispatchAudioMediaSegment(){Gr.isInitSegmentDispatched()&&Gr.audio_track_.length&&Gr._preDoDecode()},dispatchAudioVideoMediaSegment(){Gr.isInitSegmentDispatched()&&(Gr.audio_track_.length||Gr.video_track_.length)&&Gr._preDoDecode()},parseADTSAACPayload(e,t){if(Gr.has_video_&&!Gr.video_init_segment_dispatched_)return;if(Gr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+Gr.aac_last_incomplete_data_.byteLength);t.set(Gr.aac_last_incomplete_data_,0),t.set(e,Gr.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/Gr.timescale_),"aac"===Gr.audio_metadata_.codec){if(null==t&&null!=Gr.audio_last_sample_pts_)r=1024/Gr.audio_metadata_.sampling_frequency*1e3,i=Gr.audio_last_sample_pts_+r;else if(null==t)return void ii.debug.warn(Gr.TAG_NAME,"AAC: Unknown pts");if(Gr.aac_last_incomplete_data_&&Gr.audio_last_sample_pts_){r=1024/Gr.audio_metadata_.sampling_frequency*1e3;let e=Gr.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(ii.debug.warn(Gr.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Xt(e),a=null,o=i;for(;null!=(a=s.readNextAACFrame());){r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==Gr.audio_init_segment_dispatched_?(Gr.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},Gr.dispatchAudioInitSegment(e)):Gr.detectAudioMetadataChange(e)&&(Gr.dispatchAudioMediaSegment(),Gr.dispatchAudioInitSegment(e)),n=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:se};Gr.audio_track_.samples.push(s),Gr.audio_track_.length+=i.byteLength,o+=r}s.hasIncompleteData()&&(Gr.aac_last_incomplete_data_=s.getIncompleteData()),n&&(Gr.audio_last_sample_pts_=n)},parseLOASAACPayload(e,t){if(Gr.has_video_&&!Gr.video_init_segment_dispatched_)return;if(Gr.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+Gr.aac_last_incomplete_data_.byteLength);t.set(Gr.aac_last_incomplete_data_,0),t.set(e,Gr.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/Gr.timescale_),"aac"===Gr.audio_metadata_.codec){if(null==t&&null!=Gr.audio_last_sample_pts_)r=1024/Gr.audio_metadata_.sampling_frequency*1e3,i=Gr.audio_last_sample_pts_+r;else if(null==t)return void ii.debug.warn(Gr.TAG_NAME,"AAC: Unknown pts");if(Gr.aac_last_incomplete_data_&&Gr.audio_last_sample_pts_){r=1024/Gr.audio_metadata_.sampling_frequency*1e3;let e=Gr.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(ii.debug.warn(Gr.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,s=new Zt(e),a=null,o=i;for(;null!=(a=s.readNextAACFrame(dr(this.loas_previous_frame)?void 0:this.loas_previous_frame));){Gr.loas_previous_frame=a,r=1024/a.sampling_frequency*1e3;const e={codec:"aac",data:a};0==Gr.audio_init_segment_dispatched_?(Gr.audio_metadata_={codec:"aac",audio_object_type:a.audio_object_type,sampling_freq_index:a.sampling_freq_index,sampling_frequency:a.sampling_frequency,channel_config:a.channel_config},Gr.dispatchAudioInitSegment(e)):Gr.detectAudioMetadataChange(e)&&(Gr.dispatchAudioMediaSegment(),Gr.dispatchAudioInitSegment(e)),n=o;let t=Math.floor(o);const i=new Uint8Array(a.data.length+2);i.set([175,1],0),i.set(a.data,2);let s={payload:i,length:i.byteLength,pts:t,dts:t,type:se};Gr.audio_track_.samples.push(s),Gr.audio_track_.length+=i.byteLength,o+=r}s.hasIncompleteData()&&(Gr.aac_last_incomplete_data_=s.getIncompleteData()),n&&(Gr.audio_last_sample_pts_=n)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if(Gr.has_video_&&!Gr.video_init_segment_dispatched_)return;let r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],n=[11025,12e3,8e3,0],s=e[1]>>>3&3,a=(6&e[1])>>1;e[2];let o=(12&e[2])>>>2,d=3!=(e[3]>>>6&3)?2:1,l=0,c=34;switch(s){case 0:l=n[o];break;case 2:l=i[o];break;case 3:l=r[o]}switch(a){case 1:c=34;break;case 2:c=33;break;case 3:c=32}const u={};u.object_type=c,u.sample_rate=l,u.channel_count=d,u.data=e;const h={codec:"mp3",data:u};0==Gr.audio_init_segment_dispatched_?(Gr.audio_metadata_={codec:"mp3",object_type:c,sample_rate:l,channel_count:d},Gr.dispatchAudioInitSegment(h)):Gr.detectAudioMetadataChange(h)&&(Gr.dispatchAudioMediaSegment(),Gr.dispatchAudioInitSegment(h));let f={payload:e,length:e.byteLength,pts:t/Gr.timescale_,dts:t/Gr.timescale_,type:se};Gr.audio_track_.samples.push(f),Gr.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==Gr.audio_metadata_.codec)return ii.debug.log(Gr.TAG_NAME,`Audio: Audio Codecs changed from ${Gr.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===Gr.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==Gr.audio_metadata_.audio_object_type)return ii.debug.log(Gr.TAG_NAME,`AAC: AudioObjectType changed from ${Gr.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==Gr.audio_metadata_.sampling_freq_index)return ii.debug.log(Gr.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${Gr.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==Gr.audio_metadata_.channel_config)return ii.debug.log(Gr.TAG_NAME,`AAC: Channel configuration changed from ${Gr.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===Gr.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==Gr.audio_metadata_.sampling_frequency)return ii.debug.log(Gr.TAG_NAME,`AC3: Sampling Frequency changed from ${Gr.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==Gr.audio_metadata_.bit_stream_identification)return ii.debug.log(Gr.TAG_NAME,`AC3: Bit Stream Identification changed from ${Gr.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==Gr.audio_metadata_.bit_stream_mode)return ii.debug.log(Gr.TAG_NAME,`AC3: BitStream Mode changed from ${Gr.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==Gr.audio_metadata_.channel_mode)return ii.debug.log(Gr.TAG_NAME,`AC3: Channel Mode changed from ${Gr.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==Gr.audio_metadata_.low_frequency_effects_channel_on)return ii.debug.log(Gr.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${Gr.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===Gr.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==Gr.audio_metadata_.sample_rate)return ii.debug.log(Gr.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${Gr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==Gr.audio_metadata_.channel_count)return ii.debug.log(Gr.TAG_NAME,`Opus: Channel count changed from ${Gr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===Gr.audio_metadata_.codec){const t=e.data;if(t.object_type!==Gr.audio_metadata_.object_type)return ii.debug.log(Gr.TAG_NAME,`MP3: AudioObjectType changed from ${Gr.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==Gr.audio_metadata_.sample_rate)return ii.debug.log(Gr.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${Gr.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==Gr.audio_metadata_.channel_count)return ii.debug.log(Gr.TAG_NAME,`MP3: Channel count changed from ${Gr.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=Gr.audio_track_.id,t.timescale=1e3,t.duration=Gr.duration_,"aac"===Gr.audio_metadata_.codec){let r="aac"===e.codec?e.data:null,i=new $n(r);t.audioSampleRate=i.sampling_rate,t.audioSampleRateIndex=i.sampling_index,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const n=Wt({profile:ii._opt.mseDecodeAudio?i.object_type:i.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});ii.decodeAudio(n,0)}else"ac-3"===Gr.audio_metadata_.codec||"ec-3"===Gr.audio_metadata_.codec||"opus"===Gr.audio_metadata_.codec||"mp3"===Gr.audio_metadata_.codec&&(t.audioSampleRate=Gr.audio_metadata_.sample_rate,t.channelCount=Gr.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==Gr.audio_init_segment_dispatched_&&ii.debug.log(Gr.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),Gr.audio_init_segment_dispatched_=!0,Gr.video_metadata_changed_=!1;let r=Gr.media_info_;r.hasAudio=!0,r.audioCodec=t.originalCodec,r.audioSampleRate=t.audioSampleRate,r.audioChannelCount=t.channelCount,r.hasVideo&&r.videoCodec?r.mimeType=`video/mp2t; codecs="${r.videoCodec},${r.audioCodec}"`:r.mimeType=`video/mp2t; codecs="${r.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,r){},parsePESPrivateDataPayload(e,t,r,i,n){let s=new zn;if(s.pid=i,s.stream_id=n,s.len=e.byteLength,s.data=e,null!=t){let e=Math.floor(t/Gr.timescale_);s.pts=e}else s.nearest_pts=Gr.getNearestTimestampMilliseconds();if(null!=r){let e=Math.floor(r/Gr.timescale_);s.dts=e}},parseTimedID3MetadataPayload(e,t,r,i,n){ii.debug.log(Gr.TAG_NAME,`Timed ID3 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseSynchronousKLVMetadataPayload(e,t,r,i,n){ii.debug.log(Gr.TAG_NAME,`Synchronous KLV Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseAsynchronousKLVMetadataPayload(e,t,r){ii.debug.log(Gr.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${r}`)},parseSMPTE2038MetadataPayload(e,t,r,i,n){ii.debug.log(Gr.TAG_NAME,`SMPTE 2038 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},getNearestTimestampMilliseconds:()=>null!=Gr.audio_last_sample_pts_?Math.floor(Gr.audio_last_sample_pts_):null!=Gr.last_pcr_?Math.floor(Gr.last_pcr_/300/Gr.timescale_):void 0,_preDoDecode(){const e=Gr.video_track_,t=Gr.audio_track_;let r=e.samples;t.samples.length>0&&(r=e.samples.concat(t.samples),r=r.sort(((e,t)=>e.dts-t.dts))),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===ae?Gr._doDecodeVideo({...e,payload:t}):e.type===se&&Gr._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let r=null;r=e.isHevc?Kr(t,e.isIFrame):Ir(t,e.isIFrame),e.isIFrame&&ii.calcIframeIntervalTimestamp(e.dts);let i=ii.cryptoPayload(r,e.isIFrame);ii.decode(i,{type:ae,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let r=t;yr(ii._opt.m7sCryptoAudio)&&(r=ii.cryptoPayloadAudio(t)),ii.decode(r,{type:se,ts:e.dts,isIFrame:!1,cts:0})}},jr=null;br()&&(jr={TAG_NAME:"worker MediaSource",_resetInIt(){jr.isAvc=null,jr.isAAC=null,jr.videoInfo={},jr.videoMeta={},jr.audioMeta={},jr.sourceBuffer=null,jr.audioSourceBuffer=null,jr.hasInit=!1,jr.hasAudioInit=!1,jr.isAudioInitInfo=!1,jr.videoMimeType="",jr.audioMimeType="",jr.cacheTrack={},jr.cacheAudioTrack={},jr.timeInit=!1,jr.sequenceNumber=0,jr.audioSequenceNumber=0,jr.firstRenderTime=null,jr.firstAudioTime=null,jr.mediaSourceAppendBufferFull=!1,jr.mediaSourceAppendBufferError=!1,jr.mediaSourceAddSourceBufferError=!1,jr.mediaSourceBufferError=!1,jr.mediaSourceError=!1,jr.prevTimestamp=null,jr.decodeDiffTimestamp=null,jr.prevDts=null,jr.prevAudioDts=null,jr.prevPayloadBufferSize=0,jr.isWidthOrHeightChanged=!1,jr.prevTs=null,jr.prevAudioTs=null,jr.eventListenList=[],jr.pendingRemoveRanges=[],jr.pendingSegments=[],jr.pendingAudioRemoveRanges=[],jr.pendingAudioSegments=[],jr.supportVideoFrameCallbackHandle=null,jr.audioSourceBufferCheckTimeout=null,jr.audioSourceNoDataCheckTimeout=null,jr.hasPendingEos=!1,jr.$video={currentTime:0,readyState:0}},init(){jr.events=new pn,jr._resetInIt(),jr.mediaSource=new self.MediaSource,jr.isDecodeFirstIIframe=!!vr(ii._opt.checkFirstIFrame),jr._bindMediaSourceEvents()},destroy(){jr.stop(),jr._clearAudioSourceBufferCheckTimeout(),jr.eventListenList&&jr.eventListenList.length&&(jr.eventListenList.forEach((e=>e())),jr.eventListenList=[]),jr._resetInIt(),jr.mediaSource=null},getState:()=>jr.mediaSource&&jr.mediaSource.readyState,isStateOpen:()=>jr.getState()===yt,isStateClosed:()=>jr.getState()===vt,isStateEnded:()=>jr.getState()===gt,_bindMediaSourceEvents(){const{proxy:e}=jr.events,t=e(jr.mediaSource,wt,(()=>{ii.debug.log(jr.TAG_NAME,"sourceOpen"),jr._onMediaSourceSourceOpen()})),r=e(jr.mediaSource,bt,(()=>{ii.debug.log(jr.TAG_NAME,"sourceClose")})),i=e(jr.mediaSource,St,(()=>{ii.debug.log(jr.TAG_NAME,"sourceended")}));jr.eventListenList.push(t,r,i)},_onMediaSourceSourceOpen(){jr.sourceBuffer||(ii.debug.log(jr.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),jr._initSourceBuffer()),jr.audioSourceBuffer||(ii.debug.log(jr.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),jr._initAudioSourceBuffer()),jr._hasPendingSegments()&&jr._doAppendSegments()},decodeVideo(e,t,r,i){if(ii.isDestroyed)ii.debug.warn(jr.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(vr(jr.hasInit))if(r&&e[1]===xt){const i=15&e[0];if(i===Fe&&vr(or()))return void jr.emitError(De.mediaSourceH265NotSupport);jr.videoInfo.codec=i,postMessage({cmd:R,code:i});const n=new Uint8Array(e);postMessage({cmd:M,buffer:n,codecId:i},[n.buffer]),jr.hasInit=jr._decodeConfigurationRecord(e,t,r,i)}else ii.debug.warn(jr.TAG_NAME,`decodeVideo has not init , isIframe is ${r} , payload is ${e[1]}`);else if(!jr.isDecodeFirstIIframe&&r&&(jr.isDecodeFirstIIframe=!0),jr.isDecodeFirstIIframe){if(r&&0===e[1]){const t=15&e[0];let r={};t===Ie?r=kr(e.slice(5)):t===Fe&&(r=Vr(e));const i=jr.videoInfo;i&&i.codecWidth&&i.codecWidth&&r&&r.codecWidth&&r.codecHeight&&(r.codecWidth!==i.codecWidth||r.codecHeight!==i.codecWidth)&&(ii.debug.warn(jr.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${i.codecWidth}, old height is ${i.codecWidth},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),jr.isWidthOrHeightChanged=!0,jr.emitError(De.mseWidthOrHeightChange))}if(jr.isWidthOrHeightChanged)return void ii.debug.warn(jr.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(gr(e))return void ii.debug.warn(jr.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength300&&(jr.firstAudioTime-=e,ii.debug.warn(jr.TAG_NAME,`video\n firstAudioTime is ${jr.firstRenderTime} and current time is ${jr.prevTs}\n play time is ${e} and firstAudioTime ${t} - ${e} = ${jr.firstAudioTime}`))}r=t-jr.firstAudioTime,r<0&&(ii.debug.warn(jr.TAG_NAME,`decodeAudio\n local dts is < 0 , ts is ${t} and prevTs is ${jr.prevAudioTs},\n firstAudioTime is ${jr.firstAudioTime}`),r=null===jr.prevAudioDts?0:jr.prevAudioDts+ii._opt.mseCorrectAudioTimeDuration),null!==jr.prevAudioTs&&r<=jr.prevAudioDts&&(ii.debug.warn(jr.TAG_NAME,`\n decodeAudio dts is less than(or equal) prev dts ,\n dts is ${r} and prev dts is ${jr.prevAudioDts} ,\n and now ts is ${t} and prev ts is ${jr.prevAudioTs} ,\n and diff is ${t-jr.prevAudioTs}`),r=jr.prevAudioDts+ii._opt.mseCorrectAudioTimeDuration)}ii.isPlayer?jr._decodeAudio(e,r,t):ii.isPlayback,jr.prevAudioTs=t,jr.prevAudioDts=r}else ii.debug.log(jr.TAG_NAME,"decodeAudio first frame is not iFrame")}},_checkTsIsMaxDiff:e=>jr.prevTs>0&&eA,_decodeConfigurationRecord(e,t,r,i){let n=e.slice(5),s={};if(i===Ie?s=kr(n):i===Fe&&(s=Wr(n)),jr.videoInfo.width=s.codecWidth,jr.videoInfo.height=s.codecHeight,0===s.codecWidth&&0===s.codecHeight)return ii.debug.warn(jr.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(s)),jr.emitError(De.mediaSourceDecoderConfigurationError),!1;const a={id:Pt,type:"video",timescale:1e3,duration:0,avcc:n,codecWidth:s.codecWidth,codecHeight:s.codecHeight,videoType:s.videoType},o=mn.generateInitSegment(a);jr.isAvc=i===Ie;let d=s.codec;return jr.videoMimeType=d?`video/mp4; codecs="${s.codec}"`:jr.isAvc?ut:ht,postMessage({cmd:k,w:s.codecWidth,h:s.codecHeight}),jr._initSourceBuffer(),jr.appendBuffer(o.buffer),jr.sequenceNumber=0,jr.cacheTrack={},jr.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const r=e[0]>>4,i=e[0]>>1&1,n=r===$e,s=r===ze;if(vr(s||n))return ii.debug.warn(jr.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${r} ant auto wasm decode`),jr.emitError(De.mediaSourceAudioG711NotSupport),!1;const a={id:It,type:"audio",timescale:1e3};let o={};if(jt(e)){if(o=Kt(e.slice(2)),!o)return!1;a.audioSampleRate=o.sampleRate,a.channelCount=o.channelCount,a.config=o.config,a.refSampleDuration=1024/a.audioSampleRate*a.timescale}else{if(!n)return!1;if(o=An(e),!o)return!1;a.audioSampleRate=o.samplingRate,a.channelCount=o.channelCount,a.refSampleDuration=1152/a.audioSampleRate*a.timescale}a.codec=o.codec,a.duration=0;let d="mp4",l=o.codec,c=null;n&&vr(ar())?(d="mpeg",l="",c=new Uint8Array):c=mn.generateInitSegment(a);let u=`${a.type}/${d}`;return l&&l.length>0&&(u+=`;codecs=${l}`),vr(jr.isAudioInitInfo)&&(Jt=r===ze?i?16:8:0===i?8:16,postMessage({cmd:I,code:r}),postMessage({cmd:P,sampleRate:a.audioSampleRate,channels:a.channelCount,depth:Jt}),jr.isAudioInitInfo=!0),jr.audioMimeType=u,jr.isAAC=s,jr._initAudioSourceBuffer(),jr.appendAudioBuffer(c.buffer),!0},_initSourceBuffer(){const{proxy:e}=jr.events;if(null===jr.sourceBuffer&&null!==jr.mediaSource&&jr.isStateOpen()&&jr.videoMimeType){try{jr.sourceBuffer=jr.mediaSource.addSourceBuffer(jr.videoMimeType),ii.debug.log(jr.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",jr.videoMimeType)}catch(e){return ii.debug.error(jr.TAG_NAME,"appendBuffer() mseDecoder.mediaSource.addSourceBuffer()",e.code,e),jr.emitError(De.mseAddSourceBufferError,e.code),void(jr.mediaSourceAddSourceBufferError=!0)}if(jr.sourceBuffer){const t=e(jr.sourceBuffer,"error",(e=>{jr.mediaSourceBufferError=!0,ii.debug.error(jr.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e),jr.emitError(De.mseSourceBufferError,e.code)})),r=e(jr.sourceBuffer,"updateend",(()=>{jr._hasPendingRemoveRanges()?jr._doRemoveRanges():jr._hasPendingSegments()?jr._doAppendSegments():jr.hasPendingEos&&(ii.debug.log(jr.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),jr.endOfStream())}));jr.eventListenList.push(t,r)}}else ii.debug.log(jr.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${jr.isStateOpen()} and mseDecoder.isAvc === null is ${null===jr.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=jr.events;if(null===jr.audioSourceBuffer&&null!==jr.mediaSource&&jr.isStateOpen()&&jr.audioMimeType){try{jr.audioSourceBuffer=jr.mediaSource.addSourceBuffer(jr.audioMimeType),jr._clearAudioSourceBufferCheckTimeout(),ii.debug.log(jr.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",jr.audioMimeType)}catch(e){return ii.debug.error(jr.TAG_NAME,"appendAudioBuffer() mseDecoder.mediaSource.addSourceBuffer()",e.code,e),jr.emitError(De.mseAddSourceBufferError,e.code),void(jr.mediaSourceAddSourceBufferError=!0)}if(jr.audioSourceBuffer){const t=e(jr.audioSourceBuffer,"error",(e=>{jr.mediaSourceBufferError=!0,ii.debug.error(jr.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e),jr.emitError(De.mseSourceBufferError,e.code)})),r=e(jr.audioSourceBuffer,"updateend",(()=>{jr._hasPendingRemoveRanges()?jr._doRemoveRanges():jr._hasPendingSegments()?jr._doAppendSegments():jr.hasPendingEos&&(ii.debug.log(jr.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),jr.endOfStream())}));jr.eventListenList.push(t,r),null===jr.audioSourceNoDataCheckTimeout&&(jr.audioSourceNoDataCheckTimeout=setTimeout((()=>{jr._clearAudioNoDataCheckTimeout(),jr.emitError(De.mediaSourceAudioNoDataTimeout)}),1e3))}}else ii.debug.log(jr.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${jr.isStateOpen()} and mseDecoder.audioMimeType is ${jr.audioMimeType}`)},_decodeVideo(e,t,r,i,n){let s=e.slice(5),a=s.byteLength;if(0===a)return void ii.debug.warn(jr.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let o=(new Date).getTime(),d=!1;jr.prevTimestamp||(jr.prevTimestamp=o,d=!0);const l=o-jr.prevTimestamp;if(jr.decodeDiffTimestamp=l,l>500&&!d&&ii.isPlayer&&ii.debug.warn(jr.TAG_NAME,`_decodeVideo now time is ${o} and prev time is ${jr.prevTimestamp}, diff time is ${l} ms`),jr.cacheTrack.id&&t>=jr.cacheTrack.dts){let e=8+jr.cacheTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(mn.types.mdat,4),r.set(jr.cacheTrack.data,8),jr.cacheTrack.duration=t-jr.cacheTrack.dts;let i=mn.moof(jr.cacheTrack,jr.cacheTrack.dts);jr.cacheTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),jr.appendBuffer(n.buffer)}else ii.debug.log(jr.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${n} cacheTrack dts is ${jr.cacheTrack&&jr.cacheTrack.dts}`),jr.timeInit=!1,jr.cacheTrack={};jr.cacheTrack||(jr.cacheTrack={}),jr.cacheTrack.id=Pt,jr.cacheTrack.sequenceNumber=++jr.sequenceNumber,jr.cacheTrack.size=a,jr.cacheTrack.dts=t,jr.cacheTrack.cts=i,jr.cacheTrack.isKeyframe=r,jr.cacheTrack.data=s,jr.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},jr.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,r){let i=jr.isAAC?e.slice(2):e.slice(1),n=i.byteLength;if(jr.cacheAudioTrack.id&&t>=jr.cacheAudioTrack.dts){let e=8+jr.cacheAudioTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(mn.types.mdat,4),r.set(jr.cacheAudioTrack.data,8),jr.cacheAudioTrack.duration=t-jr.cacheAudioTrack.dts;let i=mn.moof(jr.cacheAudioTrack,jr.cacheAudioTrack.dts);jr.cacheAudioTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),jr.appendAudioBuffer(n.buffer)}else jr.cacheAudioTrack={};jr.cacheAudioTrack||(jr.cacheAudioTrack={}),jr.cacheAudioTrack.id=It,jr.cacheAudioTrack.sequenceNumber=++jr.audioSequenceNumber,jr.cacheAudioTrack.size=n,jr.cacheAudioTrack.dts=t,jr.cacheAudioTrack.cts=0,jr.cacheAudioTrack.data=i,jr.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){ii.isDestroyed?ii.debug.warn(jr.TAG_NAME,"appendBuffer() player is destroyed"):jr.mediaSourceAddSourceBufferError?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):jr.mediaSourceAppendBufferFull?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):jr.mediaSourceAppendBufferError?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):jr.mediaSourceBufferError?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(jr.pendingSegments.push(e),jr.sourceBuffer&&(ii._opt.mseAutoCleanupSourceBuffer&&jr._needCleanupSourceBuffer()&&jr._doCleanUpSourceBuffer(),vr(jr.getSourceBufferUpdating())&&jr.isStateOpen()&&vr(jr._hasPendingRemoveRanges()))?jr._doAppendSegments():jr.isStateClosed()?(jr.mediaSourceBufferError=!0,jr.emitError(De.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):jr.isStateEnded()?(jr.mediaSourceBufferError=!0,jr.emitError(De.mseSourceBufferError,"mediaSource is end")):jr._hasPendingRemoveRanges()&&ii.debug.log(jr.TAG_NAME,`video has pending remove ranges and video length is ${jr.pendingRemoveRanges.length}, audio length is ${jr.pendingAudioRemoveRanges.length}`))},appendAudioBuffer(e){ii.isDestroyed?ii.debug.warn(jr.TAG_NAME,"appendAudioBuffer() player is destroyed"):jr.mediaSourceAddSourceBufferError?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):jr.mediaSourceAppendBufferFull?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):jr.mediaSourceAppendBufferError?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):jr.mediaSourceBufferError?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(jr.pendingAudioSegments.push(e),jr.audioSourceBuffer&&(ii._opt.mseAutoCleanupSourceBuffer&&jr._needCleanupSourceBuffer()&&jr._doCleanUpSourceBuffer(),vr(jr.getAudioSourceBufferUpdating())&&jr.isStateOpen()&&vr(jr._hasPendingRemoveRanges()))?jr._doAppendSegments():jr.isStateClosed()?(jr.mediaSourceBufferError=!0,jr.emitError(De.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):jr.isStateEnded()?(jr.mediaSourceBufferError=!0,jr.emitError(De.mseSourceBufferError,"mediaSource is end")):jr._hasPendingRemoveRanges()&&ii.debug.log(jr.TAG_NAME,`audio has pending remove ranges and video length is ${jr.pendingRemoveRanges.length}, audio length is ${jr.pendingAudioRemoveRanges.length}`))},getSourceBufferUpdating:()=>jr.sourceBuffer&&jr.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>jr.audioSourceBuffer&&jr.audioSourceBuffer.updating,stop(){jr.abortSourceBuffer(),jr.removeSourceBuffer(),jr.endOfStream()},clearUpAllSourceBuffer(){if(jr.sourceBuffer){const e=jr.sourceBuffer.buffered;for(let t=0;tjr.pendingSegments.length>0||jr.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>jr.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(jr.isStateClosed()||jr.isStateEnded())ii.debug.log(jr.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==jr.sourceBuffer){if(jr.needInitAudio()&&null===jr.audioSourceBuffer)return ii.debug.log(jr.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===jr.audioSourceBufferCheckTimeout&&(jr.audioSourceBufferCheckTimeout=setTimeout((()=>{jr._clearAudioSourceBufferCheckTimeout(),jr.emitError(De.mediaSourceAudioInitTimeout)}),1e3)));if(vr(jr.getSourceBufferUpdating())&&jr.pendingSegments.length>0){const e=jr.pendingSegments.shift();try{jr.sourceBuffer.appendBuffer(e)}catch(e){ii.debug.error(jr.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(jr.stop(),jr.mediaSourceAppendBufferFull=!0,jr.emitError(De.mediaSourceFull)):11===e.code?(jr.stop(),jr.mediaSourceAppendBufferError=!0,jr.emitError(De.mediaSourceAppendBufferError)):(jr.stop(),jr.mediaSourceBufferError=!0,jr.emitError(De.mseSourceBufferError,e.code))}}if(vr(jr.getAudioSourceBufferUpdating())&&jr.pendingAudioSegments.length>0){const e=jr.pendingAudioSegments.shift();try{jr.audioSourceBuffer.appendBuffer(e)}catch(e){ii.debug.error(jr.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(jr.stop(),jr.mediaSourceAppendBufferFull=!0,jr.emitError(De.mediaSourceFull)):11===e.code?(jr.stop(),jr.mediaSourceAppendBufferError=!0,jr.emitError(De.mediaSourceAppendBufferError)):(jr.stop(),jr.mediaSourceBufferError=!0,jr.emitError(De.mseSourceBufferError,e.code))}}}else ii.debug.log(jr.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=jr.$video.currentTime;if(jr.sourceBuffer){const t=jr.sourceBuffer.buffered;let r=!1;for(let i=0;i=ii._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-ii._opt.mseAutoCleanupMinBackwardDuration;jr.pendingRemoveRanges.push({start:n,end:t})}}else s=ii._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-ii._opt.mseAutoCleanupMinBackwardDuration;jr.pendingAudioRemoveRanges.push({start:n,end:t})}}else sjr.pendingRemoveRanges.length>0||jr.pendingAudioRemoveRanges.length>0,needInitAudio:()=>ii._opt.hasAudio&&ii._opt.mseDecodeAudio,_doRemoveRanges(){if(jr.sourceBuffer&&vr(jr.getSourceBufferUpdating())){let e=jr.pendingRemoveRanges;for(;e.length&&vr(jr.getSourceBufferUpdating());){let t=e.shift();try{jr.sourceBuffer.remove(t.start,t.end)}catch(e){ii.debug.warn(jr.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e)}}}if(jr.audioSourceBuffer&&vr(jr.getAudioSourceBufferUpdating())){let e=jr.pendingAudioRemoveRanges;for(;e.length&&vr(jr.getAudioSourceBufferUpdating());){let t=e.shift();try{jr.audioSourceBuffer.remove(t.start,t.end)}catch(e){ii.debug.warn(jr.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e)}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(vr(ii._opt.mseAutoCleanupSourceBuffer))return!1;const e=jr.$video.currentTime;if(jr.sourceBuffer){let t=jr.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ii._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(jr.audioSourceBuffer){let t=jr.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ii._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){jr.audioSourceBufferCheckTimeout&&(clearTimeout(jr.audioSourceBufferCheckTimeout),jr.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){jr.audioSourceNoDataCheckTimeout&&(clearTimeout(jr.audioSourceNoDataCheckTimeout),jr.audioSourceNoDataCheckTimeout=null)},getHandle:()=>jr.mediaSource.handle,emitError(e){postMessage({cmd:ne,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let ii={isPlayer:!0,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:kt,_opt:Sr(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){ii.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:ii.getVideoBufferLength(),audioDemuxBufferDelay:ii.getAudioBufferLength(),streamBufferByteLength:ii.getStreamBufferLength(),netBuf:ii.networkDelay||0,pushLatestDelay:ii.pushLatestDelay||0,latestDelay:ii.delay,isStreamTsMoreThanLocal:be});postMessage({cmd:$,type:Te,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return ii._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||ii._opt.hasVideo&&!U)return-1;if(t===se)return ii.delay;if(ii.preDelayTimestamp&&ii.preDelayTimestamp>e)return ii.preDelayTimestamp-e>1e3&&ii.debug.warn("worker",`getDelay() and preDelayTimestamp is ${ii.preDelayTimestamp} > timestamp is ${e} more than ${ii.preDelayTimestamp-e}ms and return ${ii.delay}`),ii.preDelayTimestamp=e,ii.delay;if(ii.firstTimestamp){if(e){const t=Date.now()-ii.startTimestamp,r=e-ii.firstTimestamp;t>=r?(be=!1,ii.delay=t-r):(be=!0,ii.delay=r-t)}}else ii.firstTimestamp=e,ii.startTimestamp=Date.now(),ii.delay=-1;return ii.preDelayTimestamp=e,ii.delay},getDelayNotUpdateDelay:function(e,t){if(!e||ii._opt.hasVideo&&!U)return-1;if(t===se)return ii.pushLatestDelay;if(ii.preDelayTimestamp&&ii.preDelayTimestamp-e>1e3)return ii.debug.warn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${ii.preDelayTimestamp} > timestamp is ${e} more than ${ii.preDelayTimestamp-e}ms and return -1`),-1;if(ii.firstTimestamp){let t=-1;if(e){const r=Date.now()-ii.startTimestamp,i=e-ii.firstTimestamp;r>=i?(be=!1,t=r-i):(be=!0,t=i-r)}return t}return-1},resetDelay:function(){ii.firstTimestamp=null,ii.startTimestamp=null,ii.delay=-1,ii.dropping=!1},resetAllDelay:function(){ii.resetDelay(),ii.preDelayTimestamp=null},doDecode:function(e){ii._opt.isEmitSEI&&e.type===ae&&ii.isWorkerFetch&&ii.findSei(e.payload,e.ts),ii.isPlayUseMSEAndDecoderInWorker()?e.type===se?ii._opt.mseDecodeAudio?jr.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===ae&&jr.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):ii._opt.useWCS&&ii.useOffscreen()&&e.type===ae&&s.decode?s.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===i.length)return;const t=e.ts,n=i[0],s=e.type===ae&&gr(e.payload);if(vr(r))s&&(ii.debug.log("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n isVideoSqeHeader is ${s}`),i.shift(),ii.doDecode(n));else{const r=n.ts-t,a=n.type===se&&e.type===ae;(r<=20||a||s)&&(ii.debug.log("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n diff is ${r} and isVideoAndNextAudio is ${a} and isVideoSqeHeader is ${s}`),i.shift(),ii.doDecode(n))}},init:function(){ii.debug.log("worker","init and opt is",JSON.stringify(ii._opt));const e=ii._opt.playType===v,t=ii._opt.playType===b;if(Ar.init(),ii.isPlayer=e,ii.isPlayback=t,ii.isPlayUseMSEAndDecoderInWorker()&&jr&&jr.init(),ii.isPlaybackCacheBeforeDecodeForFpsRender())ii.debug.log("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");else{ii.debug.log("worker","setInterval()");const t=ii._opt.videoBuffer+ii._opt.videoBufferDelay,r=()=>{let r=null;if(i.length){if(ii.isPushDropping)return void ii.debug.warn("worker",`loop() isPushDropping is true and bufferList length is ${i.length}`);if(ii.dropping){for(r=i.shift(),ii.debug.warn("worker",`loop() dropBuffer is dropping and isIFrame ${r.isIFrame} and delay is ${ii.delay} and bufferlist is ${i.length}`);!r.isIFrame&&i.length;)r=i.shift();const e=ii.getDelayNotUpdateDelay(r.ts,r.type);r.isIFrame&&e<=ii.getNotDroppingDelayTs()&&(ii.debug.log("worker","loop() is dropping = false, is iFrame"),ii.dropping=!1,ii.doDecode(r),ii.decodeNext(r))}else if(ii.isPlayback||ii.isPlayUseMSE()||0===ii._opt.videoBuffer)for(;i.length;)r=i.shift(),ii.doDecode(r);else if(r=i[0],-1===ii.getDelay(r.ts,r.type))ii.debug.log("worker","loop() common dumex delay is -1 ,data.ts is",r.ts),i.shift(),ii.doDecode(r),ii.decodeNext(r);else if(ii.delay>t&&e)ii.hasIframeInBufferList()?(ii.debug.log("worker",`delay is ${ii.delay} > maxDelay ${t}, set dropping is true`),ii.resetAllDelay(),ii.dropping=!0,postMessage({cmd:H})):(i.shift(),ii.doDecode(r),ii.decodeNext(r));else for(;i.length;){if(r=i[0],!(ii.getDelay(r.ts,r.type)>ii._opt.videoBuffer)){ii.delay<0&&ii.debug.warn("worker",`loop() do not decode and delay is ${ii.delay}, bufferList is ${i.length}`);break}i.shift(),ii.doDecode(r)}}else-1!==ii.delay&&ii.debug.log("worker","loop() bufferList is empty and reset delay"),ii.resetAllDelay()};ii.stopId=setInterval((()=>{let e=(new Date).getTime();we||(we=e);const t=e-we;t>100&&ii.debug.warn("worker",`loop demux diff time is ${t}`),r(),we=(new Date).getTime()}),20)}if(vr(ii._opt.checkFirstIFrame)&&(U=!0),ii.isPlayUseMSEAndDecoderInWorker()&&jr){const e=jr.getHandle();e&&postMessage({cmd:re,mseHandle:e},[e])}},playbackCacheLoop:function(){ii.stopId&&(clearInterval(ii.stopId),ii.stopId=null);const e=()=>{let e=null;i.length&&(e=i.shift(),ii.doDecode(e))};e();const t=Math.ceil(1e3/(ii.streamFps*ii._opt.playbackRate));ii.debug.log("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${ii.streamFps}, streamAudioFps is ${ii.streamAudioFps} ,streamVideoFps is ${ii.streamVideoFps} playbackRate is ${ii._opt.playbackRate}`),ii.stopId=setInterval(e,t)},close:function(){if(ii.debug.log("worker","close"),ii.isDestroyed=!0,Er(),!o||1!==o.readyState&&2!==o.readyState?o&&ii.debug.log("worker",`close() and socket.readyState is ${o.readyState}`):(nr=!0,o.close(1e3,"Client disconnecting")),o=null,ii.stopStreamRateAndStatsInterval(),ii.stopId&&(clearInterval(ii.stopId),ii.stopId=null),ii.mp3Demuxer&&(ii.mp3Demuxer.destroy(),ii.mp3Demuxer=null),ii.writableStream&&vr(ii.writableStream.locked)&&ii.writableStream.close().catch((e=>{ii.debug.log("worker","close() and writableStream.close() error",e)})),ii.writableStream=null,ni)try{ni.clear&&ni.clear(),ni=null}catch(e){ii.debug.warn("worker","close() and audioDecoder.clear error",e)}if(si)try{si.clear&&si.clear(),si=null}catch(e){ii.debug.warn("worker","close() and videoDecoder.clear error",e)}d=null,we=null,be=!1,s&&(s.reset&&s.reset(),s=null),jr&&(jr.destroy(),jr=null),ii.firstTimestamp=null,ii.startTimestamp=null,ii.networkDelay=0,ii.streamFps=null,ii.streamAudioFps=null,ii.streamVideoFps=null,ii.delay=-1,ii.pushLatestDelay=-1,ii.preDelayTimestamp=null,ii.dropping=!1,ii.isPushDropping=!1,ii.isPlayer=!0,ii.isPlayback=!1,ii.isWorkerFetch=!1,ii._opt=Sr(),ii.webglObj&&(ii.webglObj.destroy(),ii.offscreenCanvas.removeEventListener("webglcontextlost",ii.onOffscreenCanvasWebglContextLost),ii.offscreenCanvas.removeEventListener("webglcontextrestored",ii.onOffscreenCanvasWebglContextRestored),ii.offscreenCanvas=null,ii.offscreenCanvasGL=null,ii.offscreenCanvasCtx=null),i=[],n=[],c&&(c.buffer=null,c=null),h=null,f=null,S=!1,E=!1,U=!1,Ot=!1,$t=!1,Gt=!1,Ht=null,Yt=null,at=[],mt=0,_t=0,Ve=null,Xe=null,Et=null,At=null,Jt=null,Ut=0,Nt=0,ft=null,pt=null,ii.fetchStatus=kt,wr=!0,Ar.destroy(),Tr.destroy(),$r.destroy(),Gr.destroy(),postMessage({cmd:Y})},pushBuffer:function(e,t){if(t.type===se&&jt(e)){if(ii.debug.log("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),ii._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:J,buffer:t},[t.buffer])}ii.decodeAudio(e,t.ts)}else if(t.type===ae&&t.isIFrame&&gr(e)){if(ii.debug.log("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),ii._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Q,buffer:t},[t.buffer])}ii.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(ii._opt.isRecording)if(ii._opt.isRecordTypeFlv){const r=new Uint8Array(e);postMessage({cmd:ee,type:t.type,buffer:r,ts:t.ts},[r.buffer])}else if(ii._opt.recordType===w)if(t.type===ae){const r=new Uint8Array(e).slice(5);postMessage({cmd:z,buffer:r,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[r.buffer])}else if(t.type===se&&ii._opt.isWasmMp4){const r=new Uint8Array(e),i=qt(r)?r.slice(2):r.slice(1);postMessage({cmd:F,buffer:i,ts:t.ts},[i.buffer])}if(ii.isPlayer&&Ut>0&&At>0&&t.type===ae){const e=t.ts-At,r=Ut+Ut/2;e>r&&ii.debug.log("worker",`pushBuffer video\n ts is ${t.ts}, preTimestamp is ${At},\n diff is ${e} and preTimestampDuration is ${Ut} and maxDiff is ${r}\n maybe trigger black screen or flower screen\n `)}if(ii.isPlayer&&At>0&&t.type===ae&&t.tsA&&(ii.debug.warn("worker",`pushBuffer,\n preTimestamp is ${At}, options.ts is ${t.ts},\n diff is ${At-t.ts} more than 3600000,\n and resetAllDelay`),ii.resetAllDelay(),At=null,Ut=0),ii.isPlayer&&At>0&&t.ts<=At&&t.type===ae&&(ii.debug.warn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTimestamp is ${At} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Nt}`),ii._opt.isDropSameTimestampGop&&vr(t.isIFrame)&&U)){const e=ii.hasIframeInBufferList(),t=vr(ii.isPushDropping);return ii.debug.log("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?ii.dropBuffer$2():(ii.clearBuffer(!0),yr(ii._opt.checkFirstIFrame)&&yr(r)&&(ii.isPlayUseMSEAndDecoderInWorker()?jr.isDecodeFirstIIframe=!1:postMessage({cmd:te}))))}if(ii.isPlayer&&U){const e=ii._opt.videoBuffer+ii._opt.videoBufferDelay,r=ii.getDelayNotUpdateDelay(t.ts,t.type);ii.pushLatestDelay=r,r>e&&ii.delay0&&ii.hasIframeInBufferList()&&!1===ii.isPushDropping&&(ii.debug.log("worker",`pushBuffer(), pushLatestDelay is ${r} more than ${e} and decoder.delay is ${ii.delay} and has iIframe and next decoder.dropBuffer$2()`),ii.dropBuffer$2())}if(ii.isPlayer&&t.type===ae&&(At>0&&(Ut=t.ts-At),Nt=e.byteLength,At=t.ts),t.type===se?i.push({ts:t.ts,payload:e,decoder:{decode:ii.decodeAudio},type:se,isIFrame:!1}):t.type===ae&&i.push({ts:t.ts,cts:t.cts,payload:e,decoder:{decode:ii.decodeVideo},type:ae,isIFrame:t.isIFrame}),ii.isPlaybackCacheBeforeDecodeForFpsRender()&&(dr(ii.streamVideoFps)||dr(ii.streamAudioFps))){let e=ii.streamVideoFps,t=ii.streamAudioFps;if(dr(ii.streamVideoFps)&&(e=pr(i,ae),e&&(ii.streamVideoFps=e,postMessage({cmd:V,value:ii.streamVideoFps}),ii.streamFps=t?e+t:e,vr(ii._opt.hasAudio)&&(ii.debug.log("worker","playbackCacheBeforeDecodeForFpsRender, _opt.hasAudio is false and set streamAudioFps is 0"),ii.streamAudioFps=0),ii.playbackCacheLoop())),dr(ii.streamAudioFps)&&(t=pr(i,se),t&&(ii.streamAudioFps=t,ii.streamFps=e?e+t:t,ii.playbackCacheLoop())),dr(ii.streamVideoFps)&&dr(ii.streamAudioFps)){const r=i.map((e=>({type:e.type,ts:e.ts})));ii.debug.log("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${i.length}, and ts list is ${JSON.stringify(r)}`)}const r=ii.getAudioBufferLength()>0,n=r?60:40;i.length>=n&&(ii.debug.warn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${i.length} more than ${n}, and hasAudio is ${r} an set streamFps is 25`),ii.streamVideoFps=25,postMessage({cmd:V,value:ii.streamVideoFps}),r?(ii.streamAudioFps=25,ii.streamFps=ii.streamVideoFps+ii.streamAudioFps):ii.streamFps=ii.streamVideoFps,ii.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return i.forEach((t=>{t.type===ae&&(e+=1)})),e},hasIframeInBufferList:()=>i.some((e=>e.type===ae&&e.isIFrame)),isAllIframeInBufferList(){const e=ii.getVideoBufferLength();let t=0;return i.forEach((e=>{e.type===ae&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>ii._opt.videoBuffer+ii._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return i.forEach((t=>{t.type===se&&(e+=1)})),e},getStreamBufferLength(){let e=0;return c&&c.buffer&&(e=c.buffer.byteLength),ii._opt.isNakedFlow?Ar.lastBuf&&(e=Ar.lastBuf.byteLength):ii._opt.isTs?Gr._remainingPacketData&&(e=Gr._remainingPacketData.byteLength):ii._opt.isFmp4&&Tr.mp4Box&&(e=Tr.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){ii.debug.log("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),ii.isWorkerFetch=!0,t.isFlv?ii._opt.isFlv=!0:t.isFmp4?ii._opt.isFmp4=!0:t.isMpeg4?ii._opt.isMpeg4=!0:t.isNakedFlow?ii._opt.isNakedFlow=!0:t.isTs&&(ii._opt.isTs=!0),d=sr((e=>{postMessage({cmd:$,type:Ee,value:e})})),ii.startStreamRateAndStatsInterval(),t.isFmp4&&(Tr.listenMp4Box(),ii._opt.isFmp4Private&&Tr.initTransportDescarmber()),t.protocol===_?(c=new Br(ii.demuxFlv()),fetch(e,{signal:a.signal}).then((e=>{if(yr(nr))return ii.debug.log("worker","request abort and run res.body.cancel()"),ii.fetchStatus=kt,void e.body.cancel();if(!mr(e))return ii.debug.warn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),Er(),void postMessage({cmd:$,type:De.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:$,type:Ue}),hr())ii.writableStream=new WritableStream({write:e=>a&&a.signal&&a.signal.aborted?(ii.debug.log("worker","writableStream write() and abortController.signal.aborted is true so return"),void(ii.fetchStatus=Dt)):yr(nr)?(ii.debug.log("worker","writableStream write() and requestAbort is true so return"),void(ii.fetchStatus=Dt)):void("string"!=typeof e?(ii.fetchStatus=Ct,d(e.byteLength),t.isFlv?c.write(e):t.isFmp4?ii.demuxFmp4(e):t.isMpeg4?ii.demuxMpeg4(e):t.isTs&&ii.demuxTs(e)):ii.debug.warn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{ii.debug.log("worker","writableStream close()"),ii.fetchStatus=Dt,c=null,Er(),postMessage({cmd:$,type:Se,value:g,msg:"fetch done"})},abort:e=>{if(a&&a.signal&&a.signal.aborted)return ii.debug.log("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(ii.fetchStatus=Dt);c=null,e.name!==Bt?(ii.debug.log("worker",`writableStream abort() and e is ${e.toString()}`),Er(),postMessage({cmd:$,type:De.fetchError,value:e.toString()})):ii.debug.log("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(ii.writableStream);else{const r=e.body.getReader(),i=()=>{r.read().then((e=>{let{done:r,value:n}=e;return r?(ii.debug.log("worker","fetchNext().then() and done is true"),ii.fetchStatus=Dt,c=null,Er(),void postMessage({cmd:$,type:Se,value:g,msg:"fetch done"})):a&&a.signal&&a.signal.aborted?(ii.debug.log("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(ii.fetchStatus=Dt)):yr(nr)?(ii.debug.log("worker","fetchNext().then() and requestAbort is true so return"),void(ii.fetchStatus=Dt)):void("string"!=typeof n?(ii.fetchStatus=Ct,d(n.byteLength),t.isFlv?c.write(n):t.isFmp4?ii.demuxFmp4(n):t.isMpeg4&&ii.demuxMpeg4(n),i()):ii.debug.warn("worker",`fetchNext().then() and value "${n}" is string so return`))})).catch((e=>{if(a&&a.signal&&a.signal.aborted)return ii.debug.log("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(ii.fetchStatus=Dt);c=null,e.name!==Bt?(ii.debug.log("worker",`fetchNext().catch() and e is ${e.toString()}`),Er(),postMessage({cmd:$,type:De.fetchError,value:e.toString()})):ii.debug.log("worker","fetchNext().catch() and e.name is AbortError so return")}))};i()}})).catch((e=>{a&&a.signal&&a.signal.aborted?ii.debug.log("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==Bt?(ii.debug.log("worker",`fetch().catch() and e is ${e.toString()}`),Er(),postMessage({cmd:$,type:De.fetchError,value:e.toString()}),c=null):ii.debug.log("worker","fetch().catch() and e.name is AbortError so return")}))):t.protocol===m&&(t.isFlv&&(c=new Br(ii.demuxFlv())),o=new WebSocket(e),o.binaryType="arraybuffer",o.onopen=()=>{ii.debug.log("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:$,type:Ue}),postMessage({cmd:$,type:Ce})},o.onclose=e=>{u?ii.debug.log("worker","fetchStream, WebsocketStream socket close and isSocketError is true , so return"):(ii.debug.log("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&ii.debug.error("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),yr(nr)?ii.debug.log("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(c=null,postMessage({cmd:$,type:Se,value:y,msg:e.code})))},o.onerror=e=>{ii.debug.error("worker","fetchStream, WebsocketStream socket error",e),u=!0,c=null,postMessage({cmd:$,type:De.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},o.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?c.write(e.data):t.isFmp4?ii.demuxFmp4(e.data):t.isMpeg4?ii.demuxMpeg4(e.data):ii._opt.isNakedFlow?ii.demuxNakedFlow(e.data):ii.demuxM7s(e.data)):ii.debug.warn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,i=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const n=r[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let s=r[0];const a=(yield n).slice();switch(i){case oe:if(a.byteLength>0){let e=a;yr(ii._opt.m7sCryptoAudio)&&(e=ii.cryptoPayloadAudio(a)),ii.decode(e,{type:se,ts:s})}else ii.debug.warn("worker",`demuxFlv() type is audio and payload.byteLength is ${a.byteLength} and return`);break;case de:if(a.byteLength>=6){const e=a[0];if(ii._isEnhancedH265Header(e))ii._decodeEnhancedH265Video(a,s);else{a[0];let e=a[0]>>4===Tt;if(e&&gr(a)&&null===Ht){const e=15&a[0];Ht=e===Fe,Yt=tr(a,Ht),ii.debug.log("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${Ht} and nalUnitSize is ${Yt}`)}e&&ii.calcIframeIntervalTimestamp(s),ii.isPlayer&&ii.calcNetworkDelay(s),r[0]=a[4],r[1]=a[3],r[2]=a[2],r[3]=0;let t=r[0],i=ii.cryptoPayload(a,e);ii.decode(i,{type:ae,ts:s,isIFrame:e,cts:t})}}else ii.debug.warn("worker",`demuxFlv() type is video and payload.byteLength is ${a.byteLength} and return`);break;case le:postMessage({cmd:Z,buffer:a},[a.buffer]);break;default:ii.debug.log("worker",`demuxFlv() type is ${i}`)}}},decode:function(e,t){t.type===se?ii._opt.hasAudio&&(postMessage({cmd:$,type:Ae,value:e.byteLength}),ii.isPlayer?ii.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):ii.isPlayback&&(ii.isPlaybackOnlyDecodeIFrame()||(ii.isPlaybackCacheBeforeDecodeForFpsRender(),ii.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===ae&&ii._opt.hasVideo&&(postMessage({cmd:$,type:Be,value:e.byteLength}),postMessage({cmd:$,type:xe,value:t.ts}),ii.isPlayer?ii.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):ii.isPlayback&&(ii.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&ii.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(ii.isPlaybackCacheBeforeDecodeForFpsRender(),ii.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let r=e;return ii._opt.isM7sCrypto?ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength>0&&ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength>0?r=zi(e,ii._opt.cryptoKey,ii._opt.cryptoIV,Ht):ii.debug.error("worker",`isM7sCrypto cryptoKey.length is ${ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength} or cryptoIV.length is ${ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength} null`):ii._opt.isSm4Crypto?ii._opt.sm4CryptoKey&&t?r=an(e,ii._opt.sm4CryptoKey):ii._opt.sm4CryptoKey||ii.debug.error("worker","isSm4Crypto opt.sm4CryptoKey is null"):ii._opt.isXorCrypto&&(ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength>0&&ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength>0?r=hn(e,ii._opt.cryptoKey,ii._opt.cryptoIV,Ht):ii.debug.error("worker",`isXorCrypto cryptoKey.length is ${ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength} or cryptoIV.length is ${ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength} null`)),r},cryptoPayloadAudio:function(e){let t=e;return ii._opt.isM7sCrypto&&(ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength>0&&ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength>0?e[0]>>4===ze&&(t=Ni(e,ii._opt.cryptoKey,ii._opt.cryptoIV)):ii.debug.error("worker",`isM7sCrypto cryptoKey.length is ${ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength} or cryptoIV.length is ${ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength} null`)),t},setCodecAudio:function(e,t){const r=e[0]>>4,i=e[0]>>1&1;if(Jt=r===ze?i?16:8:0===i?8:16,ni&&ni.setCodec)if(jt(e)||r===Ne||r===Oe||r===$e){ii.debug.log("worker",`setCodecAudio: init audio codec, codeId is ${r}`);const i=r===ze?e.slice(2):new Uint8Array(0);ni.setCodec(r,ii._opt.sampleRate,i),r===ze&&postMessage({cmd:L,buffer:i},[i.buffer]),E=!0,r!==ze&&(r===$e?(ii.mp3Demuxer||(ii.mp3Demuxer=new ln(ii),ii.mp3Demuxer.on("data",((e,t)=>{ni.decode(e,t)}))),ii.mp3Demuxer.dispatch(e.slice(1),t)):ni.decode(e.slice(1),t))}else ii.debug.warn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",r);else ii.debug.error("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(ii.isDestroyed)ii.debug.log("worker","decodeAudio, decoder is destroyed and return");else if(ii.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())jr.decodeAudio(e,t);else if(yr(r)&&yr(ii._opt.mseDecodeAudio))postMessage({cmd:O,payload:e,ts:t,cts:t},[e.buffer]);else{const r=e[0]>>4;if(E){if(jt(e))return void ii.debug.log("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");r===$e?ii.mp3Demuxer.dispatch(e.slice(1),t):ni.decode(r===ze?e.slice(2):e.slice(1),t)}else ii.setCodecAudio(e,t)}},setCodecVideo:function(e){const t=15&e[0];if(si&&si.setCodec)if(gr(e))if(t===Ie||t===Fe){ii.debug.log("worker",`setCodecVideo: init video codec , codecId is ${t}`);const r=e.slice(5);if(t===Ie&&ii._opt.useSIMD){const e=kr(r);if(e.codecWidth>B||e.codecHeight>B)return postMessage({cmd:q}),void ii.debug.warn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const i=new Uint8Array(e);S=!0,si.setCodec(t,r),postMessage({cmd:R,code:t}),postMessage({cmd:M,buffer:i,codecId:t},[i.buffer])}else ii.debug.warn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${t} is not H264 or H265`);else ii.debug.warn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${t} and frameType is ${e[0]>>4} and packetType is ${e[1]}`);else ii.debug.error("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(ii.isDestroyed)ii.debug.log("worker","decodeVideo, decoder is destroyed and return");else if(ii.isPlayUseMSEAndDecoderInWorker())jr.decodeVideo(e,t,i,n);else if(yr(r))postMessage({cmd:N,payload:e,isIFrame:i,ts:t,cts:n,delay:ii.delay},[e.buffer]);else if(S)if(!U&&i&&(U=!0),U){if(i&&gr(e)){const t=15&e[0];let r={};t===Ie?r=kr(e.slice(5)):t===Fe&&(r=Vr(e)),r.codecWidth&&r.codecHeight&&h&&f&&(r.codecWidth!==h||r.codecHeight!==f)&&(ii.debug.warn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${h}, old height is ${f},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),$t=!0,postMessage({cmd:W}))}if($t)return void ii.debug.warn("worker","decodeVideo: video width or height is changed, and return");if(Gt)return void ii.debug.warn("worker","decodeVideo: simd decode error, and return");if(gr(e))return void ii.debug.warn("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];ii.debug.log("worker",`clearBuffer,bufferList length is ${i.length}, need clear is ${e}`),e&&(i=[]),ii.isPlayer&&(ii.resetAllDelay(),yr(ii._opt.checkFirstIFrame)&&(ii.dropping=!0,postMessage({cmd:H}))),yr(ii._opt.checkFirstIFrame)&&vr(r)&&(U=!1)},dropBuffer$2:function(){if(i.length>0){let e=i.findIndex((e=>yr(e.isIFrame)&&e.type===ae));if(ii.isAllIframeInBufferList())for(let t=0;t=ii.getNotDroppingDelayTs()){ii.debug.log("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${n} and notDroppingDelayTs is ${ii.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){ii.isPushDropping=!0,postMessage({cmd:H});const t=i.length;i=i.slice(e);const r=i.shift();ii.resetAllDelay(),ii.getDelay(r.ts,r.type),ii.doDecode(r),ii.isPushDropping=!1,ii.debug.log("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${i.length} and new delay is ${ii.delay} `)}else ii.isPushDropping=!1}0===i.length&&(ii.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),r=t.getUint32(1,!1),i=t.getUint8(0),n=new ArrayBuffer(4),s=new Uint32Array(n);switch(i){case se:ii.decode(new Uint8Array(e,5),{type:se,ts:r});break;case ae:if(t.byteLength>=11){const i=new Uint8Array(e,5),n=i[0];if(ii._isEnhancedH265Header(n))ii._decodeEnhancedH265Video(i,r);else{const e=t.getUint8(5)>>4==1;if(e&&(ii.calcIframeIntervalTimestamp(r),gr(i)&&null===Ht)){const e=15&i[0];Ht=e===Fe}ii.isPlayer&&ii.calcNetworkDelay(r),s[0]=i[4],s[1]=i[3],s[2]=i[2],s[3]=0;let n=s[0],a=ii.cryptoPayload(i,e);ii.decode(a,{type:ae,ts:r,isIFrame:e,cts:n})}}else ii.debug.warn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){Ar.dispatch(e)},demuxFmp4:function(e){Tr.dispatch(e)},demuxMpeg4:function(e){$r.dispatch(e)},demuxTs:function(e){Gr.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const r=e[0],i=48&r,n=15&r,s=e.slice(1,5),a=new ArrayBuffer(4),o=new Uint32Array(a),d="a"==String.fromCharCode(s[0]);if(Ht=vr(d),n===Lt){if(i===zt){const r=e.slice(5);if(d);else{const i=new Uint8Array(5+r.length);i.set([28,0,0,0,0],0),i.set(r,5),Yt=tr(e,Ht),ii.debug.log("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${Ht} and nalUnitSize is ${Yt}`),ii.decode(i,{type:ae,ts:t,isIFrame:!0,cts:0})}}}else if(n===Rt){let r=e,n=0;const s=i===zt;s&&ii.calcIframeIntervalTimestamp(t),d||(o[0]=e[4],o[1]=e[3],o[2]=e[2],o[3]=0,n=o[0],r=Kr(e.slice(8),s),r=ii.cryptoPayload(r,s),ii.decode(r,{type:ae,ts:t,isIFrame:s,cts:n}))}else if(n===Mt){const r=i===zt;r&&ii.calcIframeIntervalTimestamp(t);let n=Kr(e.slice(5),r);n=ii.cryptoPayload(n,r),ii.decode(n,{type:ae,ts:t,isIFrame:r,cts:0})}},_isEnhancedH265Header:function(e){return(e&Ft)===Ft},findSei:function(e,t){let r=4;lr(Yt)&&(r=Yt),Qt(e.slice(5),r).forEach((e=>{const r=Ht?e[0]>>>1&63:31&e[0];(Ht&&(r===dt||r===ot)||vr(Ht)&&r===qe)&&postMessage({cmd:X,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(U&&e>0))return;null===Ve?(Ve=e,Xe=rr()):et?r-t:0;ii.networkDelay=i,i>ii._opt.networkDelay&&ii._opt.playType===v&&(ii.debug.warn("worker",`calcNetworkDelay now dts:${e}, start dts is ${Ve} vs start is ${t},local diff is ${r} ,delay is ${i}`),postMessage({cmd:$,type:ke,value:i}))},calcIframeIntervalTimestamp:function(e){null===Et?Et=e:Et=ii._opt.playbackForwardMaxRateDecodeIFrame},isPlayUseMSE:function(){return ii.isPlayer&&ii._opt.useMSE&&yr(r)},isPlayUseMSEAndDecoderInWorker:function(){return ii.isPlayUseMSE()&&ii._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return ii.isPlayUseMSEAndDecoderInWorker()&&ii._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){ii.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){ii.debug.error("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Ot=!0,ii.webglObj.destroy(),ii.webglObj=null,ii.offscreenCanvasGL=null,setTimeout((()=>{ii.offscreenCanvasGL=ii.offscreenCanvas.getContext("webgl"),ii.offscreenCanvasGL&&ii.offscreenCanvasGL.getContextAttributes().stencil?(ii.webglObj=p(ii.offscreenCanvasGL,ii._opt.openWebglAlignment),Ot=!1):ii.debug.error("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){ii.debug.log("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,r){postMessage({cmd:R,code:e}),postMessage({cmd:k,w:t,h:r}),h=t,f=r,ii.useOffscreen()&&(ii.offscreenCanvas=new OffscreenCanvas(t,r),ii.offscreenCanvasGL=ii.offscreenCanvas.getContext("webgl"),ii.webglObj=p(ii.offscreenCanvasGL,ii._opt.openWebglAlignment),ii.offscreenCanvas.addEventListener("webglcontextlost",ii.onOffscreenCanvasWebglContextLost,!1),ii.offscreenCanvas.addEventListener("webglcontextrestored",ii.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,r){postMessage({cmd:I,code:e}),postMessage({cmd:P,sampleRate:t,channels:r,depth:Jt}),_t=r},yuvData:function(t,r){if(ii.isDestroyed)return void ii.debug.log("worker","yuvData, decoder is destroyed and return");const i=h*f*3/2;let n=e.HEAPU8.subarray(t,t+i),s=new Uint8Array(n);if(ft=null,ii.useOffscreen())try{if(Ot)return;ii.webglObj.renderYUV(h,f,s);let e=ii.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:e,delay:ii.delay,ts:r},[e])}catch(e){ii.debug.error("worker","yuvData, transferToImageBitmap error is",e)}else postMessage({cmd:C,output:s,delay:ii.delay,ts:r},[s.buffer])},pcmData:function(e,r,i){if(ii.isDestroyed)return void ii.debug.log("worker","pcmData, decoder is destroyed and return");let s=r,a=[],o=0,d=ii._opt.audioBufferSize;for(let r=0;r<2;r++){let i=t.HEAPU32[(e>>2)+r]>>2;a[r]=t.HEAPF32.subarray(i,i+s)}if(mt){if(!(s>=(r=d-mt)))return mt+=s,n[0]=Float32Array.of(...n[0],...a[0]),void(2==_t&&(n[1]=Float32Array.of(...n[1],...a[1])));at[0]=Float32Array.of(...n[0],...a[0].subarray(0,r)),2==_t&&(at[1]=Float32Array.of(...n[1],...a[1].subarray(0,r))),postMessage({cmd:D,buffer:at,ts:i},at.map((e=>e.buffer))),o=r,s-=r}for(mt=s;mt>=d;mt-=d)at[0]=a[0].slice(o,o+=d),2==_t&&(at[1]=a[1].slice(o-d,o)),postMessage({cmd:D,buffer:at,ts:i},at.map((e=>e.buffer)));mt&&(n[0]=a[0].slice(o),2==_t&&(n[1]=a[1].slice(o))),a=[]},errorInfo:function(e){null===ft&&(ft=rr());const t=rr(),r=ir(pt>0?2*pt:5e3,1e3,5e3),i=t-ft;i>r&&(ii.debug.warn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${pt} and diff is ${i} and maxDiff is ${r}\n and replay`),Gt=!0,postMessage({cmd:j}))},sendWebsocketMessage:function(e){o?o.readyState===Pe?o.send(e):ii.debug.error("worker","socket is not open"):ii.debug.error("worker","socket is null")},timeEnd:function(){},postStreamToMain(e,t){postMessage({cmd:K,type:t,buffer:e},[e.buffer])}};ii.debug=new xr(ii);let ni=null;t.AudioDecoder&&(ni=new t.AudioDecoder(ii));let si=null;e.VideoDecoder&&(si=new e.VideoDecoder(ii)),postMessage({cmd:T}),self.onmessage=function(e){let t=e.data;switch(t.cmd){case ce:try{ii._opt=Object.assign(ii._opt,JSON.parse(t.opt))}catch(e){}ii.init();break;case ue:ii.pushBuffer(t.buffer,t.options);break;case he:ii.decodeAudio(t.buffer,t.ts);break;case fe:ii.decodeVideo(t.buffer,t.ts,t.isIFrame);break;case _e:ii.clearBuffer(t.needClear);break;case ge:ii.fetchStream(t.url,JSON.parse(t.opt));break;case pe:ii.debug.log("worker","close",JSON.stringify(t.options)),t.options&&vr(t.options.isVideoInited)&&(wr=t.options.isVideoInited),ii.close();break;case me:ii.debug.log("worker","updateConfig",t.key,t.value),ii._opt[t.key]=t.value,"playbackRate"===t.key&&(ii.playbackUpdatePlaybackRate(),ii.isPlaybackCacheBeforeDecodeForFpsRender()&&ii.playbackCacheLoop());break;case ye:ii.sendWebsocketMessage(t.message);break;case ve:jr.$video.currentTime=Number(t.message)}}}(e[1],t)}))})); diff --git a/pages_player/static/h5/js/jessibuca-pro/decoder-pro-simd.wasm b/pages_player/static/h5/js/jessibuca-pro/decoder-pro-simd.wasm new file mode 100644 index 0000000..4e43c94 Binary files /dev/null and b/pages_player/static/h5/js/jessibuca-pro/decoder-pro-simd.wasm differ diff --git a/pages_player/static/h5/js/jessibuca-pro/decoder-pro.js b/pages_player/static/h5/js/jessibuca-pro/decoder-pro.js new file mode 100644 index 0000000..e18dd55 --- /dev/null +++ b/pages_player/static/h5/js/jessibuca-pro/decoder-pro.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("crypto")):"function"==typeof define&&define.amd?define(["crypto"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).crypto$1)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r,n=t(e),o=(r="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href,function(e){var t,i;(e=void 0!==(e=e||{})?e:{}).ready=new Promise((function(e,r){t=e,i=r})),(e=void 0!==e?e:{}).locateFile=function(e){return"decoder-pro.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_WASM_URL&&""!=JESSIBUCA_PRO_WASM_URL?JESSIBUCA_PRO_WASM_URL:e};var n,o,s,a,d,l,u=Object.assign({},e),c="./this.program",f="object"==typeof window,h="function"==typeof importScripts,p="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,m="";p?(m=h?require("path").dirname(m)+"/":__dirname+"/",l=()=>{d||(a=require("fs"),d=require("path"))},n=function(e,t){return l(),e=d.normalize(e),a.readFileSync(e,t?void 0:"utf8")},s=e=>{var t=n(e,!0);return t.buffer||(t=new Uint8Array(t)),t},o=(e,t,r)=>{l(),e=d.normalize(e),a.readFile(e,(function(e,i){e?r(e):t(i.buffer)}))},process.argv.length>1&&(c=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(e){if(!(e instanceof J))throw e})),process.on("unhandledRejection",(function(e){throw e})),e.inspect=function(){return"[Emscripten Module object]"}):(f||h)&&(h?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),r&&(m=r),m=0!==m.indexOf("blob:")?m.substr(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1):"",n=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},h&&(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),o=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var _,g,y=e.print||console.log.bind(console),v=e.printErr||console.warn.bind(console);Object.assign(e,u),u=null,e.arguments&&e.arguments,e.thisProgram&&(c=e.thisProgram),e.quit&&e.quit,e.wasmBinary&&(_=e.wasmBinary),e.noExitRuntime,"object"!=typeof WebAssembly&&Y("no native wasm support detected");var b=!1;function w(e,t){e||Y(t)}var S,E,A,B,x,U,k,T,C,D,P="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function F(e,t,r){for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&P)return P.decode(e.subarray(t,n));for(var o="";t>10,56320|1023&l)}}else o+=String.fromCharCode((31&s)<<6|a)}else o+=String.fromCharCode(s)}return o}function I(e,t){return e?F(A,e,t):""}function L(e,t,r,i){if(!(i>0))return 0;for(var n=r,o=r+i-1,s=0;s=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s)),a<=127){if(r>=o)break;t[r++]=a}else if(a<=2047){if(r+1>=o)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=o)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=o)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a}}return t[r]=0,r-n}function M(e){for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t}e.INITIAL_MEMORY;var R,z,N,O,G=[],$=[],H=[],V=0,W=null;function j(t){V++,e.monitorRunDependencies&&e.monitorRunDependencies(V)}function q(t){if(V--,e.monitorRunDependencies&&e.monitorRunDependencies(V),0==V&&W){var r=W;W=null,r()}}function Y(t){e.onAbort&&e.onAbort(t),v(t="Aborted("+t+")"),b=!0,t+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(t);throw i(r),r}function K(e){return e.startsWith("data:application/octet-stream;base64,")}function X(e){return e.startsWith("file://")}function Z(e){try{if(e==R&&_)return new Uint8Array(_);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}catch(e){Y(e)}}function J(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Q(t){for(;t.length>0;)t.shift()(e)}function ee(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){k[this.ptr+4>>2]=e},this.get_type=function(){return k[this.ptr+4>>2]},this.set_destructor=function(e){k[this.ptr+8>>2]=e},this.get_destructor=function(){return k[this.ptr+8>>2]},this.set_refcount=function(e){U[this.ptr>>2]=e},this.set_caught=function(e){e=e?1:0,E[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=E[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,E[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=E[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var e=U[this.ptr>>2];U[this.ptr>>2]=e+1},this.release_ref=function(){var e=U[this.ptr>>2];return U[this.ptr>>2]=e-1,1===e},this.set_adjusted_ptr=function(e){k[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return k[this.ptr+16>>2]},this.get_exception_ptr=function(){if(jt(this.get_type()))return k[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}e.locateFile?K(R="decoder-pro.wasm")||(z=R,R=e.locateFile?e.locateFile(z,m):m+z):R=new URL("decoder-pro.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href).toString();var te={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=te.isAbs(e),r="/"===e.substr(-1);return(e=te.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=te.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=te.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments,0);return te.normalize(e.join("/"))},join2:(e,t)=>te.normalize(e+"/"+t)},re={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:ae.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=te.isAbs(i)}return(t?"/":"")+(e=te.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=re.resolve(e).substr(1),t=re.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),o=Math.min(i.length,n.length),s=o,a=0;a0?r:M(e)+1,n=new Array(i),o=L(e,n,0,n.length);return t&&(n.length=o),n}var ne={ttys:[],init:function(){},shutdown:function(){},register:function(e,t){ne.ttys[e]={input:[],output:[],ops:t},ae.registerDevice(e,ne.stream_ops)},stream_ops:{open:function(e){var t=ne.ttys[e.node.rdev];if(!t)throw new ae.ErrnoError(43);e.tty=t,e.seekable=!1},close:function(e){e.tty.ops.flush(e.tty)},flush:function(e){e.tty.ops.flush(e.tty)},read:function(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new ae.ErrnoError(60);for(var o=0,s=0;s0?r.slice(0,i).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(t=window.prompt("Input: "))&&(t+="\n"):"function"==typeof readline&&null!==(t=readline())&&(t+="\n");if(!t)return null;e.input=ie(t,!0)}return e.input.shift()},put_char:function(e,t){null===t||10===t?(y(F(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(y(F(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,t){null===t||10===t?(v(F(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(v(F(e.output,0)),e.output=[])}}};function oe(e){e=function(e,t){return Math.ceil(e/t)*t}(e,65536);var t=Wt(65536,e);return t?(function(e,t){A.fill(0,e,e+t)}(t,e),t):0}var se={ops_table:null,mount:function(e){return se.createNode(null,"/",16895,0)},createNode:function(e,t,r,i){if(ae.isBlkdev(r)||ae.isFIFO(r))throw new ae.ErrnoError(63);se.ops_table||(se.ops_table={dir:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr,lookup:se.node_ops.lookup,mknod:se.node_ops.mknod,rename:se.node_ops.rename,unlink:se.node_ops.unlink,rmdir:se.node_ops.rmdir,readdir:se.node_ops.readdir,symlink:se.node_ops.symlink},stream:{llseek:se.stream_ops.llseek}},file:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr},stream:{llseek:se.stream_ops.llseek,read:se.stream_ops.read,write:se.stream_ops.write,allocate:se.stream_ops.allocate,mmap:se.stream_ops.mmap,msync:se.stream_ops.msync}},link:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr,readlink:se.node_ops.readlink},stream:{}},chrdev:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr},stream:ae.chrdev_stream_ops}});var n=ae.createNode(e,t,r,i);return ae.isDir(n.mode)?(n.node_ops=se.ops_table.dir.node,n.stream_ops=se.ops_table.dir.stream,n.contents={}):ae.isFile(n.mode)?(n.node_ops=se.ops_table.file.node,n.stream_ops=se.ops_table.file.stream,n.usedBytes=0,n.contents=null):ae.isLink(n.mode)?(n.node_ops=se.ops_table.link.node,n.stream_ops=se.ops_table.link.stream):ae.isChrdev(n.mode)&&(n.node_ops=se.ops_table.chrdev.node,n.stream_ops=se.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage:function(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr:function(e){var t={};return t.dev=ae.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,ae.isDir(e.mode)?t.size=4096:ae.isFile(e.mode)?t.size=e.usedBytes:ae.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr:function(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&se.resizeFileStorage(e,t.size)},lookup:function(e,t){throw ae.genericErrors[44]},mknod:function(e,t,r,i){return se.createNode(e,t,r,i)},rename:function(e,t,r){if(ae.isDir(e.mode)){var i;try{i=ae.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new ae.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink:function(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir:function(e,t){var r=ae.lookupNode(e,t);for(var i in r.contents)throw new ae.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir:function(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink:function(e,t,r){var i=se.createNode(e,t,41471,0);return i.link=r,i},readlink:function(e){if(!ae.isLink(e.mode))throw new ae.ErrnoError(28);return e.link}},stream_ops:{read:function(e,t,r,i,n){var o=e.node.contents;if(n>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-n,i);if(s>8&&o.subarray)t.set(o.subarray(n,n+s),r);else for(var a=0;a0||r+t1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=re.resolve(ae.cwd(),e)))return{path:"",node:null};var r={follow_mount:!0,recurse_count:0};if(t=Object.assign(r,t),t.recurse_count>8)throw new ae.ErrnoError(32);for(var i=te.normalizeArray(e.split("/").filter((e=>!!e)),!1),n=ae.root,o="/",s=0;s40)throw new ae.ErrnoError(32)}}return{path:o,node:n}},getPath:e=>{for(var t;;){if(ae.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?r+"/"+t:r+t:r}t=t?e.name+"/"+t:e.name,e=e.parent}},hashName:(e,t)=>{for(var r=0,i=0;i>>0)%ae.nameTable.length},hashAddNode:e=>{var t=ae.hashName(e.parent.id,e.name);e.name_next=ae.nameTable[t],ae.nameTable[t]=e},hashRemoveNode:e=>{var t=ae.hashName(e.parent.id,e.name);if(ae.nameTable[t]===e)ae.nameTable[t]=e.name_next;else for(var r=ae.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode:(e,t)=>{var r=ae.mayLookup(e);if(r)throw new ae.ErrnoError(r,e);for(var i=ae.hashName(e.id,t),n=ae.nameTable[i];n;n=n.name_next){var o=n.name;if(n.parent.id===e.id&&o===t)return n}return ae.lookup(e,t)},createNode:(e,t,r,i)=>{var n=new ae.FSNode(e,t,r,i);return ae.hashAddNode(n),n},destroyNode:e=>{ae.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:e=>{var t=ae.flagModes[e];if(void 0===t)throw new Error("Unknown file open mode: "+e);return t},flagsToPermissionString:e=>{var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>ae.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup:e=>{var t=ae.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate:(e,t)=>{try{return ae.lookupNode(e,t),20}catch(e){}return ae.nodePermissions(e,"wx")},mayDelete:(e,t,r)=>{var i;try{i=ae.lookupNode(e,t)}catch(e){return e.errno}var n=ae.nodePermissions(e,"wx");if(n)return n;if(r){if(!ae.isDir(i.mode))return 54;if(ae.isRoot(i)||ae.getPath(i)===ae.cwd())return 10}else if(ae.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?ae.isLink(e.mode)?32:ae.isDir(e.mode)&&("r"!==ae.flagsToPermissionString(t)||512&t)?31:ae.nodePermissions(e,ae.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ae.MAX_OPEN_FDS;for(var r=e;r<=t;r++)if(!ae.streams[r])return r;throw new ae.ErrnoError(33)},getStream:e=>ae.streams[e],createStream:(e,t,r)=>{ae.FSStream||(ae.FSStream=function(){this.shared={}},ae.FSStream.prototype={},Object.defineProperties(ae.FSStream.prototype,{object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}},flags:{get:function(){return this.shared.flags},set:function(e){this.shared.flags=e}},position:{get:function(){return this.shared.position},set:function(e){this.shared.position=e}}})),e=Object.assign(new ae.FSStream,e);var i=ae.nextfd(t,r);return e.fd=i,ae.streams[i]=e,e},closeStream:e=>{ae.streams[e]=null},chrdev_stream_ops:{open:e=>{var t=ae.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:()=>{throw new ae.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice:(e,t)=>{ae.devices[e]={stream_ops:t}},getDevice:e=>ae.devices[e],getMounts:e=>{for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs:(e,t)=>{"function"==typeof e&&(t=e,e=!1),ae.syncFSRequests++,ae.syncFSRequests>1&&v("warning: "+ae.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var r=ae.getMounts(ae.root.mount),i=0;function n(e){return ae.syncFSRequests--,t(e)}function o(e){if(e)return o.errored?void 0:(o.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return o(null);t.type.syncfs(t,e,o)}))},mount:(e,t,r)=>{var i,n="/"===r,o=!r;if(n&&ae.root)throw new ae.ErrnoError(10);if(!n&&!o){var s=ae.lookupPath(r,{follow_mount:!1});if(r=s.path,i=s.node,ae.isMountpoint(i))throw new ae.ErrnoError(10);if(!ae.isDir(i.mode))throw new ae.ErrnoError(54)}var a={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(a);return d.mount=a,a.root=d,n?ae.root=d:i&&(i.mounted=a,i.mount&&i.mount.mounts.push(a)),d},unmount:e=>{var t=ae.lookupPath(e,{follow_mount:!1});if(!ae.isMountpoint(t.node))throw new ae.ErrnoError(28);var r=t.node,i=r.mounted,n=ae.getMounts(i);Object.keys(ae.nameTable).forEach((e=>{for(var t=ae.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&ae.destroyNode(t),t=r}})),r.mounted=null;var o=r.mount.mounts.indexOf(i);r.mount.mounts.splice(o,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod:(e,t,r)=>{var i=ae.lookupPath(e,{parent:!0}).node,n=te.basename(e);if(!n||"."===n||".."===n)throw new ae.ErrnoError(28);var o=ae.mayCreate(i,n);if(o)throw new ae.ErrnoError(o);if(!i.node_ops.mknod)throw new ae.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,ae.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,ae.mknod(e,t,0)),mkdirTree:(e,t)=>{for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,ae.mknod(e,t,r)),symlink:(e,t)=>{if(!re.resolve(e))throw new ae.ErrnoError(44);var r=ae.lookupPath(t,{parent:!0}).node;if(!r)throw new ae.ErrnoError(44);var i=te.basename(t),n=ae.mayCreate(r,i);if(n)throw new ae.ErrnoError(n);if(!r.node_ops.symlink)throw new ae.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename:(e,t)=>{var r,i,n=te.dirname(e),o=te.dirname(t),s=te.basename(e),a=te.basename(t);if(r=ae.lookupPath(e,{parent:!0}).node,i=ae.lookupPath(t,{parent:!0}).node,!r||!i)throw new ae.ErrnoError(44);if(r.mount!==i.mount)throw new ae.ErrnoError(75);var d,l=ae.lookupNode(r,s),u=re.relative(e,o);if("."!==u.charAt(0))throw new ae.ErrnoError(28);if("."!==(u=re.relative(t,n)).charAt(0))throw new ae.ErrnoError(55);try{d=ae.lookupNode(i,a)}catch(e){}if(l!==d){var c=ae.isDir(l.mode),f=ae.mayDelete(r,s,c);if(f)throw new ae.ErrnoError(f);if(f=d?ae.mayDelete(i,a,c):ae.mayCreate(i,a))throw new ae.ErrnoError(f);if(!r.node_ops.rename)throw new ae.ErrnoError(63);if(ae.isMountpoint(l)||d&&ae.isMountpoint(d))throw new ae.ErrnoError(10);if(i!==r&&(f=ae.nodePermissions(r,"w")))throw new ae.ErrnoError(f);ae.hashRemoveNode(l);try{r.node_ops.rename(l,i,a)}catch(e){throw e}finally{ae.hashAddNode(l)}}},rmdir:e=>{var t=ae.lookupPath(e,{parent:!0}).node,r=te.basename(e),i=ae.lookupNode(t,r),n=ae.mayDelete(t,r,!0);if(n)throw new ae.ErrnoError(n);if(!t.node_ops.rmdir)throw new ae.ErrnoError(63);if(ae.isMountpoint(i))throw new ae.ErrnoError(10);t.node_ops.rmdir(t,r),ae.destroyNode(i)},readdir:e=>{var t=ae.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new ae.ErrnoError(54);return t.node_ops.readdir(t)},unlink:e=>{var t=ae.lookupPath(e,{parent:!0}).node;if(!t)throw new ae.ErrnoError(44);var r=te.basename(e),i=ae.lookupNode(t,r),n=ae.mayDelete(t,r,!1);if(n)throw new ae.ErrnoError(n);if(!t.node_ops.unlink)throw new ae.ErrnoError(63);if(ae.isMountpoint(i))throw new ae.ErrnoError(10);t.node_ops.unlink(t,r),ae.destroyNode(i)},readlink:e=>{var t=ae.lookupPath(e).node;if(!t)throw new ae.ErrnoError(44);if(!t.node_ops.readlink)throw new ae.ErrnoError(28);return re.resolve(ae.getPath(t.parent),t.node_ops.readlink(t))},stat:(e,t)=>{var r=ae.lookupPath(e,{follow:!t}).node;if(!r)throw new ae.ErrnoError(44);if(!r.node_ops.getattr)throw new ae.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>ae.stat(e,!0),chmod:(e,t,r)=>{var i;if(!(i="string"==typeof e?ae.lookupPath(e,{follow:!r}).node:e).node_ops.setattr)throw new ae.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod:(e,t)=>{ae.chmod(e,t,!0)},fchmod:(e,t)=>{var r=ae.getStream(e);if(!r)throw new ae.ErrnoError(8);ae.chmod(r.node,t)},chown:(e,t,r,i)=>{var n;if(!(n="string"==typeof e?ae.lookupPath(e,{follow:!i}).node:e).node_ops.setattr)throw new ae.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown:(e,t,r)=>{ae.chown(e,t,r,!0)},fchown:(e,t,r)=>{var i=ae.getStream(e);if(!i)throw new ae.ErrnoError(8);ae.chown(i.node,t,r)},truncate:(e,t)=>{if(t<0)throw new ae.ErrnoError(28);var r;if(!(r="string"==typeof e?ae.lookupPath(e,{follow:!0}).node:e).node_ops.setattr)throw new ae.ErrnoError(63);if(ae.isDir(r.mode))throw new ae.ErrnoError(31);if(!ae.isFile(r.mode))throw new ae.ErrnoError(28);var i=ae.nodePermissions(r,"w");if(i)throw new ae.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate:(e,t)=>{var r=ae.getStream(e);if(!r)throw new ae.ErrnoError(8);if(0==(2097155&r.flags))throw new ae.ErrnoError(28);ae.truncate(r.node,t)},utime:(e,t,r)=>{var i=ae.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open:(t,r,i)=>{if(""===t)throw new ae.ErrnoError(44);var n;if(i=void 0===i?438:i,i=64&(r="string"==typeof r?ae.modeStringToFlags(r):r)?4095&i|32768:0,"object"==typeof t)n=t;else{t=te.normalize(t);try{n=ae.lookupPath(t,{follow:!(131072&r)}).node}catch(e){}}var o=!1;if(64&r)if(n){if(128&r)throw new ae.ErrnoError(20)}else n=ae.mknod(t,i,0),o=!0;if(!n)throw new ae.ErrnoError(44);if(ae.isChrdev(n.mode)&&(r&=-513),65536&r&&!ae.isDir(n.mode))throw new ae.ErrnoError(54);if(!o){var s=ae.mayOpen(n,r);if(s)throw new ae.ErrnoError(s)}512&r&&!o&&ae.truncate(n,0),r&=-131713;var a=ae.createStream({node:n,path:ae.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return a.stream_ops.open&&a.stream_ops.open(a),!e.logReadFiles||1&r||(ae.readFiles||(ae.readFiles={}),t in ae.readFiles||(ae.readFiles[t]=1)),a},close:e=>{if(ae.isClosed(e))throw new ae.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{ae.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek:(e,t,r)=>{if(ae.isClosed(e))throw new ae.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new ae.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new ae.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read:(e,t,r,i,n)=>{if(i<0||n<0)throw new ae.ErrnoError(28);if(ae.isClosed(e))throw new ae.ErrnoError(8);if(1==(2097155&e.flags))throw new ae.ErrnoError(8);if(ae.isDir(e.node.mode))throw new ae.ErrnoError(31);if(!e.stream_ops.read)throw new ae.ErrnoError(28);var o=void 0!==n;if(o){if(!e.seekable)throw new ae.ErrnoError(70)}else n=e.position;var s=e.stream_ops.read(e,t,r,i,n);return o||(e.position+=s),s},write:(e,t,r,i,n,o)=>{if(i<0||n<0)throw new ae.ErrnoError(28);if(ae.isClosed(e))throw new ae.ErrnoError(8);if(0==(2097155&e.flags))throw new ae.ErrnoError(8);if(ae.isDir(e.node.mode))throw new ae.ErrnoError(31);if(!e.stream_ops.write)throw new ae.ErrnoError(28);e.seekable&&1024&e.flags&&ae.llseek(e,0,2);var s=void 0!==n;if(s){if(!e.seekable)throw new ae.ErrnoError(70)}else n=e.position;var a=e.stream_ops.write(e,t,r,i,n,o);return s||(e.position+=a),a},allocate:(e,t,r)=>{if(ae.isClosed(e))throw new ae.ErrnoError(8);if(t<0||r<=0)throw new ae.ErrnoError(28);if(0==(2097155&e.flags))throw new ae.ErrnoError(8);if(!ae.isFile(e.node.mode)&&!ae.isDir(e.node.mode))throw new ae.ErrnoError(43);if(!e.stream_ops.allocate)throw new ae.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap:(e,t,r,i,n)=>{if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new ae.ErrnoError(2);if(1==(2097155&e.flags))throw new ae.ErrnoError(2);if(!e.stream_ops.mmap)throw new ae.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e&&e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl:(e,t,r)=>{if(!e.stream_ops.ioctl)throw new ae.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error('Invalid encoding type "'+t.encoding+'"');var r,i=ae.open(e,t.flags),n=ae.stat(e),o=n.size,s=new Uint8Array(o);return ae.read(i,s,0,o,0),"utf8"===t.encoding?r=F(s,0):"binary"===t.encoding&&(r=s),ae.close(i),r},writeFile:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=ae.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(M(t)+1),o=L(t,n,0,n.length);ae.write(i,n,0,o,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");ae.write(i,t,0,t.byteLength,void 0,r.canOwn)}ae.close(i)},cwd:()=>ae.currentPath,chdir:e=>{var t=ae.lookupPath(e,{follow:!0});if(null===t.node)throw new ae.ErrnoError(44);if(!ae.isDir(t.node.mode))throw new ae.ErrnoError(54);var r=ae.nodePermissions(t.node,"x");if(r)throw new ae.ErrnoError(r);ae.currentPath=t.path},createDefaultDirectories:()=>{ae.mkdir("/tmp"),ae.mkdir("/home"),ae.mkdir("/home/web_user")},createDefaultDevices:()=>{ae.mkdir("/dev"),ae.registerDevice(ae.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),ae.mkdev("/dev/null",ae.makedev(1,3)),ne.register(ae.makedev(5,0),ne.default_tty_ops),ne.register(ae.makedev(6,0),ne.default_tty1_ops),ae.mkdev("/dev/tty",ae.makedev(5,0)),ae.mkdev("/dev/tty1",ae.makedev(6,0));var e=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var e=new Uint8Array(1);return()=>(crypto.getRandomValues(e),e[0])}if(p)try{var t=require("crypto");return()=>t.randomBytes(1)[0]}catch(e){}return()=>Y("randomDevice")}();ae.createDevice("/dev","random",e),ae.createDevice("/dev","urandom",e),ae.mkdir("/dev/shm"),ae.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{ae.mkdir("/proc");var e=ae.mkdir("/proc/self");ae.mkdir("/proc/self/fd"),ae.mount({mount:()=>{var t=ae.createNode(e,"fd",16895,73);return t.node_ops={lookup:(e,t)=>{var r=+t,i=ae.getStream(r);if(!i)throw new ae.ErrnoError(8);var n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams:()=>{e.stdin?ae.createDevice("/dev","stdin",e.stdin):ae.symlink("/dev/tty","/dev/stdin"),e.stdout?ae.createDevice("/dev","stdout",null,e.stdout):ae.symlink("/dev/tty","/dev/stdout"),e.stderr?ae.createDevice("/dev","stderr",null,e.stderr):ae.symlink("/dev/tty1","/dev/stderr"),ae.open("/dev/stdin",0),ae.open("/dev/stdout",1),ae.open("/dev/stderr",1)},ensureErrnoError:()=>{ae.ErrnoError||(ae.ErrnoError=function(e,t){this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},ae.ErrnoError.prototype=new Error,ae.ErrnoError.prototype.constructor=ae.ErrnoError,[44].forEach((e=>{ae.genericErrors[e]=new ae.ErrnoError(e),ae.genericErrors[e].stack=""})))},staticInit:()=>{ae.ensureErrnoError(),ae.nameTable=new Array(4096),ae.mount(se,{},"/"),ae.createDefaultDirectories(),ae.createDefaultDevices(),ae.createSpecialDirectories(),ae.filesystems={MEMFS:se}},init:(t,r,i)=>{ae.init.initialized=!0,ae.ensureErrnoError(),e.stdin=t||e.stdin,e.stdout=r||e.stdout,e.stderr=i||e.stderr,ae.createStandardStreams()},quit:()=>{ae.init.initialized=!1;for(var e=0;e{var r=0;return e&&(r|=365),t&&(r|=146),r},findObject:(e,t)=>{var r=ae.analyzePath(e,t);return r.exists?r.object:null},analyzePath:(e,t)=>{try{e=(i=ae.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var i=ae.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=i.path,r.parentObject=i.node,r.name=te.basename(e),i=ae.lookupPath(e,{follow:!t}),r.exists=!0,r.path=i.path,r.object=i.node,r.name=i.node.name,r.isRoot="/"===i.path}catch(e){r.error=e.errno}return r},createPath:(e,t,r,i)=>{e="string"==typeof e?e:ae.getPath(e);for(var n=t.split("/").reverse();n.length;){var o=n.pop();if(o){var s=te.join2(e,o);try{ae.mkdir(s)}catch(e){}e=s}}return s},createFile:(e,t,r,i,n)=>{var o=te.join2("string"==typeof e?e:ae.getPath(e),t),s=ae.getMode(i,n);return ae.create(o,s)},createDataFile:(e,t,r,i,n,o)=>{var s=t;e&&(e="string"==typeof e?e:ae.getPath(e),s=t?te.join2(e,t):e);var a=ae.getMode(i,n),d=ae.create(s,a);if(r){if("string"==typeof r){for(var l=new Array(r.length),u=0,c=r.length;u{var n=te.join2("string"==typeof e?e:ae.getPath(e),t),o=ae.getMode(!!r,!!i);ae.createDevice.major||(ae.createDevice.major=64);var s=ae.makedev(ae.createDevice.major++,0);return ae.registerDevice(s,{open:e=>{e.seekable=!1},close:e=>{i&&i.buffer&&i.buffer.length&&i(10)},read:(e,t,i,n,o)=>{for(var s=0,a=0;a{for(var s=0;s{if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!n)throw new Error("Cannot load without read() or XMLHttpRequest.");try{e.contents=ie(n(e.url),!0),e.usedBytes=e.contents.length}catch(e){throw new ae.ErrnoError(29)}},createLazyFile:(e,t,r,i,n)=>{function o(){this.lengthKnown=!1,this.chunks=[]}if(o.prototype.get=function(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},o.prototype.setDataGetter=function(e){this.getter=e},o.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,o=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,s=1048576;n||(s=i);var a=this;a.setDataGetter((e=>{var t=e*s,n=(e+1)*s-1;if(n=Math.min(n,i-1),void 0===a.chunks[e]&&(a.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==s&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ie(n.responseText||"",!0)})(t,n)),void 0===a.chunks[e])throw new Error("doXHR failed!");return a.chunks[e]})),!o&&i||(s=i=1,i=this.getter(0).length,s=i,y("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=s,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!h)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new o;Object.defineProperties(s,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var a={isDevice:!1,contents:s}}else a={isDevice:!1,url:r};var d=ae.createFile(e,t,a,i,n);a.contents?d.contents=a.contents:a.url&&(d.contents=null,d.url=a.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function u(e,t,r,i,n){var o=e.node.contents;if(n>=o.length)return 0;var s=Math.min(o.length-n,i);if(o.slice)for(var a=0;a{var t=d.stream_ops[e];l[e]=function(){return ae.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>(ae.forceLoadFile(d),u(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{ae.forceLoadFile(d);var o=oe(t);if(!o)throw new ae.ErrnoError(48);return u(e,E,o,t,r),{ptr:o,allocated:!0}},d.stream_ops=l,d},createPreloadedFile:(e,t,r,i,n,s,a,d,l,u)=>{var c=t?re.resolve(te.join2(e,t)):e;function f(r){function o(r){u&&u(),d||ae.createDataFile(e,t,r,i,n,l),s&&s(),q()}Browser.handledByPreloadPlugin(r,c,o,(()=>{a&&a(),q()}))||o(r)}j(),"string"==typeof r?function(e,t,r,i){var n=i?"":"al "+e;o(e,(r=>{w(r,'Loading data file "'+e+'" failed (no arrayBuffer).'),t(new Uint8Array(r)),n&&q()}),(t=>{if(!r)throw'Loading data file "'+e+'" failed.';r()})),n&&j()}(r,(e=>f(e)),a):f(r)},indexedDB:()=>window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,DB_NAME:()=>"EM_FS_"+window.location.pathname,DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(e,t,r)=>{t=t||(()=>{}),r=r||(()=>{});var i=ae.indexedDB();try{var n=i.open(ae.DB_NAME(),ae.DB_VERSION)}catch(e){return r(e)}n.onupgradeneeded=()=>{y("creating db"),n.result.createObjectStore(ae.DB_STORE_NAME)},n.onsuccess=()=>{var i=n.result.transaction([ae.DB_STORE_NAME],"readwrite"),o=i.objectStore(ae.DB_STORE_NAME),s=0,a=0,d=e.length;function l(){0==a?t():r()}e.forEach((e=>{var t=o.put(ae.analyzePath(e).object.contents,e);t.onsuccess=()=>{++s+a==d&&l()},t.onerror=()=>{a++,s+a==d&&l()}})),i.onerror=r},n.onerror=r},loadFilesFromDB:(e,t,r)=>{t=t||(()=>{}),r=r||(()=>{});var i=ae.indexedDB();try{var n=i.open(ae.DB_NAME(),ae.DB_VERSION)}catch(e){return r(e)}n.onupgradeneeded=r,n.onsuccess=()=>{var i=n.result;try{var o=i.transaction([ae.DB_STORE_NAME],"readonly")}catch(e){return void r(e)}var s=o.objectStore(ae.DB_STORE_NAME),a=0,d=0,l=e.length;function u(){0==d?t():r()}e.forEach((e=>{var t=s.get(e);t.onsuccess=()=>{ae.analyzePath(e).exists&&ae.unlink(e),ae.createDataFile(te.dirname(e),te.basename(e),t.result,!0,!0,!0),++a+d==l&&u()},t.onerror=()=>{d++,a+d==l&&u()}})),o.onerror=r},n.onerror=r}},de={DEFAULT_POLLMASK:5,calculateAt:function(e,t,r){if(te.isAbs(t))return t;var i;if(-100===e)i=ae.cwd();else{var n=ae.getStream(e);if(!n)throw new ae.ErrnoError(8);i=n.path}if(0==t.length){if(!r)throw new ae.ErrnoError(44);return i}return te.join2(i,t)},doStat:function(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&te.normalize(t)!==te.normalize(ae.getPath(e.node)))return-54;throw e}return U[r>>2]=i.dev,U[r+4>>2]=0,U[r+8>>2]=i.ino,U[r+12>>2]=i.mode,U[r+16>>2]=i.nlink,U[r+20>>2]=i.uid,U[r+24>>2]=i.gid,U[r+28>>2]=i.rdev,U[r+32>>2]=0,O=[i.size>>>0,(N=i.size,+Math.abs(N)>=1?N>0?(0|Math.min(+Math.floor(N/4294967296),4294967295))>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[r+40>>2]=O[0],U[r+44>>2]=O[1],U[r+48>>2]=4096,U[r+52>>2]=i.blocks,O=[Math.floor(i.atime.getTime()/1e3)>>>0,(N=Math.floor(i.atime.getTime()/1e3),+Math.abs(N)>=1?N>0?(0|Math.min(+Math.floor(N/4294967296),4294967295))>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[r+56>>2]=O[0],U[r+60>>2]=O[1],U[r+64>>2]=0,O=[Math.floor(i.mtime.getTime()/1e3)>>>0,(N=Math.floor(i.mtime.getTime()/1e3),+Math.abs(N)>=1?N>0?(0|Math.min(+Math.floor(N/4294967296),4294967295))>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[r+72>>2]=O[0],U[r+76>>2]=O[1],U[r+80>>2]=0,O=[Math.floor(i.ctime.getTime()/1e3)>>>0,(N=Math.floor(i.ctime.getTime()/1e3),+Math.abs(N)>=1?N>0?(0|Math.min(+Math.floor(N/4294967296),4294967295))>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[r+88>>2]=O[0],U[r+92>>2]=O[1],U[r+96>>2]=0,O=[i.ino>>>0,(N=i.ino,+Math.abs(N)>=1?N>0?(0|Math.min(+Math.floor(N/4294967296),4294967295))>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[r+104>>2]=O[0],U[r+108>>2]=O[1],0},doMsync:function(e,t,r,i,n){var o=A.slice(e,e+r);ae.msync(t,o,n,r,i)},varargs:void 0,get:function(){return de.varargs+=4,U[de.varargs-4>>2]},getStr:function(e){return I(e)},getStreamFromFD:function(e){var t=ae.getStream(e);if(!t)throw new ae.ErrnoError(8);return t}};function le(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}var ue=void 0;function ce(e){for(var t="",r=e;A[r];)t+=ue[A[r++]];return t}var fe={},he={},pe={};function me(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?"_"+e:e}function _e(e,t){return e=me(e),new Function("body","return function "+e+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(t)}function ge(e,t){var r=_e(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},r}var ye=void 0;function ve(e){throw new ye(e)}var be=void 0;function we(e){throw new be(e)}function Se(e,t,r){function i(t){var i=r(t);i.length!==e.length&&we("Mismatched type converter count");for(var n=0;n{he.hasOwnProperty(e)?n[t]=he[e]:(o.push(e),fe.hasOwnProperty(e)||(fe[e]=[]),fe[e].push((()=>{n[t]=he[e],++s===o.length&&i(n)})))})),0===o.length&&i(n)}function Ee(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var i=t.name;if(e||ve('type "'+i+'" must have a positive integer typeid pointer'),he.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;ve("Cannot register type '"+i+"' twice")}if(he[e]=t,delete pe[e],fe.hasOwnProperty(e)){var n=fe[e];delete fe[e],n.forEach((e=>e()))}}function Ae(e){if(!(this instanceof je))return!1;if(!(e instanceof je))return!1;for(var t=this.$$.ptrType.registeredClass,r=this.$$.ptr,i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n}function Be(e){ve(e.$$.ptrType.registeredClass.name+" instance already deleted")}var xe=!1;function Ue(e){}function ke(e){e.count.value-=1,0===e.count.value&&function(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}(e)}function Te(e,t,r){if(t===r)return e;if(void 0===r.baseClass)return null;var i=Te(e,t,r.baseClass);return null===i?null:r.downcast(i)}var Ce={};function De(){return Object.keys(Re).length}function Pe(){var e=[];for(var t in Re)Re.hasOwnProperty(t)&&e.push(Re[t]);return e}var Fe=[];function Ie(){for(;Fe.length;){var e=Fe.pop();e.$$.deleteScheduled=!1,e.delete()}}var Le=void 0;function Me(e){Le=e,Fe.length&&Le&&Le(Ie)}var Re={};function ze(e,t){return t=function(e,t){for(void 0===t&&ve("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}(e,t),Re[t]}function Ne(e,t){return t.ptrType&&t.ptr||we("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&we("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Ge(Object.create(e,{$$:{value:t}}))}function Oe(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ze(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?Ne(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Ne(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var o,s=this.registeredClass.getActualType(t),a=Ce[s];if(!a)return n.call(this);o=this.isConst?a.constPointerType:a.pointerType;var d=Te(t,this.registeredClass,o.registeredClass);return null===d?n.call(this):this.isSmartPointer?Ne(o.registeredClass.instancePrototype,{ptrType:o,ptr:d,smartPtrType:this,smartPtr:e}):Ne(o.registeredClass.instancePrototype,{ptrType:o,ptr:d})}function Ge(e){return"undefined"==typeof FinalizationRegistry?(Ge=e=>e,e):(xe=new FinalizationRegistry((e=>{ke(e.$$)})),Ge=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t};xe.register(e,r,e)}return e},Ue=e=>xe.unregister(e),Ge(e))}function $e(){if(this.$$.ptr||Be(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=Ge(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}function He(){this.$$.ptr||Be(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ve("Object already scheduled for deletion"),Ue(this),ke(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Ve(){return!this.$$.ptr}function We(){return this.$$.ptr||Be(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ve("Object already scheduled for deletion"),Fe.push(this),1===Fe.length&&Le&&Le(Ie),this.$$.deleteScheduled=!0,this}function je(){}function qe(e,t,r){if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||ve("Function '"+r+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}}function Ye(e,t,r,i,n,o,s,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=o,this.upcast=s,this.downcast=a,this.pureVirtualFunctions=[]}function Ke(e,t,r){for(;t!==r;)t.upcast||ve("Expected null or instance of "+r.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function Xe(e,t){if(null===t)return this.isReference&&ve("null is not a valid "+this.name),0;t.$$||ve('Cannot pass "'+wt(t)+'" as a '+this.name),t.$$.ptr||ve("Cannot pass deleted object as a pointer of type "+this.name);var r=t.$$.ptrType.registeredClass;return Ke(t.$$.ptr,r,this.registeredClass)}function Ze(e,t){var r;if(null===t)return this.isReference&&ve("null is not a valid "+this.name),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||ve('Cannot pass "'+wt(t)+'" as a '+this.name),t.$$.ptr||ve("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&ve("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var i=t.$$.ptrType.registeredClass;if(r=Ke(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&ve("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:ve("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,bt.toHandle((function(){n.delete()}))),null!==e&&e.push(this.rawDestructor,r)}break;default:ve("Unsupporting sharing policy")}return r}function Je(e,t){if(null===t)return this.isReference&&ve("null is not a valid "+this.name),0;t.$$||ve('Cannot pass "'+wt(t)+'" as a '+this.name),t.$$.ptr||ve("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&ve("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var r=t.$$.ptrType.registeredClass;return Ke(t.$$.ptr,r,this.registeredClass)}function Qe(e){return this.fromWireType(U[e>>2])}function et(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function tt(e){this.rawDestructor&&this.rawDestructor(e)}function rt(e){null!==e&&e.delete()}function it(e,t,r,i,n,o,s,a,d,l,u){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=o,this.sharingPolicy=s,this.rawGetPointee=a,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=u,n||void 0!==t.baseClass?this.toWireType=Ze:i?(this.toWireType=Xe,this.destructorFunction=null):(this.toWireType=Je,this.destructorFunction=null)}var nt=[];function ot(e){var t=nt[e];return t||(e>=nt.length&&(nt.length=e+1),nt[e]=t=D.get(e)),t}function st(t,r,i){return t.includes("j")?function(t,r,i){var n=e["dynCall_"+t];return i&&i.length?n.apply(null,[r].concat(i)):n.call(null,r)}(t,r,i):ot(r).apply(null,i)}function at(e,t){var r,i,n,o=(e=ce(e)).includes("j")?(r=e,i=t,n=[],function(){return n.length=0,Object.assign(n,arguments),st(r,i,n)}):ot(t);return"function"!=typeof o&&ve("unknown function pointer with signature "+e+": "+t),o}var dt=void 0;function lt(e){var t=Ht(e),r=ce(t);return Ot(t),r}function ut(e,t){var r=[],i={};throw t.forEach((function e(t){i[t]||he[t]||(pe[t]?pe[t].forEach(e):(r.push(t),i[t]=!0))})),new dt(e+": "+r.map(lt).join([", "]))}function ct(e,t){for(var r=[],i=0;i>2]);return r}function ft(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function ht(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var r=_e(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function pt(e,t,r,i,n){var o=t.length;o<2&&ve("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==t[1]&&null!==r,a=!1,d=1;d0?", ":"")+c),f+=(l?"var rv = ":"")+"invoker(fn"+(c.length>0?", ":"")+c+");\n",a)f+="runDestructors(destructors);\n";else for(d=s?1:2;d4&&0==--_t[e].refcount&&(_t[e]=void 0,mt.push(e))}function yt(){for(var e=0,t=5;t<_t.length;++t)void 0!==_t[t]&&++e;return e}function vt(){for(var e=5;e<_t.length;++e)if(void 0!==_t[e])return _t[e];return null}var bt={toValue:e=>(e||ve("Cannot use deleted val. handle = "+e),_t[e].value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var t=mt.length?mt.pop():_t.length;return _t[t]={refcount:1,value:e},t}}};function wt(e){if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e}function St(e,t){switch(t){case 2:return function(e){return this.fromWireType(T[e>>2])};case 3:return function(e){return this.fromWireType(C[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Et(e,t,r){switch(t){case 0:return r?function(e){return E[e]}:function(e){return A[e]};case 1:return r?function(e){return B[e>>1]}:function(e){return x[e>>1]};case 2:return r?function(e){return U[e>>2]}:function(e){return k[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}var At="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function Bt(e,t){for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&x[i];)++i;if((r=i<<1)-e>32&&At)return At.decode(A.subarray(e,r));for(var o="",s=0;!(s>=t/2);++s){var a=B[e+2*s>>1];if(0==a)break;o+=String.fromCharCode(a)}return o}function xt(e,t,r){if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,o=0;o>1]=s,t+=2}return B[t>>1]=0,t-i}function Ut(e){return 2*e.length}function kt(e,t){for(var r=0,i="";!(r>=t/4);){var n=U[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var o=n-65536;i+=String.fromCharCode(55296|o>>10,56320|1023&o)}else i+=String.fromCharCode(n)}return i}function Tt(e,t,r){if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,o=0;o=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o)),U[t>>2]=s,(t+=4)+4>n)break}return U[t>>2]=0,t-i}function Ct(e){for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t}var Dt={},Pt=[],Ft=[],It={};function Lt(){if(!Lt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:c||"./this.program"};for(var t in It)void 0===It[t]?delete e[t]:e[t]=It[t];var r=[];for(var t in e)r.push(t+"="+e[t]);Lt.strings=r}return Lt.strings}var Mt=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=ae.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},Rt=365,zt=146;Object.defineProperties(Mt.prototype,{read:{get:function(){return(this.mode&Rt)===Rt},set:function(e){e?this.mode|=Rt:this.mode&=-366}},write:{get:function(){return(this.mode&zt)===zt},set:function(e){e?this.mode|=zt:this.mode&=-147}},isFolder:{get:function(){return ae.isDir(this.mode)}},isDevice:{get:function(){return ae.isChrdev(this.mode)}}}),ae.FSNode=Mt,ae.staticInit(),function(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);ue=e}(),ye=e.BindingError=ge(Error,"BindingError"),be=e.InternalError=ge(Error,"InternalError"),je.prototype.isAliasOf=Ae,je.prototype.clone=$e,je.prototype.delete=He,je.prototype.isDeleted=Ve,je.prototype.deleteLater=We,e.getInheritedInstanceCount=De,e.getLiveInheritedInstances=Pe,e.flushPendingDeletes=Ie,e.setDelayFunction=Me,it.prototype.getPointee=et,it.prototype.destructor=tt,it.prototype.argPackAdvance=8,it.prototype.readValueFromPointer=Qe,it.prototype.deleteObject=rt,it.prototype.fromWireType=Oe,dt=e.UnboundTypeError=ge(Error,"UnboundTypeError"),e.count_emval_handles=yt,e.get_first_emval=vt;var Nt={p:function(e){return Gt(e+24)+24},o:function(e,t,r){throw new ee(e).init(t,r),e},C:function(e,t,r){de.varargs=r;try{var i=de.getStreamFromFD(e);switch(t){case 0:return(n=de.get())<0?-28:ae.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=de.get();return i.flags|=n,0;case 5:return n=de.get(),B[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return o=28,U[$t()>>2]=o,-1}}catch(e){if(void 0===ae||!(e instanceof ae.ErrnoError))throw e;return-e.errno}var o},w:function(e,t,r,i){de.varargs=i;try{t=de.getStr(t),t=de.calculateAt(e,t);var n=i?de.get():0;return ae.open(t,r,n).fd}catch(e){if(void 0===ae||!(e instanceof ae.ErrnoError))throw e;return-e.errno}},t:function(e,t,r,i,n){},E:function(e,t,r,i,n){var o=le(r);Ee(e,{name:t=ce(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?i:n},argPackAdvance:8,readValueFromPointer:function(e){var i;if(1===r)i=E;else if(2===r)i=B;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+t);i=U}return this.fromWireType(i[e>>o])},destructorFunction:null})},s:function(t,r,i,n,o,s,a,d,l,u,c,f,h){c=ce(c),s=at(o,s),d&&(d=at(a,d)),u&&(u=at(l,u)),h=at(f,h);var p=me(c);!function(t,r,i){e.hasOwnProperty(t)?((void 0===i||void 0!==e[t].overloadTable&&void 0!==e[t].overloadTable[i])&&ve("Cannot register public name '"+t+"' twice"),qe(e,t,t),e.hasOwnProperty(i)&&ve("Cannot register multiple overloads of a function with the same number of arguments ("+i+")!"),e[t].overloadTable[i]=r):(e[t]=r,void 0!==i&&(e[t].numArguments=i))}(p,(function(){ut("Cannot construct "+c+" due to unbound types",[n])})),Se([t,r,i],n?[n]:[],(function(r){var i,o;r=r[0],o=n?(i=r.registeredClass).instancePrototype:je.prototype;var a=_e(p,(function(){if(Object.getPrototypeOf(this)!==l)throw new ye("Use 'new' to construct "+c);if(void 0===f.constructor_body)throw new ye(c+" has no accessible constructor");var e=f.constructor_body[arguments.length];if(void 0===e)throw new ye("Tried to invoke ctor of "+c+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(f.constructor_body).toString()+") parameters instead!");return e.apply(this,arguments)})),l=Object.create(o,{constructor:{value:a}});a.prototype=l;var f=new Ye(c,a,l,h,i,s,d,u),m=new it(c,f,!0,!1,!1),_=new it(c+"*",f,!1,!1,!1),g=new it(c+" const*",f,!1,!0,!1);return Ce[t]={pointerType:_,constPointerType:g},function(t,r,i){e.hasOwnProperty(t)||we("Replacing nonexistant public symbol"),void 0!==e[t].overloadTable&&void 0!==i?e[t].overloadTable[i]=r:(e[t]=r,e[t].argCount=i)}(p,a),[m,_,g]}))},q:function(e,t,r,i,n,o){w(t>0);var s=ct(t,r);n=at(i,n),Se([],[e],(function(e){var r="constructor "+(e=e[0]).name;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new ye("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+e.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return e.registeredClass.constructor_body[t-1]=()=>{ut("Cannot construct "+e.name+" due to unbound types",s)},Se([],s,(function(i){return i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=pt(r,i,null,n,o),[]})),[]}))},d:function(e,t,r,i,n,o,s,a){var d=ct(r,i);t=ce(t),o=at(n,o),Se([],[e],(function(e){var i=(e=e[0]).name+"."+t;function n(){ut("Cannot call "+i+" due to unbound types",d)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),a&&e.registeredClass.pureVirtualFunctions.push(t);var l=e.registeredClass.instancePrototype,u=l[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,l[t]=n):(qe(l,t,i),l[t].overloadTable[r-2]=n),Se([],d,(function(n){var a=pt(i,n,e,o,s);return void 0===l[t].overloadTable?(a.argCount=r-2,l[t]=a):l[t].overloadTable[r-2]=a,[]})),[]}))},D:function(e,t){Ee(e,{name:t=ce(t),fromWireType:function(e){var t=bt.toValue(e);return gt(e),t},toWireType:function(e,t){return bt.toHandle(t)},argPackAdvance:8,readValueFromPointer:Qe,destructorFunction:null})},l:function(e,t,r){var i=le(r);Ee(e,{name:t=ce(t),fromWireType:function(e){return e},toWireType:function(e,t){return t},argPackAdvance:8,readValueFromPointer:St(t,i),destructorFunction:null})},c:function(e,t,r,i,n){t=ce(t);var o=le(r),s=e=>e;if(0===i){var a=32-8*r;s=e=>e<>>a}var d=t.includes("unsigned");Ee(e,{name:t,fromWireType:s,toWireType:d?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:8,readValueFromPointer:Et(t,o,0!==i),destructorFunction:null})},b:function(e,t,r){var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=k,r=t[e>>=2],n=t[e+1];return new i(S,n,r)}Ee(e,{name:r=ce(r),fromWireType:n,argPackAdvance:8,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},k:function(e,t){var r="std::string"===(t=ce(t));Ee(e,{name:t,fromWireType:function(e){var t,i=k[e>>2],n=e+4;if(r)for(var o=n,s=0;s<=i;++s){var a=n+s;if(s==i||0==A[a]){var d=I(o,a-o);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),o=a+1}}else{var l=new Array(i);for(s=0;s>2]=i,r&&n)L(t,A,s,i+1);else if(n)for(var a=0;a255&&(Ot(s),ve("String has UTF-16 code units that do not fit in 8 bits")),A[s+a]=d}else for(a=0;ax,a=1):4===t&&(i=kt,n=Tt,s=Ct,o=()=>k,a=2),Ee(e,{name:r,fromWireType:function(e){for(var r,n=k[e>>2],s=o(),d=e+4,l=0;l<=n;++l){var u=e+4+l*t;if(l==n||0==s[u>>a]){var c=i(d,u-d);void 0===r?r=c:(r+=String.fromCharCode(0),r+=c),d=u+t}}return Ot(e),r},toWireType:function(e,i){"string"!=typeof i&&ve("Cannot pass non-string to C++ string type "+r);var o=s(i),d=Gt(4+o+t);return k[d>>2]=o>>a,n(i,d+4,o+t),null!==e&&e.push(Ot,d),d},argPackAdvance:8,readValueFromPointer:Qe,destructorFunction:function(e){Ot(e)}})},n:function(e,t){Ee(e,{isVoid:!0,name:t=ce(t),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})},e:function(){return Date.now()},i:function(e,t,r,i){var n,o;(e=Pt[e])(t=bt.toValue(t),r=void 0===(o=Dt[n=r])?ce(n):o,null,i)},g:gt,m:function(e,t){var r=function(e,t){for(var r,i,n,o=new Array(e),s=0;s>2],i="parameter "+s,n=void 0,void 0===(n=he[r])&&ve(i+" has unknown type "+lt(r)),n);return o}(e,t),i=r[0],n=i.name+"_$"+r.slice(1).map((function(e){return e.name})).join("_")+"$",o=Ft[n];if(void 0!==o)return o;for(var s=["retType"],a=[i],d="",l=0;l>2]=o,function(e,t,r){for(var i=0;i>0]=e.charCodeAt(i);r||(E[t>>0]=0)}(i,o),r+=i.length+1})),0},z:function(e,t){var r=Lt();k[e>>2]=r.length;var i=0;return r.forEach((function(e){i+=e.length+1})),k[t>>2]=i,0},j:function(e){try{var t=de.getStreamFromFD(e);return ae.close(t),0}catch(e){if(void 0===ae||!(e instanceof ae.ErrnoError))throw e;return e.errno}},x:function(e,t){try{var r=de.getStreamFromFD(e),i=r.tty?2:ae.isDir(r.mode)?3:ae.isLink(r.mode)?7:4;return E[t>>0]=i,0}catch(e){if(void 0===ae||!(e instanceof ae.ErrnoError))throw e;return e.errno}},B:function(e,t,r,i){try{var n=function(e,t,r,i){for(var n=0,o=0;o>2],a=k[t+4>>2];t+=8;var d=ae.read(e,E,s,a,i);if(d<0)return-1;if(n+=d,d>2]=n,0}catch(e){if(void 0===ae||!(e instanceof ae.ErrnoError))throw e;return e.errno}},r:function(e,t,r,i,n){try{var o=(d=r)+2097152>>>0<4194305-!!(a=t)?(a>>>0)+4294967296*d:NaN;if(isNaN(o))return 61;var s=de.getStreamFromFD(e);return ae.llseek(s,o,i),O=[s.position>>>0,(N=s.position,+Math.abs(N)>=1?N>0?(0|Math.min(+Math.floor(N/4294967296),4294967295))>>>0:~~+Math.ceil((N-+(~~N>>>0))/4294967296)>>>0:0)],U[n>>2]=O[0],U[n+4>>2]=O[1],s.getdents&&0===o&&0===i&&(s.getdents=null),0}catch(e){if(void 0===ae||!(e instanceof ae.ErrnoError))throw e;return e.errno}var a,d},h:function(e,t,r,i){try{var n=function(e,t,r,i){for(var n=0,o=0;o>2],a=k[t+4>>2];t+=8;var d=ae.write(e,E,s,a,i);if(d<0)return-1;n+=d}return n}(de.getStreamFromFD(e),t,r);return k[i>>2]=n,0}catch(e){if(void 0===ae||!(e instanceof ae.ErrnoError))throw e;return e.errno}},u:function(e){}};!function(){var t={a:Nt};function r(t,r){var i,n,o=t.exports;e.asm=o,g=e.asm.F,i=g.buffer,S=i,e.HEAP8=E=new Int8Array(i),e.HEAP16=B=new Int16Array(i),e.HEAP32=U=new Int32Array(i),e.HEAPU8=A=new Uint8Array(i),e.HEAPU16=x=new Uint16Array(i),e.HEAPU32=k=new Uint32Array(i),e.HEAPF32=T=new Float32Array(i),e.HEAPF64=C=new Float64Array(i),D=e.asm.J,n=e.asm.G,$.unshift(n),q()}function n(e){r(e.instance)}function s(e){return function(){if(!_&&(f||h)){if("function"==typeof fetch&&!X(R))return fetch(R,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+R+"'";return e.arrayBuffer()})).catch((function(){return Z(R)}));if(o)return new Promise((function(e,t){o(R,(function(t){e(new Uint8Array(t))}),t)}))}return Promise.resolve().then((function(){return Z(R)}))}().then((function(e){return WebAssembly.instantiate(e,t)})).then((function(e){return e})).then(e,(function(e){v("failed to asynchronously prepare wasm: "+e),Y(e)}))}if(j(),e.instantiateWasm)try{return e.instantiateWasm(t,r)}catch(e){return v("Module.instantiateWasm callback failed with error: "+e),!1}(_||"function"!=typeof WebAssembly.instantiateStreaming||K(R)||X(R)||p||"function"!=typeof fetch?s(n):fetch(R,{credentials:"same-origin"}).then((function(e){return WebAssembly.instantiateStreaming(e,t).then(n,(function(e){return v("wasm streaming compile failed: "+e),v("falling back to ArrayBuffer instantiation"),s(n)}))}))).catch(i)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.G).apply(null,arguments)};var Ot=e._free=function(){return(Ot=e._free=e.asm.H).apply(null,arguments)},Gt=e._malloc=function(){return(Gt=e._malloc=e.asm.I).apply(null,arguments)},$t=e.___errno_location=function(){return($t=e.___errno_location=e.asm.K).apply(null,arguments)},Ht=e.___getTypeName=function(){return(Ht=e.___getTypeName=e.asm.L).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.M).apply(null,arguments)};var Vt,Wt=e._emscripten_builtin_memalign=function(){return(Wt=e._emscripten_builtin_memalign=e.asm.N).apply(null,arguments)},jt=e.___cxa_is_pointer_type=function(){return(jt=e.___cxa_is_pointer_type=e.asm.O).apply(null,arguments)};function qt(r){function i(){Vt||(Vt=!0,e.calledRun=!0,b||(e.noFSInit||ae.init.initialized||ae.init(),ae.ignorePermissions=!1,Q($),t(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),function(){if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)t=e.postRun.shift(),H.unshift(t);var t;Q(H)}()))}V>0||(function(){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)t=e.preRun.shift(),G.unshift(t);var t;Q(G)}(),V>0||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),i()}),1)):i()))}if(e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.P).apply(null,arguments)},e._ff_h264_cabac_tables=74748,W=function e(){Vt||qt(),Vt||(W=e)},e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return qt(),e.ready}),s=(()=>{var e="undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href;return function(t){var r,i;(t=void 0!==(t=t||{})?t:{}).ready=new Promise((function(e,t){r=e,i=t})),(t=void 0!==t?t:{}).locateFile=function(e){return"decoder-pro-audio.wasm"==e&&"undefined"!=typeof JESSIBUCA_PRO_AUDIO_WASM_URL&&""!=JESSIBUCA_PRO_AUDIO_WASM_URL?JESSIBUCA_PRO_AUDIO_WASM_URL:e};var n,o,s,a,d,l,u=Object.assign({},t),c="./this.program",f="object"==typeof window,h="function"==typeof importScripts,p="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,m="";p?(m=h?require("path").dirname(m)+"/":__dirname+"/",l=()=>{d||(a=require("fs"),d=require("path"))},n=function(e,t){return l(),e=d.normalize(e),a.readFileSync(e,t?void 0:"utf8")},s=e=>{var t=n(e,!0);return t.buffer||(t=new Uint8Array(t)),t},o=(e,t,r)=>{l(),e=d.normalize(e),a.readFile(e,(function(e,i){e?r(e):t(i.buffer)}))},process.argv.length>1&&(c=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(e){if(!(e instanceof J))throw e})),process.on("unhandledRejection",(function(e){throw e})),t.inspect=function(){return"[Emscripten Module object]"}):(f||h)&&(h?m=self.location.href:"undefined"!=typeof document&&document.currentScript&&(m=document.currentScript.src),e&&(m=e),m=0!==m.indexOf("blob:")?m.substr(0,m.replace(/[?#].*/,"").lastIndexOf("/")+1):"",n=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},h&&(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),o=(e,t,r)=>{var i=new XMLHttpRequest;i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?t(i.response):r()},i.onerror=r,i.send(null)});var _=t.print||console.log.bind(console),g=t.printErr||console.warn.bind(console);Object.assign(t,u),u=null,t.arguments&&t.arguments,t.thisProgram&&(c=t.thisProgram),t.quit&&t.quit;var y,v;t.wasmBinary&&(y=t.wasmBinary),t.noExitRuntime,"object"!=typeof WebAssembly&&V("no native wasm support detected");var b=!1;function w(e,t){e||V(t)}var S,E,A,B,x,U,k,T,C,D,P="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function F(e,t,r){for(var i=t+r,n=t;e[n]&&!(n>=i);)++n;if(n-t>16&&e.buffer&&P)return P.decode(e.subarray(t,n));for(var o="";t>10,56320|1023&l)}}else o+=String.fromCharCode((31&s)<<6|a)}else o+=String.fromCharCode(s)}return o}function I(e,t){return e?F(A,e,t):""}function L(e,t,r,i){if(!(i>0))return 0;for(var n=r,o=r+i-1,s=0;s=55296&&a<=57343)a=65536+((1023&a)<<10)|1023&e.charCodeAt(++s);if(a<=127){if(r>=o)break;t[r++]=a}else if(a<=2047){if(r+1>=o)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=o)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=o)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a}}return t[r]=0,r-n}function M(e){for(var t=0,r=0;r=55296&&i<=57343?(t+=4,++r):t+=3}return t}t.INITIAL_MEMORY;var R=[],z=[],N=[];var O=0,G=null;function $(e){O++,t.monitorRunDependencies&&t.monitorRunDependencies(O)}function H(e){if(O--,t.monitorRunDependencies&&t.monitorRunDependencies(O),0==O&&G){var r=G;G=null,r()}}function V(e){t.onAbort&&t.onAbort(e),g(e="Aborted("+e+")"),b=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw i(r),r}var W,j,q,Y;function K(e){return e.startsWith("data:application/octet-stream;base64,")}function X(e){return e.startsWith("file://")}function Z(e){try{if(e==W&&y)return new Uint8Array(y);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}catch(e){V(e)}}function J(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Q(e){for(;e.length>0;)e.shift()(t)}function ee(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(e){k[this.ptr+4>>2]=e},this.get_type=function(){return k[this.ptr+4>>2]},this.set_destructor=function(e){k[this.ptr+8>>2]=e},this.get_destructor=function(){return k[this.ptr+8>>2]},this.set_refcount=function(e){U[this.ptr>>2]=e},this.set_caught=function(e){e=e?1:0,E[this.ptr+12>>0]=e},this.get_caught=function(){return 0!=E[this.ptr+12>>0]},this.set_rethrown=function(e){e=e?1:0,E[this.ptr+13>>0]=e},this.get_rethrown=function(){return 0!=E[this.ptr+13>>0]},this.init=function(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var e=U[this.ptr>>2];U[this.ptr>>2]=e+1},this.release_ref=function(){var e=U[this.ptr>>2];return U[this.ptr>>2]=e-1,1===e},this.set_adjusted_ptr=function(e){k[this.ptr+16>>2]=e},this.get_adjusted_ptr=function(){return k[this.ptr+16>>2]},this.get_exception_ptr=function(){if(jt(this.get_type()))return k[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}t.locateFile?K(W="decoder-pro-audio.wasm")||(j=W,W=t.locateFile?t.locateFile(j,m):m+j):W=new URL("decoder-pro-audio.wasm","undefined"==typeof document&&"undefined"==typeof location?new(require("url").URL)("file:"+__filename).href:"undefined"==typeof document?location.href:document.currentScript&&document.currentScript.src||new URL("decoder-pro.js",document.baseURI).href).toString();var te={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,i=e.length-1;i>=0;i--){var n=e[i];"."===n?e.splice(i,1):".."===n?(e.splice(i,1),r++):r&&(e.splice(i,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=te.isAbs(e),r="/"===e.substr(-1);return(e=te.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=te.splitPath(e),r=t[0],i=t[1];return r||i?(i&&(i=i.substr(0,i.length-1)),r+i):"."},basename:e=>{if("/"===e)return"/";var t=(e=(e=te.normalize(e)).replace(/\/$/,"")).lastIndexOf("/");return-1===t?e:e.substr(t+1)},join:function(){var e=Array.prototype.slice.call(arguments,0);return te.normalize(e.join("/"))},join2:(e,t)=>te.normalize(e+"/"+t)};var re={resolve:function(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var i=r>=0?arguments[r]:ae.cwd();if("string"!=typeof i)throw new TypeError("Arguments to path.resolve must be strings");if(!i)return"";e=i+"/"+e,t=te.isAbs(i)}return(t?"/":"")+(e=te.normalizeArray(e.split("/").filter((e=>!!e)),!t).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=re.resolve(e).substr(1),t=re.resolve(t).substr(1);for(var i=r(e.split("/")),n=r(t.split("/")),o=Math.min(i.length,n.length),s=o,a=0;a0?r:M(e)+1,n=new Array(i),o=L(e,n,0,n.length);return t&&(n.length=o),n}var ne={ttys:[],init:function(){},shutdown:function(){},register:function(e,t){ne.ttys[e]={input:[],output:[],ops:t},ae.registerDevice(e,ne.stream_ops)},stream_ops:{open:function(e){var t=ne.ttys[e.node.rdev];if(!t)throw new ae.ErrnoError(43);e.tty=t,e.seekable=!1},close:function(e){e.tty.ops.flush(e.tty)},flush:function(e){e.tty.ops.flush(e.tty)},read:function(e,t,r,i,n){if(!e.tty||!e.tty.ops.get_char)throw new ae.ErrnoError(60);for(var o=0,s=0;s0?r.slice(0,i).toString("utf-8"):null}else"undefined"!=typeof window&&"function"==typeof window.prompt?null!==(t=window.prompt("Input: "))&&(t+="\n"):"function"==typeof readline&&null!==(t=readline())&&(t+="\n");if(!t)return null;e.input=ie(t,!0)}return e.input.shift()},put_char:function(e,t){null===t||10===t?(_(F(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(_(F(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,t){null===t||10===t?(g(F(e.output,0)),e.output=[]):0!=t&&e.output.push(t)},flush:function(e){e.output&&e.output.length>0&&(g(F(e.output,0)),e.output=[])}}};function oe(e){e=function(e,t){return Math.ceil(e/t)*t}(e,65536);var t=Wt(65536,e);return t?(function(e,t){A.fill(0,e,e+t)}(t,e),t):0}var se={ops_table:null,mount:function(e){return se.createNode(null,"/",16895,0)},createNode:function(e,t,r,i){if(ae.isBlkdev(r)||ae.isFIFO(r))throw new ae.ErrnoError(63);se.ops_table||(se.ops_table={dir:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr,lookup:se.node_ops.lookup,mknod:se.node_ops.mknod,rename:se.node_ops.rename,unlink:se.node_ops.unlink,rmdir:se.node_ops.rmdir,readdir:se.node_ops.readdir,symlink:se.node_ops.symlink},stream:{llseek:se.stream_ops.llseek}},file:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr},stream:{llseek:se.stream_ops.llseek,read:se.stream_ops.read,write:se.stream_ops.write,allocate:se.stream_ops.allocate,mmap:se.stream_ops.mmap,msync:se.stream_ops.msync}},link:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr,readlink:se.node_ops.readlink},stream:{}},chrdev:{node:{getattr:se.node_ops.getattr,setattr:se.node_ops.setattr},stream:ae.chrdev_stream_ops}});var n=ae.createNode(e,t,r,i);return ae.isDir(n.mode)?(n.node_ops=se.ops_table.dir.node,n.stream_ops=se.ops_table.dir.stream,n.contents={}):ae.isFile(n.mode)?(n.node_ops=se.ops_table.file.node,n.stream_ops=se.ops_table.file.stream,n.usedBytes=0,n.contents=null):ae.isLink(n.mode)?(n.node_ops=se.ops_table.link.node,n.stream_ops=se.ops_table.link.stream):ae.isChrdev(n.mode)&&(n.node_ops=se.ops_table.chrdev.node,n.stream_ops=se.ops_table.chrdev.stream),n.timestamp=Date.now(),e&&(e.contents[t]=n,e.timestamp=n.timestamp),n},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage:function(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var i=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(i.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr:function(e){var t={};return t.dev=ae.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,ae.isDir(e.mode)?t.size=4096:ae.isFile(e.mode)?t.size=e.usedBytes:ae.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr:function(e,t){void 0!==t.mode&&(e.mode=t.mode),void 0!==t.timestamp&&(e.timestamp=t.timestamp),void 0!==t.size&&se.resizeFileStorage(e,t.size)},lookup:function(e,t){throw ae.genericErrors[44]},mknod:function(e,t,r,i){return se.createNode(e,t,r,i)},rename:function(e,t,r){if(ae.isDir(e.mode)){var i;try{i=ae.lookupNode(t,r)}catch(e){}if(i)for(var n in i.contents)throw new ae.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=r,t.contents[r]=e,t.timestamp=e.parent.timestamp,e.parent=t},unlink:function(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir:function(e,t){var r=ae.lookupNode(e,t);for(var i in r.contents)throw new ae.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir:function(e){var t=[".",".."];for(var r in e.contents)e.contents.hasOwnProperty(r)&&t.push(r);return t},symlink:function(e,t,r){var i=se.createNode(e,t,41471,0);return i.link=r,i},readlink:function(e){if(!ae.isLink(e.mode))throw new ae.ErrnoError(28);return e.link}},stream_ops:{read:function(e,t,r,i,n){var o=e.node.contents;if(n>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-n,i);if(s>8&&o.subarray)t.set(o.subarray(n,n+s),r);else for(var a=0;a0||r+t1&&void 0!==arguments[1]?arguments[1]:{};if(!(e=re.resolve(ae.cwd(),e)))return{path:"",node:null};var r={follow_mount:!0,recurse_count:0};if(t=Object.assign(r,t),t.recurse_count>8)throw new ae.ErrnoError(32);for(var i=te.normalizeArray(e.split("/").filter((e=>!!e)),!1),n=ae.root,o="/",s=0;s40)throw new ae.ErrnoError(32)}}return{path:o,node:n}},getPath:e=>{for(var t;;){if(ae.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?r+"/"+t:r+t:r}t=t?e.name+"/"+t:e.name,e=e.parent}},hashName:(e,t)=>{for(var r=0,i=0;i>>0)%ae.nameTable.length},hashAddNode:e=>{var t=ae.hashName(e.parent.id,e.name);e.name_next=ae.nameTable[t],ae.nameTable[t]=e},hashRemoveNode:e=>{var t=ae.hashName(e.parent.id,e.name);if(ae.nameTable[t]===e)ae.nameTable[t]=e.name_next;else for(var r=ae.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode:(e,t)=>{var r=ae.mayLookup(e);if(r)throw new ae.ErrnoError(r,e);for(var i=ae.hashName(e.id,t),n=ae.nameTable[i];n;n=n.name_next){var o=n.name;if(n.parent.id===e.id&&o===t)return n}return ae.lookup(e,t)},createNode:(e,t,r,i)=>{var n=new ae.FSNode(e,t,r,i);return ae.hashAddNode(n),n},destroyNode:e=>{ae.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>49152==(49152&e),flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:e=>{var t=ae.flagModes[e];if(void 0===t)throw new Error("Unknown file open mode: "+e);return t},flagsToPermissionString:e=>{var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>ae.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup:e=>{var t=ae.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate:(e,t)=>{try{ae.lookupNode(e,t);return 20}catch(e){}return ae.nodePermissions(e,"wx")},mayDelete:(e,t,r)=>{var i;try{i=ae.lookupNode(e,t)}catch(e){return e.errno}var n=ae.nodePermissions(e,"wx");if(n)return n;if(r){if(!ae.isDir(i.mode))return 54;if(ae.isRoot(i)||ae.getPath(i)===ae.cwd())return 10}else if(ae.isDir(i.mode))return 31;return 0},mayOpen:(e,t)=>e?ae.isLink(e.mode)?32:ae.isDir(e.mode)&&("r"!==ae.flagsToPermissionString(t)||512&t)?31:ae.nodePermissions(e,ae.flagsToPermissionString(t)):44,MAX_OPEN_FDS:4096,nextfd:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ae.MAX_OPEN_FDS;for(var r=e;r<=t;r++)if(!ae.streams[r])return r;throw new ae.ErrnoError(33)},getStream:e=>ae.streams[e],createStream:(e,t,r)=>{ae.FSStream||(ae.FSStream=function(){this.shared={}},ae.FSStream.prototype={},Object.defineProperties(ae.FSStream.prototype,{object:{get:function(){return this.node},set:function(e){this.node=e}},isRead:{get:function(){return 1!=(2097155&this.flags)}},isWrite:{get:function(){return 0!=(2097155&this.flags)}},isAppend:{get:function(){return 1024&this.flags}},flags:{get:function(){return this.shared.flags},set:function(e){this.shared.flags=e}},position:{get:function(){return this.shared.position},set:function(e){this.shared.position=e}}})),e=Object.assign(new ae.FSStream,e);var i=ae.nextfd(t,r);return e.fd=i,ae.streams[i]=e,e},closeStream:e=>{ae.streams[e]=null},chrdev_stream_ops:{open:e=>{var t=ae.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:()=>{throw new ae.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice:(e,t)=>{ae.devices[e]={stream_ops:t}},getDevice:e=>ae.devices[e],getMounts:e=>{for(var t=[],r=[e];r.length;){var i=r.pop();t.push(i),r.push.apply(r,i.mounts)}return t},syncfs:(e,t)=>{"function"==typeof e&&(t=e,e=!1),ae.syncFSRequests++,ae.syncFSRequests>1&&g("warning: "+ae.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var r=ae.getMounts(ae.root.mount),i=0;function n(e){return ae.syncFSRequests--,t(e)}function o(e){if(e)return o.errored?void 0:(o.errored=!0,n(e));++i>=r.length&&n(null)}r.forEach((t=>{if(!t.type.syncfs)return o(null);t.type.syncfs(t,e,o)}))},mount:(e,t,r)=>{var i,n="/"===r,o=!r;if(n&&ae.root)throw new ae.ErrnoError(10);if(!n&&!o){var s=ae.lookupPath(r,{follow_mount:!1});if(r=s.path,i=s.node,ae.isMountpoint(i))throw new ae.ErrnoError(10);if(!ae.isDir(i.mode))throw new ae.ErrnoError(54)}var a={type:e,opts:t,mountpoint:r,mounts:[]},d=e.mount(a);return d.mount=a,a.root=d,n?ae.root=d:i&&(i.mounted=a,i.mount&&i.mount.mounts.push(a)),d},unmount:e=>{var t=ae.lookupPath(e,{follow_mount:!1});if(!ae.isMountpoint(t.node))throw new ae.ErrnoError(28);var r=t.node,i=r.mounted,n=ae.getMounts(i);Object.keys(ae.nameTable).forEach((e=>{for(var t=ae.nameTable[e];t;){var r=t.name_next;n.includes(t.mount)&&ae.destroyNode(t),t=r}})),r.mounted=null;var o=r.mount.mounts.indexOf(i);r.mount.mounts.splice(o,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod:(e,t,r)=>{var i=ae.lookupPath(e,{parent:!0}).node,n=te.basename(e);if(!n||"."===n||".."===n)throw new ae.ErrnoError(28);var o=ae.mayCreate(i,n);if(o)throw new ae.ErrnoError(o);if(!i.node_ops.mknod)throw new ae.ErrnoError(63);return i.node_ops.mknod(i,n,t,r)},create:(e,t)=>(t=void 0!==t?t:438,t&=4095,t|=32768,ae.mknod(e,t,0)),mkdir:(e,t)=>(t=void 0!==t?t:511,t&=1023,t|=16384,ae.mknod(e,t,0)),mkdirTree:(e,t)=>{for(var r=e.split("/"),i="",n=0;n(void 0===r&&(r=t,t=438),t|=8192,ae.mknod(e,t,r)),symlink:(e,t)=>{if(!re.resolve(e))throw new ae.ErrnoError(44);var r=ae.lookupPath(t,{parent:!0}).node;if(!r)throw new ae.ErrnoError(44);var i=te.basename(t),n=ae.mayCreate(r,i);if(n)throw new ae.ErrnoError(n);if(!r.node_ops.symlink)throw new ae.ErrnoError(63);return r.node_ops.symlink(r,i,e)},rename:(e,t)=>{var r,i,n=te.dirname(e),o=te.dirname(t),s=te.basename(e),a=te.basename(t);if(r=ae.lookupPath(e,{parent:!0}).node,i=ae.lookupPath(t,{parent:!0}).node,!r||!i)throw new ae.ErrnoError(44);if(r.mount!==i.mount)throw new ae.ErrnoError(75);var d,l=ae.lookupNode(r,s),u=re.relative(e,o);if("."!==u.charAt(0))throw new ae.ErrnoError(28);if("."!==(u=re.relative(t,n)).charAt(0))throw new ae.ErrnoError(55);try{d=ae.lookupNode(i,a)}catch(e){}if(l!==d){var c=ae.isDir(l.mode),f=ae.mayDelete(r,s,c);if(f)throw new ae.ErrnoError(f);if(f=d?ae.mayDelete(i,a,c):ae.mayCreate(i,a))throw new ae.ErrnoError(f);if(!r.node_ops.rename)throw new ae.ErrnoError(63);if(ae.isMountpoint(l)||d&&ae.isMountpoint(d))throw new ae.ErrnoError(10);if(i!==r&&(f=ae.nodePermissions(r,"w")))throw new ae.ErrnoError(f);ae.hashRemoveNode(l);try{r.node_ops.rename(l,i,a)}catch(e){throw e}finally{ae.hashAddNode(l)}}},rmdir:e=>{var t=ae.lookupPath(e,{parent:!0}).node,r=te.basename(e),i=ae.lookupNode(t,r),n=ae.mayDelete(t,r,!0);if(n)throw new ae.ErrnoError(n);if(!t.node_ops.rmdir)throw new ae.ErrnoError(63);if(ae.isMountpoint(i))throw new ae.ErrnoError(10);t.node_ops.rmdir(t,r),ae.destroyNode(i)},readdir:e=>{var t=ae.lookupPath(e,{follow:!0}).node;if(!t.node_ops.readdir)throw new ae.ErrnoError(54);return t.node_ops.readdir(t)},unlink:e=>{var t=ae.lookupPath(e,{parent:!0}).node;if(!t)throw new ae.ErrnoError(44);var r=te.basename(e),i=ae.lookupNode(t,r),n=ae.mayDelete(t,r,!1);if(n)throw new ae.ErrnoError(n);if(!t.node_ops.unlink)throw new ae.ErrnoError(63);if(ae.isMountpoint(i))throw new ae.ErrnoError(10);t.node_ops.unlink(t,r),ae.destroyNode(i)},readlink:e=>{var t=ae.lookupPath(e).node;if(!t)throw new ae.ErrnoError(44);if(!t.node_ops.readlink)throw new ae.ErrnoError(28);return re.resolve(ae.getPath(t.parent),t.node_ops.readlink(t))},stat:(e,t)=>{var r=ae.lookupPath(e,{follow:!t}).node;if(!r)throw new ae.ErrnoError(44);if(!r.node_ops.getattr)throw new ae.ErrnoError(63);return r.node_ops.getattr(r)},lstat:e=>ae.stat(e,!0),chmod:(e,t,r)=>{var i;"string"==typeof e?i=ae.lookupPath(e,{follow:!r}).node:i=e;if(!i.node_ops.setattr)throw new ae.ErrnoError(63);i.node_ops.setattr(i,{mode:4095&t|-4096&i.mode,timestamp:Date.now()})},lchmod:(e,t)=>{ae.chmod(e,t,!0)},fchmod:(e,t)=>{var r=ae.getStream(e);if(!r)throw new ae.ErrnoError(8);ae.chmod(r.node,t)},chown:(e,t,r,i)=>{var n;"string"==typeof e?n=ae.lookupPath(e,{follow:!i}).node:n=e;if(!n.node_ops.setattr)throw new ae.ErrnoError(63);n.node_ops.setattr(n,{timestamp:Date.now()})},lchown:(e,t,r)=>{ae.chown(e,t,r,!0)},fchown:(e,t,r)=>{var i=ae.getStream(e);if(!i)throw new ae.ErrnoError(8);ae.chown(i.node,t,r)},truncate:(e,t)=>{if(t<0)throw new ae.ErrnoError(28);var r;"string"==typeof e?r=ae.lookupPath(e,{follow:!0}).node:r=e;if(!r.node_ops.setattr)throw new ae.ErrnoError(63);if(ae.isDir(r.mode))throw new ae.ErrnoError(31);if(!ae.isFile(r.mode))throw new ae.ErrnoError(28);var i=ae.nodePermissions(r,"w");if(i)throw new ae.ErrnoError(i);r.node_ops.setattr(r,{size:t,timestamp:Date.now()})},ftruncate:(e,t)=>{var r=ae.getStream(e);if(!r)throw new ae.ErrnoError(8);if(0==(2097155&r.flags))throw new ae.ErrnoError(28);ae.truncate(r.node,t)},utime:(e,t,r)=>{var i=ae.lookupPath(e,{follow:!0}).node;i.node_ops.setattr(i,{timestamp:Math.max(t,r)})},open:(e,r,i)=>{if(""===e)throw new ae.ErrnoError(44);var n;if(i=void 0===i?438:i,i=64&(r="string"==typeof r?ae.modeStringToFlags(r):r)?4095&i|32768:0,"object"==typeof e)n=e;else{e=te.normalize(e);try{n=ae.lookupPath(e,{follow:!(131072&r)}).node}catch(e){}}var o=!1;if(64&r)if(n){if(128&r)throw new ae.ErrnoError(20)}else n=ae.mknod(e,i,0),o=!0;if(!n)throw new ae.ErrnoError(44);if(ae.isChrdev(n.mode)&&(r&=-513),65536&r&&!ae.isDir(n.mode))throw new ae.ErrnoError(54);if(!o){var s=ae.mayOpen(n,r);if(s)throw new ae.ErrnoError(s)}512&r&&!o&&ae.truncate(n,0),r&=-131713;var a=ae.createStream({node:n,path:ae.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return a.stream_ops.open&&a.stream_ops.open(a),!t.logReadFiles||1&r||(ae.readFiles||(ae.readFiles={}),e in ae.readFiles||(ae.readFiles[e]=1)),a},close:e=>{if(ae.isClosed(e))throw new ae.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{ae.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek:(e,t,r)=>{if(ae.isClosed(e))throw new ae.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new ae.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new ae.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read:(e,t,r,i,n)=>{if(i<0||n<0)throw new ae.ErrnoError(28);if(ae.isClosed(e))throw new ae.ErrnoError(8);if(1==(2097155&e.flags))throw new ae.ErrnoError(8);if(ae.isDir(e.node.mode))throw new ae.ErrnoError(31);if(!e.stream_ops.read)throw new ae.ErrnoError(28);var o=void 0!==n;if(o){if(!e.seekable)throw new ae.ErrnoError(70)}else n=e.position;var s=e.stream_ops.read(e,t,r,i,n);return o||(e.position+=s),s},write:(e,t,r,i,n,o)=>{if(i<0||n<0)throw new ae.ErrnoError(28);if(ae.isClosed(e))throw new ae.ErrnoError(8);if(0==(2097155&e.flags))throw new ae.ErrnoError(8);if(ae.isDir(e.node.mode))throw new ae.ErrnoError(31);if(!e.stream_ops.write)throw new ae.ErrnoError(28);e.seekable&&1024&e.flags&&ae.llseek(e,0,2);var s=void 0!==n;if(s){if(!e.seekable)throw new ae.ErrnoError(70)}else n=e.position;var a=e.stream_ops.write(e,t,r,i,n,o);return s||(e.position+=a),a},allocate:(e,t,r)=>{if(ae.isClosed(e))throw new ae.ErrnoError(8);if(t<0||r<=0)throw new ae.ErrnoError(28);if(0==(2097155&e.flags))throw new ae.ErrnoError(8);if(!ae.isFile(e.node.mode)&&!ae.isDir(e.node.mode))throw new ae.ErrnoError(43);if(!e.stream_ops.allocate)throw new ae.ErrnoError(138);e.stream_ops.allocate(e,t,r)},mmap:(e,t,r,i,n)=>{if(0!=(2&i)&&0==(2&n)&&2!=(2097155&e.flags))throw new ae.ErrnoError(2);if(1==(2097155&e.flags))throw new ae.ErrnoError(2);if(!e.stream_ops.mmap)throw new ae.ErrnoError(43);return e.stream_ops.mmap(e,t,r,i,n)},msync:(e,t,r,i,n)=>e&&e.stream_ops.msync?e.stream_ops.msync(e,t,r,i,n):0,munmap:e=>0,ioctl:(e,t,r)=>{if(!e.stream_ops.ioctl)throw new ae.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding)throw new Error('Invalid encoding type "'+t.encoding+'"');var r,i=ae.open(e,t.flags),n=ae.stat(e),o=n.size,s=new Uint8Array(o);return ae.read(i,s,0,o,0),"utf8"===t.encoding?r=F(s,0):"binary"===t.encoding&&(r=s),ae.close(i),r},writeFile:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r.flags=r.flags||577;var i=ae.open(e,r.flags,r.mode);if("string"==typeof t){var n=new Uint8Array(M(t)+1),o=L(t,n,0,n.length);ae.write(i,n,0,o,void 0,r.canOwn)}else{if(!ArrayBuffer.isView(t))throw new Error("Unsupported data type");ae.write(i,t,0,t.byteLength,void 0,r.canOwn)}ae.close(i)},cwd:()=>ae.currentPath,chdir:e=>{var t=ae.lookupPath(e,{follow:!0});if(null===t.node)throw new ae.ErrnoError(44);if(!ae.isDir(t.node.mode))throw new ae.ErrnoError(54);var r=ae.nodePermissions(t.node,"x");if(r)throw new ae.ErrnoError(r);ae.currentPath=t.path},createDefaultDirectories:()=>{ae.mkdir("/tmp"),ae.mkdir("/home"),ae.mkdir("/home/web_user")},createDefaultDevices:()=>{ae.mkdir("/dev"),ae.registerDevice(ae.makedev(1,3),{read:()=>0,write:(e,t,r,i,n)=>i}),ae.mkdev("/dev/null",ae.makedev(1,3)),ne.register(ae.makedev(5,0),ne.default_tty_ops),ne.register(ae.makedev(6,0),ne.default_tty1_ops),ae.mkdev("/dev/tty",ae.makedev(5,0)),ae.mkdev("/dev/tty1",ae.makedev(6,0));var e=function(){if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues){var e=new Uint8Array(1);return()=>(crypto.getRandomValues(e),e[0])}if(p)try{var t=require("crypto");return()=>t.randomBytes(1)[0]}catch(e){}return()=>V("randomDevice")}();ae.createDevice("/dev","random",e),ae.createDevice("/dev","urandom",e),ae.mkdir("/dev/shm"),ae.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{ae.mkdir("/proc");var e=ae.mkdir("/proc/self");ae.mkdir("/proc/self/fd"),ae.mount({mount:()=>{var t=ae.createNode(e,"fd",16895,73);return t.node_ops={lookup:(e,t)=>{var r=+t,i=ae.getStream(r);if(!i)throw new ae.ErrnoError(8);var n={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>i.path}};return n.parent=n,n}},t}},{},"/proc/self/fd")},createStandardStreams:()=>{t.stdin?ae.createDevice("/dev","stdin",t.stdin):ae.symlink("/dev/tty","/dev/stdin"),t.stdout?ae.createDevice("/dev","stdout",null,t.stdout):ae.symlink("/dev/tty","/dev/stdout"),t.stderr?ae.createDevice("/dev","stderr",null,t.stderr):ae.symlink("/dev/tty1","/dev/stderr"),ae.open("/dev/stdin",0),ae.open("/dev/stdout",1),ae.open("/dev/stderr",1)},ensureErrnoError:()=>{ae.ErrnoError||(ae.ErrnoError=function(e,t){this.node=t,this.setErrno=function(e){this.errno=e},this.setErrno(e),this.message="FS error"},ae.ErrnoError.prototype=new Error,ae.ErrnoError.prototype.constructor=ae.ErrnoError,[44].forEach((e=>{ae.genericErrors[e]=new ae.ErrnoError(e),ae.genericErrors[e].stack=""})))},staticInit:()=>{ae.ensureErrnoError(),ae.nameTable=new Array(4096),ae.mount(se,{},"/"),ae.createDefaultDirectories(),ae.createDefaultDevices(),ae.createSpecialDirectories(),ae.filesystems={MEMFS:se}},init:(e,r,i)=>{ae.init.initialized=!0,ae.ensureErrnoError(),t.stdin=e||t.stdin,t.stdout=r||t.stdout,t.stderr=i||t.stderr,ae.createStandardStreams()},quit:()=>{ae.init.initialized=!1;for(var e=0;e{var r=0;return e&&(r|=365),t&&(r|=146),r},findObject:(e,t)=>{var r=ae.analyzePath(e,t);return r.exists?r.object:null},analyzePath:(e,t)=>{try{e=(i=ae.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var i=ae.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=i.path,r.parentObject=i.node,r.name=te.basename(e),i=ae.lookupPath(e,{follow:!t}),r.exists=!0,r.path=i.path,r.object=i.node,r.name=i.node.name,r.isRoot="/"===i.path}catch(e){r.error=e.errno}return r},createPath:(e,t,r,i)=>{e="string"==typeof e?e:ae.getPath(e);for(var n=t.split("/").reverse();n.length;){var o=n.pop();if(o){var s=te.join2(e,o);try{ae.mkdir(s)}catch(e){}e=s}}return s},createFile:(e,t,r,i,n)=>{var o=te.join2("string"==typeof e?e:ae.getPath(e),t),s=ae.getMode(i,n);return ae.create(o,s)},createDataFile:(e,t,r,i,n,o)=>{var s=t;e&&(e="string"==typeof e?e:ae.getPath(e),s=t?te.join2(e,t):e);var a=ae.getMode(i,n),d=ae.create(s,a);if(r){if("string"==typeof r){for(var l=new Array(r.length),u=0,c=r.length;u{var n=te.join2("string"==typeof e?e:ae.getPath(e),t),o=ae.getMode(!!r,!!i);ae.createDevice.major||(ae.createDevice.major=64);var s=ae.makedev(ae.createDevice.major++,0);return ae.registerDevice(s,{open:e=>{e.seekable=!1},close:e=>{i&&i.buffer&&i.buffer.length&&i(10)},read:(e,t,i,n,o)=>{for(var s=0,a=0;a{for(var s=0;s{if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if("undefined"!=typeof XMLHttpRequest)throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(!n)throw new Error("Cannot load without read() or XMLHttpRequest.");try{e.contents=ie(n(e.url),!0),e.usedBytes=e.contents.length}catch(e){throw new ae.ErrnoError(29)}},createLazyFile:(e,t,r,i,n)=>{function o(){this.lengthKnown=!1,this.chunks=[]}if(o.prototype.get=function(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,r=e/this.chunkSize|0;return this.getter(r)[t]}},o.prototype.setDataGetter=function(e){this.getter=e},o.prototype.cacheLength=function(){var e=new XMLHttpRequest;if(e.open("HEAD",r,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+r+". Status: "+e.status);var t,i=Number(e.getResponseHeader("Content-length")),n=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,o=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,s=1048576;n||(s=i);var a=this;a.setDataGetter((e=>{var t=e*s,n=(e+1)*s-1;if(n=Math.min(n,i-1),void 0===a.chunks[e]&&(a.chunks[e]=((e,t)=>{if(e>t)throw new Error("invalid range ("+e+", "+t+") or no bytes requested!");if(t>i-1)throw new Error("only "+i+" bytes available! programmer error!");var n=new XMLHttpRequest;if(n.open("GET",r,!1),i!==s&&n.setRequestHeader("Range","bytes="+e+"-"+t),n.responseType="arraybuffer",n.overrideMimeType&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.send(null),!(n.status>=200&&n.status<300||304===n.status))throw new Error("Couldn't load "+r+". Status: "+n.status);return void 0!==n.response?new Uint8Array(n.response||[]):ie(n.responseText||"",!0)})(t,n)),void 0===a.chunks[e])throw new Error("doXHR failed!");return a.chunks[e]})),!o&&i||(s=i=1,i=this.getter(0).length,s=i,_("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=i,this._chunkSize=s,this.lengthKnown=!0},"undefined"!=typeof XMLHttpRequest){if(!h)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var s=new o;Object.defineProperties(s,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var a={isDevice:!1,contents:s}}else a={isDevice:!1,url:r};var d=ae.createFile(e,t,a,i,n);a.contents?d.contents=a.contents:a.url&&(d.contents=null,d.url=a.url),Object.defineProperties(d,{usedBytes:{get:function(){return this.contents.length}}});var l={};function u(e,t,r,i,n){var o=e.node.contents;if(n>=o.length)return 0;var s=Math.min(o.length-n,i);if(o.slice)for(var a=0;a{var t=d.stream_ops[e];l[e]=function(){return ae.forceLoadFile(d),t.apply(null,arguments)}})),l.read=(e,t,r,i,n)=>(ae.forceLoadFile(d),u(e,t,r,i,n)),l.mmap=(e,t,r,i,n)=>{ae.forceLoadFile(d);var o=oe(t);if(!o)throw new ae.ErrnoError(48);return u(e,E,o,t,r),{ptr:o,allocated:!0}},d.stream_ops=l,d},createPreloadedFile:(e,t,r,i,n,s,a,d,l,u)=>{var c=t?re.resolve(te.join2(e,t)):e;function f(r){function o(r){u&&u(),d||ae.createDataFile(e,t,r,i,n,l),s&&s(),H()}Browser.handledByPreloadPlugin(r,c,o,(()=>{a&&a(),H()}))||o(r)}$(),"string"==typeof r?function(e,t,r,i){var n=i?"":"al "+e;o(e,(r=>{w(r,'Loading data file "'+e+'" failed (no arrayBuffer).'),t(new Uint8Array(r)),n&&H()}),(t=>{if(!r)throw'Loading data file "'+e+'" failed.';r()})),n&&$()}(r,(e=>f(e)),a):f(r)},indexedDB:()=>window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,DB_NAME:()=>"EM_FS_"+window.location.pathname,DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(e,t,r)=>{t=t||(()=>{}),r=r||(()=>{});var i=ae.indexedDB();try{var n=i.open(ae.DB_NAME(),ae.DB_VERSION)}catch(e){return r(e)}n.onupgradeneeded=()=>{_("creating db"),n.result.createObjectStore(ae.DB_STORE_NAME)},n.onsuccess=()=>{var i=n.result.transaction([ae.DB_STORE_NAME],"readwrite"),o=i.objectStore(ae.DB_STORE_NAME),s=0,a=0,d=e.length;function l(){0==a?t():r()}e.forEach((e=>{var t=o.put(ae.analyzePath(e).object.contents,e);t.onsuccess=()=>{++s+a==d&&l()},t.onerror=()=>{a++,s+a==d&&l()}})),i.onerror=r},n.onerror=r},loadFilesFromDB:(e,t,r)=>{t=t||(()=>{}),r=r||(()=>{});var i=ae.indexedDB();try{var n=i.open(ae.DB_NAME(),ae.DB_VERSION)}catch(e){return r(e)}n.onupgradeneeded=r,n.onsuccess=()=>{var i=n.result;try{var o=i.transaction([ae.DB_STORE_NAME],"readonly")}catch(e){return void r(e)}var s=o.objectStore(ae.DB_STORE_NAME),a=0,d=0,l=e.length;function u(){0==d?t():r()}e.forEach((e=>{var t=s.get(e);t.onsuccess=()=>{ae.analyzePath(e).exists&&ae.unlink(e),ae.createDataFile(te.dirname(e),te.basename(e),t.result,!0,!0,!0),++a+d==l&&u()},t.onerror=()=>{d++,a+d==l&&u()}})),o.onerror=r},n.onerror=r}},de={DEFAULT_POLLMASK:5,calculateAt:function(e,t,r){if(te.isAbs(t))return t;var i;if(-100===e)i=ae.cwd();else{var n=ae.getStream(e);if(!n)throw new ae.ErrnoError(8);i=n.path}if(0==t.length){if(!r)throw new ae.ErrnoError(44);return i}return te.join2(i,t)},doStat:function(e,t,r){try{var i=e(t)}catch(e){if(e&&e.node&&te.normalize(t)!==te.normalize(ae.getPath(e.node)))return-54;throw e}return U[r>>2]=i.dev,U[r+4>>2]=0,U[r+8>>2]=i.ino,U[r+12>>2]=i.mode,U[r+16>>2]=i.nlink,U[r+20>>2]=i.uid,U[r+24>>2]=i.gid,U[r+28>>2]=i.rdev,U[r+32>>2]=0,Y=[i.size>>>0,(q=i.size,+Math.abs(q)>=1?q>0?(0|Math.min(+Math.floor(q/4294967296),4294967295))>>>0:~~+Math.ceil((q-+(~~q>>>0))/4294967296)>>>0:0)],U[r+40>>2]=Y[0],U[r+44>>2]=Y[1],U[r+48>>2]=4096,U[r+52>>2]=i.blocks,Y=[Math.floor(i.atime.getTime()/1e3)>>>0,(q=Math.floor(i.atime.getTime()/1e3),+Math.abs(q)>=1?q>0?(0|Math.min(+Math.floor(q/4294967296),4294967295))>>>0:~~+Math.ceil((q-+(~~q>>>0))/4294967296)>>>0:0)],U[r+56>>2]=Y[0],U[r+60>>2]=Y[1],U[r+64>>2]=0,Y=[Math.floor(i.mtime.getTime()/1e3)>>>0,(q=Math.floor(i.mtime.getTime()/1e3),+Math.abs(q)>=1?q>0?(0|Math.min(+Math.floor(q/4294967296),4294967295))>>>0:~~+Math.ceil((q-+(~~q>>>0))/4294967296)>>>0:0)],U[r+72>>2]=Y[0],U[r+76>>2]=Y[1],U[r+80>>2]=0,Y=[Math.floor(i.ctime.getTime()/1e3)>>>0,(q=Math.floor(i.ctime.getTime()/1e3),+Math.abs(q)>=1?q>0?(0|Math.min(+Math.floor(q/4294967296),4294967295))>>>0:~~+Math.ceil((q-+(~~q>>>0))/4294967296)>>>0:0)],U[r+88>>2]=Y[0],U[r+92>>2]=Y[1],U[r+96>>2]=0,Y=[i.ino>>>0,(q=i.ino,+Math.abs(q)>=1?q>0?(0|Math.min(+Math.floor(q/4294967296),4294967295))>>>0:~~+Math.ceil((q-+(~~q>>>0))/4294967296)>>>0:0)],U[r+104>>2]=Y[0],U[r+108>>2]=Y[1],0},doMsync:function(e,t,r,i,n){var o=A.slice(e,e+r);ae.msync(t,o,n,r,i)},varargs:void 0,get:function(){return de.varargs+=4,U[de.varargs-4>>2]},getStr:function(e){return I(e)},getStreamFromFD:function(e){var t=ae.getStream(e);if(!t)throw new ae.ErrnoError(8);return t}};function le(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}var ue=void 0;function ce(e){for(var t="",r=e;A[r];)t+=ue[A[r++]];return t}var fe={},he={},pe={};function me(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?"_"+e:e}function _e(e,t){return e=me(e),new Function("body","return function "+e+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(t)}function ge(e,t){var r=_e(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},r}var ye=void 0;function ve(e){throw new ye(e)}var be=void 0;function we(e){throw new be(e)}function Se(e,t,r){function i(t){var i=r(t);i.length!==e.length&&we("Mismatched type converter count");for(var n=0;n{he.hasOwnProperty(e)?n[t]=he[e]:(o.push(e),fe.hasOwnProperty(e)||(fe[e]=[]),fe[e].push((()=>{n[t]=he[e],++s===o.length&&i(n)})))})),0===o.length&&i(n)}function Ee(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var i=t.name;if(e||ve('type "'+i+'" must have a positive integer typeid pointer'),he.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;ve("Cannot register type '"+i+"' twice")}if(he[e]=t,delete pe[e],fe.hasOwnProperty(e)){var n=fe[e];delete fe[e],n.forEach((e=>e()))}}function Ae(e){if(!(this instanceof je))return!1;if(!(e instanceof je))return!1;for(var t=this.$$.ptrType.registeredClass,r=this.$$.ptr,i=e.$$.ptrType.registeredClass,n=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;i.baseClass;)n=i.upcast(n),i=i.baseClass;return t===i&&r===n}function Be(e){ve(e.$$.ptrType.registeredClass.name+" instance already deleted")}var xe=!1;function Ue(e){}function ke(e){e.count.value-=1,0===e.count.value&&function(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}(e)}function Te(e,t,r){if(t===r)return e;if(void 0===r.baseClass)return null;var i=Te(e,t,r.baseClass);return null===i?null:r.downcast(i)}var Ce={};function De(){return Object.keys(Re).length}function Pe(){var e=[];for(var t in Re)Re.hasOwnProperty(t)&&e.push(Re[t]);return e}var Fe=[];function Ie(){for(;Fe.length;){var e=Fe.pop();e.$$.deleteScheduled=!1,e.delete()}}var Le=void 0;function Me(e){Le=e,Fe.length&&Le&&Le(Ie)}var Re={};function ze(e,t){return t=function(e,t){for(void 0===t&&ve("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}(e,t),Re[t]}function Ne(e,t){return t.ptrType&&t.ptr||we("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!==!!t.smartPtr&&we("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Ge(Object.create(e,{$$:{value:t}}))}function Oe(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=ze(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var i=r.clone();return this.destructor(e),i}function n(){return this.isSmartPointer?Ne(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Ne(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var o,s=this.registeredClass.getActualType(t),a=Ce[s];if(!a)return n.call(this);o=this.isConst?a.constPointerType:a.pointerType;var d=Te(t,this.registeredClass,o.registeredClass);return null===d?n.call(this):this.isSmartPointer?Ne(o.registeredClass.instancePrototype,{ptrType:o,ptr:d,smartPtrType:this,smartPtr:e}):Ne(o.registeredClass.instancePrototype,{ptrType:o,ptr:d})}function Ge(e){return"undefined"==typeof FinalizationRegistry?(Ge=e=>e,e):(xe=new FinalizationRegistry((e=>{ke(e.$$)})),Ge=e=>{var t=e.$$;if(!!t.smartPtr){var r={$$:t};xe.register(e,r,e)}return e},Ue=e=>xe.unregister(e),Ge(e))}function $e(){if(this.$$.ptr||Be(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=Ge(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}function He(){this.$$.ptr||Be(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ve("Object already scheduled for deletion"),Ue(this),ke(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Ve(){return!this.$$.ptr}function We(){return this.$$.ptr||Be(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ve("Object already scheduled for deletion"),Fe.push(this),1===Fe.length&&Le&&Le(Ie),this.$$.deleteScheduled=!0,this}function je(){}function qe(e,t,r){if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||ve("Function '"+r+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}}function Ye(e,t,r,i,n,o,s,a){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=i,this.baseClass=n,this.getActualType=o,this.upcast=s,this.downcast=a,this.pureVirtualFunctions=[]}function Ke(e,t,r){for(;t!==r;)t.upcast||ve("Expected null or instance of "+r.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function Xe(e,t){if(null===t)return this.isReference&&ve("null is not a valid "+this.name),0;t.$$||ve('Cannot pass "'+wt(t)+'" as a '+this.name),t.$$.ptr||ve("Cannot pass deleted object as a pointer of type "+this.name);var r=t.$$.ptrType.registeredClass;return Ke(t.$$.ptr,r,this.registeredClass)}function Ze(e,t){var r;if(null===t)return this.isReference&&ve("null is not a valid "+this.name),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||ve('Cannot pass "'+wt(t)+'" as a '+this.name),t.$$.ptr||ve("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&ve("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var i=t.$$.ptrType.registeredClass;if(r=Ke(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&ve("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:ve("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,bt.toHandle((function(){n.delete()}))),null!==e&&e.push(this.rawDestructor,r)}break;default:ve("Unsupporting sharing policy")}return r}function Je(e,t){if(null===t)return this.isReference&&ve("null is not a valid "+this.name),0;t.$$||ve('Cannot pass "'+wt(t)+'" as a '+this.name),t.$$.ptr||ve("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&ve("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var r=t.$$.ptrType.registeredClass;return Ke(t.$$.ptr,r,this.registeredClass)}function Qe(e){return this.fromWireType(U[e>>2])}function et(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function tt(e){this.rawDestructor&&this.rawDestructor(e)}function rt(e){null!==e&&e.delete()}function it(e,t,r,i,n,o,s,a,d,l,u){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=i,this.isSmartPointer=n,this.pointeeType=o,this.sharingPolicy=s,this.rawGetPointee=a,this.rawConstructor=d,this.rawShare=l,this.rawDestructor=u,n||void 0!==t.baseClass?this.toWireType=Ze:i?(this.toWireType=Xe,this.destructorFunction=null):(this.toWireType=Je,this.destructorFunction=null)}var nt=[];function ot(e){var t=nt[e];return t||(e>=nt.length&&(nt.length=e+1),nt[e]=t=D.get(e)),t}function st(e,r,i){return e.includes("j")?function(e,r,i){var n=t["dynCall_"+e];return i&&i.length?n.apply(null,[r].concat(i)):n.call(null,r)}(e,r,i):ot(r).apply(null,i)}function at(e,t){var r,i,n,o=(e=ce(e)).includes("j")?(r=e,i=t,n=[],function(){return n.length=0,Object.assign(n,arguments),st(r,i,n)}):ot(t);return"function"!=typeof o&&ve("unknown function pointer with signature "+e+": "+t),o}var dt=void 0;function lt(e){var t=$t(e),r=ce(t);return Ot(t),r}function ut(e,t){var r=[],i={};throw t.forEach((function e(t){i[t]||he[t]||(pe[t]?pe[t].forEach(e):(r.push(t),i[t]=!0))})),new dt(e+": "+r.map(lt).join([", "]))}function ct(e,t){for(var r=[],i=0;i>2]);return r}function ft(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function ht(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var r=_e(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var i=new r,n=e.apply(i,t);return n instanceof Object?n:i}function pt(e,t,r,i,n){var o=t.length;o<2&&ve("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==t[1]&&null!==r,a=!1,d=1;d0?", ":"")+c),f+=(l?"var rv = ":"")+"invoker(fn"+(c.length>0?", ":"")+c+");\n",a)f+="runDestructors(destructors);\n";else for(d=s?1:2;d4&&0==--_t[e].refcount&&(_t[e]=void 0,mt.push(e))}function yt(){for(var e=0,t=5;t<_t.length;++t)void 0!==_t[t]&&++e;return e}function vt(){for(var e=5;e<_t.length;++e)if(void 0!==_t[e])return _t[e];return null}var bt={toValue:e=>(e||ve("Cannot use deleted val. handle = "+e),_t[e].value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var t=mt.length?mt.pop():_t.length;return _t[t]={refcount:1,value:e},t}}};function wt(e){if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e}function St(e,t){switch(t){case 2:return function(e){return this.fromWireType(T[e>>2])};case 3:return function(e){return this.fromWireType(C[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Et(e,t,r){switch(t){case 0:return r?function(e){return E[e]}:function(e){return A[e]};case 1:return r?function(e){return B[e>>1]}:function(e){return x[e>>1]};case 2:return r?function(e){return U[e>>2]}:function(e){return k[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}var At="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function Bt(e,t){for(var r=e,i=r>>1,n=i+t/2;!(i>=n)&&x[i];)++i;if((r=i<<1)-e>32&&At)return At.decode(A.subarray(e,r));for(var o="",s=0;!(s>=t/2);++s){var a=B[e+2*s>>1];if(0==a)break;o+=String.fromCharCode(a)}return o}function xt(e,t,r){if(void 0===r&&(r=2147483647),r<2)return 0;for(var i=t,n=(r-=2)<2*e.length?r/2:e.length,o=0;o>1]=s,t+=2}return B[t>>1]=0,t-i}function Ut(e){return 2*e.length}function kt(e,t){for(var r=0,i="";!(r>=t/4);){var n=U[e+4*r>>2];if(0==n)break;if(++r,n>=65536){var o=n-65536;i+=String.fromCharCode(55296|o>>10,56320|1023&o)}else i+=String.fromCharCode(n)}return i}function Tt(e,t,r){if(void 0===r&&(r=2147483647),r<4)return 0;for(var i=t,n=i+r-4,o=0;o=55296&&s<=57343)s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o);if(U[t>>2]=s,(t+=4)+4>n)break}return U[t>>2]=0,t-i}function Ct(e){for(var t=0,r=0;r=55296&&i<=57343&&++r,t+=4}return t}var Dt={};var Pt=[];var Ft=[];var It={};function Lt(){if(!Lt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:c||"./this.program"};for(var t in It)void 0===It[t]?delete e[t]:e[t]=It[t];var r=[];for(var t in e)r.push(t+"="+e[t]);Lt.strings=r}return Lt.strings}var Mt=function(e,t,r,i){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=ae.nextInode++,this.name=t,this.mode=r,this.node_ops={},this.stream_ops={},this.rdev=i},Rt=365,zt=146;Object.defineProperties(Mt.prototype,{read:{get:function(){return(this.mode&Rt)===Rt},set:function(e){e?this.mode|=Rt:this.mode&=-366}},write:{get:function(){return(this.mode&zt)===zt},set:function(e){e?this.mode|=zt:this.mode&=-147}},isFolder:{get:function(){return ae.isDir(this.mode)}},isDevice:{get:function(){return ae.isChrdev(this.mode)}}}),ae.FSNode=Mt,ae.staticInit(),function(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);ue=e}(),ye=t.BindingError=ge(Error,"BindingError"),be=t.InternalError=ge(Error,"InternalError"),je.prototype.isAliasOf=Ae,je.prototype.clone=$e,je.prototype.delete=He,je.prototype.isDeleted=Ve,je.prototype.deleteLater=We,t.getInheritedInstanceCount=De,t.getLiveInheritedInstances=Pe,t.flushPendingDeletes=Ie,t.setDelayFunction=Me,it.prototype.getPointee=et,it.prototype.destructor=tt,it.prototype.argPackAdvance=8,it.prototype.readValueFromPointer=Qe,it.prototype.deleteObject=rt,it.prototype.fromWireType=Oe,dt=t.UnboundTypeError=ge(Error,"UnboundTypeError"),t.count_emval_handles=yt,t.get_first_emval=vt;var Nt={q:function(e){return Vt(e+24)+24},p:function(e,t,r){throw new ee(e).init(t,r),e},C:function(e,t,r){de.varargs=r;try{var i=de.getStreamFromFD(e);switch(t){case 0:return(n=de.get())<0?-28:ae.createStream(i,n).fd;case 1:case 2:case 6:case 7:return 0;case 3:return i.flags;case 4:var n=de.get();return i.flags|=n,0;case 5:n=de.get();return B[n+0>>1]=2,0;case 16:case 8:default:return-28;case 9:return o=28,U[Gt()>>2]=o,-1}}catch(e){if(void 0===ae||!(e instanceof ae.ErrnoError))throw e;return-e.errno}var o},w:function(e,t,r,i){de.varargs=i;try{t=de.getStr(t),t=de.calculateAt(e,t);var n=i?de.get():0;return ae.open(t,r,n).fd}catch(e){if(void 0===ae||!(e instanceof ae.ErrnoError))throw e;return-e.errno}},u:function(e,t,r,i,n){},E:function(e,t,r,i,n){var o=le(r);Ee(e,{name:t=ce(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?i:n},argPackAdvance:8,readValueFromPointer:function(e){var i;if(1===r)i=E;else if(2===r)i=B;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+t);i=U}return this.fromWireType(i[e>>o])},destructorFunction:null})},t:function(e,r,i,n,o,s,a,d,l,u,c,f,h){c=ce(c),s=at(o,s),d&&(d=at(a,d)),u&&(u=at(l,u)),h=at(f,h);var p=me(c);!function(e,r,i){t.hasOwnProperty(e)?((void 0===i||void 0!==t[e].overloadTable&&void 0!==t[e].overloadTable[i])&&ve("Cannot register public name '"+e+"' twice"),qe(t,e,e),t.hasOwnProperty(i)&&ve("Cannot register multiple overloads of a function with the same number of arguments ("+i+")!"),t[e].overloadTable[i]=r):(t[e]=r,void 0!==i&&(t[e].numArguments=i))}(p,(function(){ut("Cannot construct "+c+" due to unbound types",[n])})),Se([e,r,i],n?[n]:[],(function(r){var i,o;r=r[0],o=n?(i=r.registeredClass).instancePrototype:je.prototype;var a=_e(p,(function(){if(Object.getPrototypeOf(this)!==l)throw new ye("Use 'new' to construct "+c);if(void 0===f.constructor_body)throw new ye(c+" has no accessible constructor");var e=f.constructor_body[arguments.length];if(void 0===e)throw new ye("Tried to invoke ctor of "+c+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(f.constructor_body).toString()+") parameters instead!");return e.apply(this,arguments)})),l=Object.create(o,{constructor:{value:a}});a.prototype=l;var f=new Ye(c,a,l,h,i,s,d,u),m=new it(c,f,!0,!1,!1),_=new it(c+"*",f,!1,!1,!1),g=new it(c+" const*",f,!1,!0,!1);return Ce[e]={pointerType:_,constPointerType:g},function(e,r,i){t.hasOwnProperty(e)||we("Replacing nonexistant public symbol"),void 0!==t[e].overloadTable&&void 0!==i?t[e].overloadTable[i]=r:(t[e]=r,t[e].argCount=i)}(p,a),[m,_,g]}))},r:function(e,t,r,i,n,o){w(t>0);var s=ct(t,r);n=at(i,n),Se([],[e],(function(e){var r="constructor "+(e=e[0]).name;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new ye("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+e.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return e.registeredClass.constructor_body[t-1]=()=>{ut("Cannot construct "+e.name+" due to unbound types",s)},Se([],s,(function(i){return i.splice(1,0,null),e.registeredClass.constructor_body[t-1]=pt(r,i,null,n,o),[]})),[]}))},d:function(e,t,r,i,n,o,s,a){var d=ct(r,i);t=ce(t),o=at(n,o),Se([],[e],(function(e){var i=(e=e[0]).name+"."+t;function n(){ut("Cannot call "+i+" due to unbound types",d)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),a&&e.registeredClass.pureVirtualFunctions.push(t);var l=e.registeredClass.instancePrototype,u=l[t];return void 0===u||void 0===u.overloadTable&&u.className!==e.name&&u.argCount===r-2?(n.argCount=r-2,n.className=e.name,l[t]=n):(qe(l,t,i),l[t].overloadTable[r-2]=n),Se([],d,(function(n){var a=pt(i,n,e,o,s);return void 0===l[t].overloadTable?(a.argCount=r-2,l[t]=a):l[t].overloadTable[r-2]=a,[]})),[]}))},D:function(e,t){Ee(e,{name:t=ce(t),fromWireType:function(e){var t=bt.toValue(e);return gt(e),t},toWireType:function(e,t){return bt.toHandle(t)},argPackAdvance:8,readValueFromPointer:Qe,destructorFunction:null})},n:function(e,t,r){var i=le(r);Ee(e,{name:t=ce(t),fromWireType:function(e){return e},toWireType:function(e,t){return t},argPackAdvance:8,readValueFromPointer:St(t,i),destructorFunction:null})},c:function(e,t,r,i,n){t=ce(t);var o=le(r),s=e=>e;if(0===i){var a=32-8*r;s=e=>e<>>a}var d=t.includes("unsigned");Ee(e,{name:t,fromWireType:s,toWireType:d?function(e,t){return this.name,t>>>0}:function(e,t){return this.name,t},argPackAdvance:8,readValueFromPointer:Et(t,o,0!==i),destructorFunction:null})},b:function(e,t,r){var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function n(e){var t=k,r=t[e>>=2],n=t[e+1];return new i(S,n,r)}Ee(e,{name:r=ce(r),fromWireType:n,argPackAdvance:8,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})},m:function(e,t){var r="std::string"===(t=ce(t));Ee(e,{name:t,fromWireType:function(e){var t,i=k[e>>2],n=e+4;if(r)for(var o=n,s=0;s<=i;++s){var a=n+s;if(s==i||0==A[a]){var d=I(o,a-o);void 0===t?t=d:(t+=String.fromCharCode(0),t+=d),o=a+1}}else{var l=new Array(i);for(s=0;s>2]=i,r&&n)L(t,A,s,i+1);else if(n)for(var a=0;a255&&(Ot(s),ve("String has UTF-16 code units that do not fit in 8 bits")),A[s+a]=d}else for(a=0;ax,a=1):4===t&&(i=kt,n=Tt,s=Ct,o=()=>k,a=2),Ee(e,{name:r,fromWireType:function(e){for(var r,n=k[e>>2],s=o(),d=e+4,l=0;l<=n;++l){var u=e+4+l*t;if(l==n||0==s[u>>a]){var c=i(d,u-d);void 0===r?r=c:(r+=String.fromCharCode(0),r+=c),d=u+t}}return Ot(e),r},toWireType:function(e,i){"string"!=typeof i&&ve("Cannot pass non-string to C++ string type "+r);var o=s(i),d=Vt(4+o+t);return k[d>>2]=o>>a,n(i,d+4,o+t),null!==e&&e.push(Ot,d),d},argPackAdvance:8,readValueFromPointer:Qe,destructorFunction:function(e){Ot(e)}})},o:function(e,t){Ee(e,{isVoid:!0,name:t=ce(t),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})},f:function(){return Date.now()},g:function(e,t,r,i){var n,o;(e=Pt[e])(t=bt.toValue(t),r=void 0===(o=Dt[n=r])?ce(n):o,null,i)},j:gt,i:function(e,t){var r=function(e,t){for(var r,i,n,o=new Array(e),s=0;s>2],i="parameter "+s,n=void 0,void 0===(n=he[r])&&ve(i+" has unknown type "+lt(r)),n);return o}(e,t),i=r[0],n=i.name+"_$"+r.slice(1).map((function(e){return e.name})).join("_")+"$",o=Ft[n];if(void 0!==o)return o;for(var s=["retType"],a=[i],d="",l=0;l>2]=o,function(e,t,r){for(var i=0;i>0]=e.charCodeAt(i);r||(E[t>>0]=0)}(i,o),r+=i.length+1})),0},z:function(e,t){var r=Lt();k[e>>2]=r.length;var i=0;return r.forEach((function(e){i+=e.length+1})),k[t>>2]=i,0},l:function(e){try{var t=de.getStreamFromFD(e);return ae.close(t),0}catch(e){if(void 0===ae||!(e instanceof ae.ErrnoError))throw e;return e.errno}},x:function(e,t){try{var r=de.getStreamFromFD(e),i=r.tty?2:ae.isDir(r.mode)?3:ae.isLink(r.mode)?7:4;return E[t>>0]=i,0}catch(e){if(void 0===ae||!(e instanceof ae.ErrnoError))throw e;return e.errno}},B:function(e,t,r,i){try{var n=function(e,t,r,i){for(var n=0,o=0;o>2],a=k[t+4>>2];t+=8;var d=ae.read(e,E,s,a,i);if(d<0)return-1;if(n+=d,d>2]=n,0}catch(e){if(void 0===ae||!(e instanceof ae.ErrnoError))throw e;return e.errno}},s:function(e,t,r,i,n){try{var o=(d=r)+2097152>>>0<4194305-!!(a=t)?(a>>>0)+4294967296*d:NaN;if(isNaN(o))return 61;var s=de.getStreamFromFD(e);return ae.llseek(s,o,i),Y=[s.position>>>0,(q=s.position,+Math.abs(q)>=1?q>0?(0|Math.min(+Math.floor(q/4294967296),4294967295))>>>0:~~+Math.ceil((q-+(~~q>>>0))/4294967296)>>>0:0)],U[n>>2]=Y[0],U[n+4>>2]=Y[1],s.getdents&&0===o&&0===i&&(s.getdents=null),0}catch(e){if(void 0===ae||!(e instanceof ae.ErrnoError))throw e;return e.errno}var a,d},k:function(e,t,r,i){try{var n=function(e,t,r,i){for(var n=0,o=0;o>2],a=k[t+4>>2];t+=8;var d=ae.write(e,E,s,a,i);if(d<0)return-1;n+=d}return n}(de.getStreamFromFD(e),t,r);return k[i>>2]=n,0}catch(e){if(void 0===ae||!(e instanceof ae.ErrnoError))throw e;return e.errno}},e:function(e){}};!function(){var e={a:Nt};function r(e,r){var i,n,o=e.exports;t.asm=o,v=t.asm.F,i=v.buffer,S=i,t.HEAP8=E=new Int8Array(i),t.HEAP16=B=new Int16Array(i),t.HEAP32=U=new Int32Array(i),t.HEAPU8=A=new Uint8Array(i),t.HEAPU16=x=new Uint16Array(i),t.HEAPU32=k=new Uint32Array(i),t.HEAPF32=T=new Float32Array(i),t.HEAPF64=C=new Float64Array(i),D=t.asm.I,n=t.asm.G,z.unshift(n),H()}function n(e){r(e.instance)}function s(t){return function(){if(!y&&(f||h)){if("function"==typeof fetch&&!X(W))return fetch(W,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+W+"'";return e.arrayBuffer()})).catch((function(){return Z(W)}));if(o)return new Promise((function(e,t){o(W,(function(t){e(new Uint8Array(t))}),t)}))}return Promise.resolve().then((function(){return Z(W)}))}().then((function(t){return WebAssembly.instantiate(t,e)})).then((function(e){return e})).then(t,(function(e){g("failed to asynchronously prepare wasm: "+e),V(e)}))}if($(),t.instantiateWasm)try{return t.instantiateWasm(e,r)}catch(e){return g("Module.instantiateWasm callback failed with error: "+e),!1}(y||"function"!=typeof WebAssembly.instantiateStreaming||K(W)||X(W)||p||"function"!=typeof fetch?s(n):fetch(W,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,e).then(n,(function(e){return g("wasm streaming compile failed: "+e),g("falling back to ArrayBuffer instantiation"),s(n)}))}))).catch(i)}(),t.___wasm_call_ctors=function(){return(t.___wasm_call_ctors=t.asm.G).apply(null,arguments)};var Ot=t._free=function(){return(Ot=t._free=t.asm.H).apply(null,arguments)},Gt=t.___errno_location=function(){return(Gt=t.___errno_location=t.asm.J).apply(null,arguments)},$t=t.___getTypeName=function(){return($t=t.___getTypeName=t.asm.K).apply(null,arguments)};t.___embind_register_native_and_builtin_types=function(){return(t.___embind_register_native_and_builtin_types=t.asm.L).apply(null,arguments)};var Ht,Vt=t._malloc=function(){return(Vt=t._malloc=t.asm.M).apply(null,arguments)},Wt=t._emscripten_builtin_memalign=function(){return(Wt=t._emscripten_builtin_memalign=t.asm.N).apply(null,arguments)},jt=t.___cxa_is_pointer_type=function(){return(jt=t.___cxa_is_pointer_type=t.asm.O).apply(null,arguments)};function qt(e){function i(){Ht||(Ht=!0,t.calledRun=!0,b||(t.noFSInit||ae.init.initialized||ae.init(),ae.ignorePermissions=!1,Q(z),r(t),t.onRuntimeInitialized&&t.onRuntimeInitialized(),function(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)e=t.postRun.shift(),N.unshift(e);var e;Q(N)}()))}O>0||(!function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)e=t.preRun.shift(),R.unshift(e);var e;Q(R)}(),O>0||(t.setStatus?(t.setStatus("Running..."),setTimeout((function(){setTimeout((function(){t.setStatus("")}),1),i()}),1)):i()))}if(t.dynCall_viiijj=function(){return(t.dynCall_viiijj=t.asm.P).apply(null,arguments)},t.dynCall_jij=function(){return(t.dynCall_jij=t.asm.Q).apply(null,arguments)},t.dynCall_jii=function(){return(t.dynCall_jii=t.asm.R).apply(null,arguments)},t.dynCall_jiji=function(){return(t.dynCall_jiji=t.asm.S).apply(null,arguments)},G=function e(){Ht||qt(),Ht||(G=e)},t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return qt(),t.ready}})(),a=1e-6,d="undefined"!=typeof Float32Array?Float32Array:Array;function l(){var e=new d(16);return d!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function u(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var c,f=function(e,t,r,i,n,o,s){var a=1/(t-r),d=1/(i-n),l=1/(o-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*d,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*a,e[13]=(n+i)*d,e[14]=(s+o)*l,e[15]=1,e};function h(e,t,r){var i=new d(3);return i[0]=e,i[1]=t,i[2]=r,i}c=new d(3),d!=Float32Array&&(c[0]=0,c[1]=0,c[2]=0);var p=(e,t)=>{t&&e.pixelStorei(e.UNPACK_ALIGNMENT,1);const r=function(){const t=m(e.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=m(e.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),i=e.createProgram();if(e.attachShader(i,t),e.attachShader(i,r),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))return console.log("Unable to initialize the shader program: "+e.getProgramInfoLog(i)),null;return i}();let i={program:r,attribLocations:{vertexPosition:e.getAttribLocation(r,"aVertexPosition"),texturePosition:e.getAttribLocation(r,"aTexturePosition")},uniformLocations:{projectionMatrix:e.getUniformLocation(r,"uProjectionMatrix"),modelMatrix:e.getUniformLocation(r,"uModelMatrix"),viewMatrix:e.getUniformLocation(r,"uViewMatrix"),rgbatexture:e.getUniformLocation(r,"rgbaTexture"),ytexture:e.getUniformLocation(r,"yTexture"),utexture:e.getUniformLocation(r,"uTexture"),vtexture:e.getUniformLocation(r,"vTexture"),isyuv:e.getUniformLocation(r,"isyuv")}},n=function(){const t=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,t);e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),e.STATIC_DRAW);var r=[];r=r.concat([0,1],[1,1],[1,0],[0,0]);const i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,new Float32Array(r),e.STATIC_DRAW);const n=e.createBuffer();e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n);return e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),e.STATIC_DRAW),{position:t,texPosition:i,indices:n}}(),o=p(),s=p(),d=p(),c=p();function p(){let t=e.createTexture();return e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),t}function m(t,r){const i=e.createShader(t);return e.shaderSource(i,r),e.compileShader(i),e.getShaderParameter(i,e.COMPILE_STATUS)?i:(console.log("An error occurred compiling the shaders: "+e.getShaderInfoLog(i)),e.deleteShader(i),null)}function _(t,r){e.viewport(0,0,t,r),e.clearColor(0,0,0,0),e.clearDepth(1),e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);const o=l();f(o,-1,1,-1,1,.1,100);const p=l();u(p);const m=l();!function(e,t,r,i){var n,o,s,d,l,c,f,h,p,m,_=t[0],g=t[1],y=t[2],v=i[0],b=i[1],w=i[2],S=r[0],E=r[1],A=r[2];Math.abs(_-S)32&&console.error("ExpGolomb: readBits() bits exceeded max 32bits!"),e<=this._current_word_bits_left){let t=this._current_word>>>32-e;return this._current_word<<=e,this._current_word_bits_left-=e,t}let t=this._current_word_bits_left?this._current_word:0;t>>>=32-this._current_word_bits_left;let r=e-this._current_word_bits_left;this._fillCurrentWord();let i=Math.min(r,this._current_word_bits_left),n=this._current_word>>>32-i;return this._current_word<<=i,this._current_word_bits_left-=i,t=t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){let e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){let e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}const $t=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1],Ht=$t,Vt=$t;function Wt(e){let{profile:t,sampleRate:r,channel:i}=e;return new Uint8Array([175,0,t<<3|(14&r)>>1,(1&r)<<7|i<<3])}function jt(e){return qt(e)&&e[1]===xt}function qt(e){return e[0]>>4===ze}const Yt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];function Kt(e){let t=new Uint8Array(e),r=null,i=0,n=0,o=0,s=null;if(i=n=t[0]>>>3,o=(7&t[0])<<1|t[1]>>>7,o<0||o>=Yt.length)return void console.error("Flv: AAC invalid sampling frequency index!");let a=Yt[o],d=(120&t[1])>>>3;if(d<0||d>=8)return void console.log("Flv: AAC invalid channel configuration");5===i&&(s=(7&t[1])<<1|t[2]>>>7,t[2]);let l=self.navigator.userAgent.toLowerCase();return-1!==l.indexOf("firefox")?o>=6?(i=5,r=new Array(4),s=o-3):(i=2,r=new Array(2),s=o):-1!==l.indexOf("android")?(i=2,r=new Array(2),s=o):(i=5,s=o,r=new Array(4),o>=6?s=o-3:1===d&&(i=2,r=new Array(2),s=o)),r[0]=i<<3,r[0]|=(15&o)>>>1,r[1]=(15&o)<<7,r[1]|=(15&d)<<3,5===i&&(r[1]|=(15&s)>>>1,r[2]=(1&s)<<7,r[2]|=8,r[3]=0),{audioType:"aac",config:r,sampleRate:a,channelCount:d,objectType:i,codec:"mp4a.40."+i,originalCodec:"mp4a.40."+n}}class Xt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+7>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(4095===(r[t+0]<<8|r[t+1])>>>4)return t;t++}}readNextAACFrame(){let e=this.data_,t=null;for(;null==t&&!this.eof_flag_;){let r=this.current_syncword_offset_,i=(8&e[r+1])>>>3,n=(6&e[r+1])>>>1,o=1&e[r+1],s=(192&e[r+2])>>>6,a=(60&e[r+2])>>>2,d=(1&e[r+2])<<2|(192&e[r+3])>>>6,l=(3&e[r+3])<<11|e[r+4]<<3|(224&e[r+5])>>>5;if(e[r+6],r+l>this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let u=1===o?7:9,c=l-u;r+=u;let f=this.findNextSyncwordOffset(r+c);if(this.current_syncword_offset_=f,0!==i&&1!==i||0!==n)continue;let h=e.subarray(r,r+c);t={},t.audio_object_type=s+1,t.sampling_freq_index=a,t.sampling_frequency=Ht[a],t.channel_config=d,t.data=h}return t}hasIncompleteData(){return this.has_last_incomplete_data}getIncompleteData(){return this.has_last_incomplete_data?this.data_.subarray(this.current_syncword_offset_):null}}class Zt{constructor(e){this.data_=e,this.eof_flag_=!1,this.current_syncword_offset_=this.findNextSyncwordOffset(0),this.eof_flag_&&console.error("Could not found ADTS syncword until payload end")}findNextSyncwordOffset(e){let t=e,r=this.data_;for(;;){if(t+1>=r.byteLength)return this.eof_flag_=!0,r.byteLength;if(695===(r[t+0]<<3|r[t+1]>>>5))return t;t++}}getLATMValue(e){let t=e.readBits(2),r=0;for(let i=0;i<=t;i++)r<<=8,r|=e.readByte();return r}readNextAACFrame(e){let t=this.data_,r=null;for(;null==r&&!this.eof_flag_;){let i=this.current_syncword_offset_,n=(31&t[i+1])<<8|t[i+2];if(i+3+n>=this.data_.byteLength){this.eof_flag_=!0,this.has_last_incomplete_data=!0;break}let o=new Gt(t.subarray(i+3,i+3+n)),s=null;if(o.readBool()){if(null==e){console.warn("StreamMuxConfig Missing"),this.current_syncword_offset_=this.findNextSyncwordOffset(i+3+n),o.destroy();continue}s=e}else{let e=o.readBool();if(e&&o.readBool()){console.error("audioMuxVersionA is Not Supported"),o.destroy();break}if(e&&this.getLATMValue(o),!o.readBool()){console.error("allStreamsSameTimeFraming zero is Not Supported"),o.destroy();break}if(0!==o.readBits(6)){console.error("more than 2 numSubFrames Not Supported"),o.destroy();break}if(0!==o.readBits(4)){console.error("more than 2 numProgram Not Supported"),o.destroy();break}if(0!==o.readBits(3)){console.error("more than 2 numLayer Not Supported"),o.destroy();break}let t=e?this.getLATMValue(o):0,r=o.readBits(5);t-=5;let i=o.readBits(4);t-=4;let n=o.readBits(4);t-=4,o.readBits(3),t-=3,t>0&&o.readBits(t);let a=o.readBits(3);if(0!==a){console.error(`frameLengthType = ${a}. Only frameLengthType = 0 Supported`),o.destroy();break}o.readByte();let d=o.readBool();if(d)if(e)this.getLATMValue(o);else{let e=0;for(;;){e<<=8;let t=o.readBool();if(e+=o.readByte(),!t)break}console.log(e)}o.readBool()&&o.readByte(),s={},s.audio_object_type=r,s.sampling_freq_index=i,s.sampling_frequency=Ht[s.sampling_freq_index],s.channel_config=n,s.other_data_present=d}let a=0;for(;;){let e=o.readByte();if(a+=e,255!==e)break}let d=new Uint8Array(a);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0;return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+(e[t+3]||0)}function Qt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(e.length<4)return;const r=e.length,i=[];let n,o=0;for(;o+t>>=8),o+=t,n){if(o+n>r)break;i.push(e.subarray(o,o+n)),o+=n}return i}function er(e){const t=e.byteLength,r=new Uint8Array(4);r[0]=t>>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t;const i=new Uint8Array(t+4);return i.set(r,0),i.set(e,4),i}function tr(e,t){let r=null;return t?e.length>=28&&(r=1+(3&e[26])):e.length>=12&&(r=1+(3&e[9])),r}function rr(){return(new Date).getTime()}function ir(e,t,r){return Math.max(Math.min(e,Math.max(t,r)),Math.min(t,r))}function nr(){return performance&&"function"==typeof performance.now?performance.now():Date.now()}function or(e){let t=0,r=nr();return i=>{if(n=i,"[object Number]"!==Object.prototype.toString.call(n))return;var n;t+=i;const o=nr(),s=o-r;s>=1e3&&(e(t/s*1e3),r=o,t=0)}}function sr(){const e=window.navigator.userAgent.toLowerCase();return/firefox/i.test(e)}function ar(){let e=!1;return"MediaSource"in self&&(self.MediaSource.isTypeSupported(ft)||self.MediaSource.isTypeSupported(ht)||self.MediaSource.isTypeSupported(pt)||self.MediaSource.isTypeSupported(mt)||self.MediaSource.isTypeSupported(_t))&&(e=!0),e}function dr(e){return null==e}function lr(e){return!dr(e)}function ur(e){return"function"==typeof e}function cr(e){let t=null,r=31&e[0];return r!==$e&&r!==He||(t=Me),t||(r=(126&e[0])>>1,r!==et&&r!==rt&&r!==nt||(t=Re)),t}function fr(){return"undefined"!=typeof WritableStream}function hr(e){e.close()}function pr(e,t){t&&(e=e.filter((e=>e.type&&e.type===t)));let r=e[0],i=null,n=1;if(e.length>0){let t=e[1];t&&t.ts-r.ts>1e5&&(r=t,n=2)}if(r)for(let o=n;o=1e3){e[o-1].ts-r.ts<1e3&&(i=o+1)}}}return i}function mr(e){return e.ok&&e.status>=200&&e.status<=299}function _r(){return function(e){let t="";if("object"==typeof e)try{t=JSON.stringify(e),t=JSON.parse(t)}catch(r){t=e}else t=e;return t}(U)}function gr(e){return e[0]>>4===Ut&&e[1]===xt}function yr(e){return!0===e||"true"===e}function vr(e){return!0!==e&&"true"!==e}function br(){return!!(self.Worker&&self.MediaSource&&"canConstructInDedicatedWorker"in self.MediaSource&&!0===self.MediaSource.canConstructInDedicatedWorker)}(()=>{try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)return new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}})();var wr=function(e,t,r,i){return new(r||(r=Promise))((function(n,o){function s(e){try{d(i.next(e))}catch(e){o(e)}}function a(e){try{d(i.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}d((i=i.apply(e,t||[])).next())}))};const Sr=Symbol(32),Er=Symbol(16),Ar=Symbol(8);class Br{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}setG(e){this.g=e,this.demand(e.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(e){return wr(this,void 0,void 0,(function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise(((t,r)=>{var i;this.reject=r,this.resolve=e=>{delete this.lastReadPromise,delete this.resolve,delete this.need,t(e)};this.demand(e,!0)||null===(i=this.pull)||void 0===i||i.call(this,e)}))}))}readU32(){return this.read(Sr)}readU16(){return this.read(Er)}readU8(){return this.read(Ar)}close(){var e;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),null===(e=this.reject)||void 0===e||e.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let e=null;const t=this.buffer.subarray(this.consumed);let r=0;const i=e=>t.length<(r=e);if("number"==typeof this.need){if(i(this.need))return;e=t.subarray(0,r)}else if(this.need===Sr){if(i(4))return;e=t[0]<<24|t[1]<<16|t[2]<<8|t[3]}else if(this.need===Er){if(i(2))return;e=t[0]<<8|t[1]}else if(this.need===Ar){if(i(1))return;e=t[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(i(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(t.subarray(0,r)),e=this.need}else if(this.g)return void this.g.throw(new Error("Unsupported type"))}else{if(i(this.need.byteLength))return;new Uint8Array(this.need).set(t.subarray(0,r)),e=this.need}return this.consumed+=r,this.g?this.demand(this.g.next(e).value,!0):this.resolve&&this.resolve(e),e}write(e){if(e instanceof Uint8Array?this.malloc(e.length).set(e):"buffer"in e?this.malloc(e.byteLength).set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)):this.malloc(e.byteLength).set(new Uint8Array(e)),!this.g&&!this.resolve)return new Promise((e=>this.pull=e));this.flush()}writeU32(e){this.malloc(4).set([e>>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){const t=this.buffer.length,r=t+e;if(r<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,r);else{const e=new Uint8Array(r);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,r)}return this.buffer=new Uint8Array(e),this.buffer}}Br.U32=Sr,Br.U16=Er,Br.U8=Ar;class xr{constructor(e){this.log=function(t){if(e._opt.debug&&e._opt.debugLevel==S){const o=e._opt.debugUuid?`[${e._opt.debugUuid}]`:"";for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n1?r-1:0),n=1;n1?i-1:0),o=1;o=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseSPS(e){let t=Ur._ebsp2rbsp(e),r=new Gt(t);r.readByte();let i=r.readByte();r.readByte();let n=r.readByte();r.readUEG();let o=Ur.getProfileString(i),s=Ur.getLevelString(n),a=1,d=420,l=[0,420,422,444],u=8;if((100===i||110===i||122===i||244===i||44===i||83===i||86===i||118===i||128===i||138===i||144===i)&&(a=r.readUEG(),3===a&&r.readBits(1),a<=3&&(d=l[a]),u=r.readUEG()+8,r.readUEG(),r.readBits(1),r.readBool())){let e=3!==a?8:12;for(let t=0;t0&&e<16?(b=t[e-1],w=i[e-1]):255===e&&(b=r.readByte()<<8|r.readByte(),w=r.readByte()<<8|r.readByte())}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(4),r.readBool()&&r.readBits(24)),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool()){let e=r.readBits(32),t=r.readBits(32);E=r.readBool(),A=t,B=2*e,S=A/B}}let x=1;1===b&&1===w||(x=b/w);let U=0,k=0;if(0===a)U=1,k=2-m;else{U=3===a?1:2,k=(1===a?2:1)*(2-m)}let T=16*(h+1),C=16*(p+1)*(2-m);T-=(_+g)*U,C-=(y+v)*k;let D=Math.ceil(T*x);return r.destroy(),r=null,{profile_string:o,level_string:s,bit_depth:u,ref_frames:f,chroma_format:d,chroma_format_string:Ur.getChromaFormatString(d),frame_rate:{fixed:E,fps:S,fps_den:B,fps_num:A},sar_ratio:{width:b,height:w},codec_size:{width:T,height:C},present_size:{width:D,height:C}}}static parseSPS$2(e){let t=e.subarray(1,4),r="avc1.";for(let e=0;e<3;e++){let i=t[e].toString(16);i.length<2&&(i="0"+i),r+=i}let i=Ur._ebsp2rbsp(e),n=new Gt(i);n.readByte();let o=n.readByte();n.readByte();let s=n.readByte();n.readUEG();let a=Ur.getProfileString(o),d=Ur.getLevelString(s),l=1,u=420,c=[0,420,422,444],f=8,h=8;if((100===o||110===o||122===o||244===o||44===o||83===o||86===o||118===o||128===o||138===o||144===o)&&(l=n.readUEG(),3===l&&n.readBits(1),l<=3&&(u=c[l]),f=n.readUEG()+8,h=n.readUEG()+8,n.readBits(1),n.readBool())){let e=3!==l?8:12;for(let t=0;t0&&e<16?(E=t[e-1],A=r[e-1]):255===e&&(E=n.readByte()<<8|n.readByte(),A=n.readByte()<<8|n.readByte())}if(n.readBool()&&n.readBool(),n.readBool()&&(n.readBits(4),n.readBool()&&n.readBits(24)),n.readBool()&&(n.readUEG(),n.readUEG()),n.readBool()){let e=n.readBits(32),t=n.readBits(32);x=n.readBool(),U=t,k=2*e,B=U/k}}let T=1;1===E&&1===A||(T=E/A);let C=0,D=0;if(0===l)C=1,D=2-y;else{C=3===l?1:2,D=(1===l?2:1)*(2-y)}let P=16*(_+1),F=16*(g+1)*(2-y);P-=(v+b)*C,F-=(w+S)*D;let I=Math.ceil(P*T);return n.destroy(),n=null,{codec_mimetype:r,profile_idc:o,level_idc:s,profile_string:a,level_string:d,chroma_format_idc:l,bit_depth:f,bit_depth_luma:f,bit_depth_chroma:h,ref_frames:m,chroma_format:u,chroma_format_string:Ur.getChromaFormatString(u),frame_rate:{fixed:x,fps:B,fps_den:k,fps_num:U},sar_ratio:{width:E,height:A},codec_size:{width:P,height:F},present_size:{width:I,height:F}}}static _skipScalingList(e,t){let r=8,i=8,n=0;for(let o=0;o=this.buflen)return this.iserro=!0,0;this.iserro=!1,r=this.bufoff+e>8?8-this.bufoff:e,t<<=r,t+=this.buffer[this.bufpos]>>8-this.bufoff-r&255>>8-r,this.bufoff+=r,e-=r,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){let t=this.bufpos,r=this.bufoff,i=this.read(e);return this.bufpos=t,this.bufoff=r,i}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.sps,4),t.sps=i}if(t.pps){const e=t.pps.byteLength,r=new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e]),i=new Uint8Array(e+4);i.set(r,0),i.set(t.pps,4),t.pps=i}return t}function Cr(e){let{sps:t,pps:r}=e;const i=[23,0,0,0,0,1,66,0,30,255];i[0]=23,i[6]=t[1],i[7]=t[2],i[8]=t[3],i[10]=225,i[11]=t.byteLength>>8&255,i[12]=255&t.byteLength,i.push(...t,1,r.byteLength>>8&255,255&r.byteLength,...r);return new Uint8Array(i)}function Dr(e){let{sps:t,pps:r}=e,i=8+t.byteLength+1+2+r.byteLength,n=!1;const o=Ur.parseSPS$2(t);66!==t[3]&&77!==t[3]&&88!==t[3]&&(n=!0,i+=4);let s=new Uint8Array(i);s[0]=1,s[1]=t[1],s[2]=t[2],s[3]=t[3],s[4]=255,s[5]=225;let a=t.byteLength;s[6]=a>>>8,s[7]=255&a;let d=8;s.set(t,8),d+=a,s[d]=1;let l=r.byteLength;s[d+1]=l>>>8,s[d+2]=255&l,s.set(r,d+3),d+=3+l,n&&(s[d]=252|o.chroma_format_idc,s[d+1]=248|o.bit_depth_luma-8,s[d+2]=248|o.bit_depth_chroma-8,s[d+3]=0,d+=4);const u=[23,0,0,0,0],c=new Uint8Array(u.length+s.byteLength);return c.set(u,0),c.set(s,u.length),c}function Pr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Fr(e,t){let r=[];r[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Ir(e){return 31&e[0]}function Lr(e){return e===qe}function Mr(e){return!function(e){return e===$e||e===He}(e)&&!Lr(e)}function Rr(e){return e===Ve}function zr(e){if(0===e.length)return!1;const t=Ir(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=31&e[r],n=(128&e[r])>>>7,o=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=o,i>=Xe||0===n&&(t={type:i,data:e.subarray(r,o)})}return t}}class Or{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}const Gr=e=>{let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)},$r=e=>{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}};class Hr{static _ebsp2rbsp(e){let t=e,r=t.byteLength,i=new Uint8Array(r),n=0;for(let e=0;e=2&&3===t[e]&&0===t[e-1]&&0===t[e-2]||(i[n]=t[e],n++);return new Uint8Array(i.buffer,0,n)}static parseVPS(e){let t=Hr._ebsp2rbsp(e),r=new Gt(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}}static parseSPS(e){let t=Hr._ebsp2rbsp(e),r=new Gt(t);r.readByte(),r.readByte();let i=0,n=0,o=0,s=0;r.readBits(4);let a=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),u=r.readBits(5),c=r.readByte(),f=r.readByte(),h=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=a;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<=16?(I=t[e-1],L=i[e-1]):255===e&&(I=r.readBits(16),L=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()){r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())}if(r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(r.readUEG(),r.readUEG(),r.readUEG(),r.readUEG()),r.readBool()){if(R=r.readBits(32),z=r.readBits(32),r.readBool()&&r.readUEG(),r.readBool()){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=a;n++){let n=r.readBool();M=n;let o=!0,s=1;n||(o=r.readBool());let a=!1;if(o?r.readUEG():a=r.readBool(),a||(s=r.readUEG()+1),e){for(let e=0;e>6&3,r.general_tier_flag=e[1]>>5&1,r.general_profile_idc=31&e[1],r.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],r.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],r.general_constraint_indicator_flags=r.general_constraint_indicator_flags<<16|e[10]<<8|e[11],r.general_level_idc=e[12],r.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],r.parallelismType=3&e[15],r.chromaFormat=3&e[16],r.bitDepthLumaMinus8=7&e[17],r.bitDepthChromaMinus8=7&e[18],r.avgFrameRate=e[19]<<8|e[20],r.constantFrameRate=e[21]>>6&3,r.numTemporalLayers=e[21]>>3&7,r.temporalIdNested=e[21]>>2&1,r.lengthSizeMinusOne=3&e[21];let i=e[22],n=e.slice(23);for(let e=0;e0)for(let t=r;t<8;t++)e.read(2);i.sub_layer_profile_space=[],i.sub_layer_tier_flag=[],i.sub_layer_profile_idc=[],i.sub_layer_profile_compatibility_flag=[],i.sub_layer_progressive_source_flag=[],i.sub_layer_interlaced_source_flag=[],i.sub_layer_non_packed_constraint_flag=[],i.sub_layer_frame_only_constraint_flag=[],i.sub_layer_level_idc=[];for(let t=0;t{let t=Gr(e),r=new Gt(t);return r.readByte(),r.readByte(),r.readBits(4),r.readBits(2),r.readBits(6),{num_temporal_layers:r.readBits(3)+1,temporal_id_nested:r.readBool()}})(t),s=(e=>{let t=Gr(e),r=new Gt(t);r.readByte(),r.readByte();let i=0,n=0,o=0,s=0;r.readBits(4);let a=r.readBits(3);r.readBool();let d=r.readBits(2),l=r.readBool(),u=r.readBits(5),c=r.readByte(),f=r.readByte(),h=r.readByte(),p=r.readByte(),m=r.readByte(),_=r.readByte(),g=r.readByte(),y=r.readByte(),v=r.readByte(),b=r.readByte(),w=r.readByte(),S=[],E=[];for(let e=0;e0)for(let e=a;e<8;e++)r.readBits(2);for(let e=0;e1&&r.readSEG();for(let e=0;e0&&e<16?(I=t[e-1],L=i[e-1]):255===e&&(I=r.readBits(16),L=r.readBits(16))}if(r.readBool()&&r.readBool(),r.readBool()&&(r.readBits(3),r.readBool(),r.readBool()&&(r.readByte(),r.readByte(),r.readByte())),r.readBool()&&(r.readUEG(),r.readUEG()),r.readBool(),r.readBool(),r.readBool(),P=r.readBool(),P&&(i+=r.readUEG(),n+=r.readUEG(),o+=r.readUEG(),s+=r.readUEG()),r.readBool()&&(R=r.readBits(32),z=r.readBits(32),r.readBool()&&(r.readUEG(),r.readBool()))){let e=!1,t=!1,i=!1;e=r.readBool(),t=r.readBool(),(e||t)&&(i=r.readBool(),i&&(r.readByte(),r.readBits(5),r.readBool(),r.readBits(5)),r.readBits(4),r.readBits(4),i&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let n=0;n<=a;n++){let n=r.readBool();M=n;let o=!1,s=1;n||(o=r.readBool());let a=!1;if(o?r.readSEG():a=r.readBool(),a||(cpbcnt=r.readUEG()+1),e)for(let e=0;e{let t=Gr(e),r=new Gt(t);r.readByte(),r.readByte(),r.readUEG(),r.readUEG(),r.readBool(),r.readBool(),r.readBits(3),r.readBool(),r.readBool(),r.readUEG(),r.readUEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool()&&r.readUEG(),r.readSEG(),r.readSEG(),r.readBool(),r.readBool(),r.readBool(),r.readBool();let i=r.readBool(),n=r.readBool(),o=1;return n&&i?o=0:n?o=3:i&&(o=2),{parallelismType:o}})(r);n=Object.assign(n,o,s,a);let d=23+(5+t.byteLength)+(5+i.byteLength)+(5+r.byteLength),l=new Uint8Array(d);l[0]=1,l[1]=(3&n.general_profile_space)<<6|(n.general_tier_flag?1:0)<<5|31&n.general_profile_idc,l[2]=n.general_profile_compatibility_flags_1||0,l[3]=n.general_profile_compatibility_flags_2||0,l[4]=n.general_profile_compatibility_flags_3||0,l[5]=n.general_profile_compatibility_flags_4||0,l[6]=n.general_constraint_indicator_flags_1||0,l[7]=n.general_constraint_indicator_flags_2||0,l[8]=n.general_constraint_indicator_flags_3||0,l[9]=n.general_constraint_indicator_flags_4||0,l[10]=n.general_constraint_indicator_flags_5||0,l[11]=n.general_constraint_indicator_flags_6||0,l[12]=60,l[13]=240|(3840&n.min_spatial_segmentation_idc)>>8,l[14]=255&n.min_spatial_segmentation_idc,l[15]=252|3&n.parallelismType,l[16]=252|3&n.chroma_format_idc,l[17]=248|7&n.bit_depth_luma_minus8,l[18]=248|7&n.bit_depth_chroma_minus8,l[19]=0,l[20]=0,l[21]=(3&n.constant_frame_rate)<<6|(7&n.num_temporal_layers)<<3|(n.temporal_id_nested?1:0)<<2|3,l[22]=3,l[23]=128|et,l[24]=0,l[25]=1,l[26]=(65280&t.byteLength)>>8,l[27]=(255&t.byteLength)>>0,l.set(t,28),l[23+(5+t.byteLength)+0]=128|rt,l[23+(5+t.byteLength)+1]=0,l[23+(5+t.byteLength)+2]=1,l[23+(5+t.byteLength)+3]=(65280&i.byteLength)>>8,l[23+(5+t.byteLength)+4]=(255&i.byteLength)>>0,l.set(i,23+(5+t.byteLength)+5),l[23+(5+t.byteLength+5+i.byteLength)+0]=128|nt,l[23+(5+t.byteLength+5+i.byteLength)+1]=0,l[23+(5+t.byteLength+5+i.byteLength)+2]=1,l[23+(5+t.byteLength+5+i.byteLength)+3]=(65280&r.byteLength)>>8,l[23+(5+t.byteLength+5+i.byteLength)+4]=(255&r.byteLength)>>0,l.set(r,23+(5+t.byteLength+5+i.byteLength)+5);const u=[28,0,0,0,0],c=new Uint8Array(u.length+l.byteLength);return c.set(u,0),c.set(l,u.length),c}function Yr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0,r[5]=e.byteLength>>24&255,r[6]=e.byteLength>>16&255,r[7]=e.byteLength>>8&255,r[8]=255&e.byteLength;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Kr(e,t){let r=[];r[0]=t?28:44,r[1]=1,r[2]=0,r[3]=0,r[4]=0;const i=new Uint8Array(r.length+e.byteLength);return i.set(r,0),i.set(e,r.length),i}function Xr(e){return(126&e[0])>>1}function Zr(e){return e===st}function Jr(e){return!function(e){return e>=32&&e<=40}(e)}function Qr(e){return e>=16&&e<=21}function ei(e){if(0===e.length)return!1;const t=Xr(e[0]);for(let r=1;r=r.byteLength)return this.eofFlag=!0,r.byteLength;let e=r[t+0]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3],i=r[t+0]<<16|r[t+1]<<8|r[t+2];if(1===e||1===i)return t;t++}}readNextNaluPayload(){let e=this.data,t=null;for(;null==t&&!this.eofFlag;){let r=this.currentStartcodeOffset;r+=1===(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])?4:3;let i=e[r]>>1&63,n=(128&e[r])>>>7,o=this.findNextStartCodeOffset(r);this.currentStartcodeOffset=o,0===n&&(t={type:i,data:e.subarray(r,o)})}return t}}class ri{constructor(e){let t=e.data.byteLength;this.type=e.type,this.data=new Uint8Array(4+t),new DataView(this.data.buffer).setUint32(0,t),this.data.set(e.data,4)}}function ii(e){return parseInt(e)===e}function ni(e){if(!ii(e.length))return!1;for(var t=0;t255)return!1;return!0}function oi(e,t){if(e.buffer&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!ni(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(ii(e.length)&&ni(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function si(e){return new Uint8Array(e)}function ai(e,t,r,i,n){null==i&&null==n||(e=e.slice?e.slice(i,n):Array.prototype.slice.call(e,i,n)),t.set(e,r)}var di,li={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&i<224?(t.push(String.fromCharCode((31&i)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&i)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},ui=(di="0123456789abcdef",{toBytes:function(e){for(var t=[],r=0;r>4]+di[15&i])}return t.join("")}}),ci={16:10,24:12,32:14},fi=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],hi=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],pi=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],mi=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],_i=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],gi=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],yi=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],vi=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],bi=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],wi=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],Si=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],Ei=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Ai=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Bi=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],xi=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Ui(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=o[t],this._Kd[e-r][t%4]=o[t];for(var s,a=0,d=n;d>16&255]<<24^hi[s>>8&255]<<16^hi[255&s]<<8^hi[s>>24&255]^fi[a]<<24,a+=1,8!=n)for(t=1;t>8&255]<<8^hi[s>>16&255]<<16^hi[s>>24&255]<<24;for(t=n/2+1;t>2,u=d%4,this._Ke[l][u]=o[t],this._Kd[e-l][u]=o[t++],d++}for(var l=1;l>24&255]^Ai[s>>16&255]^Bi[s>>8&255]^xi[255&s]},ki.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],i=Ui(e),n=0;n<4;n++)i[n]^=this._Ke[0][n];for(var o=1;o>24&255]^_i[i[(n+1)%4]>>16&255]^gi[i[(n+2)%4]>>8&255]^yi[255&i[(n+3)%4]]^this._Ke[o][n];i=r.slice()}var s,a=si(16);for(n=0;n<4;n++)s=this._Ke[t][n],a[4*n]=255&(hi[i[n]>>24&255]^s>>24),a[4*n+1]=255&(hi[i[(n+1)%4]>>16&255]^s>>16),a[4*n+2]=255&(hi[i[(n+2)%4]>>8&255]^s>>8),a[4*n+3]=255&(hi[255&i[(n+3)%4]]^s);return a},ki.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],i=Ui(e),n=0;n<4;n++)i[n]^=this._Kd[0][n];for(var o=1;o>24&255]^bi[i[(n+3)%4]>>16&255]^wi[i[(n+2)%4]>>8&255]^Si[255&i[(n+1)%4]]^this._Kd[o][n];i=r.slice()}var s,a=si(16);for(n=0;n<4;n++)s=this._Kd[t][n],a[4*n]=255&(pi[i[n]>>24&255]^s>>24),a[4*n+1]=255&(pi[i[(n+3)%4]>>16&255]^s>>16),a[4*n+2]=255&(pi[i[(n+2)%4]>>8&255]^s>>8),a[4*n+3]=255&(pi[255&i[(n+1)%4]]^s);return a};var Ti=function(e){if(!(this instanceof Ti))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new ki(e)};Ti.prototype.encrypt=function(e){if((e=oi(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=si(e.length),r=si(16),i=0;iNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;t>=0;--t)this._counter[t]=e%256,e=parseInt(e/256)},Fi.prototype.setBytes=function(e){if(16!=(e=oi(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},Fi.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var Ii=function(e,t){if(!(this instanceof Ii))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",t instanceof Fi||(t=new Fi(t)),this._counter=t,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new ki(e)};Ii.prototype.encrypt=function(e){for(var t=oi(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,i=0;i>>2]>>>24-o%4*8&255;t[i+o>>>2]|=s<<24-(i+o)%4*8}else for(var a=0;a>>2]=r[a>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=d.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-n%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(r,t/2)}},f=u.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var t=e.length,r=[],i=0;i>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(r,t)}},h=u.Utf8={stringify:function(e){try{return decodeURIComponent(escape(f.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return f.parse(unescape(encodeURIComponent(e)))}},p=a.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=h.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,i=this._data,n=i.words,o=i.sigBytes,s=this.blockSize,a=o/(4*s),d=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,u=e.min(4*d,o);if(d){for(var c=0;c>>2]|=e[n]<<24-n%4*8;t.call(this,i,r)}else t.apply(this,arguments)};i.prototype=e}}(),r.lib.WordArray)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.WordArray,i=e.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],n=0;n>>2]>>>16-n%4*8&65535;i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var r=e.length,i=[],n=0;n>>1]|=e.charCodeAt(n)<<16-n%2*16;return t.create(i,2*r)}},i.Utf16LE={stringify:function(e){for(var t=e.words,r=e.sigBytes,i=[],o=0;o>>2]>>>16-o%4*8&65535);i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var r=e.length,i=[],o=0;o>>1]|=n(e.charCodeAt(o)<<16-o%2*16);return t.create(i,2*r)}}}(),r.enc.Utf16)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.WordArray;function i(e,r,i){for(var n=[],o=0,s=0;s>>6-s%4*2;n[o>>>2]|=a<<24-o%4*8,o++}return t.create(n,o)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,i=this._map;e.clamp();for(var n=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>6*(3-a)&63));var d=i.charAt(64);if(d)for(;n.length%4;)n.push(d);return n.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var o=0;o>>6-s%4*2;n[o>>>2]|=a<<24-o%4*8,o++}return t.create(n,o)}e.enc.Base64url={stringify:function(e,t){void 0===t&&(t=!0);var r=e.words,i=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var o=[],s=0;s>>2]>>>24-s%4*8&255)<<16|(r[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|r[s+2>>>2]>>>24-(s+2)%4*8&255,d=0;d<4&&s+.75*d>>6*(3-d)&63));var l=n.charAt(64);if(l)for(;o.length%4;)o.push(l);return o.join("")},parse:function(e,t){void 0===t&&(t=!0);var r=e.length,n=t?this._safe_map:this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var s=0;s>>24)|4278255360&(n<<24|n>>>8)}var o=this._hash.words,s=e[t+0],d=e[t+1],h=e[t+2],p=e[t+3],m=e[t+4],_=e[t+5],g=e[t+6],y=e[t+7],v=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],B=e[t+14],x=e[t+15],U=o[0],k=o[1],T=o[2],C=o[3];U=l(U,k,T,C,s,7,a[0]),C=l(C,U,k,T,d,12,a[1]),T=l(T,C,U,k,h,17,a[2]),k=l(k,T,C,U,p,22,a[3]),U=l(U,k,T,C,m,7,a[4]),C=l(C,U,k,T,_,12,a[5]),T=l(T,C,U,k,g,17,a[6]),k=l(k,T,C,U,y,22,a[7]),U=l(U,k,T,C,v,7,a[8]),C=l(C,U,k,T,b,12,a[9]),T=l(T,C,U,k,w,17,a[10]),k=l(k,T,C,U,S,22,a[11]),U=l(U,k,T,C,E,7,a[12]),C=l(C,U,k,T,A,12,a[13]),T=l(T,C,U,k,B,17,a[14]),U=u(U,k=l(k,T,C,U,x,22,a[15]),T,C,d,5,a[16]),C=u(C,U,k,T,g,9,a[17]),T=u(T,C,U,k,S,14,a[18]),k=u(k,T,C,U,s,20,a[19]),U=u(U,k,T,C,_,5,a[20]),C=u(C,U,k,T,w,9,a[21]),T=u(T,C,U,k,x,14,a[22]),k=u(k,T,C,U,m,20,a[23]),U=u(U,k,T,C,b,5,a[24]),C=u(C,U,k,T,B,9,a[25]),T=u(T,C,U,k,p,14,a[26]),k=u(k,T,C,U,v,20,a[27]),U=u(U,k,T,C,A,5,a[28]),C=u(C,U,k,T,h,9,a[29]),T=u(T,C,U,k,y,14,a[30]),U=c(U,k=u(k,T,C,U,E,20,a[31]),T,C,_,4,a[32]),C=c(C,U,k,T,v,11,a[33]),T=c(T,C,U,k,S,16,a[34]),k=c(k,T,C,U,B,23,a[35]),U=c(U,k,T,C,d,4,a[36]),C=c(C,U,k,T,m,11,a[37]),T=c(T,C,U,k,y,16,a[38]),k=c(k,T,C,U,w,23,a[39]),U=c(U,k,T,C,A,4,a[40]),C=c(C,U,k,T,s,11,a[41]),T=c(T,C,U,k,p,16,a[42]),k=c(k,T,C,U,g,23,a[43]),U=c(U,k,T,C,b,4,a[44]),C=c(C,U,k,T,E,11,a[45]),T=c(T,C,U,k,x,16,a[46]),U=f(U,k=c(k,T,C,U,h,23,a[47]),T,C,s,6,a[48]),C=f(C,U,k,T,y,10,a[49]),T=f(T,C,U,k,B,15,a[50]),k=f(k,T,C,U,_,21,a[51]),U=f(U,k,T,C,E,6,a[52]),C=f(C,U,k,T,p,10,a[53]),T=f(T,C,U,k,w,15,a[54]),k=f(k,T,C,U,d,21,a[55]),U=f(U,k,T,C,v,6,a[56]),C=f(C,U,k,T,x,10,a[57]),T=f(T,C,U,k,g,15,a[58]),k=f(k,T,C,U,A,21,a[59]),U=f(U,k,T,C,m,6,a[60]),C=f(C,U,k,T,S,10,a[61]),T=f(T,C,U,k,h,15,a[62]),k=f(k,T,C,U,b,21,a[63]),o[0]=o[0]+U|0,o[1]=o[1]+k|0,o[2]=o[2]+T|0,o[3]=o[3]+C|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;r[n>>>5]|=128<<24-n%32;var o=e.floor(i/4294967296),s=i;r[15+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(n+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(r.length+1),this._process();for(var a=this._hash,d=a.words,l=0;l<4;l++){var u=d[l];d[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,r,i,n,o,s){var a=e+(t&r|~t&i)+n+s;return(a<>>32-o)+t}function u(e,t,r,i,n,o,s){var a=e+(t&i|r&~i)+n+s;return(a<>>32-o)+t}function c(e,t,r,i,n,o,s){var a=e+(t^r^i)+n+s;return(a<>>32-o)+t}function f(e,t,r,i,n,o,s){var a=e+(r^(t|~i))+n+s;return(a<>>32-o)+t}t.MD5=o._createHelper(d),t.HmacMD5=o._createHmacHelper(d)}(Math),r.MD5)})),Ot((function(e,t){var r,i,n,o,s,a,d,l;e.exports=(i=(r=l=Mi).lib,n=i.WordArray,o=i.Hasher,s=r.algo,a=[],d=s.SHA1=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],s=r[3],d=r[4],l=0;l<80;l++){if(l<16)a[l]=0|e[t+l];else{var u=a[l-3]^a[l-8]^a[l-14]^a[l-16];a[l]=u<<1|u>>>31}var c=(i<<5|i>>>27)+d+a[l];c+=l<20?1518500249+(n&o|~n&s):l<40?1859775393+(n^o^s):l<60?(n&o|n&s|o&s)-1894007588:(n^o^s)-899497514,d=s,s=o,o=n<<30|n>>>2,n=i,i=c}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+d|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(i+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=o._createHelper(d),r.HmacSHA1=o._createHmacHelper(d),l.SHA1)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,n=i.WordArray,o=i.Hasher,s=t.algo,a=[],d=[];!function(){function t(t){for(var r=e.sqrt(t),i=2;i<=r;i++)if(!(t%i))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var i=2,n=0;n<64;)t(i)&&(n<8&&(a[n]=r(e.pow(i,.5))),d[n]=r(e.pow(i,1/3)),n++),i++}();var l=[],u=s.SHA256=o.extend({_doReset:function(){this._hash=new n.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],s=r[3],a=r[4],u=r[5],c=r[6],f=r[7],h=0;h<64;h++){if(h<16)l[h]=0|e[t+h];else{var p=l[h-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,_=l[h-2],g=(_<<15|_>>>17)^(_<<13|_>>>19)^_>>>10;l[h]=m+l[h-7]+g+l[h-16]}var y=i&n^i&o^n&o,v=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=f+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&u^~a&c)+d[h]+l[h];f=c,c=u,u=a,a=s+b|0,s=o,o=n,n=i,i=b+(v+y)|0}r[0]=r[0]+i|0,r[1]=r[1]+n|0,r[2]=r[2]+o|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+u|0,r[6]=r[6]+c|0,r[7]=r[7]+f|0},_doFinalize:function(){var t=this._data,r=t.words,i=8*this._nDataBytes,n=8*t.sigBytes;return r[n>>>5]|=128<<24-n%32,r[14+(n+64>>>9<<4)]=e.floor(i/4294967296),r[15+(n+64>>>9<<4)]=i,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(u),t.HmacSHA256=o._createHmacHelper(u)}(Math),r.SHA256)})),Ot((function(e,t){var r,i,n,o,s,a;e.exports=(i=(r=a=Mi).lib.WordArray,n=r.algo,o=n.SHA256,s=n.SHA224=o.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=4,e}}),r.SHA224=o._createHelper(s),r.HmacSHA224=o._createHmacHelper(s),a.SHA224)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.Hasher,i=e.x64,n=i.Word,o=i.WordArray,s=e.algo;function a(){return n.create.apply(n,arguments)}var d=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=a()}();var u=s.SHA512=t.extend({_doReset:function(){this._hash=new o.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,i=r[0],n=r[1],o=r[2],s=r[3],a=r[4],u=r[5],c=r[6],f=r[7],h=i.high,p=i.low,m=n.high,_=n.low,g=o.high,y=o.low,v=s.high,b=s.low,w=a.high,S=a.low,E=u.high,A=u.low,B=c.high,x=c.low,U=f.high,k=f.low,T=h,C=p,D=m,P=_,F=g,I=y,L=v,M=b,R=w,z=S,N=E,O=A,G=B,$=x,H=U,V=k,W=0;W<80;W++){var j,q,Y=l[W];if(W<16)q=Y.high=0|e[t+2*W],j=Y.low=0|e[t+2*W+1];else{var K=l[W-15],X=K.high,Z=K.low,J=(X>>>1|Z<<31)^(X>>>8|Z<<24)^X>>>7,Q=(Z>>>1|X<<31)^(Z>>>8|X<<24)^(Z>>>7|X<<25),ee=l[W-2],te=ee.high,re=ee.low,ie=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ne=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),oe=l[W-7],se=oe.high,ae=oe.low,de=l[W-16],le=de.high,ue=de.low;q=(q=(q=J+se+((j=Q+ae)>>>0>>0?1:0))+ie+((j+=ne)>>>0>>0?1:0))+le+((j+=ue)>>>0>>0?1:0),Y.high=q,Y.low=j}var ce,fe=R&N^~R&G,he=z&O^~z&$,pe=T&D^T&F^D&F,me=C&P^C&I^P&I,_e=(T>>>28|C<<4)^(T<<30|C>>>2)^(T<<25|C>>>7),ge=(C>>>28|T<<4)^(C<<30|T>>>2)^(C<<25|T>>>7),ye=(R>>>14|z<<18)^(R>>>18|z<<14)^(R<<23|z>>>9),ve=(z>>>14|R<<18)^(z>>>18|R<<14)^(z<<23|R>>>9),be=d[W],we=be.high,Se=be.low,Ee=H+ye+((ce=V+ve)>>>0>>0?1:0),Ae=ge+me;H=G,V=$,G=N,$=O,N=R,O=z,R=L+(Ee=(Ee=(Ee=Ee+fe+((ce+=he)>>>0>>0?1:0))+we+((ce+=Se)>>>0>>0?1:0))+q+((ce+=j)>>>0>>0?1:0))+((z=M+ce|0)>>>0>>0?1:0)|0,L=F,M=I,F=D,I=P,D=T,P=C,T=Ee+(_e+pe+(Ae>>>0>>0?1:0))+((C=ce+Ae|0)>>>0>>0?1:0)|0}p=i.low=p+C,i.high=h+T+(p>>>0>>0?1:0),_=n.low=_+P,n.high=m+D+(_>>>0

>>0?1:0),y=o.low=y+I,o.high=g+F+(y>>>0>>0?1:0),b=s.low=b+M,s.high=v+L+(b>>>0>>0?1:0),S=a.low=S+z,a.high=w+R+(S>>>0>>0?1:0),A=u.low=A+O,u.high=E+N+(A>>>0>>0?1:0),x=c.low=x+$,c.high=B+G+(x>>>0<$>>>0?1:0),k=f.low=k+V,f.high=U+H+(k>>>0>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(i+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(u),e.HmacSHA512=t._createHmacHelper(u)}(),r.SHA512)})),Ot((function(e,t){var r,i,n,o,s,a,d,l;e.exports=(i=(r=l=Mi).x64,n=i.Word,o=i.WordArray,s=r.algo,a=s.SHA512,d=s.SHA384=a.extend({_doReset:function(){this._hash=new o.init([new n.init(3418070365,3238371032),new n.init(1654270250,914150663),new n.init(2438529370,812702999),new n.init(355462360,4144912697),new n.init(1731405415,4290775857),new n.init(2394180231,1750603025),new n.init(3675008525,1694076839),new n.init(1203062813,3204075428)])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=16,e}}),r.SHA384=a._createHelper(d),r.HmacSHA384=a._createHmacHelper(d),l.SHA384)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,n=i.WordArray,o=i.Hasher,s=t.x64.Word,a=t.algo,d=[],l=[],u=[];!function(){for(var e=1,t=0,r=0;r<24;r++){d[e+5*t]=(r+1)*(r+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,o=0;o<24;o++){for(var a=0,c=0,f=0;f<7;f++){if(1&n){var h=(1<>>24)|4278255360&(o<<24|o>>>8),s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),(k=r[n]).high^=s,k.low^=o}for(var a=0;a<24;a++){for(var f=0;f<5;f++){for(var h=0,p=0,m=0;m<5;m++)h^=(k=r[f+5*m]).high,p^=k.low;var _=c[f];_.high=h,_.low=p}for(f=0;f<5;f++){var g=c[(f+4)%5],y=c[(f+1)%5],v=y.high,b=y.low;for(h=g.high^(v<<1|b>>>31),p=g.low^(b<<1|v>>>31),m=0;m<5;m++)(k=r[f+5*m]).high^=h,k.low^=p}for(var w=1;w<25;w++){var S=(k=r[w]).high,E=k.low,A=d[w];A<32?(h=S<>>32-A,p=E<>>32-A):(h=E<>>64-A,p=S<>>64-A);var B=c[l[w]];B.high=h,B.low=p}var x=c[0],U=r[0];for(x.high=U.high,x.low=U.low,f=0;f<5;f++)for(m=0;m<5;m++){var k=r[w=f+5*m],T=c[w],C=c[(f+1)%5+5*m],D=c[(f+2)%5+5*m];k.high=T.high^~C.high&D.high,k.low=T.low^~C.low&D.low}k=r[0];var P=u[a];k.high^=P.high,k.low^=P.low}},_doFinalize:function(){var t=this._data,r=t.words;this._nDataBytes;var i=8*t.sigBytes,o=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(e.ceil((i+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*r.length,this._process();for(var s=this._state,a=this.cfg.outputLength/8,d=a/8,l=[],u=0;u>>24)|4278255360&(f<<24|f>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),l.push(h),l.push(f)}return new n.init(l,a)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),r=0;r<25;r++)t[r]=t[r].clone();return e}});t.SHA3=o._createHelper(f),t.HmacSHA3=o._createHmacHelper(f)}(Math),r.SHA3)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib,n=i.WordArray,o=i.Hasher,s=t.algo,a=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),d=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),u=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),c=n.create([0,1518500249,1859775393,2400959708,2840853838]),f=n.create([1352829926,1548603684,1836072691,2053994217,0]),h=s.RIPEMD160=o.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var i=t+r,n=e[i];e[i]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var o,s,h,b,w,S,E,A,B,x,U,k=this._hash.words,T=c.words,C=f.words,D=a.words,P=d.words,F=l.words,I=u.words;for(S=o=k[0],E=s=k[1],A=h=k[2],B=b=k[3],x=w=k[4],r=0;r<80;r+=1)U=o+e[t+D[r]]|0,U+=r<16?p(s,h,b)+T[0]:r<32?m(s,h,b)+T[1]:r<48?_(s,h,b)+T[2]:r<64?g(s,h,b)+T[3]:y(s,h,b)+T[4],U=(U=v(U|=0,F[r]))+w|0,o=w,w=b,b=v(h,10),h=s,s=U,U=S+e[t+P[r]]|0,U+=r<16?y(E,A,B)+C[0]:r<32?g(E,A,B)+C[1]:r<48?_(E,A,B)+C[2]:r<64?m(E,A,B)+C[3]:p(E,A,B)+C[4],U=(U=v(U|=0,I[r]))+x|0,S=x,x=B,B=v(A,10),A=E,E=U;U=k[1]+h+B|0,k[1]=k[2]+b+x|0,k[2]=k[3]+w+S|0,k[3]=k[4]+o+E|0,k[4]=k[0]+s+A|0,k[0]=U},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,o=n.words,s=0;s<5;s++){var a=o[s];o[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return n},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,r){return e^t^r}function m(e,t,r){return e&t|~e&r}function _(e,t,r){return(e|~t)^r}function g(e,t,r){return e&r|t&~r}function y(e,t,r){return e^(t|~r)}function v(e,t){return e<>>32-t}t.RIPEMD160=o._createHelper(h),t.HmacRIPEMD160=o._createHmacHelper(h)}(),r.RIPEMD160)})),Ot((function(e,t){var r,i,n;e.exports=(i=(r=Mi).lib.Base,n=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var r=e.blockSize,i=4*r;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),s=this._iKey=t.clone(),a=o.words,d=s.words,l=0;l>>2];e.sigBytes-=t}};i.BlockCipher=u.extend({cfg:u.cfg.extend({mode:h,padding:p}),reset:function(){var e;u.reset.call(this);var t=this.cfg,r=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(i,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var m=i.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?o.create([1398893684,1701076831]).concat(r).concat(t):t).toString(d)},parse:function(e){var t,r=d.parse(e),i=r.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=o.create(i.slice(2,4)),i.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:t})}},g=i.SerializableCipher=n.extend({cfg:n.extend({format:_}),encrypt:function(e,t,r,i){i=this.cfg.extend(i);var n=e.createEncryptor(r,i),o=n.finalize(t),s=n.cfg;return m.create({ciphertext:o,key:r,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,r,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(r,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,i,n){if(i||(i=o.random(8)),n)s=l.create({keySize:t+r,hasher:n}).compute(e,i);else var s=l.create({keySize:t+r}).compute(e,i);var a=o.create(s.words.slice(t),4*r);return s.sigBytes=4*t,m.create({key:s,iv:a,salt:i})}},v=i.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(e,t,r,i){var n=(i=this.cfg.extend(i)).kdf.execute(r,e.keySize,e.ivSize,i.salt,i.hasher);i.iv=n.iv;var o=g.encrypt.call(this,e,t,n.key,i);return o.mixIn(n),o},decrypt:function(e,t,r,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var n=i.kdf.execute(r,e.keySize,e.ivSize,t.salt,i.hasher);return i.iv=n.iv,g.decrypt.call(this,e,t,n.key,i)}})}())})),Ot((function(e,t){var r;e.exports=((r=Mi).mode.CFB=function(){var e=r.lib.BlockCipherMode.extend();function t(e,t,r,i){var n,o=this._iv;o?(n=o.slice(0),this._iv=void 0):n=this._prevBlock,i.encryptBlock(n,0);for(var s=0;s>24&255)){var t=e>>16&255,r=e>>8&255,i=255&e;255===t?(t=0,255===r?(r=0,255===i?i=0:++i):++r):++t,e=0,e+=t<<16,e+=r<<8,e+=i}else e+=1<<24;return e}function i(e){return 0===(e[0]=t(e[0]))&&(e[1]=t(e[1])),e}var n=e.Encryptor=e.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=this._iv,s=this._counter;o&&(s=this._counter=o.slice(0),this._iv=void 0),i(s);var a=s.slice(0);r.encryptBlock(a,0);for(var d=0;d>>2]|=n<<24-o%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Ansix923)})),Ot((function(e,t){var r;e.exports=((r=Mi).pad.Iso10126={pad:function(e,t){var i=4*t,n=i-e.sigBytes%i;e.concat(r.lib.WordArray.random(n-1)).concat(r.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.pad.Iso10126)})),Ot((function(e,t){var r;e.exports=((r=Mi).pad.Iso97971={pad:function(e,t){e.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(e,t)},unpad:function(e){r.pad.ZeroPadding.unpad(e),e.sigBytes--}},r.pad.Iso97971)})),Ot((function(e,t){var r;e.exports=((r=Mi).pad.ZeroPadding={pad:function(e,t){var r=4*t;e.clamp(),e.sigBytes+=r-(e.sigBytes%r||r)},unpad:function(e){var t=e.words,r=e.sigBytes-1;for(r=e.sigBytes-1;r>=0;r--)if(t[r>>>2]>>>24-r%4*8&255){e.sigBytes=r+1;break}}},r.pad.ZeroPadding)})),Ot((function(e,t){var r;e.exports=((r=Mi).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(e){var t=r,i=t.lib.CipherParams,n=t.enc.Hex;t.format.Hex={stringify:function(e){return e.ciphertext.toString(n)},parse:function(e){var t=n.parse(e);return i.create({ciphertext:t})}}}(),r.format.Hex)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo,n=[],o=[],s=[],a=[],d=[],l=[],u=[],c=[],f=[],h=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,n[r]=p,o[p]=r;var m=e[r],_=e[m],g=e[_],y=257*e[p]^16843008*p;s[r]=y<<24|y>>>8,a[r]=y<<16|y>>>16,d[r]=y<<8|y>>>24,l[r]=y,y=16843009*g^65537*_^257*m^16843008*r,u[p]=y<<24|y>>>8,c[p]=y<<16|y>>>16,f[p]=y<<8|y>>>24,h[p]=y,r?(r=m^e[e[e[g^m]]],i^=e[e[i]]):r=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,i=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],s=0;s6&&s%r==4&&(l=n[l>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l]):(l=n[(l=l<<8|l>>>24)>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l],l^=p[s/r|0]<<24),o[s]=o[s-r]^l);for(var a=this._invKeySchedule=[],d=0;d>>24]]^c[n[l>>>16&255]]^f[n[l>>>8&255]]^h[n[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,d,l,n)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,u,c,f,h,o),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,i,n,o,s,a){for(var d=this._nRounds,l=e[t]^r[0],u=e[t+1]^r[1],c=e[t+2]^r[2],f=e[t+3]^r[3],h=4,p=1;p>>24]^n[u>>>16&255]^o[c>>>8&255]^s[255&f]^r[h++],_=i[u>>>24]^n[c>>>16&255]^o[f>>>8&255]^s[255&l]^r[h++],g=i[c>>>24]^n[f>>>16&255]^o[l>>>8&255]^s[255&u]^r[h++],y=i[f>>>24]^n[l>>>16&255]^o[u>>>8&255]^s[255&c]^r[h++];l=m,u=_,c=g,f=y}m=(a[l>>>24]<<24|a[u>>>16&255]<<16|a[c>>>8&255]<<8|a[255&f])^r[h++],_=(a[u>>>24]<<24|a[c>>>16&255]<<16|a[f>>>8&255]<<8|a[255&l])^r[h++],g=(a[c>>>24]<<24|a[f>>>16&255]<<16|a[l>>>8&255]<<8|a[255&u])^r[h++],y=(a[f>>>24]<<24|a[l>>>16&255]<<16|a[u>>>8&255]<<8|a[255&c])^r[h++],e[t]=m,e[t+1]=_,e[t+2]=g,e[t+3]=y},keySize:8});e.AES=t._createHelper(m)}(),r.AES)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib,i=t.WordArray,n=t.BlockCipher,o=e.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],d=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],u=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],c=o.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],r=0;r<56;r++){var i=s[r]-1;t[r]=e[i>>>5]>>>31-i%32&1}for(var n=this._subKeys=[],o=0;o<16;o++){var l=n[o]=[],u=d[o];for(r=0;r<24;r++)l[r/6|0]|=t[(a[r]-1+u)%28]<<31-r%6,l[4+(r/6|0)]|=t[28+(a[r+24]-1+u)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var c=this._invSubKeys=[];for(r=0;r<16;r++)c[r]=n[15-r]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,r){this._lBlock=e[t],this._rBlock=e[t+1],f.call(this,4,252645135),f.call(this,16,65535),h.call(this,2,858993459),h.call(this,8,16711935),f.call(this,1,1431655765);for(var i=0;i<16;i++){for(var n=r[i],o=this._lBlock,s=this._rBlock,a=0,d=0;d<8;d++)a|=l[d][((s^n[d])&u[d])>>>0];this._lBlock=s,this._rBlock=o^a}var c=this._lBlock;this._lBlock=this._rBlock,this._rBlock=c,f.call(this,1,1431655765),h.call(this,8,16711935),h.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function f(e,t){var r=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=r,this._lBlock^=r<>>e^this._lBlock)&t;this._lBlock^=r,this._rBlock^=r<192.");var t=e.slice(0,2),r=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=c.createEncryptor(i.create(t)),this._des2=c.createEncryptor(i.create(r)),this._des3=c.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(p)}(),r.TripleDES)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,r=e.sigBytes,i=this._S=[],n=0;n<256;n++)i[n]=n;n=0;for(var o=0;n<256;n++){var s=n%r,a=t[s>>>2]>>>24-s%4*8&255;o=(o+i[n]+a)%256;var d=i[n];i[n]=i[o],i[o]=d}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,r=this._j,i=0,n=0;n<4;n++){r=(r+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[r],e[r]=o,i|=e[(e[t]+e[r])%256]<<24-8*n}return this._i=t,this._j=r,i}e.RC4=t._createHelper(n);var s=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});e.RC4Drop=t._createHelper(s)}(),r.RC4)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],o=[],s=[],a=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,r=0;r<4;r++)e[r]=16711935&(e[r]<<8|e[r]>>>24)|4278255360&(e[r]<<24|e[r]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,r=0;r<4;r++)d.call(this);for(r=0;r<8;r++)n[r]^=i[r+4&7];if(t){var o=t.words,s=o[0],a=o[1],l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=l>>>16|4294901760&u,f=u<<16|65535&l;for(n[0]^=l,n[1]^=c,n[2]^=u,n[3]^=f,n[4]^=l,n[5]^=c,n[6]^=u,n[7]^=f,r=0;r<4;r++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,a=i>>>16,d=((n*n>>>17)+n*a>>>15)+a*a,l=((4294901760&i)*i|0)+((65535&i)*i|0);s[r]=d^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=t._createHelper(a)}(),r.Rabbit)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.StreamCipher,i=e.algo,n=[],o=[],s=[],a=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,r=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)d.call(this);for(n=0;n<8;n++)i[n]^=r[n+4&7];if(t){var o=t.words,s=o[0],a=o[1],l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=l>>>16|4294901760&u,f=u<<16|65535&l;for(i[0]^=l,i[1]^=c,i[2]^=u,i[3]^=f,i[4]^=l,i[5]^=c,i[6]^=u,i[7]^=f,n=0;n<4;n++)d.call(this)}},_doProcessBlock:function(e,t){var r=this._X;d.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),e[t+i]^=n[i]},blockSize:4,ivSize:2});function d(){for(var e=this._X,t=this._C,r=0;r<8;r++)o[r]=t[r];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0>>0?1:0)|0,this._b=t[7]>>>0>>0?1:0,r=0;r<8;r++){var i=e[r]+t[r],n=65535&i,a=i>>>16,d=((n*n>>>17)+n*a>>>15)+a*a,l=((4294901760&i)*i|0)+((65535&i)*i|0);s[r]=d^l}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=t._createHelper(a)}(),r.RabbitLegacy)})),Ot((function(e,t){var r;e.exports=(r=Mi,function(){var e=r,t=e.lib.BlockCipher,i=e.algo;const n=16,o=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],s=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var a={pbox:[],sbox:[]};function d(e,t){let r=t>>24&255,i=t>>16&255,n=t>>8&255,o=255&t,s=e.sbox[0][r]+e.sbox[1][i];return s^=e.sbox[2][n],s+=e.sbox[3][o],s}function l(e,t,r){let i,o=t,s=r;for(let t=0;t1;--t)o^=e.pbox[t],s=d(e,o)^s,i=o,o=s,s=i;return i=o,o=s,s=i,s^=e.pbox[1],o^=e.pbox[0],{left:o,right:s}}function c(e,t,r){for(let t=0;t<4;t++){e.sbox[t]=[];for(let r=0;r<256;r++)e.sbox[t][r]=s[t][r]}let i=0;for(let s=0;s=r&&(i=0);let a=0,d=0,u=0;for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];t=new Uint8Array(t),r=new Uint8Array(r);const n=e.byteLength;let o=5;for(;on)break;let a=e[o+4],d=!1;if(i?(a=a>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(a)):(a&=31,d=1===a||5===a),d){const i=e.slice(o+4+2,o+4+s);let n=new Li.ModeOfOperation.ctr(t,new Li.Counter(r));const a=n.decrypt(i);n=null,e.set(a,o+4+2)}o=o+4+s}return e}function Ni(e,t,r){if(e.byteLength<=30)return e;const i=e.slice(32);let n=new Li.ModeOfOperation.ctr(t,new Li.Counter(r));const o=n.decrypt(i);return n=null,e.set(o,32),e}Ot((function(e,t){e.exports=Mi}));var Oi=Ot((function(e,t){var r,n,o,s=(r=new Date,n=4,o={setLogLevel:function(e){n=e==this.debug?1:e==this.info?2:e==this.warn?3:(this.error,4)},debug:function(e,t){void 0===console.debug&&(console.debug=console.log),1>=n&&console.debug("["+s.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},log:function(e,t){this.debug(e.msg)},info:function(e,t){2>=n&&console.info("["+s.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},warn:function(e,t){3>=n&&console.warn("["+s.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)},error:function(e,t){4>=n&&console.error("["+s.getDurationString(new Date-r,1e3)+"]","["+e+"]",t)}},o);s.getDurationString=function(e,t){var r;function i(e,t){for(var r=(""+e).split(".");r[0].length0){for(var r="",i=0;i0&&(r+=","),r+="["+s.getDurationString(e.start(i))+","+s.getDurationString(e.end(i))+"]";return r}return"(empty)"},t.Log=s;var a=function(e){if(!(e instanceof ArrayBuffer))throw"Needs an array buffer";this.buffer=e,this.dataview=new DataView(e),this.position=0};a.prototype.getPosition=function(){return this.position},a.prototype.getEndPosition=function(){return this.buffer.byteLength},a.prototype.getLength=function(){return this.buffer.byteLength},a.prototype.seek=function(e){var t=Math.max(0,Math.min(this.buffer.byteLength,e));return this.position=isNaN(t)||!isFinite(t)?0:t,!0},a.prototype.isEos=function(){return this.getPosition()>=this.getEndPosition()},a.prototype.readAnyInt=function(e,t){var r=0;if(this.position+e<=this.buffer.byteLength){switch(e){case 1:r=t?this.dataview.getInt8(this.position):this.dataview.getUint8(this.position);break;case 2:r=t?this.dataview.getInt16(this.position):this.dataview.getUint16(this.position);break;case 3:if(t)throw"No method for reading signed 24 bits values";r=this.dataview.getUint8(this.position)<<16,r|=this.dataview.getUint8(this.position+1)<<8,r|=this.dataview.getUint8(this.position+2);break;case 4:r=t?this.dataview.getInt32(this.position):this.dataview.getUint32(this.position);break;case 8:if(t)throw"No method for reading signed 64 bits values";r=this.dataview.getUint32(this.position)<<32,r|=this.dataview.getUint32(this.position+4);break;default:throw"readInt method not implemented for size: "+e}return this.position+=e,r}throw"Not enough bytes in buffer"},a.prototype.readUint8=function(){return this.readAnyInt(1,!1)},a.prototype.readUint16=function(){return this.readAnyInt(2,!1)},a.prototype.readUint24=function(){return this.readAnyInt(3,!1)},a.prototype.readUint32=function(){return this.readAnyInt(4,!1)},a.prototype.readUint64=function(){return this.readAnyInt(8,!1)},a.prototype.readString=function(e){if(this.position+e<=this.buffer.byteLength){for(var t="",r=0;rthis._byteLength&&(this._byteLength=t);else{for(r<1&&(r=1);t>r;)r*=2;var i=new ArrayBuffer(r),n=new Uint8Array(this._buffer);new Uint8Array(i,0,n.length).set(n),this.buffer=i,this._byteLength=t}}},d.prototype._trimAlloc=function(){if(this._byteLength!=this._buffer.byteLength){var e=new ArrayBuffer(this._byteLength),t=new Uint8Array(e),r=new Uint8Array(this._buffer,0,t.length);t.set(r),this.buffer=e}},d.BIG_ENDIAN=!1,d.LITTLE_ENDIAN=!0,d.prototype._byteLength=0,Object.defineProperty(d.prototype,"byteLength",{get:function(){return this._byteLength-this._byteOffset}}),Object.defineProperty(d.prototype,"buffer",{get:function(){return this._trimAlloc(),this._buffer},set:function(e){this._buffer=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"byteOffset",{get:function(){return this._byteOffset},set:function(e){this._byteOffset=e,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._buffer.byteLength}}),Object.defineProperty(d.prototype,"dataView",{get:function(){return this._dataView},set:function(e){this._byteOffset=e.byteOffset,this._buffer=e.buffer,this._dataView=new DataView(this._buffer,this._byteOffset),this._byteLength=this._byteOffset+e.byteLength}}),d.prototype.seek=function(e){var t=Math.max(0,Math.min(this.byteLength,e));this.position=isNaN(t)||!isFinite(t)?0:t},d.prototype.isEof=function(){return this.position>=this._byteLength},d.prototype.mapUint8Array=function(e){this._realloc(1*e);var t=new Uint8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.readInt32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Int32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Int16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Int8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readUint32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Uint32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint16Array=function(e,t){e=null==e?this.byteLength-this.position/2:e;var r=new Uint16Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readUint8Array=function(e){e=null==e?this.byteLength-this.position:e;var t=new Uint8Array(e);return d.memcpy(t.buffer,0,this.buffer,this.byteOffset+this.position,e*t.BYTES_PER_ELEMENT),this.position+=t.byteLength,t},d.prototype.readFloat64Array=function(e,t){e=null==e?this.byteLength-this.position/8:e;var r=new Float64Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readFloat32Array=function(e,t){e=null==e?this.byteLength-this.position/4:e;var r=new Float32Array(e);return d.memcpy(r.buffer,0,this.buffer,this.byteOffset+this.position,e*r.BYTES_PER_ELEMENT),d.arrayToNative(r,null==t?this.endianness:t),this.position+=r.byteLength,r},d.prototype.readInt32=function(e){var t=this._dataView.getInt32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readInt16=function(e){var t=this._dataView.getInt16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readInt8=function(){var e=this._dataView.getInt8(this.position);return this.position+=1,e},d.prototype.readUint32=function(e){var t=this._dataView.getUint32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readUint16=function(e){var t=this._dataView.getUint16(this.position,null==e?this.endianness:e);return this.position+=2,t},d.prototype.readUint8=function(){var e=this._dataView.getUint8(this.position);return this.position+=1,e},d.prototype.readFloat32=function(e){var t=this._dataView.getFloat32(this.position,null==e?this.endianness:e);return this.position+=4,t},d.prototype.readFloat64=function(e){var t=this._dataView.getFloat64(this.position,null==e?this.endianness:e);return this.position+=8,t},d.endianness=new Int8Array(new Int16Array([1]).buffer)[0]>0,d.memcpy=function(e,t,r,i,n){var o=new Uint8Array(e,t,n),s=new Uint8Array(r,i,n);o.set(s)},d.arrayToNative=function(e,t){return t==this.endianness?e:this.flipArrayEndianness(e)},d.nativeToEndian=function(e,t){return this.endianness==t?e:this.flipArrayEndianness(e)},d.flipArrayEndianness=function(e){for(var t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=0;rn;i--,n++){var o=t[n];t[n]=t[i],t[i]=o}return e},d.prototype.failurePosition=0,String.fromCharCodeUint8=function(e){for(var t=[],r=0;r>16),this.writeUint8((65280&e)>>8),this.writeUint8(255&e)},d.prototype.adjustUint32=function(e,t){var r=this.position;this.seek(e),this.writeUint32(t),this.seek(r)},d.prototype.mapInt32Array=function(e,t){this._realloc(4*e);var r=new Int32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapInt16Array=function(e,t){this._realloc(2*e);var r=new Int16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapInt8Array=function(e){this._realloc(1*e);var t=new Int8Array(this._buffer,this.byteOffset+this.position,e);return this.position+=1*e,t},d.prototype.mapUint32Array=function(e,t){this._realloc(4*e);var r=new Uint32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r},d.prototype.mapUint16Array=function(e,t){this._realloc(2*e);var r=new Uint16Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=2*e,r},d.prototype.mapFloat64Array=function(e,t){this._realloc(8*e);var r=new Float64Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=8*e,r},d.prototype.mapFloat32Array=function(e,t){this._realloc(4*e);var r=new Float32Array(this._buffer,this.byteOffset+this.position,e);return d.arrayToNative(r,null==t?this.endianness:t),this.position+=4*e,r};var u=function(e){this.buffers=[],this.bufferIndex=-1,e&&(this.insertBuffer(e),this.bufferIndex=0)};(u.prototype=new d(new ArrayBuffer,0,d.BIG_ENDIAN)).initialized=function(){var e;return this.bufferIndex>-1||(this.buffers.length>0?0===(e=this.buffers[0]).fileStart?(this.buffer=e,this.bufferIndex=0,s.debug("MultiBufferStream","Stream ready for parsing"),!0):(s.warn("MultiBufferStream","The first buffer should have a fileStart of 0"),this.logBufferLevel(),!1):(s.warn("MultiBufferStream","No buffer to start parsing from"),this.logBufferLevel(),!1))},ArrayBuffer.concat=function(e,t){s.debug("ArrayBuffer","Trying to create a new buffer of size: "+(e.byteLength+t.byteLength));var r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r.buffer},u.prototype.reduceBuffer=function(e,t,r){var i;return(i=new Uint8Array(r)).set(new Uint8Array(e,t,r)),i.buffer.fileStart=e.fileStart+t,i.buffer.usedBytes=0,i.buffer},u.prototype.insertBuffer=function(e){for(var t=!0,r=0;ri.byteLength){this.buffers.splice(r,1),r--;continue}s.warn("MultiBufferStream","Buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+") already appended, ignoring")}else e.fileStart+e.byteLength<=i.fileStart||(e=this.reduceBuffer(e,0,i.fileStart-e.fileStart)),s.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.splice(r,0,e),0===r&&(this.buffer=e);t=!1;break}if(e.fileStart0)){t=!1;break}e=this.reduceBuffer(e,n,o)}}t&&(s.debug("MultiBufferStream","Appending new buffer (fileStart: "+e.fileStart+" - Length: "+e.byteLength+")"),this.buffers.push(e),0===r&&(this.buffer=e))},u.prototype.logBufferLevel=function(e){var t,r,i,n,o,a=[],d="";for(i=0,n=0,t=0;t0&&(d+=o.end-1+"]");var l=e?s.info:s.debug;0===this.buffers.length?l("MultiBufferStream","No more buffer in memory"):l("MultiBufferStream",this.buffers.length+" stored buffer(s) ("+i+"/"+n+" bytes), continuous ranges: "+d)},u.prototype.cleanBuffers=function(){var e,t;for(e=0;e"+this.buffer.byteLength+")"),!0}return!1}return!1},u.prototype.findPosition=function(e,t,r){var i,n=null,o=-1;for(i=!0===e?0:this.bufferIndex;i=t?(s.debug("MultiBufferStream","Found position in existing buffer #"+o),o):-1},u.prototype.findEndContiguousBuf=function(e){var t,r,i,n=void 0!==e?e:this.bufferIndex;if(r=this.buffers[n],this.buffers.length>n+1)for(t=n+1;t>3;return 31===i&&r.data.length>=2&&(i=32+((7&r.data[0])<<3)+((224&r.data[1])>>5)),i}return null},r.DecoderConfigDescriptor=function(e){r.Descriptor.call(this,4,e)},r.DecoderConfigDescriptor.prototype=new r.Descriptor,r.DecoderConfigDescriptor.prototype.parse=function(e){this.oti=e.readUint8(),this.streamType=e.readUint8(),this.upStream=0!=(this.streamType>>1&1),this.streamType=this.streamType>>>2,this.bufferSize=e.readUint24(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32(),this.size-=13,this.parseRemainingDescriptors(e)},r.DecoderSpecificInfo=function(e){r.Descriptor.call(this,5,e)},r.DecoderSpecificInfo.prototype=new r.Descriptor,r.SLConfigDescriptor=function(e){r.Descriptor.call(this,6,e)},r.SLConfigDescriptor.prototype=new r.Descriptor,this};t.MPEG4DescriptorParser=c;var f={ERR_INVALID_DATA:-1,ERR_NOT_ENOUGH_DATA:0,OK:1,BASIC_BOXES:["mdat","idat","free","skip","meco","strk"],FULL_BOXES:["hmhd","nmhd","iods","xml ","bxml","ipro","mere"],CONTAINER_BOXES:[["moov",["trak","pssh"]],["trak"],["edts"],["mdia"],["minf"],["dinf"],["stbl",["sgpd","sbgp"]],["mvex",["trex"]],["moof",["traf"]],["traf",["trun","sgpd","sbgp"]],["vttc"],["tref"],["iref"],["mfra",["tfra"]],["meco"],["hnti"],["hinf"],["strk"],["strd"],["sinf"],["rinf"],["schi"],["trgr"],["udta",["kind"]],["iprp",["ipma"]],["ipco"],["grpl"],["j2kH"],["etyp",["tyco"]]],boxCodes:[],fullBoxCodes:[],containerBoxCodes:[],sampleEntryCodes:{},sampleGroupEntryCodes:[],trackGroupTypes:[],UUIDBoxes:{},UUIDs:[],initialize:function(){f.FullBox.prototype=new f.Box,f.ContainerBox.prototype=new f.Box,f.SampleEntry.prototype=new f.Box,f.TrackGroupTypeBox.prototype=new f.FullBox,f.BASIC_BOXES.forEach((function(e){f.createBoxCtor(e)})),f.FULL_BOXES.forEach((function(e){f.createFullBoxCtor(e)})),f.CONTAINER_BOXES.forEach((function(e){f.createContainerBoxCtor(e[0],null,e[1])}))},Box:function(e,t,r){this.type=e,this.size=t,this.uuid=r},FullBox:function(e,t,r){f.Box.call(this,e,t,r),this.flags=0,this.version=0},ContainerBox:function(e,t,r){f.Box.call(this,e,t,r),this.boxes=[]},SampleEntry:function(e,t,r,i){f.ContainerBox.call(this,e,t),this.hdr_size=r,this.start=i},SampleGroupEntry:function(e){this.grouping_type=e},TrackGroupTypeBox:function(e,t){f.FullBox.call(this,e,t)},createBoxCtor:function(e,t){f.boxCodes.push(e),f[e+"Box"]=function(t){f.Box.call(this,e,t)},f[e+"Box"].prototype=new f.Box,t&&(f[e+"Box"].prototype.parse=t)},createFullBoxCtor:function(e,t){f[e+"Box"]=function(t){f.FullBox.call(this,e,t)},f[e+"Box"].prototype=new f.FullBox,f[e+"Box"].prototype.parse=function(e){this.parseFullHeader(e),t&&t.call(this,e)}},addSubBoxArrays:function(e){if(e){this.subBoxNames=e;for(var t=e.length,r=0;rr?(s.error("BoxParser","Box of type '"+u+"' has a size "+l+" greater than its container size "+r),{code:f.ERR_NOT_ENOUGH_DATA,type:u,size:l,hdr_size:d,start:a}):0!==l&&a+l>e.getEndPosition()?(e.seek(a),s.info("BoxParser","Not enough data in stream to parse the entire '"+u+"' box"),{code:f.ERR_NOT_ENOUGH_DATA,type:u,size:l,hdr_size:d,start:a}):t?{code:f.OK,type:u,size:l,hdr_size:d,start:a}:(f[u+"Box"]?i=new f[u+"Box"](l):"uuid"!==u?(s.warn("BoxParser","Unknown box type: '"+u+"'"),(i=new f.Box(u,l)).has_unparsed_data=!0):f.UUIDBoxes[o]?i=new f.UUIDBoxes[o](l):(s.warn("BoxParser","Unknown uuid type: '"+o+"'"),(i=new f.Box(u,l)).uuid=o,i.has_unparsed_data=!0),i.hdr_size=d,i.start=a,i.write===f.Box.prototype.write&&"mdat"!==i.type&&(s.info("BoxParser","'"+c+"' box writing not yet implemented, keeping unparsed data in memory for later write"),i.parseDataAndRewind(e)),i.parse(e),(n=e.getPosition()-(i.start+i.size))<0?(s.warn("BoxParser","Parsing of box '"+c+"' did not read the entire indicated box data size (missing "+-n+" bytes), seeking forward"),e.seek(i.start+i.size)):n>0&&(s.error("BoxParser","Parsing of box '"+c+"' read "+n+" more bytes than the indicated box data size, seeking backwards"),0!==i.size&&e.seek(i.start+i.size)),{code:f.OK,box:i,size:i.size})},f.Box.prototype.parse=function(e){"mdat"!=this.type?this.data=e.readUint8Array(this.size-this.hdr_size):0===this.size?e.seek(e.getEndPosition()):e.seek(this.start+this.size)},f.Box.prototype.parseDataAndRewind=function(e){this.data=e.readUint8Array(this.size-this.hdr_size),e.position-=this.size-this.hdr_size},f.FullBox.prototype.parseDataAndRewind=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=4,e.position-=this.size-this.hdr_size},f.FullBox.prototype.parseFullHeader=function(e){this.version=e.readUint8(),this.flags=e.readUint24(),this.hdr_size+=4},f.FullBox.prototype.parse=function(e){this.parseFullHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},f.ContainerBox.prototype.parse=function(e){for(var t,r;e.getPosition()>10&31,t[1]=this.language>>5&31,t[2]=31&this.language,this.languageString=String.fromCharCode(t[0]+96,t[1]+96,t[2]+96)},f.SAMPLE_ENTRY_TYPE_VISUAL="Visual",f.SAMPLE_ENTRY_TYPE_AUDIO="Audio",f.SAMPLE_ENTRY_TYPE_HINT="Hint",f.SAMPLE_ENTRY_TYPE_METADATA="Metadata",f.SAMPLE_ENTRY_TYPE_SUBTITLE="Subtitle",f.SAMPLE_ENTRY_TYPE_SYSTEM="System",f.SAMPLE_ENTRY_TYPE_TEXT="Text",f.SampleEntry.prototype.parseHeader=function(e){e.readUint8Array(6),this.data_reference_index=e.readUint16(),this.hdr_size+=8},f.SampleEntry.prototype.parse=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size)},f.SampleEntry.prototype.parseDataAndRewind=function(e){this.parseHeader(e),this.data=e.readUint8Array(this.size-this.hdr_size),this.hdr_size-=8,e.position-=this.size-this.hdr_size},f.SampleEntry.prototype.parseFooter=function(e){f.ContainerBox.prototype.parse.call(this,e)},f.createMediaSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_HINT),f.createMediaSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_METADATA),f.createMediaSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_SUBTITLE),f.createMediaSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_SYSTEM),f.createMediaSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_TEXT),f.createMediaSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,(function(e){var t;this.parseHeader(e),e.readUint16(),e.readUint16(),e.readUint32Array(3),this.width=e.readUint16(),this.height=e.readUint16(),this.horizresolution=e.readUint32(),this.vertresolution=e.readUint32(),e.readUint32(),this.frame_count=e.readUint16(),t=Math.min(31,e.readUint8()),this.compressorname=e.readString(t),t<31&&e.readString(31-t),this.depth=e.readUint16(),e.readUint16(),this.parseFooter(e)})),f.createMediaSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_AUDIO,(function(e){this.parseHeader(e),e.readUint32Array(2),this.channel_count=e.readUint16(),this.samplesize=e.readUint16(),e.readUint16(),e.readUint16(),this.samplerate=e.readUint32()/65536,this.parseFooter(e)})),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"avc1"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"avc2"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"avc3"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"avc4"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"av01"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"dav1"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"hvc1"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"hev1"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"hvt1"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"lhe1"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"dvh1"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"dvhe"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"vvc1"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"vvi1"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"vvs1"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"vvcN"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"vp08"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"vp09"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"avs3"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"j2ki"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"mjp2"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"mjpg"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"uncv"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_AUDIO,"mp4a"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_AUDIO,"ac-3"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_AUDIO,"ac-4"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_AUDIO,"ec-3"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_AUDIO,"Opus"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_AUDIO,"mha1"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_AUDIO,"mha2"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_AUDIO,"mhm1"),f.createSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_AUDIO,"mhm2"),f.createEncryptedSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_VISUAL,"encv"),f.createEncryptedSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_AUDIO,"enca"),f.createEncryptedSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_SUBTITLE,"encu"),f.createEncryptedSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_SYSTEM,"encs"),f.createEncryptedSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_TEXT,"enct"),f.createEncryptedSampleEntryCtor(f.SAMPLE_ENTRY_TYPE_METADATA,"encm"),f.createBoxCtor("a1lx",(function(e){var t=16*(1+(1&(1&e.readUint8())));this.layer_size=[];for(var r=0;r<3;r++)this.layer_size[r]=16==t?e.readUint16():e.readUint32()})),f.createBoxCtor("a1op",(function(e){this.op_index=e.readUint8()})),f.createFullBoxCtor("auxC",(function(e){this.aux_type=e.readCString();var t=this.size-this.hdr_size-(this.aux_type.length+1);this.aux_subtype=e.readUint8Array(t)})),f.createBoxCtor("av1C",(function(e){var t=e.readUint8();if(t>>7&!1)s.error("av1C marker problem");else if(this.version=127&t,1===this.version)if(t=e.readUint8(),this.seq_profile=t>>5&7,this.seq_level_idx_0=31&t,t=e.readUint8(),this.seq_tier_0=t>>7&1,this.high_bitdepth=t>>6&1,this.twelve_bit=t>>5&1,this.monochrome=t>>4&1,this.chroma_subsampling_x=t>>3&1,this.chroma_subsampling_y=t>>2&1,this.chroma_sample_position=3&t,t=e.readUint8(),this.reserved_1=t>>5&7,0===this.reserved_1){if(this.initial_presentation_delay_present=t>>4&1,1===this.initial_presentation_delay_present)this.initial_presentation_delay_minus_one=15&t;else if(this.reserved_2=15&t,0!==this.reserved_2)return void s.error("av1C reserved_2 parsing problem");var r=this.size-this.hdr_size-4;this.configOBUs=e.readUint8Array(r)}else s.error("av1C reserved_1 parsing problem");else s.error("av1C version "+this.version+" not supported")})),f.createBoxCtor("avcC",(function(e){var t,r;for(this.configurationVersion=e.readUint8(),this.AVCProfileIndication=e.readUint8(),this.profile_compatibility=e.readUint8(),this.AVCLevelIndication=e.readUint8(),this.lengthSizeMinusOne=3&e.readUint8(),this.nb_SPS_nalus=31&e.readUint8(),r=this.size-this.hdr_size-6,this.SPS=[],t=0;t0&&(this.ext=e.readUint8Array(r))})),f.createBoxCtor("btrt",(function(e){this.bufferSizeDB=e.readUint32(),this.maxBitrate=e.readUint32(),this.avgBitrate=e.readUint32()})),f.createFullBoxCtor("ccst",(function(e){var t=e.readUint8();this.all_ref_pics_intra=128==(128&t),this.intra_pred_used=64==(64&t),this.max_ref_per_pic=(63&t)>>2,e.readUint24()})),f.createBoxCtor("cdef",(function(e){var t;for(this.channel_count=e.readUint16(),this.channel_indexes=[],this.channel_types=[],this.channel_associations=[],t=0;t=32768&&this.component_type_urls.push(e.readCString())}})),f.createFullBoxCtor("co64",(function(e){var t,r;if(t=e.readUint32(),this.chunk_offsets=[],0===this.version)for(r=0;r>7}else("rICC"===this.colour_type||"prof"===this.colour_type)&&(this.ICC_profile=e.readUint8Array(this.size-4))})),f.createFullBoxCtor("cprt",(function(e){this.parseLanguage(e),this.notice=e.readCString()})),f.createFullBoxCtor("cslg",(function(e){0===this.version&&(this.compositionToDTSShift=e.readInt32(),this.leastDecodeToDisplayDelta=e.readInt32(),this.greatestDecodeToDisplayDelta=e.readInt32(),this.compositionStartTime=e.readInt32(),this.compositionEndTime=e.readInt32())})),f.createFullBoxCtor("ctts",(function(e){var t,r;if(t=e.readUint32(),this.sample_counts=[],this.sample_offsets=[],0===this.version)for(r=0;r>6,this.bsid=t>>1&31,this.bsmod=(1&t)<<2|r>>6&3,this.acmod=r>>3&7,this.lfeon=r>>2&1,this.bit_rate_code=3&r|i>>5&7})),f.createBoxCtor("dec3",(function(e){var t=e.readUint16();this.data_rate=t>>3,this.num_ind_sub=7&t,this.ind_subs=[];for(var r=0;r>6,i.bsid=n>>1&31,i.bsmod=(1&n)<<4|o>>4&15,i.acmod=o>>1&7,i.lfeon=1&o,i.num_dep_sub=s>>1&15,i.num_dep_sub>0&&(i.chan_loc=(1&s)<<8|e.readUint8())}})),f.createFullBoxCtor("dfLa",(function(e){var t=[],r=["STREAMINFO","PADDING","APPLICATION","SEEKTABLE","VORBIS_COMMENT","CUESHEET","PICTURE","RESERVED"];for(this.parseFullHeader(e);;){var i=e.readUint8(),n=Math.min(127&i,r.length-1);if(n?e.readUint8Array(e.readUint24()):(e.readUint8Array(13),this.samplerate=e.readUint32()>>12,e.readUint8Array(20)),t.push(r[n]),128&i)break}this.numMetadataBlocks=t.length+" ("+t.join(", ")+")"})),f.createBoxCtor("dimm",(function(e){this.bytessent=e.readUint64()})),f.createBoxCtor("dmax",(function(e){this.time=e.readUint32()})),f.createBoxCtor("dmed",(function(e){this.bytessent=e.readUint64()})),f.createBoxCtor("dOps",(function(e){if(this.Version=e.readUint8(),this.OutputChannelCount=e.readUint8(),this.PreSkip=e.readUint16(),this.InputSampleRate=e.readUint32(),this.OutputGain=e.readInt16(),this.ChannelMappingFamily=e.readUint8(),0!==this.ChannelMappingFamily){this.StreamCount=e.readUint8(),this.CoupledCount=e.readUint8(),this.ChannelMapping=[];for(var t=0;t=4;)this.compatible_brands[r]=e.readString(4),t-=4,r++})),f.createFullBoxCtor("hdlr",(function(e){0===this.version&&(e.readUint32(),this.handler=e.readString(4),e.readUint32Array(3),this.name=e.readString(this.size-this.hdr_size-20),"\0"===this.name[this.name.length-1]&&(this.name=this.name.slice(0,-1)))})),f.createBoxCtor("hvcC",(function(e){var t,r,i,n;this.configurationVersion=e.readUint8(),n=e.readUint8(),this.general_profile_space=n>>6,this.general_tier_flag=(32&n)>>5,this.general_profile_idc=31&n,this.general_profile_compatibility=e.readUint32(),this.general_constraint_indicator=e.readUint8Array(6),this.general_level_idc=e.readUint8(),this.min_spatial_segmentation_idc=4095&e.readUint16(),this.parallelismType=3&e.readUint8(),this.chroma_format_idc=3&e.readUint8(),this.bit_depth_luma_minus8=7&e.readUint8(),this.bit_depth_chroma_minus8=7&e.readUint8(),this.avgFrameRate=e.readUint16(),n=e.readUint8(),this.constantFrameRate=n>>6,this.numTemporalLayers=(13&n)>>3,this.temporalIdNested=(4&n)>>2,this.lengthSizeMinusOne=3&n,this.nalu_arrays=[];var o=e.readUint8();for(t=0;t>7,s.nalu_type=63&n;var a=e.readUint16();for(r=0;r>4&15,this.length_size=15&t,t=e.readUint8(),this.base_offset_size=t>>4&15,1===this.version||2===this.version?this.index_size=15&t:this.index_size=0,this.items=[];var r=0;if(this.version<2)r=e.readUint16();else{if(2!==this.version)throw"version of iloc box not supported";r=e.readUint32()}for(var i=0;i>7,this.axis=1&t})),f.createFullBoxCtor("infe",(function(e){if(0!==this.version&&1!==this.version||(this.item_ID=e.readUint16(),this.item_protection_index=e.readUint16(),this.item_name=e.readCString(),this.content_type=e.readCString(),this.content_encoding=e.readCString()),1===this.version)return this.extension_type=e.readString(4),s.warn("BoxParser","Cannot parse extension type"),void e.seek(this.start+this.size);this.version>=2&&(2===this.version?this.item_ID=e.readUint16():3===this.version&&(this.item_ID=e.readUint32()),this.item_protection_index=e.readUint16(),this.item_type=e.readString(4),this.item_name=e.readCString(),"mime"===this.item_type?(this.content_type=e.readCString(),this.content_encoding=e.readCString()):"uri "===this.item_type&&(this.item_uri_type=e.readCString()))})),f.createFullBoxCtor("ipma",(function(e){var t,r;for(entry_count=e.readUint32(),this.associations=[],t=0;t>7==1,1&this.flags?s.property_index=(127&o)<<8|e.readUint8():s.property_index=127&o}}})),f.createFullBoxCtor("iref",(function(e){var t,r;for(this.references=[];e.getPosition()>7,i.assignment_type=127&n,i.assignment_type){case 0:i.grouping_type=e.readString(4);break;case 1:i.grouping_type=e.readString(4),i.grouping_type_parameter=e.readUint32();break;case 2:case 3:break;case 4:i.sub_track_id=e.readUint32();break;default:s.warn("BoxParser","Unknown leva assignement type")}}})),f.createBoxCtor("lsel",(function(e){this.layer_id=e.readUint16()})),f.createBoxCtor("maxr",(function(e){this.period=e.readUint32(),this.bytes=e.readUint32()})),h.prototype.toString=function(){return"("+this.x+","+this.y+")"},f.createBoxCtor("mdcv",(function(e){this.display_primaries=[],this.display_primaries[0]=new h(e.readUint16(),e.readUint16()),this.display_primaries[1]=new h(e.readUint16(),e.readUint16()),this.display_primaries[2]=new h(e.readUint16(),e.readUint16()),this.white_point=new h(e.readUint16(),e.readUint16()),this.max_display_mastering_luminance=e.readUint32(),this.min_display_mastering_luminance=e.readUint32()})),f.createFullBoxCtor("mdhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.parseLanguage(e),e.readUint16()})),f.createFullBoxCtor("mehd",(function(e){1&this.flags&&(s.warn("BoxParser","mehd box incorrectly uses flags set to 1, converting version to 1"),this.version=1),1==this.version?this.fragment_duration=e.readUint64():this.fragment_duration=e.readUint32()})),f.createFullBoxCtor("meta",(function(e){this.boxes=[],f.ContainerBox.prototype.parse.call(this,e)})),f.createFullBoxCtor("mfhd",(function(e){this.sequence_number=e.readUint32()})),f.createFullBoxCtor("mfro",(function(e){this._size=e.readUint32()})),f.createFullBoxCtor("mskC",(function(e){this.bits_per_pixel=e.readUint8()})),f.createFullBoxCtor("mvhd",(function(e){1==this.version?(this.creation_time=e.readUint64(),this.modification_time=e.readUint64(),this.timescale=e.readUint32(),this.duration=e.readUint64()):(this.creation_time=e.readUint32(),this.modification_time=e.readUint32(),this.timescale=e.readUint32(),this.duration=e.readUint32()),this.rate=e.readUint32(),this.volume=e.readUint16()>>8,e.readUint16(),e.readUint32Array(2),this.matrix=e.readUint32Array(9),e.readUint32Array(6),this.next_track_id=e.readUint32()})),f.createBoxCtor("npck",(function(e){this.packetssent=e.readUint32()})),f.createBoxCtor("nump",(function(e){this.packetssent=e.readUint64()})),f.createFullBoxCtor("padb",(function(e){var t=e.readUint32();this.padbits=[];for(var r=0;r0){var t=e.readUint32();this.kid=[];for(var r=0;r0&&(this.data=e.readUint8Array(i))})),f.createFullBoxCtor("clef",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),f.createFullBoxCtor("enof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),f.createFullBoxCtor("prof",(function(e){this.width=e.readUint32(),this.height=e.readUint32()})),f.createContainerBoxCtor("tapt",null,["clef","prof","enof"]),f.createBoxCtor("rtp ",(function(e){this.descriptionformat=e.readString(4),this.sdptext=e.readString(this.size-this.hdr_size-4)})),f.createFullBoxCtor("saio",(function(e){1&this.flags&&(this.aux_info_type=e.readUint32(),this.aux_info_type_parameter=e.readUint32());var t=e.readUint32();this.offset=[];for(var r=0;r>7,this.avgRateFlag=t>>6&1,this.durationFlag&&(this.duration=e.readUint32()),this.avgRateFlag&&(this.accurateStatisticsFlag=e.readUint8(),this.avgBitRate=e.readUint16(),this.avgFrameRate=e.readUint16()),this.dependency=[];for(var r=e.readUint8(),i=0;i>7,this.num_leading_samples=127&t})),f.createSampleGroupCtor("rash",(function(e){if(this.operation_point_count=e.readUint16(),this.description_length!==2+(1===this.operation_point_count?2:6*this.operation_point_count)+9)s.warn("BoxParser","Mismatch in "+this.grouping_type+" sample group length"),this.data=e.readUint8Array(this.description_length-2);else{if(1===this.operation_point_count)this.target_rate_share=e.readUint16();else{this.target_rate_share=[],this.available_bitrate=[];for(var t=0;t>4,this.skip_byte_block=15&t,this.isProtected=e.readUint8(),this.Per_Sample_IV_Size=e.readUint8(),this.KID=f.parseHex16(e),this.constant_IV_size=0,this.constant_IV=0,1===this.isProtected&&0===this.Per_Sample_IV_Size&&(this.constant_IV_size=e.readUint8(),this.constant_IV=e.readUint8Array(this.constant_IV_size))})),f.createSampleGroupCtor("stsa",(function(e){s.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),f.createSampleGroupCtor("sync",(function(e){var t=e.readUint8();this.NAL_unit_type=63&t})),f.createSampleGroupCtor("tele",(function(e){var t=e.readUint8();this.level_independently_decodable=t>>7})),f.createSampleGroupCtor("tsas",(function(e){s.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),f.createSampleGroupCtor("tscl",(function(e){s.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),f.createSampleGroupCtor("vipr",(function(e){s.warn("BoxParser","Sample Group type: "+this.grouping_type+" not fully parsed")})),f.createFullBoxCtor("sbgp",(function(e){this.grouping_type=e.readString(4),1===this.version?this.grouping_type_parameter=e.readUint32():this.grouping_type_parameter=0,this.entries=[];for(var t=e.readUint32(),r=0;r>6,this.sample_depends_on[i]=t>>4&3,this.sample_is_depended_on[i]=t>>2&3,this.sample_has_redundancy[i]=3&t})),f.createFullBoxCtor("senc"),f.createFullBoxCtor("sgpd",(function(e){this.grouping_type=e.readString(4),s.debug("BoxParser","Found Sample Groups of type "+this.grouping_type),1===this.version?this.default_length=e.readUint32():this.default_length=0,this.version>=2&&(this.default_group_description_index=e.readUint32()),this.entries=[];for(var t=e.readUint32(),r=0;r>31&1,i.referenced_size=2147483647&n,i.subsegment_duration=e.readUint32(),n=e.readUint32(),i.starts_with_SAP=n>>31&1,i.SAP_type=n>>28&7,i.SAP_delta_time=268435455&n}})),f.SingleItemTypeReferenceBox=function(e,t,r,i){f.Box.call(this,e,t),this.hdr_size=r,this.start=i},f.SingleItemTypeReferenceBox.prototype=new f.Box,f.SingleItemTypeReferenceBox.prototype.parse=function(e){this.from_item_ID=e.readUint16();var t=e.readUint16();this.references=[];for(var r=0;r>4&15,this.sample_sizes[t+1]=15&i}else if(8===this.field_size)for(t=0;t0)for(r=0;r>4&15,this.default_skip_byte_block=15&t}this.default_isProtected=e.readUint8(),this.default_Per_Sample_IV_Size=e.readUint8(),this.default_KID=f.parseHex16(e),1===this.default_isProtected&&0===this.default_Per_Sample_IV_Size&&(this.default_constant_IV_size=e.readUint8(),this.default_constant_IV=e.readUint8Array(this.default_constant_IV_size))})),f.createFullBoxCtor("tfdt",(function(e){1==this.version?this.baseMediaDecodeTime=e.readUint64():this.baseMediaDecodeTime=e.readUint32()})),f.createFullBoxCtor("tfhd",(function(e){var t=0;this.track_id=e.readUint32(),this.size-this.hdr_size>t&&this.flags&f.TFHD_FLAG_BASE_DATA_OFFSET?(this.base_data_offset=e.readUint64(),t+=8):this.base_data_offset=0,this.size-this.hdr_size>t&&this.flags&f.TFHD_FLAG_SAMPLE_DESC?(this.default_sample_description_index=e.readUint32(),t+=4):this.default_sample_description_index=0,this.size-this.hdr_size>t&&this.flags&f.TFHD_FLAG_SAMPLE_DUR?(this.default_sample_duration=e.readUint32(),t+=4):this.default_sample_duration=0,this.size-this.hdr_size>t&&this.flags&f.TFHD_FLAG_SAMPLE_SIZE?(this.default_sample_size=e.readUint32(),t+=4):this.default_sample_size=0,this.size-this.hdr_size>t&&this.flags&f.TFHD_FLAG_SAMPLE_FLAGS?(this.default_sample_flags=e.readUint32(),t+=4):this.default_sample_flags=0})),f.createFullBoxCtor("tfra",(function(e){this.track_ID=e.readUint32(),e.readUint24();var t=e.readUint8();this.length_size_of_traf_num=t>>4&3,this.length_size_of_trun_num=t>>2&3,this.length_size_of_sample_num=3&t,this.entries=[];for(var r=e.readUint32(),i=0;i>8,e.readUint16(),this.matrix=e.readInt32Array(9),this.width=e.readUint32(),this.height=e.readUint32()})),f.createBoxCtor("tmax",(function(e){this.time=e.readUint32()})),f.createBoxCtor("tmin",(function(e){this.time=e.readUint32()})),f.createBoxCtor("totl",(function(e){this.bytessent=e.readUint32()})),f.createBoxCtor("tpay",(function(e){this.bytessent=e.readUint32()})),f.createBoxCtor("tpyl",(function(e){this.bytessent=e.readUint64()})),f.TrackGroupTypeBox.prototype.parse=function(e){this.parseFullHeader(e),this.track_group_id=e.readUint32()},f.createTrackGroupCtor("msrc"),f.TrackReferenceTypeBox=function(e,t,r,i){f.Box.call(this,e,t),this.hdr_size=r,this.start=i},f.TrackReferenceTypeBox.prototype=new f.Box,f.TrackReferenceTypeBox.prototype.parse=function(e){this.track_ids=e.readUint32Array((this.size-this.hdr_size)/4)},f.trefBox.prototype.parse=function(e){for(var t,r;e.getPosition()t&&this.flags&f.TRUN_FLAGS_DATA_OFFSET?(this.data_offset=e.readInt32(),t+=4):this.data_offset=0,this.size-this.hdr_size>t&&this.flags&f.TRUN_FLAGS_FIRST_FLAG?(this.first_sample_flags=e.readUint32(),t+=4):this.first_sample_flags=0,this.sample_duration=[],this.sample_size=[],this.sample_flags=[],this.sample_composition_time_offset=[],this.size-this.hdr_size>t)for(var r=0;r>7&1,this.block_pad_lsb=r>>6&1,this.block_little_endian=r>>5&1,this.block_reversed=r>>4&1,this.pad_unknown=r>>3&1,this.pixel_size=e.readUint32(),this.row_align_size=e.readUint32(),this.tile_align_size=e.readUint32(),this.num_tile_cols_minus_one=e.readUint32(),this.num_tile_rows_minus_one=e.readUint32()}})),f.createFullBoxCtor("url ",(function(e){1!==this.flags&&(this.location=e.readCString())})),f.createFullBoxCtor("urn ",(function(e){this.name=e.readCString(),this.size-this.hdr_size-this.name.length-1>0&&(this.location=e.readCString())})),f.createUUIDBox("a5d40b30e81411ddba2f0800200c9a66",!0,!1,(function(e){this.LiveServerManifest=e.readString(this.size-this.hdr_size).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")})),f.createUUIDBox("d08a4f1810f34a82b6c832d8aba183d3",!0,!1,(function(e){this.system_id=f.parseHex16(e);var t=e.readUint32();t>0&&(this.data=e.readUint8Array(t))})),f.createUUIDBox("a2394f525a9b4f14a2446c427c648df4",!0,!1),f.createUUIDBox("8974dbce7be74c5184f97148f9882554",!0,!1,(function(e){this.default_AlgorithmID=e.readUint24(),this.default_IV_size=e.readUint8(),this.default_KID=f.parseHex16(e)})),f.createUUIDBox("d4807ef2ca3946958e5426cb9e46a79f",!0,!1,(function(e){this.fragment_count=e.readUint8(),this.entries=[];for(var t=0;t>4,this.chromaSubsampling=t>>1&7,this.videoFullRangeFlag=1&t,this.colourPrimaries=e.readUint8(),this.transferCharacteristics=e.readUint8(),this.matrixCoefficients=e.readUint8(),this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize)):(this.profile=e.readUint8(),this.level=e.readUint8(),t=e.readUint8(),this.bitDepth=t>>4&15,this.colorSpace=15&t,t=e.readUint8(),this.chromaSubsampling=t>>4&15,this.transferFunction=t>>1&7,this.videoFullRangeFlag=1&t,this.codecIntializationDataSize=e.readUint16(),this.codecIntializationData=e.readUint8Array(this.codecIntializationDataSize))})),f.createBoxCtor("vttC",(function(e){this.text=e.readString(this.size-this.hdr_size)})),f.createFullBoxCtor("vvcC",(function(e){var t,r,i={held_bits:void 0,num_held_bits:0,stream_read_1_bytes:function(e){this.held_bits=e.readUint8(),this.num_held_bits=8},stream_read_2_bytes:function(e){this.held_bits=e.readUint16(),this.num_held_bits=16},extract_bits:function(e){var t=this.held_bits>>this.num_held_bits-e&(1<1){for(i.stream_read_1_bytes(e),this.ptl_sublayer_present_mask=0,r=this.num_sublayers-2;r>=0;--r){var s=i.extract_bits(1);this.ptl_sublayer_present_mask|=s<1;++r)i.extract_bits(1);for(this.sublayer_level_idc=[],r=this.num_sublayers-2;r>=0;--r)this.ptl_sublayer_present_mask&1<>=1;t+=f.decimalToHex(i,0),t+=".",0===this.hvcC.general_tier_flag?t+="L":t+="H",t+=this.hvcC.general_level_idc;var n=!1,o="";for(e=5;e>=0;e--)(this.hvcC.general_constraint_indicator[e]||n)&&(o="."+f.decimalToHex(this.hvcC.general_constraint_indicator[e],0)+o,n=!0);t+=o}return t},f.vvc1SampleEntry.prototype.getCodec=f.vvi1SampleEntry.prototype.getCodec=function(){var e,t=f.SampleEntry.prototype.getCodec.call(this);if(this.vvcC){t+="."+this.vvcC.general_profile_idc,this.vvcC.general_tier_flag?t+=".H":t+=".L",t+=this.vvcC.general_level_idc;var r="";if(this.vvcC.general_constraint_info){var i,n=[],o=0;for(o|=this.vvcC.ptl_frame_only_constraint<<7,o|=this.vvcC.ptl_multilayer_enabled<<6,e=0;e>2&63,n.push(o),o&&(i=e),o=this.vvcC.general_constraint_info[e]>>2&3;if(void 0===i)r=".CA";else{r=".C";var s="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",a=0,d=0;for(e=0;e<=i;++e)for(a=a<<8|n[e],d+=8;d>=5;){r+=s[a>>d-5&31],a&=(1<<(d-=5))-1}d&&(r+=s[31&(a<<=5-d)])}}t+=r}return t},f.mp4aSampleEntry.prototype.getCodec=function(){var e=f.SampleEntry.prototype.getCodec.call(this);if(this.esds&&this.esds.esd){var t=this.esds.esd.getOTI(),r=this.esds.esd.getAudioConfig();return e+"."+f.decimalToHex(t)+(r?"."+r:"")}return e},f.stxtSampleEntry.prototype.getCodec=function(){var e=f.SampleEntry.prototype.getCodec.call(this);return this.mime_format?e+"."+this.mime_format:e},f.vp08SampleEntry.prototype.getCodec=f.vp09SampleEntry.prototype.getCodec=function(){var e=f.SampleEntry.prototype.getCodec.call(this),t=this.vpcC.level;0==t&&(t="00");var r=this.vpcC.bitDepth;return 8==r&&(r="08"),e+".0"+this.vpcC.profile+"."+t+"."+r},f.av01SampleEntry.prototype.getCodec=function(){var e,t=f.SampleEntry.prototype.getCodec.call(this),r=this.av1C.seq_level_idx_0;return r<10&&(r="0"+r),2===this.av1C.seq_profile&&1===this.av1C.high_bitdepth?e=1===this.av1C.twelve_bit?"12":"10":this.av1C.seq_profile<=2&&(e=1===this.av1C.high_bitdepth?"10":"08"),t+"."+this.av1C.seq_profile+"."+r+(this.av1C.seq_tier_0?"H":"M")+"."+e},f.Box.prototype.writeHeader=function(e,t){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),s.debug("BoxWriter","Writing box "+this.type+" of size: "+this.size+" at position "+e.getPosition()+(t||"")),this.size>l?e.writeUint32(1):(this.sizePosition=e.getPosition(),e.writeUint32(this.size)),e.writeString(this.type,null,4),"uuid"===this.type&&e.writeUint8Array(this.uuid),this.size>l&&e.writeUint64(this.size)},f.FullBox.prototype.writeHeader=function(e){this.size+=4,f.Box.prototype.writeHeader.call(this,e," v="+this.version+" f="+this.flags),e.writeUint8(this.version),e.writeUint24(this.flags)},f.Box.prototype.write=function(e){"mdat"===this.type?this.data&&(this.size=this.data.length,this.writeHeader(e),e.writeUint8Array(this.data)):(this.size=this.data?this.data.length:0,this.writeHeader(e),this.data&&e.writeUint8Array(this.data))},f.ContainerBox.prototype.write=function(e){this.size=0,this.writeHeader(e);for(var t=0;t=2&&e.writeUint32(this.default_sample_description_index),e.writeUint32(this.entries.length),t=0;t0)for(t=0;t+1t?1:0,this.flags=0,this.size=4,1===this.version&&(this.size+=4),this.writeHeader(e),1===this.version?e.writeUint64(this.baseMediaDecodeTime):e.writeUint32(this.baseMediaDecodeTime)},f.tfhdBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&f.TFHD_FLAG_BASE_DATA_OFFSET&&(this.size+=8),this.flags&f.TFHD_FLAG_SAMPLE_DESC&&(this.size+=4),this.flags&f.TFHD_FLAG_SAMPLE_DUR&&(this.size+=4),this.flags&f.TFHD_FLAG_SAMPLE_SIZE&&(this.size+=4),this.flags&f.TFHD_FLAG_SAMPLE_FLAGS&&(this.size+=4),this.writeHeader(e),e.writeUint32(this.track_id),this.flags&f.TFHD_FLAG_BASE_DATA_OFFSET&&e.writeUint64(this.base_data_offset),this.flags&f.TFHD_FLAG_SAMPLE_DESC&&e.writeUint32(this.default_sample_description_index),this.flags&f.TFHD_FLAG_SAMPLE_DUR&&e.writeUint32(this.default_sample_duration),this.flags&f.TFHD_FLAG_SAMPLE_SIZE&&e.writeUint32(this.default_sample_size),this.flags&f.TFHD_FLAG_SAMPLE_FLAGS&&e.writeUint32(this.default_sample_flags)},f.tkhdBox.prototype.write=function(e){this.version=0,this.size=80,this.writeHeader(e),e.writeUint32(this.creation_time),e.writeUint32(this.modification_time),e.writeUint32(this.track_id),e.writeUint32(0),e.writeUint32(this.duration),e.writeUint32(0),e.writeUint32(0),e.writeInt16(this.layer),e.writeInt16(this.alternate_group),e.writeInt16(this.volume<<8),e.writeUint16(0),e.writeInt32Array(this.matrix),e.writeUint32(this.width),e.writeUint32(this.height)},f.trexBox.prototype.write=function(e){this.version=0,this.flags=0,this.size=20,this.writeHeader(e),e.writeUint32(this.track_id),e.writeUint32(this.default_sample_description_index),e.writeUint32(this.default_sample_duration),e.writeUint32(this.default_sample_size),e.writeUint32(this.default_sample_flags)},f.trunBox.prototype.write=function(e){this.version=0,this.size=4,this.flags&f.TRUN_FLAGS_DATA_OFFSET&&(this.size+=4),this.flags&f.TRUN_FLAGS_FIRST_FLAG&&(this.size+=4),this.flags&f.TRUN_FLAGS_DURATION&&(this.size+=4*this.sample_duration.length),this.flags&f.TRUN_FLAGS_SIZE&&(this.size+=4*this.sample_size.length),this.flags&f.TRUN_FLAGS_FLAGS&&(this.size+=4*this.sample_flags.length),this.flags&f.TRUN_FLAGS_CTS_OFFSET&&(this.size+=4*this.sample_composition_time_offset.length),this.writeHeader(e),e.writeUint32(this.sample_count),this.flags&f.TRUN_FLAGS_DATA_OFFSET&&(this.data_offset_position=e.getPosition(),e.writeInt32(this.data_offset)),this.flags&f.TRUN_FLAGS_FIRST_FLAG&&e.writeUint32(this.first_sample_flags);for(var t=0;t-1||e[r]instanceof f.Box||t[r]instanceof f.Box||void 0===e[r]||void 0===t[r]||"function"==typeof e[r]||"function"==typeof t[r]||e.subBoxNames&&e.subBoxNames.indexOf(r.slice(0,4))>-1||t.subBoxNames&&t.subBoxNames.indexOf(r.slice(0,4))>-1||"data"===r||"start"===r||"size"===r||"creation_time"===r||"modification_time"===r||f.DIFF_PRIMITIVE_ARRAY_PROP_NAMES.indexOf(r)>-1||e[r]===t[r]))return!1;return!0},f.boxEqual=function(e,t){if(!f.boxEqualFields(e,t))return!1;for(var r=0;r1)for(t=1;t-1&&this.fragmentedTracks.splice(t,1)},g.prototype.setExtractionOptions=function(e,t,r){var i=this.getTrackById(e);if(i){var n={};this.extractedTracks.push(n),n.id=e,n.user=t,n.trak=i,i.nextSample=0,n.nb_samples=1e3,n.samples=[],r&&r.nbSamples&&(n.nb_samples=r.nbSamples)}},g.prototype.unsetExtractionOptions=function(e){for(var t=-1,r=0;r-1&&this.extractedTracks.splice(t,1)},g.prototype.parse=function(){var e,t;if(!this.restoreParsePosition||this.restoreParsePosition())for(;;){if(this.hasIncompleteMdat&&this.hasIncompleteMdat()){if(this.processIncompleteMdat())continue;return}if(this.saveParsePosition&&this.saveParsePosition(),(e=f.parseOneBox(this.stream,false)).code===f.ERR_NOT_ENOUGH_DATA){if(this.processIncompleteBox){if(this.processIncompleteBox(e))continue;return}return}var r;switch(r="uuid"!==(t=e.box).type?t.type:t.uuid,this.boxes.push(t),r){case"mdat":this.mdats.push(t);break;case"moof":this.moofs.push(t);break;case"moov":this.moovStartFound=!0,0===this.mdats.length&&(this.isProgressive=!0);default:void 0!==this[r]&&s.warn("ISOFile","Duplicate Box of type: "+r+", overriding previous occurrence"),this[r]=t}this.updateUsedBytes&&this.updateUsedBytes(t,e)}},g.prototype.checkBuffer=function(e){if(null==e)throw"Buffer must be defined and non empty";if(void 0===e.fileStart)throw"Buffer must have a fileStart property";return 0===e.byteLength?(s.warn("ISOFile","Ignoring empty buffer (fileStart: "+e.fileStart+")"),this.stream.logBufferLevel(),!1):(s.info("ISOFile","Processing buffer (fileStart: "+e.fileStart+")"),e.usedBytes=0,this.stream.insertBuffer(e),this.stream.logBufferLevel(),!!this.stream.initialized()||(s.warn("ISOFile","Not ready to start parsing"),!1))},g.prototype.appendBuffer=function(e,t){var r;if(this.checkBuffer(e))return this.parse(),this.moovStartFound&&!this.moovStartSent&&(this.moovStartSent=!0,this.onMoovStart&&this.onMoovStart()),this.moov?(this.sampleListBuilt||(this.buildSampleLists(),this.sampleListBuilt=!0),this.updateSampleLists(),this.onReady&&!this.readySent&&(this.readySent=!0,this.onReady(this.getInfo())),this.processSamples(t),this.nextSeekPosition?(r=this.nextSeekPosition,this.nextSeekPosition=void 0):r=this.nextParsePosition,this.stream.getEndFilePositionAfter&&(r=this.stream.getEndFilePositionAfter(r))):r=this.nextParsePosition?this.nextParsePosition:0,this.sidx&&this.onSidx&&!this.sidxSent&&(this.onSidx(this.sidx),this.sidxSent=!0),this.meta&&(this.flattenItemInfo&&!this.itemListBuilt&&(this.flattenItemInfo(),this.itemListBuilt=!0),this.processItems&&this.processItems(this.onItem)),this.stream.cleanBuffers&&(s.info("ISOFile","Done processing buffer (fileStart: "+e.fileStart+") - next buffer to fetch should have a fileStart position of "+r),this.stream.logBufferLevel(),this.stream.cleanBuffers(),this.stream.logBufferLevel(!0),s.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize())),r},g.prototype.getInfo=function(){var e,t,r,i,n,o,s={},a=new Date("1904-01-01T00:00:00Z").getTime();if(this.moov)for(s.hasMoov=!0,s.duration=this.moov.mvhd.duration,s.timescale=this.moov.mvhd.timescale,s.isFragmented=null!=this.moov.mvex,s.isFragmented&&this.moov.mvex.mehd&&(s.fragment_duration=this.moov.mvex.mehd.fragment_duration),s.isProgressive=this.isProgressive,s.hasIOD=null!=this.moov.iods,s.brands=[],s.brands.push(this.ftyp.major_brand),s.brands=s.brands.concat(this.ftyp.compatible_brands),s.created=new Date(a+1e3*this.moov.mvhd.creation_time),s.modified=new Date(a+1e3*this.moov.mvhd.modification_time),s.tracks=[],s.audioTracks=[],s.videoTracks=[],s.subtitleTracks=[],s.metadataTracks=[],s.hintTracks=[],s.otherTracks=[],e=0;e0?s.mime+='video/mp4; codecs="':s.audioTracks&&s.audioTracks.length>0?s.mime+='audio/mp4; codecs="':s.mime+='application/mp4; codecs="',e=0;e=r.samples.length)&&(s.info("ISOFile","Sending fragmented data on track #"+i.id+" for samples ["+Math.max(0,r.nextSample-i.nb_samples)+","+(r.nextSample-1)+"]"),s.info("ISOFile","Sample data size in memory: "+this.getAllocatedSampleDataSize()),this.onSegment&&this.onSegment(i.id,i.user,i.segmentStream.buffer,r.nextSample,e||r.nextSample>=r.samples.length),i.segmentStream=null,i!==this.fragmentedTracks[t]))break}}if(null!==this.onSamples)for(t=0;t=r.samples.length)&&(s.debug("ISOFile","Sending samples on track #"+o.id+" for sample "+r.nextSample),this.onSamples&&this.onSamples(o.id,o.user,o.samples),o.samples=[],o!==this.extractedTracks[t]))break}}}},g.prototype.getBox=function(e){var t=this.getBoxes(e,!0);return t.length?t[0]:null},g.prototype.getBoxes=function(e,t){var r=[];return g._sweep.call(this,e,r,t),r},g._sweep=function(e,t,r){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&r)return;g._sweep.call(this.boxes[i],e,t,r)}},g.prototype.getTrackSamplesInfo=function(e){var t=this.getTrackById(e);return t?t.samples:void 0},g.prototype.getTrackSample=function(e,t){var r=this.getTrackById(e);return this.getSample(r,t)},g.prototype.releaseUsedSamples=function(e,t){var r=0,i=this.getTrackById(e);i.lastValidSample||(i.lastValidSample=0);for(var n=i.lastValidSample;ne*n.timescale){l=i-1;break}t&&n.is_sync&&(d=i)}for(t&&(l=d),e=r.samples[l].cts,r.nextSample=l;r.samples[l].alreadyRead===r.samples[l].size&&r.samples[l+1];)l++;return o=r.samples[l].offset+r.samples[l].alreadyRead,s.info("ISOFile","Seeking to "+(t?"RAP":"")+" sample #"+r.nextSample+" on track "+r.tkhd.track_id+", time "+s.getDurationString(e,a)+" and offset: "+o),{offset:o,time:e/a}},g.prototype.getTrackDuration=function(e){var t;return e.samples?((t=e.samples[e.samples.length-1]).cts+t.duration)/t.timescale:1/0},g.prototype.seek=function(e,t){var r,i,n,o=this.moov,a={offset:1/0,time:1/0};if(this.moov){for(n=0;nthis.getTrackDuration(r)||((i=this.seekTrack(e,t,r)).offset-1){s=d;break}switch(s){case"Visual":if(n.add("vmhd").set("graphicsmode",0).set("opcolor",[0,0,0]),o.set("width",t.width).set("height",t.height).set("horizresolution",72<<16).set("vertresolution",72<<16).set("frame_count",1).set("compressorname",t.type+" Compressor").set("depth",24),t.avcDecoderConfigRecord){var c=new f.avcCBox;c.parse(new a(t.avcDecoderConfigRecord)),o.addBox(c)}else if(t.hevcDecoderConfigRecord){var h=new f.hvcCBox;h.parse(new a(t.hevcDecoderConfigRecord)),o.addBox(h)}break;case"Audio":n.add("smhd").set("balance",t.balance||0),o.set("channel_count",t.channel_count||2).set("samplesize",t.samplesize||16).set("samplerate",t.samplerate||65536);break;case"Hint":n.add("hmhd");break;case"Subtitle":if(n.add("sthd"),"stpp"===t.type)o.set("namespace",t.namespace||"nonamespace").set("schema_location",t.schema_location||"").set("auxiliary_mime_types",t.auxiliary_mime_types||"");break;default:n.add("nmhd")}t.description&&o.addBox(t.description),t.description_boxes&&t.description_boxes.forEach((function(e){o.addBox(e)})),n.add("dinf").add("dref").addEntry((new f["url Box"]).set("flags",1));var p=n.add("stbl");return p.add("stsd").addEntry(o),p.add("stts").set("sample_counts",[]).set("sample_deltas",[]),p.add("stsc").set("first_chunk",[]).set("samples_per_chunk",[]).set("sample_description_index",[]),p.add("stco").set("chunk_offsets",[]),p.add("stsz").set("sample_sizes",[]),this.moov.mvex.add("trex").set("track_id",t.id).set("default_sample_description_index",t.default_sample_description_index||1).set("default_sample_duration",t.default_sample_duration||0).set("default_sample_size",t.default_sample_size||0).set("default_sample_flags",t.default_sample_flags||0),this.buildTrakSampleLists(r),t.id}},f.Box.prototype.computeSize=function(e){var t=e||new d;t.endianness=d.BIG_ENDIAN,this.write(t)},g.prototype.addSample=function(e,t,r){var i=r||{},n={},o=this.getTrackById(e);if(null!==o){n.number=o.samples.length,n.track_id=o.tkhd.track_id,n.timescale=o.mdia.mdhd.timescale,n.description_index=i.sample_description_index?i.sample_description_index-1:0,n.description=o.mdia.minf.stbl.stsd.entries[n.description_index],n.data=t,n.size=t.byteLength,n.alreadyRead=n.size,n.duration=i.duration||1,n.cts=i.cts||0,n.dts=i.dts||0,n.is_sync=i.is_sync||!1,n.is_leading=i.is_leading||0,n.depends_on=i.depends_on||0,n.is_depended_on=i.is_depended_on||0,n.has_redundancy=i.has_redundancy||0,n.degradation_priority=i.degradation_priority||0,n.offset=0,n.subsamples=i.subsamples,o.samples.push(n),o.samples_size+=n.size,o.samples_duration+=n.duration,void 0===o.first_dts&&(o.first_dts=i.dts),this.processSamples();var s=this.createSingleSampleMoof(n);return this.addBox(s),s.computeSize(),s.trafs[0].truns[0].data_offset=s.size+8,this.add("mdat").data=new Uint8Array(t),n}},g.prototype.createSingleSampleMoof=function(e){var t=0;t=e.is_sync?1<<25:65536;var r=new f.moofBox;r.add("mfhd").set("sequence_number",this.nextMoofNumber),this.nextMoofNumber++;var i=r.add("traf"),n=this.getTrackById(e.track_id);return i.add("tfhd").set("track_id",e.track_id).set("flags",f.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),i.add("tfdt").set("baseMediaDecodeTime",e.dts-(n.first_dts||0)),i.add("trun").set("flags",f.TRUN_FLAGS_DATA_OFFSET|f.TRUN_FLAGS_DURATION|f.TRUN_FLAGS_SIZE|f.TRUN_FLAGS_FLAGS|f.TRUN_FLAGS_CTS_OFFSET).set("data_offset",0).set("first_sample_flags",0).set("sample_count",1).set("sample_duration",[e.duration]).set("sample_size",[e.size]).set("sample_flags",[t]).set("sample_composition_time_offset",[e.cts-e.dts]),r},g.prototype.lastMoofIndex=0,g.prototype.samplesDataSize=0,g.prototype.resetTables=function(){var e,t,r,i,n,o;for(this.initial_duration=this.moov.mvhd.duration,this.moov.mvhd.duration=0,e=0;e=2&&(d=n[s].grouping_type+"/0",(a=new l(n[s].grouping_type,0)).is_fragment=!0,t.sample_groups_info[d]||(t.sample_groups_info[d]=a))}else for(s=0;s=2&&(d=i[s].grouping_type+"/0",a=new l(i[s].grouping_type,0),e.sample_groups_info[d]||(e.sample_groups_info[d]=a))},g.setSampleGroupProperties=function(e,t,r,i){var n,o;for(n in t.sample_groups=[],i){var s;if(t.sample_groups[n]={},t.sample_groups[n].grouping_type=i[n].grouping_type,t.sample_groups[n].grouping_type_parameter=i[n].grouping_type_parameter,r>=i[n].last_sample_in_run&&(i[n].last_sample_in_run<0&&(i[n].last_sample_in_run=0),i[n].entry_index++,i[n].entry_index<=i[n].sbgp.entries.length-1&&(i[n].last_sample_in_run+=i[n].sbgp.entries[i[n].entry_index].sample_count)),i[n].entry_index<=i[n].sbgp.entries.length-1?t.sample_groups[n].group_description_index=i[n].sbgp.entries[i[n].entry_index].group_description_index:t.sample_groups[n].group_description_index=-1,0!==t.sample_groups[n].group_description_index)s=i[n].fragment_description?i[n].fragment_description:i[n].description,t.sample_groups[n].group_description_index>0?(o=t.sample_groups[n].group_description_index>65535?(t.sample_groups[n].group_description_index>>16)-1:t.sample_groups[n].group_description_index-1,s&&o>=0&&(t.sample_groups[n].description=s.entries[o])):s&&s.version>=2&&s.default_group_description_index>0&&(t.sample_groups[n].description=s.entries[s.default_group_description_index-1])}},g.process_sdtp=function(e,t,r){t&&(e?(t.is_leading=e.is_leading[r],t.depends_on=e.sample_depends_on[r],t.is_depended_on=e.sample_is_depended_on[r],t.has_redundancy=e.sample_has_redundancy[r]):(t.is_leading=0,t.depends_on=0,t.is_depended_on=0,t.has_redundancy=0))},g.prototype.buildSampleLists=function(){var e,t;for(e=0;ev&&(b++,v<0&&(v=0),v+=o.sample_counts[b]),t>0?(e.samples[t-1].duration=o.sample_deltas[b],e.samples_duration+=e.samples[t-1].duration,x.dts=e.samples[t-1].dts+e.samples[t-1].duration):x.dts=0,s?(t>=w&&(S++,w<0&&(w=0),w+=s.sample_counts[S]),x.cts=e.samples[t].dts+s.sample_offsets[S]):x.cts=x.dts,a?(t==a.sample_numbers[E]-1?(x.is_sync=!0,E++):(x.is_sync=!1,x.degradation_priority=0),l&&l.entries[A].sample_delta+B==t+1&&(x.subsamples=l.entries[A].subsamples,B+=l.entries[A].sample_delta,A++)):x.is_sync=!0,g.process_sdtp(e.mdia.minf.stbl.sdtp,x,x.number),x.degradation_priority=f?f.priority[t]:0,l&&l.entries[A].sample_delta+B==t&&(x.subsamples=l.entries[A].subsamples,B+=l.entries[A].sample_delta),(u.length>0||c.length>0)&&g.setSampleGroupProperties(e,x,t,e.sample_groups_info)}t>0&&(e.samples[t-1].duration=Math.max(e.mdia.mdhd.duration-e.samples[t-1].dts,0),e.samples_duration+=e.samples[t-1].duration)}},g.prototype.updateSampleLists=function(){var e,t,r,i,n,o,s,a,d,l,u,c,h,p,m;if(void 0!==this.moov)for(;this.lastMoofIndex0&&g.initSampleGroups(c,u,u.sbgps,c.mdia.minf.stbl.sgpds,u.sgpds),t=0;t0?p.dts=c.samples[c.samples.length-2].dts+c.samples[c.samples.length-2].duration:(u.tfdt?p.dts=u.tfdt.baseMediaDecodeTime:p.dts=0,c.first_traf_merged=!0),p.cts=p.dts,_.flags&f.TRUN_FLAGS_CTS_OFFSET&&(p.cts=p.dts+_.sample_composition_time_offset[r]),m=s,_.flags&f.TRUN_FLAGS_FLAGS?m=_.sample_flags[r]:0===r&&_.flags&f.TRUN_FLAGS_FIRST_FLAG&&(m=_.first_sample_flags),p.is_sync=!(m>>16&1),p.is_leading=m>>26&3,p.depends_on=m>>24&3,p.is_depended_on=m>>22&3,p.has_redundancy=m>>20&3,p.degradation_priority=65535&m;var y=!!(u.tfhd.flags&f.TFHD_FLAG_BASE_DATA_OFFSET),v=!!(u.tfhd.flags&f.TFHD_FLAG_DEFAULT_BASE_IS_MOOF),b=!!(_.flags&f.TRUN_FLAGS_DATA_OFFSET),w=0;w=y?u.tfhd.base_data_offset:v||0===t?l.start:a,p.offset=0===t&&0===r?b?w+_.data_offset:w:a,a=p.offset+p.size,(u.sbgps.length>0||u.sgpds.length>0||c.mdia.minf.stbl.sbgps.length>0||c.mdia.minf.stbl.sgpds.length>0)&&g.setSampleGroupProperties(c,p,p.number_in_traf,u.sample_groups_info)}}if(u.subs){c.has_fragment_subsamples=!0;var S=u.first_sample_index;for(t=0;t-1))return null;var o=(r=this.stream.buffers[n]).byteLength-(i.offset+i.alreadyRead-r.fileStart);if(i.size-i.alreadyRead<=o)return s.debug("ISOFile","Getting sample #"+t+" data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+(i.size-i.alreadyRead)+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,i.size-i.alreadyRead),r.usedBytes+=i.size-i.alreadyRead,this.stream.logBufferLevel(),i.alreadyRead=i.size,i;if(0===o)return null;s.debug("ISOFile","Getting sample #"+t+" partial data (alreadyRead: "+i.alreadyRead+" offset: "+(i.offset+i.alreadyRead-r.fileStart)+" read size: "+o+" full size: "+i.size+")"),d.memcpy(i.data.buffer,i.alreadyRead,r,i.offset+i.alreadyRead-r.fileStart,o),i.alreadyRead+=o,r.usedBytes+=o,this.stream.logBufferLevel()}},g.prototype.releaseSample=function(e,t){var r=e.samples[t];return r.data?(this.samplesDataSize-=r.size,r.data=null,r.alreadyRead=0,r.size):0},g.prototype.getAllocatedSampleDataSize=function(){return this.samplesDataSize},g.prototype.getCodecs=function(){var e,t="";for(e=0;e0&&(t+=","),t+=this.moov.traks[e].mdia.minf.stbl.stsd.entries[0].getCodec()}return t},g.prototype.getTrexById=function(e){var t;if(!this.moov||!this.moov.mvex)return null;for(t=0;t0&&(r.protection=o.ipro.protections[o.iinf.item_infos[e].protection_index-1]),o.iinf.item_infos[e].item_type?r.type=o.iinf.item_infos[e].item_type:r.type="mime",r.content_type=o.iinf.item_infos[e].content_type,r.content_encoding=o.iinf.item_infos[e].content_encoding;if(o.grpl)for(e=0;e0&&f.property_index-1-1))return null;var a=(t=this.stream.buffers[o]).byteLength-(n.offset+n.alreadyRead-t.fileStart);if(!(n.length-n.alreadyRead<=a))return s.debug("ISOFile","Getting item #"+e+" extent #"+i+" partial data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+a+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,a),n.alreadyRead+=a,r.alreadyRead+=a,t.usedBytes+=a,this.stream.logBufferLevel(),null;s.debug("ISOFile","Getting item #"+e+" extent #"+i+" data (alreadyRead: "+n.alreadyRead+" offset: "+(n.offset+n.alreadyRead-t.fileStart)+" read size: "+(n.length-n.alreadyRead)+" full extent size: "+n.length+" full item size: "+r.size+")"),d.memcpy(r.data.buffer,r.alreadyRead,t,n.offset+n.alreadyRead-t.fileStart,n.length-n.alreadyRead),t.usedBytes+=n.length-n.alreadyRead,this.stream.logBufferLevel(),r.alreadyRead+=n.length-n.alreadyRead,n.alreadyRead=n.length}}return r.alreadyRead===r.size?r:null},g.prototype.releaseItem=function(e){var t=this.items[e];if(t.data){this.itemsDataSize-=t.size,t.data=null,t.alreadyRead=0;for(var r=0;r0?this.moov.traks[e].samples[0].duration:0),t.push(i)}return t},f.Box.prototype.printHeader=function(e){this.size+=8,this.size>l&&(this.size+=8),"uuid"===this.type&&(this.size+=16),e.log(e.indent+"size:"+this.size),e.log(e.indent+"type:"+this.type)},f.FullBox.prototype.printHeader=function(e){this.size+=4,f.Box.prototype.printHeader.call(this,e),e.log(e.indent+"version:"+this.version),e.log(e.indent+"flags:"+this.flags)},f.Box.prototype.print=function(e){this.printHeader(e)},f.ContainerBox.prototype.print=function(e){this.printHeader(e);for(var t=0;t>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"next_track_id: "+this.next_track_id)},f.tkhdBox.prototype.print=function(e){f.FullBox.prototype.printHeader.call(this,e),e.log(e.indent+"creation_time: "+this.creation_time),e.log(e.indent+"modification_time: "+this.modification_time),e.log(e.indent+"track_id: "+this.track_id),e.log(e.indent+"duration: "+this.duration),e.log(e.indent+"volume: "+(this.volume>>8)),e.log(e.indent+"matrix: "+this.matrix.join(", ")),e.log(e.indent+"layer: "+this.layer),e.log(e.indent+"alternate_group: "+this.alternate_group),e.log(e.indent+"width: "+this.width),e.log(e.indent+"height: "+this.height)};var y={createFile:function(e,t){var r=void 0===e||e,i=new g(t);return i.discardMdatData=!r,i}};t.createFile=y.createFile}));function Gi(e){return e.reduce(((e,t)=>256*e+t))}function $i(e){const t=[101,103,119,99],r=e.length-28,i=e.slice(r,r+t.length);return t.every(((e,t)=>e===i[t]))}Oi.Log,Oi.MP4BoxStream,Oi.DataStream,Oi.MultiBufferStream,Oi.MPEG4DescriptorParser,Oi.BoxParser,Oi.XMLSubtitlein4Parser,Oi.Textin4Parser,Oi.ISOFile,Oi.createFile;class Hi{constructor(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=new Uint8Array([30,158,90,33,244,57,83,165,2,70,35,87,215,231,226,108]),this.t=this.n.slice().reverse()}destroy(){this.s=null,this.a=null,this.l=0,this.c=0,this.u=1/0,this.A=!1,this.d=!1,this.r=4194304,this.n=null,this.t=null}transport(e){if(!this.s&&this.l>50)return e;if(this.l++,this.d)return e;const t=new Uint8Array(e);if(this.A){if(!(this.c~e))}(e.slice(r+32,r+32+t))]}return null}(t,this.t);if(!r)return e;const i=function(e){try{if("object"!=typeof WebAssembly||"function"!=typeof WebAssembly.instantiate)throw null;{const e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(!(e instanceof WebAssembly.Module&&new WebAssembly.Instance(e)instanceof WebAssembly.Instance))throw null}}catch(e){return new Error("video_error_4")}let t;try{t={env:{__handle_stack_overflow:()=>e(new Error("video_error_1")),memory:new WebAssembly.Memory({initial:256,maximum:256})}}}catch(e){return new Error("video_error_5")}return t}(e);if(i instanceof Error)return console.error(i.message),this.d=!0,e;this.A=!0,this.u=r[1],$i(t)&&this.c++,WebAssembly.instantiate(r[2],i).then((e=>{if("function"!=typeof(t=e.instance.exports).parse||"object"!=typeof t.memory)return this.d=!0,void console.error("video_error_3");var t;this.s=e.instance.exports,this.a=new Uint8Array(this.s.memory.buffer)})).catch((e=>{this.d=!0,console.error("video_error_6")}))}return e}}const Vi=16,Wi=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],ji=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function qi(e){const t=[];for(let r=0,i=e.length;r1===(e=e.toString(16)).length?"0"+e:e)).join("")}function Ki(e){const t=[];for(let r=0,i=e.length;r>>6),t.push(128|63&i);else if(i<=55295||i>=57344&&i<=65535)t.push(224|i>>>12),t.push(128|i>>>6&63),t.push(128|63&i);else{if(!(i>=65536&&i<=1114111))throw t.push(i),new Error("input is not supported");r++,t.push(240|i>>>18&28),t.push(128|i>>>12&63),t.push(128|i>>>6&63),t.push(128|63&i)}}return t}function Xi(e){const t=[];for(let r=0,i=e.length;r=240&&e[r]<=247?(t.push(String.fromCodePoint(((7&e[r])<<18)+((63&e[r+1])<<12)+((63&e[r+2])<<6)+(63&e[r+3]))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((15&e[r])<<12)+((63&e[r+1])<<6)+(63&e[r+2]))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((31&e[r])<<6)+(63&e[r+1]))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function Zi(e,t){const r=31&t;return e<>>32-r}function Ji(e){return(255&Wi[e>>>24&255])<<24|(255&Wi[e>>>16&255])<<16|(255&Wi[e>>>8&255])<<8|255&Wi[255&e]}function Qi(e){return e^Zi(e,2)^Zi(e,10)^Zi(e,18)^Zi(e,24)}function en(e){return e^Zi(e,13)^Zi(e,23)}function tn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[4*t],n[1]=255&e[4*t+1],n[2]=255&e[4*t+2],n[3]=255&e[4*t+3],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];for(let e,t=0;t<32;t+=4)e=i[1]^i[2]^i[3]^r[t+0],i[0]^=Qi(Ji(e)),e=i[2]^i[3]^i[0]^r[t+1],i[1]^=Qi(Ji(e)),e=i[3]^i[0]^i[1]^r[t+2],i[2]^=Qi(Ji(e)),e=i[0]^i[1]^i[2]^r[t+3],i[3]^=Qi(Ji(e));for(let e=0;e<16;e+=4)t[e]=i[3-e/4]>>>24&255,t[e+1]=i[3-e/4]>>>16&255,t[e+2]=i[3-e/4]>>>8&255,t[e+3]=255&i[3-e/4]}function rn(e,t,r){const i=new Array(4),n=new Array(4);for(let t=0;t<4;t++)n[0]=255&e[0+4*t],n[1]=255&e[1+4*t],n[2]=255&e[2+4*t],n[3]=255&e[3+4*t],i[t]=n[0]<<24|n[1]<<16|n[2]<<8|n[3];i[0]^=2746333894,i[1]^=1453994832,i[2]^=1736282519,i[3]^=2993693404;for(let e,r=0;r<32;r+=4)e=i[1]^i[2]^i[3]^ji[r+0],t[r+0]=i[0]^=en(Ji(e)),e=i[2]^i[3]^i[0]^ji[r+1],t[r+1]=i[1]^=en(Ji(e)),e=i[3]^i[0]^i[1]^ji[r+2],t[r+2]=i[2]^=en(Ji(e)),e=i[0]^i[1]^i[2]^ji[r+3],t[r+3]=i[3]^=en(Ji(e));if(0===r)for(let e,r=0;r<16;r++)e=t[r],t[r]=t[31-r],t[31-r]=e}function nn(e,t,r){let{padding:i="pkcs#7",mode:n,iv:o=[],output:s="string"}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if("cbc"===n&&("string"==typeof o&&(o=qi(o)),16!==o.length))throw new Error("iv is invalid");if("string"==typeof t&&(t=qi(t)),16!==t.length)throw new Error("key is invalid");if(e="string"==typeof e?0!==r?Ki(e):qi(e):[...e],("pkcs#5"===i||"pkcs#7"===i)&&0!==r){const t=Vi-e.length%Vi;for(let r=0;r=Vi;){const t=e.slice(c,c+16),i=new Array(16);if("cbc"===n)for(let e=0;e2&&void 0!==arguments[2]&&arguments[2];const i=e.byteLength;let n=5;for(;ni)break;let s=e[n+4],a=!1;if(r?(s=s>>>1&63,a=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(s)):(s&=31,a=1===s||5===s),a){const r=nn(e.slice(n+4+2,n+4+o),t,0,{padding:"none",output:"array"});e.set(r,n+4+2)}n=n+4+o}return e}class an{on(e,t,r){const i=this.e||(this.e={});return(i[e]||(i[e]=[])).push({fn:t,ctx:r}),this}once(e,t,r){const i=this;function n(){i.off(e,n);for(var o=arguments.length,s=new Array(o),a=0;a1?r-1:0),n=1;n{delete r[e]})),void delete this.e;const i=r[e],n=[];if(i&&t)for(let e=0,r=i.length;e=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(!(!1&this.tempBuffer[this.parsedOffset+1])){this.versionLayer=this.tempBuffer[this.parsedOffset+1],this.state=dn.findFirstStartCode,this.fisrtStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==dn.findFirstStartCode){let e=!1;for(;this.tempBuffer.length-this.parsedOffset>=2&&!this.isDestroyed;)if(255==this.tempBuffer[this.parsedOffset]){if(this.tempBuffer[this.parsedOffset+1]==this.versionLayer){this.state=dn.findSecondStartCode,this.secondStartCodeOffset=this.parsedOffset,this.parsedOffset+=2,e=!0;break}this.parsedOffset++}else this.parsedOffset++;if(e)continue;break}if(this.state==dn.findSecondStartCode){let e=this.tempBuffer.slice(this.fisrtStartCodeOffset,this.secondStartCodeOffset);this.emit("data",e,t),this.tempBuffer=this.tempBuffer.slice(this.secondStartCodeOffset),this.fisrtStartCodeOffset=0,this.parsedOffset=2,this.state=dn.findFirstStartCode}}}}function un(e,t,r){for(let i=2;i3&&void 0!==arguments[3]&&arguments[3];const n=e.byteLength;let o=5;for(;on)break;let a=e[o+4],d=!1;if(i?(a=a>>>1&63,d=[0,1,2,3,4,5,6,7,8,9,16,17,18,19,20,21].includes(a)):(a&=31,d=1===a||5===a),d){const i=un(e.slice(o+4,o+4+s),t,r);e.set(i,o+4)}o=o+4+s}return e}function hn(){for(var e=arguments.length,t=new Array(e),r=0;re+t.byteLength),0));let n=0;return t.forEach((e=>{i.set(e,n),n+=e.byteLength})),i}class pn{constructor(e){this.destroys=[],this.proxy=this.proxy.bind(this),this.master=e}proxy(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!e)return;if(Array.isArray(t))return t.map((t=>this.proxy(e,t,r,i)));e.addEventListener(t,r,i);const n=()=>{ur(e.removeEventListener)&&e.removeEventListener(t,r,i)};return this.destroys.push(n),n}destroy(){this.master.debug&&this.master.debug.log("Events","destroy"),this.destroys.forEach((e=>e())),this.destroys=[]}}class mn{static init(){mn.types={avc1:[],avcC:[],hvc1:[],hvcC:[],av01:[],av1C:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],Opus:[],dOps:[],"ac-3":[],dac3:[],"ec-3":[],dec3:[]};for(let e in mn.types)mn.types.hasOwnProperty(e)&&(mn.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);let e=mn.constants={};e.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),e.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),e.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSC=e.STCO=e.STTS,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.HDLR_VIDEO=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]),e.HDLR_AUDIO=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]),e.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,r=null,i=Array.prototype.slice.call(arguments,1),n=i.length;for(let e=0;e>>24&255,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r.set(e,4);let o=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,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]))}static trak(e){return mn.box(mn.types.trak,mn.tkhd(e),mn.mdia(e))}static tkhd(e){let t=e.id,r=e.duration,i=e.presentWidth,n=e.presentHeight;return mn.box(mn.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>>8&255,255&i,0,0,n>>>8&255,255&n,0,0]))}static mdia(e){return mn.box(mn.types.mdia,mn.mdhd(e),mn.hdlr(e),mn.minf(e))}static mdhd(e){let t=e.timescale,r=e.duration;return mn.box(mn.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,85,196,0,0]))}static hdlr(e){let t=null;return t="audio"===e.type?mn.constants.HDLR_AUDIO:mn.constants.HDLR_VIDEO,mn.box(mn.types.hdlr,t)}static minf(e){let t=null;return t="audio"===e.type?mn.box(mn.types.smhd,mn.constants.SMHD):mn.box(mn.types.vmhd,mn.constants.VMHD),mn.box(mn.types.minf,t,mn.dinf(),mn.stbl(e))}static dinf(){return mn.box(mn.types.dinf,mn.box(mn.types.dref,mn.constants.DREF))}static stbl(e){return mn.box(mn.types.stbl,mn.stsd(e),mn.box(mn.types.stts,mn.constants.STTS),mn.box(mn.types.stsc,mn.constants.STSC),mn.box(mn.types.stsz,mn.constants.STSZ),mn.box(mn.types.stco,mn.constants.STCO))}static stsd(e){return"audio"===e.type?"mp3"===e.audioType?mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.mp3(e)):mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.mp4a(e)):"avc"===e.videoType?mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.avc1(e)):mn.box(mn.types.stsd,mn.constants.STSD_PREFIX,mn.hvc1(e))}static mp3(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return mn.box(mn.types[".mp3"],i)}static mp4a(e){let t=e.channelCount,r=e.audioSampleRate,i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,r>>>8&255,255&r,0,0]);return mn.box(mn.types.mp4a,i,mn.esds(e))}static esds(e){let t=e.config||[],r=t.length,i=new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([r]).concat(t).concat([6,1,2]));return mn.box(mn.types.esds,i)}static avc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=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,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return mn.box(mn.types.avc1,n,mn.box(mn.types.avcC,t))}static hvc1(e){let t=e.avcc;const r=e.codecWidth,i=e.codecHeight;let n=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,r>>>8&255,255&r,i>>>8&255,255&i,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return mn.box(mn.types.hvc1,n,mn.box(mn.types.hvcC,t))}static mvex(e){return mn.box(mn.types.mvex,mn.trex(e))}static trex(e){let t=e.id,r=new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return mn.box(mn.types.trex,r)}static moof(e,t){return mn.box(mn.types.moof,mn.mfhd(e.sequenceNumber),mn.traf(e,t))}static mfhd(e){let t=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return mn.box(mn.types.mfhd,t)}static traf(e,t){let r=e.id,i=mn.box(mn.types.tfhd,new Uint8Array([0,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,255&r])),n=mn.box(mn.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),o=mn.sdtp(e),s=mn.trun(e,o.byteLength+16+16+8+16+8+8);return mn.box(mn.types.traf,i,n,s,o)}static sdtp(e){let t=new Uint8Array(5),r=e.flags;return t[4]=r.isLeading<<6|r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy,mn.box(mn.types.sdtp,t)}static trun(e,t){let r=new Uint8Array(28);t+=36,r.set([0,0,15,1,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0);let i=e.duration,n=e.size,o=e.flags,s=e.cts;return r.set([i>>>24&255,i>>>16&255,i>>>8&255,255&i,n>>>24&255,n>>>16&255,n>>>8&255,255&n,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.isNonSync,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s],12),mn.box(mn.types.trun,r)}static mdat(e){return mn.box(mn.types.mdat,e)}}mn.init();var _n,gn=Ot((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}));(_n=gn)&&_n.__esModule&&Object.prototype.hasOwnProperty.call(_n,"default")&&_n.default;const yn=[44100,48e3,32e3,0],vn=[22050,24e3,16e3,0],bn=[11025,12e3,8e3,0],wn=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],Sn=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],En=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1];function An(e){if(e.length<4)return void console.error("Invalid MP3 packet, header missing!");let t=new Uint8Array(e.buffer),r=null;if(255!==t[0])return void console.error("Invalid MP3 packet, first byte != 0xFF ");let i=t[1]>>>3&3,n=(6&t[1])>>1,o=(240&t[2])>>>4,s=(12&t[2])>>>2,a=3!==(t[3]>>>6&3)?2:1,d=0,l=0;switch(i){case 0:d=bn[s];break;case 2:d=vn[s];break;case 3:d=yn[s]}switch(n){case 1:o=e[n]&&t=6?(i=5,t=new Array(4),s=n-3):(i=2,t=new Array(2),s=n):-1!==a.indexOf("android")?(i=2,t=new Array(2),s=n):(i=5,s=n,t=new Array(4),n>=6?s=n-3:1===o&&(i=2,t=new Array(2),s=n)),t[0]=i<<3,t[0]|=(15&n)>>>1,t[1]=(15&n)<<7,t[1]|=(15&o)<<3,5===i&&(t[1]|=(15&s)>>>1,t[2]=(1&s)<<7,t[2]|=8,t[3]=0),this.config=t,this.sampling_rate=Nn[n],this.sampling_index=n,this.channel_count=o,this.object_type=i,this.original_object_type=r,this.codec_mimetype="mp4a.40."+i,this.original_codec_mimetype="mp4a.40."+r}}Date.now||(Date.now=function(){return(new Date).getTime()});const $n=[];$n.push(s({printErr:function(e){console.warn("JbPro[❌❌❌][worker]:",e)}}),o({printErr:function(e){console.warn("JbPro[❌❌❌][worker]",e)}})),Promise.all($n).then((e=>{const t=e[0];!function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=[],n=[],o={},s=new AbortController,a=null,d=null,l=null,u=null,c=!1,f=null,h=null,S=!1,E=!1,U=!!yr(r),be=!1,we=null,Ve=null,Xe=null,st=[],ht=null,pt=null,mt=0,_t=0,Et=null,At=null,Ut=0,Nt=0,Ot=!1,Gt=!1,$t=!1,Ht=null,Yt=null,Jt=null,nr=!1,wr=!0,Sr=()=>{const e=_r();return{debug:e.debug,debugLevel:e.debugLevel,debugUuid:e.debugUuid,useOffscreen:e.useOffscreen,useWCS:e.useWCS,useMSE:e.useMSE,videoBuffer:e.videoBuffer,videoBufferDelay:e.videoBufferDelay,openWebglAlignment:e.openWebglAlignment,playType:e.playType,hasAudio:e.hasAudio,hasVideo:e.hasVideo,playbackRate:1,playbackForwardMaxRateDecodeIFrame:e.playbackForwardMaxRateDecodeIFrame,playbackIsCacheBeforeDecodeForFpsRender:e.playbackConfig.isCacheBeforeDecodeForFpsRender,sampleRate:0,networkDelay:e.networkDelay,visibility:!0,useSIMD:e.useSIMD,isRecording:!1,recordType:e.recordType,isNakedFlow:e.isNakedFlow,checkFirstIFrame:e.checkFirstIFrame,audioBufferSize:1024,isM7sCrypto:e.isM7sCrypto,m7sCryptoAudio:e.m7sCryptoAudio,cryptoKey:e.cryptoKey,cryptoIV:e.cryptoIV,isSm4Crypto:e.isSm4Crypto,sm4CryptoKey:e.sm4CryptoKey,isXorCrypto:e.isXorCrypto,isHls265:!1,isFlv:e.isFlv,isFmp4:e.isFmp4,isMpeg4:e.isMpeg4,isTs:e.isTs,isFmp4Private:e.isFmp4Private,isEmitSEI:e.isEmitSEI,isRecordTypeFlv:!1,isWasmMp4:!1,isChrome:!1,isDropSameTimestampGop:e.isDropSameTimestampGop,mseDecodeAudio:e.mseDecodeAudio,nakedFlowH265DemuxUseNew:e.nakedFlowH265DemuxUseNew,mseDecoderUseWorker:e.mseDecoderUseWorker,mseAutoCleanupSourceBuffer:e.mseAutoCleanupSourceBuffer,mseAutoCleanupMaxBackwardDuration:e.mseAutoCleanupMaxBackwardDuration,mseAutoCleanupMinBackwardDuration:e.mseAutoCleanupMinBackwardDuration,mseCorrectTimeDuration:e.mseCorrectTimeDuration,mseCorrectAudioTimeDuration:e.mseCorrectAudioTimeDuration}};"VideoEncoder"in self&&(o={hasInit:!1,isEmitInfo:!1,offscreenCanvas:null,offscreenCanvasCtx:null,decoder:new VideoDecoder({output:function(e){if(o.isEmitInfo||(ii.debug.log("worker","Webcodecs Video Decoder initSize"),postMessage({cmd:T,w:e.codedWidth,h:e.codedHeight}),o.isEmitInfo=!0,o.offscreenCanvas=new OffscreenCanvas(e.codedWidth,e.codedHeight),o.offscreenCanvasCtx=o.offscreenCanvas.getContext("2d")),ur(e.createImageBitmap))e.createImageBitmap().then((t=>{o.offscreenCanvasCtx.drawImage(t,0,0,e.codedWidth,e.codedHeight);let r=o.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:r,delay:ii.delay,ts:0},[r]),hr(e)}));else{o.offscreenCanvasCtx.drawImage(e,0,0,e.codedWidth,e.codedHeight);let t=o.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:t,delay:ii.delay,ts:0},[t]),hr(e)}},error:function(e){ii.debug.error("worker","VideoDecoder error",e)}}),decode:function(e,t,r){const i=e[0]>>4==1;if(o.hasInit){const r=new EncodedVideoChunk({data:e.slice(5),timestamp:t,type:i?lt:ut});o.decoder.decode(r)}else if(i&&0===e[1]){const t=15&e[0];postMessage({cmd:M,code:t});const r=new Uint8Array(e);postMessage({cmd:R,buffer:r,codecId:t},[r.buffer]);let i=null,n=null;const s=e.slice(5);t===Fe?(n=Tr(s),i={codec:n.codec,description:s}):t===Ie&&(n=Wr(s),i={codec:n.codec,description:s}),n&&n.codecWidth&&n.codecHeight&&(i.codedHeight=n.codecHeight,i.codedWidth=n.codecWidth);try{o.decoder.configure(i),o.hasInit=!0}catch(e){ii.debug.log("worker","VideoDecoder configure error",e.code,e)}}},reset(){o.hasInit=!1,o.isEmitInfo=!1,o.offscreenCanvas=null,o.offscreenCanvasCtx=null}});let Er=function(){if(nr=!0,ii.fetchStatus!==Ct||vr(ii._opt.isChrome)){if(s)try{s.abort(),s=null}catch(e){ii.debug.log("worker","abort catch",e)}}else s=null,ii.debug.log("worker",`abort() and not abortController.abort() _status is ${ii.fetchStatus} and _isChrome is ${ii._opt.isChrome}`)},Ar={init(){Ar.lastBuf=null,Ar.vps=null,Ar.sps=null,Ar.pps=null,Ar.streamType=null,Ar.localDts=0,Ar.isSendSeqHeader=!1},destroy(){Ar.lastBuf=null,Ar.vps=null,Ar.sps=null,Ar.pps=null,Ar.streamType=null,Ar.localDts=0,Ar.isSendSeqHeader=!1},dispatch(e){const t=new Uint8Array(e);Ar.extractNALu$2(t)},getNaluDts(){let e=Ar.localDts;return Ar.localDts=Ar.localDts+40,e},getNaluAudioDts(){const e=ii._opt.sampleRate,t=ii._opt.audioBufferSize;return Ar.localDts+parseInt(t/e*1e3)},extractNALu(e){let t,r,i=0,n=e.byteLength,o=0,s=[];for(;i1)for(let e=0;e{const t=Ir(e);t===He||t===$e?Ar.handleVideoH264Nalu(e):Mr(t)&&i.push(e)})),1===i.length)Ar.handleVideoH264Nalu(i[0]);else if(zr(i)){const e=Ir(i[0]),t=Rr(e);Ar.handleVideoH264NaluList(i,t,e)}else i.forEach((e=>{Ar.handleVideoH264Nalu(e)}))}else if(Ar.streamType===Re)if(ii._opt.nakedFlowH265DemuxUseNew){const t=Ar.handleAddNaluStartCode(e),r=Ar.extractNALu(t);if(0===r.length)return void ii.debug.warn("worker","handleVideoNalu","h265 naluList.length === 0");const i=[];if(r.forEach((e=>{const t=Xr(e);t===nt||t===rt||t===et?Ar.handleVideoH265Nalu(e):Jr(t)&&i.push(e)})),1===i.length)Ar.handleVideoH265Nalu(i[0]);else if(ei(i)){const e=Xr(i[0]),t=Qr(e);Ar.handleVideoH265NaluList(i,t,e)}else i.forEach((e=>{Ar.handleVideoH265Nalu(e)}))}else Xr(e)===nt?Ar.extractH265PPS(e):Ar.handleVideoH265Nalu(e)},extractH264PPS(e){const t=Ar.handleAddNaluStartCode(e);Ar.extractNALu(t).forEach((e=>{Lr(Ir(e))?Ar.extractH264SEI(e):Ar.handleVideoH264Nalu(e)}))},extractH265PPS(e){const t=Ar.handleAddNaluStartCode(e);Ar.extractNALu(t).forEach((e=>{Zr(Xr(e))?Ar.extractH265SEI(e):Ar.handleVideoH265Nalu(e)}))},extractH264SEI(e){const t=Ar.handleAddNaluStartCode(e);Ar.extractNALu(t).forEach((e=>{Ar.handleVideoH264Nalu(e)}))},extractH265SEI(e){const t=Ar.handleAddNaluStartCode(e);Ar.extractNALu(t).forEach((e=>{Ar.handleVideoH265Nalu(e)}))},handleAddNaluStartCode(e){const t=[0,0,0,1],r=new Uint8Array(e.length+t.length);return r.set(t),r.set(e,t.length),r},handleVideoH264Nalu(e){const t=Ir(e);switch(t){case $e:Ar.sps=e;break;case He:Ar.pps=e}if(Ar.isSendSeqHeader){if(Ar.sps&&Ar.pps){const e=Cr({sps:Ar.sps,pps:Ar.pps}),t=Ar.getNaluDts();ii.decode(e,{type:se,ts:t,isIFrame:!0,cts:0}),Ar.sps=null,Ar.pps=null}if(Mr(t)){const r=Rr(t),i=Ar.getNaluDts(),n=Pr(e,r);Ar.doDecode(n,{type:se,ts:i,isIFrame:r,cts:0})}else ii.debug.warn("work",`handleVideoH264Nalu Avc Seq Head is ${t}`)}else if(Ar.sps&&Ar.pps){Ar.isSendSeqHeader=!0;const e=Cr({sps:Ar.sps,pps:Ar.pps});ii.decode(e,{type:se,ts:0,isIFrame:!0,cts:0}),Ar.sps=null,Ar.pps=null}},handleVideoH264NaluList(e,t,r){if(Ar.isSendSeqHeader){const i=Ar.getNaluDts(),n=Fr(e.reduce(((e,t)=>{const r=er(e),i=er(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Ar.doDecode(n,{type:se,ts:i,isIFrame:t,cts:0}),ii.debug.log("worker",`handleVideoH264NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}else ii.debug.warn("worker","handleVideoH264NaluList isSendSeqHeader is false")},handleVideoH265Nalu(e){const t=Xr(e);switch(t){case et:Ar.vps=e;break;case rt:Ar.sps=e;break;case nt:Ar.pps=e}if(Ar.isSendSeqHeader){if(Ar.vps&&Ar.sps&&Ar.pps){const e=qr({vps:Ar.vps,sps:Ar.sps,pps:Ar.pps}),t=Ar.getNaluDts();ii.decode(e,{type:se,ts:t,isIFrame:!0,cts:0}),Ar.vps=null,Ar.sps=null,Ar.pps=null}if(Jr(t)){const r=Qr(t),i=Ar.getNaluDts(),n=Yr(e,r);Ar.doDecode(n,{type:se,ts:i,isIFrame:r,cts:0})}else ii.debug.warn("work",`handleVideoH265Nalu HevcSeqHead is ${t}`)}else if(Ar.vps&&Ar.sps&&Ar.pps){Ar.isSendSeqHeader=!0;const e=qr({vps:Ar.vps,sps:Ar.sps,pps:Ar.pps});ii.decode(e,{type:se,ts:0,isIFrame:!0,cts:0}),Ar.vps=null,Ar.sps=null,Ar.pps=null}},handleVideoH265NaluList(e,t,r){if(Ar.isSendSeqHeader){const i=Ar.getNaluDts(),n=Kr(e.reduce(((e,t)=>{const r=er(e),i=er(t),n=new Uint8Array(r.byteLength+i.byteLength);return n.set(r,0),n.set(i,r.byteLength),n})),t);Ar.doDecode(n,{type:se,ts:i,isIFrame:t,cts:0}),ii.debug.log("worker",`handleVideoH265NaluList list size is ${e.length} package length is ${n.byteLength} isIFrame is ${t},nalu type is ${r}, dts is ${i}`)}else ii.debug.warn("worker","handleVideoH265NaluList isSendSeqHeader is false")},doDecode(e,t){ii.calcNetworkDelay(t.ts),t.isIFrame&&ii.calcIframeIntervalTimestamp(t.ts),ii.decode(e,t)}},kr={LOG_NAME:"worker fmp4Demuxer",mp4Box:null,offset:0,videoTrackId:null,audioTrackId:null,isHevc:!1,listenMp4Box(){kr.mp4Box=Oi.createFile(),kr.mp4Box.onReady=kr.onReady,kr.mp4Box.onError=kr.onError,kr.mp4Box.onSamples=kr.onSamples},initTransportDescarmber(){kr.transportDescarmber=new Hi},_getSeqHeader(e){const t=kr.mp4Box.getTrackById(e.id);for(const e of t.mdia.minf.stbl.stsd.entries)if(e.avcC||e.hvcC){const t=new Oi.DataStream(void 0,0,Oi.DataStream.BIG_ENDIAN);let r=[];e.avcC?(e.avcC.write(t),r=[23,0,0,0,0]):(kr.isHevc=!0,Ht=!0,e.hvcC.write(t),r=[28,0,0,0,0]);const i=new Uint8Array(t.buffer,8),n=new Uint8Array(r.length+i.length);return n.set(r,0),n.set(i,r.length),n}return null},onReady(e){ii.debug.log(kr.LOG_NAME,"onReady()");const t=e.videoTracks[0],r=e.audioTracks[0];if(t){kr.videoTrackId=t.id;const e=kr._getSeqHeader(t);e&&(ii.debug.log(kr.LOG_NAME,"seqHeader"),ii.decodeVideo(e,0,!0,0)),kr.mp4Box.setExtractionOptions(t.id)}if(r&&ii._opt.hasAudio){kr.audioTrackId=r.id;const e=r.audio||{},t=Vt.indexOf(e.sample_rate),i=r.codec.replace("mp4a.40.","");kr.mp4Box.setExtractionOptions(r.id);const n=Wt({profile:parseInt(i,10),sampleRate:t,channel:e.channel_count});ii.debug.log(kr.LOG_NAME,"aacADTSHeader"),ii.decodeAudio(n,0)}kr.mp4Box.start()},onError(e){ii.debug.error(kr.LOG_NAME,"mp4Box onError",e)},onSamples(e,t,r){if(e===kr.videoTrackId)for(const t of r){const r=t.data,i=t.is_sync,n=1e3*t.cts/t.timescale;t.duration,t.timescale,i&&ii.calcIframeIntervalTimestamp(n);let o=null;o=kr.isHevc?Kr(r,i):Fr(r,i),ii.decode(o,{type:se,ts:n,isIFrame:i,cts:0}),kr.mp4Box.releaseUsedSamples(e,t.number)}else if(e===kr.audioTrackId){if(ii._opt.hasAudio)for(const t of r){const r=t.data,i=1e3*t.cts/t.timescale;t.duration,t.timescale;const n=new Uint8Array(r.byteLength+2);n.set([175,1],0),n.set(r,2),ii.decode(n,{type:oe,ts:i,isIFrame:!1,cts:0}),kr.mp4Box.releaseUsedSamples(e,t.number)}}else ii.debug.warn(kr.LOG_NAME,"onSamples() trackId error",e)},dispatch(e){let t=new Uint8Array(e);kr.transportDescarmber&&(t=kr.transportDescarmber.transport(t)),t.buffer.fileStart=kr.offset,kr.offset+=t.byteLength,kr.mp4Box.appendBuffer(t.buffer)},destroy(){kr.mp4Box&&(kr.mp4Box.stop(),kr.mp4Box.flush(),kr.mp4Box.destroy(),kr.mp4Box=null),kr.transportDescarmber&&(kr.transportDescarmber.destroy(),kr.transportDescarmber=null),kr.offset=0,kr.videoTrackId=null,kr.audioTrackId=null,kr.isHevc=!1}},Gr={LOG_NAME:"worker mpeg4Demuxer",lastBuffer:new Uint8Array(0),parsedOffset:0,firstStartCodeOffset:0,secondStartCodeOffset:0,state:"init",hasInitVideoCodec:!1,localDts:0,dispatch(e){const t=new Uint8Array(e);Gr.extractNALu(t)},destroy(){Gr.lastBuffer=new Uint8Array(0),Gr.parsedOffset=0,Gr.firstStartCodeOffset=0,Gr.secondStartCodeOffset=0,Gr.state="init",Gr.hasInitVideoCodec=!1,Gr.localDts=0},extractNALu(e){if(!e||e.byteLength<1)return void ii.debug.warn(Gr.LOG_NAME,"extractNALu() buffer error",e);const t=new Uint8Array(Gr.lastBuffer.length+e.length);for(t.set(Gr.lastBuffer,0),t.set(new Uint8Array(e),Gr.lastBuffer.length),Gr.lastBuffer=t;;){if("init"===Gr.state){let e=!1;for(;Gr.lastBuffer.length-Gr.parsedOffset>=4;)if(0===Gr.lastBuffer[Gr.parsedOffset])if(0===Gr.lastBuffer[Gr.parsedOffset+1])if(1===Gr.lastBuffer[Gr.parsedOffset+2]){if(182===Gr.lastBuffer[Gr.parsedOffset+3]){Gr.state="findFirstStartCode",Gr.firstStartCodeOffset=Gr.parsedOffset,Gr.parsedOffset+=4,e=!0;break}Gr.parsedOffset++}else Gr.parsedOffset++;else Gr.parsedOffset++;else Gr.parsedOffset++;if(e)continue;break}if("findFirstStartCode"===Gr.state){let e=!1;for(;Gr.lastBuffer.length-Gr.parsedOffset>=4;)if(0===Gr.lastBuffer[Gr.parsedOffset])if(0===Gr.lastBuffer[Gr.parsedOffset+1])if(1===Gr.lastBuffer[Gr.parsedOffset+2]){if(182===Gr.lastBuffer[Gr.parsedOffset+3]){Gr.state="findSecondStartCode",Gr.secondStartCodeOffset=Gr.parsedOffset,Gr.parsedOffset+=4,e=!0;break}Gr.parsedOffset++}else Gr.parsedOffset++;else Gr.parsedOffset++;else Gr.parsedOffset++;if(e)continue;break}if("findSecondStartCode"===Gr.state){if(!(Gr.lastBuffer.length-Gr.parsedOffset>0))break;{let e,t,r=192&Gr.lastBuffer[Gr.parsedOffset];e=0==r?Gr.secondStartCodeOffset-14:Gr.secondStartCodeOffset;let i=0==(192&Gr.lastBuffer[Gr.firstStartCodeOffset+4]);if(i){if(Gr.firstStartCodeOffset-14<0)return void ii.debug.warn(Gr.LOG_NAME,"firstStartCodeOffset -14 is",Gr.firstStartCodeOffset-14);Gr.hasInitVideoCodec||(Gr.hasInitVideoCodec=!0,ii.debug.log(Gr.LOG_NAME,"setCodec"),oi.setCodec(Le,"")),t=Gr.lastBuffer.subarray(Gr.firstStartCodeOffset-14,e)}else t=Gr.lastBuffer.subarray(Gr.firstStartCodeOffset,e);let n=Gr.getNaluDts();Gr.hasInitVideoCodec?(postMessage({cmd:G,type:Be,value:t.byteLength}),postMessage({cmd:G,type:xe,value:n}),oi.decode(t,i?1:0,n)):ii.debug.warn(Gr.LOG_NAME,"has not init video codec"),Gr.lastBuffer=Gr.lastBuffer.subarray(e),Gr.firstStartCodeOffset=0==r?14:0,Gr.parsedOffset=Gr.firstStartCodeOffset+4,Gr.state="findFirstStartCode"}}}},getNaluDts(){let e=Gr.localDts;return Gr.localDts=Gr.localDts+40,e}},$r={TAG_NAME:"worker TsLoaderV2",first_parse_:!0,tsPacketSize:0,syncOffset:0,pmt_:null,config_:null,media_info_:new On,timescale_:90,duration_:0,pat_:{version_number:0,network_pid:0,program_map_pid:{}},current_program_:null,current_pmt_pid_:-1,program_pmt_map_:{},pes_slice_queues_:{},section_slice_queues_:{},video_metadata_:{vps:null,sps:null,pps:null,details:null},audio_metadata_:{codec:null,audio_object_type:null,sampling_freq_index:null,sampling_frequency:null,channel_config:null},last_pcr_:null,audio_last_sample_pts_:void 0,aac_last_incomplete_data_:null,has_video_:!1,has_audio_:!1,video_init_segment_dispatched_:!1,audio_init_segment_dispatched_:!1,video_metadata_changed_:!1,audio_metadata_changed_:!1,loas_previous_frame:null,video_track_:{type:"video",id:1,sequenceNumber:0,samples:[],length:0},audio_track_:{type:"audio",id:2,sequenceNumber:0,samples:[],length:0},_remainingPacketData:null,init(){},destroy(){$r.media_info_=null,$r.pes_slice_queues_=null,$r.section_slice_queues_=null,$r.video_metadata_=null,$r.audio_metadata_=null,$r.aac_last_incomplete_data_=null,$r.video_track_=null,$r.audio_track_=null,$r._remainingPacketData=null},probe(e){let t=new Uint8Array(e),r=-1,i=188;if(t.byteLength<=3*i)return{needMoreData:!0};for(;-1===r;){let e=Math.min(1e3,t.byteLength-3*i);for(let n=0;n=4&&(r-=4),{match:!0,consumed:0,ts_packet_size:i,sync_offset:r})},_initPmt:()=>({program_number:0,version_number:0,pcr_pid:0,pid_stream_type:{},common_pids:{h264:void 0,h265:void 0,adts_aac:void 0,loas_aac:void 0,opus:void 0,ac3:void 0,eac3:void 0,mp3:void 0},pes_private_data_pids:{},timed_id3_pids:{},synchronous_klv_pids:{},asynchronous_klv_pids:{},scte_35_pids:{},smpte2038_pids:{}}),dispatch(e){$r._remainingPacketData&&(e=hn($r._remainingPacketData,e),$r._remainingPacketData=null);let t=e.buffer;const r=$r.parseChunks(t);r?$r._remainingPacketData=e.subarray(r):e.length>>6;r[1];let o=(31&r[1])<<8|r[2],s=(48&r[3])>>>4,a=15&r[3],d=!(!$r.pmt_||$r.pmt_.pcr_pid!==o),l={},u=4;if(2==s||3==s){let e=r[4];if(e>0&&(d||3==s)&&(l.discontinuity_indicator=(128&r[5])>>>7,l.random_access_indicator=(64&r[5])>>>6,l.elementary_stream_priority_indicator=(32&r[5])>>>5,(16&r[5])>>>4)){let e=300*(r[6]<<25|r[7]<<17|r[8]<<9|r[9]<<1|r[10]>>>7)+((1&r[10])<<8|r[11]);$r.last_pcr_=e}if(2==s||5+e===188){t+=188,204===$r.tsPacketSize&&(t+=16);continue}u=5+e}if(1==s||3==s)if(0===o||o===$r.current_pmt_pid_||null!=$r.pmt_&&$r.pmt_.pid_stream_type[o]===Fn){let r=188-u;$r.handleSectionSlice(e,t+u,r,{pid:o,payload_unit_start_indicator:n,continuity_conunter:a,random_access_indicator:l.random_access_indicator})}else if(null!=$r.pmt_&&null!=$r.pmt_.pid_stream_type[o]){let r=188-u,i=$r.pmt_.pid_stream_type[o];o!==$r.pmt_.common_pids.h264&&o!==$r.pmt_.common_pids.h265&&o!==$r.pmt_.common_pids.adts_aac&&o!==$r.pmt_.common_pids.loas_aac&&o!==$r.pmt_.common_pids.ac3&&o!==$r.pmt_.common_pids.eac3&&o!==$r.pmt_.common_pids.opus&&o!==$r.pmt_.common_pids.mp3&&!0!==$r.pmt_.pes_private_data_pids[o]&&!0!==$r.pmt_.timed_id3_pids[o]&&!0!==$r.pmt_.synchronous_klv_pids[o]&&!0!==$r.pmt_.asynchronous_klv_pids[o]||$r.handlePESSlice(e,t+u,r,{pid:o,stream_type:i,payload_unit_start_indicator:n,continuity_conunter:a,random_access_indicator:l.random_access_indicator})}t+=188,204===$r.tsPacketSize&&(t+=16)}return $r.dispatchAudioVideoMediaSegment(),t},handleSectionSlice(e,t,r,i){let n=new Uint8Array(e,t,r),o=$r.section_slice_queues_[i.pid];if(i.payload_unit_start_indicator){let s=n[0];if(null!=o&&0!==o.total_length){let n=new Uint8Array(e,t+1,Math.min(r,s));o.slices.push(n),o.total_length+=n.byteLength,o.total_length===o.expected_length?$r.emitSectionSlices(o,i):$r.clearSlices(o,i)}for(let a=1+s;a=o.expected_length&&$r.clearSlices(o,i),a+=d.byteLength}}else if(null!=o&&0!==o.total_length){let n=new Uint8Array(e,t,Math.min(r,o.expected_length-o.total_length));o.slices.push(n),o.total_length+=n.byteLength,o.total_length===o.expected_length?$r.emitSectionSlices(o,i):o.total_length>=o.expected_length&&$r.clearSlices(o,i)}},handlePESSlice(e,t,r,i){let n=new Uint8Array(e,t,r),o=n[0]<<16|n[1]<<8|n[2];n[3];let s=n[4]<<8|n[5];if(i.payload_unit_start_indicator){if(1!==o)return void ii.debug.warn($r.TAG_NAME,`handlePESSlice: packet_start_code_prefix should be 1 but with value ${o}`);let e=$r.pes_slice_queues_[i.pid];e&&(0===e.expected_length||e.expected_length===e.total_length?$r.emitPESSlices(e,i):$r.clearSlices(e,i)),$r.pes_slice_queues_[i.pid]=new Mn,$r.pes_slice_queues_[i.pid].random_access_indicator=i.random_access_indicator}if(null==$r.pes_slice_queues_[i.pid])return;let a=$r.pes_slice_queues_[i.pid];a.slices.push(n),i.payload_unit_start_indicator&&(a.expected_length=0===s?0:s+6),a.total_length+=n.byteLength,a.expected_length>0&&a.expected_length===a.total_length?$r.emitPESSlices(a,i):a.expected_length>0&&a.expected_length>>6,a=t[8];2!==s&&3!==s||(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,o=3===s?536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2:r);let d,l=9+a;if(0!==n){if(n<3+a)return void ii.debug.warn($r.TAG_NAME,"Malformed PES: PES_packet_length < 3 + PES_header_data_length");d=n-3-a}else d=t.byteLength-l;let u=t.subarray(l,l+d);switch(e.stream_type){case Bn:case xn:$r.parseMP3Payload(u,r);break;case Un:$r.pmt_.common_pids.opus===e.pid||$r.pmt_.common_pids.ac3===e.pid||$r.pmt_.common_pids.eac3===e.pid||($r.pmt_.asynchronous_klv_pids[e.pid]?$r.parseAsynchronousKLVMetadataPayload(u,e.pid,i):$r.pmt_.smpte2038_pids[e.pid]?$r.parseSMPTE2038MetadataPayload(u,r,o,e.pid,i):$r.parsePESPrivateDataPayload(u,r,o,e.pid,i));break;case kn:$r.parseADTSAACPayload(u,r);break;case Tn:$r.parseLOASAACPayload(u,r);break;case Cn:case Dn:break;case Pn:$r.pmt_.timed_id3_pids[e.pid]?$r.parseTimedID3MetadataPayload(u,r,o,e.pid,i):$r.pmt_.synchronous_klv_pids[e.pid]&&$r.parseSynchronousKLVMetadataPayload(u,r,o,e.pid,i);break;case In:$r.parseH264Payload(u,r,o,e.random_access_indicator);break;case Ln:$r.parseH265Payload(u,r,o,e.random_access_indicator)}}else if((188===i||191===i||240===i||241===i||255===i||242===i||248===i)&&e.stream_type===Un){let r,o=6;r=0!==n?n:t.byteLength-o;let s=t.subarray(o,o+r);$r.parsePESPrivateDataPayload(s,void 0,void 0,e.pid,i)}}else ii.debug.error($r.TAG_NAME,`parsePES: packet_start_code_prefix should be 1 but with value ${r}`)},parsePAT(e){let t=e[0];if(0!==t)return void Log.e($r.TAG,`parsePAT: table_id ${t} is not corresponded to PAT!`);let r=(15&e[1])<<8|e[2];e[3],e[4];let i=(62&e[5])>>>1,n=1&e[5],o=e[6];e[7];let s=null;if(1===n&&0===o)s={version_number:0,network_pid:0,program_pmt_pid:{}},s.version_number=i;else if(s=$r.pat_,null==s)return;let a=r-5-4,d=-1,l=-1;for(let t=8;t<8+a;t+=4){let r=e[t]<<8|e[t+1],i=(31&e[t+2])<<8|e[t+3];0===r?s.network_pid=i:(s.program_pmt_pid[r]=i,-1===d&&(d=r),-1===l&&(l=i))}1===n&&0===o&&(null==$r.pat_&&ii.debug.log($r.TAG_NAME,`Parsed first PAT: ${JSON.stringify(s)}`),$r.pat_=s,$r.current_program_=d,$r.current_pmt_pid_=l)},parsePMT(e){let t=e[0];if(2!==t)return void ii.debug.error($r.TAG_NAME,`parsePMT: table_id ${t} is not corresponded to PMT!`);let r,i=(15&e[1])<<8|e[2],n=e[3]<<8|e[4],o=(62&e[5])>>>1,s=1&e[5],a=e[6];if(e[7],1===s&&0===a)r=$r._initPmt(),r.program_number=n,r.version_number=o,$r.program_pmt_map_[n]=r;else if(r=$r.program_pmt_map_[n],null==r)return;r.pcr_pid=(31&e[8])<<8|e[9];let d=(15&e[10])<<8|e[11],l=12+d,u=i-9-d-4;for(let t=l;t0){for(let i=t+5;i0)for(let i=t+5;i$r.has_video_&&$r.has_audio_?$r.video_init_segment_dispatched_&&$r.audio_init_segment_dispatched_:$r.has_video_&&!$r.has_audio_?$r.video_init_segment_dispatched_:!($r.has_video_||!$r.has_audio_)&&$r.audio_init_segment_dispatched_,dispatchVideoInitSegment(){let e=$r.video_metadata_.details,t={type:"video"};t.id=$r.video_track_.id,t.timescale=1e3,t.duration=$r.duration_,t.codecWidth=e.codec_size.width,t.codecHeight=e.codec_size.height,t.presentWidth=e.present_size.width,t.presentHeight=e.present_size.height,t.profile=e.profile_string,t.level=e.level_string,t.bitDepth=e.bit_depth,t.chromaFormat=e.chroma_format,t.sarRatio=e.sar_ratio,t.frameRate=e.frame_rate;let r=t.frameRate.fps_den,i=t.frameRate.fps_num;if(t.refSampleDuration=r/i*1e3,t.codec=e.codec_mimetype,$r.video_metadata_.vps){let e=$r.video_metadata_.vps.data.subarray(4),r=$r.video_metadata_.sps.data.subarray(4),i=$r.video_metadata_.pps.data.subarray(4);t.hvcc=qr({vps:e,sps:r,pps:i}),0==$r.video_init_segment_dispatched_&&ii.debug.log($r.TAG_NAME,`Generated first HEVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.hvcc&&ii.decodeVideo(t.hvcc,0,!0,0)}else{let e=$r.video_metadata_.sps.data.subarray(4),r=$r.video_metadata_.pps.data.subarray(4);t.avcc=Dr({sps:e,pps:r}),0==$r.video_init_segment_dispatched_&&ii.debug.log($r.TAG_NAME,`Generated first AVCDecoderConfigurationRecord for mimeType: ${t.codec}`),t.avcc&&ii.decodeVideo(t.avcc,0,!0,0)}$r.video_init_segment_dispatched_=!0,$r.video_metadata_changed_=!1;let n=$r.media_info_;n.hasVideo=!0,n.width=t.codecWidth,n.height=t.codecHeight,n.fps=t.frameRate.fps,n.profile=t.profile,n.level=t.level,n.refFrames=e.ref_frames,n.chromaFormat=e.chroma_format_string,n.sarNum=t.sarRatio.width,n.sarDen=t.sarRatio.height,n.videoCodec=t.codec,n.hasAudio&&n.audioCodec?n.mimeType=`video/mp2t; codecs="${n.videoCodec},${n.audioCodec}"`:n.mimeType=`video/mp2t; codecs="${n.videoCodec}"`},dispatchVideoMediaSegment(){$r.isInitSegmentDispatched()&&$r.video_track_.length&&$r._preDoDecode()},dispatchAudioMediaSegment(){$r.isInitSegmentDispatched()&&$r.audio_track_.length&&$r._preDoDecode()},dispatchAudioVideoMediaSegment(){$r.isInitSegmentDispatched()&&($r.audio_track_.length||$r.video_track_.length)&&$r._preDoDecode()},parseADTSAACPayload(e,t){if($r.has_video_&&!$r.video_init_segment_dispatched_)return;if($r.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+$r.aac_last_incomplete_data_.byteLength);t.set($r.aac_last_incomplete_data_,0),t.set(e,$r.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/$r.timescale_),"aac"===$r.audio_metadata_.codec){if(null==t&&null!=$r.audio_last_sample_pts_)r=1024/$r.audio_metadata_.sampling_frequency*1e3,i=$r.audio_last_sample_pts_+r;else if(null==t)return void ii.debug.warn($r.TAG_NAME,"AAC: Unknown pts");if($r.aac_last_incomplete_data_&&$r.audio_last_sample_pts_){r=1024/$r.audio_metadata_.sampling_frequency*1e3;let e=$r.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(ii.debug.warn($r.TAG_NAME,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,o=new Xt(e),s=null,a=i;for(;null!=(s=o.readNextAACFrame());){r=1024/s.sampling_frequency*1e3;const e={codec:"aac",data:s};0==$r.audio_init_segment_dispatched_?($r.audio_metadata_={codec:"aac",audio_object_type:s.audio_object_type,sampling_freq_index:s.sampling_freq_index,sampling_frequency:s.sampling_frequency,channel_config:s.channel_config},$r.dispatchAudioInitSegment(e)):$r.detectAudioMetadataChange(e)&&($r.dispatchAudioMediaSegment(),$r.dispatchAudioInitSegment(e)),n=a;let t=Math.floor(a);const i=new Uint8Array(s.data.length+2);i.set([175,1],0),i.set(s.data,2);let o={payload:i,length:i.byteLength,pts:t,dts:t,type:oe};$r.audio_track_.samples.push(o),$r.audio_track_.length+=i.byteLength,a+=r}o.hasIncompleteData()&&($r.aac_last_incomplete_data_=o.getIncompleteData()),n&&($r.audio_last_sample_pts_=n)},parseLOASAACPayload(e,t){if($r.has_video_&&!$r.video_init_segment_dispatched_)return;if($r.aac_last_incomplete_data_){let t=new Uint8Array(e.byteLength+$r.aac_last_incomplete_data_.byteLength);t.set($r.aac_last_incomplete_data_,0),t.set(e,$r.aac_last_incomplete_data_.byteLength),e=t}let r,i;if(null!=t&&(i=t/$r.timescale_),"aac"===$r.audio_metadata_.codec){if(null==t&&null!=$r.audio_last_sample_pts_)r=1024/$r.audio_metadata_.sampling_frequency*1e3,i=$r.audio_last_sample_pts_+r;else if(null==t)return void ii.debug.warn($r.TAG_NAME,"AAC: Unknown pts");if($r.aac_last_incomplete_data_&&$r.audio_last_sample_pts_){r=1024/$r.audio_metadata_.sampling_frequency*1e3;let e=$r.audio_last_sample_pts_+r;Math.abs(e-i)>1&&(ii.debug.warn($r.TAG,`AAC: Detected pts overlapped, expected: ${e}ms, PES pts: ${i}ms`),i=e)}}let n,o=new Zt(e),s=null,a=i;for(;null!=(s=o.readNextAACFrame(dr(this.loas_previous_frame)?void 0:this.loas_previous_frame));){$r.loas_previous_frame=s,r=1024/s.sampling_frequency*1e3;const e={codec:"aac",data:s};0==$r.audio_init_segment_dispatched_?($r.audio_metadata_={codec:"aac",audio_object_type:s.audio_object_type,sampling_freq_index:s.sampling_freq_index,sampling_frequency:s.sampling_frequency,channel_config:s.channel_config},$r.dispatchAudioInitSegment(e)):$r.detectAudioMetadataChange(e)&&($r.dispatchAudioMediaSegment(),$r.dispatchAudioInitSegment(e)),n=a;let t=Math.floor(a);const i=new Uint8Array(s.data.length+2);i.set([175,1],0),i.set(s.data,2);let o={payload:i,length:i.byteLength,pts:t,dts:t,type:oe};$r.audio_track_.samples.push(o),$r.audio_track_.length+=i.byteLength,a+=r}o.hasIncompleteData()&&($r.aac_last_incomplete_data_=o.getIncompleteData()),n&&($r.audio_last_sample_pts_=n)},parseAC3Payload(e,t){},parseEAC3Payload(e,t){},parseOpusPayload(e,t){},parseMP3Payload(e,t){if($r.has_video_&&!$r.video_init_segment_dispatched_)return;let r=[44100,48e3,32e3,0],i=[22050,24e3,16e3,0],n=[11025,12e3,8e3,0],o=e[1]>>>3&3,s=(6&e[1])>>1;e[2];let a=(12&e[2])>>>2,d=3!=(e[3]>>>6&3)?2:1,l=0,u=34;switch(o){case 0:l=n[a];break;case 2:l=i[a];break;case 3:l=r[a]}switch(s){case 1:u=34;break;case 2:u=33;break;case 3:u=32}const c={};c.object_type=u,c.sample_rate=l,c.channel_count=d,c.data=e;const f={codec:"mp3",data:c};0==$r.audio_init_segment_dispatched_?($r.audio_metadata_={codec:"mp3",object_type:u,sample_rate:l,channel_count:d},$r.dispatchAudioInitSegment(f)):$r.detectAudioMetadataChange(f)&&($r.dispatchAudioMediaSegment(),$r.dispatchAudioInitSegment(f));let h={payload:e,length:e.byteLength,pts:t/$r.timescale_,dts:t/$r.timescale_,type:oe};$r.audio_track_.samples.push(h),$r.audio_track_.length+=e.byteLength},detectAudioMetadataChange(e){if(e.codec!==$r.audio_metadata_.codec)return ii.debug.log($r.TAG_NAME,`Audio: Audio Codecs changed from ${$r.audio_metadata_.codec} to ${e.codec}`),!0;if("aac"===e.codec&&"aac"===$r.audio_metadata_.codec){const t=e.data;if(t.audio_object_type!==$r.audio_metadata_.audio_object_type)return ii.debug.log($r.TAG_NAME,`AAC: AudioObjectType changed from ${$r.audio_metadata_.audio_object_type} to ${t.audio_object_type}`),!0;if(t.sampling_freq_index!==$r.audio_metadata_.sampling_freq_index)return ii.debug.log($r.TAG_NAME,`AAC: SamplingFrequencyIndex changed from ${$r.audio_metadata_.sampling_freq_index} to ${t.sampling_freq_index}`),!0;if(t.channel_config!==$r.audio_metadata_.channel_config)return ii.debug.log($r.TAG_NAME,`AAC: Channel configuration changed from ${$r.audio_metadata_.channel_config} to ${t.channel_config}`),!0}else if("ac-3"===e.codec&&"ac-3"===$r.audio_metadata_.codec){const t=e.data;if(t.sampling_frequency!==$r.audio_metadata_.sampling_frequency)return ii.debug.log($r.TAG_NAME,`AC3: Sampling Frequency changed from ${$r.audio_metadata_.sampling_frequency} to ${t.sampling_frequency}`),!0;if(t.bit_stream_identification!==$r.audio_metadata_.bit_stream_identification)return ii.debug.log($r.TAG_NAME,`AC3: Bit Stream Identification changed from ${$r.audio_metadata_.bit_stream_identification} to ${t.bit_stream_identification}`),!0;if(t.bit_stream_mode!==$r.audio_metadata_.bit_stream_mode)return ii.debug.log($r.TAG_NAME,`AC3: BitStream Mode changed from ${$r.audio_metadata_.bit_stream_mode} to ${t.bit_stream_mode}`),!0;if(t.channel_mode!==$r.audio_metadata_.channel_mode)return ii.debug.log($r.TAG_NAME,`AC3: Channel Mode changed from ${$r.audio_metadata_.channel_mode} to ${t.channel_mode}`),!0;if(t.low_frequency_effects_channel_on!==$r.audio_metadata_.low_frequency_effects_channel_on)return ii.debug.log($r.TAG_NAME,`AC3: Low Frequency Effects Channel On changed from ${$r.audio_metadata_.low_frequency_effects_channel_on} to ${t.low_frequency_effects_channel_on}`),!0}else if("opus"===e.codec&&"opus"===$r.audio_metadata_.codec){const t=e.meta;if(t.sample_rate!==$r.audio_metadata_.sample_rate)return ii.debug.log($r.TAG_NAME,`Opus: SamplingFrequencyIndex changed from ${$r.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==$r.audio_metadata_.channel_count)return ii.debug.log($r.TAG_NAME,`Opus: Channel count changed from ${$r.audio_metadata_.channel_count} to ${t.channel_count}`),!0}else if("mp3"===e.codec&&"mp3"===$r.audio_metadata_.codec){const t=e.data;if(t.object_type!==$r.audio_metadata_.object_type)return ii.debug.log($r.TAG_NAME,`MP3: AudioObjectType changed from ${$r.audio_metadata_.object_type} to ${t.object_type}`),!0;if(t.sample_rate!==$r.audio_metadata_.sample_rate)return ii.debug.log($r.TAG_NAME,`MP3: SamplingFrequencyIndex changed from ${$r.audio_metadata_.sample_rate} to ${t.sample_rate}`),!0;if(t.channel_count!==$r.audio_metadata_.channel_count)return ii.debug.log($r.TAG_NAME,`MP3: Channel count changed from ${$r.audio_metadata_.channel_count} to ${t.channel_count}`),!0}return!1},dispatchAudioInitSegment(e){let t={type:"audio"};if(t.id=$r.audio_track_.id,t.timescale=1e3,t.duration=$r.duration_,"aac"===$r.audio_metadata_.codec){let r="aac"===e.codec?e.data:null,i=new Gn(r);t.audioSampleRate=i.sampling_rate,t.audioSampleRateIndex=i.sampling_index,t.channelCount=i.channel_count,t.codec=i.codec_mimetype,t.originalCodec=i.original_codec_mimetype,t.config=i.config,t.refSampleDuration=1024/t.audioSampleRate*t.timescale;const n=Wt({profile:ii._opt.mseDecodeAudio?i.object_type:i.original_object_type,sampleRate:t.audioSampleRateIndex,channel:t.channelCount});ii.decodeAudio(n,0)}else"ac-3"===$r.audio_metadata_.codec||"ec-3"===$r.audio_metadata_.codec||"opus"===$r.audio_metadata_.codec||"mp3"===$r.audio_metadata_.codec&&(t.audioSampleRate=$r.audio_metadata_.sample_rate,t.channelCount=$r.audio_metadata_.channel_count,t.codec="mp3",t.originalCodec="mp3",t.config=void 0);0==$r.audio_init_segment_dispatched_&&ii.debug.log($r.TAG_NAME,`Generated first AudioSpecificConfig for mimeType: ${t.codec}`),$r.audio_init_segment_dispatched_=!0,$r.video_metadata_changed_=!1;let r=$r.media_info_;r.hasAudio=!0,r.audioCodec=t.originalCodec,r.audioSampleRate=t.audioSampleRate,r.audioChannelCount=t.channelCount,r.hasVideo&&r.videoCodec?r.mimeType=`video/mp2t; codecs="${r.videoCodec},${r.audioCodec}"`:r.mimeType=`video/mp2t; codecs="${r.audioCodec}"`},dispatchPESPrivateDataDescriptor(e,t,r){},parsePESPrivateDataPayload(e,t,r,i,n){let o=new zn;if(o.pid=i,o.stream_id=n,o.len=e.byteLength,o.data=e,null!=t){let e=Math.floor(t/$r.timescale_);o.pts=e}else o.nearest_pts=$r.getNearestTimestampMilliseconds();if(null!=r){let e=Math.floor(r/$r.timescale_);o.dts=e}},parseTimedID3MetadataPayload(e,t,r,i,n){ii.debug.log($r.TAG_NAME,`Timed ID3 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseSynchronousKLVMetadataPayload(e,t,r,i,n){ii.debug.log($r.TAG_NAME,`Synchronous KLV Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},parseAsynchronousKLVMetadataPayload(e,t,r){ii.debug.log($r.TAG_NAME,`Asynchronous KLV Metadata: pid=${t}, stream_id=${r}`)},parseSMPTE2038MetadataPayload(e,t,r,i,n){ii.debug.log($r.TAG_NAME,`SMPTE 2038 Metadata: pid=${i}, pts=${t}, dts=${r}, stream_id=${n}`)},getNearestTimestampMilliseconds:()=>null!=$r.audio_last_sample_pts_?Math.floor($r.audio_last_sample_pts_):null!=$r.last_pcr_?Math.floor($r.last_pcr_/300/$r.timescale_):void 0,_preDoDecode(){const e=$r.video_track_,t=$r.audio_track_;let r=e.samples;t.samples.length>0&&(r=e.samples.concat(t.samples),r=r.sort(((e,t)=>e.dts-t.dts))),r.forEach((e=>{const t=new Uint8Array(e.payload);delete e.payload,e.type===se?$r._doDecodeVideo({...e,payload:t}):e.type===oe&&$r._doDecodeAudio({...e,payload:t})})),e.samples=[],e.length=0,t.samples=[],t.length=0},_doDecodeVideo(e){const t=new Uint8Array(e.payload);let r=null;r=e.isHevc?Kr(t,e.isIFrame):Fr(t,e.isIFrame),e.isIFrame&&ii.calcIframeIntervalTimestamp(e.dts);let i=ii.cryptoPayload(r,e.isIFrame);ii.decode(i,{type:se,ts:e.dts,isIFrame:e.isIFrame,cts:e.cts})},_doDecodeAudio(e){const t=new Uint8Array(e.payload);let r=t;yr(ii._opt.m7sCryptoAudio)&&(r=ii.cryptoPayloadAudio(t)),ii.decode(r,{type:oe,ts:e.dts,isIFrame:!1,cts:0})}},jr=null;br()&&(jr={TAG_NAME:"worker MediaSource",_resetInIt(){jr.isAvc=null,jr.isAAC=null,jr.videoInfo={},jr.videoMeta={},jr.audioMeta={},jr.sourceBuffer=null,jr.audioSourceBuffer=null,jr.hasInit=!1,jr.hasAudioInit=!1,jr.isAudioInitInfo=!1,jr.videoMimeType="",jr.audioMimeType="",jr.cacheTrack={},jr.cacheAudioTrack={},jr.timeInit=!1,jr.sequenceNumber=0,jr.audioSequenceNumber=0,jr.firstRenderTime=null,jr.firstAudioTime=null,jr.mediaSourceAppendBufferFull=!1,jr.mediaSourceAppendBufferError=!1,jr.mediaSourceAddSourceBufferError=!1,jr.mediaSourceBufferError=!1,jr.mediaSourceError=!1,jr.prevTimestamp=null,jr.decodeDiffTimestamp=null,jr.prevDts=null,jr.prevAudioDts=null,jr.prevPayloadBufferSize=0,jr.isWidthOrHeightChanged=!1,jr.prevTs=null,jr.prevAudioTs=null,jr.eventListenList=[],jr.pendingRemoveRanges=[],jr.pendingSegments=[],jr.pendingAudioRemoveRanges=[],jr.pendingAudioSegments=[],jr.supportVideoFrameCallbackHandle=null,jr.audioSourceBufferCheckTimeout=null,jr.audioSourceNoDataCheckTimeout=null,jr.hasPendingEos=!1,jr.$video={currentTime:0,readyState:0}},init(){jr.events=new pn,jr._resetInIt(),jr.mediaSource=new self.MediaSource,jr.isDecodeFirstIIframe=!!vr(ii._opt.checkFirstIFrame),jr._bindMediaSourceEvents()},destroy(){jr.stop(),jr._clearAudioSourceBufferCheckTimeout(),jr.eventListenList&&jr.eventListenList.length&&(jr.eventListenList.forEach((e=>e())),jr.eventListenList=[]),jr._resetInIt(),jr.mediaSource=null},getState:()=>jr.mediaSource&&jr.mediaSource.readyState,isStateOpen:()=>jr.getState()===yt,isStateClosed:()=>jr.getState()===vt,isStateEnded:()=>jr.getState()===gt,_bindMediaSourceEvents(){const{proxy:e}=jr.events,t=e(jr.mediaSource,wt,(()=>{ii.debug.log(jr.TAG_NAME,"sourceOpen"),jr._onMediaSourceSourceOpen()})),r=e(jr.mediaSource,bt,(()=>{ii.debug.log(jr.TAG_NAME,"sourceClose")})),i=e(jr.mediaSource,St,(()=>{ii.debug.log(jr.TAG_NAME,"sourceended")}));jr.eventListenList.push(t,r,i)},_onMediaSourceSourceOpen(){jr.sourceBuffer||(ii.debug.log(jr.TAG_NAME,"onMediaSourceSourceOpen() sourceBuffer is null and next init"),jr._initSourceBuffer()),jr.audioSourceBuffer||(ii.debug.log(jr.TAG_NAME,"onMediaSourceSourceOpen() audioSourceBuffer is null and next init"),jr._initAudioSourceBuffer()),jr._hasPendingSegments()&&jr._doAppendSegments()},decodeVideo(e,t,r,i){if(ii.isDestroyed)ii.debug.warn(jr.TAG_NAME,"decodeVideo() and decoder is destroyed");else if(vr(jr.hasInit))if(r&&e[1]===xt){const i=15&e[0];if(i===Ie&&vr(ar()))return void jr.emitError(De.mediaSourceH265NotSupport);jr.videoInfo.codec=i,postMessage({cmd:M,code:i});const n=new Uint8Array(e);postMessage({cmd:R,buffer:n,codecId:i},[n.buffer]),jr.hasInit=jr._decodeConfigurationRecord(e,t,r,i)}else ii.debug.warn(jr.TAG_NAME,`decodeVideo has not init , isIframe is ${r} , payload is ${e[1]}`);else if(!jr.isDecodeFirstIIframe&&r&&(jr.isDecodeFirstIIframe=!0),jr.isDecodeFirstIIframe){if(r&&0===e[1]){const t=15&e[0];let r={};t===Fe?r=Tr(e.slice(5)):t===Ie&&(r=Vr(e));const i=jr.videoInfo;i&&i.codecWidth&&i.codecWidth&&r&&r.codecWidth&&r.codecHeight&&(r.codecWidth!==i.codecWidth||r.codecHeight!==i.codecWidth)&&(ii.debug.warn(jr.TAG_NAME,`\n decodeVideo: video width or height is changed,\n old width is ${i.codecWidth}, old height is ${i.codecWidth},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),jr.isWidthOrHeightChanged=!0,jr.emitError(De.mseWidthOrHeightChange))}if(jr.isWidthOrHeightChanged)return void ii.debug.warn(jr.TAG_NAME,"decodeVideo: video width or height is changed, and return");if(gr(e))return void ii.debug.warn(jr.TAG_NAME,"decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength300&&(jr.firstAudioTime-=e,ii.debug.warn(jr.TAG_NAME,`video\n firstAudioTime is ${jr.firstRenderTime} and current time is ${jr.prevTs}\n play time is ${e} and firstAudioTime ${t} - ${e} = ${jr.firstAudioTime}`))}r=t-jr.firstAudioTime,r<0&&(ii.debug.warn(jr.TAG_NAME,`decodeAudio\n local dts is < 0 , ts is ${t} and prevTs is ${jr.prevAudioTs},\n firstAudioTime is ${jr.firstAudioTime}`),r=null===jr.prevAudioDts?0:jr.prevAudioDts+ii._opt.mseCorrectAudioTimeDuration),null!==jr.prevAudioTs&&r<=jr.prevAudioDts&&(ii.debug.warn(jr.TAG_NAME,`\n decodeAudio dts is less than(or equal) prev dts ,\n dts is ${r} and prev dts is ${jr.prevAudioDts} ,\n and now ts is ${t} and prev ts is ${jr.prevAudioTs} ,\n and diff is ${t-jr.prevAudioTs}`),r=jr.prevAudioDts+ii._opt.mseCorrectAudioTimeDuration)}ii.isPlayer?jr._decodeAudio(e,r,t):ii.isPlayback,jr.prevAudioTs=t,jr.prevAudioDts=r}else ii.debug.log(jr.TAG_NAME,"decodeAudio first frame is not iFrame")}},_checkTsIsMaxDiff:e=>jr.prevTs>0&&eA,_decodeConfigurationRecord(e,t,r,i){let n=e.slice(5),o={};if(i===Fe?o=Tr(n):i===Ie&&(o=Wr(n)),jr.videoInfo.width=o.codecWidth,jr.videoInfo.height=o.codecHeight,0===o.codecWidth&&0===o.codecHeight)return ii.debug.warn(jr.TAG_NAME,"_decodeConfigurationRecord error",JSON.stringify(o)),jr.emitError(De.mediaSourceDecoderConfigurationError),!1;const s={id:Pt,type:"video",timescale:1e3,duration:0,avcc:n,codecWidth:o.codecWidth,codecHeight:o.codecHeight,videoType:o.videoType},a=mn.generateInitSegment(s);jr.isAvc=i===Fe;let d=o.codec;return jr.videoMimeType=d?`video/mp4; codecs="${o.codec}"`:jr.isAvc?ct:ft,postMessage({cmd:T,w:o.codecWidth,h:o.codecHeight}),jr._initSourceBuffer(),jr.appendBuffer(a.buffer),jr.sequenceNumber=0,jr.cacheTrack={},jr.timeInit=!1,!0},_decodeAudioConfigurationRecord(e,t){const r=e[0]>>4,i=e[0]>>1&1,n=r===Ge,o=r===ze;if(vr(o||n))return ii.debug.warn(jr.TAG_NAME,`_decodeAudioConfigurationRecord audio codec is not support , codecId is ${r} ant auto wasm decode`),jr.emitError(De.mediaSourceAudioG711NotSupport),!1;const s={id:Ft,type:"audio",timescale:1e3};let a={};if(jt(e)){if(a=Kt(e.slice(2)),!a)return!1;s.audioSampleRate=a.sampleRate,s.channelCount=a.channelCount,s.config=a.config,s.refSampleDuration=1024/s.audioSampleRate*s.timescale}else{if(!n)return!1;if(a=An(e),!a)return!1;s.audioSampleRate=a.samplingRate,s.channelCount=a.channelCount,s.refSampleDuration=1152/s.audioSampleRate*s.timescale}s.codec=a.codec,s.duration=0;let d="mp4",l=a.codec,u=null;n&&vr(sr())?(d="mpeg",l="",u=new Uint8Array):u=mn.generateInitSegment(s);let c=`${s.type}/${d}`;return l&&l.length>0&&(c+=`;codecs=${l}`),vr(jr.isAudioInitInfo)&&(Jt=r===ze?i?16:8:0===i?8:16,postMessage({cmd:F,code:r}),postMessage({cmd:P,sampleRate:s.audioSampleRate,channels:s.channelCount,depth:Jt}),jr.isAudioInitInfo=!0),jr.audioMimeType=c,jr.isAAC=o,jr._initAudioSourceBuffer(),jr.appendAudioBuffer(u.buffer),!0},_initSourceBuffer(){const{proxy:e}=jr.events;if(null===jr.sourceBuffer&&null!==jr.mediaSource&&jr.isStateOpen()&&jr.videoMimeType){try{jr.sourceBuffer=jr.mediaSource.addSourceBuffer(jr.videoMimeType),ii.debug.log(jr.TAG_NAME,"_initSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",jr.videoMimeType)}catch(e){return ii.debug.error(jr.TAG_NAME,"appendBuffer() mseDecoder.mediaSource.addSourceBuffer()",e.code,e),jr.emitError(De.mseAddSourceBufferError,e.code),void(jr.mediaSourceAddSourceBufferError=!0)}if(jr.sourceBuffer){const t=e(jr.sourceBuffer,"error",(e=>{jr.mediaSourceBufferError=!0,ii.debug.error(jr.TAG_NAME,"mseSourceBufferError mseDecoder.sourceBuffer",e),jr.emitError(De.mseSourceBufferError,e.code)})),r=e(jr.sourceBuffer,"updateend",(()=>{jr._hasPendingRemoveRanges()?jr._doRemoveRanges():jr._hasPendingSegments()?jr._doAppendSegments():jr.hasPendingEos&&(ii.debug.log(jr.TAG_NAME,"videoSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),jr.endOfStream())}));jr.eventListenList.push(t,r)}}else ii.debug.log(jr.TAG_NAME,`_initSourceBuffer and mseDecoder.isStateOpen is ${jr.isStateOpen()} and mseDecoder.isAvc === null is ${null===jr.isAvc}`)},_initAudioSourceBuffer(){const{proxy:e}=jr.events;if(null===jr.audioSourceBuffer&&null!==jr.mediaSource&&jr.isStateOpen()&&jr.audioMimeType){try{jr.audioSourceBuffer=jr.mediaSource.addSourceBuffer(jr.audioMimeType),jr._clearAudioSourceBufferCheckTimeout(),ii.debug.log(jr.TAG_NAME,"_initAudioSourceBuffer() mseDecoder.mediaSource.addSourceBuffer()",jr.audioMimeType)}catch(e){return ii.debug.error(jr.TAG_NAME,"appendAudioBuffer() mseDecoder.mediaSource.addSourceBuffer()",e.code,e),jr.emitError(De.mseAddSourceBufferError,e.code),void(jr.mediaSourceAddSourceBufferError=!0)}if(jr.audioSourceBuffer){const t=e(jr.audioSourceBuffer,"error",(e=>{jr.mediaSourceBufferError=!0,ii.debug.error(jr.TAG_NAME,"mseSourceBufferError mseDecoder.audioSourceBuffer",e),jr.emitError(De.mseSourceBufferError,e.code)})),r=e(jr.audioSourceBuffer,"updateend",(()=>{jr._hasPendingRemoveRanges()?jr._doRemoveRanges():jr._hasPendingSegments()?jr._doAppendSegments():jr.hasPendingEos&&(ii.debug.log(jr.TAG_NAME,"audioSourceBuffer updateend and hasPendingEos is true, next endOfStream()"),jr.endOfStream())}));jr.eventListenList.push(t,r),null===jr.audioSourceNoDataCheckTimeout&&(jr.audioSourceNoDataCheckTimeout=setTimeout((()=>{jr._clearAudioNoDataCheckTimeout(),jr.emitError(De.mediaSourceAudioNoDataTimeout)}),1e3))}}else ii.debug.log(jr.TAG_NAME,`_initAudioSourceBuffer and mseDecoder.isStateOpen is ${jr.isStateOpen()} and mseDecoder.audioMimeType is ${jr.audioMimeType}`)},_decodeVideo(e,t,r,i,n){let o=e.slice(5),s=o.byteLength;if(0===s)return void ii.debug.warn(jr.TAG_NAME,"_decodeVideo payload bytes is 0 and return");let a=(new Date).getTime(),d=!1;jr.prevTimestamp||(jr.prevTimestamp=a,d=!0);const l=a-jr.prevTimestamp;if(jr.decodeDiffTimestamp=l,l>500&&!d&&ii.isPlayer&&ii.debug.warn(jr.TAG_NAME,`_decodeVideo now time is ${a} and prev time is ${jr.prevTimestamp}, diff time is ${l} ms`),jr.cacheTrack.id&&t>=jr.cacheTrack.dts){let e=8+jr.cacheTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(mn.types.mdat,4),r.set(jr.cacheTrack.data,8),jr.cacheTrack.duration=t-jr.cacheTrack.dts;let i=mn.moof(jr.cacheTrack,jr.cacheTrack.dts);jr.cacheTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),jr.appendBuffer(n.buffer)}else ii.debug.log(jr.TAG_NAME,`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${n} cacheTrack dts is ${jr.cacheTrack&&jr.cacheTrack.dts}`),jr.timeInit=!1,jr.cacheTrack={};jr.cacheTrack||(jr.cacheTrack={}),jr.cacheTrack.id=Pt,jr.cacheTrack.sequenceNumber=++jr.sequenceNumber,jr.cacheTrack.size=s,jr.cacheTrack.dts=t,jr.cacheTrack.cts=i,jr.cacheTrack.isKeyframe=r,jr.cacheTrack.data=o,jr.cacheTrack.flags={isLeading:0,dependsOn:r?2:1,isDependedOn:r?1:0,hasRedundancy:0,isNonSync:r?0:1},jr.prevTimestamp=(new Date).getTime()},_decodeAudio(e,t,r){let i=jr.isAAC?e.slice(2):e.slice(1),n=i.byteLength;if(jr.cacheAudioTrack.id&&t>=jr.cacheAudioTrack.dts){let e=8+jr.cacheAudioTrack.size,r=new Uint8Array(e);r[0]=e>>>24&255,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=255&e,r.set(mn.types.mdat,4),r.set(jr.cacheAudioTrack.data,8),jr.cacheAudioTrack.duration=t-jr.cacheAudioTrack.dts;let i=mn.moof(jr.cacheAudioTrack,jr.cacheAudioTrack.dts);jr.cacheAudioTrack={};let n=new Uint8Array(i.byteLength+r.byteLength);n.set(i,0),n.set(r,i.byteLength),jr.appendAudioBuffer(n.buffer)}else jr.cacheAudioTrack={};jr.cacheAudioTrack||(jr.cacheAudioTrack={}),jr.cacheAudioTrack.id=Ft,jr.cacheAudioTrack.sequenceNumber=++jr.audioSequenceNumber,jr.cacheAudioTrack.size=n,jr.cacheAudioTrack.dts=t,jr.cacheAudioTrack.cts=0,jr.cacheAudioTrack.data=i,jr.cacheAudioTrack.flags={isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}},appendBuffer(e){ii.isDestroyed?ii.debug.warn(jr.TAG_NAME,"appendBuffer() player is destroyed"):jr.mediaSourceAddSourceBufferError?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):jr.mediaSourceAppendBufferFull?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):jr.mediaSourceAppendBufferError?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):jr.mediaSourceBufferError?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(jr.pendingSegments.push(e),jr.sourceBuffer&&(ii._opt.mseAutoCleanupSourceBuffer&&jr._needCleanupSourceBuffer()&&jr._doCleanUpSourceBuffer(),vr(jr.getSourceBufferUpdating())&&jr.isStateOpen()&&vr(jr._hasPendingRemoveRanges()))?jr._doAppendSegments():jr.isStateClosed()?(jr.mediaSourceBufferError=!0,jr.emitError(De.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):jr.isStateEnded()?(jr.mediaSourceBufferError=!0,jr.emitError(De.mseSourceBufferError,"mediaSource is end")):jr._hasPendingRemoveRanges()&&ii.debug.log(jr.TAG_NAME,`video has pending remove ranges and video length is ${jr.pendingRemoveRanges.length}, audio length is ${jr.pendingAudioRemoveRanges.length}`))},appendAudioBuffer(e){ii.isDestroyed?ii.debug.warn(jr.TAG_NAME,"appendAudioBuffer() player is destroyed"):jr.mediaSourceAddSourceBufferError?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceAddSourceBufferError is true"):jr.mediaSourceAppendBufferFull?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferFull is true"):jr.mediaSourceAppendBufferError?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceAppendBufferError is true"):jr.mediaSourceBufferError?ii.debug.warn(jr.TAG_NAME,"mseDecoder.mediaSourceBufferError is true"):(jr.pendingAudioSegments.push(e),jr.audioSourceBuffer&&(ii._opt.mseAutoCleanupSourceBuffer&&jr._needCleanupSourceBuffer()&&jr._doCleanUpSourceBuffer(),vr(jr.getAudioSourceBufferUpdating())&&jr.isStateOpen()&&vr(jr._hasPendingRemoveRanges()))?jr._doAppendSegments():jr.isStateClosed()?(jr.mediaSourceBufferError=!0,jr.emitError(De.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed")):jr.isStateEnded()?(jr.mediaSourceBufferError=!0,jr.emitError(De.mseSourceBufferError,"mediaSource is end")):jr._hasPendingRemoveRanges()&&ii.debug.log(jr.TAG_NAME,`audio has pending remove ranges and video length is ${jr.pendingRemoveRanges.length}, audio length is ${jr.pendingAudioRemoveRanges.length}`))},getSourceBufferUpdating:()=>jr.sourceBuffer&&jr.sourceBuffer.updating,getAudioSourceBufferUpdating:()=>jr.audioSourceBuffer&&jr.audioSourceBuffer.updating,stop(){jr.abortSourceBuffer(),jr.removeSourceBuffer(),jr.endOfStream()},clearUpAllSourceBuffer(){if(jr.sourceBuffer){const e=jr.sourceBuffer.buffered;for(let t=0;tjr.pendingSegments.length>0||jr.pendingAudioSegments.length>0,getPendingSegmentsLength:()=>jr.pendingSegments.length,_handleUpdatePlaybackRate(){},_doAppendSegments(){if(jr.isStateClosed()||jr.isStateEnded())ii.debug.log(jr.TAG_NAME,"_doAppendSegments() mediaSource is closed or ended and return");else if(null!==jr.sourceBuffer){if(jr.needInitAudio()&&null===jr.audioSourceBuffer)return ii.debug.log(jr.TAG_NAME,"_doAppendSegments() audioSourceBuffer is null and need init audio source buffer"),void(null===jr.audioSourceBufferCheckTimeout&&(jr.audioSourceBufferCheckTimeout=setTimeout((()=>{jr._clearAudioSourceBufferCheckTimeout(),jr.emitError(De.mediaSourceAudioInitTimeout)}),1e3)));if(vr(jr.getSourceBufferUpdating())&&jr.pendingSegments.length>0){const e=jr.pendingSegments.shift();try{jr.sourceBuffer.appendBuffer(e)}catch(e){ii.debug.error(jr.TAG_NAME,"mseDecoder.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(jr.stop(),jr.mediaSourceAppendBufferFull=!0,jr.emitError(De.mediaSourceFull)):11===e.code?(jr.stop(),jr.mediaSourceAppendBufferError=!0,jr.emitError(De.mediaSourceAppendBufferError)):(jr.stop(),jr.mediaSourceBufferError=!0,jr.emitError(De.mseSourceBufferError,e.code))}}if(vr(jr.getAudioSourceBufferUpdating())&&jr.pendingAudioSegments.length>0){const e=jr.pendingAudioSegments.shift();try{jr.audioSourceBuffer.appendBuffer(e)}catch(e){ii.debug.error(jr.TAG_NAME,"mseDecoder.audioSourceBuffer.appendBuffer()",e.code,e),22===e.code?(jr.stop(),jr.mediaSourceAppendBufferFull=!0,jr.emitError(De.mediaSourceFull)):11===e.code?(jr.stop(),jr.mediaSourceAppendBufferError=!0,jr.emitError(De.mediaSourceAppendBufferError)):(jr.stop(),jr.mediaSourceBufferError=!0,jr.emitError(De.mseSourceBufferError,e.code))}}}else ii.debug.log(jr.TAG_NAME,"_doAppendSegments() sourceBuffer is null and wait init and return")},_doCleanUpSourceBuffer(){const e=jr.$video.currentTime;if(jr.sourceBuffer){const t=jr.sourceBuffer.buffered;let r=!1;for(let i=0;i=ii._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-ii._opt.mseAutoCleanupMinBackwardDuration;jr.pendingRemoveRanges.push({start:n,end:t})}}else o=ii._opt.mseAutoCleanupMaxBackwardDuration){r=!0;let t=e-ii._opt.mseAutoCleanupMinBackwardDuration;jr.pendingAudioRemoveRanges.push({start:n,end:t})}}else ojr.pendingRemoveRanges.length>0||jr.pendingAudioRemoveRanges.length>0,needInitAudio:()=>ii._opt.hasAudio&&ii._opt.mseDecodeAudio,_doRemoveRanges(){if(jr.sourceBuffer&&vr(jr.getSourceBufferUpdating())){let e=jr.pendingRemoveRanges;for(;e.length&&vr(jr.getSourceBufferUpdating());){let t=e.shift();try{jr.sourceBuffer.remove(t.start,t.end)}catch(e){ii.debug.warn(jr.TAG_NAME,"_doRemoveRanges() sourceBuffer error",e)}}}if(jr.audioSourceBuffer&&vr(jr.getAudioSourceBufferUpdating())){let e=jr.pendingAudioRemoveRanges;for(;e.length&&vr(jr.getAudioSourceBufferUpdating());){let t=e.shift();try{jr.audioSourceBuffer.remove(t.start,t.end)}catch(e){ii.debug.warn(jr.TAG_NAME,"_doRemoveRanges() audioSourceBuffer error",e)}}}},_getPlaybackRate(){},_needCleanupSourceBuffer(){if(vr(ii._opt.mseAutoCleanupSourceBuffer))return!1;const e=jr.$video.currentTime;if(jr.sourceBuffer){let t=jr.sourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ii._opt.mseAutoCleanupMaxBackwardDuration)return!0}if(jr.audioSourceBuffer){let t=jr.audioSourceBuffer.buffered;if(t.length>=1&&e-t.start(0)>=ii._opt.mseAutoCleanupMaxBackwardDuration)return!0}return!1},_clearAudioSourceBufferCheckTimeout(){jr.audioSourceBufferCheckTimeout&&(clearTimeout(jr.audioSourceBufferCheckTimeout),jr.audioSourceBufferCheckTimeout=null)},_clearAudioNoDataCheckTimeout(){jr.audioSourceNoDataCheckTimeout&&(clearTimeout(jr.audioSourceNoDataCheckTimeout),jr.audioSourceNoDataCheckTimeout=null)},getHandle:()=>jr.mediaSource.handle,emitError(e){postMessage({cmd:ne,value:e,msg:arguments.length>1&&void 0!==arguments[1]?arguments[1]:""})}});let ii={isPlayer:!0,isPlayback:!1,dropping:!1,isPushDropping:!1,isWorkerFetch:!1,isDestroyed:!1,fetchStatus:Tt,_opt:Sr(),mp3Demuxer:null,delay:-1,pushLatestDelay:-1,firstTimestamp:null,startTimestamp:null,preDelayTimestamp:null,stopId:null,streamFps:null,streamAudioFps:null,streamVideoFps:null,writableStream:null,networkDelay:0,webglObj:null,startStreamRateAndStatsInterval:function(){ii.stopStreamRateAndStatsInterval(),l=setInterval((()=>{d&&d(0);const e=JSON.stringify({demuxBufferDelay:ii.getVideoBufferLength(),audioDemuxBufferDelay:ii.getAudioBufferLength(),streamBufferByteLength:ii.getStreamBufferLength(),netBuf:ii.networkDelay||0,pushLatestDelay:ii.pushLatestDelay||0,latestDelay:ii.delay,isStreamTsMoreThanLocal:be});postMessage({cmd:G,type:ke,value:e})}),1e3)},stopStreamRateAndStatsInterval:function(){l&&(clearInterval(l),l=null)},useOffscreen:function(){return ii._opt.useOffscreen&&"undefined"!=typeof OffscreenCanvas},getDelay:function(e,t){if(!e||ii._opt.hasVideo&&!U)return-1;if(t===oe)return ii.delay;if(ii.preDelayTimestamp&&ii.preDelayTimestamp>e)return ii.preDelayTimestamp-e>1e3&&ii.debug.warn("worker",`getDelay() and preDelayTimestamp is ${ii.preDelayTimestamp} > timestamp is ${e} more than ${ii.preDelayTimestamp-e}ms and return ${ii.delay}`),ii.preDelayTimestamp=e,ii.delay;if(ii.firstTimestamp){if(e){const t=Date.now()-ii.startTimestamp,r=e-ii.firstTimestamp;t>=r?(be=!1,ii.delay=t-r):(be=!0,ii.delay=r-t)}}else ii.firstTimestamp=e,ii.startTimestamp=Date.now(),ii.delay=-1;return ii.preDelayTimestamp=e,ii.delay},getDelayNotUpdateDelay:function(e,t){if(!e||ii._opt.hasVideo&&!U)return-1;if(t===oe)return ii.pushLatestDelay;if(ii.preDelayTimestamp&&ii.preDelayTimestamp-e>1e3)return ii.debug.warn("worker",`getDelayNotUpdateDelay() and preDelayTimestamp is ${ii.preDelayTimestamp} > timestamp is ${e} more than ${ii.preDelayTimestamp-e}ms and return -1`),-1;if(ii.firstTimestamp){let t=-1;if(e){const r=Date.now()-ii.startTimestamp,i=e-ii.firstTimestamp;r>=i?(be=!1,t=r-i):(be=!0,t=i-r)}return t}return-1},resetDelay:function(){ii.firstTimestamp=null,ii.startTimestamp=null,ii.delay=-1,ii.dropping=!1},resetAllDelay:function(){ii.resetDelay(),ii.preDelayTimestamp=null},doDecode:function(e){ii._opt.isEmitSEI&&e.type===se&&ii.isWorkerFetch&&ii.findSei(e.payload,e.ts),ii.isPlayUseMSEAndDecoderInWorker()?e.type===oe?ii._opt.mseDecodeAudio?jr.decodeAudio(e.payload,e.ts):e.decoder.decode(e.payload,e.ts):e.type===se&&jr.decodeVideo(e.payload,e.ts,e.isIFrame,e.cts):ii._opt.useWCS&&ii.useOffscreen()&&e.type===se&&o.decode?o.decode(e.payload,e.ts,e.cts):e.decoder.decode(e.payload,e.ts,e.isIFrame,e.cts)},decodeNext(e){if(0===i.length)return;const t=e.ts,n=i[0],o=e.type===se&&gr(e.payload);if(vr(r))o&&(ii.debug.log("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n isVideoSqeHeader is ${o}`),i.shift(),ii.doDecode(n));else{const r=n.ts-t,s=n.type===oe&&e.type===se;(r<=20||s||o)&&(ii.debug.log("worker",`decode data type is ${e.type} and\n ts is ${t} next data type is ${n.type} ts is ${n.ts}\n diff is ${r} and isVideoAndNextAudio is ${s} and isVideoSqeHeader is ${o}`),i.shift(),ii.doDecode(n))}},init:function(){ii.debug.log("worker","init and opt is",JSON.stringify(ii._opt));const e=ii._opt.playType===v,t=ii._opt.playType===b;if(Ar.init(),ii.isPlayer=e,ii.isPlayback=t,ii.isPlayUseMSEAndDecoderInWorker()&&jr&&jr.init(),ii.isPlaybackCacheBeforeDecodeForFpsRender())ii.debug.log("worker","playback and playbackIsCacheBeforeDecodeForFpsRender is true");else{ii.debug.log("worker","setInterval()");const t=ii._opt.videoBuffer+ii._opt.videoBufferDelay,r=()=>{let r=null;if(i.length){if(ii.isPushDropping)return void ii.debug.warn("worker",`loop() isPushDropping is true and bufferList length is ${i.length}`);if(ii.dropping){for(r=i.shift(),ii.debug.warn("worker",`loop() dropBuffer is dropping and isIFrame ${r.isIFrame} and delay is ${ii.delay} and bufferlist is ${i.length}`);!r.isIFrame&&i.length;)r=i.shift();const e=ii.getDelayNotUpdateDelay(r.ts,r.type);r.isIFrame&&e<=ii.getNotDroppingDelayTs()&&(ii.debug.log("worker","loop() is dropping = false, is iFrame"),ii.dropping=!1,ii.doDecode(r),ii.decodeNext(r))}else if(ii.isPlayback||ii.isPlayUseMSE()||0===ii._opt.videoBuffer)for(;i.length;)r=i.shift(),ii.doDecode(r);else if(r=i[0],-1===ii.getDelay(r.ts,r.type))ii.debug.log("worker","loop() common dumex delay is -1 ,data.ts is",r.ts),i.shift(),ii.doDecode(r),ii.decodeNext(r);else if(ii.delay>t&&e)ii.hasIframeInBufferList()?(ii.debug.log("worker",`delay is ${ii.delay} > maxDelay ${t}, set dropping is true`),ii.resetAllDelay(),ii.dropping=!0,postMessage({cmd:H})):(i.shift(),ii.doDecode(r),ii.decodeNext(r));else for(;i.length;){if(r=i[0],!(ii.getDelay(r.ts,r.type)>ii._opt.videoBuffer)){ii.delay<0&&ii.debug.warn("worker",`loop() do not decode and delay is ${ii.delay}, bufferList is ${i.length}`);break}i.shift(),ii.doDecode(r)}}else-1!==ii.delay&&ii.debug.log("worker","loop() bufferList is empty and reset delay"),ii.resetAllDelay()};ii.stopId=setInterval((()=>{let e=(new Date).getTime();we||(we=e);const t=e-we;t>100&&ii.debug.warn("worker",`loop demux diff time is ${t}`),r(),we=(new Date).getTime()}),20)}if(vr(ii._opt.checkFirstIFrame)&&(U=!0),ii.isPlayUseMSEAndDecoderInWorker()&&jr){const e=jr.getHandle();e&&postMessage({cmd:re,mseHandle:e},[e])}},playbackCacheLoop:function(){ii.stopId&&(clearInterval(ii.stopId),ii.stopId=null);const e=()=>{let e=null;i.length&&(e=i.shift(),ii.doDecode(e))};e();const t=Math.ceil(1e3/(ii.streamFps*ii._opt.playbackRate));ii.debug.log("worker",`playbackCacheLoop fragDuration is ${t}, streamFps is ${ii.streamFps}, streamAudioFps is ${ii.streamAudioFps} ,streamVideoFps is ${ii.streamVideoFps} playbackRate is ${ii._opt.playbackRate}`),ii.stopId=setInterval(e,t)},close:function(){if(ii.debug.log("worker","close"),ii.isDestroyed=!0,Er(),!a||1!==a.readyState&&2!==a.readyState?a&&ii.debug.log("worker",`close() and socket.readyState is ${a.readyState}`):(nr=!0,a.close(1e3,"Client disconnecting")),a=null,ii.stopStreamRateAndStatsInterval(),ii.stopId&&(clearInterval(ii.stopId),ii.stopId=null),ii.mp3Demuxer&&(ii.mp3Demuxer.destroy(),ii.mp3Demuxer=null),ii.writableStream&&vr(ii.writableStream.locked)&&ii.writableStream.close().catch((e=>{ii.debug.log("worker","close() and writableStream.close() error",e)})),ii.writableStream=null,ni)try{ni.clear&&ni.clear(),ni=null}catch(e){ii.debug.warn("worker","close() and audioDecoder.clear error",e)}if(oi)try{oi.clear&&oi.clear(),oi=null}catch(e){ii.debug.warn("worker","close() and videoDecoder.clear error",e)}d=null,we=null,be=!1,o&&(o.reset&&o.reset(),o=null),jr&&(jr.destroy(),jr=null),ii.firstTimestamp=null,ii.startTimestamp=null,ii.networkDelay=0,ii.streamFps=null,ii.streamAudioFps=null,ii.streamVideoFps=null,ii.delay=-1,ii.pushLatestDelay=-1,ii.preDelayTimestamp=null,ii.dropping=!1,ii.isPushDropping=!1,ii.isPlayer=!0,ii.isPlayback=!1,ii.isWorkerFetch=!1,ii._opt=Sr(),ii.webglObj&&(ii.webglObj.destroy(),ii.offscreenCanvas.removeEventListener("webglcontextlost",ii.onOffscreenCanvasWebglContextLost),ii.offscreenCanvas.removeEventListener("webglcontextrestored",ii.onOffscreenCanvasWebglContextRestored),ii.offscreenCanvas=null,ii.offscreenCanvasGL=null,ii.offscreenCanvasCtx=null),i=[],n=[],u&&(u.buffer=null,u=null),f=null,h=null,S=!1,E=!1,U=!1,Ot=!1,Gt=!1,$t=!1,Ht=null,Yt=null,st=[],mt=0,_t=0,Ve=null,Xe=null,Et=null,At=null,Jt=null,Ut=0,Nt=0,ht=null,pt=null,ii.fetchStatus=Tt,wr=!0,Ar.destroy(),kr.destroy(),Gr.destroy(),$r.destroy(),postMessage({cmd:Y})},pushBuffer:function(e,t){if(t.type===oe&&jt(e)){if(ii.debug.log("worker",`pushBuffer audio ts is ${t.ts}, isAacCodecPacket is true`),ii._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:J,buffer:t},[t.buffer])}ii.decodeAudio(e,t.ts)}else if(t.type===se&&t.isIFrame&&gr(e)){if(ii.debug.log("worker",`pushBuffer video ts is ${t.ts}, isVideoSequenceHeader is true`),ii._opt.isRecordTypeFlv){const t=new Uint8Array(e);postMessage({cmd:Q,buffer:t},[t.buffer])}ii.decodeVideo(e,t.ts,t.isIFrame,t.cts)}else{if(ii._opt.isRecording)if(ii._opt.isRecordTypeFlv){const r=new Uint8Array(e);postMessage({cmd:ee,type:t.type,buffer:r,ts:t.ts},[r.buffer])}else if(ii._opt.recordType===w)if(t.type===se){const r=new Uint8Array(e).slice(5);postMessage({cmd:z,buffer:r,isIFrame:t.isIFrame,ts:t.ts,cts:t.cts},[r.buffer])}else if(t.type===oe&&ii._opt.isWasmMp4){const r=new Uint8Array(e),i=qt(r)?r.slice(2):r.slice(1);postMessage({cmd:I,buffer:i,ts:t.ts},[i.buffer])}if(ii.isPlayer&&Ut>0&&At>0&&t.type===se){const e=t.ts-At,r=Ut+Ut/2;e>r&&ii.debug.log("worker",`pushBuffer video\n ts is ${t.ts}, preTimestamp is ${At},\n diff is ${e} and preTimestampDuration is ${Ut} and maxDiff is ${r}\n maybe trigger black screen or flower screen\n `)}if(ii.isPlayer&&At>0&&t.type===se&&t.tsA&&(ii.debug.warn("worker",`pushBuffer,\n preTimestamp is ${At}, options.ts is ${t.ts},\n diff is ${At-t.ts} more than 3600000,\n and resetAllDelay`),ii.resetAllDelay(),At=null,Ut=0),ii.isPlayer&&At>0&&t.ts<=At&&t.type===se&&(ii.debug.warn("worker",`pushBuffer() and isIFrame is ${t.isIFrame} and,\n options.ts is ${t.ts} less than (or equal) preTimestamp is ${At} and\n payloadBufferSize is ${e.byteLength} and prevPayloadBufferSize is ${Nt}`),ii._opt.isDropSameTimestampGop&&vr(t.isIFrame)&&U)){const e=ii.hasIframeInBufferList(),t=vr(ii.isPushDropping);return ii.debug.log("worker",`pushBuffer, isDropSameTimestampGop is true and\n hasIframe is ${e} and isNotPushDropping is ${t} and next dropBuffer`),void(e&&t?ii.dropBuffer$2():(ii.clearBuffer(!0),yr(ii._opt.checkFirstIFrame)&&yr(r)&&(ii.isPlayUseMSEAndDecoderInWorker()?jr.isDecodeFirstIIframe=!1:postMessage({cmd:te}))))}if(ii.isPlayer&&U){const e=ii._opt.videoBuffer+ii._opt.videoBufferDelay,r=ii.getDelayNotUpdateDelay(t.ts,t.type);ii.pushLatestDelay=r,r>e&&ii.delay0&&ii.hasIframeInBufferList()&&!1===ii.isPushDropping&&(ii.debug.log("worker",`pushBuffer(), pushLatestDelay is ${r} more than ${e} and decoder.delay is ${ii.delay} and has iIframe and next decoder.dropBuffer$2()`),ii.dropBuffer$2())}if(ii.isPlayer&&t.type===se&&(At>0&&(Ut=t.ts-At),Nt=e.byteLength,At=t.ts),t.type===oe?i.push({ts:t.ts,payload:e,decoder:{decode:ii.decodeAudio},type:oe,isIFrame:!1}):t.type===se&&i.push({ts:t.ts,cts:t.cts,payload:e,decoder:{decode:ii.decodeVideo},type:se,isIFrame:t.isIFrame}),ii.isPlaybackCacheBeforeDecodeForFpsRender()&&(dr(ii.streamVideoFps)||dr(ii.streamAudioFps))){let e=ii.streamVideoFps,t=ii.streamAudioFps;if(dr(ii.streamVideoFps)&&(e=pr(i,se),e&&(ii.streamVideoFps=e,postMessage({cmd:V,value:ii.streamVideoFps}),ii.streamFps=t?e+t:e,vr(ii._opt.hasAudio)&&(ii.debug.log("worker","playbackCacheBeforeDecodeForFpsRender, _opt.hasAudio is false and set streamAudioFps is 0"),ii.streamAudioFps=0),ii.playbackCacheLoop())),dr(ii.streamAudioFps)&&(t=pr(i,oe),t&&(ii.streamAudioFps=t,ii.streamFps=e?e+t:t,ii.playbackCacheLoop())),dr(ii.streamVideoFps)&&dr(ii.streamAudioFps)){const r=i.map((e=>({type:e.type,ts:e.ts})));ii.debug.log("worker",`playbackCacheBeforeDecodeForFpsRender, calc streamAudioFps is ${t}, streamVideoFps is ${e}, bufferListLength is ${i.length}, and ts list is ${JSON.stringify(r)}`)}const r=ii.getAudioBufferLength()>0,n=r?60:40;i.length>=n&&(ii.debug.warn("worker",`playbackCacheBeforeDecodeForFpsRender, bufferListLength is ${i.length} more than ${n}, and hasAudio is ${r} an set streamFps is 25`),ii.streamVideoFps=25,postMessage({cmd:V,value:ii.streamVideoFps}),r?(ii.streamAudioFps=25,ii.streamFps=ii.streamVideoFps+ii.streamAudioFps):ii.streamFps=ii.streamVideoFps,ii.playbackCacheLoop())}}},getVideoBufferLength(){let e=0;return i.forEach((t=>{t.type===se&&(e+=1)})),e},hasIframeInBufferList:()=>i.some((e=>e.type===se&&e.isIFrame)),isAllIframeInBufferList(){const e=ii.getVideoBufferLength();let t=0;return i.forEach((e=>{e.type===se&&e.isIFrame&&(t+=1)})),e===t},getNotDroppingDelayTs:()=>ii._opt.videoBuffer+ii._opt.videoBufferDelay/2,getAudioBufferLength(){let e=0;return i.forEach((t=>{t.type===oe&&(e+=1)})),e},getStreamBufferLength(){let e=0;return u&&u.buffer&&(e=u.buffer.byteLength),ii._opt.isNakedFlow?Ar.lastBuf&&(e=Ar.lastBuf.byteLength):ii._opt.isTs?$r._remainingPacketData&&(e=$r._remainingPacketData.byteLength):ii._opt.isFmp4&&kr.mp4Box&&(e=kr.mp4Box.getAllocatedSampleDataSize()),e},fetchStream:function(e,t){ii.debug.log("worker","fetchStream, url is "+e,"options:",JSON.stringify(t)),ii.isWorkerFetch=!0,t.isFlv?ii._opt.isFlv=!0:t.isFmp4?ii._opt.isFmp4=!0:t.isMpeg4?ii._opt.isMpeg4=!0:t.isNakedFlow?ii._opt.isNakedFlow=!0:t.isTs&&(ii._opt.isTs=!0),d=or((e=>{postMessage({cmd:G,type:Ee,value:e})})),ii.startStreamRateAndStatsInterval(),t.isFmp4&&(kr.listenMp4Box(),ii._opt.isFmp4Private&&kr.initTransportDescarmber()),t.protocol===_?(u=new Br(ii.demuxFlv()),fetch(e,{signal:s.signal}).then((e=>{if(yr(nr))return ii.debug.log("worker","request abort and run res.body.cancel()"),ii.fetchStatus=Tt,void e.body.cancel();if(!mr(e))return ii.debug.warn("worker",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),Er(),void postMessage({cmd:G,type:De.fetchError,value:`fetch response status is ${e.status} and ok is ${e.ok}`});if(postMessage({cmd:G,type:Ue}),fr())ii.writableStream=new WritableStream({write:e=>s&&s.signal&&s.signal.aborted?(ii.debug.log("worker","writableStream write() and abortController.signal.aborted is true so return"),void(ii.fetchStatus=Dt)):yr(nr)?(ii.debug.log("worker","writableStream write() and requestAbort is true so return"),void(ii.fetchStatus=Dt)):void("string"!=typeof e?(ii.fetchStatus=Ct,d(e.byteLength),t.isFlv?u.write(e):t.isFmp4?ii.demuxFmp4(e):t.isMpeg4?ii.demuxMpeg4(e):t.isTs&&ii.demuxTs(e)):ii.debug.warn("worker",`writableStream write() and value is "${e}" string so return`)),close:()=>{ii.debug.log("worker","writableStream close()"),ii.fetchStatus=Dt,u=null,Er(),postMessage({cmd:G,type:Se,value:g,msg:"fetch done"})},abort:e=>{if(s&&s.signal&&s.signal.aborted)return ii.debug.log("worker","writableStream abort() and abortController.signal.aborted is true so return"),void(ii.fetchStatus=Dt);u=null,e.name!==Bt?(ii.debug.log("worker",`writableStream abort() and e is ${e.toString()}`),Er(),postMessage({cmd:G,type:De.fetchError,value:e.toString()})):ii.debug.log("worker","writableStream abort() and e.name is AbortError so return")}}),e.body.pipeTo(ii.writableStream);else{const r=e.body.getReader(),i=()=>{r.read().then((e=>{let{done:r,value:n}=e;return r?(ii.debug.log("worker","fetchNext().then() and done is true"),ii.fetchStatus=Dt,u=null,Er(),void postMessage({cmd:G,type:Se,value:g,msg:"fetch done"})):s&&s.signal&&s.signal.aborted?(ii.debug.log("worker","fetchNext().then() and abortController.signal.aborted is true so return"),void(ii.fetchStatus=Dt)):yr(nr)?(ii.debug.log("worker","fetchNext().then() and requestAbort is true so return"),void(ii.fetchStatus=Dt)):void("string"!=typeof n?(ii.fetchStatus=Ct,d(n.byteLength),t.isFlv?u.write(n):t.isFmp4?ii.demuxFmp4(n):t.isMpeg4&&ii.demuxMpeg4(n),i()):ii.debug.warn("worker",`fetchNext().then() and value "${n}" is string so return`))})).catch((e=>{if(s&&s.signal&&s.signal.aborted)return ii.debug.log("worker","fetchNext().catch() and abortController.signal.aborted is true so return"),void(ii.fetchStatus=Dt);u=null,e.name!==Bt?(ii.debug.log("worker",`fetchNext().catch() and e is ${e.toString()}`),Er(),postMessage({cmd:G,type:De.fetchError,value:e.toString()})):ii.debug.log("worker","fetchNext().catch() and e.name is AbortError so return")}))};i()}})).catch((e=>{s&&s.signal&&s.signal.aborted?ii.debug.log("worker","fetch().catch() and abortController.signal.aborted is true so return"):e.name!==Bt?(ii.debug.log("worker",`fetch().catch() and e is ${e.toString()}`),Er(),postMessage({cmd:G,type:De.fetchError,value:e.toString()}),u=null):ii.debug.log("worker","fetch().catch() and e.name is AbortError so return")}))):t.protocol===m&&(t.isFlv&&(u=new Br(ii.demuxFlv())),a=new WebSocket(e),a.binaryType="arraybuffer",a.onopen=()=>{ii.debug.log("worker","fetchStream, WebsocketStream socket open"),postMessage({cmd:G,type:Ue}),postMessage({cmd:G,type:Ce})},a.onclose=e=>{c?ii.debug.log("worker","fetchStream, WebsocketStream socket close and isSocketError is true , so return"):(ii.debug.log("worker",`fetchStream, WebsocketStream socket close and code is ${e.code}`),1006===e.code&&ii.debug.error("worker",`fetchStream, WebsocketStream socket close abnormally and code is ${e.code}`),yr(nr)?ii.debug.log("worker","fetchStream, WebsocketStream socket close and requestAbort is true so return"):(u=null,postMessage({cmd:G,type:Se,value:y,msg:e.code})))},a.onerror=e=>{ii.debug.error("worker","fetchStream, WebsocketStream socket error",e),c=!0,u=null,postMessage({cmd:G,type:De.websocketError,value:e.isTrusted?"websocket user aborted":"websocket error"})},a.onmessage=e=>{"string"!=typeof e.data?(d(e.data.byteLength),t.isFlv?u.write(e.data):t.isFmp4?ii.demuxFmp4(e.data):t.isMpeg4?ii.demuxMpeg4(e.data):ii._opt.isNakedFlow?ii.demuxNakedFlow(e.data):ii.demuxM7s(e.data)):ii.debug.warn("worker",`socket on message is string "${e.data}" and return`)})},demuxFlv:function*(){yield 9;const e=new ArrayBuffer(4),t=new Uint8Array(e),r=new Uint32Array(e);for(;;){t[3]=0;const e=yield 15,i=e[4];t[0]=e[7],t[1]=e[6],t[2]=e[5];const n=r[0];t[0]=e[10],t[1]=e[9],t[2]=e[8],t[3]=e[11];let o=r[0];const s=(yield n).slice();switch(i){case ae:if(s.byteLength>0){let e=s;yr(ii._opt.m7sCryptoAudio)&&(e=ii.cryptoPayloadAudio(s)),ii.decode(e,{type:oe,ts:o})}else ii.debug.warn("worker",`demuxFlv() type is audio and payload.byteLength is ${s.byteLength} and return`);break;case de:if(s.byteLength>=6){const e=s[0];if(ii._isEnhancedH265Header(e))ii._decodeEnhancedH265Video(s,o);else{s[0];let e=s[0]>>4===kt;if(e&&gr(s)&&null===Ht){const e=15&s[0];Ht=e===Ie,Yt=tr(s,Ht),ii.debug.log("worker",`demuxFlv() isVideoSequenceHeader is true and isHevc is ${Ht} and nalUnitSize is ${Yt}`)}e&&ii.calcIframeIntervalTimestamp(o),ii.isPlayer&&ii.calcNetworkDelay(o),r[0]=s[4],r[1]=s[3],r[2]=s[2],r[3]=0;let t=r[0],i=ii.cryptoPayload(s,e);ii.decode(i,{type:se,ts:o,isIFrame:e,cts:t})}}else ii.debug.warn("worker",`demuxFlv() type is video and payload.byteLength is ${s.byteLength} and return`);break;case le:postMessage({cmd:Z,buffer:s},[s.buffer]);break;default:ii.debug.log("worker",`demuxFlv() type is ${i}`)}}},decode:function(e,t){t.type===oe?ii._opt.hasAudio&&(postMessage({cmd:G,type:Ae,value:e.byteLength}),ii.isPlayer?ii.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts}):ii.isPlayback&&(ii.isPlaybackOnlyDecodeIFrame()||(ii.isPlaybackCacheBeforeDecodeForFpsRender(),ii.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts})))):t.type===se&&ii._opt.hasVideo&&(postMessage({cmd:G,type:Be,value:e.byteLength}),postMessage({cmd:G,type:xe,value:t.ts}),ii.isPlayer?ii.pushBuffer(e,{type:t.type,ts:t.ts,isIFrame:t.isIFrame,cts:t.cts}):ii.isPlayback&&(ii.isPlaybackOnlyDecodeIFrame()?t.isIFrame&&ii.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}):(ii.isPlaybackCacheBeforeDecodeForFpsRender(),ii.pushBuffer(e,{type:t.type,ts:t.ts,cts:t.cts,isIFrame:t.isIFrame}))))},cryptoPayload:function(e,t){let r=e;return ii._opt.isM7sCrypto?ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength>0&&ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength>0?r=zi(e,ii._opt.cryptoKey,ii._opt.cryptoIV,Ht):ii.debug.error("worker",`isM7sCrypto cryptoKey.length is ${ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength} or cryptoIV.length is ${ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength} null`):ii._opt.isSm4Crypto?ii._opt.sm4CryptoKey&&t?r=sn(e,ii._opt.sm4CryptoKey):ii._opt.sm4CryptoKey||ii.debug.error("worker","isSm4Crypto opt.sm4CryptoKey is null"):ii._opt.isXorCrypto&&(ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength>0&&ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength>0?r=fn(e,ii._opt.cryptoKey,ii._opt.cryptoIV,Ht):ii.debug.error("worker",`isXorCrypto cryptoKey.length is ${ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength} or cryptoIV.length is ${ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength} null`)),r},cryptoPayloadAudio:function(e){let t=e;return ii._opt.isM7sCrypto&&(ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength>0&&ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength>0?e[0]>>4===ze&&(t=Ni(e,ii._opt.cryptoKey,ii._opt.cryptoIV)):ii.debug.error("worker",`isM7sCrypto cryptoKey.length is ${ii._opt.cryptoKey&&ii._opt.cryptoKey.byteLength} or cryptoIV.length is ${ii._opt.cryptoIV&&ii._opt.cryptoIV.byteLength} null`)),t},setCodecAudio:function(e,t){const r=e[0]>>4,i=e[0]>>1&1;if(Jt=r===ze?i?16:8:0===i?8:16,ni&&ni.setCodec)if(jt(e)||r===Ne||r===Oe||r===Ge){ii.debug.log("worker",`setCodecAudio: init audio codec, codeId is ${r}`);const i=r===ze?e.slice(2):new Uint8Array(0);ni.setCodec(r,ii._opt.sampleRate,i),r===ze&&postMessage({cmd:L,buffer:i},[i.buffer]),E=!0,r!==ze&&(r===Ge?(ii.mp3Demuxer||(ii.mp3Demuxer=new ln(ii),ii.mp3Demuxer.on("data",((e,t)=>{ni.decode(e,t)}))),ii.mp3Demuxer.dispatch(e.slice(1),t)):ni.decode(e.slice(1),t))}else ii.debug.warn("worker","setCodecAudio: hasInitAudioCodec is false, codecId is ",r);else ii.debug.error("worker","setCodecAudio: audioDecoder or audioDecoder.setCodec is null")},decodeAudio:function(e,t){if(ii.isDestroyed)ii.debug.log("worker","decodeAudio, decoder is destroyed and return");else if(ii.isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio())jr.decodeAudio(e,t);else if(yr(r)&&yr(ii._opt.mseDecodeAudio))postMessage({cmd:O,payload:e,ts:t,cts:t},[e.buffer]);else{const r=e[0]>>4;if(E){if(jt(e))return void ii.debug.log("worker","decodeAudio and has already initialized and payload is aac codec packet so drop this frame");r===Ge?ii.mp3Demuxer.dispatch(e.slice(1),t):ni.decode(r===ze?e.slice(2):e.slice(1),t)}else ii.setCodecAudio(e,t)}},setCodecVideo:function(e){const t=15&e[0];if(oi&&oi.setCodec)if(gr(e))if(t===Fe||t===Ie){ii.debug.log("worker",`setCodecVideo: init video codec , codecId is ${t}`);const r=e.slice(5);if(t===Fe&&ii._opt.useSIMD){const e=Tr(r);if(e.codecWidth>B||e.codecHeight>B)return postMessage({cmd:q}),void ii.debug.warn("worker",`setCodecVideo: SIMD H264 decode video width is too large, width is ${e.codecWidth}, height is ${e.codecHeight}`)}const i=new Uint8Array(e);S=!0,oi.setCodec(t,r),postMessage({cmd:M,code:t}),postMessage({cmd:R,buffer:i,codecId:t},[i.buffer])}else ii.debug.warn("worker",`setCodecVideo: hasInitVideoCodec is false, codecId is ${t} is not H264 or H265`);else ii.debug.warn("worker",`decodeVideo: hasInitVideoCodec is false, codecId is ${t} and frameType is ${e[0]>>4} and packetType is ${e[1]}`);else ii.debug.error("worker","setCodecVideo: videoDecoder or videoDecoder.setCodec is null")},decodeVideo:function(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(ii.isDestroyed)ii.debug.log("worker","decodeVideo, decoder is destroyed and return");else if(ii.isPlayUseMSEAndDecoderInWorker())jr.decodeVideo(e,t,i,n);else if(yr(r))postMessage({cmd:N,payload:e,isIFrame:i,ts:t,cts:n,delay:ii.delay},[e.buffer]);else if(S)if(!U&&i&&(U=!0),U){if(i&&gr(e)){const t=15&e[0];let r={};t===Fe?r=Tr(e.slice(5)):t===Ie&&(r=Vr(e)),r.codecWidth&&r.codecHeight&&f&&h&&(r.codecWidth!==f||r.codecHeight!==h)&&(ii.debug.warn("worker",`\n decodeVideo: video width or height is changed,\n old width is ${f}, old height is ${h},\n new width is ${r.codecWidth}, new height is ${r.codecHeight},\n and emit change event`),Gt=!0,postMessage({cmd:W}))}if(Gt)return void ii.debug.warn("worker","decodeVideo: video width or height is changed, and return");if($t)return void ii.debug.warn("worker","decodeVideo: simd decode error, and return");if(gr(e))return void ii.debug.warn("worker","decodeVideo and payload is video sequence header so drop this frame");if(e.byteLength0&&void 0!==arguments[0]&&arguments[0];ii.debug.log("worker",`clearBuffer,bufferList length is ${i.length}, need clear is ${e}`),e&&(i=[]),ii.isPlayer&&(ii.resetAllDelay(),yr(ii._opt.checkFirstIFrame)&&(ii.dropping=!0,postMessage({cmd:H}))),yr(ii._opt.checkFirstIFrame)&&vr(r)&&(U=!1)},dropBuffer$2:function(){if(i.length>0){let e=i.findIndex((e=>yr(e.isIFrame)&&e.type===se));if(ii.isAllIframeInBufferList())for(let t=0;t=ii.getNotDroppingDelayTs()){ii.debug.log("worker",`dropBuffer$2() isAllIframeInBufferList() is true, and index is ${t} and tempDelay is ${n} and notDroppingDelayTs is ${ii.getNotDroppingDelayTs()}`),e=t;break}}if(e>=0){ii.isPushDropping=!0,postMessage({cmd:H});const t=i.length;i=i.slice(e);const r=i.shift();ii.resetAllDelay(),ii.getDelay(r.ts,r.type),ii.doDecode(r),ii.isPushDropping=!1,ii.debug.log("worker",`dropBuffer$2() iFrameIndex is ${e},and old bufferList length is ${t} ,new bufferList is ${i.length} and new delay is ${ii.delay} `)}else ii.isPushDropping=!1}0===i.length&&(ii.isPushDropping=!1)},demuxM7s:function(e){const t=new DataView(e),r=t.getUint32(1,!1),i=t.getUint8(0),n=new ArrayBuffer(4),o=new Uint32Array(n);switch(i){case oe:ii.decode(new Uint8Array(e,5),{type:oe,ts:r});break;case se:if(t.byteLength>=11){const i=new Uint8Array(e,5),n=i[0];if(ii._isEnhancedH265Header(n))ii._decodeEnhancedH265Video(i,r);else{const e=t.getUint8(5)>>4==1;if(e&&(ii.calcIframeIntervalTimestamp(r),gr(i)&&null===Ht)){const e=15&i[0];Ht=e===Ie}ii.isPlayer&&ii.calcNetworkDelay(r),o[0]=i[4],o[1]=i[3],o[2]=i[2],o[3]=0;let n=o[0],s=ii.cryptoPayload(i,e);ii.decode(s,{type:se,ts:r,isIFrame:e,cts:n})}}else ii.debug.warn("worker",`demuxM7s() type is video and arrayBuffer length is ${e.byteLength} and return`)}},demuxNakedFlow:function(e){Ar.dispatch(e)},demuxFmp4:function(e){kr.dispatch(e)},demuxMpeg4:function(e){Gr.dispatch(e)},demuxTs:function(e){$r.dispatch(e)},_decodeEnhancedH265Video:function(e,t){const r=e[0],i=48&r,n=15&r,o=e.slice(1,5),s=new ArrayBuffer(4),a=new Uint32Array(s),d="a"==String.fromCharCode(o[0]);if(Ht=vr(d),n===Lt){if(i===zt){const r=e.slice(5);if(d);else{const i=new Uint8Array(5+r.length);i.set([28,0,0,0,0],0),i.set(r,5),Yt=tr(e,Ht),ii.debug.log("worker",`demuxFlv() isVideoSequenceHeader(enhancedH265) is true and isHevc is ${Ht} and nalUnitSize is ${Yt}`),ii.decode(i,{type:se,ts:t,isIFrame:!0,cts:0})}}}else if(n===Mt){let r=e,n=0;const o=i===zt;o&&ii.calcIframeIntervalTimestamp(t),d||(a[0]=e[4],a[1]=e[3],a[2]=e[2],a[3]=0,n=a[0],r=Kr(e.slice(8),o),r=ii.cryptoPayload(r,o),ii.decode(r,{type:se,ts:t,isIFrame:o,cts:n}))}else if(n===Rt){const r=i===zt;r&&ii.calcIframeIntervalTimestamp(t);let n=Kr(e.slice(5),r);n=ii.cryptoPayload(n,r),ii.decode(n,{type:se,ts:t,isIFrame:r,cts:0})}},_isEnhancedH265Header:function(e){return(e&It)===It},findSei:function(e,t){let r=4;lr(Yt)&&(r=Yt),Qt(e.slice(5),r).forEach((e=>{const r=Ht?e[0]>>>1&63:31&e[0];(Ht&&(r===dt||r===at)||vr(Ht)&&r===qe)&&postMessage({cmd:X,buffer:e,ts:t},[e.buffer])}))},calcNetworkDelay:function(e){if(!(U&&e>0))return;null===Ve?(Ve=e,Xe=rr()):et?r-t:0;ii.networkDelay=i,i>ii._opt.networkDelay&&ii._opt.playType===v&&(ii.debug.warn("worker",`calcNetworkDelay now dts:${e}, start dts is ${Ve} vs start is ${t},local diff is ${r} ,delay is ${i}`),postMessage({cmd:G,type:Te,value:i}))},calcIframeIntervalTimestamp:function(e){null===Et?Et=e:Et=ii._opt.playbackForwardMaxRateDecodeIFrame},isPlayUseMSE:function(){return ii.isPlayer&&ii._opt.useMSE&&yr(r)},isPlayUseMSEAndDecoderInWorker:function(){return ii.isPlayUseMSE()&&ii._opt.mseDecoderUseWorker},isPlayUseMSEAndDecoderInWorkerAndMseDecodeAudio:function(){return ii.isPlayUseMSEAndDecoderInWorker()&&ii._opt.mseDecodeAudio},playbackUpdatePlaybackRate:function(){ii.clearBuffer(!0)},onOffscreenCanvasWebglContextLost:function(e){ii.debug.error("worker","handleOffscreenCanvasWebglContextLost and next try to create webgl"),e.preventDefault(),Ot=!0,ii.webglObj.destroy(),ii.webglObj=null,ii.offscreenCanvasGL=null,setTimeout((()=>{ii.offscreenCanvasGL=ii.offscreenCanvas.getContext("webgl"),ii.offscreenCanvasGL&&ii.offscreenCanvasGL.getContextAttributes().stencil?(ii.webglObj=p(ii.offscreenCanvasGL,ii._opt.openWebglAlignment),Ot=!1):ii.debug.error("worker","handleOffscreenCanvasWebglContextLost, stencil is false")}),500)},onOffscreenCanvasWebglContextRestored:function(e){ii.debug.log("worker","handleOffscreenCanvasWebglContextRestored"),e.preventDefault()},videoInfo:function(e,t,r){postMessage({cmd:M,code:e}),postMessage({cmd:T,w:t,h:r}),f=t,h=r,ii.useOffscreen()&&(ii.offscreenCanvas=new OffscreenCanvas(t,r),ii.offscreenCanvasGL=ii.offscreenCanvas.getContext("webgl"),ii.webglObj=p(ii.offscreenCanvasGL,ii._opt.openWebglAlignment),ii.offscreenCanvas.addEventListener("webglcontextlost",ii.onOffscreenCanvasWebglContextLost,!1),ii.offscreenCanvas.addEventListener("webglcontextrestored",ii.onOffscreenCanvasWebglContextRestored,!1))},audioInfo:function(e,t,r){postMessage({cmd:F,code:e}),postMessage({cmd:P,sampleRate:t,channels:r,depth:Jt}),_t=r},yuvData:function(t,r){if(ii.isDestroyed)return void ii.debug.log("worker","yuvData, decoder is destroyed and return");const i=f*h*3/2;let n=e.HEAPU8.subarray(t,t+i),o=new Uint8Array(n);if(ht=null,ii.useOffscreen())try{if(Ot)return;ii.webglObj.renderYUV(f,h,o);let e=ii.offscreenCanvas.transferToImageBitmap();postMessage({cmd:C,buffer:e,delay:ii.delay,ts:r},[e])}catch(e){ii.debug.error("worker","yuvData, transferToImageBitmap error is",e)}else postMessage({cmd:C,output:o,delay:ii.delay,ts:r},[o.buffer])},pcmData:function(e,r,i){if(ii.isDestroyed)return void ii.debug.log("worker","pcmData, decoder is destroyed and return");let o=r,s=[],a=0,d=ii._opt.audioBufferSize;for(let r=0;r<2;r++){let i=t.HEAPU32[(e>>2)+r]>>2;s[r]=t.HEAPF32.subarray(i,i+o)}if(mt){if(!(o>=(r=d-mt)))return mt+=o,n[0]=Float32Array.of(...n[0],...s[0]),void(2==_t&&(n[1]=Float32Array.of(...n[1],...s[1])));st[0]=Float32Array.of(...n[0],...s[0].subarray(0,r)),2==_t&&(st[1]=Float32Array.of(...n[1],...s[1].subarray(0,r))),postMessage({cmd:D,buffer:st,ts:i},st.map((e=>e.buffer))),a=r,o-=r}for(mt=o;mt>=d;mt-=d)st[0]=s[0].slice(a,a+=d),2==_t&&(st[1]=s[1].slice(a-d,a)),postMessage({cmd:D,buffer:st,ts:i},st.map((e=>e.buffer)));mt&&(n[0]=s[0].slice(a),2==_t&&(n[1]=s[1].slice(a))),s=[]},errorInfo:function(e){null===ht&&(ht=rr());const t=rr(),r=ir(pt>0?2*pt:5e3,1e3,5e3),i=t-ht;i>r&&(ii.debug.warn("worker",`errorInfo() emit simdDecodeError and\n iframeIntervalTimestamp is ${pt} and diff is ${i} and maxDiff is ${r}\n and replay`),$t=!0,postMessage({cmd:j}))},sendWebsocketMessage:function(e){a?a.readyState===Pe?a.send(e):ii.debug.error("worker","socket is not open"):ii.debug.error("worker","socket is null")},timeEnd:function(){},postStreamToMain(e,t){postMessage({cmd:K,type:t,buffer:e},[e.buffer])}};ii.debug=new xr(ii);let ni=null;t.AudioDecoder&&(ni=new t.AudioDecoder(ii));let oi=null;e.VideoDecoder&&(oi=new e.VideoDecoder(ii)),postMessage({cmd:k}),self.onmessage=function(e){let t=e.data;switch(t.cmd){case ue:try{ii._opt=Object.assign(ii._opt,JSON.parse(t.opt))}catch(e){}ii.init();break;case ce:ii.pushBuffer(t.buffer,t.options);break;case fe:ii.decodeAudio(t.buffer,t.ts);break;case he:ii.decodeVideo(t.buffer,t.ts,t.isIFrame);break;case _e:ii.clearBuffer(t.needClear);break;case ge:ii.fetchStream(t.url,JSON.parse(t.opt));break;case pe:ii.debug.log("worker","close",JSON.stringify(t.options)),t.options&&vr(t.options.isVideoInited)&&(wr=t.options.isVideoInited),ii.close();break;case me:ii.debug.log("worker","updateConfig",t.key,t.value),ii._opt[t.key]=t.value,"playbackRate"===t.key&&(ii.playbackUpdatePlaybackRate(),ii.isPlaybackCacheBeforeDecodeForFpsRender()&&ii.playbackCacheLoop());break;case ye:ii.sendWebsocketMessage(t.message);break;case ve:jr.$video.currentTime=Number(t.message)}}}(e[1],t)}))})); diff --git a/pages_player/static/h5/js/jessibuca-pro/decoder-pro.wasm b/pages_player/static/h5/js/jessibuca-pro/decoder-pro.wasm new file mode 100644 index 0000000..c997680 Binary files /dev/null and b/pages_player/static/h5/js/jessibuca-pro/decoder-pro.wasm differ diff --git a/pages_player/static/icon/iconfont.css b/pages_player/static/icon/iconfont.css new file mode 100644 index 0000000..eb7d6fa --- /dev/null +++ b/pages_player/static/icon/iconfont.css @@ -0,0 +1,62 @@ +@font-face { + font-family: "iconfont"; /* Project id 3415787 */ + src: + url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAdAAAsAAAAADjwAAAbyAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACEQgqNJIsXATYCJAM0CxwABCAFhGcHgS8bUAxRlFBSINmXkJMNLyQ1dsZuJ6woPVTfjQHAU9ov93iJZFaYJACQLABXFBA8X/v9zt7d976ZdGgQGRKJJNa0eycU8xAJiRBpRDxU5v/vtP1jbnUqLNnyqDzLmGosxQvpT5rL2IytJVIiHBST+4WYKBwFHs8Dl3v/1qpAB2HE0VlCWcCBZhrv4d8zX++ciielZ2FCujnd3DPTwQ5uX6A6trZ3y49ZJIo2QlOJ6lfvNkKlaahWAutE1gEd3MiP4aEs8FBSTKz59nP1axtiIR6moYwUKe1vft8PP8y90kQjb4lo4iXzSEshYlGenQ3IU4Vfeh8UcBuaJqfD8ytYWGm20GfE4xW6mmqVgsKUFcVsuChO2Wbdt6pzy4Jc5zrEafX76g+bKQirFJ9k/nzQwu/P2eo/j0A/oTCoa0PrC7CABt0bi1H37cQzuoHdSnAv1Te2AGFB62TyApQpi7ZfVb2WvTVWTZhGIE1Y6CjGSjgBUUlpPf2DZ3Nw8xCa4eXiZEE1SPCiz9Ug+gPLEMoXSSBsiBQQDogMEG6ILBAeiBwQAlEBQkNUgTAQffCHF989f7jwA/zhxJ/dCAuAr6ifBgXIAdGPYs2KQqHon0mQSjBaHdmn+AIuV5h6Z65lBYy5bb2jd353CgIRJMC30KT5YUqpRHZMTwM4UB4/DEnw6MmdNBLsOnWMLqMjJ3YApoYoITgxMyHquEuSMir+KWknRkfdwKCiyg6ZuKpTPt0vKK9o7+6aWshCSZKmeaIoOhsRBKAQHG+VzaBTYASZVlUOk81AwjzHEpwaqSKGleUYba2gOA4ohCAEtqUomiYgSaj6MIXO0HABSIYJpU8DxhhiEmCtCh4chExVya/tk+29il7ejey5ctFwANd2iBIMnY8P7HqCjsSdYnFWZrp6iZWRVXk5oy7Q8vvKTscGp3Q4rUNMLzdTjSjQjutY2ClvB/ddvXcIPapv3tHxYCsoBKZdhyEBXj/NVf7MDTpXfuuclXj25oJHMdx6ItSBr1J3rTrTmpfl38ZR8u4E3jOuc4dY3NEj3kWRjh29k+PCEwTur4BgJoJbj5XlYjM7IIF8GPtlHaNuEKANoSSNBig6vc8OM6YERWcSxHDTVcDay8ZgBLkLHa6ngqzCKNsua3mGep3RG/lS8M/wY+5oeERowJ817N7075I0CNDC46USHfmWpvCrWV7hNjEBDomBcRHBTas/erP/xNi4CFXLlv6P/M5f6H9Odm42Vnh8GDR/QVVpKAyHSIu0rEJCYWmhdUhglWLFEDhuhNdluY6nwVufVe627OLNBgs7uH4h/f593rqyFHg0uMaRHhpiZc3vYQWHJlqbPDQMjIaogOdop8GTqKzz1wD/7HzAPf97Af7FosDQD1LoSpP07a1CQ62Ovndz7Rp7zmrWJVaS7GysF3dd875elMeVjj2ms2mRHom+Cscb0pLq+RNCYSvo7zHq2LkLQ527mLieZ6rdWxLkpd1rkUqU7fWgVvda+JjuQffBu6aL75cCMr4ZViOnd8X+njuF87Qq6TWab48AcZvFsL4FUH84NzWNnZ2HmG59c2ZwUcdEFbskOnqJIuVKRaHVXc0OG8fNxBmnk3Wm7pvuLAOGS3gHXHOBX5AEv1ADO5RVB0nmHjdoEUs3TzubRTzaaOzIqs9NMD07LZgTlLYuQefuQkPnZTJ+WHR0WEfegA/+3hq45gA/cUDbqG4saw1c7RxiNphwRd1q2KG0xisWPgQOBYvZuscy1fRS+iB5kI135YVHcXmrcB5YFXbH0kzw/ZN4exOk9gRsclNNrh4FTE6rJ31CqkogzfinYfIZHQz9Vj6hjqlHkHSKwlgydSVxAWxvLKJ+nFiPE4MCgyK2/zcdz1/HhHelOO8Xkk6cDipyEjAbjgpJi1XQzXUUZIGvWhKoeiIzKEjymesZLgPdyRg4HKSGvZMUYTYehKRIB4RDBmhOZdKwbWDxGAOb0xRw65g52CNiyyhV9aDu+ASUoGcg/F6AFvRKGvYNWOI+gS3oH7gthHk8j3rYXkSasSWPr0QyZ3kq58rWCxRF0ziXd4MxSeSQXUfncckRWowydkhPosmZEx6dIYfGxVBrR3x0Q2S57nL2gx2nyqUdauYM7IkQlQufLWLJa9hNjGPxgfPw711AQqFRkZG8wVHS9GQ7MdI3ZCCPBMvU4Y3U3/VEaOwR5kgGI0HTSLMBRjopdIit5bWGEJPVNgTyvYEBDbTGKtSXl8wXPgNwi1/SlyJlqtRp0qZLnyFjpsxZ2JdOemknKqntipwstxMtraZScS+Sumqs1TPsZKlbiq+m3oCyrE+25OpexStPS8LLUGjE2TJqPuFqFS9azyyUVksVsXK2XVVQN1ErMXUFAAA=') format('woff2'); +} + +.iconfont { + font-family: "iconfont" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-shipin:before { + content: "\e600"; +} + +.icon-fanhui:before { + content: "\e608"; +} + +.icon-fangda-:before { + content: "\e60e"; +} + +.icon-suoxiao-:before { + content: "\e60f"; +} + +.icon-dian:before { + content: "\ec1e"; +} + +.icon-bofang-:before { + content: "\e603"; +} + +.icon-zanting-:before { + content: "\e604"; +} + +.icon-24gf-pauseSquare:before { + content: "\ea81"; +} + +.icon-camera-full:before { + content: "\e967"; +} + +.icon-yinliangdi:before { + content: "\e606"; +} + +.icon-yinlianggao:before { + content: "\e607"; +} + +.icon-jieshu:before { + content: "\e625"; +} + diff --git a/pages_player/static/icon/iconfont.ttf b/pages_player/static/icon/iconfont.ttf new file mode 100644 index 0000000..c22f3e8 Binary files /dev/null and b/pages_player/static/icon/iconfont.ttf differ diff --git a/pages_player/static/img/Icon_Calendar@3x.png b/pages_player/static/img/Icon_Calendar@3x.png new file mode 100644 index 0000000..52bb1e8 Binary files /dev/null and b/pages_player/static/img/Icon_Calendar@3x.png differ diff --git a/pages_player/static/img/bg.jpg b/pages_player/static/img/bg.jpg new file mode 100644 index 0000000..efabc41 Binary files /dev/null and b/pages_player/static/img/bg.jpg differ diff --git a/pages_player/static/img/expand-hover.png b/pages_player/static/img/expand-hover.png new file mode 100644 index 0000000..6856c57 Binary files /dev/null and b/pages_player/static/img/expand-hover.png differ diff --git a/pages_player/static/img/expand.png b/pages_player/static/img/expand.png new file mode 100644 index 0000000..eaeb6ad Binary files /dev/null and b/pages_player/static/img/expand.png differ diff --git a/pages_player/static/img/index/selfDevice.png b/pages_player/static/img/index/selfDevice.png new file mode 100644 index 0000000..8e77cec Binary files /dev/null and b/pages_player/static/img/index/selfDevice.png differ diff --git a/pages_player/static/img/pause.png b/pages_player/static/img/pause.png new file mode 100644 index 0000000..efcfae4 Binary files /dev/null and b/pages_player/static/img/pause.png differ diff --git a/pages_player/static/img/play.png b/pages_player/static/img/play.png new file mode 100644 index 0000000..6624ce9 Binary files /dev/null and b/pages_player/static/img/play.png differ diff --git a/pages_player/static/img/screenShot2x.png b/pages_player/static/img/screenShot2x.png new file mode 100644 index 0000000..0e2a84a Binary files /dev/null and b/pages_player/static/img/screenShot2x.png differ diff --git a/pages_player/static/img/screenShot3x.png b/pages_player/static/img/screenShot3x.png new file mode 100644 index 0000000..d939411 Binary files /dev/null and b/pages_player/static/img/screenShot3x.png differ diff --git a/pages_player/static/img/selfDevice/icon_duijiang.png b/pages_player/static/img/selfDevice/icon_duijiang.png new file mode 100644 index 0000000..66304eb Binary files /dev/null and b/pages_player/static/img/selfDevice/icon_duijiang.png differ diff --git a/pages_player/static/img/selfDevice/icon_duijiang_c.png b/pages_player/static/img/selfDevice/icon_duijiang_c.png new file mode 100644 index 0000000..101398e Binary files /dev/null and b/pages_player/static/img/selfDevice/icon_duijiang_c.png differ diff --git a/pages_player/static/img/selfDevice/icon_jietu.png b/pages_player/static/img/selfDevice/icon_jietu.png new file mode 100644 index 0000000..921c4a6 Binary files /dev/null and b/pages_player/static/img/selfDevice/icon_jietu.png differ diff --git a/pages_player/static/img/selfDevice/icon_yuntai.png b/pages_player/static/img/selfDevice/icon_yuntai.png new file mode 100644 index 0000000..1557fd8 Binary files /dev/null and b/pages_player/static/img/selfDevice/icon_yuntai.png differ diff --git a/pages_player/static/img/selfDevice/icon_yuntai_c.png b/pages_player/static/img/selfDevice/icon_yuntai_c.png new file mode 100644 index 0000000..75cb473 Binary files /dev/null and b/pages_player/static/img/selfDevice/icon_yuntai_c.png differ diff --git a/pages_player/static/img/selfDevice/yuntai.png b/pages_player/static/img/selfDevice/yuntai.png new file mode 100644 index 0000000..fb1b86b Binary files /dev/null and b/pages_player/static/img/selfDevice/yuntai.png differ diff --git a/pages_player/static/img/selfDevice/yuntai/yuntai.png b/pages_player/static/img/selfDevice/yuntai/yuntai.png new file mode 100644 index 0000000..fb1b86b Binary files /dev/null and b/pages_player/static/img/selfDevice/yuntai/yuntai.png differ diff --git a/pages_player/static/img/selfDevice/yuntai/yuntai_shang.png b/pages_player/static/img/selfDevice/yuntai/yuntai_shang.png new file mode 100644 index 0000000..c6999e6 Binary files /dev/null and b/pages_player/static/img/selfDevice/yuntai/yuntai_shang.png differ diff --git a/pages_player/static/img/selfDevice/yuntai/yuntai_xia.png b/pages_player/static/img/selfDevice/yuntai/yuntai_xia.png new file mode 100644 index 0000000..ef396b4 Binary files /dev/null and b/pages_player/static/img/selfDevice/yuntai/yuntai_xia.png differ diff --git a/pages_player/static/img/selfDevice/yuntai/yuntai_you.png b/pages_player/static/img/selfDevice/yuntai/yuntai_you.png new file mode 100644 index 0000000..971c751 Binary files /dev/null and b/pages_player/static/img/selfDevice/yuntai/yuntai_you.png differ diff --git a/pages_player/static/img/selfDevice/yuntai/yuntai_zuo.png b/pages_player/static/img/selfDevice/yuntai/yuntai_zuo.png new file mode 100644 index 0000000..69fb65c Binary files /dev/null and b/pages_player/static/img/selfDevice/yuntai/yuntai_zuo.png differ diff --git a/pages_player/static/img/slience.png b/pages_player/static/img/slience.png new file mode 100644 index 0000000..03086ab Binary files /dev/null and b/pages_player/static/img/slience.png differ diff --git a/pages_player/static/img/sound.png b/pages_player/static/img/sound.png new file mode 100644 index 0000000..5087810 Binary files /dev/null and b/pages_player/static/img/sound.png differ diff --git a/pages_player/static/img/switch/Icon_BenDiLuXiang1_Normal@2x.png b/pages_player/static/img/switch/Icon_BenDiLuXiang1_Normal@2x.png new file mode 100644 index 0000000..3b5d2b2 Binary files /dev/null and b/pages_player/static/img/switch/Icon_BenDiLuXiang1_Normal@2x.png differ diff --git a/pages_player/static/img/switch/Icon_BenDiLuXiang1_Normal@3x.png b/pages_player/static/img/switch/Icon_BenDiLuXiang1_Normal@3x.png new file mode 100644 index 0000000..03ec385 Binary files /dev/null and b/pages_player/static/img/switch/Icon_BenDiLuXiang1_Normal@3x.png differ diff --git a/pages_player/static/img/switch/Icon_BenDiLuXiang1_Select@2x.png b/pages_player/static/img/switch/Icon_BenDiLuXiang1_Select@2x.png new file mode 100644 index 0000000..074c1e1 Binary files /dev/null and b/pages_player/static/img/switch/Icon_BenDiLuXiang1_Select@2x.png differ diff --git a/pages_player/static/img/switch/Icon_BenDiLuXiang1_Select@3x.png b/pages_player/static/img/switch/Icon_BenDiLuXiang1_Select@3x.png new file mode 100644 index 0000000..e824e90 Binary files /dev/null and b/pages_player/static/img/switch/Icon_BenDiLuXiang1_Select@3x.png differ diff --git a/pages_player/static/img/switch/Icon_YunLuXiang1_Normal@2x.png b/pages_player/static/img/switch/Icon_YunLuXiang1_Normal@2x.png new file mode 100644 index 0000000..b2374c5 Binary files /dev/null and b/pages_player/static/img/switch/Icon_YunLuXiang1_Normal@2x.png differ diff --git a/pages_player/static/img/switch/Icon_YunLuXiang1_Normal@3x.png b/pages_player/static/img/switch/Icon_YunLuXiang1_Normal@3x.png new file mode 100644 index 0000000..5dd9e7f Binary files /dev/null and b/pages_player/static/img/switch/Icon_YunLuXiang1_Normal@3x.png differ diff --git a/pages_player/static/img/switch/Icon_YunLuXiang1_Select@2x.png b/pages_player/static/img/switch/Icon_YunLuXiang1_Select@2x.png new file mode 100644 index 0000000..586783d Binary files /dev/null and b/pages_player/static/img/switch/Icon_YunLuXiang1_Select@2x.png differ diff --git a/pages_player/static/img/switch/Icon_YunLuXiang1_Select@3x.png b/pages_player/static/img/switch/Icon_YunLuXiang1_Select@3x.png new file mode 100644 index 0000000..99ee54d Binary files /dev/null and b/pages_player/static/img/switch/Icon_YunLuXiang1_Select@3x.png differ diff --git a/pages_player/static/img/transform.png b/pages_player/static/img/transform.png new file mode 100644 index 0000000..e4cf3dd Binary files /dev/null and b/pages_player/static/img/transform.png differ diff --git a/pages_player/static/img/zoom-stop-hover.png b/pages_player/static/img/zoom-stop-hover.png new file mode 100644 index 0000000..9ba05e9 Binary files /dev/null and b/pages_player/static/img/zoom-stop-hover.png differ diff --git a/pages_player/static/img/zoom-stop.png b/pages_player/static/img/zoom-stop.png new file mode 100644 index 0000000..9adc482 Binary files /dev/null and b/pages_player/static/img/zoom-stop.png differ diff --git a/pages_player/static/js/jessibuca-pro.js b/pages_player/static/js/jessibuca-pro.js new file mode 100644 index 0000000..cf6aab0 --- /dev/null +++ b/pages_player/static/js/jessibuca-pro.js @@ -0,0 +1,318 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self)["jessibuca-pro"]=t()}(this,function(){"use strict";const _="fetch",M="websocket",U="worker",n="player",y="playbackTF",p="mp4",j="webm",N="flv",V="webTransport",H="nakedFlow",W={flv:"FLV",m7s:"m7s",hls:"HLS",webrtc:"Webrtc",webTransport:"WebTransport",nakedFlow:"裸流"},G="canvas",z="debug",K="warn",q="click",J={url:"",playbackConfig:{},fullscreenWatermarkConfig:{},playType:n,playbackForwardMaxRateDecodeIFrame:8,playOptions:{},isLive:!0,isMulti:!1,isCrypto:!1},Q={playType:n,container:"",videoBuffer:1e3,videoBufferDelay:1e3,networkDelay:1e4,isResize:!0,isFullResize:!1,isFlv:!1,isHls:!1,isWebrtc:!1,isWebrtcForZLM:!1,isNakedFlow:!1,debug:!1,debugLevel:K,debugUuid:"",isMulti:!1,hotKey:!1,loadingTimeout:10,heartTimeout:10,timeout:10,pageVisibilityHiddenTimeout:300,loadingTimeoutReplay:!0,heartTimeoutReplay:!0,loadingTimeoutReplayTimes:3,heartTimeoutReplayTimes:3,heartTimeoutReplayUseLastFrameShow:!1,supportDblclickFullscreen:!1,showBandwidth:!1,showPerformance:!1,keepScreenOn:!0,isNotMute:!1,hasAudio:!0,hasVideo:!0,operateBtns:{fullscreen:!1,screenshot:!1,play:!1,audio:!1,record:!1,ptz:!1,quality:!1,zoom:!1,close:!1,scale:!1,performance:!1,aiFace:!1,aiObject:!1,fullscreenFn:null,fullscreenExitFn:null,screenshotFn:null,playFn:null,pauseFn:null,recordFn:null,recordStopFn:null},extendOperateBtns:[],contextmenuBtns:[],watermarkConfig:{},controlAutoHide:!1,hasControl:!1,loadingIcon:!0,loadingText:"",background:"",loadingBackground:"",decoder:"decoder-pro.js",decoderWASM:"",url:"",rotate:0,mirrorRotate:"none",playbackConfig:{playList:[],fps:"",showControl:!0,showRateBtn:!1,rateConfig:[],isCacheBeforeDecodeForFpsRender:!1,uiUsePlaybackPause:!1,isPlaybackPauseClearCache:!0,isUseFpsRender:!1,isUseLocalCalculateTime:!1,localOneFrameTimestamp:40,supportWheel:!1},qualityConfig:[],defaultStreamQuality:"",scaleConfig:["拉伸","缩放","正常"],forceNoOffscreen:!0,hiddenAutoPause:!1,protocol:2,demuxType:N,useWasm:!1,useWCS:!1,useSIMD:!0,wcsUseVideoRender:!0,wasmUseVideoRender:!0,mseUseCanvasRender:!1,hlsUseCanvasRender:!1,useMSE:!1,useOffscreen:!1,autoWasm:!0,wasmDecodeErrorReplay:!0,openWebglAlignment:!1,syncAudioAndVideo:!1,playbackDelayTime:1e3,playbackFps:25,playbackForwardMaxRateDecodeIFrame:8,playbackCurrentTimeMove:!0,useVideoRender:!0,useCanvasRender:!1,networkDelayTimeoutReplay:!1,recordType:p,checkFirstIFrame:!0,nakedFlowFps:25,audioEngine:null,isShowRecordingUI:!0,isShowZoomingUI:!0,useFaceDetector:!1,useObjectDetector:!1,ptzClickType:q,weiXinInAndroidAudioBufferSize:4800,isCrypto:!1,cryptoKey:"",cryptoIV:"",cryptoKeyUrl:"",autoResize:!1,useWebFullScreen:!1,ptsMaxDiff:3600,aiFaceDetectWidth:192,aiObjectDetectWidth:192},X="init",Y="initVideo",Z="initAudio",$="audioCode",ee="videoCode",te="videoCodec",v={fullscreen:"fullscreen$2",webFullscreen:"webFullscreen",decoderWorkerInit:"decoderWorkerInit",play:"play",playing:"playing",pause:"pause",mute:"mute",load:"load",loading:"loading",zooming:"zooming",videoInfo:"videoInfo",timeUpdate:"timeUpdate",audioInfo:"audioInfo",log:"log",error:"error",kBps:"kBps",timeout:"timeout",delayTimeout:"delayTimeout",delayTimeoutRetryEnd:"delayTimeoutRetryEnd",loadingTimeout:"loadingTimeout",loadingTimeoutRetryEnd:"loadingTimeoutRetryEnd",stats:"stats",performance:"performance",faceDetectActive:"faceDetectActive",objectDetectActive:"objectDetectActive",record:"record",recording:"recording",recordingTimestamp:"recordingTimestamp",recordStart:"recordStart",recordEnd:"recordEnd",recordCreateError:"recordCreateError",recordBlob:"recordBlob",buffer:"buffer",videoFrame:"videoFrame",start:"start",metadata:"metadata",resize:"resize",volumechange:"volumechange",destroy:"destroy",beforeDestroy:"beforeDestroy",streamEnd:"streamEnd",streamRate:"streamRate",streamAbps:"streamAbps",streamVbps:"streamVbps",streamDts:"streamDts",streamSuccess:"streamSuccess",streamMessage:"streamMessage",streamError:"streamError",streamStats:"streamStats",mseSourceOpen:"mseSourceOpen",mseSourceClose:"mseSourceClose",mseSourceended:"mseSourceended",mseSourceBufferError:"mseSourceBufferError",mseSourceBufferBusy:"mseSourceBufferBusy",mseSourceBufferFull:"mseSourceBufferFull",videoWaiting:"videoWaiting",videoTimeUpdate:"videoTimeUpdate",videoSyncAudio:"videoSyncAudio",playToRenderTimes:"playToRenderTimes",playbackTime:"playbackTime",playbackTimestamp:"playbackTimestamp",playbackPrecision:"playbackPrecision",playbackJustTime:"playbackJustTime",playbackStats:"playbackStats",playbackSeek:"playbackSeek",playbackPause:"playbackPause",playbackPauseOrResume:"playbackPauseOrResume",playbackRateChange:"playbackRateChange",playbackPreRateChange:"playbackPreRateChange",ptz:"ptz",streamQualityChange:"streamQualityChange",visibilityChange:"visibilityChange",netBuf:"netBuf",close:"close",networkDelayTimeout:"networkDelayTimeout",togglePerformancePanel:"togglePerformancePanel",viewResizeChange:"viewResizeChange",flvDemuxBufferSizeTooLarge:"flvDemuxBufferSizeTooLarge",talkGetUserMediaSuccess:"talkGetUserMediaSuccess",talkGetUserMediaFail:"talkGetUserMediaFail",talkGetUserMediaTimeout:"talkGetUserMediaTimeout",talkStreamStart:"talkStreamStart",talkStreamOpen:"talkStreamOpen",talkStreamClose:"talkStreamClose",talkStreamError:"talkStreamError",talkStreamInactive:"talkStreamInactive",webrtcDisconnect:"webrtcDisconnect",webrtcFailed:"webrtcFailed",webrtcClosed:"webrtcClosed",crashLog:"crashLog",focus:"focus",blur:"blur",visibilityHiddenTimeout:"visibilityHiddenTimeout",websocketOpen:"websocketOpen",websocketClose:"websocketClose",websocketError:"websocketError",websocketMessage:"websocketMessage",aiObjectDetectorInfo:"aiObjectDetectorInfo",aiFaceDetector:"aiFaceDetector"},ie={load:v.load,timeUpdate:v.timeUpdate,videoInfo:v.videoInfo,audioInfo:v.audioInfo,error:v.error,kBps:v.kBps,start:v.start,timeout:v.timeout,loadingTimeout:v.loadingTimeout,loadingTimeoutRetryEnd:v.loadingTimeoutRetryEnd,delayTimeout:v.delayTimeout,delayTimeoutRetryEnd:v.delayTimeoutRetryEnd,fullscreen:"fullscreen",webFullscreen:v.webFullscreen,play:v.play,pause:v.pause,mute:v.mute,stats:v.stats,performance:v.performance,recordingTimestamp:v.recordingTimestamp,recordStart:v.recordStart,recordEnd:v.recordEnd,recordBlob:v.recordBlob,playToRenderTimes:v.playToRenderTimes,playbackSeek:v.playbackSeek,playbackStats:v.playbackStats,playbackTimestamp:v.playbackTimestamp,playbackPauseOrResume:v.playbackPauseOrResume,playbackPreRateChange:v.playbackPreRateChange,playbackRateChange:v.playbackRateChange,ptz:v.ptz,streamQualityChange:v.streamQualityChange,zooming:v.zooming,crashLog:v.crashLog,focus:v.focus,blur:v.blur,visibilityHiddenTimeout:v.visibilityHiddenTimeout,visibilityChange:v.visibilityChange,websocketOpen:v.websocketOpen,networkDelayTimeout:v.networkDelayTimeout,aiObjectDetectorInfo:v.aiObjectDetectorInfo},re={talkStreamClose:v.talkStreamClose,talkStreamError:v.talkStreamError,talkStreamInactive:v.talkStreamInactive,talkGetUserMediaTimeout:v.talkGetUserMediaTimeout},A={playError:"playIsNotPauseOrUrlIsNull",fetchError:"fetchError",websocketError:"websocketError",webcodecsH265NotSupport:"webcodecsH265NotSupport",webcodecsDecodeError:"webcodecsDecodeError",mediaSourceH265NotSupport:"mediaSourceH265NotSupport",mediaSourceDecoderConfigurationError:"mediaSourceDecoderConfigurationError",mediaSourceFull:v.mseSourceBufferFull,mseSourceBufferError:v.mseSourceBufferError,mediaSourceAppendBufferError:"mediaSourceAppendBufferError",mediaSourceBufferListLarge:"mediaSourceBufferListLarge",mediaSourceAppendBufferEndTimeout:"mediaSourceAppendBufferEndTimeout",wasmDecodeError:"wasmDecodeError",hlsError:"hlsError",webrtcError:"webrtcError",webglAlignmentError:"webglAlignmentError",webcodecsWidthOrHeightChange:"webcodecsWidthOrHeightChange",tallWebsocketClosedByError:"tallWebsocketClosedByError",flvDemuxBufferSizeTooLarge:v.flvDemuxBufferSizeTooLarge,wasmDecodeVideoNoResponseError:"wasmDecodeVideoNoResponseError",audioChannelError:"audioChannelError",simdH264DecodeVideoWidthIsTooLarge:"simdH264DecodeVideoWidthIsTooLarge"},se="notConnect",ae="open",o={download:"download",base64:"base64",blob:"blob"},ne="download",oe={7:"H264(AVC)",12:"H265(HEVC)"},le="H264(AVC)",ce="H265(HEVC)",ue={AAC:"AAC",ALAW:"ALAW(g711a)",MULAW:"MULAW(g711u)"},de={10:"AAC",7:"ALAW",8:"MULAW"},he=6,pe="webcodecs",fe="webgl",Ae="offscreen",me="mse",ge='video/mp4; codecs="avc1.64002A"',ye='video/mp4; codecs="hev1.1.6.L123.b0"',ve="oneHour",be="halfHour",Ee="fiveMin",Se={oneHour:"one-hour",halfHour:"half-hour",tenMin:"ten-min",fiveMin:"five-min"},Te=["oneHour","halfHour","tenMin","fiveMin"],we=["up","right","down","left"],ke="g711a",Ce="g711u",l={png:"image/png",jpeg:"image/jpeg",webp:"image/webp"},Re="waiting",De="timeupdate",Le="ratechange",Ie="The user aborted a request",Be="AbortError",xe="AbortError",Pe="worklet",Fe={encType:ke,packetType:"rtp",rtpSsrc:"0000000000",numberChannels:1,sampleRate:8e3,sampleBitsWidth:16,debug:!1,debugLevel:K,testMicrophone:!1,audioBufferLength:160,engine:Pe,checkGetUserMediaTimeout:!1,getUserMediaTimeout:1e4},Oe="worklet",_e="script",Me="active",Ue={name:"",index:0,icon:"",iconHover:"",iconTitle:"",activeIcon:"",activeIconHover:"",activeIconTitle:"",click:null,activeClick:null},je={content:"",click:null,index:0};class Ne{constructor(a){this.log=function(e){if(a._opt.debug&&a._opt.debugLevel==z){for(var t=a._opt.debugUuid?`[${a._opt.debugUuid}]`:"",i=arguments.length,r=new Array(1this.proxy(t,e,i,r));t.addEventListener(e,i,r);var s=()=>t.removeEventListener(e,i,r);return this.destroys.push(s),s}}destroy(){this.master.debug&&this.master.debug.log("Events","destroy"),this.destroys.forEach(e=>e())}}var F="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function He(e,t){return e(t={exports:{}},t.exports),t.exports}var f=He(function(e){var n,t,o,i,r;n="undefined"!=typeof window&&void 0!==window.document?window.document:{},t=e.exports,o=function(){for(var e,t=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],i=0,r=t.length,s={};i>4==10&&0===e[1]}function Ge(){}function ze(e){var e=(0{E(t,e,i[e])}),t.style[i]=e)}function Ke(e,t,i){i=!(2{var t;u(e)&&(r+=e,1e3<=(t=(e=qe())-s))&&(i(r/t*1e3),s=e,r=0)}}f.isEnabled;try{if("object"==typeof WebAssembly&&"function"==typeof WebAssembly.instantiate){var e=new WebAssembly.Module(Uint8Array.of(0,97,115,109,1,0,0,0));if(e instanceof WebAssembly.Module)new WebAssembly.Instance(e)instanceof WebAssembly.Instance}}catch(e){}function S(){return/iphone|ipod|android.*mobile|windows.*phone|blackberry.*mobile/i.test(window.navigator.userAgent.toLowerCase())}function Qe(){const t=window.navigator.userAgent.toLowerCase()||"",i={type:"",version:""},e={IE:window.ActiveXObject||"ActiveXObject"in window,Chrome:-1{var i=r[t];return"a"===t?["一","二","三","四","五","六","日"][i-1]:(i=0{l=!1,n&&(e.apply(o,n),n=null,o=null)},a))}}function u(e){return"[object Number]"===Object.prototype.toString.call(e)}function tt(){return window.MediaStreamTrackGenerator&&"function"==typeof window.MediaStreamTrackGenerator}function it(e){return null==e}function rt(e){return!0===e||!1===e}function c(e){return!it(e)}function st(e){var t={container:"",left:"",right:"",top:"",bottom:"",opacity:1,image:{src:"",width:"100",height:"60"},text:{content:"",fontSize:"14",color:"#000"}},i=Object.assign(t.image,e.image||{}),r=Object.assign(t.text,e.text||{});return Object.assign(t,e,{image:i,text:r})}function at(e,t){e={container:e||"",text:"",opacity:"",angle:"",color:"",fontSize:"",fontFamily:""};return{watermark_parent_node:(e=Object.assign(e,t)).container,watermark_alpha:e.opacity,watermark_angle:e.angle,watermark_fontsize:e.fontSize,watermark_color:e.color,watermark_font:e.fontFamily,watermark_txt:e.text}}function nt(e,c){return new Promise((t,i)=>{let r=st(c);if(!r.image.src&&!r.text.content)return t(e);let s=document.createElement("canvas"),a=(s.width=c.width,s.height=c.height,s.getContext("2d")),n=0,o=0;u(r.left)?n=r.left:u(r.right)&&(n=s.width-r.right),u(r.top)?o=r.top:u(r.bottom)&&(o=s.height-r.bottom);const l=new Image;l.src=e,l.onload=()=>{if(a.drawImage(l,0,0),r.image&&r.image.src){const e=new Image;e.src=r.image.src,e.setAttribute("crossOrigin","Anonymous"),e.onload=()=>{n-=r.image.width,a.drawImage(e,n,o,r.image.width,r.image.height),t(s.toDataURL(c.format,c.quality))},e.onerror=e=>{i()}}else r.text&&r.text.content&&(a.font=r.text.fontSize+"px 宋体",a.fillStyle=r.text.color,a.textAlign="right",a.fillText(r.text.content,n,o),t(s.toDataURL(c.format,c.quality)))},l.onerror=e=>{i(e)}})}function ot(e){var t,i;return-1{return e=window.navigator.userAgent,/MicroMessenger/i.test(e)&&(e=window.navigator.userAgent.toLowerCase(),/android/i.test(e));var e};function w(e){e=e||window.event;return e.target||e.srcElement}function k(e){return"function"==typeof e}function ft(e){let t=0,i=0;var r=e||window.event;return r.pageX||r.pageY?(t=r.pageX,i=r.pageY):(r.clientX||r.clientY)&&(t=e.clientX+document.documentElement.scrollLeft+document.body.scrollLeft,i=e.clientY+document.documentElement.scrollTop+document.body.scrollTop),{posX:t,posY:i}}function At(e){return!1===e.hasAudio&&(e.useMSE||e.useWCS&&!e.useOffscreen)}function mt(e){e=e.toString().trim().match(/^function\s*\w*\s*\([\w\s,]*\)\s*{([\w\W]*?)}$/)[1],e=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(e)}function gt(e){e.close?e.close():e.destroy&&e.destroy()}function yt(){return"https:"===window.location.protocol||"localhost"===window.location.hostname}function vt(e){for(var e=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),t=window.atob(e),i=new Uint8Array(t.length),r=0;r{delete t[e]}),delete this.e}}var Tt="undefined"!=typeof Float32Array?Float32Array:Array;function wt(){var e=new Tt(16);return Tt!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function kt(e){e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function Ct(e,t,i){var r=new Tt(3);return r[0]=e,r[1]=t,r[2]=i,r}e=new Tt(3),Tt!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0);var Rt=(g,e)=>{e&&g.pixelStorei(g.UNPACK_ALIGNMENT,1);e=n(g.VERTEX_SHADER,"\n attribute vec4 aVertexPosition;\n attribute vec2 aTexturePosition;\n uniform mat4 uModelMatrix;\n uniform mat4 uViewMatrix;\n uniform mat4 uProjectionMatrix;\n varying lowp vec2 vTexturePosition;\n void main(void) {\n gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * aVertexPosition;\n vTexturePosition = aTexturePosition;\n }\n "),r=n(g.FRAGMENT_SHADER,"\n precision highp float;\n varying highp vec2 vTexturePosition;\n uniform int isyuv;\n uniform sampler2D rgbaTexture;\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const mat4 YUV2RGB = mat4( 1.1643828125, 0, 1.59602734375, -.87078515625,\n 1.1643828125, -.39176171875, -.81296875, .52959375,\n 1.1643828125, 2.017234375, 0, -1.081390625,\n 0, 0, 0, 1);\n\n\n void main(void) {\n\n if (isyuv>0) {\n\n highp float y = texture2D(yTexture, vTexturePosition).r;\n highp float u = texture2D(uTexture, vTexturePosition).r;\n highp float v = texture2D(vTexture, vTexturePosition).r;\n gl_FragColor = vec4(y, u, v, 1) * YUV2RGB;\n\n } else {\n gl_FragColor = texture2D(rgbaTexture, vTexturePosition);\n }\n }\n "),s=g.createProgram(),g.attachShader(s,e),g.attachShader(s,r),g.linkProgram(s);const t=g.getProgramParameter(s,g.LINK_STATUS)?s:(console.log("Unable to initialize the shader program: "+g.getProgramInfoLog(s)),null),y={program:t,attribLocations:{vertexPosition:g.getAttribLocation(t,"aVertexPosition"),texturePosition:g.getAttribLocation(t,"aTexturePosition")},uniformLocations:{projectionMatrix:g.getUniformLocation(t,"uProjectionMatrix"),modelMatrix:g.getUniformLocation(t,"uModelMatrix"),viewMatrix:g.getUniformLocation(t,"uViewMatrix"),rgbatexture:g.getUniformLocation(t,"rgbaTexture"),ytexture:g.getUniformLocation(t,"yTexture"),utexture:g.getUniformLocation(t,"uTexture"),vtexture:g.getUniformLocation(t,"vTexture"),isyuv:g.getUniformLocation(t,"isyuv")}},v=(e=g.createBuffer(),g.bindBuffer(g.ARRAY_BUFFER,e),g.bufferData(g.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,-1,-1,1,1,-1,-1,1,-1]),g.STATIC_DRAW),r=(r=[]).concat([0,1],[1,1],[1,0],[0,0]),s=g.createBuffer(),g.bindBuffer(g.ARRAY_BUFFER,s),g.bufferData(g.ARRAY_BUFFER,new Float32Array(r),g.STATIC_DRAW),r=g.createBuffer(),g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,r),g.bufferData(g.ELEMENT_ARRAY_BUFFER,new Uint16Array([0,1,2,0,2,3]),g.STATIC_DRAW),{position:e,texPosition:s,indices:r}),i=a(),b=a(),E=a(),S=a();var r,s;function a(){var e=g.createTexture();return g.bindTexture(g.TEXTURE_2D,e),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,g.LINEAR),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,g.LINEAR),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,g.CLAMP_TO_EDGE),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,g.CLAMP_TO_EDGE),e}function n(e,t){e=g.createShader(e);return g.shaderSource(e,t),g.compileShader(e),g.getShaderParameter(e,g.COMPILE_STATUS)?e:(console.log("An error occurred compiling the shaders: "+g.getShaderInfoLog(e)),g.deleteShader(e),null)}function o(e,t){g.viewport(0,0,e,t),g.clearColor(0,0,0,0),g.clearDepth(1),g.enable(g.DEPTH_TEST),g.depthFunc(g.LEQUAL),g.clear(g.COLOR_BUFFER_BIT|g.DEPTH_BUFFER_BIT);const i=wt();e=i,r=(s=t=1)/((m=-1)-t),n=1/((a=-1)-s),p=1/((h=.1)-(d=100)),e[0]=-2*r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*p,e[11]=0,e[12]=(m+t)*r,e[13]=(s+a)*n,e[14]=(d+h)*p,e[15]=1;var r,s,a,n,o,l,c,u,d,h,p,f,A,m=wt(),t=(kt(m),wt());r=t,s=Ct(0,0,0),a=Ct(0,0,-1),n=Ct(0,1,0),d=s[0],h=s[1],s=s[2],p=n[0],e=n[1],n=n[2],f=a[0],A=a[1],a=a[2],Math.abs(d-f)<1e-6&&Math.abs(h-A)<1e-6&&Math.abs(s-a)<1e-6?kt(r):(f=d-f,A=h-A,a=s-a,o=e*(a*=u=1/Math.hypot(f,A,a))-n*(A*=u),n=n*(f*=u)-p*a,p=p*A-e*f,(u=Math.hypot(o,n,p))?(o*=u=1/u,n*=u,p*=u):p=n=o=0,e=A*p-a*n,l=a*o-f*p,c=f*n-A*o,(u=Math.hypot(e,l,c))?(e*=u=1/u,l*=u,c*=u):c=l=e=0,r[0]=o,r[1]=e,r[2]=f,r[3]=0,r[4]=n,r[5]=l,r[6]=A,r[7]=0,r[8]=p,r[9]=c,r[10]=a,r[11]=0,r[12]=-(o*d+n*h+p*s),r[13]=-(e*d+l*h+c*s),r[14]=-(f*d+A*h+a*s),r[15]=1);{const e=3,t=g.FLOAT,i=!1,b=0,E=0;g.bindBuffer(g.ARRAY_BUFFER,v.position),g.vertexAttribPointer(y.attribLocations.vertexPosition,3,t,!1,0,0),g.enableVertexAttribArray(y.attribLocations.vertexPosition)}{const e=2,t=g.FLOAT,i=!1,b=0,E=0;g.bindBuffer(g.ARRAY_BUFFER,v.texPosition),g.vertexAttribPointer(y.attribLocations.texturePosition,2,t,!1,0,0),g.enableVertexAttribArray(y.attribLocations.texturePosition)}g.activeTexture(g.TEXTURE0+3),g.bindTexture(g.TEXTURE_2D,b),g.activeTexture(g.TEXTURE0+4),g.bindTexture(g.TEXTURE_2D,E),g.activeTexture(g.TEXTURE0+5),g.bindTexture(g.TEXTURE_2D,S),g.bindBuffer(g.ELEMENT_ARRAY_BUFFER,v.indices),g.useProgram(y.program),g.uniformMatrix4fv(y.uniformLocations.projectionMatrix,!1,i),g.uniformMatrix4fv(y.uniformLocations.modelMatrix,!1,m),g.uniformMatrix4fv(y.uniformLocations.viewMatrix,!1,t),g.uniform1i(y.uniformLocations.rgbatexture,2),g.uniform1i(y.uniformLocations.ytexture,3),g.uniform1i(y.uniformLocations.utexture,4),g.uniform1i(y.uniformLocations.vtexture,5),g.uniform1i(y.uniformLocations.isyuv,1);{const e=6,t=g.UNSIGNED_SHORT,y=0;g.drawElements(g.TRIANGLES,6,t,0)}}return{render:function(e,t,i,r,s){g.activeTexture(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,b),g.texImage2D(g.TEXTURE_2D,0,g.LUMINANCE,e,t,0,g.LUMINANCE,g.UNSIGNED_BYTE,i),g.activeTexture(g.TEXTURE1),g.bindTexture(g.TEXTURE_2D,E),g.texImage2D(g.TEXTURE_2D,0,g.LUMINANCE,e/2,t/2,0,g.LUMINANCE,g.UNSIGNED_BYTE,r),g.activeTexture(g.TEXTURE2),g.bindTexture(g.TEXTURE_2D,S),g.texImage2D(g.TEXTURE_2D,0,g.LUMINANCE,e/2,t/2,0,g.LUMINANCE,g.UNSIGNED_BYTE,s),o(e,t)},renderYUV:function(e,t,i){var r=i.slice(0,e*t),s=i.slice(e*t,e*t*5/4),i=i.slice(e*t*5/4,e*t*3/2);g.activeTexture(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,b),g.texImage2D(g.TEXTURE_2D,0,g.LUMINANCE,e,t,0,g.LUMINANCE,g.UNSIGNED_BYTE,r),g.activeTexture(g.TEXTURE1),g.bindTexture(g.TEXTURE_2D,E),g.texImage2D(g.TEXTURE_2D,0,g.LUMINANCE,e/2,t/2,0,g.LUMINANCE,g.UNSIGNED_BYTE,s),g.activeTexture(g.TEXTURE2),g.bindTexture(g.TEXTURE_2D,S),g.texImage2D(g.TEXTURE_2D,0,g.LUMINANCE,e/2,t/2,0,g.LUMINANCE,g.UNSIGNED_BYTE,i),o(e,t)},destroy:function(){g.deleteProgram(y.program),g.deleteBuffer(v.position),g.deleteBuffer(v.texPosition),g.deleteBuffer(v.indices),g.deleteTexture(i),g.deleteTexture(b),g.deleteTexture(E),g.deleteTexture(S)}}};class Dt extends t{constructor(){super(),this.videoInfo={width:null,height:null,encType:null},this.init=!1}resetInit(){this.videoInfo={width:null,height:null,encType:null},this.init=!1}destroy(){this.resetInit()}updateVideoInfo(e){c(e.encTypeCode)&&(this.videoInfo.encType=oe[e.encTypeCode]),c(e.encType)&&(this.videoInfo.encType=e.encType),c(e.width)&&(this.videoInfo.width=e.width),c(e.height)&&(this.videoInfo.height=e.height),c(this.videoInfo.encType)&&c(this.videoInfo.height)&&c(this.videoInfo.width)&&!this.init&&(this.player.emit(v.videoInfo,this.videoInfo),this.init=!0)}clearView(){}play(){}pause(){}getType(){return""}isPlaying(){return!0}addContentToCanvas(){}}var d="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0;function Lt(e,t,i){var r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){Pt(r.response,t,i)},r.onerror=function(){console.error("could not download file")},r.send()}function It(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&t.status<=299}function Bt(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(e){var i=document.createEvent("MouseEvents");i.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(i)}}var xt=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),Pt="object"!=typeof window||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!xt?function(e,t,i){var r=d.URL||d.webkitURL,s=document.createElementNS("http://www.w3.org/1999/xhtml","a");t=t||e.name||"download",s.download=t,s.rel="noopener","string"==typeof e?(s.href=e,s.origin!==location.origin?It(s.href)?Lt(e,t,i):Bt(s,s.target="_blank"):Bt(s)):(s.href=r.createObjectURL(e),setTimeout(function(){r.revokeObjectURL(s.href)},4e4),setTimeout(function(){Bt(s)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){var r;t=t||e.name||"download","string"==typeof e?It(e)?Lt(e,t,i):((r=document.createElement("a")).href=e,r.target="_blank",setTimeout(function(){Bt(r)})):navigator.msSaveOrOpenBlob((e=e,void 0===(i=i)?i={autoBom:!1}:"object"!=typeof i&&(console.warn("Deprecated: Expected third argument to be a object"),i={autoBom:!i}),i.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e),t)}:function(e,t,i,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof e)return Lt(e,t,i);var s,a,n,t="application/octet-stream"===e.type,i=/constructor/i.test(d.HTMLElement)||d.safari,o=/CriOS\/[\d]+/.test(navigator.userAgent);(o||t&&i||xt)&&"undefined"!=typeof FileReader?((s=new FileReader).onloadend=function(){var e=s.result,e=o?e:e.replace(/^data:[^;]*;/,"data:attachment/file;");r?r.location.href=e:location=e,r=null},s.readAsDataURL(e)):(a=d.URL||d.webkitURL,n=a.createObjectURL(e),r?r.location=n:location.href=n,r=null,setTimeout(function(){a.revokeObjectURL(n)},4e4))};class Ft extends Dt{constructor(e){super(),this.player=e;var t=document.createElement("canvas");t.style.position="absolute",t.style.top=0,t.style.left=0,this.$videoElement=t,e.$container.appendChild(this.$videoElement),this.context2D=null,this.contextGl=null,this.contextGlRender=null,this.contextGlDestroy=null,this.bitmaprenderer=null,this.renderType=null,this.controlHeight=0,this._initCanvasRender()}destroy(){super.destroy(),this.contextGl&&(this.contextGl=null),this.context2D&&(this.context2D=null),this.contextGlRender&&(this.contextGlDestroy&&this.contextGlDestroy(),this.contextGlDestroy=null,this.contextGlRender=null),this.bitmaprenderer&&(this.bitmaprenderer=null),this.renderType=null,this.videoInfo={width:"",height:"",encType:"",encTypeCode:""},this.player.$container.removeChild(this.$videoElement),this.init=!1,this.off()}_initContextGl(){var e;this.contextGl=function(e){let t=null;var i=["webgl","experimental-webgl","moz-webgl","webkit-3d"];let r=0;for(;!t&&r{(s=(s=ht(s)?{filename:s}:s)||{}).width=this.videoInfo.width,s.height=this.videoInfo.height,s.filename=s.filename||m(),s.format=s.format?l[s.format]:l.png,s.quality=Number(s.quality)||.92,s.type=s.type||o.download;const r=this.$videoElement.toDataURL(s.format,s.quality);nt(r,s).then(e=>{if(s.type===o.base64)t(r);else{const r=ze(e);if(s.type===o.blob)t(r);else if(s.type===o.download){t();const e=s.format.split("/")[1];Pt(r,s.filename+"."+e)}}}).catch(e=>{i(e)})})}render(){}clearView(){}play(){}pause(){}resize(){this.player.debug.log("canvasVideo","resize");var e=this.player._opt;let t=this.player.width,i=this.player.height;if(e.hasControl&&!e.controlAutoHide){const r=this.controlHeight;S()&&this.player.fullscreen&&e.useWebFullScreen?t-=r:i-=r}let r=this.$videoElement.width,s=this.$videoElement.height;var a=e.rotate,n=(t-r)/2,o=(i-s)/2,l=(270!==a&&90!==a||(r=this.$videoElement.height,s=this.$videoElement.width),t/r),c=i/s;let u=c{"text"===e.type?(t.font=`${e.fontSize||12}px Arial`,t.fillStyle=e.color||"green",t.fillText(e.text,e.x,e.y)):"rect"===e.type&&(t.strokeStyle=e.color||"green",t.lineWidth=e.lineWidth||2,t.strokeRect(e.x,e.y,e.width,e.height))}),t.restore()}}}class Ot extends Ft{constructor(e){super(e),this.yuvList=[],this.controlHeight=38,this.player.debug.log("CanvasVideo","init")}destroy(){super.destroy(),this.yuvList=[],this.player.debug.log("CanvasVideoLoader","destroy")}_initContext2D(){this.context2D=this.$videoElement.getContext("2d",0{this.context2D.drawImage(e,0,0,this.$videoElement.width,this.$videoElement.height),gt(t.videoFrame)})}catch(t){}else this.context2D.drawImage(t.videoFrame,0,0,this.$videoElement.width,this.$videoElement.height),gt(t.videoFrame);break;case me:case"hls":this.context2D.drawImage(t.$video,0,0,this.$videoElement.width,this.$videoElement.height)}}clearView(){switch(this.renderType){case Ae:e=this.$videoElement.width,t=this.$videoElement.height,(i=document.createElement("canvas")).width=e,i.height=t,window.createImageBitmap(i,0,0,e,t).then(e=>{this.bitmaprenderer.transferFromImageBitmap(e)});break;case fe:this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT);break;case pe:case me:case"hls":this.context2D.clearRect(0,0,this.$videoElement.width,this.$videoElement.height)}var e,t,i}}class _t extends Dt{constructor(t){super(),this.player=t;var e=document.createElement("video"),i=document.createElement("canvas"),i=(e.muted=!0,e.style.position="absolute",e.style.top=0,e.style.left=0,this._delayPlay=!1,t.$container.appendChild(e),this.$videoElement=e,this.$canvasElement=i,this.canvasContext=i.getContext("2d"),this.mediaStream=null,t.canVideoTrackWritter()&&tt()&&(this.trackGenerator=new MediaStreamTrackGenerator({kind:"video"}),this.mediaStream=new MediaStream([this.trackGenerator]),e.srcObject=this.mediaStream,this.vwriter=this.trackGenerator.writable.getWriter()),this.fixChromeVideoFlashBug(),this.resize(),this.eventListenList=[],this.player.events)["proxy"],e=i(this.$videoElement,"canplay",()=>{this.player.debug.log("Video","canplay"),this._delayPlay&&this._play()}),r=i(this.$videoElement,"waiting",()=>{this.player.debug.log("Video","waiting")}),s=i(this.$videoElement,"loadedmetadata",()=>{this.player.debug.log("Video","loadedmetadata")}),a=i(this.$videoElement,"timeupdate",e=>{e=parseInt(e.timeStamp,10);(this.player._opt.isWebrtc||this.player._opt.isHls)&&this.player.emit(v.timeUpdate,e),t._opt.isWebrtc&&t.handleRender()}),i=i(this.$videoElement,"error",()=>{this.player.debug.error("Video","Error "+this.$videoElement.error.code+"; details: "+this.$videoElement.error.message)});this.eventListenList.push(e,r,a,i,s),this.player.debug.log("Video","init")}destroy(){super.destroy(),this.eventListenList&&(this.eventListenList.forEach(e=>{e()}),this.eventListenList=[]),this.$canvasElement=null,this.canvasContext=null,this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.player.$container.removeChild(this.$videoElement),this.$videoElement=null),this.trackGenerator&&(this.trackGenerator.stop(),this.trackGenerator=null),this.vwriter&&(this.vwriter.close(),this.vwriter=null),this._delayPlay=!1,this.mediaStream&&(this.mediaStream.getTracks().forEach(e=>e.stop()),this.mediaStream=null),this.off(),this.player.debug.log("Video","destroy")}fixChromeVideoFlashBug(){const e=Qe().type.toLowerCase();if("chrome"===e||"edge"===e){const e=this.player.$container;e.style.backdropFilter="blur(0px)",e.style.translateZ="0"}}isPause(){let e=!0;return e=this.$videoElement?this.$videoElement.paused:e}_getVideoReadyState(){let e=0;return e=this.$videoElement?this.$videoElement.readyState:e}_getVideoCurrentTime(){let e=0;return e=this.$videoElement?this.$videoElement.currentTime:e}play(){var e;this.$videoElement&&(e=this._getVideoReadyState(),this.player.debug.log("Video","play and readyState: "+e),0===e?(this.player.debug.warn("Video","readyState is 0 and set _delayPlay to true"),this._delayPlay=!0):this._play())}_play(){this.$videoElement&&this.$videoElement.play().then(()=>{this._delayPlay=!1,this.player.debug.log("Video","_play success"),setTimeout(()=>{this.isPlaying()||(this.player.debug.warn("Video","play failed and retry play"),this._play())},100)}).catch(e=>{this.player.debug.error("Video","_play error",e)})}pause(e){this.isPlaying()&&(e?this.$videoElement&&this.$videoElement.pause():setTimeout(()=>{this.$videoElement&&this.$videoElement.pause()},100))}clearView(){this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$videoElement.srcObject)&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject"))}screenshot(e,t,i,r){e=e||m(),r=r||o.download;let s=.92;!l[t]&&o[t]&&(r=t,t="png",i=void 0),"string"==typeof i&&(r=i,i=void 0),void 0!==i&&(s=Number(i));var i=this.$videoElement,a=this.$canvasElement,n=(a.width=i.videoWidth,a.height=i.videoHeight,this.canvasContext.drawImage(i,0,0,a.width,a.height),l[t]||l.png),i=a.toDataURL(n,s);if(this.canvasContext.clearRect(0,0,a.width,a.height),a.width=0,a.height=0,r===o.base64)return i;{const t=ze(i);if(r===o.blob)return t;if(r===o.download){const i=n.split("/")[1];Pt(t,e+"."+i)}}}screenshotWatermark(a){return new Promise((i,t)=>{ht(a)&&(a={filename:a});var e=this.$videoElement,r=((a=a||{}).width=e.videoWidth,a.height=e.videoHeight,a.filename=a.filename||m(),a.format=a.format?l[a.format]:l.png,a.quality=Number(a.quality)||.92,a.type=a.type||o.download,this.$canvasElement);r.width=e.videoWidth,r.height=e.videoHeight,this.canvasContext.drawImage(e,0,0,r.width,r.height);const s=r.toDataURL(a.format,a.quality);this.canvasContext.clearRect(0,0,r.width,r.height),r.width=0,r.height=0,nt(s,a).then(e=>{if(a.type===o.base64)i(s);else{var t=ze(e);if(a.type===o.blob)i(t);else if(a.type===o.download){i();const e=a.format.split("/")[1];Pt(t,a.filename+"."+e)}}}).catch(e=>{t(e)})})}initCanvasViewSize(){this.resize()}clear(){var e=this.$videoElement,t=e.buffered,t=t.length?t.end(t.length-1):0;e.currentTime=t}render(t){if(this.vwriter){if(this.$videoElement.srcObject||(this.$videoElement.srcObject=this.mediaStream),this.$videoElement.paused&&this.player.debug.warn("Video","render error, video is paused"),this.player.videoTimestamp=t.ts||0,this.player.updateStats({fps:!0,ts:t.ts||0}),t.videoFrame)this.vwriter.write(t.videoFrame),gt(t.videoFrame);else if(t.output){let e=t.output;i=e=this.player.faceDetectActive&&this.player.ai&&this.player.ai.faceDetector?this.player.ai.faceDetector.detect({width:this.videoInfo.width,height:this.videoInfo.height,data:t.output}):e,t={format:"I420",codedWidth:this.videoInfo.width,codedHeight:this.videoInfo.height,timestamp:t.ts};i=new VideoFrame(i,t);this.vwriter.write(i),gt(i)}}else this.player.debug.warn("Video","render and this.vwriter is null");var i}resize(){let e=this.player.width,t=this.player.height;const i=this.player._opt,r=i.rotate;if(i.hasControl&&!i.controlAutoHide){const r=i.playType===y?48:38;S()&&this.player.fullscreen&&i.useWebFullScreen?e-=r:t-=r}this.$videoElement.width=e,this.$videoElement.height=t,270!==r&&90!==r||(this.$videoElement.width=t,this.$videoElement.height=e);let s=(e-this.$videoElement.width)/2,a=(t-this.$videoElement.height)/2,n="contain",o=(i.isResize||(n="fill"),i.isFullResize&&(n="none"),"");"none"===i.mirrorRotate&&r&&(o+=" rotate("+r+"deg)"),"level"===i.mirrorRotate?o+=" rotateY(180deg)":"vertical"===i.mirrorRotate&&(o+=" rotateX(180deg)"),this.$videoElement.style.objectFit=n,this.$videoElement.style.transform=o,this.$videoElement.style.left=s+"px",this.$videoElement.style.top=a+"px"}getType(){return"video"}isPlaying(){return this.$videoElement&&!this.$videoElement.paused}}class Mt extends Ft{constructor(e){super(e),this.controlHeight=48,this.bufferList=[],this.playing=!1,this.playInterval=null,this.fps=1,this.preFps=1,this.streamFps=0,this.playbackRate=1,this._firstTimestamp=null,this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,this.player.on(v.playbackPause,e=>{e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()}),this.player.debug.log("CanvasPlaybackLoader","init")}destroy(){this._stopSync(),this._firstTimestamp=null,this.playing=!1,this.playbackRate=1,this.fps=1,this.preFps=1,this.bufferList=[],this._renderFps=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._hasCalcFps=!1,super.destroy(),this.player.debug.log("CanvasPlaybackLoader","destroy")}_initCanvasRender(){this.renderType=fe,this._initContextGl()}_sync(){this._stopSync(),this._doPlay(),this.playInterval=setInterval(()=>{this._doPlay()},this.fragDuration)}_doPlay(){var e;0 `+this.fps),this.player.playback.isUseFpsRender&&this._sync()):this.player.debug.log("CanvasPlaybackLoader","setFps, same fps "+e)}setStreamFps(e){this.player.debug.log("CanvasPlaybackLoader","setStreamFps",e),this._hasCalcFps=!0,this.streamFps=e,this.preFps=e,this.setFps(e)}setRate(e){e!==this.playbackRate&&(this.playbackRate=e,this.player.playback.isUseFpsRender)&&this._sync()}render$2(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);var t={tfTs:e.ts-this._firstTimestamp,ts:e.ts,buffer:e.output};this.bufferList.push(t),this.startRender(),this.player.handleRender(),this.player.playback.updateStats({ts:e.ts,tfTs:t.tfTs})}startRender(){for(;!(this.bufferList.length<=0);){var e=this.bufferList.shift();this._doRender(e.buffer)}}pushData(e){null===this._firstTimestamp&&(this._firstTimestamp=e.ts);const t={tfTs:e.ts-this._firstTimestamp,ts:e.ts,buffer:e.output},i=this.player._opt.playbackConfig.isCacheBeforeDecodeForFpsRender;if(i||this.bufferSize>this.fps*this.playbackRate*2&&(this.player.debug.warn("CanvasPlaybackLoader","buffer size is "+this.bufferSize),this._doPlay()),this.bufferList.push(t),!this._hasCalcFps){const e=function(i){let r=i[0],s=null,e=1;var t;if(0{this.initVideo()},e):this.initVideo()}clearView(){this.contextGl.clear(this.contextGl.COLOR_BUFFER_BIT)}clear(){this.bufferList=[]}resume(){this.player.playback.isUseFpsRender&&this._sync(),this.playing=!0}pause(){this.player.playback.isUseFpsRender&&this._stopSync(),this.playing=!1}}class Ut{constructor(e){return new(Ut.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.useMSE?e.mseUseCanvasRender?Ot:_t:e.isHls?e.useCanvasRender?Ot:_t:e.isWebrtc?_t:e.useWCS?!e.useOffscreen&&e.wcsUseVideoRender?_t:Ot:e.playType===y?Mt:e.wasmUseVideoRender&&!e.useOffscreen?_t:Ot}}class jt extends t{constructor(e){super(),this.bufferList=[],this.player=e,this.scriptNode=null,this.workletProcessorNode=null,this.hasInitScriptNode=!1,this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:48e3}),this.gainNode=this.audioContext.createGain();e=this.audioContext.createBufferSource();e.buffer=this.audioContext.createBuffer(1,1,22050),e.connect(this.audioContext.destination),e.noteOn?e.noteOn(0):e.start(0),this.audioBufferSourceNode=e,this.mediaStreamAudioDestinationNode=this.audioContext.createMediaStreamDestination(),this.audioEnabled(!0),this.gainNode.gain.value=0,this.playing=!1,this.audioSyncVideoOption={diff:null},this.audioInfo={encType:"",channels:"",sampleRate:""},this.init=!1,this.hasAudio=!1,this.on(v.videoSyncAudio,e=>{this.audioSyncVideoOption=e})}resetInit(){this.audioInfo={encType:"",channels:"",sampleRate:""},this.init=!1}destroy(){this.closeAudio(),this.resetInit(),this.audioContext.close(),this.audioContext=null,this.gainNode=null,this.hasAudio=!1,this.playing=!1,this.scriptNode&&(this.scriptNode.onaudioprocess=Ge,this.scriptNode=null),this.workletProcessorNode&&(this.workletProcessorNode.port.onmessage=Ge,this.workletProcessorNode=null),this.audioBufferSourceNode=null,this.mediaStreamAudioDestinationNode=null,this.hasInitScriptNode=!1,this.audioSyncVideoOption={diff:null},this.off()}updateAudioInfo(e){e.encTypeCode&&(this.audioInfo.encType=de[e.encTypeCode]),e.channels&&(this.audioInfo.channels=e.channels),e.sampleRate&&(this.audioInfo.sampleRate=e.sampleRate),this.audioInfo.sampleRate&&this.audioInfo.channels&&this.audioInfo.encType&&!this.init&&(this.player.emit(v.audioInfo,this.audioInfo),this.init=!0)}get isPlaying(){return this.playing}get isMute(){return 0===this.gainNode.gain.value}get volume(){return this.gainNode.gain.value}get bufferSize(){return this.bufferList.length}initScriptNode(){}initMobileScriptNode(){}initWorkletScriptNode(){}getEngineType(){return""}mute(e){e?(this.isMute||this.player.emit(v.mute,e),this.setVolume(0),this.clear()):(this.isMute&&this.player.emit(v.mute,e),this.audioEnabled(!0),this.setVolume(.5))}setVolume(e){e=parseFloat(e).toFixed(2),isNaN(e)||(this.audioEnabled(!0),e=b(e,0,1),this.gainNode.gain.value=e,this.player.emit(v.volumechange,this.player.volume))}closeAudio(){this.hasInitScriptNode&&(this.scriptNode&&this.scriptNode.disconnect(this.gainNode),this.workletProcessorNode&&this.workletProcessorNode.disconnect(this.gainNode),this.gainNode&&this.gainNode.disconnect(this.audioContext.destination),this.gainNode)&&this.gainNode.disconnect(this.mediaStreamAudioDestinationNode),this.clear()}audioEnabled(e){e?this.isStateSuspended()&&this.audioContext.resume():this.isStateRunning()&&this.audioContext.suspend()}isStateRunning(){return"running"===this.audioContext.state}isStateSuspended(){return"suspended"===this.audioContext.state}clear(){this.bufferList=[]}play(e,t){}pause(){this.audioSyncVideoOption={diff:null},this.playing=!1}resume(){this.playing=!0}setRate(e){}getAudioBufferSize(){return 0}}class Nt{constructor(e,t,i,r){this.player=e,this.audio=t,this.channel=i,this.bufferSize=r}extract(t,e){var i=this.provide(e);for(let e=0;en){for(let e=0;ethis._frameCount)||(e=this.frameCount),this._frameCount-=e,this._position+=e}receiveSamples(e){var t=1=e-1)break e;var o=i+2*a;r[s+2*n]=(1-this.slopeCount)*t[o]+this.slopeCount*t[o+2],r[s+2*n+1]=(1-this.slopeCount)*t[o+1]+this.slopeCount*t[o+3],n+=1,this.slopeCount+=this._rate}return this.prevSampleL=t[i+2*e-2],this.prevSampleR=t[i+2*e-1],n}}function Gt(){}class zt extends class{constructor(e){this._pipe=e}get pipe(){return this._pipe}get inputBuffer(){return this._pipe.inputBuffer}get outputBuffer(){return this._pipe.outputBuffer}fillInputBuffer(){throw new Error("fillInputBuffer() not overridden")}fillOutputBuffer(){let e=0this._position)throw new RangeError("New position may not be greater than current position");var t=this.outputBufferPosition-(this._position-e);if(t<0)throw new RangeError("New position falls outside of history buffer");this.outputBufferPosition=t,this._position=e}get sourcePosition(){return this._sourcePosition}set sourcePosition(e){this.clear(),this._sourcePosition=e}onEnd(){this.callback()}fillInputBuffer(){var e=0t&&(t=i,e=r);return e}seekBestOverlapPositionStereoQuick(){let t,i,r,s,a,n=0;for(this.preCalculateCorrelationReferenceStereo(),i=Number.MIN_VALUE,t=0,s=0,a=0;n<4;n+=1){let e=0;for(;Kt[n][e]&&!((a=s+Kt[n][e])>=this.seekLength);)(r=this.calculateCrossCorrelationStereo(2*a,this.refMidBuffer))>i&&(i=r,t=a),e+=1;s=t}return t}preCalculateCorrelationReferenceStereo(){let e,t,i=0;for(;i=this.sampleReq;){e=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(e)),this._outputBuffer.put(this.overlapLength),0<(t=this.seekWindowLength-2*this.overlapLength)&&this._outputBuffer.putBuffer(this._inputBuffer,e+this.overlapLength,t);var t=this._inputBuffer.startIndex+2*(e+this.seekWindowLength-this.overlapLength);this.midBuffer.set(this._inputBuffer.vector.subarray(t,t+2*this.overlapLength)),this.skipFract+=this.nominalSkip,e=Math.floor(this.skipFract),this.skipFract-=e,this._inputBuffer.receive(e)}}}function Jt(e,t){return 1e-10<(tthis.defaultPlaybackRate}initProcessScriptNode(){this.engineType=_e;var e=this.audioContext.createScriptProcessor(this.audioBufferSize,0,this.audioInfo.channels);e.onaudioprocess=e=>{e=e.outputBuffer;this.handleScriptNodeCallback(e)},e.connect(this.gainNode),this.scriptNode=e,this.gainNode.connect(this.audioContext.destination),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.hasInitScriptNode=!0}initIntervalScriptNode(){this.scriptStartTime=0,this.engineType=Me;var e=1e3*this.audioBufferSize/this.audioContext.sampleRate;this.scriptNodeInterval=setInterval(()=>{const e=this.audioContext.createBufferSource(),t=this.audioContext.createBuffer(this.audioInfo.channels,this.audioBufferSize,this.audioContext.sampleRate);this.handleScriptNodeCallback(t,()=>{this.scriptStartTime{"init"===e.data.message?(this.audioBufferSize=e.data.audioBufferSize,this.start=e.data.start,this.channels=e.data.channels,this.state=0,this.offset=0,this.samplesArray=[]):"stop"===e.data.message?(this.state=0,this.start=!1,this.offset=0,this.samplesArray=[]):"data"===e.data.message?this.samplesArray.push(e.data.buffer):"zero"===e.data.message&&this.samplesArray.push({left:new Float32Array(this.audioBufferSize).fill(0),right:new Float32Array(this.audioBufferSize).fill(0)})}}process(t,e,i){var r=e[0][0],s=e[0][1];if(0===this.offset&&this.port.postMessage({message:"beep"}),0===this.state)this.state=1;else if(1===this.state&&4<=this.samplesArray.length)this.state=2;else if(2===this.state){const t=this.samplesArray[0];for(let e=0;e{if(this.audioContext){let e=[1];2===this.audioInfo.channels&&(e=[1,1]),this.workletProcessorNode=new AudioWorkletNode(this.audioContext,"worklet-processor",{numberOfOutputs:this.audioInfo.channels,outputChannelCount:e}),this.workletProcessorNode.connect(this.gainNode),this.gainNode.connect(this.audioContext.destination),this.gainNode.connect(this.mediaStreamAudioDestinationNode),this.hasInitScriptNode=!0,this.workletProcessorNode.port.postMessage({message:"init",audioBufferSize:this.audioBufferSize,start:!0,channels:this.audioInfo.channels}),this.workletProcessorNode.port.onmessage=e=>{this.workletProcessorNode?this.audioContext?this.handleScriptNodeCallback(this.workletProcessorNode,null,!0):this.workletProcessorNode.port.postMessage({message:"zero"}):this.player.debug.error("AudioContext","workletProcessorNode is null")}}else this.player.debug.error("AudioContext","initWorkletScriptNode audioContext is null")})}handleScriptNodeCallback(e,t){let i,r=2t?(this.player.debug.warn("AudioContext",`bufferList length ${this.bufferList.length} more than ${t}, speed up`),e=this.defaultPlaybackRate+.1):this.bufferList.length{this.listenPlaybackPause(e)}),this.player.debug.log("AudioPlaybackContext","init")}destroy(){super.destroy(),this.player.debug.log("AudioPlaybackLoader","destroy")}listenPlaybackPause(e){e?(this.pause(),this.player.playback.isPlaybackPauseClearCache&&this.clear()):this.resume()}initScriptNodeDelay(){var e=this.player._opt.playbackDelayTime;0{this.initScriptNode()},e):this.initScriptNode()}setRate(e){e!==this.defaultPlaybackRate&&this.rateProcessor&&(this.player.debug.log("AudioPlaybackContext","setRate",e),this.defaultPlaybackRate=e,this.updatePlaybackRate(e))}play(e,t){this.isMute||(this.hasAudio=!0,this.bufferList.push({buffer:e,ts:t}),this.player._opt.syncAudioAndVideo)||this.calcPlaybackRateByBuffer()}}class ei{constructor(e){return new(ei.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.playType===y?$t:e.isHls||e.isWebrtc?Zt:Yt}}class ti extends t{constructor(t){super(),this.player=t,this.playing=!1,this.abortController=new AbortController,this.streamRate=Je(e=>{t.emit(v.kBps,(e/1024).toFixed(2))}),this.streamRateInterval=null,t.debug.log("FetchStream","init")}destroy(){this.abort(),this.off(),this.streamRate=null,this.stopStreamRateInterval(),this.player.debug.log("FetchStream","destroy")}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval(()=>{this.streamRate&&this.streamRate(0)},1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}fetchStream(e){var t=1{if(e.ok&&200<=e.status&&e.status<=299)if(this.emit(v.streamSuccess),this.startStreamRateInterval(),"undefined"!=typeof WritableStream)e.body.pipeTo(new WritableStream({write:e=>(this.streamRate&&this.streamRate(e.byteLength),r.dispatch(e)),close:()=>{r.close()},abort:e=>{r.close();var t=e.toString();-1===t.indexOf(Ie)&&-1===t.indexOf(Be)&&e.name!==xe&&(this.abort(),this.emit(A.fetchError,e),this.player.emit(v.error,A.fetchError))}}));else{this.player.debug.log("FetchStream","not support WritableStream and use getReader() to read stream");const t=e.body.getReader(),i=()=>{t.read().then(e=>{var{done:e,value:t}=e;e?r.close():(this.streamRate&&this.streamRate(t.byteLength),r.dispatch(t),i())}).catch(e=>{r.close();var t=e.toString();-1===t.indexOf(Ie)&&-1===t.indexOf(Be)&&e.name!==xe&&(this.abort(),this.emit(A.fetchError,e),this.player.emit(v.error,A.fetchError))})};i()}else this.player.debug.error("FetchStream",`fetch response status is ${e.status} and ok is ${e.ok} and emit error and next abort()`),this.abort(),this.emit(A.fetchError,`fetch response status is ${e.status} and ok is `+e.ok),this.player.emit(v.error,A.fetchError)}).catch(e=>{"AbortError"!==e.name&&(r.close(),this.abort(),this.emit(A.fetchError,e),this.player.emit(v.error,A.fetchError))})}abort(){this.abortController&&(this.abortController.abort(),this.abortController=null)}getStreamType(){return _}}class ii extends t{constructor(t){super(),this.player=t,this.socket=null,this.socketStatus=se,this.wsUrl=null,this.socketDestroyFnList=[],this.streamRate=Je(e=>{t.emit(v.kBps,(e/1024).toFixed(2))}),this.streamRateInterval=null,t.debug.log("WebsocketStream","init")}destroy(){this._closeWebSocket(),this.stopStreamRateInterval(),this.wsUrl=null,this.off(),this.player.debug.log("WebsocketStream","destroy")}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval(()=>{this.streamRate&&this.streamRate(0)},1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebSocket(){const e=this.player,{debug:t,events:{proxy:i},demux:r}=e;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer";var s=i(this.socket,"open",()=>{t.log("WebsocketStream","socket open"),this.socketStatus=ae,this.emit(v.streamSuccess),this.player.emit(v.websocketOpen),this.startStreamRateInterval()}),a=i(this.socket,"message",e=>{this.streamRate&&this.streamRate(e.data.byteLength),this._handleMessage(e.data)}),n=i(this.socket,"close",()=>{t.log("WebsocketStream","socket close"),this.socketStatus="close",this.emit(v.streamEnd)}),o=i(this.socket,"error",e=>{t.log("WebsocketStream","socket error"),this.socketStatus="error",this.emit(A.websocketError,e),this.player.emit(v.error,A.websocketError),r.close(),t.log("WebsocketStream","socket error:",e)});this.socketDestroyFnList.push(s,a,n,o)}_closeWebSocket(){this.socketDestroyFnList.forEach(e=>e()),this.socket&&(this.socket.close(),this.socket=null),this.socketStatus=se,this.streamRate=null}_handleMessage(e){var t=this.player["demux"];t?t.dispatch(e):this.player.debug.warn("WebsocketStream","websocket handle message demux is null")}fetchStream(e,t){this.player._times.streamStart=m(),this.wsUrl=e,this._createWebSocket()}sendMessage(e){this.socket?this.socketStatus===ae?this.socket.send(e):this.player.debug.error("WebsocketStream","websocket send message error and socket status is "+this.socketStatus):this.player.debug.error("WebsocketStream","websocket send message socket is null")}resetFetchStream(){this._closeWebSocket(),this._createWebSocket()}getStreamType(){return M}}class ri extends t{constructor(e){super(),(this.player=e).debug.log("HlsStream","init")}destroy(){this.off(),this.player.debug.log("HlsStream","destroy")}fetchStream(e){var t=this.player["hlsDecoder"];this.player._times.streamStart=m(),t.loadSource(e).then(()=>{this.player.debug.log("HlsStream","loadSource success"),this.emit(v.streamSuccess)}).catch(e=>{this.emit(A.hlsError,e),this.emit(v.error,A.hlsError)})}getStreamType(){return"hls"}}class si extends t{constructor(e){super(),this.player=e,this.webrctUrl=null,e.debug.log("WebrtcStream","init")}destroy(){this.webrctUrl=null,this.off(),this.player.debug.log("WebrtcStream","destroy")}fetchStream(e){var t=this.player["webrtc"];this.player._times.streamStart=m(),this.webrctUrl=e.replace("webrtc:",window.location.protocol),t.loadSource(this.webrctUrl).then(()=>{this.player.debug.log("WebrtcStream","loadSource success"),this.emit(v.streamSuccess)}).catch(e=>{this.emit(A.webrtcError,e),this.emit(v.error,A.webrtcError)})}getStreamType(){return"webrtc"}}class ai extends t{constructor(t){super(),this.player=t,this.transport=null,this.wtUrl=null,this.streamRate=Je(e=>{t.emit(v.kBps,(e/1024).toFixed(2))}),this.streamRateInterval=null,t.debug.log("WebTransportLoader","init")}destroy(){this.abort(),this.off(),this.player.debug.log("WebTransportLoader","destroy")}startStreamRateInterval(){this.stopStreamRateInterval(),this.streamRateInterval=setInterval(()=>{this.streamRate&&this.streamRate(0)},1e3)}stopStreamRateInterval(){this.streamRateInterval&&(clearInterval(this.streamRateInterval),this.streamRateInterval=null)}_createWebTransport(){const e=this.player,{events:{},demux:t}=e;try{this.transport=new WebTransport(this.wtUrl),this.transport.ready.then(()=>{this.emit(v.streamSuccess),this.startStreamRateInterval(),this.transport.createBidirectionalStream().then(e=>{e.readable.pipeTo(new WritableStream(t.input))})}).catch(e=>{this.player.debug.warn("WebTransportLoader","_createWebTransport-ready",e)})}catch(e){this.player.debug.warn("WebTransportLoader","_createWebTransport",e)}}fetchStream(e){this.player._times.streamStart=m(),this.wtUrl=e.replace(/^wt/,"https"),this._createWebTransport()}abort(){if(this.transport)try{this.transport.close(),this.transport=null}catch(e){this.transport=null}}getStreamType(){return"webTransport"}}class ni extends t{constructor(e){super(),this.player=e,this.workUrl=null,e.debug.log("WorkerStream","init")}destroy(){this.workUrl=null,this.player.debug.log("WorkerStream","destroy")}sendMessage(e){this.player.decoderWorker.workerSendMessage(e)}fetchStream(e){this.workUrl=e,this.player._times.streamStart=m(),this.player.decoderWorker.workerFetchStream(e)}getStreamType(){var e=this.player._opt.protocol;return U+" "+(2===e?_:M)}}class oi{constructor(e){return new(oi.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){var{protocol:t,useWasm:i,playType:r}=e;return 2===t?r!==n||i&&!At(e)?ni:ti:1===t?r!==n||i&&!At(e)?ni:ii:3===t?ri:4===t?si:5===t?ai:void 0}}var li=He(function(e){function T(i,s){if(!i)throw"First parameter is required.";s=new f(i,s=s||{type:"video"});var a=this;function t(e){e&&(s.initCallback=function(){e(),e=s.initCallback=null});var t=new A(i,s);(u=new t(i,s)).record(),c("recording"),s.disableLogs||console.log("Initialized recorderType:",u.constructor.name,"for output-type:",s.type)}function n(r){function e(e){if(u){Object.keys(u).forEach(function(e){"function"!=typeof u[e]&&(a[e]=u[e])});var t,i=u.blob;if(!i){if(!e)throw"Recording failed.";u.blob=i=e}if(i&&!s.disableLogs&&console.log(i.type,"->",y(i.size)),r){try{t=w.createObjectURL(i)}catch(e){}"function"==typeof r.call?r.call(a,t):r(t)}s.autoWriteToDisk&&l(function(e){var t={};t[s.type+"Blob"]=e,L.Store(t)})}else"function"==typeof r.call?r.call(a,""):r("")}r=r||function(){},u?"paused"===a.state?(a.resumeRecording(),setTimeout(function(){n(r)},1)):("recording"===a.state||s.disableLogs||console.warn('Recording state should be: "recording", however current state is: ',a.state),s.disableLogs||console.log("Stopped recording "+s.type+" stream."),"gif"!==s.type?u.stop(e):(u.stop(),e()),c("stopped")):d()}function o(e){postMessage((new FileReaderSync).readAsDataURL(e))}function l(t,e){if(!t)throw"Pass a callback function over getDataURL.";var i,r=(e||u||{}).blob;r?"undefined"==typeof Worker||navigator.mozGetUserMedia?((i=new FileReader).readAsDataURL(r),i.onload=function(e){t(e.target.result)}):((i=function(e){try{var t=w.createObjectURL(new Blob([e.toString(),"this.onmessage = function (eee) {"+e.name+"(eee.data);}"],{type:"application/javascript"})),i=new Worker(t);return w.revokeObjectURL(t),i}catch(e){}}(o)).onmessage=function(e){t(e.data)},i.postMessage(r)):(s.disableLogs||console.warn("Blob encoder did not finish its job yet."),setTimeout(function(){l(t,e)},1e3))}function r(e){e=e||0,"paused"!==a.state?"stopped"!==a.state&&(e>=a.recordingDuration?n(a.onRecordingStopped):(e+=1e3,setTimeout(function(){r(e)},1e3))):setTimeout(function(){r(e)},1e3)}function c(e){a&&(a.state=e,"function"==typeof a.onStateChanged.call?a.onStateChanged.call(a,e):a.onStateChanged(e))}var u,e='It seems that recorder is destroyed or "startRecording" is not invoked for '+s.type+" recorder.";function d(){!0!==s.disableLogs&&console.warn(e)}var h={startRecording:function(e){return s.disableLogs||console.log("RecordRTC version: ",a.version),(s=e?new f(i,e):s).disableLogs||console.log("started recording "+s.type+" stream."),u?(u.clearRecordedData(),u.record(),c("recording"),a.recordingDuration&&r()):t(function(){a.recordingDuration&&r()}),a},stopRecording:n,pauseRecording:function(){u?"recording"===a.state?(c("paused"),u.pause(),s.disableLogs||console.log("Paused recording.")):s.disableLogs||console.warn("Unable to pause the recording. Recording state: ",a.state):d()},resumeRecording:function(){u?"paused"===a.state?(c("recording"),u.resume(),s.disableLogs||console.log("Resumed recording.")):s.disableLogs||console.warn("Unable to resume the recording. Recording state: ",a.state):d()},initRecorder:t,setRecordingDuration:function(e,t){if(void 0===e)throw"recordingDuration is required.";if("number"!=typeof e)throw"recordingDuration must be a number.";return a.recordingDuration=e,a.onRecordingStopped=t||function(){},{onRecordingStopped:function(e){a.onRecordingStopped=e}}},clearRecordedData:function(){u?(u.clearRecordedData(),s.disableLogs||console.log("Cleared old recorded data.")):d()},getBlob:function(){if(u)return u.blob;d()},getDataURL:l,toURL:function(){if(u)return w.createObjectURL(u.blob);d()},getInternalRecorder:function(){return u},save:function(e){u?v(u.blob,e):d()},getFromDisk:function(e){u?T.getFromDisk(s.type,e):d()},setAdvertisementArray:function(e){s.advertisement=[];for(var t=e.length,i=0;i>=8;return new Uint8Array(t.reverse())}(e[i].id)),t.push(n(a)),t.push(r)}return new Blob(t,{type:"video/webm"})}function o(e){for(var t=0,i={};t 127 not supported";return[128|e.trackNum,e.timecode>>8,255&e.timecode,t].map(function(e){return String.fromCharCode(e)}).join("")+e.frame}({discardable:0,frame:e.data.slice(4),invisible:0,keyframe:1,lacing:0,trackNum:1,timecode:Math.round(i)});return i+=e.duration,{data:t,id:163}}))}(a,0,n)};r[1].data.push(l),a+=o}return c(r)}(e.map(function(e){var t=function(e){for(var t=e.RIFF[0].WEBP[0],i=t.indexOf("*"),r=0,s=[];r<4;r++)s[r]=t.charCodeAt(i+3+r);return{width:16383&(s[1]<<8|s[0]),height:16383&(s[3]<<8|s[2]),data:t,riff:e}}(o(atob(e.image.slice(23))));return t.duration=e.duration,t}));postMessage(e)}T.Whammy=C;var L={init:function(){var i,e,t,r=this;function s(e){e.createObjectStore(r.dataStoreName)}function a(){var e=i.transaction([r.dataStoreName],"readwrite");function t(t){e.objectStore(r.dataStoreName).get(t).onsuccess=function(e){r.callback&&r.callback(e.target.result,t)}}r.videoBlob&&e.objectStore(r.dataStoreName).put(r.videoBlob,"videoBlob"),r.gifBlob&&e.objectStore(r.dataStoreName).put(r.gifBlob,"gifBlob"),r.audioBlob&&e.objectStore(r.dataStoreName).put(r.audioBlob,"audioBlob"),t("audioBlob"),t("videoBlob"),t("gifBlob")}"undefined"!=typeof indexedDB&&void 0!==indexedDB.open?(e=this.dbName||location.href.replace(/\/|:|#|%|\.|\[|\]/g,""),(t=indexedDB.open(e,1)).onerror=r.onError,t.onsuccess=function(){(i=t.result).onerror=r.onError,i.setVersion&&1!==i.version?i.setVersion(1).onsuccess=function(){s(i),a()}:a()},t.onupgradeneeded=function(e){s(e.target.result)}):console.error("IndexedDB API are not available in this browser.")},Fetch:function(e){return this.callback=e,this.init(),this},Store:function(e){return this.audioBlob=e.audioBlob,this.videoBlob=e.videoBlob,this.gifBlob=e.gifBlob,this.init(),this},onError:function(e){console.error(JSON.stringify(e,null,"\t"))},dataStoreName:"recordRTC",dbName:null};function I(e,i){"undefined"==typeof GIFEncoder&&((t=document.createElement("script")).src="https://www.webrtc-experiment.com/gif-recorder.js",(document.body||document.documentElement).appendChild(t)),i=i||{};var t,r,s=e instanceof CanvasRenderingContext2D||e instanceof HTMLCanvasElement,a=(this.record=function(){"undefined"!=typeof GIFEncoder&&l?(s||(i.width||(i.width=r.offsetWidth||320),i.height||(i.height=r.offsetHeight||240),i.video||(i.video={width:i.width,height:i.height}),i.canvas||(i.canvas={width:i.width,height:i.height}),n.width=i.canvas.width||320,n.height=i.canvas.height||240,r.width=i.video.width||320,r.height=i.video.height||240),(u=new GIFEncoder).setRepeat(0),u.setDelay(i.frameRate||200),u.setQuality(i.quality||10),u.start(),"function"==typeof i.onGifRecordingStarted&&i.onGifRecordingStarted(),d=p(function e(t){if(!0!==h.clearedRecordedData){if(a)return setTimeout(function(){e(t)},100);d=p(e),t-c<90||(!s&&r.paused&&r.play(),s||o.drawImage(r,0,0,n.width,n.height),i.onGifPreview&&i.onGifPreview(n.toDataURL("image/png")),u.addFrame(o),c=t)}}),i.initCallback&&i.initCallback()):setTimeout(h.record,1e3)},!(this.stop=function(e){e=e||function(){},d&&m(d),this.blob=new Blob([new Uint8Array(u.stream().bin)],{type:"image/gif"}),e(this.blob),u.stream().bin=[]})),n=(this.pause=function(){a=!0},this.resume=function(){a=!1},this.clearRecordedData=function(){h.clearedRecordedData=!0,u&&(u.stream().bin=[])},this.name="GifRecorder",this.toString=function(){return this.name},document.createElement("canvas")),o=n.getContext("2d"),l=(s&&(e instanceof CanvasRenderingContext2D?n=(o=e).canvas:e instanceof HTMLCanvasElement&&(o=e.getContext("2d"),n=e)),!0);s||((r=document.createElement("video")).muted=!0,r.autoplay=!0,r.playsInline=!0,l=!1,r.onloadedmetadata=function(){l=!0},S(e,r),r.play());var c,u,d=null,h=this}function B(r,s){s=s||"multi-streams-mixer";var a=[],n=!1,o=document.createElement("canvas"),l=o.getContext("2d"),c=(o.style.opacity=0,o.style.position="absolute",o.style.zIndex=-1,o.style.top="-1000em",o.style.left="-1000em",o.className=s,(document.body||document.documentElement).appendChild(o),this.disableLogs=!1,this.frameInterval=10,this.width=360,this.height=240,this.useGainNode=!0,this),e=window.AudioContext;void 0===e&&("undefined"!=typeof webkitAudioContext&&(e=webkitAudioContext),"undefined"!=typeof mozAudioContext)&&(e=mozAudioContext);window.URL,"undefined"!=typeof navigator&&void 0===navigator.getUserMedia&&(void 0!==navigator.webkitGetUserMedia&&(navigator.getUserMedia=navigator.webkitGetUserMedia),void 0!==navigator.mozGetUserMedia)&&(navigator.getUserMedia=navigator.mozGetUserMedia);var u=window.MediaStream,d=(void 0!==(u=void 0===u&&"undefined"!=typeof webkitMediaStream?webkitMediaStream:u)&&void 0===u.prototype.stop&&(u.prototype.stop=function(){this.getTracks().forEach(function(e){e.stop()})}),{});function h(){var e,t,i;n||(e=a.length,t=!1,i=[],a.forEach(function(e){e.stream||(e.stream={}),e.stream.fullcanvas?t=e:i.push(e)}),t?(o.width=t.stream.width,o.height=t.stream.height):i.length?(o.width=1>>32-e,this._current_word<<=e,this._current_word_bits_left-=e,t):(t=this._current_word_bits_left?this._current_word:0,t>>>=32-this._current_word_bits_left,e=e-this._current_word_bits_left,this._fillCurrentWord(),e=Math.min(e,this._current_word_bits_left),i=this._current_word>>>32-e,this._current_word<<=e,this._current_word_bits_left-=e,t<>>e))return this._current_word<<=e,this._current_word_bits_left-=e,e;return this._fillCurrentWord(),e+this._skipLeadingZero()}readUEG(){var e=this._skipLeadingZero();return this.readBits(e+1)-1}readSEG(){var e=this.readUEG();return 1&e?e+1>>>1:-1*(e>>>1)}}class P{static _ebsp2rbsp(e){let t=e,i=t.byteLength,r=new Uint8Array(i),s=0;for(let e=0;e=this.buflen)return this.iserro=!0,0;this.iserro=!1,i=8>8-this.bufoff-i&255>>8-i),this.bufoff+=i,e-=i,8==this.bufoff&&(this.bufpos++,this.bufoff=0)}return t}look(e){var t=this.bufpos,i=this.bufoff,e=this.read(e);return this.bufpos=t,this.bufoff=i,e}read_golomb(){let e;for(e=0;0===this.read(1)&&!this.iserro;e++);return(1<>>24&255,t>>>16&255,t>>>8&255,255&t]),e=new Uint8Array(t+4);e.set(i,0),e.set(s.sps,4),s.sps=e}if(s.pps){const t=s.pps.byteLength,i=new Uint8Array([t>>>24&255,t>>>16&255,t>>>8&255,255&t]),e=new Uint8Array(t+4);e.set(i,0),e.set(s.pps,4),s.pps=e}return s}function hi(e){var t=e.byteLength,i=new Uint8Array(4),t=(i[0]=t>>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,new Uint8Array(t+4));return t.set(i,0),t.set(e,4),t}function h(e){return 31&e[0]}function pi(e){return e===he}function fi(e){return 7!==e&&8!==e&&!pi(e)}const Ai=e=>{let t=e,i=t.byteLength,r=new Uint8Array(i),s=0;for(let e=0;e>6&3,s.general_tier_flag=e[1]>>5&1,s.general_profile_idc=31&e[1],s.general_profile_compatibility_flags=e[2]<<24|e[3]<<16|e[4]<<8|e[5],s.general_constraint_indicator_flags=e[6]<<24|e[7]<<16|e[8]<<8|e[9],s.general_constraint_indicator_flags=s.general_constraint_indicator_flags<<16|e[10]<<8|e[11],s.general_level_idc=e[12],s.min_spatial_segmentation_idc=(15&e[13])<<8|e[14],s.parallelismType=3&e[15],s.chromaFormat=3&e[16],s.bitDepthLumaMinus8=7&e[17],s.bitDepthChromaMinus8=7&e[18],s.avgFrameRate=e[19]<<8|e[20],s.constantFrameRate=e[21]>>6&3,s.numTemporalLayers=e[21]>>3&7,s.temporalIdNested=e[21]>>2&1,s.lengthSizeMinusOne=3&e[21];let t=e[22],i=e.slice(23);for(let e=0;e>1}class yi extends t{constructor(e){super(),this.player=e,this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.recordingInterval=null,this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.mdatBytesLength=0,this.metaInfo={codecWidth:0,codecHeight:0,presentWidth:0,presentHeight:0,refSampleDuration:0,timescale:1e3,avcc:null,videoType:""}}destroy(){this._reset()}get isH264(){return 7===this.codecId}get isH265(){return 12===this.codecId}setFileName(e){this.fileName=e}get isRecording(){return this._isRecording}get recording(){return this._isRecording}get recordTime(){return this._recordingTimestamp}startRecord(){}handleAddNaluTrack(e,t,i,r){}handleAddTrack(e){}stopRecordAndSave(){}startRecordingInterval(){}stopRecordingInterval(){this.recordingInterval&&clearInterval(this.recordingInterval),this.recordingInterval=null}getToTalByteLength(){}_reset(){this.fileName="",this._isRecording=!1,this._recordingTimestamp=0,this.stopRecordingInterval(),this.sps=null,this.pps=null,this.vps=null,this.codecId=null,this.mdatBytesLength=0}initMetaData(e,t){let i;var r=e.slice(5);if(this.codecId=t,this.metaInfo.avcc=r,7===t)i=di(r);else if(12===t){i=function(e){var t=23,i=e[23];if(32!=(63&i))return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and vpsTag is "+i),{};t+=2,++t;var i=e[27]|e[26]<<8,r=(t+=2,e.slice(28,28+i)),s=e[t+=i];if(33!=(63&s))return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and sps tag is "+s),{};t+=2;var s=e[1+ ++t]|e[t]<<8,a=e.slice(t+=2,t+s),n=e[t+=s];if(34!=(63&n))return console.warn("parseHEVCDecoderVPSAndSPSAndPPS and pps tag is "+n),{};t+=2;var n=e[1+ ++t]|e[t]<<8,e=e.slice(t+=2,t+n),t=new Uint8Array([s>>>24&255,s>>>16&255,s>>>8&255,255&s]),o=new Uint8Array([n>>>24&255,n>>>16&255,n>>>8&255,255&n]),l=new Uint8Array([i>>>24&255,i>>>16&255,i>>>8&255,255&i]),s=new Uint8Array(4+s),t=(s.set(t,0),s.set(a,4),new Uint8Array(4+n)),a=(t.set(o,0),t.set(e,4),new Uint8Array(4+i));return a.set(l,0),a.set(r,4),{sps:s,pps:t,vps:a}}(r);const t=mi(e);i=Object.assign(i,t)}i&&(i.vps&&(this.vps=i.vps),i.pps&&(this.pps=i.pps),i.sps&&(this.sps=i.sps),i.presentWidth&&(this.metaInfo.presentWidth=i.presentWidth),i.presentHeight&&(this.metaInfo.presentHeight=i.presentHeight),i.codecWidth&&(this.metaInfo.codecWidth=i.codecWidth),i.codecHeight&&(this.metaInfo.codecHeight=i.codecHeight),i.timescale&&(this.metaInfo.timescale=i.timescale),i.refSampleDuration&&(this.metaInfo.refSampleDuration=i.refSampleDuration),i.videoType)&&(this.metaInfo.videoType=i.videoType)}}class vi extends yi{constructor(e){super(e),this.totalByteLength=0,this._startRecordingTimestamp=null,e.debug.log("RecorderRTC","init")}_reset(){super._reset(),this.totalByteLength=0,this._startRecordingTimestamp=null,this.recorder&&(this.recorder.destroy(),this.recorder=null)}destroy(){super.destroy(),this._reset(),this.player.debug.log("RecorderRTC","destroy")}getSeekableBlob(t){const s=new EBML.Reader,a=new EBML.Decoder,n=EBML.tools,i=new FileReader;return new Promise((r,e)=>{i.onload=function(e){a.decode(this.result).forEach(function(e){s.read(e)}),s.stop();var t=n.makeMetadataSeekable(s.metadatas,s.duration,s.cues),i=this.result.slice(s.metadataSize),t=new Blob([t,i],{type:"video/webm"});r(t)},i.readAsArrayBuffer(t)})}startRecord(){const t=this.player.debug,i={type:"video",mimeType:"video/webm;codecs=h264",timeSlice:1e3,onTimeStamp:e=>{t.log("RecorderRTC","record timestamp :"+e),null===this._startRecordingTimestamp&&(this._startRecordingTimestamp=e),this._recordingTimestamp=(e-this._startRecordingTimestamp)/1e3},ondataavailable:e=>{this.totalByteLength+=e.size,t.log("RecorderRTC","ondataavailable",e.size)},disableLogs:!this.player._opt.debug};try{let e=null;if(this.player.getRenderType()===G?e=this.player.video.$videoElement.captureStream(25):this.player.video.mediaStream?e=this.player.video.mediaStream:this.player._opt.isHls||this.player._opt.useMSE||this.player._opt.useWCS?e=this.player.video.$videoElement.captureStream(25):this.player._opt.isWebrtc&&(e=this.player.webrtc.videoStream),e){if(this.player.audio&&this.player.audio.mediaStreamAudioDestinationNode&&this.player.audio.mediaStreamAudioDestinationNode.stream&&!this.player.audio.isStateSuspended()&&this.player.audio.hasAudio&&this.player._opt.hasAudio){const t=this.player.audio.mediaStreamAudioDestinationNode.stream;if(0{this.player.emit(v.recordingTimestamp,this._recordingTimestamp)},1e3)}stopRecordAndSave(){let i=0{this.recorder&&this._isRecording||e("recorder is not ready"),r&&this.setFileName(r),this.recorder.stopRecording(()=>{this.player.debug.log("RecorderRTC","stop recording");var e=(this.fileName||m())+"."+j;if(this.recorder.getBlob(),"blob"===i){const i=this.recorder.getBlob();t(i),this.player.emit(v.recordBlob,i)}else t(),this.recorder.save(e);this.player.emit(v.recordEnd),this._reset(),this.player.emit(v.recording,!1)})})}getToTalByteLength(){return this.totalByteLength}getTotalDuration(){return this.recordTime}getType(){return j}initMetaData(){}}class g{static init(){for(var e in g.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[],free:[],edts:[],elst:[],stss:[]},g.types)g.types.hasOwnProperty(e)&&(g.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var t=g.constants={};t.FTYP=new Uint8Array([105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,97,118,99,49,109,112,52,49,0,0,0,0]),t.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),t.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSC=t.STCO=t.STTS,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.HDLR_VIDEO=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]),t.HDLR_AUDIO=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]),t.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,r=Array.prototype.slice.call(arguments,1),s=r.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let a=8;for(let e=0;e=Math.pow(2,32)-1?(a=16,(n=new Uint8Array(i+a)).set(new Uint8Array([0,0,0,1]),0),n.set(g.types.mdat,4),n.set(new Uint8Array([i+8>>>56&255,i+8>>>48&255,i+8>>>40&255,i+8>>>32&255,i+8>>>24&255,i+8>>>16&255,i+8>>>8&255,i+8&255]),8)):((n=new Uint8Array(i+a))[0]=i+8>>>24&255,n[1]=i+8>>>16&255,n[2]=i+8>>>8&255,n[3]=i+8&255,n.set(g.types.mdat,4));for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,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,0,0,0,3]))}static trak(e){return g.box(g.types.trak,g.tkhd(e),g.mdia(e))}static tkhd(e){var t=e.id,i=e.duration,r=e.presentWidth,e=e.presentHeight;return g.box(g.types.tkhd,new Uint8Array([0,0,0,15,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>>8&255,255&r,0,0,e>>>8&255,255&e,0,0]))}static edts(e,t){return g.box(g.types.edts,g.elst(e,t))}static elst(t,i){let r=0;for(let e=0;e>>24&255,r>>>16&255,r>>>8&255,255&r,255,255,255,255,0,1,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e,0,0,0,0,0,1,0,0]))}static mdia(e){return g.box(g.types.mdia,g.mdhd(e),g.hdlr(e),g.minf(e))}static mdhd(e){var t=e.timescale/e.refSampleDuration,e=t*e.duration/e.timescale;return g.box(g.types.mdhd,new Uint8Array([0,0,0,0,206,186,253,168,206,186,253,168,t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e,85,196,0,0]))}static hdlr(e){var t=g.constants.HDLR_VIDEO;return g.box(g.types.hdlr,t)}static minf(e){var t=g.box(g.types.vmhd,g.constants.VMHD);return g.box(g.types.minf,t,g.dinf(),g.stbl(e))}static dinf(){return g.box(g.types.dinf,g.box(g.types.dref,g.constants.DREF))}static stbl(e){var i=e.samples,r=[{No:1,num:0,sampleDelte:1,chunkNo:1,duration:i[0].duration}],s=[i[0].duration],a=i.length;for(let t=0;t>>24&255,i>>>16&255,i>>>8&255,255&i]),r=e.byteLength,s=new Uint8Array(r+8*i);s.set(e,0);for(let e=0;e>>24&255,t[e].num>>>16&255,t[e].num>>>8&255,255&t[e].num,t[e].sampleDelte>>>24&255,t[e].sampleDelte>>>16&255,t[e].sampleDelte>>>8&255,255&t[e].sampleDelte]),r),r+=8;return g.box(g.types.stts,s)}static stss(t){var i=[],r=t.length;for(let e=0;e>>24&255,s>>>16&255,s>>>8&255,255&s]),a=e.byteLength,n=new Uint8Array(a+4*s);n.set(e,0);for(let e=0;e>>24&255,i[e]>>>16&255,i[e]>>>8&255,255&i[e]]),a),a+=4;return g.box(g.types.stss,n)}static stsc(t){let i=t.length,e=new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i]),r=e.byteLength,s=new Uint8Array(r+12*i);s.set(e,0);for(let e=0;e>>24&255,a>>>16&255,a>>>8&255,255&a,n>>>24&255,n>>>16&255,n>>>8&255,255&n,o>>>24&255,o>>>16&255,o>>>8&255,255&o]),r),r+=12}return g.box(g.types.stsc,s)}static stsz(t){let i=t.length,e=new Uint8Array([0,0,0,0,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i]),r=e.byteLength,s=new Uint8Array(r+4*i);s.set(e,0);for(let e=0;e>>24&255,a>>>16&255,a>>>8&255,255&a]),r),r+=4}return g.box(g.types.stsz,s)}static stco(e,t){t=t[0].chunkOffset;return g.box(g.types.stco,new Uint8Array([0,0,0,0,0,0,0,1,t>>>24&255,t>>>16&255,t>>>8&255,255&t]))}static stsd(e){return"audio"===e.type?"mp3"===e.codec?g.box(g.types.stsd,g.constants.STSD_PREFIX,g.mp3(e)):g.box(g.types.stsd,g.constants.STSD_PREFIX,g.mp4a(e)):"avc"===e.videoType?g.box(g.types.stsd,g.constants.STSD_PREFIX,g.avc1(e)):g.box(g.types.stsd,g.constants.STSD_PREFIX,g.hvc1(e))}static mp3(e){var t=e.channelCount,e=e.audioSampleRate,t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,e>>>8&255,255&e,0,0]);return g.box(g.types[".mp3"],t)}static mp4a(e){var t=e.channelCount,i=e.audioSampleRate,t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return g.box(g.types.mp4a,t,g.esds(e))}static esds(e){var e=e.config||[],t=e.length,t=new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e).concat([6,1,2]));return g.box(g.types.esds,t)}static avc1(e){var t=e.avcc,i=e.codecWidth,e=e.codecHeight,i=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,i>>>8&255,255&i,e>>>8&255,255&e,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return g.box(g.types.avc1,i,g.box(g.types.avcC,t))}static hvc1(e){var t=e.avcc,i=e.codecWidth,e=e.codecHeight,i=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,i>>>8&255,255&i,e>>>8&255,255&e,0,72,0,0,0,72,0,0,0,0,0,0,0,1,13,106,101,115,115,105,98,117,99,97,45,112,114,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return g.box(g.types.hvc1,i,g.box(g.types.hvcC,t))}static mvex(e){return g.box(g.types.mvex,g.trex(e))}static trex(e){e=e.id,e=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return g.box(g.types.trex,e)}static moof(e,t){return g.box(g.types.moof,g.mfhd(e.sequenceNumber),g.traf(e,t))}static mfhd(e){e=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return g.box(g.types.mfhd,e)}static traf(e,t){var i=e.id,i=g.box(g.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),t=g.box(g.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),r=g.sdtp(e),e=g.trun(e,r.byteLength+16+16+8+16+8+8);return g.box(g.types.traf,i,t,e,r)}static sdtp(e){var t=e.samples||[],i=t.length,r=new Uint8Array(4+i);for(let e=0;e>>24&255,r>>>16&255,r>>>8&255,255&r,(t+=8+e)>>>24&255,t>>>16&255,t>>>8&255,255&t],0);for(let e=0;e>>24&255,a>>>16&255,a>>>8&255,255&a,n>>>24&255,n>>>16&255,n>>>8&255,255&n,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.isNonSync,0,0,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*e)}return g.box(g.types.trun,s)}static mdat(e){return g.box(g.types.mdat,e)}}g.init();class bi extends yi{constructor(e){super(e),this.tagName="recorderMP4",this.totalDuration=0,this.totalByteLength=0,this.bufferList=[],this.cacheTrack={},this.sequenceNumber=0,e.debug.log(this.tagName,"init")}destroy(){super.destroy(),this._reset(),this.player.debug.log(this.tagName,"destroy")}_reset(){super._reset(),this.totalDuration=0,this.totalByteLength=0,this.sequenceNumber=0,this.cacheTrack={},this.bufferList=[]}startRecord(){var e=this.player.debug;this._isRecording=!0,this.player.emit(v.recording,!0),e.log(this.tagName,"start recording"),this.player.emit(v.recordStart),this.startRecordingInterval()}startRecordingInterval(){this.stopRecordingInterval(),this.recordingInterval=window.setInterval(()=>{this.player.emit(v.recordingTimestamp,this.getTotalDuration())},1e3)}formatFmp4Track(e,t,i,r){return{id:1,sequenceNumber:++this.sequenceNumber,size:e.byteLength,dts:i,cts:r,isKeyframe:t,data:e,duration:0,flags:{isLeading:0,dependsOn:t?2:1,isDependedOn:t?1:0,hasRedundancy:0,isNonSync:t?0:1}}}handleAddNaluTrack(e,t,i,r){this.cacheTrack.id&&i>=this.cacheTrack.dts?(this.cacheTrack.duration=i-this.cacheTrack.dts,this.handleAddFmp4Track(this.cacheTrack)):this.cacheTrack={},this.cacheTrack=this.formatFmp4Track(e,t,i,r)}handleAddFmp4Track(e){if(this.isRecording)if(null!==this.sps&&null!==this.pps||!this.isH264)if(null!==this.sps&&null!==this.pps&&null!==this.vps||!this.isH265){var t=Object.assign({},e),i=(t.pts=t.dts+t.cts,t.data);if(t.isKeyframe)if(this.isH264){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength);e.set(this.sps,0),e.set(this.pps,this.sps.byteLength);var r=new Uint8Array(e.byteLength+i.byteLength);r.set(e,0),r.set(i,e.byteLength),t.data=r}else if(this.isH265){const e=new Uint8Array(this.sps.byteLength+this.pps.byteLength+this.vps.byteLength);e.set(this.vps,0),e.set(this.sps,this.vps.byteLength),e.set(this.pps,this.vps.byteLength+this.sps.byteLength);r=new Uint8Array(e.byteLength+i.byteLength);r.set(e,0),r.set(i,e.byteLength),t.data=r}t.size=t.data.byteLength,this.totalDuration+=t.duration,this.totalByteLength+=t.data.byteLength,t.duration=0,t.originalDts=t.dts,delete t.id,delete t.sequenceNumber,this.bufferList.push(t)}else this.player.debug.error(this.tagName,"handleAddFmp4Track, is h265 and this.sps or this.pps or this.vps is null ");else this.player.debug.error(this.tagName,"handleAddFmp4Track, is h264 and this.sps or this.pps is null ");else this.player.debug.error(this.tagName,"handleAddFmp4Track, isRecording is false ")}getTotalDuration(){return this.totalDuration/1e3}getType(){return p}getToTalByteLength(){return this.totalByteLength}stopRecordAndSave(){let e=0{if(!this.isRecording)return this.player.debug.error(this.tagName,"stop recording fail, isRecording is false "),r("stop recording fail, isRecording is false ");if(0===this.bufferList.length)return this.player.debug.error(this.tagName,"stop recording fail, this.bufferList.length is 0 "),r("stop recording fail, this.bufferList.length is 0 ");t&&this.setFileName(t);r={id:1,type:"video",sps:this.sps,pps:this.pps,samples:this.bufferList,sequenceNumber:this.bufferList.length,length:0,addSampleNum:1,duration:0,...this.metaInfo},r=g.generateInitSegment({timescale:1e3,duration:this.totalDuration},[r],this.totalByteLength),this.player.debug.log(this.tagName,"stop recording"),r=new Blob([r],{type:"application/octet-stream"});if("blob"===e)i(r),this.player.emit(v.recordBlob,r);else{i();{i=(this.fileName||m())+"."+p;let e=window.URL.createObjectURL(r),t=window.document.createElement("a");t.download=i,t.href=e,(r=window.document.createEvent("MouseEvents")).initEvent("click",!0,!0),t.dispatchEvent(r),setTimeout(()=>{window.URL.revokeObjectURL(e)},(i=window.navigator.userAgent.toLowerCase())&&/iphone|ipad|ipod|ios/.test(i)?1e3:0)}}this._reset(),this.player.emit(v.recording,!1)})}}class Ei{constructor(e){return new(Ei.getLoaderFactory(e._opt))(e)}static getLoaderFactory(e){return e.recordType===p&&(e.useWasm||e.useMSE||e.useWCS)?bi:vi}}class Si{constructor(e){this.player=e,this.decoderWorker=new Worker(e._opt.decoder),this._initDecoderWorker(),e.debug.log("decoderWorker","init"),e.on(v.visibilityChange,()=>{this.updateWorkConfig({key:"visibility",value:e.visibility})})}destroy(){this.decoderWorker.postMessage({cmd:"close"}),this.decoderWorker.terminate(),this.decoderWorker=null,this.player.debug.log("decoderWorker","destroy")}_initDecoderWorker(){const{debug:i,events:{}}=this.player;this.decoderWorker.onmessage=e=>{var t=e.data;switch(t.cmd){case X:i.log("decoderWorker","onmessage:",X),this.decoderWorker&&this._initWork(),this.player.loaded||this.player.emit(v.load),this.player.emit(v.decoderWorkerInit);break;case ee:i.log("decoderWorker","onmessage:",ee,t.code),this.player._times.decodeStart||(this.player._times.decodeStart=m()),this.player.video.updateVideoInfo({encTypeCode:t.code});break;case te:i.log("decoderWorker","onmessage:",te,t.codecId),this.player.recorder&&this.player.recorder.initMetaData(t.buffer,t.codecId);break;case $:i.log("decoderWorker","onmessage:",$,t.code),this.player.audio&&this.player.audio.updateAudioInfo({encTypeCode:t.code});break;case Y:(i.log("decoderWorker","onmessage:",Y,`width:${t.w},height:`+t.h),this.player.video.updateVideoInfo({width:t.w,height:t.h}),this.player._opt.openWebglAlignment||t.w/2%4==0||this.player.getRenderType()!==G)?(this.player.video.initCanvasViewSize(),this.player._opt.playType===y&&(this.player.video.initFps(),this.player.video.initVideoDelay())):this.player.emit(A.webglAlignmentError);break;case Z:(i.log("decoderWorker","onmessage:",Z,`channels:${t.channels},sampleRate:`+t.sampleRate),2=this.player._opt.playbackForwardMaxRateDecodeIFrame?i&&(this.player.debug.log("decoderWorker",`current rate is ${this.player.video.rate},only decode i frame`),this._decodeVideoNoDelay(e,t,i)):1===this.player.video.rate?this._decodeVideo(e,t,i):this._decodeVideoNoDelay(e,t,i))}_decodeVideo(e,t,i){t={type:2,ts:Math.max(t,0),isIFrame:i};this.decoderWorker.postMessage({cmd:"decode",buffer:e,options:t},[e.buffer])}_decodeVideoNoDelay(e,t,i){this.decoderWorker.postMessage({cmd:"videoDecode",buffer:e,ts:Math.max(t,0),isIFrame:i},[e.buffer])}decodeAudio(e,t){this.player._opt.playType===n?this.player._opt.useWCS||this.player._opt.useMSE?this._decodeAudioNoDelay(e,t):this._decodeAudio(e,t):this.player._opt.playType===y&&(1===this.player.video.rate?this._decodeAudio(e,t):this._decodeAudioNoDelay(e,t))}_decodeAudio(e,t){t={type:1,ts:Math.max(t,0)};this.decoderWorker.postMessage({cmd:"decode",buffer:e,options:t},[e.buffer])}_decodeAudioNoDelay(e,t){this.decoderWorker.postMessage({cmd:"audioDecode",buffer:e,ts:Math.max(t,0)},[e.buffer])}updateWorkConfig(e){this.decoderWorker&&this.decoderWorker.postMessage({cmd:"updateConfig",key:e.key,value:e.value})}workerFetchStream(e){var t=this.player["_opt"],t={protocol:t.protocol,isFlv:t.isFlv};this.decoderWorker.postMessage({cmd:"fetchStream",url:e,opt:JSON.stringify(t)})}clearWorkBuffer(){this.decoderWorker.postMessage({cmd:"clearBuffer",needClear:0e?1e3 timestamp is ${e} more than ${this.preDelayTimestamp-e}ms`):this.firstTimestamp?e&&(t=Date.now()-this.startTimestamp,(i=e-this.firstTimestamp)<=t?(this.isStreamTsMoreThanLocal=!1,this.delay=t-i):(this.isStreamTsMoreThanLocal=!0,this.delay=i-t)):(this.firstTimestamp=e,this.startTimestamp=Date.now(),this.delay=-1),this.preDelayTimestamp=e,this.delay):-1}getDelayNotUpdateDelay(t){if(t&&this.player.isDemuxDecodeFirstIIframeInit())if(this.preDelayTimestamp&&1e3 timestamp is ${t} more than ${this.preDelayTimestamp-t}ms`);else if(this.firstTimestamp){let e=-1;var i;return t&&(i=Date.now()-this.startTimestamp,t=t-this.firstTimestamp,e=t<=i?i-t:t-i),e}return-1}resetDelay(){this.firstTimestamp=null,this.startTimestamp=null,this.delay=-1,this.dropping=!1}resetAllDelay(){this.resetDelay(),this.preDelayTimestamp=null}initInterval(){this.player.debug.log("CommonDemux","init Interval"),this._loop(),this.stopId=setInterval(()=>{var e=(new Date).getTime(),e=(this.preLoopTimestamp||(this.preLoopTimestamp=e),e-this.preLoopTimestamp);100i+t&&r?this.hasIframeInBufferList()?(this.player.debug.warn("CommonDemux",`_loop delay is ${this.delay}, set dropping is true`),this.resetAllDelay(),this.dropping=!0):(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay>t?(this.bufferList.shift(),this._doDecoderDecode(e)):this.delay<0&&this.player.debug.error("CommonDemux",`_loop delay is ${this.delay} bufferList is `+this.bufferList);else-1!==this.delay&&this.player.debug.log("CommonDemux","loop() bufferList is empty and reset delay"),this.resetAllDelay()}_doDecode(e,t,i,r){var s=this.player,a={ts:i,cts:4s&&this.delay ${r+i}, bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2()):a>s&&this.delay ${r+i},bufferList is ${this.bufferList.length}, delay is ${this.delay} and dropBuffer$2()`),this.dropBuffer$2())}2===t.type&&(this.preTimestamp=t.ts),1===t.type?this.bufferList.push({ts:t.ts,payload:e,type:1}):2===t.type&&this.bufferList.push({ts:t.ts,cts:t.cts,payload:e,type:2,isIFrame:t.isIFrame})}}dropBuffer$2(){var e,t,i;0!0===e.isIFrame&&2===e.type))?(this.isPushDropping=!1,this.bufferList=this.bufferList.slice(e),t=this.bufferList.shift(),i=this.getDelayNotUpdateDelay(t.ts),this._doDecoderDecode(t),this.player.debug.log("CommonDemux",`dropBuffer$2() iFrameIndex is ${e},and bufferList length is ${this.bufferList.length} and tempDelay is ${i} ,delay is ${this.delay} `)):this.isPushDropping=!1),0===this.bufferList.length&&(this.isPushDropping=!1)}dropBuffer(){for(var e=this.getMaxDelayTs();0=this.getNotDroppingDelayTs()&&i= ${this.getNotDroppingDelayTs()} and delay is ${this.delay} and bufferlist is `+this.bufferList.length);break}this.player.debug.warn("CommonDemux",`dropBuffer() dropBuffer is dropping and data.type is ${t.type}, isIFrame ${t.isIFrame} and tempDelay is ${i} and getNotDroppingDelayTs is ${this.getNotDroppingDelayTs()}, delay is ${this.delay} and bufferlist is `+this.bufferList.length),this.bufferList.shift(),2===t.type&&t.isIFrame&&this._doDecoderDecode(t),this.isPushDropping=!0}0===this.bufferList.length&&(this.isPushDropping=!1)}clearBuffer(){var e=0this.player._opt.networkDelay&&this.player._opt.playType===n&&(this.player.debug.warn("CommonDemux",`now dts:${e},start dts is ${this.bufferStartDts}, vs start is ${t},local diff is ${i} ,delay is `+r),this.player.emit(v.networkDelayTimeout,r)),this.player.updateStats({netBuf:r}))}calcIframeIntervalTimestamp(e){var t;null===this.preIframeTs?this.preIframeTs=e:this.preIframeTs2===e.type&&e.isIFrame)}getInputByteLength(){return 0}getIsStreamTsMoreThanLocal(){return this.isStreamTsMoreThanLocal}close(){}reset(){}}const wi=[[Uint8Array,Int8Array],[Uint16Array,Int16Array],[Uint32Array,Int32Array,Float32Array],[Float64Array]],ki=Symbol(32),Ci=Symbol(16),Ri=Symbol(8),Di=new Map;wi.forEach((e,t)=>e.forEach(e=>Di.set(e,t)));class Li{constructor(e){this.g=e,this.consumed=0,e&&(this.need=e.next().value)}fillFromReader(i){return e=this,l=function*(){var{done:e,value:t}=yield i.read();return e?void this.close():(this.write(t),this.fillFromReader(i))},new(o=(o=n=void 0)||Promise)(function(i,t){function r(e){try{a(l.next(e))}catch(e){t(e)}}function s(e){try{a(l.throw(e))}catch(e){t(e)}}function a(e){var t;e.done?i(e.value):((t=e.value)instanceof o?t:new o(function(e){e(t)})).then(r,s)}a((l=l.apply(e,n||[])).next())});var e,n,o,l}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(e,t){return t&&this.consume(),this.need=e,this.flush()}read(i){return new Promise((t,e)=>{if(this.resolve)return e("last read not complete yet");this.resolve=e=>{delete this.resolve,delete this.need,t(e)},this.demand(i,!0)})}readU32(){return this.read(ki)}readU16(){return this.read(Ci)}readU8(){return this.read(Ri)}close(){this.g&&this.g.return()}flush(){if(this.buffer&&this.need){let e=null;const r=this.buffer.subarray(this.consumed);let t=0;var i=e=>r.length<(t=e);if("number"==typeof this.need){if(i(this.need))return;e=r.subarray(0,t)}else if(this.need instanceof ArrayBuffer){if(i(this.need.byteLength))return;new Uint8Array(this.need).set(r.subarray(0,t)),e=this.need}else if(this.need===ki){if(i(4))return;e=r[0]<<24|r[1]<<16|r[2]<<8|r[3]}else if(this.need===Ci){if(i(2))return;e=r[0]<<8|r[1]}else if(this.need===Ri){if(i(1))return;e=r[0]}else if(Di.has(this.need.constructor)){if(i(this.need.length<>24&255,e>>16&255,e>>8&255,255&e]),this.flush()}writeU16(e){this.malloc(2).set([e>>8&255,255&e]),this.flush()}writeU8(e){this.malloc(1)[0]=e,this.flush()}malloc(e){if(this.buffer){var t=this.buffer.length,i=t+e;if(i<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,i);else{const e=new Uint8Array(i);e.set(this.buffer),this.buffer=e}return this.buffer.subarray(t,i)}return this.buffer=new Uint8Array(e),this.buffer}}Li.U32=ki,Li.U16=Ci,Li.U8=Ri;var Ii,Bi="application/json, text/javascript",xi="text/html",Pi=/^(?:text|application)\/xml/i,Fi=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Oi=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,_i=/^\s*$/,Mi={},Ui={},ji="",Ni={type:"GET",beforeSend:C,success:C,error:C,complete:C,context:null,xhr:function(){return new window.XMLHttpRequest},accepts:{json:Bi,xml:"application/xml, text/xml",html:xi,text:"text/plain","*":"*/".concat("*")},crossDomain:!1,timeout:0,username:null,password:null,processData:!0,promise:C,contentType:"application/x-www-form-urlencoded; charset=UTF-8"};function C(){}function R(e,t){"object"==typeof e&&(t=e,e=void 0);var i,r=qi({},t=t||{});for(i in Ni)void 0===r[i]&&(r[i]=Ni[i]);try{var s={},a=new Promise(function(e,t){s.resolve=e,s.reject=t});a.resolve=s.resolve,a.reject=s.reject,r.promise=a}catch(e){r.promise={resolve:C,reject:C}}var n,o,l,c,u,a=Oi.exec(window.location.href.toLowerCase())||[],d=(r.url=((e||r.url||window.location.href)+"").replace(/#.*$/,"").replace(/^\/\//,a[1]+"//"),r.url),h=(r.crossDomain||(r.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(r.url)&&RegExp.$2!==window.location.href),r.dataType);if("jsonp"===h)return/=\?/.test(r.url)||(a=(r.jsonp||"callback")+"=?",r.url=zi(r.url,a)),l=(n=r).jsonpCallback||"jsonp"+Xi(),c=window.document.createElement("script"),u={abort:function(){l in window&&(window[l]=C)}},a=window.document.getElementsByTagName("head")[0]||window.document.documentElement,c.onerror=function(e){e=e,window.clearTimeout(o),u.abort(),Wi(e.type,u,e.type,n),p()},window[l]=function(e){window.clearTimeout(o),Vi(e,u,n),p()},Ki(n),c.src=n.url.replace(/=\?/,"="+l),c.src=zi(c.src,"_="+(new Date).getTime()),c.async=!0,n.scriptCharset&&(c.charset=n.scriptCharset),a.insertBefore(c,a.firstChild),0>4]+$i[15&r])}return t.join("")}}),ir={16:10,24:12,32:14},rr=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],I=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],sr=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],ar=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],nr=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],or=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],lr=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],cr=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],ur=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],dr=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],hr=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],pr=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],fr=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Ar=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],mr=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function gr(e){for(var t=[],i=0;i>2][t%4]=a[t],this._Kd[e-i][t%4]=a[t];for(var n,o=0,l=s;l>16&255]<<24^I[n>>8&255]<<16^I[255&n]<<8^I[n>>24&255]^rr[o]<<24,o+=1,8!=s)for(t=1;t>8&255]<<8^I[n>>16&255]<<16^I[n>>24&255]<<24,t=s/2+1;t>2][u=l%4]=a[t],this._Kd[e-c][u]=a[t++],l++}for(var c=1;c>24&255]^fr[n>>16&255]^Ar[n>>8&255]^mr[255&n]},r.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,i=[0,0,0,0],r=gr(e),s=0;s<4;s++)r[s]^=this._Ke[0][s];for(var a=1;a>24&255]^nr[r[(s+1)%4]>>16&255]^or[r[(s+2)%4]>>8&255]^lr[255&r[(s+3)%4]]^this._Ke[a][s];r=i.slice()}for(var n,o=D(16),s=0;s<4;s++)n=this._Ke[t][s],o[4*s]=255&(I[r[s]>>24&255]^n>>24),o[4*s+1]=255&(I[r[(s+1)%4]>>16&255]^n>>16),o[4*s+2]=255&(I[r[(s+2)%4]>>8&255]^n>>8),o[4*s+3]=255&(I[255&r[(s+3)%4]]^n);return o},r.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,i=[0,0,0,0],r=gr(e),s=0;s<4;s++)r[s]^=this._Kd[0][s];for(var a=1;a>24&255]^ur[r[(s+3)%4]>>16&255]^dr[r[(s+2)%4]>>8&255]^hr[255&r[(s+1)%4]]^this._Kd[a][s];r=i.slice()}for(var n,o=D(16),s=0;s<4;s++)n=this._Kd[t][s],o[4*s]=255&(sr[r[s]>>24&255]^n>>24),o[4*s+1]=255&(sr[r[(s+3)%4]>>16&255]^n>>16),o[4*s+2]=255&(sr[r[(s+2)%4]>>8&255]^n>>8),o[4*s+3]=255&(sr[255&r[(s+1)%4]]^n);return o},yr.prototype.encrypt=function(e){if((e=a(e)).length%16!=0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=D(e.length),i=D(16),r=0;rNumber.MAX_SAFE_INTEGER)throw new Error("integer value out of safe range");for(var t=15;0<=t;--t)this._counter[t]=e%256,e=parseInt(e/256)},i.prototype.setBytes=function(e){if(16!=(e=a(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},i.prototype.increment=function(){for(var e=15;0<=e;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};Sr.prototype.decrypt=Sr.prototype.encrypt=function(e){for(var t=a(e,!0),i=0;i>4==1;if(i&&this.calcIframeIntervalTimestamp(t),0s)break;var n=t[a+4];if(1==(n&=31)||5==n){const s=t.slice(a+4+2,a+4+o);let e=new Tr.ModeOfOperation.ctr(i,new Tr.Counter(r));n=e.decrypt(s);e=null,t.set(n,a+4+2)}a=a+4+o}var o;return t}(n,s._opt.cryptoKey,s._opt.cryptoIV):s.debug.error("FlvDemux",`cryptoKey.length is ${s._opt.cryptoKey&&s._opt.cryptoKey.byteLength} or cryptoIV.length is ${s._opt.cryptoIV&&s._opt.cryptoIV.byteLength} null`)),this._doDecode(e,2,t,i,o)}}break;default:s.debug.log("FlvDemux","demux() type is "+l)}}}close(){this.input=null}getInputByteLength(){let e=0;return e=this.input&&this.input.buffer?this.input.buffer.byteLength:e}}class kr extends Ti{constructor(e){super(e),e.debug.log("M7sDemux","init")}destroy(){super.destroy(),this.player.debug.log("M7sDemux","destroy")}dispatch(t){const i=this.player,r=new DataView(t),s=r.getUint8(0),a=r.getUint32(1,!1);switch(s){case 1:if(i._opt.hasAudio){const r=new Uint8Array(t,5);i.updateStats({abps:r.byteLength}),0>4==1;let e=a;this.player._opt.useMSE&&c(this.player.mseDecoder.firstRenderTime)&&(e=a-this.player.mseDecoder.firstRenderTime),i.updateStats({vbps:n.byteLength,dts:e}),0>1)&&33!=i&&34!=i?t:ce}(t)),this.streamVideoType===le){const e=this.handleAddNaluStartCode(t),i=this.extractNALu(e);if(0===i.length)this.player.debug.warn(this.name,"handleVideoNalu","naluList.length === 0");else{const r=[];if(i.forEach(e=>{var t=h(e);8===t||7===t?this.handleVideoH264Nalu(e):fi(t)&&r.push(e)}),1===r.length)this.handleVideoH264Nalu(r[0]);else{const e=function(t){if(0===t.length)return!1;var i=h(t[0]);for(let e=1;e{this.handleVideoH264Nalu(e)})}}}else this.streamVideoType===ce?34===gi(t)?this.extractH265PPS(t):this.handleVideoH265Nalu(t):this.player.debug.error(this.name," this.streamVideoType is null")}extractH264PPS(e){e=this.handleAddNaluStartCode(e);this.extractNALu(e).forEach(e=>{pi(h(e))?this.extractH264SEI(e):this.handleVideoH264Nalu(e)})}extractH265PPS(e){e=this.handleAddNaluStartCode(e);this.extractNALu(e).forEach(e=>{39===gi(e)?this.extractH265SEI(e):this.handleVideoH265Nalu(e)})}extractH264SEI(e){e=this.handleAddNaluStartCode(e);this.extractNALu(e).forEach(e=>{this.handleVideoH264Nalu(e)})}extractH265SEI(e){e=this.handleAddNaluStartCode(e);this.extractNALu(e).forEach(e=>{this.handleVideoH265Nalu(e)})}handleAddNaluStartCode(e){var t=[0,0,0,1],i=new Uint8Array(e.length+t.length);return i.set(t),i.set(e,t.length),i}handleAudioAACNalu(t){if(t&&!(t.byteLength<1)){this.streamAudioType||(this.streamAudioType=ue.AAC);let e=new Uint8Array(t);var i=e.slice(0,7);if(e=e.slice(7),!this.isSendAACSeqHeader){const t=(192&i[2])>>6,e=(60&i[2])>>2,r=(1&i[2])<<2|(192&i[3])>>6,s=new Uint8Array([175,0,t<<3|(14&e)>>1,(1&e)<<7|r<<3]);this.isSendAACSeqHeader=!0,this._doDecode(s,1,0,!1,0)}const r=this.getNaluAudioDts(),s=new Uint8Array(e.length+2);s.set([175,1],0),s.set(e,2),this._doDecode(s,1,r,!1,0)}}handleAudioG711ANalu(e){var t,i;!e||e.byteLength<1||(this.streamAudioType||(this.streamAudioType=ue.ALAW),e=new Uint8Array(e),t=this.getNaluAudioDts(),(i=new Uint8Array(e.length+1)).set([114],0),i.set(e,1),this._doDecode(i,1,t,!1,0))}handleAudioG711UNalu(e){var t,i;!e||e.byteLength<1||(this.streamAudioType||(this.streamAudioType=ue.MULAW),e=new Uint8Array(e),t=this.getNaluAudioDts(),(i=new Uint8Array(e.length+1)).set([130],0),i.set(e,1),this._doDecode(i,1,t,!1,0))}handleVideoH264Nalu(e){var t,i,r,s=h(e);switch(s){case 7:this.sps=e;break;case 8:this.pps=e}if(this.isSendSeqHeader)if(fi(s)){this.player._times.demuxStart||(this.player._times.demuxStart=m());const a=5===s,n=this.getNaluDts(),o=(t=e,(i=[])[0]=a?23:39,i[1]=1,i[2]=0,i[3]=0,i[4]=0,i[5]=t.byteLength>>24&255,i[6]=t.byteLength>>16&255,i[7]=t.byteLength>>8&255,i[8]=255&t.byteLength,(r=new Uint8Array(i.length+t.byteLength)).set(i,0),r.set(t,i.length),r);this.player.updateStats({vbps:o.byteLength,dts:n}),a&&this.calcIframeIntervalTimestamp(n),this._doDecode(o,2,n,a,0)}else this.player.debug.warn(this.name,"handleVideoH264Nalu is avc seq head nalType is "+s);else if(this.sps&&this.pps){this.isSendSeqHeader=!0;const e=function(e){let{sps:t,pps:i}=e,r=8+t.byteLength+1+2+i.byteLength,s=!1;var e=P.parseSPS$2(t),a=(66!==t[3]&&77!==t[3]&&88!==t[3]&&(s=!0,r+=4),new Uint8Array(r)),n=(a[0]=1,a[1]=t[1],a[2]=t[2],a[3]=t[3],a[4]=255,a[5]=225,t.byteLength),o=(a[6]=n>>>8,a[7]=255&n,8),n=(a.set(t,8),a[o+=n]=1,i.byteLength),n=(a[o+1]=n>>>8,a[o+2]=255&n,a.set(i,o+3),o+=3+n,s&&(a[o]=252|e.chroma_format_idc,a[o+1]=248|e.bit_depth_luma-8,a[o+2]=248|e.bit_depth_chroma-8,a[o+3]=0,o+=4),[23,0,0,0,0]),e=new Uint8Array(n.length+a.byteLength);return e.set(n,0),e.set(a,n.length),e}({sps:this.sps,pps:this.pps});this._doDecode(e,2,0,!0,0)}}handleVideoH264NaluList(e,t,i){if(this.isSendSeqHeader){this.player._times.demuxStart||(this.player._times.demuxStart=m());const i=this.getNaluDts(),a=(e=e.reduce((e,t)=>{var e=hi(e),t=hi(t),i=new Uint8Array(e.byteLength+t.byteLength);return i.set(e,0),i.set(t,e.byteLength),i}),(r=[])[0]=t?23:39,r[1]=1,r[2]=0,r[3]=0,r[4]=0,(s=new Uint8Array(r.length+e.byteLength)).set(r,0),s.set(e,r.length),s);this.player.updateStats({vbps:a.byteLength,dts:i}),t&&this.calcIframeIntervalTimestamp(i),this._doDecode(a,2,i,t,0)}else this.player.debug.warn(this.name,"handleVideoH264NaluList isSendSeqHeader is false");var r,s}handleVideoH265Nalu(e){var t,i,r=gi(e);switch(r){case 32:this.vps=e;break;case 33:this.sps=e;break;case 34:this.pps=e}if(this.isSendSeqHeader){if(!(32<=r&&r<=40)){this.player._times.demuxStart||(this.player._times.demuxStart=m());const s=16<=r&&r<=21,a=this.getNaluDts(),n=(r=e,(t=[])[0]=s?28:44,t[1]=1,t[2]=0,t[3]=0,t[4]=0,t[5]=r.byteLength>>24&255,t[6]=r.byteLength>>16&255,t[7]=r.byteLength>>8&255,t[8]=255&r.byteLength,(i=new Uint8Array(t.length+r.byteLength)).set(t,0),i.set(r,t.length),i);this.player.updateStats({vbps:n.byteLength,dts:a}),s&&this.calcIframeIntervalTimestamp(a),this._doDecode(n,2,a,s,0)}}else if(this.vps&&this.sps&&this.pps){this.isSendSeqHeader=!0;const e=function(e){var{vps:e,pps:t,sps:i}=e,r={configurationVersion:1},s=(e=>{e=Ai(e),e=new ci(e);return e.readByte(),e.readByte(),e.readBits(4),e.readBits(2),e.readBits(6),{num_temporal_layers:e.readBits(3)+1,temporal_id_nested:e.readBool()}})(e),a=(e=>{let t=Ai(e),a=new ci(t),i=(a.readByte(),a.readByte(),0),r=0,s=0,n=0;a.readBits(4);var o=a.readBits(3),e=(a.readBool(),a.readBits(2)),l=a.readBool(),c=a.readBits(5),u=a.readByte(),d=a.readByte(),h=a.readByte(),p=a.readByte(),f=a.readByte(),A=a.readByte(),m=a.readByte(),_=a.readByte(),M=a.readByte(),U=a.readByte(),g=a.readByte(),y=[],j=[];for(let e=0;e{switch(e){case 0:return"4:0:0";case 1:return"4:2:0";case 2:return"4:2:2";case 3:return"4:4:4";default:return"Unknown"}})(b),general_level_idc:g,general_profile_space:e,general_tier_flag:l,general_profile_idc:c,general_profile_compatibility_flags_1:u,general_profile_compatibility_flags_2:d,general_profile_compatibility_flags_3:h,general_profile_compatibility_flags_4:p,general_constraint_indicator_flags_1:f,general_constraint_indicator_flags_2:A,general_constraint_indicator_flags_3:m,general_constraint_indicator_flags_4:_,general_constraint_indicator_flags_5:M,general_constraint_indicator_flags_6:U,min_spatial_segmentation_idc:C,constant_frame_rate:0,chroma_format_idc:b,bit_depth_luma_minus8:E,bit_depth_chroma_minus8:H,frame_rate:{fixed:L,fps:B/I,fps_den:I,fps_num:B},sar_ratio:{width:R,height:D},codec_size:{width:P,height:F},present_size:{width:P*O,height:F}}})(i),n=(e=>{e=Ai(e),e=new ci(e);e.readByte(),e.readByte(),e.readUEG(),e.readUEG(),e.readBool(),e.readBool(),e.readBits(3),e.readBool(),e.readBool(),e.readUEG(),e.readUEG(),e.readSEG(),e.readBool(),e.readBool(),e.readBool()&&e.readUEG(),e.readSEG(),e.readSEG(),e.readBool(),e.readBool(),e.readBool(),e.readBool();let t=e.readBool(),i=e.readBool(),r=1;return i&&t?r=0:i?r=3:t&&(r=2),{parallelismType:r}})(t),r=Object.assign(r,s,a,n),s=23+(5+e.byteLength)+(5+i.byteLength)+(5+t.byteLength),n=((a=new Uint8Array(s))[0]=1,a[1]=(3&r.general_profile_space)<<6|(r.general_tier_flag?1:0)<<5|31&r.general_profile_idc,a[2]=r.general_profile_compatibility_flags_1||0,a[3]=r.general_profile_compatibility_flags_2||0,a[4]=r.general_profile_compatibility_flags_3||0,a[5]=r.general_profile_compatibility_flags_4||0,a[6]=r.general_constraint_indicator_flags_1||0,a[7]=r.general_constraint_indicator_flags_2||0,a[8]=r.general_constraint_indicator_flags_3||0,a[9]=r.general_constraint_indicator_flags_4||0,a[10]=r.general_constraint_indicator_flags_5||0,a[11]=r.general_constraint_indicator_flags_6||0,a[12]=60,a[13]=240|(3840&r.min_spatial_segmentation_idc)>>8,a[14]=255&r.min_spatial_segmentation_idc,a[15]=252|3&r.parallelismType,a[16]=252|3&r.chroma_format_idc,a[17]=248|7&r.bit_depth_luma_minus8,a[18]=248|7&r.bit_depth_chroma_minus8,a[19]=0,a[20]=0,a[21]=(3&r.constant_frame_rate)<<6|(7&r.num_temporal_layers)<<3|(r.temporal_id_nested?1:0)<<2|3,a[22]=3,a[23]=160,a[24]=0,a[25]=1,a[26]=(65280&e.byteLength)>>8,a[27]=(255&e.byteLength)>>0,a.set(e,28),a[23+(5+e.byteLength)+0]=161,a[23+(5+e.byteLength)+1]=0,a[23+(5+e.byteLength)+2]=1,a[23+(5+e.byteLength)+3]=(65280&i.byteLength)>>8,a[23+(5+e.byteLength)+4]=(255&i.byteLength)>>0,a.set(i,23+(5+e.byteLength)+5),a[23+(5+e.byteLength+5+i.byteLength)+0]=162,a[23+(5+e.byteLength+5+i.byteLength)+1]=0,a[23+(5+e.byteLength+5+i.byteLength)+2]=1,a[23+(5+e.byteLength+5+i.byteLength)+3]=(65280&t.byteLength)>>8,a[23+(5+e.byteLength+5+i.byteLength)+4]=(255&t.byteLength)>>0,a.set(t,23+(5+e.byteLength+5+i.byteLength)+5),[28,0,0,0,0]);return(s=new Uint8Array(n.length+a.byteLength)).set(n,0),s.set(a,n.length),s}({vps:this.vps,sps:this.sps,pps:this.pps});this._doDecode(e,2,0,!0,0)}}getInputByteLength(){let e=0;return e=this.lastBuf?this.lastBuf.byteLength:e}}class Dr{constructor(e){return new(Dr.getLoaderFactory(e._opt.demuxType))(e)}static getLoaderFactory(e){return"m7s"===e?kr:e===N?wr:e===V?Cr:e===H?Rr:void 0}}class Lr extends t{constructor(e){super(),this.player=e,this.hasInit=!1,this.isDecodeFirstIIframe=!1,this.isInitInfo=!1,this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.decoder=null,this.initDecoder(),e.debug.log("Webcodecs","init")}destroy(){this.decoder&&("closed"!==this.decoder.state&&this.decoder.close(),this.decoder=null),this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.hasInit=!1,this.isInitInfo=!1,this.isDecodeFirstIIframe=!1,this.off(),this.player.debug.log("Webcodecs","destroy")}initDecoder(){const t=this;this.decoder=new VideoDecoder({output(e){t.handleDecode(e)},error(e){t.handleError(e)}})}handleDecode(e){this.isInitInfo||(this.player.video.updateVideoInfo({width:e.codedWidth,height:e.codedHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0),this.player._times.videoStart||(this.player._times.videoStart=m(),this.player.handlePlayToRenderTimes()),this.player.video.render({videoFrame:e,ts:e.timestamp}),this.player.handleRender(),this.player.updateStats({dfps:!0,buf:this.player.demux&&this.player.demux.delay||0})}handleError(e){this.player.debug.error("Webcodecs","VideoDecoder handleError",e)}decodeVideo(i,r,s,a){if(this.hasInit)if(this.isDecodeFirstIIframe||s||this.player.debug.warn("Webcodecs","VideoDecoder isDecodeFirstIIframe false and isIframe is false"),!this.isDecodeFirstIIframe&&s&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){let e=!1,t=(new Date).getTime();this.prevTimestamp||(this.prevTimestamp=t,e=!0);var n=t-this.prevTimestamp,n=(((this.decodeDiffTimestamp=n)<5||500(e[t]=` + + ${Ir[t]?`${Ir[t]}`:""} +`,e),{});function Br(e,t){let i=!1;return e.forEach(e=>{i||e.startTimestamp<=t&&e.endTimestamp>t&&(i=!0)}),i}function xr(e,t,i){let r=0 + ${a.title} + + `),s[h]);c&&(i+=` +

+ `),h+=1}t&&a.$playbackTimeListOne.insertAdjacentHTML("beforeend",t),i&&a.$playbackTimeListSecond.insertAdjacentHTML("beforeend",i),(d+=1){const s=m["events"]["proxy"],a=document.createElement("object");a.setAttribute("aria-hidden","true"),a.setAttribute("tabindex",-1),a.type="text/html",a.data="about:blank",E(a,{display:"block",position:"absolute",top:"0",left:"0",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:"-1"});let n=m.width,e=m.height;const t=et(()=>{m.width===n&&m.height===e||(n=m.width,e=m.height,m.emit(v.resize),l())},500),i=(s(a,"load",()=>{s(a.contentDocument.defaultView,"resize",()=>{t()})}),m.$container.appendChild(a),m.on(v.destroy,()=>{m.$container.removeChild(a)}),m.on(v.volumechange,()=>{var e,t,i;0===(e=m.volume)?(E(g.$volumeOn,"display","none"),E(g.$volumeOff,"display","flex"),E(g.$volumeHandle,"top","48px")):g.$volumeHandle&&g.$volumePanel&&(t=Ke(g.$volumePanel,"height")||60,i=Ke(g.$volumeHandle,"height"),E(g.$volumeHandle,"top",t-(t-i)*e-i+"px"),E(g.$volumeOn,"display","flex"),E(g.$volumeOff,"display","none")),g.$volumePanelText&&(g.$volumePanelText.innerHTML=parseInt(100*e))}),m.on(v.loading,e=>{E(g.$loading,"display",e?"flex":"none"),E(g.$poster,"display","none"),e&&E(g.$playBig,"display","none"),S()||e||(g.$loadingBgImage.width=0,g.$loadingBgImage.height=0,g.$loadingBgImage.src="",E(g.$loadingBg,"display","none"))}),e=>{m.fullscreen&&w(e)!==m.$container||r()}),r=e=>{e=rt(e)?e:m.fullscreen;E(g.$fullscreenExit,"display",e?"flex":"none"),E(g.$fullscreen,"display",e?"none":"flex")},o=()=>m._opt.playType===y&&m._opt.playbackConfig.showControl,l=i=>{S()&&g.$controls&&m._opt.useWebFullScreen&&setTimeout(()=>{if(m.fullscreen){const i=o()?48:38;var e=m.height/2-m.width+i/2,t=m.height/2-i/2;g.$controls.style.transform=`translateX(${-e}px) translateY(-${t}px) rotate(-90deg)`}else g.$controls.style.transform="translateX(0) translateY(0) rotate(0)";i&&i()},10)};try{f.on("change",i),m.events.destroys.push(()=>{f.off("change",i)})}catch(m){}m.on(v.webFullscreen,e=>{S()&&(r(e),l(()=>{u()}))}),m.on(v.recording,()=>{m.playing&&(E(g.$record,"display",m.recording?"none":"flex"),E(g.$recordStop,"display",m.recording?"flex":"none"),m._opt.hasControl||m._opt.isShowRecordingUI)&&E(g.$recording,"display",m.recording?"flex":"none")}),m.on(v.recordingTimestamp,e=>{g.$recordingTime&&(g.$recordingTime.innerHTML=ot(e))}),m.on(v.zooming,()=>{m.playing&&(E(g.$zoom,"display",m.zooming?"none":"flex"),E(g.$zoomStop,"display",m.zooming?"flex":"none"),m._opt.hasControl||m._opt.isShowZoomingUI)&&E(g.$zoomControls,"display",m.zooming?"flex":"none")}),m.on(v.playing,e=>{c(e)});const c=t=>{E(g.$play,"display",t?"none":"flex"),E(g.$playBig,"display",t?"none":"block"),E(g.$pause,"display",t?"flex":"none"),E(g.$screenshot,"display",t?"flex":"none"),E(g.$record,"display",t?"flex":"none"),E(g.$qualityMenu,"display",t?"flex":"none"),E(g.$volume,"display",t?"flex":"none"),E(g.$ptz,"display",t?"flex":"none"),E(g.$zoom,"display",t?"flex":"none"),E(g.$scaleMenu,"display",t?"flex":"none"),E(g.$faceDetect,"display",t?"flex":"none"),m.isPlayback()&&E(g.$speedMenu,"display",t?"flex":"none"),r(),g.extendBtnList.forEach(e=>{e.$iconWrap&&E(e.$iconWrap,"display",t?"flex":"none"),e.$activeIconWrap&&E(e.$activeIconWrap,"display","none")}),m._opt.showPerformance?E(g.$performanceActive,"display",t?"flex":"none"):E(g.$performance,"display",t?"flex":"none"),E(g.$ptzActive,"display","none"),E(g.$recordStop,"display","none"),E(g.$zoomStop,"display","none"),E(g.$faceDetectActive,"display","none"),t||(g.$speed&&(g.$speed.innerHTML="0 KB/s"),E(g.$zoomControls,"display","none"),E(g.$recording,"display","none"),g.$ptzControl&&g.$ptzControl.classList.remove("jessibuca-ptz-controls-show")),u()},u=(m.on(v.playbackPause,e=>{c(!e)}),m.on(v.kBps,e=>{if(m._opt.showBandwidth){const m=function(e){if(null==e||""===e||0===parseFloat(e)||"NaN"===e)return"0 KB/s";var t=["KB/s","MB/s","GB/s","TB/s","PB/s","EB/s","ZB/s","YB/s"],e=parseFloat(e),i=Math.floor(Math.log(e)/Math.log(1024));let r=e/Math.pow(1024,i);return(r=r.toFixed(2))+(t[i]||t[0])}(e);g.$speed&&(g.$speed.innerHTML=m),u()}}),()=>{if(o()){let e=g.controlsInnerRect.width-g.controlsLeftRect.width-g.controlsRightRect.width-g.controlsPlaybackBtnsRect.width;S()&&m.webFullscreen&&(e=g.controlsInnerRect.height-g.controlsLeftRect.height-g.controlsRightRect.height-g.controlsPlaybackBtnsRect.height),g.$playbackTimeInner.style.width=e+"px"}});if(o()){const s=()=>{if(o()){let e=0;var t,i,r=m.playback&&m.playback.playingTimestamp;r&&(t=(r=new Date(r)).getHours(),i=r.getMinutes(),r=r.getSeconds(),m.playback.is60Min?e=60*t+i:m.playback.is30Min?e=2*(60*t+i)+parseInt(r/30,10):m.playback.is10Min?e=6*(60*t+i)+parseInt(r/10,10):m.playback.is5Min?e=12*(60*t+i)+parseInt(r/5,10):m.playback.is1Min&&(e=60*(60*t+i)+parseInt(r,10)),g.$playbackCurrentTime.style.left=e+"px")}},a=e=>{g.$playbackNarrow.classList.remove("disabled"),g.$playbackExpand.classList.remove("disabled"),e===ve&&g.$playbackNarrow.classList.add("disabled"),e===Ee&&g.$playbackExpand.classList.add("disabled")},n=()=>{var e=g.$playbackCurrentTime.style.left,e=parseInt(e,10),t=g.controlsPlaybackTimeInner.width,e=0{g.$playbackCurrentTimeText&&(g.$playbackCurrentTimeText.innerText=Ye(e,"{h}:{i}:{s}")),s()}),m.on(v.playbackPrecision,(i,r)=>{g.$playbackTimeScroll.classList.remove(Se.oneHour,Se.halfHour,Se.fiveMin,Se.tenMin),g.$playbackTimeScroll.classList.add(Se[i]),g.rafId&&(window.cancelAnimationFrame(g.rafId),g.rafId=null),g.changePercisitionInterval&&(clearTimeout(g.changePercisitionInterval),g.changePercisitionInterval=null),g.$playbackTimeListOne.innerHTML="",g.$playbackTimeListSecond.innerHTML="",g.changePercisitionInterval=setTimeout(()=>{switch(g.$playbackTimeListOne.innerHTML="",g.$playbackTimeListSecond.innerHTML="",i){case ve:Pr(r,g);break;case be:t=g,xr(function(e){var s=0{u()}),u()}if(m._opt.operateBtns.quality&&0{s(e)});const s=i=>{g.$qualityText.innerText=i,g.$qualityMenuItems.forEach(e=>{var t=e.dataset.quality;e.classList.remove("jessibuca-quality-menu-item-active"),t===i&&e.classList.add("jessibuca-quality-menu-item-active")})};{const h=m._opt.qualityConfig||[];let t="";h.forEach(e=>{t+=` +
${e}
+ `}),t&&(g.$qualityMenuList.insertAdjacentHTML("beforeend",t),Object.defineProperty(g,"$qualityMenuItems",{value:m.$container.querySelectorAll(".jessibuca-quality-menu-item")}),setTimeout(()=>{var e=h[0];m.streamQuality=e},0))}m.streamQuality&&s(m.streamQuality)}if(m._opt.operateBtns.scale&&0{s(e)});const s=i=>{var e=m._opt.scaleConfig[i];g.$scaleText.innerText=e,g.$scaleMenuItems.forEach(e=>{var t=e.dataset.scale;e.classList.remove("jessibuca-scale-menu-item-active"),T(t)===T(i)&&e.classList.add("jessibuca-scale-menu-item-active")})};{var d=m._opt.scaleConfig||[];let i="";d.forEach((e,t)=>{i+=` +
${e}
+ `}),i&&(g.$scaleMenuList.insertAdjacentHTML("beforeend",i),Object.defineProperty(g,"$scaleMenuItems",{value:m.$container.querySelectorAll(".jessibuca-scale-menu-item")}))}s(m.scaleType)}if(m.isPlayback()&&m._opt.playbackConfig.showRateBtn&&0{s(e)});const s=i=>{var e=m._opt.playbackConfig.rateConfig.find(e=>T(e.value)===T(i));e&&(g.$speedText.innerText=e.label,g.$speedMenuItems.forEach(e=>{var t=e.dataset.speed;e.classList.remove("jessibuca-speed-menu-item-active"),T(t)===T(i)&&e.classList.add("jessibuca-speed-menu-item-active")}))};{d=m._opt.playbackConfig.rateConfig;let i="";d.forEach((e,t)=>{i+=` +
${e.label}
+ `}),i&&(g.$speedMenuList.insertAdjacentHTML("beforeend",i),Object.defineProperty(g,"$speedMenuItems",{value:m.$container.querySelectorAll(".jessibuca-speed-menu-item")}))}const a=m.playback?m.playback.playbackRate:1;s(a)}m.on(v.stats,function(){var e,t,i,r,s,a,n,o,l,c,u,d,h,p,f,A=0 + 版本 "2023-4-9" + +
+ 播放模式 ${h} +
+ ${m.isPlayback()?` +
+ 播放倍率 ${m.playback.rate}倍 +
+
+ 播放模式 ${m.playback.isUseFpsRender?"固定FPS":"动态FPS"} +
+ ${m.playback.isUseFpsRender?` +
+ 固定FPS ${m.video.getStreamFps()} +
+ `:""} + `:""} +
+ 解封装模式 ${W[a]} +
+
+ 解码模式 ${s} +
+
+ 渲染组件 ${r} +
+
+ 网络请求组件 ${n} +
+
+ 视频格式 ${e.encType||"-"} +
+
+ 视频(宽x高) ${e.width||"-"}x${e.height||"-"} +
+
+ 视频GOP(ms) ${c||"-"} +
+
+ 音频格式 ${ue[t.encType]||"-"} +
+
+ 音频引擎 ${o||"-"} +
+
+ 音频通道 ${t.channels||"-"} +
+
+ 音频采样率 ${t.sampleRate||"-"} +
+ ${m.isPlayer()?` +
+ 播放器初始化(ms) ${i.playTimestamp} +
+
+ 开始请求地址(ms) ${i.streamTimestamp} +
+
+ 请求响应(ms) ${i.streamResponseTimestamp} +
+
+ 解封装(ms) ${i.demuxTimestamp} +
+
+ 解码(ms) ${i.decodeTimestamp} +
+
+ 页面开始渲染(ms) ${i.videoTimestamp} +
+
+ 初始化到页面渲染(ms) ${i.allTimestamp} +
+ ${m.recording?` +
+ 视频录制时间 ${u} +
+
+ 视频录制大小 ${d} +
+ `:""} + `:""} +
+ 音频码率(bit) ${A.abps} +
+
+ 视频码率(bit) ${A.vbps} +
+
+ 视频帧率(fps) ${A.fps} +
+
+ 视频峰值帧率(fps) ${A.maxFps} +
+
+ 解码帧率(fps) ${A.dfps} +
+
+ 音频缓冲帧 ${A.audioBuffer} +
+ ${m.isPlayer()?` +
+ 视频待解码帧 ${A.demuxBuffer} +
+ `:` +
+ 缓存时长(ms) ${A.playbackCacheDataDuration} +
+
+ 视频待渲染帧 ${A.playbackVideoBuffer} +
+
+ 视频待解码帧 ${A.demuxBuffer} +
+
+ 音频待解码帧 ${A.audioDemuxBuffer} +
+ `} +
+ 待解封装数据(byte) ${A.flvBuffer} +
+ ${m._opt.useMSE?` +
+ MSE缓冲时长(ms) ${A.mseDelay} +
+
+ MSE解码间隔(ms) ${A.mseDecodeDiffTimes} +
+
+ MSE解码时间(ms) ${A.mseTs} +
+
+ MSE播放模式 ${1 +
+ `:""} + ${m._opt.useWCS?` +
+ WCS解码间隔(ms) ${A.wcsDecodeDiffTimes} +
+ `:""} + ${m._opt.isHls?`
+ HLS缓冲时长(ms) ${A.hlsDelay} +
+
+ HLS播放模式 ${1 +
+ `:""} +
+ 网络延迟(ms) ${A.netBuf} +
+
+ 缓冲时长(ms) ${A.buf} +
+
+ 最新缓冲时长(ms) ${A.pushLatestDelay} +
+
+ 视频显示时间(ms) ${A.ts} +
+ ${m._opt.hasAudio&&m.isAudioNotMute()?` +
+ 音频显示时间(ms) ${A.audioTs} +
+ ${m._opt.hasVideo?` +
+ 音视频同步时间戳(ms) ${A.ts-A.audioTs} +
+ `:""} +
+ 音频播放模式 ${l?"加速":"正常"} +
+ `:""} +
+ 视频解码时间(ms) ${A.dts} +
+ +
+ 解码前-解码后延迟(ms) ${A.delayTs} +
+
+ 总延迟(网络+解码)(ms) ${A.totalDelayTs} +
+ ${A.isStreamTsMoreThanLocal?'
\n 是否超过一倍率推流 是\n
\n ':""} +
+ 是否在丢帧 ${p} +
+
+ 播放时长(s) ${ot(A.pTs)} +
+
+ `,g.$performancePanel.insertAdjacentHTML("beforeend",f)):(g.$performancePanel.innerHTML="",E(g.$performancePanel,"display","none"))}),m.on(v.togglePerformancePanel,e=>{E(g.$performance,"display",e?"none":"flex"),E(g.$performanceActive,"display",e?"flex":"none")}),m.on(v.faceDetectActive,e=>{E(g.$faceDetect,"display",e?"none":"flex"),E(g.$faceDetectActive,"display",e?"flex":"none")})};function Or(e,t){var i,r,t=(t=void 0===t?{}:t).insertAt;e&&"undefined"!=typeof document&&(i=document.head||document.getElementsByTagName("head")[0],(r=document.createElement("style")).type="text/css","top"===t&&i.firstChild?i.insertBefore(r,i.firstChild):i.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e)))}function _r(e,t){t instanceof Element?e.appendChild(t):e.insertAdjacentHTML("beforeend",String(t)),e.lastElementChild||e.lastChild}function x(e,t,i){e.style[t]=i}function Mr(e,t){return e.composedPath&&-1 +
+
+
+
+
+
+
+
+
+
+
00:00:00
+
+
+
+
+
+
${B.narrow}
+
${B.expand}
+
+ + `,l.$container.insertAdjacentHTML("beforeend",` + ${u.background?`
`:""} +
+ +
+ ${u.loadingIcon?` +
+ ${B.loading} + ${u.loadingText?`
${u.loadingText}
`:""} +
+ `:""} + ${u.hasControl&&d.play?'
':""} + ${u.hasControl&&d.ptz?'\n
\n
\n
\n
\n
\n
\n
\n
\n ':""} + ${u.hasVideo?` +
+
${B.narrow}
+
电子放大
+
${B.expand}
+
${B.zoomStop}
+
+
+
+
00:00:00
+
${B.recordStop}
+
+ `:""} + + ${u.hasControl?` +
+
+
+ ${u.showBandwidth?'
':""} +
+ ${u.playType===y&&u.playbackConfig.showControl?h:""} + +
+ ${u.playType===y&&u.playbackConfig.showRateBtn?'\n
\n
\n
\n
\n
\n
\n ':""} + ${d.close?`
${B.close}
`:""} + ${d.performance?`
${B.performance}
${B.performanceActive}
`:""} + ${d.aiFace?`
${B.face}
${B.faceActive}
`:""} + ${d.quality?'\n
\n
\n
\n
\n
\n
\n ':""} + ${d.scale?'\n
\n
\n
\n
\n
\n
\n ':""} + ${d.audio?` +
+
+ ${B.audio} + ${B.mute} +
+
+
+
+
+
+
+
+ `:""} + ${d.play?`
${B.play}
${B.pause}
`:""} + ${d.screenshot?`
${B.screenshot}
`:""} + ${d.record?`
${B.record}
${B.recordStop}
`:""} + ${d.ptz?`
${B.ptz}
${B.ptzActive}
`:""} + ${d.zoom?`
${B.zoom}
${B.zoomStop}
`:""} + ${d.fullscreen?`
${B.fullscreen}
${B.fullscreenExit}
`:""} +
+
+
+ `:""} +
+
+ `),Object.defineProperty(c,"$poster",{value:l.$container.querySelector(".jessibuca-poster")}),Object.defineProperty(c,"$loadingBg",{value:l.$container.querySelector(".jessibuca-loading-bg")}),Object.defineProperty(c,"$loadingBgImage",{value:l.$container.querySelector(".jessibuca-loading-bg-image")}),Object.defineProperty(c,"$loading",{value:l.$container.querySelector(".jessibuca-loading")}),Object.defineProperty(c,"$play",{value:l.$container.querySelector(".jessibuca-play")}),Object.defineProperty(c,"$playBig",{value:l.$container.querySelector(".jessibuca-play-big")}),Object.defineProperty(c,"$recording",{value:l.$container.querySelector(".jessibuca-recording")}),Object.defineProperty(c,"$recordingTime",{value:l.$container.querySelector(".jessibuca-recording-time")}),Object.defineProperty(c,"$recordingStop",{value:l.$container.querySelector(".jessibuca-recording-stop")}),Object.defineProperty(c,"$pause",{value:l.$container.querySelector(".jessibuca-pause")}),Object.defineProperty(c,"$controls",{value:l.$container.querySelector(".jessibuca-controls")}),Object.defineProperty(c,"$controlsInner",{value:l.$container.querySelector(".jessibuca-controls-bottom")}),Object.defineProperty(c,"$controlsLeft",{value:l.$container.querySelector(".jessibuca-controls-left")}),Object.defineProperty(c,"$controlsRight",{value:l.$container.querySelector(".jessibuca-controls-right")}),Object.defineProperty(c,"$volume",{value:l.$container.querySelector(".jessibuca-volume")}),Object.defineProperty(c,"$volumePanelWrap",{value:l.$container.querySelector(".jessibuca-volume-panel-wrap")}),Object.defineProperty(c,"$volumePanelText",{value:l.$container.querySelector(".jessibuca-volume-panel-text")}),Object.defineProperty(c,"$volumePanel",{value:l.$container.querySelector(".jessibuca-volume-panel")}),Object.defineProperty(c,"$volumeHandle",{value:l.$container.querySelector(".jessibuca-volume-panel-handle")}),Object.defineProperty(c,"$volumeOn",{value:l.$container.querySelector(".jessibuca-icon-audio")}),Object.defineProperty(c,"$volumeOff",{value:l.$container.querySelector(".jessibuca-icon-mute")}),Object.defineProperty(c,"$fullscreen",{value:l.$container.querySelector(".jessibuca-fullscreen")}),Object.defineProperty(c,"$fullscreenExit",{value:l.$container.querySelector(".jessibuca-fullscreen-exit")}),Object.defineProperty(c,"$record",{value:l.$container.querySelector(".jessibuca-record")}),Object.defineProperty(c,"$recordStop",{value:l.$container.querySelector(".jessibuca-record-stop")}),Object.defineProperty(c,"$screenshot",{value:l.$container.querySelector(".jessibuca-screenshot")}),Object.defineProperty(c,"$speed",{value:l.$container.querySelector(".jessibuca-speed")}),Object.defineProperty(c,"$playbackTime",{value:l.$container.querySelector(".jessibuca-controls-playback-time")}),Object.defineProperty(c,"$playbackTimeInner",{value:l.$container.querySelector(".jessibuca-controls-playback-time-inner")}),Object.defineProperty(c,"$playbackTimeScroll",{value:l.$container.querySelector(".jessibuca-controls-playback-time-scroll")}),Object.defineProperty(c,"$playbackTimeList",{value:l.$container.querySelector(".jessibuca-controls-playback-time-list")}),Object.defineProperty(c,"$playbackTimeListOne",{value:l.$container.querySelector(".jessibuca-playback-time-one-wrap")}),Object.defineProperty(c,"$playbackTimeListSecond",{value:l.$container.querySelector(".jessibuca-playback-time-second-wrap")}),Object.defineProperty(c,"$playbackCurrentTime",{value:l.$container.querySelector(".jessibuca-controls-playback-current-time")}),Object.defineProperty(c,"$playbackCurrentTimeText",{value:l.$container.querySelector(".jessibuca-controls-playback-current-time-text")}),Object.defineProperty(c,"$controlsPlaybackBtns",{value:l.$container.querySelector(".jessibuca-controls-playback-btns")}),Object.defineProperty(c,"$playbackNarrow",{value:l.$container.querySelector(".jessibuca-playback-narrow")}),Object.defineProperty(c,"$playbackExpand",{value:l.$container.querySelector(".jessibuca-playback-expand")}),Object.defineProperty(c,"$ptz",{value:l.$container.querySelector(".jessibuca-ptz")}),Object.defineProperty(c,"$ptzActive",{value:l.$container.querySelector(".jessibuca-ptz-active")}),Object.defineProperty(c,"$ptzControl",{value:l.$container.querySelector(".jessibuca-ptz-controls")}),Object.defineProperty(c,"$ptzBgActive",{value:l.$container.querySelector(".jessibuca-ptz-bg-active")}),Object.defineProperty(c,"$ptzControlCircular",{value:l.$container.querySelector(".jessibuca-ptz-control")}),Object.defineProperty(c,"$ptzArrows",{value:l.$container.querySelectorAll(".jessibuca-ptz-arrow")}),Object.defineProperty(c,"$qualityText",{value:l.$container.querySelector(".jessibuca-quality-icon-text")}),Object.defineProperty(c,"$qualityMenu",{value:l.$container.querySelector(".jessibuca-quality-menu")}),Object.defineProperty(c,"$qualityMenuList",{value:l.$container.querySelector(".jessibuca-quality-menu-list")}),Object.defineProperty(c,"$scaleText",{value:l.$container.querySelector(".jessibuca-scale-icon-text")}),Object.defineProperty(c,"$scaleMenu",{value:l.$container.querySelector(".jessibuca-scale-menu")}),Object.defineProperty(c,"$scaleMenuList",{value:l.$container.querySelector(".jessibuca-scale-menu-list")}),Object.defineProperty(c,"$zoom",{value:l.$container.querySelector(".jessibuca-zoom")}),Object.defineProperty(c,"$zoomStop",{value:l.$container.querySelector(".jessibuca-zoom-stop")}),Object.defineProperty(c,"$zoomNarrow",{value:l.$container.querySelector(".jessibuca-zoom-narrow")}),Object.defineProperty(c,"$zoomExpand",{value:l.$container.querySelector(".jessibuca-zoom-expand")}),Object.defineProperty(c,"$zoomStop2",{value:l.$container.querySelector(".jessibuca-zoom-stop2")}),Object.defineProperty(c,"$close",{value:l.$container.querySelector(".jessibuca-close")}),Object.defineProperty(c,"$zoomControls",{value:l.$container.querySelector(".jessibuca-zoom-controls")}),Object.defineProperty(c,"$performancePanel",{value:l.$container.querySelector(".jessibuca-performance-panel")}),Object.defineProperty(c,"$performance",{value:l.$container.querySelector(".jessibuca-performance")}),Object.defineProperty(c,"$performanceActive",{value:l.$container.querySelector(".jessibuca-performance-active")}),Object.defineProperty(c,"$faceDetect",{value:l.$container.querySelector(".jessibuca-face")}),Object.defineProperty(c,"$faceDetectActive",{value:l.$container.querySelector(".jessibuca-face-active")}),Object.defineProperty(c,"$contextmenus",{value:l.$container.querySelector(".jessibuca-contextmenus")}),Object.defineProperty(c,"$speedText",{value:l.$container.querySelector(".jessibuca-speed-icon-text")}),Object.defineProperty(c,"$speedMenu",{value:l.$container.querySelector(".jessibuca-speed-menu")}),Object.defineProperty(c,"$speedMenuList",{value:l.$container.querySelector(".jessibuca-speed-menu-list")}),0{this.addExtendBtn(e)}),o=this,Object.defineProperty(o,"controlsRect",{get:()=>o.$controls.getBoundingClientRect()}),Object.defineProperty(o,"controlsInnerRect",{get:()=>o.$controlsInner.getBoundingClientRect()}),Object.defineProperty(o,"controlsLeftRect",{get:()=>o.$controlsLeft.getBoundingClientRect()}),Object.defineProperty(o,"controlsRightRect",{get:()=>o.$controlsRight.getBoundingClientRect()}),Object.defineProperty(o,"controlsPlaybackTimeInner",{get:()=>o.$playbackTimeInner&&o.$playbackTimeInner.getBoundingClientRect()||{}}),Object.defineProperty(o,"controlsPlaybackBtnsRect",{get:()=>o.$controlsPlaybackBtns&&o.$controlsPlaybackBtns.getBoundingClientRect()||{width:0}}),Fr(e,this);{var r=e,s=this;const p=r["events"]["proxy"],f=r._opt,A=f.operateBtns;function t(e){var{bottom:t,height:i}=s.$volumePanel.getBoundingClientRect(),r=s.$volumeHandle.getBoundingClientRect()["height"];return b(t-e.y-r/2,0,i-r/2)/(i-r)}if(p(window,["click","contextmenu"],e=>{-1{setTimeout(()=>{r.resize()},300)}),p(s.$controls,"click",e=>{e.stopPropagation()}),A.play&&(p(s.$pause,"click",e=>{f.playType===y&&f.playbackConfig.uiUsePlaybackPause?r.playbackPause=!0:k(A.pauseFn)?A.pauseFn():r.pause()}),p(s.$play,"click",e=>{f.playType===y&&r.playbackPause?r.playbackPause=!1:k(A.playFn)?A.playFn():(r.play(),r.resumeAudioAfterPause())})),p(s.$playBig,"click",e=>{f.playType===y&&r.playbackPause?r.playbackPause=!1:k(A.playFn)?A.playFn():(r.play(),r.resumeAudioAfterPause())}),A.screenshot&&p(s.$screenshot,"click",e=>{e.stopPropagation(),k(A.screenshotFn)?A.screenshotFn():r.video.screenshot()}),A.audio&&(p(s.$volume,"mouseover",()=>{s.$volumePanelWrap.classList.add("jessibuca-volume-panel-wrap-show")}),p(s.$volume,"mouseout",()=>{s.$volumePanelWrap.classList.remove("jessibuca-volume-panel-wrap-show")}),p(s.$volumeOn,"click",e=>{e.stopPropagation(),E(s.$volumeOn,"display","none"),E(s.$volumeOff,"display","block");e=r.volume;r.volume=0,r._lastVolume=e}),p(s.$volumeOff,"click",e=>{e.stopPropagation(),E(s.$volumeOn,"display","block"),E(s.$volumeOff,"display","none"),r.volume=r.lastVolume||.5}),p(s.$volumePanel,"click",e=>{e.stopPropagation(),r.volume=t(e)}),p(s.$volumeHandle,"mousedown",()=>{s.isVolumeDroging=!0}),p(s.$volumeHandle,"mousemove",e=>{s.isVolumeDroging&&(r.volume=t(e))}),p(document,"mouseup",()=>{s.isVolumeDroging&&(s.isVolumeDroging=!1)})),A.record&&(p(s.$record,"click",e=>{e.stopPropagation(),k(A.recordFn)?A.recordFn():r.recording=!0}),p(s.$recordStop,"click",e=>{e.stopPropagation(),k(A.recordStopFn)?A.recordStopFn():r.recording=!1})),p(s.$recordingStop,"click",e=>{e.stopPropagation(),k(A.recordStopFn)?A.recordStopFn():r.recording=!1}),A.fullscreen&&(p(s.$fullscreen,"click",e=>{e.stopPropagation(),k(A.fullscreenFn)?A.fullscreenFn():r.fullscreen=!0}),p(s.$fullscreenExit,"click",e=>{e.stopPropagation(),k(A.fullscreenExitFn)?A.fullscreenExitFn():r.fullscreen=!1})),A.ptz&&(p(s.$ptz,"click",e=>{e.stopPropagation(),E(s.$ptzActive,"display","flex"),E(s.$ptz,"display","none"),s.$ptzControl.classList.add("jessibuca-ptz-controls-show")}),p(s.$ptzActive,"click",e=>{e.stopPropagation(),E(s.$ptz,"display","flex"),E(s.$ptzActive,"display","none"),s.$ptzControl.classList.remove("jessibuca-ptz-controls-show")}),s.$ptzArrows.forEach(e=>{if(f.ptzClickType===q)p(e,"click",e=>{e.stopPropagation();e=e.currentTarget.dataset.arrow;s.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-show"),s.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-"+e),s.$ptzControlCircular.classList.add("jessibuca-ptz-control-"+e),r.emit(v.ptz,e),setTimeout(()=>{s.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-show"),we.forEach(e=>{s.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-"+e),s.$ptzControlCircular.classList.remove("jessibuca-ptz-control-"+e)}),r.emit(v.ptz,"stop")},300)});else if("mouseDownAndUp"===f.ptzClickType){let t=!1;p(e,"mousedown",e=>{e.stopPropagation(),t=!0;e=e.currentTarget.dataset.arrow;s.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-show"),s.$ptzBgActive.classList.add("jessibuca-ptz-bg-active-"+e),s.$ptzControlCircular.classList.add("jessibuca-ptz-control-"+e),r.emit(v.ptz,e)});const i=()=>{t=!1,s.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-show"),we.forEach(e=>{s.$ptzBgActive.classList.remove("jessibuca-ptz-bg-active-"+e),s.$ptzControlCircular.classList.remove("jessibuca-ptz-control-"+e)}),r.emit(v.ptz,"stop")};p(e,"mouseup",e=>{e.stopPropagation(),t&&i()}),p(window,"mouseup",e=>{e.stopPropagation(),t&&i()})}})),A.performance&&(p(s.$performance,"click",e=>{e.stopPropagation(),r.togglePerformancePanel(!0)}),p(s.$performanceActive,"click",e=>{e.stopPropagation(),r.togglePerformancePanel(!1)})),A.aiFace&&(p(s.$faceDetect,"click",e=>{e.stopPropagation(),r.faceDetect(!0)}),p(s.$faceDetectActive,"click",e=>{e.stopPropagation(),r.faceDetect(!1)})),r._opt.hasControl&&r._opt.controlAutoHide){p(r.$container,"mouseover",()=>{r.fullscreen||(E(s.$controls,"display","block"),f())}),p(r.$container,"mousemove",()=>{r.$container&&s.$controls&&(r.fullscreen,"none"===s.$controls.style.display)&&(E(s.$controls,"display","block"),f())}),p(r.$container,"mouseout",()=>{A(),E(s.$controls,"display","none")});let e=null;const f=()=>{A(),e=setTimeout(()=>{E(s.$controls,"display","none")},5e3)},A=()=>{e&&(clearTimeout(e),e=null)}}r._opt.playType===y&&(p(s.$playbackNarrow,"click",e=>{e.stopPropagation(),r.playback&&r.playback.narrowPrecision()}),p(s.$playbackExpand,"click",e=>{e.stopPropagation(),r.playback&&r.playback.expandPrecision()}),p(s.$playbackTimeList,"click",e=>{e=w(e);e.matches("div.jessibuca-playback-time-minute-one")&&r.playback&&r.playback.seek(e.dataset)}),r._opt.playbackConfig.showRateBtn&&(p(s.$speedMenu,"mouseover",()=>{s.$speedMenuList.classList.add("jessibuca-speed-menu-shown")}),p(s.$speedMenu,"mouseout",()=>{s.$speedMenuList.classList.remove("jessibuca-speed-menu-shown")}),p(s.$speedMenuList,"click",e=>{var t=w(e);if(t.matches("div.jessibuca-speed-menu-item")){const e=t.dataset;r.emit(v.playbackPreRateChange,e.speed)}})),r._opt.playbackConfig.supportWheel)&&p(s.$playbackTimeInner,"wheel",e=>{e.preventDefault(),0<(e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3)?r.playback&&r.playback.expandPrecision():r.playback&&r.playback.narrowPrecision()}),A.quality&&(p(s.$qualityMenu,"mouseover",()=>{s.$qualityMenuList.classList.add("jessibuca-quality-menu-shown")}),p(s.$qualityMenu,"mouseout",()=>{s.$qualityMenuList.classList.remove("jessibuca-quality-menu-shown")}),p(s.$qualityMenuList,"click",e=>{var t=w(e);if(t.matches("div.jessibuca-quality-menu-item")){const e=t.dataset;r.streamQuality=e.quality}})),A.scale&&(p(s.$scaleMenu,"mouseover",()=>{s.$scaleMenuList.classList.add("jessibuca-scale-menu-shown")}),p(s.$scaleMenu,"mouseout",()=>{s.$scaleMenuList.classList.remove("jessibuca-scale-menu-shown")}),p(s.$scaleMenuList,"click",e=>{var t=w(e);if(t.matches("div.jessibuca-scale-menu-item")){const e=t.dataset;r.setScaleMode(e.scale)}})),A.zoom&&(p(s.$zoom,"click",e=>{e.stopPropagation(),r.zooming=!0}),p(s.$zoomStop,"click",e=>{e.stopPropagation(),r.zooming=!1})),p(s.$zoomExpand,"click",e=>{e.stopPropagation(),r.zoom&&r.zoom.expandPrecision()}),p(s.$zoomNarrow,"click",e=>{e.stopPropagation(),r.zoom&&r.zoom.narrowPrecision()}),p(s.$zoomStop2,"click",e=>{e.stopPropagation(),r.zooming=!1}),A.close&&p(s.$close,"click",e=>{e.stopPropagation(),r.doDestroy()})}if(e._opt.hotKey){var i=e,a=this;const m=i["events"]["proxy"],g={};function n(e,t){g[e]?g[e].push(t):g[e]=[t]}n(27,()=>{i.fullscreen&&(i.fullscreen=!1)}),n(38,()=>{i.volume+=.05}),n(40,()=>{i.volume-=.05}),m(window,"keydown",e=>{if(a.isFocus){const a=document.activeElement.tagName.toUpperCase(),t=document.activeElement.getAttribute("contenteditable");if("INPUT"!==a&&"TEXTAREA"!==a&&""!==t&&"true"!==t){const a=g[e.keyCode];a&&(e.preventDefault(),a.forEach(e=>e()))}}})}var o,l,c,u,d,h;this.btnIndex=0,this.initLoadingBackground(),this.player.debug.log("Control","init")}getBtnIndex(){return this.btnIndex++}destroy(){this.$performancePanel&&(this.$performancePanel.innerHTML="",this.player.$container.removeChild(this.$performancePanel)),this.$poster&&this.player.$container.removeChild(this.$poster),this.$loading&&this.player.$container.removeChild(this.$loading),this.$loadingBg&&this.player.$container.removeChild(this.$loadingBg),this.$controls&&this.player.$container.removeChild(this.$controls),this.$playBig&&this.player.$container.removeChild(this.$playBig),this.$recording&&this.player.$container.removeChild(this.$recording),this.$ptzControl&&this.player.$container.removeChild(this.$ptzControl),this.$zoomControls&&this.player.$container.removeChild(this.$zoomControls),this.$contextmenus&&(this.$contextmenus.innerHTML="",this.player.$container.removeChild(this.$contextmenus)),this.extendBtnList=[],this.player.$container.classList.remove("jessibuca-controls-show-auto-hide"),this.player.$container.classList.remove("jessibuca-controls-show"),this.player.debug.log("control","destroy")}autoSize(){var e=this.player;e.$container.style.padding="0 0";const t=e.width,i=e.height,r=t/i,s=e.video.$videoElement.width/e.video.$videoElement.height;if(r>s){const r=(t-i*s)/2;e.$container.style.padding=`0 ${r}px`}else{const r=(i-t/s)/2;e.$container.style.padding=r+"px 0"}}initLoadingBackground(){var r=this.player;if(r._opt.loadingBackground&&r._opt.heartTimeoutReplayUseLastFrameShow){let e=r.height;var s=r._opt,a=(s.hasControl&&!s.controlAutoHide&&(e-=s.playType===y?48:38),this.$loadingBgImage.width=r.width,this.$loadingBgImage.height=e,s.rotate);270!==a&&90!==a||(control.$loadingBgImage.width=e,control.$loadingBgImage.height=r.width),this.$loadingBgImage.src=r._opt.loadingBackground;let t="contain",i=(s.isResize||(t="fill"),s.isFullResize&&(t="none"),"");"none"===s.mirrorRotate&&a&&(i+=" rotate("+a+"deg)"),"level"===s.mirrorRotate?i+=" rotateY(180deg)":"vertical"===s.mirrorRotate&&(i+=" rotateX(180deg)"),this.$loadingBgImage.style.transform=i,this.$loadingBgImage.style.objectFit=t,x(this.$loadingBg,"display","block")}}_validateExtendBtn(t){let e=!0;return t.name||(this.player.debug.warn("Control","extend button name is required"),e=!1),e&&-1!==this.extendBtnList.findIndex(e=>e.name===t.name)&&(this.player.debug.warn("Control",`extend button name: ${t.name} is already exist`),e=!1),e&&!t.icon&&(this.player.debug.warn("Control","extend button icon is required"),e=!1),e}addExtendBtn(){let t=0 + ${t.icon?`
+ + ${t.iconTitle?` + ${t.iconTitle} + `:""} +
`:""} + ${t.activeIcon?`
+ + ${t.activeIconTitle?` + ${t.activeIconTitle} + `:""} +
`:""} + + `,n=Array.from(r.children)[t.index],o=(n?n.insertAdjacentHTML("beforebegin",a):_r(r,a),t.icon?r.querySelector(".jessibuca-icon-extend-"+i):null),l=t.icon?r.querySelector(".jessibuca-control-extend-"+i):null,c=t.activeIcon?r.querySelector(`.jessibuca-icon-extend-${i}-active`):null,u=t.activeIcon?r.querySelector(`.jessibuca-control-extend-${i}-active`):null,{proxy:d}=this.player["events"];t.icon&&(x(o,"background",`url(${t.icon}) no-repeat center`),x(o,"background-size","100% 100%"),x(l,"display","none"),t.iconHover)&&(d(o,"mouseover",()=>{x(o,"background",`url(${t.iconHover}) no-repeat center`),x(o,"background-size","100% 100%")}),d(o,"mouseout",()=>{x(o,"background",`url(${t.icon}) no-repeat center`),x(o,"background-size","100% 100%")})),t.activeIcon&&(x(c,"background",`url(${t.activeIcon}) no-repeat center`),x(c,"background-size","100% 100%"),x(u,"display","none"),t.activeIconHover)&&(d(c,"mouseover",()=>{x(c,"background",`url(${t.activeIconHover}) no-repeat center`),x(c,"background-size","100% 100%")}),d(c,"mouseout",()=>{x(c,"background",`url(${t.activeIcon}) no-repeat center`),x(c,"background-size","100% 100%")})),t.click&&o&&d(o,"click",e=>{e.preventDefault(),s&&(x(l,"display","none"),x(u,"display","flex")),t.click.call(this.player,this,e)}),t.activeClick&&c&&d(c,"click",e=>{e.preventDefault(),x(l,"display","flex"),x(u,"display","none"),t.activeClick.call(this.player,this,e)}),this.extendBtnList.push({name:i,$iconWrap:l,$activeIconWrap:u})}}}Or(".jessibuca-container{position:relative;width:100%;height:100%;overflow:hidden}.jessibuca-container.jessibuca-fullscreen-web{position:fixed;z-index:9999;left:0;top:0;right:0;bottom:0;width:100vw!important;height:100vh!important;background:#000}");class O{static init(){for(var e in O.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},O.types)O.types.hasOwnProperty(e)&&(O.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var t=O.constants={};t.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),t.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),t.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSC=t.STCO=t.STTS,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.HDLR_VIDEO=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]),t.HDLR_AUDIO=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]),t.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}static box(e){let t=8,i=null,r=Array.prototype.slice.call(arguments,1),s=r.length;for(let e=0;e>>24&255,i[1]=t>>>16&255,i[2]=t>>>8&255,i[3]=255&t,i.set(e,4);let a=8;for(let e=0;e>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,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]))}static trak(e){return O.box(O.types.trak,O.tkhd(e),O.mdia(e))}static tkhd(e){var t=e.id,i=e.duration,r=e.presentWidth,e=e.presentHeight;return O.box(O.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>>8&255,255&r,0,0,e>>>8&255,255&e,0,0]))}static mdia(e){return O.box(O.types.mdia,O.mdhd(e),O.hdlr(e),O.minf(e))}static mdhd(e){var t=e.timescale,e=e.duration;return O.box(O.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t,e>>>24&255,e>>>16&255,e>>>8&255,255&e,85,196,0,0]))}static hdlr(e){e="audio"===e.type?O.constants.HDLR_AUDIO:O.constants.HDLR_VIDEO;return O.box(O.types.hdlr,e)}static minf(e){var t="audio"===e.type?O.box(O.types.smhd,O.constants.SMHD):O.box(O.types.vmhd,O.constants.VMHD);return O.box(O.types.minf,t,O.dinf(),O.stbl(e))}static dinf(){return O.box(O.types.dinf,O.box(O.types.dref,O.constants.DREF))}static stbl(e){return O.box(O.types.stbl,O.stsd(e),O.box(O.types.stts,O.constants.STTS),O.box(O.types.stsc,O.constants.STSC),O.box(O.types.stsz,O.constants.STSZ),O.box(O.types.stco,O.constants.STCO))}static stsd(e){return"audio"===e.type?O.box(O.types.stsd,O.constants.STSD_PREFIX,O.mp4a(e)):"avc"===e.videoType?O.box(O.types.stsd,O.constants.STSD_PREFIX,O.avc1(e)):O.box(O.types.stsd,O.constants.STSD_PREFIX,O.hvc1(e))}static mp4a(e){var t=e.channelCount,i=e.audioSampleRate,t=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t,0,16,0,0,0,0,i>>>8&255,255&i,0,0]);return O.box(O.types.mp4a,t,O.esds(e))}static esds(e){var e=e.config||[],t=e.length,t=new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e).concat([6,1,2]));return O.box(O.types.esds,t)}static avc1(e){var t=e.avcc,i=e.codecWidth,e=e.codecHeight,i=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,i>>>8&255,255&i,e>>>8&255,255&e,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return O.box(O.types.avc1,i,O.box(O.types.avcC,t))}static hvc1(e){var t=e.avcc,i=e.codecWidth,e=e.codecHeight,i=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,i>>>8&255,255&i,e>>>8&255,255&e,0,72,0,0,0,72,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,24,255,255]);return O.box(O.types.hvc1,i,O.box(O.types.hvcC,t))}static mvex(e){return O.box(O.types.mvex,O.trex(e))}static trex(e){e=e.id,e=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return O.box(O.types.trex,e)}static moof(e,t){return O.box(O.types.moof,O.mfhd(e.sequenceNumber),O.traf(e,t))}static mfhd(e){e=new Uint8Array([0,0,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e]);return O.box(O.types.mfhd,e)}static traf(e,t){var i=e.id,i=O.box(O.types.tfhd,new Uint8Array([0,0,0,0,i>>>24&255,i>>>16&255,i>>>8&255,255&i])),t=O.box(O.types.tfdt,new Uint8Array([0,0,0,0,t>>>24&255,t>>>16&255,t>>>8&255,255&t])),r=O.sdtp(e),e=O.trun(e,r.byteLength+16+16+8+16+8+8);return O.box(O.types.traf,i,t,e,r)}static sdtp(e){var t=new Uint8Array(5),e=e.flags;return t[4]=e.isLeading<<6|e.dependsOn<<4|e.isDependedOn<<2|e.hasRedundancy,O.box(O.types.sdtp,t)}static trun(e,t){var i=new Uint8Array(28),t=(i.set([0,0,15,1,0,0,0,1,(t+=36)>>>24&255,t>>>16&255,t>>>8&255,255&t],0),e.duration),r=e.size,s=e.flags,e=e.cts;return i.set([t>>>24&255,t>>>16&255,t>>>8&255,255&t,r>>>24&255,r>>>16&255,r>>>8&255,255&r,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.isNonSync,0,0,e>>>24&255,e>>>16&255,e>>>8&255,255&e],12),O.box(O.types.trun,i)}static mdat(e){return O.box(O.types.mdat,e)}}O.init();class jr extends t{constructor(t){super(),this.player=t,this.isAvc=!0,this.mediaSource=new window.MediaSource,this.sourceBuffer=null,this.hasInit=!1,this.isInitInfo=!1,this.cacheTrack={},this.timeInit=!1,this.sequenceNumber=0,this.dropping=!1,this.firstRenderTime=null,this.$videoElement=null,this.mediaSourceAppendBufferFull=!1,this.mediaSourceAppendBufferError=!1,this.isDecodeFirstIIframe=!1,this.prevTimestamp=null,this.decodeDiffTimestamp=null,this.prevDts=null,this.prevTs=null,this.mediaSourceObjectURL=window.URL.createObjectURL(this.mediaSource),this.eventListenList=[],t._opt.mseUseCanvasRender?(this.$videoElement=document.createElement("video"),this.$videoElement.src=this.mediaSourceObjectURL,this.initVideoEvents()):(this.player.video.$videoElement.src=this.mediaSourceObjectURL,this.$videoElement=this.player.video.$videoElement);const{proxy:e}=t["events"],i=e(this.mediaSource,"sourceopen",()=>{this.player&&this.player.emit(v.mseSourceOpen)}),r=e(this.mediaSource,"sourceclose",()=>{this.player&&this.player.emit(v.mseSourceClose)}),s=e(this.mediaSource,"sourceended",()=>{this.player&&this.player.emit(v.mseSourceended)});if(this.eventListenList.push(i,r,s),this.player.isPlayer){const a=e(this.$videoElement,De,e=>{if(this._handleUpdatePlaybackRate(),t._opt.mseUseCanvasRender)if(this.player.checkIsInRender())this.player.handleRender();else{const t=parseInt(e.timeStamp,10);this.player.debug.warn("MediaSource",`mseUseCanvasRender is true and $videoElement ts is ${t}, but not in render`)}else this.player.handleRender()}),i=e(this.$videoElement,Le,()=>{t.debug.log("MediaSource","video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)});this.eventListenList.push(a,i)}t.debug.log("MediaSource","init")}destroy(){this.stop(),this.eventListenList.length&&(this.eventListenList.forEach(e=>e()),this.eventListenList=[]),this.mediaSource=null,this.sourceBuffer=null,this.hasInit=!1,this.isInitInfo=!1,this.sequenceNumber=0,this.cacheTrack={},this.timeInit=!1,this.mediaSourceAppendBufferFull=!1,this.mediaSourceAppendBufferError=!1,this.isDecodeFirstIIframe=!1,this.prevTimestamp=null,this.prevDts=null,this.prevTs=null,this.firstRenderTime=null,this.dropping=!1,this.$videoElement&&(this.player._opt.mseUseCanvasRender&&this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$videoElement=null),this.mediaSourceObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceObjectURL),this.mediaSourceObjectURL=null),this.off(),this.player.debug.log("MediaSource","destroy")}get state(){return this.mediaSource&&this.mediaSource.readyState}get isStateOpen(){return"open"===this.state}get isStateClosed(){return"closed"===this.state}get isStateEnded(){return"ended"===this.state}get duration(){return this.mediaSource&&this.mediaSource.duration}set duration(e){this.mediaSource.duration=e}initVideoEvents(){var e=this.player.events["proxy"],t=(this.$videoElement,e(this.$videoElement,Re,()=>{this.player.debug.log("MediaSource","video waiting")})),e=e(this.$videoElement,De,e=>{e=parseInt(e.timeStamp,10);this.player.emit(v.videoTimeUpdate,e),this.$videoElement.paused&&(this.player.debug.warn("MediaSource","video is paused and next try to replay"),this.$videoElement.play().then(()=>{this.player.debug.log("MediaSource","video is paused and replay success")}).catch(e=>{this.player.debug.warn("MediaSource","video is paused and replay error ",e)}))});this.eventListenList.push(()=>{this.player.debug.log("MediaSource","video canplay"),this.$videoElement.play().then(()=>{this.player.debug.log("MediaSource","video play")}).catch(e=>{this.player.debug.warn("MediaSource","video play error ",e)})},t,e)}decodeVideo(t,i,r,s){var e=this.player;if(e)if(this.hasInit){if(r&&0===t[1]){const i=15&t[0];let e={};7==i?e=di(t.slice(5)):12==i&&(e=mi(t));const s=this.player.video.videoInfo;s&&s.width&&s.height&&e&&e.codecWidth&&e.codecHeight&&(e.codecWidth!==s.width||e.codecHeight!==s.height)&&(this.player.debug.warn("MediaSource",`width or height is update, width ${s.width}-> ${e.codecWidth}, height ${s.height}-> `+e.codecHeight),this.isInitInfo=!1,this.player.video.init=!1)}if(!this.isDecodeFirstIIframe&&r&&(this.isDecodeFirstIIframe=!0),this.isDecodeFirstIIframe){null===this.firstRenderTime&&(this.firstRenderTime=i);let e=i-this.firstRenderTime;e<0&&(this.player.debug.error("MediaSource",`decodeVideo local dts is < 0 , ts is ${i} and firstRenderTime is `+this.firstRenderTime),e=null===this.prevDts?0:this.prevDts+20,this._checkTsIsMaxDiff(i))&&(this.player.error("MediaSource",`decodeVideo local dts is < 0 , ts is ${i} and prevTs is ${this.prevTs}, diff is `+(this.prevTs-i)),this.firstRenderTime=i),null!==this.prevDts&&e<=this.prevDts&&(this.player.debug.error("MediaSource",`decodeVideo dts is less than prev dts , dts is ${e} and prev dts is ${this.prevDts} and now ts is ${i} and prev ts is ${this.prevTs} and firstRenderTime is `+this.firstRenderTime),e=this.prevDts+20),this._decodeVideo(t,e,r,s,i),this.prevDts=e,this.prevTs=i}else this.player.debug.warn("MediaSource","decodeVideo isDecodeFirstIIframe false")}else if(r&&0===t[1]){const s=15&t[0];(e.video.updateVideoInfo({encTypeCode:s}),12!=s||window.MediaSource&&window.MediaSource.isTypeSupported(ye))?(e._times.decodeStart||(e._times.decodeStart=m()),this.hasInit=this._decodeConfigurationRecord(t,i,r,s)):this.emit(A.mediaSourceH265NotSupport)}else this.player.debug.error("MediaSource",`decodeVideo has not init , isIframe is ${r} , payload is `+t[1])}_checkTsIsMaxDiff(e){return 0h?(a.debug.warn("MediaSource","dropping time is ",t-this.cacheTrack.dts),this.dropping=!1,this.cacheTrack={}):this.cacheTrack.id&&t>=this.cacheTrack.dts?(h=8+this.cacheTrack.size,(u=new Uint8Array(h))[0]=h>>>24&255,u[1]=h>>>16&255,u[2]=h>>>8&255,u[3]=255&h,u.set(O.types.mdat,4),u.set(this.cacheTrack.data,8),this.cacheTrack.duration=t-this.cacheTrack.dts,this.player.recorder&&this.player.recorder.isRecording&&this.player._opt.recordType===p&&this.player.recorder.handleAddFmp4Track(this.cacheTrack),h=O.moof(this.cacheTrack,this.cacheTrack.dts),(d=new Uint8Array(h.byteLength+u.byteLength)).set(h,0),d.set(u,h.byteLength),this.appendBuffer(d.buffer),a.emit(v.timeUpdate,s),a.updateStats({fps:!0,ts:s,mseTs:t,buf:a.demux&&a.demux.delay||0}),a._times.videoStart||(a._times.videoStart=m(),a.handlePlayToRenderTimes())):(a.debug.log("MediaSource",`timeInit set false , cacheTrack = {} now dts is ${t}, and ts is ${s} cacheTrack dts is `+(this.cacheTrack&&this.cacheTrack.dts)),this.timeInit=!1,this.cacheTrack={}),this.cacheTrack||(this.cacheTrack={}),this.cacheTrack.id=1,this.cacheTrack.sequenceNumber=++this.sequenceNumber,this.cacheTrack.size=o,this.cacheTrack.dts=t,this.cacheTrack.cts=r,this.cacheTrack.isKeyframe=i,this.cacheTrack.data=n,this.cacheTrack.flags={isLeading:0,dependsOn:i?2:1,isDependedOn:i?1:0,hasRedundancy:0,isNonSync:i?0:1},this.timeInit||1!==e.buffered.length||(a.debug.log("MediaSource","timeInit set true"),this.timeInit=!0,e.currentTime=e.buffered.end(0)),!this.isInitInfo&&0{this.player.emit(v.mseSourceBufferError,e)}),i=i(this.sourceBuffer,"updateend",()=>{});this.eventListenList.push(r,i)}if(this.mediaSourceAppendBufferFull)t.error("MediaSource","this.mediaSourceAppendBufferFull is true");else if(this.mediaSourceAppendBufferError)t.error("MediaSource","this.mediaSourceAppendBufferError is true");else if(!1===this.sourceBuffer.updating&&this.isStateOpen)try{this.sourceBuffer.appendBuffer(e)}catch(e){t.warn("MediaSource","this.sourceBuffer.appendBuffer()",e.code,e),22===e.code?(this.stop(),this.mediaSourceAppendBufferFull=!0,this.emit(A.mediaSourceFull)):11===e.code?(this.stop(),this.mediaSourceAppendBufferError=!0,this.emit(A.mediaSourceAppendBufferError)):(t.error("MediaSource","appendBuffer error",e),this.player.emit(v.mseSourceBufferError,e))}else this.isStateClosed?this.player.emit(A.mseSourceBufferError,"mediaSource is not attached to video or mediaSource is closed"):this.isStateEnded?this.player.emit(A.mseSourceBufferError,"mediaSource is end"):!0===this.sourceBuffer.updating&&this.player.emit(v.mseSourceBufferBusy)}stop(){this.abortSourceBuffer(),this.removeSourceBuffer(),this.endOfStream()}dropSourceBuffer(e){var t=this.$videoElement;this.dropping=e,0"undefined"!=typeof navigator&&parseFloat((""+(/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))<10&&!window.MSStream,Vr=()=>"wakeLock"in navigator;class Hr{constructor(e){if(this.player=e,this.enabled=!1,Vr()){this._wakeLock=null;const e=()=>{null!==this._wakeLock&&"visible"===document.visibilityState&&this.enable()};document.addEventListener("visibilitychange",e),document.addEventListener("fullscreenchange",e)}else Nr()?this.noSleepTimer=null:(this.noSleepVideo=document.createElement("video"),this.noSleepVideo.setAttribute("title","No Sleep"),this.noSleepVideo.setAttribute("playsinline",""),this._addSourceToVideo(this.noSleepVideo,"webm","data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC7AAAAAAAAgLUBAAAAAAC4AQN2b3JiaXMtAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAxMDExMDEgKFNjaGF1ZmVudWdnZXQpAQAAABUAAABlbmNvZGVyPUxhdmM1NS41Mi4xMDIBBXZvcmJpcyVCQ1YBAEAAACRzGCpGpXMWhBAaQlAZ4xxCzmvsGUJMEYIcMkxbyyVzkCGkoEKIWyiB0JBVAABAAACHQXgUhIpBCCGEJT1YkoMnPQghhIg5eBSEaUEIIYQQQgghhBBCCCGERTlokoMnQQgdhOMwOAyD5Tj4HIRFOVgQgydB6CCED0K4moOsOQghhCQ1SFCDBjnoHITCLCiKgsQwuBaEBDUojILkMMjUgwtCiJqDSTX4GoRnQXgWhGlBCCGEJEFIkIMGQcgYhEZBWJKDBjm4FITLQagahCo5CB+EIDRkFQCQAACgoiiKoigKEBqyCgDIAAAQQFEUx3EcyZEcybEcCwgNWQUAAAEACAAAoEiKpEiO5EiSJFmSJVmSJVmS5omqLMuyLMuyLMsyEBqyCgBIAABQUQxFcRQHCA1ZBQBkAAAIoDiKpViKpWiK54iOCISGrAIAgAAABAAAEDRDUzxHlETPVFXXtm3btm3btm3btm3btm1blmUZCA1ZBQBAAAAQ0mlmqQaIMAMZBkJDVgEACAAAgBGKMMSA0JBVAABAAACAGEoOogmtOd+c46BZDppKsTkdnEi1eZKbirk555xzzsnmnDHOOeecopxZDJoJrTnnnMSgWQqaCa0555wnsXnQmiqtOeeccc7pYJwRxjnnnCateZCajbU555wFrWmOmkuxOeecSLl5UptLtTnnnHPOOeecc84555zqxekcnBPOOeecqL25lpvQxTnnnE/G6d6cEM4555xzzjnnnHPOOeecIDRkFQAABABAEIaNYdwpCNLnaCBGEWIaMulB9+gwCRqDnELq0ehopJQ6CCWVcVJKJwgNWQUAAAIAQAghhRRSSCGFFFJIIYUUYoghhhhyyimnoIJKKqmooowyyyyzzDLLLLPMOuyssw47DDHEEEMrrcRSU2011lhr7jnnmoO0VlprrbVSSimllFIKQkNWAQAgAAAEQgYZZJBRSCGFFGKIKaeccgoqqIDQkFUAACAAgAAAAABP8hzRER3RER3RER3RER3R8RzPESVREiVREi3TMjXTU0VVdWXXlnVZt31b2IVd933d933d+HVhWJZlWZZlWZZlWZZlWZZlWZYgNGQVAAACAAAghBBCSCGFFFJIKcYYc8w56CSUEAgNWQUAAAIACAAAAHAUR3EcyZEcSbIkS9IkzdIsT/M0TxM9URRF0zRV0RVdUTdtUTZl0zVdUzZdVVZtV5ZtW7Z125dl2/d93/d93/d93/d93/d9XQdCQ1YBABIAADqSIymSIimS4ziOJElAaMgqAEAGAEAAAIriKI7jOJIkSZIlaZJneZaomZrpmZ4qqkBoyCoAABAAQAAAAAAAAIqmeIqpeIqoeI7oiJJomZaoqZoryqbsuq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq4LhIasAgAkAAB0JEdyJEdSJEVSJEdygNCQVQCADACAAAAcwzEkRXIsy9I0T/M0TxM90RM901NFV3SB0JBVAAAgAIAAAAAAAAAMybAUy9EcTRIl1VItVVMt1VJF1VNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVN0zRNEwgNWQkAkAEAkBBTLS3GmgmLJGLSaqugYwxS7KWxSCpntbfKMYUYtV4ah5RREHupJGOKQcwtpNApJq3WVEKFFKSYYyoVUg5SIDRkhQAQmgHgcBxAsixAsiwAAAAAAAAAkDQN0DwPsDQPAAAAAAAAACRNAyxPAzTPAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAA0DwP8DwR8EQRAAAAAAAAACzPAzTRAzxRBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABA0jRA8zxA8zwAAAAAAAAAsDwP8EQR0DwRAAAAAAAAACzPAzxRBDzRAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAEOAAABBgIRQasiIAiBMAcEgSJAmSBM0DSJYFTYOmwTQBkmVB06BpME0AAAAAAAAAAAAAJE2DpkHTIIoASdOgadA0iCIAAAAAAAAAAAAAkqZB06BpEEWApGnQNGgaRBEAAAAAAAAAAAAAzzQhihBFmCbAM02IIkQRpgkAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAGHAAAAgwoQwUGrIiAIgTAHA4imUBAIDjOJYFAACO41gWAABYliWKAABgWZooAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAYcAAACDChDBQashIAiAIAcCiKZQHHsSzgOJYFJMmyAJYF0DyApgFEEQAIAAAocAAACLBBU2JxgEJDVgIAUQAABsWxLE0TRZKkaZoniiRJ0zxPFGma53meacLzPM80IYqiaJoQRVE0TZimaaoqME1VFQAAUOAAABBgg6bE4gCFhqwEAEICAByKYlma5nmeJ4qmqZokSdM8TxRF0TRNU1VJkqZ5niiKommapqqyLE3zPFEURdNUVVWFpnmeKIqiaaqq6sLzPE8URdE0VdV14XmeJ4qiaJqq6roQRVE0TdNUTVV1XSCKpmmaqqqqrgtETxRNU1Vd13WB54miaaqqq7ouEE3TVFVVdV1ZBpimaaqq68oyQFVV1XVdV5YBqqqqruu6sgxQVdd1XVmWZQCu67qyLMsCAAAOHAAAAoygk4wqi7DRhAsPQKEhKwKAKAAAwBimFFPKMCYhpBAaxiSEFEImJaXSUqogpFJSKRWEVEoqJaOUUmopVRBSKamUCkIqJZVSAADYgQMA2IGFUGjISgAgDwCAMEYpxhhzTiKkFGPOOScRUoox55yTSjHmnHPOSSkZc8w556SUzjnnnHNSSuacc845KaVzzjnnnJRSSuecc05KKSWEzkEnpZTSOeecEwAAVOAAABBgo8jmBCNBhYasBABSAQAMjmNZmuZ5omialiRpmud5niiapiZJmuZ5nieKqsnzPE8URdE0VZXneZ4oiqJpqirXFUXTNE1VVV2yLIqmaZqq6rowTdNUVdd1XZimaaqq67oubFtVVdV1ZRm2raqq6rqyDFzXdWXZloEsu67s2rIAAPAEBwCgAhtWRzgpGgssNGQlAJABAEAYg5BCCCFlEEIKIYSUUggJAAAYcAAACDChDBQashIASAUAAIyx1lprrbXWQGettdZaa62AzFprrbXWWmuttdZaa6211lJrrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmuttdZaa6211lprrbXWWmstpZRSSimllFJKKaWUUkoppZRSSgUA+lU4APg/2LA6wknRWGChISsBgHAAAMAYpRhzDEIppVQIMeacdFRai7FCiDHnJKTUWmzFc85BKCGV1mIsnnMOQikpxVZjUSmEUlJKLbZYi0qho5JSSq3VWIwxqaTWWoutxmKMSSm01FqLMRYjbE2ptdhqq7EYY2sqLbQYY4zFCF9kbC2m2moNxggjWywt1VprMMYY3VuLpbaaizE++NpSLDHWXAAAd4MDAESCjTOsJJ0VjgYXGrISAAgJACAQUooxxhhzzjnnpFKMOeaccw5CCKFUijHGnHMOQgghlIwx5pxzEEIIIYRSSsaccxBCCCGEkFLqnHMQQgghhBBKKZ1zDkIIIYQQQimlgxBCCCGEEEoopaQUQgghhBBCCKmklEIIIYRSQighlZRSCCGEEEIpJaSUUgohhFJCCKGElFJKKYUQQgillJJSSimlEkoJJYQSUikppRRKCCGUUkpKKaVUSgmhhBJKKSWllFJKIYQQSikFAAAcOAAABBhBJxlVFmGjCRcegEJDVgIAZAAAkKKUUiktRYIipRikGEtGFXNQWoqocgxSzalSziDmJJaIMYSUk1Qy5hRCDELqHHVMKQYtlRhCxhik2HJLoXMOAAAAQQCAgJAAAAMEBTMAwOAA4XMQdAIERxsAgCBEZohEw0JweFAJEBFTAUBigkIuAFRYXKRdXECXAS7o4q4DIQQhCEEsDqCABByccMMTb3jCDU7QKSp1IAAAAAAADADwAACQXAAREdHMYWRobHB0eHyAhIiMkAgAAAAAABcAfAAAJCVAREQ0cxgZGhscHR4fICEiIyQBAIAAAgAAAAAggAAEBAQAAAAAAAIAAAAEBB9DtnUBAAAAAAAEPueBAKOFggAAgACjzoEAA4BwBwCdASqwAJAAAEcIhYWIhYSIAgIABhwJ7kPfbJyHvtk5D32ych77ZOQ99snIe+2TkPfbJyHvtk5D32ych77ZOQ99YAD+/6tQgKOFggADgAqjhYIAD4AOo4WCACSADqOZgQArADECAAEQEAAYABhYL/QACIBDmAYAAKOFggA6gA6jhYIAT4AOo5mBAFMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAGSADqOFggB6gA6jmYEAewAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAj4AOo5mBAKMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAKSADqOFggC6gA6jmYEAywAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIAz4AOo4WCAOSADqOZgQDzADECAAEQEAAYABhYL/QACIBDmAYAAKOFggD6gA6jhYIBD4AOo5iBARsAEQIAARAQFGAAYWC/0AAiAQ5gGACjhYIBJIAOo4WCATqADqOZgQFDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggFPgA6jhYIBZIAOo5mBAWsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAXqADqOFggGPgA6jmYEBkwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIBpIAOo4WCAbqADqOZgQG7ADECAAEQEAAYABhYL/QACIBDmAYAAKOFggHPgA6jmYEB4wAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIB5IAOo4WCAfqADqOZgQILADECAAEQEAAYABhYL/QACIBDmAYAAKOFggIPgA6jhYICJIAOo5mBAjMAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAjqADqOFggJPgA6jmYECWwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYICZIAOo4WCAnqADqOZgQKDADECAAEQEAAYABhYL/QACIBDmAYAAKOFggKPgA6jhYICpIAOo5mBAqsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCArqADqOFggLPgA6jmIEC0wARAgABEBAUYABhYL/QACIBDmAYAKOFggLkgA6jhYIC+oAOo5mBAvsAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCAw+ADqOZgQMjADECAAEQEAAYABhYL/QACIBDmAYAAKOFggMkgA6jhYIDOoAOo5mBA0sAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA0+ADqOFggNkgA6jmYEDcwAxAgABEBAAGAAYWC/0AAiAQ5gGAACjhYIDeoAOo4WCA4+ADqOZgQObADECAAEQEAAYABhYL/QACIBDmAYAAKOFggOkgA6jhYIDuoAOo5mBA8MAMQIAARAQABgAGFgv9AAIgEOYBgAAo4WCA8+ADqOFggPkgA6jhYID+oAOo4WCBA+ADhxTu2sBAAAAAAAAEbuPs4EDt4r3gQHxghEr8IEK"),this._addSourceToVideo(this.noSleepVideo,"mp4","data:video/mp4;base64,AAAAHGZ0eXBNNFYgAAACAGlzb21pc28yYXZjMQAAAAhmcmVlAAAGF21kYXTeBAAAbGliZmFhYyAxLjI4AABCAJMgBDIARwAAArEGBf//rdxF6b3m2Ui3lizYINkj7u94MjY0IC0gY29yZSAxNDIgcjIgOTU2YzhkOCAtIEguMjY0L01QRUctNCBBVkMgY29kZWMgLSBDb3B5bGVmdCAyMDAzLTIwMTQgLSBodHRwOi8vd3d3LnZpZGVvbGFuLm9yZy94MjY0Lmh0bWwgLSBvcHRpb25zOiBjYWJhYz0wIHJlZj0zIGRlYmxvY2s9MTowOjAgYW5hbHlzZT0weDE6MHgxMTEgbWU9aGV4IHN1Ym1lPTcgcHN5PTEgcHN5X3JkPTEuMDA6MC4wMCBtaXhlZF9yZWY9MSBtZV9yYW5nZT0xNiBjaHJvbWFfbWU9MSB0cmVsbGlzPTEgOHg4ZGN0PTAgY3FtPTAgZGVhZHpvbmU9MjEsMTEgZmFzdF9wc2tpcD0xIGNocm9tYV9xcF9vZmZzZXQ9LTIgdGhyZWFkcz02IGxvb2thaGVhZF90aHJlYWRzPTEgc2xpY2VkX3RocmVhZHM9MCBucj0wIGRlY2ltYXRlPTEgaW50ZXJsYWNlZD0wIGJsdXJheV9jb21wYXQ9MCBjb25zdHJhaW5lZF9pbnRyYT0wIGJmcmFtZXM9MCB3ZWlnaHRwPTAga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCB2YnZfbWF4cmF0ZT03NjggdmJ2X2J1ZnNpemU9MzAwMCBjcmZfbWF4PTAuMCBuYWxfaHJkPW5vbmUgZmlsbGVyPTAgaXBfcmF0aW89MS40MCBhcT0xOjEuMDAAgAAAAFZliIQL8mKAAKvMnJycnJycnJycnXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXiEASZACGQAjgCEASZACGQAjgAAAAAdBmjgX4GSAIQBJkAIZACOAAAAAB0GaVAX4GSAhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGagC/AySEASZACGQAjgAAAAAZBmqAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZrAL8DJIQBJkAIZACOAAAAABkGa4C/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmwAvwMkhAEmQAhkAI4AAAAAGQZsgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGbQC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm2AvwMkhAEmQAhkAI4AAAAAGQZuAL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGboC/AySEASZACGQAjgAAAAAZBm8AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZvgL8DJIQBJkAIZACOAAAAABkGaAC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmiAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZpAL8DJIQBJkAIZACOAAAAABkGaYC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBmoAvwMkhAEmQAhkAI4AAAAAGQZqgL8DJIQBJkAIZACOAIQBJkAIZACOAAAAABkGawC/AySEASZACGQAjgAAAAAZBmuAvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZsAL8DJIQBJkAIZACOAAAAABkGbIC/AySEASZACGQAjgCEASZACGQAjgAAAAAZBm0AvwMkhAEmQAhkAI4AhAEmQAhkAI4AAAAAGQZtgL8DJIQBJkAIZACOAAAAABkGbgCvAySEASZACGQAjgCEASZACGQAjgAAAAAZBm6AnwMkhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AhAEmQAhkAI4AAAAhubW9vdgAAAGxtdmhkAAAAAAAAAAAAAAAAAAAD6AAABDcAAQAAAQAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAzB0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAABAAAAAAAAA+kAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAALAAAACQAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAPpAAAAAAABAAAAAAKobWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAB1MAAAdU5VxAAAAAAALWhkbHIAAAAAAAAAAHZpZGUAAAAAAAAAAAAAAABWaWRlb0hhbmRsZXIAAAACU21pbmYAAAAUdm1oZAAAAAEAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAhNzdGJsAAAAr3N0c2QAAAAAAAAAAQAAAJ9hdmMxAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAALAAkABIAAAASAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGP//AAAALWF2Y0MBQsAN/+EAFWdCwA3ZAsTsBEAAAPpAADqYA8UKkgEABWjLg8sgAAAAHHV1aWRraEDyXyRPxbo5pRvPAyPzAAAAAAAAABhzdHRzAAAAAAAAAAEAAAAeAAAD6QAAABRzdHNzAAAAAAAAAAEAAAABAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAAIxzdHN6AAAAAAAAAAAAAAAeAAADDwAAAAsAAAALAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAACgAAAAoAAAAKAAAAiHN0Y28AAAAAAAAAHgAAAEYAAANnAAADewAAA5gAAAO0AAADxwAAA+MAAAP2AAAEEgAABCUAAARBAAAEXQAABHAAAASMAAAEnwAABLsAAATOAAAE6gAABQYAAAUZAAAFNQAABUgAAAVkAAAFdwAABZMAAAWmAAAFwgAABd4AAAXxAAAGDQAABGh0cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAABDcAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAQkAAADcAABAAAAAAPgbWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAAC7gAAAykBVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAADi21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAADT3N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAAC7gAAAAAAAM2VzZHMAAAAAA4CAgCIAAgAEgICAFEAVBbjYAAu4AAAADcoFgICAAhGQBoCAgAECAAAAIHN0dHMAAAAAAAAAAgAAADIAAAQAAAAAAQAAAkAAAAFUc3RzYwAAAAAAAAAbAAAAAQAAAAEAAAABAAAAAgAAAAIAAAABAAAAAwAAAAEAAAABAAAABAAAAAIAAAABAAAABgAAAAEAAAABAAAABwAAAAIAAAABAAAACAAAAAEAAAABAAAACQAAAAIAAAABAAAACgAAAAEAAAABAAAACwAAAAIAAAABAAAADQAAAAEAAAABAAAADgAAAAIAAAABAAAADwAAAAEAAAABAAAAEAAAAAIAAAABAAAAEQAAAAEAAAABAAAAEgAAAAIAAAABAAAAFAAAAAEAAAABAAAAFQAAAAIAAAABAAAAFgAAAAEAAAABAAAAFwAAAAIAAAABAAAAGAAAAAEAAAABAAAAGQAAAAIAAAABAAAAGgAAAAEAAAABAAAAGwAAAAIAAAABAAAAHQAAAAEAAAABAAAAHgAAAAIAAAABAAAAHwAAAAQAAAABAAAA4HN0c3oAAAAAAAAAAAAAADMAAAAaAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAAAJAAAACQAAAAkAAACMc3RjbwAAAAAAAAAfAAAALAAAA1UAAANyAAADhgAAA6IAAAO+AAAD0QAAA+0AAAQAAAAEHAAABC8AAARLAAAEZwAABHoAAASWAAAEqQAABMUAAATYAAAE9AAABRAAAAUjAAAFPwAABVIAAAVuAAAFgQAABZ0AAAWwAAAFzAAABegAAAX7AAAGFwAAAGJ1ZHRhAAAAWm1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALWlsc3QAAAAlqXRvbwAAAB1kYXRhAAAAAQAAAABMYXZmNTUuMzMuMTAw"),this.noSleepVideo.addEventListener("loadedmetadata",()=>{this.noSleepVideo.duration<=1?this.noSleepVideo.setAttribute("loop",""):this.noSleepVideo.addEventListener("timeupdate",()=>{.5{this._wakeLock=e,this.enabled=!0,t.log("wakeLock","Wake Lock active."),this._wakeLock.addEventListener("release",()=>{t.log("wakeLock","Wake Lock released.")})}).catch(e=>{throw this.enabled=!1,t.error("wakeLock",e.name+", "+e.message),e}):Nr()?(this.disable(),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(e=>(this.enabled=!0,e)).catch(e=>{throw this.enabled=!1,e})}disable(){var e=this.player.debug;Vr()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):Nr()?this.noSleepTimer&&(e.warn("wakeLock","NoSleep now disabled for older iOS devices."),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}var s=(tr=He(function(e,t){"undefined"!=typeof window&&(e.exports=function(){return i={"./node_modules/eventemitter3/index.js":function(e,t,i){var r=Object.prototype.hasOwnProperty,p="~";function s(){}function a(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function n(e,t,i,r,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");i=new a(i,r||e,s),r=p?p+t:t;return e._events[r]?e._events[r].fn?e._events[r]=[e._events[r],i]:e._events[r].push(i):(e._events[r]=i,e._eventsCount++),e}function l(e,t){0==--e._eventsCount?e._events=new s:delete e._events[t]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(p=!1)),o.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)r.call(e,t)&&i.push(p?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},o.prototype.listeners=function(e){var e=p?p+e:e,t=this._events[e];if(!t)return[];if(t.fn)return[t.fn];for(var i=0,r=t.length,s=new Array(r);ie||r.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=e+.05),(t=this.getNextFragment(a,n))?"identity"!==(null==(i=t.decryptdata)?void 0:i.keyFormat)||null!=(r=t.decryptdata)&&r.key?this.loadFragment(t,n,a):this.loadKey(t,n):this.bufferFlushed=!0)))))},E.getMaxBufferLength=function(){var e=b.prototype.getMaxBufferLength.call(this),t=this.getFwdBufferInfo(this.videoBuffer||this.media,u.PlaylistLevelType.MAIN);return null===t?e:Math.max(e,t.len)},E.onMediaDetaching=function(){this.videoBuffer=null,b.prototype.onMediaDetaching.call(this)},E.onAudioTracksUpdated=function(e,t){t=t.audioTracks;this.resetTransmuxer(),this.levels=t.map(function(e){return new r.Level(e)})},E.onAudioTrackSwitching=function(e,t){var i=!!t.url,t=(this.trackId=t.id,this.fragCurrent);null!=t&&t.loader&&t.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),i?this.setInterval(100):this.resetTransmuxer(),i?(this.audioSwitch=!0,this.state=d.State.IDLE):this.state=d.State.STOPPED,this.tick()},E.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},E.onLevelLoaded=function(e,t){this.mainDetails=t.details},E.onAudioTrackLoaded=function(e,t){var i=this.levels,r=t.details,t=t.id;if(i){this.log("Track "+t+" loaded ["+r.startSN+","+r.endSN+"],duration:"+r.totalduration);var i=i[t],s=0;if(r.live||null!=(a=i.details)&&a.live){var a=this.mainDetails;if(r.fragments[0]||(r.deltaUpdateFailed=!0),r.deltaUpdateFailed||!a)return;s=!i.details&&r.hasProgramDateTime&&a.hasProgramDateTime?(Object(l.alignMediaPlaylistByPDT)(r,a),r.fragments[0].start):this.alignPlaylists(r,i.details)}i.details=r,this.levelLastLoaded=t,this.startFragRequested||!this.mainDetails&&r.live||this.setStartPosition(i.details,s),this.state!==d.State.WAITING_TRACK||this.waitForCdnTuneIn(r)||(this.state=d.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+t)},E._handleFragmentLoadProgress=function(e){var t,i,r,s,a=e.frag,n=e.part,e=e.payload,o=this.config,l=this.trackId,c=this.levels;c?(c=c[l],console.assert(c,"Audio track is defined on fragment load progress"),t=c.details,console.assert(t,"Audio track details are defined on fragment load progress"),o=o.defaultAudioCodec||c.audioCodec||"mp4a.40.2",c=(c=this.transmuxer)||(this.transmuxer=new A.default(this.hls,u.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this))),i=this.initPTS[a.cc],r=null==(r=a.initSegment)?void 0:r.data,void 0!==i?(s=n?n.index:-1,s=new m.ChunkMetadata(a.level,a.sn,a.stats.chunkCount,e.byteLength,s,-1!==s),c.push(e,r,o,"",a,n,t.totalduration,!1,s,i)):(g.logger.log("Unknown video PTS for cc "+a.cc+", waiting for video PTS before demuxing audio frag "+a.sn+" of ["+t.startSN+" ,"+t.endSN+"],track "+l),(this.waitingData=this.waitingData||{frag:a,part:n,cache:new f.default,complete:!1}).cache.push(new Uint8Array(e)),this.waitingVideoCC=this.videoTrackCC,this.state=d.State.WAITING_INIT_PTS)):this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered")},E._handleFragmentLoadComplete=function(e){this.waitingData?this.waitingData.complete=!0:b.prototype._handleFragmentLoadComplete.call(this,e)},E.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},E.onBufferCreated=function(e,t){var i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer)},E.onFragBuffered=function(e,t){var i=t.frag,t=t.part;i.type===u.PlaylistLevelType.AUDIO&&(this.fragContextChanged(i)?this.warn("Fragment "+i.sn+(t?" p: "+t.index:"")+" of level "+i.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):("initSegment"!==i.sn&&(this.fragPrevious=i,this.audioSwitch)&&(this.audioSwitch=!1,this.hls.trigger(h.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId})),this.fragBufferedComplete(i,t)))},E.onError=function(e,t){switch(t.details){case c.ErrorDetails.FRAG_LOAD_ERROR:case c.ErrorDetails.FRAG_LOAD_TIMEOUT:case c.ErrorDetails.KEY_LOAD_ERROR:case c.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(u.PlaylistLevelType.AUDIO,t);break;case c.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case c.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==d.State.ERROR&&this.state!==d.State.STOPPED&&(this.state=t.fatal?d.State.ERROR:d.State.IDLE,this.warn(t.details+" while loading frag, switching to "+this.state+" state"));break;case c.ErrorDetails.BUFFER_FULL_ERROR:var i,r;"audio"!==t.parent||this.state!==d.State.PARSING&&this.state!==d.State.PARSED||(i=!0,(i=(r=this.getFwdBufferInfo(this.mediaBuffer,u.PlaylistLevelType.AUDIO))&&.5=o.length?this.warn("Invalid id passed to audio-track controller"):(this.clearTimer(),t=o[this.trackId],this.log("Now switching to audio-track index "+e),i=(o=o[e]).id,r=void 0===(r=o.groupId)?"":r,s=o.name,a=o.type,n=o.url,this.trackId=e,this.trackName=s,this.selectDefaultTrack=!1,this.hls.trigger(l.Events.AUDIO_TRACK_SWITCHING,{id:i,groupId:r,name:s,type:a,url:n}),o.details&&!o.details.live||(e=this.switchParams(o.url,null==t?void 0:t.details),this.loadPlaylist(e)))},s.selectInitialTrack=function(){var e=this.tracksInGroup,e=(console.assert(e.length,"Initial audio track should be selected when tracks are known"),this.trackName),e=this.findTrackId(e)||this.findTrackId();-1!==e?this.setAudioTrack(e):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(l.Events.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},s.findTrackId=function(e){for(var t=this.tracksInGroup,i=0;it.partTarget&&(s+=1),Object(o.isFiniteNumber)(a))return new l.HlsUrlParameters(a,Object(o.isFiniteNumber)(s)?s:void 0,l.HlsSkip.No)}}},t.loadPlaylist=function(e){},t.shouldLoadTrack=function(e){return this.canLoad&&e&&!!e.url&&(!e.details||e.details.live)},t.playlistLoaded=function(e,t,i){var r=this,s=t.details,a=t.stats,n=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(s.advancedDateTime=Date.now()-n,s.live||null!=i&&i.live){if(s.reloaded(i),i&&this.log("live playlist "+e+" "+(s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:"MISSED")),i&&0i.tuneInGoal?(this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+d+" with playlist age: "+s.age),d=0):(n+=h=Math.floor(d/s.targetduration),void 0!==l&&(l+=Math.round(d%s.targetduration/s.partTarget)),this.log("CDN Tune-in age: "+s.ageHeader+"s last advanced "+u.toFixed(2)+"s goal: "+d+" skip sn "+h+" to part "+l)),s.tuneInGoal=d),o=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l),c||!p)return void this.loadPlaylist(o)}else o=this.getDeliveryDirectives(s,t.deliveryDirectives,n,l);i=Object(f.computeReloadInterval)(s,a);void 0!==n&&s.canBlockReload&&(i-=s.partTarget||1),this.log("reload live playlist "+e+" in "+Math.round(i)+" ms"),this.timer=self.setTimeout(function(){return r.loadPlaylist(o)},i)}}else this.clearTimer()},t.getDeliveryDirectives=function(e,t,i,r){var s=Object(l.getSkipValue)(e,i);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,s=l.HlsSkip.No),new l.HlsUrlParameters(i,r,s)},t.retryLoadingOrFail=function(e){var t,i=this,r=this.hls.config,s=this.retryCount=t.endSN)||e.nextStart)&&(null!=(e=t.partList)&&e.length?(t=e[e.length-1],n.BufferHelper.isBuffered(this.media,t.start+t.duration/2)):(e=r.getState(i))===d.FragmentState.PARTIAL||e===d.FragmentState.OK)},t.onMediaAttached=function(e,t){t=this.media=this.mediaBuffer=t.media,this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),t.addEventListener("seeking",this.onvseeking),t.addEventListener("ended",this.onvended),t=this.config;this.levels&&t.autoStartLoad&&this.state===E.STOPPED&&this.startLoad(t.startPosition)},t.onMediaDetaching=function(){var e=this.media;null!=e&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},t.onMediaSeeking=function(){var e=this.config,t=this.fragCurrent,i=this.media,r=this.mediaBuffer,s=this.state,a=i?i.currentTime:0,r=n.BufferHelper.bufferInfo(r||i,a,e.maxBufferHole);this.log("media seeking to "+(Object(l.isFiniteNumber)(a)?a.toFixed(3):a)+", state: "+s),s===E.ENDED?this.resetLoadingState():t&&!r.len&&(s=e.maxFragLookUpTolerance,e=t.start-s,s=a>t.start+t.duration+s,ae.end&&t.fragmentHint&&(e=t.fragmentHint);var n,o=this.getNextPart(a,e,i);if(-1i&&this.flushMainBuffer(r,e.start)):this.flushMainBuffer(0,e.start))},t.getFwdBufferInfo=function(e,t){var i=this.config,r=this.getLoadPosition();if(!Object(l.isFiniteNumber)(r))return null;var s=n.BufferHelper.bufferInfo(e,r,i.maxBufferHole);if(0===s.len&&void 0!==s.nextStart){t=this.fragmentTracker.getBufferedFrag(r,t);if(t&&s.nextStart=e&&(t.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},t.getNextFragment=function(e,t){var i=t.fragments,r=i.length;if(!r)return null;var s,a=this.config,n=i[0].start;if(t.live){var o=a.initialLiveManifestSize;if(re.start&&e.loaded},t.getInitialLiveFragment=function(e,t){var i,r=this.fragPrevious,s=null;return r?(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),s=Object(p.findFragmentByPDT)(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),s||((i=r.sn+1)>=e.startSN&&i<=e.endSN&&(i=t[i-e.startSN],r.cc===i.cc)&&this.log("Live playlist, switching playlist, load frag with next SN: "+(s=i).sn),s)||(s=Object(p.findFragWithCC)(t,r.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+s.sn)):null!==(i=this.hls.liveSyncPosition)&&(s=this.getFragmentAtPosition(i,this.bitrateTest?e.fragmentEnd:e.edge,e)),s},t.getFragmentAtPosition=function(e,t,i){var r,s=this.config,a=this.fragPrevious,n=i.fragments,o=i.endSN,l=i.fragmentHint,c=s.maxFragLookUpTolerance,s=!!(s.lowLatencyMode&&i.partList&&l);if(s&&l&&!this.bitrateTest&&(n=n.concat(l),o=l.sn),r=e=s-a.maxFragLookUpTolerance&&i<=r,null!==t)&&n.duration>t&&(i"+e.startSN+" prev-sn: "+(o?o.sn:"na")+" fragments: "+n),s):i):(this.warn("No fragments in live playlist"),0)},t.waitForCdnTuneIn=function(e){return e.live&&e.canBlockReload&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)},t.setStartPosition=function(e,t){var i,r=this.startPosition;-1!==(r=r"+e))}}]),T);function T(e,t,i){var r;return(r=b.call(this)||this).hls=void 0,r.fragPrevious=null,r.fragCurrent=null,r.fragmentTracker=void 0,r.transmuxer=null,r._state=E.STOPPED,r.media=void 0,r.mediaBuffer=void 0,r.config=void 0,r.bitrateTest=!1,r.lastCurrentTime=0,r.nextLoadPosition=0,r.startPosition=0,r.loadedmetadata=!1,r.fragLoadError=0,r.retryDate=0,r.levels=null,r.fragmentLoader=void 0,r.levelLastLoaded=null,r.startFragRequested=!1,r.decrypter=void 0,r.initPTS=[],r.onvseeking=null,r.onvended=null,r.logPrefix="",r.log=void 0,r.warn=void 0,r.logPrefix=i,r.log=s.logger.log.bind(s.logger,i+":"),r.warn=s.logger.warn.bind(s.logger,i+":"),r.hls=e,r.fragmentLoader=new f.default(e.config),r.fragmentTracker=t,r.config=e.config,r.decrypter=new A.default(e,e.config),e.on(h.Events.KEY_LOADED,r.onKeyLoaded,function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(r)),r}},"./src/controller/buffer-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return a});var l=i("./src/polyfills/number.ts"),A=i("./src/events.ts"),m=i("./src/utils/logger.ts"),g=i("./src/errors.ts"),y=i("./src/utils/buffer-helper.ts"),t=i("./src/utils/mediasource-helper.ts"),n=i("./src/loader/fragment.ts"),r=i("./src/controller/buffer-operation-queue.ts"),s=Object(t.getMediaSource)(),c=/([ha]vc.)(?:\.[^.,]+)+/,a=((i=o.prototype).hasSourceTypes=function(){return 0i.config.appendErrorMaxRetry&&(m.logger.error("[buffer-controller]: Failed "+i.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),t.fatal=!0)),i.trigger(A.Events.ERROR,t)}},o)},i.onBufferFlushing=function(e,i){function t(t){return{execute:r.removeExecutor.bind(r,t,i.startOffset,i.endOffset),onStart:function(){},onComplete:function(){r.hls.trigger(A.Events.BUFFER_FLUSHED,{type:t})},onError:function(e){m.logger.warn("[buffer-controller]: Failed to remove from "+t+" SourceBuffer",e)}}}var r=this,s=this.operationQueue;i.type?s.append(t(i.type),i.type):this.getSourceBufferTypes().forEach(function(e){s.append(t(e),e)})},i.onFragParsed=function(e,t){var i=this,r=t.frag,s=t.part,t=[],a=(s||r).elementaryStreams;a[n.ElementaryStreamTypes.AUDIOVIDEO]?t.push("audiovideo"):(a[n.ElementaryStreamTypes.AUDIO]&&t.push("audio"),a[n.ElementaryStreamTypes.VIDEO]&&t.push("video")),0===t.length&&m.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+r.type+" level: "+r.level+" sn: "+r.sn),this.blockBuffers(function(){var e=self.performance.now(),e=(r.stats.buffering.end=e,s&&(s.stats.buffering.end=e),(s||r).stats);i.hls.trigger(A.Events.FRAG_BUFFERED,{frag:r,part:s,stats:e,id:r.type})},t)},i.onFragChanged=function(e,t){this.flushBackBuffer()},i.onBufferEos=function(e,r){var s=this;this.getSourceBufferTypes().reduce(function(e,t){var i=s.sourceBuffer[t];return r.type&&r.type!==t||i&&!i.ended&&(i.ended=!0,m.logger.log("[buffer-controller]: "+t+" sourceBuffer now EOS")),e&&!(i&&!i.ended)},!0)&&this.blockBuffers(function(){var e=s.mediaSource;e&&"open"===e.readyState&&e.endOfStream()})},i.onLevelUpdated=function(e,t){t=t.details;t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},i.flushBackBuffer=function(){var e,t,i,r,s=this.hls,a=this.details,n=this.media,o=this.sourceBuffer;n&&null!==a&&(e=this.getSourceBufferTypes()).length&&(i=a.live&&null!==s.config.liveBackBufferLength?s.config.liveBackBufferLength:s.config.backBufferLength,!Object(l.isFiniteNumber)(i)||i<0||(n=n.currentTime,t=a.levelTargetDuration,i=Math.max(i,t),r=Math.floor(n/t)*t-i,e.forEach(function(e){var t=o[e];t&&0<(t=y.BufferHelper.getBuffered(t)).length&&r>t.start(0)&&(s.trigger(A.Events.BACK_BUFFER_REACHED,{bufferEnd:r}),a.live&&s.trigger(A.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r}),s.trigger(A.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:e}))})))},i.updateMediaElementDuration=function(){var e,t,i,r,s,a;this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState&&(e=this.details,t=this.hls,s=this.media,i=this.mediaSource,r=e.fragments[0].start+e.totalduration,s=s.duration,a=Object(l.isFiniteNumber)(i.duration)?i.duration:0,e.live&&t.config.liveDurationInfinity?(m.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),i.duration=1/0,this.updateSeekableRange(e)):(athis.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping)},i.getMaxLevel=function(i){var r=this,e=this.hls.levels;return e.length?(e=e.filter(function(e,t){return n.isLevelAllowed(t,r.restrictedLevels)&&t<=i}),this.clientRect=null,n.getMaxLevelByMediaSize(e,this.mediaWidth,this.mediaHeight)):-1},i.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},i.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},i.getDimensions=function(){var e,t,i;return this.clientRect||(t={width:0,height:0},(e=this.media)&&(i=e.getBoundingClientRect(),t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)),this.clientRect=t)},n.isLevelAllowed=function(e,t){return-1===(t=void 0===t?[]:t).indexOf(e)},n.getMaxLevelByMediaSize=function(e,t,i){if(!e||!e.length)return-1;for(var r,s=e.length-1,a=0;a=t||n.height>=i)&&(!(r=e[a+1])||n.width!==r.width||n.height!==r.height)){s=a;break}}return s},i=[{key:"contentScaleFactor",get:function(){var e=1;try{e=self.devicePixelRatio}catch(e){}return e}}],s((a=n).prototype,[{key:"mediaWidth",get:function(){return this.getDimensions().width*n.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*n.contentScaleFactor}}]),s(a,i);var a=n;function n(e){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}t.default=a},"./src/controller/cmcd-controller.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return h});var r=i("./src/events.ts"),n=i("./src/types/cmcd.ts"),s=i("./src/utils/buffer-helper.ts"),o=i("./src/utils/logger.ts");function a(e,t){for(var i=0;i=e.length?{done:!0}:{done:!1,value:e[i++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);it&&(t=s.bitrate)}return 0a.config.fpsDroppedMonitoringThreshold*s&&(n=a.currentLevel,c.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+n),0=n)&&(a.trigger(l.Events.FPS_DROP_LEVEL_CAPPING,{level:--n,droppedLevel:a.currentLevel}),a.autoLevelCapping=n,this.streamController.nextLevelSwitch()),this.lastTime=o,this.lastDroppedFrames=i,this.lastDecodedFrames=t)},i.checkFPSInterval=function(){var e,t=this.media;t&&(this.isVideoPlaybackQualityAvailable?(e=t.getVideoPlaybackQuality(),this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)):this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount))},t.default=r},"./src/controller/fragment-finders.ts":function(e,t,i){i.r(t),i.d(t,"findFragmentByPDT",function(){return r}),i.d(t,"findFragmentByPTS",function(){return s}),i.d(t,"fragmentWithinToleranceTest",function(){return o}),i.d(t,"pdtWithinToleranceTest",function(){return l}),i.d(t,"findFragWithCC",function(){return c});var a=i("./src/polyfills/number.ts"),n=i("./src/utils/binary-search.ts");function r(e,t,i){if(null!==t&&Array.isArray(e)&&e.length&&Object(a.isFiniteNumber)(t)&&!(t<(e[0].programDateTime||0)||t>=(e[e.length-1].endProgramDateTime||0))){i=i||0;for(var r=0;re&&i.start?-1:0}function l(e,t,i){t=1e3*Math.min(t,i.duration+(i.deltaPTS||0));return(i.endProgramDateTime||0)-t>e}function c(e,t){return n.default.search(e,function(e){return e.cct?-1:0})}},"./src/controller/fragment-tracker.ts":function(e,t,i){i.r(t),i.d(t,"FragmentState",function(){return r}),i.d(t,"FragmentTracker",function(){return a});var r,s=i("./src/events.ts"),o=i("./src/types/loader.ts"),a=((t=r=r||{}).NOT_LOADED="NOT_LOADED",t.BACKTRACKED="BACKTRACKED",t.APPENDING="APPENDING",t.PARTIAL="PARTIAL",t.OK="OK",(i=n.prototype)._registerListeners=function(){var e=this.hls;e.on(s.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.on(s.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.on(s.Events.FRAG_LOADED,this.onFragLoaded,this)},i._unregisterListeners=function(){var e=this.hls;e.off(s.Events.BUFFER_APPENDED,this.onBufferAppended,this),e.off(s.Events.FRAG_BUFFERED,this.onFragBuffered,this),e.off(s.Events.FRAG_LOADED,this.onFragLoaded,this)},i.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},i.getAppendedFrag=function(e,t){if(t===o.PlaylistLevelType.MAIN){var i=this.activeFragment,r=this.activeParts;if(!i)return null;if(r)for(var s=r.length;s--;){var a=r[s],n=a?a.end:i.appendedPTS;if(a.start<=e&&void 0!==n&&e<=n)return 9t&&s.removeFragment(e)})},i.removeFragment=function(e){var t=c(e);e.stats.loaded=0,e.clearElementaryStreamInfo(),delete this.fragments[t]},i.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},n);function n(e){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=e,this._registerListeners()}function l(e){var t;return e.buffered&&(null!=(t=e.range.video)&&t.partial||null!=(t=e.range.audio)&&t.partial)}function c(e){return e.type+"_"+e.level+"_"+e.urlId+"_"+e.sn}},"./src/controller/gap-controller.ts":function(e,t,i){i.r(t),i.d(t,"STALL_MINIMUM_DURATION_MS",function(){return p}),i.d(t,"MAX_START_GAP_JUMP",function(){return f}),i.d(t,"SKIP_BUFFER_HOLE_STEP_SECONDS",function(){return A}),i.d(t,"SKIP_BUFFER_RANGE_START",function(){return m}),i.d(t,"default",function(){return r});var c=i("./src/utils/buffer-helper.ts"),u=i("./src/errors.ts"),d=i("./src/events.ts"),h=i("./src/utils/logger.ts"),p=250,f=2,A=.1,m=.05,r=((t=s.prototype).destroy=function(){this.hls=this.fragmentTracker=this.media=null},t.poll=function(e){var t=this.config,i=this.media,r=this.stalled,s=i.currentTime,a=i.seeking,n=this.seeking&&!a,o=!this.seeking&&a;if(this.seeking=a,s===e){if((o||n)&&(this.stalled=null),!i.paused&&!i.ended&&0!==i.playbackRate&&c.BufferHelper.getBuffered(i).length){e=c.BufferHelper.bufferInfo(i,s,0),o=0f,l=!n||fi.maxBufferHole&&t>1e3*i.highBufferWatchdogPeriod&&(h.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},t._reportStall=function(e){var t=this.hls,i=this.media;this.stallReported||(this.stallReported=!0,h.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer (buffer="+e+")"),t.trigger(d.Events.ERROR,{type:u.ErrorTypes.MEDIA_ERROR,details:u.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:e}))},t._trySkipBufferHole=function(e){for(var t=this.config,i=this.hls,r=this.media,s=r.currentTime,a=0,n=c.BufferHelper.getBuffered(r),o=0;o=a&&sthis.hls.config.fragLoadingMaxRetry))&&(r=t.frag.level);break;case A.ErrorDetails.LEVEL_LOAD_ERROR:case A.ErrorDetails.LEVEL_LOAD_TIMEOUT:i&&(i.deliveryDirectives&&(n=!1),r=i.level),a=!0;break;case A.ErrorDetails.REMUX_ALLOC_ERROR:r=t.level,a=!0}void 0!==r&&this.recoverLevel(t,r,a,n)}}},t.recoverLevel=function(e,t,i,r){var s=e.details,a=this._levels[t];if(a.loadError++,i){if(!this.retryLoadingOrFail(e))return void(this.currentLevelIndex=-1);e.levelRetry=!0}r&&(1<(i=a.url.length)&&a.loadError=t.length){var i=e<0;if(this.hls.trigger(f.Events.ERROR,{type:A.ErrorTypes.OTHER_ERROR,details:A.ErrorDetails.LEVEL_SWITCH_ERROR,level:e,fatal:i,reason:"invalid level idx"}),i)return;e=Math.min(e,t.length-1)}this.clearTimer();var i=this.currentLevelIndex,r=t[i],t=t[e],i=(this.log("switching to level "+e+" from "+i),s({},t,{level:this.currentLevelIndex=e,maxBitrate:t.maxBitrate,uri:t.uri,urlId:t.urlId})),e=(delete i._urlId,this.hls.trigger(f.Events.LEVEL_SWITCHING,i),t.details);e&&!e.live||(i=this.switchParams(t.uri,null==r?void 0:r.details),this.loadPlaylist(i))}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){var e;return void 0===this._startLevel?void 0!==(e=this.hls.config.startLevel)?e:this._firstLevel:this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}]),c);function c(e){return(e=l.call(this,e,"[level-controller]")||this)._levels=[],e._firstLevel=-1,e._startLevel=void 0,e.currentLevelIndex=-1,e.manualLevelIndex=-1,e.onParsedComplete=void 0,e._registerListeners(),e}},"./src/controller/level-helper.ts":function(e,t,i){i.r(t),i.d(t,"addGroupId",function(){return r}),i.d(t,"assignTrackIdsByGroup",function(){return s}),i.d(t,"updatePTS",function(){return a}),i.d(t,"updateFragPTSDTS",function(){return m}),i.d(t,"mergeDetails",function(){return n}),i.d(t,"mapPartIntersection",function(){return g}),i.d(t,"mapFragmentIntersection",function(){return y}),i.d(t,"adjustSliding",function(){return v}),i.d(t,"addSliding",function(){return o}),i.d(t,"computeReloadInterval",function(){return l}),i.d(t,"getFragmentWithSN",function(){return c}),i.d(t,"getPartWith",function(){return u});var p=i("./src/polyfills/number.ts"),f=i("./src/utils/logger.ts");function r(e,t,i){switch(t){case"audio":e.audioGroupIds||(e.audioGroupIds=[]),e.audioGroupIds.push(i);break;case"text":e.textGroupIds||(e.textGroupIds=[]),e.textGroupIds.push(i)}}function s(e){var i={};e.forEach(function(e){var t=e.groupId||"";e.id=i[t]=i[t]||0,i[t]++})}function a(e,t,i){A(e[t],e[i])}function A(e,t){var i,r=t.startPTS;Object(p.isFiniteNumber)(r)?(i=0,(r=t.sn>e.sn?(i=r-e.start,e):(i=e.start-r,t)).duration!==i&&(r.duration=i)):t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration:t.start=Math.max(e.start-t.duration,0)}function m(e,t,i,r,s,a){r-i<=0&&(f.logger.warn("Fragment should have a positive duration",t),r=i+t.duration,a=s+t.duration);var n=i,o=r,l=t.startPTS,c=t.endPTS,u=(Object(p.isFiniteNumber)(l)&&(u=Math.abs(l-i),Object(p.isFiniteNumber)(t.deltaPTS)?t.deltaPTS=Math.max(u,t.deltaPTS):t.deltaPTS=u,n=Math.max(i,l),i=Math.min(i,l),s=Math.min(s,t.startDTS),o=Math.min(r,c),r=Math.max(r,c),a=Math.max(a,t.endDTS)),t.duration=r-i,i-t.start);t.appendedPTS=r,t.start=t.startPTS=i,t.maxStartPTS=n,t.startDTS=s,t.endPTS=r,t.minEndPTS=o,t.endDTS=a;var d,l=t.sn;if(!e||le.endSN)return 0;var c=l-e.startSN,h=e.fragments;for(h[c]=t,d=c;0=e.length||o(t,e[i].start)}function o(e,t){if(t){for(var i=e.fragments,r=e.skippedSegments;r=this.getMaxBufferLength(t.maxBitrate)||(this._streamEnded(i,s)?(e={},this.altAudio&&(e.type="video"),this.hls.trigger(m.Events.BUFFER_EOS,e),this.state=A.State.ENDED):(a=i.end,t=this.getNextFragment(a,s),this.couldBacktrack&&!this.fragPrevious&&t&&"initSegment"!==t.sn&&1<(e=t.sn-s.startSN)&&(t=s.fragments[e-1],this.fragmentTracker.removeFragment(t)),t&&this.fragmentTracker.getState(t)===n.FragmentState.OK&&this.nextLoadPosition>a&&(i=this.audioOnly&&!this.altAudio?g.ElementaryStreamTypes.AUDIO:g.ElementaryStreamTypes.VIDEO,this.afterBufferFlushed(r,i,d.PlaylistLevelType.MAIN),t=this.getNextFragment(this.nextLoadPosition,s)),t&&("identity"!==(null==(e=(t=!t.initSegment||t.initSegment.data||this.bitrateTest?t:t.initSegment).decryptdata)?void 0:e.keyFormat)||null!=(r=t.decryptdata)&&r.key?this.loadFragment(t,s,a):this.loadKey(t,s)))))},i.loadFragment=function(e,t,i){var r=this.fragmentTracker.getState(e);if(this.fragCurrent=e,r===n.FragmentState.BACKTRACKED){var s=this.fragmentTracker.getBacktrackData(e);if(s)return this._handleFragmentLoadProgress(s),void this._handleFragmentLoadComplete(s);r=n.FragmentState.NOT_LOADED}r===n.FragmentState.NOT_LOADED||r===n.FragmentState.PARTIAL?"initSegment"===e.sn?this._loadInitSegment(e):this.bitrateTest?(e.bitrateTest=!0,this.log("Fragment "+e.sn+" of level "+e.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(e)):(this.startFragRequested=!0,y.prototype.loadFragment.call(this,e,t,i)):r===n.FragmentState.APPENDING?this.reduceMaxBufferLength(e.duration)&&this.fragmentTracker.removeFragment(e):0===(null==(s=this.media)?void 0:s.buffered.length)&&this.fragmentTracker.removeAllFragments()},i.getAppendedFrag=function(e){e=this.fragmentTracker.getAppendedFrag(e,d.PlaylistLevelType.MAIN);return e&&"fragment"in e?e.fragment:e},i.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,d.PlaylistLevelType.MAIN)},i.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},i.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},i.nextLevelSwitch=function(){var e,t=this.levels,i=this.media;null!=i&&i.readyState&&((e=this.getAppendedFrag(i.currentTime))&&1=r[n].start&&a<=r[n].end){s=r[n];break}t=i.start+i.duration;s?s.end=t:r.push(s={start:a,end:t}),this.fragmentTracker.fragBuffered(i)}}},i.onBufferFlushing=function(e,t){var i,r,s,a=t.startOffset,n=t.endOffset;0===a&&n!==Number.POSITIVE_INFINITY&&(i=this.currentTrackId,(r=this.levels).length)&&r[i]&&r[i].details&&((s=n-r[i].details.targetduration)<=0||(t.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach(function(e){for(var t=0;t=s.length||t!==r)&&a){if(this.mediaBuffer=this.mediaBufferTimeRanges,i.live||null!=(s=a.details)&&s.live){r=this.mainDetails;if(i.deltaUpdateFailed||!r)return;s=r.fragments[0];a.details?0===this.alignPlaylists(i,a.details)&&s&&Object(o.addSliding)(i,s.start):i.hasProgramDateTime&&r.hasProgramDateTime?Object(n.alignMediaPlaylistByPDT)(i,r):s&&Object(o.addSliding)(i,s.start)}a.details=i,this.levelLastLoaded=t,this.tick(),!i.live||this.fragCurrent||!this.media||this.state!==d.State.IDLE||Object(c.findFragmentByPTS)(null,i.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),a.details=void 0)}}},i._handleFragmentLoadComplete=function(e){var i,r=e.frag,e=e.payload,t=r.decryptdata,s=this.hls;!this.fragContextChanged(r)&&e&&0this.getMaxBufferLength()+a||(console.assert(e,"Subtitle track details are defined on idle subtitle stream controller tick"),a=(s=e.fragments).length,o=e.edge,n=this.fragPrevious,i=o.length||(this.clearTimer(),i=o[e],this.log("Switching to subtitle track "+e),this.trackId=e,i?(o=i.id,r=i.groupId,s=i.name,a=i.type,n=i.url,this.hls.trigger(l.Events.SUBTITLE_TRACK_SWITCH,{id:o,groupId:void 0===r?"":r,name:s,type:a,url:n}),o=this.switchParams(i.url,null==t?void 0:t.details),this.loadPlaylist(o)):this.hls.trigger(l.Events.SUBTITLE_TRACK_SWITCH,{id:e}))):this.queuedDefaultTrack=e},s.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var e=-1,t=d(this.media.textTracks),i=0;i>>8^255&A^99,d[t[A]=h]),g=d[m],y=d[g],v=257*d[A]^16843008*A;r[h]=v<<24|v>>>8,s[h]=v<<16|v>>>16,a[h]=v<<8|v>>>24,n[h]=v,o[A]=(v=16843009*y^65537*g^257*m^16843008*h)<<24|v>>>8,l[A]=v<<16|v>>>16,c[A]=v<<8|v>>>24,u[A]=v,h?(h=m^d[d[d[y^m]]],p^=d[d[p]]):h=p=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),i=!0,r=0;r>>6),u=(60&t[i+2])>>>2;if(!(l.length-1>>6,d.logger.log("manifest codec:"+r+", ADTS type:"+c+", samplingIndex:"+u),t=/firefox/i.test(n)?6<=u?(c=5,a=new Array(4),u-3):(c=2,a=new Array(2),u):-1!==n.indexOf("android")?(c=2,a=new Array(2),u):(c=5,a=new Array(4),r&&(-1!==r.indexOf("mp4a.40.29")||-1!==r.indexOf("mp4a.40.5"))||!r&&6<=u?u-3:((r&&-1!==r.indexOf("mp4a.40.2")&&(6<=u&&1==s||/vivaldi/i.test(n))||!r&&1==s)&&(c=2,a=new Array(2)),u)),a[0]=c<<3,a[0]|=(14&u)>>1,a[1]|=(1&u)<<7,a[1]|=s<<3,5===c&&(a[1]|=(14&t)>>1,a[2]=(1&t)<<7,a[2]|=8,a[3]=0),{config:a,samplerate:l[u],channelCount:s,codec:"mp4a.40."+c,manifestCodec:o};e.trigger(p.Events.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+u})}function r(e,t){return 255===e[t]&&240==(246&e[t+1])}function n(e,t){return 1&e[t+1]?7:9}function o(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function s(e,t){return t+5=e.length||(i=o(e,t))<=r)&&((r=t+i)===e.length||l(e,r))}function f(e,t,i,r,s){e.samplerate||(t=a(t,i,r,s))&&(e.config=t.config,e.samplerate=t.samplerate,e.channelCount=t.channelCount,e.codec=t.codec,e.manifestCodec=t.manifestCodec,d.logger.log("parsed codec:"+e.codec+", rate:"+t.samplerate+", channels:"+t.channelCount))}function A(e){return 9216e4/e}function m(e,t,i,r,s){var a=n(e,t),e=o(e,t);if(0<(e-=a))return{headerLength:a,frameLength:e,stamp:i+r*s}}function g(e,t,i,r,s){var a,n,o,r=m(t,i,r,s,A(e.samplerate));if(r)return s=r.frameLength,n=r.headerLength,r=r.stamp,s=n+s,(o=Math.max(0,i+s-t.length))?(a=new Uint8Array(s-n)).set(t.subarray(i+n,t.length),0):a=t.subarray(i+n,i+s),t={unit:a,pts:r},o||e.samples.push(t),{sample:t,length:s,missing:o}}},"./src/demux/base-audio-demuxer.ts":function(e,t,i){i.r(t),i.d(t,"initPTSFn",function(){return A});var r=i("./src/polyfills/number.ts"),d=i("./src/demux/id3.ts"),h=i("./src/demux/dummy-demuxed-track.ts"),p=i("./src/utils/mp4-tools.ts"),f=i("./src/utils/typed-array.ts");(i=s.prototype).resetInitSegment=function(e,t,i){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},i.resetTimeStamp=function(){},i.resetContiguity=function(){},i.canParse=function(e,t){return!1},i.appendFrame=function(e,t,i){},i.demux=function(e,t){this.cachedData&&(e=Object(p.appendUint8Array)(this.cachedData,e),this.cachedData=null);var i,r,s,a=d.getID3Data(e,0),n=a?a.length:0,o=this._audioTrack,l=this._id3Track,c=a?d.getTimeStamp(a):void 0,u=e.length;for(0!==this.frameIndex&&null!==this.initPTS||(this.initPTS=A(c,t)),a&&0e||(e=(e-=this.bitsAvailable)-((t=e>>3)>>3),this.bytesAvailable-=t,this.loadWord()),this.word<<=e,this.bitsAvailable-=e},i.readBits=function(e){var t=Math.min(this.bitsAvailable,e),i=this.word>>>32-t;return 32>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},i.skipUEG=function(){this.skipBits(1+this.skipLZ())},i.skipEG=function(){this.skipBits(1+this.skipLZ())},i.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},i.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},i.readBoolean=function(){return 1===this.readBits(1)},i.readUByte=function(){return this.readBits(8)},i.readUShort=function(){return this.readBits(16)},i.readUInt=function(){return this.readBits(32)},i.skipScalingList=function(e){for(var t=8,i=8,r=0;r>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(s);break;case 12:case 13:a=e[c++],l+=String.fromCharCode((31&s)<<6|63&a);break;case 14:a=e[c++],n=e[c++],l+=String.fromCharCode((15&s)<<12|(63&a)<<6|(63&n)<<0)}}return l},v={decodeTextFrame:A}},"./src/demux/mp3demuxer.ts":function(e,t,i){i.r(t);var r=i("./src/demux/base-audio-demuxer.ts"),s=i("./src/demux/id3.ts"),a=i("./src/utils/logger.ts"),n=i("./src/demux/mpegaudio.ts");function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}l=r.default,i=l,(r=c).prototype=Object.create(i.prototype),o(r.prototype.constructor=r,i),(r=c.prototype).resetInitSegment=function(e,t,i){l.prototype.resetInitSegment.call(this,e,t,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:e,duration:i,inputTimeScale:9e4,dropped:0}},c.probe=function(e){if(e)for(var t=(s.getID3Data(e,0)||[]).length,i=e.length;tt.length)){var a=n(t,i);if(a&&i+a.frameLength<=t.length)return r=r+s*(9e4*a.samplesPerFrame/a.sampleRate),s={unit:t.subarray(i,i+a.frameLength),pts:r,dts:r},e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(s),{sample:s,length:a.frameLength,missing:0}}}function n(e,t){var i,r,s,a,n,o=e[t+1]>>3&3,l=e[t+1]>>1&3,c=e[t+2]>>4&15,u=e[t+2]>>2&3;if(1!=o&&0!=c&&15!=c&&3!=u)return n=e[t+2]>>1&1,i=e[t+3]>>6,c=1e3*h[14*(3==o?3-l:3==l?3:4)+c-1],u=p[3*(3==o?0:2==o?1:2)+u],r=3==i?1:2,a=8*(o=f[o][l])*(s=A[l]),o=Math.floor(o*c/u+n)*s,null===d&&(n=(navigator.userAgent||"").match(/Chrome\/(\d+)/i),d=n?parseInt(n[1]):0),d&&d<=87&&2==l&&224e3<=c&&0==i&&(e[t+3]=128|e[t+3]),{sampleRate:u,channelCount:r,frameLength:o,samplesPerFrame:a}}function s(e,t){return 255===e[t]&&224==(224&e[t+1])&&0!=(6&e[t+1])}function a(e,t){return t+1=e.length)return void i();if(!(e[t].unit.length<32)){var r=this.decrypter.isSync();if(this.decryptAacSample(e,t,i,r),!r)return}}},i.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,i=new Int8Array(t),r=0,s=32;s=e.length)return void r();for(var s=e[t].units;!(i>=s.length);i++){var a=s[i];if(!(a.data.length<=48||1!==a.type&&5!==a.type)){var n=this.decrypter.isSync();if(this.decryptAvcSample(e,t,i,r,a,n),!n)return}}}},t.default=s},"./src/demux/transmuxer-interface.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return r});var l=i("./node_modules/webworkify-webpack/index.js"),c=i("./src/events.ts"),S=i("./src/demux/transmuxer.ts"),T=i("./src/utils/logger.ts"),u=i("./src/errors.ts"),t=i("./src/utils/mediasource-helper.ts"),d=i("./node_modules/eventemitter3/index.js"),h=Object(t.getMediaSource)()||{isTypeSupported:function(){return!1}},r=((i=s.prototype).destroy=function(){var e=this.worker,e=(e?(e.removeEventListener("message",this.onwmsg),e.terminate(),this.worker=null):(e=this.transmuxer)&&(e.destroy(),this.transmuxer=null),this.observer);e&&e.removeAllListeners(),this.observer=null},i.push=function(e,t,i,r,s,a,n,o,l,c){var u=this,d=(l.transmuxing.start=self.performance.now(),this.transmuxer),h=this.worker,p=(a||s).start,f=s.decryptdata,A=this.frag,m=!(A&&s.cc===A.cc),g=!(A&&l.level===A.level),y=A?l.sn-A.sn:-1,v=this.part?l.part-this.part.index:1,b=!g&&(1==y||0==y&&1==v),E=self.performance.now(),E=((g||y||0===s.stats.parsing.start)&&(s.stats.parsing.start=E),!a||!v&&b||(a.stats.parsing.start=E),!(A&&(null==(y=s.initSegment)?void 0:y.url)===(null==(v=A.initSegment)?void 0:v.url))),y=new S.TransmuxState(m,b,o,g,p,E);b&&!m&&!E||(T.logger.log("[transmuxer-interface, "+s.type+"]: Starting new transmux session for sn: "+l.sn+" p: "+l.part+" level: "+l.level+" id: "+l.id+"\n discontinuity: "+m+"\n trackSwitch: "+g+"\n contiguous: "+b+"\n accurateTimeOffset: "+o+"\n timeOffset: "+p+"\n initSegmentChange: "+E),A=new S.TransmuxConfig(i,r,t,n,c),this.configureTransmuxer(A)),this.frag=s,this.part=a,h?h.postMessage({cmd:"demux",data:e,decryptdata:f,chunkMeta:l,state:y},e instanceof ArrayBuffer?[e]:[]):d&&(v=d.push(e,f,l,y),Object(S.isPromise)(v)?v.then(function(e){u.handleTransmuxComplete(e)}):this.handleTransmuxComplete(v))},i.flush=function(t){var i=this,e=(t.transmuxing.start=self.performance.now(),this.transmuxer),r=this.worker;r?r.postMessage({cmd:"flush",chunkMeta:t}):e&&(r=e.flush(t),Object(S.isPromise)(r)?r.then(function(e){i.handleFlushResult(e,t)}):this.handleFlushResult(r,t))},i.handleFlushResult=function(e,t){var i=this;e.forEach(function(e){i.handleTransmuxComplete(e)}),this.onFlush(t)},i.onWorkerMessage=function(e){var t=e.data,i=this.hls;switch(t.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,i.trigger(t.event,t.data)}},i.configureTransmuxer=function(e){var t=this.worker,i=this.transmuxer;t?t.postMessage({cmd:"configure",config:e}):i&&i.configure(e)},i.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},s);function s(i,e,t,r){function s(e,t){(t=t||{}).frag=n.frag,t.id=n.id,i.trigger(e,t)}var a,n=this,t=(this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=i,this.id=e,this.onTransmuxComplete=t,this.onFlush=r,i.config),r=(this.observer=new d.EventEmitter,this.observer.on(c.Events.FRAG_DECRYPTED,s),this.observer.on(c.Events.ERROR,s),{mp4:h.isTypeSupported("video/mp4"),mpeg:h.isTypeSupported("audio/mpeg"),mp3:h.isTypeSupported('audio/mp4; codecs="mp3"')}),o=navigator.vendor;if(t.enableWorker&&"undefined"!=typeof Worker){T.logger.log("demuxing in webworker");try{a=this.worker=l("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),a.addEventListener("message",this.onwmsg),a.onerror=function(e){i.trigger(c.Events.ERROR,{type:u.ErrorTypes.OTHER_ERROR,details:u.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(e.message+" ("+e.filename+":"+e.lineno+")")})},a.postMessage({cmd:"init",typeSupported:r,vendor:o,id:e,config:JSON.stringify(t)})}catch(i){T.logger.warn("Error in worker:",i),T.logger.error("Error while initializing DemuxerWorker, fallback to inline"),a&&self.URL.revokeObjectURL(a.objectURL),this.transmuxer=new S.default(this.observer,r,t,o,e),this.worker=null}}else this.transmuxer=new S.default(this.observer,r,t,o,e)}},"./src/demux/transmuxer-worker.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return s});var o=i("./src/demux/transmuxer.ts"),r=i("./src/events.ts"),l=i("./src/utils/logger.ts"),c=i("./node_modules/eventemitter3/index.js");function s(s){function a(e,t){s.postMessage({event:e,data:t})}var n=new c.EventEmitter;n.on(r.Events.FRAG_DECRYPTED,a),n.on(r.Events.ERROR,a),s.addEventListener("message",function(e){var t=e.data;switch(t.cmd){case"init":var i=JSON.parse(t.config);s.transmuxer=new o.default(n,t.typeSupported,i,t.vendor,t.id),Object(l.enableLogs)(i.debug),a("init",null);break;case"configure":s.transmuxer.configure(t.config);break;case"demux":i=s.transmuxer.push(t.data,t.decryptdata,t.chunkMeta,t.state);Object(o.isPromise)(i)?i.then(function(e){u(s,e)}):u(s,i);break;case"flush":var r=t.chunkMeta,i=s.transmuxer.flush(r);Object(o.isPromise)(i)?i.then(function(e){d(s,e,r)}):d(s,i,r)}})}function u(e,t){var i,r,s;((i=t.remuxResult).audio||i.video||i.text||i.id3||i.initSegment)&&(i=[],r=(s=t.remuxResult).audio,s=s.video,r&&a(i,r),s&&a(i,s),e.postMessage({event:"transmuxComplete",data:t},i))}function a(e,t){t.data1&&e.push(t.data1.buffer),t.data2&&e.push(t.data2.buffer)}function d(t,e,i){e.forEach(function(e){u(t,e)}),t.postMessage({event:"flush",data:i})}},"./src/demux/transmuxer.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return d}),i.d(t,"isPromise",function(){return p}),i.d(t,"TransmuxConfig",function(){return f}),i.d(t,"TransmuxState",function(){return A});var y,l=i("./src/events.ts"),c=i("./src/errors.ts"),r=i("./src/crypt/decrypter.ts"),t=i("./src/demux/aacdemuxer.ts"),g=i("./src/demux/mp4demuxer.ts"),s=i("./src/demux/tsdemuxer.ts"),a=i("./src/demux/mp3demuxer.ts"),n=i("./src/remux/mp4-remuxer.ts"),v=i("./src/remux/passthrough-remuxer.ts"),o=i("./src/demux/chunk-cache.ts"),b=i("./src/utils/mp4-tools.ts"),E=i("./src/utils/logger.ts");try{y=self.performance.now.bind(self.performance)}catch(e){E.logger.debug("Unable to use Performance API on this environment"),y=self.Date.now}var S=[{demux:s.default,remux:n.default},{demux:g.default,remux:v.default},{demux:t.default,remux:n.default},{demux:a.default,remux:n.default}],u=1024,d=(S.forEach(function(e){e=e.demux;u=Math.max(u,e.minProbeByteLength)}),(i=h.prototype).configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},i.push=function(e,t,i,r){var s=this,a=i.transmuxing,e=(a.executeStart=y(),new Uint8Array(e)),n=this.cache,o=this.config,l=this.currentTransmuxState,c=this.transmuxConfig,t=(r&&(this.currentTransmuxState=r),u=null,u=0>4){if((w=E+5+e[E+4])===E+188)continue}else w=E+4;switch(T){case l:S&&(c&&(s=O(c))&&this.parseAVCPES(s,!1),c={data:[],size:0}),c&&(c.data.push(e.subarray(w,E+188)),c.size+=E+188-w);break;case u:S&&(h&&(s=O(h))&&(n.isAAC?this.parseAACPES(s):this.parseMPEGPES(s)),h={data:[],size:0}),h&&(h.data.push(e.subarray(w,E+188)),h.size+=E+188-w);break;case d:S&&(p&&(s=O(p))&&this.parseID3PES(s),p={data:[],size:0}),p&&(p.data.push(e.subarray(w,E+188)),p.size+=E+188-w);break;case 0:S&&(w+=e[w]+1),m=this._pmtId=(31&(k=e)[(v=w)+10])<<8|k[v+11];break;case m:S&&(w+=e[w]+1);var k=function(e,t,i,r){var s={audio:-1,avc:-1,id3:-1,isAAC:!0},a=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);te.size-6)return null;var l=t[7],c=(192&l&&(r=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&l?54e5=e[i-1].pts)e.push(t);else for(var r=i-1;0<=r;r--)if(t.ptst)return r;return 0}},{key:"maxAutoLevel",get:function(){var e=this.levels,t=this.autoLevelCapping;return-1===t&&e&&e.length?e.length-1:t}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(e){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,e)}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}]),o(i,t);var l=E;function E(e){void 0===e&&(e={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new b.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var t=this.config=Object(v.mergeConfig)(E.DefaultConfig,e),e=(this.userConfig=e,Object(y.enableLogs)(t.debug),this._autoLevelCapping=-1,t.progressive&&Object(v.enableStreamingMode)(t),t.abrController),i=t.bufferController,r=t.capLevelController,s=t.fpsController,e=this.abrController=new e(this),i=this.bufferController=new i(this),r=this.capLevelController=new r(this),s=new s(this),a=new d.default(this),n=new h.default(this),o=new p.default(this),l=this.levelController=new A.default(this),c=new m.FragmentTracker(this),u=this.streamController=new g.default(this,c),l=(r.setStreamController(u),s.setStreamController(u),[l,u]),u=(this.networkControllers=l,[a,n,e,i,r,s,o,c]);this.audioTrackController=this.createController(t.audioTrackController,null,l),this.createController(t.audioStreamController,c,l),this.subtitleTrackController=this.createController(t.subtitleTrackController,null,l),this.createController(t.subtitleStreamController,c,l),this.createController(t.timelineController,null,u),this.emeController=this.createController(t.emeController,null,u),this.cmcdController=this.createController(t.cmcdController,null,u),this.latencyController=this.createController(f.default,null,u),this.coreComponents=u}l.defaultConfig=void 0},"./src/is-supported.ts":function(e,t,i){i.r(t),i.d(t,"isSupported",function(){return a}),i.d(t,"changeTypeSupported",function(){return n});var r=i("./src/utils/mediasource-helper.ts");function s(){return self.SourceBuffer||self.WebKitSourceBuffer}function a(){var e,t=Object(r.getMediaSource)();return!!t&&(e=s(),t=t&&"function"==typeof t.isTypeSupported&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),e=!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove,!!t)&&!!e}function n(){var e=s();return"function"==typeof(null==e||null==(e=e.prototype)?void 0:e.changeType)}},"./src/loader/fragment-loader.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return l}),i.d(t,"LoadError",function(){return A});var r=i("./src/polyfills/number.ts"),h=i("./src/errors.ts");function s(e){var i="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(e))return i.get(e);i.set(e,t)}function t(){return a(e,arguments,o(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n(t,e)})(e)}function a(e,t,i){return(a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return;if(Reflect.construct.sham)return;if("function"==typeof Proxy)return 1;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),1}catch(e){}}()?Reflect.construct:function(e,t,i){var r=[null],t=(r.push.apply(r,t),new(Function.bind.apply(e,r)));return i&&n(t,i.prototype),t}).apply(null,arguments)}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var p=Math.pow(2,17),l=((t=c.prototype).destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},t.abort=function(){this.loader&&this.loader.abort()},t.load=function(n,o){var l=this,e=n.url;if(!e)return Promise.reject(new A({type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,networkDetails:null},"Fragment does not have a "+(e?"part list":"url")));this.abort();var i=this.config,c=i.fLoader,u=i.loader;return new Promise(function(s,r){l.loader&&l.loader.destroy();var a=l.loader=n.loader=new(c||u)(i),e=f(n),t={timeout:i.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:i.fragLoadingMaxRetryTimeout,highWaterMark:p};n.stats=a.stats,a.load(e,t,{onSuccess:function(e,t,i,r){l.resetLoader(n,a),s({frag:n,part:null,payload:e.data,networkDetails:r})},onError:function(e,t,i){l.resetLoader(n,a),r(new A({type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,response:e,networkDetails:i}))},onAbort:function(e,t,i){l.resetLoader(n,a),r(new A({type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:n,networkDetails:i}))},onTimeout:function(e,t,i){l.resetLoader(n,a),r(new A({type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,networkDetails:i}))},onProgress:function(e,t,i,r){o&&o({frag:n,part:null,payload:i,networkDetails:r})}})})},t.loadPart=function(n,o,l){var c=this,i=(this.abort(),this.config),u=i.fLoader,d=i.loader;return new Promise(function(s,r){c.loader&&c.loader.destroy();var a=c.loader=n.loader=new(u||d)(i),e=f(n,o),t={timeout:i.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:i.fragLoadingMaxRetryTimeout,highWaterMark:p};o.stats=a.stats,a.load(e,t,{onSuccess:function(e,t,i,r){c.resetLoader(n,a),c.updateStatsFromPart(n,o);e={frag:n,part:o,payload:e.data,networkDetails:r};l(e),s(e)},onError:function(e,t,i){c.resetLoader(n,a),r(new A({type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:n,part:o,response:e,networkDetails:i}))},onAbort:function(e,t,i){n.stats.aborted=o.stats.aborted,c.resetLoader(n,a),r(new A({type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:n,part:o,networkDetails:i}))},onTimeout:function(e,t,i){c.resetLoader(n,a),r(new A({type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:n,part:o,networkDetails:i}))}})})},t.updateStatsFromPart=function(e,t){var i=e.stats,r=t.stats,s=r.total,e=(i.loaded+=r.loaded,s?(s=((e=Math.round(e.duration/t.duration))-(t=Math.min(Math.round(i.loaded/s),e)))*Math.round(i.loaded/t),i.total=i.loaded+s):i.total=Math.max(i.loaded,i.total),i.loading),t=r.loading;e.start?e.first+=t.first-t.start:(e.start=t.start,e.first=t.first),e.end=t.end},t.resetLoader=function(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()},c);function c(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}function f(e,t){var i=(t=void 0===t?null:t)||e,e={frag:e,part:t,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},t=i.byteRangeStartOffset,i=i.byteRangeEndOffset;return Object(r.isFiniteNumber)(t)&&Object(r.isFiniteNumber)(i)&&(e.rangeStart=t,e.rangeEnd=i),e}u=s(Error),i=u,(t=d).prototype=Object.create(i.prototype),n(t.prototype.constructor=t,i);var u,A=d;function d(e){for(var t,i=arguments.length,r=new Array(1>8*(15-i)&255;return t},i.setDecryptDataFromLevelKey=function(e,t){var i=e;return"AES-128"===(null==e?void 0:e.method)&&e.uri&&!e.iv&&((i=o.LevelKey.fromURI(e.uri)).method=e.method,i.iv=this.createInitializationVector(t),i.keyFormat="identity"),i},i.setElementaryStreamInfo=function(e,t,i,r,s,a){void 0===a&&(a=!1);var n=this.elementaryStreams,o=n[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,i),o.startDTS=Math.min(o.startDTS,r),o.endDTS=Math.max(o.endDTS,s)):n[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:s,partial:a}},i.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[r.AUDIO]=null,e[r.VIDEO]=null,e[r.AUDIOVIDEO]=null},h(v,[{key:"decryptdata",get:function(){var e;return this.levelkey||this._decryptdata?(!this._decryptdata&&this.levelkey&&("number"!=typeof(e=this.sn)&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&n.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),e=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,e)),this._decryptdata):null}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){var e;return null!==this.programDateTime&&Object(s.isFiniteNumber)(this.programDateTime)?(e=Object(s.isFiniteNumber)(this.duration)?this.duration:0,this.programDateTime+1e3*e):null}},{key:"encrypted",get:function(){var e;return!(null==(e=this.decryptdata)||!e.keyFormat||!this.decryptdata.uri)}}]),v),g=(c(y,p=A),h(y,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),y);function y(e,t,i,r,s){(i=p.call(this,i)||this).fragOffset=0,i.duration=0,i.gap=!1,i.independent=!1,i.relurl=void 0,i.fragment=void 0,i.index=void 0,i.stats=new l.LoadStats,i.duration=e.decimalFloatingPoint("DURATION"),i.gap=e.bool("GAP"),i.independent=e.bool("INDEPENDENT"),i.relurl=e.enumeratedString("URI"),i.fragment=t,i.index=r;t=e.enumeratedString("BYTERANGE");return t&&i.setByteRange(t,s),s&&(i.fragOffset=s.fragOffset+s.duration),i}function v(e,t){return(t=f.call(this,t)||this)._decryptdata=null,t.rawProgramDateTime=null,t.programDateTime=null,t.tagList=[],t.duration=0,t.sn=0,t.levelkey=void 0,t.type=void 0,t.loader=null,t.level=-1,t.cc=0,t.startPTS=void 0,t.endPTS=void 0,t.appendedPTS=void 0,t.startDTS=void 0,t.endDTS=void 0,t.start=0,t.deltaPTS=void 0,t.maxStartPTS=void 0,t.minEndPTS=void 0,t.stats=new l.LoadStats,t.urlId=0,t.data=void 0,t.bitrateTest=!1,t.title=null,t.initSegment=null,t.type=e,t}function b(e){var t;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((t={})[r.AUDIO]=null,t[r.VIDEO]=null,t[r.AUDIOVIDEO]=null,t),this.baseurl=e}},"./src/loader/key-loader.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return s});var n=i("./src/events.ts"),r=i("./src/errors.ts"),o=i("./src/utils/logger.ts"),s=((t=a.prototype)._registerListeners=function(){this.hls.on(n.Events.KEY_LOADING,this.onKeyLoading,this)},t._unregisterListeners=function(){this.hls.off(n.Events.KEY_LOADING,this.onKeyLoading)},t.destroy=function(){for(var e in this._unregisterListeners(),this.loaders){e=this.loaders[e];e&&e.destroy()}this.loaders={}},t.onKeyLoading=function(e,t){var i,r,t=t.frag,s=t.type,a=this.loaders[s];t.decryptdata?(i=t.decryptdata.uri)!==this.decrypturl||null===this.decryptkey?(r=this.hls.config,a&&(o.logger.warn("abort previous key loader for type:"+s),a.abort()),i?(a=r.loader,s=t.loader=this.loaders[s]=new a(r),this.decrypturl=i,this.decryptkey=null,a={url:i,frag:t,responseType:"arraybuffer"},i={timeout:r.fragLoadingTimeOut,maxRetry:0,retryDelay:r.fragLoadingRetryDelay,maxRetryDelay:r.fragLoadingMaxRetryTimeout,highWaterMark:0},r={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},s.load(a,i,r)):o.logger.warn("key uri is falsy")):this.decryptkey&&(t.decryptdata.key=this.decryptkey,this.hls.trigger(n.Events.KEY_LOADED,{frag:t})):o.logger.warn("Missing decryption data on fragment in onKeyLoading")},t.loadsuccess=function(e,t,i){i=i.frag;i.decryptdata?(this.decryptkey=i.decryptdata.key=new Uint8Array(e.data),i.loader=null,delete this.loaders[i.type],this.hls.trigger(n.Events.KEY_LOADED,{frag:i})):o.logger.error("after key load, decryptdata unset")},t.loaderror=function(e,t){var t=t.frag,i=t.loader;i&&i.abort(),delete this.loaders[t.type],this.hls.trigger(n.Events.ERROR,{type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:t,response:e})},t.loadtimeout=function(e,t){var t=t.frag,i=t.loader;i&&i.abort(),delete this.loaders[t.type],this.hls.trigger(n.Events.ERROR,{type:r.ErrorTypes.NETWORK_ERROR,details:r.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:t})},a);function a(e){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=e,this._registerListeners()}},"./src/loader/level-details.ts":function(e,t,i){i.r(t),i.d(t,"LevelDetails",function(){return a});var r=i("./src/polyfills/number.ts");function s(e,t){for(var i=0;ie.endSN||0>24&255,o[1]=t>>16&255,o[2]=t>>8&255,o[3]=255&t,o.set(e,4),a=0,t=8;a>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,t>>24,t>>16&255,t>>8&255,255&t,85,196,0,0]))},d.mdia=function(e){return d.box(d.types.mdia,d.mdhd(e.timescale,e.duration),d.hdlr(e.type),d.minf(e))},d.mfhd=function(e){return d.box(d.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},d.minf=function(e){return"audio"===e.type?d.box(d.types.minf,d.box(d.types.smhd,d.SMHD),d.DINF,d.stbl(e)):d.box(d.types.minf,d.box(d.types.vmhd,d.VMHD),d.DINF,d.stbl(e))},d.moof=function(e,t,i){return d.box(d.types.moof,d.mfhd(e),d.traf(i,t))},d.moov=function(e){for(var t=e.length,i=[];t--;)i[t]=d.trak(e[t]);return d.box.apply(null,[d.types.moov,d.mvhd(e[0].timescale,e[0].duration)].concat(i).concat(d.mvex(e)))},d.mvex=function(e){for(var t=e.length,i=[];t--;)i[t]=d.trex(e[t]);return d.box.apply(null,[d.types.mvex].concat(i))},d.mvhd=function(e,t){t*=e;var i=Math.floor(t/(1+a)),t=Math.floor(t%(1+a)),e=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,t>>24,t>>16&255,t>>8&255,255&t,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 d.box(d.types.mvhd,e)},d.sdtp=function(e){for(var t,i=e.samples||[],r=new Uint8Array(4+i.length),s=0;s>>8&255),r.push(255&i),r=r.concat(Array.prototype.slice.call(t));for(a=0;a>>8&255),s.push(255&i),s=s.concat(Array.prototype.slice.call(t));var n=d.box(d.types.avcC,new Uint8Array([1,r[3],r[4],r[5],255,224|e.sps.length].concat(r).concat([e.pps.length]).concat(s))),o=e.width,l=e.height,c=e.pixelRatio[0],u=e.pixelRatio[1];return d.box(d.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,255&o,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),n,d.box(d.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),d.box(d.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,u>>24,u>>16&255,u>>8&255,255&u])))},d.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},d.mp4a=function(e){var t=e.samplerate;return d.box(d.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0]),d.box(d.types.esds,d.esds(e)))},d.mp3=function(e){var t=e.samplerate;return d.box(d.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0]))},d.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?d.box(d.types.stsd,d.STSD,d.mp4a(e)):d.box(d.types.stsd,d.STSD,d.mp3(e)):d.box(d.types.stsd,d.STSD,d.avc1(e))},d.tkhd=function(e){var t=e.id,i=e.duration*e.timescale,r=e.width,e=e.height,s=Math.floor(i/(1+a)),i=Math.floor(i%(1+a));return d.box(d.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,i>>24,i>>16&255,i>>8&255,255&i,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,255&r,0,0,e>>8&255,255&e,0,0]))},d.traf=function(e,t){var i=d.sdtp(e),r=e.id,s=Math.floor(t/(1+a)),t=Math.floor(t%(1+a));return d.box(d.types.traf,d.box(d.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),d.box(d.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,t>>24,t>>16&255,t>>8&255,255&t])),d.trun(e,i.length+16+20+8+16+8+8),i)},d.trak=function(e){return e.duration=e.duration||4294967295,d.box(d.types.trak,d.tkhd(e),d.mdia(e))},d.trex=function(e){e=e.id;return d.box(d.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},d.trun=function(e,t){var i,r,s,a,n,o=e.samples||[],l=o.length,e=12+16*l,c=new Uint8Array(e);for(c.set([0,0,15,1,l>>>24&255,l>>>16&255,l>>>8&255,255&l,(t+=8+e)>>>24&255,t>>>16&255,t>>>8&255,255&t],0),i=0;i>>24&255,r>>>16&255,r>>>8&255,255&r,s>>>24&255,s>>>16&255,s>>>8&255,255&s,a.isLeading<<2|a.dependsOn,a.isDependedOn<<6|a.hasRedundancy<<4|a.paddingValue<<1|a.isNonSync,61440&a.degradPrio,15&a.degradPrio,n>>>24&255,n>>>16&255,n>>>8&255,255&n],12+16*i);return d.box(d.types.trun,c)},d.initSegment=function(e){d.types||d.init();var e=d.moov(e),t=new Uint8Array(d.FTYP.byteLength+e.byteLength);return t.set(d.FTYP),t.set(e,d.FTYP.byteLength),t},d);function d(){}i.types=void 0,i.HDLR_TYPES=void 0,i.STTS=void 0,i.STSC=void 0,i.STCO=void 0,i.STSZ=void 0,i.VMHD=void 0,i.SMHD=void 0,i.STSD=void 0,i.FTYP=void 0,i.DINF=void 0,t.default=i},"./src/remux/mp4-remuxer.ts":function(e,t,i){i.r(t),i.d(t,"default",function(){return r}),i.d(t,"normalizePts",function(){return Z});var h=i("./src/polyfills/number.ts"),M=i("./src/remux/aac-helper.ts"),G=i("./src/remux/mp4-generator.ts"),z=i("./src/events.ts"),K=i("./src/errors.ts"),q=i("./src/utils/logger.ts"),S=i("./src/types/loader.ts"),J=i("./src/utils/timescale-conversion.ts");function Q(){return(Q=Object.assign||function(e){for(var t=1;tg.pts&&(f=Math.max(Math.min(f,g.pts-g.dts),-18e3)),g.dtsNumber.MAX_SAFE_INTEGER?1/0:e},i.hexadecimalInteger=function(e){if(this[e]){for(var t=(1&(t=(this[e]||"0x").slice(2)).length?"0":"")+t,i=new Uint8Array(t.length/2),r=0;rNumber.MAX_SAFE_INTEGER?1/0:e},i.decimalFloatingPoint=function(e){return parseFloat(this[e])},i.optionalFloat=function(e,t){e=this[e];return e?parseFloat(e):t},i.enumeratedString=function(e){return this[e]},i.bool=function(e){return"YES"===this[e]},i.decimalResolution=function(e){e=r.exec(this[e]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},n.parseAttrList=function(e){var t,i={};for(s.lastIndex=0;null!==(t=s.exec(e));){var r=t[2];0===r.indexOf('"')&&r.lastIndexOf('"')===r.length-1&&(r=r.slice(1,-1)),i[t[1]]=r}return i},n);function n(e){for(var t in e="string"==typeof e?n.parseAttrList(e):e)e.hasOwnProperty(t)&&(this[t]=e[t])}},"./src/utils/binary-search.ts":function(e,t,i){i.r(t),t.default={search:function(e,t){for(var i,r,s=0,a=e.length-1;s<=a;){var n=t(r=e[i=(s+a)/2|0]);if(0=i.start(r)&&t<=i.end(r))return!0}catch(e){}return!1},n.bufferInfo=function(e,t,i){try{if(e){for(var r=n.getBuffered(e),s=[],a=0;aa&&(r[n-1].end=e[s].end):r.push(e[s])}else r=e;for(var o,l=0,c=t,u=t,d=0;d=e&&r.logger.log(this.time+" ["+e+"] "+t)},R),m=((i=C.prototype).reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},i.setStyles=function(e){for(var t=["foreground","underline","italics","background","flash"],i=0;in&&(this.logger.log(c.DEBUG,"Too large cursor position "+this.pos),this.pos=n)},i.moveCursor=function(e){var t=this.pos+e;if(1=n?this.logger.log(c.ERROR,"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},i.clearFromPos=function(e){for(var t=e;t ("+l([n,o])+")"),!(i=(i=(i=(i=this.parseCmd(n,o))||this.parseMidrow(n,o))||this.parsePAC(n,o))||this.parseBackgroundAttributes(n,o))&&(r=this.parseChars(n,o))&&((a=this.currentChannel)&&0i.startCC||e&&e.cc=this.minWeight_},i.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},i.destroy=function(){},t.default=r},"./src/utils/ewma.ts":function(e,t,i){function r(e,t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}i.r(t),(i=r.prototype).sample=function(e,t){var i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e},i.getTotalWeight=function(){return this.totalWeight_},i.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},t.default=r},"./src/utils/fetch-loader.ts":function(e,t,i){i.r(t),i.d(t,"fetchSupported",function(){return l});var d=i("./src/polyfills/number.ts"),r=i("./src/loader/load-stats.ts"),c=i("./src/demux/chunk-cache.ts");function s(e){var i="function"==typeof Map?new Map:void 0;return(s=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==i){if(i.has(e))return i.get(e);i.set(e,t)}function t(){return a(e,arguments,o(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n(t,e)})(e)}function a(e,t,i){return(a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return;if(Reflect.construct.sham)return;if("function"==typeof Proxy)return 1;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),1}catch(e){}}()?Reflect.construct:function(e,t,i){var r=[null],t=(r.push.apply(r,t),new(Function.bind.apply(e,r)));return i&&n(t,i.prototype),t}).apply(null,arguments)}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(){return(h=Object.assign||function(e){for(var t=1;t=n&&o(s,a,l.flush(),r)):o(s,a,e,r),i())}).catch(function(){return Promise.reject()})}()};i=u;function u(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||p,this.controller=new self.AbortController,this.stats=new r.LoadStats}function p(e,t){return new self.Request(e.url,t)}f=s(Error),m=f,(A=y).prototype=Object.create(m.prototype),n(A.prototype.constructor=A,m);var f,A,m,g=y;function y(e,t,i){return(e=f.call(this,e)||this).code=void 0,e.details=void 0,e.code=t,e.details=i,e}t.default=i},"./src/utils/imsc1-ttml-parser.ts":function(e,t,i){i.r(t),i.d(t,"IMSC1_CODEC",function(){return r}),i.d(t,"parseIMSC1",function(){return s});var n=i("./src/utils/mp4-tools.ts"),o=i("./src/utils/vttparser.ts"),p=i("./src/utils/vttcue.ts"),l=i("./src/demux/id3.ts"),c=i("./src/utils/timescale-conversion.ts"),f=i("./src/utils/webvtt-parser.ts");function A(){return(A=Object.assign||function(e){for(var t=1;t"):s)})}(e,"debug","log","info","warn","error");try{a.log()}catch(e){a=r}}else a=r}var o=r},"./src/utils/mediakeys-helper.ts":function(e,t,i){i.r(t),i.d(t,"KeySystems",function(){return r}),i.d(t,"requestMediaKeySystemAccess",function(){return s}),(i=r=r||{}).WIDEVINE="com.widevine.alpha",i.PLAYREADY="com.microsoft.playready";var r,s="undefined"!=typeof self&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null},"./src/utils/mediasource-helper.ts":function(e,t,i){function r(){return self.MediaSource||self.WebKitMediaSource}i.r(t),i.d(t,"getMediaSource",function(){return r})},"./src/utils/mp4-tools.ts":function(e,t,i){i.r(t),i.d(t,"bin2str",function(){return u}),i.d(t,"readUint16",function(){return h}),i.d(t,"readUint32",function(){return g}),i.d(t,"writeUint32",function(){return n}),i.d(t,"findBox",function(){return y}),i.d(t,"parseSegmentIndex",function(){return v}),i.d(t,"parseInitSegment",function(){return s}),i.d(t,"getStartDTS",function(){return o}),i.d(t,"getDuration",function(){return l}),i.d(t,"computeRawDurationFromSamples",function(){return b}),i.d(t,"offsetStartDTS",function(){return d}),i.d(t,"segmentValidRange",function(){return p}),i.d(t,"appendUint8Array",function(){return f});var r=i("./src/utils/typed-array.ts"),m=i("./src/loader/fragment.ts"),a=Math.pow(2,32)-1,c=[].push;function u(e){return String.fromCharCode.apply(null,e)}function h(e,t){"data"in e&&(t+=e.start,e=e.data);e=e[t]<<8|e[t+1];return e<0?65536+e:e}function g(e,t){"data"in e&&(t+=e.start,e=e.data);e=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return e<0?4294967296+e:e}function n(e,t,i){"data"in e&&(t+=e.start,e=e.data),e[t]=i>>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function y(e,t){var i,r,s=[];if(t.length)for(var a=("data"in e?(i=e.data,r=e.start,e.end):(r=0,(i=e).byteLength)),n=r;n>>31)return console.warn("SIDX has hierarchical references (not supported)"),null;u=g(r,c);c+=4,i.push({referenceSize:d,subsegmentDuration:u,info:{duration:u/a,start:n,end:n+d-1}}),n+=d,s=c+=4}return{earliestPresentationTime:0,timescale:a,version:e,referencesCount:o,references:i,moovEndOffset:t}}function s(e){for(var i=[],t=y(e,["moov","trak"]),r=0;re)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)},i.reset=function(){this.cueRanges=[],this.startTime=null};var r=s;function s(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}},"./src/utils/texttrack-utils.ts":function(e,t,i){i.r(t),i.d(t,"sendAddTrackEvent",function(){return r}),i.d(t,"addCueToTrack",function(){return a}),i.d(t,"clearCurrentCues",function(){return n}),i.d(t,"removeCuesInRange",function(){return o}),i.d(t,"getCuesInRange",function(){return l});var s=i("./src/utils/logger.ts");function r(e,t){var i;try{i=new Event("addtrack")}catch(e){(i=document.createEvent("Event")).initEvent("addtrack",!1,!1)}i.track=e,t.dispatchEvent(i)}function a(e,t){var i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: "+t)}catch(i){s.logger.debug("[texttrack-utils]: "+i);var r=new self.TextTrackCue(t.startTime,t.endTime,t.text);r.id=t.id,e.addCue(r)}"disabled"===i&&(e.mode=i)}function n(e){var t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(var i=e.cues.length;i--;)e.removeCue(e.cues[i]);"disabled"===t&&(e.mode=t)}function o(e,t,i){var r=e.mode;if("disabled"===r&&(e.mode="hidden"),e.cues&&0e[i].endTime)return-1;for(var r=0,s=i;r<=s;){var a=Math.floor((s+r)/2);if(te[a].startTime&&r=t&&o.endTime<=i)r.push(o);else if(o.startTime>i)return r}return r}},"./src/utils/time-ranges.ts":function(e,t,i){i.r(t),t.default={toString:function(e){for(var t="",i=e.length,r=0;r/gi,"\n")}(i=f.prototype).parse=function(e){var r=this;function t(){for(var e=0,t=p(t=r.buffer);e>>0).toString()};function w(e,t,i){return r(e.toString())+r(t.toString())+r(i)}function s(e,t,i,s,a,n,r,o){var l,c=new y.VTTParser,e=Object(v.utf8ArrayToStr)(new Uint8Array(e)).trim().replace(S,"\n").split("\n"),u=[],d=Object(b.toMpegTsClockFromTimescale)(t,i),h="00:00.000",p=0,f=0,A=!0,m=!1;c.oncue=function(e){var t=s[a],i=s.ccOffset,r=(p-d)/9e4,i=(null!=t&&t.new&&(void 0!==f?i=s.ccOffset=t.start:function(e,t){var i,r=e[a],s=e[r.prevCC];if(!s||!s.new&&r.new)return e.ccOffset=e.presentationOffset=r.start,r.new=!1;for(;null!=(i=s)&&i.new;)e.ccOffset+=r.start-s.start,r.new=!1,s=e[(r=s).prevCC];e.presentationOffset=t}(s,r)),r&&(i=r-s.presentationOffset),m&&(t=e.endTime-e.startTime,r=Object(E.normalizePts)(9e4*(e.startTime+i-f),9e4*n)/9e4,e.startTime=r,e.endTime=r+t),e.text.trim());e.text=decodeURIComponent(encodeURIComponent(i)),e.id||(e.id=w(e.startTime,e.endTime,i)),0=e.maxRetry||400<=t&&t<499?(o.logger.error(t+" while loading "+s.url),this.callbacks.onError({code:t,text:a.statusText},s,a)):(o.logger.warn(t+" while loading "+s.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,e.maxRetryDelay),n.retry++)):(self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),e.timeout)))},i.loadtimeout=function(){o.logger.warn("timeout while loading "+this.context.url);var e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.loader))},i.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},i.getCacheAge=function(){var e,t=null;return t=this.loader&&s.test(this.loader.getAllResponseHeaders())?(e=this.loader.getResponseHeader("age"))?parseFloat(e):null:t},t.default=a}},r={},s.m=i,s.c=r,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)s.d(i,r,function(e){return t[e]}.bind(null,r));return i},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="/dist/",s(s.s="./src/hls.ts").default;function s(e){var t;return(r[e]||(t=r[e]={i:e,l:!1,exports:{}},i[e].call(t.exports,t,t.exports,s),t.l=!0,t)).exports}var i,r}())}))&&tr.__esModule&&Object.prototype.hasOwnProperty.call(tr,"default")?tr.default:tr;class Wr extends t{constructor(e){super(),(this.player=e)._opt,this.canVideoPlay=!1,this.$videoElement=null,this.canvasRenderInterval=null,this.bandwidthEstimateInterval=null,this.fpsInterval=null,this.hlsFps=0,this.hlsPrevFrams=0,this.isInitInfo=!1,this.eventsDestroy=[],s.isSupported()?(this.$videoElement=this.player.video.$videoElement,this.hls=new s({}),this._initHls(),this._bindEvents()):function(){let e=document.createElement("video"),t=e.canPlayType("application/vnd.apple.mpegurl");return e=null,t}()?(this.$videoElement=this.player.video.$videoElement,this.canVideoPlay=!0):this.player.debug.error("HlsDecoder","init hls error ,not support "),this.player.debug.log("HlsDecoder","init")}destroy(){this.hls&&(this.hls.destroy(),this.hls=null),this.eventsDestroy.length&&(this.eventsDestroy.forEach(e=>e()),this.eventsDestroy=[]),this.isInitInfo=!1,this._stopCanvasRender(),this._stopBandwidthEstimateInterval(),this._stopFpsInterval(),this.$videoElement=null,this.hlsFps=0,this.player.debug.log("HlsDecoder","destroy")}checkHlsBufferedDelay(){var e=this.$videoElement;let t=0;var i=e.buffered,i=i.length?i.end(i.length-1):0;return(t=i-e.currentTime)<0&&(this.player.debug.warn("HlsDecoder","checkHlsBufferedDelay result < 0",t,i,e.currentTime),t=0),t}getFps(){return this.hlsFps}_startCanvasRender(){this._stopCanvasRender(),this.canvasRenderInterval=setInterval(()=>{this.player.video.render({$video:this.$videoElement,ts:0})},40)}_stopCanvasRender(){this.canvasRenderInterval&&(clearInterval(this.canvasRenderInterval),this.canvasRenderInterval=null)}_startBandwidthEstimateInterval(){this._stopBandwidthEstimateInterval(),this.bandwidthEstimateInterval=setInterval(()=>{let e=0;this.hls.bandwidthEstimate&&(e=this.hls.bandwidthEstimate),this.player.emit(v.kBps,(e/1024/8/10).toFixed(2))},1e3)}_stopBandwidthEstimateInterval(){this.bandwidthEstimateInterval&&(clearInterval(this.bandwidthEstimateInterval),this.bandwidthEstimateInterval=null)}_startFpsInterval(){this._stopCanvasRender(),this.fpsInterval=setInterval(()=>{var e=this.$videoElement.getVideoPlaybackQuality();this.hlsFps=e.totalVideoFrames-this.hlsPrevFrams,this.hlsPrevFrams=e.totalVideoFrames},1e3)}_stopFpsInterval(){this.fpsInterval&&(clearInterval(this.fpsInterval),this.fpsInterval=null)}_initHls(){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.$videoElement.muted=!0,Xe()&&(this.$videoElement.style.position="absolute"),this.initVideoEvents()),this.hls.attachMedia(this.$videoElement)}_bindEvents(){const i=this.player,e=this.player.events["proxy"];this.hls;var t=e(this.$videoElement,De,e=>{this.hls&&(e=parseInt(e.timeStamp,10),i.handleRender(),i.updateStats({ts:e,dts:e}),i.emit(v.videoTimeUpdate,e))});this.eventsDestroy.push(t),this._startBandwidthEstimateInterval(),this._startFpsInterval(),this.hls.on(s.Events.ERROR,(e,t)=>{if(t.fatal)switch(t.type){case s.ErrorTypes.NETWORK_ERROR:this.player.debug.error("HlsDecoder","fatal network error encountered, try to recover"),this.hls.startLoad();break;case s.ErrorTypes.MEDIA_ERROR:this.player.debug.error("HlsDecoder","fatal media error encountered, try to recover"),this.hls.recoverMediaError()}}),this.hls.on(s.Events.MEDIA_ATTACHING,()=>{}),this.hls.on(s.Events.MEDIA_ATTACHED,()=>{}),this.hls.on(s.Events.MEDIA_DETACHING,()=>{}),this.hls.on(s.Events.MEDIA_DETACHED,()=>{}),this.hls.on(s.Events.BUFFER_RESET,()=>{}),this.hls.on(s.Events.BUFFER_CODECS,()=>{}),this.hls.on(s.Events.BUFFER_CREATED,()=>{}),this.hls.on(s.Events.BUFFER_APPENDING,(e,t)=>{this.player.debug.log("HlsDecoder","BUFFER_APPENDING",t)}),this.hls.on(s.Events.BUFFER_APPENDED,()=>{}),this.hls.on(s.Events.BUFFER_EOS,()=>{}),this.hls.on(s.Events.BUFFER_FLUSHING,()=>{}),this.hls.on(s.Events.BUFFER_FLUSHED,()=>{}),this.hls.on(s.Events.MANIFEST_LOADING,()=>{this.player.debug.log("HlsDecoder","MANIFEST_LOADING 开始加载playlist m3u8资源")}),this.hls.on(s.Events.MANIFEST_LOADED,(e,t)=>{this.player.debug.log("HlsDecoder","MANIFEST_LOADED playlist m3u8文件加载完成",t)}),this.hls.on(s.Events.MANIFEST_PARSED,()=>{this.player.debug.log("HlsDecoder","MANIFEST_PARSED playlist m3u8解析完成"),i._times.demuxStart||(i._times.demuxStart=m())}),this.hls.on(s.Events.LEVEL_LOADING,()=>{}),this.hls.on(s.Events.LEVEL_LOADED,(e,t)=>{}),this.hls.on(s.Events.FRAG_LOADING,()=>{}),this.hls.on(s.Events.FRAG_LOADED,(e,t)=>{i._times.decodeStart||(i._times.decodeStart=m())}),this.hls.on(s.Events.BUFFER_APPENDING,()=>{i._times.videoStart||(i._times.videoStart=m(),i.handlePlayToRenderTimes())}),this.hls.on(s.Events.FRAG_DECRYPTED,()=>{}),this.hls.on(s.Events.KEY_LOADING,()=>{}),this.hls.on(s.Events.KEY_LOADING,()=>{}),this.hls.on(s.Events.FPS_DROP,e=>{}),this.hls.on(s.Events.FPS_DROP_LEVEL_CAPPING,e=>{}),this.hls.on(s.Events.FRAG_PARSING_INIT_SEGMENT,(e,t)=>{this.player.debug.log("HlsDecoder","FRAG_PARSING_INIT_SEGMENT",t);const i=!!(t&&t.tracks&&t.tracks.audio),r=!!(t&&t.tracks&&t.tracks.video);if(i&&t.tracks.audio){var s=t.tracks.audio;const i=s.metadata&&s.metadata.channelCount?s.metadata.channelCount:0,r=s.codec;this.player.audio&&this.player.audio.updateAudioInfo({encType:r,channels:i,sampleRate:44100})}var a;r&&t.tracks.video&&(t=(s=t.tracks.video).codec,a=s.metadata&&s.metadata.width?s.metadata.width:0,s=s.metadata&&s.metadata.height?s.metadata.height:0,this.player.video)&&this.player.video.updateVideoInfo({encTypeCode:-1!==t.indexOf("avc")?7:12,width:a,height:s})})}initVideoPlay(e){this.player._opt.useCanvasRender&&(this.$videoElement=document.createElement("video"),this.initVideoEvents()),this.$videoElement.muted=!0,this.$videoElement.src=e}initRenderSize(){this.isInitInfo||(this.player.video.updateVideoInfo({width:this.$videoElement.videoWidth,height:this.$videoElement.videoHeight}),this.player.video.initCanvasViewSize(),this.isInitInfo=!0)}initVideoEvents(){var e=this.player.events["proxy"],t=e(this.$videoElement,"canplay",()=>{this.player.debug.log("HlsDecoder","video canplay"),this.$videoElement.play().then(()=>{this.player.debug.log("HlsDecoder","video play"),this._startCanvasRender(),this.initRenderSize()}).catch(e=>{this.player.debug.warn("HlsDecoder","video play error ",e)})}),i=e(this.$videoElement,Re,()=>{this.player.debug.log("HlsDecoder","video waiting")}),r=e(this.$videoElement,De,e=>{e=parseInt(e.timeStamp,10);this.player.handleRender(),this.player.updateStats({ts:e}),this.player.emit(v.videoTimeUpdate,e)}),e=e(this.$videoElement,Le,()=>{this.player.debug.log("HlsDecoder","video playback Rate change",this.$videoElement&&this.$videoElement.playbackRate)});this.eventsDestroy.push(t,i,r,e)}loadSource(i){return new Promise((e,t)=>{this.canVideoPlay?(this.initVideoPlay(i),e()):this.hls.on(s.Events.MEDIA_ATTACHED,()=>{this.hls.loadSource(i),e()})})}_handleUpdatePlaybackRate(){if(this.$videoElement){var t=this.$videoElement,i=(this.player._opt.videoBuffer+this.player._opt.videoBufferDelay)/1e3,r=t.buffered,r=(r.length&&r.start(0),r.length?r.end(r.length-1):0);let e=t.currentTime;var s=r-e,i=Math.max(5,3+i),i=(i{this.player.debug.log("WebrtcDecoder","onsignalingstatechange",e)},t.oniceconnectionstatechange=e=>{this.player.debug.log("WebrtcDecoder","oniceconnectionstatechange",t.iceConnectionState)},t.onicecandidate=e=>{this.player.debug.log("WebrtcDecoder","onicecandidate",e)},t.ontrack=e=>{var t=i.video.$videoElement;"video"===e.track.kind&&(e=e.streams[0],t.srcObject=e,this.videoStream=e)},t.onconnectionstatechange=e=>{switch(i.debug.log("WebrtcDecoder","sdp connect status "+t.connectionState),t.connectionState){case"connected":break;case"disconnected":i.emit(v.webrtcDisconnect);break;case"failed":i.emit(v.webrtcFailed);break;case"closed":i.emit(v.webrtcClosed)}},this.rtcPeerConnection=t}loadSource(s){return new Promise((t,i)=>{const r=this.rtcPeerConnection;r.createOffer().then(e=>{r.setLocalDescription(e),this.player.debug.log("WebrtcDecoder","getWebRtcRemoteSdp loadSource"),e=e.sdp,fetch(s,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:e}).then(e=>{e.text().then(e=>{this.player.debug.log("WebrtcDecoder","getWebRtcRemoteSdp response"),r.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e})),t()}).catch(e=>{this.player.debug.error("WebrtcDecoder","loadSource response.text() error",e),i(e)})}).catch(e=>{this.player.debug.error("WebrtcDecoder","loadSource getWebRtcRemoteSdp response error",e),i(e)})}).catch(e=>{this.player.debug.error("WebrtcDecoder","loadSource rtcPeerConnection.createOffer() error",e),i(e)})})}}class zr extends t{constructor(e){super(),this.tagName="WebrtcForZLMDecoder",this.player=e,this.rtcPeerConnection=null,this.videoStream=null,this._initRtcPeerConnection(),this.player.debug.log(this.tagName,"init")}destroy(){this.rtcPeerConnection&&(this.rtcPeerConnection.close(),this.rtcPeerConnection=null),this.videoStream&&(this.videoStream.getTracks().forEach(e=>e.stop()),this.videoStream=null),this.videoStream=null,this.player.video.$videoElement.srcObject=null,this.player.debug.log(this.tagName,"destroy")}_initRtcPeerConnection(){const t=new RTCPeerConnection,i=this.player;t.addTransceiver("video",{direction:"recvonly"}),t.addTransceiver("audio",{direction:"recvonly"}),t.onsignalingstatechange=e=>{console.log("onsignalingstatechange",e)},t.oniceconnectionstatechange=e=>{console.log("oniceconnectionstatechange",t.iceConnectionState)},t.onicecandidate=e=>{console.log("onicecandidate",e)},t.ontrack=e=>{var t=i.video.$videoElement;console.log("ontrack",e),"video"===e.track.kind&&(e=e.streams[0],t.srcObject=e,this.videoStream=e)},this.rtcPeerConnection=t}loadSource(s){return new Promise((t,i)=>{const r=this.rtcPeerConnection;r.createOffer().then(e=>{r.setLocalDescription(e),this.player.debug.log(this.tagName,"getWebRtcRemoteSdp loadSource"),e=e.sdp,R({url:s,type:"POST",data:e,contentType:"text/plain;charset=utf-8",processData:!1,dataType:"json"}).then(e=>{this.player.debug.log(this.tagName,"getWebRtcRemoteSdp response");e=e.data;if(0!==e.code)return i(e.msg);r.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e.sdp})),t()}).catch(e=>{this.player.debug.error(this.tagName,"loadSource getWebRtcRemoteSdp response error",e),i(e)})}).catch(e=>{this.player.debug.error(this.tagName,"loadSource rtcPeerConnection.createOffer() error",e),i(e)})})}}class Kr extends t{constructor(e,t){super(),this.player=e,this._showPrecision=null,this._startTime=null,this._playStartTime=null,this._playingTimestamp=null,this._fps=parseInt(t.fps,10)||e._opt.playbackFps,this._isUseFpsRender=!0===t.isUseFpsRender,this._rate=1,this._audioTimestamp=0,this._videoTimestamp=0,this._currentLocalTimestamp=0,this._localOneFrameTimestamp=t.localOneFrameTimestamp||40,this._localCalculateTimeInterval=null,this._isUseLocalCalculateTime=!0===t.isUseLocalCalculateTime,this._isPlaybackPauseClearCache=!1!==t.isPlaybackPauseClearCache,this._isCacheBeforeDecodeForFpsRender=!0===t.isCacheBeforeDecodeForFpsRender,this._startfpsTime=null,this._startFpsTimestamp=null,this._checkStatsInterval=null,this._playbackTs=0,this._renderFps=0,this._isUseLocalCalculateTime?this._startLocalCalculateTime():this._listen(),this.playbackList=[],this._totalDuration=0,this.initPlaybackList(t.playList),this.player.on(v.playbackPause,e=>{e?this.pause():this.resume()}),e.debug.log("Playback","init",{fps:this._fps,isUseFpsRender:this._isUseFpsRender,localOneFrameTimestamp:this._localOneFrameTimestamp,isUseLocalCalculateTime:this._isUseLocalCalculateTime,uiUsePlaybackPause:t.uiUsePlaybackPause,showControl:t.showControl})}destroy(){this._startTime=null,this._showPrecision=null,this._playStartTime=null,this._playingTimestamp=null,this._totalDuration=0,this._audioTimestamp=0,this._videoTimestamp=0,this._fps=null,this._isUseFpsRender=!1,this._rate=1,this.playbackList=[],this._localCalculateTimeInterval=null,this._currentLocalTimestamp=0,this._startfpsTime=null,this._startFpsTimestamp=null,this._renderFps=0,this._playbackTs=0,this._stopLocalCalculateTime(),this.clearStatsInterval(),this.off(),this.player.debug.log("Playback","destroy")}_listen(){this.player.on(v.stats,e=>{e=e.ts,this._playStartTime||(this._playStartTime=e),e-=this._playStartTime;this.setPlayingTimestamp(e)})}pause(){this.clearStatsInterval()}resume(){this.startCheckStatsInterval()}updateStats(){var t=0{var e=this._currentLocalTimestamp,e=(this._playStartTime||(this._playStartTime=e),e-this._playStartTime);this.setPlayingTimestamp(e)},1e3)}startCheckStatsInterval(){this.clearStatsInterval(),this._checkStatsInterval=setInterval(()=>{this.updateStats()},1e3)}_stopLocalCalculateTime(){this._localCalculateTimeInterval&&(clearInterval(this._localCalculateTimeInterval),this._localCalculateTimeInterval=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}increaseLocalTimestamp(){this._isUseLocalCalculateTime&&(this._currentLocalTimestamp+=this._localOneFrameTimestamp)}initPlaybackList(e){this.playbackList=e||[];let i=0;this.playbackList.forEach((e,t)=>{10===ut(e.start)&&(e.startTimestamp=1e3*e.start,e.startTime=Ye(e.startTimestamp)),10===ut(e.end)&&(e.endTimestamp=1e3*e.end,e.endTime=Ye(e.endTimestamp)),e.duration=e.end-e.start,i+=e.duration}),this._totalDuration=i,this.player.debug.log("Playback",this.playbackList),0{if(e){this.player.$container.classList.add("jessibuca-zoom-control"),this._bindEvents();const e=this.player.video.$videoElement.style.transform;var t=this.player.video.$videoElement.style.left,i=this.player.video.$videoElement.style.top,t=parseFloat(t),i=parseFloat(i),t=(t&&(this.videoPosition.left=t),i&&(this.videoPosition.top=i),(this.prevVideoElementStyleTransform=e).match(/scale\([0-9., ]*\)/g));t&&t[0]&&(i=t[0].replace("scale(","").replace(")",""),this.prevVideoElementStyleScale=i.split(","))}else this.player.$container.classList.remove("jessibuca-zoom-control"),this._unbindEvents(),this._resetVideoPosition(),this.player.$container.style.cursor="auto",this.player.video.$videoElement.style.transform=this.prevVideoElementStyleTransform,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null}),t(window,"mouseup",e=>{this.handleMouseUp(e)}),e.debug.log("zoom","init")}destroy(){this.bindEvents=[],this.isDragging=!1,this.currentZoom=1,this.prevVideoElementStyleTransform=null,this.prevVideoElementStyleScale=null,this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.off(),this.player.debug.log("zoom","destroy")}_bindEvents(){var e=this.player["events"]["proxy"],t=e(this.player.$container,"mousemove",e=>{this.handleMouseMove(e)}),t=(this.bindEvents.push(t),e(this.player.$container,"mousedown",e=>{this.handleMouseDown(e)}));this.bindEvents.push(t)}_unbindEvents(){this.bindEvents.forEach(e=>{e&&e()})}handleMouseMove(e){var t,i,r;e.stopPropagation(),this.isDragging&&this.player.zooming&&({posX:e,posY:t}=ft(e),i=this.tempPosition.x-e,r=this.tempPosition.y-t,this.videoPosition.left=this.videoPosition.left-i,this.videoPosition.top=this.videoPosition.top-r,this.tempPosition.x=e,this.tempPosition.y=t,this.updateVideoPosition())}handleMouseDown(e){e.stopPropagation();const t=w(e);if(this.player.zooming&&(t.matches("video")||t.matches("canvas"))){const{posX:t,posY:i}=ft(e);this.player.$container.style.cursor="grabbing",this.tempPosition.x=t,this.tempPosition.y=i,this.isDragging=!0,this.player.debug.log("zoom","handleMouseDown is dragging true")}}handleMouseUp(e){e.stopPropagation(),this.isDragging&&this.player.zooming&&(this.tempPosition={x:0,y:0},this.isDragging=!1,this.player.$container.style.cursor="grab",this.player.debug.log("zoom","handleMouseUp is dragging false"))}updateVideoPosition(){var e=this.player.video.$videoElement;e.style.left=this.videoPosition.left+"px",e.style.top=this.videoPosition.top+"px"}_resetVideoPosition(){this.player.resize(),this.tempPosition={x:0,y:0},this.videoPosition={left:0,top:0},this.currentZoom=1}narrowPrecision(){this.currentZoom<=1||(--this.currentZoom,this.updateVideoElementScale())}expandPrecision(){5<=this.currentZoom||(this.currentZoom+=1,this.updateVideoElementScale())}updateVideoElementScale(){const e=this.player.video.$videoElement;let t=e.style.transform,i=1,r=1;if(this.prevVideoElementStyleScale){const e=this.prevVideoElementStyleScale[0],t=(void 0!==e&&(i=e,r=e),this.prevVideoElementStyleScale[1]);void 0!==t&&(r=t)}r=T(r);var s=.5*(i=T(i))*(this.currentZoom-1)+i,a=.5*r*(this.currentZoom-1)+r,n=-1===t.indexOf("scale(")?t+` scale(${s},${a})`:t.replace(/scale\([0-9., ]*\)/,`scale(${s},${a})`);this.player.debug.log("zoom",`updateVideoElementScale end is ${s}, ${a} style is `+n),e.style.transform=n}}class Jr extends t{constructor(e){super(),this.player=e,this.faceDetector=null,this.objectDetector=null,this.initFaceDetector(),this.initObjectDetector(),this.player.debug.log("AiLoader","init")}initFaceDetector(){if(this.player._opt.useFaceDetector&&window.JessibucaProFaceDetector){const e=new JessibucaProFaceDetector({detectWidth:this.player._opt.aiFaceDetectWidth});e.load().then(()=>{this.player.debug.log("AiLoader","init face detector success"),this.faceDetector=e})}}initObjectDetector(){if(this.player._opt.useObjectDetector&&window.JessibucaProObjectDetector){const e=new JessibucaProObjectDetector({detectWidth:this.player._opt.aiObjectDetectWidth});e.load().then(()=>{this.player.debug.log("AiLoader","init object detector success"),this.objectDetector=e,this.objectDetector.on("jessibuca-pro-object-detector-info",e=>{e&&0{this.addMenuItem(e)}),e(this.player.$container,"contextmenu",e=>{e.preventDefault(),this.show();var t=e.clientX,e=e.clientY,{height:i,width:r,left:s,top:a}=this.player.$container.getBoundingClientRect(),{height:n,width:o}=this.$contextmenus.getBoundingClientRect();let l=t-s,c=e-a;s+r{Mr(e,this.$contextmenus)||this.hide()}),this.player.on(v.blur,()=>{this.hide()})}_validateMenuItem(e){let t=!0;return e.content||(this.player.debug.warn(this.LOG_NAME,"content is required"),t=!1),t}addMenuItem(){let t=0 + ${t.content} + + `,(s=Array.from(this.$contextmenus.children)[t.index])?s.insertAdjacentHTML("beforebegin",r):_r(this.$contextmenus,r),s=this.$contextmenus.querySelector(".jessibuca-contextmenu-"+i),t.click&&a(s,"click",e=>{e.preventDefault(),t.click.call(this.player,this,e),this.hide()}),this.menuList.push({uuid:i,$menuItem:s}))}}class Xr extends t{constructor(e,t){super(),this.$container=e;var i,e=St(),r=(this._opt=Object.assign({},e,t),this.debug=new Ne(this),this._opt.forceNoOffscreen=!0,S()&&(this._opt.controlAutoHide=!1),this._opt.forceNoOffscreen||("undefined"==typeof OffscreenCanvas?(this._opt.forceNoOffscreen=!0,this._opt.useOffscreen=!1):this._opt.useOffscreen=!0),(this._opt.isHls||this._opt.isWebrtc)&&(this._opt.useWCS=!1,this._opt.useMSE=!1,this._opt.isNakedFlow=!1),this._opt.isNakedFlow,this._opt.isHls||this._opt.isWebrtc||(this._opt.useWCS&&(this._opt.useWCS="VideoEncoder"in window,this._opt.useWCS||this.debug.warn("Player","useWCS is true, but not support so set useWCS false"),this._opt.useWCS)&&(this._opt.useOffscreen?this._opt.wcsUseVideoRender=!1:this._opt.wcsUseVideoRender&&(this._opt.wcsUseVideoRender=tt())),this._opt.useMSE&&(this._opt.useMSE=window.MediaSource&&window.MediaSource.isTypeSupported(ge),this._opt.useMSE||this.debug.warn("Player","useMSE is true, but not support so set useMSE false"))),this._opt.useMSE?(this._opt.useWCS&&this.debug.warn("Player","useMSE is true and useWCS is true then useWCS set true->false"),this._opt.forceNoOffscreen||this.debug.warn("Player","useMSE is true and forceNoOffscreen is false then forceNoOffscreen set false->true"),this._opt.useWCS=!1,this._opt.forceNoOffscreen=!0):this._opt.useWCS,!this._opt.useSIMD&&-1===this._opt.decoder.indexOf("-simd")||(this._opt.useSIMD=WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),this._opt.useSIMD)||this.debug.warn("Player","useSIMD is true, but not support so set useSIMD false"),this._opt.useSIMD?-1===this._opt.decoder.indexOf("-simd")&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro","decoder-pro-simd")):-1!==this._opt.decoder.indexOf("-simd")&&(this._opt.decoder=this._opt.decoder.replace("decoder-pro-simd","decoder-pro")),this._opt.hasAudio||(this._opt.operateBtns.audio=!1),this._opt.hasVideo||(this._opt.operateBtns.fullscreen=!1,this._opt.operateBtns.screenshot=!1,this._opt.operateBtns.record=!1,this._opt.operateBtns.ptz=!1,this._opt.operateBtns.quality=!1,this._opt.operateBtns.zoom=!1),this._opt.qualityConfig&&0===this._opt.qualityConfig.length&&this._opt.operateBtns.quality&&(this._opt.operateBtns.quality=!1,this.debug.warn("Player","_opt.qualityConfig is empty, so set operateBtns.quality false")),this._opt.hasControl=this._hasControl(),this._loading=!1,this._playing=!1,this._playbackPause=!1,this._hasLoaded=!1,this._zooming=!1,this._destroyed=!1,this._checkHeartTimeout=null,this._checkLoadingTimeout=null,this._checkStatsInterval=null,this._checkVisibleHiddenTimeout=null,this._startBpsTime=null,this._isPlayingBeforePageHidden=!1,this._stats={buf:0,netBuf:0,fps:0,maxFps:0,dfps:0,abps:0,vbps:0,ts:0,mseTs:0,pTs:0,dts:0},this._allStatsData={},this._faceDetectActive=!1,this._objectDetectActive=!1,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this._videoTimestamp=0,this._audioTimestamp=0,this._videoIframeIntervalTs=0,this._streamQuality=this._opt.defaultStreamQuality||"",this._visibility=!0,this._lastestVisibilityChangeTimestamp=null,this._tempWorkerStats=null,this._isPlayback()&&(this._opt.useMSE=!1,this._opt.useWCS=!1),!1!==this._opt.useMSE||!1!==this._opt.useWCS||this._opt.isWebrtc||this._opt.isHls||(this._opt.useWasm=!0),(this._opt.isHls||this._opt.isWebrtc)&&(this._opt.hasVideo=!0,this._opt.hasAudio=!0),this._opt.hasVideo||(this._opt.useMSE=!1,this._opt.useWCS=!1),this._opt.useWasm&&(this._opt.useOffscreen?this._opt.wasmUseVideoRender=!1:this._opt.wasmUseVideoRender&&(this._opt.wasmUseVideoRender=Ze()&&tt(),this._opt.wasmUseVideoRender||this.debug.warn("Player","use wasm video render, but not support so set wasmUseVideoRender false")),this._opt.useSIMD?this.debug.log("Player","use simd wasm"):this.debug.log("Player","use wasm")),this._opt.useWasm&&(this._opt.useFaceDetector&&window.JessibucaProFaceDetector||this._opt.useObjectDetector&&window.JessibucaProObjectDetector)?(this.ai=new Jr(this),this._opt.useFaceDetector&&window.JessibucaProFaceDetector||(this._opt.operateBtns.aiFace=!1),this._opt.useObjectDetector&&window.JessibucaProObjectDetector||(this._opt.operateBtns.aiObject=!1)):(this._opt.operateBtns.aiObject=!1,this._opt.operateBtns.aiFace=!1),!this._opt.useFaceDetector||this._opt.useWasm&&window.JessibucaProFaceDetector||this.debug.warn("Player",`use face detector, useWasm is ${this._opt.useWasm} and window.JessibucaProFaceDetector is `+!!window.JessibucaProFaceDetector),!this._opt.useObjectDetector||this._opt.useWasm&&window.JessibucaProObjectDetector||this.debug.warn("Player",`use object detector, useWasm is ${this._opt.useWasm} and window.JessibucaProObjectDetector is `+!!window.JessibucaProObjectDetector),this._opt.useVideoRender&&(this._opt.useWasm&&!this._opt.useOffscreen?(this._opt.wasmUseVideoRender=Ze(),this._opt.wasmUseVideoRender||this.debug.warn("Player","use wasm video render, but not support so set wasmUseVideoRender false")):this._opt.useWCS&&!this._opt.useOffscreen&&(this._opt.wcsUseVideoRender=tt(),this._opt.wcsUseVideoRender||this.debug.warn("Player","use wcs video render, but not support so set wcsUseVideoRender false"))),this._opt.useCanvasRender&&(this._opt.useMSE&&(this._opt.mseUseCanvasRender=!0),this._opt.useWasm&&(this._opt.wasmUseVideoRender=!1),this._opt.useWCS&&(this._opt.wcsUseVideoRender=!1),this._opt.isHls)&&!Xe()&&(this._opt.hlsUseCanvasRender=!0),this._opt.useVideoRender=!1,this._opt.useCanvasRender=!1,this._opt.useWasm?this._opt.wasmUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useWCS?this._opt.wcsUseVideoRender?this._opt.useVideoRender=!0:this._opt.useCanvasRender=!0:this._opt.useMSE?this._opt.mseUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this._opt.isHls?this._opt.hlsUseCanvasRender?this._opt.useCanvasRender=!0:this._opt.useVideoRender=!0:this._opt.isWebrtc&&(this._opt.useVideoRender=!0),i=this,Object.defineProperty(i,"rect",{get:()=>{var e=i.$container.getBoundingClientRect();return e.width=Math.max(e.width,i.$container.clientWidth),e.height=Math.max(e.height,i.$container.clientHeight),e}}),["bottom","height","left","right","top","width"].forEach(e=>{Object.defineProperty(i,e,{get:()=>i.rect[e]})}),this.events=new Ve(this),this._opt.hasVideo&&(this.video=new Ut(this),this.recorder=new Ei(this)),this._opt.isHls?(this.hlsDecoder=new Wr(this),this.loaded=!0):this._opt.isWebrtc?(this._opt.isWebrtcForZLM?this.webrtc=new zr(this):this.webrtc=new Gr(this),this.loaded=!0):At(this._opt)?this.loaded=!0:this.decoderWorker=new Si(this),this._opt.hasAudio&&(this.audio=new ei(this)),this.stream=null,this.demux=null,this._lastVolume=null,this._isInZoom=!1,this._playingStartTimestamp=null,this._opt.useWCS&&(this.webcodecsDecoder=new Lr(this),this._opt.hasAudio||(this.loaded=!0)),this._opt.useMSE&&(this.mseDecoder=new jr(this),this._opt.hasAudio||(this.loaded=!0)),this.control=new Ur(this),0{w(e)===r.$container&&(r.emit(ie.fullscreen,r.fullscreen),!r.fullscreen||r._opt.useMSE)&&r.resize()};f.on("change",a),r.events.destroys.push(()=>{f.off("change",a)})}catch(r){}if(r.on(v.decoderWorkerInit,()=>{r.debug.log("player","listen decoderWorkerInit and set loaded true"),r.loaded=!0}),r.on(v.play,()=>{r.loading=!1}),r.on(v.fullscreen,e=>{if(e)try{f.request(r.$container).then(()=>{}).catch(e=>{r.debug.error("player","fullscreen request error",e),S()&&r._opt.useWebFullScreen&&(r.webFullscreen=!0)})}catch(e){S()&&r._opt.useWebFullScreen&&(r.webFullscreen=!0)}else try{f.exit().then(()=>{r.webFullscreen&&(r.webFullscreen=!1)}).catch(e=>{r.debug.error("player","fullscreen exit error",e),r.webFullscreen&&(r.webFullscreen=!1)})}catch(e){r.webFullscreen&&(r.webFullscreen=!1)}}),S()&&r.on(v.webFullscreen,e=>{e?r.$container.classList.add("jessibuca-fullscreen-web"):r.$container.classList.remove("jessibuca-fullscreen-web"),r.emit(ie.fullscreen,r.fullscreen)}),r.on(v.resize,()=>{r.video&&r.video.resize()}),r._opt.debug){const n=[v.timeUpdate];Object.keys(v).forEach(t=>{r.on(v[t],e=>{n.includes(t)||r.debug.log("player events",v[t],e)})}),Object.keys(A).forEach(t=>{r.on(A[t],e=>{r.debug.log("player event error",A[t],e)})})}{var s=this;const{_opt:o,debug:l,events:{proxy:c}}=s;if(o.supportDblclickFullscreen&&c(s.$container,"dblclick",e=>{e=w(e).nodeName.toLowerCase();"canvas"!==e&&"video"!==e||(s.fullscreen=!s.fullscreen)}),c(document,"visibilitychange",()=>{s.visibility="visible"===document.visibilityState,l.log("visibilitychange",document.visibilityState),o.hiddenAutoPause&&(l.log("visibilitychange","hiddenAutoPause is true ",document.visibilityState,s._isPlayingBeforePageHidden),"visible"===document.visibilityState?s._isPlayingBeforePageHidden&&s.play():(s._isPlayingBeforePageHidden=s.playing,s.playing&&s.pause()))}),c(window,"fullscreenchange",()=>{null!==s.keepScreenOn&&"visible"===document.visibilityState&&s.enableWakeLock()}),c(document,["click","contextmenu"],e=>{Mr(e,s.$container)?(s.isInput="INPUT"===e.target.tagName,s.isFocus=!0,s.emit(v.focus)):(s.isInput=!1,s.isFocus=!1,s.emit(v.blur))}),o.autoResize){const o=et(()=>{s.resize()},500);c(window,["resize","orientationchange"],()=>{o()}),screen&&screen.orientation&&screen.orientation.onchange&&c(screen.orientation,"change",()=>{o()})}}if(dt(this._opt.watermarkConfig)){const e=Object.assign(this._opt.watermarkConfig,{container:this.$container});this._removeWatermarkFn=function(){var t=st(e);const i=t.container;if(i){var r=null;const n=document.createElement("div");n.setAttribute("style","pointer-events: none !important; display: block !important");var r="function"==typeof n.attachShadow?n.attachShadow({mode:"open"}):n.shadowRoot||n,s=i.children,a=Math.floor(Math.random()*(s.length-1)),s=(s[a]?i.insertBefore(n,s[a]):i.appendChild(n),document.createElement("div"));let e=null;return t.image&&t.image.src?((e=document.createElement("img")).style.height="100%",e.style.width="100%",e.style.objectFit="contain",e.src=t.image.src):t.text&&t.text.content&&(e=document.createTextNode(t.text.content)),e?(s.appendChild(e),s.style.visibility="",s.style.position="absolute",s.style.display="block",s.style["-ms-user-select"]="none",s.style["-moz-user-select"]="none",s.style["-webkit-user-select"]="none",s.style["-o-user-select"]="none",s.style["user-select"]="none",s.style["-webkit-touch-callout"]="none",s.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)",s.style["-webkit-text-size-adjust"]="none",s.style["-webkit-touch-callout"]="none",s.style.opacity=t.opacity,u(t.left)&&(s.style.left=t.left+"px"),u(t.right)&&(s.style.right=t.right+"px"),u(t.top)&&(s.style.top=t.top+"px"),u(t.bottom)&&(s.style.bottom=t.bottom+"px"),s.style.overflow="hidden",s.style.zIndex="9999999",t.image&&t.image.src?(s.style.width=t.image.width+"px",s.style.height=t.image.height+"px"):t.text&&t.text.content&&(s.style.fontSize=t.text.fontSize+"px",s.style.color=t.text.color),r.appendChild(s),()=>{i.removeChild(n)}):void 0}}()}this._opt.useWCS&&this.debug.log("Player","use WCS"),this._opt.useMSE&&this.debug.log("Player","use MSE"),this._opt.useOffscreen&&this.debug.log("Player","use offscreen"),this._opt.isHls&&this.debug.log("Player","use hls"),this._opt.isWebrtc&&this.debug.log("Player","use webrtc"),this._isPlayback()&&this.debug.log("Player","use playback"),this._opt.hasVideo&&(0===this.width&&this.debug.error("Player","container width is 0, please check the container width"),0===this.height)&&this.debug.error("Player","container height is 0, please check the container height"),this.debug.log("Player options",this._opt)}destroy(){this._destroyed=!0,this.emit("destroy"),this.off(),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.clearVisibilityHiddenTimeout(),this._loading=!1,this._playing=!1,this._playbackPause=!1,this._hasLoaded=!1,this._lastVolume=null,this._zooming=!1,this._faceDetectActive=!1,this._objectDetectActive=!1,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},this._opt=St(),this.decoderWorker&&(this.decoderWorker.destroy(),this.decoderWorker=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.video&&(this.video.destroy(),this.video=null),this.audio&&(this.audio.destroy(),this.audio=null),this.stream&&(this.stream.destroy(),this.stream=null),this.recorder&&(this.recorder.destroy(),this.recorder=null),this.control&&(this.control.destroy(),this.control=null),this.webcodecsDecoder&&(this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.demux&&(this.demux.destroy(),this.demux=null),this.hlsDecoder&&(this.hlsDecoder.destroy(),this.hlsDecoder=null),this.events&&(this.events.destroy(),this.events=null),this.playback&&(this.playback.destroy(),this.playback=null),this.zoom&&(this.zoom.destroy(),this.zoom=null),this.ai&&(this.ai.destroy(),this.ai=null),this.releaseWakeLock(),this.keepScreenOn=null,this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._streamQuality="",this._visibility=!0,this._isInZoom=!1,this._playingStartTimestamp=null,this._lastestVisibilityChangeTimestamp=null,this._videoIframeIntervalTs=null,this._tempWorkerStats=null,this._removeWatermarkFn&&(this._removeWatermarkFn(),this._removeWatermarkFn=null),this.$container=null,this.debug.log("play","destroy end")}set fullscreen(e){S()&&this._opt.useWebFullScreen?(this.emit(v.webFullscreen,e),setTimeout(()=>{this.updateOption({rotate:e?270:0}),this.resize()},10)):this.emit(v.fullscreen,e)}get fullscreen(){return f.isFullscreen||this.webFullscreen}set webFullscreen(e){this.emit(v.webFullscreen,e)}get webFullscreen(){return this.$container.classList.contains("jessibuca-fullscreen-web")}set loaded(e){this._hasLoaded=e}get loaded(){return this._hasLoaded||this._opt.isHls||this._opt.isWebrtc||this._opt.useMSE&&!this._opt.hasAudio||this._opt.useWCS&&!this._opt.hasAudio}set playing(e){e&&(this.loading=!1),this.playing!==e&&(this._playing=e,this.emit(v.playing,e),this.emit(v.volumechange,this.volume),e?this.emit(v.play):this.emit(v.pause))}get playing(){return this._playing}get volume(){return this.audio&&this.audio.volume||0}set volume(e){e!==this.volume&&(this.audio?(this.audio.setVolume(e),this._lastVolume=this.volume):this.debug.error("Player","set volume error, audio is null"))}get lastVolume(){return this._lastVolume}set loading(e){this.loading!==e&&(this._loading=e,this.emit(v.loading,this._loading))}get loading(){return this._loading}set zooming(e){this.zooming!==e&&(this.zoom||(this.zoom=new qr(this)),this._zooming=e,this.emit(v.zooming,this.zooming))}get zooming(){return this._zooming}set recording(e){e?this.playing&&!this.recording&&(this.recorder&&this.recorder.startRecord(),this._opt.useWasm)&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!0}):this.recording&&(this._opt.useWasm&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!1}),this.recorder)&&this.recorder.stopRecordAndSave().then(()=>{}).catch(e=>{})}get recording(){return!!this.recorder&&this.recorder.isRecording}set audioTimestamp(e){null!==e&&(this._audioTimestamp=e)}get audioTimestamp(){return this._audioTimestamp}set videoTimestamp(e){null!==e&&(this._videoTimestamp=e,this._opt.useWCS||this._opt.useMSE||this.audioTimestamp&&this.videoTimestamp&&this.audio&&this.audio.emit(v.videoSyncAudio,{audioTimestamp:this.audioTimestamp,videoTimestamp:this.videoTimestamp,diff:this.audioTimestamp-this.videoTimestamp}))}set streamQuality(e){this.streamQuality!==e&&(this._streamQuality=e,this.emit(v.streamQualityChange,e))}get streamQuality(){return this._streamQuality}get videoTimestamp(){return this._videoTimestamp}get isDebug(){return!0===this._opt.debug}get scaleType(){var e=this._opt,t=e.isResize,e=e.isFullResize;let i=0;return!1===e&&!1===t?i=0:!1===e&&!0===t?i=1:!0===e&&!0===t&&(i=2),i}set visibility(e){this._visibility!==e&&(this._visibility=e,this.emit(v.visibilityChange,e),this._lastestVisibilityChangeTimestamp=m(),e?this.clearVisibilityHiddenTimeout():this.startVisibilityHiddenTimeout())}get visibility(){return this._visibility}set playbackPause(e){this._playbackPause!==e&&(this._playbackPause=e,this.emit(v.playbackPause,e),this.emit(v.playbackPauseOrResume,e))}get playbackPause(){return this._playbackPause}set videoIframeIntervalTs(e){this._videoIframeIntervalTs=e}get videoIframeIntervalTs(){return this._videoIframeIntervalTs}set faceDetectActive(e){this._faceDetectActive!==e&&(this._faceDetectActive=e,this.emit(v.faceDetectActive,e))}get faceDetectActive(){return this._faceDetectActive}set objectDetectActive(e){this._objectDetectActive!==e&&(this._objectDetectActive=e,this.emit(v.objectDetectActive,e))}get objectDetectActive(){return this._objectDetectActive}get isUseWorkerDemuxAndDecode(){return this.stream&&this.stream.getStreamType()===U}isDestroyed(){return this._destroyed}updateOption(e){this._opt=Object.assign({},this._opt,e)}init(){return new Promise((e,t)=>{this.video||this._opt.hasVideo&&(this.video=new Ut(this)),this.audio||this._opt.hasAudio&&(this.audio=new ei(this)),this.stream||(this.stream=new oi(this)),this._opt.isHls?(this.hlsDecoder||(this.hlsDecoder=new Wr(this),this.loaded=!0),e()):this._opt.isWebrtc?(this.webrtc||(this._opt.isWebrtcForZLM?this.webrtc=new zr(this):this.webrtc=new Gr(this),this.loaded=!0),e()):(this.demux||this._opt.hasVideo&&!this.isUseWorkerDemuxAndDecode&&(this.demux=new Dr(this)),this._opt.useWCS&&!this.webcodecsDecoder&&(this.webcodecsDecoder=new Lr(this)),this._opt.useMSE&&!this.mseDecoder&&(this.mseDecoder=new jr(this)),this.decoderWorker?this.loaded?e():this.once(v.decoderWorkerInit,()=>{e()}):At(this._opt)?e():(this.decoderWorker=new Si(this),this.once(v.decoderWorkerInit,()=>{e()})))})}play(i,r){return new Promise((e,t)=>{if(!i&&!this._opt.url)return t("url is empty");this.loading=!0,this.playing=!1,this._times.playInitStart=m(),i=i||this._opt.url,this._opt.url=i,this.clearCheckHeartTimeout(),this.init().then(()=>{this._times.playStart=m(),this._opt.isNotMute&&this.mute(!1),this.webcodecsDecoder&&this.webcodecsDecoder.once(A.webcodecsH265NotSupport,()=>{this.emit(A.webcodecsH265NotSupport),this._opt.autoWasm||this.emit(v.error,A.webcodecsH265NotSupport)}),this.mseDecoder&&(this.mseDecoder.once(A.mediaSourceH265NotSupport,()=>{this.emit(A.mediaSourceH265NotSupport),this._opt.autoWasm||this.emit(v.error,A.mediaSourceH265NotSupport)}),this.mseDecoder.once(A.mediaSourceFull,()=>{this.emit(A.mediaSourceFull)}),this.mseDecoder.once(A.mediaSourceAppendBufferError,()=>{this.emit(A.mediaSourceAppendBufferError)}),this.mseDecoder.once(A.mediaSourceBufferListLarge,()=>{this.emit(A.mediaSourceBufferListLarge)}),this.mseDecoder.once(A.mediaSourceAppendBufferEndTimeout,()=>{this.emit(A.mediaSourceAppendBufferEndTimeout)}),this.mseDecoder.once(A.mediaSourceDecoderConfigurationError,()=>{this.emit(A.mediaSourceDecoderConfigurationError)})),this.enableWakeLock(),this.checkLoadingTimeout(),this.stream?(this.stream.once(A.fetchError,e=>{this.emit(A.fetchError,e),t(e)}),this.stream.once(A.websocketError,e=>{this.emit(A.websocketError,e),t(e)}),this.stream.once(v.streamEnd,()=>{t("stream end")}),this.stream.once(A.hlsError,e=>{t(e)}),this.stream.once(A.webrtcError,e=>{t(e)}),this.stream.once(v.streamSuccess,()=>{e(),this._times.streamResponse=m(),this.video&&this.video.play(),this.checkStatsInterval(),this.isPlayback()&&this.playback&&this.playback.startCheckStatsInterval()}),this.stream.fetchStream(i,r)):this.debug.warn("player","play() this.stream is null")}).catch(e=>{t(e)})})}close(){return new Promise((e,t)=>{this._close().then(()=>{this.video&&this.video.clearView(),e()}).catch(e=>{t(e)})})}resumeAudioAfterPause(){this.lastVolume&&(this.volume=this.lastVolume)}_close(){return new Promise((e,t)=>{this.stream&&(this.stream.destroy(),this.stream=null),this.demux&&(this.demux.destroy(),this.demux=null),this.decoderWorker&&(this.decoderWorker.destroy(),this.decoderWorker=null),this.webcodecsDecoder&&(this.webcodecsDecoder.destroy(),this.webcodecsDecoder=null),this.mseDecoder&&(this.mseDecoder.destroy(),this.mseDecoder=null),this.hlsDecoder&&(this.hlsDecoder.destroy(),this.hlsDecoder=null),this.webrtc&&(this.webrtc.destroy(),this.webrtc=null),this.audio&&(this.audio.destroy(),this.audio=null),this.clearCheckHeartTimeout(),this.clearCheckLoadingTimeout(),this.clearStatsInterval(),this.isPlayback()&&this.playback&&this.playback.clearStatsInterval(),this.loading=!1,this.recording=!1,this.zooming=!1,this.playing=!1,this.video&&(this.video.resetInit(),this.video.pause(!0)),this.releaseWakeLock(),this.resetStats(),this._audioTimestamp=0,this._videoTimestamp=0,this._times={playInitStart:"",playStart:"",streamStart:"",streamResponse:"",demuxStart:"",decodeStart:"",videoStart:"",playTimestamp:"",streamTimestamp:"",streamResponseTimestamp:"",demuxTimestamp:"",decodeTimestamp:"",videoTimestamp:"",allTimestamp:""},setTimeout(()=>{e()},0)})}pause(){let i=0{i?this.close().then(()=>{e()}).catch(e=>{t(e)}):this._close().then(()=>{e()}).catch(e=>{t(e)})})}isAudioMute(){let e=!0;return e=this.audio?this.audio.isMute:e}isAudioNotMute(){return!this.isAudioMute()}mute(e){this.audio&&this.audio.mute(e)}resize(){this.video&&this.video.resize()}startRecord(e,t){this.recording||(this.recorder.setFileName(e,t),this.recording=!0)}stopRecordAndSave(e,r){return new Promise((t,i)=>{this.recorder||i("recorder is null"),this.recording?(this._opt.useWasm&&this.decoderWorker.updateWorkConfig({key:"isRecording",value:!0}),this.recorder.stopRecordAndSave(e,r).then(e=>{t(e)}).catch(e=>{i(e)})):i("recorder is not recording")})}_hasControl(){let e=!1,t=!1;return Object.keys(this._opt.operateBtns).forEach(e=>{this._opt.operateBtns[e]&&-1===(""+e).indexOf("Fn")&&(t=!0)}),(this._opt.showBandwidth||t)&&(e=!0),e=this._isPlayback()&&this._opt.playbackConfig.showControl?!0:e}_isPlayback(){return this._opt.playType===y}useWasmDecode(){return!1===this._opt.useMSE&&!1===this._opt.useWCS}canVideoTrackWritter(){var e=this._opt;return!e.isHls&&!e.isWebrtc&&!e.useMSE&&(e.useWCS&&!e.useOffscreen&&e.wcsUseVideoRender||this.useWasmDecode())}checkHeart(){this.clearCheckHeartTimeout(),this.checkHeartTimeout()}checkHeartTimeout(){this._checkHeartTimeout=setTimeout(()=>{!1===this.playbackPause&&this.playing?0!==this._stats.fps?this.debug.warn("player","checkHeartTimeout but fps is "+this._stats.fps):this.isDestroyed()?this.debug&&this.debug.warn("player","checkHeartTimeout but player is destroyed"):(this.debug.warn("player","checkHeartTimeout and pause and emit delayTimeout event"),this.pause(!1).then(()=>{this.emit(v.timeout,v.delayTimeout),this.emit(v.delayTimeout)})):this.debug.warn("player",`playbackPause is ${this.playbackPause}, playing is `+this.playing)},1e3*this._opt.heartTimeout)}checkStatsInterval(){this._checkStatsInterval=setInterval(()=>{this.updateStats()},1e3)}clearCheckHeartTimeout(){this._checkHeartTimeout&&(clearTimeout(this._checkHeartTimeout),this._checkHeartTimeout=null)}checkLoadingTimeout(){this._checkLoadingTimeout=setTimeout(()=>{this.playing?this.debug.warn("player",`checkLoadingTimeout but loading is ${this.loading} and playing is `+this.playing):this.isDestroyed()?this.debug&&this.debug.warn("player","checkLoadingTimeout but player is destroyed"):(this.debug.warn("player","checkLoadingTimeout and pause and emit loadingTimeout event"),this.pause(!1).then(()=>{this.emit(v.timeout,v.loadingTimeout),this.emit(v.loadingTimeout)}))},1e3*this._opt.loadingTimeout)}clearCheckLoadingTimeout(){this._checkLoadingTimeout&&(this.debug.log("player","clearCheckLoadingTimeout"),clearTimeout(this._checkLoadingTimeout),this._checkLoadingTimeout=null)}clearStatsInterval(){this._checkStatsInterval&&(clearInterval(this._checkStatsInterval),this._checkStatsInterval=null)}handleRender(){this.isDestroyed()?this.debug&&this.debug.warn("player","handleRender but player is destroyed"):(this.loading&&(this.clearCheckLoadingTimeout(),this.emit(v.start),this.loading=!1),this.playing||(this.playing=!0),this.checkHeart())}updateStats(h){h=h||{},this._startBpsTime||(this._startBpsTime=m()),c(h.ts)&&(this._stats.ts=h.ts,null===this._playingStartTimestamp)&&0this._stats.maxFps&&(this._stats.maxFps=this._stats.fps),this._allStatsData=Object.assign(this._stats,{audioBuffer:c,audioTs:this.audioTimestamp,playbackVideoBuffer:u,playbackVideoWaitingBuffer:0,playbackAudioWaitingBuffer:0,playbackCacheDataDuration:d,demuxBuffer:s,pushLatestDelay:l,audioDemuxBuffer:a,flvBuffer:r,mseDelay:e,mseDecodeDiffTimes:t,mseDecodePlaybackRate:i,wcsDecodeDiffTimes:t,hlsDelay:e,hlsDecodePlaybackRate:i,delayTs:h,totalDelayTs:f,isDropping:n,isStreamTsMoreThanLocal:o}),this.emit(v.stats,this._allStatsData),1048576{this.emit(v.visibilityHiddenTimeout)},1e3*this._opt.pageVisibilityHiddenTimeout))}clearVisibilityHiddenTimeout(){this._checkVisibleHiddenTimeout&&(clearTimeout(this._checkVisibleHiddenTimeout),this._checkVisibleHiddenTimeout=null)}faceDetect(e){this.faceDetectActive=e}objectDetect(e){this.objectDetectActive=e}downloadNakedFlowFile(){this.demux&&this.demux.downloadNakedFlowFile&&this.demux.downloadNakedFlowFile()}hasCacheOnGopBuffer(){var e=this.videoIframeIntervalTs,t=this._allStatsData.demuxBuffer,i=this._allStatsData.maxFps;let r=e&&t&&i?e<1e3/i*t:!1;return r}addContentToCanvas(){var e=0e,this.ratioWeight=1):(this.fromSampleRate{let t,i,r,s,a,n,o,l,c,u=e.length,d=this.channels;if(u%d!=0)throw new Error("Buffer was of incorrect sample length.");if(u<=0)return[];for(t=this.outputBufferSize,i=this.ratioWeight,r=this.lastWeight,s=0,a=0,n=0,o=0,l=this.outputBuffer;r<1;r+=i)for(a=r%1,s=1-a,this.lastWeight=r%1,c=0;c{let t,i,r,s,a,n,o,l,c,u,d,h=e.length,p=this.channels;if(h%p!=0)throw new Error("Buffer was of incorrect sample length.");if(h<=0)return[];for(t=this.outputBufferSize,i=[],r=this.ratioWeight,s=0,n=0,l=!this.tailExists,this.tailExists=!1,c=this.outputBuffer,u=0,d=0,a=0;a=o)){for(a=0;a{e.stop()}),this.userMediaStream=null),this.mediaStreamSource&&(this.mediaStreamSource.disconnect(),this.mediaStreamSource=null),this.recorder&&(this.recorder.disconnect(),this.recorder.onaudioprocess=null),this.biquadFilter&&(this.biquadFilter.disconnect(),this.biquadFilter=null),this.gainNode&&(this.gainNode.disconnect(),this.gainNode=null),this.workletRecorder&&(this.workletRecorder.disconnect(),this.workletRecorder=null),this.socket&&(this.socketStatus===ae&&this._sendClose(),this.socket.close(),this.socket=null),this._stopHeartInterval(),this._stopCheckGetUserMediaTimeout(),this.audioContext=null,this.gainNode=null,this.recorder=null,this.audioBufferList=[],this.sequenceId=0,this.wsUrl=null,this.tempTimestamp=null,this.tempRtpBufferList=[],this.startTimestamp=0,this.log("talk","destroy")}addRtpToBuffer(e){var t=e.length+this.tempRtpBufferList.length,t=new Uint8Array(t);t.set(this.tempRtpBufferList,0),t.set(e,this.tempRtpBufferList.length),this.tempRtpBufferList=t}downloadRtpFile(){var e=new Blob([this.tempRtpBufferList]);try{var t=document.createElement("a");t.href=window.URL.createObjectURL(e),t.download=Date.now()+".rtp",t.click()}catch(e){console.error("downloadRtpFile",e)}}calcAudioBufferLength(){var e=this._opt["sampleRate"];return 8*e*.02/8}get socketStatusOpen(){return this.socketStatus===ae}log(){for(var e=arguments.length,t=new Array(e),i=0;i{var i=this.events.proxy;this.socket=new WebSocket(this.wsUrl),this.socket.binaryType="arraybuffer",this.emit(v.talkStreamStart),i(this.socket,"open",()=>{this.socketStatus=ae,this.log(this.tag,"websocket open -> do talk"),this.emit(v.talkStreamOpen),e(),this._doTalk()}),i(this.socket,"message",e=>{this.log(this.tag,"websocket message",e.data)}),i(this.socket,"close",e=>{this.socketStatus="close",this.log(this.tag,"websocket close"),this.emit(v.talkStreamClose),t(e)}),i(this.socket,"error",e=>{this.socketStatus="error",this.error(this.tag,"websocket error",e),this.emit(v.talkStreamError,e),t(e)})})}_sendClose(){}_initTalk(){this._initMethods(),this._opt.engine===Pe?this._initWorklet():"script"===this._opt.engine&&this._initScriptProcessor(),this.log(this.tag,"audioContext samplerate",this.audioContext.sampleRate)}_initMethods(){this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:48e3}),this.gainNode=this.audioContext.createGain(),this.gainNode.gain.value=1,this.biquadFilter=this.audioContext.createBiquadFilter(),this.biquadFilter.type="lowpass",this.biquadFilter.frequency.value=3e3,this.resampler=new Yr({fromSampleRate:this.audioContext.sampleRate,toSampleRate:this._opt.sampleRate,channels:this._opt.numberChannels,inputBufferSize:this.bufferSize})}_initScriptProcessor(){var e=this.audioContext.createScriptProcessor||this.audioContext.createJavaScriptNode;this.recorder=e.apply(this.audioContext,[this.bufferSize,this._opt.numberChannels,this._opt.numberChannels]),this.recorder.onaudioprocess=e=>this._onaudioprocess(e)}_initWorklet(){this.audioContext.audioWorklet.addModule(mt(function(){class e extends AudioWorkletProcessor{constructor(e){super(),this._cursor=0,this._bufferSize=e.processorOptions.bufferSize,this._buffer=new Float32Array(this._bufferSize)}process(t,e,i){if(t.length&&t[0].length)for(let e=0;e{var e=new AudioWorkletNode(this.audioContext,"talk-processor",{processorOptions:{bufferSize:this.bufferSize}});e.connect(this.gainNode),e.port.onmessage=e=>{"data"===e.data.eventType&&this._encodeAudioData(e.data.buffer)},this.workletRecorder=e})}_onaudioprocess(e){e=e.inputBuffer.getChannelData(0);this._encodeAudioData(new Float32Array(e))}_encodeAudioData(e){if(0===e[0]&&0===e[1])this.log(this.tag,"empty audio data");else{const r=this.resampler.resample(e);let t=r;if(16===this._opt.sampleBitsWidth?t=function(e){let t=e.length,i=new Int16Array(t);for(;t--;){var r=Math.max(-1,Math.min(1,e[t]));i[t]=r<0?32768*r:32767*r}return i}(r):8===this._opt.sampleBitsWidth&&(t=function(e){let t=e.length,i=new Int8Array(t);for(;t--;){var r=Math.max(-1,Math.min(1,e[t]));i[t]=parseInt(255/(65535/(32768+(r<0?32768*r:32767*r))),10)}return i}(r)),null!==t.buffer){let e=null;this._opt.encType===ke?e=function(e){const i=[];return Array.prototype.slice.call(e).forEach((e,t)=>{i[t]=function(e){let t,i,r;return 0<=e?t=213:(t=85,(e=-e-1)<0&&(e=32767)),8<=(i=$r(e,Zr,8))?127^t:(r=i<<4,(r|=i<2?e>>4&15:e>>i+3&15)^t)}(e)}),i}(t):this._opt.encType===Ce&&(e=function(e){const i=[];return Array.prototype.slice.call(e).forEach((e,t)=>{i[t]=function(e){let t=0;t=e<0?(e=132-e,127):(e+=132,255);var i=$r(e,Zr,8);return 8<=i?127^t:(i<<4|e>>i+3&15)^t}(e)}),i}(t));const r=Uint8Array.from(e);for(let e=0;e>8,t[1]=255&n>>0,t[2]=128,t[3]=128+i,t[4]=r/256,t[5]=r%256,t[6]=s/65536/256,t[7]=s/65536%256,t[8]=s%65536/256,t[9]=s%65536%256,t[10]=a/65536/256,t[11]=a/65536%256,t[12]=a%65536/256,t[13]=a%65536%256,t.concat([...e])),l=new Uint8Array(o.length);for(let e=0;e{this.log(this.tag,"getUserMedia success"),this.userMediaStream=e,this.mediaStreamSource=this.audioContext.createMediaStreamSource(e),this.mediaStreamSource.connect(this.biquadFilter),this.recorder?(this.biquadFilter.connect(this.recorder),this.recorder.connect(this.gainNode)):this.workletRecorder&&(this.biquadFilter.connect(this.workletRecorder),this.workletRecorder.connect(this.gainNode)),this.gainNode.connect(this.audioContext.destination),this.emit(v.talkGetUserMediaSuccess),null===e.oninactive&&(e.oninactive=e=>{this._handleStreamInactive(e)})}).catch(e=>{this.error(this.tag,"getUserMedia error",e.toString()),this.emit(v.talkGetUserMediaFail,e.toString())}).finally(()=>{this.log(this.tag,"getUserMedia finally"),this._stopCheckGetUserMediaTimeout()})}_getUserMedia2(){this.log(this.tag,"getUserMedia"),navigator.mediaDevices?navigator.mediaDevices.getUserMedia({audio:!0}).then(e=>{this.log(this.tag,"getUserMedia2 success")}):navigator.getUserMedia({audio:!0},this.log(this.tag,"getUserMedia2 success"),this.log(this.tag,"getUserMedia2 fail"))}async _getUserMedia3(){this.log(this.tag,"getUserMedia3");try{var e=await navigator.mediaDevices.getUserMedia({audio:{latency:!0,noiseSuppression:!0,autoGainControl:!0,echoCancellation:!0,sampleRate:48e3,channelCount:1},video:!1});console.log("getUserMedia() got stream:",e),this.log(this.tag,"getUserMedia3 success")}catch(e){this.log(this.tag,"getUserMedia3 fail")}}_handleStreamInactive(e){this.userMediaStream&&(this.error(this.tag,"stream oninactive"),this.emit(v.talkStreamInactive))}_startCheckGetUserMediaTimeout(){this._stopCheckGetUserMediaTimeout(),this.checkGetUserMediaTimeout=setTimeout(()=>{this.log(this.tag,"check getUserMedia timeout"),this.emit(v.talkGetUserMediaTimeout)},this._opt.getUserMediaTimeout)}_stopCheckGetUserMediaTimeout(){this.checkGetUserMediaTimeout&&(this.log(this.tag,"stop checkGetUserMediaTimeout"),clearTimeout(this.checkGetUserMediaTimeout),this.checkGetUserMediaTimeout=null)}_startHeartInterval(){this.heartInterval=setInterval(()=>{this.log(this.tag,"heart interval");var e=[35,36,0,0,0,0,0,0],e=new Uint8Array(e);this.socket.send(e.buffer)},15e3)}_stopHeartInterval(){this.heartInterval&&(this.log(this.tag,"stop heart interval"),clearInterval(this.heartInterval),this.heartInterval=null)}startTalk(i){return new Promise((e,t)=>function(){let e=!1;var t=window.navigator;return e=t?(e=!(!t.mediaDevices||!t.mediaDevices.getUserMedia))||!!(t.getUserMedia||t.webkitGetUserMedia||t.mozGetUserMedia||t.msGetUserMedia):e}()?(this.wsUrl=i,this._opt.testMicrophone?(this._doTalk(),e()):(this._createWebSocket().catch(e=>{t(e)}),this.once(v.talkGetUserMediaFail,()=>{t("getUserMedia fail")}),void this.once(v.talkGetUserMediaSuccess,()=>{e()}))):t("not support getUserMedia"))}setVolume(e){e=parseFloat(e).toFixed(2),isNaN(e)||(e=b(e,0,1),this.gainNode.gain.value=e)}getOption(){return this._opt}get volume(){return this.gainNode?parseFloat(100*this.gainNode.gain.value).toFixed(0):null}}class ts{constructor(e){this.player=e,this.globalSetting=null;e=$e();this.defaultSettings={watermark_id:"JessibucaPro_"+e,watermark_prefix:"JessibucaPro_mask_"+e,watermark_txt:"JessibucaPro 测试水印",watermark_x:0,watermark_y:0,watermark_rows:0,watermark_cols:0,watermark_x_space:0,watermark_y_space:0,watermark_font:"微软雅黑",watermark_color:"black",watermark_fontsize:"18px",watermark_alpha:.15,watermark_width:150,watermark_height:100,watermark_angle:15,watermark_parent_width:0,watermark_parent_height:0,watermark_parent_node:null}}destroy(){this._removeMark(),this.globalSetting=null,this.defaultSettings={watermark_id:"",watermark_prefix:"",watermark_txt:"JessibucaPro 测试水印",watermark_x:0,watermark_y:0,watermark_rows:0,watermark_cols:0,watermark_x_space:0,watermark_y_space:0,watermark_font:"微软雅黑",watermark_color:"black",watermark_fontsize:"18px",watermark_alpha:.15,watermark_width:150,watermark_height:100,watermark_angle:15,watermark_parent_width:0,watermark_parent_height:0,watermark_parent_node:null}}remove(){this._removeMark()}load(e){this.globalSetting=e,this._loadMark(e)}resize(){this.globalSetting&&this._loadMark(this.globalSetting)}_loadMark(){var e=this.defaultSettings;if(1===arguments.length&&"object"==typeof arguments[0]){var t,i=arguments[0]||{};for(t in i)i[t]&&e[t]&&i[t]===e[t]||!i[t]&&0!==i[t]||(e[t]=i[t])}var r=document.getElementById(e.watermark_id),s=(r&&r.parentNode&&r.parentNode.removeChild(r),"string"==typeof e.watermark_parent_node?document.getElementById(e.watermark_parent_node):e.watermark_parent_node),r=s||document.body,a=r.getBoundingClientRect(),n=Math.max(r.scrollWidth,r.clientWidth,a.width),o=Math.max(r.scrollHeight,r.clientHeight,a.height),a=arguments[0]||{},a=((a.watermark_parent_width||a.watermark_parent_height)&&r&&(e.watermark_x=e.watermark_x+0,e.watermark_y=e.watermark_y+0),document.getElementById(e.watermark_id)),l=null;a?a.shadowRoot&&(l=a.shadowRoot):((a=document.createElement("div")).id=e.watermark_id,a.setAttribute("style","pointer-events: none !important; display: block !important"),l="function"==typeof a.attachShadow?a.attachShadow({mode:"open"}):a,(u=r.children)[d=Math.floor(Math.random()*(u.length-1))]?r.insertBefore(a,u[d]):r.appendChild(a)),e.watermark_cols=parseInt((n-e.watermark_x)/(e.watermark_width+e.watermark_x_space));var c,u=parseInt((n-e.watermark_x-e.watermark_width*e.watermark_cols)/e.watermark_cols);e.watermark_x_space=u&&e.watermark_x_space,e.watermark_rows=parseInt((o-e.watermark_y)/(e.watermark_height+e.watermark_y_space));var d=parseInt((o-e.watermark_y-e.watermark_height*e.watermark_rows)/e.watermark_rows);e.watermark_y_space=d&&e.watermark_y_space;for(var h=s?(c=e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1)):(c=0+e.watermark_x+e.watermark_width*e.watermark_cols+e.watermark_x_space*(e.watermark_cols-1),0+e.watermark_y+e.watermark_height*e.watermark_rows+e.watermark_y_space*(e.watermark_rows-1)),p=0;p=t.heartTimeout)throw new Error(`Jessibuca-pro videoBuffer ${t.videoBuffer}s must be less than heartTimeout ${t.heartTimeout}s`);if(i.classList.add("jessibuca-container"),!1===t.isLive){const e=document.createElement("video");e.muted=!0,e.setAttribute("controlsList","nodownload"),e.disablePictureInPicture="disablePictureInPicture",e.style.position="absolute",e.style.top=0,e.style.left=0,e.style.height="100%",e.style.width="100%",i.appendChild(e),this.$videoElement=e,this.$container=i,void(this._opt=t)}else delete t.container,c(t.videoBuffer)&&(t.videoBuffer=1e3*Number(t.videoBuffer)),c(t.videoBufferDelay)&&(t.videoBufferDelay=1e3*Number(t.videoBufferDelay)),c(t.networkDelay)&&(t.networkDelay=1e3*Number(t.networkDelay)),c(t.timeout)&&(it(t.loadingTimeout)&&(t.loadingTimeout=t.timeout),it(t.heartTimeout))&&(t.heartTimeout=t.timeout),t.isMulti&&(t.debugUuid="xxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})),this._opt=t,this._destroyed=!1,this.$container=i,this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.events=new Ve(this),this.debug=new Ne(this),this.watermark=new ts(this),this._initPlayer(i,t),this._initWatermark()}destroy(){this._destroyed=!0,this.off(),this.$videoElement&&(this.$videoElement.pause(),this.$videoElement.currentTime=0,this.$videoElement.srcObject&&(this.$videoElement.srcObject=null,this.$videoElement.removeAttribute("srcObject")),this.$videoElement.src&&(this.$videoElement.src="",this.$videoElement.removeAttribute("src")),this.$container.removeChild(this.$videoElement),this.$videoElement=null),this.player&&(this.player.destroy(),this.player=null),this.events&&(this.events.destroy(),this.events=null),this.talk&&(this.talk.destroy(),this.talk=null),this.watermark&&(this.watermark.destroy(),this.watermark=null),this.$container=null,this._resetOpt(),this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.debug&&this.debug.log("jessibuca","destroy")}_resetOpt(){this._opt=Et()}_initPlayer(e,t){this.player=new Xr(e,t),this.debug.log("jessibuca","_initPlayer",this.player.getOption()),this._bindEvents()}_initTalk(){var e=0{this.player.on(ie[t],e=>{this.emit(t,e)})}),this.player.once(v.beforeDestroy,()=>{this.emit(v.close),this.destroy()}),this.player.on(v.resize,()=>{this.watermark&&this.watermark.resize()}),this.player.on(v.fullscreen,()=>{this.watermark&&this.watermark.resize()})}_bindTalkEvents(){Object.keys(re).forEach(t=>{this.player.on(re[t],e=>{this.emit(t,e)})})}_initWatermark(){var e;dt(this._opt.fullscreenWatermarkConfig)&&((e=at(this.$container,this._opt.fullscreenWatermarkConfig)).watermark_txt?this.watermark.load(e):this.debug.warn("jessibuca","fullscreenWatermarkConfig text is empty"))}isDestroyed(){return this._destroyed}getOption(){return this.player?this.player.getOption():{}}setDebug(e){this.player&&this.player.updateOption({debug:!!e})}mute(){this.player&&this.player.mute(!0)}cancelMute(){this.player&&this.player.mute(!1)}setVolume(e){this.player&&(this.player.volume=e)}getVolume(){let e=null;return this.player&&(e=this.player.volume,e=parseFloat(e).toFixed(2)),e}audioResume(){this.player&&this.player.audio&&this.player.audio.audioEnabled(!0)}setTimeout(e){e=Number(e),this.player&&this.player.updateOption({timeout:e,loadingTimeout:e,heartTimeout:e})}setScaleMode(e){this.player&&this.player.setScaleMode(e)}pause(){let e=0{this.player?this.player.pause(e).then(e=>{t(e)}).catch(e=>{i(e)}):i("player is null")})}close(){return new Promise((e,t)=>{this._opt.url="",this._loadingTimeoutReplayTimes=0,this._heartTimeoutReplayTimes=0,this.player?this.player.close().then(()=>{e()}).catch(e=>{t(e)}):t("player is null")})}clearView(){this.player&&this.player.video?this.getRenderType()===G?this.player.video.clearView():this.debug.warn("jessibuca","clearView","render type is video, not support clearView, please use canvas render type"):this.debug.warn("jessibuca","clearView","player is null")}play(){let a=0{if(a||this._opt.url)if(a=a&&(""+a).trim(),!1===this._opt.isLive)this.$videoElement.controls="controls",this.$videoElement.muted=!1,this.$videoElement.src=a,this.$videoElement.play(),i(this.$videoElement);else{if(this._opt.isCrypto){var e,t=n.cryptoKey||this._opt.playOptions.cryptoKey,s=n.cryptoIV||this._opt.playOptions.cryptoIV;if(!t||!s)return e=a||this._opt.url,void this._cryptoPlay(e).then(e=>{var{cryptoIV:e,cryptoKey:t}=e;this._opt.playOptions.cryptoKey=t,this._opt.playOptions.cryptoIV=e,n.cryptoIV=e,n.cryptoKey=t,this._playBefore(a,n).then(()=>{i()}).catch(e=>{r(e)})}).catch(e=>{r(e)});this._opt.playOptions.cryptoKey=t,this._opt.playOptions.cryptoIV=s,n.cryptoIV=s,n.cryptoKey=t}this._playBefore(a,n).then(()=>{i()}).catch(e=>{r(e)})}else this.emit(v.error,A.playError),r()})}_playBefore(i,r){return new Promise((e,t)=>{this.player?i?this._opt.url?i===this._opt.url?this.player.playing?(this.debug.log("jessibuca","_playBefore","playing and resolve()"),e()):(this.debug.log("jessibuca","_playBefore","pause -> play"),this.player.play(this._opt.url,this._opt.playOptions).then(()=>{e(),this.player.resumeAudioAfterPause()}).catch(e=>{this.debug.error("Jessibuca","_playBefore this.player.play error",e),this.emit(v.crashLog,this.getCrashLog(e)),this.player.pause().then(()=>{t(e)})})):this.player.pause().then(()=>{this._play(i,r).then(()=>{e()}).catch(e=>{this.debug.error("Jessibuca","_play error",e),t(e)})}).catch(e=>{this.debug.error("Jessibuca","this.player.pause error",e),t(e)}):this._play(i,r).then(()=>{e()}).catch(e=>{this.debug.error("Jessibuca","_play error",e),t(e)}):this.player.play(this._opt.url,this._opt.playOptions).then(()=>{e(),this.player.resumeAudioAfterPause()}).catch(e=>{this.debug.error("Jessibuca","this.player.play error",e),this.emit(v.crashLog,this.getCrashLog(e)),this.player.pause().then(()=>{t(e)})}):i?this._play(i,r).then(()=>{e()}).catch(e=>{this.debug.error("Jessibuca","_play error",e),t(e)}):this._play(this._opt.url,this._opt.playOptions).then(()=>{e()}).catch(e=>{this.debug.error("Jessibuca","_play error",e),t(e)})})}_cryptoPlay(n){return new Promise((r,s)=>{var e,t=function(){var e=(n||document.location.toString()).split("//"),t=e[1].indexOf("/");let i=e[1].substring(t);return i=-1!=i.indexOf("?")?i.split("?")[0]:i}();let i=this._opt.cryptoKeyUrl,a="";if(i)a=i;else{const r=function(e){var t=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");let r=e;return t&&(i.setAttribute("href",r),r=i.href),i.setAttribute("href",r),{origin:i.origin,href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:"/"===i.pathname.charAt(0)?i.pathname:"/"+i.pathname}}(n);i=r.origin+"/crypto/",a=i+"?stream="+t}e=a,new Promise((t,i)=>{R.get(e).then(e=>{t(e)}).catch(e=>{i(e)})}).then(e=>{if(e){const t=e.split("."),i=vt(t[0]),a=vt(t[1]);a&&i?r({cryptoIV:a,cryptoKey:i}):s("get cryptoIV or cryptoKey error")}else s(`cryptoKeyUrl: getM7SCryptoStreamKey ${a} res is null`)}).catch(e=>{s(e)})})}playback(e){var t,i=1{if(!this.player)return t("player is null");!0===i?this.pause().then(()=>{e()}).catch(e=>{t(e)}):(this.player.playbackPause=!0,e())})}playbackResume(){return this._opt.playType===n?Promise.reject("playType is player, can not call playbackResume method"):new Promise((e,t)=>{if(!this.player)return t();this.player.playbackPause=!1,e()})}forward(i){return!1===this._opt.isLive||this._opt.playType===n?Promise.reject("forward() method only just for playback type"):u(Number(i))?new Promise((e,t)=>{(this.player&&this.player.playing?(i=b(Number(i),.1,32),this.player.playback.setRate(i),this.player.video&&this.player.video.setRate(i),this.player.audio&&this.player.audio.setRate(i),this.player.decoderWorker.clearWorkBuffer(!0),this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"playbackRate",value:i}),e):t)()}):Promise.reject(`forward() params "rate": ${i} must be number type`)}playbackForward(e){return this.forward(e)}normal(){return this.forward(1)}playbackNormal(){return this.normal()}updatePlaybackForwardMaxRateDecodeIFrame(e){e=b(Number(e),1,8),this.player?this.player.updateOption({playbackForwardMaxRateDecodeIFrame:e}):this._opt.playbackForwardMaxRateDecodeIFrame=e}setPlaybackStartTime(e){var t=ut(e);this.player&&this.player.isPlayback()&&(t<10&&0!==e||this.player.playing&&(10===t&&(e*=1e3),this.player.playback.setStartTime(e),this.playbackClearCacheBuffer()))}playbackClearCacheBuffer(){this.player&&this.player.isPlayback()&&(this.player.video&&this.player.video.clear(),this.player.audio&&this.player.audio.clear(),this.player.decoderWorker.clearWorkBuffer(!0))}getPlaybackCurrentRate(){return this.player&&this.player.isPlayback()?this.player.playback.rate:1}setStreamQuality(e){this.player&&this.player._opt.operateBtns.quality&&(this.player._opt.qualityConfig||[]).includes(e)&&(this.player.streamQuality=e)}_play(){let c=0{this.player||t("player is null");let i=!1;this._opt.url&&this._opt.url!==c&&(i=!0),this._opt.url=c,this._opt.playOptions=u;var r=0===c.indexOf("http"),s=0===c.indexOf("webrtc"),a=0===c.indexOf("wt"),n=!s&&-1!==c.indexOf(".m3u8"),o=!s&&-1!==c.indexOf(".flv"),l=r?n?3:2:a?5:s?4:1,r=this._opt.isNakedFlow?H:r&&!n||o||this._opt.isFlv?N:n?"hls":s?"webrtc":a?V:"m7s";if(o&&!this._opt.isFlv&&(this._opt.isFlv=!0),!l||!r)return t(`play protocol is ${l}, demuxType is `+r);n||s||i?this._resetPlayer({protocol:l,demuxType:r,isHls:n,isWebrtc:s}):(this.player.updateOption({protocol:l,demuxType:r,isFlv:this._opt.isFlv,cryptoKey:u.cryptoKey||"",cryptoIV:u.cryptoIV||""}),u.cryptoKey&&u.cryptoIV&&(this.player.decoderWorker&&this.player.decoderWorker.updateWorkConfig({key:"cryptoKey",value:u.cryptoKey}),this.player.decoderWorker)&&this.player.decoderWorker.updateWorkConfig({key:"cryptoIV",value:u.cryptoIV})),this.player.once(A.webglAlignmentError,()=>{this.emit(v.crashLog,this.getCrashLog(A.webglAlignmentError)),this.pause().then(()=>{this.debug.log("Jessibuca","webglAlignmentError");var e=this._opt.url;this._resetPlayer({openWebglAlignment:!0}),this.play(e).then(()=>{this.debug.log("Jessibuca","webglAlignmentError and play success")}).catch(e=>{this.debug.error("Jessibuca","webglAlignmentError and play error",e)})}).catch(e=>{this.debug.error("Jessibuca","webglAlignmentError and pause error",e)})}),this.player.once(A.mediaSourceH265NotSupport,()=>{this.emit(v.crashLog,this.getCrashLog(A.mediaSourceH265NotSupport)),this.pause().then(()=>{var e;this.player._opt.autoWasm?(this.debug.log("Jessibuca","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play"),e=this._opt.url,this._resetPlayer({useMSE:!1,useWCS:!1}),this.play(e).then(()=>{this.debug.log("Jessibuca","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play success")}).catch(e=>{this.debug.error("Jessibuca","mediaSourceH265NotSupport auto wasm [mse-> wasm] reset player and play error",e)})):this.debug.log("Jessibuca","mediaSourceH265NotSupport and autoWasm is false")}).catch(e=>{this.debug.error("Jessibuca","mediaSourceH265NotSupport and pause error",e)})}),this.player.once(A.mediaSourceFull,()=>{this.emit(v.crashLog,this.getCrashLog(A.mediaSourceFull)),this.pause().then(()=>{var e;this.player._opt.autoWasm?(this.debug.log("Jessibuca","mediaSourceFull and auto wasm [mse-> wasm] reset player and play"),e=this._opt.url,this._resetPlayer({useMSE:!1,useWCS:!1}),this.play(e).then(()=>{this.debug.log("Jessibuca","mediaSourceFull and reset player and play success")}).catch(e=>{this.debug.error("Jessibuca","mediaSourceFull and reset player and play error",e)})):this.debug.log("Jessibuca","mediaSourceFull and autoWasm is false")}).catch(e=>{this.debug.error("Jessibuca","mediaSourceFull and pause error",e)})}),this.player.once(A.mediaSourceAppendBufferError,()=>{this.emit(v.crashLog,this.getCrashLog(A.mediaSourceAppendBufferError)),this.pause().then(()=>{var e;this.player._opt.autoWasm?(this.debug.log("Jessibuca","mediaSourceAppendBufferError and auto wasm [mse-> wasm] reset player and play"),e=this._opt.url,this._resetPlayer({useMSE:!1,useWCS:!1}),this.play(e).then(()=>{this.debug.log("Jessibuca","mediaSourceAppendBufferError and reset player and play success")}).catch(e=>{this.debug.error("Jessibuca","mediaSourceAppendBufferError and reset player and play error",e)})):this.debug.log("Jessibuca","mediaSourceAppendBufferError and autoWasm is false")}).catch(e=>{this.debug.error("Jessibuca","mediaSourceAppendBufferError and pause error",e)})}),this.player.once(A.mediaSourceBufferListLarge,()=>{this.emit(v.crashLog,this.getCrashLog(A.mediaSourceBufferListLarge)),this.pause().then(()=>{var e;this.player._opt.autoWasm?(this.debug.log("Jessibuca","media source buffer list large and auto wasm [mse-> wasm] reset player and play"),e=this._opt.url,this._resetPlayer({useMSE:!1,useWCS:!1}),this.play(e).then(()=>{this.debug.log("Jessibuca","media source buffer list large and reset player and play success")}).catch(e=>{this.debug.error("Jessibuca","media source buffer list large and reset player and play error",e)})):this.debug.log("Jessibuca","media source buffer list large and autoWasm is false")}).catch(e=>{this.debug.error("Jessibuca","media source buffer list large and pause error",e)})}),this.player.once(A.mediaSourceAppendBufferEndTimeout,()=>{this.emit(v.crashLog,this.getCrashLog(A.mediaSourceAppendBufferEndTimeout)),this.pause().then(()=>{var e;this.player._opt.autoWasm&&(this.debug.log("Jessibuca","media source append buffer end timeout and auto wasm [mse-> wasm] reset player and play"),e=this._opt.url,this._resetPlayer({useMSE:!1,useWCS:!1}),this.play(e).then(()=>{this.debug.log("Jessibuca","media source append buffer end timeout and reset player and play success")}).catch(e=>{this.debug.error("Jessibuca","media source append buffer end timeout and reset player and play error",e)}))}).catch(e=>{this.debug.error("Jessibuca","media source append buffer end timeout and pause error",e)})}),this.player.once(A.mseSourceBufferError,()=>{this.emit(v.crashLog,this.getCrashLog(A.mseSourceBufferError)),this.pause().then(()=>{var e;this.player._opt.autoWasm?(this.debug.log("Jessibuca","mseSourceBufferError auto wasm [mse-> wasm] reset player and play"),e=this._opt.url,this._resetPlayer({useMSE:!1,useWCS:!1}),this.play(e).then(()=>{this.debug.log("Jessibuca","mseSourceBufferError auto wasm [mse-> wasm] reset player and play success")}).catch(e=>{this.debug.error("Jessibuca","mseSourceBufferError auto wasm [mse-> wasm] reset player and play error",e)})):this.debug.log("Jessibuca","mseSourceBufferError and autoWasm is false")}).catch(e=>{this.debug.error("Jessibuca","mseSourceBufferError and pause error",e)})}),this.player.once(A.mediaSourceDecoderConfigurationError,()=>{this.emit(v.crashLog,this.getCrashLog(A.mediaSourceDecoderConfigurationError)),this.pause().then(()=>{var e;this.player._opt.autoWasm?(this.debug.log("Jessibuca","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play"),e=this._opt.url,this._resetPlayer({useMSE:!1,useWCS:!1}),this.play(e).then(()=>{this.debug.log("Jessibuca","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play success")}).catch(e=>{this.debug.error("Jessibuca","mediaSourceDecoderConfigurationError auto wasm [mse-> wasm] reset player and play error",e)})):this.debug.log("Jessibuca","mediaSourceDecoderConfigurationError and autoWasm is false")}).catch(e=>{this.debug.error("Jessibuca","mediaSourceDecoderConfigurationError and pause error",e)})}),this.player.once(A.webcodecsH265NotSupport,()=>{this.emit(v.crashLog,this.getCrashLog(A.webcodecsH265NotSupport)),this.pause().then(()=>{var e;this.player._opt.autoWasm?(this.debug.log("Jessibuca","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play"),e=this._opt.url,this._resetPlayer({useWCS:!1}),this.play(e).then(()=>{this.debug.log("Jessibuca","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play success")}).catch(e=>{this.debug.error("Jessibuca","webcodecsH265NotSupport auto wasm [wcs-> wasm] reset player and play error",e)})):this.debug.log("Jessibuca","webcodecsH265NotSupport and autoWasm is false")}).catch(e=>{this.debug.error("Jessibuca","webcodecsH265NotSupport and pause error",e)})}),this.player.once(A.webcodecsWidthOrHeightChange,()=>{this.emit(v.crashLog,this.getCrashLog(A.webcodecsWidthOrHeightChange)),this.pause().then(()=>{this.debug.log("Jessibuca","webcodecs Width Or Height Change reset player and play");var e=this._opt.url;this._resetPlayer({useWCS:!0}),this.play(e).then(()=>{this.debug.log("Jessibuca","webcodecs Width Or Height Change reset player and play success")}).catch(e=>{this.debug.error("Jessibuca","webcodecs Width Or Height Change reset player and play error",e)})})}),this.player.once(A.webcodecsDecodeError,()=>{this.emit(v.crashLog,this.getCrashLog(A.webcodecsDecodeError)),this.pause().then(()=>{var e;this.player._opt.autoWasm?(this.debug.log("Jessibuca","webcodecs decode error reset player and play"),e=this._opt.url,this._resetPlayer({useWCS:!1}),this.play(e).then(()=>{this.debug.log("Jessibuca","webcodecs decode error reset player and play success")}).catch(e=>{this.debug.error("Jessibuca","webcodecs decode error reset player and play error",e)})):this.debug.log("Jessibuca","webcodecs decode error and autoWasm is false")}).catch(e=>{this.debug.error("Jessibuca","webcodecs decode error and pause error",e)})}),this.player.once(A.wasmDecodeError,()=>{this.emit(v.crashLog,this.getCrashLog(A.wasmDecodeError)),this.pause().then(()=>{var e;this.player._opt.wasmDecodeErrorReplay?(this.debug.log("Jessibuca","wasm decode error and reset player and play"),e=this._opt.url,this._resetPlayer(),this.play(e).then(()=>{this.debug.log("Jessibuca","wasm decode error and reset player and play success")}).catch(e=>{this.debug.error("Jessibuca","wasm decode error and reset player and play error",e)})):this.debug.log("Jessibuca","wasm decode error and wasmDecodeErrorReplay is false")}).catch(e=>{this.debug.error("Jessibuca","wasm decode error and pause error",e)})}),this.player.once(A.wasmDecodeVideoNoResponseError,()=>{this.emit(v.crashLog,this.getCrashLog(A.wasmDecodeVideoNoResponseError)),this.pause().then(()=>{this.debug.log("Jessibuca","wasm decode video no response error and reset player and play");var e=this._opt.url,t=this.screenshot("","png",.92,"base64");this._resetPlayer({loadingBackground:t}),this.play(e).then(()=>{this.debug.log("Jessibuca","wasm decode video no response error and reset player and play success")}).catch(e=>{this.debug.error("Jessibuca","wasm decode video no response error and reset player and play error",e)})}).catch(e=>{this.debug.error("Jessibuca","wasm decode video no response error and pause error",e)})}),this.player.once(A.simdH264DecodeVideoWidthIsTooLarge,()=>{this.emit(v.crashLog,this.getCrashLog(A.simdH264DecodeVideoWidthIsTooLarge)),this.pause().then(()=>{this.debug.log("Jessibuca","simdH264DecodeVideoWidthIsTooLarge and reset player and play");var e=this._opt.url;this._resetPlayer({useSIMD:!1}),this.play(e).then(()=>{this.debug.log("Jessibuca","simdH264DecodeVideoWidthIsTooLarge and reset player and play success")}).catch(e=>{this.debug.error("Jessibuca","simdH264DecodeVideoWidthIsTooLarge and reset player and play error",e)})}).catch(e=>{this.debug.error("Jessibuca","simdH264DecodeVideoWidthIsTooLarge and pause error",e)})}),this.player.once(v.networkDelayTimeout,()=>{var e;this.emit(v.crashLog,this.getCrashLog(v.networkDelayTimeout)),this.player._opt.networkDelayTimeoutReplay&&(this.debug.log("Jessibuca","network delay time out and reset player and play"),e=this._opt.url,this._resetPlayer(),this.play(e).then(()=>{this.debug.log("Jessibuca","wasm decode error and reset player and play success")}).catch(e=>{this.debug.error("Jessibuca","wasm decode error and reset player and play error",e)}))}),this.player.once(A.fetchError,()=>{this.emit(v.crashLog,this.getCrashLog(A.fetchError)),this.debug.log("Jessibuca","fetch error and reset player"),this.pause().then(()=>{this._resetPlayer()}).catch(e=>{this.debug.error("Jessibuca","fetch error and pause",e)})}),this.player.on(v.delayTimeout,()=>{var e,t;this.emit(v.crashLog,this.getCrashLog(v.delayTimeout)),this.player&&this.player._opt.heartTimeoutReplay&&(this._heartTimeoutReplayTimes{}).catch(e=>{this.debug.error("Jessibuca","delay timeout replay error",e)}))):(this.player&&this.player.emit(v.delayTimeoutRetryEnd),this.debug.warn("Jessibuca",`delayTimeout and opt.heartTimeoutReplay is ${this.player._opt.heartTimeoutReplay} and opt.heartTimeoutReplayTimes is ${this.player._opt.heartTimeoutReplayTimes}},and local._heartTimeoutReplayTimes is `+this._heartTimeoutReplayTimes))}),this.player.on(v.loadingTimeout,()=>{var e;this.emit(v.crashLog,this.getCrashLog(v.loadingTimeout)),this.player&&this.player._opt.loadingTimeoutReplay&&(this._loadingTimeoutReplayTimes{}).catch(e=>{this.debug.error("Jessibuca","loading timeout replay error",e)}))):(this.player&&this.player.emit(v.loadingTimeoutRetryEnd),this.debug.log("Jessibuca",`loadingTimeoutReplay is ${this.player._opt.loadingTimeoutReplay} and local._loadingTimeoutReplayTimes time is ${this._loadingTimeoutReplayTimes} and opt.loadingTimeoutReplayTimes is `+this.player._opt.loadingTimeoutReplayTimes))}),this.hasLoaded()?this.player.play(c,u).then(()=>{e()}).catch(e=>{this.debug.error("Jessibuca","hasLoaded and play error",e),this.emit(v.crashLog,this.getCrashLog(e)),this.player.pause().then(()=>{t(e)}).catch(e=>{this.debug.error("Jessibuca","hasLoaded and play error and next pause error",e)})}):this.player.once(v.decoderWorkerInit,()=>{this.player.play(c,u).then(()=>{e()}).catch(e=>{this.debug.error("Jessibuca","decoderWorkerInit and play error",e),this.emit(v.crashLog,this.getCrashLog(e)),this.player.pause().then(()=>{t(e)}).catch(e=>{this.debug.error("Jessibuca","decoderWorkerInit and play error and next pause error",e)})})})})}resize(){this.player&&this.player.resize()}setBufferTime(e){e=Number(e),this.player&&(10{if(!this.player)return t();(this.player.playing?(this.player.startRecord(i,r),e):t)()})}stopRecordAndSave(e,r){return new Promise((t,i)=>{this.player&&this.player.recording?this.player.stopRecordAndSave(e,r).then(e=>{t(e)}).catch(e=>{i(e)}):i("not recording")})}isPlaying(){let e=!1;return this.player&&(this._opt.playType===n?e=this.player.playing:this._opt.playType===y&&(e=!1===this.player.playbackPause&&this.player.playing)),e}isLoading(){return!!this.player&&this.player.loading}isPause(){let e=!1;return this._opt.playType===n?e=!this.isPlaying()&&!this.isLoading():this._opt.playType===y&&this.player&&(e=this.player.playbackPause),e}isPaused(){return this.isPause()}isPlaybackPause(){let e=!1;return e=this._opt.playType===y&&this.player?this.player.playbackPause:e}isMute(){let e=!0;return e=this.player?this.player.isAudioMute():e}isRecording(){return this.player&&this.player.recorder&&this.player.recorder.recording||!1}clearBufferDelay(){this.player&&this.player.clearBufferDelay()}setNetworkDelayTime(e){e=Number(e),this.player&&(e<1&&console.warn(`Jessibuca network delay is ${e} second, is too small`),e=b(e,1,100),this.player.updateOption({networkDelay:1e3*e}),this.player.decoderWorker)&&this.player.decoderWorker.updateWorkConfig({key:"networkDelay",value:1e3*e})}getDecodeType(){let e="";return e=this.player?this.player.getDecodeType():e}getRenderType(){let e="";return e=this.player?this.player.getRenderType():e}getAudioEngineType(){let e="";return e=this.player?this.player.getAudioEngineType():e}getPlayingTimestamp(){let e=0;return e=this.player?this.player.getPlayingTimestamp():e}getStatus(){let e="destroy";return e=this.player?this.player.loading?"loading":this.player.playing?"playing":"paused":e}getPlayType(){return this.player?this.player._opt.playType:n}togglePerformancePanel(e){var t=this.player._opt.showPerformance;let i=!t;(i=rt(e)?e:i)!==t&&this.player&&this.player.togglePerformancePanel(i)}openZoom(){this.player&&(this.player.zooming=!0)}closeZoom(){this.player&&(this.player.zooming=!1)}isZoomOpen(){let e=!1;return e=this.player?this.player.zooming:e}expandZoom(){this.player&&this.player.zoom&&this.player.zooming&&this.player.zoom.expandPrecision()}narrowZoom(){this.player&&this.player.zoom&&this.player.zooming&&this.player.zoom.narrowPrecision()}getCurrentZoomIndex(){let e=1;return e=this.player&&this.player.zoom?this.player.zoom.currentZoom:e}startTalk(i){let r=1{this._initTalk(r),this.talk.startTalk(i).then(()=>{e(),this.talk.once(v.talkStreamClose,()=>{this.stopTalk().catch(e=>{})}),this.talk.once(v.talkStreamError,()=>{this.stopTalk().catch(e=>{})}),this.talk.once(v.talkStreamInactive,()=>{this.stopTalk().catch(e=>{})})}).catch(e=>{t(e)})})}stopTalk(){return new Promise((e,t)=>{this.talk||t("talk is not init"),this.talk.destroy(),e()})}getTalkVolume(){return new Promise((e,t)=>{this.talk||t("talk is not init"),e(this.talk.volume)})}setTalkVolume(i){return new Promise((e,t)=>{this.talk||t("talk is not init"),this.talk.setVolume(i/100),e()})}setNakedFlowFps(r){return new Promise((e,t)=>{var i;return this.player?it(r)?t("fps is empty"):(i=b(i=Number(r),1,100),void this.player.updateOption({nakedFlowFps:i})):t("player is not init")})}getCrashLog(e){var t,i;if(this.player)return t=this.player.getAllStatsData(),i=this.player,{url:this._opt.url,playType:i.isPlayback()?"playback":"live",demuxType:i.getDemuxType(),decoderType:i.getDecodeType(),renderType:i.getRenderType(),videoInfo:i.video?i.video.videoInfo:{},audioInfo:i.audio?i.audio.audioInfo:{},audioEngine:i.getAudioEngineType(),allTimes:t.pTs,timestamp:m(),error:function(e){const t=Object.prototype.toString;return function(e){switch(t.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return 1;default:try{return e instanceof Error}catch(e){}}}(e)?e.message:null==e?"":"object"==typeof e?JSON.stringify(e,null,2):String(e)}(e)}}updateDebugLevel(e){!this.player||e!==z&&e!==K||e!==this.player._opt.debugLevel&&(this.player.updateOption({debugLevel:e}),this.player.decoderWorker)&&this.player.decoderWorker.updateWorkConfig({key:"debugLevel",value:e})}updateFullscreenWatermark(e){dt(e)&&(this._opt.fullscreenWatermarkConfig=e,(e=at(this.$container,e)).watermark_txt?this.watermark.load(e):this.debug.warn("jessibuca","fullscreenWatermarkConfig text is empty"))}removeFullscreenWatermark(){this.watermark&&this.watermark.remove()}faceDetectOpen(){this.player&&this.player.faceDetect(!0)}faceDetectClose(){this.player&&this.player.faceDetect(!1)}objectDetectOpen(){this.player&&this.player.objectDetect(!0)}objectDetectClose(){this.player&&this.player.objectDetect(!1)}sendWebsocketMessage(e){this.player?this.player.sendWebsocketMessage(e):this.debug.warn("jessibuca","player is not init")}downloadTempNakedFlowFile(){return new Promise((e,t)=>{this.player?(this.player.downloadNakedFlowFile(),e()):t("player is not init")})}downloadTempRtpFile(){return new Promise((e,t)=>{this.talk?(this.talk.downloadRtpFile(),e()):t("talk is not init")})}}return is.ERROR=A,is.EVENTS=ie,window.JessibucaPro=is}); diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..3df192b --- /dev/null +++ b/project.config.json @@ -0,0 +1,29 @@ +{ + "description": "项目配置文件,用于直接导入微信开发者工具", + "packOptions": { + "ignore": [], + "include": [] + }, + "setting": { + "urlCheck": false, + "es6": false, + "postcss": false, + "minified": true, + "newFeature": true, + "bigPackageSizeSupport": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + } + }, + "compileType": "miniprogram", + "libVersion": "2.32.1", + "appid": "wx5bfbadf52adc17f3", + "projectname": "芯程物联", + "condition": {}, + "editorSetting": { + "tabIndent": "insertSpaces", + "tabSize": 2 + } +} \ No newline at end of file diff --git a/static/538.png b/static/538.png new file mode 100644 index 0000000..0f03422 Binary files /dev/null and b/static/538.png differ diff --git a/static/750.png b/static/750.png new file mode 100644 index 0000000..44d874c Binary files /dev/null and b/static/750.png differ diff --git a/static/about.png b/static/about.png new file mode 100644 index 0000000..949ed8a Binary files /dev/null and b/static/about.png differ diff --git a/static/alert.png b/static/alert.png new file mode 100644 index 0000000..19ad20f Binary files /dev/null and b/static/alert.png differ diff --git a/static/alert_active.png b/static/alert_active.png new file mode 100644 index 0000000..d4789c2 Binary files /dev/null and b/static/alert_active.png differ diff --git a/static/ap.png b/static/ap.png new file mode 100644 index 0000000..a72ef42 Binary files /dev/null and b/static/ap.png differ diff --git a/static/avatar.png b/static/avatar.png new file mode 100644 index 0000000..9f72798 Binary files /dev/null and b/static/avatar.png differ diff --git a/static/bg.png b/static/bg.png new file mode 100644 index 0000000..03f483c Binary files /dev/null and b/static/bg.png differ diff --git a/static/bq.png b/static/bq.png new file mode 100644 index 0000000..a14eb4e Binary files /dev/null and b/static/bq.png differ diff --git a/static/common/cameras.png b/static/common/cameras.png new file mode 100644 index 0000000..700695e Binary files /dev/null and b/static/common/cameras.png differ diff --git a/static/common/device.png b/static/common/device.png new file mode 100644 index 0000000..643576c Binary files /dev/null and b/static/common/device.png differ diff --git a/static/common/gateway.png b/static/common/gateway.png new file mode 100644 index 0000000..5442572 Binary files /dev/null and b/static/common/gateway.png differ diff --git a/static/common/scada_black.png b/static/common/scada_black.png new file mode 100644 index 0000000..7e2d3a9 Binary files /dev/null and b/static/common/scada_black.png differ diff --git a/static/common/scada_blue.png b/static/common/scada_blue.png new file mode 100644 index 0000000..b4d74f9 Binary files /dev/null and b/static/common/scada_blue.png differ diff --git a/static/common/video.png b/static/common/video.png new file mode 100644 index 0000000..1d15dbe Binary files /dev/null and b/static/common/video.png differ diff --git a/static/configuration.png b/static/configuration.png new file mode 100644 index 0000000..2f341e7 Binary files /dev/null and b/static/configuration.png differ diff --git a/static/cq.png b/static/cq.png new file mode 100644 index 0000000..a290b45 Binary files /dev/null and b/static/cq.png differ diff --git a/static/cropping/photo.png b/static/cropping/photo.png new file mode 100644 index 0000000..829b4a8 Binary files /dev/null and b/static/cropping/photo.png differ diff --git a/static/cropping/rotate.png b/static/cropping/rotate.png new file mode 100644 index 0000000..9ba0999 Binary files /dev/null and b/static/cropping/rotate.png differ diff --git a/static/device_black.png b/static/device_black.png new file mode 100644 index 0000000..ad272e8 Binary files /dev/null and b/static/device_black.png differ diff --git a/static/device_blue.png b/static/device_blue.png new file mode 100644 index 0000000..6c394e3 Binary files /dev/null and b/static/device_blue.png differ diff --git a/static/down.png b/static/down.png new file mode 100644 index 0000000..ff6fff2 Binary files /dev/null and b/static/down.png differ diff --git a/static/gq.png b/static/gq.png new file mode 100644 index 0000000..4664838 Binary files /dev/null and b/static/gq.png differ diff --git a/static/group.png b/static/group.png new file mode 100644 index 0000000..a15877d Binary files /dev/null and b/static/group.png differ diff --git a/static/home.png b/static/home.png new file mode 100644 index 0000000..fd6dedc Binary files /dev/null and b/static/home.png differ diff --git a/static/home/device/attribute.png b/static/home/device/attribute.png new file mode 100644 index 0000000..e33182f Binary files /dev/null and b/static/home/device/attribute.png differ diff --git a/static/home/device/function.png b/static/home/device/function.png new file mode 100644 index 0000000..0a54915 Binary files /dev/null and b/static/home/device/function.png differ diff --git a/static/home/device/share.png b/static/home/device/share.png new file mode 100644 index 0000000..1d372b2 Binary files /dev/null and b/static/home/device/share.png differ diff --git a/static/home/fastbee.png b/static/home/fastbee.png new file mode 100644 index 0000000..67ac75b Binary files /dev/null and b/static/home/fastbee.png differ diff --git a/static/home_active.png b/static/home_active.png new file mode 100644 index 0000000..1bfe54c Binary files /dev/null and b/static/home_active.png differ diff --git a/static/hp.png b/static/hp.png new file mode 100644 index 0000000..f562f8a Binary files /dev/null and b/static/hp.png differ diff --git a/static/hp_logo.png b/static/hp_logo.png new file mode 100644 index 0000000..17822b2 Binary files /dev/null and b/static/hp_logo.png differ diff --git a/static/intercom.png b/static/intercom.png new file mode 100644 index 0000000..28e1fd1 Binary files /dev/null and b/static/intercom.png differ diff --git a/static/language.png b/static/language.png new file mode 100644 index 0000000..a8fcea3 Binary files /dev/null and b/static/language.png differ diff --git a/static/loading.png b/static/loading.png new file mode 100644 index 0000000..ace5990 Binary files /dev/null and b/static/loading.png differ diff --git a/static/log_black.png b/static/log_black.png new file mode 100644 index 0000000..1659892 Binary files /dev/null and b/static/log_black.png differ diff --git a/static/log_blue.png b/static/log_blue.png new file mode 100644 index 0000000..e747526 Binary files /dev/null and b/static/log_blue.png differ diff --git a/static/login/fastbee.png b/static/login/fastbee.png new file mode 100644 index 0000000..7082bc1 Binary files /dev/null and b/static/login/fastbee.png differ diff --git a/static/login/phone.png b/static/login/phone.png new file mode 100644 index 0000000..a64afb8 Binary files /dev/null and b/static/login/phone.png differ diff --git a/static/login/search.png b/static/login/search.png new file mode 100644 index 0000000..276a887 Binary files /dev/null and b/static/login/search.png differ diff --git a/static/login/wechat.png b/static/login/wechat.png new file mode 100644 index 0000000..feb4b09 Binary files /dev/null and b/static/login/wechat.png differ diff --git a/static/logo-1.png b/static/logo-1.png new file mode 100644 index 0000000..de03c7f Binary files /dev/null and b/static/logo-1.png differ diff --git a/static/logo.9.png b/static/logo.9.png new file mode 100644 index 0000000..84cb65c Binary files /dev/null and b/static/logo.9.png differ diff --git a/static/logo.jpg b/static/logo.jpg new file mode 100644 index 0000000..03be24b Binary files /dev/null and b/static/logo.jpg differ diff --git a/static/logo_title.png b/static/logo_title.png new file mode 100644 index 0000000..6428ae9 Binary files /dev/null and b/static/logo_title.png differ diff --git a/static/message.png b/static/message.png new file mode 100644 index 0000000..e71c59c Binary files /dev/null and b/static/message.png differ diff --git a/static/more.png b/static/more.png new file mode 100644 index 0000000..77f7c78 Binary files /dev/null and b/static/more.png differ diff --git a/static/pantilt.png b/static/pantilt.png new file mode 100644 index 0000000..f5c713e Binary files /dev/null and b/static/pantilt.png differ diff --git a/static/play.png b/static/play.png new file mode 100644 index 0000000..d9b83c4 Binary files /dev/null and b/static/play.png differ diff --git a/static/record.png b/static/record.png new file mode 100644 index 0000000..c8a8b37 Binary files /dev/null and b/static/record.png differ diff --git a/static/relate.png b/static/relate.png new file mode 100644 index 0000000..b1b377c Binary files /dev/null and b/static/relate.png differ diff --git a/static/scan.png b/static/scan.png new file mode 100644 index 0000000..9a6fa26 Binary files /dev/null and b/static/scan.png differ diff --git a/static/scene(1).png b/static/scene(1).png new file mode 100644 index 0000000..db7444e Binary files /dev/null and b/static/scene(1).png differ diff --git a/static/scene.png b/static/scene.png new file mode 100644 index 0000000..0ea0a26 Binary files /dev/null and b/static/scene.png differ diff --git a/static/scene/alarm.png b/static/scene/alarm.png new file mode 100644 index 0000000..f79bb52 Binary files /dev/null and b/static/scene/alarm.png differ diff --git a/static/scene/device.png b/static/scene/device.png new file mode 100644 index 0000000..669edff Binary files /dev/null and b/static/scene/device.png differ diff --git a/static/scene/once.png b/static/scene/once.png new file mode 100644 index 0000000..29180bd Binary files /dev/null and b/static/scene/once.png differ diff --git a/static/scene/product.png b/static/scene/product.png new file mode 100644 index 0000000..57c9e7d Binary files /dev/null and b/static/scene/product.png differ diff --git a/static/scene/relation.png b/static/scene/relation.png new file mode 100644 index 0000000..9887eea Binary files /dev/null and b/static/scene/relation.png differ diff --git a/static/scene/timing.png b/static/scene/timing.png new file mode 100644 index 0000000..98d1920 Binary files /dev/null and b/static/scene/timing.png differ diff --git a/static/scene_active.png b/static/scene_active.png new file mode 100644 index 0000000..5d954ea Binary files /dev/null and b/static/scene_active.png differ diff --git a/static/screenshot.png b/static/screenshot.png new file mode 100644 index 0000000..96c9270 Binary files /dev/null and b/static/screenshot.png differ diff --git a/static/startintercom.png b/static/startintercom.png new file mode 100644 index 0000000..4e7b255 Binary files /dev/null and b/static/startintercom.png differ diff --git a/static/state.png b/static/state.png new file mode 100644 index 0000000..6617cf8 Binary files /dev/null and b/static/state.png differ diff --git a/static/state_active.png b/static/state_active.png new file mode 100644 index 0000000..575841b Binary files /dev/null and b/static/state_active.png differ diff --git a/static/statistic_black.png b/static/statistic_black.png new file mode 100644 index 0000000..15cb6be Binary files /dev/null and b/static/statistic_black.png differ diff --git a/static/statistic_blue.png b/static/statistic_blue.png new file mode 100644 index 0000000..c18955f Binary files /dev/null and b/static/statistic_blue.png differ diff --git a/static/stoprecord.png b/static/stoprecord.png new file mode 100644 index 0000000..575e070 Binary files /dev/null and b/static/stoprecord.png differ diff --git a/static/switch.png b/static/switch.png new file mode 100644 index 0000000..0c021fc Binary files /dev/null and b/static/switch.png differ diff --git a/static/tag.png b/static/tag.png new file mode 100644 index 0000000..e8a13de Binary files /dev/null and b/static/tag.png differ diff --git a/static/time_black.png b/static/time_black.png new file mode 100644 index 0000000..ee42dc9 Binary files /dev/null and b/static/time_black.png differ diff --git a/static/time_blue.png b/static/time_blue.png new file mode 100644 index 0000000..140c47d Binary files /dev/null and b/static/time_blue.png differ diff --git a/static/trend.png b/static/trend.png new file mode 100644 index 0000000..dd2edd6 Binary files /dev/null and b/static/trend.png differ diff --git a/static/trend_active.png b/static/trend_active.png new file mode 100644 index 0000000..8df5169 Binary files /dev/null and b/static/trend_active.png differ diff --git a/static/upgrade.png b/static/upgrade.png new file mode 100644 index 0000000..9b5adae Binary files /dev/null and b/static/upgrade.png differ diff --git a/static/user.png b/static/user.png new file mode 100644 index 0000000..e560ff5 Binary files /dev/null and b/static/user.png differ diff --git a/static/user_active.png b/static/user_active.png new file mode 100644 index 0000000..534a81a Binary files /dev/null and b/static/user_active.png differ diff --git a/static/video.png b/static/video.png new file mode 100644 index 0000000..d348643 Binary files /dev/null and b/static/video.png differ diff --git a/static/weather/0.svg b/static/weather/0.svg new file mode 100644 index 0000000..f864fc4 --- /dev/null +++ b/static/weather/0.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/1.svg b/static/weather/1.svg new file mode 100644 index 0000000..3bc0a06 --- /dev/null +++ b/static/weather/1.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/10.svg b/static/weather/10.svg new file mode 100644 index 0000000..6a31c6b --- /dev/null +++ b/static/weather/10.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/11.svg b/static/weather/11.svg new file mode 100644 index 0000000..52d0d55 --- /dev/null +++ b/static/weather/11.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/12.svg b/static/weather/12.svg new file mode 100644 index 0000000..e785133 --- /dev/null +++ b/static/weather/12.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/13.svg b/static/weather/13.svg new file mode 100644 index 0000000..debc80d --- /dev/null +++ b/static/weather/13.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/14.svg b/static/weather/14.svg new file mode 100644 index 0000000..5bbcb57 --- /dev/null +++ b/static/weather/14.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/15.svg b/static/weather/15.svg new file mode 100644 index 0000000..b50c5f0 --- /dev/null +++ b/static/weather/15.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/16.svg b/static/weather/16.svg new file mode 100644 index 0000000..d1b7fbe --- /dev/null +++ b/static/weather/16.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/17.svg b/static/weather/17.svg new file mode 100644 index 0000000..edb4de0 --- /dev/null +++ b/static/weather/17.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/18.svg b/static/weather/18.svg new file mode 100644 index 0000000..edb4de0 --- /dev/null +++ b/static/weather/18.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/19.svg b/static/weather/19.svg new file mode 100644 index 0000000..d9a5232 --- /dev/null +++ b/static/weather/19.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/2.svg b/static/weather/2.svg new file mode 100644 index 0000000..288d2f2 --- /dev/null +++ b/static/weather/2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/20.svg b/static/weather/20.svg new file mode 100644 index 0000000..6dd7a57 --- /dev/null +++ b/static/weather/20.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/21.svg b/static/weather/21.svg new file mode 100644 index 0000000..128360d --- /dev/null +++ b/static/weather/21.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/22.svg b/static/weather/22.svg new file mode 100644 index 0000000..31d6c16 --- /dev/null +++ b/static/weather/22.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/23.svg b/static/weather/23.svg new file mode 100644 index 0000000..302cc2e --- /dev/null +++ b/static/weather/23.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/24.svg b/static/weather/24.svg new file mode 100644 index 0000000..995f22e --- /dev/null +++ b/static/weather/24.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/25.svg b/static/weather/25.svg new file mode 100644 index 0000000..e7af626 --- /dev/null +++ b/static/weather/25.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/26.svg b/static/weather/26.svg new file mode 100644 index 0000000..fd376c0 --- /dev/null +++ b/static/weather/26.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/27.svg b/static/weather/27.svg new file mode 100644 index 0000000..fd376c0 --- /dev/null +++ b/static/weather/27.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/28.svg b/static/weather/28.svg new file mode 100644 index 0000000..8bc7c43 Binary files /dev/null and b/static/weather/28.svg differ diff --git a/static/weather/29.svg b/static/weather/29.svg new file mode 100644 index 0000000..c45c84c Binary files /dev/null and b/static/weather/29.svg differ diff --git a/static/weather/3.svg b/static/weather/3.svg new file mode 100644 index 0000000..477183b --- /dev/null +++ b/static/weather/3.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/30.svg b/static/weather/30.svg new file mode 100644 index 0000000..b0e0544 --- /dev/null +++ b/static/weather/30.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/31.svg b/static/weather/31.svg new file mode 100644 index 0000000..f0a905c --- /dev/null +++ b/static/weather/31.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/33.svg b/static/weather/33.svg new file mode 100644 index 0000000..095e637 --- /dev/null +++ b/static/weather/33.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/34.svg b/static/weather/34.svg new file mode 100644 index 0000000..17ba8fe --- /dev/null +++ b/static/weather/34.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/35.svg b/static/weather/35.svg new file mode 100644 index 0000000..17ba8fe --- /dev/null +++ b/static/weather/35.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/36.svg b/static/weather/36.svg new file mode 100644 index 0000000..619cfbc --- /dev/null +++ b/static/weather/36.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/37.svg b/static/weather/37.svg new file mode 100644 index 0000000..58d21e1 --- /dev/null +++ b/static/weather/37.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/38.svg b/static/weather/38.svg new file mode 100644 index 0000000..32f690f --- /dev/null +++ b/static/weather/38.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/4.svg b/static/weather/4.svg new file mode 100644 index 0000000..44946c9 --- /dev/null +++ b/static/weather/4.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/5.svg b/static/weather/5.svg new file mode 100644 index 0000000..71dacf2 --- /dev/null +++ b/static/weather/5.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/6.svg b/static/weather/6.svg new file mode 100644 index 0000000..021d636 --- /dev/null +++ b/static/weather/6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/7.svg b/static/weather/7.svg new file mode 100644 index 0000000..638330a --- /dev/null +++ b/static/weather/7.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/8.svg b/static/weather/8.svg new file mode 100644 index 0000000..021d636 --- /dev/null +++ b/static/weather/8.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/weather/9.svg b/static/weather/9.svg new file mode 100644 index 0000000..ca3d9e1 --- /dev/null +++ b/static/weather/9.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/wechat_bind.png b/static/wechat_bind.png new file mode 100644 index 0000000..daca743 Binary files /dev/null and b/static/wechat_bind.png differ diff --git a/static/wechat_unbind.png b/static/wechat_unbind.png new file mode 100644 index 0000000..5f80550 Binary files /dev/null and b/static/wechat_unbind.png differ diff --git a/static/wifi.png b/static/wifi.png new file mode 100644 index 0000000..2896091 Binary files /dev/null and b/static/wifi.png differ diff --git a/static/wifi_0.png b/static/wifi_0.png new file mode 100644 index 0000000..54d6693 Binary files /dev/null and b/static/wifi_0.png differ diff --git a/static/wifi_1.png b/static/wifi_1.png new file mode 100644 index 0000000..895ae95 Binary files /dev/null and b/static/wifi_1.png differ diff --git a/static/wifi_2.png b/static/wifi_2.png new file mode 100644 index 0000000..69c9c96 Binary files /dev/null and b/static/wifi_2.png differ diff --git a/static/wifi_3.png b/static/wifi_3.png new file mode 100644 index 0000000..6dd0e6a Binary files /dev/null and b/static/wifi_3.png differ diff --git a/static/wifi_4.png b/static/wifi_4.png new file mode 100644 index 0000000..5186c2a Binary files /dev/null and b/static/wifi_4.png differ diff --git a/store/$u.mixin.js b/store/$u.mixin.js new file mode 100644 index 0000000..292ff85 --- /dev/null +++ b/store/$u.mixin.js @@ -0,0 +1,32 @@ +// $u.mixin.js + +import { + mapState +} from 'vuex' +import store from "@/store" + +// 尝试将用户在根目录中的store/index.js的vuex的state变量,全部加载到全局变量中 +let $uStoreKey = []; +try { + $uStoreKey = store.state ? Object.keys(store.state) : []; +} catch (e) { + +} + +module.exports = { + created() { + // 将vuex方法挂在到$u中 + // 使用方法为:如果要修改vuex的state中的user.name变量为"史诗" => this.$u.vuex('user.name', '史诗') + // 如果要修改vuex的state的version变量为1.0.1 => this.$u.vuex('version', '1.0.1') + uni.$u.vuex = (name, value) => { + this.$store.commit('$uStore', { + name, + value + }) + } + }, + computed: { + // 将vuex的state中的所有变量,解构到全局混入的mixin中 + ...mapState($uStoreKey) + } +} diff --git a/store/index.js b/store/index.js new file mode 100644 index 0000000..3e3a2c0 --- /dev/null +++ b/store/index.js @@ -0,0 +1,78 @@ +import Vue from 'vue'; +import Vuex from 'vuex'; + +import permission from '@/store/modules/permission'; + +Vue.use(Vuex); + +// 需要永久存储,且下次APP启动需要取出的,在state中的变量名 +let saveStateKeys = ['vuex_token', 'profile']; + +// 保存变量到本地存储中 +const saveLifeData = function (key, value) { + // 判断变量名是否在需要存储的数组中 + if (saveStateKeys.indexOf(key) != -1) { + // 获取本地存储的lifeData对象,将变量添加到对象中 + let tmp = uni.getStorageSync('lifeData'); + // 第一次打开APP,不存在lifeData变量,故放一个{}空对象 + tmp = tmp ? tmp : {}; + tmp[key] = value; + // 执行这一步后,所有需要存储的变量,都挂载在本地的lifeData对象中 + uni.setStorageSync('lifeData', tmp); + } +} + +const store = new Vuex.Store({ + modules: { + permission, + }, + state: { + vuex_token: 'token', + profile: {}, + + + }, + getters: { + + }, + mutations: { + $uStore (state, payload) { + // 判断是否多层级调用,state中为对象存在的情况,诸如user.info.score = 1 + let nameArr = payload.name.split('.'); + let saveKey = ''; + let len = nameArr.length; + if (len >= 2) { + let obj = state[nameArr[0]]; + for (let i = 1; i < len - 1; i++) { + obj = obj[nameArr[i]]; + } + obj[nameArr[len - 1]] = payload.value; + saveKey = nameArr[0]; + } else { + // 单层级变量,在state就是一个普通变量的情况 + state[payload.name] = payload.value; + saveKey = payload.name; + } + // 保存变量到本地,见顶部函数定义 + saveLifeData(saveKey, state[saveKey]) + }, + + }, + actions: { + + + }, +}) + +// 从缓存中取得相同的key进行覆盖操作 +let lifeData = uni.getStorageSync('lifeData') || {}; +for (let key in lifeData) { + if (store.state.hasOwnProperty(key)) { + store.commit('$uStore', { + name: key, + value: lifeData[key] + }) + } +} + +export default store; \ No newline at end of file diff --git a/store/modules/permission.js b/store/modules/permission.js new file mode 100644 index 0000000..79fd25e --- /dev/null +++ b/store/modules/permission.js @@ -0,0 +1,156 @@ +import permision from "@/utils/permission.js"; + +const state = { + ACCESS_FINE_LOCATION: false, + CAMERA: false, + READ_EXTERNAL_STORAGE: false, + /* #ifdef APP-PLUS */ + isIos: plus.os.name == "iOS", + /* #endif */ + mapping: { + 'ACCESS_FINE_LOCATION': { + title: "位置信息权限说明", + content: "便于您使用该功能获取当前位置天气情况、WIFI列表等场景。", + methods: 'SET_ACCESS_FINE_LOCATION' + }, + 'CAMERA': { + title: "相机权限说明", + content: "便于您使用该功能扫码添加设备。", + methods: 'SET_CAMERA' + }, + 'READ_EXTERNAL_STORAGE': { + title: "存储空间/照片权限说明", + content: "便于您使用该功能上传您的照片/图片及用于更换头像与扫描添加设备等场景中读取和写入相册和文件内容。", + methods: 'SET_READ_EXTERNAL_STORAGE' + }, + } +} +const mutations = { + SET_ACCESS_FINE_LOCATION (state, val) { + state.ACCESS_FINE_LOCATION = val; + }, + SET_CAMERA (state, val) { + state.CAMERA = val; + }, + SET_READ_EXTERNAL_STORAGE (state, val) { + state.READ_EXTERNAL_STORAGE = val; + } +} +const actions = { + //权限获取 + async requestPermissions ({ + state, + dispatch, + commit + }, permissionID) { + try { + if (!state[permissionID] && !state.isIos) { + var viewObj = await dispatch('nativeObjView', permissionID); + viewObj.show(); + } + return new Promise(async (resolve, reject) => { + //苹果不需要这个 + if (state.isIos) { + resolve(1); + return; + } + // Android权限查询 + const result = await permision.requestAndroidPermission( + 'android.permission.' + permissionID + ); + if (result === 1) { + //'已获得授权' + commit(state.mapping[permissionID].methods, true); + } else if (result === 0) { + //'未获得授权' + commit(state.mapping[permissionID].methods, false); + } else { + commit(state.mapping[permissionID].methods, true); + uni.showModal({ + title: '提示', + content: '操作权限已被拒绝,请手动前往设置', + confirmText: "立即设置", + success: (res) => { + if (res.confirm) { + permision.gotoAppPermissionSetting(); + } + } + }) + } + if (viewObj) viewObj.close(); + resolve(result); + }); + } catch (error) { + console.log(error); + reject(error); + } + }, + //提示框 + nativeObjView ({ state }, permissionID) { + const systemInfo = uni.getSystemInfoSync(); + const statusBarHeight = systemInfo.statusBarHeight; + const navigationBarHeight = systemInfo.platform === 'android' ? 48 : + 44; // Set the navigation bar height based on the platform + const totalHeight = statusBarHeight + navigationBarHeight; + let view = new plus.nativeObj.View('per-modal', { + top: '0px', + left: '0px', + width: '100%', + backgroundColor: '#444', + }); + view.drawRect({ + color: '#fff', + radius: '10px' + }, { + top: totalHeight + 'px', + left: '5%', + width: '90%', + height: "100px", + }); + view.drawText(state.mapping[permissionID].title, { + top: totalHeight + 7 + 'px', + left: "10%", + height: "32px" + }, { + align: "left", + color: "#000", + }, { + onClick: function (e) { + console.log(e); + } + }); + view.drawText(state.mapping[permissionID].content, { + top: totalHeight + 35 + 'px', + height: "62px", + left: "10%", + width: "80%" + }, { + whiteSpace: 'normal', + size: "14px", + align: "left", + color: "#656563" + }); + + function show () { + view = plus.nativeObj.View.getViewById('per-modal'); + view.show() + view = null //展示的时候也得清空,不然影响下次的关闭,不知道为啥 + }; + + function close () { + view = plus.nativeObj.View.getViewById('per-modal'); + view.close(); + view = null + }; + return { + show, + close + }; + }, +} +export default { + namespaced: true, + state, + mutations, + actions +}; \ No newline at end of file diff --git a/uni.scss b/uni.scss new file mode 100644 index 0000000..9502fad --- /dev/null +++ b/uni.scss @@ -0,0 +1,80 @@ +/** + * 这里是uni-app内置的常用样式变量 + * + * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量 + * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App + * + */ + +/** + * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能 + * + * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件 + */ + +/* 颜色变量 */ + +/* 行为相关颜色 */ +$uni-color-primary: #007aff; +$uni-color-success: #4cd964; +$uni-color-warning: #f0ad4e; +$uni-color-error: #dd524d; + +/* 文字基本颜色 */ +$uni-text-color: #333; //基本色 +$uni-text-color-inverse: #fff; //反色 +$uni-text-color-grey: #999; //辅助灰色,如加载更多的提示信息 +$uni-text-color-placeholder: #808080; +$uni-text-color-disable: #c0c0c0; + +/* 背景颜色 */ +$uni-bg-color: #ffffff; +$uni-bg-color-grey: #f8f8f8; +$uni-bg-color-hover: #f1f1f1; //点击状态颜色 +$uni-bg-color-mask: rgba(0, 0, 0, 0.4); //遮罩颜色 + +/* 边框颜色 */ +$uni-border-color: #c8c7cc; + +/* 尺寸变量 */ + +/* 文字尺寸 */ +$uni-font-size-sm: 24rpx; +$uni-font-size-base: 28rpx; +$uni-font-size-lg: 32rpx; + +/* 图片尺寸 */ +$uni-img-size-sm: 40rpx; +$uni-img-size-base: 52rpx; +$uni-img-size-lg: 80rpx; + +/* Border Radius */ +$uni-border-radius-sm: 4rpx; +$uni-border-radius-base: 6rpx; +$uni-border-radius-lg: 12rpx; +$uni-border-radius-circle: 50%; + +/* 水平间距 */ +$uni-spacing-row-sm: 10px; +$uni-spacing-row-base: 20rpx; +$uni-spacing-row-lg: 30rpx; + +/* 垂直间距 */ +$uni-spacing-col-sm: 8rpx; +$uni-spacing-col-base: 16rpx; +$uni-spacing-col-lg: 24rpx; + +/* 透明度 */ +$uni-opacity-disabled: 0.3; // 组件禁用态的透明度 + +/* 文章场景相关 */ +$uni-color-title: #2c405a; // 文章标题颜色 +$uni-font-size-title: 40rpx; +$uni-color-subtitle: #555555; // 二级标题颜色 +$uni-font-size-subtitle: 36rpx; +$uni-color-paragraph: #3f536e; // 文章段落颜色 +$uni-font-size-paragraph: 30rpx; + + +/* uni.scss */ +@import '@/uni_modules/uview-ui/theme.scss'; diff --git a/uni_modules/jessibuca/hybrid/h5.html b/uni_modules/jessibuca/hybrid/h5.html new file mode 100644 index 0000000..7d321ba --- /dev/null +++ b/uni_modules/jessibuca/hybrid/h5.html @@ -0,0 +1,195 @@ + + + + + + 监控详情页 + + + +
+
+ +
+
+
+ +
+
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ +
+
+ + + + + + + + + diff --git a/uni_modules/jessibuca/hybrid/index.html b/uni_modules/jessibuca/hybrid/index.html new file mode 100644 index 0000000..41881a3 --- /dev/null +++ b/uni_modules/jessibuca/hybrid/index.html @@ -0,0 +1,28 @@ + + + + + + + + <%= htmlWebpackPlugin.options.title %> + + + + + + + + +
+ + + + + diff --git a/uni_modules/qiun-data-charts/changelog.md b/uni_modules/qiun-data-charts/changelog.md new file mode 100644 index 0000000..4829f18 --- /dev/null +++ b/uni_modules/qiun-data-charts/changelog.md @@ -0,0 +1,246 @@ +## 2.4.3-20220505(2022-05-05) +- 秋云图表组件 修复开启canvas2d后将series赋值为空数组显示加载图标时,再次赋值后画布闪动的bug +- 秋云图表组件 修复升级hbx最新版后ECharts的highlight方法报错的bug +- uCharts.js 雷达图新增参数opts.extra.radar.gridEval,数据点位网格抽希,默认1 +- uCharts.js 雷达图新增参数opts.extra.radar.axisLabel, 是否显示刻度点值,默认false +- uCharts.js 雷达图新增参数opts.extra.radar.axisLabelTofix,刻度点值小数位数,默认0 +- uCharts.js 雷达图新增参数opts.extra.radar.labelPointShow,是否显示末端刻度圆点,默认false +- uCharts.js 雷达图新增参数opts.extra.radar.labelPointRadius,刻度圆点的半径,默认3 +- uCharts.js 雷达图新增参数opts.extra.radar.labelPointColor,刻度圆点的颜色,默认#cccccc +- uCharts.js 雷达图新增参数opts.extra.radar.linearType,渐变色类型,可选值"none"关闭渐变,"custom"开启渐变 +- uCharts.js 雷达图新增参数opts.extra.radar.customColor,自定义渐变颜色,数组类型对应series的数组长度以匹配不同series颜色的不同配色方案,例如["#FA7D8D", "#EB88E2"] +- uCharts.js 雷达图优化支持series.textColor、series.textSize属性 +- uCharts.js 柱状图中温度计式图标,优化支持全圆角类型,修复边框有缝隙的bug,详见官网【演示】中的温度计图表 +- uCharts.js 柱状图新增参数opts.extra.column.activeWidth,当前点击柱状图的背景宽度,默认一个单元格单位 +- uCharts.js 混合图增加opts.extra.mix.area.gradient 区域图是否开启渐变色 +- uCharts.js 混合图增加opts.extra.mix.area.opacity 区域图透明度,默认0.2 +- uCharts.js 饼图、圆环图、玫瑰图、漏斗图,增加opts.series[0].data[i].labelText,自定义标签文字,避免formatter格式化的繁琐,详见官网【演示】中的饼图 +- uCharts.js 饼图、圆环图、玫瑰图、漏斗图,增加opts.series[0].data[i].labelShow,自定义是否显示某一个指示标签,避免因饼图类别太多导致标签重复或者居多导致图形变形的问题,详见官网【演示】中的饼图 +- uCharts.js 增加opts.series[i].legendText/opts.series[0].data[i].legendText(与series.name同级)自定义图例显示文字的方法 +- uCharts.js 优化X轴、Y轴formatter格式化方法增加形参,统一为fromatter:function(value,index,opts){} +- uCharts.js 修复横屏模式下无法使用双指缩放方法的bug +- uCharts.js 修复当只有一条数据或者多条数据值相等的时候Y轴自动计算的最大值错误的bug +- 【官网模板】增加外部自定义图例与图表交互的例子,[点击跳转](https://www.ucharts.cn/v2/#/layout/info?id=2) + +## 注意:非unimodules 版本如因更新 hbx 至 3.4.7 导致报错如下,请到码云更新非 unimodules 版本组件,[点击跳转](https://gitee.com/uCharts/uCharts/tree/master/uni-app/uCharts-%E7%BB%84%E4%BB%B6) +> Error in callback for immediate watcher "uchartsOpts": "SyntaxError: Unexpected token u in JSON at position 0" +## 2.4.2-20220421(2022-04-21) +- 秋云图表组件 修复HBX升级3.4.6.20220420版本后echarts报错的问题 +## 2.4.2-20220420(2022-04-20) +## 重要!此版本uCharts新增了很多功能,修复了诸多已知问题 +- 秋云图表组件 新增onzoom开启双指缩放功能(仅uCharts),前提需要直角坐标系类图表类型,并且ontouch为true、opts.enableScroll为true,详见实例项目K线图 +- 秋云图表组件 新增optsWatch是否监听opts变化,关闭optsWatch后,动态修改opts不会触发图表重绘 +- 秋云图表组件 修复开启canvas2d功能后,动态更新数据后画布闪动的bug +- 秋云图表组件 去除directory属性,改为自动获取echarts.min.js路径(升级不受影响) +- 秋云图表组件 增加getImage()方法及@getImage事件,通过ref调用getImage()方法获,触发@getImage事件获取当前画布的base64图片文件流。 +- 秋云图表组件 支付宝、字节跳动、飞书、快手小程序支持开启canvas2d同层渲染设置。 +- 秋云图表组件 新增加【非uniCloud】版本组件,避免有些不需要uniCloud的使用组件发布至小程序需要提交隐私声明问题,请到码云[【非uniCloud版本】](https://gitee.com/uCharts/uCharts/tree/master/uni-app/uCharts-%E7%BB%84%E4%BB%B6),或npm[【非uniCloud版本】](https://www.npmjs.com/package/@qiun/uni-ucharts)下载使用。 +- uCharts.js 新增dobuleZoom双指缩放功能 +- uCharts.js 新增山峰图type="mount",数据格式为饼图类格式,不需要传入categories,具体详见新版官网在线演示 +- uCharts.js 修复折线图当数据中存在null时tooltip报错的bug +- uCharts.js 修复饼图类当画布比较小时自动计算的半径是负数报错的bug +- uCharts.js 统一各图表类型的series.formatter格式化方法的形参为(val, index, series, opts),方便格式化时有更多参数可用 +- uCharts.js 标记线功能增加labelText自定义显示文字,增加labelAlign标签显示位置(左侧或右侧),增加标签显示位置微调labelOffsetX、labelOffsetY +- uCharts.js 修复条状图当数值很小时开启圆角后样式错误的bug +- uCharts.js 修复X轴开启disabled后,X轴仍占用空间的bug +- uCharts.js 修复X轴开启滚动条并且开启rotateLabel后,X轴文字与滚动条重叠的bug +- uCharts.js 增加X轴rotateAngle文字旋转自定义角度,取值范围(-90至90) +- uCharts.js 修复地图文字标签层级显示不正确的bug +- uCharts.js 修复饼图、圆环图、玫瑰图当数据全部为0的时候不显示数据标签的bug +- uCharts.js 修复当opts.padding上边距为0时,Y轴顶部刻度标签位置不正确的bug + +## 另外我们还开发了各大原生小程序组件,已发布至码云和npm +[https://gitee.com/uCharts/uCharts](https://gitee.com/uCharts/uCharts) +[https://www.npmjs.com/~qiun](https://www.npmjs.com/~qiun) + +## 对于原生uCharts文档我们已上线新版官方网站,详情点击下面链接进入官网 +[https://www.uCharts.cn/v2/](https://www.ucharts.cn/v2/) +## 2.3.7-20220122(2022-01-22) +## 重要!使用vue3编译,请使用cli模式并升级至最新依赖,HbuilderX编译需要使用3.3.8以上版本 +- uCharts.js 修复uni-app平台组件模式使用vue3编译到小程序报错的bug。 +## 2.3.7-20220118(2022-01-18) +## 注意,使用vue3的前提是需要3.3.8.20220114-alpha版本的HBuilder! +## 2.3.67-20220118(2022-01-18) +- 秋云图表组件 组件初步支持vue3,全端编译会有些问题,具体详见下面修改: +1. 小程序端运行时,在uni_modules文件夹的qiun-data-charts.js中搜索 new uni_modules_qiunDataCharts_js_sdk_uCharts_uCharts.uCharts,将.uCharts去掉。 +2. 小程序端发行时,在uni_modules文件夹的qiun-data-charts.js中搜索 new e.uCharts,将.uCharts去掉,变为 new e。 +3. 如果觉得上述步骤比较麻烦,如果您的项目只编译到小程序端,可以修改u-charts.js最后一行导出方式,将 export default uCharts;变更为 export default { uCharts: uCharts }; 这样变更后,H5和App端的renderjs会有问题,请开发者自行选择。(此问题非组件问题,请等待DC官方修复Vue3的小程序端) +## 2.3.6-20220111(2022-01-11) +- 秋云图表组件 修改组件 props 属性中的 background 默认值为 rgba(0,0,0,0) +## 2.3.6-20211201(2021-12-01) +- uCharts.js 修复bar条状图开启圆角模式时,值很小时圆角渲染错误的bug +## 2.3.5-20211014(2021-10-15) +- uCharts.js 增加vue3的编译支持(仅原生uCharts,qiun-data-charts组件后续会支持,请关注更新) +## 2.3.4-20211012(2021-10-12) +- 秋云图表组件 修复 mac os x 系统 mouseover 事件丢失的 bug +## 2.3.3-20210706(2021-07-06) +- uCharts.js 增加雷达图开启数据点值(opts.dataLabel)的显示 +## 2.3.2-20210627(2021-06-27) +- 秋云图表组件 修复tooltipCustom个别情况下传值不正确报错TypeError: Cannot read property 'name' of undefined的bug +## 2.3.1-20210616(2021-06-16) +- uCharts.js 修复圆角柱状图使用4角圆角时,当数值过大时不正确的bug +## 2.3.0-20210612(2021-06-12) +- uCharts.js 【重要】uCharts增加nvue兼容,可在nvue项目中使用gcanvas组件渲染uCharts,[详见码云uCharts-demo-nvue](https://gitee.com/uCharts/uCharts) +- 秋云图表组件 增加tapLegend属性,是否开启图例点击交互事件 +- 秋云图表组件 getIndex事件中增加返回uCharts实例中的opts参数,以便在页面中调用参数 +- 示例项目 pages/other/other.vue增加app端自定义tooltip的方法,详见showOptsTooltip方法 +## 2.2.1-20210603(2021-06-03) +- uCharts.js 修复饼图、圆环图、玫瑰图,当起始角度不为0时,tooltip位置不准确的bug +- uCharts.js 增加温度计式柱状图开启顶部半圆形的配置 +## 2.2.0-20210529(2021-05-29) +- uCharts.js 增加条状图type="bar" +- 示例项目 pages/ucharts/ucharts.vue增加条状图的demo +## 2.1.7-20210524(2021-05-24) +- uCharts.js 修复大数据量模式下曲线图不平滑的bug +## 2.1.6-20210523(2021-05-23) +- 秋云图表组件 修复小程序端开启滚动条更新数据后滚动条位置不符合预期的bug +## 2.1.5-2021051702(2021-05-17) +- uCharts.js 修复自定义Y轴min和max值为0时不能正确显示的bug +## 2.1.5-20210517(2021-05-17) +- uCharts.js 修复Y轴自定义min和max时,未按指定的最大值最小值显示坐标轴刻度的bug +## 2.1.4-20210516(2021-05-16) +- 秋云图表组件 优化onWindowResize防抖方法 +- 秋云图表组件 修复APP端uCharts更新数据时,清空series显示loading图标后再显示图表,图表抖动的bug +- uCharts.js 修复开启canvas2d后,x轴、y轴、series自定义字体大小未按比例缩放的bug +- 示例项目 修复format-e.vue拼写错误导致app端使用uCharts渲染图表 +## 2.1.3-20210513(2021-05-13) +- 秋云图表组件 修改uCharts变更chartData数据为updateData方法,支持带滚动条的数据动态打点 +- 秋云图表组件 增加onWindowResize防抖方法 fix by ど誓言,如尘般染指流年づ +- 秋云图表组件 H5或者APP变更chartData数据显示loading图表时,原数据闪现的bug +- 秋云图表组件 props增加errorReload禁用错误点击重新加载的方法 +- uCharts.js 增加tooltip显示category(x轴对应点位)标题的功能,opts.extra.tooltip.showCategory,默认为false +- uCharts.js 修复mix混合图只有柱状图时,tooltip的分割线显示位置不正确的bug +- uCharts.js 修复开启滚动条,图表在拖动中动态打点,滚动条位置不正确的bug +- uCharts.js 修复饼图类数据格式为echarts数据格式,series为空数组报错的bug +- 示例项目 修改uCharts.js更新到v2.1.2版本后,@getIndex方法获取索引值变更为e.currentIndex.index +- 示例项目 pages/updata/updata.vue增加滚动条拖动更新(数据动态打点)的demo +- 示例项目 pages/other/other.vue增加errorReload禁用错误点击重新加载的demo +## 2.1.2-20210509(2021-05-09) +秋云图表组件 修复APP端初始化时就传入chartData或lacaldata不显示图表的bug +## 2.1.1-20210509(2021-05-09) +- 秋云图表组件 变更ECharts的eopts配置在renderjs内执行,支持在config-echarts.js配置文件内写function配置。 +- 秋云图表组件 修复APP端报错Prop being mutated: "onmouse"错误的bug。 +- 秋云图表组件 修复APP端报错Error: Not Found:Page[6][-1,27] at view.umd.min.js:1的bug。 +## 2.1.0-20210507(2021-05-07) +- 秋云图表组件 修复初始化时就有数据或者数据更新的时候loading加载动画闪动的bug +- uCharts.js 修复x轴format方法categories为字符串类型时返回NaN的bug +- uCharts.js 修复series.textColor、legend.fontColor未执行全局默认颜色的bug +## 2.1.0-20210506(2021-05-06) +- 秋云图表组件 修复极个别情况下报错item.properties undefined的bug +- 秋云图表组件 修复极个别情况下关闭加载动画reshow不起作用,无法显示图表的bug +- 示例项目 pages/ucharts/ucharts.vue 增加时间轴折线图(type="tline")、时间轴区域图(type="tarea")、散点图(type="scatter")、气泡图demo(type="bubble")、倒三角形漏斗图(opts.extra.funnel.type="triangle")、金字塔形漏斗图(opts.extra.funnel.type="pyramid") +- 示例项目 pages/format-u/format-u.vue 增加X轴format格式化示例 +- uCharts.js 升级至v2.1.0版本 +- uCharts.js 修复 玫瑰图面积模式点击tooltip位置不正确的bug +- uCharts.js 修复 玫瑰图点击图例,只剩一个类别显示空白的bug +- uCharts.js 修复 饼图类图点击图例,其他图表tooltip位置某些情况下不准的bug +- uCharts.js 修复 x轴为矢量轴(时间轴)情况下,点击tooltip位置不正确的bug +- uCharts.js 修复 词云图获取点击索引偶尔不准的bug +- uCharts.js 增加 直角坐标系图表X轴format格式化方法(原生uCharts.js用法请使用formatter) +- uCharts.js 增加 漏斗图扩展配置,倒三角形(opts.extra.funnel.type="triangle"),金字塔形(opts.extra.funnel.type="pyramid") +- uCharts.js 增加 散点图(opts.type="scatter")、气泡图(opts.type="bubble") +- 后期计划 完善散点图、气泡图,增加markPoints标记点,增加横向条状图。 +## 2.0.0-20210502(2021-05-02) +- uCharts.js 修复词云图获取点击索引不正确的bug +## 2.0.0-20210501(2021-05-01) +- 秋云图表组件 修复QQ小程序、百度小程序在关闭动画效果情况下,v-for循环使用图表,显示不正确的bug +## 2.0.0-20210426(2021-04-26) +- 秋云图表组件 修复QQ小程序不支持canvas2d的bug +- 秋云图表组件 修复钉钉小程序某些情况点击坐标计算错误的bug +- uCharts.js 增加 extra.column.categoryGap 参数,柱状图类每个category点位(X轴点)柱子组之间的间距 +- uCharts.js 增加 yAxis.data[i].titleOffsetY 参数,标题纵向偏移距离,负数为向上偏移,正数向下偏移 +- uCharts.js 增加 yAxis.data[i].titleOffsetX 参数,标题横向偏移距离,负数为向左偏移,正数向右偏移 +- uCharts.js 增加 extra.gauge.labelOffset 参数,仪表盘标签文字径向便宜距离,默认13px +## 2.0.0-20210422-2(2021-04-22) +秋云图表组件 修复 formatterAssign 未判断 args[key] == null 的情况导致栈溢出的 bug +## 2.0.0-20210422(2021-04-22) +- 秋云图表组件 修复H5、APP、支付宝小程序、微信小程序canvas2d模式下横屏模式的bug +## 2.0.0-20210421(2021-04-21) +- uCharts.js 修复多行图例的情况下,图例在上方或者下方时,图例float为左侧或者右侧时,第二行及以后的图例对齐方式不正确的bug +## 2.0.0-20210420(2021-04-20) +- 秋云图表组件 修复微信小程序开启canvas2d模式后,windows版微信小程序不支持canvas2d模式的bug +- 秋云图表组件 修改非uni_modules版本为v2.0版本qiun-data-charts组件 +## 2.0.0-20210419(2021-04-19) +## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧绿色【使用HBuilderX导入插件】即可使用,示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。 +## 初次使用如果提示未注册<qiun-data-charts>组件,请重启HBuilderX,如仍不好用,请重启电脑; +## 如果是cli项目,请尝试清理node_modules,重新install,还不行就删除项目,再重新install。 +## 此问题已于DCloud官方确认,HBuilderX下个版本会修复。 +## 其他图表不显示问题详见[常见问题选项卡](https://demo.ucharts.cn) +## 新手请先完整阅读帮助文档及常见问题3遍,右侧蓝色按钮示例项目请看2遍! +## [DEMO演示及在线生成工具(v2.0文档)https://demo.ucharts.cn](https://demo.ucharts.cn) +## [图表组件在项目中的应用参见 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) +- uCharts.js 修复混合图中柱状图单独设置颜色不生效的bug +- uCharts.js 修复多Y轴单独设置fontSize时,开启canvas2d后,未对应放大字体的bug +## 2.0.0-20210418(2021-04-18) +- 秋云图表组件 增加directory配置,修复H5端history模式下如果发布到二级目录无法正确加载echarts.min.js的bug +## 2.0.0-20210416(2021-04-16) +## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧绿色【使用HBuilderX导入插件】即可使用,示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。 +## 初次使用如果提示未注册<qiun-data-charts>组件,请重启HBuilderX,如仍不好用,请重启电脑; +## 如果是cli项目,请尝试清理node_modules,重新install,还不行就删除项目,再重新install。 +## 此问题已于DCloud官方确认,HBuilderX下个版本会修复。 +## 其他图表不显示问题详见[常见问题选项卡](https://demo.ucharts.cn) +## 新手请先完整阅读帮助文档及常见问题3遍,右侧蓝色按钮示例项目请看2遍! +## [DEMO演示及在线生成工具(v2.0文档)https://demo.ucharts.cn](https://demo.ucharts.cn) +## [图表组件在项目中的应用参见 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) +- 秋云图表组件 修复APP端某些情况下报错`Not Found Page`的bug,fix by 高级bug开发技术员 +- 示例项目 修复APP端v-for循环某些情况下报错`Not Found Page`的bug,fix by 高级bug开发技术员 +- uCharts.js 修复非直角坐标系tooltip提示窗右侧超出未变换方向显示的bug +## 2.0.0-20210415(2021-04-15) +- 秋云图表组件 修复H5端发布到二级目录下echarts无法加载的bug +- 秋云图表组件 修复某些情况下echarts.off('finished')移除监听事件报错的bug +## 2.0.0-20210414(2021-04-14) +## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧绿色【使用HBuilderX导入插件】即可使用,示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。 +## 初次使用如果提示未注册<qiun-data-charts>组件,请重启HBuilderX,如仍不好用,请重启电脑; +## 如果是cli项目,请尝试清理node_modules,重新install,还不行就删除项目,再重新install。 +## 此问题已于DCloud官方确认,HBuilderX下个版本会修复。 +## 其他图表不显示问题详见[常见问题选项卡](https://demo.ucharts.cn) +## 新手请先完整阅读帮助文档及常见问题3遍,右侧蓝色按钮示例项目请看2遍! +## [DEMO演示及在线生成工具(v2.0文档)https://demo.ucharts.cn](https://demo.ucharts.cn) +## [图表组件在项目中的应用参见 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) +- 秋云图表组件 修复H5端在cli项目下ECharts引用地址错误的bug +- 示例项目 增加ECharts的formatter用法的示例(详见示例项目format-e.vue) +- uCharts.js 增加圆环图中心背景色的配置extra.ring.centerColor +- uCharts.js 修复微信小程序安卓端柱状图开启透明色后显示不正确的bug +## 2.0.0-20210413(2021-04-13) +- 秋云图表组件 修复百度小程序多个图表真机未能正确获取根元素dom尺寸的bug +- 秋云图表组件 修复百度小程序横屏模式方向不正确的bug +- 秋云图表组件 修改ontouch时,@getTouchStart@getTouchMove@getTouchEnd的触发条件 +- uCharts.js 修复饼图类数据格式series属性不生效的bug +- uCharts.js 增加时序区域图 详见示例项目中ucharts.vue +## 2.0.0-20210412-2(2021-04-12) +## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧绿色【使用HBuilderX导入插件】即可使用,示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。 +## 初次使用如果提示未注册<qiun-data-charts>组件,请重启HBuilderX。如仍不好用,请重启电脑,此问题已于DCloud官方确认,HBuilderX下个版本会修复。 +## [DEMO演示及在线生成工具(v2.0文档)https://demo.ucharts.cn](https://demo.ucharts.cn) +## [图表组件在uniCloudAdmin中的应用 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) +- 秋云图表组件 修复uCharts在APP端横屏模式下不能正确渲染的bug +- 示例项目 增加ECharts柱状图渐变色、圆角柱状图、横向柱状图(条状图)的示例 +## 2.0.0-20210412(2021-04-12) +- 秋云图表组件 修复created中判断echarts导致APP端无法识别,改回mounted中判断echarts初始化 +- uCharts.js 修复2d模式下series.textOffset未乘像素比的bug +## 2.0.0-20210411(2021-04-11) +## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧绿色【使用HBuilderX导入插件】即可使用,示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。 +## 初次使用如果提示未注册组件,请重启HBuilderX,并清空小程序开发者工具缓存。 +## [DEMO演示及在线生成工具(v2.0文档)https://demo.ucharts.cn](https://demo.ucharts.cn) +## [图表组件在uniCloudAdmin中的应用 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) +- uCharts.js 折线图区域图增加connectNulls断点续连的功能,详见示例项目中ucharts.vue +- 秋云图表组件 变更初始化方法为created,变更type2d默认值为true,优化2d模式下组件初始化后dom获取不到的bug +- 秋云图表组件 修复左右布局时,右侧图表点击坐标错误的bug,修复tooltip柱状图自定义颜色显示object的bug +## 2.0.0-20210410(2021-04-10) +- 修复左右布局时,右侧图表点击坐标错误的bug,修复柱状图自定义颜色tooltip显示object的bug +- 增加标记线及柱状图自定义颜色的demo +## 2.0.0-20210409(2021-04-08) +## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧【使用HBuilderX导入插件】即可体验,DEMO演示及在线生成工具(v2.0文档)[https://demo.ucharts.cn](https://demo.ucharts.cn) +## 图表组件在uniCloudAdmin中的应用 [UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) +- uCharts.js 修复钉钉小程序百度小程序measureText不准确的bug,修复2d模式下饼图类activeRadius为按比例放大的bug +- 修复组件在支付宝小程序端点击位置不准确的bug +## 2.0.0-20210408(2021-04-07) +- 修复组件在支付宝小程序端不能显示的bug(目前支付宝小程不能点击交互,后续修复) +- uCharts.js 修复高分屏下柱状图类,圆弧进度条 自定义宽度不能按比例放大的bug +## 2.0.0-20210407(2021-04-06) +## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧【使用HBuilderX导入插件】即可体验,DEMO演示及在线生成工具(v2.0文档)[https://demo.ucharts.cn](https://demo.ucharts.cn) +## 增加 通过tofix和unit快速格式化y轴的demo add by `howcode` +## 增加 图表组件在uniCloudAdmin中的应用 [UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) +## 2.0.0-20210406(2021-04-05) +# 秋云图表组件+uCharts v2.0版本同步上线,使用方法详见https://demo.ucharts.cn帮助页 +## 2.0.0(2021-04-05) +# 秋云图表组件+uCharts v2.0版本同步上线,使用方法详见https://demo.ucharts.cn帮助页 diff --git a/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue b/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue new file mode 100644 index 0000000..14e4365 --- /dev/null +++ b/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue @@ -0,0 +1,1607 @@ + + + + + + + + + + diff --git a/uni_modules/qiun-data-charts/components/qiun-error/qiun-error.vue b/uni_modules/qiun-data-charts/components/qiun-error/qiun-error.vue new file mode 100644 index 0000000..b15b19f --- /dev/null +++ b/uni_modules/qiun-data-charts/components/qiun-error/qiun-error.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/uni_modules/qiun-data-charts/components/qiun-loading/loading1.vue b/uni_modules/qiun-data-charts/components/qiun-loading/loading1.vue new file mode 100644 index 0000000..b701394 --- /dev/null +++ b/uni_modules/qiun-data-charts/components/qiun-loading/loading1.vue @@ -0,0 +1,162 @@ + + + + + diff --git a/uni_modules/qiun-data-charts/components/qiun-loading/loading2.vue b/uni_modules/qiun-data-charts/components/qiun-loading/loading2.vue new file mode 100644 index 0000000..7541b31 --- /dev/null +++ b/uni_modules/qiun-data-charts/components/qiun-loading/loading2.vue @@ -0,0 +1,170 @@ + + + + + diff --git a/uni_modules/qiun-data-charts/components/qiun-loading/loading3.vue b/uni_modules/qiun-data-charts/components/qiun-loading/loading3.vue new file mode 100644 index 0000000..8e14db3 --- /dev/null +++ b/uni_modules/qiun-data-charts/components/qiun-loading/loading3.vue @@ -0,0 +1,173 @@ + + + + + diff --git a/uni_modules/qiun-data-charts/components/qiun-loading/loading4.vue b/uni_modules/qiun-data-charts/components/qiun-loading/loading4.vue new file mode 100644 index 0000000..77c55b7 --- /dev/null +++ b/uni_modules/qiun-data-charts/components/qiun-loading/loading4.vue @@ -0,0 +1,222 @@ + + + + + diff --git a/uni_modules/qiun-data-charts/components/qiun-loading/loading5.vue b/uni_modules/qiun-data-charts/components/qiun-loading/loading5.vue new file mode 100644 index 0000000..cb93a55 --- /dev/null +++ b/uni_modules/qiun-data-charts/components/qiun-loading/loading5.vue @@ -0,0 +1,229 @@ + + + + diff --git a/uni_modules/qiun-data-charts/components/qiun-loading/qiun-loading.vue b/uni_modules/qiun-data-charts/components/qiun-loading/qiun-loading.vue new file mode 100644 index 0000000..7789060 --- /dev/null +++ b/uni_modules/qiun-data-charts/components/qiun-loading/qiun-loading.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/uni_modules/qiun-data-charts/js_sdk/u-charts/config-echarts.js b/uni_modules/qiun-data-charts/js_sdk/u-charts/config-echarts.js new file mode 100644 index 0000000..6bdef43 --- /dev/null +++ b/uni_modules/qiun-data-charts/js_sdk/u-charts/config-echarts.js @@ -0,0 +1,423 @@ +/* + * uCharts® + * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)、Vue、Taro等支持canvas的框架平台 + * Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved. + * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) + * 复制使用请保留本段注释,感谢支持开源! + * + * uCharts®官方网站 + * https://www.uCharts.cn + * + * 开源地址: + * https://gitee.com/uCharts/uCharts + * + * uni-app插件市场地址: + * http://ext.dcloud.net.cn/plugin?id=271 + * + */ + +// 通用配置项 + +// 主题颜色配置:如每个图表类型需要不同主题,请在对应图表类型上更改color属性 +const color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc']; + +const cfe = { + //demotype为自定义图表类型 + "type": ["pie", "ring", "rose", "funnel", "line", "column", "area", "radar", "gauge","candle","demotype"], + //增加自定义图表类型,如果需要categories,请在这里加入您的图表类型例如最后的"demotype" + "categories": ["line", "column", "area", "radar", "gauge", "candle","demotype"], + //instance为实例变量承载属性,option为eopts承载属性,不要删除 + "instance": {}, + "option": {}, + //下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换 + "formatter":{ + "tooltipStatistic":function(){}, + "tooltipDemo1":function(res){ + let result = '' + for (let i in res) { + if (i == 0) { + result += res[i].axisValueLabel + '年销售额' + } + let value = '--' + if (res[i].data !== null) { + value = res[i].data + } + // #ifdef H5 + result += '\n' + res[i].seriesName + ':' + value + ' 万元' + // #endif + + // #ifdef APP-PLUS + result += '
' + res[i].marker + res[i].seriesName + ':' + value + ' 万元' + // #endif + } + return result; + }, + legendFormat:function(name){ + return "自定义图例+"+name; + }, + yAxisFormatDemo:function (value, index) { + return value + '元'; + }, + seriesFormatDemo:function(res){ + return res.name + '年' + res.value + '元'; + } + }, + //这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在eopts参数,会将demotype与eopts中option合并后渲染图表。 + "demotype":{ + "color": color, + //在这里填写echarts的option即可 + + }, + //下面是自定义配置,请添加项目所需的通用配置 + "column": { + "color": color, + "title": { + "text": '' + }, + "tooltip": { + "trigger": 'axis' + }, + "grid": { + "top": 30, + "bottom": 50, + "right": 15, + "left": 40 + }, + "legend": { + "bottom": 'left', + }, + "toolbox": { + "show": false, + }, + "xAxis": { + "type": 'category', + "axisLabel": { + "color": '#666666' + }, + "axisLine": { + "lineStyle": { + "color": '#CCCCCC' + } + }, + "boundaryGap": true, + "data": [] + }, + "yAxis": { + "type": 'value', + "axisTick": { + "show": false, + }, + "axisLabel": { + "color": '#666666' + }, + "axisLine": { + "lineStyle": { + "color": '#CCCCCC' + } + }, + }, + "seriesTemplate": { + "name": '', + "type": 'bar', + "data": [], + "barwidth": 20, + "label": { + "show": true, + "color": "#666666", + "position": 'top', + }, + }, + }, + "line": { + "color": color, + "title": { + "text": '' + }, + "tooltip": { + "trigger": 'axis' + }, + "grid": { + "top": 30, + "bottom": 50, + "right": 15, + "left": 40 + }, + "legend": { + "bottom": 'left', + }, + "toolbox": { + "show": false, + }, + "xAxis": { + "type": 'category', + "axisLabel": { + "color": '#666666' + }, + "axisLine": { + "lineStyle": { + "color": '#CCCCCC' + } + }, + "boundaryGap": true, + "data": [] + }, + "yAxis": { + "type": 'value', + "axisTick": { + "show": false, + }, + "axisLabel": { + "color": '#666666' + }, + "axisLine": { + "lineStyle": { + "color": '#CCCCCC' + } + }, + }, + "seriesTemplate": { + "name": '', + "type": 'line', + "data": [], + "barwidth": 20, + "label": { + "show": true, + "color": "#666666", + "position": 'top', + }, + }, + }, + "area": { + "color": color, + "title": { + "text": '' + }, + "tooltip": { + "trigger": 'axis' + }, + "grid": { + "top": 30, + "bottom": 50, + "right": 15, + "left": 40 + }, + "legend": { + "bottom": 'left', + }, + "toolbox": { + "show": false, + }, + "xAxis": { + "type": 'category', + "axisLabel": { + "color": '#666666' + }, + "axisLine": { + "lineStyle": { + "color": '#CCCCCC' + } + }, + "boundaryGap": true, + "data": [] + }, + "yAxis": { + "type": 'value', + "axisTick": { + "show": false, + }, + "axisLabel": { + "color": '#666666' + }, + "axisLine": { + "lineStyle": { + "color": '#CCCCCC' + } + }, + }, + "seriesTemplate": { + "name": '', + "type": 'line', + "data": [], + "areaStyle": {}, + "label": { + "show": true, + "color": "#666666", + "position": 'top', + }, + }, + }, + "pie": { + "color": color, + "title": { + "text": '' + }, + "tooltip": { + "trigger": 'item' + }, + "grid": { + "top": 40, + "bottom": 30, + "right": 15, + "left": 15 + }, + "legend": { + "bottom": 'left', + }, + "seriesTemplate": { + "name": '', + "type": 'pie', + "data": [], + "radius": '50%', + "label": { + "show": true, + "color": "#666666", + "position": 'top', + }, + }, + }, + "ring": { + "color": color, + "title": { + "text": '' + }, + "tooltip": { + "trigger": 'item' + }, + "grid": { + "top": 40, + "bottom": 30, + "right": 15, + "left": 15 + }, + "legend": { + "bottom": 'left', + }, + "seriesTemplate": { + "name": '', + "type": 'pie', + "data": [], + "radius": ['40%', '70%'], + "avoidLabelOverlap": false, + "label": { + "show": true, + "color": "#666666", + "position": 'top', + }, + "labelLine": { + "show": true + }, + }, + }, + "rose": { + "color": color, + "title": { + "text": '' + }, + "tooltip": { + "trigger": 'item' + }, + "legend": { + "top": 'bottom' + }, + "seriesTemplate": { + "name": '', + "type": 'pie', + "data": [], + "radius": "55%", + "center": ['50%', '50%'], + "roseType": 'area', + }, + }, + "funnel": { + "color": color, + "title": { + "text": '' + }, + "tooltip": { + "trigger": 'item', + "formatter": "{b} : {c}%" + }, + "legend": { + "top": 'bottom' + }, + "seriesTemplate": { + "name": '', + "type": 'funnel', + "left": '10%', + "top": 60, + "bottom": 60, + "width": '80%', + "min": 0, + "max": 100, + "minSize": '0%', + "maxSize": '100%', + "sort": 'descending', + "gap": 2, + "label": { + "show": true, + "position": 'inside' + }, + "labelLine": { + "length": 10, + "lineStyle": { + "width": 1, + "type": 'solid' + } + }, + "itemStyle": { + "bordercolor": '#fff', + "borderwidth": 1 + }, + "emphasis": { + "label": { + "fontSize": 20 + } + }, + "data": [], + }, + }, + "gauge": { + "color": color, + "tooltip": { + "formatter": '{a}
{b} : {c}%' + }, + "seriesTemplate": { + "name": '业务指标', + "type": 'gauge', + "detail": {"formatter": '{value}%'}, + "data": [{"value": 50, "name": '完成率'}] + }, + }, + "candle": { + "xAxis": { + "data": [] + }, + "yAxis": {}, + "color": color, + "title": { + "text": '' + }, + "dataZoom": [{ + "type": 'inside', + "xAxisIndex": [0, 1], + "start": 10, + "end": 100 + }, + { + "show": true, + "xAxisIndex": [0, 1], + "type": 'slider', + "bottom": 10, + "start": 10, + "end": 100 + } + ], + "seriesTemplate": { + "name": '', + "type": 'k', + "data": [], + }, + } +} + +export default cfe; \ No newline at end of file diff --git a/uni_modules/qiun-data-charts/js_sdk/u-charts/config-ucharts.js b/uni_modules/qiun-data-charts/js_sdk/u-charts/config-ucharts.js new file mode 100644 index 0000000..f0fd69d --- /dev/null +++ b/uni_modules/qiun-data-charts/js_sdk/u-charts/config-ucharts.js @@ -0,0 +1,611 @@ +/* + * uCharts® + * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)、Vue、Taro等支持canvas的框架平台 + * Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved. + * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) + * 复制使用请保留本段注释,感谢支持开源! + * + * uCharts®官方网站 + * https://www.uCharts.cn + * + * 开源地址: + * https://gitee.com/uCharts/uCharts + * + * uni-app插件市场地址: + * http://ext.dcloud.net.cn/plugin?id=271 + * + */ + +// 主题颜色配置:如每个图表类型需要不同主题,请在对应图表类型上更改color属性 +const color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc']; + +//事件转换函数,主要用作格式化x轴为时间轴,根据需求自行修改 +const formatDateTime = (timeStamp, returnType)=>{ + var date = new Date(); + date.setTime(timeStamp * 1000); + var y = date.getFullYear(); + var m = date.getMonth() + 1; + m = m < 10 ? ('0' + m) : m; + var d = date.getDate(); + d = d < 10 ? ('0' + d) : d; + var h = date.getHours(); + h = h < 10 ? ('0' + h) : h; + var minute = date.getMinutes(); + var second = date.getSeconds(); + minute = minute < 10 ? ('0' + minute) : minute; + second = second < 10 ? ('0' + second) : second; + if(returnType == 'full'){return y + '-' + m + '-' + d + ' '+ h +':' + minute + ':' + second;} + if(returnType == 'y-m-d'){return y + '-' + m + '-' + d;} + if(returnType == 'h:m'){return h +':' + minute;} + if(returnType == 'h:m:s'){return h +':' + minute +':' + second;} + return [y, m, d, h, minute, second]; +} + +const cfu = { + //demotype为自定义图表类型,一般不需要自定义图表类型,只需要改根节点上对应的类型即可 + "type":["pie","ring","rose","word","funnel","map","arcbar","line","column","mount","bar","area","radar","gauge","candle","mix","tline","tarea","scatter","bubble","demotype"], + "range":["饼状图","圆环图","玫瑰图","词云图","漏斗图","地图","圆弧进度条","折线图","柱状图","山峰图","条状图","区域图","雷达图","仪表盘","K线图","混合图","时间轴折线","时间轴区域","散点图","气泡图","自定义类型"], + //增加自定义图表类型,如果需要categories,请在这里加入您的图表类型,例如最后的"demotype" + //自定义类型时需要注意"tline","tarea","scatter","bubble"等时间轴(矢量x轴)类图表,没有categories,不需要加入categories + "categories":["line","column","mount","bar","area","radar","gauge","candle","mix","demotype"], + //instance为实例变量承载属性,不要删除 + "instance":{}, + //option为opts及eopts承载属性,不要删除 + "option":{}, + //下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换 + "formatter":{ + // 提示窗 + "tooltipStatistic":function(item, category, index, opts){return opts.name+' '+item.data+' '+opts.unit}, + // 保留两位小数 + "dashboardKeepTwoDecimals":function(val,index,opts){ + const num=val+''; + if(num.indexOf('.')!=-1){ + return val.toFixed(1); + } + return val; + }, + "yAxisDemo1":function(val, index, opts){return val+'元'}, + "yAxisDemo2":function(val, index, opts){return val.toFixed(2)}, + "xAxisDemo1":function(val, index, opts){return val+'年';}, + "xAxisDemo2":function(val, index, opts){return formatDateTime(val,'h:m')}, + "seriesDemo1":function(val, index, series, opts){return val+'元'}, + "tooltipDemo1":function(item, category, index, opts){ + if(index==0){ + return '随便用'+item.data+'年' + }else{ + return '其他我没改'+item.data+'天' + } + }, + "pieDemo":function(val, index, series, opts){ + if(index !== undefined){ + return series[index].name+':'+series[index].data+'元' + } + }, + }, + //这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在opts参数,会将demotype与opts中option合并后渲染图表。 + "demotype":{ + //我这里把曲线图当做了自定义图表类型,您可以根据需要随意指定类型或配置 + "type": "line", + "color": color, + "padding": [15,10,0,15], + "xAxis": { + "disableGrid": true, + }, + "yAxis": { + "gridType": "dash", + "dashLength": 2, + }, + "legend": { + }, + "extra": { + "line": { + "type": "curve", + "width": 2 + }, + } + }, + //下面是自定义配置,请添加项目所需的通用配置 + "pie":{ + "type": "pie", + "color": color, + "padding": [5,5,5,5], + "extra": { + "pie": { + "activeOpacity": 0.5, + "activeRadius": 10, + "offsetAngle": 0, + "labelWidth": 15, + "border": true, + "borderWidth": 3, + "borderColor": "#FFFFFF" + }, + } + }, + "ring":{ + "type": "ring", + "color": color, + "padding": [5,5,5,5], + "rotate": false, + "dataLabel": true, + "legend": { + "show": true, + "position": "right", + "lineHeight": 25, + }, + "title": { + "name": "收益率", + "fontSize": 15, + "color": "#666666" + }, + "subtitle": { + "name": "70%", + "fontSize": 25, + "color": "#7cb5ec" + }, + "extra": { + "ring": { + "ringWidth":30, + "activeOpacity": 0.5, + "activeRadius": 10, + "offsetAngle": 0, + "labelWidth": 15, + "border": true, + "borderWidth": 3, + "borderColor": "#FFFFFF" + }, + }, + }, + "rose":{ + "type": "rose", + "color": color, + "padding": [5,5,5,5], + "legend": { + "show": true, + "position": "left", + "lineHeight": 25, + }, + "extra": { + "rose": { + "type": "area", + "minRadius": 50, + "activeOpacity": 0.5, + "activeRadius": 10, + "offsetAngle": 0, + "labelWidth": 15, + "border": false, + "borderWidth": 2, + "borderColor": "#FFFFFF" + }, + } + }, + "word":{ + "type": "word", + "color": color, + "extra": { + "word": { + "type": "normal", + "autoColors": false + } + } + }, + "funnel":{ + "type": "funnel", + "color": color, + "padding": [15,15,0,15], + "extra": { + "funnel": { + "activeOpacity": 0.3, + "activeWidth": 10, + "border": true, + "borderWidth": 2, + "borderColor": "#FFFFFF", + "fillOpacity": 1, + "labelAlign": "right" + }, + } + }, + "map":{ + "type": "map", + "color": color, + "padding": [0,0,0,0], + "dataLabel": true, + "extra": { + "map": { + "border": true, + "borderWidth": 1, + "borderColor": "#666666", + "fillOpacity": 0.6, + "activeBorderColor": "#F04864", + "activeFillColor": "#FACC14", + "activeFillOpacity": 1 + }, + } + }, + "arcbar":{ + "type": "arcbar", + "color": color, + "title": { + "name": "百分比", + "fontSize": 25, + "color": "#00FF00" + }, + "subtitle": { + "name": "默认标题", + "fontSize": 15, + "color": "#666666" + }, + "extra": { + "arcbar": { + "type": "default", + "width": 12, + "backgroundColor": "#E9E9E9", + "startAngle": 0.75, + "endAngle": 0.25, + "gap": 2 + } + } + }, + "line":{ + "type": "line", + "color": color, + "padding": [15,10,0,15], + "xAxis": { + "disableGrid": true, + }, + "yAxis": { + "gridType": "dash", + "dashLength": 2, + }, + "legend": { + }, + "extra": { + "line": { + "type": "straight", + "width": 2 + }, + } + }, + "tline":{ + "type": "line", + "color": color, + "padding": [15,10,0,15], + "xAxis": { + "disableGrid": false, + "boundaryGap":"justify", + }, + "yAxis": { + "gridType": "dash", + "dashLength": 2, + "data":[ + { + "min":0, + "max":80 + } + ] + }, + "legend": { + }, + "extra": { + "line": { + "type": "curve", + "width": 2 + }, + } + }, + "tarea":{ + "type": "area", + "color": color, + "padding": [15,10,0,15], + "xAxis": { + "disableGrid": true, + "boundaryGap":"justify", + }, + "yAxis": { + "gridType": "dash", + "dashLength": 2, + "data":[ + { + "min":0, + "max":80 + } + ] + }, + "legend": { + }, + "extra": { + "area": { + "type": "curve", + "opacity": 0.2, + "addLine": true, + "width": 2, + "gradient": true + }, + } + }, + "column":{ + "type": "column", + "color": color, + "padding": [15,15,0,5], + "xAxis": { + "disableGrid": true, + }, + "yAxis": { + "data":[{"min":0}] + }, + "legend": { + }, + "extra": { + "column": { + "type": "group", + "width": 30, + "activeBgColor": "#000000", + "activeBgOpacity": 0.08 + }, + } + }, + "mount":{ + "type": "mount", + "color": color, + "padding": [15,15,0,5], + "xAxis": { + "disableGrid": true, + }, + "yAxis": { + "data":[{"min":0}] + }, + "legend": { + }, + "extra": { + "mount": { + "type": "mount", + "widthRatio": 1.5, + }, + } + }, + "bar":{ + "type": "bar", + "color": color, + "padding": [15,30,0,5], + "xAxis": { + "boundaryGap":"justify", + "disableGrid":false, + "min":0, + "axisLine":false + }, + "yAxis": { + }, + "legend": { + }, + "extra": { + "bar": { + "type": "group", + "width": 30, + "meterBorde": 1, + "meterFillColor": "#FFFFFF", + "activeBgColor": "#000000", + "activeBgOpacity": 0.08 + }, + } + }, + "area":{ + "type": "area", + "color": color, + "padding": [15,15,0,15], + "xAxis": { + "disableGrid": true, + }, + "yAxis": { + "gridType": "dash", + "dashLength": 2, + }, + "legend": { + }, + "extra": { + "area": { + "type": "straight", + "opacity": 0.2, + "addLine": true, + "width": 2, + "gradient": false + }, + } + }, + "radar":{ + "type": "radar", + "color": color, + "padding": [5,5,5,5], + "dataLabel": false, + "legend": { + "show": true, + "position": "right", + "lineHeight": 25, + }, + "extra": { + "radar": { + "gridType": "radar", + "gridColor": "#CCCCCC", + "gridCount": 3, + "opacity": 0.2, + "max": 200 + }, + } + }, + "gauge":{ + "type": "gauge", + "color": color, + "title": { + "name": "66Km/H", + "fontSize": 25, + "color": "#2fc25b", + "offsetY": 50 + }, + "subtitle": { + "name": "实时速度", + "fontSize": 15, + "color": "#1890ff", + "offsetY": -50 + }, + "extra": { + "gauge": { + "type": "default", + "width": 30, + "labelColor": "#666666", + "startAngle": 0.75, + "endAngle": 0.25, + "startNumber": 0, + "endNumber": 100, + "labelFormat": "", + "splitLine": { + "fixRadius": 0, + "splitNumber": 10, + "width": 30, + "color": "#FFFFFF", + "childNumber": 5, + "childWidth": 12 + }, + "pointer": { + "width": 24, + "color": "auto" + } + } + } + }, + "candle":{ + "type": "candle", + "color": color, + "padding": [15,15,0,15], + "enableScroll": true, + "enableMarkLine": true, + "dataLabel": false, + "xAxis": { + "labelCount": 4, + "itemCount": 40, + "disableGrid": true, + "gridColor": "#CCCCCC", + "gridType": "solid", + "dashLength": 4, + "scrollShow": true, + "scrollAlign": "left", + "scrollColor": "#A6A6A6", + "scrollBackgroundColor": "#EFEBEF" + }, + "yAxis": { + }, + "legend": { + }, + "extra": { + "candle": { + "color": { + "upLine": "#f04864", + "upFill": "#f04864", + "downLine": "#2fc25b", + "downFill": "#2fc25b" + }, + "average": { + "show": true, + "name": ["MA5","MA10","MA30"], + "day": [5,10,20], + "color": ["#1890ff","#2fc25b","#facc14"] + } + }, + "markLine": { + "type": "dash", + "dashLength": 5, + "data": [ + { + "value": 2150, + "lineColor": "#f04864", + "showLabel": true + }, + { + "value": 2350, + "lineColor": "#f04864", + "showLabel": true + } + ] + } + } + }, + "mix":{ + "type": "mix", + "color": color, + "padding": [15,15,0,15], + "xAxis": { + "disableGrid": true, + }, + "yAxis": { + "disabled": false, + "disableGrid": false, + "splitNumber": 5, + "gridType": "dash", + "dashLength": 4, + "gridColor": "#CCCCCC", + "padding": 10, + "showTitle": true, + "data": [] + }, + "legend": { + }, + "extra": { + "mix": { + "column": { + "width": 20 + } + }, + } + }, + "scatter":{ + "type": "scatter", + "color":color, + "padding":[15,15,0,15], + "dataLabel":false, + "xAxis": { + "disableGrid": false, + "gridType":"dash", + "splitNumber":5, + "boundaryGap":"justify", + "min":0 + }, + "yAxis": { + "disableGrid": false, + "gridType":"dash", + }, + "legend": { + }, + "extra": { + "scatter": { + }, + } + }, + "bubble":{ + "type": "bubble", + "color":color, + "padding":[15,15,0,15], + "xAxis": { + "disableGrid": false, + "gridType":"dash", + "splitNumber":5, + "boundaryGap":"justify", + "min":0, + "max":250 + }, + "yAxis": { + "disableGrid": false, + "gridType":"dash", + "data":[{ + "min":0, + "max":150 + }] + }, + "legend": { + }, + "extra": { + "bubble": { + "border":2, + "opacity": 0.5, + }, + } + } +} + +export default cfu; \ No newline at end of file diff --git a/uni_modules/qiun-data-charts/js_sdk/u-charts/readme.md b/uni_modules/qiun-data-charts/js_sdk/u-charts/readme.md new file mode 100644 index 0000000..d307ba3 --- /dev/null +++ b/uni_modules/qiun-data-charts/js_sdk/u-charts/readme.md @@ -0,0 +1,5 @@ +# uCharts JSSDK说明 +1、如不使用uCharts组件,可直接引用u-charts.js,打包编译后会`自动压缩`,压缩后体积约为`120kb`。 +2、如果120kb的体积仍需压缩,请手到uCharts官网通过在线定制选择您需要的图表。 +3、config-ucharts.js为uCharts组件的用户配置文件,升级前请`自行备份config-ucharts.js`文件,以免被强制覆盖。 +4、config-echarts.js为ECharts组件的用户配置文件,升级前请`自行备份config-echarts.js`文件,以免被强制覆盖。 \ No newline at end of file diff --git a/uni_modules/qiun-data-charts/js_sdk/u-charts/u-charts.js b/uni_modules/qiun-data-charts/js_sdk/u-charts/u-charts.js new file mode 100644 index 0000000..bfe6ef0 --- /dev/null +++ b/uni_modules/qiun-data-charts/js_sdk/u-charts/u-charts.js @@ -0,0 +1,7546 @@ +/* + * uCharts (R) + * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360/快手)、Vue、Taro等支持canvas的框架平台 + * Copyright (C) 2018-2022 QIUN (R) 秋云 https://www.ucharts.cn All rights reserved. + * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) + * 复制使用请保留本段注释,感谢支持开源! + * + * uCharts (R) 官方网站 + * https://www.uCharts.cn + * + * 开源地址: + * https://gitee.com/uCharts/uCharts + * + * uni-app插件市场地址: + * http://ext.dcloud.net.cn/plugin?id=271 + * + */ + +'use strict'; + +var config = { + version: 'v2.4.3-20220505', + yAxisWidth: 15, + xAxisHeight: 22, + xAxisTextPadding: 3, + padding: [10, 10, 10, 10], + pixelRatio: 1, + rotate: false, + fontSize: 13, + fontColor: '#666666', + dataPointShape: ['circle', 'circle', 'circle', 'circle'], + color: ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc'], + linearColor: ['#0EE2F8', '#2BDCA8', '#FA7D8D', '#EB88E2', '#2AE3A0', '#0EE2F8', '#EB88E2', '#6773E3', + '#F78A85' + ], + pieChartLinePadding: 15, + pieChartTextPadding: 5, + titleFontSize: 20, + subtitleFontSize: 15, + toolTipPadding: 3, + toolTipBackground: '#000000', + toolTipOpacity: 0.7, + toolTipLineHeight: 20, + radarLabelTextMargin: 13, +}; + +var assign = function (target, ...varArgs) { + if (target == null) { + throw new TypeError('[uCharts] Cannot convert undefined or null to object'); + } + if (!varArgs || varArgs.length <= 0) { + return target; + } + // 深度合并对象 + function deepAssign (obj1, obj2) { + for (let key in obj2) { + obj1[key] = obj1[key] && obj1[key].toString() === "[object Object]" ? + deepAssign(obj1[key], obj2[key]) : obj1[key] = obj2[key]; + } + return obj1; + } + varArgs.forEach(val => { + target = deepAssign(target, val); + }); + return target; +}; + +var util = { + toFixed: function toFixed (num, limit) { + limit = limit || 2; + if (this.isFloat(num)) { + num = num.toFixed(limit); + } + return num; + }, + isFloat: function isFloat (num) { + return num % 1 !== 0; + }, + approximatelyEqual: function approximatelyEqual (num1, num2) { + return Math.abs(num1 - num2) < 1e-10; + }, + isSameSign: function isSameSign (num1, num2) { + return Math.abs(num1) === num1 && Math.abs(num2) === num2 || Math.abs(num1) !== num1 && Math.abs( + num2) !== num2; + }, + isSameXCoordinateArea: function isSameXCoordinateArea (p1, p2) { + return this.isSameSign(p1.x, p2.x); + }, + isCollision: function isCollision (obj1, obj2) { + obj1.end = {}; + obj1.end.x = obj1.start.x + obj1.width; + obj1.end.y = obj1.start.y - obj1.height; + obj2.end = {}; + obj2.end.x = obj2.start.x + obj2.width; + obj2.end.y = obj2.start.y - obj2.height; + var flag = obj2.start.x > obj1.end.x || obj2.end.x < obj1.start.x || obj2.end.y > obj1.start.y || obj2 + .start.y < obj1.end.y; + return !flag; + } +}; + +//兼容H5点击事件 +function getH5Offset (e) { + e.mp = { + changedTouches: [] + }; + e.mp.changedTouches.push({ + x: e.offsetX, + y: e.offsetY + }); + return e; +} + +// hex 转 rgba +function hexToRgb (hexValue, opc) { + var rgx = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; + var hex = hexValue.replace(rgx, function (m, r, g, b) { + return r + r + g + g + b + b; + }); + var rgb = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); + var r = parseInt(rgb[1], 16); + var g = parseInt(rgb[2], 16); + var b = parseInt(rgb[3], 16); + return 'rgba(' + r + ',' + g + ',' + b + ',' + opc + ')'; +} + +function findRange (num, type, limit) { + if (isNaN(num)) { + throw new Error('[uCharts] series数据需为Number格式'); + } + limit = limit || 10; + type = type ? type : 'upper'; + var multiple = 1; + while (limit < 1) { + limit *= 10; + multiple *= 10; + } + if (type === 'upper') { + num = Math.ceil(num * multiple); + } else { + num = Math.floor(num * multiple); + } + while (num % limit !== 0) { + if (type === 'upper') { + if (num == num + 1) { //修复数据值过大num++无效的bug by 向日葵 @xrk_jy + break; + } + num++; + } else { + num--; + } + } + return num / multiple; +} + +function calCandleMA (dayArr, nameArr, colorArr, kdata) { + let seriesTemp = []; + for (let k = 0; k < dayArr.length; k++) { + let seriesItem = { + data: [], + name: nameArr[k], + color: colorArr[k] + }; + for (let i = 0, len = kdata.length; i < len; i++) { + if (i < dayArr[k]) { + seriesItem.data.push(null); + continue; + } + let sum = 0; + for (let j = 0; j < dayArr[k]; j++) { + sum += kdata[i - j][1]; + } + seriesItem.data.push(+(sum / dayArr[k]).toFixed(3)); + } + seriesTemp.push(seriesItem); + } + return seriesTemp; +} + +function calValidDistance (self, distance, chartData, config, opts) { + var dataChartAreaWidth = opts.width - opts.area[1] - opts.area[3]; + var dataChartWidth = chartData.eachSpacing * (opts.chartData.xAxisData.xAxisPoints.length - 1); + if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount + .widthRatio > 1) { + if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2 + dataChartWidth += (opts.extra.mount.widthRatio - 1) * chartData.eachSpacing; + } + var validDistance = distance; + if (distance >= 0) { + validDistance = 0; + self.uevent.trigger('scrollLeft'); + self.scrollOption.position = 'left' + opts.xAxis.scrollPosition = 'left'; + } else if (Math.abs(distance) >= dataChartWidth - dataChartAreaWidth) { + validDistance = dataChartAreaWidth - dataChartWidth; + self.uevent.trigger('scrollRight'); + self.scrollOption.position = 'right' + opts.xAxis.scrollPosition = 'right'; + } else { + self.scrollOption.position = distance + opts.xAxis.scrollPosition = distance; + } + return validDistance; +} + +function isInAngleRange (angle, startAngle, endAngle) { + function adjust (angle) { + while (angle < 0) { + angle += 2 * Math.PI; + } + while (angle > 2 * Math.PI) { + angle -= 2 * Math.PI; + } + return angle; + } + angle = adjust(angle); + startAngle = adjust(startAngle); + endAngle = adjust(endAngle); + if (startAngle > endAngle) { + endAngle += 2 * Math.PI; + if (angle < startAngle) { + angle += 2 * Math.PI; + } + } + return angle >= startAngle && angle <= endAngle; +} + +function createCurveControlPoints (points, i) { + function isNotMiddlePoint (points, i) { + if (points[i - 1] && points[i + 1]) { + return points[i].y >= Math.max(points[i - 1].y, points[i + 1].y) || points[i].y <= Math.min(points[i - 1].y, + points[i + 1].y); + } else { + return false; + } + } + + function isNotMiddlePointX (points, i) { + if (points[i - 1] && points[i + 1]) { + return points[i].x >= Math.max(points[i - 1].x, points[i + 1].x) || points[i].x <= Math.min(points[i - 1].x, + points[i + 1].x); + } else { + return false; + } + } + var a = 0.2; + var b = 0.2; + var pAx = null; + var pAy = null; + var pBx = null; + var pBy = null; + if (i < 1) { + pAx = points[0].x + (points[1].x - points[0].x) * a; + pAy = points[0].y + (points[1].y - points[0].y) * a; + } else { + pAx = points[i].x + (points[i + 1].x - points[i - 1].x) * a; + pAy = points[i].y + (points[i + 1].y - points[i - 1].y) * a; + } + + if (i > points.length - 3) { + var last = points.length - 1; + pBx = points[last].x - (points[last].x - points[last - 1].x) * b; + pBy = points[last].y - (points[last].y - points[last - 1].y) * b; + } else { + pBx = points[i + 1].x - (points[i + 2].x - points[i].x) * b; + pBy = points[i + 1].y - (points[i + 2].y - points[i].y) * b; + } + if (isNotMiddlePoint(points, i + 1)) { + pBy = points[i + 1].y; + } + if (isNotMiddlePoint(points, i)) { + pAy = points[i].y; + } + if (isNotMiddlePointX(points, i + 1)) { + pBx = points[i + 1].x; + } + if (isNotMiddlePointX(points, i)) { + pAx = points[i].x; + } + if (pAy >= Math.max(points[i].y, points[i + 1].y) || pAy <= Math.min(points[i].y, points[i + 1].y)) { + pAy = points[i].y; + } + if (pBy >= Math.max(points[i].y, points[i + 1].y) || pBy <= Math.min(points[i].y, points[i + 1].y)) { + pBy = points[i + 1].y; + } + if (pAx >= Math.max(points[i].x, points[i + 1].x) || pAx <= Math.min(points[i].x, points[i + 1].x)) { + pAx = points[i].x; + } + if (pBx >= Math.max(points[i].x, points[i + 1].x) || pBx <= Math.min(points[i].x, points[i + 1].x)) { + pBx = points[i + 1].x; + } + return { + ctrA: { + x: pAx, + y: pAy + }, + ctrB: { + x: pBx, + y: pBy + } + }; +} + + +function convertCoordinateOrigin (x, y, center) { + return { + x: center.x + x, + y: center.y - y + }; +} + +function avoidCollision (obj, target) { + if (target) { + // is collision test + while (util.isCollision(obj, target)) { + if (obj.start.x > 0) { + obj.start.y--; + } else if (obj.start.x < 0) { + obj.start.y++; + } else { + if (obj.start.y > 0) { + obj.start.y++; + } else { + obj.start.y--; + } + } + } + } + return obj; +} + +function fixPieSeries (series, opts, config) { + let pieSeriesArr = []; + if (series.length > 0 && series[0].data.constructor.toString().indexOf('Array') > -1) { + opts._pieSeries_ = series; + let oldseries = series[0].data; + for (var i = 0; i < oldseries.length; i++) { + oldseries[i].formatter = series[0].formatter; + oldseries[i].data = oldseries[i].value; + pieSeriesArr.push(oldseries[i]); + } + opts.series = pieSeriesArr; + } else { + pieSeriesArr = series; + } + return pieSeriesArr; +} + +function fillSeries (series, opts, config) { + var index = 0; + for (var i = 0; i < series.length; i++) { + let item = series[i]; + if (!item.color) { + item.color = config.color[index]; + index = (index + 1) % config.color.length; + } + if (!item.linearIndex) { + item.linearIndex = i; + } + if (!item.index) { + item.index = 0; + } + if (!item.type) { + item.type = opts.type; + } + if (typeof item.show == "undefined") { + item.show = true; + } + if (!item.type) { + item.type = opts.type; + } + if (!item.pointShape) { + item.pointShape = "circle"; + } + if (!item.legendShape) { + switch (item.type) { + case 'line': + item.legendShape = "line"; + break; + case 'column': + case 'bar': + item.legendShape = "rect"; + break; + case 'area': + case 'mount': + item.legendShape = "triangle"; + break; + default: + item.legendShape = "circle"; + } + } + } + return series; +} + +function fillCustomColor (linearType, customColor, series, config) { + var newcolor = customColor || []; + if (linearType == 'custom' && newcolor.length == 0) { + newcolor = config.linearColor; + } + if (linearType == 'custom' && newcolor.length < series.length) { + let chazhi = series.length - newcolor.length; + for (var i = 0; i < chazhi; i++) { + newcolor.push(config.linearColor[(i + 1) % config.linearColor.length]); + } + } + return newcolor; +} + +function getDataRange (minData, maxData) { + var limit = 0; + var range = maxData - minData; + if (range >= 10000) { + limit = 1000; + } else if (range >= 1000) { + limit = 100; + } else if (range >= 100) { + limit = 10; + } else if (range >= 10) { + limit = 5; + } else if (range >= 1) { + limit = 1; + } else if (range >= 0.1) { + limit = 0.1; + } else if (range >= 0.01) { + limit = 0.01; + } else if (range >= 0.001) { + limit = 0.001; + } else if (range >= 0.0001) { + limit = 0.0001; + } else if (range >= 0.00001) { + limit = 0.00001; + } else { + limit = 0.000001; + } + return { + minRange: findRange(minData, 'lower', limit), + maxRange: findRange(maxData, 'upper', limit) + }; +} + +function measureText (text, fontSize, context) { + var width = 0; + text = String(text); + // #ifdef MP-ALIPAY || MP-BAIDU || APP-NVUE + context = false; + // #endif + if (context !== false && context !== undefined && context.setFontSize && context.measureText) { + context.setFontSize(fontSize); + return context.measureText(text).width; + } else { + var text = text.split(''); + for (let i = 0; i < text.length; i++) { + let item = text[i]; + if (/[a-zA-Z]/.test(item)) { + width += 7; + } else if (/[0-9]/.test(item)) { + width += 5.5; + } else if (/\./.test(item)) { + width += 2.7; + } else if (/-/.test(item)) { + width += 3.25; + } else if (/:/.test(item)) { + width += 2.5; + } else if (/[\u4e00-\u9fa5]/.test(item)) { + width += 10; + } else if (/\(|\)/.test(item)) { + width += 3.73; + } else if (/\s/.test(item)) { + width += 2.5; + } else if (/%/.test(item)) { + width += 8; + } else { + width += 10; + } + } + return width * fontSize / 10; + } +} + +function dataCombine (series) { + return series.reduce(function (a, b) { + return (a.data ? a.data : a).concat(b.data); + }, []); +} + +function dataCombineStack (series, len) { + var sum = new Array(len); + for (var j = 0; j < sum.length; j++) { + sum[j] = 0; + } + for (var i = 0; i < series.length; i++) { + for (var j = 0; j < sum.length; j++) { + sum[j] += series[i].data[j]; + } + } + return series.reduce(function (a, b) { + return (a.data ? a.data : a).concat(b.data).concat(sum); + }, []); +} + +function getTouches (touches, opts, e) { + let x, y; + if (touches.clientX) { + if (opts.rotate) { + y = opts.height - touches.clientX * opts.pix; + x = (touches.pageY - e.currentTarget.offsetTop - (opts.height / opts.pix / 2) * (opts.pix - 1)) * opts.pix; + } else { + x = touches.clientX * opts.pix; + y = (touches.pageY - e.currentTarget.offsetTop - (opts.height / opts.pix / 2) * (opts.pix - 1)) * opts.pix; + } + } else { + if (opts.rotate) { + y = opts.height - touches.x * opts.pix; + x = touches.y * opts.pix; + } else { + x = touches.x * opts.pix; + y = touches.y * opts.pix; + } + } + return { + x: x, + y: y + } +} + +function getSeriesDataItem (series, index, group) { + var data = []; + var newSeries = []; + var indexIsArr = index.constructor.toString().indexOf('Array') > -1; + if (indexIsArr) { + let tempSeries = filterSeries(series); + for (var i = 0; i < group.length; i++) { + newSeries.push(tempSeries[group[i]]); + } + } else { + newSeries = series; + }; + for (let i = 0; i < newSeries.length; i++) { + let item = newSeries[i]; + let tmpindex = -1; + if (indexIsArr) { + tmpindex = index[i]; + } else { + tmpindex = index; + } + if (item.data[tmpindex] !== null && typeof item.data[tmpindex] !== 'undefined' && item.show) { + let seriesItem = {}; + seriesItem.color = item.color; + seriesItem.type = item.type; + seriesItem.style = item.style; + seriesItem.pointShape = item.pointShape; + seriesItem.disableLegend = item.disableLegend; + seriesItem.name = item.name; + seriesItem.show = item.show; + seriesItem.data = item.formatter ? item.formatter(item.data[tmpindex]) : item.data[tmpindex]; + data.push(seriesItem); + } + } + return data; +} + +function getMaxTextListLength (list, fontSize, context) { + var lengthList = list.map(function (item) { + return measureText(item, fontSize, context); + }); + return Math.max.apply(null, lengthList); +} + +function getRadarCoordinateSeries (length) { + var eachAngle = 2 * Math.PI / length; + var CoordinateSeries = []; + for (var i = 0; i < length; i++) { + CoordinateSeries.push(eachAngle * i); + } + return CoordinateSeries.map(function (item) { + return -1 * item + Math.PI / 2; + }); +} + +function getToolTipData (seriesData, opts, index, group, categories) { + var option = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {}; + var calPoints = opts.chartData.calPoints ? opts.chartData.calPoints : []; + let points = {}; + if (group.length > 0) { + let filterPoints = []; + for (let i = 0; i < group.length; i++) { + filterPoints.push(calPoints[group[i]]) + } + points = filterPoints[0][index[0]]; + } else { + for (let i = 0; i < calPoints.length; i++) { + if (calPoints[i][index]) { + points = calPoints[i][index]; + break; + } + } + }; + var textList = seriesData.map(function (item) { + let titleText = null; + if (opts.categories && opts.categories.length > 0) { + titleText = categories[index]; + }; + return { + text: option.formatter ? option.formatter(item, titleText, index, opts) : item.name + ': ' + item + .data, + color: item.color + }; + }); + var offset = { + x: Math.round(points.x), + y: Math.round(points.y) + }; + return { + textList: textList, + offset: offset + }; +} + +function getMixToolTipData (seriesData, opts, index, categories) { + var option = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; + var points = opts.chartData.xAxisPoints[index] + opts.chartData.eachSpacing / 2; + var textList = seriesData.map(function (item) { + return { + text: option.formatter ? option.formatter(item, categories[index], index, opts) : item.name + ': ' + + item.data, + color: item.color, + disableLegend: item.disableLegend ? true : false + }; + }); + textList = textList.filter(function (item) { + if (item.disableLegend !== true) { + return item; + } + }); + var offset = { + x: Math.round(points), + y: 0 + }; + return { + textList: textList, + offset: offset + }; +} + +function getCandleToolTipData (series, seriesData, opts, index, categories, extra) { + var option = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {}; + var calPoints = opts.chartData.calPoints; + let upColor = extra.color.upFill; + let downColor = extra.color.downFill; + //颜色顺序为开盘,收盘,最低,最高 + let color = [upColor, upColor, downColor, upColor]; + var textList = []; + seriesData.map(function (item) { + if (index == 0) { + if (item.data[1] - item.data[0] < 0) { + color[1] = downColor; + } else { + color[1] = upColor; + } + } else { + if (item.data[0] < series[index - 1][1]) { + color[0] = downColor; + } + if (item.data[1] < item.data[0]) { + color[1] = downColor; + } + if (item.data[2] > series[index - 1][1]) { + color[2] = upColor; + } + if (item.data[3] < series[index - 1][1]) { + color[3] = downColor; + } + } + let text1 = { + text: '开盘:' + item.data[0], + color: color[0] + }; + let text2 = { + text: '收盘:' + item.data[1], + color: color[1] + }; + let text3 = { + text: '最低:' + item.data[2], + color: color[2] + }; + let text4 = { + text: '最高:' + item.data[3], + color: color[3] + }; + textList.push(text1, text2, text3, text4); + }); + var validCalPoints = []; + var offset = { + x: 0, + y: 0 + }; + for (let i = 0; i < calPoints.length; i++) { + let points = calPoints[i]; + if (typeof points[index] !== 'undefined' && points[index] !== null) { + validCalPoints.push(points[index]); + } + } + offset.x = Math.round(validCalPoints[0][0].x); + return { + textList: textList, + offset: offset + }; +} + +function filterSeries (series) { + let tempSeries = []; + for (let i = 0; i < series.length; i++) { + if (series[i].show == true) { + tempSeries.push(series[i]) + } + } + return tempSeries; +} + +function findCurrentIndex (currentPoints, calPoints, opts, config) { + var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; + var current = { index: -1, group: [] }; + var spacing = opts.chartData.eachSpacing / 2; + let xAxisPoints = []; + if (calPoints && calPoints.length > 0) { + if (!opts.categories) { + spacing = 0; + } else { + for (let i = 1; i < opts.chartData.xAxisPoints.length; i++) { + xAxisPoints.push(opts.chartData.xAxisPoints[i] - spacing); + } + if ((opts.type == 'line' || opts.type == 'area') && opts.xAxis.boundaryGap == 'justify') { + xAxisPoints = opts.chartData.xAxisPoints; + } + } + if (isInExactChartArea(currentPoints, opts, config)) { + if (!opts.categories) { + let timePoints = Array(calPoints.length); + for (let i = 0; i < calPoints.length; i++) { + timePoints[i] = Array(calPoints[i].length) + for (let j = 0; j < calPoints[i].length; j++) { + timePoints[i][j] = (Math.abs(calPoints[i][j].x - currentPoints.x)); + } + }; + let pointValue = Array(timePoints.length); + let pointIndex = Array(timePoints.length); + for (let i = 0; i < timePoints.length; i++) { + pointValue[i] = Math.min.apply(null, timePoints[i]); + pointIndex[i] = timePoints[i].indexOf(pointValue[i]); + } + let minValue = Math.min.apply(null, pointValue); + current.index = []; + for (let i = 0; i < pointValue.length; i++) { + if (pointValue[i] == minValue) { + current.group.push(i); + current.index.push(pointIndex[i]); + } + }; + } else { + xAxisPoints.forEach(function (item, index) { + if (currentPoints.x + offset + spacing > item) { + current.index = index; + } + }); + } + } + } + return current; +} + +function findBarChartCurrentIndex (currentPoints, calPoints, opts, config) { + var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0; + var current = { index: -1, group: [] }; + var spacing = opts.chartData.eachSpacing / 2; + let yAxisPoints = opts.chartData.yAxisPoints; + if (calPoints && calPoints.length > 0) { + if (isInExactChartArea(currentPoints, opts, config)) { + yAxisPoints.forEach(function (item, index) { + if (currentPoints.y + offset + spacing > item) { + current.index = index; + } + }); + } + } + return current; +} + +function findLegendIndex (currentPoints, legendData, opts) { + let currentIndex = -1; + let gap = 0; + if (isInExactLegendArea(currentPoints, legendData.area)) { + let points = legendData.points; + let index = -1; + for (let i = 0, len = points.length; i < len; i++) { + let item = points[i]; + for (let j = 0; j < item.length; j++) { + index += 1; + let area = item[j]['area']; + if (area && currentPoints.x > area[0] - gap && currentPoints.x < area[2] + gap && currentPoints.y > + area[1] - gap && currentPoints.y < area[3] + gap) { + currentIndex = index; + break; + } + } + } + return currentIndex; + } + return currentIndex; +} + +function isInExactLegendArea (currentPoints, area) { + return currentPoints.x > area.start.x && currentPoints.x < area.end.x && currentPoints.y > area.start.y && + currentPoints.y < area.end.y; +} + +function isInExactChartArea (currentPoints, opts, config) { + return currentPoints.x <= opts.width - opts.area[1] + 10 && currentPoints.x >= opts.area[3] - 10 && currentPoints + .y >= opts.area[0] && currentPoints.y <= opts.height - opts.area[2]; +} + +function findRadarChartCurrentIndex (currentPoints, radarData, count) { + var eachAngleArea = 2 * Math.PI / count; + var currentIndex = -1; + if (isInExactPieChartArea(currentPoints, radarData.center, radarData.radius)) { + var fixAngle = function fixAngle (angle) { + if (angle < 0) { + angle += 2 * Math.PI; + } + if (angle > 2 * Math.PI) { + angle -= 2 * Math.PI; + } + return angle; + }; + var angle = Math.atan2(radarData.center.y - currentPoints.y, currentPoints.x - radarData.center.x); + angle = -1 * angle; + if (angle < 0) { + angle += 2 * Math.PI; + } + var angleList = radarData.angleList.map(function (item) { + item = fixAngle(-1 * item); + return item; + }); + angleList.forEach(function (item, index) { + var rangeStart = fixAngle(item - eachAngleArea / 2); + var rangeEnd = fixAngle(item + eachAngleArea / 2); + if (rangeEnd < rangeStart) { + rangeEnd += 2 * Math.PI; + } + if (angle >= rangeStart && angle <= rangeEnd || angle + 2 * Math.PI >= rangeStart && angle + 2 * + Math.PI <= rangeEnd) { + currentIndex = index; + } + }); + } + return currentIndex; +} + +function findFunnelChartCurrentIndex (currentPoints, funnelData) { + var currentIndex = -1; + for (var i = 0, len = funnelData.series.length; i < len; i++) { + var item = funnelData.series[i]; + if (currentPoints.x > item.funnelArea[0] && currentPoints.x < item.funnelArea[2] && currentPoints.y > item + .funnelArea[1] && currentPoints.y < item.funnelArea[3]) { + currentIndex = i; + break; + } + } + return currentIndex; +} + +function findWordChartCurrentIndex (currentPoints, wordData) { + var currentIndex = -1; + for (var i = 0, len = wordData.length; i < len; i++) { + var item = wordData[i]; + if (currentPoints.x > item.area[0] && currentPoints.x < item.area[2] && currentPoints.y > item.area[1] && + currentPoints.y < item.area[3]) { + currentIndex = i; + break; + } + } + return currentIndex; +} + +function findMapChartCurrentIndex (currentPoints, opts) { + var currentIndex = -1; + var cData = opts.chartData.mapData; + var data = opts.series; + var tmp = pointToCoordinate(currentPoints.y, currentPoints.x, cData.bounds, cData.scale, cData.xoffset, cData + .yoffset); + var poi = [tmp.x, tmp.y]; + for (var i = 0, len = data.length; i < len; i++) { + var item = data[i].geometry.coordinates; + if (isPoiWithinPoly(poi, item, opts.chartData.mapData.mercator)) { + currentIndex = i; + break; + } + } + return currentIndex; +} + +function findRoseChartCurrentIndex (currentPoints, pieData, opts) { + var currentIndex = -1; + var series = getRoseDataPoints(opts._series_, opts.extra.rose.type, pieData.radius, pieData.radius); + if (pieData && pieData.center && isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) { + var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x); + angle = -angle; + if (opts.extra.rose && opts.extra.rose.offsetAngle) { + angle = angle - opts.extra.rose.offsetAngle * Math.PI / 180; + } + for (var i = 0, len = series.length; i < len; i++) { + if (isInAngleRange(angle, series[i]._start_, series[i]._start_ + series[i]._rose_proportion_ * 2 * Math + .PI)) { + currentIndex = i; + break; + } + } + } + return currentIndex; +} + +function findPieChartCurrentIndex (currentPoints, pieData, opts) { + var currentIndex = -1; + var series = getPieDataPoints(pieData.series); + if (pieData && pieData.center && isInExactPieChartArea(currentPoints, pieData.center, pieData.radius)) { + var angle = Math.atan2(pieData.center.y - currentPoints.y, currentPoints.x - pieData.center.x); + angle = -angle; + if (opts.extra.pie && opts.extra.pie.offsetAngle) { + angle = angle - opts.extra.pie.offsetAngle * Math.PI / 180; + } + if (opts.extra.ring && opts.extra.ring.offsetAngle) { + angle = angle - opts.extra.ring.offsetAngle * Math.PI / 180; + } + for (var i = 0, len = series.length; i < len; i++) { + if (isInAngleRange(angle, series[i]._start_, series[i]._start_ + series[i]._proportion_ * 2 * Math.PI)) { + currentIndex = i; + break; + } + } + } + return currentIndex; +} + +function isInExactPieChartArea (currentPoints, center, radius) { + return Math.pow(currentPoints.x - center.x, 2) + Math.pow(currentPoints.y - center.y, 2) <= Math.pow(radius, 2); +} + + +function splitPoints (points, eachSeries) { + var newPoints = []; + var items = []; + points.forEach(function (item, index) { + if (eachSeries.connectNulls) { + if (item !== null) { + items.push(item); + } + } else { + if (item !== null) { + items.push(item); + } else { + if (items.length) { + newPoints.push(items); + } + items = []; + } + } + + }); + if (items.length) { + newPoints.push(items); + } + return newPoints; +} + + +function calLegendData (series, opts, config, chartData, context) { + let legendData = { + area: { + start: { + x: 0, + y: 0 + }, + end: { + x: 0, + y: 0 + }, + width: 0, + height: 0, + wholeWidth: 0, + wholeHeight: 0 + }, + points: [], + widthArr: [], + heightArr: [] + }; + if (opts.legend.show === false) { + chartData.legendData = legendData; + return legendData; + } + let padding = opts.legend.padding * opts.pix; + let margin = opts.legend.margin * opts.pix; + let fontSize = opts.legend.fontSize ? opts.legend.fontSize * opts.pix : config.fontSize; + let shapeWidth = 15 * opts.pix; + let shapeRight = 5 * opts.pix; + let lineHeight = Math.max(opts.legend.lineHeight * opts.pix, fontSize); + if (opts.legend.position == 'top' || opts.legend.position == 'bottom') { + let legendList = []; + let widthCount = 0; + let widthCountArr = []; + let currentRow = []; + for (let i = 0; i < series.length; i++) { + let item = series[i]; + const legendText = item.legendText ? item.legendText : item.name; + let itemWidth = shapeWidth + shapeRight + measureText(legendText || 'undefined', fontSize, context) + opts + .legend.itemGap * opts.pix; + if (widthCount + itemWidth > opts.width - opts.area[1] - opts.area[3]) { + legendList.push(currentRow); + widthCountArr.push(widthCount - opts.legend.itemGap * opts.pix); + widthCount = itemWidth; + currentRow = [item]; + } else { + widthCount += itemWidth; + currentRow.push(item); + } + } + if (currentRow.length) { + legendList.push(currentRow); + widthCountArr.push(widthCount - opts.legend.itemGap * opts.pix); + legendData.widthArr = widthCountArr; + let legendWidth = Math.max.apply(null, widthCountArr); + switch (opts.legend.float) { + case 'left': + legendData.area.start.x = opts.area[3]; + legendData.area.end.x = opts.area[3] + legendWidth + 2 * padding; + break; + case 'right': + legendData.area.start.x = opts.width - opts.area[1] - legendWidth - 2 * padding; + legendData.area.end.x = opts.width - opts.area[1]; + break; + default: + legendData.area.start.x = (opts.width - legendWidth) / 2 - padding; + legendData.area.end.x = (opts.width + legendWidth) / 2 + padding; + } + legendData.area.width = legendWidth + 2 * padding; + legendData.area.wholeWidth = legendWidth + 2 * padding; + legendData.area.height = legendList.length * lineHeight + 2 * padding; + legendData.area.wholeHeight = legendList.length * lineHeight + 2 * padding + 2 * margin; + legendData.points = legendList; + } + } else { + let len = series.length; + let maxHeight = opts.height - opts.area[0] - opts.area[2] - 2 * margin - 2 * padding; + let maxLength = Math.min(Math.floor(maxHeight / lineHeight), len); + legendData.area.height = maxLength * lineHeight + padding * 2; + legendData.area.wholeHeight = maxLength * lineHeight + padding * 2; + switch (opts.legend.float) { + case 'top': + legendData.area.start.y = opts.area[0] + margin; + legendData.area.end.y = opts.area[0] + margin + legendData.area.height; + break; + case 'bottom': + legendData.area.start.y = opts.height - opts.area[2] - margin - legendData.area.height; + legendData.area.end.y = opts.height - opts.area[2] - margin; + break; + default: + legendData.area.start.y = (opts.height - legendData.area.height) / 2; + legendData.area.end.y = (opts.height + legendData.area.height) / 2; + } + let lineNum = len % maxLength === 0 ? len / maxLength : Math.floor((len / maxLength) + 1); + let currentRow = []; + for (let i = 0; i < lineNum; i++) { + let temp = series.slice(i * maxLength, i * maxLength + maxLength); + currentRow.push(temp); + } + legendData.points = currentRow; + if (currentRow.length) { + for (let i = 0; i < currentRow.length; i++) { + let item = currentRow[i]; + let maxWidth = 0; + for (let j = 0; j < item.length; j++) { + let itemWidth = shapeWidth + shapeRight + measureText(item[j].name || 'undefined', fontSize, + context) + opts.legend.itemGap * opts.pix; + if (itemWidth > maxWidth) { + maxWidth = itemWidth; + } + } + legendData.widthArr.push(maxWidth); + legendData.heightArr.push(item.length * lineHeight + padding * 2); + } + let legendWidth = 0 + for (let i = 0; i < legendData.widthArr.length; i++) { + legendWidth += legendData.widthArr[i]; + } + legendData.area.width = legendWidth - opts.legend.itemGap * opts.pix + 2 * padding; + legendData.area.wholeWidth = legendData.area.width + padding; + } + } + switch (opts.legend.position) { + case 'top': + legendData.area.start.y = opts.area[0] + margin; + legendData.area.end.y = opts.area[0] + margin + legendData.area.height; + break; + case 'bottom': + legendData.area.start.y = opts.height - opts.area[2] - legendData.area.height - margin; + legendData.area.end.y = opts.height - opts.area[2] - margin; + break; + case 'left': + legendData.area.start.x = opts.area[3]; + legendData.area.end.x = opts.area[3] + legendData.area.width; + break; + case 'right': + legendData.area.start.x = opts.width - opts.area[1] - legendData.area.width; + legendData.area.end.x = opts.width - opts.area[1]; + break; + } + chartData.legendData = legendData; + return legendData; +} + +function calCategoriesData (categories, opts, config, eachSpacing, context) { + var result = { + angle: 0, + xAxisHeight: config.xAxisHeight + }; + var fontSize = opts.xAxis.fontSize * opts.pix || config.fontSize; + var categoriesTextLenth = categories.map(function (item, index) { + var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item, index, opts) : item; + return measureText(String(xitem), fontSize, context); + }); + + var maxTextLength = Math.max.apply(this, categoriesTextLenth); + if (opts.xAxis.rotateLabel == true) { + result.angle = opts.xAxis.rotateAngle * Math.PI / 180; + let tempHeight = 2 * config.xAxisTextPadding + Math.abs(maxTextLength * Math.sin(result.angle)) + tempHeight = tempHeight < fontSize + 2 * config.xAxisTextPadding ? tempHeight + 2 * config.xAxisTextPadding : + tempHeight; + if (opts.enableScroll == true && opts.xAxis.scrollShow == true) { + tempHeight += 12 * opts.pix; + } + result.xAxisHeight = tempHeight; + } + if (opts.xAxis.disabled) { + result.xAxisHeight = 0; + } + return result; +} + +function getXAxisTextList (series, opts, config, stack) { + var index = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : -1; + var data; + if (stack == 'stack') { + data = dataCombineStack(series, opts.categories.length); + } else { + data = dataCombine(series); + } + var sorted = []; + // remove null from data + data = data.filter(function (item) { + //return item !== null; + if (typeof item === 'object' && item !== null) { + if (item.constructor.toString().indexOf('Array') > -1) { + return item !== null; + } else { + return item.value !== null; + } + } else { + return item !== null; + } + }); + data.map(function (item) { + if (typeof item === 'object') { + if (item.constructor.toString().indexOf('Array') > -1) { + if (opts.type == 'candle') { + item.map(function (subitem) { + sorted.push(subitem); + }) + } else { + sorted.push(item[0]); + } + } else { + sorted.push(item.value); + } + } else { + sorted.push(item); + } + }) + + var minData = 0; + var maxData = 0; + if (sorted.length > 0) { + minData = Math.min.apply(this, sorted); + maxData = Math.max.apply(this, sorted); + } + //为了兼容v1.9.0之前的项目 + if (index > -1) { + if (typeof opts.xAxis.data[index].min === 'number') { + minData = Math.min(opts.xAxis.data[index].min, minData); + } + if (typeof opts.xAxis.data[index].max === 'number') { + maxData = Math.max(opts.xAxis.data[index].max, maxData); + } + } else { + if (typeof opts.xAxis.min === 'number') { + minData = Math.min(opts.xAxis.min, minData); + } + if (typeof opts.xAxis.max === 'number') { + maxData = Math.max(opts.xAxis.max, maxData); + } + } + if (minData === maxData) { + var rangeSpan = maxData || 10; + maxData += rangeSpan; + } + //var dataRange = getDataRange(minData, maxData); + var minRange = minData; + var maxRange = maxData; + var range = []; + var eachRange = (maxRange - minRange) / opts.xAxis.splitNumber; + for (var i = 0; i <= opts.xAxis.splitNumber; i++) { + range.push(minRange + eachRange * i); + } + return range; +} + +function calXAxisData (series, opts, config, context) { + //堆叠图重算Y轴 + var columnstyle = assign({}, { + type: "" + }, opts.extra.bar); + var result = { + angle: 0, + xAxisHeight: config.xAxisHeight + }; + result.ranges = getXAxisTextList(series, opts, config, columnstyle.type); + result.rangesFormat = result.ranges.map(function (item) { + //item = opts.xAxis.formatter ? opts.xAxis.formatter(item) : util.toFixed(item, 2); + item = util.toFixed(item, 2); + return item; + }); + var xAxisScaleValues = result.ranges.map(function (item) { + // 如果刻度值是浮点数,则保留两位小数 + item = util.toFixed(item, 2); + // 若有自定义格式则调用自定义的格式化函数 + //item = opts.xAxis.formatter ? opts.xAxis.formatter(Number(item)) : item; + return item; + }); + result = Object.assign(result, getXAxisPoints(xAxisScaleValues, opts, config)); + // 计算X轴刻度的属性譬如每个刻度的间隔,刻度的起始点\结束点以及总长 + var eachSpacing = result.eachSpacing; + var textLength = xAxisScaleValues.map(function (item) { + return measureText(item, opts.xAxis.fontSize * opts.pix || config.fontSize, context); + }); + // get max length of categories text + var maxTextLength = Math.max.apply(this, textLength); + // 如果刻度值文本内容过长,则将其逆时针旋转45° + if (maxTextLength + 2 * config.xAxisTextPadding > eachSpacing) { + result.angle = 45 * Math.PI / 180; + result.xAxisHeight = 2 * config.xAxisTextPadding + maxTextLength * Math.sin(result.angle); + } + if (opts.xAxis.disabled === true) { + result.xAxisHeight = 0; + } + return result; +} + +function getRadarDataPoints (angleList, center, radius, series, opts) { + var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1; + var radarOption = opts.extra.radar || {}; + radarOption.max = radarOption.max || 0; + var maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series))); + var data = []; + for (let i = 0; i < series.length; i++) { + let each = series[i]; + let listItem = {}; + listItem.color = each.color; + listItem.legendShape = each.legendShape; + listItem.pointShape = each.pointShape; + listItem.data = []; + each.data.forEach(function (item, index) { + let tmp = {}; + tmp.angle = angleList[index]; + tmp.proportion = item / maxData; + tmp.value = item; + tmp.position = convertCoordinateOrigin(radius * tmp.proportion * process * Math.cos(tmp.angle), + radius * tmp.proportion * process * Math.sin(tmp.angle), center); + listItem.data.push(tmp); + }); + data.push(listItem); + } + return data; +} + +function getPieDataPoints (series, radius) { + var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + var count = 0; + var _start_ = 0; + for (let i = 0; i < series.length; i++) { + let item = series[i]; + item.data = item.data === null ? 0 : item.data; + count += item.data; + } + for (let i = 0; i < series.length; i++) { + let item = series[i]; + item.data = item.data === null ? 0 : item.data; + if (count === 0) { + item._proportion_ = 1 / series.length * process; + } else { + item._proportion_ = item.data / count * process; + } + item._radius_ = radius; + } + for (let i = 0; i < series.length; i++) { + let item = series[i]; + item._start_ = _start_; + _start_ += 2 * item._proportion_ * Math.PI; + } + return series; +} + +function getFunnelDataPoints (series, radius, type, eachSpacing) { + var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + series = series.sort(function (a, b) { + return parseInt(b.data) - parseInt(a.data); + }); + for (let i = 0; i < series.length; i++) { + if (type == 'funnel') { + series[i].radius = series[i].data / series[0].data * radius * process; + } else { + series[i].radius = (eachSpacing * (series.length - i)) / (eachSpacing * series.length) * radius * process; + } + series[i]._proportion_ = series[i].data / series[0].data; + } + if (type !== 'pyramid') { + series.reverse(); + } + return series; +} + +function getRoseDataPoints (series, type, minRadius, radius) { + var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + var count = 0; + var _start_ = 0; + var dataArr = []; + for (let i = 0; i < series.length; i++) { + let item = series[i]; + item.data = item.data === null ? 0 : item.data; + count += item.data; + dataArr.push(item.data); + } + var minData = Math.min.apply(null, dataArr); + var maxData = Math.max.apply(null, dataArr); + var radiusLength = radius - minRadius; + for (let i = 0; i < series.length; i++) { + let item = series[i]; + item.data = item.data === null ? 0 : item.data; + if (count === 0) { + item._proportion_ = 1 / series.length * process; + item._rose_proportion_ = 1 / series.length * process; + } else { + item._proportion_ = item.data / count * process; + if (type == 'area') { + item._rose_proportion_ = 1 / series.length * process; + } else { + item._rose_proportion_ = item.data / count * process; + } + } + item._radius_ = minRadius + radiusLength * ((item.data - minData) / (maxData - minData)) || radius; + } + for (let i = 0; i < series.length; i++) { + let item = series[i]; + item._start_ = _start_; + _start_ += 2 * item._rose_proportion_ * Math.PI; + } + return series; +} + +function getArcbarDataPoints (series, arcbarOption) { + var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + if (process == 1) { + process = 0.999999; + } + for (let i = 0; i < series.length; i++) { + let item = series[i]; + item.data = item.data === null ? 0 : item.data; + let totalAngle; + if (arcbarOption.type == 'circle') { + totalAngle = 2; + } else { + if (arcbarOption.endAngle < arcbarOption.startAngle) { + totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle; + } else { + totalAngle = arcbarOption.startAngle - arcbarOption.endAngle; + } + } + item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle; + if (item._proportion_ >= 2) { + item._proportion_ = item._proportion_ % 2; + } + } + return series; +} + +function getGaugeArcbarDataPoints (series, arcbarOption) { + var process = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; + if (process == 1) { + process = 0.999999; + } + for (let i = 0; i < series.length; i++) { + let item = series[i]; + item.data = item.data === null ? 0 : item.data; + let totalAngle; + if (arcbarOption.type == 'circle') { + totalAngle = 2; + } else { + if (arcbarOption.endAngle < arcbarOption.startAngle) { + totalAngle = 2 + arcbarOption.endAngle - arcbarOption.startAngle; + } else { + totalAngle = arcbarOption.startAngle - arcbarOption.endAngle; + } + } + item._proportion_ = totalAngle * item.data * process + arcbarOption.startAngle; + if (item._proportion_ >= 2) { + item._proportion_ = item._proportion_ % 2; + } + } + return series; +} + +function getGaugeAxisPoints (categories, startAngle, endAngle) { + let totalAngle = startAngle - endAngle + 1; + let tempStartAngle = startAngle; + for (let i = 0; i < categories.length; i++) { + categories[i].value = categories[i].value === null ? 0 : categories[i].value; + categories[i]._startAngle_ = tempStartAngle; + categories[i]._endAngle_ = totalAngle * categories[i].value + startAngle; + if (categories[i]._endAngle_ >= 2) { + categories[i]._endAngle_ = categories[i]._endAngle_ % 2; + } + tempStartAngle = categories[i]._endAngle_; + } + return categories; +} + +function getGaugeDataPoints (series, categories, gaugeOption) { + let process = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; + for (let i = 0; i < series.length; i++) { + let item = series[i]; + item.data = item.data === null ? 0 : item.data; + if (gaugeOption.pointer.color == 'auto') { + for (let i = 0; i < categories.length; i++) { + if (item.data <= categories[i].value) { + item.color = categories[i].color; + break; + } + } + } else { + item.color = gaugeOption.pointer.color; + } + let totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1; + item._endAngle_ = totalAngle * item.data + gaugeOption.startAngle; + item._oldAngle_ = gaugeOption.oldAngle; + if (gaugeOption.oldAngle < gaugeOption.endAngle) { + item._oldAngle_ += 2; + } + if (item.data >= gaugeOption.oldData) { + item._proportion_ = (item._endAngle_ - item._oldAngle_) * process + gaugeOption.oldAngle; + } else { + item._proportion_ = item._oldAngle_ - (item._oldAngle_ - item._endAngle_) * process; + } + if (item._proportion_ >= 2) { + item._proportion_ = item._proportion_ % 2; + } + } + return series; +} + +function getPieTextMaxLength (series, config, context, opts) { + series = getPieDataPoints(series); + let maxLength = 0; + for (let i = 0; i < series.length; i++) { + let item = series[i]; + let text = item.formatter ? item.formatter(+item._proportion_.toFixed(2)) : util.toFixed(item._proportion_ * + 100) + '%'; + maxLength = Math.max(maxLength, measureText(text, item.textSize * opts.pix || config.fontSize, context)); + } + return maxLength; +} + +function fixColumeData (points, eachSpacing, columnLen, index, config, opts) { + return points.map(function (item) { + if (item === null) { + return null; + } + var seriesGap = 0; + var categoryGap = 0; + if (opts.type == 'mix') { + seriesGap = opts.extra.mix.column.seriesGap * opts.pix || 0; + categoryGap = opts.extra.mix.column.categoryGap * opts.pix || 0; + } else { + seriesGap = opts.extra.column.seriesGap * opts.pix || 0; + categoryGap = opts.extra.column.categoryGap * opts.pix || 0; + } + seriesGap = Math.min(seriesGap, eachSpacing / columnLen) + categoryGap = Math.min(categoryGap, eachSpacing / columnLen) + item.width = Math.ceil((eachSpacing - 2 * categoryGap - seriesGap * (columnLen - 1)) / columnLen); + if (opts.extra.mix && opts.extra.mix.column.width && +opts.extra.mix.column.width > 0) { + item.width = Math.min(item.width, +opts.extra.mix.column.width * opts.pix); + } + if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) { + item.width = Math.min(item.width, +opts.extra.column.width * opts.pix); + } + if (item.width <= 0) { + item.width = 1; + } + item.x += (index + 0.5 - columnLen / 2) * (item.width + seriesGap); + return item; + }); +} + +function fixBarData (points, eachSpacing, columnLen, index, config, opts) { + return points.map(function (item) { + if (item === null) { + return null; + } + var seriesGap = 0; + var categoryGap = 0; + seriesGap = opts.extra.bar.seriesGap * opts.pix || 0; + categoryGap = opts.extra.bar.categoryGap * opts.pix || 0; + seriesGap = Math.min(seriesGap, eachSpacing / columnLen) + categoryGap = Math.min(categoryGap, eachSpacing / columnLen) + item.width = Math.ceil((eachSpacing - 2 * categoryGap - seriesGap * (columnLen - 1)) / columnLen); + if (opts.extra.bar && opts.extra.bar.width && +opts.extra.bar.width > 0) { + item.width = Math.min(item.width, +opts.extra.bar.width * opts.pix); + } + if (item.width <= 0) { + item.width = 1; + } + item.y += (index + 0.5 - columnLen / 2) * (item.width + seriesGap); + return item; + }); +} + +function fixColumeMeterData (points, eachSpacing, columnLen, index, config, opts, border) { + var categoryGap = opts.extra.column.categoryGap * opts.pix || 0; + return points.map(function (item) { + if (item === null) { + return null; + } + item.width = eachSpacing - 2 * categoryGap; + if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) { + item.width = Math.min(item.width, +opts.extra.column.width * opts.pix); + } + if (index > 0) { + item.width -= border; + } + return item; + }); +} + +function fixColumeStackData (points, eachSpacing, columnLen, index, config, opts, series) { + var categoryGap = opts.extra.column.categoryGap * opts.pix || 0; + return points.map(function (item, indexn) { + if (item === null) { + return null; + } + item.width = Math.ceil(eachSpacing - 2 * categoryGap); + if (opts.extra.column && opts.extra.column.width && +opts.extra.column.width > 0) { + item.width = Math.min(item.width, +opts.extra.column.width * opts.pix); + } + if (item.width <= 0) { + item.width = 1; + } + return item; + }); +} + +function fixBarStackData (points, eachSpacing, columnLen, index, config, opts, series) { + var categoryGap = opts.extra.bar.categoryGap * opts.pix || 0; + return points.map(function (item, indexn) { + if (item === null) { + return null; + } + item.width = Math.ceil(eachSpacing - 2 * categoryGap); + if (opts.extra.bar && opts.extra.bar.width && +opts.extra.bar.width > 0) { + item.width = Math.min(item.width, +opts.extra.bar.width * opts.pix); + } + if (item.width <= 0) { + item.width = 1; + } + return item; + }); +} + +function getXAxisPoints (categories, opts, config) { + var spacingValid = opts.width - opts.area[1] - opts.area[3]; + var dataCount = opts.enableScroll ? Math.min(opts.xAxis.itemCount, categories.length) : categories.length; + if ((opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble' || opts.type == + 'bar') && dataCount > 1 && opts.xAxis.boundaryGap == 'justify') { + dataCount -= 1; + } + var widthRatio = 0; + if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount + .widthRatio > 1) { + if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2 + widthRatio = opts.extra.mount.widthRatio - 1; + dataCount += widthRatio; + } + var eachSpacing = spacingValid / dataCount; + var xAxisPoints = []; + var startX = opts.area[3]; + var endX = opts.width - opts.area[1]; + categories.forEach(function (item, index) { + xAxisPoints.push(startX + widthRatio / 2 * eachSpacing + index * eachSpacing); + }); + if (opts.xAxis.boundaryGap !== 'justify') { + if (opts.enableScroll === true) { + xAxisPoints.push(startX + widthRatio * eachSpacing + categories.length * eachSpacing); + } else { + xAxisPoints.push(endX); + } + } + return { + xAxisPoints: xAxisPoints, + startX: startX, + endX: endX, + eachSpacing: eachSpacing + }; +} + +function getCandleDataPoints (data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) { + var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1; + var points = []; + var validHeight = opts.height - opts.area[0] - opts.area[2]; + data.forEach(function (item, index) { + if (item === null) { + points.push(null); + } else { + var cPoints = []; + item.forEach(function (items, indexs) { + var point = {}; + point.x = xAxisPoints[index] + Math.round(eachSpacing / 2); + var value = items.value || items; + var height = validHeight * (value - minRange) / (maxRange - minRange); + height *= process; + point.y = opts.height - Math.round(height) - opts.area[2]; + cPoints.push(point); + }); + points.push(cPoints); + } + }); + return points; +} + +function getDataPoints (data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config) { + var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1; + var boundaryGap = 'center'; + if (opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == 'bubble') { + boundaryGap = opts.xAxis.boundaryGap; + } + var points = []; + var validHeight = opts.height - opts.area[0] - opts.area[2]; + var validWidth = opts.width - opts.area[1] - opts.area[3]; + data.forEach(function (item, index) { + if (item === null) { + points.push(null); + } else { + var point = {}; + point.color = item.color; + point.x = xAxisPoints[index]; + var value = item; + if (typeof item === 'object' && item !== null) { + if (item.constructor.toString().indexOf('Array') > -1) { + let xranges, xminRange, xmaxRange; + xranges = [].concat(opts.chartData.xAxisData.ranges); + xminRange = xranges.shift(); + xmaxRange = xranges.pop(); + value = item[1]; + point.x = opts.area[3] + validWidth * (item[0] - xminRange) / (xmaxRange - xminRange); + if (opts.type == 'bubble') { + point.r = item[2]; + point.t = item[3]; + } + } else { + value = item.value; + } + } + if (boundaryGap == 'center') { + point.x += eachSpacing / 2; + } + var height = validHeight * (value - minRange) / (maxRange - minRange); + height *= process; + point.y = opts.height - height - opts.area[2]; + points.push(point); + } + }); + return points; +} + +function getMountDataPoints (series, minRange, maxRange, xAxisPoints, eachSpacing, opts, mountOption) { + var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1; + var points = []; + var validHeight = opts.height - opts.area[0] - opts.area[2]; + var validWidth = opts.width - opts.area[1] - opts.area[3]; + var mountWidth = eachSpacing * mountOption.widthRatio; + series.forEach(function (item, index) { + if (item === null) { + points.push(null); + } else { + var point = {}; + point.color = item.color; + point.x = xAxisPoints[index]; + point.x += eachSpacing / 2; + var value = item.data; + var height = validHeight * (value - minRange) / (maxRange - minRange); + height *= process; + point.y = opts.height - height - opts.area[2]; + point.value = value; + point.width = mountWidth; + points.push(point); + } + }); + return points; +} + +function getBarDataPoints (data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config) { + var process = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 1; + var points = []; + var validHeight = opts.height - opts.area[0] - opts.area[2]; + var validWidth = opts.width - opts.area[1] - opts.area[3]; + data.forEach(function (item, index) { + if (item === null) { + points.push(null); + } else { + var point = {}; + point.color = item.color; + point.y = yAxisPoints[index]; + var value = item; + if (typeof item === 'object' && item !== null) { + value = item.value; + } + var height = validWidth * (value - minRange) / (maxRange - minRange); + height *= process; + point.height = height; + point.value = value; + point.x = height + opts.area[3]; + points.push(point); + } + }); + return points; +} + +function getStackDataPoints (data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, seriesIndex, + stackSeries) { + var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1; + var points = []; + var validHeight = opts.height - opts.area[0] - opts.area[2]; + data.forEach(function (item, index) { + if (item === null) { + points.push(null); + } else { + var point = {}; + point.color = item.color; + point.x = xAxisPoints[index] + Math.round(eachSpacing / 2); + + if (seriesIndex > 0) { + var value = 0; + for (let i = 0; i <= seriesIndex; i++) { + value += stackSeries[i].data[index]; + } + var value0 = value - item; + var height = validHeight * (value - minRange) / (maxRange - minRange); + var height0 = validHeight * (value0 - minRange) / (maxRange - minRange); + } else { + var value = item; + var height = validHeight * (value - minRange) / (maxRange - minRange); + var height0 = 0; + } + var heightc = height0; + height *= process; + heightc *= process; + point.y = opts.height - Math.round(height) - opts.area[2]; + point.y0 = opts.height - Math.round(heightc) - opts.area[2]; + points.push(point); + } + }); + return points; +} + +function getBarStackDataPoints (data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, seriesIndex, + stackSeries) { + var process = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : 1; + var points = []; + var validHeight = opts.width - opts.area[1] - opts.area[3]; + data.forEach(function (item, index) { + if (item === null) { + points.push(null); + } else { + var point = {}; + point.color = item.color; + point.y = yAxisPoints[index]; + if (seriesIndex > 0) { + var value = 0; + for (let i = 0; i <= seriesIndex; i++) { + value += stackSeries[i].data[index]; + } + var value0 = value - item; + var height = validHeight * (value - minRange) / (maxRange - minRange); + var height0 = validHeight * (value0 - minRange) / (maxRange - minRange); + } else { + var value = item; + var height = validHeight * (value - minRange) / (maxRange - minRange); + var height0 = 0; + } + var heightc = height0; + height *= process; + heightc *= process; + point.height = height - heightc; + point.x = opts.area[3] + height; + point.x0 = opts.area[3] + heightc; + points.push(point); + } + }); + return points; +} + +function getYAxisTextList (series, opts, config, stack, yData) { + var index = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : -1; + var data; + if (stack == 'stack') { + data = dataCombineStack(series, opts.categories.length); + } else { + data = dataCombine(series); + } + var sorted = []; + // remove null from data + data = data.filter(function (item) { + //return item !== null; + if (typeof item === 'object' && item !== null) { + if (item.constructor.toString().indexOf('Array') > -1) { + return item !== null; + } else { + return item.value !== null; + } + } else { + return item !== null; + } + }); + data.map(function (item) { + if (typeof item === 'object') { + if (item.constructor.toString().indexOf('Array') > -1) { + if (opts.type == 'candle') { + item.map(function (subitem) { + sorted.push(subitem); + }) + } else { + sorted.push(item[1]); + } + } else { + sorted.push(item.value); + } + } else { + sorted.push(item); + } + }) + var minData = yData.min || 0; + var maxData = yData.max || 0; + if (sorted.length > 0) { + minData = Math.min.apply(this, sorted); + maxData = Math.max.apply(this, sorted); + } + if (minData === maxData) { + // var rangeSpan = maxData || 10; + // maxData += rangeSpan; + if (maxData == 0) { + maxData = 10; + } else { + minData = 0; + } + } + var dataRange = getDataRange(minData, maxData); + var minRange = (yData.min === undefined || yData.min === null) ? dataRange.minRange : yData.min; + var maxRange = (yData.max === undefined || yData.max === null) ? dataRange.maxRange : yData.max; + var range = []; + var eachRange = (maxRange - minRange) / opts.yAxis.splitNumber; + for (var i = 0; i <= opts.yAxis.splitNumber; i++) { + range.push(minRange + eachRange * i); + } + return range.reverse(); +} + +function calYAxisData (series, opts, config, context) { + //堆叠图重算Y轴 + var columnstyle = assign({}, { + type: "" + }, opts.extra.column); + //如果是多Y轴,重新计算 + var YLength = opts.yAxis.data.length; + var newSeries = new Array(YLength); + if (YLength > 0) { + for (let i = 0; i < YLength; i++) { + newSeries[i] = []; + for (let j = 0; j < series.length; j++) { + if (series[j].index == i) { + newSeries[i].push(series[j]); + } + } + } + var rangesArr = new Array(YLength); + var rangesFormatArr = new Array(YLength); + var yAxisWidthArr = new Array(YLength); + + for (let i = 0; i < YLength; i++) { + let yData = opts.yAxis.data[i]; + //如果总开关不显示,强制每个Y轴为不显示 + if (opts.yAxis.disabled == true) { + yData.disabled = true; + } + if (yData.type === 'categories') { + if (!yData.formatter) { + yData.formatter = (val, index, opts) => { return val + (yData.unit || '') }; + } + yData.categories = yData.categories || opts.categories; + rangesArr[i] = yData.categories; + } else { + if (!yData.formatter) { + yData.formatter = (val, index, opts) => { return val.toFixed(yData.tofix) + (yData.unit || '') }; + } + rangesArr[i] = getYAxisTextList(newSeries[i], opts, config, columnstyle.type, yData, i); + } + let yAxisFontSizes = yData.fontSize * opts.pix || config.fontSize; + yAxisWidthArr[i] = { + position: yData.position ? yData.position : 'left', + width: 0 + }; + rangesFormatArr[i] = rangesArr[i].map(function (items, index) { + items = yData.formatter(items, index, opts); + yAxisWidthArr[i].width = Math.max(yAxisWidthArr[i].width, measureText(items, yAxisFontSizes, + context) + 5); + return items; + }); + let calibration = yData.calibration ? 4 * opts.pix : 0; + yAxisWidthArr[i].width += calibration + 3 * opts.pix; + if (yData.disabled === true) { + yAxisWidthArr[i].width = 0; + } + } + } else { + var rangesArr = new Array(1); + var rangesFormatArr = new Array(1); + var yAxisWidthArr = new Array(1); + if (opts.type === 'bar') { + rangesArr[0] = opts.categories; + if (!opts.yAxis.formatter) { + opts.yAxis.formatter = (val, index, opts) => { return val + (opts.yAxis.unit || '') } + } + } else { + if (!opts.yAxis.formatter) { + opts.yAxis.formatter = (val, index, opts) => { + return val.toFixed(opts.yAxis.tofix) + (opts.yAxis + .unit || '') + } + } + rangesArr[0] = getYAxisTextList(series, opts, config, columnstyle.type, {}); + } + yAxisWidthArr[0] = { + position: 'left', + width: 0 + }; + var yAxisFontSize = opts.yAxis.fontSize * opts.pix || config.fontSize; + rangesFormatArr[0] = rangesArr[0].map(function (item, index) { + item = opts.yAxis.formatter(item, index, opts); + yAxisWidthArr[0].width = Math.max(yAxisWidthArr[0].width, measureText(item, yAxisFontSize, + context) + 5); + return item; + }); + yAxisWidthArr[0].width += 3 * opts.pix; + if (opts.yAxis.disabled === true) { + yAxisWidthArr[0] = { + position: 'left', + width: 0 + }; + opts.yAxis.data[0] = { + disabled: true + }; + } else { + opts.yAxis.data[0] = { + disabled: false, + position: 'left', + max: opts.yAxis.max, + min: opts.yAxis.min, + formatter: opts.yAxis.formatter + }; + if (opts.type === 'bar') { + opts.yAxis.data[0].categories = opts.categories; + opts.yAxis.data[0].type = 'categories'; + } + } + } + return { + rangesFormat: rangesFormatArr, + ranges: rangesArr, + yAxisWidth: yAxisWidthArr + }; +} + +function calTooltipYAxisData (point, series, opts, config, eachSpacing) { + let ranges = [].concat(opts.chartData.yAxisData.ranges); + let spacingValid = opts.height - opts.area[0] - opts.area[2]; + let minAxis = opts.area[0]; + let items = []; + for (let i = 0; i < ranges.length; i++) { + let maxVal = ranges[i].shift(); + let minVal = ranges[i].pop(); + let item = maxVal - (maxVal - minVal) * (point - minAxis) / spacingValid; + item = opts.yAxis.data[i].formatter ? opts.yAxis.data[i].formatter(item) : item.toFixed(0); + items.push(String(item)) + } + return items; +} + +function calMarkLineData (points, opts) { + let minRange, maxRange; + let spacingValid = opts.height - opts.area[0] - opts.area[2]; + for (let i = 0; i < points.length; i++) { + points[i].yAxisIndex = points[i].yAxisIndex ? points[i].yAxisIndex : 0; + let range = [].concat(opts.chartData.yAxisData.ranges[points[i].yAxisIndex]); + minRange = range.pop(); + maxRange = range.shift(); + let height = spacingValid * (points[i].value - minRange) / (maxRange - minRange); + points[i].y = opts.height - Math.round(height) - opts.area[2]; + } + return points; +} + +function contextRotate (context, opts) { + if (opts.rotateLock !== true) { + context.translate(opts.height, 0); + context.rotate(90 * Math.PI / 180); + } else if (opts._rotate_ !== true) { + context.translate(opts.height, 0); + context.rotate(90 * Math.PI / 180); + opts._rotate_ = true; + } +} + +function drawPointShape (points, color, shape, context, opts) { + context.beginPath(); + if (opts.dataPointShapeType == 'hollow') { + context.setStrokeStyle(color); + context.setFillStyle(opts.background); + context.setLineWidth(2 * opts.pix); + } else { + context.setStrokeStyle("#ffffff"); + context.setFillStyle(color); + context.setLineWidth(1 * opts.pix); + } + if (shape === 'diamond') { + points.forEach(function (item, index) { + if (item !== null) { + context.moveTo(item.x, item.y - 4.5); + context.lineTo(item.x - 4.5, item.y); + context.lineTo(item.x, item.y + 4.5); + context.lineTo(item.x + 4.5, item.y); + context.lineTo(item.x, item.y - 4.5); + } + }); + } else if (shape === 'circle') { + points.forEach(function (item, index) { + if (item !== null) { + context.moveTo(item.x + 2.5 * opts.pix, item.y); + context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false); + } + }); + } else if (shape === 'square') { + points.forEach(function (item, index) { + if (item !== null) { + context.moveTo(item.x - 3.5, item.y - 3.5); + context.rect(item.x - 3.5, item.y - 3.5, 7, 7); + } + }); + } else if (shape === 'triangle') { + points.forEach(function (item, index) { + if (item !== null) { + context.moveTo(item.x, item.y - 4.5); + context.lineTo(item.x - 4.5, item.y + 4.5); + context.lineTo(item.x + 4.5, item.y + 4.5); + context.lineTo(item.x, item.y - 4.5); + } + }); + } else if (shape === 'triangle') { + return; + } + context.closePath(); + context.fill(); + context.stroke(); +} + +function drawRingTitle (opts, config, context, center) { + var titlefontSize = opts.title.fontSize || config.titleFontSize; + var subtitlefontSize = opts.subtitle.fontSize || config.subtitleFontSize; + var title = opts.title.name || ''; + var subtitle = opts.subtitle.name || ''; + var titleFontColor = opts.title.color || opts.fontColor; + var subtitleFontColor = opts.subtitle.color || opts.fontColor; + var titleHeight = title ? titlefontSize : 0; + var subtitleHeight = subtitle ? subtitlefontSize : 0; + var margin = 5; + if (subtitle) { + var textWidth = measureText(subtitle, subtitlefontSize * opts.pix, context); + var startX = center.x - textWidth / 2 + (opts.subtitle.offsetX || 0) * opts.pix; + var startY = center.y + subtitlefontSize * opts.pix / 2 + (opts.subtitle.offsetY || 0) * opts.pix; + if (title) { + startY += (titleHeight * opts.pix + margin) / 2; + } + context.beginPath(); + context.setFontSize(subtitlefontSize * opts.pix); + context.setFillStyle(subtitleFontColor); + context.fillText(subtitle, startX, startY); + context.closePath(); + context.stroke(); + } + if (title) { + var _textWidth = measureText(title, titlefontSize * opts.pix, context); + var _startX = center.x - _textWidth / 2 + (opts.title.offsetX || 0); + var _startY = center.y + titlefontSize * opts.pix / 2 + (opts.title.offsetY || 0) * opts.pix; + if (subtitle) { + _startY -= (subtitleHeight * opts.pix + margin) / 2; + } + context.beginPath(); + context.setFontSize(titlefontSize * opts.pix); + context.setFillStyle(titleFontColor); + context.fillText(title, _startX, _startY); + context.closePath(); + context.stroke(); + } +} + +function drawPointText (points, series, config, context, opts) { + // 绘制数据文案 + var data = series.data; + var textOffset = series.textOffset ? series.textOffset : 0; + points.forEach(function (item, index) { + if (item !== null) { + context.beginPath(); + var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize; + context.setFontSize(fontSize); + context.setFillStyle(series.textColor || opts.fontColor); + var value = data[index] + if (typeof data[index] === 'object' && data[index] !== null) { + if (data[index].constructor.toString().indexOf('Array') > -1) { + value = data[index][1]; + } else { + value = data[index].value + } + } + var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value; + context.setTextAlign('center'); + context.fillText(String(formatVal), item.x, item.y - 4 + textOffset * opts.pix); + context.closePath(); + context.stroke(); + context.setTextAlign('left'); + } + }); +} + +function drawMountPointText (points, series, config, context, opts) { + // 绘制数据文案 + var data = series.data; + var textOffset = series.textOffset ? series.textOffset : 0; + points.forEach(function (item, index) { + if (item !== null) { + context.beginPath(); + var fontSize = series[index].textSize ? series[index].textSize * opts.pix : config.fontSize; + context.setFontSize(fontSize); + context.setFillStyle(series[index].textColor || opts.fontColor); + var value = item.value + var formatVal = series[index].formatter ? series[index].formatter(value, index, series, opts) : + value; + context.setTextAlign('center'); + context.fillText(String(formatVal), item.x, item.y - 4 + textOffset * opts.pix); + context.closePath(); + context.stroke(); + context.setTextAlign('left'); + } + }); +} + +function drawBarPointText (points, series, config, context, opts) { + // 绘制数据文案 + var data = series.data; + var textOffset = series.textOffset ? series.textOffset : 0; + points.forEach(function (item, index) { + if (item !== null) { + context.beginPath(); + var fontSize = series.textSize ? series.textSize * opts.pix : config.fontSize; + context.setFontSize(fontSize); + context.setFillStyle(series.textColor || opts.fontColor); + var value = data[index] + if (typeof data[index] === 'object' && data[index] !== null) { + value = data[index].value; + } + var formatVal = series.formatter ? series.formatter(value, index, series, opts) : value; + context.setTextAlign('left'); + context.fillText(String(formatVal), item.x + 4 * opts.pix, item.y + fontSize / 2 - 3); + context.closePath(); + context.stroke(); + } + }); +} + +function drawGaugeLabel (gaugeOption, radius, centerPosition, opts, config, context) { + radius -= gaugeOption.width / 2 + gaugeOption.labelOffset * opts.pix; + radius = radius < 10 ? 10 : radius; + let totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1; + let splitAngle = totalAngle / gaugeOption.splitLine.splitNumber; + let totalNumber = gaugeOption.endNumber - gaugeOption.startNumber; + let splitNumber = totalNumber / gaugeOption.splitLine.splitNumber; + let nowAngle = gaugeOption.startAngle; + let nowNumber = gaugeOption.startNumber; + for (let i = 0; i < gaugeOption.splitLine.splitNumber + 1; i++) { + var pos = { + x: radius * Math.cos(nowAngle * Math.PI), + y: radius * Math.sin(nowAngle * Math.PI) + }; + var labelText = gaugeOption.formatter ? gaugeOption.formatter(nowNumber, i, opts) : nowNumber; + pos.x += centerPosition.x - measureText(labelText, config.fontSize, context) / 2; + pos.y += centerPosition.y; + var startX = pos.x; + var startY = pos.y; + context.beginPath(); + context.setFontSize(config.fontSize); + context.setFillStyle(gaugeOption.labelColor || opts.fontColor); + context.fillText(labelText, startX, startY + config.fontSize / 2); + context.closePath(); + context.stroke(); + nowAngle += splitAngle; + if (nowAngle >= 2) { + nowAngle = nowAngle % 2; + } + nowNumber += splitNumber; + } +} + +function drawRadarLabel (angleList, radius, centerPosition, opts, config, context) { + var radarOption = opts.extra.radar || {}; + angleList.forEach(function (angle, index) { + if (radarOption.labelPointShow === true && opts.categories[index] !== '') { + var posPoint = { + x: radius * Math.cos(angle), + y: radius * Math.sin(angle) + }; + var posPointAxis = convertCoordinateOrigin(posPoint.x, posPoint.y, centerPosition); + context.setFillStyle(radarOption.labelPointColor); + context.beginPath(); + context.arc(posPointAxis.x, posPointAxis.y, radarOption.labelPointRadius * opts.pix, 0, 2 * Math.PI, + false); + context.closePath(); + context.fill(); + } + var pos = { + x: (radius + config.radarLabelTextMargin * opts.pix) * Math.cos(angle), + y: (radius + config.radarLabelTextMargin * opts.pix) * Math.sin(angle) + }; + var posRelativeCanvas = convertCoordinateOrigin(pos.x, pos.y, centerPosition); + var startX = posRelativeCanvas.x; + var startY = posRelativeCanvas.y; + if (util.approximatelyEqual(pos.x, 0)) { + startX -= measureText(opts.categories[index] || '', config.fontSize, context) / 2; + } else if (pos.x < 0) { + startX -= measureText(opts.categories[index] || '', config.fontSize, context); + } + context.beginPath(); + context.setFontSize(config.fontSize); + context.setFillStyle(radarOption.labelColor || opts.fontColor); + context.fillText(opts.categories[index] || '', startX, startY + config.fontSize / 2); + context.closePath(); + context.stroke(); + }); + +} + +function drawPieText (series, opts, config, context, radius, center) { + var lineRadius = config.pieChartLinePadding; + var textObjectCollection = []; + var lastTextObject = null; + var seriesConvert = series.map(function (item, index) { + var text = item.formatter ? item.formatter(item, index, series, opts) : util.toFixed(item._proportion_ + .toFixed(4) * 100) + '%'; + text = item.labelText ? item.labelText : text; + var arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._proportion_ / 2); + if (item._rose_proportion_) { + arc = 2 * Math.PI - (item._start_ + 2 * Math.PI * item._rose_proportion_ / 2); + } + var color = item.color; + var radius = item._radius_; + return { + arc: arc, + text: text, + color: color, + radius: radius, + textColor: item.textColor, + textSize: item.textSize, + labelShow: item.labelShow + }; + }); + for (let i = 0; i < seriesConvert.length; i++) { + let item = seriesConvert[i]; + // line end + let orginX1 = Math.cos(item.arc) * (item.radius + lineRadius); + let orginY1 = Math.sin(item.arc) * (item.radius + lineRadius); + // line start + let orginX2 = Math.cos(item.arc) * item.radius; + let orginY2 = Math.sin(item.arc) * item.radius; + // text start + let orginX3 = orginX1 >= 0 ? orginX1 + config.pieChartTextPadding : orginX1 - config.pieChartTextPadding; + let orginY3 = orginY1; + let textWidth = measureText(item.text, item.textSize * opts.pix || config.fontSize, context); + let startY = orginY3; + if (lastTextObject && util.isSameXCoordinateArea(lastTextObject.start, { + x: orginX3 + })) { + if (orginX3 > 0) { + startY = Math.min(orginY3, lastTextObject.start.y); + } else if (orginX1 < 0) { + startY = Math.max(orginY3, lastTextObject.start.y); + } else { + if (orginY3 > 0) { + startY = Math.max(orginY3, lastTextObject.start.y); + } else { + startY = Math.min(orginY3, lastTextObject.start.y); + } + } + } + if (orginX3 < 0) { + orginX3 -= textWidth; + } + let textObject = { + lineStart: { + x: orginX2, + y: orginY2 + }, + lineEnd: { + x: orginX1, + y: orginY1 + }, + start: { + x: orginX3, + y: startY + }, + width: textWidth, + height: config.fontSize, + text: item.text, + color: item.color, + textColor: item.textColor, + textSize: item.textSize + }; + lastTextObject = avoidCollision(textObject, lastTextObject); + textObjectCollection.push(lastTextObject); + } + for (let i = 0; i < textObjectCollection.length; i++) { + if (seriesConvert[i].labelShow === false) { + continue; + } + let item = textObjectCollection[i]; + let lineStartPoistion = convertCoordinateOrigin(item.lineStart.x, item.lineStart.y, center); + let lineEndPoistion = convertCoordinateOrigin(item.lineEnd.x, item.lineEnd.y, center); + let textPosition = convertCoordinateOrigin(item.start.x, item.start.y, center); + context.setLineWidth(1 * opts.pix); + context.setFontSize(item.textSize * opts.pix || config.fontSize); + context.beginPath(); + context.setStrokeStyle(item.color); + context.setFillStyle(item.color); + context.moveTo(lineStartPoistion.x, lineStartPoistion.y); + let curveStartX = item.start.x < 0 ? textPosition.x + item.width : textPosition.x; + let textStartX = item.start.x < 0 ? textPosition.x - 5 : textPosition.x + 5; + context.quadraticCurveTo(lineEndPoistion.x, lineEndPoistion.y, curveStartX, textPosition.y); + context.moveTo(lineStartPoistion.x, lineStartPoistion.y); + context.stroke(); + context.closePath(); + context.beginPath(); + context.moveTo(textPosition.x + item.width, textPosition.y); + context.arc(curveStartX, textPosition.y, 2 * opts.pix, 0, 2 * Math.PI); + context.closePath(); + context.fill(); + context.beginPath(); + context.setFontSize(item.textSize * opts.pix || config.fontSize); + context.setFillStyle(item.textColor || opts.fontColor); + context.fillText(item.text, textStartX, textPosition.y + 3); + context.closePath(); + context.stroke(); + context.closePath(); + } +} + +function drawToolTipSplitLine (offsetX, opts, config, context) { + var toolTipOption = opts.extra.tooltip || {}; + toolTipOption.gridType = toolTipOption.gridType == undefined ? 'solid' : toolTipOption.gridType; + toolTipOption.dashLength = toolTipOption.dashLength == undefined ? 4 : toolTipOption.dashLength; + var startY = opts.area[0]; + var endY = opts.height - opts.area[2]; + if (toolTipOption.gridType == 'dash') { + context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]); + } + context.setStrokeStyle(toolTipOption.gridColor || '#cccccc'); + context.setLineWidth(1 * opts.pix); + context.beginPath(); + context.moveTo(offsetX, startY); + context.lineTo(offsetX, endY); + context.stroke(); + context.setLineDash([]); + if (toolTipOption.xAxisLabel) { + let labelText = opts.categories[opts.tooltip.index]; + context.setFontSize(config.fontSize); + let textWidth = measureText(labelText, config.fontSize, context); + let textX = offsetX - 0.5 * textWidth; + let textY = endY; + context.beginPath(); + context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption + .labelBgOpacity || config.toolTipOpacity)); + context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground); + context.setLineWidth(1 * opts.pix); + context.rect(textX - config.toolTipPadding, textY, textWidth + 2 * config.toolTipPadding, config.fontSize + 2 * + config.toolTipPadding); + context.closePath(); + context.stroke(); + context.fill(); + context.beginPath(); + context.setFontSize(config.fontSize); + context.setFillStyle(toolTipOption.labelFontColor || opts.fontColor); + context.fillText(String(labelText), textX, textY + config.toolTipPadding + config.fontSize); + context.closePath(); + context.stroke(); + } +} + +function drawMarkLine (opts, config, context) { + let markLineOption = assign({}, { + type: 'solid', + dashLength: 4, + data: [] + }, opts.extra.markLine); + let startX = opts.area[3]; + let endX = opts.width - opts.area[1]; + let points = calMarkLineData(markLineOption.data, opts); + for (let i = 0; i < points.length; i++) { + let item = assign({}, { + lineColor: '#DE4A42', + showLabel: false, + labelFontColor: '#666666', + labelBgColor: '#DFE8FF', + labelBgOpacity: 0.8, + labelAlign: 'left', + labelOffsetX: 0, + labelOffsetY: 0, + }, points[i]); + if (markLineOption.type == 'dash') { + context.setLineDash([markLineOption.dashLength, markLineOption.dashLength]); + } + context.setStrokeStyle(item.lineColor); + context.setLineWidth(1 * opts.pix); + context.beginPath(); + context.moveTo(startX, item.y); + context.lineTo(endX, item.y); + context.stroke(); + context.setLineDash([]); + if (item.showLabel) { + let labelText = item.labelText ? item.labelText : item.value; + context.setFontSize(config.fontSize); + let textWidth = measureText(labelText, config.fontSize, context); + let bgWidth = textWidth + config.toolTipPadding * 2; + let bgStartX = item.labelAlign == 'left' ? opts.area[3] - bgWidth : opts.width - opts.area[1]; + bgStartX += item.labelOffsetX; + let bgStartY = item.y - 0.5 * config.fontSize - config.toolTipPadding; + bgStartY += item.labelOffsetY; + let textX = bgStartX + config.toolTipPadding; + let textY = item.y; + context.setFillStyle(hexToRgb(item.labelBgColor, item.labelBgOpacity)); + context.setStrokeStyle(item.labelBgColor); + context.setLineWidth(1 * opts.pix); + context.beginPath(); + context.rect(bgStartX, bgStartY, bgWidth, config.fontSize + 2 * config.toolTipPadding); + context.closePath(); + context.stroke(); + context.fill(); + context.setFontSize(config.fontSize); + context.setTextAlign('left'); + context.setFillStyle(item.labelFontColor); + context.fillText(String(labelText), textX, bgStartY + config.fontSize + config.toolTipPadding / 2); + context.stroke(); + context.setTextAlign('left'); + } + } +} + +function drawToolTipHorizentalLine (opts, config, context, eachSpacing, xAxisPoints) { + var toolTipOption = assign({}, { + gridType: 'solid', + dashLength: 4 + }, opts.extra.tooltip); + var startX = opts.area[3]; + var endX = opts.width - opts.area[1]; + if (toolTipOption.gridType == 'dash') { + context.setLineDash([toolTipOption.dashLength, toolTipOption.dashLength]); + } + context.setStrokeStyle(toolTipOption.gridColor || '#cccccc'); + context.setLineWidth(1 * opts.pix); + context.beginPath(); + context.moveTo(startX, opts.tooltip.offset.y); + context.lineTo(endX, opts.tooltip.offset.y); + context.stroke(); + context.setLineDash([]); + if (toolTipOption.yAxisLabel) { + let labelText = calTooltipYAxisData(opts.tooltip.offset.y, opts.series, opts, config, eachSpacing); + let widthArr = opts.chartData.yAxisData.yAxisWidth; + let tStartLeft = opts.area[3]; + let tStartRight = opts.width - opts.area[1]; + for (let i = 0; i < labelText.length; i++) { + context.setFontSize(config.fontSize); + let textWidth = measureText(labelText[i], config.fontSize, context); + let bgStartX, bgEndX, bgWidth; + if (widthArr[i].position == 'left') { + bgStartX = tStartLeft - widthArr[i].width; + bgEndX = Math.max(bgStartX, bgStartX + textWidth + config.toolTipPadding * 2); + } else { + bgStartX = tStartRight; + bgEndX = Math.max(bgStartX + widthArr[i].width, bgStartX + textWidth + config.toolTipPadding * 2); + } + bgWidth = bgEndX - bgStartX; + let textX = bgStartX + (bgWidth - textWidth) / 2; + let textY = opts.tooltip.offset.y; + context.beginPath(); + context.setFillStyle(hexToRgb(toolTipOption.labelBgColor || config.toolTipBackground, toolTipOption + .labelBgOpacity || config.toolTipOpacity)); + context.setStrokeStyle(toolTipOption.labelBgColor || config.toolTipBackground); + context.setLineWidth(1 * opts.pix); + context.rect(bgStartX, textY - 0.5 * config.fontSize - config.toolTipPadding, bgWidth, config.fontSize + 2 * + config.toolTipPadding); + context.closePath(); + context.stroke(); + context.fill(); + context.beginPath(); + context.setFontSize(config.fontSize); + context.setFillStyle(toolTipOption.labelFontColor || opts.fontColor); + context.fillText(labelText[i], textX, textY + 0.5 * config.fontSize); + context.closePath(); + context.stroke(); + if (widthArr[i].position == 'left') { + tStartLeft -= (widthArr[i].width + opts.yAxis.padding * opts.pix); + } else { + tStartRight += widthArr[i].width + opts.yAxis.padding * opts.pix; + } + } + } +} + +function drawToolTipSplitArea (offsetX, opts, config, context, eachSpacing) { + var toolTipOption = assign({}, { + activeBgColor: '#000000', + activeBgOpacity: 0.08, + activeWidth: eachSpacing + }, opts.extra.column); + toolTipOption.activeWidth = toolTipOption.activeWidth > eachSpacing ? eachSpacing : toolTipOption.activeWidth; + var startY = opts.area[0]; + var endY = opts.height - opts.area[2]; + context.beginPath(); + context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity)); + context.rect(offsetX - toolTipOption.activeWidth / 2, startY, toolTipOption.activeWidth, endY - startY); + context.closePath(); + context.fill(); + context.setFillStyle("#FFFFFF"); +} + +function drawBarToolTipSplitArea (offsetX, opts, config, context, eachSpacing) { + var toolTipOption = assign({}, { + activeBgColor: '#000000', + activeBgOpacity: 0.08 + }, opts.extra.bar); + var startX = opts.area[3]; + var endX = opts.width - opts.area[1]; + context.beginPath(); + context.setFillStyle(hexToRgb(toolTipOption.activeBgColor, toolTipOption.activeBgOpacity)); + context.rect(startX, offsetX - eachSpacing / 2, endX - startX, eachSpacing); + context.closePath(); + context.fill(); + context.setFillStyle("#FFFFFF"); +} + +// 依据项目自定义x轴显示文案,本项目是针对日期做处理MM-DD,否则显示原有 +function processedData (item) { + const text = item?.text; + const newTextArr = item?.text?.split(' '); + const regExgs = /(?\d{2,4}-\d{2}(?:-\d{2})?(?: \d{2}:\d{2}(?::\d{2})?)?)\s(?.*)/; + const match = text?.match(regExgs); + if (match) { + const date = match[1]; + const content = match[2] + return { date, content }; + } + return { date: newTextArr?.[0] || '', content: newTextArr?.[1] || '' }; +}; + +// 新增处理函数显示内容函数 +function formatText (item, tooltip) { + const { content } = processedData(item) + const [label, value] = content?.split(':') + let formattedText = label + ':'; + if (tooltip?.formatter) { + formattedText += tooltip?.formatter(value, item) // 通过回调在外部自定义处理显示 + } else { + formattedText += value; // 默认 + } + return { ...item, text: formattedText }; +} + +function drawToolTip (textList, offset, opts, config, context, eachSpacing, xAxisPoints) { + const { extra: { tooltip } } = opts || {} // 获取拓展的tooltip内容属性 + const { date } = processedData(textList?.[0]) || {} // 对应x轴坐标值,并去掉默认角标 + const newTextList = textList.map(item => formatText(item, tooltip)) // 处理自定义内容值 + const resList = [{ color: null, text: date }, ...newTextList]; // 重新生成最新的内容 + textList = JSON.parse(JSON.stringify(resList)); + var toolTipOption = assign({}, { + showBox: true, + showArrow: true, + showCategory: false, + bgColor: '#000000', + bgOpacity: 0.7, + borderColor: '#000000', + borderWidth: 0, + borderRadius: 0, + borderOpacity: 0.7, + fontColor: '#FFFFFF', + splitLine: true, + }, opts.extra.tooltip); + if (toolTipOption.showCategory == true && opts.categories) { + textList.unshift({ text: opts.categories[opts.tooltip.index], color: null }) + } + var legendWidth = 4 * opts.pix; + var legendMarginRight = 5 * opts.pix; + var arrowWidth = toolTipOption.showArrow ? 8 * opts.pix : 0; + var isOverRightBorder = false; + if (opts.type == 'line' || opts.type == 'mount' || opts.type == 'area' || opts.type == 'candle' || opts.type == + 'mix') { + if (toolTipOption.splitLine == true) { + drawToolTipSplitLine(opts.tooltip.offset.x, opts, config, context); + } + } + offset = assign({ + x: 0, + y: 0 + }, offset); + offset.y -= 8 * opts.pix; + var textWidth = textList.map(function (item) { + return measureText(item.text, config.fontSize, context); + }); + var toolTipWidth = legendWidth + legendMarginRight + 4 * config.toolTipPadding + Math.max.apply(null, textWidth); + var toolTipHeight = 2 * config.toolTipPadding + textList.length * config.toolTipLineHeight; + if (toolTipOption.showBox == false) { + return + } + // if beyond the right border + if (offset.x - Math.abs(opts._scrollDistance_ || 0) + arrowWidth + toolTipWidth > opts.width) { + isOverRightBorder = true; + } + if (toolTipHeight + offset.y > opts.height) { + offset.y = opts.height - toolTipHeight; + } + // draw background rect + context.beginPath(); + context.setFillStyle(hexToRgb(toolTipOption.bgColor || config.toolTipBackground, toolTipOption.bgOpacity || config + .toolTipOpacity)); + context.setLineWidth(toolTipOption.borderWidth * opts.pix); + context.setStrokeStyle(hexToRgb(toolTipOption.borderColor, toolTipOption.borderOpacity)); + var radius = toolTipOption.borderRadius; + if (isOverRightBorder) { + if (toolTipOption.showArrow) { + context.moveTo(offset.x, offset.y + 10 * opts.pix); + context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pix + 5 * opts.pix); + } + context.arc(offset.x - arrowWidth - radius, offset.y + toolTipHeight - radius, radius, 0, Math.PI / 2, false); + context.arc(offset.x - arrowWidth - Math.round(toolTipWidth) + radius, offset.y + toolTipHeight - radius, + radius, + Math.PI / 2, Math.PI, false); + context.arc(offset.x - arrowWidth - Math.round(toolTipWidth) + radius, offset.y + radius, radius, -Math.PI, - + Math.PI / 2, false); + context.arc(offset.x - arrowWidth - radius, offset.y + radius, radius, -Math.PI / 2, 0, false); + if (toolTipOption.showArrow) { + context.lineTo(offset.x - arrowWidth, offset.y + 10 * opts.pix - 5 * opts.pix); + context.lineTo(offset.x, offset.y + 10 * opts.pix); + } + } else { + if (toolTipOption.showArrow) { + context.moveTo(offset.x, offset.y + 10 * opts.pix); + context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pix - 5 * opts.pix); + } + context.arc(offset.x + arrowWidth + radius, offset.y + radius, radius, -Math.PI, -Math.PI / 2, false); + context.arc(offset.x + arrowWidth + Math.round(toolTipWidth) - radius, offset.y + radius, radius, -Math.PI / 2, + 0, + false); + context.arc(offset.x + arrowWidth + Math.round(toolTipWidth) - radius, offset.y + toolTipHeight - radius, + radius, 0, + Math.PI / 2, false); + context.arc(offset.x + arrowWidth + radius, offset.y + toolTipHeight - radius, radius, Math.PI / 2, Math.PI, + false); + if (toolTipOption.showArrow) { + context.lineTo(offset.x + arrowWidth, offset.y + 10 * opts.pix + 5 * opts.pix); + context.lineTo(offset.x, offset.y + 10 * opts.pix); + } + } + context.closePath(); + context.fill(); + if (toolTipOption.borderWidth > 0) { + context.stroke(); + } + // draw legend + textList.forEach(function (item, index) { + if (item.color !== null) { + context.beginPath(); + context.setFillStyle(item.color); + var startX = offset.x + arrowWidth + 2 * config.toolTipPadding; + var startY = offset.y + (config.toolTipLineHeight - config.fontSize) / 2 + config + .toolTipLineHeight * index + config.toolTipPadding + 1; + if (isOverRightBorder) { + startX = offset.x - toolTipWidth - arrowWidth + 2 * config.toolTipPadding; + } + context.fillRect(startX, startY, legendWidth, config.fontSize); + context.closePath(); + } + }); + // draw text list + textList.forEach(function (item, index) { + var startX = offset.x + arrowWidth + 2 * config.toolTipPadding + legendWidth + legendMarginRight; + if (isOverRightBorder) { + startX = offset.x - toolTipWidth - arrowWidth + 2 * config.toolTipPadding + +legendWidth + + legendMarginRight; + } + var startY = offset.y + (config.toolTipLineHeight - config.fontSize) / 2 + config.toolTipLineHeight * + index + config.toolTipPadding; + context.beginPath(); + context.setFontSize(config.fontSize); + context.setFillStyle(toolTipOption.fontColor); + context.fillText(item.text, startX, startY + config.fontSize); + context.closePath(); + context.stroke(); + }); +} + +function drawColumnDataPoints (series, opts, config, context) { + let process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + let xAxisData = opts.chartData.xAxisData, + xAxisPoints = xAxisData.xAxisPoints, + eachSpacing = xAxisData.eachSpacing; + let columnOption = assign({}, { + type: 'group', + width: eachSpacing / 2, + meterBorder: 4, + meterFillColor: '#FFFFFF', + barBorderCircle: false, + barBorderRadius: [], + seriesGap: 2, + linearType: 'none', + linearOpacity: 1, + customColor: [], + colorStop: 0, + }, opts.extra.column); + let calPoints = []; + context.save(); + let leftNum = -2; + let rightNum = xAxisPoints.length + 2; + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { + context.translate(opts._scrollDistance_, 0); + leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2; + rightNum = leftNum + opts.xAxis.itemCount + 4; + } + if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) { + drawToolTipSplitArea(opts.tooltip.offset.x, opts, config, context, eachSpacing); + } + columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config); + series.forEach(function (eachSeries, seriesIndex) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]); + minRange = ranges.pop(); + maxRange = ranges.shift(); + var data = eachSeries.data; + switch (columnOption.type) { + case 'group': + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, + process); + var tooltipPoints = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, + config, seriesIndex, series, process); + calPoints.push(tooltipPoints); + points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts); + for (let i = 0; i < points.length; i++) { + let item = points[i]; + //fix issues/I27B1N yyoinge & Joeshu + if (item !== null && i > leftNum && i < rightNum) { + var startX = item.x - item.width / 2; + var height = opts.height - item.y - opts.area[2]; + context.beginPath(); + var fillColor = item.color || eachSeries.color + var strokeColor = item.color || eachSeries.color + if (columnOption.linearType !== 'none') { + var grd = context.createLinearGradient(startX, item.y, startX, opts.height - opts + .area[2]); + //透明渐变 + if (columnOption.linearType == 'opacity') { + grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity)); + grd.addColorStop(1, hexToRgb(fillColor, 1)); + } else { + grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], + columnOption.linearOpacity)); + grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[ + eachSeries.linearIndex], columnOption.linearOpacity)); + grd.addColorStop(1, hexToRgb(fillColor, 1)); + } + fillColor = grd + } + // 圆角边框 + if ((columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4) || + columnOption.barBorderCircle === true) { + const left = startX; + const top = item.y; + const width = item.width; + const height = opts.height - opts.area[2] - item.y; + if (columnOption.barBorderCircle) { + columnOption.barBorderRadius = [width / 2, width / 2, 0, 0]; + } + let [r0, r1, r2, r3] = columnOption.barBorderRadius; + let minRadius = Math.min(width / 2, height / 2); + r0 = r0 > minRadius ? minRadius : r0; + r1 = r1 > minRadius ? minRadius : r1; + r2 = r2 > minRadius ? minRadius : r2; + r3 = r3 > minRadius ? minRadius : r3; + r0 = r0 < 0 ? 0 : r0; + r1 = r1 < 0 ? 0 : r1; + r2 = r2 < 0 ? 0 : r2; + r3 = r3 < 0 ? 0 : r3; + context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2); + context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0); + context.arc(left + width - r2, top + height - r2, r2, 0, Math.PI / 2); + context.arc(left + r3, top + height - r3, r3, Math.PI / 2, Math.PI); + } else { + context.moveTo(startX, item.y); + context.lineTo(startX + item.width, item.y); + context.lineTo(startX + item.width, opts.height - opts.area[2]); + context.lineTo(startX, opts.height - opts.area[2]); + context.lineTo(startX, item.y); + context.setLineWidth(1) + context.setStrokeStyle(strokeColor); + } + context.setFillStyle(fillColor); + context.closePath(); + //context.stroke(); + context.fill(); + } + }; + break; + case 'stack': + // 绘制堆叠数据图 + var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, + config, seriesIndex, series, process); + calPoints.push(points); + points = fixColumeStackData(points, eachSpacing, series.length, seriesIndex, config, opts, + series); + for (let i = 0; i < points.length; i++) { + let item = points[i]; + if (item !== null && i > leftNum && i < rightNum) { + context.beginPath(); + var fillColor = item.color || eachSeries.color; + var startX = item.x - item.width / 2 + 1; + var height = opts.height - item.y - opts.area[2]; + var height0 = opts.height - item.y0 - opts.area[2]; + if (seriesIndex > 0) { + height -= height0; + } + context.setFillStyle(fillColor); + context.moveTo(startX, item.y); + context.fillRect(startX, item.y, item.width, height); + context.closePath(); + context.fill(); + } + }; + break; + case 'meter': + // 绘制温度计数据图 + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, + process); + calPoints.push(points); + points = fixColumeMeterData(points, eachSpacing, series.length, seriesIndex, config, opts, + columnOption.meterBorder); + for (let i = 0; i < points.length; i++) { + let item = points[i]; + if (item !== null && i > leftNum && i < rightNum) { + //画背景颜色 + context.beginPath(); + if (seriesIndex == 0 && columnOption.meterBorder > 0) { + context.setStrokeStyle(eachSeries.color); + context.setLineWidth(columnOption.meterBorder * opts.pix); + } + if (seriesIndex == 0) { + context.setFillStyle(columnOption.meterFillColor); + } else { + context.setFillStyle(item.color || eachSeries.color); + } + var startX = item.x - item.width / 2; + var height = opts.height - item.y - opts.area[2]; + if ((columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4) || + columnOption.barBorderCircle === true) { + const left = startX; + const top = item.y; + const width = item.width; + const height = opts.height - opts.area[2] - item.y; + if (columnOption.barBorderCircle) { + columnOption.barBorderRadius = [width / 2, width / 2, 0, 0]; + } + let [r0, r1, r2, r3] = columnOption.barBorderRadius; + let minRadius = Math.min(width / 2, height / 2); + r0 = r0 > minRadius ? minRadius : r0; + r1 = r1 > minRadius ? minRadius : r1; + r2 = r2 > minRadius ? minRadius : r2; + r3 = r3 > minRadius ? minRadius : r3; + r0 = r0 < 0 ? 0 : r0; + r1 = r1 < 0 ? 0 : r1; + r2 = r2 < 0 ? 0 : r2; + r3 = r3 < 0 ? 0 : r3; + context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2); + context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0); + context.arc(left + width - r2, top + height - r2, r2, 0, Math.PI / 2); + context.arc(left + r3, top + height - r3, r3, Math.PI / 2, Math.PI); + context.fill(); + } else { + context.moveTo(startX, item.y); + context.lineTo(startX + item.width, item.y); + context.lineTo(startX + item.width, opts.height - opts.area[2]); + context.lineTo(startX, opts.height - opts.area[2]); + context.lineTo(startX, item.y); + context.fill(); + } + if (seriesIndex == 0 && columnOption.meterBorder > 0) { + context.closePath(); + context.stroke(); + } + } + } + break; + } + }); + + if (opts.dataLabel !== false && process === 1) { + series.forEach(function (eachSeries, seriesIndex) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]); + minRange = ranges.pop(); + maxRange = ranges.shift(); + var data = eachSeries.data; + switch (columnOption.type) { + case 'group': + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, + process); + points = fixColumeData(points, eachSpacing, series.length, seriesIndex, config, opts); + drawPointText(points, eachSeries, config, context, opts); + break; + case 'stack': + var points = getStackDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, + config, seriesIndex, series, process); + drawPointText(points, eachSeries, config, context, opts); + break; + case 'meter': + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, + process); + drawPointText(points, eachSeries, config, context, opts); + break; + } + }); + } + context.restore(); + return { + xAxisPoints: xAxisPoints, + calPoints: calPoints, + eachSpacing: eachSpacing + }; +} + +function drawMountDataPoints (series, opts, config, context) { + let process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + let xAxisData = opts.chartData.xAxisData, + xAxisPoints = xAxisData.xAxisPoints, + eachSpacing = xAxisData.eachSpacing; + let mountOption = assign({}, { + type: 'mount', + widthRatio: 1, + borderWidth: 1, + barBorderCircle: false, + barBorderRadius: [], + linearType: 'none', + linearOpacity: 1, + customColor: [], + colorStop: 0, + }, opts.extra.mount); + mountOption.widthRatio = mountOption.widthRatio <= 0 ? 0 : mountOption.widthRatio; + mountOption.widthRatio = mountOption.widthRatio >= 2 ? 2 : mountOption.widthRatio; + let calPoints = []; + context.save(); + let leftNum = -2; + let rightNum = xAxisPoints.length + 2; + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { + context.translate(opts._scrollDistance_, 0); + leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2; + rightNum = leftNum + opts.xAxis.itemCount + 4; + } + mountOption.customColor = fillCustomColor(mountOption.linearType, mountOption.customColor, series, config); + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.yAxisData.ranges[0]); + minRange = ranges.pop(); + maxRange = ranges.shift(); + var points = getMountDataPoints(series, minRange, maxRange, xAxisPoints, eachSpacing, opts, mountOption, process); + switch (mountOption.type) { + case 'bar': + for (let i = 0; i < points.length; i++) { + let item = points[i]; + if (item !== null && i > leftNum && i < rightNum) { + var startX = item.x - eachSpacing * mountOption.widthRatio / 2; + var height = opts.height - item.y - opts.area[2]; + context.beginPath(); + var fillColor = item.color || series[i].color + var strokeColor = item.color || series[i].color + if (mountOption.linearType !== 'none') { + var grd = context.createLinearGradient(startX, item.y, startX, opts.height - opts.area[2]); + //透明渐变 + if (mountOption.linearType == 'opacity') { + grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity)); + grd.addColorStop(1, hexToRgb(fillColor, 1)); + } else { + grd.addColorStop(0, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption + .linearOpacity)); + grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[i] + .linearIndex], mountOption.linearOpacity)); + grd.addColorStop(1, hexToRgb(fillColor, 1)); + } + fillColor = grd + } + // 圆角边框 + if ((mountOption.barBorderRadius && mountOption.barBorderRadius.length === 4) || mountOption + .barBorderCircle === true) { + const left = startX; + const top = item.y; + const width = item.width; + const height = opts.height - opts.area[2] - item.y - mountOption.borderWidth * opts.pix / 2; + if (mountOption.barBorderCircle) { + mountOption.barBorderRadius = [width / 2, width / 2, 0, 0]; + } + let [r0, r1, r2, r3] = mountOption.barBorderRadius; + let minRadius = Math.min(width / 2, height / 2); + r0 = r0 > minRadius ? minRadius : r0; + r1 = r1 > minRadius ? minRadius : r1; + r2 = r2 > minRadius ? minRadius : r2; + r3 = r3 > minRadius ? minRadius : r3; + r0 = r0 < 0 ? 0 : r0; + r1 = r1 < 0 ? 0 : r1; + r2 = r2 < 0 ? 0 : r2; + r3 = r3 < 0 ? 0 : r3; + context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2); + context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0); + context.arc(left + width - r2, top + height - r2, r2, 0, Math.PI / 2); + context.arc(left + r3, top + height - r3, r3, Math.PI / 2, Math.PI); + } else { + context.moveTo(startX, item.y); + context.lineTo(startX + item.width, item.y); + context.lineTo(startX + item.width, opts.height - opts.area[2]); + context.lineTo(startX, opts.height - opts.area[2]); + context.lineTo(startX, item.y); + } + context.setStrokeStyle(strokeColor); + context.setFillStyle(fillColor); + if (mountOption.borderWidth > 0) { + context.setLineWidth(mountOption.borderWidth * opts.pix); + context.closePath(); + context.stroke(); + } + context.fill(); + } + }; + break; + case 'triangle': + for (let i = 0; i < points.length; i++) { + let item = points[i]; + if (item !== null && i > leftNum && i < rightNum) { + var startX = item.x - eachSpacing * mountOption.widthRatio / 2; + var height = opts.height - item.y - opts.area[2]; + context.beginPath(); + var fillColor = item.color || series[i].color + var strokeColor = item.color || series[i].color + if (mountOption.linearType !== 'none') { + var grd = context.createLinearGradient(startX, item.y, startX, opts.height - opts.area[2]); + //透明渐变 + if (mountOption.linearType == 'opacity') { + grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity)); + grd.addColorStop(1, hexToRgb(fillColor, 1)); + } else { + grd.addColorStop(0, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption + .linearOpacity)); + grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[i] + .linearIndex], mountOption.linearOpacity)); + grd.addColorStop(1, hexToRgb(fillColor, 1)); + } + fillColor = grd + } + context.moveTo(startX, opts.height - opts.area[2]); + context.lineTo(item.x, item.y); + context.lineTo(startX + item.width, opts.height - opts.area[2]); + context.setStrokeStyle(strokeColor); + context.setFillStyle(fillColor); + if (mountOption.borderWidth > 0) { + context.setLineWidth(mountOption.borderWidth * opts.pix); + context.stroke(); + } + context.fill(); + } + }; + break; + case 'mount': + for (let i = 0; i < points.length; i++) { + let item = points[i]; + if (item !== null && i > leftNum && i < rightNum) { + var startX = item.x - eachSpacing * mountOption.widthRatio / 2; + var height = opts.height - item.y - opts.area[2]; + context.beginPath(); + var fillColor = item.color || series[i].color + var strokeColor = item.color || series[i].color + if (mountOption.linearType !== 'none') { + var grd = context.createLinearGradient(startX, item.y, startX, opts.height - opts.area[2]); + //透明渐变 + if (mountOption.linearType == 'opacity') { + grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity)); + grd.addColorStop(1, hexToRgb(fillColor, 1)); + } else { + grd.addColorStop(0, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption + .linearOpacity)); + grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[i] + .linearIndex], mountOption.linearOpacity)); + grd.addColorStop(1, hexToRgb(fillColor, 1)); + } + fillColor = grd + } + context.moveTo(startX, opts.height - opts.area[2]); + context.bezierCurveTo(item.x - item.width / 4, opts.height - opts.area[2], item.x - item.width / 4, + item.y, item.x, item.y); + context.bezierCurveTo(item.x + item.width / 4, item.y, item.x + item.width / 4, opts.height - opts + .area[2], startX + item.width, opts.height - opts.area[2]); + context.setStrokeStyle(strokeColor); + context.setFillStyle(fillColor); + if (mountOption.borderWidth > 0) { + context.setLineWidth(mountOption.borderWidth * opts.pix); + context.stroke(); + } + context.fill(); + } + }; + break; + case 'sharp': + for (let i = 0; i < points.length; i++) { + let item = points[i]; + if (item !== null && i > leftNum && i < rightNum) { + var startX = item.x - eachSpacing * mountOption.widthRatio / 2; + var height = opts.height - item.y - opts.area[2]; + context.beginPath(); + var fillColor = item.color || series[i].color + var strokeColor = item.color || series[i].color + if (mountOption.linearType !== 'none') { + var grd = context.createLinearGradient(startX, item.y, startX, opts.height - opts.area[2]); + //透明渐变 + if (mountOption.linearType == 'opacity') { + grd.addColorStop(0, hexToRgb(fillColor, mountOption.linearOpacity)); + grd.addColorStop(1, hexToRgb(fillColor, 1)); + } else { + grd.addColorStop(0, hexToRgb(mountOption.customColor[series[i].linearIndex], mountOption + .linearOpacity)); + grd.addColorStop(mountOption.colorStop, hexToRgb(mountOption.customColor[series[i] + .linearIndex], mountOption.linearOpacity)); + grd.addColorStop(1, hexToRgb(fillColor, 1)); + } + fillColor = grd + } + context.moveTo(startX, opts.height - opts.area[2]); + context.quadraticCurveTo(item.x - 0, opts.height - opts.area[2] - height / 4, item.x, item.y); + context.quadraticCurveTo(item.x + 0, opts.height - opts.area[2] - height / 4, startX + item.width, + opts.height - opts.area[2]) + context.setStrokeStyle(strokeColor); + context.setFillStyle(fillColor); + if (mountOption.borderWidth > 0) { + context.setLineWidth(mountOption.borderWidth * opts.pix); + context.stroke(); + } + context.fill(); + } + }; + break; + } + + if (opts.dataLabel !== false && process === 1) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.yAxisData.ranges[0]); + minRange = ranges.pop(); + maxRange = ranges.shift(); + var points = getMountDataPoints(series, minRange, maxRange, xAxisPoints, eachSpacing, opts, mountOption, + process); + drawMountPointText(points, series, config, context, opts); + } + context.restore(); + return { + xAxisPoints: xAxisPoints, + calPoints: points, + eachSpacing: eachSpacing + }; +} + +function drawBarDataPoints (series, opts, config, context) { + let process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + let yAxisPoints = []; + let eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / opts.categories.length; + for (let i = 0; i < opts.categories.length; i++) { + yAxisPoints.push(opts.area[0] + eachSpacing / 2 + eachSpacing * i); + } + let columnOption = assign({}, { + type: 'group', + width: eachSpacing / 2, + meterBorder: 4, + meterFillColor: '#FFFFFF', + barBorderCircle: false, + barBorderRadius: [], + seriesGap: 2, + linearType: 'none', + linearOpacity: 1, + customColor: [], + colorStop: 0, + }, opts.extra.bar); + let calPoints = []; + context.save(); + let leftNum = -2; + let rightNum = yAxisPoints.length + 2; + if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) { + drawBarToolTipSplitArea(opts.tooltip.offset.y, opts, config, context, eachSpacing); + } + columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config); + series.forEach(function (eachSeries, seriesIndex) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.xAxisData.ranges); + maxRange = ranges.pop(); + minRange = ranges.shift(); + var data = eachSeries.data; + switch (columnOption.type) { + case 'group': + var points = getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, config, + process); + var tooltipPoints = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, + opts, config, seriesIndex, series, process); + calPoints.push(tooltipPoints); + points = fixBarData(points, eachSpacing, series.length, seriesIndex, config, opts); + for (let i = 0; i < points.length; i++) { + let item = points[i]; + //fix issues/I27B1N yyoinge & Joeshu + if (item !== null && i > leftNum && i < rightNum) { + //var startX = item.x - item.width / 2; + var startX = opts.area[3]; + var startY = item.y - item.width / 2; + var height = item.height; + context.beginPath(); + var fillColor = item.color || eachSeries.color + var strokeColor = item.color || eachSeries.color + if (columnOption.linearType !== 'none') { + var grd = context.createLinearGradient(startX, item.y, item.x, item.y); + //透明渐变 + if (columnOption.linearType == 'opacity') { + grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity)); + grd.addColorStop(1, hexToRgb(fillColor, 1)); + } else { + grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], + columnOption.linearOpacity)); + grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[ + eachSeries.linearIndex], columnOption.linearOpacity)); + grd.addColorStop(1, hexToRgb(fillColor, 1)); + } + fillColor = grd + } + // 圆角边框 + if ((columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4) || + columnOption.barBorderCircle === true) { + const left = startX; + const width = item.width; + const top = item.y - item.width / 2; + const height = item.height; + if (columnOption.barBorderCircle) { + columnOption.barBorderRadius = [width / 2, width / 2, 0, 0]; + } + let [r0, r1, r2, r3] = columnOption.barBorderRadius; + let minRadius = Math.min(width / 2, height / 2); + r0 = r0 > minRadius ? minRadius : r0; + r1 = r1 > minRadius ? minRadius : r1; + r2 = r2 > minRadius ? minRadius : r2; + r3 = r3 > minRadius ? minRadius : r3; + r0 = r0 < 0 ? 0 : r0; + r1 = r1 < 0 ? 0 : r1; + r2 = r2 < 0 ? 0 : r2; + r3 = r3 < 0 ? 0 : r3; + + context.arc(left + r3, top + r3, r3, -Math.PI, -Math.PI / 2); + context.arc(item.x - r0, top + r0, r0, -Math.PI / 2, 0); + context.arc(item.x - r1, top + width - r1, r1, 0, Math.PI / 2); + context.arc(left + r2, top + width - r2, r2, Math.PI / 2, Math.PI); + } else { + context.moveTo(startX, startY); + context.lineTo(item.x, startY); + context.lineTo(item.x, startY + item.width); + context.lineTo(startX, startY + item.width); + context.lineTo(startX, startY); + context.setLineWidth(1) + context.setStrokeStyle(strokeColor); + } + context.setFillStyle(fillColor); + context.closePath(); + //context.stroke(); + context.fill(); + } + }; + break; + case 'stack': + // 绘制堆叠数据图 + var points = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, + config, seriesIndex, series, process); + calPoints.push(points); + points = fixBarStackData(points, eachSpacing, series.length, seriesIndex, config, opts, series); + for (let i = 0; i < points.length; i++) { + let item = points[i]; + if (item !== null && i > leftNum && i < rightNum) { + context.beginPath(); + var fillColor = item.color || eachSeries.color; + var startX = item.x0; + context.setFillStyle(fillColor); + context.moveTo(startX, item.y - item.width / 2); + context.fillRect(startX, item.y - item.width / 2, item.height, item.width); + context.closePath(); + context.fill(); + } + }; + break; + } + }); + + if (opts.dataLabel !== false && process === 1) { + series.forEach(function (eachSeries, seriesIndex) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.xAxisData.ranges); + maxRange = ranges.pop(); + minRange = ranges.shift(); + var data = eachSeries.data; + switch (columnOption.type) { + case 'group': + var points = getBarDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, + config, process); + points = fixBarData(points, eachSpacing, series.length, seriesIndex, config, opts); + drawBarPointText(points, eachSeries, config, context, opts); + break; + case 'stack': + var points = getBarStackDataPoints(data, minRange, maxRange, yAxisPoints, eachSpacing, opts, + config, seriesIndex, series, process); + drawBarPointText(points, eachSeries, config, context, opts); + break; + } + }); + } + return { + yAxisPoints: yAxisPoints, + calPoints: calPoints, + eachSpacing: eachSpacing + }; +} + +function drawCandleDataPoints (series, seriesMA, opts, config, context) { + var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1; + var candleOption = assign({}, { + color: {}, + average: {} + }, opts.extra.candle); + candleOption.color = assign({}, { + upLine: '#f04864', + upFill: '#f04864', + downLine: '#2fc25b', + downFill: '#2fc25b' + }, candleOption.color); + candleOption.average = assign({}, { + show: false, + name: [], + day: [], + color: config.color + }, candleOption.average); + opts.extra.candle = candleOption; + let xAxisData = opts.chartData.xAxisData, + xAxisPoints = xAxisData.xAxisPoints, + eachSpacing = xAxisData.eachSpacing; + let calPoints = []; + context.save(); + let leftNum = -2; + let rightNum = xAxisPoints.length + 2; + let leftSpace = 0; + let rightSpace = opts.width + eachSpacing; + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { + context.translate(opts._scrollDistance_, 0); + leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2; + rightNum = leftNum + opts.xAxis.itemCount + 4; + leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3]; + rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing; + } + //画均线 + if (candleOption.average.show || seriesMA) { //Merge pull request !12 from 邱贵翔 + seriesMA.forEach(function (eachSeries, seriesIndex) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]); + minRange = ranges.pop(); + maxRange = ranges.shift(); + var data = eachSeries.data; + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, + process); + var splitPointList = splitPoints(points, eachSeries); + for (let i = 0; i < splitPointList.length; i++) { + let points = splitPointList[i]; + context.beginPath(); + context.setStrokeStyle(eachSeries.color); + context.setLineWidth(1); + if (points.length === 1) { + context.moveTo(points[0].x, points[0].y); + context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI); + } else { + context.moveTo(points[0].x, points[0].y); + let startPoint = 0; + for (let j = 0; j < points.length; j++) { + let item = points[j]; + if (startPoint == 0 && item.x > leftSpace) { + context.moveTo(item.x, item.y); + startPoint = 1; + } + if (j > 0 && item.x > leftSpace && item.x < rightSpace) { + var ctrlPoint = createCurveControlPoints(points, j - 1); + context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, + ctrlPoint.ctrB.y, item.x, + item.y); + } + } + context.moveTo(points[0].x, points[0].y); + } + context.closePath(); + context.stroke(); + } + }); + } + //画K线 + series.forEach(function (eachSeries, seriesIndex) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]); + minRange = ranges.pop(); + maxRange = ranges.shift(); + var data = eachSeries.data; + var points = getCandleDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, + process); + calPoints.push(points); + var splitPointList = splitPoints(points, eachSeries); + for (let i = 0; i < splitPointList[0].length; i++) { + if (i > leftNum && i < rightNum) { + let item = splitPointList[0][i]; + context.beginPath(); + //如果上涨 + if (data[i][1] - data[i][0] > 0) { + context.setStrokeStyle(candleOption.color.upLine); + context.setFillStyle(candleOption.color.upFill); + context.setLineWidth(1 * opts.pix); + context.moveTo(item[3].x, item[3].y); //顶点 + context.lineTo(item[1].x, item[1].y); //收盘中间点 + context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点 + context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点 + context.lineTo(item[0].x, item[0].y); //开盘中间点 + context.lineTo(item[2].x, item[2].y); //底点 + context.lineTo(item[0].x, item[0].y); //开盘中间点 + context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点 + context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点 + context.lineTo(item[1].x, item[1].y); //收盘中间点 + context.moveTo(item[3].x, item[3].y); //顶点 + } else { + context.setStrokeStyle(candleOption.color.downLine); + context.setFillStyle(candleOption.color.downFill); + context.setLineWidth(1 * opts.pix); + context.moveTo(item[3].x, item[3].y); //顶点 + context.lineTo(item[0].x, item[0].y); //开盘中间点 + context.lineTo(item[0].x - eachSpacing / 4, item[0].y); //开盘左侧点 + context.lineTo(item[1].x - eachSpacing / 4, item[1].y); //收盘左侧点 + context.lineTo(item[1].x, item[1].y); //收盘中间点 + context.lineTo(item[2].x, item[2].y); //底点 + context.lineTo(item[1].x, item[1].y); //收盘中间点 + context.lineTo(item[1].x + eachSpacing / 4, item[1].y); //收盘右侧点 + context.lineTo(item[0].x + eachSpacing / 4, item[0].y); //开盘右侧点 + context.lineTo(item[0].x, item[0].y); //开盘中间点 + context.moveTo(item[3].x, item[3].y); //顶点 + } + context.closePath(); + context.fill(); + context.stroke(); + } + } + }); + context.restore(); + return { + xAxisPoints: xAxisPoints, + calPoints: calPoints, + eachSpacing: eachSpacing + }; +} + +function drawAreaDataPoints (series, opts, config, context) { + var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + var areaOption = assign({}, { + type: 'straight', + opacity: 0.2, + addLine: false, + width: 2, + gradient: false + }, opts.extra.area); + let xAxisData = opts.chartData.xAxisData, + xAxisPoints = xAxisData.xAxisPoints, + eachSpacing = xAxisData.eachSpacing; + let endY = opts.height - opts.area[2]; + let calPoints = []; + context.save(); + let leftSpace = 0; + let rightSpace = opts.width + eachSpacing; + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { + context.translate(opts._scrollDistance_, 0); + leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3]; + rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing; + } + series.forEach(function (eachSeries, seriesIndex) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]); + minRange = ranges.pop(); + maxRange = ranges.shift(); + let data = eachSeries.data; + let points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process); + calPoints.push(points); + let splitPointList = splitPoints(points, eachSeries); + for (let i = 0; i < splitPointList.length; i++) { + let points = splitPointList[i]; + // 绘制区域数 + context.beginPath(); + context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity)); + if (areaOption.gradient) { + let gradient = context.createLinearGradient(0, opts.area[0], 0, opts.height - opts.area[2]); + gradient.addColorStop('0', hexToRgb(eachSeries.color, areaOption.opacity)); + gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1)); + context.setFillStyle(gradient); + } else { + context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity)); + } + context.setLineWidth(areaOption.width * opts.pix); + if (points.length > 1) { + let firstPoint = points[0]; + let lastPoint = points[points.length - 1]; + context.moveTo(firstPoint.x, firstPoint.y); + let startPoint = 0; + if (areaOption.type === 'curve') { + for (let j = 0; j < points.length; j++) { + let item = points[j]; + if (startPoint == 0 && item.x > leftSpace) { + context.moveTo(item.x, item.y); + startPoint = 1; + } + if (j > 0 && item.x > leftSpace && item.x < rightSpace) { + let ctrlPoint = createCurveControlPoints(points, j - 1); + context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, + ctrlPoint.ctrB.y, item.x, item.y); + } + }; + } + if (areaOption.type === 'straight') { + for (let j = 0; j < points.length; j++) { + let item = points[j]; + if (startPoint == 0 && item.x > leftSpace) { + context.moveTo(item.x, item.y); + startPoint = 1; + } + if (j > 0 && item.x > leftSpace && item.x < rightSpace) { + context.lineTo(item.x, item.y); + } + }; + } + if (areaOption.type === 'step') { + for (let j = 0; j < points.length; j++) { + let item = points[j]; + if (startPoint == 0 && item.x > leftSpace) { + context.moveTo(item.x, item.y); + startPoint = 1; + } + if (j > 0 && item.x > leftSpace && item.x < rightSpace) { + context.lineTo(item.x, points[j - 1].y); + context.lineTo(item.x, item.y); + } + }; + } + context.lineTo(lastPoint.x, endY); + context.lineTo(firstPoint.x, endY); + context.lineTo(firstPoint.x, firstPoint.y); + } else { + let item = points[0]; + context.moveTo(item.x - eachSpacing / 2, item.y); + context.lineTo(item.x + eachSpacing / 2, item.y); + context.lineTo(item.x + eachSpacing / 2, endY); + context.lineTo(item.x - eachSpacing / 2, endY); + context.moveTo(item.x - eachSpacing / 2, item.y); + } + context.closePath(); + context.fill(); + //画连线 + if (areaOption.addLine) { + if (eachSeries.lineType == 'dash') { + let dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8; + dashLength *= opts.pix; + context.setLineDash([dashLength, dashLength]); + } + context.beginPath(); + context.setStrokeStyle(eachSeries.color); + context.setLineWidth(areaOption.width * opts.pix); + if (points.length === 1) { + context.moveTo(points[0].x, points[0].y); + context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI); + } else { + context.moveTo(points[0].x, points[0].y); + let startPoint = 0; + if (areaOption.type === 'curve') { + for (let j = 0; j < points.length; j++) { + let item = points[j]; + if (startPoint == 0 && item.x > leftSpace) { + context.moveTo(item.x, item.y); + startPoint = 1; + } + if (j > 0 && item.x > leftSpace && item.x < rightSpace) { + let ctrlPoint = createCurveControlPoints(points, j - 1); + context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, + ctrlPoint.ctrB.y, item.x, item.y); + } + }; + } + if (areaOption.type === 'straight') { + for (let j = 0; j < points.length; j++) { + let item = points[j]; + if (startPoint == 0 && item.x > leftSpace) { + context.moveTo(item.x, item.y); + startPoint = 1; + } + if (j > 0 && item.x > leftSpace && item.x < rightSpace) { + context.lineTo(item.x, item.y); + } + }; + } + if (areaOption.type === 'step') { + for (let j = 0; j < points.length; j++) { + let item = points[j]; + if (startPoint == 0 && item.x > leftSpace) { + context.moveTo(item.x, item.y); + startPoint = 1; + } + if (j > 0 && item.x > leftSpace && item.x < rightSpace) { + context.lineTo(item.x, points[j - 1].y); + context.lineTo(item.x, item.y); + } + }; + } + context.moveTo(points[0].x, points[0].y); + } + context.stroke(); + context.setLineDash([]); + } + } + //画点 + if (opts.dataPointShape !== false) { + drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts); + } + }); + + if (opts.dataLabel !== false && process === 1) { + series.forEach(function (eachSeries, seriesIndex) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]); + minRange = ranges.pop(); + maxRange = ranges.shift(); + var data = eachSeries.data; + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, + process); + drawPointText(points, eachSeries, config, context, opts); + }); + } + context.restore(); + return { + xAxisPoints: xAxisPoints, + calPoints: calPoints, + eachSpacing: eachSpacing + }; +} + +function drawScatterDataPoints (series, opts, config, context) { + var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + var scatterOption = assign({}, { + type: 'circle' + }, opts.extra.scatter); + let xAxisData = opts.chartData.xAxisData, + xAxisPoints = xAxisData.xAxisPoints, + eachSpacing = xAxisData.eachSpacing; + var calPoints = []; + context.save(); + let leftSpace = 0; + let rightSpace = opts.width + eachSpacing; + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { + context.translate(opts._scrollDistance_, 0); + leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3]; + rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing; + } + series.forEach(function (eachSeries, seriesIndex) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]); + minRange = ranges.pop(); + maxRange = ranges.shift(); + var data = eachSeries.data; + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process); + context.beginPath(); + context.setStrokeStyle(eachSeries.color); + context.setFillStyle(eachSeries.color); + context.setLineWidth(1 * opts.pix); + var shape = eachSeries.pointShape; + if (shape === 'diamond') { + points.forEach(function (item, index) { + if (item !== null) { + context.moveTo(item.x, item.y - 4.5); + context.lineTo(item.x - 4.5, item.y); + context.lineTo(item.x, item.y + 4.5); + context.lineTo(item.x + 4.5, item.y); + context.lineTo(item.x, item.y - 4.5); + } + }); + } else if (shape === 'circle') { + points.forEach(function (item, index) { + if (item !== null) { + context.moveTo(item.x + 2.5 * opts.pix, item.y); + context.arc(item.x, item.y, 3 * opts.pix, 0, 2 * Math.PI, false); + } + }); + } else if (shape === 'square') { + points.forEach(function (item, index) { + if (item !== null) { + context.moveTo(item.x - 3.5, item.y - 3.5); + context.rect(item.x - 3.5, item.y - 3.5, 7, 7); + } + }); + } else if (shape === 'triangle') { + points.forEach(function (item, index) { + if (item !== null) { + context.moveTo(item.x, item.y - 4.5); + context.lineTo(item.x - 4.5, item.y + 4.5); + context.lineTo(item.x + 4.5, item.y + 4.5); + context.lineTo(item.x, item.y - 4.5); + } + }); + } else if (shape === 'triangle') { + return; + } + context.closePath(); + context.fill(); + context.stroke(); + }); + if (opts.dataLabel !== false && process === 1) { + series.forEach(function (eachSeries, seriesIndex) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]); + minRange = ranges.pop(); + maxRange = ranges.shift(); + var data = eachSeries.data; + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, + process); + drawPointText(points, eachSeries, config, context, opts); + }); + } + context.restore(); + return { + xAxisPoints: xAxisPoints, + calPoints: calPoints, + eachSpacing: eachSpacing + }; +} + +function drawBubbleDataPoints (series, opts, config, context) { + var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + var bubbleOption = assign({}, { + opacity: 1, + border: 2 + }, opts.extra.bubble); + let xAxisData = opts.chartData.xAxisData, + xAxisPoints = xAxisData.xAxisPoints, + eachSpacing = xAxisData.eachSpacing; + var calPoints = []; + context.save(); + let leftSpace = 0; + let rightSpace = opts.width + eachSpacing; + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { + context.translate(opts._scrollDistance_, 0); + leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3]; + rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing; + } + series.forEach(function (eachSeries, seriesIndex) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]); + minRange = ranges.pop(); + maxRange = ranges.shift(); + var data = eachSeries.data; + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process); + context.beginPath(); + context.setStrokeStyle(eachSeries.color); + context.setLineWidth(bubbleOption.border * opts.pix); + context.setFillStyle(hexToRgb(eachSeries.color, bubbleOption.opacity)); + points.forEach(function (item, index) { + context.moveTo(item.x + item.r, item.y); + context.arc(item.x, item.y, item.r * opts.pix, 0, 2 * Math.PI, false); + }); + context.closePath(); + context.fill(); + context.stroke(); + + if (opts.dataLabel !== false && process === 1) { + points.forEach(function (item, index) { + context.beginPath(); + var fontSize = series.textSize * opts.pix || config.fontSize; + context.setFontSize(fontSize); + context.setFillStyle(series.textColor || "#FFFFFF"); + context.setTextAlign('center'); + context.fillText(String(item.t), item.x, item.y + fontSize / 2); + context.closePath(); + context.stroke(); + context.setTextAlign('left'); + }); + } + }); + context.restore(); + return { + xAxisPoints: xAxisPoints, + calPoints: calPoints, + eachSpacing: eachSpacing + }; +} + +function drawLineDataPoints (series, opts, config, context) { + var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + var lineOption = assign({}, { + type: 'straight', + width: 2 + }, opts.extra.line); + lineOption.width *= opts.pix; + let xAxisData = opts.chartData.xAxisData, + xAxisPoints = xAxisData.xAxisPoints, + eachSpacing = xAxisData.eachSpacing; + var calPoints = []; + context.save(); + let leftSpace = 0; + let rightSpace = opts.width + eachSpacing; + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { + context.translate(opts._scrollDistance_, 0); + leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3]; + rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing; + } + series.forEach(function (eachSeries, seriesIndex) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]); + minRange = ranges.pop(); + maxRange = ranges.shift(); + var data = eachSeries.data; + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process); + calPoints.push(points); + var splitPointList = splitPoints(points, eachSeries); + if (eachSeries.lineType == 'dash') { + let dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8; + dashLength *= opts.pix; + context.setLineDash([dashLength, dashLength]); + } + context.beginPath(); + context.setStrokeStyle(eachSeries.color); + context.setLineWidth(lineOption.width); + splitPointList.forEach(function (points, index) { + if (points.length === 1) { + context.moveTo(points[0].x, points[0].y); + context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI); + } else { + context.moveTo(points[0].x, points[0].y); + let startPoint = 0; + if (lineOption.type === 'curve') { + for (let j = 0; j < points.length; j++) { + let item = points[j]; + if (startPoint == 0 && item.x > leftSpace) { + context.moveTo(item.x, item.y); + startPoint = 1; + } + if (j > 0 && item.x > leftSpace && item.x < rightSpace) { + var ctrlPoint = createCurveControlPoints(points, j - 1); + context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, + ctrlPoint.ctrB.y, item.x, item.y); + } + }; + } + if (lineOption.type === 'straight') { + for (let j = 0; j < points.length; j++) { + let item = points[j]; + if (startPoint == 0 && item.x > leftSpace) { + context.moveTo(item.x, item.y); + startPoint = 1; + } + if (j > 0 && item.x > leftSpace && item.x < rightSpace) { + context.lineTo(item.x, item.y); + } + }; + } + if (lineOption.type === 'step') { + for (let j = 0; j < points.length; j++) { + let item = points[j]; + if (startPoint == 0 && item.x > leftSpace) { + context.moveTo(item.x, item.y); + startPoint = 1; + } + if (j > 0 && item.x > leftSpace && item.x < rightSpace) { + context.lineTo(item.x, points[j - 1].y); + context.lineTo(item.x, item.y); + } + }; + } + context.moveTo(points[0].x, points[0].y); + } + }); + context.stroke(); + context.setLineDash([]); + if (opts.dataPointShape !== false) { + drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts); + } + }); + if (opts.dataLabel !== false && process === 1) { + series.forEach(function (eachSeries, seriesIndex) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]); + minRange = ranges.pop(); + maxRange = ranges.shift(); + var data = eachSeries.data; + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, + process); + drawPointText(points, eachSeries, config, context, opts); + }); + } + context.restore(); + return { + xAxisPoints: xAxisPoints, + calPoints: calPoints, + eachSpacing: eachSpacing + }; +} + +function drawMixDataPoints (series, opts, config, context) { + let process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + let xAxisData = opts.chartData.xAxisData, + xAxisPoints = xAxisData.xAxisPoints, + eachSpacing = xAxisData.eachSpacing; + let columnOption = assign({}, { + width: eachSpacing / 2, + barBorderCircle: false, + barBorderRadius: [], + seriesGap: 2, + linearType: 'none', + linearOpacity: 1, + customColor: [], + colorStop: 0, + }, opts.extra.mix.column); + let areaOption = assign({}, { + opacity: 0.2, + gradient: false + }, opts.extra.mix.area); + let endY = opts.height - opts.area[2]; + let calPoints = []; + var columnIndex = 0; + var columnLength = 0; + series.forEach(function (eachSeries, seriesIndex) { + if (eachSeries.type == 'column') { + columnLength += 1; + } + }); + context.save(); + let leftNum = -2; + let rightNum = xAxisPoints.length + 2; + let leftSpace = 0; + let rightSpace = opts.width + eachSpacing; + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { + context.translate(opts._scrollDistance_, 0); + leftNum = Math.floor(-opts._scrollDistance_ / eachSpacing) - 2; + rightNum = leftNum + opts.xAxis.itemCount + 4; + leftSpace = -opts._scrollDistance_ - eachSpacing * 2 + opts.area[3]; + rightSpace = leftSpace + (opts.xAxis.itemCount + 4) * eachSpacing; + } + columnOption.customColor = fillCustomColor(columnOption.linearType, columnOption.customColor, series, config); + series.forEach(function (eachSeries, seriesIndex) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]); + minRange = ranges.pop(); + maxRange = ranges.shift(); + var data = eachSeries.data; + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, process); + calPoints.push(points); + // 绘制柱状数据图 + if (eachSeries.type == 'column') { + points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts); + for (let i = 0; i < points.length; i++) { + let item = points[i]; + if (item !== null && i > leftNum && i < rightNum) { + var startX = item.x - item.width / 2; + var height = opts.height - item.y - opts.area[2]; + context.beginPath(); + var fillColor = item.color || eachSeries.color + var strokeColor = item.color || eachSeries.color + if (columnOption.linearType !== 'none') { + var grd = context.createLinearGradient(startX, item.y, startX, opts.height - opts.area[ + 2]); + //透明渐变 + if (columnOption.linearType == 'opacity') { + grd.addColorStop(0, hexToRgb(fillColor, columnOption.linearOpacity)); + grd.addColorStop(1, hexToRgb(fillColor, 1)); + } else { + grd.addColorStop(0, hexToRgb(columnOption.customColor[eachSeries.linearIndex], + columnOption.linearOpacity)); + grd.addColorStop(columnOption.colorStop, hexToRgb(columnOption.customColor[ + eachSeries.linearIndex], columnOption.linearOpacity)); + grd.addColorStop(1, hexToRgb(fillColor, 1)); + } + fillColor = grd + } + // 圆角边框 + if ((columnOption.barBorderRadius && columnOption.barBorderRadius.length === 4) || + columnOption.barBorderCircle) { + const left = startX; + const top = item.y; + const width = item.width; + const height = opts.height - opts.area[2] - item.y; + if (columnOption.barBorderCircle) { + columnOption.barBorderRadius = [width / 2, width / 2, 0, 0]; + } + let [r0, r1, r2, r3] = columnOption.barBorderRadius; + let minRadius = Math.min(width / 2, height / 2); + r0 = r0 > minRadius ? minRadius : r0; + r1 = r1 > minRadius ? minRadius : r1; + r2 = r2 > minRadius ? minRadius : r2; + r3 = r3 > minRadius ? minRadius : r3; + r0 = r0 < 0 ? 0 : r0; + r1 = r1 < 0 ? 0 : r1; + r2 = r2 < 0 ? 0 : r2; + r3 = r3 < 0 ? 0 : r3; + context.arc(left + r0, top + r0, r0, -Math.PI, -Math.PI / 2); + context.arc(left + width - r1, top + r1, r1, -Math.PI / 2, 0); + context.arc(left + width - r2, top + height - r2, r2, 0, Math.PI / 2); + context.arc(left + r3, top + height - r3, r3, Math.PI / 2, Math.PI); + } else { + context.moveTo(startX, item.y); + context.lineTo(startX + item.width, item.y); + context.lineTo(startX + item.width, opts.height - opts.area[2]); + context.lineTo(startX, opts.height - opts.area[2]); + context.lineTo(startX, item.y); + context.setLineWidth(1) + context.setStrokeStyle(strokeColor); + } + context.setFillStyle(fillColor); + context.closePath(); + context.fill(); + } + } + columnIndex += 1; + } + //绘制区域图数据 + if (eachSeries.type == 'area') { + let splitPointList = splitPoints(points, eachSeries); + for (let i = 0; i < splitPointList.length; i++) { + let points = splitPointList[i]; + // 绘制区域数据 + context.beginPath(); + context.setStrokeStyle(eachSeries.color); + context.setStrokeStyle(hexToRgb(eachSeries.color, areaOption.opacity)); + if (areaOption.gradient) { + let gradient = context.createLinearGradient(0, opts.area[0], 0, opts.height - opts.area[2]); + gradient.addColorStop('0', hexToRgb(eachSeries.color, areaOption.opacity)); + gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1)); + context.setFillStyle(gradient); + } else { + context.setFillStyle(hexToRgb(eachSeries.color, areaOption.opacity)); + } + context.setLineWidth(2 * opts.pix); + if (points.length > 1) { + var firstPoint = points[0]; + let lastPoint = points[points.length - 1]; + context.moveTo(firstPoint.x, firstPoint.y); + let startPoint = 0; + if (eachSeries.style === 'curve') { + for (let j = 0; j < points.length; j++) { + let item = points[j]; + if (startPoint == 0 && item.x > leftSpace) { + context.moveTo(item.x, item.y); + startPoint = 1; + } + if (j > 0 && item.x > leftSpace && item.x < rightSpace) { + var ctrlPoint = createCurveControlPoints(points, j - 1); + context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB.x, + ctrlPoint.ctrB.y, item.x, item.y); + } + }; + } else { + for (let j = 0; j < points.length; j++) { + let item = points[j]; + if (startPoint == 0 && item.x > leftSpace) { + context.moveTo(item.x, item.y); + startPoint = 1; + } + if (j > 0 && item.x > leftSpace && item.x < rightSpace) { + context.lineTo(item.x, item.y); + } + }; + } + context.lineTo(lastPoint.x, endY); + context.lineTo(firstPoint.x, endY); + context.lineTo(firstPoint.x, firstPoint.y); + } else { + let item = points[0]; + context.moveTo(item.x - eachSpacing / 2, item.y); + context.lineTo(item.x + eachSpacing / 2, item.y); + context.lineTo(item.x + eachSpacing / 2, endY); + context.lineTo(item.x - eachSpacing / 2, endY); + context.moveTo(item.x - eachSpacing / 2, item.y); + } + context.closePath(); + context.fill(); + } + } + // 绘制折线数据图 + if (eachSeries.type == 'line') { + var splitPointList = splitPoints(points, eachSeries); + splitPointList.forEach(function (points, index) { + if (eachSeries.lineType == 'dash') { + let dashLength = eachSeries.dashLength ? eachSeries.dashLength : 8; + dashLength *= opts.pix; + context.setLineDash([dashLength, dashLength]); + } + context.beginPath(); + context.setStrokeStyle(eachSeries.color); + context.setLineWidth(2 * opts.pix); + if (points.length === 1) { + context.moveTo(points[0].x, points[0].y); + context.arc(points[0].x, points[0].y, 1, 0, 2 * Math.PI); + } else { + context.moveTo(points[0].x, points[0].y); + let startPoint = 0; + if (eachSeries.style == 'curve') { + for (let j = 0; j < points.length; j++) { + let item = points[j]; + if (startPoint == 0 && item.x > leftSpace) { + context.moveTo(item.x, item.y); + startPoint = 1; + } + if (j > 0 && item.x > leftSpace && item.x < rightSpace) { + var ctrlPoint = createCurveControlPoints(points, j - 1); + context.bezierCurveTo(ctrlPoint.ctrA.x, ctrlPoint.ctrA.y, ctrlPoint.ctrB + .x, ctrlPoint.ctrB.y, + item.x, item.y); + } + } + } else { + for (let j = 0; j < points.length; j++) { + let item = points[j]; + if (startPoint == 0 && item.x > leftSpace) { + context.moveTo(item.x, item.y); + startPoint = 1; + } + if (j > 0 && item.x > leftSpace && item.x < rightSpace) { + context.lineTo(item.x, item.y); + } + } + } + context.moveTo(points[0].x, points[0].y); + } + context.stroke(); + context.setLineDash([]); + }); + } + // 绘制点数据图 + if (eachSeries.type == 'point') { + eachSeries.addPoint = true; + } + if (eachSeries.addPoint == true && eachSeries.type !== 'column') { + drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts); + } + }); + if (opts.dataLabel !== false && process === 1) { + var columnIndex = 0; + series.forEach(function (eachSeries, seriesIndex) { + let ranges, minRange, maxRange; + ranges = [].concat(opts.chartData.yAxisData.ranges[eachSeries.index]); + minRange = ranges.pop(); + maxRange = ranges.shift(); + var data = eachSeries.data; + var points = getDataPoints(data, minRange, maxRange, xAxisPoints, eachSpacing, opts, config, + process); + if (eachSeries.type !== 'column') { + drawPointText(points, eachSeries, config, context, opts); + } else { + points = fixColumeData(points, eachSpacing, columnLength, columnIndex, config, opts); + drawPointText(points, eachSeries, config, context, opts); + columnIndex += 1; + } + }); + } + context.restore(); + return { + xAxisPoints: xAxisPoints, + calPoints: calPoints, + eachSpacing: eachSpacing, + } +} + + +function drawToolTipBridge (opts, config, context, process, eachSpacing, xAxisPoints) { + var toolTipOption = opts.extra.tooltip || {}; + if (toolTipOption.horizentalLine && opts.tooltip && process === 1 && (opts.type == 'line' || opts.type == 'area' || + opts.type == 'column' || opts.type == 'mount' || opts.type == 'candle' || opts.type == 'mix')) { + drawToolTipHorizentalLine(opts, config, context, eachSpacing, xAxisPoints) + } + context.save(); + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0 && opts.enableScroll === true) { + context.translate(opts._scrollDistance_, 0); + } + if (opts.tooltip && opts.tooltip.textList && opts.tooltip.textList.length && process === 1) { + drawToolTip(opts.tooltip.textList, opts.tooltip.offset, opts, config, context, eachSpacing, xAxisPoints); + } + context.restore(); + +} + +function drawXAxis (categories, opts, config, context) { + + let xAxisData = opts.chartData.xAxisData, + xAxisPoints = xAxisData.xAxisPoints, + startX = xAxisData.startX, + endX = xAxisData.endX, + eachSpacing = xAxisData.eachSpacing; + var boundaryGap = 'center'; + if (opts.type == 'bar' || opts.type == 'line' || opts.type == 'area' || opts.type == 'scatter' || opts.type == + 'bubble') { + boundaryGap = opts.xAxis.boundaryGap; + } + var startY = opts.height - opts.area[2]; + var endY = opts.area[0]; + + //绘制滚动条 + if (opts.enableScroll && opts.xAxis.scrollShow) { + var scrollY = opts.height - opts.area[2] + config.xAxisHeight; + var scrollScreenWidth = endX - startX; + var scrollTotalWidth = eachSpacing * (xAxisPoints.length - 1); + if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount + .widthRatio > 1) { + if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2 + scrollTotalWidth += (opts.extra.mount.widthRatio - 1) * eachSpacing; + } + var scrollWidth = scrollScreenWidth * scrollScreenWidth / scrollTotalWidth; + var scrollLeft = 0; + if (opts._scrollDistance_) { + scrollLeft = -opts._scrollDistance_ * (scrollScreenWidth) / scrollTotalWidth; + } + context.beginPath(); + context.setLineCap('round'); + context.setLineWidth(6 * opts.pix); + context.setStrokeStyle(opts.xAxis.scrollBackgroundColor || "#EFEBEF"); + context.moveTo(startX, scrollY); + context.lineTo(endX, scrollY); + context.stroke(); + context.closePath(); + context.beginPath(); + context.setLineCap('round'); + context.setLineWidth(6 * opts.pix); + context.setStrokeStyle(opts.xAxis.scrollColor || "#A6A6A6"); + context.moveTo(startX + scrollLeft, scrollY); + context.lineTo(startX + scrollLeft + scrollWidth, scrollY); + context.stroke(); + context.closePath(); + context.setLineCap('butt'); + } + context.save(); + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) { + context.translate(opts._scrollDistance_, 0); + } + //绘制X轴刻度线 + if (opts.xAxis.calibration === true) { + context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc"); + context.setLineCap('butt'); + context.setLineWidth(1 * opts.pix); + xAxisPoints.forEach(function (item, index) { + if (index > 0) { + context.beginPath(); + context.moveTo(item - eachSpacing / 2, startY); + context.lineTo(item - eachSpacing / 2, startY + 3 * opts.pix); + context.closePath(); + context.stroke(); + } + }); + } + //绘制X轴网格 + if (opts.xAxis.disableGrid !== true) { + context.setStrokeStyle(opts.xAxis.gridColor || "#cccccc"); + context.setLineCap('butt'); + context.setLineWidth(1 * opts.pix); + if (opts.xAxis.gridType == 'dash') { + context.setLineDash([opts.xAxis.dashLength * opts.pix, opts.xAxis.dashLength * opts.pix]); + } + opts.xAxis.gridEval = opts.xAxis.gridEval || 1; + xAxisPoints.forEach(function (item, index) { + if (index % opts.xAxis.gridEval == 0) { + context.beginPath(); + context.moveTo(item, startY); + context.lineTo(item, endY); + context.stroke(); + } + }); + context.setLineDash([]); + } + //绘制X轴文案 + if (opts.xAxis.disabled !== true) { + // 对X轴列表做抽稀处理 + //默认全部显示X轴标签 + let maxXAxisListLength = categories.length; + //如果设置了X轴单屏数量 + if (opts.xAxis.labelCount) { + //如果设置X轴密度 + if (opts.xAxis.itemCount) { + maxXAxisListLength = Math.ceil(categories.length / opts.xAxis.itemCount * opts.xAxis.labelCount); + } else { + maxXAxisListLength = opts.xAxis.labelCount; + } + maxXAxisListLength -= 1; + } + + let ratio = Math.ceil(categories.length / maxXAxisListLength); + + let newCategories = []; + let cgLength = categories.length; + for (let i = 0; i < cgLength; i++) { + if (i % ratio !== 0) { + newCategories.push(""); + } else { + newCategories.push(categories[i]); + } + } + newCategories[cgLength - 1] = categories[cgLength - 1]; + var xAxisFontSize = opts.xAxis.fontSize * opts.pix || config.fontSize; + if (config._xAxisTextAngle_ === 0) { + newCategories.forEach(function (item, index) { + var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item, index, opts) : item; + var offset = -measureText(String(xitem), xAxisFontSize, context) / 2; + if (boundaryGap == 'center') { + offset += eachSpacing / 2; + } + var scrollHeight = 0; + if (opts.xAxis.scrollShow) { + scrollHeight = 6 * opts.pix; + } + context.beginPath(); + context.setFontSize(xAxisFontSize); + context.setFillStyle(opts.xAxis.fontColor || opts.fontColor); + context.fillText(String(xitem), xAxisPoints[index] + offset, startY + xAxisFontSize + (config + .xAxisHeight - scrollHeight - xAxisFontSize) / 2); + context.closePath(); + context.stroke(); + }); + } else { + newCategories.forEach(function (item, index) { + var xitem = opts.xAxis.formatter ? opts.xAxis.formatter(item) : item; + context.save(); + context.beginPath(); + context.setFontSize(xAxisFontSize); + context.setFillStyle(opts.xAxis.fontColor || opts.fontColor); + var textWidth = measureText(String(xitem), xAxisFontSize, context); + var offsetX = xAxisPoints[index]; + if (boundaryGap == 'center') { + offsetX = xAxisPoints[index] + eachSpacing / 2; + } + var scrollHeight = 0; + if (opts.xAxis.scrollShow) { + scrollHeight = 6 * opts.pix; + } + var offsetY = startY + 6 * opts.pix + xAxisFontSize - xAxisFontSize * Math.abs(Math.sin(config + ._xAxisTextAngle_)); + if (opts.xAxis.rotateAngle < 0) { + offsetX -= xAxisFontSize / 2; + textWidth = 0; + } else { + offsetX += xAxisFontSize / 2; + textWidth = -textWidth; + } + context.translate(offsetX, offsetY); + context.rotate(-1 * config._xAxisTextAngle_); + context.fillText(String(xitem), textWidth, 0); + context.closePath(); + context.stroke(); + context.restore(); + }); + } + } + context.restore(); + //绘制X轴轴线 + if (opts.xAxis.axisLine) { + context.beginPath(); + context.setStrokeStyle(opts.xAxis.axisLineColor); + context.setLineWidth(1 * opts.pix); + context.moveTo(startX, opts.height - opts.area[2]); + context.lineTo(endX, opts.height - opts.area[2]); + context.stroke(); + } +} + +function drawYAxisGrid (categories, opts, config, context) { + if (opts.yAxis.disableGrid === true) { + return; + } + let spacingValid = opts.height - opts.area[0] - opts.area[2]; + let eachSpacing = spacingValid / opts.yAxis.splitNumber; + let startX = opts.area[3]; + let xAxisPoints = opts.chartData.xAxisData.xAxisPoints, + xAxiseachSpacing = opts.chartData.xAxisData.eachSpacing; + let TotalWidth = xAxiseachSpacing * (xAxisPoints.length - 1); + if (opts.type == 'mount' && opts.extra && opts.extra.mount && opts.extra.mount.widthRatio && opts.extra.mount + .widthRatio > 1) { + if (opts.extra.mount.widthRatio > 2) opts.extra.mount.widthRatio = 2 + TotalWidth += (opts.extra.mount.widthRatio - 1) * xAxiseachSpacing; + } + let endX = startX + TotalWidth; + let points = []; + let startY = 1 + if (opts.xAxis.axisLine === false) { + startY = 0 + } + for (let i = startY; i < opts.yAxis.splitNumber + 1; i++) { + points.push(opts.height - opts.area[2] - eachSpacing * i); + } + context.save(); + if (opts._scrollDistance_ && opts._scrollDistance_ !== 0) { + context.translate(opts._scrollDistance_, 0); + } + if (opts.yAxis.gridType == 'dash') { + context.setLineDash([opts.yAxis.dashLength * opts.pix, opts.yAxis.dashLength * opts.pix]); + } + context.setStrokeStyle(opts.yAxis.gridColor); + context.setLineWidth(1 * opts.pix); + points.forEach(function (item, index) { + context.beginPath(); + context.moveTo(startX, item); + context.lineTo(endX, item); + context.stroke(); + }); + context.setLineDash([]); + context.restore(); +} + +function drawYAxis (series, opts, config, context) { + if (opts.yAxis.disabled === true) { + return; + } + var spacingValid = opts.height - opts.area[0] - opts.area[2]; + var eachSpacing = spacingValid / opts.yAxis.splitNumber; + var startX = opts.area[3]; + var endX = opts.width - opts.area[1]; + var endY = opts.height - opts.area[2]; + var fillEndY = endY + config.xAxisHeight; + if (opts.xAxis.scrollShow) { + fillEndY -= 3 * opts.pix; + } + if (opts.xAxis.rotateLabel) { + fillEndY = opts.height - opts.area[2] + opts.fontSize * opts.pix / 2; + } + // set YAxis background + context.beginPath(); + context.setFillStyle(opts.background); + if (opts.enableScroll == true && opts.xAxis.scrollPosition && opts.xAxis.scrollPosition !== 'left') { + context.fillRect(0, 0, startX, fillEndY); + } + if (opts.enableScroll == true && opts.xAxis.scrollPosition && opts.xAxis.scrollPosition !== 'right') { + context.fillRect(endX, 0, opts.width, fillEndY); + } + context.closePath(); + context.stroke(); + + let tStartLeft = opts.area[3]; + let tStartRight = opts.width - opts.area[1]; + let tStartCenter = opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2; + if (opts.yAxis.data) { + for (let i = 0; i < opts.yAxis.data.length; i++) { + let yData = opts.yAxis.data[i]; + var points = []; + if (yData.type === 'categories') { + for (let i = 0; i <= yData.categories.length; i++) { + points.push(opts.area[0] + spacingValid / yData.categories.length / 2 + spacingValid / yData + .categories.length * i); + } + } else { + for (let i = 0; i <= opts.yAxis.splitNumber; i++) { + points.push(opts.area[0] + eachSpacing * i); + } + } + if (yData.disabled !== true) { + let rangesFormat = opts.chartData.yAxisData.rangesFormat[i]; + let yAxisFontSize = yData.fontSize ? yData.fontSize * opts.pix : config.fontSize; + let yAxisWidth = opts.chartData.yAxisData.yAxisWidth[i]; + let textAlign = yData.textAlign || "right"; + //画Y轴刻度及文案 + rangesFormat.forEach(function (item, index) { + var pos = points[index]; + context.beginPath(); + context.setFontSize(yAxisFontSize); + context.setLineWidth(1 * opts.pix); + context.setStrokeStyle(yData.axisLineColor || '#cccccc'); + context.setFillStyle(yData.fontColor || opts.fontColor); + let tmpstrat = 0; + let gapwidth = 4 * opts.pix; + if (yAxisWidth.position == 'left') { + //画刻度线 + if (yData.calibration == true) { + context.moveTo(tStartLeft, pos); + context.lineTo(tStartLeft - 3 * opts.pix, pos); + gapwidth += 3 * opts.pix; + } + //画文字 + switch (textAlign) { + case "left": + context.setTextAlign('left'); + tmpstrat = tStartLeft - yAxisWidth.width + break; + case "right": + context.setTextAlign('right'); + tmpstrat = tStartLeft - gapwidth + break; + default: + context.setTextAlign('center'); + tmpstrat = tStartLeft - yAxisWidth.width / 2 + } + context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix); + + } else if (yAxisWidth.position == 'right') { + //画刻度线 + if (yData.calibration == true) { + context.moveTo(tStartRight, pos); + context.lineTo(tStartRight + 3 * opts.pix, pos); + gapwidth += 3 * opts.pix; + } + switch (textAlign) { + case "left": + context.setTextAlign('left'); + tmpstrat = tStartRight + gapwidth + break; + case "right": + context.setTextAlign('right'); + tmpstrat = tStartRight + yAxisWidth.width + break; + default: + context.setTextAlign('center'); + tmpstrat = tStartRight + yAxisWidth.width / 2 + } + context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix); + } else if (yAxisWidth.position == 'center') { + //画刻度线 + if (yData.calibration == true) { + context.moveTo(tStartCenter, pos); + context.lineTo(tStartCenter - 3 * opts.pix, pos); + gapwidth += 3 * opts.pix; + } + //画文字 + switch (textAlign) { + case "left": + context.setTextAlign('left'); + tmpstrat = tStartCenter - yAxisWidth.width + break; + case "right": + context.setTextAlign('right'); + tmpstrat = tStartCenter - gapwidth + break; + default: + context.setTextAlign('center'); + tmpstrat = tStartCenter - yAxisWidth.width / 2 + } + context.fillText(String(item), tmpstrat, pos + yAxisFontSize / 2 - 3 * opts.pix); + } + context.closePath(); + context.stroke(); + context.setTextAlign('left'); + }); + //画Y轴轴线 + if (yData.axisLine !== false) { + context.beginPath(); + context.setStrokeStyle(yData.axisLineColor || '#cccccc'); + context.setLineWidth(1 * opts.pix); + if (yAxisWidth.position == 'left') { + context.moveTo(tStartLeft, opts.height - opts.area[2]); + context.lineTo(tStartLeft, opts.area[0]); + } else if (yAxisWidth.position == 'right') { + context.moveTo(tStartRight, opts.height - opts.area[2]); + context.lineTo(tStartRight, opts.area[0]); + } else if (yAxisWidth.position == 'center') { + context.moveTo(tStartCenter, opts.height - opts.area[2]); + context.lineTo(tStartCenter, opts.area[0]); + } + context.stroke(); + } + //画Y轴标题 + if (opts.yAxis.showTitle) { + let titleFontSize = yData.titleFontSize * opts.pix || config.fontSize; + let title = yData.title; + context.beginPath(); + context.setFontSize(titleFontSize); + context.setFillStyle(yData.titleFontColor || opts.fontColor); + if (yAxisWidth.position == 'left') { + context.fillText(title, tStartLeft - measureText(title, titleFontSize, context) / 2 + (yData + .titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix); + } else if (yAxisWidth.position == 'right') { + context.fillText(title, tStartRight - measureText(title, titleFontSize, context) / 2 + (yData + .titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix); + } else if (yAxisWidth.position == 'center') { + context.fillText(title, tStartCenter - measureText(title, titleFontSize, context) / 2 + (yData + .titleOffsetX || 0), opts.area[0] - (10 - (yData.titleOffsetY || 0)) * opts.pix); + } + context.closePath(); + context.stroke(); + } + if (yAxisWidth.position == 'left') { + tStartLeft -= (yAxisWidth.width + opts.yAxis.padding * opts.pix); + } else { + tStartRight += yAxisWidth.width + opts.yAxis.padding * opts.pix; + } + } + } + } + +} + +function drawLegend (series, opts, config, context, chartData) { + if (opts.legend.show === false) { + return; + } + let legendData = chartData.legendData; + let legendList = legendData.points; + let legendArea = legendData.area; + let padding = opts.legend.padding * opts.pix; + let fontSize = opts.legend.fontSize * opts.pix; + let shapeWidth = 15 * opts.pix; + let shapeRight = 5 * opts.pix; + let itemGap = opts.legend.itemGap * opts.pix; + let lineHeight = Math.max(opts.legend.lineHeight * opts.pix, fontSize); + //画背景及边框 + context.beginPath(); + context.setLineWidth(opts.legend.borderWidth * opts.pix); + context.setStrokeStyle(opts.legend.borderColor); + context.setFillStyle(opts.legend.backgroundColor); + context.moveTo(legendArea.start.x, legendArea.start.y); + context.rect(legendArea.start.x, legendArea.start.y, legendArea.width, legendArea.height); + context.closePath(); + context.fill(); + context.stroke(); + legendList.forEach(function (itemList, listIndex) { + let width = 0; + let height = 0; + width = legendData.widthArr[listIndex]; + height = legendData.heightArr[listIndex]; + let startX = 0; + let startY = 0; + if (opts.legend.position == 'top' || opts.legend.position == 'bottom') { + switch (opts.legend.float) { + case 'left': + startX = legendArea.start.x + padding; + break; + case 'right': + startX = legendArea.start.x + legendArea.width - width; + break; + default: + startX = legendArea.start.x + (legendArea.width - width) / 2; + } + startY = legendArea.start.y + padding + listIndex * lineHeight; + } else { + if (listIndex == 0) { + width = 0; + } else { + width = legendData.widthArr[listIndex - 1]; + } + startX = legendArea.start.x + padding + width; + startY = legendArea.start.y + padding + (legendArea.height - height) / 2; + } + context.setFontSize(config.fontSize); + for (let i = 0; i < itemList.length; i++) { + let item = itemList[i]; + item.area = [0, 0, 0, 0]; + item.area[0] = startX; + item.area[1] = startY; + item.area[3] = startY + lineHeight; + context.beginPath(); + context.setLineWidth(1 * opts.pix); + context.setStrokeStyle(item.show ? item.color : opts.legend.hiddenColor); + context.setFillStyle(item.show ? item.color : opts.legend.hiddenColor); + switch (item.legendShape) { + case 'line': + context.moveTo(startX, startY + 0.5 * lineHeight - 2 * opts.pix); + context.fillRect(startX, startY + 0.5 * lineHeight - 2 * opts.pix, 15 * opts.pix, 4 * opts + .pix); + break; + case 'triangle': + context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix); + context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix); + context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix); + context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix); + break; + case 'diamond': + context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix); + context.lineTo(startX + 2.5 * opts.pix, startY + 0.5 * lineHeight); + context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight + 5 * opts.pix); + context.lineTo(startX + 12.5 * opts.pix, startY + 0.5 * lineHeight); + context.lineTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix); + break; + case 'circle': + context.moveTo(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight); + context.arc(startX + 7.5 * opts.pix, startY + 0.5 * lineHeight, 5 * opts.pix, 0, 2 * Math + .PI); + break; + case 'rect': + context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pix); + context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pix, 15 * opts.pix, 10 * opts + .pix); + break; + case 'square': + context.moveTo(startX + 5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix); + context.fillRect(startX + 5 * opts.pix, startY + 0.5 * lineHeight - 5 * opts.pix, 10 * opts + .pix, 10 * opts.pix); + break; + case 'none': + break; + default: + context.moveTo(startX, startY + 0.5 * lineHeight - 5 * opts.pix); + context.fillRect(startX, startY + 0.5 * lineHeight - 5 * opts.pix, 15 * opts.pix, 10 * opts + .pix); + } + context.closePath(); + context.fill(); + context.stroke(); + startX += shapeWidth + shapeRight; + let fontTrans = 0.5 * lineHeight + 0.5 * fontSize - 2; + const legendText = item.legendText ? item.legendText : item.name; + context.beginPath(); + context.setFontSize(fontSize); + context.setFillStyle(item.show ? opts.legend.fontColor : opts.legend.hiddenColor); + context.fillText(legendText, startX, startY + fontTrans); + context.closePath(); + context.stroke(); + if (opts.legend.position == 'top' || opts.legend.position == 'bottom') { + startX += measureText(legendText, fontSize, context) + itemGap; + item.area[2] = startX; + } else { + item.area[2] = startX + measureText(legendText, fontSize, context) + itemGap;; + startX -= shapeWidth + shapeRight; + startY += lineHeight; + } + } + }); +} + +function drawPieDataPoints (series, opts, config, context) { + var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + var pieOption = assign({}, { + activeOpacity: 0.5, + activeRadius: 10, + offsetAngle: 0, + labelWidth: 15, + ringWidth: 30, + customRadius: 0, + border: false, + borderWidth: 2, + borderColor: '#FFFFFF', + centerColor: '#FFFFFF', + linearType: 'none', + customColor: [], + }, opts.type == "pie" ? opts.extra.pie : opts.extra.ring); + var centerPosition = { + x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2, + y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2 + }; + if (config.pieChartLinePadding == 0) { + config.pieChartLinePadding = pieOption.activeRadius * opts.pix; + } + + var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - config.pieChartLinePadding - config + .pieChartTextPadding - config._pieTextMaxLength_, (opts.height - opts.area[0] - opts.area[2]) / 2 - config + .pieChartLinePadding - config.pieChartTextPadding); + radius = radius < 10 ? 10 : radius; + if (pieOption.customRadius > 0) { + radius = pieOption.customRadius * opts.pix; + } + series = getPieDataPoints(series, radius, process); + var activeRadius = pieOption.activeRadius * opts.pix; + pieOption.customColor = fillCustomColor(pieOption.linearType, pieOption.customColor, series, config); + series = series.map(function (eachSeries) { + eachSeries._start_ += (pieOption.offsetAngle) * Math.PI / 180; + return eachSeries; + }); + series.forEach(function (eachSeries, seriesIndex) { + if (opts.tooltip) { + if (opts.tooltip.index == seriesIndex) { + context.beginPath(); + context.setFillStyle(hexToRgb(eachSeries.color, pieOption.activeOpacity || 0.5)); + context.moveTo(centerPosition.x, centerPosition.y); + context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_ + activeRadius, eachSeries + ._start_, eachSeries._start_ + 2 * eachSeries._proportion_ * Math.PI); + context.closePath(); + context.fill(); + } + } + context.beginPath(); + context.setLineWidth(pieOption.borderWidth * opts.pix); + context.lineJoin = "round"; + context.setStrokeStyle(pieOption.borderColor); + var fillcolor = eachSeries.color; + if (pieOption.linearType == 'custom') { + var grd; + if (context.createCircularGradient) { + grd = context.createCircularGradient(centerPosition.x, centerPosition.y, eachSeries._radius_) + } else { + grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, + centerPosition.y, eachSeries._radius_) + } + grd.addColorStop(0, hexToRgb(pieOption.customColor[eachSeries.linearIndex], 1)) + grd.addColorStop(1, hexToRgb(eachSeries.color, 1)) + fillcolor = grd + } + context.setFillStyle(fillcolor); + context.moveTo(centerPosition.x, centerPosition.y); + context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries + ._start_ + 2 * eachSeries._proportion_ * Math.PI); + context.closePath(); + context.fill(); + if (pieOption.border == true) { + context.stroke(); + } + }); + if (opts.type === 'ring') { + var innerPieWidth = radius * 0.6; + if (typeof pieOption.ringWidth === 'number' && pieOption.ringWidth > 0) { + innerPieWidth = Math.max(0, radius - pieOption.ringWidth * opts.pix); + } + context.beginPath(); + context.setFillStyle(pieOption.centerColor); + context.moveTo(centerPosition.x, centerPosition.y); + context.arc(centerPosition.x, centerPosition.y, innerPieWidth, 0, 2 * Math.PI); + context.closePath(); + context.fill(); + } + if (opts.dataLabel !== false && process === 1) { + drawPieText(series, opts, config, context, radius, centerPosition); + } + if (process === 1 && opts.type === 'ring') { + drawRingTitle(opts, config, context, centerPosition); + } + return { + center: centerPosition, + radius: radius, + series: series + }; +} + +function drawRoseDataPoints (series, opts, config, context) { + var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + var roseOption = assign({}, { + type: 'area', + activeOpacity: 0.5, + activeRadius: 10, + offsetAngle: 0, + labelWidth: 15, + border: false, + borderWidth: 2, + borderColor: '#FFFFFF', + linearType: 'none', + customColor: [], + }, opts.extra.rose); + if (config.pieChartLinePadding == 0) { + config.pieChartLinePadding = roseOption.activeRadius * opts.pix; + } + var centerPosition = { + x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2, + y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2 + }; + var radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - config.pieChartLinePadding - config + .pieChartTextPadding - config._pieTextMaxLength_, (opts.height - opts.area[0] - opts.area[2]) / 2 - config + .pieChartLinePadding - config.pieChartTextPadding); + radius = radius < 10 ? 10 : radius; + var minRadius = roseOption.minRadius || radius * 0.5; + series = getRoseDataPoints(series, roseOption.type, minRadius, radius, process); + var activeRadius = roseOption.activeRadius * opts.pix; + roseOption.customColor = fillCustomColor(roseOption.linearType, roseOption.customColor, series, config); + series = series.map(function (eachSeries) { + eachSeries._start_ += (roseOption.offsetAngle || 0) * Math.PI / 180; + return eachSeries; + }); + series.forEach(function (eachSeries, seriesIndex) { + if (opts.tooltip) { + if (opts.tooltip.index == seriesIndex) { + context.beginPath(); + context.setFillStyle(hexToRgb(eachSeries.color, roseOption.activeOpacity || 0.5)); + context.moveTo(centerPosition.x, centerPosition.y); + context.arc(centerPosition.x, centerPosition.y, activeRadius + eachSeries._radius_, eachSeries + ._start_, eachSeries._start_ + 2 * eachSeries._rose_proportion_ * Math.PI); + context.closePath(); + context.fill(); + } + } + context.beginPath(); + context.setLineWidth(roseOption.borderWidth * opts.pix); + context.lineJoin = "round"; + context.setStrokeStyle(roseOption.borderColor); + var fillcolor = eachSeries.color; + if (roseOption.linearType == 'custom') { + var grd; + if (context.createCircularGradient) { + grd = context.createCircularGradient(centerPosition.x, centerPosition.y, eachSeries._radius_) + } else { + grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, + centerPosition.y, eachSeries._radius_) + } + grd.addColorStop(0, hexToRgb(roseOption.customColor[eachSeries.linearIndex], 1)) + grd.addColorStop(1, hexToRgb(eachSeries.color, 1)) + fillcolor = grd + } + context.setFillStyle(fillcolor); + context.moveTo(centerPosition.x, centerPosition.y); + context.arc(centerPosition.x, centerPosition.y, eachSeries._radius_, eachSeries._start_, eachSeries + ._start_ + 2 * eachSeries._rose_proportion_ * Math.PI); + context.closePath(); + context.fill(); + if (roseOption.border == true) { + context.stroke(); + } + }); + + if (opts.dataLabel !== false && process === 1) { + drawPieText(series, opts, config, context, radius, centerPosition); + } + return { + center: centerPosition, + radius: radius, + series: series + }; +} + +function drawArcbarDataPoints (series, opts, config, context) { + var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + var arcbarOption = assign({}, { + startAngle: 0.75, + endAngle: 0.25, + type: 'default', + lineCap: 'round', + width: 12, + gap: 2, + linearType: 'none', + customColor: [], + }, opts.extra.arcbar); + series = getArcbarDataPoints(series, arcbarOption, process); + var centerPosition; + if (arcbarOption.centerX || arcbarOption.centerY) { + centerPosition = { + x: arcbarOption.centerX ? arcbarOption.centerX : opts.width / 2, + y: arcbarOption.centerY ? arcbarOption.centerY : opts.height / 2 + }; + } else { + centerPosition = { + x: opts.width / 2, + y: opts.height / 2 + }; + } + var radius; + if (arcbarOption.radius) { + radius = arcbarOption.radius; + } else { + radius = Math.min(centerPosition.x, centerPosition.y); + radius -= 5 * opts.pix; + radius -= arcbarOption.width / 2; + } + radius = radius < 10 ? 10 : radius; + arcbarOption.customColor = fillCustomColor(arcbarOption.linearType, arcbarOption.customColor, series, config); + + for (let i = 0; i < series.length; i++) { + let eachSeries = series[i]; + //背景颜色 + context.setLineWidth(arcbarOption.width * opts.pix); + context.setStrokeStyle(arcbarOption.backgroundColor || '#E9E9E9'); + context.setLineCap(arcbarOption.lineCap); + context.beginPath(); + if (arcbarOption.type == 'default') { + context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * + opts.pix) * i, arcbarOption.startAngle * Math.PI, arcbarOption.endAngle * Math.PI, false); + } else { + context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * + opts.pix) * i, 0, 2 * Math.PI, false); + } + context.stroke(); + //进度条 + var fillColor = eachSeries.color + if (arcbarOption.linearType == 'custom') { + var grd = context.createLinearGradient(centerPosition.x - radius, centerPosition.y, centerPosition.x + + radius, centerPosition.y); + grd.addColorStop(1, hexToRgb(arcbarOption.customColor[eachSeries.linearIndex], 1)) + grd.addColorStop(0, hexToRgb(eachSeries.color, 1)) + fillColor = grd; + } + context.setLineWidth(arcbarOption.width * opts.pix); + context.setStrokeStyle(fillColor); + context.setLineCap(arcbarOption.lineCap); + context.beginPath(); + context.arc(centerPosition.x, centerPosition.y, radius - (arcbarOption.width * opts.pix + arcbarOption.gap * + opts.pix) * i, arcbarOption.startAngle * Math.PI, eachSeries._proportion_ * Math.PI, false); + context.stroke(); + } + drawRingTitle(opts, config, context, centerPosition); + return { + center: centerPosition, + radius: radius, + series: series + }; +} + +function drawGaugeDataPoints (categories, series, opts, config, context) { + var process = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1; + var gaugeOption = assign({}, { + type: 'default', + startAngle: 0.75, + endAngle: 0.25, + width: 15, + labelOffset: 13, + splitLine: { + fixRadius: 0, + splitNumber: 10, + width: 15, + color: '#FFFFFF', + childNumber: 5, + childWidth: 5 + }, + pointer: { + width: 15, + color: 'auto' + } + }, opts.extra.gauge); + if (gaugeOption.oldAngle == undefined) { + gaugeOption.oldAngle = gaugeOption.startAngle; + } + if (gaugeOption.oldData == undefined) { + gaugeOption.oldData = 0; + } + categories = getGaugeAxisPoints(categories, gaugeOption.startAngle, gaugeOption.endAngle); + var centerPosition = { + x: opts.width / 2, + y: opts.height / 2 + }; + var radius = Math.min(centerPosition.x, centerPosition.y); + radius -= 5 * opts.pix; + radius -= gaugeOption.width / 2; + radius = radius < 10 ? 10 : radius; + var innerRadius = radius - gaugeOption.width; + var totalAngle = 0; + //判断仪表盘的样式:default百度样式,progress新样式 + if (gaugeOption.type == 'progress') { + //## 第一步画中心圆形背景和进度条背景 + //中心圆形背景 + var pieRadius = radius - gaugeOption.width * 3; + context.beginPath(); + let gradient = context.createLinearGradient(centerPosition.x, centerPosition.y - pieRadius, centerPosition.x, + centerPosition.y + pieRadius); + //配置渐变填充(起点:中心点向上减半径;结束点中心点向下加半径) + gradient.addColorStop('0', hexToRgb(series[0].color, 0.3)); + gradient.addColorStop('1.0', hexToRgb("#FFFFFF", 0.1)); + context.setFillStyle(gradient); + context.arc(centerPosition.x, centerPosition.y, pieRadius, 0, 2 * Math.PI, false); + context.fill(); + //画进度条背景 + context.setLineWidth(gaugeOption.width); + context.setStrokeStyle(hexToRgb(series[0].color, 0.3)); + context.setLineCap('round'); + context.beginPath(); + context.arc(centerPosition.x, centerPosition.y, innerRadius, gaugeOption.startAngle * Math.PI, gaugeOption + .endAngle * Math.PI, false); + context.stroke(); + //## 第二步画刻度线 + totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1; + let splitAngle = totalAngle / gaugeOption.splitLine.splitNumber; + let childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber; + let startX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius; + let endX = -radius - gaugeOption.width - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width; + context.save(); + context.translate(centerPosition.x, centerPosition.y); + context.rotate((gaugeOption.startAngle - 1) * Math.PI); + let len = gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1; + let proc = series[0].data * process; + for (let i = 0; i < len; i++) { + context.beginPath(); + //刻度线随进度变色 + if (proc > (i / len)) { + context.setStrokeStyle(hexToRgb(series[0].color, 1)); + } else { + context.setStrokeStyle(hexToRgb(series[0].color, 0.3)); + } + context.setLineWidth(3 * opts.pix); + context.moveTo(startX, 0); + context.lineTo(endX, 0); + context.stroke(); + context.rotate(childAngle * Math.PI); + } + context.restore(); + //## 第三步画进度条 + series = getGaugeArcbarDataPoints(series, gaugeOption, process); + context.setLineWidth(gaugeOption.width); + context.setStrokeStyle(series[0].color); + context.setLineCap('round'); + context.beginPath(); + context.arc(centerPosition.x, centerPosition.y, innerRadius, gaugeOption.startAngle * Math.PI, series[0] + ._proportion_ * Math.PI, false); + context.stroke(); + //## 第四步画指针 + let pointerRadius = radius - gaugeOption.width * 2.5; + context.save(); + context.translate(centerPosition.x, centerPosition.y); + context.rotate((series[0]._proportion_ - 1) * Math.PI); + context.beginPath(); + context.setLineWidth(gaugeOption.width / 3); + let gradient3 = context.createLinearGradient(0, -pointerRadius * 0.6, 0, pointerRadius * 0.6); + gradient3.addColorStop('0', hexToRgb('#FFFFFF', 0)); + gradient3.addColorStop('0.5', hexToRgb(series[0].color, 1)); + gradient3.addColorStop('1.0', hexToRgb('#FFFFFF', 0)); + context.setStrokeStyle(gradient3); + context.arc(0, 0, pointerRadius, 0.85 * Math.PI, 1.15 * Math.PI, false); + context.stroke(); + context.beginPath(); + context.setLineWidth(1); + context.setStrokeStyle(series[0].color); + context.setFillStyle(series[0].color); + context.moveTo(-pointerRadius - gaugeOption.width / 3 / 2, -4); + context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2 - 4, 0); + context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2, 4); + context.lineTo(-pointerRadius - gaugeOption.width / 3 / 2, -4); + context.stroke(); + context.fill(); + context.restore(); + //default百度样式 + } else { + //画背景 + context.setLineWidth(gaugeOption.width); + context.setLineCap('butt'); + for (let i = 0; i < categories.length; i++) { + let eachCategories = categories[i]; + context.beginPath(); + context.setStrokeStyle(eachCategories.color); + context.arc(centerPosition.x, centerPosition.y, radius, eachCategories._startAngle_ * Math.PI, + eachCategories._endAngle_ * Math.PI, false); + context.stroke(); + } + context.save(); + //画刻度线 + totalAngle = gaugeOption.startAngle - gaugeOption.endAngle + 1; + let splitAngle = totalAngle / gaugeOption.splitLine.splitNumber; + let childAngle = totalAngle / gaugeOption.splitLine.splitNumber / gaugeOption.splitLine.childNumber; + let startX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius; + let endX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine.width; + let childendX = -radius - gaugeOption.width * 0.5 - gaugeOption.splitLine.fixRadius + gaugeOption.splitLine + .childWidth; + context.translate(centerPosition.x, centerPosition.y); + context.rotate((gaugeOption.startAngle - 1) * Math.PI); + for (let i = 0; i < gaugeOption.splitLine.splitNumber + 1; i++) { + context.beginPath(); + context.setStrokeStyle(gaugeOption.splitLine.color); + context.setLineWidth(2 * opts.pix); + context.moveTo(startX, 0); + context.lineTo(endX, 0); + context.stroke(); + context.rotate(splitAngle * Math.PI); + } + context.restore(); + context.save(); + context.translate(centerPosition.x, centerPosition.y); + context.rotate((gaugeOption.startAngle - 1) * Math.PI); + for (let i = 0; i < gaugeOption.splitLine.splitNumber * gaugeOption.splitLine.childNumber + 1; i++) { + context.beginPath(); + context.setStrokeStyle(gaugeOption.splitLine.color); + context.setLineWidth(1 * opts.pix); + context.moveTo(startX, 0); + context.lineTo(childendX, 0); + context.stroke(); + context.rotate(childAngle * Math.PI); + } + context.restore(); + //画指针 + series = getGaugeDataPoints(series, categories, gaugeOption, process); + for (let i = 0; i < series.length; i++) { + let eachSeries = series[i]; + context.save(); + context.translate(centerPosition.x, centerPosition.y); + context.rotate((eachSeries._proportion_ - 1) * Math.PI); + context.beginPath(); + context.setFillStyle(eachSeries.color); + context.moveTo(gaugeOption.pointer.width, 0); + context.lineTo(0, -gaugeOption.pointer.width / 2); + context.lineTo(-innerRadius, 0); + context.lineTo(0, gaugeOption.pointer.width / 2); + context.lineTo(gaugeOption.pointer.width, 0); + context.closePath(); + context.fill(); + context.beginPath(); + context.setFillStyle('#FFFFFF'); + context.arc(0, 0, gaugeOption.pointer.width / 6, 0, 2 * Math.PI, false); + context.fill(); + context.restore(); + } + if (opts.dataLabel !== false) { + drawGaugeLabel(gaugeOption, radius, centerPosition, opts, config, context); + } + } + //画仪表盘标题,副标题 + drawRingTitle(opts, config, context, centerPosition); + if (process === 1 && opts.type === 'gauge') { + opts.extra.gauge.oldAngle = series[0]._proportion_; + opts.extra.gauge.oldData = series[0].data; + } + return { + center: centerPosition, + radius: radius, + innerRadius: innerRadius, + categories: categories, + totalAngle: totalAngle + }; +} + +function drawRadarDataPoints (series, opts, config, context) { + var process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + var radarOption = assign({}, { + gridColor: '#cccccc', + gridType: 'radar', + gridEval: 1, + axisLabel: false, + axisLabelTofix: 0, + labelColor: '#666666', + labelPointShow: false, + labelPointRadius: 3, + labelPointColor: '#cccccc', + opacity: 0.2, + gridCount: 3, + border: false, + borderWidth: 2, + linearType: 'none', + customColor: [], + }, opts.extra.radar); + var coordinateAngle = getRadarCoordinateSeries(opts.categories.length); + var centerPosition = { + x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2, + y: opts.area[0] + (opts.height - opts.area[0] - opts.area[2]) / 2 + }; + var xr = (opts.width - opts.area[1] - opts.area[3]) / 2 + var yr = (opts.height - opts.area[0] - opts.area[2]) / 2 + var radius = Math.min(xr - (getMaxTextListLength(opts.categories, config.fontSize, context) + config + .radarLabelTextMargin), yr - config.radarLabelTextMargin); + radius -= config.radarLabelTextMargin * opts.pix; + radius = radius < 10 ? 10 : radius; + // 画分割线 + context.beginPath(); + context.setLineWidth(1 * opts.pix); + context.setStrokeStyle(radarOption.gridColor); + coordinateAngle.forEach(function (angle, index) { + var pos = convertCoordinateOrigin(radius * Math.cos(angle), radius * Math.sin(angle), centerPosition); + context.moveTo(centerPosition.x, centerPosition.y); + if (index % radarOption.gridEval == 0) { + context.lineTo(pos.x, pos.y); + } + }); + context.stroke(); + context.closePath(); + + // 画背景网格 + var _loop = function _loop (i) { + var startPos = {}; + context.beginPath(); + context.setLineWidth(1 * opts.pix); + context.setStrokeStyle(radarOption.gridColor); + if (radarOption.gridType == 'radar') { + coordinateAngle.forEach(function (angle, index) { + var pos = convertCoordinateOrigin(radius / radarOption.gridCount * i * Math.cos(angle), + radius / + radarOption.gridCount * i * Math.sin(angle), centerPosition); + if (index === 0) { + startPos = pos; + context.moveTo(pos.x, pos.y); + } else { + context.lineTo(pos.x, pos.y); + } + }); + context.lineTo(startPos.x, startPos.y); + } else { + var pos = convertCoordinateOrigin(radius / radarOption.gridCount * i * Math.cos(1.5), radius / + radarOption.gridCount * i * Math.sin(1.5), centerPosition); + context.arc(centerPosition.x, centerPosition.y, centerPosition.y - pos.y, 0, 2 * Math.PI, false); + } + context.stroke(); + context.closePath(); + }; + for (var i = 1; i <= radarOption.gridCount; i++) { + _loop(i); + } + radarOption.customColor = fillCustomColor(radarOption.linearType, radarOption.customColor, series, config); + var radarDataPoints = getRadarDataPoints(coordinateAngle, centerPosition, radius, series, opts, process); + radarDataPoints.forEach(function (eachSeries, seriesIndex) { + // 绘制区域数据 + context.beginPath(); + context.setLineWidth(radarOption.borderWidth * opts.pix); + context.setStrokeStyle(eachSeries.color); + + var fillcolor = hexToRgb(eachSeries.color, radarOption.opacity); + if (radarOption.linearType == 'custom') { + var grd; + if (context.createCircularGradient) { + grd = context.createCircularGradient(centerPosition.x, centerPosition.y, radius) + } else { + grd = context.createRadialGradient(centerPosition.x, centerPosition.y, 0, centerPosition.x, + centerPosition.y, radius) + } + grd.addColorStop(0, hexToRgb(radarOption.customColor[series[seriesIndex].linearIndex], radarOption + .opacity)) + grd.addColorStop(1, hexToRgb(eachSeries.color, radarOption.opacity)) + fillcolor = grd + } + + context.setFillStyle(fillcolor); + eachSeries.data.forEach(function (item, index) { + if (index === 0) { + context.moveTo(item.position.x, item.position.y); + } else { + context.lineTo(item.position.x, item.position.y); + } + }); + context.closePath(); + context.fill(); + if (radarOption.border === true) { + context.stroke(); + } + context.closePath(); + if (opts.dataPointShape !== false) { + var points = eachSeries.data.map(function (item) { + return item.position; + }); + drawPointShape(points, eachSeries.color, eachSeries.pointShape, context, opts); + } + }); + // 画刻度值 + if (radarOption.axisLabel === true) { + const maxData = Math.max(radarOption.max, Math.max.apply(null, dataCombine(series))); + const stepLength = radius / radarOption.gridCount; + const fontSize = opts.fontSize * opts.pix; + context.setFontSize(fontSize); + context.setFillStyle(opts.fontColor); + context.setTextAlign('left'); + for (var i = 0; i < radarOption.gridCount + 1; i++) { + let label = i * maxData / radarOption.gridCount; + label = label.toFixed(radarOption.axisLabelTofix); + context.fillText(String(label), centerPosition.x + 3 * opts.pix, centerPosition.y - i * stepLength + + fontSize / 2); + } + } + + // draw label text + drawRadarLabel(coordinateAngle, radius, centerPosition, opts, config, context); + + // draw dataLabel + if (opts.dataLabel !== false && process === 1) { + radarDataPoints.forEach(function (eachSeries, seriesIndex) { + context.beginPath(); + var fontSize = eachSeries.textSize * opts.pix || config.fontSize; + context.setFontSize(fontSize); + context.setFillStyle(eachSeries.textColor || opts.fontColor); + eachSeries.data.forEach(function (item, index) { + //如果是中心点垂直的上下点位 + if (Math.abs(item.position.x - centerPosition.x) < 2) { + //如果在上面 + if (item.position.y < centerPosition.y) { + context.setTextAlign('center'); + context.fillText(item.value, item.position.x, item.position.y - 4); + } else { + context.setTextAlign('center'); + context.fillText(item.value, item.position.x, item.position.y + fontSize + 2); + } + } else { + //如果在左侧 + if (item.position.x < centerPosition.x) { + context.setTextAlign('right'); + context.fillText(item.value, item.position.x - 4, item.position.y + fontSize / + 2 - 2); + } else { + context.setTextAlign('left'); + context.fillText(item.value, item.position.x + 4, item.position.y + fontSize / + 2 - 2); + } + } + }); + context.closePath(); + context.stroke(); + }); + context.setTextAlign('left'); + } + + return { + center: centerPosition, + radius: radius, + angleList: coordinateAngle + }; +} + +// 经纬度转墨卡托 +function lonlat2mercator (longitude, latitude) { + var mercator = Array(2); + var x = longitude * 20037508.34 / 180; + var y = Math.log(Math.tan((90 + latitude) * Math.PI / 360)) / (Math.PI / 180); + y = y * 20037508.34 / 180; + mercator[0] = x; + mercator[1] = y; + return mercator; +} + +// 墨卡托转经纬度 +function mercator2lonlat (longitude, latitude) { + var lonlat = Array(2) + var x = longitude / 20037508.34 * 180; + var y = latitude / 20037508.34 * 180; + y = 180 / Math.PI * (2 * Math.atan(Math.exp(y * Math.PI / 180)) - Math.PI / 2); + lonlat[0] = x; + lonlat[1] = y; + return lonlat; +} + +function getBoundingBox (data) { + var bounds = {}, + coords; + bounds.xMin = 180; + bounds.xMax = 0; + bounds.yMin = 90; + bounds.yMax = 0 + for (var i = 0; i < data.length; i++) { + var coorda = data[i].geometry.coordinates + for (var k = 0; k < coorda.length; k++) { + coords = coorda[k]; + if (coords.length == 1) { + coords = coords[0] + } + for (var j = 0; j < coords.length; j++) { + var longitude = coords[j][0]; + var latitude = coords[j][1]; + var point = { + x: longitude, + y: latitude + } + bounds.xMin = bounds.xMin < point.x ? bounds.xMin : point.x; + bounds.xMax = bounds.xMax > point.x ? bounds.xMax : point.x; + bounds.yMin = bounds.yMin < point.y ? bounds.yMin : point.y; + bounds.yMax = bounds.yMax > point.y ? bounds.yMax : point.y; + } + } + } + return bounds; +} + +function coordinateToPoint (latitude, longitude, bounds, scale, xoffset, yoffset) { + return { + x: (longitude - bounds.xMin) * scale + xoffset, + y: (bounds.yMax - latitude) * scale + yoffset + }; +} + +function pointToCoordinate (pointY, pointX, bounds, scale, xoffset, yoffset) { + return { + x: (pointX - xoffset) / scale + bounds.xMin, + y: bounds.yMax - (pointY - yoffset) / scale + }; +} + +function isRayIntersectsSegment (poi, s_poi, e_poi) { + if (s_poi[1] == e_poi[1]) { + return false; + } + if (s_poi[1] > poi[1] && e_poi[1] > poi[1]) { + return false; + } + if (s_poi[1] < poi[1] && e_poi[1] < poi[1]) { + return false; + } + if (s_poi[1] == poi[1] && e_poi[1] > poi[1]) { + return false; + } + if (e_poi[1] == poi[1] && s_poi[1] > poi[1]) { + return false; + } + if (s_poi[0] < poi[0] && e_poi[1] < poi[1]) { + return false; + } + let xseg = e_poi[0] - (e_poi[0] - s_poi[0]) * (e_poi[1] - poi[1]) / (e_poi[1] - s_poi[1]); + if (xseg < poi[0]) { + return false; + } else { + return true; + } +} + +function isPoiWithinPoly (poi, poly, mercator) { + let sinsc = 0; + for (let i = 0; i < poly.length; i++) { + let epoly = poly[i][0]; + if (poly.length == 1) { + epoly = poly[i][0] + } + for (let j = 0; j < epoly.length - 1; j++) { + let s_poi = epoly[j]; + let e_poi = epoly[j + 1]; + if (mercator) { + s_poi = lonlat2mercator(epoly[j][0], epoly[j][1]); + e_poi = lonlat2mercator(epoly[j + 1][0], epoly[j + 1][1]); + } + if (isRayIntersectsSegment(poi, s_poi, e_poi)) { + sinsc += 1; + } + } + } + if (sinsc % 2 == 1) { + return true; + } else { + return false; + } +} + +function drawMapDataPoints (series, opts, config, context) { + var mapOption = assign({}, { + border: true, + mercator: false, + borderWidth: 1, + borderColor: '#666666', + fillOpacity: 0.6, + activeBorderColor: '#f04864', + activeFillColor: '#facc14', + activeFillOpacity: 1 + }, opts.extra.map); + var coords, point; + var data = series; + var bounds = getBoundingBox(data); + if (mapOption.mercator) { + var max = lonlat2mercator(bounds.xMax, bounds.yMax) + var min = lonlat2mercator(bounds.xMin, bounds.yMin) + bounds.xMax = max[0] + bounds.yMax = max[1] + bounds.xMin = min[0] + bounds.yMin = min[1] + } + var xScale = opts.width / Math.abs(bounds.xMax - bounds.xMin); + var yScale = opts.height / Math.abs(bounds.yMax - bounds.yMin); + var scale = xScale < yScale ? xScale : yScale; + var xoffset = opts.width / 2 - Math.abs(bounds.xMax - bounds.xMin) / 2 * scale; + var yoffset = opts.height / 2 - Math.abs(bounds.yMax - bounds.yMin) / 2 * scale; + for (var i = 0; i < data.length; i++) { + context.beginPath(); + context.setLineWidth(mapOption.borderWidth * opts.pix); + context.setStrokeStyle(mapOption.borderColor); + context.setFillStyle(hexToRgb(series[i].color, mapOption.fillOpacity)); + if (opts.tooltip) { + if (opts.tooltip.index == i) { + context.setStrokeStyle(mapOption.activeBorderColor); + context.setFillStyle(hexToRgb(mapOption.activeFillColor, mapOption.activeFillOpacity)); + } + } + var coorda = data[i].geometry.coordinates + for (var k = 0; k < coorda.length; k++) { + coords = coorda[k]; + if (coords.length == 1) { + coords = coords[0] + } + for (var j = 0; j < coords.length; j++) { + var gaosi = Array(2); + if (mapOption.mercator) { + gaosi = lonlat2mercator(coords[j][0], coords[j][1]) + } else { + gaosi = coords[j] + } + point = coordinateToPoint(gaosi[1], gaosi[0], bounds, scale, xoffset, yoffset) + if (j === 0) { + context.beginPath(); + context.moveTo(point.x, point.y); + } else { + context.lineTo(point.x, point.y); + } + } + context.fill(); + if (mapOption.border == true) { + context.stroke(); + } + } + } + if (opts.dataLabel == true) { + for (var i = 0; i < data.length; i++) { + var centerPoint = data[i].properties.centroid; + if (centerPoint) { + if (mapOption.mercator) { + centerPoint = lonlat2mercator(data[i].properties.centroid[0], data[i].properties.centroid[1]) + } + point = coordinateToPoint(centerPoint[1], centerPoint[0], bounds, scale, xoffset, yoffset); + let fontSize = data[i].textSize * opts.pix || config.fontSize; + let text = data[i].properties.name; + context.beginPath(); + context.setFontSize(fontSize) + context.setFillStyle(data[i].textColor || opts.fontColor) + context.fillText(text, point.x - measureText(text, fontSize, context) / 2, point.y + fontSize / 2); + context.closePath(); + context.stroke(); + } + } + } + opts.chartData.mapData = { + bounds: bounds, + scale: scale, + xoffset: xoffset, + yoffset: yoffset, + mercator: mapOption.mercator + } + drawToolTipBridge(opts, config, context, 1); + context.draw(); +} + +function normalInt (min, max, iter) { + iter = iter == 0 ? 1 : iter; + var arr = []; + for (var i = 0; i < iter; i++) { + arr[i] = Math.random(); + }; + return Math.floor(arr.reduce(function (i, j) { + return i + j + }) / iter * (max - min)) + min; +}; + +function collisionNew (area, points, width, height) { + var isIn = false; + for (let i = 0; i < points.length; i++) { + if (points[i].area) { + if (area[3] < points[i].area[1] || area[0] > points[i].area[2] || area[1] > points[i].area[3] || area[2] < + points[i].area[0]) { + if (area[0] < 0 || area[1] < 0 || area[2] > width || area[3] > height) { + isIn = true; + break; + } else { + isIn = false; + } + } else { + isIn = true; + break; + } + } + } + return isIn; +}; + +function getWordCloudPoint (opts, type, context) { + let points = opts.series; + switch (type) { + case 'normal': + for (let i = 0; i < points.length; i++) { + let text = points[i].name; + let tHeight = points[i].textSize * opts.pix; + let tWidth = measureText(text, tHeight, context); + let x, y; + let area; + let breaknum = 0; + while (true) { + breaknum++; + x = normalInt(-opts.width / 2, opts.width / 2, 5) - tWidth / 2; + y = normalInt(-opts.height / 2, opts.height / 2, 5) + tHeight / 2; + area = [x - 5 + opts.width / 2, y - 5 - tHeight + opts.height / 2, x + tWidth + 5 + opts.width / 2, + y + 5 + + opts.height / 2 + ]; + let isCollision = collisionNew(area, points, opts.width, opts.height); + if (!isCollision) break; + if (breaknum == 1000) { + area = [-100, -100, -100, -100]; + break; + } + }; + points[i].area = area; + } + break; + case 'vertical': + function Spin () { + //获取均匀随机值,是否旋转,旋转的概率为(1-0.5) + if (Math.random() > 0.7) { + return true; + } else { + return false + }; + }; + for (let i = 0; i < points.length; i++) { + let text = points[i].name; + let tHeight = points[i].textSize * opts.pix; + let tWidth = measureText(text, tHeight, context); + let isSpin = Spin(); + let x, y, area, areav; + let breaknum = 0; + while (true) { + breaknum++; + let isCollision; + if (isSpin) { + x = normalInt(-opts.width / 2, opts.width / 2, 5) - tWidth / 2; + y = normalInt(-opts.height / 2, opts.height / 2, 5) + tHeight / 2; + area = [y - 5 - tWidth + opts.width / 2, (-x - 5 + opts.height / 2), y + 5 + opts.width / 2, (- + x + tHeight + 5 + opts.height / 2)]; + areav = [opts.width - (opts.width / 2 - opts.height / 2) - (-x + tHeight + 5 + opts.height / + 2) - 5, (opts.height / 2 - opts.width / 2) + (y - 5 - tWidth + opts.width / 2) - 5, + opts + .width - (opts.width / 2 - opts.height / 2) - (-x + tHeight + 5 + opts.height / 2) + + tHeight, (opts.height / 2 - opts.width / 2) + (y - 5 - tWidth + opts.width / 2) + + tWidth + 5 + ]; + isCollision = collisionNew(areav, points, opts.height, opts.width); + } else { + x = normalInt(-opts.width / 2, opts.width / 2, 5) - tWidth / 2; + y = normalInt(-opts.height / 2, opts.height / 2, 5) + tHeight / 2; + area = [x - 5 + opts.width / 2, y - 5 - tHeight + opts.height / 2, x + tWidth + 5 + opts.width / + 2, y + 5 + opts.height / 2 + ]; + isCollision = collisionNew(area, points, opts.width, opts.height); + } + if (!isCollision) break; + if (breaknum == 1000) { + area = [-1000, -1000, -1000, -1000]; + break; + } + }; + if (isSpin) { + points[i].area = areav; + points[i].areav = area; + } else { + points[i].area = area; + } + points[i].rotate = isSpin; + }; + break; + } + return points; +} + +function drawWordCloudDataPoints (series, opts, config, context) { + let process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + let wordOption = assign({}, { + type: 'normal', + autoColors: true + }, opts.extra.word); + if (!opts.chartData.wordCloudData) { + opts.chartData.wordCloudData = getWordCloudPoint(opts, wordOption.type, context); + } + context.beginPath(); + context.setFillStyle(opts.background); + context.rect(0, 0, opts.width, opts.height); + context.fill(); + context.save(); + let points = opts.chartData.wordCloudData; + context.translate(opts.width / 2, opts.height / 2); + for (let i = 0; i < points.length; i++) { + context.save(); + if (points[i].rotate) { + context.rotate(90 * Math.PI / 180); + } + let text = points[i].name; + let tHeight = points[i].textSize * opts.pix; + let tWidth = measureText(text, tHeight, context); + context.beginPath(); + context.setStrokeStyle(points[i].color); + context.setFillStyle(points[i].color); + context.setFontSize(tHeight); + if (points[i].rotate) { + if (points[i].areav[0] > 0) { + if (opts.tooltip) { + if (opts.tooltip.index == i) { + context.strokeText(text, (points[i].areav[0] + 5 - opts.width / 2) * process - tWidth * (1 - + process) / 2, (points[i].areav[1] + 5 + tHeight - opts.height / 2) * process); + } else { + context.fillText(text, (points[i].areav[0] + 5 - opts.width / 2) * process - tWidth * (1 - + process) / 2, (points[i].areav[1] + 5 + tHeight - opts.height / 2) * process); + } + } else { + context.fillText(text, (points[i].areav[0] + 5 - opts.width / 2) * process - tWidth * (1 - + process) / 2, (points[i].areav[1] + 5 + tHeight - opts.height / 2) * process); + } + } + } else { + if (points[i].area[0] > 0) { + if (opts.tooltip) { + if (opts.tooltip.index == i) { + context.strokeText(text, (points[i].area[0] + 5 - opts.width / 2) * process - tWidth * (1 - + process) / 2, (points[i].area[1] + 5 + tHeight - opts.height / 2) * process); + } else { + context.fillText(text, (points[i].area[0] + 5 - opts.width / 2) * process - tWidth * (1 - + process) / 2, (points[i].area[1] + 5 + tHeight - opts.height / 2) * process); + } + } else { + context.fillText(text, (points[i].area[0] + 5 - opts.width / 2) * process - tWidth * (1 - process) / + 2, (points[i].area[1] + 5 + tHeight - opts.height / 2) * process); + } + } + } + context.stroke(); + context.restore(); + } + context.restore(); +} + +function drawFunnelDataPoints (series, opts, config, context) { + let process = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; + let funnelOption = assign({}, { + type: 'funnel', + activeWidth: 10, + activeOpacity: 0.3, + border: false, + borderWidth: 2, + borderColor: '#FFFFFF', + fillOpacity: 1, + labelAlign: 'right', + linearType: 'none', + customColor: [], + }, opts.extra.funnel); + let eachSpacing = (opts.height - opts.area[0] - opts.area[2]) / series.length; + let centerPosition = { + x: opts.area[3] + (opts.width - opts.area[1] - opts.area[3]) / 2, + y: opts.height - opts.area[2] + }; + let activeWidth = funnelOption.activeWidth * opts.pix; + let radius = Math.min((opts.width - opts.area[1] - opts.area[3]) / 2 - activeWidth, (opts.height - opts.area[0] - + opts.area[2]) / 2 - activeWidth); + series = getFunnelDataPoints(series, radius, funnelOption.type, eachSpacing, process); + context.save(); + context.translate(centerPosition.x, centerPosition.y); + funnelOption.customColor = fillCustomColor(funnelOption.linearType, funnelOption.customColor, series, config); + if (funnelOption.type == 'pyramid') { + for (let i = 0; i < series.length; i++) { + if (i == series.length - 1) { + if (opts.tooltip) { + if (opts.tooltip.index == i) { + context.beginPath(); + context.setFillStyle(hexToRgb(series[i].color, funnelOption.activeOpacity)); + context.moveTo(-activeWidth, -eachSpacing); + context.lineTo(-series[i].radius - activeWidth, 0); + context.lineTo(series[i].radius + activeWidth, 0); + context.lineTo(activeWidth, -eachSpacing); + context.lineTo(-activeWidth, -eachSpacing); + context.closePath(); + context.fill(); + } + } + series[i].funnelArea = [centerPosition.x - series[i].radius, centerPosition.y - eachSpacing * (i + 1), + centerPosition.x + series[i].radius, centerPosition.y - eachSpacing * i + ]; + context.beginPath(); + context.setLineWidth(funnelOption.borderWidth * opts.pix); + context.setStrokeStyle(funnelOption.borderColor); + var fillColor = hexToRgb(series[i].color, funnelOption.fillOpacity); + if (funnelOption.linearType == 'custom') { + var grd = context.createLinearGradient(series[i].radius, -eachSpacing, -series[i].radius, - + eachSpacing); + grd.addColorStop(0, hexToRgb(series[i].color, funnelOption.fillOpacity)); + grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[series[i].linearIndex], funnelOption + .fillOpacity)); + grd.addColorStop(1, hexToRgb(series[i].color, funnelOption.fillOpacity)); + fillColor = grd + } + context.setFillStyle(fillColor); + context.moveTo(0, -eachSpacing); + context.lineTo(-series[i].radius, 0); + context.lineTo(series[i].radius, 0); + context.lineTo(0, -eachSpacing); + context.closePath(); + context.fill(); + if (funnelOption.border == true) { + context.stroke(); + } + } else { + if (opts.tooltip) { + if (opts.tooltip.index == i) { + context.beginPath(); + context.setFillStyle(hexToRgb(series[i].color, funnelOption.activeOpacity)); + context.moveTo(0, 0); + context.lineTo(-series[i].radius - activeWidth, 0); + context.lineTo(-series[i + 1].radius - activeWidth, -eachSpacing); + context.lineTo(series[i + 1].radius + activeWidth, -eachSpacing); + context.lineTo(series[i].radius + activeWidth, 0); + context.lineTo(0, 0); + context.closePath(); + context.fill(); + } + } + series[i].funnelArea = [centerPosition.x - series[i].radius, centerPosition.y - eachSpacing * (i + 1), + centerPosition.x + series[i].radius, centerPosition.y - eachSpacing * i + ]; + context.beginPath(); + context.setLineWidth(funnelOption.borderWidth * opts.pix); + context.setStrokeStyle(funnelOption.borderColor); + var fillColor = hexToRgb(series[i].color, funnelOption.fillOpacity); + if (funnelOption.linearType == 'custom') { + var grd = context.createLinearGradient(series[i].radius, -eachSpacing, -series[i].radius, - + eachSpacing); + grd.addColorStop(0, hexToRgb(series[i].color, funnelOption.fillOpacity)); + grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[series[i].linearIndex], funnelOption + .fillOpacity)); + grd.addColorStop(1, hexToRgb(series[i].color, funnelOption.fillOpacity)); + fillColor = grd + } + context.setFillStyle(fillColor); + context.moveTo(0, 0); + context.lineTo(-series[i].radius, 0); + context.lineTo(-series[i + 1].radius, -eachSpacing); + context.lineTo(series[i + 1].radius, -eachSpacing); + context.lineTo(series[i].radius, 0); + context.lineTo(0, 0); + context.closePath(); + context.fill(); + if (funnelOption.border == true) { + context.stroke(); + } + } + context.translate(0, -eachSpacing) + } + } else { + for (let i = 0; i < series.length; i++) { + if (i == 0) { + if (opts.tooltip) { + if (opts.tooltip.index == i) { + context.beginPath(); + context.setFillStyle(hexToRgb(series[i].color, funnelOption.activeOpacity)); + context.moveTo(-activeWidth, 0); + context.lineTo(-series[i].radius - activeWidth, -eachSpacing); + context.lineTo(series[i].radius + activeWidth, -eachSpacing); + context.lineTo(activeWidth, 0); + context.lineTo(-activeWidth, 0); + context.closePath(); + context.fill(); + } + } + series[i].funnelArea = [centerPosition.x - series[i].radius, centerPosition.y - eachSpacing, + centerPosition.x + series[i].radius, centerPosition.y + ]; + context.beginPath(); + context.setLineWidth(funnelOption.borderWidth * opts.pix); + context.setStrokeStyle(funnelOption.borderColor); + var fillColor = hexToRgb(series[i].color, funnelOption.fillOpacity); + if (funnelOption.linearType == 'custom') { + var grd = context.createLinearGradient(series[i].radius, -eachSpacing, -series[i].radius, - + eachSpacing); + grd.addColorStop(0, hexToRgb(series[i].color, funnelOption.fillOpacity)); + grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[series[i].linearIndex], funnelOption + .fillOpacity)); + grd.addColorStop(1, hexToRgb(series[i].color, funnelOption.fillOpacity)); + fillColor = grd + } + context.setFillStyle(fillColor); + context.moveTo(0, 0); + context.lineTo(-series[i].radius, -eachSpacing); + context.lineTo(series[i].radius, -eachSpacing); + context.lineTo(0, 0); + context.closePath(); + context.fill(); + if (funnelOption.border == true) { + context.stroke(); + } + } else { + if (opts.tooltip) { + if (opts.tooltip.index == i) { + context.beginPath(); + context.setFillStyle(hexToRgb(series[i].color, funnelOption.activeOpacity)); + context.moveTo(0, 0); + context.lineTo(-series[i - 1].radius - activeWidth, 0); + context.lineTo(-series[i].radius - activeWidth, -eachSpacing); + context.lineTo(series[i].radius + activeWidth, -eachSpacing); + context.lineTo(series[i - 1].radius + activeWidth, 0); + context.lineTo(0, 0); + context.closePath(); + context.fill(); + } + } + series[i].funnelArea = [centerPosition.x - series[i].radius, centerPosition.y - eachSpacing * (i + 1), + centerPosition.x + series[i].radius, centerPosition.y - eachSpacing * i + ]; + context.beginPath(); + context.setLineWidth(funnelOption.borderWidth * opts.pix); + context.setStrokeStyle(funnelOption.borderColor); + var fillColor = hexToRgb(series[i].color, funnelOption.fillOpacity); + if (funnelOption.linearType == 'custom') { + var grd = context.createLinearGradient(series[i].radius, -eachSpacing, -series[i].radius, - + eachSpacing); + grd.addColorStop(0, hexToRgb(series[i].color, funnelOption.fillOpacity)); + grd.addColorStop(0.5, hexToRgb(funnelOption.customColor[series[i].linearIndex], funnelOption + .fillOpacity)); + grd.addColorStop(1, hexToRgb(series[i].color, funnelOption.fillOpacity)); + fillColor = grd + } + context.setFillStyle(fillColor); + context.moveTo(0, 0); + context.lineTo(-series[i - 1].radius, 0); + context.lineTo(-series[i].radius, -eachSpacing); + context.lineTo(series[i].radius, -eachSpacing); + context.lineTo(series[i - 1].radius, 0); + context.lineTo(0, 0); + context.closePath(); + context.fill(); + if (funnelOption.border == true) { + context.stroke(); + } + } + context.translate(0, -eachSpacing) + } + } + + context.restore(); + if (opts.dataLabel !== false && process === 1) { + drawFunnelText(series, opts, context, eachSpacing, funnelOption.labelAlign, activeWidth, centerPosition); + } + return { + center: centerPosition, + radius: radius, + series: series + }; +} + +function drawFunnelText (series, opts, context, eachSpacing, labelAlign, activeWidth, centerPosition) { + for (let i = 0; i < series.length; i++) { + let item = series[i]; + if (item.labelShow === false) { + continue; + } + let startX, endX, startY, fontSize; + let text = item.formatter ? item.formatter(item, i, series, opts) : util.toFixed(item._proportion_ * 100) + '%'; + text = item.labelText ? item.labelText : text; + if (labelAlign == 'right') { + if (opts.extra.funnel.type === 'pyramid') { + if (i == series.length - 1) { + startX = (item.funnelArea[2] + centerPosition.x) / 2; + } else { + startX = (item.funnelArea[2] + series[i + 1].funnelArea[2]) / 2; + } + } else { + if (i == 0) { + startX = (item.funnelArea[2] + centerPosition.x) / 2; + } else { + startX = (item.funnelArea[2] + series[i - 1].funnelArea[2]) / 2; + } + } + endX = startX + activeWidth * 2; + startY = item.funnelArea[1] + eachSpacing / 2; + fontSize = item.textSize * opts.pix || opts.fontSize * opts.pix; + context.setLineWidth(1 * opts.pix); + context.setStrokeStyle(item.color); + context.setFillStyle(item.color); + context.beginPath(); + context.moveTo(startX, startY); + context.lineTo(endX, startY); + context.stroke(); + context.closePath(); + context.beginPath(); + context.moveTo(endX, startY); + context.arc(endX, startY, 2 * opts.pix, 0, 2 * Math.PI); + context.closePath(); + context.fill(); + context.beginPath(); + context.setFontSize(fontSize); + context.setFillStyle(item.textColor || opts.fontColor); + context.fillText(text, endX + 5, startY + fontSize / 2 - 2); + context.closePath(); + context.stroke(); + context.closePath(); + } else { + if (opts.extra.funnel.type === 'pyramid') { + if (i == series.length - 1) { + startX = (item.funnelArea[0] + centerPosition.x) / 2; + } else { + startX = (item.funnelArea[0] + series[i + 1].funnelArea[0]) / 2; + } + } else { + if (i == 0) { + startX = (item.funnelArea[0] + centerPosition.x) / 2; + } else { + startX = (item.funnelArea[0] + series[i - 1].funnelArea[0]) / 2; + } + } + endX = startX - activeWidth * 2; + startY = item.funnelArea[1] + eachSpacing / 2; + fontSize = item.textSize * opts.pix || opts.fontSize * opts.pix; + context.setLineWidth(1 * opts.pix); + context.setStrokeStyle(item.color); + context.setFillStyle(item.color); + context.beginPath(); + context.moveTo(startX, startY); + context.lineTo(endX, startY); + context.stroke(); + context.closePath(); + context.beginPath(); + context.moveTo(endX, startY); + context.arc(endX, startY, 2, 0, 2 * Math.PI); + context.closePath(); + context.fill(); + context.beginPath(); + context.setFontSize(fontSize); + context.setFillStyle(item.textColor || opts.fontColor); + context.fillText(text, endX - 5 - measureText(text, fontSize, context), startY + fontSize / 2 - 2); + context.closePath(); + context.stroke(); + context.closePath(); + } + + } +} + + +function drawCanvas (opts, context) { + context.draw(); +} + +var Timing = { + easeIn: function easeIn (pos) { + return Math.pow(pos, 3); + }, + easeOut: function easeOut (pos) { + return Math.pow(pos - 1, 3) + 1; + }, + easeInOut: function easeInOut (pos) { + if ((pos /= 0.5) < 1) { + return 0.5 * Math.pow(pos, 3); + } else { + return 0.5 * (Math.pow(pos - 2, 3) + 2); + } + }, + linear: function linear (pos) { + return pos; + } +}; + +function Animation (opts) { + this.isStop = false; + opts.duration = typeof opts.duration === 'undefined' ? 1000 : opts.duration; + opts.timing = opts.timing || 'easeInOut'; + var delay = 17; + + function createAnimationFrame () { + if (typeof setTimeout !== 'undefined') { + return function (step, delay) { + setTimeout(function () { + var timeStamp = +new Date(); + step(timeStamp); + }, delay); + }; + } else if (typeof requestAnimationFrame !== 'undefined') { + return requestAnimationFrame; + } else { + return function (step) { + step(null); + }; + } + }; + var animationFrame = createAnimationFrame(); + var startTimeStamp = null; + var _step = function step (timestamp) { + if (timestamp === null || this.isStop === true) { + opts.onProcess && opts.onProcess(1); + opts.onAnimationFinish && opts.onAnimationFinish(); + return; + } + if (startTimeStamp === null) { + startTimeStamp = timestamp; + } + if (timestamp - startTimeStamp < opts.duration) { + var process = (timestamp - startTimeStamp) / opts.duration; + var timingFunction = Timing[opts.timing]; + process = timingFunction(process); + opts.onProcess && opts.onProcess(process); + animationFrame(_step, delay); + } else { + opts.onProcess && opts.onProcess(1); + opts.onAnimationFinish && opts.onAnimationFinish(); + } + }; + _step = _step.bind(this); + animationFrame(_step, delay); +} + +Animation.prototype.stop = function () { + this.isStop = true; +}; + +function drawCharts (type, opts, config, context) { + var _this = this; + var series = opts.series; + //兼容ECharts饼图类数据格式 + if (type === 'pie' || type === 'ring' || type === 'mount' || type === 'rose' || type === 'funnel') { + series = fixPieSeries(series, opts, config); + } + var categories = opts.categories; + if (type === 'mount') { + categories = []; + for (let j = 0; j < series.length; j++) { + if (series[j].show !== false) categories.push(series[j].name) + } + opts.categories = categories; + } + series = fillSeries(series, opts, config); + var duration = opts.animation ? opts.duration : 0; + _this.animationInstance && _this.animationInstance.stop(); + var seriesMA = null; + if (type == 'candle') { + let average = assign({}, opts.extra.candle.average); + if (average.show) { + seriesMA = calCandleMA(average.day, average.name, average.color, series[0].data); + seriesMA = fillSeries(seriesMA, opts, config); + opts.seriesMA = seriesMA; + } else if (opts.seriesMA) { + seriesMA = opts.seriesMA = fillSeries(opts.seriesMA, opts, config); + } else { + seriesMA = series; + } + } else { + seriesMA = series; + } + /* 过滤掉show=false的series */ + opts._series_ = series = filterSeries(series); + //重新计算图表区域 + opts.area = new Array(4); + //复位绘图区域 + for (let j = 0; j < 4; j++) { + opts.area[j] = opts.padding[j] * opts.pix; + } + //通过计算三大区域:图例、X轴、Y轴的大小,确定绘图区域 + var _calLegendData = calLegendData(seriesMA, opts, config, opts.chartData, context), + legendHeight = _calLegendData.area.wholeHeight, + legendWidth = _calLegendData.area.wholeWidth; + + switch (opts.legend.position) { + case 'top': + opts.area[0] += legendHeight; + break; + case 'bottom': + opts.area[2] += legendHeight; + break; + case 'left': + opts.area[3] += legendWidth; + break; + case 'right': + opts.area[1] += legendWidth; + break; + } + + let _calYAxisData = {}, + yAxisWidth = 0; + if (opts.type === 'line' || opts.type === 'column' || opts.type === 'mount' || opts.type === 'area' || opts.type === + 'mix' || opts.type === 'candle' || opts.type === 'scatter' || opts.type === 'bubble' || opts.type === 'bar') { + _calYAxisData = calYAxisData(series, opts, config, context); + yAxisWidth = _calYAxisData.yAxisWidth; + //如果显示Y轴标题 + if (opts.yAxis.showTitle) { + let maxTitleHeight = 0; + for (let i = 0; i < opts.yAxis.data.length; i++) { + maxTitleHeight = Math.max(maxTitleHeight, opts.yAxis.data[i].titleFontSize ? opts.yAxis.data[i] + .titleFontSize * opts.pix : config.fontSize) + } + opts.area[0] += maxTitleHeight; + } + let rightIndex = 0, + leftIndex = 0; + //计算主绘图区域左右位置 + for (let i = 0; i < yAxisWidth.length; i++) { + if (yAxisWidth[i].position == 'left') { + if (leftIndex > 0) { + opts.area[3] += yAxisWidth[i].width + opts.yAxis.padding * opts.pix; + } else { + opts.area[3] += yAxisWidth[i].width; + } + leftIndex += 1; + } else if (yAxisWidth[i].position == 'right') { + if (rightIndex > 0) { + opts.area[1] += yAxisWidth[i].width + opts.yAxis.padding * opts.pix; + } else { + opts.area[1] += yAxisWidth[i].width; + } + rightIndex += 1; + } + } + } else { + config.yAxisWidth = yAxisWidth; + } + opts.chartData.yAxisData = _calYAxisData; + + if (opts.categories && opts.categories.length && opts.type !== 'radar' && opts.type !== 'gauge' && opts.type !== + 'bar') { + opts.chartData.xAxisData = getXAxisPoints(opts.categories, opts, config); + let _calCategoriesData = calCategoriesData(opts.categories, opts, config, opts.chartData.xAxisData.eachSpacing, + context), + xAxisHeight = _calCategoriesData.xAxisHeight, + angle = _calCategoriesData.angle; + config.xAxisHeight = xAxisHeight; + config._xAxisTextAngle_ = angle; + opts.area[2] += xAxisHeight; + opts.chartData.categoriesData = _calCategoriesData; + } else { + if (opts.type === 'line' || opts.type === 'area' || opts.type === 'scatter' || opts.type === 'bubble' || opts + .type === 'bar') { + opts.chartData.xAxisData = calXAxisData(series, opts, config, context); + categories = opts.chartData.xAxisData.rangesFormat; + let _calCategoriesData = calCategoriesData(categories, opts, config, opts.chartData.xAxisData.eachSpacing, + context), + xAxisHeight = _calCategoriesData.xAxisHeight, + angle = _calCategoriesData.angle; + config.xAxisHeight = xAxisHeight; + config._xAxisTextAngle_ = angle; + opts.area[2] += xAxisHeight; + opts.chartData.categoriesData = _calCategoriesData; + } else { + opts.chartData.xAxisData = { + xAxisPoints: [] + }; + } + } + + //计算右对齐偏移距离 + if (opts.enableScroll && opts.xAxis.scrollAlign == 'right' && opts._scrollDistance_ === undefined) { + let offsetLeft = 0, + xAxisPoints = opts.chartData.xAxisData.xAxisPoints, + startX = opts.chartData.xAxisData.startX, + endX = opts.chartData.xAxisData.endX, + eachSpacing = opts.chartData.xAxisData.eachSpacing; + let totalWidth = eachSpacing * (xAxisPoints.length - 1); + let screenWidth = endX - startX; + offsetLeft = screenWidth - totalWidth; + _this.scrollOption.currentOffset = offsetLeft; + _this.scrollOption.startTouchX = offsetLeft; + _this.scrollOption.distance = 0; + _this.scrollOption.lastMoveTime = 0; + opts._scrollDistance_ = offsetLeft; + } + + if (type === 'pie' || type === 'ring' || type === 'rose') { + config._pieTextMaxLength_ = opts.dataLabel === false ? 0 : getPieTextMaxLength(seriesMA, config, context, opts); + } + + switch (type) { + case 'word': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + drawWordCloudDataPoints(series, opts, config, context, process); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'map': + context.clearRect(0, 0, opts.width, opts.height); + drawMapDataPoints(series, opts, config, context); + break; + case 'funnel': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + opts.chartData.funnelData = drawFunnelDataPoints(series, opts, config, context, + process); + drawLegend(opts.series, opts, config, context, opts.chartData); + drawToolTipBridge(opts, config, context, process); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'line': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function onProcess (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + drawYAxisGrid(categories, opts, config, context); + drawXAxis(categories, opts, config, context); + var _drawLineDataPoints = drawLineDataPoints(series, opts, config, context, process), + xAxisPoints = _drawLineDataPoints.xAxisPoints, + calPoints = _drawLineDataPoints.calPoints, + eachSpacing = _drawLineDataPoints.eachSpacing; + opts.chartData.xAxisPoints = xAxisPoints; + opts.chartData.calPoints = calPoints; + opts.chartData.eachSpacing = eachSpacing; + drawYAxis(series, opts, config, context); + if (opts.enableMarkLine !== false && process === 1) { + drawMarkLine(opts, config, context); + } + drawLegend(opts.series, opts, config, context, opts.chartData); + drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'scatter': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function onProcess (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + drawYAxisGrid(categories, opts, config, context); + drawXAxis(categories, opts, config, context); + var _drawScatterDataPoints = drawScatterDataPoints(series, opts, config, context, + process), + xAxisPoints = _drawScatterDataPoints.xAxisPoints, + calPoints = _drawScatterDataPoints.calPoints, + eachSpacing = _drawScatterDataPoints.eachSpacing; + opts.chartData.xAxisPoints = xAxisPoints; + opts.chartData.calPoints = calPoints; + opts.chartData.eachSpacing = eachSpacing; + drawYAxis(series, opts, config, context); + if (opts.enableMarkLine !== false && process === 1) { + drawMarkLine(opts, config, context); + } + drawLegend(opts.series, opts, config, context, opts.chartData); + drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'bubble': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function onProcess (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + drawYAxisGrid(categories, opts, config, context); + drawXAxis(categories, opts, config, context); + var _drawBubbleDataPoints = drawBubbleDataPoints(series, opts, config, context, + process), + xAxisPoints = _drawBubbleDataPoints.xAxisPoints, + calPoints = _drawBubbleDataPoints.calPoints, + eachSpacing = _drawBubbleDataPoints.eachSpacing; + opts.chartData.xAxisPoints = xAxisPoints; + opts.chartData.calPoints = calPoints; + opts.chartData.eachSpacing = eachSpacing; + drawYAxis(series, opts, config, context); + if (opts.enableMarkLine !== false && process === 1) { + drawMarkLine(opts, config, context); + } + drawLegend(opts.series, opts, config, context, opts.chartData); + drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'mix': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function onProcess (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + drawYAxisGrid(categories, opts, config, context); + drawXAxis(categories, opts, config, context); + var _drawMixDataPoints = drawMixDataPoints(series, opts, config, context, process), + xAxisPoints = _drawMixDataPoints.xAxisPoints, + calPoints = _drawMixDataPoints.calPoints, + eachSpacing = _drawMixDataPoints.eachSpacing; + opts.chartData.xAxisPoints = xAxisPoints; + opts.chartData.calPoints = calPoints; + opts.chartData.eachSpacing = eachSpacing; + drawYAxis(series, opts, config, context); + if (opts.enableMarkLine !== false && process === 1) { + drawMarkLine(opts, config, context); + } + drawLegend(opts.series, opts, config, context, opts.chartData); + drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'column': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function onProcess (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + drawYAxisGrid(categories, opts, config, context); + drawXAxis(categories, opts, config, context); + var _drawColumnDataPoints = drawColumnDataPoints(series, opts, config, context, + process), + xAxisPoints = _drawColumnDataPoints.xAxisPoints, + calPoints = _drawColumnDataPoints.calPoints, + eachSpacing = _drawColumnDataPoints.eachSpacing; + opts.chartData.xAxisPoints = xAxisPoints; + opts.chartData.calPoints = calPoints; + opts.chartData.eachSpacing = eachSpacing; + drawYAxis(series, opts, config, context); + if (opts.enableMarkLine !== false && process === 1) { + drawMarkLine(opts, config, context); + } + drawLegend(opts.series, opts, config, context, opts.chartData); + drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'mount': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function onProcess (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + drawYAxisGrid(categories, opts, config, context); + drawXAxis(categories, opts, config, context); + var _drawMountDataPoints = drawMountDataPoints(series, opts, config, context, process), + xAxisPoints = _drawMountDataPoints.xAxisPoints, + calPoints = _drawMountDataPoints.calPoints, + eachSpacing = _drawMountDataPoints.eachSpacing; + opts.chartData.xAxisPoints = xAxisPoints; + opts.chartData.calPoints = calPoints; + opts.chartData.eachSpacing = eachSpacing; + drawYAxis(series, opts, config, context); + if (opts.enableMarkLine !== false && process === 1) { + drawMarkLine(opts, config, context); + } + drawLegend(opts.series, opts, config, context, opts.chartData); + drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'bar': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function onProcess (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + drawXAxis(categories, opts, config, context); + var _drawBarDataPoints = drawBarDataPoints(series, opts, config, context, process), + yAxisPoints = _drawBarDataPoints.yAxisPoints, + calPoints = _drawBarDataPoints.calPoints, + eachSpacing = _drawBarDataPoints.eachSpacing; + opts.chartData.yAxisPoints = yAxisPoints; + opts.chartData.xAxisPoints = opts.chartData.xAxisData.xAxisPoints; + opts.chartData.calPoints = calPoints; + opts.chartData.eachSpacing = eachSpacing; + drawYAxis(series, opts, config, context); + if (opts.enableMarkLine !== false && process === 1) { + drawMarkLine(opts, config, context); + } + drawLegend(opts.series, opts, config, context, opts.chartData); + drawToolTipBridge(opts, config, context, process, eachSpacing, yAxisPoints); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'area': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function onProcess (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + drawYAxisGrid(categories, opts, config, context); + drawXAxis(categories, opts, config, context); + var _drawAreaDataPoints = drawAreaDataPoints(series, opts, config, context, process), + xAxisPoints = _drawAreaDataPoints.xAxisPoints, + calPoints = _drawAreaDataPoints.calPoints, + eachSpacing = _drawAreaDataPoints.eachSpacing; + opts.chartData.xAxisPoints = xAxisPoints; + opts.chartData.calPoints = calPoints; + opts.chartData.eachSpacing = eachSpacing; + drawYAxis(series, opts, config, context); + if (opts.enableMarkLine !== false && process === 1) { + drawMarkLine(opts, config, context); + } + drawLegend(opts.series, opts, config, context, opts.chartData); + drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'ring': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function onProcess (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process); + drawLegend(opts.series, opts, config, context, opts.chartData); + drawToolTipBridge(opts, config, context, process); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'pie': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function onProcess (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + opts.chartData.pieData = drawPieDataPoints(series, opts, config, context, process); + drawLegend(opts.series, opts, config, context, opts.chartData); + drawToolTipBridge(opts, config, context, process); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'rose': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function onProcess (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + opts.chartData.pieData = drawRoseDataPoints(series, opts, config, context, process); + drawLegend(opts.series, opts, config, context, opts.chartData); + drawToolTipBridge(opts, config, context, process); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'radar': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function onProcess (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + opts.chartData.radarData = drawRadarDataPoints(series, opts, config, context, process); + drawLegend(opts.series, opts, config, context, opts.chartData); + drawToolTipBridge(opts, config, context, process); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'arcbar': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function onProcess (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + opts.chartData.arcbarData = drawArcbarDataPoints(series, opts, config, context, + process); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'gauge': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function onProcess (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + opts.chartData.gaugeData = drawGaugeDataPoints(categories, series, opts, config, + context, process); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + case 'candle': + this.animationInstance = new Animation({ + timing: opts.timing, + duration: duration, + onProcess: function onProcess (process) { + context.clearRect(0, 0, opts.width, opts.height); + if (opts.rotate) { + contextRotate(context, opts); + } + drawYAxisGrid(categories, opts, config, context); + drawXAxis(categories, opts, config, context); + var _drawCandleDataPoints = drawCandleDataPoints(series, seriesMA, opts, config, + context, process), + xAxisPoints = _drawCandleDataPoints.xAxisPoints, + calPoints = _drawCandleDataPoints.calPoints, + eachSpacing = _drawCandleDataPoints.eachSpacing; + opts.chartData.xAxisPoints = xAxisPoints; + opts.chartData.calPoints = calPoints; + opts.chartData.eachSpacing = eachSpacing; + drawYAxis(series, opts, config, context); + if (opts.enableMarkLine !== false && process === 1) { + drawMarkLine(opts, config, context); + } + if (seriesMA) { + drawLegend(seriesMA, opts, config, context, opts.chartData); + } else { + drawLegend(opts.series, opts, config, context, opts.chartData); + } + drawToolTipBridge(opts, config, context, process, eachSpacing, xAxisPoints); + drawCanvas(opts, context); + }, + onAnimationFinish: function onAnimationFinish () { + _this.uevent.trigger('renderComplete'); + } + }); + break; + } +} + +function uChartsEvent () { + this.events = {}; +} + +uChartsEvent.prototype.addEventListener = function (type, listener) { + this.events[type] = this.events[type] || []; + this.events[type].push(listener); +}; + +uChartsEvent.prototype.delEventListener = function (type) { + this.events[type] = []; +}; + +uChartsEvent.prototype.trigger = function () { + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + var type = args[0]; + var params = args.slice(1); + if (!!this.events[type]) { + this.events[type].forEach(function (listener) { + try { + listener.apply(null, params); + } catch (e) { + //console.log('[uCharts] '+e); + } + }); + } +}; + +var uCharts = function uCharts (opts) { + opts.pix = opts.pixelRatio ? opts.pixelRatio : 1; + opts.fontSize = opts.fontSize ? opts.fontSize : 13; + opts.fontColor = opts.fontColor ? opts.fontColor : config.fontColor; + if (opts.background == "" || opts.background == "none") { + opts.background = "#FFFFFF" + } + opts.title = assign({}, opts.title); + opts.subtitle = assign({}, opts.subtitle); + opts.duration = opts.duration ? opts.duration : 1000; + opts.yAxis = assign({}, { + data: [], + showTitle: false, + disabled: false, + disableGrid: false, + splitNumber: 5, + gridType: 'solid', + dashLength: 4 * opts.pix, + gridColor: '#cccccc', + padding: 10, + fontColor: '#666666' + }, opts.yAxis); + opts.xAxis = assign({}, { + rotateLabel: false, + rotateAngle: 45, + disabled: false, + disableGrid: false, + splitNumber: 5, + calibration: false, + gridType: 'solid', + dashLength: 4, + scrollAlign: 'left', + boundaryGap: 'center', + axisLine: true, + axisLineColor: '#cccccc' + }, opts.xAxis); + opts.xAxis.scrollPosition = opts.xAxis.scrollAlign; + opts.legend = assign({}, { + show: true, + position: 'bottom', + float: 'center', + backgroundColor: 'rgba(0,0,0,0)', + borderColor: 'rgba(0,0,0,0)', + borderWidth: 0, + padding: 5, + margin: 5, + itemGap: 10, + fontSize: opts.fontSize, + lineHeight: opts.fontSize, + fontColor: opts.fontColor, + formatter: {}, + hiddenColor: '#CECECE' + }, opts.legend); + opts.extra = assign({}, opts.extra); + opts.rotate = opts.rotate ? true : false; + opts.animation = opts.animation ? true : false; + opts.rotate = opts.rotate ? true : false; + opts.canvas2d = opts.canvas2d ? true : false; + + let config$$1 = assign({}, config); + config$$1.color = opts.color ? opts.color : config$$1.color; + if (opts.type == 'pie') { + config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.pie.labelWidth * opts.pix || + config$$1.pieChartLinePadding * opts.pix; + } + if (opts.type == 'ring') { + config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.ring.labelWidth * opts.pix || + config$$1.pieChartLinePadding * opts.pix; + } + if (opts.type == 'rose') { + config$$1.pieChartLinePadding = opts.dataLabel === false ? 0 : opts.extra.rose.labelWidth * opts.pix || + config$$1.pieChartLinePadding * opts.pix; + } + config$$1.pieChartTextPadding = opts.dataLabel === false ? 0 : config$$1.pieChartTextPadding * opts.pix; + + //屏幕旋转 + config$$1.rotate = opts.rotate; + if (opts.rotate) { + let tempWidth = opts.width; + let tempHeight = opts.height; + opts.width = tempHeight; + opts.height = tempWidth; + } + + //适配高分屏 + opts.padding = opts.padding ? opts.padding : config$$1.padding; + config$$1.yAxisWidth = config.yAxisWidth * opts.pix; + config$$1.xAxisHeight = config.xAxisHeight * opts.pix; + if (opts.enableScroll && opts.xAxis.scrollShow) { + config$$1.xAxisHeight += 6 * opts.pix; + } + config$$1.fontSize = opts.fontSize * opts.pix; + config$$1.titleFontSize = config.titleFontSize * opts.pix; + config$$1.subtitleFontSize = config.subtitleFontSize * opts.pix; + config$$1.toolTipPadding = config.toolTipPadding * opts.pix; + config$$1.toolTipLineHeight = config.toolTipLineHeight * opts.pix; + if (!opts.context) { + throw new Error('[uCharts] 未获取到context!注意:v2.0版本后,需要自行获取canvas的绘图上下文并传入opts.context!'); + } + this.context = opts.context; + if (!this.context.setTextAlign) { + this.context.setStrokeStyle = function (e) { + return this.strokeStyle = e; + } + this.context.setLineWidth = function (e) { + return this.lineWidth = e; + } + this.context.setLineCap = function (e) { + return this.lineCap = e; + } + this.context.setFontSize = function (e) { + return this.font = e + "px sans-serif"; + } + this.context.setFillStyle = function (e) { + return this.fillStyle = e; + } + this.context.setTextAlign = function (e) { + return this.textAlign = e; + } + this.context.draw = function () {} + } + //兼容NVUEsetLineDash + if (!this.context.setLineDash) { + this.context.setLineDash = function (e) {} + } + opts.chartData = {}; + this.uevent = new uChartsEvent(); + this.scrollOption = { + currentOffset: 0, + startTouchX: 0, + distance: 0, + lastMoveTime: 0 + }; + this.opts = opts; + this.config = config$$1; + drawCharts.call(this, opts.type, opts, config$$1, this.context); +}; + +uCharts.prototype.updateData = function () { + let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + this.opts = assign({}, this.opts, data); + this.opts.updateData = true; + let scrollPosition = data.scrollPosition || 'current'; + switch (scrollPosition) { + case 'current': + this.opts._scrollDistance_ = this.scrollOption.currentOffset; + break; + case 'left': + this.opts._scrollDistance_ = 0; + this.scrollOption = { + currentOffset: 0, + startTouchX: 0, + distance: 0, + lastMoveTime: 0 + }; + break; + case 'right': + let _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config, this.context), + yAxisWidth = _calYAxisData.yAxisWidth; + this.config.yAxisWidth = yAxisWidth; + let offsetLeft = 0; + let _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config), + xAxisPoints = _getXAxisPoints0.xAxisPoints, + startX = _getXAxisPoints0.startX, + endX = _getXAxisPoints0.endX, + eachSpacing = _getXAxisPoints0.eachSpacing; + let totalWidth = eachSpacing * (xAxisPoints.length - 1); + let screenWidth = endX - startX; + offsetLeft = screenWidth - totalWidth; + this.scrollOption = { + currentOffset: offsetLeft, + startTouchX: offsetLeft, + distance: 0, + lastMoveTime: 0 + }; + this.opts._scrollDistance_ = offsetLeft; + break; + } + drawCharts.call(this, this.opts.type, this.opts, this.config, this.context); +}; + +uCharts.prototype.zoom = function () { + var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.opts.xAxis.itemCount; + if (this.opts.enableScroll !== true) { + console.log('[uCharts] 请启用滚动条后使用') + return; + } + //当前屏幕中间点 + let centerPoint = Math.round(Math.abs(this.scrollOption.currentOffset) / this.opts.chartData.eachSpacing) + Math + .round(this.opts.xAxis.itemCount / 2); + this.opts.animation = false; + this.opts.xAxis.itemCount = val.itemCount; + //重新计算x轴偏移距离 + let _calYAxisData = calYAxisData(this.opts.series, this.opts, this.config, this.context), + yAxisWidth = _calYAxisData.yAxisWidth; + this.config.yAxisWidth = yAxisWidth; + let offsetLeft = 0; + let _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config), + xAxisPoints = _getXAxisPoints0.xAxisPoints, + startX = _getXAxisPoints0.startX, + endX = _getXAxisPoints0.endX, + eachSpacing = _getXAxisPoints0.eachSpacing; + let centerLeft = eachSpacing * centerPoint; + let screenWidth = endX - startX; + let MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1); + offsetLeft = screenWidth / 2 - centerLeft; + if (offsetLeft > 0) { + offsetLeft = 0; + } + if (offsetLeft < MaxLeft) { + offsetLeft = MaxLeft; + } + this.scrollOption = { + currentOffset: offsetLeft, + startTouchX: 0, + distance: 0, + lastMoveTime: 0 + }; + calValidDistance(this, offsetLeft, this.opts.chartData, this.config, this.opts); + this.opts._scrollDistance_ = offsetLeft; + drawCharts.call(this, this.opts.type, this.opts, this.config, this.context); +}; + +uCharts.prototype.dobuleZoom = function (e) { + if (this.opts.enableScroll !== true) { + console.log('[uCharts] 请启用滚动条后使用') + return; + } + const tcs = e.changedTouches; + if (tcs.length < 2) { + return; + } + for (var i = 0; i < tcs.length; i++) { + tcs[i].x = tcs[i].x ? tcs[i].x : tcs[i].clientX; + tcs[i].y = tcs[i].y ? tcs[i].y : tcs[i].clientY; + } + const ntcs = [getTouches(tcs[0], this.opts, e), getTouches(tcs[1], this.opts, e)]; + const xlength = Math.abs(ntcs[0].x - ntcs[1].x); + // 记录初始的两指之间的数据 + if (!this.scrollOption.moveCount) { + let cts0 = { changedTouches: [{ x: tcs[0].x, y: this.opts.area[0] / this.opts.pix + 2 }] }; + let cts1 = { changedTouches: [{ x: tcs[1].x, y: this.opts.area[0] / this.opts.pix + 2 }] }; + if (this.opts.rotate) { + cts0 = { + changedTouches: [{ + x: this.opts.height / this.opts.pix - this.opts.area[0] / this.opts.pix - 2, + y: tcs[0].y + }] + }; + cts1 = { + changedTouches: [{ + x: this.opts.height / this.opts.pix - this.opts.area[0] / this.opts.pix - 2, + y: tcs[1].y + }] + }; + } + const moveCurrent1 = this.getCurrentDataIndex(cts0).index; + const moveCurrent2 = this.getCurrentDataIndex(cts1).index; + const moveCount = Math.abs(moveCurrent1 - moveCurrent2); + this.scrollOption.moveCount = moveCount; + this.scrollOption.moveCurrent1 = Math.min(moveCurrent1, moveCurrent2); + this.scrollOption.moveCurrent2 = Math.max(moveCurrent1, moveCurrent2); + return; + } + + let currentEachSpacing = xlength / this.scrollOption.moveCount; + let itemCount = (this.opts.width - this.opts.area[1] - this.opts.area[3]) / currentEachSpacing; + itemCount = itemCount <= 2 ? 2 : itemCount; + itemCount = itemCount >= this.opts.categories.length ? this.opts.categories.length : itemCount; + this.opts.animation = false; + this.opts.xAxis.itemCount = itemCount; + // 重新计算滚动条偏移距离 + let offsetLeft = 0; + let _getXAxisPoints0 = getXAxisPoints(this.opts.categories, this.opts, this.config), + xAxisPoints = _getXAxisPoints0.xAxisPoints, + startX = _getXAxisPoints0.startX, + endX = _getXAxisPoints0.endX, + eachSpacing = _getXAxisPoints0.eachSpacing; + let currentLeft = eachSpacing * this.scrollOption.moveCurrent1; + let screenWidth = endX - startX; + let MaxLeft = screenWidth - eachSpacing * (xAxisPoints.length - 1); + offsetLeft = -currentLeft + Math.min(ntcs[0].x, ntcs[1].x) - this.opts.area[3] - eachSpacing; + if (offsetLeft > 0) { + offsetLeft = 0; + } + if (offsetLeft < MaxLeft) { + offsetLeft = MaxLeft; + } + this.scrollOption.currentOffset = offsetLeft; + this.scrollOption.startTouchX = 0; + this.scrollOption.distance = 0; + calValidDistance(this, offsetLeft, this.opts.chartData, this.config, this.opts); + this.opts._scrollDistance_ = offsetLeft; + drawCharts.call(this, this.opts.type, this.opts, this.config, this.context); +} + +uCharts.prototype.stopAnimation = function () { + this.animationInstance && this.animationInstance.stop(); +}; + +uCharts.prototype.addEventListener = function (type, listener) { + this.uevent.addEventListener(type, listener); +}; + +uCharts.prototype.delEventListener = function (type) { + this.uevent.delEventListener(type); +}; + +uCharts.prototype.getCurrentDataIndex = function (e) { + var touches = null; + if (e.changedTouches) { + touches = e.changedTouches[0]; + } else { + touches = e.mp.changedTouches[0]; + } + if (touches) { + let _touches$ = getTouches(touches, this.opts, e); + if (this.opts.type === 'pie' || this.opts.type === 'ring') { + return findPieChartCurrentIndex({ + x: _touches$.x, + y: _touches$.y + }, this.opts.chartData.pieData, this.opts); + } else if (this.opts.type === 'rose') { + return findRoseChartCurrentIndex({ + x: _touches$.x, + y: _touches$.y + }, this.opts.chartData.pieData, this.opts); + } else if (this.opts.type === 'radar') { + return findRadarChartCurrentIndex({ + x: _touches$.x, + y: _touches$.y + }, this.opts.chartData.radarData, this.opts.categories.length); + } else if (this.opts.type === 'funnel') { + return findFunnelChartCurrentIndex({ + x: _touches$.x, + y: _touches$.y + }, this.opts.chartData.funnelData); + } else if (this.opts.type === 'map') { + return findMapChartCurrentIndex({ + x: _touches$.x, + y: _touches$.y + }, this.opts); + } else if (this.opts.type === 'word') { + return findWordChartCurrentIndex({ + x: _touches$.x, + y: _touches$.y + }, this.opts.chartData.wordCloudData); + } else if (this.opts.type === 'bar') { + return findBarChartCurrentIndex({ + x: _touches$.x, + y: _touches$.y + }, this.opts.chartData.calPoints, this.opts, this.config, Math.abs(this.scrollOption + .currentOffset)); + } else { + return findCurrentIndex({ + x: _touches$.x, + y: _touches$.y + }, this.opts.chartData.calPoints, this.opts, this.config, Math.abs(this.scrollOption + .currentOffset)); + } + } + return -1; +}; + +uCharts.prototype.getLegendDataIndex = function (e) { + var touches = null; + if (e.changedTouches) { + touches = e.changedTouches[0]; + } else { + touches = e.mp.changedTouches[0]; + } + if (touches) { + let _touches$ = getTouches(touches, this.opts, e); + return findLegendIndex({ + x: _touches$.x, + y: _touches$.y + }, this.opts.chartData.legendData); + } + return -1; +}; + +uCharts.prototype.touchLegend = function (e) { + var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var touches = null; + if (e.changedTouches) { + touches = e.changedTouches[0]; + } else { + touches = e.mp.changedTouches[0]; + } + if (touches) { + var _touches$ = getTouches(touches, this.opts, e); + var index = this.getLegendDataIndex(e); + if (index >= 0) { + if (this.opts.type == 'candle') { + this.opts.seriesMA[index].show = !this.opts.seriesMA[index].show; + } else { + this.opts.series[index].show = !this.opts.series[index].show; + } + this.opts.animation = option.animation ? true : false; + this.opts._scrollDistance_ = this.scrollOption.currentOffset; + drawCharts.call(this, this.opts.type, this.opts, this.config, this.context); + } + } + +}; + +uCharts.prototype.showToolTip = function (e) { + var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var touches = null; + if (e.changedTouches) { + touches = e.changedTouches[0]; + } else { + touches = e.mp.changedTouches[0]; + } + if (!touches) { + console.log("[uCharts] 未获取到event坐标信息"); + } + var _touches$ = getTouches(touches, this.opts, e); + var currentOffset = this.scrollOption.currentOffset; + var opts = assign({}, this.opts, { + _scrollDistance_: currentOffset, + animation: false + }); + if (this.opts.type === 'line' || this.opts.type === 'area' || this.opts.type === 'column' || this.opts.type === + 'scatter' || this.opts.type === 'bubble') { + var current = this.getCurrentDataIndex(e); + var index = option.index == undefined ? current.index : option.index; + if (index > -1 || index.length > 0) { + var seriesData = getSeriesDataItem(this.opts.series, index, current.group); + if (seriesData.length !== 0) { + var _getToolTipData = getToolTipData(seriesData, this.opts, index, current.group, this.opts + .categories, option), + textList = _getToolTipData.textList, + offset = _getToolTipData.offset; + offset.y = _touches$.y; + opts.tooltip = { + textList: option.textList !== undefined ? option.textList : textList, + offset: option.offset !== undefined ? option.offset : offset, + option: option, + index: index + }; + } + } + drawCharts.call(this, opts.type, opts, this.config, this.context); + } + if (this.opts.type === 'mount') { + var index = option.index == undefined ? this.getCurrentDataIndex(e).index : option.index; + if (index > -1) { + var opts = assign({}, this.opts, { animation: false }); + var seriesData = assign({}, opts._series_[index]); + var textList = [{ + text: option.formatter ? option.formatter(seriesData, undefined, index, opts) : seriesData + .name + ': ' + seriesData.data, + color: seriesData.color + }]; + var offset = { + x: opts.chartData.calPoints[index].x, + y: _touches$.y + }; + opts.tooltip = { + textList: option.textList ? option.textList : textList, + offset: option.offset !== undefined ? option.offset : offset, + option: option, + index: index + }; + } + + drawCharts.call(this, opts.type, opts, this.config, this.context); + } + if (this.opts.type === 'bar') { + var current = this.getCurrentDataIndex(e); + var index = option.index == undefined ? current.index : option.index; + if (index > -1 || index.length > 0) { + var seriesData = getSeriesDataItem(this.opts.series, index, current.group); + if (seriesData.length !== 0) { + var _getToolTipData = getToolTipData(seriesData, this.opts, index, current.group, this.opts + .categories, option), + textList = _getToolTipData.textList, + offset = _getToolTipData.offset; + offset.x = _touches$.x; + opts.tooltip = { + textList: option.textList !== undefined ? option.textList : textList, + offset: option.offset !== undefined ? option.offset : offset, + option: option, + index: index + }; + } + } + drawCharts.call(this, opts.type, opts, this.config, this.context); + } + if (this.opts.type === 'mix') { + var current = this.getCurrentDataIndex(e); + var index = option.index == undefined ? current.index : option.index; + if (index > -1) { + var currentOffset = this.scrollOption.currentOffset; + var opts = assign({}, this.opts, { + _scrollDistance_: currentOffset, + animation: false + }); + var seriesData = getSeriesDataItem(this.opts.series, index); + if (seriesData.length !== 0) { + var _getMixToolTipData = getMixToolTipData(seriesData, this.opts, index, this.opts.categories, + option), + textList = _getMixToolTipData.textList, + offset = _getMixToolTipData.offset; + offset.y = _touches$.y; + opts.tooltip = { + textList: option.textList ? option.textList : textList, + offset: option.offset !== undefined ? option.offset : offset, + option: option, + index: index + }; + } + } + drawCharts.call(this, opts.type, opts, this.config, this.context); + } + if (this.opts.type === 'candle') { + var current = this.getCurrentDataIndex(e); + var index = option.index == undefined ? current.index : option.index; + if (index > -1) { + var currentOffset = this.scrollOption.currentOffset; + var opts = assign({}, this.opts, { + _scrollDistance_: currentOffset, + animation: false + }); + var seriesData = getSeriesDataItem(this.opts.series, index); + if (seriesData.length !== 0) { + var _getToolTipData = getCandleToolTipData(this.opts.series[0].data, seriesData, this.opts, index, + this.opts.categories, this.opts.extra.candle, option), + textList = _getToolTipData.textList, + offset = _getToolTipData.offset; + offset.y = _touches$.y; + opts.tooltip = { + textList: option.textList ? option.textList : textList, + offset: option.offset !== undefined ? option.offset : offset, + option: option, + index: index + }; + } + } + drawCharts.call(this, opts.type, opts, this.config, this.context); + } + if (this.opts.type === 'pie' || this.opts.type === 'ring' || this.opts.type === 'rose' || this.opts.type === + 'funnel') { + var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index; + if (index > -1) { + var opts = assign({}, this.opts, { animation: false }); + var seriesData = assign({}, opts._series_[index]); + var textList = [{ + text: option.formatter ? option.formatter(seriesData, undefined, index, opts) : seriesData + .name + ': ' + seriesData.data, + color: seriesData.color + }]; + var offset = { + x: _touches$.x, + y: _touches$.y + }; + opts.tooltip = { + textList: option.textList ? option.textList : textList, + offset: option.offset !== undefined ? option.offset : offset, + option: option, + index: index + }; + } + drawCharts.call(this, opts.type, opts, this.config, this.context); + } + if (this.opts.type === 'map') { + var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index; + if (index > -1) { + var opts = assign({}, this.opts, { animation: false }); + var seriesData = assign({}, this.opts.series[index]); + seriesData.name = seriesData.properties.name + var textList = [{ + text: option.formatter ? option.formatter(seriesData, undefined, index, this.opts) : + seriesData.name, + color: seriesData.color + }]; + var offset = { + x: _touches$.x, + y: _touches$.y + }; + opts.tooltip = { + textList: option.textList ? option.textList : textList, + offset: option.offset !== undefined ? option.offset : offset, + option: option, + index: index + }; + } + opts.updateData = false; + drawCharts.call(this, opts.type, opts, this.config, this.context); + } + if (this.opts.type === 'word') { + var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index; + if (index > -1) { + var opts = assign({}, this.opts, { animation: false }); + var seriesData = assign({}, this.opts.series[index]); + var textList = [{ + text: option.formatter ? option.formatter(seriesData, undefined, index, this.opts) : + seriesData.name, + color: seriesData.color + }]; + var offset = { + x: _touches$.x, + y: _touches$.y + }; + opts.tooltip = { + textList: option.textList ? option.textList : textList, + offset: option.offset !== undefined ? option.offset : offset, + option: option, + index: index + }; + } + opts.updateData = false; + drawCharts.call(this, opts.type, opts, this.config, this.context); + } + if (this.opts.type === 'radar') { + var index = option.index == undefined ? this.getCurrentDataIndex(e) : option.index; + if (index > -1) { + var opts = assign({}, this.opts, { animation: false }); + var seriesData = getSeriesDataItem(this.opts.series, index); + if (seriesData.length !== 0) { + var textList = seriesData.map((item) => { + return { + text: option.formatter ? option.formatter(item, this.opts.categories[index], index, + this.opts) : item.name + ': ' + item.data, + color: item.color + }; + }); + var offset = { + x: _touches$.x, + y: _touches$.y + }; + opts.tooltip = { + textList: option.textList ? option.textList : textList, + offset: option.offset !== undefined ? option.offset : offset, + option: option, + index: index + }; + } + } + drawCharts.call(this, opts.type, opts, this.config, this.context); + } +}; + +uCharts.prototype.translate = function (distance) { + this.scrollOption = { + currentOffset: distance, + startTouchX: distance, + distance: 0, + lastMoveTime: 0 + }; + let opts = assign({}, this.opts, { + _scrollDistance_: distance, + animation: false + }); + drawCharts.call(this, this.opts.type, opts, this.config, this.context); +}; + +uCharts.prototype.scrollStart = function (e) { + var touches = null; + if (e.changedTouches) { + touches = e.changedTouches[0]; + } else { + touches = e.mp.changedTouches[0]; + } + var _touches$ = getTouches(touches, this.opts, e); + if (touches && this.opts.enableScroll === true) { + this.scrollOption.startTouchX = _touches$.x; + } +}; + +uCharts.prototype.scroll = function (e) { + if (this.scrollOption.lastMoveTime === 0) { + this.scrollOption.lastMoveTime = Date.now(); + } + let Limit = this.opts.touchMoveLimit || 60; + let currMoveTime = Date.now(); + let duration = currMoveTime - this.scrollOption.lastMoveTime; + if (duration < Math.floor(1000 / Limit)) return; + if (this.scrollOption.startTouchX == 0) return; + this.scrollOption.lastMoveTime = currMoveTime; + var touches = null; + if (e.changedTouches) { + touches = e.changedTouches[0]; + } else { + touches = e.mp.changedTouches[0]; + } + if (touches && this.opts.enableScroll === true) { + var _touches$ = getTouches(touches, this.opts, e); + var _distance; + _distance = _touches$.x - this.scrollOption.startTouchX; + var currentOffset = this.scrollOption.currentOffset; + var validDistance = calValidDistance(this, currentOffset + _distance, this.opts.chartData, this.config, this + .opts); + this.scrollOption.distance = _distance = validDistance - currentOffset; + var opts = assign({}, this.opts, { + _scrollDistance_: currentOffset + _distance, + animation: false + }); + this.opts = opts; + drawCharts.call(this, opts.type, opts, this.config, this.context); + return currentOffset + _distance; + } +}; + +uCharts.prototype.scrollEnd = function (e) { + if (this.opts.enableScroll === true) { + var _scrollOption = this.scrollOption, + currentOffset = _scrollOption.currentOffset, + distance = _scrollOption.distance; + this.scrollOption.currentOffset = currentOffset + distance; + this.scrollOption.distance = 0; + this.scrollOption.moveCount = 0; + } +}; + +export default uCharts; \ No newline at end of file diff --git a/uni_modules/qiun-data-charts/js_sdk/u-charts/u-charts.min.js b/uni_modules/qiun-data-charts/js_sdk/u-charts/u-charts.min.js new file mode 100644 index 0000000..7a24728 --- /dev/null +++ b/uni_modules/qiun-data-charts/js_sdk/u-charts/u-charts.min.js @@ -0,0 +1,18 @@ +/* + * uCharts (R) + * 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360/快手)、Vue、Taro等支持canvas的框架平台 + * Copyright (C) 2021 QIUN (R) 秋云 https://www.ucharts.cn All rights reserved. + * Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) + * 复制使用请保留本段注释,感谢支持开源! + * + * uCharts (R) 官方网站 + * https://www.uCharts.cn + * + * 开源地址: + * https://gitee.com/uCharts/uCharts + * + * uni-app插件市场地址: + * http://ext.dcloud.net.cn/plugin?id=271 + * + */ +"use strict";var config={version:"v2.4.3-20220505",yAxisWidth:15,xAxisHeight:22,xAxisTextPadding:3,padding:[10,10,10,10],pixelRatio:1,rotate:false,fontSize:13,fontColor:"#666666",dataPointShape:["circle","circle","circle","circle"],color:["#1890FF","#91CB74","#FAC858","#EE6666","#73C0DE","#3CA272","#FC8452","#9A60B4","#ea7ccc"],linearColor:["#0EE2F8","#2BDCA8","#FA7D8D","#EB88E2","#2AE3A0","#0EE2F8","#EB88E2","#6773E3","#F78A85"],pieChartLinePadding:15,pieChartTextPadding:5,titleFontSize:20,subtitleFontSize:15,toolTipPadding:3,toolTipBackground:"#000000",toolTipOpacity:.7,toolTipLineHeight:20,radarLabelTextMargin:13};var assign=function(e,...t){if(e==null){throw new TypeError("[uCharts] Cannot convert undefined or null to object")}if(!t||t.length<=0){return e}function i(e,a){for(let t in a){e[t]=e[t]&&e[t].toString()==="[object Object]"?i(e[t],a[t]):e[t]=a[t]}return e}t.forEach(t=>{e=i(e,t)});return e};var util={toFixed:function t(e,a){a=a||2;if(this.isFloat(e)){e=e.toFixed(a)}return e},isFloat:function t(e){return e%1!==0},approximatelyEqual:function t(e,a){return Math.abs(e-a)<1e-10},isSameSign:function t(e,a){return Math.abs(e)===e&&Math.abs(a)===a||Math.abs(e)!==e&&Math.abs(a)!==a},isSameXCoordinateArea:function t(e,a){return this.isSameSign(e.x,a.x)},isCollision:function t(e,a){e.end={};e.end.x=e.start.x+e.width;e.end.y=e.start.y-e.height;a.end={};a.end.x=a.start.x+a.width;a.end.y=a.start.y-a.height;var i=a.start.x>e.end.x||a.end.xe.start.y||a.start.y1){if(r.extra.mount.widthRatio>2)r.extra.mount.widthRatio=2;n+=(r.extra.mount.widthRatio-1)*a.eachSpacing}var l=e;if(e>=0){l=0;t.uevent.trigger("scrollLeft");t.scrollOption.position="left";r.xAxis.scrollPosition="left"}else if(Math.abs(e)>=n-o){l=o-n;t.uevent.trigger("scrollRight");t.scrollOption.position="right";r.xAxis.scrollPosition="right"}else{t.scrollOption.position=e;r.xAxis.scrollPosition=e}return l}function isInAngleRange(t,e,a){function i(t){while(t<0){t+=2*Math.PI}while(t>2*Math.PI){t-=2*Math.PI}return t}t=i(t);e=i(e);a=i(a);if(e>a){a+=2*Math.PI;if(t=e&&t<=a}function createCurveControlPoints(t,e){function a(t,e){if(t[e-1]&&t[e+1]){return t[e].y>=Math.max(t[e-1].y,t[e+1].y)||t[e].y<=Math.min(t[e-1].y,t[e+1].y)}else{return false}}function c(t,e){if(t[e-1]&&t[e+1]){return t[e].x>=Math.max(t[e-1].x,t[e+1].x)||t[e].x<=Math.min(t[e-1].x,t[e+1].x)}else{return false}}var i=.2;var r=.2;var o=null;var n=null;var l=null;var s=null;if(e<1){o=t[0].x+(t[1].x-t[0].x)*i;n=t[0].y+(t[1].y-t[0].y)*i}else{o=t[e].x+(t[e+1].x-t[e-1].x)*i;n=t[e].y+(t[e+1].y-t[e-1].y)*i}if(e>t.length-3){var h=t.length-1;l=t[h].x-(t[h].x-t[h-1].x)*r;s=t[h].y-(t[h].y-t[h-1].y)*r}else{l=t[e+1].x-(t[e+2].x-t[e].x)*r;s=t[e+1].y-(t[e+2].y-t[e].y)*r}if(a(t,e+1)){s=t[e+1].y}if(a(t,e)){n=t[e].y}if(c(t,e+1)){l=t[e+1].x}if(c(t,e)){o=t[e].x}if(n>=Math.max(t[e].y,t[e+1].y)||n<=Math.min(t[e].y,t[e+1].y)){n=t[e].y}if(s>=Math.max(t[e].y,t[e+1].y)||s<=Math.min(t[e].y,t[e+1].y)){s=t[e+1].y}if(o>=Math.max(t[e].x,t[e+1].x)||o<=Math.min(t[e].x,t[e+1].x)){o=t[e].x}if(l>=Math.max(t[e].x,t[e+1].x)||l<=Math.min(t[e].x,t[e+1].x)){l=t[e+1].x}return{ctrA:{x:o,y:n},ctrB:{x:l,y:s}}}function convertCoordinateOrigin(t,e,a){return{x:a.x+t,y:a.y-e}}function avoidCollision(t,e){if(e){while(util.isCollision(t,e)){if(t.start.x>0){t.start.y--}else if(t.start.x<0){t.start.y++}else{if(t.start.y>0){t.start.y++}else{t.start.y--}}}}return t}function fixPieSeries(e,a,t){let i=[];if(e.length>0&&e[0].data.constructor.toString().indexOf("Array")>-1){a._pieSeries_=e;let t=e[0].data;for(var r=0;r=1e4){a=1e3}else if(i>=1e3){a=100}else if(i>=100){a=10}else if(i>=10){a=5}else if(i>=1){a=1}else if(i>=.1){a=.1}else if(i>=.01){a=.01}else if(i>=.001){a=.001}else if(i>=1e-4){a=1e-4}else if(i>=1e-5){a=1e-5}else{a=1e-6}return{minRange:findRange(t,"lower",a),maxRange:findRange(e,"upper",a)}}function measureText(a,t,e){var i=0;a=String(a);e=false;if(e!==false&&e!==undefined&&e.setFontSize&&e.measureText){e.setFontSize(t);return e.measureText(a).width}else{var a=a.split("");for(let e=0;e-1;if(n){let t=filterSeries(e);for(var l=0;l5&&arguments[5]!==undefined?arguments[5]:{};var l=a.chartData.calPoints?a.chartData.calPoints:[];let s={};if(r.length>0){let e=[];for(let t=0;t0){e=o[i]}return{text:n.formatter?n.formatter(t,e,i,a):t.name+": "+t.data,color:t.color}});var h={x:Math.round(s.x),y:Math.round(s.y)};return{textList:e,offset:h}}function getMixToolTipData(t,e,a,i){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:{};var o=e.chartData.xAxisPoints[a]+e.chartData.eachSpacing/2;var n=t.map(function(t){return{text:r.formatter?r.formatter(t,i[a],a,e):t.name+": "+t.data,color:t.color,disableLegend:t.disableLegend?true:false}});n=n.filter(function(t){if(t.disableLegend!==true){return t}});var l={x:Math.round(o),y:0};return{textList:n,offset:l}}function getCandleToolTipData(o,e,r,n,d,t){var x=arguments.length>6&&arguments[6]!==undefined?arguments[6]:{};var a=r.chartData.calPoints;let l=t.color.upFill;let s=t.color.downFill;let h=[l,l,s,l];var c=[];e.map(function(t){if(n==0){if(t.data[1]-t.data[0]<0){h[1]=s}else{h[1]=l}}else{if(t.data[0]o[n-1][1]){h[2]=l}if(t.data[3]4&&arguments[4]!==undefined?arguments[4]:0;var l={index:-1,group:[]};var i=e.chartData.eachSpacing/2;let r=[];if(n&&n.length>0){if(!e.categories){i=0}else{for(let t=1;tt){l.index=e}})}}}return l}function findBarChartCurrentIndex(a,t,e,i){var r=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var o={index:-1,group:[]};var n=e.chartData.eachSpacing/2;let l=e.chartData.yAxisPoints;if(t&&t.length>0){if(isInExactChartArea(a,e,i)){l.forEach(function(t,e){if(a.y+r+n>t){o.index=e}})}}return o}function findLegendIndex(o,t,e){let n=-1;let l=0;if(isInExactLegendArea(o,t.area)){let i=t.points;let r=-1;for(let t=0,e=i.length;tt[0]-l&&o.xt[1]-l&&o.ye.start.x&&t.xe.start.y&&t.y=e.area[3]-10&&t.y>=e.area[0]&&t.y<=e.height-e.area[2]}function findRadarChartCurrentIndex(t,e,a){var r=2*Math.PI/a;var o=-1;if(isInExactPieChartArea(t,e.center,e.radius)){var n=function t(e){if(e<0){e+=2*Math.PI}if(e>2*Math.PI){e-=2*Math.PI}return e};var l=Math.atan2(e.center.y-t.y,t.x-e.center.x);l=-1*l;if(l<0){l+=2*Math.PI}var i=e.angleList.map(function(t){t=n(-1*t);return t});i.forEach(function(t,e){var a=n(t-r/2);var i=n(t+r/2);if(i=a&&l<=i||l+2*Math.PI>=a&&l+2*Math.PI<=i){o=e}})}return o}function findFunnelChartCurrentIndex(t,e){var a=-1;for(var i=0,r=e.series.length;io.funnelArea[0]&&t.xo.funnelArea[1]&&t.yo.area[0]&&t.xo.area[1]&&t.ys.width-s.area[1]-s.area[3]){i.push(n);o.push(r-s.legend.itemGap*s.pix);r=e;n=[t]}else{r+=e;n.push(t)}}if(n.length){i.push(n);o.push(r-s.legend.itemGap*s.pix);c.widthArr=o;let t=Math.max.apply(null,o);switch(s.legend.float){case"left":c.area.start.x=s.area[3];c.area.end.x=s.area[3]+t+2*d;break;case"right":c.area.start.x=s.width-s.area[1]-t-2*d;c.area.end.x=s.width-s.area[1];break;default:c.area.start.x=(s.width-t)/2-d;c.area.end.x=(s.width+t)/2+d}c.area.width=t+2*d;c.area.wholeWidth=t+2*d;c.area.height=i.length*g+2*d;c.area.wholeHeight=i.length*g+2*d+2*x;c.points=i}}else{let t=l.length;let e=s.height-s.area[0]-s.area[2]-2*x-2*d;let a=Math.min(Math.floor(e/g),t);c.area.height=a*g+d*2;c.area.wholeHeight=a*g+d*2;switch(s.legend.float){case"top":c.area.start.y=s.area[0]+x;c.area.end.y=s.area[0]+x+c.area.height;break;case"bottom":c.area.start.y=s.height-s.area[2]-x-c.area.height;c.area.end.y=s.height-s.area[2]-x;break;default:c.area.start.y=(s.height-c.area.height)/2;c.area.end.y=(s.height+c.area.height)/2}let i=t%a===0?t/a:Math.floor(t/a+1);let r=[];for(let e=0;ei){i=t}}c.widthArr.push(i);c.heightArr.push(a.length*g+d*2)}let e=0;for(let t=0;t4&&arguments[4]!==undefined?arguments[4]:-1;var i;if(c=="stack"){i=dataCombineStack(t,e.categories.length)}else{i=dataCombine(t)}var r=[];i=i.filter(function(t){if(typeof t==="object"&&t!==null){if(t.constructor.toString().indexOf("Array")>-1){return t!==null}else{return t.value!==null}}else{return t!==null}});i.map(function(t){if(typeof t==="object"){if(t.constructor.toString().indexOf("Array")>-1){if(e.type=="candle"){t.map(function(t){r.push(t)})}else{r.push(t[0])}}else{r.push(t.value)}}else{r.push(t)}});var o=0;var n=0;if(r.length>0){o=Math.min.apply(this,r);n=Math.max.apply(this,r)}if(a>-1){if(typeof e.xAxis.data[a].min==="number"){o=Math.min(e.xAxis.data[a].min,o)}if(typeof e.xAxis.data[a].max==="number"){n=Math.max(e.xAxis.data[a].max,n)}}else{if(typeof e.xAxis.min==="number"){o=Math.min(e.xAxis.min,o)}if(typeof e.xAxis.max==="number"){n=Math.max(e.xAxis.max,n)}}if(o===n){var d=n||10;n+=d}var l=o;var x=n;var f=[];var p=(x-l)/e.xAxis.splitNumber;for(var s=0;s<=e.xAxis.splitNumber;s++){f.push(l+p*s)}return f}function calXAxisData(t,e,a,i){var r=assign({},{type:""},e.extra.bar);var o={angle:0,xAxisHeight:a.xAxisHeight};o.ranges=getXAxisTextList(t,e,a,r.type);o.rangesFormat=o.ranges.map(function(t){t=util.toFixed(t,2);return t});var n=o.ranges.map(function(t){t=util.toFixed(t,2);return t});o=Object.assign(o,getXAxisPoints(n,e,a));var l=o.eachSpacing;var s=n.map(function(t){return measureText(t,e.xAxis.fontSize*e.pix||a.fontSize,i)});var h=Math.max.apply(this,s);if(h+2*a.xAxisTextPadding>l){o.angle=45*Math.PI/180;o.xAxisHeight=2*a.xAxisTextPadding+h*Math.sin(o.angle)}if(e.xAxis.disabled===true){o.xAxisHeight=0}return o}function getRadarDataPoints(r,o,n,a,t){var l=arguments.length>5&&arguments[5]!==undefined?arguments[5]:1;var e=t.extra.radar||{};e.max=e.max||0;var s=Math.max(e.max,Math.max.apply(null,dataCombine(a)));var h=[];for(let e=0;e2&&arguments[2]!==undefined?arguments[2]:1;var o=0;var n=0;for(let e=0;e4&&arguments[4]!==undefined?arguments[4]:1;e=e.sort(function(t,e){return parseInt(e.data)-parseInt(t.data)});for(let t=0;t4&&arguments[4]!==undefined?arguments[4]:1;var l=0;var s=0;var h=[];for(let e=0;e2&&arguments[2]!==undefined?arguments[2]:1;if(o==1){o=.999999}for(let a=0;a=2){t._proportion_=t._proportion_%2}}return i}function getGaugeArcbarDataPoints(i,r){var o=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1;if(o==1){o=.999999}for(let a=0;a=2){t._proportion_=t._proportion_%2}}return i}function getGaugeAxisPoints(e,a,t){let i=a-t+1;let r=a;for(let t=0;t=2){e[t]._endAngle_=e[t]._endAngle_%2}r=e[t]._endAngle_}return e}function getGaugeDataPoints(i,r,o){let n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:1;for(let a=0;a=o.oldData){e._proportion_=(e._endAngle_-e._oldAngle_)*n+o.oldAngle}else{e._proportion_=e._oldAngle_-(e._oldAngle_-e._endAngle_)*n}if(e._proportion_>=2){e._proportion_=e._proportion_%2}}return i}function getPieTextMaxLength(i,r,o,n){i=getPieDataPoints(i);let l=0;for(let a=0;a0){t.width=Math.min(t.width,+n.extra.mix.column.width*n.pix)}if(n.extra.column&&n.extra.column.width&&+n.extra.column.width>0){t.width=Math.min(t.width,+n.extra.column.width*n.pix)}if(t.width<=0){t.width=1}t.x+=(o+.5-r/2)*(t.width+e);return t})}function fixBarData(t,i,r,o,e,n){return t.map(function(t){if(t===null){return null}var e=0;var a=0;e=n.extra.bar.seriesGap*n.pix||0;a=n.extra.bar.categoryGap*n.pix||0;e=Math.min(e,i/r);a=Math.min(a,i/r);t.width=Math.ceil((i-2*a-e*(r-1))/r);if(n.extra.bar&&n.extra.bar.width&&+n.extra.bar.width>0){t.width=Math.min(t.width,+n.extra.bar.width*n.pix)}if(t.width<=0){t.width=1}t.y+=(o+.5-r/2)*(t.width+e);return t})}function fixColumeMeterData(t,e,a,i,r,o,n){var l=o.extra.column.categoryGap*o.pix||0;return t.map(function(t){if(t===null){return null}t.width=e-2*l;if(o.extra.column&&o.extra.column.width&&+o.extra.column.width>0){t.width=Math.min(t.width,+o.extra.column.width*o.pix)}if(i>0){t.width-=n}return t})}function fixColumeStackData(t,a,e,i,r,o,n){var l=o.extra.column.categoryGap*o.pix||0;return t.map(function(t,e){if(t===null){return null}t.width=Math.ceil(a-2*l);if(o.extra.column&&o.extra.column.width&&+o.extra.column.width>0){t.width=Math.min(t.width,+o.extra.column.width*o.pix)}if(t.width<=0){t.width=1}return t})}function fixBarStackData(t,a,e,i,r,o,n){var l=o.extra.bar.categoryGap*o.pix||0;return t.map(function(t,e){if(t===null){return null}t.width=Math.ceil(a-2*l);if(o.extra.bar&&o.extra.bar.width&&+o.extra.bar.width>0){t.width=Math.min(t.width,+o.extra.bar.width*o.pix)}if(t.width<=0){t.width=1}return t})}function getXAxisPoints(t,e,h){var a=e.width-e.area[1]-e.area[3];var i=e.enableScroll?Math.min(e.xAxis.itemCount,t.length):t.length;if((e.type=="line"||e.type=="area"||e.type=="scatter"||e.type=="bubble"||e.type=="bar")&&i>1&&e.xAxis.boundaryGap=="justify"){i-=1}var r=0;if(e.type=="mount"&&e.extra&&e.extra.mount&&e.extra.mount.widthRatio&&e.extra.mount.widthRatio>1){if(e.extra.mount.widthRatio>2)e.extra.mount.widthRatio=2;r=e.extra.mount.widthRatio-1;i+=r}var o=a/i;var n=[];var l=e.area[3];var s=e.width-e.area[1];t.forEach(function(t,e){n.push(l+r/2*o+e*o)});if(e.xAxis.boundaryGap!=="justify"){if(e.enableScroll===true){n.push(l+r*o+t.length*o)}else{n.push(s)}}return{xAxisPoints:n,startX:l,endX:s,eachSpacing:o}}function getCandleDataPoints(t,l,s,h,c,d,a){var x=arguments.length>7&&arguments[7]!==undefined?arguments[7]:1;var e=[];var f=d.height-d.area[0]-d.area[2];t.forEach(function(t,o){if(t===null){e.push(null)}else{var n=[];t.forEach(function(t,e){var a={};a.x=h[o]+Math.round(c/2);var i=t.value||t;var r=f*(i-l)/(s-l);r*=x;a.y=d.height-Math.round(r)-d.area[2];n.push(a)});e.push(n)}});return e}function getDataPoints(t,a,n,l,s,h,e){var c=arguments.length>7&&arguments[7]!==undefined?arguments[7]:1;var d="center";if(h.type=="line"||h.type=="area"||h.type=="scatter"||h.type=="bubble"){d=h.xAxis.boundaryGap}var x=[];var f=h.height-h.area[0]-h.area[2];var p=h.width-h.area[1]-h.area[3];t.forEach(function(i,t){if(i===null){x.push(null)}else{var r={};r.color=i.color;r.x=l[t];var o=i;if(typeof i==="object"&&i!==null){if(i.constructor.toString().indexOf("Array")>-1){let t,e,a;t=[].concat(h.chartData.xAxisData.ranges);e=t.shift();a=t.pop();o=i[1];r.x=h.area[3]+p*(i[0]-e)/(a-e);if(h.type=="bubble"){r.r=i[2];r.t=i[3]}}else{o=i.value}}if(d=="center"){r.x+=s/2}var e=f*(o-a)/(n-a);e*=c;r.y=h.height-e-h.area[2];x.push(r)}});return x}function getMountDataPoints(t,o,n,l,s,h,e){var c=arguments.length>7&&arguments[7]!==undefined?arguments[7]:1;var d=[];var x=h.height-h.area[0]-h.area[2];var a=h.width-h.area[1]-h.area[3];var f=s*e.widthRatio;t.forEach(function(t,e){if(t===null){d.push(null)}else{var a={};a.color=t.color;a.x=l[e];a.x+=s/2;var i=t.data;var r=x*(i-o)/(n-o);r*=c;a.y=h.height-r-h.area[2];a.value=i;a.width=f;d.push(a)}});return d}function getBarDataPoints(t,o,n,l,e,s,a){var h=arguments.length>7&&arguments[7]!==undefined?arguments[7]:1;var c=[];var i=s.height-s.area[0]-s.area[2];var d=s.width-s.area[1]-s.area[3];t.forEach(function(t,e){if(t===null){c.push(null)}else{var a={};a.color=t.color;a.y=l[e];var i=t;if(typeof t==="object"&&t!==null){i=t.value}var r=d*(i-o)/(n-o);r*=h;a.height=r;a.value=i;a.x=r+s.area[3];c.push(a)}});return c}function getStackDataPoints(t,s,h,c,u,d,e,x,y){var f=arguments.length>9&&arguments[9]!==undefined?arguments[9]:1;var p=[];var g=d.height-d.area[0]-d.area[2];t.forEach(function(t,e){if(t===null){p.push(null)}else{var a={};a.color=t.color;a.x=c[e]+Math.round(u/2);if(x>0){var i=0;for(let t=0;t<=x;t++){i+=y[t].data[e]}var r=i-t;var o=g*(i-s)/(h-s);var n=g*(r-s)/(h-s)}else{var i=t;var o=g*(i-s)/(h-s);var n=0}var l=n;o*=f;l*=f;a.y=d.height-Math.round(o)-d.area[2];a.y0=d.height-Math.round(l)-d.area[2];p.push(a)}});return p}function getBarStackDataPoints(t,s,h,c,e,d,a,x,u){var f=arguments.length>9&&arguments[9]!==undefined?arguments[9]:1;var p=[];var g=d.width-d.area[1]-d.area[3];t.forEach(function(t,e){if(t===null){p.push(null)}else{var a={};a.color=t.color;a.y=c[e];if(x>0){var i=0;for(let t=0;t<=x;t++){i+=u[t].data[e]}var r=i-t;var o=g*(i-s)/(h-s);var n=g*(r-s)/(h-s)}else{var i=t;var o=g*(i-s)/(h-s);var n=0}var l=n;o*=f;l*=f;a.height=o-l;a.x=d.area[3]+o;a.x0=d.area[3]+l;p.push(a)}});return p}function getYAxisTextList(t,e,h,c,a){var d=arguments.length>5&&arguments[5]!==undefined?arguments[5]:-1;var i;if(c=="stack"){i=dataCombineStack(t,e.categories.length)}else{i=dataCombine(t)}var r=[];i=i.filter(function(t){if(typeof t==="object"&&t!==null){if(t.constructor.toString().indexOf("Array")>-1){return t!==null}else{return t.value!==null}}else{return t!==null}});i.map(function(t){if(typeof t==="object"){if(t.constructor.toString().indexOf("Array")>-1){if(e.type=="candle"){t.map(function(t){r.push(t)})}else{r.push(t[1])}}else{r.push(t.value)}}else{r.push(t)}});var o=a.min||0;var n=a.max||0;if(r.length>0){o=Math.min.apply(this,r);n=Math.max.apply(this,r)}if(o===n){if(n==0){n=10}else{o=0}}var l=getDataRange(o,n);var x=a.min===undefined||a.min===null?l.minRange:a.min;var f=a.max===undefined||a.max===null?l.maxRange:a.max;var p=[];var g=(f-x)/e.yAxis.splitNumber;for(var s=0;s<=e.yAxis.splitNumber;s++){p.push(x+g*s)}return p.reverse()}function calYAxisData(a,o,e,n){var l=assign({},{type:""},o.extra.column);var t=o.yAxis.data.length;var s=new Array(t);if(t>0){for(let e=0;e{return t+(i.unit||"")}}i.categories=i.categories||o.categories;h[r]=i.categories}else{if(!i.formatter){i.formatter=(t,e,a)=>{return t.toFixed(i.tofix)+(i.unit||"")}}h[r]=getYAxisTextList(s[r],o,e,l.type,i,r)}let a=i.fontSize*o.pix||e.fontSize;d[r]={position:i.position?i.position:"left",width:0};c[r]=h[r].map(function(t,e){t=i.formatter(t,e,o);d[r].width=Math.max(d[r].width,measureText(t,a,n)+5);return t});let t=i.calibration?4*o.pix:0;d[r].width+=t+3*o.pix;if(i.disabled===true){d[r].width=0}}}else{var h=new Array(1);var c=new Array(1);var d=new Array(1);if(o.type==="bar"){h[0]=o.categories;if(!o.yAxis.formatter){o.yAxis.formatter=(t,e,a)=>{return t+(a.yAxis.unit||"")}}}else{if(!o.yAxis.formatter){o.yAxis.formatter=(t,e,a)=>{return t.toFixed(a.yAxis.tofix)+(a.yAxis.unit||"")}}h[0]=getYAxisTextList(a,o,e,l.type,{})}d[0]={position:"left",width:0};var i=o.yAxis.fontSize*o.pix||e.fontSize;c[0]=h[0].map(function(t,e){t=o.yAxis.formatter(t,e,o);d[0].width=Math.max(d[0].width,measureText(t,i,n)+5);return t});d[0].width+=3*o.pix;if(o.yAxis.disabled===true){d[0]={position:"left",width:0};o.yAxis.data[0]={disabled:true}}else{o.yAxis.data[0]={disabled:false,position:"left",max:o.yAxis.max,min:o.yAxis.min,formatter:o.yAxis.formatter};if(o.type==="bar"){o.yAxis.data[0].categories=o.categories;o.yAxis.data[0].type="categories"}}}return{rangesFormat:c,ranges:h,yAxisWidth:d}}function calTooltipYAxisData(r,t,o,e,a){let n=[].concat(o.chartData.yAxisData.ranges);let l=o.height-o.area[0]-o.area[2];let s=o.area[0];let h=[];for(let i=0;i-1){i=h[e][1]}else{i=h[e].value}}var r=o.formatter?o.formatter(i,e,o,s):i;l.setTextAlign("center");l.fillText(String(r),t.x,t.y-4+c*s.pix);l.closePath();l.stroke();l.setTextAlign("left")}})}function drawMountPointText(t,o,n,l,s){var e=o.data;var h=o.textOffset?o.textOffset:0;t.forEach(function(t,e){if(t!==null){l.beginPath();var a=o[e].textSize?o[e].textSize*s.pix:n.fontSize;l.setFontSize(a);l.setFillStyle(o[e].textColor||s.fontColor);var i=t.value;var r=o[e].formatter?o[e].formatter(i,e,o,s):i;l.setTextAlign("center");l.fillText(String(r),t.x,t.y-4+h*s.pix);l.closePath();l.stroke();l.setTextAlign("left")}})}function drawBarPointText(t,o,n,l,s){var h=o.data;var e=o.textOffset?o.textOffset:0;t.forEach(function(t,e){if(t!==null){l.beginPath();var a=o.textSize?o.textSize*s.pix:n.fontSize;l.setFontSize(a);l.setFillStyle(o.textColor||s.fontColor);var i=h[e];if(typeof h[e]==="object"&&h[e]!==null){i=h[e].value}var r=o.formatter?o.formatter(i,e,o,s):i;l.setTextAlign("left");l.fillText(String(r),t.x+4*s.pix,t.y+a/2-3);l.closePath();l.stroke()}})}function drawGaugeLabel(e,a,i,r,o,n){a-=e.width/2+e.labelOffset*r.pix;a=a<10?10:a;let t=e.startAngle-e.endAngle+1;let d=t/e.splitLine.splitNumber;let x=e.endNumber-e.startNumber;let f=x/e.splitLine.splitNumber;let l=e.startAngle;let s=e.startNumber;for(let t=0;t=2){l=l%2}s+=f}}function drawRadarLabel(t,s,h,c,d,x){var f=c.extra.radar||{};t.forEach(function(t,e){if(f.labelPointShow===true&&c.categories[e]!==""){var a={x:s*Math.cos(t),y:s*Math.sin(t)};var i=convertCoordinateOrigin(a.x,a.y,h);x.setFillStyle(f.labelPointColor);x.beginPath();x.arc(i.x,i.y,f.labelPointRadius*c.pix,0,2*Math.PI,false);x.closePath();x.fill()}var r={x:(s+d.radarLabelTextMargin*c.pix)*Math.cos(t),y:(s+d.radarLabelTextMargin*c.pix)*Math.sin(t)};var o=convertCoordinateOrigin(r.x,r.y,h);var n=o.x;var l=o.y;if(util.approximatelyEqual(r.x,0)){n-=measureText(c.categories[e]||"",d.fontSize,x)/2}else if(r.x<0){n-=measureText(c.categories[e]||"",d.fontSize,x)}x.beginPath();x.setFontSize(d.fontSize);x.setFillStyle(f.labelColor||c.fontColor);x.fillText(c.categories[e]||"",n,l+d.fontSize/2);x.closePath();x.stroke()})}function drawPieText(n,d,x,f,t,l){var p=x.pieChartLinePadding;var g=[];var u=null;var y=n.map(function(t,e){var a=t.formatter?t.formatter(t,e,n,d):util.toFixed(t._proportion_.toFixed(4)*100)+"%";a=t.labelText?t.labelText:a;var i=2*Math.PI-(t._start_+2*Math.PI*t._proportion_/2);if(t._rose_proportion_){i=2*Math.PI-(t._start_+2*Math.PI*t._rose_proportion_/2)}var r=t.color;var o=t._radius_;return{arc:i,text:a,color:r,radius:o,textColor:t.textColor,textSize:t.textSize,labelShow:t.labelShow}});for(let c=0;c=0?e+x.pieChartTextPadding:e-x.pieChartTextPadding;let n=a;let l=measureText(t.text,t.textSize*d.pix||x.fontSize,f);let s=n;if(u&&util.isSameXCoordinateArea(u.start,{x:o})){if(o>0){s=Math.min(n,u.start.y)}else if(e<0){s=Math.max(n,u.start.y)}else{if(n>0){s=Math.max(n,u.start.y)}else{s=Math.min(n,u.start.y)}}}if(o<0){o-=l}let h={lineStart:{x:i,y:r},lineEnd:{x:e,y:a},start:{x:o,y:s},width:l,height:x.fontSize,text:t.text,color:t.color,textColor:t.textColor,textSize:t.textSize};u=avoidCollision(h,u);g.push(u)}for(let n=0;nr?r:o.activeWidth;var n=e.area[0];var l=e.height-e.area[2];i.beginPath();i.setFillStyle(hexToRgb(o.activeBgColor,o.activeBgOpacity));i.rect(t-o.activeWidth/2,n,o.activeWidth,l-n);i.closePath();i.fill();i.setFillStyle("#FFFFFF")}function drawBarToolTipSplitArea(t,e,a,i,r){var o=assign({},{activeBgColor:"#000000",activeBgOpacity:.08},e.extra.bar);var n=e.area[3];var l=e.width-e.area[1];i.beginPath();i.setFillStyle(hexToRgb(o.activeBgColor,o.activeBgOpacity));i.rect(n,t-r/2,l-n,r);i.closePath();i.fill();i.setFillStyle("#FFFFFF")}function drawToolTip(t,r,e,o,n,c,d){var l=assign({},{showBox:true,showArrow:true,showCategory:false,bgColor:"#000000",bgOpacity:.7,borderColor:"#000000",borderWidth:0,borderRadius:0,borderOpacity:.7,fontColor:"#FFFFFF",splitLine:true},e.extra.tooltip);if(l.showCategory==true&&e.categories){t.unshift({text:e.categories[e.tooltip.index],color:null})}var x=4*e.pix;var f=5*e.pix;var s=l.showArrow?8*e.pix:0;var p=false;if(e.type=="line"||e.type=="mount"||e.type=="area"||e.type=="candle"||e.type=="mix"){if(l.splitLine==true){drawToolTipSplitLine(e.tooltip.offset.x,e,o,n)}}r=assign({x:0,y:0},r);r.y-=8*e.pix;var g=t.map(function(t){return measureText(t.text,o.fontSize,n)});var h=x+f+4*o.toolTipPadding+Math.max.apply(null,g);var a=2*o.toolTipPadding+t.length*o.toolTipLineHeight;if(l.showBox==false){return}if(r.x-Math.abs(e._scrollDistance_||0)+s+h>e.width){p=true}if(a+r.y>e.height){r.y=e.height-a}n.beginPath();n.setFillStyle(hexToRgb(l.bgColor||o.toolTipBackground,l.bgOpacity||o.toolTipOpacity));n.setLineWidth(l.borderWidth*e.pix);n.setStrokeStyle(hexToRgb(l.borderColor,l.borderOpacity));var i=l.borderRadius;if(p){if(l.showArrow){n.moveTo(r.x,r.y+10*e.pix);n.lineTo(r.x-s,r.y+10*e.pix+5*e.pix)}n.arc(r.x-s-i,r.y+a-i,i,0,Math.PI/2,false);n.arc(r.x-s-Math.round(h)+i,r.y+a-i,i,Math.PI/2,Math.PI,false);n.arc(r.x-s-Math.round(h)+i,r.y+i,i,-Math.PI,-Math.PI/2,false);n.arc(r.x-s-i,r.y+i,i,-Math.PI/2,0,false);if(l.showArrow){n.lineTo(r.x-s,r.y+10*e.pix-5*e.pix);n.lineTo(r.x,r.y+10*e.pix)}}else{if(l.showArrow){n.moveTo(r.x,r.y+10*e.pix);n.lineTo(r.x+s,r.y+10*e.pix-5*e.pix)}n.arc(r.x+s+i,r.y+i,i,-Math.PI,-Math.PI/2,false);n.arc(r.x+s+Math.round(h)-i,r.y+i,i,-Math.PI/2,0,false);n.arc(r.x+s+Math.round(h)-i,r.y+a-i,i,0,Math.PI/2,false);n.arc(r.x+s+i,r.y+a-i,i,Math.PI/2,Math.PI,false);if(l.showArrow){n.lineTo(r.x+s,r.y+10*e.pix+5*e.pix);n.lineTo(r.x,r.y+10*e.pix)}}n.closePath();n.fill();if(l.borderWidth>0){n.stroke()}t.forEach(function(t,e){if(t.color!==null){n.beginPath();n.setFillStyle(t.color);var a=r.x+s+2*o.toolTipPadding;var i=r.y+(o.toolTipLineHeight-o.fontSize)/2+o.toolTipLineHeight*e+o.toolTipPadding+1;if(p){a=r.x-h-s+2*o.toolTipPadding}n.fillRect(a,i,x,o.fontSize);n.closePath()}});t.forEach(function(t,e){var a=r.x+s+2*o.toolTipPadding+x+f;if(p){a=r.x-h-s+2*o.toolTipPadding+ +x+f}var i=r.y+(o.toolTipLineHeight-o.fontSize)/2+o.toolTipLineHeight*e+o.toolTipPadding;n.beginPath();n.setFontSize(o.fontSize);n.setFillStyle(l.fontColor);n.fillText(t.text,a,i+o.fontSize);n.closePath();n.stroke()})}function drawColumnDataPoints(y,v,m,T){let b=arguments.length>4&&arguments[4]!==undefined?arguments[4]:1;let t=v.chartData.xAxisData,P=t.xAxisPoints,w=t.eachSpacing;let S=assign({},{type:"group",width:w/2,meterBorder:4,meterFillColor:"#FFFFFF",barBorderCircle:false,barBorderRadius:[],seriesGap:2,linearType:"none",linearOpacity:1,customColor:[],colorStop:0},v.extra.column);let A=[];T.save();let C=-2;let D=P.length+2;if(v._scrollDistance_&&v._scrollDistance_!==0&&v.enableScroll===true){T.translate(v._scrollDistance_,0);C=Math.floor(-v._scrollDistance_/w)-2;D=C+v.xAxis.itemCount+4}if(v.tooltip&&v.tooltip.textList&&v.tooltip.textList.length&&b===1){drawToolTipSplitArea(v.tooltip.offset.x,v,m,T,w)}S.customColor=fillCustomColor(S.linearType,S.customColor,y,m);y.forEach(function(a,i){let t,o,x;t=[].concat(v.chartData.yAxisData.ranges[a.index]);o=t.pop();x=t.shift();var f=a.data;switch(S.type){case"group":var r=getDataPoints(f,o,x,P,w,v,m,b);var p=getStackDataPoints(f,o,x,P,w,v,m,i,y,b);A.push(p);r=fixColumeData(r,w,y.length,i,m,v);for(let t=0;tC&&tr?r:t;e=e>r?r:e;a=a>r?r:a;i=i>r?r:i;t=t<0?0:t;e=e<0?0:e;a=a<0?0:a;i=i<0?0:i;T.arc(h+t,c+t,t,-Math.PI,-Math.PI/2);T.arc(h+d-e,c+e,e,-Math.PI/2,0);T.arc(h+d-a,c+l-a,a,0,Math.PI/2);T.arc(h+i,c+l-i,i,Math.PI/2,Math.PI)}else{T.moveTo(n,o.y);T.lineTo(n+o.width,o.y);T.lineTo(n+o.width,v.height-v.area[2]);T.lineTo(n,v.height-v.area[2]);T.lineTo(n,o.y);T.setLineWidth(1);T.setStrokeStyle(g)}T.setFillStyle(s);T.closePath();T.fill()}};break;case"stack":var r=getStackDataPoints(f,o,x,P,w,v,m,i,y,b);A.push(r);r=fixColumeStackData(r,w,y.length,i,m,v,y);for(let e=0;eC&&e0){l-=u}T.setFillStyle(s);T.moveTo(n,t.y);T.fillRect(n,t.y,t.width,l);T.closePath();T.fill()}};break;case"meter":var r=getDataPoints(f,o,x,P,w,v,m,b);A.push(r);r=fixColumeMeterData(r,w,y.length,i,m,v,S.meterBorder);for(let t=0;tC&&t0){T.setStrokeStyle(a.color);T.setLineWidth(S.meterBorder*v.pix)}if(i==0){T.setFillStyle(S.meterFillColor)}else{T.setFillStyle(o.color||a.color)}var n=o.x-o.width/2;var l=v.height-o.y-v.area[2];if(S.barBorderRadius&&S.barBorderRadius.length===4||S.barBorderCircle===true){const h=n;const c=o.y;const d=o.width;const l=v.height-v.area[2]-o.y;if(S.barBorderCircle){S.barBorderRadius=[d/2,d/2,0,0]}let[t,e,a,i]=S.barBorderRadius;let r=Math.min(d/2,l/2);t=t>r?r:t;e=e>r?r:e;a=a>r?r:a;i=i>r?r:i;t=t<0?0:t;e=e<0?0:e;a=a<0?0:a;i=i<0?0:i;T.arc(h+t,c+t,t,-Math.PI,-Math.PI/2);T.arc(h+d-e,c+e,e,-Math.PI/2,0);T.arc(h+d-a,c+l-a,a,0,Math.PI/2);T.arc(h+i,c+l-i,i,Math.PI/2,Math.PI);T.fill()}else{T.moveTo(n,o.y);T.lineTo(n+o.width,o.y);T.lineTo(n+o.width,v.height-v.area[2]);T.lineTo(n,v.height-v.area[2]);T.lineTo(n,o.y);T.fill()}if(i==0&&S.meterBorder>0){T.closePath();T.stroke()}}}break}});if(v.dataLabel!==false&&b===1){y.forEach(function(t,e){let a,i,r;a=[].concat(v.chartData.yAxisData.ranges[t.index]);i=a.pop();r=a.shift();var o=t.data;switch(S.type){case"group":var n=getDataPoints(o,i,r,P,w,v,m,b);n=fixColumeData(n,w,y.length,e,m,v);drawPointText(n,t,m,T,v);break;case"stack":var n=getStackDataPoints(o,i,r,P,w,v,m,e,y,b);drawPointText(n,t,m,T,v);break;case"meter":var n=getDataPoints(o,i,r,P,w,v,m,b);drawPointText(n,t,m,T,v);break}})}T.restore();return{xAxisPoints:P,calPoints:A,eachSpacing:w}}function drawMountDataPoints(i,n,o,l){let f=arguments.length>4&&arguments[4]!==undefined?arguments[4]:1;let t=n.chartData.xAxisData,p=t.xAxisPoints,r=t.eachSpacing;let s=assign({},{type:"mount",widthRatio:1,borderWidth:1,barBorderCircle:false,barBorderRadius:[],linearType:"none",linearOpacity:1,customColor:[],colorStop:0},n.extra.mount);s.widthRatio=s.widthRatio<=0?0:s.widthRatio;s.widthRatio=s.widthRatio>=2?2:s.widthRatio;let e=[];l.save();let a=-2;let g=p.length+2;if(n._scrollDistance_&&n._scrollDistance_!==0&&n.enableScroll===true){l.translate(n._scrollDistance_,0);a=Math.floor(-n._scrollDistance_/r)-2;g=a+n.xAxis.itemCount+4}s.customColor=fillCustomColor(s.linearType,s.customColor,i,o);let u,y,v;u=[].concat(n.chartData.yAxisData.ranges[0]);y=u.pop();v=u.shift();var h=getMountDataPoints(i,y,v,p,r,n,s,f);switch(s.type){case"bar":for(let t=0;ta&&tr?r:t;e=e>r?r:e;a=a>r?r:a;i=i>r?r:i;t=t<0?0:t;e=e<0?0:e;a=a<0?0:a;i=i<0?0:i;l.arc(b+t,P+t,t,-Math.PI,-Math.PI/2);l.arc(b+w-e,P+e,e,-Math.PI/2,0);l.arc(b+w-a,P+m-a,a,0,Math.PI/2);l.arc(b+i,P+m-i,i,Math.PI/2,Math.PI)}else{l.moveTo(c,o.y);l.lineTo(c+o.width,o.y);l.lineTo(c+o.width,n.height-n.area[2]);l.lineTo(c,n.height-n.area[2]);l.lineTo(c,o.y)}l.setStrokeStyle(T);l.setFillStyle(d);if(s.borderWidth>0){l.setLineWidth(s.borderWidth*n.pix);l.closePath();l.stroke()}l.fill()}};break;case"triangle":for(let e=0;ea&&e0){l.setLineWidth(s.borderWidth*n.pix);l.stroke()}l.fill()}};break;case"mount":for(let e=0;ea&&e0){l.setLineWidth(s.borderWidth*n.pix);l.stroke()}l.fill()}};break;case"sharp":for(let e=0;ea&&e0){l.setLineWidth(s.borderWidth*n.pix);l.stroke()}l.fill()}};break}if(n.dataLabel!==false&&f===1){let t,e,a;t=[].concat(n.chartData.yAxisData.ranges[0]);e=t.pop();a=t.shift();var h=getMountDataPoints(i,e,a,p,r,n,s,f);drawMountPointText(h,i,o,l,n)}l.restore();return{xAxisPoints:p,calPoints:h,eachSpacing:r}}function drawBarDataPoints(y,v,m,T){let b=arguments.length>4&&arguments[4]!==undefined?arguments[4]:1;let P=[];let w=(v.height-v.area[0]-v.area[2])/v.categories.length;for(let t=0;tC&&tr?r:t;e=e>r?r:e;a=a>r?r:a;i=i>r?r:i;t=t<0?0:t;e=e<0?0:e;a=a<0?0:a;i=i<0?0:i;T.arc(u+i,c+i,i,-Math.PI,-Math.PI/2);T.arc(o.x-t,c+t,t,-Math.PI/2,0);T.arc(o.x-e,c+h-e,e,0,Math.PI/2);T.arc(u+a,c+h-a,a,Math.PI/2,Math.PI)}else{T.moveTo(n,r);T.lineTo(o.x,r);T.lineTo(o.x,r+o.width);T.lineTo(n,r+o.width);T.lineTo(n,r);T.setLineWidth(1);T.setStrokeStyle(g)}T.setFillStyle(l);T.closePath();T.fill()}};break;case"stack":var i=getBarStackDataPoints(x,e,d,P,w,v,m,t,y,b);A.push(i);i=fixBarStackData(i,w,y.length,t,m,v,y);for(let e=0;eC&&e5&&arguments[5]!==undefined?arguments[5]:1;var s=assign({},{color:{},average:{}},h.extra.candle);s.color=assign({},{upLine:"#f04864",upFill:"#f04864",downLine:"#2fc25b",downFill:"#2fc25b"},s.color);s.average=assign({},{show:false,name:[],day:[],color:c.color},s.average);h.extra.candle=s;let a=h.chartData.xAxisData,x=a.xAxisPoints,f=a.eachSpacing;let y=[];d.save();let p=-2;let v=x.length+2;let g=0;let m=h.width+f;if(h._scrollDistance_&&h._scrollDistance_!==0&&h.enableScroll===true){d.translate(h._scrollDistance_,0);p=Math.floor(-h._scrollDistance_/f)-2;v=p+h.xAxis.itemCount+4;g=-h._scrollDistance_-f*2+h.area[3];m=g+(h.xAxis.itemCount+4)*f}if(s.average.show||t){t.forEach(function(e,t){let a,i,r;a=[].concat(h.chartData.yAxisData.ranges[e.index]);i=a.pop();r=a.shift();var o=e.data;var n=getDataPoints(o,i,r,x,f,h,c,u);var l=splitPoints(n,e);for(let t=0;tg){d.moveTo(t.x,t.y);a=1}if(e>0&&t.x>g&&t.xp&&e0){d.setStrokeStyle(s.color.upLine);d.setFillStyle(s.color.upFill);d.setLineWidth(1*h.pix);d.moveTo(t[3].x,t[3].y);d.lineTo(t[1].x,t[1].y);d.lineTo(t[1].x-f/4,t[1].y);d.lineTo(t[0].x-f/4,t[0].y);d.lineTo(t[0].x,t[0].y);d.lineTo(t[2].x,t[2].y);d.lineTo(t[0].x,t[0].y);d.lineTo(t[0].x+f/4,t[0].y);d.lineTo(t[1].x+f/4,t[1].y);d.lineTo(t[1].x,t[1].y);d.moveTo(t[3].x,t[3].y)}else{d.setStrokeStyle(s.color.downLine);d.setFillStyle(s.color.downFill);d.setLineWidth(1*h.pix);d.moveTo(t[3].x,t[3].y);d.lineTo(t[0].x,t[0].y);d.lineTo(t[0].x-f/4,t[0].y);d.lineTo(t[1].x-f/4,t[1].y);d.lineTo(t[1].x,t[1].y);d.lineTo(t[2].x,t[2].y);d.lineTo(t[1].x,t[1].y);d.lineTo(t[1].x+f/4,t[1].y);d.lineTo(t[0].x+f/4,t[0].y);d.lineTo(t[0].x,t[0].y);d.moveTo(t[3].x,t[3].y)}d.closePath();d.fill();d.stroke()}}});d.restore();return{xAxisPoints:x,calPoints:y,eachSpacing:f}}function drawAreaDataPoints(t,s,h,c){var d=arguments.length>4&&arguments[4]!==undefined?arguments[4]:1;var x=assign({},{type:"straight",opacity:.2,addLine:false,width:2,gradient:false},s.extra.area);let e=s.chartData.xAxisData,y=e.xAxisPoints,f=e.eachSpacing;let p=s.height-s.area[2];let v=[];c.save();let g=0;let u=s.width+f;if(s._scrollDistance_&&s._scrollDistance_!==0&&s.enableScroll===true){c.translate(s._scrollDistance_,0);g=-s._scrollDistance_-f*2+s.area[3];u=g+(s.xAxis.itemCount+4)*f}t.forEach(function(e,t){let a,i,r;a=[].concat(s.chartData.yAxisData.ranges[e.index]);i=a.pop();r=a.shift();let o=e.data;let n=getDataPoints(o,i,r,y,f,s,h,d);v.push(n);let l=splitPoints(n,e);for(let t=0;t1){let t=r[0];let e=r[r.length-1];c.moveTo(t.x,t.y);let i=0;if(x.type==="curve"){for(let a=0;ag){c.moveTo(e.x,e.y);i=1}if(a>0&&e.x>g&&e.xg){c.moveTo(t.x,t.y);i=1}if(e>0&&t.x>g&&t.xg){c.moveTo(t.x,t.y);i=1}if(e>0&&t.x>g&&t.xg){c.moveTo(e.x,e.y);i=1}if(a>0&&e.x>g&&e.xg){c.moveTo(t.x,t.y);i=1}if(e>0&&t.x>g&&t.xg){c.moveTo(t.x,t.y);i=1}if(e>0&&t.x>g&&t.x4&&arguments[4]!==undefined?arguments[4]:1;var i=assign({},{type:"circle"},s.extra.scatter);let e=s.chartData.xAxisData,x=e.xAxisPoints,f=e.eachSpacing;var r=[];c.save();let a=0;let o=s.width+f;if(s._scrollDistance_&&s._scrollDistance_!==0&&s.enableScroll===true){c.translate(s._scrollDistance_,0);a=-s._scrollDistance_-f*2+s.area[3];o=a+(s.xAxis.itemCount+4)*f}t.forEach(function(t,e){let a,i,r;a=[].concat(s.chartData.yAxisData.ranges[t.index]);i=a.pop();r=a.shift();var o=t.data;var n=getDataPoints(o,i,r,x,f,s,h,d);c.beginPath();c.setStrokeStyle(t.color);c.setFillStyle(t.color);c.setLineWidth(1*s.pix);var l=t.pointShape;if(l==="diamond"){n.forEach(function(t,e){if(t!==null){c.moveTo(t.x,t.y-4.5);c.lineTo(t.x-4.5,t.y);c.lineTo(t.x,t.y+4.5);c.lineTo(t.x+4.5,t.y);c.lineTo(t.x,t.y-4.5)}})}else if(l==="circle"){n.forEach(function(t,e){if(t!==null){c.moveTo(t.x+2.5*s.pix,t.y);c.arc(t.x,t.y,3*s.pix,0,2*Math.PI,false)}})}else if(l==="square"){n.forEach(function(t,e){if(t!==null){c.moveTo(t.x-3.5,t.y-3.5);c.rect(t.x-3.5,t.y-3.5,7,7)}})}else if(l==="triangle"){n.forEach(function(t,e){if(t!==null){c.moveTo(t.x,t.y-4.5);c.lineTo(t.x-4.5,t.y+4.5);c.lineTo(t.x+4.5,t.y+4.5);c.lineTo(t.x,t.y-4.5)}})}else if(l==="triangle"){return}c.closePath();c.fill();c.stroke()});if(s.dataLabel!==false&&d===1){t.forEach(function(t,e){let a,i,r;a=[].concat(s.chartData.yAxisData.ranges[t.index]);i=a.pop();r=a.shift();var o=t.data;var n=getDataPoints(o,i,r,x,f,s,h,d);drawPointText(n,t,h,c,s)})}c.restore();return{xAxisPoints:x,calPoints:r,eachSpacing:f}}function drawBubbleDataPoints(l,s,h,c){var d=arguments.length>4&&arguments[4]!==undefined?arguments[4]:1;var x=assign({},{opacity:1,border:2},s.extra.bubble);let t=s.chartData.xAxisData,f=t.xAxisPoints,p=t.eachSpacing;var e=[];c.save();let a=0;let i=s.width+p;if(s._scrollDistance_&&s._scrollDistance_!==0&&s.enableScroll===true){c.translate(s._scrollDistance_,0);a=-s._scrollDistance_-p*2+s.area[3];i=a+(s.xAxis.itemCount+4)*p}l.forEach(function(t,e){let a,i,r;a=[].concat(s.chartData.yAxisData.ranges[t.index]);i=a.pop();r=a.shift();var o=t.data;var n=getDataPoints(o,i,r,f,p,s,h,d);c.beginPath();c.setStrokeStyle(t.color);c.setLineWidth(x.border*s.pix);c.setFillStyle(hexToRgb(t.color,x.opacity));n.forEach(function(t,e){c.moveTo(t.x+t.r,t.y);c.arc(t.x,t.y,t.r*s.pix,0,2*Math.PI,false)});c.closePath();c.fill();c.stroke();if(s.dataLabel!==false&&d===1){n.forEach(function(t,e){c.beginPath();var a=l.textSize*s.pix||h.fontSize;c.setFontSize(a);c.setFillStyle(l.textColor||"#FFFFFF");c.setTextAlign("center");c.fillText(String(t.t),t.x,t.y+a/2);c.closePath();c.stroke();c.setTextAlign("left")})}});c.restore();return{xAxisPoints:f,calPoints:e,eachSpacing:p}}function drawLineDataPoints(t,s,h,c){var d=arguments.length>4&&arguments[4]!==undefined?arguments[4]:1;var x=assign({},{type:"straight",width:2},s.extra.line);x.width*=s.pix;let e=s.chartData.xAxisData,f=e.xAxisPoints,p=e.eachSpacing;var y=[];c.save();let g=0;let u=s.width+p;if(s._scrollDistance_&&s._scrollDistance_!==0&&s.enableScroll===true){c.translate(s._scrollDistance_,0);g=-s._scrollDistance_-p*2+s.area[3];u=g+(s.xAxis.itemCount+4)*p}t.forEach(function(e,t){let a,i,r;a=[].concat(s.chartData.yAxisData.ranges[e.index]);i=a.pop();r=a.shift();var o=e.data;var n=getDataPoints(o,i,r,f,p,s,h,d);y.push(n);var l=splitPoints(n,e);if(e.lineType=="dash"){let t=e.dashLength?e.dashLength:8;t*=s.pix;c.setLineDash([t,t])}c.beginPath();c.setStrokeStyle(e.color);c.setLineWidth(x.width);l.forEach(function(i,t){if(i.length===1){c.moveTo(i[0].x,i[0].y);c.arc(i[0].x,i[0].y,1,0,2*Math.PI)}else{c.moveTo(i[0].x,i[0].y);let a=0;if(x.type==="curve"){for(let e=0;eg){c.moveTo(t.x,t.y);a=1}if(e>0&&t.x>g&&t.xg){c.moveTo(t.x,t.y);a=1}if(e>0&&t.x>g&&t.xg){c.moveTo(t.x,t.y);a=1}if(e>0&&t.x>g&&t.x4&&arguments[4]!==undefined?arguments[4]:1;let e=v.chartData.xAxisData,b=e.xAxisPoints,P=e.eachSpacing;let w=assign({},{width:P/2,barBorderCircle:false,barBorderRadius:[],seriesGap:2,linearType:"none",linearOpacity:1,customColor:[],colorStop:0},v.extra.mix.column);let S=assign({},{opacity:.2,gradient:false},v.extra.mix.area);let M=v.height-v.area[2];let L=[];var _=0;var F=0;t.forEach(function(t,e){if(t.type=="column"){F+=1}});T.save();let k=-2;let R=b.length+2;let A=0;let C=v.width+P;if(v._scrollDistance_&&v._scrollDistance_!==0&&v.enableScroll===true){T.translate(v._scrollDistance_,0);k=Math.floor(-v._scrollDistance_/P)-2;R=k+v.xAxis.itemCount+4;A=-v._scrollDistance_-P*2+v.area[3];C=A+(v.xAxis.itemCount+4)*P}w.customColor=fillCustomColor(w.linearType,w.customColor,t,m);t.forEach(function(n,t){let o,x,f;o=[].concat(v.chartData.yAxisData.ranges[n.index]);x=o.pop();f=o.shift();var p=n.data;var a=getDataPoints(p,x,f,b,P,v,m,D);L.push(a);if(n.type=="column"){a=fixColumeData(a,P,F,_,m,v);for(let t=0;tk&&tr?r:t;e=e>r?r:e;a=a>r?r:a;i=i>r?r:i;t=t<0?0:t;e=e<0?0:e;a=a<0?0:a;i=i<0?0:i;T.arc(h+t,c+t,t,-Math.PI,-Math.PI/2);T.arc(h+d-e,c+e,e,-Math.PI/2,0);T.arc(h+d-a,c+s-a,a,0,Math.PI/2);T.arc(h+i,c+s-i,i,Math.PI/2,Math.PI)}else{T.moveTo(l,o.y);T.lineTo(l+o.width,o.y);T.lineTo(l+o.width,v.height-v.area[2]);T.lineTo(l,v.height-v.area[2]);T.lineTo(l,o.y);T.setLineWidth(1);T.setStrokeStyle(g)}T.setFillStyle(e);T.closePath();T.fill()}}_+=1}if(n.type=="area"){let e=splitPoints(a,n);for(let t=0;t1){var r=i[0];let t=i[i.length-1];T.moveTo(r.x,r.y);let a=0;if(n.style==="curve"){for(let e=0;eA){T.moveTo(t.x,t.y);a=1}if(e>0&&t.x>A&&t.xA){T.moveTo(t.x,t.y);a=1}if(e>0&&t.x>A&&t.xA){T.moveTo(t.x,t.y);a=1}if(e>0&&t.x>A&&t.xA){T.moveTo(t.x,t.y);a=1}if(e>0&&t.x>A&&t.x1){if(l.extra.mount.widthRatio>2)l.extra.mount.widthRatio=2;g+=(l.extra.mount.widthRatio-1)*d}var u=n*n/g;var y=0;if(l._scrollDistance_){y=-l._scrollDistance_*n/g}h.beginPath();h.setLineCap("round");h.setLineWidth(6*l.pix);h.setStrokeStyle(l.xAxis.scrollBackgroundColor||"#EFEBEF");h.moveTo(e,o);h.lineTo(a,o);h.stroke();h.closePath();h.beginPath();h.setLineCap("round");h.setLineWidth(6*l.pix);h.setStrokeStyle(l.xAxis.scrollColor||"#A6A6A6");h.moveTo(e+y,o);h.lineTo(e+y+u,o);h.stroke();h.closePath();h.setLineCap("butt")}h.save();if(l._scrollDistance_&&l._scrollDistance_!==0){h.translate(l._scrollDistance_,0)}if(l.xAxis.calibration===true){h.setStrokeStyle(l.xAxis.gridColor||"#cccccc");h.setLineCap("butt");h.setLineWidth(1*l.pix);c.forEach(function(t,e){if(e>0){h.beginPath();h.moveTo(t-d/2,x);h.lineTo(t-d/2,x+3*l.pix);h.closePath();h.stroke()}})}if(l.xAxis.disableGrid!==true){h.setStrokeStyle(l.xAxis.gridColor||"#cccccc");h.setLineCap("butt");h.setLineWidth(1*l.pix);if(l.xAxis.gridType=="dash"){h.setLineDash([l.xAxis.dashLength*l.pix,l.xAxis.dashLength*l.pix])}l.xAxis.gridEval=l.xAxis.gridEval||1;c.forEach(function(t,e){if(e%l.xAxis.gridEval==0){h.beginPath();h.moveTo(t,x);h.lineTo(t,i);h.stroke()}});h.setLineDash([])}if(l.xAxis.disabled!==true){let t=r.length;if(l.xAxis.labelCount){if(l.xAxis.itemCount){t=Math.ceil(r.length/l.xAxis.itemCount*l.xAxis.labelCount)}else{t=l.xAxis.labelCount}t-=1}let e=Math.ceil(r.length/t);let a=[];let i=r.length;for(let t=0;t1){if(e.extra.mount.widthRatio>2)e.extra.mount.widthRatio=2;l+=(e.extra.mount.widthRatio-1)*n}let x=r+l;let s=[];let h=1;if(e.xAxis.axisLine===false){h=0}for(let t=h;t4&&arguments[4]!==undefined?arguments[4]:1;var n=assign({},{activeOpacity:.5,activeRadius:10,offsetAngle:0,labelWidth:15,ringWidth:30,customRadius:0,border:false,borderWidth:2,borderColor:"#FFFFFF",centerColor:"#FFFFFF",linearType:"none",customColor:[]},r.type=="pie"?r.extra.pie:r.extra.ring);var l={x:r.area[3]+(r.width-r.area[1]-r.area[3])/2,y:r.area[0]+(r.height-r.area[0]-r.area[2])/2};if(e.pieChartLinePadding==0){e.pieChartLinePadding=n.activeRadius*r.pix}var i=Math.min((r.width-r.area[1]-r.area[3])/2-e.pieChartLinePadding-e.pieChartTextPadding-e._pieTextMaxLength_,(r.height-r.area[0]-r.area[2])/2-e.pieChartLinePadding-e.pieChartTextPadding);i=i<10?10:i;if(n.customRadius>0){i=n.customRadius*r.pix}t=getPieDataPoints(t,i,a);var h=n.activeRadius*r.pix;n.customColor=fillCustomColor(n.linearType,n.customColor,t,e);t=t.map(function(t){t._start_+=n.offsetAngle*Math.PI/180;return t});t.forEach(function(t,e){if(r.tooltip){if(r.tooltip.index==e){o.beginPath();o.setFillStyle(hexToRgb(t.color,n.activeOpacity||.5));o.moveTo(l.x,l.y);o.arc(l.x,l.y,t._radius_+h,t._start_,t._start_+2*t._proportion_*Math.PI);o.closePath();o.fill()}}o.beginPath();o.setLineWidth(n.borderWidth*r.pix);o.lineJoin="round";o.setStrokeStyle(n.borderColor);var a=t.color;if(n.linearType=="custom"){var i;if(o.createCircularGradient){i=o.createCircularGradient(l.x,l.y,t._radius_)}else{i=o.createRadialGradient(l.x,l.y,0,l.x,l.y,t._radius_)}i.addColorStop(0,hexToRgb(n.customColor[t.linearIndex],1));i.addColorStop(1,hexToRgb(t.color,1));a=i}o.setFillStyle(a);o.moveTo(l.x,l.y);o.arc(l.x,l.y,t._radius_,t._start_,t._start_+2*t._proportion_*Math.PI);o.closePath();o.fill();if(n.border==true){o.stroke()}});if(r.type==="ring"){var s=i*.6;if(typeof n.ringWidth==="number"&&n.ringWidth>0){s=Math.max(0,i-n.ringWidth*r.pix)}o.beginPath();o.setFillStyle(n.centerColor);o.moveTo(l.x,l.y);o.arc(l.x,l.y,s,0,2*Math.PI);o.closePath();o.fill()}if(r.dataLabel!==false&&a===1){drawPieText(t,r,e,o,i,l)}if(a===1&&r.type==="ring"){drawRingTitle(r,e,o,l)}return{center:l,radius:i,series:t}}function drawRoseDataPoints(t,r,e,o){var a=arguments.length>4&&arguments[4]!==undefined?arguments[4]:1;var n=assign({},{type:"area",activeOpacity:.5,activeRadius:10,offsetAngle:0,labelWidth:15,border:false,borderWidth:2,borderColor:"#FFFFFF",linearType:"none",customColor:[]},r.extra.rose);if(e.pieChartLinePadding==0){e.pieChartLinePadding=n.activeRadius*r.pix}var l={x:r.area[3]+(r.width-r.area[1]-r.area[3])/2,y:r.area[0]+(r.height-r.area[0]-r.area[2])/2};var i=Math.min((r.width-r.area[1]-r.area[3])/2-e.pieChartLinePadding-e.pieChartTextPadding-e._pieTextMaxLength_,(r.height-r.area[0]-r.area[2])/2-e.pieChartLinePadding-e.pieChartTextPadding);i=i<10?10:i;var s=n.minRadius||i*.5;t=getRoseDataPoints(t,n.type,s,i,a);var h=n.activeRadius*r.pix;n.customColor=fillCustomColor(n.linearType,n.customColor,t,e);t=t.map(function(t){t._start_+=(n.offsetAngle||0)*Math.PI/180;return t});t.forEach(function(t,e){if(r.tooltip){if(r.tooltip.index==e){o.beginPath();o.setFillStyle(hexToRgb(t.color,n.activeOpacity||.5));o.moveTo(l.x,l.y);o.arc(l.x,l.y,h+t._radius_,t._start_,t._start_+2*t._rose_proportion_*Math.PI);o.closePath();o.fill()}}o.beginPath();o.setLineWidth(n.borderWidth*r.pix);o.lineJoin="round";o.setStrokeStyle(n.borderColor);var a=t.color;if(n.linearType=="custom"){var i;if(o.createCircularGradient){i=o.createCircularGradient(l.x,l.y,t._radius_)}else{i=o.createRadialGradient(l.x,l.y,0,l.x,l.y,t._radius_)}i.addColorStop(0,hexToRgb(n.customColor[t.linearIndex],1));i.addColorStop(1,hexToRgb(t.color,1));a=i}o.setFillStyle(a);o.moveTo(l.x,l.y);o.arc(l.x,l.y,t._radius_,t._start_,t._start_+2*t._rose_proportion_*Math.PI);o.closePath();o.fill();if(n.border==true){o.stroke()}});if(r.dataLabel!==false&&a===1){drawPieText(t,r,e,o,i,l)}return{center:l,radius:i,series:t}}function drawArcbarDataPoints(a,i,t,r){var e=arguments.length>4&&arguments[4]!==undefined?arguments[4]:1;var o=assign({},{startAngle:.75,endAngle:.25,type:"default",lineCap:"round",width:12,gap:2,linearType:"none",customColor:[]},i.extra.arcbar);a=getArcbarDataPoints(a,o,e);var n;if(o.centerX||o.centerY){n={x:o.centerX?o.centerX:i.width/2,y:o.centerY?o.centerY:i.height/2}}else{n={x:i.width/2,y:i.height/2}}var l;if(o.radius){l=o.radius}else{l=Math.min(n.x,n.y);l-=5*i.pix;l-=o.width/2}l=l<10?10:l;o.customColor=fillCustomColor(o.linearType,o.customColor,a,t);for(let e=0;e5&&arguments[5]!==undefined?arguments[5]:1;var f=assign({},{type:"default",startAngle:.75,endAngle:.25,width:15,labelOffset:13,splitLine:{fixRadius:0,splitNumber:10,width:15,color:"#FFFFFF",childNumber:5,childWidth:5},pointer:{width:15,color:"auto"}},c.extra.gauge);if(f.oldAngle==undefined){f.oldAngle=f.startAngle}if(f.oldData==undefined){f.oldData=0}n=getGaugeAxisPoints(n,f.startAngle,f.endAngle);var p={x:c.width/2,y:c.height/2};var g=Math.min(p.x,p.y);g-=5*c.pix;g-=f.width/2;g=g<10?10:g;var u=g-f.width;var y=0;if(f.type=="progress"){var v=g-f.width*3;d.beginPath();let t=d.createLinearGradient(p.x,p.y-v,p.x,p.y+v);t.addColorStop("0",hexToRgb(h[0].color,.3));t.addColorStop("1.0",hexToRgb("#FFFFFF",.1));d.setFillStyle(t);d.arc(p.x,p.y,v,0,2*Math.PI,false);d.fill();d.setLineWidth(f.width);d.setStrokeStyle(hexToRgb(h[0].color,.3));d.setLineCap("round");d.beginPath();d.arc(p.x,p.y,u,f.startAngle*Math.PI,f.endAngle*Math.PI,false);d.stroke();y=f.startAngle-f.endAngle+1;let e=y/f.splitLine.splitNumber;let a=y/f.splitLine.splitNumber/f.splitLine.childNumber;let i=-g-f.width*.5-f.splitLine.fixRadius;let r=-g-f.width-f.splitLine.fixRadius+f.splitLine.width;d.save();d.translate(p.x,p.y);d.rotate((f.startAngle-1)*Math.PI);let o=f.splitLine.splitNumber*f.splitLine.childNumber+1;let n=h[0].data*x;for(let t=0;tt/o){d.setStrokeStyle(hexToRgb(h[0].color,1))}else{d.setStrokeStyle(hexToRgb(h[0].color,.3))}d.setLineWidth(3*c.pix);d.moveTo(i,0);d.lineTo(r,0);d.stroke();d.rotate(a*Math.PI)}d.restore();h=getGaugeArcbarDataPoints(h,f,x);d.setLineWidth(f.width);d.setStrokeStyle(h[0].color);d.setLineCap("round");d.beginPath();d.arc(p.x,p.y,u,f.startAngle*Math.PI,h[0]._proportion_*Math.PI,false);d.stroke();let l=g-f.width*2.5;d.save();d.translate(p.x,p.y);d.rotate((h[0]._proportion_-1)*Math.PI);d.beginPath();d.setLineWidth(f.width/3);let s=d.createLinearGradient(0,-l*.6,0,l*.6);s.addColorStop("0",hexToRgb("#FFFFFF",0));s.addColorStop("0.5",hexToRgb(h[0].color,1));s.addColorStop("1.0",hexToRgb("#FFFFFF",0));d.setStrokeStyle(s);d.arc(0,0,l,.85*Math.PI,1.15*Math.PI,false);d.stroke();d.beginPath();d.setLineWidth(1);d.setStrokeStyle(h[0].color);d.setFillStyle(h[0].color);d.moveTo(-l-f.width/3/2,-4);d.lineTo(-l-f.width/3/2-4,0);d.lineTo(-l-f.width/3/2,4);d.lineTo(-l-f.width/3/2,-4);d.stroke();d.fill();d.restore()}else{d.setLineWidth(f.width);d.setLineCap("butt");for(let e=0;e4&&arguments[4]!==undefined?arguments[4]:1;var s=assign({},{gridColor:"#cccccc",gridType:"radar",gridEval:1,axisLabel:false,axisLabelTofix:0,labelColor:"#666666",labelPointShow:false,labelPointRadius:3,labelPointColor:"#cccccc",opacity:.2,gridCount:3,border:false,borderWidth:2,linearType:"none",customColor:[]},n.extra.radar);var a=getRadarCoordinateSeries(n.categories.length);var h={x:n.area[3]+(n.width-n.area[1]-n.area[3])/2,y:n.area[0]+(n.height-n.area[0]-n.area[2])/2};var r=(n.width-n.area[1]-n.area[3])/2;var d=(n.height-n.area[0]-n.area[2])/2;var c=Math.min(r-(getMaxTextListLength(n.categories,i.fontSize,l)+i.radarLabelTextMargin),d-i.radarLabelTextMargin);c-=i.radarLabelTextMargin*n.pix;c=c<10?10:c;l.beginPath();l.setLineWidth(1*n.pix);l.setStrokeStyle(s.gridColor);a.forEach(function(t,e){var a=convertCoordinateOrigin(c*Math.cos(t),c*Math.sin(t),h);l.moveTo(h.x,h.y);if(e%s.gridEval==0){l.lineTo(a.x,a.y)}});l.stroke();l.closePath();var x=function t(i){var r={};l.beginPath();l.setLineWidth(1*n.pix);l.setStrokeStyle(s.gridColor);if(s.gridType=="radar"){a.forEach(function(t,e){var a=convertCoordinateOrigin(c/s.gridCount*i*Math.cos(t),c/s.gridCount*i*Math.sin(t),h);if(e===0){r=a;l.moveTo(a.x,a.y)}else{l.lineTo(a.x,a.y)}});l.lineTo(r.x,r.y)}else{var e=convertCoordinateOrigin(c/s.gridCount*i*Math.cos(1.5),c/s.gridCount*i*Math.sin(1.5),h);l.arc(h.x,h.y,h.y-e.y,0,2*Math.PI,false)}l.stroke();l.closePath()};for(var e=1;e<=s.gridCount;e++){x(e)}s.customColor=fillCustomColor(s.linearType,s.customColor,o,i);var f=getRadarDataPoints(a,h,c,o,n,t);f.forEach(function(t,e){l.beginPath();l.setLineWidth(s.borderWidth*n.pix);l.setStrokeStyle(t.color);var a=hexToRgb(t.color,s.opacity);if(s.linearType=="custom"){var i;if(l.createCircularGradient){i=l.createCircularGradient(h.x,h.y,c)}else{i=l.createRadialGradient(h.x,h.y,0,h.x,h.y,c)}i.addColorStop(0,hexToRgb(s.customColor[o[e].linearIndex],s.opacity));i.addColorStop(1,hexToRgb(t.color,s.opacity));a=i}l.setFillStyle(a);t.data.forEach(function(t,e){if(e===0){l.moveTo(t.position.x,t.position.y)}else{l.lineTo(t.position.x,t.position.y)}});l.closePath();l.fill();if(s.border===true){l.stroke()}l.closePath();if(n.dataPointShape!==false){var r=t.data.map(function(t){return t.position});drawPointShape(r,t.color,t.pointShape,l,n)}});if(s.axisLabel===true){const p=Math.max(s.max,Math.max.apply(null,dataCombine(o)));const g=c/s.gridCount;const u=n.fontSize*n.pix;l.setFontSize(u);l.setFillStyle(n.fontColor);l.setTextAlign("left");for(var e=0;eh.x?e.xMax:h.x;e.yMin=e.yMinh.y?e.yMax:h.y}}}return e}function coordinateToPoint(t,e,a,i,r,o){return{x:(e-a.xMin)*i+r,y:(a.yMax-t)*i+o}}function pointToCoordinate(t,e,a,i,r,o){return{x:(e-r)/i+a.xMin,y:a.yMax-(t-o)/i}}function isRayIntersectsSegment(t,e,a){if(e[1]==a[1]){return false}if(e[1]>t[1]&&a[1]>t[1]){return false}if(e[1]t[1]){return false}if(a[1]==t[1]&&e[1]>t[1]){return false}if(e[0]a[t].area[2]||e[1]>a[t].area[3]||e[2]i||e[3]>r){o=true;break}else{o=false}}else{o=true;break}}}return o}function getWordCloudPoint(c,t,d){let x=c.series;switch(t){case"normal":for(let l=0;l.7){return true}else{return false}};for(let h=0;h4&&arguments[4]!==undefined?arguments[4]:1;let a=assign({},{type:"normal",autoColors:true},r.extra.word);if(!r.chartData.wordCloudData){r.chartData.wordCloudData=getWordCloudPoint(r,a.type,o)}o.beginPath();o.setFillStyle(r.background);o.rect(0,0,r.width,r.height);o.fill();o.save();let l=r.chartData.wordCloudData;o.translate(r.width/2,r.height/2);for(let i=0;i0){if(r.tooltip){if(r.tooltip.index==i){o.strokeText(t,(l[i].areav[0]+5-r.width/2)*n-a*(1-n)/2,(l[i].areav[1]+5+e-r.height/2)*n)}else{o.fillText(t,(l[i].areav[0]+5-r.width/2)*n-a*(1-n)/2,(l[i].areav[1]+5+e-r.height/2)*n)}}else{o.fillText(t,(l[i].areav[0]+5-r.width/2)*n-a*(1-n)/2,(l[i].areav[1]+5+e-r.height/2)*n)}}}else{if(l[i].area[0]>0){if(r.tooltip){if(r.tooltip.index==i){o.strokeText(t,(l[i].area[0]+5-r.width/2)*n-a*(1-n)/2,(l[i].area[1]+5+e-r.height/2)*n)}else{o.fillText(t,(l[i].area[0]+5-r.width/2)*n-a*(1-n)/2,(l[i].area[1]+5+e-r.height/2)*n)}}else{o.fillText(t,(l[i].area[0]+5-r.width/2)*n-a*(1-n)/2,(l[i].area[1]+5+e-r.height/2)*n)}}}o.stroke();o.restore()}o.restore()}function drawFunnelDataPoints(e,a,t,i){let c=arguments.length>4&&arguments[4]!==undefined?arguments[4]:1;let r=assign({},{type:"funnel",activeWidth:10,activeOpacity:.3,border:false,borderWidth:2,borderColor:"#FFFFFF",fillOpacity:1,labelAlign:"right",linearType:"none",customColor:[]},a.extra.funnel);let o=(a.height-a.area[0]-a.area[2])/e.length;let n={x:a.area[3]+(a.width-a.area[1]-a.area[3])/2,y:a.height-a.area[2]};let l=r.activeWidth*a.pix;let d=Math.min((a.width-a.area[1]-a.area[3])/2-l,(a.height-a.area[0]-a.area[2])/2-l);e=getFunnelDataPoints(e,d,r.type,o,c);i.save();i.translate(n.x,n.y);r.customColor=fillCustomColor(r.linearType,r.customColor,e,t);if(r.type=="pyramid"){for(let t=0;t0){l.area[3]+=i[t].width+l.yAxis.padding*l.pix}else{l.area[3]+=i[t].width}a+=1}else if(i[t].position=="right"){if(e>0){l.area[1]+=i[t].width+l.yAxis.padding*l.pix}else{l.area[1]+=i[t].width}e+=1}}}else{n.yAxisWidth=i}l.chartData.yAxisData=f;if(l.categories&&l.categories.length&&l.type!=="radar"&&l.type!=="gauge"&&l.type!=="bar"){l.chartData.xAxisData=getXAxisPoints(l.categories,l,n);let t=calCategoriesData(l.categories,l,n,l.chartData.xAxisData.eachSpacing,s),e=t.xAxisHeight,a=t.angle;n.xAxisHeight=e;n._xAxisTextAngle_=a;l.area[2]+=e;l.chartData.categoriesData=t}else{if(l.type==="line"||l.type==="area"||l.type==="scatter"||l.type==="bubble"||l.type==="bar"){l.chartData.xAxisData=calXAxisData(c,l,n,s);d=l.chartData.xAxisData.rangesFormat;let t=calCategoriesData(d,l,n,l.chartData.xAxisData.eachSpacing,s),e=t.xAxisHeight,a=t.angle;n.xAxisHeight=e;n._xAxisTextAngle_=a;l.area[2]+=e;l.chartData.categoriesData=t}else{l.chartData.xAxisData={xAxisPoints:[]}}}if(l.enableScroll&&l.xAxis.scrollAlign=="right"&&l._scrollDistance_===undefined){let t=0,e=l.chartData.xAxisData.xAxisPoints,a=l.chartData.xAxisData.startX,i=l.chartData.xAxisData.endX,r=l.chartData.xAxisData.eachSpacing;let o=r*(e.length-1);let n=i-a;t=n-o;h.scrollOption.currentOffset=t;h.scrollOption.startTouchX=t;h.scrollOption.distance=0;h.scrollOption.lastMoveTime=0;l._scrollDistance_=t}if(t==="pie"||t==="ring"||t==="rose"){n._pieTextMaxLength_=l.dataLabel===false?0:getPieTextMaxLength(x,n,s,l)}switch(t){case"word":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function(t){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}drawWordCloudDataPoints(c,l,n,s,t);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"map":s.clearRect(0,0,l.width,l.height);drawMapDataPoints(c,l,n,s);break;case"funnel":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function(t){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}l.chartData.funnelData=drawFunnelDataPoints(c,l,n,s,t);drawLegend(l.series,l,n,s,l.chartData);drawToolTipBridge(l,n,s,t);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"line":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function t(e){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}drawYAxisGrid(d,l,n,s);drawXAxis(d,l,n,s);var a=drawLineDataPoints(c,l,n,s,e),i=a.xAxisPoints,r=a.calPoints,o=a.eachSpacing;l.chartData.xAxisPoints=i;l.chartData.calPoints=r;l.chartData.eachSpacing=o;drawYAxis(c,l,n,s);if(l.enableMarkLine!==false&&e===1){drawMarkLine(l,n,s)}drawLegend(l.series,l,n,s,l.chartData);drawToolTipBridge(l,n,s,e,o,i);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"scatter":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function t(e){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}drawYAxisGrid(d,l,n,s);drawXAxis(d,l,n,s);var a=drawScatterDataPoints(c,l,n,s,e),i=a.xAxisPoints,r=a.calPoints,o=a.eachSpacing;l.chartData.xAxisPoints=i;l.chartData.calPoints=r;l.chartData.eachSpacing=o;drawYAxis(c,l,n,s);if(l.enableMarkLine!==false&&e===1){drawMarkLine(l,n,s)}drawLegend(l.series,l,n,s,l.chartData);drawToolTipBridge(l,n,s,e,o,i);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"bubble":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function t(e){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}drawYAxisGrid(d,l,n,s);drawXAxis(d,l,n,s);var a=drawBubbleDataPoints(c,l,n,s,e),i=a.xAxisPoints,r=a.calPoints,o=a.eachSpacing;l.chartData.xAxisPoints=i;l.chartData.calPoints=r;l.chartData.eachSpacing=o;drawYAxis(c,l,n,s);if(l.enableMarkLine!==false&&e===1){drawMarkLine(l,n,s)}drawLegend(l.series,l,n,s,l.chartData);drawToolTipBridge(l,n,s,e,o,i);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"mix":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function t(e){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}drawYAxisGrid(d,l,n,s);drawXAxis(d,l,n,s);var a=drawMixDataPoints(c,l,n,s,e),i=a.xAxisPoints,r=a.calPoints,o=a.eachSpacing;l.chartData.xAxisPoints=i;l.chartData.calPoints=r;l.chartData.eachSpacing=o;drawYAxis(c,l,n,s);if(l.enableMarkLine!==false&&e===1){drawMarkLine(l,n,s)}drawLegend(l.series,l,n,s,l.chartData);drawToolTipBridge(l,n,s,e,o,i);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"column":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function t(e){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}drawYAxisGrid(d,l,n,s);drawXAxis(d,l,n,s);var a=drawColumnDataPoints(c,l,n,s,e),i=a.xAxisPoints,r=a.calPoints,o=a.eachSpacing;l.chartData.xAxisPoints=i;l.chartData.calPoints=r;l.chartData.eachSpacing=o;drawYAxis(c,l,n,s);if(l.enableMarkLine!==false&&e===1){drawMarkLine(l,n,s)}drawLegend(l.series,l,n,s,l.chartData);drawToolTipBridge(l,n,s,e,o,i);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"mount":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function t(e){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}drawYAxisGrid(d,l,n,s);drawXAxis(d,l,n,s);var a=drawMountDataPoints(c,l,n,s,e),i=a.xAxisPoints,r=a.calPoints,o=a.eachSpacing;l.chartData.xAxisPoints=i;l.chartData.calPoints=r;l.chartData.eachSpacing=o;drawYAxis(c,l,n,s);if(l.enableMarkLine!==false&&e===1){drawMarkLine(l,n,s)}drawLegend(l.series,l,n,s,l.chartData);drawToolTipBridge(l,n,s,e,o,i);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"bar":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function t(e){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}drawXAxis(d,l,n,s);var a=drawBarDataPoints(c,l,n,s,e),i=a.yAxisPoints,r=a.calPoints,o=a.eachSpacing;l.chartData.yAxisPoints=i;l.chartData.xAxisPoints=l.chartData.xAxisData.xAxisPoints;l.chartData.calPoints=r;l.chartData.eachSpacing=o;drawYAxis(c,l,n,s);if(l.enableMarkLine!==false&&e===1){drawMarkLine(l,n,s)}drawLegend(l.series,l,n,s,l.chartData);drawToolTipBridge(l,n,s,e,o,i);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"area":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function t(e){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}drawYAxisGrid(d,l,n,s);drawXAxis(d,l,n,s);var a=drawAreaDataPoints(c,l,n,s,e),i=a.xAxisPoints,r=a.calPoints,o=a.eachSpacing;l.chartData.xAxisPoints=i;l.chartData.calPoints=r;l.chartData.eachSpacing=o;drawYAxis(c,l,n,s);if(l.enableMarkLine!==false&&e===1){drawMarkLine(l,n,s)}drawLegend(l.series,l,n,s,l.chartData);drawToolTipBridge(l,n,s,e,o,i);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"ring":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function t(e){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}l.chartData.pieData=drawPieDataPoints(c,l,n,s,e);drawLegend(l.series,l,n,s,l.chartData);drawToolTipBridge(l,n,s,e);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"pie":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function t(e){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}l.chartData.pieData=drawPieDataPoints(c,l,n,s,e);drawLegend(l.series,l,n,s,l.chartData);drawToolTipBridge(l,n,s,e);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"rose":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function t(e){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}l.chartData.pieData=drawRoseDataPoints(c,l,n,s,e);drawLegend(l.series,l,n,s,l.chartData);drawToolTipBridge(l,n,s,e);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"radar":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function t(e){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}l.chartData.radarData=drawRadarDataPoints(c,l,n,s,e);drawLegend(l.series,l,n,s,l.chartData);drawToolTipBridge(l,n,s,e);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"arcbar":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function t(e){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}l.chartData.arcbarData=drawArcbarDataPoints(c,l,n,s,e);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"gauge":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function t(e){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}l.chartData.gaugeData=drawGaugeDataPoints(d,c,l,n,s,e);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break;case"candle":this.animationInstance=new Animation({timing:l.timing,duration:e,onProcess:function t(e){s.clearRect(0,0,l.width,l.height);if(l.rotate){contextRotate(s,l)}drawYAxisGrid(d,l,n,s);drawXAxis(d,l,n,s);var a=drawCandleDataPoints(c,x,l,n,s,e),i=a.xAxisPoints,r=a.calPoints,o=a.eachSpacing;l.chartData.xAxisPoints=i;l.chartData.calPoints=r;l.chartData.eachSpacing=o;drawYAxis(c,l,n,s);if(l.enableMarkLine!==false&&e===1){drawMarkLine(l,n,s)}if(x){drawLegend(x,l,n,s,l.chartData)}else{drawLegend(l.series,l,n,s,l.chartData)}drawToolTipBridge(l,n,s,e,o,i);drawCanvas(l,s)},onAnimationFinish:function t(){h.uevent.trigger("renderComplete")}});break}}function uChartsEvent(){this.events={}}uChartsEvent.prototype.addEventListener=function(t,e){this.events[t]=this.events[t]||[];this.events[t].push(e)};uChartsEvent.prototype.delEventListener=function(t){this.events[t]=[]};uChartsEvent.prototype.trigger=function(){for(var t=arguments.length,e=Array(t),a=0;a0&&arguments[0]!==undefined?arguments[0]:{};this.opts=assign({},this.opts,t);this.opts.updateData=true;let c=t.scrollPosition||"current";switch(c){case"current":this.opts._scrollDistance_=this.scrollOption.currentOffset;break;case"left":this.opts._scrollDistance_=0;this.scrollOption={currentOffset:0,startTouchX:0,distance:0,lastMoveTime:0};break;case"right":let t=calYAxisData(this.opts.series,this.opts,this.config,this.context),e=t.yAxisWidth;this.config.yAxisWidth=e;let a=0;let i=getXAxisPoints(this.opts.categories,this.opts,this.config),r=i.xAxisPoints,o=i.startX,n=i.endX,l=i.eachSpacing;let s=l*(r.length-1);let h=n-o;a=h-s;this.scrollOption={currentOffset:a,startTouchX:a,distance:0,lastMoveTime:0};this.opts._scrollDistance_=a;break}drawCharts.call(this,this.opts.type,this.opts,this.config,this.context)};uCharts.prototype.zoom=function(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:this.opts.xAxis.itemCount;if(this.opts.enableScroll!==true){console.log("[uCharts] 请启用滚动条后使用");return}let e=Math.round(Math.abs(this.scrollOption.currentOffset)/this.opts.chartData.eachSpacing)+Math.round(this.opts.xAxis.itemCount/2);this.opts.animation=false;this.opts.xAxis.itemCount=t.itemCount;let a=calYAxisData(this.opts.series,this.opts,this.config,this.context),i=a.yAxisWidth;this.config.yAxisWidth=i;let r=0;let o=getXAxisPoints(this.opts.categories,this.opts,this.config),h=o.xAxisPoints,c=o.startX,d=o.endX,n=o.eachSpacing;let x=n*e;let l=d-c;let s=l-n*(h.length-1);r=l/2-x;if(r>0){r=0}if(r=this.opts.categories.length?this.opts.categories.length:r;this.opts.animation=false;this.opts.xAxis.itemCount=r;let o=0;let n=getXAxisPoints(this.opts.categories,this.opts,this.config),x=n.xAxisPoints,f=n.startX,p=n.endX,l=n.eachSpacing;let g=l*this.scrollOption.moveCurrent1;let u=p-f;let y=u-l*(x.length-1);o=-g+Math.min(i[0].x,i[1].x)-this.opts.area[3]-l;if(o>0){o=0}if(o1&&arguments[1]!==undefined?arguments[1]:{};var a=null;if(t.changedTouches){a=t.changedTouches[0]}else{a=t.mp.changedTouches[0]}if(a){var i=getTouches(a,this.opts,t);var r=this.getLegendDataIndex(t);if(r>=0){if(this.opts.type=="candle"){this.opts.seriesMA[r].show=!this.opts.seriesMA[r].show}else{this.opts.series[r].show=!this.opts.series[r].show}this.opts.animation=e.animation?true:false;this.opts._scrollDistance_=this.scrollOption.currentOffset;drawCharts.call(this,this.opts.type,this.opts,this.config,this.context)}}};uCharts.prototype.showToolTip=function(t){var e=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var c=null;if(t.changedTouches){c=t.changedTouches[0]}else{c=t.mp.changedTouches[0]}if(!c){console.log("[uCharts] 未获取到event坐标信息")}var a=getTouches(c,this.opts,t);var d=this.scrollOption.currentOffset;var i=assign({},this.opts,{_scrollDistance_:d,animation:false});if(this.opts.type==="line"||this.opts.type==="area"||this.opts.type==="column"||this.opts.type==="scatter"||this.opts.type==="bubble"){var r=this.getCurrentDataIndex(t);var o=e.index==undefined?r.index:e.index;if(o>-1||o.length>0){var n=getSeriesDataItem(this.opts.series,o,r.group);if(n.length!==0){var l=getToolTipData(n,this.opts,o,r.group,this.opts.categories,e),s=l.textList,h=l.offset;h.y=a.y;i.tooltip={textList:e.textList!==undefined?e.textList:s,offset:e.offset!==undefined?e.offset:h,option:e,index:o}}}drawCharts.call(this,i.type,i,this.config,this.context)}if(this.opts.type==="mount"){var o=e.index==undefined?this.getCurrentDataIndex(t).index:e.index;if(o>-1){var i=assign({},this.opts,{animation:false});var n=assign({},i._series_[o]);var s=[{text:e.formatter?e.formatter(n,undefined,o,i):n.name+": "+n.data,color:n.color}];var h={x:i.chartData.calPoints[o].x,y:a.y};i.tooltip={textList:e.textList?e.textList:s,offset:e.offset!==undefined?e.offset:h,option:e,index:o}}drawCharts.call(this,i.type,i,this.config,this.context)}if(this.opts.type==="bar"){var r=this.getCurrentDataIndex(t);var o=e.index==undefined?r.index:e.index;if(o>-1||o.length>0){var n=getSeriesDataItem(this.opts.series,o,r.group);if(n.length!==0){var l=getToolTipData(n,this.opts,o,r.group,this.opts.categories,e),s=l.textList,h=l.offset;h.x=a.x;i.tooltip={textList:e.textList!==undefined?e.textList:s,offset:e.offset!==undefined?e.offset:h,option:e,index:o}}}drawCharts.call(this,i.type,i,this.config,this.context)}if(this.opts.type==="mix"){var r=this.getCurrentDataIndex(t);var o=e.index==undefined?r.index:e.index;if(o>-1){var d=this.scrollOption.currentOffset;var i=assign({},this.opts,{_scrollDistance_:d,animation:false});var n=getSeriesDataItem(this.opts.series,o);if(n.length!==0){var x=getMixToolTipData(n,this.opts,o,this.opts.categories,e),s=x.textList,h=x.offset;h.y=a.y;i.tooltip={textList:e.textList?e.textList:s,offset:e.offset!==undefined?e.offset:h,option:e,index:o}}}drawCharts.call(this,i.type,i,this.config,this.context)}if(this.opts.type==="candle"){var r=this.getCurrentDataIndex(t);var o=e.index==undefined?r.index:e.index;if(o>-1){var d=this.scrollOption.currentOffset;var i=assign({},this.opts,{_scrollDistance_:d,animation:false});var n=getSeriesDataItem(this.opts.series,o);if(n.length!==0){var l=getCandleToolTipData(this.opts.series[0].data,n,this.opts,o,this.opts.categories,this.opts.extra.candle,e),s=l.textList,h=l.offset;h.y=a.y;i.tooltip={textList:e.textList?e.textList:s,offset:e.offset!==undefined?e.offset:h,option:e,index:o}}}drawCharts.call(this,i.type,i,this.config,this.context)}if(this.opts.type==="pie"||this.opts.type==="ring"||this.opts.type==="rose"||this.opts.type==="funnel"){var o=e.index==undefined?this.getCurrentDataIndex(t):e.index;if(o>-1){var i=assign({},this.opts,{animation:false});var n=assign({},i._series_[o]);var s=[{text:e.formatter?e.formatter(n,undefined,o,i):n.name+": "+n.data,color:n.color}];var h={x:a.x,y:a.y};i.tooltip={textList:e.textList?e.textList:s,offset:e.offset!==undefined?e.offset:h,option:e,index:o}}drawCharts.call(this,i.type,i,this.config,this.context)}if(this.opts.type==="map"){var o=e.index==undefined?this.getCurrentDataIndex(t):e.index;if(o>-1){var i=assign({},this.opts,{animation:false});var n=assign({},this.opts.series[o]);n.name=n.properties.name;var s=[{text:e.formatter?e.formatter(n,undefined,o,this.opts):n.name,color:n.color}];var h={x:a.x,y:a.y};i.tooltip={textList:e.textList?e.textList:s,offset:e.offset!==undefined?e.offset:h,option:e,index:o}}i.updateData=false;drawCharts.call(this,i.type,i,this.config,this.context)}if(this.opts.type==="word"){var o=e.index==undefined?this.getCurrentDataIndex(t):e.index;if(o>-1){var i=assign({},this.opts,{animation:false});var n=assign({},this.opts.series[o]);var s=[{text:e.formatter?e.formatter(n,undefined,o,this.opts):n.name,color:n.color}];var h={x:a.x,y:a.y};i.tooltip={textList:e.textList?e.textList:s,offset:e.offset!==undefined?e.offset:h,option:e,index:o}}i.updateData=false;drawCharts.call(this,i.type,i,this.config,this.context)}if(this.opts.type==="radar"){var o=e.index==undefined?this.getCurrentDataIndex(t):e.index;if(o>-1){var i=assign({},this.opts,{animation:false});var n=getSeriesDataItem(this.opts.series,o);if(n.length!==0){var s=n.map(t=>{return{text:e.formatter?e.formatter(t,this.opts.categories[o],o,this.opts):t.name+": "+t.data,color:t.color}});var h={x:a.x,y:a.y};i.tooltip={textList:e.textList?e.textList:s,offset:e.offset!==undefined?e.offset:h,option:e,index:o}}}drawCharts.call(this,i.type,i,this.config,this.context)}};uCharts.prototype.translate=function(t){this.scrollOption={currentOffset:t,startTouchX:t,distance:0,lastMoveTime:0};let e=assign({},this.opts,{_scrollDistance_:t,animation:false});drawCharts.call(this,this.opts.type,e,this.config,this.context)};uCharts.prototype.scrollStart=function(t){var e=null;if(t.changedTouches){e=t.changedTouches[0]}else{e=t.mp.changedTouches[0]}var a=getTouches(e,this.opts,t);if(e&&this.opts.enableScroll===true){this.scrollOption.startTouchX=a.x}};uCharts.prototype.scroll=function(t){if(this.scrollOption.lastMoveTime===0){this.scrollOption.lastMoveTime=Date.now()}let e=this.opts.touchMoveLimit||60;let a=Date.now();let i=a-this.scrollOption.lastMoveTime;if(i写给uCharts使用者的一封信 + +亲爱的用户: + +- 由于最近上线的官网中实行了部分收费体验,收到了许多用户的使用反馈,大致反馈的问题都指向同一矛头:为何新官网的在线工具也要收费?对于这件事,我们深表歉意。由于新官网本身未提供技术文档,使得用户误以为我们对文档实行了收费。经我们连夜整改,新官网目前已经将技术文档开放出来供大家阅读使用,并免费对外开放了【演示】中的查看全端全平台的代码的功能,为此再次向所受影响的用户们致以诚恳的歉意。 + +- 其次,我们须澄清几点,如下: +1. uCharts的插件本身遵循开源原则,并不收费,用户可自行到DCloud市场与Gitee码云上获取源码 +2. uCharts的技术文档永久对用户开放 +3. 收费内容仅针对原生工具、组件工具、定制功能以及模板市场的部分收费模板 + +- uCharts为什么实行收费原则? +1. 服务器的费用支撑 +2. 团队的运营支出;正如你所见,我们的群里有大量的用户在请教图表配置与反馈问题,群里的每一位管理员都在花费不少精力在积极解决用户的问题,然而遇到巨大的咨询量时,我们无法及时、精准解答回复,因此,我们推出了会员优先服务 +3. 与其说模板市场是收费,倒不如说给野生用户提供了创造价值的机会,用户既可以在上面发布模板赚取费用,遇到心动的模板也能免费/付费使用 + +- 收费不是目的,正如你们所见,用户可以申请成为[【开发者】](https://www.ucharts.cn/v2/#/agreement/developer),开发者不限制任何官网功能,并享有官方指导、开发、改造uCharts的权力,并且活动期间【返还超级会员费用】!我们想说的是,我们新版官网上线旨在希望更多的用户加入到开发者的队伍,我们共同去维护uCharts! + +我们相信:星星之火可以燎原! + +uCharts技术团队 + +2022.4.23 + + + + +![logo](https://img-blog.csdnimg.cn/4a276226973841468c1be356f8d9438b.png) + + +[![star](https://gitee.com/uCharts/uCharts/badge/star.svg?theme=gvp)](https://gitee.com/uCharts/uCharts/stargazers) +[![fork](https://gitee.com/uCharts/uCharts/badge/fork.svg?theme=gvp)](https://gitee.com/uCharts/uCharts/members) +[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) +[![npm package](https://img.shields.io/npm/v/@qiun/ucharts.svg?style=flat-square)](https://www.npmjs.com/~qiun) + + +## uCharts简介 + +`uCharts`是一款基于`canvas API`开发的适用于所有前端应用的图表库,开发者编写一套代码,可运行到 Web、iOS、Android(基于 uni-app / taro )、以及各种小程序(微信/支付宝/百度/头条/飞书/QQ/快手/钉钉/淘宝)、快应用等更多支持 canvas API 的平台。 + +## 官方网站 + +## [https://www.ucharts.cn](https://www.ucharts.cn) + +## 快速体验 + +一套代码编到多个平台,依次扫描二维码,亲自体验uCharts图表跨平台效果!其他平台请自行编译。 + +![](https://www.ucharts.cn/images/web/guide/qrcode20220224.png) + +## 致开发者 + +感谢各位开发者`四年`来对秋云及uCharts的支持,uCharts的进步离不开各位开发者的鼓励与贡献。为更好的帮助各位开发者使用图表工具,我们推出了新版官网,增加了在线定制、问答社区、在线配置等一些增值服务,为确保您能更好的应用图表组件,建议您先`仔细阅读本页指南`以及`常见问题`,而不是下载下来`直接使用`。如仍然不能解决,请到`官网社区`或开通会员后加入`专属VIP会员群`提问将会很快得到回答。 + +## 社群支持 + +uCharts官方拥有4个2000人的QQ群及专属VIP会员群支持,庞大的用户量证明我们一直在努力,请各位放心使用!uCharts的开源图表组件的开发,团队付出了大量的时间与精力,经过四来的考验,不会有比较明显的bug,请各位放心使用。如果您有更好的想法,可以在`码云提交Pull Requests`以帮助更多开发者完成需求,再次感谢各位对uCharts的鼓励与支持! + +#### 官方交流群 +- 交流群1:371774600(已满) +- 交流群2:619841586(已满) +- 交流群3:955340127(已满) +- 交流群4:641669795 +- 口令`uniapp` + +#### 专属VIP会员群 +- 开通会员后详见【账号详情】页面中顶部的滚动通知 +- 口令`您的用户ID` + +## 版权信息 + +uCharts始终坚持开源,遵循 [Apache Licence 2.0](https://www.apache.org/licenses/LICENSE-2.0.html) 开源协议,意味着您无需支付任何费用,即可将uCharts应用到您的产品中。 + +注意:这并不意味着您可以将uCharts应用到非法的领域,比如涉及赌博,暴力等方面。如因此产生纠纷或法律问题,uCharts相关方及秋云科技不承担任何责任。 + +## 合作伙伴 + +[![DIY官网](https://www.ucharts.cn/images/web/guide/links/diy-gw.png)](https://www.diygw.com/) +[![HasChat](https://www.ucharts.cn/images/web/guide/links/haschat.png)](https://gitee.com/howcode/has-chat) +[![uViewUI](https://www.ucharts.cn/images/web/guide/links/uView.png)](https://www.uviewui.com/) +[![图鸟UI](https://www.ucharts.cn/images/web/guide/links/tuniao.png)](https://ext.dcloud.net.cn/plugin?id=7088) +[![thorui](https://www.ucharts.cn/images/web/guide/links/thorui.png)](https://ext.dcloud.net.cn/publisher?id=202) +[![FirstUI](https://www.ucharts.cn/images/web/guide/links/first.png)](https://www.firstui.cn/) +[![nProUI](https://www.ucharts.cn/images/web/guide/links/nPro.png)](https://ext.dcloud.net.cn/plugin?id=5169) +[![GraceUI](https://www.ucharts.cn/images/web/guide/links/grace.png)](https://www.graceui.com/) + + +## 更新记录 + +详见官网指南中说明,[点击此处查看](https://www.ucharts.cn/v2/#/guide/index?id=100) + + +## 相关链接 +- [uCharts官网](https://www.ucharts.cn) +- [DCloud插件市场地址](https://ext.dcloud.net.cn/plugin?id=271) +- [uCharts码云开源托管地址](https://gitee.com/uCharts/uCharts) [![star](https://gitee.com/uCharts/uCharts/badge/star.svg?theme=gvp)](https://gitee.com/uCharts/uCharts/stargazers) +- [uCharts npm开源地址](https://www.ucharts.cn) +- [ECharts官网](https://echarts.apache.org/zh/index.html) +- [ECharts配置手册](https://echarts.apache.org/zh/option.html) +- [图表组件在项目中的应用 ReportPlus数据报表](https://www.ucharts.cn/v2/#/layout/info?id=1) \ No newline at end of file diff --git a/uni_modules/qiun-data-charts/static/app-plus/echarts.min.js b/uni_modules/qiun-data-charts/static/app-plus/echarts.min.js new file mode 100644 index 0000000..5396a03 --- /dev/null +++ b/uni_modules/qiun-data-charts/static/app-plus/echarts.min.js @@ -0,0 +1,23 @@ + +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* 版本为4.2.1,修改一处源码:this.el.hide() 改为 this.el?this.el.hide():true +*/ + + +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){"createCanvas"===t&&(nw=null),ew[t]=e}function i(t){if(null==t||"object"!=typeof t)return t;var e=t,n=Y_.call(t);if("[object Array]"===n){if(!O(t)){e=[];for(var o=0,a=t.length;o=0){var o="touchend"!==n?e.targetTouches[0]:e.changedTouches[0];o&&st(t,o,e,i)}else st(t,e,e,i),e.zrDelta=e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3;var a=e.button;return null==e.which&&void 0!==a&&gw.test(e.type)&&(e.which=1&a?1:2&a?3:4&a?2:0),e}function ht(t,e,i){pw?t.addEventListener(e,i):t.attachEvent("on"+e,i)}function ct(t,e,i){pw?t.removeEventListener(e,i):t.detachEvent("on"+e,i)}function dt(t){return 2===t.which||3===t.which}function ft(t){var e=t[1][0]-t[0][0],i=t[1][1]-t[0][1];return Math.sqrt(e*e+i*i)}function pt(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}function gt(t,e,i){return{type:t,event:i,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:i.zrX,offsetY:i.zrY,gestureEvent:i.gestureEvent,pinchX:i.pinchX,pinchY:i.pinchY,pinchScale:i.pinchScale,wheelDelta:i.zrDelta,zrByTouch:i.zrByTouch,which:i.which,stop:mt}}function mt(t){mw(this.event)}function vt(){}function yt(t,e,i){if(t[t.rectHover?"rectContain":"contain"](e,i)){for(var n,o=t;o;){if(o.clipPath&&!o.clipPath.contain(e,i))return!1;o.silent&&(n=!0),o=o.parent}return!n||xw}return!1}function xt(){var t=new bw(6);return _t(t),t}function _t(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function wt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function bt(t,e,i){var n=e[0]*i[0]+e[2]*i[1],o=e[1]*i[0]+e[3]*i[1],a=e[0]*i[2]+e[2]*i[3],r=e[1]*i[2]+e[3]*i[3],s=e[0]*i[4]+e[2]*i[5]+e[4],l=e[1]*i[4]+e[3]*i[5]+e[5];return t[0]=n,t[1]=o,t[2]=a,t[3]=r,t[4]=s,t[5]=l,t}function St(t,e,i){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+i[0],t[5]=e[5]+i[1],t}function Mt(t,e,i){var n=e[0],o=e[2],a=e[4],r=e[1],s=e[3],l=e[5],u=Math.sin(i),h=Math.cos(i);return t[0]=n*h+r*u,t[1]=-n*u+r*h,t[2]=o*h+s*u,t[3]=-o*u+h*s,t[4]=h*a+u*l,t[5]=h*l-u*a,t}function It(t,e,i){var n=i[0],o=i[1];return t[0]=e[0]*n,t[1]=e[1]*o,t[2]=e[2]*n,t[3]=e[3]*o,t[4]=e[4]*n,t[5]=e[5]*o,t}function Tt(t,e){var i=e[0],n=e[2],o=e[4],a=e[1],r=e[3],s=e[5],l=i*r-a*n;return l?(l=1/l,t[0]=r*l,t[1]=-a*l,t[2]=-n*l,t[3]=i*l,t[4]=(n*s-r*o)*l,t[5]=(a*o-i*s)*l,t):null}function At(t){var e=xt();return wt(e,t),e}function Dt(t){return t>Iw||t<-Iw}function Ct(t){this._target=t.target,this._life=t.life||1e3,this._delay=t.delay||0,this._initialized=!1,this.loop=null!=t.loop&&t.loop,this.gap=t.gap||0,this.easing=t.easing||"Linear",this.onframe=t.onframe,this.ondestroy=t.ondestroy,this.onrestart=t.onrestart,this._pausedTime=0,this._paused=!1}function Lt(t){return(t=Math.round(t))<0?0:t>255?255:t}function kt(t){return(t=Math.round(t))<0?0:t>360?360:t}function Pt(t){return t<0?0:t>1?1:t}function Nt(t){return Lt(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100*255:parseInt(t,10))}function Ot(t){return Pt(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100:parseFloat(t))}function Et(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}function Rt(t,e,i){return t+(e-t)*i}function zt(t,e,i,n,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t}function Bt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Vt(t,e){Vw&&Bt(Vw,e),Vw=Bw.put(t,Vw||e.slice())}function Gt(t,e){if(t){e=e||[];var i=Bw.get(t);if(i)return Bt(e,i);var n=(t+="").replace(/ /g,"").toLowerCase();if(n in zw)return Bt(e,zw[n]),Vt(t,e),e;if("#"!==n.charAt(0)){var o=n.indexOf("("),a=n.indexOf(")");if(-1!==o&&a+1===n.length){var r=n.substr(0,o),s=n.substr(o+1,a-(o+1)).split(","),l=1;switch(r){case"rgba":if(4!==s.length)return void zt(e,0,0,0,1);l=Ot(s.pop());case"rgb":return 3!==s.length?void zt(e,0,0,0,1):(zt(e,Nt(s[0]),Nt(s[1]),Nt(s[2]),l),Vt(t,e),e);case"hsla":return 4!==s.length?void zt(e,0,0,0,1):(s[3]=Ot(s[3]),Ft(s,e),Vt(t,e),e);case"hsl":return 3!==s.length?void zt(e,0,0,0,1):(Ft(s,e),Vt(t,e),e);default:return}}zt(e,0,0,0,1)}else{if(4===n.length)return(u=parseInt(n.substr(1),16))>=0&&u<=4095?(zt(e,(3840&u)>>4|(3840&u)>>8,240&u|(240&u)>>4,15&u|(15&u)<<4,1),Vt(t,e),e):void zt(e,0,0,0,1);if(7===n.length){var u=parseInt(n.substr(1),16);return u>=0&&u<=16777215?(zt(e,(16711680&u)>>16,(65280&u)>>8,255&u,1),Vt(t,e),e):void zt(e,0,0,0,1)}}}}function Ft(t,e){var i=(parseFloat(t[0])%360+360)%360/360,n=Ot(t[1]),o=Ot(t[2]),a=o<=.5?o*(n+1):o+n-o*n,r=2*o-a;return e=e||[],zt(e,Lt(255*Et(r,a,i+1/3)),Lt(255*Et(r,a,i)),Lt(255*Et(r,a,i-1/3)),1),4===t.length&&(e[3]=t[3]),e}function Wt(t){if(t){var e,i,n=t[0]/255,o=t[1]/255,a=t[2]/255,r=Math.min(n,o,a),s=Math.max(n,o,a),l=s-r,u=(s+r)/2;if(0===l)e=0,i=0;else{i=u<.5?l/(s+r):l/(2-s-r);var h=((s-n)/6+l/2)/l,c=((s-o)/6+l/2)/l,d=((s-a)/6+l/2)/l;n===s?e=d-c:o===s?e=1/3+h-d:a===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,i,u];return null!=t[3]&&f.push(t[3]),f}}function Ht(t,e){var i=Gt(t);if(i){for(var n=0;n<3;n++)i[n]=e<0?i[n]*(1-e)|0:(255-i[n])*e+i[n]|0,i[n]>255?i[n]=255:t[n]<0&&(i[n]=0);return qt(i,4===i.length?"rgba":"rgb")}}function Zt(t){var e=Gt(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function Ut(t,e,i){if(e&&e.length&&t>=0&&t<=1){i=i||[];var n=t*(e.length-1),o=Math.floor(n),a=Math.ceil(n),r=e[o],s=e[a],l=n-o;return i[0]=Lt(Rt(r[0],s[0],l)),i[1]=Lt(Rt(r[1],s[1],l)),i[2]=Lt(Rt(r[2],s[2],l)),i[3]=Pt(Rt(r[3],s[3],l)),i}}function Xt(t,e,i){if(e&&e.length&&t>=0&&t<=1){var n=t*(e.length-1),o=Math.floor(n),a=Math.ceil(n),r=Gt(e[o]),s=Gt(e[a]),l=n-o,u=qt([Lt(Rt(r[0],s[0],l)),Lt(Rt(r[1],s[1],l)),Lt(Rt(r[2],s[2],l)),Pt(Rt(r[3],s[3],l))],"rgba");return i?{color:u,leftIndex:o,rightIndex:a,value:n}:u}}function jt(t,e,i,n){if(t=Gt(t))return t=Wt(t),null!=e&&(t[0]=kt(e)),null!=i&&(t[1]=Ot(i)),null!=n&&(t[2]=Ot(n)),qt(Ft(t),"rgba")}function Yt(t,e){if((t=Gt(t))&&null!=e)return t[3]=Pt(e),qt(t,"rgba")}function qt(t,e){if(t&&t.length){var i=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(i+=","+t[3]),e+"("+i+")"}}function Kt(t,e){return t[e]}function $t(t,e,i){t[e]=i}function Jt(t,e,i){return(e-t)*i+t}function Qt(t,e,i){return i>.5?e:t}function te(t,e,i,n,o){var a=t.length;if(1===o)for(s=0;so)t.length=o;else for(r=n;r=0&&!(m[i]<=e);i--);i=Math.min(i,u-2)}else{for(i=L;ie);i++);i=Math.min(i-1,u-2)}L=i,k=e;var n=m[i+1]-m[i];if(0!==n)if(I=(e-m[i])/n,l)if(A=v[i],T=v[0===i?i:i-1],D=v[i>u-2?u-1:i+1],C=v[i>u-3?u-1:i+2],d)ne(T,A,D,C,I,I*I,I*I*I,r(t,o),g);else{if(f)a=ne(T,A,D,C,I,I*I,I*I*I,P,1),a=re(P);else{if(p)return Qt(A,D,I);a=oe(T,A,D,C,I,I*I,I*I*I)}s(t,o,a)}else if(d)te(v[i],v[i+1],I,r(t,o),g);else{var a;if(f)te(v[i],v[i+1],I,P,1),a=re(P);else{if(p)return Qt(v[i],v[i+1],I);a=Jt(v[i],v[i+1],I)}s(t,o,a)}},ondestroy:i});return e&&"spline"!==e&&(N.easing=e),N}}}function ue(t,e,i,n,o,a,r,s){_(n)?(a=o,o=n,n=0):x(o)?(a=o,o="linear",n=0):x(n)?(a=n,n=0):x(i)?(a=i,i=500):i||(i=500),t.stopAnimation(),he(t,"",t,e,i,n,s);var l=t.animators.slice(),u=l.length;u||a&&a();for(var h=0;h0&&t.animate(e,!1).when(null==o?500:o,s).delay(a||0)}function ce(t,e,i,n){if(e){var o={};o[e]={},o[e][i]=n,t.attr(o)}else t.attr(i,n)}function de(t,e,i,n){i<0&&(t+=i,i=-i),n<0&&(e+=n,n=-n),this.x=t,this.y=e,this.width=i,this.height=n}function fe(t){for(var e=0;t>=eb;)e|=1&t,t>>=1;return t+e}function pe(t,e,i,n){var o=e+1;if(o===i)return 1;if(n(t[o++],t[e])<0){for(;o=0;)o++;return o-e}function ge(t,e,i){for(i--;e>>1])<0?l=a:s=a+1;var u=n-s;switch(u){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;u>0;)t[s+u]=t[s+u-1],u--}t[s]=r}}function ve(t,e,i,n,o,a){var r=0,s=0,l=1;if(a(t,e[i+o])>0){for(s=n-o;l0;)r=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),r+=o,l+=o}else{for(s=o+1;ls&&(l=s);var u=r;r=o-l,l=o-u}for(r++;r>>1);a(t,e[i+h])>0?r=h+1:l=h}return l}function ye(t,e,i,n,o,a){var r=0,s=0,l=1;if(a(t,e[i+o])<0){for(s=o+1;ls&&(l=s);var u=r;r=o-l,l=o-u}else{for(s=n-o;l=0;)r=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),r+=o,l+=o}for(r++;r>>1);a(t,e[i+h])<0?l=h:r=h+1}return l}function xe(t,e){function i(i){var s=a[i],u=r[i],h=a[i+1],c=r[i+1];r[i]=u+c,i===l-3&&(a[i+1]=a[i+2],r[i+1]=r[i+2]),l--;var d=ye(t[h],t,s,u,0,e);s+=d,0!==(u-=d)&&0!==(c=ve(t[s+u-1],t,h,c,c-1,e))&&(u<=c?n(s,u,h,c):o(s,u,h,c))}function n(i,n,o,a){var r=0;for(r=0;r=ib||f>=ib);if(p)break;g<0&&(g=0),g+=2}if((s=g)<1&&(s=1),1===n){for(r=0;r=0;r--)t[f+r]=t[d+r];if(0===n){v=!0;break}}if(t[c--]=u[h--],1==--a){v=!0;break}if(0!=(m=a-ve(t[l],u,0,a,a-1,e))){for(a-=m,f=(c-=m)+1,d=(h-=m)+1,r=0;r=ib||m>=ib);if(v)break;p<0&&(p=0),p+=2}if((s=p)<1&&(s=1),1===a){for(f=(c-=n)+1,d=(l-=n)+1,r=n-1;r>=0;r--)t[f+r]=t[d+r];t[c]=u[h]}else{if(0===a)throw new Error;for(d=c-(a-1),r=0;r=0;r--)t[f+r]=t[d+r];t[c]=u[h]}else for(d=c-(a-1),r=0;r1;){var t=l-2;if(t>=1&&r[t-1]<=r[t]+r[t+1]||t>=2&&r[t-2]<=r[t]+r[t-1])r[t-1]r[t+1])break;i(t)}},this.forceMergeRuns=function(){for(;l>1;){var t=l-2;t>0&&r[t-1]s&&(l=s),me(t,i,i+l,i+a,e),a=l}r.pushRun(i,a),r.mergeRuns(),o-=a,i+=a}while(0!==o);r.forceMergeRuns()}}function we(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}function be(t,e,i){var n=null==e.x?0:e.x,o=null==e.x2?1:e.x2,a=null==e.y?0:e.y,r=null==e.y2?0:e.y2;return e.global||(n=n*i.width+i.x,o=o*i.width+i.x,a=a*i.height+i.y,r=r*i.height+i.y),n=isNaN(n)?0:n,o=isNaN(o)?1:o,a=isNaN(a)?0:a,r=isNaN(r)?0:r,t.createLinearGradient(n,a,o,r)}function Se(t,e,i){var n=i.width,o=i.height,a=Math.min(n,o),r=null==e.x?.5:e.x,s=null==e.y?.5:e.y,l=null==e.r?.5:e.r;return e.global||(r=r*n+i.x,s=s*o+i.y,l*=a),t.createRadialGradient(r,s,0,r,s,l)}function Me(){return!1}function Ie(t,e,i){var n=iw(),o=e.getWidth(),a=e.getHeight(),r=n.style;return r&&(r.position="absolute",r.left=0,r.top=0,r.width=o+"px",r.height=a+"px",n.setAttribute("data-zr-dom-id",t)),n.width=o*i,n.height=a*i,n}function Te(t){if("string"==typeof t){var e=mb.get(t);return e&&e.image}return t}function Ae(t,e,i,n,o){if(t){if("string"==typeof t){if(e&&e.__zrImageSrc===t||!i)return e;var a=mb.get(t),r={hostEl:i,cb:n,cbPayload:o};return a?!Ce(e=a.image)&&a.pending.push(r):((e=new Image).onload=e.onerror=De,mb.put(t,e.__cachedImgObj={image:e,pending:[r]}),e.src=e.__zrImageSrc=t),e}return t}return e}function De(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;exb&&(yb=0,vb={}),yb++,vb[i]=o,o}function ke(t,e,i,n,o,a,r,s){return r?Ne(t,e,i,n,o,a,r,s):Pe(t,e,i,n,o,a,s)}function Pe(t,e,i,n,o,a,r){var s=He(t,e,o,a,r),l=Le(t,e);o&&(l+=o[1]+o[3]);var u=s.outerHeight,h=new de(Oe(0,l,i),Ee(0,u,n),l,u);return h.lineHeight=s.lineHeight,h}function Ne(t,e,i,n,o,a,r,s){var l=Ze(t,{rich:r,truncate:s,font:e,textAlign:i,textPadding:o,textLineHeight:a}),u=l.outerWidth,h=l.outerHeight;return new de(Oe(0,u,i),Ee(0,h,n),u,h)}function Oe(t,e,i){return"right"===i?t-=e:"center"===i&&(t-=e/2),t}function Ee(t,e,i){return"middle"===i?t-=e/2:"bottom"===i&&(t-=e),t}function Re(t,e,i){var n=e.x,o=e.y,a=e.height,r=e.width,s=a/2,l="left",u="top";switch(t){case"left":n-=i,o+=s,l="right",u="middle";break;case"right":n+=i+r,o+=s,u="middle";break;case"top":n+=r/2,o-=i,l="center",u="bottom";break;case"bottom":n+=r/2,o+=a+i,l="center";break;case"inside":n+=r/2,o+=s,l="center",u="middle";break;case"insideLeft":n+=i,o+=s,u="middle";break;case"insideRight":n+=r-i,o+=s,l="right",u="middle";break;case"insideTop":n+=r/2,o+=i,l="center";break;case"insideBottom":n+=r/2,o+=a-i,l="center",u="bottom";break;case"insideTopLeft":n+=i,o+=i;break;case"insideTopRight":n+=r-i,o+=i,l="right";break;case"insideBottomLeft":n+=i,o+=a-i,u="bottom";break;case"insideBottomRight":n+=r-i,o+=a-i,l="right",u="bottom"}return{x:n,y:o,textAlign:l,textVerticalAlign:u}}function ze(t,e,i,n,o){if(!e)return"";var a=(t+"").split("\n");o=Be(e,i,n,o);for(var r=0,s=a.length;r=r;l++)s-=r;var u=Le(i,e);return u>s&&(i="",u=0),s=t-u,n.ellipsis=i,n.ellipsisWidth=u,n.contentWidth=s,n.containerWidth=t,n}function Ve(t,e){var i=e.containerWidth,n=e.font,o=e.contentWidth;if(!i)return"";var a=Le(t,n);if(a<=i)return t;for(var r=0;;r++){if(a<=o||r>=e.maxIterations){t+=e.ellipsis;break}var s=0===r?Ge(t,o,e.ascCharWidth,e.cnCharWidth):a>0?Math.floor(t.length*o/a):0;a=Le(t=t.substr(0,s),n)}return""===t&&(t=e.placeholder),t}function Ge(t,e,i,n){for(var o=0,a=0,r=t.length;au)t="",r=[];else if(null!=h)for(var c=Be(h-(i?i[1]+i[3]:0),e,o.ellipsis,{minChar:o.minChar,placeholder:o.placeholder}),d=0,f=r.length;do&&Ue(i,t.substring(o,a)),Ue(i,n[2],n[1]),o=_b.lastIndex}of)return{lines:[],width:0,height:0};k.textWidth=Le(k.text,_);var b=y.textWidth,S=null==b||"auto"===b;if("string"==typeof b&&"%"===b.charAt(b.length-1))k.percentWidth=b,u.push(k),b=0;else{if(S){b=k.textWidth;var M=y.textBackgroundColor,I=M&&M.image;I&&Ce(I=Te(I))&&(b=Math.max(b,I.width*w/I.height))}var T=x?x[1]+x[3]:0;b+=T;var C=null!=d?d-m:null;null!=C&&Cl&&(i*=l/(c=i+n),n*=l/c),o+a>l&&(o*=l/(c=o+a),a*=l/c),n+o>u&&(n*=u/(c=n+o),o*=u/c),i+a>u&&(i*=u/(c=i+a),a*=u/c),t.moveTo(r+i,s),t.lineTo(r+l-n,s),0!==n&&t.arc(r+l-n,s+n,n,-Math.PI/2,0),t.lineTo(r+l,s+u-o),0!==o&&t.arc(r+l-o,s+u-o,o,0,Math.PI/2),t.lineTo(r+a,s+u),0!==a&&t.arc(r+a,s+u-a,a,Math.PI/2,Math.PI),t.lineTo(r,s+i),0!==i&&t.arc(r+i,s+i,i,Math.PI,1.5*Math.PI)}function Ye(t){return qe(t),d(t.rich,qe),t}function qe(t){if(t){t.font=Xe(t);var e=t.textAlign;"middle"===e&&(e="center"),t.textAlign=null==e||Mb[e]?e:"left";var i=t.textVerticalAlign||t.textBaseline;"center"===i&&(i="middle"),t.textVerticalAlign=null==i||Ib[i]?i:"top",t.textPadding&&(t.textPadding=L(t.textPadding))}}function Ke(t,e,i,n,o,a){n.rich?Je(t,e,i,n,o,a):$e(t,e,i,n,o,a)}function $e(t,e,i,n,o,a){var r,s=ii(n),l=!1,u=e.__attrCachedBy===rb.PLAIN_TEXT;a!==sb?(a&&(r=a.style,l=!s&&u&&r),e.__attrCachedBy=s?rb.NONE:rb.PLAIN_TEXT):u&&(e.__attrCachedBy=rb.NONE);var h=n.font||Sb;l&&h===(r.font||Sb)||(e.font=h);var c=t.__computedFont;t.__styleFont!==h&&(t.__styleFont=h,c=t.__computedFont=e.font);var d=n.textPadding,f=n.textLineHeight,p=t.__textCotentBlock;p&&!t.__dirtyText||(p=t.__textCotentBlock=He(i,c,d,f,n.truncate));var g=p.outerHeight,m=p.lines,v=p.lineHeight,y=ai(g,n,o),x=y.baseX,_=y.baseY,w=y.textAlign||"left",b=y.textVerticalAlign;ti(e,n,o,x,_);var S=Ee(_,g,b),M=x,I=S;if(s||d){var T=Le(i,c);d&&(T+=d[1]+d[3]);var A=Oe(x,T,w);s&&ni(t,e,n,A,S,T,g),d&&(M=hi(x,w,d),I+=d[0])}e.textAlign=w,e.textBaseline="middle",e.globalAlpha=n.opacity||1;for(B=0;B=0&&"right"===(_=b[C]).textAlign;)ei(t,e,_,n,M,v,D,"right"),I-=_.width,D-=_.width,C--;for(A+=(a-(A-m)-(y-D)-I)/2;T<=C;)ei(t,e,_=b[T],n,M,v,A+_.width/2,"center"),A+=_.width,T++;v+=M}}function ti(t,e,i,n,o){if(i&&e.textRotation){var a=e.textOrigin;"center"===a?(n=i.width/2+i.x,o=i.height/2+i.y):a&&(n=a[0]+i.x,o=a[1]+i.y),t.translate(n,o),t.rotate(-e.textRotation),t.translate(-n,-o)}}function ei(t,e,i,n,o,a,r,s){var l=n.rich[i.styleName]||{};l.text=i.text;var u=i.textVerticalAlign,h=a+o/2;"top"===u?h=a+i.height/2:"bottom"===u&&(h=a+o-i.height/2),!i.isLineHolder&&ii(l)&&ni(t,e,l,"right"===s?r-i.width:"center"===s?r-i.width/2:r,h-i.height/2,i.width,i.height);var c=i.textPadding;c&&(r=hi(r,s,c),h-=i.height/2-c[2]-i.textHeight/2),ri(e,"shadowBlur",D(l.textShadowBlur,n.textShadowBlur,0)),ri(e,"shadowColor",l.textShadowColor||n.textShadowColor||"transparent"),ri(e,"shadowOffsetX",D(l.textShadowOffsetX,n.textShadowOffsetX,0)),ri(e,"shadowOffsetY",D(l.textShadowOffsetY,n.textShadowOffsetY,0)),ri(e,"textAlign",s),ri(e,"textBaseline","middle"),ri(e,"font",i.font||Sb);var d=si(l.textStroke||n.textStroke,p),f=li(l.textFill||n.textFill),p=A(l.textStrokeWidth,n.textStrokeWidth);d&&(ri(e,"lineWidth",p),ri(e,"strokeStyle",d),e.strokeText(i.text,r,h)),f&&(ri(e,"fillStyle",f),e.fillText(i.text,r,h))}function ii(t){return!!(t.textBackgroundColor||t.textBorderWidth&&t.textBorderColor)}function ni(t,e,i,n,o,a,r){var s=i.textBackgroundColor,l=i.textBorderWidth,u=i.textBorderColor,h=_(s);if(ri(e,"shadowBlur",i.textBoxShadowBlur||0),ri(e,"shadowColor",i.textBoxShadowColor||"transparent"),ri(e,"shadowOffsetX",i.textBoxShadowOffsetX||0),ri(e,"shadowOffsetY",i.textBoxShadowOffsetY||0),h||l&&u){e.beginPath();var c=i.textBorderRadius;c?je(e,{x:n,y:o,width:a,height:r,r:c}):e.rect(n,o,a,r),e.closePath()}if(h)if(ri(e,"fillStyle",s),null!=i.fillOpacity){f=e.globalAlpha;e.globalAlpha=i.fillOpacity*i.opacity,e.fill(),e.globalAlpha=f}else e.fill();else if(w(s)){var d=s.image;(d=Ae(d,null,t,oi,s))&&Ce(d)&&e.drawImage(d,n,o,a,r)}if(l&&u)if(ri(e,"lineWidth",l),ri(e,"strokeStyle",u),null!=i.strokeOpacity){var f=e.globalAlpha;e.globalAlpha=i.strokeOpacity*i.opacity,e.stroke(),e.globalAlpha=f}else e.stroke()}function oi(t,e){e.image=t}function ai(t,e,i){var n=e.x||0,o=e.y||0,a=e.textAlign,r=e.textVerticalAlign;if(i){var s=e.textPosition;if(s instanceof Array)n=i.x+ui(s[0],i.width),o=i.y+ui(s[1],i.height);else{var l=Re(s,i,e.textDistance);n=l.x,o=l.y,a=a||l.textAlign,r=r||l.textVerticalAlign}var u=e.textOffset;u&&(n+=u[0],o+=u[1])}return{baseX:n,baseY:o,textAlign:a,textVerticalAlign:r}}function ri(t,e,i){return t[e]=ab(t,e,i),t[e]}function si(t,e){return null==t||e<=0||"transparent"===t||"none"===t?null:t.image||t.colorStops?"#000":t}function li(t){return null==t||"none"===t?null:t.image||t.colorStops?"#000":t}function ui(t,e){return"string"==typeof t?t.lastIndexOf("%")>=0?parseFloat(t)/100*e:parseFloat(t):t}function hi(t,e,i){return"right"===e?t-i[1]:"center"===e?t+i[3]/2-i[1]/2:t+i[3]}function ci(t,e){return null!=t&&(t||e.textBackgroundColor||e.textBorderWidth&&e.textBorderColor||e.textPadding)}function di(t){t=t||{},Kw.call(this,t);for(var e in t)t.hasOwnProperty(e)&&"style"!==e&&(this[e]=t[e]);this.style=new ub(t.style,this),this._rect=null,this.__clipPaths=[]}function fi(t){di.call(this,t)}function pi(t){return parseInt(t,10)}function gi(t){return!!t&&(!!t.__builtin__||"function"==typeof t.resize&&"function"==typeof t.refresh)}function mi(t,e,i){return Cb.copy(t.getBoundingRect()),t.transform&&Cb.applyTransform(t.transform),Lb.width=e,Lb.height=i,!Cb.intersect(Lb)}function vi(t,e){if(t===e)return!1;if(!t||!e||t.length!==e.length)return!0;for(var i=0;i=i.length&&i.push({option:t})}}),i}function Ni(t){var e=R();Zb(t,function(t,i){var n=t.exist;n&&e.set(n.id,t)}),Zb(t,function(t,i){var n=t.option;k(!n||null==n.id||!e.get(n.id)||e.get(n.id)===t,"id duplicates: "+(n&&n.id)),n&&null!=n.id&&e.set(n.id,t),!t.keyInfo&&(t.keyInfo={})}),Zb(t,function(t,i){var n=t.exist,o=t.option,a=t.keyInfo;if(Ub(o)){if(a.name=null!=o.name?o.name+"":n?n.name:jb+i,n)a.id=n.id;else if(null!=o.id)a.id=o.id+"";else{var r=0;do{a.id="\0"+a.name+"\0"+r++}while(e.get(a.id))}e.set(a.id,t)}})}function Oi(t){var e=t.name;return!(!e||!e.indexOf(jb))}function Ei(t){return Ub(t)&&t.id&&0===(t.id+"").indexOf("\0_ec_\0")}function Ri(t,e){function i(t,e,i){for(var n=0,o=t.length;n-rS&&trS||t<-rS}function tn(t,e,i,n,o){var a=1-o;return a*a*(a*t+3*o*e)+o*o*(o*n+3*a*i)}function en(t,e,i,n,o){var a=1-o;return 3*(((e-t)*a+2*(i-e)*o)*a+(n-i)*o*o)}function nn(t,e,i,n,o,a){var r=n+3*(e-i)-t,s=3*(i-2*e+t),l=3*(e-t),u=t-o,h=s*s-3*r*l,c=s*l-9*r*u,d=l*l-3*s*u,f=0;if(Ji(h)&&Ji(c))Ji(s)?a[0]=0:(M=-l/s)>=0&&M<=1&&(a[f++]=M);else{var p=c*c-4*h*d;if(Ji(p)){var g=c/h,m=-g/2;(M=-s/r+g)>=0&&M<=1&&(a[f++]=M),m>=0&&m<=1&&(a[f++]=m)}else if(p>0){var v=aS(p),y=h*s+1.5*r*(-c+v),x=h*s+1.5*r*(-c-v);(M=(-s-((y=y<0?-oS(-y,uS):oS(y,uS))+(x=x<0?-oS(-x,uS):oS(x,uS))))/(3*r))>=0&&M<=1&&(a[f++]=M)}else{var _=(2*h*s-3*r*c)/(2*aS(h*h*h)),w=Math.acos(_)/3,b=aS(h),S=Math.cos(w),M=(-s-2*b*S)/(3*r),m=(-s+b*(S+lS*Math.sin(w)))/(3*r),I=(-s+b*(S-lS*Math.sin(w)))/(3*r);M>=0&&M<=1&&(a[f++]=M),m>=0&&m<=1&&(a[f++]=m),I>=0&&I<=1&&(a[f++]=I)}}return f}function on(t,e,i,n,o){var a=6*i-12*e+6*t,r=9*e+3*n-3*t-9*i,s=3*e-3*t,l=0;if(Ji(r))Qi(a)&&(c=-s/a)>=0&&c<=1&&(o[l++]=c);else{var u=a*a-4*r*s;if(Ji(u))o[0]=-a/(2*r);else if(u>0){var h=aS(u),c=(-a+h)/(2*r),d=(-a-h)/(2*r);c>=0&&c<=1&&(o[l++]=c),d>=0&&d<=1&&(o[l++]=d)}}return l}function an(t,e,i,n,o,a){var r=(e-t)*o+t,s=(i-e)*o+e,l=(n-i)*o+i,u=(s-r)*o+r,h=(l-s)*o+s,c=(h-u)*o+u;a[0]=t,a[1]=r,a[2]=u,a[3]=c,a[4]=c,a[5]=h,a[6]=l,a[7]=n}function rn(t,e,i,n,o,a,r,s,l,u,h){var c,d,f,p,g,m=.005,v=1/0;hS[0]=l,hS[1]=u;for(var y=0;y<1;y+=.05)cS[0]=tn(t,i,o,r,y),cS[1]=tn(e,n,a,s,y),(p=hw(hS,cS))=0&&p=0&&c<=1&&(o[l++]=c);else{var u=r*r-4*a*s;if(Ji(u))(c=-r/(2*a))>=0&&c<=1&&(o[l++]=c);else if(u>0){var h=aS(u),c=(-r+h)/(2*a),d=(-r-h)/(2*a);c>=0&&c<=1&&(o[l++]=c),d>=0&&d<=1&&(o[l++]=d)}}return l}function hn(t,e,i){var n=t+i-2*e;return 0===n?.5:(t-e)/n}function cn(t,e,i,n,o){var a=(e-t)*n+t,r=(i-e)*n+e,s=(r-a)*n+a;o[0]=t,o[1]=a,o[2]=s,o[3]=s,o[4]=r,o[5]=i}function dn(t,e,i,n,o,a,r,s,l){var u,h=.005,c=1/0;hS[0]=r,hS[1]=s;for(var d=0;d<1;d+=.05)cS[0]=sn(t,i,o,d),cS[1]=sn(e,n,a,d),(m=hw(hS,cS))=0&&m1e-4)return s[0]=t-i,s[1]=e-n,l[0]=t+i,void(l[1]=e+n);if(yS[0]=mS(o)*i+t,yS[1]=gS(o)*n+e,xS[0]=mS(a)*i+t,xS[1]=gS(a)*n+e,u(s,yS,xS),h(l,yS,xS),(o%=vS)<0&&(o+=vS),(a%=vS)<0&&(a+=vS),o>a&&!r?a+=vS:oo&&(_S[0]=mS(f)*i+t,_S[1]=gS(f)*n+e,u(s,_S,s),h(l,_S,l))}function yn(t,e,i,n,o,a,r){if(0===o)return!1;var s=o,l=0,u=t;if(r>e+s&&r>n+s||rt+s&&a>i+s||ae+c&&h>n+c&&h>a+c&&h>s+c||ht+c&&u>i+c&&u>o+c&&u>r+c||ue+u&&l>n+u&&l>a+u||lt+u&&s>i+u&&s>o+u||si||h+uo&&(o+=zS);var d=Math.atan2(l,s);return d<0&&(d+=zS),d>=n&&d<=o||d+zS>=n&&d+zS<=o}function Sn(t,e,i,n,o,a){if(a>e&&a>n||ao?r:0}function Mn(t,e){return Math.abs(t-e)e&&u>n&&u>a&&u>s||u1&&In(),c=tn(e,n,a,s,WS[0]),p>1&&(d=tn(e,n,a,s,WS[1]))),2===p?me&&s>n&&s>a||s=0&&u<=1){for(var h=0,c=sn(e,n,a,u),d=0;di||s<-i)return 0;u=Math.sqrt(i*i-s*s);FS[0]=-u,FS[1]=u;var l=Math.abs(n-o);if(l<1e-4)return 0;if(l%VS<1e-4){n=0,o=VS;p=a?1:-1;return r>=FS[0]+t&&r<=FS[1]+t?p:0}if(a){var u=n;n=wn(o),o=wn(u)}else n=wn(n),o=wn(o);n>o&&(o+=VS);for(var h=0,c=0;c<2;c++){var d=FS[c];if(d+t>r){var f=Math.atan2(s,d),p=a?1:-1;f<0&&(f=VS+f),(f>=n&&f<=o||f+VS>=n&&f+VS<=o)&&(f>Math.PI/2&&f<1.5*Math.PI&&(p=-p),h+=p)}}return h}function Cn(t,e,i,n,o){for(var a=0,r=0,s=0,l=0,u=0,h=0;h1&&(i||(a+=Sn(r,s,l,u,n,o))),1===h&&(l=r=t[h],u=s=t[h+1]),c){case BS.M:r=l=t[h++],s=u=t[h++];break;case BS.L:if(i){if(yn(r,s,t[h],t[h+1],e,n,o))return!0}else a+=Sn(r,s,t[h],t[h+1],n,o)||0;r=t[h++],s=t[h++];break;case BS.C:if(i){if(xn(r,s,t[h++],t[h++],t[h++],t[h++],t[h],t[h+1],e,n,o))return!0}else a+=Tn(r,s,t[h++],t[h++],t[h++],t[h++],t[h],t[h+1],n,o)||0;r=t[h++],s=t[h++];break;case BS.Q:if(i){if(_n(r,s,t[h++],t[h++],t[h],t[h+1],e,n,o))return!0}else a+=An(r,s,t[h++],t[h++],t[h],t[h+1],n,o)||0;r=t[h++],s=t[h++];break;case BS.A:var d=t[h++],f=t[h++],p=t[h++],g=t[h++],m=t[h++],v=t[h++];h+=1;var y=1-t[h++],x=Math.cos(m)*p+d,_=Math.sin(m)*g+f;h>1?a+=Sn(r,s,x,_,n,o):(l=x,u=_);var w=(n-d)*g/p+d;if(i){if(bn(d,f,g,m,m+v,y,e,w,o))return!0}else a+=Dn(d,f,g,m,m+v,y,w,o);r=Math.cos(m+v)*p+d,s=Math.sin(m+v)*g+f;break;case BS.R:l=r=t[h++],u=s=t[h++];var x=l+t[h++],_=u+t[h++];if(i){if(yn(l,u,x,u,e,n,o)||yn(x,u,x,_,e,n,o)||yn(x,_,l,_,e,n,o)||yn(l,_,l,u,e,n,o))return!0}else a+=Sn(x,u,x,_,n,o),a+=Sn(l,_,l,u,n,o);break;case BS.Z:if(i){if(yn(r,s,l,u,e,n,o))return!0}else a+=Sn(r,s,l,u,n,o);r=l,s=u}}return i||Mn(s,u)||(a+=Sn(r,s,l,u,n,o)||0),0!==a}function Ln(t,e,i){return Cn(t,0,!1,e,i)}function kn(t,e,i,n){return Cn(t,e,!0,i,n)}function Pn(t){di.call(this,t),this.path=null}function Nn(t,e,i,n,o,a,r,s,l,u,h){var c=l*(tM/180),d=QS(c)*(t-i)/2+JS(c)*(e-n)/2,f=-1*JS(c)*(t-i)/2+QS(c)*(e-n)/2,p=d*d/(r*r)+f*f/(s*s);p>1&&(r*=$S(p),s*=$S(p));var g=(o===a?-1:1)*$S((r*r*(s*s)-r*r*(f*f)-s*s*(d*d))/(r*r*(f*f)+s*s*(d*d)))||0,m=g*r*f/s,v=g*-s*d/r,y=(t+i)/2+QS(c)*m-JS(c)*v,x=(e+n)/2+JS(c)*m+QS(c)*v,_=nM([1,0],[(d-m)/r,(f-v)/s]),w=[(d-m)/r,(f-v)/s],b=[(-1*d-m)/r,(-1*f-v)/s],S=nM(w,b);iM(w,b)<=-1&&(S=tM),iM(w,b)>=1&&(S=0),0===a&&S>0&&(S-=2*tM),1===a&&S<0&&(S+=2*tM),h.addData(u,y,x,r,s,_,S,c,a)}function On(t){if(!t)return new ES;for(var e,i=0,n=0,o=i,a=n,r=new ES,s=ES.CMD,l=t.match(oM),u=0;u=2){if(o&&"spline"!==o){var a=fM(n,o,i,e.smoothConstraint);t.moveTo(n[0][0],n[0][1]);for(var r=n.length,s=0;s<(i?r:r-1);s++){var l=a[2*s],u=a[2*s+1],h=n[(s+1)%r];t.bezierCurveTo(l[0],l[1],u[0],u[1],h[0],h[1])}}else{"spline"===o&&(n=dM(n,i)),t.moveTo(n[0][0],n[0][1]);for(var s=1,c=n.length;s=0)?(i={textFill:null,textStroke:t.textStroke,textStrokeWidth:t.textStrokeWidth},t.textFill="#fff",null==t.textStroke&&(t.textStroke=a,null==t.textStrokeWidth&&(t.textStrokeWidth=2))):null!=a&&(i={textFill:null},t.textFill=a),i&&(t.insideRollback=i)}}function bo(t){var e=t.insideRollback;e&&(t.textFill=e.textFill,t.textStroke=e.textStroke,t.textStrokeWidth=e.textStrokeWidth,t.insideRollback=null)}function So(t,e){var i=e||e.getModel("textStyle");return P([t.fontStyle||i&&i.getShallow("fontStyle")||"",t.fontWeight||i&&i.getShallow("fontWeight")||"",(t.fontSize||i&&i.getShallow("fontSize")||12)+"px",t.fontFamily||i&&i.getShallow("fontFamily")||"sans-serif"].join(" "))}function Mo(t,e,i,n,o,a){if("function"==typeof o&&(a=o,o=null),n&&n.isAnimationEnabled()){var r=t?"Update":"",s=n.getShallow("animationDuration"+r),l=n.getShallow("animationEasing"+r),u=n.getShallow("animationDelay"+r);"function"==typeof u&&(u=u(o,n.getAnimationDelayParams?n.getAnimationDelayParams(e,o):null)),"function"==typeof s&&(s=s(o)),s>0?e.animateTo(i,s,u||0,l,a,!!a):(e.stopAnimation(),e.attr(i),a&&a())}else e.stopAnimation(),e.attr(i),a&&a()}function Io(t,e,i,n,o){Mo(!0,t,e,i,n,o)}function To(t,e,i,n,o){Mo(!1,t,e,i,n,o)}function Ao(t,e){for(var i=_t([]);t&&t!==e;)bt(i,t.getLocalTransform(),i),t=t.parent;return i}function Do(t,e,i){return e&&!c(e)&&(e=Tw.getLocalTransform(e)),i&&(e=Tt([],e)),Q([],t,e)}function Co(t,e,i){var n=0===e[4]||0===e[5]||0===e[0]?1:Math.abs(2*e[4]/e[0]),o=0===e[4]||0===e[5]||0===e[2]?1:Math.abs(2*e[4]/e[2]),a=["left"===t?-n:"right"===t?n:0,"top"===t?-o:"bottom"===t?o:0];return a=Do(a,e,i),Math.abs(a[0])>Math.abs(a[1])?a[0]>0?"right":"left":a[1]>0?"bottom":"top"}function Lo(t,e,i,n){function o(t){var e={position:F(t.position),rotation:t.rotation};return t.shape&&(e.shape=a({},t.shape)),e}if(t&&e){var r=function(t){var e={};return t.traverse(function(t){!t.isGroup&&t.anid&&(e[t.anid]=t)}),e}(t);e.traverse(function(t){if(!t.isGroup&&t.anid){var e=r[t.anid];if(e){var n=o(t);t.attr(o(e)),Io(t,n,i,t.dataIndex)}}})}}function ko(t,e){return f(t,function(t){var i=t[0];i=LM(i,e.x),i=kM(i,e.x+e.width);var n=t[1];return n=LM(n,e.y),n=kM(n,e.y+e.height),[i,n]})}function Po(t,e,i){var n=(e=a({rectHover:!0},e)).style={strokeNoScale:!0};if(i=i||{x:-1,y:-1,width:2,height:2},t)return 0===t.indexOf("image://")?(n.image=t.slice(8),r(n,i),new fi(e)):Xn(t.replace("path://",""),e,i,"center")}function No(t,e,i){this.parentModel=e,this.ecModel=i,this.option=t}function Oo(t,e,i){for(var n=0;n0){if(t<=e[0])return i[0];if(t>=e[1])return i[1]}else{if(t>=e[0])return i[0];if(t<=e[1])return i[1]}else{if(t===e[0])return i[0];if(t===e[1])return i[1]}return(t-e[0])/o*a+i[0]}function Vo(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return"string"==typeof t?zo(t).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t}function Go(t,e,i){return null==e&&(e=10),e=Math.min(Math.max(0,e),20),t=(+t).toFixed(e),i?t:+t}function Fo(t){return t.sort(function(t,e){return t-e}),t}function Wo(t){if(t=+t,isNaN(t))return 0;for(var e=1,i=0;Math.round(t*e)/e!==t;)e*=10,i++;return i}function Ho(t){var e=t.toString(),i=e.indexOf("e");if(i>0){var n=+e.slice(i+1);return n<0?-n:0}var o=e.indexOf(".");return o<0?0:e.length-1-o}function Zo(t,e){var i=Math.log,n=Math.LN10,o=Math.floor(i(t[1]-t[0])/n),a=Math.round(i(Math.abs(e[1]-e[0]))/n),r=Math.min(Math.max(-o+a,0),20);return isFinite(r)?r:20}function Uo(t,e,i){if(!t[e])return 0;var n=p(t,function(t,e){return t+(isNaN(e)?0:e)},0);if(0===n)return 0;for(var o=Math.pow(10,i),a=f(t,function(t){return(isNaN(t)?0:t)/n*o*100}),r=100*o,s=f(a,function(t){return Math.floor(t)}),l=p(s,function(t,e){return t+e},0),u=f(a,function(t,e){return t-s[e]});lh&&(h=u[d],c=d);++s[c],u[c]=0,++l}return s[e]/o}function Xo(t){var e=2*Math.PI;return(t%e+e)%e}function jo(t){return t>-UM&&t=-20?+t.toFixed(n<0?-n:0):t}function Jo(t){function e(t,i,n){return t.interval[n]=0}function ta(t){return isNaN(t)?"-":(t=(t+"").split("."))[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:"")}function ea(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()}),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t}function ia(t){return null==t?"":(t+"").replace(KM,function(t,e){return $M[e]})}function na(t,e,i){y(e)||(e=[e]);var n=e.length;if(!n)return"";for(var o=e[0].$vars||[],a=0;a':'':{renderMode:o,content:"{marker"+a+"|} ",style:{color:i}}:""}function ra(t,e){return t+="","0000".substr(0,e-t.length)+t}function sa(t,e,i){"week"!==t&&"month"!==t&&"quarter"!==t&&"half-year"!==t&&"year"!==t||(t="MM-dd\nyyyy");var n=Yo(e),o=i?"UTC":"",a=n["get"+o+"FullYear"](),r=n["get"+o+"Month"]()+1,s=n["get"+o+"Date"](),l=n["get"+o+"Hours"](),u=n["get"+o+"Minutes"](),h=n["get"+o+"Seconds"](),c=n["get"+o+"Milliseconds"]();return t=t.replace("MM",ra(r,2)).replace("M",r).replace("yyyy",a).replace("yy",a%100).replace("dd",ra(s,2)).replace("d",s).replace("hh",ra(l,2)).replace("h",l).replace("mm",ra(u,2)).replace("m",u).replace("ss",ra(h,2)).replace("s",h).replace("SSS",ra(c,3))}function la(t){return t?t.charAt(0).toUpperCase()+t.substr(1):t}function ua(t,e,i,n,o){var a=0,r=0;null==n&&(n=1/0),null==o&&(o=1/0);var s=0;e.eachChild(function(l,u){var h,c,d=l.position,f=l.getBoundingRect(),p=e.childAt(u+1),g=p&&p.getBoundingRect();if("horizontal"===t){var m=f.width+(g?-g.x+f.x:0);(h=a+m)>n||l.newline?(a=0,h=m,r+=s+i,s=f.height):s=Math.max(s,f.height)}else{var v=f.height+(g?-g.y+f.y:0);(c=r+v)>o||l.newline?(a+=s+i,r=0,c=v,s=f.width):s=Math.max(s,f.width)}l.newline||(d[0]=a,d[1]=r,"horizontal"===t?a=h+i:r=c+i)})}function ha(t,e,i){var n=e.width,o=e.height,a=Vo(t.x,n),r=Vo(t.y,o),s=Vo(t.x2,n),l=Vo(t.y2,o);return(isNaN(a)||isNaN(parseFloat(t.x)))&&(a=0),(isNaN(s)||isNaN(parseFloat(t.x2)))&&(s=n),(isNaN(r)||isNaN(parseFloat(t.y)))&&(r=0),(isNaN(l)||isNaN(parseFloat(t.y2)))&&(l=o),i=qM(i||0),{width:Math.max(s-a-i[1]-i[3],0),height:Math.max(l-r-i[0]-i[2],0)}}function ca(t,e,i){i=qM(i||0);var n=e.width,o=e.height,a=Vo(t.left,n),r=Vo(t.top,o),s=Vo(t.right,n),l=Vo(t.bottom,o),u=Vo(t.width,n),h=Vo(t.height,o),c=i[2]+i[0],d=i[1]+i[3],f=t.aspect;switch(isNaN(u)&&(u=n-s-d-a),isNaN(h)&&(h=o-l-c-r),null!=f&&(isNaN(u)&&isNaN(h)&&(f>n/o?u=.8*n:h=.8*o),isNaN(u)&&(u=f*h),isNaN(h)&&(h=u/f)),isNaN(a)&&(a=n-s-u-d),isNaN(r)&&(r=o-l-h-c),t.left||t.right){case"center":a=n/2-u/2-i[3];break;case"right":a=n-u-d}switch(t.top||t.bottom){case"middle":case"center":r=o/2-h/2-i[0];break;case"bottom":r=o-h-c}a=a||0,r=r||0,isNaN(u)&&(u=n-d-a-(s||0)),isNaN(h)&&(h=o-c-r-(l||0));var p=new de(a+i[3],r+i[0],u,h);return p.margin=i,p}function da(t,e,i,n,o){var a=!o||!o.hv||o.hv[0],s=!o||!o.hv||o.hv[1],l=o&&o.boundingMode||"all";if(a||s){var u;if("raw"===l)u="group"===t.type?new de(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(u=t.getBoundingRect(),t.needLocalTransform()){var h=t.getLocalTransform();(u=u.clone()).applyTransform(h)}e=ca(r({width:u.width,height:u.height},e),i,n);var c=t.position,d=a?e.x-u.x:0,f=s?e.y-u.y:0;t.attr("position","raw"===l?[d,f]:[c[0]+d,c[1]+f])}}function fa(t,e){return null!=t[oI[e][0]]||null!=t[oI[e][1]]&&null!=t[oI[e][2]]}function pa(t,e,i){function n(i,n){var r={},l=0,u={},h=0;if(iI(i,function(e){u[e]=t[e]}),iI(i,function(t){o(e,t)&&(r[t]=u[t]=e[t]),a(r,t)&&l++,a(u,t)&&h++}),s[n])return a(e,i[1])?u[i[2]]=null:a(e,i[2])&&(u[i[1]]=null),u;if(2!==h&&l){if(l>=2)return r;for(var c=0;ce)return t[n];return t[i-1]}function ya(t){var e=t.get("coordinateSystem"),i={coordSysName:e,coordSysDims:[],axisMap:R(),categoryAxisMap:R()},n=fI[e];if(n)return n(t,i,i.axisMap,i.categoryAxisMap),i}function xa(t){return"category"===t.get("type")}function _a(t){this.fromDataset=t.fromDataset,this.data=t.data||(t.sourceFormat===vI?{}:[]),this.sourceFormat=t.sourceFormat||yI,this.seriesLayoutBy=t.seriesLayoutBy||_I,this.dimensionsDefine=t.dimensionsDefine,this.encodeDefine=t.encodeDefine&&R(t.encodeDefine),this.startIndex=t.startIndex||0,this.dimensionsDetectCount=t.dimensionsDetectCount}function wa(t){var e=t.option.source,i=yI;if(S(e))i=xI;else if(y(e)){0===e.length&&(i=gI);for(var n=0,o=e.length;n=e:"max"===i?t<=e:t===e}function Xa(t,e){return t.join(",")===e.join(",")}function ja(t,e){AI(e=e||{},function(e,i){if(null!=e){var n=t[i];if(lI.hasClass(i)){e=Di(e);var o=Pi(n=Di(n),e);t[i]=CI(o,function(t){return t.option&&t.exist?LI(t.exist,t.option,!0):t.exist||t.option})}else t[i]=LI(n,e,!0)}})}function Ya(t){var e=t&&t.itemStyle;if(e)for(var i=0,o=OI.length;i=0;p--){var g=t[p];if(s||(d=g.data.rawIndexOf(g.stackedByDimension,c)),d>=0){var m=g.data.getByRawIndex(g.stackResultDimension,d);if(h>=0&&m>0||h<=0&&m<0){h+=m,f=m;break}}}return n[0]=h,n[1]=f,n});r.hostModel.setData(l),e.data=l})}function rr(t,e){_a.isInstance(t)||(t=_a.seriesDataToSource(t)),this._source=t;var i=this._data=t.data,n=t.sourceFormat;n===xI&&(this._offset=0,this._dimSize=e,this._data=i),a(this,GI[n===gI?n+"_"+t.seriesLayoutBy:n])}function sr(){return this._data.length}function lr(t){return this._data[t]}function ur(t){for(var e=0;ee.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function Mr(t,e){d(t.CHANGABLE_METHODS,function(i){t.wrapMethod(i,v(Ir,e))})}function Ir(t){var e=Tr(t);e&&e.setOutputEnd(this.count())}function Tr(t){var e=(t.ecModel||{}).scheduler,i=e&&e.getPipeline(t.uid);if(i){var n=i.currentTask;if(n){var o=n.agentStubMap;o&&(n=o.get(t.uid))}return n}}function Ar(){this.group=new tb,this.uid=Ro("viewChart"),this.renderTask=gr({plan:Lr,reset:kr}),this.renderTask.context={view:this}}function Dr(t,e){if(t&&(t.trigger(e),"group"===t.type))for(var i=0;i=0?n():c=setTimeout(n,-a),u=o};return d.clear=function(){c&&(clearTimeout(c),c=null)},d.debounceNextCall=function(t){l=t},d}function Nr(t,e,i,n){var o=t[e];if(o){var a=o[iT]||o,r=o[oT];if(o[nT]!==i||r!==n){if(null==i||!n)return t[e]=a;(o=t[e]=Pr(a,i,"debounce"===n))[iT]=a,o[oT]=n,o[nT]=i}return o}}function Or(t,e){var i=t[e];i&&i[iT]&&(t[e]=i[iT])}function Er(t,e,i,n){this.ecInstance=t,this.api=e,this.unfinished;var i=this._dataProcessorHandlers=i.slice(),n=this._visualHandlers=n.slice();this._allHandlers=i.concat(n),this._stageTaskMap=R()}function Rr(t,e,i,n,o){function a(t,e){return t.setDirty&&(!t.dirtyMap||t.dirtyMap.get(e.__pipeline.id))}o=o||{};var r;d(e,function(e,s){if(!o.visualType||o.visualType===e.visualType){var l=t._stageTaskMap.get(e.uid),u=l.seriesTaskMap,h=l.overallTask;if(h){var c,d=h.agentStubMap;d.each(function(t){a(o,t)&&(t.dirty(),c=!0)}),c&&h.dirty(),hT(h,n);var f=t.getPerformArgs(h,o.block);d.each(function(t){t.perform(f)}),r|=h.perform(f)}else u&&u.each(function(s,l){a(o,s)&&s.dirty();var u=t.getPerformArgs(s,o.block);u.skip=!e.performRawSeries&&i.isSeriesFiltered(s.context.model),hT(s,n),r|=s.perform(u)})}}),t.unfinished|=r}function zr(t,e,i,n,o){function a(i){var a=i.uid,s=r.get(a)||r.set(a,gr({plan:Hr,reset:Zr,count:Xr}));s.context={model:i,ecModel:n,api:o,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:t},jr(t,i,s)}var r=i.seriesTaskMap||(i.seriesTaskMap=R()),s=e.seriesType,l=e.getTargetSeries;e.createOnAllSeries?n.eachRawSeries(a):s?n.eachRawSeriesByType(s,a):l&&l(n,o).each(a);var u=t._pipelineMap;r.each(function(t,e){u.get(e)||(t.dispose(),r.removeKey(e))})}function Br(t,e,i,n,o){function a(e){var i=e.uid,n=s.get(i);n||(n=s.set(i,gr({reset:Gr,onDirty:Wr})),r.dirty()),n.context={model:e,overallProgress:h,modifyOutputEnd:c},n.agent=r,n.__block=h,jr(t,e,n)}var r=i.overallTask=i.overallTask||gr({reset:Vr});r.context={ecModel:n,api:o,overallReset:e.overallReset,scheduler:t};var s=r.agentStubMap=r.agentStubMap||R(),l=e.seriesType,u=e.getTargetSeries,h=!0,c=e.modifyOutputEnd;l?n.eachRawSeriesByType(l,a):u?u(n,o).each(a):(h=!1,d(n.getSeries(),a));var f=t._pipelineMap;s.each(function(t,e){f.get(e)||(t.dispose(),r.dirty(),s.removeKey(e))})}function Vr(t){t.overallReset(t.ecModel,t.api,t.payload)}function Gr(t,e){return t.overallProgress&&Fr}function Fr(){this.agent.dirty(),this.getDownstream().dirty()}function Wr(){this.agent&&this.agent.dirty()}function Hr(t){return t.plan&&t.plan(t.model,t.ecModel,t.api,t.payload)}function Zr(t){t.useClearVisual&&t.data.clearAllVisual();var e=t.resetDefines=Di(t.reset(t.model,t.ecModel,t.api,t.payload));return e.length>1?f(e,function(t,e){return Ur(e)}):cT}function Ur(t){return function(e,i){var n=i.data,o=i.resetDefines[t];if(o&&o.dataEach)for(var a=e.start;a0?parseInt(n,10)/100:n?parseFloat(n):0;var o=i.getAttribute("stop-color")||"#000000";e.addColorStop(n,o)}i=i.nextSibling}}function Qr(t,e){t&&t.__inheritedStyle&&(e.__inheritedStyle||(e.__inheritedStyle={}),r(e.__inheritedStyle,t.__inheritedStyle))}function ts(t){for(var e=P(t).split(_T),i=[],n=0;n0;a-=2){var r=o[a],s=o[a-1];switch(n=n||xt(),s){case"translate":r=P(r).split(_T),St(n,n,[parseFloat(r[0]),parseFloat(r[1]||0)]);break;case"scale":r=P(r).split(_T),It(n,n,[parseFloat(r[0]),parseFloat(r[1]||r[0])]);break;case"rotate":r=P(r).split(_T),Mt(n,n,parseFloat(r[0]));break;case"skew":r=P(r).split(_T),console.warn("Skew transform is not supported yet");break;case"matrix":r=P(r).split(_T);n[0]=parseFloat(r[0]),n[1]=parseFloat(r[1]),n[2]=parseFloat(r[2]),n[3]=parseFloat(r[3]),n[4]=parseFloat(r[4]),n[5]=parseFloat(r[5])}}e.setLocalTransform(n)}}function os(t){var e=t.getAttribute("style"),i={};if(!e)return i;var n={};TT.lastIndex=0;for(var o;null!=(o=TT.exec(e));)n[o[1]]=o[2];for(var a in ST)ST.hasOwnProperty(a)&&null!=n[a]&&(i[ST[a]]=n[a]);return i}function as(t,e,i){var n=e/t.width,o=i/t.height,a=Math.min(n,o);return{scale:[a,a],position:[-(t.x+t.width/2)*a+e/2,-(t.y+t.height/2)*a+i/2]}}function rs(t,e){return(new $r).parse(t,e)}function ss(t){return function(e,i,n){e=e&&e.toLowerCase(),fw.prototype[t].call(this,e,i,n)}}function ls(){fw.call(this)}function us(t,e,n){function o(t,e){return t.__prio-e.__prio}n=n||{},"string"==typeof e&&(e=JT[e]),this.id,this.group,this._dom=t;var a=this._zr=Ii(t,{renderer:n.renderer||"canvas",devicePixelRatio:n.devicePixelRatio,width:n.width,height:n.height});this._throttledZrFlush=Pr(m(a.flush,a),17),(e=i(e))&&BI(e,!0),this._theme=e,this._chartsViews=[],this._chartsMap={},this._componentsViews=[],this._componentsMap={},this._coordSysMgr=new Fa;var r=this._api=As(this);_e($T,o),_e(YT,o),this._scheduler=new Er(this,r,YT,$T),fw.call(this,this._ecEventProcessor=new Ds),this._messageCenter=new ls,this._initEvents(),this.resize=m(this.resize,this),this._pendingActions=[],a.animation.on("frame",this._onframe,this),vs(a,this),N(this)}function hs(t,e,i){var n,o=this._model,a=this._coordSysMgr.getCoordinateSystems();e=Vi(o,e);for(var r=0;re.get("hoverLayerThreshold")&&!U_.node&&i.traverse(function(t){t.isGroup||(t.useHoverLayer=!0)})}function Is(t,e){var i=t.get("blendMode")||null;e.group.traverse(function(t){t.isGroup||t.style.blend!==i&&t.setStyle("blend",i),t.eachPendingDisplayable&&t.eachPendingDisplayable(function(t){t.setStyle("blend",i)})})}function Ts(t,e){var i=t.get("z"),n=t.get("zlevel");e.group.traverse(function(t){"group"!==t.type&&(null!=i&&(t.z=i),null!=n&&(t.zlevel=n))})}function As(t){var e=t._coordSysMgr;return a(new Ga(t),{getCoordinateSystems:m(e.getCoordinateSystems,e),getComponentByElement:function(e){for(;e;){var i=e.__ecComponentInfo;if(null!=i)return t._model.getComponent(i.mainType,i.index);e=e.parent}}})}function Ds(){this.eventInfo}function Cs(t){function e(t,e){for(var n=0;n65535?dA:pA}function Js(t){var e=t.constructor;return e===Array?t.slice():new e(t)}function Qs(t,e){d(gA.concat(e.__wrappedMethods||[]),function(i){e.hasOwnProperty(i)&&(t[i]=e[i])}),t.__wrappedMethods=e.__wrappedMethods,d(mA,function(n){t[n]=i(e[n])}),t._calculationInfo=a(e._calculationInfo)}function tl(t,e,i,n,o){var a=cA[e.type],r=n-1,s=e.name,l=t[s][r];if(l&&l.length=0?this._indices[t]:-1}function al(t,e){var i=t._idList[e];return null==i&&(i=il(t,t._idDimIdx,e)),null==i&&(i=hA+e),i}function rl(t){return y(t)||(t=[t]),t}function sl(t,e){var i=t.dimensions,n=new vA(f(i,t.getDimensionInfo,t),t.hostModel);Qs(n,t);for(var o=n._storage={},a=t._storage,r=0;r=0?(o[s]=ll(a[s]),n._rawExtent[s]=ul(),n._extent[s]=null):o[s]=a[s])}return n}function ll(t){for(var e=new Array(t.length),i=0;in&&(r=o.interval=n);var s=o.intervalPrecision=Ml(r);return Tl(o.niceTickExtent=[MA(Math.ceil(t[0]/r)*r,s),MA(Math.floor(t[1]/r)*r,s)],t),o}function Ml(t){return Ho(t)+2}function Il(t,e,i){t[e]=Math.max(Math.min(t[e],i[1]),i[0])}function Tl(t,e){!isFinite(t[0])&&(t[0]=e[0]),!isFinite(t[1])&&(t[1]=e[1]),Il(t,0,e),Il(t,1,e),t[0]>t[1]&&(t[0]=t[1])}function Al(t,e,i,n){var o=[];if(!t)return o;e[0]1e4)return[];return e[1]>(o.length?o[o.length-1]:i[1])&&o.push(e[1]),o}function Dl(t){return t.get("stack")||AA+t.seriesIndex}function Cl(t){return t.dim+t.index}function Ll(t){var e=[],i=t.axis;if("category"===i.type){for(var n=i.getBandWidth(),o=0;o=0?"p":"n",b=m;p&&(o[r][_]||(o[r][_]={p:m,n:m}),b=o[r][_][w]);var S,M,I,T;if(g)S=b,M=(A=i.dataToPoint([x,_]))[1]+l,I=A[0]-m,T=u,Math.abs(I)a[1]?(n=a[1],o=a[0]):(n=a[0],o=a[1]);var r=e.toGlobalCoord(e.dataToCoord(0));return ro&&(r=o),r}function Vl(t,e){return VA(t,BA(e))}function Gl(t,e){var i,n,o,a=t.type,r=e.getMin(),s=e.getMax(),l=null!=r,u=null!=s,h=t.getExtent();"ordinal"===a?i=e.getCategories().length:(y(n=e.get("boundaryGap"))||(n=[n||0,n||0]),"boolean"==typeof n[0]&&(n=[0,0]),n[0]=Vo(n[0],1),n[1]=Vo(n[1],1),o=h[1]-h[0]||Math.abs(h[0])),null==r&&(r="ordinal"===a?i?0:NaN:h[0]-n[0]*o),null==s&&(s="ordinal"===a?i?i-1:NaN:h[1]+n[1]*o),"dataMin"===r?r=h[0]:"function"==typeof r&&(r=r({min:h[0],max:h[1]})),"dataMax"===s?s=h[1]:"function"==typeof s&&(s=s({min:h[0],max:h[1]})),(null==r||!isFinite(r))&&(r=NaN),(null==s||!isFinite(s))&&(s=NaN),t.setBlank(I(r)||I(s)||"ordinal"===a&&!t.getOrdinalMeta().categories.length),e.getNeedCrossZero()&&(r>0&&s>0&&!l&&(r=0),r<0&&s<0&&!u&&(s=0));var c=e.ecModel;if(c&&"time"===a){var f,p=kl("bar",c);if(d(p,function(t){f|=t.getBaseAxis()===e.axis}),f){var g=Pl(p),m=Fl(r,s,e,g);r=m.min,s=m.max}}return[r,s]}function Fl(t,e,i,n){var o=i.axis.getExtent(),a=o[1]-o[0],r=Ol(n,i.axis);if(void 0===r)return{min:t,max:e};var s=1/0;d(r,function(t){s=Math.min(t.offset,s)});var l=-1/0;d(r,function(t){l=Math.max(t.offset+t.width,l)}),s=Math.abs(s),l=Math.abs(l);var u=s+l,h=e-t,c=h/(1-(s+l)/a)-h;return e+=c*(l/u),t-=c*(s/u),{min:t,max:e}}function Wl(t,e){var i=Gl(t,e),n=null!=e.getMin(),o=null!=e.getMax(),a=e.get("splitNumber");"log"===t.type&&(t.base=e.get("logBase"));var r=t.type;t.setExtent(i[0],i[1]),t.niceExtent({splitNumber:a,fixMin:n,fixMax:o,minInterval:"interval"===r||"time"===r?e.get("minInterval"):null,maxInterval:"interval"===r||"time"===r?e.get("maxInterval"):null});var s=e.get("interval");null!=s&&t.setInterval&&t.setInterval(s)}function Hl(t,e){if(e=e||t.get("type"))switch(e){case"category":return new SA(t.getOrdinalMeta?t.getOrdinalMeta():t.getCategories(),[1/0,-1/0]);case"value":return new TA;default:return(xl.getClass(e)||TA).create(t)}}function Zl(t){var e=t.scale.getExtent(),i=e[0],n=e[1];return!(i>0&&n>0||i<0&&n<0)}function Ul(t){var e=t.getLabelModel().get("formatter"),i="category"===t.type?t.scale.getExtent()[0]:null;return"string"==typeof e?e=function(e){return function(i){return i=t.scale.getLabel(i),e.replace("{value}",null!=i?i:"")}}(e):"function"==typeof e?function(n,o){return null!=i&&(o=n-i),e(Xl(t,n),o)}:function(e){return t.scale.getLabel(e)}}function Xl(t,e){return"category"===t.type?t.scale.getLabel(e):e}function jl(t){var e=t.model,i=t.scale;if(e.get("axisLabel.show")&&!i.isBlank()){var n,o,a="category"===t.type,r=i.getExtent();o=a?i.count():(n=i.getTicks()).length;var s,l=t.getLabelModel(),u=Ul(t),h=1;o>40&&(h=Math.ceil(o/40));for(var c=0;c>1^-(1&s),l=l>>1^-(1&l),o=s+=o,a=l+=a,n.push([s/i,l/i])}return n}function ou(t){return"category"===t.type?ru(t):uu(t)}function au(t,e){return"category"===t.type?lu(t,e):{ticks:t.scale.getTicks()}}function ru(t){var e=t.getLabelModel(),i=su(t,e);return!e.get("show")||t.scale.isBlank()?{labels:[],labelCategoryInterval:i.labelCategoryInterval}:i}function su(t,e){var i=hu(t,"labels"),n=ql(e),o=cu(i,n);if(o)return o;var a,r;return a=x(n)?vu(t,n):mu(t,r="auto"===n?fu(t):n),du(i,n,{labels:a,labelCategoryInterval:r})}function lu(t,e){var i=hu(t,"ticks"),n=ql(e),o=cu(i,n);if(o)return o;var a,r;if(e.get("show")&&!t.scale.isBlank()||(a=[]),x(n))a=vu(t,n,!0);else if("auto"===n){var s=su(t,t.getLabelModel());r=s.labelCategoryInterval,a=f(s.labels,function(t){return t.tickValue})}else a=mu(t,r=n,!0);return du(i,n,{ticks:a,tickCategoryInterval:r})}function uu(t){var e=t.scale.getTicks(),i=Ul(t);return{labels:f(e,function(e,n){return{formattedLabel:i(e,n),rawLabel:t.scale.getLabel(e),tickValue:e}})}}function hu(t,e){return nD(t)[e]||(nD(t)[e]=[])}function cu(t,e){for(var i=0;i40&&(s=Math.max(1,Math.floor(r/40)));for(var l=a[0],u=t.dataToCoord(l+1)-t.dataToCoord(l),h=Math.abs(u*Math.cos(n)),c=Math.abs(u*Math.sin(n)),d=0,f=0;l<=a[1];l+=s){var p=0,g=0,m=ke(i(l),e.font,"center","top");p=1.3*m.width,g=1.3*m.height,d=Math.max(d,p,7),f=Math.max(f,g,7)}var v=d/h,y=f/c;isNaN(v)&&(v=1/0),isNaN(y)&&(y=1/0);var x=Math.max(0,Math.floor(Math.min(v,y))),_=nD(t.model),w=_.lastAutoInterval,b=_.lastTickCount;return null!=w&&null!=b&&Math.abs(w-x)<=1&&Math.abs(b-r)<=1&&w>x?x=w:(_.lastTickCount=r,_.lastAutoInterval=x),x}function gu(t){var e=t.getLabelModel();return{axisRotate:t.getRotate?t.getRotate():t.isHorizontal&&!t.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}function mu(t,e,i){function n(t){l.push(i?t:{formattedLabel:o(t),rawLabel:a.getLabel(t),tickValue:t})}var o=Ul(t),a=t.scale,r=a.getExtent(),s=t.getLabelModel(),l=[],u=Math.max((e||0)+1,1),h=r[0],c=a.count();0!==h&&u>1&&c/u>2&&(h=Math.round(Math.ceil(h/u)*u));var d=Kl(t),f=s.get("showMinLabel")||d,p=s.get("showMaxLabel")||d;f&&h!==r[0]&&n(r[0]);for(var g=h;g<=r[1];g+=u)n(g);return p&&g!==r[1]&&n(r[1]),l}function vu(t,e,i){var n=t.scale,o=Ul(t),a=[];return d(n.getTicks(),function(t){var r=n.getLabel(t);e(t,r)&&a.push(i?t:{formattedLabel:o(t),rawLabel:r,tickValue:t})}),a}function yu(t,e){var i=(t[1]-t[0])/e/2;t[0]+=i,t[1]-=i}function xu(t,e,i,n,o){function a(t,e){return h?t>e:t0&&(t.coord-=u/(2*(e+1)))}),s={coord:e[r-1].coord+u},e.push(s)}var h=l[0]>l[1];a(e[0].coord,l[0])&&(o?e[0].coord=l[0]:e.shift()),o&&a(l[0],e[0].coord)&&e.unshift({coord:l[0]}),a(l[1],s.coord)&&(o?s.coord=l[1]:e.pop()),o&&a(s.coord,l[1])&&e.push({coord:l[1]})}}function _u(t,e){var i=t.mapDimension("defaultedLabel",!0),n=i.length;if(1===n)return fr(t,e,i[0]);if(n){for(var o=[],a=0;a0?i=n[0]:n[1]<0&&(i=n[1]),i}function Ou(t,e,i,n){var o=NaN;t.stacked&&(o=i.get(i.getCalculationInfo("stackedOverDimension"),n)),isNaN(o)&&(o=t.valueStart);var a=t.baseDataOffset,r=[];return r[a]=i.get(t.baseDim,n),r[1-a]=o,e.dataToPoint(r)}function Eu(t,e){var i=[];return e.diff(t).add(function(t){i.push({cmd:"+",idx:t})}).update(function(t,e){i.push({cmd:"=",idx:e,idx1:t})}).remove(function(t){i.push({cmd:"-",idx:t})}).execute(),i}function Ru(t){return isNaN(t[0])||isNaN(t[1])}function zu(t,e,i,n,o,a,r,s,l,u,h){return"none"!==u&&u?Bu.apply(this,arguments):Vu.apply(this,arguments)}function Bu(t,e,i,n,o,a,r,s,l,u,h){for(var c=0,d=i,f=0;f=o||d<0)break;if(Ru(p)){if(h){d+=a;continue}break}if(d===i)t[a>0?"moveTo":"lineTo"](p[0],p[1]);else if(l>0){var g=e[c],m="y"===u?1:0,v=(p[m]-g[m])*l;_D(bD,g),bD[m]=g[m]+v,_D(SD,p),SD[m]=p[m]-v,t.bezierCurveTo(bD[0],bD[1],SD[0],SD[1],p[0],p[1])}else t.lineTo(p[0],p[1]);c=d,d+=a}return f}function Vu(t,e,i,n,o,a,r,s,l,u,h){for(var c=0,d=i,f=0;f=o||d<0)break;if(Ru(p)){if(h){d+=a;continue}break}if(d===i)t[a>0?"moveTo":"lineTo"](p[0],p[1]),_D(bD,p);else if(l>0){var g=d+a,m=e[g];if(h)for(;m&&Ru(e[g]);)m=e[g+=a];var v=.5,y=e[c];if(!(m=e[g])||Ru(m))_D(SD,p);else{Ru(m)&&!h&&(m=p),U(wD,m,y);var x,_;if("x"===u||"y"===u){var w="x"===u?0:1;x=Math.abs(p[w]-y[w]),_=Math.abs(p[w]-m[w])}else x=uw(p,y),_=uw(p,m);xD(SD,p,wD,-l*(1-(v=_/(_+x))))}vD(bD,bD,s),yD(bD,bD,r),vD(SD,SD,s),yD(SD,SD,r),t.bezierCurveTo(bD[0],bD[1],SD[0],SD[1],p[0],p[1]),xD(bD,p,wD,l*v)}else t.lineTo(p[0],p[1]);c=d,d+=a}return f}function Gu(t,e){var i=[1/0,1/0],n=[-1/0,-1/0];if(e)for(var o=0;on[0]&&(n[0]=a[0]),a[1]>n[1]&&(n[1]=a[1])}return{min:e?i:n,max:e?n:i}}function Fu(t,e){if(t.length===e.length){for(var i=0;ie[0]?1:-1;e[0]+=n*i,e[1]-=n*i}return e}function Zu(t,e,i){if(!i.valueDim)return[];for(var n=[],o=0,a=e.count();oa[1]&&a.reverse();var r=o.getExtent(),s=Math.PI/180;i&&(a[0]-=.5,a[1]+=.5);var l=new hM({shape:{cx:Go(t.cx,1),cy:Go(t.cy,1),r0:Go(a[0],1),r:Go(a[1],1),startAngle:-r[0]*s,endAngle:-r[1]*s,clockwise:o.inverse}});return e&&(l.shape.endAngle=-r[0]*s,To(l,{shape:{endAngle:-r[1]*s}},n)),l}function ju(t,e,i,n){return"polar"===t.type?Xu(t,e,i,n):Uu(t,e,i,n)}function Yu(t,e,i){for(var n=e.getBaseAxis(),o="x"===n.dim||"radius"===n.dim?0:1,a=[],r=0;r=0;a--){var r=i[a].dimension,s=t.dimensions[r],l=t.getDimensionInfo(s);if("x"===(n=l&&l.coordDim)||"y"===n){o=i[a];break}}if(o){var u=e.getAxis(n),h=f(o.stops,function(t){return{coord:u.toGlobalCoord(u.dataToCoord(t.value)),color:t.color}}),c=h.length,p=o.outerColors.slice();c&&h[0].coord>h[c-1].coord&&(h.reverse(),p.reverse());var g=h[0].coord-10,m=h[c-1].coord+10,v=m-g;if(v<.001)return"transparent";d(h,function(t){t.offset=(t.coord-g)/v}),h.push({offset:c?h[c-1].offset:.5,color:p[1]||"transparent"}),h.unshift({offset:c?h[0].offset:.5,color:p[0]||"transparent"});var y=new TM(0,0,0,0,h,!0);return y[n]=g,y[n+"2"]=m,y}}}function Ku(t,e,i){var n=t.get("showAllSymbol"),o="auto"===n;if(!n||o){var a=i.getAxesByScale("ordinal")[0];if(a&&(!o||!$u(a,e))){var r=e.mapDimension(a.dim),s={};return d(a.getViewLabels(),function(t){s[t.tickValue]=1}),function(t){return!s.hasOwnProperty(e.get(r,t))}}}}function $u(t,e){var i=t.getExtent(),n=Math.abs(i[1]-i[0])/t.scale.count();isNaN(n)&&(n=0);for(var o=e.count(),a=Math.max(1,Math.round(o/5)),r=0;rn)return!1;return!0}function Ju(t){return this._axes[t]}function Qu(t){LD.call(this,t)}function th(t,e){return e.type||(e.data?"category":"value")}function eh(t,e,i){return t.getCoordSysModel()===e}function ih(t,e,i){this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this._initCartesian(t,e,i),this.model=t}function nh(t,e,i,n){function o(t){return t.dim+"_"+t.index}i.getAxesOnZeroOf=function(){return a?[a]:[]};var a,r=t[e],s=i.model,l=s.get("axisLine.onZero"),u=s.get("axisLine.onZeroAxisIndex");if(l){if(null!=u)oh(r[u])&&(a=r[u]);else for(var h in r)if(r.hasOwnProperty(h)&&oh(r[h])&&!n[o(r[h])]){a=r[h];break}a&&(n[o(a)]=!0)}}function oh(t){return t&&"category"!==t.type&&"time"!==t.type&&Zl(t)}function ah(t,e){var i=t.getExtent(),n=i[0]+i[1];t.toGlobalCoord="x"===t.dim?function(t){return t+e}:function(t){return n-t+e},t.toLocalCoord="x"===t.dim?function(t){return t-e}:function(t){return n-t+e}}function rh(t,e){return f(VD,function(e){return t.getReferringComponents(e)[0]})}function sh(t){return"cartesian2d"===t.get("coordinateSystem")}function lh(t){var e={componentType:t.mainType,componentIndex:t.componentIndex};return e[t.mainType+"Index"]=t.componentIndex,e}function uh(t,e,i,n){var o,a,r=Xo(i-t.rotation),s=n[0]>n[1],l="start"===e&&!s||"start"!==e&&s;return jo(r-GD/2)?(a=l?"bottom":"top",o="center"):jo(r-1.5*GD)?(a=l?"top":"bottom",o="center"):(a="middle",o=r<1.5*GD&&r>GD/2?l?"left":"right":l?"right":"left"),{rotation:r,textAlign:o,textVerticalAlign:a}}function hh(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)}function ch(t,e,i){if(!Kl(t.axis)){var n=t.get("axisLabel.showMinLabel"),o=t.get("axisLabel.showMaxLabel");e=e||[],i=i||[];var a=e[0],r=e[1],s=e[e.length-1],l=e[e.length-2],u=i[0],h=i[1],c=i[i.length-1],d=i[i.length-2];!1===n?(dh(a),dh(u)):fh(a,r)&&(n?(dh(r),dh(h)):(dh(a),dh(u))),!1===o?(dh(s),dh(c)):fh(l,s)&&(o?(dh(l),dh(d)):(dh(s),dh(c)))}}function dh(t){t&&(t.ignore=!0)}function fh(t,e,i){var n=t&&t.getBoundingRect().clone(),o=e&&e.getBoundingRect().clone();if(n&&o){var a=_t([]);return Mt(a,a,-t.rotation),n.applyTransform(bt([],a,t.getLocalTransform())),o.applyTransform(bt([],a,e.getLocalTransform())),n.intersect(o)}}function ph(t){return"middle"===t||"center"===t}function gh(t,e,i){var n=e.axis;if(e.get("axisTick.show")&&!n.scale.isBlank()){for(var o=e.getModel("axisTick"),a=o.getModel("lineStyle"),s=o.get("length"),l=n.getTicksCoords(),u=[],h=[],c=t._transform,d=[],f=0;f=0||t===e}function Sh(t){var e=Mh(t);if(e){var i=e.axisPointerModel,n=e.axis.scale,o=i.option,a=i.get("status"),r=i.get("value");null!=r&&(r=n.parse(r));var s=Th(i);null==a&&(o.status=s?"show":"hide");var l=n.getExtent().slice();l[0]>l[1]&&l.reverse(),(null==r||r>l[1])&&(r=l[1]),r0?"bottom":"top":o.width>0?"left":"right";l||kh(t.style,d,n,u,a,i,p),fo(t,d)}function Rh(t,e){var i=t.get(tC)||0;return Math.min(i,Math.abs(e.width),Math.abs(e.height))}function zh(t,e,i){var n=t.getData(),o=[],a=n.getLayout("valueAxisHorizontal")?1:0;o[1-a]=n.getLayout("valueAxisStart");var r=new nC({shape:{points:n.getLayout("largePoints")},incremental:!!i,__startPoint:o,__valueIdx:a});e.add(r),Bh(r,t,n)}function Bh(t,e,i){var n=i.getVisual("borderColor")||i.getVisual("color"),o=e.getModel("itemStyle").getItemStyle(["color","borderColor"]);t.useStyle(o),t.style.fill=null,t.style.stroke=n,t.style.lineWidth=i.getLayout("barWidth")}function Vh(t,e,i,n){var o=e.getData(),a=this.dataIndex,r=o.getName(a),s=e.get("selectedOffset");n.dispatchAction({type:"pieToggleSelect",from:t,name:r,seriesId:e.id}),o.each(function(t){Gh(o.getItemGraphicEl(t),o.getItemLayout(t),e.isSelected(o.getName(t)),s,i)})}function Gh(t,e,i,n,o){var a=(e.startAngle+e.endAngle)/2,r=Math.cos(a),s=Math.sin(a),l=i?n:0,u=[r*l,s*l];o?t.animate().when(200,{position:u}).start("bounceOut"):t.attr("position",u)}function Fh(t,e){function i(){a.ignore=a.hoverIgnore,r.ignore=r.hoverIgnore}function n(){a.ignore=a.normalIgnore,r.ignore=r.normalIgnore}tb.call(this);var o=new hM({z2:2}),a=new gM,r=new rM;this.add(o),this.add(a),this.add(r),this.updateData(t,e,!0),this.on("emphasis",i).on("normal",n).on("mouseover",i).on("mouseout",n)}function Wh(t,e,i,n,o,a,r){function s(e,i){for(var n=e;n>=0&&(t[n].y-=i,!(n>0&&t[n].y>t[n-1].y+t[n-1].height));n--);}function l(t,e,i,n,o,a){for(var r=e?Number.MAX_VALUE:0,s=0,l=t.length;s=r&&(d=r-10),!e&&d<=r&&(d=r+10),t[s].x=i+d*a,r=d}}t.sort(function(t,e){return t.y-e.y});for(var u,h=0,c=t.length,d=[],f=[],p=0;pe&&a+1t[a].y+t[a].height)return void s(a,n/2);s(i-1,n/2)}(p,c,-u),h=t[p].y+t[p].height;r-h<0&&s(c-1,h-r);for(p=0;p=i?f.push(t[p]):d.push(t[p]);l(d,!1,e,i,n,o),l(f,!0,e,i,n,o)}function Hh(t,e,i,n,o,a){for(var r=[],s=[],l=0;l3?1.4:o>1?1.2:1.1;hc(this,"zoom","zoomOnMouseWheel",t,{scale:n>0?s:1/s,originX:a,originY:r})}if(i){var l=Math.abs(n);hc(this,"scrollMove","moveOnMouseWheel",t,{scrollDelta:(n>0?1:-1)*(l>3?.4:l>1?.15:.05),originX:a,originY:r})}}}function uc(t){ic(this._zr,"globalPan")||hc(this,"zoom",null,t,{scale:t.pinchScale>1?1.1:1/1.1,originX:t.pinchX,originY:t.pinchY})}function hc(t,e,i,n,o){t.pointerChecker&&t.pointerChecker(n,o.originX,o.originY)&&(mw(n.event),cc(t,e,i,n,o))}function cc(t,e,i,n,o){o.isAvailableBehavior=m(dc,null,i,n),t.trigger(e,o)}function dc(t,e,i){var n=i[t];return!t||n&&(!_(n)||e.event[n+"Key"])}function fc(t,e,i){var n=t.target,o=n.position;o[0]+=e,o[1]+=i,n.dirty()}function pc(t,e,i,n){var o=t.target,a=t.zoomLimit,r=o.position,s=o.scale,l=t.zoom=t.zoom||1;if(l*=e,a){var u=a.min||0,h=a.max||1/0;l=Math.max(Math.min(h,l),u)}var c=l/t.zoom;t.zoom=l,r[0]-=(i-r[0])*(c-1),r[1]-=(n-r[1])*(c-1),s[0]*=c,s[1]*=c,o.dirty()}function gc(t,e,i){var n=e.getComponentByElement(t.topTarget),o=n&&n.coordinateSystem;return n&&n!==i&&!RC[n.mainType]&&o&&o.model!==i}function mc(t,e){var i=t.getItemStyle(),n=t.get("areaColor");return null!=n&&(i.fill=n),i}function vc(t,e,i,n,o){i.off("click"),i.off("mousedown"),e.get("selectedMode")&&(i.on("mousedown",function(){t._mouseDownFlag=!0}),i.on("click",function(a){if(t._mouseDownFlag){t._mouseDownFlag=!1;for(var r=a.target;!r.__regions;)r=r.parent;if(r){var s={type:("geo"===e.mainType?"geo":"map")+"ToggleSelect",batch:f(r.__regions,function(t){return{name:t.name,from:o.uid}})};s[e.mainType+"Id"]=e.id,n.dispatchAction(s),yc(e,i)}}}))}function yc(t,e){e.eachChild(function(e){d(e.__regions,function(i){e.trigger(t.isSelected(i.name)?"emphasis":"normal")})})}function xc(t,e){var i=new tb;this.uid=Ro("ec_map_draw"),this._controller=new oc(t.getZr()),this._controllerHost={target:e?i:null},this.group=i,this._updateGroup=e,this._mouseDownFlag,this._mapName,this._initialized,i.add(this._regionsGroup=new tb),i.add(this._backgroundGroup=new tb)}function _c(t){var e=this[zC];e&&e.recordVersion===this[BC]&&wc(e,t)}function wc(t,e){var i=t.circle,n=t.labelModel,o=t.hoverLabelModel,a=t.emphasisText,r=t.normalText;e?(i.style.extendFrom(mo({},o,{text:o.get("show")?a:null},{isRectText:!0,useInsideStyle:!1},!0)),i.__mapOriginalZ2=i.z2,i.z2+=NM):(mo(i.style,n,{text:n.get("show")?r:null,textPosition:n.getShallow("position")||"bottom"},{isRectText:!0,useInsideStyle:!1}),i.dirty(!1),null!=i.__mapOriginalZ2&&(i.z2=i.__mapOriginalZ2,i.__mapOriginalZ2=null))}function bc(t,e,i){var n=t.getZoom(),o=t.getCenter(),a=e.zoom,r=t.dataToPoint(o);if(null!=e.dx&&null!=e.dy){r[0]-=e.dx,r[1]-=e.dy;o=t.pointToData(r);t.setCenter(o)}if(null!=a){if(i){var s=i.min||0,l=i.max||1/0;a=Math.max(Math.min(n*a,l),s)/n}t.scale[0]*=a,t.scale[1]*=a;var u=t.position,h=(e.originX-u[0])*(a-1),c=(e.originY-u[1])*(a-1);u[0]-=h,u[1]-=c,t.updateTransform();o=t.pointToData(r);t.setCenter(o),t.setZoom(a*n)}return{center:t.getCenter(),zoom:t.getZoom()}}function Sc(){Tw.call(this)}function Mc(t){this.name=t,this.zoomLimit,Tw.call(this),this._roamTransformable=new Sc,this._rawTransformable=new Sc,this._center,this._zoom}function Ic(t,e,i,n){var o=i.seriesModel,a=o?o.coordinateSystem:null;return a===this?a[t](n):null}function Tc(t,e,i,n){Mc.call(this,t),this.map=e;var o=OC.load(e,i);this._nameCoordMap=o.nameCoordMap,this._regionsMap=o.regionsMap,this._invertLongitute=null==n||n,this.regions=o.regions,this._rect=o.boundingRect}function Ac(t,e,i,n){var o=i.geoModel,a=i.seriesModel,r=o?o.coordinateSystem:a?a.coordinateSystem||(a.getReferringComponents("geo")[0]||{}).coordinateSystem:null;return r===this?r[t](n):null}function Dc(t,e){var i=t.get("boundingCoords");if(null!=i){var n=i[0],o=i[1];isNaN(n[0])||isNaN(n[1])||isNaN(o[0])||isNaN(o[1])||this.setBoundingRect(n[0],n[1],o[0]-n[0],o[1]-n[1])}var a,r=this.getBoundingRect(),s=t.get("layoutCenter"),l=t.get("layoutSize"),u=e.getWidth(),h=e.getHeight(),c=r.width/r.height*this.aspectScale,d=!1;s&&l&&(s=[Vo(s[0],u),Vo(s[1],h)],l=Vo(l,Math.min(u,h)),isNaN(s[0])||isNaN(s[1])||isNaN(l)||(d=!0));if(d){var f={};c>1?(f.width=l,f.height=l/c):(f.height=l,f.width=l*c),f.y=s[1]-f.height/2,f.x=s[0]-f.width/2}else(a=t.getBoxLayoutParams()).aspect=c,f=ca(a,{width:u,height:h});this.setViewRect(f.x,f.y,f.width,f.height),this.setCenter(t.get("center")),this.setZoom(t.get("zoom"))}function Cc(t,e){d(e.get("geoCoord"),function(e,i){t.addGeoCoord(i,e)})}function Lc(t,e){var i={};return d(t,function(t){t.each(t.mapDimension("value"),function(e,n){var o="ec-"+t.getName(n);i[o]=i[o]||[],isNaN(e)||i[o].push(e)})}),t[0].map(t[0].mapDimension("value"),function(n,o){for(var a="ec-"+t[0].getName(o),r=0,s=1/0,l=-1/0,u=i[a].length,h=0;h=0;o--){var a=i[o];a.hierNode={defaultAncestor:null,ancestor:a,prelim:0,modifier:0,change:0,shift:0,i:o,thread:null},n.push(a)}}function Wc(t,e){var i=t.isExpand?t.children:[],n=t.parentNode.children,o=t.hierNode.i?n[t.hierNode.i-1]:null;if(i.length){jc(t);var a=(i[0].hierNode.prelim+i[i.length-1].hierNode.prelim)/2;o?(t.hierNode.prelim=o.hierNode.prelim+e(t,o),t.hierNode.modifier=t.hierNode.prelim-a):t.hierNode.prelim=a}else o&&(t.hierNode.prelim=o.hierNode.prelim+e(t,o));t.parentNode.hierNode.defaultAncestor=Yc(t,o,t.parentNode.hierNode.defaultAncestor||n[0],e)}function Hc(t){var e=t.hierNode.prelim+t.parentNode.hierNode.modifier;t.setLayout({x:e},!0),t.hierNode.modifier+=t.parentNode.hierNode.modifier}function Zc(t){return arguments.length?t:Qc}function Uc(t,e){var i={};return t-=Math.PI/2,i.x=e*Math.cos(t),i.y=e*Math.sin(t),i}function Xc(t,e){return ca(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function jc(t){for(var e=t.children,i=e.length,n=0,o=0;--i>=0;){var a=e[i];a.hierNode.prelim+=n,a.hierNode.modifier+=n,o+=a.hierNode.change,n+=a.hierNode.shift+o}}function Yc(t,e,i,n){if(e){for(var o=t,a=t,r=a.parentNode.children[0],s=e,l=o.hierNode.modifier,u=a.hierNode.modifier,h=r.hierNode.modifier,c=s.hierNode.modifier;s=qc(s),a=Kc(a),s&&a;){o=qc(o),r=Kc(r),o.hierNode.ancestor=t;var d=s.hierNode.prelim+c-a.hierNode.prelim-u+n(s,a);d>0&&(Jc($c(s,t,i),t,d),u+=d,l+=d),c+=s.hierNode.modifier,u+=a.hierNode.modifier,l+=o.hierNode.modifier,h+=r.hierNode.modifier}s&&!qc(o)&&(o.hierNode.thread=s,o.hierNode.modifier+=c-l),a&&!Kc(r)&&(r.hierNode.thread=a,r.hierNode.modifier+=u-h,i=t)}return i}function qc(t){var e=t.children;return e.length&&t.isExpand?e[e.length-1]:t.hierNode.thread}function Kc(t){var e=t.children;return e.length&&t.isExpand?e[0]:t.hierNode.thread}function $c(t,e,i){return t.hierNode.ancestor.parentNode===e.parentNode?t.hierNode.ancestor:i}function Jc(t,e,i){var n=i/(e.hierNode.i-t.hierNode.i);e.hierNode.change-=n,e.hierNode.shift+=i,e.hierNode.modifier+=i,e.hierNode.prelim+=i,t.hierNode.change+=n}function Qc(t,e){return t.parentNode===e.parentNode?1:2}function td(t,e){var i=t.getItemLayout(e);return i&&!isNaN(i.x)&&!isNaN(i.y)&&"none"!==t.getItemVisual(e,"symbol")}function ed(t,e,i){return i.itemModel=e,i.itemStyle=e.getModel("itemStyle").getItemStyle(),i.hoverItemStyle=e.getModel("emphasis.itemStyle").getItemStyle(),i.lineStyle=e.getModel("lineStyle").getLineStyle(),i.labelModel=e.getModel("label"),i.hoverLabelModel=e.getModel("emphasis.label"),!1===t.isExpand&&0!==t.children.length?i.symbolInnerColor=i.itemStyle.fill:i.symbolInnerColor="#fff",i}function id(t,e,i,n,o,a){var s=!i,l=t.tree.getNodeByDataIndex(e),a=ed(l,l.getModel(),a),u=t.tree.root,h=l.parentNode===u?l:l.parentNode||l,c=t.getItemGraphicEl(h.dataIndex),d=h.getLayout(),f=c?{x:c.position[0],y:c.position[1],rawX:c.__radialOldRawX,rawY:c.__radialOldRawY}:d,p=l.getLayout();s?(i=new wu(t,e,a)).attr("position",[f.x,f.y]):i.updateData(t,e,a),i.__radialOldRawX=i.__radialRawX,i.__radialOldRawY=i.__radialRawY,i.__radialRawX=p.rawX,i.__radialRawY=p.rawY,n.add(i),t.setItemGraphicEl(e,i),Io(i,{position:[p.x,p.y]},o);var g=i.getSymbolPath();if("radial"===a.layout){var m,v,y=u.children[0],x=y.getLayout(),_=y.children.length;if(p.x===x.x&&!0===l.isExpand){var w={};w.x=(y.children[0].getLayout().x+y.children[_-1].getLayout().x)/2,w.y=(y.children[0].getLayout().y+y.children[_-1].getLayout().y)/2,(m=Math.atan2(w.y-x.y,w.x-x.x))<0&&(m=2*Math.PI+m),(v=w.xx.x)||(m-=Math.PI);var b=v?"left":"right";g.setStyle({textPosition:b,textRotation:-m,textOrigin:"center",verticalAlign:"middle"})}if(l.parentNode&&l.parentNode!==u){var S=i.__edge;S||(S=i.__edge=new bM({shape:od(a,f,f),style:r({opacity:0,strokeNoScale:!0},a.lineStyle)})),Io(S,{shape:od(a,d,p),style:{opacity:1}},o),n.add(S)}}function nd(t,e,i,n,o,a){for(var r,s=t.tree.getNodeByDataIndex(e),l=t.tree.root,a=ed(s,s.getModel(),a),u=s.parentNode===l?s:s.parentNode||s;null==(r=u.getLayout());)u=u.parentNode===l?u:u.parentNode||u;Io(i,{position:[r.x+1,r.y+1]},o,function(){n.remove(i),t.setItemGraphicEl(e,null)}),i.fadeOut(null,{keepLabel:!0});var h=i.__edge;h&&Io(h,{shape:od(a,r,r),style:{opacity:0}},o,function(){n.remove(h)})}function od(t,e,i){var n,o,a,r,s,l,u,h,c=t.orient;if("radial"===t.layout){s=e.rawX,u=e.rawY,l=i.rawX,h=i.rawY;var d=Uc(s,u),f=Uc(s,u+(h-u)*t.curvature),p=Uc(l,h+(u-h)*t.curvature),g=Uc(l,h);return{x1:d.x,y1:d.y,x2:g.x,y2:g.y,cpx1:f.x,cpy1:f.y,cpx2:p.x,cpy2:p.y}}return s=e.x,u=e.y,l=i.x,h=i.y,"LR"!==c&&"RL"!==c||(n=s+(l-s)*t.curvature,o=u,a=l+(s-l)*t.curvature,r=h),"TB"!==c&&"BT"!==c||(n=s,o=u+(h-u)*t.curvature,a=l,r=h+(u-h)*t.curvature),{x1:s,y1:u,x2:l,y2:h,cpx1:n,cpy1:o,cpx2:a,cpy2:r}}function ad(t,e,i){for(var n,o=[t],a=[];n=o.pop();)if(a.push(n),n.isExpand){var r=n.children;if(r.length)for(var s=0;s=0;a--)n.push(o[a])}}function sd(t,e){var i=Xc(t,e);t.layoutInfo=i;var n=t.get("layout"),o=0,a=0,r=null;"radial"===n?(o=2*Math.PI,a=Math.min(i.height,i.width)/2,r=Zc(function(t,e){return(t.parentNode===e.parentNode?1:2)/t.depth})):(o=i.width,a=i.height,r=Zc());var s=t.getData().tree.root,l=s.children[0];if(l){Fc(s),ad(l,Wc,r),s.hierNode.modifier=-l.hierNode.prelim,rd(l,Hc);var u=l,h=l,c=l;rd(l,function(t){var e=t.getLayout().x;eh.getLayout().x&&(h=t),t.depth>c.depth&&(c=t)});var d=u===h?1:r(u,h)/2,f=d-u.getLayout().x,p=0,g=0,m=0,v=0;if("radial"===n)p=o/(h.getLayout().x+d+f),g=a/(c.depth-1||1),rd(l,function(t){m=(t.getLayout().x+f)*p,v=(t.depth-1)*g;var e=Uc(m,v);t.setLayout({x:e.x,y:e.y,rawX:m,rawY:v},!0)});else{var y=t.getOrient();"RL"===y||"LR"===y?(g=a/(h.getLayout().x+d+f),p=o/(c.depth-1||1),rd(l,function(t){v=(t.getLayout().x+f)*g,m="LR"===y?(t.depth-1)*p:o-(t.depth-1)*p,t.setLayout({x:m,y:v},!0)})):"TB"!==y&&"BT"!==y||(p=o/(h.getLayout().x+d+f),g=a/(c.depth-1||1),rd(l,function(t){m=(t.getLayout().x+f)*p,v="TB"===y?(t.depth-1)*g:a-(t.depth-1)*g,t.setLayout({x:m,y:v},!0)}))}}}function ld(t,e,i){if(t&&l(e,t.type)>=0){var n=i.getData().tree.root,o=t.targetNode;if("string"==typeof o&&(o=n.getNodeById(o)),o&&n.contains(o))return{node:o};var a=t.targetNodeId;if(null!=a&&(o=n.getNodeById(a)))return{node:o}}}function ud(t){for(var e=[];t;)(t=t.parentNode)&&e.push(t);return e.reverse()}function hd(t,e){return l(ud(t),e)>=0}function cd(t,e){for(var i=[];t;){var n=t.dataIndex;i.push({name:t.name,dataIndex:n,value:e.getRawValue(n)}),t=t.parentNode}return i.reverse(),i}function dd(t){var e=0;d(t.children,function(t){dd(t);var i=t.value;y(i)&&(i=i[0]),e+=i});var i=t.value;y(i)&&(i=i[0]),(null==i||isNaN(i))&&(i=e),i<0&&(i=0),y(t.value)?t.value[0]=i:t.value=i}function fd(t,e){var i=e.get("color");if(i){var n;return d(t=t||[],function(t){var e=new No(t),i=e.get("color");(e.get("itemStyle.color")||i&&"none"!==i)&&(n=!0)}),n||((t[0]||(t[0]={})).color=i.slice()),t}}function pd(t){this.group=new tb,t.add(this.group)}function gd(t,e,i,n,o,a){var r=[[o?t:t-UC,e],[t+i,e],[t+i,e+n],[o?t:t-UC,e+n]];return!a&&r.splice(2,0,[t+i+UC,e+n/2]),!o&&r.push([t,e+n/2]),r}function md(t,e,i){t.eventData={componentType:"series",componentSubType:"treemap",componentIndex:e.componentIndex,seriesIndex:e.componentIndex,seriesName:e.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:i&&i.dataIndex,name:i&&i.name},treePathInfo:i&&cd(i,e)}}function vd(){var t,e=[],i={};return{add:function(t,n,o,a,r){return _(a)&&(r=a,a=0),!i[t.id]&&(i[t.id]=1,e.push({el:t,target:n,time:o,delay:a,easing:r}),!0)},done:function(e){return t=e,this},start:function(){for(var n=e.length,o=0,a=e.length;o=0;a--)null==i[a]&&(delete n[e[a]],e.pop())}function bd(t,e){var i=t.visual,n=[];w(i)?sL(i,function(t){n.push(t)}):null!=i&&n.push(i);var o={color:1,symbol:1};e||1!==n.length||o.hasOwnProperty(t.type)||(n[1]=n[0]),Ld(t,n)}function Sd(t){return{applyVisual:function(e,i,n){e=this.mapValueToVisual(e),n("color",t(i("color"),e))},_doMap:Dd([0,1])}}function Md(t){var e=this.option.visual;return e[Math.round(Bo(t,[0,1],[0,e.length-1],!0))]||{}}function Id(t){return function(e,i,n){n(t,this.mapValueToVisual(e))}}function Td(t){var e=this.option.visual;return e[this.option.loop&&t!==uL?t%e.length:t]}function Ad(){return this.option.visual[0]}function Dd(t){return{linear:function(e){return Bo(e,t,this.option.visual,!0)},category:Td,piecewise:function(e,i){var n=Cd.call(this,i);return null==n&&(n=Bo(e,t,this.option.visual,!0)),n},fixed:Ad}}function Cd(t){var e=this.option,i=e.pieceList;if(e.hasSpecialVisual){var n=i[hL.findPieceIndex(t,i)];if(n&&n.visual)return n.visual[this.type]}}function Ld(t,e){return t.visual=e,"color"===t.type&&(t.parsedVisual=f(e,function(t){return Gt(t)})),e}function kd(t,e,i){return t?e<=i:e=o.length||t===o[t.depth])&&Pd(t,Vd(r,h,t,e,g,a),i,n,o,a)})}else l=Od(h),t.setVisual("color",l)}}function Nd(t,e,i,n){var o=a({},e);return d(["color","colorAlpha","colorSaturation"],function(a){var r=t.get(a,!0);null==r&&i&&(r=i[a]),null==r&&(r=e[a]),null==r&&(r=n.get(a)),null!=r&&(o[a]=r)}),o}function Od(t){var e=Rd(t,"color");if(e){var i=Rd(t,"colorAlpha"),n=Rd(t,"colorSaturation");return n&&(e=jt(e,null,null,n)),i&&(e=Yt(e,i)),e}}function Ed(t,e){return null!=e?jt(e,null,null,t):null}function Rd(t,e){var i=t[e];if(null!=i&&"none"!==i)return i}function zd(t,e,i,n,o,a){if(a&&a.length){var r=Bd(e,"color")||null!=o.color&&"none"!==o.color&&(Bd(e,"colorAlpha")||Bd(e,"colorSaturation"));if(r){var s=e.get("visualMin"),l=e.get("visualMax"),u=i.dataExtent.slice();null!=s&&su[1]&&(u[1]=l);var h=e.get("colorMappingBy"),c={type:r.name,dataExtent:u,visual:r.range};"color"!==c.type||"index"!==h&&"id"!==h?c.mappingMethod="linear":(c.mappingMethod="category",c.loop=!0);var d=new hL(c);return d.__drColorMappingBy=h,d}}}function Bd(t,e){var i=t.get(e);return fL(i)&&i.length?{name:e,range:i}:null}function Vd(t,e,i,n,o,r){var s=a({},e);if(o){var l=o.type,u="color"===l&&o.__drColorMappingBy,h="index"===u?n:"id"===u?r.mapIdToIndex(i.getId()):i.getValue(t.get("visualDimension"));s[l]=o.mapValueToVisual(h)}return s}function Gd(t,e,i,n){var o,a;if(!t.isRemoved()){var r=t.getLayout();o=r.width,a=r.height;var s=(f=t.getModel()).get(_L),l=f.get(wL)/2,u=Kd(f),h=Math.max(s,u),c=s-l,d=h-l,f=t.getModel();t.setLayout({borderWidth:s,upperHeight:h,upperLabelHeight:u},!0);var p=(o=mL(o-2*c,0))*(a=mL(a-c-d,0)),g=Fd(t,f,p,e,i,n);if(g.length){var m={x:c,y:d,width:o,height:a},v=vL(o,a),y=1/0,x=[];x.area=0;for(var _=0,w=g.length;_=0;l--){var u=o["asc"===n?r-l-1:l].getValue();u/i*es[1]&&(s[1]=e)})}else s=[NaN,NaN];return{sum:n,dataExtent:s}}function Ud(t,e,i){for(var n,o=0,a=1/0,r=0,s=t.length;ro&&(o=n));var l=t.area*t.area,u=e*e*i;return l?mL(u*o/l,l/(u*a)):1/0}function Xd(t,e,i,n,o){var a=e===i.width?0:1,r=1-a,s=["x","y"],l=["width","height"],u=i[s[a]],h=e?t.area/e:0;(o||h>i[l[r]])&&(h=i[l[r]]);for(var c=0,d=t.length;cXM&&(u=XM),a=s}u=0?n+=u:n-=u:p>=0?n-=u:n+=u}return n}function pf(t,e){return t.getVisual("opacity")||t.getModel().get(e)}function gf(t,e,i){var n=t.getGraphicEl(),o=pf(t,e);null!=i&&(null==o&&(o=1),o*=i),n.downplay&&n.downplay(),n.traverse(function(t){if("group"!==t.type){var e=t.lineLabelOriginalOpacity;null!=e&&null==i||(e=o),t.setStyle("opacity",e)}})}function mf(t,e){var i=pf(t,e),n=t.getGraphicEl();n.highlight&&n.highlight(),n.traverse(function(t){"group"!==t.type&&t.setStyle("opacity",i)})}function vf(t){return t instanceof Array||(t=[t,t]),t}function yf(t){var e=t.coordinateSystem;if(!e||"view"===e.type){var i=t.getGraph();i.eachNode(function(t){var e=t.getModel();t.setLayout([+e.get("x"),+e.get("y")])}),xf(i)}}function xf(t){t.eachEdge(function(t){var e=t.getModel().get("lineStyle.curveness")||0,i=F(t.node1.getLayout()),n=F(t.node2.getLayout()),o=[i,n];+e&&o.push([(i[0]+n[0])/2-(i[1]-n[1])*e,(i[1]+n[1])/2-(n[0]-i[0])*e]),t.setLayout(o)})}function _f(t){var e=t.coordinateSystem;if(!e||"view"===e.type){var i=e.getBoundingRect(),n=t.getData(),o=n.graph,a=0,r=n.getSum("value"),s=2*Math.PI/(r||n.count()),l=i.width/2+i.x,u=i.height/2+i.y,h=Math.min(i.width,i.height)/2;o.eachNode(function(t){var e=t.getValue("value");a+=s*(r?e:1)/2,t.setLayout([h*Math.cos(a)+l,h*Math.sin(a)+u]),a+=s*(r?e:1)/2}),n.setLayout({cx:l,cy:u}),o.eachEdge(function(t){var e,i=t.getModel().get("lineStyle.curveness")||0,n=F(t.node1.getLayout()),o=F(t.node2.getLayout()),a=(n[0]+o[0])/2,r=(n[1]+o[1])/2;+i&&(e=[l*(i*=3)+a*(1-i),u*i+r*(1-i)]),t.setLayout([n,o,e])})}}function wf(t,e,i){for(var n=i.rect,o=n.width,a=n.height,r=[n.x+o/2,n.y+a/2],s=null==i.gravity?.1:i.gravity,l=0;l0?-1:i<0?1:e?-1:1}}function Pf(t,e){return Math.min(e[1],Math.max(e[0],t))}function Nf(t,e,i){this._axesMap=R(),this._axesLayout={},this.dimensions=t.dimensions,this._rect,this._model=t,this._init(t,e,i)}function Of(t,e){return ek(ik(t,e[0]),e[1])}function Ef(t,e){var i=e.layoutLength/(e.axisCount-1);return{position:i*t,axisNameAvailableWidth:i,axisLabelShow:!0}}function Rf(t,e){var i,n,o=e.layoutLength,a=e.axisExpandWidth,r=e.axisCount,s=e.axisCollapseWidth,l=e.winInnerIndices,u=s,h=!1;return tmk}function $f(t){var e=t.length-1;return e<0&&(e=0),[t[0],t[e]]}function Jf(t,e,i,n){var o=new tb;return o.add(new yM({name:"main",style:ip(i),silent:!0,draggable:!0,cursor:"move",drift:uk(t,e,o,"nswe"),ondragend:uk(qf,e,{isEnd:!0})})),hk(n,function(i){o.add(new yM({name:i,style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:uk(t,e,o,i),ondragend:uk(qf,e,{isEnd:!0})}))}),o}function Qf(t,e,i,n){var o=n.brushStyle.lineWidth||0,a=fk(o,vk),r=i[0][0],s=i[1][0],l=r-o/2,u=s-o/2,h=i[0][1],c=i[1][1],d=h-a+o/2,f=c-a+o/2,p=h-r,g=c-s,m=p+o,v=g+o;ep(t,e,"main",r,s,p,g),n.transformable&&(ep(t,e,"w",l,u,a,v),ep(t,e,"e",d,u,a,v),ep(t,e,"n",l,u,m,a),ep(t,e,"s",l,f,m,a),ep(t,e,"nw",l,u,a,a),ep(t,e,"ne",d,u,a,a),ep(t,e,"sw",l,f,a,a),ep(t,e,"se",d,f,a,a))}function tp(t,e){var i=e.__brushOption,n=i.transformable,o=e.childAt(0);o.useStyle(ip(i)),o.attr({silent:!n,cursor:n?"move":"default"}),hk(["w","e","n","s","se","sw","ne","nw"],function(i){var o=e.childOfName(i),a=ap(t,i);o&&o.attr({silent:!n,invisible:!n,cursor:n?_k[a]+"-resize":null})})}function ep(t,e,i,n,o,a,r){var s=e.childOfName(i);s&&s.setShape(hp(up(t,e,[[n,o],[n+a,o+r]])))}function ip(t){return r({strokeNoScale:!0},t.brushStyle)}function np(t,e,i,n){var o=[dk(t,i),dk(e,n)],a=[fk(t,i),fk(e,n)];return[[o[0],a[0]],[o[1],a[1]]]}function op(t){return Ao(t.group)}function ap(t,e){if(e.length>1)return("e"===(n=[ap(t,(e=e.split(""))[0]),ap(t,e[1])])[0]||"w"===n[0])&&n.reverse(),n.join("");var i={left:"w",right:"e",top:"n",bottom:"s"},n=Co({w:"left",e:"right",n:"top",s:"bottom"}[e],op(t));return i[n]}function rp(t,e,i,n,o,a,r,s){var l=n.__brushOption,u=t(l.range),h=lp(i,a,r);hk(o.split(""),function(t){var e=xk[t];u[e[0]][e[1]]+=h[e[0]]}),l.range=e(np(u[0][0],u[1][0],u[0][1],u[1][1])),Zf(i,n),qf(i,{isEnd:!1})}function sp(t,e,i,n,o){var a=e.__brushOption.range,r=lp(t,i,n);hk(a,function(t){t[0]+=r[0],t[1]+=r[1]}),Zf(t,e),qf(t,{isEnd:!1})}function lp(t,e,i){var n=t.group,o=n.transformCoordToLocal(e,i),a=n.transformCoordToLocal(0,0);return[o[0]-a[0],o[1]-a[1]]}function up(t,e,n){var o=jf(t,e);return o&&!0!==o?o.clipPath(n,t._transform):i(n)}function hp(t){var e=dk(t[0][0],t[1][0]),i=dk(t[0][1],t[1][1]);return{x:e,y:i,width:fk(t[0][0],t[1][0])-e,height:fk(t[0][1],t[1][1])-i}}function cp(t,e,i){if(t._brushType){var n=t._zr,o=t._covers,a=Xf(t,e,i);if(!t._dragging)for(var r=0;r0;a--)Yp(s,l*=.99,r),jp(s,o,i,n,r),tg(s,l,r),jp(s,o,i,n,r)}function Up(t,e){var i=[],n="vertical"===e?"y":"x",o=Zi(t,function(t){return t.getLayout()[n]});return o.keys.sort(function(t,e){return t-e}),d(o.keys,function(t){i.push(o.buckets.get(t))}),i}function Xp(t,e,i,n,o,a,r){var s=[];d(e,function(t){var e=t.length,i=0,l=0;d(t,function(t){i+=t.getLayout().value}),l="vertical"===r?(o-(e-1)*a)/i:(n-(e-1)*a)/i,s.push(l)}),s.sort(function(t,e){return t-e});var l=s[0];d(e,function(t){d(t,function(t,e){var i=t.getLayout().value*l;"vertical"===r?(t.setLayout({x:e},!0),t.setLayout({dx:i},!0)):(t.setLayout({y:e},!0),t.setLayout({dy:i},!0))})}),d(i,function(t){var e=+t.getValue()*l;t.setLayout({dy:e},!0)})}function jp(t,e,i,n,o){d(t,function(t){var a,r,s,l=0,u=t.length;if("vertical"===o){var h;for(t.sort(function(t,e){return t.getLayout().x-e.getLayout().x}),s=0;s0&&(h=a.getLayout().x+r,a.setLayout({x:h},!0)),l=a.getLayout().x+a.getLayout().dx+e;if((r=l-e-n)>0)for(h=a.getLayout().x-r,a.setLayout({x:h},!0),l=h,s=u-2;s>=0;--s)(r=(a=t[s]).getLayout().x+a.getLayout().dx+e-l)>0&&(h=a.getLayout().x-r,a.setLayout({x:h},!0)),l=a.getLayout().x}else{var c;for(t.sort(function(t,e){return t.getLayout().y-e.getLayout().y}),s=0;s0&&(c=a.getLayout().y+r,a.setLayout({y:c},!0)),l=a.getLayout().y+a.getLayout().dy+e;if((r=l-e-i)>0)for(c=a.getLayout().y-r,a.setLayout({y:c},!0),l=c,s=u-2;s>=0;--s)(r=(a=t[s]).getLayout().y+a.getLayout().dy+e-l)>0&&(c=a.getLayout().y-r,a.setLayout({y:c},!0)),l=a.getLayout().y}})}function Yp(t,e,i){d(t.slice().reverse(),function(t){d(t,function(t){if(t.outEdges.length){var n=Qp(t.outEdges,qp,i)/Qp(t.outEdges,Jp,i);if("vertical"===i){var o=t.getLayout().x+(n-$p(t,i))*e;t.setLayout({x:o},!0)}else{var a=t.getLayout().y+(n-$p(t,i))*e;t.setLayout({y:a},!0)}}})})}function qp(t,e){return $p(t.node2,e)*t.getValue()}function Kp(t,e){return $p(t.node1,e)*t.getValue()}function $p(t,e){return"vertical"===e?t.getLayout().x+t.getLayout().dx/2:t.getLayout().y+t.getLayout().dy/2}function Jp(t){return t.getValue()}function Qp(t,e,i){for(var n=0,o=t.length,a=-1;++a0?"P":"N",a=n.getVisual("borderColor"+o)||n.getVisual("color"+o),r=i.getModel(Gk).getItemStyle(Wk);e.useStyle(r),e.style.fill=null,e.style.stroke=a}function fg(t,e,i,n,o){return i>n?-1:i0?t.get(o,e-1)<=n?1:-1:1}function pg(t,e){var i,n=t.getBaseAxis(),o="category"===n.type?n.getBandWidth():(i=n.getExtent(),Math.abs(i[1]-i[0])/e.count()),a=Vo(A(t.get("barMaxWidth"),o),o),r=Vo(A(t.get("barMinWidth"),1),o),s=t.get("barWidth");return null!=s?Vo(s,o):Math.max(Math.min(o/2,a),r)}function gg(t){return y(t)||(t=[+t,+t]),t}function mg(t,e){t.eachChild(function(t){t.attr({z:e.z,zlevel:e.zlevel,style:{stroke:"stroke"===e.brushType?e.color:null,fill:"fill"===e.brushType?e.color:null}})})}function vg(t,e){tb.call(this);var i=new wu(t,e),n=new tb;this.add(i),this.add(n),n.beforeUpdate=function(){this.attr(i.getScale())},this.updateData(t,e)}function yg(t){var e=t.data;e&&e[0]&&e[0][0]&&e[0][0].coord&&(t.data=f(e,function(t){var e={coords:[t[0].coord,t[1].coord]};return t[0].name&&(e.fromName=t[0].name),t[1].name&&(e.toName=t[1].name),o([e,t[0],t[1]])}))}function xg(t,e,i){tb.call(this),this.add(this.createLine(t,e,i)),this._updateEffectSymbol(t,e)}function _g(t,e,i){tb.call(this),this._createPolyline(t,e,i)}function wg(t,e,i){xg.call(this,t,e,i),this._lastFrame=0,this._lastFramePercent=0}function bg(){this.group=new tb}function Sg(t){return t instanceof Array||(t=[t,t]),t}function Mg(){var t=iw();this.canvas=t,this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={}}function Ig(t,e,i){var n=t[1]-t[0],o=(e=f(e,function(e){return{interval:[(e.interval[0]-t[0])/n,(e.interval[1]-t[0])/n]}})).length,a=0;return function(t){for(n=a;n=0;n--){var r=e[n].interval;if(r[0]<=t&&t<=r[1]){a=n;break}}return n>=0&&n=e[0]&&t<=e[1]}}function Ag(t){var e=t.dimensions;return"lng"===e[0]&&"lat"===e[1]}function Dg(t,e,i,n){var o=t.getItemLayout(e),a=i.get("symbolRepeat"),r=i.get("symbolClip"),s=i.get("symbolPosition")||"start",l=(i.get("symbolRotate")||0)*Math.PI/180||0,u=i.get("symbolPatternSize")||2,h=i.isAnimationEnabled(),c={dataIndex:e,layout:o,itemModel:i,symbolType:t.getItemVisual(e,"symbol")||"circle",color:t.getItemVisual(e,"color"),symbolClip:r,symbolRepeat:a,symbolRepeatDirection:i.get("symbolRepeatDirection"),symbolPatternSize:u,rotation:l,animationModel:h?i:null,hoverAnimation:h&&i.get("hoverAnimation"),z2:i.getShallow("z",!0)||0};Cg(i,a,o,n,c),kg(t,e,o,a,r,c.boundingLength,c.pxSign,u,n,c),Pg(i,c.symbolScale,l,n,c);var d=c.symbolSize,f=i.get("symbolOffset");return y(f)&&(f=[Vo(f[0],d[0]),Vo(f[1],d[1])]),Ng(i,d,o,a,r,f,s,c.valueLineWidth,c.boundingLength,c.repeatCutLength,n,c),c}function Cg(t,e,i,n,o){var a,r=n.valueDim,s=t.get("symbolBoundingData"),l=n.coordSys.getOtherAxis(n.coordSys.getBaseAxis()),u=l.toGlobalCoord(l.dataToCoord(0)),h=1-+(i[r.wh]<=0);if(y(s)){var c=[Lg(l,s[0])-u,Lg(l,s[1])-u];c[1]0?1:a<0?-1:0}function Lg(t,e){return t.toGlobalCoord(t.dataToCoord(t.scale.parse(e)))}function kg(t,e,i,n,o,a,r,s,l,u){var h=l.valueDim,c=l.categoryDim,d=Math.abs(i[c.wh]),f=t.getItemVisual(e,"symbolSize");y(f)?f=f.slice():(null==f&&(f="100%"),f=[f,f]),f[c.index]=Vo(f[c.index],d),f[h.index]=Vo(f[h.index],n?d:Math.abs(a)),u.symbolSize=f,(u.symbolScale=[f[0]/s,f[1]/s])[h.index]*=(l.isHorizontal?-1:1)*r}function Pg(t,e,i,n,o){var a=t.get(cP)||0;a&&(fP.attr({scale:e.slice(),rotation:i}),fP.updateTransform(),a/=fP.getLineScale(),a*=e[n.valueDim.index]),o.valueLineWidth=a}function Ng(t,e,i,n,o,r,s,l,u,h,c,d){var f=c.categoryDim,p=c.valueDim,g=d.pxSign,m=Math.max(e[p.index]+l,0),v=m;if(n){var y=Math.abs(u),x=T(t.get("symbolMargin"),"15%")+"",_=!1;x.lastIndexOf("!")===x.length-1&&(_=!0,x=x.slice(0,x.length-1)),x=Vo(x,e[p.index]);var w=Math.max(m+2*x,0),b=_?0:2*x,S=Qo(n),M=S?n:Kg((y+b)/w);w=m+2*(x=(y-M*m)/2/(_?M:M-1)),b=_?0:2*x,S||"fixed"===n||(M=h?Kg((Math.abs(h)+b)/w):0),v=M*w-b,d.repeatTimes=M,d.symbolMargin=x}var I=g*(v/2),A=d.pathPosition=[];A[f.index]=i[f.wh]/2,A[p.index]="start"===s?I:"end"===s?u-I:u/2,r&&(A[0]+=r[0],A[1]+=r[1]);var D=d.bundlePosition=[];D[f.index]=i[f.xy],D[p.index]=i[p.xy];var C=d.barRectShape=a({},i);C[p.wh]=g*Math.max(Math.abs(i[p.wh]),Math.abs(A[p.index]+I)),C[f.wh]=i[f.wh];var L=d.clipShape={};L[f.xy]=-i[f.xy],L[f.wh]=c.ecSize[f.wh],L[p.xy]=0,L[p.wh]=i[p.wh]}function Og(t){var e=t.symbolPatternSize,i=Jl(t.symbolType,-e/2,-e/2,e,e,t.color);return i.attr({culling:!0}),"image"!==i.type&&i.setStyle({strokeNoScale:!0}),i}function Eg(t,e,i,n){function o(t){var e=l.slice(),n=i.pxSign,o=t;return("start"===i.symbolRepeatDirection?n>0:n<0)&&(o=h-1-t),e[u.index]=d*(o-h/2+.5)+l[u.index],{position:e,scale:i.symbolScale.slice(),rotation:i.rotation}}var a=t.__pictorialBundle,r=i.symbolSize,s=i.valueLineWidth,l=i.pathPosition,u=e.valueDim,h=i.repeatTimes||0,c=0,d=r[e.valueDim.index]+s+2*i.symbolMargin;for(jg(t,function(t){t.__pictorialAnimationIndex=c,t.__pictorialRepeatTimes=h,c0)],d=t.__pictorialBarRect;kh(d.style,h,a,n,e.seriesModel,o,c),fo(d,h)}function Kg(t){var e=Math.round(t);return Math.abs(t-e)<1e-4?e:Math.ceil(t)}function $g(t,e,i){this.dimension="single",this.dimensions=["single"],this._axis=null,this._rect,this._init(t,e,i),this.model=t}function Jg(t,e){e=e||{};var i=t.coordinateSystem,n=t.axis,o={},a=n.position,r=n.orient,s=i.getRect(),l=[s.x,s.x+s.width,s.y,s.y+s.height],u={horizontal:{top:l[2],bottom:l[3]},vertical:{left:l[0],right:l[1]}};o.position=["vertical"===r?u.vertical[a]:l[0],"horizontal"===r?u.horizontal[a]:l[3]];var h={horizontal:0,vertical:1};o.rotation=Math.PI/2*h[r];var c={top:-1,bottom:1,right:1,left:-1};o.labelDirection=o.tickDirection=o.nameDirection=c[a],t.get("axisTick.inside")&&(o.tickDirection=-o.tickDirection),T(e.labelInside,t.get("axisLabel.inside"))&&(o.labelDirection=-o.labelDirection);var d=e.rotate;return null==d&&(d=t.get("axisLabel.rotate")),o.labelRotation="top"===a?-d:d,o.z2=1,o}function Qg(t,e,i,n,o){var r=t.axis;if(!r.scale.isBlank()&&r.containData(e))if(t.involveSeries){var s=tm(e,t),l=s.payloadBatch,u=s.snapToValue;l[0]&&null==o.seriesIndex&&a(o,l[0]),!n&&t.snap&&r.containData(u)&&null!=u&&(e=u),i.showPointer(t,e,l,o),i.showTooltip(t,s,u)}else i.showPointer(t,e)}function tm(t,e){var i=e.axis,n=i.dim,o=t,a=[],r=Number.MAX_VALUE,s=-1;return _P(e.seriesModels,function(e,l){var u,h,c=e.getData().mapDimension(n,!0);if(e.getAxisTooltipData){var d=e.getAxisTooltipData(c,t,i);h=d.dataIndices,u=d.nestestValue}else{if(!(h=e.getData().indicesOfNearest(c[0],t,"category"===i.type?.5:null)).length)return;u=e.getData().get(c[0],h[0])}if(null!=u&&isFinite(u)){var f=t-u,p=Math.abs(f);p<=r&&((p=0&&s<0)&&(r=p,s=f,o=u,a.length=0),_P(h,function(t){a.push({seriesIndex:e.seriesIndex,dataIndexInside:t,dataIndex:e.getData().getRawIndex(t)})}))}}),{payloadBatch:a,snapToValue:o}}function em(t,e,i,n){t[e.key]={value:i,payloadBatch:n}}function im(t,e,i,n){var o=i.payloadBatch,a=e.axis,r=a.model,s=e.axisPointerModel;if(e.triggerTooltip&&o.length){var l=e.coordSys.model,u=Ah(l),h=t.map[u];h||(h=t.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(h)),h.dataByAxis.push({axisDim:a.dim,axisIndex:r.componentIndex,axisType:r.type,axisId:r.id,value:n,valueLabelOpt:{precision:s.get("label.precision"),formatter:s.get("label.formatter")},seriesDataIndices:o.slice()})}}function nm(t,e,i){var n=i.axesInfo=[];_P(e,function(e,i){var o=e.axisPointerModel.option,a=t[i];a?(!e.useHandle&&(o.status="show"),o.value=a.value,o.seriesDataIndices=(a.payloadBatch||[]).slice()):!e.useHandle&&(o.status="hide"),"show"===o.status&&n.push({axisDim:e.axis.dim,axisIndex:e.axis.model.componentIndex,value:o.value})})}function om(t,e,i,n){if(!lm(e)&&t.list.length){var o=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};n({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:i.tooltipOption,position:i.position,dataIndexInside:o.dataIndexInside,dataIndex:o.dataIndex,seriesIndex:o.seriesIndex,dataByCoordSys:t.list})}else n({type:"hideTip"})}function am(t,e,i){var n=i.getZr(),o=bP(n).axisPointerLastHighlights||{},a=bP(n).axisPointerLastHighlights={};_P(t,function(t,e){var i=t.axisPointerModel.option;"show"===i.status&&_P(i.seriesDataIndices,function(t){var e=t.seriesIndex+" | "+t.dataIndex;a[e]=t})});var r=[],s=[];d(o,function(t,e){!a[e]&&s.push(t)}),d(a,function(t,e){!o[e]&&r.push(t)}),s.length&&i.dispatchAction({type:"downplay",escapeConnect:!0,batch:s}),r.length&&i.dispatchAction({type:"highlight",escapeConnect:!0,batch:r})}function rm(t,e){for(var i=0;i<(t||[]).length;i++){var n=t[i];if(e.axis.dim===n.axisDim&&e.axis.model.componentIndex===n.axisIndex)return n}}function sm(t){var e=t.axis.model,i={},n=i.axisDim=t.axis.dim;return i.axisIndex=i[n+"AxisIndex"]=e.componentIndex,i.axisName=i[n+"AxisName"]=e.name,i.axisId=i[n+"AxisId"]=e.id,i}function lm(t){return!t||null==t[0]||isNaN(t[0])||null==t[1]||isNaN(t[1])}function um(t,e,i){if(!U_.node){var n=e.getZr();SP(n).records||(SP(n).records={}),hm(n,e),(SP(n).records[t]||(SP(n).records[t]={})).handler=i}}function hm(t,e){function i(i,n){t.on(i,function(i){var o=pm(e);MP(SP(t).records,function(t){t&&n(t,i,o.dispatchAction)}),cm(o.pendings,e)})}SP(t).initialized||(SP(t).initialized=!0,i("click",v(fm,"click")),i("mousemove",v(fm,"mousemove")),i("globalout",dm))}function cm(t,e){var i,n=t.showTip.length,o=t.hideTip.length;n?i=t.showTip[n-1]:o&&(i=t.hideTip[o-1]),i&&(i.dispatchAction=null,e.dispatchAction(i))}function dm(t,e,i){t.handler("leave",null,i)}function fm(t,e,i,n){e.handler(t,i,n)}function pm(t){var e={showTip:[],hideTip:[]},i=function(n){var o=e[n.type];o?o.push(n):(n.dispatchAction=i,t.dispatchAction(n))};return{dispatchAction:i,pendings:e}}function gm(t,e){if(!U_.node){var i=e.getZr();(SP(i).records||{})[t]&&(SP(i).records[t]=null)}}function mm(){}function vm(t,e,i,n){ym(TP(i).lastProp,n)||(TP(i).lastProp=n,e?Io(i,n,t):(i.stopAnimation(),i.attr(n)))}function ym(t,e){if(w(t)&&w(e)){var i=!0;return d(e,function(e,n){i=i&&ym(t[n],e)}),!!i}return t===e}function xm(t,e){t[e.get("label.show")?"show":"hide"]()}function _m(t){return{position:t.position.slice(),rotation:t.rotation||0}}function wm(t,e,i){var n=e.get("z"),o=e.get("zlevel");t&&t.traverse(function(t){"group"!==t.type&&(null!=n&&(t.z=n),null!=o&&(t.zlevel=o),t.silent=i)})}function bm(t){var e,i=t.get("type"),n=t.getModel(i+"Style");return"line"===i?(e=n.getLineStyle()).fill=null:"shadow"===i&&((e=n.getAreaStyle()).stroke=null),e}function Sm(t,e,i,n,o){var a=Im(i.get("value"),e.axis,e.ecModel,i.get("seriesDataIndices"),{precision:i.get("label.precision"),formatter:i.get("label.formatter")}),r=i.getModel("label"),s=qM(r.get("padding")||0),l=r.getFont(),u=ke(a,l),h=o.position,c=u.width+s[1]+s[3],d=u.height+s[0]+s[2],f=o.align;"right"===f&&(h[0]-=c),"center"===f&&(h[0]-=c/2);var p=o.verticalAlign;"bottom"===p&&(h[1]-=d),"middle"===p&&(h[1]-=d/2),Mm(h,c,d,n);var g=r.get("backgroundColor");g&&"auto"!==g||(g=e.get("axisLine.lineStyle.color")),t.label={shape:{x:0,y:0,width:c,height:d,r:r.get("borderRadius")},position:h.slice(),style:{text:a,textFont:l,textFill:r.getTextColor(),textPosition:"inside",fill:g,stroke:r.get("borderColor")||"transparent",lineWidth:r.get("borderWidth")||0,shadowBlur:r.get("shadowBlur"),shadowColor:r.get("shadowColor"),shadowOffsetX:r.get("shadowOffsetX"),shadowOffsetY:r.get("shadowOffsetY")},z2:10}}function Mm(t,e,i,n){var o=n.getWidth(),a=n.getHeight();t[0]=Math.min(t[0]+e,o)-e,t[1]=Math.min(t[1]+i,a)-i,t[0]=Math.max(t[0],0),t[1]=Math.max(t[1],0)}function Im(t,e,i,n,o){t=e.scale.parse(t);var a=e.scale.getLabel(t,{precision:o.precision}),r=o.formatter;if(r){var s={value:Xl(e,t),seriesData:[]};d(n,function(t){var e=i.getSeriesByIndex(t.seriesIndex),n=t.dataIndexInside,o=e&&e.getDataParams(n);o&&s.seriesData.push(o)}),_(r)?a=r.replace("{value}",a):x(r)&&(a=r(s))}return a}function Tm(t,e,i){var n=xt();return Mt(n,n,i.rotation),St(n,n,i.position),Do([t.dataToCoord(e),(i.labelOffset||0)+(i.labelDirection||1)*(i.labelMargin||0)],n)}function Am(t,e,i,n,o,a){var r=FD.innerTextLayout(i.rotation,0,i.labelDirection);i.labelMargin=o.get("label.margin"),Sm(e,n,o,a,{position:Tm(n.axis,t,i),align:r.textAlign,verticalAlign:r.textVerticalAlign})}function Dm(t,e,i){return i=i||0,{x1:t[i],y1:t[1-i],x2:e[i],y2:e[1-i]}}function Cm(t,e,i){return i=i||0,{x:t[i],y:t[1-i],width:e[i],height:e[1-i]}}function Lm(t,e,i,n,o,a){return{cx:t,cy:e,r0:i,r:n,startAngle:o,endAngle:a,clockwise:!0}}function km(t,e){var i={};return i[e.dim+"AxisIndex"]=e.index,t.getCartesian(i)}function Pm(t){return"x"===t.dim?0:1}function Nm(t){return t.isHorizontal()?0:1}function Om(t,e){var i=t.getRect();return[i[kP[e]],i[kP[e]]+i[PP[e]]]}function Em(t,e,i){var n=new yM({shape:{x:t.x-10,y:t.y-10,width:0,height:t.height+20}});return To(n,{shape:{width:t.width+20,height:t.height+20}},e,i),n}function Rm(t,e,i){if(t.count())for(var n,o=e.coordinateSystem,a=e.getLayerSeries(),r=t.mapDimension("single"),s=t.mapDimension("value"),l=f(a,function(e){return f(e.indices,function(e){var i=o.dataToPoint(t.get(r,e));return i[1]=t.get(s,e),i})}),u=zm(l),h=u.y0,c=i/u.max,d=a.length,p=a[0].indices.length,g=0;ga&&(a=u),n.push(u)}for(var h=0;ha&&(a=d)}return r.y0=o,r.max=a,r}function Bm(t){var e=0;d(t.children,function(t){Bm(t);var i=t.value;y(i)&&(i=i[0]),e+=i});var i=t.value;y(i)&&(i=i[0]),(null==i||isNaN(i))&&(i=e),i<0&&(i=0),y(t.value)?t.value[0]=i:t.value=i}function Vm(t,e,i){function n(){r.ignore=r.hoverIgnore}function o(){r.ignore=r.normalIgnore}tb.call(this);var a=new hM({z2:zP});a.seriesIndex=e.seriesIndex;var r=new rM({z2:BP,silent:t.getModel("label").get("silent")});this.add(a),this.add(r),this.updateData(!0,t,"normal",e,i),this.on("emphasis",n).on("normal",o).on("mouseover",n).on("mouseout",o)}function Gm(t,e,i){var n=t.getVisual("color"),o=t.getVisual("visualMeta");o&&0!==o.length||(n=null);var a=t.getModel("itemStyle").get("color");if(a)return a;if(n)return n;if(0===t.depth)return i.option.color[0];var r=i.option.color.length;return a=i.option.color[Fm(t)%r]}function Fm(t){for(var e=t;e.depth>1;)e=e.parentNode;return l(t.getAncestors()[0].children,e)}function Wm(t,e,i){return i!==RP.NONE&&(i===RP.SELF?t===e:i===RP.ANCESTOR?t===e||t.isAncestorOf(e):t===e||t.isDescendantOf(e))}function Hm(t,e,i){e.getData().setItemVisual(t.dataIndex,"color",i)}function Zm(t,e){var i=t.children||[];t.children=Um(i,e),i.length&&d(t.children,function(t){Zm(t,e)})}function Um(t,e){if("function"==typeof e)return t.sort(e);var i="asc"===e;return t.sort(function(t,e){var n=(t.getValue()-e.getValue())*(i?1:-1);return 0===n?(t.dataIndex-e.dataIndex)*(i?-1:1):n})}function Xm(t,e){return e=e||[0,0],f(["x","y"],function(i,n){var o=this.getAxis(i),a=e[n],r=t[n]/2;return"category"===o.type?o.getBandWidth():Math.abs(o.dataToCoord(a-r)-o.dataToCoord(a+r))},this)}function jm(t,e){return e=e||[0,0],f([0,1],function(i){var n=e[i],o=t[i]/2,a=[],r=[];return a[i]=n-o,r[i]=n+o,a[1-i]=r[1-i]=e[1-i],Math.abs(this.dataToPoint(a)[i]-this.dataToPoint(r)[i])},this)}function Ym(t,e){var i=this.getAxis(),n=e instanceof Array?e[0]:e,o=(t instanceof Array?t[0]:t)/2;return"category"===i.type?i.getBandWidth():Math.abs(i.dataToCoord(n-o)-i.dataToCoord(n+o))}function qm(t,e){return f(["Radius","Angle"],function(i,n){var o=this["get"+i+"Axis"](),a=e[n],r=t[n]/2,s="dataTo"+i,l="category"===o.type?o.getBandWidth():Math.abs(o[s](a-r)-o[s](a+r));return"Angle"===i&&(l=l*Math.PI/180),l},this)}function Km(t){var e,i=t.type;if("path"===i){var n=t.shape,o=null!=n.width&&null!=n.height?{x:n.x||0,y:n.y||0,width:n.width,height:n.height}:null,a=lv(n);(e=Xn(a,null,o,n.layout||"center")).__customPathData=a}else"image"===i?(e=new fi({})).__customImagePath=t.style.image:"text"===i?(e=new rM({})).__customText=t.style.text:e=new(0,zM[i.charAt(0).toUpperCase()+i.slice(1)]);return e.__customGraphicType=i,e.name=t.name,e}function $m(t,e,n,o,a,r,s){var l={},u=n.style||{};if(n.shape&&(l.shape=i(n.shape)),n.position&&(l.position=n.position.slice()),n.scale&&(l.scale=n.scale.slice()),n.origin&&(l.origin=n.origin.slice()),n.rotation&&(l.rotation=n.rotation),"image"===t.type&&n.style){h=l.style={};d(["x","y","width","height"],function(e){Jm(e,h,u,t.style,r)})}if("text"===t.type&&n.style){var h=l.style={};d(["x","y"],function(e){Jm(e,h,u,t.style,r)}),!u.hasOwnProperty("textFill")&&u.fill&&(u.textFill=u.fill),!u.hasOwnProperty("textStroke")&&u.stroke&&(u.textStroke=u.stroke)}if("group"!==t.type&&(t.useStyle(u),r)){t.style.opacity=0;var c=u.opacity;null==c&&(c=1),To(t,{style:{opacity:c}},o,e)}r?t.attr(l):Io(t,l,o,e),n.hasOwnProperty("z2")&&t.attr("z2",n.z2||0),n.hasOwnProperty("silent")&&t.attr("silent",n.silent),n.hasOwnProperty("invisible")&&t.attr("invisible",n.invisible),n.hasOwnProperty("ignore")&&t.attr("ignore",n.ignore),n.hasOwnProperty("info")&&t.attr("info",n.info);var f=n.styleEmphasis,p=!1===f;t.__cusHasEmphStl&&null==f||!t.__cusHasEmphStl&&p||(ro(t,f),t.__cusHasEmphStl=!p),s&&po(t,!p)}function Jm(t,e,i,n,o){null==i[t]||o||(e[t]=i[t],i[t]=n[t])}function Qm(t,e,i,n){function o(t){null==t&&(t=h),v&&(c=e.getItemModel(t),d=c.getModel(UP),f=c.getModel(XP),p=e.getItemVisual(t,"color"),v=!1)}var s=t.get("renderItem"),l=t.coordinateSystem,u={};l&&(u=l.prepareCustoms?l.prepareCustoms():YP[l.type](l));var h,c,d,f,p,g=r({getWidth:n.getWidth,getHeight:n.getHeight,getZr:n.getZr,getDevicePixelRatio:n.getDevicePixelRatio,value:function(t,i){return null==i&&(i=h),e.get(e.getDimension(t||0),i)},style:function(i,n){null==n&&(n=h),o(n);var r=c.getModel(HP).getItemStyle();null!=p&&(r.fill=p);var s=e.getItemVisual(n,"opacity");return null!=s&&(r.opacity=s),mo(r,d,null,{autoColor:p,isRectText:!0}),r.text=d.getShallow("show")?A(t.getFormattedLabel(n,"normal"),_u(e,n)):null,i&&a(r,i),r},styleEmphasis:function(i,n){null==n&&(n=h),o(n);var r=c.getModel(ZP).getItemStyle();return mo(r,f,null,{isRectText:!0},!0),r.text=f.getShallow("show")?D(t.getFormattedLabel(n,"emphasis"),t.getFormattedLabel(n,"normal"),_u(e,n)):null,i&&a(r,i),r},visual:function(t,i){return null==i&&(i=h),e.getItemVisual(i,t)},barLayout:function(t){if(l.getBaseAxis)return Ll(r({axis:l.getBaseAxis()},t),n)},currentSeriesIndices:function(){return i.getCurrentSeriesIndices()},font:function(t){return So(t,i)}},u.api||{}),m={context:{},seriesId:t.id,seriesName:t.name,seriesIndex:t.seriesIndex,coordSys:u.coordSys,dataInsideLength:e.count(),encode:tv(t.getData())},v=!0;return function(t,i){return h=t,v=!0,s&&s(r({dataIndexInside:t,dataIndex:e.getRawIndex(t),actionType:i?i.type:null},m),g)}}function tv(t){var e={};return d(t.dimensions,function(i,n){var o=t.getDimensionInfo(i);if(!o.isExtraCoord){var a=o.coordDim;(e[a]=e[a]||[])[o.coordDimIndex]=n}}),e}function ev(t,e,i,n,o,a){return(t=iv(t,e,i,n,o,a,!0))&&a.setItemGraphicEl(e,t),t}function iv(t,e,i,n,o,a,r){var s=!i,l=(i=i||{}).type,u=i.shape,h=i.style;if(t&&(s||null!=l&&l!==t.__customGraphicType||"path"===l&&uv(u)&&lv(u)!==t.__customPathData||"image"===l&&hv(h,"image")&&h.image!==t.__customImagePath||"text"===l&&hv(u,"text")&&h.text!==t.__customText)&&(o.remove(t),t=null),!s){var c=!t;return!t&&(t=Km(i)),$m(t,e,i,n,a,c,r),"group"===l&&nv(t,e,i,n,a),o.add(t),t}}function nv(t,e,i,n,o){var a=i.children,r=a?a.length:0,s=i.$mergeChildren,l="byName"===s||i.diffChildrenByName,u=!1===s;if(r||l||u)if(l)ov({oldChildren:t.children()||[],newChildren:a||[],dataIndex:e,animatableModel:n,group:t,data:o});else{u&&t.removeAll();for(var h=0;hn?t-=l+a:t+=a),null!=r&&(e+u+r>o?e-=u+r:e+=r),[t,e]}function Ov(t,e,i,n,o){var a=i.getOuterSize(),r=a.width,s=a.height;return t=Math.min(t+r,n)-r,e=Math.min(e+s,o)-s,t=Math.max(t,0),e=Math.max(e,0),[t,e]}function Ev(t,e,i){var n=i[0],o=i[1],a=0,r=0,s=e.width,l=e.height;switch(t){case"inside":a=e.x+s/2-n/2,r=e.y+l/2-o/2;break;case"top":a=e.x+s/2-n/2,r=e.y-o-5;break;case"bottom":a=e.x+s/2-n/2,r=e.y+l+5;break;case"left":a=e.x-n-5,r=e.y+l/2-o/2;break;case"right":a=e.x+s+5,r=e.y+l/2-o/2}return[a,r]}function Rv(t){return"center"===t||"middle"===t}function zv(t){return t.get("stack")||"__ec_stack_"+t.seriesIndex}function Bv(t){return t.dim}function Vv(t,e){var i={};d(t,function(t,e){var n=t.getData(),o=t.coordinateSystem.getBaseAxis(),a=o.getExtent(),r="category"===o.type?o.getBandWidth():Math.abs(a[1]-a[0])/n.count(),s=i[Bv(o)]||{bandWidth:r,remainedWidth:r,autoWidthCount:0,categoryGap:"20%",gap:"30%",stacks:{}},l=s.stacks;i[Bv(o)]=s;var u=zv(t);l[u]||s.autoWidthCount++,l[u]=l[u]||{width:0,maxWidth:0};var h=Vo(t.get("barWidth"),r),c=Vo(t.get("barMaxWidth"),r),d=t.get("barGap"),f=t.get("barCategoryGap");h&&!l[u].width&&(h=Math.min(s.remainedWidth,h),l[u].width=h,s.remainedWidth-=h),c&&(l[u].maxWidth=c),null!=d&&(s.gap=d),null!=f&&(s.categoryGap=f)});var n={};return d(i,function(t,e){n[e]={};var i=t.stacks,o=t.bandWidth,a=Vo(t.categoryGap,o),r=Vo(t.gap,1),s=t.remainedWidth,l=t.autoWidthCount,u=(s-a)/(l+(l-1)*r);u=Math.max(u,0),d(i,function(t,e){var i=t.maxWidth;i&&ie[0]&&(e=e.slice().reverse());var n=t.coordToPoint([e[0],i]),o=t.coordToPoint([e[1],i]);return{x1:n[0],y1:n[1],x2:o[0],y2:o[1]}}function jv(t){return t.getRadiusAxis().inverse?0:1}function Yv(t){var e=t[0],i=t[t.length-1];e&&i&&Math.abs(Math.abs(e.coord-i.coord)-360)<1e-4&&t.pop()}function qv(t,e,i){return{position:[t.cx,t.cy],rotation:i/180*Math.PI,labelDirection:-1,tickDirection:-1,nameDirection:1,labelRotate:e.getModel("axisLabel").get("rotate"),z2:1}}function Kv(t,e,i,n,o){var a=e.axis,r=a.dataToCoord(t),s=n.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l,u,h,c=n.getRadiusAxis().getExtent();if("radius"===a.dim){var d=xt();Mt(d,d,s),St(d,d,[n.cx,n.cy]),l=Do([r,-o],d);var f=e.getModel("axisLabel").get("rotate")||0,p=FD.innerTextLayout(s,f*Math.PI/180,-1);u=p.textAlign,h=p.textVerticalAlign}else{var g=c[1];l=n.coordToPoint([g+o,r]);var m=n.cx,v=n.cy;u=Math.abs(l[0]-m)/g<.3?"center":l[0]>m?"left":"right",h=Math.abs(l[1]-v)/g<.3?"middle":l[1]>v?"top":"bottom"}return{position:l,align:u,verticalAlign:h}}function $v(t,e){e.update="updateView",Es(e,function(e,i){var n={};return i.eachComponent({mainType:"geo",query:e},function(i){i[t](e.name),d(i.coordinateSystem.regions,function(t){n[t.name]=i.isSelected(t.name)||!1})}),{selected:n,name:e.name}})}function Jv(t){var e={};d(t,function(t){e[t]=1}),t.length=0,d(e,function(e,i){t.push(i)})}function Qv(t){if(t)for(var e in t)if(t.hasOwnProperty(e))return!0}function ty(t,e,n){function o(){var t=function(){};return t.prototype.__hidden=t.prototype,new t}var a={};return MN(e,function(e){var r=a[e]=o();MN(t[e],function(t,o){if(hL.isValidType(o)){var a={type:o,visual:t};n&&n(a,e),r[o]=new hL(a),"opacity"===o&&((a=i(a)).type="colorAlpha",r.__hidden.__alphaForOpacity=new hL(a))}})}),a}function ey(t,e,n){var o;d(n,function(t){e.hasOwnProperty(t)&&Qv(e[t])&&(o=!0)}),o&&d(n,function(n){e.hasOwnProperty(n)&&Qv(e[n])?t[n]=i(e[n]):delete t[n]})}function iy(t,e,i,n,o,a){function r(t){return i.getItemVisual(h,t)}function s(t,e){i.setItemVisual(h,t,e)}function l(t,l){h=null==a?t:l;var c=i.getRawDataItem(h);if(!c||!1!==c.visualMap)for(var d=n.call(o,t),f=e[d],p=u[d],g=0,m=p.length;g1)return!1;var h=uy(i-t,o-t,n-e,a-e)/l;return!(h<0||h>1)}function ly(t){return t<=1e-6&&t>=-1e-6}function uy(t,e,i,n){return t*n-e*i}function hy(t,e,i){var n=this._targetInfoList=[],o={},a=dy(e,t);TN(PN,function(t,e){(!i||!i.include||AN(i.include,e)>=0)&&t(a,n,o)})}function cy(t){return t[0]>t[1]&&t.reverse(),t}function dy(t,e){return Vi(t,e,{includeMainTypes:LN})}function fy(t,e,i,n){var o=i.getAxis(["x","y"][t]),a=cy(f([0,1],function(t){return e?o.coordToData(o.toLocalCoord(n[t])):o.toGlobalCoord(o.dataToCoord(n[t]))})),r=[];return r[t]=a,r[1-t]=[NaN,NaN],{values:a,xyMinMax:r}}function py(t,e,i,n){return[e[0]-n[t]*i[0],e[1]-n[t]*i[1]]}function gy(t,e){var i=my(t),n=my(e),o=[i[0]/n[0],i[1]/n[1]];return isNaN(o[0])&&(o[0]=1),isNaN(o[1])&&(o[1]=1),o}function my(t){return t?[t[0][1]-t[0][0],t[1][1]-t[1][0]]:[NaN,NaN]}function vy(t,e,i,n,o){if(o){var a=t.getZr();a[VN]||(a[BN]||(a[BN]=yy),Nr(a,BN,i,e)(t,n))}}function yy(t,e){if(!t.isDisposed()){var i=t.getZr();i[VN]=!0,t.dispatchAction({type:"brushSelect",batch:e}),i[VN]=!1}}function xy(t,e,i,n){for(var o=0,a=e.length;o=0}function Ny(t,e,i){function n(t,e){return l(e.nodes,t)>=0}function o(t,n){var o=!1;return e(function(e){d(i(t,e)||[],function(t){n.records[e.name][t]&&(o=!0)})}),o}function a(t,n){n.nodes.push(t),e(function(e){d(i(t,e)||[],function(t){n.records[e.name][t]=!0})})}return function(i){var r={nodes:[],records:{}};if(e(function(t){r.records[t.name]={}}),!i)return r;a(i,r);var s;do{s=!1,t(function(t){!n(t,r)&&o(t,r)&&(a(t,r),s=!0)})}while(s);return r}}function Oy(t,e,i){var n=[1/0,-1/0];return $N(i,function(t){var i=t.getData();i&&$N(i.mapDimension(e,!0),function(t){var e=i.getApproximateExtent(t);e[0]n[1]&&(n[1]=e[1])})}),n[1]0?0:NaN);var r=i.getMax(!0);return null!=r&&"dataMax"!==r&&"function"!=typeof r?e[1]=r:o&&(e[1]=a>0?a-1:NaN),i.get("scale",!0)||(e[0]>0&&(e[0]=0),e[1]<0&&(e[1]=0)),e}function Ry(t,e){var i=t.getAxisModel(),n=t._percentWindow,o=t._valueWindow;if(n){var a=Zo(o,[0,500]);a=Math.min(a,20);var r=e||0===n[0]&&100===n[1];i.setRange(r?null:+o[0].toFixed(a),r?null:+o[1].toFixed(a))}}function zy(t){var e=t._minMaxSpan={},i=t._dataZoomModel;$N(["min","max"],function(n){e[n+"Span"]=i.get(n+"Span");var o=i.get(n+"ValueSpan");if(null!=o&&(e[n+"ValueSpan"]=o,null!=(o=t.getAxisModel().axis.scale.parse(o)))){var a=t._dataExtent;e[n+"Span"]=Bo(a[0]+o,a,[0,100],!0)}})}function By(t){var e={};return tO(["start","end","startValue","endValue","throttle"],function(i){t.hasOwnProperty(i)&&(e[i]=t[i])}),e}function Vy(t,e){var i=t._rangePropMode,n=t.get("rangeMode");tO([["start","startValue"],["end","endValue"]],function(t,o){var a=null!=e[t[0]],r=null!=e[t[1]];a&&!r?i[o]="percent":!a&&r?i[o]="value":n?i[o]=n[o]:a&&(i[o]="percent")})}function Gy(t){return{x:"y",y:"x",radius:"angle",angle:"radius"}[t]}function Fy(t){return"vertical"===t?"ns-resize":"ew-resize"}function Wy(t,e){var i=Uy(t),n=e.dataZoomId,o=e.coordId;d(i,function(t,i){var a=t.dataZoomInfos;a[n]&&l(e.allCoordIds,o)<0&&(delete a[n],t.count--)}),jy(i);var a=i[o];a||((a=i[o]={coordId:o,dataZoomInfos:{},count:0}).controller=Xy(t,a),a.dispatchAction=v(Yy,t)),!a.dataZoomInfos[n]&&a.count++,a.dataZoomInfos[n]=e;var r=qy(a.dataZoomInfos);a.controller.enable(r.controlType,r.opt),a.controller.setPointerChecker(e.containsPoint),Nr(a,"dispatchAction",e.dataZoomModel.get("throttle",!0),"fixRate")}function Hy(t,e){var i=Uy(t);d(i,function(t){t.controller.dispose();var i=t.dataZoomInfos;i[e]&&(delete i[e],t.count--)}),jy(i)}function Zy(t){return t.type+"\0_"+t.id}function Uy(t){var e=t.getZr();return e[fO]||(e[fO]={})}function Xy(t,e){var i=new oc(t.getZr());return d(["pan","zoom","scrollMove"],function(t){i.on(t,function(i){var n=[];d(e.dataZoomInfos,function(o){if(i.isAvailableBehavior(o.dataZoomModel.option)){var a=(o.getRange||{})[t],r=a&&a(e.controller,i);!o.dataZoomModel.get("disabled",!0)&&r&&n.push({dataZoomId:o.dataZoomId,start:r[0],end:r[1]})}}),n.length&&e.dispatchAction(n)})}),i}function jy(t){d(t,function(e,i){e.count||(e.controller.dispose(),delete t[i])})}function Yy(t,e){t.dispatchAction({type:"dataZoom",batch:e})}function qy(t){var e,i={type_true:2,type_move:1,type_false:0,type_undefined:-1},n=!0;return d(t,function(t){var o=t.dataZoomModel,a=!o.get("disabled",!0)&&(!o.get("zoomLock",!0)||"move");i["type_"+a]>i["type_"+e]&&(e=a),n&=o.get("preventDefaultMouseMove",!0)}),{controlType:e,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!n}}}function Ky(t){return function(e,i,n,o){var a=this._range,r=a.slice(),s=e.axisModels[0];if(s){var l=t(r,s,e,i,n,o);return QL(l,r,[0,100],"all"),this._range=r,a[0]!==r[0]||a[1]!==r[1]?r:void 0}}}function $y(t,e){return t&&t.hasOwnProperty&&t.hasOwnProperty(e)}function Jy(t,e,i,n){for(var o=e.targetVisuals[n],a=hL.prepareVisualTypes(o),r={color:t.getData().getVisual("color")},s=0,l=a.length;s=0&&(r[a]=+r[a].toFixed(h)),r}function fx(t,e){var n=t.getData(),o=t.coordinateSystem;if(e&&!cx(e)&&!y(e.coord)&&o){var a=o.dimensions,r=px(e,n,o,t);if((e=i(e)).type&&YO[e.type]&&r.baseAxis&&r.valueAxis){var s=XO(a,r.baseAxis.dim),l=XO(a,r.valueAxis.dim);e.coord=YO[e.type](n,r.baseDataDim,r.valueDataDim,s,l),e.value=e.coord[l]}else{for(var u=[null!=e.xAxis?e.xAxis:e.radiusAxis,null!=e.yAxis?e.yAxis:e.angleAxis],h=0;h<2;h++)YO[u[h]]&&(u[h]=yx(n,n.mapDimension(a[h]),u[h]));e.coord=u}}return e}function px(t,e,i,n){var o={};return null!=t.valueIndex||null!=t.valueDim?(o.valueDataDim=null!=t.valueIndex?e.getDimension(t.valueIndex):t.valueDim,o.valueAxis=i.getAxis(gx(n,o.valueDataDim)),o.baseAxis=i.getOtherAxis(o.valueAxis),o.baseDataDim=e.mapDimension(o.baseAxis.dim)):(o.baseAxis=n.getBaseAxis(),o.valueAxis=i.getOtherAxis(o.baseAxis),o.baseDataDim=e.mapDimension(o.baseAxis.dim),o.valueDataDim=e.mapDimension(o.valueAxis.dim)),o}function gx(t,e){var i=t.getData(),n=i.dimensions;e=i.getDimension(e);for(var o=0;o=0)return!0}function Yx(t){for(var e=t.split(/\n+/g),i=[],n=f(Xx(e.shift()).split(pE),function(t){return{name:t,data:[]}}),o=0;o=0&&!i[o][n];o--);if(o<0){var a=t.queryComponents({mainType:"dataZoom",subType:"select",id:n})[0];if(a){var r=a.getPercentRange();i[0][n]={dataZoomId:n,start:r[0],end:r[1]}}}}),i.push(e)}function t_(t){var e=n_(t),i=e[e.length-1];e.length>1&&e.pop();var n={};return gE(i,function(t,i){for(var o=e.length-1;o>=0;o--)if(t=e[o][i]){n[i]=t;break}}),n}function e_(t){t[mE]=null}function i_(t){return n_(t).length}function n_(t){var e=t[mE];return e||(e=t[mE]=[{}]),e}function o_(t,e,i){(this._brushController=new zf(i.getZr())).on("brush",m(this._onBrush,this)).mount(),this._isZoomActive}function a_(t){var e={};return d(["xAxisIndex","yAxisIndex"],function(i){e[i]=t[i],null==e[i]&&(e[i]="all"),(!1===e[i]||"none"===e[i])&&(e[i]=[])}),e}function r_(t,e){t.setIconStatus("back",i_(e)>1?"emphasis":"normal")}function s_(t,e,i,n,o){var a=i._isZoomActive;n&&"takeGlobalCursor"===n.type&&(a="dataZoomSelect"===n.key&&n.dataZoomSelectActive),i._isZoomActive=a,t.setIconStatus("zoom",a?"emphasis":"normal");var r=new hy(a_(t.option),e,{include:["grid"]});i._brushController.setPanels(r.makePanelOpts(o,function(t){return t.xAxisDeclared&&!t.yAxisDeclared?"lineX":!t.xAxisDeclared&&t.yAxisDeclared?"lineY":"rect"})).enableBrush(!!a&&{brushType:"auto",brushStyle:{lineWidth:0,fill:"rgba(0,0,0,0.2)"}})}function l_(t){this.model=t}function u_(t){return SE(t)}function h_(){if(!TE&&AE){TE=!0;var t=AE.styleSheets;t.length<31?AE.createStyleSheet().addRule(".zrvml","behavior:url(#default#VML)"):t[0].addRule(".zrvml","behavior:url(#default#VML)")}}function c_(t){return parseInt(t,10)}function d_(t,e){h_(),this.root=t,this.storage=e;var i=document.createElement("div"),n=document.createElement("div");i.style.cssText="display:inline-block;overflow:hidden;position:relative;width:300px;height:150px;",n.style.cssText="position:absolute;left:0;top:0;",t.appendChild(i),this._vmlRoot=n,this._vmlViewport=i,this.resize();var o=e.delFromStorage,a=e.addToStorage;e.delFromStorage=function(t){o.call(e,t),t&&t.onRemove&&t.onRemove(n)},e.addToStorage=function(t){t.onAdd&&t.onAdd(n),a.call(e,t)},this._firstPaint=!0}function f_(t){return function(){Yw('In IE8.0 VML mode painter not support method "'+t+'"')}}function p_(t){return document.createElementNS(sR,t)}function g_(t){return cR(1e4*t)/1e4}function m_(t){return t-vR}function v_(t,e){var i=e?t.textFill:t.fill;return null!=i&&i!==hR}function y_(t,e){var i=e?t.textStroke:t.stroke;return null!=i&&i!==hR}function x_(t,e){e&&__(t,"transform","matrix("+uR.call(e,",")+")")}function __(t,e,i){(!i||"linear"!==i.type&&"radial"!==i.type)&&t.setAttribute(e,i)}function w_(t,e,i){t.setAttributeNS("http://www.w3.org/1999/xlink",e,i)}function b_(t,e,i,n){if(v_(e,i)){var o=i?e.textFill:e.fill;o="transparent"===o?hR:o,"none"!==t.getAttribute("clip-path")&&o===hR&&(o="rgba(0, 0, 0, 0.002)"),__(t,"fill",o),__(t,"fill-opacity",null!=e.fillOpacity?e.fillOpacity*e.opacity:e.opacity)}else __(t,"fill",hR);if(y_(e,i)){var a=i?e.textStroke:e.stroke;__(t,"stroke",a="transparent"===a?hR:a),__(t,"stroke-width",(i?e.textStrokeWidth:e.lineWidth)/(!i&&e.strokeNoScale?n.getLineScale():1)),__(t,"paint-order",i?"stroke":"fill"),__(t,"stroke-opacity",null!=e.strokeOpacity?e.strokeOpacity:e.opacity),e.lineDash?(__(t,"stroke-dasharray",e.lineDash.join(",")),__(t,"stroke-dashoffset",cR(e.lineDashOffset||0))):__(t,"stroke-dasharray",""),e.lineCap&&__(t,"stroke-linecap",e.lineCap),e.lineJoin&&__(t,"stroke-linejoin",e.lineJoin),e.miterLimit&&__(t,"stroke-miterlimit",e.miterLimit)}else __(t,"stroke",hR)}function S_(t){for(var e=[],i=t.data,n=t.len(),o=0;o=gR||!m_(g)&&(d>-pR&&d<0||d>pR)==!!p;var y=g_(s+u*fR(c)),x=g_(l+h*dR(c));m&&(d=p?gR-1e-4:1e-4-gR,v=!0,9===o&&e.push("M",y,x));var _=g_(s+u*fR(c+d)),w=g_(l+h*dR(c+d));e.push("A",g_(u),g_(h),cR(f*mR),+v,+p,_,w);break;case lR.Z:a="Z";break;case lR.R:var _=g_(i[o++]),w=g_(i[o++]),b=g_(i[o++]),S=g_(i[o++]);e.push("M",_,w,"L",_+b,w,"L",_+b,w+S,"L",_,w+S,"L",_,w)}a&&e.push(a);for(var M=0;M=11),domSupported:"undefined"!=typeof document}}(navigator.userAgent),X_={"[object Function]":1,"[object RegExp]":1,"[object Date]":1,"[object Error]":1,"[object CanvasGradient]":1,"[object CanvasPattern]":1,"[object Image]":1,"[object Canvas]":1},j_={"[object Int8Array]":1,"[object Uint8Array]":1,"[object Uint8ClampedArray]":1,"[object Int16Array]":1,"[object Uint16Array]":1,"[object Int32Array]":1,"[object Uint32Array]":1,"[object Float32Array]":1,"[object Float64Array]":1},Y_=Object.prototype.toString,q_=Array.prototype,K_=q_.forEach,$_=q_.filter,J_=q_.slice,Q_=q_.map,tw=q_.reduce,ew={},iw=function(){return ew.createCanvas()};ew.createCanvas=function(){return document.createElement("canvas")};var nw,ow="__ec_primitive__";E.prototype={constructor:E,get:function(t){return this.data.hasOwnProperty(t)?this.data[t]:null},set:function(t,e){return this.data[t]=e},each:function(t,e){void 0!==e&&(t=m(t,e));for(var i in this.data)this.data.hasOwnProperty(i)&&t(this.data[i],i)},removeKey:function(t){delete this.data[t]}};var aw=(Object.freeze||Object)({$override:e,clone:i,merge:n,mergeAll:o,extend:a,defaults:r,createCanvas:iw,getContext:s,indexOf:l,inherits:u,mixin:h,isArrayLike:c,each:d,map:f,reduce:p,filter:g,find:function(t,e,i){if(t&&e)for(var n=0,o=t.length;n3&&(n=dw.call(n,1));for(var a=e.length,r=0;r4&&(n=dw.call(n,1,n.length-1));for(var a=n[n.length-1],r=e.length,s=0;s1&&n&&n.length>1){var a=ft(n)/ft(o);!isFinite(a)&&(a=1),e.pinchScale=a;var r=pt(n);return e.pinchX=r[0],e.pinchY=r[1],{type:"pinch",target:t[0].target,event:e}}}}},xw="silent";vt.prototype.dispose=function(){};var _w=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],ww=function(t,e,i,n){fw.call(this),this.storage=t,this.painter=e,this.painterRoot=n,i=i||new vt,this.proxy=null,this._hovered={},this._lastTouchMoment,this._lastX,this._lastY,this._gestureMgr,it.call(this),this.setHandlerProxy(i)};ww.prototype={constructor:ww,setHandlerProxy:function(t){this.proxy&&this.proxy.dispose(),t&&(d(_w,function(e){t.on&&t.on(e,this[e],this)},this),t.handler=this),this.proxy=t},mousemove:function(t){var e=t.zrX,i=t.zrY,n=this._hovered,o=n.target;o&&!o.__zr&&(o=(n=this.findHover(n.x,n.y)).target);var a=this._hovered=this.findHover(e,i),r=a.target,s=this.proxy;s.setCursor&&s.setCursor(r?r.cursor:"default"),o&&r!==o&&this.dispatchToElement(n,"mouseout",t),this.dispatchToElement(a,"mousemove",t),r&&r!==o&&this.dispatchToElement(a,"mouseover",t)},mouseout:function(t){this.dispatchToElement(this._hovered,"mouseout",t);var e,i=t.toElement||t.relatedTarget;do{i=i&&i.parentNode}while(i&&9!==i.nodeType&&!(e=i===this.painterRoot));!e&&this.trigger("globalout",{event:t})},resize:function(t){this._hovered={}},dispatch:function(t,e){var i=this[t];i&&i.call(this,e)},dispose:function(){this.proxy.dispose(),this.storage=this.proxy=this.painter=null},setCursorStyle:function(t){var e=this.proxy;e.setCursor&&e.setCursor(t)},dispatchToElement:function(t,e,i){var n=(t=t||{}).target;if(!n||!n.silent){for(var o="on"+e,a=gt(e,t,i);n&&(n[o]&&(a.cancelBubble=n[o].call(n,a)),n.trigger(e,a),n=n.parent,!a.cancelBubble););a.cancelBubble||(this.trigger(e,a),this.painter&&this.painter.eachOtherLayer(function(t){"function"==typeof t[o]&&t[o].call(t,a),t.trigger&&t.trigger(e,a)}))}},findHover:function(t,e,i){for(var n=this.storage.getDisplayList(),o={x:t,y:e},a=n.length-1;a>=0;a--){var r;if(n[a]!==i&&!n[a].ignore&&(r=yt(n[a],t,e))&&(!o.topTarget&&(o.topTarget=n[a]),r!==xw)){o.target=n[a];break}}return o},processGesture:function(t,e){this._gestureMgr||(this._gestureMgr=new vw);var i=this._gestureMgr;"start"===e&&i.clear();var n=i.recognize(t,this.findHover(t.zrX,t.zrY,null).target,this.proxy.dom);if("end"===e&&i.clear(),n){var o=n.type;t.gestureEvent=o,this.dispatchToElement({target:n.target},o,n.event)}}},d(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){ww.prototype[t]=function(e){var i=this.findHover(e.zrX,e.zrY),n=i.target;if("mousedown"===t)this._downEl=n,this._downPoint=[e.zrX,e.zrY],this._upEl=n;else if("mouseup"===t)this._upEl=n;else if("click"===t){if(this._downEl!==this._upEl||!this._downPoint||uw(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(i,t,e)}}),h(ww,fw),h(ww,it);var bw="undefined"==typeof Float32Array?Array:Float32Array,Sw=(Object.freeze||Object)({create:xt,identity:_t,copy:wt,mul:bt,translate:St,rotate:Mt,scale:It,invert:Tt,clone:At}),Mw=_t,Iw=5e-5,Tw=function(t){(t=t||{}).position||(this.position=[0,0]),null==t.rotation&&(this.rotation=0),t.scale||(this.scale=[1,1]),this.origin=this.origin||null},Aw=Tw.prototype;Aw.transform=null,Aw.needLocalTransform=function(){return Dt(this.rotation)||Dt(this.position[0])||Dt(this.position[1])||Dt(this.scale[0]-1)||Dt(this.scale[1]-1)};var Dw=[];Aw.updateTransform=function(){var t=this.parent,e=t&&t.transform,i=this.needLocalTransform(),n=this.transform;if(i||e){n=n||xt(),i?this.getLocalTransform(n):Mw(n),e&&(i?bt(n,t.transform,n):wt(n,t.transform)),this.transform=n;var o=this.globalScaleRatio;if(null!=o&&1!==o){this.getGlobalScale(Dw);var a=Dw[0]<0?-1:1,r=Dw[1]<0?-1:1,s=((Dw[0]-a)*o+a)/Dw[0]||0,l=((Dw[1]-r)*o+r)/Dw[1]||0;n[0]*=s,n[1]*=s,n[2]*=l,n[3]*=l}this.invTransform=this.invTransform||xt(),Tt(this.invTransform,n)}else n&&Mw(n)},Aw.getLocalTransform=function(t){return Tw.getLocalTransform(this,t)},Aw.setTransform=function(t){var e=this.transform,i=t.dpr||1;e?t.setTransform(i*e[0],i*e[1],i*e[2],i*e[3],i*e[4],i*e[5]):t.setTransform(i,0,0,i,0,0)},Aw.restoreTransform=function(t){var e=t.dpr||1;t.setTransform(e,0,0,e,0,0)};var Cw=[],Lw=xt();Aw.setLocalTransform=function(t){if(t){var e=t[0]*t[0]+t[1]*t[1],i=t[2]*t[2]+t[3]*t[3],n=this.position,o=this.scale;Dt(e-1)&&(e=Math.sqrt(e)),Dt(i-1)&&(i=Math.sqrt(i)),t[0]<0&&(e=-e),t[3]<0&&(i=-i),n[0]=t[4],n[1]=t[5],o[0]=e,o[1]=i,this.rotation=Math.atan2(-t[1]/i,t[0]/e)}},Aw.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(bt(Cw,t.invTransform,e),e=Cw);var i=this.origin;i&&(i[0]||i[1])&&(Lw[4]=i[0],Lw[5]=i[1],bt(Cw,e,Lw),Cw[4]-=i[0],Cw[5]-=i[1],e=Cw),this.setLocalTransform(e)}},Aw.getGlobalScale=function(t){var e=this.transform;return t=t||[],e?(t[0]=Math.sqrt(e[0]*e[0]+e[1]*e[1]),t[1]=Math.sqrt(e[2]*e[2]+e[3]*e[3]),e[0]<0&&(t[0]=-t[0]),e[3]<0&&(t[1]=-t[1]),t):(t[0]=1,t[1]=1,t)},Aw.transformCoordToLocal=function(t,e){var i=[t,e],n=this.invTransform;return n&&Q(i,i,n),i},Aw.transformCoordToGlobal=function(t,e){var i=[t,e],n=this.transform;return n&&Q(i,i,n),i},Tw.getLocalTransform=function(t,e){Mw(e=e||[]);var i=t.origin,n=t.scale||[1,1],o=t.rotation||0,a=t.position||[0,0];return i&&(e[4]-=i[0],e[5]-=i[1]),It(e,e,n),o&&Mt(e,e,o),i&&(e[4]+=i[0],e[5]+=i[1]),e[4]+=a[0],e[5]+=a[1],e};var kw={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return.5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return 0===t?0:Math.pow(1024,t-1)},exponentialOut:function(t){return 1===t?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),-i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4))},elasticOut:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/.4)+1)},elasticInOut:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),(t*=2)<1?i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-kw.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?.5*kw.bounceIn(2*t):.5*kw.bounceOut(2*t-1)+.5}};Ct.prototype={constructor:Ct,step:function(t,e){if(this._initialized||(this._startTime=t+this._delay,this._initialized=!0),this._paused)this._pausedTime+=e;else{var i=(t-this._startTime-this._pausedTime)/this._life;if(!(i<0)){i=Math.min(i,1);var n=this.easing,o="string"==typeof n?kw[n]:n,a="function"==typeof o?o(i):i;return this.fire("frame",a),1===i?this.loop?(this.restart(t),"restart"):(this._needsRemove=!0,"destroy"):null}}},restart:function(t){var e=(t-this._startTime-this._pausedTime)%this._life;this._startTime=t-e+this.gap,this._pausedTime=0,this._needsRemove=!1},fire:function(t,e){this[t="on"+t]&&this[t](this._target,e)},pause:function(){this._paused=!0},resume:function(){this._paused=!1}};var Pw=function(){this.head=null,this.tail=null,this._len=0},Nw=Pw.prototype;Nw.insert=function(t){var e=new Ow(t);return this.insertEntry(e),e},Nw.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},Nw.remove=function(t){var e=t.prev,i=t.next;e?e.next=i:this.head=i,i?i.prev=e:this.tail=e,t.next=t.prev=null,this._len--},Nw.len=function(){return this._len},Nw.clear=function(){this.head=this.tail=null,this._len=0};var Ow=function(t){this.value=t,this.next,this.prev},Ew=function(t){this._list=new Pw,this._map={},this._maxSize=t||10,this._lastRemovedEntry=null},Rw=Ew.prototype;Rw.put=function(t,e){var i=this._list,n=this._map,o=null;if(null==n[t]){var a=i.len(),r=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var s=i.head;i.remove(s),delete n[s.key],o=s.value,this._lastRemovedEntry=s}r?r.value=e:r=new Ow(e),r.key=t,i.insertEntry(r),n[t]=r}return o},Rw.get=function(t){var e=this._map[t],i=this._list;if(null!=e)return e!==i.tail&&(i.remove(e),i.insertEntry(e)),e.value},Rw.clear=function(){this._list.clear(),this._map={}};var zw={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]},Bw=new Ew(20),Vw=null,Gw=Ut,Fw=Xt,Ww=(Object.freeze||Object)({parse:Gt,lift:Ht,toHex:Zt,fastLerp:Ut,fastMapToColor:Gw,lerp:Xt,mapToColor:Fw,modifyHSL:jt,modifyAlpha:Yt,stringify:qt}),Hw=Array.prototype.slice,Zw=function(t,e,i,n){this._tracks={},this._target=t,this._loop=e||!1,this._getter=i||Kt,this._setter=n||$t,this._clipCount=0,this._delay=0,this._doneList=[],this._onframeList=[],this._clipList=[]};Zw.prototype={when:function(t,e){var i=this._tracks;for(var n in e)if(e.hasOwnProperty(n)){if(!i[n]){i[n]=[];var o=this._getter(this._target,n);if(null==o)continue;0!==t&&i[n].push({time:0,value:ae(o)})}i[n].push({time:t,value:e[n]})}return this},during:function(t){return this._onframeList.push(t),this},pause:function(){for(var t=0;t=i.x&&t<=i.x+i.width&&e>=i.y&&e<=i.y+i.height},clone:function(){return new de(this.x,this.y,this.width,this.height)},copy:function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},plain:function(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},de.create=function(t){return new de(t.x,t.y,t.width,t.height)};var tb=function(t){t=t||{},Kw.call(this,t);for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);this._children=[],this.__storage=null,this.__dirty=!0};tb.prototype={constructor:tb,isGroup:!0,type:"group",silent:!1,children:function(){return this._children.slice()},childAt:function(t){return this._children[t]},childOfName:function(t){for(var e=this._children,i=0;i=0&&(i.splice(n,0,t),this._doAdd(t))}return this},_doAdd:function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__storage,i=this.__zr;e&&e!==t.__storage&&(e.addToStorage(t),t instanceof tb&&t.addChildrenToStorage(e)),i&&i.refresh()},remove:function(t){var e=this.__zr,i=this.__storage,n=this._children,o=l(n,t);return o<0?this:(n.splice(o,1),t.parent=null,i&&(i.delFromStorage(t),t instanceof tb&&t.delChildrenFromStorage(i)),e&&e.refresh(),this)},removeAll:function(){var t,e,i=this._children,n=this.__storage;for(e=0;e=0&&(this.delFromStorage(t),this._roots.splice(o,1),t instanceof tb&&t.delChildrenFromStorage(this))}},addToStorage:function(t){return t&&(t.__storage=this,t.dirty(!1)),this},delFromStorage:function(t){return t&&(t.__storage=null),this},dispose:function(){this._renderList=this._roots=null},displayableSortFunc:we};var ob={shadowBlur:1,shadowOffsetX:1,shadowOffsetY:1,textShadowBlur:1,textShadowOffsetX:1,textShadowOffsetY:1,textBoxShadowBlur:1,textBoxShadowOffsetX:1,textBoxShadowOffsetY:1},ab=function(t,e,i){return ob.hasOwnProperty(e)?i*=t.dpr:i},rb={NONE:0,STYLE_BIND:1,PLAIN_TEXT:2},sb=9,lb=[["shadowBlur",0],["shadowOffsetX",0],["shadowOffsetY",0],["shadowColor","#000"],["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]],ub=function(t){this.extendFrom(t,!1)};ub.prototype={constructor:ub,fill:"#000",stroke:null,opacity:1,fillOpacity:null,strokeOpacity:null,lineDash:null,lineDashOffset:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,lineWidth:1,strokeNoScale:!1,text:null,font:null,textFont:null,fontStyle:null,fontWeight:null,fontSize:null,fontFamily:null,textTag:null,textFill:"#000",textStroke:null,textWidth:null,textHeight:null,textStrokeWidth:0,textLineHeight:null,textPosition:"inside",textRect:null,textOffset:null,textAlign:null,textVerticalAlign:null,textDistance:5,textShadowColor:"transparent",textShadowBlur:0,textShadowOffsetX:0,textShadowOffsetY:0,textBoxShadowColor:"transparent",textBoxShadowBlur:0,textBoxShadowOffsetX:0,textBoxShadowOffsetY:0,transformText:!1,textRotation:0,textOrigin:null,textBackgroundColor:null,textBorderColor:null,textBorderWidth:0,textBorderRadius:0,textPadding:null,rich:null,truncate:null,blend:null,bind:function(t,e,i){var n=this,o=i&&i.style,a=!o||t.__attrCachedBy!==rb.STYLE_BIND;t.__attrCachedBy=rb.STYLE_BIND;for(var r=0;r0},extendFrom:function(t,e){if(t)for(var i in t)!t.hasOwnProperty(i)||!0!==e&&(!1===e?this.hasOwnProperty(i):null==t[i])||(this[i]=t[i])},set:function(t,e){"string"==typeof t?this[t]=e:this.extendFrom(t,!0)},clone:function(){var t=new this.constructor;return t.extendFrom(this,!0),t},getGradient:function(t,e,i){for(var n=("radial"===e.type?Se:be)(t,e,i),o=e.colorStops,a=0;a=0&&i.splice(n,1),t.__hoverMir=null},clearHover:function(t){for(var e=this._hoverElements,i=0;i15)break}s.__drawIndex=m,s.__drawIndex0&&t>n[0]){for(r=0;rt);r++);a=i[n[r]]}if(n.splice(r+1,0,t),i[t]=e,!e.virtual)if(a){var l=a.dom;l.nextSibling?s.insertBefore(e.dom,l.nextSibling):s.appendChild(e.dom)}else s.firstChild?s.insertBefore(e.dom,s.firstChild):s.appendChild(e.dom)}else Yw("Layer of zlevel "+t+" is not valid")},eachLayer:function(t,e){var i,n,o=this._zlevelList;for(n=0;n0?.01:0),this._needsManuallyCompositing),a.__builtin__||Yw("ZLevel "+s+" has been used by unkown layer "+a.id),a!==i&&(a.__used=!0,a.__startIndex!==o&&(a.__dirty=!0),a.__startIndex=o,a.incremental?a.__drawIndex=-1:a.__drawIndex=o,e(o),i=a),r.__dirty&&(a.__dirty=!0,a.incremental&&a.__drawIndex<0&&(a.__drawIndex=o))}e(o),this.eachBuiltinLayer(function(t,e){!t.__used&&t.getElementCount()>0&&(t.__dirty=!0,t.__startIndex=t.__endIndex=t.__drawIndex=0),t.__dirty&&t.__drawIndex<0&&(t.__drawIndex=t.__startIndex)})},clear:function(){return this.eachBuiltinLayer(this._clearLayer),this},_clearLayer:function(t){t.clear()},setBackgroundColor:function(t){this._backgroundColor=t},configLayer:function(t,e){if(e){var i=this._layerConfig;i[t]?n(i[t],e,!0):i[t]=e;for(var o=0;o=0&&this._clips.splice(e,1)},removeAnimator:function(t){for(var e=t.getClips(),i=0;i=0||n&&l(n,r)<0)){var s=e.getShallow(r);null!=s&&(o[t[a][0]]=s)}}return o}},tS=Qb([["lineWidth","width"],["stroke","color"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]),eS={getLineStyle:function(t){var e=tS(this,t),i=this.getLineDash(e.lineWidth);return i&&(e.lineDash=i),e},getLineDash:function(t){null==t&&(t=1);var e=this.get("type"),i=Math.max(t,2),n=4*t;return"solid"===e||null==e?null:"dashed"===e?[n,n]:[i,i]}},iS=Qb([["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]]),nS={getAreaStyle:function(t,e){return iS(this,t,e)}},oS=Math.pow,aS=Math.sqrt,rS=1e-8,sS=1e-4,lS=aS(3),uS=1/3,hS=V(),cS=V(),dS=V(),fS=Math.min,pS=Math.max,gS=Math.sin,mS=Math.cos,vS=2*Math.PI,yS=V(),xS=V(),_S=V(),wS=[],bS=[],SS={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},MS=[],IS=[],TS=[],AS=[],DS=Math.min,CS=Math.max,LS=Math.cos,kS=Math.sin,PS=Math.sqrt,NS=Math.abs,OS="undefined"!=typeof Float32Array,ES=function(t){this._saveData=!t,this._saveData&&(this.data=[]),this._ctx=null};ES.prototype={constructor:ES,_xi:0,_yi:0,_x0:0,_y0:0,_ux:0,_uy:0,_len:0,_lineDash:null,_dashOffset:0,_dashIdx:0,_dashSum:0,setScale:function(t,e){this._ux=NS(1/Xw/t)||0,this._uy=NS(1/Xw/e)||0},getContext:function(){return this._ctx},beginPath:function(t){return this._ctx=t,t&&t.beginPath(),t&&(this.dpr=t.dpr),this._saveData&&(this._len=0),this._lineDash&&(this._lineDash=null,this._dashOffset=0),this},moveTo:function(t,e){return this.addData(SS.M,t,e),this._ctx&&this._ctx.moveTo(t,e),this._x0=t,this._y0=e,this._xi=t,this._yi=e,this},lineTo:function(t,e){var i=NS(t-this._xi)>this._ux||NS(e-this._yi)>this._uy||this._len<5;return this.addData(SS.L,t,e),this._ctx&&i&&(this._needsDash()?this._dashedLineTo(t,e):this._ctx.lineTo(t,e)),i&&(this._xi=t,this._yi=e),this},bezierCurveTo:function(t,e,i,n,o,a){return this.addData(SS.C,t,e,i,n,o,a),this._ctx&&(this._needsDash()?this._dashedBezierTo(t,e,i,n,o,a):this._ctx.bezierCurveTo(t,e,i,n,o,a)),this._xi=o,this._yi=a,this},quadraticCurveTo:function(t,e,i,n){return this.addData(SS.Q,t,e,i,n),this._ctx&&(this._needsDash()?this._dashedQuadraticTo(t,e,i,n):this._ctx.quadraticCurveTo(t,e,i,n)),this._xi=i,this._yi=n,this},arc:function(t,e,i,n,o,a){return this.addData(SS.A,t,e,i,i,n,o-n,0,a?0:1),this._ctx&&this._ctx.arc(t,e,i,n,o,a),this._xi=LS(o)*i+t,this._yi=kS(o)*i+e,this},arcTo:function(t,e,i,n,o){return this._ctx&&this._ctx.arcTo(t,e,i,n,o),this},rect:function(t,e,i,n){return this._ctx&&this._ctx.rect(t,e,i,n),this.addData(SS.R,t,e,i,n),this},closePath:function(){this.addData(SS.Z);var t=this._ctx,e=this._x0,i=this._y0;return t&&(this._needsDash()&&this._dashedLineTo(e,i),t.closePath()),this._xi=e,this._yi=i,this},fill:function(t){t&&t.fill(),this.toStatic()},stroke:function(t){t&&t.stroke(),this.toStatic()},setLineDash:function(t){if(t instanceof Array){this._lineDash=t,this._dashIdx=0;for(var e=0,i=0;ie.length&&(this._expandData(),e=this.data);for(var i=0;i0&&f<=t||h<0&&f>=t||0===h&&(c>0&&p<=e||c<0&&p>=e);)f+=h*(i=r[n=this._dashIdx]),p+=c*i,this._dashIdx=(n+1)%g,h>0&&fl||c>0&&pu||s[n%2?"moveTo":"lineTo"](h>=0?DS(f,t):CS(f,t),c>=0?DS(p,e):CS(p,e));h=f-t,c=p-e,this._dashOffset=-PS(h*h+c*c)},_dashedBezierTo:function(t,e,i,n,o,a){var r,s,l,u,h,c=this._dashSum,d=this._dashOffset,f=this._lineDash,p=this._ctx,g=this._xi,m=this._yi,v=tn,y=0,x=this._dashIdx,_=f.length,w=0;for(d<0&&(d=c+d),d%=c,r=0;r<1;r+=.1)s=v(g,t,i,o,r+.1)-v(g,t,i,o,r),l=v(m,e,n,a,r+.1)-v(m,e,n,a,r),y+=PS(s*s+l*l);for(;x<_&&!((w+=f[x])>d);x++);for(r=(w-d)/y;r<=1;)u=v(g,t,i,o,r),h=v(m,e,n,a,r),x%2?p.moveTo(u,h):p.lineTo(u,h),r+=f[x]/y,x=(x+1)%_;x%2!=0&&p.lineTo(o,a),s=o-u,l=a-h,this._dashOffset=-PS(s*s+l*l)},_dashedQuadraticTo:function(t,e,i,n){var o=i,a=n;i=(i+2*t)/3,n=(n+2*e)/3,t=(this._xi+2*t)/3,e=(this._yi+2*e)/3,this._dashedBezierTo(t,e,i,n,o,a)},toStatic:function(){var t=this.data;t instanceof Array&&(t.length=this._len,OS&&(this.data=new Float32Array(t)))},getBoundingRect:function(){MS[0]=MS[1]=TS[0]=TS[1]=Number.MAX_VALUE,IS[0]=IS[1]=AS[0]=AS[1]=-Number.MAX_VALUE;for(var t=this.data,e=0,i=0,n=0,o=0,a=0;al||NS(r-o)>u||c===h-1)&&(t.lineTo(a,r),n=a,o=r);break;case SS.C:t.bezierCurveTo(s[c++],s[c++],s[c++],s[c++],s[c++],s[c++]),n=s[c-2],o=s[c-1];break;case SS.Q:t.quadraticCurveTo(s[c++],s[c++],s[c++],s[c++]),n=s[c-2],o=s[c-1];break;case SS.A:var f=s[c++],p=s[c++],g=s[c++],m=s[c++],v=s[c++],y=s[c++],x=s[c++],_=s[c++],w=g>m?g:m,b=g>m?1:g/m,S=g>m?m/g:1,M=v+y;Math.abs(g-m)>.001?(t.translate(f,p),t.rotate(x),t.scale(b,S),t.arc(0,0,w,v,M,1-_),t.scale(1/b,1/S),t.rotate(-x),t.translate(-f,-p)):t.arc(f,p,w,v,M,1-_),1===c&&(e=LS(v)*g+f,i=kS(v)*m+p),n=LS(M)*g+f,o=kS(M)*m+p;break;case SS.R:e=n=s[c],i=o=s[c+1],t.rect(s[c++],s[c++],s[c++],s[c++]);break;case SS.Z:t.closePath(),n=e,o=i}}}},ES.CMD=SS;var RS=2*Math.PI,zS=2*Math.PI,BS=ES.CMD,VS=2*Math.PI,GS=1e-4,FS=[-1,-1,-1],WS=[-1,-1],HS=fb.prototype.getCanvasPattern,ZS=Math.abs,US=new ES(!0);Pn.prototype={constructor:Pn,type:"path",__dirtyPath:!0,strokeContainThreshold:5,subPixelOptimize:!1,brush:function(t,e){var i=this.style,n=this.path||US,o=i.hasStroke(),a=i.hasFill(),r=i.fill,s=i.stroke,l=a&&!!r.colorStops,u=o&&!!s.colorStops,h=a&&!!r.image,c=o&&!!s.image;if(i.bind(t,this,e),this.setTransform(t),this.__dirty){var d;l&&(d=d||this.getBoundingRect(),this._fillGradient=i.getGradient(t,r,d)),u&&(d=d||this.getBoundingRect(),this._strokeGradient=i.getGradient(t,s,d))}l?t.fillStyle=this._fillGradient:h&&(t.fillStyle=HS.call(r,t)),u?t.strokeStyle=this._strokeGradient:c&&(t.strokeStyle=HS.call(s,t));var f=i.lineDash,p=i.lineDashOffset,g=!!t.setLineDash,m=this.getGlobalScale();if(n.setScale(m[0],m[1]),this.__dirtyPath||f&&!g&&o?(n.beginPath(t),f&&!g&&(n.setLineDash(f),n.setLineDashOffset(p)),this.buildPath(n,this.shape,!1),this.path&&(this.__dirtyPath=!1)):(t.beginPath(),this.path.rebuildPath(t)),a)if(null!=i.fillOpacity){v=t.globalAlpha;t.globalAlpha=i.fillOpacity*i.opacity,n.fill(t),t.globalAlpha=v}else n.fill(t);if(f&&g&&(t.setLineDash(f),t.lineDashOffset=p),o)if(null!=i.strokeOpacity){var v=t.globalAlpha;t.globalAlpha=i.strokeOpacity*i.opacity,n.stroke(t),t.globalAlpha=v}else n.stroke(t);f&&g&&t.setLineDash([]),null!=i.text&&(this.restoreTransform(t),this.drawRectText(t,this.getBoundingRect()))},buildPath:function(t,e,i){},createPathProxy:function(){this.path=new ES},getBoundingRect:function(){var t=this._rect,e=this.style,i=!t;if(i){var n=this.path;n||(n=this.path=new ES),this.__dirtyPath&&(n.beginPath(),this.buildPath(n,this.shape,!1)),t=n.getBoundingRect()}if(this._rect=t,e.hasStroke()){var o=this._rectWithStroke||(this._rectWithStroke=t.clone());if(this.__dirty||i){o.copy(t);var a=e.lineWidth,r=e.strokeNoScale?this.getLineScale():1;e.hasFill()||(a=Math.max(a,this.strokeContainThreshold||4)),r>1e-10&&(o.width+=a/r,o.height+=a/r,o.x-=a/r/2,o.y-=a/r/2)}return o}return t},contain:function(t,e){var i=this.transformCoordToLocal(t,e),n=this.getBoundingRect(),o=this.style;if(t=i[0],e=i[1],n.contain(t,e)){var a=this.path.data;if(o.hasStroke()){var r=o.lineWidth,s=o.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(o.hasFill()||(r=Math.max(r,this.strokeContainThreshold)),kn(a,r/s,t,e)))return!0}if(o.hasFill())return Ln(a,t,e)}return!1},dirty:function(t){null==t&&(t=!0),t&&(this.__dirtyPath=t,this._rect=null),this.__dirty=this.__dirtyText=!0,this.__zr&&this.__zr.refresh(),this.__clipTarget&&this.__clipTarget.dirty()},animateShape:function(t){return this.animate("shape",t)},attrKV:function(t,e){"shape"===t?(this.setShape(e),this.__dirtyPath=!0,this._rect=null):di.prototype.attrKV.call(this,t,e)},setShape:function(t,e){var i=this.shape;if(i){if(w(t))for(var n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);else i[t]=e;this.dirty(!0)}return this},getLineScale:function(){var t=this.transform;return t&&ZS(t[0]-1)>1e-10&&ZS(t[3]-1)>1e-10?Math.sqrt(ZS(t[0]*t[3]-t[2]*t[1])):1}},Pn.extend=function(t){var e=function(e){Pn.call(this,e),t.style&&this.style.extendFrom(t.style,!1);var i=t.shape;if(i){this.shape=this.shape||{};var n=this.shape;for(var o in i)!n.hasOwnProperty(o)&&i.hasOwnProperty(o)&&(n[o]=i[o])}t.init&&t.init.call(this,e)};u(e,Pn);for(var i in t)"style"!==i&&"shape"!==i&&(e.prototype[i]=t[i]);return e},u(Pn,di);var XS=ES.CMD,jS=[[],[],[]],YS=Math.sqrt,qS=Math.atan2,KS=function(t,e){var i,n,o,a,r,s,l=t.data,u=XS.M,h=XS.C,c=XS.L,d=XS.R,f=XS.A,p=XS.Q;for(o=0,a=0;o=11?function(){var e,i=this.__clipPaths,n=this.style;if(i)for(var o=0;oi-2?i-1:c+1],u=t[c>i-3?i-1:c+2]);var p=d*d,g=d*p;n.push([Bn(s[0],f[0],l[0],u[0],d,p,g),Bn(s[1],f[1],l[1],u[1],d,p,g)])}return n},fM=function(t,e,i,n){var o,a,r,s,l=[],u=[],h=[],c=[];if(n){r=[1/0,1/0],s=[-1/0,-1/0];for(var d=0,f=t.length;d=i&&a>=o)return{x:i,y:o,width:n-i,height:a-o}},createIcon:Po,Group:tb,Image:fi,Text:rM,Circle:sM,Sector:hM,Ring:cM,Polygon:pM,Polyline:gM,Rect:yM,Line:_M,BezierCurve:bM,Arc:SM,IncrementalDisplayable:Zn,CompoundPath:MM,LinearGradient:TM,RadialGradient:AM,BoundingRect:de}),BM=["textStyle","color"],VM={getTextColor:function(t){var e=this.ecModel;return this.getShallow("color")||(!t&&e?e.get(BM):null)},getFont:function(){return So({fontStyle:this.getShallow("fontStyle"),fontWeight:this.getShallow("fontWeight"),fontSize:this.getShallow("fontSize"),fontFamily:this.getShallow("fontFamily")},this.ecModel)},getTextRect:function(t){return ke(t,this.getFont(),this.getShallow("align"),this.getShallow("verticalAlign")||this.getShallow("baseline"),this.getShallow("padding"),this.getShallow("lineHeight"),this.getShallow("rich"),this.getShallow("truncateText"))}},GM=Qb([["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"],["textPosition"],["textAlign"]]),FM={getItemStyle:function(t,e){var i=GM(this,t,e),n=this.getBorderLineDash();return n&&(i.lineDash=n),i},getBorderLineDash:function(){var t=this.get("borderType");return"solid"===t||null==t?null:"dashed"===t?[5,5]:[1,1]}},WM=h,HM=Bi();No.prototype={constructor:No,init:null,mergeOption:function(t){n(this.option,t,!0)},get:function(t,e){return null==t?this.option:Oo(this.option,this.parsePath(t),!e&&Eo(this,t))},getShallow:function(t,e){var i=this.option,n=null==i?i:i[t],o=!e&&Eo(this,t);return null==n&&o&&(n=o.getShallow(t)),n},getModel:function(t,e){var i,n=null==t?this.option:Oo(this.option,t=this.parsePath(t));return e=e||(i=Eo(this,t))&&i.getModel(t),new No(n,e,this.ecModel)},isEmpty:function(){return null==this.option},restoreData:function(){},clone:function(){return new(0,this.constructor)(i(this.option))},setReadOnly:function(t){},parsePath:function(t){return"string"==typeof t&&(t=t.split(".")),t},customizeGetParent:function(t){HM(this).getParent=t},isAnimationEnabled:function(){if(!U_.node){if(null!=this.option.animation)return!!this.option.animation;if(this.parentModel)return this.parentModel.isAnimationEnabled()}}},ji(No),Yi(No),WM(No,eS),WM(No,nS),WM(No,VM),WM(No,FM);var ZM=0,UM=1e-4,XM=9007199254740991,jM=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d\d)(?::(\d\d)(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/,YM=(Object.freeze||Object)({linearMap:Bo,parsePercent:Vo,round:Go,asc:Fo,getPrecision:Wo,getPrecisionSafe:Ho,getPixelPrecision:Zo,getPercentWithPrecision:Uo,MAX_SAFE_INTEGER:XM,remRadian:Xo,isRadianAroundZero:jo,parseDate:Yo,quantity:qo,nice:$o,quantile:function(t,e){var i=(t.length-1)*e+1,n=Math.floor(i),o=+t[n-1],a=i-n;return a?o+a*(t[n]-o):o},reformIntervals:Jo,isNumeric:Qo}),qM=L,KM=/([&<>"'])/g,$M={"&":"&","<":"<",">":">",'"':""","'":"'"},JM=["a","b","c","d","e","f","g"],QM=function(t,e){return"{"+t+(null==e?"":e)+"}"},tI=ze,eI=(Object.freeze||Object)({addCommas:ta,toCamelCase:ea,normalizeCssArray:qM,encodeHTML:ia,formatTpl:na,formatTplSimple:oa,getTooltipMarker:aa,formatTime:sa,capitalFirst:la,truncateText:tI,getTextBoundingRect:function(t){return ke(t.text,t.font,t.textAlign,t.textVerticalAlign,t.textPadding,t.textLineHeight,t.rich,t.truncate)},getTextRect:function(t,e,i,n,o,a,r,s){return ke(t,e,i,n,o,s,a,r)}}),iI=d,nI=["left","right","top","bottom","width","height"],oI=[["width","left","right"],["height","top","bottom"]],aI=ua,rI=(v(ua,"vertical"),v(ua,"horizontal"),{getBoxLayoutParams:function(){return{left:this.get("left"),top:this.get("top"),right:this.get("right"),bottom:this.get("bottom"),width:this.get("width"),height:this.get("height")}}}),sI=Bi(),lI=No.extend({type:"component",id:"",name:"",mainType:"",subType:"",componentIndex:0,defaultOption:null,ecModel:null,dependentModels:[],uid:null,layoutMode:null,$constructor:function(t,e,i,n){No.call(this,t,e,i,n),this.uid=Ro("ec_cpt_model")},init:function(t,e,i,n){this.mergeDefaultAndTheme(t,i)},mergeDefaultAndTheme:function(t,e){var i=this.layoutMode,o=i?ga(t):{};n(t,e.getTheme().get(this.mainType)),n(t,this.getDefaultOption()),i&&pa(t,o,i)},mergeOption:function(t,e){n(this.option,t,!0);var i=this.layoutMode;i&&pa(this.option,t,i)},optionUpdated:function(t,e){},getDefaultOption:function(){var t=sI(this);if(!t.defaultOption){for(var e=[],i=this.constructor;i;){var o=i.prototype.defaultOption;o&&e.push(o),i=i.superClass}for(var a={},r=e.length-1;r>=0;r--)a=n(a,e[r],!0);t.defaultOption=a}return t.defaultOption},getReferringComponents:function(t){return this.ecModel.queryComponents({mainType:t,index:this.get(t+"Index",!0),id:this.get(t+"Id",!0)})}});$i(lI,{registerWhenExtend:!0}),function(t){var e={};t.registerSubTypeDefaulter=function(t,i){t=Ui(t),e[t.main]=i},t.determineSubType=function(i,n){var o=n.type;if(!o){var a=Ui(i).main;t.hasSubTypes(i)&&e[a]&&(o=e[a](n))}return o}}(lI),function(t,e){function i(t){var i={},a=[];return d(t,function(r){var s=n(i,r),u=o(s.originalDeps=e(r),t);s.entryCount=u.length,0===s.entryCount&&a.push(r),d(u,function(t){l(s.predecessor,t)<0&&s.predecessor.push(t);var e=n(i,t);l(e.successor,t)<0&&e.successor.push(r)})}),{graph:i,noEntryList:a}}function n(t,e){return t[e]||(t[e]={predecessor:[],successor:[]}),t[e]}function o(t,e){var i=[];return d(t,function(t){l(e,t)>=0&&i.push(t)}),i}t.topologicalTravel=function(t,e,n,o){function a(t){s[t].entryCount--,0===s[t].entryCount&&l.push(t)}if(t.length){var r=i(e),s=r.graph,l=r.noEntryList,u={};for(d(t,function(t){u[t]=!0});l.length;){var h=l.pop(),c=s[h],f=!!u[h];f&&(n.call(o,h,c.originalDeps.slice()),delete u[h]),d(c.successor,f?function(t){u[t]=!0,a(t)}:a)}d(u,function(){throw new Error("Circle dependency may exists")})}}}(lI,function(t){var e=[];return d(lI.getClassesByMainType(t),function(t){e=e.concat(t.prototype.dependencies||[])}),e=f(e,function(t){return Ui(t).main}),"dataset"!==t&&l(e,"dataset")<=0&&e.unshift("dataset"),e}),h(lI,rI);var uI="";"undefined"!=typeof navigator&&(uI=navigator.platform||"");var hI={color:["#c23531","#2f4554","#61a0a8","#d48265","#91c7ae","#749f83","#ca8622","#bda29a","#6e7074","#546570","#c4ccd3"],gradientColor:["#f6efa6","#d88273","#bf444c"],textStyle:{fontFamily:uI.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,animation:"auto",animationDuration:1e3,animationDurationUpdate:300,animationEasing:"exponentialOut",animationEasingUpdate:"cubicOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1},cI=Bi(),dI={clearColorPalette:function(){cI(this).colorIdx=0,cI(this).colorNameMap={}},getColorFromPalette:function(t,e,i){var n=cI(e=e||this),o=n.colorIdx||0,a=n.colorNameMap=n.colorNameMap||{};if(a.hasOwnProperty(t))return a[t];var r=Di(this.get("color",!0)),s=this.get("colorLayer",!0),l=null!=i&&s?va(s,i):r;if((l=l||r)&&l.length){var u=l[o];return t&&(a[t]=u),n.colorIdx=(o+1)%l.length,u}}},fI={cartesian2d:function(t,e,i,n){var o=t.getReferringComponents("xAxis")[0],a=t.getReferringComponents("yAxis")[0];e.coordSysDims=["x","y"],i.set("x",o),i.set("y",a),xa(o)&&(n.set("x",o),e.firstCategoryDimIndex=0),xa(a)&&(n.set("y",a),e.firstCategoryDimIndex=1)},singleAxis:function(t,e,i,n){var o=t.getReferringComponents("singleAxis")[0];e.coordSysDims=["single"],i.set("single",o),xa(o)&&(n.set("single",o),e.firstCategoryDimIndex=0)},polar:function(t,e,i,n){var o=t.getReferringComponents("polar")[0],a=o.findAxisModel("radiusAxis"),r=o.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],i.set("radius",a),i.set("angle",r),xa(a)&&(n.set("radius",a),e.firstCategoryDimIndex=0),xa(r)&&(n.set("angle",r),e.firstCategoryDimIndex=1)},geo:function(t,e,i,n){e.coordSysDims=["lng","lat"]},parallel:function(t,e,i,n){var o=t.ecModel,a=o.getComponent("parallel",t.get("parallelIndex")),r=e.coordSysDims=a.dimensions.slice();d(a.parallelAxisIndex,function(t,a){var s=o.getComponent("parallelAxis",t),l=r[a];i.set(l,s),xa(s)&&null==e.firstCategoryDimIndex&&(n.set(l,s),e.firstCategoryDimIndex=a)})}},pI="original",gI="arrayRows",mI="objectRows",vI="keyedColumns",yI="unknown",xI="typedArray",_I="column",wI="row";_a.seriesDataToSource=function(t){return new _a({data:t,sourceFormat:S(t)?xI:pI,fromDataset:!1})},Yi(_a);var bI=Bi(),SI="\0_ec_inner",MI=No.extend({init:function(t,e,i,n){i=i||{},this.option=null,this._theme=new No(i),this._optionManager=n},setOption:function(t,e){k(!(SI in t),"please use chart.getOption()"),this._optionManager.setOption(t,e),this.resetOption(null)},resetOption:function(t){var e=!1,i=this._optionManager;if(!t||"recreate"===t){var n=i.mountOption("recreate"===t);this.option&&"recreate"!==t?(this.restoreData(),this.mergeOption(n)):Ea.call(this,n),e=!0}if("timeline"!==t&&"media"!==t||this.restoreData(),!t||"recreate"===t||"timeline"===t){var o=i.getTimelineOption(this);o&&(this.mergeOption(o),e=!0)}if(!t||"recreate"===t||"media"===t){var a=i.getMediaOption(this,this._api);a.length&&d(a,function(t){this.mergeOption(t,e=!0)},this)}return e},mergeOption:function(t){var e=this.option,o=this._componentsMap,r=[];Sa(this),d(t,function(t,o){null!=t&&(lI.hasClass(o)?o&&r.push(o):e[o]=null==e[o]?i(t):n(e[o],t,!0))}),lI.topologicalTravel(r,lI.getAllClassMainTypes(),function(i,n){var r=Di(t[i]),s=Pi(o.get(i),r);Ni(s),d(s,function(t,e){var n=t.option;w(n)&&(t.keyInfo.mainType=i,t.keyInfo.subType=za(i,n,t.exist))});var l=Ra(o,n);e[i]=[],o.set(i,[]),d(s,function(t,n){var r=t.exist,s=t.option;if(k(w(s)||r,"Empty component definition"),s){var u=lI.getClass(i,t.keyInfo.subType,!0);if(r&&r instanceof u)r.name=t.keyInfo.name,r.mergeOption(s,this),r.optionUpdated(s,!1);else{var h=a({dependentModels:l,componentIndex:n},t.keyInfo);a(r=new u(s,this,this,h),h),r.init(s,this,this,h),r.optionUpdated(null,!0)}}else r.mergeOption({},this),r.optionUpdated({},!1);o.get(i)[n]=r,e[i][n]=r.option},this),"series"===i&&Ba(this,o.get("series"))},this),this._seriesIndicesMap=R(this._seriesIndices=this._seriesIndices||[])},getOption:function(){var t=i(this.option);return d(t,function(e,i){if(lI.hasClass(i)){for(var n=(e=Di(e)).length-1;n>=0;n--)Ei(e[n])&&e.splice(n,1);t[i]=e}}),delete t[SI],t},getTheme:function(){return this._theme},getComponent:function(t,e){var i=this._componentsMap.get(t);if(i)return i[e||0]},queryComponents:function(t){var e=t.mainType;if(!e)return[];var i=t.index,n=t.id,o=t.name,a=this._componentsMap.get(e);if(!a||!a.length)return[];var r;if(null!=i)y(i)||(i=[i]),r=g(f(i,function(t){return a[t]}),function(t){return!!t});else if(null!=n){var s=y(n);r=g(a,function(t){return s&&l(n,t.id)>=0||!s&&t.id===n})}else if(null!=o){var u=y(o);r=g(a,function(t){return u&&l(o,t.name)>=0||!u&&t.name===o})}else r=a.slice();return Va(r,t)},findComponents:function(t){var e=t.query,i=t.mainType,n=function(t){var e=i+"Index",n=i+"Id",o=i+"Name";return!t||null==t[e]&&null==t[n]&&null==t[o]?null:{mainType:i,index:t[e],id:t[n],name:t[o]}}(e);return function(e){return t.filter?g(e,t.filter):e}(Va(n?this.queryComponents(n):this._componentsMap.get(i),t))},eachComponent:function(t,e,i){var n=this._componentsMap;"function"==typeof t?(i=e,e=t,n.each(function(t,n){d(t,function(t,o){e.call(i,n,t,o)})})):_(t)?d(n.get(t),e,i):w(t)&&d(this.findComponents(t),e,i)},getSeriesByName:function(t){return g(this._componentsMap.get("series"),function(e){return e.name===t})},getSeriesByIndex:function(t){return this._componentsMap.get("series")[t]},getSeriesByType:function(t){return g(this._componentsMap.get("series"),function(e){return e.subType===t})},getSeries:function(){return this._componentsMap.get("series").slice()},getSeriesCount:function(){return this._componentsMap.get("series").length},eachSeries:function(t,e){d(this._seriesIndices,function(i){var n=this._componentsMap.get("series")[i];t.call(e,n,i)},this)},eachRawSeries:function(t,e){d(this._componentsMap.get("series"),t,e)},eachSeriesByType:function(t,e,i){d(this._seriesIndices,function(n){var o=this._componentsMap.get("series")[n];o.subType===t&&e.call(i,o,n)},this)},eachRawSeriesByType:function(t,e,i){return d(this.getSeriesByType(t),e,i)},isSeriesFiltered:function(t){return null==this._seriesIndicesMap.get(t.componentIndex)},getCurrentSeriesIndices:function(){return(this._seriesIndices||[]).slice()},filterSeries:function(t,e){Ba(this,g(this._componentsMap.get("series"),t,e))},restoreData:function(t){var e=this._componentsMap;Ba(this,e.get("series"));var i=[];e.each(function(t,e){i.push(e)}),lI.topologicalTravel(i,lI.getAllClassMainTypes(),function(i,n){d(e.get(i),function(e){("series"!==i||!Na(e,t))&&e.restoreData()})})}});h(MI,dI);var II=["getDom","getZr","getWidth","getHeight","getDevicePixelRatio","dispatchAction","isDisposed","on","off","getDataURL","getConnectedDataURL","getModel","getOption","getViewOfComponentModel","getViewOfSeriesModel"],TI={};Fa.prototype={constructor:Fa,create:function(t,e){var i=[];d(TI,function(n,o){var a=n.create(t,e);i=i.concat(a||[])}),this._coordinateSystems=i},update:function(t,e){d(this._coordinateSystems,function(i){i.update&&i.update(t,e)})},getCoordinateSystems:function(){return this._coordinateSystems.slice()}},Fa.register=function(t,e){TI[t]=e},Fa.get=function(t){return TI[t]};var AI=d,DI=i,CI=f,LI=n,kI=/^(min|max)?(.+)$/;Wa.prototype={constructor:Wa,setOption:function(t,e){t&&d(Di(t.series),function(t){t&&t.data&&S(t.data)&&N(t.data)}),t=DI(t,!0);var i=this._optionBackup,n=Ha.call(this,t,e,!i);this._newBaseOption=n.baseOption,i?(ja(i.baseOption,n.baseOption),n.timelineOptions.length&&(i.timelineOptions=n.timelineOptions),n.mediaList.length&&(i.mediaList=n.mediaList),n.mediaDefault&&(i.mediaDefault=n.mediaDefault)):this._optionBackup=n},mountOption:function(t){var e=this._optionBackup;return this._timelineOptions=CI(e.timelineOptions,DI),this._mediaList=CI(e.mediaList,DI),this._mediaDefault=DI(e.mediaDefault),this._currentMediaIndices=[],DI(t?e.baseOption:this._newBaseOption)},getTimelineOption:function(t){var e,i=this._timelineOptions;if(i.length){var n=t.getComponent("timeline");n&&(e=DI(i[n.getCurrentIndex()],!0))}return e},getMediaOption:function(t){var e=this._api.getWidth(),i=this._api.getHeight(),n=this._mediaList,o=this._mediaDefault,a=[],r=[];if(!n.length&&!o)return r;for(var s=0,l=n.length;s=1)&&(t=1),t}var i=this._upstream,n=t&&t.skip;if(this._dirty&&i){var o=this.context;o.data=o.outputData=i.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var a;this._plan&&!n&&(a=this._plan(this.context));var r=e(this._modBy),s=this._modDataCount||0,l=e(t&&t.modBy),u=t&&t.modDataCount||0;r===l&&s===u||(a="reset");var h;(this._dirty||"reset"===a)&&(this._dirty=!1,h=yr(this,n)),this._modBy=l,this._modDataCount=u;var c=t&&t.step;if(this._dueEnd=i?i._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var d=this._dueIndex,f=Math.min(null!=c?this._dueIndex+c:1/0,this._dueEnd);if(!n&&(h||d=i?null:t1&&a>0?e:t}};return s}();UI.dirty=function(){this._dirty=!0,this._onDirty&&this._onDirty(this.context)},UI.unfinished=function(){return this._progress&&this._dueIndex":"\n",s="richText"===n,l={},u=0,h=this.getData(),c=h.mapDimension("defaultedTooltip",!0),f=c.length,g=this.getRawValue(t),m=y(g),v=h.getItemVisual(t,"color");w(v)&&v.colorStops&&(v=(v.colorStops[0]||{}).color),v=v||"transparent";var x=(f>1||m&&!f?function(i){function o(t,i){var o=h.getDimensionInfo(i);if(o&&!1!==o.otherDims.tooltip){var c=o.type,d="sub"+a.seriesIndex+"at"+u,p=aa({color:v,type:"subItem",renderMode:n,markerId:d}),g="string"==typeof p?p:p.content,m=(r?g+ia(o.displayName||"-")+": ":"")+ia("ordinal"===c?t+"":"time"===c?e?"":sa("yyyy/MM/dd hh:mm:ss",t):ta(t));m&&f.push(m),s&&(l[d]=v,++u)}}var r=p(i,function(t,e,i){var n=h.getDimensionInfo(i);return t|=n&&!1!==n.tooltip&&null!=n.displayName},0),f=[];c.length?d(c,function(e){o(fr(h,t,e),e)}):d(i,o);var g=r?s?"\n":"
":"",m=g+f.join(g||", ");return{renderMode:n,content:m,style:l}}(g):o(f?fr(h,t,c[0]):m?g[0]:g)).content,_=a.seriesIndex+"at"+u,b=aa({color:v,type:"item",renderMode:n,markerId:_});l[_]=v,++u;var S=h.getName(t),M=this.name;Oi(this)||(M=""),M=M?ia(M)+(e?": ":r):"";var I="string"==typeof b?b:b.content;return{html:e?I+M+x:M+I+(S?ia(S)+": "+x:x),markers:l}},isAnimationEnabled:function(){if(U_.node)return!1;var t=this.getShallow("animation");return t&&this.getData().count()>this.getShallow("animationThreshold")&&(t=!1),t},restoreData:function(){this.dataTask.dirty()},getColorFromPalette:function(t,e,i){var n=this.ecModel,o=dI.getColorFromPalette.call(this,t,e,i);return o||(o=n.getColorFromPalette(t,e,i)),o},coordDimToDataDim:function(t){return this.getRawData().mapDimension(t,!0)},getProgressive:function(){return this.get("progressive")},getProgressiveThreshold:function(){return this.get("progressiveThreshold")},getAxisTooltipData:null,getTooltipPosition:null,pipeTask:null,preventIncremental:null,pipelineContext:null});h(YI,ZI),h(YI,dI);var qI=function(){this.group=new tb,this.uid=Ro("viewComponent")};qI.prototype={constructor:qI,init:function(t,e){},render:function(t,e,i,n){},dispose:function(){},filterForExposedEvent:null};var KI=qI.prototype;KI.updateView=KI.updateLayout=KI.updateVisual=function(t,e,i,n){},ji(qI),$i(qI,{registerWhenExtend:!0});var $I=function(){var t=Bi();return function(e){var i=t(e),n=e.pipelineContext,o=i.large,a=i.progressiveRender,r=i.large=n.large,s=i.progressiveRender=n.progressiveRender;return!!(o^r||a^s)&&"reset"}},JI=Bi(),QI=$I();Ar.prototype={type:"chart",init:function(t,e){},render:function(t,e,i,n){},highlight:function(t,e,i,n){Cr(t.getData(),n,"emphasis")},downplay:function(t,e,i,n){Cr(t.getData(),n,"normal")},remove:function(t,e){this.group.removeAll()},dispose:function(){},incrementalPrepareRender:null,incrementalRender:null,updateTransform:null,filterForExposedEvent:null};var tT=Ar.prototype;tT.updateView=tT.updateLayout=tT.updateVisual=function(t,e,i,n){this.render(t,e,i,n)},ji(Ar),$i(Ar,{registerWhenExtend:!0}),Ar.markUpdateMethod=function(t,e){JI(t).updateMethod=e};var eT={incrementalPrepareRender:{progress:function(t,e){e.view.incrementalRender(t,e.model,e.ecModel,e.api,e.payload)}},render:{forceFirstProgress:!0,progress:function(t,e){e.view.render(e.model,e.ecModel,e.api,e.payload)}}},iT="\0__throttleOriginMethod",nT="\0__throttleRate",oT="\0__throttleType",aT={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var i=t.getData(),n=(t.visualColorAccessPath||"itemStyle.color").split("."),o=t.get(n)||t.getColorFromPalette(t.name,null,e.getSeriesCount());if(i.setVisual("color",o),!e.isSeriesFiltered(t)){"function"!=typeof o||o instanceof IM||i.each(function(e){i.setItemVisual(e,"color",o(t.getDataParams(e)))});return{dataEach:i.hasItemOption?function(t,e){var i=t.getItemModel(e).get(n,!0);null!=i&&t.setItemVisual(e,"color",i)}:null}}}},rT={toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}},sT=function(t,e){function i(t,e){if("string"!=typeof t)return t;var i=t;return d(e,function(t,e){i=i.replace(new RegExp("\\{\\s*"+e+"\\s*\\}","g"),t)}),i}function n(t){var e=a.get(t);if(null==e){for(var i=t.split("."),n=rT.aria,o=0;o1?"series.multiple.prefix":"series.single.prefix"),{seriesCount:r}),e.eachSeries(function(t,e){if(e1?"multiple":"single")+".";a=i(a=n(s?u+"withName":u+"withoutName"),{seriesId:t.seriesIndex,seriesName:t.get("name"),seriesType:o(t.subType)});var c=t.getData();window.data=c,c.count()>l?a+=i(n("data.partialData"),{displayCnt:l}):a+=n("data.allData");for(var d=[],p=0;pi.blockIndex?i.step:null,a=n&&n.modDataCount;return{step:o,modBy:null!=a?Math.ceil(a/o):null,modDataCount:a}}},uT.getPipeline=function(t){return this._pipelineMap.get(t)},uT.updateStreamModes=function(t,e){var i=this._pipelineMap.get(t.uid),n=t.getData().count(),o=i.progressiveEnabled&&e.incrementalPrepareRender&&n>=i.threshold,a=t.get("large")&&n>=t.get("largeThreshold"),r="mod"===t.get("progressiveChunkMode")?n:null;t.pipelineContext=i.context={progressiveRender:o,modDataCount:r,large:a}},uT.restorePipelines=function(t){var e=this,i=e._pipelineMap=R();t.eachSeries(function(t){var n=t.getProgressive(),o=t.uid;i.set(o,{id:o,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:n&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(n||700),count:0}),jr(e,t,t.dataTask)})},uT.prepareStageTasks=function(){var t=this._stageTaskMap,e=this.ecInstance.getModel(),i=this.api;d(this._allHandlers,function(n){var o=t.get(n.uid)||t.set(n.uid,[]);n.reset&&zr(this,n,o,e,i),n.overallReset&&Br(this,n,o,e,i)},this)},uT.prepareView=function(t,e,i,n){var o=t.renderTask,a=o.context;a.model=e,a.ecModel=i,a.api=n,o.__block=!t.incrementalPrepareRender,jr(this,e,o)},uT.performDataProcessorTasks=function(t,e){Rr(this,this._dataProcessorHandlers,t,e,{block:!0})},uT.performVisualTasks=function(t,e,i){Rr(this,this._visualHandlers,t,e,i)},uT.performSeriesTasks=function(t){var e;t.eachSeries(function(t){e|=t.dataTask.perform()}),this.unfinished|=e},uT.plan=function(){this._pipelineMap.each(function(t){var e=t.tail;do{if(e.__block){t.blockIndex=e.__idxInPipeline;break}e=e.getUpstream()}while(e)})};var hT=uT.updatePayload=function(t,e){"remain"!==e&&(t.context.payload=e)},cT=Ur(0);Er.wrapStageHandler=function(t,e){return x(t)&&(t={overallReset:t,seriesType:Yr(t)}),t.uid=Ro("stageHandler"),e&&(t.visualType=e),t};var dT,fT={},pT={};qr(fT,MI),qr(pT,Ga),fT.eachSeriesByType=fT.eachRawSeriesByType=function(t){dT=t},fT.eachComponent=function(t){"series"===t.mainType&&t.subType&&(dT=t.subType)};var gT=["#37A2DA","#32C5E9","#67E0E3","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#E062AE","#E690D1","#e7bcf3","#9d96f5","#8378EA","#96BFFF"],mT={color:gT,colorLayer:[["#37A2DA","#ffd85c","#fd7b5f"],["#37A2DA","#67E0E3","#FFDB5C","#ff9f7f","#E062AE","#9d96f5"],["#37A2DA","#32C5E9","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#e7bcf3","#8378EA","#96BFFF"],gT]},vT=["#dd6b66","#759aa0","#e69d87","#8dc1a9","#ea7e53","#eedd78","#73a373","#73b9bc","#7289ab","#91ca8c","#f49f42"],yT={color:vT,backgroundColor:"#333",tooltip:{axisPointer:{lineStyle:{color:"#eee"},crossStyle:{color:"#eee"}}},legend:{textStyle:{color:"#eee"}},textStyle:{color:"#eee"},title:{textStyle:{color:"#eee"}},toolbox:{iconStyle:{normal:{borderColor:"#eee"}}},dataZoom:{textStyle:{color:"#eee"}},visualMap:{textStyle:{color:"#eee"}},timeline:{lineStyle:{color:"#eee"},itemStyle:{normal:{color:vT[1]}},label:{normal:{textStyle:{color:"#eee"}}},controlStyle:{normal:{color:"#eee",borderColor:"#eee"}}},timeAxis:{axisLine:{lineStyle:{color:"#eee"}},axisTick:{lineStyle:{color:"#eee"}},axisLabel:{textStyle:{color:"#eee"}},splitLine:{lineStyle:{type:"dashed",color:"#aaa"}},splitArea:{areaStyle:{color:"#eee"}}},logAxis:{axisLine:{lineStyle:{color:"#eee"}},axisTick:{lineStyle:{color:"#eee"}},axisLabel:{textStyle:{color:"#eee"}},splitLine:{lineStyle:{type:"dashed",color:"#aaa"}},splitArea:{areaStyle:{color:"#eee"}}},valueAxis:{axisLine:{lineStyle:{color:"#eee"}},axisTick:{lineStyle:{color:"#eee"}},axisLabel:{textStyle:{color:"#eee"}},splitLine:{lineStyle:{type:"dashed",color:"#aaa"}},splitArea:{areaStyle:{color:"#eee"}}},categoryAxis:{axisLine:{lineStyle:{color:"#eee"}},axisTick:{lineStyle:{color:"#eee"}},axisLabel:{textStyle:{color:"#eee"}},splitLine:{lineStyle:{type:"dashed",color:"#aaa"}},splitArea:{areaStyle:{color:"#eee"}}},line:{symbol:"circle"},graph:{color:vT},gauge:{title:{textStyle:{color:"#eee"}}},candlestick:{itemStyle:{normal:{color:"#FD1050",color0:"#0CF49B",borderColor:"#FD1050",borderColor0:"#0CF49B"}}}};yT.categoryAxis.splitLine.show=!1,lI.extend({type:"dataset",defaultOption:{seriesLayoutBy:_I,sourceHeader:null,dimensions:null,source:null},optionUpdated:function(){wa(this)}}),qI.extend({type:"dataset"});var xT=Pn.extend({type:"ellipse",shape:{cx:0,cy:0,rx:0,ry:0},buildPath:function(t,e){var i=.5522848,n=e.cx,o=e.cy,a=e.rx,r=e.ry,s=a*i,l=r*i;t.moveTo(n-a,o),t.bezierCurveTo(n-a,o-l,n-s,o-r,n,o-r),t.bezierCurveTo(n+s,o-r,n+a,o-l,n+a,o),t.bezierCurveTo(n+a,o+l,n+s,o+r,n,o+r),t.bezierCurveTo(n-s,o+r,n-a,o+l,n-a,o),t.closePath()}}),_T=/[\s,]+/;$r.prototype.parse=function(t,e){e=e||{};var i=Kr(t);if(!i)throw new Error("Illegal svg");var n=new tb;this._root=n;var o=i.getAttribute("viewBox")||"",a=parseFloat(i.getAttribute("width")||e.width),r=parseFloat(i.getAttribute("height")||e.height);isNaN(a)&&(a=null),isNaN(r)&&(r=null),es(i,n,null,!0);for(var s=i.firstChild;s;)this._parseNode(s,n),s=s.nextSibling;var l,u;if(o){var h=P(o).split(_T);h.length>=4&&(l={x:parseFloat(h[0]||0),y:parseFloat(h[1]||0),width:parseFloat(h[2]),height:parseFloat(h[3])})}if(l&&null!=a&&null!=r&&(u=as(l,a,r),!e.ignoreViewBox)){var c=n;(n=new tb).add(c),c.scale=u.scale.slice(),c.position=u.position.slice()}return e.ignoreRootClip||null==a||null==r||n.setClipPath(new yM({shape:{x:0,y:0,width:a,height:r}})),{root:n,width:a,height:r,viewBoxRect:l,viewBoxTransform:u}},$r.prototype._parseNode=function(t,e){var i=t.nodeName.toLowerCase();"defs"===i?this._isDefine=!0:"text"===i&&(this._isText=!0);var n;if(this._isDefine){if(r=bT[i]){var o=r.call(this,t),a=t.getAttribute("id");a&&(this._defs[a]=o)}}else{var r=wT[i];r&&(n=r.call(this,t,e),e.add(n))}for(var s=t.firstChild;s;)1===s.nodeType&&this._parseNode(s,n),3===s.nodeType&&this._isText&&this._parseText(s,n),s=s.nextSibling;"defs"===i?this._isDefine=!1:"text"===i&&(this._isText=!1)},$r.prototype._parseText=function(t,e){if(1===t.nodeType){var i=t.getAttribute("dx")||0,n=t.getAttribute("dy")||0;this._textX+=parseFloat(i),this._textY+=parseFloat(n)}var o=new rM({style:{text:t.textContent,transformText:!0},position:[this._textX||0,this._textY||0]});Qr(e,o),es(t,o,this._defs);var a=o.style.fontSize;a&&a<9&&(o.style.fontSize=9,o.scale=o.scale||[1,1],o.scale[0]*=a/9,o.scale[1]*=a/9);var r=o.getBoundingRect();return this._textX+=r.width,e.add(o),o};var wT={g:function(t,e){var i=new tb;return Qr(e,i),es(t,i,this._defs),i},rect:function(t,e){var i=new yM;return Qr(e,i),es(t,i,this._defs),i.setShape({x:parseFloat(t.getAttribute("x")||0),y:parseFloat(t.getAttribute("y")||0),width:parseFloat(t.getAttribute("width")||0),height:parseFloat(t.getAttribute("height")||0)}),i},circle:function(t,e){var i=new sM;return Qr(e,i),es(t,i,this._defs),i.setShape({cx:parseFloat(t.getAttribute("cx")||0),cy:parseFloat(t.getAttribute("cy")||0),r:parseFloat(t.getAttribute("r")||0)}),i},line:function(t,e){var i=new _M;return Qr(e,i),es(t,i,this._defs),i.setShape({x1:parseFloat(t.getAttribute("x1")||0),y1:parseFloat(t.getAttribute("y1")||0),x2:parseFloat(t.getAttribute("x2")||0),y2:parseFloat(t.getAttribute("y2")||0)}),i},ellipse:function(t,e){var i=new xT;return Qr(e,i),es(t,i,this._defs),i.setShape({cx:parseFloat(t.getAttribute("cx")||0),cy:parseFloat(t.getAttribute("cy")||0),rx:parseFloat(t.getAttribute("rx")||0),ry:parseFloat(t.getAttribute("ry")||0)}),i},polygon:function(t,e){var i=t.getAttribute("points");i&&(i=ts(i));var n=new pM({shape:{points:i||[]}});return Qr(e,n),es(t,n,this._defs),n},polyline:function(t,e){var i=new Pn;Qr(e,i),es(t,i,this._defs);var n=t.getAttribute("points");return n&&(n=ts(n)),new gM({shape:{points:n||[]}})},image:function(t,e){var i=new fi;return Qr(e,i),es(t,i,this._defs),i.setStyle({image:t.getAttribute("xlink:href"),x:t.getAttribute("x"),y:t.getAttribute("y"),width:t.getAttribute("width"),height:t.getAttribute("height")}),i},text:function(t,e){var i=t.getAttribute("x")||0,n=t.getAttribute("y")||0,o=t.getAttribute("dx")||0,a=t.getAttribute("dy")||0;this._textX=parseFloat(i)+parseFloat(o),this._textY=parseFloat(n)+parseFloat(a);var r=new tb;return Qr(e,r),es(t,r,this._defs),r},tspan:function(t,e){var i=t.getAttribute("x"),n=t.getAttribute("y");null!=i&&(this._textX=parseFloat(i)),null!=n&&(this._textY=parseFloat(n));var o=t.getAttribute("dx")||0,a=t.getAttribute("dy")||0,r=new tb;return Qr(e,r),es(t,r,this._defs),this._textX+=o,this._textY+=a,r},path:function(t,e){var i=Rn(t.getAttribute("d")||"");return Qr(e,i),es(t,i,this._defs),i}},bT={lineargradient:function(t){var e=parseInt(t.getAttribute("x1")||0,10),i=parseInt(t.getAttribute("y1")||0,10),n=parseInt(t.getAttribute("x2")||10,10),o=parseInt(t.getAttribute("y2")||0,10),a=new TM(e,i,n,o);return Jr(t,a),a},radialgradient:function(t){}},ST={fill:"fill",stroke:"stroke","stroke-width":"lineWidth",opacity:"opacity","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-miterlimit":"miterLimit","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","text-align":"textAlign","alignment-baseline":"textBaseline"},MT=/url\(\s*#(.*?)\)/,IT=/(translate|scale|rotate|skewX|skewY|matrix)\(([\-\s0-9\.e,]*)\)/g,TT=/([^\s:;]+)\s*:\s*([^:;]+)/g,AT=R(),DT={registerMap:function(t,e,i){var n;return y(e)?n=e:e.svg?n=[{type:"svg",source:e.svg,specialAreas:e.specialAreas}]:(e.geoJson&&!e.features&&(i=e.specialAreas,e=e.geoJson),n=[{type:"geoJSON",source:e,specialAreas:i}]),d(n,function(t){var e=t.type;"geoJson"===e&&(e=t.type="geoJSON"),(0,CT[e])(t)}),AT.set(t,n)},retrieveMap:function(t){return AT.get(t)}},CT={geoJSON:function(t){var e=t.source;t.geoJSON=_(e)?"undefined"!=typeof JSON&&JSON.parse?JSON.parse(e):new Function("return ("+e+");")():e},svg:function(t){t.svgXML=Kr(t.source)}},LT=k,kT=d,PT=x,NT=w,OT=lI.parseClassType,ET={zrender:"4.0.6"},RT=1e3,zT=1e3,BT=3e3,VT={PROCESSOR:{FILTER:RT,STATISTIC:5e3},VISUAL:{LAYOUT:zT,GLOBAL:2e3,CHART:BT,COMPONENT:4e3,BRUSH:5e3}},GT="__flagInMainProcess",FT="__optionUpdated",WT=/^[a-zA-Z0-9_]+$/;ls.prototype.on=ss("on"),ls.prototype.off=ss("off"),ls.prototype.one=ss("one"),h(ls,fw);var HT=us.prototype;HT._onframe=function(){if(!this._disposed){var t=this._scheduler;if(this[FT]){var e=this[FT].silent;this[GT]=!0,cs(this),ZT.update.call(this),this[GT]=!1,this[FT]=!1,gs.call(this,e),ms.call(this,e)}else if(t.unfinished){var i=1,n=this._model;this._api;t.unfinished=!1;do{var o=+new Date;t.performSeriesTasks(n),t.performDataProcessorTasks(n),fs(this,n),t.performVisualTasks(n),bs(this,this._model,0,"remain"),i-=+new Date-o}while(i>0&&t.unfinished);t.unfinished||this._zr.flush()}}},HT.getDom=function(){return this._dom},HT.getZr=function(){return this._zr},HT.setOption=function(t,e,i){var n;if(NT(e)&&(i=e.lazyUpdate,n=e.silent,e=e.notMerge),this[GT]=!0,!this._model||e){var o=new Wa(this._api),a=this._theme,r=this._model=new MI(null,null,a,o);r.scheduler=this._scheduler,r.init(null,null,a,o)}this._model.setOption(t,qT),i?(this[FT]={silent:n},this[GT]=!1):(cs(this),ZT.update.call(this),this._zr.flush(),this[FT]=!1,this[GT]=!1,gs.call(this,n),ms.call(this,n))},HT.setTheme=function(){console.error("ECharts#setTheme() is DEPRECATED in ECharts 3.0")},HT.getModel=function(){return this._model},HT.getOption=function(){return this._model&&this._model.getOption()},HT.getWidth=function(){return this._zr.getWidth()},HT.getHeight=function(){return this._zr.getHeight()},HT.getDevicePixelRatio=function(){return this._zr.painter.dpr||window.devicePixelRatio||1},HT.getRenderedCanvas=function(t){if(U_.canvasSupported)return(t=t||{}).pixelRatio=t.pixelRatio||1,t.backgroundColor=t.backgroundColor||this._model.get("backgroundColor"),this._zr.painter.getRenderedCanvas(t)},HT.getSvgDataUrl=function(){if(U_.svgSupported){var t=this._zr;return d(t.storage.getDisplayList(),function(t){t.stopAnimation(!0)}),t.painter.pathToDataUrl()}},HT.getDataURL=function(t){var e=(t=t||{}).excludeComponents,i=this._model,n=[],o=this;kT(e,function(t){i.eachComponent({mainType:t},function(t){var e=o._componentsMap[t.__viewId];e.group.ignore||(n.push(e),e.group.ignore=!0)})});var a="svg"===this._zr.painter.getType()?this.getSvgDataUrl():this.getRenderedCanvas(t).toDataURL("image/"+(t&&t.type||"png"));return kT(n,function(t){t.group.ignore=!1}),a},HT.getConnectedDataURL=function(t){if(U_.canvasSupported){var e=this.group,n=Math.min,o=Math.max;if(eA[e]){var a=1/0,r=1/0,s=-1/0,l=-1/0,u=[],h=t&&t.pixelRatio||1;d(tA,function(h,c){if(h.group===e){var d=h.getRenderedCanvas(i(t)),f=h.getDom().getBoundingClientRect();a=n(f.left,a),r=n(f.top,r),s=o(f.right,s),l=o(f.bottom,l),u.push({dom:d,left:f.left,top:f.top})}});var c=(s*=h)-(a*=h),f=(l*=h)-(r*=h),p=iw();p.width=c,p.height=f;var g=Ii(p);return kT(u,function(t){var e=new fi({style:{x:t.left*h-a,y:t.top*h-r,image:t.dom}});g.add(e)}),g.refreshImmediately(),p.toDataURL("image/"+(t&&t.type||"png"))}return this.getDataURL(t)}},HT.convertToPixel=v(hs,"convertToPixel"),HT.convertFromPixel=v(hs,"convertFromPixel"),HT.containPixel=function(t,e){var i;return t=Vi(this._model,t),d(t,function(t,n){n.indexOf("Models")>=0&&d(t,function(t){var o=t.coordinateSystem;if(o&&o.containPoint)i|=!!o.containPoint(e);else if("seriesModels"===n){var a=this._chartsMap[t.__viewId];a&&a.containPoint&&(i|=a.containPoint(e,t))}},this)},this),!!i},HT.getVisual=function(t,e){var i=(t=Vi(this._model,t,{defaultMainType:"series"})).seriesModel.getData(),n=t.hasOwnProperty("dataIndexInside")?t.dataIndexInside:t.hasOwnProperty("dataIndex")?i.indexOfRawIndex(t.dataIndex):null;return null!=n?i.getItemVisual(n,e):i.getVisual(e)},HT.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},HT.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]};var ZT={prepareAndUpdate:function(t){cs(this),ZT.update.call(this,t)},update:function(t){var e=this._model,i=this._api,n=this._zr,o=this._coordSysMgr,a=this._scheduler;if(e){a.restoreData(e,t),a.performSeriesTasks(e),o.create(e,i),a.performDataProcessorTasks(e,t),fs(this,e),o.update(e,i),xs(e),a.performVisualTasks(e,t),_s(this,e,i,t);var r=e.get("backgroundColor")||"transparent";if(U_.canvasSupported)n.setBackgroundColor(r);else{var s=Gt(r);r=qt(s,"rgb"),0===s[3]&&(r="transparent")}Ss(e,i)}},updateTransform:function(t){var e=this._model,i=this,n=this._api;if(e){var o=[];e.eachComponent(function(a,r){var s=i.getViewOfComponentModel(r);if(s&&s.__alive)if(s.updateTransform){var l=s.updateTransform(r,e,n,t);l&&l.update&&o.push(s)}else o.push(s)});var a=R();e.eachSeries(function(o){var r=i._chartsMap[o.__viewId];if(r.updateTransform){var s=r.updateTransform(o,e,n,t);s&&s.update&&a.set(o.uid,1)}else a.set(o.uid,1)}),xs(e),this._scheduler.performVisualTasks(e,t,{setDirty:!0,dirtyMap:a}),bs(i,e,0,t,a),Ss(e,this._api)}},updateView:function(t){var e=this._model;e&&(Ar.markUpdateMethod(t,"updateView"),xs(e),this._scheduler.performVisualTasks(e,t,{setDirty:!0}),_s(this,this._model,this._api,t),Ss(e,this._api))},updateVisual:function(t){ZT.update.call(this,t)},updateLayout:function(t){ZT.update.call(this,t)}};HT.resize=function(t){this._zr.resize(t);var e=this._model;if(this._loadingFX&&this._loadingFX.resize(),e){var i=e.resetOption("media"),n=t&&t.silent;this[GT]=!0,i&&cs(this),ZT.update.call(this),this[GT]=!1,gs.call(this,n),ms.call(this,n)}},HT.showLoading=function(t,e){if(NT(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),QT[t]){var i=QT[t](this._api,e),n=this._zr;this._loadingFX=i,n.add(i)}},HT.hideLoading=function(){this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},HT.makeActionFromEvent=function(t){var e=a({},t);return e.type=jT[t.type],e},HT.dispatchAction=function(t,e){NT(e)||(e={silent:!!e}),XT[t.type]&&this._model&&(this[GT]?this._pendingActions.push(t):(ps.call(this,t,e.silent),e.flush?this._zr.flush(!0):!1!==e.flush&&U_.browser.weChat&&this._throttledZrFlush(),gs.call(this,e.silent),ms.call(this,e.silent)))},HT.appendData=function(t){var e=t.seriesIndex;this.getModel().getSeriesByIndex(e).appendData(t),this._scheduler.unfinished=!0},HT.on=ss("on"),HT.off=ss("off"),HT.one=ss("one");var UT=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"];HT._initEvents=function(){kT(UT,function(t){var e=function(e){var i,n=this.getModel(),o=e.target;if("globalout"===t)i={};else if(o&&null!=o.dataIndex){var r=o.dataModel||n.getSeriesByIndex(o.seriesIndex);i=r&&r.getDataParams(o.dataIndex,o.dataType,o)||{}}else o&&o.eventData&&(i=a({},o.eventData));if(i){var s=i.componentType,l=i.componentIndex;"markLine"!==s&&"markPoint"!==s&&"markArea"!==s||(s="series",l=i.seriesIndex);var u=s&&null!=l&&n.getComponent(s,l),h=u&&this["series"===u.mainType?"_chartsMap":"_componentsMap"][u.__viewId];i.event=e,i.type=t,this._ecEventProcessor.eventInfo={targetEl:o,packedEvent:i,model:u,view:h},this.trigger(t,i)}};e.zrEventfulCallAtLast=!0,this._zr.on(t,e,this)},this),kT(jT,function(t,e){this._messageCenter.on(e,function(t){this.trigger(e,t)},this)},this)},HT.isDisposed=function(){return this._disposed},HT.clear=function(){this.setOption({series:[]},!0)},HT.dispose=function(){if(!this._disposed){this._disposed=!0,Fi(this.getDom(),oA,"");var t=this._api,e=this._model;kT(this._componentsViews,function(i){i.dispose(e,t)}),kT(this._chartsViews,function(i){i.dispose(e,t)}),this._zr.dispose(),delete tA[this.id]}},h(us,fw),Ds.prototype={constructor:Ds,normalizeQuery:function(t){var e={},i={},n={};if(_(t)){var o=OT(t);e.mainType=o.main||null,e.subType=o.sub||null}else{var a=["Index","Name","Id"],r={name:1,dataIndex:1,dataType:1};d(t,function(t,o){for(var s=!1,l=0;l0&&h===o.length-u.length){var c=o.slice(0,h);"data"!==c&&(e.mainType=c,e[u.toLowerCase()]=t,s=!0)}}r.hasOwnProperty(o)&&(i[o]=t,s=!0),s||(n[o]=t)})}return{cptQuery:e,dataQuery:i,otherQuery:n}},filter:function(t,e,i){function n(t,e,i,n){return null==t[i]||e[n||i]===t[i]}var o=this.eventInfo;if(!o)return!0;var a=o.targetEl,r=o.packedEvent,s=o.model,l=o.view;if(!s||!l)return!0;var u=e.cptQuery,h=e.dataQuery;return n(u,s,"mainType")&&n(u,s,"subType")&&n(u,s,"index","componentIndex")&&n(u,s,"name")&&n(u,s,"id")&&n(h,r,"name")&&n(h,r,"dataIndex")&&n(h,r,"dataType")&&(!l.filterForExposedEvent||l.filterForExposedEvent(t,e.otherQuery,a,r))},afterTrigger:function(){this.eventInfo=null}};var XT={},jT={},YT=[],qT=[],KT=[],$T=[],JT={},QT={},tA={},eA={},iA=new Date-0,nA=new Date-0,oA="_echarts_instance_",aA=Ls;Bs(2e3,aT),Ns(BI),Os(5e3,function(t){var e=R();t.eachSeries(function(t){var i=t.get("stack");if(i){var n=e.get(i)||e.set(i,[]),o=t.getData(),a={stackResultDimension:o.getCalculationInfo("stackResultDimension"),stackedOverDimension:o.getCalculationInfo("stackedOverDimension"),stackedDimension:o.getCalculationInfo("stackedDimension"),stackedByDimension:o.getCalculationInfo("stackedByDimension"),isStackedByIndex:o.getCalculationInfo("isStackedByIndex"),data:o,seriesModel:t};if(!a.stackedDimension||!a.isStackedByIndex&&!a.stackedByDimension)return;n.length&&o.setCalculationInfo("stackedOnSeries",n[n.length-1].seriesModel),n.push(a)}}),e.each(ar)}),Gs("default",function(t,e){r(e=e||{},{text:"loading",color:"#c23531",textColor:"#000",maskColor:"rgba(255, 255, 255, 0.8)",zlevel:0});var i=new yM({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4}),n=new SM({shape:{startAngle:-lT/2,endAngle:-lT/2+.1,r:10},style:{stroke:e.color,lineCap:"round",lineWidth:5},zlevel:e.zlevel,z:10001}),o=new yM({style:{fill:"none",text:e.text,textPosition:"right",textDistance:10,textFill:e.textColor},zlevel:e.zlevel,z:10001});n.animateShape(!0).when(1e3,{endAngle:3*lT/2}).start("circularInOut"),n.animateShape(!0).when(1e3,{startAngle:3*lT/2}).delay(300).start("circularInOut");var a=new tb;return a.add(n),a.add(o),a.add(i),a.resize=function(){var e=t.getWidth()/2,a=t.getHeight()/2;n.setShape({cx:e,cy:a});var r=n.shape.r;o.setShape({x:e-r,y:a-r,width:2*r,height:2*r}),i.setShape({x:0,y:0,width:t.getWidth(),height:t.getHeight()})},a.resize(),a}),Es({type:"highlight",event:"highlight",update:"highlight"},B),Es({type:"downplay",event:"downplay",update:"downplay"},B),Ps("light",mT),Ps("dark",yT);var rA={};Xs.prototype={constructor:Xs,add:function(t){return this._add=t,this},update:function(t){return this._update=t,this},remove:function(t){return this._remove=t,this},execute:function(){var t=this._old,e=this._new,i={},n=[],o=[];for(js(t,{},n,"_oldKeyGetter",this),js(e,i,o,"_newKeyGetter",this),a=0;ax[1]&&(x[1]=y)}e&&(this._nameList[d]=e[f])}this._rawCount=this._count=l,this._extent={},el(this)},yA._initDataFromProvider=function(t,e){if(!(t>=e)){for(var i,n=this._chunkSize,o=this._rawData,a=this._storage,r=this.dimensions,s=r.length,l=this._dimensionInfos,u=this._nameList,h=this._idList,c=this._rawExtent,d=this._nameRepeatCount={},f=this._chunkCount,p=0;pM[1]&&(M[1]=S)}if(!o.pure){var I=u[v];if(m&&null==I)if(null!=m.name)u[v]=I=m.name;else if(null!=i){var T=r[i],A=a[T][y];if(A){I=A[x];var D=l[T].ordinalMeta;D&&D.categories.length&&(I=D.categories[I])}}var C=null==m?null:m.id;null==C&&null!=I&&(d[I]=d[I]||0,C=I,d[I]>0&&(C+="__ec__"+d[I]),d[I]++),null!=C&&(h[v]=C)}}!o.persistent&&o.clean&&o.clean(),this._rawCount=this._count=e,this._extent={},el(this)}},yA.count=function(){return this._count},yA.getIndices=function(){var t=this._indices;if(t){var e=t.constructor,i=this._count;if(e===Array){n=new e(i);for(o=0;o=0&&e=0&&ea&&(a=s)}return i=[o,a],this._extent[t]=i,i},yA.getApproximateExtent=function(t){return t=this.getDimension(t),this._approximateExtent[t]||this.getDataExtent(t)},yA.setApproximateExtent=function(t,e){e=this.getDimension(e),this._approximateExtent[e]=t.slice()},yA.getCalculationInfo=function(t){return this._calculationInfo[t]},yA.setCalculationInfo=function(t,e){lA(t)?a(this._calculationInfo,t):this._calculationInfo[t]=e},yA.getSum=function(t){var e=0;if(this._storage[t])for(var i=0,n=this.count();i=this._rawCount||t<0)return-1;var e=this._indices,i=e[t];if(null!=i&&it))return a;o=a-1}}return-1},yA.indicesOfNearest=function(t,e,i){var n=[];if(!this._storage[t])return n;null==i&&(i=1/0);for(var o=Number.MAX_VALUE,a=-1,r=0,s=this.count();r=0&&a<0)&&(o=u,a=l,n.length=0),n.push(r))}return n},yA.getRawIndex=nl,yA.getRawDataItem=function(t){if(this._rawData.persistent)return this._rawData.getItem(this.getRawIndex(t));for(var e=[],i=0;i=l&&w<=u||isNaN(w))&&(a[r++]=c),c++;h=!0}else if(2===n){for(var d=this._storage[s],v=this._storage[e[1]],y=t[e[1]][0],x=t[e[1]][1],f=0;f=l&&w<=u||isNaN(w))&&(b>=y&&b<=x||isNaN(b))&&(a[r++]=c),c++}h=!0}}if(!h)if(1===n)for(m=0;m=l&&w<=u||isNaN(w))&&(a[r++]=M)}else for(m=0;mt[I][1])&&(S=!1)}S&&(a[r++]=this.getRawIndex(m))}return rb[1]&&(b[1]=w)}}}return o},yA.downSample=function(t,e,i,n){for(var o=sl(this,[t]),a=o._storage,r=[],s=Math.floor(1/e),l=a[t],u=this.count(),h=this._chunkSize,c=o._rawExtent[t],d=new($s(this))(u),f=0,p=0;pu-p&&(s=u-p,r.length=s);for(var g=0;gc[1]&&(c[1]=x),d[f++]=_}return o._count=f,o._indices=d,o.getRawIndex=ol,o},yA.getItemModel=function(t){var e=this.hostModel;return new No(this.getRawDataItem(t),e,e&&e.ecModel)},yA.diff=function(t){var e=this;return new Xs(t?t.getIndices():[],this.getIndices(),function(e){return al(t,e)},function(t){return al(e,t)})},yA.getVisual=function(t){var e=this._visual;return e&&e[t]},yA.setVisual=function(t,e){if(lA(t))for(var i in t)t.hasOwnProperty(i)&&this.setVisual(i,t[i]);else this._visual=this._visual||{},this._visual[t]=e},yA.setLayout=function(t,e){if(lA(t))for(var i in t)t.hasOwnProperty(i)&&this.setLayout(i,t[i]);else this._layout[t]=e},yA.getLayout=function(t){return this._layout[t]},yA.getItemLayout=function(t){return this._itemLayouts[t]},yA.setItemLayout=function(t,e,i){this._itemLayouts[t]=i?a(this._itemLayouts[t]||{},e):e},yA.clearItemLayouts=function(){this._itemLayouts.length=0},yA.getItemVisual=function(t,e,i){var n=this._itemVisuals[t],o=n&&n[e];return null!=o||i?o:this.getVisual(e)},yA.setItemVisual=function(t,e,i){var n=this._itemVisuals[t]||{},o=this.hasItemVisual;if(this._itemVisuals[t]=n,lA(e))for(var a in e)e.hasOwnProperty(a)&&(n[a]=e[a],o[a]=!0);else n[e]=i,o[e]=!0},yA.clearAllVisual=function(){this._visual={},this._itemVisuals=[],this.hasItemVisual={}};var xA=function(t){t.seriesIndex=this.seriesIndex,t.dataIndex=this.dataIndex,t.dataType=this.dataType};yA.setItemGraphicEl=function(t,e){var i=this.hostModel;e&&(e.dataIndex=t,e.dataType=this.dataType,e.seriesIndex=i&&i.seriesIndex,"group"===e.type&&e.traverse(xA,e)),this._graphicEls[t]=e},yA.getItemGraphicEl=function(t){return this._graphicEls[t]},yA.eachItemGraphicEl=function(t,e){d(this._graphicEls,function(i,n){i&&t&&t.call(e,i,n)})},yA.cloneShallow=function(t){if(!t){var e=f(this.dimensions,this.getDimensionInfo,this);t=new vA(e,this.hostModel)}if(t._storage=this._storage,Qs(t,this),this._indices){var i=this._indices.constructor;t._indices=new i(this._indices)}else t._indices=null;return t.getRawIndex=t._indices?ol:nl,t},yA.wrapMethod=function(t,e){var i=this[t];"function"==typeof i&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var t=i.apply(this,arguments);return e.apply(this,[t].concat(C(arguments)))})},yA.TRANSFERABLE_METHODS=["cloneShallow","downSample","map"],yA.CHANGABLE_METHODS=["filterSelf","selectRange"];var _A=function(t,e){return e=e||{},hl(e.coordDimensions||[],t,{dimsDef:e.dimensionsDefine||t.dimensionsDefine,encodeDef:e.encodeDefine||t.encodeDefine,dimCount:e.dimensionsCount,generateCoord:e.generateCoord,generateCoordCount:e.generateCoordCount})};xl.prototype.parse=function(t){return t},xl.prototype.getSetting=function(t){return this._setting[t]},xl.prototype.contain=function(t){var e=this._extent;return t>=e[0]&&t<=e[1]},xl.prototype.normalize=function(t){var e=this._extent;return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])},xl.prototype.scale=function(t){var e=this._extent;return t*(e[1]-e[0])+e[0]},xl.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1])},xl.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},xl.prototype.getExtent=function(){return this._extent.slice()},xl.prototype.setExtent=function(t,e){var i=this._extent;isNaN(t)||(i[0]=t),isNaN(e)||(i[1]=e)},xl.prototype.isBlank=function(){return this._isBlank},xl.prototype.setBlank=function(t){this._isBlank=t},xl.prototype.getLabel=null,ji(xl),$i(xl,{registerWhenExtend:!0}),_l.createByAxisModel=function(t){var e=t.option,i=e.data,n=i&&f(i,bl);return new _l({categories:n,needCollect:!n,deduplication:!1!==e.dedplication})};var wA=_l.prototype;wA.getOrdinal=function(t){return wl(this).get(t)},wA.parseAndCollect=function(t){var e,i=this._needCollect;if("string"!=typeof t&&!i)return t;if(i&&!this._deduplication)return e=this.categories.length,this.categories[e]=t,e;var n=wl(this);return null==(e=n.get(t))&&(i?(e=this.categories.length,this.categories[e]=t,n.set(t,e)):e=NaN),e};var bA=xl.prototype,SA=xl.extend({type:"ordinal",init:function(t,e){t&&!y(t)||(t=new _l({categories:t})),this._ordinalMeta=t,this._extent=e||[0,t.categories.length-1]},parse:function(t){return"string"==typeof t?this._ordinalMeta.getOrdinal(t):Math.round(t)},contain:function(t){return t=this.parse(t),bA.contain.call(this,t)&&null!=this._ordinalMeta.categories[t]},normalize:function(t){return bA.normalize.call(this,this.parse(t))},scale:function(t){return Math.round(bA.scale.call(this,t))},getTicks:function(){for(var t=[],e=this._extent,i=e[0];i<=e[1];)t.push(i),i++;return t},getLabel:function(t){if(!this.isBlank())return this._ordinalMeta.categories[t]},count:function(){return this._extent[1]-this._extent[0]+1},unionExtentFromData:function(t,e){this.unionExtent(t.getApproximateExtent(e))},getOrdinalMeta:function(){return this._ordinalMeta},niceTicks:B,niceExtent:B});SA.create=function(){return new SA};var MA=Go,IA=Go,TA=xl.extend({type:"interval",_interval:0,_intervalPrecision:2,setExtent:function(t,e){var i=this._extent;isNaN(t)||(i[0]=parseFloat(t)),isNaN(e)||(i[1]=parseFloat(e))},unionExtent:function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1]),TA.prototype.setExtent.call(this,e[0],e[1])},getInterval:function(){return this._interval},setInterval:function(t){this._interval=t,this._niceExtent=this._extent.slice(),this._intervalPrecision=Ml(t)},getTicks:function(){return Al(this._interval,this._extent,this._niceExtent,this._intervalPrecision)},getLabel:function(t,e){if(null==t)return"";var i=e&&e.precision;return null==i?i=Ho(t)||0:"auto"===i&&(i=this._intervalPrecision),t=IA(t,i,!0),ta(t)},niceTicks:function(t,e,i){t=t||5;var n=this._extent,o=n[1]-n[0];if(isFinite(o)){o<0&&(o=-o,n.reverse());var a=Sl(n,t,e,i);this._intervalPrecision=a.intervalPrecision,this._interval=a.interval,this._niceExtent=a.niceTickExtent}},niceExtent:function(t){var e=this._extent;if(e[0]===e[1])if(0!==e[0]){var i=e[0];t.fixMax?e[0]-=i/2:(e[1]+=i/2,e[0]-=i/2)}else e[1]=1;var n=e[1]-e[0];isFinite(n)||(e[0]=0,e[1]=1),this.niceTicks(t.splitNumber,t.minInterval,t.maxInterval);var o=this._interval;t.fixMin||(e[0]=IA(Math.floor(e[0]/o)*o)),t.fixMax||(e[1]=IA(Math.ceil(e[1]/o)*o))}});TA.create=function(){return new TA};var AA="__ec_stack_",DA="undefined"!=typeof Float32Array?Float32Array:Array,CA={seriesType:"bar",plan:$I(),reset:function(t){if(Rl(t)&&zl(t)){var e=t.getData(),i=t.coordinateSystem,n=i.getBaseAxis(),o=i.getOtherAxis(n),a=e.mapDimension(o.dim),r=e.mapDimension(n.dim),s=o.isHorizontal(),l=s?0:1,u=Ol(Pl([t]),n,t).width;return u>.5||(u=.5),{progress:function(t,e){for(var n,h=new DA(2*t.count),c=[],d=[],f=0;null!=(n=t.next());)d[l]=e.get(a,n),d[1-l]=e.get(r,n),c=i.dataToPoint(d,null,c),h[f++]=c[0],h[f++]=c[1];e.setLayout({largePoints:h,barWidth:u,valueAxisStart:Bl(0,o),valueAxisHorizontal:s})}}}}},LA=TA.prototype,kA=Math.ceil,PA=Math.floor,NA=function(t,e,i,n){for(;i>>1;t[o][1]i&&(a=i);var r=EA.length,s=NA(EA,a,0,r),l=EA[Math.min(s,r-1)],u=l[1];"year"===l[0]&&(u*=$o(o/u/t,!0));var h=this.getSetting("useUTC")?0:60*new Date(+n[0]||+n[1]).getTimezoneOffset()*1e3,c=[Math.round(kA((n[0]-h)/u)*u+h),Math.round(PA((n[1]-h)/u)*u+h)];Tl(c,n),this._stepLvl=l,this._interval=u,this._niceExtent=c},parse:function(t){return+Yo(t)}});d(["contain","normalize"],function(t){OA.prototype[t]=function(e){return LA[t].call(this,this.parse(e))}});var EA=[["hh:mm:ss",1e3],["hh:mm:ss",5e3],["hh:mm:ss",1e4],["hh:mm:ss",15e3],["hh:mm:ss",3e4],["hh:mm\nMM-dd",6e4],["hh:mm\nMM-dd",3e5],["hh:mm\nMM-dd",6e5],["hh:mm\nMM-dd",9e5],["hh:mm\nMM-dd",18e5],["hh:mm\nMM-dd",36e5],["hh:mm\nMM-dd",72e5],["hh:mm\nMM-dd",216e5],["hh:mm\nMM-dd",432e5],["MM-dd\nyyyy",864e5],["MM-dd\nyyyy",1728e5],["MM-dd\nyyyy",2592e5],["MM-dd\nyyyy",3456e5],["MM-dd\nyyyy",432e6],["MM-dd\nyyyy",5184e5],["week",6048e5],["MM-dd\nyyyy",864e6],["week",12096e5],["week",18144e5],["month",26784e5],["week",36288e5],["month",53568e5],["week",6048e6],["quarter",8208e6],["month",107136e5],["month",13392e6],["half-year",16416e6],["month",214272e5],["month",26784e6],["year",32832e6]];OA.create=function(t){return new OA({useUTC:t.ecModel.get("useUTC")})};var RA=xl.prototype,zA=TA.prototype,BA=Ho,VA=Go,GA=Math.floor,FA=Math.ceil,WA=Math.pow,HA=Math.log,ZA=xl.extend({type:"log",base:10,$constructor:function(){xl.apply(this,arguments),this._originalScale=new TA},getTicks:function(){var t=this._originalScale,e=this._extent,i=t.getExtent();return f(zA.getTicks.call(this),function(n){var o=Go(WA(this.base,n));return o=n===e[0]&&t.__fixMin?Vl(o,i[0]):o,o=n===e[1]&&t.__fixMax?Vl(o,i[1]):o},this)},getLabel:zA.getLabel,scale:function(t){return t=RA.scale.call(this,t),WA(this.base,t)},setExtent:function(t,e){var i=this.base;t=HA(t)/HA(i),e=HA(e)/HA(i),zA.setExtent.call(this,t,e)},getExtent:function(){var t=this.base,e=RA.getExtent.call(this);e[0]=WA(t,e[0]),e[1]=WA(t,e[1]);var i=this._originalScale,n=i.getExtent();return i.__fixMin&&(e[0]=Vl(e[0],n[0])),i.__fixMax&&(e[1]=Vl(e[1],n[1])),e},unionExtent:function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=HA(t[0])/HA(e),t[1]=HA(t[1])/HA(e),RA.unionExtent.call(this,t)},unionExtentFromData:function(t,e){this.unionExtent(t.getApproximateExtent(e))},niceTicks:function(t){t=t||10;var e=this._extent,i=e[1]-e[0];if(!(i===1/0||i<=0)){var n=qo(i);for(t/i*n<=.5&&(n*=10);!isNaN(n)&&Math.abs(n)<1&&Math.abs(n)>0;)n*=10;var o=[Go(FA(e[0]/n)*n),Go(GA(e[1]/n)*n)];this._interval=n,this._niceExtent=o}},niceExtent:function(t){zA.niceExtent.call(this,t);var e=this._originalScale;e.__fixMin=t.fixMin,e.__fixMax=t.fixMax}});d(["contain","normalize"],function(t){ZA.prototype[t]=function(e){return e=HA(e)/HA(this.base),RA[t].call(this,e)}}),ZA.create=function(){return new ZA};var UA={getMin:function(t){var e=this.option,i=t||null==e.rangeStart?e.min:e.rangeStart;return this.axis&&null!=i&&"dataMin"!==i&&"function"!=typeof i&&!I(i)&&(i=this.axis.scale.parse(i)),i},getMax:function(t){var e=this.option,i=t||null==e.rangeEnd?e.max:e.rangeEnd;return this.axis&&null!=i&&"dataMax"!==i&&"function"!=typeof i&&!I(i)&&(i=this.axis.scale.parse(i)),i},getNeedCrossZero:function(){var t=this.option;return null==t.rangeStart&&null==t.rangeEnd&&!t.scale},getCoordSysModel:B,setRange:function(t,e){this.option.rangeStart=t,this.option.rangeEnd=e},resetRange:function(){this.option.rangeStart=this.option.rangeEnd=null}},XA=Un({type:"triangle",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var i=e.cx,n=e.cy,o=e.width/2,a=e.height/2;t.moveTo(i,n-a),t.lineTo(i+o,n+a),t.lineTo(i-o,n+a),t.closePath()}}),jA=Un({type:"diamond",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var i=e.cx,n=e.cy,o=e.width/2,a=e.height/2;t.moveTo(i,n-a),t.lineTo(i+o,n),t.lineTo(i,n+a),t.lineTo(i-o,n),t.closePath()}}),YA=Un({type:"pin",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.x,n=e.y,o=e.width/5*3,a=Math.max(o,e.height),r=o/2,s=r*r/(a-r),l=n-a+r+s,u=Math.asin(s/r),h=Math.cos(u)*r,c=Math.sin(u),d=Math.cos(u),f=.6*r,p=.7*r;t.moveTo(i-h,l+s),t.arc(i,l,r,Math.PI-u,2*Math.PI+u),t.bezierCurveTo(i+h-c*f,l+s+d*f,i,n-p,i,n),t.bezierCurveTo(i,n-p,i-h+c*f,l+s+d*f,i-h,l+s),t.closePath()}}),qA=Un({type:"arrow",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.height,n=e.width,o=e.x,a=e.y,r=n/3*2;t.moveTo(o,a),t.lineTo(o+r,a+i),t.lineTo(o,a+i/4*3),t.lineTo(o-r,a+i),t.lineTo(o,a),t.closePath()}}),KA={line:function(t,e,i,n,o){o.x1=t,o.y1=e+n/2,o.x2=t+i,o.y2=e+n/2},rect:function(t,e,i,n,o){o.x=t,o.y=e,o.width=i,o.height=n},roundRect:function(t,e,i,n,o){o.x=t,o.y=e,o.width=i,o.height=n,o.r=Math.min(i,n)/4},square:function(t,e,i,n,o){var a=Math.min(i,n);o.x=t,o.y=e,o.width=a,o.height=a},circle:function(t,e,i,n,o){o.cx=t+i/2,o.cy=e+n/2,o.r=Math.min(i,n)/2},diamond:function(t,e,i,n,o){o.cx=t+i/2,o.cy=e+n/2,o.width=i,o.height=n},pin:function(t,e,i,n,o){o.x=t+i/2,o.y=e+n/2,o.width=i,o.height=n},arrow:function(t,e,i,n,o){o.x=t+i/2,o.y=e+n/2,o.width=i,o.height=n},triangle:function(t,e,i,n,o){o.cx=t+i/2,o.cy=e+n/2,o.width=i,o.height=n}},$A={};d({line:_M,rect:yM,roundRect:yM,square:yM,circle:sM,diamond:jA,pin:YA,arrow:qA,triangle:XA},function(t,e){$A[e]=new t});var JA=Un({type:"symbol",shape:{symbolType:"",x:0,y:0,width:0,height:0},beforeBrush:function(){var t=this.style;"pin"===this.shape.symbolType&&"inside"===t.textPosition&&(t.textPosition=["50%","40%"],t.textAlign="center",t.textVerticalAlign="middle")},buildPath:function(t,e,i){var n=e.symbolType,o=$A[n];"none"!==e.symbolType&&(o||(o=$A[n="rect"]),KA[n](e.x,e.y,e.width,e.height,o.shape),o.buildPath(t,o.shape,i))}}),QA={isDimensionStacked:pl,enableDataStack:fl,getStackedDimension:gl},tD=(Object.freeze||Object)({createList:function(t){return ml(t.getSource(),t)},getLayoutRect:ca,dataStack:QA,createScale:function(t,e){var i=e;No.isInstance(e)||h(i=new No(e),UA);var n=Hl(i);return n.setExtent(t[0],t[1]),Wl(n,i),n},mixinAxisModelCommonMethods:function(t){h(t,UA)},completeDimensions:hl,createDimensions:_A,createSymbol:Jl}),eD=1e-8;eu.prototype={constructor:eu,properties:null,getBoundingRect:function(){var t=this._rect;if(t)return t;for(var e=Number.MAX_VALUE,i=[e,e],n=[-e,-e],o=[],a=[],r=this.geometries,s=0;s0}),function(t){var e=t.properties,i=t.geometry,n=i.coordinates,o=[];"Polygon"===i.type&&o.push({type:"polygon",exterior:n[0],interiors:n.slice(1)}),"MultiPolygon"===i.type&&d(n,function(t){t[0]&&o.push({type:"polygon",exterior:t[0],interiors:t.slice(1)})});var a=new eu(e.name,o,e.cp);return a.properties=e,a})},nD=Bi(),oD=[0,1],aD=function(t,e,i){this.dim=t,this.scale=e,this._extent=i||[0,0],this.inverse=!1,this.onBand=!1};aD.prototype={constructor:aD,contain:function(t){var e=this._extent,i=Math.min(e[0],e[1]),n=Math.max(e[0],e[1]);return t>=i&&t<=n},containData:function(t){return this.contain(this.dataToCoord(t))},getExtent:function(){return this._extent.slice()},getPixelPrecision:function(t){return Zo(t||this.scale.getExtent(),this._extent)},setExtent:function(t,e){var i=this._extent;i[0]=t,i[1]=e},dataToCoord:function(t,e){var i=this._extent,n=this.scale;return t=n.normalize(t),this.onBand&&"ordinal"===n.type&&yu(i=i.slice(),n.count()),Bo(t,oD,i,e)},coordToData:function(t,e){var i=this._extent,n=this.scale;this.onBand&&"ordinal"===n.type&&yu(i=i.slice(),n.count());var o=Bo(t,i,oD,e);return this.scale.scale(o)},pointToData:function(t,e){},getTicksCoords:function(t){var e=(t=t||{}).tickModel||this.getTickModel(),i=au(this,e),n=f(i.ticks,function(t){return{coord:this.dataToCoord(t),tickValue:t}},this),o=e.get("alignWithLabel");return xu(this,n,i.tickCategoryInterval,o,t.clamp),n},getViewLabels:function(){return ou(this).labels},getLabelModel:function(){return this.model.getModel("axisLabel")},getTickModel:function(){return this.model.getModel("axisTick")},getBandWidth:function(){var t=this._extent,e=this.scale.getExtent(),i=e[1]-e[0]+(this.onBand?1:0);0===i&&(i=1);var n=Math.abs(t[1]-t[0]);return Math.abs(n)/i},isHorizontal:null,getRotate:null,calculateCategoryInterval:function(){return pu(this)}};var rD=iD,sD={};d(["map","each","filter","indexOf","inherits","reduce","filter","bind","curry","isArray","isString","isObject","isFunction","extend","defaults","clone","merge"],function(t){sD[t]=aw[t]});var lD={};d(["extendShape","extendPath","makePath","makeImage","mergePath","resizePath","createIcon","setHoverStyle","setLabelStyle","setTextStyle","setText","getFont","updateProps","initProps","getTransform","clipPointsByRect","clipRectByRect","Group","Image","Text","Circle","Sector","Ring","Polygon","Polyline","Rect","Line","BezierCurve","Arc","IncrementalDisplayable","CompoundPath","LinearGradient","RadialGradient","BoundingRect"],function(t){lD[t]=zM[t]}),YI.extend({type:"series.line",dependencies:["grid","polar"],getInitialData:function(t,e){return ml(this.getSource(),this)},defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,clipOverflow:!0,label:{position:"top"},lineStyle:{width:2,type:"solid"},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0}});var uD=wu.prototype,hD=wu.getSymbolSize=function(t,e){var i=t.getItemVisual(e,"symbolSize");return i instanceof Array?i.slice():[+i,+i]};uD._createSymbol=function(t,e,i,n,o){this.removeAll();var a=Jl(t,-1,-1,2,2,e.getItemVisual(i,"color"),o);a.attr({z2:100,culling:!0,scale:bu(n)}),a.drift=Su,this._symbolType=t,this.add(a)},uD.stopSymbolAnimation=function(t){this.childAt(0).stopAnimation(t)},uD.getSymbolPath=function(){return this.childAt(0)},uD.getScale=function(){return this.childAt(0).scale},uD.highlight=function(){this.childAt(0).trigger("emphasis")},uD.downplay=function(){this.childAt(0).trigger("normal")},uD.setZ=function(t,e){var i=this.childAt(0);i.zlevel=t,i.z=e},uD.setDraggable=function(t){var e=this.childAt(0);e.draggable=t,e.cursor=t?"move":"pointer"},uD.updateData=function(t,e,i){this.silent=!1;var n=t.getItemVisual(e,"symbol")||"circle",o=t.hostModel,a=hD(t,e),r=n!==this._symbolType;if(r){var s=t.getItemVisual(e,"symbolKeepAspect");this._createSymbol(n,t,e,a,s)}else(l=this.childAt(0)).silent=!1,Io(l,{scale:bu(a)},o,e);if(this._updateCommon(t,e,a,i),r){var l=this.childAt(0),u=i&&i.fadeIn,h={scale:l.scale.slice()};u&&(h.style={opacity:l.style.opacity}),l.scale=[0,0],u&&(l.style.opacity=0),To(l,h,o,e)}this._seriesModel=o};var cD=["itemStyle"],dD=["emphasis","itemStyle"],fD=["label"],pD=["emphasis","label"];uD._updateCommon=function(t,e,i,n){var o=this.childAt(0),r=t.hostModel,s=t.getItemVisual(e,"color");"image"!==o.type&&o.useStyle({strokeNoScale:!0});var l=n&&n.itemStyle,u=n&&n.hoverItemStyle,h=n&&n.symbolRotate,c=n&&n.symbolOffset,d=n&&n.labelModel,f=n&&n.hoverLabelModel,p=n&&n.hoverAnimation,g=n&&n.cursorStyle;if(!n||t.hasItemOption){var m=n&&n.itemModel?n.itemModel:t.getItemModel(e);l=m.getModel(cD).getItemStyle(["color"]),u=m.getModel(dD).getItemStyle(),h=m.getShallow("symbolRotate"),c=m.getShallow("symbolOffset"),d=m.getModel(fD),f=m.getModel(pD),p=m.getShallow("hoverAnimation"),g=m.getShallow("cursor")}else u=a({},u);var v=o.style;o.attr("rotation",(h||0)*Math.PI/180||0),c&&o.attr("position",[Vo(c[0],i[0]),Vo(c[1],i[1])]),g&&o.attr("cursor",g),o.setColor(s,n&&n.symbolInnerColor),o.setStyle(l);var y=t.getItemVisual(e,"opacity");null!=y&&(v.opacity=y);var x=t.getItemVisual(e,"liftZ"),_=o.__z2Origin;null!=x?null==_&&(o.__z2Origin=o.z2,o.z2+=x):null!=_&&(o.z2=_,o.__z2Origin=null);var w=n&&n.useNameLabel;go(v,u,d,f,{labelFetcher:r,labelDataIndex:e,defaultText:function(e,i){return w?t.getName(e):_u(t,e)},isRectText:!0,autoColor:s}),o.off("mouseover").off("mouseout").off("emphasis").off("normal"),o.hoverStyle=u,fo(o),o.__symbolOriginalScale=bu(i),p&&r.isAnimationEnabled()&&o.on("mouseover",Mu).on("mouseout",Iu).on("emphasis",Tu).on("normal",Au)},uD.fadeOut=function(t,e){var i=this.childAt(0);this.silent=i.silent=!0,!(e&&e.keepLabel)&&(i.style.text=null),Io(i,{style:{opacity:0},scale:[0,0]},this._seriesModel,this.dataIndex,t)},u(wu,tb);var gD=Du.prototype;gD.updateData=function(t,e){e=Lu(e);var i=this.group,n=t.hostModel,o=this._data,a=this._symbolCtor,r=ku(t);o||i.removeAll(),t.diff(o).add(function(n){var o=t.getItemLayout(n);if(Cu(t,o,n,e)){var s=new a(t,n,r);s.attr("position",o),t.setItemGraphicEl(n,s),i.add(s)}}).update(function(s,l){var u=o.getItemGraphicEl(l),h=t.getItemLayout(s);Cu(t,h,s,e)?(u?(u.updateData(t,s,r),Io(u,{position:h},n)):(u=new a(t,s)).attr("position",h),i.add(u),t.setItemGraphicEl(s,u)):i.remove(u)}).remove(function(t){var e=o.getItemGraphicEl(t);e&&e.fadeOut(function(){i.remove(e)})}).execute(),this._data=t},gD.isPersistent=function(){return!0},gD.updateLayout=function(){var t=this._data;t&&t.eachItemGraphicEl(function(e,i){var n=t.getItemLayout(i);e.attr("position",n)})},gD.incrementalPrepareUpdate=function(t){this._seriesScope=ku(t),this._data=null,this.group.removeAll()},gD.incrementalUpdate=function(t,e,i){i=Lu(i);for(var n=t.start;n0&&Ru(i[o-1]);o--);for(;n0&&Ru(i[a-1]);a--);for(;o=0){var r=o.getItemGraphicEl(a);if(!r){var s=o.getItemLayout(a);if(!s)return;(r=new wu(o,a)).position=s,r.setZ(t.get("zlevel"),t.get("z")),r.ignore=isNaN(s[0])||isNaN(s[1]),r.__temp=!0,o.setItemGraphicEl(a,r),r.stopSymbolAnimation(!0),this.group.add(r)}r.highlight()}else Ar.prototype.highlight.call(this,t,e,i,n)},downplay:function(t,e,i,n){var o=t.getData(),a=zi(o,n);if(null!=a&&a>=0){var r=o.getItemGraphicEl(a);r&&(r.__temp?(o.setItemGraphicEl(a,null),this.group.remove(r)):r.downplay())}else Ar.prototype.downplay.call(this,t,e,i,n)},_newPolyline:function(t){var e=this._polyline;return e&&this._lineGroup.remove(e),e=new MD({shape:{points:t},silent:!0,z2:10}),this._lineGroup.add(e),this._polyline=e,e},_newPolygon:function(t,e){var i=this._polygon;return i&&this._lineGroup.remove(i),i=new ID({shape:{points:t,stackedOnPoints:e},silent:!0}),this._lineGroup.add(i),this._polygon=i,i},_updateAnimation:function(t,e,i,n,o,a){var r=this._polyline,s=this._polygon,l=t.hostModel,u=mD(this._data,t,this._stackedOnPoints,e,this._coordSys,i,this._valueOrigin,a),h=u.current,c=u.stackedOnCurrent,d=u.next,f=u.stackedOnNext;o&&(h=Yu(u.current,i,o),c=Yu(u.stackedOnCurrent,i,o),d=Yu(u.next,i,o),f=Yu(u.stackedOnNext,i,o)),r.shape.__points=u.current,r.shape.points=h,Io(r,{shape:{points:d}},l),s&&(s.setShape({points:h,stackedOnPoints:c}),Io(s,{shape:{points:d,stackedOnPoints:f}},l));for(var p=[],g=u.status,m=0;me&&(e=t[i]);return isFinite(e)?e:NaN},min:function(t){for(var e=1/0,i=0;ie[1]&&e.reverse(),e},getOtherAxis:function(){this.grid.getOtherAxis()},pointToData:function(t,e){return this.coordToData(this.toLocalCoord(t["x"===this.dim?0:1]),e)},toLocalCoord:null,toGlobalCoord:null},u(kD,aD);var PD={show:!0,zlevel:0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#333",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}}},ND={};ND.categoryAxis=n({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},PD),ND.valueAxis=n({boundaryGap:[0,0],splitNumber:5},PD),ND.timeAxis=r({scale:!0,min:"dataMin",max:"dataMax"},ND.valueAxis),ND.logAxis=r({scale:!0,logBase:10},ND.valueAxis);var OD=["value","category","time","log"],ED=function(t,e,i,a){d(OD,function(r){e.extend({type:t+"Axis."+r,mergeDefaultAndTheme:function(e,o){var a=this.layoutMode,s=a?ga(e):{};n(e,o.getTheme().get(r+"Axis")),n(e,this.getDefaultOption()),e.type=i(t,e),a&&pa(e,s,a)},optionUpdated:function(){"category"===this.option.type&&(this.__ordinalMeta=_l.createByAxisModel(this))},getCategories:function(t){var e=this.option;if("category"===e.type)return t?e.data:this.__ordinalMeta.categories},getOrdinalMeta:function(){return this.__ordinalMeta},defaultOption:o([{},ND[r+"Axis"],a],!0)})}),lI.registerSubTypeDefaulter(t+"Axis",v(i,t))},RD=lI.extend({type:"cartesian2dAxis",axis:null,init:function(){RD.superApply(this,"init",arguments),this.resetRange()},mergeOption:function(){RD.superApply(this,"mergeOption",arguments),this.resetRange()},restoreData:function(){RD.superApply(this,"restoreData",arguments),this.resetRange()},getCoordSysModel:function(){return this.ecModel.queryComponents({mainType:"grid",index:this.option.gridIndex,id:this.option.gridId})[0]}});n(RD.prototype,UA);var zD={offset:0};ED("x",RD,th,zD),ED("y",RD,th,zD),lI.extend({type:"grid",dependencies:["xAxis","yAxis"],layoutMode:"box",coordinateSystem:null,defaultOption:{show:!1,zlevel:0,z:0,left:"10%",top:60,right:"10%",bottom:60,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"}});var BD=ih.prototype;BD.type="grid",BD.axisPointerEnabled=!0,BD.getRect=function(){return this._rect},BD.update=function(t,e){var i=this._axesMap;this._updateScale(t,this.model),d(i.x,function(t){Wl(t.scale,t.model)}),d(i.y,function(t){Wl(t.scale,t.model)});var n={};d(i.x,function(t){nh(i,"y",t,n)}),d(i.y,function(t){nh(i,"x",t,n)}),this.resize(this.model,e)},BD.resize=function(t,e,i){function n(){d(a,function(t){var e=t.isHorizontal(),i=e?[0,o.width]:[0,o.height],n=t.inverse?1:0;t.setExtent(i[n],i[1-n]),ah(t,e?o.x:o.y)})}var o=ca(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()});this._rect=o;var a=this._axesList;n(),!i&&t.get("containLabel")&&(d(a,function(t){if(!t.model.get("axisLabel.inside")){var e=jl(t);if(e){var i=t.isHorizontal()?"height":"width",n=t.model.get("axisLabel.margin");o[i]-=e[i]+n,"top"===t.position?o.y+=e.height+n:"left"===t.position&&(o.x+=e.width+n)}}}),n())},BD.getAxis=function(t,e){var i=this._axesMap[t];if(null!=i){if(null==e)for(var n in i)if(i.hasOwnProperty(n))return i[n];return i[e]}},BD.getAxes=function(){return this._axesList.slice()},BD.getCartesian=function(t,e){if(null!=t&&null!=e){var i="x"+t+"y"+e;return this._coordsMap[i]}w(t)&&(e=t.yAxisIndex,t=t.xAxisIndex);for(var n=0,o=this._coordsList;nu[1]?-1:1,c=["start"===o?u[0]-h*l:"end"===o?u[1]+h*l:(u[0]+u[1])/2,ph(o)?t.labelOffset+r*l:0],d=e.get("nameRotate");null!=d&&(d=d*GD/180);var f;ph(o)?n=HD(t.rotation,null!=d?d:t.rotation,r):(n=uh(t,o,d||0,u),null!=(f=t.axisNameAvailableWidth)&&(f=Math.abs(f/Math.sin(n.rotation)),!isFinite(f)&&(f=null)));var p=s.getFont(),g=e.get("nameTruncate",!0)||{},m=g.ellipsis,v=T(t.nameTruncateMaxWidth,g.maxWidth,f),y=null!=m&&null!=v?tI(i,v,p,m,{minChar:2,placeholder:g.placeholder}):i,x=e.get("tooltip",!0),_=e.mainType,w={componentType:_,name:i,$vars:["name"]};w[_+"Index"]=e.componentIndex;var b=new rM({anid:"name",__fullText:i,__truncatedText:y,position:c,rotation:n.rotation,silent:hh(e),z2:1,tooltip:x&&x.show?a({content:i,formatter:function(){return i},formatterParams:w},x):null});mo(b.style,s,{text:y,textFont:p,textFill:s.getTextColor()||e.get("axisLine.lineStyle.color"),textAlign:n.textAlign,textVerticalAlign:n.textVerticalAlign}),e.get("triggerEvent")&&(b.eventData=lh(e),b.eventData.targetType="axisName",b.eventData.name=i),this._dumbGroup.add(b),b.updateTransform(),this.group.add(b),b.decomposeTransform()}}},HD=FD.innerTextLayout=function(t,e,i){var n,o,a=Xo(e-t);return jo(a)?(o=i>0?"top":"bottom",n="center"):jo(a-GD)?(o=i>0?"bottom":"top",n="center"):(o="middle",n=a>0&&a0?"right":"left":i>0?"left":"right"),{rotation:a,textAlign:n,textVerticalAlign:o}},ZD=d,UD=v,XD=Ws({type:"axis",_axisPointer:null,axisPointerClass:null,render:function(t,e,i,n){this.axisPointerClass&&Sh(t),XD.superApply(this,"render",arguments),Dh(this,t,0,i,0,!0)},updateAxisPointer:function(t,e,i,n,o){Dh(this,t,0,i,0,!1)},remove:function(t,e){var i=this._axisPointer;i&&i.remove(e),XD.superApply(this,"remove",arguments)},dispose:function(t,e){Ch(this,e),XD.superApply(this,"dispose",arguments)}}),jD=[];XD.registerAxisPointerClass=function(t,e){jD[t]=e},XD.getAxisPointerClass=function(t){return t&&jD[t]};var YD=["axisLine","axisTickLabel","axisName"],qD=["splitArea","splitLine"],KD=XD.extend({type:"cartesianAxis",axisPointerClass:"CartesianAxisPointer",render:function(t,e,i,n){this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new tb,this.group.add(this._axisGroup),t.get("show")){var a=t.getCoordSysModel(),r=Lh(a,t),s=new FD(t,r);d(YD,s.add,s),this._axisGroup.add(s.getGroup()),d(qD,function(e){t.get(e+".show")&&this["_"+e](t,a)},this),Lo(o,this._axisGroup,t),KD.superCall(this,"render",t,e,i,n)}},remove:function(){this._splitAreaColors=null},_splitLine:function(t,e){var i=t.axis;if(!i.scale.isBlank()){var n=t.getModel("splitLine"),o=n.getModel("lineStyle"),a=o.get("color");a=y(a)?a:[a];for(var s=e.coordinateSystem.getRect(),l=i.isHorizontal(),u=0,h=i.getTicksCoords({tickModel:n}),c=[],d=[],f=o.getLineStyle(),p=0;p1){var c;"string"==typeof o?c=DD[o]:"function"==typeof o&&(c=o),c&&t.setData(n.downSample(n.mapDimension(s.dim),1/h,c,CD))}}}}}("line"));var $D=YI.extend({type:"series.__base_bar__",getInitialData:function(t,e){return ml(this.getSource(),this)},getMarkerPosition:function(t){var e=this.coordinateSystem;if(e){var i=e.dataToPoint(e.clampData(t)),n=this.getData(),o=n.getLayout("offset"),a=n.getLayout("size");return i[e.getBaseAxis().isHorizontal()?0:1]+=o+a/2,i}return[NaN,NaN]},defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:"mod",itemStyle:{},emphasis:{}}});$D.extend({type:"series.bar",dependencies:["grid","polar"],brushSelector:"rect",getProgressive:function(){return!!this.get("large")&&this.get("progressive")},getProgressiveThreshold:function(){var t=this.get("progressiveThreshold"),e=this.get("largeThreshold");return e>t&&(t=e),t}});var JD=Qb([["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["stroke","barBorderColor"],["lineWidth","barBorderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]),QD={getBarItemStyle:function(t){var e=JD(this,t);if(this.getBorderLineDash){var i=this.getBorderLineDash();i&&(e.lineDash=i)}return e}},tC=["itemStyle","barBorderWidth"];a(No.prototype,QD),Zs({type:"bar",render:function(t,e,i){this._updateDrawMode(t);var n=t.get("coordinateSystem");return"cartesian2d"!==n&&"polar"!==n||(this._isLargeDraw?this._renderLarge(t,e,i):this._renderNormal(t,e,i)),this.group},incrementalPrepareRender:function(t,e,i){this._clear(),this._updateDrawMode(t)},incrementalRender:function(t,e,i,n){this._incrementalRenderLarge(t,e)},_updateDrawMode:function(t){var e=t.pipelineContext.large;(null==this._isLargeDraw||e^this._isLargeDraw)&&(this._isLargeDraw=e,this._clear())},_renderNormal:function(t,e,i){var n,o=this.group,a=t.getData(),r=this._data,s=t.coordinateSystem,l=s.getBaseAxis();"cartesian2d"===s.type?n=l.isHorizontal():"polar"===s.type&&(n="angle"===l.dim);var u=t.isAnimationEnabled()?t:null;a.diff(r).add(function(e){if(a.hasValue(e)){var i=a.getItemModel(e),r=iC[s.type](a,e,i),l=eC[s.type](a,e,i,r,n,u);a.setItemGraphicEl(e,l),o.add(l),Eh(l,a,e,i,r,t,n,"polar"===s.type)}}).update(function(e,i){var l=r.getItemGraphicEl(i);if(a.hasValue(e)){var h=a.getItemModel(e),c=iC[s.type](a,e,h);l?Io(l,{shape:c},u,e):l=eC[s.type](a,e,h,c,n,u,!0),a.setItemGraphicEl(e,l),o.add(l),Eh(l,a,e,h,c,t,n,"polar"===s.type)}else o.remove(l)}).remove(function(t){var e=r.getItemGraphicEl(t);"cartesian2d"===s.type?e&&Nh(t,u,e):e&&Oh(t,u,e)}).execute(),this._data=a},_renderLarge:function(t,e,i){this._clear(),zh(t,this.group)},_incrementalRenderLarge:function(t,e){zh(e,this.group,!0)},dispose:B,remove:function(t){this._clear(t)},_clear:function(t){var e=this.group,i=this._data;t&&t.get("animation")&&i&&!this._isLargeDraw?i.eachItemGraphicEl(function(e){"sector"===e.type?Oh(e.dataIndex,t,e):Nh(e.dataIndex,t,e)}):e.removeAll(),this._data=null}});var eC={cartesian2d:function(t,e,i,n,o,r,s){var l=new yM({shape:a({},n)});if(r){var u=l.shape,h=o?"height":"width",c={};u[h]=0,c[h]=n[h],zM[s?"updateProps":"initProps"](l,{shape:c},r,e)}return l},polar:function(t,e,i,n,o,a,s){var l=n.startAngle0?1:-1,r=n.height>0?1:-1;return{x:n.x+a*o/2,y:n.y+r*o/2,width:n.width-a*o,height:n.height-r*o}},polar:function(t,e,i){var n=t.getItemLayout(e);return{cx:n.cx,cy:n.cy,r0:n.r0,r:n.r,startAngle:n.startAngle,endAngle:n.endAngle}}},nC=Pn.extend({type:"largeBar",shape:{points:[]},buildPath:function(t,e){for(var i=e.points,n=this.__startPoint,o=this.__valueIdx,a=0;a0&&"scale"!==u){var d=o.getItemLayout(0),f=Math.max(i.getWidth(),i.getHeight())/2,p=m(r.removeClipPath,r);r.setClipPath(this._createClipPath(d.cx,d.cy,f,d.startAngle,d.clockwise,p,t))}else r.removeClipPath();this._data=o}},dispose:function(){},_createClipPath:function(t,e,i,n,o,a,r){var s=new hM({shape:{cx:t,cy:e,r0:0,r:i,startAngle:n,endAngle:n,clockwise:o}});return To(s,{shape:{endAngle:n+(o?1:-1)*Math.PI*2}},r,a),s},containPoint:function(t,e){var i=e.getData().getItemLayout(0);if(i){var n=t[0]-i.cx,o=t[1]-i.cy,a=Math.sqrt(n*n+o*o);return a<=i.r&&a>=i.r0}}});var lC=function(t,e){d(e,function(e){e.update="updateView",Es(e,function(i,n){var o={};return n.eachComponent({mainType:"series",subType:t,query:i},function(t){t[e.method]&&t[e.method](i.name,i.dataIndex);var n=t.getData();n.each(function(e){var i=n.getName(e);o[i]=t.isSelected(i)||!1})}),{name:i.name,selected:o}})})},uC=function(t){return{getTargetSeries:function(e){var i={},n=R();return e.eachSeriesByType(t,function(t){t.__paletteScope=i,n.set(t.uid,t)}),n},reset:function(t,e){var i=t.getRawData(),n={},o=t.getData();o.each(function(t){var e=o.getRawIndex(t);n[e]=t}),i.each(function(e){var a=n[e],r=null!=a&&o.getItemVisual(a,"color",!0);if(r)i.setItemVisual(e,"color",r);else{var s=i.getItemModel(e).get("itemStyle.color")||t.getColorFromPalette(i.getName(e)||e+"",t.__paletteScope,i.count());i.setItemVisual(e,"color",s),null!=a&&o.setItemVisual(a,"color",s)}})}}},hC=function(t,e,i,n){var o,a,r=t.getData(),s=[],l=!1;r.each(function(i){var n,u,h,c,d=r.getItemLayout(i),f=r.getItemModel(i),p=f.getModel("label"),g=p.get("position")||f.get("emphasis.label.position"),m=f.getModel("labelLine"),v=m.get("length"),y=m.get("length2"),x=(d.startAngle+d.endAngle)/2,_=Math.cos(x),w=Math.sin(x);o=d.cx,a=d.cy;var b="inside"===g||"inner"===g;if("center"===g)n=d.cx,u=d.cy,c="center";else{var S=(b?(d.r+d.r0)/2*_:d.r*_)+o,M=(b?(d.r+d.r0)/2*w:d.r*w)+a;if(n=S+3*_,u=M+3*w,!b){var I=S+_*(v+e-d.r),T=M+w*(v+e-d.r),A=I+(_<0?-1:1)*y,D=T;n=A+(_<0?-5:5),u=D,h=[[S,M],[I,T],[A,D]]}c=b?"center":_>0?"left":"right"}var C=p.getFont(),L=p.get("rotate")?_<0?-x+Math.PI:-x:0,k=ke(t.getFormattedLabel(i,"normal")||r.getName(i),C,c,"top");l=!!L,d.label={x:n,y:u,position:g,height:k.height,len:v,len2:y,linePoints:h,textAlign:c,verticalAlign:"middle",rotation:L,inside:b},b||s.push(d.label)}),!l&&t.get("avoidLabelOverlap")&&Hh(s,o,a,e,i,n)},cC=2*Math.PI,dC=Math.PI/180,fC=function(t){return{seriesType:t,reset:function(t,e){var i=e.findComponents({mainType:"legend"});if(i&&i.length){var n=t.getData();n.filterSelf(function(t){for(var e=n.getName(t),o=0;o=0;s--){var l=2*s,u=n[l]-a/2,h=n[l+1]-r/2;if(t>=u&&e>=h&&t<=u+a&&e<=h+r)return s}return-1}}),gC=Uh.prototype;gC.isPersistent=function(){return!this._incremental},gC.updateData=function(t){this.group.removeAll();var e=new pC({rectHover:!0,cursor:"default"});e.setShape({points:t.getLayout("symbolPoints")}),this._setCommon(e,t),this.group.add(e),this._incremental=null},gC.updateLayout=function(t){if(!this._incremental){var e=t.getLayout("symbolPoints");this.group.eachChild(function(t){if(null!=t.startIndex){var i=2*(t.endIndex-t.startIndex),n=4*t.startIndex*2;e=new Float32Array(e.buffer,n,i)}t.setShape("points",e)})}},gC.incrementalPrepareUpdate=function(t){this.group.removeAll(),this._clearIncremental(),t.count()>2e6?(this._incremental||(this._incremental=new Zn({silent:!0})),this.group.add(this._incremental)):this._incremental=null},gC.incrementalUpdate=function(t,e){var i;this._incremental?(i=new pC,this._incremental.addDisplayable(i,!0)):((i=new pC({rectHover:!0,cursor:"default",startIndex:t.start,endIndex:t.end})).incremental=!0,this.group.add(i)),i.setShape({points:e.getLayout("symbolPoints")}),this._setCommon(i,e,!!this._incremental)},gC._setCommon=function(t,e,i){var n=e.hostModel,o=e.getVisual("symbolSize");t.setShape("size",o instanceof Array?o:[o,o]),t.symbolProxy=Jl(e.getVisual("symbol"),0,0,0,0),t.setColor=t.symbolProxy.setColor;var a=t.shape.size[0]<4;t.useStyle(n.getModel("itemStyle").getItemStyle(a?["color","shadowBlur","shadowColor"]:["color"]));var r=e.getVisual("color");r&&t.setColor(r),i||(t.seriesIndex=n.seriesIndex,t.on("mousemove",function(e){t.dataIndex=null;var i=t.findDataIndex(e.offsetX,e.offsetY);i>=0&&(t.dataIndex=i+(t.startIndex||0))}))},gC.remove=function(){this._clearIncremental(),this._incremental=null,this.group.removeAll()},gC._clearIncremental=function(){var t=this._incremental;t&&t.clearDisplaybles()},Zs({type:"scatter",render:function(t,e,i){var n=t.getData();this._updateSymbolDraw(n,t).updateData(n),this._finished=!0},incrementalPrepareRender:function(t,e,i){var n=t.getData();this._updateSymbolDraw(n,t).incrementalPrepareUpdate(n),this._finished=!1},incrementalRender:function(t,e,i){this._symbolDraw.incrementalUpdate(t,e.getData()),this._finished=t.end===e.getData().count()},updateTransform:function(t,e,i){var n=t.getData();if(this.group.dirty(),!this._finished||n.count()>1e4||!this._symbolDraw.isPersistent())return{update:!0};var o=AD().reset(t);o.progress&&o.progress({start:0,end:n.count()},n),this._symbolDraw.updateLayout(n)},_updateSymbolDraw:function(t,e){var i=this._symbolDraw,n=e.pipelineContext.large;return i&&n===this._isLargeDraw||(i&&i.remove(),i=this._symbolDraw=n?new Uh:new Du,this._isLargeDraw=n,this.group.removeAll()),this.group.add(i.group),i},remove:function(t,e){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},dispose:function(){}}),Bs(TD("scatter","circle")),zs(AD("scatter")),u(Xh,aD),jh.prototype.getIndicatorAxes=function(){return this._indicatorAxes},jh.prototype.dataToPoint=function(t,e){var i=this._indicatorAxes[e];return this.coordToPoint(i.dataToCoord(t),e)},jh.prototype.coordToPoint=function(t,e){var i=this._indicatorAxes[e].angle;return[this.cx+t*Math.cos(i),this.cy-t*Math.sin(i)]},jh.prototype.pointToData=function(t){var e=t[0]-this.cx,i=t[1]-this.cy,n=Math.sqrt(e*e+i*i);e/=n,i/=n;for(var o,a=Math.atan2(-i,e),r=1/0,s=-1,l=0;ln[0]&&isFinite(c)&&isFinite(n[0]))}else{r.getTicks().length-1>a&&(u=i(u));var d=Math.round((n[0]+n[1])/2/u)*u,f=Math.round(a/2);r.setExtent(Go(d-f*u),Go(d+(a-f)*u)),r.setInterval(u)}})},jh.dimensions=[],jh.create=function(t,e){var i=[];return t.eachComponent("radar",function(n){var o=new jh(n,t,e);i.push(o),n.coordinateSystem=o}),t.eachSeriesByType("radar",function(t){"radar"===t.get("coordinateSystem")&&(t.coordinateSystem=i[t.get("radarIndex")||0])}),i},Fa.register("radar",jh);var mC=ND.valueAxis,vC=(Fs({type:"radar",optionUpdated:function(){var t=this.get("boundaryGap"),e=this.get("splitNumber"),o=this.get("scale"),s=this.get("axisLine"),l=this.get("axisTick"),u=this.get("axisLabel"),h=this.get("name"),c=this.get("name.show"),d=this.get("name.formatter"),p=this.get("nameGap"),g=this.get("triggerEvent"),m=f(this.get("indicator")||[],function(f){null!=f.max&&f.max>0&&!f.min?f.min=0:null!=f.min&&f.min<0&&!f.max&&(f.max=0);var m=h;if(null!=f.color&&(m=r({color:f.color},h)),f=n(i(f),{boundaryGap:t,splitNumber:e,scale:o,axisLine:s,axisTick:l,axisLabel:u,name:f.text,nameLocation:"end",nameGap:p,nameTextStyle:m,triggerEvent:g},!1),c||(f.name=""),"string"==typeof d){var v=f.name;f.name=d.replace("{value}",null!=v?v:"")}else"function"==typeof d&&(f.name=d(f.name,f));var y=a(new No(f,null,this.ecModel),UA);return y.mainType="radar",y.componentIndex=this.componentIndex,y},this);this.getIndicatorModels=function(){return m}},defaultOption:{zlevel:0,z:0,center:["50%","50%"],radius:"75%",startAngle:90,name:{show:!0},boundaryGap:[0,0],splitNumber:5,nameGap:15,scale:!1,shape:"polygon",axisLine:n({lineStyle:{color:"#bbb"}},mC.axisLine),axisLabel:Yh(mC.axisLabel,!1),axisTick:Yh(mC.axisTick,!1),splitLine:Yh(mC.splitLine,!0),splitArea:Yh(mC.splitArea,!0),indicator:[]}}),["axisLine","axisTickLabel","axisName"]);Ws({type:"radar",render:function(t,e,i){this.group.removeAll(),this._buildAxes(t),this._buildSplitLineAndArea(t)},_buildAxes:function(t){var e=t.coordinateSystem;d(f(e.getIndicatorAxes(),function(t){return new FD(t.model,{position:[e.cx,e.cy],rotation:t.angle,labelDirection:-1,tickDirection:-1,nameDirection:1})}),function(t){d(vC,t.add,t),this.group.add(t.getGroup())},this)},_buildSplitLineAndArea:function(t){function e(t,e,i){var n=i%e.length;return t[n]=t[n]||[],n}var i=t.coordinateSystem,n=i.getIndicatorAxes();if(n.length){var o=t.get("shape"),a=t.getModel("splitLine"),s=t.getModel("splitArea"),l=a.getModel("lineStyle"),u=s.getModel("areaStyle"),h=a.get("show"),c=s.get("show"),p=l.get("color"),g=u.get("color");p=y(p)?p:[p],g=y(g)?g:[g];var m=[],v=[];if("circle"===o)for(var x=n[0].getTicksCoords(),_=i.cx,w=i.cy,b=0;b"+f(i,function(i,n){var o=e.get(e.mapDimension(i.dim),t);return ia(i.name+" : "+o)}).join("
")},defaultOption:{zlevel:0,z:2,coordinateSystem:"radar",legendHoverLink:!0,radarIndex:0,lineStyle:{width:2,type:"solid"},label:{position:"top"},symbol:"emptyCircle",symbolSize:4}});Zs({type:"radar",render:function(t,e,n){function o(t,e){var i=t.getItemVisual(e,"symbol")||"circle",n=t.getItemVisual(e,"color");if("none"!==i){var o=qh(t.getItemVisual(e,"symbolSize")),a=Jl(i,-1,-1,2,2,n);return a.attr({style:{strokeNoScale:!0},z2:100,scale:[o[0]/2,o[1]/2]}),a}}function a(e,i,n,a,r,s){n.removeAll();for(var l=0;l"+ia(n+" : "+i)},getTooltipPosition:function(t){if(null!=t){var e=this.getData().getName(t),i=this.coordinateSystem,n=i.getRegion(e);return n&&i.dataToPoint(n.center)}},setZoom:function(t){this.option.zoom=t},setCenter:function(t){this.option.center=t},defaultOption:{zlevel:0,z:2,coordinateSystem:"geo",map:"",left:"center",top:"center",aspectScale:.75,showLegendSymbol:!0,dataRangeHoverLink:!0,boundingCoords:null,center:null,zoom:1,scaleLimit:null,label:{show:!1,color:"#000"},itemStyle:{borderWidth:.5,borderColor:"#444",areaColor:"#eee"},emphasis:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{areaColor:"rgba(255,215,0,0.8)"}}}}),aC);var EC="\0_ec_interaction_mutex";Es({type:"takeGlobalCursor",event:"globalCursorTaken",update:"update"},function(){}),h(oc,fw);var RC={axisPointer:1,tooltip:1,brush:1};xc.prototype={constructor:xc,draw:function(t,e,i,n,o){var a="geo"===t.mainType,r=t.getData&&t.getData();a&&e.eachComponent({mainType:"series",subType:"map"},function(e){r||e.getHostGeoModel()!==t||(r=e.getData())});var s=t.coordinateSystem;this._updateBackground(s);var l=this._regionsGroup,u=this.group,h=s.scale,c={position:s.position,scale:h};!l.childAt(0)||o?u.attr(c):Io(u,c,t),l.removeAll();var f=["itemStyle"],p=["emphasis","itemStyle"],g=["label"],m=["emphasis","label"],v=R();d(s.regions,function(e){var i=v.get(e.name)||v.set(e.name,new tb),n=new MM({shape:{paths:[]}});i.add(n);var o,s=(C=t.getRegionModel(e.name)||t).getModel(f),u=C.getModel(p),c=mc(s),y=mc(u),x=C.getModel(g),_=C.getModel(m);if(r){o=r.indexOfName(e.name);var w=r.getItemVisual(o,"color",!0);w&&(c.fill=w)}d(e.geometries,function(t){if("polygon"===t.type){n.shape.paths.push(new pM({shape:{points:t.exterior}}));for(var e=0;e<(t.interiors?t.interiors.length:0);e++)n.shape.paths.push(new pM({shape:{points:t.interiors[e]}}))}}),n.setStyle(c),n.style.strokeNoScale=!0,n.culling=!0;var b=x.get("show"),S=_.get("show"),M=r&&isNaN(r.get(r.mapDimension("value"),o)),I=r&&r.getItemLayout(o);if(a||M&&(b||S)||I&&I.showLabel){var T,A=a?e.name:o;(!r||o>=0)&&(T=t);var D=new rM({position:e.center.slice(),scale:[1/h[0],1/h[1]],z2:10,silent:!0});go(D.style,D.hoverStyle={},x,_,{labelFetcher:T,labelDataIndex:A,defaultText:e.name,useInsideStyle:!1},{textAlign:"center",textVerticalAlign:"middle"}),i.add(D)}if(r)r.setItemGraphicEl(o,i);else{var C=t.getRegionModel(e.name);n.eventData={componentType:"geo",componentIndex:t.componentIndex,geoIndex:t.componentIndex,name:e.name,region:C&&C.option||{}}}(i.__regions||(i.__regions=[])).push(e),fo(i,y,{hoverSilentOnTouch:!!t.get("selectedMode")}),l.add(i)}),this._updateController(t,e,i),vc(this,t,l,i,n),yc(t,l)},remove:function(){this._regionsGroup.removeAll(),this._backgroundGroup.removeAll(),this._controller.dispose(),this._mapName&&OC.removeGraphic(this._mapName,this.uid),this._mapName=null,this._controllerHost={}},_updateBackground:function(t){var e=t.map;this._mapName!==e&&d(OC.makeGraphic(e,this.uid),function(t){this._backgroundGroup.add(t)},this),this._mapName=e},_updateController:function(t,e,i){function n(){var e={type:"geoRoam",componentType:l};return e[l+"Id"]=t.id,e}var o=t.coordinateSystem,r=this._controller,s=this._controllerHost;s.zoomLimit=t.get("scaleLimit"),s.zoom=o.getZoom(),r.enable(t.get("roam")||!1);var l=t.mainType;r.off("pan").on("pan",function(t){this._mouseDownFlag=!1,fc(s,t.dx,t.dy),i.dispatchAction(a(n(),{dx:t.dx,dy:t.dy}))},this),r.off("zoom").on("zoom",function(t){if(this._mouseDownFlag=!1,pc(s,t.scale,t.originX,t.originY),i.dispatchAction(a(n(),{zoom:t.scale,originX:t.originX,originY:t.originY})),this._updateGroup){var e=this.group.scale;this._regionsGroup.traverse(function(t){"text"===t.type&&t.attr("scale",[1/e[0],1/e[1]])})}},this),r.setPointerChecker(function(e,n,a){return o.getViewRectAfterRoam().contain(n,a)&&!gc(e,i,t)})}};var zC="__seriesMapHighDown",BC="__seriesMapCallKey";Zs({type:"map",render:function(t,e,i,n){if(!n||"mapToggleSelect"!==n.type||n.from!==this.uid){var o=this.group;if(o.removeAll(),!t.getHostGeoModel()){if(n&&"geoRoam"===n.type&&"series"===n.componentType&&n.seriesId===t.id)(a=this._mapDraw)&&o.add(a.group);else if(t.needsDrawMap){var a=this._mapDraw||new xc(i,!0);o.add(a.group),a.draw(t,e,i,this,n),this._mapDraw=a}else this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null;t.get("showLegendSymbol")&&e.getComponent("legend")&&this._renderSymbols(t,e,i)}}},remove:function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null,this.group.removeAll()},dispose:function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null},_renderSymbols:function(t,e,i){var n=t.originalData,o=this.group;n.each(n.mapDimension("value"),function(e,i){if(!isNaN(e)){var r=n.getItemLayout(i);if(r&&r.point){var s=r.point,l=r.offset,u=new sM({style:{fill:t.getData().getVisual("color")},shape:{cx:s[0]+9*l,cy:s[1],r:3},silent:!0,z2:8+(l?0:NM+1)});if(!l){var h=t.mainSeries.getData(),c=n.getName(i),d=h.indexOfName(c),f=n.getItemModel(i),p=f.getModel("label"),g=f.getModel("emphasis.label"),m=h.getItemGraphicEl(d),y=A(t.getFormattedLabel(d,"normal"),c),x=A(t.getFormattedLabel(d,"emphasis"),y),_=m[zC],w=Math.random();if(!_){_=m[zC]={};var b=v(_c,!0),S=v(_c,!1);m.on("mouseover",b).on("mouseout",S).on("emphasis",b).on("normal",S)}m[BC]=w,a(_,{recordVersion:w,circle:u,labelModel:p,hoverLabelModel:g,emphasisText:x,normalText:y}),wc(_,!1)}o.add(u)}}})}}),Es({type:"geoRoam",event:"geoRoam",update:"updateTransform"},function(t,e){var i=t.componentType||"series";e.eachComponent({mainType:i,query:t},function(e){var n=e.coordinateSystem;if("geo"===n.type){var o=bc(n,t,e.get("scaleLimit"));e.setCenter&&e.setCenter(o.center),e.setZoom&&e.setZoom(o.zoom),"series"===i&&d(e.seriesGroup,function(t){t.setCenter(o.center),t.setZoom(o.zoom)})}})});var VC=Q;h(Sc,Tw),Mc.prototype={constructor:Mc,type:"view",dimensions:["x","y"],setBoundingRect:function(t,e,i,n){return this._rect=new de(t,e,i,n),this._rect},getBoundingRect:function(){return this._rect},setViewRect:function(t,e,i,n){this.transformTo(t,e,i,n),this._viewRect=new de(t,e,i,n)},transformTo:function(t,e,i,n){var o=this.getBoundingRect(),a=this._rawTransformable;a.transform=o.calculateTransform(new de(t,e,i,n)),a.decomposeTransform(),this._updateTransform()},setCenter:function(t){t&&(this._center=t,this._updateCenterAndZoom())},setZoom:function(t){t=t||1;var e=this.zoomLimit;e&&(null!=e.max&&(t=Math.min(e.max,t)),null!=e.min&&(t=Math.max(e.min,t))),this._zoom=t,this._updateCenterAndZoom()},getDefaultCenter:function(){var t=this.getBoundingRect();return[t.x+t.width/2,t.y+t.height/2]},getCenter:function(){return this._center||this.getDefaultCenter()},getZoom:function(){return this._zoom||1},getRoamTransform:function(){return this._roamTransformable.getLocalTransform()},_updateCenterAndZoom:function(){var t=this._rawTransformable.getLocalTransform(),e=this._roamTransformable,i=this.getDefaultCenter(),n=this.getCenter(),o=this.getZoom();n=Q([],n,t),i=Q([],i,t),e.origin=n,e.position=[i[0]-n[0],i[1]-n[1]],e.scale=[o,o],this._updateTransform()},_updateTransform:function(){var t=this._roamTransformable,e=this._rawTransformable;e.parent=t,t.updateTransform(),e.updateTransform(),wt(this.transform||(this.transform=[]),e.transform||xt()),this._rawTransform=e.getLocalTransform(),this.invTransform=this.invTransform||[],Tt(this.invTransform,this.transform),this.decomposeTransform()},getViewRect:function(){return this._viewRect},getViewRectAfterRoam:function(){var t=this.getBoundingRect().clone();return t.applyTransform(this.transform),t},dataToPoint:function(t,e,i){var n=e?this._rawTransform:this.transform;return i=i||[],n?VC(i,t,n):G(i,t)},pointToData:function(t){var e=this.invTransform;return e?VC([],t,e):[t[0],t[1]]},convertToPixel:v(Ic,"dataToPoint"),convertFromPixel:v(Ic,"pointToData"),containPoint:function(t){return this.getViewRectAfterRoam().contain(t[0],t[1])}},h(Mc,Tw),Tc.prototype={constructor:Tc,type:"geo",dimensions:["lng","lat"],containCoord:function(t){for(var e=this.regions,i=0;ie&&(e=n.height)}this.height=e+1},getNodeById:function(t){if(this.getId()===t)return this;for(var e=0,i=this.children,n=i.length;e=0&&this.hostTree.data.setItemLayout(this.dataIndex,t,e)},getLayout:function(){return this.hostTree.data.getItemLayout(this.dataIndex)},getModel:function(t){if(!(this.dataIndex<0)){var e,i=this.hostTree,n=i.data.getItemModel(this.dataIndex),o=this.getLevelModel();return o||0!==this.children.length&&(0===this.children.length||!1!==this.isExpand)||(e=this.getLeavesModel()),n.getModel(t,(o||e||i.hostModel).getModel(t))}},getLevelModel:function(){return(this.hostTree.levelModels||[])[this.depth]},getLeavesModel:function(){return this.hostTree.leavesModel},setVisual:function(t,e){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,t,e)},getVisual:function(t,e){return this.hostTree.data.getItemVisual(this.dataIndex,t,e)},getRawIndex:function(){return this.hostTree.data.getRawIndex(this.dataIndex)},getId:function(){return this.hostTree.data.getId(this.dataIndex)},isAncestorOf:function(t){for(var e=t.parentNode;e;){if(e===this)return!0;e=e.parentNode}return!1},isDescendantOf:function(t){return t!==this&&t.isAncestorOf(this)}},Vc.prototype={constructor:Vc,type:"tree",eachNode:function(t,e,i){this.root.eachNode(t,e,i)},getNodeByDataIndex:function(t){var e=this.data.getRawIndex(t);return this._nodes[e]},getNodeByName:function(t){return this.root.getNodeByName(t)},update:function(){for(var t=this.data,e=this._nodes,i=0,n=e.length;ia&&(a=t.depth)});var r=t.expandAndCollapse&&t.initialTreeDepth>=0?t.initialTreeDepth:a;return o.root.eachNode("preorder",function(t){var e=t.hostTree.data.getRawDataItem(t.dataIndex);t.isExpand=e&&null!=e.collapsed?!e.collapsed:t.depth<=r}),o.data},getOrient:function(){var t=this.get("orient");return"horizontal"===t?t="LR":"vertical"===t&&(t="TB"),t},setZoom:function(t){this.option.zoom=t},setCenter:function(t){this.option.center=t},formatTooltip:function(t){for(var e=this.getData().tree,i=e.root.children[0],n=e.getNodeByDataIndex(t),o=n.getValue(),a=n.name;n&&n!==i;)a=n.parentNode.name+"."+a,n=n.parentNode;return ia(a+(isNaN(o)||null==o?"":" : "+o))},defaultOption:{zlevel:0,z:2,coordinateSystem:"view",left:"12%",top:"12%",right:"12%",bottom:"12%",layout:"orthogonal",roam:!1,nodeScaleRatio:.4,center:null,zoom:1,orient:"LR",symbol:"emptyCircle",symbolSize:7,expandAndCollapse:!0,initialTreeDepth:2,lineStyle:{color:"#ccc",width:1.5,curveness:.5},itemStyle:{color:"lightsteelblue",borderColor:"#c23531",borderWidth:1.5},label:{show:!0,color:"#555"},leaves:{label:{show:!0}},animationEasing:"linear",animationDuration:700,animationDurationUpdate:1e3}}),Zs({type:"tree",init:function(t,e){this._oldTree,this._mainGroup=new tb,this._controller=new oc(e.getZr()),this._controllerHost={target:this.group},this.group.add(this._mainGroup)},render:function(t,e,i,n){var o=t.getData(),a=t.layoutInfo,r=this._mainGroup,s=t.get("layout");"radial"===s?r.attr("position",[a.x+a.width/2,a.y+a.height/2]):r.attr("position",[a.x,a.y]),this._updateViewCoordSys(t),this._updateController(t,e,i);var l=this._data,u={expandAndCollapse:t.get("expandAndCollapse"),layout:s,orient:t.getOrient(),curvature:t.get("lineStyle.curveness"),symbolRotate:t.get("symbolRotate"),symbolOffset:t.get("symbolOffset"),hoverAnimation:t.get("hoverAnimation"),useNameLabel:!0,fadeIn:!0};o.diff(l).add(function(e){td(o,e)&&id(o,e,null,r,t,u)}).update(function(e,i){var n=l.getItemGraphicEl(i);td(o,e)?id(o,e,n,r,t,u):n&&nd(l,i,n,r,t,u)}).remove(function(e){var i=l.getItemGraphicEl(e);i&&nd(l,e,i,r,t,u)}).execute(),this._nodeScaleRatio=t.get("nodeScaleRatio"),this._updateNodeAndLinkScale(t),!0===u.expandAndCollapse&&o.eachItemGraphicEl(function(e,n){e.off("click").on("click",function(){i.dispatchAction({type:"treeExpandAndCollapse",seriesId:t.id,dataIndex:n})})}),this._data=o},_updateViewCoordSys:function(t){var e=t.getData(),i=[];e.each(function(t){var n=e.getItemLayout(t);!n||isNaN(n.x)||isNaN(n.y)||i.push([+n.x,+n.y])});var n=[],o=[];fn(i,n,o),o[0]-n[0]==0&&(o[0]+=1,n[0]-=1),o[1]-n[1]==0&&(o[1]+=1,n[1]-=1);var a=t.coordinateSystem=new Mc;a.zoomLimit=t.get("scaleLimit"),a.setBoundingRect(n[0],n[1],o[0]-n[0],o[1]-n[1]),a.setCenter(t.get("center")),a.setZoom(t.get("zoom")),this.group.attr({position:a.position,scale:a.scale}),this._viewCoordSys=a},_updateController:function(t,e,i){var n=this._controller,o=this._controllerHost,a=this.group;n.setPointerChecker(function(e,n,o){var r=a.getBoundingRect();return r.applyTransform(a.transform),r.contain(n,o)&&!gc(e,i,t)}),n.enable(t.get("roam")),o.zoomLimit=t.get("scaleLimit"),o.zoom=t.coordinateSystem.getZoom(),n.off("pan").off("zoom").on("pan",function(e){fc(o,e.dx,e.dy),i.dispatchAction({seriesId:t.id,type:"treeRoam",dx:e.dx,dy:e.dy})},this).on("zoom",function(e){pc(o,e.scale,e.originX,e.originY),i.dispatchAction({seriesId:t.id,type:"treeRoam",zoom:e.scale,originX:e.originX,originY:e.originY}),this._updateNodeAndLinkScale(t)},this)},_updateNodeAndLinkScale:function(t){var e=t.getData(),i=this._getNodeGlobalScale(t),n=[i,i];e.eachItemGraphicEl(function(t,e){t.attr("scale",n)})},_getNodeGlobalScale:function(t){var e=t.coordinateSystem;if("view"!==e.type)return 1;var i=this._nodeScaleRatio,n=e.scale,o=n&&n[0]||1;return((e.getZoom()-1)*i+1)/o},dispose:function(){this._controller&&this._controller.dispose(),this._controllerHost={}},remove:function(){this._mainGroup.removeAll(),this._data=null}}),Es({type:"treeExpandAndCollapse",event:"treeExpandAndCollapse",update:"update"},function(t,e){e.eachComponent({mainType:"series",subType:"tree",query:t},function(e){var i=t.dataIndex,n=e.getData().tree.getNodeByDataIndex(i);n.isExpand=!n.isExpand})}),Es({type:"treeRoam",event:"treeRoam",update:"none"},function(t,e){e.eachComponent({mainType:"series",subType:"tree",query:t},function(e){var i=bc(e.coordinateSystem,t);e.setCenter&&e.setCenter(i.center),e.setZoom&&e.setZoom(i.zoom)})});Bs(TD("tree","circle")),zs(function(t,e){t.eachSeriesByType("tree",function(t){sd(t,e)})}),YI.extend({type:"series.treemap",layoutMode:"box",dependencies:["grid","polar"],_viewRoot:null,defaultOption:{progressive:0,hoverLayerThreshold:1/0,left:"center",top:"middle",right:null,bottom:null,width:"80%",height:"80%",sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"▶",zoomToNodeRatio:.1024,roam:!0,nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",top:"bottom",emptyItemWidth:25,itemStyle:{color:"rgba(0,0,0,0.7)",borderColor:"rgba(255,255,255,0.7)",borderWidth:1,shadowColor:"rgba(150,150,150,1)",shadowBlur:3,shadowOffsetX:0,shadowOffsetY:0,textStyle:{color:"#fff"}},emphasis:{textStyle:{}}},label:{show:!0,distance:0,padding:5,position:"inside",color:"#fff",ellipsis:!0},upperLabel:{show:!1,position:[0,"50%"],height:20,color:"#fff",ellipsis:!0,verticalAlign:"middle"},itemStyle:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:"#fff",borderColorSaturation:null},emphasis:{upperLabel:{show:!0,position:[0,"50%"],color:"#fff",ellipsis:!0,verticalAlign:"middle"}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:"index",visibleMin:10,childrenVisibleMin:null,levels:[]},getInitialData:function(t,e){var i={name:t.name,children:t.data};dd(i);var n=t.levels||[];n=t.levels=fd(n,e);var o={};return o.levels=n,Vc.createTree(i,this,o).data},optionUpdated:function(){this.resetViewRoot()},formatTooltip:function(t){var e=this.getData(),i=this.getRawValue(t),n=ta(y(i)?i[0]:i);return ia(e.getName(t)+": "+n)},getDataParams:function(t){var e=YI.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(t);return e.treePathInfo=cd(i,this),e},setLayoutInfo:function(t){this.layoutInfo=this.layoutInfo||{},a(this.layoutInfo,t)},mapIdToIndex:function(t){var e=this._idIndexMap;e||(e=this._idIndexMap=R(),this._idIndexMapCount=0);var i=e.get(t);return null==i&&e.set(t,i=this._idIndexMapCount++),i},getViewRoot:function(){return this._viewRoot},resetViewRoot:function(t){t?this._viewRoot=t:t=this._viewRoot;var e=this.getRawData().tree.root;t&&(t===e||e.contains(t))||(this._viewRoot=e)}});var UC=5;pd.prototype={constructor:pd,render:function(t,e,i,n){var o=t.getModel("breadcrumb"),a=this.group;if(a.removeAll(),o.get("show")&&i){var r=o.getModel("itemStyle"),s=r.getModel("textStyle"),l={pos:{left:o.get("left"),right:o.get("right"),top:o.get("top"),bottom:o.get("bottom")},box:{width:e.getWidth(),height:e.getHeight()},emptyItemWidth:o.get("emptyItemWidth"),totalWidth:0,renderList:[]};this._prepare(i,l,s),this._renderContent(t,l,r,s,n),da(a,l.pos,l.box)}},_prepare:function(t,e,i){for(var n=t;n;n=n.parentNode){var o=n.getModel().get("name"),a=i.getTextRect(o),r=Math.max(a.width+16,e.emptyItemWidth);e.totalWidth+=r+8,e.renderList.push({node:n,text:o,width:r})}},_renderContent:function(t,e,i,n,o){for(var a=0,s=e.emptyItemWidth,l=t.get("breadcrumb.height"),u=ha(e.pos,e.box),h=e.totalWidth,c=e.renderList,d=c.length-1;d>=0;d--){var f=c[d],p=f.node,g=f.width,m=f.text;h>u.width&&(h-=g-s,g=s,m=null);var y=new pM({shape:{points:gd(a,0,g,l,d===c.length-1,0===d)},style:r(i.getItemStyle(),{lineJoin:"bevel",text:m,textFill:n.getTextColor(),textFont:n.getFont()}),z:10,onclick:v(o,p)});this.group.add(y),md(y,t,p),a+=g+8}},remove:function(){this.group.removeAll()}};var XC=m,jC=tb,YC=yM,qC=d,KC=["label"],$C=["emphasis","label"],JC=["upperLabel"],QC=["emphasis","upperLabel"],tL=10,eL=1,iL=2,nL=Qb([["fill","color"],["stroke","strokeColor"],["lineWidth","strokeWidth"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]),oL=function(t){var e=nL(t);return e.stroke=e.fill=e.lineWidth=null,e};Zs({type:"treemap",init:function(t,e){this._containerGroup,this._storage={nodeGroup:[],background:[],content:[]},this._oldTree,this._breadcrumb,this._controller,this._state="ready"},render:function(t,e,i,n){if(!(l(e.findComponents({mainType:"series",subType:"treemap",query:n}),t)<0)){this.seriesModel=t,this.api=i,this.ecModel=e;var o=ld(n,["treemapZoomToNode","treemapRootToNode"],t),a=n&&n.type,r=t.layoutInfo,s=!this._oldTree,u=this._storage,h="treemapRootToNode"===a&&o&&u?{rootNodeGroup:u.nodeGroup[o.node.getRawIndex()],direction:n.direction}:null,c=this._giveContainerGroup(r),d=this._doRender(c,t,h);s||a&&"treemapZoomToNode"!==a&&"treemapRootToNode"!==a?d.renderFinally():this._doAnimation(c,d,t,h),this._resetController(i),this._renderBreadcrumb(t,i,o)}},_giveContainerGroup:function(t){var e=this._containerGroup;return e||(e=this._containerGroup=new jC,this._initEvents(e),this.group.add(e)),e.attr("position",[t.x,t.y]),e},_doRender:function(t,e,i){function n(t,e,i,o,a){function r(t){return t.getId()}function s(r,s){var l=null!=r?t[r]:null,u=null!=s?e[s]:null,c=h(l,u,i,a);c&&n(l&&l.viewChildren||[],u&&u.viewChildren||[],c,o,a+1)}o?(e=t,qC(t,function(t,e){!t.isRemoved()&&s(e,e)})):new Xs(e,t,r,r).add(s).update(s).remove(v(s,null)).execute()}var o=e.getData().tree,a=this._oldTree,r={nodeGroup:[],background:[],content:[]},s={nodeGroup:[],background:[],content:[]},l=this._storage,u=[],h=v(yd,e,s,l,i,r,u);n(o.root?[o.root]:[],a&&a.root?[a.root]:[],t,o===a||!a,0);var c=function(t){var e={nodeGroup:[],background:[],content:[]};return t&&qC(t,function(t,i){var n=e[i];qC(t,function(t){t&&(n.push(t),t.__tmWillDelete=1)})}),e}(l);return this._oldTree=o,this._storage=s,{lastsForAnimation:r,willDeleteEls:c,renderFinally:function(){qC(c,function(t){qC(t,function(t){t.parent&&t.parent.remove(t)})}),qC(u,function(t){t.invisible=!0,t.dirty()})}}},_doAnimation:function(t,e,i,n){if(i.get("animation")){var o=i.get("animationDurationUpdate"),r=i.get("animationEasing"),s=vd();qC(e.willDeleteEls,function(t,e){qC(t,function(t,i){if(!t.invisible){var a,l=t.parent;if(n&&"drillDown"===n.direction)a=l===n.rootNodeGroup?{shape:{x:0,y:0,width:l.__tmNodeWidth,height:l.__tmNodeHeight},style:{opacity:0}}:{style:{opacity:0}};else{var u=0,h=0;l.__tmWillDelete||(u=l.__tmNodeWidth/2,h=l.__tmNodeHeight/2),a="nodeGroup"===e?{position:[u,h],style:{opacity:0}}:{shape:{x:u,y:h,width:0,height:0},style:{opacity:0}}}a&&s.add(t,a,o,r)}})}),qC(this._storage,function(t,i){qC(t,function(t,n){var l=e.lastsForAnimation[i][n],u={};l&&("nodeGroup"===i?l.old&&(u.position=t.position.slice(),t.attr("position",l.old)):(l.old&&(u.shape=a({},t.shape),t.setShape(l.old)),l.fadein?(t.setStyle("opacity",0),u.style={opacity:1}):1!==t.style.opacity&&(u.style={opacity:1})),s.add(t,u,o,r))})},this),this._state="animating",s.done(XC(function(){this._state="ready",e.renderFinally()},this)).start()}},_resetController:function(t){var e=this._controller;e||((e=this._controller=new oc(t.getZr())).enable(this.seriesModel.get("roam")),e.on("pan",XC(this._onPan,this)),e.on("zoom",XC(this._onZoom,this)));var i=new de(0,0,t.getWidth(),t.getHeight());e.setPointerChecker(function(t,e,n){return i.contain(e,n)})},_clearController:function(){var t=this._controller;t&&(t.dispose(),t=null)},_onPan:function(t){if("animating"!==this._state&&(Math.abs(t.dx)>3||Math.abs(t.dy)>3)){var e=this.seriesModel.getData().tree.root;if(!e)return;var i=e.getLayout();if(!i)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:i.x+t.dx,y:i.y+t.dy,width:i.width,height:i.height}})}},_onZoom:function(t){var e=t.originX,i=t.originY;if("animating"!==this._state){var n=this.seriesModel.getData().tree.root;if(!n)return;var o=n.getLayout();if(!o)return;var a=new de(o.x,o.y,o.width,o.height),r=this.seriesModel.layoutInfo;e-=r.x,i-=r.y;var s=xt();St(s,s,[-e,-i]),It(s,s,[t.scale,t.scale]),St(s,s,[e,i]),a.applyTransform(s),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:a.x,y:a.y,width:a.width,height:a.height}})}},_initEvents:function(t){t.on("click",function(t){if("ready"===this._state){var e=this.seriesModel.get("nodeClick",!0);if(e){var i=this.findTarget(t.offsetX,t.offsetY);if(i){var n=i.node;if(n.getLayout().isLeafRoot)this._rootToNode(i);else if("zoomToNode"===e)this._zoomToNode(i);else if("link"===e){var o=n.hostTree.data.getItemModel(n.dataIndex),a=o.get("link",!0),r=o.get("target",!0)||"blank";a&&window.open(a,r)}}}}},this)},_renderBreadcrumb:function(t,e,i){i||(i=null!=t.get("leafDepth",!0)?{node:t.getViewRoot()}:this.findTarget(e.getWidth()/2,e.getHeight()/2))||(i={node:t.getData().tree.root}),(this._breadcrumb||(this._breadcrumb=new pd(this.group))).render(t,e,i.node,XC(function(e){"animating"!==this._state&&(hd(t.getViewRoot(),e)?this._rootToNode({node:e}):this._zoomToNode({node:e}))},this))},remove:function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage={nodeGroup:[],background:[],content:[]},this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},dispose:function(){this._clearController()},_zoomToNode:function(t){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},_rootToNode:function(t){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},findTarget:function(t,e){var i;return this.seriesModel.getViewRoot().eachNode({attr:"viewChildren",order:"preorder"},function(n){var o=this._storage.background[n.getRawIndex()];if(o){var a=o.transformCoordToLocal(t,e),r=o.shape;if(!(r.x<=a[0]&&a[0]<=r.x+r.width&&r.y<=a[1]&&a[1]<=r.y+r.height))return!1;i={node:n,offsetX:a[0],offsetY:a[1]}}},this),i}});for(var aL=["treemapZoomToNode","treemapRender","treemapMove"],rL=0;rL=0&&t.call(e,i[o],o)},TL.eachEdge=function(t,e){for(var i=this.edges,n=i.length,o=0;o=0&&i[o].node1.dataIndex>=0&&i[o].node2.dataIndex>=0&&t.call(e,i[o],o)},TL.breadthFirstTraverse=function(t,e,i,n){if(Jd.isInstance(e)||(e=this._nodesMap[$d(e)]),e){for(var o="out"===i?"outEdges":"in"===i?"inEdges":"edges",a=0;a=0&&i.node2.dataIndex>=0});for(var o=0,a=n.length;o=0&&this[t][e].setItemVisual(this.dataIndex,i,n)},getVisual:function(i,n){return this[t][e].getItemVisual(this.dataIndex,i,n)},setLayout:function(i,n){this.dataIndex>=0&&this[t][e].setItemLayout(this.dataIndex,i,n)},getLayout:function(){return this[t][e].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[t][e].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[t][e].getRawIndex(this.dataIndex)}}};h(Jd,AL("hostGraph","data")),h(Qd,AL("hostGraph","edgeData")),IL.Node=Jd,IL.Edge=Qd,Yi(Jd),Yi(Qd);var DL=function(t,e,i,n,o){for(var a=new IL(n),r=0;r "+f)),h++)}var p,g=i.get("coordinateSystem");if("cartesian2d"===g||"polar"===g)p=ml(t,i);else{var m=Fa.get(g),v=m&&"view"!==m.type?m.dimensions||[]:[];l(v,"value")<0&&v.concat(["value"]);var y=_A(t,{coordDimensions:v});(p=new vA(y,i)).initData(t)}var x=new vA(["value"],i);return x.initData(u,s),o&&o(p,x),kc({mainData:p,struct:a,structAttr:"graph",datas:{node:p,edge:x},datasAttr:{node:"data",edge:"edgeData"}}),a.update(),a},CL=Hs({type:"series.graph",init:function(t){CL.superApply(this,"init",arguments),this.legendDataProvider=function(){return this._categoriesData},this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},mergeOption:function(t){CL.superApply(this,"mergeOption",arguments),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},mergeDefaultAndTheme:function(t){CL.superApply(this,"mergeDefaultAndTheme",arguments),Ci(t,["edgeLabel"],["show"])},getInitialData:function(t,e){var i=t.edges||t.links||[],n=t.data||t.nodes||[],o=this;if(n&&i)return DL(n,i,this,!0,function(t,i){function n(t){return(t=this.parsePath(t))&&"label"===t[0]?r:t&&"emphasis"===t[0]&&"label"===t[1]?l:this.parentModel}t.wrapMethod("getItemModel",function(t){var e=o._categoriesModels[t.getShallow("category")];return e&&(e.parentModel=t.parentModel,t.parentModel=e),t});var a=o.getModel("edgeLabel"),r=new No({label:a.option},a.parentModel,e),s=o.getModel("emphasis.edgeLabel"),l=new No({emphasis:{label:s.option}},s.parentModel,e);i.wrapMethod("getItemModel",function(t){return t.customizeGetParent(n),t})}).data},getGraph:function(){return this.getData().graph},getEdgeData:function(){return this.getGraph().edgeData},getCategoriesData:function(){return this._categoriesData},formatTooltip:function(t,e,i){if("edge"===i){var n=this.getData(),o=this.getDataParams(t,i),a=n.graph.getEdgeByIndex(t),r=n.getName(a.node1.dataIndex),s=n.getName(a.node2.dataIndex),l=[];return null!=r&&l.push(r),null!=s&&l.push(s),l=ia(l.join(" > ")),o.value&&(l+=" : "+ia(o.value)),l}return CL.superApply(this,"formatTooltip",arguments)},_updateCategoriesData:function(){var t=f(this.option.categories||[],function(t){return null!=t.value?t:a({value:0},t)}),e=new vA(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray(function(t){return e.getItemModel(t,!0)})},setZoom:function(t){this.option.zoom=t},setCenter:function(t){this.option.center=t},isAnimationEnabled:function(){return CL.superCall(this,"isAnimationEnabled")&&!("force"===this.get("layout")&&this.get("force.layoutAnimation"))},defaultOption:{zlevel:0,z:2,coordinateSystem:"view",legendHoverLink:!0,hoverAnimation:!0,layout:null,focusNodeAdjacency:!1,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{position:"middle"},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:"{b}"},itemStyle:{},lineStyle:{color:"#aaa",width:1,curveness:0,opacity:.5},emphasis:{label:{show:!0}}}}),LL=_M.prototype,kL=bM.prototype,PL=Un({type:"ec-line",style:{stroke:"#000",fill:null},shape:{x1:0,y1:0,x2:0,y2:0,percent:1,cpx1:null,cpy1:null},buildPath:function(t,e){(tf(e)?LL:kL).buildPath(t,e)},pointAt:function(t){return tf(this.shape)?LL.pointAt.call(this,t):kL.pointAt.call(this,t)},tangentAt:function(t){var e=this.shape,i=tf(e)?[e.x2-e.x1,e.y2-e.y1]:kL.tangentAt.call(this,t);return q(i,i)}}),NL=["fromSymbol","toSymbol"],OL=rf.prototype;OL.beforeUpdate=function(){var t=this,e=t.childOfName("fromSymbol"),i=t.childOfName("toSymbol"),n=t.childOfName("label");if(e||i||!n.ignore){for(var o=1,a=this.parent;a;)a.scale&&(o/=a.scale[0]),a=a.parent;var r=t.childOfName("line");if(this.__dirty||r.__dirty){var s=r.shape.percent,l=r.pointAt(0),u=r.pointAt(s),h=U([],u,l);if(q(h,h),e&&(e.attr("position",l),c=r.tangentAt(0),e.attr("rotation",Math.PI/2-Math.atan2(c[1],c[0])),e.attr("scale",[o*s,o*s])),i){i.attr("position",u);var c=r.tangentAt(1);i.attr("rotation",-Math.PI/2-Math.atan2(c[1],c[0])),i.attr("scale",[o*s,o*s])}if(!n.ignore){n.attr("position",u);var d,f,p,g=5*o;if("end"===n.__position)d=[h[0]*g+u[0],h[1]*g+u[1]],f=h[0]>.8?"left":h[0]<-.8?"right":"center",p=h[1]>.8?"top":h[1]<-.8?"bottom":"middle";else if("middle"===n.__position){var m=s/2,v=[(c=r.tangentAt(m))[1],-c[0]],y=r.pointAt(m);v[1]>0&&(v[0]=-v[0],v[1]=-v[1]),d=[y[0]+v[0]*g,y[1]+v[1]*g],f="center",p="bottom";var x=-Math.atan2(c[1],c[0]);u[0].8?"right":h[0]<-.8?"left":"center",p=h[1]>.8?"bottom":h[1]<-.8?"top":"middle";n.attr({style:{textVerticalAlign:n.__verticalAlign||p,textAlign:n.__textAlign||f},position:d,scale:[o,o]})}}}},OL._createLine=function(t,e,i){var n=t.hostModel,o=of(t.getItemLayout(e));o.shape.percent=0,To(o,{shape:{percent:1}},n,e),this.add(o);var a=new rM({name:"label",lineLabelOriginalOpacity:1});this.add(a),d(NL,function(i){var n=nf(i,t,e);this.add(n),this[ef(i)]=t.getItemVisual(e,i)},this),this._updateCommonStl(t,e,i)},OL.updateData=function(t,e,i){var n=t.hostModel,o=this.childOfName("line"),a=t.getItemLayout(e),r={shape:{}};af(r.shape,a),Io(o,r,n,e),d(NL,function(i){var n=t.getItemVisual(e,i),o=ef(i);if(this[o]!==n){this.remove(this.childOfName(i));var a=nf(i,t,e);this.add(a)}this[o]=n},this),this._updateCommonStl(t,e,i)},OL._updateCommonStl=function(t,e,i){var n=t.hostModel,o=this.childOfName("line"),a=i&&i.lineStyle,s=i&&i.hoverLineStyle,l=i&&i.labelModel,u=i&&i.hoverLabelModel;if(!i||t.hasItemOption){var h=t.getItemModel(e);a=h.getModel("lineStyle").getLineStyle(),s=h.getModel("emphasis.lineStyle").getLineStyle(),l=h.getModel("label"),u=h.getModel("emphasis.label")}var c=t.getItemVisual(e,"color"),f=D(t.getItemVisual(e,"opacity"),a.opacity,1);o.useStyle(r({strokeNoScale:!0,fill:"none",stroke:c,opacity:f},a)),o.hoverStyle=s,d(NL,function(t){var e=this.childOfName(t);e&&(e.setColor(c),e.setStyle({opacity:f}))},this);var p,g,m=l.getShallow("show"),v=u.getShallow("show"),y=this.childOfName("label");if((m||v)&&(p=c||"#000",null==(g=n.getFormattedLabel(e,"normal",t.dataType)))){var x=n.getRawValue(e);g=null==x?t.getName(e):isFinite(x)?Go(x):x}var _=m?g:null,w=v?A(n.getFormattedLabel(e,"emphasis",t.dataType),g):null,b=y.style;null==_&&null==w||(mo(y.style,l,{text:_},{autoColor:p}),y.__textAlign=b.textAlign,y.__verticalAlign=b.textVerticalAlign,y.__position=l.get("position")||"middle"),y.hoverStyle=null!=w?{text:w,textFill:u.getTextColor(!0),fontStyle:u.getShallow("fontStyle"),fontWeight:u.getShallow("fontWeight"),fontSize:u.getShallow("fontSize"),fontFamily:u.getShallow("fontFamily")}:{text:null},y.ignore=!m&&!v,fo(this)},OL.highlight=function(){this.trigger("emphasis")},OL.downplay=function(){this.trigger("normal")},OL.updateLayout=function(t,e){this.setLinePoints(t.getItemLayout(e))},OL.setLinePoints=function(t){var e=this.childOfName("line");af(e.shape,t),e.dirty()},u(rf,tb);var EL=sf.prototype;EL.isPersistent=function(){return!0},EL.updateData=function(t){var e=this,i=e.group,n=e._lineData;e._lineData=t,n||i.removeAll();var o=hf(t);t.diff(n).add(function(i){lf(e,t,i,o)}).update(function(i,a){uf(e,n,t,a,i,o)}).remove(function(t){i.remove(n.getItemGraphicEl(t))}).execute()},EL.updateLayout=function(){var t=this._lineData;t&&t.eachItemGraphicEl(function(e,i){e.updateLayout(t,i)},this)},EL.incrementalPrepareUpdate=function(t){this._seriesScope=hf(t),this._lineData=null,this.group.removeAll()},EL.incrementalUpdate=function(t,e){for(var i=t.start;i=o/3?1:2),l=e.y-n(r)*a*(a>=o/3?1:2);r=e.angle-Math.PI/2,t.moveTo(s,l),t.lineTo(e.x+i(r)*a,e.y+n(r)*a),t.lineTo(e.x+i(e.angle)*o,e.y+n(e.angle)*o),t.lineTo(e.x-i(r)*a,e.y-n(r)*a),t.lineTo(s,l)}}),YL=2*Math.PI,qL=(Ar.extend({type:"gauge",render:function(t,e,i){this.group.removeAll();var n=t.get("axisLine.lineStyle.color"),o=Sf(t,i);this._renderMain(t,e,i,n,o)},dispose:function(){},_renderMain:function(t,e,i,n,o){for(var a=this.group,r=t.getModel("axisLine").getModel("lineStyle"),s=t.get("clockwise"),l=-t.get("startAngle")/180*Math.PI,u=-t.get("endAngle")/180*Math.PI,h=(u-l)%YL,c=l,d=r.get("width"),f=0;f=t&&(0===e?0:n[e-1][0]).4?"bottom":"middle",textAlign:A<-.4?"left":A>.4?"right":"center"},{autoColor:P}),silent:!0}))}if(g.get("show")&&T!==v){for(var N=0;N<=y;N++){var A=Math.cos(w),D=Math.sin(w),O=new _M({shape:{x1:A*c+u,y1:D*c+h,x2:A*(c-_)+u,y2:D*(c-_)+h},silent:!0,style:I});"auto"===I.stroke&&O.setStyle({stroke:n((T+N/y)/v)}),l.add(O),w+=S}w-=S}else w+=b}},_renderPointer:function(t,e,i,n,o,a,r,s){var l=this.group,u=this._data;if(t.get("pointer.show")){var h=[+t.get("min"),+t.get("max")],c=[a,r],d=t.getData(),f=d.mapDimension("value");d.diff(u).add(function(e){var i=new jL({shape:{angle:a}});To(i,{shape:{angle:Bo(d.get(f,e),h,c,!0)}},t),l.add(i),d.setItemGraphicEl(e,i)}).update(function(e,i){var n=u.getItemGraphicEl(i);Io(n,{shape:{angle:Bo(d.get(f,e),h,c,!0)}},t),l.add(n),d.setItemGraphicEl(e,n)}).remove(function(t){var e=u.getItemGraphicEl(t);l.remove(e)}).execute(),d.eachItemGraphicEl(function(t,e){var i=d.getItemModel(e),a=i.getModel("pointer");t.setShape({x:o.cx,y:o.cy,width:Vo(a.get("width"),o.r),r:Vo(a.get("length"),o.r)}),t.useStyle(i.getModel("itemStyle").getItemStyle()),"auto"===t.style.fill&&t.setStyle("fill",n(Bo(d.get(f,e),h,[0,1],!0))),fo(t,i.getModel("emphasis.itemStyle").getItemStyle())}),this._data=d}else u&&u.eachItemGraphicEl(function(t){l.remove(t)})},_renderTitle:function(t,e,i,n,o){var a=t.getData(),r=a.mapDimension("value"),s=t.getModel("title");if(s.get("show")){var l=s.get("offsetCenter"),u=o.cx+Vo(l[0],o.r),h=o.cy+Vo(l[1],o.r),c=+t.get("min"),d=+t.get("max"),f=n(Bo(t.getData().get(r,0),[c,d],[0,1],!0));this.group.add(new rM({silent:!0,style:mo({},s,{x:u,y:h,text:a.getName(0),textAlign:"center",textVerticalAlign:"middle"},{autoColor:f,forceRich:!0})}))}},_renderDetail:function(t,e,i,n,o){var a=t.getModel("detail"),r=+t.get("min"),s=+t.get("max");if(a.get("show")){var l=a.get("offsetCenter"),u=o.cx+Vo(l[0],o.r),h=o.cy+Vo(l[1],o.r),c=Vo(a.get("width"),o.r),d=Vo(a.get("height"),o.r),f=t.getData(),p=f.get(f.mapDimension("value"),0),g=n(Bo(p,[r,s],[0,1],!0));this.group.add(new rM({silent:!0,style:mo({},a,{x:u,y:h,text:Mf(p,a.get("formatter")),textWidth:isNaN(c)?null:c,textHeight:isNaN(d)?null:d,textAlign:"center",textVerticalAlign:"middle"},{autoColor:g,forceRich:!0})}))}}}),Hs({type:"series.funnel",init:function(t){qL.superApply(this,"init",arguments),this.legendDataProvider=function(){return this.getRawData()},this._defaultLabelLine(t)},getInitialData:function(t,e){return oC(this,["value"])},_defaultLabelLine:function(t){Ci(t,"labelLine",["show"]);var e=t.labelLine,i=t.emphasis.labelLine;e.show=e.show&&t.label.show,i.show=i.show&&t.emphasis.label.show},getDataParams:function(t){var e=this.getData(),i=qL.superCall(this,"getDataParams",t),n=e.mapDimension("value"),o=e.getSum(n);return i.percent=o?+(e.get(n,t)/o*100).toFixed(2):0,i.$vars.push("percent"),i},defaultOption:{zlevel:0,z:2,legendHoverLink:!0,left:80,top:60,right:80,bottom:60,minSize:"0%",maxSize:"100%",sort:"descending",gap:0,funnelAlign:"center",label:{show:!0,position:"outer"},labelLine:{show:!0,length:20,lineStyle:{width:1,type:"solid"}},itemStyle:{borderColor:"#fff",borderWidth:1},emphasis:{label:{show:!0}}}})),KL=If.prototype,$L=["itemStyle","opacity"];KL.updateData=function(t,e,i){var n=this.childAt(0),o=t.hostModel,a=t.getItemModel(e),s=t.getItemLayout(e),l=t.getItemModel(e).get($L);l=null==l?1:l,n.useStyle({}),i?(n.setShape({points:s.points}),n.setStyle({opacity:0}),To(n,{style:{opacity:l}},o,e)):Io(n,{style:{opacity:l},shape:{points:s.points}},o,e);var u=a.getModel("itemStyle"),h=t.getItemVisual(e,"color");n.setStyle(r({lineJoin:"round",fill:h},u.getItemStyle(["opacity"]))),n.hoverStyle=u.getModel("emphasis").getItemStyle(),this._updateLabel(t,e),fo(this)},KL._updateLabel=function(t,e){var i=this.childAt(1),n=this.childAt(2),o=t.hostModel,a=t.getItemModel(e),r=t.getItemLayout(e).label,s=t.getItemVisual(e,"color");Io(i,{shape:{points:r.linePoints||r.linePoints}},o,e),Io(n,{style:{x:r.x,y:r.y}},o,e),n.attr({rotation:r.rotation,origin:[r.x,r.y],z2:10});var l=a.getModel("label"),u=a.getModel("emphasis.label"),h=a.getModel("labelLine"),c=a.getModel("emphasis.labelLine"),s=t.getItemVisual(e,"color");go(n.style,n.hoverStyle={},l,u,{labelFetcher:t.hostModel,labelDataIndex:e,defaultText:t.getName(e),autoColor:s,useInsideStyle:!!r.inside},{textAlign:r.textAlign,textVerticalAlign:r.verticalAlign}),n.ignore=n.normalIgnore=!l.get("show"),n.hoverIgnore=!u.get("show"),i.ignore=i.normalIgnore=!h.get("show"),i.hoverIgnore=!c.get("show"),i.setStyle({stroke:s}),i.setStyle(h.getModel("lineStyle").getLineStyle()),i.hoverStyle=c.getModel("lineStyle").getLineStyle()},u(If,tb);Ar.extend({type:"funnel",render:function(t,e,i){var n=t.getData(),o=this._data,a=this.group;n.diff(o).add(function(t){var e=new If(n,t);n.setItemGraphicEl(t,e),a.add(e)}).update(function(t,e){var i=o.getItemGraphicEl(e);i.updateData(n,t),a.add(i),n.setItemGraphicEl(t,i)}).remove(function(t){var e=o.getItemGraphicEl(t);a.remove(e)}).execute(),this._data=n},remove:function(){this.group.removeAll(),this._data=null},dispose:function(){}});Bs(uC("funnel")),zs(function(t,e,i){t.eachSeriesByType("funnel",function(t){var i=t.getData(),n=i.mapDimension("value"),o=t.get("sort"),a=Tf(t,e),r=Af(i,o),s=[Vo(t.get("minSize"),a.width),Vo(t.get("maxSize"),a.width)],l=i.getDataExtent(n),u=t.get("min"),h=t.get("max");null==u&&(u=Math.min(l[0],0)),null==h&&(h=l[1]);var c=t.get("funnelAlign"),d=t.get("gap"),f=(a.height-d*(i.count()-1))/i.count(),p=a.y,g=function(t,e){var o,r=Bo(i.get(n,t)||0,[u,h],s,!0);switch(c){case"left":o=a.x;break;case"center":o=a.x+(a.width-r)/2;break;case"right":o=a.x+a.width-r}return[[o,e],[o+r,e]]};"ascending"===o&&(f=-f,d=-d,p+=a.height,r=r.reverse());for(var m=0;ma&&(e[1-n]=e[n]+h.sign*a),e},tk=d,ek=Math.min,ik=Math.max,nk=Math.floor,ok=Math.ceil,ak=Go,rk=Math.PI;Nf.prototype={type:"parallel",constructor:Nf,_init:function(t,e,i){var n=t.dimensions,o=t.parallelAxisIndex;tk(n,function(t,i){var n=o[i],a=e.getComponent("parallelAxis",n),r=this._axesMap.set(t,new JL(t,Hl(a),[0,0],a.get("type"),n)),s="category"===r.type;r.onBand=s&&a.get("boundaryGap"),r.inverse=a.get("inverse"),a.axis=r,r.model=a,r.coordinateSystem=a.coordinateSystem=this},this)},update:function(t,e){this._updateAxesFromSeries(this._model,t)},containPoint:function(t){var e=this._makeLayoutInfo(),i=e.axisBase,n=e.layoutBase,o=e.pixelDimIndex,a=t[1-o],r=t[o];return a>=i&&a<=i+e.axisLength&&r>=n&&r<=n+e.layoutLength},getModel:function(){return this._model},_updateAxesFromSeries:function(t,e){e.eachSeries(function(i){if(t.contains(i,e)){var n=i.getData();tk(this.dimensions,function(t){var e=this._axesMap.get(t);e.scale.unionExtentFromData(n,n.mapDimension(t)),Wl(e.scale,e.model)},this)}},this)},resize:function(t,e){this._rect=ca(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()}),this._layoutAxes()},getRect:function(){return this._rect},_makeLayoutInfo:function(){var t,e=this._model,i=this._rect,n=["x","y"],o=["width","height"],a=e.get("layout"),r="horizontal"===a?0:1,s=i[o[r]],l=[0,s],u=this.dimensions.length,h=Of(e.get("axisExpandWidth"),l),c=Of(e.get("axisExpandCount")||0,[0,u]),d=e.get("axisExpandable")&&u>3&&u>c&&c>1&&h>0&&s>0,f=e.get("axisExpandWindow");f?(t=Of(f[1]-f[0],l),f[1]=f[0]+t):(t=Of(h*(c-1),l),(f=[h*(e.get("axisExpandCenter")||nk(u/2))-t/2])[1]=f[0]+t);var p=(s-t)/(u-c);p<3&&(p=0);var g=[nk(ak(f[0]/h,1))+1,ok(ak(f[1]/h,1))-1],m=p/h*f[0];return{layout:a,pixelDimIndex:r,layoutBase:i[n[r]],layoutLength:s,axisBase:i[n[1-r]],axisLength:i[o[1-r]],axisExpandable:d,axisExpandWidth:h,axisCollapseWidth:p,axisExpandWindow:f,axisCount:u,winInnerIndices:g,axisExpandWindow0Pos:m}},_layoutAxes:function(){var t=this._rect,e=this._axesMap,i=this.dimensions,n=this._makeLayoutInfo(),o=n.layout;e.each(function(t){var e=[0,n.axisLength],i=t.inverse?1:0;t.setExtent(e[i],e[1-i])}),tk(i,function(e,i){var a=(n.axisExpandable?Rf:Ef)(i,n),r={horizontal:{x:a.position,y:n.axisLength},vertical:{x:0,y:a.position}},s={horizontal:rk/2,vertical:0},l=[r[o].x+t.x,r[o].y+t.y],u=s[o],h=xt();Mt(h,h,u),St(h,h,l),this._axesLayout[e]={position:l,rotation:u,transform:h,axisNameAvailableWidth:a.axisNameAvailableWidth,axisLabelShow:a.axisLabelShow,nameTruncateMaxWidth:a.nameTruncateMaxWidth,tickDirection:1,labelDirection:1}},this)},getAxis:function(t){return this._axesMap.get(t)},dataToPoint:function(t,e){return this.axisCoordToPoint(this._axesMap.get(e).dataToCoord(t),e)},eachActiveState:function(t,e,i,n){null==i&&(i=0),null==n&&(n=t.count());var o=this._axesMap,a=this.dimensions,r=[],s=[];d(a,function(e){r.push(t.mapDimension(e)),s.push(o.get(e).model)});for(var l=this.hasAxisBrushed(),u=i;uo*(1-h[0])?(l="jump",r=s-o*(1-h[2])):(r=s-o*h[1])>=0&&(r=s-o*(1-h[1]))<=0&&(r=0),(r*=e.axisExpandWidth/u)?QL(r,n,a,"all"):l="none";else{o=n[1]-n[0];(n=[ik(0,a[1]*s/o-o/2)])[1]=ek(a[1],n[0]+o),n[0]=n[1]-o}return{axisExpandWindow:n,behavior:l}}},Fa.register("parallel",{create:function(t,e){var i=[];return t.eachComponent("parallel",function(n,o){var a=new Nf(n,t,e);a.name="parallel_"+o,a.resize(n,e),n.coordinateSystem=a,a.model=n,i.push(a)}),t.eachSeries(function(e){if("parallel"===e.get("coordinateSystem")){var i=t.queryComponents({mainType:"parallel",index:e.get("parallelIndex"),id:e.get("parallelId")})[0];e.coordinateSystem=i.coordinateSystem}}),i}});var sk=lI.extend({type:"baseParallelAxis",axis:null,activeIntervals:[],getAreaSelectStyle:function(){return Qb([["fill","color"],["lineWidth","borderWidth"],["stroke","borderColor"],["width","width"],["opacity","opacity"]])(this.getModel("areaSelectStyle"))},setActiveIntervals:function(t){var e=this.activeIntervals=i(t);if(e)for(var n=e.length-1;n>=0;n--)Fo(e[n])},getActiveState:function(t){var e=this.activeIntervals;if(!e.length)return"normal";if(null==t||isNaN(t))return"inactive";if(1===e.length){var i=e[0];if(i[0]<=t&&t<=i[1])return"active"}else for(var n=0,o=e.length;n5)return;var n=this._model.coordinateSystem.getSlidedAxisExpandWindow([t.offsetX,t.offsetY]);"none"!==n.behavior&&this._dispatchExpand({axisExpandWindow:n.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(t){if(!this._mouseDownPoint&&Ip(this,"mousemove")){var e=this._model,i=e.coordinateSystem.getSlidedAxisExpandWindow([t.offsetX,t.offsetY]),n=i.behavior;"jump"===n&&this._throttledDispatchExpand.debounceNextCall(e.get("axisExpandDebounce")),this._throttledDispatchExpand("none"===n?null:{axisExpandWindow:i.axisExpandWindow,animation:"jump"===n&&null})}}};Ns(function(t){Cf(t),Lf(t)}),YI.extend({type:"series.parallel",dependencies:["parallel"],visualColorAccessPath:"lineStyle.color",getInitialData:function(t,e){var i=this.getSource();return Tp(i,this),ml(i,this)},getRawIndicesByActiveState:function(t){var e=this.coordinateSystem,i=this.getData(),n=[];return e.eachActiveState(i,function(e,o){t===e&&n.push(i.getRawIndex(o))}),n},defaultOption:{zlevel:0,z:2,coordinateSystem:"parallel",parallelIndex:0,label:{show:!1},inactiveOpacity:.05,activeOpacity:1,lineStyle:{width:1,opacity:.45,type:"solid"},emphasis:{label:{show:!1}},progressive:500,smooth:!1,animationEasing:"linear"}});var Dk=.3,Ck=(Ar.extend({type:"parallel",init:function(){this._dataGroup=new tb,this.group.add(this._dataGroup),this._data,this._initialized},render:function(t,e,i,n){var o=this._dataGroup,a=t.getData(),r=this._data,s=t.coordinateSystem,l=s.dimensions,u=kp(t);if(a.diff(r).add(function(t){Pp(Lp(a,o,t,l,s),a,t,u)}).update(function(e,i){var o=r.getItemGraphicEl(i),h=Cp(a,e,l,s);a.setItemGraphicEl(e,o),Io(o,{shape:{points:h}},n&&!1===n.animation?null:t,e),Pp(o,a,e,u)}).remove(function(t){var e=r.getItemGraphicEl(t);o.remove(e)}).execute(),!this._initialized){this._initialized=!0;var h=Dp(s,t,function(){setTimeout(function(){o.removeClipPath()})});o.setClipPath(h)}this._data=a},incrementalPrepareRender:function(t,e,i){this._initialized=!0,this._data=null,this._dataGroup.removeAll()},incrementalRender:function(t,e,i){for(var n=e.getData(),o=e.coordinateSystem,a=o.dimensions,r=kp(e),s=t.start;sn&&(n=e)}),d(e,function(e){var o=new hL({type:"color",mappingMethod:"linear",dataExtent:[i,n],visual:t.get("color")}).mapValueToVisual(e.getLayout().value);e.setVisual("color",o);var a=e.getModel().get("itemStyle.color");null!=a&&e.setVisual("color",a)})}})});var Ok={_baseAxisDim:null,getInitialData:function(t,e){var i,n,o=e.getComponent("xAxis",this.get("xAxisIndex")),a=e.getComponent("yAxis",this.get("yAxisIndex")),r=o.get("type"),s=a.get("type");"category"===r?(t.layout="horizontal",i=o.getOrdinalMeta(),n=!0):"category"===s?(t.layout="vertical",i=a.getOrdinalMeta(),n=!0):t.layout=t.layout||"horizontal";var l=["x","y"],u="horizontal"===t.layout?0:1,h=this._baseAxisDim=l[u],c=l[1-u],f=[o,a],p=f[u].get("type"),g=f[1-u].get("type"),m=t.data;if(m&&n){var v=[];d(m,function(t,e){var i;t.value&&y(t.value)?(i=t.value.slice(),t.value.unshift(e)):y(t)?(i=t.slice(),t.unshift(e)):i=t,v.push(i)}),t.data=v}var x=this.defaultValueDimensions;return oC(this,{coordDimensions:[{name:h,type:qs(p),ordinalMeta:i,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:c,type:qs(g),dimsDef:x.slice()}],dimensionsCount:x.length+1})},getBaseAxis:function(){var t=this._baseAxisDim;return this.ecModel.getComponent(t+"Axis",this.get(t+"AxisIndex")).axis}};h(YI.extend({type:"series.boxplot",dependencies:["xAxis","yAxis","grid"],defaultValueDimensions:[{name:"min",defaultTooltip:!0},{name:"Q1",defaultTooltip:!0},{name:"median",defaultTooltip:!0},{name:"Q3",defaultTooltip:!0},{name:"max",defaultTooltip:!0}],dimensions:null,defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,layout:null,boxWidth:[7,50],itemStyle:{color:"#fff",borderWidth:1},emphasis:{itemStyle:{borderWidth:2,shadowBlur:5,shadowOffsetX:2,shadowOffsetY:2,shadowColor:"rgba(0,0,0,0.4)"}},animationEasing:"elasticOut",animationDuration:800}}),Ok,!0);var Ek=["itemStyle"],Rk=["emphasis","itemStyle"],zk=(Ar.extend({type:"boxplot",render:function(t,e,i){var n=t.getData(),o=this.group,a=this._data;this._data||o.removeAll();var r="horizontal"===t.get("layout")?1:0;n.diff(a).add(function(t){if(n.hasValue(t)){var e=ig(n.getItemLayout(t),n,t,r,!0);n.setItemGraphicEl(t,e),o.add(e)}}).update(function(t,e){var i=a.getItemGraphicEl(e);if(n.hasValue(t)){var s=n.getItemLayout(t);i?ng(s,i,n,t):i=ig(s,n,t,r),o.add(i),n.setItemGraphicEl(t,i)}else o.remove(i)}).remove(function(t){var e=a.getItemGraphicEl(t);e&&o.remove(e)}).execute(),this._data=n},remove:function(t){var e=this.group,i=this._data;this._data=null,i&&i.eachItemGraphicEl(function(t){t&&e.remove(t)})},dispose:B}),Pn.extend({type:"boxplotBoxPath",shape:{},buildPath:function(t,e){var i=e.points,n=0;for(t.moveTo(i[n][0],i[n][1]),n++;n<4;n++)t.lineTo(i[n][0],i[n][1]);for(t.closePath();n0?jk:Yk)}function n(t,e){return e.get(t>0?Uk:Xk)}var o=t.getData(),a=t.pipelineContext.large;if(o.setVisual({legendSymbol:"roundRect",colorP:i(1,t),colorN:i(-1,t),borderColorP:n(1,t),borderColorN:n(-1,t)}),!e.isSeriesFiltered(t))return!a&&{progress:function(t,e){for(var o;null!=(o=t.next());){var a=e.getItemModel(o),r=e.getItemLayout(o).sign;e.setItemVisual(o,{color:i(r,a),borderColor:n(r,a)})}}}}},Kk="undefined"!=typeof Float32Array?Float32Array:Array,$k={seriesType:"candlestick",plan:$I(),reset:function(t){var e=t.coordinateSystem,i=t.getData(),n=pg(t,i),o=0,a=1,r=["x","y"],s=i.mapDimension(r[o]),l=i.mapDimension(r[a],!0),u=l[0],h=l[1],c=l[2],d=l[3];if(i.setLayout({candleWidth:n,isSimpleBox:n<=1.3}),!(null==s||l.length<4))return{progress:t.pipelineContext.large?function(t,i){for(var n,r,l=new Kk(5*t.count),f=0,p=[],g=[];null!=(r=t.next());){var m=i.get(s,r),v=i.get(u,r),y=i.get(h,r),x=i.get(c,r),_=i.get(d,r);isNaN(m)||isNaN(x)||isNaN(_)?(l[f++]=NaN,f+=4):(l[f++]=fg(i,r,v,y,h),p[o]=m,p[a]=x,n=e.dataToPoint(p,null,g),l[f++]=n?n[0]:NaN,l[f++]=n?n[1]:NaN,p[a]=_,n=e.dataToPoint(p,null,g),l[f++]=n?n[1]:NaN)}i.setLayout("largePoints",l)}:function(t,i){function r(t,i){var n=[];return n[o]=i,n[a]=t,isNaN(i)||isNaN(t)?[NaN,NaN]:e.dataToPoint(n)}function l(t,e,i){var a=e.slice(),r=e.slice();a[o]=Jn(a[o]+n/2,1,!1),r[o]=Jn(r[o]-n/2,1,!0),i?t.push(a,r):t.push(r,a)}function f(t){return t[o]=Jn(t[o],1),t}for(var p;null!=(p=t.next());){var g=i.get(s,p),m=i.get(u,p),v=i.get(h,p),y=i.get(c,p),x=i.get(d,p),_=Math.min(m,v),w=Math.max(m,v),b=r(_,g),S=r(w,g),M=r(y,g),I=r(x,g),T=[];l(T,S,0),l(T,b,1),T.push(f(I),f(S),f(M),f(b)),i.setItemLayout(p,{sign:fg(i,p,m,v,h),initBaseline:m>v?S[a]:b[a],ends:T,brushRect:function(t,e,i){var s=r(t,i),l=r(e,i);return s[o]-=n/2,l[o]-=n/2,{x:s[0],y:s[1],width:a?n:l[0]-s[0],height:a?l[1]-s[1]:n}}(y,x,g)})}}}}};Ns(function(t){t&&y(t.series)&&d(t.series,function(t){w(t)&&"k"===t.type&&(t.type="candlestick")})}),Bs(qk),zs($k),YI.extend({type:"series.effectScatter",dependencies:["grid","polar"],getInitialData:function(t,e){return ml(this.getSource(),this)},brushSelector:"point",defaultOption:{coordinateSystem:"cartesian2d",zlevel:0,z:2,legendHoverLink:!0,effectType:"ripple",progressive:0,showEffectOn:"render",rippleEffect:{period:4,scale:2.5,brushType:"fill"},symbolSize:10}});var Jk=vg.prototype;Jk.stopEffectAnimation=function(){this.childAt(1).removeAll()},Jk.startEffectAnimation=function(t){for(var e=t.symbolType,i=t.color,n=this.childAt(1),o=0;o<3;o++){var a=Jl(e,-1,-1,2,2,i);a.attr({style:{strokeNoScale:!0},z2:99,silent:!0,scale:[.5,.5]});var r=-o/3*t.period+t.effectOffset;a.animate("",!0).when(t.period,{scale:[t.rippleScale/2,t.rippleScale/2]}).delay(r).start(),a.animateStyle(!0).when(t.period,{opacity:0}).delay(r).start(),n.add(a)}mg(n,t)},Jk.updateEffectAnimation=function(t){for(var e=this._effectCfg,i=this.childAt(1),n=["symbolType","period","rippleScale"],o=0;o "))},preventIncremental:function(){return!!this.get("effect.show")},getProgressive:function(){var t=this.option.progressive;return null==t?this.option.large?1e4:this.get("progressive"):t},getProgressiveThreshold:function(){var t=this.option.progressiveThreshold;return null==t?this.option.large?2e4:this.get("progressiveThreshold"):t},defaultOption:{coordinateSystem:"geo",zlevel:0,z:2,legendHoverLink:!0,hoverAnimation:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,label:{show:!1,position:"end"},lineStyle:{opacity:.5}}}),iP=xg.prototype;iP.createLine=function(t,e,i){return new rf(t,e,i)},iP._updateEffectSymbol=function(t,e){var i=t.getItemModel(e).getModel("effect"),n=i.get("symbolSize"),o=i.get("symbol");y(n)||(n=[n,n]);var a=i.get("color")||t.getItemVisual(e,"color"),r=this.childAt(1);this._symbolType!==o&&(this.remove(r),(r=Jl(o,-.5,-.5,1,1,a)).z2=100,r.culling=!0,this.add(r)),r&&(r.setStyle("shadowColor",a),r.setStyle(i.getItemStyle(["color"])),r.attr("scale",n),r.setColor(a),r.attr("scale",n),this._symbolType=o,this._updateEffectAnimation(t,i,e))},iP._updateEffectAnimation=function(t,e,i){var n=this.childAt(1);if(n){var o=this,a=t.getItemLayout(i),r=1e3*e.get("period"),s=e.get("loop"),l=e.get("constantSpeed"),u=T(e.get("delay"),function(e){return e/t.count()*r/3}),h="function"==typeof u;if(n.ignore=!0,this.updateAnimationPoints(n,a),l>0&&(r=this.getLineLength(n)/l*1e3),r!==this._period||s!==this._loop){n.stopAnimation();var c=u;h&&(c=u(i)),n.__t>0&&(c=-r*n.__t),n.__t=0;var d=n.animate("",s).when(r,{__t:1}).delay(c).during(function(){o.updateSymbolPosition(n)});s||d.done(function(){o.remove(n)}),d.start()}this._period=r,this._loop=s}},iP.getLineLength=function(t){return uw(t.__p1,t.__cp1)+uw(t.__cp1,t.__p2)},iP.updateAnimationPoints=function(t,e){t.__p1=e[0],t.__p2=e[1],t.__cp1=e[2]||[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2]},iP.updateData=function(t,e,i){this.childAt(0).updateData(t,e,i),this._updateEffectSymbol(t,e)},iP.updateSymbolPosition=function(t){var e=t.__p1,i=t.__p2,n=t.__cp1,o=t.__t,a=t.position,r=sn,s=ln;a[0]=r(e[0],n[0],i[0],o),a[1]=r(e[1],n[1],i[1],o);var l=s(e[0],n[0],i[0],o),u=s(e[1],n[1],i[1],o);t.rotation=-Math.atan2(u,l)-Math.PI/2,t.ignore=!1},iP.updateLayout=function(t,e){this.childAt(0).updateLayout(t,e);var i=t.getItemModel(e).getModel("effect");this._updateEffectAnimation(t,i,e)},u(xg,tb);var nP=_g.prototype;nP._createPolyline=function(t,e,i){var n=t.getItemLayout(e),o=new gM({shape:{points:n}});this.add(o),this._updateCommonStl(t,e,i)},nP.updateData=function(t,e,i){var n=t.hostModel;Io(this.childAt(0),{shape:{points:t.getItemLayout(e)}},n,e),this._updateCommonStl(t,e,i)},nP._updateCommonStl=function(t,e,i){var n=this.childAt(0),o=t.getItemModel(e),a=t.getItemVisual(e,"color"),s=i&&i.lineStyle,l=i&&i.hoverLineStyle;i&&!t.hasItemOption||(s=o.getModel("lineStyle").getLineStyle(),l=o.getModel("emphasis.lineStyle").getLineStyle()),n.useStyle(r({strokeNoScale:!0,fill:"none",stroke:a},s)),n.hoverStyle=l,fo(this)},nP.updateLayout=function(t,e){this.childAt(0).setShape("points",t.getItemLayout(e))},u(_g,tb);var oP=wg.prototype;oP.createLine=function(t,e,i){return new _g(t,e,i)},oP.updateAnimationPoints=function(t,e){this._points=e;for(var i=[0],n=0,o=1;o=0&&!(n[r]<=e);r--);r=Math.min(r,o-2)}else{for(var r=a;re);r++);r=Math.min(r-1,o-2)}J(t.position,i[r],i[r+1],(e-n[r])/(n[r+1]-n[r]));var s=i[r+1][0]-i[r][0],l=i[r+1][1]-i[r][1];t.rotation=-Math.atan2(l,s)-Math.PI/2,this._lastFrame=r,this._lastFramePercent=e,t.ignore=!1}},u(wg,xg);var aP=Un({shape:{polyline:!1,curveness:0,segs:[]},buildPath:function(t,e){var i=e.segs,n=e.curveness;if(e.polyline)for(r=0;r0){t.moveTo(i[r++],i[r++]);for(var a=1;a0){var c=(s+u)/2-(l-h)*n,d=(l+h)/2-(u-s)*n;t.quadraticCurveTo(c,d,u,h)}else t.lineTo(u,h)}},findDataIndex:function(t,e){var i=this.shape,n=i.segs,o=i.curveness;if(i.polyline)for(var a=0,r=0;r0)for(var l=n[r++],u=n[r++],h=1;h0){if(_n(l,u,(l+c)/2-(u-d)*o,(u+d)/2-(c-l)*o,c,d))return a}else if(yn(l,u,c,d))return a;a++}return-1}}),rP=bg.prototype;rP.isPersistent=function(){return!this._incremental},rP.updateData=function(t){this.group.removeAll();var e=new aP({rectHover:!0,cursor:"default"});e.setShape({segs:t.getLayout("linesPoints")}),this._setCommon(e,t),this.group.add(e),this._incremental=null},rP.incrementalPrepareUpdate=function(t){this.group.removeAll(),this._clearIncremental(),t.count()>5e5?(this._incremental||(this._incremental=new Zn({silent:!0})),this.group.add(this._incremental)):this._incremental=null},rP.incrementalUpdate=function(t,e){var i=new aP;i.setShape({segs:e.getLayout("linesPoints")}),this._setCommon(i,e,!!this._incremental),this._incremental?this._incremental.addDisplayable(i,!0):(i.rectHover=!0,i.cursor="default",i.__startIndex=t.start,this.group.add(i))},rP.remove=function(){this._clearIncremental(),this._incremental=null,this.group.removeAll()},rP._setCommon=function(t,e,i){var n=e.hostModel;t.setShape({polyline:n.get("polyline"),curveness:n.get("lineStyle.curveness")}),t.useStyle(n.getModel("lineStyle").getLineStyle()),t.style.strokeNoScale=!0;var o=e.getVisual("color");o&&t.setStyle("stroke",o),t.setStyle("fill"),i||(t.seriesIndex=n.seriesIndex,t.on("mousemove",function(e){t.dataIndex=null;var i=t.findDataIndex(e.offsetX,e.offsetY);i>0&&(t.dataIndex=i+t.__startIndex)}))},rP._clearIncremental=function(){var t=this._incremental;t&&t.clearDisplaybles()};var sP={seriesType:"lines",plan:$I(),reset:function(t){var e=t.coordinateSystem,i=t.get("polyline"),n=t.pipelineContext.large;return{progress:function(o,a){var r=[];if(n){var s,l=o.end-o.start;if(i){for(var u=0,h=o.start;h0){var I=a(v)?s:l;v>0&&(v=v*S+b),x[_++]=I[M],x[_++]=I[M+1],x[_++]=I[M+2],x[_++]=I[M+3]*v*256}else _+=4}return c.putImageData(y,0,0),h},_getBrush:function(){var t=this._brushCanvas||(this._brushCanvas=iw()),e=this.pointSize+this.blurSize,i=2*e;t.width=i,t.height=i;var n=t.getContext("2d");return n.clearRect(0,0,i,i),n.shadowOffsetX=i,n.shadowBlur=this.blurSize,n.shadowColor="#000",n.beginPath(),n.arc(-e,e,this.pointSize,0,2*Math.PI,!0),n.closePath(),n.fill(),t},_getGradient:function(t,e,i){for(var n=this._gradientPixels,o=n[i]||(n[i]=new Uint8ClampedArray(1024)),a=[0,0,0,0],r=0,s=0;s<256;s++)e[i](s/255,!0,a),o[r++]=a[0],o[r++]=a[1],o[r++]=a[2],o[r++]=a[3];return o}},Zs({type:"heatmap",render:function(t,e,i){var n;e.eachComponent("visualMap",function(e){e.eachTargetSeries(function(i){i===t&&(n=e)})}),this.group.removeAll(),this._incrementalDisplayable=null;var o=t.coordinateSystem;"cartesian2d"===o.type||"calendar"===o.type?this._renderOnCartesianAndCalendar(t,i,0,t.getData().count()):Ag(o)&&this._renderOnGeo(o,t,n,i)},incrementalPrepareRender:function(t,e,i){this.group.removeAll()},incrementalRender:function(t,e,i,n){e.coordinateSystem&&this._renderOnCartesianAndCalendar(e,n,t.start,t.end,!0)},_renderOnCartesianAndCalendar:function(t,e,i,n,o){var r,s,l=t.coordinateSystem;if("cartesian2d"===l.type){var u=l.getAxis("x"),h=l.getAxis("y");r=u.getBandWidth(),s=h.getBandWidth()}for(var c=this.group,d=t.getData(),f=t.getModel("itemStyle").getItemStyle(["color"]),p=t.getModel("emphasis.itemStyle").getItemStyle(),g=t.getModel("label"),m=t.getModel("emphasis.label"),v=l.type,y="cartesian2d"===v?[d.mapDimension("x"),d.mapDimension("y"),d.mapDimension("value")]:[d.mapDimension("time"),d.mapDimension("value")],x=i;x=e.y&&t[1]<=e.y+e.height:i.contain(i.toLocalCoord(t[1]))&&t[0]>=e.y&&t[0]<=e.y+e.height},pointToData:function(t){var e=this.getAxis();return[e.coordToData(e.toLocalCoord(t["horizontal"===e.orient?0:1]))]},dataToPoint:function(t){var e=this.getAxis(),i=this.getRect(),n=[],o="horizontal"===e.orient?0:1;return t instanceof Array&&(t=t[0]),n[o]=e.toGlobalCoord(e.dataToCoord(+t)),n[1-o]=0===o?i.y+i.height/2:i.x+i.width/2,n}},Fa.register("single",{create:function(t,e){var i=[];return t.eachComponent("singleAxis",function(n,o){var a=new $g(n,t,e);a.name="single_"+o,a.resize(n,e),n.coordinateSystem=a,i.push(a)}),t.eachSeries(function(e){if("singleAxis"===e.get("coordinateSystem")){var i=t.queryComponents({mainType:"singleAxis",index:e.get("singleAxisIndex"),id:e.get("singleAxisId")})[0];e.coordinateSystem=i&&i.coordinateSystem}}),i},dimensions:$g.prototype.dimensions});var gP=["axisLine","axisTickLabel","axisName"],mP=XD.extend({type:"singleAxis",axisPointerClass:"SingleAxisPointer",render:function(t,e,i,n){var o=this.group;o.removeAll();var a=Jg(t),r=new FD(t,a);d(gP,r.add,r),o.add(r.getGroup()),t.get("splitLine.show")&&this._splitLine(t),mP.superCall(this,"render",t,e,i,n)},_splitLine:function(t){var e=t.axis;if(!e.scale.isBlank()){var i=t.getModel("splitLine"),n=i.getModel("lineStyle"),o=n.get("width"),a=n.get("color");a=a instanceof Array?a:[a];for(var r=t.coordinateSystem.getRect(),s=e.isHorizontal(),l=[],u=0,h=e.getTicksCoords({tickModel:i}),c=[],d=[],f=0;f=0)&&i({type:"updateAxisPointer",currTrigger:t,x:e&&e.offsetX,y:e&&e.offsetY})})},remove:function(t,e){gm(e.getZr(),"axisPointer"),IP.superApply(this._model,"remove",arguments)},dispose:function(t,e){gm("axisPointer",e),IP.superApply(this._model,"dispose",arguments)}}),TP=Bi(),AP=i,DP=m;(mm.prototype={_group:null,_lastGraphicKey:null,_handle:null,_dragging:!1,_lastValue:null,_lastStatus:null,_payloadInfo:null,animationThreshold:15,render:function(t,e,i,n){var o=e.get("value"),a=e.get("status");if(this._axisModel=t,this._axisPointerModel=e,this._api=i,n||this._lastValue!==o||this._lastStatus!==a){this._lastValue=o,this._lastStatus=a;var r=this._group,s=this._handle;if(!a||"hide"===a)return r&&r.hide(),void(s&&s.hide());r&&r.show(),s&&s.show();var l={};this.makeElOption(l,o,t,e,i);var u=l.graphicKey;u!==this._lastGraphicKey&&this.clear(i),this._lastGraphicKey=u;var h=this._moveAnimation=this.determineAnimation(t,e);if(r){var c=v(vm,e,h);this.updatePointerEl(r,l,c,e),this.updateLabelEl(r,l,c,e)}else r=this._group=new tb,this.createPointerEl(r,l,t,e),this.createLabelEl(r,l,t,e),i.getZr().add(r);wm(r,e,!0),this._renderHandle(o)}},remove:function(t){this.clear(t)},dispose:function(t){this.clear(t)},determineAnimation:function(t,e){var i=e.get("animation"),n=t.axis,o="category"===n.type,a=e.get("snap");if(!a&&!o)return!1;if("auto"===i||null==i){var r=this.animationThreshold;if(o&&n.getBandWidth()>r)return!0;if(a){var s=Mh(t).seriesDataCount,l=n.getExtent();return Math.abs(l[0]-l[1])/s>r}return!1}return!0===i},makeElOption:function(t,e,i,n,o){},createPointerEl:function(t,e,i,n){var o=e.pointer;if(o){var a=TP(t).pointerEl=new zM[o.type](AP(e.pointer));t.add(a)}},createLabelEl:function(t,e,i,n){if(e.label){var o=TP(t).labelEl=new yM(AP(e.label));t.add(o),xm(o,n)}},updatePointerEl:function(t,e,i){var n=TP(t).pointerEl;n&&(n.setStyle(e.pointer.style),i(n,{shape:e.pointer.shape}))},updateLabelEl:function(t,e,i,n){var o=TP(t).labelEl;o&&(o.setStyle(e.label.style),i(o,{shape:e.label.shape,position:e.label.position}),xm(o,n))},_renderHandle:function(t){if(!this._dragging&&this.updateHandleTransform){var e=this._axisPointerModel,i=this._api.getZr(),n=this._handle,o=e.getModel("handle"),a=e.get("status");if(!o.get("show")||!a||"hide"===a)return n&&i.remove(n),void(this._handle=null);var r;this._handle||(r=!0,n=this._handle=Po(o.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(t){mw(t.event)},onmousedown:DP(this._onHandleDragMove,this,0,0),drift:DP(this._onHandleDragMove,this),ondragend:DP(this._onHandleDragEnd,this)}),i.add(n)),wm(n,e,!1);var s=["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"];n.setStyle(o.getItemStyle(null,s));var l=o.get("size");y(l)||(l=[l,l]),n.attr("scale",[l[0]/2,l[1]/2]),Nr(this,"_doDispatchAxisPointer",o.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,r)}},_moveHandleToValue:function(t,e){vm(this._axisPointerModel,!e&&this._moveAnimation,this._handle,_m(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},_onHandleDragMove:function(t,e){var i=this._handle;if(i){this._dragging=!0;var n=this.updateHandleTransform(_m(i),[t,e],this._axisModel,this._axisPointerModel);this._payloadInfo=n,i.stopAnimation(),i.attr(_m(n)),TP(i).lastProp=null,this._doDispatchAxisPointer()}},_doDispatchAxisPointer:function(){if(this._handle){var t=this._payloadInfo,e=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:t.cursorPoint[0],y:t.cursorPoint[1],tooltipOption:t.tooltipOption,axesInfo:[{axisDim:e.axis.dim,axisIndex:e.componentIndex}]})}},_onHandleDragEnd:function(t){if(this._dragging=!1,this._handle){var e=this._axisPointerModel.get("value");this._moveHandleToValue(e),this._api.dispatchAction({type:"hideTip"})}},getHandleTransform:null,updateHandleTransform:null,clear:function(t){this._lastValue=null,this._lastStatus=null;var e=t.getZr(),i=this._group,n=this._handle;e&&i&&(this._lastGraphicKey=null,i&&e.remove(i),n&&e.remove(n),this._group=null,this._handle=null,this._payloadInfo=null)},doClear:function(){},buildLabel:function(t,e,i){return i=i||0,{x:t[i],y:t[1-i],width:e[i],height:e[1-i]}}}).constructor=mm,ji(mm);var CP=mm.extend({makeElOption:function(t,e,i,n,o){var a=i.axis,r=a.grid,s=n.get("type"),l=km(r,a).getOtherAxis(a).getGlobalExtent(),u=a.toGlobalCoord(a.dataToCoord(e,!0));if(s&&"none"!==s){var h=bm(n),c=LP[s](a,u,l,h);c.style=h,t.graphicKey=c.type,t.pointer=c}Am(e,t,Lh(r.model,i),i,n,o)},getHandleTransform:function(t,e,i){var n=Lh(e.axis.grid.model,e,{labelInside:!1});return n.labelMargin=i.get("handle.margin"),{position:Tm(e.axis,t,n),rotation:n.rotation+(n.labelDirection<0?Math.PI:0)}},updateHandleTransform:function(t,e,i,n){var o=i.axis,a=o.grid,r=o.getGlobalExtent(!0),s=km(a,o).getOtherAxis(o).getGlobalExtent(),l="x"===o.dim?0:1,u=t.position;u[l]+=e[l],u[l]=Math.min(r[1],u[l]),u[l]=Math.max(r[0],u[l]);var h=(s[1]+s[0])/2,c=[h,h];c[l]=u[l];var d=[{verticalAlign:"middle"},{align:"center"}];return{position:u,rotation:t.rotation,cursorPoint:c,tooltipOption:d[l]}}}),LP={line:function(t,e,i,n){var o=Dm([e,i[0]],[e,i[1]],Pm(t));return Kn({shape:o,style:n}),{type:"Line",shape:o}},shadow:function(t,e,i,n){var o=Math.max(1,t.getBandWidth()),a=i[1]-i[0];return{type:"Rect",shape:Cm([e-o/2,i[0]],[o,a],Pm(t))}}};XD.registerAxisPointerClass("CartesianAxisPointer",CP),Ns(function(t){if(t){(!t.axisPointer||0===t.axisPointer.length)&&(t.axisPointer={});var e=t.axisPointer.link;e&&!y(e)&&(t.axisPointer.link=[e])}}),Os(VT.PROCESSOR.STATISTIC,function(t,e){t.getComponent("axisPointer").coordSysAxesInfo=vh(t,e)}),Es({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},function(t,e,i){var n=t.currTrigger,o=[t.x,t.y],a=t,r=t.dispatchAction||m(i.dispatchAction,i),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){lm(o)&&(o=xP({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},e).point);var l=lm(o),u=a.axesInfo,h=s.axesInfo,c="leave"===n||lm(o),d={},f={},p={list:[],map:{}},g={showPointer:wP(em,f),showTooltip:wP(im,p)};_P(s.coordSysMap,function(t,e){var i=l||t.containPoint(o);_P(s.coordSysAxesInfo[e],function(t,e){var n=t.axis,a=rm(u,t);if(!c&&i&&(!u||a)){var r=a&&a.value;null!=r||l||(r=n.pointToData(o)),null!=r&&Qg(t,r,g,!1,d)}})});var v={};return _P(h,function(t,e){var i=t.linkGroup;i&&!f[e]&&_P(i.axesInfo,function(e,n){var o=f[n];if(e!==t&&o){var a=o.value;i.mapper&&(a=t.axis.scale.parse(i.mapper(a,sm(e),sm(t)))),v[t.key]=a}})}),_P(v,function(t,e){Qg(h[e],t,g,!0,d)}),nm(f,h,d),om(p,o,t,r),am(h,0,i),d}});var kP=["x","y"],PP=["width","height"],NP=mm.extend({makeElOption:function(t,e,i,n,o){var a=i.axis,r=a.coordinateSystem,s=Om(r,1-Nm(a)),l=r.dataToPoint(e)[0],u=n.get("type");if(u&&"none"!==u){var h=bm(n),c=OP[u](a,l,s,h);c.style=h,t.graphicKey=c.type,t.pointer=c}Am(e,t,Jg(i),i,n,o)},getHandleTransform:function(t,e,i){var n=Jg(e,{labelInside:!1});return n.labelMargin=i.get("handle.margin"),{position:Tm(e.axis,t,n),rotation:n.rotation+(n.labelDirection<0?Math.PI:0)}},updateHandleTransform:function(t,e,i,n){var o=i.axis,a=o.coordinateSystem,r=Nm(o),s=Om(a,r),l=t.position;l[r]+=e[r],l[r]=Math.min(s[1],l[r]),l[r]=Math.max(s[0],l[r]);var u=Om(a,1-r),h=(u[1]+u[0])/2,c=[h,h];return c[r]=l[r],{position:l,rotation:t.rotation,cursorPoint:c,tooltipOption:{verticalAlign:"middle"}}}}),OP={line:function(t,e,i,n){var o=Dm([e,i[0]],[e,i[1]],Nm(t));return Kn({shape:o,style:n}),{type:"Line",shape:o}},shadow:function(t,e,i,n){var o=t.getBandWidth(),a=i[1]-i[0];return{type:"Rect",shape:Cm([e-o/2,i[0]],[o,a],Nm(t))}}};XD.registerAxisPointerClass("SingleAxisPointer",NP),Ws({type:"single"});var EP=YI.extend({type:"series.themeRiver",dependencies:["singleAxis"],nameMap:null,init:function(t){EP.superApply(this,"init",arguments),this.legendDataProvider=function(){return this.getRawData()}},fixData:function(t){var e=t.length,i=[];Zi(t,function(t){return t[2]}).buckets.each(function(t,e){i.push({name:e,dataList:t})});for(var n=i.length,o=-1,a=-1,r=0;ro&&(o=s,a=r)}for(var l=0;lMath.PI/2?"right":"left"):x&&"center"!==x?"left"===x?(f=u.r0+y,p>Math.PI/2&&(x="right")):"right"===x&&(f=u.r-y,p>Math.PI/2&&(x="left")):(f=(u.r+u.r0)/2,x="center"),d.attr("style",{text:l,textAlign:x,textVerticalAlign:n("verticalAlign")||"middle",opacity:n("opacity")});var _=f*g+u.cx,w=f*m+u.cy;d.attr("position",[_,w]);var b=n("rotate"),S=0;"radial"===b?(S=-p)<-Math.PI/2&&(S+=Math.PI):"tangential"===b?(S=Math.PI/2-p)>Math.PI/2?S-=Math.PI:S<-Math.PI/2&&(S+=Math.PI):"number"==typeof b&&(S=b*Math.PI/180),d.attr("rotation",S)},VP._initEvents=function(t,e,i,n){t.off("mouseover").off("mouseout").off("emphasis").off("normal");var o=this,a=function(){o.onEmphasis(n)},r=function(){o.onNormal()};i.isAnimationEnabled()&&t.on("mouseover",a).on("mouseout",r).on("emphasis",a).on("normal",r).on("downplay",function(){o.onDownplay()}).on("highlight",function(){o.onHighlight()})},u(Vm,tb);Ar.extend({type:"sunburst",init:function(){},render:function(t,e,i,n){function o(i,n){if(c||!i||i.getValue()||(i=null),i!==l&&n!==l)if(n&&n.piece)i?(n.piece.updateData(!1,i,"normal",t,e),s.setItemGraphicEl(i.dataIndex,n.piece)):a(n);else if(i){var o=new Vm(i,t,e);h.add(o),s.setItemGraphicEl(i.dataIndex,o)}}function a(t){t&&t.piece&&(h.remove(t.piece),t.piece=null)}var r=this;this.seriesModel=t,this.api=i,this.ecModel=e;var s=t.getData(),l=s.tree.root,u=t.getViewRoot(),h=this.group,c=t.get("renderLabelForZeroData"),d=[];u.eachNode(function(t){d.push(t)});var f=this._oldChildren||[];if(function(t,e){function i(t){return t.getId()}function n(i,n){o(null==i?null:t[i],null==n?null:e[n])}0===t.length&&0===e.length||new Xs(e,t,i,i).add(n).update(n).remove(v(n,null)).execute()}(d,f),function(i,n){if(n.depth>0){r.virtualPiece?r.virtualPiece.updateData(!1,i,"normal",t,e):(r.virtualPiece=new Vm(i,t,e),h.add(r.virtualPiece)),n.piece._onclickEvent&&n.piece.off("click",n.piece._onclickEvent);var o=function(t){r._rootToNode(n.parentNode)};n.piece._onclickEvent=o,r.virtualPiece.on("click",o)}else r.virtualPiece&&(h.remove(r.virtualPiece),r.virtualPiece=null)}(l,u),n&&n.highlight&&n.highlight.piece){var p=t.getShallow("highlightPolicy");n.highlight.piece.onEmphasis(p)}else if(n&&n.unhighlight){var g=this.virtualPiece;!g&&l.children.length&&(g=l.children[0].piece),g&&g.onNormal()}this._initEvents(),this._oldChildren=d},dispose:function(){},_initEvents:function(){var t=this,e=function(e){var i=!1;t.seriesModel.getViewRoot().eachNode(function(n){if(!i&&n.piece&&n.piece.childAt(0)===e.target){var o=n.getModel().get("nodeClick");if("rootToNode"===o)t._rootToNode(n);else if("link"===o){var a=n.getModel(),r=a.get("link");if(r){var s=a.get("target",!0)||"_blank";window.open(r,s)}}i=!0}})};this.group._onclickEvent&&this.group.off("click",this.group._onclickEvent),this.group.on("click",e),this.group._onclickEvent=e},_rootToNode:function(t){t!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:"sunburstRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t})},containPoint:function(t,e){var i=e.getData().getItemLayout(0);if(i){var n=t[0]-i.cx,o=t[1]-i.cy,a=Math.sqrt(n*n+o*o);return a<=i.r&&a>=i.r0}}});var GP="sunburstRootToNode";Es({type:GP,update:"updateView"},function(t,e){e.eachComponent({mainType:"series",subType:"sunburst",query:t},function(e,i){var n=ld(t,[GP],e);if(n){var o=e.getViewRoot();o&&(t.direction=hd(o,n.node)?"rollUp":"drillDown"),e.resetViewRoot(n.node)}})});var FP="sunburstHighlight";Es({type:FP,update:"updateView"},function(t,e){e.eachComponent({mainType:"series",subType:"sunburst",query:t},function(e,i){var n=ld(t,[FP],e);n&&(t.highlight=n.node)})});Es({type:"sunburstUnhighlight",update:"updateView"},function(t,e){e.eachComponent({mainType:"series",subType:"sunburst",query:t},function(e,i){t.unhighlight=!0})});var WP=Math.PI/180;Bs(v(uC,"sunburst")),zs(v(function(t,e,i,n){e.eachSeriesByType(t,function(t){var e=t.get("center"),n=t.get("radius");y(n)||(n=[0,n]),y(e)||(e=[e,e]);var o=i.getWidth(),a=i.getHeight(),r=Math.min(o,a),s=Vo(e[0],o),l=Vo(e[1],a),u=Vo(n[0],r/2),h=Vo(n[1],r/2),c=-t.get("startAngle")*WP,f=t.get("minAngle")*WP,p=t.getData().tree.root,g=t.getViewRoot(),m=g.depth,v=t.get("sort");null!=v&&Zm(g,v);var x=0;d(g.children,function(t){!isNaN(t.getValue())&&x++});var _=g.getValue(),w=Math.PI/(_||x)*2,b=g.depth>0,S=g.height-(b?-1:1),M=(h-u)/(S||1),I=t.get("clockwise"),T=t.get("stillShowZeroSum"),A=I?1:-1,D=function(t,e){if(t){var i=e;if(t!==p){var n=t.getValue(),o=0===_&&T?w:n*w;on[1]&&n.reverse(),{coordSys:{type:"polar",cx:t.cx,cy:t.cy,r:n[1],r0:n[0]},api:{coord:m(function(n){var o=e.dataToRadius(n[0]),a=i.dataToAngle(n[1]),r=t.coordToPoint([o,a]);return r.push(o,a*Math.PI/180),r}),size:m(qm,t)}}},calendar:function(t){var e=t.getRect(),i=t.getRangeInfo();return{coordSys:{type:"calendar",x:e.x,y:e.y,width:e.width,height:e.height,cellWidth:t.getCellWidth(),cellHeight:t.getCellHeight(),rangeInfo:{start:i.start,end:i.end,weeks:i.weeks,dayCount:i.allDay}},api:{coord:function(e,i){return t.dataToPoint(e,i)}}}}};YI.extend({type:"series.custom",dependencies:["grid","polar","geo","singleAxis","calendar"],defaultOption:{coordinateSystem:"cartesian2d",zlevel:0,z:2,legendHoverLink:!0,useTransform:!0},getInitialData:function(t,e){return ml(this.getSource(),this)},getDataParams:function(t,e,i){var n=YI.prototype.getDataParams.apply(this,arguments);return i&&(n.info=i.info),n}}),Ar.extend({type:"custom",_data:null,render:function(t,e,i,n){var o=this._data,a=t.getData(),r=this.group,s=Qm(t,a,e,i);a.diff(o).add(function(e){ev(null,e,s(e,n),t,r,a)}).update(function(e,i){ev(o.getItemGraphicEl(i),e,s(e,n),t,r,a)}).remove(function(t){var e=o.getItemGraphicEl(t);e&&r.remove(e)}).execute(),this._data=a},incrementalPrepareRender:function(t,e,i){this.group.removeAll(),this._data=null},incrementalRender:function(t,e,i,n,o){for(var a=e.getData(),r=Qm(e,a,i,n),s=t.start;s=0;l--)null==o[l]?o.splice(l,1):delete o[l].$action},_flatten:function(t,e,i){d(t,function(t){if(t){i&&(t.parentOption=i),e.push(t);var n=t.children;"group"===t.type&&n&&this._flatten(n,e,t),delete t.children}},this)},useElOptionsToUpdate:function(){var t=this._elOptionsToUpdate;return this._elOptionsToUpdate=null,t}});Ws({type:"graphic",init:function(t,e){this._elMap=R(),this._lastGraphicModel},render:function(t,e,i){t!==this._lastGraphicModel&&this._clear(),this._lastGraphicModel=t,this._updateElements(t),this._relocate(t,i)},_updateElements:function(t){var e=t.useElOptionsToUpdate();if(e){var i=this._elMap,n=this.group;d(e,function(e){var o=e.$action,a=e.id,r=i.get(a),s=e.parentId,l=null!=s?i.get(s):n,u=e.style;"text"===e.type&&u&&(e.hv&&e.hv[1]&&(u.textVerticalAlign=u.textBaseline=null),!u.hasOwnProperty("textFill")&&u.fill&&(u.textFill=u.fill),!u.hasOwnProperty("textStroke")&&u.stroke&&(u.textStroke=u.stroke));var h=fv(e);o&&"merge"!==o?"replace"===o?(dv(r,i),cv(a,l,h,i)):"remove"===o&&dv(r,i):r?r.attr(h):cv(a,l,h,i);var c=i.get(a);c&&(c.__ecGraphicWidth=e.width,c.__ecGraphicHeight=e.height,yv(c,t))})}},_relocate:function(t,e){for(var i=t.option.elements,n=this.group,o=this._elMap,a=i.length-1;a>=0;a--){var r=i[a],s=o.get(r.id);if(s){var l=s.parent;da(s,r,l===n?{width:e.getWidth(),height:e.getHeight()}:{width:l.__ecGraphicWidth||0,height:l.__ecGraphicHeight||0},null,{hv:r.hv,boundingMode:r.bounding})}}},_clear:function(){var t=this._elMap;t.each(function(e){dv(e,t)}),this._elMap=R()},dispose:function(){this._clear()}});var KP=Fs({type:"legend.plain",dependencies:["series"],layoutMode:{type:"box",ignoreSize:!0},init:function(t,e,i){this.mergeDefaultAndTheme(t,i),t.selected=t.selected||{}},mergeOption:function(t){KP.superCall(this,"mergeOption",t)},optionUpdated:function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&"single"===this.get("selectedMode")){for(var e=!1,i=0;i=0},defaultOption:{zlevel:0,z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,inactiveColor:"#ccc",textStyle:{color:"#333"},selectedMode:!0,tooltip:{show:!1}}});Es("legendToggleSelect","legendselectchanged",v(xv,"toggleSelected")),Es("legendSelect","legendselected",v(xv,"select")),Es("legendUnSelect","legendunselected",v(xv,"unSelect"));var $P=v,JP=d,QP=tb,tN=Ws({type:"legend.plain",newlineDisabled:!1,init:function(){this.group.add(this._contentGroup=new QP),this._backgroundEl,this._isFirstRender=!0},getContentGroup:function(){return this._contentGroup},render:function(t,e,i){var n=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),t.get("show",!0)){var o=t.get("align");o&&"auto"!==o||(o="right"===t.get("left")&&"vertical"===t.get("orient")?"right":"left"),this.renderInner(o,t,e,i);var a=t.getBoxLayoutParams(),s={width:i.getWidth(),height:i.getHeight()},l=t.get("padding"),u=ca(a,s,l),h=this.layoutInner(t,o,u,n),c=ca(r({width:h.width,height:h.height},a),s,l);this.group.attr("position",[c.x-h.x,c.y-h.y]),this.group.add(this._backgroundEl=wv(h,t))}},resetInner:function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl)},renderInner:function(t,e,i,n){var o=this.getContentGroup(),a=R(),r=e.get("selectedMode"),s=[];i.eachRawSeries(function(t){!t.get("legendHoverLink")&&s.push(t.id)}),JP(e.getData(),function(l,u){var h=l.get("name");if(this.newlineDisabled||""!==h&&"\n"!==h){var c=i.getSeriesByName(h)[0];if(!a.get(h))if(c){var d=c.getData(),f=d.getVisual("color");"function"==typeof f&&(f=f(c.getDataParams(0)));var p=d.getVisual("legendSymbol")||"roundRect",g=d.getVisual("symbol");this._createItem(h,u,l,e,p,g,t,f,r).on("click",$P(bv,h,n)).on("mouseover",$P(Sv,c.name,null,n,s)).on("mouseout",$P(Mv,c.name,null,n,s)),a.set(h,!0)}else i.eachRawSeries(function(i){if(!a.get(h)&&i.legendDataProvider){var o=i.legendDataProvider(),c=o.indexOfName(h);if(c<0)return;var d=o.getItemVisual(c,"color");this._createItem(h,u,l,e,"roundRect",null,t,d,r).on("click",$P(bv,h,n)).on("mouseover",$P(Sv,null,h,n,s)).on("mouseout",$P(Mv,null,h,n,s)),a.set(h,!0)}},this)}else o.add(new QP({newline:!0}))},this)},_createItem:function(t,e,i,n,o,r,s,l,u){var h=n.get("itemWidth"),c=n.get("itemHeight"),d=n.get("inactiveColor"),f=n.get("symbolKeepAspect"),p=n.isSelected(t),g=new QP,m=i.getModel("textStyle"),v=i.get("icon"),y=i.getModel("tooltip"),x=y.parentModel;if(o=v||o,g.add(Jl(o,0,0,h,c,p?l:d,null==f||f)),!v&&r&&(r!==o||"none"===r)){var _=.8*c;"none"===r&&(r="circle"),g.add(Jl(r,(h-_)/2,(c-_)/2,_,_,p?l:d,null==f||f))}var w="left"===s?h+5:-5,b=s,S=n.get("formatter"),M=t;"string"==typeof S&&S?M=S.replace("{name}",null!=t?t:""):"function"==typeof S&&(M=S(t)),g.add(new rM({style:mo({},m,{text:M,x:w,y:c/2,textFill:p?m.getTextColor():d,textAlign:b,textVerticalAlign:"middle"})}));var I=new yM({shape:g.getBoundingRect(),invisible:!0,tooltip:y.get("show")?a({content:t,formatter:x.get("formatter",!0)||function(){return t},formatterParams:{componentType:"legend",legendIndex:n.componentIndex,name:t,$vars:["name"]}},y.option):null});return g.add(I),g.eachChild(function(t){t.silent=!0}),I.silent=!u,this.getContentGroup().add(g),fo(g),g.__legendDataIndex=e,g},layoutInner:function(t,e,i){var n=this.getContentGroup();aI(t.get("orient"),n,t.get("itemGap"),i.width,i.height);var o=n.getBoundingRect();return n.attr("position",[-o.x,-o.y]),this.group.getBoundingRect()},remove:function(){this.getContentGroup().removeAll(),this._isFirstRender=!0}});Os(function(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.filterSeries(function(t){for(var i=0;ii[l],p=[-c.x,-c.y];n||(p[s]=o.position[s]);var g=[0,0],m=[-d.x,-d.y],v=A(t.get("pageButtonGap",!0),t.get("itemGap",!0));f&&("end"===t.get("pageButtonPosition",!0)?m[s]+=i[l]-d[l]:g[s]+=d[l]+v),m[1-s]+=c[u]/2-d[u]/2,o.attr("position",p),a.attr("position",g),r.attr("position",m);var y=this.group.getBoundingRect();if((y={x:0,y:0})[l]=f?i[l]:c[l],y[u]=Math.max(c[u],d[u]),y[h]=Math.min(0,d[h]+m[1-s]),a.__rectSize=i[l],f){var x={x:0,y:0};x[l]=Math.max(i[l]-d[l]-v,0),x[u]=y[u],a.setClipPath(new yM({shape:x})),a.__rectSize=x[l]}else r.eachChild(function(t){t.attr({invisible:!0,silent:!0})});var _=this._getPageInfo(t);return null!=_.pageIndex&&Io(o,{position:_.contentPosition},!!f&&t),this._updatePageInfoView(t,_),y},_pageGo:function(t,e,i){var n=this._getPageInfo(e)[t];null!=n&&i.dispatchAction({type:"legendScroll",scrollDataIndex:n,legendId:e.id})},_updatePageInfoView:function(t,e){var i=this._controllerGroup;d(["pagePrev","pageNext"],function(n){var o=null!=e[n+"DataIndex"],a=i.childOfName(n);a&&(a.setStyle("fill",o?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),a.cursor=o?"pointer":"default")});var n=i.childOfName("pageText"),o=t.get("pageFormatter"),a=e.pageIndex,r=null!=a?a+1:0,s=e.pageCount;n&&o&&n.setStyle("text",_(o)?o.replace("{current}",r).replace("{total}",s):o({current:r,total:s}))},_getPageInfo:function(t){function e(t){if(t){var e=t.getBoundingRect(),i=e[l]+t.position[r];return{s:i,e:i+e[s],i:t.__legendDataIndex}}}function i(t,e){return t.e>=e&&t.s<=e+a}var n=t.get("scrollDataIndex",!0),o=this.getContentGroup(),a=this._containerGroup.__rectSize,r=t.getOrient().index,s=nN[r],l=oN[r],u=this._findTargetItemIndex(n),h=o.children(),c=h[u],d=h.length,f=d?1:0,p={contentPosition:o.position.slice(),pageCount:f,pageIndex:f-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!c)return p;var g=e(c);p.contentPosition[r]=-g.s;for(var m=u+1,v=g,y=g,x=null;m<=d;++m)(!(x=e(h[m]))&&y.e>v.s+a||x&&!i(x,v.s))&&(v=y.i>v.i?y:x)&&(null==p.pageNextDataIndex&&(p.pageNextDataIndex=v.i),++p.pageCount),y=x;for(var m=u-1,v=g,y=g,x=null;m>=-1;--m)(x=e(h[m]))&&i(y,x.s)||!(v.i=0;){var r=o.indexOf("|}"),s=o.substr(a+"{marker".length,r-a-"{marker".length);s.indexOf("sub")>-1?n["marker"+s]={textWidth:4,textHeight:4,textBorderRadius:2,textBackgroundColor:e[s],textOffset:[3,0]}:n["marker"+s]={textWidth:10,textHeight:10,textBorderRadius:5,textBackgroundColor:e[s]},a=(o=o.substr(r+1)).indexOf("{marker")}this.el=new rM({style:{rich:n,text:t,textLineHeight:20,textBackgroundColor:i.get("backgroundColor"),textBorderRadius:i.get("borderRadius"),textFill:i.get("textStyle.color"),textPadding:i.get("padding")},z:i.get("z")}),this._zr.add(this.el);var l=this;this.el.on("mouseover",function(){l._enterable&&(clearTimeout(l._hideTimeout),l._show=!0),l._inContent=!0}),this.el.on("mouseout",function(){l._enterable&&l._show&&l.hideLater(l._hideDelay),l._inContent=!1})},setEnterable:function(t){this._enterable=t},getSize:function(){var t=this.el.getBoundingRect();return[t.width,t.height]},moveTo:function(t,e){this.el&&this.el.attr("position",[t,e])},hide:function(){this.el?this.el.hide():true,this._show=!1},hideLater:function(t){!this._show||this._inContent&&this._enterable||(t?(this._hideDelay=t,this._show=!1,this._hideTimeout=setTimeout(m(this.hide,this),t)):this.hide())},isShow:function(){return this._show},getOuterSize:function(){return this.getSize()}};var uN=m,hN=d,cN=Vo,dN=new yM({shape:{x:-1,y:-1,width:2,height:2}});Ws({type:"tooltip",init:function(t,e){if(!U_.node){var i=t.getComponent("tooltip").get("renderMode");this._renderMode=Hi(i);var n;"html"===this._renderMode?(n=new Cv(e.getDom(),e),this._newLine="
"):(n=new Lv(e),this._newLine="\n"),this._tooltipContent=n}},render:function(t,e,i){if(!U_.node){this.group.removeAll(),this._tooltipModel=t,this._ecModel=e,this._api=i,this._lastDataByCoordSys=null,this._alwaysShowContent=t.get("alwaysShowContent");var n=this._tooltipContent;n.update(),n.setEnterable(t.get("enterable")),this._initGlobalListener(),this._keepShow()}},_initGlobalListener:function(){var t=this._tooltipModel.get("triggerOn");um("itemTooltip",this._api,uN(function(e,i,n){"none"!==t&&(t.indexOf(e)>=0?this._tryShow(i,n):"leave"===e&&this._hide(n))},this))},_keepShow:function(){var t=this._tooltipModel,e=this._ecModel,i=this._api;if(null!=this._lastX&&null!=this._lastY&&"none"!==t.get("triggerOn")){var n=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){n.manuallyShowTip(t,e,i,{x:n._lastX,y:n._lastY})})}},manuallyShowTip:function(t,e,i,n){if(n.from!==this.uid&&!U_.node){var o=Pv(n,i);this._ticket="";var a=n.dataByCoordSys;if(n.tooltip&&null!=n.x&&null!=n.y){var r=dN;r.position=[n.x,n.y],r.update(),r.tooltip=n.tooltip,this._tryShow({offsetX:n.x,offsetY:n.y,target:r},o)}else if(a)this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,event:{},dataByCoordSys:n.dataByCoordSys,tooltipOption:n.tooltipOption},o);else if(null!=n.seriesIndex){if(this._manuallyAxisShowTip(t,e,i,n))return;var s=xP(n,e),l=s.point[0],u=s.point[1];null!=l&&null!=u&&this._tryShow({offsetX:l,offsetY:u,position:n.position,target:s.el,event:{}},o)}else null!=n.x&&null!=n.y&&(i.dispatchAction({type:"updateAxisPointer",x:n.x,y:n.y}),this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,target:i.getZr().findHover(n.x,n.y).target,event:{}},o))}},manuallyHideTip:function(t,e,i,n){var o=this._tooltipContent;!this._alwaysShowContent&&this._tooltipModel&&o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=null,n.from!==this.uid&&this._hide(Pv(n,i))},_manuallyAxisShowTip:function(t,e,i,n){var o=n.seriesIndex,a=n.dataIndex,r=e.getComponent("axisPointer").coordSysAxesInfo;if(null!=o&&null!=a&&null!=r){var s=e.getSeriesByIndex(o);if(s&&"axis"===(t=kv([s.getData().getItemModel(a),s,(s.coordinateSystem||{}).model,t])).get("trigger"))return i.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:a,position:n.position}),!0}},_tryShow:function(t,e){var i=t.target;if(this._tooltipModel){this._lastX=t.offsetX,this._lastY=t.offsetY;var n=t.dataByCoordSys;n&&n.length?this._showAxisTooltip(n,t):i&&null!=i.dataIndex?(this._lastDataByCoordSys=null,this._showSeriesItemTooltip(t,i,e)):i&&i.tooltip?(this._lastDataByCoordSys=null,this._showComponentItemTooltip(t,i,e)):(this._lastDataByCoordSys=null,this._hide(e))}},_showOrMove:function(t,e){var i=t.get("showDelay");e=m(e,this),clearTimeout(this._showTimout),i>0?this._showTimout=setTimeout(e,i):e()},_showAxisTooltip:function(t,e){var i=this._ecModel,o=this._tooltipModel,a=[e.offsetX,e.offsetY],r=[],s=[],l=kv([e.tooltipOption,o]),u=this._renderMode,h=this._newLine,c={};hN(t,function(t){hN(t.dataByAxis,function(t){var e=i.getComponent(t.axisDim+"Axis",t.axisIndex),o=t.value,a=[];if(e&&null!=o){var l=Im(o,e.axis,i,t.seriesDataIndices,t.valueLabelOpt);d(t.seriesDataIndices,function(r){var h=i.getSeriesByIndex(r.seriesIndex),d=r.dataIndexInside,f=h&&h.getDataParams(d);if(f.axisDim=t.axisDim,f.axisIndex=t.axisIndex,f.axisType=t.axisType,f.axisId=t.axisId,f.axisValue=Xl(e.axis,o),f.axisValueLabel=l,f){s.push(f);var p,g=h.formatTooltip(d,!0,null,u);if(w(g)){p=g.html;var m=g.markers;n(c,m)}else p=g;a.push(p)}});var f=l;"html"!==u?r.push(a.join(h)):r.push((f?ia(f)+h:"")+a.join(h))}})},this),r.reverse(),r=r.join(this._newLine+this._newLine);var f=e.position;this._showOrMove(l,function(){this._updateContentNotChangedOnAxis(t)?this._updatePosition(l,f,a[0],a[1],this._tooltipContent,s):this._showTooltipContent(l,r,s,Math.random(),a[0],a[1],f,void 0,c)})},_showSeriesItemTooltip:function(t,e,i){var n=this._ecModel,o=e.seriesIndex,a=n.getSeriesByIndex(o),r=e.dataModel||a,s=e.dataIndex,l=e.dataType,u=r.getData(),h=kv([u.getItemModel(s),r,a&&(a.coordinateSystem||{}).model,this._tooltipModel]),c=h.get("trigger");if(null==c||"item"===c){var d,f,p=r.getDataParams(s,l),g=r.formatTooltip(s,!1,l,this._renderMode);w(g)?(d=g.html,f=g.markers):(d=g,f=null);var m="item_"+r.name+"_"+s;this._showOrMove(h,function(){this._showTooltipContent(h,d,p,m,t.offsetX,t.offsetY,t.position,t.target,f)}),i({type:"showTip",dataIndexInside:s,dataIndex:u.getRawIndex(s),seriesIndex:o,from:this.uid})}},_showComponentItemTooltip:function(t,e,i){var n=e.tooltip;if("string"==typeof n){var o=n;n={content:o,formatter:o}}var a=new No(n,this._tooltipModel,this._ecModel),r=a.get("content"),s=Math.random();this._showOrMove(a,function(){this._showTooltipContent(a,r,a.get("formatterParams")||{},s,t.offsetX,t.offsetY,t.position,e)}),i({type:"showTip",from:this.uid})},_showTooltipContent:function(t,e,i,n,o,a,r,s,l){if(this._ticket="",t.get("showContent")&&t.get("show")){var u=this._tooltipContent,h=t.get("formatter");r=r||t.get("position");var c=e;if(h&&"string"==typeof h)c=na(h,i,!0);else if("function"==typeof h){var d=uN(function(e,n){e===this._ticket&&(u.setContent(n,l,t),this._updatePosition(t,r,o,a,u,i,s))},this);this._ticket=n,c=h(i,n,d)}u.setContent(c,l,t),u.show(t),this._updatePosition(t,r,o,a,u,i,s)}},_updatePosition:function(t,e,i,n,o,a,r){var s=this._api.getWidth(),l=this._api.getHeight();e=e||t.get("position");var u=o.getSize(),h=t.get("align"),c=t.get("verticalAlign"),d=r&&r.getBoundingRect().clone();if(r&&d.applyTransform(r.transform),"function"==typeof e&&(e=e([i,n],a,o.el,d,{viewSize:[s,l],contentSize:u.slice()})),y(e))i=cN(e[0],s),n=cN(e[1],l);else if(w(e)){e.width=u[0],e.height=u[1];var f=ca(e,{width:s,height:l});i=f.x,n=f.y,h=null,c=null}else"string"==typeof e&&r?(i=(p=Ev(e,d,u))[0],n=p[1]):(i=(p=Nv(i,n,o,s,l,h?null:20,c?null:20))[0],n=p[1]);if(h&&(i-=Rv(h)?u[0]/2:"right"===h?u[0]:0),c&&(n-=Rv(c)?u[1]/2:"bottom"===c?u[1]:0),t.get("confine")){var p=Ov(i,n,o,s,l);i=p[0],n=p[1]}o.moveTo(i,n)},_updateContentNotChangedOnAxis:function(t){var e=this._lastDataByCoordSys,i=!!e&&e.length===t.length;return i&&hN(e,function(e,n){var o=e.dataByAxis||{},a=(t[n]||{}).dataByAxis||[];(i&=o.length===a.length)&&hN(o,function(t,e){var n=a[e]||{},o=t.seriesDataIndices||[],r=n.seriesDataIndices||[];(i&=t.value===n.value&&t.axisType===n.axisType&&t.axisId===n.axisId&&o.length===r.length)&&hN(o,function(t,e){var n=r[e];i&=t.seriesIndex===n.seriesIndex&&t.dataIndex===n.dataIndex})})}),this._lastDataByCoordSys=t,!!i},_hide:function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},dispose:function(t,e){U_.node||(this._tooltipContent.hide(),gm("itemTooltip",e))}}),Es({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},function(){}),Es({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},function(){}),Gv.prototype={constructor:Gv,pointToData:function(t,e){return this.polar.pointToData(t,e)["radius"===this.dim?0:1]},dataToRadius:aD.prototype.dataToCoord,radiusToData:aD.prototype.coordToData},u(Gv,aD);var fN=Bi();Fv.prototype={constructor:Fv,pointToData:function(t,e){return this.polar.pointToData(t,e)["radius"===this.dim?0:1]},dataToAngle:aD.prototype.dataToCoord,angleToData:aD.prototype.coordToData,calculateCategoryInterval:function(){var t=this,e=t.getLabelModel(),i=t.scale,n=i.getExtent(),o=i.count();if(n[1]-n[0]<1)return 0;var a=n[0],r=t.dataToCoord(a+1)-t.dataToCoord(a),s=Math.abs(r),l=ke(a,e.getFont(),"center","top"),u=Math.max(l.height,7)/s;isNaN(u)&&(u=1/0);var h=Math.max(0,Math.floor(u)),c=fN(t.model),d=c.lastAutoInterval,f=c.lastTickCount;return null!=d&&null!=f&&Math.abs(d-h)<=1&&Math.abs(f-o)<=1&&d>h?h=d:(c.lastTickCount=o,c.lastAutoInterval=h),h}},u(Fv,aD);var pN=function(t){this.name=t||"",this.cx=0,this.cy=0,this._radiusAxis=new Gv,this._angleAxis=new Fv,this._radiusAxis.polar=this._angleAxis.polar=this};pN.prototype={type:"polar",axisPointerEnabled:!0,constructor:pN,dimensions:["radius","angle"],model:null,containPoint:function(t){var e=this.pointToCoord(t);return this._radiusAxis.contain(e[0])&&this._angleAxis.contain(e[1])},containData:function(t){return this._radiusAxis.containData(t[0])&&this._angleAxis.containData(t[1])},getAxis:function(t){return this["_"+t+"Axis"]},getAxes:function(){return[this._radiusAxis,this._angleAxis]},getAxesByScale:function(t){var e=[],i=this._angleAxis,n=this._radiusAxis;return i.scale.type===t&&e.push(i),n.scale.type===t&&e.push(n),e},getAngleAxis:function(){return this._angleAxis},getRadiusAxis:function(){return this._radiusAxis},getOtherAxis:function(t){var e=this._angleAxis;return t===e?this._radiusAxis:e},getBaseAxis:function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAngleAxis()},getTooltipAxes:function(t){var e=null!=t&&"auto"!==t?this.getAxis(t):this.getBaseAxis();return{baseAxes:[e],otherAxes:[this.getOtherAxis(e)]}},dataToPoint:function(t,e){return this.coordToPoint([this._radiusAxis.dataToRadius(t[0],e),this._angleAxis.dataToAngle(t[1],e)])},pointToData:function(t,e){var i=this.pointToCoord(t);return[this._radiusAxis.radiusToData(i[0],e),this._angleAxis.angleToData(i[1],e)]},pointToCoord:function(t){var e=t[0]-this.cx,i=t[1]-this.cy,n=this.getAngleAxis(),o=n.getExtent(),a=Math.min(o[0],o[1]),r=Math.max(o[0],o[1]);n.inverse?a=r-360:r=a+360;var s=Math.sqrt(e*e+i*i);e/=s,i/=s;for(var l=Math.atan2(-i,e)/Math.PI*180,u=lr;)l+=360*u;return[s,l]},coordToPoint:function(t){var e=t[0],i=t[1]/180*Math.PI;return[Math.cos(i)*e+this.cx,-Math.sin(i)*e+this.cy]}};var gN=lI.extend({type:"polarAxis",axis:null,getCoordSysModel:function(){return this.ecModel.queryComponents({mainType:"polar",index:this.option.polarIndex,id:this.option.polarId})[0]}});n(gN.prototype,UA);var mN={angle:{startAngle:90,clockwise:!0,splitNumber:12,axisLabel:{rotate:!1}},radius:{splitNumber:5}};ED("angle",gN,Wv,mN.angle),ED("radius",gN,Wv,mN.radius),Fs({type:"polar",dependencies:["polarAxis","angleAxis"],coordinateSystem:null,findAxisModel:function(t){var e;return this.ecModel.eachComponent(t,function(t){t.getCoordSysModel()===this&&(e=t)},this),e},defaultOption:{zlevel:0,z:0,center:["50%","50%"],radius:"80%"}});var vN={dimensions:pN.prototype.dimensions,create:function(t,e){var i=[];return t.eachComponent("polar",function(t,n){var o=new pN(n);o.update=Zv;var a=o.getRadiusAxis(),r=o.getAngleAxis(),s=t.findAxisModel("radiusAxis"),l=t.findAxisModel("angleAxis");Uv(a,s),Uv(r,l),Hv(o,t,e),i.push(o),t.coordinateSystem=o,o.model=t}),t.eachSeries(function(e){if("polar"===e.get("coordinateSystem")){var i=t.queryComponents({mainType:"polar",index:e.get("polarIndex"),id:e.get("polarId")})[0];e.coordinateSystem=i.coordinateSystem}}),i}};Fa.register("polar",vN);var yN=["axisLine","axisLabel","axisTick","splitLine","splitArea"];XD.extend({type:"angleAxis",axisPointerClass:"PolarAxisPointer",render:function(t,e){if(this.group.removeAll(),t.get("show")){var n=t.axis,o=n.polar,a=o.getRadiusAxis().getExtent(),r=n.getTicksCoords(),s=f(n.getViewLabels(),function(t){return(t=i(t)).coord=n.dataToCoord(t.tickValue),t});Yv(s),Yv(r),d(yN,function(e){!t.get(e+".show")||n.scale.isBlank()&&"axisLine"!==e||this["_"+e](t,o,r,a,s)},this)}},_axisLine:function(t,e,i,n){var o=t.getModel("axisLine.lineStyle"),a=new sM({shape:{cx:e.cx,cy:e.cy,r:n[jv(e)]},style:o.getLineStyle(),z2:1,silent:!0});a.style.fill=null,this.group.add(a)},_axisTick:function(t,e,i,n){var o=t.getModel("axisTick"),a=(o.get("inside")?-1:1)*o.get("length"),s=n[jv(e)],l=f(i,function(t){return new _M({shape:Xv(e,[s,s+a],t.coord)})});this.group.add(OM(l,{style:r(o.getModel("lineStyle").getLineStyle(),{stroke:t.get("axisLine.lineStyle.color")})}))},_axisLabel:function(t,e,i,n,o){var a=t.getCategories(!0),r=t.getModel("axisLabel"),s=r.get("margin");d(o,function(i,o){var l=r,u=i.tickValue,h=n[jv(e)],c=e.coordToPoint([h+s,i.coord]),d=e.cx,f=e.cy,p=Math.abs(c[0]-d)/h<.3?"center":c[0]>d?"left":"right",g=Math.abs(c[1]-f)/h<.3?"middle":c[1]>f?"top":"bottom";a&&a[u]&&a[u].textStyle&&(l=new No(a[u].textStyle,r,r.ecModel));var m=new rM({silent:!0});this.group.add(m),mo(m.style,l,{x:c[0],y:c[1],textFill:l.getTextColor()||t.get("axisLine.lineStyle.color"),text:i.formattedLabel,textAlign:p,textVerticalAlign:g})},this)},_splitLine:function(t,e,i,n){var o=t.getModel("splitLine").getModel("lineStyle"),a=o.get("color"),s=0;a=a instanceof Array?a:[a];for(var l=[],u=0;u=0?"p":"n",M=y;v&&(n[r][b]||(n[r][b]={p:y,n:y}),M=n[r][b][S]);var I,T,A,D;if("radius"===h.dim){var C=h.dataToRadius(w)-y,L=a.dataToAngle(b);Math.abs(C)=0},kN.findTargetInfo=function(t,e){for(var i=this._targetInfoList,n=dy(e,t),o=0;o=0||AN(n,t.getAxis("y").model)>=0)&&a.push(t)}),e.push({panelId:"grid--"+t.id,gridModel:t,coordSysModel:t,coordSys:a[0],coordSyses:a,getPanelRect:ON.grid,xAxisDeclared:r[t.id],yAxisDeclared:s[t.id]})}))},geo:function(t,e){TN(t.geoModels,function(t){var i=t.coordinateSystem;e.push({panelId:"geo--"+t.id,geoModel:t,coordSysModel:t,coordSys:i,coordSyses:[i],getPanelRect:ON.geo})})}},NN=[function(t,e){var i=t.xAxisModel,n=t.yAxisModel,o=t.gridModel;return!o&&i&&(o=i.axis.grid.model),!o&&n&&(o=n.axis.grid.model),o&&o===e.gridModel},function(t,e){var i=t.geoModel;return i&&i===e.geoModel}],ON={grid:function(){return this.coordSys.grid.getRect().clone()},geo:function(){var t=this.coordSys,e=t.getBoundingRect().clone();return e.applyTransform(Ao(t)),e}},EN={lineX:DN(fy,0),lineY:DN(fy,1),rect:function(t,e,i){var n=e[CN[t]]([i[0][0],i[1][0]]),o=e[CN[t]]([i[0][1],i[1][1]]),a=[cy([n[0],o[0]]),cy([n[1],o[1]])];return{values:a,xyMinMax:a}},polygon:function(t,e,i){var n=[[1/0,-1/0],[1/0,-1/0]];return{values:f(i,function(i){var o=e[CN[t]](i);return n[0][0]=Math.min(n[0][0],o[0]),n[1][0]=Math.min(n[1][0],o[1]),n[0][1]=Math.max(n[0][1],o[0]),n[1][1]=Math.max(n[1][1],o[1]),o}),xyMinMax:n}}},RN={lineX:DN(py,0),lineY:DN(py,1),rect:function(t,e,i){return[[t[0][0]-i[0]*e[0][0],t[0][1]-i[0]*e[0][1]],[t[1][0]-i[1]*e[1][0],t[1][1]-i[1]*e[1][1]]]},polygon:function(t,e,i){return f(t,function(t,n){return[t[0]-i[0]*e[n][0],t[1]-i[1]*e[n][1]]})}},zN=["inBrush","outOfBrush"],BN="__ecBrushSelect",VN="__ecInBrushSelectEvent",GN=VT.VISUAL.BRUSH;zs(GN,function(t,e,i){t.eachComponent({mainType:"brush"},function(e){i&&"takeGlobalCursor"===i.type&&e.setBrushOption("brush"===i.key?i.brushOption:{brushType:!1}),(e.brushTargetManager=new hy(e.option,t)).setInputRanges(e.areas,t)})}),Bs(GN,function(t,e,n){var o,a,s=[];t.eachComponent({mainType:"brush"},function(e,n){function l(t){return"all"===m||v[t]}function u(t){return!!t.length}function h(t,e){var i=t.coordinateSystem;w|=i.hasAxisBrushed(),l(e)&&i.eachActiveState(t.getData(),function(t,e){"active"===t&&(x[e]=1)})}function c(i,n,o){var a=_y(i);if(a&&!wy(e,n)&&(d(b,function(n){a[n.brushType]&&e.brushTargetManager.controlSeries(n,i,t)&&o.push(n),w|=u(o)}),l(n)&&u(o))){var r=i.getData();r.each(function(t){xy(a,o,r,t)&&(x[t]=1)})}}var p={brushId:e.id,brushIndex:n,brushName:e.name,areas:i(e.areas),selected:[]};s.push(p);var g=e.option,m=g.brushLink,v=[],x=[],_=[],w=0;n||(o=g.throttleType,a=g.throttleDelay);var b=f(e.areas,function(t){return by(r({boundingRect:FN[t.brushType](t)},t))}),S=ty(e.option,zN,function(t){t.mappingMethod="fixed"});y(m)&&d(m,function(t){v[t]=1}),t.eachSeries(function(t,e){var i=_[e]=[];"parallel"===t.subType?h(t,e):c(t,e,i)}),t.eachSeries(function(t,e){var i={seriesId:t.id,seriesIndex:e,seriesName:t.name,dataIndex:[]};p.selected.push(i);var n=_y(t),o=_[e],a=t.getData(),r=l(e)?function(t){return x[t]?(i.dataIndex.push(a.getRawIndex(t)),"inBrush"):"outOfBrush"}:function(t){return xy(n,o,a,t)?(i.dataIndex.push(a.getRawIndex(t)),"inBrush"):"outOfBrush"};(l(e)?w:u(o))&&iy(zN,S,a,r)})}),vy(e,o,a,s,n)});var FN={lineX:B,lineY:B,rect:function(t){return Sy(t.range)},polygon:function(t){for(var e,i=t.range,n=0,o=i.length;ne[0][1]&&(e[0][1]=a[0]),a[1]e[1][1]&&(e[1][1]=a[1])}return e&&Sy(e)}},WN=["#ddd"];Fs({type:"brush",dependencies:["geo","grid","xAxis","yAxis","parallel","series"],defaultOption:{toolbox:null,brushLink:null,seriesIndex:"all",geoIndex:null,xAxisIndex:null,yAxisIndex:null,brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:"rgba(120,140,180,0.3)",borderColor:"rgba(120,140,180,0.8)"},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4},areas:[],brushType:null,brushOption:{},coordInfoList:[],optionUpdated:function(t,e){var i=this.option;!e&&ey(i,t,["inBrush","outOfBrush"]);var n=i.inBrush=i.inBrush||{};i.outOfBrush=i.outOfBrush||{color:WN},n.hasOwnProperty("liftZ")||(n.liftZ=5)},setAreas:function(t){t&&(this.areas=f(t,function(t){return My(this.option,t)},this))},setBrushOption:function(t){this.brushOption=My(this.option,t),this.brushType=this.brushOption.brushType}});Ws({type:"brush",init:function(t,e){this.ecModel=t,this.api=e,this.model,(this._brushController=new zf(e.getZr())).on("brush",m(this._onBrush,this)).mount()},render:function(t){return this.model=t,Iy.apply(this,arguments)},updateTransform:Iy,updateView:Iy,dispose:function(){this._brushController.dispose()},_onBrush:function(t,e){var n=this.model.id;this.model.brushTargetManager.setOutputRanges(t,this.ecModel),(!e.isEnd||e.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:n,areas:i(t),$from:n})}}),Es({type:"brush",event:"brush"},function(t,e){e.eachComponent({mainType:"brush",query:t},function(e){e.setAreas(t.areas)})}),Es({type:"brushSelect",event:"brushSelected",update:"none"},function(){});var HN={},ZN=rT.toolbox.brush;Dy.defaultOption={show:!0,type:["rect","polygon","lineX","lineY","keep","clear"],icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:i(ZN.title)};var UN=Dy.prototype;UN.render=UN.updateView=function(t,e,i){var n,o,a;e.eachComponent({mainType:"brush"},function(t){n=t.brushType,o=t.brushOption.brushMode||"single",a|=t.areas.length}),this._brushType=n,this._brushMode=o,d(t.get("type",!0),function(e){t.setIconStatus(e,("keep"===e?"multiple"===o:"clear"===e?a:e===n)?"emphasis":"normal")})},UN.getIcons=function(){var t=this.model,e=t.get("icon",!0),i={};return d(t.get("type",!0),function(t){e[t]&&(i[t]=e[t])}),i},UN.onclick=function(t,e,i){var n=this._brushType,o=this._brushMode;"clear"===i?(e.dispatchAction({type:"axisAreaSelect",intervals:[]}),e.dispatchAction({type:"brush",command:"clear",areas:[]})):e.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:"keep"===i?n:n!==i&&i,brushMode:"keep"===i?"multiple"===o?"single":"multiple":o}})},Ty("brush",Dy),Ns(function(t,e){var i=t&&t.brush;if(y(i)||(i=i?[i]:[]),i.length){var n=[];d(i,function(t){var e=t.hasOwnProperty("toolbox")?t.toolbox:[];e instanceof Array&&(n=n.concat(e))});var o=t&&t.toolbox;y(o)&&(o=o[0]),o||(o={feature:{}},t.toolbox=[o]);var a=o.feature||(o.feature={}),r=a.brush||(a.brush={}),s=r.type||(r.type=[]);s.push.apply(s,n),Jv(s),e&&!s.length&&s.push.apply(s,SN)}});Cy.prototype={constructor:Cy,type:"calendar",dimensions:["time","value"],getDimensionsInfo:function(){return[{name:"time",type:"time"},"value"]},getRangeInfo:function(){return this._rangeInfo},getModel:function(){return this._model},getRect:function(){return this._rect},getCellWidth:function(){return this._sw},getCellHeight:function(){return this._sh},getOrient:function(){return this._orient},getFirstDayOfWeek:function(){return this._firstDayOfWeek},getDateInfo:function(t){var e=(t=Yo(t)).getFullYear(),i=t.getMonth()+1;i=i<10?"0"+i:i;var n=t.getDate();n=n<10?"0"+n:n;var o=t.getDay();return o=Math.abs((o+7-this.getFirstDayOfWeek())%7),{y:e,m:i,d:n,day:o,time:t.getTime(),formatedDate:e+"-"+i+"-"+n,date:t}},getNextNDay:function(t,e){return 0===(e=e||0)?this.getDateInfo(t):((t=new Date(this.getDateInfo(t).time)).setDate(t.getDate()+e),this.getDateInfo(t))},update:function(t,e){function i(t,e){return null!=t[e]&&"auto"!==t[e]}this._firstDayOfWeek=+this._model.getModel("dayLabel").get("firstDay"),this._orient=this._model.get("orient"),this._lineWidth=this._model.getModel("itemStyle").getItemStyle().lineWidth||0,this._rangeInfo=this._getRangeInfo(this._initRangeOption());var n=this._rangeInfo.weeks||1,o=["width","height"],a=this._model.get("cellSize").slice(),r=this._model.getBoxLayoutParams(),s="horizontal"===this._orient?[n,7]:[7,n];d([0,1],function(t){i(a,t)&&(r[o[t]]=a[t]*s[t])});var l={width:e.getWidth(),height:e.getHeight()},u=this._rect=ca(r,l);d([0,1],function(t){i(a,t)||(a[t]=u[o[t]]/s[t])}),this._sw=a[0],this._sh=a[1]},dataToPoint:function(t,e){y(t)&&(t=t[0]),null==e&&(e=!0);var i=this.getDateInfo(t),n=this._rangeInfo,o=i.formatedDate;if(e&&!(i.time>=n.start.time&&i.timea.end.time&&t.reverse(),t},_getRangeInfo:function(t){var e;(t=[this.getDateInfo(t[0]),this.getDateInfo(t[1])])[0].time>t[1].time&&(e=!0,t.reverse());var i=Math.floor(t[1].time/864e5)-Math.floor(t[0].time/864e5)+1,n=new Date(t[0].time),o=n.getDate(),a=t[1].date.getDate();if(n.setDate(o+i-1),n.getDate()!==a)for(var r=n.getTime()-t[1].time>0?1:-1;n.getDate()!==a&&(n.getTime()-t[1].time)*r>0;)i-=r,n.setDate(o+i-1);var s=Math.floor((i+t[0].day+6)/7),l=e?1-s:s-1;return e&&t.reverse(),{range:[t[0].formatedDate,t[1].formatedDate],start:t[0],end:t[1],allDay:i,weeks:s,nthWeek:l,fweek:t[0].day,lweek:t[1].day}},_getDateByWeeksAndDay:function(t,e,i){var n=this._getRangeInfo(i);if(t>n.weeks||0===t&&en.lweek)return!1;var o=7*(t-1)-n.fweek+e,a=new Date(n.start.time);return a.setDate(n.start.d+o),this.getDateInfo(a)}},Cy.dimensions=Cy.prototype.dimensions,Cy.getDimensionsInfo=Cy.prototype.getDimensionsInfo,Cy.create=function(t,e){var i=[];return t.eachComponent("calendar",function(n){var o=new Cy(n,t,e);i.push(o),n.coordinateSystem=o}),t.eachSeries(function(t){"calendar"===t.get("coordinateSystem")&&(t.coordinateSystem=i[t.get("calendarIndex")||0])}),i},Fa.register("calendar",Cy);var XN=lI.extend({type:"calendar",coordinateSystem:null,defaultOption:{zlevel:0,z:2,left:80,top:60,cellSize:20,orient:"horizontal",splitLine:{show:!0,lineStyle:{color:"#000",width:1,type:"solid"}},itemStyle:{color:"#fff",borderWidth:1,borderColor:"#ccc"},dayLabel:{show:!0,firstDay:0,position:"start",margin:"50%",nameMap:"en",color:"#000"},monthLabel:{show:!0,position:"start",margin:5,align:"center",nameMap:"en",formatter:null,color:"#000"},yearLabel:{show:!0,position:null,margin:30,formatter:null,color:"#ccc",fontFamily:"sans-serif",fontWeight:"bolder",fontSize:20}},init:function(t,e,i,n){var o=ga(t);XN.superApply(this,"init",arguments),ky(t,o)},mergeOption:function(t,e){XN.superApply(this,"mergeOption",arguments),ky(this.option,t)}}),jN={EN:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],CN:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},YN={EN:["S","M","T","W","T","F","S"],CN:["日","一","二","三","四","五","六"]};Ws({type:"calendar",_tlpoints:null,_blpoints:null,_firstDayOfMonth:null,_firstDayPoints:null,render:function(t,e,i){var n=this.group;n.removeAll();var o=t.coordinateSystem,a=o.getRangeInfo(),r=o.getOrient();this._renderDayRect(t,a,n),this._renderLines(t,a,r,n),this._renderYearText(t,a,r,n),this._renderMonthText(t,r,n),this._renderWeekText(t,a,r,n)},_renderDayRect:function(t,e,i){for(var n=t.coordinateSystem,o=t.getModel("itemStyle").getItemStyle(),a=n.getCellWidth(),r=n.getCellHeight(),s=e.start.time;s<=e.end.time;s=n.getNextNDay(s,1).time){var l=n.dataToRect([s],!1).tl,u=new yM({shape:{x:l[0],y:l[1],width:a,height:r},cursor:"default",style:o});i.add(u)}},_renderLines:function(t,e,i,n){function o(e){a._firstDayOfMonth.push(r.getDateInfo(e)),a._firstDayPoints.push(r.dataToRect([e],!1).tl);var o=a._getLinePointsOfOneWeek(t,e,i);a._tlpoints.push(o[0]),a._blpoints.push(o[o.length-1]),l&&a._drawSplitline(o,s,n)}var a=this,r=t.coordinateSystem,s=t.getModel("splitLine.lineStyle").getLineStyle(),l=t.get("splitLine.show"),u=s.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var h=e.start,c=0;h.time<=e.end.time;c++){o(h.formatedDate),0===c&&(h=r.getDateInfo(e.start.y+"-"+e.start.m));var d=h.date;d.setMonth(d.getMonth()+1),h=r.getDateInfo(d)}o(r.getNextNDay(e.end.time,1).formatedDate),l&&this._drawSplitline(a._getEdgesPoints(a._tlpoints,u,i),s,n),l&&this._drawSplitline(a._getEdgesPoints(a._blpoints,u,i),s,n)},_getEdgesPoints:function(t,e,i){var n=[t[0].slice(),t[t.length-1].slice()],o="horizontal"===i?0:1;return n[0][o]=n[0][o]-e/2,n[1][o]=n[1][o]+e/2,n},_drawSplitline:function(t,e,i){var n=new gM({z2:20,shape:{points:t},style:e});i.add(n)},_getLinePointsOfOneWeek:function(t,e,i){var n=t.coordinateSystem;e=n.getDateInfo(e);for(var o=[],a=0;a<7;a++){var r=n.getNextNDay(e.time,a),s=n.dataToRect([r.time],!1);o[2*r.day]=s.tl,o[2*r.day+1]=s["horizontal"===i?"bl":"tr"]}return o},_formatterLabel:function(t,e){return"string"==typeof t&&t?oa(t,e):"function"==typeof t?t(e):e.nameMap},_yearTextPositionControl:function(t,e,i,n,o){e=e.slice();var a=["center","bottom"];"bottom"===n?(e[1]+=o,a=["center","top"]):"left"===n?e[0]-=o:"right"===n?(e[0]+=o,a=["center","top"]):e[1]-=o;var r=0;return"left"!==n&&"right"!==n||(r=Math.PI/2),{rotation:r,position:e,style:{textAlign:a[0],textVerticalAlign:a[1]}}},_renderYearText:function(t,e,i,n){var o=t.getModel("yearLabel");if(o.get("show")){var a=o.get("margin"),r=o.get("position");r||(r="horizontal"!==i?"top":"left");var s=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],l=(s[0][0]+s[1][0])/2,u=(s[0][1]+s[1][1])/2,h="horizontal"===i?0:1,c={top:[l,s[h][1]],bottom:[l,s[1-h][1]],left:[s[1-h][0],u],right:[s[h][0],u]},d=e.start.y;+e.end.y>+e.start.y&&(d=d+"-"+e.end.y);var f=o.get("formatter"),p={start:e.start.y,end:e.end.y,nameMap:d},g=this._formatterLabel(f,p),m=new rM({z2:30});mo(m.style,o,{text:g}),m.attr(this._yearTextPositionControl(m,c[r],i,r,a)),n.add(m)}},_monthTextPositionControl:function(t,e,i,n,o){var a="left",r="top",s=t[0],l=t[1];return"horizontal"===i?(l+=o,e&&(a="center"),"start"===n&&(r="bottom")):(s+=o,e&&(r="middle"),"start"===n&&(a="right")),{x:s,y:l,textAlign:a,textVerticalAlign:r}},_renderMonthText:function(t,e,i){var n=t.getModel("monthLabel");if(n.get("show")){var o=n.get("nameMap"),r=n.get("margin"),s=n.get("position"),l=n.get("align"),u=[this._tlpoints,this._blpoints];_(o)&&(o=jN[o.toUpperCase()]||[]);var h="start"===s?0:1,c="horizontal"===e?0:1;r="start"===s?-r:r;for(var d="center"===l,f=0;f=r[0]&&t<=r[1]}if(t===this._dataZoomModel){var n=this._dimName,o=this.getTargetSeriesModels(),a=t.get("filterMode"),r=this._valueWindow;"none"!==a&&$N(o,function(t){var e=t.getData(),o=e.mapDimension(n,!0);o.length&&("weakFilter"===a?e.filterSelf(function(t){for(var i,n,a,s=0;sr[1];if(u&&!h&&!c)return!0;u&&(a=!0),h&&(i=!0),c&&(n=!0)}return a&&i&&n}):$N(o,function(n){if("empty"===a)t.setData(e.map(n,function(t){return i(t)?t:NaN}));else{var o={};o[n]=r,e.selectRange(o)}}),$N(o,function(t){e.setApproximateExtent(r,t)}))})}}};var tO=d,eO=KN,iO=Fs({type:"dataZoom",dependencies:["xAxis","yAxis","zAxis","radiusAxis","angleAxis","singleAxis","series"],defaultOption:{zlevel:0,z:4,orient:null,xAxisIndex:null,yAxisIndex:null,filterMode:"filter",throttle:null,start:0,end:100,startValue:null,endValue:null,minSpan:null,maxSpan:null,minValueSpan:null,maxValueSpan:null,rangeMode:null},init:function(t,e,i){this._dataIntervalByAxis={},this._dataInfo={},this._axisProxies={},this.textStyleModel,this._autoThrottle=!0,this._rangePropMode=["percent","percent"];var n=By(t);this.mergeDefaultAndTheme(t,i),this.doInit(n)},mergeOption:function(t){var e=By(t);n(this.option,t,!0),this.doInit(e)},doInit:function(t){var e=this.option;U_.canvasSupported||(e.realtime=!1),this._setDefaultThrottle(t),Vy(this,t),tO([["start","startValue"],["end","endValue"]],function(t,i){"value"===this._rangePropMode[i]&&(e[t[0]]=null)},this),this.textStyleModel=this.getModel("textStyle"),this._resetTarget(),this._giveAxisProxies()},_giveAxisProxies:function(){var t=this._axisProxies;this.eachTargetAxis(function(e,i,n,o){var a=this.dependentModels[e.axis][i],r=a.__dzAxisProxy||(a.__dzAxisProxy=new QN(e.name,i,this,o));t[e.name+"_"+i]=r},this)},_resetTarget:function(){var t=this.option,e=this._judgeAutoMode();eO(function(e){var i=e.axisIndex;t[i]=Di(t[i])},this),"axisIndex"===e?this._autoSetAxisIndex():"orient"===e&&this._autoSetOrient()},_judgeAutoMode:function(){var t=this.option,e=!1;eO(function(i){null!=t[i.axisIndex]&&(e=!0)},this);var i=t.orient;return null==i&&e?"orient":e?void 0:(null==i&&(t.orient="horizontal"),"axisIndex")},_autoSetAxisIndex:function(){var t=!0,e=this.get("orient",!0),i=this.option,n=this.dependentModels;if(t){var o="vertical"===e?"y":"x";n[o+"Axis"].length?(i[o+"AxisIndex"]=[0],t=!1):tO(n.singleAxis,function(n){t&&n.get("orient",!0)===e&&(i.singleAxisIndex=[n.componentIndex],t=!1)})}t&&eO(function(e){if(t){var n=[],o=this.dependentModels[e.axis];if(o.length&&!n.length)for(var a=0,r=o.length;a0?100:20}},getFirstTargetAxisModel:function(){var t;return eO(function(e){if(null==t){var i=this.get(e.axisIndex);i.length&&(t=this.dependentModels[e.axis][i[0]])}},this),t},eachTargetAxis:function(t,e){var i=this.ecModel;eO(function(n){tO(this.get(n.axisIndex),function(o){t.call(e,n,o,this,i)},this)},this)},getAxisProxy:function(t,e){return this._axisProxies[t+"_"+e]},getAxisModel:function(t,e){var i=this.getAxisProxy(t,e);return i&&i.getAxisModel()},setRawRange:function(t,e){var i=this.option;tO([["start","startValue"],["end","endValue"]],function(e){null==t[e[0]]&&null==t[e[1]]||(i[e[0]]=t[e[0]],i[e[1]]=t[e[1]])},this),!e&&Vy(this,t)},getPercentRange:function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},getValueRange:function(t,e){if(null!=t||null!=e)return this.getAxisProxy(t,e).getDataValueWindow();var i=this.findRepresentativeAxisProxy();return i?i.getDataValueWindow():void 0},findRepresentativeAxisProxy:function(t){if(t)return t.__dzAxisProxy;var e=this._axisProxies;for(var i in e)if(e.hasOwnProperty(i)&&e[i].hostedBy(this))return e[i];for(var i in e)if(e.hasOwnProperty(i)&&!e[i].hostedBy(this))return e[i]},getRangePropMode:function(){return this._rangePropMode.slice()}}),nO=qI.extend({type:"dataZoom",render:function(t,e,i,n){this.dataZoomModel=t,this.ecModel=e,this.api=i},getTargetCoordInfo:function(){function t(t,e,i,n){for(var o,a=0;a0&&e%g)p+=f;else{var i=null==t||isNaN(t)||""===t,n=i?0:aO(t,a,u,!0);i&&!l&&e?(c.push([c[c.length-1][0],0]),d.push([d[d.length-1][0],0])):!i&&l&&(c.push([p,0]),d.push([p,0])),c.push([p,n]),d.push([p,n]),p+=f,l=i}});var m=this.dataZoomModel;this._displayables.barGroup.add(new pM({shape:{points:c},style:r({fill:m.get("dataBackgroundColor")},m.getModel("dataBackground.areaStyle").getAreaStyle()),silent:!0,z2:-20})),this._displayables.barGroup.add(new gM({shape:{points:d},style:m.getModel("dataBackground.lineStyle").getLineStyle(),silent:!0,z2:-19}))}}},_prepareDataShadowInfo:function(){var t=this.dataZoomModel,e=t.get("showDataShadow");if(!1!==e){var i,n=this.ecModel;return t.eachTargetAxis(function(o,a){d(t.getAxisProxy(o.name,a).getTargetSeriesModels(),function(t){if(!(i||!0!==e&&l(cO,t.get("type"))<0)){var r,s=n.getComponent(o.axis,a).axis,u=Gy(o.name),h=t.coordinateSystem;null!=u&&h.getOtherAxis&&(r=h.getOtherAxis(s).inverse),u=t.getData().mapDimension(u),i={thisAxis:s,series:t,thisDim:o.name,otherDim:u,otherAxisInverse:r}}},this)},this),i}},_renderHandle:function(){var t=this._displayables,e=t.handles=[],i=t.handleLabels=[],n=this._displayables.barGroup,o=this._size,a=this.dataZoomModel;n.add(t.filler=new oO({draggable:!0,cursor:Fy(this._orient),drift:sO(this._onDragMove,this,"all"),onmousemove:function(t){mw(t.event)},ondragstart:sO(this._showDataInfo,this,!0),ondragend:sO(this._onDragEnd,this),onmouseover:sO(this._showDataInfo,this,!0),onmouseout:sO(this._showDataInfo,this,!1),style:{fill:a.get("fillerColor"),textPosition:"inside"}})),n.add(new oO($n({silent:!0,shape:{x:0,y:0,width:o[0],height:o[1]},style:{stroke:a.get("dataBackgroundColor")||a.get("borderColor"),lineWidth:1,fill:"rgba(0,0,0,0)"}}))),lO([0,1],function(t){var o=Po(a.get("handleIcon"),{cursor:Fy(this._orient),draggable:!0,drift:sO(this._onDragMove,this,t),onmousemove:function(t){mw(t.event)},ondragend:sO(this._onDragEnd,this),onmouseover:sO(this._showDataInfo,this,!0),onmouseout:sO(this._showDataInfo,this,!1)},{x:-1,y:0,width:2,height:2}),r=o.getBoundingRect();this._handleHeight=Vo(a.get("handleSize"),this._size[1]),this._handleWidth=r.width/r.height*this._handleHeight,o.setStyle(a.getModel("handleStyle").getItemStyle());var s=a.get("handleColor");null!=s&&(o.style.fill=s),n.add(e[t]=o);var l=a.textStyleModel;this.group.add(i[t]=new rM({silent:!0,invisible:!0,style:{x:0,y:0,text:"",textVerticalAlign:"middle",textAlign:"center",textFill:l.getTextColor(),textFont:l.getFont()},z2:10}))},this)},_resetInterval:function(){var t=this._range=this.dataZoomModel.getPercentRange(),e=this._getViewExtent();this._handleEnds=[aO(t[0],[0,100],e,!0),aO(t[1],[0,100],e,!0)]},_updateInterval:function(t,e){var i=this.dataZoomModel,n=this._handleEnds,o=this._getViewExtent(),a=i.findRepresentativeAxisProxy().getMinMaxSpan(),r=[0,100];QL(e,n,o,i.get("zoomLock")?"all":t,null!=a.minSpan?aO(a.minSpan,r,o,!0):null,null!=a.maxSpan?aO(a.maxSpan,r,o,!0):null);var s=this._range,l=this._range=rO([aO(n[0],o,r,!0),aO(n[1],o,r,!0)]);return!s||s[0]!==l[0]||s[1]!==l[1]},_updateView:function(t){var e=this._displayables,i=this._handleEnds,n=rO(i.slice()),o=this._size;lO([0,1],function(t){var n=e.handles[t],a=this._handleHeight;n.attr({scale:[a/2,a/2],position:[i[t],o[1]/2-a/2]})},this),e.filler.setShape({x:n[0],y:0,width:n[1]-n[0],height:o[1]}),this._updateDataInfo(t)},_updateDataInfo:function(t){function e(t){var e=Ao(n.handles[t].parent,this.group),i=Co(0===t?"right":"left",e),s=this._handleWidth/2+hO,l=Do([c[t]+(0===t?-s:s),this._size[1]/2],e);o[t].setStyle({x:l[0],y:l[1],textVerticalAlign:a===uO?"middle":i,textAlign:a===uO?i:"center",text:r[t]})}var i=this.dataZoomModel,n=this._displayables,o=n.handleLabels,a=this._orient,r=["",""];if(i.get("showDetail")){var s=i.findRepresentativeAxisProxy();if(s){var l=s.getAxisModel().axis,u=this._range,h=t?s.calculateDataWindow({start:u[0],end:u[1]}).valueWindow:s.getDataValueWindow();r=[this._formatLabel(h[0],l),this._formatLabel(h[1],l)]}}var c=rO(this._handleEnds.slice());e.call(this,0),e.call(this,1)},_formatLabel:function(t,e){var i=this.dataZoomModel,n=i.get("labelFormatter"),o=i.get("labelPrecision");null!=o&&"auto"!==o||(o=e.getPixelPrecision());var a=null==t||isNaN(t)?"":"category"===e.type||"time"===e.type?e.scale.getLabel(Math.round(t)):t.toFixed(Math.min(o,20));return x(n)?n(t,a):_(n)?n.replace("{value}",a):a},_showDataInfo:function(t){t=this._dragging||t;var e=this._displayables.handleLabels;e[0].attr("invisible",!t),e[1].attr("invisible",!t)},_onDragMove:function(t,e,i){this._dragging=!0;var n=Do([e,i],this._displayables.barGroup.getLocalTransform(),!0),o=this._updateInterval(t,n[0]),a=this.dataZoomModel.get("realtime");this._updateView(!a),o&&a&&this._dispatchZoomAction()},_onDragEnd:function(){this._dragging=!1,this._showDataInfo(!1),!this.dataZoomModel.get("realtime")&&this._dispatchZoomAction()},_onClickPanelClick:function(t){var e=this._size,i=this._displayables.barGroup.transformCoordToLocal(t.offsetX,t.offsetY);if(!(i[0]<0||i[0]>e[0]||i[1]<0||i[1]>e[1])){var n=this._handleEnds,o=(n[0]+n[1])/2,a=this._updateInterval("all",i[0]-o);this._updateView(),a&&this._dispatchZoomAction()}},_dispatchZoomAction:function(){var t=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,start:t[0],end:t[1]})},_findCoordRect:function(){var t;if(lO(this.getTargetCoordInfo(),function(e){if(!t&&e.length){var i=e[0].model.coordinateSystem;t=i.getRect&&i.getRect()}}),!t){var e=this.api.getWidth(),i=this.api.getHeight();t={x:.2*e,y:.2*i,width:.6*e,height:.6*i}}return t}});iO.extend({type:"dataZoom.inside",defaultOption:{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}});var fO="\0_ec_dataZoom_roams",pO=m,gO=nO.extend({type:"dataZoom.inside",init:function(t,e){this._range},render:function(t,e,i,n){gO.superApply(this,"render",arguments),this._range=t.getPercentRange(),d(this.getTargetCoordInfo(),function(e,n){var o=f(e,function(t){return Zy(t.model)});d(e,function(e){var a=e.model,r={};d(["pan","zoom","scrollMove"],function(t){r[t]=pO(mO[t],this,e,n)},this),Wy(i,{coordId:Zy(a),allCoordIds:o,containsPoint:function(t,e,i){return a.coordinateSystem.containPoint([e,i])},dataZoomId:t.id,dataZoomModel:t,getRange:r})},this)},this)},dispose:function(){Hy(this.api,this.dataZoomModel.id),gO.superApply(this,"dispose",arguments),this._range=null}}),mO={zoom:function(t,e,i,n){var o=this._range,a=o.slice(),r=t.axisModels[0];if(r){var s=vO[e](null,[n.originX,n.originY],r,i,t),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],u=Math.max(1/n.scale,0);a[0]=(a[0]-l)*u+l,a[1]=(a[1]-l)*u+l;var h=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();return QL(0,a,[0,100],0,h.minSpan,h.maxSpan),this._range=a,o[0]!==a[0]||o[1]!==a[1]?a:void 0}},pan:Ky(function(t,e,i,n,o,a){var r=vO[n]([a.oldX,a.oldY],[a.newX,a.newY],e,o,i);return r.signal*(t[1]-t[0])*r.pixel/r.pixelLength}),scrollMove:Ky(function(t,e,i,n,o,a){return vO[n]([0,0],[a.scrollDelta,a.scrollDelta],e,o,i).signal*(t[1]-t[0])*a.scrollDelta})},vO={grid:function(t,e,i,n,o){var a=i.axis,r={},s=o.model.coordinateSystem.getRect();return t=t||[0,0],"x"===a.dim?(r.pixel=e[0]-t[0],r.pixelLength=s.width,r.pixelStart=s.x,r.signal=a.inverse?1:-1):(r.pixel=e[1]-t[1],r.pixelLength=s.height,r.pixelStart=s.y,r.signal=a.inverse?-1:1),r},polar:function(t,e,i,n,o){var a=i.axis,r={},s=o.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return t=t?s.pointToCoord(t):[0,0],e=s.pointToCoord(e),"radiusAxis"===i.mainType?(r.pixel=e[0]-t[0],r.pixelLength=l[1]-l[0],r.pixelStart=l[0],r.signal=a.inverse?1:-1):(r.pixel=e[1]-t[1],r.pixelLength=u[1]-u[0],r.pixelStart=u[0],r.signal=a.inverse?-1:1),r},singleAxis:function(t,e,i,n,o){var a=i.axis,r=o.model.coordinateSystem.getRect(),s={};return t=t||[0,0],"horizontal"===a.orient?(s.pixel=e[0]-t[0],s.pixelLength=r.width,s.pixelStart=r.x,s.signal=a.inverse?1:-1):(s.pixel=e[1]-t[1],s.pixelLength=r.height,s.pixelStart=r.y,s.signal=a.inverse?-1:1),s}};Os({getTargetSeries:function(t){var e=R();return t.eachComponent("dataZoom",function(t){t.eachTargetAxis(function(t,i,n){d(n.getAxisProxy(t.name,i).getTargetSeriesModels(),function(t){e.set(t.uid,t)})})}),e},modifyOutputEnd:!0,overallReset:function(t,e){t.eachComponent("dataZoom",function(t){t.eachTargetAxis(function(t,i,n){n.getAxisProxy(t.name,i).reset(n,e)}),t.eachTargetAxis(function(t,i,n){n.getAxisProxy(t.name,i).filterData(n,e)})}),t.eachComponent("dataZoom",function(t){var e=t.findRepresentativeAxisProxy(),i=e.getDataPercentWindow(),n=e.getDataValueWindow();t.setRawRange({start:i[0],end:i[1],startValue:n[0],endValue:n[1]},!0)})}}),Es("dataZoom",function(t,e){var i=Ny(m(e.eachComponent,e,"dataZoom"),KN,function(t,e){return t.get(e.axisIndex)}),n=[];e.eachComponent({mainType:"dataZoom",query:t},function(t,e){n.push.apply(n,i(t).nodes)}),d(n,function(e,i){e.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})})});var yO=d,xO=function(t){var e=t&&t.visualMap;y(e)||(e=e?[e]:[]),yO(e,function(t){if(t){$y(t,"splitList")&&!$y(t,"pieces")&&(t.pieces=t.splitList,delete t.splitList);var e=t.pieces;e&&y(e)&&yO(e,function(t){w(t)&&($y(t,"start")&&!$y(t,"min")&&(t.min=t.start),$y(t,"end")&&!$y(t,"max")&&(t.max=t.end))})}})};lI.registerSubTypeDefaulter("visualMap",function(t){return t.categories||(t.pieces?t.pieces.length>0:t.splitNumber>0)&&!t.calculable?"piecewise":"continuous"});var _O=VT.VISUAL.COMPONENT;Bs(_O,{createOnAllSeries:!0,reset:function(t,e){var i=[];return e.eachComponent("visualMap",function(e){var n=t.pipelineContext;!e.isTargetSeries(t)||n&&n.large||i.push(ny(e.stateList,e.targetVisuals,m(e.getValueState,e),e.getDataDimension(t.getData())))}),i}}),Bs(_O,{createOnAllSeries:!0,reset:function(t,e){var i=t.getData(),n=[];e.eachComponent("visualMap",function(e){if(e.isTargetSeries(t)){var o=e.getVisualMeta(m(Jy,null,t,e))||{stops:[],outerColors:[]},a=e.getDataDimension(i),r=i.getDimensionInfo(a);null!=r&&(o.dimension=r.index,n.push(o))}}),t.getData().setVisual("visualMeta",n)}});var wO={get:function(t,e,n){var o=i((bO[t]||{})[e]);return n&&y(o)?o[o.length-1]:o}},bO={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},SO=hL.mapVisual,MO=hL.eachVisual,IO=y,TO=d,AO=Fo,DO=Bo,CO=B,LO=Fs({type:"visualMap",dependencies:["series"],stateList:["inRange","outOfRange"],replacableOptionKeys:["inRange","outOfRange","target","controller","color"],dataBound:[-1/0,1/0],layoutMode:{type:"box",ignoreSize:!0},defaultOption:{show:!0,zlevel:0,z:4,seriesIndex:"all",min:0,max:200,dimension:null,inRange:null,outOfRange:null,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,color:null,formatter:null,text:null,textStyle:{color:"#333"}},init:function(t,e,i){this._dataExtent,this.targetVisuals={},this.controllerVisuals={},this.textStyleModel,this.itemSize,this.mergeDefaultAndTheme(t,i)},optionUpdated:function(t,e){var i=this.option;U_.canvasSupported||(i.realtime=!1),!e&&ey(i,t,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},resetVisual:function(t){var e=this.stateList;t=m(t,this),this.controllerVisuals=ty(this.option.controller,e,t),this.targetVisuals=ty(this.option.target,e,t)},getTargetSeriesIndices:function(){var t=this.option.seriesIndex,e=[];return null==t||"all"===t?this.ecModel.eachSeries(function(t,i){e.push(i)}):e=Di(t),e},eachTargetSeries:function(t,e){d(this.getTargetSeriesIndices(),function(i){t.call(e,this.ecModel.getSeriesByIndex(i))},this)},isTargetSeries:function(t){var e=!1;return this.eachTargetSeries(function(i){i===t&&(e=!0)}),e},formatValueText:function(t,e,i){function n(t){return t===l[0]?"min":t===l[1]?"max":(+t).toFixed(Math.min(s,20))}var o,a,r=this.option,s=r.precision,l=this.dataBound,u=r.formatter;return i=i||["<",">"],y(t)&&(t=t.slice(),o=!0),a=e?t:o?[n(t[0]),n(t[1])]:n(t),_(u)?u.replace("{value}",o?a[0]:a).replace("{value2}",o?a[1]:a):x(u)?o?u(t[0],t[1]):u(t):o?t[0]===l[0]?i[0]+" "+a[1]:t[1]===l[1]?i[1]+" "+a[0]:a[0]+" - "+a[1]:a},resetExtent:function(){var t=this.option,e=AO([t.min,t.max]);this._dataExtent=e},getDataDimension:function(t){var e=this.option.dimension,i=t.dimensions;if(null!=e||i.length){if(null!=e)return t.getDimension(e);for(var n=t.dimensions,o=n.length-1;o>=0;o--){var a=n[o];if(!t.getDimensionInfo(a).isCalculationCoord)return a}}},getExtent:function(){return this._dataExtent.slice()},completeVisualOption:function(){function t(t){IO(o.color)&&!t.inRange&&(t.inRange={color:o.color.slice().reverse()}),t.inRange=t.inRange||{color:e.get("gradientColor")},TO(this.stateList,function(e){var i=t[e];if(_(i)){var n=wO.get(i,"active",l);n?(t[e]={},t[e][i]=n):delete t[e]}},this)}var e=this.ecModel,o=this.option,a={inRange:o.inRange,outOfRange:o.outOfRange},r=o.target||(o.target={}),s=o.controller||(o.controller={});n(r,a),n(s,a);var l=this.isCategory();t.call(this,r),t.call(this,s),function(t,e,i){var n=t[e],o=t[i];n&&!o&&(o=t[i]={},TO(n,function(t,e){if(hL.isValidType(e)){var i=wO.get(e,"inactive",l);null!=i&&(o[e]=i,"color"!==e||o.hasOwnProperty("opacity")||o.hasOwnProperty("colorAlpha")||(o.opacity=[0,0]))}}))}.call(this,r,"inRange","outOfRange"),function(t){var e=(t.inRange||{}).symbol||(t.outOfRange||{}).symbol,n=(t.inRange||{}).symbolSize||(t.outOfRange||{}).symbolSize,o=this.get("inactiveColor");TO(this.stateList,function(a){var r=this.itemSize,s=t[a];s||(s=t[a]={color:l?o:[o]}),null==s.symbol&&(s.symbol=e&&i(e)||(l?"roundRect":["roundRect"])),null==s.symbolSize&&(s.symbolSize=n&&i(n)||(l?r[0]:[r[0],r[0]])),s.symbol=SO(s.symbol,function(t){return"none"===t||"square"===t?"roundRect":t});var u=s.symbolSize;if(null!=u){var h=-1/0;MO(u,function(t){t>h&&(h=t)}),s.symbolSize=SO(u,function(t){return DO(t,[0,h],[0,r[0]],!0)})}},this)}.call(this,s)},resetItemSize:function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},isCategory:function(){return!!this.option.categories},setSelected:CO,getValueState:CO,getVisualMeta:CO}),kO=[20,140],PO=LO.extend({type:"visualMap.continuous",defaultOption:{align:"auto",calculable:!1,range:null,realtime:!0,itemHeight:null,itemWidth:null,hoverLink:!0,hoverLinkDataSize:null,hoverLinkOnHandle:null},optionUpdated:function(t,e){PO.superApply(this,"optionUpdated",arguments),this.resetExtent(),this.resetVisual(function(t){t.mappingMethod="linear",t.dataExtent=this.getExtent()}),this._resetRange()},resetItemSize:function(){PO.superApply(this,"resetItemSize",arguments);var t=this.itemSize;"horizontal"===this._orient&&t.reverse(),(null==t[0]||isNaN(t[0]))&&(t[0]=kO[0]),(null==t[1]||isNaN(t[1]))&&(t[1]=kO[1])},_resetRange:function(){var t=this.getExtent(),e=this.option.range;!e||e.auto?(t.auto=1,this.option.range=t):y(e)&&(e[0]>e[1]&&e.reverse(),e[0]=Math.max(e[0],t[0]),e[1]=Math.min(e[1],t[1]))},completeVisualOption:function(){LO.prototype.completeVisualOption.apply(this,arguments),d(this.stateList,function(t){var e=this.option.controller[t].symbolSize;e&&e[0]!==e[1]&&(e[0]=0)},this)},setSelected:function(t){this.option.range=t.slice(),this._resetRange()},getSelected:function(){var t=this.getExtent(),e=Fo((this.get("range")||[]).slice());return e[0]>t[1]&&(e[0]=t[1]),e[1]>t[1]&&(e[1]=t[1]),e[0]=i[1]||t<=e[1])?"inRange":"outOfRange"},findTargetDataIndices:function(t){var e=[];return this.eachTargetSeries(function(i){var n=[],o=i.getData();o.each(this.getDataDimension(o),function(e,i){t[0]<=e&&e<=t[1]&&n.push(i)},this),e.push({seriesId:i.id,dataIndex:n})},this),e},getVisualMeta:function(t){function e(e,i){o.push({value:e,color:t(e,i)})}for(var i=Qy(0,0,this.getExtent()),n=Qy(0,0,this.option.range.slice()),o=[],a=0,r=0,s=n.length,l=i.length;rt[1])break;i.push({color:this.getControllerVisual(a,"color",e),offset:o/100})}return i.push({color:this.getControllerVisual(t[1],"color",e),offset:1}),i},_createBarPoints:function(t,e){var i=this.visualMapModel.itemSize;return[[i[0]-e[0],t[0]],[i[0],t[0]],[i[0],t[1]],[i[0]-e[1],t[1]]]},_createBarGroup:function(t){var e=this._orient,i=this.visualMapModel.get("inverse");return new tb("horizontal"!==e||i?"horizontal"===e&&i?{scale:"bottom"===t?[-1,1]:[1,1],rotation:-Math.PI/2}:"vertical"!==e||i?{scale:"left"===t?[1,1]:[-1,1]}:{scale:"left"===t?[1,-1]:[-1,-1]}:{scale:"bottom"===t?[1,1]:[-1,1],rotation:Math.PI/2})},_updateHandle:function(t,e){if(this._useHandle){var i=this._shapes,n=this.visualMapModel,o=i.handleThumbs,a=i.handleLabels;EO([0,1],function(r){var s=o[r];s.setStyle("fill",e.handlesColor[r]),s.position[1]=t[r];var l=Do(i.handleLabelPoints[r],Ao(s,this.group));a[r].setStyle({x:l[0],y:l[1],text:n.formatValueText(this._dataInterval[r]),textVerticalAlign:"middle",textAlign:this._applyTransform("horizontal"===this._orient?0===r?"bottom":"top":"left",i.barGroup)})},this)}},_showIndicator:function(t,e,i,n){var o=this.visualMapModel,a=o.getExtent(),r=o.itemSize,s=[0,r[1]],l=OO(t,a,s,!0),u=this._shapes,h=u.indicator;if(h){h.position[1]=l,h.attr("invisible",!1),h.setShape("points",ox(!!i,n,l,r[1]));var c={convertOpacityToAlpha:!0},d=this.getControllerVisual(t,"color",c);h.setStyle("fill",d);var f=Do(u.indicatorLabelPoint,Ao(h,this.group)),p=u.indicatorLabel;p.attr("invisible",!1);var g=this._applyTransform("left",u.barGroup),m=this._orient;p.setStyle({text:(i||"")+o.formatValueText(e),textVerticalAlign:"horizontal"===m?g:"middle",textAlign:"horizontal"===m?"center":g,x:f[0],y:f[1]})}},_enableHoverLinkToSeries:function(){var t=this;this._shapes.barGroup.on("mousemove",function(e){if(t._hovering=!0,!t._dragging){var i=t.visualMapModel.itemSize,n=t._applyTransform([e.offsetX,e.offsetY],t._shapes.barGroup,!0,!0);n[1]=RO(zO(0,n[1]),i[1]),t._doHoverLinkToSeries(n[1],0<=n[0]&&n[0]<=i[0])}}).on("mouseout",function(){t._hovering=!1,!t._dragging&&t._clearHoverLinkToSeries()})},_enableHoverLinkFromSeries:function(){var t=this.api.getZr();this.visualMapModel.option.hoverLink?(t.on("mouseover",this._hoverLinkFromSeriesMouseOver,this),t.on("mouseout",this._hideIndicator,this)):this._clearHoverLinkFromSeries()},_doHoverLinkToSeries:function(t,e){var i=this.visualMapModel,n=i.itemSize;if(i.option.hoverLink){var o=[0,n[1]],a=i.getExtent();t=RO(zO(o[0],t),o[1]);var r=ax(i,a,o),s=[t-r,t+r],l=OO(t,o,a,!0),u=[OO(s[0],o,a,!0),OO(s[1],o,a,!0)];s[0]o[1]&&(u[1]=1/0),e&&(u[0]===-1/0?this._showIndicator(l,u[1],"< ",r):u[1]===1/0?this._showIndicator(l,u[0],"> ",r):this._showIndicator(l,l,"≈ ",r));var h=this._hoverLinkDataIndices,c=[];(e||rx(i))&&(c=this._hoverLinkDataIndices=i.findTargetDataIndices(u));var d=Ri(h,c);this._dispatchHighDown("downplay",ex(d[0])),this._dispatchHighDown("highlight",ex(d[1]))}},_hoverLinkFromSeriesMouseOver:function(t){var e=t.target,i=this.visualMapModel;if(e&&null!=e.dataIndex){var n=this.ecModel.getSeriesByIndex(e.seriesIndex);if(i.isTargetSeries(n)){var o=n.getData(e.dataType),a=o.get(i.getDataDimension(o),e.dataIndex,!0);isNaN(a)||this._showIndicator(a,a)}}},_hideIndicator:function(){var t=this._shapes;t.indicator&&t.indicator.attr("invisible",!0),t.indicatorLabel&&t.indicatorLabel.attr("invisible",!0)},_clearHoverLinkToSeries:function(){this._hideIndicator();var t=this._hoverLinkDataIndices;this._dispatchHighDown("downplay",ex(t)),t.length=0},_clearHoverLinkFromSeries:function(){this._hideIndicator();var t=this.api.getZr();t.off("mouseover",this._hoverLinkFromSeriesMouseOver),t.off("mouseout",this._hideIndicator)},_applyTransform:function(t,e,i,n){var o=Ao(e,n?null:this.group);return zM[y(t)?"applyTransform":"transformDirection"](t,o,i)},_dispatchHighDown:function(t,e){e&&e.length&&this.api.dispatchAction({type:t,batch:e})},dispose:function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()},remove:function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()}});Es({type:"selectDataRange",event:"dataRangeSelected",update:"update"},function(t,e){e.eachComponent({mainType:"visualMap",query:t},function(e){e.setSelected(t.selected)})}),Ns(xO);var FO=LO.extend({type:"visualMap.piecewise",defaultOption:{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieceList:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0,showLabel:null},optionUpdated:function(t,e){FO.superApply(this,"optionUpdated",arguments),this._pieceList=[],this.resetExtent();var n=this._mode=this._determineMode();WO[this._mode].call(this),this._resetSelected(t,e);var o=this.option.categories;this.resetVisual(function(t,e){"categories"===n?(t.mappingMethod="category",t.categories=i(o)):(t.dataExtent=this.getExtent(),t.mappingMethod="piecewise",t.pieceList=f(this._pieceList,function(t){var t=i(t);return"inRange"!==e&&(t.visual=null),t}))})},completeVisualOption:function(){function t(t,e,i){return t&&t[e]&&(w(t[e])?t[e].hasOwnProperty(i):t[e]===i)}var e=this.option,i={},n=hL.listVisualTypes(),o=this.isCategory();d(e.pieces,function(t){d(n,function(e){t.hasOwnProperty(e)&&(i[e]=1)})}),d(i,function(i,n){var a=0;d(this.stateList,function(i){a|=t(e,i,n)||t(e.target,i,n)},this),!a&&d(this.stateList,function(t){(e[t]||(e[t]={}))[n]=wO.get(n,"inRange"===t?"active":"inactive",o)})},this),LO.prototype.completeVisualOption.apply(this,arguments)},_resetSelected:function(t,e){var i=this.option,n=this._pieceList,o=(e?i:t).selected||{};if(i.selected=o,d(n,function(t,e){var i=this.getSelectedMapKey(t);o.hasOwnProperty(i)||(o[i]=!0)},this),"single"===i.selectedMode){var a=!1;d(n,function(t,e){var i=this.getSelectedMapKey(t);o[i]&&(a?o[i]=!1:a=!0)},this)}},getSelectedMapKey:function(t){return"categories"===this._mode?t.value+"":t.index+""},getPieceList:function(){return this._pieceList},_determineMode:function(){var t=this.option;return t.pieces&&t.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},setSelected:function(t){this.option.selected=i(t)},getValueState:function(t){var e=hL.findPieceIndex(t,this._pieceList);return null!=e&&this.option.selected[this.getSelectedMapKey(this._pieceList[e])]?"inRange":"outOfRange"},findTargetDataIndices:function(t){var e=[];return this.eachTargetSeries(function(i){var n=[],o=i.getData();o.each(this.getDataDimension(o),function(e,i){hL.findPieceIndex(e,this._pieceList)===t&&n.push(i)},this),e.push({seriesId:i.id,dataIndex:n})},this),e},getRepresentValue:function(t){var e;if(this.isCategory())e=t.value;else if(null!=t.value)e=t.value;else{var i=t.interval||[];e=i[0]===-1/0&&i[1]===1/0?0:(i[0]+i[1])/2}return e},getVisualMeta:function(t){function e(e,a){var r=o.getRepresentValue({interval:e});a||(a=o.getValueState(r));var s=t(r,a);e[0]===-1/0?n[0]=s:e[1]===1/0?n[1]=s:i.push({value:e[0],color:s},{value:e[1],color:s})}if(!this.isCategory()){var i=[],n=[],o=this,a=this._pieceList.slice();if(a.length){var r=a[0].interval[0];r!==-1/0&&a.unshift({interval:[-1/0,r]}),(r=a[a.length-1].interval[1])!==1/0&&a.push({interval:[r,1/0]})}else a.push({interval:[-1/0,1/0]});var s=-1/0;return d(a,function(t){var i=t.interval;i&&(i[0]>s&&e([s,i[0]],"outOfRange"),e(i.slice()),s=i[1])},this),{stops:i,outerColors:n}}}}),WO={splitNumber:function(){var t=this.option,e=this._pieceList,i=Math.min(t.precision,20),n=this.getExtent(),o=t.splitNumber;o=Math.max(parseInt(o,10),1),t.splitNumber=o;for(var a=(n[1]-n[0])/o;+a.toFixed(i)!==a&&i<5;)i++;t.precision=i,a=+a.toFixed(i);var r=0;t.minOpen&&e.push({index:r++,interval:[-1/0,n[0]],close:[0,0]});for(var s=n[0],l=r+o;r","≥"][e[0]]];t.text=t.text||this.formatValueText(null!=t.value?t.value:t.interval,!1,i)},this)}};NO.extend({type:"visualMap.piecewise",doRender:function(){var t=this.group;t.removeAll();var e=this.visualMapModel,i=e.get("textGap"),n=e.textStyleModel,o=n.getFont(),a=n.getTextColor(),r=this._getItemAlign(),s=e.itemSize,l=this._getViewData(),u=l.endsText,h=T(e.get("showLabel",!0),!u);u&&this._renderEndsText(t,u[0],s,h,r),d(l.viewPieceList,function(n){var l=n.piece,u=new tb;u.onclick=m(this._onItemClick,this,l),this._enableHoverLink(u,n.indexInModelPieceList);var c=e.getRepresentValue(l);if(this._createItemSymbol(u,c,[0,0,s[0],s[1]]),h){var d=this.visualMapModel.getValueState(c);u.add(new rM({style:{x:"right"===r?-i:s[0]+i,y:s[1]/2,text:l.text,textVerticalAlign:"middle",textAlign:r,textFont:o,textFill:a,opacity:"outOfRange"===d?.5:1}}))}t.add(u)},this),u&&this._renderEndsText(t,u[1],s,h,r),aI(e.get("orient"),t,e.get("itemGap")),this.renderBackground(t),this.positionGroup(t)},_enableHoverLink:function(t,e){function i(t){var i=this.visualMapModel;i.option.hoverLink&&this.api.dispatchAction({type:t,batch:ex(i.findTargetDataIndices(e))})}t.on("mouseover",m(i,this,"highlight")).on("mouseout",m(i,this,"downplay"))},_getItemAlign:function(){var t=this.visualMapModel,e=t.option;if("vertical"===e.orient)return tx(t,this.api,t.itemSize);var i=e.align;return i&&"auto"!==i||(i="left"),i},_renderEndsText:function(t,e,i,n,o){if(e){var a=new tb,r=this.visualMapModel.textStyleModel;a.add(new rM({style:{x:n?"right"===o?i[0]:0:i[0]/2,y:i[1]/2,textVerticalAlign:"middle",textAlign:n?o:"center",text:e,textFont:r.getFont(),textFill:r.getTextColor()}})),t.add(a)}},_getViewData:function(){var t=this.visualMapModel,e=f(t.getPieceList(),function(t,e){return{piece:t,indexInModelPieceList:e}}),i=t.get("text"),n=t.get("orient"),o=t.get("inverse");return("horizontal"===n?o:!o)?e.reverse():i&&(i=i.slice().reverse()),{viewPieceList:e,endsText:i}},_createItemSymbol:function(t,e,i){t.add(Jl(this.getControllerVisual(e,"symbol"),i[0],i[1],i[2],i[3],this.getControllerVisual(e,"color")))},_onItemClick:function(t){var e=this.visualMapModel,n=e.option,o=i(n.selected),a=e.getSelectedMapKey(t);"single"===n.selectedMode?(o[a]=!0,d(o,function(t,e){o[e]=e===a})):o[a]=!o[a],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}});Ns(xO);var HO=ta,ZO=ia,UO=Fs({type:"marker",dependencies:["series","grid","polar","geo"],init:function(t,e,i,n){this.mergeDefaultAndTheme(t,i),this.mergeOption(t,i,n.createdBySelf,!0)},isAnimationEnabled:function(){if(U_.node)return!1;var t=this.__hostSeries;return this.getShallow("animation")&&t&&t.isAnimationEnabled()},mergeOption:function(t,e,i,n){var o=this.constructor,r=this.mainType+"Model";i||e.eachSeries(function(t){var i=t.get(this.mainType,!0),s=t[r];i&&i.data?(s?s.mergeOption(i,e,!0):(n&&ux(i),d(i.data,function(t){t instanceof Array?(ux(t[0]),ux(t[1])):ux(t)}),a(s=new o(i,this,e),{mainType:this.mainType,seriesIndex:t.seriesIndex,name:t.name,createdBySelf:!0}),s.__hostSeries=t),t[r]=s):t[r]=null},this)},formatTooltip:function(t){var e=this.getData(),i=this.getRawValue(t),n=y(i)?f(i,HO).join(", "):HO(i),o=e.getName(t),a=ZO(this.name);return(null!=i||o)&&(a+="
"),o&&(a+=ZO(o),null!=i&&(a+=" : ")),null!=i&&(a+=ZO(n)),a},getData:function(){return this._data},setData:function(t){this._data=t}});h(UO,ZI),UO.extend({type:"markPoint",defaultOption:{zlevel:0,z:5,symbol:"pin",symbolSize:50,tooltip:{trigger:"item"},label:{show:!0,position:"inside"},itemStyle:{borderWidth:2},emphasis:{label:{show:!0}}}});var XO=l,jO=v,YO={min:jO(dx,"min"),max:jO(dx,"max"),average:jO(dx,"average")},qO=Ws({type:"marker",init:function(){this.markerGroupMap=R()},render:function(t,e,i){var n=this.markerGroupMap;n.each(function(t){t.__keep=!1});var o=this.type+"Model";e.eachSeries(function(t){var n=t[o];n&&this.renderSeries(t,n,e,i)},this),n.each(function(t){!t.__keep&&this.group.remove(t.group)},this)},renderSeries:function(){}});qO.extend({type:"markPoint",updateTransform:function(t,e,i){e.eachSeries(function(t){var e=t.markPointModel;e&&(xx(e.getData(),t,i),this.markerGroupMap.get(t.id).updateLayout(e))},this)},renderSeries:function(t,e,i,n){var o=t.coordinateSystem,a=t.id,r=t.getData(),s=this.markerGroupMap,l=s.get(a)||s.set(a,new Du),u=_x(o,t,e);e.setData(u),xx(e.getData(),t,n),u.each(function(t){var i=u.getItemModel(t),n=i.getShallow("symbolSize");"function"==typeof n&&(n=n(e.getRawValue(t),e.getDataParams(t))),u.setItemVisual(t,{symbolSize:n,color:i.get("itemStyle.color")||r.getVisual("color"),symbol:i.getShallow("symbol")})}),l.updateData(u),this.group.add(l.group),u.eachItemGraphicEl(function(t){t.traverse(function(t){t.dataModel=e})}),l.__keep=!0,l.group.silent=e.get("silent")||t.get("silent")}}),Ns(function(t){t.markPoint=t.markPoint||{}}),UO.extend({type:"markLine",defaultOption:{zlevel:0,z:5,symbol:["circle","arrow"],symbolSize:[8,16],precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end"},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"}});var KO=function(t,e,o,r){var s=t.getData(),l=r.type;if(!y(r)&&("min"===l||"max"===l||"average"===l||"median"===l||null!=r.xAxis||null!=r.yAxis)){var u,h;if(null!=r.yAxis||null!=r.xAxis)u=null!=r.yAxis?"y":"x",e.getAxis(u),h=T(r.yAxis,r.xAxis);else{var c=px(r,s,e,t);u=c.valueDataDim,c.valueAxis,h=yx(s,u,l)}var d="x"===u?0:1,f=1-d,p=i(r),g={};p.type=null,p.coord=[],g.coord=[],p.coord[f]=-1/0,g.coord[f]=1/0;var m=o.get("precision");m>=0&&"number"==typeof h&&(h=+h.toFixed(Math.min(m,20))),p.coord[d]=g.coord[d]=h,r=[p,g,{type:l,valueIndex:r.valueIndex,value:h}]}return r=[fx(t,r[0]),fx(t,r[1]),a({},r[2])],r[2].type=r[2].type||"",n(r[2],r[0]),n(r[2],r[1]),r};qO.extend({type:"markLine",updateTransform:function(t,e,i){e.eachSeries(function(t){var e=t.markLineModel;if(e){var n=e.getData(),o=e.__from,a=e.__to;o.each(function(e){Ix(o,e,!0,t,i),Ix(a,e,!1,t,i)}),n.each(function(t){n.setItemLayout(t,[o.getItemLayout(t),a.getItemLayout(t)])}),this.markerGroupMap.get(t.id).updateLayout()}},this)},renderSeries:function(t,e,i,n){function o(e,i,o){var a=e.getItemModel(i);Ix(e,i,o,t,n),e.setItemVisual(i,{symbolSize:a.get("symbolSize")||g[o?0:1],symbol:a.get("symbol",!0)||p[o?0:1],color:a.get("itemStyle.color")||s.getVisual("color")})}var a=t.coordinateSystem,r=t.id,s=t.getData(),l=this.markerGroupMap,u=l.get(r)||l.set(r,new sf);this.group.add(u.group);var h=Tx(a,t,e),c=h.from,d=h.to,f=h.line;e.__from=c,e.__to=d,e.setData(f);var p=e.get("symbol"),g=e.get("symbolSize");y(p)||(p=[p,p]),"number"==typeof g&&(g=[g,g]),h.from.each(function(t){o(c,t,!0),o(d,t,!1)}),f.each(function(t){var e=f.getItemModel(t).get("lineStyle.color");f.setItemVisual(t,{color:e||c.getItemVisual(t,"color")}),f.setItemLayout(t,[c.getItemLayout(t),d.getItemLayout(t)]),f.setItemVisual(t,{fromSymbolSize:c.getItemVisual(t,"symbolSize"),fromSymbol:c.getItemVisual(t,"symbol"),toSymbolSize:d.getItemVisual(t,"symbolSize"),toSymbol:d.getItemVisual(t,"symbol")})}),u.updateData(f),h.line.eachItemGraphicEl(function(t,i){t.traverse(function(t){t.dataModel=e})}),u.__keep=!0,u.group.silent=e.get("silent")||t.get("silent")}}),Ns(function(t){t.markLine=t.markLine||{}}),UO.extend({type:"markArea",defaultOption:{zlevel:0,z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}}});var $O=function(t,e,i,n){var a=fx(t,n[0]),r=fx(t,n[1]),s=T,l=a.coord,u=r.coord;l[0]=s(l[0],-1/0),l[1]=s(l[1],-1/0),u[0]=s(u[0],1/0),u[1]=s(u[1],1/0);var h=o([{},a,r]);return h.coord=[a.coord,r.coord],h.x0=a.x,h.y0=a.y,h.x1=r.x,h.y1=r.y,h},JO=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]];qO.extend({type:"markArea",updateTransform:function(t,e,i){e.eachSeries(function(t){var e=t.markAreaModel;if(e){var n=e.getData();n.each(function(e){var o=f(JO,function(o){return Lx(n,e,o,t,i)});n.setItemLayout(e,o),n.getItemGraphicEl(e).setShape("points",o)})}},this)},renderSeries:function(t,e,i,n){var o=t.coordinateSystem,a=t.id,s=t.getData(),l=this.markerGroupMap,u=l.get(a)||l.set(a,{group:new tb});this.group.add(u.group),u.__keep=!0;var h=kx(o,t,e);e.setData(h),h.each(function(e){h.setItemLayout(e,f(JO,function(i){return Lx(h,e,i,t,n)})),h.setItemVisual(e,{color:s.getVisual("color")})}),h.diff(u.__data).add(function(t){var e=new pM({shape:{points:h.getItemLayout(t)}});h.setItemGraphicEl(t,e),u.group.add(e)}).update(function(t,i){var n=u.__data.getItemGraphicEl(i);Io(n,{shape:{points:h.getItemLayout(t)}},e,t),u.group.add(n),h.setItemGraphicEl(t,n)}).remove(function(t){var e=u.__data.getItemGraphicEl(t);u.group.remove(e)}).execute(),h.eachItemGraphicEl(function(t,i){var n=h.getItemModel(i),o=n.getModel("label"),a=n.getModel("emphasis.label"),s=h.getItemVisual(i,"color");t.useStyle(r(n.getModel("itemStyle").getItemStyle(),{fill:Yt(s,.4),stroke:s})),t.hoverStyle=n.getModel("emphasis.itemStyle").getItemStyle(),go(t.style,t.hoverStyle,o,a,{labelFetcher:e,labelDataIndex:i,defaultText:h.getName(i)||"",isRectText:!0,autoColor:s}),fo(t,{}),t.dataModel=e}),u.__data=h,u.group.silent=e.get("silent")||t.get("silent")}}),Ns(function(t){t.markArea=t.markArea||{}});lI.registerSubTypeDefaulter("timeline",function(){return"slider"}),Es({type:"timelineChange",event:"timelineChanged",update:"prepareAndUpdate"},function(t,e){var i=e.getComponent("timeline");return i&&null!=t.currentIndex&&(i.setCurrentIndex(t.currentIndex),!i.get("loop",!0)&&i.isIndexMax()&&i.setPlayState(!1)),e.resetOption("timeline"),r({currentIndex:i.option.currentIndex},t)}),Es({type:"timelinePlayChange",event:"timelinePlayChanged",update:"update"},function(t,e){var i=e.getComponent("timeline");i&&null!=t.playState&&i.setPlayState(t.playState)});var QO=lI.extend({type:"timeline",layoutMode:"box",defaultOption:{zlevel:0,z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:5,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:"#000"},data:[]},init:function(t,e,i){this._data,this._names,this.mergeDefaultAndTheme(t,i),this._initData()},mergeOption:function(t){QO.superApply(this,"mergeOption",arguments),this._initData()},setCurrentIndex:function(t){null==t&&(t=this.option.currentIndex);var e=this._data.count();this.option.loop?t=(t%e+e)%e:(t>=e&&(t=e-1),t<0&&(t=0)),this.option.currentIndex=t},getCurrentIndex:function(){return this.option.currentIndex},isIndexMax:function(){return this.getCurrentIndex()>=this._data.count()-1},setPlayState:function(t){this.option.autoPlay=!!t},getPlayState:function(){return!!this.option.autoPlay},_initData:function(){var t=this.option,e=t.data||[],n=t.axisType,o=this._names=[];if("category"===n){var a=[];d(e,function(t,e){var n,r=Li(t);w(t)?(n=i(t)).value=e:n=e,a.push(n),_(r)||null!=r&&!isNaN(r)||(r=""),o.push(r+"")}),e=a}var r={category:"ordinal",time:"time"}[n]||"number";(this._data=new vA([{name:"value",type:r}],this)).initData(e,o)},getData:function(){return this._data},getCategories:function(){if("category"===this.get("axisType"))return this._names.slice()}});h(QO.extend({type:"timeline.slider",defaultOption:{backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"emptyCircle",symbolSize:10,lineStyle:{show:!0,width:2,color:"#304654"},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:"#304654"},itemStyle:{color:"#304654",borderWidth:1},checkpointStyle:{symbol:"circle",symbolSize:13,color:"#c23531",borderWidth:5,borderColor:"rgba(194,53,49, 0.5)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:22,itemGap:12,position:"left",playIcon:"path://M31.6,53C17.5,53,6,41.5,6,27.4S17.5,1.8,31.6,1.8C45.7,1.8,57.2,13.3,57.2,27.4S45.7,53,31.6,53z M31.6,3.3 C18.4,3.3,7.5,14.1,7.5,27.4c0,13.3,10.8,24.1,24.1,24.1C44.9,51.5,55.7,40.7,55.7,27.4C55.7,14.1,44.9,3.3,31.6,3.3z M24.9,21.3 c0-2.2,1.6-3.1,3.5-2l10.5,6.1c1.899,1.1,1.899,2.9,0,4l-10.5,6.1c-1.9,1.1-3.5,0.2-3.5-2V21.3z",stopIcon:"path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z",nextIcon:"path://M18.6,50.8l22.5-22.5c0.2-0.2,0.3-0.4,0.3-0.7c0-0.3-0.1-0.5-0.3-0.7L18.7,4.4c-0.1-0.1-0.2-0.3-0.2-0.5 c0-0.4,0.3-0.8,0.8-0.8c0.2,0,0.5,0.1,0.6,0.3l23.5,23.5l0,0c0.2,0.2,0.3,0.4,0.3,0.7c0,0.3-0.1,0.5-0.3,0.7l-0.1,0.1L19.7,52 c-0.1,0.1-0.3,0.2-0.5,0.2c-0.4,0-0.8-0.3-0.8-0.8C18.4,51.2,18.5,51,18.6,50.8z",prevIcon:"path://M43,52.8L20.4,30.3c-0.2-0.2-0.3-0.4-0.3-0.7c0-0.3,0.1-0.5,0.3-0.7L42.9,6.4c0.1-0.1,0.2-0.3,0.2-0.5 c0-0.4-0.3-0.8-0.8-0.8c-0.2,0-0.5,0.1-0.6,0.3L18.3,28.8l0,0c-0.2,0.2-0.3,0.4-0.3,0.7c0,0.3,0.1,0.5,0.3,0.7l0.1,0.1L41.9,54 c0.1,0.1,0.3,0.2,0.5,0.2c0.4,0,0.8-0.3,0.8-0.8C43.2,53.2,43.1,53,43,52.8z",color:"#304654",borderColor:"#304654",borderWidth:1},emphasis:{label:{show:!0,color:"#c23531"},itemStyle:{color:"#c23531"},controlStyle:{color:"#c23531",borderColor:"#c23531",borderWidth:2}},data:[]}}),ZI);var tE=qI.extend({type:"timeline"}),eE=function(t,e,i,n){aD.call(this,t,e,i),this.type=n||"value",this.model=null};eE.prototype={constructor:eE,getLabelModel:function(){return this.model.getModel("label")},isHorizontal:function(){return"horizontal"===this.model.get("orient")}},u(eE,aD);var iE=m,nE=d,oE=Math.PI;tE.extend({type:"timeline.slider",init:function(t,e){this.api=e,this._axis,this._viewRect,this._timer,this._currentPointer,this._mainGroup,this._labelGroup},render:function(t,e,i,n){if(this.model=t,this.api=i,this.ecModel=e,this.group.removeAll(),t.get("show",!0)){var o=this._layout(t,i),a=this._createGroup("mainGroup"),r=this._createGroup("labelGroup"),s=this._axis=this._createAxis(o,t);t.formatTooltip=function(t){return ia(s.scale.getLabel(t))},nE(["AxisLine","AxisTick","Control","CurrentPointer"],function(e){this["_render"+e](o,a,s,t)},this),this._renderAxisLabel(o,r,s,t),this._position(o,t)}this._doPlayStop()},remove:function(){this._clearTimer(),this.group.removeAll()},dispose:function(){this._clearTimer()},_layout:function(t,e){var i=t.get("label.position"),n=t.get("orient"),o=Ex(t,e);null==i||"auto"===i?i="horizontal"===n?o.y+o.height/2=0||"+"===i?"left":"right"},r={horizontal:i>=0||"+"===i?"top":"bottom",vertical:"middle"},s={horizontal:0,vertical:oE/2},l="vertical"===n?o.height:o.width,u=t.getModel("controlStyle"),h=u.get("show",!0),c=h?u.get("itemSize"):0,d=h?u.get("itemGap"):0,f=c+d,p=t.get("label.rotate")||0;p=p*oE/180;var g,m,v,y,x=u.get("position",!0),_=h&&u.get("showPlayBtn",!0),w=h&&u.get("showPrevBtn",!0),b=h&&u.get("showNextBtn",!0),S=0,M=l;return"left"===x||"bottom"===x?(_&&(g=[0,0],S+=f),w&&(m=[S,0],S+=f),b&&(v=[M-c,0],M-=f)):(_&&(g=[M-c,0],M-=f),w&&(m=[0,0],S+=f),b&&(v=[M-c,0],M-=f)),y=[S,M],t.get("inverse")&&y.reverse(),{viewRect:o,mainLength:l,orient:n,rotation:s[n],labelRotation:p,labelPosOpt:i,labelAlign:t.get("label.align")||a[n],labelBaseline:t.get("label.verticalAlign")||t.get("label.baseline")||r[n],playPosition:g,prevBtnPosition:m,nextBtnPosition:v,axisExtent:y,controlSize:c,controlGap:d}},_position:function(t,e){function i(t){var e=t.position;t.origin=[c[0][0]-e[0],c[1][0]-e[1]]}function n(t){return[[t.x,t.x+t.width],[t.y,t.y+t.height]]}function o(t,e,i,n,o){t[n]+=i[n][o]-e[n][o]}var a=this._mainGroup,r=this._labelGroup,s=t.viewRect;if("vertical"===t.orient){var l=xt(),u=s.x,h=s.y+s.height;St(l,l,[-u,-h]),Mt(l,l,-oE/2),St(l,l,[u,h]),(s=s.clone()).applyTransform(l)}var c=n(s),d=n(a.getBoundingRect()),f=n(r.getBoundingRect()),p=a.position,g=r.position;g[0]=p[0]=c[0][0];var m=t.labelPosOpt;if(isNaN(m))o(p,d,c,1,v="+"===m?0:1),o(g,f,c,1,1-v);else{var v=m>=0?0:1;o(p,d,c,1,v),g[1]=p[1]+m}a.attr("position",p),r.attr("position",g),a.rotation=r.rotation=t.rotation,i(a),i(r)},_createAxis:function(t,e){var i=e.getData(),n=e.get("axisType"),o=Hl(e,n);o.getTicks=function(){return i.mapArray(["value"],function(t){return t})};var a=i.getDataExtent("value");o.setExtent(a[0],a[1]),o.niceTicks();var r=new eE("value",o,t.axisExtent,n);return r.model=e,r},_createGroup:function(t){var e=this["_"+t]=new tb;return this.group.add(e),e},_renderAxisLine:function(t,e,i,n){var o=i.getExtent();n.get("lineStyle.show")&&e.add(new _M({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:a({lineCap:"round"},n.getModel("lineStyle").getLineStyle()),silent:!0,z2:1}))},_renderAxisTick:function(t,e,i,n){var o=n.getData(),a=i.scale.getTicks();nE(a,function(t){var a=i.dataToCoord(t),r=o.getItemModel(t),s=r.getModel("itemStyle"),l=r.getModel("emphasis.itemStyle"),u={position:[a,0],onclick:iE(this._changeTimeline,this,t)},h=zx(r,s,e,u);fo(h,l.getItemStyle()),r.get("tooltip")?(h.dataIndex=t,h.dataModel=n):h.dataIndex=h.dataModel=null},this)},_renderAxisLabel:function(t,e,i,n){if(i.getLabelModel().get("show")){var o=n.getData(),a=i.getViewLabels();nE(a,function(n){var a=n.tickValue,r=o.getItemModel(a),s=r.getModel("label"),l=r.getModel("emphasis.label"),u=i.dataToCoord(n.tickValue),h=new rM({position:[u,0],rotation:t.labelRotation-t.rotation,onclick:iE(this._changeTimeline,this,a),silent:!1});mo(h.style,s,{text:n.formattedLabel,textAlign:t.labelAlign,textVerticalAlign:t.labelBaseline}),e.add(h),fo(h,mo({},l))},this)}},_renderControl:function(t,e,i,n){function o(t,i,o,h){if(t){var c=Rx(n,i,u,{position:t,origin:[a/2,0],rotation:h?-r:0,rectHover:!0,style:s,onclick:o});e.add(c),fo(c,l)}}var a=t.controlSize,r=t.rotation,s=n.getModel("controlStyle").getItemStyle(),l=n.getModel("emphasis.controlStyle").getItemStyle(),u=[0,-a/2,a,a],h=n.getPlayState(),c=n.get("inverse",!0);o(t.nextBtnPosition,"controlStyle.nextIcon",iE(this._changeTimeline,this,c?"-":"+")),o(t.prevBtnPosition,"controlStyle.prevIcon",iE(this._changeTimeline,this,c?"+":"-")),o(t.playPosition,"controlStyle."+(h?"stopIcon":"playIcon"),iE(this._handlePlayClick,this,!h),!0)},_renderCurrentPointer:function(t,e,i,n){var o=n.getData(),a=n.getCurrentIndex(),r=o.getItemModel(a).getModel("checkpointStyle"),s=this,l={onCreate:function(t){t.draggable=!0,t.drift=iE(s._handlePointerDrag,s),t.ondragend=iE(s._handlePointerDragend,s),Bx(t,a,i,n,!0)},onUpdate:function(t){Bx(t,a,i,n)}};this._currentPointer=zx(r,r,this._mainGroup,{},this._currentPointer,l)},_handlePlayClick:function(t){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:t,from:this.uid})},_handlePointerDrag:function(t,e,i){this._clearTimer(),this._pointerChangeTimeline([i.offsetX,i.offsetY])},_handlePointerDragend:function(t){this._pointerChangeTimeline([t.offsetX,t.offsetY],!0)},_pointerChangeTimeline:function(t,e){var i=this._toAxisCoord(t)[0],n=Fo(this._axis.getExtent().slice());i>n[1]&&(i=n[1]),ii.getHeight()&&(n.textPosition="top",l=!0);var u=l?-5-o.height:s+8;a+o.width/2>i.getWidth()?(n.textPosition=["100%",u],n.textAlign="right"):a-o.width/2<0&&(n.textPosition=[0,u],n.textAlign="left")}})}},updateView:function(t,e,i,n){d(this._features,function(t){t.updateView&&t.updateView(t.model,e,i,n)})},remove:function(t,e){d(this._features,function(i){i.remove&&i.remove(t,e)}),this.group.removeAll()},dispose:function(t,e){d(this._features,function(i){i.dispose&&i.dispose(t,e)})}});var rE=rT.toolbox.saveAsImage;Gx.defaultOption={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:rE.title,type:"png",name:"",excludeComponents:["toolbox"],pixelRatio:1,lang:rE.lang.slice()},Gx.prototype.unusable=!U_.canvasSupported,Gx.prototype.onclick=function(t,e){var i=this.model,n=i.get("name")||t.get("title.0.text")||"echarts",o=document.createElement("a"),a=i.get("type",!0)||"png";o.download=n+"."+a,o.target="_blank";var r=e.getConnectedDataURL({type:a,backgroundColor:i.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",excludeComponents:i.get("excludeComponents"),pixelRatio:i.get("pixelRatio")});if(o.href=r,"function"!=typeof MouseEvent||U_.browser.ie||U_.browser.edge)if(window.navigator.msSaveOrOpenBlob){for(var s=atob(r.split(",")[1]),l=s.length,u=new Uint8Array(l);l--;)u[l]=s.charCodeAt(l);var h=new Blob([u]);window.navigator.msSaveOrOpenBlob(h,n+"."+a)}else{var c=i.get("lang"),d='';window.open().document.write(d)}else{var f=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});o.dispatchEvent(f)}},Ty("saveAsImage",Gx);var sE=rT.toolbox.magicType;Fx.defaultOption={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z",tiled:"M2.3,2.2h22.8V25H2.3V2.2z M35,2.2h22.8V25H35V2.2zM2.3,35h22.8v22.8H2.3V35z M35,35h22.8v22.8H35V35z"},title:i(sE.title),option:{},seriesIndex:{}};var lE=Fx.prototype;lE.getIcons=function(){var t=this.model,e=t.get("icon"),i={};return d(t.get("type"),function(t){e[t]&&(i[t]=e[t])}),i};var uE={line:function(t,e,i,o){if("bar"===t)return n({id:e,type:"line",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},o.get("option.line")||{},!0)},bar:function(t,e,i,o){if("line"===t)return n({id:e,type:"bar",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},o.get("option.bar")||{},!0)},stack:function(t,e,i,o){if("line"===t||"bar"===t)return n({id:e,stack:"__ec_magicType_stack__"},o.get("option.stack")||{},!0)},tiled:function(t,e,i,o){if("line"===t||"bar"===t)return n({id:e,stack:""},o.get("option.tiled")||{},!0)}},hE=[["line","bar"],["stack","tiled"]];lE.onclick=function(t,e,i){var n=this.model,o=n.get("seriesIndex."+i);if(uE[i]){var a={series:[]};d(hE,function(t){l(t,i)>=0&&d(t,function(t){n.setIconStatus(t,"normal")})}),n.setIconStatus(i,"emphasis"),t.eachComponent({mainType:"series",query:null==o?null:{seriesIndex:o}},function(e){var o=e.subType,s=e.id,l=uE[i](o,s,e,n);l&&(r(l,e.option),a.series.push(l));var u=e.coordinateSystem;if(u&&"cartesian2d"===u.type&&("line"===i||"bar"===i)){var h=u.getAxesByScale("ordinal")[0];if(h){var c=h.dim+"Axis",d=t.queryComponents({mainType:c,index:e.get(name+"Index"),id:e.get(name+"Id")})[0].componentIndex;a[c]=a[c]||[];for(var f=0;f<=d;f++)a[c][d]=a[c][d]||{};a[c][d].boundaryGap="bar"===i}}}),e.dispatchAction({type:"changeMagicType",currentType:i,newOption:a})}},Es({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(t,e){e.mergeOption(t.newOption)}),Ty("magicType",Fx);var cE=rT.toolbox.dataView,dE=new Array(60).join("-"),fE="\t",pE=new RegExp("["+fE+"]+","g");$x.defaultOption={show:!0,readOnly:!1,optionToContent:null,contentToOption:null,icon:"M17.5,17.3H33 M17.5,17.3H33 M45.4,29.5h-28 M11.5,2v56H51V14.8L38.4,2H11.5z M38.4,2.2v12.7H51 M45.4,41.7h-28",title:i(cE.title),lang:i(cE.lang),backgroundColor:"#fff",textColor:"#000",textareaColor:"#fff",textareaBorderColor:"#333",buttonColor:"#c23531",buttonTextColor:"#fff"},$x.prototype.onclick=function(t,e){function i(){n.removeChild(a),x._dom=null}var n=e.getDom(),o=this.model;this._dom&&n.removeChild(this._dom);var a=document.createElement("div");a.style.cssText="position:absolute;left:5px;top:5px;bottom:5px;right:5px;",a.style.backgroundColor=o.get("backgroundColor")||"#fff";var r=document.createElement("h4"),s=o.get("lang")||[];r.innerHTML=s[0]||o.get("title"),r.style.cssText="margin: 10px 20px;",r.style.color=o.get("textColor");var l=document.createElement("div"),u=document.createElement("textarea");l.style.cssText="display:block;width:100%;overflow:auto;";var h=o.get("optionToContent"),c=o.get("contentToOption"),d=Ux(t);if("function"==typeof h){var f=h(e.getOption());"string"==typeof f?l.innerHTML=f:M(f)&&l.appendChild(f)}else l.appendChild(u),u.readOnly=o.get("readOnly"),u.style.cssText="width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;",u.style.color=o.get("textColor"),u.style.borderColor=o.get("textareaBorderColor"),u.style.backgroundColor=o.get("textareaColor"),u.value=d.value;var p=d.meta,g=document.createElement("div");g.style.cssText="position:absolute;bottom:0;left:0;right:0;";var m="float:right;margin-right:20px;border:none;cursor:pointer;padding:2px 5px;font-size:12px;border-radius:3px",v=document.createElement("div"),y=document.createElement("div");m+=";background-color:"+o.get("buttonColor"),m+=";color:"+o.get("buttonTextColor");var x=this;ht(v,"click",i),ht(y,"click",function(){var t;try{t="function"==typeof c?c(l,e.getOption()):Kx(u.value,p)}catch(t){throw i(),new Error("Data view format error "+t)}t&&e.dispatchAction({type:"changeDataView",newOption:t}),i()}),v.innerHTML=s[1],y.innerHTML=s[2],y.style.cssText=m,v.style.cssText=m,!o.get("readOnly")&&g.appendChild(y),g.appendChild(v),ht(u,"keydown",function(t){if(9===(t.keyCode||t.which)){var e=this.value,i=this.selectionStart,n=this.selectionEnd;this.value=e.substring(0,i)+fE+e.substring(n),this.selectionStart=this.selectionEnd=i+1,mw(t)}}),a.appendChild(r),a.appendChild(l),a.appendChild(g),l.style.height=n.clientHeight-80+"px",n.appendChild(a),this._dom=a},$x.prototype.remove=function(t,e){this._dom&&e.getDom().removeChild(this._dom)},$x.prototype.dispose=function(t,e){this.remove(t,e)},Ty("dataView",$x),Es({type:"changeDataView",event:"dataViewChanged",update:"prepareAndUpdate"},function(t,e){var i=[];d(t.newOption.series,function(t){var n=e.getSeriesByName(t.name)[0];if(n){var o=n.get("data");i.push({name:t.name,data:Jx(t.data,o)})}else i.push(a({type:"scatter"},t))}),e.mergeOption(r({series:i},t.newOption))});var gE=d,mE="\0_ec_hist_store";iO.extend({type:"dataZoom.select"}),nO.extend({type:"dataZoom.select"});var vE=rT.toolbox.dataZoom,yE=d,xE="\0_ec_\0toolbox-dataZoom_";o_.defaultOption={show:!0,icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:i(vE.title)};var _E=o_.prototype;_E.render=function(t,e,i,n){this.model=t,this.ecModel=e,this.api=i,s_(t,e,this,n,i),r_(t,e)},_E.onclick=function(t,e,i){wE[i].call(this)},_E.remove=function(t,e){this._brushController.unmount()},_E.dispose=function(t,e){this._brushController.dispose()};var wE={zoom:function(){var t=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:t})},back:function(){this._dispatchZoomAction(t_(this.ecModel))}};_E._onBrush=function(t,e){function i(t,e,i){var r=e.getAxis(t),s=r.model,l=n(t,s,a),u=l.findRepresentativeAxisProxy(s).getMinMaxSpan();null==u.minValueSpan&&null==u.maxValueSpan||(i=QL(0,i.slice(),r.scale.getExtent(),0,u.minValueSpan,u.maxValueSpan)),l&&(o[l.id]={dataZoomId:l.id,startValue:i[0],endValue:i[1]})}function n(t,e,i){var n;return i.eachComponent({mainType:"dataZoom",subType:"select"},function(i){i.getAxisModel(t,e.componentIndex)&&(n=i)}),n}if(e.isEnd&&t.length){var o={},a=this.ecModel;this._brushController.updateCovers([]),new hy(a_(this.model.option),a,{include:["grid"]}).matchOutputRanges(t,a,function(t,e,n){if("cartesian2d"===n.type){var o=t.brushType;"rect"===o?(i("x",n,e[0]),i("y",n,e[1])):i({lineX:"x",lineY:"y"}[o],n,e)}}),Qx(a,o),this._dispatchZoomAction(o)}},_E._dispatchZoomAction=function(t){var e=[];yE(t,function(t,n){e.push(i(t))}),e.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:e})},Ty("dataZoom",o_),Ns(function(t){function e(t,e){if(e){var o=t+"Index",a=e[o];null==a||"all"===a||y(a)||(a=!1===a||"none"===a?[]:[a]),i(t,function(e,i){if(null==a||"all"===a||-1!==l(a,i)){var r={type:"select",$fromToolbox:!0,id:xE+t+i};r[o]=i,n.push(r)}})}}function i(e,i){var n=t[e];y(n)||(n=n?[n]:[]),yE(n,i)}if(t){var n=t.dataZoom||(t.dataZoom=[]);y(n)||(t.dataZoom=n=[n]);var o=t.toolbox;if(o&&(y(o)&&(o=o[0]),o&&o.feature)){var a=o.feature.dataZoom;e("xAxis",a),e("yAxis",a)}}});var bE=rT.toolbox.restore;l_.defaultOption={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:bE.title},l_.prototype.onclick=function(t,e,i){e_(t),e.dispatchAction({type:"restore",from:this.uid})},Ty("restore",l_),Es({type:"restore",event:"restore",update:"prepareAndUpdate"},function(t,e){e.resetOption("recreate")});var SE,ME="urn:schemas-microsoft-com:vml",IE="undefined"==typeof window?null:window,TE=!1,AE=IE&&IE.document;if(AE&&!U_.canvasSupported)try{!AE.namespaces.zrvml&&AE.namespaces.add("zrvml",ME),SE=function(t){return AE.createElement("')}}catch(t){SE=function(t){return AE.createElement("<"+t+' xmlns="'+ME+'" class="zrvml">')}}var DE=ES.CMD,CE=Math.round,LE=Math.sqrt,kE=Math.abs,PE=Math.cos,NE=Math.sin,OE=Math.max;if(!U_.canvasSupported){var EE=21600,RE=EE/2,zE=function(t){t.style.cssText="position:absolute;left:0;top:0;width:1px;height:1px;",t.coordsize=EE+","+EE,t.coordorigin="0,0"},BE=function(t){return String(t).replace(/&/g,"&").replace(/"/g,""")},VE=function(t,e,i){return"rgb("+[t,e,i].join(",")+")"},GE=function(t,e){e&&t&&e.parentNode!==t&&t.appendChild(e)},FE=function(t,e){e&&t&&e.parentNode===t&&t.removeChild(e)},WE=function(t,e,i){return 1e5*(parseFloat(t)||0)+1e3*(parseFloat(e)||0)+i},HE=function(t,e){return"string"==typeof t?t.lastIndexOf("%")>=0?parseFloat(t)/100*e:parseFloat(t):t},ZE=function(t,e,i){var n=Gt(e);i=+i,isNaN(i)&&(i=1),n&&(t.color=VE(n[0],n[1],n[2]),t.opacity=i*n[3])},UE=function(t){var e=Gt(t);return[VE(e[0],e[1],e[2]),e[3]]},XE=function(t,e,i){var n=e.fill;if(null!=n)if(n instanceof IM){var o,a=0,r=[0,0],s=0,l=1,u=i.getBoundingRect(),h=u.width,c=u.height;if("linear"===n.type){o="gradient";var d=i.transform,f=[n.x*h,n.y*c],p=[n.x2*h,n.y2*c];d&&(Q(f,f,d),Q(p,p,d));var g=p[0]-f[0],m=p[1]-f[1];(a=180*Math.atan2(g,m)/Math.PI)<0&&(a+=360),a<1e-6&&(a=0)}else{o="gradientradial";var f=[n.x*h,n.y*c],d=i.transform,v=i.scale,y=h,x=c;r=[(f[0]-u.x)/y,(f[1]-u.y)/x],d&&Q(f,f,d),y/=v[0]*EE,x/=v[1]*EE;var _=OE(y,x);s=0/_,l=2*n.r/_-s}var w=n.colorStops.slice();w.sort(function(t,e){return t.offset-e.offset});for(var b=w.length,S=[],M=[],I=0;I=2){var D=S[0][0],C=S[1][0],L=S[0][1]*e.opacity,k=S[1][1]*e.opacity;t.type=o,t.method="none",t.focus="100%",t.angle=a,t.color=D,t.color2=C,t.colors=M.join(","),t.opacity=k,t.opacity2=L}"radial"===o&&(t.focusposition=r.join(","))}else ZE(t,n,e.opacity)},jE=function(t,e){null!=e.lineDash&&(t.dashstyle=e.lineDash.join(" ")),null==e.stroke||e.stroke instanceof IM||ZE(t,e.stroke,e.opacity)},YE=function(t,e,i,n){var o="fill"===e,a=t.getElementsByTagName(e)[0];null!=i[e]&&"none"!==i[e]&&(o||!o&&i.lineWidth)?(t[o?"filled":"stroked"]="true",i[e]instanceof IM&&FE(t,a),a||(a=u_(e)),o?XE(a,i,n):jE(a,i),GE(t,a)):(t[o?"filled":"stroked"]="false",FE(t,a))},qE=[[],[],[]],KE=function(t,e){var i,n,o,a,r,s,l=DE.M,u=DE.C,h=DE.L,c=DE.A,d=DE.Q,f=[],p=t.data,g=t.len();for(a=0;a.01?N&&(O+=.0125):Math.abs(E-D)<1e-4?N&&OA?x-=.0125:x+=.0125:N&&ED?y+=.0125:y-=.0125),f.push(R,CE(((A-C)*M+b)*EE-RE),",",CE(((D-L)*I+S)*EE-RE),",",CE(((A+C)*M+b)*EE-RE),",",CE(((D+L)*I+S)*EE-RE),",",CE((O*M+b)*EE-RE),",",CE((E*I+S)*EE-RE),",",CE((y*M+b)*EE-RE),",",CE((x*I+S)*EE-RE)),r=y,s=x;break;case DE.R:var z=qE[0],B=qE[1];z[0]=p[a++],z[1]=p[a++],B[0]=z[0]+p[a++],B[1]=z[1]+p[a++],e&&(Q(z,z,e),Q(B,B,e)),z[0]=CE(z[0]*EE-RE),B[0]=CE(B[0]*EE-RE),z[1]=CE(z[1]*EE-RE),B[1]=CE(B[1]*EE-RE),f.push(" m ",z[0],",",z[1]," l ",B[0],",",z[1]," l ",B[0],",",B[1]," l ",z[0],",",B[1]);break;case DE.Z:f.push(" x ")}if(i>0){f.push(n);for(var V=0;V100&&(tR=0,QE={});var i,n=eR.style;try{n.font=t,i=n.fontFamily.split(",")[0]}catch(t){}e={style:n.fontStyle||"normal",variant:n.fontVariant||"normal",weight:n.fontWeight||"normal",size:0|parseFloat(n.fontSize||12),family:i||"Microsoft YaHei"},QE[t]=e,tR++}return e};!function(t,e){bb[t]=e}("measureText",function(t,e){var i=AE;JE||((JE=i.createElement("div")).style.cssText="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;",AE.body.appendChild(JE));try{JE.style.font=e}catch(t){}return JE.innerHTML="",JE.appendChild(i.createTextNode(t)),{width:JE.offsetWidth}});for(var nR=new de,oR=[Db,di,fi,Pn,rM],aR=0;aR=o&&u+1>=a){for(var h=[],c=0;c=o&&c+1>=a)return T_(0,s.components);l[i]=s}else l[i]=void 0}r++}();if(d)return d}},pushComponent:function(t,e,i){var n=t[t.length-1];n&&n.added===e&&n.removed===i?t[t.length-1]={count:n.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon:function(t,e,i,n){for(var o=e.length,a=i.length,r=t.newPos,s=r-n,l=0;r+1=0;--n)if(e[n]===t)return!0;return!1}),i):null:i[0]},D_.prototype.update=function(t,e){if(t){var i=this.getDefs(!1);if(t[this._domName]&&i.contains(t[this._domName]))"function"==typeof e&&e(t);else{var n=this.add(t);n&&(t[this._domName]=n)}}},D_.prototype.addDom=function(t){this.getDefs(!0).appendChild(t)},D_.prototype.removeDom=function(t){var e=this.getDefs(!1);e&&t[this._domName]&&(e.removeChild(t[this._domName]),t[this._domName]=null)},D_.prototype.getDoms=function(){var t=this.getDefs(!1);if(!t)return[];var e=[];return d(this._tagNames,function(i){var n=t.getElementsByTagName(i);e=e.concat([].slice.call(n))}),e},D_.prototype.markAllUnused=function(){var t=this;d(this.getDoms(),function(e){e[t._markLabel]="0"})},D_.prototype.markUsed=function(t){t&&(t[this._markLabel]="1")},D_.prototype.removeUnused=function(){var t=this.getDefs(!1);if(t){var e=this;d(this.getDoms(),function(i){"1"!==i[e._markLabel]&&t.removeChild(i)})}},D_.prototype.getSvgProxy=function(t){return t instanceof Pn?yR:t instanceof fi?xR:t instanceof rM?_R:yR},D_.prototype.getTextSvgElement=function(t){return t.__textSvgEl},D_.prototype.getSvgElement=function(t){return t.__svgEl},u(C_,D_),C_.prototype.addWithoutUpdate=function(t,e){if(e&&e.style){var i=this;d(["fill","stroke"],function(n){if(e.style[n]&&("linear"===e.style[n].type||"radial"===e.style[n].type)){var o,a=e.style[n],r=i.getDefs(!0);a._dom?(o=a._dom,r.contains(a._dom)||i.addDom(o)):o=i.add(a),i.markUsed(e);var s=o.getAttribute("id");t.setAttribute(n,"url(#"+s+")")}})}},C_.prototype.add=function(t){var e;if("linear"===t.type)e=this.createElement("linearGradient");else{if("radial"!==t.type)return Yw("Illegal gradient type."),null;e=this.createElement("radialGradient")}return t.id=t.id||this.nextId++,e.setAttribute("id","zr"+this._zrId+"-gradient-"+t.id),this.updateDom(t,e),this.addDom(e),e},C_.prototype.update=function(t){var e=this;D_.prototype.update.call(this,t,function(){var i=t.type,n=t._dom.tagName;"linear"===i&&"linearGradient"===n||"radial"===i&&"radialGradient"===n?e.updateDom(t,t._dom):(e.removeDom(t),e.add(t))})},C_.prototype.updateDom=function(t,e){if("linear"===t.type)e.setAttribute("x1",t.x),e.setAttribute("y1",t.y),e.setAttribute("x2",t.x2),e.setAttribute("y2",t.y2);else{if("radial"!==t.type)return void Yw("Illegal gradient type.");e.setAttribute("cx",t.x),e.setAttribute("cy",t.y),e.setAttribute("r",t.r)}t.global?e.setAttribute("gradientUnits","userSpaceOnUse"):e.setAttribute("gradientUnits","objectBoundingBox"),e.innerHTML="";for(var i=t.colorStops,n=0,o=i.length;n0){var n,o,a=this.getDefs(!0),r=e[0],s=i?"_textDom":"_dom";r[s]?(o=r[s].getAttribute("id"),n=r[s],a.contains(n)||a.appendChild(n)):(o="zr"+this._zrId+"-clip-"+this.nextId,++this.nextId,(n=this.createElement("clipPath")).setAttribute("id",o),a.appendChild(n),r[s]=n);var l=this.getSvgProxy(r);if(r.transform&&r.parent.invTransform&&!i){var u=Array.prototype.slice.call(r.transform);bt(r.transform,r.parent.invTransform,r.transform),l.brush(r),r.transform=u}else l.brush(r);var h=this.getSvgElement(r);n.innerHTML="",n.appendChild(h.cloneNode()),t.setAttribute("clip-path","url(#"+o+")"),e.length>1&&this.updateDom(n,e.slice(1),i)}else t&&t.setAttribute("clip-path","none")},L_.prototype.markUsed=function(t){var e=this;t.__clipPaths&&t.__clipPaths.length>0&&d(t.__clipPaths,function(t){t._dom&&D_.prototype.markUsed.call(e,t._dom),t._textDom&&D_.prototype.markUsed.call(e,t._textDom)})},u(k_,D_),k_.prototype.addWithoutUpdate=function(t,e){if(e&&P_(e.style)){var i,n=e.style;n._shadowDom?(i=n._shadowDom,this.getDefs(!0).contains(n._shadowDom)||this.addDom(i)):i=this.add(e),this.markUsed(e);var o=i.getAttribute("id");t.style.filter="url(#"+o+")"}},k_.prototype.add=function(t){var e=this.createElement("filter"),i=t.style;return i._shadowDomId=i._shadowDomId||this.nextId++,e.setAttribute("id","zr"+this._zrId+"-shadow-"+i._shadowDomId),this.updateDom(t,e),this.addDom(e),e},k_.prototype.update=function(t,e){var i=e.style;if(P_(i)){var n=this;D_.prototype.update.call(this,e,function(t){n.updateDom(e,t._shadowDom)})}else this.remove(t,i)},k_.prototype.remove=function(t,e){null!=e._shadowDomId&&(this.removeDom(e),t.style.filter="")},k_.prototype.updateDom=function(t,e){var i=e.getElementsByTagName("feDropShadow");i=0===i.length?this.createElement("feDropShadow"):i[0];var n,o,a,r,s=t.style,l=t.scale?t.scale[0]||1:1,u=t.scale?t.scale[1]||1:1;if(s.shadowBlur||s.shadowOffsetX||s.shadowOffsetY)n=s.shadowOffsetX||0,o=s.shadowOffsetY||0,a=s.shadowBlur,r=s.shadowColor;else{if(!s.textShadowBlur)return void this.removeDom(e,s);n=s.textShadowOffsetX||0,o=s.textShadowOffsetY||0,a=s.textShadowBlur,r=s.textShadowColor}i.setAttribute("dx",n/l),i.setAttribute("dy",o/u),i.setAttribute("flood-color",r);var h=a/2/l+" "+a/2/u;i.setAttribute("stdDeviation",h),e.setAttribute("x","-100%"),e.setAttribute("y","-100%"),e.setAttribute("width",Math.ceil(a/2*200)+"%"),e.setAttribute("height",Math.ceil(a/2*200)+"%"),e.appendChild(i),s._shadowDom=e},k_.prototype.markUsed=function(t){var e=t.style;e&&e._shadowDom&&D_.prototype.markUsed.call(this,e._shadowDom)};var IR=function(t,e,i,n){this.root=t,this.storage=e,this._opts=i=a({},i||{});var o=p_("svg");o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("version","1.1"),o.setAttribute("baseProfile","full"),o.style.cssText="user-select:none;position:absolute;left:0;top:0;",this.gradientManager=new C_(n,o),this.clipPathManager=new L_(n,o),this.shadowManager=new k_(n,o);var r=document.createElement("div");r.style.cssText="overflow:hidden;position:relative",this._svgRoot=o,this._viewport=r,t.appendChild(r),r.appendChild(o),this.resize(i.width,i.height),this._visibleList=[]};IR.prototype={constructor:IR,getType:function(){return"svg"},getViewportRoot:function(){return this._viewport},getViewportRootOffset:function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},refresh:function(){var t=this.storage.getDisplayList(!0);this._paintList(t)},setBackgroundColor:function(t){this._viewport.style.background=t},_paintList:function(t){this.gradientManager.markAllUnused(),this.clipPathManager.markAllUnused(),this.shadowManager.markAllUnused();var e,i=this._svgRoot,n=this._visibleList,o=t.length,a=[];for(e=0;e=0;--n)if(e[n]===t)return!0;return!1}),i):null:i[0]},resize:function(t,e){var i=this._viewport;i.style.display="none";var n=this._opts;if(null!=t&&(n.width=t),null!=e&&(n.height=e),t=this._getSize(0),e=this._getSize(1),i.style.display="",this._width!==t||this._height!==e){this._width=t,this._height=e;var o=i.style;o.width=t+"px",o.height=e+"px";var a=this._svgRoot;a.setAttribute("width",t),a.setAttribute("height",e)}},getWidth:function(){return this._width},getHeight:function(){return this._height},_getSize:function(t){var e=this._opts,i=["width","height"][t],n=["clientWidth","clientHeight"][t],o=["paddingLeft","paddingTop"][t],a=["paddingRight","paddingBottom"][t];if(null!=e[i]&&"auto"!==e[i])return parseFloat(e[i]);var r=this.root,s=document.defaultView.getComputedStyle(r);return(r[n]||N_(s[i])||N_(r.style[i]))-(N_(s[o])||0)-(N_(s[a])||0)|0},dispose:function(){this.root.innerHTML="",this._svgRoot=this._viewport=this.storage=null},clear:function(){this._viewport&&this.root.removeChild(this._viewport)},pathToDataUrl:function(){return this.refresh(),"data:image/svg+xml;charset=UTF-8,"+this._svgRoot.outerHTML}},d(["getLayer","insertLayer","eachLayer","eachBuiltinLayer","eachOtherLayer","getLayers","modLayer","delLayer","clearLayer","toDataURL","pathToImage"],function(t){IR.prototype[t]=F_(t)}),Ti("svg",IR),t.version="4.2.1",t.dependencies=ET,t.PRIORITY=VT,t.init=function(t,e,i){var n=ks(t);if(n)return n;var o=new us(t,e,i);return o.id="ec_"+iA++,tA[o.id]=o,Fi(t,oA,o.id),Cs(o),o},t.connect=function(t){if(y(t)){var e=t;t=null,kT(e,function(e){null!=e.group&&(t=e.group)}),t=t||"g_"+nA++,kT(e,function(e){e.group=t})}return eA[t]=!0,t},t.disConnect=Ls,t.disconnect=aA,t.dispose=function(t){"string"==typeof t?t=tA[t]:t instanceof us||(t=ks(t)),t instanceof us&&!t.isDisposed()&&t.dispose()},t.getInstanceByDom=ks,t.getInstanceById=function(t){return tA[t]},t.registerTheme=Ps,t.registerPreprocessor=Ns,t.registerProcessor=Os,t.registerPostUpdate=function(t){KT.push(t)},t.registerAction=Es,t.registerCoordinateSystem=Rs,t.getCoordinateSystemDimensions=function(t){var e=Fa.get(t);if(e)return e.getDimensionsInfo?e.getDimensionsInfo():e.dimensions.slice()},t.registerLayout=zs,t.registerVisual=Bs,t.registerLoading=Gs,t.extendComponentModel=Fs,t.extendComponentView=Ws,t.extendSeriesModel=Hs,t.extendChartView=Zs,t.setCanvasCreator=function(t){e("createCanvas",t)},t.registerMap=function(t,e,i){DT.registerMap(t,e,i)},t.getMap=function(t){var e=DT.retrieveMap(t);return e&&e[0]&&{geoJson:e[0].geoJSON,specialAreas:e[0].specialAreas}},t.dataTool=rA,t.zrender=Hb,t.number=YM,t.format=eI,t.throttle=Pr,t.helper=tD,t.matrix=Sw,t.vector=cw,t.color=Ww,t.parseGeoJSON=iD,t.parseGeoJson=rD,t.util=sD,t.graphic=lD,t.List=vA,t.Model=No,t.Axis=aD,t.env=U_}); \ No newline at end of file diff --git a/uni_modules/qiun-data-charts/static/h5/echarts.min.js b/uni_modules/qiun-data-charts/static/h5/echarts.min.js new file mode 100644 index 0000000..5396a03 --- /dev/null +++ b/uni_modules/qiun-data-charts/static/h5/echarts.min.js @@ -0,0 +1,23 @@ + +/* +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +* 版本为4.2.1,修改一处源码:this.el.hide() 改为 this.el?this.el.hide():true +*/ + + +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t,e){"createCanvas"===t&&(nw=null),ew[t]=e}function i(t){if(null==t||"object"!=typeof t)return t;var e=t,n=Y_.call(t);if("[object Array]"===n){if(!O(t)){e=[];for(var o=0,a=t.length;o=0){var o="touchend"!==n?e.targetTouches[0]:e.changedTouches[0];o&&st(t,o,e,i)}else st(t,e,e,i),e.zrDelta=e.wheelDelta?e.wheelDelta/120:-(e.detail||0)/3;var a=e.button;return null==e.which&&void 0!==a&&gw.test(e.type)&&(e.which=1&a?1:2&a?3:4&a?2:0),e}function ht(t,e,i){pw?t.addEventListener(e,i):t.attachEvent("on"+e,i)}function ct(t,e,i){pw?t.removeEventListener(e,i):t.detachEvent("on"+e,i)}function dt(t){return 2===t.which||3===t.which}function ft(t){var e=t[1][0]-t[0][0],i=t[1][1]-t[0][1];return Math.sqrt(e*e+i*i)}function pt(t){return[(t[0][0]+t[1][0])/2,(t[0][1]+t[1][1])/2]}function gt(t,e,i){return{type:t,event:i,target:e.target,topTarget:e.topTarget,cancelBubble:!1,offsetX:i.zrX,offsetY:i.zrY,gestureEvent:i.gestureEvent,pinchX:i.pinchX,pinchY:i.pinchY,pinchScale:i.pinchScale,wheelDelta:i.zrDelta,zrByTouch:i.zrByTouch,which:i.which,stop:mt}}function mt(t){mw(this.event)}function vt(){}function yt(t,e,i){if(t[t.rectHover?"rectContain":"contain"](e,i)){for(var n,o=t;o;){if(o.clipPath&&!o.clipPath.contain(e,i))return!1;o.silent&&(n=!0),o=o.parent}return!n||xw}return!1}function xt(){var t=new bw(6);return _t(t),t}function _t(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t}function wt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t}function bt(t,e,i){var n=e[0]*i[0]+e[2]*i[1],o=e[1]*i[0]+e[3]*i[1],a=e[0]*i[2]+e[2]*i[3],r=e[1]*i[2]+e[3]*i[3],s=e[0]*i[4]+e[2]*i[5]+e[4],l=e[1]*i[4]+e[3]*i[5]+e[5];return t[0]=n,t[1]=o,t[2]=a,t[3]=r,t[4]=s,t[5]=l,t}function St(t,e,i){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4]+i[0],t[5]=e[5]+i[1],t}function Mt(t,e,i){var n=e[0],o=e[2],a=e[4],r=e[1],s=e[3],l=e[5],u=Math.sin(i),h=Math.cos(i);return t[0]=n*h+r*u,t[1]=-n*u+r*h,t[2]=o*h+s*u,t[3]=-o*u+h*s,t[4]=h*a+u*l,t[5]=h*l-u*a,t}function It(t,e,i){var n=i[0],o=i[1];return t[0]=e[0]*n,t[1]=e[1]*o,t[2]=e[2]*n,t[3]=e[3]*o,t[4]=e[4]*n,t[5]=e[5]*o,t}function Tt(t,e){var i=e[0],n=e[2],o=e[4],a=e[1],r=e[3],s=e[5],l=i*r-a*n;return l?(l=1/l,t[0]=r*l,t[1]=-a*l,t[2]=-n*l,t[3]=i*l,t[4]=(n*s-r*o)*l,t[5]=(a*o-i*s)*l,t):null}function At(t){var e=xt();return wt(e,t),e}function Dt(t){return t>Iw||t<-Iw}function Ct(t){this._target=t.target,this._life=t.life||1e3,this._delay=t.delay||0,this._initialized=!1,this.loop=null!=t.loop&&t.loop,this.gap=t.gap||0,this.easing=t.easing||"Linear",this.onframe=t.onframe,this.ondestroy=t.ondestroy,this.onrestart=t.onrestart,this._pausedTime=0,this._paused=!1}function Lt(t){return(t=Math.round(t))<0?0:t>255?255:t}function kt(t){return(t=Math.round(t))<0?0:t>360?360:t}function Pt(t){return t<0?0:t>1?1:t}function Nt(t){return Lt(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100*255:parseInt(t,10))}function Ot(t){return Pt(t.length&&"%"===t.charAt(t.length-1)?parseFloat(t)/100:parseFloat(t))}function Et(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}function Rt(t,e,i){return t+(e-t)*i}function zt(t,e,i,n,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t}function Bt(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Vt(t,e){Vw&&Bt(Vw,e),Vw=Bw.put(t,Vw||e.slice())}function Gt(t,e){if(t){e=e||[];var i=Bw.get(t);if(i)return Bt(e,i);var n=(t+="").replace(/ /g,"").toLowerCase();if(n in zw)return Bt(e,zw[n]),Vt(t,e),e;if("#"!==n.charAt(0)){var o=n.indexOf("("),a=n.indexOf(")");if(-1!==o&&a+1===n.length){var r=n.substr(0,o),s=n.substr(o+1,a-(o+1)).split(","),l=1;switch(r){case"rgba":if(4!==s.length)return void zt(e,0,0,0,1);l=Ot(s.pop());case"rgb":return 3!==s.length?void zt(e,0,0,0,1):(zt(e,Nt(s[0]),Nt(s[1]),Nt(s[2]),l),Vt(t,e),e);case"hsla":return 4!==s.length?void zt(e,0,0,0,1):(s[3]=Ot(s[3]),Ft(s,e),Vt(t,e),e);case"hsl":return 3!==s.length?void zt(e,0,0,0,1):(Ft(s,e),Vt(t,e),e);default:return}}zt(e,0,0,0,1)}else{if(4===n.length)return(u=parseInt(n.substr(1),16))>=0&&u<=4095?(zt(e,(3840&u)>>4|(3840&u)>>8,240&u|(240&u)>>4,15&u|(15&u)<<4,1),Vt(t,e),e):void zt(e,0,0,0,1);if(7===n.length){var u=parseInt(n.substr(1),16);return u>=0&&u<=16777215?(zt(e,(16711680&u)>>16,(65280&u)>>8,255&u,1),Vt(t,e),e):void zt(e,0,0,0,1)}}}}function Ft(t,e){var i=(parseFloat(t[0])%360+360)%360/360,n=Ot(t[1]),o=Ot(t[2]),a=o<=.5?o*(n+1):o+n-o*n,r=2*o-a;return e=e||[],zt(e,Lt(255*Et(r,a,i+1/3)),Lt(255*Et(r,a,i)),Lt(255*Et(r,a,i-1/3)),1),4===t.length&&(e[3]=t[3]),e}function Wt(t){if(t){var e,i,n=t[0]/255,o=t[1]/255,a=t[2]/255,r=Math.min(n,o,a),s=Math.max(n,o,a),l=s-r,u=(s+r)/2;if(0===l)e=0,i=0;else{i=u<.5?l/(s+r):l/(2-s-r);var h=((s-n)/6+l/2)/l,c=((s-o)/6+l/2)/l,d=((s-a)/6+l/2)/l;n===s?e=d-c:o===s?e=1/3+h-d:a===s&&(e=2/3+c-h),e<0&&(e+=1),e>1&&(e-=1)}var f=[360*e,i,u];return null!=t[3]&&f.push(t[3]),f}}function Ht(t,e){var i=Gt(t);if(i){for(var n=0;n<3;n++)i[n]=e<0?i[n]*(1-e)|0:(255-i[n])*e+i[n]|0,i[n]>255?i[n]=255:t[n]<0&&(i[n]=0);return qt(i,4===i.length?"rgba":"rgb")}}function Zt(t){var e=Gt(t);if(e)return((1<<24)+(e[0]<<16)+(e[1]<<8)+ +e[2]).toString(16).slice(1)}function Ut(t,e,i){if(e&&e.length&&t>=0&&t<=1){i=i||[];var n=t*(e.length-1),o=Math.floor(n),a=Math.ceil(n),r=e[o],s=e[a],l=n-o;return i[0]=Lt(Rt(r[0],s[0],l)),i[1]=Lt(Rt(r[1],s[1],l)),i[2]=Lt(Rt(r[2],s[2],l)),i[3]=Pt(Rt(r[3],s[3],l)),i}}function Xt(t,e,i){if(e&&e.length&&t>=0&&t<=1){var n=t*(e.length-1),o=Math.floor(n),a=Math.ceil(n),r=Gt(e[o]),s=Gt(e[a]),l=n-o,u=qt([Lt(Rt(r[0],s[0],l)),Lt(Rt(r[1],s[1],l)),Lt(Rt(r[2],s[2],l)),Pt(Rt(r[3],s[3],l))],"rgba");return i?{color:u,leftIndex:o,rightIndex:a,value:n}:u}}function jt(t,e,i,n){if(t=Gt(t))return t=Wt(t),null!=e&&(t[0]=kt(e)),null!=i&&(t[1]=Ot(i)),null!=n&&(t[2]=Ot(n)),qt(Ft(t),"rgba")}function Yt(t,e){if((t=Gt(t))&&null!=e)return t[3]=Pt(e),qt(t,"rgba")}function qt(t,e){if(t&&t.length){var i=t[0]+","+t[1]+","+t[2];return"rgba"!==e&&"hsva"!==e&&"hsla"!==e||(i+=","+t[3]),e+"("+i+")"}}function Kt(t,e){return t[e]}function $t(t,e,i){t[e]=i}function Jt(t,e,i){return(e-t)*i+t}function Qt(t,e,i){return i>.5?e:t}function te(t,e,i,n,o){var a=t.length;if(1===o)for(s=0;so)t.length=o;else for(r=n;r=0&&!(m[i]<=e);i--);i=Math.min(i,u-2)}else{for(i=L;ie);i++);i=Math.min(i-1,u-2)}L=i,k=e;var n=m[i+1]-m[i];if(0!==n)if(I=(e-m[i])/n,l)if(A=v[i],T=v[0===i?i:i-1],D=v[i>u-2?u-1:i+1],C=v[i>u-3?u-1:i+2],d)ne(T,A,D,C,I,I*I,I*I*I,r(t,o),g);else{if(f)a=ne(T,A,D,C,I,I*I,I*I*I,P,1),a=re(P);else{if(p)return Qt(A,D,I);a=oe(T,A,D,C,I,I*I,I*I*I)}s(t,o,a)}else if(d)te(v[i],v[i+1],I,r(t,o),g);else{var a;if(f)te(v[i],v[i+1],I,P,1),a=re(P);else{if(p)return Qt(v[i],v[i+1],I);a=Jt(v[i],v[i+1],I)}s(t,o,a)}},ondestroy:i});return e&&"spline"!==e&&(N.easing=e),N}}}function ue(t,e,i,n,o,a,r,s){_(n)?(a=o,o=n,n=0):x(o)?(a=o,o="linear",n=0):x(n)?(a=n,n=0):x(i)?(a=i,i=500):i||(i=500),t.stopAnimation(),he(t,"",t,e,i,n,s);var l=t.animators.slice(),u=l.length;u||a&&a();for(var h=0;h0&&t.animate(e,!1).when(null==o?500:o,s).delay(a||0)}function ce(t,e,i,n){if(e){var o={};o[e]={},o[e][i]=n,t.attr(o)}else t.attr(i,n)}function de(t,e,i,n){i<0&&(t+=i,i=-i),n<0&&(e+=n,n=-n),this.x=t,this.y=e,this.width=i,this.height=n}function fe(t){for(var e=0;t>=eb;)e|=1&t,t>>=1;return t+e}function pe(t,e,i,n){var o=e+1;if(o===i)return 1;if(n(t[o++],t[e])<0){for(;o=0;)o++;return o-e}function ge(t,e,i){for(i--;e>>1])<0?l=a:s=a+1;var u=n-s;switch(u){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;u>0;)t[s+u]=t[s+u-1],u--}t[s]=r}}function ve(t,e,i,n,o,a){var r=0,s=0,l=1;if(a(t,e[i+o])>0){for(s=n-o;l0;)r=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),r+=o,l+=o}else{for(s=o+1;ls&&(l=s);var u=r;r=o-l,l=o-u}for(r++;r>>1);a(t,e[i+h])>0?r=h+1:l=h}return l}function ye(t,e,i,n,o,a){var r=0,s=0,l=1;if(a(t,e[i+o])<0){for(s=o+1;ls&&(l=s);var u=r;r=o-l,l=o-u}else{for(s=n-o;l=0;)r=l,(l=1+(l<<1))<=0&&(l=s);l>s&&(l=s),r+=o,l+=o}for(r++;r>>1);a(t,e[i+h])<0?l=h:r=h+1}return l}function xe(t,e){function i(i){var s=a[i],u=r[i],h=a[i+1],c=r[i+1];r[i]=u+c,i===l-3&&(a[i+1]=a[i+2],r[i+1]=r[i+2]),l--;var d=ye(t[h],t,s,u,0,e);s+=d,0!==(u-=d)&&0!==(c=ve(t[s+u-1],t,h,c,c-1,e))&&(u<=c?n(s,u,h,c):o(s,u,h,c))}function n(i,n,o,a){var r=0;for(r=0;r=ib||f>=ib);if(p)break;g<0&&(g=0),g+=2}if((s=g)<1&&(s=1),1===n){for(r=0;r=0;r--)t[f+r]=t[d+r];if(0===n){v=!0;break}}if(t[c--]=u[h--],1==--a){v=!0;break}if(0!=(m=a-ve(t[l],u,0,a,a-1,e))){for(a-=m,f=(c-=m)+1,d=(h-=m)+1,r=0;r=ib||m>=ib);if(v)break;p<0&&(p=0),p+=2}if((s=p)<1&&(s=1),1===a){for(f=(c-=n)+1,d=(l-=n)+1,r=n-1;r>=0;r--)t[f+r]=t[d+r];t[c]=u[h]}else{if(0===a)throw new Error;for(d=c-(a-1),r=0;r=0;r--)t[f+r]=t[d+r];t[c]=u[h]}else for(d=c-(a-1),r=0;r1;){var t=l-2;if(t>=1&&r[t-1]<=r[t]+r[t+1]||t>=2&&r[t-2]<=r[t]+r[t-1])r[t-1]r[t+1])break;i(t)}},this.forceMergeRuns=function(){for(;l>1;){var t=l-2;t>0&&r[t-1]s&&(l=s),me(t,i,i+l,i+a,e),a=l}r.pushRun(i,a),r.mergeRuns(),o-=a,i+=a}while(0!==o);r.forceMergeRuns()}}function we(t,e){return t.zlevel===e.zlevel?t.z===e.z?t.z2-e.z2:t.z-e.z:t.zlevel-e.zlevel}function be(t,e,i){var n=null==e.x?0:e.x,o=null==e.x2?1:e.x2,a=null==e.y?0:e.y,r=null==e.y2?0:e.y2;return e.global||(n=n*i.width+i.x,o=o*i.width+i.x,a=a*i.height+i.y,r=r*i.height+i.y),n=isNaN(n)?0:n,o=isNaN(o)?1:o,a=isNaN(a)?0:a,r=isNaN(r)?0:r,t.createLinearGradient(n,a,o,r)}function Se(t,e,i){var n=i.width,o=i.height,a=Math.min(n,o),r=null==e.x?.5:e.x,s=null==e.y?.5:e.y,l=null==e.r?.5:e.r;return e.global||(r=r*n+i.x,s=s*o+i.y,l*=a),t.createRadialGradient(r,s,0,r,s,l)}function Me(){return!1}function Ie(t,e,i){var n=iw(),o=e.getWidth(),a=e.getHeight(),r=n.style;return r&&(r.position="absolute",r.left=0,r.top=0,r.width=o+"px",r.height=a+"px",n.setAttribute("data-zr-dom-id",t)),n.width=o*i,n.height=a*i,n}function Te(t){if("string"==typeof t){var e=mb.get(t);return e&&e.image}return t}function Ae(t,e,i,n,o){if(t){if("string"==typeof t){if(e&&e.__zrImageSrc===t||!i)return e;var a=mb.get(t),r={hostEl:i,cb:n,cbPayload:o};return a?!Ce(e=a.image)&&a.pending.push(r):((e=new Image).onload=e.onerror=De,mb.put(t,e.__cachedImgObj={image:e,pending:[r]}),e.src=e.__zrImageSrc=t),e}return t}return e}function De(){var t=this.__cachedImgObj;this.onload=this.onerror=this.__cachedImgObj=null;for(var e=0;exb&&(yb=0,vb={}),yb++,vb[i]=o,o}function ke(t,e,i,n,o,a,r,s){return r?Ne(t,e,i,n,o,a,r,s):Pe(t,e,i,n,o,a,s)}function Pe(t,e,i,n,o,a,r){var s=He(t,e,o,a,r),l=Le(t,e);o&&(l+=o[1]+o[3]);var u=s.outerHeight,h=new de(Oe(0,l,i),Ee(0,u,n),l,u);return h.lineHeight=s.lineHeight,h}function Ne(t,e,i,n,o,a,r,s){var l=Ze(t,{rich:r,truncate:s,font:e,textAlign:i,textPadding:o,textLineHeight:a}),u=l.outerWidth,h=l.outerHeight;return new de(Oe(0,u,i),Ee(0,h,n),u,h)}function Oe(t,e,i){return"right"===i?t-=e:"center"===i&&(t-=e/2),t}function Ee(t,e,i){return"middle"===i?t-=e/2:"bottom"===i&&(t-=e),t}function Re(t,e,i){var n=e.x,o=e.y,a=e.height,r=e.width,s=a/2,l="left",u="top";switch(t){case"left":n-=i,o+=s,l="right",u="middle";break;case"right":n+=i+r,o+=s,u="middle";break;case"top":n+=r/2,o-=i,l="center",u="bottom";break;case"bottom":n+=r/2,o+=a+i,l="center";break;case"inside":n+=r/2,o+=s,l="center",u="middle";break;case"insideLeft":n+=i,o+=s,u="middle";break;case"insideRight":n+=r-i,o+=s,l="right",u="middle";break;case"insideTop":n+=r/2,o+=i,l="center";break;case"insideBottom":n+=r/2,o+=a-i,l="center",u="bottom";break;case"insideTopLeft":n+=i,o+=i;break;case"insideTopRight":n+=r-i,o+=i,l="right";break;case"insideBottomLeft":n+=i,o+=a-i,u="bottom";break;case"insideBottomRight":n+=r-i,o+=a-i,l="right",u="bottom"}return{x:n,y:o,textAlign:l,textVerticalAlign:u}}function ze(t,e,i,n,o){if(!e)return"";var a=(t+"").split("\n");o=Be(e,i,n,o);for(var r=0,s=a.length;r=r;l++)s-=r;var u=Le(i,e);return u>s&&(i="",u=0),s=t-u,n.ellipsis=i,n.ellipsisWidth=u,n.contentWidth=s,n.containerWidth=t,n}function Ve(t,e){var i=e.containerWidth,n=e.font,o=e.contentWidth;if(!i)return"";var a=Le(t,n);if(a<=i)return t;for(var r=0;;r++){if(a<=o||r>=e.maxIterations){t+=e.ellipsis;break}var s=0===r?Ge(t,o,e.ascCharWidth,e.cnCharWidth):a>0?Math.floor(t.length*o/a):0;a=Le(t=t.substr(0,s),n)}return""===t&&(t=e.placeholder),t}function Ge(t,e,i,n){for(var o=0,a=0,r=t.length;au)t="",r=[];else if(null!=h)for(var c=Be(h-(i?i[1]+i[3]:0),e,o.ellipsis,{minChar:o.minChar,placeholder:o.placeholder}),d=0,f=r.length;do&&Ue(i,t.substring(o,a)),Ue(i,n[2],n[1]),o=_b.lastIndex}of)return{lines:[],width:0,height:0};k.textWidth=Le(k.text,_);var b=y.textWidth,S=null==b||"auto"===b;if("string"==typeof b&&"%"===b.charAt(b.length-1))k.percentWidth=b,u.push(k),b=0;else{if(S){b=k.textWidth;var M=y.textBackgroundColor,I=M&&M.image;I&&Ce(I=Te(I))&&(b=Math.max(b,I.width*w/I.height))}var T=x?x[1]+x[3]:0;b+=T;var C=null!=d?d-m:null;null!=C&&Cl&&(i*=l/(c=i+n),n*=l/c),o+a>l&&(o*=l/(c=o+a),a*=l/c),n+o>u&&(n*=u/(c=n+o),o*=u/c),i+a>u&&(i*=u/(c=i+a),a*=u/c),t.moveTo(r+i,s),t.lineTo(r+l-n,s),0!==n&&t.arc(r+l-n,s+n,n,-Math.PI/2,0),t.lineTo(r+l,s+u-o),0!==o&&t.arc(r+l-o,s+u-o,o,0,Math.PI/2),t.lineTo(r+a,s+u),0!==a&&t.arc(r+a,s+u-a,a,Math.PI/2,Math.PI),t.lineTo(r,s+i),0!==i&&t.arc(r+i,s+i,i,Math.PI,1.5*Math.PI)}function Ye(t){return qe(t),d(t.rich,qe),t}function qe(t){if(t){t.font=Xe(t);var e=t.textAlign;"middle"===e&&(e="center"),t.textAlign=null==e||Mb[e]?e:"left";var i=t.textVerticalAlign||t.textBaseline;"center"===i&&(i="middle"),t.textVerticalAlign=null==i||Ib[i]?i:"top",t.textPadding&&(t.textPadding=L(t.textPadding))}}function Ke(t,e,i,n,o,a){n.rich?Je(t,e,i,n,o,a):$e(t,e,i,n,o,a)}function $e(t,e,i,n,o,a){var r,s=ii(n),l=!1,u=e.__attrCachedBy===rb.PLAIN_TEXT;a!==sb?(a&&(r=a.style,l=!s&&u&&r),e.__attrCachedBy=s?rb.NONE:rb.PLAIN_TEXT):u&&(e.__attrCachedBy=rb.NONE);var h=n.font||Sb;l&&h===(r.font||Sb)||(e.font=h);var c=t.__computedFont;t.__styleFont!==h&&(t.__styleFont=h,c=t.__computedFont=e.font);var d=n.textPadding,f=n.textLineHeight,p=t.__textCotentBlock;p&&!t.__dirtyText||(p=t.__textCotentBlock=He(i,c,d,f,n.truncate));var g=p.outerHeight,m=p.lines,v=p.lineHeight,y=ai(g,n,o),x=y.baseX,_=y.baseY,w=y.textAlign||"left",b=y.textVerticalAlign;ti(e,n,o,x,_);var S=Ee(_,g,b),M=x,I=S;if(s||d){var T=Le(i,c);d&&(T+=d[1]+d[3]);var A=Oe(x,T,w);s&&ni(t,e,n,A,S,T,g),d&&(M=hi(x,w,d),I+=d[0])}e.textAlign=w,e.textBaseline="middle",e.globalAlpha=n.opacity||1;for(B=0;B=0&&"right"===(_=b[C]).textAlign;)ei(t,e,_,n,M,v,D,"right"),I-=_.width,D-=_.width,C--;for(A+=(a-(A-m)-(y-D)-I)/2;T<=C;)ei(t,e,_=b[T],n,M,v,A+_.width/2,"center"),A+=_.width,T++;v+=M}}function ti(t,e,i,n,o){if(i&&e.textRotation){var a=e.textOrigin;"center"===a?(n=i.width/2+i.x,o=i.height/2+i.y):a&&(n=a[0]+i.x,o=a[1]+i.y),t.translate(n,o),t.rotate(-e.textRotation),t.translate(-n,-o)}}function ei(t,e,i,n,o,a,r,s){var l=n.rich[i.styleName]||{};l.text=i.text;var u=i.textVerticalAlign,h=a+o/2;"top"===u?h=a+i.height/2:"bottom"===u&&(h=a+o-i.height/2),!i.isLineHolder&&ii(l)&&ni(t,e,l,"right"===s?r-i.width:"center"===s?r-i.width/2:r,h-i.height/2,i.width,i.height);var c=i.textPadding;c&&(r=hi(r,s,c),h-=i.height/2-c[2]-i.textHeight/2),ri(e,"shadowBlur",D(l.textShadowBlur,n.textShadowBlur,0)),ri(e,"shadowColor",l.textShadowColor||n.textShadowColor||"transparent"),ri(e,"shadowOffsetX",D(l.textShadowOffsetX,n.textShadowOffsetX,0)),ri(e,"shadowOffsetY",D(l.textShadowOffsetY,n.textShadowOffsetY,0)),ri(e,"textAlign",s),ri(e,"textBaseline","middle"),ri(e,"font",i.font||Sb);var d=si(l.textStroke||n.textStroke,p),f=li(l.textFill||n.textFill),p=A(l.textStrokeWidth,n.textStrokeWidth);d&&(ri(e,"lineWidth",p),ri(e,"strokeStyle",d),e.strokeText(i.text,r,h)),f&&(ri(e,"fillStyle",f),e.fillText(i.text,r,h))}function ii(t){return!!(t.textBackgroundColor||t.textBorderWidth&&t.textBorderColor)}function ni(t,e,i,n,o,a,r){var s=i.textBackgroundColor,l=i.textBorderWidth,u=i.textBorderColor,h=_(s);if(ri(e,"shadowBlur",i.textBoxShadowBlur||0),ri(e,"shadowColor",i.textBoxShadowColor||"transparent"),ri(e,"shadowOffsetX",i.textBoxShadowOffsetX||0),ri(e,"shadowOffsetY",i.textBoxShadowOffsetY||0),h||l&&u){e.beginPath();var c=i.textBorderRadius;c?je(e,{x:n,y:o,width:a,height:r,r:c}):e.rect(n,o,a,r),e.closePath()}if(h)if(ri(e,"fillStyle",s),null!=i.fillOpacity){f=e.globalAlpha;e.globalAlpha=i.fillOpacity*i.opacity,e.fill(),e.globalAlpha=f}else e.fill();else if(w(s)){var d=s.image;(d=Ae(d,null,t,oi,s))&&Ce(d)&&e.drawImage(d,n,o,a,r)}if(l&&u)if(ri(e,"lineWidth",l),ri(e,"strokeStyle",u),null!=i.strokeOpacity){var f=e.globalAlpha;e.globalAlpha=i.strokeOpacity*i.opacity,e.stroke(),e.globalAlpha=f}else e.stroke()}function oi(t,e){e.image=t}function ai(t,e,i){var n=e.x||0,o=e.y||0,a=e.textAlign,r=e.textVerticalAlign;if(i){var s=e.textPosition;if(s instanceof Array)n=i.x+ui(s[0],i.width),o=i.y+ui(s[1],i.height);else{var l=Re(s,i,e.textDistance);n=l.x,o=l.y,a=a||l.textAlign,r=r||l.textVerticalAlign}var u=e.textOffset;u&&(n+=u[0],o+=u[1])}return{baseX:n,baseY:o,textAlign:a,textVerticalAlign:r}}function ri(t,e,i){return t[e]=ab(t,e,i),t[e]}function si(t,e){return null==t||e<=0||"transparent"===t||"none"===t?null:t.image||t.colorStops?"#000":t}function li(t){return null==t||"none"===t?null:t.image||t.colorStops?"#000":t}function ui(t,e){return"string"==typeof t?t.lastIndexOf("%")>=0?parseFloat(t)/100*e:parseFloat(t):t}function hi(t,e,i){return"right"===e?t-i[1]:"center"===e?t+i[3]/2-i[1]/2:t+i[3]}function ci(t,e){return null!=t&&(t||e.textBackgroundColor||e.textBorderWidth&&e.textBorderColor||e.textPadding)}function di(t){t=t||{},Kw.call(this,t);for(var e in t)t.hasOwnProperty(e)&&"style"!==e&&(this[e]=t[e]);this.style=new ub(t.style,this),this._rect=null,this.__clipPaths=[]}function fi(t){di.call(this,t)}function pi(t){return parseInt(t,10)}function gi(t){return!!t&&(!!t.__builtin__||"function"==typeof t.resize&&"function"==typeof t.refresh)}function mi(t,e,i){return Cb.copy(t.getBoundingRect()),t.transform&&Cb.applyTransform(t.transform),Lb.width=e,Lb.height=i,!Cb.intersect(Lb)}function vi(t,e){if(t===e)return!1;if(!t||!e||t.length!==e.length)return!0;for(var i=0;i=i.length&&i.push({option:t})}}),i}function Ni(t){var e=R();Zb(t,function(t,i){var n=t.exist;n&&e.set(n.id,t)}),Zb(t,function(t,i){var n=t.option;k(!n||null==n.id||!e.get(n.id)||e.get(n.id)===t,"id duplicates: "+(n&&n.id)),n&&null!=n.id&&e.set(n.id,t),!t.keyInfo&&(t.keyInfo={})}),Zb(t,function(t,i){var n=t.exist,o=t.option,a=t.keyInfo;if(Ub(o)){if(a.name=null!=o.name?o.name+"":n?n.name:jb+i,n)a.id=n.id;else if(null!=o.id)a.id=o.id+"";else{var r=0;do{a.id="\0"+a.name+"\0"+r++}while(e.get(a.id))}e.set(a.id,t)}})}function Oi(t){var e=t.name;return!(!e||!e.indexOf(jb))}function Ei(t){return Ub(t)&&t.id&&0===(t.id+"").indexOf("\0_ec_\0")}function Ri(t,e){function i(t,e,i){for(var n=0,o=t.length;n-rS&&trS||t<-rS}function tn(t,e,i,n,o){var a=1-o;return a*a*(a*t+3*o*e)+o*o*(o*n+3*a*i)}function en(t,e,i,n,o){var a=1-o;return 3*(((e-t)*a+2*(i-e)*o)*a+(n-i)*o*o)}function nn(t,e,i,n,o,a){var r=n+3*(e-i)-t,s=3*(i-2*e+t),l=3*(e-t),u=t-o,h=s*s-3*r*l,c=s*l-9*r*u,d=l*l-3*s*u,f=0;if(Ji(h)&&Ji(c))Ji(s)?a[0]=0:(M=-l/s)>=0&&M<=1&&(a[f++]=M);else{var p=c*c-4*h*d;if(Ji(p)){var g=c/h,m=-g/2;(M=-s/r+g)>=0&&M<=1&&(a[f++]=M),m>=0&&m<=1&&(a[f++]=m)}else if(p>0){var v=aS(p),y=h*s+1.5*r*(-c+v),x=h*s+1.5*r*(-c-v);(M=(-s-((y=y<0?-oS(-y,uS):oS(y,uS))+(x=x<0?-oS(-x,uS):oS(x,uS))))/(3*r))>=0&&M<=1&&(a[f++]=M)}else{var _=(2*h*s-3*r*c)/(2*aS(h*h*h)),w=Math.acos(_)/3,b=aS(h),S=Math.cos(w),M=(-s-2*b*S)/(3*r),m=(-s+b*(S+lS*Math.sin(w)))/(3*r),I=(-s+b*(S-lS*Math.sin(w)))/(3*r);M>=0&&M<=1&&(a[f++]=M),m>=0&&m<=1&&(a[f++]=m),I>=0&&I<=1&&(a[f++]=I)}}return f}function on(t,e,i,n,o){var a=6*i-12*e+6*t,r=9*e+3*n-3*t-9*i,s=3*e-3*t,l=0;if(Ji(r))Qi(a)&&(c=-s/a)>=0&&c<=1&&(o[l++]=c);else{var u=a*a-4*r*s;if(Ji(u))o[0]=-a/(2*r);else if(u>0){var h=aS(u),c=(-a+h)/(2*r),d=(-a-h)/(2*r);c>=0&&c<=1&&(o[l++]=c),d>=0&&d<=1&&(o[l++]=d)}}return l}function an(t,e,i,n,o,a){var r=(e-t)*o+t,s=(i-e)*o+e,l=(n-i)*o+i,u=(s-r)*o+r,h=(l-s)*o+s,c=(h-u)*o+u;a[0]=t,a[1]=r,a[2]=u,a[3]=c,a[4]=c,a[5]=h,a[6]=l,a[7]=n}function rn(t,e,i,n,o,a,r,s,l,u,h){var c,d,f,p,g,m=.005,v=1/0;hS[0]=l,hS[1]=u;for(var y=0;y<1;y+=.05)cS[0]=tn(t,i,o,r,y),cS[1]=tn(e,n,a,s,y),(p=hw(hS,cS))=0&&p=0&&c<=1&&(o[l++]=c);else{var u=r*r-4*a*s;if(Ji(u))(c=-r/(2*a))>=0&&c<=1&&(o[l++]=c);else if(u>0){var h=aS(u),c=(-r+h)/(2*a),d=(-r-h)/(2*a);c>=0&&c<=1&&(o[l++]=c),d>=0&&d<=1&&(o[l++]=d)}}return l}function hn(t,e,i){var n=t+i-2*e;return 0===n?.5:(t-e)/n}function cn(t,e,i,n,o){var a=(e-t)*n+t,r=(i-e)*n+e,s=(r-a)*n+a;o[0]=t,o[1]=a,o[2]=s,o[3]=s,o[4]=r,o[5]=i}function dn(t,e,i,n,o,a,r,s,l){var u,h=.005,c=1/0;hS[0]=r,hS[1]=s;for(var d=0;d<1;d+=.05)cS[0]=sn(t,i,o,d),cS[1]=sn(e,n,a,d),(m=hw(hS,cS))=0&&m1e-4)return s[0]=t-i,s[1]=e-n,l[0]=t+i,void(l[1]=e+n);if(yS[0]=mS(o)*i+t,yS[1]=gS(o)*n+e,xS[0]=mS(a)*i+t,xS[1]=gS(a)*n+e,u(s,yS,xS),h(l,yS,xS),(o%=vS)<0&&(o+=vS),(a%=vS)<0&&(a+=vS),o>a&&!r?a+=vS:oo&&(_S[0]=mS(f)*i+t,_S[1]=gS(f)*n+e,u(s,_S,s),h(l,_S,l))}function yn(t,e,i,n,o,a,r){if(0===o)return!1;var s=o,l=0,u=t;if(r>e+s&&r>n+s||rt+s&&a>i+s||ae+c&&h>n+c&&h>a+c&&h>s+c||ht+c&&u>i+c&&u>o+c&&u>r+c||ue+u&&l>n+u&&l>a+u||lt+u&&s>i+u&&s>o+u||si||h+uo&&(o+=zS);var d=Math.atan2(l,s);return d<0&&(d+=zS),d>=n&&d<=o||d+zS>=n&&d+zS<=o}function Sn(t,e,i,n,o,a){if(a>e&&a>n||ao?r:0}function Mn(t,e){return Math.abs(t-e)e&&u>n&&u>a&&u>s||u1&&In(),c=tn(e,n,a,s,WS[0]),p>1&&(d=tn(e,n,a,s,WS[1]))),2===p?me&&s>n&&s>a||s=0&&u<=1){for(var h=0,c=sn(e,n,a,u),d=0;di||s<-i)return 0;u=Math.sqrt(i*i-s*s);FS[0]=-u,FS[1]=u;var l=Math.abs(n-o);if(l<1e-4)return 0;if(l%VS<1e-4){n=0,o=VS;p=a?1:-1;return r>=FS[0]+t&&r<=FS[1]+t?p:0}if(a){var u=n;n=wn(o),o=wn(u)}else n=wn(n),o=wn(o);n>o&&(o+=VS);for(var h=0,c=0;c<2;c++){var d=FS[c];if(d+t>r){var f=Math.atan2(s,d),p=a?1:-1;f<0&&(f=VS+f),(f>=n&&f<=o||f+VS>=n&&f+VS<=o)&&(f>Math.PI/2&&f<1.5*Math.PI&&(p=-p),h+=p)}}return h}function Cn(t,e,i,n,o){for(var a=0,r=0,s=0,l=0,u=0,h=0;h1&&(i||(a+=Sn(r,s,l,u,n,o))),1===h&&(l=r=t[h],u=s=t[h+1]),c){case BS.M:r=l=t[h++],s=u=t[h++];break;case BS.L:if(i){if(yn(r,s,t[h],t[h+1],e,n,o))return!0}else a+=Sn(r,s,t[h],t[h+1],n,o)||0;r=t[h++],s=t[h++];break;case BS.C:if(i){if(xn(r,s,t[h++],t[h++],t[h++],t[h++],t[h],t[h+1],e,n,o))return!0}else a+=Tn(r,s,t[h++],t[h++],t[h++],t[h++],t[h],t[h+1],n,o)||0;r=t[h++],s=t[h++];break;case BS.Q:if(i){if(_n(r,s,t[h++],t[h++],t[h],t[h+1],e,n,o))return!0}else a+=An(r,s,t[h++],t[h++],t[h],t[h+1],n,o)||0;r=t[h++],s=t[h++];break;case BS.A:var d=t[h++],f=t[h++],p=t[h++],g=t[h++],m=t[h++],v=t[h++];h+=1;var y=1-t[h++],x=Math.cos(m)*p+d,_=Math.sin(m)*g+f;h>1?a+=Sn(r,s,x,_,n,o):(l=x,u=_);var w=(n-d)*g/p+d;if(i){if(bn(d,f,g,m,m+v,y,e,w,o))return!0}else a+=Dn(d,f,g,m,m+v,y,w,o);r=Math.cos(m+v)*p+d,s=Math.sin(m+v)*g+f;break;case BS.R:l=r=t[h++],u=s=t[h++];var x=l+t[h++],_=u+t[h++];if(i){if(yn(l,u,x,u,e,n,o)||yn(x,u,x,_,e,n,o)||yn(x,_,l,_,e,n,o)||yn(l,_,l,u,e,n,o))return!0}else a+=Sn(x,u,x,_,n,o),a+=Sn(l,_,l,u,n,o);break;case BS.Z:if(i){if(yn(r,s,l,u,e,n,o))return!0}else a+=Sn(r,s,l,u,n,o);r=l,s=u}}return i||Mn(s,u)||(a+=Sn(r,s,l,u,n,o)||0),0!==a}function Ln(t,e,i){return Cn(t,0,!1,e,i)}function kn(t,e,i,n){return Cn(t,e,!0,i,n)}function Pn(t){di.call(this,t),this.path=null}function Nn(t,e,i,n,o,a,r,s,l,u,h){var c=l*(tM/180),d=QS(c)*(t-i)/2+JS(c)*(e-n)/2,f=-1*JS(c)*(t-i)/2+QS(c)*(e-n)/2,p=d*d/(r*r)+f*f/(s*s);p>1&&(r*=$S(p),s*=$S(p));var g=(o===a?-1:1)*$S((r*r*(s*s)-r*r*(f*f)-s*s*(d*d))/(r*r*(f*f)+s*s*(d*d)))||0,m=g*r*f/s,v=g*-s*d/r,y=(t+i)/2+QS(c)*m-JS(c)*v,x=(e+n)/2+JS(c)*m+QS(c)*v,_=nM([1,0],[(d-m)/r,(f-v)/s]),w=[(d-m)/r,(f-v)/s],b=[(-1*d-m)/r,(-1*f-v)/s],S=nM(w,b);iM(w,b)<=-1&&(S=tM),iM(w,b)>=1&&(S=0),0===a&&S>0&&(S-=2*tM),1===a&&S<0&&(S+=2*tM),h.addData(u,y,x,r,s,_,S,c,a)}function On(t){if(!t)return new ES;for(var e,i=0,n=0,o=i,a=n,r=new ES,s=ES.CMD,l=t.match(oM),u=0;u=2){if(o&&"spline"!==o){var a=fM(n,o,i,e.smoothConstraint);t.moveTo(n[0][0],n[0][1]);for(var r=n.length,s=0;s<(i?r:r-1);s++){var l=a[2*s],u=a[2*s+1],h=n[(s+1)%r];t.bezierCurveTo(l[0],l[1],u[0],u[1],h[0],h[1])}}else{"spline"===o&&(n=dM(n,i)),t.moveTo(n[0][0],n[0][1]);for(var s=1,c=n.length;s=0)?(i={textFill:null,textStroke:t.textStroke,textStrokeWidth:t.textStrokeWidth},t.textFill="#fff",null==t.textStroke&&(t.textStroke=a,null==t.textStrokeWidth&&(t.textStrokeWidth=2))):null!=a&&(i={textFill:null},t.textFill=a),i&&(t.insideRollback=i)}}function bo(t){var e=t.insideRollback;e&&(t.textFill=e.textFill,t.textStroke=e.textStroke,t.textStrokeWidth=e.textStrokeWidth,t.insideRollback=null)}function So(t,e){var i=e||e.getModel("textStyle");return P([t.fontStyle||i&&i.getShallow("fontStyle")||"",t.fontWeight||i&&i.getShallow("fontWeight")||"",(t.fontSize||i&&i.getShallow("fontSize")||12)+"px",t.fontFamily||i&&i.getShallow("fontFamily")||"sans-serif"].join(" "))}function Mo(t,e,i,n,o,a){if("function"==typeof o&&(a=o,o=null),n&&n.isAnimationEnabled()){var r=t?"Update":"",s=n.getShallow("animationDuration"+r),l=n.getShallow("animationEasing"+r),u=n.getShallow("animationDelay"+r);"function"==typeof u&&(u=u(o,n.getAnimationDelayParams?n.getAnimationDelayParams(e,o):null)),"function"==typeof s&&(s=s(o)),s>0?e.animateTo(i,s,u||0,l,a,!!a):(e.stopAnimation(),e.attr(i),a&&a())}else e.stopAnimation(),e.attr(i),a&&a()}function Io(t,e,i,n,o){Mo(!0,t,e,i,n,o)}function To(t,e,i,n,o){Mo(!1,t,e,i,n,o)}function Ao(t,e){for(var i=_t([]);t&&t!==e;)bt(i,t.getLocalTransform(),i),t=t.parent;return i}function Do(t,e,i){return e&&!c(e)&&(e=Tw.getLocalTransform(e)),i&&(e=Tt([],e)),Q([],t,e)}function Co(t,e,i){var n=0===e[4]||0===e[5]||0===e[0]?1:Math.abs(2*e[4]/e[0]),o=0===e[4]||0===e[5]||0===e[2]?1:Math.abs(2*e[4]/e[2]),a=["left"===t?-n:"right"===t?n:0,"top"===t?-o:"bottom"===t?o:0];return a=Do(a,e,i),Math.abs(a[0])>Math.abs(a[1])?a[0]>0?"right":"left":a[1]>0?"bottom":"top"}function Lo(t,e,i,n){function o(t){var e={position:F(t.position),rotation:t.rotation};return t.shape&&(e.shape=a({},t.shape)),e}if(t&&e){var r=function(t){var e={};return t.traverse(function(t){!t.isGroup&&t.anid&&(e[t.anid]=t)}),e}(t);e.traverse(function(t){if(!t.isGroup&&t.anid){var e=r[t.anid];if(e){var n=o(t);t.attr(o(e)),Io(t,n,i,t.dataIndex)}}})}}function ko(t,e){return f(t,function(t){var i=t[0];i=LM(i,e.x),i=kM(i,e.x+e.width);var n=t[1];return n=LM(n,e.y),n=kM(n,e.y+e.height),[i,n]})}function Po(t,e,i){var n=(e=a({rectHover:!0},e)).style={strokeNoScale:!0};if(i=i||{x:-1,y:-1,width:2,height:2},t)return 0===t.indexOf("image://")?(n.image=t.slice(8),r(n,i),new fi(e)):Xn(t.replace("path://",""),e,i,"center")}function No(t,e,i){this.parentModel=e,this.ecModel=i,this.option=t}function Oo(t,e,i){for(var n=0;n0){if(t<=e[0])return i[0];if(t>=e[1])return i[1]}else{if(t>=e[0])return i[0];if(t<=e[1])return i[1]}else{if(t===e[0])return i[0];if(t===e[1])return i[1]}return(t-e[0])/o*a+i[0]}function Vo(t,e){switch(t){case"center":case"middle":t="50%";break;case"left":case"top":t="0%";break;case"right":case"bottom":t="100%"}return"string"==typeof t?zo(t).match(/%$/)?parseFloat(t)/100*e:parseFloat(t):null==t?NaN:+t}function Go(t,e,i){return null==e&&(e=10),e=Math.min(Math.max(0,e),20),t=(+t).toFixed(e),i?t:+t}function Fo(t){return t.sort(function(t,e){return t-e}),t}function Wo(t){if(t=+t,isNaN(t))return 0;for(var e=1,i=0;Math.round(t*e)/e!==t;)e*=10,i++;return i}function Ho(t){var e=t.toString(),i=e.indexOf("e");if(i>0){var n=+e.slice(i+1);return n<0?-n:0}var o=e.indexOf(".");return o<0?0:e.length-1-o}function Zo(t,e){var i=Math.log,n=Math.LN10,o=Math.floor(i(t[1]-t[0])/n),a=Math.round(i(Math.abs(e[1]-e[0]))/n),r=Math.min(Math.max(-o+a,0),20);return isFinite(r)?r:20}function Uo(t,e,i){if(!t[e])return 0;var n=p(t,function(t,e){return t+(isNaN(e)?0:e)},0);if(0===n)return 0;for(var o=Math.pow(10,i),a=f(t,function(t){return(isNaN(t)?0:t)/n*o*100}),r=100*o,s=f(a,function(t){return Math.floor(t)}),l=p(s,function(t,e){return t+e},0),u=f(a,function(t,e){return t-s[e]});lh&&(h=u[d],c=d);++s[c],u[c]=0,++l}return s[e]/o}function Xo(t){var e=2*Math.PI;return(t%e+e)%e}function jo(t){return t>-UM&&t=-20?+t.toFixed(n<0?-n:0):t}function Jo(t){function e(t,i,n){return t.interval[n]=0}function ta(t){return isNaN(t)?"-":(t=(t+"").split("."))[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(t.length>1?"."+t[1]:"")}function ea(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()}),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t}function ia(t){return null==t?"":(t+"").replace(KM,function(t,e){return $M[e]})}function na(t,e,i){y(e)||(e=[e]);var n=e.length;if(!n)return"";for(var o=e[0].$vars||[],a=0;a':'':{renderMode:o,content:"{marker"+a+"|} ",style:{color:i}}:""}function ra(t,e){return t+="","0000".substr(0,e-t.length)+t}function sa(t,e,i){"week"!==t&&"month"!==t&&"quarter"!==t&&"half-year"!==t&&"year"!==t||(t="MM-dd\nyyyy");var n=Yo(e),o=i?"UTC":"",a=n["get"+o+"FullYear"](),r=n["get"+o+"Month"]()+1,s=n["get"+o+"Date"](),l=n["get"+o+"Hours"](),u=n["get"+o+"Minutes"](),h=n["get"+o+"Seconds"](),c=n["get"+o+"Milliseconds"]();return t=t.replace("MM",ra(r,2)).replace("M",r).replace("yyyy",a).replace("yy",a%100).replace("dd",ra(s,2)).replace("d",s).replace("hh",ra(l,2)).replace("h",l).replace("mm",ra(u,2)).replace("m",u).replace("ss",ra(h,2)).replace("s",h).replace("SSS",ra(c,3))}function la(t){return t?t.charAt(0).toUpperCase()+t.substr(1):t}function ua(t,e,i,n,o){var a=0,r=0;null==n&&(n=1/0),null==o&&(o=1/0);var s=0;e.eachChild(function(l,u){var h,c,d=l.position,f=l.getBoundingRect(),p=e.childAt(u+1),g=p&&p.getBoundingRect();if("horizontal"===t){var m=f.width+(g?-g.x+f.x:0);(h=a+m)>n||l.newline?(a=0,h=m,r+=s+i,s=f.height):s=Math.max(s,f.height)}else{var v=f.height+(g?-g.y+f.y:0);(c=r+v)>o||l.newline?(a+=s+i,r=0,c=v,s=f.width):s=Math.max(s,f.width)}l.newline||(d[0]=a,d[1]=r,"horizontal"===t?a=h+i:r=c+i)})}function ha(t,e,i){var n=e.width,o=e.height,a=Vo(t.x,n),r=Vo(t.y,o),s=Vo(t.x2,n),l=Vo(t.y2,o);return(isNaN(a)||isNaN(parseFloat(t.x)))&&(a=0),(isNaN(s)||isNaN(parseFloat(t.x2)))&&(s=n),(isNaN(r)||isNaN(parseFloat(t.y)))&&(r=0),(isNaN(l)||isNaN(parseFloat(t.y2)))&&(l=o),i=qM(i||0),{width:Math.max(s-a-i[1]-i[3],0),height:Math.max(l-r-i[0]-i[2],0)}}function ca(t,e,i){i=qM(i||0);var n=e.width,o=e.height,a=Vo(t.left,n),r=Vo(t.top,o),s=Vo(t.right,n),l=Vo(t.bottom,o),u=Vo(t.width,n),h=Vo(t.height,o),c=i[2]+i[0],d=i[1]+i[3],f=t.aspect;switch(isNaN(u)&&(u=n-s-d-a),isNaN(h)&&(h=o-l-c-r),null!=f&&(isNaN(u)&&isNaN(h)&&(f>n/o?u=.8*n:h=.8*o),isNaN(u)&&(u=f*h),isNaN(h)&&(h=u/f)),isNaN(a)&&(a=n-s-u-d),isNaN(r)&&(r=o-l-h-c),t.left||t.right){case"center":a=n/2-u/2-i[3];break;case"right":a=n-u-d}switch(t.top||t.bottom){case"middle":case"center":r=o/2-h/2-i[0];break;case"bottom":r=o-h-c}a=a||0,r=r||0,isNaN(u)&&(u=n-d-a-(s||0)),isNaN(h)&&(h=o-c-r-(l||0));var p=new de(a+i[3],r+i[0],u,h);return p.margin=i,p}function da(t,e,i,n,o){var a=!o||!o.hv||o.hv[0],s=!o||!o.hv||o.hv[1],l=o&&o.boundingMode||"all";if(a||s){var u;if("raw"===l)u="group"===t.type?new de(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(u=t.getBoundingRect(),t.needLocalTransform()){var h=t.getLocalTransform();(u=u.clone()).applyTransform(h)}e=ca(r({width:u.width,height:u.height},e),i,n);var c=t.position,d=a?e.x-u.x:0,f=s?e.y-u.y:0;t.attr("position","raw"===l?[d,f]:[c[0]+d,c[1]+f])}}function fa(t,e){return null!=t[oI[e][0]]||null!=t[oI[e][1]]&&null!=t[oI[e][2]]}function pa(t,e,i){function n(i,n){var r={},l=0,u={},h=0;if(iI(i,function(e){u[e]=t[e]}),iI(i,function(t){o(e,t)&&(r[t]=u[t]=e[t]),a(r,t)&&l++,a(u,t)&&h++}),s[n])return a(e,i[1])?u[i[2]]=null:a(e,i[2])&&(u[i[1]]=null),u;if(2!==h&&l){if(l>=2)return r;for(var c=0;ce)return t[n];return t[i-1]}function ya(t){var e=t.get("coordinateSystem"),i={coordSysName:e,coordSysDims:[],axisMap:R(),categoryAxisMap:R()},n=fI[e];if(n)return n(t,i,i.axisMap,i.categoryAxisMap),i}function xa(t){return"category"===t.get("type")}function _a(t){this.fromDataset=t.fromDataset,this.data=t.data||(t.sourceFormat===vI?{}:[]),this.sourceFormat=t.sourceFormat||yI,this.seriesLayoutBy=t.seriesLayoutBy||_I,this.dimensionsDefine=t.dimensionsDefine,this.encodeDefine=t.encodeDefine&&R(t.encodeDefine),this.startIndex=t.startIndex||0,this.dimensionsDetectCount=t.dimensionsDetectCount}function wa(t){var e=t.option.source,i=yI;if(S(e))i=xI;else if(y(e)){0===e.length&&(i=gI);for(var n=0,o=e.length;n=e:"max"===i?t<=e:t===e}function Xa(t,e){return t.join(",")===e.join(",")}function ja(t,e){AI(e=e||{},function(e,i){if(null!=e){var n=t[i];if(lI.hasClass(i)){e=Di(e);var o=Pi(n=Di(n),e);t[i]=CI(o,function(t){return t.option&&t.exist?LI(t.exist,t.option,!0):t.exist||t.option})}else t[i]=LI(n,e,!0)}})}function Ya(t){var e=t&&t.itemStyle;if(e)for(var i=0,o=OI.length;i=0;p--){var g=t[p];if(s||(d=g.data.rawIndexOf(g.stackedByDimension,c)),d>=0){var m=g.data.getByRawIndex(g.stackResultDimension,d);if(h>=0&&m>0||h<=0&&m<0){h+=m,f=m;break}}}return n[0]=h,n[1]=f,n});r.hostModel.setData(l),e.data=l})}function rr(t,e){_a.isInstance(t)||(t=_a.seriesDataToSource(t)),this._source=t;var i=this._data=t.data,n=t.sourceFormat;n===xI&&(this._offset=0,this._dimSize=e,this._data=i),a(this,GI[n===gI?n+"_"+t.seriesLayoutBy:n])}function sr(){return this._data.length}function lr(t){return this._data[t]}function ur(t){for(var e=0;ee.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)}function Mr(t,e){d(t.CHANGABLE_METHODS,function(i){t.wrapMethod(i,v(Ir,e))})}function Ir(t){var e=Tr(t);e&&e.setOutputEnd(this.count())}function Tr(t){var e=(t.ecModel||{}).scheduler,i=e&&e.getPipeline(t.uid);if(i){var n=i.currentTask;if(n){var o=n.agentStubMap;o&&(n=o.get(t.uid))}return n}}function Ar(){this.group=new tb,this.uid=Ro("viewChart"),this.renderTask=gr({plan:Lr,reset:kr}),this.renderTask.context={view:this}}function Dr(t,e){if(t&&(t.trigger(e),"group"===t.type))for(var i=0;i=0?n():c=setTimeout(n,-a),u=o};return d.clear=function(){c&&(clearTimeout(c),c=null)},d.debounceNextCall=function(t){l=t},d}function Nr(t,e,i,n){var o=t[e];if(o){var a=o[iT]||o,r=o[oT];if(o[nT]!==i||r!==n){if(null==i||!n)return t[e]=a;(o=t[e]=Pr(a,i,"debounce"===n))[iT]=a,o[oT]=n,o[nT]=i}return o}}function Or(t,e){var i=t[e];i&&i[iT]&&(t[e]=i[iT])}function Er(t,e,i,n){this.ecInstance=t,this.api=e,this.unfinished;var i=this._dataProcessorHandlers=i.slice(),n=this._visualHandlers=n.slice();this._allHandlers=i.concat(n),this._stageTaskMap=R()}function Rr(t,e,i,n,o){function a(t,e){return t.setDirty&&(!t.dirtyMap||t.dirtyMap.get(e.__pipeline.id))}o=o||{};var r;d(e,function(e,s){if(!o.visualType||o.visualType===e.visualType){var l=t._stageTaskMap.get(e.uid),u=l.seriesTaskMap,h=l.overallTask;if(h){var c,d=h.agentStubMap;d.each(function(t){a(o,t)&&(t.dirty(),c=!0)}),c&&h.dirty(),hT(h,n);var f=t.getPerformArgs(h,o.block);d.each(function(t){t.perform(f)}),r|=h.perform(f)}else u&&u.each(function(s,l){a(o,s)&&s.dirty();var u=t.getPerformArgs(s,o.block);u.skip=!e.performRawSeries&&i.isSeriesFiltered(s.context.model),hT(s,n),r|=s.perform(u)})}}),t.unfinished|=r}function zr(t,e,i,n,o){function a(i){var a=i.uid,s=r.get(a)||r.set(a,gr({plan:Hr,reset:Zr,count:Xr}));s.context={model:i,ecModel:n,api:o,useClearVisual:e.isVisual&&!e.isLayout,plan:e.plan,reset:e.reset,scheduler:t},jr(t,i,s)}var r=i.seriesTaskMap||(i.seriesTaskMap=R()),s=e.seriesType,l=e.getTargetSeries;e.createOnAllSeries?n.eachRawSeries(a):s?n.eachRawSeriesByType(s,a):l&&l(n,o).each(a);var u=t._pipelineMap;r.each(function(t,e){u.get(e)||(t.dispose(),r.removeKey(e))})}function Br(t,e,i,n,o){function a(e){var i=e.uid,n=s.get(i);n||(n=s.set(i,gr({reset:Gr,onDirty:Wr})),r.dirty()),n.context={model:e,overallProgress:h,modifyOutputEnd:c},n.agent=r,n.__block=h,jr(t,e,n)}var r=i.overallTask=i.overallTask||gr({reset:Vr});r.context={ecModel:n,api:o,overallReset:e.overallReset,scheduler:t};var s=r.agentStubMap=r.agentStubMap||R(),l=e.seriesType,u=e.getTargetSeries,h=!0,c=e.modifyOutputEnd;l?n.eachRawSeriesByType(l,a):u?u(n,o).each(a):(h=!1,d(n.getSeries(),a));var f=t._pipelineMap;s.each(function(t,e){f.get(e)||(t.dispose(),r.dirty(),s.removeKey(e))})}function Vr(t){t.overallReset(t.ecModel,t.api,t.payload)}function Gr(t,e){return t.overallProgress&&Fr}function Fr(){this.agent.dirty(),this.getDownstream().dirty()}function Wr(){this.agent&&this.agent.dirty()}function Hr(t){return t.plan&&t.plan(t.model,t.ecModel,t.api,t.payload)}function Zr(t){t.useClearVisual&&t.data.clearAllVisual();var e=t.resetDefines=Di(t.reset(t.model,t.ecModel,t.api,t.payload));return e.length>1?f(e,function(t,e){return Ur(e)}):cT}function Ur(t){return function(e,i){var n=i.data,o=i.resetDefines[t];if(o&&o.dataEach)for(var a=e.start;a0?parseInt(n,10)/100:n?parseFloat(n):0;var o=i.getAttribute("stop-color")||"#000000";e.addColorStop(n,o)}i=i.nextSibling}}function Qr(t,e){t&&t.__inheritedStyle&&(e.__inheritedStyle||(e.__inheritedStyle={}),r(e.__inheritedStyle,t.__inheritedStyle))}function ts(t){for(var e=P(t).split(_T),i=[],n=0;n0;a-=2){var r=o[a],s=o[a-1];switch(n=n||xt(),s){case"translate":r=P(r).split(_T),St(n,n,[parseFloat(r[0]),parseFloat(r[1]||0)]);break;case"scale":r=P(r).split(_T),It(n,n,[parseFloat(r[0]),parseFloat(r[1]||r[0])]);break;case"rotate":r=P(r).split(_T),Mt(n,n,parseFloat(r[0]));break;case"skew":r=P(r).split(_T),console.warn("Skew transform is not supported yet");break;case"matrix":r=P(r).split(_T);n[0]=parseFloat(r[0]),n[1]=parseFloat(r[1]),n[2]=parseFloat(r[2]),n[3]=parseFloat(r[3]),n[4]=parseFloat(r[4]),n[5]=parseFloat(r[5])}}e.setLocalTransform(n)}}function os(t){var e=t.getAttribute("style"),i={};if(!e)return i;var n={};TT.lastIndex=0;for(var o;null!=(o=TT.exec(e));)n[o[1]]=o[2];for(var a in ST)ST.hasOwnProperty(a)&&null!=n[a]&&(i[ST[a]]=n[a]);return i}function as(t,e,i){var n=e/t.width,o=i/t.height,a=Math.min(n,o);return{scale:[a,a],position:[-(t.x+t.width/2)*a+e/2,-(t.y+t.height/2)*a+i/2]}}function rs(t,e){return(new $r).parse(t,e)}function ss(t){return function(e,i,n){e=e&&e.toLowerCase(),fw.prototype[t].call(this,e,i,n)}}function ls(){fw.call(this)}function us(t,e,n){function o(t,e){return t.__prio-e.__prio}n=n||{},"string"==typeof e&&(e=JT[e]),this.id,this.group,this._dom=t;var a=this._zr=Ii(t,{renderer:n.renderer||"canvas",devicePixelRatio:n.devicePixelRatio,width:n.width,height:n.height});this._throttledZrFlush=Pr(m(a.flush,a),17),(e=i(e))&&BI(e,!0),this._theme=e,this._chartsViews=[],this._chartsMap={},this._componentsViews=[],this._componentsMap={},this._coordSysMgr=new Fa;var r=this._api=As(this);_e($T,o),_e(YT,o),this._scheduler=new Er(this,r,YT,$T),fw.call(this,this._ecEventProcessor=new Ds),this._messageCenter=new ls,this._initEvents(),this.resize=m(this.resize,this),this._pendingActions=[],a.animation.on("frame",this._onframe,this),vs(a,this),N(this)}function hs(t,e,i){var n,o=this._model,a=this._coordSysMgr.getCoordinateSystems();e=Vi(o,e);for(var r=0;re.get("hoverLayerThreshold")&&!U_.node&&i.traverse(function(t){t.isGroup||(t.useHoverLayer=!0)})}function Is(t,e){var i=t.get("blendMode")||null;e.group.traverse(function(t){t.isGroup||t.style.blend!==i&&t.setStyle("blend",i),t.eachPendingDisplayable&&t.eachPendingDisplayable(function(t){t.setStyle("blend",i)})})}function Ts(t,e){var i=t.get("z"),n=t.get("zlevel");e.group.traverse(function(t){"group"!==t.type&&(null!=i&&(t.z=i),null!=n&&(t.zlevel=n))})}function As(t){var e=t._coordSysMgr;return a(new Ga(t),{getCoordinateSystems:m(e.getCoordinateSystems,e),getComponentByElement:function(e){for(;e;){var i=e.__ecComponentInfo;if(null!=i)return t._model.getComponent(i.mainType,i.index);e=e.parent}}})}function Ds(){this.eventInfo}function Cs(t){function e(t,e){for(var n=0;n65535?dA:pA}function Js(t){var e=t.constructor;return e===Array?t.slice():new e(t)}function Qs(t,e){d(gA.concat(e.__wrappedMethods||[]),function(i){e.hasOwnProperty(i)&&(t[i]=e[i])}),t.__wrappedMethods=e.__wrappedMethods,d(mA,function(n){t[n]=i(e[n])}),t._calculationInfo=a(e._calculationInfo)}function tl(t,e,i,n,o){var a=cA[e.type],r=n-1,s=e.name,l=t[s][r];if(l&&l.length=0?this._indices[t]:-1}function al(t,e){var i=t._idList[e];return null==i&&(i=il(t,t._idDimIdx,e)),null==i&&(i=hA+e),i}function rl(t){return y(t)||(t=[t]),t}function sl(t,e){var i=t.dimensions,n=new vA(f(i,t.getDimensionInfo,t),t.hostModel);Qs(n,t);for(var o=n._storage={},a=t._storage,r=0;r=0?(o[s]=ll(a[s]),n._rawExtent[s]=ul(),n._extent[s]=null):o[s]=a[s])}return n}function ll(t){for(var e=new Array(t.length),i=0;in&&(r=o.interval=n);var s=o.intervalPrecision=Ml(r);return Tl(o.niceTickExtent=[MA(Math.ceil(t[0]/r)*r,s),MA(Math.floor(t[1]/r)*r,s)],t),o}function Ml(t){return Ho(t)+2}function Il(t,e,i){t[e]=Math.max(Math.min(t[e],i[1]),i[0])}function Tl(t,e){!isFinite(t[0])&&(t[0]=e[0]),!isFinite(t[1])&&(t[1]=e[1]),Il(t,0,e),Il(t,1,e),t[0]>t[1]&&(t[0]=t[1])}function Al(t,e,i,n){var o=[];if(!t)return o;e[0]1e4)return[];return e[1]>(o.length?o[o.length-1]:i[1])&&o.push(e[1]),o}function Dl(t){return t.get("stack")||AA+t.seriesIndex}function Cl(t){return t.dim+t.index}function Ll(t){var e=[],i=t.axis;if("category"===i.type){for(var n=i.getBandWidth(),o=0;o=0?"p":"n",b=m;p&&(o[r][_]||(o[r][_]={p:m,n:m}),b=o[r][_][w]);var S,M,I,T;if(g)S=b,M=(A=i.dataToPoint([x,_]))[1]+l,I=A[0]-m,T=u,Math.abs(I)a[1]?(n=a[1],o=a[0]):(n=a[0],o=a[1]);var r=e.toGlobalCoord(e.dataToCoord(0));return ro&&(r=o),r}function Vl(t,e){return VA(t,BA(e))}function Gl(t,e){var i,n,o,a=t.type,r=e.getMin(),s=e.getMax(),l=null!=r,u=null!=s,h=t.getExtent();"ordinal"===a?i=e.getCategories().length:(y(n=e.get("boundaryGap"))||(n=[n||0,n||0]),"boolean"==typeof n[0]&&(n=[0,0]),n[0]=Vo(n[0],1),n[1]=Vo(n[1],1),o=h[1]-h[0]||Math.abs(h[0])),null==r&&(r="ordinal"===a?i?0:NaN:h[0]-n[0]*o),null==s&&(s="ordinal"===a?i?i-1:NaN:h[1]+n[1]*o),"dataMin"===r?r=h[0]:"function"==typeof r&&(r=r({min:h[0],max:h[1]})),"dataMax"===s?s=h[1]:"function"==typeof s&&(s=s({min:h[0],max:h[1]})),(null==r||!isFinite(r))&&(r=NaN),(null==s||!isFinite(s))&&(s=NaN),t.setBlank(I(r)||I(s)||"ordinal"===a&&!t.getOrdinalMeta().categories.length),e.getNeedCrossZero()&&(r>0&&s>0&&!l&&(r=0),r<0&&s<0&&!u&&(s=0));var c=e.ecModel;if(c&&"time"===a){var f,p=kl("bar",c);if(d(p,function(t){f|=t.getBaseAxis()===e.axis}),f){var g=Pl(p),m=Fl(r,s,e,g);r=m.min,s=m.max}}return[r,s]}function Fl(t,e,i,n){var o=i.axis.getExtent(),a=o[1]-o[0],r=Ol(n,i.axis);if(void 0===r)return{min:t,max:e};var s=1/0;d(r,function(t){s=Math.min(t.offset,s)});var l=-1/0;d(r,function(t){l=Math.max(t.offset+t.width,l)}),s=Math.abs(s),l=Math.abs(l);var u=s+l,h=e-t,c=h/(1-(s+l)/a)-h;return e+=c*(l/u),t-=c*(s/u),{min:t,max:e}}function Wl(t,e){var i=Gl(t,e),n=null!=e.getMin(),o=null!=e.getMax(),a=e.get("splitNumber");"log"===t.type&&(t.base=e.get("logBase"));var r=t.type;t.setExtent(i[0],i[1]),t.niceExtent({splitNumber:a,fixMin:n,fixMax:o,minInterval:"interval"===r||"time"===r?e.get("minInterval"):null,maxInterval:"interval"===r||"time"===r?e.get("maxInterval"):null});var s=e.get("interval");null!=s&&t.setInterval&&t.setInterval(s)}function Hl(t,e){if(e=e||t.get("type"))switch(e){case"category":return new SA(t.getOrdinalMeta?t.getOrdinalMeta():t.getCategories(),[1/0,-1/0]);case"value":return new TA;default:return(xl.getClass(e)||TA).create(t)}}function Zl(t){var e=t.scale.getExtent(),i=e[0],n=e[1];return!(i>0&&n>0||i<0&&n<0)}function Ul(t){var e=t.getLabelModel().get("formatter"),i="category"===t.type?t.scale.getExtent()[0]:null;return"string"==typeof e?e=function(e){return function(i){return i=t.scale.getLabel(i),e.replace("{value}",null!=i?i:"")}}(e):"function"==typeof e?function(n,o){return null!=i&&(o=n-i),e(Xl(t,n),o)}:function(e){return t.scale.getLabel(e)}}function Xl(t,e){return"category"===t.type?t.scale.getLabel(e):e}function jl(t){var e=t.model,i=t.scale;if(e.get("axisLabel.show")&&!i.isBlank()){var n,o,a="category"===t.type,r=i.getExtent();o=a?i.count():(n=i.getTicks()).length;var s,l=t.getLabelModel(),u=Ul(t),h=1;o>40&&(h=Math.ceil(o/40));for(var c=0;c>1^-(1&s),l=l>>1^-(1&l),o=s+=o,a=l+=a,n.push([s/i,l/i])}return n}function ou(t){return"category"===t.type?ru(t):uu(t)}function au(t,e){return"category"===t.type?lu(t,e):{ticks:t.scale.getTicks()}}function ru(t){var e=t.getLabelModel(),i=su(t,e);return!e.get("show")||t.scale.isBlank()?{labels:[],labelCategoryInterval:i.labelCategoryInterval}:i}function su(t,e){var i=hu(t,"labels"),n=ql(e),o=cu(i,n);if(o)return o;var a,r;return a=x(n)?vu(t,n):mu(t,r="auto"===n?fu(t):n),du(i,n,{labels:a,labelCategoryInterval:r})}function lu(t,e){var i=hu(t,"ticks"),n=ql(e),o=cu(i,n);if(o)return o;var a,r;if(e.get("show")&&!t.scale.isBlank()||(a=[]),x(n))a=vu(t,n,!0);else if("auto"===n){var s=su(t,t.getLabelModel());r=s.labelCategoryInterval,a=f(s.labels,function(t){return t.tickValue})}else a=mu(t,r=n,!0);return du(i,n,{ticks:a,tickCategoryInterval:r})}function uu(t){var e=t.scale.getTicks(),i=Ul(t);return{labels:f(e,function(e,n){return{formattedLabel:i(e,n),rawLabel:t.scale.getLabel(e),tickValue:e}})}}function hu(t,e){return nD(t)[e]||(nD(t)[e]=[])}function cu(t,e){for(var i=0;i40&&(s=Math.max(1,Math.floor(r/40)));for(var l=a[0],u=t.dataToCoord(l+1)-t.dataToCoord(l),h=Math.abs(u*Math.cos(n)),c=Math.abs(u*Math.sin(n)),d=0,f=0;l<=a[1];l+=s){var p=0,g=0,m=ke(i(l),e.font,"center","top");p=1.3*m.width,g=1.3*m.height,d=Math.max(d,p,7),f=Math.max(f,g,7)}var v=d/h,y=f/c;isNaN(v)&&(v=1/0),isNaN(y)&&(y=1/0);var x=Math.max(0,Math.floor(Math.min(v,y))),_=nD(t.model),w=_.lastAutoInterval,b=_.lastTickCount;return null!=w&&null!=b&&Math.abs(w-x)<=1&&Math.abs(b-r)<=1&&w>x?x=w:(_.lastTickCount=r,_.lastAutoInterval=x),x}function gu(t){var e=t.getLabelModel();return{axisRotate:t.getRotate?t.getRotate():t.isHorizontal&&!t.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}function mu(t,e,i){function n(t){l.push(i?t:{formattedLabel:o(t),rawLabel:a.getLabel(t),tickValue:t})}var o=Ul(t),a=t.scale,r=a.getExtent(),s=t.getLabelModel(),l=[],u=Math.max((e||0)+1,1),h=r[0],c=a.count();0!==h&&u>1&&c/u>2&&(h=Math.round(Math.ceil(h/u)*u));var d=Kl(t),f=s.get("showMinLabel")||d,p=s.get("showMaxLabel")||d;f&&h!==r[0]&&n(r[0]);for(var g=h;g<=r[1];g+=u)n(g);return p&&g!==r[1]&&n(r[1]),l}function vu(t,e,i){var n=t.scale,o=Ul(t),a=[];return d(n.getTicks(),function(t){var r=n.getLabel(t);e(t,r)&&a.push(i?t:{formattedLabel:o(t),rawLabel:r,tickValue:t})}),a}function yu(t,e){var i=(t[1]-t[0])/e/2;t[0]+=i,t[1]-=i}function xu(t,e,i,n,o){function a(t,e){return h?t>e:t0&&(t.coord-=u/(2*(e+1)))}),s={coord:e[r-1].coord+u},e.push(s)}var h=l[0]>l[1];a(e[0].coord,l[0])&&(o?e[0].coord=l[0]:e.shift()),o&&a(l[0],e[0].coord)&&e.unshift({coord:l[0]}),a(l[1],s.coord)&&(o?s.coord=l[1]:e.pop()),o&&a(s.coord,l[1])&&e.push({coord:l[1]})}}function _u(t,e){var i=t.mapDimension("defaultedLabel",!0),n=i.length;if(1===n)return fr(t,e,i[0]);if(n){for(var o=[],a=0;a0?i=n[0]:n[1]<0&&(i=n[1]),i}function Ou(t,e,i,n){var o=NaN;t.stacked&&(o=i.get(i.getCalculationInfo("stackedOverDimension"),n)),isNaN(o)&&(o=t.valueStart);var a=t.baseDataOffset,r=[];return r[a]=i.get(t.baseDim,n),r[1-a]=o,e.dataToPoint(r)}function Eu(t,e){var i=[];return e.diff(t).add(function(t){i.push({cmd:"+",idx:t})}).update(function(t,e){i.push({cmd:"=",idx:e,idx1:t})}).remove(function(t){i.push({cmd:"-",idx:t})}).execute(),i}function Ru(t){return isNaN(t[0])||isNaN(t[1])}function zu(t,e,i,n,o,a,r,s,l,u,h){return"none"!==u&&u?Bu.apply(this,arguments):Vu.apply(this,arguments)}function Bu(t,e,i,n,o,a,r,s,l,u,h){for(var c=0,d=i,f=0;f=o||d<0)break;if(Ru(p)){if(h){d+=a;continue}break}if(d===i)t[a>0?"moveTo":"lineTo"](p[0],p[1]);else if(l>0){var g=e[c],m="y"===u?1:0,v=(p[m]-g[m])*l;_D(bD,g),bD[m]=g[m]+v,_D(SD,p),SD[m]=p[m]-v,t.bezierCurveTo(bD[0],bD[1],SD[0],SD[1],p[0],p[1])}else t.lineTo(p[0],p[1]);c=d,d+=a}return f}function Vu(t,e,i,n,o,a,r,s,l,u,h){for(var c=0,d=i,f=0;f=o||d<0)break;if(Ru(p)){if(h){d+=a;continue}break}if(d===i)t[a>0?"moveTo":"lineTo"](p[0],p[1]),_D(bD,p);else if(l>0){var g=d+a,m=e[g];if(h)for(;m&&Ru(e[g]);)m=e[g+=a];var v=.5,y=e[c];if(!(m=e[g])||Ru(m))_D(SD,p);else{Ru(m)&&!h&&(m=p),U(wD,m,y);var x,_;if("x"===u||"y"===u){var w="x"===u?0:1;x=Math.abs(p[w]-y[w]),_=Math.abs(p[w]-m[w])}else x=uw(p,y),_=uw(p,m);xD(SD,p,wD,-l*(1-(v=_/(_+x))))}vD(bD,bD,s),yD(bD,bD,r),vD(SD,SD,s),yD(SD,SD,r),t.bezierCurveTo(bD[0],bD[1],SD[0],SD[1],p[0],p[1]),xD(bD,p,wD,l*v)}else t.lineTo(p[0],p[1]);c=d,d+=a}return f}function Gu(t,e){var i=[1/0,1/0],n=[-1/0,-1/0];if(e)for(var o=0;on[0]&&(n[0]=a[0]),a[1]>n[1]&&(n[1]=a[1])}return{min:e?i:n,max:e?n:i}}function Fu(t,e){if(t.length===e.length){for(var i=0;ie[0]?1:-1;e[0]+=n*i,e[1]-=n*i}return e}function Zu(t,e,i){if(!i.valueDim)return[];for(var n=[],o=0,a=e.count();oa[1]&&a.reverse();var r=o.getExtent(),s=Math.PI/180;i&&(a[0]-=.5,a[1]+=.5);var l=new hM({shape:{cx:Go(t.cx,1),cy:Go(t.cy,1),r0:Go(a[0],1),r:Go(a[1],1),startAngle:-r[0]*s,endAngle:-r[1]*s,clockwise:o.inverse}});return e&&(l.shape.endAngle=-r[0]*s,To(l,{shape:{endAngle:-r[1]*s}},n)),l}function ju(t,e,i,n){return"polar"===t.type?Xu(t,e,i,n):Uu(t,e,i,n)}function Yu(t,e,i){for(var n=e.getBaseAxis(),o="x"===n.dim||"radius"===n.dim?0:1,a=[],r=0;r=0;a--){var r=i[a].dimension,s=t.dimensions[r],l=t.getDimensionInfo(s);if("x"===(n=l&&l.coordDim)||"y"===n){o=i[a];break}}if(o){var u=e.getAxis(n),h=f(o.stops,function(t){return{coord:u.toGlobalCoord(u.dataToCoord(t.value)),color:t.color}}),c=h.length,p=o.outerColors.slice();c&&h[0].coord>h[c-1].coord&&(h.reverse(),p.reverse());var g=h[0].coord-10,m=h[c-1].coord+10,v=m-g;if(v<.001)return"transparent";d(h,function(t){t.offset=(t.coord-g)/v}),h.push({offset:c?h[c-1].offset:.5,color:p[1]||"transparent"}),h.unshift({offset:c?h[0].offset:.5,color:p[0]||"transparent"});var y=new TM(0,0,0,0,h,!0);return y[n]=g,y[n+"2"]=m,y}}}function Ku(t,e,i){var n=t.get("showAllSymbol"),o="auto"===n;if(!n||o){var a=i.getAxesByScale("ordinal")[0];if(a&&(!o||!$u(a,e))){var r=e.mapDimension(a.dim),s={};return d(a.getViewLabels(),function(t){s[t.tickValue]=1}),function(t){return!s.hasOwnProperty(e.get(r,t))}}}}function $u(t,e){var i=t.getExtent(),n=Math.abs(i[1]-i[0])/t.scale.count();isNaN(n)&&(n=0);for(var o=e.count(),a=Math.max(1,Math.round(o/5)),r=0;rn)return!1;return!0}function Ju(t){return this._axes[t]}function Qu(t){LD.call(this,t)}function th(t,e){return e.type||(e.data?"category":"value")}function eh(t,e,i){return t.getCoordSysModel()===e}function ih(t,e,i){this._coordsMap={},this._coordsList=[],this._axesMap={},this._axesList=[],this._initCartesian(t,e,i),this.model=t}function nh(t,e,i,n){function o(t){return t.dim+"_"+t.index}i.getAxesOnZeroOf=function(){return a?[a]:[]};var a,r=t[e],s=i.model,l=s.get("axisLine.onZero"),u=s.get("axisLine.onZeroAxisIndex");if(l){if(null!=u)oh(r[u])&&(a=r[u]);else for(var h in r)if(r.hasOwnProperty(h)&&oh(r[h])&&!n[o(r[h])]){a=r[h];break}a&&(n[o(a)]=!0)}}function oh(t){return t&&"category"!==t.type&&"time"!==t.type&&Zl(t)}function ah(t,e){var i=t.getExtent(),n=i[0]+i[1];t.toGlobalCoord="x"===t.dim?function(t){return t+e}:function(t){return n-t+e},t.toLocalCoord="x"===t.dim?function(t){return t-e}:function(t){return n-t+e}}function rh(t,e){return f(VD,function(e){return t.getReferringComponents(e)[0]})}function sh(t){return"cartesian2d"===t.get("coordinateSystem")}function lh(t){var e={componentType:t.mainType,componentIndex:t.componentIndex};return e[t.mainType+"Index"]=t.componentIndex,e}function uh(t,e,i,n){var o,a,r=Xo(i-t.rotation),s=n[0]>n[1],l="start"===e&&!s||"start"!==e&&s;return jo(r-GD/2)?(a=l?"bottom":"top",o="center"):jo(r-1.5*GD)?(a=l?"top":"bottom",o="center"):(a="middle",o=r<1.5*GD&&r>GD/2?l?"left":"right":l?"right":"left"),{rotation:r,textAlign:o,textVerticalAlign:a}}function hh(t){var e=t.get("tooltip");return t.get("silent")||!(t.get("triggerEvent")||e&&e.show)}function ch(t,e,i){if(!Kl(t.axis)){var n=t.get("axisLabel.showMinLabel"),o=t.get("axisLabel.showMaxLabel");e=e||[],i=i||[];var a=e[0],r=e[1],s=e[e.length-1],l=e[e.length-2],u=i[0],h=i[1],c=i[i.length-1],d=i[i.length-2];!1===n?(dh(a),dh(u)):fh(a,r)&&(n?(dh(r),dh(h)):(dh(a),dh(u))),!1===o?(dh(s),dh(c)):fh(l,s)&&(o?(dh(l),dh(d)):(dh(s),dh(c)))}}function dh(t){t&&(t.ignore=!0)}function fh(t,e,i){var n=t&&t.getBoundingRect().clone(),o=e&&e.getBoundingRect().clone();if(n&&o){var a=_t([]);return Mt(a,a,-t.rotation),n.applyTransform(bt([],a,t.getLocalTransform())),o.applyTransform(bt([],a,e.getLocalTransform())),n.intersect(o)}}function ph(t){return"middle"===t||"center"===t}function gh(t,e,i){var n=e.axis;if(e.get("axisTick.show")&&!n.scale.isBlank()){for(var o=e.getModel("axisTick"),a=o.getModel("lineStyle"),s=o.get("length"),l=n.getTicksCoords(),u=[],h=[],c=t._transform,d=[],f=0;f=0||t===e}function Sh(t){var e=Mh(t);if(e){var i=e.axisPointerModel,n=e.axis.scale,o=i.option,a=i.get("status"),r=i.get("value");null!=r&&(r=n.parse(r));var s=Th(i);null==a&&(o.status=s?"show":"hide");var l=n.getExtent().slice();l[0]>l[1]&&l.reverse(),(null==r||r>l[1])&&(r=l[1]),r0?"bottom":"top":o.width>0?"left":"right";l||kh(t.style,d,n,u,a,i,p),fo(t,d)}function Rh(t,e){var i=t.get(tC)||0;return Math.min(i,Math.abs(e.width),Math.abs(e.height))}function zh(t,e,i){var n=t.getData(),o=[],a=n.getLayout("valueAxisHorizontal")?1:0;o[1-a]=n.getLayout("valueAxisStart");var r=new nC({shape:{points:n.getLayout("largePoints")},incremental:!!i,__startPoint:o,__valueIdx:a});e.add(r),Bh(r,t,n)}function Bh(t,e,i){var n=i.getVisual("borderColor")||i.getVisual("color"),o=e.getModel("itemStyle").getItemStyle(["color","borderColor"]);t.useStyle(o),t.style.fill=null,t.style.stroke=n,t.style.lineWidth=i.getLayout("barWidth")}function Vh(t,e,i,n){var o=e.getData(),a=this.dataIndex,r=o.getName(a),s=e.get("selectedOffset");n.dispatchAction({type:"pieToggleSelect",from:t,name:r,seriesId:e.id}),o.each(function(t){Gh(o.getItemGraphicEl(t),o.getItemLayout(t),e.isSelected(o.getName(t)),s,i)})}function Gh(t,e,i,n,o){var a=(e.startAngle+e.endAngle)/2,r=Math.cos(a),s=Math.sin(a),l=i?n:0,u=[r*l,s*l];o?t.animate().when(200,{position:u}).start("bounceOut"):t.attr("position",u)}function Fh(t,e){function i(){a.ignore=a.hoverIgnore,r.ignore=r.hoverIgnore}function n(){a.ignore=a.normalIgnore,r.ignore=r.normalIgnore}tb.call(this);var o=new hM({z2:2}),a=new gM,r=new rM;this.add(o),this.add(a),this.add(r),this.updateData(t,e,!0),this.on("emphasis",i).on("normal",n).on("mouseover",i).on("mouseout",n)}function Wh(t,e,i,n,o,a,r){function s(e,i){for(var n=e;n>=0&&(t[n].y-=i,!(n>0&&t[n].y>t[n-1].y+t[n-1].height));n--);}function l(t,e,i,n,o,a){for(var r=e?Number.MAX_VALUE:0,s=0,l=t.length;s=r&&(d=r-10),!e&&d<=r&&(d=r+10),t[s].x=i+d*a,r=d}}t.sort(function(t,e){return t.y-e.y});for(var u,h=0,c=t.length,d=[],f=[],p=0;pe&&a+1t[a].y+t[a].height)return void s(a,n/2);s(i-1,n/2)}(p,c,-u),h=t[p].y+t[p].height;r-h<0&&s(c-1,h-r);for(p=0;p=i?f.push(t[p]):d.push(t[p]);l(d,!1,e,i,n,o),l(f,!0,e,i,n,o)}function Hh(t,e,i,n,o,a){for(var r=[],s=[],l=0;l3?1.4:o>1?1.2:1.1;hc(this,"zoom","zoomOnMouseWheel",t,{scale:n>0?s:1/s,originX:a,originY:r})}if(i){var l=Math.abs(n);hc(this,"scrollMove","moveOnMouseWheel",t,{scrollDelta:(n>0?1:-1)*(l>3?.4:l>1?.15:.05),originX:a,originY:r})}}}function uc(t){ic(this._zr,"globalPan")||hc(this,"zoom",null,t,{scale:t.pinchScale>1?1.1:1/1.1,originX:t.pinchX,originY:t.pinchY})}function hc(t,e,i,n,o){t.pointerChecker&&t.pointerChecker(n,o.originX,o.originY)&&(mw(n.event),cc(t,e,i,n,o))}function cc(t,e,i,n,o){o.isAvailableBehavior=m(dc,null,i,n),t.trigger(e,o)}function dc(t,e,i){var n=i[t];return!t||n&&(!_(n)||e.event[n+"Key"])}function fc(t,e,i){var n=t.target,o=n.position;o[0]+=e,o[1]+=i,n.dirty()}function pc(t,e,i,n){var o=t.target,a=t.zoomLimit,r=o.position,s=o.scale,l=t.zoom=t.zoom||1;if(l*=e,a){var u=a.min||0,h=a.max||1/0;l=Math.max(Math.min(h,l),u)}var c=l/t.zoom;t.zoom=l,r[0]-=(i-r[0])*(c-1),r[1]-=(n-r[1])*(c-1),s[0]*=c,s[1]*=c,o.dirty()}function gc(t,e,i){var n=e.getComponentByElement(t.topTarget),o=n&&n.coordinateSystem;return n&&n!==i&&!RC[n.mainType]&&o&&o.model!==i}function mc(t,e){var i=t.getItemStyle(),n=t.get("areaColor");return null!=n&&(i.fill=n),i}function vc(t,e,i,n,o){i.off("click"),i.off("mousedown"),e.get("selectedMode")&&(i.on("mousedown",function(){t._mouseDownFlag=!0}),i.on("click",function(a){if(t._mouseDownFlag){t._mouseDownFlag=!1;for(var r=a.target;!r.__regions;)r=r.parent;if(r){var s={type:("geo"===e.mainType?"geo":"map")+"ToggleSelect",batch:f(r.__regions,function(t){return{name:t.name,from:o.uid}})};s[e.mainType+"Id"]=e.id,n.dispatchAction(s),yc(e,i)}}}))}function yc(t,e){e.eachChild(function(e){d(e.__regions,function(i){e.trigger(t.isSelected(i.name)?"emphasis":"normal")})})}function xc(t,e){var i=new tb;this.uid=Ro("ec_map_draw"),this._controller=new oc(t.getZr()),this._controllerHost={target:e?i:null},this.group=i,this._updateGroup=e,this._mouseDownFlag,this._mapName,this._initialized,i.add(this._regionsGroup=new tb),i.add(this._backgroundGroup=new tb)}function _c(t){var e=this[zC];e&&e.recordVersion===this[BC]&&wc(e,t)}function wc(t,e){var i=t.circle,n=t.labelModel,o=t.hoverLabelModel,a=t.emphasisText,r=t.normalText;e?(i.style.extendFrom(mo({},o,{text:o.get("show")?a:null},{isRectText:!0,useInsideStyle:!1},!0)),i.__mapOriginalZ2=i.z2,i.z2+=NM):(mo(i.style,n,{text:n.get("show")?r:null,textPosition:n.getShallow("position")||"bottom"},{isRectText:!0,useInsideStyle:!1}),i.dirty(!1),null!=i.__mapOriginalZ2&&(i.z2=i.__mapOriginalZ2,i.__mapOriginalZ2=null))}function bc(t,e,i){var n=t.getZoom(),o=t.getCenter(),a=e.zoom,r=t.dataToPoint(o);if(null!=e.dx&&null!=e.dy){r[0]-=e.dx,r[1]-=e.dy;o=t.pointToData(r);t.setCenter(o)}if(null!=a){if(i){var s=i.min||0,l=i.max||1/0;a=Math.max(Math.min(n*a,l),s)/n}t.scale[0]*=a,t.scale[1]*=a;var u=t.position,h=(e.originX-u[0])*(a-1),c=(e.originY-u[1])*(a-1);u[0]-=h,u[1]-=c,t.updateTransform();o=t.pointToData(r);t.setCenter(o),t.setZoom(a*n)}return{center:t.getCenter(),zoom:t.getZoom()}}function Sc(){Tw.call(this)}function Mc(t){this.name=t,this.zoomLimit,Tw.call(this),this._roamTransformable=new Sc,this._rawTransformable=new Sc,this._center,this._zoom}function Ic(t,e,i,n){var o=i.seriesModel,a=o?o.coordinateSystem:null;return a===this?a[t](n):null}function Tc(t,e,i,n){Mc.call(this,t),this.map=e;var o=OC.load(e,i);this._nameCoordMap=o.nameCoordMap,this._regionsMap=o.regionsMap,this._invertLongitute=null==n||n,this.regions=o.regions,this._rect=o.boundingRect}function Ac(t,e,i,n){var o=i.geoModel,a=i.seriesModel,r=o?o.coordinateSystem:a?a.coordinateSystem||(a.getReferringComponents("geo")[0]||{}).coordinateSystem:null;return r===this?r[t](n):null}function Dc(t,e){var i=t.get("boundingCoords");if(null!=i){var n=i[0],o=i[1];isNaN(n[0])||isNaN(n[1])||isNaN(o[0])||isNaN(o[1])||this.setBoundingRect(n[0],n[1],o[0]-n[0],o[1]-n[1])}var a,r=this.getBoundingRect(),s=t.get("layoutCenter"),l=t.get("layoutSize"),u=e.getWidth(),h=e.getHeight(),c=r.width/r.height*this.aspectScale,d=!1;s&&l&&(s=[Vo(s[0],u),Vo(s[1],h)],l=Vo(l,Math.min(u,h)),isNaN(s[0])||isNaN(s[1])||isNaN(l)||(d=!0));if(d){var f={};c>1?(f.width=l,f.height=l/c):(f.height=l,f.width=l*c),f.y=s[1]-f.height/2,f.x=s[0]-f.width/2}else(a=t.getBoxLayoutParams()).aspect=c,f=ca(a,{width:u,height:h});this.setViewRect(f.x,f.y,f.width,f.height),this.setCenter(t.get("center")),this.setZoom(t.get("zoom"))}function Cc(t,e){d(e.get("geoCoord"),function(e,i){t.addGeoCoord(i,e)})}function Lc(t,e){var i={};return d(t,function(t){t.each(t.mapDimension("value"),function(e,n){var o="ec-"+t.getName(n);i[o]=i[o]||[],isNaN(e)||i[o].push(e)})}),t[0].map(t[0].mapDimension("value"),function(n,o){for(var a="ec-"+t[0].getName(o),r=0,s=1/0,l=-1/0,u=i[a].length,h=0;h=0;o--){var a=i[o];a.hierNode={defaultAncestor:null,ancestor:a,prelim:0,modifier:0,change:0,shift:0,i:o,thread:null},n.push(a)}}function Wc(t,e){var i=t.isExpand?t.children:[],n=t.parentNode.children,o=t.hierNode.i?n[t.hierNode.i-1]:null;if(i.length){jc(t);var a=(i[0].hierNode.prelim+i[i.length-1].hierNode.prelim)/2;o?(t.hierNode.prelim=o.hierNode.prelim+e(t,o),t.hierNode.modifier=t.hierNode.prelim-a):t.hierNode.prelim=a}else o&&(t.hierNode.prelim=o.hierNode.prelim+e(t,o));t.parentNode.hierNode.defaultAncestor=Yc(t,o,t.parentNode.hierNode.defaultAncestor||n[0],e)}function Hc(t){var e=t.hierNode.prelim+t.parentNode.hierNode.modifier;t.setLayout({x:e},!0),t.hierNode.modifier+=t.parentNode.hierNode.modifier}function Zc(t){return arguments.length?t:Qc}function Uc(t,e){var i={};return t-=Math.PI/2,i.x=e*Math.cos(t),i.y=e*Math.sin(t),i}function Xc(t,e){return ca(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()})}function jc(t){for(var e=t.children,i=e.length,n=0,o=0;--i>=0;){var a=e[i];a.hierNode.prelim+=n,a.hierNode.modifier+=n,o+=a.hierNode.change,n+=a.hierNode.shift+o}}function Yc(t,e,i,n){if(e){for(var o=t,a=t,r=a.parentNode.children[0],s=e,l=o.hierNode.modifier,u=a.hierNode.modifier,h=r.hierNode.modifier,c=s.hierNode.modifier;s=qc(s),a=Kc(a),s&&a;){o=qc(o),r=Kc(r),o.hierNode.ancestor=t;var d=s.hierNode.prelim+c-a.hierNode.prelim-u+n(s,a);d>0&&(Jc($c(s,t,i),t,d),u+=d,l+=d),c+=s.hierNode.modifier,u+=a.hierNode.modifier,l+=o.hierNode.modifier,h+=r.hierNode.modifier}s&&!qc(o)&&(o.hierNode.thread=s,o.hierNode.modifier+=c-l),a&&!Kc(r)&&(r.hierNode.thread=a,r.hierNode.modifier+=u-h,i=t)}return i}function qc(t){var e=t.children;return e.length&&t.isExpand?e[e.length-1]:t.hierNode.thread}function Kc(t){var e=t.children;return e.length&&t.isExpand?e[0]:t.hierNode.thread}function $c(t,e,i){return t.hierNode.ancestor.parentNode===e.parentNode?t.hierNode.ancestor:i}function Jc(t,e,i){var n=i/(e.hierNode.i-t.hierNode.i);e.hierNode.change-=n,e.hierNode.shift+=i,e.hierNode.modifier+=i,e.hierNode.prelim+=i,t.hierNode.change+=n}function Qc(t,e){return t.parentNode===e.parentNode?1:2}function td(t,e){var i=t.getItemLayout(e);return i&&!isNaN(i.x)&&!isNaN(i.y)&&"none"!==t.getItemVisual(e,"symbol")}function ed(t,e,i){return i.itemModel=e,i.itemStyle=e.getModel("itemStyle").getItemStyle(),i.hoverItemStyle=e.getModel("emphasis.itemStyle").getItemStyle(),i.lineStyle=e.getModel("lineStyle").getLineStyle(),i.labelModel=e.getModel("label"),i.hoverLabelModel=e.getModel("emphasis.label"),!1===t.isExpand&&0!==t.children.length?i.symbolInnerColor=i.itemStyle.fill:i.symbolInnerColor="#fff",i}function id(t,e,i,n,o,a){var s=!i,l=t.tree.getNodeByDataIndex(e),a=ed(l,l.getModel(),a),u=t.tree.root,h=l.parentNode===u?l:l.parentNode||l,c=t.getItemGraphicEl(h.dataIndex),d=h.getLayout(),f=c?{x:c.position[0],y:c.position[1],rawX:c.__radialOldRawX,rawY:c.__radialOldRawY}:d,p=l.getLayout();s?(i=new wu(t,e,a)).attr("position",[f.x,f.y]):i.updateData(t,e,a),i.__radialOldRawX=i.__radialRawX,i.__radialOldRawY=i.__radialRawY,i.__radialRawX=p.rawX,i.__radialRawY=p.rawY,n.add(i),t.setItemGraphicEl(e,i),Io(i,{position:[p.x,p.y]},o);var g=i.getSymbolPath();if("radial"===a.layout){var m,v,y=u.children[0],x=y.getLayout(),_=y.children.length;if(p.x===x.x&&!0===l.isExpand){var w={};w.x=(y.children[0].getLayout().x+y.children[_-1].getLayout().x)/2,w.y=(y.children[0].getLayout().y+y.children[_-1].getLayout().y)/2,(m=Math.atan2(w.y-x.y,w.x-x.x))<0&&(m=2*Math.PI+m),(v=w.xx.x)||(m-=Math.PI);var b=v?"left":"right";g.setStyle({textPosition:b,textRotation:-m,textOrigin:"center",verticalAlign:"middle"})}if(l.parentNode&&l.parentNode!==u){var S=i.__edge;S||(S=i.__edge=new bM({shape:od(a,f,f),style:r({opacity:0,strokeNoScale:!0},a.lineStyle)})),Io(S,{shape:od(a,d,p),style:{opacity:1}},o),n.add(S)}}function nd(t,e,i,n,o,a){for(var r,s=t.tree.getNodeByDataIndex(e),l=t.tree.root,a=ed(s,s.getModel(),a),u=s.parentNode===l?s:s.parentNode||s;null==(r=u.getLayout());)u=u.parentNode===l?u:u.parentNode||u;Io(i,{position:[r.x+1,r.y+1]},o,function(){n.remove(i),t.setItemGraphicEl(e,null)}),i.fadeOut(null,{keepLabel:!0});var h=i.__edge;h&&Io(h,{shape:od(a,r,r),style:{opacity:0}},o,function(){n.remove(h)})}function od(t,e,i){var n,o,a,r,s,l,u,h,c=t.orient;if("radial"===t.layout){s=e.rawX,u=e.rawY,l=i.rawX,h=i.rawY;var d=Uc(s,u),f=Uc(s,u+(h-u)*t.curvature),p=Uc(l,h+(u-h)*t.curvature),g=Uc(l,h);return{x1:d.x,y1:d.y,x2:g.x,y2:g.y,cpx1:f.x,cpy1:f.y,cpx2:p.x,cpy2:p.y}}return s=e.x,u=e.y,l=i.x,h=i.y,"LR"!==c&&"RL"!==c||(n=s+(l-s)*t.curvature,o=u,a=l+(s-l)*t.curvature,r=h),"TB"!==c&&"BT"!==c||(n=s,o=u+(h-u)*t.curvature,a=l,r=h+(u-h)*t.curvature),{x1:s,y1:u,x2:l,y2:h,cpx1:n,cpy1:o,cpx2:a,cpy2:r}}function ad(t,e,i){for(var n,o=[t],a=[];n=o.pop();)if(a.push(n),n.isExpand){var r=n.children;if(r.length)for(var s=0;s=0;a--)n.push(o[a])}}function sd(t,e){var i=Xc(t,e);t.layoutInfo=i;var n=t.get("layout"),o=0,a=0,r=null;"radial"===n?(o=2*Math.PI,a=Math.min(i.height,i.width)/2,r=Zc(function(t,e){return(t.parentNode===e.parentNode?1:2)/t.depth})):(o=i.width,a=i.height,r=Zc());var s=t.getData().tree.root,l=s.children[0];if(l){Fc(s),ad(l,Wc,r),s.hierNode.modifier=-l.hierNode.prelim,rd(l,Hc);var u=l,h=l,c=l;rd(l,function(t){var e=t.getLayout().x;eh.getLayout().x&&(h=t),t.depth>c.depth&&(c=t)});var d=u===h?1:r(u,h)/2,f=d-u.getLayout().x,p=0,g=0,m=0,v=0;if("radial"===n)p=o/(h.getLayout().x+d+f),g=a/(c.depth-1||1),rd(l,function(t){m=(t.getLayout().x+f)*p,v=(t.depth-1)*g;var e=Uc(m,v);t.setLayout({x:e.x,y:e.y,rawX:m,rawY:v},!0)});else{var y=t.getOrient();"RL"===y||"LR"===y?(g=a/(h.getLayout().x+d+f),p=o/(c.depth-1||1),rd(l,function(t){v=(t.getLayout().x+f)*g,m="LR"===y?(t.depth-1)*p:o-(t.depth-1)*p,t.setLayout({x:m,y:v},!0)})):"TB"!==y&&"BT"!==y||(p=o/(h.getLayout().x+d+f),g=a/(c.depth-1||1),rd(l,function(t){m=(t.getLayout().x+f)*p,v="TB"===y?(t.depth-1)*g:a-(t.depth-1)*g,t.setLayout({x:m,y:v},!0)}))}}}function ld(t,e,i){if(t&&l(e,t.type)>=0){var n=i.getData().tree.root,o=t.targetNode;if("string"==typeof o&&(o=n.getNodeById(o)),o&&n.contains(o))return{node:o};var a=t.targetNodeId;if(null!=a&&(o=n.getNodeById(a)))return{node:o}}}function ud(t){for(var e=[];t;)(t=t.parentNode)&&e.push(t);return e.reverse()}function hd(t,e){return l(ud(t),e)>=0}function cd(t,e){for(var i=[];t;){var n=t.dataIndex;i.push({name:t.name,dataIndex:n,value:e.getRawValue(n)}),t=t.parentNode}return i.reverse(),i}function dd(t){var e=0;d(t.children,function(t){dd(t);var i=t.value;y(i)&&(i=i[0]),e+=i});var i=t.value;y(i)&&(i=i[0]),(null==i||isNaN(i))&&(i=e),i<0&&(i=0),y(t.value)?t.value[0]=i:t.value=i}function fd(t,e){var i=e.get("color");if(i){var n;return d(t=t||[],function(t){var e=new No(t),i=e.get("color");(e.get("itemStyle.color")||i&&"none"!==i)&&(n=!0)}),n||((t[0]||(t[0]={})).color=i.slice()),t}}function pd(t){this.group=new tb,t.add(this.group)}function gd(t,e,i,n,o,a){var r=[[o?t:t-UC,e],[t+i,e],[t+i,e+n],[o?t:t-UC,e+n]];return!a&&r.splice(2,0,[t+i+UC,e+n/2]),!o&&r.push([t,e+n/2]),r}function md(t,e,i){t.eventData={componentType:"series",componentSubType:"treemap",componentIndex:e.componentIndex,seriesIndex:e.componentIndex,seriesName:e.name,seriesType:"treemap",selfType:"breadcrumb",nodeData:{dataIndex:i&&i.dataIndex,name:i&&i.name},treePathInfo:i&&cd(i,e)}}function vd(){var t,e=[],i={};return{add:function(t,n,o,a,r){return _(a)&&(r=a,a=0),!i[t.id]&&(i[t.id]=1,e.push({el:t,target:n,time:o,delay:a,easing:r}),!0)},done:function(e){return t=e,this},start:function(){for(var n=e.length,o=0,a=e.length;o=0;a--)null==i[a]&&(delete n[e[a]],e.pop())}function bd(t,e){var i=t.visual,n=[];w(i)?sL(i,function(t){n.push(t)}):null!=i&&n.push(i);var o={color:1,symbol:1};e||1!==n.length||o.hasOwnProperty(t.type)||(n[1]=n[0]),Ld(t,n)}function Sd(t){return{applyVisual:function(e,i,n){e=this.mapValueToVisual(e),n("color",t(i("color"),e))},_doMap:Dd([0,1])}}function Md(t){var e=this.option.visual;return e[Math.round(Bo(t,[0,1],[0,e.length-1],!0))]||{}}function Id(t){return function(e,i,n){n(t,this.mapValueToVisual(e))}}function Td(t){var e=this.option.visual;return e[this.option.loop&&t!==uL?t%e.length:t]}function Ad(){return this.option.visual[0]}function Dd(t){return{linear:function(e){return Bo(e,t,this.option.visual,!0)},category:Td,piecewise:function(e,i){var n=Cd.call(this,i);return null==n&&(n=Bo(e,t,this.option.visual,!0)),n},fixed:Ad}}function Cd(t){var e=this.option,i=e.pieceList;if(e.hasSpecialVisual){var n=i[hL.findPieceIndex(t,i)];if(n&&n.visual)return n.visual[this.type]}}function Ld(t,e){return t.visual=e,"color"===t.type&&(t.parsedVisual=f(e,function(t){return Gt(t)})),e}function kd(t,e,i){return t?e<=i:e=o.length||t===o[t.depth])&&Pd(t,Vd(r,h,t,e,g,a),i,n,o,a)})}else l=Od(h),t.setVisual("color",l)}}function Nd(t,e,i,n){var o=a({},e);return d(["color","colorAlpha","colorSaturation"],function(a){var r=t.get(a,!0);null==r&&i&&(r=i[a]),null==r&&(r=e[a]),null==r&&(r=n.get(a)),null!=r&&(o[a]=r)}),o}function Od(t){var e=Rd(t,"color");if(e){var i=Rd(t,"colorAlpha"),n=Rd(t,"colorSaturation");return n&&(e=jt(e,null,null,n)),i&&(e=Yt(e,i)),e}}function Ed(t,e){return null!=e?jt(e,null,null,t):null}function Rd(t,e){var i=t[e];if(null!=i&&"none"!==i)return i}function zd(t,e,i,n,o,a){if(a&&a.length){var r=Bd(e,"color")||null!=o.color&&"none"!==o.color&&(Bd(e,"colorAlpha")||Bd(e,"colorSaturation"));if(r){var s=e.get("visualMin"),l=e.get("visualMax"),u=i.dataExtent.slice();null!=s&&su[1]&&(u[1]=l);var h=e.get("colorMappingBy"),c={type:r.name,dataExtent:u,visual:r.range};"color"!==c.type||"index"!==h&&"id"!==h?c.mappingMethod="linear":(c.mappingMethod="category",c.loop=!0);var d=new hL(c);return d.__drColorMappingBy=h,d}}}function Bd(t,e){var i=t.get(e);return fL(i)&&i.length?{name:e,range:i}:null}function Vd(t,e,i,n,o,r){var s=a({},e);if(o){var l=o.type,u="color"===l&&o.__drColorMappingBy,h="index"===u?n:"id"===u?r.mapIdToIndex(i.getId()):i.getValue(t.get("visualDimension"));s[l]=o.mapValueToVisual(h)}return s}function Gd(t,e,i,n){var o,a;if(!t.isRemoved()){var r=t.getLayout();o=r.width,a=r.height;var s=(f=t.getModel()).get(_L),l=f.get(wL)/2,u=Kd(f),h=Math.max(s,u),c=s-l,d=h-l,f=t.getModel();t.setLayout({borderWidth:s,upperHeight:h,upperLabelHeight:u},!0);var p=(o=mL(o-2*c,0))*(a=mL(a-c-d,0)),g=Fd(t,f,p,e,i,n);if(g.length){var m={x:c,y:d,width:o,height:a},v=vL(o,a),y=1/0,x=[];x.area=0;for(var _=0,w=g.length;_=0;l--){var u=o["asc"===n?r-l-1:l].getValue();u/i*es[1]&&(s[1]=e)})}else s=[NaN,NaN];return{sum:n,dataExtent:s}}function Ud(t,e,i){for(var n,o=0,a=1/0,r=0,s=t.length;ro&&(o=n));var l=t.area*t.area,u=e*e*i;return l?mL(u*o/l,l/(u*a)):1/0}function Xd(t,e,i,n,o){var a=e===i.width?0:1,r=1-a,s=["x","y"],l=["width","height"],u=i[s[a]],h=e?t.area/e:0;(o||h>i[l[r]])&&(h=i[l[r]]);for(var c=0,d=t.length;cXM&&(u=XM),a=s}u=0?n+=u:n-=u:p>=0?n-=u:n+=u}return n}function pf(t,e){return t.getVisual("opacity")||t.getModel().get(e)}function gf(t,e,i){var n=t.getGraphicEl(),o=pf(t,e);null!=i&&(null==o&&(o=1),o*=i),n.downplay&&n.downplay(),n.traverse(function(t){if("group"!==t.type){var e=t.lineLabelOriginalOpacity;null!=e&&null==i||(e=o),t.setStyle("opacity",e)}})}function mf(t,e){var i=pf(t,e),n=t.getGraphicEl();n.highlight&&n.highlight(),n.traverse(function(t){"group"!==t.type&&t.setStyle("opacity",i)})}function vf(t){return t instanceof Array||(t=[t,t]),t}function yf(t){var e=t.coordinateSystem;if(!e||"view"===e.type){var i=t.getGraph();i.eachNode(function(t){var e=t.getModel();t.setLayout([+e.get("x"),+e.get("y")])}),xf(i)}}function xf(t){t.eachEdge(function(t){var e=t.getModel().get("lineStyle.curveness")||0,i=F(t.node1.getLayout()),n=F(t.node2.getLayout()),o=[i,n];+e&&o.push([(i[0]+n[0])/2-(i[1]-n[1])*e,(i[1]+n[1])/2-(n[0]-i[0])*e]),t.setLayout(o)})}function _f(t){var e=t.coordinateSystem;if(!e||"view"===e.type){var i=e.getBoundingRect(),n=t.getData(),o=n.graph,a=0,r=n.getSum("value"),s=2*Math.PI/(r||n.count()),l=i.width/2+i.x,u=i.height/2+i.y,h=Math.min(i.width,i.height)/2;o.eachNode(function(t){var e=t.getValue("value");a+=s*(r?e:1)/2,t.setLayout([h*Math.cos(a)+l,h*Math.sin(a)+u]),a+=s*(r?e:1)/2}),n.setLayout({cx:l,cy:u}),o.eachEdge(function(t){var e,i=t.getModel().get("lineStyle.curveness")||0,n=F(t.node1.getLayout()),o=F(t.node2.getLayout()),a=(n[0]+o[0])/2,r=(n[1]+o[1])/2;+i&&(e=[l*(i*=3)+a*(1-i),u*i+r*(1-i)]),t.setLayout([n,o,e])})}}function wf(t,e,i){for(var n=i.rect,o=n.width,a=n.height,r=[n.x+o/2,n.y+a/2],s=null==i.gravity?.1:i.gravity,l=0;l0?-1:i<0?1:e?-1:1}}function Pf(t,e){return Math.min(e[1],Math.max(e[0],t))}function Nf(t,e,i){this._axesMap=R(),this._axesLayout={},this.dimensions=t.dimensions,this._rect,this._model=t,this._init(t,e,i)}function Of(t,e){return ek(ik(t,e[0]),e[1])}function Ef(t,e){var i=e.layoutLength/(e.axisCount-1);return{position:i*t,axisNameAvailableWidth:i,axisLabelShow:!0}}function Rf(t,e){var i,n,o=e.layoutLength,a=e.axisExpandWidth,r=e.axisCount,s=e.axisCollapseWidth,l=e.winInnerIndices,u=s,h=!1;return tmk}function $f(t){var e=t.length-1;return e<0&&(e=0),[t[0],t[e]]}function Jf(t,e,i,n){var o=new tb;return o.add(new yM({name:"main",style:ip(i),silent:!0,draggable:!0,cursor:"move",drift:uk(t,e,o,"nswe"),ondragend:uk(qf,e,{isEnd:!0})})),hk(n,function(i){o.add(new yM({name:i,style:{opacity:0},draggable:!0,silent:!0,invisible:!0,drift:uk(t,e,o,i),ondragend:uk(qf,e,{isEnd:!0})}))}),o}function Qf(t,e,i,n){var o=n.brushStyle.lineWidth||0,a=fk(o,vk),r=i[0][0],s=i[1][0],l=r-o/2,u=s-o/2,h=i[0][1],c=i[1][1],d=h-a+o/2,f=c-a+o/2,p=h-r,g=c-s,m=p+o,v=g+o;ep(t,e,"main",r,s,p,g),n.transformable&&(ep(t,e,"w",l,u,a,v),ep(t,e,"e",d,u,a,v),ep(t,e,"n",l,u,m,a),ep(t,e,"s",l,f,m,a),ep(t,e,"nw",l,u,a,a),ep(t,e,"ne",d,u,a,a),ep(t,e,"sw",l,f,a,a),ep(t,e,"se",d,f,a,a))}function tp(t,e){var i=e.__brushOption,n=i.transformable,o=e.childAt(0);o.useStyle(ip(i)),o.attr({silent:!n,cursor:n?"move":"default"}),hk(["w","e","n","s","se","sw","ne","nw"],function(i){var o=e.childOfName(i),a=ap(t,i);o&&o.attr({silent:!n,invisible:!n,cursor:n?_k[a]+"-resize":null})})}function ep(t,e,i,n,o,a,r){var s=e.childOfName(i);s&&s.setShape(hp(up(t,e,[[n,o],[n+a,o+r]])))}function ip(t){return r({strokeNoScale:!0},t.brushStyle)}function np(t,e,i,n){var o=[dk(t,i),dk(e,n)],a=[fk(t,i),fk(e,n)];return[[o[0],a[0]],[o[1],a[1]]]}function op(t){return Ao(t.group)}function ap(t,e){if(e.length>1)return("e"===(n=[ap(t,(e=e.split(""))[0]),ap(t,e[1])])[0]||"w"===n[0])&&n.reverse(),n.join("");var i={left:"w",right:"e",top:"n",bottom:"s"},n=Co({w:"left",e:"right",n:"top",s:"bottom"}[e],op(t));return i[n]}function rp(t,e,i,n,o,a,r,s){var l=n.__brushOption,u=t(l.range),h=lp(i,a,r);hk(o.split(""),function(t){var e=xk[t];u[e[0]][e[1]]+=h[e[0]]}),l.range=e(np(u[0][0],u[1][0],u[0][1],u[1][1])),Zf(i,n),qf(i,{isEnd:!1})}function sp(t,e,i,n,o){var a=e.__brushOption.range,r=lp(t,i,n);hk(a,function(t){t[0]+=r[0],t[1]+=r[1]}),Zf(t,e),qf(t,{isEnd:!1})}function lp(t,e,i){var n=t.group,o=n.transformCoordToLocal(e,i),a=n.transformCoordToLocal(0,0);return[o[0]-a[0],o[1]-a[1]]}function up(t,e,n){var o=jf(t,e);return o&&!0!==o?o.clipPath(n,t._transform):i(n)}function hp(t){var e=dk(t[0][0],t[1][0]),i=dk(t[0][1],t[1][1]);return{x:e,y:i,width:fk(t[0][0],t[1][0])-e,height:fk(t[0][1],t[1][1])-i}}function cp(t,e,i){if(t._brushType){var n=t._zr,o=t._covers,a=Xf(t,e,i);if(!t._dragging)for(var r=0;r0;a--)Yp(s,l*=.99,r),jp(s,o,i,n,r),tg(s,l,r),jp(s,o,i,n,r)}function Up(t,e){var i=[],n="vertical"===e?"y":"x",o=Zi(t,function(t){return t.getLayout()[n]});return o.keys.sort(function(t,e){return t-e}),d(o.keys,function(t){i.push(o.buckets.get(t))}),i}function Xp(t,e,i,n,o,a,r){var s=[];d(e,function(t){var e=t.length,i=0,l=0;d(t,function(t){i+=t.getLayout().value}),l="vertical"===r?(o-(e-1)*a)/i:(n-(e-1)*a)/i,s.push(l)}),s.sort(function(t,e){return t-e});var l=s[0];d(e,function(t){d(t,function(t,e){var i=t.getLayout().value*l;"vertical"===r?(t.setLayout({x:e},!0),t.setLayout({dx:i},!0)):(t.setLayout({y:e},!0),t.setLayout({dy:i},!0))})}),d(i,function(t){var e=+t.getValue()*l;t.setLayout({dy:e},!0)})}function jp(t,e,i,n,o){d(t,function(t){var a,r,s,l=0,u=t.length;if("vertical"===o){var h;for(t.sort(function(t,e){return t.getLayout().x-e.getLayout().x}),s=0;s0&&(h=a.getLayout().x+r,a.setLayout({x:h},!0)),l=a.getLayout().x+a.getLayout().dx+e;if((r=l-e-n)>0)for(h=a.getLayout().x-r,a.setLayout({x:h},!0),l=h,s=u-2;s>=0;--s)(r=(a=t[s]).getLayout().x+a.getLayout().dx+e-l)>0&&(h=a.getLayout().x-r,a.setLayout({x:h},!0)),l=a.getLayout().x}else{var c;for(t.sort(function(t,e){return t.getLayout().y-e.getLayout().y}),s=0;s0&&(c=a.getLayout().y+r,a.setLayout({y:c},!0)),l=a.getLayout().y+a.getLayout().dy+e;if((r=l-e-i)>0)for(c=a.getLayout().y-r,a.setLayout({y:c},!0),l=c,s=u-2;s>=0;--s)(r=(a=t[s]).getLayout().y+a.getLayout().dy+e-l)>0&&(c=a.getLayout().y-r,a.setLayout({y:c},!0)),l=a.getLayout().y}})}function Yp(t,e,i){d(t.slice().reverse(),function(t){d(t,function(t){if(t.outEdges.length){var n=Qp(t.outEdges,qp,i)/Qp(t.outEdges,Jp,i);if("vertical"===i){var o=t.getLayout().x+(n-$p(t,i))*e;t.setLayout({x:o},!0)}else{var a=t.getLayout().y+(n-$p(t,i))*e;t.setLayout({y:a},!0)}}})})}function qp(t,e){return $p(t.node2,e)*t.getValue()}function Kp(t,e){return $p(t.node1,e)*t.getValue()}function $p(t,e){return"vertical"===e?t.getLayout().x+t.getLayout().dx/2:t.getLayout().y+t.getLayout().dy/2}function Jp(t){return t.getValue()}function Qp(t,e,i){for(var n=0,o=t.length,a=-1;++a0?"P":"N",a=n.getVisual("borderColor"+o)||n.getVisual("color"+o),r=i.getModel(Gk).getItemStyle(Wk);e.useStyle(r),e.style.fill=null,e.style.stroke=a}function fg(t,e,i,n,o){return i>n?-1:i0?t.get(o,e-1)<=n?1:-1:1}function pg(t,e){var i,n=t.getBaseAxis(),o="category"===n.type?n.getBandWidth():(i=n.getExtent(),Math.abs(i[1]-i[0])/e.count()),a=Vo(A(t.get("barMaxWidth"),o),o),r=Vo(A(t.get("barMinWidth"),1),o),s=t.get("barWidth");return null!=s?Vo(s,o):Math.max(Math.min(o/2,a),r)}function gg(t){return y(t)||(t=[+t,+t]),t}function mg(t,e){t.eachChild(function(t){t.attr({z:e.z,zlevel:e.zlevel,style:{stroke:"stroke"===e.brushType?e.color:null,fill:"fill"===e.brushType?e.color:null}})})}function vg(t,e){tb.call(this);var i=new wu(t,e),n=new tb;this.add(i),this.add(n),n.beforeUpdate=function(){this.attr(i.getScale())},this.updateData(t,e)}function yg(t){var e=t.data;e&&e[0]&&e[0][0]&&e[0][0].coord&&(t.data=f(e,function(t){var e={coords:[t[0].coord,t[1].coord]};return t[0].name&&(e.fromName=t[0].name),t[1].name&&(e.toName=t[1].name),o([e,t[0],t[1]])}))}function xg(t,e,i){tb.call(this),this.add(this.createLine(t,e,i)),this._updateEffectSymbol(t,e)}function _g(t,e,i){tb.call(this),this._createPolyline(t,e,i)}function wg(t,e,i){xg.call(this,t,e,i),this._lastFrame=0,this._lastFramePercent=0}function bg(){this.group=new tb}function Sg(t){return t instanceof Array||(t=[t,t]),t}function Mg(){var t=iw();this.canvas=t,this.blurSize=30,this.pointSize=20,this.maxOpacity=1,this.minOpacity=0,this._gradientPixels={}}function Ig(t,e,i){var n=t[1]-t[0],o=(e=f(e,function(e){return{interval:[(e.interval[0]-t[0])/n,(e.interval[1]-t[0])/n]}})).length,a=0;return function(t){for(n=a;n=0;n--){var r=e[n].interval;if(r[0]<=t&&t<=r[1]){a=n;break}}return n>=0&&n=e[0]&&t<=e[1]}}function Ag(t){var e=t.dimensions;return"lng"===e[0]&&"lat"===e[1]}function Dg(t,e,i,n){var o=t.getItemLayout(e),a=i.get("symbolRepeat"),r=i.get("symbolClip"),s=i.get("symbolPosition")||"start",l=(i.get("symbolRotate")||0)*Math.PI/180||0,u=i.get("symbolPatternSize")||2,h=i.isAnimationEnabled(),c={dataIndex:e,layout:o,itemModel:i,symbolType:t.getItemVisual(e,"symbol")||"circle",color:t.getItemVisual(e,"color"),symbolClip:r,symbolRepeat:a,symbolRepeatDirection:i.get("symbolRepeatDirection"),symbolPatternSize:u,rotation:l,animationModel:h?i:null,hoverAnimation:h&&i.get("hoverAnimation"),z2:i.getShallow("z",!0)||0};Cg(i,a,o,n,c),kg(t,e,o,a,r,c.boundingLength,c.pxSign,u,n,c),Pg(i,c.symbolScale,l,n,c);var d=c.symbolSize,f=i.get("symbolOffset");return y(f)&&(f=[Vo(f[0],d[0]),Vo(f[1],d[1])]),Ng(i,d,o,a,r,f,s,c.valueLineWidth,c.boundingLength,c.repeatCutLength,n,c),c}function Cg(t,e,i,n,o){var a,r=n.valueDim,s=t.get("symbolBoundingData"),l=n.coordSys.getOtherAxis(n.coordSys.getBaseAxis()),u=l.toGlobalCoord(l.dataToCoord(0)),h=1-+(i[r.wh]<=0);if(y(s)){var c=[Lg(l,s[0])-u,Lg(l,s[1])-u];c[1]0?1:a<0?-1:0}function Lg(t,e){return t.toGlobalCoord(t.dataToCoord(t.scale.parse(e)))}function kg(t,e,i,n,o,a,r,s,l,u){var h=l.valueDim,c=l.categoryDim,d=Math.abs(i[c.wh]),f=t.getItemVisual(e,"symbolSize");y(f)?f=f.slice():(null==f&&(f="100%"),f=[f,f]),f[c.index]=Vo(f[c.index],d),f[h.index]=Vo(f[h.index],n?d:Math.abs(a)),u.symbolSize=f,(u.symbolScale=[f[0]/s,f[1]/s])[h.index]*=(l.isHorizontal?-1:1)*r}function Pg(t,e,i,n,o){var a=t.get(cP)||0;a&&(fP.attr({scale:e.slice(),rotation:i}),fP.updateTransform(),a/=fP.getLineScale(),a*=e[n.valueDim.index]),o.valueLineWidth=a}function Ng(t,e,i,n,o,r,s,l,u,h,c,d){var f=c.categoryDim,p=c.valueDim,g=d.pxSign,m=Math.max(e[p.index]+l,0),v=m;if(n){var y=Math.abs(u),x=T(t.get("symbolMargin"),"15%")+"",_=!1;x.lastIndexOf("!")===x.length-1&&(_=!0,x=x.slice(0,x.length-1)),x=Vo(x,e[p.index]);var w=Math.max(m+2*x,0),b=_?0:2*x,S=Qo(n),M=S?n:Kg((y+b)/w);w=m+2*(x=(y-M*m)/2/(_?M:M-1)),b=_?0:2*x,S||"fixed"===n||(M=h?Kg((Math.abs(h)+b)/w):0),v=M*w-b,d.repeatTimes=M,d.symbolMargin=x}var I=g*(v/2),A=d.pathPosition=[];A[f.index]=i[f.wh]/2,A[p.index]="start"===s?I:"end"===s?u-I:u/2,r&&(A[0]+=r[0],A[1]+=r[1]);var D=d.bundlePosition=[];D[f.index]=i[f.xy],D[p.index]=i[p.xy];var C=d.barRectShape=a({},i);C[p.wh]=g*Math.max(Math.abs(i[p.wh]),Math.abs(A[p.index]+I)),C[f.wh]=i[f.wh];var L=d.clipShape={};L[f.xy]=-i[f.xy],L[f.wh]=c.ecSize[f.wh],L[p.xy]=0,L[p.wh]=i[p.wh]}function Og(t){var e=t.symbolPatternSize,i=Jl(t.symbolType,-e/2,-e/2,e,e,t.color);return i.attr({culling:!0}),"image"!==i.type&&i.setStyle({strokeNoScale:!0}),i}function Eg(t,e,i,n){function o(t){var e=l.slice(),n=i.pxSign,o=t;return("start"===i.symbolRepeatDirection?n>0:n<0)&&(o=h-1-t),e[u.index]=d*(o-h/2+.5)+l[u.index],{position:e,scale:i.symbolScale.slice(),rotation:i.rotation}}var a=t.__pictorialBundle,r=i.symbolSize,s=i.valueLineWidth,l=i.pathPosition,u=e.valueDim,h=i.repeatTimes||0,c=0,d=r[e.valueDim.index]+s+2*i.symbolMargin;for(jg(t,function(t){t.__pictorialAnimationIndex=c,t.__pictorialRepeatTimes=h,c0)],d=t.__pictorialBarRect;kh(d.style,h,a,n,e.seriesModel,o,c),fo(d,h)}function Kg(t){var e=Math.round(t);return Math.abs(t-e)<1e-4?e:Math.ceil(t)}function $g(t,e,i){this.dimension="single",this.dimensions=["single"],this._axis=null,this._rect,this._init(t,e,i),this.model=t}function Jg(t,e){e=e||{};var i=t.coordinateSystem,n=t.axis,o={},a=n.position,r=n.orient,s=i.getRect(),l=[s.x,s.x+s.width,s.y,s.y+s.height],u={horizontal:{top:l[2],bottom:l[3]},vertical:{left:l[0],right:l[1]}};o.position=["vertical"===r?u.vertical[a]:l[0],"horizontal"===r?u.horizontal[a]:l[3]];var h={horizontal:0,vertical:1};o.rotation=Math.PI/2*h[r];var c={top:-1,bottom:1,right:1,left:-1};o.labelDirection=o.tickDirection=o.nameDirection=c[a],t.get("axisTick.inside")&&(o.tickDirection=-o.tickDirection),T(e.labelInside,t.get("axisLabel.inside"))&&(o.labelDirection=-o.labelDirection);var d=e.rotate;return null==d&&(d=t.get("axisLabel.rotate")),o.labelRotation="top"===a?-d:d,o.z2=1,o}function Qg(t,e,i,n,o){var r=t.axis;if(!r.scale.isBlank()&&r.containData(e))if(t.involveSeries){var s=tm(e,t),l=s.payloadBatch,u=s.snapToValue;l[0]&&null==o.seriesIndex&&a(o,l[0]),!n&&t.snap&&r.containData(u)&&null!=u&&(e=u),i.showPointer(t,e,l,o),i.showTooltip(t,s,u)}else i.showPointer(t,e)}function tm(t,e){var i=e.axis,n=i.dim,o=t,a=[],r=Number.MAX_VALUE,s=-1;return _P(e.seriesModels,function(e,l){var u,h,c=e.getData().mapDimension(n,!0);if(e.getAxisTooltipData){var d=e.getAxisTooltipData(c,t,i);h=d.dataIndices,u=d.nestestValue}else{if(!(h=e.getData().indicesOfNearest(c[0],t,"category"===i.type?.5:null)).length)return;u=e.getData().get(c[0],h[0])}if(null!=u&&isFinite(u)){var f=t-u,p=Math.abs(f);p<=r&&((p=0&&s<0)&&(r=p,s=f,o=u,a.length=0),_P(h,function(t){a.push({seriesIndex:e.seriesIndex,dataIndexInside:t,dataIndex:e.getData().getRawIndex(t)})}))}}),{payloadBatch:a,snapToValue:o}}function em(t,e,i,n){t[e.key]={value:i,payloadBatch:n}}function im(t,e,i,n){var o=i.payloadBatch,a=e.axis,r=a.model,s=e.axisPointerModel;if(e.triggerTooltip&&o.length){var l=e.coordSys.model,u=Ah(l),h=t.map[u];h||(h=t.map[u]={coordSysId:l.id,coordSysIndex:l.componentIndex,coordSysType:l.type,coordSysMainType:l.mainType,dataByAxis:[]},t.list.push(h)),h.dataByAxis.push({axisDim:a.dim,axisIndex:r.componentIndex,axisType:r.type,axisId:r.id,value:n,valueLabelOpt:{precision:s.get("label.precision"),formatter:s.get("label.formatter")},seriesDataIndices:o.slice()})}}function nm(t,e,i){var n=i.axesInfo=[];_P(e,function(e,i){var o=e.axisPointerModel.option,a=t[i];a?(!e.useHandle&&(o.status="show"),o.value=a.value,o.seriesDataIndices=(a.payloadBatch||[]).slice()):!e.useHandle&&(o.status="hide"),"show"===o.status&&n.push({axisDim:e.axis.dim,axisIndex:e.axis.model.componentIndex,value:o.value})})}function om(t,e,i,n){if(!lm(e)&&t.list.length){var o=((t.list[0].dataByAxis[0]||{}).seriesDataIndices||[])[0]||{};n({type:"showTip",escapeConnect:!0,x:e[0],y:e[1],tooltipOption:i.tooltipOption,position:i.position,dataIndexInside:o.dataIndexInside,dataIndex:o.dataIndex,seriesIndex:o.seriesIndex,dataByCoordSys:t.list})}else n({type:"hideTip"})}function am(t,e,i){var n=i.getZr(),o=bP(n).axisPointerLastHighlights||{},a=bP(n).axisPointerLastHighlights={};_P(t,function(t,e){var i=t.axisPointerModel.option;"show"===i.status&&_P(i.seriesDataIndices,function(t){var e=t.seriesIndex+" | "+t.dataIndex;a[e]=t})});var r=[],s=[];d(o,function(t,e){!a[e]&&s.push(t)}),d(a,function(t,e){!o[e]&&r.push(t)}),s.length&&i.dispatchAction({type:"downplay",escapeConnect:!0,batch:s}),r.length&&i.dispatchAction({type:"highlight",escapeConnect:!0,batch:r})}function rm(t,e){for(var i=0;i<(t||[]).length;i++){var n=t[i];if(e.axis.dim===n.axisDim&&e.axis.model.componentIndex===n.axisIndex)return n}}function sm(t){var e=t.axis.model,i={},n=i.axisDim=t.axis.dim;return i.axisIndex=i[n+"AxisIndex"]=e.componentIndex,i.axisName=i[n+"AxisName"]=e.name,i.axisId=i[n+"AxisId"]=e.id,i}function lm(t){return!t||null==t[0]||isNaN(t[0])||null==t[1]||isNaN(t[1])}function um(t,e,i){if(!U_.node){var n=e.getZr();SP(n).records||(SP(n).records={}),hm(n,e),(SP(n).records[t]||(SP(n).records[t]={})).handler=i}}function hm(t,e){function i(i,n){t.on(i,function(i){var o=pm(e);MP(SP(t).records,function(t){t&&n(t,i,o.dispatchAction)}),cm(o.pendings,e)})}SP(t).initialized||(SP(t).initialized=!0,i("click",v(fm,"click")),i("mousemove",v(fm,"mousemove")),i("globalout",dm))}function cm(t,e){var i,n=t.showTip.length,o=t.hideTip.length;n?i=t.showTip[n-1]:o&&(i=t.hideTip[o-1]),i&&(i.dispatchAction=null,e.dispatchAction(i))}function dm(t,e,i){t.handler("leave",null,i)}function fm(t,e,i,n){e.handler(t,i,n)}function pm(t){var e={showTip:[],hideTip:[]},i=function(n){var o=e[n.type];o?o.push(n):(n.dispatchAction=i,t.dispatchAction(n))};return{dispatchAction:i,pendings:e}}function gm(t,e){if(!U_.node){var i=e.getZr();(SP(i).records||{})[t]&&(SP(i).records[t]=null)}}function mm(){}function vm(t,e,i,n){ym(TP(i).lastProp,n)||(TP(i).lastProp=n,e?Io(i,n,t):(i.stopAnimation(),i.attr(n)))}function ym(t,e){if(w(t)&&w(e)){var i=!0;return d(e,function(e,n){i=i&&ym(t[n],e)}),!!i}return t===e}function xm(t,e){t[e.get("label.show")?"show":"hide"]()}function _m(t){return{position:t.position.slice(),rotation:t.rotation||0}}function wm(t,e,i){var n=e.get("z"),o=e.get("zlevel");t&&t.traverse(function(t){"group"!==t.type&&(null!=n&&(t.z=n),null!=o&&(t.zlevel=o),t.silent=i)})}function bm(t){var e,i=t.get("type"),n=t.getModel(i+"Style");return"line"===i?(e=n.getLineStyle()).fill=null:"shadow"===i&&((e=n.getAreaStyle()).stroke=null),e}function Sm(t,e,i,n,o){var a=Im(i.get("value"),e.axis,e.ecModel,i.get("seriesDataIndices"),{precision:i.get("label.precision"),formatter:i.get("label.formatter")}),r=i.getModel("label"),s=qM(r.get("padding")||0),l=r.getFont(),u=ke(a,l),h=o.position,c=u.width+s[1]+s[3],d=u.height+s[0]+s[2],f=o.align;"right"===f&&(h[0]-=c),"center"===f&&(h[0]-=c/2);var p=o.verticalAlign;"bottom"===p&&(h[1]-=d),"middle"===p&&(h[1]-=d/2),Mm(h,c,d,n);var g=r.get("backgroundColor");g&&"auto"!==g||(g=e.get("axisLine.lineStyle.color")),t.label={shape:{x:0,y:0,width:c,height:d,r:r.get("borderRadius")},position:h.slice(),style:{text:a,textFont:l,textFill:r.getTextColor(),textPosition:"inside",fill:g,stroke:r.get("borderColor")||"transparent",lineWidth:r.get("borderWidth")||0,shadowBlur:r.get("shadowBlur"),shadowColor:r.get("shadowColor"),shadowOffsetX:r.get("shadowOffsetX"),shadowOffsetY:r.get("shadowOffsetY")},z2:10}}function Mm(t,e,i,n){var o=n.getWidth(),a=n.getHeight();t[0]=Math.min(t[0]+e,o)-e,t[1]=Math.min(t[1]+i,a)-i,t[0]=Math.max(t[0],0),t[1]=Math.max(t[1],0)}function Im(t,e,i,n,o){t=e.scale.parse(t);var a=e.scale.getLabel(t,{precision:o.precision}),r=o.formatter;if(r){var s={value:Xl(e,t),seriesData:[]};d(n,function(t){var e=i.getSeriesByIndex(t.seriesIndex),n=t.dataIndexInside,o=e&&e.getDataParams(n);o&&s.seriesData.push(o)}),_(r)?a=r.replace("{value}",a):x(r)&&(a=r(s))}return a}function Tm(t,e,i){var n=xt();return Mt(n,n,i.rotation),St(n,n,i.position),Do([t.dataToCoord(e),(i.labelOffset||0)+(i.labelDirection||1)*(i.labelMargin||0)],n)}function Am(t,e,i,n,o,a){var r=FD.innerTextLayout(i.rotation,0,i.labelDirection);i.labelMargin=o.get("label.margin"),Sm(e,n,o,a,{position:Tm(n.axis,t,i),align:r.textAlign,verticalAlign:r.textVerticalAlign})}function Dm(t,e,i){return i=i||0,{x1:t[i],y1:t[1-i],x2:e[i],y2:e[1-i]}}function Cm(t,e,i){return i=i||0,{x:t[i],y:t[1-i],width:e[i],height:e[1-i]}}function Lm(t,e,i,n,o,a){return{cx:t,cy:e,r0:i,r:n,startAngle:o,endAngle:a,clockwise:!0}}function km(t,e){var i={};return i[e.dim+"AxisIndex"]=e.index,t.getCartesian(i)}function Pm(t){return"x"===t.dim?0:1}function Nm(t){return t.isHorizontal()?0:1}function Om(t,e){var i=t.getRect();return[i[kP[e]],i[kP[e]]+i[PP[e]]]}function Em(t,e,i){var n=new yM({shape:{x:t.x-10,y:t.y-10,width:0,height:t.height+20}});return To(n,{shape:{width:t.width+20,height:t.height+20}},e,i),n}function Rm(t,e,i){if(t.count())for(var n,o=e.coordinateSystem,a=e.getLayerSeries(),r=t.mapDimension("single"),s=t.mapDimension("value"),l=f(a,function(e){return f(e.indices,function(e){var i=o.dataToPoint(t.get(r,e));return i[1]=t.get(s,e),i})}),u=zm(l),h=u.y0,c=i/u.max,d=a.length,p=a[0].indices.length,g=0;ga&&(a=u),n.push(u)}for(var h=0;ha&&(a=d)}return r.y0=o,r.max=a,r}function Bm(t){var e=0;d(t.children,function(t){Bm(t);var i=t.value;y(i)&&(i=i[0]),e+=i});var i=t.value;y(i)&&(i=i[0]),(null==i||isNaN(i))&&(i=e),i<0&&(i=0),y(t.value)?t.value[0]=i:t.value=i}function Vm(t,e,i){function n(){r.ignore=r.hoverIgnore}function o(){r.ignore=r.normalIgnore}tb.call(this);var a=new hM({z2:zP});a.seriesIndex=e.seriesIndex;var r=new rM({z2:BP,silent:t.getModel("label").get("silent")});this.add(a),this.add(r),this.updateData(!0,t,"normal",e,i),this.on("emphasis",n).on("normal",o).on("mouseover",n).on("mouseout",o)}function Gm(t,e,i){var n=t.getVisual("color"),o=t.getVisual("visualMeta");o&&0!==o.length||(n=null);var a=t.getModel("itemStyle").get("color");if(a)return a;if(n)return n;if(0===t.depth)return i.option.color[0];var r=i.option.color.length;return a=i.option.color[Fm(t)%r]}function Fm(t){for(var e=t;e.depth>1;)e=e.parentNode;return l(t.getAncestors()[0].children,e)}function Wm(t,e,i){return i!==RP.NONE&&(i===RP.SELF?t===e:i===RP.ANCESTOR?t===e||t.isAncestorOf(e):t===e||t.isDescendantOf(e))}function Hm(t,e,i){e.getData().setItemVisual(t.dataIndex,"color",i)}function Zm(t,e){var i=t.children||[];t.children=Um(i,e),i.length&&d(t.children,function(t){Zm(t,e)})}function Um(t,e){if("function"==typeof e)return t.sort(e);var i="asc"===e;return t.sort(function(t,e){var n=(t.getValue()-e.getValue())*(i?1:-1);return 0===n?(t.dataIndex-e.dataIndex)*(i?-1:1):n})}function Xm(t,e){return e=e||[0,0],f(["x","y"],function(i,n){var o=this.getAxis(i),a=e[n],r=t[n]/2;return"category"===o.type?o.getBandWidth():Math.abs(o.dataToCoord(a-r)-o.dataToCoord(a+r))},this)}function jm(t,e){return e=e||[0,0],f([0,1],function(i){var n=e[i],o=t[i]/2,a=[],r=[];return a[i]=n-o,r[i]=n+o,a[1-i]=r[1-i]=e[1-i],Math.abs(this.dataToPoint(a)[i]-this.dataToPoint(r)[i])},this)}function Ym(t,e){var i=this.getAxis(),n=e instanceof Array?e[0]:e,o=(t instanceof Array?t[0]:t)/2;return"category"===i.type?i.getBandWidth():Math.abs(i.dataToCoord(n-o)-i.dataToCoord(n+o))}function qm(t,e){return f(["Radius","Angle"],function(i,n){var o=this["get"+i+"Axis"](),a=e[n],r=t[n]/2,s="dataTo"+i,l="category"===o.type?o.getBandWidth():Math.abs(o[s](a-r)-o[s](a+r));return"Angle"===i&&(l=l*Math.PI/180),l},this)}function Km(t){var e,i=t.type;if("path"===i){var n=t.shape,o=null!=n.width&&null!=n.height?{x:n.x||0,y:n.y||0,width:n.width,height:n.height}:null,a=lv(n);(e=Xn(a,null,o,n.layout||"center")).__customPathData=a}else"image"===i?(e=new fi({})).__customImagePath=t.style.image:"text"===i?(e=new rM({})).__customText=t.style.text:e=new(0,zM[i.charAt(0).toUpperCase()+i.slice(1)]);return e.__customGraphicType=i,e.name=t.name,e}function $m(t,e,n,o,a,r,s){var l={},u=n.style||{};if(n.shape&&(l.shape=i(n.shape)),n.position&&(l.position=n.position.slice()),n.scale&&(l.scale=n.scale.slice()),n.origin&&(l.origin=n.origin.slice()),n.rotation&&(l.rotation=n.rotation),"image"===t.type&&n.style){h=l.style={};d(["x","y","width","height"],function(e){Jm(e,h,u,t.style,r)})}if("text"===t.type&&n.style){var h=l.style={};d(["x","y"],function(e){Jm(e,h,u,t.style,r)}),!u.hasOwnProperty("textFill")&&u.fill&&(u.textFill=u.fill),!u.hasOwnProperty("textStroke")&&u.stroke&&(u.textStroke=u.stroke)}if("group"!==t.type&&(t.useStyle(u),r)){t.style.opacity=0;var c=u.opacity;null==c&&(c=1),To(t,{style:{opacity:c}},o,e)}r?t.attr(l):Io(t,l,o,e),n.hasOwnProperty("z2")&&t.attr("z2",n.z2||0),n.hasOwnProperty("silent")&&t.attr("silent",n.silent),n.hasOwnProperty("invisible")&&t.attr("invisible",n.invisible),n.hasOwnProperty("ignore")&&t.attr("ignore",n.ignore),n.hasOwnProperty("info")&&t.attr("info",n.info);var f=n.styleEmphasis,p=!1===f;t.__cusHasEmphStl&&null==f||!t.__cusHasEmphStl&&p||(ro(t,f),t.__cusHasEmphStl=!p),s&&po(t,!p)}function Jm(t,e,i,n,o){null==i[t]||o||(e[t]=i[t],i[t]=n[t])}function Qm(t,e,i,n){function o(t){null==t&&(t=h),v&&(c=e.getItemModel(t),d=c.getModel(UP),f=c.getModel(XP),p=e.getItemVisual(t,"color"),v=!1)}var s=t.get("renderItem"),l=t.coordinateSystem,u={};l&&(u=l.prepareCustoms?l.prepareCustoms():YP[l.type](l));var h,c,d,f,p,g=r({getWidth:n.getWidth,getHeight:n.getHeight,getZr:n.getZr,getDevicePixelRatio:n.getDevicePixelRatio,value:function(t,i){return null==i&&(i=h),e.get(e.getDimension(t||0),i)},style:function(i,n){null==n&&(n=h),o(n);var r=c.getModel(HP).getItemStyle();null!=p&&(r.fill=p);var s=e.getItemVisual(n,"opacity");return null!=s&&(r.opacity=s),mo(r,d,null,{autoColor:p,isRectText:!0}),r.text=d.getShallow("show")?A(t.getFormattedLabel(n,"normal"),_u(e,n)):null,i&&a(r,i),r},styleEmphasis:function(i,n){null==n&&(n=h),o(n);var r=c.getModel(ZP).getItemStyle();return mo(r,f,null,{isRectText:!0},!0),r.text=f.getShallow("show")?D(t.getFormattedLabel(n,"emphasis"),t.getFormattedLabel(n,"normal"),_u(e,n)):null,i&&a(r,i),r},visual:function(t,i){return null==i&&(i=h),e.getItemVisual(i,t)},barLayout:function(t){if(l.getBaseAxis)return Ll(r({axis:l.getBaseAxis()},t),n)},currentSeriesIndices:function(){return i.getCurrentSeriesIndices()},font:function(t){return So(t,i)}},u.api||{}),m={context:{},seriesId:t.id,seriesName:t.name,seriesIndex:t.seriesIndex,coordSys:u.coordSys,dataInsideLength:e.count(),encode:tv(t.getData())},v=!0;return function(t,i){return h=t,v=!0,s&&s(r({dataIndexInside:t,dataIndex:e.getRawIndex(t),actionType:i?i.type:null},m),g)}}function tv(t){var e={};return d(t.dimensions,function(i,n){var o=t.getDimensionInfo(i);if(!o.isExtraCoord){var a=o.coordDim;(e[a]=e[a]||[])[o.coordDimIndex]=n}}),e}function ev(t,e,i,n,o,a){return(t=iv(t,e,i,n,o,a,!0))&&a.setItemGraphicEl(e,t),t}function iv(t,e,i,n,o,a,r){var s=!i,l=(i=i||{}).type,u=i.shape,h=i.style;if(t&&(s||null!=l&&l!==t.__customGraphicType||"path"===l&&uv(u)&&lv(u)!==t.__customPathData||"image"===l&&hv(h,"image")&&h.image!==t.__customImagePath||"text"===l&&hv(u,"text")&&h.text!==t.__customText)&&(o.remove(t),t=null),!s){var c=!t;return!t&&(t=Km(i)),$m(t,e,i,n,a,c,r),"group"===l&&nv(t,e,i,n,a),o.add(t),t}}function nv(t,e,i,n,o){var a=i.children,r=a?a.length:0,s=i.$mergeChildren,l="byName"===s||i.diffChildrenByName,u=!1===s;if(r||l||u)if(l)ov({oldChildren:t.children()||[],newChildren:a||[],dataIndex:e,animatableModel:n,group:t,data:o});else{u&&t.removeAll();for(var h=0;hn?t-=l+a:t+=a),null!=r&&(e+u+r>o?e-=u+r:e+=r),[t,e]}function Ov(t,e,i,n,o){var a=i.getOuterSize(),r=a.width,s=a.height;return t=Math.min(t+r,n)-r,e=Math.min(e+s,o)-s,t=Math.max(t,0),e=Math.max(e,0),[t,e]}function Ev(t,e,i){var n=i[0],o=i[1],a=0,r=0,s=e.width,l=e.height;switch(t){case"inside":a=e.x+s/2-n/2,r=e.y+l/2-o/2;break;case"top":a=e.x+s/2-n/2,r=e.y-o-5;break;case"bottom":a=e.x+s/2-n/2,r=e.y+l+5;break;case"left":a=e.x-n-5,r=e.y+l/2-o/2;break;case"right":a=e.x+s+5,r=e.y+l/2-o/2}return[a,r]}function Rv(t){return"center"===t||"middle"===t}function zv(t){return t.get("stack")||"__ec_stack_"+t.seriesIndex}function Bv(t){return t.dim}function Vv(t,e){var i={};d(t,function(t,e){var n=t.getData(),o=t.coordinateSystem.getBaseAxis(),a=o.getExtent(),r="category"===o.type?o.getBandWidth():Math.abs(a[1]-a[0])/n.count(),s=i[Bv(o)]||{bandWidth:r,remainedWidth:r,autoWidthCount:0,categoryGap:"20%",gap:"30%",stacks:{}},l=s.stacks;i[Bv(o)]=s;var u=zv(t);l[u]||s.autoWidthCount++,l[u]=l[u]||{width:0,maxWidth:0};var h=Vo(t.get("barWidth"),r),c=Vo(t.get("barMaxWidth"),r),d=t.get("barGap"),f=t.get("barCategoryGap");h&&!l[u].width&&(h=Math.min(s.remainedWidth,h),l[u].width=h,s.remainedWidth-=h),c&&(l[u].maxWidth=c),null!=d&&(s.gap=d),null!=f&&(s.categoryGap=f)});var n={};return d(i,function(t,e){n[e]={};var i=t.stacks,o=t.bandWidth,a=Vo(t.categoryGap,o),r=Vo(t.gap,1),s=t.remainedWidth,l=t.autoWidthCount,u=(s-a)/(l+(l-1)*r);u=Math.max(u,0),d(i,function(t,e){var i=t.maxWidth;i&&ie[0]&&(e=e.slice().reverse());var n=t.coordToPoint([e[0],i]),o=t.coordToPoint([e[1],i]);return{x1:n[0],y1:n[1],x2:o[0],y2:o[1]}}function jv(t){return t.getRadiusAxis().inverse?0:1}function Yv(t){var e=t[0],i=t[t.length-1];e&&i&&Math.abs(Math.abs(e.coord-i.coord)-360)<1e-4&&t.pop()}function qv(t,e,i){return{position:[t.cx,t.cy],rotation:i/180*Math.PI,labelDirection:-1,tickDirection:-1,nameDirection:1,labelRotate:e.getModel("axisLabel").get("rotate"),z2:1}}function Kv(t,e,i,n,o){var a=e.axis,r=a.dataToCoord(t),s=n.getAngleAxis().getExtent()[0];s=s/180*Math.PI;var l,u,h,c=n.getRadiusAxis().getExtent();if("radius"===a.dim){var d=xt();Mt(d,d,s),St(d,d,[n.cx,n.cy]),l=Do([r,-o],d);var f=e.getModel("axisLabel").get("rotate")||0,p=FD.innerTextLayout(s,f*Math.PI/180,-1);u=p.textAlign,h=p.textVerticalAlign}else{var g=c[1];l=n.coordToPoint([g+o,r]);var m=n.cx,v=n.cy;u=Math.abs(l[0]-m)/g<.3?"center":l[0]>m?"left":"right",h=Math.abs(l[1]-v)/g<.3?"middle":l[1]>v?"top":"bottom"}return{position:l,align:u,verticalAlign:h}}function $v(t,e){e.update="updateView",Es(e,function(e,i){var n={};return i.eachComponent({mainType:"geo",query:e},function(i){i[t](e.name),d(i.coordinateSystem.regions,function(t){n[t.name]=i.isSelected(t.name)||!1})}),{selected:n,name:e.name}})}function Jv(t){var e={};d(t,function(t){e[t]=1}),t.length=0,d(e,function(e,i){t.push(i)})}function Qv(t){if(t)for(var e in t)if(t.hasOwnProperty(e))return!0}function ty(t,e,n){function o(){var t=function(){};return t.prototype.__hidden=t.prototype,new t}var a={};return MN(e,function(e){var r=a[e]=o();MN(t[e],function(t,o){if(hL.isValidType(o)){var a={type:o,visual:t};n&&n(a,e),r[o]=new hL(a),"opacity"===o&&((a=i(a)).type="colorAlpha",r.__hidden.__alphaForOpacity=new hL(a))}})}),a}function ey(t,e,n){var o;d(n,function(t){e.hasOwnProperty(t)&&Qv(e[t])&&(o=!0)}),o&&d(n,function(n){e.hasOwnProperty(n)&&Qv(e[n])?t[n]=i(e[n]):delete t[n]})}function iy(t,e,i,n,o,a){function r(t){return i.getItemVisual(h,t)}function s(t,e){i.setItemVisual(h,t,e)}function l(t,l){h=null==a?t:l;var c=i.getRawDataItem(h);if(!c||!1!==c.visualMap)for(var d=n.call(o,t),f=e[d],p=u[d],g=0,m=p.length;g1)return!1;var h=uy(i-t,o-t,n-e,a-e)/l;return!(h<0||h>1)}function ly(t){return t<=1e-6&&t>=-1e-6}function uy(t,e,i,n){return t*n-e*i}function hy(t,e,i){var n=this._targetInfoList=[],o={},a=dy(e,t);TN(PN,function(t,e){(!i||!i.include||AN(i.include,e)>=0)&&t(a,n,o)})}function cy(t){return t[0]>t[1]&&t.reverse(),t}function dy(t,e){return Vi(t,e,{includeMainTypes:LN})}function fy(t,e,i,n){var o=i.getAxis(["x","y"][t]),a=cy(f([0,1],function(t){return e?o.coordToData(o.toLocalCoord(n[t])):o.toGlobalCoord(o.dataToCoord(n[t]))})),r=[];return r[t]=a,r[1-t]=[NaN,NaN],{values:a,xyMinMax:r}}function py(t,e,i,n){return[e[0]-n[t]*i[0],e[1]-n[t]*i[1]]}function gy(t,e){var i=my(t),n=my(e),o=[i[0]/n[0],i[1]/n[1]];return isNaN(o[0])&&(o[0]=1),isNaN(o[1])&&(o[1]=1),o}function my(t){return t?[t[0][1]-t[0][0],t[1][1]-t[1][0]]:[NaN,NaN]}function vy(t,e,i,n,o){if(o){var a=t.getZr();a[VN]||(a[BN]||(a[BN]=yy),Nr(a,BN,i,e)(t,n))}}function yy(t,e){if(!t.isDisposed()){var i=t.getZr();i[VN]=!0,t.dispatchAction({type:"brushSelect",batch:e}),i[VN]=!1}}function xy(t,e,i,n){for(var o=0,a=e.length;o=0}function Ny(t,e,i){function n(t,e){return l(e.nodes,t)>=0}function o(t,n){var o=!1;return e(function(e){d(i(t,e)||[],function(t){n.records[e.name][t]&&(o=!0)})}),o}function a(t,n){n.nodes.push(t),e(function(e){d(i(t,e)||[],function(t){n.records[e.name][t]=!0})})}return function(i){var r={nodes:[],records:{}};if(e(function(t){r.records[t.name]={}}),!i)return r;a(i,r);var s;do{s=!1,t(function(t){!n(t,r)&&o(t,r)&&(a(t,r),s=!0)})}while(s);return r}}function Oy(t,e,i){var n=[1/0,-1/0];return $N(i,function(t){var i=t.getData();i&&$N(i.mapDimension(e,!0),function(t){var e=i.getApproximateExtent(t);e[0]n[1]&&(n[1]=e[1])})}),n[1]0?0:NaN);var r=i.getMax(!0);return null!=r&&"dataMax"!==r&&"function"!=typeof r?e[1]=r:o&&(e[1]=a>0?a-1:NaN),i.get("scale",!0)||(e[0]>0&&(e[0]=0),e[1]<0&&(e[1]=0)),e}function Ry(t,e){var i=t.getAxisModel(),n=t._percentWindow,o=t._valueWindow;if(n){var a=Zo(o,[0,500]);a=Math.min(a,20);var r=e||0===n[0]&&100===n[1];i.setRange(r?null:+o[0].toFixed(a),r?null:+o[1].toFixed(a))}}function zy(t){var e=t._minMaxSpan={},i=t._dataZoomModel;$N(["min","max"],function(n){e[n+"Span"]=i.get(n+"Span");var o=i.get(n+"ValueSpan");if(null!=o&&(e[n+"ValueSpan"]=o,null!=(o=t.getAxisModel().axis.scale.parse(o)))){var a=t._dataExtent;e[n+"Span"]=Bo(a[0]+o,a,[0,100],!0)}})}function By(t){var e={};return tO(["start","end","startValue","endValue","throttle"],function(i){t.hasOwnProperty(i)&&(e[i]=t[i])}),e}function Vy(t,e){var i=t._rangePropMode,n=t.get("rangeMode");tO([["start","startValue"],["end","endValue"]],function(t,o){var a=null!=e[t[0]],r=null!=e[t[1]];a&&!r?i[o]="percent":!a&&r?i[o]="value":n?i[o]=n[o]:a&&(i[o]="percent")})}function Gy(t){return{x:"y",y:"x",radius:"angle",angle:"radius"}[t]}function Fy(t){return"vertical"===t?"ns-resize":"ew-resize"}function Wy(t,e){var i=Uy(t),n=e.dataZoomId,o=e.coordId;d(i,function(t,i){var a=t.dataZoomInfos;a[n]&&l(e.allCoordIds,o)<0&&(delete a[n],t.count--)}),jy(i);var a=i[o];a||((a=i[o]={coordId:o,dataZoomInfos:{},count:0}).controller=Xy(t,a),a.dispatchAction=v(Yy,t)),!a.dataZoomInfos[n]&&a.count++,a.dataZoomInfos[n]=e;var r=qy(a.dataZoomInfos);a.controller.enable(r.controlType,r.opt),a.controller.setPointerChecker(e.containsPoint),Nr(a,"dispatchAction",e.dataZoomModel.get("throttle",!0),"fixRate")}function Hy(t,e){var i=Uy(t);d(i,function(t){t.controller.dispose();var i=t.dataZoomInfos;i[e]&&(delete i[e],t.count--)}),jy(i)}function Zy(t){return t.type+"\0_"+t.id}function Uy(t){var e=t.getZr();return e[fO]||(e[fO]={})}function Xy(t,e){var i=new oc(t.getZr());return d(["pan","zoom","scrollMove"],function(t){i.on(t,function(i){var n=[];d(e.dataZoomInfos,function(o){if(i.isAvailableBehavior(o.dataZoomModel.option)){var a=(o.getRange||{})[t],r=a&&a(e.controller,i);!o.dataZoomModel.get("disabled",!0)&&r&&n.push({dataZoomId:o.dataZoomId,start:r[0],end:r[1]})}}),n.length&&e.dispatchAction(n)})}),i}function jy(t){d(t,function(e,i){e.count||(e.controller.dispose(),delete t[i])})}function Yy(t,e){t.dispatchAction({type:"dataZoom",batch:e})}function qy(t){var e,i={type_true:2,type_move:1,type_false:0,type_undefined:-1},n=!0;return d(t,function(t){var o=t.dataZoomModel,a=!o.get("disabled",!0)&&(!o.get("zoomLock",!0)||"move");i["type_"+a]>i["type_"+e]&&(e=a),n&=o.get("preventDefaultMouseMove",!0)}),{controlType:e,opt:{zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!0,preventDefaultMouseMove:!!n}}}function Ky(t){return function(e,i,n,o){var a=this._range,r=a.slice(),s=e.axisModels[0];if(s){var l=t(r,s,e,i,n,o);return QL(l,r,[0,100],"all"),this._range=r,a[0]!==r[0]||a[1]!==r[1]?r:void 0}}}function $y(t,e){return t&&t.hasOwnProperty&&t.hasOwnProperty(e)}function Jy(t,e,i,n){for(var o=e.targetVisuals[n],a=hL.prepareVisualTypes(o),r={color:t.getData().getVisual("color")},s=0,l=a.length;s=0&&(r[a]=+r[a].toFixed(h)),r}function fx(t,e){var n=t.getData(),o=t.coordinateSystem;if(e&&!cx(e)&&!y(e.coord)&&o){var a=o.dimensions,r=px(e,n,o,t);if((e=i(e)).type&&YO[e.type]&&r.baseAxis&&r.valueAxis){var s=XO(a,r.baseAxis.dim),l=XO(a,r.valueAxis.dim);e.coord=YO[e.type](n,r.baseDataDim,r.valueDataDim,s,l),e.value=e.coord[l]}else{for(var u=[null!=e.xAxis?e.xAxis:e.radiusAxis,null!=e.yAxis?e.yAxis:e.angleAxis],h=0;h<2;h++)YO[u[h]]&&(u[h]=yx(n,n.mapDimension(a[h]),u[h]));e.coord=u}}return e}function px(t,e,i,n){var o={};return null!=t.valueIndex||null!=t.valueDim?(o.valueDataDim=null!=t.valueIndex?e.getDimension(t.valueIndex):t.valueDim,o.valueAxis=i.getAxis(gx(n,o.valueDataDim)),o.baseAxis=i.getOtherAxis(o.valueAxis),o.baseDataDim=e.mapDimension(o.baseAxis.dim)):(o.baseAxis=n.getBaseAxis(),o.valueAxis=i.getOtherAxis(o.baseAxis),o.baseDataDim=e.mapDimension(o.baseAxis.dim),o.valueDataDim=e.mapDimension(o.valueAxis.dim)),o}function gx(t,e){var i=t.getData(),n=i.dimensions;e=i.getDimension(e);for(var o=0;o=0)return!0}function Yx(t){for(var e=t.split(/\n+/g),i=[],n=f(Xx(e.shift()).split(pE),function(t){return{name:t,data:[]}}),o=0;o=0&&!i[o][n];o--);if(o<0){var a=t.queryComponents({mainType:"dataZoom",subType:"select",id:n})[0];if(a){var r=a.getPercentRange();i[0][n]={dataZoomId:n,start:r[0],end:r[1]}}}}),i.push(e)}function t_(t){var e=n_(t),i=e[e.length-1];e.length>1&&e.pop();var n={};return gE(i,function(t,i){for(var o=e.length-1;o>=0;o--)if(t=e[o][i]){n[i]=t;break}}),n}function e_(t){t[mE]=null}function i_(t){return n_(t).length}function n_(t){var e=t[mE];return e||(e=t[mE]=[{}]),e}function o_(t,e,i){(this._brushController=new zf(i.getZr())).on("brush",m(this._onBrush,this)).mount(),this._isZoomActive}function a_(t){var e={};return d(["xAxisIndex","yAxisIndex"],function(i){e[i]=t[i],null==e[i]&&(e[i]="all"),(!1===e[i]||"none"===e[i])&&(e[i]=[])}),e}function r_(t,e){t.setIconStatus("back",i_(e)>1?"emphasis":"normal")}function s_(t,e,i,n,o){var a=i._isZoomActive;n&&"takeGlobalCursor"===n.type&&(a="dataZoomSelect"===n.key&&n.dataZoomSelectActive),i._isZoomActive=a,t.setIconStatus("zoom",a?"emphasis":"normal");var r=new hy(a_(t.option),e,{include:["grid"]});i._brushController.setPanels(r.makePanelOpts(o,function(t){return t.xAxisDeclared&&!t.yAxisDeclared?"lineX":!t.xAxisDeclared&&t.yAxisDeclared?"lineY":"rect"})).enableBrush(!!a&&{brushType:"auto",brushStyle:{lineWidth:0,fill:"rgba(0,0,0,0.2)"}})}function l_(t){this.model=t}function u_(t){return SE(t)}function h_(){if(!TE&&AE){TE=!0;var t=AE.styleSheets;t.length<31?AE.createStyleSheet().addRule(".zrvml","behavior:url(#default#VML)"):t[0].addRule(".zrvml","behavior:url(#default#VML)")}}function c_(t){return parseInt(t,10)}function d_(t,e){h_(),this.root=t,this.storage=e;var i=document.createElement("div"),n=document.createElement("div");i.style.cssText="display:inline-block;overflow:hidden;position:relative;width:300px;height:150px;",n.style.cssText="position:absolute;left:0;top:0;",t.appendChild(i),this._vmlRoot=n,this._vmlViewport=i,this.resize();var o=e.delFromStorage,a=e.addToStorage;e.delFromStorage=function(t){o.call(e,t),t&&t.onRemove&&t.onRemove(n)},e.addToStorage=function(t){t.onAdd&&t.onAdd(n),a.call(e,t)},this._firstPaint=!0}function f_(t){return function(){Yw('In IE8.0 VML mode painter not support method "'+t+'"')}}function p_(t){return document.createElementNS(sR,t)}function g_(t){return cR(1e4*t)/1e4}function m_(t){return t-vR}function v_(t,e){var i=e?t.textFill:t.fill;return null!=i&&i!==hR}function y_(t,e){var i=e?t.textStroke:t.stroke;return null!=i&&i!==hR}function x_(t,e){e&&__(t,"transform","matrix("+uR.call(e,",")+")")}function __(t,e,i){(!i||"linear"!==i.type&&"radial"!==i.type)&&t.setAttribute(e,i)}function w_(t,e,i){t.setAttributeNS("http://www.w3.org/1999/xlink",e,i)}function b_(t,e,i,n){if(v_(e,i)){var o=i?e.textFill:e.fill;o="transparent"===o?hR:o,"none"!==t.getAttribute("clip-path")&&o===hR&&(o="rgba(0, 0, 0, 0.002)"),__(t,"fill",o),__(t,"fill-opacity",null!=e.fillOpacity?e.fillOpacity*e.opacity:e.opacity)}else __(t,"fill",hR);if(y_(e,i)){var a=i?e.textStroke:e.stroke;__(t,"stroke",a="transparent"===a?hR:a),__(t,"stroke-width",(i?e.textStrokeWidth:e.lineWidth)/(!i&&e.strokeNoScale?n.getLineScale():1)),__(t,"paint-order",i?"stroke":"fill"),__(t,"stroke-opacity",null!=e.strokeOpacity?e.strokeOpacity:e.opacity),e.lineDash?(__(t,"stroke-dasharray",e.lineDash.join(",")),__(t,"stroke-dashoffset",cR(e.lineDashOffset||0))):__(t,"stroke-dasharray",""),e.lineCap&&__(t,"stroke-linecap",e.lineCap),e.lineJoin&&__(t,"stroke-linejoin",e.lineJoin),e.miterLimit&&__(t,"stroke-miterlimit",e.miterLimit)}else __(t,"stroke",hR)}function S_(t){for(var e=[],i=t.data,n=t.len(),o=0;o=gR||!m_(g)&&(d>-pR&&d<0||d>pR)==!!p;var y=g_(s+u*fR(c)),x=g_(l+h*dR(c));m&&(d=p?gR-1e-4:1e-4-gR,v=!0,9===o&&e.push("M",y,x));var _=g_(s+u*fR(c+d)),w=g_(l+h*dR(c+d));e.push("A",g_(u),g_(h),cR(f*mR),+v,+p,_,w);break;case lR.Z:a="Z";break;case lR.R:var _=g_(i[o++]),w=g_(i[o++]),b=g_(i[o++]),S=g_(i[o++]);e.push("M",_,w,"L",_+b,w,"L",_+b,w+S,"L",_,w+S,"L",_,w)}a&&e.push(a);for(var M=0;M=11),domSupported:"undefined"!=typeof document}}(navigator.userAgent),X_={"[object Function]":1,"[object RegExp]":1,"[object Date]":1,"[object Error]":1,"[object CanvasGradient]":1,"[object CanvasPattern]":1,"[object Image]":1,"[object Canvas]":1},j_={"[object Int8Array]":1,"[object Uint8Array]":1,"[object Uint8ClampedArray]":1,"[object Int16Array]":1,"[object Uint16Array]":1,"[object Int32Array]":1,"[object Uint32Array]":1,"[object Float32Array]":1,"[object Float64Array]":1},Y_=Object.prototype.toString,q_=Array.prototype,K_=q_.forEach,$_=q_.filter,J_=q_.slice,Q_=q_.map,tw=q_.reduce,ew={},iw=function(){return ew.createCanvas()};ew.createCanvas=function(){return document.createElement("canvas")};var nw,ow="__ec_primitive__";E.prototype={constructor:E,get:function(t){return this.data.hasOwnProperty(t)?this.data[t]:null},set:function(t,e){return this.data[t]=e},each:function(t,e){void 0!==e&&(t=m(t,e));for(var i in this.data)this.data.hasOwnProperty(i)&&t(this.data[i],i)},removeKey:function(t){delete this.data[t]}};var aw=(Object.freeze||Object)({$override:e,clone:i,merge:n,mergeAll:o,extend:a,defaults:r,createCanvas:iw,getContext:s,indexOf:l,inherits:u,mixin:h,isArrayLike:c,each:d,map:f,reduce:p,filter:g,find:function(t,e,i){if(t&&e)for(var n=0,o=t.length;n3&&(n=dw.call(n,1));for(var a=e.length,r=0;r4&&(n=dw.call(n,1,n.length-1));for(var a=n[n.length-1],r=e.length,s=0;s1&&n&&n.length>1){var a=ft(n)/ft(o);!isFinite(a)&&(a=1),e.pinchScale=a;var r=pt(n);return e.pinchX=r[0],e.pinchY=r[1],{type:"pinch",target:t[0].target,event:e}}}}},xw="silent";vt.prototype.dispose=function(){};var _w=["click","dblclick","mousewheel","mouseout","mouseup","mousedown","mousemove","contextmenu"],ww=function(t,e,i,n){fw.call(this),this.storage=t,this.painter=e,this.painterRoot=n,i=i||new vt,this.proxy=null,this._hovered={},this._lastTouchMoment,this._lastX,this._lastY,this._gestureMgr,it.call(this),this.setHandlerProxy(i)};ww.prototype={constructor:ww,setHandlerProxy:function(t){this.proxy&&this.proxy.dispose(),t&&(d(_w,function(e){t.on&&t.on(e,this[e],this)},this),t.handler=this),this.proxy=t},mousemove:function(t){var e=t.zrX,i=t.zrY,n=this._hovered,o=n.target;o&&!o.__zr&&(o=(n=this.findHover(n.x,n.y)).target);var a=this._hovered=this.findHover(e,i),r=a.target,s=this.proxy;s.setCursor&&s.setCursor(r?r.cursor:"default"),o&&r!==o&&this.dispatchToElement(n,"mouseout",t),this.dispatchToElement(a,"mousemove",t),r&&r!==o&&this.dispatchToElement(a,"mouseover",t)},mouseout:function(t){this.dispatchToElement(this._hovered,"mouseout",t);var e,i=t.toElement||t.relatedTarget;do{i=i&&i.parentNode}while(i&&9!==i.nodeType&&!(e=i===this.painterRoot));!e&&this.trigger("globalout",{event:t})},resize:function(t){this._hovered={}},dispatch:function(t,e){var i=this[t];i&&i.call(this,e)},dispose:function(){this.proxy.dispose(),this.storage=this.proxy=this.painter=null},setCursorStyle:function(t){var e=this.proxy;e.setCursor&&e.setCursor(t)},dispatchToElement:function(t,e,i){var n=(t=t||{}).target;if(!n||!n.silent){for(var o="on"+e,a=gt(e,t,i);n&&(n[o]&&(a.cancelBubble=n[o].call(n,a)),n.trigger(e,a),n=n.parent,!a.cancelBubble););a.cancelBubble||(this.trigger(e,a),this.painter&&this.painter.eachOtherLayer(function(t){"function"==typeof t[o]&&t[o].call(t,a),t.trigger&&t.trigger(e,a)}))}},findHover:function(t,e,i){for(var n=this.storage.getDisplayList(),o={x:t,y:e},a=n.length-1;a>=0;a--){var r;if(n[a]!==i&&!n[a].ignore&&(r=yt(n[a],t,e))&&(!o.topTarget&&(o.topTarget=n[a]),r!==xw)){o.target=n[a];break}}return o},processGesture:function(t,e){this._gestureMgr||(this._gestureMgr=new vw);var i=this._gestureMgr;"start"===e&&i.clear();var n=i.recognize(t,this.findHover(t.zrX,t.zrY,null).target,this.proxy.dom);if("end"===e&&i.clear(),n){var o=n.type;t.gestureEvent=o,this.dispatchToElement({target:n.target},o,n.event)}}},d(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(t){ww.prototype[t]=function(e){var i=this.findHover(e.zrX,e.zrY),n=i.target;if("mousedown"===t)this._downEl=n,this._downPoint=[e.zrX,e.zrY],this._upEl=n;else if("mouseup"===t)this._upEl=n;else if("click"===t){if(this._downEl!==this._upEl||!this._downPoint||uw(this._downPoint,[e.zrX,e.zrY])>4)return;this._downPoint=null}this.dispatchToElement(i,t,e)}}),h(ww,fw),h(ww,it);var bw="undefined"==typeof Float32Array?Array:Float32Array,Sw=(Object.freeze||Object)({create:xt,identity:_t,copy:wt,mul:bt,translate:St,rotate:Mt,scale:It,invert:Tt,clone:At}),Mw=_t,Iw=5e-5,Tw=function(t){(t=t||{}).position||(this.position=[0,0]),null==t.rotation&&(this.rotation=0),t.scale||(this.scale=[1,1]),this.origin=this.origin||null},Aw=Tw.prototype;Aw.transform=null,Aw.needLocalTransform=function(){return Dt(this.rotation)||Dt(this.position[0])||Dt(this.position[1])||Dt(this.scale[0]-1)||Dt(this.scale[1]-1)};var Dw=[];Aw.updateTransform=function(){var t=this.parent,e=t&&t.transform,i=this.needLocalTransform(),n=this.transform;if(i||e){n=n||xt(),i?this.getLocalTransform(n):Mw(n),e&&(i?bt(n,t.transform,n):wt(n,t.transform)),this.transform=n;var o=this.globalScaleRatio;if(null!=o&&1!==o){this.getGlobalScale(Dw);var a=Dw[0]<0?-1:1,r=Dw[1]<0?-1:1,s=((Dw[0]-a)*o+a)/Dw[0]||0,l=((Dw[1]-r)*o+r)/Dw[1]||0;n[0]*=s,n[1]*=s,n[2]*=l,n[3]*=l}this.invTransform=this.invTransform||xt(),Tt(this.invTransform,n)}else n&&Mw(n)},Aw.getLocalTransform=function(t){return Tw.getLocalTransform(this,t)},Aw.setTransform=function(t){var e=this.transform,i=t.dpr||1;e?t.setTransform(i*e[0],i*e[1],i*e[2],i*e[3],i*e[4],i*e[5]):t.setTransform(i,0,0,i,0,0)},Aw.restoreTransform=function(t){var e=t.dpr||1;t.setTransform(e,0,0,e,0,0)};var Cw=[],Lw=xt();Aw.setLocalTransform=function(t){if(t){var e=t[0]*t[0]+t[1]*t[1],i=t[2]*t[2]+t[3]*t[3],n=this.position,o=this.scale;Dt(e-1)&&(e=Math.sqrt(e)),Dt(i-1)&&(i=Math.sqrt(i)),t[0]<0&&(e=-e),t[3]<0&&(i=-i),n[0]=t[4],n[1]=t[5],o[0]=e,o[1]=i,this.rotation=Math.atan2(-t[1]/i,t[0]/e)}},Aw.decomposeTransform=function(){if(this.transform){var t=this.parent,e=this.transform;t&&t.transform&&(bt(Cw,t.invTransform,e),e=Cw);var i=this.origin;i&&(i[0]||i[1])&&(Lw[4]=i[0],Lw[5]=i[1],bt(Cw,e,Lw),Cw[4]-=i[0],Cw[5]-=i[1],e=Cw),this.setLocalTransform(e)}},Aw.getGlobalScale=function(t){var e=this.transform;return t=t||[],e?(t[0]=Math.sqrt(e[0]*e[0]+e[1]*e[1]),t[1]=Math.sqrt(e[2]*e[2]+e[3]*e[3]),e[0]<0&&(t[0]=-t[0]),e[3]<0&&(t[1]=-t[1]),t):(t[0]=1,t[1]=1,t)},Aw.transformCoordToLocal=function(t,e){var i=[t,e],n=this.invTransform;return n&&Q(i,i,n),i},Aw.transformCoordToGlobal=function(t,e){var i=[t,e],n=this.transform;return n&&Q(i,i,n),i},Tw.getLocalTransform=function(t,e){Mw(e=e||[]);var i=t.origin,n=t.scale||[1,1],o=t.rotation||0,a=t.position||[0,0];return i&&(e[4]-=i[0],e[5]-=i[1]),It(e,e,n),o&&Mt(e,e,o),i&&(e[4]+=i[0],e[5]+=i[1]),e[4]+=a[0],e[5]+=a[1],e};var kw={linear:function(t){return t},quadraticIn:function(t){return t*t},quadraticOut:function(t){return t*(2-t)},quadraticInOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},cubicIn:function(t){return t*t*t},cubicOut:function(t){return--t*t*t+1},cubicInOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},quarticIn:function(t){return t*t*t*t},quarticOut:function(t){return 1- --t*t*t*t},quarticInOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},quinticIn:function(t){return t*t*t*t*t},quinticOut:function(t){return--t*t*t*t*t+1},quinticInOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},sinusoidalIn:function(t){return 1-Math.cos(t*Math.PI/2)},sinusoidalOut:function(t){return Math.sin(t*Math.PI/2)},sinusoidalInOut:function(t){return.5*(1-Math.cos(Math.PI*t))},exponentialIn:function(t){return 0===t?0:Math.pow(1024,t-1)},exponentialOut:function(t){return 1===t?1:1-Math.pow(2,-10*t)},exponentialInOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))},circularIn:function(t){return 1-Math.sqrt(1-t*t)},circularOut:function(t){return Math.sqrt(1- --t*t)},circularInOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},elasticIn:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),-i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4))},elasticOut:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),i*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/.4)+1)},elasticInOut:function(t){var e,i=.1;return 0===t?0:1===t?1:(!i||i<1?(i=1,e=.1):e=.4*Math.asin(1/i)/(2*Math.PI),(t*=2)<1?i*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4)*-.5:i*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/.4)*.5+1)},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},backInOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)},bounceIn:function(t){return 1-kw.bounceOut(1-t)},bounceOut:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},bounceInOut:function(t){return t<.5?.5*kw.bounceIn(2*t):.5*kw.bounceOut(2*t-1)+.5}};Ct.prototype={constructor:Ct,step:function(t,e){if(this._initialized||(this._startTime=t+this._delay,this._initialized=!0),this._paused)this._pausedTime+=e;else{var i=(t-this._startTime-this._pausedTime)/this._life;if(!(i<0)){i=Math.min(i,1);var n=this.easing,o="string"==typeof n?kw[n]:n,a="function"==typeof o?o(i):i;return this.fire("frame",a),1===i?this.loop?(this.restart(t),"restart"):(this._needsRemove=!0,"destroy"):null}}},restart:function(t){var e=(t-this._startTime-this._pausedTime)%this._life;this._startTime=t-e+this.gap,this._pausedTime=0,this._needsRemove=!1},fire:function(t,e){this[t="on"+t]&&this[t](this._target,e)},pause:function(){this._paused=!0},resume:function(){this._paused=!1}};var Pw=function(){this.head=null,this.tail=null,this._len=0},Nw=Pw.prototype;Nw.insert=function(t){var e=new Ow(t);return this.insertEntry(e),e},Nw.insertEntry=function(t){this.head?(this.tail.next=t,t.prev=this.tail,t.next=null,this.tail=t):this.head=this.tail=t,this._len++},Nw.remove=function(t){var e=t.prev,i=t.next;e?e.next=i:this.head=i,i?i.prev=e:this.tail=e,t.next=t.prev=null,this._len--},Nw.len=function(){return this._len},Nw.clear=function(){this.head=this.tail=null,this._len=0};var Ow=function(t){this.value=t,this.next,this.prev},Ew=function(t){this._list=new Pw,this._map={},this._maxSize=t||10,this._lastRemovedEntry=null},Rw=Ew.prototype;Rw.put=function(t,e){var i=this._list,n=this._map,o=null;if(null==n[t]){var a=i.len(),r=this._lastRemovedEntry;if(a>=this._maxSize&&a>0){var s=i.head;i.remove(s),delete n[s.key],o=s.value,this._lastRemovedEntry=s}r?r.value=e:r=new Ow(e),r.key=t,i.insertEntry(r),n[t]=r}return o},Rw.get=function(t){var e=this._map[t],i=this._list;if(null!=e)return e!==i.tail&&(i.remove(e),i.insertEntry(e)),e.value},Rw.clear=function(){this._list.clear(),this._map={}};var zw={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]},Bw=new Ew(20),Vw=null,Gw=Ut,Fw=Xt,Ww=(Object.freeze||Object)({parse:Gt,lift:Ht,toHex:Zt,fastLerp:Ut,fastMapToColor:Gw,lerp:Xt,mapToColor:Fw,modifyHSL:jt,modifyAlpha:Yt,stringify:qt}),Hw=Array.prototype.slice,Zw=function(t,e,i,n){this._tracks={},this._target=t,this._loop=e||!1,this._getter=i||Kt,this._setter=n||$t,this._clipCount=0,this._delay=0,this._doneList=[],this._onframeList=[],this._clipList=[]};Zw.prototype={when:function(t,e){var i=this._tracks;for(var n in e)if(e.hasOwnProperty(n)){if(!i[n]){i[n]=[];var o=this._getter(this._target,n);if(null==o)continue;0!==t&&i[n].push({time:0,value:ae(o)})}i[n].push({time:t,value:e[n]})}return this},during:function(t){return this._onframeList.push(t),this},pause:function(){for(var t=0;t=i.x&&t<=i.x+i.width&&e>=i.y&&e<=i.y+i.height},clone:function(){return new de(this.x,this.y,this.width,this.height)},copy:function(t){this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height},plain:function(){return{x:this.x,y:this.y,width:this.width,height:this.height}}},de.create=function(t){return new de(t.x,t.y,t.width,t.height)};var tb=function(t){t=t||{},Kw.call(this,t);for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);this._children=[],this.__storage=null,this.__dirty=!0};tb.prototype={constructor:tb,isGroup:!0,type:"group",silent:!1,children:function(){return this._children.slice()},childAt:function(t){return this._children[t]},childOfName:function(t){for(var e=this._children,i=0;i=0&&(i.splice(n,0,t),this._doAdd(t))}return this},_doAdd:function(t){t.parent&&t.parent.remove(t),t.parent=this;var e=this.__storage,i=this.__zr;e&&e!==t.__storage&&(e.addToStorage(t),t instanceof tb&&t.addChildrenToStorage(e)),i&&i.refresh()},remove:function(t){var e=this.__zr,i=this.__storage,n=this._children,o=l(n,t);return o<0?this:(n.splice(o,1),t.parent=null,i&&(i.delFromStorage(t),t instanceof tb&&t.delChildrenFromStorage(i)),e&&e.refresh(),this)},removeAll:function(){var t,e,i=this._children,n=this.__storage;for(e=0;e=0&&(this.delFromStorage(t),this._roots.splice(o,1),t instanceof tb&&t.delChildrenFromStorage(this))}},addToStorage:function(t){return t&&(t.__storage=this,t.dirty(!1)),this},delFromStorage:function(t){return t&&(t.__storage=null),this},dispose:function(){this._renderList=this._roots=null},displayableSortFunc:we};var ob={shadowBlur:1,shadowOffsetX:1,shadowOffsetY:1,textShadowBlur:1,textShadowOffsetX:1,textShadowOffsetY:1,textBoxShadowBlur:1,textBoxShadowOffsetX:1,textBoxShadowOffsetY:1},ab=function(t,e,i){return ob.hasOwnProperty(e)?i*=t.dpr:i},rb={NONE:0,STYLE_BIND:1,PLAIN_TEXT:2},sb=9,lb=[["shadowBlur",0],["shadowOffsetX",0],["shadowOffsetY",0],["shadowColor","#000"],["lineCap","butt"],["lineJoin","miter"],["miterLimit",10]],ub=function(t){this.extendFrom(t,!1)};ub.prototype={constructor:ub,fill:"#000",stroke:null,opacity:1,fillOpacity:null,strokeOpacity:null,lineDash:null,lineDashOffset:0,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,lineWidth:1,strokeNoScale:!1,text:null,font:null,textFont:null,fontStyle:null,fontWeight:null,fontSize:null,fontFamily:null,textTag:null,textFill:"#000",textStroke:null,textWidth:null,textHeight:null,textStrokeWidth:0,textLineHeight:null,textPosition:"inside",textRect:null,textOffset:null,textAlign:null,textVerticalAlign:null,textDistance:5,textShadowColor:"transparent",textShadowBlur:0,textShadowOffsetX:0,textShadowOffsetY:0,textBoxShadowColor:"transparent",textBoxShadowBlur:0,textBoxShadowOffsetX:0,textBoxShadowOffsetY:0,transformText:!1,textRotation:0,textOrigin:null,textBackgroundColor:null,textBorderColor:null,textBorderWidth:0,textBorderRadius:0,textPadding:null,rich:null,truncate:null,blend:null,bind:function(t,e,i){var n=this,o=i&&i.style,a=!o||t.__attrCachedBy!==rb.STYLE_BIND;t.__attrCachedBy=rb.STYLE_BIND;for(var r=0;r0},extendFrom:function(t,e){if(t)for(var i in t)!t.hasOwnProperty(i)||!0!==e&&(!1===e?this.hasOwnProperty(i):null==t[i])||(this[i]=t[i])},set:function(t,e){"string"==typeof t?this[t]=e:this.extendFrom(t,!0)},clone:function(){var t=new this.constructor;return t.extendFrom(this,!0),t},getGradient:function(t,e,i){for(var n=("radial"===e.type?Se:be)(t,e,i),o=e.colorStops,a=0;a=0&&i.splice(n,1),t.__hoverMir=null},clearHover:function(t){for(var e=this._hoverElements,i=0;i15)break}s.__drawIndex=m,s.__drawIndex0&&t>n[0]){for(r=0;rt);r++);a=i[n[r]]}if(n.splice(r+1,0,t),i[t]=e,!e.virtual)if(a){var l=a.dom;l.nextSibling?s.insertBefore(e.dom,l.nextSibling):s.appendChild(e.dom)}else s.firstChild?s.insertBefore(e.dom,s.firstChild):s.appendChild(e.dom)}else Yw("Layer of zlevel "+t+" is not valid")},eachLayer:function(t,e){var i,n,o=this._zlevelList;for(n=0;n0?.01:0),this._needsManuallyCompositing),a.__builtin__||Yw("ZLevel "+s+" has been used by unkown layer "+a.id),a!==i&&(a.__used=!0,a.__startIndex!==o&&(a.__dirty=!0),a.__startIndex=o,a.incremental?a.__drawIndex=-1:a.__drawIndex=o,e(o),i=a),r.__dirty&&(a.__dirty=!0,a.incremental&&a.__drawIndex<0&&(a.__drawIndex=o))}e(o),this.eachBuiltinLayer(function(t,e){!t.__used&&t.getElementCount()>0&&(t.__dirty=!0,t.__startIndex=t.__endIndex=t.__drawIndex=0),t.__dirty&&t.__drawIndex<0&&(t.__drawIndex=t.__startIndex)})},clear:function(){return this.eachBuiltinLayer(this._clearLayer),this},_clearLayer:function(t){t.clear()},setBackgroundColor:function(t){this._backgroundColor=t},configLayer:function(t,e){if(e){var i=this._layerConfig;i[t]?n(i[t],e,!0):i[t]=e;for(var o=0;o=0&&this._clips.splice(e,1)},removeAnimator:function(t){for(var e=t.getClips(),i=0;i=0||n&&l(n,r)<0)){var s=e.getShallow(r);null!=s&&(o[t[a][0]]=s)}}return o}},tS=Qb([["lineWidth","width"],["stroke","color"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]),eS={getLineStyle:function(t){var e=tS(this,t),i=this.getLineDash(e.lineWidth);return i&&(e.lineDash=i),e},getLineDash:function(t){null==t&&(t=1);var e=this.get("type"),i=Math.max(t,2),n=4*t;return"solid"===e||null==e?null:"dashed"===e?[n,n]:[i,i]}},iS=Qb([["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]]),nS={getAreaStyle:function(t,e){return iS(this,t,e)}},oS=Math.pow,aS=Math.sqrt,rS=1e-8,sS=1e-4,lS=aS(3),uS=1/3,hS=V(),cS=V(),dS=V(),fS=Math.min,pS=Math.max,gS=Math.sin,mS=Math.cos,vS=2*Math.PI,yS=V(),xS=V(),_S=V(),wS=[],bS=[],SS={M:1,L:2,C:3,Q:4,A:5,Z:6,R:7},MS=[],IS=[],TS=[],AS=[],DS=Math.min,CS=Math.max,LS=Math.cos,kS=Math.sin,PS=Math.sqrt,NS=Math.abs,OS="undefined"!=typeof Float32Array,ES=function(t){this._saveData=!t,this._saveData&&(this.data=[]),this._ctx=null};ES.prototype={constructor:ES,_xi:0,_yi:0,_x0:0,_y0:0,_ux:0,_uy:0,_len:0,_lineDash:null,_dashOffset:0,_dashIdx:0,_dashSum:0,setScale:function(t,e){this._ux=NS(1/Xw/t)||0,this._uy=NS(1/Xw/e)||0},getContext:function(){return this._ctx},beginPath:function(t){return this._ctx=t,t&&t.beginPath(),t&&(this.dpr=t.dpr),this._saveData&&(this._len=0),this._lineDash&&(this._lineDash=null,this._dashOffset=0),this},moveTo:function(t,e){return this.addData(SS.M,t,e),this._ctx&&this._ctx.moveTo(t,e),this._x0=t,this._y0=e,this._xi=t,this._yi=e,this},lineTo:function(t,e){var i=NS(t-this._xi)>this._ux||NS(e-this._yi)>this._uy||this._len<5;return this.addData(SS.L,t,e),this._ctx&&i&&(this._needsDash()?this._dashedLineTo(t,e):this._ctx.lineTo(t,e)),i&&(this._xi=t,this._yi=e),this},bezierCurveTo:function(t,e,i,n,o,a){return this.addData(SS.C,t,e,i,n,o,a),this._ctx&&(this._needsDash()?this._dashedBezierTo(t,e,i,n,o,a):this._ctx.bezierCurveTo(t,e,i,n,o,a)),this._xi=o,this._yi=a,this},quadraticCurveTo:function(t,e,i,n){return this.addData(SS.Q,t,e,i,n),this._ctx&&(this._needsDash()?this._dashedQuadraticTo(t,e,i,n):this._ctx.quadraticCurveTo(t,e,i,n)),this._xi=i,this._yi=n,this},arc:function(t,e,i,n,o,a){return this.addData(SS.A,t,e,i,i,n,o-n,0,a?0:1),this._ctx&&this._ctx.arc(t,e,i,n,o,a),this._xi=LS(o)*i+t,this._yi=kS(o)*i+e,this},arcTo:function(t,e,i,n,o){return this._ctx&&this._ctx.arcTo(t,e,i,n,o),this},rect:function(t,e,i,n){return this._ctx&&this._ctx.rect(t,e,i,n),this.addData(SS.R,t,e,i,n),this},closePath:function(){this.addData(SS.Z);var t=this._ctx,e=this._x0,i=this._y0;return t&&(this._needsDash()&&this._dashedLineTo(e,i),t.closePath()),this._xi=e,this._yi=i,this},fill:function(t){t&&t.fill(),this.toStatic()},stroke:function(t){t&&t.stroke(),this.toStatic()},setLineDash:function(t){if(t instanceof Array){this._lineDash=t,this._dashIdx=0;for(var e=0,i=0;ie.length&&(this._expandData(),e=this.data);for(var i=0;i0&&f<=t||h<0&&f>=t||0===h&&(c>0&&p<=e||c<0&&p>=e);)f+=h*(i=r[n=this._dashIdx]),p+=c*i,this._dashIdx=(n+1)%g,h>0&&fl||c>0&&pu||s[n%2?"moveTo":"lineTo"](h>=0?DS(f,t):CS(f,t),c>=0?DS(p,e):CS(p,e));h=f-t,c=p-e,this._dashOffset=-PS(h*h+c*c)},_dashedBezierTo:function(t,e,i,n,o,a){var r,s,l,u,h,c=this._dashSum,d=this._dashOffset,f=this._lineDash,p=this._ctx,g=this._xi,m=this._yi,v=tn,y=0,x=this._dashIdx,_=f.length,w=0;for(d<0&&(d=c+d),d%=c,r=0;r<1;r+=.1)s=v(g,t,i,o,r+.1)-v(g,t,i,o,r),l=v(m,e,n,a,r+.1)-v(m,e,n,a,r),y+=PS(s*s+l*l);for(;x<_&&!((w+=f[x])>d);x++);for(r=(w-d)/y;r<=1;)u=v(g,t,i,o,r),h=v(m,e,n,a,r),x%2?p.moveTo(u,h):p.lineTo(u,h),r+=f[x]/y,x=(x+1)%_;x%2!=0&&p.lineTo(o,a),s=o-u,l=a-h,this._dashOffset=-PS(s*s+l*l)},_dashedQuadraticTo:function(t,e,i,n){var o=i,a=n;i=(i+2*t)/3,n=(n+2*e)/3,t=(this._xi+2*t)/3,e=(this._yi+2*e)/3,this._dashedBezierTo(t,e,i,n,o,a)},toStatic:function(){var t=this.data;t instanceof Array&&(t.length=this._len,OS&&(this.data=new Float32Array(t)))},getBoundingRect:function(){MS[0]=MS[1]=TS[0]=TS[1]=Number.MAX_VALUE,IS[0]=IS[1]=AS[0]=AS[1]=-Number.MAX_VALUE;for(var t=this.data,e=0,i=0,n=0,o=0,a=0;al||NS(r-o)>u||c===h-1)&&(t.lineTo(a,r),n=a,o=r);break;case SS.C:t.bezierCurveTo(s[c++],s[c++],s[c++],s[c++],s[c++],s[c++]),n=s[c-2],o=s[c-1];break;case SS.Q:t.quadraticCurveTo(s[c++],s[c++],s[c++],s[c++]),n=s[c-2],o=s[c-1];break;case SS.A:var f=s[c++],p=s[c++],g=s[c++],m=s[c++],v=s[c++],y=s[c++],x=s[c++],_=s[c++],w=g>m?g:m,b=g>m?1:g/m,S=g>m?m/g:1,M=v+y;Math.abs(g-m)>.001?(t.translate(f,p),t.rotate(x),t.scale(b,S),t.arc(0,0,w,v,M,1-_),t.scale(1/b,1/S),t.rotate(-x),t.translate(-f,-p)):t.arc(f,p,w,v,M,1-_),1===c&&(e=LS(v)*g+f,i=kS(v)*m+p),n=LS(M)*g+f,o=kS(M)*m+p;break;case SS.R:e=n=s[c],i=o=s[c+1],t.rect(s[c++],s[c++],s[c++],s[c++]);break;case SS.Z:t.closePath(),n=e,o=i}}}},ES.CMD=SS;var RS=2*Math.PI,zS=2*Math.PI,BS=ES.CMD,VS=2*Math.PI,GS=1e-4,FS=[-1,-1,-1],WS=[-1,-1],HS=fb.prototype.getCanvasPattern,ZS=Math.abs,US=new ES(!0);Pn.prototype={constructor:Pn,type:"path",__dirtyPath:!0,strokeContainThreshold:5,subPixelOptimize:!1,brush:function(t,e){var i=this.style,n=this.path||US,o=i.hasStroke(),a=i.hasFill(),r=i.fill,s=i.stroke,l=a&&!!r.colorStops,u=o&&!!s.colorStops,h=a&&!!r.image,c=o&&!!s.image;if(i.bind(t,this,e),this.setTransform(t),this.__dirty){var d;l&&(d=d||this.getBoundingRect(),this._fillGradient=i.getGradient(t,r,d)),u&&(d=d||this.getBoundingRect(),this._strokeGradient=i.getGradient(t,s,d))}l?t.fillStyle=this._fillGradient:h&&(t.fillStyle=HS.call(r,t)),u?t.strokeStyle=this._strokeGradient:c&&(t.strokeStyle=HS.call(s,t));var f=i.lineDash,p=i.lineDashOffset,g=!!t.setLineDash,m=this.getGlobalScale();if(n.setScale(m[0],m[1]),this.__dirtyPath||f&&!g&&o?(n.beginPath(t),f&&!g&&(n.setLineDash(f),n.setLineDashOffset(p)),this.buildPath(n,this.shape,!1),this.path&&(this.__dirtyPath=!1)):(t.beginPath(),this.path.rebuildPath(t)),a)if(null!=i.fillOpacity){v=t.globalAlpha;t.globalAlpha=i.fillOpacity*i.opacity,n.fill(t),t.globalAlpha=v}else n.fill(t);if(f&&g&&(t.setLineDash(f),t.lineDashOffset=p),o)if(null!=i.strokeOpacity){var v=t.globalAlpha;t.globalAlpha=i.strokeOpacity*i.opacity,n.stroke(t),t.globalAlpha=v}else n.stroke(t);f&&g&&t.setLineDash([]),null!=i.text&&(this.restoreTransform(t),this.drawRectText(t,this.getBoundingRect()))},buildPath:function(t,e,i){},createPathProxy:function(){this.path=new ES},getBoundingRect:function(){var t=this._rect,e=this.style,i=!t;if(i){var n=this.path;n||(n=this.path=new ES),this.__dirtyPath&&(n.beginPath(),this.buildPath(n,this.shape,!1)),t=n.getBoundingRect()}if(this._rect=t,e.hasStroke()){var o=this._rectWithStroke||(this._rectWithStroke=t.clone());if(this.__dirty||i){o.copy(t);var a=e.lineWidth,r=e.strokeNoScale?this.getLineScale():1;e.hasFill()||(a=Math.max(a,this.strokeContainThreshold||4)),r>1e-10&&(o.width+=a/r,o.height+=a/r,o.x-=a/r/2,o.y-=a/r/2)}return o}return t},contain:function(t,e){var i=this.transformCoordToLocal(t,e),n=this.getBoundingRect(),o=this.style;if(t=i[0],e=i[1],n.contain(t,e)){var a=this.path.data;if(o.hasStroke()){var r=o.lineWidth,s=o.strokeNoScale?this.getLineScale():1;if(s>1e-10&&(o.hasFill()||(r=Math.max(r,this.strokeContainThreshold)),kn(a,r/s,t,e)))return!0}if(o.hasFill())return Ln(a,t,e)}return!1},dirty:function(t){null==t&&(t=!0),t&&(this.__dirtyPath=t,this._rect=null),this.__dirty=this.__dirtyText=!0,this.__zr&&this.__zr.refresh(),this.__clipTarget&&this.__clipTarget.dirty()},animateShape:function(t){return this.animate("shape",t)},attrKV:function(t,e){"shape"===t?(this.setShape(e),this.__dirtyPath=!0,this._rect=null):di.prototype.attrKV.call(this,t,e)},setShape:function(t,e){var i=this.shape;if(i){if(w(t))for(var n in t)t.hasOwnProperty(n)&&(i[n]=t[n]);else i[t]=e;this.dirty(!0)}return this},getLineScale:function(){var t=this.transform;return t&&ZS(t[0]-1)>1e-10&&ZS(t[3]-1)>1e-10?Math.sqrt(ZS(t[0]*t[3]-t[2]*t[1])):1}},Pn.extend=function(t){var e=function(e){Pn.call(this,e),t.style&&this.style.extendFrom(t.style,!1);var i=t.shape;if(i){this.shape=this.shape||{};var n=this.shape;for(var o in i)!n.hasOwnProperty(o)&&i.hasOwnProperty(o)&&(n[o]=i[o])}t.init&&t.init.call(this,e)};u(e,Pn);for(var i in t)"style"!==i&&"shape"!==i&&(e.prototype[i]=t[i]);return e},u(Pn,di);var XS=ES.CMD,jS=[[],[],[]],YS=Math.sqrt,qS=Math.atan2,KS=function(t,e){var i,n,o,a,r,s,l=t.data,u=XS.M,h=XS.C,c=XS.L,d=XS.R,f=XS.A,p=XS.Q;for(o=0,a=0;o=11?function(){var e,i=this.__clipPaths,n=this.style;if(i)for(var o=0;oi-2?i-1:c+1],u=t[c>i-3?i-1:c+2]);var p=d*d,g=d*p;n.push([Bn(s[0],f[0],l[0],u[0],d,p,g),Bn(s[1],f[1],l[1],u[1],d,p,g)])}return n},fM=function(t,e,i,n){var o,a,r,s,l=[],u=[],h=[],c=[];if(n){r=[1/0,1/0],s=[-1/0,-1/0];for(var d=0,f=t.length;d=i&&a>=o)return{x:i,y:o,width:n-i,height:a-o}},createIcon:Po,Group:tb,Image:fi,Text:rM,Circle:sM,Sector:hM,Ring:cM,Polygon:pM,Polyline:gM,Rect:yM,Line:_M,BezierCurve:bM,Arc:SM,IncrementalDisplayable:Zn,CompoundPath:MM,LinearGradient:TM,RadialGradient:AM,BoundingRect:de}),BM=["textStyle","color"],VM={getTextColor:function(t){var e=this.ecModel;return this.getShallow("color")||(!t&&e?e.get(BM):null)},getFont:function(){return So({fontStyle:this.getShallow("fontStyle"),fontWeight:this.getShallow("fontWeight"),fontSize:this.getShallow("fontSize"),fontFamily:this.getShallow("fontFamily")},this.ecModel)},getTextRect:function(t){return ke(t,this.getFont(),this.getShallow("align"),this.getShallow("verticalAlign")||this.getShallow("baseline"),this.getShallow("padding"),this.getShallow("lineHeight"),this.getShallow("rich"),this.getShallow("truncateText"))}},GM=Qb([["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"],["textPosition"],["textAlign"]]),FM={getItemStyle:function(t,e){var i=GM(this,t,e),n=this.getBorderLineDash();return n&&(i.lineDash=n),i},getBorderLineDash:function(){var t=this.get("borderType");return"solid"===t||null==t?null:"dashed"===t?[5,5]:[1,1]}},WM=h,HM=Bi();No.prototype={constructor:No,init:null,mergeOption:function(t){n(this.option,t,!0)},get:function(t,e){return null==t?this.option:Oo(this.option,this.parsePath(t),!e&&Eo(this,t))},getShallow:function(t,e){var i=this.option,n=null==i?i:i[t],o=!e&&Eo(this,t);return null==n&&o&&(n=o.getShallow(t)),n},getModel:function(t,e){var i,n=null==t?this.option:Oo(this.option,t=this.parsePath(t));return e=e||(i=Eo(this,t))&&i.getModel(t),new No(n,e,this.ecModel)},isEmpty:function(){return null==this.option},restoreData:function(){},clone:function(){return new(0,this.constructor)(i(this.option))},setReadOnly:function(t){},parsePath:function(t){return"string"==typeof t&&(t=t.split(".")),t},customizeGetParent:function(t){HM(this).getParent=t},isAnimationEnabled:function(){if(!U_.node){if(null!=this.option.animation)return!!this.option.animation;if(this.parentModel)return this.parentModel.isAnimationEnabled()}}},ji(No),Yi(No),WM(No,eS),WM(No,nS),WM(No,VM),WM(No,FM);var ZM=0,UM=1e-4,XM=9007199254740991,jM=/^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d\d)(?::(\d\d)(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/,YM=(Object.freeze||Object)({linearMap:Bo,parsePercent:Vo,round:Go,asc:Fo,getPrecision:Wo,getPrecisionSafe:Ho,getPixelPrecision:Zo,getPercentWithPrecision:Uo,MAX_SAFE_INTEGER:XM,remRadian:Xo,isRadianAroundZero:jo,parseDate:Yo,quantity:qo,nice:$o,quantile:function(t,e){var i=(t.length-1)*e+1,n=Math.floor(i),o=+t[n-1],a=i-n;return a?o+a*(t[n]-o):o},reformIntervals:Jo,isNumeric:Qo}),qM=L,KM=/([&<>"'])/g,$M={"&":"&","<":"<",">":">",'"':""","'":"'"},JM=["a","b","c","d","e","f","g"],QM=function(t,e){return"{"+t+(null==e?"":e)+"}"},tI=ze,eI=(Object.freeze||Object)({addCommas:ta,toCamelCase:ea,normalizeCssArray:qM,encodeHTML:ia,formatTpl:na,formatTplSimple:oa,getTooltipMarker:aa,formatTime:sa,capitalFirst:la,truncateText:tI,getTextBoundingRect:function(t){return ke(t.text,t.font,t.textAlign,t.textVerticalAlign,t.textPadding,t.textLineHeight,t.rich,t.truncate)},getTextRect:function(t,e,i,n,o,a,r,s){return ke(t,e,i,n,o,s,a,r)}}),iI=d,nI=["left","right","top","bottom","width","height"],oI=[["width","left","right"],["height","top","bottom"]],aI=ua,rI=(v(ua,"vertical"),v(ua,"horizontal"),{getBoxLayoutParams:function(){return{left:this.get("left"),top:this.get("top"),right:this.get("right"),bottom:this.get("bottom"),width:this.get("width"),height:this.get("height")}}}),sI=Bi(),lI=No.extend({type:"component",id:"",name:"",mainType:"",subType:"",componentIndex:0,defaultOption:null,ecModel:null,dependentModels:[],uid:null,layoutMode:null,$constructor:function(t,e,i,n){No.call(this,t,e,i,n),this.uid=Ro("ec_cpt_model")},init:function(t,e,i,n){this.mergeDefaultAndTheme(t,i)},mergeDefaultAndTheme:function(t,e){var i=this.layoutMode,o=i?ga(t):{};n(t,e.getTheme().get(this.mainType)),n(t,this.getDefaultOption()),i&&pa(t,o,i)},mergeOption:function(t,e){n(this.option,t,!0);var i=this.layoutMode;i&&pa(this.option,t,i)},optionUpdated:function(t,e){},getDefaultOption:function(){var t=sI(this);if(!t.defaultOption){for(var e=[],i=this.constructor;i;){var o=i.prototype.defaultOption;o&&e.push(o),i=i.superClass}for(var a={},r=e.length-1;r>=0;r--)a=n(a,e[r],!0);t.defaultOption=a}return t.defaultOption},getReferringComponents:function(t){return this.ecModel.queryComponents({mainType:t,index:this.get(t+"Index",!0),id:this.get(t+"Id",!0)})}});$i(lI,{registerWhenExtend:!0}),function(t){var e={};t.registerSubTypeDefaulter=function(t,i){t=Ui(t),e[t.main]=i},t.determineSubType=function(i,n){var o=n.type;if(!o){var a=Ui(i).main;t.hasSubTypes(i)&&e[a]&&(o=e[a](n))}return o}}(lI),function(t,e){function i(t){var i={},a=[];return d(t,function(r){var s=n(i,r),u=o(s.originalDeps=e(r),t);s.entryCount=u.length,0===s.entryCount&&a.push(r),d(u,function(t){l(s.predecessor,t)<0&&s.predecessor.push(t);var e=n(i,t);l(e.successor,t)<0&&e.successor.push(r)})}),{graph:i,noEntryList:a}}function n(t,e){return t[e]||(t[e]={predecessor:[],successor:[]}),t[e]}function o(t,e){var i=[];return d(t,function(t){l(e,t)>=0&&i.push(t)}),i}t.topologicalTravel=function(t,e,n,o){function a(t){s[t].entryCount--,0===s[t].entryCount&&l.push(t)}if(t.length){var r=i(e),s=r.graph,l=r.noEntryList,u={};for(d(t,function(t){u[t]=!0});l.length;){var h=l.pop(),c=s[h],f=!!u[h];f&&(n.call(o,h,c.originalDeps.slice()),delete u[h]),d(c.successor,f?function(t){u[t]=!0,a(t)}:a)}d(u,function(){throw new Error("Circle dependency may exists")})}}}(lI,function(t){var e=[];return d(lI.getClassesByMainType(t),function(t){e=e.concat(t.prototype.dependencies||[])}),e=f(e,function(t){return Ui(t).main}),"dataset"!==t&&l(e,"dataset")<=0&&e.unshift("dataset"),e}),h(lI,rI);var uI="";"undefined"!=typeof navigator&&(uI=navigator.platform||"");var hI={color:["#c23531","#2f4554","#61a0a8","#d48265","#91c7ae","#749f83","#ca8622","#bda29a","#6e7074","#546570","#c4ccd3"],gradientColor:["#f6efa6","#d88273","#bf444c"],textStyle:{fontFamily:uI.match(/^Win/)?"Microsoft YaHei":"sans-serif",fontSize:12,fontStyle:"normal",fontWeight:"normal"},blendMode:null,animation:"auto",animationDuration:1e3,animationDurationUpdate:300,animationEasing:"exponentialOut",animationEasingUpdate:"cubicOut",animationThreshold:2e3,progressiveThreshold:3e3,progressive:400,hoverLayerThreshold:3e3,useUTC:!1},cI=Bi(),dI={clearColorPalette:function(){cI(this).colorIdx=0,cI(this).colorNameMap={}},getColorFromPalette:function(t,e,i){var n=cI(e=e||this),o=n.colorIdx||0,a=n.colorNameMap=n.colorNameMap||{};if(a.hasOwnProperty(t))return a[t];var r=Di(this.get("color",!0)),s=this.get("colorLayer",!0),l=null!=i&&s?va(s,i):r;if((l=l||r)&&l.length){var u=l[o];return t&&(a[t]=u),n.colorIdx=(o+1)%l.length,u}}},fI={cartesian2d:function(t,e,i,n){var o=t.getReferringComponents("xAxis")[0],a=t.getReferringComponents("yAxis")[0];e.coordSysDims=["x","y"],i.set("x",o),i.set("y",a),xa(o)&&(n.set("x",o),e.firstCategoryDimIndex=0),xa(a)&&(n.set("y",a),e.firstCategoryDimIndex=1)},singleAxis:function(t,e,i,n){var o=t.getReferringComponents("singleAxis")[0];e.coordSysDims=["single"],i.set("single",o),xa(o)&&(n.set("single",o),e.firstCategoryDimIndex=0)},polar:function(t,e,i,n){var o=t.getReferringComponents("polar")[0],a=o.findAxisModel("radiusAxis"),r=o.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],i.set("radius",a),i.set("angle",r),xa(a)&&(n.set("radius",a),e.firstCategoryDimIndex=0),xa(r)&&(n.set("angle",r),e.firstCategoryDimIndex=1)},geo:function(t,e,i,n){e.coordSysDims=["lng","lat"]},parallel:function(t,e,i,n){var o=t.ecModel,a=o.getComponent("parallel",t.get("parallelIndex")),r=e.coordSysDims=a.dimensions.slice();d(a.parallelAxisIndex,function(t,a){var s=o.getComponent("parallelAxis",t),l=r[a];i.set(l,s),xa(s)&&null==e.firstCategoryDimIndex&&(n.set(l,s),e.firstCategoryDimIndex=a)})}},pI="original",gI="arrayRows",mI="objectRows",vI="keyedColumns",yI="unknown",xI="typedArray",_I="column",wI="row";_a.seriesDataToSource=function(t){return new _a({data:t,sourceFormat:S(t)?xI:pI,fromDataset:!1})},Yi(_a);var bI=Bi(),SI="\0_ec_inner",MI=No.extend({init:function(t,e,i,n){i=i||{},this.option=null,this._theme=new No(i),this._optionManager=n},setOption:function(t,e){k(!(SI in t),"please use chart.getOption()"),this._optionManager.setOption(t,e),this.resetOption(null)},resetOption:function(t){var e=!1,i=this._optionManager;if(!t||"recreate"===t){var n=i.mountOption("recreate"===t);this.option&&"recreate"!==t?(this.restoreData(),this.mergeOption(n)):Ea.call(this,n),e=!0}if("timeline"!==t&&"media"!==t||this.restoreData(),!t||"recreate"===t||"timeline"===t){var o=i.getTimelineOption(this);o&&(this.mergeOption(o),e=!0)}if(!t||"recreate"===t||"media"===t){var a=i.getMediaOption(this,this._api);a.length&&d(a,function(t){this.mergeOption(t,e=!0)},this)}return e},mergeOption:function(t){var e=this.option,o=this._componentsMap,r=[];Sa(this),d(t,function(t,o){null!=t&&(lI.hasClass(o)?o&&r.push(o):e[o]=null==e[o]?i(t):n(e[o],t,!0))}),lI.topologicalTravel(r,lI.getAllClassMainTypes(),function(i,n){var r=Di(t[i]),s=Pi(o.get(i),r);Ni(s),d(s,function(t,e){var n=t.option;w(n)&&(t.keyInfo.mainType=i,t.keyInfo.subType=za(i,n,t.exist))});var l=Ra(o,n);e[i]=[],o.set(i,[]),d(s,function(t,n){var r=t.exist,s=t.option;if(k(w(s)||r,"Empty component definition"),s){var u=lI.getClass(i,t.keyInfo.subType,!0);if(r&&r instanceof u)r.name=t.keyInfo.name,r.mergeOption(s,this),r.optionUpdated(s,!1);else{var h=a({dependentModels:l,componentIndex:n},t.keyInfo);a(r=new u(s,this,this,h),h),r.init(s,this,this,h),r.optionUpdated(null,!0)}}else r.mergeOption({},this),r.optionUpdated({},!1);o.get(i)[n]=r,e[i][n]=r.option},this),"series"===i&&Ba(this,o.get("series"))},this),this._seriesIndicesMap=R(this._seriesIndices=this._seriesIndices||[])},getOption:function(){var t=i(this.option);return d(t,function(e,i){if(lI.hasClass(i)){for(var n=(e=Di(e)).length-1;n>=0;n--)Ei(e[n])&&e.splice(n,1);t[i]=e}}),delete t[SI],t},getTheme:function(){return this._theme},getComponent:function(t,e){var i=this._componentsMap.get(t);if(i)return i[e||0]},queryComponents:function(t){var e=t.mainType;if(!e)return[];var i=t.index,n=t.id,o=t.name,a=this._componentsMap.get(e);if(!a||!a.length)return[];var r;if(null!=i)y(i)||(i=[i]),r=g(f(i,function(t){return a[t]}),function(t){return!!t});else if(null!=n){var s=y(n);r=g(a,function(t){return s&&l(n,t.id)>=0||!s&&t.id===n})}else if(null!=o){var u=y(o);r=g(a,function(t){return u&&l(o,t.name)>=0||!u&&t.name===o})}else r=a.slice();return Va(r,t)},findComponents:function(t){var e=t.query,i=t.mainType,n=function(t){var e=i+"Index",n=i+"Id",o=i+"Name";return!t||null==t[e]&&null==t[n]&&null==t[o]?null:{mainType:i,index:t[e],id:t[n],name:t[o]}}(e);return function(e){return t.filter?g(e,t.filter):e}(Va(n?this.queryComponents(n):this._componentsMap.get(i),t))},eachComponent:function(t,e,i){var n=this._componentsMap;"function"==typeof t?(i=e,e=t,n.each(function(t,n){d(t,function(t,o){e.call(i,n,t,o)})})):_(t)?d(n.get(t),e,i):w(t)&&d(this.findComponents(t),e,i)},getSeriesByName:function(t){return g(this._componentsMap.get("series"),function(e){return e.name===t})},getSeriesByIndex:function(t){return this._componentsMap.get("series")[t]},getSeriesByType:function(t){return g(this._componentsMap.get("series"),function(e){return e.subType===t})},getSeries:function(){return this._componentsMap.get("series").slice()},getSeriesCount:function(){return this._componentsMap.get("series").length},eachSeries:function(t,e){d(this._seriesIndices,function(i){var n=this._componentsMap.get("series")[i];t.call(e,n,i)},this)},eachRawSeries:function(t,e){d(this._componentsMap.get("series"),t,e)},eachSeriesByType:function(t,e,i){d(this._seriesIndices,function(n){var o=this._componentsMap.get("series")[n];o.subType===t&&e.call(i,o,n)},this)},eachRawSeriesByType:function(t,e,i){return d(this.getSeriesByType(t),e,i)},isSeriesFiltered:function(t){return null==this._seriesIndicesMap.get(t.componentIndex)},getCurrentSeriesIndices:function(){return(this._seriesIndices||[]).slice()},filterSeries:function(t,e){Ba(this,g(this._componentsMap.get("series"),t,e))},restoreData:function(t){var e=this._componentsMap;Ba(this,e.get("series"));var i=[];e.each(function(t,e){i.push(e)}),lI.topologicalTravel(i,lI.getAllClassMainTypes(),function(i,n){d(e.get(i),function(e){("series"!==i||!Na(e,t))&&e.restoreData()})})}});h(MI,dI);var II=["getDom","getZr","getWidth","getHeight","getDevicePixelRatio","dispatchAction","isDisposed","on","off","getDataURL","getConnectedDataURL","getModel","getOption","getViewOfComponentModel","getViewOfSeriesModel"],TI={};Fa.prototype={constructor:Fa,create:function(t,e){var i=[];d(TI,function(n,o){var a=n.create(t,e);i=i.concat(a||[])}),this._coordinateSystems=i},update:function(t,e){d(this._coordinateSystems,function(i){i.update&&i.update(t,e)})},getCoordinateSystems:function(){return this._coordinateSystems.slice()}},Fa.register=function(t,e){TI[t]=e},Fa.get=function(t){return TI[t]};var AI=d,DI=i,CI=f,LI=n,kI=/^(min|max)?(.+)$/;Wa.prototype={constructor:Wa,setOption:function(t,e){t&&d(Di(t.series),function(t){t&&t.data&&S(t.data)&&N(t.data)}),t=DI(t,!0);var i=this._optionBackup,n=Ha.call(this,t,e,!i);this._newBaseOption=n.baseOption,i?(ja(i.baseOption,n.baseOption),n.timelineOptions.length&&(i.timelineOptions=n.timelineOptions),n.mediaList.length&&(i.mediaList=n.mediaList),n.mediaDefault&&(i.mediaDefault=n.mediaDefault)):this._optionBackup=n},mountOption:function(t){var e=this._optionBackup;return this._timelineOptions=CI(e.timelineOptions,DI),this._mediaList=CI(e.mediaList,DI),this._mediaDefault=DI(e.mediaDefault),this._currentMediaIndices=[],DI(t?e.baseOption:this._newBaseOption)},getTimelineOption:function(t){var e,i=this._timelineOptions;if(i.length){var n=t.getComponent("timeline");n&&(e=DI(i[n.getCurrentIndex()],!0))}return e},getMediaOption:function(t){var e=this._api.getWidth(),i=this._api.getHeight(),n=this._mediaList,o=this._mediaDefault,a=[],r=[];if(!n.length&&!o)return r;for(var s=0,l=n.length;s=1)&&(t=1),t}var i=this._upstream,n=t&&t.skip;if(this._dirty&&i){var o=this.context;o.data=o.outputData=i.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this);var a;this._plan&&!n&&(a=this._plan(this.context));var r=e(this._modBy),s=this._modDataCount||0,l=e(t&&t.modBy),u=t&&t.modDataCount||0;r===l&&s===u||(a="reset");var h;(this._dirty||"reset"===a)&&(this._dirty=!1,h=yr(this,n)),this._modBy=l,this._modDataCount=u;var c=t&&t.step;if(this._dueEnd=i?i._outputDueEnd:this._count?this._count(this.context):1/0,this._progress){var d=this._dueIndex,f=Math.min(null!=c?this._dueIndex+c:1/0,this._dueEnd);if(!n&&(h||d=i?null:t1&&a>0?e:t}};return s}();UI.dirty=function(){this._dirty=!0,this._onDirty&&this._onDirty(this.context)},UI.unfinished=function(){return this._progress&&this._dueIndex":"\n",s="richText"===n,l={},u=0,h=this.getData(),c=h.mapDimension("defaultedTooltip",!0),f=c.length,g=this.getRawValue(t),m=y(g),v=h.getItemVisual(t,"color");w(v)&&v.colorStops&&(v=(v.colorStops[0]||{}).color),v=v||"transparent";var x=(f>1||m&&!f?function(i){function o(t,i){var o=h.getDimensionInfo(i);if(o&&!1!==o.otherDims.tooltip){var c=o.type,d="sub"+a.seriesIndex+"at"+u,p=aa({color:v,type:"subItem",renderMode:n,markerId:d}),g="string"==typeof p?p:p.content,m=(r?g+ia(o.displayName||"-")+": ":"")+ia("ordinal"===c?t+"":"time"===c?e?"":sa("yyyy/MM/dd hh:mm:ss",t):ta(t));m&&f.push(m),s&&(l[d]=v,++u)}}var r=p(i,function(t,e,i){var n=h.getDimensionInfo(i);return t|=n&&!1!==n.tooltip&&null!=n.displayName},0),f=[];c.length?d(c,function(e){o(fr(h,t,e),e)}):d(i,o);var g=r?s?"\n":"
":"",m=g+f.join(g||", ");return{renderMode:n,content:m,style:l}}(g):o(f?fr(h,t,c[0]):m?g[0]:g)).content,_=a.seriesIndex+"at"+u,b=aa({color:v,type:"item",renderMode:n,markerId:_});l[_]=v,++u;var S=h.getName(t),M=this.name;Oi(this)||(M=""),M=M?ia(M)+(e?": ":r):"";var I="string"==typeof b?b:b.content;return{html:e?I+M+x:M+I+(S?ia(S)+": "+x:x),markers:l}},isAnimationEnabled:function(){if(U_.node)return!1;var t=this.getShallow("animation");return t&&this.getData().count()>this.getShallow("animationThreshold")&&(t=!1),t},restoreData:function(){this.dataTask.dirty()},getColorFromPalette:function(t,e,i){var n=this.ecModel,o=dI.getColorFromPalette.call(this,t,e,i);return o||(o=n.getColorFromPalette(t,e,i)),o},coordDimToDataDim:function(t){return this.getRawData().mapDimension(t,!0)},getProgressive:function(){return this.get("progressive")},getProgressiveThreshold:function(){return this.get("progressiveThreshold")},getAxisTooltipData:null,getTooltipPosition:null,pipeTask:null,preventIncremental:null,pipelineContext:null});h(YI,ZI),h(YI,dI);var qI=function(){this.group=new tb,this.uid=Ro("viewComponent")};qI.prototype={constructor:qI,init:function(t,e){},render:function(t,e,i,n){},dispose:function(){},filterForExposedEvent:null};var KI=qI.prototype;KI.updateView=KI.updateLayout=KI.updateVisual=function(t,e,i,n){},ji(qI),$i(qI,{registerWhenExtend:!0});var $I=function(){var t=Bi();return function(e){var i=t(e),n=e.pipelineContext,o=i.large,a=i.progressiveRender,r=i.large=n.large,s=i.progressiveRender=n.progressiveRender;return!!(o^r||a^s)&&"reset"}},JI=Bi(),QI=$I();Ar.prototype={type:"chart",init:function(t,e){},render:function(t,e,i,n){},highlight:function(t,e,i,n){Cr(t.getData(),n,"emphasis")},downplay:function(t,e,i,n){Cr(t.getData(),n,"normal")},remove:function(t,e){this.group.removeAll()},dispose:function(){},incrementalPrepareRender:null,incrementalRender:null,updateTransform:null,filterForExposedEvent:null};var tT=Ar.prototype;tT.updateView=tT.updateLayout=tT.updateVisual=function(t,e,i,n){this.render(t,e,i,n)},ji(Ar),$i(Ar,{registerWhenExtend:!0}),Ar.markUpdateMethod=function(t,e){JI(t).updateMethod=e};var eT={incrementalPrepareRender:{progress:function(t,e){e.view.incrementalRender(t,e.model,e.ecModel,e.api,e.payload)}},render:{forceFirstProgress:!0,progress:function(t,e){e.view.render(e.model,e.ecModel,e.api,e.payload)}}},iT="\0__throttleOriginMethod",nT="\0__throttleRate",oT="\0__throttleType",aT={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var i=t.getData(),n=(t.visualColorAccessPath||"itemStyle.color").split("."),o=t.get(n)||t.getColorFromPalette(t.name,null,e.getSeriesCount());if(i.setVisual("color",o),!e.isSeriesFiltered(t)){"function"!=typeof o||o instanceof IM||i.each(function(e){i.setItemVisual(e,"color",o(t.getDataParams(e)))});return{dataEach:i.hasItemOption?function(t,e){var i=t.getItemModel(e).get(n,!0);null!=i&&t.setItemVisual(e,"color",i)}:null}}}},rT={toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}},sT=function(t,e){function i(t,e){if("string"!=typeof t)return t;var i=t;return d(e,function(t,e){i=i.replace(new RegExp("\\{\\s*"+e+"\\s*\\}","g"),t)}),i}function n(t){var e=a.get(t);if(null==e){for(var i=t.split("."),n=rT.aria,o=0;o1?"series.multiple.prefix":"series.single.prefix"),{seriesCount:r}),e.eachSeries(function(t,e){if(e1?"multiple":"single")+".";a=i(a=n(s?u+"withName":u+"withoutName"),{seriesId:t.seriesIndex,seriesName:t.get("name"),seriesType:o(t.subType)});var c=t.getData();window.data=c,c.count()>l?a+=i(n("data.partialData"),{displayCnt:l}):a+=n("data.allData");for(var d=[],p=0;pi.blockIndex?i.step:null,a=n&&n.modDataCount;return{step:o,modBy:null!=a?Math.ceil(a/o):null,modDataCount:a}}},uT.getPipeline=function(t){return this._pipelineMap.get(t)},uT.updateStreamModes=function(t,e){var i=this._pipelineMap.get(t.uid),n=t.getData().count(),o=i.progressiveEnabled&&e.incrementalPrepareRender&&n>=i.threshold,a=t.get("large")&&n>=t.get("largeThreshold"),r="mod"===t.get("progressiveChunkMode")?n:null;t.pipelineContext=i.context={progressiveRender:o,modDataCount:r,large:a}},uT.restorePipelines=function(t){var e=this,i=e._pipelineMap=R();t.eachSeries(function(t){var n=t.getProgressive(),o=t.uid;i.set(o,{id:o,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:n&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(n||700),count:0}),jr(e,t,t.dataTask)})},uT.prepareStageTasks=function(){var t=this._stageTaskMap,e=this.ecInstance.getModel(),i=this.api;d(this._allHandlers,function(n){var o=t.get(n.uid)||t.set(n.uid,[]);n.reset&&zr(this,n,o,e,i),n.overallReset&&Br(this,n,o,e,i)},this)},uT.prepareView=function(t,e,i,n){var o=t.renderTask,a=o.context;a.model=e,a.ecModel=i,a.api=n,o.__block=!t.incrementalPrepareRender,jr(this,e,o)},uT.performDataProcessorTasks=function(t,e){Rr(this,this._dataProcessorHandlers,t,e,{block:!0})},uT.performVisualTasks=function(t,e,i){Rr(this,this._visualHandlers,t,e,i)},uT.performSeriesTasks=function(t){var e;t.eachSeries(function(t){e|=t.dataTask.perform()}),this.unfinished|=e},uT.plan=function(){this._pipelineMap.each(function(t){var e=t.tail;do{if(e.__block){t.blockIndex=e.__idxInPipeline;break}e=e.getUpstream()}while(e)})};var hT=uT.updatePayload=function(t,e){"remain"!==e&&(t.context.payload=e)},cT=Ur(0);Er.wrapStageHandler=function(t,e){return x(t)&&(t={overallReset:t,seriesType:Yr(t)}),t.uid=Ro("stageHandler"),e&&(t.visualType=e),t};var dT,fT={},pT={};qr(fT,MI),qr(pT,Ga),fT.eachSeriesByType=fT.eachRawSeriesByType=function(t){dT=t},fT.eachComponent=function(t){"series"===t.mainType&&t.subType&&(dT=t.subType)};var gT=["#37A2DA","#32C5E9","#67E0E3","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#E062AE","#E690D1","#e7bcf3","#9d96f5","#8378EA","#96BFFF"],mT={color:gT,colorLayer:[["#37A2DA","#ffd85c","#fd7b5f"],["#37A2DA","#67E0E3","#FFDB5C","#ff9f7f","#E062AE","#9d96f5"],["#37A2DA","#32C5E9","#9FE6B8","#FFDB5C","#ff9f7f","#fb7293","#e7bcf3","#8378EA","#96BFFF"],gT]},vT=["#dd6b66","#759aa0","#e69d87","#8dc1a9","#ea7e53","#eedd78","#73a373","#73b9bc","#7289ab","#91ca8c","#f49f42"],yT={color:vT,backgroundColor:"#333",tooltip:{axisPointer:{lineStyle:{color:"#eee"},crossStyle:{color:"#eee"}}},legend:{textStyle:{color:"#eee"}},textStyle:{color:"#eee"},title:{textStyle:{color:"#eee"}},toolbox:{iconStyle:{normal:{borderColor:"#eee"}}},dataZoom:{textStyle:{color:"#eee"}},visualMap:{textStyle:{color:"#eee"}},timeline:{lineStyle:{color:"#eee"},itemStyle:{normal:{color:vT[1]}},label:{normal:{textStyle:{color:"#eee"}}},controlStyle:{normal:{color:"#eee",borderColor:"#eee"}}},timeAxis:{axisLine:{lineStyle:{color:"#eee"}},axisTick:{lineStyle:{color:"#eee"}},axisLabel:{textStyle:{color:"#eee"}},splitLine:{lineStyle:{type:"dashed",color:"#aaa"}},splitArea:{areaStyle:{color:"#eee"}}},logAxis:{axisLine:{lineStyle:{color:"#eee"}},axisTick:{lineStyle:{color:"#eee"}},axisLabel:{textStyle:{color:"#eee"}},splitLine:{lineStyle:{type:"dashed",color:"#aaa"}},splitArea:{areaStyle:{color:"#eee"}}},valueAxis:{axisLine:{lineStyle:{color:"#eee"}},axisTick:{lineStyle:{color:"#eee"}},axisLabel:{textStyle:{color:"#eee"}},splitLine:{lineStyle:{type:"dashed",color:"#aaa"}},splitArea:{areaStyle:{color:"#eee"}}},categoryAxis:{axisLine:{lineStyle:{color:"#eee"}},axisTick:{lineStyle:{color:"#eee"}},axisLabel:{textStyle:{color:"#eee"}},splitLine:{lineStyle:{type:"dashed",color:"#aaa"}},splitArea:{areaStyle:{color:"#eee"}}},line:{symbol:"circle"},graph:{color:vT},gauge:{title:{textStyle:{color:"#eee"}}},candlestick:{itemStyle:{normal:{color:"#FD1050",color0:"#0CF49B",borderColor:"#FD1050",borderColor0:"#0CF49B"}}}};yT.categoryAxis.splitLine.show=!1,lI.extend({type:"dataset",defaultOption:{seriesLayoutBy:_I,sourceHeader:null,dimensions:null,source:null},optionUpdated:function(){wa(this)}}),qI.extend({type:"dataset"});var xT=Pn.extend({type:"ellipse",shape:{cx:0,cy:0,rx:0,ry:0},buildPath:function(t,e){var i=.5522848,n=e.cx,o=e.cy,a=e.rx,r=e.ry,s=a*i,l=r*i;t.moveTo(n-a,o),t.bezierCurveTo(n-a,o-l,n-s,o-r,n,o-r),t.bezierCurveTo(n+s,o-r,n+a,o-l,n+a,o),t.bezierCurveTo(n+a,o+l,n+s,o+r,n,o+r),t.bezierCurveTo(n-s,o+r,n-a,o+l,n-a,o),t.closePath()}}),_T=/[\s,]+/;$r.prototype.parse=function(t,e){e=e||{};var i=Kr(t);if(!i)throw new Error("Illegal svg");var n=new tb;this._root=n;var o=i.getAttribute("viewBox")||"",a=parseFloat(i.getAttribute("width")||e.width),r=parseFloat(i.getAttribute("height")||e.height);isNaN(a)&&(a=null),isNaN(r)&&(r=null),es(i,n,null,!0);for(var s=i.firstChild;s;)this._parseNode(s,n),s=s.nextSibling;var l,u;if(o){var h=P(o).split(_T);h.length>=4&&(l={x:parseFloat(h[0]||0),y:parseFloat(h[1]||0),width:parseFloat(h[2]),height:parseFloat(h[3])})}if(l&&null!=a&&null!=r&&(u=as(l,a,r),!e.ignoreViewBox)){var c=n;(n=new tb).add(c),c.scale=u.scale.slice(),c.position=u.position.slice()}return e.ignoreRootClip||null==a||null==r||n.setClipPath(new yM({shape:{x:0,y:0,width:a,height:r}})),{root:n,width:a,height:r,viewBoxRect:l,viewBoxTransform:u}},$r.prototype._parseNode=function(t,e){var i=t.nodeName.toLowerCase();"defs"===i?this._isDefine=!0:"text"===i&&(this._isText=!0);var n;if(this._isDefine){if(r=bT[i]){var o=r.call(this,t),a=t.getAttribute("id");a&&(this._defs[a]=o)}}else{var r=wT[i];r&&(n=r.call(this,t,e),e.add(n))}for(var s=t.firstChild;s;)1===s.nodeType&&this._parseNode(s,n),3===s.nodeType&&this._isText&&this._parseText(s,n),s=s.nextSibling;"defs"===i?this._isDefine=!1:"text"===i&&(this._isText=!1)},$r.prototype._parseText=function(t,e){if(1===t.nodeType){var i=t.getAttribute("dx")||0,n=t.getAttribute("dy")||0;this._textX+=parseFloat(i),this._textY+=parseFloat(n)}var o=new rM({style:{text:t.textContent,transformText:!0},position:[this._textX||0,this._textY||0]});Qr(e,o),es(t,o,this._defs);var a=o.style.fontSize;a&&a<9&&(o.style.fontSize=9,o.scale=o.scale||[1,1],o.scale[0]*=a/9,o.scale[1]*=a/9);var r=o.getBoundingRect();return this._textX+=r.width,e.add(o),o};var wT={g:function(t,e){var i=new tb;return Qr(e,i),es(t,i,this._defs),i},rect:function(t,e){var i=new yM;return Qr(e,i),es(t,i,this._defs),i.setShape({x:parseFloat(t.getAttribute("x")||0),y:parseFloat(t.getAttribute("y")||0),width:parseFloat(t.getAttribute("width")||0),height:parseFloat(t.getAttribute("height")||0)}),i},circle:function(t,e){var i=new sM;return Qr(e,i),es(t,i,this._defs),i.setShape({cx:parseFloat(t.getAttribute("cx")||0),cy:parseFloat(t.getAttribute("cy")||0),r:parseFloat(t.getAttribute("r")||0)}),i},line:function(t,e){var i=new _M;return Qr(e,i),es(t,i,this._defs),i.setShape({x1:parseFloat(t.getAttribute("x1")||0),y1:parseFloat(t.getAttribute("y1")||0),x2:parseFloat(t.getAttribute("x2")||0),y2:parseFloat(t.getAttribute("y2")||0)}),i},ellipse:function(t,e){var i=new xT;return Qr(e,i),es(t,i,this._defs),i.setShape({cx:parseFloat(t.getAttribute("cx")||0),cy:parseFloat(t.getAttribute("cy")||0),rx:parseFloat(t.getAttribute("rx")||0),ry:parseFloat(t.getAttribute("ry")||0)}),i},polygon:function(t,e){var i=t.getAttribute("points");i&&(i=ts(i));var n=new pM({shape:{points:i||[]}});return Qr(e,n),es(t,n,this._defs),n},polyline:function(t,e){var i=new Pn;Qr(e,i),es(t,i,this._defs);var n=t.getAttribute("points");return n&&(n=ts(n)),new gM({shape:{points:n||[]}})},image:function(t,e){var i=new fi;return Qr(e,i),es(t,i,this._defs),i.setStyle({image:t.getAttribute("xlink:href"),x:t.getAttribute("x"),y:t.getAttribute("y"),width:t.getAttribute("width"),height:t.getAttribute("height")}),i},text:function(t,e){var i=t.getAttribute("x")||0,n=t.getAttribute("y")||0,o=t.getAttribute("dx")||0,a=t.getAttribute("dy")||0;this._textX=parseFloat(i)+parseFloat(o),this._textY=parseFloat(n)+parseFloat(a);var r=new tb;return Qr(e,r),es(t,r,this._defs),r},tspan:function(t,e){var i=t.getAttribute("x"),n=t.getAttribute("y");null!=i&&(this._textX=parseFloat(i)),null!=n&&(this._textY=parseFloat(n));var o=t.getAttribute("dx")||0,a=t.getAttribute("dy")||0,r=new tb;return Qr(e,r),es(t,r,this._defs),this._textX+=o,this._textY+=a,r},path:function(t,e){var i=Rn(t.getAttribute("d")||"");return Qr(e,i),es(t,i,this._defs),i}},bT={lineargradient:function(t){var e=parseInt(t.getAttribute("x1")||0,10),i=parseInt(t.getAttribute("y1")||0,10),n=parseInt(t.getAttribute("x2")||10,10),o=parseInt(t.getAttribute("y2")||0,10),a=new TM(e,i,n,o);return Jr(t,a),a},radialgradient:function(t){}},ST={fill:"fill",stroke:"stroke","stroke-width":"lineWidth",opacity:"opacity","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity","stroke-dasharray":"lineDash","stroke-dashoffset":"lineDashOffset","stroke-linecap":"lineCap","stroke-linejoin":"lineJoin","stroke-miterlimit":"miterLimit","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","text-align":"textAlign","alignment-baseline":"textBaseline"},MT=/url\(\s*#(.*?)\)/,IT=/(translate|scale|rotate|skewX|skewY|matrix)\(([\-\s0-9\.e,]*)\)/g,TT=/([^\s:;]+)\s*:\s*([^:;]+)/g,AT=R(),DT={registerMap:function(t,e,i){var n;return y(e)?n=e:e.svg?n=[{type:"svg",source:e.svg,specialAreas:e.specialAreas}]:(e.geoJson&&!e.features&&(i=e.specialAreas,e=e.geoJson),n=[{type:"geoJSON",source:e,specialAreas:i}]),d(n,function(t){var e=t.type;"geoJson"===e&&(e=t.type="geoJSON"),(0,CT[e])(t)}),AT.set(t,n)},retrieveMap:function(t){return AT.get(t)}},CT={geoJSON:function(t){var e=t.source;t.geoJSON=_(e)?"undefined"!=typeof JSON&&JSON.parse?JSON.parse(e):new Function("return ("+e+");")():e},svg:function(t){t.svgXML=Kr(t.source)}},LT=k,kT=d,PT=x,NT=w,OT=lI.parseClassType,ET={zrender:"4.0.6"},RT=1e3,zT=1e3,BT=3e3,VT={PROCESSOR:{FILTER:RT,STATISTIC:5e3},VISUAL:{LAYOUT:zT,GLOBAL:2e3,CHART:BT,COMPONENT:4e3,BRUSH:5e3}},GT="__flagInMainProcess",FT="__optionUpdated",WT=/^[a-zA-Z0-9_]+$/;ls.prototype.on=ss("on"),ls.prototype.off=ss("off"),ls.prototype.one=ss("one"),h(ls,fw);var HT=us.prototype;HT._onframe=function(){if(!this._disposed){var t=this._scheduler;if(this[FT]){var e=this[FT].silent;this[GT]=!0,cs(this),ZT.update.call(this),this[GT]=!1,this[FT]=!1,gs.call(this,e),ms.call(this,e)}else if(t.unfinished){var i=1,n=this._model;this._api;t.unfinished=!1;do{var o=+new Date;t.performSeriesTasks(n),t.performDataProcessorTasks(n),fs(this,n),t.performVisualTasks(n),bs(this,this._model,0,"remain"),i-=+new Date-o}while(i>0&&t.unfinished);t.unfinished||this._zr.flush()}}},HT.getDom=function(){return this._dom},HT.getZr=function(){return this._zr},HT.setOption=function(t,e,i){var n;if(NT(e)&&(i=e.lazyUpdate,n=e.silent,e=e.notMerge),this[GT]=!0,!this._model||e){var o=new Wa(this._api),a=this._theme,r=this._model=new MI(null,null,a,o);r.scheduler=this._scheduler,r.init(null,null,a,o)}this._model.setOption(t,qT),i?(this[FT]={silent:n},this[GT]=!1):(cs(this),ZT.update.call(this),this._zr.flush(),this[FT]=!1,this[GT]=!1,gs.call(this,n),ms.call(this,n))},HT.setTheme=function(){console.error("ECharts#setTheme() is DEPRECATED in ECharts 3.0")},HT.getModel=function(){return this._model},HT.getOption=function(){return this._model&&this._model.getOption()},HT.getWidth=function(){return this._zr.getWidth()},HT.getHeight=function(){return this._zr.getHeight()},HT.getDevicePixelRatio=function(){return this._zr.painter.dpr||window.devicePixelRatio||1},HT.getRenderedCanvas=function(t){if(U_.canvasSupported)return(t=t||{}).pixelRatio=t.pixelRatio||1,t.backgroundColor=t.backgroundColor||this._model.get("backgroundColor"),this._zr.painter.getRenderedCanvas(t)},HT.getSvgDataUrl=function(){if(U_.svgSupported){var t=this._zr;return d(t.storage.getDisplayList(),function(t){t.stopAnimation(!0)}),t.painter.pathToDataUrl()}},HT.getDataURL=function(t){var e=(t=t||{}).excludeComponents,i=this._model,n=[],o=this;kT(e,function(t){i.eachComponent({mainType:t},function(t){var e=o._componentsMap[t.__viewId];e.group.ignore||(n.push(e),e.group.ignore=!0)})});var a="svg"===this._zr.painter.getType()?this.getSvgDataUrl():this.getRenderedCanvas(t).toDataURL("image/"+(t&&t.type||"png"));return kT(n,function(t){t.group.ignore=!1}),a},HT.getConnectedDataURL=function(t){if(U_.canvasSupported){var e=this.group,n=Math.min,o=Math.max;if(eA[e]){var a=1/0,r=1/0,s=-1/0,l=-1/0,u=[],h=t&&t.pixelRatio||1;d(tA,function(h,c){if(h.group===e){var d=h.getRenderedCanvas(i(t)),f=h.getDom().getBoundingClientRect();a=n(f.left,a),r=n(f.top,r),s=o(f.right,s),l=o(f.bottom,l),u.push({dom:d,left:f.left,top:f.top})}});var c=(s*=h)-(a*=h),f=(l*=h)-(r*=h),p=iw();p.width=c,p.height=f;var g=Ii(p);return kT(u,function(t){var e=new fi({style:{x:t.left*h-a,y:t.top*h-r,image:t.dom}});g.add(e)}),g.refreshImmediately(),p.toDataURL("image/"+(t&&t.type||"png"))}return this.getDataURL(t)}},HT.convertToPixel=v(hs,"convertToPixel"),HT.convertFromPixel=v(hs,"convertFromPixel"),HT.containPixel=function(t,e){var i;return t=Vi(this._model,t),d(t,function(t,n){n.indexOf("Models")>=0&&d(t,function(t){var o=t.coordinateSystem;if(o&&o.containPoint)i|=!!o.containPoint(e);else if("seriesModels"===n){var a=this._chartsMap[t.__viewId];a&&a.containPoint&&(i|=a.containPoint(e,t))}},this)},this),!!i},HT.getVisual=function(t,e){var i=(t=Vi(this._model,t,{defaultMainType:"series"})).seriesModel.getData(),n=t.hasOwnProperty("dataIndexInside")?t.dataIndexInside:t.hasOwnProperty("dataIndex")?i.indexOfRawIndex(t.dataIndex):null;return null!=n?i.getItemVisual(n,e):i.getVisual(e)},HT.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]},HT.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]};var ZT={prepareAndUpdate:function(t){cs(this),ZT.update.call(this,t)},update:function(t){var e=this._model,i=this._api,n=this._zr,o=this._coordSysMgr,a=this._scheduler;if(e){a.restoreData(e,t),a.performSeriesTasks(e),o.create(e,i),a.performDataProcessorTasks(e,t),fs(this,e),o.update(e,i),xs(e),a.performVisualTasks(e,t),_s(this,e,i,t);var r=e.get("backgroundColor")||"transparent";if(U_.canvasSupported)n.setBackgroundColor(r);else{var s=Gt(r);r=qt(s,"rgb"),0===s[3]&&(r="transparent")}Ss(e,i)}},updateTransform:function(t){var e=this._model,i=this,n=this._api;if(e){var o=[];e.eachComponent(function(a,r){var s=i.getViewOfComponentModel(r);if(s&&s.__alive)if(s.updateTransform){var l=s.updateTransform(r,e,n,t);l&&l.update&&o.push(s)}else o.push(s)});var a=R();e.eachSeries(function(o){var r=i._chartsMap[o.__viewId];if(r.updateTransform){var s=r.updateTransform(o,e,n,t);s&&s.update&&a.set(o.uid,1)}else a.set(o.uid,1)}),xs(e),this._scheduler.performVisualTasks(e,t,{setDirty:!0,dirtyMap:a}),bs(i,e,0,t,a),Ss(e,this._api)}},updateView:function(t){var e=this._model;e&&(Ar.markUpdateMethod(t,"updateView"),xs(e),this._scheduler.performVisualTasks(e,t,{setDirty:!0}),_s(this,this._model,this._api,t),Ss(e,this._api))},updateVisual:function(t){ZT.update.call(this,t)},updateLayout:function(t){ZT.update.call(this,t)}};HT.resize=function(t){this._zr.resize(t);var e=this._model;if(this._loadingFX&&this._loadingFX.resize(),e){var i=e.resetOption("media"),n=t&&t.silent;this[GT]=!0,i&&cs(this),ZT.update.call(this),this[GT]=!1,gs.call(this,n),ms.call(this,n)}},HT.showLoading=function(t,e){if(NT(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),QT[t]){var i=QT[t](this._api,e),n=this._zr;this._loadingFX=i,n.add(i)}},HT.hideLoading=function(){this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null},HT.makeActionFromEvent=function(t){var e=a({},t);return e.type=jT[t.type],e},HT.dispatchAction=function(t,e){NT(e)||(e={silent:!!e}),XT[t.type]&&this._model&&(this[GT]?this._pendingActions.push(t):(ps.call(this,t,e.silent),e.flush?this._zr.flush(!0):!1!==e.flush&&U_.browser.weChat&&this._throttledZrFlush(),gs.call(this,e.silent),ms.call(this,e.silent)))},HT.appendData=function(t){var e=t.seriesIndex;this.getModel().getSeriesByIndex(e).appendData(t),this._scheduler.unfinished=!0},HT.on=ss("on"),HT.off=ss("off"),HT.one=ss("one");var UT=["click","dblclick","mouseover","mouseout","mousemove","mousedown","mouseup","globalout","contextmenu"];HT._initEvents=function(){kT(UT,function(t){var e=function(e){var i,n=this.getModel(),o=e.target;if("globalout"===t)i={};else if(o&&null!=o.dataIndex){var r=o.dataModel||n.getSeriesByIndex(o.seriesIndex);i=r&&r.getDataParams(o.dataIndex,o.dataType,o)||{}}else o&&o.eventData&&(i=a({},o.eventData));if(i){var s=i.componentType,l=i.componentIndex;"markLine"!==s&&"markPoint"!==s&&"markArea"!==s||(s="series",l=i.seriesIndex);var u=s&&null!=l&&n.getComponent(s,l),h=u&&this["series"===u.mainType?"_chartsMap":"_componentsMap"][u.__viewId];i.event=e,i.type=t,this._ecEventProcessor.eventInfo={targetEl:o,packedEvent:i,model:u,view:h},this.trigger(t,i)}};e.zrEventfulCallAtLast=!0,this._zr.on(t,e,this)},this),kT(jT,function(t,e){this._messageCenter.on(e,function(t){this.trigger(e,t)},this)},this)},HT.isDisposed=function(){return this._disposed},HT.clear=function(){this.setOption({series:[]},!0)},HT.dispose=function(){if(!this._disposed){this._disposed=!0,Fi(this.getDom(),oA,"");var t=this._api,e=this._model;kT(this._componentsViews,function(i){i.dispose(e,t)}),kT(this._chartsViews,function(i){i.dispose(e,t)}),this._zr.dispose(),delete tA[this.id]}},h(us,fw),Ds.prototype={constructor:Ds,normalizeQuery:function(t){var e={},i={},n={};if(_(t)){var o=OT(t);e.mainType=o.main||null,e.subType=o.sub||null}else{var a=["Index","Name","Id"],r={name:1,dataIndex:1,dataType:1};d(t,function(t,o){for(var s=!1,l=0;l0&&h===o.length-u.length){var c=o.slice(0,h);"data"!==c&&(e.mainType=c,e[u.toLowerCase()]=t,s=!0)}}r.hasOwnProperty(o)&&(i[o]=t,s=!0),s||(n[o]=t)})}return{cptQuery:e,dataQuery:i,otherQuery:n}},filter:function(t,e,i){function n(t,e,i,n){return null==t[i]||e[n||i]===t[i]}var o=this.eventInfo;if(!o)return!0;var a=o.targetEl,r=o.packedEvent,s=o.model,l=o.view;if(!s||!l)return!0;var u=e.cptQuery,h=e.dataQuery;return n(u,s,"mainType")&&n(u,s,"subType")&&n(u,s,"index","componentIndex")&&n(u,s,"name")&&n(u,s,"id")&&n(h,r,"name")&&n(h,r,"dataIndex")&&n(h,r,"dataType")&&(!l.filterForExposedEvent||l.filterForExposedEvent(t,e.otherQuery,a,r))},afterTrigger:function(){this.eventInfo=null}};var XT={},jT={},YT=[],qT=[],KT=[],$T=[],JT={},QT={},tA={},eA={},iA=new Date-0,nA=new Date-0,oA="_echarts_instance_",aA=Ls;Bs(2e3,aT),Ns(BI),Os(5e3,function(t){var e=R();t.eachSeries(function(t){var i=t.get("stack");if(i){var n=e.get(i)||e.set(i,[]),o=t.getData(),a={stackResultDimension:o.getCalculationInfo("stackResultDimension"),stackedOverDimension:o.getCalculationInfo("stackedOverDimension"),stackedDimension:o.getCalculationInfo("stackedDimension"),stackedByDimension:o.getCalculationInfo("stackedByDimension"),isStackedByIndex:o.getCalculationInfo("isStackedByIndex"),data:o,seriesModel:t};if(!a.stackedDimension||!a.isStackedByIndex&&!a.stackedByDimension)return;n.length&&o.setCalculationInfo("stackedOnSeries",n[n.length-1].seriesModel),n.push(a)}}),e.each(ar)}),Gs("default",function(t,e){r(e=e||{},{text:"loading",color:"#c23531",textColor:"#000",maskColor:"rgba(255, 255, 255, 0.8)",zlevel:0});var i=new yM({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4}),n=new SM({shape:{startAngle:-lT/2,endAngle:-lT/2+.1,r:10},style:{stroke:e.color,lineCap:"round",lineWidth:5},zlevel:e.zlevel,z:10001}),o=new yM({style:{fill:"none",text:e.text,textPosition:"right",textDistance:10,textFill:e.textColor},zlevel:e.zlevel,z:10001});n.animateShape(!0).when(1e3,{endAngle:3*lT/2}).start("circularInOut"),n.animateShape(!0).when(1e3,{startAngle:3*lT/2}).delay(300).start("circularInOut");var a=new tb;return a.add(n),a.add(o),a.add(i),a.resize=function(){var e=t.getWidth()/2,a=t.getHeight()/2;n.setShape({cx:e,cy:a});var r=n.shape.r;o.setShape({x:e-r,y:a-r,width:2*r,height:2*r}),i.setShape({x:0,y:0,width:t.getWidth(),height:t.getHeight()})},a.resize(),a}),Es({type:"highlight",event:"highlight",update:"highlight"},B),Es({type:"downplay",event:"downplay",update:"downplay"},B),Ps("light",mT),Ps("dark",yT);var rA={};Xs.prototype={constructor:Xs,add:function(t){return this._add=t,this},update:function(t){return this._update=t,this},remove:function(t){return this._remove=t,this},execute:function(){var t=this._old,e=this._new,i={},n=[],o=[];for(js(t,{},n,"_oldKeyGetter",this),js(e,i,o,"_newKeyGetter",this),a=0;ax[1]&&(x[1]=y)}e&&(this._nameList[d]=e[f])}this._rawCount=this._count=l,this._extent={},el(this)},yA._initDataFromProvider=function(t,e){if(!(t>=e)){for(var i,n=this._chunkSize,o=this._rawData,a=this._storage,r=this.dimensions,s=r.length,l=this._dimensionInfos,u=this._nameList,h=this._idList,c=this._rawExtent,d=this._nameRepeatCount={},f=this._chunkCount,p=0;pM[1]&&(M[1]=S)}if(!o.pure){var I=u[v];if(m&&null==I)if(null!=m.name)u[v]=I=m.name;else if(null!=i){var T=r[i],A=a[T][y];if(A){I=A[x];var D=l[T].ordinalMeta;D&&D.categories.length&&(I=D.categories[I])}}var C=null==m?null:m.id;null==C&&null!=I&&(d[I]=d[I]||0,C=I,d[I]>0&&(C+="__ec__"+d[I]),d[I]++),null!=C&&(h[v]=C)}}!o.persistent&&o.clean&&o.clean(),this._rawCount=this._count=e,this._extent={},el(this)}},yA.count=function(){return this._count},yA.getIndices=function(){var t=this._indices;if(t){var e=t.constructor,i=this._count;if(e===Array){n=new e(i);for(o=0;o=0&&e=0&&ea&&(a=s)}return i=[o,a],this._extent[t]=i,i},yA.getApproximateExtent=function(t){return t=this.getDimension(t),this._approximateExtent[t]||this.getDataExtent(t)},yA.setApproximateExtent=function(t,e){e=this.getDimension(e),this._approximateExtent[e]=t.slice()},yA.getCalculationInfo=function(t){return this._calculationInfo[t]},yA.setCalculationInfo=function(t,e){lA(t)?a(this._calculationInfo,t):this._calculationInfo[t]=e},yA.getSum=function(t){var e=0;if(this._storage[t])for(var i=0,n=this.count();i=this._rawCount||t<0)return-1;var e=this._indices,i=e[t];if(null!=i&&it))return a;o=a-1}}return-1},yA.indicesOfNearest=function(t,e,i){var n=[];if(!this._storage[t])return n;null==i&&(i=1/0);for(var o=Number.MAX_VALUE,a=-1,r=0,s=this.count();r=0&&a<0)&&(o=u,a=l,n.length=0),n.push(r))}return n},yA.getRawIndex=nl,yA.getRawDataItem=function(t){if(this._rawData.persistent)return this._rawData.getItem(this.getRawIndex(t));for(var e=[],i=0;i=l&&w<=u||isNaN(w))&&(a[r++]=c),c++;h=!0}else if(2===n){for(var d=this._storage[s],v=this._storage[e[1]],y=t[e[1]][0],x=t[e[1]][1],f=0;f=l&&w<=u||isNaN(w))&&(b>=y&&b<=x||isNaN(b))&&(a[r++]=c),c++}h=!0}}if(!h)if(1===n)for(m=0;m=l&&w<=u||isNaN(w))&&(a[r++]=M)}else for(m=0;mt[I][1])&&(S=!1)}S&&(a[r++]=this.getRawIndex(m))}return rb[1]&&(b[1]=w)}}}return o},yA.downSample=function(t,e,i,n){for(var o=sl(this,[t]),a=o._storage,r=[],s=Math.floor(1/e),l=a[t],u=this.count(),h=this._chunkSize,c=o._rawExtent[t],d=new($s(this))(u),f=0,p=0;pu-p&&(s=u-p,r.length=s);for(var g=0;gc[1]&&(c[1]=x),d[f++]=_}return o._count=f,o._indices=d,o.getRawIndex=ol,o},yA.getItemModel=function(t){var e=this.hostModel;return new No(this.getRawDataItem(t),e,e&&e.ecModel)},yA.diff=function(t){var e=this;return new Xs(t?t.getIndices():[],this.getIndices(),function(e){return al(t,e)},function(t){return al(e,t)})},yA.getVisual=function(t){var e=this._visual;return e&&e[t]},yA.setVisual=function(t,e){if(lA(t))for(var i in t)t.hasOwnProperty(i)&&this.setVisual(i,t[i]);else this._visual=this._visual||{},this._visual[t]=e},yA.setLayout=function(t,e){if(lA(t))for(var i in t)t.hasOwnProperty(i)&&this.setLayout(i,t[i]);else this._layout[t]=e},yA.getLayout=function(t){return this._layout[t]},yA.getItemLayout=function(t){return this._itemLayouts[t]},yA.setItemLayout=function(t,e,i){this._itemLayouts[t]=i?a(this._itemLayouts[t]||{},e):e},yA.clearItemLayouts=function(){this._itemLayouts.length=0},yA.getItemVisual=function(t,e,i){var n=this._itemVisuals[t],o=n&&n[e];return null!=o||i?o:this.getVisual(e)},yA.setItemVisual=function(t,e,i){var n=this._itemVisuals[t]||{},o=this.hasItemVisual;if(this._itemVisuals[t]=n,lA(e))for(var a in e)e.hasOwnProperty(a)&&(n[a]=e[a],o[a]=!0);else n[e]=i,o[e]=!0},yA.clearAllVisual=function(){this._visual={},this._itemVisuals=[],this.hasItemVisual={}};var xA=function(t){t.seriesIndex=this.seriesIndex,t.dataIndex=this.dataIndex,t.dataType=this.dataType};yA.setItemGraphicEl=function(t,e){var i=this.hostModel;e&&(e.dataIndex=t,e.dataType=this.dataType,e.seriesIndex=i&&i.seriesIndex,"group"===e.type&&e.traverse(xA,e)),this._graphicEls[t]=e},yA.getItemGraphicEl=function(t){return this._graphicEls[t]},yA.eachItemGraphicEl=function(t,e){d(this._graphicEls,function(i,n){i&&t&&t.call(e,i,n)})},yA.cloneShallow=function(t){if(!t){var e=f(this.dimensions,this.getDimensionInfo,this);t=new vA(e,this.hostModel)}if(t._storage=this._storage,Qs(t,this),this._indices){var i=this._indices.constructor;t._indices=new i(this._indices)}else t._indices=null;return t.getRawIndex=t._indices?ol:nl,t},yA.wrapMethod=function(t,e){var i=this[t];"function"==typeof i&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var t=i.apply(this,arguments);return e.apply(this,[t].concat(C(arguments)))})},yA.TRANSFERABLE_METHODS=["cloneShallow","downSample","map"],yA.CHANGABLE_METHODS=["filterSelf","selectRange"];var _A=function(t,e){return e=e||{},hl(e.coordDimensions||[],t,{dimsDef:e.dimensionsDefine||t.dimensionsDefine,encodeDef:e.encodeDefine||t.encodeDefine,dimCount:e.dimensionsCount,generateCoord:e.generateCoord,generateCoordCount:e.generateCoordCount})};xl.prototype.parse=function(t){return t},xl.prototype.getSetting=function(t){return this._setting[t]},xl.prototype.contain=function(t){var e=this._extent;return t>=e[0]&&t<=e[1]},xl.prototype.normalize=function(t){var e=this._extent;return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])},xl.prototype.scale=function(t){var e=this._extent;return t*(e[1]-e[0])+e[0]},xl.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1])},xl.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))},xl.prototype.getExtent=function(){return this._extent.slice()},xl.prototype.setExtent=function(t,e){var i=this._extent;isNaN(t)||(i[0]=t),isNaN(e)||(i[1]=e)},xl.prototype.isBlank=function(){return this._isBlank},xl.prototype.setBlank=function(t){this._isBlank=t},xl.prototype.getLabel=null,ji(xl),$i(xl,{registerWhenExtend:!0}),_l.createByAxisModel=function(t){var e=t.option,i=e.data,n=i&&f(i,bl);return new _l({categories:n,needCollect:!n,deduplication:!1!==e.dedplication})};var wA=_l.prototype;wA.getOrdinal=function(t){return wl(this).get(t)},wA.parseAndCollect=function(t){var e,i=this._needCollect;if("string"!=typeof t&&!i)return t;if(i&&!this._deduplication)return e=this.categories.length,this.categories[e]=t,e;var n=wl(this);return null==(e=n.get(t))&&(i?(e=this.categories.length,this.categories[e]=t,n.set(t,e)):e=NaN),e};var bA=xl.prototype,SA=xl.extend({type:"ordinal",init:function(t,e){t&&!y(t)||(t=new _l({categories:t})),this._ordinalMeta=t,this._extent=e||[0,t.categories.length-1]},parse:function(t){return"string"==typeof t?this._ordinalMeta.getOrdinal(t):Math.round(t)},contain:function(t){return t=this.parse(t),bA.contain.call(this,t)&&null!=this._ordinalMeta.categories[t]},normalize:function(t){return bA.normalize.call(this,this.parse(t))},scale:function(t){return Math.round(bA.scale.call(this,t))},getTicks:function(){for(var t=[],e=this._extent,i=e[0];i<=e[1];)t.push(i),i++;return t},getLabel:function(t){if(!this.isBlank())return this._ordinalMeta.categories[t]},count:function(){return this._extent[1]-this._extent[0]+1},unionExtentFromData:function(t,e){this.unionExtent(t.getApproximateExtent(e))},getOrdinalMeta:function(){return this._ordinalMeta},niceTicks:B,niceExtent:B});SA.create=function(){return new SA};var MA=Go,IA=Go,TA=xl.extend({type:"interval",_interval:0,_intervalPrecision:2,setExtent:function(t,e){var i=this._extent;isNaN(t)||(i[0]=parseFloat(t)),isNaN(e)||(i[1]=parseFloat(e))},unionExtent:function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1]),TA.prototype.setExtent.call(this,e[0],e[1])},getInterval:function(){return this._interval},setInterval:function(t){this._interval=t,this._niceExtent=this._extent.slice(),this._intervalPrecision=Ml(t)},getTicks:function(){return Al(this._interval,this._extent,this._niceExtent,this._intervalPrecision)},getLabel:function(t,e){if(null==t)return"";var i=e&&e.precision;return null==i?i=Ho(t)||0:"auto"===i&&(i=this._intervalPrecision),t=IA(t,i,!0),ta(t)},niceTicks:function(t,e,i){t=t||5;var n=this._extent,o=n[1]-n[0];if(isFinite(o)){o<0&&(o=-o,n.reverse());var a=Sl(n,t,e,i);this._intervalPrecision=a.intervalPrecision,this._interval=a.interval,this._niceExtent=a.niceTickExtent}},niceExtent:function(t){var e=this._extent;if(e[0]===e[1])if(0!==e[0]){var i=e[0];t.fixMax?e[0]-=i/2:(e[1]+=i/2,e[0]-=i/2)}else e[1]=1;var n=e[1]-e[0];isFinite(n)||(e[0]=0,e[1]=1),this.niceTicks(t.splitNumber,t.minInterval,t.maxInterval);var o=this._interval;t.fixMin||(e[0]=IA(Math.floor(e[0]/o)*o)),t.fixMax||(e[1]=IA(Math.ceil(e[1]/o)*o))}});TA.create=function(){return new TA};var AA="__ec_stack_",DA="undefined"!=typeof Float32Array?Float32Array:Array,CA={seriesType:"bar",plan:$I(),reset:function(t){if(Rl(t)&&zl(t)){var e=t.getData(),i=t.coordinateSystem,n=i.getBaseAxis(),o=i.getOtherAxis(n),a=e.mapDimension(o.dim),r=e.mapDimension(n.dim),s=o.isHorizontal(),l=s?0:1,u=Ol(Pl([t]),n,t).width;return u>.5||(u=.5),{progress:function(t,e){for(var n,h=new DA(2*t.count),c=[],d=[],f=0;null!=(n=t.next());)d[l]=e.get(a,n),d[1-l]=e.get(r,n),c=i.dataToPoint(d,null,c),h[f++]=c[0],h[f++]=c[1];e.setLayout({largePoints:h,barWidth:u,valueAxisStart:Bl(0,o),valueAxisHorizontal:s})}}}}},LA=TA.prototype,kA=Math.ceil,PA=Math.floor,NA=function(t,e,i,n){for(;i>>1;t[o][1]i&&(a=i);var r=EA.length,s=NA(EA,a,0,r),l=EA[Math.min(s,r-1)],u=l[1];"year"===l[0]&&(u*=$o(o/u/t,!0));var h=this.getSetting("useUTC")?0:60*new Date(+n[0]||+n[1]).getTimezoneOffset()*1e3,c=[Math.round(kA((n[0]-h)/u)*u+h),Math.round(PA((n[1]-h)/u)*u+h)];Tl(c,n),this._stepLvl=l,this._interval=u,this._niceExtent=c},parse:function(t){return+Yo(t)}});d(["contain","normalize"],function(t){OA.prototype[t]=function(e){return LA[t].call(this,this.parse(e))}});var EA=[["hh:mm:ss",1e3],["hh:mm:ss",5e3],["hh:mm:ss",1e4],["hh:mm:ss",15e3],["hh:mm:ss",3e4],["hh:mm\nMM-dd",6e4],["hh:mm\nMM-dd",3e5],["hh:mm\nMM-dd",6e5],["hh:mm\nMM-dd",9e5],["hh:mm\nMM-dd",18e5],["hh:mm\nMM-dd",36e5],["hh:mm\nMM-dd",72e5],["hh:mm\nMM-dd",216e5],["hh:mm\nMM-dd",432e5],["MM-dd\nyyyy",864e5],["MM-dd\nyyyy",1728e5],["MM-dd\nyyyy",2592e5],["MM-dd\nyyyy",3456e5],["MM-dd\nyyyy",432e6],["MM-dd\nyyyy",5184e5],["week",6048e5],["MM-dd\nyyyy",864e6],["week",12096e5],["week",18144e5],["month",26784e5],["week",36288e5],["month",53568e5],["week",6048e6],["quarter",8208e6],["month",107136e5],["month",13392e6],["half-year",16416e6],["month",214272e5],["month",26784e6],["year",32832e6]];OA.create=function(t){return new OA({useUTC:t.ecModel.get("useUTC")})};var RA=xl.prototype,zA=TA.prototype,BA=Ho,VA=Go,GA=Math.floor,FA=Math.ceil,WA=Math.pow,HA=Math.log,ZA=xl.extend({type:"log",base:10,$constructor:function(){xl.apply(this,arguments),this._originalScale=new TA},getTicks:function(){var t=this._originalScale,e=this._extent,i=t.getExtent();return f(zA.getTicks.call(this),function(n){var o=Go(WA(this.base,n));return o=n===e[0]&&t.__fixMin?Vl(o,i[0]):o,o=n===e[1]&&t.__fixMax?Vl(o,i[1]):o},this)},getLabel:zA.getLabel,scale:function(t){return t=RA.scale.call(this,t),WA(this.base,t)},setExtent:function(t,e){var i=this.base;t=HA(t)/HA(i),e=HA(e)/HA(i),zA.setExtent.call(this,t,e)},getExtent:function(){var t=this.base,e=RA.getExtent.call(this);e[0]=WA(t,e[0]),e[1]=WA(t,e[1]);var i=this._originalScale,n=i.getExtent();return i.__fixMin&&(e[0]=Vl(e[0],n[0])),i.__fixMax&&(e[1]=Vl(e[1],n[1])),e},unionExtent:function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=HA(t[0])/HA(e),t[1]=HA(t[1])/HA(e),RA.unionExtent.call(this,t)},unionExtentFromData:function(t,e){this.unionExtent(t.getApproximateExtent(e))},niceTicks:function(t){t=t||10;var e=this._extent,i=e[1]-e[0];if(!(i===1/0||i<=0)){var n=qo(i);for(t/i*n<=.5&&(n*=10);!isNaN(n)&&Math.abs(n)<1&&Math.abs(n)>0;)n*=10;var o=[Go(FA(e[0]/n)*n),Go(GA(e[1]/n)*n)];this._interval=n,this._niceExtent=o}},niceExtent:function(t){zA.niceExtent.call(this,t);var e=this._originalScale;e.__fixMin=t.fixMin,e.__fixMax=t.fixMax}});d(["contain","normalize"],function(t){ZA.prototype[t]=function(e){return e=HA(e)/HA(this.base),RA[t].call(this,e)}}),ZA.create=function(){return new ZA};var UA={getMin:function(t){var e=this.option,i=t||null==e.rangeStart?e.min:e.rangeStart;return this.axis&&null!=i&&"dataMin"!==i&&"function"!=typeof i&&!I(i)&&(i=this.axis.scale.parse(i)),i},getMax:function(t){var e=this.option,i=t||null==e.rangeEnd?e.max:e.rangeEnd;return this.axis&&null!=i&&"dataMax"!==i&&"function"!=typeof i&&!I(i)&&(i=this.axis.scale.parse(i)),i},getNeedCrossZero:function(){var t=this.option;return null==t.rangeStart&&null==t.rangeEnd&&!t.scale},getCoordSysModel:B,setRange:function(t,e){this.option.rangeStart=t,this.option.rangeEnd=e},resetRange:function(){this.option.rangeStart=this.option.rangeEnd=null}},XA=Un({type:"triangle",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var i=e.cx,n=e.cy,o=e.width/2,a=e.height/2;t.moveTo(i,n-a),t.lineTo(i+o,n+a),t.lineTo(i-o,n+a),t.closePath()}}),jA=Un({type:"diamond",shape:{cx:0,cy:0,width:0,height:0},buildPath:function(t,e){var i=e.cx,n=e.cy,o=e.width/2,a=e.height/2;t.moveTo(i,n-a),t.lineTo(i+o,n),t.lineTo(i,n+a),t.lineTo(i-o,n),t.closePath()}}),YA=Un({type:"pin",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.x,n=e.y,o=e.width/5*3,a=Math.max(o,e.height),r=o/2,s=r*r/(a-r),l=n-a+r+s,u=Math.asin(s/r),h=Math.cos(u)*r,c=Math.sin(u),d=Math.cos(u),f=.6*r,p=.7*r;t.moveTo(i-h,l+s),t.arc(i,l,r,Math.PI-u,2*Math.PI+u),t.bezierCurveTo(i+h-c*f,l+s+d*f,i,n-p,i,n),t.bezierCurveTo(i,n-p,i-h+c*f,l+s+d*f,i-h,l+s),t.closePath()}}),qA=Un({type:"arrow",shape:{x:0,y:0,width:0,height:0},buildPath:function(t,e){var i=e.height,n=e.width,o=e.x,a=e.y,r=n/3*2;t.moveTo(o,a),t.lineTo(o+r,a+i),t.lineTo(o,a+i/4*3),t.lineTo(o-r,a+i),t.lineTo(o,a),t.closePath()}}),KA={line:function(t,e,i,n,o){o.x1=t,o.y1=e+n/2,o.x2=t+i,o.y2=e+n/2},rect:function(t,e,i,n,o){o.x=t,o.y=e,o.width=i,o.height=n},roundRect:function(t,e,i,n,o){o.x=t,o.y=e,o.width=i,o.height=n,o.r=Math.min(i,n)/4},square:function(t,e,i,n,o){var a=Math.min(i,n);o.x=t,o.y=e,o.width=a,o.height=a},circle:function(t,e,i,n,o){o.cx=t+i/2,o.cy=e+n/2,o.r=Math.min(i,n)/2},diamond:function(t,e,i,n,o){o.cx=t+i/2,o.cy=e+n/2,o.width=i,o.height=n},pin:function(t,e,i,n,o){o.x=t+i/2,o.y=e+n/2,o.width=i,o.height=n},arrow:function(t,e,i,n,o){o.x=t+i/2,o.y=e+n/2,o.width=i,o.height=n},triangle:function(t,e,i,n,o){o.cx=t+i/2,o.cy=e+n/2,o.width=i,o.height=n}},$A={};d({line:_M,rect:yM,roundRect:yM,square:yM,circle:sM,diamond:jA,pin:YA,arrow:qA,triangle:XA},function(t,e){$A[e]=new t});var JA=Un({type:"symbol",shape:{symbolType:"",x:0,y:0,width:0,height:0},beforeBrush:function(){var t=this.style;"pin"===this.shape.symbolType&&"inside"===t.textPosition&&(t.textPosition=["50%","40%"],t.textAlign="center",t.textVerticalAlign="middle")},buildPath:function(t,e,i){var n=e.symbolType,o=$A[n];"none"!==e.symbolType&&(o||(o=$A[n="rect"]),KA[n](e.x,e.y,e.width,e.height,o.shape),o.buildPath(t,o.shape,i))}}),QA={isDimensionStacked:pl,enableDataStack:fl,getStackedDimension:gl},tD=(Object.freeze||Object)({createList:function(t){return ml(t.getSource(),t)},getLayoutRect:ca,dataStack:QA,createScale:function(t,e){var i=e;No.isInstance(e)||h(i=new No(e),UA);var n=Hl(i);return n.setExtent(t[0],t[1]),Wl(n,i),n},mixinAxisModelCommonMethods:function(t){h(t,UA)},completeDimensions:hl,createDimensions:_A,createSymbol:Jl}),eD=1e-8;eu.prototype={constructor:eu,properties:null,getBoundingRect:function(){var t=this._rect;if(t)return t;for(var e=Number.MAX_VALUE,i=[e,e],n=[-e,-e],o=[],a=[],r=this.geometries,s=0;s0}),function(t){var e=t.properties,i=t.geometry,n=i.coordinates,o=[];"Polygon"===i.type&&o.push({type:"polygon",exterior:n[0],interiors:n.slice(1)}),"MultiPolygon"===i.type&&d(n,function(t){t[0]&&o.push({type:"polygon",exterior:t[0],interiors:t.slice(1)})});var a=new eu(e.name,o,e.cp);return a.properties=e,a})},nD=Bi(),oD=[0,1],aD=function(t,e,i){this.dim=t,this.scale=e,this._extent=i||[0,0],this.inverse=!1,this.onBand=!1};aD.prototype={constructor:aD,contain:function(t){var e=this._extent,i=Math.min(e[0],e[1]),n=Math.max(e[0],e[1]);return t>=i&&t<=n},containData:function(t){return this.contain(this.dataToCoord(t))},getExtent:function(){return this._extent.slice()},getPixelPrecision:function(t){return Zo(t||this.scale.getExtent(),this._extent)},setExtent:function(t,e){var i=this._extent;i[0]=t,i[1]=e},dataToCoord:function(t,e){var i=this._extent,n=this.scale;return t=n.normalize(t),this.onBand&&"ordinal"===n.type&&yu(i=i.slice(),n.count()),Bo(t,oD,i,e)},coordToData:function(t,e){var i=this._extent,n=this.scale;this.onBand&&"ordinal"===n.type&&yu(i=i.slice(),n.count());var o=Bo(t,i,oD,e);return this.scale.scale(o)},pointToData:function(t,e){},getTicksCoords:function(t){var e=(t=t||{}).tickModel||this.getTickModel(),i=au(this,e),n=f(i.ticks,function(t){return{coord:this.dataToCoord(t),tickValue:t}},this),o=e.get("alignWithLabel");return xu(this,n,i.tickCategoryInterval,o,t.clamp),n},getViewLabels:function(){return ou(this).labels},getLabelModel:function(){return this.model.getModel("axisLabel")},getTickModel:function(){return this.model.getModel("axisTick")},getBandWidth:function(){var t=this._extent,e=this.scale.getExtent(),i=e[1]-e[0]+(this.onBand?1:0);0===i&&(i=1);var n=Math.abs(t[1]-t[0]);return Math.abs(n)/i},isHorizontal:null,getRotate:null,calculateCategoryInterval:function(){return pu(this)}};var rD=iD,sD={};d(["map","each","filter","indexOf","inherits","reduce","filter","bind","curry","isArray","isString","isObject","isFunction","extend","defaults","clone","merge"],function(t){sD[t]=aw[t]});var lD={};d(["extendShape","extendPath","makePath","makeImage","mergePath","resizePath","createIcon","setHoverStyle","setLabelStyle","setTextStyle","setText","getFont","updateProps","initProps","getTransform","clipPointsByRect","clipRectByRect","Group","Image","Text","Circle","Sector","Ring","Polygon","Polyline","Rect","Line","BezierCurve","Arc","IncrementalDisplayable","CompoundPath","LinearGradient","RadialGradient","BoundingRect"],function(t){lD[t]=zM[t]}),YI.extend({type:"series.line",dependencies:["grid","polar"],getInitialData:function(t,e){return ml(this.getSource(),this)},defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,clipOverflow:!0,label:{position:"top"},lineStyle:{width:2,type:"solid"},step:!1,smooth:!1,smoothMonotone:null,symbol:"emptyCircle",symbolSize:4,symbolRotate:null,showSymbol:!0,showAllSymbol:"auto",connectNulls:!1,sampling:"none",animationEasing:"linear",progressive:0,hoverLayerThreshold:1/0}});var uD=wu.prototype,hD=wu.getSymbolSize=function(t,e){var i=t.getItemVisual(e,"symbolSize");return i instanceof Array?i.slice():[+i,+i]};uD._createSymbol=function(t,e,i,n,o){this.removeAll();var a=Jl(t,-1,-1,2,2,e.getItemVisual(i,"color"),o);a.attr({z2:100,culling:!0,scale:bu(n)}),a.drift=Su,this._symbolType=t,this.add(a)},uD.stopSymbolAnimation=function(t){this.childAt(0).stopAnimation(t)},uD.getSymbolPath=function(){return this.childAt(0)},uD.getScale=function(){return this.childAt(0).scale},uD.highlight=function(){this.childAt(0).trigger("emphasis")},uD.downplay=function(){this.childAt(0).trigger("normal")},uD.setZ=function(t,e){var i=this.childAt(0);i.zlevel=t,i.z=e},uD.setDraggable=function(t){var e=this.childAt(0);e.draggable=t,e.cursor=t?"move":"pointer"},uD.updateData=function(t,e,i){this.silent=!1;var n=t.getItemVisual(e,"symbol")||"circle",o=t.hostModel,a=hD(t,e),r=n!==this._symbolType;if(r){var s=t.getItemVisual(e,"symbolKeepAspect");this._createSymbol(n,t,e,a,s)}else(l=this.childAt(0)).silent=!1,Io(l,{scale:bu(a)},o,e);if(this._updateCommon(t,e,a,i),r){var l=this.childAt(0),u=i&&i.fadeIn,h={scale:l.scale.slice()};u&&(h.style={opacity:l.style.opacity}),l.scale=[0,0],u&&(l.style.opacity=0),To(l,h,o,e)}this._seriesModel=o};var cD=["itemStyle"],dD=["emphasis","itemStyle"],fD=["label"],pD=["emphasis","label"];uD._updateCommon=function(t,e,i,n){var o=this.childAt(0),r=t.hostModel,s=t.getItemVisual(e,"color");"image"!==o.type&&o.useStyle({strokeNoScale:!0});var l=n&&n.itemStyle,u=n&&n.hoverItemStyle,h=n&&n.symbolRotate,c=n&&n.symbolOffset,d=n&&n.labelModel,f=n&&n.hoverLabelModel,p=n&&n.hoverAnimation,g=n&&n.cursorStyle;if(!n||t.hasItemOption){var m=n&&n.itemModel?n.itemModel:t.getItemModel(e);l=m.getModel(cD).getItemStyle(["color"]),u=m.getModel(dD).getItemStyle(),h=m.getShallow("symbolRotate"),c=m.getShallow("symbolOffset"),d=m.getModel(fD),f=m.getModel(pD),p=m.getShallow("hoverAnimation"),g=m.getShallow("cursor")}else u=a({},u);var v=o.style;o.attr("rotation",(h||0)*Math.PI/180||0),c&&o.attr("position",[Vo(c[0],i[0]),Vo(c[1],i[1])]),g&&o.attr("cursor",g),o.setColor(s,n&&n.symbolInnerColor),o.setStyle(l);var y=t.getItemVisual(e,"opacity");null!=y&&(v.opacity=y);var x=t.getItemVisual(e,"liftZ"),_=o.__z2Origin;null!=x?null==_&&(o.__z2Origin=o.z2,o.z2+=x):null!=_&&(o.z2=_,o.__z2Origin=null);var w=n&&n.useNameLabel;go(v,u,d,f,{labelFetcher:r,labelDataIndex:e,defaultText:function(e,i){return w?t.getName(e):_u(t,e)},isRectText:!0,autoColor:s}),o.off("mouseover").off("mouseout").off("emphasis").off("normal"),o.hoverStyle=u,fo(o),o.__symbolOriginalScale=bu(i),p&&r.isAnimationEnabled()&&o.on("mouseover",Mu).on("mouseout",Iu).on("emphasis",Tu).on("normal",Au)},uD.fadeOut=function(t,e){var i=this.childAt(0);this.silent=i.silent=!0,!(e&&e.keepLabel)&&(i.style.text=null),Io(i,{style:{opacity:0},scale:[0,0]},this._seriesModel,this.dataIndex,t)},u(wu,tb);var gD=Du.prototype;gD.updateData=function(t,e){e=Lu(e);var i=this.group,n=t.hostModel,o=this._data,a=this._symbolCtor,r=ku(t);o||i.removeAll(),t.diff(o).add(function(n){var o=t.getItemLayout(n);if(Cu(t,o,n,e)){var s=new a(t,n,r);s.attr("position",o),t.setItemGraphicEl(n,s),i.add(s)}}).update(function(s,l){var u=o.getItemGraphicEl(l),h=t.getItemLayout(s);Cu(t,h,s,e)?(u?(u.updateData(t,s,r),Io(u,{position:h},n)):(u=new a(t,s)).attr("position",h),i.add(u),t.setItemGraphicEl(s,u)):i.remove(u)}).remove(function(t){var e=o.getItemGraphicEl(t);e&&e.fadeOut(function(){i.remove(e)})}).execute(),this._data=t},gD.isPersistent=function(){return!0},gD.updateLayout=function(){var t=this._data;t&&t.eachItemGraphicEl(function(e,i){var n=t.getItemLayout(i);e.attr("position",n)})},gD.incrementalPrepareUpdate=function(t){this._seriesScope=ku(t),this._data=null,this.group.removeAll()},gD.incrementalUpdate=function(t,e,i){i=Lu(i);for(var n=t.start;n0&&Ru(i[o-1]);o--);for(;n0&&Ru(i[a-1]);a--);for(;o=0){var r=o.getItemGraphicEl(a);if(!r){var s=o.getItemLayout(a);if(!s)return;(r=new wu(o,a)).position=s,r.setZ(t.get("zlevel"),t.get("z")),r.ignore=isNaN(s[0])||isNaN(s[1]),r.__temp=!0,o.setItemGraphicEl(a,r),r.stopSymbolAnimation(!0),this.group.add(r)}r.highlight()}else Ar.prototype.highlight.call(this,t,e,i,n)},downplay:function(t,e,i,n){var o=t.getData(),a=zi(o,n);if(null!=a&&a>=0){var r=o.getItemGraphicEl(a);r&&(r.__temp?(o.setItemGraphicEl(a,null),this.group.remove(r)):r.downplay())}else Ar.prototype.downplay.call(this,t,e,i,n)},_newPolyline:function(t){var e=this._polyline;return e&&this._lineGroup.remove(e),e=new MD({shape:{points:t},silent:!0,z2:10}),this._lineGroup.add(e),this._polyline=e,e},_newPolygon:function(t,e){var i=this._polygon;return i&&this._lineGroup.remove(i),i=new ID({shape:{points:t,stackedOnPoints:e},silent:!0}),this._lineGroup.add(i),this._polygon=i,i},_updateAnimation:function(t,e,i,n,o,a){var r=this._polyline,s=this._polygon,l=t.hostModel,u=mD(this._data,t,this._stackedOnPoints,e,this._coordSys,i,this._valueOrigin,a),h=u.current,c=u.stackedOnCurrent,d=u.next,f=u.stackedOnNext;o&&(h=Yu(u.current,i,o),c=Yu(u.stackedOnCurrent,i,o),d=Yu(u.next,i,o),f=Yu(u.stackedOnNext,i,o)),r.shape.__points=u.current,r.shape.points=h,Io(r,{shape:{points:d}},l),s&&(s.setShape({points:h,stackedOnPoints:c}),Io(s,{shape:{points:d,stackedOnPoints:f}},l));for(var p=[],g=u.status,m=0;me&&(e=t[i]);return isFinite(e)?e:NaN},min:function(t){for(var e=1/0,i=0;ie[1]&&e.reverse(),e},getOtherAxis:function(){this.grid.getOtherAxis()},pointToData:function(t,e){return this.coordToData(this.toLocalCoord(t["x"===this.dim?0:1]),e)},toLocalCoord:null,toGlobalCoord:null},u(kD,aD);var PD={show:!0,zlevel:0,z:0,inverse:!1,name:"",nameLocation:"end",nameRotate:null,nameTruncate:{maxWidth:null,ellipsis:"...",placeholder:"."},nameTextStyle:{},nameGap:15,silent:!1,triggerEvent:!1,tooltip:{show:!1},axisPointer:{},axisLine:{show:!0,onZero:!0,onZeroAxisIndex:null,lineStyle:{color:"#333",width:1,type:"solid"},symbol:["none","none"],symbolSize:[10,15]},axisTick:{show:!0,inside:!1,length:5,lineStyle:{width:1}},axisLabel:{show:!0,inside:!1,rotate:0,showMinLabel:null,showMaxLabel:null,margin:8,fontSize:12},splitLine:{show:!0,lineStyle:{color:["#ccc"],width:1,type:"solid"}},splitArea:{show:!1,areaStyle:{color:["rgba(250,250,250,0.3)","rgba(200,200,200,0.3)"]}}},ND={};ND.categoryAxis=n({boundaryGap:!0,deduplication:null,splitLine:{show:!1},axisTick:{alignWithLabel:!1,interval:"auto"},axisLabel:{interval:"auto"}},PD),ND.valueAxis=n({boundaryGap:[0,0],splitNumber:5},PD),ND.timeAxis=r({scale:!0,min:"dataMin",max:"dataMax"},ND.valueAxis),ND.logAxis=r({scale:!0,logBase:10},ND.valueAxis);var OD=["value","category","time","log"],ED=function(t,e,i,a){d(OD,function(r){e.extend({type:t+"Axis."+r,mergeDefaultAndTheme:function(e,o){var a=this.layoutMode,s=a?ga(e):{};n(e,o.getTheme().get(r+"Axis")),n(e,this.getDefaultOption()),e.type=i(t,e),a&&pa(e,s,a)},optionUpdated:function(){"category"===this.option.type&&(this.__ordinalMeta=_l.createByAxisModel(this))},getCategories:function(t){var e=this.option;if("category"===e.type)return t?e.data:this.__ordinalMeta.categories},getOrdinalMeta:function(){return this.__ordinalMeta},defaultOption:o([{},ND[r+"Axis"],a],!0)})}),lI.registerSubTypeDefaulter(t+"Axis",v(i,t))},RD=lI.extend({type:"cartesian2dAxis",axis:null,init:function(){RD.superApply(this,"init",arguments),this.resetRange()},mergeOption:function(){RD.superApply(this,"mergeOption",arguments),this.resetRange()},restoreData:function(){RD.superApply(this,"restoreData",arguments),this.resetRange()},getCoordSysModel:function(){return this.ecModel.queryComponents({mainType:"grid",index:this.option.gridIndex,id:this.option.gridId})[0]}});n(RD.prototype,UA);var zD={offset:0};ED("x",RD,th,zD),ED("y",RD,th,zD),lI.extend({type:"grid",dependencies:["xAxis","yAxis"],layoutMode:"box",coordinateSystem:null,defaultOption:{show:!1,zlevel:0,z:0,left:"10%",top:60,right:"10%",bottom:60,containLabel:!1,backgroundColor:"rgba(0,0,0,0)",borderWidth:1,borderColor:"#ccc"}});var BD=ih.prototype;BD.type="grid",BD.axisPointerEnabled=!0,BD.getRect=function(){return this._rect},BD.update=function(t,e){var i=this._axesMap;this._updateScale(t,this.model),d(i.x,function(t){Wl(t.scale,t.model)}),d(i.y,function(t){Wl(t.scale,t.model)});var n={};d(i.x,function(t){nh(i,"y",t,n)}),d(i.y,function(t){nh(i,"x",t,n)}),this.resize(this.model,e)},BD.resize=function(t,e,i){function n(){d(a,function(t){var e=t.isHorizontal(),i=e?[0,o.width]:[0,o.height],n=t.inverse?1:0;t.setExtent(i[n],i[1-n]),ah(t,e?o.x:o.y)})}var o=ca(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()});this._rect=o;var a=this._axesList;n(),!i&&t.get("containLabel")&&(d(a,function(t){if(!t.model.get("axisLabel.inside")){var e=jl(t);if(e){var i=t.isHorizontal()?"height":"width",n=t.model.get("axisLabel.margin");o[i]-=e[i]+n,"top"===t.position?o.y+=e.height+n:"left"===t.position&&(o.x+=e.width+n)}}}),n())},BD.getAxis=function(t,e){var i=this._axesMap[t];if(null!=i){if(null==e)for(var n in i)if(i.hasOwnProperty(n))return i[n];return i[e]}},BD.getAxes=function(){return this._axesList.slice()},BD.getCartesian=function(t,e){if(null!=t&&null!=e){var i="x"+t+"y"+e;return this._coordsMap[i]}w(t)&&(e=t.yAxisIndex,t=t.xAxisIndex);for(var n=0,o=this._coordsList;nu[1]?-1:1,c=["start"===o?u[0]-h*l:"end"===o?u[1]+h*l:(u[0]+u[1])/2,ph(o)?t.labelOffset+r*l:0],d=e.get("nameRotate");null!=d&&(d=d*GD/180);var f;ph(o)?n=HD(t.rotation,null!=d?d:t.rotation,r):(n=uh(t,o,d||0,u),null!=(f=t.axisNameAvailableWidth)&&(f=Math.abs(f/Math.sin(n.rotation)),!isFinite(f)&&(f=null)));var p=s.getFont(),g=e.get("nameTruncate",!0)||{},m=g.ellipsis,v=T(t.nameTruncateMaxWidth,g.maxWidth,f),y=null!=m&&null!=v?tI(i,v,p,m,{minChar:2,placeholder:g.placeholder}):i,x=e.get("tooltip",!0),_=e.mainType,w={componentType:_,name:i,$vars:["name"]};w[_+"Index"]=e.componentIndex;var b=new rM({anid:"name",__fullText:i,__truncatedText:y,position:c,rotation:n.rotation,silent:hh(e),z2:1,tooltip:x&&x.show?a({content:i,formatter:function(){return i},formatterParams:w},x):null});mo(b.style,s,{text:y,textFont:p,textFill:s.getTextColor()||e.get("axisLine.lineStyle.color"),textAlign:n.textAlign,textVerticalAlign:n.textVerticalAlign}),e.get("triggerEvent")&&(b.eventData=lh(e),b.eventData.targetType="axisName",b.eventData.name=i),this._dumbGroup.add(b),b.updateTransform(),this.group.add(b),b.decomposeTransform()}}},HD=FD.innerTextLayout=function(t,e,i){var n,o,a=Xo(e-t);return jo(a)?(o=i>0?"top":"bottom",n="center"):jo(a-GD)?(o=i>0?"bottom":"top",n="center"):(o="middle",n=a>0&&a0?"right":"left":i>0?"left":"right"),{rotation:a,textAlign:n,textVerticalAlign:o}},ZD=d,UD=v,XD=Ws({type:"axis",_axisPointer:null,axisPointerClass:null,render:function(t,e,i,n){this.axisPointerClass&&Sh(t),XD.superApply(this,"render",arguments),Dh(this,t,0,i,0,!0)},updateAxisPointer:function(t,e,i,n,o){Dh(this,t,0,i,0,!1)},remove:function(t,e){var i=this._axisPointer;i&&i.remove(e),XD.superApply(this,"remove",arguments)},dispose:function(t,e){Ch(this,e),XD.superApply(this,"dispose",arguments)}}),jD=[];XD.registerAxisPointerClass=function(t,e){jD[t]=e},XD.getAxisPointerClass=function(t){return t&&jD[t]};var YD=["axisLine","axisTickLabel","axisName"],qD=["splitArea","splitLine"],KD=XD.extend({type:"cartesianAxis",axisPointerClass:"CartesianAxisPointer",render:function(t,e,i,n){this.group.removeAll();var o=this._axisGroup;if(this._axisGroup=new tb,this.group.add(this._axisGroup),t.get("show")){var a=t.getCoordSysModel(),r=Lh(a,t),s=new FD(t,r);d(YD,s.add,s),this._axisGroup.add(s.getGroup()),d(qD,function(e){t.get(e+".show")&&this["_"+e](t,a)},this),Lo(o,this._axisGroup,t),KD.superCall(this,"render",t,e,i,n)}},remove:function(){this._splitAreaColors=null},_splitLine:function(t,e){var i=t.axis;if(!i.scale.isBlank()){var n=t.getModel("splitLine"),o=n.getModel("lineStyle"),a=o.get("color");a=y(a)?a:[a];for(var s=e.coordinateSystem.getRect(),l=i.isHorizontal(),u=0,h=i.getTicksCoords({tickModel:n}),c=[],d=[],f=o.getLineStyle(),p=0;p1){var c;"string"==typeof o?c=DD[o]:"function"==typeof o&&(c=o),c&&t.setData(n.downSample(n.mapDimension(s.dim),1/h,c,CD))}}}}}("line"));var $D=YI.extend({type:"series.__base_bar__",getInitialData:function(t,e){return ml(this.getSource(),this)},getMarkerPosition:function(t){var e=this.coordinateSystem;if(e){var i=e.dataToPoint(e.clampData(t)),n=this.getData(),o=n.getLayout("offset"),a=n.getLayout("size");return i[e.getBaseAxis().isHorizontal()?0:1]+=o+a/2,i}return[NaN,NaN]},defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,barMinHeight:0,barMinAngle:0,large:!1,largeThreshold:400,progressive:3e3,progressiveChunkMode:"mod",itemStyle:{},emphasis:{}}});$D.extend({type:"series.bar",dependencies:["grid","polar"],brushSelector:"rect",getProgressive:function(){return!!this.get("large")&&this.get("progressive")},getProgressiveThreshold:function(){var t=this.get("progressiveThreshold"),e=this.get("largeThreshold");return e>t&&(t=e),t}});var JD=Qb([["fill","color"],["stroke","borderColor"],["lineWidth","borderWidth"],["stroke","barBorderColor"],["lineWidth","barBorderWidth"],["opacity"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]),QD={getBarItemStyle:function(t){var e=JD(this,t);if(this.getBorderLineDash){var i=this.getBorderLineDash();i&&(e.lineDash=i)}return e}},tC=["itemStyle","barBorderWidth"];a(No.prototype,QD),Zs({type:"bar",render:function(t,e,i){this._updateDrawMode(t);var n=t.get("coordinateSystem");return"cartesian2d"!==n&&"polar"!==n||(this._isLargeDraw?this._renderLarge(t,e,i):this._renderNormal(t,e,i)),this.group},incrementalPrepareRender:function(t,e,i){this._clear(),this._updateDrawMode(t)},incrementalRender:function(t,e,i,n){this._incrementalRenderLarge(t,e)},_updateDrawMode:function(t){var e=t.pipelineContext.large;(null==this._isLargeDraw||e^this._isLargeDraw)&&(this._isLargeDraw=e,this._clear())},_renderNormal:function(t,e,i){var n,o=this.group,a=t.getData(),r=this._data,s=t.coordinateSystem,l=s.getBaseAxis();"cartesian2d"===s.type?n=l.isHorizontal():"polar"===s.type&&(n="angle"===l.dim);var u=t.isAnimationEnabled()?t:null;a.diff(r).add(function(e){if(a.hasValue(e)){var i=a.getItemModel(e),r=iC[s.type](a,e,i),l=eC[s.type](a,e,i,r,n,u);a.setItemGraphicEl(e,l),o.add(l),Eh(l,a,e,i,r,t,n,"polar"===s.type)}}).update(function(e,i){var l=r.getItemGraphicEl(i);if(a.hasValue(e)){var h=a.getItemModel(e),c=iC[s.type](a,e,h);l?Io(l,{shape:c},u,e):l=eC[s.type](a,e,h,c,n,u,!0),a.setItemGraphicEl(e,l),o.add(l),Eh(l,a,e,h,c,t,n,"polar"===s.type)}else o.remove(l)}).remove(function(t){var e=r.getItemGraphicEl(t);"cartesian2d"===s.type?e&&Nh(t,u,e):e&&Oh(t,u,e)}).execute(),this._data=a},_renderLarge:function(t,e,i){this._clear(),zh(t,this.group)},_incrementalRenderLarge:function(t,e){zh(e,this.group,!0)},dispose:B,remove:function(t){this._clear(t)},_clear:function(t){var e=this.group,i=this._data;t&&t.get("animation")&&i&&!this._isLargeDraw?i.eachItemGraphicEl(function(e){"sector"===e.type?Oh(e.dataIndex,t,e):Nh(e.dataIndex,t,e)}):e.removeAll(),this._data=null}});var eC={cartesian2d:function(t,e,i,n,o,r,s){var l=new yM({shape:a({},n)});if(r){var u=l.shape,h=o?"height":"width",c={};u[h]=0,c[h]=n[h],zM[s?"updateProps":"initProps"](l,{shape:c},r,e)}return l},polar:function(t,e,i,n,o,a,s){var l=n.startAngle0?1:-1,r=n.height>0?1:-1;return{x:n.x+a*o/2,y:n.y+r*o/2,width:n.width-a*o,height:n.height-r*o}},polar:function(t,e,i){var n=t.getItemLayout(e);return{cx:n.cx,cy:n.cy,r0:n.r0,r:n.r,startAngle:n.startAngle,endAngle:n.endAngle}}},nC=Pn.extend({type:"largeBar",shape:{points:[]},buildPath:function(t,e){for(var i=e.points,n=this.__startPoint,o=this.__valueIdx,a=0;a0&&"scale"!==u){var d=o.getItemLayout(0),f=Math.max(i.getWidth(),i.getHeight())/2,p=m(r.removeClipPath,r);r.setClipPath(this._createClipPath(d.cx,d.cy,f,d.startAngle,d.clockwise,p,t))}else r.removeClipPath();this._data=o}},dispose:function(){},_createClipPath:function(t,e,i,n,o,a,r){var s=new hM({shape:{cx:t,cy:e,r0:0,r:i,startAngle:n,endAngle:n,clockwise:o}});return To(s,{shape:{endAngle:n+(o?1:-1)*Math.PI*2}},r,a),s},containPoint:function(t,e){var i=e.getData().getItemLayout(0);if(i){var n=t[0]-i.cx,o=t[1]-i.cy,a=Math.sqrt(n*n+o*o);return a<=i.r&&a>=i.r0}}});var lC=function(t,e){d(e,function(e){e.update="updateView",Es(e,function(i,n){var o={};return n.eachComponent({mainType:"series",subType:t,query:i},function(t){t[e.method]&&t[e.method](i.name,i.dataIndex);var n=t.getData();n.each(function(e){var i=n.getName(e);o[i]=t.isSelected(i)||!1})}),{name:i.name,selected:o}})})},uC=function(t){return{getTargetSeries:function(e){var i={},n=R();return e.eachSeriesByType(t,function(t){t.__paletteScope=i,n.set(t.uid,t)}),n},reset:function(t,e){var i=t.getRawData(),n={},o=t.getData();o.each(function(t){var e=o.getRawIndex(t);n[e]=t}),i.each(function(e){var a=n[e],r=null!=a&&o.getItemVisual(a,"color",!0);if(r)i.setItemVisual(e,"color",r);else{var s=i.getItemModel(e).get("itemStyle.color")||t.getColorFromPalette(i.getName(e)||e+"",t.__paletteScope,i.count());i.setItemVisual(e,"color",s),null!=a&&o.setItemVisual(a,"color",s)}})}}},hC=function(t,e,i,n){var o,a,r=t.getData(),s=[],l=!1;r.each(function(i){var n,u,h,c,d=r.getItemLayout(i),f=r.getItemModel(i),p=f.getModel("label"),g=p.get("position")||f.get("emphasis.label.position"),m=f.getModel("labelLine"),v=m.get("length"),y=m.get("length2"),x=(d.startAngle+d.endAngle)/2,_=Math.cos(x),w=Math.sin(x);o=d.cx,a=d.cy;var b="inside"===g||"inner"===g;if("center"===g)n=d.cx,u=d.cy,c="center";else{var S=(b?(d.r+d.r0)/2*_:d.r*_)+o,M=(b?(d.r+d.r0)/2*w:d.r*w)+a;if(n=S+3*_,u=M+3*w,!b){var I=S+_*(v+e-d.r),T=M+w*(v+e-d.r),A=I+(_<0?-1:1)*y,D=T;n=A+(_<0?-5:5),u=D,h=[[S,M],[I,T],[A,D]]}c=b?"center":_>0?"left":"right"}var C=p.getFont(),L=p.get("rotate")?_<0?-x+Math.PI:-x:0,k=ke(t.getFormattedLabel(i,"normal")||r.getName(i),C,c,"top");l=!!L,d.label={x:n,y:u,position:g,height:k.height,len:v,len2:y,linePoints:h,textAlign:c,verticalAlign:"middle",rotation:L,inside:b},b||s.push(d.label)}),!l&&t.get("avoidLabelOverlap")&&Hh(s,o,a,e,i,n)},cC=2*Math.PI,dC=Math.PI/180,fC=function(t){return{seriesType:t,reset:function(t,e){var i=e.findComponents({mainType:"legend"});if(i&&i.length){var n=t.getData();n.filterSelf(function(t){for(var e=n.getName(t),o=0;o=0;s--){var l=2*s,u=n[l]-a/2,h=n[l+1]-r/2;if(t>=u&&e>=h&&t<=u+a&&e<=h+r)return s}return-1}}),gC=Uh.prototype;gC.isPersistent=function(){return!this._incremental},gC.updateData=function(t){this.group.removeAll();var e=new pC({rectHover:!0,cursor:"default"});e.setShape({points:t.getLayout("symbolPoints")}),this._setCommon(e,t),this.group.add(e),this._incremental=null},gC.updateLayout=function(t){if(!this._incremental){var e=t.getLayout("symbolPoints");this.group.eachChild(function(t){if(null!=t.startIndex){var i=2*(t.endIndex-t.startIndex),n=4*t.startIndex*2;e=new Float32Array(e.buffer,n,i)}t.setShape("points",e)})}},gC.incrementalPrepareUpdate=function(t){this.group.removeAll(),this._clearIncremental(),t.count()>2e6?(this._incremental||(this._incremental=new Zn({silent:!0})),this.group.add(this._incremental)):this._incremental=null},gC.incrementalUpdate=function(t,e){var i;this._incremental?(i=new pC,this._incremental.addDisplayable(i,!0)):((i=new pC({rectHover:!0,cursor:"default",startIndex:t.start,endIndex:t.end})).incremental=!0,this.group.add(i)),i.setShape({points:e.getLayout("symbolPoints")}),this._setCommon(i,e,!!this._incremental)},gC._setCommon=function(t,e,i){var n=e.hostModel,o=e.getVisual("symbolSize");t.setShape("size",o instanceof Array?o:[o,o]),t.symbolProxy=Jl(e.getVisual("symbol"),0,0,0,0),t.setColor=t.symbolProxy.setColor;var a=t.shape.size[0]<4;t.useStyle(n.getModel("itemStyle").getItemStyle(a?["color","shadowBlur","shadowColor"]:["color"]));var r=e.getVisual("color");r&&t.setColor(r),i||(t.seriesIndex=n.seriesIndex,t.on("mousemove",function(e){t.dataIndex=null;var i=t.findDataIndex(e.offsetX,e.offsetY);i>=0&&(t.dataIndex=i+(t.startIndex||0))}))},gC.remove=function(){this._clearIncremental(),this._incremental=null,this.group.removeAll()},gC._clearIncremental=function(){var t=this._incremental;t&&t.clearDisplaybles()},Zs({type:"scatter",render:function(t,e,i){var n=t.getData();this._updateSymbolDraw(n,t).updateData(n),this._finished=!0},incrementalPrepareRender:function(t,e,i){var n=t.getData();this._updateSymbolDraw(n,t).incrementalPrepareUpdate(n),this._finished=!1},incrementalRender:function(t,e,i){this._symbolDraw.incrementalUpdate(t,e.getData()),this._finished=t.end===e.getData().count()},updateTransform:function(t,e,i){var n=t.getData();if(this.group.dirty(),!this._finished||n.count()>1e4||!this._symbolDraw.isPersistent())return{update:!0};var o=AD().reset(t);o.progress&&o.progress({start:0,end:n.count()},n),this._symbolDraw.updateLayout(n)},_updateSymbolDraw:function(t,e){var i=this._symbolDraw,n=e.pipelineContext.large;return i&&n===this._isLargeDraw||(i&&i.remove(),i=this._symbolDraw=n?new Uh:new Du,this._isLargeDraw=n,this.group.removeAll()),this.group.add(i.group),i},remove:function(t,e){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},dispose:function(){}}),Bs(TD("scatter","circle")),zs(AD("scatter")),u(Xh,aD),jh.prototype.getIndicatorAxes=function(){return this._indicatorAxes},jh.prototype.dataToPoint=function(t,e){var i=this._indicatorAxes[e];return this.coordToPoint(i.dataToCoord(t),e)},jh.prototype.coordToPoint=function(t,e){var i=this._indicatorAxes[e].angle;return[this.cx+t*Math.cos(i),this.cy-t*Math.sin(i)]},jh.prototype.pointToData=function(t){var e=t[0]-this.cx,i=t[1]-this.cy,n=Math.sqrt(e*e+i*i);e/=n,i/=n;for(var o,a=Math.atan2(-i,e),r=1/0,s=-1,l=0;ln[0]&&isFinite(c)&&isFinite(n[0]))}else{r.getTicks().length-1>a&&(u=i(u));var d=Math.round((n[0]+n[1])/2/u)*u,f=Math.round(a/2);r.setExtent(Go(d-f*u),Go(d+(a-f)*u)),r.setInterval(u)}})},jh.dimensions=[],jh.create=function(t,e){var i=[];return t.eachComponent("radar",function(n){var o=new jh(n,t,e);i.push(o),n.coordinateSystem=o}),t.eachSeriesByType("radar",function(t){"radar"===t.get("coordinateSystem")&&(t.coordinateSystem=i[t.get("radarIndex")||0])}),i},Fa.register("radar",jh);var mC=ND.valueAxis,vC=(Fs({type:"radar",optionUpdated:function(){var t=this.get("boundaryGap"),e=this.get("splitNumber"),o=this.get("scale"),s=this.get("axisLine"),l=this.get("axisTick"),u=this.get("axisLabel"),h=this.get("name"),c=this.get("name.show"),d=this.get("name.formatter"),p=this.get("nameGap"),g=this.get("triggerEvent"),m=f(this.get("indicator")||[],function(f){null!=f.max&&f.max>0&&!f.min?f.min=0:null!=f.min&&f.min<0&&!f.max&&(f.max=0);var m=h;if(null!=f.color&&(m=r({color:f.color},h)),f=n(i(f),{boundaryGap:t,splitNumber:e,scale:o,axisLine:s,axisTick:l,axisLabel:u,name:f.text,nameLocation:"end",nameGap:p,nameTextStyle:m,triggerEvent:g},!1),c||(f.name=""),"string"==typeof d){var v=f.name;f.name=d.replace("{value}",null!=v?v:"")}else"function"==typeof d&&(f.name=d(f.name,f));var y=a(new No(f,null,this.ecModel),UA);return y.mainType="radar",y.componentIndex=this.componentIndex,y},this);this.getIndicatorModels=function(){return m}},defaultOption:{zlevel:0,z:0,center:["50%","50%"],radius:"75%",startAngle:90,name:{show:!0},boundaryGap:[0,0],splitNumber:5,nameGap:15,scale:!1,shape:"polygon",axisLine:n({lineStyle:{color:"#bbb"}},mC.axisLine),axisLabel:Yh(mC.axisLabel,!1),axisTick:Yh(mC.axisTick,!1),splitLine:Yh(mC.splitLine,!0),splitArea:Yh(mC.splitArea,!0),indicator:[]}}),["axisLine","axisTickLabel","axisName"]);Ws({type:"radar",render:function(t,e,i){this.group.removeAll(),this._buildAxes(t),this._buildSplitLineAndArea(t)},_buildAxes:function(t){var e=t.coordinateSystem;d(f(e.getIndicatorAxes(),function(t){return new FD(t.model,{position:[e.cx,e.cy],rotation:t.angle,labelDirection:-1,tickDirection:-1,nameDirection:1})}),function(t){d(vC,t.add,t),this.group.add(t.getGroup())},this)},_buildSplitLineAndArea:function(t){function e(t,e,i){var n=i%e.length;return t[n]=t[n]||[],n}var i=t.coordinateSystem,n=i.getIndicatorAxes();if(n.length){var o=t.get("shape"),a=t.getModel("splitLine"),s=t.getModel("splitArea"),l=a.getModel("lineStyle"),u=s.getModel("areaStyle"),h=a.get("show"),c=s.get("show"),p=l.get("color"),g=u.get("color");p=y(p)?p:[p],g=y(g)?g:[g];var m=[],v=[];if("circle"===o)for(var x=n[0].getTicksCoords(),_=i.cx,w=i.cy,b=0;b"+f(i,function(i,n){var o=e.get(e.mapDimension(i.dim),t);return ia(i.name+" : "+o)}).join("
")},defaultOption:{zlevel:0,z:2,coordinateSystem:"radar",legendHoverLink:!0,radarIndex:0,lineStyle:{width:2,type:"solid"},label:{position:"top"},symbol:"emptyCircle",symbolSize:4}});Zs({type:"radar",render:function(t,e,n){function o(t,e){var i=t.getItemVisual(e,"symbol")||"circle",n=t.getItemVisual(e,"color");if("none"!==i){var o=qh(t.getItemVisual(e,"symbolSize")),a=Jl(i,-1,-1,2,2,n);return a.attr({style:{strokeNoScale:!0},z2:100,scale:[o[0]/2,o[1]/2]}),a}}function a(e,i,n,a,r,s){n.removeAll();for(var l=0;l"+ia(n+" : "+i)},getTooltipPosition:function(t){if(null!=t){var e=this.getData().getName(t),i=this.coordinateSystem,n=i.getRegion(e);return n&&i.dataToPoint(n.center)}},setZoom:function(t){this.option.zoom=t},setCenter:function(t){this.option.center=t},defaultOption:{zlevel:0,z:2,coordinateSystem:"geo",map:"",left:"center",top:"center",aspectScale:.75,showLegendSymbol:!0,dataRangeHoverLink:!0,boundingCoords:null,center:null,zoom:1,scaleLimit:null,label:{show:!1,color:"#000"},itemStyle:{borderWidth:.5,borderColor:"#444",areaColor:"#eee"},emphasis:{label:{show:!0,color:"rgb(100,0,0)"},itemStyle:{areaColor:"rgba(255,215,0,0.8)"}}}}),aC);var EC="\0_ec_interaction_mutex";Es({type:"takeGlobalCursor",event:"globalCursorTaken",update:"update"},function(){}),h(oc,fw);var RC={axisPointer:1,tooltip:1,brush:1};xc.prototype={constructor:xc,draw:function(t,e,i,n,o){var a="geo"===t.mainType,r=t.getData&&t.getData();a&&e.eachComponent({mainType:"series",subType:"map"},function(e){r||e.getHostGeoModel()!==t||(r=e.getData())});var s=t.coordinateSystem;this._updateBackground(s);var l=this._regionsGroup,u=this.group,h=s.scale,c={position:s.position,scale:h};!l.childAt(0)||o?u.attr(c):Io(u,c,t),l.removeAll();var f=["itemStyle"],p=["emphasis","itemStyle"],g=["label"],m=["emphasis","label"],v=R();d(s.regions,function(e){var i=v.get(e.name)||v.set(e.name,new tb),n=new MM({shape:{paths:[]}});i.add(n);var o,s=(C=t.getRegionModel(e.name)||t).getModel(f),u=C.getModel(p),c=mc(s),y=mc(u),x=C.getModel(g),_=C.getModel(m);if(r){o=r.indexOfName(e.name);var w=r.getItemVisual(o,"color",!0);w&&(c.fill=w)}d(e.geometries,function(t){if("polygon"===t.type){n.shape.paths.push(new pM({shape:{points:t.exterior}}));for(var e=0;e<(t.interiors?t.interiors.length:0);e++)n.shape.paths.push(new pM({shape:{points:t.interiors[e]}}))}}),n.setStyle(c),n.style.strokeNoScale=!0,n.culling=!0;var b=x.get("show"),S=_.get("show"),M=r&&isNaN(r.get(r.mapDimension("value"),o)),I=r&&r.getItemLayout(o);if(a||M&&(b||S)||I&&I.showLabel){var T,A=a?e.name:o;(!r||o>=0)&&(T=t);var D=new rM({position:e.center.slice(),scale:[1/h[0],1/h[1]],z2:10,silent:!0});go(D.style,D.hoverStyle={},x,_,{labelFetcher:T,labelDataIndex:A,defaultText:e.name,useInsideStyle:!1},{textAlign:"center",textVerticalAlign:"middle"}),i.add(D)}if(r)r.setItemGraphicEl(o,i);else{var C=t.getRegionModel(e.name);n.eventData={componentType:"geo",componentIndex:t.componentIndex,geoIndex:t.componentIndex,name:e.name,region:C&&C.option||{}}}(i.__regions||(i.__regions=[])).push(e),fo(i,y,{hoverSilentOnTouch:!!t.get("selectedMode")}),l.add(i)}),this._updateController(t,e,i),vc(this,t,l,i,n),yc(t,l)},remove:function(){this._regionsGroup.removeAll(),this._backgroundGroup.removeAll(),this._controller.dispose(),this._mapName&&OC.removeGraphic(this._mapName,this.uid),this._mapName=null,this._controllerHost={}},_updateBackground:function(t){var e=t.map;this._mapName!==e&&d(OC.makeGraphic(e,this.uid),function(t){this._backgroundGroup.add(t)},this),this._mapName=e},_updateController:function(t,e,i){function n(){var e={type:"geoRoam",componentType:l};return e[l+"Id"]=t.id,e}var o=t.coordinateSystem,r=this._controller,s=this._controllerHost;s.zoomLimit=t.get("scaleLimit"),s.zoom=o.getZoom(),r.enable(t.get("roam")||!1);var l=t.mainType;r.off("pan").on("pan",function(t){this._mouseDownFlag=!1,fc(s,t.dx,t.dy),i.dispatchAction(a(n(),{dx:t.dx,dy:t.dy}))},this),r.off("zoom").on("zoom",function(t){if(this._mouseDownFlag=!1,pc(s,t.scale,t.originX,t.originY),i.dispatchAction(a(n(),{zoom:t.scale,originX:t.originX,originY:t.originY})),this._updateGroup){var e=this.group.scale;this._regionsGroup.traverse(function(t){"text"===t.type&&t.attr("scale",[1/e[0],1/e[1]])})}},this),r.setPointerChecker(function(e,n,a){return o.getViewRectAfterRoam().contain(n,a)&&!gc(e,i,t)})}};var zC="__seriesMapHighDown",BC="__seriesMapCallKey";Zs({type:"map",render:function(t,e,i,n){if(!n||"mapToggleSelect"!==n.type||n.from!==this.uid){var o=this.group;if(o.removeAll(),!t.getHostGeoModel()){if(n&&"geoRoam"===n.type&&"series"===n.componentType&&n.seriesId===t.id)(a=this._mapDraw)&&o.add(a.group);else if(t.needsDrawMap){var a=this._mapDraw||new xc(i,!0);o.add(a.group),a.draw(t,e,i,this,n),this._mapDraw=a}else this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null;t.get("showLegendSymbol")&&e.getComponent("legend")&&this._renderSymbols(t,e,i)}}},remove:function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null,this.group.removeAll()},dispose:function(){this._mapDraw&&this._mapDraw.remove(),this._mapDraw=null},_renderSymbols:function(t,e,i){var n=t.originalData,o=this.group;n.each(n.mapDimension("value"),function(e,i){if(!isNaN(e)){var r=n.getItemLayout(i);if(r&&r.point){var s=r.point,l=r.offset,u=new sM({style:{fill:t.getData().getVisual("color")},shape:{cx:s[0]+9*l,cy:s[1],r:3},silent:!0,z2:8+(l?0:NM+1)});if(!l){var h=t.mainSeries.getData(),c=n.getName(i),d=h.indexOfName(c),f=n.getItemModel(i),p=f.getModel("label"),g=f.getModel("emphasis.label"),m=h.getItemGraphicEl(d),y=A(t.getFormattedLabel(d,"normal"),c),x=A(t.getFormattedLabel(d,"emphasis"),y),_=m[zC],w=Math.random();if(!_){_=m[zC]={};var b=v(_c,!0),S=v(_c,!1);m.on("mouseover",b).on("mouseout",S).on("emphasis",b).on("normal",S)}m[BC]=w,a(_,{recordVersion:w,circle:u,labelModel:p,hoverLabelModel:g,emphasisText:x,normalText:y}),wc(_,!1)}o.add(u)}}})}}),Es({type:"geoRoam",event:"geoRoam",update:"updateTransform"},function(t,e){var i=t.componentType||"series";e.eachComponent({mainType:i,query:t},function(e){var n=e.coordinateSystem;if("geo"===n.type){var o=bc(n,t,e.get("scaleLimit"));e.setCenter&&e.setCenter(o.center),e.setZoom&&e.setZoom(o.zoom),"series"===i&&d(e.seriesGroup,function(t){t.setCenter(o.center),t.setZoom(o.zoom)})}})});var VC=Q;h(Sc,Tw),Mc.prototype={constructor:Mc,type:"view",dimensions:["x","y"],setBoundingRect:function(t,e,i,n){return this._rect=new de(t,e,i,n),this._rect},getBoundingRect:function(){return this._rect},setViewRect:function(t,e,i,n){this.transformTo(t,e,i,n),this._viewRect=new de(t,e,i,n)},transformTo:function(t,e,i,n){var o=this.getBoundingRect(),a=this._rawTransformable;a.transform=o.calculateTransform(new de(t,e,i,n)),a.decomposeTransform(),this._updateTransform()},setCenter:function(t){t&&(this._center=t,this._updateCenterAndZoom())},setZoom:function(t){t=t||1;var e=this.zoomLimit;e&&(null!=e.max&&(t=Math.min(e.max,t)),null!=e.min&&(t=Math.max(e.min,t))),this._zoom=t,this._updateCenterAndZoom()},getDefaultCenter:function(){var t=this.getBoundingRect();return[t.x+t.width/2,t.y+t.height/2]},getCenter:function(){return this._center||this.getDefaultCenter()},getZoom:function(){return this._zoom||1},getRoamTransform:function(){return this._roamTransformable.getLocalTransform()},_updateCenterAndZoom:function(){var t=this._rawTransformable.getLocalTransform(),e=this._roamTransformable,i=this.getDefaultCenter(),n=this.getCenter(),o=this.getZoom();n=Q([],n,t),i=Q([],i,t),e.origin=n,e.position=[i[0]-n[0],i[1]-n[1]],e.scale=[o,o],this._updateTransform()},_updateTransform:function(){var t=this._roamTransformable,e=this._rawTransformable;e.parent=t,t.updateTransform(),e.updateTransform(),wt(this.transform||(this.transform=[]),e.transform||xt()),this._rawTransform=e.getLocalTransform(),this.invTransform=this.invTransform||[],Tt(this.invTransform,this.transform),this.decomposeTransform()},getViewRect:function(){return this._viewRect},getViewRectAfterRoam:function(){var t=this.getBoundingRect().clone();return t.applyTransform(this.transform),t},dataToPoint:function(t,e,i){var n=e?this._rawTransform:this.transform;return i=i||[],n?VC(i,t,n):G(i,t)},pointToData:function(t){var e=this.invTransform;return e?VC([],t,e):[t[0],t[1]]},convertToPixel:v(Ic,"dataToPoint"),convertFromPixel:v(Ic,"pointToData"),containPoint:function(t){return this.getViewRectAfterRoam().contain(t[0],t[1])}},h(Mc,Tw),Tc.prototype={constructor:Tc,type:"geo",dimensions:["lng","lat"],containCoord:function(t){for(var e=this.regions,i=0;ie&&(e=n.height)}this.height=e+1},getNodeById:function(t){if(this.getId()===t)return this;for(var e=0,i=this.children,n=i.length;e=0&&this.hostTree.data.setItemLayout(this.dataIndex,t,e)},getLayout:function(){return this.hostTree.data.getItemLayout(this.dataIndex)},getModel:function(t){if(!(this.dataIndex<0)){var e,i=this.hostTree,n=i.data.getItemModel(this.dataIndex),o=this.getLevelModel();return o||0!==this.children.length&&(0===this.children.length||!1!==this.isExpand)||(e=this.getLeavesModel()),n.getModel(t,(o||e||i.hostModel).getModel(t))}},getLevelModel:function(){return(this.hostTree.levelModels||[])[this.depth]},getLeavesModel:function(){return this.hostTree.leavesModel},setVisual:function(t,e){this.dataIndex>=0&&this.hostTree.data.setItemVisual(this.dataIndex,t,e)},getVisual:function(t,e){return this.hostTree.data.getItemVisual(this.dataIndex,t,e)},getRawIndex:function(){return this.hostTree.data.getRawIndex(this.dataIndex)},getId:function(){return this.hostTree.data.getId(this.dataIndex)},isAncestorOf:function(t){for(var e=t.parentNode;e;){if(e===this)return!0;e=e.parentNode}return!1},isDescendantOf:function(t){return t!==this&&t.isAncestorOf(this)}},Vc.prototype={constructor:Vc,type:"tree",eachNode:function(t,e,i){this.root.eachNode(t,e,i)},getNodeByDataIndex:function(t){var e=this.data.getRawIndex(t);return this._nodes[e]},getNodeByName:function(t){return this.root.getNodeByName(t)},update:function(){for(var t=this.data,e=this._nodes,i=0,n=e.length;ia&&(a=t.depth)});var r=t.expandAndCollapse&&t.initialTreeDepth>=0?t.initialTreeDepth:a;return o.root.eachNode("preorder",function(t){var e=t.hostTree.data.getRawDataItem(t.dataIndex);t.isExpand=e&&null!=e.collapsed?!e.collapsed:t.depth<=r}),o.data},getOrient:function(){var t=this.get("orient");return"horizontal"===t?t="LR":"vertical"===t&&(t="TB"),t},setZoom:function(t){this.option.zoom=t},setCenter:function(t){this.option.center=t},formatTooltip:function(t){for(var e=this.getData().tree,i=e.root.children[0],n=e.getNodeByDataIndex(t),o=n.getValue(),a=n.name;n&&n!==i;)a=n.parentNode.name+"."+a,n=n.parentNode;return ia(a+(isNaN(o)||null==o?"":" : "+o))},defaultOption:{zlevel:0,z:2,coordinateSystem:"view",left:"12%",top:"12%",right:"12%",bottom:"12%",layout:"orthogonal",roam:!1,nodeScaleRatio:.4,center:null,zoom:1,orient:"LR",symbol:"emptyCircle",symbolSize:7,expandAndCollapse:!0,initialTreeDepth:2,lineStyle:{color:"#ccc",width:1.5,curveness:.5},itemStyle:{color:"lightsteelblue",borderColor:"#c23531",borderWidth:1.5},label:{show:!0,color:"#555"},leaves:{label:{show:!0}},animationEasing:"linear",animationDuration:700,animationDurationUpdate:1e3}}),Zs({type:"tree",init:function(t,e){this._oldTree,this._mainGroup=new tb,this._controller=new oc(e.getZr()),this._controllerHost={target:this.group},this.group.add(this._mainGroup)},render:function(t,e,i,n){var o=t.getData(),a=t.layoutInfo,r=this._mainGroup,s=t.get("layout");"radial"===s?r.attr("position",[a.x+a.width/2,a.y+a.height/2]):r.attr("position",[a.x,a.y]),this._updateViewCoordSys(t),this._updateController(t,e,i);var l=this._data,u={expandAndCollapse:t.get("expandAndCollapse"),layout:s,orient:t.getOrient(),curvature:t.get("lineStyle.curveness"),symbolRotate:t.get("symbolRotate"),symbolOffset:t.get("symbolOffset"),hoverAnimation:t.get("hoverAnimation"),useNameLabel:!0,fadeIn:!0};o.diff(l).add(function(e){td(o,e)&&id(o,e,null,r,t,u)}).update(function(e,i){var n=l.getItemGraphicEl(i);td(o,e)?id(o,e,n,r,t,u):n&&nd(l,i,n,r,t,u)}).remove(function(e){var i=l.getItemGraphicEl(e);i&&nd(l,e,i,r,t,u)}).execute(),this._nodeScaleRatio=t.get("nodeScaleRatio"),this._updateNodeAndLinkScale(t),!0===u.expandAndCollapse&&o.eachItemGraphicEl(function(e,n){e.off("click").on("click",function(){i.dispatchAction({type:"treeExpandAndCollapse",seriesId:t.id,dataIndex:n})})}),this._data=o},_updateViewCoordSys:function(t){var e=t.getData(),i=[];e.each(function(t){var n=e.getItemLayout(t);!n||isNaN(n.x)||isNaN(n.y)||i.push([+n.x,+n.y])});var n=[],o=[];fn(i,n,o),o[0]-n[0]==0&&(o[0]+=1,n[0]-=1),o[1]-n[1]==0&&(o[1]+=1,n[1]-=1);var a=t.coordinateSystem=new Mc;a.zoomLimit=t.get("scaleLimit"),a.setBoundingRect(n[0],n[1],o[0]-n[0],o[1]-n[1]),a.setCenter(t.get("center")),a.setZoom(t.get("zoom")),this.group.attr({position:a.position,scale:a.scale}),this._viewCoordSys=a},_updateController:function(t,e,i){var n=this._controller,o=this._controllerHost,a=this.group;n.setPointerChecker(function(e,n,o){var r=a.getBoundingRect();return r.applyTransform(a.transform),r.contain(n,o)&&!gc(e,i,t)}),n.enable(t.get("roam")),o.zoomLimit=t.get("scaleLimit"),o.zoom=t.coordinateSystem.getZoom(),n.off("pan").off("zoom").on("pan",function(e){fc(o,e.dx,e.dy),i.dispatchAction({seriesId:t.id,type:"treeRoam",dx:e.dx,dy:e.dy})},this).on("zoom",function(e){pc(o,e.scale,e.originX,e.originY),i.dispatchAction({seriesId:t.id,type:"treeRoam",zoom:e.scale,originX:e.originX,originY:e.originY}),this._updateNodeAndLinkScale(t)},this)},_updateNodeAndLinkScale:function(t){var e=t.getData(),i=this._getNodeGlobalScale(t),n=[i,i];e.eachItemGraphicEl(function(t,e){t.attr("scale",n)})},_getNodeGlobalScale:function(t){var e=t.coordinateSystem;if("view"!==e.type)return 1;var i=this._nodeScaleRatio,n=e.scale,o=n&&n[0]||1;return((e.getZoom()-1)*i+1)/o},dispose:function(){this._controller&&this._controller.dispose(),this._controllerHost={}},remove:function(){this._mainGroup.removeAll(),this._data=null}}),Es({type:"treeExpandAndCollapse",event:"treeExpandAndCollapse",update:"update"},function(t,e){e.eachComponent({mainType:"series",subType:"tree",query:t},function(e){var i=t.dataIndex,n=e.getData().tree.getNodeByDataIndex(i);n.isExpand=!n.isExpand})}),Es({type:"treeRoam",event:"treeRoam",update:"none"},function(t,e){e.eachComponent({mainType:"series",subType:"tree",query:t},function(e){var i=bc(e.coordinateSystem,t);e.setCenter&&e.setCenter(i.center),e.setZoom&&e.setZoom(i.zoom)})});Bs(TD("tree","circle")),zs(function(t,e){t.eachSeriesByType("tree",function(t){sd(t,e)})}),YI.extend({type:"series.treemap",layoutMode:"box",dependencies:["grid","polar"],_viewRoot:null,defaultOption:{progressive:0,hoverLayerThreshold:1/0,left:"center",top:"middle",right:null,bottom:null,width:"80%",height:"80%",sort:!0,clipWindow:"origin",squareRatio:.5*(1+Math.sqrt(5)),leafDepth:null,drillDownIcon:"▶",zoomToNodeRatio:.1024,roam:!0,nodeClick:"zoomToNode",animation:!0,animationDurationUpdate:900,animationEasing:"quinticInOut",breadcrumb:{show:!0,height:22,left:"center",top:"bottom",emptyItemWidth:25,itemStyle:{color:"rgba(0,0,0,0.7)",borderColor:"rgba(255,255,255,0.7)",borderWidth:1,shadowColor:"rgba(150,150,150,1)",shadowBlur:3,shadowOffsetX:0,shadowOffsetY:0,textStyle:{color:"#fff"}},emphasis:{textStyle:{}}},label:{show:!0,distance:0,padding:5,position:"inside",color:"#fff",ellipsis:!0},upperLabel:{show:!1,position:[0,"50%"],height:20,color:"#fff",ellipsis:!0,verticalAlign:"middle"},itemStyle:{color:null,colorAlpha:null,colorSaturation:null,borderWidth:0,gapWidth:0,borderColor:"#fff",borderColorSaturation:null},emphasis:{upperLabel:{show:!0,position:[0,"50%"],color:"#fff",ellipsis:!0,verticalAlign:"middle"}},visualDimension:0,visualMin:null,visualMax:null,color:[],colorAlpha:null,colorSaturation:null,colorMappingBy:"index",visibleMin:10,childrenVisibleMin:null,levels:[]},getInitialData:function(t,e){var i={name:t.name,children:t.data};dd(i);var n=t.levels||[];n=t.levels=fd(n,e);var o={};return o.levels=n,Vc.createTree(i,this,o).data},optionUpdated:function(){this.resetViewRoot()},formatTooltip:function(t){var e=this.getData(),i=this.getRawValue(t),n=ta(y(i)?i[0]:i);return ia(e.getName(t)+": "+n)},getDataParams:function(t){var e=YI.prototype.getDataParams.apply(this,arguments),i=this.getData().tree.getNodeByDataIndex(t);return e.treePathInfo=cd(i,this),e},setLayoutInfo:function(t){this.layoutInfo=this.layoutInfo||{},a(this.layoutInfo,t)},mapIdToIndex:function(t){var e=this._idIndexMap;e||(e=this._idIndexMap=R(),this._idIndexMapCount=0);var i=e.get(t);return null==i&&e.set(t,i=this._idIndexMapCount++),i},getViewRoot:function(){return this._viewRoot},resetViewRoot:function(t){t?this._viewRoot=t:t=this._viewRoot;var e=this.getRawData().tree.root;t&&(t===e||e.contains(t))||(this._viewRoot=e)}});var UC=5;pd.prototype={constructor:pd,render:function(t,e,i,n){var o=t.getModel("breadcrumb"),a=this.group;if(a.removeAll(),o.get("show")&&i){var r=o.getModel("itemStyle"),s=r.getModel("textStyle"),l={pos:{left:o.get("left"),right:o.get("right"),top:o.get("top"),bottom:o.get("bottom")},box:{width:e.getWidth(),height:e.getHeight()},emptyItemWidth:o.get("emptyItemWidth"),totalWidth:0,renderList:[]};this._prepare(i,l,s),this._renderContent(t,l,r,s,n),da(a,l.pos,l.box)}},_prepare:function(t,e,i){for(var n=t;n;n=n.parentNode){var o=n.getModel().get("name"),a=i.getTextRect(o),r=Math.max(a.width+16,e.emptyItemWidth);e.totalWidth+=r+8,e.renderList.push({node:n,text:o,width:r})}},_renderContent:function(t,e,i,n,o){for(var a=0,s=e.emptyItemWidth,l=t.get("breadcrumb.height"),u=ha(e.pos,e.box),h=e.totalWidth,c=e.renderList,d=c.length-1;d>=0;d--){var f=c[d],p=f.node,g=f.width,m=f.text;h>u.width&&(h-=g-s,g=s,m=null);var y=new pM({shape:{points:gd(a,0,g,l,d===c.length-1,0===d)},style:r(i.getItemStyle(),{lineJoin:"bevel",text:m,textFill:n.getTextColor(),textFont:n.getFont()}),z:10,onclick:v(o,p)});this.group.add(y),md(y,t,p),a+=g+8}},remove:function(){this.group.removeAll()}};var XC=m,jC=tb,YC=yM,qC=d,KC=["label"],$C=["emphasis","label"],JC=["upperLabel"],QC=["emphasis","upperLabel"],tL=10,eL=1,iL=2,nL=Qb([["fill","color"],["stroke","strokeColor"],["lineWidth","strokeWidth"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["shadowColor"]]),oL=function(t){var e=nL(t);return e.stroke=e.fill=e.lineWidth=null,e};Zs({type:"treemap",init:function(t,e){this._containerGroup,this._storage={nodeGroup:[],background:[],content:[]},this._oldTree,this._breadcrumb,this._controller,this._state="ready"},render:function(t,e,i,n){if(!(l(e.findComponents({mainType:"series",subType:"treemap",query:n}),t)<0)){this.seriesModel=t,this.api=i,this.ecModel=e;var o=ld(n,["treemapZoomToNode","treemapRootToNode"],t),a=n&&n.type,r=t.layoutInfo,s=!this._oldTree,u=this._storage,h="treemapRootToNode"===a&&o&&u?{rootNodeGroup:u.nodeGroup[o.node.getRawIndex()],direction:n.direction}:null,c=this._giveContainerGroup(r),d=this._doRender(c,t,h);s||a&&"treemapZoomToNode"!==a&&"treemapRootToNode"!==a?d.renderFinally():this._doAnimation(c,d,t,h),this._resetController(i),this._renderBreadcrumb(t,i,o)}},_giveContainerGroup:function(t){var e=this._containerGroup;return e||(e=this._containerGroup=new jC,this._initEvents(e),this.group.add(e)),e.attr("position",[t.x,t.y]),e},_doRender:function(t,e,i){function n(t,e,i,o,a){function r(t){return t.getId()}function s(r,s){var l=null!=r?t[r]:null,u=null!=s?e[s]:null,c=h(l,u,i,a);c&&n(l&&l.viewChildren||[],u&&u.viewChildren||[],c,o,a+1)}o?(e=t,qC(t,function(t,e){!t.isRemoved()&&s(e,e)})):new Xs(e,t,r,r).add(s).update(s).remove(v(s,null)).execute()}var o=e.getData().tree,a=this._oldTree,r={nodeGroup:[],background:[],content:[]},s={nodeGroup:[],background:[],content:[]},l=this._storage,u=[],h=v(yd,e,s,l,i,r,u);n(o.root?[o.root]:[],a&&a.root?[a.root]:[],t,o===a||!a,0);var c=function(t){var e={nodeGroup:[],background:[],content:[]};return t&&qC(t,function(t,i){var n=e[i];qC(t,function(t){t&&(n.push(t),t.__tmWillDelete=1)})}),e}(l);return this._oldTree=o,this._storage=s,{lastsForAnimation:r,willDeleteEls:c,renderFinally:function(){qC(c,function(t){qC(t,function(t){t.parent&&t.parent.remove(t)})}),qC(u,function(t){t.invisible=!0,t.dirty()})}}},_doAnimation:function(t,e,i,n){if(i.get("animation")){var o=i.get("animationDurationUpdate"),r=i.get("animationEasing"),s=vd();qC(e.willDeleteEls,function(t,e){qC(t,function(t,i){if(!t.invisible){var a,l=t.parent;if(n&&"drillDown"===n.direction)a=l===n.rootNodeGroup?{shape:{x:0,y:0,width:l.__tmNodeWidth,height:l.__tmNodeHeight},style:{opacity:0}}:{style:{opacity:0}};else{var u=0,h=0;l.__tmWillDelete||(u=l.__tmNodeWidth/2,h=l.__tmNodeHeight/2),a="nodeGroup"===e?{position:[u,h],style:{opacity:0}}:{shape:{x:u,y:h,width:0,height:0},style:{opacity:0}}}a&&s.add(t,a,o,r)}})}),qC(this._storage,function(t,i){qC(t,function(t,n){var l=e.lastsForAnimation[i][n],u={};l&&("nodeGroup"===i?l.old&&(u.position=t.position.slice(),t.attr("position",l.old)):(l.old&&(u.shape=a({},t.shape),t.setShape(l.old)),l.fadein?(t.setStyle("opacity",0),u.style={opacity:1}):1!==t.style.opacity&&(u.style={opacity:1})),s.add(t,u,o,r))})},this),this._state="animating",s.done(XC(function(){this._state="ready",e.renderFinally()},this)).start()}},_resetController:function(t){var e=this._controller;e||((e=this._controller=new oc(t.getZr())).enable(this.seriesModel.get("roam")),e.on("pan",XC(this._onPan,this)),e.on("zoom",XC(this._onZoom,this)));var i=new de(0,0,t.getWidth(),t.getHeight());e.setPointerChecker(function(t,e,n){return i.contain(e,n)})},_clearController:function(){var t=this._controller;t&&(t.dispose(),t=null)},_onPan:function(t){if("animating"!==this._state&&(Math.abs(t.dx)>3||Math.abs(t.dy)>3)){var e=this.seriesModel.getData().tree.root;if(!e)return;var i=e.getLayout();if(!i)return;this.api.dispatchAction({type:"treemapMove",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:i.x+t.dx,y:i.y+t.dy,width:i.width,height:i.height}})}},_onZoom:function(t){var e=t.originX,i=t.originY;if("animating"!==this._state){var n=this.seriesModel.getData().tree.root;if(!n)return;var o=n.getLayout();if(!o)return;var a=new de(o.x,o.y,o.width,o.height),r=this.seriesModel.layoutInfo;e-=r.x,i-=r.y;var s=xt();St(s,s,[-e,-i]),It(s,s,[t.scale,t.scale]),St(s,s,[e,i]),a.applyTransform(s),this.api.dispatchAction({type:"treemapRender",from:this.uid,seriesId:this.seriesModel.id,rootRect:{x:a.x,y:a.y,width:a.width,height:a.height}})}},_initEvents:function(t){t.on("click",function(t){if("ready"===this._state){var e=this.seriesModel.get("nodeClick",!0);if(e){var i=this.findTarget(t.offsetX,t.offsetY);if(i){var n=i.node;if(n.getLayout().isLeafRoot)this._rootToNode(i);else if("zoomToNode"===e)this._zoomToNode(i);else if("link"===e){var o=n.hostTree.data.getItemModel(n.dataIndex),a=o.get("link",!0),r=o.get("target",!0)||"blank";a&&window.open(a,r)}}}}},this)},_renderBreadcrumb:function(t,e,i){i||(i=null!=t.get("leafDepth",!0)?{node:t.getViewRoot()}:this.findTarget(e.getWidth()/2,e.getHeight()/2))||(i={node:t.getData().tree.root}),(this._breadcrumb||(this._breadcrumb=new pd(this.group))).render(t,e,i.node,XC(function(e){"animating"!==this._state&&(hd(t.getViewRoot(),e)?this._rootToNode({node:e}):this._zoomToNode({node:e}))},this))},remove:function(){this._clearController(),this._containerGroup&&this._containerGroup.removeAll(),this._storage={nodeGroup:[],background:[],content:[]},this._state="ready",this._breadcrumb&&this._breadcrumb.remove()},dispose:function(){this._clearController()},_zoomToNode:function(t){this.api.dispatchAction({type:"treemapZoomToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},_rootToNode:function(t){this.api.dispatchAction({type:"treemapRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t.node})},findTarget:function(t,e){var i;return this.seriesModel.getViewRoot().eachNode({attr:"viewChildren",order:"preorder"},function(n){var o=this._storage.background[n.getRawIndex()];if(o){var a=o.transformCoordToLocal(t,e),r=o.shape;if(!(r.x<=a[0]&&a[0]<=r.x+r.width&&r.y<=a[1]&&a[1]<=r.y+r.height))return!1;i={node:n,offsetX:a[0],offsetY:a[1]}}},this),i}});for(var aL=["treemapZoomToNode","treemapRender","treemapMove"],rL=0;rL=0&&t.call(e,i[o],o)},TL.eachEdge=function(t,e){for(var i=this.edges,n=i.length,o=0;o=0&&i[o].node1.dataIndex>=0&&i[o].node2.dataIndex>=0&&t.call(e,i[o],o)},TL.breadthFirstTraverse=function(t,e,i,n){if(Jd.isInstance(e)||(e=this._nodesMap[$d(e)]),e){for(var o="out"===i?"outEdges":"in"===i?"inEdges":"edges",a=0;a=0&&i.node2.dataIndex>=0});for(var o=0,a=n.length;o=0&&this[t][e].setItemVisual(this.dataIndex,i,n)},getVisual:function(i,n){return this[t][e].getItemVisual(this.dataIndex,i,n)},setLayout:function(i,n){this.dataIndex>=0&&this[t][e].setItemLayout(this.dataIndex,i,n)},getLayout:function(){return this[t][e].getItemLayout(this.dataIndex)},getGraphicEl:function(){return this[t][e].getItemGraphicEl(this.dataIndex)},getRawIndex:function(){return this[t][e].getRawIndex(this.dataIndex)}}};h(Jd,AL("hostGraph","data")),h(Qd,AL("hostGraph","edgeData")),IL.Node=Jd,IL.Edge=Qd,Yi(Jd),Yi(Qd);var DL=function(t,e,i,n,o){for(var a=new IL(n),r=0;r "+f)),h++)}var p,g=i.get("coordinateSystem");if("cartesian2d"===g||"polar"===g)p=ml(t,i);else{var m=Fa.get(g),v=m&&"view"!==m.type?m.dimensions||[]:[];l(v,"value")<0&&v.concat(["value"]);var y=_A(t,{coordDimensions:v});(p=new vA(y,i)).initData(t)}var x=new vA(["value"],i);return x.initData(u,s),o&&o(p,x),kc({mainData:p,struct:a,structAttr:"graph",datas:{node:p,edge:x},datasAttr:{node:"data",edge:"edgeData"}}),a.update(),a},CL=Hs({type:"series.graph",init:function(t){CL.superApply(this,"init",arguments),this.legendDataProvider=function(){return this._categoriesData},this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},mergeOption:function(t){CL.superApply(this,"mergeOption",arguments),this.fillDataTextStyle(t.edges||t.links),this._updateCategoriesData()},mergeDefaultAndTheme:function(t){CL.superApply(this,"mergeDefaultAndTheme",arguments),Ci(t,["edgeLabel"],["show"])},getInitialData:function(t,e){var i=t.edges||t.links||[],n=t.data||t.nodes||[],o=this;if(n&&i)return DL(n,i,this,!0,function(t,i){function n(t){return(t=this.parsePath(t))&&"label"===t[0]?r:t&&"emphasis"===t[0]&&"label"===t[1]?l:this.parentModel}t.wrapMethod("getItemModel",function(t){var e=o._categoriesModels[t.getShallow("category")];return e&&(e.parentModel=t.parentModel,t.parentModel=e),t});var a=o.getModel("edgeLabel"),r=new No({label:a.option},a.parentModel,e),s=o.getModel("emphasis.edgeLabel"),l=new No({emphasis:{label:s.option}},s.parentModel,e);i.wrapMethod("getItemModel",function(t){return t.customizeGetParent(n),t})}).data},getGraph:function(){return this.getData().graph},getEdgeData:function(){return this.getGraph().edgeData},getCategoriesData:function(){return this._categoriesData},formatTooltip:function(t,e,i){if("edge"===i){var n=this.getData(),o=this.getDataParams(t,i),a=n.graph.getEdgeByIndex(t),r=n.getName(a.node1.dataIndex),s=n.getName(a.node2.dataIndex),l=[];return null!=r&&l.push(r),null!=s&&l.push(s),l=ia(l.join(" > ")),o.value&&(l+=" : "+ia(o.value)),l}return CL.superApply(this,"formatTooltip",arguments)},_updateCategoriesData:function(){var t=f(this.option.categories||[],function(t){return null!=t.value?t:a({value:0},t)}),e=new vA(["value"],this);e.initData(t),this._categoriesData=e,this._categoriesModels=e.mapArray(function(t){return e.getItemModel(t,!0)})},setZoom:function(t){this.option.zoom=t},setCenter:function(t){this.option.center=t},isAnimationEnabled:function(){return CL.superCall(this,"isAnimationEnabled")&&!("force"===this.get("layout")&&this.get("force.layoutAnimation"))},defaultOption:{zlevel:0,z:2,coordinateSystem:"view",legendHoverLink:!0,hoverAnimation:!0,layout:null,focusNodeAdjacency:!1,circular:{rotateLabel:!1},force:{initLayout:null,repulsion:[0,50],gravity:.1,edgeLength:30,layoutAnimation:!0},left:"center",top:"center",symbol:"circle",symbolSize:10,edgeSymbol:["none","none"],edgeSymbolSize:10,edgeLabel:{position:"middle"},draggable:!1,roam:!1,center:null,zoom:1,nodeScaleRatio:.6,label:{show:!1,formatter:"{b}"},itemStyle:{},lineStyle:{color:"#aaa",width:1,curveness:0,opacity:.5},emphasis:{label:{show:!0}}}}),LL=_M.prototype,kL=bM.prototype,PL=Un({type:"ec-line",style:{stroke:"#000",fill:null},shape:{x1:0,y1:0,x2:0,y2:0,percent:1,cpx1:null,cpy1:null},buildPath:function(t,e){(tf(e)?LL:kL).buildPath(t,e)},pointAt:function(t){return tf(this.shape)?LL.pointAt.call(this,t):kL.pointAt.call(this,t)},tangentAt:function(t){var e=this.shape,i=tf(e)?[e.x2-e.x1,e.y2-e.y1]:kL.tangentAt.call(this,t);return q(i,i)}}),NL=["fromSymbol","toSymbol"],OL=rf.prototype;OL.beforeUpdate=function(){var t=this,e=t.childOfName("fromSymbol"),i=t.childOfName("toSymbol"),n=t.childOfName("label");if(e||i||!n.ignore){for(var o=1,a=this.parent;a;)a.scale&&(o/=a.scale[0]),a=a.parent;var r=t.childOfName("line");if(this.__dirty||r.__dirty){var s=r.shape.percent,l=r.pointAt(0),u=r.pointAt(s),h=U([],u,l);if(q(h,h),e&&(e.attr("position",l),c=r.tangentAt(0),e.attr("rotation",Math.PI/2-Math.atan2(c[1],c[0])),e.attr("scale",[o*s,o*s])),i){i.attr("position",u);var c=r.tangentAt(1);i.attr("rotation",-Math.PI/2-Math.atan2(c[1],c[0])),i.attr("scale",[o*s,o*s])}if(!n.ignore){n.attr("position",u);var d,f,p,g=5*o;if("end"===n.__position)d=[h[0]*g+u[0],h[1]*g+u[1]],f=h[0]>.8?"left":h[0]<-.8?"right":"center",p=h[1]>.8?"top":h[1]<-.8?"bottom":"middle";else if("middle"===n.__position){var m=s/2,v=[(c=r.tangentAt(m))[1],-c[0]],y=r.pointAt(m);v[1]>0&&(v[0]=-v[0],v[1]=-v[1]),d=[y[0]+v[0]*g,y[1]+v[1]*g],f="center",p="bottom";var x=-Math.atan2(c[1],c[0]);u[0].8?"right":h[0]<-.8?"left":"center",p=h[1]>.8?"bottom":h[1]<-.8?"top":"middle";n.attr({style:{textVerticalAlign:n.__verticalAlign||p,textAlign:n.__textAlign||f},position:d,scale:[o,o]})}}}},OL._createLine=function(t,e,i){var n=t.hostModel,o=of(t.getItemLayout(e));o.shape.percent=0,To(o,{shape:{percent:1}},n,e),this.add(o);var a=new rM({name:"label",lineLabelOriginalOpacity:1});this.add(a),d(NL,function(i){var n=nf(i,t,e);this.add(n),this[ef(i)]=t.getItemVisual(e,i)},this),this._updateCommonStl(t,e,i)},OL.updateData=function(t,e,i){var n=t.hostModel,o=this.childOfName("line"),a=t.getItemLayout(e),r={shape:{}};af(r.shape,a),Io(o,r,n,e),d(NL,function(i){var n=t.getItemVisual(e,i),o=ef(i);if(this[o]!==n){this.remove(this.childOfName(i));var a=nf(i,t,e);this.add(a)}this[o]=n},this),this._updateCommonStl(t,e,i)},OL._updateCommonStl=function(t,e,i){var n=t.hostModel,o=this.childOfName("line"),a=i&&i.lineStyle,s=i&&i.hoverLineStyle,l=i&&i.labelModel,u=i&&i.hoverLabelModel;if(!i||t.hasItemOption){var h=t.getItemModel(e);a=h.getModel("lineStyle").getLineStyle(),s=h.getModel("emphasis.lineStyle").getLineStyle(),l=h.getModel("label"),u=h.getModel("emphasis.label")}var c=t.getItemVisual(e,"color"),f=D(t.getItemVisual(e,"opacity"),a.opacity,1);o.useStyle(r({strokeNoScale:!0,fill:"none",stroke:c,opacity:f},a)),o.hoverStyle=s,d(NL,function(t){var e=this.childOfName(t);e&&(e.setColor(c),e.setStyle({opacity:f}))},this);var p,g,m=l.getShallow("show"),v=u.getShallow("show"),y=this.childOfName("label");if((m||v)&&(p=c||"#000",null==(g=n.getFormattedLabel(e,"normal",t.dataType)))){var x=n.getRawValue(e);g=null==x?t.getName(e):isFinite(x)?Go(x):x}var _=m?g:null,w=v?A(n.getFormattedLabel(e,"emphasis",t.dataType),g):null,b=y.style;null==_&&null==w||(mo(y.style,l,{text:_},{autoColor:p}),y.__textAlign=b.textAlign,y.__verticalAlign=b.textVerticalAlign,y.__position=l.get("position")||"middle"),y.hoverStyle=null!=w?{text:w,textFill:u.getTextColor(!0),fontStyle:u.getShallow("fontStyle"),fontWeight:u.getShallow("fontWeight"),fontSize:u.getShallow("fontSize"),fontFamily:u.getShallow("fontFamily")}:{text:null},y.ignore=!m&&!v,fo(this)},OL.highlight=function(){this.trigger("emphasis")},OL.downplay=function(){this.trigger("normal")},OL.updateLayout=function(t,e){this.setLinePoints(t.getItemLayout(e))},OL.setLinePoints=function(t){var e=this.childOfName("line");af(e.shape,t),e.dirty()},u(rf,tb);var EL=sf.prototype;EL.isPersistent=function(){return!0},EL.updateData=function(t){var e=this,i=e.group,n=e._lineData;e._lineData=t,n||i.removeAll();var o=hf(t);t.diff(n).add(function(i){lf(e,t,i,o)}).update(function(i,a){uf(e,n,t,a,i,o)}).remove(function(t){i.remove(n.getItemGraphicEl(t))}).execute()},EL.updateLayout=function(){var t=this._lineData;t&&t.eachItemGraphicEl(function(e,i){e.updateLayout(t,i)},this)},EL.incrementalPrepareUpdate=function(t){this._seriesScope=hf(t),this._lineData=null,this.group.removeAll()},EL.incrementalUpdate=function(t,e){for(var i=t.start;i=o/3?1:2),l=e.y-n(r)*a*(a>=o/3?1:2);r=e.angle-Math.PI/2,t.moveTo(s,l),t.lineTo(e.x+i(r)*a,e.y+n(r)*a),t.lineTo(e.x+i(e.angle)*o,e.y+n(e.angle)*o),t.lineTo(e.x-i(r)*a,e.y-n(r)*a),t.lineTo(s,l)}}),YL=2*Math.PI,qL=(Ar.extend({type:"gauge",render:function(t,e,i){this.group.removeAll();var n=t.get("axisLine.lineStyle.color"),o=Sf(t,i);this._renderMain(t,e,i,n,o)},dispose:function(){},_renderMain:function(t,e,i,n,o){for(var a=this.group,r=t.getModel("axisLine").getModel("lineStyle"),s=t.get("clockwise"),l=-t.get("startAngle")/180*Math.PI,u=-t.get("endAngle")/180*Math.PI,h=(u-l)%YL,c=l,d=r.get("width"),f=0;f=t&&(0===e?0:n[e-1][0]).4?"bottom":"middle",textAlign:A<-.4?"left":A>.4?"right":"center"},{autoColor:P}),silent:!0}))}if(g.get("show")&&T!==v){for(var N=0;N<=y;N++){var A=Math.cos(w),D=Math.sin(w),O=new _M({shape:{x1:A*c+u,y1:D*c+h,x2:A*(c-_)+u,y2:D*(c-_)+h},silent:!0,style:I});"auto"===I.stroke&&O.setStyle({stroke:n((T+N/y)/v)}),l.add(O),w+=S}w-=S}else w+=b}},_renderPointer:function(t,e,i,n,o,a,r,s){var l=this.group,u=this._data;if(t.get("pointer.show")){var h=[+t.get("min"),+t.get("max")],c=[a,r],d=t.getData(),f=d.mapDimension("value");d.diff(u).add(function(e){var i=new jL({shape:{angle:a}});To(i,{shape:{angle:Bo(d.get(f,e),h,c,!0)}},t),l.add(i),d.setItemGraphicEl(e,i)}).update(function(e,i){var n=u.getItemGraphicEl(i);Io(n,{shape:{angle:Bo(d.get(f,e),h,c,!0)}},t),l.add(n),d.setItemGraphicEl(e,n)}).remove(function(t){var e=u.getItemGraphicEl(t);l.remove(e)}).execute(),d.eachItemGraphicEl(function(t,e){var i=d.getItemModel(e),a=i.getModel("pointer");t.setShape({x:o.cx,y:o.cy,width:Vo(a.get("width"),o.r),r:Vo(a.get("length"),o.r)}),t.useStyle(i.getModel("itemStyle").getItemStyle()),"auto"===t.style.fill&&t.setStyle("fill",n(Bo(d.get(f,e),h,[0,1],!0))),fo(t,i.getModel("emphasis.itemStyle").getItemStyle())}),this._data=d}else u&&u.eachItemGraphicEl(function(t){l.remove(t)})},_renderTitle:function(t,e,i,n,o){var a=t.getData(),r=a.mapDimension("value"),s=t.getModel("title");if(s.get("show")){var l=s.get("offsetCenter"),u=o.cx+Vo(l[0],o.r),h=o.cy+Vo(l[1],o.r),c=+t.get("min"),d=+t.get("max"),f=n(Bo(t.getData().get(r,0),[c,d],[0,1],!0));this.group.add(new rM({silent:!0,style:mo({},s,{x:u,y:h,text:a.getName(0),textAlign:"center",textVerticalAlign:"middle"},{autoColor:f,forceRich:!0})}))}},_renderDetail:function(t,e,i,n,o){var a=t.getModel("detail"),r=+t.get("min"),s=+t.get("max");if(a.get("show")){var l=a.get("offsetCenter"),u=o.cx+Vo(l[0],o.r),h=o.cy+Vo(l[1],o.r),c=Vo(a.get("width"),o.r),d=Vo(a.get("height"),o.r),f=t.getData(),p=f.get(f.mapDimension("value"),0),g=n(Bo(p,[r,s],[0,1],!0));this.group.add(new rM({silent:!0,style:mo({},a,{x:u,y:h,text:Mf(p,a.get("formatter")),textWidth:isNaN(c)?null:c,textHeight:isNaN(d)?null:d,textAlign:"center",textVerticalAlign:"middle"},{autoColor:g,forceRich:!0})}))}}}),Hs({type:"series.funnel",init:function(t){qL.superApply(this,"init",arguments),this.legendDataProvider=function(){return this.getRawData()},this._defaultLabelLine(t)},getInitialData:function(t,e){return oC(this,["value"])},_defaultLabelLine:function(t){Ci(t,"labelLine",["show"]);var e=t.labelLine,i=t.emphasis.labelLine;e.show=e.show&&t.label.show,i.show=i.show&&t.emphasis.label.show},getDataParams:function(t){var e=this.getData(),i=qL.superCall(this,"getDataParams",t),n=e.mapDimension("value"),o=e.getSum(n);return i.percent=o?+(e.get(n,t)/o*100).toFixed(2):0,i.$vars.push("percent"),i},defaultOption:{zlevel:0,z:2,legendHoverLink:!0,left:80,top:60,right:80,bottom:60,minSize:"0%",maxSize:"100%",sort:"descending",gap:0,funnelAlign:"center",label:{show:!0,position:"outer"},labelLine:{show:!0,length:20,lineStyle:{width:1,type:"solid"}},itemStyle:{borderColor:"#fff",borderWidth:1},emphasis:{label:{show:!0}}}})),KL=If.prototype,$L=["itemStyle","opacity"];KL.updateData=function(t,e,i){var n=this.childAt(0),o=t.hostModel,a=t.getItemModel(e),s=t.getItemLayout(e),l=t.getItemModel(e).get($L);l=null==l?1:l,n.useStyle({}),i?(n.setShape({points:s.points}),n.setStyle({opacity:0}),To(n,{style:{opacity:l}},o,e)):Io(n,{style:{opacity:l},shape:{points:s.points}},o,e);var u=a.getModel("itemStyle"),h=t.getItemVisual(e,"color");n.setStyle(r({lineJoin:"round",fill:h},u.getItemStyle(["opacity"]))),n.hoverStyle=u.getModel("emphasis").getItemStyle(),this._updateLabel(t,e),fo(this)},KL._updateLabel=function(t,e){var i=this.childAt(1),n=this.childAt(2),o=t.hostModel,a=t.getItemModel(e),r=t.getItemLayout(e).label,s=t.getItemVisual(e,"color");Io(i,{shape:{points:r.linePoints||r.linePoints}},o,e),Io(n,{style:{x:r.x,y:r.y}},o,e),n.attr({rotation:r.rotation,origin:[r.x,r.y],z2:10});var l=a.getModel("label"),u=a.getModel("emphasis.label"),h=a.getModel("labelLine"),c=a.getModel("emphasis.labelLine"),s=t.getItemVisual(e,"color");go(n.style,n.hoverStyle={},l,u,{labelFetcher:t.hostModel,labelDataIndex:e,defaultText:t.getName(e),autoColor:s,useInsideStyle:!!r.inside},{textAlign:r.textAlign,textVerticalAlign:r.verticalAlign}),n.ignore=n.normalIgnore=!l.get("show"),n.hoverIgnore=!u.get("show"),i.ignore=i.normalIgnore=!h.get("show"),i.hoverIgnore=!c.get("show"),i.setStyle({stroke:s}),i.setStyle(h.getModel("lineStyle").getLineStyle()),i.hoverStyle=c.getModel("lineStyle").getLineStyle()},u(If,tb);Ar.extend({type:"funnel",render:function(t,e,i){var n=t.getData(),o=this._data,a=this.group;n.diff(o).add(function(t){var e=new If(n,t);n.setItemGraphicEl(t,e),a.add(e)}).update(function(t,e){var i=o.getItemGraphicEl(e);i.updateData(n,t),a.add(i),n.setItemGraphicEl(t,i)}).remove(function(t){var e=o.getItemGraphicEl(t);a.remove(e)}).execute(),this._data=n},remove:function(){this.group.removeAll(),this._data=null},dispose:function(){}});Bs(uC("funnel")),zs(function(t,e,i){t.eachSeriesByType("funnel",function(t){var i=t.getData(),n=i.mapDimension("value"),o=t.get("sort"),a=Tf(t,e),r=Af(i,o),s=[Vo(t.get("minSize"),a.width),Vo(t.get("maxSize"),a.width)],l=i.getDataExtent(n),u=t.get("min"),h=t.get("max");null==u&&(u=Math.min(l[0],0)),null==h&&(h=l[1]);var c=t.get("funnelAlign"),d=t.get("gap"),f=(a.height-d*(i.count()-1))/i.count(),p=a.y,g=function(t,e){var o,r=Bo(i.get(n,t)||0,[u,h],s,!0);switch(c){case"left":o=a.x;break;case"center":o=a.x+(a.width-r)/2;break;case"right":o=a.x+a.width-r}return[[o,e],[o+r,e]]};"ascending"===o&&(f=-f,d=-d,p+=a.height,r=r.reverse());for(var m=0;ma&&(e[1-n]=e[n]+h.sign*a),e},tk=d,ek=Math.min,ik=Math.max,nk=Math.floor,ok=Math.ceil,ak=Go,rk=Math.PI;Nf.prototype={type:"parallel",constructor:Nf,_init:function(t,e,i){var n=t.dimensions,o=t.parallelAxisIndex;tk(n,function(t,i){var n=o[i],a=e.getComponent("parallelAxis",n),r=this._axesMap.set(t,new JL(t,Hl(a),[0,0],a.get("type"),n)),s="category"===r.type;r.onBand=s&&a.get("boundaryGap"),r.inverse=a.get("inverse"),a.axis=r,r.model=a,r.coordinateSystem=a.coordinateSystem=this},this)},update:function(t,e){this._updateAxesFromSeries(this._model,t)},containPoint:function(t){var e=this._makeLayoutInfo(),i=e.axisBase,n=e.layoutBase,o=e.pixelDimIndex,a=t[1-o],r=t[o];return a>=i&&a<=i+e.axisLength&&r>=n&&r<=n+e.layoutLength},getModel:function(){return this._model},_updateAxesFromSeries:function(t,e){e.eachSeries(function(i){if(t.contains(i,e)){var n=i.getData();tk(this.dimensions,function(t){var e=this._axesMap.get(t);e.scale.unionExtentFromData(n,n.mapDimension(t)),Wl(e.scale,e.model)},this)}},this)},resize:function(t,e){this._rect=ca(t.getBoxLayoutParams(),{width:e.getWidth(),height:e.getHeight()}),this._layoutAxes()},getRect:function(){return this._rect},_makeLayoutInfo:function(){var t,e=this._model,i=this._rect,n=["x","y"],o=["width","height"],a=e.get("layout"),r="horizontal"===a?0:1,s=i[o[r]],l=[0,s],u=this.dimensions.length,h=Of(e.get("axisExpandWidth"),l),c=Of(e.get("axisExpandCount")||0,[0,u]),d=e.get("axisExpandable")&&u>3&&u>c&&c>1&&h>0&&s>0,f=e.get("axisExpandWindow");f?(t=Of(f[1]-f[0],l),f[1]=f[0]+t):(t=Of(h*(c-1),l),(f=[h*(e.get("axisExpandCenter")||nk(u/2))-t/2])[1]=f[0]+t);var p=(s-t)/(u-c);p<3&&(p=0);var g=[nk(ak(f[0]/h,1))+1,ok(ak(f[1]/h,1))-1],m=p/h*f[0];return{layout:a,pixelDimIndex:r,layoutBase:i[n[r]],layoutLength:s,axisBase:i[n[1-r]],axisLength:i[o[1-r]],axisExpandable:d,axisExpandWidth:h,axisCollapseWidth:p,axisExpandWindow:f,axisCount:u,winInnerIndices:g,axisExpandWindow0Pos:m}},_layoutAxes:function(){var t=this._rect,e=this._axesMap,i=this.dimensions,n=this._makeLayoutInfo(),o=n.layout;e.each(function(t){var e=[0,n.axisLength],i=t.inverse?1:0;t.setExtent(e[i],e[1-i])}),tk(i,function(e,i){var a=(n.axisExpandable?Rf:Ef)(i,n),r={horizontal:{x:a.position,y:n.axisLength},vertical:{x:0,y:a.position}},s={horizontal:rk/2,vertical:0},l=[r[o].x+t.x,r[o].y+t.y],u=s[o],h=xt();Mt(h,h,u),St(h,h,l),this._axesLayout[e]={position:l,rotation:u,transform:h,axisNameAvailableWidth:a.axisNameAvailableWidth,axisLabelShow:a.axisLabelShow,nameTruncateMaxWidth:a.nameTruncateMaxWidth,tickDirection:1,labelDirection:1}},this)},getAxis:function(t){return this._axesMap.get(t)},dataToPoint:function(t,e){return this.axisCoordToPoint(this._axesMap.get(e).dataToCoord(t),e)},eachActiveState:function(t,e,i,n){null==i&&(i=0),null==n&&(n=t.count());var o=this._axesMap,a=this.dimensions,r=[],s=[];d(a,function(e){r.push(t.mapDimension(e)),s.push(o.get(e).model)});for(var l=this.hasAxisBrushed(),u=i;uo*(1-h[0])?(l="jump",r=s-o*(1-h[2])):(r=s-o*h[1])>=0&&(r=s-o*(1-h[1]))<=0&&(r=0),(r*=e.axisExpandWidth/u)?QL(r,n,a,"all"):l="none";else{o=n[1]-n[0];(n=[ik(0,a[1]*s/o-o/2)])[1]=ek(a[1],n[0]+o),n[0]=n[1]-o}return{axisExpandWindow:n,behavior:l}}},Fa.register("parallel",{create:function(t,e){var i=[];return t.eachComponent("parallel",function(n,o){var a=new Nf(n,t,e);a.name="parallel_"+o,a.resize(n,e),n.coordinateSystem=a,a.model=n,i.push(a)}),t.eachSeries(function(e){if("parallel"===e.get("coordinateSystem")){var i=t.queryComponents({mainType:"parallel",index:e.get("parallelIndex"),id:e.get("parallelId")})[0];e.coordinateSystem=i.coordinateSystem}}),i}});var sk=lI.extend({type:"baseParallelAxis",axis:null,activeIntervals:[],getAreaSelectStyle:function(){return Qb([["fill","color"],["lineWidth","borderWidth"],["stroke","borderColor"],["width","width"],["opacity","opacity"]])(this.getModel("areaSelectStyle"))},setActiveIntervals:function(t){var e=this.activeIntervals=i(t);if(e)for(var n=e.length-1;n>=0;n--)Fo(e[n])},getActiveState:function(t){var e=this.activeIntervals;if(!e.length)return"normal";if(null==t||isNaN(t))return"inactive";if(1===e.length){var i=e[0];if(i[0]<=t&&t<=i[1])return"active"}else for(var n=0,o=e.length;n5)return;var n=this._model.coordinateSystem.getSlidedAxisExpandWindow([t.offsetX,t.offsetY]);"none"!==n.behavior&&this._dispatchExpand({axisExpandWindow:n.axisExpandWindow})}this._mouseDownPoint=null},mousemove:function(t){if(!this._mouseDownPoint&&Ip(this,"mousemove")){var e=this._model,i=e.coordinateSystem.getSlidedAxisExpandWindow([t.offsetX,t.offsetY]),n=i.behavior;"jump"===n&&this._throttledDispatchExpand.debounceNextCall(e.get("axisExpandDebounce")),this._throttledDispatchExpand("none"===n?null:{axisExpandWindow:i.axisExpandWindow,animation:"jump"===n&&null})}}};Ns(function(t){Cf(t),Lf(t)}),YI.extend({type:"series.parallel",dependencies:["parallel"],visualColorAccessPath:"lineStyle.color",getInitialData:function(t,e){var i=this.getSource();return Tp(i,this),ml(i,this)},getRawIndicesByActiveState:function(t){var e=this.coordinateSystem,i=this.getData(),n=[];return e.eachActiveState(i,function(e,o){t===e&&n.push(i.getRawIndex(o))}),n},defaultOption:{zlevel:0,z:2,coordinateSystem:"parallel",parallelIndex:0,label:{show:!1},inactiveOpacity:.05,activeOpacity:1,lineStyle:{width:1,opacity:.45,type:"solid"},emphasis:{label:{show:!1}},progressive:500,smooth:!1,animationEasing:"linear"}});var Dk=.3,Ck=(Ar.extend({type:"parallel",init:function(){this._dataGroup=new tb,this.group.add(this._dataGroup),this._data,this._initialized},render:function(t,e,i,n){var o=this._dataGroup,a=t.getData(),r=this._data,s=t.coordinateSystem,l=s.dimensions,u=kp(t);if(a.diff(r).add(function(t){Pp(Lp(a,o,t,l,s),a,t,u)}).update(function(e,i){var o=r.getItemGraphicEl(i),h=Cp(a,e,l,s);a.setItemGraphicEl(e,o),Io(o,{shape:{points:h}},n&&!1===n.animation?null:t,e),Pp(o,a,e,u)}).remove(function(t){var e=r.getItemGraphicEl(t);o.remove(e)}).execute(),!this._initialized){this._initialized=!0;var h=Dp(s,t,function(){setTimeout(function(){o.removeClipPath()})});o.setClipPath(h)}this._data=a},incrementalPrepareRender:function(t,e,i){this._initialized=!0,this._data=null,this._dataGroup.removeAll()},incrementalRender:function(t,e,i){for(var n=e.getData(),o=e.coordinateSystem,a=o.dimensions,r=kp(e),s=t.start;sn&&(n=e)}),d(e,function(e){var o=new hL({type:"color",mappingMethod:"linear",dataExtent:[i,n],visual:t.get("color")}).mapValueToVisual(e.getLayout().value);e.setVisual("color",o);var a=e.getModel().get("itemStyle.color");null!=a&&e.setVisual("color",a)})}})});var Ok={_baseAxisDim:null,getInitialData:function(t,e){var i,n,o=e.getComponent("xAxis",this.get("xAxisIndex")),a=e.getComponent("yAxis",this.get("yAxisIndex")),r=o.get("type"),s=a.get("type");"category"===r?(t.layout="horizontal",i=o.getOrdinalMeta(),n=!0):"category"===s?(t.layout="vertical",i=a.getOrdinalMeta(),n=!0):t.layout=t.layout||"horizontal";var l=["x","y"],u="horizontal"===t.layout?0:1,h=this._baseAxisDim=l[u],c=l[1-u],f=[o,a],p=f[u].get("type"),g=f[1-u].get("type"),m=t.data;if(m&&n){var v=[];d(m,function(t,e){var i;t.value&&y(t.value)?(i=t.value.slice(),t.value.unshift(e)):y(t)?(i=t.slice(),t.unshift(e)):i=t,v.push(i)}),t.data=v}var x=this.defaultValueDimensions;return oC(this,{coordDimensions:[{name:h,type:qs(p),ordinalMeta:i,otherDims:{tooltip:!1,itemName:0},dimsDef:["base"]},{name:c,type:qs(g),dimsDef:x.slice()}],dimensionsCount:x.length+1})},getBaseAxis:function(){var t=this._baseAxisDim;return this.ecModel.getComponent(t+"Axis",this.get(t+"AxisIndex")).axis}};h(YI.extend({type:"series.boxplot",dependencies:["xAxis","yAxis","grid"],defaultValueDimensions:[{name:"min",defaultTooltip:!0},{name:"Q1",defaultTooltip:!0},{name:"median",defaultTooltip:!0},{name:"Q3",defaultTooltip:!0},{name:"max",defaultTooltip:!0}],dimensions:null,defaultOption:{zlevel:0,z:2,coordinateSystem:"cartesian2d",legendHoverLink:!0,hoverAnimation:!0,layout:null,boxWidth:[7,50],itemStyle:{color:"#fff",borderWidth:1},emphasis:{itemStyle:{borderWidth:2,shadowBlur:5,shadowOffsetX:2,shadowOffsetY:2,shadowColor:"rgba(0,0,0,0.4)"}},animationEasing:"elasticOut",animationDuration:800}}),Ok,!0);var Ek=["itemStyle"],Rk=["emphasis","itemStyle"],zk=(Ar.extend({type:"boxplot",render:function(t,e,i){var n=t.getData(),o=this.group,a=this._data;this._data||o.removeAll();var r="horizontal"===t.get("layout")?1:0;n.diff(a).add(function(t){if(n.hasValue(t)){var e=ig(n.getItemLayout(t),n,t,r,!0);n.setItemGraphicEl(t,e),o.add(e)}}).update(function(t,e){var i=a.getItemGraphicEl(e);if(n.hasValue(t)){var s=n.getItemLayout(t);i?ng(s,i,n,t):i=ig(s,n,t,r),o.add(i),n.setItemGraphicEl(t,i)}else o.remove(i)}).remove(function(t){var e=a.getItemGraphicEl(t);e&&o.remove(e)}).execute(),this._data=n},remove:function(t){var e=this.group,i=this._data;this._data=null,i&&i.eachItemGraphicEl(function(t){t&&e.remove(t)})},dispose:B}),Pn.extend({type:"boxplotBoxPath",shape:{},buildPath:function(t,e){var i=e.points,n=0;for(t.moveTo(i[n][0],i[n][1]),n++;n<4;n++)t.lineTo(i[n][0],i[n][1]);for(t.closePath();n0?jk:Yk)}function n(t,e){return e.get(t>0?Uk:Xk)}var o=t.getData(),a=t.pipelineContext.large;if(o.setVisual({legendSymbol:"roundRect",colorP:i(1,t),colorN:i(-1,t),borderColorP:n(1,t),borderColorN:n(-1,t)}),!e.isSeriesFiltered(t))return!a&&{progress:function(t,e){for(var o;null!=(o=t.next());){var a=e.getItemModel(o),r=e.getItemLayout(o).sign;e.setItemVisual(o,{color:i(r,a),borderColor:n(r,a)})}}}}},Kk="undefined"!=typeof Float32Array?Float32Array:Array,$k={seriesType:"candlestick",plan:$I(),reset:function(t){var e=t.coordinateSystem,i=t.getData(),n=pg(t,i),o=0,a=1,r=["x","y"],s=i.mapDimension(r[o]),l=i.mapDimension(r[a],!0),u=l[0],h=l[1],c=l[2],d=l[3];if(i.setLayout({candleWidth:n,isSimpleBox:n<=1.3}),!(null==s||l.length<4))return{progress:t.pipelineContext.large?function(t,i){for(var n,r,l=new Kk(5*t.count),f=0,p=[],g=[];null!=(r=t.next());){var m=i.get(s,r),v=i.get(u,r),y=i.get(h,r),x=i.get(c,r),_=i.get(d,r);isNaN(m)||isNaN(x)||isNaN(_)?(l[f++]=NaN,f+=4):(l[f++]=fg(i,r,v,y,h),p[o]=m,p[a]=x,n=e.dataToPoint(p,null,g),l[f++]=n?n[0]:NaN,l[f++]=n?n[1]:NaN,p[a]=_,n=e.dataToPoint(p,null,g),l[f++]=n?n[1]:NaN)}i.setLayout("largePoints",l)}:function(t,i){function r(t,i){var n=[];return n[o]=i,n[a]=t,isNaN(i)||isNaN(t)?[NaN,NaN]:e.dataToPoint(n)}function l(t,e,i){var a=e.slice(),r=e.slice();a[o]=Jn(a[o]+n/2,1,!1),r[o]=Jn(r[o]-n/2,1,!0),i?t.push(a,r):t.push(r,a)}function f(t){return t[o]=Jn(t[o],1),t}for(var p;null!=(p=t.next());){var g=i.get(s,p),m=i.get(u,p),v=i.get(h,p),y=i.get(c,p),x=i.get(d,p),_=Math.min(m,v),w=Math.max(m,v),b=r(_,g),S=r(w,g),M=r(y,g),I=r(x,g),T=[];l(T,S,0),l(T,b,1),T.push(f(I),f(S),f(M),f(b)),i.setItemLayout(p,{sign:fg(i,p,m,v,h),initBaseline:m>v?S[a]:b[a],ends:T,brushRect:function(t,e,i){var s=r(t,i),l=r(e,i);return s[o]-=n/2,l[o]-=n/2,{x:s[0],y:s[1],width:a?n:l[0]-s[0],height:a?l[1]-s[1]:n}}(y,x,g)})}}}}};Ns(function(t){t&&y(t.series)&&d(t.series,function(t){w(t)&&"k"===t.type&&(t.type="candlestick")})}),Bs(qk),zs($k),YI.extend({type:"series.effectScatter",dependencies:["grid","polar"],getInitialData:function(t,e){return ml(this.getSource(),this)},brushSelector:"point",defaultOption:{coordinateSystem:"cartesian2d",zlevel:0,z:2,legendHoverLink:!0,effectType:"ripple",progressive:0,showEffectOn:"render",rippleEffect:{period:4,scale:2.5,brushType:"fill"},symbolSize:10}});var Jk=vg.prototype;Jk.stopEffectAnimation=function(){this.childAt(1).removeAll()},Jk.startEffectAnimation=function(t){for(var e=t.symbolType,i=t.color,n=this.childAt(1),o=0;o<3;o++){var a=Jl(e,-1,-1,2,2,i);a.attr({style:{strokeNoScale:!0},z2:99,silent:!0,scale:[.5,.5]});var r=-o/3*t.period+t.effectOffset;a.animate("",!0).when(t.period,{scale:[t.rippleScale/2,t.rippleScale/2]}).delay(r).start(),a.animateStyle(!0).when(t.period,{opacity:0}).delay(r).start(),n.add(a)}mg(n,t)},Jk.updateEffectAnimation=function(t){for(var e=this._effectCfg,i=this.childAt(1),n=["symbolType","period","rippleScale"],o=0;o "))},preventIncremental:function(){return!!this.get("effect.show")},getProgressive:function(){var t=this.option.progressive;return null==t?this.option.large?1e4:this.get("progressive"):t},getProgressiveThreshold:function(){var t=this.option.progressiveThreshold;return null==t?this.option.large?2e4:this.get("progressiveThreshold"):t},defaultOption:{coordinateSystem:"geo",zlevel:0,z:2,legendHoverLink:!0,hoverAnimation:!0,xAxisIndex:0,yAxisIndex:0,symbol:["none","none"],symbolSize:[10,10],geoIndex:0,effect:{show:!1,period:4,constantSpeed:0,symbol:"circle",symbolSize:3,loop:!0,trailLength:.2},large:!1,largeThreshold:2e3,polyline:!1,label:{show:!1,position:"end"},lineStyle:{opacity:.5}}}),iP=xg.prototype;iP.createLine=function(t,e,i){return new rf(t,e,i)},iP._updateEffectSymbol=function(t,e){var i=t.getItemModel(e).getModel("effect"),n=i.get("symbolSize"),o=i.get("symbol");y(n)||(n=[n,n]);var a=i.get("color")||t.getItemVisual(e,"color"),r=this.childAt(1);this._symbolType!==o&&(this.remove(r),(r=Jl(o,-.5,-.5,1,1,a)).z2=100,r.culling=!0,this.add(r)),r&&(r.setStyle("shadowColor",a),r.setStyle(i.getItemStyle(["color"])),r.attr("scale",n),r.setColor(a),r.attr("scale",n),this._symbolType=o,this._updateEffectAnimation(t,i,e))},iP._updateEffectAnimation=function(t,e,i){var n=this.childAt(1);if(n){var o=this,a=t.getItemLayout(i),r=1e3*e.get("period"),s=e.get("loop"),l=e.get("constantSpeed"),u=T(e.get("delay"),function(e){return e/t.count()*r/3}),h="function"==typeof u;if(n.ignore=!0,this.updateAnimationPoints(n,a),l>0&&(r=this.getLineLength(n)/l*1e3),r!==this._period||s!==this._loop){n.stopAnimation();var c=u;h&&(c=u(i)),n.__t>0&&(c=-r*n.__t),n.__t=0;var d=n.animate("",s).when(r,{__t:1}).delay(c).during(function(){o.updateSymbolPosition(n)});s||d.done(function(){o.remove(n)}),d.start()}this._period=r,this._loop=s}},iP.getLineLength=function(t){return uw(t.__p1,t.__cp1)+uw(t.__cp1,t.__p2)},iP.updateAnimationPoints=function(t,e){t.__p1=e[0],t.__p2=e[1],t.__cp1=e[2]||[(e[0][0]+e[1][0])/2,(e[0][1]+e[1][1])/2]},iP.updateData=function(t,e,i){this.childAt(0).updateData(t,e,i),this._updateEffectSymbol(t,e)},iP.updateSymbolPosition=function(t){var e=t.__p1,i=t.__p2,n=t.__cp1,o=t.__t,a=t.position,r=sn,s=ln;a[0]=r(e[0],n[0],i[0],o),a[1]=r(e[1],n[1],i[1],o);var l=s(e[0],n[0],i[0],o),u=s(e[1],n[1],i[1],o);t.rotation=-Math.atan2(u,l)-Math.PI/2,t.ignore=!1},iP.updateLayout=function(t,e){this.childAt(0).updateLayout(t,e);var i=t.getItemModel(e).getModel("effect");this._updateEffectAnimation(t,i,e)},u(xg,tb);var nP=_g.prototype;nP._createPolyline=function(t,e,i){var n=t.getItemLayout(e),o=new gM({shape:{points:n}});this.add(o),this._updateCommonStl(t,e,i)},nP.updateData=function(t,e,i){var n=t.hostModel;Io(this.childAt(0),{shape:{points:t.getItemLayout(e)}},n,e),this._updateCommonStl(t,e,i)},nP._updateCommonStl=function(t,e,i){var n=this.childAt(0),o=t.getItemModel(e),a=t.getItemVisual(e,"color"),s=i&&i.lineStyle,l=i&&i.hoverLineStyle;i&&!t.hasItemOption||(s=o.getModel("lineStyle").getLineStyle(),l=o.getModel("emphasis.lineStyle").getLineStyle()),n.useStyle(r({strokeNoScale:!0,fill:"none",stroke:a},s)),n.hoverStyle=l,fo(this)},nP.updateLayout=function(t,e){this.childAt(0).setShape("points",t.getItemLayout(e))},u(_g,tb);var oP=wg.prototype;oP.createLine=function(t,e,i){return new _g(t,e,i)},oP.updateAnimationPoints=function(t,e){this._points=e;for(var i=[0],n=0,o=1;o=0&&!(n[r]<=e);r--);r=Math.min(r,o-2)}else{for(var r=a;re);r++);r=Math.min(r-1,o-2)}J(t.position,i[r],i[r+1],(e-n[r])/(n[r+1]-n[r]));var s=i[r+1][0]-i[r][0],l=i[r+1][1]-i[r][1];t.rotation=-Math.atan2(l,s)-Math.PI/2,this._lastFrame=r,this._lastFramePercent=e,t.ignore=!1}},u(wg,xg);var aP=Un({shape:{polyline:!1,curveness:0,segs:[]},buildPath:function(t,e){var i=e.segs,n=e.curveness;if(e.polyline)for(r=0;r0){t.moveTo(i[r++],i[r++]);for(var a=1;a0){var c=(s+u)/2-(l-h)*n,d=(l+h)/2-(u-s)*n;t.quadraticCurveTo(c,d,u,h)}else t.lineTo(u,h)}},findDataIndex:function(t,e){var i=this.shape,n=i.segs,o=i.curveness;if(i.polyline)for(var a=0,r=0;r0)for(var l=n[r++],u=n[r++],h=1;h0){if(_n(l,u,(l+c)/2-(u-d)*o,(u+d)/2-(c-l)*o,c,d))return a}else if(yn(l,u,c,d))return a;a++}return-1}}),rP=bg.prototype;rP.isPersistent=function(){return!this._incremental},rP.updateData=function(t){this.group.removeAll();var e=new aP({rectHover:!0,cursor:"default"});e.setShape({segs:t.getLayout("linesPoints")}),this._setCommon(e,t),this.group.add(e),this._incremental=null},rP.incrementalPrepareUpdate=function(t){this.group.removeAll(),this._clearIncremental(),t.count()>5e5?(this._incremental||(this._incremental=new Zn({silent:!0})),this.group.add(this._incremental)):this._incremental=null},rP.incrementalUpdate=function(t,e){var i=new aP;i.setShape({segs:e.getLayout("linesPoints")}),this._setCommon(i,e,!!this._incremental),this._incremental?this._incremental.addDisplayable(i,!0):(i.rectHover=!0,i.cursor="default",i.__startIndex=t.start,this.group.add(i))},rP.remove=function(){this._clearIncremental(),this._incremental=null,this.group.removeAll()},rP._setCommon=function(t,e,i){var n=e.hostModel;t.setShape({polyline:n.get("polyline"),curveness:n.get("lineStyle.curveness")}),t.useStyle(n.getModel("lineStyle").getLineStyle()),t.style.strokeNoScale=!0;var o=e.getVisual("color");o&&t.setStyle("stroke",o),t.setStyle("fill"),i||(t.seriesIndex=n.seriesIndex,t.on("mousemove",function(e){t.dataIndex=null;var i=t.findDataIndex(e.offsetX,e.offsetY);i>0&&(t.dataIndex=i+t.__startIndex)}))},rP._clearIncremental=function(){var t=this._incremental;t&&t.clearDisplaybles()};var sP={seriesType:"lines",plan:$I(),reset:function(t){var e=t.coordinateSystem,i=t.get("polyline"),n=t.pipelineContext.large;return{progress:function(o,a){var r=[];if(n){var s,l=o.end-o.start;if(i){for(var u=0,h=o.start;h0){var I=a(v)?s:l;v>0&&(v=v*S+b),x[_++]=I[M],x[_++]=I[M+1],x[_++]=I[M+2],x[_++]=I[M+3]*v*256}else _+=4}return c.putImageData(y,0,0),h},_getBrush:function(){var t=this._brushCanvas||(this._brushCanvas=iw()),e=this.pointSize+this.blurSize,i=2*e;t.width=i,t.height=i;var n=t.getContext("2d");return n.clearRect(0,0,i,i),n.shadowOffsetX=i,n.shadowBlur=this.blurSize,n.shadowColor="#000",n.beginPath(),n.arc(-e,e,this.pointSize,0,2*Math.PI,!0),n.closePath(),n.fill(),t},_getGradient:function(t,e,i){for(var n=this._gradientPixels,o=n[i]||(n[i]=new Uint8ClampedArray(1024)),a=[0,0,0,0],r=0,s=0;s<256;s++)e[i](s/255,!0,a),o[r++]=a[0],o[r++]=a[1],o[r++]=a[2],o[r++]=a[3];return o}},Zs({type:"heatmap",render:function(t,e,i){var n;e.eachComponent("visualMap",function(e){e.eachTargetSeries(function(i){i===t&&(n=e)})}),this.group.removeAll(),this._incrementalDisplayable=null;var o=t.coordinateSystem;"cartesian2d"===o.type||"calendar"===o.type?this._renderOnCartesianAndCalendar(t,i,0,t.getData().count()):Ag(o)&&this._renderOnGeo(o,t,n,i)},incrementalPrepareRender:function(t,e,i){this.group.removeAll()},incrementalRender:function(t,e,i,n){e.coordinateSystem&&this._renderOnCartesianAndCalendar(e,n,t.start,t.end,!0)},_renderOnCartesianAndCalendar:function(t,e,i,n,o){var r,s,l=t.coordinateSystem;if("cartesian2d"===l.type){var u=l.getAxis("x"),h=l.getAxis("y");r=u.getBandWidth(),s=h.getBandWidth()}for(var c=this.group,d=t.getData(),f=t.getModel("itemStyle").getItemStyle(["color"]),p=t.getModel("emphasis.itemStyle").getItemStyle(),g=t.getModel("label"),m=t.getModel("emphasis.label"),v=l.type,y="cartesian2d"===v?[d.mapDimension("x"),d.mapDimension("y"),d.mapDimension("value")]:[d.mapDimension("time"),d.mapDimension("value")],x=i;x=e.y&&t[1]<=e.y+e.height:i.contain(i.toLocalCoord(t[1]))&&t[0]>=e.y&&t[0]<=e.y+e.height},pointToData:function(t){var e=this.getAxis();return[e.coordToData(e.toLocalCoord(t["horizontal"===e.orient?0:1]))]},dataToPoint:function(t){var e=this.getAxis(),i=this.getRect(),n=[],o="horizontal"===e.orient?0:1;return t instanceof Array&&(t=t[0]),n[o]=e.toGlobalCoord(e.dataToCoord(+t)),n[1-o]=0===o?i.y+i.height/2:i.x+i.width/2,n}},Fa.register("single",{create:function(t,e){var i=[];return t.eachComponent("singleAxis",function(n,o){var a=new $g(n,t,e);a.name="single_"+o,a.resize(n,e),n.coordinateSystem=a,i.push(a)}),t.eachSeries(function(e){if("singleAxis"===e.get("coordinateSystem")){var i=t.queryComponents({mainType:"singleAxis",index:e.get("singleAxisIndex"),id:e.get("singleAxisId")})[0];e.coordinateSystem=i&&i.coordinateSystem}}),i},dimensions:$g.prototype.dimensions});var gP=["axisLine","axisTickLabel","axisName"],mP=XD.extend({type:"singleAxis",axisPointerClass:"SingleAxisPointer",render:function(t,e,i,n){var o=this.group;o.removeAll();var a=Jg(t),r=new FD(t,a);d(gP,r.add,r),o.add(r.getGroup()),t.get("splitLine.show")&&this._splitLine(t),mP.superCall(this,"render",t,e,i,n)},_splitLine:function(t){var e=t.axis;if(!e.scale.isBlank()){var i=t.getModel("splitLine"),n=i.getModel("lineStyle"),o=n.get("width"),a=n.get("color");a=a instanceof Array?a:[a];for(var r=t.coordinateSystem.getRect(),s=e.isHorizontal(),l=[],u=0,h=e.getTicksCoords({tickModel:i}),c=[],d=[],f=0;f=0)&&i({type:"updateAxisPointer",currTrigger:t,x:e&&e.offsetX,y:e&&e.offsetY})})},remove:function(t,e){gm(e.getZr(),"axisPointer"),IP.superApply(this._model,"remove",arguments)},dispose:function(t,e){gm("axisPointer",e),IP.superApply(this._model,"dispose",arguments)}}),TP=Bi(),AP=i,DP=m;(mm.prototype={_group:null,_lastGraphicKey:null,_handle:null,_dragging:!1,_lastValue:null,_lastStatus:null,_payloadInfo:null,animationThreshold:15,render:function(t,e,i,n){var o=e.get("value"),a=e.get("status");if(this._axisModel=t,this._axisPointerModel=e,this._api=i,n||this._lastValue!==o||this._lastStatus!==a){this._lastValue=o,this._lastStatus=a;var r=this._group,s=this._handle;if(!a||"hide"===a)return r&&r.hide(),void(s&&s.hide());r&&r.show(),s&&s.show();var l={};this.makeElOption(l,o,t,e,i);var u=l.graphicKey;u!==this._lastGraphicKey&&this.clear(i),this._lastGraphicKey=u;var h=this._moveAnimation=this.determineAnimation(t,e);if(r){var c=v(vm,e,h);this.updatePointerEl(r,l,c,e),this.updateLabelEl(r,l,c,e)}else r=this._group=new tb,this.createPointerEl(r,l,t,e),this.createLabelEl(r,l,t,e),i.getZr().add(r);wm(r,e,!0),this._renderHandle(o)}},remove:function(t){this.clear(t)},dispose:function(t){this.clear(t)},determineAnimation:function(t,e){var i=e.get("animation"),n=t.axis,o="category"===n.type,a=e.get("snap");if(!a&&!o)return!1;if("auto"===i||null==i){var r=this.animationThreshold;if(o&&n.getBandWidth()>r)return!0;if(a){var s=Mh(t).seriesDataCount,l=n.getExtent();return Math.abs(l[0]-l[1])/s>r}return!1}return!0===i},makeElOption:function(t,e,i,n,o){},createPointerEl:function(t,e,i,n){var o=e.pointer;if(o){var a=TP(t).pointerEl=new zM[o.type](AP(e.pointer));t.add(a)}},createLabelEl:function(t,e,i,n){if(e.label){var o=TP(t).labelEl=new yM(AP(e.label));t.add(o),xm(o,n)}},updatePointerEl:function(t,e,i){var n=TP(t).pointerEl;n&&(n.setStyle(e.pointer.style),i(n,{shape:e.pointer.shape}))},updateLabelEl:function(t,e,i,n){var o=TP(t).labelEl;o&&(o.setStyle(e.label.style),i(o,{shape:e.label.shape,position:e.label.position}),xm(o,n))},_renderHandle:function(t){if(!this._dragging&&this.updateHandleTransform){var e=this._axisPointerModel,i=this._api.getZr(),n=this._handle,o=e.getModel("handle"),a=e.get("status");if(!o.get("show")||!a||"hide"===a)return n&&i.remove(n),void(this._handle=null);var r;this._handle||(r=!0,n=this._handle=Po(o.get("icon"),{cursor:"move",draggable:!0,onmousemove:function(t){mw(t.event)},onmousedown:DP(this._onHandleDragMove,this,0,0),drift:DP(this._onHandleDragMove,this),ondragend:DP(this._onHandleDragEnd,this)}),i.add(n)),wm(n,e,!1);var s=["color","borderColor","borderWidth","opacity","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY"];n.setStyle(o.getItemStyle(null,s));var l=o.get("size");y(l)||(l=[l,l]),n.attr("scale",[l[0]/2,l[1]/2]),Nr(this,"_doDispatchAxisPointer",o.get("throttle")||0,"fixRate"),this._moveHandleToValue(t,r)}},_moveHandleToValue:function(t,e){vm(this._axisPointerModel,!e&&this._moveAnimation,this._handle,_m(this.getHandleTransform(t,this._axisModel,this._axisPointerModel)))},_onHandleDragMove:function(t,e){var i=this._handle;if(i){this._dragging=!0;var n=this.updateHandleTransform(_m(i),[t,e],this._axisModel,this._axisPointerModel);this._payloadInfo=n,i.stopAnimation(),i.attr(_m(n)),TP(i).lastProp=null,this._doDispatchAxisPointer()}},_doDispatchAxisPointer:function(){if(this._handle){var t=this._payloadInfo,e=this._axisModel;this._api.dispatchAction({type:"updateAxisPointer",x:t.cursorPoint[0],y:t.cursorPoint[1],tooltipOption:t.tooltipOption,axesInfo:[{axisDim:e.axis.dim,axisIndex:e.componentIndex}]})}},_onHandleDragEnd:function(t){if(this._dragging=!1,this._handle){var e=this._axisPointerModel.get("value");this._moveHandleToValue(e),this._api.dispatchAction({type:"hideTip"})}},getHandleTransform:null,updateHandleTransform:null,clear:function(t){this._lastValue=null,this._lastStatus=null;var e=t.getZr(),i=this._group,n=this._handle;e&&i&&(this._lastGraphicKey=null,i&&e.remove(i),n&&e.remove(n),this._group=null,this._handle=null,this._payloadInfo=null)},doClear:function(){},buildLabel:function(t,e,i){return i=i||0,{x:t[i],y:t[1-i],width:e[i],height:e[1-i]}}}).constructor=mm,ji(mm);var CP=mm.extend({makeElOption:function(t,e,i,n,o){var a=i.axis,r=a.grid,s=n.get("type"),l=km(r,a).getOtherAxis(a).getGlobalExtent(),u=a.toGlobalCoord(a.dataToCoord(e,!0));if(s&&"none"!==s){var h=bm(n),c=LP[s](a,u,l,h);c.style=h,t.graphicKey=c.type,t.pointer=c}Am(e,t,Lh(r.model,i),i,n,o)},getHandleTransform:function(t,e,i){var n=Lh(e.axis.grid.model,e,{labelInside:!1});return n.labelMargin=i.get("handle.margin"),{position:Tm(e.axis,t,n),rotation:n.rotation+(n.labelDirection<0?Math.PI:0)}},updateHandleTransform:function(t,e,i,n){var o=i.axis,a=o.grid,r=o.getGlobalExtent(!0),s=km(a,o).getOtherAxis(o).getGlobalExtent(),l="x"===o.dim?0:1,u=t.position;u[l]+=e[l],u[l]=Math.min(r[1],u[l]),u[l]=Math.max(r[0],u[l]);var h=(s[1]+s[0])/2,c=[h,h];c[l]=u[l];var d=[{verticalAlign:"middle"},{align:"center"}];return{position:u,rotation:t.rotation,cursorPoint:c,tooltipOption:d[l]}}}),LP={line:function(t,e,i,n){var o=Dm([e,i[0]],[e,i[1]],Pm(t));return Kn({shape:o,style:n}),{type:"Line",shape:o}},shadow:function(t,e,i,n){var o=Math.max(1,t.getBandWidth()),a=i[1]-i[0];return{type:"Rect",shape:Cm([e-o/2,i[0]],[o,a],Pm(t))}}};XD.registerAxisPointerClass("CartesianAxisPointer",CP),Ns(function(t){if(t){(!t.axisPointer||0===t.axisPointer.length)&&(t.axisPointer={});var e=t.axisPointer.link;e&&!y(e)&&(t.axisPointer.link=[e])}}),Os(VT.PROCESSOR.STATISTIC,function(t,e){t.getComponent("axisPointer").coordSysAxesInfo=vh(t,e)}),Es({type:"updateAxisPointer",event:"updateAxisPointer",update:":updateAxisPointer"},function(t,e,i){var n=t.currTrigger,o=[t.x,t.y],a=t,r=t.dispatchAction||m(i.dispatchAction,i),s=e.getComponent("axisPointer").coordSysAxesInfo;if(s){lm(o)&&(o=xP({seriesIndex:a.seriesIndex,dataIndex:a.dataIndex},e).point);var l=lm(o),u=a.axesInfo,h=s.axesInfo,c="leave"===n||lm(o),d={},f={},p={list:[],map:{}},g={showPointer:wP(em,f),showTooltip:wP(im,p)};_P(s.coordSysMap,function(t,e){var i=l||t.containPoint(o);_P(s.coordSysAxesInfo[e],function(t,e){var n=t.axis,a=rm(u,t);if(!c&&i&&(!u||a)){var r=a&&a.value;null!=r||l||(r=n.pointToData(o)),null!=r&&Qg(t,r,g,!1,d)}})});var v={};return _P(h,function(t,e){var i=t.linkGroup;i&&!f[e]&&_P(i.axesInfo,function(e,n){var o=f[n];if(e!==t&&o){var a=o.value;i.mapper&&(a=t.axis.scale.parse(i.mapper(a,sm(e),sm(t)))),v[t.key]=a}})}),_P(v,function(t,e){Qg(h[e],t,g,!0,d)}),nm(f,h,d),om(p,o,t,r),am(h,0,i),d}});var kP=["x","y"],PP=["width","height"],NP=mm.extend({makeElOption:function(t,e,i,n,o){var a=i.axis,r=a.coordinateSystem,s=Om(r,1-Nm(a)),l=r.dataToPoint(e)[0],u=n.get("type");if(u&&"none"!==u){var h=bm(n),c=OP[u](a,l,s,h);c.style=h,t.graphicKey=c.type,t.pointer=c}Am(e,t,Jg(i),i,n,o)},getHandleTransform:function(t,e,i){var n=Jg(e,{labelInside:!1});return n.labelMargin=i.get("handle.margin"),{position:Tm(e.axis,t,n),rotation:n.rotation+(n.labelDirection<0?Math.PI:0)}},updateHandleTransform:function(t,e,i,n){var o=i.axis,a=o.coordinateSystem,r=Nm(o),s=Om(a,r),l=t.position;l[r]+=e[r],l[r]=Math.min(s[1],l[r]),l[r]=Math.max(s[0],l[r]);var u=Om(a,1-r),h=(u[1]+u[0])/2,c=[h,h];return c[r]=l[r],{position:l,rotation:t.rotation,cursorPoint:c,tooltipOption:{verticalAlign:"middle"}}}}),OP={line:function(t,e,i,n){var o=Dm([e,i[0]],[e,i[1]],Nm(t));return Kn({shape:o,style:n}),{type:"Line",shape:o}},shadow:function(t,e,i,n){var o=t.getBandWidth(),a=i[1]-i[0];return{type:"Rect",shape:Cm([e-o/2,i[0]],[o,a],Nm(t))}}};XD.registerAxisPointerClass("SingleAxisPointer",NP),Ws({type:"single"});var EP=YI.extend({type:"series.themeRiver",dependencies:["singleAxis"],nameMap:null,init:function(t){EP.superApply(this,"init",arguments),this.legendDataProvider=function(){return this.getRawData()}},fixData:function(t){var e=t.length,i=[];Zi(t,function(t){return t[2]}).buckets.each(function(t,e){i.push({name:e,dataList:t})});for(var n=i.length,o=-1,a=-1,r=0;ro&&(o=s,a=r)}for(var l=0;lMath.PI/2?"right":"left"):x&&"center"!==x?"left"===x?(f=u.r0+y,p>Math.PI/2&&(x="right")):"right"===x&&(f=u.r-y,p>Math.PI/2&&(x="left")):(f=(u.r+u.r0)/2,x="center"),d.attr("style",{text:l,textAlign:x,textVerticalAlign:n("verticalAlign")||"middle",opacity:n("opacity")});var _=f*g+u.cx,w=f*m+u.cy;d.attr("position",[_,w]);var b=n("rotate"),S=0;"radial"===b?(S=-p)<-Math.PI/2&&(S+=Math.PI):"tangential"===b?(S=Math.PI/2-p)>Math.PI/2?S-=Math.PI:S<-Math.PI/2&&(S+=Math.PI):"number"==typeof b&&(S=b*Math.PI/180),d.attr("rotation",S)},VP._initEvents=function(t,e,i,n){t.off("mouseover").off("mouseout").off("emphasis").off("normal");var o=this,a=function(){o.onEmphasis(n)},r=function(){o.onNormal()};i.isAnimationEnabled()&&t.on("mouseover",a).on("mouseout",r).on("emphasis",a).on("normal",r).on("downplay",function(){o.onDownplay()}).on("highlight",function(){o.onHighlight()})},u(Vm,tb);Ar.extend({type:"sunburst",init:function(){},render:function(t,e,i,n){function o(i,n){if(c||!i||i.getValue()||(i=null),i!==l&&n!==l)if(n&&n.piece)i?(n.piece.updateData(!1,i,"normal",t,e),s.setItemGraphicEl(i.dataIndex,n.piece)):a(n);else if(i){var o=new Vm(i,t,e);h.add(o),s.setItemGraphicEl(i.dataIndex,o)}}function a(t){t&&t.piece&&(h.remove(t.piece),t.piece=null)}var r=this;this.seriesModel=t,this.api=i,this.ecModel=e;var s=t.getData(),l=s.tree.root,u=t.getViewRoot(),h=this.group,c=t.get("renderLabelForZeroData"),d=[];u.eachNode(function(t){d.push(t)});var f=this._oldChildren||[];if(function(t,e){function i(t){return t.getId()}function n(i,n){o(null==i?null:t[i],null==n?null:e[n])}0===t.length&&0===e.length||new Xs(e,t,i,i).add(n).update(n).remove(v(n,null)).execute()}(d,f),function(i,n){if(n.depth>0){r.virtualPiece?r.virtualPiece.updateData(!1,i,"normal",t,e):(r.virtualPiece=new Vm(i,t,e),h.add(r.virtualPiece)),n.piece._onclickEvent&&n.piece.off("click",n.piece._onclickEvent);var o=function(t){r._rootToNode(n.parentNode)};n.piece._onclickEvent=o,r.virtualPiece.on("click",o)}else r.virtualPiece&&(h.remove(r.virtualPiece),r.virtualPiece=null)}(l,u),n&&n.highlight&&n.highlight.piece){var p=t.getShallow("highlightPolicy");n.highlight.piece.onEmphasis(p)}else if(n&&n.unhighlight){var g=this.virtualPiece;!g&&l.children.length&&(g=l.children[0].piece),g&&g.onNormal()}this._initEvents(),this._oldChildren=d},dispose:function(){},_initEvents:function(){var t=this,e=function(e){var i=!1;t.seriesModel.getViewRoot().eachNode(function(n){if(!i&&n.piece&&n.piece.childAt(0)===e.target){var o=n.getModel().get("nodeClick");if("rootToNode"===o)t._rootToNode(n);else if("link"===o){var a=n.getModel(),r=a.get("link");if(r){var s=a.get("target",!0)||"_blank";window.open(r,s)}}i=!0}})};this.group._onclickEvent&&this.group.off("click",this.group._onclickEvent),this.group.on("click",e),this.group._onclickEvent=e},_rootToNode:function(t){t!==this.seriesModel.getViewRoot()&&this.api.dispatchAction({type:"sunburstRootToNode",from:this.uid,seriesId:this.seriesModel.id,targetNode:t})},containPoint:function(t,e){var i=e.getData().getItemLayout(0);if(i){var n=t[0]-i.cx,o=t[1]-i.cy,a=Math.sqrt(n*n+o*o);return a<=i.r&&a>=i.r0}}});var GP="sunburstRootToNode";Es({type:GP,update:"updateView"},function(t,e){e.eachComponent({mainType:"series",subType:"sunburst",query:t},function(e,i){var n=ld(t,[GP],e);if(n){var o=e.getViewRoot();o&&(t.direction=hd(o,n.node)?"rollUp":"drillDown"),e.resetViewRoot(n.node)}})});var FP="sunburstHighlight";Es({type:FP,update:"updateView"},function(t,e){e.eachComponent({mainType:"series",subType:"sunburst",query:t},function(e,i){var n=ld(t,[FP],e);n&&(t.highlight=n.node)})});Es({type:"sunburstUnhighlight",update:"updateView"},function(t,e){e.eachComponent({mainType:"series",subType:"sunburst",query:t},function(e,i){t.unhighlight=!0})});var WP=Math.PI/180;Bs(v(uC,"sunburst")),zs(v(function(t,e,i,n){e.eachSeriesByType(t,function(t){var e=t.get("center"),n=t.get("radius");y(n)||(n=[0,n]),y(e)||(e=[e,e]);var o=i.getWidth(),a=i.getHeight(),r=Math.min(o,a),s=Vo(e[0],o),l=Vo(e[1],a),u=Vo(n[0],r/2),h=Vo(n[1],r/2),c=-t.get("startAngle")*WP,f=t.get("minAngle")*WP,p=t.getData().tree.root,g=t.getViewRoot(),m=g.depth,v=t.get("sort");null!=v&&Zm(g,v);var x=0;d(g.children,function(t){!isNaN(t.getValue())&&x++});var _=g.getValue(),w=Math.PI/(_||x)*2,b=g.depth>0,S=g.height-(b?-1:1),M=(h-u)/(S||1),I=t.get("clockwise"),T=t.get("stillShowZeroSum"),A=I?1:-1,D=function(t,e){if(t){var i=e;if(t!==p){var n=t.getValue(),o=0===_&&T?w:n*w;on[1]&&n.reverse(),{coordSys:{type:"polar",cx:t.cx,cy:t.cy,r:n[1],r0:n[0]},api:{coord:m(function(n){var o=e.dataToRadius(n[0]),a=i.dataToAngle(n[1]),r=t.coordToPoint([o,a]);return r.push(o,a*Math.PI/180),r}),size:m(qm,t)}}},calendar:function(t){var e=t.getRect(),i=t.getRangeInfo();return{coordSys:{type:"calendar",x:e.x,y:e.y,width:e.width,height:e.height,cellWidth:t.getCellWidth(),cellHeight:t.getCellHeight(),rangeInfo:{start:i.start,end:i.end,weeks:i.weeks,dayCount:i.allDay}},api:{coord:function(e,i){return t.dataToPoint(e,i)}}}}};YI.extend({type:"series.custom",dependencies:["grid","polar","geo","singleAxis","calendar"],defaultOption:{coordinateSystem:"cartesian2d",zlevel:0,z:2,legendHoverLink:!0,useTransform:!0},getInitialData:function(t,e){return ml(this.getSource(),this)},getDataParams:function(t,e,i){var n=YI.prototype.getDataParams.apply(this,arguments);return i&&(n.info=i.info),n}}),Ar.extend({type:"custom",_data:null,render:function(t,e,i,n){var o=this._data,a=t.getData(),r=this.group,s=Qm(t,a,e,i);a.diff(o).add(function(e){ev(null,e,s(e,n),t,r,a)}).update(function(e,i){ev(o.getItemGraphicEl(i),e,s(e,n),t,r,a)}).remove(function(t){var e=o.getItemGraphicEl(t);e&&r.remove(e)}).execute(),this._data=a},incrementalPrepareRender:function(t,e,i){this.group.removeAll(),this._data=null},incrementalRender:function(t,e,i,n,o){for(var a=e.getData(),r=Qm(e,a,i,n),s=t.start;s=0;l--)null==o[l]?o.splice(l,1):delete o[l].$action},_flatten:function(t,e,i){d(t,function(t){if(t){i&&(t.parentOption=i),e.push(t);var n=t.children;"group"===t.type&&n&&this._flatten(n,e,t),delete t.children}},this)},useElOptionsToUpdate:function(){var t=this._elOptionsToUpdate;return this._elOptionsToUpdate=null,t}});Ws({type:"graphic",init:function(t,e){this._elMap=R(),this._lastGraphicModel},render:function(t,e,i){t!==this._lastGraphicModel&&this._clear(),this._lastGraphicModel=t,this._updateElements(t),this._relocate(t,i)},_updateElements:function(t){var e=t.useElOptionsToUpdate();if(e){var i=this._elMap,n=this.group;d(e,function(e){var o=e.$action,a=e.id,r=i.get(a),s=e.parentId,l=null!=s?i.get(s):n,u=e.style;"text"===e.type&&u&&(e.hv&&e.hv[1]&&(u.textVerticalAlign=u.textBaseline=null),!u.hasOwnProperty("textFill")&&u.fill&&(u.textFill=u.fill),!u.hasOwnProperty("textStroke")&&u.stroke&&(u.textStroke=u.stroke));var h=fv(e);o&&"merge"!==o?"replace"===o?(dv(r,i),cv(a,l,h,i)):"remove"===o&&dv(r,i):r?r.attr(h):cv(a,l,h,i);var c=i.get(a);c&&(c.__ecGraphicWidth=e.width,c.__ecGraphicHeight=e.height,yv(c,t))})}},_relocate:function(t,e){for(var i=t.option.elements,n=this.group,o=this._elMap,a=i.length-1;a>=0;a--){var r=i[a],s=o.get(r.id);if(s){var l=s.parent;da(s,r,l===n?{width:e.getWidth(),height:e.getHeight()}:{width:l.__ecGraphicWidth||0,height:l.__ecGraphicHeight||0},null,{hv:r.hv,boundingMode:r.bounding})}}},_clear:function(){var t=this._elMap;t.each(function(e){dv(e,t)}),this._elMap=R()},dispose:function(){this._clear()}});var KP=Fs({type:"legend.plain",dependencies:["series"],layoutMode:{type:"box",ignoreSize:!0},init:function(t,e,i){this.mergeDefaultAndTheme(t,i),t.selected=t.selected||{}},mergeOption:function(t){KP.superCall(this,"mergeOption",t)},optionUpdated:function(){this._updateData(this.ecModel);var t=this._data;if(t[0]&&"single"===this.get("selectedMode")){for(var e=!1,i=0;i=0},defaultOption:{zlevel:0,z:4,show:!0,orient:"horizontal",left:"center",top:0,align:"auto",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderRadius:0,borderWidth:0,padding:5,itemGap:10,itemWidth:25,itemHeight:14,inactiveColor:"#ccc",textStyle:{color:"#333"},selectedMode:!0,tooltip:{show:!1}}});Es("legendToggleSelect","legendselectchanged",v(xv,"toggleSelected")),Es("legendSelect","legendselected",v(xv,"select")),Es("legendUnSelect","legendunselected",v(xv,"unSelect"));var $P=v,JP=d,QP=tb,tN=Ws({type:"legend.plain",newlineDisabled:!1,init:function(){this.group.add(this._contentGroup=new QP),this._backgroundEl,this._isFirstRender=!0},getContentGroup:function(){return this._contentGroup},render:function(t,e,i){var n=this._isFirstRender;if(this._isFirstRender=!1,this.resetInner(),t.get("show",!0)){var o=t.get("align");o&&"auto"!==o||(o="right"===t.get("left")&&"vertical"===t.get("orient")?"right":"left"),this.renderInner(o,t,e,i);var a=t.getBoxLayoutParams(),s={width:i.getWidth(),height:i.getHeight()},l=t.get("padding"),u=ca(a,s,l),h=this.layoutInner(t,o,u,n),c=ca(r({width:h.width,height:h.height},a),s,l);this.group.attr("position",[c.x-h.x,c.y-h.y]),this.group.add(this._backgroundEl=wv(h,t))}},resetInner:function(){this.getContentGroup().removeAll(),this._backgroundEl&&this.group.remove(this._backgroundEl)},renderInner:function(t,e,i,n){var o=this.getContentGroup(),a=R(),r=e.get("selectedMode"),s=[];i.eachRawSeries(function(t){!t.get("legendHoverLink")&&s.push(t.id)}),JP(e.getData(),function(l,u){var h=l.get("name");if(this.newlineDisabled||""!==h&&"\n"!==h){var c=i.getSeriesByName(h)[0];if(!a.get(h))if(c){var d=c.getData(),f=d.getVisual("color");"function"==typeof f&&(f=f(c.getDataParams(0)));var p=d.getVisual("legendSymbol")||"roundRect",g=d.getVisual("symbol");this._createItem(h,u,l,e,p,g,t,f,r).on("click",$P(bv,h,n)).on("mouseover",$P(Sv,c.name,null,n,s)).on("mouseout",$P(Mv,c.name,null,n,s)),a.set(h,!0)}else i.eachRawSeries(function(i){if(!a.get(h)&&i.legendDataProvider){var o=i.legendDataProvider(),c=o.indexOfName(h);if(c<0)return;var d=o.getItemVisual(c,"color");this._createItem(h,u,l,e,"roundRect",null,t,d,r).on("click",$P(bv,h,n)).on("mouseover",$P(Sv,null,h,n,s)).on("mouseout",$P(Mv,null,h,n,s)),a.set(h,!0)}},this)}else o.add(new QP({newline:!0}))},this)},_createItem:function(t,e,i,n,o,r,s,l,u){var h=n.get("itemWidth"),c=n.get("itemHeight"),d=n.get("inactiveColor"),f=n.get("symbolKeepAspect"),p=n.isSelected(t),g=new QP,m=i.getModel("textStyle"),v=i.get("icon"),y=i.getModel("tooltip"),x=y.parentModel;if(o=v||o,g.add(Jl(o,0,0,h,c,p?l:d,null==f||f)),!v&&r&&(r!==o||"none"===r)){var _=.8*c;"none"===r&&(r="circle"),g.add(Jl(r,(h-_)/2,(c-_)/2,_,_,p?l:d,null==f||f))}var w="left"===s?h+5:-5,b=s,S=n.get("formatter"),M=t;"string"==typeof S&&S?M=S.replace("{name}",null!=t?t:""):"function"==typeof S&&(M=S(t)),g.add(new rM({style:mo({},m,{text:M,x:w,y:c/2,textFill:p?m.getTextColor():d,textAlign:b,textVerticalAlign:"middle"})}));var I=new yM({shape:g.getBoundingRect(),invisible:!0,tooltip:y.get("show")?a({content:t,formatter:x.get("formatter",!0)||function(){return t},formatterParams:{componentType:"legend",legendIndex:n.componentIndex,name:t,$vars:["name"]}},y.option):null});return g.add(I),g.eachChild(function(t){t.silent=!0}),I.silent=!u,this.getContentGroup().add(g),fo(g),g.__legendDataIndex=e,g},layoutInner:function(t,e,i){var n=this.getContentGroup();aI(t.get("orient"),n,t.get("itemGap"),i.width,i.height);var o=n.getBoundingRect();return n.attr("position",[-o.x,-o.y]),this.group.getBoundingRect()},remove:function(){this.getContentGroup().removeAll(),this._isFirstRender=!0}});Os(function(t){var e=t.findComponents({mainType:"legend"});e&&e.length&&t.filterSeries(function(t){for(var i=0;ii[l],p=[-c.x,-c.y];n||(p[s]=o.position[s]);var g=[0,0],m=[-d.x,-d.y],v=A(t.get("pageButtonGap",!0),t.get("itemGap",!0));f&&("end"===t.get("pageButtonPosition",!0)?m[s]+=i[l]-d[l]:g[s]+=d[l]+v),m[1-s]+=c[u]/2-d[u]/2,o.attr("position",p),a.attr("position",g),r.attr("position",m);var y=this.group.getBoundingRect();if((y={x:0,y:0})[l]=f?i[l]:c[l],y[u]=Math.max(c[u],d[u]),y[h]=Math.min(0,d[h]+m[1-s]),a.__rectSize=i[l],f){var x={x:0,y:0};x[l]=Math.max(i[l]-d[l]-v,0),x[u]=y[u],a.setClipPath(new yM({shape:x})),a.__rectSize=x[l]}else r.eachChild(function(t){t.attr({invisible:!0,silent:!0})});var _=this._getPageInfo(t);return null!=_.pageIndex&&Io(o,{position:_.contentPosition},!!f&&t),this._updatePageInfoView(t,_),y},_pageGo:function(t,e,i){var n=this._getPageInfo(e)[t];null!=n&&i.dispatchAction({type:"legendScroll",scrollDataIndex:n,legendId:e.id})},_updatePageInfoView:function(t,e){var i=this._controllerGroup;d(["pagePrev","pageNext"],function(n){var o=null!=e[n+"DataIndex"],a=i.childOfName(n);a&&(a.setStyle("fill",o?t.get("pageIconColor",!0):t.get("pageIconInactiveColor",!0)),a.cursor=o?"pointer":"default")});var n=i.childOfName("pageText"),o=t.get("pageFormatter"),a=e.pageIndex,r=null!=a?a+1:0,s=e.pageCount;n&&o&&n.setStyle("text",_(o)?o.replace("{current}",r).replace("{total}",s):o({current:r,total:s}))},_getPageInfo:function(t){function e(t){if(t){var e=t.getBoundingRect(),i=e[l]+t.position[r];return{s:i,e:i+e[s],i:t.__legendDataIndex}}}function i(t,e){return t.e>=e&&t.s<=e+a}var n=t.get("scrollDataIndex",!0),o=this.getContentGroup(),a=this._containerGroup.__rectSize,r=t.getOrient().index,s=nN[r],l=oN[r],u=this._findTargetItemIndex(n),h=o.children(),c=h[u],d=h.length,f=d?1:0,p={contentPosition:o.position.slice(),pageCount:f,pageIndex:f-1,pagePrevDataIndex:null,pageNextDataIndex:null};if(!c)return p;var g=e(c);p.contentPosition[r]=-g.s;for(var m=u+1,v=g,y=g,x=null;m<=d;++m)(!(x=e(h[m]))&&y.e>v.s+a||x&&!i(x,v.s))&&(v=y.i>v.i?y:x)&&(null==p.pageNextDataIndex&&(p.pageNextDataIndex=v.i),++p.pageCount),y=x;for(var m=u-1,v=g,y=g,x=null;m>=-1;--m)(x=e(h[m]))&&i(y,x.s)||!(v.i=0;){var r=o.indexOf("|}"),s=o.substr(a+"{marker".length,r-a-"{marker".length);s.indexOf("sub")>-1?n["marker"+s]={textWidth:4,textHeight:4,textBorderRadius:2,textBackgroundColor:e[s],textOffset:[3,0]}:n["marker"+s]={textWidth:10,textHeight:10,textBorderRadius:5,textBackgroundColor:e[s]},a=(o=o.substr(r+1)).indexOf("{marker")}this.el=new rM({style:{rich:n,text:t,textLineHeight:20,textBackgroundColor:i.get("backgroundColor"),textBorderRadius:i.get("borderRadius"),textFill:i.get("textStyle.color"),textPadding:i.get("padding")},z:i.get("z")}),this._zr.add(this.el);var l=this;this.el.on("mouseover",function(){l._enterable&&(clearTimeout(l._hideTimeout),l._show=!0),l._inContent=!0}),this.el.on("mouseout",function(){l._enterable&&l._show&&l.hideLater(l._hideDelay),l._inContent=!1})},setEnterable:function(t){this._enterable=t},getSize:function(){var t=this.el.getBoundingRect();return[t.width,t.height]},moveTo:function(t,e){this.el&&this.el.attr("position",[t,e])},hide:function(){this.el?this.el.hide():true,this._show=!1},hideLater:function(t){!this._show||this._inContent&&this._enterable||(t?(this._hideDelay=t,this._show=!1,this._hideTimeout=setTimeout(m(this.hide,this),t)):this.hide())},isShow:function(){return this._show},getOuterSize:function(){return this.getSize()}};var uN=m,hN=d,cN=Vo,dN=new yM({shape:{x:-1,y:-1,width:2,height:2}});Ws({type:"tooltip",init:function(t,e){if(!U_.node){var i=t.getComponent("tooltip").get("renderMode");this._renderMode=Hi(i);var n;"html"===this._renderMode?(n=new Cv(e.getDom(),e),this._newLine="
"):(n=new Lv(e),this._newLine="\n"),this._tooltipContent=n}},render:function(t,e,i){if(!U_.node){this.group.removeAll(),this._tooltipModel=t,this._ecModel=e,this._api=i,this._lastDataByCoordSys=null,this._alwaysShowContent=t.get("alwaysShowContent");var n=this._tooltipContent;n.update(),n.setEnterable(t.get("enterable")),this._initGlobalListener(),this._keepShow()}},_initGlobalListener:function(){var t=this._tooltipModel.get("triggerOn");um("itemTooltip",this._api,uN(function(e,i,n){"none"!==t&&(t.indexOf(e)>=0?this._tryShow(i,n):"leave"===e&&this._hide(n))},this))},_keepShow:function(){var t=this._tooltipModel,e=this._ecModel,i=this._api;if(null!=this._lastX&&null!=this._lastY&&"none"!==t.get("triggerOn")){var n=this;clearTimeout(this._refreshUpdateTimeout),this._refreshUpdateTimeout=setTimeout(function(){n.manuallyShowTip(t,e,i,{x:n._lastX,y:n._lastY})})}},manuallyShowTip:function(t,e,i,n){if(n.from!==this.uid&&!U_.node){var o=Pv(n,i);this._ticket="";var a=n.dataByCoordSys;if(n.tooltip&&null!=n.x&&null!=n.y){var r=dN;r.position=[n.x,n.y],r.update(),r.tooltip=n.tooltip,this._tryShow({offsetX:n.x,offsetY:n.y,target:r},o)}else if(a)this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,event:{},dataByCoordSys:n.dataByCoordSys,tooltipOption:n.tooltipOption},o);else if(null!=n.seriesIndex){if(this._manuallyAxisShowTip(t,e,i,n))return;var s=xP(n,e),l=s.point[0],u=s.point[1];null!=l&&null!=u&&this._tryShow({offsetX:l,offsetY:u,position:n.position,target:s.el,event:{}},o)}else null!=n.x&&null!=n.y&&(i.dispatchAction({type:"updateAxisPointer",x:n.x,y:n.y}),this._tryShow({offsetX:n.x,offsetY:n.y,position:n.position,target:i.getZr().findHover(n.x,n.y).target,event:{}},o))}},manuallyHideTip:function(t,e,i,n){var o=this._tooltipContent;!this._alwaysShowContent&&this._tooltipModel&&o.hideLater(this._tooltipModel.get("hideDelay")),this._lastX=this._lastY=null,n.from!==this.uid&&this._hide(Pv(n,i))},_manuallyAxisShowTip:function(t,e,i,n){var o=n.seriesIndex,a=n.dataIndex,r=e.getComponent("axisPointer").coordSysAxesInfo;if(null!=o&&null!=a&&null!=r){var s=e.getSeriesByIndex(o);if(s&&"axis"===(t=kv([s.getData().getItemModel(a),s,(s.coordinateSystem||{}).model,t])).get("trigger"))return i.dispatchAction({type:"updateAxisPointer",seriesIndex:o,dataIndex:a,position:n.position}),!0}},_tryShow:function(t,e){var i=t.target;if(this._tooltipModel){this._lastX=t.offsetX,this._lastY=t.offsetY;var n=t.dataByCoordSys;n&&n.length?this._showAxisTooltip(n,t):i&&null!=i.dataIndex?(this._lastDataByCoordSys=null,this._showSeriesItemTooltip(t,i,e)):i&&i.tooltip?(this._lastDataByCoordSys=null,this._showComponentItemTooltip(t,i,e)):(this._lastDataByCoordSys=null,this._hide(e))}},_showOrMove:function(t,e){var i=t.get("showDelay");e=m(e,this),clearTimeout(this._showTimout),i>0?this._showTimout=setTimeout(e,i):e()},_showAxisTooltip:function(t,e){var i=this._ecModel,o=this._tooltipModel,a=[e.offsetX,e.offsetY],r=[],s=[],l=kv([e.tooltipOption,o]),u=this._renderMode,h=this._newLine,c={};hN(t,function(t){hN(t.dataByAxis,function(t){var e=i.getComponent(t.axisDim+"Axis",t.axisIndex),o=t.value,a=[];if(e&&null!=o){var l=Im(o,e.axis,i,t.seriesDataIndices,t.valueLabelOpt);d(t.seriesDataIndices,function(r){var h=i.getSeriesByIndex(r.seriesIndex),d=r.dataIndexInside,f=h&&h.getDataParams(d);if(f.axisDim=t.axisDim,f.axisIndex=t.axisIndex,f.axisType=t.axisType,f.axisId=t.axisId,f.axisValue=Xl(e.axis,o),f.axisValueLabel=l,f){s.push(f);var p,g=h.formatTooltip(d,!0,null,u);if(w(g)){p=g.html;var m=g.markers;n(c,m)}else p=g;a.push(p)}});var f=l;"html"!==u?r.push(a.join(h)):r.push((f?ia(f)+h:"")+a.join(h))}})},this),r.reverse(),r=r.join(this._newLine+this._newLine);var f=e.position;this._showOrMove(l,function(){this._updateContentNotChangedOnAxis(t)?this._updatePosition(l,f,a[0],a[1],this._tooltipContent,s):this._showTooltipContent(l,r,s,Math.random(),a[0],a[1],f,void 0,c)})},_showSeriesItemTooltip:function(t,e,i){var n=this._ecModel,o=e.seriesIndex,a=n.getSeriesByIndex(o),r=e.dataModel||a,s=e.dataIndex,l=e.dataType,u=r.getData(),h=kv([u.getItemModel(s),r,a&&(a.coordinateSystem||{}).model,this._tooltipModel]),c=h.get("trigger");if(null==c||"item"===c){var d,f,p=r.getDataParams(s,l),g=r.formatTooltip(s,!1,l,this._renderMode);w(g)?(d=g.html,f=g.markers):(d=g,f=null);var m="item_"+r.name+"_"+s;this._showOrMove(h,function(){this._showTooltipContent(h,d,p,m,t.offsetX,t.offsetY,t.position,t.target,f)}),i({type:"showTip",dataIndexInside:s,dataIndex:u.getRawIndex(s),seriesIndex:o,from:this.uid})}},_showComponentItemTooltip:function(t,e,i){var n=e.tooltip;if("string"==typeof n){var o=n;n={content:o,formatter:o}}var a=new No(n,this._tooltipModel,this._ecModel),r=a.get("content"),s=Math.random();this._showOrMove(a,function(){this._showTooltipContent(a,r,a.get("formatterParams")||{},s,t.offsetX,t.offsetY,t.position,e)}),i({type:"showTip",from:this.uid})},_showTooltipContent:function(t,e,i,n,o,a,r,s,l){if(this._ticket="",t.get("showContent")&&t.get("show")){var u=this._tooltipContent,h=t.get("formatter");r=r||t.get("position");var c=e;if(h&&"string"==typeof h)c=na(h,i,!0);else if("function"==typeof h){var d=uN(function(e,n){e===this._ticket&&(u.setContent(n,l,t),this._updatePosition(t,r,o,a,u,i,s))},this);this._ticket=n,c=h(i,n,d)}u.setContent(c,l,t),u.show(t),this._updatePosition(t,r,o,a,u,i,s)}},_updatePosition:function(t,e,i,n,o,a,r){var s=this._api.getWidth(),l=this._api.getHeight();e=e||t.get("position");var u=o.getSize(),h=t.get("align"),c=t.get("verticalAlign"),d=r&&r.getBoundingRect().clone();if(r&&d.applyTransform(r.transform),"function"==typeof e&&(e=e([i,n],a,o.el,d,{viewSize:[s,l],contentSize:u.slice()})),y(e))i=cN(e[0],s),n=cN(e[1],l);else if(w(e)){e.width=u[0],e.height=u[1];var f=ca(e,{width:s,height:l});i=f.x,n=f.y,h=null,c=null}else"string"==typeof e&&r?(i=(p=Ev(e,d,u))[0],n=p[1]):(i=(p=Nv(i,n,o,s,l,h?null:20,c?null:20))[0],n=p[1]);if(h&&(i-=Rv(h)?u[0]/2:"right"===h?u[0]:0),c&&(n-=Rv(c)?u[1]/2:"bottom"===c?u[1]:0),t.get("confine")){var p=Ov(i,n,o,s,l);i=p[0],n=p[1]}o.moveTo(i,n)},_updateContentNotChangedOnAxis:function(t){var e=this._lastDataByCoordSys,i=!!e&&e.length===t.length;return i&&hN(e,function(e,n){var o=e.dataByAxis||{},a=(t[n]||{}).dataByAxis||[];(i&=o.length===a.length)&&hN(o,function(t,e){var n=a[e]||{},o=t.seriesDataIndices||[],r=n.seriesDataIndices||[];(i&=t.value===n.value&&t.axisType===n.axisType&&t.axisId===n.axisId&&o.length===r.length)&&hN(o,function(t,e){var n=r[e];i&=t.seriesIndex===n.seriesIndex&&t.dataIndex===n.dataIndex})})}),this._lastDataByCoordSys=t,!!i},_hide:function(t){this._lastDataByCoordSys=null,t({type:"hideTip",from:this.uid})},dispose:function(t,e){U_.node||(this._tooltipContent.hide(),gm("itemTooltip",e))}}),Es({type:"showTip",event:"showTip",update:"tooltip:manuallyShowTip"},function(){}),Es({type:"hideTip",event:"hideTip",update:"tooltip:manuallyHideTip"},function(){}),Gv.prototype={constructor:Gv,pointToData:function(t,e){return this.polar.pointToData(t,e)["radius"===this.dim?0:1]},dataToRadius:aD.prototype.dataToCoord,radiusToData:aD.prototype.coordToData},u(Gv,aD);var fN=Bi();Fv.prototype={constructor:Fv,pointToData:function(t,e){return this.polar.pointToData(t,e)["radius"===this.dim?0:1]},dataToAngle:aD.prototype.dataToCoord,angleToData:aD.prototype.coordToData,calculateCategoryInterval:function(){var t=this,e=t.getLabelModel(),i=t.scale,n=i.getExtent(),o=i.count();if(n[1]-n[0]<1)return 0;var a=n[0],r=t.dataToCoord(a+1)-t.dataToCoord(a),s=Math.abs(r),l=ke(a,e.getFont(),"center","top"),u=Math.max(l.height,7)/s;isNaN(u)&&(u=1/0);var h=Math.max(0,Math.floor(u)),c=fN(t.model),d=c.lastAutoInterval,f=c.lastTickCount;return null!=d&&null!=f&&Math.abs(d-h)<=1&&Math.abs(f-o)<=1&&d>h?h=d:(c.lastTickCount=o,c.lastAutoInterval=h),h}},u(Fv,aD);var pN=function(t){this.name=t||"",this.cx=0,this.cy=0,this._radiusAxis=new Gv,this._angleAxis=new Fv,this._radiusAxis.polar=this._angleAxis.polar=this};pN.prototype={type:"polar",axisPointerEnabled:!0,constructor:pN,dimensions:["radius","angle"],model:null,containPoint:function(t){var e=this.pointToCoord(t);return this._radiusAxis.contain(e[0])&&this._angleAxis.contain(e[1])},containData:function(t){return this._radiusAxis.containData(t[0])&&this._angleAxis.containData(t[1])},getAxis:function(t){return this["_"+t+"Axis"]},getAxes:function(){return[this._radiusAxis,this._angleAxis]},getAxesByScale:function(t){var e=[],i=this._angleAxis,n=this._radiusAxis;return i.scale.type===t&&e.push(i),n.scale.type===t&&e.push(n),e},getAngleAxis:function(){return this._angleAxis},getRadiusAxis:function(){return this._radiusAxis},getOtherAxis:function(t){var e=this._angleAxis;return t===e?this._radiusAxis:e},getBaseAxis:function(){return this.getAxesByScale("ordinal")[0]||this.getAxesByScale("time")[0]||this.getAngleAxis()},getTooltipAxes:function(t){var e=null!=t&&"auto"!==t?this.getAxis(t):this.getBaseAxis();return{baseAxes:[e],otherAxes:[this.getOtherAxis(e)]}},dataToPoint:function(t,e){return this.coordToPoint([this._radiusAxis.dataToRadius(t[0],e),this._angleAxis.dataToAngle(t[1],e)])},pointToData:function(t,e){var i=this.pointToCoord(t);return[this._radiusAxis.radiusToData(i[0],e),this._angleAxis.angleToData(i[1],e)]},pointToCoord:function(t){var e=t[0]-this.cx,i=t[1]-this.cy,n=this.getAngleAxis(),o=n.getExtent(),a=Math.min(o[0],o[1]),r=Math.max(o[0],o[1]);n.inverse?a=r-360:r=a+360;var s=Math.sqrt(e*e+i*i);e/=s,i/=s;for(var l=Math.atan2(-i,e)/Math.PI*180,u=lr;)l+=360*u;return[s,l]},coordToPoint:function(t){var e=t[0],i=t[1]/180*Math.PI;return[Math.cos(i)*e+this.cx,-Math.sin(i)*e+this.cy]}};var gN=lI.extend({type:"polarAxis",axis:null,getCoordSysModel:function(){return this.ecModel.queryComponents({mainType:"polar",index:this.option.polarIndex,id:this.option.polarId})[0]}});n(gN.prototype,UA);var mN={angle:{startAngle:90,clockwise:!0,splitNumber:12,axisLabel:{rotate:!1}},radius:{splitNumber:5}};ED("angle",gN,Wv,mN.angle),ED("radius",gN,Wv,mN.radius),Fs({type:"polar",dependencies:["polarAxis","angleAxis"],coordinateSystem:null,findAxisModel:function(t){var e;return this.ecModel.eachComponent(t,function(t){t.getCoordSysModel()===this&&(e=t)},this),e},defaultOption:{zlevel:0,z:0,center:["50%","50%"],radius:"80%"}});var vN={dimensions:pN.prototype.dimensions,create:function(t,e){var i=[];return t.eachComponent("polar",function(t,n){var o=new pN(n);o.update=Zv;var a=o.getRadiusAxis(),r=o.getAngleAxis(),s=t.findAxisModel("radiusAxis"),l=t.findAxisModel("angleAxis");Uv(a,s),Uv(r,l),Hv(o,t,e),i.push(o),t.coordinateSystem=o,o.model=t}),t.eachSeries(function(e){if("polar"===e.get("coordinateSystem")){var i=t.queryComponents({mainType:"polar",index:e.get("polarIndex"),id:e.get("polarId")})[0];e.coordinateSystem=i.coordinateSystem}}),i}};Fa.register("polar",vN);var yN=["axisLine","axisLabel","axisTick","splitLine","splitArea"];XD.extend({type:"angleAxis",axisPointerClass:"PolarAxisPointer",render:function(t,e){if(this.group.removeAll(),t.get("show")){var n=t.axis,o=n.polar,a=o.getRadiusAxis().getExtent(),r=n.getTicksCoords(),s=f(n.getViewLabels(),function(t){return(t=i(t)).coord=n.dataToCoord(t.tickValue),t});Yv(s),Yv(r),d(yN,function(e){!t.get(e+".show")||n.scale.isBlank()&&"axisLine"!==e||this["_"+e](t,o,r,a,s)},this)}},_axisLine:function(t,e,i,n){var o=t.getModel("axisLine.lineStyle"),a=new sM({shape:{cx:e.cx,cy:e.cy,r:n[jv(e)]},style:o.getLineStyle(),z2:1,silent:!0});a.style.fill=null,this.group.add(a)},_axisTick:function(t,e,i,n){var o=t.getModel("axisTick"),a=(o.get("inside")?-1:1)*o.get("length"),s=n[jv(e)],l=f(i,function(t){return new _M({shape:Xv(e,[s,s+a],t.coord)})});this.group.add(OM(l,{style:r(o.getModel("lineStyle").getLineStyle(),{stroke:t.get("axisLine.lineStyle.color")})}))},_axisLabel:function(t,e,i,n,o){var a=t.getCategories(!0),r=t.getModel("axisLabel"),s=r.get("margin");d(o,function(i,o){var l=r,u=i.tickValue,h=n[jv(e)],c=e.coordToPoint([h+s,i.coord]),d=e.cx,f=e.cy,p=Math.abs(c[0]-d)/h<.3?"center":c[0]>d?"left":"right",g=Math.abs(c[1]-f)/h<.3?"middle":c[1]>f?"top":"bottom";a&&a[u]&&a[u].textStyle&&(l=new No(a[u].textStyle,r,r.ecModel));var m=new rM({silent:!0});this.group.add(m),mo(m.style,l,{x:c[0],y:c[1],textFill:l.getTextColor()||t.get("axisLine.lineStyle.color"),text:i.formattedLabel,textAlign:p,textVerticalAlign:g})},this)},_splitLine:function(t,e,i,n){var o=t.getModel("splitLine").getModel("lineStyle"),a=o.get("color"),s=0;a=a instanceof Array?a:[a];for(var l=[],u=0;u=0?"p":"n",M=y;v&&(n[r][b]||(n[r][b]={p:y,n:y}),M=n[r][b][S]);var I,T,A,D;if("radius"===h.dim){var C=h.dataToRadius(w)-y,L=a.dataToAngle(b);Math.abs(C)=0},kN.findTargetInfo=function(t,e){for(var i=this._targetInfoList,n=dy(e,t),o=0;o=0||AN(n,t.getAxis("y").model)>=0)&&a.push(t)}),e.push({panelId:"grid--"+t.id,gridModel:t,coordSysModel:t,coordSys:a[0],coordSyses:a,getPanelRect:ON.grid,xAxisDeclared:r[t.id],yAxisDeclared:s[t.id]})}))},geo:function(t,e){TN(t.geoModels,function(t){var i=t.coordinateSystem;e.push({panelId:"geo--"+t.id,geoModel:t,coordSysModel:t,coordSys:i,coordSyses:[i],getPanelRect:ON.geo})})}},NN=[function(t,e){var i=t.xAxisModel,n=t.yAxisModel,o=t.gridModel;return!o&&i&&(o=i.axis.grid.model),!o&&n&&(o=n.axis.grid.model),o&&o===e.gridModel},function(t,e){var i=t.geoModel;return i&&i===e.geoModel}],ON={grid:function(){return this.coordSys.grid.getRect().clone()},geo:function(){var t=this.coordSys,e=t.getBoundingRect().clone();return e.applyTransform(Ao(t)),e}},EN={lineX:DN(fy,0),lineY:DN(fy,1),rect:function(t,e,i){var n=e[CN[t]]([i[0][0],i[1][0]]),o=e[CN[t]]([i[0][1],i[1][1]]),a=[cy([n[0],o[0]]),cy([n[1],o[1]])];return{values:a,xyMinMax:a}},polygon:function(t,e,i){var n=[[1/0,-1/0],[1/0,-1/0]];return{values:f(i,function(i){var o=e[CN[t]](i);return n[0][0]=Math.min(n[0][0],o[0]),n[1][0]=Math.min(n[1][0],o[1]),n[0][1]=Math.max(n[0][1],o[0]),n[1][1]=Math.max(n[1][1],o[1]),o}),xyMinMax:n}}},RN={lineX:DN(py,0),lineY:DN(py,1),rect:function(t,e,i){return[[t[0][0]-i[0]*e[0][0],t[0][1]-i[0]*e[0][1]],[t[1][0]-i[1]*e[1][0],t[1][1]-i[1]*e[1][1]]]},polygon:function(t,e,i){return f(t,function(t,n){return[t[0]-i[0]*e[n][0],t[1]-i[1]*e[n][1]]})}},zN=["inBrush","outOfBrush"],BN="__ecBrushSelect",VN="__ecInBrushSelectEvent",GN=VT.VISUAL.BRUSH;zs(GN,function(t,e,i){t.eachComponent({mainType:"brush"},function(e){i&&"takeGlobalCursor"===i.type&&e.setBrushOption("brush"===i.key?i.brushOption:{brushType:!1}),(e.brushTargetManager=new hy(e.option,t)).setInputRanges(e.areas,t)})}),Bs(GN,function(t,e,n){var o,a,s=[];t.eachComponent({mainType:"brush"},function(e,n){function l(t){return"all"===m||v[t]}function u(t){return!!t.length}function h(t,e){var i=t.coordinateSystem;w|=i.hasAxisBrushed(),l(e)&&i.eachActiveState(t.getData(),function(t,e){"active"===t&&(x[e]=1)})}function c(i,n,o){var a=_y(i);if(a&&!wy(e,n)&&(d(b,function(n){a[n.brushType]&&e.brushTargetManager.controlSeries(n,i,t)&&o.push(n),w|=u(o)}),l(n)&&u(o))){var r=i.getData();r.each(function(t){xy(a,o,r,t)&&(x[t]=1)})}}var p={brushId:e.id,brushIndex:n,brushName:e.name,areas:i(e.areas),selected:[]};s.push(p);var g=e.option,m=g.brushLink,v=[],x=[],_=[],w=0;n||(o=g.throttleType,a=g.throttleDelay);var b=f(e.areas,function(t){return by(r({boundingRect:FN[t.brushType](t)},t))}),S=ty(e.option,zN,function(t){t.mappingMethod="fixed"});y(m)&&d(m,function(t){v[t]=1}),t.eachSeries(function(t,e){var i=_[e]=[];"parallel"===t.subType?h(t,e):c(t,e,i)}),t.eachSeries(function(t,e){var i={seriesId:t.id,seriesIndex:e,seriesName:t.name,dataIndex:[]};p.selected.push(i);var n=_y(t),o=_[e],a=t.getData(),r=l(e)?function(t){return x[t]?(i.dataIndex.push(a.getRawIndex(t)),"inBrush"):"outOfBrush"}:function(t){return xy(n,o,a,t)?(i.dataIndex.push(a.getRawIndex(t)),"inBrush"):"outOfBrush"};(l(e)?w:u(o))&&iy(zN,S,a,r)})}),vy(e,o,a,s,n)});var FN={lineX:B,lineY:B,rect:function(t){return Sy(t.range)},polygon:function(t){for(var e,i=t.range,n=0,o=i.length;ne[0][1]&&(e[0][1]=a[0]),a[1]e[1][1]&&(e[1][1]=a[1])}return e&&Sy(e)}},WN=["#ddd"];Fs({type:"brush",dependencies:["geo","grid","xAxis","yAxis","parallel","series"],defaultOption:{toolbox:null,brushLink:null,seriesIndex:"all",geoIndex:null,xAxisIndex:null,yAxisIndex:null,brushType:"rect",brushMode:"single",transformable:!0,brushStyle:{borderWidth:1,color:"rgba(120,140,180,0.3)",borderColor:"rgba(120,140,180,0.8)"},throttleType:"fixRate",throttleDelay:0,removeOnClick:!0,z:1e4},areas:[],brushType:null,brushOption:{},coordInfoList:[],optionUpdated:function(t,e){var i=this.option;!e&&ey(i,t,["inBrush","outOfBrush"]);var n=i.inBrush=i.inBrush||{};i.outOfBrush=i.outOfBrush||{color:WN},n.hasOwnProperty("liftZ")||(n.liftZ=5)},setAreas:function(t){t&&(this.areas=f(t,function(t){return My(this.option,t)},this))},setBrushOption:function(t){this.brushOption=My(this.option,t),this.brushType=this.brushOption.brushType}});Ws({type:"brush",init:function(t,e){this.ecModel=t,this.api=e,this.model,(this._brushController=new zf(e.getZr())).on("brush",m(this._onBrush,this)).mount()},render:function(t){return this.model=t,Iy.apply(this,arguments)},updateTransform:Iy,updateView:Iy,dispose:function(){this._brushController.dispose()},_onBrush:function(t,e){var n=this.model.id;this.model.brushTargetManager.setOutputRanges(t,this.ecModel),(!e.isEnd||e.removeOnClick)&&this.api.dispatchAction({type:"brush",brushId:n,areas:i(t),$from:n})}}),Es({type:"brush",event:"brush"},function(t,e){e.eachComponent({mainType:"brush",query:t},function(e){e.setAreas(t.areas)})}),Es({type:"brushSelect",event:"brushSelected",update:"none"},function(){});var HN={},ZN=rT.toolbox.brush;Dy.defaultOption={show:!0,type:["rect","polygon","lineX","lineY","keep","clear"],icon:{rect:"M7.3,34.7 M0.4,10V-0.2h9.8 M89.6,10V-0.2h-9.8 M0.4,60v10.2h9.8 M89.6,60v10.2h-9.8 M12.3,22.4V10.5h13.1 M33.6,10.5h7.8 M49.1,10.5h7.8 M77.5,22.4V10.5h-13 M12.3,31.1v8.2 M77.7,31.1v8.2 M12.3,47.6v11.9h13.1 M33.6,59.5h7.6 M49.1,59.5 h7.7 M77.5,47.6v11.9h-13",polygon:"M55.2,34.9c1.7,0,3.1,1.4,3.1,3.1s-1.4,3.1-3.1,3.1 s-3.1-1.4-3.1-3.1S53.5,34.9,55.2,34.9z M50.4,51c1.7,0,3.1,1.4,3.1,3.1c0,1.7-1.4,3.1-3.1,3.1c-1.7,0-3.1-1.4-3.1-3.1 C47.3,52.4,48.7,51,50.4,51z M55.6,37.1l1.5-7.8 M60.1,13.5l1.6-8.7l-7.8,4 M59,19l-1,5.3 M24,16.1l6.4,4.9l6.4-3.3 M48.5,11.6 l-5.9,3.1 M19.1,12.8L9.7,5.1l1.1,7.7 M13.4,29.8l1,7.3l6.6,1.6 M11.6,18.4l1,6.1 M32.8,41.9 M26.6,40.4 M27.3,40.2l6.1,1.6 M49.9,52.1l-5.6-7.6l-4.9-1.2",lineX:"M15.2,30 M19.7,15.6V1.9H29 M34.8,1.9H40.4 M55.3,15.6V1.9H45.9 M19.7,44.4V58.1H29 M34.8,58.1H40.4 M55.3,44.4 V58.1H45.9 M12.5,20.3l-9.4,9.6l9.6,9.8 M3.1,29.9h16.5 M62.5,20.3l9.4,9.6L62.3,39.7 M71.9,29.9H55.4",lineY:"M38.8,7.7 M52.7,12h13.2v9 M65.9,26.6V32 M52.7,46.3h13.2v-9 M24.9,12H11.8v9 M11.8,26.6V32 M24.9,46.3H11.8v-9 M48.2,5.1l-9.3-9l-9.4,9.2 M38.9-3.9V12 M48.2,53.3l-9.3,9l-9.4-9.2 M38.9,62.3V46.4",keep:"M4,10.5V1h10.3 M20.7,1h6.1 M33,1h6.1 M55.4,10.5V1H45.2 M4,17.3v6.6 M55.6,17.3v6.6 M4,30.5V40h10.3 M20.7,40 h6.1 M33,40h6.1 M55.4,30.5V40H45.2 M21,18.9h62.9v48.6H21V18.9z",clear:"M22,14.7l30.9,31 M52.9,14.7L22,45.7 M4.7,16.8V4.2h13.1 M26,4.2h7.8 M41.6,4.2h7.8 M70.3,16.8V4.2H57.2 M4.7,25.9v8.6 M70.3,25.9v8.6 M4.7,43.2v12.6h13.1 M26,55.8h7.8 M41.6,55.8h7.8 M70.3,43.2v12.6H57.2"},title:i(ZN.title)};var UN=Dy.prototype;UN.render=UN.updateView=function(t,e,i){var n,o,a;e.eachComponent({mainType:"brush"},function(t){n=t.brushType,o=t.brushOption.brushMode||"single",a|=t.areas.length}),this._brushType=n,this._brushMode=o,d(t.get("type",!0),function(e){t.setIconStatus(e,("keep"===e?"multiple"===o:"clear"===e?a:e===n)?"emphasis":"normal")})},UN.getIcons=function(){var t=this.model,e=t.get("icon",!0),i={};return d(t.get("type",!0),function(t){e[t]&&(i[t]=e[t])}),i},UN.onclick=function(t,e,i){var n=this._brushType,o=this._brushMode;"clear"===i?(e.dispatchAction({type:"axisAreaSelect",intervals:[]}),e.dispatchAction({type:"brush",command:"clear",areas:[]})):e.dispatchAction({type:"takeGlobalCursor",key:"brush",brushOption:{brushType:"keep"===i?n:n!==i&&i,brushMode:"keep"===i?"multiple"===o?"single":"multiple":o}})},Ty("brush",Dy),Ns(function(t,e){var i=t&&t.brush;if(y(i)||(i=i?[i]:[]),i.length){var n=[];d(i,function(t){var e=t.hasOwnProperty("toolbox")?t.toolbox:[];e instanceof Array&&(n=n.concat(e))});var o=t&&t.toolbox;y(o)&&(o=o[0]),o||(o={feature:{}},t.toolbox=[o]);var a=o.feature||(o.feature={}),r=a.brush||(a.brush={}),s=r.type||(r.type=[]);s.push.apply(s,n),Jv(s),e&&!s.length&&s.push.apply(s,SN)}});Cy.prototype={constructor:Cy,type:"calendar",dimensions:["time","value"],getDimensionsInfo:function(){return[{name:"time",type:"time"},"value"]},getRangeInfo:function(){return this._rangeInfo},getModel:function(){return this._model},getRect:function(){return this._rect},getCellWidth:function(){return this._sw},getCellHeight:function(){return this._sh},getOrient:function(){return this._orient},getFirstDayOfWeek:function(){return this._firstDayOfWeek},getDateInfo:function(t){var e=(t=Yo(t)).getFullYear(),i=t.getMonth()+1;i=i<10?"0"+i:i;var n=t.getDate();n=n<10?"0"+n:n;var o=t.getDay();return o=Math.abs((o+7-this.getFirstDayOfWeek())%7),{y:e,m:i,d:n,day:o,time:t.getTime(),formatedDate:e+"-"+i+"-"+n,date:t}},getNextNDay:function(t,e){return 0===(e=e||0)?this.getDateInfo(t):((t=new Date(this.getDateInfo(t).time)).setDate(t.getDate()+e),this.getDateInfo(t))},update:function(t,e){function i(t,e){return null!=t[e]&&"auto"!==t[e]}this._firstDayOfWeek=+this._model.getModel("dayLabel").get("firstDay"),this._orient=this._model.get("orient"),this._lineWidth=this._model.getModel("itemStyle").getItemStyle().lineWidth||0,this._rangeInfo=this._getRangeInfo(this._initRangeOption());var n=this._rangeInfo.weeks||1,o=["width","height"],a=this._model.get("cellSize").slice(),r=this._model.getBoxLayoutParams(),s="horizontal"===this._orient?[n,7]:[7,n];d([0,1],function(t){i(a,t)&&(r[o[t]]=a[t]*s[t])});var l={width:e.getWidth(),height:e.getHeight()},u=this._rect=ca(r,l);d([0,1],function(t){i(a,t)||(a[t]=u[o[t]]/s[t])}),this._sw=a[0],this._sh=a[1]},dataToPoint:function(t,e){y(t)&&(t=t[0]),null==e&&(e=!0);var i=this.getDateInfo(t),n=this._rangeInfo,o=i.formatedDate;if(e&&!(i.time>=n.start.time&&i.timea.end.time&&t.reverse(),t},_getRangeInfo:function(t){var e;(t=[this.getDateInfo(t[0]),this.getDateInfo(t[1])])[0].time>t[1].time&&(e=!0,t.reverse());var i=Math.floor(t[1].time/864e5)-Math.floor(t[0].time/864e5)+1,n=new Date(t[0].time),o=n.getDate(),a=t[1].date.getDate();if(n.setDate(o+i-1),n.getDate()!==a)for(var r=n.getTime()-t[1].time>0?1:-1;n.getDate()!==a&&(n.getTime()-t[1].time)*r>0;)i-=r,n.setDate(o+i-1);var s=Math.floor((i+t[0].day+6)/7),l=e?1-s:s-1;return e&&t.reverse(),{range:[t[0].formatedDate,t[1].formatedDate],start:t[0],end:t[1],allDay:i,weeks:s,nthWeek:l,fweek:t[0].day,lweek:t[1].day}},_getDateByWeeksAndDay:function(t,e,i){var n=this._getRangeInfo(i);if(t>n.weeks||0===t&&en.lweek)return!1;var o=7*(t-1)-n.fweek+e,a=new Date(n.start.time);return a.setDate(n.start.d+o),this.getDateInfo(a)}},Cy.dimensions=Cy.prototype.dimensions,Cy.getDimensionsInfo=Cy.prototype.getDimensionsInfo,Cy.create=function(t,e){var i=[];return t.eachComponent("calendar",function(n){var o=new Cy(n,t,e);i.push(o),n.coordinateSystem=o}),t.eachSeries(function(t){"calendar"===t.get("coordinateSystem")&&(t.coordinateSystem=i[t.get("calendarIndex")||0])}),i},Fa.register("calendar",Cy);var XN=lI.extend({type:"calendar",coordinateSystem:null,defaultOption:{zlevel:0,z:2,left:80,top:60,cellSize:20,orient:"horizontal",splitLine:{show:!0,lineStyle:{color:"#000",width:1,type:"solid"}},itemStyle:{color:"#fff",borderWidth:1,borderColor:"#ccc"},dayLabel:{show:!0,firstDay:0,position:"start",margin:"50%",nameMap:"en",color:"#000"},monthLabel:{show:!0,position:"start",margin:5,align:"center",nameMap:"en",formatter:null,color:"#000"},yearLabel:{show:!0,position:null,margin:30,formatter:null,color:"#ccc",fontFamily:"sans-serif",fontWeight:"bolder",fontSize:20}},init:function(t,e,i,n){var o=ga(t);XN.superApply(this,"init",arguments),ky(t,o)},mergeOption:function(t,e){XN.superApply(this,"mergeOption",arguments),ky(this.option,t)}}),jN={EN:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],CN:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},YN={EN:["S","M","T","W","T","F","S"],CN:["日","一","二","三","四","五","六"]};Ws({type:"calendar",_tlpoints:null,_blpoints:null,_firstDayOfMonth:null,_firstDayPoints:null,render:function(t,e,i){var n=this.group;n.removeAll();var o=t.coordinateSystem,a=o.getRangeInfo(),r=o.getOrient();this._renderDayRect(t,a,n),this._renderLines(t,a,r,n),this._renderYearText(t,a,r,n),this._renderMonthText(t,r,n),this._renderWeekText(t,a,r,n)},_renderDayRect:function(t,e,i){for(var n=t.coordinateSystem,o=t.getModel("itemStyle").getItemStyle(),a=n.getCellWidth(),r=n.getCellHeight(),s=e.start.time;s<=e.end.time;s=n.getNextNDay(s,1).time){var l=n.dataToRect([s],!1).tl,u=new yM({shape:{x:l[0],y:l[1],width:a,height:r},cursor:"default",style:o});i.add(u)}},_renderLines:function(t,e,i,n){function o(e){a._firstDayOfMonth.push(r.getDateInfo(e)),a._firstDayPoints.push(r.dataToRect([e],!1).tl);var o=a._getLinePointsOfOneWeek(t,e,i);a._tlpoints.push(o[0]),a._blpoints.push(o[o.length-1]),l&&a._drawSplitline(o,s,n)}var a=this,r=t.coordinateSystem,s=t.getModel("splitLine.lineStyle").getLineStyle(),l=t.get("splitLine.show"),u=s.lineWidth;this._tlpoints=[],this._blpoints=[],this._firstDayOfMonth=[],this._firstDayPoints=[];for(var h=e.start,c=0;h.time<=e.end.time;c++){o(h.formatedDate),0===c&&(h=r.getDateInfo(e.start.y+"-"+e.start.m));var d=h.date;d.setMonth(d.getMonth()+1),h=r.getDateInfo(d)}o(r.getNextNDay(e.end.time,1).formatedDate),l&&this._drawSplitline(a._getEdgesPoints(a._tlpoints,u,i),s,n),l&&this._drawSplitline(a._getEdgesPoints(a._blpoints,u,i),s,n)},_getEdgesPoints:function(t,e,i){var n=[t[0].slice(),t[t.length-1].slice()],o="horizontal"===i?0:1;return n[0][o]=n[0][o]-e/2,n[1][o]=n[1][o]+e/2,n},_drawSplitline:function(t,e,i){var n=new gM({z2:20,shape:{points:t},style:e});i.add(n)},_getLinePointsOfOneWeek:function(t,e,i){var n=t.coordinateSystem;e=n.getDateInfo(e);for(var o=[],a=0;a<7;a++){var r=n.getNextNDay(e.time,a),s=n.dataToRect([r.time],!1);o[2*r.day]=s.tl,o[2*r.day+1]=s["horizontal"===i?"bl":"tr"]}return o},_formatterLabel:function(t,e){return"string"==typeof t&&t?oa(t,e):"function"==typeof t?t(e):e.nameMap},_yearTextPositionControl:function(t,e,i,n,o){e=e.slice();var a=["center","bottom"];"bottom"===n?(e[1]+=o,a=["center","top"]):"left"===n?e[0]-=o:"right"===n?(e[0]+=o,a=["center","top"]):e[1]-=o;var r=0;return"left"!==n&&"right"!==n||(r=Math.PI/2),{rotation:r,position:e,style:{textAlign:a[0],textVerticalAlign:a[1]}}},_renderYearText:function(t,e,i,n){var o=t.getModel("yearLabel");if(o.get("show")){var a=o.get("margin"),r=o.get("position");r||(r="horizontal"!==i?"top":"left");var s=[this._tlpoints[this._tlpoints.length-1],this._blpoints[0]],l=(s[0][0]+s[1][0])/2,u=(s[0][1]+s[1][1])/2,h="horizontal"===i?0:1,c={top:[l,s[h][1]],bottom:[l,s[1-h][1]],left:[s[1-h][0],u],right:[s[h][0],u]},d=e.start.y;+e.end.y>+e.start.y&&(d=d+"-"+e.end.y);var f=o.get("formatter"),p={start:e.start.y,end:e.end.y,nameMap:d},g=this._formatterLabel(f,p),m=new rM({z2:30});mo(m.style,o,{text:g}),m.attr(this._yearTextPositionControl(m,c[r],i,r,a)),n.add(m)}},_monthTextPositionControl:function(t,e,i,n,o){var a="left",r="top",s=t[0],l=t[1];return"horizontal"===i?(l+=o,e&&(a="center"),"start"===n&&(r="bottom")):(s+=o,e&&(r="middle"),"start"===n&&(a="right")),{x:s,y:l,textAlign:a,textVerticalAlign:r}},_renderMonthText:function(t,e,i){var n=t.getModel("monthLabel");if(n.get("show")){var o=n.get("nameMap"),r=n.get("margin"),s=n.get("position"),l=n.get("align"),u=[this._tlpoints,this._blpoints];_(o)&&(o=jN[o.toUpperCase()]||[]);var h="start"===s?0:1,c="horizontal"===e?0:1;r="start"===s?-r:r;for(var d="center"===l,f=0;f=r[0]&&t<=r[1]}if(t===this._dataZoomModel){var n=this._dimName,o=this.getTargetSeriesModels(),a=t.get("filterMode"),r=this._valueWindow;"none"!==a&&$N(o,function(t){var e=t.getData(),o=e.mapDimension(n,!0);o.length&&("weakFilter"===a?e.filterSelf(function(t){for(var i,n,a,s=0;sr[1];if(u&&!h&&!c)return!0;u&&(a=!0),h&&(i=!0),c&&(n=!0)}return a&&i&&n}):$N(o,function(n){if("empty"===a)t.setData(e.map(n,function(t){return i(t)?t:NaN}));else{var o={};o[n]=r,e.selectRange(o)}}),$N(o,function(t){e.setApproximateExtent(r,t)}))})}}};var tO=d,eO=KN,iO=Fs({type:"dataZoom",dependencies:["xAxis","yAxis","zAxis","radiusAxis","angleAxis","singleAxis","series"],defaultOption:{zlevel:0,z:4,orient:null,xAxisIndex:null,yAxisIndex:null,filterMode:"filter",throttle:null,start:0,end:100,startValue:null,endValue:null,minSpan:null,maxSpan:null,minValueSpan:null,maxValueSpan:null,rangeMode:null},init:function(t,e,i){this._dataIntervalByAxis={},this._dataInfo={},this._axisProxies={},this.textStyleModel,this._autoThrottle=!0,this._rangePropMode=["percent","percent"];var n=By(t);this.mergeDefaultAndTheme(t,i),this.doInit(n)},mergeOption:function(t){var e=By(t);n(this.option,t,!0),this.doInit(e)},doInit:function(t){var e=this.option;U_.canvasSupported||(e.realtime=!1),this._setDefaultThrottle(t),Vy(this,t),tO([["start","startValue"],["end","endValue"]],function(t,i){"value"===this._rangePropMode[i]&&(e[t[0]]=null)},this),this.textStyleModel=this.getModel("textStyle"),this._resetTarget(),this._giveAxisProxies()},_giveAxisProxies:function(){var t=this._axisProxies;this.eachTargetAxis(function(e,i,n,o){var a=this.dependentModels[e.axis][i],r=a.__dzAxisProxy||(a.__dzAxisProxy=new QN(e.name,i,this,o));t[e.name+"_"+i]=r},this)},_resetTarget:function(){var t=this.option,e=this._judgeAutoMode();eO(function(e){var i=e.axisIndex;t[i]=Di(t[i])},this),"axisIndex"===e?this._autoSetAxisIndex():"orient"===e&&this._autoSetOrient()},_judgeAutoMode:function(){var t=this.option,e=!1;eO(function(i){null!=t[i.axisIndex]&&(e=!0)},this);var i=t.orient;return null==i&&e?"orient":e?void 0:(null==i&&(t.orient="horizontal"),"axisIndex")},_autoSetAxisIndex:function(){var t=!0,e=this.get("orient",!0),i=this.option,n=this.dependentModels;if(t){var o="vertical"===e?"y":"x";n[o+"Axis"].length?(i[o+"AxisIndex"]=[0],t=!1):tO(n.singleAxis,function(n){t&&n.get("orient",!0)===e&&(i.singleAxisIndex=[n.componentIndex],t=!1)})}t&&eO(function(e){if(t){var n=[],o=this.dependentModels[e.axis];if(o.length&&!n.length)for(var a=0,r=o.length;a0?100:20}},getFirstTargetAxisModel:function(){var t;return eO(function(e){if(null==t){var i=this.get(e.axisIndex);i.length&&(t=this.dependentModels[e.axis][i[0]])}},this),t},eachTargetAxis:function(t,e){var i=this.ecModel;eO(function(n){tO(this.get(n.axisIndex),function(o){t.call(e,n,o,this,i)},this)},this)},getAxisProxy:function(t,e){return this._axisProxies[t+"_"+e]},getAxisModel:function(t,e){var i=this.getAxisProxy(t,e);return i&&i.getAxisModel()},setRawRange:function(t,e){var i=this.option;tO([["start","startValue"],["end","endValue"]],function(e){null==t[e[0]]&&null==t[e[1]]||(i[e[0]]=t[e[0]],i[e[1]]=t[e[1]])},this),!e&&Vy(this,t)},getPercentRange:function(){var t=this.findRepresentativeAxisProxy();if(t)return t.getDataPercentWindow()},getValueRange:function(t,e){if(null!=t||null!=e)return this.getAxisProxy(t,e).getDataValueWindow();var i=this.findRepresentativeAxisProxy();return i?i.getDataValueWindow():void 0},findRepresentativeAxisProxy:function(t){if(t)return t.__dzAxisProxy;var e=this._axisProxies;for(var i in e)if(e.hasOwnProperty(i)&&e[i].hostedBy(this))return e[i];for(var i in e)if(e.hasOwnProperty(i)&&!e[i].hostedBy(this))return e[i]},getRangePropMode:function(){return this._rangePropMode.slice()}}),nO=qI.extend({type:"dataZoom",render:function(t,e,i,n){this.dataZoomModel=t,this.ecModel=e,this.api=i},getTargetCoordInfo:function(){function t(t,e,i,n){for(var o,a=0;a0&&e%g)p+=f;else{var i=null==t||isNaN(t)||""===t,n=i?0:aO(t,a,u,!0);i&&!l&&e?(c.push([c[c.length-1][0],0]),d.push([d[d.length-1][0],0])):!i&&l&&(c.push([p,0]),d.push([p,0])),c.push([p,n]),d.push([p,n]),p+=f,l=i}});var m=this.dataZoomModel;this._displayables.barGroup.add(new pM({shape:{points:c},style:r({fill:m.get("dataBackgroundColor")},m.getModel("dataBackground.areaStyle").getAreaStyle()),silent:!0,z2:-20})),this._displayables.barGroup.add(new gM({shape:{points:d},style:m.getModel("dataBackground.lineStyle").getLineStyle(),silent:!0,z2:-19}))}}},_prepareDataShadowInfo:function(){var t=this.dataZoomModel,e=t.get("showDataShadow");if(!1!==e){var i,n=this.ecModel;return t.eachTargetAxis(function(o,a){d(t.getAxisProxy(o.name,a).getTargetSeriesModels(),function(t){if(!(i||!0!==e&&l(cO,t.get("type"))<0)){var r,s=n.getComponent(o.axis,a).axis,u=Gy(o.name),h=t.coordinateSystem;null!=u&&h.getOtherAxis&&(r=h.getOtherAxis(s).inverse),u=t.getData().mapDimension(u),i={thisAxis:s,series:t,thisDim:o.name,otherDim:u,otherAxisInverse:r}}},this)},this),i}},_renderHandle:function(){var t=this._displayables,e=t.handles=[],i=t.handleLabels=[],n=this._displayables.barGroup,o=this._size,a=this.dataZoomModel;n.add(t.filler=new oO({draggable:!0,cursor:Fy(this._orient),drift:sO(this._onDragMove,this,"all"),onmousemove:function(t){mw(t.event)},ondragstart:sO(this._showDataInfo,this,!0),ondragend:sO(this._onDragEnd,this),onmouseover:sO(this._showDataInfo,this,!0),onmouseout:sO(this._showDataInfo,this,!1),style:{fill:a.get("fillerColor"),textPosition:"inside"}})),n.add(new oO($n({silent:!0,shape:{x:0,y:0,width:o[0],height:o[1]},style:{stroke:a.get("dataBackgroundColor")||a.get("borderColor"),lineWidth:1,fill:"rgba(0,0,0,0)"}}))),lO([0,1],function(t){var o=Po(a.get("handleIcon"),{cursor:Fy(this._orient),draggable:!0,drift:sO(this._onDragMove,this,t),onmousemove:function(t){mw(t.event)},ondragend:sO(this._onDragEnd,this),onmouseover:sO(this._showDataInfo,this,!0),onmouseout:sO(this._showDataInfo,this,!1)},{x:-1,y:0,width:2,height:2}),r=o.getBoundingRect();this._handleHeight=Vo(a.get("handleSize"),this._size[1]),this._handleWidth=r.width/r.height*this._handleHeight,o.setStyle(a.getModel("handleStyle").getItemStyle());var s=a.get("handleColor");null!=s&&(o.style.fill=s),n.add(e[t]=o);var l=a.textStyleModel;this.group.add(i[t]=new rM({silent:!0,invisible:!0,style:{x:0,y:0,text:"",textVerticalAlign:"middle",textAlign:"center",textFill:l.getTextColor(),textFont:l.getFont()},z2:10}))},this)},_resetInterval:function(){var t=this._range=this.dataZoomModel.getPercentRange(),e=this._getViewExtent();this._handleEnds=[aO(t[0],[0,100],e,!0),aO(t[1],[0,100],e,!0)]},_updateInterval:function(t,e){var i=this.dataZoomModel,n=this._handleEnds,o=this._getViewExtent(),a=i.findRepresentativeAxisProxy().getMinMaxSpan(),r=[0,100];QL(e,n,o,i.get("zoomLock")?"all":t,null!=a.minSpan?aO(a.minSpan,r,o,!0):null,null!=a.maxSpan?aO(a.maxSpan,r,o,!0):null);var s=this._range,l=this._range=rO([aO(n[0],o,r,!0),aO(n[1],o,r,!0)]);return!s||s[0]!==l[0]||s[1]!==l[1]},_updateView:function(t){var e=this._displayables,i=this._handleEnds,n=rO(i.slice()),o=this._size;lO([0,1],function(t){var n=e.handles[t],a=this._handleHeight;n.attr({scale:[a/2,a/2],position:[i[t],o[1]/2-a/2]})},this),e.filler.setShape({x:n[0],y:0,width:n[1]-n[0],height:o[1]}),this._updateDataInfo(t)},_updateDataInfo:function(t){function e(t){var e=Ao(n.handles[t].parent,this.group),i=Co(0===t?"right":"left",e),s=this._handleWidth/2+hO,l=Do([c[t]+(0===t?-s:s),this._size[1]/2],e);o[t].setStyle({x:l[0],y:l[1],textVerticalAlign:a===uO?"middle":i,textAlign:a===uO?i:"center",text:r[t]})}var i=this.dataZoomModel,n=this._displayables,o=n.handleLabels,a=this._orient,r=["",""];if(i.get("showDetail")){var s=i.findRepresentativeAxisProxy();if(s){var l=s.getAxisModel().axis,u=this._range,h=t?s.calculateDataWindow({start:u[0],end:u[1]}).valueWindow:s.getDataValueWindow();r=[this._formatLabel(h[0],l),this._formatLabel(h[1],l)]}}var c=rO(this._handleEnds.slice());e.call(this,0),e.call(this,1)},_formatLabel:function(t,e){var i=this.dataZoomModel,n=i.get("labelFormatter"),o=i.get("labelPrecision");null!=o&&"auto"!==o||(o=e.getPixelPrecision());var a=null==t||isNaN(t)?"":"category"===e.type||"time"===e.type?e.scale.getLabel(Math.round(t)):t.toFixed(Math.min(o,20));return x(n)?n(t,a):_(n)?n.replace("{value}",a):a},_showDataInfo:function(t){t=this._dragging||t;var e=this._displayables.handleLabels;e[0].attr("invisible",!t),e[1].attr("invisible",!t)},_onDragMove:function(t,e,i){this._dragging=!0;var n=Do([e,i],this._displayables.barGroup.getLocalTransform(),!0),o=this._updateInterval(t,n[0]),a=this.dataZoomModel.get("realtime");this._updateView(!a),o&&a&&this._dispatchZoomAction()},_onDragEnd:function(){this._dragging=!1,this._showDataInfo(!1),!this.dataZoomModel.get("realtime")&&this._dispatchZoomAction()},_onClickPanelClick:function(t){var e=this._size,i=this._displayables.barGroup.transformCoordToLocal(t.offsetX,t.offsetY);if(!(i[0]<0||i[0]>e[0]||i[1]<0||i[1]>e[1])){var n=this._handleEnds,o=(n[0]+n[1])/2,a=this._updateInterval("all",i[0]-o);this._updateView(),a&&this._dispatchZoomAction()}},_dispatchZoomAction:function(){var t=this._range;this.api.dispatchAction({type:"dataZoom",from:this.uid,dataZoomId:this.dataZoomModel.id,start:t[0],end:t[1]})},_findCoordRect:function(){var t;if(lO(this.getTargetCoordInfo(),function(e){if(!t&&e.length){var i=e[0].model.coordinateSystem;t=i.getRect&&i.getRect()}}),!t){var e=this.api.getWidth(),i=this.api.getHeight();t={x:.2*e,y:.2*i,width:.6*e,height:.6*i}}return t}});iO.extend({type:"dataZoom.inside",defaultOption:{disabled:!1,zoomLock:!1,zoomOnMouseWheel:!0,moveOnMouseMove:!0,moveOnMouseWheel:!1,preventDefaultMouseMove:!0}});var fO="\0_ec_dataZoom_roams",pO=m,gO=nO.extend({type:"dataZoom.inside",init:function(t,e){this._range},render:function(t,e,i,n){gO.superApply(this,"render",arguments),this._range=t.getPercentRange(),d(this.getTargetCoordInfo(),function(e,n){var o=f(e,function(t){return Zy(t.model)});d(e,function(e){var a=e.model,r={};d(["pan","zoom","scrollMove"],function(t){r[t]=pO(mO[t],this,e,n)},this),Wy(i,{coordId:Zy(a),allCoordIds:o,containsPoint:function(t,e,i){return a.coordinateSystem.containPoint([e,i])},dataZoomId:t.id,dataZoomModel:t,getRange:r})},this)},this)},dispose:function(){Hy(this.api,this.dataZoomModel.id),gO.superApply(this,"dispose",arguments),this._range=null}}),mO={zoom:function(t,e,i,n){var o=this._range,a=o.slice(),r=t.axisModels[0];if(r){var s=vO[e](null,[n.originX,n.originY],r,i,t),l=(s.signal>0?s.pixelStart+s.pixelLength-s.pixel:s.pixel-s.pixelStart)/s.pixelLength*(a[1]-a[0])+a[0],u=Math.max(1/n.scale,0);a[0]=(a[0]-l)*u+l,a[1]=(a[1]-l)*u+l;var h=this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();return QL(0,a,[0,100],0,h.minSpan,h.maxSpan),this._range=a,o[0]!==a[0]||o[1]!==a[1]?a:void 0}},pan:Ky(function(t,e,i,n,o,a){var r=vO[n]([a.oldX,a.oldY],[a.newX,a.newY],e,o,i);return r.signal*(t[1]-t[0])*r.pixel/r.pixelLength}),scrollMove:Ky(function(t,e,i,n,o,a){return vO[n]([0,0],[a.scrollDelta,a.scrollDelta],e,o,i).signal*(t[1]-t[0])*a.scrollDelta})},vO={grid:function(t,e,i,n,o){var a=i.axis,r={},s=o.model.coordinateSystem.getRect();return t=t||[0,0],"x"===a.dim?(r.pixel=e[0]-t[0],r.pixelLength=s.width,r.pixelStart=s.x,r.signal=a.inverse?1:-1):(r.pixel=e[1]-t[1],r.pixelLength=s.height,r.pixelStart=s.y,r.signal=a.inverse?-1:1),r},polar:function(t,e,i,n,o){var a=i.axis,r={},s=o.model.coordinateSystem,l=s.getRadiusAxis().getExtent(),u=s.getAngleAxis().getExtent();return t=t?s.pointToCoord(t):[0,0],e=s.pointToCoord(e),"radiusAxis"===i.mainType?(r.pixel=e[0]-t[0],r.pixelLength=l[1]-l[0],r.pixelStart=l[0],r.signal=a.inverse?1:-1):(r.pixel=e[1]-t[1],r.pixelLength=u[1]-u[0],r.pixelStart=u[0],r.signal=a.inverse?-1:1),r},singleAxis:function(t,e,i,n,o){var a=i.axis,r=o.model.coordinateSystem.getRect(),s={};return t=t||[0,0],"horizontal"===a.orient?(s.pixel=e[0]-t[0],s.pixelLength=r.width,s.pixelStart=r.x,s.signal=a.inverse?1:-1):(s.pixel=e[1]-t[1],s.pixelLength=r.height,s.pixelStart=r.y,s.signal=a.inverse?-1:1),s}};Os({getTargetSeries:function(t){var e=R();return t.eachComponent("dataZoom",function(t){t.eachTargetAxis(function(t,i,n){d(n.getAxisProxy(t.name,i).getTargetSeriesModels(),function(t){e.set(t.uid,t)})})}),e},modifyOutputEnd:!0,overallReset:function(t,e){t.eachComponent("dataZoom",function(t){t.eachTargetAxis(function(t,i,n){n.getAxisProxy(t.name,i).reset(n,e)}),t.eachTargetAxis(function(t,i,n){n.getAxisProxy(t.name,i).filterData(n,e)})}),t.eachComponent("dataZoom",function(t){var e=t.findRepresentativeAxisProxy(),i=e.getDataPercentWindow(),n=e.getDataValueWindow();t.setRawRange({start:i[0],end:i[1],startValue:n[0],endValue:n[1]},!0)})}}),Es("dataZoom",function(t,e){var i=Ny(m(e.eachComponent,e,"dataZoom"),KN,function(t,e){return t.get(e.axisIndex)}),n=[];e.eachComponent({mainType:"dataZoom",query:t},function(t,e){n.push.apply(n,i(t).nodes)}),d(n,function(e,i){e.setRawRange({start:t.start,end:t.end,startValue:t.startValue,endValue:t.endValue})})});var yO=d,xO=function(t){var e=t&&t.visualMap;y(e)||(e=e?[e]:[]),yO(e,function(t){if(t){$y(t,"splitList")&&!$y(t,"pieces")&&(t.pieces=t.splitList,delete t.splitList);var e=t.pieces;e&&y(e)&&yO(e,function(t){w(t)&&($y(t,"start")&&!$y(t,"min")&&(t.min=t.start),$y(t,"end")&&!$y(t,"max")&&(t.max=t.end))})}})};lI.registerSubTypeDefaulter("visualMap",function(t){return t.categories||(t.pieces?t.pieces.length>0:t.splitNumber>0)&&!t.calculable?"piecewise":"continuous"});var _O=VT.VISUAL.COMPONENT;Bs(_O,{createOnAllSeries:!0,reset:function(t,e){var i=[];return e.eachComponent("visualMap",function(e){var n=t.pipelineContext;!e.isTargetSeries(t)||n&&n.large||i.push(ny(e.stateList,e.targetVisuals,m(e.getValueState,e),e.getDataDimension(t.getData())))}),i}}),Bs(_O,{createOnAllSeries:!0,reset:function(t,e){var i=t.getData(),n=[];e.eachComponent("visualMap",function(e){if(e.isTargetSeries(t)){var o=e.getVisualMeta(m(Jy,null,t,e))||{stops:[],outerColors:[]},a=e.getDataDimension(i),r=i.getDimensionInfo(a);null!=r&&(o.dimension=r.index,n.push(o))}}),t.getData().setVisual("visualMeta",n)}});var wO={get:function(t,e,n){var o=i((bO[t]||{})[e]);return n&&y(o)?o[o.length-1]:o}},bO={color:{active:["#006edd","#e0ffff"],inactive:["rgba(0,0,0,0)"]},colorHue:{active:[0,360],inactive:[0,0]},colorSaturation:{active:[.3,1],inactive:[0,0]},colorLightness:{active:[.9,.5],inactive:[0,0]},colorAlpha:{active:[.3,1],inactive:[0,0]},opacity:{active:[.3,1],inactive:[0,0]},symbol:{active:["circle","roundRect","diamond"],inactive:["none"]},symbolSize:{active:[10,50],inactive:[0,0]}},SO=hL.mapVisual,MO=hL.eachVisual,IO=y,TO=d,AO=Fo,DO=Bo,CO=B,LO=Fs({type:"visualMap",dependencies:["series"],stateList:["inRange","outOfRange"],replacableOptionKeys:["inRange","outOfRange","target","controller","color"],dataBound:[-1/0,1/0],layoutMode:{type:"box",ignoreSize:!0},defaultOption:{show:!0,zlevel:0,z:4,seriesIndex:"all",min:0,max:200,dimension:null,inRange:null,outOfRange:null,left:0,right:null,top:null,bottom:0,itemWidth:null,itemHeight:null,inverse:!1,orient:"vertical",backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",contentColor:"#5793f3",inactiveColor:"#aaa",borderWidth:0,padding:5,textGap:10,precision:0,color:null,formatter:null,text:null,textStyle:{color:"#333"}},init:function(t,e,i){this._dataExtent,this.targetVisuals={},this.controllerVisuals={},this.textStyleModel,this.itemSize,this.mergeDefaultAndTheme(t,i)},optionUpdated:function(t,e){var i=this.option;U_.canvasSupported||(i.realtime=!1),!e&&ey(i,t,this.replacableOptionKeys),this.textStyleModel=this.getModel("textStyle"),this.resetItemSize(),this.completeVisualOption()},resetVisual:function(t){var e=this.stateList;t=m(t,this),this.controllerVisuals=ty(this.option.controller,e,t),this.targetVisuals=ty(this.option.target,e,t)},getTargetSeriesIndices:function(){var t=this.option.seriesIndex,e=[];return null==t||"all"===t?this.ecModel.eachSeries(function(t,i){e.push(i)}):e=Di(t),e},eachTargetSeries:function(t,e){d(this.getTargetSeriesIndices(),function(i){t.call(e,this.ecModel.getSeriesByIndex(i))},this)},isTargetSeries:function(t){var e=!1;return this.eachTargetSeries(function(i){i===t&&(e=!0)}),e},formatValueText:function(t,e,i){function n(t){return t===l[0]?"min":t===l[1]?"max":(+t).toFixed(Math.min(s,20))}var o,a,r=this.option,s=r.precision,l=this.dataBound,u=r.formatter;return i=i||["<",">"],y(t)&&(t=t.slice(),o=!0),a=e?t:o?[n(t[0]),n(t[1])]:n(t),_(u)?u.replace("{value}",o?a[0]:a).replace("{value2}",o?a[1]:a):x(u)?o?u(t[0],t[1]):u(t):o?t[0]===l[0]?i[0]+" "+a[1]:t[1]===l[1]?i[1]+" "+a[0]:a[0]+" - "+a[1]:a},resetExtent:function(){var t=this.option,e=AO([t.min,t.max]);this._dataExtent=e},getDataDimension:function(t){var e=this.option.dimension,i=t.dimensions;if(null!=e||i.length){if(null!=e)return t.getDimension(e);for(var n=t.dimensions,o=n.length-1;o>=0;o--){var a=n[o];if(!t.getDimensionInfo(a).isCalculationCoord)return a}}},getExtent:function(){return this._dataExtent.slice()},completeVisualOption:function(){function t(t){IO(o.color)&&!t.inRange&&(t.inRange={color:o.color.slice().reverse()}),t.inRange=t.inRange||{color:e.get("gradientColor")},TO(this.stateList,function(e){var i=t[e];if(_(i)){var n=wO.get(i,"active",l);n?(t[e]={},t[e][i]=n):delete t[e]}},this)}var e=this.ecModel,o=this.option,a={inRange:o.inRange,outOfRange:o.outOfRange},r=o.target||(o.target={}),s=o.controller||(o.controller={});n(r,a),n(s,a);var l=this.isCategory();t.call(this,r),t.call(this,s),function(t,e,i){var n=t[e],o=t[i];n&&!o&&(o=t[i]={},TO(n,function(t,e){if(hL.isValidType(e)){var i=wO.get(e,"inactive",l);null!=i&&(o[e]=i,"color"!==e||o.hasOwnProperty("opacity")||o.hasOwnProperty("colorAlpha")||(o.opacity=[0,0]))}}))}.call(this,r,"inRange","outOfRange"),function(t){var e=(t.inRange||{}).symbol||(t.outOfRange||{}).symbol,n=(t.inRange||{}).symbolSize||(t.outOfRange||{}).symbolSize,o=this.get("inactiveColor");TO(this.stateList,function(a){var r=this.itemSize,s=t[a];s||(s=t[a]={color:l?o:[o]}),null==s.symbol&&(s.symbol=e&&i(e)||(l?"roundRect":["roundRect"])),null==s.symbolSize&&(s.symbolSize=n&&i(n)||(l?r[0]:[r[0],r[0]])),s.symbol=SO(s.symbol,function(t){return"none"===t||"square"===t?"roundRect":t});var u=s.symbolSize;if(null!=u){var h=-1/0;MO(u,function(t){t>h&&(h=t)}),s.symbolSize=SO(u,function(t){return DO(t,[0,h],[0,r[0]],!0)})}},this)}.call(this,s)},resetItemSize:function(){this.itemSize=[parseFloat(this.get("itemWidth")),parseFloat(this.get("itemHeight"))]},isCategory:function(){return!!this.option.categories},setSelected:CO,getValueState:CO,getVisualMeta:CO}),kO=[20,140],PO=LO.extend({type:"visualMap.continuous",defaultOption:{align:"auto",calculable:!1,range:null,realtime:!0,itemHeight:null,itemWidth:null,hoverLink:!0,hoverLinkDataSize:null,hoverLinkOnHandle:null},optionUpdated:function(t,e){PO.superApply(this,"optionUpdated",arguments),this.resetExtent(),this.resetVisual(function(t){t.mappingMethod="linear",t.dataExtent=this.getExtent()}),this._resetRange()},resetItemSize:function(){PO.superApply(this,"resetItemSize",arguments);var t=this.itemSize;"horizontal"===this._orient&&t.reverse(),(null==t[0]||isNaN(t[0]))&&(t[0]=kO[0]),(null==t[1]||isNaN(t[1]))&&(t[1]=kO[1])},_resetRange:function(){var t=this.getExtent(),e=this.option.range;!e||e.auto?(t.auto=1,this.option.range=t):y(e)&&(e[0]>e[1]&&e.reverse(),e[0]=Math.max(e[0],t[0]),e[1]=Math.min(e[1],t[1]))},completeVisualOption:function(){LO.prototype.completeVisualOption.apply(this,arguments),d(this.stateList,function(t){var e=this.option.controller[t].symbolSize;e&&e[0]!==e[1]&&(e[0]=0)},this)},setSelected:function(t){this.option.range=t.slice(),this._resetRange()},getSelected:function(){var t=this.getExtent(),e=Fo((this.get("range")||[]).slice());return e[0]>t[1]&&(e[0]=t[1]),e[1]>t[1]&&(e[1]=t[1]),e[0]=i[1]||t<=e[1])?"inRange":"outOfRange"},findTargetDataIndices:function(t){var e=[];return this.eachTargetSeries(function(i){var n=[],o=i.getData();o.each(this.getDataDimension(o),function(e,i){t[0]<=e&&e<=t[1]&&n.push(i)},this),e.push({seriesId:i.id,dataIndex:n})},this),e},getVisualMeta:function(t){function e(e,i){o.push({value:e,color:t(e,i)})}for(var i=Qy(0,0,this.getExtent()),n=Qy(0,0,this.option.range.slice()),o=[],a=0,r=0,s=n.length,l=i.length;rt[1])break;i.push({color:this.getControllerVisual(a,"color",e),offset:o/100})}return i.push({color:this.getControllerVisual(t[1],"color",e),offset:1}),i},_createBarPoints:function(t,e){var i=this.visualMapModel.itemSize;return[[i[0]-e[0],t[0]],[i[0],t[0]],[i[0],t[1]],[i[0]-e[1],t[1]]]},_createBarGroup:function(t){var e=this._orient,i=this.visualMapModel.get("inverse");return new tb("horizontal"!==e||i?"horizontal"===e&&i?{scale:"bottom"===t?[-1,1]:[1,1],rotation:-Math.PI/2}:"vertical"!==e||i?{scale:"left"===t?[1,1]:[-1,1]}:{scale:"left"===t?[1,-1]:[-1,-1]}:{scale:"bottom"===t?[1,1]:[-1,1],rotation:Math.PI/2})},_updateHandle:function(t,e){if(this._useHandle){var i=this._shapes,n=this.visualMapModel,o=i.handleThumbs,a=i.handleLabels;EO([0,1],function(r){var s=o[r];s.setStyle("fill",e.handlesColor[r]),s.position[1]=t[r];var l=Do(i.handleLabelPoints[r],Ao(s,this.group));a[r].setStyle({x:l[0],y:l[1],text:n.formatValueText(this._dataInterval[r]),textVerticalAlign:"middle",textAlign:this._applyTransform("horizontal"===this._orient?0===r?"bottom":"top":"left",i.barGroup)})},this)}},_showIndicator:function(t,e,i,n){var o=this.visualMapModel,a=o.getExtent(),r=o.itemSize,s=[0,r[1]],l=OO(t,a,s,!0),u=this._shapes,h=u.indicator;if(h){h.position[1]=l,h.attr("invisible",!1),h.setShape("points",ox(!!i,n,l,r[1]));var c={convertOpacityToAlpha:!0},d=this.getControllerVisual(t,"color",c);h.setStyle("fill",d);var f=Do(u.indicatorLabelPoint,Ao(h,this.group)),p=u.indicatorLabel;p.attr("invisible",!1);var g=this._applyTransform("left",u.barGroup),m=this._orient;p.setStyle({text:(i||"")+o.formatValueText(e),textVerticalAlign:"horizontal"===m?g:"middle",textAlign:"horizontal"===m?"center":g,x:f[0],y:f[1]})}},_enableHoverLinkToSeries:function(){var t=this;this._shapes.barGroup.on("mousemove",function(e){if(t._hovering=!0,!t._dragging){var i=t.visualMapModel.itemSize,n=t._applyTransform([e.offsetX,e.offsetY],t._shapes.barGroup,!0,!0);n[1]=RO(zO(0,n[1]),i[1]),t._doHoverLinkToSeries(n[1],0<=n[0]&&n[0]<=i[0])}}).on("mouseout",function(){t._hovering=!1,!t._dragging&&t._clearHoverLinkToSeries()})},_enableHoverLinkFromSeries:function(){var t=this.api.getZr();this.visualMapModel.option.hoverLink?(t.on("mouseover",this._hoverLinkFromSeriesMouseOver,this),t.on("mouseout",this._hideIndicator,this)):this._clearHoverLinkFromSeries()},_doHoverLinkToSeries:function(t,e){var i=this.visualMapModel,n=i.itemSize;if(i.option.hoverLink){var o=[0,n[1]],a=i.getExtent();t=RO(zO(o[0],t),o[1]);var r=ax(i,a,o),s=[t-r,t+r],l=OO(t,o,a,!0),u=[OO(s[0],o,a,!0),OO(s[1],o,a,!0)];s[0]o[1]&&(u[1]=1/0),e&&(u[0]===-1/0?this._showIndicator(l,u[1],"< ",r):u[1]===1/0?this._showIndicator(l,u[0],"> ",r):this._showIndicator(l,l,"≈ ",r));var h=this._hoverLinkDataIndices,c=[];(e||rx(i))&&(c=this._hoverLinkDataIndices=i.findTargetDataIndices(u));var d=Ri(h,c);this._dispatchHighDown("downplay",ex(d[0])),this._dispatchHighDown("highlight",ex(d[1]))}},_hoverLinkFromSeriesMouseOver:function(t){var e=t.target,i=this.visualMapModel;if(e&&null!=e.dataIndex){var n=this.ecModel.getSeriesByIndex(e.seriesIndex);if(i.isTargetSeries(n)){var o=n.getData(e.dataType),a=o.get(i.getDataDimension(o),e.dataIndex,!0);isNaN(a)||this._showIndicator(a,a)}}},_hideIndicator:function(){var t=this._shapes;t.indicator&&t.indicator.attr("invisible",!0),t.indicatorLabel&&t.indicatorLabel.attr("invisible",!0)},_clearHoverLinkToSeries:function(){this._hideIndicator();var t=this._hoverLinkDataIndices;this._dispatchHighDown("downplay",ex(t)),t.length=0},_clearHoverLinkFromSeries:function(){this._hideIndicator();var t=this.api.getZr();t.off("mouseover",this._hoverLinkFromSeriesMouseOver),t.off("mouseout",this._hideIndicator)},_applyTransform:function(t,e,i,n){var o=Ao(e,n?null:this.group);return zM[y(t)?"applyTransform":"transformDirection"](t,o,i)},_dispatchHighDown:function(t,e){e&&e.length&&this.api.dispatchAction({type:t,batch:e})},dispose:function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()},remove:function(){this._clearHoverLinkFromSeries(),this._clearHoverLinkToSeries()}});Es({type:"selectDataRange",event:"dataRangeSelected",update:"update"},function(t,e){e.eachComponent({mainType:"visualMap",query:t},function(e){e.setSelected(t.selected)})}),Ns(xO);var FO=LO.extend({type:"visualMap.piecewise",defaultOption:{selected:null,minOpen:!1,maxOpen:!1,align:"auto",itemWidth:20,itemHeight:14,itemSymbol:"roundRect",pieceList:null,categories:null,splitNumber:5,selectedMode:"multiple",itemGap:10,hoverLink:!0,showLabel:null},optionUpdated:function(t,e){FO.superApply(this,"optionUpdated",arguments),this._pieceList=[],this.resetExtent();var n=this._mode=this._determineMode();WO[this._mode].call(this),this._resetSelected(t,e);var o=this.option.categories;this.resetVisual(function(t,e){"categories"===n?(t.mappingMethod="category",t.categories=i(o)):(t.dataExtent=this.getExtent(),t.mappingMethod="piecewise",t.pieceList=f(this._pieceList,function(t){var t=i(t);return"inRange"!==e&&(t.visual=null),t}))})},completeVisualOption:function(){function t(t,e,i){return t&&t[e]&&(w(t[e])?t[e].hasOwnProperty(i):t[e]===i)}var e=this.option,i={},n=hL.listVisualTypes(),o=this.isCategory();d(e.pieces,function(t){d(n,function(e){t.hasOwnProperty(e)&&(i[e]=1)})}),d(i,function(i,n){var a=0;d(this.stateList,function(i){a|=t(e,i,n)||t(e.target,i,n)},this),!a&&d(this.stateList,function(t){(e[t]||(e[t]={}))[n]=wO.get(n,"inRange"===t?"active":"inactive",o)})},this),LO.prototype.completeVisualOption.apply(this,arguments)},_resetSelected:function(t,e){var i=this.option,n=this._pieceList,o=(e?i:t).selected||{};if(i.selected=o,d(n,function(t,e){var i=this.getSelectedMapKey(t);o.hasOwnProperty(i)||(o[i]=!0)},this),"single"===i.selectedMode){var a=!1;d(n,function(t,e){var i=this.getSelectedMapKey(t);o[i]&&(a?o[i]=!1:a=!0)},this)}},getSelectedMapKey:function(t){return"categories"===this._mode?t.value+"":t.index+""},getPieceList:function(){return this._pieceList},_determineMode:function(){var t=this.option;return t.pieces&&t.pieces.length>0?"pieces":this.option.categories?"categories":"splitNumber"},setSelected:function(t){this.option.selected=i(t)},getValueState:function(t){var e=hL.findPieceIndex(t,this._pieceList);return null!=e&&this.option.selected[this.getSelectedMapKey(this._pieceList[e])]?"inRange":"outOfRange"},findTargetDataIndices:function(t){var e=[];return this.eachTargetSeries(function(i){var n=[],o=i.getData();o.each(this.getDataDimension(o),function(e,i){hL.findPieceIndex(e,this._pieceList)===t&&n.push(i)},this),e.push({seriesId:i.id,dataIndex:n})},this),e},getRepresentValue:function(t){var e;if(this.isCategory())e=t.value;else if(null!=t.value)e=t.value;else{var i=t.interval||[];e=i[0]===-1/0&&i[1]===1/0?0:(i[0]+i[1])/2}return e},getVisualMeta:function(t){function e(e,a){var r=o.getRepresentValue({interval:e});a||(a=o.getValueState(r));var s=t(r,a);e[0]===-1/0?n[0]=s:e[1]===1/0?n[1]=s:i.push({value:e[0],color:s},{value:e[1],color:s})}if(!this.isCategory()){var i=[],n=[],o=this,a=this._pieceList.slice();if(a.length){var r=a[0].interval[0];r!==-1/0&&a.unshift({interval:[-1/0,r]}),(r=a[a.length-1].interval[1])!==1/0&&a.push({interval:[r,1/0]})}else a.push({interval:[-1/0,1/0]});var s=-1/0;return d(a,function(t){var i=t.interval;i&&(i[0]>s&&e([s,i[0]],"outOfRange"),e(i.slice()),s=i[1])},this),{stops:i,outerColors:n}}}}),WO={splitNumber:function(){var t=this.option,e=this._pieceList,i=Math.min(t.precision,20),n=this.getExtent(),o=t.splitNumber;o=Math.max(parseInt(o,10),1),t.splitNumber=o;for(var a=(n[1]-n[0])/o;+a.toFixed(i)!==a&&i<5;)i++;t.precision=i,a=+a.toFixed(i);var r=0;t.minOpen&&e.push({index:r++,interval:[-1/0,n[0]],close:[0,0]});for(var s=n[0],l=r+o;r","≥"][e[0]]];t.text=t.text||this.formatValueText(null!=t.value?t.value:t.interval,!1,i)},this)}};NO.extend({type:"visualMap.piecewise",doRender:function(){var t=this.group;t.removeAll();var e=this.visualMapModel,i=e.get("textGap"),n=e.textStyleModel,o=n.getFont(),a=n.getTextColor(),r=this._getItemAlign(),s=e.itemSize,l=this._getViewData(),u=l.endsText,h=T(e.get("showLabel",!0),!u);u&&this._renderEndsText(t,u[0],s,h,r),d(l.viewPieceList,function(n){var l=n.piece,u=new tb;u.onclick=m(this._onItemClick,this,l),this._enableHoverLink(u,n.indexInModelPieceList);var c=e.getRepresentValue(l);if(this._createItemSymbol(u,c,[0,0,s[0],s[1]]),h){var d=this.visualMapModel.getValueState(c);u.add(new rM({style:{x:"right"===r?-i:s[0]+i,y:s[1]/2,text:l.text,textVerticalAlign:"middle",textAlign:r,textFont:o,textFill:a,opacity:"outOfRange"===d?.5:1}}))}t.add(u)},this),u&&this._renderEndsText(t,u[1],s,h,r),aI(e.get("orient"),t,e.get("itemGap")),this.renderBackground(t),this.positionGroup(t)},_enableHoverLink:function(t,e){function i(t){var i=this.visualMapModel;i.option.hoverLink&&this.api.dispatchAction({type:t,batch:ex(i.findTargetDataIndices(e))})}t.on("mouseover",m(i,this,"highlight")).on("mouseout",m(i,this,"downplay"))},_getItemAlign:function(){var t=this.visualMapModel,e=t.option;if("vertical"===e.orient)return tx(t,this.api,t.itemSize);var i=e.align;return i&&"auto"!==i||(i="left"),i},_renderEndsText:function(t,e,i,n,o){if(e){var a=new tb,r=this.visualMapModel.textStyleModel;a.add(new rM({style:{x:n?"right"===o?i[0]:0:i[0]/2,y:i[1]/2,textVerticalAlign:"middle",textAlign:n?o:"center",text:e,textFont:r.getFont(),textFill:r.getTextColor()}})),t.add(a)}},_getViewData:function(){var t=this.visualMapModel,e=f(t.getPieceList(),function(t,e){return{piece:t,indexInModelPieceList:e}}),i=t.get("text"),n=t.get("orient"),o=t.get("inverse");return("horizontal"===n?o:!o)?e.reverse():i&&(i=i.slice().reverse()),{viewPieceList:e,endsText:i}},_createItemSymbol:function(t,e,i){t.add(Jl(this.getControllerVisual(e,"symbol"),i[0],i[1],i[2],i[3],this.getControllerVisual(e,"color")))},_onItemClick:function(t){var e=this.visualMapModel,n=e.option,o=i(n.selected),a=e.getSelectedMapKey(t);"single"===n.selectedMode?(o[a]=!0,d(o,function(t,e){o[e]=e===a})):o[a]=!o[a],this.api.dispatchAction({type:"selectDataRange",from:this.uid,visualMapId:this.visualMapModel.id,selected:o})}});Ns(xO);var HO=ta,ZO=ia,UO=Fs({type:"marker",dependencies:["series","grid","polar","geo"],init:function(t,e,i,n){this.mergeDefaultAndTheme(t,i),this.mergeOption(t,i,n.createdBySelf,!0)},isAnimationEnabled:function(){if(U_.node)return!1;var t=this.__hostSeries;return this.getShallow("animation")&&t&&t.isAnimationEnabled()},mergeOption:function(t,e,i,n){var o=this.constructor,r=this.mainType+"Model";i||e.eachSeries(function(t){var i=t.get(this.mainType,!0),s=t[r];i&&i.data?(s?s.mergeOption(i,e,!0):(n&&ux(i),d(i.data,function(t){t instanceof Array?(ux(t[0]),ux(t[1])):ux(t)}),a(s=new o(i,this,e),{mainType:this.mainType,seriesIndex:t.seriesIndex,name:t.name,createdBySelf:!0}),s.__hostSeries=t),t[r]=s):t[r]=null},this)},formatTooltip:function(t){var e=this.getData(),i=this.getRawValue(t),n=y(i)?f(i,HO).join(", "):HO(i),o=e.getName(t),a=ZO(this.name);return(null!=i||o)&&(a+="
"),o&&(a+=ZO(o),null!=i&&(a+=" : ")),null!=i&&(a+=ZO(n)),a},getData:function(){return this._data},setData:function(t){this._data=t}});h(UO,ZI),UO.extend({type:"markPoint",defaultOption:{zlevel:0,z:5,symbol:"pin",symbolSize:50,tooltip:{trigger:"item"},label:{show:!0,position:"inside"},itemStyle:{borderWidth:2},emphasis:{label:{show:!0}}}});var XO=l,jO=v,YO={min:jO(dx,"min"),max:jO(dx,"max"),average:jO(dx,"average")},qO=Ws({type:"marker",init:function(){this.markerGroupMap=R()},render:function(t,e,i){var n=this.markerGroupMap;n.each(function(t){t.__keep=!1});var o=this.type+"Model";e.eachSeries(function(t){var n=t[o];n&&this.renderSeries(t,n,e,i)},this),n.each(function(t){!t.__keep&&this.group.remove(t.group)},this)},renderSeries:function(){}});qO.extend({type:"markPoint",updateTransform:function(t,e,i){e.eachSeries(function(t){var e=t.markPointModel;e&&(xx(e.getData(),t,i),this.markerGroupMap.get(t.id).updateLayout(e))},this)},renderSeries:function(t,e,i,n){var o=t.coordinateSystem,a=t.id,r=t.getData(),s=this.markerGroupMap,l=s.get(a)||s.set(a,new Du),u=_x(o,t,e);e.setData(u),xx(e.getData(),t,n),u.each(function(t){var i=u.getItemModel(t),n=i.getShallow("symbolSize");"function"==typeof n&&(n=n(e.getRawValue(t),e.getDataParams(t))),u.setItemVisual(t,{symbolSize:n,color:i.get("itemStyle.color")||r.getVisual("color"),symbol:i.getShallow("symbol")})}),l.updateData(u),this.group.add(l.group),u.eachItemGraphicEl(function(t){t.traverse(function(t){t.dataModel=e})}),l.__keep=!0,l.group.silent=e.get("silent")||t.get("silent")}}),Ns(function(t){t.markPoint=t.markPoint||{}}),UO.extend({type:"markLine",defaultOption:{zlevel:0,z:5,symbol:["circle","arrow"],symbolSize:[8,16],precision:2,tooltip:{trigger:"item"},label:{show:!0,position:"end"},lineStyle:{type:"dashed"},emphasis:{label:{show:!0},lineStyle:{width:3}},animationEasing:"linear"}});var KO=function(t,e,o,r){var s=t.getData(),l=r.type;if(!y(r)&&("min"===l||"max"===l||"average"===l||"median"===l||null!=r.xAxis||null!=r.yAxis)){var u,h;if(null!=r.yAxis||null!=r.xAxis)u=null!=r.yAxis?"y":"x",e.getAxis(u),h=T(r.yAxis,r.xAxis);else{var c=px(r,s,e,t);u=c.valueDataDim,c.valueAxis,h=yx(s,u,l)}var d="x"===u?0:1,f=1-d,p=i(r),g={};p.type=null,p.coord=[],g.coord=[],p.coord[f]=-1/0,g.coord[f]=1/0;var m=o.get("precision");m>=0&&"number"==typeof h&&(h=+h.toFixed(Math.min(m,20))),p.coord[d]=g.coord[d]=h,r=[p,g,{type:l,valueIndex:r.valueIndex,value:h}]}return r=[fx(t,r[0]),fx(t,r[1]),a({},r[2])],r[2].type=r[2].type||"",n(r[2],r[0]),n(r[2],r[1]),r};qO.extend({type:"markLine",updateTransform:function(t,e,i){e.eachSeries(function(t){var e=t.markLineModel;if(e){var n=e.getData(),o=e.__from,a=e.__to;o.each(function(e){Ix(o,e,!0,t,i),Ix(a,e,!1,t,i)}),n.each(function(t){n.setItemLayout(t,[o.getItemLayout(t),a.getItemLayout(t)])}),this.markerGroupMap.get(t.id).updateLayout()}},this)},renderSeries:function(t,e,i,n){function o(e,i,o){var a=e.getItemModel(i);Ix(e,i,o,t,n),e.setItemVisual(i,{symbolSize:a.get("symbolSize")||g[o?0:1],symbol:a.get("symbol",!0)||p[o?0:1],color:a.get("itemStyle.color")||s.getVisual("color")})}var a=t.coordinateSystem,r=t.id,s=t.getData(),l=this.markerGroupMap,u=l.get(r)||l.set(r,new sf);this.group.add(u.group);var h=Tx(a,t,e),c=h.from,d=h.to,f=h.line;e.__from=c,e.__to=d,e.setData(f);var p=e.get("symbol"),g=e.get("symbolSize");y(p)||(p=[p,p]),"number"==typeof g&&(g=[g,g]),h.from.each(function(t){o(c,t,!0),o(d,t,!1)}),f.each(function(t){var e=f.getItemModel(t).get("lineStyle.color");f.setItemVisual(t,{color:e||c.getItemVisual(t,"color")}),f.setItemLayout(t,[c.getItemLayout(t),d.getItemLayout(t)]),f.setItemVisual(t,{fromSymbolSize:c.getItemVisual(t,"symbolSize"),fromSymbol:c.getItemVisual(t,"symbol"),toSymbolSize:d.getItemVisual(t,"symbolSize"),toSymbol:d.getItemVisual(t,"symbol")})}),u.updateData(f),h.line.eachItemGraphicEl(function(t,i){t.traverse(function(t){t.dataModel=e})}),u.__keep=!0,u.group.silent=e.get("silent")||t.get("silent")}}),Ns(function(t){t.markLine=t.markLine||{}}),UO.extend({type:"markArea",defaultOption:{zlevel:0,z:1,tooltip:{trigger:"item"},animation:!1,label:{show:!0,position:"top"},itemStyle:{borderWidth:0},emphasis:{label:{show:!0,position:"top"}}}});var $O=function(t,e,i,n){var a=fx(t,n[0]),r=fx(t,n[1]),s=T,l=a.coord,u=r.coord;l[0]=s(l[0],-1/0),l[1]=s(l[1],-1/0),u[0]=s(u[0],1/0),u[1]=s(u[1],1/0);var h=o([{},a,r]);return h.coord=[a.coord,r.coord],h.x0=a.x,h.y0=a.y,h.x1=r.x,h.y1=r.y,h},JO=[["x0","y0"],["x1","y0"],["x1","y1"],["x0","y1"]];qO.extend({type:"markArea",updateTransform:function(t,e,i){e.eachSeries(function(t){var e=t.markAreaModel;if(e){var n=e.getData();n.each(function(e){var o=f(JO,function(o){return Lx(n,e,o,t,i)});n.setItemLayout(e,o),n.getItemGraphicEl(e).setShape("points",o)})}},this)},renderSeries:function(t,e,i,n){var o=t.coordinateSystem,a=t.id,s=t.getData(),l=this.markerGroupMap,u=l.get(a)||l.set(a,{group:new tb});this.group.add(u.group),u.__keep=!0;var h=kx(o,t,e);e.setData(h),h.each(function(e){h.setItemLayout(e,f(JO,function(i){return Lx(h,e,i,t,n)})),h.setItemVisual(e,{color:s.getVisual("color")})}),h.diff(u.__data).add(function(t){var e=new pM({shape:{points:h.getItemLayout(t)}});h.setItemGraphicEl(t,e),u.group.add(e)}).update(function(t,i){var n=u.__data.getItemGraphicEl(i);Io(n,{shape:{points:h.getItemLayout(t)}},e,t),u.group.add(n),h.setItemGraphicEl(t,n)}).remove(function(t){var e=u.__data.getItemGraphicEl(t);u.group.remove(e)}).execute(),h.eachItemGraphicEl(function(t,i){var n=h.getItemModel(i),o=n.getModel("label"),a=n.getModel("emphasis.label"),s=h.getItemVisual(i,"color");t.useStyle(r(n.getModel("itemStyle").getItemStyle(),{fill:Yt(s,.4),stroke:s})),t.hoverStyle=n.getModel("emphasis.itemStyle").getItemStyle(),go(t.style,t.hoverStyle,o,a,{labelFetcher:e,labelDataIndex:i,defaultText:h.getName(i)||"",isRectText:!0,autoColor:s}),fo(t,{}),t.dataModel=e}),u.__data=h,u.group.silent=e.get("silent")||t.get("silent")}}),Ns(function(t){t.markArea=t.markArea||{}});lI.registerSubTypeDefaulter("timeline",function(){return"slider"}),Es({type:"timelineChange",event:"timelineChanged",update:"prepareAndUpdate"},function(t,e){var i=e.getComponent("timeline");return i&&null!=t.currentIndex&&(i.setCurrentIndex(t.currentIndex),!i.get("loop",!0)&&i.isIndexMax()&&i.setPlayState(!1)),e.resetOption("timeline"),r({currentIndex:i.option.currentIndex},t)}),Es({type:"timelinePlayChange",event:"timelinePlayChanged",update:"update"},function(t,e){var i=e.getComponent("timeline");i&&null!=t.playState&&i.setPlayState(t.playState)});var QO=lI.extend({type:"timeline",layoutMode:"box",defaultOption:{zlevel:0,z:4,show:!0,axisType:"time",realtime:!0,left:"20%",top:null,right:"20%",bottom:0,width:null,height:40,padding:5,controlPosition:"left",autoPlay:!1,rewind:!1,loop:!0,playInterval:2e3,currentIndex:0,itemStyle:{},label:{color:"#000"},data:[]},init:function(t,e,i){this._data,this._names,this.mergeDefaultAndTheme(t,i),this._initData()},mergeOption:function(t){QO.superApply(this,"mergeOption",arguments),this._initData()},setCurrentIndex:function(t){null==t&&(t=this.option.currentIndex);var e=this._data.count();this.option.loop?t=(t%e+e)%e:(t>=e&&(t=e-1),t<0&&(t=0)),this.option.currentIndex=t},getCurrentIndex:function(){return this.option.currentIndex},isIndexMax:function(){return this.getCurrentIndex()>=this._data.count()-1},setPlayState:function(t){this.option.autoPlay=!!t},getPlayState:function(){return!!this.option.autoPlay},_initData:function(){var t=this.option,e=t.data||[],n=t.axisType,o=this._names=[];if("category"===n){var a=[];d(e,function(t,e){var n,r=Li(t);w(t)?(n=i(t)).value=e:n=e,a.push(n),_(r)||null!=r&&!isNaN(r)||(r=""),o.push(r+"")}),e=a}var r={category:"ordinal",time:"time"}[n]||"number";(this._data=new vA([{name:"value",type:r}],this)).initData(e,o)},getData:function(){return this._data},getCategories:function(){if("category"===this.get("axisType"))return this._names.slice()}});h(QO.extend({type:"timeline.slider",defaultOption:{backgroundColor:"rgba(0,0,0,0)",borderColor:"#ccc",borderWidth:0,orient:"horizontal",inverse:!1,tooltip:{trigger:"item"},symbol:"emptyCircle",symbolSize:10,lineStyle:{show:!0,width:2,color:"#304654"},label:{position:"auto",show:!0,interval:"auto",rotate:0,color:"#304654"},itemStyle:{color:"#304654",borderWidth:1},checkpointStyle:{symbol:"circle",symbolSize:13,color:"#c23531",borderWidth:5,borderColor:"rgba(194,53,49, 0.5)",animation:!0,animationDuration:300,animationEasing:"quinticInOut"},controlStyle:{show:!0,showPlayBtn:!0,showPrevBtn:!0,showNextBtn:!0,itemSize:22,itemGap:12,position:"left",playIcon:"path://M31.6,53C17.5,53,6,41.5,6,27.4S17.5,1.8,31.6,1.8C45.7,1.8,57.2,13.3,57.2,27.4S45.7,53,31.6,53z M31.6,3.3 C18.4,3.3,7.5,14.1,7.5,27.4c0,13.3,10.8,24.1,24.1,24.1C44.9,51.5,55.7,40.7,55.7,27.4C55.7,14.1,44.9,3.3,31.6,3.3z M24.9,21.3 c0-2.2,1.6-3.1,3.5-2l10.5,6.1c1.899,1.1,1.899,2.9,0,4l-10.5,6.1c-1.9,1.1-3.5,0.2-3.5-2V21.3z",stopIcon:"path://M30.9,53.2C16.8,53.2,5.3,41.7,5.3,27.6S16.8,2,30.9,2C45,2,56.4,13.5,56.4,27.6S45,53.2,30.9,53.2z M30.9,3.5C17.6,3.5,6.8,14.4,6.8,27.6c0,13.3,10.8,24.1,24.101,24.1C44.2,51.7,55,40.9,55,27.6C54.9,14.4,44.1,3.5,30.9,3.5z M36.9,35.8c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H36c0.5,0,0.9,0.4,0.9,1V35.8z M27.8,35.8 c0,0.601-0.4,1-0.9,1h-1.3c-0.5,0-0.9-0.399-0.9-1V19.5c0-0.6,0.4-1,0.9-1H27c0.5,0,0.9,0.4,0.9,1L27.8,35.8L27.8,35.8z",nextIcon:"path://M18.6,50.8l22.5-22.5c0.2-0.2,0.3-0.4,0.3-0.7c0-0.3-0.1-0.5-0.3-0.7L18.7,4.4c-0.1-0.1-0.2-0.3-0.2-0.5 c0-0.4,0.3-0.8,0.8-0.8c0.2,0,0.5,0.1,0.6,0.3l23.5,23.5l0,0c0.2,0.2,0.3,0.4,0.3,0.7c0,0.3-0.1,0.5-0.3,0.7l-0.1,0.1L19.7,52 c-0.1,0.1-0.3,0.2-0.5,0.2c-0.4,0-0.8-0.3-0.8-0.8C18.4,51.2,18.5,51,18.6,50.8z",prevIcon:"path://M43,52.8L20.4,30.3c-0.2-0.2-0.3-0.4-0.3-0.7c0-0.3,0.1-0.5,0.3-0.7L42.9,6.4c0.1-0.1,0.2-0.3,0.2-0.5 c0-0.4-0.3-0.8-0.8-0.8c-0.2,0-0.5,0.1-0.6,0.3L18.3,28.8l0,0c-0.2,0.2-0.3,0.4-0.3,0.7c0,0.3,0.1,0.5,0.3,0.7l0.1,0.1L41.9,54 c0.1,0.1,0.3,0.2,0.5,0.2c0.4,0,0.8-0.3,0.8-0.8C43.2,53.2,43.1,53,43,52.8z",color:"#304654",borderColor:"#304654",borderWidth:1},emphasis:{label:{show:!0,color:"#c23531"},itemStyle:{color:"#c23531"},controlStyle:{color:"#c23531",borderColor:"#c23531",borderWidth:2}},data:[]}}),ZI);var tE=qI.extend({type:"timeline"}),eE=function(t,e,i,n){aD.call(this,t,e,i),this.type=n||"value",this.model=null};eE.prototype={constructor:eE,getLabelModel:function(){return this.model.getModel("label")},isHorizontal:function(){return"horizontal"===this.model.get("orient")}},u(eE,aD);var iE=m,nE=d,oE=Math.PI;tE.extend({type:"timeline.slider",init:function(t,e){this.api=e,this._axis,this._viewRect,this._timer,this._currentPointer,this._mainGroup,this._labelGroup},render:function(t,e,i,n){if(this.model=t,this.api=i,this.ecModel=e,this.group.removeAll(),t.get("show",!0)){var o=this._layout(t,i),a=this._createGroup("mainGroup"),r=this._createGroup("labelGroup"),s=this._axis=this._createAxis(o,t);t.formatTooltip=function(t){return ia(s.scale.getLabel(t))},nE(["AxisLine","AxisTick","Control","CurrentPointer"],function(e){this["_render"+e](o,a,s,t)},this),this._renderAxisLabel(o,r,s,t),this._position(o,t)}this._doPlayStop()},remove:function(){this._clearTimer(),this.group.removeAll()},dispose:function(){this._clearTimer()},_layout:function(t,e){var i=t.get("label.position"),n=t.get("orient"),o=Ex(t,e);null==i||"auto"===i?i="horizontal"===n?o.y+o.height/2=0||"+"===i?"left":"right"},r={horizontal:i>=0||"+"===i?"top":"bottom",vertical:"middle"},s={horizontal:0,vertical:oE/2},l="vertical"===n?o.height:o.width,u=t.getModel("controlStyle"),h=u.get("show",!0),c=h?u.get("itemSize"):0,d=h?u.get("itemGap"):0,f=c+d,p=t.get("label.rotate")||0;p=p*oE/180;var g,m,v,y,x=u.get("position",!0),_=h&&u.get("showPlayBtn",!0),w=h&&u.get("showPrevBtn",!0),b=h&&u.get("showNextBtn",!0),S=0,M=l;return"left"===x||"bottom"===x?(_&&(g=[0,0],S+=f),w&&(m=[S,0],S+=f),b&&(v=[M-c,0],M-=f)):(_&&(g=[M-c,0],M-=f),w&&(m=[0,0],S+=f),b&&(v=[M-c,0],M-=f)),y=[S,M],t.get("inverse")&&y.reverse(),{viewRect:o,mainLength:l,orient:n,rotation:s[n],labelRotation:p,labelPosOpt:i,labelAlign:t.get("label.align")||a[n],labelBaseline:t.get("label.verticalAlign")||t.get("label.baseline")||r[n],playPosition:g,prevBtnPosition:m,nextBtnPosition:v,axisExtent:y,controlSize:c,controlGap:d}},_position:function(t,e){function i(t){var e=t.position;t.origin=[c[0][0]-e[0],c[1][0]-e[1]]}function n(t){return[[t.x,t.x+t.width],[t.y,t.y+t.height]]}function o(t,e,i,n,o){t[n]+=i[n][o]-e[n][o]}var a=this._mainGroup,r=this._labelGroup,s=t.viewRect;if("vertical"===t.orient){var l=xt(),u=s.x,h=s.y+s.height;St(l,l,[-u,-h]),Mt(l,l,-oE/2),St(l,l,[u,h]),(s=s.clone()).applyTransform(l)}var c=n(s),d=n(a.getBoundingRect()),f=n(r.getBoundingRect()),p=a.position,g=r.position;g[0]=p[0]=c[0][0];var m=t.labelPosOpt;if(isNaN(m))o(p,d,c,1,v="+"===m?0:1),o(g,f,c,1,1-v);else{var v=m>=0?0:1;o(p,d,c,1,v),g[1]=p[1]+m}a.attr("position",p),r.attr("position",g),a.rotation=r.rotation=t.rotation,i(a),i(r)},_createAxis:function(t,e){var i=e.getData(),n=e.get("axisType"),o=Hl(e,n);o.getTicks=function(){return i.mapArray(["value"],function(t){return t})};var a=i.getDataExtent("value");o.setExtent(a[0],a[1]),o.niceTicks();var r=new eE("value",o,t.axisExtent,n);return r.model=e,r},_createGroup:function(t){var e=this["_"+t]=new tb;return this.group.add(e),e},_renderAxisLine:function(t,e,i,n){var o=i.getExtent();n.get("lineStyle.show")&&e.add(new _M({shape:{x1:o[0],y1:0,x2:o[1],y2:0},style:a({lineCap:"round"},n.getModel("lineStyle").getLineStyle()),silent:!0,z2:1}))},_renderAxisTick:function(t,e,i,n){var o=n.getData(),a=i.scale.getTicks();nE(a,function(t){var a=i.dataToCoord(t),r=o.getItemModel(t),s=r.getModel("itemStyle"),l=r.getModel("emphasis.itemStyle"),u={position:[a,0],onclick:iE(this._changeTimeline,this,t)},h=zx(r,s,e,u);fo(h,l.getItemStyle()),r.get("tooltip")?(h.dataIndex=t,h.dataModel=n):h.dataIndex=h.dataModel=null},this)},_renderAxisLabel:function(t,e,i,n){if(i.getLabelModel().get("show")){var o=n.getData(),a=i.getViewLabels();nE(a,function(n){var a=n.tickValue,r=o.getItemModel(a),s=r.getModel("label"),l=r.getModel("emphasis.label"),u=i.dataToCoord(n.tickValue),h=new rM({position:[u,0],rotation:t.labelRotation-t.rotation,onclick:iE(this._changeTimeline,this,a),silent:!1});mo(h.style,s,{text:n.formattedLabel,textAlign:t.labelAlign,textVerticalAlign:t.labelBaseline}),e.add(h),fo(h,mo({},l))},this)}},_renderControl:function(t,e,i,n){function o(t,i,o,h){if(t){var c=Rx(n,i,u,{position:t,origin:[a/2,0],rotation:h?-r:0,rectHover:!0,style:s,onclick:o});e.add(c),fo(c,l)}}var a=t.controlSize,r=t.rotation,s=n.getModel("controlStyle").getItemStyle(),l=n.getModel("emphasis.controlStyle").getItemStyle(),u=[0,-a/2,a,a],h=n.getPlayState(),c=n.get("inverse",!0);o(t.nextBtnPosition,"controlStyle.nextIcon",iE(this._changeTimeline,this,c?"-":"+")),o(t.prevBtnPosition,"controlStyle.prevIcon",iE(this._changeTimeline,this,c?"+":"-")),o(t.playPosition,"controlStyle."+(h?"stopIcon":"playIcon"),iE(this._handlePlayClick,this,!h),!0)},_renderCurrentPointer:function(t,e,i,n){var o=n.getData(),a=n.getCurrentIndex(),r=o.getItemModel(a).getModel("checkpointStyle"),s=this,l={onCreate:function(t){t.draggable=!0,t.drift=iE(s._handlePointerDrag,s),t.ondragend=iE(s._handlePointerDragend,s),Bx(t,a,i,n,!0)},onUpdate:function(t){Bx(t,a,i,n)}};this._currentPointer=zx(r,r,this._mainGroup,{},this._currentPointer,l)},_handlePlayClick:function(t){this._clearTimer(),this.api.dispatchAction({type:"timelinePlayChange",playState:t,from:this.uid})},_handlePointerDrag:function(t,e,i){this._clearTimer(),this._pointerChangeTimeline([i.offsetX,i.offsetY])},_handlePointerDragend:function(t){this._pointerChangeTimeline([t.offsetX,t.offsetY],!0)},_pointerChangeTimeline:function(t,e){var i=this._toAxisCoord(t)[0],n=Fo(this._axis.getExtent().slice());i>n[1]&&(i=n[1]),ii.getHeight()&&(n.textPosition="top",l=!0);var u=l?-5-o.height:s+8;a+o.width/2>i.getWidth()?(n.textPosition=["100%",u],n.textAlign="right"):a-o.width/2<0&&(n.textPosition=[0,u],n.textAlign="left")}})}},updateView:function(t,e,i,n){d(this._features,function(t){t.updateView&&t.updateView(t.model,e,i,n)})},remove:function(t,e){d(this._features,function(i){i.remove&&i.remove(t,e)}),this.group.removeAll()},dispose:function(t,e){d(this._features,function(i){i.dispose&&i.dispose(t,e)})}});var rE=rT.toolbox.saveAsImage;Gx.defaultOption={show:!0,icon:"M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0",title:rE.title,type:"png",name:"",excludeComponents:["toolbox"],pixelRatio:1,lang:rE.lang.slice()},Gx.prototype.unusable=!U_.canvasSupported,Gx.prototype.onclick=function(t,e){var i=this.model,n=i.get("name")||t.get("title.0.text")||"echarts",o=document.createElement("a"),a=i.get("type",!0)||"png";o.download=n+"."+a,o.target="_blank";var r=e.getConnectedDataURL({type:a,backgroundColor:i.get("backgroundColor",!0)||t.get("backgroundColor")||"#fff",excludeComponents:i.get("excludeComponents"),pixelRatio:i.get("pixelRatio")});if(o.href=r,"function"!=typeof MouseEvent||U_.browser.ie||U_.browser.edge)if(window.navigator.msSaveOrOpenBlob){for(var s=atob(r.split(",")[1]),l=s.length,u=new Uint8Array(l);l--;)u[l]=s.charCodeAt(l);var h=new Blob([u]);window.navigator.msSaveOrOpenBlob(h,n+"."+a)}else{var c=i.get("lang"),d='';window.open().document.write(d)}else{var f=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1});o.dispatchEvent(f)}},Ty("saveAsImage",Gx);var sE=rT.toolbox.magicType;Fx.defaultOption={show:!0,type:[],icon:{line:"M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4",bar:"M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7",stack:"M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z",tiled:"M2.3,2.2h22.8V25H2.3V2.2z M35,2.2h22.8V25H35V2.2zM2.3,35h22.8v22.8H2.3V35z M35,35h22.8v22.8H35V35z"},title:i(sE.title),option:{},seriesIndex:{}};var lE=Fx.prototype;lE.getIcons=function(){var t=this.model,e=t.get("icon"),i={};return d(t.get("type"),function(t){e[t]&&(i[t]=e[t])}),i};var uE={line:function(t,e,i,o){if("bar"===t)return n({id:e,type:"line",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},o.get("option.line")||{},!0)},bar:function(t,e,i,o){if("line"===t)return n({id:e,type:"bar",data:i.get("data"),stack:i.get("stack"),markPoint:i.get("markPoint"),markLine:i.get("markLine")},o.get("option.bar")||{},!0)},stack:function(t,e,i,o){if("line"===t||"bar"===t)return n({id:e,stack:"__ec_magicType_stack__"},o.get("option.stack")||{},!0)},tiled:function(t,e,i,o){if("line"===t||"bar"===t)return n({id:e,stack:""},o.get("option.tiled")||{},!0)}},hE=[["line","bar"],["stack","tiled"]];lE.onclick=function(t,e,i){var n=this.model,o=n.get("seriesIndex."+i);if(uE[i]){var a={series:[]};d(hE,function(t){l(t,i)>=0&&d(t,function(t){n.setIconStatus(t,"normal")})}),n.setIconStatus(i,"emphasis"),t.eachComponent({mainType:"series",query:null==o?null:{seriesIndex:o}},function(e){var o=e.subType,s=e.id,l=uE[i](o,s,e,n);l&&(r(l,e.option),a.series.push(l));var u=e.coordinateSystem;if(u&&"cartesian2d"===u.type&&("line"===i||"bar"===i)){var h=u.getAxesByScale("ordinal")[0];if(h){var c=h.dim+"Axis",d=t.queryComponents({mainType:c,index:e.get(name+"Index"),id:e.get(name+"Id")})[0].componentIndex;a[c]=a[c]||[];for(var f=0;f<=d;f++)a[c][d]=a[c][d]||{};a[c][d].boundaryGap="bar"===i}}}),e.dispatchAction({type:"changeMagicType",currentType:i,newOption:a})}},Es({type:"changeMagicType",event:"magicTypeChanged",update:"prepareAndUpdate"},function(t,e){e.mergeOption(t.newOption)}),Ty("magicType",Fx);var cE=rT.toolbox.dataView,dE=new Array(60).join("-"),fE="\t",pE=new RegExp("["+fE+"]+","g");$x.defaultOption={show:!0,readOnly:!1,optionToContent:null,contentToOption:null,icon:"M17.5,17.3H33 M17.5,17.3H33 M45.4,29.5h-28 M11.5,2v56H51V14.8L38.4,2H11.5z M38.4,2.2v12.7H51 M45.4,41.7h-28",title:i(cE.title),lang:i(cE.lang),backgroundColor:"#fff",textColor:"#000",textareaColor:"#fff",textareaBorderColor:"#333",buttonColor:"#c23531",buttonTextColor:"#fff"},$x.prototype.onclick=function(t,e){function i(){n.removeChild(a),x._dom=null}var n=e.getDom(),o=this.model;this._dom&&n.removeChild(this._dom);var a=document.createElement("div");a.style.cssText="position:absolute;left:5px;top:5px;bottom:5px;right:5px;",a.style.backgroundColor=o.get("backgroundColor")||"#fff";var r=document.createElement("h4"),s=o.get("lang")||[];r.innerHTML=s[0]||o.get("title"),r.style.cssText="margin: 10px 20px;",r.style.color=o.get("textColor");var l=document.createElement("div"),u=document.createElement("textarea");l.style.cssText="display:block;width:100%;overflow:auto;";var h=o.get("optionToContent"),c=o.get("contentToOption"),d=Ux(t);if("function"==typeof h){var f=h(e.getOption());"string"==typeof f?l.innerHTML=f:M(f)&&l.appendChild(f)}else l.appendChild(u),u.readOnly=o.get("readOnly"),u.style.cssText="width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;",u.style.color=o.get("textColor"),u.style.borderColor=o.get("textareaBorderColor"),u.style.backgroundColor=o.get("textareaColor"),u.value=d.value;var p=d.meta,g=document.createElement("div");g.style.cssText="position:absolute;bottom:0;left:0;right:0;";var m="float:right;margin-right:20px;border:none;cursor:pointer;padding:2px 5px;font-size:12px;border-radius:3px",v=document.createElement("div"),y=document.createElement("div");m+=";background-color:"+o.get("buttonColor"),m+=";color:"+o.get("buttonTextColor");var x=this;ht(v,"click",i),ht(y,"click",function(){var t;try{t="function"==typeof c?c(l,e.getOption()):Kx(u.value,p)}catch(t){throw i(),new Error("Data view format error "+t)}t&&e.dispatchAction({type:"changeDataView",newOption:t}),i()}),v.innerHTML=s[1],y.innerHTML=s[2],y.style.cssText=m,v.style.cssText=m,!o.get("readOnly")&&g.appendChild(y),g.appendChild(v),ht(u,"keydown",function(t){if(9===(t.keyCode||t.which)){var e=this.value,i=this.selectionStart,n=this.selectionEnd;this.value=e.substring(0,i)+fE+e.substring(n),this.selectionStart=this.selectionEnd=i+1,mw(t)}}),a.appendChild(r),a.appendChild(l),a.appendChild(g),l.style.height=n.clientHeight-80+"px",n.appendChild(a),this._dom=a},$x.prototype.remove=function(t,e){this._dom&&e.getDom().removeChild(this._dom)},$x.prototype.dispose=function(t,e){this.remove(t,e)},Ty("dataView",$x),Es({type:"changeDataView",event:"dataViewChanged",update:"prepareAndUpdate"},function(t,e){var i=[];d(t.newOption.series,function(t){var n=e.getSeriesByName(t.name)[0];if(n){var o=n.get("data");i.push({name:t.name,data:Jx(t.data,o)})}else i.push(a({type:"scatter"},t))}),e.mergeOption(r({series:i},t.newOption))});var gE=d,mE="\0_ec_hist_store";iO.extend({type:"dataZoom.select"}),nO.extend({type:"dataZoom.select"});var vE=rT.toolbox.dataZoom,yE=d,xE="\0_ec_\0toolbox-dataZoom_";o_.defaultOption={show:!0,icon:{zoom:"M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1",back:"M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26"},title:i(vE.title)};var _E=o_.prototype;_E.render=function(t,e,i,n){this.model=t,this.ecModel=e,this.api=i,s_(t,e,this,n,i),r_(t,e)},_E.onclick=function(t,e,i){wE[i].call(this)},_E.remove=function(t,e){this._brushController.unmount()},_E.dispose=function(t,e){this._brushController.dispose()};var wE={zoom:function(){var t=!this._isZoomActive;this.api.dispatchAction({type:"takeGlobalCursor",key:"dataZoomSelect",dataZoomSelectActive:t})},back:function(){this._dispatchZoomAction(t_(this.ecModel))}};_E._onBrush=function(t,e){function i(t,e,i){var r=e.getAxis(t),s=r.model,l=n(t,s,a),u=l.findRepresentativeAxisProxy(s).getMinMaxSpan();null==u.minValueSpan&&null==u.maxValueSpan||(i=QL(0,i.slice(),r.scale.getExtent(),0,u.minValueSpan,u.maxValueSpan)),l&&(o[l.id]={dataZoomId:l.id,startValue:i[0],endValue:i[1]})}function n(t,e,i){var n;return i.eachComponent({mainType:"dataZoom",subType:"select"},function(i){i.getAxisModel(t,e.componentIndex)&&(n=i)}),n}if(e.isEnd&&t.length){var o={},a=this.ecModel;this._brushController.updateCovers([]),new hy(a_(this.model.option),a,{include:["grid"]}).matchOutputRanges(t,a,function(t,e,n){if("cartesian2d"===n.type){var o=t.brushType;"rect"===o?(i("x",n,e[0]),i("y",n,e[1])):i({lineX:"x",lineY:"y"}[o],n,e)}}),Qx(a,o),this._dispatchZoomAction(o)}},_E._dispatchZoomAction=function(t){var e=[];yE(t,function(t,n){e.push(i(t))}),e.length&&this.api.dispatchAction({type:"dataZoom",from:this.uid,batch:e})},Ty("dataZoom",o_),Ns(function(t){function e(t,e){if(e){var o=t+"Index",a=e[o];null==a||"all"===a||y(a)||(a=!1===a||"none"===a?[]:[a]),i(t,function(e,i){if(null==a||"all"===a||-1!==l(a,i)){var r={type:"select",$fromToolbox:!0,id:xE+t+i};r[o]=i,n.push(r)}})}}function i(e,i){var n=t[e];y(n)||(n=n?[n]:[]),yE(n,i)}if(t){var n=t.dataZoom||(t.dataZoom=[]);y(n)||(t.dataZoom=n=[n]);var o=t.toolbox;if(o&&(y(o)&&(o=o[0]),o&&o.feature)){var a=o.feature.dataZoom;e("xAxis",a),e("yAxis",a)}}});var bE=rT.toolbox.restore;l_.defaultOption={show:!0,icon:"M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5",title:bE.title},l_.prototype.onclick=function(t,e,i){e_(t),e.dispatchAction({type:"restore",from:this.uid})},Ty("restore",l_),Es({type:"restore",event:"restore",update:"prepareAndUpdate"},function(t,e){e.resetOption("recreate")});var SE,ME="urn:schemas-microsoft-com:vml",IE="undefined"==typeof window?null:window,TE=!1,AE=IE&&IE.document;if(AE&&!U_.canvasSupported)try{!AE.namespaces.zrvml&&AE.namespaces.add("zrvml",ME),SE=function(t){return AE.createElement("')}}catch(t){SE=function(t){return AE.createElement("<"+t+' xmlns="'+ME+'" class="zrvml">')}}var DE=ES.CMD,CE=Math.round,LE=Math.sqrt,kE=Math.abs,PE=Math.cos,NE=Math.sin,OE=Math.max;if(!U_.canvasSupported){var EE=21600,RE=EE/2,zE=function(t){t.style.cssText="position:absolute;left:0;top:0;width:1px;height:1px;",t.coordsize=EE+","+EE,t.coordorigin="0,0"},BE=function(t){return String(t).replace(/&/g,"&").replace(/"/g,""")},VE=function(t,e,i){return"rgb("+[t,e,i].join(",")+")"},GE=function(t,e){e&&t&&e.parentNode!==t&&t.appendChild(e)},FE=function(t,e){e&&t&&e.parentNode===t&&t.removeChild(e)},WE=function(t,e,i){return 1e5*(parseFloat(t)||0)+1e3*(parseFloat(e)||0)+i},HE=function(t,e){return"string"==typeof t?t.lastIndexOf("%")>=0?parseFloat(t)/100*e:parseFloat(t):t},ZE=function(t,e,i){var n=Gt(e);i=+i,isNaN(i)&&(i=1),n&&(t.color=VE(n[0],n[1],n[2]),t.opacity=i*n[3])},UE=function(t){var e=Gt(t);return[VE(e[0],e[1],e[2]),e[3]]},XE=function(t,e,i){var n=e.fill;if(null!=n)if(n instanceof IM){var o,a=0,r=[0,0],s=0,l=1,u=i.getBoundingRect(),h=u.width,c=u.height;if("linear"===n.type){o="gradient";var d=i.transform,f=[n.x*h,n.y*c],p=[n.x2*h,n.y2*c];d&&(Q(f,f,d),Q(p,p,d));var g=p[0]-f[0],m=p[1]-f[1];(a=180*Math.atan2(g,m)/Math.PI)<0&&(a+=360),a<1e-6&&(a=0)}else{o="gradientradial";var f=[n.x*h,n.y*c],d=i.transform,v=i.scale,y=h,x=c;r=[(f[0]-u.x)/y,(f[1]-u.y)/x],d&&Q(f,f,d),y/=v[0]*EE,x/=v[1]*EE;var _=OE(y,x);s=0/_,l=2*n.r/_-s}var w=n.colorStops.slice();w.sort(function(t,e){return t.offset-e.offset});for(var b=w.length,S=[],M=[],I=0;I=2){var D=S[0][0],C=S[1][0],L=S[0][1]*e.opacity,k=S[1][1]*e.opacity;t.type=o,t.method="none",t.focus="100%",t.angle=a,t.color=D,t.color2=C,t.colors=M.join(","),t.opacity=k,t.opacity2=L}"radial"===o&&(t.focusposition=r.join(","))}else ZE(t,n,e.opacity)},jE=function(t,e){null!=e.lineDash&&(t.dashstyle=e.lineDash.join(" ")),null==e.stroke||e.stroke instanceof IM||ZE(t,e.stroke,e.opacity)},YE=function(t,e,i,n){var o="fill"===e,a=t.getElementsByTagName(e)[0];null!=i[e]&&"none"!==i[e]&&(o||!o&&i.lineWidth)?(t[o?"filled":"stroked"]="true",i[e]instanceof IM&&FE(t,a),a||(a=u_(e)),o?XE(a,i,n):jE(a,i),GE(t,a)):(t[o?"filled":"stroked"]="false",FE(t,a))},qE=[[],[],[]],KE=function(t,e){var i,n,o,a,r,s,l=DE.M,u=DE.C,h=DE.L,c=DE.A,d=DE.Q,f=[],p=t.data,g=t.len();for(a=0;a.01?N&&(O+=.0125):Math.abs(E-D)<1e-4?N&&OA?x-=.0125:x+=.0125:N&&ED?y+=.0125:y-=.0125),f.push(R,CE(((A-C)*M+b)*EE-RE),",",CE(((D-L)*I+S)*EE-RE),",",CE(((A+C)*M+b)*EE-RE),",",CE(((D+L)*I+S)*EE-RE),",",CE((O*M+b)*EE-RE),",",CE((E*I+S)*EE-RE),",",CE((y*M+b)*EE-RE),",",CE((x*I+S)*EE-RE)),r=y,s=x;break;case DE.R:var z=qE[0],B=qE[1];z[0]=p[a++],z[1]=p[a++],B[0]=z[0]+p[a++],B[1]=z[1]+p[a++],e&&(Q(z,z,e),Q(B,B,e)),z[0]=CE(z[0]*EE-RE),B[0]=CE(B[0]*EE-RE),z[1]=CE(z[1]*EE-RE),B[1]=CE(B[1]*EE-RE),f.push(" m ",z[0],",",z[1]," l ",B[0],",",z[1]," l ",B[0],",",B[1]," l ",z[0],",",B[1]);break;case DE.Z:f.push(" x ")}if(i>0){f.push(n);for(var V=0;V100&&(tR=0,QE={});var i,n=eR.style;try{n.font=t,i=n.fontFamily.split(",")[0]}catch(t){}e={style:n.fontStyle||"normal",variant:n.fontVariant||"normal",weight:n.fontWeight||"normal",size:0|parseFloat(n.fontSize||12),family:i||"Microsoft YaHei"},QE[t]=e,tR++}return e};!function(t,e){bb[t]=e}("measureText",function(t,e){var i=AE;JE||((JE=i.createElement("div")).style.cssText="position:absolute;top:-20000px;left:0;padding:0;margin:0;border:none;white-space:pre;",AE.body.appendChild(JE));try{JE.style.font=e}catch(t){}return JE.innerHTML="",JE.appendChild(i.createTextNode(t)),{width:JE.offsetWidth}});for(var nR=new de,oR=[Db,di,fi,Pn,rM],aR=0;aR=o&&u+1>=a){for(var h=[],c=0;c=o&&c+1>=a)return T_(0,s.components);l[i]=s}else l[i]=void 0}r++}();if(d)return d}},pushComponent:function(t,e,i){var n=t[t.length-1];n&&n.added===e&&n.removed===i?t[t.length-1]={count:n.count+1,added:e,removed:i}:t.push({count:1,added:e,removed:i})},extractCommon:function(t,e,i,n){for(var o=e.length,a=i.length,r=t.newPos,s=r-n,l=0;r+1=0;--n)if(e[n]===t)return!0;return!1}),i):null:i[0]},D_.prototype.update=function(t,e){if(t){var i=this.getDefs(!1);if(t[this._domName]&&i.contains(t[this._domName]))"function"==typeof e&&e(t);else{var n=this.add(t);n&&(t[this._domName]=n)}}},D_.prototype.addDom=function(t){this.getDefs(!0).appendChild(t)},D_.prototype.removeDom=function(t){var e=this.getDefs(!1);e&&t[this._domName]&&(e.removeChild(t[this._domName]),t[this._domName]=null)},D_.prototype.getDoms=function(){var t=this.getDefs(!1);if(!t)return[];var e=[];return d(this._tagNames,function(i){var n=t.getElementsByTagName(i);e=e.concat([].slice.call(n))}),e},D_.prototype.markAllUnused=function(){var t=this;d(this.getDoms(),function(e){e[t._markLabel]="0"})},D_.prototype.markUsed=function(t){t&&(t[this._markLabel]="1")},D_.prototype.removeUnused=function(){var t=this.getDefs(!1);if(t){var e=this;d(this.getDoms(),function(i){"1"!==i[e._markLabel]&&t.removeChild(i)})}},D_.prototype.getSvgProxy=function(t){return t instanceof Pn?yR:t instanceof fi?xR:t instanceof rM?_R:yR},D_.prototype.getTextSvgElement=function(t){return t.__textSvgEl},D_.prototype.getSvgElement=function(t){return t.__svgEl},u(C_,D_),C_.prototype.addWithoutUpdate=function(t,e){if(e&&e.style){var i=this;d(["fill","stroke"],function(n){if(e.style[n]&&("linear"===e.style[n].type||"radial"===e.style[n].type)){var o,a=e.style[n],r=i.getDefs(!0);a._dom?(o=a._dom,r.contains(a._dom)||i.addDom(o)):o=i.add(a),i.markUsed(e);var s=o.getAttribute("id");t.setAttribute(n,"url(#"+s+")")}})}},C_.prototype.add=function(t){var e;if("linear"===t.type)e=this.createElement("linearGradient");else{if("radial"!==t.type)return Yw("Illegal gradient type."),null;e=this.createElement("radialGradient")}return t.id=t.id||this.nextId++,e.setAttribute("id","zr"+this._zrId+"-gradient-"+t.id),this.updateDom(t,e),this.addDom(e),e},C_.prototype.update=function(t){var e=this;D_.prototype.update.call(this,t,function(){var i=t.type,n=t._dom.tagName;"linear"===i&&"linearGradient"===n||"radial"===i&&"radialGradient"===n?e.updateDom(t,t._dom):(e.removeDom(t),e.add(t))})},C_.prototype.updateDom=function(t,e){if("linear"===t.type)e.setAttribute("x1",t.x),e.setAttribute("y1",t.y),e.setAttribute("x2",t.x2),e.setAttribute("y2",t.y2);else{if("radial"!==t.type)return void Yw("Illegal gradient type.");e.setAttribute("cx",t.x),e.setAttribute("cy",t.y),e.setAttribute("r",t.r)}t.global?e.setAttribute("gradientUnits","userSpaceOnUse"):e.setAttribute("gradientUnits","objectBoundingBox"),e.innerHTML="";for(var i=t.colorStops,n=0,o=i.length;n0){var n,o,a=this.getDefs(!0),r=e[0],s=i?"_textDom":"_dom";r[s]?(o=r[s].getAttribute("id"),n=r[s],a.contains(n)||a.appendChild(n)):(o="zr"+this._zrId+"-clip-"+this.nextId,++this.nextId,(n=this.createElement("clipPath")).setAttribute("id",o),a.appendChild(n),r[s]=n);var l=this.getSvgProxy(r);if(r.transform&&r.parent.invTransform&&!i){var u=Array.prototype.slice.call(r.transform);bt(r.transform,r.parent.invTransform,r.transform),l.brush(r),r.transform=u}else l.brush(r);var h=this.getSvgElement(r);n.innerHTML="",n.appendChild(h.cloneNode()),t.setAttribute("clip-path","url(#"+o+")"),e.length>1&&this.updateDom(n,e.slice(1),i)}else t&&t.setAttribute("clip-path","none")},L_.prototype.markUsed=function(t){var e=this;t.__clipPaths&&t.__clipPaths.length>0&&d(t.__clipPaths,function(t){t._dom&&D_.prototype.markUsed.call(e,t._dom),t._textDom&&D_.prototype.markUsed.call(e,t._textDom)})},u(k_,D_),k_.prototype.addWithoutUpdate=function(t,e){if(e&&P_(e.style)){var i,n=e.style;n._shadowDom?(i=n._shadowDom,this.getDefs(!0).contains(n._shadowDom)||this.addDom(i)):i=this.add(e),this.markUsed(e);var o=i.getAttribute("id");t.style.filter="url(#"+o+")"}},k_.prototype.add=function(t){var e=this.createElement("filter"),i=t.style;return i._shadowDomId=i._shadowDomId||this.nextId++,e.setAttribute("id","zr"+this._zrId+"-shadow-"+i._shadowDomId),this.updateDom(t,e),this.addDom(e),e},k_.prototype.update=function(t,e){var i=e.style;if(P_(i)){var n=this;D_.prototype.update.call(this,e,function(t){n.updateDom(e,t._shadowDom)})}else this.remove(t,i)},k_.prototype.remove=function(t,e){null!=e._shadowDomId&&(this.removeDom(e),t.style.filter="")},k_.prototype.updateDom=function(t,e){var i=e.getElementsByTagName("feDropShadow");i=0===i.length?this.createElement("feDropShadow"):i[0];var n,o,a,r,s=t.style,l=t.scale?t.scale[0]||1:1,u=t.scale?t.scale[1]||1:1;if(s.shadowBlur||s.shadowOffsetX||s.shadowOffsetY)n=s.shadowOffsetX||0,o=s.shadowOffsetY||0,a=s.shadowBlur,r=s.shadowColor;else{if(!s.textShadowBlur)return void this.removeDom(e,s);n=s.textShadowOffsetX||0,o=s.textShadowOffsetY||0,a=s.textShadowBlur,r=s.textShadowColor}i.setAttribute("dx",n/l),i.setAttribute("dy",o/u),i.setAttribute("flood-color",r);var h=a/2/l+" "+a/2/u;i.setAttribute("stdDeviation",h),e.setAttribute("x","-100%"),e.setAttribute("y","-100%"),e.setAttribute("width",Math.ceil(a/2*200)+"%"),e.setAttribute("height",Math.ceil(a/2*200)+"%"),e.appendChild(i),s._shadowDom=e},k_.prototype.markUsed=function(t){var e=t.style;e&&e._shadowDom&&D_.prototype.markUsed.call(this,e._shadowDom)};var IR=function(t,e,i,n){this.root=t,this.storage=e,this._opts=i=a({},i||{});var o=p_("svg");o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("version","1.1"),o.setAttribute("baseProfile","full"),o.style.cssText="user-select:none;position:absolute;left:0;top:0;",this.gradientManager=new C_(n,o),this.clipPathManager=new L_(n,o),this.shadowManager=new k_(n,o);var r=document.createElement("div");r.style.cssText="overflow:hidden;position:relative",this._svgRoot=o,this._viewport=r,t.appendChild(r),r.appendChild(o),this.resize(i.width,i.height),this._visibleList=[]};IR.prototype={constructor:IR,getType:function(){return"svg"},getViewportRoot:function(){return this._viewport},getViewportRootOffset:function(){var t=this.getViewportRoot();if(t)return{offsetLeft:t.offsetLeft||0,offsetTop:t.offsetTop||0}},refresh:function(){var t=this.storage.getDisplayList(!0);this._paintList(t)},setBackgroundColor:function(t){this._viewport.style.background=t},_paintList:function(t){this.gradientManager.markAllUnused(),this.clipPathManager.markAllUnused(),this.shadowManager.markAllUnused();var e,i=this._svgRoot,n=this._visibleList,o=t.length,a=[];for(e=0;e=0;--n)if(e[n]===t)return!0;return!1}),i):null:i[0]},resize:function(t,e){var i=this._viewport;i.style.display="none";var n=this._opts;if(null!=t&&(n.width=t),null!=e&&(n.height=e),t=this._getSize(0),e=this._getSize(1),i.style.display="",this._width!==t||this._height!==e){this._width=t,this._height=e;var o=i.style;o.width=t+"px",o.height=e+"px";var a=this._svgRoot;a.setAttribute("width",t),a.setAttribute("height",e)}},getWidth:function(){return this._width},getHeight:function(){return this._height},_getSize:function(t){var e=this._opts,i=["width","height"][t],n=["clientWidth","clientHeight"][t],o=["paddingLeft","paddingTop"][t],a=["paddingRight","paddingBottom"][t];if(null!=e[i]&&"auto"!==e[i])return parseFloat(e[i]);var r=this.root,s=document.defaultView.getComputedStyle(r);return(r[n]||N_(s[i])||N_(r.style[i]))-(N_(s[o])||0)-(N_(s[a])||0)|0},dispose:function(){this.root.innerHTML="",this._svgRoot=this._viewport=this.storage=null},clear:function(){this._viewport&&this.root.removeChild(this._viewport)},pathToDataUrl:function(){return this.refresh(),"data:image/svg+xml;charset=UTF-8,"+this._svgRoot.outerHTML}},d(["getLayer","insertLayer","eachLayer","eachBuiltinLayer","eachOtherLayer","getLayers","modLayer","delLayer","clearLayer","toDataURL","pathToImage"],function(t){IR.prototype[t]=F_(t)}),Ti("svg",IR),t.version="4.2.1",t.dependencies=ET,t.PRIORITY=VT,t.init=function(t,e,i){var n=ks(t);if(n)return n;var o=new us(t,e,i);return o.id="ec_"+iA++,tA[o.id]=o,Fi(t,oA,o.id),Cs(o),o},t.connect=function(t){if(y(t)){var e=t;t=null,kT(e,function(e){null!=e.group&&(t=e.group)}),t=t||"g_"+nA++,kT(e,function(e){e.group=t})}return eA[t]=!0,t},t.disConnect=Ls,t.disconnect=aA,t.dispose=function(t){"string"==typeof t?t=tA[t]:t instanceof us||(t=ks(t)),t instanceof us&&!t.isDisposed()&&t.dispose()},t.getInstanceByDom=ks,t.getInstanceById=function(t){return tA[t]},t.registerTheme=Ps,t.registerPreprocessor=Ns,t.registerProcessor=Os,t.registerPostUpdate=function(t){KT.push(t)},t.registerAction=Es,t.registerCoordinateSystem=Rs,t.getCoordinateSystemDimensions=function(t){var e=Fa.get(t);if(e)return e.getDimensionsInfo?e.getDimensionsInfo():e.dimensions.slice()},t.registerLayout=zs,t.registerVisual=Bs,t.registerLoading=Gs,t.extendComponentModel=Fs,t.extendComponentView=Ws,t.extendSeriesModel=Hs,t.extendChartView=Zs,t.setCanvasCreator=function(t){e("createCanvas",t)},t.registerMap=function(t,e,i){DT.registerMap(t,e,i)},t.getMap=function(t){var e=DT.retrieveMap(t);return e&&e[0]&&{geoJson:e[0].geoJSON,specialAreas:e[0].specialAreas}},t.dataTool=rA,t.zrender=Hb,t.number=YM,t.format=eI,t.throttle=Pr,t.helper=tD,t.matrix=Sw,t.vector=cw,t.color=Ww,t.parseGeoJSON=iD,t.parseGeoJson=rD,t.util=sD,t.graphic=lD,t.List=vA,t.Model=No,t.Axis=aD,t.env=U_}); \ No newline at end of file diff --git a/uni_modules/uni-badge/changelog.md b/uni_modules/uni-badge/changelog.md new file mode 100644 index 0000000..e352c60 --- /dev/null +++ b/uni_modules/uni-badge/changelog.md @@ -0,0 +1,33 @@ +## 1.2.2(2023-01-28) +- 修复 运行/打包 控制台警告问题 +## 1.2.1(2022-09-05) +- 修复 当 text 超过 max-num 时,badge 的宽度计算是根据 text 的长度计算,更改为 css 计算实际展示宽度,详见:[https://ask.dcloud.net.cn/question/150473](https://ask.dcloud.net.cn/question/150473) +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-badge](https://uniapp.dcloud.io/component/uniui/uni-badge) +## 1.1.7(2021-11-08) +- 优化 升级ui +- 修改 size 属性默认值调整为 small +- 修改 type 属性,默认值调整为 error,info 替换 default +## 1.1.6(2021-09-22) +- 修复 在字节小程序上样式不生效的 bug +## 1.1.5(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.4(2021-07-29) +- 修复 去掉 nvue 不支持css 的 align-self 属性,nvue 下不暂支持 absolute 属性 +## 1.1.3(2021-06-24) +- 优化 示例项目 +## 1.1.1(2021-05-12) +- 新增 组件示例地址 +## 1.1.0(2021-05-12) +- 新增 uni-badge 的 absolute 属性,支持定位 +- 新增 uni-badge 的 offset 属性,支持定位偏移 +- 新增 uni-badge 的 is-dot 属性,支持仅显示有一个小点 +- 新增 uni-badge 的 max-num 属性,支持自定义封顶的数字值,超过 99 显示99+ +- 优化 uni-badge 属性 custom-style, 支持以对象形式自定义样式 +## 1.0.7(2021-05-07) +- 修复 uni-badge 在 App 端,数字小于10时不是圆形的bug +- 修复 uni-badge 在父元素不是 flex 布局时,宽度缩小的bug +- 新增 uni-badge 属性 custom-style, 支持自定义样式 +## 1.0.6(2021-02-04) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-badge/components/uni-badge/uni-badge.vue b/uni_modules/uni-badge/components/uni-badge/uni-badge.vue new file mode 100644 index 0000000..956354b --- /dev/null +++ b/uni_modules/uni-badge/components/uni-badge/uni-badge.vue @@ -0,0 +1,268 @@ + + + + + diff --git a/uni_modules/uni-badge/package.json b/uni_modules/uni-badge/package.json new file mode 100644 index 0000000..b0bac93 --- /dev/null +++ b/uni_modules/uni-badge/package.json @@ -0,0 +1,85 @@ +{ + "id": "uni-badge", + "displayName": "uni-badge 数字角标", + "version": "1.2.2", + "description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。", + "keywords": [ + "", + "badge", + "uni-ui", + "uniui", + "数字角标", + "徽章" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "y", + "联盟": "y" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-badge/readme.md b/uni_modules/uni-badge/readme.md new file mode 100644 index 0000000..bdf175d --- /dev/null +++ b/uni_modules/uni-badge/readme.md @@ -0,0 +1,10 @@ +## Badge 数字角标 +> **组件名:uni-badge** +> 代码块: `uBadge` + +数字角标一般和其它控件(列表、9宫格等)配合使用,用于进行数量提示,默认为实心灰色背景, + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-badge) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + diff --git a/uni_modules/uni-collapse/changelog.md b/uni_modules/uni-collapse/changelog.md new file mode 100644 index 0000000..292e4c7 --- /dev/null +++ b/uni_modules/uni-collapse/changelog.md @@ -0,0 +1,36 @@ +## 1.4.3(2022-01-25) +- 修复 初始化的时候 ,open 属性失效的bug +## 1.4.2(2022-01-21) +- 修复 微信小程序resize后组件收起的bug +## 1.4.1(2021-11-22) +- 修复 vue3中个别scss变量无法找到的问题 +## 1.4.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-collapse](https://uniapp.dcloud.io/component/uniui/uni-collapse) +## 1.3.3(2021-08-17) +- 优化 show-arrow 属性默认为true +## 1.3.2(2021-08-17) +- 新增 show-arrow 属性,控制是否显示右侧箭头 +## 1.3.1(2021-07-30) +- 优化 vue3下小程序事件警告的问题 +## 1.3.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.2.2(2021-07-21) +- 修复 由1.2.0版本引起的 change 事件返回 undefined 的Bug +## 1.2.1(2021-07-21) +- 优化 组件示例 +## 1.2.0(2021-07-21) +- 新增 组件折叠动画 +- 新增 value\v-model 属性 ,动态修改面板折叠状态 +- 新增 title 插槽 ,可定义面板标题 +- 新增 border 属性 ,显示隐藏面板内容分隔线 +- 新增 title-border 属性 ,显示隐藏面板标题分隔线 +- 修复 resize 方法失效的Bug +- 修复 change 事件返回参数不正确的Bug +- 优化 H5、App 平台自动更具内容更新高度,无需调用 reszie() 方法 +## 1.1.7(2021-05-12) +- 新增 组件示例地址 +## 1.1.6(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 +## 1.1.5(2021-02-05) +- 调整为uni_modules目录规范 \ No newline at end of file diff --git a/uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item.vue b/uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item.vue new file mode 100644 index 0000000..d62a6a7 --- /dev/null +++ b/uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item.vue @@ -0,0 +1,402 @@ + + + + + diff --git a/uni_modules/uni-collapse/components/uni-collapse/uni-collapse.vue b/uni_modules/uni-collapse/components/uni-collapse/uni-collapse.vue new file mode 100644 index 0000000..384c39a --- /dev/null +++ b/uni_modules/uni-collapse/components/uni-collapse/uni-collapse.vue @@ -0,0 +1,147 @@ + + + diff --git a/uni_modules/uni-collapse/package.json b/uni_modules/uni-collapse/package.json new file mode 100644 index 0000000..65349cf --- /dev/null +++ b/uni_modules/uni-collapse/package.json @@ -0,0 +1,89 @@ +{ + "id": "uni-collapse", + "displayName": "uni-collapse 折叠面板", + "version": "1.4.3", + "description": "Collapse 组件,可以折叠 / 展开的内容区域。", + "keywords": [ + "uni-ui", + "折叠", + "折叠面板", + "手风琴" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-collapse/readme.md b/uni_modules/uni-collapse/readme.md new file mode 100644 index 0000000..bc758eb --- /dev/null +++ b/uni_modules/uni-collapse/readme.md @@ -0,0 +1,12 @@ + + +## Collapse 折叠面板 +> **组件名:uni-collapse** +> 代码块: `uCollapse` +> 关联组件:`uni-collapse-item`、`uni-icons`。 + + +折叠面板用来折叠/显示过长的内容或者是列表。通常是在多内容分类项使用,折叠不重要的内容,显示重要内容。点击可以展开折叠部分。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-collapse) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-data-select/changelog.md b/uni_modules/uni-data-select/changelog.md new file mode 100644 index 0000000..d5beaa3 --- /dev/null +++ b/uni_modules/uni-data-select/changelog.md @@ -0,0 +1,16 @@ +## 0.1.6(2022-07-06) +- 修复 pc端宽度异常的bug +## 0.1.5 +- 修复 pc端宽度异常的bug +## 0.1.4(2022-07-05) +- 优化 显示样式 +## 0.1.3(2022-06-02) +- 修复 localdata 赋值不生效的 bug +- 新增 支持 uni.scss 修改颜色 +- 新增 支持选项禁用(数据选项设置 disabled: true 即禁用) +## 0.1.2(2022-05-08) +- 修复 当 value 为 0 时选择不生效的 bug +## 0.1.1(2022-05-07) +- 新增 记住上次的选项(仅 collection 存在时有效) +## 0.1.0(2022-04-22) +- 初始化 diff --git a/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue b/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue new file mode 100644 index 0000000..16995bd --- /dev/null +++ b/uni_modules/uni-data-select/components/uni-data-select/uni-data-select.vue @@ -0,0 +1,426 @@ + + + + + diff --git a/uni_modules/uni-data-select/package.json b/uni_modules/uni-data-select/package.json new file mode 100644 index 0000000..1ebd8dd --- /dev/null +++ b/uni_modules/uni-data-select/package.json @@ -0,0 +1,88 @@ +{ + "id": "uni-data-select", + "displayName": "uni-data-select 下拉框选择器", + "version": "0.1.6", + "description": "通过数据驱动的下拉框选择器", + "keywords": [ + "uni-ui", + "select", + "uni-data-select", + "下拉框", + "下拉选" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "^3.1.1" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-load-more"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "u", + "app-nvue": "n" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "u", + "百度": "u", + "字节跳动": "u", + "QQ": "u", + "京东": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-data-select/readme.md b/uni_modules/uni-data-select/readme.md new file mode 100644 index 0000000..eb58de3 --- /dev/null +++ b/uni_modules/uni-data-select/readme.md @@ -0,0 +1,8 @@ +## DataSelect 下拉框选择器 +> **组件名:uni-data-select** +> 代码块: `uDataSelect` + +当选项过多时,使用下拉菜单展示并选择内容 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-data-select) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 diff --git a/uni_modules/uni-datetime-picker/changelog.md b/uni_modules/uni-datetime-picker/changelog.md new file mode 100644 index 0000000..5c9735a --- /dev/null +++ b/uni_modules/uni-datetime-picker/changelog.md @@ -0,0 +1,93 @@ +## 2.2.6(2022-06-30) +- 优化 组件样式,调整了组件图标大小、高度、颜色等,与uni-ui风格保持一致 +## 2.2.5(2022-06-24) +- 修复 日历顶部年月及底部确认未国际化 bug +## 2.2.4(2022-03-31) +- 修复 Vue3 下动态赋值,单选类型未响应的 bug +## 2.2.3(2022-03-28) +- 修复 Vue3 下动态赋值未响应的 bug +## 2.2.2(2021-12-10) +- 修复 clear-icon 属性在小程序平台不生效的 bug +## 2.2.1(2021-12-10) +- 修复 日期范围选在小程序平台,必须多点击一次才能取消选中状态的 bug +## 2.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-datetime-picker](https://uniapp.dcloud.io/component/uniui/uni-datetime-picker) +## 2.1.5(2021-11-09) +- 新增 提供组件设计资源,组件样式调整 +## 2.1.4(2021-09-10) +- 修复 hide-second 在移动端的 bug +- 修复 单选赋默认值时,赋值日期未高亮的 bug +- 修复 赋默认值时,移动端未正确显示时间的 bug +## 2.1.3(2021-09-09) +- 新增 hide-second 属性,支持只使用时分,隐藏秒 +## 2.1.2(2021-09-03) +- 优化 取消选中时(范围选)直接开始下一次选择, 避免多点一次 +- 优化 移动端支持清除按钮,同时支持通过 ref 调用组件的 clear 方法 +- 优化 调整字号大小,美化日历界面 +- 修复 因国际化导致的 placeholder 失效的 bug +## 2.1.1(2021-08-24) +- 新增 支持国际化 +- 优化 范围选择器在 pc 端过宽的问题 +## 2.1.0(2021-08-09) +- 新增 适配 vue3 +## 2.0.19(2021-08-09) +- 新增 支持作为 uni-forms 子组件相关功能 +- 修复 在 uni-forms 中使用时,选择时间报 NAN 错误的 bug +## 2.0.18(2021-08-05) +- 修复 type 属性动态赋值无效的 bug +- 修复 ‘确认’按钮被 tabbar 遮盖 bug +- 修复 组件未赋值时范围选左、右日历相同的 bug +## 2.0.17(2021-08-04) +- 修复 范围选未正确显示当前值的 bug +- 修复 h5 平台(移动端)报错 'cale' of undefined 的 bug +## 2.0.16(2021-07-21) +- 新增 return-type 属性支持返回 date 日期对象 +## 2.0.15(2021-07-14) +- 修复 单选日期类型,初始赋值后不在当前日历的 bug +- 新增 clearIcon 属性,显示框的清空按钮可配置显示隐藏(仅 pc 有效) +- 优化 移动端移除显示框的清空按钮,无实际用途 +## 2.0.14(2021-07-14) +- 修复 组件赋值为空,界面未更新的 bug +- 修复 start 和 end 不能动态赋值的 bug +- 修复 范围选类型,用户选择后再次选择右侧日历(结束日期)显示不正确的 bug +## 2.0.13(2021-07-08) +- 修复 范围选择不能动态赋值的 bug +## 2.0.12(2021-07-08) +- 修复 范围选择的初始时间在一个月内时,造成无法选择的bug +## 2.0.11(2021-07-08) +- 优化 弹出层在超出视窗边缘定位不准确的问题 +## 2.0.10(2021-07-08) +- 修复 范围起始点样式的背景色与今日样式的字体前景色融合,导致日期字体看不清的 bug +- 优化 弹出层在超出视窗边缘被遮盖的问题 +## 2.0.9(2021-07-07) +- 新增 maskClick 事件 +- 修复 特殊情况日历 rpx 布局错误的 bug,rpx -> px +- 修复 范围选择时清空返回值不合理的bug,['', ''] -> [] +## 2.0.8(2021-07-07) +- 新增 日期时间显示框支持插槽 +## 2.0.7(2021-07-01) +- 优化 添加 uni-icons 依赖 +## 2.0.6(2021-05-22) +- 修复 图标在小程序上不显示的 bug +- 优化 重命名引用组件,避免潜在组件命名冲突 +## 2.0.5(2021-05-20) +- 优化 代码目录扁平化 +## 2.0.4(2021-05-12) +- 新增 组件示例地址 +## 2.0.3(2021-05-10) +- 修复 ios 下不识别 '-' 日期格式的 bug +- 优化 pc 下弹出层添加边框和阴影 +## 2.0.2(2021-05-08) +- 修复 在 admin 中获取弹出层定位错误的bug +## 2.0.1(2021-05-08) +- 修复 type 属性向下兼容,默认值从 date 变更为 datetime +## 2.0.0(2021-04-30) +- 支持日历形式的日期+时间的范围选择 + > 注意:此版本不向后兼容,不再支持单独时间选择(type=time)及相关的 hide-second 属性(时间选可使用内置组件 picker) +## 1.0.6(2021-03-18) +- 新增 hide-second 属性,时间支持仅选择时、分 +- 修复 选择跟显示的日期不一样的 bug +- 修复 chang事件触发2次的 bug +- 修复 分、秒 end 范围错误的 bug +- 优化 更好的 nvue 适配 diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue new file mode 100644 index 0000000..3d2dbea --- /dev/null +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue @@ -0,0 +1,185 @@ + + + + + diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue new file mode 100644 index 0000000..8f7f181 --- /dev/null +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar.vue @@ -0,0 +1,907 @@ + + + + + diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json new file mode 100644 index 0000000..9acf1ab --- /dev/null +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/en.json @@ -0,0 +1,22 @@ +{ + "uni-datetime-picker.selectDate": "select date", + "uni-datetime-picker.selectTime": "select time", + "uni-datetime-picker.selectDateTime": "select datetime", + "uni-datetime-picker.startDate": "start date", + "uni-datetime-picker.endDate": "end date", + "uni-datetime-picker.startTime": "start time", + "uni-datetime-picker.endTime": "end time", + "uni-datetime-picker.ok": "ok", + "uni-datetime-picker.clear": "clear", + "uni-datetime-picker.cancel": "cancel", + "uni-datetime-picker.year": "-", + "uni-datetime-picker.month": "", + "uni-calender.MON": "MON", + "uni-calender.TUE": "TUE", + "uni-calender.WED": "WED", + "uni-calender.THU": "THU", + "uni-calender.FRI": "FRI", + "uni-calender.SAT": "SAT", + "uni-calender.SUN": "SUN", + "uni-calender.confirm": "confirm" +} diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js new file mode 100644 index 0000000..de7509c --- /dev/null +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/index.js @@ -0,0 +1,8 @@ +import en from './en.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json new file mode 100644 index 0000000..d2df5e7 --- /dev/null +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hans.json @@ -0,0 +1,22 @@ +{ + "uni-datetime-picker.selectDate": "选择日期", + "uni-datetime-picker.selectTime": "选择时间", + "uni-datetime-picker.selectDateTime": "选择日期时间", + "uni-datetime-picker.startDate": "开始日期", + "uni-datetime-picker.endDate": "结束日期", + "uni-datetime-picker.startTime": "开始时间", + "uni-datetime-picker.endTime": "结束时间", + "uni-datetime-picker.ok": "确定", + "uni-datetime-picker.clear": "清除", + "uni-datetime-picker.cancel": "取消", + "uni-datetime-picker.year": "年", + "uni-datetime-picker.month": "月", + "uni-calender.SUN": "日", + "uni-calender.MON": "一", + "uni-calender.TUE": "二", + "uni-calender.WED": "三", + "uni-calender.THU": "四", + "uni-calender.FRI": "五", + "uni-calender.SAT": "六", + "uni-calender.confirm": "确认" +} \ No newline at end of file diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json new file mode 100644 index 0000000..d23fa3c --- /dev/null +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/i18n/zh-Hant.json @@ -0,0 +1,22 @@ +{ + "uni-datetime-picker.selectDate": "選擇日期", + "uni-datetime-picker.selectTime": "選擇時間", + "uni-datetime-picker.selectDateTime": "選擇日期時間", + "uni-datetime-picker.startDate": "開始日期", + "uni-datetime-picker.endDate": "結束日期", + "uni-datetime-picker.startTime": "開始时间", + "uni-datetime-picker.endTime": "結束时间", + "uni-datetime-picker.ok": "確定", + "uni-datetime-picker.clear": "清除", + "uni-datetime-picker.cancel": "取消", + "uni-datetime-picker.year": "年", + "uni-datetime-picker.month": "月", + "uni-calender.SUN": "日", + "uni-calender.MON": "一", + "uni-calender.TUE": "二", + "uni-calender.WED": "三", + "uni-calender.THU": "四", + "uni-calender.FRI": "五", + "uni-calender.SAT": "六", + "uni-calender.confirm": "確認" +} \ No newline at end of file diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/keypress.js b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/keypress.js new file mode 100644 index 0000000..9601aba --- /dev/null +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/keypress.js @@ -0,0 +1,45 @@ +// #ifdef H5 +export default { + name: 'Keypress', + props: { + disable: { + type: Boolean, + default: false + } + }, + mounted () { + const keyNames = { + esc: ['Esc', 'Escape'], + tab: 'Tab', + enter: 'Enter', + space: [' ', 'Spacebar'], + up: ['Up', 'ArrowUp'], + left: ['Left', 'ArrowLeft'], + right: ['Right', 'ArrowRight'], + down: ['Down', 'ArrowDown'], + delete: ['Backspace', 'Delete', 'Del'] + } + const listener = ($event) => { + if (this.disable) { + return + } + const keyName = Object.keys(keyNames).find(key => { + const keyName = $event.key + const value = keyNames[key] + return value === keyName || (Array.isArray(value) && value.includes(keyName)) + }) + if (keyName) { + // 避免和其他按键事件冲突 + setTimeout(() => { + this.$emit(keyName, {}) + }, 0) + } + } + document.addEventListener('keyup', listener) + this.$once('hook:beforeDestroy', () => { + document.removeEventListener('keyup', listener) + }) + }, + render: () => {} +} +// #endif \ No newline at end of file diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue new file mode 100644 index 0000000..699aa63 --- /dev/null +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue @@ -0,0 +1,927 @@ + + + + + diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue new file mode 100644 index 0000000..9bdf8bc --- /dev/null +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue @@ -0,0 +1,1012 @@ + + + + diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js new file mode 100644 index 0000000..efa5773 --- /dev/null +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/util.js @@ -0,0 +1,410 @@ +class Calendar { + constructor({ + date, + selected, + startDate, + endDate, + range, + // multipleStatus + } = {}) { + // 当前日期 + this.date = this.getDate(new Date()) // 当前初入日期 + // 打点信息 + this.selected = selected || []; + // 范围开始 + this.startDate = startDate + // 范围结束 + this.endDate = endDate + this.range = range + // 多选状态 + this.cleanMultipleStatus() + // 每周日期 + this.weeks = {} + // this._getWeek(this.date.fullDate) + // this.multipleStatus = multipleStatus + this.lastHover = false + } + /** + * 设置日期 + * @param {Object} date + */ + setDate(date) { + this.selectDate = this.getDate(date) + this._getWeek(this.selectDate.fullDate) + } + + /** + * 清理多选状态 + */ + cleanMultipleStatus() { + this.multipleStatus = { + before: '', + after: '', + data: [] + } + } + + /** + * 重置开始日期 + */ + resetSatrtDate(startDate) { + // 范围开始 + this.startDate = startDate + + } + + /** + * 重置结束日期 + */ + resetEndDate(endDate) { + // 范围结束 + this.endDate = endDate + } + + /** + * 获取任意时间 + */ + getDate(date, AddDayCount = 0, str = 'day') { + if (!date) { + date = new Date() + } + if (typeof date !== 'object') { + date = date.replace(/-/g, '/') + } + const dd = new Date(date) + switch (str) { + case 'day': + dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期 + break + case 'month': + if (dd.getDate() === 31) { + dd.setDate(dd.getDate() + AddDayCount) + } else { + dd.setMonth(dd.getMonth() + AddDayCount) // 获取AddDayCount天后的日期 + } + break + case 'year': + dd.setFullYear(dd.getFullYear() + AddDayCount) // 获取AddDayCount天后的日期 + break + } + const y = dd.getFullYear() + const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0 + const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0 + return { + fullDate: y + '-' + m + '-' + d, + year: y, + month: m, + date: d, + day: dd.getDay() + } + } + + + /** + * 获取上月剩余天数 + */ + _getLastMonthDays(firstDay, full) { + let dateArr = [] + for (let i = firstDay; i > 0; i--) { + const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate() + dateArr.push({ + date: beforeDate, + month: full.month - 1, + disable: true + }) + } + return dateArr + } + /** + * 获取本月天数 + */ + _currentMonthDys(dateData, full) { + let dateArr = [] + let fullDate = this.date.fullDate + for (let i = 1; i <= dateData; i++) { + let isinfo = false + let nowDate = full.year + '-' + (full.month < 10 ? + full.month : full.month) + '-' + (i < 10 ? + '0' + i : i) + // 是否今天 + let isDay = fullDate === nowDate + // 获取打点信息 + let info = this.selected && this.selected.find((item) => { + if (this.dateEqual(nowDate, item.date)) { + return item + } + }) + + // 日期禁用 + let disableBefore = true + let disableAfter = true + if (this.startDate) { + // let dateCompBefore = this.dateCompare(this.startDate, fullDate) + // disableBefore = this.dateCompare(dateCompBefore ? this.startDate : fullDate, nowDate) + disableBefore = this.dateCompare(this.startDate, nowDate) + } + + if (this.endDate) { + // let dateCompAfter = this.dateCompare(fullDate, this.endDate) + // disableAfter = this.dateCompare(nowDate, dateCompAfter ? this.endDate : fullDate) + disableAfter = this.dateCompare(nowDate, this.endDate) + } + let multiples = this.multipleStatus.data + let checked = false + let multiplesStatus = -1 + if (this.range) { + if (multiples) { + multiplesStatus = multiples.findIndex((item) => { + return this.dateEqual(item, nowDate) + }) + } + if (multiplesStatus !== -1) { + checked = true + } + } + let data = { + fullDate: nowDate, + year: full.year, + date: i, + multiple: this.range ? checked : false, + beforeMultiple: this.isLogicBefore(nowDate, this.multipleStatus.before, this.multipleStatus.after), + afterMultiple: this.isLogicAfter(nowDate, this.multipleStatus.before, this.multipleStatus.after), + month: full.month, + disable: !(disableBefore && disableAfter), + isDay, + userChecked: false + } + if (info) { + data.extraInfo = info + } + + dateArr.push(data) + } + return dateArr + } + /** + * 获取下月天数 + */ + _getNextMonthDays(surplus, full) { + let dateArr = [] + for (let i = 1; i < surplus + 1; i++) { + dateArr.push({ + date: i, + month: Number(full.month) + 1, + disable: true + }) + } + return dateArr + } + + /** + * 获取当前日期详情 + * @param {Object} date + */ + getInfo(date) { + if (!date) { + date = new Date() + } + const dateInfo = this.canlender.find(item => item.fullDate === this.getDate(date).fullDate) + return dateInfo + } + + /** + * 比较时间大小 + */ + dateCompare(startDate, endDate) { + // 计算截止时间 + startDate = new Date(startDate.replace('-', '/').replace('-', '/')) + // 计算详细项的截止时间 + endDate = new Date(endDate.replace('-', '/').replace('-', '/')) + if (startDate <= endDate) { + return true + } else { + return false + } + } + + /** + * 比较时间是否相等 + */ + dateEqual(before, after) { + // 计算截止时间 + before = new Date(before.replace('-', '/').replace('-', '/')) + // 计算详细项的截止时间 + after = new Date(after.replace('-', '/').replace('-', '/')) + if (before.getTime() - after.getTime() === 0) { + return true + } else { + return false + } + } + + /** + * 比较真实起始日期 + */ + + isLogicBefore(currentDay, before, after) { + let logicBefore = before + if (before && after) { + logicBefore = this.dateCompare(before, after) ? before : after + } + return this.dateEqual(logicBefore, currentDay) + } + + isLogicAfter(currentDay, before, after) { + let logicAfter = after + if (before && after) { + logicAfter = this.dateCompare(before, after) ? after : before + } + return this.dateEqual(logicAfter, currentDay) + } + + /** + * 获取日期范围内所有日期 + * @param {Object} begin + * @param {Object} end + */ + geDateAll(begin, end) { + var arr = [] + var ab = begin.split('-') + var ae = end.split('-') + var db = new Date() + db.setFullYear(ab[0], ab[1] - 1, ab[2]) + var de = new Date() + de.setFullYear(ae[0], ae[1] - 1, ae[2]) + var unixDb = db.getTime() - 24 * 60 * 60 * 1000 + var unixDe = de.getTime() - 24 * 60 * 60 * 1000 + for (var k = unixDb; k <= unixDe;) { + k = k + 24 * 60 * 60 * 1000 + arr.push(this.getDate(new Date(parseInt(k))).fullDate) + } + return arr + } + + /** + * 获取多选状态 + */ + setMultiple(fullDate) { + let { + before, + after + } = this.multipleStatus + if (!this.range) return + if (before && after) { + if (!this.lastHover) { + this.lastHover = true + return + } + this.multipleStatus.before = fullDate + this.multipleStatus.after = '' + this.multipleStatus.data = [] + this.multipleStatus.fulldate = '' + this.lastHover = false + } else { + if (!before) { + this.multipleStatus.before = fullDate + this.lastHover = false + } else { + this.multipleStatus.after = fullDate + if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) { + this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus + .after); + } else { + this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus + .before); + } + this.lastHover = true + } + } + this._getWeek(fullDate) + } + + /** + * 鼠标 hover 更新多选状态 + */ + setHoverMultiple(fullDate) { + let { + before, + after + } = this.multipleStatus + + if (!this.range) return + if (this.lastHover) return + + if (!before) { + this.multipleStatus.before = fullDate + } else { + this.multipleStatus.after = fullDate + if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) { + this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after); + } else { + this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before); + } + } + this._getWeek(fullDate) + } + + /** + * 更新默认值多选状态 + */ + setDefaultMultiple(before, after) { + this.multipleStatus.before = before + this.multipleStatus.after = after + if (before && after) { + if (this.dateCompare(before, after)) { + this.multipleStatus.data = this.geDateAll(before, after); + this._getWeek(after) + } else { + this.multipleStatus.data = this.geDateAll(after, before); + this._getWeek(before) + } + } + } + + /** + * 获取每周数据 + * @param {Object} dateData + */ + _getWeek(dateData) { + const { + fullDate, + year, + month, + date, + day + } = this.getDate(dateData) + let firstDay = new Date(year, month - 1, 1).getDay() + let currentDay = new Date(year, month, 0).getDate() + let dates = { + lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 上个月末尾几天 + currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)), // 本月天数 + nextMonthDays: [], // 下个月开始几天 + weeks: [] + } + let canlender = [] + const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length) + dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData)) + canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays) + let weeks = {} + // 拼接数组 上个月开始几天 + 本月天数+ 下个月开始几天 + for (let i = 0; i < canlender.length; i++) { + if (i % 7 === 0) { + weeks[parseInt(i / 7)] = new Array(7) + } + weeks[parseInt(i / 7)][i % 7] = canlender[i] + } + this.canlender = canlender + this.weeks = weeks + } + + //静态方法 + // static init(date) { + // if (!this.instance) { + // this.instance = new Calendar(date); + // } + // return this.instance; + // } +} + + +export default Calendar diff --git a/uni_modules/uni-datetime-picker/package.json b/uni_modules/uni-datetime-picker/package.json new file mode 100644 index 0000000..60fa1d0 --- /dev/null +++ b/uni_modules/uni-datetime-picker/package.json @@ -0,0 +1,90 @@ +{ + "id": "uni-datetime-picker", + "displayName": "uni-datetime-picker 日期选择器", + "version": "2.2.6", + "description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择", + "keywords": [ + "uni-datetime-picker", + "uni-ui", + "uniui", + "日期时间选择器", + "日期时间" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "n" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-datetime-picker/readme.md b/uni_modules/uni-datetime-picker/readme.md new file mode 100644 index 0000000..162fbef --- /dev/null +++ b/uni_modules/uni-datetime-picker/readme.md @@ -0,0 +1,21 @@ + + +> `重要通知:组件升级更新 2.0.0 后,支持日期+时间范围选择,组件 ui 将使用日历选择日期,ui 变化较大,同时支持 PC 和 移动端。此版本不向后兼容,不再支持单独的时间选择(type=time)及相关的 hide-second 属性(时间选可使用内置组件 picker)。若仍需使用旧版本,可在插件市场下载*非uni_modules版本*,旧版本将不再维护` + +## DatetimePicker 时间选择器 + +> **组件名:uni-datetime-picker** +> 代码块: `uDatetimePicker` + + +该组件的优势是,支持**时间戳**输入和输出(起始时间、终止时间也支持时间戳),可**同时选择**日期和时间。 + +若只是需要单独选择日期和时间,不需要时间戳输入和输出,可使用原生的 picker 组件。 + +**_点击 picker 默认值规则:_** + +- 若设置初始值 value, 会显示在 picker 显示框中 +- 若无初始值 value,则初始值 value 为当前本地时间 Date.now(), 但不会显示在 picker 显示框中 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-datetime-picker) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-easyinput/changelog.md b/uni_modules/uni-easyinput/changelog.md new file mode 100644 index 0000000..84c72eb --- /dev/null +++ b/uni_modules/uni-easyinput/changelog.md @@ -0,0 +1,115 @@ +## 1.1.19(2024-07-18) +- 修复 初始值传入 null 导致input报错的bug +## 1.1.18(2024-04-11) +- 修复 easyinput组件双向绑定问题 +## 1.1.17(2024-03-28) +- 修复 在头条小程序下丢失事件绑定的问题 +## 1.1.16(2024-03-20) +- 修复 在密码输入情况下 清除和小眼睛覆盖bug 在edge浏览器下显示双眼睛bug +## 1.1.15(2024-02-21) +- 新增 左侧插槽:left +## 1.1.14(2024-02-19) +- 修复 onBlur的emit传值错误 +## 1.1.12(2024-01-29) +- 补充 adjust-position文档属性补充 +## 1.1.11(2024-01-29) +- 补充 adjust-position属性传递值:(Boolean)当键盘弹起时,是否自动上推页面 +## 1.1.10(2024-01-22) +- 去除 移除无用的log输出 +## 1.1.9(2023-04-11) +- 修复 vue3 下 keyboardheightchange 事件报错的bug +## 1.1.8(2023-03-29) +- 优化 trim 属性默认值 +## 1.1.7(2023-03-29) +- 新增 cursor-spacing 属性 +## 1.1.6(2023-01-28) +- 新增 keyboardheightchange 事件,可监听键盘高度变化 +## 1.1.5(2022-11-29) +- 优化 主题样式 +## 1.1.4(2022-10-27) +- 修复 props 中背景颜色无默认值的bug +## 1.1.0(2022-06-30) + +- 新增 在 uni-forms 1.4.0 中使用可以在 blur 时校验内容 +- 新增 clear 事件,点击右侧叉号图标触发 +- 新增 change 事件 ,仅在输入框失去焦点或用户按下回车时触发 +- 优化 组件样式,组件获取焦点时高亮显示,图标颜色调整等 + +## 1.0.5(2022-06-07) + +- 优化 clearable 显示策略 + +## 1.0.4(2022-06-07) + +- 优化 clearable 显示策略 + +## 1.0.3(2022-05-20) + +- 修复 关闭图标某些情况下无法取消的 bug + +## 1.0.2(2022-04-12) + +- 修复 默认值不生效的 bug + +## 1.0.1(2022-04-02) + +- 修复 value 不能为 0 的 bug + +## 1.0.0(2021-11-19) + +- 优化 组件 UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-easyinput](https://uniapp.dcloud.io/component/uniui/uni-easyinput) + +## 0.1.4(2021-08-20) + +- 修复 在 uni-forms 的动态表单中默认值校验不通过的 bug + +## 0.1.3(2021-08-11) + +- 修复 在 uni-forms 中重置表单,错误信息无法清除的问题 + +## 0.1.2(2021-07-30) + +- 优化 vue3 下事件警告的问题 + +## 0.1.1 + +- 优化 errorMessage 属性支持 Boolean 类型 + +## 0.1.0(2021-07-13) + +- 组件兼容 vue3,如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) + +## 0.0.16(2021-06-29) + +- 修复 confirmType 属性(仅 type="text" 生效)导致多行文本框无法换行的 bug + +## 0.0.15(2021-06-21) + +- 修复 passwordIcon 属性拼写错误的 bug + +## 0.0.14(2021-06-18) + +- 新增 passwordIcon 属性,当 type=password 时是否显示小眼睛图标 +- 修复 confirmType 属性不生效的问题 + +## 0.0.13(2021-06-04) + +- 修复 disabled 状态可清出内容的 bug + +## 0.0.12(2021-05-12) + +- 新增 组件示例地址 + +## 0.0.11(2021-05-07) + +- 修复 input-border 属性不生效的问题 + +## 0.0.10(2021-04-30) + +- 修复 ios 遮挡文字、显示一半的问题 + +## 0.0.9(2021-02-05) + +- 调整为 uni_modules 目录规范 +- 优化 兼容 nvue 页面 diff --git a/uni_modules/uni-easyinput/components/uni-easyinput/common.js b/uni_modules/uni-easyinput/components/uni-easyinput/common.js new file mode 100644 index 0000000..fde8d3c --- /dev/null +++ b/uni_modules/uni-easyinput/components/uni-easyinput/common.js @@ -0,0 +1,54 @@ +/** + * @desc 函数防抖 + * @param func 目标函数 + * @param wait 延迟执行毫秒数 + * @param immediate true - 立即执行, false - 延迟执行 + */ +export const debounce = function(func, wait = 1000, immediate = true) { + let timer; + return function() { + let context = this, + args = arguments; + if (timer) clearTimeout(timer); + if (immediate) { + let callNow = !timer; + timer = setTimeout(() => { + timer = null; + }, wait); + if (callNow) func.apply(context, args); + } else { + timer = setTimeout(() => { + func.apply(context, args); + }, wait) + } + } +} +/** + * @desc 函数节流 + * @param func 函数 + * @param wait 延迟执行毫秒数 + * @param type 1 使用表时间戳,在时间段开始的时候触发 2 使用表定时器,在时间段结束的时候触发 + */ +export const throttle = (func, wait = 1000, type = 1) => { + let previous = 0; + let timeout; + return function() { + let context = this; + let args = arguments; + if (type === 1) { + let now = Date.now(); + + if (now - previous > wait) { + func.apply(context, args); + previous = now; + } + } else if (type === 2) { + if (!timeout) { + timeout = setTimeout(() => { + timeout = null; + func.apply(context, args) + }, wait) + } + } + } +} diff --git a/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue b/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue new file mode 100644 index 0000000..93506d6 --- /dev/null +++ b/uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.vue @@ -0,0 +1,676 @@ + + + + + \ No newline at end of file diff --git a/uni_modules/uni-easyinput/package.json b/uni_modules/uni-easyinput/package.json new file mode 100644 index 0000000..2939256 --- /dev/null +++ b/uni_modules/uni-easyinput/package.json @@ -0,0 +1,88 @@ +{ + "id": "uni-easyinput", + "displayName": "uni-easyinput 增强输入框", + "version": "1.1.19", + "description": "Easyinput 组件是对原生input组件的增强", + "keywords": [ + "uni-ui", + "uniui", + "input", + "uni-easyinput", + "输入框" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y", + "alipay": "n" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-easyinput/readme.md b/uni_modules/uni-easyinput/readme.md new file mode 100644 index 0000000..f1faf8f --- /dev/null +++ b/uni_modules/uni-easyinput/readme.md @@ -0,0 +1,11 @@ + + +### Easyinput 增强输入框 +> **组件名:uni-easyinput** +> 代码块: `uEasyinput` + + +easyinput 组件是对原生input组件的增强 ,是专门为配合表单组件[uni-forms](https://ext.dcloud.net.cn/plugin?id=2773)而设计的,easyinput 内置了边框,图标等,同时包含 input 所有功能 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-easyinput) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-icons/changelog.md b/uni_modules/uni-icons/changelog.md new file mode 100644 index 0000000..0261131 --- /dev/null +++ b/uni_modules/uni-icons/changelog.md @@ -0,0 +1,42 @@ +## 2.0.10(2024-06-07) +- 优化 uni-app x 中,size 属性的类型 +## 2.0.9(2024-01-12) +fix: 修复图标大小默认值错误的问题 +## 2.0.8(2023-12-14) +- 修复 项目未使用 ts 情况下,打包报错的bug +## 2.0.7(2023-12-14) +- 修复 size 属性为 string 时,不加单位导致尺寸异常的bug +## 2.0.6(2023-12-11) +- 优化 兼容老版本icon类型,如 top ,bottom 等 +## 2.0.5(2023-12-11) +- 优化 兼容老版本icon类型,如 top ,bottom 等 +## 2.0.4(2023-12-06) +- 优化 uni-app x 下示例项目图标排序 +## 2.0.3(2023-12-06) +- 修复 nvue下引入组件报错的bug +## 2.0.2(2023-12-05) +-优化 size 属性支持单位 +## 2.0.1(2023-12-05) +- 新增 uni-app x 支持定义图标 +## 1.3.5(2022-01-24) +- 优化 size 属性可以传入不带单位的字符串数值 +## 1.3.4(2022-01-24) +- 优化 size 支持其他单位 +## 1.3.3(2022-01-17) +- 修复 nvue 有些图标不显示的bug,兼容老版本图标 +## 1.3.2(2021-12-01) +- 优化 示例可复制图标名称 +## 1.3.1(2021-11-23) +- 优化 兼容旧组件 type 值 +## 1.3.0(2021-11-19) +- 新增 更多图标 +- 优化 自定义图标使用方式 +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-icons](https://uniapp.dcloud.io/component/uniui/uni-icons) +## 1.1.7(2021-11-08) +## 1.2.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.5(2021-05-12) +- 新增 组件示例地址 +## 1.1.4(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-icons/components/uni-icons/icons.js b/uni_modules/uni-icons/components/uni-icons/icons.js new file mode 100644 index 0000000..7889936 --- /dev/null +++ b/uni_modules/uni-icons/components/uni-icons/icons.js @@ -0,0 +1,1169 @@ +export default { + "id": "2852637", + "name": "uniui图标库", + "font_family": "uniicons", + "css_prefix_text": "uniui-", + "description": "", + "glyphs": [ + { + "icon_id": "25027049", + "name": "yanse", + "font_class": "color", + "unicode": "e6cf", + "unicode_decimal": 59087 + }, + { + "icon_id": "25027048", + "name": "wallet", + "font_class": "wallet", + "unicode": "e6b1", + "unicode_decimal": 59057 + }, + { + "icon_id": "25015720", + "name": "settings-filled", + "font_class": "settings-filled", + "unicode": "e6ce", + "unicode_decimal": 59086 + }, + { + "icon_id": "25015434", + "name": "shimingrenzheng-filled", + "font_class": "auth-filled", + "unicode": "e6cc", + "unicode_decimal": 59084 + }, + { + "icon_id": "24934246", + "name": "shop-filled", + "font_class": "shop-filled", + "unicode": "e6cd", + "unicode_decimal": 59085 + }, + { + "icon_id": "24934159", + "name": "staff-filled-01", + "font_class": "staff-filled", + "unicode": "e6cb", + "unicode_decimal": 59083 + }, + { + "icon_id": "24932461", + "name": "VIP-filled", + "font_class": "vip-filled", + "unicode": "e6c6", + "unicode_decimal": 59078 + }, + { + "icon_id": "24932462", + "name": "plus_circle_fill", + "font_class": "plus-filled", + "unicode": "e6c7", + "unicode_decimal": 59079 + }, + { + "icon_id": "24932463", + "name": "folder_add-filled", + "font_class": "folder-add-filled", + "unicode": "e6c8", + "unicode_decimal": 59080 + }, + { + "icon_id": "24932464", + "name": "yanse-filled", + "font_class": "color-filled", + "unicode": "e6c9", + "unicode_decimal": 59081 + }, + { + "icon_id": "24932465", + "name": "tune-filled", + "font_class": "tune-filled", + "unicode": "e6ca", + "unicode_decimal": 59082 + }, + { + "icon_id": "24932455", + "name": "a-rilidaka-filled", + "font_class": "calendar-filled", + "unicode": "e6c0", + "unicode_decimal": 59072 + }, + { + "icon_id": "24932456", + "name": "notification-filled", + "font_class": "notification-filled", + "unicode": "e6c1", + "unicode_decimal": 59073 + }, + { + "icon_id": "24932457", + "name": "wallet-filled", + "font_class": "wallet-filled", + "unicode": "e6c2", + "unicode_decimal": 59074 + }, + { + "icon_id": "24932458", + "name": "paihangbang-filled", + "font_class": "medal-filled", + "unicode": "e6c3", + "unicode_decimal": 59075 + }, + { + "icon_id": "24932459", + "name": "gift-filled", + "font_class": "gift-filled", + "unicode": "e6c4", + "unicode_decimal": 59076 + }, + { + "icon_id": "24932460", + "name": "fire-filled", + "font_class": "fire-filled", + "unicode": "e6c5", + "unicode_decimal": 59077 + }, + { + "icon_id": "24928001", + "name": "refreshempty", + "font_class": "refreshempty", + "unicode": "e6bf", + "unicode_decimal": 59071 + }, + { + "icon_id": "24926853", + "name": "location-ellipse", + "font_class": "location-filled", + "unicode": "e6af", + "unicode_decimal": 59055 + }, + { + "icon_id": "24926735", + "name": "person-filled", + "font_class": "person-filled", + "unicode": "e69d", + "unicode_decimal": 59037 + }, + { + "icon_id": "24926703", + "name": "personadd-filled", + "font_class": "personadd-filled", + "unicode": "e698", + "unicode_decimal": 59032 + }, + { + "icon_id": "24923351", + "name": "back", + "font_class": "back", + "unicode": "e6b9", + "unicode_decimal": 59065 + }, + { + "icon_id": "24923352", + "name": "forward", + "font_class": "forward", + "unicode": "e6ba", + "unicode_decimal": 59066 + }, + { + "icon_id": "24923353", + "name": "arrowthinright", + "font_class": "arrow-right", + "unicode": "e6bb", + "unicode_decimal": 59067 + }, + { + "icon_id": "24923353", + "name": "arrowthinright", + "font_class": "arrowthinright", + "unicode": "e6bb", + "unicode_decimal": 59067 + }, + { + "icon_id": "24923354", + "name": "arrowthinleft", + "font_class": "arrow-left", + "unicode": "e6bc", + "unicode_decimal": 59068 + }, + { + "icon_id": "24923354", + "name": "arrowthinleft", + "font_class": "arrowthinleft", + "unicode": "e6bc", + "unicode_decimal": 59068 + }, + { + "icon_id": "24923355", + "name": "arrowthinup", + "font_class": "arrow-up", + "unicode": "e6bd", + "unicode_decimal": 59069 + }, + { + "icon_id": "24923355", + "name": "arrowthinup", + "font_class": "arrowthinup", + "unicode": "e6bd", + "unicode_decimal": 59069 + }, + { + "icon_id": "24923356", + "name": "arrowthindown", + "font_class": "arrow-down", + "unicode": "e6be", + "unicode_decimal": 59070 + },{ + "icon_id": "24923356", + "name": "arrowthindown", + "font_class": "arrowthindown", + "unicode": "e6be", + "unicode_decimal": 59070 + }, + { + "icon_id": "24923349", + "name": "arrowdown", + "font_class": "bottom", + "unicode": "e6b8", + "unicode_decimal": 59064 + },{ + "icon_id": "24923349", + "name": "arrowdown", + "font_class": "arrowdown", + "unicode": "e6b8", + "unicode_decimal": 59064 + }, + { + "icon_id": "24923346", + "name": "arrowright", + "font_class": "right", + "unicode": "e6b5", + "unicode_decimal": 59061 + }, + { + "icon_id": "24923346", + "name": "arrowright", + "font_class": "arrowright", + "unicode": "e6b5", + "unicode_decimal": 59061 + }, + { + "icon_id": "24923347", + "name": "arrowup", + "font_class": "top", + "unicode": "e6b6", + "unicode_decimal": 59062 + }, + { + "icon_id": "24923347", + "name": "arrowup", + "font_class": "arrowup", + "unicode": "e6b6", + "unicode_decimal": 59062 + }, + { + "icon_id": "24923348", + "name": "arrowleft", + "font_class": "left", + "unicode": "e6b7", + "unicode_decimal": 59063 + }, + { + "icon_id": "24923348", + "name": "arrowleft", + "font_class": "arrowleft", + "unicode": "e6b7", + "unicode_decimal": 59063 + }, + { + "icon_id": "24923334", + "name": "eye", + "font_class": "eye", + "unicode": "e651", + "unicode_decimal": 58961 + }, + { + "icon_id": "24923335", + "name": "eye-filled", + "font_class": "eye-filled", + "unicode": "e66a", + "unicode_decimal": 58986 + }, + { + "icon_id": "24923336", + "name": "eye-slash", + "font_class": "eye-slash", + "unicode": "e6b3", + "unicode_decimal": 59059 + }, + { + "icon_id": "24923337", + "name": "eye-slash-filled", + "font_class": "eye-slash-filled", + "unicode": "e6b4", + "unicode_decimal": 59060 + }, + { + "icon_id": "24923305", + "name": "info-filled", + "font_class": "info-filled", + "unicode": "e649", + "unicode_decimal": 58953 + }, + { + "icon_id": "24923299", + "name": "reload-01", + "font_class": "reload", + "unicode": "e6b2", + "unicode_decimal": 59058 + }, + { + "icon_id": "24923195", + "name": "mic_slash_fill", + "font_class": "micoff-filled", + "unicode": "e6b0", + "unicode_decimal": 59056 + }, + { + "icon_id": "24923165", + "name": "map-pin-ellipse", + "font_class": "map-pin-ellipse", + "unicode": "e6ac", + "unicode_decimal": 59052 + }, + { + "icon_id": "24923166", + "name": "map-pin", + "font_class": "map-pin", + "unicode": "e6ad", + "unicode_decimal": 59053 + }, + { + "icon_id": "24923167", + "name": "location", + "font_class": "location", + "unicode": "e6ae", + "unicode_decimal": 59054 + }, + { + "icon_id": "24923064", + "name": "starhalf", + "font_class": "starhalf", + "unicode": "e683", + "unicode_decimal": 59011 + }, + { + "icon_id": "24923065", + "name": "star", + "font_class": "star", + "unicode": "e688", + "unicode_decimal": 59016 + }, + { + "icon_id": "24923066", + "name": "star-filled", + "font_class": "star-filled", + "unicode": "e68f", + "unicode_decimal": 59023 + }, + { + "icon_id": "24899646", + "name": "a-rilidaka", + "font_class": "calendar", + "unicode": "e6a0", + "unicode_decimal": 59040 + }, + { + "icon_id": "24899647", + "name": "fire", + "font_class": "fire", + "unicode": "e6a1", + "unicode_decimal": 59041 + }, + { + "icon_id": "24899648", + "name": "paihangbang", + "font_class": "medal", + "unicode": "e6a2", + "unicode_decimal": 59042 + }, + { + "icon_id": "24899649", + "name": "font", + "font_class": "font", + "unicode": "e6a3", + "unicode_decimal": 59043 + }, + { + "icon_id": "24899650", + "name": "gift", + "font_class": "gift", + "unicode": "e6a4", + "unicode_decimal": 59044 + }, + { + "icon_id": "24899651", + "name": "link", + "font_class": "link", + "unicode": "e6a5", + "unicode_decimal": 59045 + }, + { + "icon_id": "24899652", + "name": "notification", + "font_class": "notification", + "unicode": "e6a6", + "unicode_decimal": 59046 + }, + { + "icon_id": "24899653", + "name": "staff", + "font_class": "staff", + "unicode": "e6a7", + "unicode_decimal": 59047 + }, + { + "icon_id": "24899654", + "name": "VIP", + "font_class": "vip", + "unicode": "e6a8", + "unicode_decimal": 59048 + }, + { + "icon_id": "24899655", + "name": "folder_add", + "font_class": "folder-add", + "unicode": "e6a9", + "unicode_decimal": 59049 + }, + { + "icon_id": "24899656", + "name": "tune", + "font_class": "tune", + "unicode": "e6aa", + "unicode_decimal": 59050 + }, + { + "icon_id": "24899657", + "name": "shimingrenzheng", + "font_class": "auth", + "unicode": "e6ab", + "unicode_decimal": 59051 + }, + { + "icon_id": "24899565", + "name": "person", + "font_class": "person", + "unicode": "e699", + "unicode_decimal": 59033 + }, + { + "icon_id": "24899566", + "name": "email-filled", + "font_class": "email-filled", + "unicode": "e69a", + "unicode_decimal": 59034 + }, + { + "icon_id": "24899567", + "name": "phone-filled", + "font_class": "phone-filled", + "unicode": "e69b", + "unicode_decimal": 59035 + }, + { + "icon_id": "24899568", + "name": "phone", + "font_class": "phone", + "unicode": "e69c", + "unicode_decimal": 59036 + }, + { + "icon_id": "24899570", + "name": "email", + "font_class": "email", + "unicode": "e69e", + "unicode_decimal": 59038 + }, + { + "icon_id": "24899571", + "name": "personadd", + "font_class": "personadd", + "unicode": "e69f", + "unicode_decimal": 59039 + }, + { + "icon_id": "24899558", + "name": "chatboxes-filled", + "font_class": "chatboxes-filled", + "unicode": "e692", + "unicode_decimal": 59026 + }, + { + "icon_id": "24899559", + "name": "contact", + "font_class": "contact", + "unicode": "e693", + "unicode_decimal": 59027 + }, + { + "icon_id": "24899560", + "name": "chatbubble-filled", + "font_class": "chatbubble-filled", + "unicode": "e694", + "unicode_decimal": 59028 + }, + { + "icon_id": "24899561", + "name": "contact-filled", + "font_class": "contact-filled", + "unicode": "e695", + "unicode_decimal": 59029 + }, + { + "icon_id": "24899562", + "name": "chatboxes", + "font_class": "chatboxes", + "unicode": "e696", + "unicode_decimal": 59030 + }, + { + "icon_id": "24899563", + "name": "chatbubble", + "font_class": "chatbubble", + "unicode": "e697", + "unicode_decimal": 59031 + }, + { + "icon_id": "24881290", + "name": "upload-filled", + "font_class": "upload-filled", + "unicode": "e68e", + "unicode_decimal": 59022 + }, + { + "icon_id": "24881292", + "name": "upload", + "font_class": "upload", + "unicode": "e690", + "unicode_decimal": 59024 + }, + { + "icon_id": "24881293", + "name": "weixin", + "font_class": "weixin", + "unicode": "e691", + "unicode_decimal": 59025 + }, + { + "icon_id": "24881274", + "name": "compose", + "font_class": "compose", + "unicode": "e67f", + "unicode_decimal": 59007 + }, + { + "icon_id": "24881275", + "name": "qq", + "font_class": "qq", + "unicode": "e680", + "unicode_decimal": 59008 + }, + { + "icon_id": "24881276", + "name": "download-filled", + "font_class": "download-filled", + "unicode": "e681", + "unicode_decimal": 59009 + }, + { + "icon_id": "24881277", + "name": "pengyouquan", + "font_class": "pyq", + "unicode": "e682", + "unicode_decimal": 59010 + }, + { + "icon_id": "24881279", + "name": "sound", + "font_class": "sound", + "unicode": "e684", + "unicode_decimal": 59012 + }, + { + "icon_id": "24881280", + "name": "trash-filled", + "font_class": "trash-filled", + "unicode": "e685", + "unicode_decimal": 59013 + }, + { + "icon_id": "24881281", + "name": "sound-filled", + "font_class": "sound-filled", + "unicode": "e686", + "unicode_decimal": 59014 + }, + { + "icon_id": "24881282", + "name": "trash", + "font_class": "trash", + "unicode": "e687", + "unicode_decimal": 59015 + }, + { + "icon_id": "24881284", + "name": "videocam-filled", + "font_class": "videocam-filled", + "unicode": "e689", + "unicode_decimal": 59017 + }, + { + "icon_id": "24881285", + "name": "spinner-cycle", + "font_class": "spinner-cycle", + "unicode": "e68a", + "unicode_decimal": 59018 + }, + { + "icon_id": "24881286", + "name": "weibo", + "font_class": "weibo", + "unicode": "e68b", + "unicode_decimal": 59019 + }, + { + "icon_id": "24881288", + "name": "videocam", + "font_class": "videocam", + "unicode": "e68c", + "unicode_decimal": 59020 + }, + { + "icon_id": "24881289", + "name": "download", + "font_class": "download", + "unicode": "e68d", + "unicode_decimal": 59021 + }, + { + "icon_id": "24879601", + "name": "help", + "font_class": "help", + "unicode": "e679", + "unicode_decimal": 59001 + }, + { + "icon_id": "24879602", + "name": "navigate-filled", + "font_class": "navigate-filled", + "unicode": "e67a", + "unicode_decimal": 59002 + }, + { + "icon_id": "24879603", + "name": "plusempty", + "font_class": "plusempty", + "unicode": "e67b", + "unicode_decimal": 59003 + }, + { + "icon_id": "24879604", + "name": "smallcircle", + "font_class": "smallcircle", + "unicode": "e67c", + "unicode_decimal": 59004 + }, + { + "icon_id": "24879605", + "name": "minus-filled", + "font_class": "minus-filled", + "unicode": "e67d", + "unicode_decimal": 59005 + }, + { + "icon_id": "24879606", + "name": "micoff", + "font_class": "micoff", + "unicode": "e67e", + "unicode_decimal": 59006 + }, + { + "icon_id": "24879588", + "name": "closeempty", + "font_class": "closeempty", + "unicode": "e66c", + "unicode_decimal": 58988 + }, + { + "icon_id": "24879589", + "name": "clear", + "font_class": "clear", + "unicode": "e66d", + "unicode_decimal": 58989 + }, + { + "icon_id": "24879590", + "name": "navigate", + "font_class": "navigate", + "unicode": "e66e", + "unicode_decimal": 58990 + }, + { + "icon_id": "24879591", + "name": "minus", + "font_class": "minus", + "unicode": "e66f", + "unicode_decimal": 58991 + }, + { + "icon_id": "24879592", + "name": "image", + "font_class": "image", + "unicode": "e670", + "unicode_decimal": 58992 + }, + { + "icon_id": "24879593", + "name": "mic", + "font_class": "mic", + "unicode": "e671", + "unicode_decimal": 58993 + }, + { + "icon_id": "24879594", + "name": "paperplane", + "font_class": "paperplane", + "unicode": "e672", + "unicode_decimal": 58994 + }, + { + "icon_id": "24879595", + "name": "close", + "font_class": "close", + "unicode": "e673", + "unicode_decimal": 58995 + }, + { + "icon_id": "24879596", + "name": "help-filled", + "font_class": "help-filled", + "unicode": "e674", + "unicode_decimal": 58996 + }, + { + "icon_id": "24879597", + "name": "plus-filled", + "font_class": "paperplane-filled", + "unicode": "e675", + "unicode_decimal": 58997 + }, + { + "icon_id": "24879598", + "name": "plus", + "font_class": "plus", + "unicode": "e676", + "unicode_decimal": 58998 + }, + { + "icon_id": "24879599", + "name": "mic-filled", + "font_class": "mic-filled", + "unicode": "e677", + "unicode_decimal": 58999 + }, + { + "icon_id": "24879600", + "name": "image-filled", + "font_class": "image-filled", + "unicode": "e678", + "unicode_decimal": 59000 + }, + { + "icon_id": "24855900", + "name": "locked-filled", + "font_class": "locked-filled", + "unicode": "e668", + "unicode_decimal": 58984 + }, + { + "icon_id": "24855901", + "name": "info", + "font_class": "info", + "unicode": "e669", + "unicode_decimal": 58985 + }, + { + "icon_id": "24855903", + "name": "locked", + "font_class": "locked", + "unicode": "e66b", + "unicode_decimal": 58987 + }, + { + "icon_id": "24855884", + "name": "camera-filled", + "font_class": "camera-filled", + "unicode": "e658", + "unicode_decimal": 58968 + }, + { + "icon_id": "24855885", + "name": "chat-filled", + "font_class": "chat-filled", + "unicode": "e659", + "unicode_decimal": 58969 + }, + { + "icon_id": "24855886", + "name": "camera", + "font_class": "camera", + "unicode": "e65a", + "unicode_decimal": 58970 + }, + { + "icon_id": "24855887", + "name": "circle", + "font_class": "circle", + "unicode": "e65b", + "unicode_decimal": 58971 + }, + { + "icon_id": "24855888", + "name": "checkmarkempty", + "font_class": "checkmarkempty", + "unicode": "e65c", + "unicode_decimal": 58972 + }, + { + "icon_id": "24855889", + "name": "chat", + "font_class": "chat", + "unicode": "e65d", + "unicode_decimal": 58973 + }, + { + "icon_id": "24855890", + "name": "circle-filled", + "font_class": "circle-filled", + "unicode": "e65e", + "unicode_decimal": 58974 + }, + { + "icon_id": "24855891", + "name": "flag", + "font_class": "flag", + "unicode": "e65f", + "unicode_decimal": 58975 + }, + { + "icon_id": "24855892", + "name": "flag-filled", + "font_class": "flag-filled", + "unicode": "e660", + "unicode_decimal": 58976 + }, + { + "icon_id": "24855893", + "name": "gear-filled", + "font_class": "gear-filled", + "unicode": "e661", + "unicode_decimal": 58977 + }, + { + "icon_id": "24855894", + "name": "home", + "font_class": "home", + "unicode": "e662", + "unicode_decimal": 58978 + }, + { + "icon_id": "24855895", + "name": "home-filled", + "font_class": "home-filled", + "unicode": "e663", + "unicode_decimal": 58979 + }, + { + "icon_id": "24855896", + "name": "gear", + "font_class": "gear", + "unicode": "e664", + "unicode_decimal": 58980 + }, + { + "icon_id": "24855897", + "name": "smallcircle-filled", + "font_class": "smallcircle-filled", + "unicode": "e665", + "unicode_decimal": 58981 + }, + { + "icon_id": "24855898", + "name": "map-filled", + "font_class": "map-filled", + "unicode": "e666", + "unicode_decimal": 58982 + }, + { + "icon_id": "24855899", + "name": "map", + "font_class": "map", + "unicode": "e667", + "unicode_decimal": 58983 + }, + { + "icon_id": "24855825", + "name": "refresh-filled", + "font_class": "refresh-filled", + "unicode": "e656", + "unicode_decimal": 58966 + }, + { + "icon_id": "24855826", + "name": "refresh", + "font_class": "refresh", + "unicode": "e657", + "unicode_decimal": 58967 + }, + { + "icon_id": "24855808", + "name": "cloud-upload", + "font_class": "cloud-upload", + "unicode": "e645", + "unicode_decimal": 58949 + }, + { + "icon_id": "24855809", + "name": "cloud-download-filled", + "font_class": "cloud-download-filled", + "unicode": "e646", + "unicode_decimal": 58950 + }, + { + "icon_id": "24855810", + "name": "cloud-download", + "font_class": "cloud-download", + "unicode": "e647", + "unicode_decimal": 58951 + }, + { + "icon_id": "24855811", + "name": "cloud-upload-filled", + "font_class": "cloud-upload-filled", + "unicode": "e648", + "unicode_decimal": 58952 + }, + { + "icon_id": "24855813", + "name": "redo", + "font_class": "redo", + "unicode": "e64a", + "unicode_decimal": 58954 + }, + { + "icon_id": "24855814", + "name": "images-filled", + "font_class": "images-filled", + "unicode": "e64b", + "unicode_decimal": 58955 + }, + { + "icon_id": "24855815", + "name": "undo-filled", + "font_class": "undo-filled", + "unicode": "e64c", + "unicode_decimal": 58956 + }, + { + "icon_id": "24855816", + "name": "more", + "font_class": "more", + "unicode": "e64d", + "unicode_decimal": 58957 + }, + { + "icon_id": "24855817", + "name": "more-filled", + "font_class": "more-filled", + "unicode": "e64e", + "unicode_decimal": 58958 + }, + { + "icon_id": "24855818", + "name": "undo", + "font_class": "undo", + "unicode": "e64f", + "unicode_decimal": 58959 + }, + { + "icon_id": "24855819", + "name": "images", + "font_class": "images", + "unicode": "e650", + "unicode_decimal": 58960 + }, + { + "icon_id": "24855821", + "name": "paperclip", + "font_class": "paperclip", + "unicode": "e652", + "unicode_decimal": 58962 + }, + { + "icon_id": "24855822", + "name": "settings", + "font_class": "settings", + "unicode": "e653", + "unicode_decimal": 58963 + }, + { + "icon_id": "24855823", + "name": "search", + "font_class": "search", + "unicode": "e654", + "unicode_decimal": 58964 + }, + { + "icon_id": "24855824", + "name": "redo-filled", + "font_class": "redo-filled", + "unicode": "e655", + "unicode_decimal": 58965 + }, + { + "icon_id": "24841702", + "name": "list", + "font_class": "list", + "unicode": "e644", + "unicode_decimal": 58948 + }, + { + "icon_id": "24841489", + "name": "mail-open-filled", + "font_class": "mail-open-filled", + "unicode": "e63a", + "unicode_decimal": 58938 + }, + { + "icon_id": "24841491", + "name": "hand-thumbsdown-filled", + "font_class": "hand-down-filled", + "unicode": "e63c", + "unicode_decimal": 58940 + }, + { + "icon_id": "24841492", + "name": "hand-thumbsdown", + "font_class": "hand-down", + "unicode": "e63d", + "unicode_decimal": 58941 + }, + { + "icon_id": "24841493", + "name": "hand-thumbsup-filled", + "font_class": "hand-up-filled", + "unicode": "e63e", + "unicode_decimal": 58942 + }, + { + "icon_id": "24841494", + "name": "hand-thumbsup", + "font_class": "hand-up", + "unicode": "e63f", + "unicode_decimal": 58943 + }, + { + "icon_id": "24841496", + "name": "heart-filled", + "font_class": "heart-filled", + "unicode": "e641", + "unicode_decimal": 58945 + }, + { + "icon_id": "24841498", + "name": "mail-open", + "font_class": "mail-open", + "unicode": "e643", + "unicode_decimal": 58947 + }, + { + "icon_id": "24841488", + "name": "heart", + "font_class": "heart", + "unicode": "e639", + "unicode_decimal": 58937 + }, + { + "icon_id": "24839963", + "name": "loop", + "font_class": "loop", + "unicode": "e633", + "unicode_decimal": 58931 + }, + { + "icon_id": "24839866", + "name": "pulldown", + "font_class": "pulldown", + "unicode": "e632", + "unicode_decimal": 58930 + }, + { + "icon_id": "24813798", + "name": "scan", + "font_class": "scan", + "unicode": "e62a", + "unicode_decimal": 58922 + }, + { + "icon_id": "24813786", + "name": "bars", + "font_class": "bars", + "unicode": "e627", + "unicode_decimal": 58919 + }, + { + "icon_id": "24813788", + "name": "cart-filled", + "font_class": "cart-filled", + "unicode": "e629", + "unicode_decimal": 58921 + }, + { + "icon_id": "24813790", + "name": "checkbox", + "font_class": "checkbox", + "unicode": "e62b", + "unicode_decimal": 58923 + }, + { + "icon_id": "24813791", + "name": "checkbox-filled", + "font_class": "checkbox-filled", + "unicode": "e62c", + "unicode_decimal": 58924 + }, + { + "icon_id": "24813794", + "name": "shop", + "font_class": "shop", + "unicode": "e62f", + "unicode_decimal": 58927 + }, + { + "icon_id": "24813795", + "name": "headphones", + "font_class": "headphones", + "unicode": "e630", + "unicode_decimal": 58928 + }, + { + "icon_id": "24813796", + "name": "cart", + "font_class": "cart", + "unicode": "e631", + "unicode_decimal": 58929 + } + ] +} diff --git a/uni_modules/uni-icons/components/uni-icons/uni-icons.uvue b/uni_modules/uni-icons/components/uni-icons/uni-icons.uvue new file mode 100644 index 0000000..8740559 --- /dev/null +++ b/uni_modules/uni-icons/components/uni-icons/uni-icons.uvue @@ -0,0 +1,91 @@ + + + + + diff --git a/uni_modules/uni-icons/components/uni-icons/uni-icons.vue b/uni_modules/uni-icons/components/uni-icons/uni-icons.vue new file mode 100644 index 0000000..7da5356 --- /dev/null +++ b/uni_modules/uni-icons/components/uni-icons/uni-icons.vue @@ -0,0 +1,110 @@ + + + + + diff --git a/uni_modules/uni-icons/components/uni-icons/uniicons.css b/uni_modules/uni-icons/components/uni-icons/uniicons.css new file mode 100644 index 0000000..0a6b6fe --- /dev/null +++ b/uni_modules/uni-icons/components/uni-icons/uniicons.css @@ -0,0 +1,664 @@ + +.uniui-cart-filled:before { + content: "\e6d0"; +} + +.uniui-gift-filled:before { + content: "\e6c4"; +} + +.uniui-color:before { + content: "\e6cf"; +} + +.uniui-wallet:before { + content: "\e6b1"; +} + +.uniui-settings-filled:before { + content: "\e6ce"; +} + +.uniui-auth-filled:before { + content: "\e6cc"; +} + +.uniui-shop-filled:before { + content: "\e6cd"; +} + +.uniui-staff-filled:before { + content: "\e6cb"; +} + +.uniui-vip-filled:before { + content: "\e6c6"; +} + +.uniui-plus-filled:before { + content: "\e6c7"; +} + +.uniui-folder-add-filled:before { + content: "\e6c8"; +} + +.uniui-color-filled:before { + content: "\e6c9"; +} + +.uniui-tune-filled:before { + content: "\e6ca"; +} + +.uniui-calendar-filled:before { + content: "\e6c0"; +} + +.uniui-notification-filled:before { + content: "\e6c1"; +} + +.uniui-wallet-filled:before { + content: "\e6c2"; +} + +.uniui-medal-filled:before { + content: "\e6c3"; +} + +.uniui-fire-filled:before { + content: "\e6c5"; +} + +.uniui-refreshempty:before { + content: "\e6bf"; +} + +.uniui-location-filled:before { + content: "\e6af"; +} + +.uniui-person-filled:before { + content: "\e69d"; +} + +.uniui-personadd-filled:before { + content: "\e698"; +} + +.uniui-arrowthinleft:before { + content: "\e6d2"; +} + +.uniui-arrowthinup:before { + content: "\e6d3"; +} + +.uniui-arrowthindown:before { + content: "\e6d4"; +} + +.uniui-back:before { + content: "\e6b9"; +} + +.uniui-forward:before { + content: "\e6ba"; +} + +.uniui-arrow-right:before { + content: "\e6bb"; +} + +.uniui-arrow-left:before { + content: "\e6bc"; +} + +.uniui-arrow-up:before { + content: "\e6bd"; +} + +.uniui-arrow-down:before { + content: "\e6be"; +} + +.uniui-arrowthinright:before { + content: "\e6d1"; +} + +.uniui-down:before { + content: "\e6b8"; +} + +.uniui-bottom:before { + content: "\e6b8"; +} + +.uniui-arrowright:before { + content: "\e6d5"; +} + +.uniui-right:before { + content: "\e6b5"; +} + +.uniui-up:before { + content: "\e6b6"; +} + +.uniui-top:before { + content: "\e6b6"; +} + +.uniui-left:before { + content: "\e6b7"; +} + +.uniui-arrowup:before { + content: "\e6d6"; +} + +.uniui-eye:before { + content: "\e651"; +} + +.uniui-eye-filled:before { + content: "\e66a"; +} + +.uniui-eye-slash:before { + content: "\e6b3"; +} + +.uniui-eye-slash-filled:before { + content: "\e6b4"; +} + +.uniui-info-filled:before { + content: "\e649"; +} + +.uniui-reload:before { + content: "\e6b2"; +} + +.uniui-micoff-filled:before { + content: "\e6b0"; +} + +.uniui-map-pin-ellipse:before { + content: "\e6ac"; +} + +.uniui-map-pin:before { + content: "\e6ad"; +} + +.uniui-location:before { + content: "\e6ae"; +} + +.uniui-starhalf:before { + content: "\e683"; +} + +.uniui-star:before { + content: "\e688"; +} + +.uniui-star-filled:before { + content: "\e68f"; +} + +.uniui-calendar:before { + content: "\e6a0"; +} + +.uniui-fire:before { + content: "\e6a1"; +} + +.uniui-medal:before { + content: "\e6a2"; +} + +.uniui-font:before { + content: "\e6a3"; +} + +.uniui-gift:before { + content: "\e6a4"; +} + +.uniui-link:before { + content: "\e6a5"; +} + +.uniui-notification:before { + content: "\e6a6"; +} + +.uniui-staff:before { + content: "\e6a7"; +} + +.uniui-vip:before { + content: "\e6a8"; +} + +.uniui-folder-add:before { + content: "\e6a9"; +} + +.uniui-tune:before { + content: "\e6aa"; +} + +.uniui-auth:before { + content: "\e6ab"; +} + +.uniui-person:before { + content: "\e699"; +} + +.uniui-email-filled:before { + content: "\e69a"; +} + +.uniui-phone-filled:before { + content: "\e69b"; +} + +.uniui-phone:before { + content: "\e69c"; +} + +.uniui-email:before { + content: "\e69e"; +} + +.uniui-personadd:before { + content: "\e69f"; +} + +.uniui-chatboxes-filled:before { + content: "\e692"; +} + +.uniui-contact:before { + content: "\e693"; +} + +.uniui-chatbubble-filled:before { + content: "\e694"; +} + +.uniui-contact-filled:before { + content: "\e695"; +} + +.uniui-chatboxes:before { + content: "\e696"; +} + +.uniui-chatbubble:before { + content: "\e697"; +} + +.uniui-upload-filled:before { + content: "\e68e"; +} + +.uniui-upload:before { + content: "\e690"; +} + +.uniui-weixin:before { + content: "\e691"; +} + +.uniui-compose:before { + content: "\e67f"; +} + +.uniui-qq:before { + content: "\e680"; +} + +.uniui-download-filled:before { + content: "\e681"; +} + +.uniui-pyq:before { + content: "\e682"; +} + +.uniui-sound:before { + content: "\e684"; +} + +.uniui-trash-filled:before { + content: "\e685"; +} + +.uniui-sound-filled:before { + content: "\e686"; +} + +.uniui-trash:before { + content: "\e687"; +} + +.uniui-videocam-filled:before { + content: "\e689"; +} + +.uniui-spinner-cycle:before { + content: "\e68a"; +} + +.uniui-weibo:before { + content: "\e68b"; +} + +.uniui-videocam:before { + content: "\e68c"; +} + +.uniui-download:before { + content: "\e68d"; +} + +.uniui-help:before { + content: "\e679"; +} + +.uniui-navigate-filled:before { + content: "\e67a"; +} + +.uniui-plusempty:before { + content: "\e67b"; +} + +.uniui-smallcircle:before { + content: "\e67c"; +} + +.uniui-minus-filled:before { + content: "\e67d"; +} + +.uniui-micoff:before { + content: "\e67e"; +} + +.uniui-closeempty:before { + content: "\e66c"; +} + +.uniui-clear:before { + content: "\e66d"; +} + +.uniui-navigate:before { + content: "\e66e"; +} + +.uniui-minus:before { + content: "\e66f"; +} + +.uniui-image:before { + content: "\e670"; +} + +.uniui-mic:before { + content: "\e671"; +} + +.uniui-paperplane:before { + content: "\e672"; +} + +.uniui-close:before { + content: "\e673"; +} + +.uniui-help-filled:before { + content: "\e674"; +} + +.uniui-paperplane-filled:before { + content: "\e675"; +} + +.uniui-plus:before { + content: "\e676"; +} + +.uniui-mic-filled:before { + content: "\e677"; +} + +.uniui-image-filled:before { + content: "\e678"; +} + +.uniui-locked-filled:before { + content: "\e668"; +} + +.uniui-info:before { + content: "\e669"; +} + +.uniui-locked:before { + content: "\e66b"; +} + +.uniui-camera-filled:before { + content: "\e658"; +} + +.uniui-chat-filled:before { + content: "\e659"; +} + +.uniui-camera:before { + content: "\e65a"; +} + +.uniui-circle:before { + content: "\e65b"; +} + +.uniui-checkmarkempty:before { + content: "\e65c"; +} + +.uniui-chat:before { + content: "\e65d"; +} + +.uniui-circle-filled:before { + content: "\e65e"; +} + +.uniui-flag:before { + content: "\e65f"; +} + +.uniui-flag-filled:before { + content: "\e660"; +} + +.uniui-gear-filled:before { + content: "\e661"; +} + +.uniui-home:before { + content: "\e662"; +} + +.uniui-home-filled:before { + content: "\e663"; +} + +.uniui-gear:before { + content: "\e664"; +} + +.uniui-smallcircle-filled:before { + content: "\e665"; +} + +.uniui-map-filled:before { + content: "\e666"; +} + +.uniui-map:before { + content: "\e667"; +} + +.uniui-refresh-filled:before { + content: "\e656"; +} + +.uniui-refresh:before { + content: "\e657"; +} + +.uniui-cloud-upload:before { + content: "\e645"; +} + +.uniui-cloud-download-filled:before { + content: "\e646"; +} + +.uniui-cloud-download:before { + content: "\e647"; +} + +.uniui-cloud-upload-filled:before { + content: "\e648"; +} + +.uniui-redo:before { + content: "\e64a"; +} + +.uniui-images-filled:before { + content: "\e64b"; +} + +.uniui-undo-filled:before { + content: "\e64c"; +} + +.uniui-more:before { + content: "\e64d"; +} + +.uniui-more-filled:before { + content: "\e64e"; +} + +.uniui-undo:before { + content: "\e64f"; +} + +.uniui-images:before { + content: "\e650"; +} + +.uniui-paperclip:before { + content: "\e652"; +} + +.uniui-settings:before { + content: "\e653"; +} + +.uniui-search:before { + content: "\e654"; +} + +.uniui-redo-filled:before { + content: "\e655"; +} + +.uniui-list:before { + content: "\e644"; +} + +.uniui-mail-open-filled:before { + content: "\e63a"; +} + +.uniui-hand-down-filled:before { + content: "\e63c"; +} + +.uniui-hand-down:before { + content: "\e63d"; +} + +.uniui-hand-up-filled:before { + content: "\e63e"; +} + +.uniui-hand-up:before { + content: "\e63f"; +} + +.uniui-heart-filled:before { + content: "\e641"; +} + +.uniui-mail-open:before { + content: "\e643"; +} + +.uniui-heart:before { + content: "\e639"; +} + +.uniui-loop:before { + content: "\e633"; +} + +.uniui-pulldown:before { + content: "\e632"; +} + +.uniui-scan:before { + content: "\e62a"; +} + +.uniui-bars:before { + content: "\e627"; +} + +.uniui-checkbox:before { + content: "\e62b"; +} + +.uniui-checkbox-filled:before { + content: "\e62c"; +} + +.uniui-shop:before { + content: "\e62f"; +} + +.uniui-headphones:before { + content: "\e630"; +} + +.uniui-cart:before { + content: "\e631"; +} diff --git a/uni_modules/uni-icons/components/uni-icons/uniicons.ttf b/uni_modules/uni-icons/components/uni-icons/uniicons.ttf new file mode 100644 index 0000000..14696d0 Binary files /dev/null and b/uni_modules/uni-icons/components/uni-icons/uniicons.ttf differ diff --git a/uni_modules/uni-icons/components/uni-icons/uniicons_file.ts b/uni_modules/uni-icons/components/uni-icons/uniicons_file.ts new file mode 100644 index 0000000..98e93aa --- /dev/null +++ b/uni_modules/uni-icons/components/uni-icons/uniicons_file.ts @@ -0,0 +1,664 @@ + +export type IconsData = { + id : string + name : string + font_family : string + css_prefix_text : string + description : string + glyphs : Array +} + +export type IconsDataItem = { + font_class : string + unicode : string +} + + +export const fontData = [ + { + "font_class": "arrow-down", + "unicode": "\ue6be" + }, + { + "font_class": "arrow-left", + "unicode": "\ue6bc" + }, + { + "font_class": "arrow-right", + "unicode": "\ue6bb" + }, + { + "font_class": "arrow-up", + "unicode": "\ue6bd" + }, + { + "font_class": "auth", + "unicode": "\ue6ab" + }, + { + "font_class": "auth-filled", + "unicode": "\ue6cc" + }, + { + "font_class": "back", + "unicode": "\ue6b9" + }, + { + "font_class": "bars", + "unicode": "\ue627" + }, + { + "font_class": "calendar", + "unicode": "\ue6a0" + }, + { + "font_class": "calendar-filled", + "unicode": "\ue6c0" + }, + { + "font_class": "camera", + "unicode": "\ue65a" + }, + { + "font_class": "camera-filled", + "unicode": "\ue658" + }, + { + "font_class": "cart", + "unicode": "\ue631" + }, + { + "font_class": "cart-filled", + "unicode": "\ue6d0" + }, + { + "font_class": "chat", + "unicode": "\ue65d" + }, + { + "font_class": "chat-filled", + "unicode": "\ue659" + }, + { + "font_class": "chatboxes", + "unicode": "\ue696" + }, + { + "font_class": "chatboxes-filled", + "unicode": "\ue692" + }, + { + "font_class": "chatbubble", + "unicode": "\ue697" + }, + { + "font_class": "chatbubble-filled", + "unicode": "\ue694" + }, + { + "font_class": "checkbox", + "unicode": "\ue62b" + }, + { + "font_class": "checkbox-filled", + "unicode": "\ue62c" + }, + { + "font_class": "checkmarkempty", + "unicode": "\ue65c" + }, + { + "font_class": "circle", + "unicode": "\ue65b" + }, + { + "font_class": "circle-filled", + "unicode": "\ue65e" + }, + { + "font_class": "clear", + "unicode": "\ue66d" + }, + { + "font_class": "close", + "unicode": "\ue673" + }, + { + "font_class": "closeempty", + "unicode": "\ue66c" + }, + { + "font_class": "cloud-download", + "unicode": "\ue647" + }, + { + "font_class": "cloud-download-filled", + "unicode": "\ue646" + }, + { + "font_class": "cloud-upload", + "unicode": "\ue645" + }, + { + "font_class": "cloud-upload-filled", + "unicode": "\ue648" + }, + { + "font_class": "color", + "unicode": "\ue6cf" + }, + { + "font_class": "color-filled", + "unicode": "\ue6c9" + }, + { + "font_class": "compose", + "unicode": "\ue67f" + }, + { + "font_class": "contact", + "unicode": "\ue693" + }, + { + "font_class": "contact-filled", + "unicode": "\ue695" + }, + { + "font_class": "down", + "unicode": "\ue6b8" + }, + { + "font_class": "bottom", + "unicode": "\ue6b8" + }, + { + "font_class": "download", + "unicode": "\ue68d" + }, + { + "font_class": "download-filled", + "unicode": "\ue681" + }, + { + "font_class": "email", + "unicode": "\ue69e" + }, + { + "font_class": "email-filled", + "unicode": "\ue69a" + }, + { + "font_class": "eye", + "unicode": "\ue651" + }, + { + "font_class": "eye-filled", + "unicode": "\ue66a" + }, + { + "font_class": "eye-slash", + "unicode": "\ue6b3" + }, + { + "font_class": "eye-slash-filled", + "unicode": "\ue6b4" + }, + { + "font_class": "fire", + "unicode": "\ue6a1" + }, + { + "font_class": "fire-filled", + "unicode": "\ue6c5" + }, + { + "font_class": "flag", + "unicode": "\ue65f" + }, + { + "font_class": "flag-filled", + "unicode": "\ue660" + }, + { + "font_class": "folder-add", + "unicode": "\ue6a9" + }, + { + "font_class": "folder-add-filled", + "unicode": "\ue6c8" + }, + { + "font_class": "font", + "unicode": "\ue6a3" + }, + { + "font_class": "forward", + "unicode": "\ue6ba" + }, + { + "font_class": "gear", + "unicode": "\ue664" + }, + { + "font_class": "gear-filled", + "unicode": "\ue661" + }, + { + "font_class": "gift", + "unicode": "\ue6a4" + }, + { + "font_class": "gift-filled", + "unicode": "\ue6c4" + }, + { + "font_class": "hand-down", + "unicode": "\ue63d" + }, + { + "font_class": "hand-down-filled", + "unicode": "\ue63c" + }, + { + "font_class": "hand-up", + "unicode": "\ue63f" + }, + { + "font_class": "hand-up-filled", + "unicode": "\ue63e" + }, + { + "font_class": "headphones", + "unicode": "\ue630" + }, + { + "font_class": "heart", + "unicode": "\ue639" + }, + { + "font_class": "heart-filled", + "unicode": "\ue641" + }, + { + "font_class": "help", + "unicode": "\ue679" + }, + { + "font_class": "help-filled", + "unicode": "\ue674" + }, + { + "font_class": "home", + "unicode": "\ue662" + }, + { + "font_class": "home-filled", + "unicode": "\ue663" + }, + { + "font_class": "image", + "unicode": "\ue670" + }, + { + "font_class": "image-filled", + "unicode": "\ue678" + }, + { + "font_class": "images", + "unicode": "\ue650" + }, + { + "font_class": "images-filled", + "unicode": "\ue64b" + }, + { + "font_class": "info", + "unicode": "\ue669" + }, + { + "font_class": "info-filled", + "unicode": "\ue649" + }, + { + "font_class": "left", + "unicode": "\ue6b7" + }, + { + "font_class": "link", + "unicode": "\ue6a5" + }, + { + "font_class": "list", + "unicode": "\ue644" + }, + { + "font_class": "location", + "unicode": "\ue6ae" + }, + { + "font_class": "location-filled", + "unicode": "\ue6af" + }, + { + "font_class": "locked", + "unicode": "\ue66b" + }, + { + "font_class": "locked-filled", + "unicode": "\ue668" + }, + { + "font_class": "loop", + "unicode": "\ue633" + }, + { + "font_class": "mail-open", + "unicode": "\ue643" + }, + { + "font_class": "mail-open-filled", + "unicode": "\ue63a" + }, + { + "font_class": "map", + "unicode": "\ue667" + }, + { + "font_class": "map-filled", + "unicode": "\ue666" + }, + { + "font_class": "map-pin", + "unicode": "\ue6ad" + }, + { + "font_class": "map-pin-ellipse", + "unicode": "\ue6ac" + }, + { + "font_class": "medal", + "unicode": "\ue6a2" + }, + { + "font_class": "medal-filled", + "unicode": "\ue6c3" + }, + { + "font_class": "mic", + "unicode": "\ue671" + }, + { + "font_class": "mic-filled", + "unicode": "\ue677" + }, + { + "font_class": "micoff", + "unicode": "\ue67e" + }, + { + "font_class": "micoff-filled", + "unicode": "\ue6b0" + }, + { + "font_class": "minus", + "unicode": "\ue66f" + }, + { + "font_class": "minus-filled", + "unicode": "\ue67d" + }, + { + "font_class": "more", + "unicode": "\ue64d" + }, + { + "font_class": "more-filled", + "unicode": "\ue64e" + }, + { + "font_class": "navigate", + "unicode": "\ue66e" + }, + { + "font_class": "navigate-filled", + "unicode": "\ue67a" + }, + { + "font_class": "notification", + "unicode": "\ue6a6" + }, + { + "font_class": "notification-filled", + "unicode": "\ue6c1" + }, + { + "font_class": "paperclip", + "unicode": "\ue652" + }, + { + "font_class": "paperplane", + "unicode": "\ue672" + }, + { + "font_class": "paperplane-filled", + "unicode": "\ue675" + }, + { + "font_class": "person", + "unicode": "\ue699" + }, + { + "font_class": "person-filled", + "unicode": "\ue69d" + }, + { + "font_class": "personadd", + "unicode": "\ue69f" + }, + { + "font_class": "personadd-filled", + "unicode": "\ue698" + }, + { + "font_class": "personadd-filled-copy", + "unicode": "\ue6d1" + }, + { + "font_class": "phone", + "unicode": "\ue69c" + }, + { + "font_class": "phone-filled", + "unicode": "\ue69b" + }, + { + "font_class": "plus", + "unicode": "\ue676" + }, + { + "font_class": "plus-filled", + "unicode": "\ue6c7" + }, + { + "font_class": "plusempty", + "unicode": "\ue67b" + }, + { + "font_class": "pulldown", + "unicode": "\ue632" + }, + { + "font_class": "pyq", + "unicode": "\ue682" + }, + { + "font_class": "qq", + "unicode": "\ue680" + }, + { + "font_class": "redo", + "unicode": "\ue64a" + }, + { + "font_class": "redo-filled", + "unicode": "\ue655" + }, + { + "font_class": "refresh", + "unicode": "\ue657" + }, + { + "font_class": "refresh-filled", + "unicode": "\ue656" + }, + { + "font_class": "refreshempty", + "unicode": "\ue6bf" + }, + { + "font_class": "reload", + "unicode": "\ue6b2" + }, + { + "font_class": "right", + "unicode": "\ue6b5" + }, + { + "font_class": "scan", + "unicode": "\ue62a" + }, + { + "font_class": "search", + "unicode": "\ue654" + }, + { + "font_class": "settings", + "unicode": "\ue653" + }, + { + "font_class": "settings-filled", + "unicode": "\ue6ce" + }, + { + "font_class": "shop", + "unicode": "\ue62f" + }, + { + "font_class": "shop-filled", + "unicode": "\ue6cd" + }, + { + "font_class": "smallcircle", + "unicode": "\ue67c" + }, + { + "font_class": "smallcircle-filled", + "unicode": "\ue665" + }, + { + "font_class": "sound", + "unicode": "\ue684" + }, + { + "font_class": "sound-filled", + "unicode": "\ue686" + }, + { + "font_class": "spinner-cycle", + "unicode": "\ue68a" + }, + { + "font_class": "staff", + "unicode": "\ue6a7" + }, + { + "font_class": "staff-filled", + "unicode": "\ue6cb" + }, + { + "font_class": "star", + "unicode": "\ue688" + }, + { + "font_class": "star-filled", + "unicode": "\ue68f" + }, + { + "font_class": "starhalf", + "unicode": "\ue683" + }, + { + "font_class": "trash", + "unicode": "\ue687" + }, + { + "font_class": "trash-filled", + "unicode": "\ue685" + }, + { + "font_class": "tune", + "unicode": "\ue6aa" + }, + { + "font_class": "tune-filled", + "unicode": "\ue6ca" + }, + { + "font_class": "undo", + "unicode": "\ue64f" + }, + { + "font_class": "undo-filled", + "unicode": "\ue64c" + }, + { + "font_class": "up", + "unicode": "\ue6b6" + }, + { + "font_class": "top", + "unicode": "\ue6b6" + }, + { + "font_class": "upload", + "unicode": "\ue690" + }, + { + "font_class": "upload-filled", + "unicode": "\ue68e" + }, + { + "font_class": "videocam", + "unicode": "\ue68c" + }, + { + "font_class": "videocam-filled", + "unicode": "\ue689" + }, + { + "font_class": "vip", + "unicode": "\ue6a8" + }, + { + "font_class": "vip-filled", + "unicode": "\ue6c6" + }, + { + "font_class": "wallet", + "unicode": "\ue6b1" + }, + { + "font_class": "wallet-filled", + "unicode": "\ue6c2" + }, + { + "font_class": "weibo", + "unicode": "\ue68b" + }, + { + "font_class": "weixin", + "unicode": "\ue691" + } +] as IconsDataItem[] + +// export const fontData = JSON.parse(fontDataJson) diff --git a/uni_modules/uni-icons/components/uni-icons/uniicons_file_vue.js b/uni_modules/uni-icons/components/uni-icons/uniicons_file_vue.js new file mode 100644 index 0000000..1cd11e1 --- /dev/null +++ b/uni_modules/uni-icons/components/uni-icons/uniicons_file_vue.js @@ -0,0 +1,649 @@ + +export const fontData = [ + { + "font_class": "arrow-down", + "unicode": "\ue6be" + }, + { + "font_class": "arrow-left", + "unicode": "\ue6bc" + }, + { + "font_class": "arrow-right", + "unicode": "\ue6bb" + }, + { + "font_class": "arrow-up", + "unicode": "\ue6bd" + }, + { + "font_class": "auth", + "unicode": "\ue6ab" + }, + { + "font_class": "auth-filled", + "unicode": "\ue6cc" + }, + { + "font_class": "back", + "unicode": "\ue6b9" + }, + { + "font_class": "bars", + "unicode": "\ue627" + }, + { + "font_class": "calendar", + "unicode": "\ue6a0" + }, + { + "font_class": "calendar-filled", + "unicode": "\ue6c0" + }, + { + "font_class": "camera", + "unicode": "\ue65a" + }, + { + "font_class": "camera-filled", + "unicode": "\ue658" + }, + { + "font_class": "cart", + "unicode": "\ue631" + }, + { + "font_class": "cart-filled", + "unicode": "\ue6d0" + }, + { + "font_class": "chat", + "unicode": "\ue65d" + }, + { + "font_class": "chat-filled", + "unicode": "\ue659" + }, + { + "font_class": "chatboxes", + "unicode": "\ue696" + }, + { + "font_class": "chatboxes-filled", + "unicode": "\ue692" + }, + { + "font_class": "chatbubble", + "unicode": "\ue697" + }, + { + "font_class": "chatbubble-filled", + "unicode": "\ue694" + }, + { + "font_class": "checkbox", + "unicode": "\ue62b" + }, + { + "font_class": "checkbox-filled", + "unicode": "\ue62c" + }, + { + "font_class": "checkmarkempty", + "unicode": "\ue65c" + }, + { + "font_class": "circle", + "unicode": "\ue65b" + }, + { + "font_class": "circle-filled", + "unicode": "\ue65e" + }, + { + "font_class": "clear", + "unicode": "\ue66d" + }, + { + "font_class": "close", + "unicode": "\ue673" + }, + { + "font_class": "closeempty", + "unicode": "\ue66c" + }, + { + "font_class": "cloud-download", + "unicode": "\ue647" + }, + { + "font_class": "cloud-download-filled", + "unicode": "\ue646" + }, + { + "font_class": "cloud-upload", + "unicode": "\ue645" + }, + { + "font_class": "cloud-upload-filled", + "unicode": "\ue648" + }, + { + "font_class": "color", + "unicode": "\ue6cf" + }, + { + "font_class": "color-filled", + "unicode": "\ue6c9" + }, + { + "font_class": "compose", + "unicode": "\ue67f" + }, + { + "font_class": "contact", + "unicode": "\ue693" + }, + { + "font_class": "contact-filled", + "unicode": "\ue695" + }, + { + "font_class": "down", + "unicode": "\ue6b8" + }, + { + "font_class": "bottom", + "unicode": "\ue6b8" + }, + { + "font_class": "download", + "unicode": "\ue68d" + }, + { + "font_class": "download-filled", + "unicode": "\ue681" + }, + { + "font_class": "email", + "unicode": "\ue69e" + }, + { + "font_class": "email-filled", + "unicode": "\ue69a" + }, + { + "font_class": "eye", + "unicode": "\ue651" + }, + { + "font_class": "eye-filled", + "unicode": "\ue66a" + }, + { + "font_class": "eye-slash", + "unicode": "\ue6b3" + }, + { + "font_class": "eye-slash-filled", + "unicode": "\ue6b4" + }, + { + "font_class": "fire", + "unicode": "\ue6a1" + }, + { + "font_class": "fire-filled", + "unicode": "\ue6c5" + }, + { + "font_class": "flag", + "unicode": "\ue65f" + }, + { + "font_class": "flag-filled", + "unicode": "\ue660" + }, + { + "font_class": "folder-add", + "unicode": "\ue6a9" + }, + { + "font_class": "folder-add-filled", + "unicode": "\ue6c8" + }, + { + "font_class": "font", + "unicode": "\ue6a3" + }, + { + "font_class": "forward", + "unicode": "\ue6ba" + }, + { + "font_class": "gear", + "unicode": "\ue664" + }, + { + "font_class": "gear-filled", + "unicode": "\ue661" + }, + { + "font_class": "gift", + "unicode": "\ue6a4" + }, + { + "font_class": "gift-filled", + "unicode": "\ue6c4" + }, + { + "font_class": "hand-down", + "unicode": "\ue63d" + }, + { + "font_class": "hand-down-filled", + "unicode": "\ue63c" + }, + { + "font_class": "hand-up", + "unicode": "\ue63f" + }, + { + "font_class": "hand-up-filled", + "unicode": "\ue63e" + }, + { + "font_class": "headphones", + "unicode": "\ue630" + }, + { + "font_class": "heart", + "unicode": "\ue639" + }, + { + "font_class": "heart-filled", + "unicode": "\ue641" + }, + { + "font_class": "help", + "unicode": "\ue679" + }, + { + "font_class": "help-filled", + "unicode": "\ue674" + }, + { + "font_class": "home", + "unicode": "\ue662" + }, + { + "font_class": "home-filled", + "unicode": "\ue663" + }, + { + "font_class": "image", + "unicode": "\ue670" + }, + { + "font_class": "image-filled", + "unicode": "\ue678" + }, + { + "font_class": "images", + "unicode": "\ue650" + }, + { + "font_class": "images-filled", + "unicode": "\ue64b" + }, + { + "font_class": "info", + "unicode": "\ue669" + }, + { + "font_class": "info-filled", + "unicode": "\ue649" + }, + { + "font_class": "left", + "unicode": "\ue6b7" + }, + { + "font_class": "link", + "unicode": "\ue6a5" + }, + { + "font_class": "list", + "unicode": "\ue644" + }, + { + "font_class": "location", + "unicode": "\ue6ae" + }, + { + "font_class": "location-filled", + "unicode": "\ue6af" + }, + { + "font_class": "locked", + "unicode": "\ue66b" + }, + { + "font_class": "locked-filled", + "unicode": "\ue668" + }, + { + "font_class": "loop", + "unicode": "\ue633" + }, + { + "font_class": "mail-open", + "unicode": "\ue643" + }, + { + "font_class": "mail-open-filled", + "unicode": "\ue63a" + }, + { + "font_class": "map", + "unicode": "\ue667" + }, + { + "font_class": "map-filled", + "unicode": "\ue666" + }, + { + "font_class": "map-pin", + "unicode": "\ue6ad" + }, + { + "font_class": "map-pin-ellipse", + "unicode": "\ue6ac" + }, + { + "font_class": "medal", + "unicode": "\ue6a2" + }, + { + "font_class": "medal-filled", + "unicode": "\ue6c3" + }, + { + "font_class": "mic", + "unicode": "\ue671" + }, + { + "font_class": "mic-filled", + "unicode": "\ue677" + }, + { + "font_class": "micoff", + "unicode": "\ue67e" + }, + { + "font_class": "micoff-filled", + "unicode": "\ue6b0" + }, + { + "font_class": "minus", + "unicode": "\ue66f" + }, + { + "font_class": "minus-filled", + "unicode": "\ue67d" + }, + { + "font_class": "more", + "unicode": "\ue64d" + }, + { + "font_class": "more-filled", + "unicode": "\ue64e" + }, + { + "font_class": "navigate", + "unicode": "\ue66e" + }, + { + "font_class": "navigate-filled", + "unicode": "\ue67a" + }, + { + "font_class": "notification", + "unicode": "\ue6a6" + }, + { + "font_class": "notification-filled", + "unicode": "\ue6c1" + }, + { + "font_class": "paperclip", + "unicode": "\ue652" + }, + { + "font_class": "paperplane", + "unicode": "\ue672" + }, + { + "font_class": "paperplane-filled", + "unicode": "\ue675" + }, + { + "font_class": "person", + "unicode": "\ue699" + }, + { + "font_class": "person-filled", + "unicode": "\ue69d" + }, + { + "font_class": "personadd", + "unicode": "\ue69f" + }, + { + "font_class": "personadd-filled", + "unicode": "\ue698" + }, + { + "font_class": "personadd-filled-copy", + "unicode": "\ue6d1" + }, + { + "font_class": "phone", + "unicode": "\ue69c" + }, + { + "font_class": "phone-filled", + "unicode": "\ue69b" + }, + { + "font_class": "plus", + "unicode": "\ue676" + }, + { + "font_class": "plus-filled", + "unicode": "\ue6c7" + }, + { + "font_class": "plusempty", + "unicode": "\ue67b" + }, + { + "font_class": "pulldown", + "unicode": "\ue632" + }, + { + "font_class": "pyq", + "unicode": "\ue682" + }, + { + "font_class": "qq", + "unicode": "\ue680" + }, + { + "font_class": "redo", + "unicode": "\ue64a" + }, + { + "font_class": "redo-filled", + "unicode": "\ue655" + }, + { + "font_class": "refresh", + "unicode": "\ue657" + }, + { + "font_class": "refresh-filled", + "unicode": "\ue656" + }, + { + "font_class": "refreshempty", + "unicode": "\ue6bf" + }, + { + "font_class": "reload", + "unicode": "\ue6b2" + }, + { + "font_class": "right", + "unicode": "\ue6b5" + }, + { + "font_class": "scan", + "unicode": "\ue62a" + }, + { + "font_class": "search", + "unicode": "\ue654" + }, + { + "font_class": "settings", + "unicode": "\ue653" + }, + { + "font_class": "settings-filled", + "unicode": "\ue6ce" + }, + { + "font_class": "shop", + "unicode": "\ue62f" + }, + { + "font_class": "shop-filled", + "unicode": "\ue6cd" + }, + { + "font_class": "smallcircle", + "unicode": "\ue67c" + }, + { + "font_class": "smallcircle-filled", + "unicode": "\ue665" + }, + { + "font_class": "sound", + "unicode": "\ue684" + }, + { + "font_class": "sound-filled", + "unicode": "\ue686" + }, + { + "font_class": "spinner-cycle", + "unicode": "\ue68a" + }, + { + "font_class": "staff", + "unicode": "\ue6a7" + }, + { + "font_class": "staff-filled", + "unicode": "\ue6cb" + }, + { + "font_class": "star", + "unicode": "\ue688" + }, + { + "font_class": "star-filled", + "unicode": "\ue68f" + }, + { + "font_class": "starhalf", + "unicode": "\ue683" + }, + { + "font_class": "trash", + "unicode": "\ue687" + }, + { + "font_class": "trash-filled", + "unicode": "\ue685" + }, + { + "font_class": "tune", + "unicode": "\ue6aa" + }, + { + "font_class": "tune-filled", + "unicode": "\ue6ca" + }, + { + "font_class": "undo", + "unicode": "\ue64f" + }, + { + "font_class": "undo-filled", + "unicode": "\ue64c" + }, + { + "font_class": "up", + "unicode": "\ue6b6" + }, + { + "font_class": "top", + "unicode": "\ue6b6" + }, + { + "font_class": "upload", + "unicode": "\ue690" + }, + { + "font_class": "upload-filled", + "unicode": "\ue68e" + }, + { + "font_class": "videocam", + "unicode": "\ue68c" + }, + { + "font_class": "videocam-filled", + "unicode": "\ue689" + }, + { + "font_class": "vip", + "unicode": "\ue6a8" + }, + { + "font_class": "vip-filled", + "unicode": "\ue6c6" + }, + { + "font_class": "wallet", + "unicode": "\ue6b1" + }, + { + "font_class": "wallet-filled", + "unicode": "\ue6c2" + }, + { + "font_class": "weibo", + "unicode": "\ue68b" + }, + { + "font_class": "weixin", + "unicode": "\ue691" + } +] + +// export const fontData = JSON.parse(fontDataJson) diff --git a/uni_modules/uni-icons/package.json b/uni_modules/uni-icons/package.json new file mode 100644 index 0000000..6b681b4 --- /dev/null +++ b/uni_modules/uni-icons/package.json @@ -0,0 +1,89 @@ +{ + "id": "uni-icons", + "displayName": "uni-icons 图标", + "version": "2.0.10", + "description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。", + "keywords": [ + "uni-ui", + "uniui", + "icon", + "图标" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "^3.2.14" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y", + "alipay": "n" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y", + "app-uvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y", + "钉钉": "y", + "快手": "y", + "飞书": "y", + "京东": "y" + }, + "快应用": { + "华为": "y", + "联盟": "y" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-icons/readme.md b/uni_modules/uni-icons/readme.md new file mode 100644 index 0000000..86234ba --- /dev/null +++ b/uni_modules/uni-icons/readme.md @@ -0,0 +1,8 @@ +## Icons 图标 +> **组件名:uni-icons** +> 代码块: `uIcons` + +用于展示 icons 图标 。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-icons) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 diff --git a/uni_modules/uni-list/changelog.md b/uni_modules/uni-list/changelog.md new file mode 100644 index 0000000..8254a18 --- /dev/null +++ b/uni_modules/uni-list/changelog.md @@ -0,0 +1,46 @@ +## 1.2.14(2023-04-14) +- 优化 uni-list-chat 具名插槽`header` 非app端套一层元素,方便使用时通过外层元素定位实现样式修改 +## 1.2.13(2023-03-03) +- uni-list-chat 新增 支持具名插槽`header` +## 1.2.12(2023-02-01) +- 新增 列表图标新增 customPrefix 属性 ,用法 [详见](https://uniapp.dcloud.net.cn/component/uniui/uni-icons.html#icons-props) +## 1.2.11(2023-01-31) +- 修复 无反馈效果呈现的bug +## 1.2.9(2022-11-22) +- 修复 uni-list-chat 在vue3下跳转报错的bug +## 1.2.8(2022-11-21) +- 修复 uni-list-chat avatar属性 值为本地路径时错误的问题 +## 1.2.7(2022-11-21) +- 修复 uni-list-chat avatar属性 在腾讯云版uniCloud下错误的问题 +## 1.2.6(2022-11-18) +- 修复 uni-list-chat note属性 支持:“草稿”字样功能 文本少1位的问题 +## 1.2.5(2022-11-15) +- 修复 uni-list-item 的 customStyle 属性 padding值在 H5端 无效的bug +## 1.2.4(2022-11-15) +- 修复 uni-list-item 的 customStyle 属性 padding值在nvue(vue2)下无效的bug +## 1.2.3(2022-11-14) +- uni-list-chat 新增 avatar 支持 fileId +## 1.2.2(2022-11-11) +- uni-list 新增属性 render-reverse 详情参考:[https://uniapp.dcloud.net.cn/component/list.html](https://uniapp.dcloud.net.cn/component/list.html) +- uni-list-chat note属性 支持:“草稿”字样 加红显示 详情参考uni-im:[https://ext.dcloud.net.cn/plugin?name=uni-im](https://ext.dcloud.net.cn/plugin?name=uni-im) +- uni-list-item 新增属性 customStyle 支持设置padding、backgroundColor +## 1.2.1(2022-03-30) +- 删除无用文件 +## 1.2.0(2021-11-23) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-list](https://uniapp.dcloud.io/component/uniui/uni-list) +## 1.1.3(2021-08-30) +- 修复 在vue3中to属性在发行应用的时候报错的bug +## 1.1.2(2021-07-30) +- 优化 vue3下事件警告的问题 +## 1.1.1(2021-07-21) +- 修复 与其他组件嵌套使用时,点击失效的Bug +## 1.1.0(2021-07-13) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.17(2021-05-12) +- 新增 组件示例地址 +## 1.0.16(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 +## 1.0.15(2021-02-05) +- 调整为uni_modules目录规范 +- 修复 uni-list-chat 角标显示不正常的问题 diff --git a/uni_modules/uni-list/components/uni-list-ad/uni-list-ad.vue b/uni_modules/uni-list/components/uni-list-ad/uni-list-ad.vue new file mode 100644 index 0000000..b9349c2 --- /dev/null +++ b/uni_modules/uni-list/components/uni-list-ad/uni-list-ad.vue @@ -0,0 +1,107 @@ + + + + + diff --git a/uni_modules/uni-list/components/uni-list-chat/uni-list-chat.scss b/uni_modules/uni-list/components/uni-list-chat/uni-list-chat.scss new file mode 100644 index 0000000..311f8d9 --- /dev/null +++ b/uni_modules/uni-list/components/uni-list-chat/uni-list-chat.scss @@ -0,0 +1,58 @@ +/** + * 这里是 uni-list 组件内置的常用样式变量 + * 如果需要覆盖样式,这里提供了基本的组件样式变量,您可以尝试修改这里的变量,去完成样式替换,而不用去修改源码 + * + */ + +// 背景色 +$background-color : #fff; +// 分割线颜色 +$divide-line-color : #e5e5e5; + +// 默认头像大小,如需要修改此值,注意同步修改 js 中的值 const avatarWidth = xx ,目前只支持方形头像 +// nvue 页面不支持修改头像大小 +$avatar-width : 45px ; + +// 头像边框 +$avatar-border-radius: 5px; +$avatar-border-color: #eee; +$avatar-border-width: 1px; + +// 标题文字样式 +$title-size : 16px; +$title-color : #3b4144; +$title-weight : normal; + +// 描述文字样式 +$note-size : 12px; +$note-color : #999; +$note-weight : normal; + +// 右侧额外内容默认样式 +$right-text-size : 12px; +$right-text-color : #999; +$right-text-weight : normal; + +// 角标样式 +// nvue 页面不支持修改圆点位置以及大小 +// 角标在左侧时,角标的位置,默认为 0 ,负数左/下移动,正数右/上移动 +$badge-left: 0px; +$badge-top: 0px; + +// 显示圆点时,圆点大小 +$dot-width: 10px; +$dot-height: 10px; + +// 显示角标时,角标大小和字体大小 +$badge-size : 18px; +$badge-font : 12px; +// 显示角标时,角标前景色 +$badge-color : #fff; +// 显示角标时,角标背景色 +$badge-background-color : #ff5a5f; +// 显示角标时,角标左右间距 +$badge-space : 6px; + +// 状态样式 +// 选中颜色 +$hover : #f5f5f5; diff --git a/uni_modules/uni-list/components/uni-list-chat/uni-list-chat.vue b/uni_modules/uni-list/components/uni-list-chat/uni-list-chat.vue new file mode 100644 index 0000000..d49fd7c --- /dev/null +++ b/uni_modules/uni-list/components/uni-list-chat/uni-list-chat.vue @@ -0,0 +1,593 @@ + + + + + diff --git a/uni_modules/uni-list/components/uni-list-item/uni-list-item.vue b/uni_modules/uni-list/components/uni-list-item/uni-list-item.vue new file mode 100644 index 0000000..a274ac8 --- /dev/null +++ b/uni_modules/uni-list/components/uni-list-item/uni-list-item.vue @@ -0,0 +1,534 @@ + + + + + \ No newline at end of file diff --git a/uni_modules/uni-list/components/uni-list/uni-list.vue b/uni_modules/uni-list/components/uni-list/uni-list.vue new file mode 100644 index 0000000..6ef5972 --- /dev/null +++ b/uni_modules/uni-list/components/uni-list/uni-list.vue @@ -0,0 +1,123 @@ + + + + diff --git a/uni_modules/uni-list/components/uni-list/uni-refresh.vue b/uni_modules/uni-list/components/uni-list/uni-refresh.vue new file mode 100644 index 0000000..3b4c5a2 --- /dev/null +++ b/uni_modules/uni-list/components/uni-list/uni-refresh.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/uni_modules/uni-list/components/uni-list/uni-refresh.wxs b/uni_modules/uni-list/components/uni-list/uni-refresh.wxs new file mode 100644 index 0000000..818a6b7 --- /dev/null +++ b/uni_modules/uni-list/components/uni-list/uni-refresh.wxs @@ -0,0 +1,87 @@ +var pullDown = { + threshold: 95, + maxHeight: 200, + callRefresh: 'onrefresh', + callPullingDown: 'onpullingdown', + refreshSelector: '.uni-refresh' +}; + +function ready(newValue, oldValue, ownerInstance, instance) { + var state = instance.getState() + state.canPullDown = newValue; + // console.log(newValue); +} + +function touchStart(e, instance) { + var state = instance.getState(); + state.refreshInstance = instance.selectComponent(pullDown.refreshSelector); + state.canPullDown = (state.refreshInstance != null && state.refreshInstance != undefined); + if (!state.canPullDown) { + return + } + + // console.log("touchStart"); + + state.height = 0; + state.touchStartY = e.touches[0].pageY || e.changedTouches[0].pageY; + state.refreshInstance.setStyle({ + 'height': 0 + }); + state.refreshInstance.callMethod("onchange", true); +} + +function touchMove(e, ownerInstance) { + var instance = e.instance; + var state = instance.getState(); + if (!state.canPullDown) { + return + } + + var oldHeight = state.height; + var endY = e.touches[0].pageY || e.changedTouches[0].pageY; + var height = endY - state.touchStartY; + if (height > pullDown.maxHeight) { + return; + } + + var refreshInstance = state.refreshInstance; + refreshInstance.setStyle({ + 'height': height + 'px' + }); + + height = height < pullDown.maxHeight ? height : pullDown.maxHeight; + state.height = height; + refreshInstance.callMethod(pullDown.callPullingDown, { + height: height + }); +} + +function touchEnd(e, ownerInstance) { + var state = e.instance.getState(); + if (!state.canPullDown) { + return + } + + state.refreshInstance.callMethod("onchange", false); + + var refreshInstance = state.refreshInstance; + if (state.height > pullDown.threshold) { + refreshInstance.callMethod(pullDown.callRefresh); + return; + } + + refreshInstance.setStyle({ + 'height': 0 + }); +} + +function propObserver(newValue, oldValue, instance) { + pullDown = newValue; +} + +module.exports = { + touchmove: touchMove, + touchstart: touchStart, + touchend: touchEnd, + propObserver: propObserver +} diff --git a/uni_modules/uni-list/package.json b/uni_modules/uni-list/package.json new file mode 100644 index 0000000..8350efc --- /dev/null +++ b/uni_modules/uni-list/package.json @@ -0,0 +1,88 @@ +{ + "id": "uni-list", + "displayName": "uni-list 列表", + "version": "1.2.14", + "description": "List 组件 ,帮助使用者快速构建列表。", + "keywords": [ + "", + "uni-ui", + "uniui", + "列表", + "", + "list" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [ + "uni-badge", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-list/readme.md b/uni_modules/uni-list/readme.md new file mode 100644 index 0000000..32c2865 --- /dev/null +++ b/uni_modules/uni-list/readme.md @@ -0,0 +1,346 @@ +## List 列表 +> **组件名:uni-list** +> 代码块: `uList`、`uListItem` +> 关联组件:`uni-list-item`、`uni-badge`、`uni-icons`、`uni-list-chat`、`uni-list-ad` + + +List 列表组件,包含基本列表样式、可扩展插槽机制、长列表性能优化、多端兼容。 + +在vue页面里,它默认使用页面级滚动。在app-nvue页面里,它默认使用原生list组件滚动。这样的长列表,在滚动出屏幕外后,系统会回收不可见区域的渲染内存资源,不会造成滚动越长手机越卡的问题。 + +uni-list组件是父容器,里面的核心是uni-list-item子组件,它代表列表中的一个可重复行,子组件可以无限循环。 + +uni-list-item有很多风格,uni-list-item组件通过内置的属性,满足一些常用的场景。当内置属性不满足需求时,可以通过扩展插槽来自定义列表内容。 + +内置属性可以覆盖的场景包括:导航列表、设置列表、小图标列表、通信录列表、聊天记录列表。 + +涉及很多大图或丰富内容的列表,比如类今日头条的新闻列表、类淘宝的电商列表,需要通过扩展插槽实现。 + +下文均有样例给出。 + +uni-list不包含下拉刷新和上拉翻页。上拉翻页另见组件:[uni-load-more](https://ext.dcloud.net.cn/plugin?id=29) + + +### 安装方式 + +本组件符合[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)规范,`HBuilderX 2.5.5`起,只需将本组件导入项目,在页面`template`中即可直接使用,无需在页面中`import`和注册`components`。 + +如需通过`npm`方式使用`uni-ui`组件,另见文档:[https://ext.dcloud.net.cn/plugin?id=55](https://ext.dcloud.net.cn/plugin?id=55) + +> **注意事项** +> 为了避免错误使用,给大家带来不好的开发体验,请在使用组件前仔细阅读下面的注意事项,可以帮你避免一些错误。 +> - 组件需要依赖 `sass` 插件 ,请自行手动安装 +> - 组件内部依赖 `'uni-icons'` 、`uni-badge` 组件 +> - `uni-list` 和 `uni-list-item` 需要配套使用,暂不支持单独使用 `uni-list-item` +> - 只有开启点击反馈后,会有点击选中效果 +> - 使用插槽时,可以完全自定义内容 +> - note 、rightText 属性暂时没做限制,不支持文字溢出隐藏,使用时应该控制长度显示或通过默认插槽自行扩展 +> - 支付宝小程序平台需要在支付宝小程序开发者工具里开启 component2 编译模式,开启方式: 详情 --> 项目配置 --> 启用 component2 编译 +> - 如果需要修改 `switch`、`badge` 样式,请使用插槽自定义 +> - 在 `HBuilderX` 低版本中,可能会出现组件显示 `undefined` 的问题,请升级最新的 `HBuilderX` 或者 `cli` +> - 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + +### 基本用法 + +- 设置 `title` 属性,可以显示列表标题 +- 设置 `disabled` 属性,可以禁用当前项 + +```html + + + + + +``` + +### 多行内容显示 + +- 设置 `note` 属性 ,可以在第二行显示描述文本信息 + +```html + + + + + +``` + +### 右侧显示角标、switch + +- 设置 `show-badge` 属性 ,可以显示角标内容 +- 设置 `show-switch` 属性,可以显示 switch 开关 + +```html + + + + + +``` + +### 左侧显示略缩图、图标 + +- 设置 `thumb` 属性 ,可以在列表左侧显示略缩图 +- 设置 `show-extra-icon` 属性,并指定 `extra-icon` 可以在左侧显示图标 + +```html + + + + +``` + +### 开启点击反馈和右侧箭头 +- 设置 `clickable` 为 `true` ,则表示这是一个可点击的列表,会默认给一个点击效果,并可以监听 `click` 事件 +- 设置 `link` 属性,会自动开启点击反馈,并给列表右侧添加一个箭头 +- 设置 `to` 属性,可以跳转页面,`link` 的值表示跳转方式,如果不指定,默认为 `navigateTo` + +```html + + + + + + + +``` + + +### 聊天列表示例 +- 设置 `clickable` 为 `true` ,则表示这是一个可点击的列表,会默认给一个点击效果,并可以监听 `click` 事件 +- 设置 `link` 属性,会自动开启点击反馈,`link` 的值表示跳转方式,如果不指定,默认为 `navigateTo` +- 设置 `to` 属性,可以跳转页面 +- `time` 属性,通常会设置成时间显示,但是这个属性不仅仅可以设置时间,你可以传入任何文本,注意文本长度可能会影响显示 +- `avatar` 和 `avatarList` 属性同时只会有一个生效,同时设置的话,`avatarList` 属性的长度大于1 ,`avatar` 属性将失效 +- 可以通过默认插槽自定义列表右侧内容 + +```html + + + + + + + + + + + + + + + + + 刚刚 + + + + + + + +``` + +```javascript + +export default { + components: {}, + data() { + return { + avatarList: [{ + url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png' + }, { + url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png' + }, { + url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png' + }] + } + } +} + +``` + + +```css + +.chat-custom-right { + flex: 1; + /* #ifndef APP-NVUE */ + display: flex; + /* #endif */ + flex-direction: column; + justify-content: space-between; + align-items: flex-end; +} + +.chat-custom-text { + font-size: 12px; + color: #999; +} + +``` + +## API + +### List Props + +属性名 |类型 |默认值 | 说明 +:-: |:-: |:-: | :-: +border |Boolean |true | 是否显示边框 + + +### ListItem Props + +属性名 |类型 |默认值 | 说明 +:-: |:-: |:-: | :-: +title |String |- | 标题 +note |String |- | 描述 +ellipsis |Number |0 | title 是否溢出隐藏,可选值,0:默认; 1:显示一行; 2:显示两行;【nvue 暂不支持】 +thumb |String |- | 左侧缩略图,若thumb有值,则不会显示扩展图标 +thumbSize |String |medium | 略缩图尺寸,可选值,lg:大图; medium:一般; sm:小图; +showBadge |Boolean |false | 是否显示数字角标 +badgeText |String |- | 数字角标内容 +badgeType |String |- | 数字角标类型,参考[uni-icons](https://ext.dcloud.net.cn/plugin?id=21) +badgeStyle |Object |- | 数字角标样式,使用uni-badge的custom-style参数 +rightText |String |- | 右侧文字内容 +disabled |Boolean |false | 是否禁用 +showArrow |Boolean |true | 是否显示箭头图标 +link |String |navigateTo | 新页面跳转方式,可选值见下表 +to |String |- | 新页面跳转地址,如填写此属性,click 会返回页面是否跳转成功 +clickable |Boolean |false | 是否开启点击反馈 +showSwitch |Boolean |false | 是否显示Switch +switchChecked |Boolean |false | Switch是否被选中 +showExtraIcon |Boolean |false | 左侧是否显示扩展图标 +extraIcon |Object |- | 扩展图标参数,格式为 ``{color: '#4cd964',size: '22',type: 'spinner'}``,参考 [uni-icons](https://ext.dcloud.net.cn/plugin?id=28) +direction | String |row | 排版方向,可选值,row:水平排列; column:垂直排列; 3个插槽是水平排还是垂直排,也受此属性控制 + + +#### Link Options + +属性名 | 说明 +:-: | :-: +navigateTo | 同 uni.navigateTo() +redirectTo | 同 uni.reLaunch() +reLaunch | 同 uni.reLaunch() +switchTab | 同 uni.switchTab() + +### ListItem Events + +事件称名 |说明 |返回参数 +:-: |:-: |:-: +click |点击 uniListItem 触发事件,需开启点击反馈 |- +switchChange |点击切换 Switch 时触发,需显示 switch |e={value:checked} + + + +### ListItem Slots + +名称 | 说明 +:-: | :-: +header | 左/上内容插槽,可完全自定义默认显示 +body | 中间内容插槽,可完全自定义中间内容 +footer | 右/下内容插槽,可完全自定义右侧内容 + + +> **通过插槽扩展** +> 需要注意的是当使用插槽时,内置样式将会失效,只保留排版样式,此时的样式需要开发者自己实现 +> 如果 `uni-list-item` 组件内置属性样式无法满足需求,可以使用插槽来自定义uni-list-item里的内容。 +> uni-list-item提供了3个可扩展的插槽:`header`、`body`、`footer` +> - 当 `direction` 属性为 `row` 时表示水平排列,此时 `header` 表示列表的左边部分,`body` 表示列表的中间部分,`footer` 表示列表的右边部分 +> - 当 `direction` 属性为 `column` 时表示垂直排列,此时 `header` 表示列表的上边部分,`body` 表示列表的中间部分,`footer` 表示列表的下边部分 +> 开发者可以只用1个插槽,也可以3个一起使用。在插槽中可自主编写view标签,实现自己所需的效果。 + + +**示例** + +```html + + + + + + + + + 自定义插槽 + + + + +``` + + + + + +### ListItemChat Props + +属性名 |类型 |默认值 | 说明 +:-: |:-: |:-: | :-: +title |String |- | 标题 +note |String |- | 描述 +clickable |Boolean |false | 是否开启点击反馈 +badgeText |String |- | 数字角标内容,设置为 `dot` 将显示圆点 +badgePositon |String |right | 角标位置 +link |String |navigateTo | 是否展示右侧箭头并开启点击反馈,可选值见下表 +clickable |Boolean |false | 是否开启点击反馈 +to |String |- | 跳转页面地址,如填写此属性,click 会返回页面是否跳转成功 +time |String |- | 右侧时间显示 +avatarCircle |Boolean |false | 是否显示圆形头像 +avatar |String |- | 头像地址,avatarCircle 不填时生效 +avatarList |Array |- | 头像组,格式为 [{url:''}] + +#### Link Options + +属性名 | 说明 +:-: | :-: +navigateTo | 同 uni.navigateTo() +redirectTo | 同 uni.reLaunch() +reLaunch | 同 uni.reLaunch() +switchTab | 同 uni.switchTab() + +### ListItemChat Slots + +名称 | 说明 +:- | :- +default | 自定义列表右侧内容(包括时间和角标显示) + +### ListItemChat Events +事件称名 | 说明 | 返回参数 +:-: | :-: | :-: +@click | 点击 uniListChat 触发事件 | {data:{}} ,如有 to 属性,会返回页面跳转信息 + + + + + + +## 基于uni-list扩展的页面模板 + +通过扩展插槽,可实现多种常见样式的列表 + +**新闻列表类** + +1. 云端一体混合布局:[https://ext.dcloud.net.cn/plugin?id=2546](https://ext.dcloud.net.cn/plugin?id=2546) +2. 云端一体垂直布局,大图模式:[https://ext.dcloud.net.cn/plugin?id=2583](https://ext.dcloud.net.cn/plugin?id=2583) +3. 云端一体垂直布局,多行图文混排:[https://ext.dcloud.net.cn/plugin?id=2584](https://ext.dcloud.net.cn/plugin?id=2584) +4. 云端一体垂直布局,多图模式:[https://ext.dcloud.net.cn/plugin?id=2585](https://ext.dcloud.net.cn/plugin?id=2585) +5. 云端一体水平布局,左图右文:[https://ext.dcloud.net.cn/plugin?id=2586](https://ext.dcloud.net.cn/plugin?id=2586) +6. 云端一体水平布局,左文右图:[https://ext.dcloud.net.cn/plugin?id=2587](https://ext.dcloud.net.cn/plugin?id=2587) +7. 云端一体垂直布局,无图模式,主标题+副标题:[https://ext.dcloud.net.cn/plugin?id=2588](https://ext.dcloud.net.cn/plugin?id=2588) + +**商品列表类** + +1. 云端一体列表/宫格视图互切:[https://ext.dcloud.net.cn/plugin?id=2651](https://ext.dcloud.net.cn/plugin?id=2651) +2. 云端一体列表(宫格模式):[https://ext.dcloud.net.cn/plugin?id=2671](https://ext.dcloud.net.cn/plugin?id=2671) +3. 云端一体列表(列表模式):[https://ext.dcloud.net.cn/plugin?id=2672](https://ext.dcloud.net.cn/plugin?id=2672) + +## 组件示例 + +点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/list/list](https://hellouniapp.dcloud.net.cn/pages/extUI/list/list) \ No newline at end of file diff --git a/uni_modules/uni-load-more/changelog.md b/uni_modules/uni-load-more/changelog.md new file mode 100644 index 0000000..8f03f1d --- /dev/null +++ b/uni_modules/uni-load-more/changelog.md @@ -0,0 +1,19 @@ +## 1.3.3(2022-01-20) +- 新增 showText属性 ,是否显示文本 +## 1.3.2(2022-01-19) +- 修复 nvue 平台下不显示文本的bug +## 1.3.1(2022-01-19) +- 修复 微信小程序平台样式选择器报警告的问题 +## 1.3.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-load-more](https://uniapp.dcloud.io/component/uniui/uni-load-more) +## 1.2.1(2021-08-24) +- 新增 支持国际化 +## 1.2.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.1.8(2021-05-12) +- 新增 组件示例地址 +## 1.1.7(2021-03-30) +- 修复 uni-load-more 在首页使用时,h5 平台报 'uni is not defined' 的 bug +## 1.1.6(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/en.json b/uni_modules/uni-load-more/components/uni-load-more/i18n/en.json new file mode 100644 index 0000000..a4f14a5 --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/en.json @@ -0,0 +1,5 @@ +{ + "uni-load-more.contentdown": "Pull up to show more", + "uni-load-more.contentrefresh": "loading...", + "uni-load-more.contentnomore": "No more data" +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/index.js b/uni_modules/uni-load-more/components/uni-load-more/i18n/index.js new file mode 100644 index 0000000..de7509c --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/index.js @@ -0,0 +1,8 @@ +import en from './en.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hans.json b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hans.json new file mode 100644 index 0000000..f15d510 --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hans.json @@ -0,0 +1,5 @@ +{ + "uni-load-more.contentdown": "上拉显示更多", + "uni-load-more.contentrefresh": "正在加载...", + "uni-load-more.contentnomore": "没有更多数据了" +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hant.json b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hant.json new file mode 100644 index 0000000..a255c6d --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/i18n/zh-Hant.json @@ -0,0 +1,5 @@ +{ + "uni-load-more.contentdown": "上拉顯示更多", + "uni-load-more.contentrefresh": "正在加載...", + "uni-load-more.contentnomore": "沒有更多數據了" +} diff --git a/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue b/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue new file mode 100644 index 0000000..e5eff4d --- /dev/null +++ b/uni_modules/uni-load-more/components/uni-load-more/uni-load-more.vue @@ -0,0 +1,399 @@ + + + + + diff --git a/uni_modules/uni-load-more/package.json b/uni_modules/uni-load-more/package.json new file mode 100644 index 0000000..2fa6f04 --- /dev/null +++ b/uni_modules/uni-load-more/package.json @@ -0,0 +1,86 @@ +{ + "id": "uni-load-more", + "displayName": "uni-load-more 加载更多", + "version": "1.3.3", + "description": "LoadMore 组件,常用在列表里面,做滚动加载使用。", + "keywords": [ + "uni-ui", + "uniui", + "加载更多", + "load-more" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-load-more/readme.md b/uni_modules/uni-load-more/readme.md new file mode 100644 index 0000000..54dc1fa --- /dev/null +++ b/uni_modules/uni-load-more/readme.md @@ -0,0 +1,14 @@ + + +### LoadMore 加载更多 +> **组件名:uni-load-more** +> 代码块: `uLoadMore` + + +用于列表中,做滚动加载使用,展示 loading 的各种状态。 + + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-load-more) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + diff --git a/uni_modules/uni-scss/changelog.md b/uni_modules/uni-scss/changelog.md new file mode 100644 index 0000000..b863bb0 --- /dev/null +++ b/uni_modules/uni-scss/changelog.md @@ -0,0 +1,8 @@ +## 1.0.3(2022-01-21) +- 优化 组件示例 +## 1.0.2(2021-11-22) +- 修复 / 符号在 vue 不同版本兼容问题引起的报错问题 +## 1.0.1(2021-11-22) +- 修复 vue3中scss语法兼容问题 +## 1.0.0(2021-11-18) +- init diff --git a/uni_modules/uni-scss/index.scss b/uni_modules/uni-scss/index.scss new file mode 100644 index 0000000..1744a5f --- /dev/null +++ b/uni_modules/uni-scss/index.scss @@ -0,0 +1 @@ +@import './styles/index.scss'; diff --git a/uni_modules/uni-scss/package.json b/uni_modules/uni-scss/package.json new file mode 100644 index 0000000..7cc0ccb --- /dev/null +++ b/uni_modules/uni-scss/package.json @@ -0,0 +1,82 @@ +{ + "id": "uni-scss", + "displayName": "uni-scss 辅助样式", + "version": "1.0.3", + "description": "uni-sass是uni-ui提供的一套全局样式 ,通过一些简单的类名和sass变量,实现简单的页面布局操作,比如颜色、边距、圆角等。", + "keywords": [ + "uni-scss", + "uni-ui", + "辅助样式" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "^3.1.0" + }, + "dcloudext": { + "category": [ + "JS SDK", + "通用 SDK" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "u" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "n", + "联盟": "n" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} diff --git a/uni_modules/uni-scss/readme.md b/uni_modules/uni-scss/readme.md new file mode 100644 index 0000000..b7d1c25 --- /dev/null +++ b/uni_modules/uni-scss/readme.md @@ -0,0 +1,4 @@ +`uni-sass` 是 `uni-ui`提供的一套全局样式 ,通过一些简单的类名和`sass`变量,实现简单的页面布局操作,比如颜色、边距、圆角等。 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-sass) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 \ No newline at end of file diff --git a/uni_modules/uni-scss/styles/index.scss b/uni_modules/uni-scss/styles/index.scss new file mode 100644 index 0000000..ffac4fe --- /dev/null +++ b/uni_modules/uni-scss/styles/index.scss @@ -0,0 +1,7 @@ +@import './setting/_variables.scss'; +@import './setting/_border.scss'; +@import './setting/_color.scss'; +@import './setting/_space.scss'; +@import './setting/_radius.scss'; +@import './setting/_text.scss'; +@import './setting/_styles.scss'; diff --git a/uni_modules/uni-scss/styles/setting/_border.scss b/uni_modules/uni-scss/styles/setting/_border.scss new file mode 100644 index 0000000..12a11c3 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_border.scss @@ -0,0 +1,3 @@ +.uni-border { + border: 1px $uni-border-1 solid; +} \ No newline at end of file diff --git a/uni_modules/uni-scss/styles/setting/_color.scss b/uni_modules/uni-scss/styles/setting/_color.scss new file mode 100644 index 0000000..1ededd9 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_color.scss @@ -0,0 +1,66 @@ + +// TODO 暂时不需要 class ,需要用户使用变量实现 ,如果使用类名其实并不推荐 +// @mixin get-styles($k,$c) { +// @if $k == size or $k == weight{ +// font-#{$k}:#{$c} +// }@else{ +// #{$k}:#{$c} +// } +// } +$uni-ui-color:( + // 主色 + primary: $uni-primary, + primary-disable: $uni-primary-disable, + primary-light: $uni-primary-light, + // 辅助色 + success: $uni-success, + success-disable: $uni-success-disable, + success-light: $uni-success-light, + warning: $uni-warning, + warning-disable: $uni-warning-disable, + warning-light: $uni-warning-light, + error: $uni-error, + error-disable: $uni-error-disable, + error-light: $uni-error-light, + info: $uni-info, + info-disable: $uni-info-disable, + info-light: $uni-info-light, + // 中性色 + main-color: $uni-main-color, + base-color: $uni-base-color, + secondary-color: $uni-secondary-color, + extra-color: $uni-extra-color, + // 背景色 + bg-color: $uni-bg-color, + // 边框颜色 + border-1: $uni-border-1, + border-2: $uni-border-2, + border-3: $uni-border-3, + border-4: $uni-border-4, + // 黑色 + black:$uni-black, + // 白色 + white:$uni-white, + // 透明 + transparent:$uni-transparent +) !default; +@each $key, $child in $uni-ui-color { + .uni-#{"" + $key} { + color: $child; + } + .uni-#{"" + $key}-bg { + background-color: $child; + } +} +.uni-shadow-sm { + box-shadow: $uni-shadow-sm; +} +.uni-shadow-base { + box-shadow: $uni-shadow-base; +} +.uni-shadow-lg { + box-shadow: $uni-shadow-lg; +} +.uni-mask { + background-color:$uni-mask; +} diff --git a/uni_modules/uni-scss/styles/setting/_radius.scss b/uni_modules/uni-scss/styles/setting/_radius.scss new file mode 100644 index 0000000..9a0428b --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_radius.scss @@ -0,0 +1,55 @@ +@mixin radius($r,$d:null ,$important: false){ + $radius-value:map-get($uni-radius, $r) if($important, !important, null); + // Key exists within the $uni-radius variable + @if (map-has-key($uni-radius, $r) and $d){ + @if $d == t { + border-top-left-radius:$radius-value; + border-top-right-radius:$radius-value; + }@else if $d == r { + border-top-right-radius:$radius-value; + border-bottom-right-radius:$radius-value; + }@else if $d == b { + border-bottom-left-radius:$radius-value; + border-bottom-right-radius:$radius-value; + }@else if $d == l { + border-top-left-radius:$radius-value; + border-bottom-left-radius:$radius-value; + }@else if $d == tl { + border-top-left-radius:$radius-value; + }@else if $d == tr { + border-top-right-radius:$radius-value; + }@else if $d == br { + border-bottom-right-radius:$radius-value; + }@else if $d == bl { + border-bottom-left-radius:$radius-value; + } + }@else{ + border-radius:$radius-value; + } +} + +@each $key, $child in $uni-radius { + @if($key){ + .uni-radius-#{"" + $key} { + @include radius($key) + } + }@else{ + .uni-radius { + @include radius($key) + } + } +} + +@each $direction in t, r, b, l,tl, tr, br, bl { + @each $key, $child in $uni-radius { + @if($key){ + .uni-radius-#{"" + $direction}-#{"" + $key} { + @include radius($key,$direction,false) + } + }@else{ + .uni-radius-#{$direction} { + @include radius($key,$direction,false) + } + } + } +} diff --git a/uni_modules/uni-scss/styles/setting/_space.scss b/uni_modules/uni-scss/styles/setting/_space.scss new file mode 100644 index 0000000..3c89528 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_space.scss @@ -0,0 +1,56 @@ + +@mixin fn($space,$direction,$size,$n) { + @if $n { + #{$space}-#{$direction}: #{$size*$uni-space-root}px + } @else { + #{$space}-#{$direction}: #{-$size*$uni-space-root}px + } +} +@mixin get-styles($direction,$i,$space,$n){ + @if $direction == t { + @include fn($space, top,$i,$n); + } + @if $direction == r { + @include fn($space, right,$i,$n); + } + @if $direction == b { + @include fn($space, bottom,$i,$n); + } + @if $direction == l { + @include fn($space, left,$i,$n); + } + @if $direction == x { + @include fn($space, left,$i,$n); + @include fn($space, right,$i,$n); + } + @if $direction == y { + @include fn($space, top,$i,$n); + @include fn($space, bottom,$i,$n); + } + @if $direction == a { + @if $n { + #{$space}:#{$i*$uni-space-root}px; + } @else { + #{$space}:#{-$i*$uni-space-root}px; + } + } +} + +@each $orientation in m,p { + $space: margin; + @if $orientation == m { + $space: margin; + } @else { + $space: padding; + } + @for $i from 0 through 16 { + @each $direction in t, r, b, l, x, y, a { + .uni-#{$orientation}#{$direction}-#{$i} { + @include get-styles($direction,$i,$space,true); + } + .uni-#{$orientation}#{$direction}-n#{$i} { + @include get-styles($direction,$i,$space,false); + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-scss/styles/setting/_styles.scss b/uni_modules/uni-scss/styles/setting/_styles.scss new file mode 100644 index 0000000..689afec --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_styles.scss @@ -0,0 +1,167 @@ +/* #ifndef APP-NVUE */ + +$-color-white:#fff; +$-color-black:#000; +@mixin base-style($color) { + color: #fff; + background-color: $color; + border-color: mix($-color-black, $color, 8%); + &:not([hover-class]):active { + background: mix($-color-black, $color, 10%); + border-color: mix($-color-black, $color, 20%); + color: $-color-white; + outline: none; + } +} +@mixin is-color($color) { + @include base-style($color); + &[loading] { + @include base-style($color); + &::before { + margin-right:5px; + } + } + &[disabled] { + &, + &[loading], + &:not([hover-class]):active { + color: $-color-white; + border-color: mix(darken($color,10%), $-color-white); + background-color: mix($color, $-color-white); + } + } + +} +@mixin base-plain-style($color) { + color:$color; + background-color: mix($-color-white, $color, 90%); + border-color: mix($-color-white, $color, 70%); + &:not([hover-class]):active { + background: mix($-color-white, $color, 80%); + color: $color; + outline: none; + border-color: mix($-color-white, $color, 50%); + } +} +@mixin is-plain($color){ + &[plain] { + @include base-plain-style($color); + &[loading] { + @include base-plain-style($color); + &::before { + margin-right:5px; + } + } + &[disabled] { + &, + &:active { + color: mix($-color-white, $color, 40%); + background-color: mix($-color-white, $color, 90%); + border-color: mix($-color-white, $color, 80%); + } + } + } +} + + +.uni-btn { + margin: 5px; + color: #393939; + border:1px solid #ccc; + font-size: 16px; + font-weight: 200; + background-color: #F9F9F9; + // TODO 暂时处理边框隐藏一边的问题 + overflow: visible; + &::after{ + border: none; + } + + &:not([type]),&[type=default] { + color: #999; + &[loading] { + background: none; + &::before { + margin-right:5px; + } + } + + + + &[disabled]{ + color: mix($-color-white, #999, 60%); + &, + &[loading], + &:active { + color: mix($-color-white, #999, 60%); + background-color: mix($-color-white,$-color-black , 98%); + border-color: mix($-color-white, #999, 85%); + } + } + + &[plain] { + color: #999; + background: none; + border-color: $uni-border-1; + &:not([hover-class]):active { + background: none; + color: mix($-color-white, $-color-black, 80%); + border-color: mix($-color-white, $-color-black, 90%); + outline: none; + } + &[disabled]{ + &, + &[loading], + &:active { + background: none; + color: mix($-color-white, #999, 60%); + border-color: mix($-color-white, #999, 85%); + } + } + } + } + + &:not([hover-class]):active { + color: mix($-color-white, $-color-black, 50%); + } + + &[size=mini] { + font-size: 16px; + font-weight: 200; + border-radius: 8px; + } + + + + &.uni-btn-small { + font-size: 14px; + } + &.uni-btn-mini { + font-size: 12px; + } + + &.uni-btn-radius { + border-radius: 999px; + } + &[type=primary] { + @include is-color($uni-primary); + @include is-plain($uni-primary) + } + &[type=success] { + @include is-color($uni-success); + @include is-plain($uni-success) + } + &[type=error] { + @include is-color($uni-error); + @include is-plain($uni-error) + } + &[type=warning] { + @include is-color($uni-warning); + @include is-plain($uni-warning) + } + &[type=info] { + @include is-color($uni-info); + @include is-plain($uni-info) + } +} +/* #endif */ diff --git a/uni_modules/uni-scss/styles/setting/_text.scss b/uni_modules/uni-scss/styles/setting/_text.scss new file mode 100644 index 0000000..a34d08f --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_text.scss @@ -0,0 +1,24 @@ +@mixin get-styles($k,$c) { + @if $k == size or $k == weight{ + font-#{$k}:#{$c} + }@else{ + #{$k}:#{$c} + } +} + +@each $key, $child in $uni-headings { + /* #ifndef APP-NVUE */ + .uni-#{$key} { + @each $k, $c in $child { + @include get-styles($k,$c) + } + } + /* #endif */ + /* #ifdef APP-NVUE */ + .container .uni-#{$key} { + @each $k, $c in $child { + @include get-styles($k,$c) + } + } + /* #endif */ +} diff --git a/uni_modules/uni-scss/styles/setting/_variables.scss b/uni_modules/uni-scss/styles/setting/_variables.scss new file mode 100644 index 0000000..557d3d7 --- /dev/null +++ b/uni_modules/uni-scss/styles/setting/_variables.scss @@ -0,0 +1,146 @@ +// @use "sass:math"; +@import '../tools/functions.scss'; +// 间距基础倍数 +$uni-space-root: 2 !default; +// 边框半径默认值 +$uni-radius-root:5px !default; +$uni-radius: () !default; +// 边框半径断点 +$uni-radius: map-deep-merge( + ( + 0: 0, + // TODO 当前版本暂时不支持 sm 属性 + // 'sm': math.div($uni-radius-root, 2), + null: $uni-radius-root, + 'lg': $uni-radius-root * 2, + 'xl': $uni-radius-root * 6, + 'pill': 9999px, + 'circle': 50% + ), + $uni-radius +); +// 字体家族 +$body-font-family: 'Roboto', sans-serif !default; +// 文本 +$heading-font-family: $body-font-family !default; +$uni-headings: () !default; +$letterSpacing: -0.01562em; +$uni-headings: map-deep-merge( + ( + 'h1': ( + size: 32px, + weight: 300, + line-height: 50px, + // letter-spacing:-0.01562em + ), + 'h2': ( + size: 28px, + weight: 300, + line-height: 40px, + // letter-spacing: -0.00833em + ), + 'h3': ( + size: 24px, + weight: 400, + line-height: 32px, + // letter-spacing: normal + ), + 'h4': ( + size: 20px, + weight: 400, + line-height: 30px, + // letter-spacing: 0.00735em + ), + 'h5': ( + size: 16px, + weight: 400, + line-height: 24px, + // letter-spacing: normal + ), + 'h6': ( + size: 14px, + weight: 500, + line-height: 18px, + // letter-spacing: 0.0125em + ), + 'subtitle': ( + size: 12px, + weight: 400, + line-height: 20px, + // letter-spacing: 0.00937em + ), + 'body': ( + font-size: 14px, + font-weight: 400, + line-height: 22px, + // letter-spacing: 0.03125em + ), + 'caption': ( + 'size': 12px, + 'weight': 400, + 'line-height': 20px, + // 'letter-spacing': 0.03333em, + // 'text-transform': false + ) + ), + $uni-headings +); + + + +// 主色 +$uni-primary: #2979ff !default; +$uni-primary-disable:lighten($uni-primary,20%) !default; +$uni-primary-light: lighten($uni-primary,25%) !default; + +// 辅助色 +// 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。 +$uni-success: #18bc37 !default; +$uni-success-disable:lighten($uni-success,20%) !default; +$uni-success-light: lighten($uni-success,25%) !default; + +$uni-warning: #f3a73f !default; +$uni-warning-disable:lighten($uni-warning,20%) !default; +$uni-warning-light: lighten($uni-warning,25%) !default; + +$uni-error: #e43d33 !default; +$uni-error-disable:lighten($uni-error,20%) !default; +$uni-error-light: lighten($uni-error,25%) !default; + +$uni-info: #8f939c !default; +$uni-info-disable:lighten($uni-info,20%) !default; +$uni-info-light: lighten($uni-info,25%) !default; + +// 中性色 +// 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。 +$uni-main-color: #3a3a3a !default; // 主要文字 +$uni-base-color: #6a6a6a !default; // 常规文字 +$uni-secondary-color: #909399 !default; // 次要文字 +$uni-extra-color: #c7c7c7 !default; // 辅助说明 + +// 边框颜色 +$uni-border-1: #F0F0F0 !default; +$uni-border-2: #EDEDED !default; +$uni-border-3: #DCDCDC !default; +$uni-border-4: #B9B9B9 !default; + +// 常规色 +$uni-black: #000000 !default; +$uni-white: #ffffff !default; +$uni-transparent: rgba($color: #000000, $alpha: 0) !default; + +// 背景色 +$uni-bg-color: #f7f7f7 !default; + +/* 水平间距 */ +$uni-spacing-sm: 8px !default; +$uni-spacing-base: 15px !default; +$uni-spacing-lg: 30px !default; + +// 阴影 +$uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5) !default; +$uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2) !default; +$uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5) !default; + +// 蒙版 +$uni-mask: rgba($color: #000000, $alpha: 0.4) !default; diff --git a/uni_modules/uni-scss/styles/tools/functions.scss b/uni_modules/uni-scss/styles/tools/functions.scss new file mode 100644 index 0000000..ac6f63e --- /dev/null +++ b/uni_modules/uni-scss/styles/tools/functions.scss @@ -0,0 +1,19 @@ +// 合并 map +@function map-deep-merge($parent-map, $child-map){ + $result: $parent-map; + @each $key, $child in $child-map { + $parent-has-key: map-has-key($result, $key); + $parent-value: map-get($result, $key); + $parent-type: type-of($parent-value); + $child-type: type-of($child); + $parent-is-map: $parent-type == map; + $child-is-map: $child-type == map; + + @if (not $parent-has-key) or ($parent-type != $child-type) or (not ($parent-is-map and $child-is-map)){ + $result: map-merge($result, ( $key: $child )); + }@else { + $result: map-merge($result, ( $key: map-deep-merge($parent-value, $child) )); + } + } + @return $result; +}; diff --git a/uni_modules/uni-scss/theme.scss b/uni_modules/uni-scss/theme.scss new file mode 100644 index 0000000..80ee62f --- /dev/null +++ b/uni_modules/uni-scss/theme.scss @@ -0,0 +1,31 @@ +// 间距基础倍数 +$uni-space-root: 2; +// 边框半径默认值 +$uni-radius-root:5px; +// 主色 +$uni-primary: #2979ff; +// 辅助色 +$uni-success: #4cd964; +// 警告色 +$uni-warning: #f0ad4e; +// 错误色 +$uni-error: #dd524d; +// 描述色 +$uni-info: #909399; +// 中性色 +$uni-main-color: #303133; +$uni-base-color: #606266; +$uni-secondary-color: #909399; +$uni-extra-color: #C0C4CC; +// 背景色 +$uni-bg-color: #f5f5f5; +// 边框颜色 +$uni-border-1: #DCDFE6; +$uni-border-2: #E4E7ED; +$uni-border-3: #EBEEF5; +$uni-border-4: #F2F6FC; + +// 常规色 +$uni-black: #000000; +$uni-white: #ffffff; +$uni-transparent: rgba($color: #000000, $alpha: 0); diff --git a/uni_modules/uni-scss/variables.scss b/uni_modules/uni-scss/variables.scss new file mode 100644 index 0000000..1c062d4 --- /dev/null +++ b/uni_modules/uni-scss/variables.scss @@ -0,0 +1,62 @@ +@import './styles/setting/_variables.scss'; +// 间距基础倍数 +$uni-space-root: 2; +// 边框半径默认值 +$uni-radius-root:5px; + +// 主色 +$uni-primary: #2979ff; +$uni-primary-disable:mix(#fff,$uni-primary,50%); +$uni-primary-light: mix(#fff,$uni-primary,80%); + +// 辅助色 +// 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。 +$uni-success: #18bc37; +$uni-success-disable:mix(#fff,$uni-success,50%); +$uni-success-light: mix(#fff,$uni-success,80%); + +$uni-warning: #f3a73f; +$uni-warning-disable:mix(#fff,$uni-warning,50%); +$uni-warning-light: mix(#fff,$uni-warning,80%); + +$uni-error: #e43d33; +$uni-error-disable:mix(#fff,$uni-error,50%); +$uni-error-light: mix(#fff,$uni-error,80%); + +$uni-info: #8f939c; +$uni-info-disable:mix(#fff,$uni-info,50%); +$uni-info-light: mix(#fff,$uni-info,80%); + +// 中性色 +// 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。 +$uni-main-color: #3a3a3a; // 主要文字 +$uni-base-color: #6a6a6a; // 常规文字 +$uni-secondary-color: #909399; // 次要文字 +$uni-extra-color: #c7c7c7; // 辅助说明 + +// 边框颜色 +$uni-border-1: #F0F0F0; +$uni-border-2: #EDEDED; +$uni-border-3: #DCDCDC; +$uni-border-4: #B9B9B9; + +// 常规色 +$uni-black: #000000; +$uni-white: #ffffff; +$uni-transparent: rgba($color: #000000, $alpha: 0); + +// 背景色 +$uni-bg-color: #f7f7f7; + +/* 水平间距 */ +$uni-spacing-sm: 8px; +$uni-spacing-base: 15px; +$uni-spacing-lg: 30px; + +// 阴影 +$uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5); +$uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2); +$uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5); + +// 蒙版 +$uni-mask: rgba($color: #000000, $alpha: 0.4); diff --git a/uni_modules/uni-search-bar/changelog.md b/uni_modules/uni-search-bar/changelog.md new file mode 100644 index 0000000..2c6571c --- /dev/null +++ b/uni_modules/uni-search-bar/changelog.md @@ -0,0 +1,47 @@ +## 1.3.0(2024-04-22) +- 修复 textColor默认值导致的文字不显示的bug +## 1.2.9(2024-04-17) +- 修复 textColor不生效的bug +## 1.2.8(2024-02-22) +- 修复 清空按钮emit值错误的bug +## 1.2.7(2024-02-21) +- 新增 设置输入框字体颜色:textColor +## 1.2.6(2024-02-20) +- 修复 uni-search-bar在支付宝小程序下样式兼容问题 +## 1.2.5(2024-01-31) +- 修复 uni-search-bar居中问题,现在默认居左,并修复样式偏移问题 +## 1.2.4(2023-05-09) +- 修复 i18n 国际化不正确的 Bug +## 1.2.3(2022-05-24) +- 新增 readonly 属性,组件只读 +## 1.2.2(2022-05-06) +- 修复 vue3 input 事件不生效的bug +## 1.2.1(2022-05-06) +- 修复 多余代码导致的bug +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-search-bar](https://uniapp.dcloud.io/component/uniui/uni-search-bar) +## 1.1.2(2021-08-30) +- 修复 value 属性与 modelValue 属性不兼容的Bug +## 1.1.1(2021-08-24) +- 新增 支持国际化 +## 1.1.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.9(2021-05-12) +- 新增 项目示例地址 +## 1.0.8(2021-04-21) +- 优化 添加依赖 uni-icons, 导入后自动下载依赖 +## 1.0.7(2021-04-15) +- uni-ui 新增 uni-search-bar 的 focus 事件 + +## 1.0.6(2021-02-05) +- 优化 组件引用关系,通过uni_modules引用组件 + +## 1.0.5(2021-02-05) +- 调整为uni_modules目录规范 +- 新增 支持双向绑定 +- 更改 input 事件的返回值,e={value:Number} --> e=value +- 新增 支持图标插槽 +- 新增 支持 clear、blur 事件 +- 新增 支持 focus 属性 +- 去掉组件背景色 diff --git a/uni_modules/uni-search-bar/components/uni-search-bar/i18n/en.json b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/en.json new file mode 100644 index 0000000..dd083a5 --- /dev/null +++ b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/en.json @@ -0,0 +1,4 @@ +{ + "uni-search-bar.cancel": "cancel", + "uni-search-bar.placeholder": "Search enter content" +} \ No newline at end of file diff --git a/uni_modules/uni-search-bar/components/uni-search-bar/i18n/index.js b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/index.js new file mode 100644 index 0000000..de7509c --- /dev/null +++ b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/index.js @@ -0,0 +1,8 @@ +import en from './en.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hans.json b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hans.json new file mode 100644 index 0000000..d2a1ced --- /dev/null +++ b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hans.json @@ -0,0 +1,4 @@ +{ + "uni-search-bar.cancel": "取消", + "uni-search-bar.placeholder": "请输入搜索内容" +} diff --git a/uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hant.json b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hant.json new file mode 100644 index 0000000..f1c96bc --- /dev/null +++ b/uni_modules/uni-search-bar/components/uni-search-bar/i18n/zh-Hant.json @@ -0,0 +1,4 @@ +{ + "uni-search-bar.cancel": "取消", + "uni-search-bar.placeholder": "請輸入搜索內容" +} diff --git a/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue b/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue new file mode 100644 index 0000000..2aab39a --- /dev/null +++ b/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue @@ -0,0 +1,310 @@ + + + + + diff --git a/uni_modules/uni-search-bar/package.json b/uni_modules/uni-search-bar/package.json new file mode 100644 index 0000000..1730d9d --- /dev/null +++ b/uni_modules/uni-search-bar/package.json @@ -0,0 +1,87 @@ +{ + "id": "uni-search-bar", + "displayName": "uni-search-bar 搜索栏", + "version": "1.3.0", + "description": "搜索栏组件,通常用于搜索商品、文章等", + "keywords": [ + "uni-ui", + "uniui", + "搜索框", + "搜索栏" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, +"dcloudext": { + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui", + "type": "component-vue" + }, + "uni_modules": { + "dependencies": [ + "uni-scss", + "uni-icons" + ], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y", + "alipay": "n" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "y", + "QQ": "y" + }, + "快应用": { + "华为": "u", + "联盟": "u" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-search-bar/readme.md b/uni_modules/uni-search-bar/readme.md new file mode 100644 index 0000000..253092f --- /dev/null +++ b/uni_modules/uni-search-bar/readme.md @@ -0,0 +1,14 @@ + + +## SearchBar 搜索栏 + +> **组件名:uni-search-bar** +> 代码块: `uSearchBar` + + +搜索栏组件 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-search-bar) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + diff --git a/uni_modules/uni-table/changelog.md b/uni_modules/uni-table/changelog.md new file mode 100644 index 0000000..8233b20 --- /dev/null +++ b/uni_modules/uni-table/changelog.md @@ -0,0 +1,23 @@ +## 1.2.1(2022-06-06) +- 修复 微信小程序存在无使用组件的问题 +## 1.2.0(2021-11-19) +- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) +- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-table](https://uniapp.dcloud.io/component/uniui/uni-table) +## 1.1.0(2021-07-30) +- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) +## 1.0.7(2021-07-08) +- 新增 uni-th 支持 date 日期筛选范围 +## 1.0.6(2021-07-05) +- 新增 uni-th 支持 range 筛选范围 +## 1.0.5(2021-06-28) +- 新增 uni-th 筛选功能 +## 1.0.4(2021-05-12) +- 新增 示例地址 +- 修复 示例项目缺少组件的Bug +## 1.0.3(2021-04-16) +- 新增 sortable 属性,是否开启单列排序 +- 优化 表格多选逻辑 +## 1.0.2(2021-03-22) +- uni-tr 添加 disabled 属性,用于 type=selection 时,设置某行是否可由全选按钮控制 +## 1.0.1(2021-02-05) +- 调整为uni_modules目录规范 diff --git a/uni_modules/uni-table/components/uni-table/uni-table.vue b/uni_modules/uni-table/components/uni-table/uni-table.vue new file mode 100644 index 0000000..91b74fa --- /dev/null +++ b/uni_modules/uni-table/components/uni-table/uni-table.vue @@ -0,0 +1,455 @@ + + + + + diff --git a/uni_modules/uni-table/components/uni-tbody/uni-tbody.vue b/uni_modules/uni-table/components/uni-tbody/uni-tbody.vue new file mode 100644 index 0000000..fbe1bdc --- /dev/null +++ b/uni_modules/uni-table/components/uni-tbody/uni-tbody.vue @@ -0,0 +1,29 @@ + + + + + diff --git a/uni_modules/uni-table/components/uni-td/uni-td.vue b/uni_modules/uni-table/components/uni-td/uni-td.vue new file mode 100644 index 0000000..9ce93e9 --- /dev/null +++ b/uni_modules/uni-table/components/uni-td/uni-td.vue @@ -0,0 +1,90 @@ + + + + + diff --git a/uni_modules/uni-table/components/uni-th/filter-dropdown.vue b/uni_modules/uni-table/components/uni-th/filter-dropdown.vue new file mode 100644 index 0000000..bc9a0e3 --- /dev/null +++ b/uni_modules/uni-table/components/uni-th/filter-dropdown.vue @@ -0,0 +1,503 @@ + + + + + diff --git a/uni_modules/uni-table/components/uni-th/uni-th.vue b/uni_modules/uni-table/components/uni-th/uni-th.vue new file mode 100644 index 0000000..883e3f2 --- /dev/null +++ b/uni_modules/uni-table/components/uni-th/uni-th.vue @@ -0,0 +1,278 @@ + + + + + diff --git a/uni_modules/uni-table/components/uni-thead/uni-thead.vue b/uni_modules/uni-table/components/uni-thead/uni-thead.vue new file mode 100644 index 0000000..0dd18cd --- /dev/null +++ b/uni_modules/uni-table/components/uni-thead/uni-thead.vue @@ -0,0 +1,129 @@ + + + + + diff --git a/uni_modules/uni-table/components/uni-tr/table-checkbox.vue b/uni_modules/uni-table/components/uni-tr/table-checkbox.vue new file mode 100644 index 0000000..158f3ff --- /dev/null +++ b/uni_modules/uni-table/components/uni-tr/table-checkbox.vue @@ -0,0 +1,179 @@ + + + + + diff --git a/uni_modules/uni-table/components/uni-tr/uni-tr.vue b/uni_modules/uni-table/components/uni-tr/uni-tr.vue new file mode 100644 index 0000000..f9b9671 --- /dev/null +++ b/uni_modules/uni-table/components/uni-tr/uni-tr.vue @@ -0,0 +1,171 @@ + + + + + diff --git a/uni_modules/uni-table/i18n/en.json b/uni_modules/uni-table/i18n/en.json new file mode 100644 index 0000000..e32023c --- /dev/null +++ b/uni_modules/uni-table/i18n/en.json @@ -0,0 +1,9 @@ +{ + "filter-dropdown.reset": "Reset", + "filter-dropdown.search": "Search", + "filter-dropdown.submit": "Submit", + "filter-dropdown.filter": "Filter", + "filter-dropdown.gt": "Greater or equal to", + "filter-dropdown.lt": "Less than or equal to", + "filter-dropdown.date": "Date" +} diff --git a/uni_modules/uni-table/i18n/es.json b/uni_modules/uni-table/i18n/es.json new file mode 100644 index 0000000..9afd04b --- /dev/null +++ b/uni_modules/uni-table/i18n/es.json @@ -0,0 +1,9 @@ +{ + "filter-dropdown.reset": "Reiniciar", + "filter-dropdown.search": "Búsqueda", + "filter-dropdown.submit": "Entregar", + "filter-dropdown.filter": "Filtrar", + "filter-dropdown.gt": "Mayor o igual a", + "filter-dropdown.lt": "Menos que o igual a", + "filter-dropdown.date": "Fecha" +} diff --git a/uni_modules/uni-table/i18n/fr.json b/uni_modules/uni-table/i18n/fr.json new file mode 100644 index 0000000..b006237 --- /dev/null +++ b/uni_modules/uni-table/i18n/fr.json @@ -0,0 +1,9 @@ +{ + "filter-dropdown.reset": "Réinitialiser", + "filter-dropdown.search": "Chercher", + "filter-dropdown.submit": "Soumettre", + "filter-dropdown.filter": "Filtre", + "filter-dropdown.gt": "Supérieur ou égal à", + "filter-dropdown.lt": "Inférieur ou égal à", + "filter-dropdown.date": "Date" +} diff --git a/uni_modules/uni-table/i18n/index.js b/uni_modules/uni-table/i18n/index.js new file mode 100644 index 0000000..2469dd0 --- /dev/null +++ b/uni_modules/uni-table/i18n/index.js @@ -0,0 +1,12 @@ +import en from './en.json' +import es from './es.json' +import fr from './fr.json' +import zhHans from './zh-Hans.json' +import zhHant from './zh-Hant.json' +export default { + en, + es, + fr, + 'zh-Hans': zhHans, + 'zh-Hant': zhHant +} diff --git a/uni_modules/uni-table/i18n/zh-Hans.json b/uni_modules/uni-table/i18n/zh-Hans.json new file mode 100644 index 0000000..862af17 --- /dev/null +++ b/uni_modules/uni-table/i18n/zh-Hans.json @@ -0,0 +1,9 @@ +{ + "filter-dropdown.reset": "重置", + "filter-dropdown.search": "搜索", + "filter-dropdown.submit": "确定", + "filter-dropdown.filter": "筛选", + "filter-dropdown.gt": "大于等于", + "filter-dropdown.lt": "小于等于", + "filter-dropdown.date": "日期范围" +} diff --git a/uni_modules/uni-table/i18n/zh-Hant.json b/uni_modules/uni-table/i18n/zh-Hant.json new file mode 100644 index 0000000..64f8061 --- /dev/null +++ b/uni_modules/uni-table/i18n/zh-Hant.json @@ -0,0 +1,9 @@ +{ + "filter-dropdown.reset": "重置", + "filter-dropdown.search": "搜索", + "filter-dropdown.submit": "確定", + "filter-dropdown.filter": "篩選", + "filter-dropdown.gt": "大於等於", + "filter-dropdown.lt": "小於等於", + "filter-dropdown.date": "日期範圍" +} diff --git a/uni_modules/uni-table/package.json b/uni_modules/uni-table/package.json new file mode 100644 index 0000000..f224ab7 --- /dev/null +++ b/uni_modules/uni-table/package.json @@ -0,0 +1,86 @@ +{ + "id": "uni-table", + "displayName": "uni-table 表格", + "version": "1.2.1", + "description": "表格组件,多用于展示多条结构类似的数据,如", + "keywords": [ + "uni-ui", + "uniui", + "table", + "表格" +], + "repository": "https://github.com/dcloudio/uni-ui", + "engines": { + "HBuilderX": "" + }, + "directories": { + "example": "../../temps/example_temps" + }, + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ], + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" + }, + "uni_modules": { + "dependencies": ["uni-scss","uni-datetime-picker"], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y" + }, + "client": { + "App": { + "app-vue": "y", + "app-nvue": "n" + }, + "H5-mobile": { + "Safari": "y", + "Android Browser": "y", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "y" + }, + "H5-pc": { + "Chrome": "y", + "IE": "y", + "Edge": "y", + "Firefox": "y", + "Safari": "y" + }, + "小程序": { + "微信": "y", + "阿里": "y", + "百度": "y", + "字节跳动": "n", + "QQ": "y" + }, + "快应用": { + "华为": "n", + "联盟": "n" + }, + "Vue": { + "vue2": "y", + "vue3": "y" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-table/readme.md b/uni_modules/uni-table/readme.md new file mode 100644 index 0000000..bb08c79 --- /dev/null +++ b/uni_modules/uni-table/readme.md @@ -0,0 +1,13 @@ + + +## Table 表单 +> 组件名:``uni-table``,代码块: `uTable`。 + +用于展示多条结构类似的数据 + +### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-table) +#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 + + + + diff --git a/uni_modules/uview-ui/LICENSE b/uni_modules/uview-ui/LICENSE new file mode 100644 index 0000000..4db40ef --- /dev/null +++ b/uni_modules/uview-ui/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 www.uviewui.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/uni_modules/uview-ui/README.md b/uni_modules/uview-ui/README.md new file mode 100644 index 0000000..c78ff47 --- /dev/null +++ b/uni_modules/uview-ui/README.md @@ -0,0 +1,66 @@ +

+ logo +

+

uView 2.0

+

多平台快速开发的UI框架

+ +[![stars](https://img.shields.io/github/stars/umicro/uView2.0?style=flat-square&logo=GitHub)](https://github.com/umicro/uView2.0) +[![forks](https://img.shields.io/github/forks/umicro/uView2.0?style=flat-square&logo=GitHub)](https://github.com/umicro/uView2.0) +[![issues](https://img.shields.io/github/issues/umicro/uView2.0?style=flat-square&logo=GitHub)](https://github.com/umicro/uView2.0/issues) +[![Website](https://img.shields.io/badge/uView-up-blue?style=flat-square)](https://uviewui.com) +[![release](https://img.shields.io/github/v/release/umicro/uView2.0?style=flat-square)](https://gitee.com/umicro/uView2.0/releases) +[![license](https://img.shields.io/github/license/umicro/uView2.0?style=flat-square)](https://en.wikipedia.org/wiki/MIT_License) + +## 说明 + +uView UI,是[uni-app](https://uniapp.dcloud.io/)全面兼容nvue的uni-app生态框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水 + +## [官方文档:https://uviewui.com](https://uviewui.com) + + +## 预览 + +您可以通过**微信**扫码,查看最佳的演示效果。 +
+
+ + + +## 链接 + +- [官方文档](https://www.uviewui.com/) +- [更新日志](https://www.uviewui.com/components/changelog.html) +- [升级指南](https://www.uviewui.com/components/changeGuide.html) +- [关于我们](https://www.uviewui.com/cooperation/about.html) + +## 交流反馈 + +欢迎加入我们的QQ群交流反馈:[点此跳转](https://www.uviewui.com/components/addQQGroup.html) + +## 关于PR + +> 我们非常乐意接受各位的优质PR,但在此之前我希望您了解uView2.0是一个需要兼容多个平台的(小程序、h5、ios app、android app)包括nvue页面、vue页面。 +> 所以希望在您修复bug并提交之前尽可能的去这些平台测试一下兼容性。最好能携带测试截图以方便审核。非常感谢! + +## 安装 + +#### **uni-app插件市场链接** —— [https://ext.dcloud.net.cn/plugin?id=1593](https://ext.dcloud.net.cn/plugin?id=1593) + +请通过[官网安装文档](https://www.uviewui.com/components/install.html)了解更详细的内容 + +## 快速上手 + +请通过[快速上手](https://uviewui.com/components/quickstart.html)了解更详细的内容 + +## 使用方法 +配置easycom规则后,自动按需引入,无需`import`组件,直接引用即可。 + +```html + +``` + +## 版权信息 +uView遵循[MIT](https://en.wikipedia.org/wiki/MIT_License)开源协议,意味着您无需支付任何费用,也无需授权,即可将uView应用到您的产品中。 + diff --git a/uni_modules/uview-ui/changelog.md b/uni_modules/uview-ui/changelog.md new file mode 100644 index 0000000..16fb337 --- /dev/null +++ b/uni_modules/uview-ui/changelog.md @@ -0,0 +1,374 @@ +## 2.0.37(2024-03-17) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复表单校验`trigger`触发器参数无效问题 +2. 修复`u-input`组件的`password`属性在动态切换为`false`时失效的问题 +3. 添加微信小程序用户同意隐私协议事件回调 +4. 修复支付宝小程序picker样式问题 +5. `u-modal`添加`duration`字段控制动画过度时间 +6. 修复`picker` `lastIndex`异常导致的`column`异常问题 +7. `tabs`增加长按事件支持 +8. 修复`u-avatar` `square`属性在小程序`open-data`下无效问题 +9. 其他一些修复 +## 2.0.36(2023-03-27) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 重构`deepClone` & `deepMerge`方法 +2. 其他优化 +## 2.0.34(2022-09-24) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. `u-input`、`u-textarea`增加`ignoreCompositionEvent`属性 +2. 修复`route`方法调用可能报错的问题 +3. 修复`u-no-network`组件`z-index`无效的问题 +4. 修复`textarea`组件在h5上confirmType=""报错的问题 +5. `u-rate`适配`nvue` +6. 优化验证手机号码的正则表达式(根据工信部发布的《电信网编号计划(2017年版)》进行修改。) +7. `form-item`添加`labelPosition`属性 +8. `u-calendar`修复`maxDate`设置为当前日期,并且当前时间大于08:00时无法显示日期列表的问题 (#724) +9. `u-radio`增加一个默认插槽用于自定义修改label内容 (#680) +10. 修复`timeFormat`函数在safari重的兼容性问题 (#664) +## 2.0.33(2022-06-17) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复`loadmore`组件`lineColor`类型错误问题 +2. 修复`u-parse`组件`imgtap`、`linktap`不生效问题 +## 2.0.32(2022-06-16) +# uView2.0重磅发布,利剑出鞘,一统江湖 +1. `u-loadmore`新增自定义颜色、虚/实线 +2. 修复`u-swiper-action`组件部分平台不能上下滑动的问题 +3. 修复`u-list`回弹问题 +4. 修复`notice-bar`组件动画在低端安卓机可能会抖动的问题 +5. `u-loading-page`添加控制图标大小的属性`iconSize` +6. 修复`u-tooltip`组件`color`参数不生效的问题 +7. 修复`u--input`组件使用`blur`事件输出为`undefined`的bug +8. `u-code-input`组件新增键盘弹起时,是否自动上推页面参数`adjustPosition` +9. 修复`image`组件`load`事件无回调对象问题 +10. 修复`button`组件`loadingSize`设置无效问题 +10. 其他修复 +## 2.0.31(2022-04-19) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复`upload`在`vue`页面上传成功后没有成功标志的问题 +2. 解决演示项目中微信小程序模拟上传图片一直出于上传中问题 +3. 修复`u-code-input`组件在`nvue`页面编译到`app`平台上光标异常问题(`app`去除此功能) +4. 修复`actionSheet`组件标题关闭按钮点击事件名称错误的问题 +5. 其他修复 +## 2.0.30(2022-04-04) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. `u-rate`增加`readonly`属性 +2. `tabs`滑块支持设置背景图片 +3. 修复`u-subsection` `mode`为`subsection`时,滑块样式不正确的问题 +4. `u-code-input`添加光标效果动画 +5. 修复`popup`的`open`事件不触发 +6. 修复`u-flex-column`无效的问题 +7. 修复`u-datetime-picker`索引在特定场合异常问题 +8. 修复`u-datetime-picker`最小时间字符串模板错误问题 +9. `u-swiper`添加`m3u8`验证 +10. `u-swiper`修改判断image和video逻辑 +11. 修复`swiper`无法使用本地图片问题,增加`type`参数 +12. 修复`u-row-notice`格式错误问题 +13. 修复`u-switch`组件当`unit`为`rpx`时,`nodeStyle`消失的问题 +14. 修复`datetime-picker`组件`showToolbar`与`visibleItemCount`属性无效的问题 +15. 修复`upload`组件条件编译位置判断错误,导致`previewImage`属性设置为`false`时,整个组件都会被隐藏的问题 +16. 修复`u-checkbox-group`设置`shape`属性无效的问题 +17. 修复`u-upload`的`capture`传入字符串的时候不生效的问题 +18. 修复`u-action-sheet`组件,关闭事件逻辑错误的问题 +19. 修复`u-list`触顶事件的触发错误的问题 +20. 修复`u-text`只有手机号可拨打的问题 +21. 修复`u-textarea`不能换行的问题 +22. 其他修复 +## 2.0.29(2022-03-13) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复`u--text`组件设置`decoration`属性未生效的问题 +2. 修复`u-datetime-picker`使用`formatter`后返回值不正确 +3. 修复`u-datetime-picker` `intercept` 可能为undefined +4. 修复已设置单位 uni..config.unit = 'rpx'时,线型指示器 `transform` 的位置翻倍,导致指示器超出宽度 +5. 修复mixin中bem方法生成的类名在支付宝和字节小程序中失效 +6. 修复默认值传值为空的时候,打开`u-datetime-picker`报错,不能选中第一列时间的bug +7. 修复`u-datetime-picker`使用`formatter`后返回值不正确 +8. 修复`u-image`组件`loading`无效果的问题 +9. 修复`config.unit`属性设为`rpx`时,导航栏占用高度不足导致塌陷的问题 +10. 修复`u-datetime-picker`组件`itemHeight`无效问题 +11. 其他修复 +## 2.0.28(2022-02-22) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. search组件新增searchIconSize属性 +2. 兼容Safari/Webkit中传入时间格式如2022-02-17 12:00:56 +3. 修复text value.js 判断日期出format错误问题 +4. priceFormat格式化金额出现精度错误 +5. priceFormat在部分情况下出现精度损失问题 +6. 优化表单rules提示 +7. 修复avatar组件src为空时,展示状态不对 +8. 其他修复 +## 2.0.27(2022-01-28) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1.样式修复 +## 2.0.26(2022-01-28) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1.样式修复 +## 2.0.25(2022-01-27) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复text组件mode=price时,可能会导致精度错误的问题 +2. 添加$u.setConfig()方法,可设置uView内置的config, props, zIndex, color属性,详见:[修改uView内置配置方案](https://uviewui.com/components/setting.html#%E9%BB%98%E8%AE%A4%E5%8D%95%E4%BD%8D%E9%85%8D%E7%BD%AE) +3. 优化form组件在errorType=toast时,如果输入错误页面会有抖动的问题 +4. 修复$u.addUnit()对配置默认单位可能无效的问题 +## 2.0.24(2022-01-25) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复swiper在current指定非0时缩放有误 +2. 修复u-icon添加stop属性的时候报错 +3. 优化遗留的通过正则判断rpx单位的问题 +4. 优化Layout布局 vue使用gutter时,会超出固定区域 +5. 优化search组件高度单位问题(rpx -> px) +6. 修复u-image slot 加载和错误的图片失去了高度 +7. 修复u-index-list中footer插槽与header插槽存在性判断错误 +8. 修复部分机型下u-popup关闭时会闪烁 +9. 修复u-image在nvue-app下失去宽高 +10. 修复u-popup运行报错 +11. 修复u-tooltip报错 +12. 修复box-sizing在app下的警告 +13. 修复u-navbar在小程序中报运行时错误 +14. 其他修复 +## 2.0.23(2022-01-24) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复image组件在hx3.3.9的nvue下可能会显示异常的问题 +2. 修复col组件gutter参数带rpx单位处理不正确的问题 +3. 修复text组件单行时无法显示省略号的问题 +4. navbar添加titleStyle参数 +5. 升级到hx3.3.9可消除nvue下控制台样式警告的问题 +## 2.0.22(2022-01-19) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. $u.page()方法优化,避免在特殊场景可能报错的问题 +2. picker组件添加immediateChange参数 +3. 新增$u.pages()方法 +## 2.0.21(2022-01-19) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 优化:form组件在用户设置rules的时候提示用户model必传 +2. 优化遗留的通过正则判断rpx单位的问题 +3. 修复微信小程序环境中tabbar组件开启safeAreaInsetBottom属性后,placeholder高度填充不正确 +4. 修复swiper在current指定非0时缩放有误 +5. 修复u-icon添加stop属性的时候报错 +6. 修复upload组件在accept=all的时候没有作用 +7. 修复在text组件mode为phone时call属性无效的问题 +8. 处理u-form clearValidate方法 +9. 其他修复 +## 2.0.20(2022-01-14) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复calendar默认会选择一个日期,如果直接点确定的话,无法取到值的问题 +2. 修复Slider缺少disabled props 还有注释 +3. 修复u-notice-bar点击事件无法拿到index索引值的问题 +4. 修复u-collapse-item在vue文件下,app端自定义插槽不生效的问题 +5. 优化头像为空时显示默认头像 +6. 修复图片地址赋值后判断加载状态为完成问题 +7. 修复日历滚动到默认日期月份区域 +8. search组件暴露点击左边icon事件 +9. 修复u-form clearValidate方法不生效 +10. upload h5端增加返回文件参数(文件的name参数) +11. 处理upload选择文件后url为blob类型无法预览的问题 +12. u-code-input 修复输入框没有往左移出一半屏幕 +13. 修复Upload上传 disabled为true时,控制台报hoverClass类型错误 +14. 临时处理ios app下grid点击坍塌问题 +15. 其他修复 +## 2.0.19(2021-12-29) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 优化微信小程序包体积可在微信中预览,请升级HbuilderX3.3.4,同时在“运行->运行到小程序模拟器”中勾选“运行时是否压缩代码” +2. 优化微信小程序setData性能,处理某些方法如$u.route()无法在模板中使用的问题 +3. navbar添加autoBack参数 +4. 允许avatar组件的事件冒泡 +5. 修复cell组件报错问题 +6. 其他修复 +## 2.0.18(2021-12-28) +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复app端编译报错问题 +2. 重新处理微信小程序端setData过大的性能问题 +3. 修复边框问题 +4. 修复最大最小月份不大于0则没有数据出现的问题 +5. 修复SwipeAction微信小程序端无法上下滑动问题 +6. 修复input的placeholder在小程序端默认显示为true问题 +7. 修复divider组件click事件无效问题 +8. 修复u-code-input maxlength 属性值为 String 类型时显示异常 +9. 修复当 grid只有 1到2时 在小程序端algin设置无效的问题 +10. 处理form-item的label为top时,取消错误提示的左边距 +11. 其他修复 +## 2.0.17(2021-12-26) +## uView正在参与开源中国的“年度最佳项目”评选,之前投过票的现在也可以投票,恳请同学们投一票,[点此帮助uView](https://www.oschina.net/project/top_cn_2021/?id=583) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 解决HBuilderX3.3.3.20211225版本导致的样式问题 +2. calendar日历添加monthNum参数 +3. navbar添加center slot +## 2.0.16(2021-12-25) +## uView正在参与开源中国的“年度最佳项目”评选,之前投过票的现在也可以投票,恳请同学们投一票,[点此帮助uView](https://www.oschina.net/project/top_cn_2021/?id=583) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 解决微信小程序setData性能问题 +2. 修复count-down组件change事件不触发问题 +## 2.0.15(2021-12-21) +## uView正在参与开源中国的“年度最佳项目”评选,之前投过票的现在也可以投票,恳请同学们投一票,[点此帮助uView](https://www.oschina.net/project/top_cn_2021/?id=583) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复Cell单元格titleWidth无效 +2. 修复cheakbox组件ischecked不更新 +3. 修复keyboard是否显示"."按键默认值问题 +4. 修复number-keyboard是否显示键盘的"."符号问题 +5. 修复Input输入框 readonly无效 +6. 修复u-avatar 导致打包app、H5时候报错问题 +7. 修复Upload上传deletable无效 +8. 修复upload当设置maxSize时无效的问题 +9. 修复tabs lineWidth传入带单位的字符串的时候偏移量计算错误问题 +10. 修复rate组件在有padding的view内,显示的星星位置和可触摸区域不匹配,无法正常选中星星 +## 2.0.13(2021-12-14) +## [点击加群交流反馈:364463526](https://jq.qq.com/?_chanwv=1027&k=mCxS3TGY) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复配置默认单位为rpx可能会导致自定义导航栏高度异常的问题 +## 2.0.12(2021-12-14) +## [点击加群交流反馈:364463526](https://jq.qq.com/?_chanwv=1027&k=mCxS3TGY) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复tabs组件在vue环境下划线消失的问题 +2. 修复upload组件在安卓小程序无法选择视频的问题 +3. 添加uni.$u.config.unit配置,用于配置参数默认单位,详见:[默认单位配置](https://www.uviewui.com/components/setting.html#%E9%BB%98%E8%AE%A4%E5%8D%95%E4%BD%8D%E9%85%8D%E7%BD%AE) +4. 修复textarea组件在没绑定v-model时,字符统计不生效问题 +5. 修复nvue下控制是否出现滚动条失效问题 +## 2.0.11(2021-12-13) +## [点击加群交流反馈:364463526](https://jq.qq.com/?_chanwv=1027&k=mCxS3TGY) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. text组件align参数无效的问题 +2. subsection组件添加keyName参数 +3. upload组件无法判断[Object file]类型的问题 +4. 处理notify层级过低问题 +5. codeInput组件添加disabledDot参数 +6. 处理actionSheet组件round参数无效的问题 +7. calendar组件添加round参数用于控制圆角值 +8. 处理swipeAction组件在vue环境下默认被打开的问题 +9. button组件的throttleTime节流参数无效的问题 +10. 解决u-notify手动关闭方法close()无效的问题 +11. input组件readonly不生效问题 +12. tag组件type参数为info不生效问题 +## 2.0.10(2021-12-08) +## [点击加群交流反馈:364463526](https://jq.qq.com/?_chanwv=1027&k=mCxS3TGY) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复button sendMessagePath属性不生效 +2. 修复DatetimePicker选择器title无效 +3. 修复u-toast设置loading=true不生效 +4. 修复u-text金额模式传0报错 +5. 修复u-toast组件的icon属性配置不生效 +6. button的icon在特殊场景下的颜色优化 +7. IndexList优化,增加# +## 2.0.9(2021-12-01) +## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 优化swiper的height支持100%值(仅vue有效),修复嵌入视频时click事件无法触发的问题 +2. 优化tabs组件对list值为空的判断,或者动态变化list时重新计算相关尺寸的问题 +3. 优化datetime-picker组件逻辑,让其后续打开的默认值为上一次的选中值,需要通过v-model绑定值才有效 +4. 修复upload内嵌在其他组件中,选择图片可能不会换行的问题 +## 2.0.8(2021-12-01) +## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复toast的position参数无效问题 +2. 处理input在ios nvue上无法获得焦点的问题 +3. avatar-group组件添加extraValue参数,让剩余展示数量可手动控制 +4. tabs组件添加keyName参数用于配置从对象中读取的键名 +5. 处理text组件名字脱敏默认配置无效的问题 +6. 处理picker组件item文本太长换行问题 +## 2.0.7(2021-11-30) +## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 修复radio和checkbox动态改变v-model无效的问题。 +2. 优化form规则validator在微信小程序用法 +3. 修复backtop组件mode参数在微信小程序无效的问题 +4. 处理Album的previewFullImage属性无效的问题 +5. 处理u-datetime-picker组件mode='time'在选择改变时间时,控制台报错的问题 +## 2.0.6(2021-11-27) +## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. 处理tag组件在vue下边框无效的问题。 +2. 处理popup组件圆角参数可能无效的问题。 +3. 处理tabs组件lineColor参数可能无效的问题。 +4. propgress组件在值很小时,显示异常的问题。 +## 2.0.5(2021-11-25) +## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. calendar在vue下显示异常问题。 +2. form组件labelPosition和errorType参数无效的问题 +3. input组件inputAlign无效的问题 +4. 其他一些修复 +## 2.0.4(2021-11-23) +## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +0. input组件缺失@confirm事件,以及subfix和prefix无效问题 +1. component.scss文件样式在vue下干扰全局布局问题 +2. 修复subsection在vue环境下表现异常的问题 +3. tag组件的bgColor等参数无效的问题 +4. upload组件不换行的问题 +5. 其他的一些修复处理 +## 2.0.3(2021-11-16) +## [点击加群交流反馈:1129077272](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. uView2.0已实现全面兼容nvue +2. uView2.0对1.x进行了架构重构,细节和性能都有极大提升 +3. 目前uView2.0为公测阶段,相关细节可能会有变动 +4. 我们写了一份与1.x的对比指南,详见[对比1.x](https://www.uviewui.com/components/diff1.x.html) +5. 处理modal的confirm回调事件拼写错误问题 +6. 处理input组件@input事件参数错误问题 +7. 其他一些修复 +## 2.0.2(2021-11-16) +## [点击加群交流反馈:1129077272](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. uView2.0已实现全面兼容nvue +2. uView2.0对1.x进行了架构重构,细节和性能都有极大提升 +3. 目前uView2.0为公测阶段,相关细节可能会有变动 +4. 我们写了一份与1.x的对比指南,详见[对比1.x](https://www.uviewui.com/components/diff1.x.html) +5. 修复input组件formatter参数缺失问题 +6. 优化loading-icon组件的scss写法问题,防止不兼容新版本scss +## 2.0.0(2020-11-15) +## [点击加群交流反馈:1129077272](https://jq.qq.com/?_wv=1027&k=KnbeceDU) + +# uView2.0重磅发布,利剑出鞘,一统江湖 + +1. uView2.0已实现全面兼容nvue +2. uView2.0对1.x进行了架构重构,细节和性能都有极大提升 +3. 目前uView2.0为公测阶段,相关细节可能会有变动 +4. 我们写了一份与1.x的对比指南,详见[对比1.x](https://www.uviewui.com/components/diff1.x.html) +5. 修复input组件formatter参数缺失问题 + + diff --git a/uni_modules/uview-ui/components/u--form/u--form.vue b/uni_modules/uview-ui/components/u--form/u--form.vue new file mode 100644 index 0000000..d534ece --- /dev/null +++ b/uni_modules/uview-ui/components/u--form/u--form.vue @@ -0,0 +1,78 @@ + + + diff --git a/uni_modules/uview-ui/components/u--image/u--image.vue b/uni_modules/uview-ui/components/u--image/u--image.vue new file mode 100644 index 0000000..21b7ab1 --- /dev/null +++ b/uni_modules/uview-ui/components/u--image/u--image.vue @@ -0,0 +1,47 @@ + + + \ No newline at end of file diff --git a/uni_modules/uview-ui/components/u--input/u--input.vue b/uni_modules/uview-ui/components/u--input/u--input.vue new file mode 100644 index 0000000..1e58b01 --- /dev/null +++ b/uni_modules/uview-ui/components/u--input/u--input.vue @@ -0,0 +1,73 @@ + + + \ No newline at end of file diff --git a/uni_modules/uview-ui/components/u--text/u--text.vue b/uni_modules/uview-ui/components/u--text/u--text.vue new file mode 100644 index 0000000..44ee52a --- /dev/null +++ b/uni_modules/uview-ui/components/u--text/u--text.vue @@ -0,0 +1,44 @@ + + + diff --git a/uni_modules/uview-ui/components/u--textarea/u--textarea.vue b/uni_modules/uview-ui/components/u--textarea/u--textarea.vue new file mode 100644 index 0000000..f4df0b9 --- /dev/null +++ b/uni_modules/uview-ui/components/u--textarea/u--textarea.vue @@ -0,0 +1,48 @@ + + + diff --git a/uni_modules/uview-ui/components/u-action-sheet/props.js b/uni_modules/uview-ui/components/u-action-sheet/props.js new file mode 100644 index 0000000..e96e04f --- /dev/null +++ b/uni_modules/uview-ui/components/u-action-sheet/props.js @@ -0,0 +1,54 @@ +export default { + props: { + // 操作菜单是否展示 (默认false) + show: { + type: Boolean, + default: uni.$u.props.actionSheet.show + }, + // 标题 + title: { + type: String, + default: uni.$u.props.actionSheet.title + }, + // 选项上方的描述信息 + description: { + type: String, + default: uni.$u.props.actionSheet.description + }, + // 数据 + actions: { + type: Array, + default: uni.$u.props.actionSheet.actions + }, + // 取消按钮的文字,不为空时显示按钮 + cancelText: { + type: String, + default: uni.$u.props.actionSheet.cancelText + }, + // 点击某个菜单项时是否关闭弹窗 + closeOnClickAction: { + type: Boolean, + default: uni.$u.props.actionSheet.closeOnClickAction + }, + // 处理底部安全区(默认true) + safeAreaInsetBottom: { + type: Boolean, + default: uni.$u.props.actionSheet.safeAreaInsetBottom + }, + // 小程序的打开方式 + openType: { + type: String, + default: uni.$u.props.actionSheet.openType + }, + // 点击遮罩是否允许关闭 (默认true) + closeOnClickOverlay: { + type: Boolean, + default: uni.$u.props.actionSheet.closeOnClickOverlay + }, + // 圆角值 + round: { + type: [Boolean, String, Number], + default: uni.$u.props.actionSheet.round + } + } +} diff --git a/uni_modules/uview-ui/components/u-action-sheet/u-action-sheet.vue b/uni_modules/uview-ui/components/u-action-sheet/u-action-sheet.vue new file mode 100644 index 0000000..26d5d8d --- /dev/null +++ b/uni_modules/uview-ui/components/u-action-sheet/u-action-sheet.vue @@ -0,0 +1,278 @@ + + + + + + diff --git a/uni_modules/uview-ui/components/u-album/props.js b/uni_modules/uview-ui/components/u-album/props.js new file mode 100644 index 0000000..75cdb37 --- /dev/null +++ b/uni_modules/uview-ui/components/u-album/props.js @@ -0,0 +1,59 @@ +export default { + props: { + // 图片地址,Array|Array形式 + urls: { + type: Array, + default: uni.$u.props.album.urls + }, + // 指定从数组的对象元素中读取哪个属性作为图片地址 + keyName: { + type: String, + default: uni.$u.props.album.keyName + }, + // 单图时,图片长边的长度 + singleSize: { + type: [String, Number], + default: uni.$u.props.album.singleSize + }, + // 多图时,图片边长 + multipleSize: { + type: [String, Number], + default: uni.$u.props.album.multipleSize + }, + // 多图时,图片水平和垂直之间的间隔 + space: { + type: [String, Number], + default: uni.$u.props.album.space + }, + // 单图时,图片缩放裁剪的模式 + singleMode: { + type: String, + default: uni.$u.props.album.singleMode + }, + // 多图时,图片缩放裁剪的模式 + multipleMode: { + type: String, + default: uni.$u.props.album.multipleMode + }, + // 最多展示的图片数量,超出时最后一个位置将会显示剩余图片数量 + maxCount: { + type: [String, Number], + default: uni.$u.props.album.maxCount + }, + // 是否可以预览图片 + previewFullImage: { + type: Boolean, + default: uni.$u.props.album.previewFullImage + }, + // 每行展示图片数量,如设置,singleSize和multipleSize将会无效 + rowCount: { + type: [String, Number], + default: uni.$u.props.album.rowCount + }, + // 超出maxCount时是否显示查看更多的提示 + showMore: { + type: Boolean, + default: uni.$u.props.album.showMore + } + } +} diff --git a/uni_modules/uview-ui/components/u-album/u-album.vue b/uni_modules/uview-ui/components/u-album/u-album.vue new file mode 100644 index 0000000..687e2d5 --- /dev/null +++ b/uni_modules/uview-ui/components/u-album/u-album.vue @@ -0,0 +1,259 @@ + + + + + \ No newline at end of file diff --git a/uni_modules/uview-ui/components/u-alert/props.js b/uni_modules/uview-ui/components/u-alert/props.js new file mode 100644 index 0000000..4297e2c --- /dev/null +++ b/uni_modules/uview-ui/components/u-alert/props.js @@ -0,0 +1,44 @@ +export default { + props: { + // 显示文字 + title: { + type: String, + default: uni.$u.props.alert.title + }, + // 主题,success/warning/info/error + type: { + type: String, + default: uni.$u.props.alert.type + }, + // 辅助性文字 + description: { + type: String, + default: uni.$u.props.alert.description + }, + // 是否可关闭 + closable: { + type: Boolean, + default: uni.$u.props.alert.closable + }, + // 是否显示图标 + showIcon: { + type: Boolean, + default: uni.$u.props.alert.showIcon + }, + // 浅或深色调,light-浅色,dark-深色 + effect: { + type: String, + default: uni.$u.props.alert.effect + }, + // 文字是否居中 + center: { + type: Boolean, + default: uni.$u.props.alert.center + }, + // 字体大小 + fontSize: { + type: [String, Number], + default: uni.$u.props.alert.fontSize + } + } +} diff --git a/uni_modules/uview-ui/components/u-alert/u-alert.vue b/uni_modules/uview-ui/components/u-alert/u-alert.vue new file mode 100644 index 0000000..81f7d43 --- /dev/null +++ b/uni_modules/uview-ui/components/u-alert/u-alert.vue @@ -0,0 +1,243 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-avatar-group/props.js b/uni_modules/uview-ui/components/u-avatar-group/props.js new file mode 100644 index 0000000..58b42ac --- /dev/null +++ b/uni_modules/uview-ui/components/u-avatar-group/props.js @@ -0,0 +1,52 @@ +export default { + props: { + // 头像图片组 + urls: { + type: Array, + default: uni.$u.props.avatarGroup.urls + }, + // 最多展示的头像数量 + maxCount: { + type: [String, Number], + default: uni.$u.props.avatarGroup.maxCount + }, + // 头像形状 + shape: { + type: String, + default: uni.$u.props.avatarGroup.shape + }, + // 图片裁剪模式 + mode: { + type: String, + default: uni.$u.props.avatarGroup.mode + }, + // 超出maxCount时是否显示查看更多的提示 + showMore: { + type: Boolean, + default: uni.$u.props.avatarGroup.showMore + }, + // 头像大小 + size: { + type: [String, Number], + default: uni.$u.props.avatarGroup.size + }, + // 指定从数组的对象元素中读取哪个属性作为图片地址 + keyName: { + type: String, + default: uni.$u.props.avatarGroup.keyName + }, + // 头像之间的遮挡比例 + gap: { + type: [String, Number], + validator(value) { + return value >= 0 && value <= 1 + }, + default: uni.$u.props.avatarGroup.gap + }, + // 需额外显示的值 + extraValue: { + type: [Number, String], + default: uni.$u.props.avatarGroup.extraValue + } + } +} diff --git a/uni_modules/uview-ui/components/u-avatar-group/u-avatar-group.vue b/uni_modules/uview-ui/components/u-avatar-group/u-avatar-group.vue new file mode 100644 index 0000000..7e996d7 --- /dev/null +++ b/uni_modules/uview-ui/components/u-avatar-group/u-avatar-group.vue @@ -0,0 +1,103 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-avatar/props.js b/uni_modules/uview-ui/components/u-avatar/props.js new file mode 100644 index 0000000..34ca0f2 --- /dev/null +++ b/uni_modules/uview-ui/components/u-avatar/props.js @@ -0,0 +1,78 @@ +export default { + props: { + // 头像图片路径(不能为相对路径) + src: { + type: String, + default: uni.$u.props.avatar.src + }, + // 头像形状,circle-圆形,square-方形 + shape: { + type: String, + default: uni.$u.props.avatar.shape + }, + // 头像尺寸 + size: { + type: [String, Number], + default: uni.$u.props.avatar.size + }, + // 裁剪模式 + mode: { + type: String, + default: uni.$u.props.avatar.mode + }, + // 显示的文字 + text: { + type: String, + default: uni.$u.props.avatar.text + }, + // 背景色 + bgColor: { + type: String, + default: uni.$u.props.avatar.bgColor + }, + // 文字颜色 + color: { + type: String, + default: uni.$u.props.avatar.color + }, + // 文字大小 + fontSize: { + type: [String, Number], + default: uni.$u.props.avatar.fontSize + }, + // 显示的图标 + icon: { + type: String, + default: uni.$u.props.avatar.icon + }, + // 显示小程序头像,只对百度,微信,QQ小程序有效 + mpAvatar: { + type: Boolean, + default: uni.$u.props.avatar.mpAvatar + }, + // 是否使用随机背景色 + randomBgColor: { + type: Boolean, + default: uni.$u.props.avatar.randomBgColor + }, + // 加载失败的默认头像(组件有内置默认图片) + defaultUrl: { + type: String, + default: uni.$u.props.avatar.defaultUrl + }, + // 如果配置了randomBgColor为true,且配置了此值,则从默认的背景色数组中取出对应索引的颜色值,取值0-19之间 + colorIndex: { + type: [String, Number], + // 校验参数规则,索引在0-19之间 + validator(n) { + return uni.$u.test.range(n, [0, 19]) || n === '' + }, + default: uni.$u.props.avatar.colorIndex + }, + // 组件标识符 + name: { + type: String, + default: uni.$u.props.avatar.name + } + } +} diff --git a/uni_modules/uview-ui/components/u-avatar/u-avatar.vue b/uni_modules/uview-ui/components/u-avatar/u-avatar.vue new file mode 100644 index 0000000..d38d8a6 --- /dev/null +++ b/uni_modules/uview-ui/components/u-avatar/u-avatar.vue @@ -0,0 +1,173 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-back-top/props.js b/uni_modules/uview-ui/components/u-back-top/props.js new file mode 100644 index 0000000..6c702c2 --- /dev/null +++ b/uni_modules/uview-ui/components/u-back-top/props.js @@ -0,0 +1,54 @@ +export default { + props: { + // 返回顶部的形状,circle-圆形,square-方形 + mode: { + type: String, + default: uni.$u.props.backtop.mode + }, + // 自定义图标 + icon: { + type: String, + default: uni.$u.props.backtop.icon + }, + // 提示文字 + text: { + type: String, + default: uni.$u.props.backtop.text + }, + // 返回顶部滚动时间 + duration: { + type: [String, Number], + default: uni.$u.props.backtop.duration + }, + // 滚动距离 + scrollTop: { + type: [String, Number], + default: uni.$u.props.backtop.scrollTop + }, + // 距离顶部多少距离显示,单位px + top: { + type: [String, Number], + default: uni.$u.props.backtop.top + }, + // 返回顶部按钮到底部的距离,单位px + bottom: { + type: [String, Number], + default: uni.$u.props.backtop.bottom + }, + // 返回顶部按钮到右边的距离,单位px + right: { + type: [String, Number], + default: uni.$u.props.backtop.right + }, + // 层级 + zIndex: { + type: [String, Number], + default: uni.$u.props.backtop.zIndex + }, + // 图标的样式,对象形式 + iconStyle: { + type: Object, + default: uni.$u.props.backtop.iconStyle + } + } +} diff --git a/uni_modules/uview-ui/components/u-back-top/u-back-top.vue b/uni_modules/uview-ui/components/u-back-top/u-back-top.vue new file mode 100644 index 0000000..2d07566 --- /dev/null +++ b/uni_modules/uview-ui/components/u-back-top/u-back-top.vue @@ -0,0 +1,129 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-badge/props.js b/uni_modules/uview-ui/components/u-badge/props.js new file mode 100644 index 0000000..74c032c --- /dev/null +++ b/uni_modules/uview-ui/components/u-badge/props.js @@ -0,0 +1,72 @@ +export default { + props: { + // 是否显示圆点 + isDot: { + type: Boolean, + default: uni.$u.props.badge.isDot + }, + // 显示的内容 + value: { + type: [Number, String], + default: uni.$u.props.badge.value + }, + // 是否显示 + show: { + type: Boolean, + default: uni.$u.props.badge.show + }, + // 最大值,超过最大值会显示 '{max}+' + max: { + type: [Number, String], + default: uni.$u.props.badge.max + }, + // 主题类型,error|warning|success|primary + type: { + type: String, + default: uni.$u.props.badge.type + }, + // 当数值为 0 时,是否展示 Badge + showZero: { + type: Boolean, + default: uni.$u.props.badge.showZero + }, + // 背景颜色,优先级比type高,如设置,type参数会失效 + bgColor: { + type: [String, null], + default: uni.$u.props.badge.bgColor + }, + // 字体颜色 + color: { + type: [String, null], + default: uni.$u.props.badge.color + }, + // 徽标形状,circle-四角均为圆角,horn-左下角为直角 + shape: { + type: String, + default: uni.$u.props.badge.shape + }, + // 设置数字的显示方式,overflow|ellipsis|limit + // overflow会根据max字段判断,超出显示`${max}+` + // ellipsis会根据max判断,超出显示`${max}...` + // limit会依据1000作为判断条件,超出1000,显示`${value/1000}K`,比如2.2k、3.34w,最多保留2位小数 + numberType: { + type: String, + default: uni.$u.props.badge.numberType + }, + // 设置badge的位置偏移,格式为 [x, y],也即设置的为top和right的值,absolute为true时有效 + offset: { + type: Array, + default: uni.$u.props.badge.offset + }, + // 是否反转背景和字体颜色 + inverted: { + type: Boolean, + default: uni.$u.props.badge.inverted + }, + // 是否绝对定位 + absolute: { + type: Boolean, + default: uni.$u.props.badge.absolute + } + } +} diff --git a/uni_modules/uview-ui/components/u-badge/u-badge.vue b/uni_modules/uview-ui/components/u-badge/u-badge.vue new file mode 100644 index 0000000..53cfc81 --- /dev/null +++ b/uni_modules/uview-ui/components/u-badge/u-badge.vue @@ -0,0 +1,171 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-button/nvue.scss b/uni_modules/uview-ui/components/u-button/nvue.scss new file mode 100644 index 0000000..490db7d --- /dev/null +++ b/uni_modules/uview-ui/components/u-button/nvue.scss @@ -0,0 +1,46 @@ +$u-button-active-opacity:0.75 !default; +$u-button-loading-text-margin-left:4px !default; +$u-button-text-color: #FFFFFF !default; +$u-button-text-plain-error-color:$u-error !default; +$u-button-text-plain-warning-color:$u-warning !default; +$u-button-text-plain-success-color:$u-success !default; +$u-button-text-plain-info-color:$u-info !default; +$u-button-text-plain-primary-color:$u-primary !default; +.u-button { + &--active { + opacity: $u-button-active-opacity; + } + + &--active--plain { + background-color: rgb(217, 217, 217); + } + + &__loading-text { + margin-left:$u-button-loading-text-margin-left; + } + + &__text, + &__loading-text { + color:$u-button-text-color; + } + + &__text--plain--error { + color:$u-button-text-plain-error-color; + } + + &__text--plain--warning { + color:$u-button-text-plain-warning-color; + } + + &__text--plain--success{ + color:$u-button-text-plain-success-color; + } + + &__text--plain--info { + color:$u-button-text-plain-info-color; + } + + &__text--plain--primary { + color:$u-button-text-plain-primary-color; + } +} \ No newline at end of file diff --git a/uni_modules/uview-ui/components/u-button/props.js b/uni_modules/uview-ui/components/u-button/props.js new file mode 100644 index 0000000..07fd844 --- /dev/null +++ b/uni_modules/uview-ui/components/u-button/props.js @@ -0,0 +1,161 @@ +/* + * @Author : LQ + * @Description : + * @version : 1.0 + * @Date : 2021-08-16 10:04:04 + * @LastAuthor : LQ + * @lastTime : 2021-08-16 10:04:24 + * @FilePath : /u-view2.0/uview-ui/components/u-button/props.js + */ +export default { + props: { + // 是否细边框 + hairline: { + type: Boolean, + default: uni.$u.props.button.hairline + }, + // 按钮的预置样式,info,primary,error,warning,success + type: { + type: String, + default: uni.$u.props.button.type + }, + // 按钮尺寸,large,normal,small,mini + size: { + type: String, + default: uni.$u.props.button.size + }, + // 按钮形状,circle(两边为半圆),square(带圆角) + shape: { + type: String, + default: uni.$u.props.button.shape + }, + // 按钮是否镂空 + plain: { + type: Boolean, + default: uni.$u.props.button.plain + }, + // 是否禁止状态 + disabled: { + type: Boolean, + default: uni.$u.props.button.disabled + }, + // 是否加载中 + loading: { + type: Boolean, + default: uni.$u.props.button.loading + }, + // 加载中提示文字 + loadingText: { + type: [String, Number], + default: uni.$u.props.button.loadingText + }, + // 加载状态图标类型 + loadingMode: { + type: String, + default: uni.$u.props.button.loadingMode + }, + // 加载图标大小 + loadingSize: { + type: [String, Number], + default: uni.$u.props.button.loadingSize + }, + // 开放能力,具体请看uniapp稳定关于button组件部分说明 + // https://uniapp.dcloud.io/component/button + openType: { + type: String, + default: uni.$u.props.button.openType + }, + // 用于
组件,点击分别会触发 组件的 submit/reset 事件 + // 取值为submit(提交表单),reset(重置表单) + formType: { + type: String, + default: uni.$u.props.button.formType + }, + // 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 + // 只微信小程序、QQ小程序有效 + appParameter: { + type: String, + default: uni.$u.props.button.appParameter + }, + // 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效 + hoverStopPropagation: { + type: Boolean, + default: uni.$u.props.button.hoverStopPropagation + }, + // 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。只微信小程序有效 + lang: { + type: String, + default: uni.$u.props.button.lang + }, + // 会话来源,open-type="contact"时有效。只微信小程序有效 + sessionFrom: { + type: String, + default: uni.$u.props.button.sessionFrom + }, + // 会话内消息卡片标题,open-type="contact"时有效 + // 默认当前标题,只微信小程序有效 + sendMessageTitle: { + type: String, + default: uni.$u.props.button.sendMessageTitle + }, + // 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效 + // 默认当前分享路径,只微信小程序有效 + sendMessagePath: { + type: String, + default: uni.$u.props.button.sendMessagePath + }, + // 会话内消息卡片图片,open-type="contact"时有效 + // 默认当前页面截图,只微信小程序有效 + sendMessageImg: { + type: String, + default: uni.$u.props.button.sendMessageImg + }, + // 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示, + // 用户点击后可以快速发送小程序消息,open-type="contact"时有效 + showMessageCard: { + type: Boolean, + default: uni.$u.props.button.showMessageCard + }, + // 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取 + dataName: { + type: String, + default: uni.$u.props.button.dataName + }, + // 节流,一定时间内只能触发一次 + throttleTime: { + type: [String, Number], + default: uni.$u.props.button.throttleTime + }, + // 按住后多久出现点击态,单位毫秒 + hoverStartTime: { + type: [String, Number], + default: uni.$u.props.button.hoverStartTime + }, + // 手指松开后点击态保留时间,单位毫秒 + hoverStayTime: { + type: [String, Number], + default: uni.$u.props.button.hoverStayTime + }, + // 按钮文字,之所以通过props传入,是因为slot传入的话 + // nvue中无法控制文字的样式 + text: { + type: [String, Number], + default: uni.$u.props.button.text + }, + // 按钮图标 + icon: { + type: String, + default: uni.$u.props.button.icon + }, + // 按钮图标 + iconColor: { + type: String, + default: uni.$u.props.button.icon + }, + // 按钮颜色,支持传入linear-gradient渐变色 + color: { + type: String, + default: uni.$u.props.button.color + } + } +} diff --git a/uni_modules/uview-ui/components/u-button/u-button.vue b/uni_modules/uview-ui/components/u-button/u-button.vue new file mode 100644 index 0000000..d60f73e --- /dev/null +++ b/uni_modules/uview-ui/components/u-button/u-button.vue @@ -0,0 +1,495 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-button/vue.scss b/uni_modules/uview-ui/components/u-button/vue.scss new file mode 100644 index 0000000..32019b2 --- /dev/null +++ b/uni_modules/uview-ui/components/u-button/vue.scss @@ -0,0 +1,80 @@ +// nvue下hover-class无效 +$u-button-before-top:50% !default; +$u-button-before-left:50% !default; +$u-button-before-width:100% !default; +$u-button-before-height:100% !default; +$u-button-before-transform:translate(-50%, -50%) !default; +$u-button-before-opacity:0 !default; +$u-button-before-background-color:#000 !default; +$u-button-before-border-color:#000 !default; +$u-button-active-before-opacity:.15 !default; +$u-button-icon-margin-left:4px !default; +$u-button-plain-u-button-info-color:$u-info; +$u-button-plain-u-button-success-color:$u-success; +$u-button-plain-u-button-error-color:$u-error; +$u-button-plain-u-button-warning-color:$u-error; + +.u-button { + width: 100%; + + &__text { + white-space: nowrap; + line-height: 1; + } + + &:before { + position: absolute; + top:$u-button-before-top; + left:$u-button-before-left; + width:$u-button-before-width; + height:$u-button-before-height; + border: inherit; + border-radius: inherit; + transform:$u-button-before-transform; + opacity:$u-button-before-opacity; + content: " "; + background-color:$u-button-before-background-color; + border-color:$u-button-before-border-color; + } + + &--active { + &:before { + opacity: .15 + } + } + + &__icon+&__text:not(:empty), + &__loading-text { + margin-left:$u-button-icon-margin-left; + } + + &--plain { + &.u-button--primary { + color: $u-primary; + } + } + + &--plain { + &.u-button--info { + color:$u-button-plain-u-button-info-color; + } + } + + &--plain { + &.u-button--success { + color:$u-button-plain-u-button-success-color; + } + } + + &--plain { + &.u-button--error { + color:$u-button-plain-u-button-error-color; + } + } + + &--plain { + &.u-button--warning { + color:$u-button-plain-u-button-warning-color; + } + } +} diff --git a/uni_modules/uview-ui/components/u-calendar/header.vue b/uni_modules/uview-ui/components/u-calendar/header.vue new file mode 100644 index 0000000..dc4f7d0 --- /dev/null +++ b/uni_modules/uview-ui/components/u-calendar/header.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-calendar/month.vue b/uni_modules/uview-ui/components/u-calendar/month.vue new file mode 100644 index 0000000..c20937f --- /dev/null +++ b/uni_modules/uview-ui/components/u-calendar/month.vue @@ -0,0 +1,579 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-calendar/props.js b/uni_modules/uview-ui/components/u-calendar/props.js new file mode 100644 index 0000000..2ad7bc7 --- /dev/null +++ b/uni_modules/uview-ui/components/u-calendar/props.js @@ -0,0 +1,144 @@ +export default { + props: { + // 日历顶部标题 + title: { + type: String, + default: uni.$u.props.calendar.title + }, + // 是否显示标题 + showTitle: { + type: Boolean, + default: uni.$u.props.calendar.showTitle + }, + // 是否显示副标题 + showSubtitle: { + type: Boolean, + default: uni.$u.props.calendar.showSubtitle + }, + // 日期类型选择,single-选择单个日期,multiple-可以选择多个日期,range-选择日期范围 + mode: { + type: String, + default: uni.$u.props.calendar.mode + }, + // mode=range时,第一个日期底部的提示文字 + startText: { + type: String, + default: uni.$u.props.calendar.startText + }, + // mode=range时,最后一个日期底部的提示文字 + endText: { + type: String, + default: uni.$u.props.calendar.endText + }, + // 自定义列表 + customList: { + type: Array, + default: uni.$u.props.calendar.customList + }, + // 主题色,对底部按钮和选中日期有效 + color: { + type: String, + default: uni.$u.props.calendar.color + }, + // 最小的可选日期 + minDate: { + type: [String, Number], + default: uni.$u.props.calendar.minDate + }, + // 最大可选日期 + maxDate: { + type: [String, Number], + default: uni.$u.props.calendar.maxDate + }, + // 默认选中的日期,mode为multiple或range是必须为数组格式 + defaultDate: { + type: [Array, String, Date, null], + default: uni.$u.props.calendar.defaultDate + }, + // mode=multiple时,最多可选多少个日期 + maxCount: { + type: [String, Number], + default: uni.$u.props.calendar.maxCount + }, + // 日期行高 + rowHeight: { + type: [String, Number], + default: uni.$u.props.calendar.rowHeight + }, + // 日期格式化函数 + formatter: { + type: [Function, null], + default: uni.$u.props.calendar.formatter + }, + // 是否显示农历 + showLunar: { + type: Boolean, + default: uni.$u.props.calendar.showLunar + }, + // 是否显示月份背景色 + showMark: { + type: Boolean, + default: uni.$u.props.calendar.showMark + }, + // 确定按钮的文字 + confirmText: { + type: String, + default: uni.$u.props.calendar.confirmText + }, + // 确认按钮处于禁用状态时的文字 + confirmDisabledText: { + type: String, + default: uni.$u.props.calendar.confirmDisabledText + }, + // 是否显示日历弹窗 + show: { + type: Boolean, + default: uni.$u.props.calendar.show + }, + // 是否允许点击遮罩关闭日历 + closeOnClickOverlay: { + type: Boolean, + default: uni.$u.props.calendar.closeOnClickOverlay + }, + // 是否为只读状态,只读状态下禁止选择日期 + readonly: { + type: Boolean, + default: uni.$u.props.calendar.readonly + }, + // 是否展示确认按钮 + showConfirm: { + type: Boolean, + default: uni.$u.props.calendar.showConfirm + }, + // 日期区间最多可选天数,默认无限制,mode = range时有效 + maxRange: { + type: [Number, String], + default: uni.$u.props.calendar.maxRange + }, + // 范围选择超过最多可选天数时的提示文案,mode = range时有效 + rangePrompt: { + type: String, + default: uni.$u.props.calendar.rangePrompt + }, + // 范围选择超过最多可选天数时,是否展示提示文案,mode = range时有效 + showRangePrompt: { + type: Boolean, + default: uni.$u.props.calendar.showRangePrompt + }, + // 是否允许日期范围的起止时间为同一天,mode = range时有效 + allowSameDay: { + type: Boolean, + default: uni.$u.props.calendar.allowSameDay + }, + // 圆角值 + round: { + type: [Boolean, String, Number], + default: uni.$u.props.calendar.round + }, + // 最多展示月份数量 + monthNum: { + type: [Number, String], + default: 3 + } + } +} diff --git a/uni_modules/uview-ui/components/u-calendar/u-calendar.vue b/uni_modules/uview-ui/components/u-calendar/u-calendar.vue new file mode 100644 index 0000000..511f993 --- /dev/null +++ b/uni_modules/uview-ui/components/u-calendar/u-calendar.vue @@ -0,0 +1,384 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-calendar/util.js b/uni_modules/uview-ui/components/u-calendar/util.js new file mode 100644 index 0000000..ca4736b --- /dev/null +++ b/uni_modules/uview-ui/components/u-calendar/util.js @@ -0,0 +1,85 @@ +export default { + methods: { + // 设置月份数据 + setMonth() { + // 月初是周几 + const day = dayjs(this.date).date(1).day() + const start = day == 0 ? 6 : day - 1 + + // 本月天数 + const days = dayjs(this.date).endOf('month').format('D') + + // 上个月天数 + const prevDays = dayjs(this.date).endOf('month').subtract(1, 'month').format('D') + + // 日期数据 + const arr = [] + // 清空表格 + this.month = [] + + // 添加上月数据 + arr.push( + ...new Array(start).fill(1).map((e, i) => { + const day = prevDays - start + i + 1 + + return { + value: day, + disabled: true, + date: dayjs(this.date).subtract(1, 'month').date(day).format('YYYY-MM-DD') + } + }) + ) + + // 添加本月数据 + arr.push( + ...new Array(days - 0).fill(1).map((e, i) => { + const day = i + 1 + + return { + value: day, + date: dayjs(this.date).date(day).format('YYYY-MM-DD') + } + }) + ) + + // 添加下个月 + arr.push( + ...new Array(42 - days - start).fill(1).map((e, i) => { + const day = i + 1 + + return { + value: day, + disabled: true, + date: dayjs(this.date).add(1, 'month').date(day).format('YYYY-MM-DD') + } + }) + ) + + // 分割数组 + for (let n = 0; n < arr.length; n += 7) { + this.month.push( + arr.slice(n, n + 7).map((e, i) => { + e.index = i + n + + // 自定义信息 + const custom = this.customList.find((c) => c.date == e.date) + + // 农历 + if (this.lunar) { + const { + IDayCn, + IMonthCn + } = this.getLunar(e.date) + e.lunar = IDayCn == '初一' ? IMonthCn : IDayCn + } + + return { + ...e, + ...custom + } + }) + ) + } + } + } +} diff --git a/uni_modules/uview-ui/components/u-car-keyboard/props.js b/uni_modules/uview-ui/components/u-car-keyboard/props.js new file mode 100644 index 0000000..3553647 --- /dev/null +++ b/uni_modules/uview-ui/components/u-car-keyboard/props.js @@ -0,0 +1,14 @@ +export default { + props: { + // 是否打乱键盘按键的顺序 + random: { + type: Boolean, + default: false + }, + // 输入一个中文后,是否自动切换到英文 + autoChange: { + type: Boolean, + default: false + } + } +} diff --git a/uni_modules/uview-ui/components/u-car-keyboard/u-car-keyboard.vue b/uni_modules/uview-ui/components/u-car-keyboard/u-car-keyboard.vue new file mode 100644 index 0000000..51175b5 --- /dev/null +++ b/uni_modules/uview-ui/components/u-car-keyboard/u-car-keyboard.vue @@ -0,0 +1,311 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-cell-group/props.js b/uni_modules/uview-ui/components/u-cell-group/props.js new file mode 100644 index 0000000..350ef40 --- /dev/null +++ b/uni_modules/uview-ui/components/u-cell-group/props.js @@ -0,0 +1,14 @@ +export default { + props: { + // 分组标题 + title: { + type: String, + default: uni.$u.props.cellGroup.title + }, + // 是否显示外边框 + border: { + type: Boolean, + default: uni.$u.props.cellGroup.border + } + } +} diff --git a/uni_modules/uview-ui/components/u-cell-group/u-cell-group.vue b/uni_modules/uview-ui/components/u-cell-group/u-cell-group.vue new file mode 100644 index 0000000..a9508c0 --- /dev/null +++ b/uni_modules/uview-ui/components/u-cell-group/u-cell-group.vue @@ -0,0 +1,61 @@ + + + + + + diff --git a/uni_modules/uview-ui/components/u-cell/props.js b/uni_modules/uview-ui/components/u-cell/props.js new file mode 100644 index 0000000..da03330 --- /dev/null +++ b/uni_modules/uview-ui/components/u-cell/props.js @@ -0,0 +1,110 @@ +export default { + props: { + // 标题 + title: { + type: [String, Number], + default: uni.$u.props.cell.title + }, + // 标题下方的描述信息 + label: { + type: [String, Number], + default: uni.$u.props.cell.label + }, + // 右侧的内容 + value: { + type: [String, Number], + default: uni.$u.props.cell.value + }, + // 左侧图标名称,或者图片链接(本地文件建议使用绝对地址) + icon: { + type: String, + default: uni.$u.props.cell.icon + }, + // 是否禁用cell + disabled: { + type: Boolean, + default: uni.$u.props.cell.disabled + }, + // 是否显示下边框 + border: { + type: Boolean, + default: uni.$u.props.cell.border + }, + // 内容是否垂直居中(主要是针对右侧的value部分) + center: { + type: Boolean, + default: uni.$u.props.cell.center + }, + // 点击后跳转的URL地址 + url: { + type: String, + default: uni.$u.props.cell.url + }, + // 链接跳转的方式,内部使用的是uView封装的route方法,可能会进行拦截操作 + linkType: { + type: String, + default: uni.$u.props.cell.linkType + }, + // 是否开启点击反馈(表现为点击时加上灰色背景) + clickable: { + type: Boolean, + default: uni.$u.props.cell.clickable + }, + // 是否展示右侧箭头并开启点击反馈 + isLink: { + type: Boolean, + default: uni.$u.props.cell.isLink + }, + // 是否显示表单状态下的必填星号(此组件可能会内嵌入input组件) + required: { + type: Boolean, + default: uni.$u.props.cell.required + }, + // 右侧的图标箭头 + rightIcon: { + type: String, + default: uni.$u.props.cell.rightIcon + }, + // 右侧箭头的方向,可选值为:left,up,down + arrowDirection: { + type: String, + default: uni.$u.props.cell.arrowDirection + }, + // 左侧图标样式 + iconStyle: { + type: [Object, String], + default: () => { + return uni.$u.props.cell.iconStyle + } + }, + // 右侧箭头图标的样式 + rightIconStyle: { + type: [Object, String], + default: () => { + return uni.$u.props.cell.rightIconStyle + } + }, + // 标题的样式 + titleStyle: { + type: [Object, String], + default: () => { + return uni.$u.props.cell.titleStyle + } + }, + // 单位元的大小,可选值为large + size: { + type: String, + default: uni.$u.props.cell.size + }, + // 点击cell是否阻止事件传播 + stop: { + type: Boolean, + default: uni.$u.props.cell.stop + }, + // 标识符,cell被点击时返回 + name: { + type: [Number, String], + default: uni.$u.props.cell.name + } + } +} diff --git a/uni_modules/uview-ui/components/u-cell/u-cell.vue b/uni_modules/uview-ui/components/u-cell/u-cell.vue new file mode 100644 index 0000000..b099c90 --- /dev/null +++ b/uni_modules/uview-ui/components/u-cell/u-cell.vue @@ -0,0 +1,229 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-checkbox-group/props.js b/uni_modules/uview-ui/components/u-checkbox-group/props.js new file mode 100644 index 0000000..2f818a1 --- /dev/null +++ b/uni_modules/uview-ui/components/u-checkbox-group/props.js @@ -0,0 +1,82 @@ +export default { + props: { + // 标识符 + name: { + type: String, + default: uni.$u.props.checkboxGroup.name + }, + // 绑定的值 + value: { + type: Array, + default: uni.$u.props.checkboxGroup.value + }, + // 形状,circle-圆形,square-方形 + shape: { + type: String, + default: uni.$u.props.checkboxGroup.shape + }, + // 是否禁用全部checkbox + disabled: { + type: Boolean, + default: uni.$u.props.checkboxGroup.disabled + }, + + // 选中状态下的颜色,如设置此值,将会覆盖parent的activeColor值 + activeColor: { + type: String, + default: uni.$u.props.checkboxGroup.activeColor + }, + // 未选中的颜色 + inactiveColor: { + type: String, + default: uni.$u.props.checkboxGroup.inactiveColor + }, + + // 整个组件的尺寸,默认px + size: { + type: [String, Number], + default: uni.$u.props.checkboxGroup.size + }, + // 布局方式,row-横向,column-纵向 + placement: { + type: String, + default: uni.$u.props.checkboxGroup.placement + }, + // label的字体大小,px单位 + labelSize: { + type: [String, Number], + default: uni.$u.props.checkboxGroup.labelSize + }, + // label的字体颜色 + labelColor: { + type: [String], + default: uni.$u.props.checkboxGroup.labelColor + }, + // 是否禁止点击文本操作 + labelDisabled: { + type: Boolean, + default: uni.$u.props.checkboxGroup.labelDisabled + }, + // 图标颜色 + iconColor: { + type: String, + default: uni.$u.props.checkboxGroup.iconColor + }, + // 图标的大小,单位px + iconSize: { + type: [String, Number], + default: uni.$u.props.checkboxGroup.iconSize + }, + // 勾选图标的对齐方式,left-左边,right-右边 + iconPlacement: { + type: String, + default: uni.$u.props.checkboxGroup.iconPlacement + }, + // 竖向配列时,是否显示下划线 + borderBottom: { + type: Boolean, + default: uni.$u.props.checkboxGroup.borderBottom + } + + } +} diff --git a/uni_modules/uview-ui/components/u-checkbox-group/u-checkbox-group.vue b/uni_modules/uview-ui/components/u-checkbox-group/u-checkbox-group.vue new file mode 100644 index 0000000..7a6b4fa --- /dev/null +++ b/uni_modules/uview-ui/components/u-checkbox-group/u-checkbox-group.vue @@ -0,0 +1,103 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-checkbox/props.js b/uni_modules/uview-ui/components/u-checkbox/props.js new file mode 100644 index 0000000..93f4fd9 --- /dev/null +++ b/uni_modules/uview-ui/components/u-checkbox/props.js @@ -0,0 +1,69 @@ +export default { + props: { + // checkbox的名称 + name: { + type: [String, Number, Boolean], + default: uni.$u.props.checkbox.name + }, + // 形状,square为方形,circle为圆型 + shape: { + type: String, + default: uni.$u.props.checkbox.shape + }, + // 整体的大小 + size: { + type: [String, Number], + default: uni.$u.props.checkbox.size + }, + // 是否默认选中 + checked: { + type: Boolean, + default: uni.$u.props.checkbox.checked + }, + // 是否禁用 + disabled: { + type: [String, Boolean], + default: uni.$u.props.checkbox.disabled + }, + // 选中状态下的颜色,如设置此值,将会覆盖parent的activeColor值 + activeColor: { + type: String, + default: uni.$u.props.checkbox.activeColor + }, + // 未选中的颜色 + inactiveColor: { + type: String, + default: uni.$u.props.checkbox.inactiveColor + }, + // 图标的大小,单位px + iconSize: { + type: [String, Number], + default: uni.$u.props.checkbox.iconSize + }, + // 图标颜色 + iconColor: { + type: String, + default: uni.$u.props.checkbox.iconColor + }, + // label提示文字,因为nvue下,直接slot进来的文字,由于特殊的结构,无法修改样式 + label: { + type: [String, Number], + default: uni.$u.props.checkbox.label + }, + // label的字体大小,px单位 + labelSize: { + type: [String, Number], + default: uni.$u.props.checkbox.labelSize + }, + // label的颜色 + labelColor: { + type: String, + default: uni.$u.props.checkbox.labelColor + }, + // 是否禁止点击提示语选中复选框 + labelDisabled: { + type: [String, Boolean], + default: uni.$u.props.checkbox.labelDisabled + } + } +} diff --git a/uni_modules/uview-ui/components/u-checkbox/u-checkbox.vue b/uni_modules/uview-ui/components/u-checkbox/u-checkbox.vue new file mode 100644 index 0000000..6429cca --- /dev/null +++ b/uni_modules/uview-ui/components/u-checkbox/u-checkbox.vue @@ -0,0 +1,344 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-circle-progress/props.js b/uni_modules/uview-ui/components/u-circle-progress/props.js new file mode 100644 index 0000000..d776cfb --- /dev/null +++ b/uni_modules/uview-ui/components/u-circle-progress/props.js @@ -0,0 +1,8 @@ +export default { + props: { + percentage: { + type: [String, Number], + default: uni.$u.props.circleProgress.percentage + } + } +} diff --git a/uni_modules/uview-ui/components/u-circle-progress/u-circle-progress.vue b/uni_modules/uview-ui/components/u-circle-progress/u-circle-progress.vue new file mode 100644 index 0000000..d1ee286 --- /dev/null +++ b/uni_modules/uview-ui/components/u-circle-progress/u-circle-progress.vue @@ -0,0 +1,198 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-code-input/props.js b/uni_modules/uview-ui/components/u-code-input/props.js new file mode 100644 index 0000000..0f016ee --- /dev/null +++ b/uni_modules/uview-ui/components/u-code-input/props.js @@ -0,0 +1,79 @@ +export default { + props: { + // 键盘弹起时,是否自动上推页面 + adjustPosition: { + type: Boolean, + default: uni.$u.props.codeInput.adjustPosition + }, + // 最大输入长度 + maxlength: { + type: [String, Number], + default: uni.$u.props.codeInput.maxlength + }, + // 是否用圆点填充 + dot: { + type: Boolean, + default: uni.$u.props.codeInput.dot + }, + // 显示模式,box-盒子模式,line-底部横线模式 + mode: { + type: String, + default: uni.$u.props.codeInput.mode + }, + // 是否细边框 + hairline: { + type: Boolean, + default: uni.$u.props.codeInput.hairline + }, + // 字符间的距离 + space: { + type: [String, Number], + default: uni.$u.props.codeInput.space + }, + // 预置值 + value: { + type: [String, Number], + default: uni.$u.props.codeInput.value + }, + // 是否自动获取焦点 + focus: { + type: Boolean, + default: uni.$u.props.codeInput.focus + }, + // 字体是否加粗 + bold: { + type: Boolean, + default: uni.$u.props.codeInput.bold + }, + // 字体颜色 + color: { + type: String, + default: uni.$u.props.codeInput.color + }, + // 字体大小 + fontSize: { + type: [String, Number], + default: uni.$u.props.codeInput.fontSize + }, + // 输入框的大小,宽等于高 + size: { + type: [String, Number], + default: uni.$u.props.codeInput.size + }, + // 是否隐藏原生键盘,如果想用自定义键盘的话,需设置此参数为true + disabledKeyboard: { + type: Boolean, + default: uni.$u.props.codeInput.disabledKeyboard + }, + // 边框和线条颜色 + borderColor: { + type: String, + default: uni.$u.props.codeInput.borderColor + }, + // 是否禁止输入"."符号 + disabledDot: { + type: Boolean, + default: uni.$u.props.codeInput.disabledDot + } + } +} diff --git a/uni_modules/uview-ui/components/u-code-input/u-code-input.vue b/uni_modules/uview-ui/components/u-code-input/u-code-input.vue new file mode 100644 index 0000000..96241cf --- /dev/null +++ b/uni_modules/uview-ui/components/u-code-input/u-code-input.vue @@ -0,0 +1,252 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-code/props.js b/uni_modules/uview-ui/components/u-code/props.js new file mode 100644 index 0000000..eaf80d0 --- /dev/null +++ b/uni_modules/uview-ui/components/u-code/props.js @@ -0,0 +1,34 @@ +export default { + props: { + // 倒计时总秒数 + seconds: { + type: [String, Number], + default: uni.$u.props.code.seconds + }, + // 尚未开始时提示 + startText: { + type: String, + default: uni.$u.props.code.startText + }, + // 正在倒计时中的提示 + changeText: { + type: String, + default: uni.$u.props.code.changeText + }, + // 倒计时结束时的提示 + endText: { + type: String, + default: uni.$u.props.code.endText + }, + // 是否在H5刷新或各端返回再进入时继续倒计时 + keepRunning: { + type: Boolean, + default: uni.$u.props.code.keepRunning + }, + // 为了区分多个页面,或者一个页面多个倒计时组件本地存储的继续倒计时变了 + uniqueKey: { + type: String, + default: uni.$u.props.code.uniqueKey + } + } +} diff --git a/uni_modules/uview-ui/components/u-code/u-code.vue b/uni_modules/uview-ui/components/u-code/u-code.vue new file mode 100644 index 0000000..f79a09a --- /dev/null +++ b/uni_modules/uview-ui/components/u-code/u-code.vue @@ -0,0 +1,129 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-col/props.js b/uni_modules/uview-ui/components/u-col/props.js new file mode 100644 index 0000000..0622251 --- /dev/null +++ b/uni_modules/uview-ui/components/u-col/props.js @@ -0,0 +1,29 @@ +export default { + props: { + // 占父容器宽度的多少等分,总分为12份 + span: { + type: [String, Number], + default: uni.$u.props.col.span + }, + // 指定栅格左侧的间隔数(总12栏) + offset: { + type: [String, Number], + default: uni.$u.props.col.offset + }, + // 水平排列方式,可选值为`start`(或`flex-start`)、`end`(或`flex-end`)、`center`、`around`(或`space-around`)、`between`(或`space-between`) + justify: { + type: String, + default: uni.$u.props.col.justify + }, + // 垂直对齐方式,可选值为top、center、bottom、stretch + align: { + type: String, + default: uni.$u.props.col.align + }, + // 文字对齐方式 + textAlign: { + type: String, + default: uni.$u.props.col.textAlign + } + } +} diff --git a/uni_modules/uview-ui/components/u-col/u-col.vue b/uni_modules/uview-ui/components/u-col/u-col.vue new file mode 100644 index 0000000..8be1517 --- /dev/null +++ b/uni_modules/uview-ui/components/u-col/u-col.vue @@ -0,0 +1,162 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-collapse-item/props.js b/uni_modules/uview-ui/components/u-collapse-item/props.js new file mode 100644 index 0000000..bd5749b --- /dev/null +++ b/uni_modules/uview-ui/components/u-collapse-item/props.js @@ -0,0 +1,59 @@ +export default { + props: { + // 标题 + title: { + type: String, + default: uni.$u.props.collapseItem.title + }, + // 标题右侧内容 + value: { + type: String, + default: uni.$u.props.collapseItem.value + }, + // 标题下方的描述信息 + label: { + type: String, + default: uni.$u.props.collapseItem.label + }, + // 是否禁用折叠面板 + disabled: { + type: Boolean, + default: uni.$u.props.collapseItem.disabled + }, + // 是否展示右侧箭头并开启点击反馈 + isLink: { + type: Boolean, + default: uni.$u.props.collapseItem.isLink + }, + // 是否开启点击反馈 + clickable: { + type: Boolean, + default: uni.$u.props.collapseItem.clickable + }, + // 是否显示内边框 + border: { + type: Boolean, + default: uni.$u.props.collapseItem.border + }, + // 标题的对齐方式 + align: { + type: String, + default: uni.$u.props.collapseItem.align + }, + // 唯一标识符 + name: { + type: [String, Number], + default: uni.$u.props.collapseItem.name + }, + // 标题左侧图片,可为绝对路径的图片或内置图标 + icon: { + type: String, + default: uni.$u.props.collapseItem.icon + }, + // 面板展开收起的过渡时间,单位ms + duration: { + type: Number, + default: uni.$u.props.collapseItem.duration + } + } +} diff --git a/uni_modules/uview-ui/components/u-collapse-item/u-collapse-item.vue b/uni_modules/uview-ui/components/u-collapse-item/u-collapse-item.vue new file mode 100644 index 0000000..0e1b703 --- /dev/null +++ b/uni_modules/uview-ui/components/u-collapse-item/u-collapse-item.vue @@ -0,0 +1,225 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-collapse/props.js b/uni_modules/uview-ui/components/u-collapse/props.js new file mode 100644 index 0000000..7ee6d31 --- /dev/null +++ b/uni_modules/uview-ui/components/u-collapse/props.js @@ -0,0 +1,19 @@ +export default { + props: { + // 当前展开面板的name,非手风琴模式:[],手风琴模式:string | number + value: { + type: [String, Number, Array, null], + default: uni.$u.props.collapse.value + }, + // 是否手风琴模式 + accordion: { + type: Boolean, + default: uni.$u.props.collapse.accordion + }, + // 是否显示外边框 + border: { + type: Boolean, + default: uni.$u.props.collapse.border + } + } +} diff --git a/uni_modules/uview-ui/components/u-collapse/u-collapse.vue b/uni_modules/uview-ui/components/u-collapse/u-collapse.vue new file mode 100644 index 0000000..fc188a2 --- /dev/null +++ b/uni_modules/uview-ui/components/u-collapse/u-collapse.vue @@ -0,0 +1,90 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-column-notice/props.js b/uni_modules/uview-ui/components/u-column-notice/props.js new file mode 100644 index 0000000..4809154 --- /dev/null +++ b/uni_modules/uview-ui/components/u-column-notice/props.js @@ -0,0 +1,55 @@ +export default { + props: { + // 显示的内容,字符串 + text: { + type: [Array], + default: uni.$u.props.columnNotice.text + }, + // 是否显示左侧的音量图标 + icon: { + type: String, + default: uni.$u.props.columnNotice.icon + }, + // 通告模式,link-显示右箭头,closable-显示右侧关闭图标 + mode: { + type: String, + default: uni.$u.props.columnNotice.mode + }, + // 文字颜色,各图标也会使用文字颜色 + color: { + type: String, + default: uni.$u.props.columnNotice.color + }, + // 背景颜色 + bgColor: { + type: String, + default: uni.$u.props.columnNotice.bgColor + }, + // 字体大小,单位px + fontSize: { + type: [String, Number], + default: uni.$u.props.columnNotice.fontSize + }, + // 水平滚动时的滚动速度,即每秒滚动多少px(px),这有利于控制文字无论多少时,都能有一个恒定的速度 + speed: { + type: [String, Number], + default: uni.$u.props.columnNotice.speed + }, + // direction = row时,是否使用步进形式滚动 + step: { + type: Boolean, + default: uni.$u.props.columnNotice.step + }, + // 滚动一个周期的时间长,单位ms + duration: { + type: [String, Number], + default: uni.$u.props.columnNotice.duration + }, + // 是否禁止用手滑动切换 + // 目前HX2.6.11,只支持App 2.5.5+、H5 2.5.5+、支付宝小程序、字节跳动小程序 + disableTouch: { + type: Boolean, + default: uni.$u.props.columnNotice.disableTouch + } + } +} diff --git a/uni_modules/uview-ui/components/u-column-notice/u-column-notice.vue b/uni_modules/uview-ui/components/u-column-notice/u-column-notice.vue new file mode 100644 index 0000000..fc39532 --- /dev/null +++ b/uni_modules/uview-ui/components/u-column-notice/u-column-notice.vue @@ -0,0 +1,160 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-count-down/props.js b/uni_modules/uview-ui/components/u-count-down/props.js new file mode 100644 index 0000000..d62f025 --- /dev/null +++ b/uni_modules/uview-ui/components/u-count-down/props.js @@ -0,0 +1,24 @@ +export default { + props: { + // 倒计时时长,单位ms + time: { + type: [String, Number], + default: uni.$u.props.countDown.time + }, + // 时间格式,DD-日,HH-时,mm-分,ss-秒,SSS-毫秒 + format: { + type: String, + default: uni.$u.props.countDown.format + }, + // 是否自动开始倒计时 + autoStart: { + type: Boolean, + default: uni.$u.props.countDown.autoStart + }, + // 是否展示毫秒倒计时 + millisecond: { + type: Boolean, + default: uni.$u.props.countDown.millisecond + } + } +} diff --git a/uni_modules/uview-ui/components/u-count-down/u-count-down.vue b/uni_modules/uview-ui/components/u-count-down/u-count-down.vue new file mode 100644 index 0000000..b5e85a6 --- /dev/null +++ b/uni_modules/uview-ui/components/u-count-down/u-count-down.vue @@ -0,0 +1,163 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-count-down/utils.js b/uni_modules/uview-ui/components/u-count-down/utils.js new file mode 100644 index 0000000..8c75005 --- /dev/null +++ b/uni_modules/uview-ui/components/u-count-down/utils.js @@ -0,0 +1,62 @@ +// 补0,如1 -> 01 +function padZero(num, targetLength = 2) { + let str = `${num}` + while (str.length < targetLength) { + str = `0${str}` + } + return str +} +const SECOND = 1000 +const MINUTE = 60 * SECOND +const HOUR = 60 * MINUTE +const DAY = 24 * HOUR +export function parseTimeData(time) { + const days = Math.floor(time / DAY) + const hours = Math.floor((time % DAY) / HOUR) + const minutes = Math.floor((time % HOUR) / MINUTE) + const seconds = Math.floor((time % MINUTE) / SECOND) + const milliseconds = Math.floor(time % SECOND) + return { + days, + hours, + minutes, + seconds, + milliseconds + } +} +export function parseFormat(format, timeData) { + let { + days, + hours, + minutes, + seconds, + milliseconds + } = timeData + // 如果格式化字符串中不存在DD(天),则将天的时间转为小时中去 + if (format.indexOf('DD') === -1) { + hours += days * 24 + } else { + // 对天补0 + format = format.replace('DD', padZero(days)) + } + // 其他同理于DD的格式化处理方式 + if (format.indexOf('HH') === -1) { + minutes += hours * 60 + } else { + format = format.replace('HH', padZero(hours)) + } + if (format.indexOf('mm') === -1) { + seconds += minutes * 60 + } else { + format = format.replace('mm', padZero(minutes)) + } + if (format.indexOf('ss') === -1) { + milliseconds += seconds * 1000 + } else { + format = format.replace('ss', padZero(seconds)) + } + return format.replace('SSS', padZero(milliseconds, 3)) +} +export function isSameSecond(time1, time2) { + return Math.floor(time1 / 1000) === Math.floor(time2 / 1000) +} diff --git a/uni_modules/uview-ui/components/u-count-to/props.js b/uni_modules/uview-ui/components/u-count-to/props.js new file mode 100644 index 0000000..86873c1 --- /dev/null +++ b/uni_modules/uview-ui/components/u-count-to/props.js @@ -0,0 +1,59 @@ +export default { + props: { + // 开始的数值,默认从0增长到某一个数 + startVal: { + type: [String, Number], + default: uni.$u.props.countTo.startVal + }, + // 要滚动的目标数值,必须 + endVal: { + type: [String, Number], + default: uni.$u.props.countTo.endVal + }, + // 滚动到目标数值的动画持续时间,单位为毫秒(ms) + duration: { + type: [String, Number], + default: uni.$u.props.countTo.duration + }, + // 设置数值后是否自动开始滚动 + autoplay: { + type: Boolean, + default: uni.$u.props.countTo.autoplay + }, + // 要显示的小数位数 + decimals: { + type: [String, Number], + default: uni.$u.props.countTo.decimals + }, + // 是否在即将到达目标数值的时候,使用缓慢滚动的效果 + useEasing: { + type: Boolean, + default: uni.$u.props.countTo.useEasing + }, + // 十进制分割 + decimal: { + type: [String, Number], + default: uni.$u.props.countTo.decimal + }, + // 字体颜色 + color: { + type: String, + default: uni.$u.props.countTo.color + }, + // 字体大小 + fontSize: { + type: [String, Number], + default: uni.$u.props.countTo.fontSize + }, + // 是否加粗字体 + bold: { + type: Boolean, + default: uni.$u.props.countTo.bold + }, + // 千位分隔符,类似金额的分割(¥23,321.05中的",") + separator: { + type: String, + default: uni.$u.props.countTo.separator + } + } +} diff --git a/uni_modules/uview-ui/components/u-count-to/u-count-to.vue b/uni_modules/uview-ui/components/u-count-to/u-count-to.vue new file mode 100644 index 0000000..417b732 --- /dev/null +++ b/uni_modules/uview-ui/components/u-count-to/u-count-to.vue @@ -0,0 +1,184 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-datetime-picker/props.js b/uni_modules/uview-ui/components/u-datetime-picker/props.js new file mode 100644 index 0000000..f44c0f9 --- /dev/null +++ b/uni_modules/uview-ui/components/u-datetime-picker/props.js @@ -0,0 +1,116 @@ +export default { + props: { + // 是否打开组件 + show: { + type: Boolean, + default: uni.$u.props.datetimePicker.show + }, + // 是否展示顶部的操作栏 + showToolbar: { + type: Boolean, + default: uni.$u.props.datetimePicker.showToolbar + }, + // 绑定值 + value: { + type: [String, Number], + default: uni.$u.props.datetimePicker.value + }, + // 顶部标题 + title: { + type: String, + default: uni.$u.props.datetimePicker.title + }, + // 展示格式,mode=date为日期选择,mode=time为时间选择,mode=year-month为年月选择,mode=datetime为日期时间选择 + mode: { + type: String, + default: uni.$u.props.datetimePicker.mode + }, + // 可选的最大时间 + maxDate: { + type: Number, + // 最大默认值为后10年 + default: uni.$u.props.datetimePicker.maxDate + }, + // 可选的最小时间 + minDate: { + type: Number, + // 最小默认值为前10年 + default: uni.$u.props.datetimePicker.minDate + }, + // 可选的最小小时,仅mode=time有效 + minHour: { + type: Number, + default: uni.$u.props.datetimePicker.minHour + }, + // 可选的最大小时,仅mode=time有效 + maxHour: { + type: Number, + default: uni.$u.props.datetimePicker.maxHour + }, + // 可选的最小分钟,仅mode=time有效 + minMinute: { + type: Number, + default: uni.$u.props.datetimePicker.minMinute + }, + // 可选的最大分钟,仅mode=time有效 + maxMinute: { + type: Number, + default: uni.$u.props.datetimePicker.maxMinute + }, + // 选项过滤函数 + filter: { + type: [Function, null], + default: uni.$u.props.datetimePicker.filter + }, + // 选项格式化函数 + formatter: { + type: [Function, null], + default: uni.$u.props.datetimePicker.formatter + }, + // 是否显示加载中状态 + loading: { + type: Boolean, + default: uni.$u.props.datetimePicker.loading + }, + // 各列中,单个选项的高度 + itemHeight: { + type: [String, Number], + default: uni.$u.props.datetimePicker.itemHeight + }, + // 取消按钮的文字 + cancelText: { + type: String, + default: uni.$u.props.datetimePicker.cancelText + }, + // 确认按钮的文字 + confirmText: { + type: String, + default: uni.$u.props.datetimePicker.confirmText + }, + // 取消按钮的颜色 + cancelColor: { + type: String, + default: uni.$u.props.datetimePicker.cancelColor + }, + // 确认按钮的颜色 + confirmColor: { + type: String, + default: uni.$u.props.datetimePicker.confirmColor + }, + // 每列中可见选项的数量 + visibleItemCount: { + type: [String, Number], + default: uni.$u.props.datetimePicker.visibleItemCount + }, + // 是否允许点击遮罩关闭选择器 + closeOnClickOverlay: { + type: Boolean, + default: uni.$u.props.datetimePicker.closeOnClickOverlay + }, + // 各列的默认索引 + defaultIndex: { + type: Array, + default: uni.$u.props.datetimePicker.defaultIndex + } + } +} diff --git a/uni_modules/uview-ui/components/u-datetime-picker/u-datetime-picker.vue b/uni_modules/uview-ui/components/u-datetime-picker/u-datetime-picker.vue new file mode 100644 index 0000000..18d8dcc --- /dev/null +++ b/uni_modules/uview-ui/components/u-datetime-picker/u-datetime-picker.vue @@ -0,0 +1,360 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-divider/props.js b/uni_modules/uview-ui/components/u-divider/props.js new file mode 100644 index 0000000..1fa8359 --- /dev/null +++ b/uni_modules/uview-ui/components/u-divider/props.js @@ -0,0 +1,44 @@ +export default { + props: { + // 是否虚线 + dashed: { + type: Boolean, + default: uni.$u.props.divider.dashed + }, + // 是否细线 + hairline: { + type: Boolean, + default: uni.$u.props.divider.hairline + }, + // 是否以点替代文字,优先于text字段起作用 + dot: { + type: Boolean, + default: uni.$u.props.divider.dot + }, + // 内容文本的位置,left-左边,center-中间,right-右边 + textPosition: { + type: String, + default: uni.$u.props.divider.textPosition + }, + // 文本内容 + text: { + type: [String, Number], + default: uni.$u.props.divider.text + }, + // 文本大小 + textSize: { + type: [String, Number], + default: uni.$u.props.divider.textSize + }, + // 文本颜色 + textColor: { + type: String, + default: uni.$u.props.divider.textColor + }, + // 线条颜色 + lineColor: { + type: String, + default: uni.$u.props.divider.lineColor + } + } +} diff --git a/uni_modules/uview-ui/components/u-divider/u-divider.vue b/uni_modules/uview-ui/components/u-divider/u-divider.vue new file mode 100644 index 0000000..b629da6 --- /dev/null +++ b/uni_modules/uview-ui/components/u-divider/u-divider.vue @@ -0,0 +1,116 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-dropdown-item/props.js b/uni_modules/uview-ui/components/u-dropdown-item/props.js new file mode 100644 index 0000000..501a1f0 --- /dev/null +++ b/uni_modules/uview-ui/components/u-dropdown-item/props.js @@ -0,0 +1,36 @@ +export default { + props: { + // 当前选中项的value值 + value: { + type: [Number, String, Array], + default: '' + }, + // 菜单项标题 + title: { + type: [String, Number], + default: '' + }, + // 选项数据,如果传入了默认slot,此参数无效 + options: { + type: Array, + default() { + return [] + } + }, + // 是否禁用此菜单项 + disabled: { + type: Boolean, + default: false + }, + // 下拉弹窗的高度 + height: { + type: [Number, String], + default: 'auto' + }, + // 点击遮罩是否可以收起弹窗 + closeOnClickOverlay: { + type: Boolean, + default: true + } + } +} diff --git a/uni_modules/uview-ui/components/u-dropdown-item/u-dropdown-item.vue b/uni_modules/uview-ui/components/u-dropdown-item/u-dropdown-item.vue new file mode 100644 index 0000000..f830291 --- /dev/null +++ b/uni_modules/uview-ui/components/u-dropdown-item/u-dropdown-item.vue @@ -0,0 +1,127 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-dropdown/props.js b/uni_modules/uview-ui/components/u-dropdown/props.js new file mode 100644 index 0000000..5f8465e --- /dev/null +++ b/uni_modules/uview-ui/components/u-dropdown/props.js @@ -0,0 +1,65 @@ +export default { + props: { + // 标题选中时的样式 + activeStyle: { + type: [String, Object], + default: () => ({ + color: '#2979ff', + fontSize: '14px' + }) + }, + // 标题未选中时的样式 + inactiveStyle: { + type: [String, Object], + default: () => ({ + color: '#606266', + fontSize: '14px' + }) + }, + // 点击遮罩是否关闭菜单 + closeOnClickMask: { + type: Boolean, + default: true + }, + // 点击当前激活项标题是否关闭菜单 + closeOnClickSelf: { + type: Boolean, + default: true + }, + // 过渡时间 + duration: { + type: [Number, String], + default: 300 + }, + // 标题菜单的高度 + height: { + type: [Number, String], + default: 40 + }, + // 是否显示下边框 + borderBottom: { + type: Boolean, + default: false + }, + // 标题的字体大小 + titleSize: { + type: [Number, String], + default: 14 + }, + // 下拉出来的内容部分的圆角值 + borderRadius: { + type: [Number, String], + default: 0 + }, + // 菜单右侧的icon图标 + menuIcon: { + type: String, + default: 'arrow-down' + }, + // 菜单右侧图标的大小 + menuIconSize: { + type: [Number, String], + default: 14 + } + } +} diff --git a/uni_modules/uview-ui/components/u-dropdown/u-dropdown.vue b/uni_modules/uview-ui/components/u-dropdown/u-dropdown.vue new file mode 100644 index 0000000..f830291 --- /dev/null +++ b/uni_modules/uview-ui/components/u-dropdown/u-dropdown.vue @@ -0,0 +1,127 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-empty/props.js b/uni_modules/uview-ui/components/u-empty/props.js new file mode 100644 index 0000000..78662f8 --- /dev/null +++ b/uni_modules/uview-ui/components/u-empty/props.js @@ -0,0 +1,59 @@ +export default { + props: { + // 内置图标名称,或图片路径,建议绝对路径 + icon: { + type: String, + default: uni.$u.props.empty.icon + }, + // 提示文字 + text: { + type: String, + default: uni.$u.props.empty.text + }, + // 文字颜色 + textColor: { + type: String, + default: uni.$u.props.empty.textColor + }, + // 文字大小 + textSize: { + type: [String, Number], + default: uni.$u.props.empty.textSize + }, + // 图标的颜色 + iconColor: { + type: String, + default: uni.$u.props.empty.iconColor + }, + // 图标的大小 + iconSize: { + type: [String, Number], + default: uni.$u.props.empty.iconSize + }, + // 选择预置的图标类型 + mode: { + type: String, + default: uni.$u.props.empty.mode + }, + // 图标宽度,单位px + width: { + type: [String, Number], + default: uni.$u.props.empty.width + }, + // 图标高度,单位px + height: { + type: [String, Number], + default: uni.$u.props.empty.height + }, + // 是否显示组件 + show: { + type: Boolean, + default: uni.$u.props.empty.show + }, + // 组件距离上一个元素之间的距离,默认px单位 + marginTop: { + type: [String, Number], + default: uni.$u.props.empty.marginTop + } + } +} diff --git a/uni_modules/uview-ui/components/u-empty/u-empty.vue b/uni_modules/uview-ui/components/u-empty/u-empty.vue new file mode 100644 index 0000000..03d6a27 --- /dev/null +++ b/uni_modules/uview-ui/components/u-empty/u-empty.vue @@ -0,0 +1,128 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-form-item/props.js b/uni_modules/uview-ui/components/u-form-item/props.js new file mode 100644 index 0000000..7b16655 --- /dev/null +++ b/uni_modules/uview-ui/components/u-form-item/props.js @@ -0,0 +1,48 @@ +export default { + props: { + // input的label提示语 + label: { + type: String, + default: uni.$u.props.formItem.label + }, + // 绑定的值 + prop: { + type: String, + default: uni.$u.props.formItem.prop + }, + // 是否显示表单域的下划线边框 + borderBottom: { + type: [String, Boolean], + default: uni.$u.props.formItem.borderBottom + }, + // label的位置,left-左边,top-上边 + labelPosition: { + type: String, + default: uni.$u.props.formItem.labelPosition + }, + // label的宽度,单位px + labelWidth: { + type: [String, Number], + default: uni.$u.props.formItem.labelWidth + }, + // 右侧图标 + rightIcon: { + type: String, + default: uni.$u.props.formItem.rightIcon + }, + // 左侧图标 + leftIcon: { + type: String, + default: uni.$u.props.formItem.leftIcon + }, + // 是否显示左边的必填星号,只作显示用,具体校验必填的逻辑,请在rules中配置 + required: { + type: Boolean, + default: uni.$u.props.formItem.required + }, + leftIconStyle: { + type: [String, Object], + default: uni.$u.props.formItem.leftIconStyle, + } + } +} diff --git a/uni_modules/uview-ui/components/u-form-item/u-form-item.vue b/uni_modules/uview-ui/components/u-form-item/u-form-item.vue new file mode 100644 index 0000000..6aa8d69 --- /dev/null +++ b/uni_modules/uview-ui/components/u-form-item/u-form-item.vue @@ -0,0 +1,235 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-form/props.js b/uni_modules/uview-ui/components/u-form/props.js new file mode 100644 index 0000000..f2a629c --- /dev/null +++ b/uni_modules/uview-ui/components/u-form/props.js @@ -0,0 +1,45 @@ +export default { + props: { + // 当前form的需要验证字段的集合 + model: { + type: Object, + default: uni.$u.props.form.model + }, + // 验证规则 + rules: { + type: [Object, Function, Array], + default: uni.$u.props.form.rules + }, + // 有错误时的提示方式,message-提示信息,toast-进行toast提示 + // border-bottom-下边框呈现红色,none-无提示 + errorType: { + type: String, + default: uni.$u.props.form.errorType + }, + // 是否显示表单域的下划线边框 + borderBottom: { + type: Boolean, + default: uni.$u.props.form.borderBottom + }, + // label的位置,left-左边,top-上边 + labelPosition: { + type: String, + default: uni.$u.props.form.labelPosition + }, + // label的宽度,单位px + labelWidth: { + type: [String, Number], + default: uni.$u.props.form.labelWidth + }, + // lable字体的对齐方式 + labelAlign: { + type: String, + default: uni.$u.props.form.labelAlign + }, + // lable的样式,对象形式 + labelStyle: { + type: Object, + default: uni.$u.props.form.labelStyle + } + } +} diff --git a/uni_modules/uview-ui/components/u-form/u-form.vue b/uni_modules/uview-ui/components/u-form/u-form.vue new file mode 100644 index 0000000..fe2dde2 --- /dev/null +++ b/uni_modules/uview-ui/components/u-form/u-form.vue @@ -0,0 +1,214 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-gap/props.js b/uni_modules/uview-ui/components/u-gap/props.js new file mode 100644 index 0000000..89953e3 --- /dev/null +++ b/uni_modules/uview-ui/components/u-gap/props.js @@ -0,0 +1,24 @@ +export default { + props: { + // 背景颜色(默认transparent) + bgColor: { + type: String, + default: uni.$u.props.gap.bgColor + }, + // 分割槽高度,单位px(默认30) + height: { + type: [String, Number], + default: uni.$u.props.gap.height + }, + // 与上一个组件的距离 + marginTop: { + type: [String, Number], + default: uni.$u.props.gap.marginTop + }, + // 与下一个组件的距离 + marginBottom: { + type: [String, Number], + default: uni.$u.props.gap.marginBottom + } + } +} diff --git a/uni_modules/uview-ui/components/u-gap/u-gap.vue b/uni_modules/uview-ui/components/u-gap/u-gap.vue new file mode 100644 index 0000000..e4429f0 --- /dev/null +++ b/uni_modules/uview-ui/components/u-gap/u-gap.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-grid-item/props.js b/uni_modules/uview-ui/components/u-grid-item/props.js new file mode 100644 index 0000000..06c3c66 --- /dev/null +++ b/uni_modules/uview-ui/components/u-grid-item/props.js @@ -0,0 +1,14 @@ +export default { + props: { + // 宫格的name + name: { + type: [String, Number, null], + default: uni.$u.props.gridItem.name + }, + // 背景颜色 + bgColor: { + type: String, + default: uni.$u.props.gridItem.bgColor + } + } +} diff --git a/uni_modules/uview-ui/components/u-grid-item/u-grid-item.vue b/uni_modules/uview-ui/components/u-grid-item/u-grid-item.vue new file mode 100644 index 0000000..fc0c7cf --- /dev/null +++ b/uni_modules/uview-ui/components/u-grid-item/u-grid-item.vue @@ -0,0 +1,209 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-grid/props.js b/uni_modules/uview-ui/components/u-grid/props.js new file mode 100644 index 0000000..87b0f6a --- /dev/null +++ b/uni_modules/uview-ui/components/u-grid/props.js @@ -0,0 +1,19 @@ +export default { + props: { + // 分成几列 + col: { + type: [String, Number], + default: uni.$u.props.grid.col + }, + // 是否显示边框 + border: { + type: Boolean, + default: uni.$u.props.grid.border + }, + // 宫格对齐方式,表现为数量少的时候,靠左,居中,还是靠右 + align: { + type: String, + default: uni.$u.props.grid.align + } + } +} diff --git a/uni_modules/uview-ui/components/u-grid/u-grid.vue b/uni_modules/uview-ui/components/u-grid/u-grid.vue new file mode 100644 index 0000000..b43cc27 --- /dev/null +++ b/uni_modules/uview-ui/components/u-grid/u-grid.vue @@ -0,0 +1,97 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-icon/icons.js b/uni_modules/uview-ui/components/u-icon/icons.js new file mode 100644 index 0000000..f4d0fe2 --- /dev/null +++ b/uni_modules/uview-ui/components/u-icon/icons.js @@ -0,0 +1,214 @@ +export default { + 'uicon-level': '\ue693', + 'uicon-column-line': '\ue68e', + 'uicon-checkbox-mark': '\ue807', + 'uicon-folder': '\ue7f5', + 'uicon-movie': '\ue7f6', + 'uicon-star-fill': '\ue669', + 'uicon-star': '\ue65f', + 'uicon-phone-fill': '\ue64f', + 'uicon-phone': '\ue622', + 'uicon-apple-fill': '\ue881', + 'uicon-chrome-circle-fill': '\ue885', + 'uicon-backspace': '\ue67b', + 'uicon-attach': '\ue632', + 'uicon-cut': '\ue948', + 'uicon-empty-car': '\ue602', + 'uicon-empty-coupon': '\ue682', + 'uicon-empty-address': '\ue646', + 'uicon-empty-favor': '\ue67c', + 'uicon-empty-permission': '\ue686', + 'uicon-empty-news': '\ue687', + 'uicon-empty-search': '\ue664', + 'uicon-github-circle-fill': '\ue887', + 'uicon-rmb': '\ue608', + 'uicon-person-delete-fill': '\ue66a', + 'uicon-reload': '\ue788', + 'uicon-order': '\ue68f', + 'uicon-server-man': '\ue6bc', + 'uicon-search': '\ue62a', + 'uicon-fingerprint': '\ue955', + 'uicon-more-dot-fill': '\ue630', + 'uicon-scan': '\ue662', + 'uicon-share-square': '\ue60b', + 'uicon-map': '\ue61d', + 'uicon-map-fill': '\ue64e', + 'uicon-tags': '\ue629', + 'uicon-tags-fill': '\ue651', + 'uicon-bookmark-fill': '\ue63b', + 'uicon-bookmark': '\ue60a', + 'uicon-eye': '\ue613', + 'uicon-eye-fill': '\ue641', + 'uicon-mic': '\ue64a', + 'uicon-mic-off': '\ue649', + 'uicon-calendar': '\ue66e', + 'uicon-calendar-fill': '\ue634', + 'uicon-trash': '\ue623', + 'uicon-trash-fill': '\ue658', + 'uicon-play-left': '\ue66d', + 'uicon-play-right': '\ue610', + 'uicon-minus': '\ue618', + 'uicon-plus': '\ue62d', + 'uicon-info': '\ue653', + 'uicon-info-circle': '\ue7d2', + 'uicon-info-circle-fill': '\ue64b', + 'uicon-question': '\ue715', + 'uicon-error': '\ue6d3', + 'uicon-close': '\ue685', + 'uicon-checkmark': '\ue6a8', + 'uicon-android-circle-fill': '\ue67e', + 'uicon-android-fill': '\ue67d', + 'uicon-ie': '\ue87b', + 'uicon-IE-circle-fill': '\ue889', + 'uicon-google': '\ue87a', + 'uicon-google-circle-fill': '\ue88a', + 'uicon-setting-fill': '\ue872', + 'uicon-setting': '\ue61f', + 'uicon-minus-square-fill': '\ue855', + 'uicon-plus-square-fill': '\ue856', + 'uicon-heart': '\ue7df', + 'uicon-heart-fill': '\ue851', + 'uicon-camera': '\ue7d7', + 'uicon-camera-fill': '\ue870', + 'uicon-more-circle': '\ue63e', + 'uicon-more-circle-fill': '\ue645', + 'uicon-chat': '\ue620', + 'uicon-chat-fill': '\ue61e', + 'uicon-bag-fill': '\ue617', + 'uicon-bag': '\ue619', + 'uicon-error-circle-fill': '\ue62c', + 'uicon-error-circle': '\ue624', + 'uicon-close-circle': '\ue63f', + 'uicon-close-circle-fill': '\ue637', + 'uicon-checkmark-circle': '\ue63d', + 'uicon-checkmark-circle-fill': '\ue635', + 'uicon-question-circle-fill': '\ue666', + 'uicon-question-circle': '\ue625', + 'uicon-share': '\ue631', + 'uicon-share-fill': '\ue65e', + 'uicon-shopping-cart': '\ue621', + 'uicon-shopping-cart-fill': '\ue65d', + 'uicon-bell': '\ue609', + 'uicon-bell-fill': '\ue640', + 'uicon-list': '\ue650', + 'uicon-list-dot': '\ue616', + 'uicon-zhihu': '\ue6ba', + 'uicon-zhihu-circle-fill': '\ue709', + 'uicon-zhifubao': '\ue6b9', + 'uicon-zhifubao-circle-fill': '\ue6b8', + 'uicon-weixin-circle-fill': '\ue6b1', + 'uicon-weixin-fill': '\ue6b2', + 'uicon-twitter-circle-fill': '\ue6ab', + 'uicon-twitter': '\ue6aa', + 'uicon-taobao-circle-fill': '\ue6a7', + 'uicon-taobao': '\ue6a6', + 'uicon-weibo-circle-fill': '\ue6a5', + 'uicon-weibo': '\ue6a4', + 'uicon-qq-fill': '\ue6a1', + 'uicon-qq-circle-fill': '\ue6a0', + 'uicon-moments-circel-fill': '\ue69a', + 'uicon-moments': '\ue69b', + 'uicon-qzone': '\ue695', + 'uicon-qzone-circle-fill': '\ue696', + 'uicon-baidu-circle-fill': '\ue680', + 'uicon-baidu': '\ue681', + 'uicon-facebook-circle-fill': '\ue68a', + 'uicon-facebook': '\ue689', + 'uicon-car': '\ue60c', + 'uicon-car-fill': '\ue636', + 'uicon-warning-fill': '\ue64d', + 'uicon-warning': '\ue694', + 'uicon-clock-fill': '\ue638', + 'uicon-clock': '\ue60f', + 'uicon-edit-pen': '\ue612', + 'uicon-edit-pen-fill': '\ue66b', + 'uicon-email': '\ue611', + 'uicon-email-fill': '\ue642', + 'uicon-minus-circle': '\ue61b', + 'uicon-minus-circle-fill': '\ue652', + 'uicon-plus-circle': '\ue62e', + 'uicon-plus-circle-fill': '\ue661', + 'uicon-file-text': '\ue663', + 'uicon-file-text-fill': '\ue665', + 'uicon-pushpin': '\ue7e3', + 'uicon-pushpin-fill': '\ue86e', + 'uicon-grid': '\ue673', + 'uicon-grid-fill': '\ue678', + 'uicon-play-circle': '\ue647', + 'uicon-play-circle-fill': '\ue655', + 'uicon-pause-circle-fill': '\ue654', + 'uicon-pause': '\ue8fa', + 'uicon-pause-circle': '\ue643', + 'uicon-eye-off': '\ue648', + 'uicon-eye-off-outline': '\ue62b', + 'uicon-gift-fill': '\ue65c', + 'uicon-gift': '\ue65b', + 'uicon-rmb-circle-fill': '\ue657', + 'uicon-rmb-circle': '\ue677', + 'uicon-kefu-ermai': '\ue656', + 'uicon-server-fill': '\ue751', + 'uicon-coupon-fill': '\ue8c4', + 'uicon-coupon': '\ue8ae', + 'uicon-integral': '\ue704', + 'uicon-integral-fill': '\ue703', + 'uicon-home-fill': '\ue964', + 'uicon-home': '\ue965', + 'uicon-hourglass-half-fill': '\ue966', + 'uicon-hourglass': '\ue967', + 'uicon-account': '\ue628', + 'uicon-plus-people-fill': '\ue626', + 'uicon-minus-people-fill': '\ue615', + 'uicon-account-fill': '\ue614', + 'uicon-thumb-down-fill': '\ue726', + 'uicon-thumb-down': '\ue727', + 'uicon-thumb-up': '\ue733', + 'uicon-thumb-up-fill': '\ue72f', + 'uicon-lock-fill': '\ue979', + 'uicon-lock-open': '\ue973', + 'uicon-lock-opened-fill': '\ue974', + 'uicon-lock': '\ue97a', + 'uicon-red-packet-fill': '\ue690', + 'uicon-photo-fill': '\ue98b', + 'uicon-photo': '\ue98d', + 'uicon-volume-off-fill': '\ue659', + 'uicon-volume-off': '\ue644', + 'uicon-volume-fill': '\ue670', + 'uicon-volume': '\ue633', + 'uicon-red-packet': '\ue691', + 'uicon-download': '\ue63c', + 'uicon-arrow-up-fill': '\ue6b0', + 'uicon-arrow-down-fill': '\ue600', + 'uicon-play-left-fill': '\ue675', + 'uicon-play-right-fill': '\ue676', + 'uicon-rewind-left-fill': '\ue679', + 'uicon-rewind-right-fill': '\ue67a', + 'uicon-arrow-downward': '\ue604', + 'uicon-arrow-leftward': '\ue601', + 'uicon-arrow-rightward': '\ue603', + 'uicon-arrow-upward': '\ue607', + 'uicon-arrow-down': '\ue60d', + 'uicon-arrow-right': '\ue605', + 'uicon-arrow-left': '\ue60e', + 'uicon-arrow-up': '\ue606', + 'uicon-skip-back-left': '\ue674', + 'uicon-skip-forward-right': '\ue672', + 'uicon-rewind-right': '\ue66f', + 'uicon-rewind-left': '\ue671', + 'uicon-arrow-right-double': '\ue68d', + 'uicon-arrow-left-double': '\ue68c', + 'uicon-wifi-off': '\ue668', + 'uicon-wifi': '\ue667', + 'uicon-empty-data': '\ue62f', + 'uicon-empty-history': '\ue684', + 'uicon-empty-list': '\ue68b', + 'uicon-empty-page': '\ue627', + 'uicon-empty-order': '\ue639', + 'uicon-man': '\ue697', + 'uicon-woman': '\ue69c', + 'uicon-man-add': '\ue61c', + 'uicon-man-add-fill': '\ue64c', + 'uicon-man-delete': '\ue61a', + 'uicon-man-delete-fill': '\ue66a', + 'uicon-zh': '\ue70a', + 'uicon-en': '\ue692' +} diff --git a/uni_modules/uview-ui/components/u-icon/props.js b/uni_modules/uview-ui/components/u-icon/props.js new file mode 100644 index 0000000..71845b7 --- /dev/null +++ b/uni_modules/uview-ui/components/u-icon/props.js @@ -0,0 +1,89 @@ +export default { + props: { + // 图标类名 + name: { + type: String, + default: uni.$u.props.icon.name + }, + // 图标颜色,可接受主题色 + color: { + type: String, + default: uni.$u.props.icon.color + }, + // 字体大小,单位px + size: { + type: [String, Number], + default: uni.$u.props.icon.size + }, + // 是否显示粗体 + bold: { + type: Boolean, + default: uni.$u.props.icon.bold + }, + // 点击图标的时候传递事件出去的index(用于区分点击了哪一个) + index: { + type: [String, Number], + default: uni.$u.props.icon.index + }, + // 触摸图标时的类名 + hoverClass: { + type: String, + default: uni.$u.props.icon.hoverClass + }, + // 自定义扩展前缀,方便用户扩展自己的图标库 + customPrefix: { + type: String, + default: uni.$u.props.icon.customPrefix + }, + // 图标右边或者下面的文字 + label: { + type: [String, Number], + default: uni.$u.props.icon.label + }, + // label的位置,只能右边或者下边 + labelPos: { + type: String, + default: uni.$u.props.icon.labelPos + }, + // label的大小 + labelSize: { + type: [String, Number], + default: uni.$u.props.icon.labelSize + }, + // label的颜色 + labelColor: { + type: String, + default: uni.$u.props.icon.labelColor + }, + // label与图标的距离 + space: { + type: [String, Number], + default: uni.$u.props.icon.space + }, + // 图片的mode + imgMode: { + type: String, + default: uni.$u.props.icon.imgMode + }, + // 用于显示图片小图标时,图片的宽度 + width: { + type: [String, Number], + default: uni.$u.props.icon.width + }, + // 用于显示图片小图标时,图片的高度 + height: { + type: [String, Number], + default: uni.$u.props.icon.height + }, + // 用于解决某些情况下,让图标垂直居中的用途 + top: { + type: [String, Number], + default: uni.$u.props.icon.top + }, + // 是否阻止事件传播 + stop: { + type: Boolean, + default: uni.$u.props.icon.stop + } + } +} diff --git a/uni_modules/uview-ui/components/u-icon/u-icon.vue b/uni_modules/uview-ui/components/u-icon/u-icon.vue new file mode 100644 index 0000000..9340328 --- /dev/null +++ b/uni_modules/uview-ui/components/u-icon/u-icon.vue @@ -0,0 +1,234 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-image/props.js b/uni_modules/uview-ui/components/u-image/props.js new file mode 100644 index 0000000..2eabb74 --- /dev/null +++ b/uni_modules/uview-ui/components/u-image/props.js @@ -0,0 +1,84 @@ +export default { + props: { + // 图片地址 + src: { + type: String, + default: uni.$u.props.image.src + }, + // 裁剪模式 + mode: { + type: String, + default: uni.$u.props.image.mode + }, + // 宽度,单位任意 + width: { + type: [String, Number], + default: uni.$u.props.image.width + }, + // 高度,单位任意 + height: { + type: [String, Number], + default: uni.$u.props.image.height + }, + // 图片形状,circle-圆形,square-方形 + shape: { + type: String, + default: uni.$u.props.image.shape + }, + // 圆角,单位任意 + radius: { + type: [String, Number], + default: uni.$u.props.image.radius + }, + // 是否懒加载,微信小程序、App、百度小程序、字节跳动小程序 + lazyLoad: { + type: Boolean, + default: uni.$u.props.image.lazyLoad + }, + // 开启长按图片显示识别微信小程序码菜单 + showMenuByLongpress: { + type: Boolean, + default: uni.$u.props.image.showMenuByLongpress + }, + // 加载中的图标,或者小图片 + loadingIcon: { + type: String, + default: uni.$u.props.image.loadingIcon + }, + // 加载失败的图标,或者小图片 + errorIcon: { + type: String, + default: uni.$u.props.image.errorIcon + }, + // 是否显示加载中的图标或者自定义的slot + showLoading: { + type: Boolean, + default: uni.$u.props.image.showLoading + }, + // 是否显示加载错误的图标或者自定义的slot + showError: { + type: Boolean, + default: uni.$u.props.image.showError + }, + // 是否需要淡入效果 + fade: { + type: Boolean, + default: uni.$u.props.image.fade + }, + // 只支持网络资源,只对微信小程序有效 + webp: { + type: Boolean, + default: uni.$u.props.image.webp + }, + // 过渡时间,单位ms + duration: { + type: [String, Number], + default: uni.$u.props.image.duration + }, + // 背景颜色,用于深色页面加载图片时,为了和背景色融合 + bgColor: { + type: String, + default: uni.$u.props.image.bgColor + } + } +} diff --git a/uni_modules/uview-ui/components/u-image/u-image.vue b/uni_modules/uview-ui/components/u-image/u-image.vue new file mode 100644 index 0000000..473e35b --- /dev/null +++ b/uni_modules/uview-ui/components/u-image/u-image.vue @@ -0,0 +1,232 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-index-anchor/props.js b/uni_modules/uview-ui/components/u-index-anchor/props.js new file mode 100644 index 0000000..6d8b59a --- /dev/null +++ b/uni_modules/uview-ui/components/u-index-anchor/props.js @@ -0,0 +1,29 @@ +export default { + props: { + // 列表锚点文本内容 + text: { + type: [String, Number], + default: uni.$u.props.indexAnchor.text + }, + // 列表锚点文字颜色 + color: { + type: String, + default: uni.$u.props.indexAnchor.color + }, + // 列表锚点文字大小,单位默认px + size: { + type: [String, Number], + default: uni.$u.props.indexAnchor.size + }, + // 列表锚点背景颜色 + bgColor: { + type: String, + default: uni.$u.props.indexAnchor.bgColor + }, + // 列表锚点高度,单位默认px + height: { + type: [String, Number], + default: uni.$u.props.indexAnchor.height + } + } +} diff --git a/uni_modules/uview-ui/components/u-index-anchor/u-index-anchor.vue b/uni_modules/uview-ui/components/u-index-anchor/u-index-anchor.vue new file mode 100644 index 0000000..b95ddef --- /dev/null +++ b/uni_modules/uview-ui/components/u-index-anchor/u-index-anchor.vue @@ -0,0 +1,91 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-index-item/props.js b/uni_modules/uview-ui/components/u-index-item/props.js new file mode 100644 index 0000000..7c11331 --- /dev/null +++ b/uni_modules/uview-ui/components/u-index-item/props.js @@ -0,0 +1,5 @@ +export default { + props: { + + } +} diff --git a/uni_modules/uview-ui/components/u-index-item/u-index-item.vue b/uni_modules/uview-ui/components/u-index-item/u-index-item.vue new file mode 100644 index 0000000..0bc7fb3 --- /dev/null +++ b/uni_modules/uview-ui/components/u-index-item/u-index-item.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-index-list/props.js b/uni_modules/uview-ui/components/u-index-list/props.js new file mode 100644 index 0000000..354d459 --- /dev/null +++ b/uni_modules/uview-ui/components/u-index-list/props.js @@ -0,0 +1,29 @@ +export default { + props: { + // 右边锚点非激活的颜色 + inactiveColor: { + type: String, + default: uni.$u.props.indexList.inactiveColor + }, + // 右边锚点激活的颜色 + activeColor: { + type: String, + default: uni.$u.props.indexList.activeColor + }, + // 索引字符列表,数组形式 + indexList: { + type: Array, + default: uni.$u.props.indexList.indexList + }, + // 是否开启锚点自动吸顶 + sticky: { + type: Boolean, + default: uni.$u.props.indexList.sticky + }, + // 自定义导航栏的高度 + customNavHeight: { + type: [String, Number], + default: uni.$u.props.indexList.customNavHeight + } + } +} diff --git a/uni_modules/uview-ui/components/u-index-list/u-index-list.vue b/uni_modules/uview-ui/components/u-index-list/u-index-list.vue new file mode 100644 index 0000000..d712618 --- /dev/null +++ b/uni_modules/uview-ui/components/u-index-list/u-index-list.vue @@ -0,0 +1,440 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-input/props.js b/uni_modules/uview-ui/components/u-input/props.js new file mode 100644 index 0000000..2c50870 --- /dev/null +++ b/uni_modules/uview-ui/components/u-input/props.js @@ -0,0 +1,187 @@ +export default { + props: { + // 输入的值 + value: { + type: [String, Number], + default: uni.$u.props.input.value + }, + // 输入框类型 + // number-数字输入键盘,app-vue下可以输入浮点数,app-nvue和小程序平台下只能输入整数 + // idcard-身份证输入键盘,微信、支付宝、百度、QQ小程序 + // digit-带小数点的数字键盘,App的nvue页面、微信、支付宝、百度、头条、QQ小程序 + // text-文本输入键盘 + type: { + type: String, + default: uni.$u.props.input.type + }, + // 如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true, + // 兼容性:微信小程序、百度小程序、字节跳动小程序、QQ小程序 + fixed: { + type: Boolean, + default: uni.$u.props.input.fixed + }, + // 是否禁用输入框 + disabled: { + type: Boolean, + default: uni.$u.props.input.disabled + }, + // 禁用状态时的背景色 + disabledColor: { + type: String, + default: uni.$u.props.input.disabledColor + }, + // 是否显示清除控件 + clearable: { + type: Boolean, + default: uni.$u.props.input.clearable + }, + // 是否密码类型 + password: { + type: Boolean, + default: uni.$u.props.input.password + }, + // 最大输入长度,设置为 -1 的时候不限制最大长度 + maxlength: { + type: [String, Number], + default: uni.$u.props.input.maxlength + }, + // 输入框为空时的占位符 + placeholder: { + type: String, + default: uni.$u.props.input.placeholder + }, + // 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写/deep/ + placeholderClass: { + type: String, + default: uni.$u.props.input.placeholderClass + }, + // 指定placeholder的样式 + placeholderStyle: { + type: [String, Object], + default: uni.$u.props.input.placeholderStyle + }, + // 是否显示输入字数统计,只在 type ="text"或type ="textarea"时有效 + showWordLimit: { + type: Boolean, + default: uni.$u.props.input.showWordLimit + }, + // 设置右下角按钮的文字,有效值:send|search|next|go|done,兼容性详见uni-app文档 + // https://uniapp.dcloud.io/component/input + // https://uniapp.dcloud.io/component/textarea + confirmType: { + type: String, + default: uni.$u.props.input.confirmType + }, + // 点击键盘右下角按钮时是否保持键盘不收起,H5无效 + confirmHold: { + type: Boolean, + default: uni.$u.props.input.confirmHold + }, + // focus时,点击页面的时候不收起键盘,微信小程序有效 + holdKeyboard: { + type: Boolean, + default: uni.$u.props.input.holdKeyboard + }, + // 自动获取焦点 + // 在 H5 平台能否聚焦以及软键盘是否跟随弹出,取决于当前浏览器本身的实现。nvue 页面不支持,需使用组件的 focus()、blur() 方法控制焦点 + focus: { + type: Boolean, + default: uni.$u.props.input.focus + }, + // 键盘收起时,是否自动失去焦点,目前仅App3.0.0+有效 + autoBlur: { + type: Boolean, + default: uni.$u.props.input.autoBlur + }, + // 是否去掉 iOS 下的默认内边距,仅微信小程序,且type=textarea时有效 + disableDefaultPadding: { + type: Boolean, + default: uni.$u.props.input.disableDefaultPadding + }, + // 指定focus时光标的位置 + cursor: { + type: [String, Number], + default: uni.$u.props.input.cursor + }, + // 输入框聚焦时底部与键盘的距离 + cursorSpacing: { + type: [String, Number], + default: uni.$u.props.input.cursorSpacing + }, + // 光标起始位置,自动聚集时有效,需与selection-end搭配使用 + selectionStart: { + type: [String, Number], + default: uni.$u.props.input.selectionStart + }, + // 光标结束位置,自动聚集时有效,需与selection-start搭配使用 + selectionEnd: { + type: [String, Number], + default: uni.$u.props.input.selectionEnd + }, + // 键盘弹起时,是否自动上推页面 + adjustPosition: { + type: Boolean, + default: uni.$u.props.input.adjustPosition + }, + // 输入框内容对齐方式,可选值为:left|center|right + inputAlign: { + type: String, + default: uni.$u.props.input.inputAlign + }, + // 输入框字体的大小 + fontSize: { + type: [String, Number], + default: uni.$u.props.input.fontSize + }, + // 输入框字体颜色 + color: { + type: String, + default: uni.$u.props.input.color + }, + // 输入框前置图标 + prefixIcon: { + type: String, + default: uni.$u.props.input.prefixIcon + }, + // 前置图标样式,对象或字符串 + prefixIconStyle: { + type: [String, Object], + default: uni.$u.props.input.prefixIconStyle + }, + // 输入框后置图标 + suffixIcon: { + type: String, + default: uni.$u.props.input.suffixIcon + }, + // 后置图标样式,对象或字符串 + suffixIconStyle: { + type: [String, Object], + default: uni.$u.props.input.suffixIconStyle + }, + // 边框类型,surround-四周边框,bottom-底部边框,none-无边框 + border: { + type: String, + default: uni.$u.props.input.border + }, + // 是否只读,与disabled不同之处在于disabled会置灰组件,而readonly则不会 + readonly: { + type: Boolean, + default: uni.$u.props.input.readonly + }, + // 输入框形状,circle-圆形,square-方形 + shape: { + type: String, + default: uni.$u.props.input.shape + }, + // 用于处理或者过滤输入框内容的方法 + formatter: { + type: [Function, null], + default: uni.$u.props.input.formatter + }, + // 是否忽略组件内对文本合成系统事件的处理 + ignoreCompositionEvent: { + type: Boolean, + default: true + } + } +} diff --git a/uni_modules/uview-ui/components/u-input/u-input.vue b/uni_modules/uview-ui/components/u-input/u-input.vue new file mode 100644 index 0000000..4c83757 --- /dev/null +++ b/uni_modules/uview-ui/components/u-input/u-input.vue @@ -0,0 +1,354 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-keyboard/props.js b/uni_modules/uview-ui/components/u-keyboard/props.js new file mode 100644 index 0000000..cfdb00a --- /dev/null +++ b/uni_modules/uview-ui/components/u-keyboard/props.js @@ -0,0 +1,84 @@ +export default { + props: { + // 键盘的类型,number-数字键盘,card-身份证键盘,car-车牌号键盘 + mode: { + type: String, + default: uni.$u.props.keyboard.mode + }, + // 是否显示键盘的"."符号 + dotDisabled: { + type: Boolean, + default: uni.$u.props.keyboard.dotDisabled + }, + // 是否显示顶部工具条 + tooltip: { + type: Boolean, + default: uni.$u.props.keyboard.tooltip + }, + // 是否显示工具条中间的提示 + showTips: { + type: Boolean, + default: uni.$u.props.keyboard.showTips + }, + // 工具条中间的提示文字 + tips: { + type: String, + default: uni.$u.props.keyboard.tips + }, + // 是否显示工具条左边的"取消"按钮 + showCancel: { + type: Boolean, + default: uni.$u.props.keyboard.showCancel + }, + // 是否显示工具条右边的"完成"按钮 + showConfirm: { + type: Boolean, + default: uni.$u.props.keyboard.showConfirm + }, + // 是否打乱键盘按键的顺序 + random: { + type: Boolean, + default: uni.$u.props.keyboard.random + }, + // 是否开启底部安全区适配,开启的话,会在iPhoneX机型底部添加一定的内边距 + safeAreaInsetBottom: { + type: Boolean, + default: uni.$u.props.keyboard.safeAreaInsetBottom + }, + // 是否允许通过点击遮罩关闭键盘 + closeOnClickOverlay: { + type: Boolean, + default: uni.$u.props.keyboard.closeOnClickOverlay + }, + // 控制键盘的弹出与收起 + show: { + type: Boolean, + default: uni.$u.props.keyboard.show + }, + // 是否显示遮罩,某些时候数字键盘时,用户希望看到自己的数值,所以可能不想要遮罩 + overlay: { + type: Boolean, + default: uni.$u.props.keyboard.overlay + }, + // z-index值 + zIndex: { + type: [String, Number], + default: uni.$u.props.keyboard.zIndex + }, + // 取消按钮的文字 + cancelText: { + type: String, + default: uni.$u.props.keyboard.cancelText + }, + // 确认按钮的文字 + confirmText: { + type: String, + default: uni.$u.props.keyboard.confirmText + }, + // 输入一个中文后,是否自动切换到英文 + autoChange: { + type: Boolean, + default: uni.$u.props.keyboard.autoChange + } + } +} diff --git a/uni_modules/uview-ui/components/u-keyboard/u-keyboard.vue b/uni_modules/uview-ui/components/u-keyboard/u-keyboard.vue new file mode 100644 index 0000000..14228cb --- /dev/null +++ b/uni_modules/uview-ui/components/u-keyboard/u-keyboard.vue @@ -0,0 +1,164 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-line-progress/props.js b/uni_modules/uview-ui/components/u-line-progress/props.js new file mode 100644 index 0000000..a4210bd --- /dev/null +++ b/uni_modules/uview-ui/components/u-line-progress/props.js @@ -0,0 +1,28 @@ +export default { + props: { + // 激活部分的颜色 + activeColor: { + type: String, + default: uni.$u.props.lineProgress.activeColor + }, + inactiveColor: { + type: String, + default: uni.$u.props.lineProgress.color + }, + // 进度百分比,数值 + percentage: { + type: [String, Number], + default: uni.$u.props.lineProgress.inactiveColor + }, + // 是否在进度条内部显示百分比的值 + showText: { + type: Boolean, + default: uni.$u.props.lineProgress.showText + }, + // 进度条的高度,单位px + height: { + type: [String, Number], + default: uni.$u.props.lineProgress.height + } + } +} diff --git a/uni_modules/uview-ui/components/u-line-progress/u-line-progress.vue b/uni_modules/uview-ui/components/u-line-progress/u-line-progress.vue new file mode 100644 index 0000000..4e27931 --- /dev/null +++ b/uni_modules/uview-ui/components/u-line-progress/u-line-progress.vue @@ -0,0 +1,144 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-line/props.js b/uni_modules/uview-ui/components/u-line/props.js new file mode 100644 index 0000000..2308cc3 --- /dev/null +++ b/uni_modules/uview-ui/components/u-line/props.js @@ -0,0 +1,33 @@ +export default { + props: { + color: { + type: String, + default: uni.$u.props.line.color + }, + // 长度,竖向时表现为高度,横向时表现为长度,可以为百分比,带px单位的值等 + length: { + type: [String, Number], + default: uni.$u.props.line.length + }, + // 线条方向,col-竖向,row-横向 + direction: { + type: String, + default: uni.$u.props.line.direction + }, + // 是否显示细边框 + hairline: { + type: Boolean, + default: uni.$u.props.line.hairline + }, + // 线条与上下左右元素的间距,字符串形式,如"30px"、"20px 30px" + margin: { + type: [String, Number], + default: uni.$u.props.line.margin + }, + // 是否虚线,true-虚线,false-实线 + dashed: { + type: Boolean, + default: uni.$u.props.line.dashed + } + } +} diff --git a/uni_modules/uview-ui/components/u-line/u-line.vue b/uni_modules/uview-ui/components/u-line/u-line.vue new file mode 100644 index 0000000..e0a6d92 --- /dev/null +++ b/uni_modules/uview-ui/components/u-line/u-line.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-link/props.js b/uni_modules/uview-ui/components/u-link/props.js new file mode 100644 index 0000000..d39353f --- /dev/null +++ b/uni_modules/uview-ui/components/u-link/props.js @@ -0,0 +1,39 @@ +export default { + props: { + // 文字颜色 + color: { + type: String, + default: uni.$u.props.link.color + }, + // 字体大小,单位px + fontSize: { + type: [String, Number], + default: uni.$u.props.link.fontSize + }, + // 是否显示下划线 + underLine: { + type: Boolean, + default: uni.$u.props.link.underLine + }, + // 要跳转的链接 + href: { + type: String, + default: uni.$u.props.link.href + }, + // 小程序中复制到粘贴板的提示语 + mpTips: { + type: String, + default: uni.$u.props.link.mpTips + }, + // 下划线颜色 + lineColor: { + type: String, + default: uni.$u.props.link.lineColor + }, + // 超链接的问题,不使用slot形式传入,是因为nvue下无法修改颜色 + text: { + type: String, + default: uni.$u.props.link.text + } + } +} diff --git a/uni_modules/uview-ui/components/u-link/u-link.vue b/uni_modules/uview-ui/components/u-link/u-link.vue new file mode 100644 index 0000000..c6802a5 --- /dev/null +++ b/uni_modules/uview-ui/components/u-link/u-link.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-list-item/props.js b/uni_modules/uview-ui/components/u-list-item/props.js new file mode 100644 index 0000000..58ddc49 --- /dev/null +++ b/uni_modules/uview-ui/components/u-list-item/props.js @@ -0,0 +1,9 @@ +export default { + props: { + // 用于滚动到指定item + anchor: { + type: [String, Number], + default: uni.$u.props.listItem.anchor + } + } +} diff --git a/uni_modules/uview-ui/components/u-list-item/u-list-item.vue b/uni_modules/uview-ui/components/u-list-item/u-list-item.vue new file mode 100644 index 0000000..1a25db6 --- /dev/null +++ b/uni_modules/uview-ui/components/u-list-item/u-list-item.vue @@ -0,0 +1,116 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-list/props.js b/uni_modules/uview-ui/components/u-list/props.js new file mode 100644 index 0000000..25406f4 --- /dev/null +++ b/uni_modules/uview-ui/components/u-list/props.js @@ -0,0 +1,76 @@ +export default { + props: { + // 控制是否出现滚动条,仅nvue有效 + showScrollbar: { + type: Boolean, + default: uni.$u.props.list.showScrollbar + }, + // 距底部多少时触发scrolltolower事件 + lowerThreshold: { + type: [String, Number], + default: uni.$u.props.list.lowerThreshold + }, + // 距顶部多少时触发scrolltoupper事件,非nvue有效 + upperThreshold: { + type: [String, Number], + default: uni.$u.props.list.upperThreshold + }, + // 设置竖向滚动条位置 + scrollTop: { + type: [String, Number], + default: uni.$u.props.list.scrollTop + }, + // 控制 onscroll 事件触发的频率,仅nvue有效 + offsetAccuracy: { + type: [String, Number], + default: uni.$u.props.list.offsetAccuracy + }, + // 启用 flexbox 布局。开启后,当前节点声明了display: flex就会成为flex container,并作用于其孩子节点,仅微信小程序有效 + enableFlex: { + type: Boolean, + default: uni.$u.props.list.enableFlex + }, + // 是否按分页模式显示List,默认值false + pagingEnabled: { + type: Boolean, + default: uni.$u.props.list.pagingEnabled + }, + // 是否允许List滚动 + scrollable: { + type: Boolean, + default: uni.$u.props.list.scrollable + }, + // 值应为某子元素id(id不能以数字开头) + scrollIntoView: { + type: String, + default: uni.$u.props.list.scrollIntoView + }, + // 在设置滚动条位置时使用动画过渡 + scrollWithAnimation: { + type: Boolean, + default: uni.$u.props.list.scrollWithAnimation + }, + // iOS点击顶部状态栏、安卓双击标题栏时,滚动条返回顶部,只对微信小程序有效 + enableBackToTop: { + type: Boolean, + default: uni.$u.props.list.enableBackToTop + }, + // 列表的高度 + height: { + type: [String, Number], + default: uni.$u.props.list.height + }, + // 列表宽度 + width: { + type: [String, Number], + default: uni.$u.props.list.width + }, + // 列表前后预渲染的屏数,1代表一个屏幕的高度,1.5代表1个半屏幕高度 + preLoadScreen: { + type: [String, Number], + default: uni.$u.props.list.preLoadScreen + } + // vue下,是否开启虚拟列表 + + } +} diff --git a/uni_modules/uview-ui/components/u-list/u-list.vue b/uni_modules/uview-ui/components/u-list/u-list.vue new file mode 100644 index 0000000..4447cab --- /dev/null +++ b/uni_modules/uview-ui/components/u-list/u-list.vue @@ -0,0 +1,157 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-loading-icon/props.js b/uni_modules/uview-ui/components/u-loading-icon/props.js new file mode 100644 index 0000000..c35524e --- /dev/null +++ b/uni_modules/uview-ui/components/u-loading-icon/props.js @@ -0,0 +1,59 @@ +export default { + props: { + // 是否显示组件 + show: { + type: Boolean, + default: uni.$u.props.loadingIcon.show + }, + // 颜色 + color: { + type: String, + default: uni.$u.props.loadingIcon.color + }, + // 提示文字颜色 + textColor: { + type: String, + default: uni.$u.props.loadingIcon.textColor + }, + // 文字和图标是否垂直排列 + vertical: { + type: Boolean, + default: uni.$u.props.loadingIcon.vertical + }, + // 模式选择,circle-圆形,spinner-花朵形,semicircle-半圆形 + mode: { + type: String, + default: uni.$u.props.loadingIcon.mode + }, + // 图标大小,单位默认px + size: { + type: [String, Number], + default: uni.$u.props.loadingIcon.size + }, + // 文字大小 + textSize: { + type: [String, Number], + default: uni.$u.props.loadingIcon.textSize + }, + // 文字内容 + text: { + type: [String, Number], + default: uni.$u.props.loadingIcon.text + }, + // 动画模式 + timingFunction: { + type: String, + default: uni.$u.props.loadingIcon.timingFunction + }, + // 动画执行周期时间 + duration: { + type: [String, Number], + default: uni.$u.props.loadingIcon.duration + }, + // mode=circle时的暗边颜色 + inactiveColor: { + type: String, + default: uni.$u.props.loadingIcon.inactiveColor + } + } +} diff --git a/uni_modules/uview-ui/components/u-loading-icon/u-loading-icon.vue b/uni_modules/uview-ui/components/u-loading-icon/u-loading-icon.vue new file mode 100644 index 0000000..2ede5c3 --- /dev/null +++ b/uni_modules/uview-ui/components/u-loading-icon/u-loading-icon.vue @@ -0,0 +1,343 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-loading-page/props.js b/uni_modules/uview-ui/components/u-loading-page/props.js new file mode 100644 index 0000000..e239b61 --- /dev/null +++ b/uni_modules/uview-ui/components/u-loading-page/props.js @@ -0,0 +1,49 @@ +export default { + props: { + // 提示内容 + loadingText: { + type: [String, Number], + default: uni.$u.props.loadingPage.loadingText + }, + // 文字上方用于替换loading动画的图片 + image: { + type: String, + default: uni.$u.props.loadingPage.image + }, + // 加载动画的模式,circle-圆形,spinner-花朵形,semicircle-半圆形 + loadingMode: { + type: String, + default: uni.$u.props.loadingPage.loadingMode + }, + // 是否加载中 + loading: { + type: Boolean, + default: uni.$u.props.loadingPage.loading + }, + // 背景色 + bgColor: { + type: String, + default: uni.$u.props.loadingPage.bgColor + }, + // 文字颜色 + color: { + type: String, + default: uni.$u.props.loadingPage.color + }, + // 文字大小 + fontSize: { + type: [String, Number], + default: uni.$u.props.loadingPage.fontSize + }, + // 图标大小 + iconSize: { + type: [String, Number], + default: uni.$u.props.loadingPage.fontSize + }, + // 加载中图标的颜色,只能rgb或者十六进制颜色值 + loadingColor: { + type: String, + default: uni.$u.props.loadingPage.loadingColor + } + } +} diff --git a/uni_modules/uview-ui/components/u-loading-page/u-loading-page.vue b/uni_modules/uview-ui/components/u-loading-page/u-loading-page.vue new file mode 100644 index 0000000..03a78ad --- /dev/null +++ b/uni_modules/uview-ui/components/u-loading-page/u-loading-page.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-loadmore/props.js b/uni_modules/uview-ui/components/u-loadmore/props.js new file mode 100644 index 0000000..1e67d89 --- /dev/null +++ b/uni_modules/uview-ui/components/u-loadmore/props.js @@ -0,0 +1,94 @@ +export default { + props: { + // 组件状态,loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态 + status: { + type: String, + default: uni.$u.props.loadmore.status + }, + // 组件背景色 + bgColor: { + type: String, + default: uni.$u.props.loadmore.bgColor + }, + // 是否显示加载中的图标 + icon: { + type: Boolean, + default: uni.$u.props.loadmore.icon + }, + // 字体大小 + fontSize: { + type: [String, Number], + default: uni.$u.props.loadmore.fontSize + }, + // 图标大小 + iconSize: { + type: [String, Number], + default: uni.$u.props.loadmore.iconSize + }, + // 字体颜色 + color: { + type: String, + default: uni.$u.props.loadmore.color + }, + // 加载中状态的图标,spinner-花朵状图标,circle-圆圈状,semicircle-半圆 + loadingIcon: { + type: String, + default: uni.$u.props.loadmore.loadingIcon + }, + // 加载前的提示语 + loadmoreText: { + type: String, + default: uni.$u.props.loadmore.loadmoreText + }, + // 加载中提示语 + loadingText: { + type: String, + default: uni.$u.props.loadmore.loadingText + }, + // 没有更多的提示语 + nomoreText: { + type: String, + default: uni.$u.props.loadmore.nomoreText + }, + // 在“没有更多”状态下,是否显示粗点 + isDot: { + type: Boolean, + default: uni.$u.props.loadmore.isDot + }, + // 加载中图标的颜色 + iconColor: { + type: String, + default: uni.$u.props.loadmore.iconColor + }, + // 上边距 + marginTop: { + type: [String, Number], + default: uni.$u.props.loadmore.marginTop + }, + // 下边距 + marginBottom: { + type: [String, Number], + default: uni.$u.props.loadmore.marginBottom + }, + // 高度,单位px + height: { + type: [String, Number], + default: uni.$u.props.loadmore.height + }, + // 是否显示左边分割线 + line: { + type: Boolean, + default: uni.$u.props.loadmore.line + }, + // 线条颜色 + lineColor: { + type: String, + default: uni.$u.props.loadmore.lineColor + }, + // 是否虚线,true-虚线,false-实线 + dashed: { + type: Boolean, + default: uni.$u.props.loadmore.dashed + } + } +} diff --git a/uni_modules/uview-ui/components/u-loadmore/u-loadmore.vue b/uni_modules/uview-ui/components/u-loadmore/u-loadmore.vue new file mode 100644 index 0000000..73c79fe --- /dev/null +++ b/uni_modules/uview-ui/components/u-loadmore/u-loadmore.vue @@ -0,0 +1,150 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-modal/props.js b/uni_modules/uview-ui/components/u-modal/props.js new file mode 100644 index 0000000..94b3078 --- /dev/null +++ b/uni_modules/uview-ui/components/u-modal/props.js @@ -0,0 +1,89 @@ +export default { + props: { + // 是否展示modal + show: { + type: Boolean, + default: uni.$u.props.modal.show + }, + // 标题 + title: { + type: [String], + default: uni.$u.props.modal.title + }, + // 弹窗内容 + content: { + type: String, + default: uni.$u.props.modal.content + }, + // 确认文案 + confirmText: { + type: String, + default: uni.$u.props.modal.confirmText + }, + // 取消文案 + cancelText: { + type: String, + default: uni.$u.props.modal.cancelText + }, + // 是否显示确认按钮 + showConfirmButton: { + type: Boolean, + default: uni.$u.props.modal.showConfirmButton + }, + // 是否显示取消按钮 + showCancelButton: { + type: Boolean, + default: uni.$u.props.modal.showCancelButton + }, + // 确认按钮颜色 + confirmColor: { + type: String, + default: uni.$u.props.modal.confirmColor + }, + // 取消文字颜色 + cancelColor: { + type: String, + default: uni.$u.props.modal.cancelColor + }, + // 对调确认和取消的位置 + buttonReverse: { + type: Boolean, + default: uni.$u.props.modal.buttonReverse + }, + // 是否开启缩放效果 + zoom: { + type: Boolean, + default: uni.$u.props.modal.zoom + }, + // 是否异步关闭,只对确定按钮有效 + asyncClose: { + type: Boolean, + default: uni.$u.props.modal.asyncClose + }, + // 是否允许点击遮罩关闭modal + closeOnClickOverlay: { + type: Boolean, + default: uni.$u.props.modal.closeOnClickOverlay + }, + // 给一个负的margin-top,往上偏移,避免和键盘重合的情况 + negativeTop: { + type: [String, Number], + default: uni.$u.props.modal.negativeTop + }, + // modal宽度,不支持百分比,可以数值,px,rpx单位 + width: { + type: [String, Number], + default: uni.$u.props.modal.width + }, + // 确认按钮的样式,circle-圆形,square-方形,如设置,将不会显示取消按钮 + confirmButtonShape: { + type: String, + default: uni.$u.props.modal.confirmButtonShape + }, + // 弹窗动画过度时间 + duration:{ + type:String | Number, + default: uni.$u.props.modal.duration + } + } +} diff --git a/uni_modules/uview-ui/components/u-modal/u-modal.vue b/uni_modules/uview-ui/components/u-modal/u-modal.vue new file mode 100644 index 0000000..72e1ed2 --- /dev/null +++ b/uni_modules/uview-ui/components/u-modal/u-modal.vue @@ -0,0 +1,228 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-navbar/props.js b/uni_modules/uview-ui/components/u-navbar/props.js new file mode 100644 index 0000000..5398de2 --- /dev/null +++ b/uni_modules/uview-ui/components/u-navbar/props.js @@ -0,0 +1,84 @@ +export default { + props: { + // 是否开启顶部安全区适配 + safeAreaInsetTop: { + type: Boolean, + default: uni.$u.props.navbar.safeAreaInsetTop + }, + // 固定在顶部时,是否生成一个等高元素,以防止塌陷 + placeholder: { + type: Boolean, + default: uni.$u.props.navbar.placeholder + }, + // 是否固定在顶部 + fixed: { + type: Boolean, + default: uni.$u.props.navbar.fixed + }, + // 是否显示下边框 + border: { + type: Boolean, + default: uni.$u.props.navbar.border + }, + // 左边的图标 + leftIcon: { + type: String, + default: uni.$u.props.navbar.leftIcon + }, + // 左边的提示文字 + leftText: { + type: String, + default: uni.$u.props.navbar.leftText + }, + // 左右的提示文字 + rightText: { + type: String, + default: uni.$u.props.navbar.rightText + }, + // 右边的图标 + rightIcon: { + type: String, + default: uni.$u.props.navbar.rightIcon + }, + // 标题 + title: { + type: [String, Number], + default: uni.$u.props.navbar.title + }, + // 背景颜色 + bgColor: { + type: String, + default: uni.$u.props.navbar.bgColor + }, + // 标题的宽度 + titleWidth: { + type: [String, Number], + default: uni.$u.props.navbar.titleWidth + }, + // 导航栏高度 + height: { + type: [String, Number], + default: uni.$u.props.navbar.height + }, + // 左侧返回图标的大小 + leftIconSize: { + type: [String, Number], + default: uni.$u.props.navbar.leftIconSize + }, + // 左侧返回图标的颜色 + leftIconColor: { + type: String, + default: uni.$u.props.navbar.leftIconColor + }, + // 点击左侧区域(返回图标),是否自动返回上一页 + autoBack: { + type: Boolean, + default: uni.$u.props.navbar.autoBack + }, + // 标题的样式,对象或字符串 + titleStyle: { + type: [String, Object], + default: uni.$u.props.navbar.titleStyle + } + } +} diff --git a/uni_modules/uview-ui/components/u-navbar/u-navbar.vue b/uni_modules/uview-ui/components/u-navbar/u-navbar.vue new file mode 100644 index 0000000..2b206b7 --- /dev/null +++ b/uni_modules/uview-ui/components/u-navbar/u-navbar.vue @@ -0,0 +1,186 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-no-network/props.js b/uni_modules/uview-ui/components/u-no-network/props.js new file mode 100644 index 0000000..9f3af62 --- /dev/null +++ b/uni_modules/uview-ui/components/u-no-network/props.js @@ -0,0 +1,19 @@ +export default { + props: { + // 页面文字提示 + tips: { + type: String, + default: uni.$u.props.noNetwork.tips + }, + // 一个z-index值,用于设置没有网络这个组件的层次,因为页面可能会有其他定位的元素层级过高,导致此组件被覆盖 + zIndex: { + type: [String, Number], + default: uni.$u.props.noNetwork.zIndex + }, + // image 没有网络的图片提示 + image: { + type: String, + default: uni.$u.props.noNetwork.image + } + } +} diff --git a/uni_modules/uview-ui/components/u-no-network/u-no-network.vue b/uni_modules/uview-ui/components/u-no-network/u-no-network.vue new file mode 100644 index 0000000..9710729 --- /dev/null +++ b/uni_modules/uview-ui/components/u-no-network/u-no-network.vue @@ -0,0 +1,220 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-notice-bar/props.js b/uni_modules/uview-ui/components/u-notice-bar/props.js new file mode 100644 index 0000000..7040c29 --- /dev/null +++ b/uni_modules/uview-ui/components/u-notice-bar/props.js @@ -0,0 +1,70 @@ +export default { + props: { + // 显示的内容,数组 + text: { + type: [Array, String], + default: uni.$u.props.noticeBar.text + }, + // 通告滚动模式,row-横向滚动,column-竖向滚动 + direction: { + type: String, + default: uni.$u.props.noticeBar.direction + }, + // direction = row时,是否使用步进形式滚动 + step: { + type: Boolean, + default: uni.$u.props.noticeBar.step + }, + // 是否显示左侧的音量图标 + icon: { + type: String, + default: uni.$u.props.noticeBar.icon + }, + // 通告模式,link-显示右箭头,closable-显示右侧关闭图标 + mode: { + type: String, + default: uni.$u.props.noticeBar.mode + }, + // 文字颜色,各图标也会使用文字颜色 + color: { + type: String, + default: uni.$u.props.noticeBar.color + }, + // 背景颜色 + bgColor: { + type: String, + default: uni.$u.props.noticeBar.bgColor + }, + // 水平滚动时的滚动速度,即每秒滚动多少px(px),这有利于控制文字无论多少时,都能有一个恒定的速度 + speed: { + type: [String, Number], + default: uni.$u.props.noticeBar.speed + }, + // 字体大小 + fontSize: { + type: [String, Number], + default: uni.$u.props.noticeBar.fontSize + }, + // 滚动一个周期的时间长,单位ms + duration: { + type: [String, Number], + default: uni.$u.props.noticeBar.duration + }, + // 是否禁止用手滑动切换 + // 目前HX2.6.11,只支持App 2.5.5+、H5 2.5.5+、支付宝小程序、字节跳动小程序 + disableTouch: { + type: Boolean, + default: uni.$u.props.noticeBar.disableTouch + }, + // 跳转的页面路径 + url: { + type: String, + default: uni.$u.props.noticeBar.url + }, + // 页面跳转的类型 + linkType: { + type: String, + default: uni.$u.props.noticeBar.linkType + } + } +} diff --git a/uni_modules/uview-ui/components/u-notice-bar/u-notice-bar.vue b/uni_modules/uview-ui/components/u-notice-bar/u-notice-bar.vue new file mode 100644 index 0000000..a06eb39 --- /dev/null +++ b/uni_modules/uview-ui/components/u-notice-bar/u-notice-bar.vue @@ -0,0 +1,101 @@ + + + + diff --git a/uni_modules/uview-ui/components/u-notify/props.js b/uni_modules/uview-ui/components/u-notify/props.js new file mode 100644 index 0000000..57a9d71 --- /dev/null +++ b/uni_modules/uview-ui/components/u-notify/props.js @@ -0,0 +1,49 @@ +export default { + props: { + // 到顶部的距离 + top: { + type: [String, Number], + default: uni.$u.props.notify.top + }, + // 是否展示组件 + // show: { + // type: Boolean, + // default: uni.$u.props.notify.show + // }, + // type主题,primary,success,warning,error + type: { + type: String, + default: uni.$u.props.notify.type + }, + // 字体颜色 + color: { + type: String, + default: uni.$u.props.notify.color + }, + // 背景颜色 + bgColor: { + type: String, + default: uni.$u.props.notify.bgColor + }, + // 展示的文字内容 + message: { + type: String, + default: uni.$u.props.notify.message + }, + // 展示时长,为0时不消失,单位ms + duration: { + type: [String, Number], + default: uni.$u.props.notify.duration + }, + // 字体大小 + fontSize: { + type: [String, Number], + default: uni.$u.props.notify.fontSize + }, + // 是否留出顶部安全距离(状态栏高度) + safeAreaInsetTop: { + type: Boolean, + default: uni.$u.props.notify.safeAreaInsetTop + } + } +} diff --git a/uni_modules/uview-ui/components/u-notify/u-notify.vue b/uni_modules/uview-ui/components/u-notify/u-notify.vue new file mode 100644 index 0000000..30adb72 --- /dev/null +++ b/uni_modules/uview-ui/components/u-notify/u-notify.vue @@ -0,0 +1,211 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-number-box/props.js b/uni_modules/uview-ui/components/u-number-box/props.js new file mode 100644 index 0000000..fb0fa94 --- /dev/null +++ b/uni_modules/uview-ui/components/u-number-box/props.js @@ -0,0 +1,109 @@ +export default { + props: { + // 步进器标识符,在change回调返回 + name: { + type: [String, Number], + default: uni.$u.props.numberBox.name + }, + // 用于双向绑定的值,初始化时设置设为默认min值(最小值) + value: { + type: [String, Number], + default: uni.$u.props.numberBox.value + }, + // 最小值 + min: { + type: [String, Number], + default: uni.$u.props.numberBox.min + }, + // 最大值 + max: { + type: [String, Number], + default: uni.$u.props.numberBox.max + }, + // 加减的步长,可为小数 + step: { + type: [String, Number], + default: uni.$u.props.numberBox.step + }, + // 是否只允许输入整数 + integer: { + type: Boolean, + default: uni.$u.props.numberBox.integer + }, + // 是否禁用,包括输入框,加减按钮 + disabled: { + type: Boolean, + default: uni.$u.props.numberBox.disabled + }, + // 是否禁用输入框 + disabledInput: { + type: Boolean, + default: uni.$u.props.numberBox.disabledInput + }, + // 是否开启异步变更,开启后需要手动控制输入值 + asyncChange: { + type: Boolean, + default: uni.$u.props.numberBox.asyncChange + }, + // 输入框宽度,单位为px + inputWidth: { + type: [String, Number], + default: uni.$u.props.numberBox.inputWidth + }, + // 是否显示减少按钮 + showMinus: { + type: Boolean, + default: uni.$u.props.numberBox.showMinus + }, + // 是否显示增加按钮 + showPlus: { + type: Boolean, + default: uni.$u.props.numberBox.showPlus + }, + // 显示的小数位数 + decimalLength: { + type: [String, Number, null], + default: uni.$u.props.numberBox.decimalLength + }, + // 是否开启长按加减手势 + longPress: { + type: Boolean, + default: uni.$u.props.numberBox.longPress + }, + // 输入框文字和加减按钮图标的颜色 + color: { + type: String, + default: uni.$u.props.numberBox.color + }, + // 按钮大小,宽高等于此值,单位px,输入框高度和此值保持一致 + buttonSize: { + type: [String, Number], + default: uni.$u.props.numberBox.buttonSize + }, + // 输入框和按钮的背景颜色 + bgColor: { + type: String, + default: uni.$u.props.numberBox.bgColor + }, + // 指定光标于键盘的距离,避免键盘遮挡输入框,单位px + cursorSpacing: { + type: [String, Number], + default: uni.$u.props.numberBox.cursorSpacing + }, + // 是否禁用增加按钮 + disablePlus: { + type: Boolean, + default: uni.$u.props.numberBox.disablePlus + }, + // 是否禁用减少按钮 + disableMinus: { + type: Boolean, + default: uni.$u.props.numberBox.disableMinus + }, + // 加减按钮图标的样式 + iconStyle: { + type: [Object, String], + default: uni.$u.props.numberBox.iconStyle + } + } +} diff --git a/uni_modules/uview-ui/components/u-number-box/u-number-box.vue b/uni_modules/uview-ui/components/u-number-box/u-number-box.vue new file mode 100644 index 0000000..69211c5 --- /dev/null +++ b/uni_modules/uview-ui/components/u-number-box/u-number-box.vue @@ -0,0 +1,416 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-number-keyboard/props.js b/uni_modules/uview-ui/components/u-number-keyboard/props.js new file mode 100644 index 0000000..5e3bf55 --- /dev/null +++ b/uni_modules/uview-ui/components/u-number-keyboard/props.js @@ -0,0 +1,19 @@ +export default { + props: { + // 键盘的类型,number-数字键盘,card-身份证键盘 + mode: { + type: String, + default: uni.$u.props.numberKeyboard.value + }, + // 是否显示键盘的"."符号 + dotDisabled: { + type: Boolean, + default: uni.$u.props.numberKeyboard.dotDisabled + }, + // 是否打乱键盘按键的顺序 + random: { + type: Boolean, + default: uni.$u.props.numberKeyboard.random + } + } +} diff --git a/uni_modules/uview-ui/components/u-number-keyboard/u-number-keyboard.vue b/uni_modules/uview-ui/components/u-number-keyboard/u-number-keyboard.vue new file mode 100644 index 0000000..4f505c6 --- /dev/null +++ b/uni_modules/uview-ui/components/u-number-keyboard/u-number-keyboard.vue @@ -0,0 +1,196 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-overlay/props.js b/uni_modules/uview-ui/components/u-overlay/props.js new file mode 100644 index 0000000..e6974df --- /dev/null +++ b/uni_modules/uview-ui/components/u-overlay/props.js @@ -0,0 +1,24 @@ +export default { + props: { + // 是否显示遮罩 + show: { + type: Boolean, + default: uni.$u.props.overlay.show + }, + // 层级z-index + zIndex: { + type: [String, Number], + default: uni.$u.props.overlay.zIndex + }, + // 遮罩的过渡时间,单位为ms + duration: { + type: [String, Number], + default: uni.$u.props.overlay.duration + }, + // 不透明度值,当做rgba的第四个参数 + opacity: { + type: [String, Number], + default: uni.$u.props.overlay.opacity + } + } +} diff --git a/uni_modules/uview-ui/components/u-overlay/u-overlay.vue b/uni_modules/uview-ui/components/u-overlay/u-overlay.vue new file mode 100644 index 0000000..92de4e9 --- /dev/null +++ b/uni_modules/uview-ui/components/u-overlay/u-overlay.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/uni_modules/uview-ui/components/u-parse/node/node.vue b/uni_modules/uview-ui/components/u-parse/node/node.vue new file mode 100644 index 0000000..73e30fd --- /dev/null +++ b/uni_modules/uview-ui/components/u-parse/node/node.vue @@ -0,0 +1,499 @@ +