@tencentcloud/call-engine-wx
Version:
Tencent Cloud TUICallEngine SDK for Wechat
3 lines • 107 kB
JavaScript
Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@tencentcloud/chat"),t=require("@tencentcloud/trtc-component-wx");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(e),r=n(t);function o(e,t,n,i){return new(n||(n=Promise))(function(r,o){function a(e){try{l(i.next(e))}catch(t){o(t)}}function s(e){try{l(i.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}l((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;var a={};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function i(){}function r(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,i,o,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new r(i,o||e,a),l=n?n+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],s]:e._events[l].push(s):(e._events[l]=s,e._eventsCount++),e}function a(e,t){0===--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(n?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},s.prototype.listeners=function(e){var t=n?n+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,o=i.length,a=new Array(o);r<o;r++)a[r]=i[r].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,r,o,a){var s=n?n+e:e;if(!this._events[s])return!1;var l,u,c=this._events[s],d=arguments.length;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),d){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,i),!0;case 4:return c.fn.call(c.context,t,i,r),!0;case 5:return c.fn.call(c.context,t,i,r,o),!0;case 6:return c.fn.call(c.context,t,i,r,o,a),!0}for(u=1,l=new Array(d-1);u<d;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var f,v=c.length;for(u=0;u<v;u++)switch(c[u].once&&this.removeListener(e,c[u].fn,void 0,!0),d){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,t);break;case 3:c[u].fn.call(c[u].context,t,i);break;case 4:c[u].fn.call(c[u].context,t,i,r);break;default:if(!l)for(f=1,l=new Array(d-1);f<d;f++)l[f-1]=arguments[f];c[u].fn.apply(c[u].context,l)}}return!0},s.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,i,r){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||r&&!s.once||i&&s.context!==i||a(this,o);else{for(var l=0,u=[],c=s.length;l<c;l++)(s[l].fn!==t||r&&!s[l].once||i&&s[l].context!==i)&&u.push(s[l]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}({get exports(){return a},set exports(e){a=e}});var s,l,u,c,d,f,v,h=a;exports.TUIErrorCode=void 0,(s=exports.TUIErrorCode||(exports.TUIErrorCode={}))[s.ERR_SUCC=0]="ERR_SUCC",s[s.ERR_FAILED=-1]="ERR_FAILED",s[s.ERR_INVALID_PARAMETER=-1001]="ERR_INVALID_PARAMETER",s[s.ERR_SDK_NOT_INITIALIZED=-1002]="ERR_SDK_NOT_INITIALIZED",s[s.ERR_PERMISSION_DENIED=-1003]="ERR_PERMISSION_DENIED",s[s.ERR_REQUIRE_PAYMENT=-1004]="ERR_REQUIRE_PAYMENT",s[s.ERR_CAMERA_START_FAILED=-1100]="ERR_CAMERA_START_FAILED",s[s.ERR_CAMERA_NOT_AUTHORIZED=-1101]="ERR_CAMERA_NOT_AUTHORIZED",s[s.ERR_CAMERA_OCCUPIED=-1102]="ERR_CAMERA_OCCUPIED",s[s.ERR_CAMERA_DEVICE_EMPTY=-1103]="ERR_CAMERA_DEVICE_EMPTY",s[s.ERR_MICROPHONE_START_FAILED=-1104]="ERR_MICROPHONE_START_FAILED",s[s.ERR_MICROPHONE_NOT_AUTHORIZED=-1105]="ERR_MICROPHONE_NOT_AUTHORIZED",s[s.ERR_MICROPHONE_OCCUPIED=-1106]="ERR_MICROPHONE_OCCUPIED",s[s.ERR_MICROPHONE_DEVICE_EMPTY=-1107]="ERR_MICROPHONE_DEVICE_EMPTY",s[s.ERR_ROOM_NAME_INVALID=-2107]="ERR_ROOM_NAME_INVALID",s[s.ERR_USER_NOT_EXIST=-2200]="ERR_USER_NOT_EXIST",s[s.ERR_REQUEST_ID_INVALID=-2311]="ERR_REQUEST_ID_INVALID",exports.TUIVideoQuality=void 0,(l=exports.TUIVideoQuality||(exports.TUIVideoQuality={}))[l.kVideoQuality_360p=1]="kVideoQuality_360p",l[l.kVideoQuality_540p=2]="kVideoQuality_540p",l[l.kVideoQuality_720p=3]="kVideoQuality_720p",l[l.kVideoQuality_1080p=4]="kVideoQuality_1080p",exports.TUIResolutionMode=void 0,(u=exports.TUIResolutionMode||(exports.TUIResolutionMode={}))[u.kResolutionMode_Landscape=0]="kResolutionMode_Landscape",u[u.kResolutionMode_Portrait=1]="kResolutionMode_Portrait",exports.TUICallEvent=void 0,(c=exports.TUICallEvent||(exports.TUICallEvent={})).ERROR="onError",c.SDK_READY="sdkReady",c.KICKED_OUT="onKickedOffLine",c.onUserSigExpired="onUserSigExpired",c.ON_CALL_BEGIN="onCallBegin",c.INVITED="onInvited",c.ON_CALL_RECEIVED="onCallReceived",c.USER_ACCEPT="onUserAccept",c.USER_ENTER="onUserJoin",c.USER_LEAVE="onUserLeave",c.REJECT="onUserReject",c.NO_RESP="onUserNoResponse",c.LINE_BUSY="onUserLineBusy",c.CALLING_CANCEL="onCallingCancel",c.ON_CALL_CANCELED="onCallCancelled",c.CALL_END="onCallEnd",c.CALLING_END="onCallEnd",c.USER_VIDEO_AVAILABLE="onUserVideoAvailable",c.USER_AUDIO_AVAILABLE="onUserAudioAvailable",c.USER_VOICE_VOLUME="onUserVoiceVolumeChanged",c.GROUP_CALL_INVITEE_LIST_UPDATE="onGroupCallInviteeListUpdate",c.CALL_TYPE_CHANGED="onCallMediaTypeChanged",c.DEVICED_UPDATED="onDeviceUpdated",c.ON_USER_NETWORK_QUALITY_CHANGED="onUserNetworkQualityChanged",c.MESSAGE_SENT_BY_ME="onMessageSentByMe",c.onDeviceChange="onDeviceChange",c.ON_CALL_NOT_CONNECTED="onCallNotConnected",c.ON_USER_INVITING="onUserInviting",exports.TUICallCameraPosition=void 0,(d=exports.TUICallCameraPosition||(exports.TUICallCameraPosition={}))[d.FRONT=0]="FRONT",d[d.BACK=1]="BACK",exports.AUDIO_PLAYBACK_DEVICE=void 0,(f=exports.AUDIO_PLAYBACK_DEVICE||(exports.AUDIO_PLAYBACK_DEVICE={}))[f.SPEAKER=0]="SPEAKER",f[f.EAR=1]="EAR",exports.AUDIO_ROUTE=void 0,(v=exports.AUDIO_ROUTE||(exports.AUDIO_ROUTE={})).SPEAKER="speaker",v.EAR="ear";var p;exports.CallEndReason=void 0,(p=exports.CallEndReason||(exports.CallEndReason={}))[p.UnKnown=0]="UnKnown",p[p.Hangup=1]="Hangup",p[p.Reject=2]="Reject",p[p.NoResponse=3]="NoResponse",p[p.Offline=4]="Offline",p[p.LineBusy=5]="LineBusy",p[p.Canceled=6]="Canceled",p[p.OtherDeviceAccepted=7]="OtherDeviceAccepted",p[p.OtherDeviceReject=8]="OtherDeviceReject",p[p.EndByServer=9]="EndByServer";var m,g,y,_,T,C,E,R="3.3.0";exports.TRTCVideoResolution=void 0,(m=exports.TRTCVideoResolution||(exports.TRTCVideoResolution={}))[m.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",m[m.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",m[m.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",m[m.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",m[m.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080",exports.TRTCVideoFillMode=void 0,(g=exports.TRTCVideoFillMode||(exports.TRTCVideoFillMode={}))[g.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",g[g.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit",exports.TRTCVideoMirrorType=void 0,(y=exports.TRTCVideoMirrorType||(exports.TRTCVideoMirrorType={}))[y.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",y[y.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",y[y.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable",exports.TRTCBeautyStyle=void 0,(_=exports.TRTCBeautyStyle||(exports.TRTCBeautyStyle={}))[_.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",_[_.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature";class b{constructor(e="",t="",n="",i="",r=""){this.deviceId=e,this.deviceName=t,this.kind=n,this.label=i,this.groupId=r}}class I{constructor(e=exports.TRTCVideoResolution.TRTCVideoResolution_640_480,t=15,n=550){this.videoResolution=e,this.videoFps=t,this.videoBitrate=n}}exports.TRTCVideoRotation=void 0,(T=exports.TRTCVideoRotation||(exports.TRTCVideoRotation={}))[T.TRTCVideoRotation0=0]="TRTCVideoRotation0",T[T.TRTCVideoRotation90=1]="TRTCVideoRotation90",T[T.TRTCVideoRotation180=2]="TRTCVideoRotation180",T[T.TRTCVideoRotation270=3]="TRTCVideoRotation270";exports.TRTCQuality=void 0,(C=exports.TRTCQuality||(exports.TRTCQuality={}))[C.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",C[C.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",C[C.TRTCQuality_Good=2]="TRTCQuality_Good",C[C.TRTCQuality_Poor=3]="TRTCQuality_Poor",C[C.TRTCQuality_Bad=4]="TRTCQuality_Bad",C[C.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",C[C.TRTCQuality_Down=6]="TRTCQuality_Down",exports.TRTCLogLevel=void 0,(E=exports.TRTCLogLevel||(exports.TRTCLogLevel={}))[E.TRTCLogLevelVerbose=0]="TRTCLogLevelVerbose",E[E.TRTCLogLevelDebug=1]="TRTCLogLevelDebug",E[E.TRTCLogLevelInfo=2]="TRTCLogLevelInfo",E[E.TRTCLogLevelWarn=3]="TRTCLogLevelWarn",E[E.TRTCLogLevelError=4]="TRTCLogLevelError",E[E.TRTCLogLevelFatal=5]="TRTCLogLevelFatal",E[E.TRTCLogLevelNone=6]="TRTCLogLevelNone";const S={cover:exports.TRTCVideoFillMode.TRTCVideoFillMode_Fill,fill:exports.TRTCVideoFillMode.TRTCVideoFillMode_Fill,contain:exports.TRTCVideoFillMode.TRTCVideoFillMode_Fit},w="string",A="object",O="array",D="function",P="undefined",N={ELECTRON:"electron",WEB:"web",MINI_PROGRAM:"miniProgram"},L="麦克风权限授权",V="使用语音通话,需要在设置中对麦克风进行授权允许",U="麦克风、摄像头权限授权",k="使用视频通话,需要在设置中对麦克风、摄像头进行授权允许",M="去设置",x="麦克风权限未开启",$="在设置-应用-微信-权限中开启麦克风权限,以正常使用音视频通话功能",F="麦克风/摄像头权限未开启",j="在设置-应用-微信-权限中开启麦克风/摄像头权限,以正常使用音视频通话功能",J="前往设置",W="authorized",B="scope.record",K="scope.camera",G="cameraAuthorized",H="microphoneAuthorized",Q=65535;var Y;function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function q(e,t,n,i,r,o,a){try{var s=e[o](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,r)}function X(e){return function(){var t=this,n=arguments;return new Promise(function(i,r){var o=e.apply(t,n);function a(e){q(o,i,r,a,s,"next",e)}function s(e){q(o,i,r,a,s,"throw",e)}a(void 0)})}}function Z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ee(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,ae(i.key),i)}}function te(e,t,n){return t&&ee(e.prototype,t),n&&ee(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function ne(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",r=n.toStringTag||"@@toStringTag";function o(n,i,r,o){var l=i&&i.prototype instanceof s?i:s,u=Object.create(l.prototype);return ie(u,"_invoke",function(n,i,r){var o,s,l,u=0,c=r||[],d=!1,f={p:0,n:0,v:e,a:v,f:v.bind(e,4),d:function(t,n){return o=t,s=0,l=e,f.n=n,a}};function v(n,i){for(s=n,l=i,t=0;!d&&u&&!r&&t<c.length;t++){var r,o=c[t],v=f.p,h=o[2];n>3?(r=h===i)&&(l=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=v&&((r=n<2&&v<o[1])?(s=0,f.v=i,f.n=o[1]):v<h&&(r=n<3||o[0]>i||i>h)&&(o[4]=n,o[5]=i,f.n=h,s=0))}if(r||n>1)return a;throw d=!0,i}return function(r,c,h){if(u>1)throw TypeError("Generator is already running");for(d&&1===c&&v(c,h),s=c,l=h;(t=s<2?e:l)||!d;){o||(s?s<3?(s>1&&(f.n=-1),v(s,l)):f.n=l:f.v=l);try{if(u=2,o){if(s||(r="next"),t=o[r]){if(!(t=t.call(o,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(l=TypeError("The iterator does not provide a '"+r+"' method"),s=1);o=e}else if((t=(d=f.n<0)?l:n.call(i,f))!==a)break}catch(t){o=e,s=1,l=t}finally{u=1}}return{value:t,done:d}}}(n,r,o),!0),u}var a={};function s(){}function l(){}function u(){}t=Object.getPrototypeOf;var c=[][i]?t(t([][i]())):(ie(t={},i,function(){return this}),t),d=u.prototype=s.prototype=Object.create(c);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,ie(e,r,"GeneratorFunction")),e.prototype=Object.create(d),e}return l.prototype=u,ie(d,"constructor",u),ie(u,"constructor",l),l.displayName="GeneratorFunction",ie(u,r,"GeneratorFunction"),ie(d),ie(d,r,"Generator"),ie(d,i,function(){return this}),ie(d,"toString",function(){return"[object Generator]"}),(ne=function(){return{w:o,m:f}})()}function ie(e,t,n,i){var r=Object.defineProperty;try{r({},"",{})}catch(e){r=0}ie=function(e,t,n,i){function o(t,n){ie(e,t,function(e){return this._invoke(t,n,e)})}t?r?r(e,t,{value:n,enumerable:!i,configurable:!i,writable:!i}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},ie(e,t,n,i)}function re(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,r,o,a,s=[],l=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(i=o.call(n)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){u=!0,r=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw r}}return s}}(e,t)||le(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function oe(e){return function(e){if(Array.isArray(e))return z(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||le(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ae(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function se(e){return se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},se(e)}function le(e,t){if(e){if("string"==typeof e)return z(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?z(e,t):void 0}}!function(e){e[e.UNKNOWN=65535]="UNKNOWN",e[e.ERROR_REQUEST_REPEATED=-1204]="ERROR_REQUEST_REPEATED"}(Y||(Y={}));var ue=function(e){return function(e){return se(Array.isArray)===D?Array.isArray(e):fe(e)===O}(e)||function(e){return null!==e&&se(e)===A}(e)},ce=function(e){return se(e)===D},de=function(e){return e instanceof Error},fe=function(e){return Object.prototype.toString.call(e).match(/^\[object (.*)\]$/)[1].toLowerCase()};Date.now||(Date.now=function(){return(new Date).getTime()});var ve=function(e){return JSON.stringify(e,["message","code"])};function he(e){if("string"!=typeof e)return e;var t;try{var n=JSON.parse(e);t="object"===se(n)&&n?n:e}catch(i){t=e}return t}function pe(){return new Promise(function(){var e=X(ne().m(function e(t,n){return ne().w(function(e){for(;;)switch(e.n){case 0:wx.getSetting({success:function(e){var n=null;n=wx.$TUICallKitPlugin?e.miniprogramAuthSetting:e.authSetting,t(n)},fail:function(e){n(e)}});case 1:return e.a(2)}},e)}));return function(t,n){return e.apply(this,arguments)}}())}function me(){return(me=X(ne().m(function e(t){var n,i,r,o,a,s,l,u;return ne().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t){e.n=1;break}return e.a(2,!1);case 1:return n=t.microphone,i=void 0!==n&&n,r=t.camera,o=void 0!==r&&r,e.p=2,e.n=3,pe();case 3:if(u=e.v){e.n=4;break}u=!1;case 4:if(s=(a=u)[B],l=a[K],!i||!o){e.n=5;break}return e.a(2,s&&l);case 5:if(!i){e.n=6;break}return e.a(2,s);case 6:if(!o){e.n=7;break}return e.a(2,l);case 7:return e.a(2,!1);case 8:return e.p=8,e.v,e.a(2,!1)}},e,null,[[2,8]])}))).apply(this,arguments)}function ge(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={title:e.title,desc:e.description||"",extension:e.extension||"",is_disable_push:e.isDisablePush||!1,ios_push_type:e.iOSPushType||0,android_push_type:e.androidPushType||0,ignore_ios_badge:!!e.ignoreIOSBadge,android_vivo_classification:e.androidVIVOClassification};return e.iOSSound&&(t.ios_sound=e.iOSSound),e.androidSound&&(t.android_sound=e.androidSound),e.androidOPPOChannelID&&(t.android_oppo_channel_id=e.androidOPPOChannelID),e.androidFCMChannelID&&(t.android_fcm_channel_id=e.androidFCMChannelID),e.androidXiaoMiChannelID&&(t.android_xiaomi_channel_id=e.androidXiaoMiChannelID),e.androidHuaWeiCategory&&(t.android_huawei_category=e.androidHuaWeiCategory),t}function ye({code:e,params:t,enableDocLink:n=!1,languageList:i=["en","zh-CN"]}){let r,o="";const a=Y[e];try{i.forEach(e=>{switch(e){case"en":r=_e[a];break;case"zh-CN":r=Te[a]}ce(r)?(o=o?`${o} `:o,o+=r(t)):se(r)===w&&(o=r)})}catch(s){r=_e.UNKNOWN_ERROR}return n&&(o+=" doc:"),o}const _e={ERROR_REQUEST_REPEATED:({fnName:e})=>`you are already ${e}(), cannot repeated call '${e}'.`,UNKNOWN_ERROR:({fnName:e,error:t})=>`'${e}' throw unknown exception${t?`, error: ${t.toString()}.`:"."}`},Te={ERROR_REQUEST_REPEATED:({fnName:e})=>`你已经调用 ${e}(), 请勿重复调用 '${e}'。`};class Ce extends Error{constructor({name:e="",code:t=Q,message:n="",messageParams:i={},extraCode:r="",fnName:o=""}){super(n||ye({code:t,params:Object.assign({fnName:o},i)})),this.name="TUICallEngineError",this.message="",this.functionName="",this.name=e||this.name,this.code=t,this.functionName=o||this.functionName,this.message=n||this.message}getCode(){return this.code}}const Ee={[exports.TUICallEvent.ERROR]:["code","message"],[exports.TUICallEvent.KICKED_OUT]:["message"],[exports.TUICallEvent.onUserSigExpired]:[],[exports.TUICallEvent.ON_CALL_RECEIVED]:["callerId","calleeIdList","chatGroupID","callMediaType","userData","roomID","strRoomID","callId","callRole"],[exports.TUICallEvent.ON_CALL_BEGIN]:["roomID","strRoomID","callMediaType","callRole","callId","chatGroupID"],[exports.TUICallEvent.CALLING_END]:["roomID","strRoomID","callMediaType","callRole","callId","totalTime","reason","userID","chatGroupID"],[exports.TUICallEvent.LINE_BUSY]:["userID"],[exports.TUICallEvent.REJECT]:["userID"],[exports.TUICallEvent.USER_ACCEPT]:["userID"],[exports.TUICallEvent.ON_CALL_CANCELED]:["userID","callId","roomID","strRoomID","callMediaType","callRole"],[exports.TUICallEvent.NO_RESP]:["userIDList"],[exports.TUICallEvent.ON_USER_INVITING]:["userID"],[exports.TUICallEvent.USER_ENTER]:["userID"],[exports.TUICallEvent.USER_LEAVE]:["userID"],[exports.TUICallEvent.USER_AUDIO_AVAILABLE]:["userID","isAudioAvailable"],[exports.TUICallEvent.USER_VIDEO_AVAILABLE]:["userID","isVideoAvailable"],[exports.TUICallEvent.USER_VOICE_VOLUME]:["userID","isVideoAvailable"],[exports.TUICallEvent.ON_USER_NETWORK_QUALITY_CHANGED]:["network"],[exports.TUICallEvent.ON_CALL_NOT_CONNECTED]:["userID","callId","roomID","strRoomID","callMediaType","callRole","reason","chatGroupID"],[exports.TUICallEvent.onDeviceChange]:["deviceId","type","state"]};function Re(e,t){const n=he(t),i=Ee[e],r={};if(e===exports.TUICallEvent.ON_CALL_RECEIVED)i.forEach((e,t)=>{r[e]="userIDList"===e&&1===t?Array.from(new Set(he(n[t]))):n[t]});else i.forEach((e,t)=>{r[e]=n[t]});return r}var be,Ie;be="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};for(var Se=function(){},we=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],Ae=we.length;Ae--;)Ie=we[Ae],console[Ie]||(be[Ie]=Se);be.methods=we;var Oe,De=be;const Pe="undefined"!=typeof wx&&"function"==typeof wx.getSystemInfoSync&&Boolean(wx.getSystemInfoSync().fontSizeSetting),Ne=(null===window||void 0===window?void 0:window.navigator)&&(null===(Oe=null===window||void 0===window?void 0:window.navigator)||void 0===Oe?void 0:Oe.userAgent)||"",Le=/iPad/i.test(Ne),Ve=/iPhone/i.test(Ne)&&!Le,Ue=/iPod/i.test(Ne),ke=Ve||Le||Ue,Me=/Android/i.test(Ne),xe=new RegExp("HeadlessChrome","i").test(Ne);var $e=0,Fe="%cCallEngine%c%s",je="padding: 1px 4px;border-radius: 3px;color: #fff;background: #444;",Je="display: inline",We=!(ke||Me||xe);function Be(){var e=new Date;return"[".concat(e.toLocaleTimeString("en-US",{hour12:!1}),".").concat(function(e){var t;switch(e.toString().length){case 1:t="00".concat(e);break;case 2:t="0".concat(e);break;default:t=e}return t}(e.getMilliseconds()),"]")}var Ke,Ge,He,Qe={_data:[],_length:0,_visible:!1,arguments2String:function(e,t){var n;if(1===t.length)n="".concat(Be()," <").concat(e,"> ").concat(t[0]);else{n="".concat(Be()," <").concat(e,"> ");for(var i=0,r=t.length;i<r;i++)ue(t[i])?de(t[i])?n+=ve(t[i]):n+=JSON.stringify(t[i]):n+=t[i],n+=" "}return n},info:function(){if($e<=1){var e=this.arguments2String("INFO",arguments);Qe.record(e,"info"),We?De.info(Fe,je,Je,e):De.info(e)}},error:function(){if($e<=3){var e=this.arguments2String("ERROR",arguments);Qe.record(e,"error"),We?De.error(Fe,je,Je,e):De.error(e)}},setLevel:function(e){e<4&&De.log("".concat(Be(),"set level from ").concat($e," to ").concat(e)),$e=e},getLevel:function(){return $e},record:function(e,t){1100===Qe._length&&(Qe._data.splice(0,100),Qe._length=1e3),Qe._length++,Qe._data.push("".concat(e," [").concat(t,"] \n"))}};function Ye(e){return o(this,void 0,void 0,function*(){if(e===Ge.AUDIO_CALL||e===Ge.VIDEO_CALL)return new Promise((t,n)=>o(this,void 0,void 0,function*(){const i={microphone:!0,camera:e===Ge.VIDEO_CALL},r=function(e){if(!e)return!1;const{microphone:t=!1,camera:n=!1}=e,i=wx.getAppAuthorizeSetting(),r=i[H]===W,o=i[G]===W;if(t&&n)return r&&o;if(t)return r;if(n)return o;return!1}(i);if(!r&&e===Ge.AUDIO_CALL){qe(x,$),n({callType:e,hasAppDevicePermission:r})}if(!r&&e===Ge.VIDEO_CALL){qe(F,j),n({callType:e,hasAppDevicePermission:r})}const a=yield function(e){return o(this,void 0,void 0,function*(){if(!e)return!1;const{microphone:t=!1,camera:n=!1}=e;try{const e=(yield getAuthSetting())||!1,i=e[B],r=e[K];return t&&n?i&&r:t?i:!!n&&r}catch(i){return!1}})}(i);if(!a&&e===Ge.AUDIO_CALL)try{yield Xe({scope:B})}catch(s){const t=L;ze(t,V),n({callType:e,text:t})}if(!a&&e===Ge.VIDEO_CALL)try{if((yield function(e){return o(this,void 0,void 0,function*(){return yield Promise.all(e.map(e=>o(this,void 0,void 0,function*(){try{return{status:"fulfilled",value:yield e}}catch(t){return{status:"rejected",reason:t}}})))})}([Xe({scope:B}),Xe({scope:K})])).find(e=>"rejected"===(null==e?void 0:e.status))){const t=U;ze(t,k),n({callType:e,text:t})}}catch(s){console.debug(s)}t()}))})}function ze(e,t){wx.showModal({title:e,content:t,confirmText:M,success:e=>{e.confirm&&wx.openSetting()}})}function qe(e,t){wx.showModal({title:e,content:t,confirmText:J,success:e=>{e.confirm&&wx.openAppAuthorizeSetting()}})}function Xe(e){return o(this,void 0,void 0,function*(){wx.$TUICallKitPlugin?yield wx.authorizeForMiniProgram(e):yield wx.authorize(e)})}!function(e){e[e.APNs=0]="APNs",e[e.VoIP=1]="VoIP"}(Ke||(Ke={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.AUDIO_CALL=1]="AUDIO_CALL",e[e.VIDEO_CALL=2]="VIDEO_CALL"}(Ge||(Ge={})),function(e){e[e.NORMAL=0]="NORMAL",e[e.RELEASE=1]="RELEASE",e[e.WARNING=2]="WARNING",e[e.ERROR=3]="ERROR",e[e.NONE=4]="NONE"}(He||(He={}));const Ze=function(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);if(null===t)return!0;let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return t===n},et=function(){},tt=function(){const e=new WeakSet;return function(t,n){if(n instanceof Error)return`Error.message: ${n.message} \n Error.stack: ${n.stack}`;if("object"==typeof n&&null!==n){if(e.has(n))return`[Circular ${t||"root"}]`;e.add(n)}return n}},nt=function(e){if("string"==typeof e)return e;try{return e instanceof Error?(JSON.stringify(e,tt())||"undefined").replace(/"/gim,""):JSON.stringify(e,tt())||"undefined"}catch(t){return`error happen when aegis stringify: \n ${t.message} \n ${t.stack}`}},it=[],rt=()=>{let e;const t=new Promise(t=>{e=t});return it.push({promise:t,resolve:e}),t};let ot=0;function at(e){return o(this,void 0,void 0,function*(){try{for(;ot>=2;)yield rt();return ot++,yield new Promise((t,n)=>{wx.request(Object.assign(Object.assign({},e),{success(e){t(e)},fail(e){n(e)}}))})}catch(t){return Promise.reject(t)}finally{ot--,it.length&&(it[0].resolve(),it.shift())}})}const st=e=>o(void 0,void 0,void 0,function*(){var{url:t,data:n,header:i={},method:r="GET",dataType:o,responseType:a}=e,s=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}(e,["url","data","header","method","dataType","responseType"]);return at(Object.assign({url:t,data:n,header:i,method:r,dataType:o,responseType:a},s))}),lt=({table:e})=>(t,n)=>{try{const i=null==t?void 0:t.map(e=>{let t={};return Object.keys(e).forEach(n=>{if(Ze(e[n]))try{t[n]=nt(e[n])}catch(i){console.debug(i)}else t[n]="level"===n?e[n]+"":"time"===n?new Date(e[n]).toISOString():e[n]}),t});n({table:e,report:i})}catch(i){console.debug(i)}},ut=(e,t)=>{let n,i=[];return(r,o)=>{if(Array.isArray(r)?i=i.concat(r):i.push(r),t&&i.length>=t||e.sendNow&&i.length>0)return o(i.splice(0,i.length)),void(n&&clearTimeout(n));n&&clearTimeout(n),n=setTimeout(()=>{n=null,i.length>0&&o(i.splice(0,i.length))},e.delay||1e3)}};var ct;!function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARING=2]="WARING",e[e.ERROR=3]="ERROR"}(ct||(ct={}));const dt={metric:!0,context:!0},ft=(e,t,n=0)=>Ze(e)?Ze(t)?(Object.keys(t).forEach(i=>{const r=e[i],o=t[i];e[i]=dt[i]&&0===n?ft(r,o,1):o}),e):e:Ze(t)?t:{};class vt{constructor(e){this.uploadChannel="",this.sendEsPipe=null,this._logLevel=ct.INFO,this._getReportDataList=[],this._blacklist=[],this.updateBlacklist()}updateEsConfig(e){try{if(e){this.esConfig=e;const{url:n,table:i}=e;n&&i&&(this.uploadChannel=n,this.sendEsPipe=(e=>{if(!e||!e.reduce||!e.length)throw new TypeError("createPipeline need at least one function param");return 1===e.length?(t,n)=>{e[0](t,n||et)}:e.reduce((e,t)=>(n,i=et)=>e(n,e=>null==t?void 0:t(e,i)))})([(t=this,(e,n)=>{try{const{sdkappid:i}=e,r=t.getBlackList();if(null==r?void 0:r.includes(String(i)))throw new Error("this sdkappid in blacklist");n(e)}catch(i){console.debug(i)}}),ut(this,5),lt({table:i}),(e,t)=>{try{e=e||{};let{logs:n=[]}=e;e.logs=null==n?void 0:n.map(e=>{const t=102400,n=e.contents;return Object.keys(n).forEach(e=>{const i=n[e];try{i&&i.length>t&&(n[e]=null==i?void 0:i.substring(0,t))}catch(r){console.debug("size of content > limitSize"),n[e]=nt(i).substring(0,t)}}),e}),t(e)}catch(n){console.debug(n)}},e=>o(this,void 0,void 0,function*(){let t=0;const i=()=>o(this,void 0,void 0,function*(){try{yield this.send({url:n,data:e})}catch(r){t<=2?(t++,setTimeout(()=>{i()},1e3)):console.debug(r)}});i()})]))}}catch(n){console.debug(n)}var t}updateGetReportData(e){"function"==typeof e&&this._getReportDataList.push(e)}updateBlacklist(){return o(this,void 0,void 0,function*(){try{const{data:e}=yield st({url:"https://jsonschema.qpic.cn/87084b1b6d263426b92926cfa5fa23af/18f29786d25587b5eb162d5e9f724b1e/blackList"}),t=null==e?void 0:e.blackList;"string"==typeof t&&(this._blacklist=t.split(","))}catch(e){console.debug("update blacklist fail",e)}})}getBlackList(){return this._blacklist}setLogLevel(e){"number"!=typeof e&&(e=ct.INFO),this._logLevel=e}createLogFunc(e){return(t,n)=>{this.log(t,n,{level:e})}}info(e,t){this.log(e,t,{level:ct.INFO})}debug(e,t){this.log(e,t,{level:ct.DEBUG})}warn(e,t){this.log(e,t,{level:ct.WARING})}error(e,t){this.log(e,t,{level:ct.ERROR})}log(e,t,n){try{const{level:i}=n||{};if(this._logLevel<=i){const n=this.getCommonReportData(),r=ft(n,Object.assign({level:i,method:e},t));"function"==typeof this.sendEsPipe&&this.sendEsPipe(r)}}catch(i){console.debug(i)}}getCommonReportData(){let e={};for(let t=0;t<this._getReportDataList.length;t++)e=ft(e,this._getReportDataList[t]());return e}send(e){return o(this,void 0,void 0,function*(){const{url:t,data:n}=e||{};try{t&&(yield st({url:t,data:n,method:"post"}))}catch(i){throw console.debug(i),new Error(i)}})}}let ht=null;var pt,mt=(pt="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e){e=void 0!==(e=e||{})?e:{};var t,n,i=WXWebAssembly;e.ready=new Promise(function(e,i){t=e,n=i});var r=Object.assign({},e),o="./this.program",a="object"==("undefined"==typeof window?"undefined":se(window)),s="function"==typeof importScripts;"object"==("undefined"==typeof process?"undefined":se(process))&&"object"==se(process.versions)&&process.versions.node;var l="";(a||s)&&(s?l=self.location.href:"undefined"!=typeof document&&document.currentScript&&(l=document.currentScript.src),pt&&(l=pt),l=0!==l.indexOf("blob:")?l.substr(0,l.replace(/[?#].*/,"").lastIndexOf("/")+1):"");var u,c=e.print||console.log.bind(console),d=e.printErr||console.warn.bind(console);Object.assign(e,r),r=null,e.arguments&&e.arguments,e.thisProgram&&(o=e.thisProgram),e.quit&&e.quit,e.wasmBinary&&e.wasmBinary,e.noExitRuntime,"object"!=se(i)&&M("no native wasm support detected");var f,v,h,p,m,g,y,_,T,C,E=!1,R="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function b(e,t,n){for(var i=t+n,r=t;e[r]&&!(r>=i);)++r;if(r-t>16&&e.buffer&&R)return R.decode(e.subarray(t,r));for(var o="";t<r;){var a=e[t++];if(128&a){var s=63&e[t++];if(192!=(224&a)){var l=63&e[t++];if((a=224==(240&a)?(15&a)<<12|s<<6|l:(7&a)<<18|s<<12|l<<6|63&e[t++])<65536)o+=String.fromCharCode(a);else{var u=a-65536;o+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else o+=String.fromCharCode((31&a)<<6|s)}else o+=String.fromCharCode(a)}return o}function I(e,t){return e?b(h,e,t):""}function S(e,t,n,i){if(!(i>0))return 0;for(var r=n,o=n+i-1,a=0;a<e.length;++a){var s=e.charCodeAt(a);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++a)),s<=127){if(n>=o)break;t[n++]=s}else if(s<=2047){if(n+1>=o)break;t[n++]=192|s>>6,t[n++]=128|63&s}else if(s<=65535){if(n+2>=o)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|63&s}else{if(n+3>=o)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|63&s}}return t[n]=0,n-r}function w(e){for(var t=0,n=0;n<e.length;++n){var i=e.charCodeAt(n);i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++n)),i<=127?++t:t+=i<=2047?2:i<=65535?3:4}return t}e.INITIAL_MEMORY;var A=[],O=[],D=[];function P(e){A.unshift(e)}function N(e){D.unshift(e)}var L,V,U=0,k=null;function M(t){e.onAbort&&e.onAbort(t),d(t="Aborted("+t+")"),E=!0,t+=". Build with -sASSERTIONS for more info.";var i=new Error(t);throw n(i),i}function x(t){for(;t.length>0;)t.shift()(e)}function $(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}(L="RTCCallEngine.wasm").startsWith("data:application/octet-stream;base64,")||(V=L,L=e.locateFile?e.locateFile(V,l):l+V);var F=void 0;function j(e){for(var t="",n=e;h[n];)t+=F[h[n++]];return t}var J={},W={},B={};function K(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?"_"+e:e}function G(e,t){return e=K(e),function(){return t.apply(this,arguments)}}function H(e,t){var n=G(t,function(e){this.name=t,this.message=e;var n=new Error(e).stack;void 0!==n&&(this.stack=this.toString()+"\n"+n.replace(/^Error(:[^\n]*)?\n/,""))});return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},n}var Q=void 0;function Y(e){throw new Q(e)}var z=void 0;function q(e){throw new z(e)}function X(e,t,n){function i(t){var i=n(t);i.length!==e.length&&q("Mismatched type converter count");for(var r=0;r<e.length;++r)ee(e[r],i[r])}e.forEach(function(e){B[e]=t});var r=new Array(t.length),o=[],a=0;t.forEach(function(e,t){W.hasOwnProperty(e)?r[t]=W[e]:(o.push(e),J.hasOwnProperty(e)||(J[e]=[]),J[e].push(function(){r[t]=W[e],++a===o.length&&i(r)}))}),0===o.length&&i(r)}function ee(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var i=t.name;if(e||Y('type "'+i+'" must have a positive integer typeid pointer'),W.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;Y("Cannot register type '"+i+"' twice")}if(W[e]=t,delete B[e],J.hasOwnProperty(e)){var r=J[e];delete J[e],r.forEach(function(e){return e()})}}function ie(e){if(!(this instanceof Ae))return!1;if(!(e instanceof Ae))return!1;for(var t=this.$$.ptrType.registeredClass,n=this.$$.ptr,i=e.$$.ptrType.registeredClass,r=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;i.baseClass;)r=i.upcast(r),i=i.baseClass;return t===i&&n===r}function ae(e){Y(e.$$.ptrType.registeredClass.name+" instance already deleted")}var le=!1;function ue(e){}function ce(e){e.count.value-=1,0===e.count.value&&function(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}(e)}function de(e,t,n){if(t===n)return e;if(void 0===n.baseClass)return null;var i=de(e,t,n.baseClass);return null===i?null:n.downcast(i)}var fe={};function ve(){return Object.keys(_e).length}function he(){var e=[];for(var t in _e)_e.hasOwnProperty(t)&&e.push(_e[t]);return e}var pe=[];function me(){for(;pe.length;){var e=pe.pop();e.$$.deleteScheduled=!1,e.delete()}}var ge=void 0;function ye(e){ge=e,pe.length&&ge&&ge(me)}var _e={};function Te(e,t){return t=function(e,t){for(void 0===t&&Y("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}(e,t),_e[t]}function Ce(e,t){return t.ptrType&&t.ptr||q("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&q("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Re(Object.create(e,{$$:{value:t}}))}function Ee(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=Te(this.registeredClass,t);if(void 0!==n){if(0===n.$$.count.value)return n.$$.ptr=t,n.$$.smartPtr=e,n.clone();var i=n.clone();return this.destructor(e),i}function r(){return this.isSmartPointer?Ce(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Ce(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var o,a=this.registeredClass.getActualType(t),s=fe[a];if(!s)return r.call(this);o=this.isConst?s.constPointerType:s.pointerType;var l=de(t,this.registeredClass,o.registeredClass);return null===l?r.call(this):this.isSmartPointer?Ce(o.registeredClass.instancePrototype,{ptrType:o,ptr:l,smartPtrType:this,smartPtr:e}):Ce(o.registeredClass.instancePrototype,{ptrType:o,ptr:l})}function Re(e){return"undefined"==typeof FinalizationRegistry?(Re=function(e){return e},e):(le=new FinalizationRegistry(function(e){ce(e.$$)}),Re=function(e){var t=e.$$;if(t.smartPtr){var n={$$:t};le.register(e,n,e)}return e},ue=function(e){return le.unregister(e)},Re(e))}function be(){if(this.$$.ptr||ae(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=Re(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}function Ie(){this.$$.ptr||ae(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Y("Object already scheduled for deletion"),ue(this),ce(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Se(){return!this.$$.ptr}function we(){return this.$$.ptr||ae(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Y("Object already scheduled for deletion"),pe.push(this),1===pe.length&&ge&&ge(me),this.$$.deleteScheduled=!0,this}function Ae(){}function Oe(e,t,n){if(void 0===e[t].overloadTable){var i=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||Y("Function '"+n+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[i.argCount]=i}}function De(e,t,n,i,r,o,a,s){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=i,this.baseClass=r,this.getActualType=o,this.upcast=a,this.downcast=s,this.pureVirtualFunctions=[]}function Pe(e,t,n){for(;t!==n;)t.upcast||Y("Expected null or instance of "+n.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function Ne(e,t){if(null===t)return this.isReference&&Y("null is not a valid "+this.name),0;t.$$||Y('Cannot pass "'+nt(t)+'" as a '+this.name),t.$$.ptr||Y("Cannot pass deleted object as a pointer of type "+this.name);var n=t.$$.ptrType.registeredClass;return Pe(t.$$.ptr,n,this.registeredClass)}function Le(e,t){var n;if(null===t)return this.isReference&&Y("null is not a valid "+this.name),this.isSmartPointer?(n=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,n),n):0;t.$$||Y('Cannot pass "'+nt(t)+'" as a '+this.name),t.$$.ptr||Y("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&Y("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var i=t.$$.ptrType.registeredClass;if(n=Pe(t.$$.ptr,i,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&Y("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?n=t.$$.smartPtr:Y("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:n=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)n=t.$$.smartPtr;else{var r=t.clone();n=this.rawShare(n,tt.toHandle(function(){r.delete()})),null!==e&&e.push(this.rawDestructor,n)}break;default:Y("Unsupporting sharing policy")}return n}function Ve(e,t){if(null===t)return this.isReference&&Y("null is not a valid "+this.name),0;t.$$||Y('Cannot pass "'+nt(t)+'" as a '+this.name),t.$$.ptr||Y("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&Y("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var n=t.$$.ptrType.registeredClass;return Pe(t.$$.ptr,n,this.registeredClass)}function Ue(e){return this.fromWireType(g[e>>2])}function ke(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function Me(e){this.rawDestructor&&this.rawDestructor(e)}function xe(e){null!==e&&e.delete()}function $e(e,t,n,i,r,o,a,s,l,u,c){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=i,this.isSmartPointer=r,this.pointeeType=o,this.sharingPolicy=a,this.rawGetPointee=s,this.rawConstructor=l,this.rawShare=u,this.rawDestructor=c,r||void 0!==t.baseClass?this.toWireType=Le:i?(this.toWireType=Ne,this.destructorFunction=null):(this.toWireType=Ve,this.destructorFunction=null)}var Fe=[];function je(e){var t=Fe[e];return t||(e>=Fe.length&&(Fe.length=e+1),Fe[e]=t=C.get(e)),t}function Je(t,n,i){return t.includes("j")?function(t,n,i){var r=e["dynCall_"+t];return i&&i.length?r.apply(null,[n].concat(i)):r.call(null,n)}(t,n,i):je(n).apply(null,i)}function We(e,t){var n,i,r,o=(e=j(e)).includes("j")?(n=e,i=t,r=[],function(){return r.length=0,Object.assign(r,arguments),Je(n,i,r)}):je(t);return"function"!=typeof o&&Y("unknown function pointer with signature "+e+": "+t),o}var Be=void 0;function Ke(e){var t=Vt(e),n=j(t);return Nt(t),n}function Ge(e,t){var n=[],i={};throw t.forEach(function e(t){i[t]||W[t]||(B[t]?B[t].forEach(e):(n.push(t),i[t]=!0))}),new Be(e+": "+n.map(Ke).join([", "]))}function He(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function Qe(e,t,n,i,r){var o=t.length;o<2&&Y("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==n,s=!1,l=1;l<t.length;++l)if(null!==t[l]&&void 0===t[l].destructorFunction){s=!0;break}var u="void"!==t[0].name,c=o-2,d=new Array(c),f=[],v=[];return function(){var n;arguments.length!==c&&Y("function "+e+" called with "+arguments.length+" arguments, expected "+c+" args!"),v.length=0,f.length=a?2:1,f[0]=r,a&&(n=t[1].toWireType(v,this),f[1]=n);for(var o=0;o<c;++o)d[o]=t[o+2].toWireType(v,arguments[o]),f.push(d[o]);return function(e){if(s)He(v);else for(var i=a?1:2;i<t.length;i++){var r=1===i?n:d[i-2];null!==t[i].destructorFunction&&t[i].destructorFunction(r)}if(u)return t[0].fromWireType(e)}(i.apply(null,f))}}function Ye(e,t){for(var n=[],i=0;i<e;i++)n.push(y[t+4*i>>2]);return n}var ze=[],qe=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function Xe(e){e>4&&0===--qe[e].refcount&&(qe[e]=void 0,ze.push(e))}function Ze(){for(var e=0,t=5;t<qe.length;++t)void 0!==qe[t]&&++e;return e}function et(){for(var e=5;e<qe.length;++e)if(void 0!==qe[e])return qe[e];return null}var tt={toValue:function(e){return e||Y("Cannot use deleted val. handle = "+e),qe[e].value},toHandle:function(e){switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var t=ze.length?ze.pop():qe.length;return qe[t]={refcount:1,value:e},t}}};function nt(e){if(null===e)return"null";var t=se(e);return"object"===t||"array"===t||"function"===t?e.toString():""+e}function it(e,t){switch(t){case 2:return function(e){return this.fromWireType(_[e>>2])};case 3:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function rt(e,t,n){switch(t){case 0:return n?function(e){return v[e]}:function(e){return h[e]};case 1:return n?function(e){return p[e>>1]}:function(e){return m[e>>1]};case 2:return n?function(e){return g[e>>2]}:function(e){return y[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}var ot="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function at(e,t){for(var n=e,i=n>>1,r=i+t/2;!(i>=r)&&m[i];)++i;if((n=i<<1)-e>32&&ot)return ot.decode(h.subarray(e,n));for(var o="",a=0;!(a>=t/2);++a){var s=p[e+2*a>>1];if(0==s)break;o+=String.fromCharCode(s)}return o}function st(e,t,n){if(void 0===n&&(n=2147483647),n<2)return 0;for(var i=t,r=(n-=2)<2*e.length?n/2:e.length,o=0;o<r;++o){var a=e.charCodeAt(o);p[t>>1]=a,t+=2}return p[t>>1]=0,t-i}function lt(e){return 2*e.length}function ut(e,t){for(var n=0,i="";!(n>=t/4);){var r=g[e+4*n>>2];if(0==r)break;if(++n,r>=65536){var o=r-65536;i+=String.fromCharCode(55296|o>>10,56320|1023&o)}else i+=String.fromCharCode(r)}return i}function ct(e,t,n){if(void 0===n&&(n=2147483647),n<4)return 0;for(var i=t,r=i+n-4,o=0;o<e.length;++o){var a=e.charCodeAt(o);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++o)),g[t>>2]=a,(t+=4)+4>r)break}return g[t>>2]=0,t-i}function dt(e){for(var t=0,n=0;n<e.length;++n){var i=e.charCodeAt(n);i>=55296&&i<=57343&&++n,t+=4}return t}function ft(e,t){var n=W[e];return void 0===n&&Y(t+" has unknown type "+Ke(e)),n}function vt(e,t){for(var n=new Array(e),i=0;i<e;++i)n[i]=ft(y[t+4*i>>2],"parameter "+i);return n}var ht={};function mt(e){var t=ht[e];return void 0===t?j(e):t}var gt=[];function yt(){if("object"==("undefined"==typeof globalThis?"undefined":se(globalThis)))return globalThis;function e(e){e.$$$embind_global$$$=e;var t="object"==("undefined"==typeof $$$embind_global$$$?"undefined":se($$$embind_global$$$))&&e.$$$embind_global$$$==e;return t||delete e.$$$embind_global$$$,t}if("object"==("undefined"==typeof $$$embind_global$$$?"undefined":se($$$embind_global$$$)))return $$$embind_global$$$;if("object"==("undefined"==typeof global?"undefined":se(global))&&e(global)?$$$embind_global$$$=global:"object"==("undefined"==typeof self?"undefined":se(self))&&e(self)&&($$$embind_global$$$=self),"object"==("undefined"==typeof $$$embind_global$$$?"undefined":se($$$embind_global$$$)))return $$$embind_global$$$;throw Error("unable to get global object.")}var _t,Tt=[],Ct={};_t=function(){return performance.now()};var Et={};function Rt(){if(!Rt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==("undefined"==typeof navigator?"undefined":se(navigator))&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:o||"./this.program"};for(var t in Et)void 0===Et[t]?delete e[t]:e[t]=Et[t];var n=[];for(var t in e)n.push(t+"="+e[t]);Rt.strings=n}return Rt.strings}var bt=[null,[],[]];function It(e,t){var n=bt[e];0===t||10===t?((1===e?c:d)(b(n,0)),n.length=0):n.push(t)}function St(e){return e%4==0&&(e%100!=0||e%400==0)}var wt=[31,29,31,30,31,30,31,31,30,31,30,31],At=[31,28,31,30,31,30,31,31,30,31,30,31];function Ot(e,t,n,i){var r=g[i+40>>2],o={tm_sec:g[i>>2],tm_min:g[i+4>>2],tm_hour:g[i+8>>2],tm_mday:g[i+12>>2],tm_mon:g[i+16>>2],tm_year:g[i+20>>2],tm_wday:g[i+24>>2],tm_yday:g[i+28>>2],tm_isdst:g[i+32>>2],tm_gmtoff:g[i+36>>2],tm_zone:r?I(r):""},a=I(n),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var l in s)a=a.replace(new RegExp(l,"g"),s[l]);var u=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],c=["January","February","March","April","May","June","July","August","September","October","November","December"];function d(e,t,n){for(var i="number"==typeof e?e.toString():e||"";i.length<t;)i=n[0]+i;return i}function f(e,t){return d(e,t,"0")}function h(e,t){function n(e){return e<0?-1:e>0?1:0}var i;return 0===(i=n(e.getFullYear()-t.getFullYear()))&&0===(i=n(e.getMonth()-t.getMonth()))&&(i=n(e.getDate()-t.getDate())),i}function p(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function m(e){var t=function(e,t){for(var n=new Date(e.getTime());t>0;){var i=St(n.getFullYear()),r=n.getMonth(),o=(i?wt:At)[r];if(!(t>o-n.getDate()))return n.setDate(n.getDate()+t),n;t-=o-n.getDate()+1,n.setDate(1),r<11?n.setMonth(r+1):(n.setMonth(0),n.setFullYear(n.getFullYear()+1))}return n}(new Date(e.tm_year+1900,0,1),e.tm_yday),n=new Date(t.getFullYear(),0,4),i=new Date(t.getFullYear()+1,0,4),r=p(n),o=p(i);return h(r,t)<=0?h(o,t)<=0?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var y={"%a":function(e){return u[e.tm_wday].substring(0,3)},"%A":function(e){return u[e.tm_wday]},"%b":function(e){return c[e.tm_mon].substring(0,3)},"%B":function(e){return c[e.tm_mon]},"%C":function(e){return f((e.tm_year+1900)/100|0,2)},"%d":function(e){return f(e.tm_mday,2)},"%e":function(e){return d(e.tm_mday,2," ")},"%g":function(e){return m(e).toString().substring(2)},"%G":function(e){return m(e)},"%H":function(e){return f(e.tm_hour,2)},"%I":function(e){var t=e.tm_hour;return 0==t?t=12:t>12&&(t-=12),f(t,2)},"%j":function(e){return f(e.tm_mday+function(e,t){for(var n=0,i=0;i<=t;n+=e[i++]);return n}(St(e.tm_year+1900)?wt:At,e.tm_mon-1),3)},"%m":function(e){return f(e.tm_mon+1,2)},"%M":function(e){return f(e.tm_min,2)},"%n":function(){return"\n"},"%p":function(e){return e.tm_hour>=0&&e.tm_hour<12?"AM":"PM"},"%S":function(e){return f(e.tm_sec,2)},"%t":function(){return"\t"},"%u":function(e){return e.tm_wday||7},"%U":function(e){var t=e.tm_yday+7-e.tm_wday;return f(Math.floor(t/7),2)},"%V":function(e){var t=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&t++,t){if(53==t){var n=(e.tm_wday+371-e.tm_yday)%7;4==n||3==n&&St(e.tm_year)||(t=1)}}else{t=52;var i=(e.tm_wday+7-e.tm_yday-1)%7;(4==i||5==i&&St(e.tm_year%400-1))&&t++}return f(t,2)},"%w":function(e){return e.tm_wday},"%W":function(e){var t=e.tm_yday+7-(e.tm_wday+6)%7;return f(Math.floor(t/7),2)},"%y":function(e){return(e.tm_year+1900).toString().substring(2)},"%Y":function(e){return e.tm_year+1900},"%z":function(e){var t=e.tm_gmtoff,n=t>=0;return t=(t=Math.abs(t)/60)/60*100+t%60,(n?"+":"-")+String("0000"+t).slice(-4)},"%Z":function(e){return e.tm_zone},"%%":function(){return"%"}};for(var l in a=a.replace(/%%/g,"\0\0"),y)a.includes(l)&&(a=a.replace(new RegExp(l,"g"),y[l](o)));var _=function(e,t,n){var i=n>0?n:w(e)+1,r=new Array(i),o=S(e,r,0,r.length);return t&&(r.length=o),r}(a=a.replace(/\0\0/g,"%"),!1);return _.length>t?0:(function(e,t){v.set(e,t)}(_,e),_.length-1)}!function(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);F=e}(),Q=e.BindingError=H(Error,"BindingError"),z=e.InternalError=H(Error,"InternalError"),Ae.prototype.isAliasOf=ie,Ae.prototype.clone=be,Ae.prototype.delete=Ie,Ae.prototype.isDeleted=Se,Ae.prototype.deleteLater=we,e.getInheritedInstanceCount=ve,e.getLiveInheritedInstances=he,e.flushPendingDeletes=me,e.setDelayFunction=ye,$e.prototype.getPointee=ke,$e.prototype.destructor=Me,$e.prototype.argPackAdvance=8,$e.prototype.readValueFromPointer=Ue,$e.prototype.deleteObject=xe,$e.prototype.fromWireType=Ee,Be=e.UnboundTypeError=H(Error,"UnboundTypeError"),e.count_emval_handles=Ze,e.get_first_emval=et;var Dt={__assert_fail:function(e,t,n,i){M