!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WSPlayer={})}(this,function(e){"use strict";var t=Object.defineProperty,s=(e,s,i)=>((e,s,i)=>s in e?t(e,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[s]=i)(e,"symbol"!=typeof s?s+"":s,i);const i={websocketPorts:{realmonitor:"realmonitor-websocket",playback:"playback-websocket",realmonitor_ws:"9100",playback_ws:"9320",realmonitor_wss:"9102",playback_wss:"9322"},errorVideoInfoCode:{224:401,227:404,253:503},errorVideoInfo:{100:"浏览器资源不足",101:"当前浏览器不支持硬解码",102:"硬解码播放失败",103:"硬解码播放延时超过8秒",104:"硬解码失败",201:"当前音频无法播放",202:"安全证书验证失败",203:"文件播放完成",205:"设备忙线",210:"请求设备异常",211:"连接异常断开",223:"非法请求视频",224:"码流token过期",226:"码流禁止访问",227:"未查询到设备码流",248:"当前传输方式不支持",250:"服务器内部报错",253:"当前拉流服务不正确",254:"网络异常",258:"设备账户锁定,无法拉流",401:"码流token过期",404:"未查询到设备码流",405:"播放超时",406:"视频流类型解析失败,请检查通道配置",407:"请求超时",408:"请求超时",409:"服务未推送码流",410:"视频流异常断开",411:"录像播放完成",457:"时间设置错误",503:"当前拉流服务不正确",504:"对讲失败",701:"Chrome版本低,请升级到最新的Chrome版本",702:"Firefox版本低,请升级到最新的Firefox版本",703:"Edge版本低,请升级到最新的Edge版本",defaultErrorMsg:"播放失败,请检查配置"},errorInfo:{101:"所选通道离线,无法播放",102:"登录权限过期,查询实时预览rtsp失败",103:"获取实时预览rtsp失败",104:"操作失败,请稍后重试",105:"通道休眠,正在唤醒中,请稍后再试",106:"请传入rtsp地址和websocket地址",107:"当前未传records录像文件, 将无法拖动进度条",108:"请求超时,请稍后重试",201:"所选通道未查询到录像文件",202:"查询录像文件列表失败",203:"查询录像rtsp失败",204:"{0}倍速无法播放音频",205:"通道休眠,正在唤醒中,请稍后再试",206:"当前倍速不支持",301:"正在对讲,无法关闭音频",302:"其他设备对讲中,无法开启音频",303:"其他设备对讲中,无法开启对讲",304:"查询对讲rtsp失败",305:"http协议不支持对讲",306:"设备对讲失败",307:"不支持PCM音频格式对讲",308:"不支持ARM音频格式对讲",309:"不支持G711u音频格式对讲",310:"不支持G726音频格式对讲",311:"不支持AAC音频格式对讲",312:"不支持G722音频格式对讲",402:"该用户无播放权限",501:"解码库未初始化完成,请稍后播放!",502:"解码库未初始化完成,请稍后对讲!",503:"请检查创建播放器时,播放器容器是否存在",601:"所操作播放器不存在",602:"所选播放器正在本地录像中,不可重复本地录像",603:"所选播放器未播放录像,不可本地录像",604:"所选播放器未开始本地录像,不可操作关闭本地录像",605:"时间跳转播放传参错误",606:"设置画面实际比例/画面平铺传参错误",607:"实时预览不支持倍速播放",608:"需传入正确的{0}方法:{1}",609:"超出当前设置最大窗口布局数量",610:"操作自定义窗口布局失败:{0}",611:"实时预览不支持播放方法",612:"实时预览不支持暂停方法",613:"实时预览不支持跳转播放",614:"当前窗口未播放实时预览画面, 无法进行对讲",701:"云台被用户{0}锁定,无法操作",702:"控制云台三维定位失败{0}",703:"控制云台{0}{1}失败{2}",704:"控制云台方向失败{0}",30000001:"SDP初始化失败",30000002:"接入服务内部错误(信令建立过程)",30000101:"请求失败",30000102:"拉流过程异常中断",30000103:"接入服务内部异常(码流传输过程)",30000104:"老设备回放时登入设备失败",30000105:"设备离线",30000106:"通道离线",30000107:"设备被删除",30000108:"通道被删除",30001001:"创建子链接失败",30001002:"设备不支持",30001003:"设备资源不足",30001004:"查询不到录像",30001005:"设备返回超时",30001006:"超过最大连接数",30002001:"拒绝对讲",30002002:"对讲被其他客户端打开,请稍后重试",30002003:"资源冲突",30002004:"不支持的语音编码格式",30002005:"无权限",30002006:"请求对讲失败",30002007:"请求喊话失败",30003001:"码率超限"},windowDefaultCustomDivision:{2:[{lStep:0,tStep:0,wStep:50,hStep:100},{lStep:50,tStep:0,wStep:50,hStep:100}],3:[{wStep:50,hStep:100,tStep:0,lStep:0},{wStep:50,hStep:50,tStep:0,lStep:50},{wStep:50,hStep:50,tStep:50,lStep:50}],6:[{wStep:66,hStep:66,tStep:0,lStep:0,selectIndex:0},{wStep:34,hStep:33,tStep:0,lStep:66,selectIndex:1},{wStep:34,hStep:33,tStep:33,lStep:66,selectIndex:2},{wStep:33,hStep:34,tStep:66,lStep:0,selectIndex:3},{wStep:33,hStep:34,tStep:66,lStep:33,selectIndex:4},{wStep:34,hStep:34,tStep:66,lStep:66,selectIndex:5}],8:[{wStep:75,hStep:75,tStep:0,lStep:0,selectIndex:0},{wStep:25,hStep:25,tStep:0,lStep:75,selectIndex:1},{wStep:25,hStep:25,tStep:25,lStep:75,selectIndex:2},{wStep:25,hStep:25,tStep:50,lStep:75,selectIndex:3},{wStep:25,hStep:25,tStep:75,lStep:0,selectIndex:4},{wStep:25,hStep:25,tStep:75,lStep:25,selectIndex:5},{wStep:25,hStep:25,tStep:75,lStep:50,selectIndex:6},{wStep:25,hStep:25,tStep:75,lStep:75,selectIndex:7}]},iconConfig:[{key:"refreshReplay",labelKey:"wsPlayer.refreshReplay",buttonParentClass:"ws-refresh-replay",buttonIconClass:"opt-icon refresh-replay-icon"},{key:"drawTriangle",labelKey:"wsPlayer.drawTriangle",buttonParentClass:"ws-draw-triangle",buttonIconClass:"opt-icon draw-triangle-icon off"},{key:"talkIcon",labelKey:"wsPlayer.talk",buttonParentClass:"ws-talk",buttonIconClass:"opt-icon talk-icon off"},{key:"localRecordIcon",labelKey:"wsPlayer.recording",buttonParentClass:"ws-record",buttonIconClass:"opt-icon record-icon"},{key:"audioIcon",labelKey:"wsPlayer.sound",buttonParentClass:"ws-audio",buttonIconClass:"opt-icon audio-icon off"},{key:"snapshotIcon",labelKey:"wsPlayer.capture",buttonParentClass:"ws-capture",buttonIconClass:"opt-icon capture-icon"}],_translate(e,t,s){Object.keys(this[e]).forEach(i=>{let r=t.$t(`${s}${i}`);r&&(this[e][i]=r)})},updateLocale(e){this._translate("errorInfo",e,"wsPlayer.error."),this._translate("errorVideoInfo",e,"wsPlayer.play.error."),this.iconConfig.forEach(t=>{t.label=e.$t(t.labelKey)})},transParam:8192,contentPadding:16,tagHeight:50,contentTop:64,lineHeight:24},r="Opera",a="Chrome",l="Firefox",n="Edge",o="Edg",c="IE",d="Safari",h="UOS",p="Qaxbrowser";function y(e){const{userAgent:t}=navigator;return t.split(e)[1].split(".")[0].slice(1)}function u(e){return"[object Object]"===toString.call(e)}function m(){return function(){let e=new Date;return[e.getFullYear(),e.getMonth()+1,e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()]}().join("_")}const w={checkBrowser:function(){const e=function(){const{userAgent:e}=navigator;return e.includes("UOS")?a:e.includes("Qaxbrowser")?p:e.includes("Edge")?n:e.includes("Edg")?o:e.includes("Firefox")?l:e.includes("Chrome")?a:e.includes("Safari")?d:e.includes("compatible")&&e.includes("MSIE")&&e.includes("Opera")?c:e.includes("Opera")?r:""}(),t=navigator.userAgent.includes("x64")||navigator.userAgent.includes("x86_64")||navigator.userAgent.includes("aarch64")?64:32,s=y(e);let i=!1,u=0;switch(e){case a:i=s>=91&&64===t,u=701;break;case l:i=s>=97,u=702;break;case n:case o:i=s>=91,u=703;break;case h:i=y("Chrome")>=91,u=704;break;case p:i=y("Chrome")>=91,u=705;break;default:i=0}return{isVersionCompliance:i,browserType:e,errorCode:u}},validFunction:function(e){return"[object Function]"===toString.call(e)},mergeObject:function e(){let t={};for(let s=0;s{s=0},t))}},debounce:function(e,t){let s;return function(){s&&clearTimeout(s),s=setTimeout(()=>{e.apply(this,arguments),s=0},t)}},getToday12Time:function(){let e=new Date;return e.setHours(12,0,0),e.getTime()/1e3},uint8ArraysToFileUrl:function(e,t="video/mp4"){let s=e.map(e=>e.buffer),i=e.map(e=>e.offset);const r=s.reduce((e,t)=>e+t.length,0),a=new Uint8Array(r);s.forEach((e,t)=>{let s=i[t];if(!(e instanceof Uint8Array))throw new TypeError("Expected an ArrayBuffer");a.set(e,s)});const l=new Blob([a],{type:t});return{blob:l,file:new File([l],"video_"+m()+("video/mp4"===t?".mp4":".dav"),{type:t}),blobUrl:URL.createObjectURL(l)}},watchDomObserver:function(e,t){const s=new ResizeObserver(e=>{e.forEach(e=>{t&&t()})});return s.observe(e[0]),s}};var f=function(){return f=Object.assign||function(e){for(var t,s=1,i=arguments.length;s