@ezuikit/control-broadcast 0.1.0-beta.3 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,6 +1,18 @@
1
1
  /*
2
- * @ezuikit/control-broadcast v0.1.0-beta.2
3
- * Copyright (c) 2026-05-04 Ezviz-OpenBiz
2
+ * @ezuikit/control-broadcast v1.0.0-beta.1
3
+ * Copyright (c) 2026-11-14 15:37:02 Ezviz-OpenBiz
4
4
  * Released under the MIT License.
5
5
  */
6
- !function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?module.exports=factory():"function"==typeof define&&define.amd?define(factory):(global="undefined"!=typeof globalThis?globalThis:global||self).Broadcast=factory()}(this,function(){"use strict";var EventEmitter=function(){function EventEmitter(){this.events=new Map}var _proto=EventEmitter.prototype;return _proto.on=function(event,callback){this.events.has(event)||this.events.set(event,[]),this.events.get(event).push(callback)},_proto.off=function(event,callback){if(this.events.has(event)){var callbacks=this.events.get(event),index=callbacks.indexOf(callback);index>-1&&callbacks.splice(index,1),0===callbacks.length&&this.events.delete(event)}},_proto.emit=function(event){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];this.events.has(event)&&this.events.get(event).forEach(function(callback){try{callback.apply(void 0,[].concat(args))}catch(error){}})},_proto.once=function(event,callback){var _this=this,onceCallback=function(){for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];callback.apply(void 0,[].concat(args)),_this.off(event,onceCallback)};this.on(event,onceCallback)},_proto.removeAllListeners=function(){this.events.clear()},_proto.listenerCount=function(event){var _this_events_get;return(null==(_this_events_get=this.events.get(event))?void 0:_this_events_get.length)||0},EventEmitter}();function _array_like_to_array(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _async_to_generator$2(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)})}}function _create_for_of_iterator_helper_loose(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(it)return(it=it.call(o)).next.bind(it);if(Array.isArray(o)||(it=function(o,minLen){if(o){if("string"==typeof o)return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_array_like_to_array(o,minLen):void 0}}(o))||allowArrayLike){it&&(o=it);var i=0;return function(){return i>=o.length?{done:!0}:{done:!1,value:o[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 _ts_generator$2(thisArg,body){var f,y,t,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]},g=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return g.next=verb(0),g.throw=verb(1),g.return=verb(2),"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;g&&(g=0,op[0]&&(_=0)),_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}var VoiceRecorder=function(){function VoiceRecorder(options){void 0===options&&(options={}),this.options={minDuration:options.minDuration||3,maxDuration:options.maxDuration||59,sampleRate:options.sampleRate||16e3,channelCount:options.channelCount||1},this.audioContext=null,this.mediaStreamSource=null,this.scriptProcessor=null,this.stream=null,this.startTime=0,this.maxTimer=null,this.audioBuffers=[],this.isRecordingFlag=!1,this.isIOSDevice=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,this.mediaRecorder=null,this.recordedChunks=[]}var _proto=VoiceRecorder.prototype;return _proto.start=function(){return _async_to_generator$2(function(){var error;return _ts_generator$2(this,function(_state){switch(_state.label){case 0:if(this.isRecordingFlag)return[2];_state.label=1;case 1:return _state.trys.push([1,3,,4]),[4,this.startWithScriptProcessor()];case 2:return _state.sent(),this.startTime=Date.now(),this.isRecordingFlag=!0,[3,4];case 3:throw error=_state.sent(),this.isRecordingFlag=!1,error;case 4:return[2]}})}).call(this)},_proto.startWithMediaRecorder=function(){return _async_to_generator$2(function(){var _this,_,mimeType;return _ts_generator$2(this,function(_state){switch(_state.label){case 0:return _this=this,_=this,[4,navigator.mediaDevices.getUserMedia({audio:!0})];case 1:return _.stream=_state.sent(),this.recordedChunks=[],mimeType="",MediaRecorder.isTypeSupported("audio/mp4")?mimeType="audio/mp4":MediaRecorder.isTypeSupported("audio/webm")?mimeType="audio/webm":MediaRecorder.isTypeSupported("audio/wav")&&(mimeType="audio/wav"),this.mediaRecorder=new MediaRecorder(this.stream,{mimeType:mimeType||void 0}),this.mediaRecorder.ondataavailable=function(event){event.data.size>0&&_this.recordedChunks.push(event.data)},this.mediaRecorder.start(),[2]}})}).call(this)},_proto.startWithScriptProcessor=function(){return _async_to_generator$2(function(){var _this,audioConstraints,_;return _ts_generator$2(this,function(_state){switch(_state.label){case 0:return _this=this,audioConstraints=this.isIOSDevice?{audio:!0}:{audio:{sampleRate:this.options.sampleRate,channelCount:this.options.channelCount,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}},_=this,[4,navigator.mediaDevices.getUserMedia(audioConstraints)];case 1:return _.stream=_state.sent(),this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:this.options.sampleRate}),this.mediaStreamSource=this.audioContext.createMediaStreamSource(this.stream),this.scriptProcessor=this.audioContext.createScriptProcessor(4096,1,1),this.audioBuffers=[],this.scriptProcessor.onaudioprocess=function(event){if(_this.isRecordingFlag){var inputData=event.inputBuffer.getChannelData(0);_this.audioBuffers.push(new Float32Array(inputData))}},this.mediaStreamSource.connect(this.scriptProcessor),this.scriptProcessor.connect(this.audioContext.destination),[2]}})}).call(this)},_proto.stop=function(){return _async_to_generator$2(function(){var _this;return _ts_generator$2(this,function(_state){switch(_state.label){case 0:return _this=this,[4,new Promise(function(resolve,reject){if(_this.isRecordingFlag){var duration=(Date.now()-_this.startTime)/1e3;if(duration<_this.options.minDuration)return reject(new Error("录音时长不足"+_this.options.minDuration+"秒")),void _this.cleanup();try{_this.isRecordingFlag=!1,_this.stopWithScriptProcessor(duration,resolve,reject)}catch(error){_this.cleanup(),reject(error)}}else resolve(new Blob([],{type:"audio/wav"}))})];case 1:return[2,_state.sent()]}})}).call(this)},_proto.stopWithMediaRecorder=function(duration,resolve,reject){var _this=this;if(!this.mediaRecorder)return reject(new Error("MediaRecorder 未初始化")),void this.cleanup();this.mediaRecorder.onstop=function(){try{var _this_recordedChunks_,mimeType=(null==(_this_recordedChunks_=_this.recordedChunks[0])?void 0:_this_recordedChunks_.type)||"audio/wav",audioBlob=new Blob(_this.recordedChunks,{type:mimeType});_this.cleanup(),resolve(audioBlob)}catch(error){_this.cleanup(),reject(error)}},this.mediaRecorder.stop()},_proto.stopWithScriptProcessor=function(duration,resolve,reject){try{for(var _step,totalLength=this.audioBuffers.reduce(function(acc,buffer){return acc+buffer.length},0),mergedBuffer=new Float32Array(totalLength),offset=0,_iterator=_create_for_of_iterator_helper_loose(this.audioBuffers);!(_step=_iterator()).done;){var buffer=_step.value;mergedBuffer.set(buffer,offset),offset+=buffer.length}var wavBlob=this.encodeWAV(mergedBuffer,this.options.sampleRate);this.cleanup(),resolve(wavBlob)}catch(error){this.cleanup(),reject(error)}},_proto.encodeWAV=function(samples,sampleRate){var buffer=new ArrayBuffer(44+2*samples.length),view=new DataView(buffer),writeString=function(offset,string){for(var i=0;i<string.length;i++)view.setUint8(offset+i,string.charCodeAt(i))};return writeString(0,"RIFF"),view.setUint32(4,36+2*samples.length,!0),writeString(8,"WAVE"),writeString(12,"fmt "),view.setUint32(16,16,!0),view.setUint16(20,1,!0),view.setUint16(22,1,!0),view.setUint32(24,sampleRate,!0),view.setUint32(28,2*sampleRate,!0),view.setUint16(32,2,!0),view.setUint16(34,16,!0),writeString(36,"data"),view.setUint32(40,2*samples.length,!0),function(output,offset,input){for(var i=0;i<input.length;i++,offset+=2){var s=Math.max(-1,Math.min(1,input[i]));output.setInt16(offset,s<0?32768*s:32767*s,!0)}}(view,44,samples),new Blob([buffer],{type:"audio/wav"})},_proto.cleanup=function(){this.isRecordingFlag=!1,this.mediaRecorder&&("inactive"!==this.mediaRecorder.state&&this.mediaRecorder.stop(),this.mediaRecorder=null),this.recordedChunks=[],this.scriptProcessor&&(this.scriptProcessor.disconnect(),this.scriptProcessor=null),this.mediaStreamSource&&(this.mediaStreamSource.disconnect(),this.mediaStreamSource=null),this.audioContext&&(this.audioContext.close(),this.audioContext=null),this.stream&&(this.stream.getTracks().forEach(function(track){return track.stop()}),this.stream=null),this.audioBuffers=[]},_proto.destroy=function(){this.cleanup(),this.maxTimer&&(clearTimeout(this.maxTimer),this.maxTimer=null)},_proto.getDuration=function(){return 0===this.startTime?0:(Date.now()-this.startTime)/1e3},_proto.isRecording=function(){return this.isRecordingFlag},VoiceRecorder}(),zh_CN={title:"广播喊话",defaultVoice:"默认语音",pressToTalk:"按住说话",clickToTalk:"点击录音",sendVoice:"下发语音",recording:"录音中",stopRecording:"停止录音",loading:"加载中...",noVoice:"暂无语音数据",recordingRemaining:"还可录制 {time} 秒",releaseToStop:"松开结束录制",clickToStop:"再次点击按钮结束录制",voiceSentSuccess:"语音下发成功",recordComplete:"录音完成",voiceSendFailed:"语音下发失败",recordFailed:"录音失败",recordTooShort:"录音时长不足3秒",micPermissionDenied:"请允许麦克风权限"},en_US={title:"Voice Broadcast",defaultVoice:"Default Voice",pressToTalk:"Press to Talk",clickToTalk:"Click to Record",sendVoice:"Send Voice",recording:"Recording",stopRecording:"Stop Recording",loading:"Loading...",noVoice:"No voice data",recordingRemaining:"{time}s remaining",releaseToStop:"Release to stop",clickToStop:"Click again to stop",voiceSentSuccess:"Voice sent successfully",recordComplete:"Recording completed",voiceSendFailed:"Failed to send voice",recordFailed:"Recording failed",recordTooShort:"Recording is too short (min 3s)",micPermissionDenied:"Please allow microphone permission"},i18n=new(function(){function I18n(){this.currentLanguage="zh",this.translations={zh:zh_CN,en:en_US}}var _proto=I18n.prototype;return _proto.setLanguage=function(language){this.currentLanguage=language},_proto.t=function(key){return this.translations[this.currentLanguage][key]||key},_proto.getLanguage=function(){return this.currentLanguage},I18n}()),RecordingToast=function(){function RecordingToast(options){void 0===options&&(options={}),this.options={maxDuration:options.maxDuration||59,minDuration:options.minDuration||3,container:options.container||document.body,isMobile:options.isMobile||!1,language:options.language||"zh"},this.container=this.options.container,this.toastElement=null,this.waveformElement=null,this.timer=null,this.currentTime=this.options.maxDuration,this.waveAnimationFrame=null,i18n.setLanguage(this.options.language),this.injectStyles()}var _proto=RecordingToast.prototype;return _proto.injectStyles=function(){var styleId="ezuikit-recording-toast-styles";if(!document.getElementById(styleId)){var style=document.createElement("style");style.id=styleId,style.textContent="\n .ezuikit-recording-toast {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) translateY(-80px);\n z-index: 9999;\n background: rgba(44, 44, 44, 0.95);\n border-radius: 16px;\n width: 120px;\n height: 120px;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 16px;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);\n animation: ezuikit-toast-fade-in 0.2s ease;\n }\n\n /* 当 RecordingToast 在特定容器内时,使用绝对定位并居中 */\n .ezuikit-broadcast-panel .ezuikit-recording-toast {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1;\n }\n\n @keyframes ezuikit-toast-fade-in {\n from {\n opacity: 0;\n transform: translate(-50%, -50%) translateY(-80px) scale(0.9);\n }\n to {\n opacity: 1;\n transform: translate(-50%, -50%) translateY(-80px) scale(1);\n }\n }\n\n /* 面板内的 toast 淡入动画 */\n .ezuikit-broadcast-panel .ezuikit-recording-toast {\n animation: ezuikit-toast-fade-in-panel 0.2s ease;\n }\n\n @keyframes ezuikit-toast-fade-in-panel {\n from {\n opacity: 0;\n transform: translate(-50%, -50%) scale(0.9);\n }\n to {\n opacity: 1;\n transform: translate(-50%, -50%) scale(1);\n }\n }\n\n .ezuikit-recording-waveform {\n width: 80px;\n height: 40px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .ezuikit-recording-svg {\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n\n #ezuikit-recording-hint {\n font-size: 12px;\n color: rgba(255, 255, 255, 0.9);\n text-align: center;\n line-height: 20px;\n padding: 0 12px;\n }\n ",document.head.appendChild(style)}},_proto.getWaveformDefs=function(){return'\n \x3c!-- 柱子0: 最左,最暗 #CCCCCC --\x3e\n <linearGradient id="waveGradient0" x1="0%" y1="0%" x2="0%" y2="100%">\n <stop offset="0%" stop-color="#CCCCCC" stop-opacity="1" />\n <stop offset="100%" stop-color="#CCCCCC" stop-opacity="1" />\n </linearGradient>\n\n \x3c!-- 柱子1: #D6D6D6 --\x3e\n <linearGradient id="waveGradient1" x1="0%" y1="0%" x2="0%" y2="100%">\n <stop offset="0%" stop-color="#D6D6D6" stop-opacity="1" />\n <stop offset="100%" stop-color="#D6D6D6" stop-opacity="1" />\n </linearGradient>\n\n \x3c!-- 柱子2: #E0E0E0 --\x3e\n <linearGradient id="waveGradient2" x1="0%" y1="0%" x2="0%" y2="100%">\n <stop offset="0%" stop-color="#E0E0E0" stop-opacity="1" />\n <stop offset="100%" stop-color="#E0E0E0" stop-opacity="1" />\n </linearGradient>\n\n \x3c!-- 柱子3: #EBEBEB --\x3e\n <linearGradient id="waveGradient3" x1="0%" y1="0%" x2="0%" y2="100%">\n <stop offset="0%" stop-color="#EBEBEB" stop-opacity="1" />\n <stop offset="100%" stop-color="#EBEBEB" stop-opacity="1" />\n </linearGradient>\n\n \x3c!-- 柱子4: 中间,最亮 #FFFFFF --\x3e\n <linearGradient id="waveGradient4" x1="0%" y1="0%" x2="0%" y2="100%">\n <stop offset="0%" stop-color="#FFFFFF" stop-opacity="1" />\n <stop offset="100%" stop-color="#FFFFFF" stop-opacity="1" />\n </linearGradient>\n\n \x3c!-- 柱子5: #EBEBEB --\x3e\n <linearGradient id="waveGradient5" x1="0%" y1="0%" x2="0%" y2="100%">\n <stop offset="0%" stop-color="#EBEBEB" stop-opacity="1" />\n <stop offset="100%" stop-color="#EBEBEB" stop-opacity="1" />\n </linearGradient>\n\n \x3c!-- 柱子6: #E0E0E0 --\x3e\n <linearGradient id="waveGradient6" x1="0%" y1="0%" x2="0%" y2="100%">\n <stop offset="0%" stop-color="#E0E0E0" stop-opacity="1" />\n <stop offset="100%" stop-color="#E0E0E0" stop-opacity="1" />\n </linearGradient>\n\n \x3c!-- 柱子7: #D6D6D6 --\x3e\n <linearGradient id="waveGradient7" x1="0%" y1="0%" x2="0%" y2="100%">\n <stop offset="0%" stop-color="#D6D6D6" stop-opacity="1" />\n <stop offset="100%" stop-color="#D6D6D6" stop-opacity="1" />\n </linearGradient>\n\n \x3c!-- 柱子8: 最右,最暗 #CCCCCC --\x3e\n <linearGradient id="waveGradient8" x1="0%" y1="0%" x2="0%" y2="100%">\n <stop offset="0%" stop-color="#CCCCCC" stop-opacity="1" />\n <stop offset="100%" stop-color="#CCCCCC" stop-opacity="1" />\n </linearGradient>\n '},_proto.createToastHTML=function(){var getBarX=function(index){return 5+16*index},remainingText=i18n.t("recordingRemaining").replace("{time}",String(this.options.maxDuration));return'\n <div class="ezuikit-recording-waveform">\n <svg id="ezuikit-waveform-svg" viewBox="0 0 150 100" xmlns="http://www.w3.org/2000/svg" width="80" height="40">\n <defs>\n '+this.getWaveformDefs()+'\n </defs>\n \x3c!-- 9个柱子,宽度12px,间距4px,所有柱子高度变化范围都是30~80px,形成波浪效果,颜色从中间向两边渐变 --\x3e\n <rect id="wave-bar-0" x="'+getBarX(0)+'" y="42.5" width="12" height="15" fill="url(#waveGradient0)" rx="6" />\n <rect id="wave-bar-1" x="'+getBarX(1)+'" y="35" width="12" height="30" fill="url(#waveGradient1)" rx="6" />\n <rect id="wave-bar-2" x="'+getBarX(2)+'" y="27.5" width="12" height="45" fill="url(#waveGradient2)" rx="6" />\n <rect id="wave-bar-3" x="'+getBarX(3)+'" y="20" width="12" height="60" fill="url(#waveGradient3)" rx="6" />\n <rect id="wave-bar-4" x="'+getBarX(4)+'" y="7.5" width="12" height="85" fill="url(#waveGradient4)" rx="6" />\n <rect id="wave-bar-5" x="'+getBarX(5)+'" y="20" width="12" height="60" fill="url(#waveGradient5)" rx="6" />\n <rect id="wave-bar-6" x="'+getBarX(6)+'" y="27.5" width="12" height="45" fill="url(#waveGradient6)" rx="6" />\n <rect id="wave-bar-7" x="'+getBarX(7)+'" y="35" width="12" height="30" fill="url(#waveGradient7)" rx="6" />\n <rect id="wave-bar-8" x="'+getBarX(8)+'" y="42.5" width="12" height="15" fill="url(#waveGradient8)" rx="6" />\n </svg>\n </div>\n <div id="ezuikit-recording-hint">'+remainingText+"</div>\n "},_proto.startWaveformAnimation=function(){var frameIndex=0;this.waveAnimationFrame=window.setInterval(function(){for(var i=0;i<9;i++){var rect=document.getElementById("wave-bar-"+i);if(rect){var phase=(.3*frameIndex+.8*i)%(2*Math.PI),height=30+50*((Math.sin(phase)+1)/2),y=50-height/2;rect.setAttribute("height",height.toFixed(2)),rect.setAttribute("y",y.toFixed(2))}}frameIndex++},100)},_proto.stopWaveformAnimation=function(){this.waveAnimationFrame&&(clearInterval(this.waveAnimationFrame),this.waveAnimationFrame=null)},_proto.show=function(){this.toastElement||(this.toastElement=document.createElement("div"),this.toastElement.className="ezuikit-recording-toast",this.toastElement.innerHTML=this.createToastHTML(),this.container.appendChild(this.toastElement),this.waveformElement=this.toastElement.querySelector(".ezuikit-recording-waveform"),this.currentTime=this.options.maxDuration,this.startCountdown(),this.startWaveformAnimation())},_proto.hide=function(){var _this_toastElement;this.stopCountdown(),this.stopWaveformAnimation(),(null==(_this_toastElement=this.toastElement)?void 0:_this_toastElement.parentNode)&&this.toastElement.parentNode.removeChild(this.toastElement),this.toastElement=null,this.waveformElement=null},_proto.startCountdown=function(){var _this=this;this.timer=window.setInterval(function(){_this.currentTime--;var hintElement=document.getElementById("ezuikit-recording-hint");if(hintElement){var remainingMin=Math.max(0,_this.currentTime);hintElement.innerHTML=remainingMin>0?i18n.t("recordingRemaining").replace("{time}",String(remainingMin)):_this.options.isMobile?i18n.t("releaseToStop"):i18n.t("clickToStop")}_this.currentTime<=0&&_this.stopCountdown()},1e3)},_proto.stopCountdown=function(){this.timer&&(clearInterval(this.timer),this.timer=null)},_proto.getCurrentTime=function(){return this.currentTime},_proto.destroy=function(){this.hide()},RecordingToast}();function asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _async_to_generator$1(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)})}}function _instanceof(left,right){return null!=right&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?!!right[Symbol.hasInstance](left):left instanceof right}function _ts_generator$1(thisArg,body){var f,y,t,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]},g=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return g.next=verb(0),g.throw=verb(1),g.return=verb(2),"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;g&&(g=0,op[0]&&(_=0)),_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}var BroadcastUI=function(){function BroadcastUI(container,options){if("string"==typeof container){var element=document.getElementById(container);this.container=element||document.body}else _instanceof(container,HTMLElement)?this.container=container:this.container=document.body;this.options=options,this.modalElement=null,this.voiceListElement=null,this.talkButton=null,this.isRecording=!1,this.isStarting=!1,this.lastTouchTime=0,this.pendingStop=!1,this.voiceList=options.voiceList||[],this.orientationChangeHandler=null,this.createUI();var panel=this.modalElement.querySelector(".ezuikit-broadcast-panel"),toastContainer=_instanceof(panel,HTMLElement)?panel:this.container;this.recordingToast=new RecordingToast({maxDuration:59,minDuration:3,container:toastContainer,isMobile:options.isMobile,language:options.language}),i18n.setLanguage(options.language),this.options.isMobile&&this.setupOrientationListener()}var _proto=BroadcastUI.prototype;return _proto.setupOrientationListener=function(){var _window_screen,_this=this;this.orientationChangeHandler=function(){_this.modalElement&&"none"!==_this.modalElement.style.display&&_this.positionModalBelowContainer()},window.addEventListener("resize",this.orientationChangeHandler),(null==(_window_screen=window.screen)?void 0:_window_screen.orientation)&&window.screen.orientation.addEventListener("change",this.orientationChangeHandler)},_proto.removeOrientationListener=function(){var _window_screen;this.orientationChangeHandler&&(window.removeEventListener("resize",this.orientationChangeHandler),(null==(_window_screen=window.screen)?void 0:_window_screen.orientation)&&window.screen.orientation.removeEventListener("change",this.orientationChangeHandler),this.orientationChangeHandler=null)},_proto.createUI=function(){this.modalElement=document.createElement("div"),this.modalElement.className="ezuikit-broadcast-modal",this.options.isMobile&&this.modalElement.classList.add("ezuikit-broadcast-modal-mobile"),this.modalElement.innerHTML=this.getModalHTML(),this.injectStyles(),this.options.isMobile?(document.body.appendChild(this.modalElement),this.positionModalBelowContainer()):this.container.appendChild(this.modalElement),this.voiceListElement=this.modalElement.querySelector(".ezuikit-broadcast-voice-list"),this.bindEvents(),this.modalElement.style.display="none",this.voiceList.length>0&&this.renderVoiceList()},_proto.positionModalBelowContainer=function(){var _this_options_player;if(this.options.isMobile&&this.modalElement){var isFullscreen=(null==(_this_options_player=this.options.player)?void 0:_this_options_player.isCurrentFullscreen)||!1;if(this.modalElement.classList.remove("normal-mode","fullscreen-landscape-mode"),isFullscreen)this.modalElement.classList.add("fullscreen-landscape-mode"),this.modalElement.style.position="fixed",this.modalElement.style.left="0",this.modalElement.style.right="0",this.modalElement.style.bottom="0",this.modalElement.style.top="auto";else{this.modalElement.classList.add("normal-mode");var containerRect=this.container.getBoundingClientRect();this.modalElement.style.position="fixed",this.modalElement.style.left="0",this.modalElement.style.right="0",this.modalElement.style.top=containerRect.bottom+"px",this.modalElement.style.bottom="0"}}},_proto.getModalHTML=function(){var t=i18n.t.bind(i18n);return'\n <div class="ezuikit-broadcast-overlay"></div>\n <div class="ezuikit-broadcast-panel" data-direction="'+(this.options.direction||"bottom")+'">\n \x3c!-- 标题栏 --\x3e\n <div class="ezuikit-broadcast-header">\n <button class="ezuikit-broadcast-close" type="button">\n <svg width="24" height="24" viewBox="0 0 24 24" fill="none">\n <path d="M18 6L6 18M6 6L18 18" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>\n </svg>\n </button>\n <h2 class="ezuikit-broadcast-title">'+t("title")+'</h2>\n </div>\n\n \x3c!-- Tab区域 --\x3e\n <div class="ezuikit-broadcast-tabs">\n <div class="ezuikit-broadcast-tab active">\n '+t("defaultVoice")+'\n </div>\n </div>\n\n \x3c!-- 内容区域 --\x3e\n <div class="ezuikit-broadcast-content">\n \x3c!-- 语音列表 --\x3e\n <div class="ezuikit-broadcast-voice-list">\n \x3c!-- 语音项将通过 updateVoiceList 动态添加 --\x3e\n <div class="ezuikit-broadcast-voice-empty">\n '+t("loading")+'\n </div>\n </div>\n </div>\n\n \x3c!-- 底部按钮 --\x3e\n <div class="ezuikit-broadcast-footer">\n <button class="ezuikit-broadcast-talk-btn" type="button">\n <span class="ezuikit-broadcast-talk-text">'+(this.options.isMobile?t("pressToTalk"):t("clickToTalk"))+"</span>\n </button>\n </div>\n </div>\n "},_proto.injectStyles=function(){var styleId="ezuikit-broadcast-styles";if(!document.getElementById(styleId)){var style=document.createElement("style");style.id=styleId,style.textContent='\n /* 模态框 */\n .ezuikit-broadcast-modal {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 30;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;\n pointer-events: none;\n }\n\n /* 移动端模态框:固定定位,覆盖整个视口 */\n .ezuikit-broadcast-modal-mobile {\n position: fixed;\n top: auto;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 9999;\n }\n\n .ezuikit-broadcast-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.5);\n animation: ezuikit-broadcast-fade-in 0.3s ease;\n pointer-events: auto;\n }\n\n /* 移动端遮罩层:覆盖整个视口 */\n .ezuikit-broadcast-modal-mobile .ezuikit-broadcast-overlay {\n position: fixed;\n }\n\n /* 移动端遮罩层:全屏模式(应用与播放器相同的伪全屏变换) */\n .ezuikit-broadcast-modal-mobile.fullscreen-landscape-mode .ezuikit-broadcast-overlay {\n position: fixed !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n top: 0 !important;\n width: 100vh !important;\n width: var(--ezplayer-mobile-inner-height, 100vh) !important;\n height: 100vw !important;\n height: var(--ezplayer-mobile-inner-width, 100vw) !important;\n transform: rotate(90.001deg) translateY(-100%) !important;\n -webkit-transform: rotate(90.001deg) translateY(-100%) !important;\n transform-origin: 0 0 !important;\n -webkit-transform-origin: 0 0 !important;\n }\n\n /* 主面板 */\n .ezuikit-broadcast-panel {\n position: absolute;\n background: #F5F5F5;\n display: flex;\n flex-direction: column;\n box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1);\n pointer-events: auto;\n overflow: hidden;\n }\n\n /* 移动端面板:固定定位,基础样式 */\n .ezuikit-broadcast-modal-mobile .ezuikit-broadcast-panel {\n position: fixed !important;\n }\n\n /* 移动端面板:普通模式(定位在 container 下方,从下往上展开) */\n .ezuikit-broadcast-modal-mobile.normal-mode .ezuikit-broadcast-panel {\n bottom: 0 !important;\n top: auto !important;\n left: 0 !important;\n right: 0 !important;\n height: 0;\n animation: ezuikit-broadcast-expand-height-mobile 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;\n }\n\n /* 移动端面板:全屏模式(应用与播放器相同的伪全屏变换,从横屏后的下方往上展开) */\n .ezuikit-broadcast-modal-mobile.fullscreen-landscape-mode .ezuikit-broadcast-panel {\n position: fixed !important;\n left: 0 !important;\n right: auto !important;\n bottom: 0 !important;\n top: 0 !important;\n height: 100vw !important;\n height: var(--ezplayer-mobile-inner-width, 100vw) !important;\n transform: rotate(90.001deg) translateY(-100%) !important;\n -webkit-transform: rotate(90.001deg) translateY(-100%) !important;\n transform-origin: 0 0 !important;\n -webkit-transform-origin: 0 0 !important;\n animation: ezuikit-broadcast-expand-width-mobile-fullscreen 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;\n }\n\n /* 不同方向的展开动画 - 从容器边缘展开 */\n .ezuikit-broadcast-panel[data-direction="bottom"] {\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n height: 0;\n animation: ezuikit-broadcast-expand-height 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;\n }\n\n .ezuikit-broadcast-panel[data-direction="top"] {\n left: 0;\n right: 0;\n top: 0;\n width: 100%;\n height: 0;\n animation: ezuikit-broadcast-expand-height 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;\n }\n\n .ezuikit-broadcast-panel[data-direction="left"] {\n left: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n animation: ezuikit-broadcast-expand-width 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;\n }\n\n .ezuikit-broadcast-panel[data-direction="right"] {\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n animation: ezuikit-broadcast-expand-width 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;\n }\n\n /* 标题栏 */\n .ezuikit-broadcast-header {\n position: relative;\n padding: 16px 20px;\n text-align: center;\n background: rgba(245, 247, 250, 1);\n }\n\n .ezuikit-broadcast-title {\n margin: 0;\n font-size: 18px;\n font-weight: 600;\n color: #333333;\n }\n\n .ezuikit-broadcast-close {\n position: absolute;\n left: 16px;\n top: 50%;\n transform: translateY(-50%);\n background: none;\n border: none;\n padding: 4px;\n cursor: pointer;\n color: #666666;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: color 0.2s;\n }\n\n .ezuikit-broadcast-close:hover {\n color: #333333;\n }\n\n /* Tab区域 */\n .ezuikit-broadcast-tabs {\n display: flex;\n padding: 0 20px;\n background: rgba(245, 247, 250, 1);\n }\n\n .ezuikit-broadcast-tab {\n position: relative;\n padding: 12px 16px 4px;\n font-size: 20px;\n color: #999999;\n cursor: pointer;\n transition: color 0.2s;\n font-weight: 700;\n }\n\n .ezuikit-broadcast-tab.active {\n color: rgba(100, 143, 252, 1);\n font-weight: 700;\n }\n\n .ezuikit-broadcast-tab.active::after {\n content: \'\';\n position: absolute;\n bottom: 0;\n left: 50%;\n transform: translateX(-50%);\n width: 10px;\n height: 2px;\n background: #6B9EFF;\n }\n\n /* 内容区域 */\n .ezuikit-broadcast-content {\n flex: 1;\n overflow-y: auto;\n padding: 16px 20px;\n background: rgba(245, 247, 250, 1);\n }\n\n /* 语音列表 */\n .ezuikit-broadcast-voice-list {\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n .ezuikit-broadcast-voice-empty {\n text-align: center;\n padding: 40px 20px;\n color: #999999;\n font-size: 14px;\n }\n\n .ezuikit-broadcast-voice-item {\n display: flex;\n align-items: center;\n padding: 11px 16px;\n background: rgba(237, 237, 237, 1);\n border-radius: 16px;\n height: 42px;\n box-sizing: border-box;\n cursor: pointer;\n transition: all 0.2s;\n }\n\n .ezuikit-broadcast-voice-item:hover {\n background: rgba(237, 237, 237, 1);\n }\n\n .ezuikit-broadcast-voice-item.selected {\n background: rgba(237, 237, 237, 1);\n }\n\n .ezuikit-broadcast-voice-icon {\n width: 24px;\n height: 24px;\n margin-right: 12px;\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #FFFFFF;\n background: #2C2C2C;\n border-radius: 50%;\n padding: 3px;\n box-sizing: border-box;\n transition: background 0.2s;\n }\n\n .ezuikit-broadcast-voice-item.selected .ezuikit-broadcast-voice-icon {\n background: rgba(100, 143, 252, 1);\n color: #FFFFFF;\n }\n\n .ezuikit-broadcast-voice-text {\n flex: 1;\n font-size: 14px;\n color: rgba(102, 102, 102, 1);\n line-height: 20px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n /* 底部按钮 */\n .ezuikit-broadcast-footer {\n padding: 16px 20px 20px;\n background: #F5F5F5;\n }\n\n .ezuikit-broadcast-talk-btn {\n width: 100%;\n padding: 16px;\n background: #6B9EFF;\n color: #FFFFFF;\n border: none;\n font-size: 16px;\n font-weight: 500;\n cursor: pointer;\n transition: all 0.2s;\n user-select: none;\n border-radius: 8px;\n }\n\n .ezuikit-broadcast-talk-btn:hover {\n background: #5A8EEE;\n }\n\n .ezuikit-broadcast-talk-btn:active {\n transform: scale(0.98);\n }\n\n .ezuikit-broadcast-talk-btn.recording {\n background: #FF5252;\n }\n\n .ezuikit-broadcast-talk-btn.disabled {\n background: #CCCCCC;\n cursor: not-allowed;\n }\n\n /* 动画 */\n @keyframes ezuikit-broadcast-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n @keyframes ezuikit-broadcast-expand-height {\n from { height: 0; }\n to { height: 80%; }\n }\n\n @keyframes ezuikit-broadcast-expand-height-mobile {\n from { height: 0; }\n to { height: 70vh; }\n }\n\n /* 全屏时从右侧展开的动画(宽度展开) */\n @keyframes ezuikit-broadcast-expand-width-mobile-fullscreen {\n from { width: 0; }\n to { width: 70vh; }\n }\n\n /* 全屏时从底部展开的动画 */\n @keyframes ezuikit-broadcast-expand-height-mobile-fullscreen {\n from { height: 0; }\n to { height: 85vh; }\n }\n\n @keyframes ezuikit-broadcast-expand-width {\n from { width: 0; }\n to {\n width: 80%;\n max-width: 400px;\n }\n }\n ',document.head.appendChild(style)}},_proto.bindEvents=function(){var _this=this;if(this.modalElement){var closeBtn=this.modalElement.querySelector(".ezuikit-broadcast-close");closeBtn&&closeBtn.addEventListener("click",function(){_this.close()});var overlay=this.modalElement.querySelector(".ezuikit-broadcast-overlay");overlay&&overlay.addEventListener("click",function(){_this.close()}),this.talkButton=this.modalElement.querySelector(".ezuikit-broadcast-talk-btn"),this.talkButton&&(this.options.isMobile?(this.talkButton.addEventListener("touchstart",function(e){e.preventDefault(),e.stopPropagation();var now=Date.now();now-_this.lastTouchTime<300||(_this.lastTouchTime=now,_this.handleRecordStart())},{passive:!1}),this.talkButton.addEventListener("touchend",function(e){e.preventDefault(),e.stopPropagation(),_this.handleRecordStop()},{passive:!1}),this.talkButton.addEventListener("touchcancel",function(){_this.isRecording&&_this.handleRecordStop()})):this.talkButton.addEventListener("click",function(e){e.preventDefault(),_this.handleRecordToggle()}))}},_proto.handleRecordToggle=function(){this.isRecording?this.handleRecordStop():this.handleRecordStart()},_proto.handleRecordStart=function(){return _async_to_generator$1(function(){var textElement,error,textElement1;return _ts_generator$1(this,function(_state){switch(_state.label){case 0:if(this.isRecording||this.isStarting)return[2];_state.label=1;case 1:return _state.trys.push([1,5,,6]),this.pendingStop=!1,this.isStarting=!0,this.recordingToast.show(),this.talkButton&&(this.talkButton.classList.add("recording"),(textElement=this.talkButton.querySelector(".ezuikit-broadcast-talk-text"))&&(textElement.textContent=this.options.isMobile?i18n.t("recording"):i18n.t("stopRecording"))),[4,this.options.onRecordStart()];case 2:return _state.sent(),this.isRecording=!0,this.isStarting=!1,this.pendingStop?(this.pendingStop=!1,[4,this.handleRecordStop()]):[3,4];case 3:_state.sent(),_state.label=4;case 4:return[3,6];case 5:return error=_state.sent(),this.isStarting=!1,this.isRecording=!1,this.pendingStop=!1,this.recordingToast.hide(),this.talkButton&&(this.talkButton.classList.remove("recording"),(textElement1=this.talkButton.querySelector(".ezuikit-broadcast-talk-text"))&&(textElement1.textContent=this.options.isMobile?i18n.t("pressToTalk"):i18n.t("clickToTalk"))),this.showError(_instanceof(error,Error)?error.message:"开始录音失败"),[3,6];case 6:return[2]}})}).call(this)},_proto.handleRecordStop=function(){return _async_to_generator$1(function(){var textElement,error,textElement1;return _ts_generator$1(this,function(_state){switch(_state.label){case 0:if(this.isStarting)return this.pendingStop=!0,[2];if(!this.isRecording)return[2];_state.label=1;case 1:return _state.trys.push([1,3,,4]),this.recordingToast.hide(),this.talkButton&&(this.talkButton.classList.remove("recording"),(textElement=this.talkButton.querySelector(".ezuikit-broadcast-talk-text"))&&(textElement.textContent=this.options.isMobile?i18n.t("pressToTalk"):i18n.t("clickToTalk"))),[4,this.options.onRecordStop()];case 2:return _state.sent(),this.isRecording=!1,[3,4];case 3:return error=_state.sent(),this.isRecording=!1,this.recordingToast.hide(),this.talkButton&&(this.talkButton.classList.remove("recording"),(textElement1=this.talkButton.querySelector(".ezuikit-broadcast-talk-text"))&&(textElement1.textContent=this.options.isMobile?i18n.t("pressToTalk"):i18n.t("clickToTalk"))),this.showError(_instanceof(error,Error)?error.message:"停止录音失败"),[3,4];case 4:return[2]}})}).call(this)},_proto.show=function(){this.modalElement&&(this.modalElement.style.display="block",this.options.isMobile&&this.positionModalBelowContainer())},_proto.hide=function(){if(this.isRecording)try{this.handleRecordStop()}catch(error){this.isRecording=!1,this.recordingToast.hide()}this.modalElement&&(this.modalElement.style.display="none")},_proto.close=function(){this.hide(),this.options.onClose()},_proto.updateVoiceList=function(voiceList){this.voiceList=voiceList,this.renderVoiceList()},_proto.renderVoiceList=function(){var _this=this;this.voiceListElement&&(0!==this.voiceList.length?(this.voiceListElement.innerHTML=this.voiceList.map(function(voice,index){return'\n <div class="ezuikit-broadcast-voice-item" data-index="'+index+'">\n <div class="ezuikit-broadcast-voice-icon">\n <svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor">\n <path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/>\n </svg>\n </div>\n <div class="ezuikit-broadcast-voice-text" title="'+voice.voiceName+'">'+voice.voiceName+"</div>\n </div>\n "}).join(""),this.voiceListElement.querySelectorAll(".ezuikit-broadcast-voice-item").forEach(function(item){item.addEventListener("click",function(){var index=parseInt(item.getAttribute("data-index")||"-1");_this.selectVoice(index)})})):this.voiceListElement.innerHTML='\n <div class="ezuikit-broadcast-voice-empty">\n '+i18n.t("noVoice")+"\n </div>\n ")},_proto.selectVoice=function(index){if(this.voiceListElement&&(this.voiceListElement.querySelectorAll(".ezuikit-broadcast-voice-item").forEach(function(item){item.classList.remove("selected")}),index>=0&&index<this.voiceList.length)){var selectedItem=this.voiceListElement.querySelector('[data-index="'+index+'"]');selectedItem&&selectedItem.classList.add("selected");var selectedVoice=this.voiceList[index];this.options.onVoiceSend(selectedVoice.fileUrl)}},_proto.setRecordingState=function(isRecording){this.isRecording=isRecording},_proto.showSuccess=function(message){},_proto.showError=function(message){},_proto.destroy=function(){var _this_modalElement;this.removeOrientationListener(),this.recordingToast.destroy(),(null==(_this_modalElement=this.modalElement)?void 0:_this_modalElement.parentNode)&&this.modalElement.parentNode.removeChild(this.modalElement),this.modalElement=null,this.voiceListElement=null,this.talkButton=null},BroadcastUI}();function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)})}}function _ts_generator(thisArg,body){var f,y,t,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]},g=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return g.next=verb(0),g.throw=verb(1),g.return=verb(2),"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;g&&(g=0,op[0]&&(_=0)),_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}var EVENTS={open:"open",close:"close",requestQueryVoiceList:"requestQueryVoiceList",voiceListLoaded:"voiceListLoaded",voiceListError:"voiceListError",requestSendVoiceOnce:"requestSendVoiceOnce",requestSendVoice:"requestSendVoice",voiceSelected:"voiceSelected",voiceRecorded:"voiceRecorded",recordStart:"recordStart",recordStop:"recordStop",recordComplete:"recordComplete",recordError:"recordError",voiceSent:"voiceSent",voiceSendError:"voiceSendError",error:"error"},DefaultOptions={channelNo:"1",env:{domain:"https://open.ys7.com"},language:"zh"},Broadcast=function(){function Broadcast(options){var _this=this;this.options=Object.assign({},DefaultOptions,options),this.eventEmitter=new EventEmitter,this.voiceRecorder=null,this.isOpen=!1,this.voiceList=options.voiceList||[],this.maxDurationTimer=null,this.pendingAudioBlob=null;var container=this.options.container||document.body;this.broadcastUI=new BroadcastUI(container,{language:this.options.language||"zh",direction:this.options.direction||"right",voiceList:this.voiceList,isMobile:this.options.isMobile||!1,player:this.options.player,onClose:function(){return _this.close()},onRecordStart:function(){return _async_to_generator(function(){return _ts_generator(this,function(_state){switch(_state.label){case 0:return[4,this.startRecord()];case 1:return[2,_state.sent()]}})}).call(_this)},onRecordStop:function(){return _async_to_generator(function(){return _ts_generator(this,function(_state){switch(_state.label){case 0:return[4,this.stopRecord()];case 1:return[2,_state.sent()]}})}).call(_this)},onVoiceSend:function(fileUrl){return _this.sendVoice(fileUrl)},onVoiceSendOnce:function(){}}),this.setupEventListeners()}var _proto=Broadcast.prototype;return _proto.initMicrophonePermission=function(){return _async_to_generator(function(){var error;return _ts_generator(this,function(_state){switch(_state.label){case 0:return _state.trys.push([0,2,,3]),[4,navigator.mediaDevices.getUserMedia({audio:{sampleRate:16e3,channelCount:1,echoCancellation:!0,noiseSuppression:!0}})];case 1:return _state.sent().getTracks().forEach(function(track){return track.stop()}),[3,3];case 2:return error=_state.sent(),this.eventEmitter.emit(EVENTS.error,{eventType:EVENTS.error,code:-1,msg:"麦克风权限获取失败",error:error}),[3,3];case 3:return[2]}})}).call(this)},_proto.requestMicrophonePermission=function(){return _async_to_generator(function(){var error;return _ts_generator(this,function(_state){switch(_state.label){case 0:return _state.trys.push([0,2,,3]),[4,navigator.mediaDevices.getUserMedia({audio:{sampleRate:16e3,channelCount:1,echoCancellation:!0,noiseSuppression:!0}})];case 1:return _state.sent().getTracks().forEach(function(track){return track.stop()}),[2,!0];case 2:return error=_state.sent(),this.eventEmitter.emit(EVENTS.error,{eventType:EVENTS.error,code:-1,msg:"麦克风权限获取失败",error:error}),[2,!1];case 3:return[2]}})}).call(this)},_proto.setupEventListeners=function(){var _this=this;this.eventEmitter.on(EVENTS.voiceListLoaded,function(data){_this.voiceList=data.data||[],_this.broadcastUI&&_this.broadcastUI.updateVoiceList(_this.voiceList)}),this.eventEmitter.on(EVENTS.voiceListError,function(data){_this.broadcastUI&&_this.broadcastUI.showError(data.msg||"语音列表加载失败")}),this.eventEmitter.on(EVENTS.voiceSent,function(data){_this.broadcastUI&&_this.broadcastUI.showSuccess(data.msg||"语音下发成功")}),this.eventEmitter.on(EVENTS.voiceSendError,function(data){_this.broadcastUI&&_this.broadcastUI.showError(data.msg||"语音下发失败")})},_proto.open=function(){if(!this.isOpen)try{this.broadcastUI.show(),this.isOpen=!0,0===this.voiceList.length&&this.loadVoiceList(),this.eventEmitter.emit(EVENTS.open,{eventType:EVENTS.open,code:0,msg:"云广播界面已打开"})}catch(error){this.eventEmitter.emit(EVENTS.error,{eventType:EVENTS.error,code:-1,msg:"打开云广播界面失败",error:error})}},_proto.close=function(){if(this.isOpen)try{if(this.voiceRecorder)try{this.voiceRecorder.stop()}catch(error){}this.broadcastUI&&this.broadcastUI.hide(),this.isOpen=!1,this.eventEmitter.emit(EVENTS.close,{eventType:EVENTS.close,code:0,msg:"云广播界面已关闭"})}catch(error){}},_proto.loadVoiceList=function(){this.eventEmitter.emit(EVENTS.requestQueryVoiceList,{eventType:EVENTS.requestQueryVoiceList,params:{deviceSerial:this.options.deviceSerial,channelNo:this.options.channelNo,pageSize:50}})},_proto.startRecord=function(){return _async_to_generator(function(){var _this,error;return _ts_generator(this,function(_state){switch(_state.label){case 0:_this=this,_state.label=1;case 1:return _state.trys.push([1,3,,4]),this.pendingAudioBlob=null,this.voiceRecorder||(this.voiceRecorder=new VoiceRecorder({minDuration:3,maxDuration:59,sampleRate:16e3})),[4,this.voiceRecorder.start()];case 2:return _state.sent(),this.maxDurationTimer=window.setTimeout(function(){return _async_to_generator(function(){return _ts_generator(this,function(_state){switch(_state.label){case 0:return[4,this.stopRecordAndCache()];case 1:return _state.sent(),[2]}})}).call(_this)},59e3),this.eventEmitter.emit(EVENTS.recordStart,{eventType:EVENTS.recordStart,code:0,msg:"开始录音"}),this.broadcastUI&&this.broadcastUI.setRecordingState(!0),[3,4];case 3:return error=_state.sent(),this.eventEmitter.emit(EVENTS.recordError,{eventType:EVENTS.recordError,code:-1,msg:"开始录音失败",error:error}),[3,4];case 4:return[2]}})}).call(this)},_proto.stopRecordAndCache=function(){return _async_to_generator(function(){var audioBlob;return _ts_generator(this,function(_state){switch(_state.label){case 0:return _state.trys.push([0,2,,3]),this.voiceRecorder&&this.voiceRecorder.isRecording()?[4,this.voiceRecorder.stop()]:[2];case 1:return 0===(audioBlob=_state.sent()).size?[2]:(this.pendingAudioBlob=audioBlob,this.eventEmitter.emit(EVENTS.recordComplete,{eventType:EVENTS.recordComplete,code:0,data:audioBlob,msg:"录音完成,等待下发"}),[3,3]);case 2:return _state.sent(),this.broadcastUI&&this.broadcastUI.setRecordingState(!1),[3,3];case 3:return[2]}})}).call(this)},_proto.stopRecord=function(){return _async_to_generator(function(){var audioBlob,audioBlob1,error;return _ts_generator(this,function(_state){switch(_state.label){case 0:if(_state.trys.push([0,2,,3]),this.maxDurationTimer&&(clearTimeout(this.maxDurationTimer),this.maxDurationTimer=null),this.pendingAudioBlob)return audioBlob=this.pendingAudioBlob,this.pendingAudioBlob=null,this.eventEmitter.emit(EVENTS.recordStop,{eventType:EVENTS.recordStop,code:0,msg:"停止录音"}),this.broadcastUI&&this.broadcastUI.setRecordingState(!1),this.sendVoiceOnce(audioBlob),[2];if(!this.voiceRecorder)throw new Error("录音器未初始化");return this.voiceRecorder.isRecording()?[4,this.voiceRecorder.stop()]:(this.broadcastUI&&this.broadcastUI.setRecordingState(!1),[2]);case 1:return 0===(audioBlob1=_state.sent()).size?(this.broadcastUI&&this.broadcastUI.setRecordingState(!1),[2]):(this.eventEmitter.emit(EVENTS.recordStop,{eventType:EVENTS.recordStop,code:0,msg:"停止录音"}),this.eventEmitter.emit(EVENTS.recordComplete,{eventType:EVENTS.recordComplete,code:0,data:audioBlob1,msg:"录音完成"}),this.broadcastUI&&this.broadcastUI.setRecordingState(!1),this.sendVoiceOnce(audioBlob1),[3,3]);case 2:return error=_state.sent(),this.eventEmitter.emit(EVENTS.recordError,{eventType:EVENTS.recordError,code:-1,msg:"停止录音失败",error:error}),this.broadcastUI&&this.broadcastUI.setRecordingState(!1),[3,3];case 3:return[2]}})}).call(this)},_proto.sendVoiceOnce=function(voiceFile){this.eventEmitter.emit(EVENTS.voiceRecorded,{eventType:EVENTS.voiceRecorded,voiceFile:voiceFile,deviceSerial:this.options.deviceSerial,channelNo:this.options.channelNo}),this.eventEmitter.emit(EVENTS.requestSendVoiceOnce,{eventType:EVENTS.requestSendVoiceOnce,voiceFile:voiceFile,deviceSerial:this.options.deviceSerial,channelNo:this.options.channelNo})},_proto.sendVoice=function(fileUrl){this.eventEmitter.emit(EVENTS.requestSendVoice,{eventType:EVENTS.requestSendVoice,fileUrl:fileUrl,deviceSerial:this.options.deviceSerial,channelNo:this.options.channelNo})},_proto.updateOptions=function(options){this.options=Object.assign(this.options,options)},_proto.on=function(event,callback){this.eventEmitter.on(event,callback)},_proto.off=function(event,callback){this.eventEmitter.off(event,callback)},_proto.destroy=function(){this.close(),this.voiceRecorder&&(this.voiceRecorder.destroy(),this.voiceRecorder=null),this.broadcastUI&&this.broadcastUI.destroy(),this.voiceList=[],this.eventEmitter.removeAllListeners()},Broadcast}();return Broadcast.VERSION="0.1.0-beta.2",Broadcast.EVENTS=EVENTS,Broadcast});
6
+ !function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?module.exports=factory():"function"==typeof define&&define.amd?define(factory):(global="undefined"!=typeof globalThis?globalThis:global||self).Broadcast=factory()}(this,function(){"use strict";var dist,hasRequiredDist,commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}
7
+ /*
8
+ * @ezuikit/utils-logger v2.1.0
9
+ * logger utils
10
+ * Copyright (c) 2026-09-15 Ezviz-OpenBiz
11
+ * Released under the MIT License.
12
+ */var distExports=function(){if(hasRequiredDist)return dist;hasRequiredDist=1;var globalThis_1,hasRequiredGlobalThis,commonjsGlobal$1="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==commonjsGlobal?commonjsGlobal:"undefined"!=typeof self?self:{},es_object_toString={};function requireGlobalThis(){if(hasRequiredGlobalThis)return globalThis_1;hasRequiredGlobalThis=1;var check=function(it){return it&&it.Math===Math&&it};return globalThis_1=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof commonjsGlobal$1&&commonjsGlobal$1)||check("object"==typeof globalThis_1&&globalThis_1)||function(){return this}()||Function("return this")()}var isPure,hasRequiredIsPure,defineGlobalProperty,hasRequiredDefineGlobalProperty,hasRequiredSharedStore,shared,hasRequiredShared,fails,hasRequiredFails,functionBindNative,hasRequiredFunctionBindNative,functionUncurryThis,hasRequiredFunctionUncurryThis,isNullOrUndefined,hasRequiredIsNullOrUndefined,requireObjectCoercible,hasRequiredRequireObjectCoercible,toObject,hasRequiredToObject,hasOwnProperty_1,hasRequiredHasOwnProperty,uid,hasRequiredUid,environmentUserAgent,hasRequiredEnvironmentUserAgent,environmentV8Version,hasRequiredEnvironmentV8Version,symbolConstructorDetection,hasRequiredSymbolConstructorDetection,useSymbolAsUid,hasRequiredUseSymbolAsUid,wellKnownSymbol,hasRequiredWellKnownSymbol,toStringTagSupport,hasRequiredToStringTagSupport,isCallable,hasRequiredIsCallable,sharedStore={exports:{}};function requireDefineGlobalProperty(){if(hasRequiredDefineGlobalProperty)return defineGlobalProperty;hasRequiredDefineGlobalProperty=1;var globalThis=requireGlobalThis(),defineProperty=Object.defineProperty;return defineGlobalProperty=function(key,value){try{defineProperty(globalThis,key,{value:value,configurable:!0,writable:!0})}catch(error){globalThis[key]=value}return value}}function requireSharedStore(){if(hasRequiredSharedStore)return sharedStore.exports;hasRequiredSharedStore=1;var IS_PURE=hasRequiredIsPure?isPure:(hasRequiredIsPure=1,isPure=!1),globalThis=requireGlobalThis(),defineGlobalProperty=requireDefineGlobalProperty(),store=sharedStore.exports=globalThis["__core-js_shared__"]||defineGlobalProperty("__core-js_shared__",{});return(store.versions||(store.versions=[])).push({version:"3.46.0",mode:IS_PURE?"pure":"global",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru), 2025 CoreJS Company (core-js.io)",license:"https://github.com/zloirock/core-js/blob/v3.46.0/LICENSE",source:"https://github.com/zloirock/core-js"}),sharedStore.exports}function requireShared(){if(hasRequiredShared)return shared;hasRequiredShared=1;var store=requireSharedStore();return shared=function(key,value){return store[key]||(store[key]=value||{})}}function requireFails(){return hasRequiredFails?fails:(hasRequiredFails=1,fails=function(exec){try{return!!exec()}catch(error){return!0}})}function requireFunctionBindNative(){if(hasRequiredFunctionBindNative)return functionBindNative;hasRequiredFunctionBindNative=1;var fails=requireFails();return functionBindNative=!fails(function(){var test=function(){}.bind();return"function"!=typeof test||test.hasOwnProperty("prototype")})}function requireFunctionUncurryThis(){if(hasRequiredFunctionUncurryThis)return functionUncurryThis;hasRequiredFunctionUncurryThis=1;var NATIVE_BIND=requireFunctionBindNative(),FunctionPrototype=Function.prototype,call=FunctionPrototype.call,uncurryThisWithBind=NATIVE_BIND&&FunctionPrototype.bind.bind(call,call);return functionUncurryThis=NATIVE_BIND?uncurryThisWithBind:function(fn){return function(){return call.apply(fn,arguments)}},functionUncurryThis}function requireIsNullOrUndefined(){return hasRequiredIsNullOrUndefined?isNullOrUndefined:(hasRequiredIsNullOrUndefined=1,isNullOrUndefined=function(it){return null==it})}function requireRequireObjectCoercible(){if(hasRequiredRequireObjectCoercible)return requireObjectCoercible;hasRequiredRequireObjectCoercible=1;var isNullOrUndefined=requireIsNullOrUndefined(),$TypeError=TypeError;return requireObjectCoercible=function(it){if(isNullOrUndefined(it))throw new $TypeError("Can't call method on "+it);return it}}function requireToObject(){if(hasRequiredToObject)return toObject;hasRequiredToObject=1;var requireObjectCoercible=requireRequireObjectCoercible(),$Object=Object;return toObject=function(argument){return $Object(requireObjectCoercible(argument))}}function requireHasOwnProperty(){if(hasRequiredHasOwnProperty)return hasOwnProperty_1;hasRequiredHasOwnProperty=1;var uncurryThis=requireFunctionUncurryThis(),toObject=requireToObject(),hasOwnProperty=uncurryThis({}.hasOwnProperty);return hasOwnProperty_1=Object.hasOwn||function(it,key){return hasOwnProperty(toObject(it),key)}}function requireUid(){if(hasRequiredUid)return uid;hasRequiredUid=1;var uncurryThis=requireFunctionUncurryThis(),id=0,postfix=Math.random(),toString=uncurryThis(1.1.toString);return uid=function(key){return"Symbol("+(void 0===key?"":key)+")_"+toString(++id+postfix,36)}}function requireSymbolConstructorDetection(){if(hasRequiredSymbolConstructorDetection)return symbolConstructorDetection;hasRequiredSymbolConstructorDetection=1;var V8_VERSION=function(){if(hasRequiredEnvironmentV8Version)return environmentV8Version;hasRequiredEnvironmentV8Version=1;var match,version,globalThis=requireGlobalThis(),userAgent=function(){if(hasRequiredEnvironmentUserAgent)return environmentUserAgent;hasRequiredEnvironmentUserAgent=1;var navigator=requireGlobalThis().navigator,userAgent=navigator&&navigator.userAgent;return environmentUserAgent=userAgent?String(userAgent):""}(),process=globalThis.process,Deno=globalThis.Deno,versions=process&&process.versions||Deno&&Deno.version,v8=versions&&versions.v8;return v8&&(version=(match=v8.split("."))[0]>0&&match[0]<4?1:+(match[0]+match[1])),!version&&userAgent&&(!(match=userAgent.match(/Edge\/(\d+)/))||match[1]>=74)&&(match=userAgent.match(/Chrome\/(\d+)/))&&(version=+match[1]),environmentV8Version=version}(),fails=requireFails(),$String=requireGlobalThis().String;return symbolConstructorDetection=!!Object.getOwnPropertySymbols&&!fails(function(){var symbol=Symbol("symbol detection");return!$String(symbol)||!(Object(symbol)instanceof Symbol)||!Symbol.sham&&V8_VERSION&&V8_VERSION<41})}function requireUseSymbolAsUid(){if(hasRequiredUseSymbolAsUid)return useSymbolAsUid;hasRequiredUseSymbolAsUid=1;var NATIVE_SYMBOL=requireSymbolConstructorDetection();return useSymbolAsUid=NATIVE_SYMBOL&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function requireWellKnownSymbol(){if(hasRequiredWellKnownSymbol)return wellKnownSymbol;hasRequiredWellKnownSymbol=1;var globalThis=requireGlobalThis(),shared=requireShared(),hasOwn=requireHasOwnProperty(),uid=requireUid(),NATIVE_SYMBOL=requireSymbolConstructorDetection(),USE_SYMBOL_AS_UID=requireUseSymbolAsUid(),Symbol=globalThis.Symbol,WellKnownSymbolsStore=shared("wks"),createWellKnownSymbol=USE_SYMBOL_AS_UID?Symbol.for||Symbol:Symbol&&Symbol.withoutSetter||uid;return wellKnownSymbol=function(name){return hasOwn(WellKnownSymbolsStore,name)||(WellKnownSymbolsStore[name]=NATIVE_SYMBOL&&hasOwn(Symbol,name)?Symbol[name]:createWellKnownSymbol("Symbol."+name)),WellKnownSymbolsStore[name]}}function requireToStringTagSupport(){if(hasRequiredToStringTagSupport)return toStringTagSupport;hasRequiredToStringTagSupport=1;var test={};return test[requireWellKnownSymbol()("toStringTag")]="z",toStringTagSupport="[object z]"===String(test)}function requireIsCallable(){if(hasRequiredIsCallable)return isCallable;hasRequiredIsCallable=1;var documentAll="object"==typeof document&&document.all;return isCallable=void 0===documentAll&&void 0!==documentAll?function(argument){return"function"==typeof argument||argument===documentAll}:function(argument){return"function"==typeof argument}}var descriptors,hasRequiredDescriptors,isObject,hasRequiredIsObject,documentCreateElement,hasRequiredDocumentCreateElement,ie8DomDefine,hasRequiredIe8DomDefine,v8PrototypeDefineBug,hasRequiredV8PrototypeDefineBug,anObject,hasRequiredAnObject,functionCall,hasRequiredFunctionCall,getBuiltIn,hasRequiredGetBuiltIn,objectIsPrototypeOf,hasRequiredObjectIsPrototypeOf,isSymbol,hasRequiredIsSymbol,tryToString,hasRequiredTryToString,aCallable,hasRequiredACallable,getMethod,hasRequiredGetMethod,ordinaryToPrimitive,hasRequiredOrdinaryToPrimitive,toPrimitive,hasRequiredToPrimitive,toPropertyKey,hasRequiredToPropertyKey,hasRequiredObjectDefineProperty,objectDefineProperty={};function requireDescriptors(){if(hasRequiredDescriptors)return descriptors;hasRequiredDescriptors=1;var fails=requireFails();return descriptors=!fails(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})}function requireIsObject(){if(hasRequiredIsObject)return isObject;hasRequiredIsObject=1;var isCallable=requireIsCallable();return isObject=function(it){return"object"==typeof it?null!==it:isCallable(it)}}function requireDocumentCreateElement(){if(hasRequiredDocumentCreateElement)return documentCreateElement;hasRequiredDocumentCreateElement=1;var globalThis=requireGlobalThis(),isObject=requireIsObject(),document=globalThis.document,EXISTS=isObject(document)&&isObject(document.createElement);return documentCreateElement=function(it){return EXISTS?document.createElement(it):{}}}function requireIe8DomDefine(){if(hasRequiredIe8DomDefine)return ie8DomDefine;hasRequiredIe8DomDefine=1;var DESCRIPTORS=requireDescriptors(),fails=requireFails(),createElement=requireDocumentCreateElement();return ie8DomDefine=!DESCRIPTORS&&!fails(function(){return 7!==Object.defineProperty(createElement("div"),"a",{get:function(){return 7}}).a})}function requireV8PrototypeDefineBug(){if(hasRequiredV8PrototypeDefineBug)return v8PrototypeDefineBug;hasRequiredV8PrototypeDefineBug=1;var DESCRIPTORS=requireDescriptors(),fails=requireFails();return v8PrototypeDefineBug=DESCRIPTORS&&fails(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})}function requireAnObject(){if(hasRequiredAnObject)return anObject;hasRequiredAnObject=1;var isObject=requireIsObject(),$String=String,$TypeError=TypeError;return anObject=function(argument){if(isObject(argument))return argument;throw new $TypeError($String(argument)+" is not an object")}}function requireFunctionCall(){if(hasRequiredFunctionCall)return functionCall;hasRequiredFunctionCall=1;var NATIVE_BIND=requireFunctionBindNative(),call=Function.prototype.call;return functionCall=NATIVE_BIND?call.bind(call):function(){return call.apply(call,arguments)},functionCall}function requireGetBuiltIn(){if(hasRequiredGetBuiltIn)return getBuiltIn;hasRequiredGetBuiltIn=1;var globalThis=requireGlobalThis(),isCallable=requireIsCallable();return getBuiltIn=function(namespace,method){return arguments.length<2?(argument=globalThis[namespace],isCallable(argument)?argument:void 0):globalThis[namespace]&&globalThis[namespace][method];var argument},getBuiltIn}function requireIsSymbol(){if(hasRequiredIsSymbol)return isSymbol;hasRequiredIsSymbol=1;var getBuiltIn=requireGetBuiltIn(),isCallable=requireIsCallable(),isPrototypeOf=function(){if(hasRequiredObjectIsPrototypeOf)return objectIsPrototypeOf;hasRequiredObjectIsPrototypeOf=1;var uncurryThis=requireFunctionUncurryThis();return objectIsPrototypeOf=uncurryThis({}.isPrototypeOf)}(),USE_SYMBOL_AS_UID=requireUseSymbolAsUid(),$Object=Object;return isSymbol=USE_SYMBOL_AS_UID?function(it){return"symbol"==typeof it}:function(it){var $Symbol=getBuiltIn("Symbol");return isCallable($Symbol)&&isPrototypeOf($Symbol.prototype,$Object(it))}}function requireTryToString(){if(hasRequiredTryToString)return tryToString;hasRequiredTryToString=1;var $String=String;return tryToString=function(argument){try{return $String(argument)}catch(error){return"Object"}}}function requireACallable(){if(hasRequiredACallable)return aCallable;hasRequiredACallable=1;var isCallable=requireIsCallable(),tryToString=requireTryToString(),$TypeError=TypeError;return aCallable=function(argument){if(isCallable(argument))return argument;throw new $TypeError(tryToString(argument)+" is not a function")}}function requireGetMethod(){if(hasRequiredGetMethod)return getMethod;hasRequiredGetMethod=1;var aCallable=requireACallable(),isNullOrUndefined=requireIsNullOrUndefined();return getMethod=function(V,P){var func=V[P];return isNullOrUndefined(func)?void 0:aCallable(func)}}function requireOrdinaryToPrimitive(){if(hasRequiredOrdinaryToPrimitive)return ordinaryToPrimitive;hasRequiredOrdinaryToPrimitive=1;var call=requireFunctionCall(),isCallable=requireIsCallable(),isObject=requireIsObject(),$TypeError=TypeError;return ordinaryToPrimitive=function(input,pref){var fn,val;if("string"===pref&&isCallable(fn=input.toString)&&!isObject(val=call(fn,input)))return val;if(isCallable(fn=input.valueOf)&&!isObject(val=call(fn,input)))return val;if("string"!==pref&&isCallable(fn=input.toString)&&!isObject(val=call(fn,input)))return val;throw new $TypeError("Can't convert object to primitive value")}}function requireToPrimitive(){if(hasRequiredToPrimitive)return toPrimitive;hasRequiredToPrimitive=1;var call=requireFunctionCall(),isObject=requireIsObject(),isSymbol=requireIsSymbol(),getMethod=requireGetMethod(),ordinaryToPrimitive=requireOrdinaryToPrimitive(),wellKnownSymbol=requireWellKnownSymbol(),$TypeError=TypeError,TO_PRIMITIVE=wellKnownSymbol("toPrimitive");return toPrimitive=function(input,pref){if(!isObject(input)||isSymbol(input))return input;var result,exoticToPrim=getMethod(input,TO_PRIMITIVE);if(exoticToPrim){if(void 0===pref&&(pref="default"),result=call(exoticToPrim,input,pref),!isObject(result)||isSymbol(result))return result;throw new $TypeError("Can't convert object to primitive value")}return void 0===pref&&(pref="number"),ordinaryToPrimitive(input,pref)}}function requireToPropertyKey(){if(hasRequiredToPropertyKey)return toPropertyKey;hasRequiredToPropertyKey=1;var toPrimitive=requireToPrimitive(),isSymbol=requireIsSymbol();return toPropertyKey=function(argument){var key=toPrimitive(argument,"string");return isSymbol(key)?key:key+""}}function requireObjectDefineProperty(){if(hasRequiredObjectDefineProperty)return objectDefineProperty;hasRequiredObjectDefineProperty=1;var DESCRIPTORS=requireDescriptors(),IE8_DOM_DEFINE=requireIe8DomDefine(),V8_PROTOTYPE_DEFINE_BUG=requireV8PrototypeDefineBug(),anObject=requireAnObject(),toPropertyKey=requireToPropertyKey(),$TypeError=TypeError,$defineProperty=Object.defineProperty,$getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor;return objectDefineProperty.f=DESCRIPTORS?V8_PROTOTYPE_DEFINE_BUG?function(O,P,Attributes){if(anObject(O),P=toPropertyKey(P),anObject(Attributes),"function"==typeof O&&"prototype"===P&&"value"in Attributes&&"writable"in Attributes&&!Attributes.writable){var current=$getOwnPropertyDescriptor(O,P);current&&current.writable&&(O[P]=Attributes.value,Attributes={configurable:"configurable"in Attributes?Attributes.configurable:current.configurable,enumerable:"enumerable"in Attributes?Attributes.enumerable:current.enumerable,writable:!1})}return $defineProperty(O,P,Attributes)}:$defineProperty:function(O,P,Attributes){if(anObject(O),P=toPropertyKey(P),anObject(Attributes),IE8_DOM_DEFINE)try{return $defineProperty(O,P,Attributes)}catch(error){}if("get"in Attributes||"set"in Attributes)throw new $TypeError("Accessors not supported");return"value"in Attributes&&(O[P]=Attributes.value),O},objectDefineProperty}var functionName,hasRequiredFunctionName,inspectSource,hasRequiredInspectSource,weakMapBasicDetection,hasRequiredWeakMapBasicDetection,createPropertyDescriptor,hasRequiredCreatePropertyDescriptor,createNonEnumerableProperty,hasRequiredCreateNonEnumerableProperty,sharedKey,hasRequiredSharedKey,hiddenKeys,hasRequiredHiddenKeys,internalState,hasRequiredInternalState,hasRequiredMakeBuiltIn,defineBuiltIn,hasRequiredDefineBuiltIn,classofRaw,hasRequiredClassofRaw,classof,hasRequiredClassof,objectToString,hasRequiredObjectToString,hasRequiredEs_object_toString,makeBuiltIn={exports:{}};function requireInspectSource(){if(hasRequiredInspectSource)return inspectSource;hasRequiredInspectSource=1;var uncurryThis=requireFunctionUncurryThis(),isCallable=requireIsCallable(),store=requireSharedStore(),functionToString=uncurryThis(Function.toString);return isCallable(store.inspectSource)||(store.inspectSource=function(it){return functionToString(it)}),inspectSource=store.inspectSource}function requireCreatePropertyDescriptor(){return hasRequiredCreatePropertyDescriptor?createPropertyDescriptor:(hasRequiredCreatePropertyDescriptor=1,createPropertyDescriptor=function(bitmap,value){return{enumerable:!(1&bitmap),configurable:!(2&bitmap),writable:!(4&bitmap),value:value}})}function requireCreateNonEnumerableProperty(){if(hasRequiredCreateNonEnumerableProperty)return createNonEnumerableProperty;hasRequiredCreateNonEnumerableProperty=1;var DESCRIPTORS=requireDescriptors(),definePropertyModule=requireObjectDefineProperty(),createPropertyDescriptor=requireCreatePropertyDescriptor();return createNonEnumerableProperty=DESCRIPTORS?function(object,key,value){return definePropertyModule.f(object,key,createPropertyDescriptor(1,value))}:function(object,key,value){return object[key]=value,object}}function requireSharedKey(){if(hasRequiredSharedKey)return sharedKey;hasRequiredSharedKey=1;var shared=requireShared(),uid=requireUid(),keys=shared("keys");return sharedKey=function(key){return keys[key]||(keys[key]=uid(key))}}function requireHiddenKeys(){return hasRequiredHiddenKeys?hiddenKeys:(hasRequiredHiddenKeys=1,hiddenKeys={})}function requireMakeBuiltIn(){if(hasRequiredMakeBuiltIn)return makeBuiltIn.exports;hasRequiredMakeBuiltIn=1;var uncurryThis=requireFunctionUncurryThis(),fails=requireFails(),isCallable=requireIsCallable(),hasOwn=requireHasOwnProperty(),DESCRIPTORS=requireDescriptors(),CONFIGURABLE_FUNCTION_NAME=function(){if(hasRequiredFunctionName)return functionName;hasRequiredFunctionName=1;var DESCRIPTORS=requireDescriptors(),hasOwn=requireHasOwnProperty(),FunctionPrototype=Function.prototype,getDescriptor=DESCRIPTORS&&Object.getOwnPropertyDescriptor,EXISTS=hasOwn(FunctionPrototype,"name"),PROPER=EXISTS&&"something"===function(){}.name,CONFIGURABLE=EXISTS&&(!DESCRIPTORS||DESCRIPTORS&&getDescriptor(FunctionPrototype,"name").configurable);return functionName={EXISTS:EXISTS,PROPER:PROPER,CONFIGURABLE:CONFIGURABLE}}().CONFIGURABLE,inspectSource=requireInspectSource(),InternalStateModule=function(){if(hasRequiredInternalState)return internalState;hasRequiredInternalState=1;var set,get,has,NATIVE_WEAK_MAP=function(){if(hasRequiredWeakMapBasicDetection)return weakMapBasicDetection;hasRequiredWeakMapBasicDetection=1;var globalThis=requireGlobalThis(),isCallable=requireIsCallable(),WeakMap=globalThis.WeakMap;return weakMapBasicDetection=isCallable(WeakMap)&&/native code/.test(String(WeakMap))}(),globalThis=requireGlobalThis(),isObject=requireIsObject(),createNonEnumerableProperty=requireCreateNonEnumerableProperty(),hasOwn=requireHasOwnProperty(),shared=requireSharedStore(),sharedKey=requireSharedKey(),hiddenKeys=requireHiddenKeys(),TypeError=globalThis.TypeError,WeakMap=globalThis.WeakMap;if(NATIVE_WEAK_MAP||shared.state){var store=shared.state||(shared.state=new WeakMap);store.get=store.get,store.has=store.has,store.set=store.set,set=function(it,metadata){if(store.has(it))throw new TypeError("Object already initialized");return metadata.facade=it,store.set(it,metadata),metadata},get=function(it){return store.get(it)||{}},has=function(it){return store.has(it)}}else{var STATE=sharedKey("state");hiddenKeys[STATE]=!0,set=function(it,metadata){if(hasOwn(it,STATE))throw new TypeError("Object already initialized");return metadata.facade=it,createNonEnumerableProperty(it,STATE,metadata),metadata},get=function(it){return hasOwn(it,STATE)?it[STATE]:{}},has=function(it){return hasOwn(it,STATE)}}return internalState={set:set,get:get,has:has,enforce:function(it){return has(it)?get(it):set(it,{})},getterFor:function(TYPE){return function(it){var state;if(!isObject(it)||(state=get(it)).type!==TYPE)throw new TypeError("Incompatible receiver, "+TYPE+" required");return state}}}}(),enforceInternalState=InternalStateModule.enforce,getInternalState=InternalStateModule.get,$String=String,defineProperty=Object.defineProperty,stringSlice=uncurryThis("".slice),replace=uncurryThis("".replace),join=uncurryThis([].join),CONFIGURABLE_LENGTH=DESCRIPTORS&&!fails(function(){return 8!==defineProperty(function(){},"length",{value:8}).length}),TEMPLATE=String(String).split("String"),makeBuiltIn$1=makeBuiltIn.exports=function(value,name,options){"Symbol("===stringSlice($String(name),0,7)&&(name="["+replace($String(name),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),options&&options.getter&&(name="get "+name),options&&options.setter&&(name="set "+name),(!hasOwn(value,"name")||CONFIGURABLE_FUNCTION_NAME&&value.name!==name)&&(DESCRIPTORS?defineProperty(value,"name",{value:name,configurable:!0}):value.name=name),CONFIGURABLE_LENGTH&&options&&hasOwn(options,"arity")&&value.length!==options.arity&&defineProperty(value,"length",{value:options.arity});try{options&&hasOwn(options,"constructor")&&options.constructor?DESCRIPTORS&&defineProperty(value,"prototype",{writable:!1}):value.prototype&&(value.prototype=void 0)}catch(error){}var state=enforceInternalState(value);return hasOwn(state,"source")||(state.source=join(TEMPLATE,"string"==typeof name?name:"")),value};return Function.prototype.toString=makeBuiltIn$1(function(){return isCallable(this)&&getInternalState(this).source||inspectSource(this)},"toString"),makeBuiltIn.exports}function requireDefineBuiltIn(){if(hasRequiredDefineBuiltIn)return defineBuiltIn;hasRequiredDefineBuiltIn=1;var isCallable=requireIsCallable(),definePropertyModule=requireObjectDefineProperty(),makeBuiltIn=requireMakeBuiltIn(),defineGlobalProperty=requireDefineGlobalProperty();return defineBuiltIn=function(O,key,value,options){options||(options={});var simple=options.enumerable,name=void 0!==options.name?options.name:key;if(isCallable(value)&&makeBuiltIn(value,name,options),options.global)simple?O[key]=value:defineGlobalProperty(key,value);else{try{options.unsafe?O[key]&&(simple=!0):delete O[key]}catch(error){}simple?O[key]=value:definePropertyModule.f(O,key,{value:value,enumerable:!1,configurable:!options.nonConfigurable,writable:!options.nonWritable})}return O}}function requireClassofRaw(){if(hasRequiredClassofRaw)return classofRaw;hasRequiredClassofRaw=1;var uncurryThis=requireFunctionUncurryThis(),toString=uncurryThis({}.toString),stringSlice=uncurryThis("".slice);return classofRaw=function(it){return stringSlice(toString(it),8,-1)}}function requireClassof(){if(hasRequiredClassof)return classof;hasRequiredClassof=1;var TO_STRING_TAG_SUPPORT=requireToStringTagSupport(),isCallable=requireIsCallable(),classofRaw=requireClassofRaw(),TO_STRING_TAG=requireWellKnownSymbol()("toStringTag"),$Object=Object,CORRECT_ARGUMENTS="Arguments"===classofRaw(function(){return arguments}());return classof=TO_STRING_TAG_SUPPORT?classofRaw:function(it){var O,tag,result;return void 0===it?"Undefined":null===it?"Null":"string"==typeof(tag=function(it,key){try{return it[key]}catch(error){}}(O=$Object(it),TO_STRING_TAG))?tag:CORRECT_ARGUMENTS?classofRaw(O):"Object"===(result=classofRaw(O))&&isCallable(O.callee)?"Arguments":result}}var hasRequiredObjectPropertyIsEnumerable,indexedObject,hasRequiredIndexedObject,toIndexedObject,hasRequiredToIndexedObject,hasRequiredObjectGetOwnPropertyDescriptor,es_reflect_apply={},objectGetOwnPropertyDescriptor={},objectPropertyIsEnumerable={};function requireToIndexedObject(){if(hasRequiredToIndexedObject)return toIndexedObject;hasRequiredToIndexedObject=1;var IndexedObject=function(){if(hasRequiredIndexedObject)return indexedObject;hasRequiredIndexedObject=1;var uncurryThis=requireFunctionUncurryThis(),fails=requireFails(),classof=requireClassofRaw(),$Object=Object,split=uncurryThis("".split);return indexedObject=fails(function(){return!$Object("z").propertyIsEnumerable(0)})?function(it){return"String"===classof(it)?split(it,""):$Object(it)}:$Object}(),requireObjectCoercible=requireRequireObjectCoercible();return toIndexedObject=function(it){return IndexedObject(requireObjectCoercible(it))}}function requireObjectGetOwnPropertyDescriptor(){if(hasRequiredObjectGetOwnPropertyDescriptor)return objectGetOwnPropertyDescriptor;hasRequiredObjectGetOwnPropertyDescriptor=1;var DESCRIPTORS=requireDescriptors(),call=requireFunctionCall(),propertyIsEnumerableModule=function(){if(hasRequiredObjectPropertyIsEnumerable)return objectPropertyIsEnumerable;hasRequiredObjectPropertyIsEnumerable=1;var $propertyIsEnumerable={}.propertyIsEnumerable,getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,NASHORN_BUG=getOwnPropertyDescriptor&&!$propertyIsEnumerable.call({1:2},1);return objectPropertyIsEnumerable.f=NASHORN_BUG?function(V){var descriptor=getOwnPropertyDescriptor(this,V);return!!descriptor&&descriptor.enumerable}:$propertyIsEnumerable,objectPropertyIsEnumerable}(),createPropertyDescriptor=requireCreatePropertyDescriptor(),toIndexedObject=requireToIndexedObject(),toPropertyKey=requireToPropertyKey(),hasOwn=requireHasOwnProperty(),IE8_DOM_DEFINE=requireIe8DomDefine(),$getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor;return objectGetOwnPropertyDescriptor.f=DESCRIPTORS?$getOwnPropertyDescriptor:function(O,P){if(O=toIndexedObject(O),P=toPropertyKey(P),IE8_DOM_DEFINE)try{return $getOwnPropertyDescriptor(O,P)}catch(error){}if(hasOwn(O,P))return createPropertyDescriptor(!call(propertyIsEnumerableModule.f,O,P),O[P])},objectGetOwnPropertyDescriptor}var mathTrunc,hasRequiredMathTrunc,toIntegerOrInfinity,hasRequiredToIntegerOrInfinity,toAbsoluteIndex,hasRequiredToAbsoluteIndex,toLength,hasRequiredToLength,lengthOfArrayLike,hasRequiredLengthOfArrayLike,arrayIncludes,hasRequiredArrayIncludes,objectKeysInternal,hasRequiredObjectKeysInternal,enumBugKeys,hasRequiredEnumBugKeys,hasRequiredObjectGetOwnPropertyNames,objectGetOwnPropertyNames={};function requireToIntegerOrInfinity(){if(hasRequiredToIntegerOrInfinity)return toIntegerOrInfinity;hasRequiredToIntegerOrInfinity=1;var trunc=function(){if(hasRequiredMathTrunc)return mathTrunc;hasRequiredMathTrunc=1;var ceil=Math.ceil,floor=Math.floor;return mathTrunc=Math.trunc||function(x){var n=+x;return(n>0?floor:ceil)(n)}}();return toIntegerOrInfinity=function(argument){var number=+argument;return number!=number||0===number?0:trunc(number)}}function requireToAbsoluteIndex(){if(hasRequiredToAbsoluteIndex)return toAbsoluteIndex;hasRequiredToAbsoluteIndex=1;var toIntegerOrInfinity=requireToIntegerOrInfinity(),max=Math.max,min=Math.min;return toAbsoluteIndex=function(index,length){var integer=toIntegerOrInfinity(index);return integer<0?max(integer+length,0):min(integer,length)}}function requireToLength(){if(hasRequiredToLength)return toLength;hasRequiredToLength=1;var toIntegerOrInfinity=requireToIntegerOrInfinity(),min=Math.min;return toLength=function(argument){var len=toIntegerOrInfinity(argument);return len>0?min(len,9007199254740991):0}}function requireLengthOfArrayLike(){if(hasRequiredLengthOfArrayLike)return lengthOfArrayLike;hasRequiredLengthOfArrayLike=1;var toLength=requireToLength();return lengthOfArrayLike=function(obj){return toLength(obj.length)}}function requireObjectKeysInternal(){if(hasRequiredObjectKeysInternal)return objectKeysInternal;hasRequiredObjectKeysInternal=1;var uncurryThis=requireFunctionUncurryThis(),hasOwn=requireHasOwnProperty(),toIndexedObject=requireToIndexedObject(),indexOf=function(){if(hasRequiredArrayIncludes)return arrayIncludes;hasRequiredArrayIncludes=1;var toIndexedObject=requireToIndexedObject(),toAbsoluteIndex=requireToAbsoluteIndex(),lengthOfArrayLike=requireLengthOfArrayLike(),createMethod=function(IS_INCLUDES){return function($this,el,fromIndex){var O=toIndexedObject($this),length=lengthOfArrayLike(O);if(0===length)return!IS_INCLUDES&&-1;var value,index=toAbsoluteIndex(fromIndex,length);if(IS_INCLUDES&&el!=el){for(;length>index;)if((value=O[index++])!=value)return!0}else for(;length>index;index++)if((IS_INCLUDES||index in O)&&O[index]===el)return IS_INCLUDES||index||0;return!IS_INCLUDES&&-1}};return arrayIncludes={includes:createMethod(!0),indexOf:createMethod(!1)}}().indexOf,hiddenKeys=requireHiddenKeys(),push=uncurryThis([].push);return objectKeysInternal=function(object,names){var key,O=toIndexedObject(object),i=0,result=[];for(key in O)!hasOwn(hiddenKeys,key)&&hasOwn(O,key)&&push(result,key);for(;names.length>i;)hasOwn(O,key=names[i++])&&(~indexOf(result,key)||push(result,key));return result}}function requireEnumBugKeys(){return hasRequiredEnumBugKeys?enumBugKeys:(hasRequiredEnumBugKeys=1,enumBugKeys=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}var hasRequiredObjectGetOwnPropertySymbols,ownKeys,hasRequiredOwnKeys,copyConstructorProperties,hasRequiredCopyConstructorProperties,isForced_1,hasRequiredIsForced,_export,hasRequired_export,functionApply,hasRequiredFunctionApply,hasRequiredEs_reflect_apply,objectGetOwnPropertySymbols={};function requireOwnKeys(){if(hasRequiredOwnKeys)return ownKeys;hasRequiredOwnKeys=1;var getBuiltIn=requireGetBuiltIn(),uncurryThis=requireFunctionUncurryThis(),getOwnPropertyNamesModule=function(){if(hasRequiredObjectGetOwnPropertyNames)return objectGetOwnPropertyNames;hasRequiredObjectGetOwnPropertyNames=1;var internalObjectKeys=requireObjectKeysInternal(),hiddenKeys=requireEnumBugKeys().concat("length","prototype");return objectGetOwnPropertyNames.f=Object.getOwnPropertyNames||function(O){return internalObjectKeys(O,hiddenKeys)},objectGetOwnPropertyNames}(),getOwnPropertySymbolsModule=(hasRequiredObjectGetOwnPropertySymbols||(hasRequiredObjectGetOwnPropertySymbols=1,objectGetOwnPropertySymbols.f=Object.getOwnPropertySymbols),objectGetOwnPropertySymbols),anObject=requireAnObject(),concat=uncurryThis([].concat);return ownKeys=getBuiltIn("Reflect","ownKeys")||function(it){var keys=getOwnPropertyNamesModule.f(anObject(it)),getOwnPropertySymbols=getOwnPropertySymbolsModule.f;return getOwnPropertySymbols?concat(keys,getOwnPropertySymbols(it)):keys}}function requireCopyConstructorProperties(){if(hasRequiredCopyConstructorProperties)return copyConstructorProperties;hasRequiredCopyConstructorProperties=1;var hasOwn=requireHasOwnProperty(),ownKeys=requireOwnKeys(),getOwnPropertyDescriptorModule=requireObjectGetOwnPropertyDescriptor(),definePropertyModule=requireObjectDefineProperty();return copyConstructorProperties=function(target,source,exceptions){for(var keys=ownKeys(source),defineProperty=definePropertyModule.f,getOwnPropertyDescriptor=getOwnPropertyDescriptorModule.f,i=0;i<keys.length;i++){var key=keys[i];hasOwn(target,key)||exceptions&&hasOwn(exceptions,key)||defineProperty(target,key,getOwnPropertyDescriptor(source,key))}}}function require_export(){if(hasRequired_export)return _export;hasRequired_export=1;var globalThis=requireGlobalThis(),getOwnPropertyDescriptor=requireObjectGetOwnPropertyDescriptor().f,createNonEnumerableProperty=requireCreateNonEnumerableProperty(),defineBuiltIn=requireDefineBuiltIn(),defineGlobalProperty=requireDefineGlobalProperty(),copyConstructorProperties=requireCopyConstructorProperties(),isForced=function(){if(hasRequiredIsForced)return isForced_1;hasRequiredIsForced=1;var fails=requireFails(),isCallable=requireIsCallable(),replacement=/#|\.prototype\./,isForced=function(feature,detection){var value=data[normalize(feature)];return value===POLYFILL||value!==NATIVE&&(isCallable(detection)?fails(detection):!!detection)},normalize=isForced.normalize=function(string){return String(string).replace(replacement,".").toLowerCase()},data=isForced.data={},NATIVE=isForced.NATIVE="N",POLYFILL=isForced.POLYFILL="P";return isForced_1=isForced}();return _export=function(options,source){var target,key,targetProperty,sourceProperty,descriptor,TARGET=options.target,GLOBAL=options.global,STATIC=options.stat;if(target=GLOBAL?globalThis:STATIC?globalThis[TARGET]||defineGlobalProperty(TARGET,{}):globalThis[TARGET]&&globalThis[TARGET].prototype)for(key in source){if(sourceProperty=source[key],targetProperty=options.dontCallGetSet?(descriptor=getOwnPropertyDescriptor(target,key))&&descriptor.value:target[key],!isForced(GLOBAL?key:TARGET+(STATIC?".":"#")+key,options.forced)&&void 0!==targetProperty){if(typeof sourceProperty==typeof targetProperty)continue;copyConstructorProperties(sourceProperty,targetProperty)}(options.sham||targetProperty&&targetProperty.sham)&&createNonEnumerableProperty(sourceProperty,"sham",!0),defineBuiltIn(target,key,sourceProperty,options)}}}function requireFunctionApply(){if(hasRequiredFunctionApply)return functionApply;hasRequiredFunctionApply=1;var NATIVE_BIND=requireFunctionBindNative(),FunctionPrototype=Function.prototype,apply=FunctionPrototype.apply,call=FunctionPrototype.call;return functionApply="object"==typeof Reflect&&Reflect.apply||(NATIVE_BIND?call.bind(apply):function(){return call.apply(apply,arguments)}),functionApply}var arraySlice,hasRequiredArraySlice,functionBind,hasRequiredFunctionBind,isConstructor,hasRequiredIsConstructor,aConstructor,hasRequiredAConstructor,es_reflect_construct={};function requireArraySlice(){if(hasRequiredArraySlice)return arraySlice;hasRequiredArraySlice=1;var uncurryThis=requireFunctionUncurryThis();return arraySlice=uncurryThis([].slice)}function requireIsConstructor(){if(hasRequiredIsConstructor)return isConstructor;hasRequiredIsConstructor=1;var uncurryThis=requireFunctionUncurryThis(),fails=requireFails(),isCallable=requireIsCallable(),classof=requireClassof(),getBuiltIn=requireGetBuiltIn(),inspectSource=requireInspectSource(),noop=function(){},construct=getBuiltIn("Reflect","construct"),constructorRegExp=/^\s*(?:class|function)\b/,exec=uncurryThis(constructorRegExp.exec),INCORRECT_TO_STRING=!constructorRegExp.test(noop),isConstructorModern=function(argument){if(!isCallable(argument))return!1;try{return construct(noop,[],argument),!0}catch(error){return!1}},isConstructorLegacy=function(argument){if(!isCallable(argument))return!1;switch(classof(argument)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return INCORRECT_TO_STRING||!!exec(constructorRegExp,inspectSource(argument))}catch(error){return!0}};return isConstructorLegacy.sham=!0,isConstructor=!construct||fails(function(){var called;return isConstructorModern(isConstructorModern.call)||!isConstructorModern(Object)||!isConstructorModern(function(){called=!0})||called})?isConstructorLegacy:isConstructorModern}function requireAConstructor(){if(hasRequiredAConstructor)return aConstructor;hasRequiredAConstructor=1;var isConstructor=requireIsConstructor(),tryToString=requireTryToString(),$TypeError=TypeError;return aConstructor=function(argument){if(isConstructor(argument))return argument;throw new $TypeError(tryToString(argument)+" is not a constructor")}}var objectKeys,hasRequiredObjectKeys,hasRequiredObjectDefineProperties,html,hasRequiredHtml,objectCreate,hasRequiredObjectCreate,hasRequiredEs_reflect_construct,objectDefineProperties={};function requireObjectKeys(){if(hasRequiredObjectKeys)return objectKeys;hasRequiredObjectKeys=1;var internalObjectKeys=requireObjectKeysInternal(),enumBugKeys=requireEnumBugKeys();return objectKeys=Object.keys||function(O){return internalObjectKeys(O,enumBugKeys)}}function requireHtml(){if(hasRequiredHtml)return html;hasRequiredHtml=1;var getBuiltIn=requireGetBuiltIn();return html=getBuiltIn("document","documentElement")}var hasRequiredEs_reflect_defineProperty,hasRequiredEs_reflect_deleteProperty,isDataDescriptor,hasRequiredIsDataDescriptor,correctPrototypeGetter,hasRequiredCorrectPrototypeGetter,objectGetPrototypeOf,hasRequiredObjectGetPrototypeOf,hasRequiredEs_reflect_get,es_reflect_defineProperty={},es_reflect_deleteProperty={},es_reflect_get={};function requireIsDataDescriptor(){if(hasRequiredIsDataDescriptor)return isDataDescriptor;hasRequiredIsDataDescriptor=1;var hasOwn=requireHasOwnProperty();return isDataDescriptor=function(descriptor){return void 0!==descriptor&&(hasOwn(descriptor,"value")||hasOwn(descriptor,"writable"))}}function requireCorrectPrototypeGetter(){if(hasRequiredCorrectPrototypeGetter)return correctPrototypeGetter;hasRequiredCorrectPrototypeGetter=1;var fails=requireFails();return correctPrototypeGetter=!fails(function(){function F(){}return F.prototype.constructor=null,Object.getPrototypeOf(new F)!==F.prototype})}function requireObjectGetPrototypeOf(){if(hasRequiredObjectGetPrototypeOf)return objectGetPrototypeOf;hasRequiredObjectGetPrototypeOf=1;var hasOwn=requireHasOwnProperty(),isCallable=requireIsCallable(),toObject=requireToObject(),sharedKey=requireSharedKey(),CORRECT_PROTOTYPE_GETTER=requireCorrectPrototypeGetter(),IE_PROTO=sharedKey("IE_PROTO"),$Object=Object,ObjectPrototype=$Object.prototype;return objectGetPrototypeOf=CORRECT_PROTOTYPE_GETTER?$Object.getPrototypeOf:function(O){var object=toObject(O);if(hasOwn(object,IE_PROTO))return object[IE_PROTO];var constructor=object.constructor;return isCallable(constructor)&&object instanceof constructor?constructor.prototype:object instanceof $Object?ObjectPrototype:null}}var hasRequiredEs_reflect_getOwnPropertyDescriptor,hasRequiredEs_reflect_getPrototypeOf,hasRequiredEs_reflect_has,arrayBufferNonExtensible,hasRequiredArrayBufferNonExtensible,objectIsExtensible,hasRequiredObjectIsExtensible,hasRequiredEs_reflect_isExtensible,hasRequiredEs_reflect_ownKeys,freezing,hasRequiredFreezing,hasRequiredEs_reflect_preventExtensions,hasRequiredEs_reflect_set,isPossiblePrototype,hasRequiredIsPossiblePrototype,aPossiblePrototype,hasRequiredAPossiblePrototype,functionUncurryThisAccessor,hasRequiredFunctionUncurryThisAccessor,objectSetPrototypeOf,hasRequiredObjectSetPrototypeOf,hasRequiredEs_reflect_setPrototypeOf,es_reflect_getOwnPropertyDescriptor={},es_reflect_getPrototypeOf={},es_reflect_isExtensible={},es_reflect_preventExtensions={},es_reflect_set={},es_reflect_setPrototypeOf={};function requireIsPossiblePrototype(){if(hasRequiredIsPossiblePrototype)return isPossiblePrototype;hasRequiredIsPossiblePrototype=1;var isObject=requireIsObject();return isPossiblePrototype=function(argument){return isObject(argument)||null===argument}}function requireAPossiblePrototype(){if(hasRequiredAPossiblePrototype)return aPossiblePrototype;hasRequiredAPossiblePrototype=1;var isPossiblePrototype=requireIsPossiblePrototype(),$String=String,$TypeError=TypeError;return aPossiblePrototype=function(argument){if(isPossiblePrototype(argument))return argument;throw new $TypeError("Can't set "+$String(argument)+" as a prototype")}}function requireObjectSetPrototypeOf(){if(hasRequiredObjectSetPrototypeOf)return objectSetPrototypeOf;hasRequiredObjectSetPrototypeOf=1;var uncurryThisAccessor=function(){if(hasRequiredFunctionUncurryThisAccessor)return functionUncurryThisAccessor;hasRequiredFunctionUncurryThisAccessor=1;var uncurryThis=requireFunctionUncurryThis(),aCallable=requireACallable();return functionUncurryThisAccessor=function(object,key,method){try{return uncurryThis(aCallable(Object.getOwnPropertyDescriptor(object,key)[method]))}catch(error){}}}(),isObject=requireIsObject(),requireObjectCoercible=requireRequireObjectCoercible(),aPossiblePrototype=requireAPossiblePrototype();return objectSetPrototypeOf=Object.setPrototypeOf||("__proto__"in{}?function(){var setter,CORRECT_SETTER=!1,test={};try{(setter=uncurryThisAccessor(Object.prototype,"__proto__","set"))(test,[]),CORRECT_SETTER=test instanceof Array}catch(error){}return function(O,proto){return requireObjectCoercible(O),aPossiblePrototype(proto),isObject(O)?(CORRECT_SETTER?setter(O,proto):O.__proto__=proto,O):O}}():void 0)}var setToStringTag,hasRequiredSetToStringTag,hasRequiredEs_reflect_toStringTag,path,hasRequiredPath,reflect$1,hasRequiredReflect$1,reflect,hasRequiredReflect,es_reflect_toStringTag={};function requireSetToStringTag(){if(hasRequiredSetToStringTag)return setToStringTag;hasRequiredSetToStringTag=1;var defineProperty=requireObjectDefineProperty().f,hasOwn=requireHasOwnProperty(),TO_STRING_TAG=requireWellKnownSymbol()("toStringTag");return setToStringTag=function(target,TAG,STATIC){target&&!STATIC&&(target=target.prototype),target&&!hasOwn(target,TO_STRING_TAG)&&defineProperty(target,TO_STRING_TAG,{configurable:!0,value:TAG})}}function requirePath(){if(hasRequiredPath)return path;hasRequiredPath=1;var globalThis=requireGlobalThis();return path=globalThis}function requireReflect$1(){if(hasRequiredReflect$1)return reflect$1;hasRequiredReflect$1=1,function(){if(hasRequiredEs_object_toString)return es_object_toString;hasRequiredEs_object_toString=1;var TO_STRING_TAG_SUPPORT=requireToStringTagSupport(),defineBuiltIn=requireDefineBuiltIn(),toString=function(){if(hasRequiredObjectToString)return objectToString;hasRequiredObjectToString=1;var TO_STRING_TAG_SUPPORT=requireToStringTagSupport(),classof=requireClassof();return objectToString=TO_STRING_TAG_SUPPORT?{}.toString:function(){return"[object "+classof(this)+"]"}}();TO_STRING_TAG_SUPPORT||defineBuiltIn(Object.prototype,"toString",toString,{unsafe:!0})}(),function(){if(hasRequiredEs_reflect_apply)return es_reflect_apply;hasRequiredEs_reflect_apply=1;var $=require_export(),functionApply=requireFunctionApply(),aCallable=requireACallable(),anObject=requireAnObject();$({target:"Reflect",stat:!0,forced:!requireFails()(function(){Reflect.apply(function(){})})},{apply:function(target,thisArgument,argumentsList){return functionApply(aCallable(target),thisArgument,anObject(argumentsList))}})}(),function(){if(hasRequiredEs_reflect_construct)return es_reflect_construct;hasRequiredEs_reflect_construct=1;var $=require_export(),getBuiltIn=requireGetBuiltIn(),apply=requireFunctionApply(),bind=function(){if(hasRequiredFunctionBind)return functionBind;hasRequiredFunctionBind=1;var uncurryThis=requireFunctionUncurryThis(),aCallable=requireACallable(),isObject=requireIsObject(),hasOwn=requireHasOwnProperty(),arraySlice=requireArraySlice(),NATIVE_BIND=requireFunctionBindNative(),$Function=Function,concat=uncurryThis([].concat),join=uncurryThis([].join),factories={};return functionBind=NATIVE_BIND?$Function.bind:function(that){var F=aCallable(this),Prototype=F.prototype,partArgs=arraySlice(arguments,1),boundFunction=function(){var args=concat(partArgs,arraySlice(arguments));return this instanceof boundFunction?function(C,argsLength,args){if(!hasOwn(factories,argsLength)){for(var list=[],i=0;i<argsLength;i++)list[i]="a["+i+"]";factories[argsLength]=$Function("C,a","return new C("+join(list,",")+")")}return factories[argsLength](C,args)}(F,args.length,args):F.apply(that,args)};return isObject(Prototype)&&(boundFunction.prototype=Prototype),boundFunction},functionBind}(),aConstructor=requireAConstructor(),anObject=requireAnObject(),isObject=requireIsObject(),create=function(){if(hasRequiredObjectCreate)return objectCreate;hasRequiredObjectCreate=1;var activeXDocument,anObject=requireAnObject(),definePropertiesModule=function(){if(hasRequiredObjectDefineProperties)return objectDefineProperties;hasRequiredObjectDefineProperties=1;var DESCRIPTORS=requireDescriptors(),V8_PROTOTYPE_DEFINE_BUG=requireV8PrototypeDefineBug(),definePropertyModule=requireObjectDefineProperty(),anObject=requireAnObject(),toIndexedObject=requireToIndexedObject(),objectKeys=requireObjectKeys();return objectDefineProperties.f=DESCRIPTORS&&!V8_PROTOTYPE_DEFINE_BUG?Object.defineProperties:function(O,Properties){anObject(O);for(var key,props=toIndexedObject(Properties),keys=objectKeys(Properties),length=keys.length,index=0;length>index;)definePropertyModule.f(O,key=keys[index++],props[key]);return O},objectDefineProperties}(),enumBugKeys=requireEnumBugKeys(),hiddenKeys=requireHiddenKeys(),html=requireHtml(),documentCreateElement=requireDocumentCreateElement(),IE_PROTO=requireSharedKey()("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(content){return"<script>"+content+"<\/script>"},NullProtoObjectViaActiveX=function(activeXDocument){activeXDocument.write(scriptTag("")),activeXDocument.close();var temp=activeXDocument.parentWindow.Object;return activeXDocument=null,temp},NullProtoObject=function(){try{activeXDocument=new ActiveXObject("htmlfile")}catch(error){}var iframeDocument,iframe;NullProtoObject="undefined"!=typeof document?document.domain&&activeXDocument?NullProtoObjectViaActiveX(activeXDocument):((iframe=documentCreateElement("iframe")).style.display="none",html.appendChild(iframe),iframe.src=String("javascript:"),(iframeDocument=iframe.contentWindow.document).open(),iframeDocument.write(scriptTag("document.F=Object")),iframeDocument.close(),iframeDocument.F):NullProtoObjectViaActiveX(activeXDocument);for(var length=enumBugKeys.length;length--;)delete NullProtoObject.prototype[enumBugKeys[length]];return NullProtoObject()};return hiddenKeys[IE_PROTO]=!0,objectCreate=Object.create||function(O,Properties){var result;return null!==O?(EmptyConstructor.prototype=anObject(O),result=new EmptyConstructor,EmptyConstructor.prototype=null,result[IE_PROTO]=O):result=NullProtoObject(),void 0===Properties?result:definePropertiesModule.f(result,Properties)}}(),fails=requireFails(),nativeConstruct=getBuiltIn("Reflect","construct"),ObjectPrototype=Object.prototype,push=[].push,NEW_TARGET_BUG=fails(function(){function F(){}return!(nativeConstruct(function(){},[],F)instanceof F)}),ARGS_BUG=!fails(function(){nativeConstruct(function(){})}),FORCED=NEW_TARGET_BUG||ARGS_BUG;$({target:"Reflect",stat:!0,forced:FORCED,sham:FORCED},{construct:function(Target,args){aConstructor(Target),anObject(args);var newTarget=arguments.length<3?Target:aConstructor(arguments[2]);if(ARGS_BUG&&!NEW_TARGET_BUG)return nativeConstruct(Target,args,newTarget);if(Target===newTarget){switch(args.length){case 0:return new Target;case 1:return new Target(args[0]);case 2:return new Target(args[0],args[1]);case 3:return new Target(args[0],args[1],args[2]);case 4:return new Target(args[0],args[1],args[2],args[3])}var $args=[null];return apply(push,$args,args),new(apply(bind,Target,$args))}var proto=newTarget.prototype,instance=create(isObject(proto)?proto:ObjectPrototype),result=apply(Target,instance,args);return isObject(result)?result:instance}})}(),function(){if(hasRequiredEs_reflect_defineProperty)return es_reflect_defineProperty;hasRequiredEs_reflect_defineProperty=1;var $=require_export(),DESCRIPTORS=requireDescriptors(),anObject=requireAnObject(),toPropertyKey=requireToPropertyKey(),definePropertyModule=requireObjectDefineProperty();$({target:"Reflect",stat:!0,forced:requireFails()(function(){Reflect.defineProperty(definePropertyModule.f({},1,{value:1}),1,{value:2})}),sham:!DESCRIPTORS},{defineProperty:function(target,propertyKey,attributes){anObject(target);var key=toPropertyKey(propertyKey);anObject(attributes);try{return definePropertyModule.f(target,key,attributes),!0}catch(error){return!1}}})}(),function(){if(hasRequiredEs_reflect_deleteProperty)return es_reflect_deleteProperty;hasRequiredEs_reflect_deleteProperty=1;var $=require_export(),anObject=requireAnObject(),getOwnPropertyDescriptor=requireObjectGetOwnPropertyDescriptor().f;$({target:"Reflect",stat:!0},{deleteProperty:function(target,propertyKey){var descriptor=getOwnPropertyDescriptor(anObject(target),propertyKey);return!(descriptor&&!descriptor.configurable)&&delete target[propertyKey]}})}(),function(){if(hasRequiredEs_reflect_get)return es_reflect_get;hasRequiredEs_reflect_get=1;var $=require_export(),call=requireFunctionCall(),isObject=requireIsObject(),anObject=requireAnObject(),isDataDescriptor=requireIsDataDescriptor(),getOwnPropertyDescriptorModule=requireObjectGetOwnPropertyDescriptor(),getPrototypeOf=requireObjectGetPrototypeOf();$({target:"Reflect",stat:!0},{get:function get(target,propertyKey){var descriptor,prototype,receiver=arguments.length<3?target:arguments[2];return anObject(target)===receiver?target[propertyKey]:(descriptor=getOwnPropertyDescriptorModule.f(target,propertyKey))?isDataDescriptor(descriptor)?descriptor.value:void 0===descriptor.get?void 0:call(descriptor.get,receiver):isObject(prototype=getPrototypeOf(target))?get(prototype,propertyKey,receiver):void 0}})}(),function(){if(hasRequiredEs_reflect_getOwnPropertyDescriptor)return es_reflect_getOwnPropertyDescriptor;hasRequiredEs_reflect_getOwnPropertyDescriptor=1;var $=require_export(),DESCRIPTORS=requireDescriptors(),anObject=requireAnObject(),getOwnPropertyDescriptorModule=requireObjectGetOwnPropertyDescriptor();$({target:"Reflect",stat:!0,sham:!DESCRIPTORS},{getOwnPropertyDescriptor:function(target,propertyKey){return getOwnPropertyDescriptorModule.f(anObject(target),propertyKey)}})}(),function(){if(hasRequiredEs_reflect_getPrototypeOf)return es_reflect_getPrototypeOf;hasRequiredEs_reflect_getPrototypeOf=1;var $=require_export(),anObject=requireAnObject(),objectGetPrototypeOf=requireObjectGetPrototypeOf();$({target:"Reflect",stat:!0,sham:!requireCorrectPrototypeGetter()},{getPrototypeOf:function(target){return objectGetPrototypeOf(anObject(target))}})}(),hasRequiredEs_reflect_has||(hasRequiredEs_reflect_has=1,require_export()({target:"Reflect",stat:!0},{has:function(target,propertyKey){return propertyKey in target}})),function(){if(hasRequiredEs_reflect_isExtensible)return es_reflect_isExtensible;hasRequiredEs_reflect_isExtensible=1;var $=require_export(),anObject=requireAnObject(),$isExtensible=function(){if(hasRequiredObjectIsExtensible)return objectIsExtensible;hasRequiredObjectIsExtensible=1;var fails=requireFails(),isObject=requireIsObject(),classof=requireClassofRaw(),ARRAY_BUFFER_NON_EXTENSIBLE=function(){if(hasRequiredArrayBufferNonExtensible)return arrayBufferNonExtensible;hasRequiredArrayBufferNonExtensible=1;var fails=requireFails();return arrayBufferNonExtensible=fails(function(){if("function"==typeof ArrayBuffer){var buffer=new ArrayBuffer(8);Object.isExtensible(buffer)&&Object.defineProperty(buffer,"a",{value:8})}})}(),$isExtensible=Object.isExtensible,FAILS_ON_PRIMITIVES=fails(function(){});return objectIsExtensible=FAILS_ON_PRIMITIVES||ARRAY_BUFFER_NON_EXTENSIBLE?function(it){return!!isObject(it)&&(!ARRAY_BUFFER_NON_EXTENSIBLE||"ArrayBuffer"!==classof(it))&&(!$isExtensible||$isExtensible(it))}:$isExtensible}();$({target:"Reflect",stat:!0},{isExtensible:function(target){return anObject(target),$isExtensible(target)}})}(),hasRequiredEs_reflect_ownKeys||(hasRequiredEs_reflect_ownKeys=1,require_export()({target:"Reflect",stat:!0},{ownKeys:requireOwnKeys()})),function(){if(hasRequiredEs_reflect_preventExtensions)return es_reflect_preventExtensions;hasRequiredEs_reflect_preventExtensions=1;var $=require_export(),getBuiltIn=requireGetBuiltIn(),anObject=requireAnObject(),FREEZING=function(){if(hasRequiredFreezing)return freezing;hasRequiredFreezing=1;var fails=requireFails();return freezing=!fails(function(){return Object.isExtensible(Object.preventExtensions({}))})}();$({target:"Reflect",stat:!0,sham:!FREEZING},{preventExtensions:function(target){anObject(target);try{var objectPreventExtensions=getBuiltIn("Object","preventExtensions");return objectPreventExtensions&&objectPreventExtensions(target),!0}catch(error){return!1}}})}(),function(){if(hasRequiredEs_reflect_set)return es_reflect_set;hasRequiredEs_reflect_set=1;var $=require_export(),call=requireFunctionCall(),anObject=requireAnObject(),isObject=requireIsObject(),isDataDescriptor=requireIsDataDescriptor(),fails=requireFails(),definePropertyModule=requireObjectDefineProperty(),getOwnPropertyDescriptorModule=requireObjectGetOwnPropertyDescriptor(),getPrototypeOf=requireObjectGetPrototypeOf(),createPropertyDescriptor=requireCreatePropertyDescriptor();$({target:"Reflect",stat:!0,forced:fails(function(){var Constructor=function(){},object=definePropertyModule.f(new Constructor,"a",{configurable:!0});return!1!==Reflect.set(Constructor.prototype,"a",1,object)})},{set:function set(target,propertyKey,V){var existingDescriptor,prototype,setter,receiver=arguments.length<4?target:arguments[3],ownDescriptor=getOwnPropertyDescriptorModule.f(anObject(target),propertyKey);if(!ownDescriptor){if(isObject(prototype=getPrototypeOf(target)))return set(prototype,propertyKey,V,receiver);ownDescriptor=createPropertyDescriptor(0)}if(isDataDescriptor(ownDescriptor)){if(!1===ownDescriptor.writable||!isObject(receiver))return!1;if(existingDescriptor=getOwnPropertyDescriptorModule.f(receiver,propertyKey)){if(existingDescriptor.get||existingDescriptor.set||!1===existingDescriptor.writable)return!1;existingDescriptor.value=V,definePropertyModule.f(receiver,propertyKey,existingDescriptor)}else definePropertyModule.f(receiver,propertyKey,createPropertyDescriptor(0,V))}else{if(void 0===(setter=ownDescriptor.set))return!1;call(setter,receiver,V)}return!0}})}(),function(){if(hasRequiredEs_reflect_setPrototypeOf)return es_reflect_setPrototypeOf;hasRequiredEs_reflect_setPrototypeOf=1;var $=require_export(),anObject=requireAnObject(),aPossiblePrototype=requireAPossiblePrototype(),objectSetPrototypeOf=requireObjectSetPrototypeOf();objectSetPrototypeOf&&$({target:"Reflect",stat:!0},{setPrototypeOf:function(target,proto){anObject(target),aPossiblePrototype(proto);try{return objectSetPrototypeOf(target,proto),!0}catch(error){return!1}}})}(),function(){if(hasRequiredEs_reflect_toStringTag)return es_reflect_toStringTag;hasRequiredEs_reflect_toStringTag=1;var $=require_export(),globalThis=requireGlobalThis(),setToStringTag=requireSetToStringTag();$({global:!0},{Reflect:{}}),setToStringTag(globalThis.Reflect,"Reflect",!0)}();var path=requirePath();return reflect$1=path.Reflect}!function(){if(hasRequiredReflect)return reflect;hasRequiredReflect=1;var parent=requireReflect$1();reflect=parent}();var _$LoggerStyle$_={info:"",log:"background: #4096ff; color: #FFF;",warn:"background: yellow; color: #FFF;",error:"background: red; color: #FFF;"},LoggerCls=function(){function LoggerCls(options){void 0===options&&(options={}),this._options={level:"INFO",showTime:!1},this._levelNum=3,this._contexts=Object.create(null),this.info=this._loggerFactory("info",this._levelNum>=3),this.log=this._loggerFactory("log",this._levelNum>=2),this.warn=this._loggerFactory("warn",this._levelNum>=1),this.error=this._loggerFactory("error",this._levelNum>=0),this.setOptions(options)}var _proto=LoggerCls.prototype;return _proto.setOptions=function(options){var _this__options_level;this._options=Object.assign({},this._options,options),this._levelNum=this._matchLevel(null!=(_this__options_level=this._options.level)?_this__options_level:"INFO"),this.info=this._loggerFactory("info",this._levelNum>=3),this.log=this._loggerFactory("log",this._levelNum>=2),this.warn=this._loggerFactory("warn",this._levelNum>=1),this.error=this._loggerFactory("error",this._levelNum>=0)},_proto._matchLevel=function(level){var logLevel=3;switch(level){case"INFO":logLevel=3;break;case"LOG":logLevel=2;break;case"WARN":logLevel=1;break;case"ERROR":logLevel=0}return logLevel},_proto._loggerFactory=function(type,bool){var fn=console[type];if(bool&&fn){var _fn,args0=this._options.name?"%c["+this._options.name+"]%c %c["+type.toUpperCase()+"]":"%c["+type.toUpperCase()+"]",color=[this._options.name?"background: green;color: #fff":null,this._options.name?"":null,_$LoggerStyle$_[type]].filter(function(color){return null!=color});return(_fn=fn).bind.apply(_fn,[].concat([console,args0],color))}return LoggerCls.noop},_proto.getOptions=function(){return this._options},_proto.context=function(key){var cached=this._contexts[key];if(cached)return cached;var instance=__$createLoggerProxy(new LoggerCls(Object.assign({},this._options,{name:key})));return this._contexts[key]=instance,instance},_proto.hasContext=function(key){return!!this._contexts[key]},_proto.getContexts=function(){return Object.keys(this._contexts)},_proto.removeContext=function(key){return!!this._contexts[key]&&(delete this._contexts[key],!0)},_proto.getVersion=function(){return"2.1.0"},LoggerCls}();function __$fillTen(num){return(num=+num)<10&&(num="0"+num),num+""}LoggerCls.noop=function(){},LoggerCls.VERSION="2.1.0";var __$CONSOLE_LIST$__=["info","log","warn","error"];function __$createLoggerProxy(logger){return new Proxy(logger,{get:function(target,prop){if(__$CONSOLE_LIST$__.includes(prop)){var _target__options;if(null==(_target__options=target._options)?void 0:_target__options.showTime){var time=(year=(now=new Date(Date.now())).getFullYear(),month=now.getMonth()+1,day=now.getDate(),hour=now.getHours(),min=now.getMinutes(),sec=now.getSeconds(),ms=now.getMilliseconds(),year+"/"+__$fillTen(month)+"/"+__$fillTen(day)+" "+__$fillTen(hour)+":"+__$fillTen(min)+":"+__$fillTen(sec)+":"+ms);return target[prop].bind(console,"["+time+"]")}return target[prop].bind(console)}var now,year,month,day,hour,min,sec,ms;return Reflect.get(target,prop)}})}return dist=function(options){return __$createLoggerProxy(new LoggerCls(options))}}(),Logger=getDefaultExportFromCjs(distExports);function createLogger(logger){var root=null!=logger?logger:Logger();return"function"==typeof root.context?root.context("Broadcast"):root}function _array_like_to_array(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _async_to_generator$2(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)})}}function _create_for_of_iterator_helper_loose(o,allowArrayLike){var it="undefined"!=typeof Symbol&&o[Symbol.iterator]||o["@@iterator"];if(it)return(it=it.call(o)).next.bind(it);if(Array.isArray(o)||(it=function(o,minLen){if(!o)return;if("string"==typeof o)return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array(o,minLen)}(o))||allowArrayLike){it&&(o=it);var i=0;return function(){return i>=o.length?{done:!0}:{done:!1,value:o[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 _ts_generator$2(thisArg,body){var f,y,t,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]},g=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),d=Object.defineProperty;return d(g,"next",{value:verb(0)}),d(g,"throw",{value:verb(1)}),d(g,"return",{value:verb(2)}),"function"==typeof Symbol&&d(g,Symbol.iterator,{value:function(){return this}}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;g&&(g=0,op[0]&&(_=0)),_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}var VoiceRecorder=function(){function VoiceRecorder(options){var _options_logger;void 0===options&&(options={}),this.options={minDuration:options.minDuration||3,maxDuration:options.maxDuration||59,sampleRate:options.sampleRate||16e3,channelCount:options.channelCount||1},this.logger=null!=(_options_logger=options.logger)?_options_logger:createLogger(),this.audioContext=null,this.mediaStreamSource=null,this.scriptProcessor=null,this.stream=null,this.startTime=0,this.maxTimer=null,this.audioBuffers=[],this.isRecordingFlag=!1,this.isIOSDevice=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,this.mediaRecorder=null,this.recordedChunks=[]}var _proto=VoiceRecorder.prototype;return _proto.start=function(){return _async_to_generator$2(function(){var error;return _ts_generator$2(this,function(_state){switch(_state.label){case 0:if(this.isRecordingFlag)return this.logger.warn("[VoiceRecorder] 录音已在进行中,忽略重复启动"),[2];_state.label=1;case 1:return _state.trys.push([1,3,,4]),[4,this.startWithScriptProcessor()];case 2:return _state.sent(),this.startTime=Date.now(),this.isRecordingFlag=!0,this.logger.log("[VoiceRecorder] 录音已开始"),[3,4];case 3:throw error=_state.sent(),this.logger.error("[VoiceRecorder] 开始录音失败",error),this.isRecordingFlag=!1,error;case 4:return[2]}})}).call(this)},_proto.startWithMediaRecorder=function(){return _async_to_generator$2(function(){var _this,_,mimeType;return _ts_generator$2(this,function(_state){switch(_state.label){case 0:return _this=this,_=this,[4,navigator.mediaDevices.getUserMedia({audio:!0})];case 1:return _.stream=_state.sent(),this.recordedChunks=[],mimeType="",MediaRecorder.isTypeSupported("audio/mp4")?mimeType="audio/mp4":MediaRecorder.isTypeSupported("audio/webm")?mimeType="audio/webm":MediaRecorder.isTypeSupported("audio/wav")&&(mimeType="audio/wav"),this.mediaRecorder=new MediaRecorder(this.stream,{mimeType:mimeType||void 0}),this.mediaRecorder.ondataavailable=function(event){event.data.size>0&&_this.recordedChunks.push(event.data)},this.mediaRecorder.start(),[2]}})}).call(this)},_proto.startWithScriptProcessor=function(){return _async_to_generator$2(function(){var _this,audioConstraints,_;return _ts_generator$2(this,function(_state){switch(_state.label){case 0:return _this=this,audioConstraints=this.isIOSDevice?{audio:!0}:{audio:{sampleRate:this.options.sampleRate,channelCount:this.options.channelCount,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}},_=this,[4,navigator.mediaDevices.getUserMedia(audioConstraints)];case 1:return _.stream=_state.sent(),this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:this.options.sampleRate}),this.mediaStreamSource=this.audioContext.createMediaStreamSource(this.stream),this.scriptProcessor=this.audioContext.createScriptProcessor(4096,1,1),this.audioBuffers=[],this.scriptProcessor.onaudioprocess=function(event){if(_this.isRecordingFlag){var inputData=event.inputBuffer.getChannelData(0);_this.audioBuffers.push(new Float32Array(inputData))}},this.mediaStreamSource.connect(this.scriptProcessor),this.scriptProcessor.connect(this.audioContext.destination),[2]}})}).call(this)},_proto.stop=function(){return _async_to_generator$2(function(){var _this;return _ts_generator$2(this,function(_state){switch(_state.label){case 0:return _this=this,[4,new Promise(function(resolve,reject){if(!_this.isRecordingFlag)return _this.logger.warn("[VoiceRecorder] 录音器未在录音状态"),void resolve(new Blob([],{type:"audio/wav"}));var duration=(Date.now()-_this.startTime)/1e3;if(duration<_this.options.minDuration)return _this.logger.error("[VoiceRecorder] 录音时长不足",{duration:duration.toFixed(2),required:_this.options.minDuration}),reject(new Error("录音时长不足"+_this.options.minDuration+"秒")),void _this.cleanup();try{_this.isRecordingFlag=!1,_this.stopWithScriptProcessor(duration,resolve,reject)}catch(error){_this.logger.error("[VoiceRecorder] 停止录音失败",error),_this.cleanup(),reject(error)}})];case 1:return[2,_state.sent()]}})}).call(this)},_proto.stopWithMediaRecorder=function(duration,resolve,reject){var _this=this;if(!this.mediaRecorder)return this.logger.error("[VoiceRecorder] MediaRecorder 未初始化"),reject(new Error("MediaRecorder 未初始化")),void this.cleanup();this.mediaRecorder.onstop=function(){try{var _this_recordedChunks_,mimeType=(null==(_this_recordedChunks_=_this.recordedChunks[0])?void 0:_this_recordedChunks_.type)||"audio/wav",audioBlob=new Blob(_this.recordedChunks,{type:mimeType});_this.logger.log("[VoiceRecorder] 录音已停止",{duration:duration.toFixed(2)+"s",size:(audioBlob.size/1024).toFixed(2)+"KB"}),_this.cleanup(),resolve(audioBlob)}catch(error){_this.logger.error("[VoiceRecorder] 处理录音数据失败",error),_this.cleanup(),reject(error)}},this.mediaRecorder.stop()},_proto.stopWithScriptProcessor=function(duration,resolve,reject){try{for(var _step,totalLength=this.audioBuffers.reduce(function(acc,buffer){return acc+buffer.length},0),mergedBuffer=new Float32Array(totalLength),offset=0,_iterator=_create_for_of_iterator_helper_loose(this.audioBuffers);!(_step=_iterator()).done;){var buffer=_step.value;mergedBuffer.set(buffer,offset),offset+=buffer.length}var wavBlob=this.encodeWAV(mergedBuffer,this.options.sampleRate);this.logger.log("[VoiceRecorder] 录音已停止",{duration:duration.toFixed(2)+"s",size:(wavBlob.size/1024).toFixed(2)+"KB"}),this.cleanup(),resolve(wavBlob)}catch(error){this.logger.error("[VoiceRecorder] 处理录音数据失败",error),this.cleanup(),reject(error)}},_proto.encodeWAV=function(samples,sampleRate){var buffer=new ArrayBuffer(44+2*samples.length),view=new DataView(buffer),writeString=function(offset,string){for(var i=0;i<string.length;i++)view.setUint8(offset+i,string.charCodeAt(i))};return writeString(0,"RIFF"),view.setUint32(4,36+2*samples.length,!0),writeString(8,"WAVE"),writeString(12,"fmt "),view.setUint32(16,16,!0),view.setUint16(20,1,!0),view.setUint16(22,1,!0),view.setUint32(24,sampleRate,!0),view.setUint32(28,2*sampleRate,!0),view.setUint16(32,2,!0),view.setUint16(34,16,!0),writeString(36,"data"),view.setUint32(40,2*samples.length,!0),function(output,offset,input){for(var i=0;i<input.length;i++,offset+=2){var s=Math.max(-1,Math.min(1,input[i]));output.setInt16(offset,s<0?32768*s:32767*s,!0)}}(view,44,samples),new Blob([buffer],{type:"audio/wav"})},_proto.cleanup=function(){this.isRecordingFlag=!1,this.mediaRecorder&&("inactive"!==this.mediaRecorder.state&&this.mediaRecorder.stop(),this.mediaRecorder=null),this.recordedChunks=[],this.scriptProcessor&&(this.scriptProcessor.disconnect(),this.scriptProcessor=null),this.mediaStreamSource&&(this.mediaStreamSource.disconnect(),this.mediaStreamSource=null),this.audioContext&&(this.audioContext.close(),this.audioContext=null),this.stream&&(this.stream.getTracks().forEach(function(track){return track.stop()}),this.stream=null),this.audioBuffers=[]},_proto.destroy=function(){this.cleanup(),this.maxTimer&&(clearTimeout(this.maxTimer),this.maxTimer=null)},_proto.getDuration=function(){return 0===this.startTime?0:(Date.now()-this.startTime)/1e3},_proto.isRecording=function(){return this.isRecordingFlag},VoiceRecorder}(),__DRAWER_PLACEMENTS__=["left","right","top","bottom"],__$DRAWER_DEFAULT_OPTIONS$__={placement:"right",width:300,height:300,showMask:!0,maskClosable:!0,showHeader:!0,showClose:!0,closeOnEscape:!0,open:!1};var _uid=0,Drawer=function(){function Drawer(container,options){var right,_this=this;this._$root=null,this._$mask=null,this._$title=null,this._$close=null,this._$body=null,this._open=!1,this._destroyed=!1,this._hideTimer=null,this._openTimer=null,this._keydownDoc=null,this._onCloseClick=function(e){e.stopPropagation(),_this.open=!1},this._onMaskClick=function(){_this.options.maskClosable&&(_this.open=!1)},this._onRootDblClick=function(e){e.stopPropagation()},this._onKeydown=function(e){e.isComposing||229===e.keyCode||e.defaultPrevented||"Escape"!==e.key&&"Esc"!==e.key||(_this.open=!1)},this.options=Object.assign({},__$DRAWER_DEFAULT_OPTIONS$__,null!=options?options:{}),this._container=this._resolveContainer(container),this._titleId="edrawer-title-"+ ++_uid,this._render(),this.options.getContainer||this._attach(this._container),((null!=(right=Drawer)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?right[Symbol.hasInstance](this):this instanceof right)?this.constructor:void 0)===Drawer&&this.applyInitialOpen()}var Constructor,protoProps,_proto=Drawer.prototype;return _proto.applyInitialOpen=function(){this.options.open&&(this.open=!0)},_proto.setTitle=function(title){this._destroyed||(this.options.title=title,this._$title&&this._mount(this._$title,title))},_proto.setContent=function(content){this._destroyed||(this.options.content=content,this._$body&&this._mount(this._$body,content))},_proto.updateOptions=function(options){var _ref,_this__$root;if(!this._destroyed){this.options=Object.assign(this.options,options);var parent=null!=(_ref=null==(_this__$root=this._$root)?void 0:_this__$root.parentElement)?_ref:null;this._clearTimers(),this._teardownDom(),this._render(),parent&&this._attach(parent),this._unbindEscape(),this._open&&this.options.closeOnEscape&&this._bindEscape()}},_proto.destroy=function(){this._destroyed||(this._destroyed=!0,this._open=!1,this._clearTimers(),this._unbindEscape(),this._teardownDom())},_proto._resolveContainer=function(container){return"string"==typeof container?document.getElementById(container)||this._query(container)||document.body:container||document.body},_proto._query=function(selector){try{return document.querySelector(selector)}catch(unused){return null}},_proto._resolveMountTarget=function(){return(null==this.options.getContainer?void 0:this.options.getContainer.call(this.options))||this._container},_proto._attach=function(target){var root=this._$root;root&&(root.parentNode!==target&&target.appendChild(root),target===target.ownerDocument.body?root.classList.add("edrawer-fixed"):root.classList.remove("edrawer-fixed"))},_proto._getPlacement=function(){var placement=this.options.placement;return placement&&__DRAWER_PLACEMENTS__.includes(placement)?placement:"right"},_proto._getDuration=function(){var duration=this.options.duration;return"number"==typeof duration&&Number.isFinite(duration)&&duration>=0?duration:300},_proto._toSize=function(value){return null==value||""===value?null:"number"==typeof value?value+"px":value},_proto._render=function(){var placement=this._getPlacement(),_this_options=this.options,showMask=_this_options.showMask,showHeader=_this_options.showHeader,showClose=_this_options.showClose,className=_this_options.className,zIndex=_this_options.zIndex,title=_this_options.title,content=_this_options.content,root=document.createElement("div");if(root.className="edrawer edrawer-"+placement+" edrawer-"+(this._open?"open":"hidden"),className&&className.split(/\s+/).forEach(function(cls){cls&&root.classList.add(cls)}),"number"==typeof zIndex&&(root.style.zIndex=""+zIndex),root.style.setProperty("--edrawer-duration",this._getDuration()+"ms"),root.addEventListener("dblclick",this._onRootDblClick),showMask){var mask=document.createElement("div");mask.className="edrawer-mask",mask.addEventListener("click",this._onMaskClick),root.appendChild(mask),this._$mask=mask}var panel=document.createElement("div");panel.className="edrawer-panel",panel.setAttribute("role","dialog");var horizontal="left"===placement||"right"===placement,size=this._toSize(horizontal?this.options.width:this.options.height);if(size&&(horizontal?panel.style.width=size:panel.style.height=size),showHeader){var header=document.createElement("div");header.className="edrawer-header";var titleEl=document.createElement("div");if(titleEl.className="edrawer-title",titleEl.id=this._titleId,void 0!==title&&this._mount(titleEl,title),header.appendChild(titleEl),panel.setAttribute("aria-labelledby",this._titleId),this._$title=titleEl,showClose){var close=document.createElement("button");close.type="button",close.className="edrawer-close",close.setAttribute("aria-label","close"),close.innerHTML='<svg viewBox="0 0 24 24" fill="none" width="1em" height="1em" stroke="currentColor" focusable="false" aria-hidden="true">\n <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,0.707114,-0.707114,0.707099,6.34277,6.34326)" />\n <path d="M0 0L15.9998 0" stroke-linecap="round" stroke-width="1.5" transform="matrix(0.707099,-0.707114,0.707114,0.707099,6.34277,17.6567)" />\n</svg>',close.addEventListener("click",this._onCloseClick),header.appendChild(close),this._$close=close}panel.appendChild(header)}var body=document.createElement("div");body.className="edrawer-body",void 0!==content&&this._mount(body,content),panel.appendChild(body),root.appendChild(panel),this._$root=root,this._$body=body},_proto._mount=function(target,content){"string"!=typeof content?(target.innerHTML="",content&&target.appendChild(content)):target.innerHTML=content},_proto._teardownDom=function(){var _this__$close,_this__$mask,_this__$root_parentNode;null==(_this__$close=this._$close)||_this__$close.removeEventListener("click",this._onCloseClick),null==(_this__$mask=this._$mask)||_this__$mask.removeEventListener("click",this._onMaskClick),this._$root&&(this._$root.removeEventListener("dblclick",this._onRootDblClick),null==(_this__$root_parentNode=this._$root.parentNode)||_this__$root_parentNode.removeChild(this._$root)),this._$root=null,this._$mask=null,this._$title=null,this._$close=null,this._$body=null},_proto._clearTimers=function(){null!==this._hideTimer&&(clearTimeout(this._hideTimer),this._hideTimer=null),null!==this._openTimer&&(clearTimeout(this._openTimer),this._openTimer=null)},_proto._bindEscape=function(){var _ref,_this__$root;this._unbindEscape();var doc=null!=(_ref=null==(_this__$root=this._$root)?void 0:_this__$root.ownerDocument)?_ref:document;doc.addEventListener("keydown",this._onKeydown),this._keydownDoc=doc},_proto._unbindEscape=function(){var _this__keydownDoc;null==(_this__keydownDoc=this._keydownDoc)||_this__keydownDoc.removeEventListener("keydown",this._onKeydown),this._keydownDoc=null},_proto._reflow=function(el){return el.offsetHeight},Constructor=Drawer,(protoProps=[{key:"open",get:function(){return this._open},set:function(open){var _this=this;if(!this._destroyed&&this._open!==open&&this._$root){var target=open?this._resolveMountTarget():null;this._open=open,this._clearTimers();var duration=this._getDuration();open?null==this.options.onOpenStart||this.options.onOpenStart.call(this.options):null==this.options.onCloseStart||this.options.onCloseStart.call(this.options);var root=this._$root;!this._destroyed&&this._open===open&&root&&(open?(this._attach(target),root.classList.remove("edrawer-hidden"),this._reflow(root),root.classList.add("edrawer-open"),this.options.closeOnEscape&&this._bindEscape(),this._openTimer=setTimeout(function(){_this._openTimer=null,null==_this.options.onOpenEnd||_this.options.onOpenEnd.call(_this.options)},duration)):(root.classList.remove("edrawer-open"),this._hideTimer=setTimeout(function(){var _this__$root;_this._hideTimer=null,null==(_this__$root=_this._$root)||_this__$root.classList.add("edrawer-hidden"),null==_this.options.onCloseEnd||_this.options.onCloseEnd.call(_this.options)},duration),this._unbindEscape()),null==this.options.onOpenChange||this.options.onOpenChange.call(this.options,open))}}}])&&function(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}(Constructor.prototype,protoProps),Drawer}();Drawer.VERSION="0.0.1";
13
+ /*
14
+ * @ezuikit/control-message v0.0.1-beta.5
15
+ * Copyright (c) 2026-11-14 15:31:14 Ezviz-OpenBiz
16
+ * Released under the MIT License.
17
+ */
18
+ var __$MESSAGE_DEFAULT_OPTIONS$__={duration:3e3,maxCount:0,position:"top",zIndex:1e3};function _extends(){return _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},_extends.apply(this,arguments)}var _MESSAGE_TYPE_ICONS_={info:'<svg viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor" focusable="false" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"/><path d="M464 336a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"/></svg>',success:'<svg viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor" focusable="false" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 0 1-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"/></svg>',warn:'<svg viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor" focusable="false" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z"/></svg>',error:'<svg viewBox="0 0 1024 1024" width="1em" height="1em" fill="currentColor" focusable="false" aria-hidden="true"><path d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 0 1-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"/></svg>'},__MESSAGE__uid__=0,Message=function(){function Message(container,options){this._$root=null,this._$notificationRoot=null,this._items=[],this._notificationItems=[],this._notificationZIndex=0,this._destroyed=!1,this.options=Object.assign({},__$MESSAGE_DEFAULT_OPTIONS$__,null!=options?options:{}),this._container=this._resolveContainer(container),this._render()}var _proto=Message.prototype;return _proto.info=function(content,options){return this._open(_extends({},options,{type:"info",content:content}))},_proto.success=function(content,options){return this._open(_extends({},options,{type:"success",content:content}))},_proto.warn=function(content,options){return this._open(_extends({},options,{type:"warn",content:content}))},_proto.error=function(content,options){return this._open(_extends({},options,{type:"error",content:content}))},_proto.notification=function(content,options){return this._open(_extends({},options,{type:"notification",content:content}))},_proto.open=function(options){return this._open(options)},_proto.full=function(content,options){return this._open(_extends({},options,{full:!0,content:content}))},_proto.close=function(id){var _this=this;if(void 0===id)this._items.slice().forEach(function(item){return _this._removeItem(item)});else{var item=this._items.find(function(it){return it.id===id});item&&this._removeItem(item)}},_proto.clear=function(){this.close()},_proto.updateOptions=function(options){this._destroyed||(this.options=Object.assign(this.options,options),this._$root&&(this._$root.className=this._buildRootClass(),this._attach(),"number"==typeof this.options.zIndex&&(this._$root.style.zIndex=""+this.options.zIndex)))},_proto.destroy=function(){var _this__$root_parentNode,_this=this;this._destroyed||(this._destroyed=!0,this._items.slice().forEach(function(item){return _this._clearItemTimer(item)}),this._items=[],this._notificationItems=[],this._$root&&(null==(_this__$root_parentNode=this._$root.parentNode)||_this__$root_parentNode.removeChild(this._$root),this._$root=null),this._$notificationRoot=null)},_proto._resolveContainer=function(container){return"string"==typeof container?document.getElementById(container)||this._query(container)||document.body:container||document.body},_proto._query=function(selector){try{return document.querySelector(selector)}catch(unused){return null}},_proto._position=function(){var position=this.options.position;return"left"===position||"right"===position||"bottom"===position?position:"top"},_proto._buildRootClass=function(){var cls=["emessage","emessage-"+this._position()];return this.options.className&&this.options.className.split(/\s+/).forEach(function(c){c&&cls.push(c)}),cls.join(" ")},_proto._render=function(){var _this_options_zIndex,root=document.createElement("div");root.className=this._buildRootClass(),root.style.zIndex=""+(null!=(_this_options_zIndex=this.options.zIndex)?_this_options_zIndex:1e3);var notifications=document.createElement("div");notifications.className="emessage-notifications",notifications.setAttribute("aria-live","polite"),notifications.setAttribute("aria-relevant","additions removals"),root.appendChild(notifications),this._$notificationRoot=notifications,this._$root=root,this._attach()},_proto._attach=function(){var root=this._$root;root&&(this._container===document.body?root.classList.add("emessage-fixed"):root.classList.remove("emessage-fixed"),root.parentNode!==this._container&&this._container.appendChild(root))},_proto._open=function(options){var _options_type,_options_content,_options_full,_ref,_options_duration,_this=this;if(this._destroyed||!this._$root)return"";var left,right,_this__$notificationRoot,type=null!=(_options_type=options.type)?_options_type:"info",isNotification="notification"===type,content=null!=(_options_content=options.content)?_options_content:"",icon="notification"===type?void 0:Message._icons[type],cloneIcon=(left=icon,null!=(right=HTMLElement)&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?!!right[Symbol.hasInstance](left):left instanceof right),full=null!=(_options_full=options.full)&&_options_full,duration=null!=(_ref=null!=(_options_duration=options.duration)?_options_duration:this.options.duration)?_ref:3e3,el=this._createItemElement(type,content,full,icon,cloneIcon),item={id:"emessage-msg-"+ ++__MESSAGE__uid__,type:type,content:content,duration:duration,timer:null,el:el,full:full,onClose:options.onClose},closeButton=el.querySelector(".emessage-close");return null==closeButton||closeButton.addEventListener("click",function(){return _this._removeItem(item)}),isNotification?(el.style.zIndex=""+ ++this._notificationZIndex,null==(_this__$notificationRoot=this._$notificationRoot)||_this__$notificationRoot.insertBefore(el,this._$notificationRoot.firstChild),this._notificationItems.push(item)):this._$root.appendChild(el),this._items.push(item),this._trim(isNotification),duration>0&&(item.timer=window.setTimeout(function(){return _this._removeItem(item)},duration)),null==this.options.onOpen||this.options.onOpen.call(this.options,item),item.id},_proto._createItemElement=function(type,content,full,customIcon,cloneCustomIcon){void 0===cloneCustomIcon&&(cloneCustomIcon=!1);var prefix="emessage",el=document.createElement("div");if(el.className="emessage-item emessage-item-"+type,full&&el.classList.add(prefix+"-item-full"),el.setAttribute("role","alert"),"notification"!==type){var icon=document.createElement("span");if(icon.className=prefix+"-icon","string"==typeof customIcon){icon.classList.add(prefix+"-icon-custom");var image=document.createElement("img");image.src=customIcon,image.alt="",image.setAttribute("aria-hidden","true"),icon.appendChild(image)}else customIcon?(icon.classList.add(prefix+"-icon-custom"),icon.appendChild(cloneCustomIcon?customIcon.cloneNode(!0):customIcon)):icon.innerHTML=_MESSAGE_TYPE_ICONS_[type];el.appendChild(icon)}var contentEl=document.createElement("span");if(contentEl.className=prefix+"-content","string"==typeof content?contentEl.innerHTML=content:content&&contentEl.appendChild(content),el.appendChild(contentEl),full||"notification"===type){var closeButton=document.createElement("span");closeButton.className=prefix+"-close",closeButton.setAttribute("aria-label","关闭消息"),closeButton.innerHTML='<svg viewBox="0 0 16 16" width="1em" height="1em" fill="none" focusable="false" aria-hidden="true"><path d="m4 4 8 8m0-8-8 8" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',el.appendChild(closeButton)}return el},_proto._removeItem=function(item){var idx=this._items.indexOf(item);if(-1!==idx){if(this._items.splice(idx,1),"notification"===item.type){var notificationIndex=this._notificationItems.indexOf(item);-1!==notificationIndex&&this._notificationItems.splice(notificationIndex,1)}this._clearItemTimer(item);var el=item.el;el.classList.add("emessage-item-leave"),window.setTimeout(function(){var _el_parentNode;null==(_el_parentNode=el.parentNode)||_el_parentNode.removeChild(el)},200),null==this.options.onClose||this.options.onClose.call(this.options,item),null==item.onClose||item.onClose.call(item)}},_proto._clearItemTimer=function(item){null!==item.timer&&(clearTimeout(item.timer),item.timer=null)},_proto._trim=function(isNotification){var _this_options_maxCount,_this=this,max=null!=(_this_options_maxCount=this.options.maxCount)?_this_options_maxCount:0;if(!(max<=0))for(var getItems=function(){return isNotification?_this._notificationItems:_this._items.filter(function(item){return"notification"!==item.type})},items=getItems();items.length>max;)this._removeItem(items[0]),items=getItems()},Message.setIcons=function(icons){Message._icons=_extends({},icons)},Message}();Message.VERSION="0.0.1-beta.5",Message._icons={};var zh_CN={title:"广播喊话",defaultVoice:"默认语音",pressToTalk:"按住说话",clickToTalk:"点击录音",sendVoice:"下发语音",recording:"录音中",stopRecording:"停止录音",loading:"加载中...",noVoice:"暂无语音数据",recordingRemaining:"还可录制 {time} 秒",releaseToStop:"松开结束录制",clickToStop:"再次点击按钮结束录制",voiceSentSuccess:"语音下发成功",recordComplete:"录音完成",voiceSendFailed:"语音下发失败",recordFailed:"录音失败",recordTooShort:"录音时长不足3秒",micPermissionDenied:"请允许麦克风权限"},en_US={title:"Voice Broadcast",defaultVoice:"Default Voice",pressToTalk:"Press to Talk",clickToTalk:"Click to Record",sendVoice:"Send Voice",recording:"Recording",stopRecording:"Stop Recording",loading:"Loading...",noVoice:"No voice data",recordingRemaining:"{time}s remaining",releaseToStop:"Release to stop",clickToStop:"Click again to stop",voiceSentSuccess:"Voice sent successfully",recordComplete:"Recording completed",voiceSendFailed:"Failed to send voice",recordFailed:"Recording failed",recordTooShort:"Recording is too short (min 3s)",micPermissionDenied:"Please allow microphone permission"},i18n=new(function(){function I18n(){this.currentLanguage="zh",this.translations={zh:zh_CN,en:en_US}}var _proto=I18n.prototype;return _proto.setLanguage=function(language){this.currentLanguage=language},_proto.t=function(key){return this.translations[this.currentLanguage][key]||key},_proto.getLanguage=function(){return this.currentLanguage},I18n}());function asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _async_to_generator$1(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)})}}function _instanceof(left,right){return null!=right&&"undefined"!=typeof Symbol&&right[Symbol.hasInstance]?!!right[Symbol.hasInstance](left):left instanceof right}function _set_prototype_of$1(o,p){return _set_prototype_of$1=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of$1(o,p)}function _ts_generator$1(thisArg,body){var f,y,t,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]},g=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),d=Object.defineProperty;return d(g,"next",{value:verb(0)}),d(g,"throw",{value:verb(1)}),d(g,"return",{value:verb(2)}),"function"==typeof Symbol&&d(g,Symbol.iterator,{value:function(){return this}}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;g&&(g=0,op[0]&&(_=0)),_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}var PREFIX="ebroadcast",WAVE_BARS=[{height:15,color:"#CCCCCC"},{height:30,color:"#D6D6D6"},{height:45,color:"#E0E0E0"},{height:60,color:"#EBEBEB"},{height:85,color:"#FFFFFF"},{height:60,color:"#EBEBEB"},{height:45,color:"#E0E0E0"},{height:30,color:"#D6D6D6"},{height:15,color:"#CCCCCC"}],BroadcastUI=function(Drawer){function BroadcastUI(container,options){var _this;i18n.setLanguage(options.language||"zh");var isMobile=!!options.isMobile,placement=BroadcastUI.resolvePlacement(options.direction),contentRoot=BroadcastUI.buildContent(isMobile),drawerOptions={title:i18n.t("title"),content:contentRoot,placement:placement,showHeader:!0,showClose:!0,maskClosable:!0,closeOnEscape:!0,className:PREFIX+"-drawer"};return"left"===placement||"right"===placement?drawerOptions.width="80%":drawerOptions.height="80%",(_this=Drawer.call(this,container,drawerOptions)||this).broadcastOptions=options,_this.logger=createLogger(options.logger),_this.isMobile=isMobile,_this.voiceList=options.voiceList||[],_this.isRecording=!1,_this.isStarting=!1,_this.lastTouchTime=0,_this.pendingStop=!1,_this.pendingCancel=!1,_this.tipTimer=null,_this.recordingMessageId=null,_this.waveBars=[],_this.recordingHint=null,_this.waveTimer=null,_this.countdownTimer=null,_this.remainingTime=59,_this.options.onOpenChange=function(open){return _this.handleOpenChange(open)},_this.voiceListElement=contentRoot.querySelector(".ebroadcast-voice-list"),_this.loadingElement=contentRoot.querySelector(".ebroadcast-loading"),_this.emptyElement=contentRoot.querySelector(".ebroadcast-empty"),_this.errorElement=contentRoot.querySelector(".ebroadcast-error"),_this.tipElement=contentRoot.querySelector(".ebroadcast-tip"),_this.talkButton=contentRoot.querySelector(".ebroadcast-talk-btn"),_this.recordingMessage=new Message(contentRoot,{className:PREFIX+"-recording",duration:0,maxCount:1,zIndex:1}),_this.bindEvents(),_this.voiceList.length>0?_this.renderVoiceList():_this.setLoading(!0),_this.logger.log("[BroadcastUI] UI创建完成,isMobile:",isMobile),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_set_prototype_of$1(subClass,superClass)}(BroadcastUI,Drawer);var _proto=BroadcastUI.prototype;return _proto.handleOpenChange=function(open){open||this.cancelRecording()},_proto.cancelRecording=function(){this.isStarting&&(this.pendingCancel=!0),this.isRecording=!1,this.pendingStop=!1,this.hideRecordingMessage(),this.setTalkButtonRecording(!1),this.cancelRecord()},_proto.bindEvents=function(){var _this_voiceListElement,_this=this;null==(_this_voiceListElement=this.voiceListElement)||_this_voiceListElement.addEventListener("click",function(e){var item=e.target.closest(".ebroadcast-voice-item");if(item){var index=parseInt(item.getAttribute("data-index")||"-1",10);_this.selectVoice(index)}}),this.talkButton&&(this.logger.log("[BroadcastUI] 绑定按钮事件,isMobile:",this.isMobile),this.isMobile?(this.logger.log("[BroadcastUI] 使用移动端交互:按住说话"),this.talkButton.addEventListener("touchstart",function(e){e.preventDefault(),e.stopPropagation();var now=Date.now();now-_this.lastTouchTime<300?_this.logger.log("[BroadcastUI] 触摸事件防抖,忽略快速点击"):(_this.lastTouchTime=now,_this.handleRecordStart())},{passive:!1}),this.talkButton.addEventListener("touchend",function(e){e.preventDefault(),e.stopPropagation(),_this.handleRecordStop()},{passive:!1}),this.talkButton.addEventListener("touchcancel",function(){_this.isRecording&&_this.handleRecordStop()})):(this.logger.log("[BroadcastUI] 使用PC端交互:点击切换"),this.talkButton.addEventListener("click",function(e){e.preventDefault(),_this.logger.log("[BroadcastUI] PC端按钮点击事件触发"),_this.handleRecordToggle()})))},_proto.handleRecordToggle=function(){this.isRecording?this.handleRecordStop():this.handleRecordStart()},_proto.handleRecordStart=function(){return _async_to_generator$1(function(){var error;return _ts_generator$1(this,function(_state){switch(_state.label){case 0:if(this.isRecording||this.isStarting)return this.logger.log("[BroadcastUI] 录音已在进行中,忽略重复启动"),[2];_state.label=1;case 1:return _state.trys.push([1,5,,6]),this.logger.log("[BroadcastUI] 开始录音..."),this.pendingStop=!1,this.pendingCancel=!1,this.isStarting=!0,this.showRecordingMessage(),this.setTalkButtonRecording(!0),[4,this.startRecord()];case 2:return _state.sent(),this.isStarting=!1,this.pendingCancel?(this.logger.log("[BroadcastUI] 启动期间面板已关闭,取消录音"),this.pendingCancel=!1,this.isRecording=!1,this.cancelRecord(),[2]):(this.isRecording=!0,this.pendingStop?(this.logger.log("[BroadcastUI] 检测到待处理的停止请求,立即停止录音"),this.pendingStop=!1,[4,this.handleRecordStop()]):[3,4]);case 3:_state.sent(),_state.label=4;case 4:return[3,6];case 5:return error=_state.sent(),this.logger.error("[BroadcastUI] 开始录音失败",error),this.isStarting=!1,this.isRecording=!1,this.pendingStop=!1,this.pendingCancel=!1,this.hideRecordingMessage(),this.setTalkButtonRecording(!1),this.showError(_instanceof(error,Error)?error.message:"开始录音失败"),[3,6];case 6:return[2]}})}).call(this)},_proto.handleRecordStop=function(){return _async_to_generator$1(function(){var error;return _ts_generator$1(this,function(_state){switch(_state.label){case 0:if(this.isStarting)return this.logger.log("[BroadcastUI] 录音正在启动中,标记为待停止"),this.pendingStop=!0,[2];if(!this.isRecording)return this.logger.log("[BroadcastUI] 未在录音状态,忽略停止请求"),[2];_state.label=1;case 1:return _state.trys.push([1,3,,4]),this.logger.log("[BroadcastUI] 停止录音..."),this.hideRecordingMessage(),this.setTalkButtonRecording(!1),[4,this.stopRecord()];case 2:return _state.sent(),this.isRecording=!1,[3,4];case 3:return error=_state.sent(),this.logger.error("[BroadcastUI] 停止录音失败",error),this.isRecording=!1,this.hideRecordingMessage(),this.setTalkButtonRecording(!1),this.showError(_instanceof(error,Error)?error.message:"停止录音失败"),[3,4];case 4:return[2]}})}).call(this)},_proto.setTalkButtonRecording=function(recording){if(this.talkButton){this.talkButton.classList.toggle(PREFIX+"-talk-btn-recording",recording);var textElement=this.talkButton.querySelector(".ebroadcast-talk-text");textElement&&(textElement.textContent=recording?this.isMobile?i18n.t("recording"):i18n.t("stopRecording"):this.isMobile?i18n.t("pressToTalk"):i18n.t("clickToTalk"))}},_proto.showRecordingMessage=function(){if(!this.recordingMessageId){var content=BroadcastUI.buildRecordingContent();this.waveBars=Array.from(content.querySelectorAll("rect")),this.recordingHint=content.querySelector(".ebroadcast-recording-hint"),this.remainingTime=59,this.updateRecordingHint(),this.recordingMessageId=this.recordingMessage.info(content,{duration:0}),this.startWaveAnimation(),this.startCountdown(),this.logger.log("[BroadcastUI] 录音提示已显示")}},_proto.hideRecordingMessage=function(){this.stopWaveAnimation(),this.stopCountdown(),this.recordingMessageId&&(this.recordingMessage.close(this.recordingMessageId),this.recordingMessageId=null,this.logger.log("[BroadcastUI] 录音提示已隐藏")),this.waveBars=[],this.recordingHint=null},_proto.startWaveAnimation=function(){var _this=this;this.stopWaveAnimation();var frame=0;this.waveTimer=window.setInterval(function(){_this.waveBars.forEach(function(bar,index){var phase=(.3*frame+.8*index)%(2*Math.PI),height=30+(Math.sin(phase)+1)/2*50;bar.setAttribute("height",height.toFixed(2)),bar.setAttribute("y",(50-height/2).toFixed(2))}),frame++},100)},_proto.stopWaveAnimation=function(){null!==this.waveTimer&&(clearInterval(this.waveTimer),this.waveTimer=null)},_proto.startCountdown=function(){var _this=this;this.stopCountdown(),this.countdownTimer=window.setInterval(function(){_this.remainingTime--,_this.updateRecordingHint(),_this.remainingTime<=0&&_this.stopCountdown()},1e3)},_proto.stopCountdown=function(){null!==this.countdownTimer&&(clearInterval(this.countdownTimer),this.countdownTimer=null)},_proto.updateRecordingHint=function(){if(this.recordingHint){var remaining=Math.max(0,this.remainingTime);this.recordingHint.textContent=remaining>0?i18n.t("recordingRemaining").replace("{time}",String(remaining)):this.isMobile?i18n.t("releaseToStop"):i18n.t("clickToStop")}},_proto.close=function(){this.open=!1},_proto.updateVoiceList=function(voiceList){this.voiceList=Array.isArray(voiceList)?voiceList:[],this.renderVoiceList()},_proto.renderVoiceList=function(){if(this.voiceListElement){if(this.setLoading(!1),this.setError(""),0===this.voiceList.length)return this.voiceListElement.innerHTML="",this.voiceListElement.parentElement&&(this.voiceListElement.parentElement.style.display="none"),void(this.emptyElement&&(this.emptyElement.style.display="flex"));this.voiceListElement.parentElement&&(this.voiceListElement.parentElement.style.display=""),this.emptyElement&&(this.emptyElement.style.display="none"),this.voiceListElement.innerHTML=this.voiceList.map(function(voice,index){var name=BroadcastUI.escape(voice.voiceName);return'\n <div class="ebroadcast-voice-item" data-index="'+index+'">\n <div class="'+PREFIX+'-voice-icon">\n <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">\n <path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/>\n </svg>\n </div>\n <div class="'+PREFIX+'-voice-text" title="'+name+'">'+name+"</div>\n </div>\n "}).join(""),this.logger.log("[BroadcastUI] 语音列表已渲染",this.voiceList.length)}},_proto.selectVoice=function(index){if(this.voiceListElement&&(this.voiceListElement.querySelectorAll(".ebroadcast-voice-item").forEach(function(item){item.classList.remove(PREFIX+"-voice-item-selected")}),index>=0&&index<this.voiceList.length)){var selectedItem=this.voiceListElement.querySelector('[data-index="'+index+'"]');selectedItem&&selectedItem.classList.add(PREFIX+"-voice-item-selected");var selectedVoice=this.voiceList[index];this.logger.log("[BroadcastUI] 已选中语音:",selectedVoice.voiceName),this.sendVoice(selectedVoice.fileUrl)}},_proto.setRecordingState=function(isRecording){this.isRecording=isRecording,this.logger.log("[BroadcastUI] 录音状态:",isRecording)},_proto.setLoading=function(loading){var _this_voiceListElement;this.loadingElement&&(this.loadingElement.style.display=loading?"flex":"none");var content=null==(_this_voiceListElement=this.voiceListElement)?void 0:_this_voiceListElement.parentElement;loading?(this.emptyElement&&(this.emptyElement.style.display="none"),this.errorElement&&(this.errorElement.style.display="none"),content&&(content.style.display="none")):content&&this.voiceList.length>0&&(content.style.display="")},_proto.setError=function(message){var _this_voiceListElement;if(this.errorElement){this.errorElement.textContent=message,this.errorElement.style.display=message?"flex":"none";var content=null==(_this_voiceListElement=this.voiceListElement)?void 0:_this_voiceListElement.parentElement;message?(this.loadingElement&&(this.loadingElement.style.display="none"),this.emptyElement&&(this.emptyElement.style.display="none"),content&&(content.style.display="none")):content&&this.voiceList.length>0&&(content.style.display="")}},_proto.showSuccess=function(message){this.logger.log("[BroadcastUI] 成功:",message),this.showTip(message,!1)},_proto.showError=function(message){this.logger.error("[BroadcastUI] 错误:",message),this.showTip(message,!0)},_proto.showTip=function(message,isError){var _this=this;this.tipElement&&message&&(this.tipElement.textContent=message,this.tipElement.classList.toggle(PREFIX+"-tip-error",isError),this.tipElement.style.display="block",this.tipElement.offsetWidth,this.tipElement.classList.add(PREFIX+"-tip-visible"),this.tipTimer&&clearTimeout(this.tipTimer),this.tipTimer=window.setTimeout(function(){var _this_tipElement;_this.tipTimer=null,null==(_this_tipElement=_this.tipElement)||_this_tipElement.classList.remove(PREFIX+"-tip-visible"),_this.tipTimer=window.setTimeout(function(){_this.tipTimer=null,_this.tipElement&&(_this.tipElement.style.display="none")},200)},2e3))},_proto.destroy=function(){this.tipTimer&&(clearTimeout(this.tipTimer),this.tipTimer=null),this.stopWaveAnimation(),this.stopCountdown(),this.recordingMessageId=null,this.waveBars=[],this.recordingHint=null,this.recordingMessage.destroy(),Drawer.prototype.destroy.call(this),this.voiceListElement=null,this.loadingElement=null,this.emptyElement=null,this.errorElement=null,this.tipElement=null,this.talkButton=null,this.logger.log("[BroadcastUI] UI已销毁")},BroadcastUI.resolvePlacement=function(direction){return"top"===direction||"bottom"===direction||"left"===direction||"right"===direction?direction:"right"},BroadcastUI.buildContent=function(isMobile){var t=i18n.t.bind(i18n),root=document.createElement("div");return root.className=PREFIX+"-content-root",root.innerHTML='\n \x3c!-- Tab区域 --\x3e\n <div class="ebroadcast-tabs">\n <div class="ebroadcast-tab ebroadcast-tab-active">'+t("defaultVoice")+'</div>\n </div>\n\n \x3c!-- 内容区域 --\x3e\n <div class="'+PREFIX+'-content">\n <div class="'+PREFIX+'-voice-list"></div>\n </div>\n\n \x3c!-- 状态区:加载 / 空 / 错误,互斥展示 --\x3e\n <div class="'+PREFIX+'-loading" style="display:none;">'+t("loading")+'</div>\n <div class="'+PREFIX+'-empty" style="display:none;">'+t("noVoice")+'</div>\n <div class="'+PREFIX+'-error" style="display:none;"></div>\n\n \x3c!-- 底部按钮 --\x3e\n <div class="'+PREFIX+'-footer">\n <button class="'+PREFIX+'-talk-btn" type="button">\n <span class="'+PREFIX+'-talk-text">'+t(isMobile?"pressToTalk":"clickToTalk")+'</span>\n </button>\n </div>\n\n \x3c!-- 轻提示:showSuccess / showError 复用 --\x3e\n <div class="'+PREFIX+'-tip" style="display:none;"></div>\n ',root},BroadcastUI.buildRecordingContent=function(){var bars=WAVE_BARS.map(function(bar,index){return'<rect x="'+(5+16*index)+'" y="'+(50-bar.height/2)+'" width="12" height="'+bar.height+'" rx="6" fill="'+bar.color+'" />'}).join(""),root=document.createElement("span");return root.className=PREFIX+"-recording-content",root.innerHTML='<svg class="ebroadcast-recording-wave" viewBox="0 0 150 100" width="80" height="40" aria-hidden="true" focusable="false">'+bars+'</svg><span class="'+PREFIX+'-recording-hint" aria-live="off"></span>',root},BroadcastUI.escape=function(value){return String(null!=value?value:"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")},BroadcastUI}(Drawer);function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)})}}function _set_prototype_of(o,p){return _set_prototype_of=Object.setPrototypeOf||function(o,p){return o.__proto__=p,o},_set_prototype_of(o,p)}function _ts_generator(thisArg,body){var f,y,t,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]},g=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),d=Object.defineProperty;return d(g,"next",{value:verb(0)}),d(g,"throw",{value:verb(1)}),d(g,"return",{value:verb(2)}),"function"==typeof Symbol&&d(g,Symbol.iterator,{value:function(){return this}}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;g&&(g=0,op[0]&&(_=0)),_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}var _BROADCAST_DefaultOptions_={channelNo:"1",env:{domain:"https://open.ys7.com"},language:"zh"},Broadcast=function(BroadcastUI){function Broadcast(options){var _this,broadcastOptions=Object.assign({},_BROADCAST_DefaultOptions_,options);return(_this=BroadcastUI.call(this,broadcastOptions.container||document.body,broadcastOptions)||this).voiceRecorder=null,_this.maxDurationTimer=null,_this.pendingAudioBlob=null,_this.logger.log("1.0.0-beta.1 init"),_this}!function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),superClass&&_set_prototype_of(subClass,superClass)}(Broadcast,BroadcastUI);var _proto=Broadcast.prototype;return _proto.invoke=function(name){for(var _len=arguments.length,args=new Array(_len>1?_len-1:0),_key=1;_key<_len;_key++)args[_key-1]=arguments[_key];var callback=this.broadcastOptions[name];if("function"==typeof callback)try{callback.apply(void 0,[].concat(args))}catch(error){this.logger.error('回调 "'+name+'" 执行出错:',error)}},_proto.initMicrophonePermission=function(){return _async_to_generator(function(){var error;return _ts_generator(this,function(_state){switch(_state.label){case 0:return _state.trys.push([0,2,,3]),this.logger.log("开始请求麦克风权限..."),[4,navigator.mediaDevices.getUserMedia({audio:{sampleRate:16e3,channelCount:1,echoCancellation:!0,noiseSuppression:!0}})];case 1:return _state.sent().getTracks().forEach(function(track){return track.stop()}),this.logger.log("麦克风权限已获取"),[3,3];case 2:return error=_state.sent(),this.logger.warn("麦克风权限获取失败,将在首次录音时再次请求",error),this.invoke("onError",{msg:"麦克风权限获取失败",error:error}),[3,3];case 3:return[2]}})}).call(this)},_proto.requestMicrophonePermission=function(){return _async_to_generator(function(){var error;return _ts_generator(this,function(_state){switch(_state.label){case 0:return _state.trys.push([0,2,,3]),this.logger.log("手动请求麦克风权限..."),[4,navigator.mediaDevices.getUserMedia({audio:{sampleRate:16e3,channelCount:1,echoCancellation:!0,noiseSuppression:!0}})];case 1:return _state.sent().getTracks().forEach(function(track){return track.stop()}),this.logger.log("麦克风权限已获取"),[2,!0];case 2:return error=_state.sent(),this.logger.error("麦克风权限获取失败",error),this.invoke("onError",{msg:"麦克风权限获取失败",error:error}),[2,!1];case 3:return[2]}})}).call(this)},_proto.handleOpenChange=function(open){BroadcastUI.prototype.handleOpenChange.call(this,open),open?(0===this.voiceList.length&&this.loadVoiceList(),this.invoke("onOpen"),this.logger.log("云广播界面已打开")):(this.invoke("onClose"),this.logger.log("云广播界面已关闭"))},_proto.loadVoiceList=function(){this.logger.log("请求加载语音列表"),this.invoke("onRequestQueryVoiceList",{deviceSerial:this.broadcastOptions.deviceSerial,channelNo:this.broadcastOptions.channelNo,pageSize:50})},_proto.startRecord=function(){return _async_to_generator(function(){var _this,error;return _ts_generator(this,function(_state){switch(_state.label){case 0:_this=this,_state.label=1;case 1:return _state.trys.push([1,3,,4]),this.logger.log("开始录音"),this.pendingAudioBlob=null,this.voiceRecorder||(this.voiceRecorder=new VoiceRecorder({minDuration:3,maxDuration:59,sampleRate:16e3,logger:this.logger})),[4,this.voiceRecorder.start()];case 2:return _state.sent(),this.maxDurationTimer=window.setTimeout(function(){return _async_to_generator(function(){return _ts_generator(this,function(_state){switch(_state.label){case 0:return this.logger.log("达到最大录音时长,停止录音并暂存"),[4,this.stopRecordAndCache()];case 1:return _state.sent(),[2]}})}).call(_this)},59e3),this.invoke("onRecordStart"),this.setRecordingState(!0),[3,4];case 3:return error=_state.sent(),this.logger.error("开始录音失败",error),this.invoke("onRecordError",{msg:"开始录音失败",error:error}),[3,4];case 4:return[2]}})}).call(this)},_proto.stopRecordAndCache=function(){return _async_to_generator(function(){var audioBlob,error;return _ts_generator(this,function(_state){switch(_state.label){case 0:return _state.trys.push([0,2,,3]),this.voiceRecorder?this.voiceRecorder.isRecording()?[4,this.voiceRecorder.stop()]:(this.logger.warn("录音器已停止"),[2]):[2];case 1:return 0===(audioBlob=_state.sent()).size?(this.logger.warn("录音数据为空"),[2]):(this.pendingAudioBlob=audioBlob,this.invoke("onRecordComplete",audioBlob),[3,3]);case 2:return error=_state.sent(),this.logger.error("停止录音失败",error),this.setRecordingState(!1),[3,3];case 3:return[2]}})}).call(this)},_proto.stopRecord=function(){return _async_to_generator(function(){var audioBlob,audioBlob1,error;return _ts_generator(this,function(_state){switch(_state.label){case 0:if(_state.trys.push([0,2,,3]),this.clearMaxDurationTimer(),this.pendingAudioBlob)return audioBlob=this.pendingAudioBlob,this.pendingAudioBlob=null,this.invoke("onRecordStop"),this.setRecordingState(!1),this.sendVoiceOnce(audioBlob),[2];if(!this.voiceRecorder)throw new Error("录音器未初始化");return this.voiceRecorder.isRecording()?[4,this.voiceRecorder.stop()]:(this.logger.warn("录音器已停止"),this.setRecordingState(!1),[2]);case 1:return 0===(audioBlob1=_state.sent()).size?(this.logger.error("录音数据为空,不进行下发"),this.setRecordingState(!1),[2]):(this.invoke("onRecordStop"),this.invoke("onRecordComplete",audioBlob1),this.setRecordingState(!1),this.sendVoiceOnce(audioBlob1),[3,3]);case 2:return error=_state.sent(),this.logger.error("停止录音失败",error),this.invoke("onRecordError",{msg:"停止录音失败",error:error}),this.setRecordingState(!1),[3,3];case 3:return[2]}})}).call(this)},_proto.cancelRecord=function(){var _this_voiceRecorder,_this=this;this.clearMaxDurationTimer(),this.pendingAudioBlob=null,(null==(_this_voiceRecorder=this.voiceRecorder)?void 0:_this_voiceRecorder.isRecording())&&this.voiceRecorder.stop().then(function(){return _this.logger.log("已取消录音,录音已丢弃")},function(){return _this.logger.log("已取消录音(录音时长不足)")})},_proto.clearMaxDurationTimer=function(){this.maxDurationTimer&&(clearTimeout(this.maxDurationTimer),this.maxDurationTimer=null)},_proto.sendVoiceOnce=function(voiceFile){var _this_broadcastOptions=this.broadcastOptions,deviceSerial=_this_broadcastOptions.deviceSerial,channelNo=_this_broadcastOptions.channelNo;this.invoke("onVoiceRecorded",{voiceFile:voiceFile,deviceSerial:deviceSerial,channelNo:channelNo}),this.invoke("onRequestSendVoiceOnce",{voiceFile:voiceFile,deviceSerial:deviceSerial,channelNo:channelNo})},_proto.sendVoice=function(fileUrl){this.logger.log("请求下发默认语音",fileUrl),this.invoke("onRequestSendVoice",{fileUrl:fileUrl,deviceSerial:this.broadcastOptions.deviceSerial,channelNo:this.broadcastOptions.channelNo})},_proto.updateOptions=function(options){this.broadcastOptions=Object.assign(this.broadcastOptions,options),this.logger.log("配置已更新",Object.keys(options))},_proto.destroy=function(){this.logger.log("开始销毁"),this.close(),this.clearMaxDurationTimer(),this.pendingAudioBlob=null,this.voiceRecorder&&(this.voiceRecorder.destroy(),this.voiceRecorder=null),BroadcastUI.prototype.destroy.call(this),this.voiceList=[],this.logger.log("销毁完成")},Broadcast}(BroadcastUI);return Broadcast.VERSION="1.0.0-beta.1",Broadcast});
@@ -0,0 +1,3 @@
1
+ import '@ezuikit/control-drawer/dist/style/style';
2
+ import '@ezuikit/control-message/dist/style/style';
3
+ import './style/broadcast.scss';