@bdky/aaas-pilot-kit 1.0.4 → 1.0.5
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/http.cjs.js +1 -1
- package/dist/http.esm.js +1 -1
- package/dist/http.umd.js +1 -1
- package/dist/index.cjs.js +30 -21
- package/dist/index.esm.js +29 -20
- package/dist/index.umd.js +30 -21
- package/dist/ky-aaas-pilot-kit.umd.js +30 -21
- package/dist/libs/aaas-pilot-kit/src/index.d.ts +2 -0
- package/dist/libs/aaas-pilot-kit/src/lib/controller.d.ts +40 -2
- package/dist/libs/aaas-pilot-kit/src/lib/error/codes.d.ts +6 -0
- package/dist/libs/aaas-pilot-kit/src/lib/error/services/AsrError.d.ts +18 -0
- package/dist/libs/aaas-pilot-kit/src/lib/service/agent/agentResponse.d.ts +174 -0
- package/dist/libs/aaas-pilot-kit/src/lib/service/agent/aiobAgentService.d.ts +1 -1
- package/dist/libs/aaas-pilot-kit/src/lib/service/agent/baseAgentService.d.ts +20 -2
- package/dist/libs/aaas-pilot-kit/src/lib/service/agent/cspAgentService.d.ts +1 -1
- package/dist/libs/aaas-pilot-kit/src/lib/service/digital-human/BaseDigitalHumanService.d.ts +16 -0
- package/dist/libs/aaas-pilot-kit/src/lib/service/digital-human/CloudDigitalHumanService.d.ts +12 -0
- package/dist/libs/aaas-pilot-kit/src/lib/service/digital-human/CloudNativeDigitalHumanService.d.ts +134 -0
- package/dist/libs/aaas-pilot-kit/src/lib/service/digital-human/PictureClientDigitalHumanService.d.ts +18 -0
- package/dist/libs/aaas-pilot-kit/src/lib/service/rtc-asr/asr/baseAsrService.d.ts +38 -3
- package/dist/libs/aaas-pilot-kit/src/lib/service/rtc-asr/asr/brtcAsrService.d.ts +2 -2
- package/dist/libs/aaas-pilot-kit/src/lib/utils/AudioDeviceDetector.d.ts +138 -0
- package/dist/libs/aaas-pilot-kit/src/lib/utils/agentResponseHelper.d.ts +42 -0
- package/dist/libs/aaas-pilot-kit/src/lib/utils/language-mapper.d.ts +70 -0
- package/dist/libs/aaas-pilot-kit/src/types/config.d.ts +175 -21
- package/package.json +7 -4
package/dist/index.umd.js
CHANGED
|
@@ -1,44 +1,53 @@
|
|
|
1
1
|
/*! For license information please see index.umd.js.LICENSE.txt */
|
|
2
|
-
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.KyDigitalHuman=n():e.KyDigitalHuman=n()}(globalThis,()=>(()=>{var e={"../../node_modules/@baidu/weirwood-error/esm/plugins/Plugin.js":function(){},"../../node_modules/@baidu/weirwood-perf/esm/index.js":function(e,n){var r=new Date().getTime();function i(e){var n=window.BOOMR;if(window){if(!e){if(window.parent===window||!document.getElementById("boomr-if-as"))return;if(window.BOOMR&&n.boomerang_frame&&n.window)try{n.boomerang_frame.document.domain!==n.window.document.domain&&(n.boomerang_frame.document.domain=n.window.document.domain)}catch(e){n.isCrossOriginError(e)||n.addError(e,"BOOMR_check_doc_domain.domainFix")}e=document.domain}if(e&&-1!==e.indexOf(".")&&window.parent){try{window.parent.document;return}catch(n){try{document.domain=e}catch(e){return}}try{window.parent.document;return}catch(n){e=e.replace(/^[\w\-]+\./,"")}i(e)}}}function o(e){return"[object String]"===Object.prototype.toString.call(e)}function s(e){return"object"==typeof e&&null!==e}function a(e,n){return!!o(n)&&e.some(function(e){if(!e)return!1;if(o(e))return -1!==n.indexOf(e);if("[object RegExp]"===Object.prototype.toString.call(e))try{return e.test(n)}catch(n){return console.error(e+"正则书写有误"),!1}return console.error(e+"忽略匹配项类型应该是String、RegExp"),!1})}function c(e,n){var r=e.lastClick,i=void 0===r?0:r,o=n.timing.requestStart;return!!i&&!!(o-i<50)}i(),n.PerfClient=function(){function e(e){!(e&&e.ignoreUrls&&e.ignoreUrls.length&&this.shouldIgnoreUrls(e.ignoreUrls))&&(this.BOOMR=function(e){var n,o,s,a,c,l,u,d,p,h=e;e.parent!==e&&document.getElementById("boomr-if-as")&&"script"===document.getElementById("boomr-if-as").nodeName.toLowerCase()&&(e=e.parent),c=e.document,e.BOOMR||(e.BOOMR={});var f=e.BOOMR;if(f.version)return f;f.version="1.3.15",f.window=e,f.boomerang_frame=h,f.plugins||(f.plugins={});try{new e.CustomEvent("CustomEvent"),l=function(n,r){return new e.CustomEvent(n,r)}}catch(e){}try{!l&&c.createEvent&&c.createEvent("CustomEvent")&&(l=function(e,n){var r=c.createEvent("CustomEvent");return n=n||{cancelable:!1,bubbles:!1},r.initCustomEvent(e,n.bubbles,n.cancelable,n.detail),r})}catch(e){}if(!l&&c.createEventObject&&(l=function(e,n){var r=c.createEventObject();return r.type=r.propertyName=e,r.detail=n.detail,r}),l||(l=function(){}),u=function(e,n,r){var i=l(e,{detail:n});function o(){try{c.dispatchEvent?c.dispatchEvent(i):c.fireEvent&&c.fireEvent("onpropertychange",i)}catch(e){}}i&&(r?f.setImmediate(o):o())},void 0!==c.hidden?(d="visibilityState",p="visibilitychange"):void 0!==c.mozHidden?(d="mozVisibilityState",p="mozvisibilitychange"):void 0!==c.msHidden?(d="msVisibilityState",p="msvisibilitychange"):void 0!==c.webkitHidden&&(d="webkitVisibilityState",p="webkitvisibilitychange"),a={t_start:r,t_end:void 0,url:"",config_url:null,loadedLate:!1,beaconsSent:0,isUnloaded:!1,beaconInQueue:!1,cookies:{},testedCookies:!1,constants:{BEACON_TYPE_SPAS:["spa","spa_hard"],MAX_GET_LENGTH:2e3},session:{domain:(s={beacon_url:"",beacon_url_force_https:!0,beacon_urls_allowed:[],beacon_type:"AUTO",beacon_auth_key:"Authorization",beacon_auth_token:void 0,beacon_with_credentials:!1,beacon_disable_sendbeacon:!1,site_domain:e.location.hostname.replace(/.*?([^.]+\.[^.]+)\.?$/,"$1").toLowerCase(),user_ip:"",autorun:!0,hasSentPageLoadBeacon:!1,r:void 0,same_site_cookie:"Lax",secure_cookie:!1,forced_same_site_cookie_none:!1,events:{page_ready:[],page_unload:[],before_unload:[],dom_loaded:[],visibility_changed:[],prerender_to_visible:[],before_beacon:[],beacon:[],page_load_beacon:[],xhr_load:[],click:[],form_submit:[],config:[],xhr_init:[],spa_init:[],spa_navigation:[],spa_cancel:[],xhr_send:[],xhr_error:[],error:[],netinfo:[],rage_click:[],before_early_beacon:[]},public_events:{before_beacon:"onBeforeBoomerangBeacon",beacon:"onBoomerangBeacon",onboomerangloaded:"onBoomerangLoaded"},translate_events:{onbeacon:"beacon",onconfig:"config",onerror:"error",onxhrerror:"xhr_error"},unloadEventsCount:0,unloadEventCalled:0,listenerCallbacks:{},vars:{},singleBeaconVars:{},varPriority:{"-1":{},1:{}},errors:{},disabled_plugins:{},localStorageSupported:!1,LOCAL_STORAGE_PREFIX:"_boomr_",nativeOverwrites:[],xb_handler:function(n){return function(r){var i;r||(r=e.event),r.target?i=r.target:r.srcElement&&(i=r.srcElement),3===i.nodeType&&(i=i.parentNode),i&&i.nodeName&&"OBJECT"===i.nodeName.toUpperCase()&&"application/x-shockwave-flash"===i.type||s.fireEvent(n,i)}},clearEvents:function(){var e;for(e in this.events)this.events.hasOwnProperty(e)&&(this.events[e]=[])},clearListeners:function(){var e;for(e in s.listenerCallbacks)if(s.listenerCallbacks.hasOwnProperty(e))for(;s.listenerCallbacks[e].length;)f.utils.removeListener(s.listenerCallbacks[e][0].el,e,s.listenerCallbacks[e][0].fn);s.listenerCallbacks={}},fireEvent:function(e,n){var r,i,o,s;if(e=e.toLowerCase(),this.translate_events[e]&&(e=this.translate_events[e]),this.events.hasOwnProperty(e)){for(this.public_events.hasOwnProperty(e)&&u(this.public_events[e],n),o=this.events[e],"before_beacon"!==e&&"beacon"!==e&&f.real_sendBeacon(),s=o.length,r=0;r<s;r++)try{(i=o[r]).fn.call(i.scope,n,i.cb_data)}catch(n){f.addError(n,"fireEvent."+e+"<"+r+">")}for(r=0;r<s;r++)try{o[r].once&&(o.splice(r,1),s--,r--)}catch(n){f.addError(n,"fireEvent."+e+"<"+r+">")}}},spaNavigation:function(){s.onloadfired=!0},beaconUrlAllowed:function(e){if(!s.beacon_urls_allowed||0===s.beacon_urls_allowed.length)return!0;for(var n=0;n<s.beacon_urls_allowed.length;n++)if(new RegExp(s.beacon_urls_allowed[n]).exec(e))return!0;return!1},checkLocalStorageSupport:function(){var n=s.LOCAL_STORAGE_PREFIX+"clss";s.localStorageSupported=!1;try{if(!e.JSON||!e.localStorage)return;e.localStorage.setItem(n,n),s.localStorageSupported=e.localStorage.getItem(n)===n,e.localStorage.removeItem(n)}catch(e){s.localStorageSupported=!1}},onFrameUnloaded:function(){var e,n;for(e=0,f.isUnloaded=!0;e<s.nativeOverwrites.length;e++)(n=s.nativeOverwrites[e]).obj[n.functionName]=n.origFn;s.nativeOverwrites=[]}}).site_domain,ID:void 0,start:void 0,length:0,enabled:!0},utils:{hasPostMessageSupport:function(){return!!e.postMessage&&("function"==typeof e.postMessage||"object"==typeof e.postMessage)},objectToString:function(e,n,r){var i,o=[];if(!e||"object"!=typeof e)return e;if(void 0===n&&(n="\n "),r||(r=0),f.utils.isArray(e)){for(i=0;i<e.length;i++)r>0&&null!==e[i]&&"object"==typeof e[i]?o.push(this.objectToString(e[i],n+("\n "===n?" ":""),r-1)):"&"===n?o.push(encodeURIComponent(e[i])):o.push(e[i]);n=","}else for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r>0&&null!==e[i]&&"object"==typeof e[i]?o.push(encodeURIComponent(i)+"="+this.objectToString(e[i],n+("\n "===n?" ":""),r-1)):"&"===n?o.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i])):o.push(i+"="+e[i]));return o.join(n)},getCookie:function(e){var n;if(!e)return null;if(f.utils.mark("get_cookie"),void 0!==f.cookies[e])return!1===f.cookies[e]?void 0:f.cookies[e];if(void 0===(n=this.getRawCookie(e))){f.cookies[e]=!1;return}return f.cookies[e]=n,f.cookies[e]},getRawCookie:function(e){var n,r;return e?(e=" "+e+"=",(n=(r=" "+c.cookie+";").indexOf(e))>=0)?(n+=e.length,r.substring(n,r.indexOf(";",n)).replace(/^"/,"").replace(/"$/,"")):void 0:null},setCookie:function(e,n,r){var i,o,a,l,u;if(!e||!f.session.domain||void 0===n)return f.addVar("nocookie",1),!1;if((i=this.objectToString(n,"&"))===f.cookies[e])return!0;if((o=e+'="'+i+'"').length<500){l=[o,"path=/","domain="+f.session.domain],"number"==typeof r&&((u=new Date).setTime(u.getTime()+1e3*r),u=u.toGMTString(),l.push("expires="+u));var d=this.getSameSiteAttributeParts();if("https:"===location.protocol&&!0===s.secure_cookie&&-1===d.indexOf("Secure")&&d.push("Secure"),l=l.concat(d),f.utils.mark("set_cookie_real"),c.cookie=l.join("; "),f.testedCookies)return"number"!=typeof r||r>0?f.cookies[e]=i:f.cookies[e]=void 0,!0;if(f.cookies[e]=void 0,i===(a=this.getCookie(e))||void 0===a&&"number"==typeof r&&r<=0)return f.cookies[e]=i,f.testedCookies=!0,f.removeVar("nocookie"),!0}return f.addVar("nocookie",1),!1},getSubCookies:function(e){var n,r,i,o,s=!1,a={};if(!e||"string"!=typeof e)return null;for(r=0,i=(n=e.split("&")).length;r<i;r++)(o=n[r].split("="))[0]&&(o.push(""),a[decodeURIComponent(o[0])]=decodeURIComponent(o[1]),s=!0);return s?a:null},removeCookie:function(e){return this.setCookie(e,{},-86400)},getSameSiteAttributeParts:function(){var e=s.same_site_cookie.toUpperCase();return(s.forced_same_site_cookie_none&&(e="NONE"),"LAX"===e)?["SameSite=Lax"]:"NONE"===e?"https:"===location.protocol&&this.isCurrentUASameSiteNoneCompatible()?["SameSite=None","Secure"]:[]:"STRICT"===e?["SameSite=Strict"]:["SameSite=Lax"]},getLocalStorage:function(n){var r,i;if(!n||!s.localStorageSupported)return null;try{if(r=e.localStorage.getItem(s.LOCAL_STORAGE_PREFIX+n),null===r)return;i=e.JSON.parse(r)}catch(e){return null}return i&&"object"==typeof i.items?"number"==typeof i.expires&&f.now()>=i.expires?void this.removeLocalStorage(n):i.items:(this.removeLocalStorage(n),null)},setLocalStorage:function(n,r,i){var o,a,c;if(!n||!s.localStorageSupported||"object"!=typeof r)return!1;if(o={items:r},"number"==typeof i&&(o.expires=f.now()+1e3*i),(a=e.JSON.stringify(o)).length<5e4)try{if(e.localStorage.setItem(s.LOCAL_STORAGE_PREFIX+n,a),c=e.localStorage.getItem(s.LOCAL_STORAGE_PREFIX+n),a===c)return!0}catch(e){}return!1},removeLocalStorage:function(n){if(!n||!s.localStorageSupported)return!1;try{return e.localStorage.removeItem(s.LOCAL_STORAGE_PREFIX+n),!0}catch(e){}return!1},cleanupURL:function(e,n){if(!e||f.utils.isArray(e))return"";if(s.strip_query_string&&(e=e.replace(/\?.*/,"?qs-redacted")),void 0!==n&&e&&e.length>n){var r=e.indexOf("?");e=-1!==r&&r<n?e.substr(0,r)+"?...":e.substr(0,n-3)+"..."}return e},hashQueryString:function(e,n){return e?e.match?(e.match(/^\/\//)&&(e=location.protocol+e),e.match(/^(https?|file):/))?(n&&(e=e.replace(/#.*/,"")),e.replace(/\?([^#]*)/,function(e,n){return"?"+(n.length>10?f.utils.hashString(n):n)})):(f.error("Passed in URL is invalid: "+e),""):(f.addError("TypeError: Not a string","hashQueryString",typeof e),""):e},pluginConfig:function(e,n,r,i){var o,s=0;if(!n||!n[r])return!1;for(o=0;o<i.length;o++)void 0!==n[r][i[o]]&&(e[i[o]]=n[r][i[o]],s++);return s>0},arrayFilter:function(e,n){var r=[];if(!(this.isArray(e)||e&&"number"==typeof e.length)||"function"!=typeof n)return r;if("function"==typeof e.filter)r=e.filter(n);else for(var i,o=-1,s=e.length;++o<s;)n(i=e[o],o,e)&&(r[r.length]=i);return r},arrayFind:function(e,n){if((this.isArray(e)||e&&"number"==typeof e.length)&&"function"==typeof n)if("function"==typeof e.find)return e.find(n);else{for(var r,i=-1,o=e.length;++i<o;)if(n(r=e[i],i,e))return r;return}},isMutationObserverSupported:function(){return!(e&&e.navigator&&e.navigator.userAgent&&e.navigator.userAgent.match(/Trident.*rv[ :]*11\./))&&e&&e.MutationObserver&&"function"==typeof e.MutationObserver},addObserver:function(n,r,i,o,s,a){var c,l,u={observer:null,timer:null};if(!this.isMutationObserverSupported()||!o||!n)return null;function d(e){var n=!1;u.timer&&(clearTimeout(u.timer),u.timer=null),o&&((n=o.call(a,e,s))||(o=null)),!n&&u.observer&&(u.observer.disconnect(),u.observer=null),"number"==typeof n&&n>0&&(u.timer=setTimeout(d,n))}return c=e.MutationObserver,e.Zone&&"function"==typeof e.Zone.__symbol__&&(l=e.Zone.__symbol__("MutationObserver"))&&"string"==typeof l&&e.hasOwnProperty(l)&&"function"==typeof e[l]&&(c=e[l]),u.observer=new c(d),i&&(u.timer=setTimeout(d,u.timeout)),u.observer.observe(n,r),u},addListener:function(e,n,r,i){var o=!1;e.addEventListener?("object"==typeof i?o=i:"boolean"==typeof i&&i&&f.browser.supportsPassive()&&(o={capture:!1,passive:!0}),e.addEventListener(n,r,o)):e.attachEvent&&e.attachEvent("on"+n,r),s.listenerCallbacks[n]=s.listenerCallbacks[n]||[],s.listenerCallbacks[n].push({el:e,fn:r})},removeListener:function(e,n,r){if(e.removeEventListener?e.removeEventListener(n,r,!1):e.detachEvent&&e.detachEvent("on"+n,r),s.listenerCallbacks.hasOwnProperty(n)){for(var i=0;i<s.listenerCallbacks[n].length;i++)if(r===s.listenerCallbacks[n][i].fn&&e===s.listenerCallbacks[n][i].el)return void s.listenerCallbacks[n].splice(i,1)}},isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},inArray:function(e,n){var r;if(void 0===e||void 0===n||!n.length)return!1;for(r=0;r<n.length;r++)if(n[r]===e)return!0;return!1},getQueryParamValue:function(e,n){var r,i,o,s;if(!e)return null;for("string"==typeof n?(r=f.window.document.createElement("a")).href=n:r="object"==typeof n&&"string"==typeof n.search?n:f.window.location,i=r.search.slice(1).split(/&/),o=0;o<i.length;o++)if(i[o]&&(s=i[o].split("=")).length&&s[0]===e)try{return s.length>1?decodeURIComponent(s.splice(1).join("=").replace(/\+/g," ")):""}catch(e){if(e&&"string"==typeof e.name&&-1!==e.name.indexOf("URIError"));else throw e}return null},generateUUID:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})},generateId:function(e){return"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".substr(0,e||40).replace(/x/g,function(e){var e=(Math.random()||.01).toString(36);return"0"===e?"0":e.substr(2,1)})},serializeForUrl:function(e){return f.utils.Compression&&f.utils.Compression.jsUrl?f.utils.Compression.jsUrl(e):window.JSON?JSON.stringify(e):""},getMyURL:function(){var e=document.currentScript||document.getElementById("boomr-if-as")||document.getElementById("boomr-scr-as");if(e)return e.src;var n,r,i=document.getElementsByTagName("script");for(r=i.length;r--;)if("interactive"===i[r].readyState)return i[r].src;try{throw Error()}catch(e){if("stack"in e&&(n=this.arrayFilter(e.stack.split(/\n/),function(e){return e.match(/https?:\/\//)}))&&n.length)return n[0].replace(/.*(https?:\/\/.+?)(:\d+)+\D*$/m,"$1")}return""},scroll:function(){var n=void 0!==e.pageXOffset,r="CSS1Compat"===(e.document.compatMode||""),i={x:0,y:0};return n?"function"==typeof e.pageXOffset?(i.x=e.pageXOffset(),i.y=e.pageYOffset()):(i.x=e.pageXOffset,i.y=e.pageYOffset):r?(i.x=e.document.documentElement.scrollLeft,i.y=e.document.documentElement.scrollTop):(i.x=e.document.body.scrollLeft,i.y=e.document.body.scrollTop),"number"==typeof i.sx&&(i.sx=Math.round(i.sx)),"number"==typeof i.sy&&(i.sy=Math.round(i.sy)),i},windowHeight:function(){return e.innerHeight||e.document.documentElement.clientHeight||e.document.body.clientHeight},windowWidth:function(){return e.innerWidth||e.document.documentElement.clientWidth||e.document.body.clientWidth},isNative:function(e){return!!e&&e.toString&&!e.hasOwnProperty("toString")&&/\[native code\]/.test(String(e))},overwriteNative:function(e,n,r){e&&r&&(f.boomerang_frame!==f.window&&s.nativeOverwrites.push({obj:e,functionName:n,origFn:e[n]}),e[n]=r)},isInteger:function(e){return(Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e})(e)},isObjectEmpty:function(e){for(var n in e)if(e.hasOwnProperty(n))return!1;return!0},hashString:function(e){e=encodeURIComponent(e);for(var n=0x811c9dc5,r=0;r<e.length;r++)n^=e.charCodeAt(r),n+=(n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24);return parseInt((n>>>0).toString()+e.length).toString(36)},isCurrentUASameSiteNoneCompatible:function(){return!e||!e.navigator||!e.navigator.userAgent||"string"!=typeof e.navigator.userAgent||this.isUASameSiteNoneCompatible(e.navigator.userAgent)},isUASameSiteNoneCompatible:function(e){var n=e.match(/(UCBrowser)\/(\d+\.\d+)\.(\d+)/);if(n){var r=parseFloat(n[2]),i=n[3];return 12.13===r?!(i<=2):!(r<12.13)}if(n=e.match(/(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+)/)){var o=n[2];return!(o>=51)||!(o<=66)}if(n=e.match(/(Macintosh;.*Mac OS X 10_14[_\d]*.*) AppleWebKit\//))return(!(n=e.match(/Version\/.* Safari\//))||null!==(n=e.match(/Chrom(?:e|ium)/)))&&!(n=e.match(/^Mozilla\/\d+(?:\.\d+)* \(Macintosh;.*Mac OS X \d+(?:_\d+)*\) AppleWebKit\/\d+(?:\.\d+)* \(KHTML, like Gecko\)$/));return!(n=e.match(/(iP.+; CPU .*OS 12(?:_\d+)*.*)/))},forEach:function(e,n,r){if(f.utils.isArray(e)&&"function"==typeof n)for(var i=e.length,o=0;o<i;o++)e.hasOwnProperty(o)&&n.call(r,e[o],o,e)},mark:function(e){var n=f.getPerformance();n&&"function"==typeof n.mark&&!f.window.BOOMR_no_mark&&n.mark("boomr:"+e)},measure:function(e,n,r){var i=f.getPerformance();i&&"function"==typeof i.measure&&!f.window.BOOMR_no_mark&&i.measure("boomr:"+e,n?"boomr:"+n:void 0,r?"boomr:"+r:void 0)}},browser:{results:{},supportsPassive:function(){if(void 0===f.browser.results.supportsPassive){if(f.browser.results.supportsPassive=!1,!Object.defineProperty)return!1;try{var e=Object.defineProperty({},"passive",{get:function(){f.browser.results.supportsPassive=!0}});window.addEventListener("test",null,e)}catch(e){}}return f.browser.results.supportsPassive}},init:function(n){var r,o,a,l,u=["autorun","sampleRate","interactionSampleRate","normalizeUrl","initiatorTypes","ignoreXhrs","beacon_auth_key","beacon_auth_token","beacon_with_credentials","beacon_disable_sendbeacon","beacon_url","beacon_url_force_https","beacon_type","site_domain","strip_query_string","user_ip","sendWindow"];if(i(),n||(n={}),void 0!==n.log&&(this.log=n.log),this.log||(this.log=function(){}),this.pageId||(this.pageId=f.utils.generateId(8)),n.primary&&s.handlers_attached)return this;for(l in void 0!==n.site_domain&&(/:/.test(n.site_domain)&&(n.site_domain=e.location.hostname.toLowerCase()),this.session.domain=n.site_domain),f.session.enabled&&void 0===f.session.ID&&(f.session.ID=f.utils.generateUUID()),void 0!==n.autorun&&(s.autorun=n.autorun),this.plugins)if(this.plugins.hasOwnProperty(l)){if(n[l]&&n[l].hasOwnProperty("enabled")&&!1===n[l].enabled){s.disabled_plugins[l]=1,"function"==typeof this.plugins[l].disable&&this.plugins[l].disable();continue}if(s.disabled_plugins[l]){if(!n[l]||!n[l].hasOwnProperty("enabled")||!0!==n[l].enabled)continue;"function"==typeof this.plugins[l].enable&&this.plugins[l].enable(),delete s.disabled_plugins[l]}if("function"==typeof this.plugins[l].init)try{this.plugins[l].init(n)}catch(e){f.addError(e,l+".init")}}for(a=0;a<u.length;a++)void 0!==n[u[a]]&&(s[u[a]]=n[u[a]]);if((!s.handlers_attached&&!n.wait||s.handlers_attached&&s.waiting_for_config)&&(s.onloadfired||void 0!==s.autorun&&!1===s.autorun||(f.hasBrowserOnloadFired()&&(f.loadedLate=!0),f.attach_page_ready(f.page_ready_autorun)),s.waiting_for_config=!1),s.handlers_attached)return this;for(n.wait&&(s.waiting_for_config=!0),f.attach_page_ready(function(){f.t_onload||(f.t_onload=f.now())}),f.utils.addListener(e,"DOMContentLoaded",function(){s.fireEvent("dom_loaded")}),f.fireEvent("config",n),f.subscribe("config",function(e){e.beacon_url&&(s.beacon_url=e.beacon_url)}),f.subscribe("spa_navigation",s.spaNavigation,null,s),void 0!==p&&(f.utils.addListener(c,p,function(){s.fireEvent("visibility_changed")}),s.lastVisibilityState=f.visibilityState(),f.subscribe("visibility_changed",function(){var e=f.visibilityState();f.lastVisibilityEvent[e]=f.now(),"prerender"===s.lastVisibilityState&&"prerender"!==e&&(f.addVar("vis.pre","1"),s.fireEvent("prerender_to_visible")),s.lastVisibilityState=e})),f.utils.addListener(c,"mouseup",s.xb_handler("click")),r=c.getElementsByTagName("form"),o=0;o<r.length;o++)f.utils.addListener(r[o],"submit",s.xb_handler("form_submit"));return e.onpagehide||null===e.onpagehide||f.utils.addListener(e,"unload",function(){f.window=e=null}),f.boomerang_frame!==f.window&&f.utils.addListener(f.boomerang_frame,"unload",s.onFrameUnloaded),s.handlers_attached=!0,this},attach_page_ready:function(n){f.hasBrowserOnloadFired()?this.setImmediate(n,null,null,f):e.onpagehide||null===e.onpagehide?f.utils.addListener(e,"pageshow",function(){n()}):f.utils.addListener(e,"load",function(){n()})},page_ready_autorun:function(e){s.autorun&&f.page_ready(e,!0)},page_ready:function(n,r){var i;return r||"number"!=typeof n||(i=n,n=null),n||(n=e.event),n||(n={name:"load"}),r?"number"==typeof e.BOOMR_page_ready&&(n.timing=n.timing||{},n.timing.loadEventEnd=e.BOOMR_page_ready,f.addVar("pr",1,!0)):(n.timing=n.timing||{},i?n.timing.loadEventEnd=i:"number"==typeof e.BOOMR_page_ready?n.timing.loadEventEnd=e.BOOMR_page_ready:n.timing.loadEventEnd=f.now(),f.addVar("pr",1,!0)),s.onloadfired||(s.fireEvent("page_ready",n),s.onloadfired=!0),this},hasBrowserOnloadFired:function(){var n=f.getPerformance();return c.readyState&&"complete"===c.readyState||n&&n.timing&&n.timing.loadEventStart>0||e.BOOMR_onload>0},onloadFired:function(){return s.onloadfired},setImmediate:function(n,r,i,o){var s,a;"undefined"!=typeof Error&&(a=(a=Error()).stack?a.stack.replace(/^Error/,"Called"):void 0),s=function(){n.call(o||null,r,i||{},a),s=null},e.requestIdleCallback?e.requestIdleCallback(s,{timeout:1e3}):e.setImmediate?e.setImmediate(s):setTimeout(s,10)},now:Date.now||function(){return new Date().getTime()},getPerformance:function(){try{if(f.window){if("performance"in f.window&&f.window.performance)return f.window.performance;return f.window.msPerformance||f.window.webkitPerformance||f.window.mozPerformance}}catch(e){}},forceSameSiteCookieNone:function(){s.forced_same_site_cookie_none=!0},hrNow:function(){var e,n,r=f.getPerformance();return r&&r.now?e=r.now():(n=f.plugins.RT&&f.plugins.RT.navigationStart&&f.plugins.RT.navigationStart()||f.t_lstart||f.t_start,e=f.now()-n),e},visibilityState:void 0===d?function(){return"visible"}:function(){return c[d]},lastVisibilityEvent:{},registerEvent:function(e){return s.events.hasOwnProperty(e)||(s.events[e]=[]),this},disable:function(){s.clearEvents(),s.clearListeners()},fireEvent:function(e,n){return s.fireEvent(e,n)},subscribe:function(n,r,i,o,a){var c,l,u;for(n=n.toLowerCase(),s.translate_events[n]&&(n=s.translate_events[n]),s.events.hasOwnProperty(n)||(s.events[n]=[]),u=s.events[n],c=0;c<u.length;c++)if((l=u[c])&&l.fn===r&&l.cb_data===i&&l.scope===o)return this;if(u.push({fn:r,cb_data:i||{},scope:o||null,once:a||!1}),"page_ready"===n&&s.onloadfired&&s.autorun&&this.setImmediate(r,null,i,o),"page_unload"===n||"before_unload"===n){s.unloadEventsCount++;var d,p=this;u.length,d=function(n){if(r&&r.call(o,n||e.event,i),++s.unloadEventCalled===s.unloadEventsCount){f.real_sendBeacon();var a=p.plugins.Continuity;a&&"function"==typeof a.checkIfSendAdditionalBeacon&&a.checkIfSendAdditionalBeacon()}},"page_unload"===n&&(e.onpagehide||null===e.onpagehide?f.utils.addListener(e,"pagehide",d):f.utils.addListener(e,"unload",d)),f.utils.addListener(e,"beforeunload",d)}return this},addError:function(e,n,r){var i,o=f.plugins.Errors;if(f.error("Boomerang caught error: "+e+", src: "+n+", extra: "+r),o&&o.is_supported())return void("string"==typeof e?o.send({message:e,extra:r,functionName:n,noStack:!0},o.VIA_APP,o.SOURCE_BOOMERANG):("string"==typeof n&&(e.functionName=n),void 0!==r&&(e.extra=r),o.send(e,o.VIA_APP,o.SOURCE_BOOMERANG)));"string"!=typeof e&&((i=String(e)).match(/^\[object/)&&(i=e.name+": "+(e.description||e.message).replace(/\r\n$/,"")),e=i),void 0!==n&&(e="["+n+":"+f.now()+"] "+e),r&&(e+=":: "+r),s.errors[e]?s.errors[e]++:s.errors[e]=1},isCrossOriginError:function(e){return"SecurityError"===e.name||"TypeError"===e.name&&"Permission denied"===e.message||"Error"===e.name&&e.message&&e.message.match(/^(Permission|Access is) denied/)||-0x7ff5ffba===e.number},addVar:function(e,n,r){if("string"==typeof e)s.vars[e]=n,r&&(s.singleBeaconVars[e]=1);else if("object"==typeof e){var i;for(i in e)e.hasOwnProperty(i)&&(s.vars[i]=e[i],r&&(s.singleBeaconVars[i]=1))}return this},appendVar:function(e,n){var r=f.getVar(e)||"";return r&&(r+=","),f.addVar(e,r+n),this},removeVar:function(e){var n,r;if(!arguments.length)return this;for(n=0,r=1==arguments.length&&f.utils.isArray(e)?e:arguments;n<r.length;n++)s.vars.hasOwnProperty(r[n])&&delete s.vars[r[n]];return this},hasVar:function(e){return s.vars.hasOwnProperty(e)},getVar:function(e){return s.vars[e]},getPendingVar:function(e){return s.ttinewBeaconPendingData?s.ttinewBeaconPendingData[e]:s.vars[e]},hasPending:function(){return s.ttinewBeaconPending},setVarPriority:function(e,n){return"number"!=typeof n||1!==Math.abs(n)||(s.varPriority[n][e]=1),this},setReferrer:function(e){s.r=e},requestStart:function(e){var n=f.now();return f.plugins.RT.startTimer("xhr_"+e,n),{loaded:function(r){f.responseEnd(e,n,r)}}},readyToSend:function(){var e;for(e in this.plugins)if(this.plugins.hasOwnProperty(e)){if(s.disabled_plugins[e])continue;if("function"==typeof this.plugins[e].readyToSend&&!1===this.plugins[e].readyToSend())return!1}return!0},responseEnd:function(e,n,r,i){if(n="number"==typeof n?n:f.now(),i="number"==typeof i?i:f.now(),!f.readyToSend())return void setTimeout(function(){f.responseEnd(e,n,r,i)},1e3);if(!f.hasSentPageLoadBeacon()&&!f.utils.inArray(e.initiator,f.constants.BEACON_TYPE_SPAS))return void f.subscribe("page_load_beacon",function(){f.responseEnd(e,n,r,i)},null,f,!0);if(s.beaconInQueue)return void f.subscribe("beacon",function(){f.responseEnd(e,n,r,i)},null,f,!0);if(s.beaconInQueue=!0,"object"==typeof e){if(!e.url)return;s.fireEvent("xhr_load",e)}else f.real_sendBeacon(),f.addVar("xhr.pg",e),f.plugins.RT.startTimer("xhr_"+e,n),s.fireEvent("xhr_load",{name:"xhr_"+e,data:r,timing:{loadEventEnd:i}})},uninstrumentXHR:function(){},instrumentXHR:function(){},uninstrumentFetch:function(){},instrumentFetch:function(){},sendBeacon:function(e){return e&&(s.beacon_url_override=e),s.beaconQueued||(s.beaconQueued=!0,f.setImmediate(f.real_sendBeacon,null,null,f)),!0},sendBeaconWhenReady:function(e,n,r){if(s.beaconInQueue)return void f.subscribe("beacon",function(){f.sendBeaconWhenReady(e,n,r)},null,f,!0);for(var i in s.beaconInQueue=!0,e)e.hasOwnProperty(i)&&f.addVar(i,e[i],!0);"function"==typeof n&&void 0!==r&&n.apply(r),f.sendBeacon()},real_sendBeacon:function(){var n,r=[],i={};if(!s.beaconQueued&&!s.ttinewBeaconPending)return!1;for(n in s.beaconQueued=!1,this.plugins)if(this.plugins.hasOwnProperty(n)){if(s.disabled_plugins[n])continue;if(!this.plugins[n].is_complete(s.vars))return delete s.vars.early,!1}if(!window||!window.Image||!window.navigator||!f.window)return!1;var o=f.utils.inArray(s.vars["http.initiator"],f.constants.BEACON_TYPE_SPAS),a=void 0===s.vars["http.initiator"]||o;for(n in s.vars.pgu||(s.vars.pgu=o?c.URL:c.URL.replace(/#.*/,"")),s.vars.pgu=f.utils.cleanupURL(s.vars.pgu),(!s.vars.u||o)&&(s.vars.u=s.vars.pgu),s.vars.pgu===s.vars.u&&delete s.vars.pgu,s.r?s.vars.r=f.utils.cleanupURL(s.r):delete s.vars.r,s.vars.v=f.version,f.snippetVersion&&(s.vars.sv=f.snippetVersion),s.vars.sm=f.snippetMethod||"i",f.session.enabled&&(s.vars["rt.si"]=f.session.ID+"-"+Math.round(f.session.start/1e3).toString(36),s.vars["rt.ss"]=f.session.start,void 0===s.vars.early?s.vars["rt.sl"]=f.session.length>=1?f.session.length:1:s.vars["rt.sl"]=f.session.length),f.visibilityState()&&(s.vars["vis.st"]=f.visibilityState(),f.lastVisibilityEvent.visible&&(s.vars["vis.lv"]=f.now()-f.lastVisibilityEvent.visible),f.lastVisibilityEvent.hidden&&(s.vars["vis.lh"]=f.now()-f.lastVisibilityEvent.hidden)),s.vars["ua.plt"]=navigator.platform,s.vars["ua.vnd"]=navigator.vendor,this.pageId&&(s.vars.pid=this.pageId),s.vars.n=++this.beaconsSent,e!==window&&(s.vars.if=""),s.errors)s.errors.hasOwnProperty(n)&&r.push(n+(s.errors[n]>1?" (*"+s.errors[n]+")":""));if(r.length>0&&(s.vars.errors=r.join("\n")),s.errors={},"function"==typeof s.normalizeUrl&&s.vars.u&&(s.vars.nmu=s.normalizeUrl(s.vars.u)),s.vars["http.initiator"]&&-1===s.initiatorTypes.indexOf(s.vars["http.initiator"]))return s.beaconInQueue=!1,!1;for(n in s.fireEvent("before_beacon",s.vars),s.vars)s.vars.hasOwnProperty(n)&&(i[n]=s.vars[n]);if(f.removeVar(["qt","pgu"]),void 0===s.vars.early){for(var l in s.singleBeaconVars)s.singleBeaconVars.hasOwnProperty(l)&&f.removeVar(l);s.singleBeaconVars={},!s.hasSentPageLoadBeacon&&a&&(s.hasSentPageLoadBeacon=!0,f.setImmediate(function(){s.fireEvent("page_load_beacon",i)}))}if(f.session.rate_limited)return!1;if(s.beaconInQueue=!1,"interaction"===s.vars["http.initiator"]){if("number"==typeof s.interactionSampleRate&&Math.random()>s.interactionSampleRate)return!1}else if("number"==typeof s.sampleRate&&Math.random()>s.sampleRate)return!1;return this.plugins.Continuity.getTtiWaitForXHRDone()&&"spa_hard"===i["http.initiator"]&&!i["c.tti.new"]&&(s.ttinewBeaconPending=!0,s.ttinewBeaconPendingData=i),f.sendBeaconData(i),!0},sendAdditionalBeacon:function(e){s.ttinewBeaconPendingData&&(f.sendBeaconData(Object.assign(s.ttinewBeaconPendingData,e)),s.ttinewBeaconPendingData=void 0,s.ttinewBeaconPending=!1)},sendBeaconData:function(n){var r,i,o,a,c=[],l=[],u=!0;if(s.beacon_url=s.beacon_url_override||s.beacon_url,!s.beacon_url||!s.beaconUrlAllowed(s.beacon_url)||f.utils.isObjectEmpty(n))return!1;s.fireEvent("beacon",n),c=this.getVarsOfPriority(n,-1),l=this.getVarsOfPriority(n,1),r=c.concat(this.getVarsOfPriority(n,0),l).join("&"),s.beacon_url_force_https&&s.beacon_url.match(/^\/\//)&&(s.beacon_url="https:"+s.beacon_url),i=s.beacon_url+(s.beacon_url.indexOf("?")>-1?"&":"?")+r,"GET"===s.beacon_type?(u=!0,i.length>f.constants.MAX_GET_LENGTH&&(window.console&&(console.warn||console.log)||function(){})("Boomerang: Warning: Beacon may not be sent via GET due to payload size > 2000 bytes")):("POST"===s.beacon_type||i.length>f.constants.MAX_GET_LENGTH)&&(u=!1);var d=s.sendWindow;if(d&&d.navigator&&"function"==typeof d.navigator.sendBeacon&&f.utils.isNative(d.navigator.sendBeacon)&&"function"==typeof e.Blob&&"GET"!==s.beacon_type&&void 0===s.beacon_auth_token&&!s.beacon_disable_sendbeacon){var p=new e.Blob([r+"&sb=1"],{type:"text/plain"});if(d.navigator.sendBeacon(s.beacon_url,p))return!0}if(f.orig_XMLHttpRequest||d&&d.XMLHttpRequest||(u=!0),u){try{o=new Image}catch(e){return!1}o.src=i}else{a=new(d.XMLHttpRequest||f.window.orig_XMLHttpRequest||f.orig_XMLHttpRequest||f.window.XMLHttpRequest);try{this.sendXhrPostBeacon(a,r)}catch(e){a=new f.boomerang_frame.XMLHttpRequest,this.sendXhrPostBeacon(a,r)}}return!0},hasSentPageLoadBeacon:function(){return s.hasSentPageLoadBeacon},sendXhrPostBeacon:function(e,n){e.open("POST",s.beacon_url),e.setRequestHeader("Content-type","text/plain"),void 0!==s.beacon_auth_token&&(void 0===s.beacon_auth_key&&(s.beacon_auth_key="Authorization"),e.setRequestHeader(s.beacon_auth_key,s.beacon_auth_token)),s.beacon_with_credentials&&(e.withCredentials=!0),e.send(n)},getVarsOfPriority:function(e,n){var r,i=[],o=0!==n?s.varPriority[n]:e;for(r in o)o.hasOwnProperty(r)&&e.hasOwnProperty(r)&&(i.push(this.getUriEncodedVar(r,void 0===e[r]?"":e[r])),0!==n&&delete e[r]);return i},getUriEncodedVar:function(e,n){return null==n&&(n=""),"object"==typeof n&&(n=f.utils.serializeForUrl(n)),encodeURIComponent(e)+"="+encodeURIComponent(n)},getResourceTiming:function(e,n,r){var i,o=f.getPerformance();try{if(o&&"function"==typeof o.getEntriesByName){if(!(i=o.getEntriesByName(e))||!i.length||"function"==typeof r&&(!(i=f.utils.arrayFilter(i,r))||!i.length))return;return i.length>1&&"function"==typeof n&&i.sort(n),i[i.length-1]}}catch(e){}},setBeaconUrlsAllowed:function(e){s.beacon_urls_allowed=e}},f.url){var m=f.window.document.createElement("a");m.href=f.url,a.url=m.href}else a.url=a.utils.getMyURL();delete window.BOOMR_start,"number"==typeof window.BOOMR_lstart?(a.t_lstart=window.BOOMR_lstart,delete window.BOOMR_lstart):"number"==typeof f.window.BOOMR_lstart&&(a.t_lstart=f.window.BOOMR_lstart),"number"==typeof f.window.BOOMR_onload&&(a.t_onload=f.window.BOOMR_onload),"object"==typeof console&&void 0!==console.log?a.log=function(e,n,r){}:a.log=function(){},a.debug=(n=function(e){return function(n,r){return this.log(n,e,"boomerang"+(r?"."+r:"")),this}})("debug"),a.info=n("info"),a.warn=n("warn"),a.error=n("error"),a.traceTime=function(e){var n=e||f.now();return[new Date(n).getHours(),new Date(n).getMinutes(),new Date(n).getSeconds(),new Date(n).getMilliseconds()].join(":")},a.cleanupURL=function(){return""+location.toString().replace(location.protocol+"//"+location.host,"")},a.trace=function(e,n,r,i){r="("+f.traceTime()+") {"+f.cleanupURL()+"} ["+e+"] <"+n+"> "+r},a.traceHighlight=function(e,n,r,i){r="("+f.traceTime()+") {"+f.cleanupURL()+"} ["+e+"] <"+n+"> "+r},a.warn=function(e,n,r,i){r="("+f.traceTime()+") {"+f.cleanupURL()+"} ["+e+"] <"+n+"> "+r};try{var g=a.getPerformance();g&&"function"==typeof g.now&&/\[native code\]/.test(String(g.now))&&g.timing&&g.timing.navigationStart&&(a.now=function(){return Math.round(g.now()+g.timing.navigationStart)})}catch(e){}for(o in s.checkLocalStorageSupport(),a)a.hasOwnProperty(o)&&(f[o]=a[o]);return f.xhr_excludes||(f.xhr_excludes={}),f.checkWindowOverrides=function(e){if(!Object.getOwnPropertyNames)return[];var n,r,i,o=[];function s(n){(function(n){for(var r,i,o=n.split("."),s=e;s&&o.length;)try{s=s[o.shift()]}catch(e){return!1}return"function"==typeof s&&(r=s,!("console.assert"===(i=n)||"Function.prototype"===i||i.indexOf("onload")>=0||i.indexOf("onbeforeunload")>=0||i.indexOf("onerror")>=0||i.indexOf("onload")>=0||i.indexOf("NodeFilter")>=0||r.toString&&!r.hasOwnProperty("toString")&&/\[native code\]/.test(String(r))))})(n)&&o.push(n)}(n=c.createElement("iframe")).style.display="none",n.src="javascript:false",c.getElementsByTagName("script")[0].parentNode.appendChild(n),i=Object.getOwnPropertyNames(r=n.contentWindow);for(var a=0;a<i.length;a++){var l=i[a];if("window"!==l&&"self"!==l&&"top"!==l&&"parent"!==l&&"frames"!==l&&r[l]&&("object"==typeof r[l]||"function"==typeof r[l])){s(l);var u=[];try{u=Object.getOwnPropertyNames(r[l])}catch(e){}for(var d=0;d<u.length;d++)s([l,u[d]].join("."));if(r[l].prototype){u=Object.getOwnPropertyNames(r[l].prototype);for(var d=0;d<u.length;d++)s([l,"prototype",u[d]].join("."))}}}return o},f.checkDocumentOverrides=function(e){return f.utils.arrayFilter(["readyState","domain","hidden","URL","cookie"],function(n){return e.hasOwnProperty(n)})},"true"===f.utils.getQueryParamValue("overridden")&&e&&e.Object&&Object.getOwnPropertyNames&&[].concat(f.checkWindowOverrides(e)).concat(f.checkDocumentOverrides(c)).length,u("onBoomerangLoaded",{BOOMR:f},!0),f}(window),this.BOOMR.addVar("token",e.token),e&&this.initOptions(e))}return e.prototype.shouldIgnoreUrls=function(e){return a(e,location.href)},e.prototype.initOptions=function(e){this.installPlugins();var n=e.sampleRate||1,r=e.interactionSampleRate||.1;for(var i in this.BOOMR.init({beacon_url:"https://fclog.baidu.com/log/weirwood?type=perf",autorun:!1,History:{auto:!0},instrument_xhr:!0,monitor_fetch:!0,ResourceTiming:{clearOnBeacon:!0,monitorClearResourceTimings:!0},Continuity:{monitorLongTasks:!0,monitorPageBusy:!0,monitorFrameRate:!0,monitorInteractions:!0,monitorStats:!1,ttiWaitForXHRDone:e.ttiWaitForXHRDone||!0,ttiWaitForXHRIgnore:e.ttiWaitForXHRIgnore||[],waitAfterOnload:e.waitAfterOnload||!1,afterOnload:e.afterOnload||!1},ignoreImage:e.ignoreImage||!1,sampleRate:n,interactionSampleRate:n*r,normalizeUrl:e.normalizeUrl,initiatorTypes:e.initiatorTypes||["spa_hard","spa","xhr"],ignoreXhrs:e.ignoreXhrs||[],sendWindow:e.sendWindow||window}),this.BOOMR)this.BOOMR.hasOwnProperty(i)&&(this[i]=this.BOOMR[i])},e.prototype.installPlugins=function(){var e,n,r,i,o=function(e){var n,r,i=(e=e||window).document,o=function(n){var r=!1;if(n.getBoundingClientRect){var o=n.getBoundingClientRect();(r={top:Math.max(o.top,0),left:Math.max(o.left,0),bottom:Math.min(o.bottom,e.innerHeight||i.documentElement.clientHeight),right:Math.min(o.right,e.innerWidth||i.documentElement.clientWidth)}).bottom<=r.top||r.right<=r.left?r=!1:r.area=(r.bottom-r.top)*(r.right-r.left)}return r},s=function(e,n){if(n){var r=o(e);r&&a.push({url:n,area:r.area,rect:r})}},a=[],c=[];try{var l=e.performance.timing.navigationStart;!function(){for(var n=i.getElementsByTagName("*"),r=/url\(.*(http.*)\)/ig,c=0;c<n.length;c++){var l=n[c],u=e.getComputedStyle(l);if("IMG"==l.tagName&&s(l,l.currentSrc||l.src),u["background-image"]){r.lastIndex=0;var d=r.exec(u["background-image"]);d&&d.length>1&&s(l,d[1].replace('"',""))}if("IFRAME"==l.tagName)try{var p=o(l);if(p){var h=RUMSpeedIndex(l.contentWindow);h&&a.push({tm:h,area:p.area,rect:p})}}catch(e){}}}();for(var u={},d=e.performance.getEntriesByType("resource"),p=0;p<d.length;p++)u[d[p].name]=d[p].responseEnd;for(var h=0;h<a.length;h++)"tm"in a[h]||(a[h].tm=void 0!==u[a[h].url]?u[a[h].url]:0);if(!function(){try{for(var r=performance.getEntriesByType("paint"),o=0;o<r.length;o++)if("first-paint"==r[o].name){l=performance.getEntriesByType("navigation")[0].startTime,n=r[o].startTime-l;break}}catch(e){}if(void 0===n&&"msFirstPaint"in e.performance.timing&&(n=e.performance.timing.msFirstPaint-l),void 0===n&&"chrome"in e&&"loadTimes"in e.chrome){var s=e.chrome.loadTimes();if("firstPaintTime"in s&&s.firstPaintTime>0){var a=s.startLoadTime;"requestTime"in s&&(a=s.requestTime),s.firstPaintTime>=a&&(n=(s.firstPaintTime-a)*1e3)}}if(void 0===n||n<0||n>12e4){n=e.performance.timing.responseStart-l;for(var c={},u=i.getElementsByTagName("head")[0].children,o=0;o<u.length;o++){var d=u[o];"SCRIPT"==d.tagName&&d.src&&!d.async&&(c[d.src]=!0),"LINK"==d.tagName&&"stylesheet"==d.rel&&d.href&&(c[d.href]=!0)}for(var p=e.performance.getEntriesByType("resource"),h=!1,f=0;f<p.length;f++)if(!h&&c[p[f].name]&&("script"==p[f].initiatorType||"link"==p[f].initiatorType)){var m=p[f].responseEnd;(void 0===n||m>n)&&(n=m)}else h=!0}n=Math.max(n,0)}(),!function(){for(var r={0:0},o=0,s=0;s<a.length;s++){var l=n;"tm"in a[s]&&a[s].tm>n&&(l=a[s].tm),void 0===r[l]&&(r[l]=0),r[l]+=a[s].area,o+=a[s].area}var u=Math.max(i.documentElement.clientWidth,e.innerWidth||0)*Math.max(i.documentElement.clientHeight,e.innerHeight||0);if(u>0&&(u=.1*Math.max(u-o,0),void 0===r[n]&&(r[n]=0),r[n]+=u,o+=u),o){for(var d in r)r.hasOwnProperty(d)&&c.push({tm:d,area:r[d]});c.sort(function(e,n){return e.tm-n.tm});for(var p=0,h=0;h<c.length;h++)p+=c[h].area,c[h].progress=p/o}}(),c.length){r=0;for(var f=0,m=0,g=0;g<c.length;g++){var v=c[g].tm-f;v>0&&m<1&&(r+=(1-m)*v),f=c[g].tm,m=c[g].progress}}else r=n}catch(e){}return r}(window);if(this.BOOMR.addVar("speedIndex",o,!0),!function(){if(!BOOMR.plugins.Continuity){var e,n=0,r=1,i=2,o="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_",s=".",a={passive:!0,capture:!0},c=BOOMR.getPerformance(),l={},u=c&&c.timing&&c.timing.navigationStart?c.timing.navigationStart:BOOMR.now(),d=function(r){var i={},o={},s=[],a=0,d=0,p=0,h=!0;function f(){return Math.floor((BOOMR.now()-r)/100)}function m(n){function o(e){return n?BOOMR.getPendingVar(e):BOOMR.getVar(e)}if(e.ttiWaitForXHRDone&&BOOMR.utils.inArray(o("http.initiator"),BOOMR.constants.BEACON_TYPE_SPAS)){var s=o("c.tti.xd"),a=0,c="spa"===o("http.initiator");c&&(a=o("rt.tstart")-u,s=o("c.tti.xd.increasing"));var l=s?s-(r-u):c?a:r-u,d=f(),p=0,h=0,m=0;for(p=Math.floor(l/100);p<=d;p++){if(!n&&(i.longtask&&i.longtask[p]||i.fps&&(!i.fps[p]||i.fps[p]<2)||i.busy&&i.busy[p]>50||i.interdly&&i.interdly[p])){h=0;continue}if(++h>=5){m=Math.max((m=r+(p-5)*100-a)-u,o("c.tti.xd"));break}}return m>0?(n||e.addToBeacon("c.tti.new",m),e.hasAddedTtinewToBeacon=!0,m):(e.hasAddedTtinewToBeacon=!1,0)}}return BOOMR.fpsLog&&BOOMR.fpsLog.length&&(r=BOOMR.fpsLog[0]+u),l.timeToInteractive=function(){if(a)return a-u},l.timeToVisuallyReady=function(){if(d)return d-u},l.timeToHeroImagesReady=function(){if(e.ttiWaitForHeroImages&&p)return p-u},l.timeToFrameworkReady=function(){if(e.ttiWaitForFrameworkReady&&e.frameworkReady)return e.frameworkReady-u},l.log=function(){return s},{register:function(e,r,s){i[e]||(i[e]=[]),o[e]={compressMode:r||n,backfillLast:s}},set:function(e,n,r){void 0===r&&(r=f()),i[e]&&(i[e][r]=n)},log:function(n,r,i){void 0===r&&(r=f()),s.push({type:n,time:r,val:i}),s.length>e.logMaxEntries&&Array.prototype.splice.call(s,0,s.length-e.logMaxEntries)},increment:function(e,n,r){void 0===r&&(r=f()),void 0===n&&(n=1),i[e]&&(i[e][r]||(i[e][r]=0),i[e][r]+=n)},getTimeBucket:f,getStats:function(e,n){var o,s=0,a=0,c=1/0,l=0,u=Math.floor((n-r)/100);if(!i[e])return 0;for(var d in i[e])(d=parseInt(d,10))>=u&&i[e].hasOwnProperty(d)&&(o=i[e][d],s++,a+=o,c=Math.min(c,o),l=Math.max(l,o));return{total:a,count:s,min:c,max:l}},analyze:function(n){var g=f(),v=0,y=0;if(e.sendLog&&void 0!==n&&function(){for(var n="",r=0;r<s.length;r++){var i=s[r];for(var o in 0!==r&&(n+="|"),n+=i.type,n+=Math.round(i.time-u).toString(36),i.val)i.val.hasOwnProperty(o)&&(n+=","+o,"number"==typeof i.val[o]?n+=i.val[o].toString(36):n+=i.val[o])}""!==n&&e.addToBeacon("c.l",n)}(),e.sendTimeline&&void 0!==n){var b,_,w=n?Math.max(n,BOOMR.now()-12e4):n;for(b in i)i.hasOwnProperty(b)&&""!==(_=M(o[b].compressMode,o[b].backfillLast,i[b],0!==w?Math.floor((w-r)/100):0,f()))&&e.addToBeacon("c.t."+b,_)}if(!a){if(!d&&!(d=function(){var n=0;if(e.ttiWaitForFrameworkReady){if(!e.frameworkReady)return;n=e.frameworkReady}if(BOOMR.plugins.PaintTiming&&BOOMR.plugins.PaintTiming.is_supported()&&c&&c.timeOrigin){var r=BOOMR.plugins.PaintTiming.getTimingFor("largest-contentful-paint");r||(r=BOOMR.plugins.PaintTiming.getTimingFor("first-contentful-paint")),r||(r=BOOMR.plugins.PaintTiming.getTimingFor("first-paint")),r&&(n=Math.max(n,Math.round(r+c.timeOrigin)))}else if(c&&c.timing&&c.timing.msFirstPaint)n=Math.max(n,c.timing.msFirstPaint);else if(BOOMR.window&&BOOMR.window.chrome&&"function"==typeof BOOMR.window.chrome.loadTimes){var i=BOOMR.window.chrome.loadTimes();i&&i.firstPaintTime&&(n=Math.max(n,1e3*i.firstPaintTime))}return c&&c.timing&&c.timing.domContentLoadedEventEnd&&(n=Math.max(n,c.timing.domContentLoadedEventEnd)),e.ttiWaitForHeroImages&&(p=function(e){var n,r,i,o,s,a=0;if(!BOOMR.window||!BOOMR.window.document||"function"!=typeof BOOMR.window.document.querySelectorAll||!c||"function"!=typeof c.getEntriesByType)return 0;if((n=BOOMR.window.document.querySelectorAll(e+", "+e+" * img, "+e+" * image"))&&n.length)for(r=0;r<n.length;r++){if(!(o=n[r].currentSrc||n[r].src||"function"==typeof n[r].getAttribute&&n[r].getAttribute("xlink:href"))&&"function"==typeof BOOMR.window.getComputedStyle){var l=BOOMR.window.getComputedStyle(n[r])&&BOOMR.window.getComputedStyle(n[r]).getPropertyValue("background");if(l){var d=l.match(/url\(["']?([^"']*)["']?\)/);d&&d.length>0&&(o=d[1])}}if(o&&(s=c.getEntriesByName(o))&&s.length)for(i=0;i<s.length;i++)a=Math.max(a,s[i].responseEnd)}return a?Math.floor(a+u):0}(e.ttiWaitForHeroImages))&&(n=Math.max(n,p)),n}())||(h&&(e.addToBeacon("c.tti.vr",l.timeToVisuallyReady()),e.addToBeacon("c.tti.fr",l.timeToFrameworkReady()),e.addToBeacon("c.tti.hi",l.timeToHeroImagesReady()),h=!1),!i.longtask&&!i.fps&&!i.busy))return;for(v=Math.floor((d-r)/100);v<=g;v++){if(i.longtask&&i.longtask[v]||i.fps&&(!i.fps[v]||i.fps[v]<2)||i.busy&&i.busy[v]>50||i.interdly&&i.interdly[v]){y=0;continue}if(++y>=5){a=Math.max(a=r+(v-5)*100,d);break}}a>0&&e.addToBeacon("c.tti",l.timeToInteractive())}m()},analyzeXHRDone:m,stop:function(){i={},s=[]},onBeacon:function(){for(var e in i)i.hasOwnProperty(e)&&(i[e]=[]);s=[],h=!1}}},p=function(n){if(n.PerformanceObserver&&n.LayoutShift){var r=!0,i=0,o=0,s=[],a=new n.PerformanceObserver(function(e){r&&e.getEntries().map(function(e){if(!e.hadRecentInput){var n=s[0],r=s[s.length-1];o&&e.startTime-r.startTime<1e3&&e.startTime-n.startTime<5e3?(o+=e.value,s.push(e)):(o=e.value,s=[e]),o>i&&(i=o)}})});try{a.observe({type:"layout-shift",buffered:!0})}catch(e){return}return l.clsScore=function(){return i},{clearClsScore:c,analyze:function(n){e.addToBeacon("c.cls",l.clsScore())},stop:function(){r=!1,a.disconnect(),c()},onBeacon:function(){c()}}}function c(){i=0}},h=function(r,i){if(r.PerformanceObserver&&r.PerformanceLongTaskTiming){var o={unknown:0,self:1,"same-origin-ancestor":2,"same-origin-descendant":3,"same-origin":4,"cross-origin-ancestor":5,"cross-origin-descendant":6,"cross-origin-unreachable":7,"multiple-contexts":8},s={unknown:0,script:1,layout:2},a={unknown:0,iframe:1,embed:2,object:3},c=new r.PerformanceObserver(function(e){var n,r,o={};if(d){n=e.getEntries(),Array.prototype.push.apply(u,n);var s=i.getTimeBucket();for(r=0;r<n.length;r++){var a=n[r].duration;p+=a;var c=s;for(a-=100;a>0&&c>=0;)o[--c]?o[c]++:o[c]=1,a-=100}for(var l in o)o.hasOwnProperty(l)&&i.increment("longtask",o[l],l);i.increment("longtask",n.length)}});try{c.observe({entryTypes:["longtask"]})}catch(e){return}i.register("longtask",n);var u=[],d=!0,p=0;return l.longTasksTime=function(){return p},l.longTasksCount=function(){return u.length},{getTasks:function(){return u},clearTasks:h,analyze:function(n){var r,i,c,d,p,h=[],f=[];if(0!==u.length){for(r=0;r<u.length;r++){for(i=0,d={s:Math.round((c=u[r]).startTime).toString(36),d:Math.ceil(c.duration).toString(36),n:o[c.name]?o[c.name]:0},f=[];i<c.attribution.length;i++)if("script"!==(p=c.attribution[i]).name||"iframe"!==p.containerType||p.containerName||p.containerId||p.containerSrc){var m,g,v=p.containerName?p.containerName:void 0,y=p.containerId?p.containerId:void 0;v===y&&(v=void 0);var b=void 0===y?p.containerSrc:void 0;f.push({a:s[p.name]?s[p.name]:0,t:a[p.containerType]?a[p.containerType]:0,n:v,i:y,s:b})}f.length>0&&(d.a=f),h.push(d)}e.addToBeacon("c.lt.n",l.longTasksCount(),!0),e.addToBeacon("c.lt.tt",l.longTasksTime()),e.addToBeacon("c.lt",(m=h,(g=BOOMR.utils.Compression&&BOOMR.utils.Compression.jsUrl||window.UserTimingCompression&&window.UserTimingCompression.jsUrl||BOOMR.window.UserTimingCompression&&BOOMR.window.UserTimingCompression.jsUrl)?g(m):window.JSON?JSON.stringify(m):""))}},stop:function(){d=!1,c.disconnect(),h()},onBeacon:function(){h()}}}function h(){u=[],p=0}},f=function(n,r){r.register("busy",i);var o=Math.floor(3.125),s=BOOMR.now(),a=0,c=0,u=0,d=0,p=!1,h=!1;return l.pageBusy=function(){return 0===u?0:Math.ceil(d/u*100)},p=setInterval(function(){var e=BOOMR.now(),n=e-s;if(s=e,n>68){var r=Math.floor((n-32)/32);a+=r,c+=r,n-=32*r}a++,n>36&&c++},32),h=setInterval(function(){var e=r.getTimeBucket(),n=e,i=0;if(0!==a){for(;a>o+1&&i<=100;)r.set("busy",100,--n),a-=o,c=Math.max(c-o,0),u+=o,d+=o,i++;u+=a,d+=c,r.set("busy",Math.ceil(c/a*100),e),a=0,c=0}},100),{analyze:function(n){e.addToBeacon("c.b",l.pageBusy())},stop:function(){p&&(clearInterval(p),p=!1),h&&(clearInterval(h),h=!1)},onBeacon:function(){u=0,d=0}}},m=function(r,i){i.register("fps",n);var o,s,a=0,c=0,d=!0;if(BOOMR.fpsLog&&BOOMR.fpsLog.length){s=o=BOOMR.fpsLog[0]+u;for(var p=0;p<BOOMR.fpsLog.length;p++){var h=u+BOOMR.fpsLog[p];i.increment("fps",1,Math.floor((h-o)/100)),h-s>=50&&c++,s=h}a=BOOMR.fpsLog.length,delete BOOMR.fpsLog}else o=BOOMR.now();return r.requestAnimationFrame(function e(n){d&&(n-s>=50&&c++,s=n,a++,i.increment("fps"),r.requestAnimationFrame(e))}),l.fps=function(){var e=l.fpsDuration();if(e)return Math.floor(a/(e/1e3))},l.fpsDuration=function(){if(o)return BOOMR.now()-o},l.fpsMinimum=function(){if(l.fpsDuration()){var e=i.getStats("fps",o).min;return e!==1/0?e:void 0}},l.fpsLongFrames=function(){return c},l.fpsStart=function(){return o?o.toString(36):0},{analyze:function(n){e.addToBeacon("c.f",l.fps()),e.addToBeacon("c.f.d",l.fpsDuration()),e.addToBeacon("c.f.m",l.fpsMinimum()),e.addToBeacon("c.f.l",l.fpsLongFrames()),e.addToBeacon("c.f.s",l.fpsStart())},stop:function(){d=!1,o=0},onBeacon:function(){d&&(o=BOOMR.now()),a=0,c=0}}},g=function(r,o,s){if(r&&r.document&&r.document.body&&r.document.documentElement){var c=2e3,u=20,d=0,p=0,h=0,f=0,m=0,g=0,v=0,y=0,b=!1,_=r.document.body,w=r.document.documentElement;o.register("scroll",n),o.register("scrollpct",i);var O=Math.max(_.scrollHeight,_.offsetHeight,w.clientHeight,w.scrollHeight,w.offsetHeight)-BOOMR.utils.windowHeight();return l.scrollPct=function(){return f},l.scrollCount=function(){return m},l.scrollDistinct=function(){return v},l.scrollPixels=function(){return g},BOOMR.utils.addListener(r,"scroll",R,a),b=setInterval(function(){var e=Math.min(h,100);0!==e&&o.set("scrollpct",e),h=0},100),{analyze:function(n){e.addToBeacon("c.s",l.scrollCount()),e.addToBeacon("c.s.p",l.scrollPct()),e.addToBeacon("c.s.y",l.scrollPixels()),e.addToBeacon("c.s.d",l.scrollDistinct())},stop:function(){b&&(clearInterval(b),b=!1),BOOMR.utils.removeListener(r,"scroll",R)},onBeacon:function(){f=0,m=0,g=0,v=0}}}function R(e){var n=BOOMR.now();m++,n-y>c&&v++,y=n;var r=Math.ceil(BOOMR.utils.scroll().y),i=Math.abs(d-r);g+=i,o.increment("scroll",i),(0===p||Math.abs(p-r)>u)&&(o.log(0,n,{y:r}),p=r),h+=Math.round(i/O*100),f+=Math.round(i/O*100),d=r}},v=function(r,i,o){i.register("click",n);var s=0,c=0,u=0,d=0,p=0,h=null;function f(e){var n=BOOMR.now(),r=e.clientX,a=e.clientY;s++;var l=Math.round(Math.sqrt(Math.pow(p-a,2)+Math.pow(d-r,2)));h===e.target||l<=10?++c+1>=3&&(u++,BOOMR.fireEvent("rage_click",e)):c=0,d=r,p=a,h=e.target,i.increment("click"),i.log(1,n,{x:r,y:a}),e.cancelable&&o.interact("click",n,e)}return l.clicksCount=function(){return s},l.clicksRage=function(){return u},BOOMR.utils.addListener(r.document,"click",f,a),{analyze:function(n){e.addToBeacon("c.c",l.clicksCount()),e.addToBeacon("c.c.r",l.clicksRage())},stop:function(){BOOMR.utils.removeListener(r.document,"click",f)},onBeacon:function(){s=0,c=0,u=0}}},y=function(r,i,o){i.register("key",n);var s=0,c=0;function u(e){var n=BOOMR.now();s++,27===e.keyCode&&c++,i.increment("key"),i.log(3,n),e.cancelable&&o.interact("key",n,e)}return l.keyCount=function(){return s},l.keyEscapes=function(){return c},BOOMR.utils.addListener(r.document,"keydown",u,a),{analyze:function(n){e.addToBeacon("c.k",l.keyCount()),e.addToBeacon("c.k.e",l.keyEscapes())},stop:function(){BOOMR.utils.removeListener(r.document,"keydown",u)},onBeacon:function(){s=0,c=0}}},b=function(r,o,s){o.register("mouse",n),o.register("mousepct",i);var c=0,u=0,d=0,p=0,h=0,f=0,m=0,g=!1,v=!1,y=Math.round(Math.sqrt(Math.pow(BOOMR.utils.windowHeight(),2)+Math.pow(BOOMR.utils.windowWidth(),2)));function b(e){var n=e.clientX,r=e.clientY,i=Math.round(Math.sqrt(Math.pow(u-r,2)+Math.pow(c-n,2))),s=Math.round(i/y*100);h+=s,f+=s,m+=i,c=n,u=r,o.increment("mouse",i)}return l.mousePct=function(){return f},l.mousePixels=function(){return m},g=setInterval(function(){var e=Math.min(h,100);0!==e&&o.set("mousepct",e),h=0},100),v=setInterval(function(){(d!==c||p!==u)&&Math.round(Math.sqrt(Math.pow(p-u,2)+Math.pow(d-c,2)))>=10&&(o.log(2,BOOMR.now(),{x:c,y:u}),d=c,p=u)},250),BOOMR.utils.addListener(r.document,"mousemove",b,a),{analyze:function(n){e.addToBeacon("c.m.p",l.mousePct()),e.addToBeacon("c.m.n",l.mousePixels())},stop:function(){g&&(clearInterval(g),g=!1),v&&(clearInterval(v),v=!1),BOOMR.utils.removeListener(r.document,"mousemove",b)},onBeacon:function(){f=0,m=0}}},_=function(r,i,o){i.register("inter",n),i.register("interdly",n);var s=0,a=null,c=0,d=0,p=0,h=0,f=!0,m=0,g=0,v=!1,y=!1,b=!1,_=!1;function w(){v&&(clearTimeout(v),v=!1),y&&(clearTimeout(y),y=!1)}function O(){BOOMR.sendBeaconWhenReady({"rt.start":"manual","http.initiator":"interaction","rt.tstart":m,"rt.end":g},function(){w(),BOOMR.fireEvent("interaction")},e)}return l.interactionDelayed=function(){return p},l.interactionDelayedTime=function(){return Math.ceil(h)},l.interactionAvgDelay=function(){if(c>0)return Math.ceil(d/c)},l.timeToFirstInteraction=function(){if(s)return s-u},l.firstInputDelay=function(){if(null!==a)return a},BOOMR.subscribe("spa_init",function(){b=!0,w()},null,e),{interact:function(n,l,_){var w=0;l=l||BOOMR.now(),f&&(c++,s||(s=_&&_.timeStamp?_.timeStamp+u:l),_&&_.timeStamp&&!(e.isSafari&&r!==window)&&(w=_.timeStamp>14e11?l-_.timeStamp:BOOMR.hrNow()-_.timeStamp,d+=w,null===a&&(a=Math.ceil(w)),w>50&&(i.increment("interdly"),p++,h+=w)),i.increment("inter"),!b&&e.afterOnloadMonitoring&&(g=BOOMR.now(),m||(m=g,y=setTimeout(O,3e4)),v&&(clearTimeout(v),v=!1),v=setTimeout(O,o)))},analyze:function(n){var r;e.addToBeacon("c.i.dc",l.interactionDelayed()),e.addToBeacon("c.i.dt",l.interactionDelayedTime()),e.addToBeacon("c.i.a",l.interactionAvgDelay()),!_&&(BOOMR.plugins.EventTiming&&BOOMR.plugins.EventTiming.is_enabled()&&(r=BOOMR.plugins.EventTiming.metrics.firstInputDelay()),r||null===a||(r=l.firstInputDelay()),r&&(e.addToBeacon("c.fid",Math.ceil(r),!0),e.addToBeacon("c.ttfi",BOOMR.plugins.EventTiming.metrics.timeToFirstInteraction()||l.timeToFirstInteraction()),_=!0))},stop:function(){f=!1},onBeacon:function(){h=0,p=0,c=0,d=0,m=0,g=0,b=!1,w()}}},w=function(e,n,r){var i,o,s=!0;function c(){s&&(r.interact("pd",i,o),i=null,o=null,BOOMR.utils.removeListener(window,"pointerup",c))}function l(e){s&&e.cancelable&&(i=BOOMR.now(),o=e,BOOMR.utils.addListener(window,"pointerup",c,a))}function u(){s=!1,BOOMR.utils.removeListener(window,"pointerdown",l),BOOMR.utils.removeListener(window,"pointerup",c),BOOMR.utils.removeListener(window,"pointercancel",u)}return BOOMR.utils.addListener(window,"pointerdown",l,a),BOOMR.utils.addListener(window,"pointercancel",u,a),{stop:u}},O=function(e,n,r){var i=!0;function o(e){if(i&&e.cancelable){var n=BOOMR.now();r.interact("md",n,e)}}return BOOMR.utils.addListener(window,"mousedown",o,a),{stop:function(){i=!1,BOOMR.utils.removeListener(window,"mousedown",o)}}},R=function(e,n,r){var i=!0;function o(e){if(i&&e.cancelable){var n=BOOMR.now();r.interact("ts",n,e)}}return BOOMR.utils.addListener(window,"touchstart",o,a),{stop:function(){i=!1,BOOMR.utils.removeListener(window,"touchstart",o)}}},S=function(e,r,i){r.register("vis",n);var o={visible:0,hidden:1,prerender:2,unloaded:3},s=!0;return BOOMR.subscribe("visibility_changed",function(e){var n=BOOMR.now();s&&(r.increment("vis"),r.log(4,n,{s:o[BOOMR.visibilityState()]}))}),{stop:function(){s=!1}}},E=function(e,r,i){r.register("orn",n);var o=!0;function s(e){var n=BOOMR.now(),i=window.orientation;if(o){r.increment("orn");var s=window.screen&&(screen.orientation||screen.msOrientation||screen.mozOrientation||{});s&&"number"==typeof s.angle&&(i=screen.orientation.angle),"number"==typeof i&&r.log(5,n,{a:i})}}return BOOMR.utils.addListener(e,"orientationchange",s,a),{stop:function(){o=!1,BOOMR.utils.removeListener(e,"orientationchange",s)}}},T=function(e,o){o.register("mem",r,!0),o.register("bat",i,!0),o.register("domsz",r,!0),o.register("domln",r,!0),o.register("mut",n);var s,a=e.document,l=!0,u=!1,d=null,p=0,h=0,f=a.getElementsByTagName("*");function m(){l&&d&&o.set("bat",d.level)}return u=setInterval(function(){var e=c&&c.memory&&c.memory.usedJSHeapSize;if(e&&o.set("mem",e),h=f.length,o.set("domsz",a.documentElement.innerHTML.length),o.set("domln",h),p>0){var n=Math.min(Math.round(p/h*100),100);o.set("mut",n),p=0}},1e3),e.navigator&&"function"==typeof e.navigator.getBattery&&e.navigator.getBattery().then(function(e){(d=e).onlevelchange&&(d.onlevelchange=m)}),BOOMR.utils.isMutationObserverSupported()&&(s=BOOMR.utils.addObserver(a,{childList:!0,subtree:!0},null,function(e){return e.forEach(function(e){if("childList"!==e.type)return!0;for(var n=0;n<e.addedNodes.length;n++){var r=e.addedNodes[n];p++,p+=r.getElementsByTagName?r.getElementsByTagName("*").length:0}}),!0},null,this)),{stop:function(){l=!1,u&&(clearInterval(u),u=!1),s&&s.observer&&(s.observer.disconnect(),s=null),d&&d.onlevelchange&&(d.onlevelchange=null),f=null}}};e={monitorLongTasks:!0,monitorPageBusy:!0,monitorFrameRate:!0,monitorInteractions:!0,monitorStats:!1,monitorLayoutShifts:!0,afterOnload:!1,afterOnloadMaxLength:6e4,afterOnloadMinWait:5e3,waitAfterOnload:!1,ttiWaitForFrameworkReady:!1,ttiWaitForHeroImages:!1,ttiWaitForXHRDone:!1,ttiWaitForXHRIgnore:[],sendLog:!0,sendTimeline:!0,logMaxEntries:100,initialized:!1,complete:!1,isSpa:!1,firedPageReady:!1,afterOnloadMonitoring:!1,frameworkReady:null,timeline:null,ttiMethod:null,longTaskMonitor:null,pageBusyMonitor:null,frameRateMonitor:null,interactionMonitor:null,scrollMonitor:null,clickMonitor:null,keyMonitor:null,mouseMonitor:null,visibilityMonitor:null,orientationMonitor:null,touchStartMonitor:null,mouseDownMonitor:null,pointerDownMonitor:null,statsMonitor:null,layoutShiftMonitor:null,monitors:["timeline","longTaskMonitor","pageBusyMonitor","frameRateMonitor","scrollMonitor","keyMonitor","clickMonitor","mouseMonitor","interactionMonitor","visibilityMonitor","orientationMonitor","statsMonitor","layoutShiftMonitor","touchStartMonitor","mouseDownMonitor","pointerDownMonitor"],timeOfLastBeacon:0,hasAddedDataToBeacon:!1,hasAddedTtinewToBeacon:void 0,isSafari:window&&window.navigator&&window.navigator.vendor&&-1!==window.navigator.vendor.indexOf("Apple"),onBeforeBeacon:function(){e.runAllAnalyzers()},checkIfSendAdditionalBeacon:function(){if(!1===e.hasAddedTtinewToBeacon&&BOOMR.hasPending()){var n=e.timeline.analyzeXHRDone(!0);BOOMR.sendAdditionalBeacon(n>0?{"c.tti.new":n,add:1}:{"c.tti.new":void 0,add:2})}},runAllAnalyzers:function(){var n,r;if(!e.hasAddedDataToBeacon){for(n=0;n<e.monitors.length;n++)(r=e[e.monitors[n]])&&"function"==typeof r.analyze&&r.analyze(e.timeOfLastBeacon);e.addToBeacon("c.lb",e.timeOfLastBeacon?e.timeOfLastBeacon.toString(36):0),e.timeOfLastBeacon=BOOMR.now(),e.hasAddedDataToBeacon=!0}},onBeacon:function(n){var r;if(!n||void 0===n.early&&(!n["http.initiator"]||0!==n["http.initiator"].indexOf("api_custom_"))){for(r=0;r<e.monitors.length;r++){var i=e[e.monitors[r]];i&&(e.afterOnload||"function"!=typeof i.stop||i.stop(),"function"==typeof i.onBeacon&&i.onBeacon())}e.hasAddedDataToBeacon=!1,n&&n.add&&(e.hasAddedTtinewToBeacon=void 0)}},onXhrLoad:function(n){n&&BOOMR.utils.inArray(n.initiator,BOOMR.constants.BEACON_TYPE_SPAS)&&(e.isSpa=!0),n&&"spa_hard"===n.initiator&&e.onPageReady()},onPageReady:function(){if(e.firedPageReady=!0,e.afterOnload&&e.monitorInteractions&&(e.afterOnloadMonitoring=!0,e.isSpa||"number"!=typeof e.afterOnloadMaxLength||setTimeout(function(){e.afterOnloadMonitoring=!1},e.afterOnloadMaxLength)),e.waitAfterOnload){var n=BOOMR.now();setTimeout(function r(){BOOMR.now()-n>e.waitAfterOnload?(e.complete=!0,BOOMR.sendBeacon()):(e.timeline.analyze(),(e.ttiWaitForXHRDone?BOOMR.getVar("c.tti.new"):l.timeToInteractive())?(e.complete=!0,BOOMR.sendBeacon()):setTimeout(r,500))},500)}else e.complete=!0},addToBeacon:function(e,n,r){if((0===n||void 0===n)&&!r)return void BOOMR.removeVar(e);BOOMR.addVar(e,n,!0)}},BOOMR.plugins.Continuity={init:function(n){if(BOOMR.utils.pluginConfig(e,n,"Continuity",["monitorLongTasks","monitorPageBusy","monitorFrameRate","monitorInteractions","monitorStats","afterOnload","afterOnloadMaxLength","afterOnloadMinWait","waitAfterOnload","ttiWaitForFrameworkReady","ttiWaitForHeroImages","ttiWaitForXHRDone","ttiWaitForXHRIgnore","sendLog","logMaxEntries","sendTimeline"]),e.initialized)return this;if(e.initialized=!0,e.timeline=new d(BOOMR.now()),BOOMR.window){if(e.monitorLongTasks&&BOOMR.window.PerformanceObserver&&BOOMR.window.PerformanceLongTaskTiming&&(e.longTaskMonitor=new h(BOOMR.window,e.timeline),e.ttiMethod="lt"),e.monitorFrameRate&&"function"==typeof BOOMR.window.requestAnimationFrame&&(e.frameRateMonitor=new m(BOOMR.window,e.timeline),e.ttiMethod||(e.ttiMethod="raf")),!e.monitorPageBusy||BOOMR.window.PerformanceObserver&&BOOMR.window.PerformanceLongTaskTiming&&e.monitorLongTasks||(e.pageBusyMonitor=new f(BOOMR.window,e.timeline),e.ttiMethod||(e.ttiMethod="b")),e.monitorInteractions){var r=BOOMR.window;e.interactionMonitor=new _(r,e.timeline,e.afterOnloadMinWait),e.scrollMonitor=new g(r,e.timeline,e.interactionMonitor),e.keyMonitor=new y(r,e.timeline,e.interactionMonitor),e.clickMonitor=new v(r,e.timeline,e.interactionMonitor),e.mouseMonitor=new b(r,e.timeline,e.interactionMonitor),e.visibilityMonitor=new S(r,e.timeline,e.interactionMonitor),e.orientationMonitor=new E(r,e.timeline,e.interactionMonitor),e.touchStartMonitor=new R(r,e.timeline,e.interactionMonitor),e.mouseDownMonitor=new O(r,e.timeline,e.interactionMonitor),e.pointerDownMonitor=new w(r,e.timeline,e.interactionMonitor)}e.monitorStats&&(e.statsMonitor=new T(BOOMR.window,e.timeline,e.interactionMonitor)),e.monitorLayoutShifts&&BOOMR.window.PerformanceObserver&&(e.layoutShiftMonitor=new p(BOOMR.window))}return BOOMR.addVar("c.e",u.toString(36)),BOOMR.addVar("c.tti.m",e.ttiMethod),BOOMR.subscribe("before_beacon",e.onBeforeBeacon,null,e),BOOMR.subscribe("beacon",e.onBeacon,null,e),BOOMR.subscribe("page_ready",e.onPageReady,null,e),BOOMR.subscribe("xhr_load",e.onXhrLoad,null,e),BOOMR.subscribe("route_change",e.checkIfSendAdditionalBeacon,null,e),this},is_complete:function(n){return e.complete||n&&("error"===n["http.initiator"]||void 0!==n.early)},frameworkReady:function(){e.frameworkReady=BOOMR.now()},getTtiWaitForXHRDone:function(){return e.ttiWaitForXHRDone},getTTIWaitForXHRIngore:function(){return"function"==typeof e.ttiWaitForXHRIgnore?e.ttiWaitForXHRIgnore():e.ttiWaitForXHRIgnore},checkIfSendAdditionalBeacon:e.checkIfSendAdditionalBeacon,metrics:l,compressBucketLog:M,decompressBucketLog:function(e,o){var a,c,l,u,d,p,h=[],f=o||0;if(!e||0===e.length)return[];for(a=0,p=parseInt(e.charAt(0),10),e=e.substring(1),u=1;a<e.length;a++){if("*"===e.charAt(a)){a++,l=e.indexOf("*",a),u=parseInt(e.substring(a,l),36),a=l;continue}for(e.charAt(a)===s?(a++,l=e.indexOf(s,a),d=parseInt(e.substring(a,l),36),a=l):p===n?d=x(e.charAt(a)):p===r?-1!==(l=e.indexOf(",",a))?(d=parseInt(e.substring(a,l),36),a=l):(d=parseInt(e.substring(a),36),a=e.length):p===i&&(d="__"===e.substr(a,2)?100:parseInt(e.substr(a,2),10),a++),c=1,h[f]=d;c<u;c++)h[++f]=d;f++,u=1}return h},decompressBucketLogNumber:x,decompressLog:function(e){var n,r,i,o,s,a=[];for(n=0,o=e.split("|");n<o.length;n++){for(r=1,s={type:parseInt((i=o[n].split(","))[0].charAt(0),10),time:parseInt(i[0].substring(1),36)};r<i.length;r++)s[i[r].charAt(0)]=i[r].substring(1);a.push(s)}return a}}}function M(e,a,c,l,u){var d,p,h,f,m,g="",v=0;if(!c||0===c.length)return"";if(a)for(void 0===c[l]&&(c[l]=0),d=l+1;d<=u;d++)void 0===c[d]&&(c[d]=c[d-1]);for(d=l;d<=u;d++){if(v="number"!=typeof c[d]||isNaN(c[d])?0:c[d],e===n?h=v<=63?o.charAt(v):s+v.toString(36)+s:e===r?h=v.toString(36):e===i&&(h=v<99?v<=9?"0"+Math.max(v,0):v:"__"),d+3<=u&&(c[d+1]===v||0===v&&void 0===c[d+1])&&(c[d+2]===v||0===v&&void 0===c[d+2])&&(c[d+3]===v||0===v&&void 0===c[d+3])){for(p=1;d<u&&(c[d+1]===v||0===v&&void 0===c[d+1]);)p++,d++;f="*"+p.toString(36)+"*"+h}else f=h;(0!==v||d!==u)&&(e===r&&m&&(g+=","),m=!0,g+=f)}return m?e.toString()+g:""}function x(e){if(!e||!e.charCodeAt)return 0;var n=e.charCodeAt(0);if(n>=48&&n<=57)return n-48;if(n>=97&&n<=122)return n-97+10;if(n>=65&&n<=90)return n-65+36;if(95===n)return 62;if(45===n)return 63;else return 0}}(),!function(){var e,n,r,i,o,s=["uninitialized","open","responseStart","domInteractive","responseEnd"];function l(e){if(!e)return null;e.href=e.href;var n=e.pathname;return"/"!==n.charAt(0)&&(n="/"+n),n}function u(e){var n;if(e.href&&(e.href.match(/^(about:|javascript:|data:)/i)||"function"==typeof BOOMR.getBeaconURL&&BOOMR.getBeaconURL()&&(0===(n=e.href.indexOf(BOOMR.getBeaconURL()))||5===n||6===n)))return!0;return BOOMR.xhr_excludes.hasOwnProperty(e.href)||BOOMR.xhr_excludes.hasOwnProperty(e.hostname)||BOOMR.xhr_excludes.hasOwnProperty(l(e))}function d(){this.watch=0,this.timer=null,this.timerEarlyBeacon=null,this.checkTimer=null,this.pending_events=[],this.lastSpaLocation=null}function p(e,n){var r,i;if(!n||!e)return!1;if("boolean"==typeof n)return!0===n;if("function"==typeof n)try{return!0===n(e)}catch(e){return!1}if(BOOMR.utils.isArray(n)){for(r=0;r<n.length;r++)if("string"==typeof(i=n[r])&&i===e||i instanceof RegExp&&i.test(e))return!0}return!1}function h(){if(o.monitorFetch&&"function"==typeof e.fetch&&"function"==typeof e.Request&&"function"==typeof e.Response&&"function"==typeof e.Promise&&"function"==typeof window.fetch&&!e.fetch.polyfill&&(!BOOMR.proxy_fetch||BOOMR.proxy_fetch!==e.fetch)){if(BOOMR.proxy_fetch&&BOOMR.orig_fetch&&BOOMR.orig_fetch===e.fetch){e.fetch=BOOMR.proxy_fetch;return}BOOMR.orig_fetch=e.orig_fetch||e.fetch,BOOMR.proxy_fetch=function(n,s){var a,c,l,u={timing:{},initiator:"xhr"};if("object"==typeof n&&n instanceof e.Request?(a=n.url,c=s&&s.method||n.method||"GET",o.captureXhrRequestResponse&&(l=s&&s.body||n.body||void 0)):(a=n,c=s&&s.method||"GET",o.captureXhrRequestResponse&&(l=s&&s.body||void 0)),i.href=a,o.xhrExcludeFilter(i))return BOOMR.orig_fetch.apply(e,arguments);BOOMR.fireEvent("xhr_init","fetch"),u.url=i.href,u.method=c,u.type="fetch",l&&(u.requestPayload=l),BOOMR.fireEvent("xhr_send",{resource:u}),r.addEvent(u);try{u.timing.requestStart||(u.timing.requestStart=BOOMR.now());var d=BOOMR.orig_fetch.apply(this,arguments);function p(n,r,i){function s(){var e;i.fetchResponse&&!i.fetchResponse.bodyUsed&&o.fetchBodyUsedWait?(e=BOOMR.now(),i.responseBodyNotUsed=!0,setTimeout(function(){o.loadFinished(i,e)},o.fetchBodyUsedWait)):o.loadFinished(i)}return function(){var o,a=n._bmrNextP;try{for(o=r.apply(this===window?e:this,arguments);a&&!a._bmrHasOnFulfilled;)a=a._bmrNextP;return a||(o instanceof e.Promise?o.then=h(o,o.then,i):s()),o}catch(e){for(;a&&!a._bmrHasOnRejected;)a=a._bmrNextP;throw a||s(),e}}}function h(e,n,r){return e._bmrNextP?n:function(){var i=Array.prototype.slice.call(arguments);i.length>0&&("function"==typeof i[0]&&(i[0]=p(e,i[0],r),e._bmrHasOnFulfilled=!0),i.length>1&&"function"==typeof i[1]&&(i[1]=p(e,i[1],r),e._bmrHasOnRejected=!0));var o=n.apply(e,i);return e._bmrNextP=o,o.then=h(o,o.then,r),o}}return d.then=h(d,d.then,u),d.then(function(n){var i,s,a=!1,c=!1;if(n.redirected&&(u.responseUrl=n.url),(n.status<200||n.status>=400)&&(u.status=n.status),u.fetchResponse=n,u.index>=0&&r.monitorMO(u.index),o.captureXhrRequestResponse&&"function"==typeof n.clone){(s=n.headers.get("content-type"))&&(a=-1!==s.indexOf("json"),c=-1!==s.indexOf("xml")),u.response={};try{n.clone().text().then(function(n){u.response.text=n,u.response.raw=n,c&&"function"==typeof e.DOMParser&&(u.response.xml=new e.DOMParser().parseFromString(n,"text/xml"))}).then(null,function(e){})}catch(e){}if(a)try{n.clone().json().then(function(e){u.response.json=e}).then(null,function(e){})}catch(e){}}return n},function(e){throw e&&("AbortError"===e.name||20===e.code)?u.status=-999:u.status=-998,e})}catch(e){throw u.status=-997,o.loadFinished(u),e}},BOOMR.utils.overwriteNative(e,"fetch",BOOMR.proxy_fetch)}}function f(){"function"==typeof e.fetch&&BOOMR.orig_fetch&&BOOMR.orig_fetch!==e.fetch&&(e.fetch=BOOMR.orig_fetch)}function m(){if(!BOOMR.proxy_XMLHttpRequest||BOOMR.proxy_XMLHttpRequest!==e.XMLHttpRequest){if(BOOMR.proxy_XMLHttpRequest&&BOOMR.orig_XMLHttpRequest&&BOOMR.orig_XMLHttpRequest===e.XMLHttpRequest){e.XMLHttpRequest=BOOMR.proxy_XMLHttpRequest,d.start();return}BOOMR.orig_XMLHttpRequest=e.orig_XMLHttpRequest||e.XMLHttpRequest,d.start(),BOOMR.subscribe("click",function(){if(!o.singlePageApp||o.spaStartFromClick){var n={timing:{},initiator:"click"};BOOMR.orig_XMLHttpRequest&&BOOMR.orig_XMLHttpRequest!==e.XMLHttpRequest&&(n.timing.requestStart=BOOMR.now(),r.addEvent(n))}}),BOOMR.proxy_XMLHttpRequest=function(){var n,a,c,l={timing:{},initiator:"xhr"},u=!1,d=!1;return a=(n=new BOOMR.orig_XMLHttpRequest).open,c=n.send,n.open=function(r,c,p){if(i.href=c,o.xhrExcludeFilter(i))return d=!0,a.apply(n,arguments);function h(r,i){n.addEventListener(r,function(){if("readystatechange"===r)if(l.timing[s[n.readyState]]=BOOMR.now(),4===n.readyState&&0!==n.status){if(n.responseURL!==l.url&&(l.responseUrl=n.responseURL),(n.status<200||n.status>=400)&&(l.status=n.status),o.captureXhrRequestResponse&&(l.response={text:""===n.responseType||"text"===n.responseType?n.responseText:null,xml:""===n.responseType||"document"===n.responseType?n.responseXML:null,raw:n.response,json:n.responseJSON},n.response&&n.response.constructor&&n.response.constructor===BOOMR.boomerang_frame.Object&&BOOMR.boomerang_frame.Object!==e.Object))try{n.response.constructor=e.Object}catch(e){}o.loadFinished(l)}else 0===n.readyState&&"number"==typeof l.timing.open&&(n.responseURL!==l.url&&(l.responseUrl=n.responseURL),l.status=-999,o.loadFinished(l));else n.responseURL!==l.url&&(l.responseUrl=n.responseURL),"load"===r?0!==n.status&&(n.status<200||n.status>=400)&&(l.status=n.status):l.status=void 0===i?n.status:i,o.loadFinished(l)},!1)}d=!1,void 0===p&&(p=!0),BOOMR.fireEvent("xhr_init","xhr"),u||(p&&h("readystatechange"),h("load"),h("timeout",-1001),h("error",-998),h("abort",-999)),l.url=i.href,l.method=r,l.type="xhr",delete l.status,p||(l.synchronous=!0),u=!0;try{return a.apply(n,arguments)}catch(e){throw l.status=-997,o.loadFinished(l),e}},n.send=function(e){return d||(o.captureXhrRequestResponse&&(n.resource.requestPayload=e),BOOMR.fireEvent("xhr_send",n),r.addEvent(l),l.timing.requestStart||(l.timing.requestStart=BOOMR.now()),void 0===l.status||-997!==l.status)?c.apply(n,arguments):void 0},n.resource=l,n},BOOMR.proxy_XMLHttpRequest.UNSENT=0,BOOMR.proxy_XMLHttpRequest.OPENED=1,BOOMR.proxy_XMLHttpRequest.HEADERS_RECEIVED=2,BOOMR.proxy_XMLHttpRequest.LOADING=3,BOOMR.proxy_XMLHttpRequest.DONE=4,BOOMR.proxy_XMLHttpRequest.prototype=BOOMR.orig_XMLHttpRequest.prototype,BOOMR.utils.overwriteNative(e,"XMLHttpRequest",BOOMR.proxy_XMLHttpRequest)}}function g(){BOOMR.orig_XMLHttpRequest&&BOOMR.orig_XMLHttpRequest!==e.XMLHttpRequest&&(e.XMLHttpRequest=BOOMR.orig_XMLHttpRequest)}function v(e){e.initiator="xhr",BOOMR.responseEnd(e)}!BOOMR.plugins.AutoXHR&&(e=BOOMR.window)&&e.XMLHttpRequest&&new e.XMLHttpRequest().addEventListener&&(d.stop=function(){d.pause(),d.observer=null},d.pause=function(){d.observer&&d.observer.observer&&!d.isPaused&&(d.isPaused=!0,d.observer.observer.disconnect())},d.resume=function(){d.observer&&d.observer.observer&&d.isPaused&&(d.isPaused=!1,d.observer.observer.observe(n,d.observer.config))},d.start=function(){if(!d.observer){var e={childList:!0,attributes:!0,subtree:!0,attributeFilter:["src","href"]};d.observer=BOOMR.utils.addObserver(n,e,null,r.mutation_cb,null,r),d.observer&&(d.observer.config=e,BOOMR.subscribe("page_unload",d.stop,null,d))}},d.prototype.addEvent=function(e){if(BOOMR.plugins.SPA&&BOOMR.plugins.SPA.get_ready()||BOOMR.utils.inArray(e.initiator,BOOMR.constants.BEACON_TYPE_SPAS)){var n,i,s,l={type:e.initiator,resource:e,nodes_to_wait:0,total_nodes:0,resources:[],xhr_resources:[],complete:!1,aborted:!1,firedEarlyBeacon:!1},u=this.pending_events.length,p=this;for(n=u-1;n>=0;n--)if(this.pending_events[n]&&!this.pending_events[n].complete){i=this.pending_events[n],s=n;break}if(i){if("click"===i.type&&o.singlePageApp&&o.spaStartFromClick&&"xhr"===l.type)l.resource.fromClick=!0,l.resource.timing.click=i.resource.timing.requestStart,l.resource.timing.requestStart=i.resource.timing.requestStart,l.interesting=i.interesting||0,l.total_nodes+=i.total_nodes,l.resources=i.resources.concat(l.resources),l.xhr_resources=i.xhr_resources.concat(l.xhr_resources),this.pending_events[s]=void 0,this.watch--;else if(("click"===i.type||i.resource.fromClick)&&o.singlePageApp&&o.spaStartFromClick&&"spa"===l.type)l.resource.timing=i.resource.timing,l.interesting=i.interesting||0,l.total_nodes+=i.total_nodes,l.resources=i.resources.concat(l.resources),i.resource.url&&l.xhr_resources.push(i.resource.url),l.xhr_resources=l.xhr_resources.concat(i.xhr_resources),this.pending_events[s]=void 0,this.watch--;else if("click"===i.type)(0===i.nodes_to_wait||!i.resource.url)&&(this.pending_events[s]=void 0,this.watch--);else if("xhr"===i.type){if("click"===l.type)return null;else if("xhr"===l.type)return r.add_event_resource(e),null}else if(BOOMR.utils.inArray(i.type,BOOMR.constants.BEACON_TYPE_SPAS)){if("xhr"===l.type)return r.add_event_resource(e),null;if("click"===l.type)return i.resource.lastClick=l.resource.timing.requestStart,null;if(BOOMR.utils.inArray(l.type,BOOMR.constants.BEACON_TYPE_SPAS)){var h=l.resource.timing.requestStart-i.resource.timing.requestStart;"spa_hard"!==i.type&&c(i.resource,l.resource)&&h<500?(this.pending_events[s]=void 0,this.watch--):(i.resource.timing.loadEventEnd=BOOMR.now(),i.aborted=!0,this.sendEvent(s))}}}if("click"===l.type){if(!d.observer)return null;this.setTimeout(o.xhrIdleTimeout,u)}else if("xhr"===l.type){if(a(o.ignoreXhrs,e.url))return null;l.nodes_to_wait++,l.total_nodes++,l.ignoreMO=!0}else BOOMR.utils.inArray(l.type,BOOMR.constants.BEACON_TYPE_SPAS)&&(d.start(),e.wait?(l.nodes_to_wait++,l.total_nodes++,e.waitComplete=function(){p.load_finished(u),e.waitComplete=void 0}):this.setTimeout(o.spaIdleTimeout,u));return this.watch++,this.pending_events.push(l),e.index=u,u}},d.prototype.sendEvent=function(e){var r=this.pending_events[e],i=this;if(BOOMR.now(),r&&!r.complete)if(this.clearTimeout(e),BOOMR.readyToSend()){if(r.complete=!0,r.resource.complete=!0,this.watch--,BOOMR.utils.inArray(r.type,BOOMR.constants.BEACON_TYPE_SPAS)&&(r.resource.url=n.URL),"spa"===r.type&&0===r.total_nodes&&r.resource.url===i.lastSpaLocation){BOOMR.fireEvent("spa_cancel"),this.pending_events[e]=void 0;return}if("click"===r.type&&(0===r.total_nodes||!r.resource.url)||("click"===r.type&&o.singlePageApp&&o.spaStartFromClick&&(r.type=r.resource.initiator="xhr"),o.xhrRequireChanges&&"xhr"===r.type&&1===r.total_nodes&&(void 0===r.interesting||0===r.interesting)&&!p(r.resource.url,o.alwaysSendXhr))){this.pending_events[e]=void 0;return}if(BOOMR.utils.inArray(r.type,BOOMR.constants.BEACON_TYPE_SPAS)&&(i.lastSpaLocation=r.resource.url,!r.forced)&&("spa"===r.type&&0===r.total_nodes&&(r.resource.timing.loadEventEnd=r.resource.timing.requestStart+1),"spa_hard"===r.type)){var s=BOOMR.getPerformance();s&&s.timing&&s.timing.loadEventEnd&&r.resource.timing.loadEventEnd&&r.resource.timing.loadEventEnd<s.timing.loadEventEnd&&(r.resource.timing.loadEventEnd=s.timing.loadEventEnd)}this.sendResource(r.resource,e)}else setTimeout(function(){i.sendEvent(e)},500)},d.prototype.sendResource=function(r,i){var o=this,s=o.pending_events[i],a=r.timing?r.timing.requestStart:void 0,c=function(e,s){e&&(r.timing.loadEventEnd=s||BOOMR.now()),BOOMR.real_sendBeacon(),r.onComplete&&r.onComplete(r),BOOMR.plugins.ResourceTiming&&BOOMR.plugins.ResourceTiming.is_enabled()&&r.timing&&r.timing.requestStart&&(r.restiming=BOOMR.plugins.ResourceTiming.getCompressedResourceTiming(r.timing.requestStart,r.timing.loadEventEnd)),BOOMR.utils.inArray(r.initiator,BOOMR.constants.BEACON_TYPE_SPAS)&&(o.calculateSpaTimings(r),"number"==typeof i&&o.pending_events[i].aborted&&(BOOMR.addVar("pgu",n.URL,!0),BOOMR.addVar("rt.quit","",!0),BOOMR.addVar("rt.abld","",!0))),BOOMR.responseEnd(r,a,r),"number"==typeof i&&(o.pending_events[i]=void 0)};if("spa_hard"===r.initiator&&(!s||!s.aborted)&&!BOOMR.hasBrowserOnloadFired())return void BOOMR.utils.addListener(e,"load",function(){var e=BOOMR.now();BOOMR.setImmediate(function(){c(!0,e)})});c(!1)},d.prototype.calculateSpaTimings=function(e){var n=BOOMR.getPerformance();if(n&&n.timing){if("spa_hard"===e.initiator)e.timing.responseEnd=n.timing.responseStart,e.timing.fetchStart=n.timing.navigationStart;else{if(!BOOMR.plugins.ResourceTiming||!BOOMR.plugins.ResourceTiming.is_supported())return;var r=BOOMR.plugins.ResourceTiming.getFilteredResourceTiming(e.timing.requestStart,e.timing.loadEventEnd,o.spaBackEndResources).entries,i=Math.round(e.timing.loadEventEnd-e.timing.requestStart);if(!r||!r.length){BOOMR.addVar("noresources",1,!0),e.timers={t_resp:0,t_page:i,t_done:i};return}for(var s=e.timing.loadEventEnd-n.timing.navigationStart,c=0;c<r.length;c++)r[c].responseStart>s?(r[c].responseStart=s,r[c].responseEnd=s):r[c].responseEnd>s&&(r[c].responseEnd=s);var l=Math.round(BOOMR.plugins.ResourceTiming.calculateResourceTimingUnion(r)),u=i-l;if(l<0||i<0||u<0)return void BOOMR.addError("Incorrect SPA time calculation");BOOMR.addVar("t_resp_calc",l,!0),BOOMR.addVar("resourceLength",r.length,!0),e.timers={t_resp:l,t_page:u,t_done:i}}var d=BOOMR.plugins.ResourceTiming.getFilteredResourceTiming(e.timing.requestStart,e.timing.loadEventEnd,["xmlhttprequest","fetch"]).entries,p=BOOMR.plugins.Continuity.getTTIWaitForXHRIngore();d=d.filter(function(e){return!a(p,e.name)});var h=e.timing.requestStart-n.timing.navigationStart,s=d.reduce(function(e,n){return n.responseEnd>e?n.responseEnd:e},h);"spa"===e.initiator&&(BOOMR.addVar("c.tti.xd.increasing",s),s-=h,BOOMR.addVar("spa.calcttixd",1,!0)),BOOMR.addVar("c.tti.xd",s)}},d.prototype.setTimeout=function(e,n){var r=this;e&&(this.clearTimeout(n),this.timer=setTimeout(function(){r.timedout(n)},e))},d.prototype.timedout=function(e){var n;if(this.clearTimeout(e),n=this.pending_events[e]){if(BOOMR.utils.inArray(n.type,BOOMR.constants.BEACON_TYPE_SPAS)&&!BOOMR.hasBrowserOnloadFired())return void this.setTimeout(o.spaIdleTimeout,e);0===n.nodes_to_wait&&this.sendEvent(e)}},d.prototype.clearTimeout=function(e){this.timer&&e===this.pending_events.length-1&&(clearTimeout(this.timer),this.timer=null)},d.prototype.load_cb=function(e,n){var r,i,o=BOOMR.now();(r=e.target||e.srcElement)&&r._bmr&&(i=r._bmr.idx,n=void 0!==n?n:r._bmr.res||0,r._bmr.end[n]||(r._bmr.end[n]=o,this.load_finished(i,o)))},d.prototype.monitorMO=function(e){var n=this.pending_events[e];n&&delete n.ignoreMO},d.prototype.load_finished=function(e,n){var i=this.pending_events[e];if(i){if(i.nodes_to_wait--,0===i.nodes_to_wait)this.checkTimer&&clearTimeout(this.checkTimer),this.checkTimer=null,i.resource.timing.loadEventEnd=n||BOOMR.now(),e===this.pending_events.length-1?BOOMR.utils.inArray(i.type,BOOMR.constants.BEACON_TYPE_SPAS)?(!i.firedEarlyBeacon&&BOOMR.plugins.Early&&BOOMR.plugins.Early.is_supported()&&(this.timerEarlyBeacon&&(clearTimeout(this.timerEarlyBeacon),this.timerEarlyBeacon=null),this.timerEarlyBeacon=setTimeout(function(){r.timerEarlyBeacon=null,i.firedEarlyBeacon||0!==i.nodes_to_wait||(i.firedEarlyBeacon=!0,BOOMR.plugins.Early.sendEarlyBeacon(i.resource,i.type))},100)),this.setTimeout(o.spaIdleTimeout,e)):this.setTimeout(o.xhrIdleTimeout,e):this.sendEvent(e);else if(!this.checkTimer&&BOOMR.utils.inArray(i.type,BOOMR.constants.BEACON_TYPE_SPAS)){var s=this;this.checkTimer=setTimeout(function(){0!==i.nodes_to_wait&&i.resources.forEach(function(r){var i=r._bmr,o=i.res||0;try{!i.end[o]&&("LINK"===i.type&&r.sheet||("IMG"===i.type||"IMAGE"===i.type)&&r.complete)&&(i.end[o]=n,s.load_finished(e,n))}catch(e){}}),s.checkTimer=null},500)}}},d.prototype.wait_for_node=function(e,n){var r,s,a,c,l,u,d,p,h,f=this,m=!1,g=!1;if(e&&e.nodeName&&(!o.ignoreImage&&e.nodeName.toUpperCase().match(/^(IMG|IMAGE)$/)||e.nodeName.toUpperCase().match(/^IFRAME$/)||"LINK"===e.nodeName.toUpperCase()&&e.rel&&e.rel.match(/\bstylesheet\b/i))){if(e._bmr&&"number"==typeof e._bmr.res&&e._bmr.end[e._bmr.res]&&(g=!0),l=e.src||"function"==typeof e.getAttribute&&(e.getAttribute("xlink:href")||e.getAttribute("href"))||e.href,e._bmr&&e._bmr.url!==l&&(g=!0),g&&"function"==typeof e._bmr.listener&&(f.load_cb({target:e,type:"changed"}),e.removeEventListener("load",e._bmr.listener),e.removeEventListener("error",e._bmr.listener),delete e._bmr.listener),!l||l.match(/^(about:|javascript:|data:)/i))return!1;if("IMG"===e.nodeName){if(e.naturalWidth&&!g)return!1;else if("function"==typeof e.getAttribute&&""===e.getAttribute("src"))return!1;else if("lazy"===e.loading)return!1}if("IFRAME"===e.nodeName&&g||("function"==typeof e.getAttribute&&(d=parseInt(e.getAttribute("height"),10),p=parseInt(e.getAttribute("width"),10)),isNaN(d)&&(d=e.style&&("0"===e.style.height||"0px"===e.style.height||"1px"===e.style.height)?0:void 0),isNaN(p)&&(p=e.style&&("0"===e.style.width||"0px"===e.style.width||"1px"===e.style.width)?0:void 0),!isNaN(d)&&d<=1&&!isNaN(p)&&p<=1||0===d||0===p||e.style&&("none"===e.style.display||"hidden"===e.style.visibility||"0"===e.style.opacity)||o.domExcludeFilter(e)||!(r=this.pending_events[n]))||(u=r.resources.length,r.urls||(r.urls={}),r.urls[l]))return!1;if(!r.resource.url){if(i.href=l,o.xhrExcludeFilter(i))return!1;r.resource.url=i.href}e._bmr||(e._bmr={end:{},type:e.nodeName.toUpperCase()}),e._bmr.res=u,e._bmr.idx=n,delete e._bmr.end[u],e._bmr.url=l,h=function(n){f.load_cb(n,u),e.removeEventListener("load",h),e.removeEventListener("error",h),delete e._bmr.listener},e._bmr.listener=h,e.addEventListener("load",h),e.addEventListener("error",h),r.nodes_to_wait++,this.clearTimeout(n),r.total_nodes++,r.resources.push(e),r.urls[l]=1,m=!0}else e.nodeType===Node.ELEMENT_NODE&&["IMAGE","IMG"].forEach(function(r){if((s=e.getElementsByTagName(r))&&s.length)for(a=0,c=s.length;a<c;a++)m|=this.wait_for_node(s[a],n)},this);return m},d.prototype.add_event_resource=function(e){var n,r=this.pending_events.length-1;return!(r<0)&&(n=this.pending_events[r])&&e?(n.xhr_resources.push(e.url),n.nodes_to_wait++,n.total_nodes++,e.index=r,e.node=!0,r):-1},d.prototype.mutation_cb=function(e){var n,r,i;return!this.watch||(n=this,(r=this.pending_events.length-1)<0||!this.pending_events[r]||!!(i=this.pending_events[r]).ignoreMO||(void 0===i.interesting&&(i.interesting=!1),e&&e.length&&(i.resource.timing.domComplete=BOOMR.now(),e.forEach(function(e){var o,s,a;if("attributes"===e.type)i.interesting|=n.wait_for_node(e.target,r);else if("childList"===e.type){for(o=0,s=e.addedNodes.length;o<s;o++)i.interesting|=n.wait_for_node(e.addedNodes[o],r);for(o=0,s=e.removedNodes.length;o<s;o++)"IFRAME"===(a=e.removedNodes[o]).nodeName&&a._bmr&&n.load_cb({target:a,type:"removed"})}})),i.interesting||i.timeoutExtended||(this.setTimeout(1e3,r),i.timeoutExtended=!0),!0))},d.prototype.queue_is_empty=function(){return 0===this.nodesWaitingFor()},d.prototype.nodesWaitingFor=function(e){var n;return 0===this.pending_events.length?0:(void 0===e&&(e=this.pending_events.length-1),n=this.pending_events[e])?n.nodes_to_wait:0},d.prototype.completeEvent=function(e){var n,r=BOOMR.now();0!==this.pending_events.length&&(void 0===e&&(e=this.pending_events.length-1),(n=this.pending_events[e])&&(n.resource.timing.loadEventEnd=r,n.forced=!0,this.sendEvent(e)))},r=new d,o={spaBackEndResources:["xmlhttprequest","script","fetch"],alwaysSendXhr:!1,xhrExcludeFilters:[],domExcludeFilters:[],initialized:!1,captureXhrRequestResponse:!1,singlePageApp:!1,spaStartFromClick:!1,autoXhrEnabled:!1,monitorFetch:!1,fetchBodyUsedWait:200,spaIdleTimeout:1e3,xhrIdleTimeout:50,xhrRequireChanges:!1,ignoreImage:!1,xhrExcludeFilter:function(e){var n,r;if(!e||!e.href)return!1;for(n=0;n<o.xhrExcludeFilters.length;n++)if("function"==typeof o.xhrExcludeFilters[n].cb){r=o.xhrExcludeFilters[n].ctx;try{if(o.xhrExcludeFilters[n].cb.call(r,e))return!0}catch(e){BOOMR.addError(e,"BOOMR.plugins.AutoXHR.impl.xhrExcludeFilter()")}}return!1},domExcludeFilter:function(e){var n,r;for(n=0;n<o.domExcludeFilters.length;n++)if("function"==typeof o.domExcludeFilters[n].cb){r=o.domExcludeFilters[n].ctx,o.domExcludeFilters[n].name;try{if(o.domExcludeFilters[n].cb.call(r,e))return!0}catch(e){BOOMR.addError(e,"BOOMR.plugins.AutoXHR.impl.domExcludeFilter()")}}return!1},loadFinished:function(e,n){var i,s,a,c,l;n=n||BOOMR.now(),!e.timing.loadEventEnd&&(e.status&&BOOMR.fireEvent("xhr_error",e),e.timing.loadEventEnd=n,(l=BOOMR.getPerformance())&&l.timing&&(s=l.timing.navigationStart,(i=BOOMR.getResourceTiming(e.url,function(e,n){return e.responseEnd-n.responseEnd},function(n){return Math.ceil(s+n.startTime+2)>=e.timing.requestStart&&0!==n.responseEnd}))&&(a=Math.floor(s+i.startTime),(c=Math.floor(s+i.responseEnd))<=BOOMR.now()&&(e.timing.responseEnd=c,e.timing.loadEventEnd<c&&(e.timing.loadEventEnd=c),e.fromClick&&e.timing.requestStart||(e.timing.requestStart=a),e.timing.fetchStart=a,0!==i.responseStart&&(e.timing.responseStart=Math.floor(s+i.responseStart)),e.restiming=i))),e.node&&p(e.url,o.alwaysSendXhr)&&r.sendResource(e),e.index>=0&&(r.monitorMO(e.index),r.load_finished(e.index,e.timing.responseEnd)))}},BOOMR.plugins.AutoXHR={is_complete:function(){return!0},init:function(r){var s,a;if(n=e.document,e&&n){if(i=n.createElement("A"),BOOMR.utils.pluginConfig(o,r,"AutoXHR",["spaBackEndResources","alwaysSendXhr","monitorFetch","fetchBodyUsedWait","spaIdleTimeout","xhrIdleTimeout","xhrRequireChanges","spaStartFromClick"]),BOOMR.instrumentXHR=m,BOOMR.uninstrumentXHR=g,BOOMR.instrumentFetch=h,BOOMR.uninstrumentFetch=f,o.initialized||(this.addExcludeFilter(u,null,"shouldExcludeXhr"),o.initialized=!0),r&&r.AutoXHR&&r.AutoXHR.excludeFilters&&r.AutoXHR.excludeFilters.length>0)for(a=0;a<r.AutoXHR.excludeFilters.length;a++)"function"==typeof r.AutoXHR.excludeFilters[a]?o.xhrExcludeFilters.push({cb:r.AutoXHR.excludeFilters[a],ctx:this,name:"unknown XHR filter"}):o.xhrExcludeFilters.push(r.AutoXHR.excludeFilters[a]);if(r&&r.AutoXHR&&r.AutoXHR.domExcludeFilters&&r.AutoXHR.domExcludeFilters.length>0)for(a=0;a<r.AutoXHR.domExcludeFilters.length;a++)"function"==typeof r.AutoXHR.domExcludeFilters[a]?o.domExcludeFilters.push({cb:r.AutoXHR.domExcludeFilters[a],ctx:this,name:"unknown DOM filter"}):o.domExcludeFilters.push(r.AutoXHR.domExcludeFilters[a]);if(o.ignoreXhrs=r.ignoreXhrs,o.ignoreImage=r.ignoreImage,o.autoXhrEnabled=r.instrument_xhr,o.monitorFetch=r.monitor_fetch,o.singlePageApp=BOOMR.plugins.SPA&&BOOMR.plugins.SPA.isSinglePageApp(r),o.alwaysSendXhr&&o.autoXhrEnabled&&BOOMR.xhr&&"function"==typeof BOOMR.xhr.stop){function c(e){if(e.length)for(s=0;s<e.length;s++)v(e[s]);else v(e)}var l=BOOMR.xhr.stop(c);l&&l.length&&BOOMR.setImmediate(c,l)}o.singlePageApp?(o.alwaysSendXhr||(o.autoXhrEnabled=!1),o.autoXhrEnabled&&(BOOMR.instrumentXHR(),BOOMR.instrumentFetch())):o.autoXhrEnabled?(BOOMR.instrumentXHR(),BOOMR.instrumentFetch()):!1===o.autoXhrEnabled&&(BOOMR.uninstrumentXHR(),BOOMR.uninstrumentFetch()),BOOMR.registerEvent("xhr_error")}},getMutationHandler:function(){return r},getPathname:l,enableAutoXhr:function(){o.autoXhrEnabled||(BOOMR.instrumentXHR(),BOOMR.instrumentFetch()),o.autoXhrEnabled=!0},addExcludeFilter:function(e,n,r){o.xhrExcludeFilters.push({cb:e,ctx:n,name:r})},addDomExcludeFilter:function(e,n,r){o.domExcludeFilters.push({cb:e,ctx:n,name:r})},setXhrRequestResponseCapturing:function(e){o.captureXhrRequestResponse=e},matchesAlwaysSendXhr:p})}(),!function(){var e,n=!1,r=!1,i=!1,o=!1,s=!1,a=!0,l=!1,u=!1,d=[],p=!1;if(!BOOMR.plugins.SPA&&BOOMR.plugins.AutoXHR){var h={spaHardMissedOnComplete:function(e){var n,r,i=BOOMR.plugins.RT&&BOOMR.plugins.RT.navigationStart(),o=BOOMR.plugins.AutoXHR.getMutationHandler();p=!1,BOOMR.addVar("spa.missed","1",!0),BOOMR.plugins.RT&&BOOMR.plugins.RT.clearTimer("t_done"),e.timing.requestStart=i,(!(n=o.pending_events[e.index])||0===n.total_nodes)&&(r=BOOMR.getPerformance())&&r.timing&&r.timing.navigationStart&&r.timing.loadEventEnd&&void 0===e.timing.loadEventEnd&&(e.timing.loadEventEnd=r.timing.loadEventEnd)},pageReady:function(){o=!0}};BOOMR.plugins.SPA={is_complete:function(e){return!p||e&&("error"===e["http.initiator"]||void 0!==e.early)},get_ready:function(){return i},init:function(e){e&&e.instrument_xhr&&(s=e.instrument_xhr,i&&s&&BOOMR.plugins.AutoXHR.enableAutoXhr()),r||(r=!0,BOOMR.subscribe("page_ready",h.pageReady,null,h))},register:function(e){d.push(e)},supported_frameworks:function(){return d},onLoadSpaHardMissed:function(){i||(o=!0,s&&BOOMR.plugins.AutoXHR.enableAutoXhr(),p=!0,u?p=!1:BOOMR.plugins.SPA.route_change(h.spaHardMissedOnComplete))},hook:function(e,r){return"function"==typeof(r=r||{}).routeFilter&&(l=r.routeFilter),"function"==typeof r.routeChangeWaitFilter&&r.routeChangeWaitFilter,"boolean"==typeof r.routeChangeWaitFilterHardNavs&&r.routeChangeWaitFilterHardNavs,r.disableHardNav&&(u=r.disableHardNav),n||(e&&BOOMR.attach_page_ready(this.onLoadSpaHardMissed),n=!0),this},route_change:function(n,r){BOOMR.fireEvent("route_change");var d=!1,p=a&&!u?"spa_hard":"spa",h=BOOMR.plugins.RT&&BOOMR.plugins.RT.navigationStart(),f=o?BOOMR.now():h,m=BOOMR.window.document.URL,g={timing:{requestStart:f},initiator:p,url:m};if("spa"===p&&e&&!e.complete)try{if(!c(e,g))return}catch(e){BOOMR.addError(e,"SPA.route_change.routeChangeWaitFilter")}if("spa"===p&&l)try{if(!l.apply(null,r))return}catch(e){BOOMR.addError(e,"SPA.route_change.routeFilter")}i=!0,BOOMR.fireEvent("spa_init",[BOOMR.plugins.SPA.current_spa_nav(),m]),a=!1,o&&"function"!=typeof n||(o=!0,g.onComplete=function(e){d||(d=!0,BOOMR.fireEvent("spa_navigation")),"function"==typeof n&&n(e)}),e=g,g.index=BOOMR.plugins.AutoXHR.getMutationHandler().addEvent(g),s&&BOOMR.plugins.AutoXHR.enableAutoXhr()},last_location:function(e){lastLocationChange=e},current_spa_nav:function(){return o?"spa":"spa_hard"},wait_complete:function(){e&&(e.wait=!1,e.waitComplete&&e.waitComplete(),e=null)},markNavigationComplete:function(){var n,r,i=BOOMR.plugins.AutoXHR.getMutationHandler();if(e&&e.wait&&BOOMR.plugins.SPA.wait_complete(),i&&i.pending_events.length>0){for(n=i.pending_events.length-1;n>=0;n--)if((r=i.pending_events[n])&&BOOMR.utils.inArray(r.type,BOOMR.constants.BEACON_TYPE_SPAS)){if(r.complete)break;i.nodesWaitingFor(n),BOOMR.addVar("spa.forced","1",!0),BOOMR.addVar("spa.waiting",i.nodesWaitingFor(),!0),i.completeEvent(n);return}}},isSpaNavInProgress:function(){var e,n,r=BOOMR.plugins.AutoXHR.getMutationHandler();if(r&&r.pending_events.length>0){for(e=r.pending_events.length-1;e>=0;e--)if((n=r.pending_events[e])&&BOOMR.utils.inArray(n.type,BOOMR.constants.BEACON_TYPE_SPAS))return!n.complete}return!1},isSinglePageApp:function(e){for(var n=!1,r=this.supported_frameworks(),i=0;i<r.length;i++){var o=r[i];if(e[o]&&e[o].enabled){n=!0;break}}return n}},BOOMR.plugins.SPA.waitComplete=BOOMR.plugins.SPA.wait_complete}}(),e={auto:!1,enabled:!0,hooked:!1,routeHooked:!1,hadMissedRouteChange:!1,routeChangeInProgress:!1,disableHardNav:!1,routeFilter:void 0,routeChangeWaitFilter:void 0,monitorReplaceState:!0,a:void 0,originHistoryPushState:null,originHistoryReplaceState:null,originHistoryGo:null,originHistoryBack:null,originHistoryForward:null,resetRouteChangeInProgress:function(){e.routeChangeInProgress&&clearTimeout(e.routeChangeInProgress),e.routeChangeInProgress=!1},setRouteChangeInProgress:function(){e.routeChangeInProgress&&clearTimeout(e.routeChangeInProgress),e.routeChangeInProgress=setTimeout(e.resetRouteChangeInProgress,50)},spaInit:function(e,n){n?BOOMR.fireEvent("spa_init",[BOOMR.plugins.SPA.current_spa_nav(),n]):e?BOOMR.fireEvent("spa_init",[BOOMR.plugins.SPA.current_spa_nav(),e]):BOOMR.fireEvent("spa_init",[BOOMR.plugins.SPA.current_spa_nav(),BOOMR.window.document.URL])},routeChange:function(n,r){e.enabled?(!e.disableHardNav||BOOMR.onloadFired())&&(e.routeChangeInProgress||(e.spaInit(n,r),BOOMR.plugins.SPA.route_change())):(e.hadMissedRouteChange=!0,e.resetRouteChangeInProgress())}},!BOOMR.plugins.History&&void 0!==BOOMR.plugins.SPA&&void 0!==BOOMR.plugins.AutoXHR&&BOOMR.window&&BOOMR.window.history&&(BOOMR.plugins.SPA.register("History"),e.a=BOOMR.window.document.createElement("A"),BOOMR.plugins.History={is_complete:function(){return!0},hook:function(n,r,i){return(i=i||{}).disableHardNav=e.disableHardNav,e.hooked||(e.routeFilter&&(i.routeFilter=e.routeFilter),e.routeChangeWaitFilter&&(i.routeChangeWaitFilter=e.routeChangeWaitFilter),function(){var n,r,i,o,s,a=BOOMR.window.history;function c(){BOOMR.window.addEventListener("popstate",function(n){e.routeChange()})}return"function"==typeof a.pushState&&(e.originHistoryPushState=a.pushState,n=a.pushState,a.pushState=function(r,i,o){return e.routeChange(i,o),n.apply(this,arguments)}),e.monitorReplaceState&&"function"==typeof a.replaceState&&(e.originHistoryReplaceState=a.pushState,r=a.replaceState,a.replaceState=function(n,i,o){if("undefined"!=typeof BOOMR){var s=BOOMR.window.document.URL,a=s;return arguments.length>=3&&null!=o&&(e.a.href=o,a=e.a.href),BOOMR.plugins.SPA.isSpaNavInProgress()&&a===s||e.routeChange(i,o),r.apply(this,arguments)}}),"function"==typeof a.go&&(e.originHistoryGo=a.go,i=a.go,a.go=function(n){return e.routeChange(),i.apply(this,arguments)}),"function"==typeof a.back&&(e.originHistoryBack=a.back,o=a.back,a.back=function(){return e.routeChange(),o.apply(this,arguments)}),"function"==typeof a.forward&&(e.originHistoryForward=a.forward,s=a.forward,a.forward=function(){return e.routeChange(),s.apply(this,arguments)}),BOOMR.window.addEventListener("hashchange",function(n){var r=(n||{}).newURL;e.routeChange(null,r)}),BOOMR.hasBrowserOnloadFired()?c():BOOMR.window.addEventListener("load",function(){setTimeout(c,0)}),BOOMR.subscribe("beacon",e.resetRouteChangeInProgress),BOOMR.subscribe("spa_cancel",e.resetRouteChangeInProgress),BOOMR.subscribe("spa_init",e.setRouteChangeInProgress),!0}()&&(BOOMR.plugins.SPA.hook(r,i),e.hooked=!0)),this},init:function(n){return BOOMR.utils.pluginConfig(e,n,"History",["auto","enabled","disableHardNav","routeFilter","routeChangeWaitFilter","monitorReplaceState"]),e.auto&&e.enabled&&this.hook(void 0,!0,{}),this},disable:function(){return history.pushState=e.originHistoryPushState,history.replaceState=e.originHistoryReplaceState,history.go=e.originHistoryGo,history.back=e.originHistoryBack,history.forward=e.originHistoryForward,e.enabled=!1,this},enable:function(){return e.enabled=!0,e.hooked&&e.hadMissedRouteChange&&(e.hadMissedRouteChange=!1,BOOMR.plugins.SPA.route_change(),e.setRouteChangeInProgress()),this}}),n=window,BOOMR.plugins.RT||(i={onloadfired:!1,unloadfired:!1,visiblefired:!1,initialized:!1,complete:!1,autorun:!0,timers:{},cookie:"RT",cookie_exp:604800,session_exp:1800,strict_referrer:!0,navigationType:0,navigationStart:void 0,responseStart:void 0,loadTime:0,oboError:0,t_start:void 0,cached_t_start:void 0,cached_xhr_start:void 0,t_fb_approx:void 0,r:void 0,beacon_url:void 0,next_beacon_url:void 0,basic_timers:{t_done:1,t_resp:1,t_page:1},crossdomain_sending:!1,navigationStartSource:"",updateCookie:function(e,n){var r,o,s,a;if(!this.cookie)return!1;for(a in s=BOOMR.utils.getSubCookies(BOOMR.utils.getCookie(this.cookie))||{})s.hasOwnProperty(a)&&!isNaN(parseInt(a,10))&&delete s[a];if("object"==typeof e)for(a in e)e.hasOwnProperty(a)&&(void 0===e[a]?s.hasOwnProperty(a)&&delete s[a]:s[a]=e[a]);return(s.z=1,s.dm=BOOMR.session.domain,s.si=BOOMR.session.ID,s.ss=BOOMR.session.start.toString(36),s.sl=BOOMR.session.length.toString(36),1800!==i.session_exp&&(s.se=i.session_exp.toString(36)),BOOMR.session.rate_limited&&(s.rl=1),s.tt=this.loadTime.toString(36),this.oboError>0?s.obo=this.oboError.toString(36):delete s.obo,o=BOOMR.now(),n&&(s[n]=(o-BOOMR.session.start).toString(36),i.lastActionTime=o),this.beacon_url&&(s.bcn=this.beacon_url),BOOMR.utils.setCookie(this.cookie,s,this.cookie_exp))?((r=BOOMR.now())-o>50&&(BOOMR.utils.removeCookie(this.cookie),BOOMR.error("took more than 50ms to set cookie... aborting: "+o+" -> "+r,"rt")),!0):(BOOMR.error("cannot set start cookie","rt"),!1)},refreshSession:function(e){e||(e=BOOMR.plugins.RT.getCookie()),e&&(e.ss?BOOMR.session.start=e.ss:BOOMR.session.start=BOOMR.plugins.RT.navigationStart()||BOOMR.t_lstart||BOOMR.t_start,e.si&&e.si.match(/-/)&&(BOOMR.session.ID=e.si),e.sl&&(BOOMR.session.length=e.sl),e.tt&&(this.loadTime=e.tt),e.obo&&(this.oboError=e.obo),e.dm&&!BOOMR.session.domain&&(BOOMR.session.domain=e.dm),e.se&&(i.session_exp=e.se),e.bcn&&(this.beacon_url=e.bcn),e.rl&&"1"===e.rl&&(BOOMR.session.rate_limited=!0))},maybeResetSession:function(e,n){var r=0;BOOMR.session.start&&BOOMR.session.length&&(r=(BOOMR.now()-BOOMR.session.start)/BOOMR.session.length);var o=1e3*i.session_exp;(!BOOMR.session.start||n&&BOOMR.session.start>n||e-(i.lastActionTime||BOOMR.t_start)>o||r>o)&&(BOOMR.session.start=n||BOOMR.plugins.RT.navigationStart()||BOOMR.t_lstart||BOOMR.t_start,BOOMR.session.length=0,BOOMR.session.rate_limited=!1,i.loadTime=0,i.oboError=0,i.beacon_url=i.next_beacon_url,i.lastActionTime=e,i.updateCookie({rl:void 0,sl:BOOMR.session.length,ss:BOOMR.session.start,tt:i.loadTime,obo:void 0,bcn:i.beacon_url}))},initFromCookie:function(){var e,n,i;i=BOOMR.plugins.RT.getCookie(),this.cookie||(BOOMR.session.enabled=!1),i&&(i.s=Math.max(+i.ld||0,Math.max(+i.ul||0,+i.cl||0)),i.s&&(i.r||i.nu)&&(this.r=i.r,e=BOOMR.utils.hashString(r.URL),n=BOOMR.utils.hashString(r&&r.referrer||""),i.cl,i.nu,!this.strict_referrer||i.cl&&i.nu&&i.nu===e&&i.s<+i.cl+15||i.s===+i.ul&&this.r===n?(this.t_start=i.s,+i.hd>i.s&&(this.t_fb_approx=i.hd)):this.t_start=this.t_fb_approx=void 0),i.s&&(this.lastActionTime=i.s),this.refreshSession(i),this.updateCookie({s:void 0,ul:void 0,cl:void 0,hd:void 0,ld:void 0,rl:void 0,r:void 0,nu:void 0,sh:void 0}),this.maybeResetSession(BOOMR.now()))},incrementSessionDetails:function(){BOOMR.session.length++,!i.timers.t_done||isNaN(i.timers.t_done.delta)?i.oboError++:i.loadTime+=i.timers.t_done.delta},getBoomerangTimings:function(){var e,n,r,i,o;function s(e,n){var r=Math.round(e||0),i=Math.round(n||0);return(r=0===r?0:r-i)||""}BOOMR.t_start&&(BOOMR.plugins.RT.startTimer("boomerang",BOOMR.t_start),BOOMR.plugins.RT.endTimer("boomerang",BOOMR.t_end),BOOMR.plugins.RT.endTimer("boomr_fb",BOOMR.t_start),BOOMR.t_lstart&&(BOOMR.plugins.RT.endTimer("boomr_ld",BOOMR.t_lstart),BOOMR.plugins.RT.setTimer("boomr_lat",BOOMR.t_start-BOOMR.t_lstart)));try{if(window&&"performance"in window&&window.performance&&"function"==typeof window.performance.getEntriesByName){for(r in n={"rt.bmr":BOOMR.url},BOOMR.config_url&&(n["rt.cnf"]=BOOMR.config_url),n)if(n.hasOwnProperty(r)&&n[r]){if(!(e=window.performance.getEntriesByName(n[r]))||0===e.length||!e[0])continue;e=e[0],o=[i=s(e.startTime,0),s(e.responseEnd,i),s(e.responseStart,i),s(e.requestStart,i),s(e.connectEnd,i),s(e.secureConnectionStart,i),s(e.connectStart,i),s(e.domainLookupEnd,i),s(e.domainLookupStart,i),s(e.redirectEnd,i),s(e.redirectStart,i)].join(",").replace(/,+$/,""),BOOMR.addVar(r,o,!0)}}}catch(e){e&&e.name&&e.name.hasOwnProperty("length")&&-1===e.name.indexOf("NS_ERROR_FAILURE")&&BOOMR.addError(e,"rt.getBoomerangTimings")}},checkPreRender:function(){return"prerender"===BOOMR.visibilityState()&&(BOOMR.plugins.RT.startTimer("t_load",this.navigationStart),BOOMR.plugins.RT.endTimer("t_load"),BOOMR.plugins.RT.startTimer("t_prerender",this.navigationStart),BOOMR.plugins.RT.startTimer("t_postrender"),!0)},initFromNavTiming:function(){var e,r;!this.navigationStart&&((r=BOOMR.getPerformance())&&r.navigation&&(this.navigationType=r.navigation.type),r&&r.timing?(e=r.timing,this.navigationStartSource="navigation"):n.chrome&&n.chrome.csi&&n.chrome.csi().startE?(e={navigationStart:n.chrome.csi().startE},this.navigationStartSource="csi"):n.gtbExternal&&n.gtbExternal.startE()&&(e={navigationStart:n.gtbExternal.startE()},this.navigationStartSource="gtb"),e&&(this.navigationStart=e.navigationStart||e.fetchStart||void 0,this.fetchStart=e.fetchStart||void 0,this.responseStart=e.responseStart||void 0,navigator.userAgent.match(/Firefox\/[78]\./)&&(this.navigationStart=e.unloadEventStart||e.fetchStart||void 0)))},validateLoadTimestamp:function(e,n,r){var i;return n&&n.timing&&n.timing.loadEventEnd?n.timing.loadEventEnd:"xhr"!==r||n&&BOOMR.utils.inArray(n.initiator,BOOMR.constants.BEACON_TYPE_SPAS)?(i=BOOMR.getPerformance())&&i.timing?i.timing.loadEventEnd?i.timing.loadEventEnd:e:BOOMR.t_onload||BOOMR.t_lstart||BOOMR.t_start||e:e},setPageLoadTimers:function(e,n,r){var o,s;if("xhr"!==e&&!("early"===e&&r&&BOOMR.utils.inArray(r.initiator,BOOMR.constants.BEACON_TYPE_SPAS))&&(i.initFromCookie(),i.initFromNavTiming(),BOOMR.addVar("rt.start",this.navigationStartSource),i.checkPreRender()))return!1;if("xhr"===e)if(r.timers)for(var a in r.timers)r.timers.hasOwnProperty(a)&&BOOMR.plugins.RT.setTimer(a,r.timers[a]);else r&&r.timing&&(void 0===(s=r.timing.fetchStart)||r.timing.responseEnd>=s)&&(o=r.timing.responseEnd);else i.responseStart?i.responseStart>=i.navigationStart&&i.responseStart>=i.fetchStart&&(o=i.responseStart):i.timers.hasOwnProperty("t_page")?BOOMR.plugins.RT.endTimer("t_page"):i.t_fb_approx&&(o=i.t_fb_approx);return o&&"early"!==e&&(s?BOOMR.plugins.RT.setTimer("t_resp",s,o):BOOMR.plugins.RT.endTimer("t_resp",o),"load"===e&&i.timers.t_load?BOOMR.plugins.RT.setTimer("t_page",i.timers.t_load.end-o):n<o?BOOMR.addVar("t_page.inv",1,!0):n-o==0&&r&&r.timing&&r.timing.requestStart&&i.timers.t_resp&&i.timers.t_resp.delta?BOOMR.plugins.RT.setTimer("t_page",n-r.timing.requestStart-i.timers.t_resp.delta):BOOMR.plugins.RT.setTimer("t_page",n-o)),"load"===e&&i.timers.hasOwnProperty("t_postrender")&&(BOOMR.plugins.RT.endTimer("t_postrender"),BOOMR.plugins.RT.endTimer("t_prerender")),!0},setSupportingTimestamps:function(e,n){e&&BOOMR.addVar("rt.tstart",e,!0),"number"==typeof i.navigationStart&&i.navigationStart!==e&&BOOMR.addVar("rt.nstart",i.navigationStart,!0),"number"==typeof i.t_start&&i.t_start!==e&&BOOMR.addVar("rt.cstart",i.t_start,!0),BOOMR.addVar("rt.bstart",BOOMR.t_start,!0),BOOMR.t_lstart&&BOOMR.addVar("rt.blstart",BOOMR.t_lstart,!0),"early"===n?BOOMR.addVar("rt.end",e||BOOMR.now(),!0):i.timers.t_done&&BOOMR.addVar("rt.end",i.timers.t_done.end,!0)},determineTStart:function(e,n){var r;return"xhr"===e||"early"===e&&n&&"spa"===n.initiator?(n&&n.name&&i.timers[n.name]?r=i.timers[n.name].start:n&&n.timing&&n.timing.requestStart&&(r=n.timing.requestStart),void 0===r&&n&&BOOMR.utils.inArray(n.initiator,BOOMR.constants.BEACON_TYPE_SPAS)?BOOMR.addVar("rt.start","none"):BOOMR.addVar("rt.start","manual"),i.cached_xhr_start=r):(i.navigationStart?r=i.navigationStart:i.t_start&&2!==i.navigationType?(r=i.t_start,BOOMR.addVar("rt.start","cookie")):i.cached_t_start?r=i.cached_t_start:(BOOMR.addVar("rt.start","none"),r=void 0),i.cached_t_start=r),r},page_ready:function(){this.onloadfired=!0},check_visibility:function(){"visible"===BOOMR.visibilityState()&&(i.visiblefired=!0)},prerenderToVisible:function(){i.onloadfired&&i.autorun&&(BOOMR.addVar("vis.pre","1",!0),BOOMR.plugins.RT.done(null,"visible"))},page_unload:function(e){this.unloadfired||BOOMR.plugins.RT.done(e,"unload"),this.updateCookie(!i.navigationStart&&i.strict_referrer?{r:BOOMR.utils.hashString(r.URL)}:null,"beforeunload"===e.type?"ul":"hd"),this.unloadfired=!0},_iterable_click:function(e,n,r,i){var o;if(r){for(;r&&r.nodeName&&r.nodeName.toUpperCase()!==n;)r=r.parentNode;r&&r.nodeName&&r.nodeName.toUpperCase()===n&&(this.refreshSession(),this.maybeResetSession(BOOMR.now()),o=i(r),this.updateCookie({nu:BOOMR.utils.hashString(o)},"cl"),BOOMR.addVar("nu",BOOMR.utils.cleanupURL(o),!0))}},onclick:function(e){i._iterable_click("Click","A",e,function(e){return e.href})},markComplete:function(){this.onloadfired&&(i.complete=!0)},onsubmit:function(e){i._iterable_click("Submit","FORM",e,function(e){var n="function"==typeof e.getAttribute&&e.getAttribute("action")||r.URL||"";return n.match(/\?/)?n:n+"?"})},onconfig:function(e){e.beacon_url&&(i.beacon_url=e.beacon_url),e.RT&&(e.RT.oboError&&!isNaN(e.RT.oboError)&&e.RT.oboError>i.oboError&&(i.oboError=e.RT.oboError),e.RT.loadTime&&!isNaN(e.RT.loadTime)&&e.RT.loadTime>i.loadTime&&(i.loadTime=e.RT.loadTime,i.timers.t_done&&!isNaN(i.timers.t_done.delta)&&(i.loadTime+=i.timers.t_done.delta)))},domloaded:function(){BOOMR.plugins.RT&&BOOMR.plugins.RT.endTimer("t_domloaded")},clear:function(e){e&&void 0!==e.early||BOOMR.removeVar("rt.start")},spaNavigation:function(){i.onloadfired=!0}},BOOMR.plugins.RT={init:function(e){if(n!==BOOMR.window&&(n=BOOMR.window),e&&e.CrossDomain&&e.CrossDomain.sending&&(i.crossdomain_sending=!0),n&&n.document)return r=n.document,BOOMR.utils.pluginConfig(i,e,"RT",["cookie","cookie_exp","session_exp","strict_referrer"]),e&&void 0!==e.autorun&&(i.autorun=e.autorun),e&&e.beacon_url&&((!i.beacon_url||e.force_beacon_url)&&(i.beacon_url=e.beacon_url),i.next_beacon_url=e.beacon_url),void 0!==r&&(i.r=BOOMR.utils.hashQueryString(r.referrer,!0)),i.initFromCookie(),i.initialized||(i.complete=!1,i.timers={},i.check_visibility(),BOOMR.subscribe("page_ready",i.page_ready,null,i),BOOMR.subscribe("visibility_changed",i.check_visibility,null,i),BOOMR.subscribe("prerender_to_visible",i.prerenderToVisible,null,i),BOOMR.subscribe("page_ready",this.done,"load",this),BOOMR.subscribe("xhr_load",this.done,"xhr",this),BOOMR.subscribe("before_early_beacon",this.done,"early",this),BOOMR.subscribe("dom_loaded",i.domloaded,null,i),BOOMR.subscribe("page_unload",i.page_unload,null,i),BOOMR.subscribe("click",i.onclick,null,i),BOOMR.subscribe("form_submit",i.onsubmit,null,i),BOOMR.subscribe("before_beacon",this.addTimersToBeacon,"beacon",this),BOOMR.subscribe("beacon",i.clear,null,i),BOOMR.subscribe("error",i.markComplete,null,i),BOOMR.subscribe("config",i.onconfig,null,i),BOOMR.subscribe("spa_navigation",i.spaNavigation,null,i),BOOMR.subscribe("interaction",i.markComplete,null,i),BOOMR.getBeaconURL=function(){return i.beacon_url},i.initialized=!0),this},startTimer:function(e,n){return e&&("t_page"===e&&this.endTimer("t_resp",n),i.timers[e]={start:"number"==typeof n?n:BOOMR.now()}),this},endTimer:function(e,n){return e&&(i.timers[e]=i.timers[e]||{},void 0===i.timers[e].end&&(i.timers[e].end="number"==typeof n?n:BOOMR.now())),this},clearTimer:function(e){return e&&delete i.timers[e],this},setTimer:function(e,n,r){return e&&(void 0!==r?i.timers[e]={start:n,end:r,delta:r-n}:i.timers[e]={delta:n}),this},addTimersToBeacon:function(e,n){var r,o,s=[];for(r in i.timers)if(i.timers.hasOwnProperty(r)){if("number"!=typeof(o=i.timers[r]).delta&&("number"!=typeof o.start&&(o.start="xhr"===n?i.cached_xhr_start:i.cached_t_start),o.delta=o.end-o.start),isNaN(o.delta))continue;i.basic_timers.hasOwnProperty(r)?BOOMR.addVar(r,o.delta,!0):s.push(r+"|"+o.delta)}s.length&&BOOMR.addVar("t_other",s.join(","),!0),"beacon"!==n||e&&void 0!==e.early||(i.timers={},i.complete=!1)},done:function(e,n){if(BOOMR.plugins.RT){var r,o,s=BOOMR.now(),a=!1;return i.complete=!1,o=i.validateLoadTimestamp(s,e,n),("load"!==n&&"visible"!==n&&"xhr"!==n&&"early"!==n||i.setPageLoadTimers(n,o,e))&&(("load"===n||"visible"===n||"early"===n&&(!e||void 0===e.initiator||"spa_hard"===e.initiator)||"xhr"===n&&e&&"spa_hard"===e.initiator)&&i.getBoomerangTimings(),r=i.determineTStart(n,e),i.refreshSession(),i.maybeResetSession(o,r),"early"!==n&&this.endTimer("t_done",o),e&&"xhr"===e.initiator&&this.setTimer("t_done",e.timing.requestStart,e.timing.loadEventEnd),i.setSupportingTimestamps(r,n),this.addTimersToBeacon(null,n),BOOMR.setReferrer(i.r),"xhr"===n&&e&&e&&e.data&&(e=e.data),"xhr"===n&&e&&(a=e.subresource,e.url&&BOOMR.addVar("u",BOOMR.utils.cleanupURL(e.url.replace(/#.*/,""))),e.status&&(e.status<-1||e.status>=400)&&BOOMR.addVar("http.errno",e.status,!0),e.method&&"GET"!==e.method&&BOOMR.addVar("http.method",e.method,!0),e.type&&"xhr"!==e.type&&BOOMR.addVar("http.type",e.type[0],!0),e.headers&&BOOMR.addVar("http.hdr",e.headers,!0),e.synchronous&&BOOMR.addVar("xhr.sync",1,!0),e.initiator&&BOOMR.addVar("http.initiator",e.initiator,!0),e.responseBodyNotUsed&&BOOMR.addVar("fetch.bnu",1,!0),e.responseUrl&&BOOMR.addVar("xhr.ru",BOOMR.utils.cleanupURL(e.responseUrl),!0)),a&&"passive"!==a&&BOOMR.addVar("rt.subres",1,!0),"load"!==n&&"visible"!==n&&("xhr"!==n||a)&&("unload"!==n||i.onloadfired||!i.autorun||i.crossdomain_sending)||(i.incrementSessionDetails(),i.updateCookie(null,"ld")),BOOMR.addVar({"rt.tt":i.loadTime,"rt.obo":i.oboError},void 0,!0),i.updateCookie(),"unload"===n&&(BOOMR.addVar("rt.quit","",!0),i.onloadfired||BOOMR.addVar("rt.abld","",!0),i.visiblefired||BOOMR.addVar("rt.ntvu","",!0)),"early"!==n&&(i.complete=!0),BOOMR.sendBeacon(i.beacon_url)),this}},is_complete:function(e){return i.complete||e&&"error"===e["http.initiator"]||e&&void 0!==e.early},updateCookie:function(){i.updateCookie()},getCookie:function(){var e,n,r;return!!i.cookie&&(1&(e=BOOMR.utils.getSubCookies(BOOMR.utils.getCookie(i.cookie))||{}).z?(n=36,r=parseInt(e.ss||0,36)):(n=10,r=0),e.ss=parseInt(e.ss||0,n),e.tt=parseInt(e.tt||0,n),e.obo=parseInt(e.obo||0,n),e.sl=parseInt(e.sl||0,n),e.se&&(e.se=parseInt(e.se,n)||1800),e.ld&&(e.ld=r+parseInt(e.ld,n)),e.ul&&(e.ul=r+parseInt(e.ul,n)),e.cl&&(e.cl=r+parseInt(e.cl,n)),e.hd&&(e.hd=r+parseInt(e.hd,n)),e)},incrementSessionDetails:function(){i.incrementSessionDetails()},navigationStart:function(){return i.navigationStart||i.initFromNavTiming(),i.navigationStart},resetTimings:function(){i.navigationStart=void 0,i.responseStart=void 0,i.loadTime=0,i.cached_t_start=void 0}}),!BOOMR.plugins.PaintTiming){var l={"first-paint":"fp","first-contentful-paint":"fcp","largest-contentful-paint":"lcp"},u={initialized:!1,complete:!1,supported:null,timingCache:{},timingHistory:{},observer:null,externalMetrics:{},done:function(e,n){var r,i,o;if(this.complete)return this;if("load"!==n&&(!e||"spa_hard"!==e.initiator))return this.complete=!0,this;if(!(r=BOOMR.getPerformance())||"function"!=typeof r.getEntriesByType){this.complete=!0;return}if((i=r.getEntriesByType("paint"))&&i.length){for(BOOMR.info("This user agent supports PaintTiming","pt"),o=0;o<i.length;o++)u.timingCache[i[o].name]=i[o].startTime,l[i[o].name]&&BOOMR.addVar("pt."+l[i[o].name],Math.floor(i[o].startTime),!0);this.complete=!0,BOOMR.sendBeacon()}},onObserver:function(e){var n=e.getEntries();if(0!==n.length){var r=n[n.length-1],i=r.renderTime||r.loadTime;u.timingCache[r.entryType]=i,u.timingHistory[r.entryType]=u.timingHistory[r.entryType]||[],u.timingHistory[r.entryType].push(i),BOOMR.addVar("pt.lcp",Math.floor(i),!0),u.externalMetrics.lcp=function(){return Math.floor(i)}}}};BOOMR.plugins.PaintTiming={init:function(){return this.is_supported()||(u.complete=!0,u.initialized=!0),u.complete||"hidden"!==BOOMR.visibilityState()||(BOOMR.addVar("pt.hid",1,!0),u.complete=!0),u.initialized||(BOOMR.subscribe("page_ready",u.done,"load",u),BOOMR.subscribe("xhr_load",u.done,"xhr",u),BOOMR.subscribe("before_unload",u.done,null,u),"function"==typeof BOOMR.window.PerformanceObserver&&"function"==typeof window.LargestContentfulPaint&&(u.observer=new BOOMR.window.PerformanceObserver(u.onObserver),u.observer.observe({type:"largest-contentful-paint",buffered:!0})),u.initialized=!0),this},is_complete:function(){return!0},is_enabled:function(){return u.initialized&&this.is_supported()},is_supported:function(){if(null!==u.supported)return u.supported;var e=BOOMR.getPerformance();return u.supported=e&&void 0!==window.PerformancePaintTiming&&"function"==typeof e.getEntriesByType,u.supported},getTimingFor:function(e){if(u.timingCache[e])return u.timingCache[e];if(this.is_supported()){var n,r,i=BOOMR.getPerformance();if(i&&"function"==typeof i.getEntriesByType&&(n=i.getEntriesByType("paint"))&&n.length){for(r=0;r<n.length;r++)if(n[r].name===e)return u.timingCache[e]=n[r].startTime,u.timingCache[e]}}},getHistoryFor:function(e){return u.timingHistory[e]||[]},metrics:u.externalMetrics}}if(!BOOMR.plugins.NavigationTiming){var d={complete:!1,fullySent:!1,sendBeacon:function(){this.complete=!0,BOOMR.sendBeacon()},xhr_done:function(e){if(e&&"spa_hard"===e.initiator)return void d.done(e);if(e&&"spa"===e.initiator)return void d.sendBeacon();BOOMR.window;var n,r,i,o={};if(e){if(e.data&&(e=e.data),(n=BOOMR.getPerformance())&&e.restiming)for(i in o={nt_red_st:e.restiming.redirectStart,nt_red_end:e.restiming.redirectEnd,nt_fet_st:e.restiming.fetchStart,nt_dns_st:e.restiming.domainLookupStart,nt_dns_end:e.restiming.domainLookupEnd,nt_con_st:e.restiming.connectStart,nt_con_end:e.restiming.connectEnd,nt_req_st:e.restiming.requestStart,nt_res_st:e.restiming.responseStart,nt_res_end:e.restiming.responseEnd},e.restiming.secureConnectionStart&&(o.nt_ssl_st=e.restiming.secureConnectionStart),o)o.hasOwnProperty(i)&&o[i]&&(o[i]+=n.timing.navigationStart,o[i]=Math.floor(o[i]));for(i in e.timing&&(r=e.timing,o.nt_req_st||(o.nt_req_st=r.requestStart),o.nt_res_st||(o.nt_res_st=r.responseStart),o.nt_res_end||(o.nt_res_end=r.responseEnd),o.nt_domint=r.domInteractive,o.nt_domcomp=r.domComplete,o.nt_load_st=r.loadEventEnd,o.nt_load_end=r.loadEventEnd),o)o.hasOwnProperty(i)&&!o[i]&&delete o[i];BOOMR.addVar(o,void 0,!0),d.sendBeacon()}},done:function(){var e,n,r,i,o,s,a=BOOMR.window,c={},l=0,u=!1;if(this.complete)return this;if(e=BOOMR.getPerformance()){for(s in"function"==typeof e.getEntriesByType&&((i=e.getEntriesByType("navigation"))&&i.length?(BOOMR.info("This user agent supports NavigationTiming2","nt"),i=i[0],l=e.timing?e.timing.navigationStart:0):i=void 0),!i&&e.timing&&(BOOMR.info("This user agent supports NavigationTiming","nt"),i=e.timing),i&&(!(c={nt_nav_st:e.timing?e.timing.navigationStart:0,nt_red_st:p(l,i.redirectStart),nt_red_end:p(l,i.redirectEnd),nt_fet_st:p(l,i.fetchStart),nt_dns_st:p(l,i.domainLookupStart),nt_dns_end:p(l,i.domainLookupEnd),nt_con_st:p(l,i.connectStart),nt_con_end:p(l,i.connectEnd),nt_req_st:p(l,i.requestStart),nt_res_st:p(l,i.responseStart),nt_res_end:p(l,i.responseEnd),nt_domloading:p(l,i.domLoading),nt_domint:p(l,i.domInteractive),nt_domcontloaded_st:p(l,i.domContentLoadedEventStart),nt_domcontloaded_end:p(l,i.domContentLoadedEventEnd),nt_domcomp:p(l,i.domComplete),nt_load_st:p(l,i.loadEventStart),nt_load_end:p(l,i.loadEventEnd),nt_unload_st:p(l,i.unloadEventStart),nt_unload_end:p(l,i.unloadEventEnd)}).nt_domloading&&e&&e.timing&&e.timing.domLoading&&(c.nt_domloading=e.timing.domLoading),i.secureConnectionStart&&(c.nt_ssl_st=p(l,i.secureConnectionStart)),e.timing&&e.timing.msFirstPaint&&(c.nt_first_paint=e.timing.msFirstPaint),i.workerStart&&(c.nt_worker_start=p(l,i.workerStart)),(i.decodedBodySize||i.transferSize)&&(c.nt_enc_size=i.encodedBodySize,c.nt_dec_size=i.decodedBodySize,c.nt_trn_size=i.transferSize),i.nextHopProtocol&&(c.nt_protocol=i.nextHopProtocol)),!c.nt_first_paint&&BOOMR.plugins.PaintTiming&&(u=BOOMR.plugins.PaintTiming.is_supported(),(o=BOOMR.plugins.PaintTiming.getTimingFor("first-paint"))&&(c.nt_first_paint=p(l,o))),(!c.nt_protocol||!c.nt_first_paint)&&(!i||""!==i.nextHopProtocol)&&!u&&a.chrome&&"function"==typeof a.chrome.loadTimes&&(r=a.chrome.loadTimes())&&(c.nt_spdy=+!!r.wasFetchedViaSpdy,c.nt_cinf=r.connectionInfo,"number"==typeof r.firstPaintTime&&0!==r.firstPaintTime&&(c.nt_first_paint=Math.round(1e3*r.firstPaintTime))),e.navigation&&(n=e.navigation,c.nt_red_cnt=n.redirectCount,c.nt_nav_type=n.type),c)c.hasOwnProperty(s)&&void 0===c[s]&&delete c[s];BOOMR.addVar(c,void 0,!0),i&&(i.requestStart&&i.navigationStart&&i.requestStart<i.navigationStart||i.responseStart&&i.navigationStart&&i.responseStart<i.navigationStart||i.responseStart&&i.fetchStart&&i.responseStart<i.fetchStart||i.navigationStart&&i.fetchStart<i.navigationStart||i.responseEnd&&i.responseEnd>BOOMR.now()+864e5)&&BOOMR.addVar("nt_bad",1,!0),c.nt_load_end>0&&(this.fullySent=!0)}d.sendBeacon()},clear:function(e){this.complete=!(e&&e.early)&&this.fullySent},prerenderToVisible:function(){this.complete=!1,this.done()},onBeforeEarlyBeacon:function(e){e&&void 0!==e.initiator&&"spa_hard"!==e.initiator||this.done()}};BOOMR.plugins.NavigationTiming={init:function(){return d.initialized||(BOOMR.subscribe("page_ready",d.done,null,d),BOOMR.subscribe("prerender_to_visible",d.prerenderToVisible,null,d),BOOMR.subscribe("before_early_beacon",d.onBeforeEarlyBeacon,null,d),BOOMR.subscribe("xhr_load",d.xhr_done,null,d),BOOMR.subscribe("before_unload",d.done,null,d),BOOMR.subscribe("beacon",d.clear,null,d),d.initialized=!0),this},is_complete:function(){return!0}}}function p(e,n){if("number"==typeof n&&0!==n)return Math.floor((e||0)+n)}if(!function(){if(!BOOMR.plugins.ResourceTiming){var e,n={other:0,img:1,link:2,script:3,css:4,xmlhttprequest:5,html:6,image:7,beacon:8,fetch:9,iframe:"a",subdocument:"a",body:"b",input:"c",frame:"a",object:"d",video:"e",audio:"f",source:"g",track:"h",embed:"i",eventsource:"j",navigation:6},r={prefetch:1,preload:2,prerender:3,stylesheet:4},i=["startTime","redirectStart","redirectEnd","fetchStart","domainLookupStart","domainLookupEnd","connectStart","secureConnectionStart","connectEnd","requestStart","responseStart","responseEnd","workerStart"],o="\n",s="*",c="0",l="1",u="2",d=1,p=2,h=4,f="3",m="4",g="5",v="6",y="7";e={complete:!1,sentNavBeacon:!1,initialized:!1,supported:null,xhr_load:function(e){e&&e.restiming&&H(e.restiming),this.complete||(this.complete=!0,BOOMR.sendBeacon())},xssBreakWords:[/(h)(ref)/gi,/(s)(rc)/gi,/(a)(ction)/gi],urlLimit:500,clearOnBeacon:!1,trimUrls:[],serverTiming:!0,monitorClearResourceTimings:!1,splitAtPath:!1,getSrcsetDimensions:!1,trackedResourceTypes:"*",done:function(){this.sentNavBeacon||(N(),this.complete=!0,this.sentNavBeacon=!0,BOOMR.sendBeacon())},onBeacon:function(n){var r=BOOMR.getPerformance();if(e.clearOnBeacon&&r){var i=r.clearResourceTimings||r.webkitClearResourceTimings;i&&"function"==typeof i&&i.call(r)}},prerenderToVisible:function(){this.sentNavBeacon=!1,this.done()}},BOOMR.plugins.ResourceTiming={init:function(n){if(BOOMR.utils.pluginConfig(e,n,"ResourceTiming",["xssBreakWords","clearOnBeacon","urlLimit","trimUrls","trackedResourceTypes","serverTiming","monitorClearResourceTimings","splitAtPath","getSrcsetDimensions"]),e.initialized)return this;if(this.is_supported()){if(BOOMR.subscribe("page_ready",e.done,null,e),BOOMR.subscribe("prerender_to_visible",e.prerenderToVisible,null,e),BOOMR.subscribe("xhr_load",e.xhr_load,null,e),BOOMR.subscribe("beacon",e.onBeacon,null,e),BOOMR.subscribe("before_unload",e.done,null,e),e.monitorClearResourceTimings){var r,i=this;BOOMR.window.performance.clearResourceTimings=(r=BOOMR.window.performance.clearResourceTimings,function(){i.addResources(BOOMR.window.performance.getEntriesByType("resource")),r.apply(BOOMR.window.performance,arguments)})}}else e.complete=!0;return e.initialized=!0,this},is_complete:function(){return!0},is_enabled:function(){return e.initialized&&this.is_supported()},is_supported:function(){if(null!==e.supported)return e.supported;var n=BOOMR.getPerformance();return e.supported=n&&"function"==typeof n.getEntriesByType&&void 0!==window.PerformanceResourceTiming,e.supported},addResources:function(n,r){if(this.is_supported()&&BOOMR.utils.isArray(n)){if(e.collectedEntries=e.collectedEntries||[],"number"==typeof r){var o=r-(BOOMR.window.performance.timeOrigin||BOOMR.window.performance.timing.navigationStart);n=BOOMR.utils.arrayFilter(n,function(e){for(var n=0;n<i.length;n++){var r=i[n];e.hasOwnProperty(r)&&(e[r]+=o)}return!0})}Array.prototype.push.apply(e.collectedEntries,n)}},getCompressedResourceTiming:k,getFilteredResourceTiming:x,calculateResourceTimingUnion:function(e){if(!e||!e.length)return 0;e.sort(function(e,n){return e.fetchStart!==n.fetchStart?e.fetchStart-n.fetchStart:(e.responseStart||e.responseEnd)-(n.responseStart||n.responseEnd)});var n,r=P(e),i=[],o=0;for(n=0;n<r.length;n++){var s=r[n];s.fetchStart<o&&(s.fetchStart=o),s.fetchStart<s.responseEnd&&(i.push(s),o=s.responseEnd)}var a=P(i),c=0;for(n=0;n<a.length;n++)c+=a[n].responseEnd-a[n].fetchStart;return c},addResourceTimingToBeacon:N,addToBeacon:H,trimTiming:w,convertToTrie:b,optimizeTrie:_,findPerformanceEntriesForFrame:S,toBase36:T,getVisibleEntries:M,reduceFetchStarts:P,compressSize:C,decompressSize:function(e,n){var r,i;for(void 0===n&&(n={}),r=e.split(","),i=0;i<r.length;i++)"_"===r[i]?r[i]=0:(""===r[i]&&(r[i]=0),r[i]=parseInt(r[i],36),i>0&&(r[i]+=r[0]));return 1===r.length&&r.push(r[0]),2===r.length&&r.push(r[0]),n.encodedBodySize=r[0],n.transferSize=r[1],n.decodedBodySize=r[2],n},trimUrl:I,getResourceLatestTime:j,mergePixels:A,countPixels:B,getOptimizedTimepoints:function(e){var n,r,i,o,s,a,c,l,u,d,p={},h=[];for(n=0,r=Object.keys(e);n<r.length;n++)void 0===p[s=Math.round(Number(r[n]))]&&(p[s]=[]),Array.prototype.push.apply(p[s],e[r[n]]);if(0===(r=Object.keys(p).map(Number).sort(function(e,n){return e-n})).length)return{};for(n=0;n<r.length;n++)c=B(i=A(i,p[s=r[n]],s)),r[n]=[s,c];for(n=0,o=0,a=0,l=0;n<r.length;n++)s=r[n][0],c=r[n][1],u=B(i,0,s),(c>a||u>l)&&(h.push(d=(d=(s===1/0?"":T(Math.round(s-o)))+"~"+T(c-a)+"~"+T(c-u)).replace(/~~/,"-").replace(/~$/,"")),o=s,a=c,l=u);return h.join("!").replace(/!+$/,"")},decompressTimePoints:function(e){var n,r,i,o={},s=[0,0,0];for(r=0,n=e.split("!");r<n.length;r++)o[(i=n[r].replace(/^~/,"Infinity~").replace("-","~0~").split("~").map(function(e,n){return e="Infinity"===e?1/0:parseInt(e,36),2===n?e=s[1]-e:e+=s[n],s[n]=e,e}))[0]]=[i[1],i[2]||i[1]];return o},accumulateServerTimingEntries:D,compressServerTiming:L,indexServerTiming:F,identifyServerTimingEntry:U,decompressServerTiming:function(e,n){var r=n.split(":"),i=Number(r[0]),o=0,s=0;if(r.length>1){var a=r[1].split(".");""!==a[0]&&(o=Number(a[0])),a.length>1&&(s=Number(a[1]))}var c,l="";return Array.isArray(e[o])?(c=e[o][0],l=e[o][1+s]||""):c=e[o],{name:c,duration:i,description:l}},SPECIAL_DATA_PREFIX:s,SPECIAL_DATA_DIMENSION_TYPE:c,SPECIAL_DATA_SIZE_TYPE:l,SPECIAL_DATA_SCRIPT_ATTR_TYPE:u,SPECIAL_DATA_LINK_ATTR_TYPE:m,SPECIAL_DATA_SERVICE_WORKER_TYPE:v,ASYNC_ATTR:d,DEFER_ATTR:p,LOCAT_ATTR:h,INITIATOR_TYPES:n,REL_TYPES:r}}function b(n,r){var i,s,a,c,l,u,d,p,h={};for(i in n){for(a=0,s=i;a<e.xssBreakWords.length;a++)s=s.replace(e.xssBreakWords[a],"$1"+o+"$2");if(n.hasOwnProperty(i))for(a=0,c=n[i],l=r?[(l=s.split("/"))[0]+"//",l[2]+(l.length>3?"/":"")].concat(l.slice(3).reduce(function(e){return function(n,r,i){var s,a;if(-1!==r.indexOf(o)){for(a=0,s=r.split(o);a<s.length-1;a++)n.push(s[a]),n.push(o);r=s.slice(-1)}return"number"==typeof e&&i<e&&(r+="/"),n.concat(r)}}(l.length-4),[])):s.split(""),d=h;a<l.length;a++)void 0===(p=d[u=l[a]])?d=d[u]=a===l.length-1?c:{}:"string"==typeof p?d=d[u]={"|":p}:a===l.length-1?d[u]["|"]=c:d=d[u]}return h}function _(e,n){var r,i,s,a=0,c=[];for(r in e)e.hasOwnProperty(r)&&c.push(r);for(var l=0;l<c.length;l++)"object"==typeof e[r=c[l]]&&(i=_(e[r],!1))&&(delete e[r],r===o?(r=i.name,a++):r+=i.name,e[r]=i.value),a++;if(1===a)if(n)return(s={})[r]=e[r],s;else return{name:r,value:e[r]};return!!n&&e}function w(e,n){"number"!=typeof e&&(e=0),"number"!=typeof n&&(n=0);var r=Math.round(e||0),i=Math.round(n||0);return 0===r?0:r-i}function O(e){try{if(e.location&&e.location.href,e.document,"performance"in e&&e.performance)return!0}catch(e){}return!1}function R(e){var n=0;return O(e)&&e.performance.timing&&e.performance.timing.navigationStart&&(n=e.performance.timing.navigationStart),n}function S(n,o,s,a,c){var l,u,f,m,g,v,y,b,_,w=[],T={},x={};if(void 0===o&&(o=!0),void 0===s&&(s=0),void 0===a&&(a=0),a>10)return w;try{if(!O(n))return w;if(f=R(n),b=M(n,c),_=n.document.createElement("a"),E(_,T,"script"),E(_,x,"link"),(v=n.document.getElementsByTagName("iframe"))&&v.length)for(l=0;l<v.length;l++)m=R(v[l].contentWindow),g=0,m>f&&(g=s+(m-f)),_.href=v[l].src,w=w.concat(S(v[l].contentWindow,!1,g,a+1,b[_.href]));if("function"!=typeof n.performance.getEntriesByType)return w;function C(n){return e.serverTiming&&n.serverTiming||[]}o&&(I=n,A=w,B=u,k=y,P=C,(B=I.performance.getEntriesByType("navigation"))&&1===B.length?(k=B[0],A.push({name:I.location.href,startTime:0,initiatorType:"html",redirectStart:k.redirectStart,redirectEnd:k.redirectEnd,fetchStart:k.fetchStart,domainLookupStart:k.domainLookupStart,domainLookupEnd:k.domainLookupEnd,connectStart:k.connectStart,secureConnectionStart:k.secureConnectionStart,connectEnd:k.connectEnd,requestStart:k.requestStart,responseStart:k.responseStart,responseEnd:k.responseEnd,workerStart:k.workerStart,encodedBodySize:k.encodedBodySize,decodedBodySize:k.decodedBodySize,transferSize:k.transferSize,serverTiming:P(k)})):I.performance.timing&&0!==(t=I.performance.timing).navigationStart&&t.responseEnd<=t.navigationStart+36e5&&A.push({name:I.location.href,startTime:0,initiatorType:"html",redirectStart:t.redirectStart?t.redirectStart-t.navigationStart:0,redirectEnd:t.redirectEnd?t.redirectEnd-t.navigationStart:0,fetchStart:t.fetchStart?t.fetchStart-t.navigationStart:0,domainLookupStart:t.domainLookupStart?t.domainLookupStart-t.navigationStart:0,domainLookupEnd:t.domainLookupEnd?t.domainLookupEnd-t.navigationStart:0,connectStart:t.connectStart?t.connectStart-t.navigationStart:0,secureConnectionStart:t.secureConnectionStart?t.secureConnectionStart-t.navigationStart:0,connectEnd:t.connectEnd?t.connectEnd-t.navigationStart:0,requestStart:t.requestStart?t.requestStart-t.navigationStart:0,responseStart:t.responseStart?t.responseStart-t.navigationStart:0,responseEnd:t.responseEnd?t.responseEnd-t.navigationStart:0}));var I,A,B,k,P,N=n.performance.getEntriesByType("resource");n===BOOMR.window&&e.collectedEntries&&(Array.prototype.push.apply(N,e.collectedEntries),e.collectedEntries=[]),w=w.concat(function(e,n,o,s,a,c){for(var l,u,f=[],m=0;e&&m<e.length;m++){l={name:(u=e[m]).name,initiatorType:u.initiatorType,encodedBodySize:u.encodedBodySize,decodedBodySize:u.decodedBodySize,transferSize:u.transferSize,serverTiming:n(u),visibleDimensions:o[u.name],latestTime:j(u)};for(var g=0;g<i.length;g++){var v=i[g];l[v]="startTime"===v||u[v]?u[v]+s:0}if(u.hasOwnProperty("_data")&&(l._data=u._data),("script"===u.initiatorType||"link"===u.initiatorType)&&a[u.name]){var y=a[u.name];for(l.scriptAttrs=(y.async?d:0)|(y.defer?p:0);1===y.nodeType&&"BODY"!==y.nodeName;)y=y.parentNode;l.scriptAttrs|="BODY"===y.nodeName?h:0}"link"===u.initiatorType&&c[u.name]&&BOOMR.utils.arrayFind(c[u.name].rel.split(/[\u0009\u000A\u000C\u000D\u0020]+/),function(e){if(r[e=e.toLowerCase()])return l.linkAttrs=r[e],!0}),f.push(l)}return f}(N,C,b,s,T,x))}catch(e){}return w}function E(e,n,r){Array.prototype.forEach.call(e.ownerDocument.getElementsByTagName(r),function(r){e.href=r.currentSrc||r.src||"function"==typeof r.getAttribute&&r.getAttribute("xlink:href")||r.href,e.href.match(/^https?:\/\//)&&(n[e.href]=r)})}function T(e){return"number"==typeof e&&0!==e?e.toString(36):"string"==typeof e?e:""}function M(n,r){var i,o,s={},a=n.document,c=a.createElement("A");return i=(r=r||[0,0,0,0])[3]+(void 0!==n.pageXOffset)?n.pageXOffset:(a.documentElement||a.body.parentNode||a.body).scrollLeft,o=r[2]+(void 0!==n.pageYOffset)?n.pageYOffset:(a.documentElement||a.body.parentNode||a.body).scrollTop,["img","iframe","image"].forEach(function(n){var r,l,u,d,p,h,f,m=a.getElementsByTagName(n);for(p=0;p<m.length;p++)if((d=m[p])&&(c.href=f=d.currentSrc||d.src||"function"==typeof d.getAttribute&&d.getAttribute("src")||d.getAttribute("xlink:href"),(f=c.href)&&!s[f]&&((h=d.getBoundingClientRect()).height||d.offsetHeight)&&(h.width||d.offsetWidth))){if(s[f]=[h.height||d.offsetHeight,h.width||d.offsetWidth,Math.round(h.top+o),Math.round(h.left+i)],!d.naturalHeight&&!d.naturalWidth)continue;e.getSrcsetDimensions&&d.currentSrc&&(d.srcset||d.parentNode&&d.parentNode.nodeName&&"PICTURE"===d.parentNode.nodeName.toUpperCase())?(r=d.isConnected?d.ownerDocument.createElement("IMG"):new BOOMR.window.Image).src=f:r=d,l=r.naturalHeight||d.naturalHeight,u=r.naturalWidth||d.naturalWidth,(l||u)&&(s[f][0]!==l||s[f][1]!==u)&&s[f].push(l,u)}}),s}function x(e,n,r){var i,o,s=S(BOOMR.window,!0,0,0),a=R(BOOMR.window),c={};if(!s||!s.length)return{entries:[]};s.sort(function(e,n){return e.startTime-n.startTime});var l=[];for(i=0;i<s.length;i++)if(!("string"!=typeof(o=s[i]).name||0!==o.name.indexOf("http:")&&0!==o.name.indexOf("https:")||"function"==typeof BOOMR.getBeaconURL&&BOOMR.getBeaconURL()&&o.name.indexOf(BOOMR.getBeaconURL())>-1)&&(!e||!(a+o.startTime<e))){if(n&&a+o.startTime>n)break;(void 0===r||"*"===r||!r.length||o.initiatorType&&BOOMR.utils.inArray(o.initiatorType,r))&&(D(c,o.serverTiming),l.push(o))}var u=L(c);return{entries:l,serverTiming:{lookup:u,indexed:F(u)}}}function C(e){var n,r,i;return e.encodedBodySize||e.decodedBodySize||e.transferSize?(n=e.transferSize,r=e.encodedBodySize,[r,n?n-r:"_",(i=e.decodedBodySize)?i-r:0].map(T).join(",").replace(/,+$/,"")):""}function I(n,r){var i,o,s;if(n&&r)for(i=0;i<r.length;i++)if("string"==typeof(s=r[i])){if(-1!==(o=n.indexOf(s))){n=n.substr(0,o+s.length)+"...";break}}else s instanceof RegExp&&s.test(n)&&(n=n.replace(s,"$1")+"...");return BOOMR.utils.cleanupURL(n,e.urlLimit)}function j(e){return e.responseEnd?e.responseEnd:e.responseStart&&e.startTime?e.responseStart+(e.responseStart-e.startTime)*.2:1/0}function A(e,n,r){var i=BOOMR.window.screen,o=i.height,s=i.width;return n.reduce(function(e,n){var i,a,c,l,u,d;if(i=Math.max(0,n[3]),c=Math.max(0,n[2]),a=Math.min(n[3]+n[1],s),l=Math.min(n[2]+n[0],o),i>=a||c>=l)return e;for(d=c;d<l;d++)for(e[d]||(e[d]=[]),u=i;u<a;u++)e[d][u]=r;return e},e||[])}function B(e,n,r){return n=n||0,r=r||1/0,e.reduce(function(e,i){return e+i.filter(function(e){return n<=e&&e<=r}).length},0)}function k(r,i){var o,d,p,h,O,R={},S={},E=x(r,i,e.trackedResourceTypes),M=E.entries,j=E.serverTiming;if(!M||!M.length)return{restiming:{},servertiming:[]};for(o=0;o<M.length;o++){d=M[o];var A=BOOMR.plugins.Continuity.getTTIWaitForXHRIngore(),B=d.initiatorType&&BOOMR.utils.inArray(d.initiatorType,["xmlhttprequest","fetch"])&&a(A,d.name);void 0===(p=n[d.initiatorType])&&(p=0),O=p+[w(d.startTime,0),w(d.responseEnd,d.startTime),w(d.responseStart,d.startTime),w(d.requestStart,d.startTime),w(d.connectEnd,d.startTime),w(d.secureConnectionStart,d.startTime),w(d.connectStart,d.startTime),w(d.domainLookupEnd,d.startTime),w(d.domainLookupStart,d.startTime),w(d.redirectEnd,d.startTime),w(d.redirectStart,d.startTime)].map(T).join(",").replace(/,+$/,"");var k=C(d);if(""!==k&&(O+=s+l+k),d.hasOwnProperty("scriptAttrs")&&(O+=s+u+d.scriptAttrs),d.serverTiming&&d.serverTiming.length&&(O+=s+f+d.serverTiming.reduce(function(e,n,r){var i=String(void 0!==n.duration?n.duration:n.value);"0."===i.substring(0,2)&&(i=i.substring(1));var o=n.name||n.metric;return e+((r>0?",":"")+i+U(j.indexed[o].index,j.indexed[o].descriptions[n.description]))},"")),d.hasOwnProperty("linkAttrs")&&(O+=s+m+d.linkAttrs),d.workerStart&&"number"==typeof d.workerStart&&0!==d.workerStart){var P,N=w(("number"!=typeof(P=d.workerStart)&&(P=0),Math.ceil(P||0)),d.startTime);O+=s+v+T(N)}if(B&&(O+=s+y+1),h=I(d.name,e.trimUrls),d.hasOwnProperty("_data")){var D="";for(var L in d._data)d._data.hasOwnProperty(L)&&(D+=s+g+L+":"+d._data[L]);void 0===R[h]?R[h]=O+D:R[h]+=D}else void 0!==R[h]?R[h]+="|"+O:d.visibleDimensions?R[h]=s+c+d.visibleDimensions.map(Math.round).map(T).join(",").replace(/,+$/,"")+"|"+O:R[h]=O;d.visibleDimensions&&(S[d.latestTime]||(S[d.latestTime]=[]),S[d.latestTime].push(d.visibleDimensions))}return{restiming:_(b(R,e.splitAtPath),!0),servertiming:j.lookup}}function P(e){var n=[];if(!e||!e.length)return n;for(var r=0;r<e.length;r++){var i=e[r];(r===e.length-1||i.fetchStart!==e[r+1].fetchStart)&&n.push({fetchStart:i.fetchStart,responseEnd:i.responseStart||i.responseEnd})}return n}function N(e,n){var r;"undefined"!=typeof JSON&&(r=k(e,n))&&(BOOMR.info("Client supports Resource Timing API","restiming"),H(r))}function D(e,n){(n||[]).forEach(function(n){var r=n.name||n.metric;void 0===e[r]&&(e[r]={count:0,counts:{}});var i=e[r];i.counts[n.description]=i.counts[n.description]||0,i.counts[n.description]++,i.count++})}function L(e){return Object.keys(e).sort(function(n,r){return e[r].count-e[n].count}).reduce(function(n,r){var i=Object.keys(e[r].counts).sort(function(n,i){return e[r].counts[i]-e[r].counts[n]});return n.push(1===i.length&&""===i[0]?r:[r].concat(i)),n},[])}function F(e){return e.reduce(function(e,n,r){var i,o;return Array.isArray(n)?(i=n[0],o=n.slice(1).reduce(function(e,n,r){return e[n]=r,e},{})):(i=n,o={"":0}),e[i]={index:r,descriptions:o},e},{})}function U(e,n){var r="";return e&&(r+=e),n&&(r+="."+n),r.length&&(r=":"+r),r}function H(e){BOOMR.addVar("restiming",JSON.stringify(e.restiming),!0),e.servertiming.length&&BOOMR.addVar("servertiming",BOOMR.utils.serializeForUrl(e.servertiming),!0)}}(),!BOOMR.plugins.UserTiming){var h={complete:!1,initialized:!1,supported:!1,options:{from:0,window:BOOMR.window},getUserTiming:function(){var e,n=this.findUserTimingForFrame(h.options.window);h.options.from&&(n=n.filter(function(e){return e.startTime+e.duration>=h.options.from}));var r=window.UserTimingCompression||BOOMR.window.UserTimingCompression;if(void 0!==r)return e=r.compressUserTiming(n),r.compressForUri(e);if(0===n.length)return null;for(var i=this.getUserTimingMap(),o=0,s=n.length;o<s;o++){var a=n[o];"measure"===a.entryType&&0===a.name.indexOf("x_")&&(i[a.name]?i[a.name].push(a.duration):i[a.name]=[a.duration])}return JSON.stringify(i)},addEntriesToBeacon:function(e){var n,r=BOOMR.hrNow();this.complete||e&&void 0!==e.early||((n=this.getUserTiming())&&BOOMR.addVar("usertiming",n,!0),this.options.from=r,this.complete=!0)},getUserTimingMap:function(){var e,n=BOOMR.getVar("usertiming");if(!n)return{};try{if(e=JSON.parse(n),s(e))return e}catch(e){}return{}},findUserTimingForFrame:function(e){var n;if(!e)return[];try{if(e.location&&e.location.href,!("performance"in e)||!e.performance||!e.performance.getEntriesByType)return n;n=(n=e.performance.getEntriesByType("mark")).concat(e.performance.getEntriesByType("measure"))}catch(e){}return n},clearMetrics:function(e){this.complete=!1},subscribe:function(){BOOMR.subscribe("before_beacon",this.addEntriesToBeacon,null,this),BOOMR.subscribe("beacon",this.clearMetrics,null,this)},pageReady:function(){this.checkSupport()&&this.subscribe()},checkSupport:function(){if(this.supported)return!0;var e=BOOMR.getPerformance();if(e&&"function"==typeof e.getEntriesByType){var n=e.getEntriesByType("mark"),r=e.getEntriesByType("measure");if(BOOMR.utils.isArray(n)&&BOOMR.utils.isArray(r))return BOOMR.info("Client supports UserTiming API","usertiming"),this.supported=!0,!0}return!1}};BOOMR.plugins.UserTiming={init:function(e){return h.initialized||(h.checkSupport()?h.subscribe():BOOMR.subscribe("page_ready",h.pageReady,null,h),h.initialized=!0),this},is_complete:function(){return!0},is_supported:function(){return h.initialized&&h.supported},addUserTiming:function(e){var n=h.getUserTimingMap();s(e)&&(Object.keys(e).forEach(function(r){var i,o=e[r];i=o,"[object Number]"===Object.prototype.toString.call(i)&&(o=[o]),n[r]?n[r].concat(o):n[r]=o}),n&&BOOMR.addVar("usertiming",JSON.stringify(n),!0))}}}if(!BOOMR.plugins.EventTiming){var f={click:0,dblclick:1,mousedown:2,mouseup:3,mousemove:4,touchstart:5,touchend:6,touchmove:7,keydown:8,keyup:9,keypress:10,wheel:11,pointerdown:12,pointerup:13,pointermove:14,compositionstart:17,compositionupdate:18,compositionend:19,contextmenu:20},m={initialized:!1,supported:null,observerEvent:null,observerFirstInput:null,entries:[],firstInputDelay:null,timeToFirstInteraction:null,onBeforeBeacon:function(){var e;if(m.entries&&m.entries.length){var n=[];for(e=0;e<m.entries.length;e++)n.push({n:f[m.entries[e].name]?f[m.entries[e].name]:m.entries[e].name,s:Math.round(m.entries[e].startTime).toString(36),d:Math.round(m.entries[e].duration).toString(36),p:Math.round(m.entries[e].processingEnd-m.entries[e].processingStart).toString(36),c:+!!m.entries[e].cancelable,fi:"first-input"===m.entries[e].entryType?1:void 0});BOOMR.addVar("et.e",BOOMR.utils.serializeForUrl(n),!0)}m.entries=[],null!==m.firstInputDelay&&(BOOMR.addVar("et.fid",Math.ceil(m.firstInputDelay),!0),m.firstInputDelay=null)},onEventTiming:function(e){m.entries=m.entries.concat(e.getEntries())},onFirstInput:function(e){var n=e.getEntries();m.entries=m.entries.concat(n),m.firstInputDelay=n[0].processingStart-n[0].startTime,m.timeToFirstInteraction=n[0].startTime}};BOOMR.plugins.EventTiming={init:function(){if(this.is_supported()||(m.initialized=!0),!m.initialized){BOOMR.subscribe("before_beacon",m.onBeforeBeacon,null,m);try{var e=BOOMR.window;m.observerEvent=new e.PerformanceObserver(m.onEventTiming),m.observerEvent.observe({type:["event"],buffered:!0}),m.observerFirstInput=new e.PerformanceObserver(m.onFirstInput),m.observerFirstInput.observe({type:["first-input"],buffered:!0})}catch(e){m.supported=!1}m.initialized=!0}return this},is_complete:function(){return!0},is_enabled:function(){return m.initialized&&this.is_supported()},is_supported:function(){if(null!==m.supported)return m.supported;var e=BOOMR.window;return m.supported=BOOMR.getPerformance()&&void 0!==e.PerformanceEventTiming&&"function"==typeof e.PerformanceObserver,m.supported&&BOOMR.info("This user agent supports EventTiming","et"),m.supported},stop:function(){m.observerEvent&&(m.observerEvent.disconnect(),m.observerEvent=null),m.observerFirstInput&&(m.observerFirstInput.disconnect(),m.observerFirstInput=null)},metrics:{count:function(){return m.entries.length},averageDuration:function(){if(0===m.entries.length)return 0;for(var e=0,n=0;n<m.entries.length;n++)e+=m.entries[n].duration;return e/m.entries.length},firstInputDelay:function(){return m.firstInputDelay},timeToFirstInteraction:function(){return m.timeToFirstInteraction}}}}},e.prototype.uninstall=function(){var e=this.BOOMR,n=e.plugins;e.disable(),Object.keys(n).forEach(function(e){n[e].disable&&n[e].disable()}),e.orig_XMLHttpRequest&&e.orig_XMLHttpRequest!==window.XMLHttpRequest&&(window.XMLHttpRequest=e.orig_XMLHttpRequest)},e.prototype.addUserTiming=function(e){var n=this.BOOMR;n&&n.plugins.UserTiming&&n.plugins.UserTiming.addUserTiming&&n.plugins.UserTiming.addUserTiming(e)},e}()},"../../node_modules/abort-signal-polyfill/dist/staticMethods/abort.js":function(e,n){"use strict";n.abortSignalAbort=function(e){let n=new AbortController;return n.abort(e),n.signal}},"../../node_modules/abort-signal-polyfill/dist/staticMethods/any.js":function(e,n){"use strict";n.abortSignalAny=function(e){if(0===e.length)return new AbortController().signal;if(1===e.length)return e[0];for(let n of e)if(n.aborted)return n;let n=new AbortController,r=Array(e.length),i=()=>{for(let e of r)e()};return e.forEach((e,o)=>{let s=()=>{n.abort(e.reason),i()};e.addEventListener("abort",s),r[o]=()=>e.removeEventListener("abort",s)}),n.signal}},"../../node_modules/abort-signal-polyfill/dist/staticMethods/timeout.js":function(e,n){"use strict";n.abortSignalTimeout=function(e){let n=new AbortController;return setTimeout(()=>{n.abort(new DOMException(`signal timed out after ${e} ms`,"TimeoutError"))},e),n.signal}},"../../node_modules/p-queue/node_modules/eventemitter3/index.js":function(e){"use strict";var n=Object.prototype.hasOwnProperty,r="~";function i(){}function o(e,n,r){this.fn=e,this.context=n,this.once=r||!1}function s(e,n,i,s,a){if("function"!=typeof i)throw TypeError("The listener must be a function");var c=new o(i,s||e,a),l=r?r+n:n;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],c]:e._events[l].push(c):(e._events[l]=c,e._eventsCount++),e}function a(e,n){0==--e._eventsCount?e._events=new i:delete e._events[n]}function c(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1)),c.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)n.call(e,i)&&o.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},c.prototype.listeners=function(e){var n=r?r+e:e,i=this._events[n];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,s=i.length,a=Array(s);o<s;o++)a[o]=i[o].fn;return a},c.prototype.listenerCount=function(e){var n=r?r+e:e,i=this._events[n];return i?i.fn?1:i.length:0},c.prototype.emit=function(e,n,i,o,s,a){var c=r?r+e:e;if(!this._events[c])return!1;var l,u,d=this._events[c],p=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),p){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,n),!0;case 3:return d.fn.call(d.context,n,i),!0;case 4:return d.fn.call(d.context,n,i,o),!0;case 5:return d.fn.call(d.context,n,i,o,s),!0;case 6:return d.fn.call(d.context,n,i,o,s,a),!0}for(u=1,l=Array(p-1);u<p;u++)l[u-1]=arguments[u];d.fn.apply(d.context,l)}else{var h,f=d.length;for(u=0;u<f;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),p){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,n);break;case 3:d[u].fn.call(d[u].context,n,i);break;case 4:d[u].fn.call(d[u].context,n,i,o);break;default:if(!l)for(h=1,l=Array(p-1);h<p;h++)l[h-1]=arguments[h];d[u].fn.apply(d[u].context,l)}}return!0},c.prototype.on=function(e,n,r){return s(this,e,n,r,!1)},c.prototype.once=function(e,n,r){return s(this,e,n,r,!0)},c.prototype.removeListener=function(e,n,i,o){var s=r?r+e:e;if(!this._events[s])return this;if(!n)return a(this,s),this;var c=this._events[s];if(c.fn)c.fn!==n||o&&!c.once||i&&c.context!==i||a(this,s);else{for(var l=0,u=[],d=c.length;l<d;l++)(c[l].fn!==n||o&&!c[l].once||i&&c[l].context!==i)&&u.push(c[l]);u.length?this._events[s]=1===u.length?u[0]:u:a(this,s)}return this},c.prototype.removeAllListeners=function(e){var n;return e?(n=r?r+e:e,this._events[n]&&a(this,n)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,e.exports=c},"../../node_modules/process/browser.js":function(e){var n,r,i,o=e.exports={};function s(){throw Error("setTimeout has not been defined")}function a(){throw Error("clearTimeout has not been defined")}try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}function c(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(r){try{return n.call(null,e,0)}catch(r){return n.call(this,e,0)}}}var l=[],u=!1,d=-1;function p(){u&&i&&(u=!1,i.length?l=i.concat(l):d=-1,l.length&&h())}function h(){if(!u){var e=c(p);u=!0;for(var n=l.length;n;){for(i=l,l=[];++d<n;)i&&i[d].run();d=-1,n=l.length}i=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(n){try{return r.call(null,e)}catch(n){return r.call(this,e)}}}(e)}}function f(e,n){this.fun=e,this.array=n}function m(){}o.nextTick=function(e){var n=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)n[r-1]=arguments[r];l.push(new f(e,n)),1!==l.length||u||c(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw Error("process.chdir is not supported")},o.umask=function(){return 0}},"../../node_modules/sdp/sdp.js":function(e){"use strict";let n={};n.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},n.localCName=n.generateIdentifier(),n.splitLines=function(e){return e.trim().split("\n").map(e=>e.trim())},n.splitSections=function(e){return e.split("\nm=").map((e,n)=>(n>0?"m="+e:e).trim()+"\r\n")},n.getDescription=function(e){let r=n.splitSections(e);return r&&r[0]},n.getMediaSections=function(e){let r=n.splitSections(e);return r.shift(),r},n.matchPrefix=function(e,r){return n.splitLines(e).filter(e=>0===e.indexOf(r))},n.parseCandidate=function(e){let n,r={foundation:(n=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[n[1]]||n[1],protocol:n[2].toLowerCase(),priority:parseInt(n[3],10),ip:n[4],address:n[4],port:parseInt(n[5],10),type:n[7]};for(let e=8;e<n.length;e+=2)switch(n[e]){case"raddr":r.relatedAddress=n[e+1];break;case"rport":r.relatedPort=parseInt(n[e+1],10);break;case"tcptype":r.tcpType=n[e+1];break;case"ufrag":r.ufrag=n[e+1],r.usernameFragment=n[e+1];break;default:void 0===r[n[e]]&&(r[n[e]]=n[e+1])}return r},n.writeCandidate=function(e){let n=[];n.push(e.foundation);let r=e.component;"rtp"===r?n.push(1):"rtcp"===r?n.push(2):n.push(r),n.push(e.protocol.toUpperCase()),n.push(e.priority),n.push(e.address||e.ip),n.push(e.port);let i=e.type;return n.push("typ"),n.push(i),"host"!==i&&e.relatedAddress&&e.relatedPort&&(n.push("raddr"),n.push(e.relatedAddress),n.push("rport"),n.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(n.push("tcptype"),n.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(n.push("ufrag"),n.push(e.usernameFragment||e.ufrag)),"candidate:"+n.join(" ")},n.parseIceOptions=function(e){return e.substring(14).split(" ")},n.parseRtpMap=function(e){let n=e.substring(9).split(" "),r={payloadType:parseInt(n.shift(),10)};return r.name=(n=n[0].split("/"))[0],r.clockRate=parseInt(n[1],10),r.channels=3===n.length?parseInt(n[2],10):1,r.numChannels=r.channels,r},n.writeRtpMap=function(e){let n=e.payloadType;void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType);let r=e.channels||e.numChannels||1;return"a=rtpmap:"+n+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},n.parseExtmap=function(e){let n=e.substring(9).split(" ");return{id:parseInt(n[0],10),direction:n[0].indexOf("/")>0?n[0].split("/")[1]:"sendrecv",uri:n[1],attributes:n.slice(2).join(" ")}},n.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},n.parseFmtp=function(e){let n,r={},i=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<i.length;e++)r[(n=i[e].trim().split("="))[0].trim()]=n[1];return r},n.writeFmtp=function(e){let n="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){let i=[];Object.keys(e.parameters).forEach(n=>{void 0!==e.parameters[n]?i.push(n+"="+e.parameters[n]):i.push(n)}),n+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return n},n.parseRtcpFb=function(e){let n=e.substring(e.indexOf(" ")+1).split(" ");return{type:n.shift(),parameter:n.join(" ")}},n.writeRtcpFb=function(e){let n="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(e=>{n+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),n},n.parseSsrcMedia=function(e){let n=e.indexOf(" "),r={ssrc:parseInt(e.substring(7,n),10)},i=e.indexOf(":",n);return i>-1?(r.attribute=e.substring(n+1,i),r.value=e.substring(i+1)):r.attribute=e.substring(n+1),r},n.parseSsrcGroup=function(e){let n=e.substring(13).split(" ");return{semantics:n.shift(),ssrcs:n.map(e=>parseInt(e,10))}},n.getMid=function(e){let r=n.matchPrefix(e,"a=mid:")[0];if(r)return r.substring(6)},n.parseFingerprint=function(e){let n=e.substring(14).split(" ");return{algorithm:n[0].toLowerCase(),value:n[1].toUpperCase()}},n.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:n.matchPrefix(e+r,"a=fingerprint:").map(n.parseFingerprint)}},n.writeDtlsParameters=function(e,n){let r="a=setup:"+n+"\r\n";return e.fingerprints.forEach(e=>{r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),r},n.parseCryptoLine=function(e){let n=e.substring(9).split(" ");return{tag:parseInt(n[0],10),cryptoSuite:n[1],keyParams:n[2],sessionParams:n.slice(3)}},n.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?n.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},n.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;let n=e.substring(7).split("|");return{keyMethod:"inline",keySalt:n[0],lifeTime:n[1],mkiValue:n[2]?n[2].split(":")[0]:void 0,mkiLength:n[2]?n[2].split(":")[1]:void 0}},n.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},n.getCryptoParameters=function(e,r){return n.matchPrefix(e+r,"a=crypto:").map(n.parseCryptoLine)},n.getIceParameters=function(e,r){let i=n.matchPrefix(e+r,"a=ice-ufrag:")[0],o=n.matchPrefix(e+r,"a=ice-pwd:")[0];return i&&o?{usernameFragment:i.substring(12),password:o.substring(10)}:null},n.writeIceParameters=function(e){let n="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(n+="a=ice-lite\r\n"),n},n.parseRtpParameters=function(e){let r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=n.splitLines(e)[0].split(" ");r.profile=i[2];for(let o=3;o<i.length;o++){let s=i[o],a=n.matchPrefix(e,"a=rtpmap:"+s+" ")[0];if(a){let i=n.parseRtpMap(a),o=n.matchPrefix(e,"a=fmtp:"+s+" ");switch(i.parameters=o.length?n.parseFmtp(o[0]):{},i.rtcpFeedback=n.matchPrefix(e,"a=rtcp-fb:"+s+" ").map(n.parseRtcpFb),r.codecs.push(i),i.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(i.name.toUpperCase())}}}n.matchPrefix(e,"a=extmap:").forEach(e=>{r.headerExtensions.push(n.parseExtmap(e))});let o=n.matchPrefix(e,"a=rtcp-fb:* ").map(n.parseRtcpFb);return r.codecs.forEach(e=>{o.forEach(n=>{e.rtcpFeedback.find(e=>e.type===n.type&&e.parameter===n.parameter)||e.rtcpFeedback.push(n)})}),r},n.writeRtpDescription=function(e,r){let i="";i+="m="+e+" ",i+=r.codecs.length>0?"9":"0",i+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=r.codecs.map(e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach(e=>{i+=n.writeRtpMap(e),i+=n.writeFmtp(e),i+=n.writeRtcpFb(e)});let o=0;return r.codecs.forEach(e=>{e.maxptime>o&&(o=e.maxptime)}),o>0&&(i+="a=maxptime:"+o+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach(e=>{i+=n.writeExtmap(e)}),i},n.parseRtpEncodingParameters=function(e){let r,i=[],o=n.parseRtpParameters(e),s=-1!==o.fecMechanisms.indexOf("RED"),a=-1!==o.fecMechanisms.indexOf("ULPFEC"),c=n.matchPrefix(e,"a=ssrc:").map(e=>n.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute),l=c.length>0&&c[0].ssrc,u=n.matchPrefix(e,"a=ssrc-group:FID").map(e=>e.substring(17).split(" ").map(e=>parseInt(e,10)));u.length>0&&u[0].length>1&&u[0][0]===l&&(r=u[0][1]),o.codecs.forEach(e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let n={ssrc:l,codecPayloadType:parseInt(e.parameters.apt,10)};l&&r&&(n.rtx={ssrc:r}),i.push(n),s&&((n=JSON.parse(JSON.stringify(n))).fec={ssrc:l,mechanism:a?"red+ulpfec":"red"},i.push(n))}}),0===i.length&&l&&i.push({ssrc:l});let d=n.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substring(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substring(5),10)*.95-16e3:void 0,i.forEach(e=>{e.maxBitrate=d})),i},n.parseRtcpParameters=function(e){let r={},i=n.matchPrefix(e,"a=ssrc:").map(e=>n.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute)[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);let o=n.matchPrefix(e,"a=rtcp-rsize");return r.reducedSize=o.length>0,r.compound=0===o.length,r.mux=n.matchPrefix(e,"a=rtcp-mux").length>0,r},n.writeRtcpParameters=function(e){let n="";return e.reducedSize&&(n+="a=rtcp-rsize\r\n"),e.mux&&(n+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(n+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),n},n.parseMsid=function(e){let r,i=n.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(r=i[0].substring(7).split(" "))[0],track:r[1]};let o=n.matchPrefix(e,"a=ssrc:").map(e=>n.parseSsrcMedia(e)).filter(e=>"msid"===e.attribute);if(o.length>0)return{stream:(r=o[0].value.split(" "))[0],track:r[1]}},n.parseSctpDescription=function(e){let r,i=n.parseMLine(e),o=n.matchPrefix(e,"a=max-message-size:");o.length>0&&(r=parseInt(o[0].substring(19),10)),isNaN(r)&&(r=65536);let s=n.matchPrefix(e,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substring(12),10),protocol:i.fmt,maxMessageSize:r};let a=n.matchPrefix(e,"a=sctpmap:");if(a.length>0){let e=a[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:r}}},n.writeSctpDescription=function(e,n){let r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+n.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+n.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+n.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+n.port+" "+n.protocol+" 65535\r\n"],void 0!==n.maxMessageSize&&r.push("a=max-message-size:"+n.maxMessageSize+"\r\n"),r.join("")},n.generateSessionId=function(){return Math.random().toString().substr(2,22)},n.writeSessionBoilerplate=function(e,r,i){return"v=0\r\no="+(i||"thisisadapterortc")+" "+(e||n.generateSessionId())+" "+(void 0!==r?r:2)+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},n.getDirection=function(e,r){let i=n.splitLines(e);for(let e=0;e<i.length;e++)switch(i[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[e].substring(2)}return r?n.getDirection(r):"sendrecv"},n.getKind=function(e){return n.splitLines(e)[0].split(" ")[0].substring(2)},n.isRejected=function(e){return"0"===e.split(" ",2)[1]},n.parseMLine=function(e){let r=n.splitLines(e)[0].substring(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},n.parseOLine=function(e){let r=n.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},n.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;let r=n.splitLines(e);for(let e=0;e<r.length;e++)if(r[e].length<2||"="!==r[e].charAt(1))return!1;return!0},e.exports=n},"../../node_modules/typewriter-effect/dist/core.js":function(e,n,r){var i,o=r("../../node_modules/process/browser.js");"undefined"!=typeof self&&self,e.exports=(()=>{var e={3146:(e,n,r)=>{for(var i=r(3491),o="undefined"==typeof window?r.g:window,s=["moz","webkit"],a="AnimationFrame",c=o["request"+a],l=o["cancel"+a]||o["cancelRequest"+a],u=0;!c&&u<s.length;u++)c=o[s[u]+"Request"+a],l=o[s[u]+"Cancel"+a]||o[s[u]+"CancelRequest"+a];if(!c||!l){var d=0,p=0,h=[],f=1e3/60;c=function(e){if(0===h.length){var n=i(),r=Math.max(0,f-(n-d));d=r+n,setTimeout(function(){var e=h.slice(0);h.length=0;for(var n=0;n<e.length;n++)if(!e[n].cancelled)try{e[n].callback(d)}catch(e){setTimeout(function(){throw e},0)}},Math.round(r))}return h.push({handle:++p,callback:e,cancelled:!1}),p},l=function(e){for(var n=0;n<h.length;n++)h[n].handle===e&&(h[n].cancelled=!0)}}e.exports=function(e){return c.call(o,e)},e.exports.cancel=function(){l.apply(o,arguments)},e.exports.polyfill=function(e){e||(e=o),e.requestAnimationFrame=c,e.cancelAnimationFrame=l}},3491:function(e){(function(){var n,r,i,s;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:null!=o&&o.hrtime?(e.exports=function(){return(n()-s)/1e6},r=o.hrtime,s=(n=function(){var e;return 1e9*(e=r())[0]+e[1]})()-1e9*o.uptime()):Date.now?(e.exports=function(){return Date.now()-i},i=Date.now()):(e.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(this)}},n={};function r(i){var o=n[i];if(void 0!==o)return o.exports;var s=n[i]={exports:{}};return e[i].call(s.exports,s,s.exports,r),s.exports}r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},r.d=(e,n)=>{for(var i in n)r.o(n,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);var i={};return(()=>{"use strict";r.d(i,{default:()=>T});var e=r(3146),n=r.n(e);let o=function(e){return new RegExp(/<[a-z][\s\S]*>/i).test(e)},s=function(e,n){return Math.floor(Math.random()*(n-e+1))+e};var a="TYPE_CHARACTER",c="REMOVE_CHARACTER",l="REMOVE_ALL",u="REMOVE_LAST_VISIBLE_NODE",d="PAUSE_FOR",p="CALL_FUNCTION",h="ADD_HTML_TAG_ELEMENT",f="CHANGE_DELETE_SPEED",m="CHANGE_DELAY",g="CHANGE_CURSOR",v="PASTE_STRING",y="HTML_TAG";function b(e){return(b="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})(e)}function _(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function w(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?_(Object(r),!0).forEach(function(n){S(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function O(e){return function(e){if(Array.isArray(e))return R(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(e){if("string"==typeof e)return R(e,void 0);var r=({}).toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?R(e,void 0):void 0}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function S(e,n,r){return(n=E(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function E(e){var n=function(e){if("object"!=b(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=b(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==b(n)?n:n+""}let T=function(){var r;function i(r,b){var _=this;if(function(e,n){if(!(e instanceof n))throw TypeError("Cannot call a class as a function")}(this,i),S(this,"state",{cursorAnimation:null,lastFrameTime:null,pauseUntil:null,eventQueue:[],eventLoop:null,eventLoopPaused:!1,reverseCalledEvents:[],calledEvents:[],visibleNodes:[],initialOptions:null,elements:{container:null,wrapper:document.createElement("span"),cursor:document.createElement("span")}}),S(this,"options",{strings:null,cursor:"|",delay:"natural",pauseFor:1500,deleteSpeed:"natural",loop:!1,autoStart:!1,devMode:!1,skipAddStyles:!1,wrapperClassName:"Typewriter__wrapper",cursorClassName:"Typewriter__cursor",stringSplitter:null,onCreateTextNode:null,onRemoveNode:null}),S(this,"setupWrapperElement",function(){_.state.elements.container&&(_.state.elements.wrapper.className=_.options.wrapperClassName,_.state.elements.cursor.className=_.options.cursorClassName,_.state.elements.cursor.innerHTML=_.options.cursor,_.state.elements.container.innerHTML="",_.state.elements.container.appendChild(_.state.elements.wrapper),_.state.elements.container.appendChild(_.state.elements.cursor))}),S(this,"start",function(){return _.state.eventLoopPaused=!1,_.runEventLoop(),_}),S(this,"pause",function(){return _.state.eventLoopPaused=!0,_}),S(this,"stop",function(){return _.state.eventLoop&&((0,e.cancel)(_.state.eventLoop),_.state.eventLoop=null),_}),S(this,"pauseFor",function(e){return _.addEventToQueue(d,{ms:e}),_}),S(this,"typeOutAllStrings",function(){return"string"==typeof _.options.strings?_.typeString(_.options.strings).pauseFor(_.options.pauseFor):_.options.strings.forEach(function(e){_.typeString(e).pauseFor(_.options.pauseFor).deleteAll(_.options.deleteSpeed)}),_}),S(this,"typeString",function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(o(e))return _.typeOutHTMLString(e,n);if(e){var r=(_.options||{}).stringSplitter,i="function"==typeof r?r(e):e.split("");_.typeCharacters(i,n)}return _}),S(this,"pasteString",function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return o(e)?_.typeOutHTMLString(e,n,!0):(e&&_.addEventToQueue(v,{character:e,node:n}),_)}),S(this,"typeOutHTMLString",function(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0,o=((n=document.createElement("div")).innerHTML=e,n.childNodes);if(o.length>0)for(var s=0;s<o.length;s++){var a=o[s],c=a.innerHTML;a&&3!==a.nodeType?(a.innerHTML="",_.addEventToQueue(h,{node:a,parentNode:r}),i?_.pasteString(c,a):_.typeString(c,a)):a.textContent&&(i?_.pasteString(a.textContent,r):_.typeString(a.textContent,r))}return _}),S(this,"deleteAll",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"natural";return _.addEventToQueue(l,{speed:e}),_}),S(this,"changeDeleteSpeed",function(e){if(!e)throw Error("Must provide new delete speed");return _.addEventToQueue(f,{speed:e}),_}),S(this,"changeDelay",function(e){if(!e)throw Error("Must provide new delay");return _.addEventToQueue(m,{delay:e}),_}),S(this,"changeCursor",function(e){if(!e)throw Error("Must provide new cursor");return _.addEventToQueue(g,{cursor:e}),_}),S(this,"deleteChars",function(e){if(!e)throw Error("Must provide amount of characters to delete");for(var n=0;n<e;n++)_.addEventToQueue(c);return _}),S(this,"callFunction",function(e,n){if(!e||"function"!=typeof e)throw Error("Callback must be a function");return _.addEventToQueue(p,{cb:e,thisArg:n}),_}),S(this,"typeCharacters",function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e||!Array.isArray(e))throw Error("Characters must be an array");return e.forEach(function(e){_.addEventToQueue(a,{character:e,node:n})}),_}),S(this,"removeCharacters",function(e){if(!e||!Array.isArray(e))throw Error("Characters must be an array");return e.forEach(function(){_.addEventToQueue(c)}),_}),S(this,"addEventToQueue",function(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return _.addEventToStateProperty(e,n,r,"eventQueue")}),S(this,"addReverseCalledEvent",function(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return _.options.loop?_.addEventToStateProperty(e,n,r,"reverseCalledEvents"):_}),S(this,"addEventToStateProperty",function(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0,o={eventName:e,eventArgs:n||{}};return _.state[i]=r?[o].concat(O(_.state[i])):[].concat(O(_.state[i]),[o]),_}),S(this,"runEventLoop",function(){_.state.lastFrameTime||(_.state.lastFrameTime=Date.now());var e=Date.now(),r=e-_.state.lastFrameTime;if(!_.state.eventQueue.length){if(!_.options.loop)return;_.state.eventQueue=O(_.state.calledEvents),_.state.calledEvents=[],_.options=w({},_.state.initialOptions)}if(_.state.eventLoop=n()(_.runEventLoop),!_.state.eventLoopPaused){if(_.state.pauseUntil){if(e<_.state.pauseUntil)return;_.state.pauseUntil=null}var i,o=O(_.state.eventQueue),b=o.shift();if(!(r<=(i=b.eventName===u||b.eventName===c?"natural"===_.options.deleteSpeed?s(40,80):_.options.deleteSpeed:"natural"===_.options.delay?s(120,160):_.options.delay))){var R=b.eventName,S=b.eventArgs;switch(_.logInDevMode({currentEvent:b,state:_.state,delay:i}),R){case v:case a:var E=S.character,T=S.node,M=document.createTextNode(E),x=M;_.options.onCreateTextNode&&"function"==typeof _.options.onCreateTextNode&&(x=_.options.onCreateTextNode(E,M)),x&&(T?T.appendChild(x):_.state.elements.wrapper.appendChild(x)),_.state.visibleNodes=[].concat(O(_.state.visibleNodes),[{type:"TEXT_NODE",character:E,node:x}]);break;case c:o.unshift({eventName:u,eventArgs:{removingCharacterNode:!0}});break;case d:var C=b.eventArgs.ms;_.state.pauseUntil=Date.now()+parseInt(C);break;case p:var I=b.eventArgs,j=I.cb,A=I.thisArg;j.call(A,{elements:_.state.elements});break;case h:var B=b.eventArgs,k=B.node,P=B.parentNode;P?P.appendChild(k):_.state.elements.wrapper.appendChild(k),_.state.visibleNodes=[].concat(O(_.state.visibleNodes),[{type:y,node:k,parentNode:P||_.state.elements.wrapper}]);break;case l:var N=_.state.visibleNodes,D=S.speed,L=[];D&&L.push({eventName:f,eventArgs:{speed:D,temp:!0}});for(var F=0,U=N.length;F<U;F++)L.push({eventName:u,eventArgs:{removingCharacterNode:!1}});D&&L.push({eventName:f,eventArgs:{speed:_.options.deleteSpeed,temp:!0}}),o.unshift.apply(o,L);break;case u:var H=b.eventArgs.removingCharacterNode;if(_.state.visibleNodes.length){var q=_.state.visibleNodes.pop(),V=q.type,X=q.node,W=q.character;_.options.onRemoveNode&&"function"==typeof _.options.onRemoveNode&&_.options.onRemoveNode({node:X,character:W}),X&&X.parentNode.removeChild(X),V===y&&H&&o.unshift({eventName:u,eventArgs:{}})}break;case f:_.options.deleteSpeed=b.eventArgs.speed;break;case m:_.options.delay=b.eventArgs.delay;break;case g:_.options.cursor=b.eventArgs.cursor,_.state.elements.cursor.innerHTML=b.eventArgs.cursor}_.options.loop&&(b.eventName===u||b.eventArgs&&b.eventArgs.temp||(_.state.calledEvents=[].concat(O(_.state.calledEvents),[b]))),_.state.eventQueue=o,_.state.lastFrameTime=e}}}),r)if("string"==typeof r){var R=document.querySelector(r);if(!R)throw Error("Could not find container element");this.state.elements.container=R}else this.state.elements.container=r;b&&(this.options=w(w({},this.options),b)),this.state.initialOptions=w({},this.options),this.init()}return r=[{key:"init",value:function(){var e;this.setupWrapperElement(),this.addEventToQueue(g,{cursor:this.options.cursor},!0),this.addEventToQueue(l,null,!0),!window||window.___TYPEWRITER_JS_STYLES_ADDED___||this.options.skipAddStyles||((e=document.createElement("style")).appendChild(document.createTextNode(".Typewriter__cursor{-webkit-animation:Typewriter-cursor 1s infinite;animation:Typewriter-cursor 1s infinite;margin-left:1px}@-webkit-keyframes Typewriter-cursor{0%{opacity:0}50%{opacity:1}100%{opacity:0}}@keyframes Typewriter-cursor{0%{opacity:0}50%{opacity:1}100%{opacity:0}}")),document.head.appendChild(e),window.___TYPEWRITER_JS_STYLES_ADDED___=!0),!0===this.options.autoStart&&this.options.strings&&this.typeOutAllStrings().start()}},{key:"logInDevMode",value:function(e){this.options.devMode&&console.log(e)}}],function(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,E(i.key),i)}}(i.prototype,r),Object.defineProperty(i,"prototype",{writable:!1}),i}()})(),i.default})()},"../../node_modules/ua-parser-js/src/ua-parser.js":function(e,n){!function(r,i){"use strict";var o="function",s="undefined",a="object",c="string",l="major",u="model",d="name",p="type",h="vendor",f="version",m="architecture",g="console",v="mobile",y="tablet",b="smarttv",_="wearable",w="embedded",O="Amazon",R="Apple",S="ASUS",E="BlackBerry",T="Browser",M="Chrome",x="Firefox",C="Google",I="Huawei",j="Microsoft",A="Motorola",B="Opera",k="Samsung",P="Sharp",N="Sony",D="Xiaomi",L="Zebra",F="Facebook",U="Chromium OS",H="Mac OS",q=" Browser",V=function(e,n){var r={};for(var i in e)n[i]&&n[i].length%2==0?r[i]=n[i].concat(e[i]):r[i]=e[i];return r},X=function(e){for(var n={},r=0;r<e.length;r++)n[e[r].toUpperCase()]=e[r];return n},W=function(e,n){return typeof e===c&&-1!==$(n).indexOf($(e))},$=function(e){return e.toLowerCase()},z=function(e,n){if(typeof e===c)return e=e.replace(/^\s\s*/,""),typeof n===s?e:e.substring(0,500)},G=function(e,n){for(var r,s,c,l,u,d,p=0;p<n.length&&!u;){var h=n[p],f=n[p+1];for(r=s=0;r<h.length&&!u&&h[r];)if(u=h[r++].exec(e))for(c=0;c<f.length;c++)d=u[++s],typeof(l=f[c])===a&&l.length>0?2===l.length?typeof l[1]==o?this[l[0]]=l[1].call(this,d):this[l[0]]=l[1]:3===l.length?typeof l[1]!==o||l[1].exec&&l[1].test?this[l[0]]=d?d.replace(l[1],l[2]):void 0:this[l[0]]=d?l[1].call(this,d,l[2]):void 0:4===l.length&&(this[l[0]]=d?l[3].call(this,d.replace(l[1],l[2])):i):this[l]=d||i;p+=2}},Y=function(e,n){for(var r in n)if(typeof n[r]===a&&n[r].length>0){for(var o=0;o<n[r].length;o++)if(W(n[r][o],e))return"?"===r?i:r}else if(W(n[r],e))return"?"===r?i:r;return n.hasOwnProperty("*")?n["*"]:e},Q={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},J={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[d,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[d,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[d,f],[/opios[\/ ]+([\w\.]+)/i],[f,[d,B+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[f,[d,B+" GX"]],[/\bopr\/([\w\.]+)/i],[f,[d,B]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[f,[d,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[f,[d,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[d,f],[/quark(?:pc)?\/([-\w\.]+)/i],[f,[d,"Quark"]],[/\bddg\/([\w\.]+)/i],[f,[d,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[d,"UC"+T]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[f,[d,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[d,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[d,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[f,[d,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[f,[d,"Smart Lenovo "+T]],[/(avast|avg)\/([\w\.]+)/i],[[d,/(.+)/,"$1 Secure "+T],f],[/\bfocus\/([\w\.]+)/i],[f,[d,x+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[d,B+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[d,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[d,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[d,B+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[d,"MIUI"+q]],[/fxios\/([\w\.-]+)/i],[f,[d,x]],[/\bqihoobrowser\/?([\w\.]*)/i],[f,[d,"360"]],[/\b(qq)\/([\w\.]+)/i],[[d,/(.+)/,"$1Browser"],f],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[d,/(.+)/,"$1"+q],f],[/samsungbrowser\/([\w\.]+)/i],[f,[d,k+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[f,[d,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[d,"Sogou Mobile"],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[d,f],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[d],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[f,d],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[d,F],f],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[d,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[d,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[f,[d,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[d,M+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[d,M+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[d,"Android "+T]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[d,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[d,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,d],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[d,[f,Y,{"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[d,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[d,"Netscape"],f],[/(wolvic|librewolf)\/([\w\.]+)/i],[d,f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[d,x+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[d,[f,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[d,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[m,"amd64"]],[/(ia32(?=;))/i],[[m,$]],[/((?:i[346]|x)86)[;\)]/i],[[m,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[m,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[m,"armhf"]],[/windows (ce|mobile); ppc;/i],[[m,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[m,/ower/,"",$]],[/(sun4\w)[;\)]/i],[[m,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[m,$]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[h,k],[p,y]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[u,[h,k],[p,v]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[u,[h,R],[p,v]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[h,R],[p,y]],[/(macintosh);/i],[u,[h,R]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[h,P],[p,v]],[/(?:honor)([-\w ]+)[;\)]/i],[u,[h,"Honor"],[p,v]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[h,I],[p,y]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[h,I],[p,v]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[u,/_/g," "],[h,D],[p,v]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[h,D],[p,y]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[h,"OPPO"],[p,v]],[/\b(opd2\d{3}a?) bui/i],[u,[h,"OPPO"],[p,y]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[h,"Vivo"],[p,v]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[u,[h,"Realme"],[p,v]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[h,A],[p,v]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[h,A],[p,y]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[h,"LG"],[p,y]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[h,"LG"],[p,v]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[h,"Lenovo"],[p,y]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[h,"Nokia"],[p,v]],[/(pixel c)\b/i],[u,[h,C],[p,y]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[h,C],[p,v]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[h,N],[p,v]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[h,N],[p,y]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[h,"OnePlus"],[p,v]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[h,O],[p,y]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[h,O],[p,v]],[/(playbook);[-\w\),; ]+(rim)/i],[u,h,[p,y]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[h,E],[p,v]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[h,S],[p,y]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[h,S],[p,v]],[/(nexus 9)/i],[u,[h,"HTC"],[p,y]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[u,/_/g," "],[p,v]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[u,[h,"TCL"],[p,y]],[/(itel) ((\w+))/i],[[h,$],u,[p,Y,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[h,"Acer"],[p,y]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[h,"Meizu"],[p,v]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[u,[h,"Ulefone"],[p,v]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[u,[h,"Energizer"],[p,v]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[u,[h,"Cat"],[p,v]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[u,[h,"Smartfren"],[p,v]],[/droid.+; (a(?:015|06[35]|142p?))/i],[u,[h,"Nothing"],[p,v]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[h,u,[p,v]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[h,u,[p,y]],[/(surface duo)/i],[u,[h,j],[p,y]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[h,"Fairphone"],[p,v]],[/(u304aa)/i],[u,[h,"AT&T"],[p,v]],[/\bsie-(\w*)/i],[u,[h,"Siemens"],[p,v]],[/\b(rct\w+) b/i],[u,[h,"RCA"],[p,y]],[/\b(venue[\d ]{2,7}) b/i],[u,[h,"Dell"],[p,y]],[/\b(q(?:mv|ta)\w+) b/i],[u,[h,"Verizon"],[p,y]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[h,"Barnes & Noble"],[p,y]],[/\b(tm\d{3}\w+) b/i],[u,[h,"NuVision"],[p,y]],[/\b(k88) b/i],[u,[h,"ZTE"],[p,y]],[/\b(nx\d{3}j) b/i],[u,[h,"ZTE"],[p,v]],[/\b(gen\d{3}) b.+49h/i],[u,[h,"Swiss"],[p,v]],[/\b(zur\d{3}) b/i],[u,[h,"Swiss"],[p,y]],[/\b((zeki)?tb.*\b) b/i],[u,[h,"Zeki"],[p,y]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,"Dragon Touch"],u,[p,y]],[/\b(ns-?\w{0,9}) b/i],[u,[h,"Insignia"],[p,y]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[h,"NextBook"],[p,y]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,"Voice"],u,[p,v]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],u,[p,v]],[/\b(ph-1) /i],[u,[h,"Essential"],[p,v]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[h,"Envizen"],[p,y]],[/\b(trio[-\w\. ]+) b/i],[u,[h,"MachSpeed"],[p,y]],[/\btu_(1491) b/i],[u,[h,"Rotor"],[p,y]],[/(shield[\w ]+) b/i],[u,[h,"Nvidia"],[p,y]],[/(sprint) (\w+)/i],[h,u,[p,v]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[h,j],[p,v]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[h,L],[p,y]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[h,L],[p,v]],[/smart-tv.+(samsung)/i],[h,[p,b]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[h,k],[p,b]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,"LG"],[p,b]],[/(apple) ?tv/i],[h,[u,R+" TV"],[p,b]],[/crkey/i],[[u,M+"cast"],[h,C],[p,b]],[/droid.+aft(\w+)( bui|\))/i],[u,[h,O],[p,b]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[h,P],[p,b]],[/(bravia[\w ]+)( bui|\))/i],[u,[h,N],[p,b]],[/(mitv-\w{5}) bui/i],[u,[h,D],[p,b]],[/Hbbtv.*(technisat) (.*);/i],[h,u,[p,b]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[h,z],[u,z],[p,b]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[p,b]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,u,[p,g]],[/droid.+; (shield) bui/i],[u,[h,"Nvidia"],[p,g]],[/(playstation [345portablevi]+)/i],[u,[h,N],[p,g]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[h,j],[p,g]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[u,[h,k],[p,_]],[/((pebble))app/i],[h,u,[p,_]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[h,R],[p,_]],[/droid.+; (glass) \d/i],[u,[h,C],[p,_]],[/droid.+; (wt63?0{2,3})\)/i],[u,[h,L],[p,_]],[/droid.+; (glass) \d/i],[u,[h,C],[p,_]],[/(pico) (4|neo3(?: link|pro)?)/i],[h,u,[p,_]],[/; (quest( \d| pro)?)/i],[u,[h,F],[p,_]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[p,w]],[/(aeobc)\b/i],[u,[h,O],[p,w]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[u,[p,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[p,y]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[p,y]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[p,v]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[d,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[d,f],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[d,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[d,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,d]],os:[[/microsoft (windows) (vista|xp)/i],[d,f],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[d,[f,Y,Q]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[f,Y,Q],[d,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[d,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[d,H],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,d],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[d,f],[/\(bb(10);/i],[f,[d,E]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[d,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[d,x+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[d,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[f,[d,"watchOS"]],[/crkey\/([\d\.]+)/i],[f,[d,M+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[d,U],f],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[d,f],[/(sunos) ?([\w\.\d]*)/i],[[d,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[d,f]]},K=function(e,n){if(typeof e===a&&(n=e,e=i),!(this instanceof K))return new K(e,n).getResult();var g=typeof r!==s&&r.navigator?r.navigator:i,b=e||(g&&g.userAgent?g.userAgent:""),_=g&&g.userAgentData?g.userAgentData:i,w=n?V(J,n):J,O=g&&g.userAgent==b;return this.getBrowser=function(){var e,n={};return n[d]=i,n[f]=i,G.call(n,b,w.browser),n[l]=typeof(e=n[f])===c?e.replace(/[^\d\.]/g,"").split(".")[0]:i,O&&g&&g.brave&&typeof g.brave.isBrave==o&&(n[d]="Brave"),n},this.getCPU=function(){var e={};return e[m]=i,G.call(e,b,w.cpu),e},this.getDevice=function(){var e={};return e[h]=i,e[u]=i,e[p]=i,G.call(e,b,w.device),O&&!e[p]&&_&&_.mobile&&(e[p]=v),O&&"Macintosh"==e[u]&&g&&typeof g.standalone!==s&&g.maxTouchPoints&&g.maxTouchPoints>2&&(e[u]="iPad",e[p]=y),e},this.getEngine=function(){var e={};return e[d]=i,e[f]=i,G.call(e,b,w.engine),e},this.getOS=function(){var e={};return e[d]=i,e[f]=i,G.call(e,b,w.os),O&&!e[d]&&_&&_.platform&&"Unknown"!=_.platform&&(e[d]=_.platform.replace(/chrome os/i,U).replace(/macos/i,H)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return b},this.setUA=function(e){return b=typeof e===c&&e.length>500?z(e,500):e,this},this.setUA(b),this};K.VERSION="1.0.40",K.BROWSER=X([d,f,l]),K.CPU=X([m]),K.DEVICE=X([u,h,p,g,v,b,y,_,w]),K.ENGINE=K.OS=X([d,f]),typeof n!==s?(e.exports&&(n=e.exports=K),n.UAParser=K):typeof define===o&&define.amd?define(function(){return K}):typeof r!==s&&(r.UAParser=K);var Z=typeof r!==s&&(r.jQuery||r.Zepto);if(Z&&!Z.ua){var ee=new K;Z.ua=ee.getResult(),Z.ua.get=function(){return ee.getUA()},Z.ua.set=function(e){ee.setUA(e);var n=ee.getResult();for(var r in n)Z.ua[r]=n[r]}}}("object"==typeof window?window:this)},"../../node_modules/core-js/internals/a-callable.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/is-callable.js"),o=r("../../node_modules/core-js/internals/try-to-string.js"),s=TypeError;e.exports=function(e){if(i(e))return e;throw new s(o(e)+" is not a function")}},"../../node_modules/core-js/internals/a-possible-prototype.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/is-possible-prototype.js"),o=String,s=TypeError;e.exports=function(e){if(i(e))return e;throw new s("Can't set "+o(e)+" as a prototype")}},"../../node_modules/core-js/internals/add-to-unscopables.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/well-known-symbol.js"),o=r("../../node_modules/core-js/internals/object-create.js"),s=r("../../node_modules/core-js/internals/object-define-property.js").f,a=i("unscopables"),c=Array.prototype;void 0===c[a]&&s(c,a,{configurable:!0,value:o(null)}),e.exports=function(e){c[a][e]=!0}},"../../node_modules/core-js/internals/an-object.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/is-object.js"),o=String,s=TypeError;e.exports=function(e){if(i(e))return e;throw new s(o(e)+" is not an object")}},"../../node_modules/core-js/internals/array-buffer-basic-detection.js":function(e){"use strict";e.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},"../../node_modules/core-js/internals/array-buffer-view-core.js":function(e,n,r){"use strict";var i,o,s,a=r("../../node_modules/core-js/internals/array-buffer-basic-detection.js"),c=r("../../node_modules/core-js/internals/descriptors.js"),l=r("../../node_modules/core-js/internals/global-this.js"),u=r("../../node_modules/core-js/internals/is-callable.js"),d=r("../../node_modules/core-js/internals/is-object.js"),p=r("../../node_modules/core-js/internals/has-own-property.js"),h=r("../../node_modules/core-js/internals/classof.js"),f=r("../../node_modules/core-js/internals/try-to-string.js"),m=r("../../node_modules/core-js/internals/create-non-enumerable-property.js"),g=r("../../node_modules/core-js/internals/define-built-in.js"),v=r("../../node_modules/core-js/internals/define-built-in-accessor.js"),y=r("../../node_modules/core-js/internals/object-is-prototype-of.js"),b=r("../../node_modules/core-js/internals/object-get-prototype-of.js"),_=r("../../node_modules/core-js/internals/object-set-prototype-of.js"),w=r("../../node_modules/core-js/internals/well-known-symbol.js"),O=r("../../node_modules/core-js/internals/uid.js"),R=r("../../node_modules/core-js/internals/internal-state.js"),S=R.enforce,E=R.get,T=l.Int8Array,M=T&&T.prototype,x=l.Uint8ClampedArray,C=x&&x.prototype,I=T&&b(T),j=M&&b(M),A=Object.prototype,B=l.TypeError,k=w("toStringTag"),P=O("TYPED_ARRAY_TAG"),N="TypedArrayConstructor",D=a&&!!_&&"Opera"!==h(l.opera),L=!1,F={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},U={BigInt64Array:8,BigUint64Array:8},H=function(e){var n=b(e);if(d(n)){var r=E(n);return r&&p(r,N)?r[N]:H(n)}},q=function(e){if(!d(e))return!1;var n=h(e);return p(F,n)||p(U,n)};for(i in F)(s=(o=l[i])&&o.prototype)?S(s)[N]=o:D=!1;for(i in U)(s=(o=l[i])&&o.prototype)&&(S(s)[N]=o);if((!D||!u(I)||I===Function.prototype)&&(I=function(){throw new B("Incorrect invocation")},D))for(i in F)l[i]&&_(l[i],I);if((!D||!j||j===A)&&(j=I.prototype,D))for(i in F)l[i]&&_(l[i].prototype,j);if(D&&b(C)!==j&&_(C,j),c&&!p(j,k))for(i in L=!0,v(j,k,{configurable:!0,get:function(){return d(this)?this[P]:void 0}}),F)l[i]&&m(l[i],P,i);e.exports={NATIVE_ARRAY_BUFFER_VIEWS:D,TYPED_ARRAY_TAG:L&&P,aTypedArray:function(e){if(q(e))return e;throw new B("Target is not a typed array")},aTypedArrayConstructor:function(e){if(u(e)&&(!_||y(I,e)))return e;throw new B(f(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,n,r,i){if(c){if(r)for(var o in F){var s=l[o];if(s&&p(s.prototype,e))try{delete s.prototype[e]}catch(r){try{s.prototype[e]=n}catch(e){}}}(!j[e]||r)&&g(j,e,r?n:D&&M[e]||n,i)}},exportTypedArrayStaticMethod:function(e,n,r){var i,o;if(c){if(_){if(r){for(i in F)if((o=l[i])&&p(o,e))try{delete o[e]}catch(e){}}if(I[e]&&!r)return;try{return g(I,e,r?n:D&&I[e]||n)}catch(e){}}for(i in F)(o=l[i])&&(!o[e]||r)&&g(o,e,n)}},getTypedArrayConstructor:H,isView:function(e){if(!d(e))return!1;var n=h(e);return"DataView"===n||p(F,n)||p(U,n)},isTypedArray:q,TypedArray:I,TypedArrayPrototype:j}},"../../node_modules/core-js/internals/array-includes.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/to-indexed-object.js"),o=r("../../node_modules/core-js/internals/to-absolute-index.js"),s=r("../../node_modules/core-js/internals/length-of-array-like.js"),a=function(e){return function(n,r,a){var c,l=i(n),u=s(l);if(0===u)return!e&&-1;var d=o(a,u);if(e&&r!=r){for(;u>d;)if((c=l[d++])!=c)return!0}else for(;u>d;d++)if((e||d in l)&&l[d]===r)return e||d||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},"../../node_modules/core-js/internals/array-method-is-strict.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/fails.js");e.exports=function(e,n){var r=[][e];return!!r&&i(function(){r.call(null,n||function(){return 1},1)})}},"../../node_modules/core-js/internals/array-reduce.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/a-callable.js"),o=r("../../node_modules/core-js/internals/to-object.js"),s=r("../../node_modules/core-js/internals/indexed-object.js"),a=r("../../node_modules/core-js/internals/length-of-array-like.js"),c=TypeError,l="Reduce of empty array with no initial value",u=function(e){return function(n,r,u,d){var p=o(n),h=s(p),f=a(p);if(i(r),0===f&&u<2)throw new c(l);var m=e?f-1:0,g=e?-1:1;if(u<2)for(;;){if(m in h){d=h[m],m+=g;break}if(m+=g,e?m<0:f<=m)throw new c(l)}for(;e?m>=0:f>m;m+=g)m in h&&(d=r(d,h[m],m,p));return d}};e.exports={left:u(!1),right:u(!0)}},"../../node_modules/core-js/internals/classof-raw.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this.js"),o=i({}.toString),s=i("".slice);e.exports=function(e){return s(o(e),8,-1)}},"../../node_modules/core-js/internals/classof.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/to-string-tag-support.js"),o=r("../../node_modules/core-js/internals/is-callable.js"),s=r("../../node_modules/core-js/internals/classof-raw.js"),a=r("../../node_modules/core-js/internals/well-known-symbol.js")("toStringTag"),c=Object,l="Arguments"===s(function(){return arguments}()),u=function(e,n){try{return e[n]}catch(e){}};e.exports=i?s:function(e){var n,r,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=u(n=c(e),a))?r:l?s(n):"Object"===(i=s(n))&&o(n.callee)?"Arguments":i}},"../../node_modules/core-js/internals/copy-constructor-properties.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/has-own-property.js"),o=r("../../node_modules/core-js/internals/own-keys.js"),s=r("../../node_modules/core-js/internals/object-get-own-property-descriptor.js"),a=r("../../node_modules/core-js/internals/object-define-property.js");e.exports=function(e,n,r){for(var c=o(n),l=a.f,u=s.f,d=0;d<c.length;d++){var p=c[d];i(e,p)||r&&i(r,p)||l(e,p,u(n,p))}}},"../../node_modules/core-js/internals/correct-prototype-getter.js":function(e,n,r){"use strict";e.exports=!r("../../node_modules/core-js/internals/fails.js")(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})},"../../node_modules/core-js/internals/create-non-enumerable-property.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/descriptors.js"),o=r("../../node_modules/core-js/internals/object-define-property.js"),s=r("../../node_modules/core-js/internals/create-property-descriptor.js");e.exports=i?function(e,n,r){return o.f(e,n,s(1,r))}:function(e,n,r){return e[n]=r,e}},"../../node_modules/core-js/internals/create-property-descriptor.js":function(e){"use strict";e.exports=function(e,n){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:n}}},"../../node_modules/core-js/internals/define-built-in-accessor.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/make-built-in.js"),o=r("../../node_modules/core-js/internals/object-define-property.js");e.exports=function(e,n,r){return r.get&&i(r.get,n,{getter:!0}),r.set&&i(r.set,n,{setter:!0}),o.f(e,n,r)}},"../../node_modules/core-js/internals/define-built-in.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/is-callable.js"),o=r("../../node_modules/core-js/internals/object-define-property.js"),s=r("../../node_modules/core-js/internals/make-built-in.js"),a=r("../../node_modules/core-js/internals/define-global-property.js");e.exports=function(e,n,r,c){c||(c={});var l=c.enumerable,u=void 0!==c.name?c.name:n;if(i(r)&&s(r,u,c),c.global)l?e[n]=r:a(n,r);else{try{c.unsafe?e[n]&&(l=!0):delete e[n]}catch(e){}l?e[n]=r:o.f(e,n,{value:r,enumerable:!1,configurable:!c.nonConfigurable,writable:!c.nonWritable})}return e}},"../../node_modules/core-js/internals/define-global-property.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js"),o=Object.defineProperty;e.exports=function(e,n){try{o(i,e,{value:n,configurable:!0,writable:!0})}catch(r){i[e]=n}return n}},"../../node_modules/core-js/internals/descriptors.js":function(e,n,r){"use strict";e.exports=!r("../../node_modules/core-js/internals/fails.js")(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},"../../node_modules/core-js/internals/document-create-element.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js"),o=r("../../node_modules/core-js/internals/is-object.js"),s=i.document,a=o(s)&&o(s.createElement);e.exports=function(e){return a?s.createElement(e):{}}},"../../node_modules/core-js/internals/enum-bug-keys.js":function(e){"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},"../../node_modules/core-js/internals/environment-is-node.js":function(e,n,r){"use strict";e.exports="NODE"===r("../../node_modules/core-js/internals/environment.js")},"../../node_modules/core-js/internals/environment-user-agent.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js").navigator,o=i&&i.userAgent;e.exports=o?String(o):""},"../../node_modules/core-js/internals/environment-v8-version.js":function(e,n,r){"use strict";var i,o,s=r("../../node_modules/core-js/internals/global-this.js"),a=r("../../node_modules/core-js/internals/environment-user-agent.js"),c=s.process,l=s.Deno,u=c&&c.versions||l&&l.version,d=u&&u.v8;d&&(o=(i=d.split("."))[0]>0&&i[0]<4?1:+(i[0]+i[1])),!o&&a&&(!(i=a.match(/Edge\/(\d+)/))||i[1]>=74)&&(i=a.match(/Chrome\/(\d+)/))&&(o=+i[1]),e.exports=o},"../../node_modules/core-js/internals/environment.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js"),o=r("../../node_modules/core-js/internals/environment-user-agent.js"),s=r("../../node_modules/core-js/internals/classof-raw.js"),a=function(e){return o.slice(0,e.length)===e};e.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":i.Bun&&"string"==typeof Bun.version?"BUN":i.Deno&&"object"==typeof Deno.version?"DENO":"process"===s(i.process)?"NODE":i.window&&i.document?"BROWSER":"REST"},"../../node_modules/core-js/internals/export.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js"),o=r("../../node_modules/core-js/internals/object-get-own-property-descriptor.js").f,s=r("../../node_modules/core-js/internals/create-non-enumerable-property.js"),a=r("../../node_modules/core-js/internals/define-built-in.js"),c=r("../../node_modules/core-js/internals/define-global-property.js"),l=r("../../node_modules/core-js/internals/copy-constructor-properties.js"),u=r("../../node_modules/core-js/internals/is-forced.js");e.exports=function(e,n){var r,d,p,h,f,m=e.target,g=e.global,v=e.stat;if(r=g?i:v?i[m]||c(m,{}):i[m]&&i[m].prototype)for(d in n){if(h=n[d],p=e.dontCallGetSet?(f=o(r,d))&&f.value:r[d],!u(g?d:m+(v?".":"#")+d,e.forced)&&void 0!==p){if(typeof h==typeof p)continue;l(h,p)}(e.sham||p&&p.sham)&&s(h,"sham",!0),a(r,d,h,e)}}},"../../node_modules/core-js/internals/fails.js":function(e){"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},"../../node_modules/core-js/internals/function-bind-native.js":function(e,n,r){"use strict";e.exports=!r("../../node_modules/core-js/internals/fails.js")(function(){var e=(function(){}).bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})},"../../node_modules/core-js/internals/function-call.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-bind-native.js"),o=Function.prototype.call;e.exports=i?o.bind(o):function(){return o.apply(o,arguments)}},"../../node_modules/core-js/internals/function-name.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/descriptors.js"),o=r("../../node_modules/core-js/internals/has-own-property.js"),s=Function.prototype,a=i&&Object.getOwnPropertyDescriptor,c=o(s,"name"),l=c&&(!i||i&&a(s,"name").configurable);e.exports={EXISTS:c,PROPER:c&&"something"===(function(){}).name,CONFIGURABLE:l}},"../../node_modules/core-js/internals/function-uncurry-this-accessor.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this.js"),o=r("../../node_modules/core-js/internals/a-callable.js");e.exports=function(e,n,r){try{return i(o(Object.getOwnPropertyDescriptor(e,n)[r]))}catch(e){}}},"../../node_modules/core-js/internals/function-uncurry-this.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-bind-native.js"),o=Function.prototype,s=o.call,a=i&&o.bind.bind(s,s);e.exports=i?a:function(e){return function(){return s.apply(e,arguments)}}},"../../node_modules/core-js/internals/get-built-in.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js"),o=r("../../node_modules/core-js/internals/is-callable.js");e.exports=function(e,n){var r;return arguments.length<2?o(r=i[e])?r:void 0:i[e]&&i[e][n]}},"../../node_modules/core-js/internals/get-method.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/a-callable.js"),o=r("../../node_modules/core-js/internals/is-null-or-undefined.js");e.exports=function(e,n){var r=e[n];return o(r)?void 0:i(r)}},"../../node_modules/core-js/internals/global-this.js":function(e,n,r){"use strict";var i=function(e){return e&&e.Math===Math&&e};e.exports=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof r.g&&r.g)||i("object"==typeof this&&this)||function(){return this}()||Function("return this")()},"../../node_modules/core-js/internals/has-own-property.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this.js"),o=r("../../node_modules/core-js/internals/to-object.js"),s=i({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,n){return s(o(e),n)}},"../../node_modules/core-js/internals/hidden-keys.js":function(e){"use strict";e.exports={}},"../../node_modules/core-js/internals/html.js":function(e,n,r){"use strict";e.exports=r("../../node_modules/core-js/internals/get-built-in.js")("document","documentElement")},"../../node_modules/core-js/internals/ie8-dom-define.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/descriptors.js"),o=r("../../node_modules/core-js/internals/fails.js"),s=r("../../node_modules/core-js/internals/document-create-element.js");e.exports=!i&&!o(function(){return 7!==Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a})},"../../node_modules/core-js/internals/indexed-object.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this.js"),o=r("../../node_modules/core-js/internals/fails.js"),s=r("../../node_modules/core-js/internals/classof-raw.js"),a=Object,c=i("".split);e.exports=o(function(){return!a("z").propertyIsEnumerable(0)})?function(e){return"String"===s(e)?c(e,""):a(e)}:a},"../../node_modules/core-js/internals/inspect-source.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this.js"),o=r("../../node_modules/core-js/internals/is-callable.js"),s=r("../../node_modules/core-js/internals/shared-store.js"),a=i(Function.toString);o(s.inspectSource)||(s.inspectSource=function(e){return a(e)}),e.exports=s.inspectSource},"../../node_modules/core-js/internals/internal-state.js":function(e,n,r){"use strict";var i,o,s,a=r("../../node_modules/core-js/internals/weak-map-basic-detection.js"),c=r("../../node_modules/core-js/internals/global-this.js"),l=r("../../node_modules/core-js/internals/is-object.js"),u=r("../../node_modules/core-js/internals/create-non-enumerable-property.js"),d=r("../../node_modules/core-js/internals/has-own-property.js"),p=r("../../node_modules/core-js/internals/shared-store.js"),h=r("../../node_modules/core-js/internals/shared-key.js"),f=r("../../node_modules/core-js/internals/hidden-keys.js"),m="Object already initialized",g=c.TypeError,v=c.WeakMap;if(a||p.state){var y=p.state||(p.state=new v);y.get=y.get,y.has=y.has,y.set=y.set,i=function(e,n){if(y.has(e))throw new g(m);return n.facade=e,y.set(e,n),n},o=function(e){return y.get(e)||{}},s=function(e){return y.has(e)}}else{var b=h("state");f[b]=!0,i=function(e,n){if(d(e,b))throw new g(m);return n.facade=e,u(e,b,n),n},o=function(e){return d(e,b)?e[b]:{}},s=function(e){return d(e,b)}}e.exports={set:i,get:o,has:s,enforce:function(e){return s(e)?o(e):i(e,{})},getterFor:function(e){return function(n){var r;if(!l(n)||(r=o(n)).type!==e)throw new g("Incompatible receiver, "+e+" required");return r}}}},"../../node_modules/core-js/internals/is-callable.js":function(e){"use strict";var n="object"==typeof document&&document.all;e.exports=void 0===n&&void 0!==n?function(e){return"function"==typeof e||e===n}:function(e){return"function"==typeof e}},"../../node_modules/core-js/internals/is-forced.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/fails.js"),o=r("../../node_modules/core-js/internals/is-callable.js"),s=/#|\.prototype\./,a=function(e,n){var r=l[c(e)];return r===d||r!==u&&(o(n)?i(n):!!n)},c=a.normalize=function(e){return String(e).replace(s,".").toLowerCase()},l=a.data={},u=a.NATIVE="N",d=a.POLYFILL="P";e.exports=a},"../../node_modules/core-js/internals/is-null-or-undefined.js":function(e){"use strict";e.exports=function(e){return null==e}},"../../node_modules/core-js/internals/is-object.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/is-callable.js");e.exports=function(e){return"object"==typeof e?null!==e:i(e)}},"../../node_modules/core-js/internals/is-possible-prototype.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/is-object.js");e.exports=function(e){return i(e)||null===e}},"../../node_modules/core-js/internals/is-pure.js":function(e){"use strict";e.exports=!1},"../../node_modules/core-js/internals/is-symbol.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/get-built-in.js"),o=r("../../node_modules/core-js/internals/is-callable.js"),s=r("../../node_modules/core-js/internals/object-is-prototype-of.js"),a=r("../../node_modules/core-js/internals/use-symbol-as-uid.js"),c=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var n=i("Symbol");return o(n)&&s(n.prototype,c(e))}},"../../node_modules/core-js/internals/length-of-array-like.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/to-length.js");e.exports=function(e){return i(e.length)}},"../../node_modules/core-js/internals/make-built-in.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this.js"),o=r("../../node_modules/core-js/internals/fails.js"),s=r("../../node_modules/core-js/internals/is-callable.js"),a=r("../../node_modules/core-js/internals/has-own-property.js"),c=r("../../node_modules/core-js/internals/descriptors.js"),l=r("../../node_modules/core-js/internals/function-name.js").CONFIGURABLE,u=r("../../node_modules/core-js/internals/inspect-source.js"),d=r("../../node_modules/core-js/internals/internal-state.js"),p=d.enforce,h=d.get,f=String,m=Object.defineProperty,g=i("".slice),v=i("".replace),y=i([].join),b=c&&!o(function(){return 8!==m(function(){},"length",{value:8}).length}),_=String(String).split("String"),w=e.exports=function(e,n,r){"Symbol("===g(f(n),0,7)&&(n="["+v(f(n),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(n="get "+n),r&&r.setter&&(n="set "+n),(!a(e,"name")||l&&e.name!==n)&&(c?m(e,"name",{value:n,configurable:!0}):e.name=n),b&&r&&a(r,"arity")&&e.length!==r.arity&&m(e,"length",{value:r.arity});try{r&&a(r,"constructor")&&r.constructor?c&&m(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var i=p(e);return a(i,"source")||(i.source=y(_,"string"==typeof n?n:"")),e};Function.prototype.toString=w(function(){return s(this)&&h(this).source||u(this)},"toString")},"../../node_modules/core-js/internals/math-trunc.js":function(e){"use strict";var n=Math.ceil,r=Math.floor;e.exports=Math.trunc||function(e){var i=+e;return(i>0?r:n)(i)}},"../../node_modules/core-js/internals/object-create.js":function(e,n,r){"use strict";var i,o=r("../../node_modules/core-js/internals/an-object.js"),s=r("../../node_modules/core-js/internals/object-define-properties.js"),a=r("../../node_modules/core-js/internals/enum-bug-keys.js"),c=r("../../node_modules/core-js/internals/hidden-keys.js"),l=r("../../node_modules/core-js/internals/html.js"),u=r("../../node_modules/core-js/internals/document-create-element.js"),d=r("../../node_modules/core-js/internals/shared-key.js"),p="prototype",h="script",f=d("IE_PROTO"),m=function(){},g=function(e){return"<"+h+">"+e+"</"+h+">"},v=function(e){e.write(g("")),e.close();var n=e.parentWindow.Object;return e=null,n},y=function(){var e,n=u("iframe");return n.style.display="none",l.appendChild(n),n.src=String("java"+h+":"),(e=n.contentWindow.document).open(),e.write(g("document.F=Object")),e.close(),e.F},b=function(){try{i=new ActiveXObject("htmlfile")}catch(e){}b="undefined"!=typeof document?document.domain&&i?v(i):y():v(i);for(var e=a.length;e--;)delete b[p][a[e]];return b()};c[f]=!0,e.exports=Object.create||function(e,n){var r;return null!==e?(m[p]=o(e),r=new m,m[p]=null,r[f]=e):r=b(),void 0===n?r:s.f(r,n)}},"../../node_modules/core-js/internals/object-define-properties.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/descriptors.js"),o=r("../../node_modules/core-js/internals/v8-prototype-define-bug.js"),s=r("../../node_modules/core-js/internals/object-define-property.js"),a=r("../../node_modules/core-js/internals/an-object.js"),c=r("../../node_modules/core-js/internals/to-indexed-object.js"),l=r("../../node_modules/core-js/internals/object-keys.js");n.f=i&&!o?Object.defineProperties:function(e,n){a(e);for(var r,i=c(n),o=l(n),u=o.length,d=0;u>d;)s.f(e,r=o[d++],i[r]);return e}},"../../node_modules/core-js/internals/object-define-property.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/descriptors.js"),o=r("../../node_modules/core-js/internals/ie8-dom-define.js"),s=r("../../node_modules/core-js/internals/v8-prototype-define-bug.js"),a=r("../../node_modules/core-js/internals/an-object.js"),c=r("../../node_modules/core-js/internals/to-property-key.js"),l=TypeError,u=Object.defineProperty,d=Object.getOwnPropertyDescriptor,p="enumerable",h="configurable",f="writable";n.f=i?s?function(e,n,r){if(a(e),n=c(n),a(r),"function"==typeof e&&"prototype"===n&&"value"in r&&f in r&&!r[f]){var i=d(e,n);i&&i[f]&&(e[n]=r.value,r={configurable:h in r?r[h]:i[h],enumerable:p in r?r[p]:i[p],writable:!1})}return u(e,n,r)}:u:function(e,n,r){if(a(e),n=c(n),a(r),o)try{return u(e,n,r)}catch(e){}if("get"in r||"set"in r)throw new l("Accessors not supported");return"value"in r&&(e[n]=r.value),e}},"../../node_modules/core-js/internals/object-get-own-property-descriptor.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/descriptors.js"),o=r("../../node_modules/core-js/internals/function-call.js"),s=r("../../node_modules/core-js/internals/object-property-is-enumerable.js"),a=r("../../node_modules/core-js/internals/create-property-descriptor.js"),c=r("../../node_modules/core-js/internals/to-indexed-object.js"),l=r("../../node_modules/core-js/internals/to-property-key.js"),u=r("../../node_modules/core-js/internals/has-own-property.js"),d=r("../../node_modules/core-js/internals/ie8-dom-define.js"),p=Object.getOwnPropertyDescriptor;n.f=i?p:function(e,n){if(e=c(e),n=l(n),d)try{return p(e,n)}catch(e){}if(u(e,n))return a(!o(s.f,e,n),e[n])}},"../../node_modules/core-js/internals/object-get-own-property-names.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/object-keys-internal.js"),o=r("../../node_modules/core-js/internals/enum-bug-keys.js").concat("length","prototype");n.f=Object.getOwnPropertyNames||function(e){return i(e,o)}},"../../node_modules/core-js/internals/object-get-own-property-symbols.js":function(e,n){"use strict";n.f=Object.getOwnPropertySymbols},"../../node_modules/core-js/internals/object-get-prototype-of.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/has-own-property.js"),o=r("../../node_modules/core-js/internals/is-callable.js"),s=r("../../node_modules/core-js/internals/to-object.js"),a=r("../../node_modules/core-js/internals/shared-key.js"),c=r("../../node_modules/core-js/internals/correct-prototype-getter.js"),l=a("IE_PROTO"),u=Object,d=u.prototype;e.exports=c?u.getPrototypeOf:function(e){var n=s(e);if(i(n,l))return n[l];var r=n.constructor;return o(r)&&n instanceof r?r.prototype:n instanceof u?d:null}},"../../node_modules/core-js/internals/object-is-prototype-of.js":function(e,n,r){"use strict";e.exports=r("../../node_modules/core-js/internals/function-uncurry-this.js")({}.isPrototypeOf)},"../../node_modules/core-js/internals/object-keys-internal.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this.js"),o=r("../../node_modules/core-js/internals/has-own-property.js"),s=r("../../node_modules/core-js/internals/to-indexed-object.js"),a=r("../../node_modules/core-js/internals/array-includes.js").indexOf,c=r("../../node_modules/core-js/internals/hidden-keys.js"),l=i([].push);e.exports=function(e,n){var r,i=s(e),u=0,d=[];for(r in i)!o(c,r)&&o(i,r)&&l(d,r);for(;n.length>u;)o(i,r=n[u++])&&(~a(d,r)||l(d,r));return d}},"../../node_modules/core-js/internals/object-keys.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/object-keys-internal.js"),o=r("../../node_modules/core-js/internals/enum-bug-keys.js");e.exports=Object.keys||function(e){return i(e,o)}},"../../node_modules/core-js/internals/object-property-is-enumerable.js":function(e,n){"use strict";var r={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor;n.f=i&&!r.call({1:2},1)?function(e){var n=i(this,e);return!!n&&n.enumerable}:r},"../../node_modules/core-js/internals/object-set-prototype-of.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this-accessor.js"),o=r("../../node_modules/core-js/internals/is-object.js"),s=r("../../node_modules/core-js/internals/require-object-coercible.js"),a=r("../../node_modules/core-js/internals/a-possible-prototype.js");e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,n=!1,r={};try{(e=i(Object.prototype,"__proto__","set"))(r,[]),n=r instanceof Array}catch(e){}return function(r,i){return s(r),a(i),o(r)&&(n?e(r,i):r.__proto__=i),r}}():void 0)},"../../node_modules/core-js/internals/ordinary-to-primitive.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-call.js"),o=r("../../node_modules/core-js/internals/is-callable.js"),s=r("../../node_modules/core-js/internals/is-object.js"),a=TypeError;e.exports=function(e,n){var r,c;if("string"===n&&o(r=e.toString)&&!s(c=i(r,e))||o(r=e.valueOf)&&!s(c=i(r,e))||"string"!==n&&o(r=e.toString)&&!s(c=i(r,e)))return c;throw new a("Can't convert object to primitive value")}},"../../node_modules/core-js/internals/own-keys.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/get-built-in.js"),o=r("../../node_modules/core-js/internals/function-uncurry-this.js"),s=r("../../node_modules/core-js/internals/object-get-own-property-names.js"),a=r("../../node_modules/core-js/internals/object-get-own-property-symbols.js"),c=r("../../node_modules/core-js/internals/an-object.js"),l=o([].concat);e.exports=i("Reflect","ownKeys")||function(e){var n=s.f(c(e)),r=a.f;return r?l(n,r(e)):n}},"../../node_modules/core-js/internals/require-object-coercible.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/is-null-or-undefined.js"),o=TypeError;e.exports=function(e){if(i(e))throw new o("Can't call method on "+e);return e}},"../../node_modules/core-js/internals/shared-key.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/shared.js"),o=r("../../node_modules/core-js/internals/uid.js"),s=i("keys");e.exports=function(e){return s[e]||(s[e]=o(e))}},"../../node_modules/core-js/internals/shared-store.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/is-pure.js"),o=r("../../node_modules/core-js/internals/global-this.js"),s=r("../../node_modules/core-js/internals/define-global-property.js"),a="__core-js_shared__",c=e.exports=o[a]||s(a,{});(c.versions||(c.versions=[])).push({version:"3.44.0",mode:i?"pure":"global",copyright:"\xa9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.44.0/LICENSE",source:"https://github.com/zloirock/core-js"})},"../../node_modules/core-js/internals/shared.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/shared-store.js");e.exports=function(e,n){return i[e]||(i[e]=n||{})}},"../../node_modules/core-js/internals/symbol-constructor-detection.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/environment-v8-version.js"),o=r("../../node_modules/core-js/internals/fails.js"),s=r("../../node_modules/core-js/internals/global-this.js").String;e.exports=!!Object.getOwnPropertySymbols&&!o(function(){var e=Symbol("symbol detection");return!s(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&i&&i<41})},"../../node_modules/core-js/internals/to-absolute-index.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/to-integer-or-infinity.js"),o=Math.max,s=Math.min;e.exports=function(e,n){var r=i(e);return r<0?o(r+n,0):s(r,n)}},"../../node_modules/core-js/internals/to-indexed-object.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/indexed-object.js"),o=r("../../node_modules/core-js/internals/require-object-coercible.js");e.exports=function(e){return i(o(e))}},"../../node_modules/core-js/internals/to-integer-or-infinity.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/math-trunc.js");e.exports=function(e){var n=+e;return n!=n||0===n?0:i(n)}},"../../node_modules/core-js/internals/to-length.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/to-integer-or-infinity.js"),o=Math.min;e.exports=function(e){var n=i(e);return n>0?o(n,0x1fffffffffffff):0}},"../../node_modules/core-js/internals/to-object.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/require-object-coercible.js"),o=Object;e.exports=function(e){return o(i(e))}},"../../node_modules/core-js/internals/to-offset.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/to-positive-integer.js"),o=RangeError;e.exports=function(e,n){var r=i(e);if(r%n)throw new o("Wrong offset");return r}},"../../node_modules/core-js/internals/to-positive-integer.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/to-integer-or-infinity.js"),o=RangeError;e.exports=function(e){var n=i(e);if(n<0)throw new o("The argument can't be less than 0");return n}},"../../node_modules/core-js/internals/to-primitive.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-call.js"),o=r("../../node_modules/core-js/internals/is-object.js"),s=r("../../node_modules/core-js/internals/is-symbol.js"),a=r("../../node_modules/core-js/internals/get-method.js"),c=r("../../node_modules/core-js/internals/ordinary-to-primitive.js"),l=r("../../node_modules/core-js/internals/well-known-symbol.js"),u=TypeError,d=l("toPrimitive");e.exports=function(e,n){if(!o(e)||s(e))return e;var r,l=a(e,d);if(l){if(void 0===n&&(n="default"),!o(r=i(l,e,n))||s(r))return r;throw new u("Can't convert object to primitive value")}return void 0===n&&(n="number"),c(e,n)}},"../../node_modules/core-js/internals/to-property-key.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/to-primitive.js"),o=r("../../node_modules/core-js/internals/is-symbol.js");e.exports=function(e){var n=i(e,"string");return o(n)?n:n+""}},"../../node_modules/core-js/internals/to-string-tag-support.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/well-known-symbol.js")("toStringTag"),o={};o[i]="z",e.exports="[object z]"===String(o)},"../../node_modules/core-js/internals/try-to-string.js":function(e){"use strict";var n=String;e.exports=function(e){try{return n(e)}catch(e){return"Object"}}},"../../node_modules/core-js/internals/uid.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this.js"),o=0,s=Math.random(),a=i(1.1.toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++o+s,36)}},"../../node_modules/core-js/internals/use-symbol-as-uid.js":function(e,n,r){"use strict";e.exports=r("../../node_modules/core-js/internals/symbol-constructor-detection.js")&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},"../../node_modules/core-js/internals/v8-prototype-define-bug.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/descriptors.js"),o=r("../../node_modules/core-js/internals/fails.js");e.exports=i&&o(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},"../../node_modules/core-js/internals/weak-map-basic-detection.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js"),o=r("../../node_modules/core-js/internals/is-callable.js"),s=i.WeakMap;e.exports=o(s)&&/native code/.test(String(s))},"../../node_modules/core-js/internals/well-known-symbol.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js"),o=r("../../node_modules/core-js/internals/shared.js"),s=r("../../node_modules/core-js/internals/has-own-property.js"),a=r("../../node_modules/core-js/internals/uid.js"),c=r("../../node_modules/core-js/internals/symbol-constructor-detection.js"),l=r("../../node_modules/core-js/internals/use-symbol-as-uid.js"),u=i.Symbol,d=o("wks"),p=l?u.for||u:u&&u.withoutSetter||a;e.exports=function(e){return s(d,e)||(d[e]=c&&s(u,e)?u[e]:p("Symbol."+e)),d[e]}},"../../node_modules/core-js/modules/es.array.includes.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/export.js"),o=r("../../node_modules/core-js/internals/array-includes.js").includes,s=r("../../node_modules/core-js/internals/fails.js"),a=r("../../node_modules/core-js/internals/add-to-unscopables.js");i({target:"Array",proto:!0,forced:s(function(){return![,].includes()})},{includes:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),a("includes")},"../../node_modules/core-js/modules/es.array.reduce.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/export.js"),o=r("../../node_modules/core-js/internals/array-reduce.js").left,s=r("../../node_modules/core-js/internals/array-method-is-strict.js"),a=r("../../node_modules/core-js/internals/environment-v8-version.js");i({target:"Array",proto:!0,forced:!r("../../node_modules/core-js/internals/environment-is-node.js")&&a>79&&a<83||!s("reduce")},{reduce:function(e){var n=arguments.length;return o(this,e,n,n>1?arguments[1]:void 0)}})},"../../node_modules/core-js/modules/es.object.has-own.js":function(e,n,r){"use strict";r("../../node_modules/core-js/internals/export.js")({target:"Object",stat:!0},{hasOwn:r("../../node_modules/core-js/internals/has-own-property.js")})},"../../node_modules/core-js/modules/es.typed-array.set.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js"),o=r("../../node_modules/core-js/internals/function-call.js"),s=r("../../node_modules/core-js/internals/array-buffer-view-core.js"),a=r("../../node_modules/core-js/internals/length-of-array-like.js"),c=r("../../node_modules/core-js/internals/to-offset.js"),l=r("../../node_modules/core-js/internals/to-object.js"),u=r("../../node_modules/core-js/internals/fails.js"),d=i.RangeError,p=i.Int8Array,h=p&&p.prototype,f=h&&h.set,m=s.aTypedArray,g=s.exportTypedArrayMethod,v=!u(function(){var e=new Uint8ClampedArray(2);return o(f,e,{length:1,0:3},1),3!==e[1]}),y=v&&s.NATIVE_ARRAY_BUFFER_VIEWS&&u(function(){var e=new p(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]});g("set",function(e){m(this);var n=c(arguments.length>1?arguments[1]:void 0,1),r=l(e);if(v)return o(f,this,r,n);var i=this.length,s=a(r),u=0;if(s+n>i)throw new d("Wrong length");for(;u<s;)this[n+u]=r[u++]},!v||y)},"../../node_modules/reflect-metadata/Reflect.js":function(e,n,r){var i,o;o=i||(i={}),function(e){var n="object"==typeof globalThis?globalThis:"object"==typeof r.g?r.g:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(e){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(e){}}(),i=s(o);function s(e,n){return function(r,i){Object.defineProperty(e,r,{configurable:!0,writable:!0,value:i}),n&&n(r,i)}}void 0!==n.Reflect&&(i=s(n.Reflect,i)),e(i,n),void 0===n.Reflect&&(n.Reflect=o)}(function(e,n){var r,i=Object.prototype.hasOwnProperty,o="function"==typeof Symbol,s=o&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",a=o&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",c="function"==typeof Object.create,l=({__proto__:[]})instanceof Array,u=!c&&!l,d={create:c?function(){return L(Object.create(null))}:l?function(){return L({__proto__:null})}:function(){return L({})},has:u?function(e,n){return i.call(e,n)}:function(e,n){return n in e},get:u?function(e,n){return i.call(e,n)?e[n]:void 0}:function(e,n){return e[n]}},p=Object.getPrototypeOf(Function),h="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:function(){var e={},n=[],r=function(){function e(e,n,r){this._index=0,this._keys=e,this._values=n,this._selector=r}return e.prototype["@@iterator"]=function(){return this},e.prototype[a]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var r=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=n,this._values=n):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=n,this._values=n),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=n,this._values=n),{value:e,done:!0}},e}();function i(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(i.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),i.prototype.has=function(e){return this._find(e,!1)>=0},i.prototype.get=function(e){var n=this._find(e,!1);return n>=0?this._values[n]:void 0},i.prototype.set=function(e,n){var r=this._find(e,!0);return this._values[r]=n,this},i.prototype.delete=function(n){var r=this._find(n,!1);if(r>=0){for(var i=this._keys.length,o=r+1;o<i;o++)this._keys[o-1]=this._keys[o],this._values[o-1]=this._values[o];return this._keys.length--,this._values.length--,j(n,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},i.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},i.prototype.keys=function(){return new r(this._keys,this._values,o)},i.prototype.values=function(){return new r(this._keys,this._values,s)},i.prototype.entries=function(){return new r(this._keys,this._values,c)},i.prototype["@@iterator"]=function(){return this.entries()},i.prototype[a]=function(){return this.entries()},i.prototype._find=function(e,n){if(!j(this._cacheKey,e)){this._cacheIndex=-1;for(var r=0;r<this._keys.length;r++)if(j(this._keys[r],e)){this._cacheIndex=r;break}}return this._cacheIndex<0&&n&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},i;function o(e,n){return e}function s(e,n){return n}function c(e,n){return[e,n]}}(),f="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:function(){function e(){this._map=new h}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.keys()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[a]=function(){return this.keys()},e}(),m="function"==typeof WeakMap?WeakMap:function(){var e=d.create(),n=o();function r(){this._key=o()}return r.prototype.has=function(e){var n=s(e,!1);return void 0!==n&&d.has(n,this._key)},r.prototype.get=function(e){var n=s(e,!1);return void 0!==n?d.get(n,this._key):void 0},r.prototype.set=function(e,n){return s(e,!0)[this._key]=n,this},r.prototype.delete=function(e){var n=s(e,!1);return void 0!==n&&delete n[this._key]},r.prototype.clear=function(){this._key=o()},r;function o(){var n;do n="@@WeakMap@@"+function(){var e=function(e){if("function"==typeof Uint8Array){var n=new Uint8Array(16);return"undefined"!=typeof crypto?crypto.getRandomValues(n):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(n):a(n,16),n}return a(Array(e),e)}(16);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var n="",r=0;r<16;++r){var i=e[r];(4===r||6===r||8===r)&&(n+="-"),i<16&&(n+="0"),n+=i.toString(16).toLowerCase()}return n}();while(d.has(e,n));return e[n]=!0,n}function s(e,r){if(!i.call(e,n)){if(!r)return;Object.defineProperty(e,n,{value:d.create()})}return e[n]}function a(e,n){for(var r=0;r<n;++r)e[r]=255*Math.random()|0;return e}}(),g=o?Symbol.for("@reflect-metadata:registry"):void 0,v=(!S(g)&&T(n.Reflect)&&Object.isExtensible(n.Reflect)&&(r=n.Reflect[g]),S(r)&&(r=function(){S(g)||void 0===n.Reflect||g in n.Reflect||"function"!=typeof n.Reflect.defineMetadata||(r=(e=n.Reflect).defineMetadata,i=e.hasOwnMetadata,o=e.getOwnMetadata,s=e.getOwnMetadataKeys,a=e.deleteMetadata,c=new m,l={isProviderFor:function(e,n){var r=c.get(e);return!!(!S(r)&&r.has(n))||!!s(e,n).length&&(S(r)&&(r=new f,c.set(e,r)),r.add(n),!0)},OrdinaryDefineOwnMetadata:r,OrdinaryHasOwnMetadata:i,OrdinaryGetOwnMetadata:o,OrdinaryOwnMetadataKeys:s,OrdinaryDeleteMetadata:a});var e,r,i,o,s,a,c,l,u,d,p,v=new m,y={registerProvider:function(e){if(!Object.isExtensible(y))throw Error("Cannot add provider to a frozen registry.");switch(!0){case l===e:break;case S(u):u=e;break;case u===e:break;case S(d):d=e;break;case d===e:break;default:void 0===p&&(p=new f),p.add(e)}},getProvider:b,setProvider:function(e,n,r){if(!function(e){if(S(e))throw TypeError();return u===e||d===e||!S(p)&&p.has(e)}(r))throw Error("Metadata provider not registered.");var i=b(e,n);if(i!==r){if(!S(i))return!1;var o=v.get(e);S(o)&&(o=new h,v.set(e,o)),o.set(n,r)}return!0}};return y;function b(e,n){var r,i=v.get(e);return S(i)||(r=i.get(n)),S(r)&&(r=function(e,n){if(!S(u)){if(u.isProviderFor(e,n))return u;if(!S(d)){if(d.isProviderFor(e,n))return u;if(!S(p))for(var r=B(p);;){var i=k(r);if(!i)return;var o=i.value;if(o.isProviderFor(e,n))return P(r),o}}}if(!S(l)&&l.isProviderFor(e,n))return l}(e,n),S(r)||(S(i)&&(i=new h,v.set(e,i)),i.set(n,r))),r}}()),!S(g)&&T(n.Reflect)&&Object.isExtensible(n.Reflect)&&Object.defineProperty(n.Reflect,g,{enumerable:!1,configurable:!1,writable:!1,value:r}),r),y=function(e){var n=new m,r={isProviderFor:function(e,r){var i=n.get(e);return!S(i)&&i.has(r)},OrdinaryDefineOwnMetadata:function(e,n,r,o){i(r,o,!0).set(e,n)},OrdinaryHasOwnMetadata:function(e,n,r){var o=i(n,r,!1);return!S(o)&&!!o.has(e)},OrdinaryGetOwnMetadata:function(e,n,r){var o=i(n,r,!1);if(!S(o))return o.get(e)},OrdinaryOwnMetadataKeys:function(e,n){var r=[],o=i(e,n,!1);if(S(o))return r;for(var s=B(o.keys()),a=0;;){var c=k(s);if(!c)return r.length=a,r;var l=c.value;try{r[a]=l}catch(e){try{P(s)}finally{throw e}}a++}},OrdinaryDeleteMetadata:function(e,r,o){var s=i(r,o,!1);if(S(s)||!s.delete(e))return!1;if(0===s.size){var a=n.get(r);S(a)||(a.delete(o),0===a.size&&n.delete(a))}return!0}};return v.registerProvider(r),r;function i(i,o,s){var a=n.get(i),c=!1;if(S(a)){if(!s)return;a=new h,n.set(i,a),c=!0}var l=a.get(o);if(S(l)){if(!s)return;if(l=new h,a.set(o,l),!e.setProvider(i,o,r))throw a.delete(o),c&&n.delete(i),Error("Wrong provider for target.")}return l}}(v);function b(e,n,r){var i=D(n,r,!1);return!S(i)&&!!i.OrdinaryHasOwnMetadata(e,n,r)}function _(e,n,r){var i=D(n,r,!1);if(!S(i))return i.OrdinaryGetOwnMetadata(e,n,r)}function w(e,n,r,i){D(r,i,!0).OrdinaryDefineOwnMetadata(e,n,r,i)}function O(e,n){var r=D(e,n,!1);return r?r.OrdinaryOwnMetadataKeys(e,n):[]}function R(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function S(e){return void 0===e}function E(e){return null===e}function T(e){return"object"==typeof e?null!==e:"function"==typeof e}e("decorate",function(e,n,r,i){if(S(r)){if(!x(e)||!I(n))throw TypeError();for(var o=e,s=n,a=o.length-1;a>=0;--a){var c=(0,o[a])(s);if(!S(c)&&!E(c)){if(!I(c))throw TypeError();s=c}}return s}if(!x(e)||!T(n)||!T(i)&&!S(i)&&!E(i))throw TypeError();return E(i)&&(i=void 0),function(e,n,r,i){for(var o=e.length-1;o>=0;--o){var s=(0,e[o])(n,r,i);if(!S(s)&&!E(s)){if(!T(s))throw TypeError();i=s}}return i}(e,n,r=M(r),i)}),e("metadata",function(e,n){return function(r,i){if(!T(r)||!S(i)&&!function(e){switch(R(e)){case 3:case 4:return!0;default:return!1}}(i))throw TypeError();w(e,n,r,i)}}),e("defineMetadata",function(e,n,r,i){if(!T(r))throw TypeError();return S(i)||(i=M(i)),w(e,n,r,i)}),e("hasMetadata",function(e,n,r){if(!T(n))throw TypeError();return S(r)||(r=M(r)),function e(n,r,i){if(b(n,r,i))return!0;var o=N(r);return!E(o)&&e(n,o,i)}(e,n,r)}),e("hasOwnMetadata",function(e,n,r){if(!T(n))throw TypeError();return S(r)||(r=M(r)),b(e,n,r)}),e("getMetadata",function(e,n,r){if(!T(n))throw TypeError();return S(r)||(r=M(r)),function e(n,r,i){if(b(n,r,i))return _(n,r,i);var o=N(r);if(!E(o))return e(n,o,i)}(e,n,r)}),e("getOwnMetadata",function(e,n,r){if(!T(n))throw TypeError();return S(r)||(r=M(r)),_(e,n,r)}),e("getMetadataKeys",function(e,n){if(!T(e))throw TypeError();return S(n)||(n=M(n)),function e(n,r){var i=O(n,r),o=N(n);if(null===o)return i;var s=e(o,r);if(s.length<=0)return i;if(i.length<=0)return s;for(var a=new f,c=[],l=0;l<i.length;l++){var u=i[l],d=a.has(u);d||(a.add(u),c.push(u))}for(var p=0;p<s.length;p++){var u=s[p],d=a.has(u);d||(a.add(u),c.push(u))}return c}(e,n)}),e("getOwnMetadataKeys",function(e,n){if(!T(e))throw TypeError();return S(n)||(n=M(n)),O(e,n)}),e("deleteMetadata",function(e,n,r){if(!T(n)||(S(r)||(r=M(r)),!T(n)))throw TypeError();S(r)||(r=M(r));var i=D(n,r,!1);return!S(i)&&i.OrdinaryDeleteMetadata(e,n,r)});function M(e){var n=function(e,n){switch(R(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var r="string",i=A(e,s);if(void 0!==i){var o=i.call(e,r);if(T(o))throw TypeError();return o}return function(e,n){if("string"===n){var r=e.toString;if(C(r)){var i=r.call(e);if(!T(i))return i}var o=e.valueOf;if(C(o)){var i=o.call(e);if(!T(i))return i}}else{var o=e.valueOf;if(C(o)){var i=o.call(e);if(!T(i))return i}var s=e.toString;if(C(s)){var i=s.call(e);if(!T(i))return i}}throw TypeError()}(e,r)}(e,0);return"symbol"==typeof n?n:""+n}function x(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function C(e){return"function"==typeof e}function I(e){return"function"==typeof e}function j(e,n){return e===n||e!=e&&n!=n}function A(e,n){var r=e[n];if(null!=r){if(!C(r))throw TypeError();return r}}function B(e){var n=A(e,a);if(!C(n))throw TypeError();var r=n.call(e);if(!T(r))throw TypeError();return r}function k(e){var n=e.next();return!n.done&&n}function P(e){var n=e.return;n&&n.call(e)}function N(e){var n=Object.getPrototypeOf(e);if("function"!=typeof e||e===p||n!==p)return n;var r=e.prototype,i=r&&Object.getPrototypeOf(r);if(null==i||i===Object.prototype)return n;var o=i.constructor;return"function"!=typeof o||o===e?n:o}function D(e,n,r){var i=v.getProvider(e,n);if(!S(i))return i;if(r){if(v.setProvider(e,n,y))return y;throw Error("Illegal state.")}}function L(e){return e.__=void 0,delete e.__,e}})}},n={};function r(i){var o=n[i];if(void 0!==o)return o.exports;var s=n[i]={exports:{}};return e[i].call(s.exports,s,s.exports,r),s.exports}r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},r.d=(e,n)=>{for(var i in n)r.o(n,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},r.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";let e,n;r.r(i),r.d(i,{AIWorkerConversationBean:()=>io,ClientConversationBean:()=>rl,ConversationService:()=>ic,DEFAULT_OPTIONS:()=>rn,createAaaSPilotKit:()=>s$,ConversationBean:()=>ra,AaaSPilotKitController:()=>oz,BaseAgentService:()=>n7});var o,s,a,c,l,u,d,p,h,f,m,g,v,y,b,_,w,O,R,S,E,T,M,x,C,I,j,A={};r.r(A),r.d(A,{fixNegotiationNeeded:()=>sd,shimAddTrackRemoveTrack:()=>sl,shimAddTrackRemoveTrackWithNative:()=>sc,shimGetSendersWithDtmf:()=>ss,shimGetUserMedia:()=>sr,shimMediaStream:()=>si,shimOnTrack:()=>so,shimPeerConnection:()=>su,shimSenderReceiverGetStats:()=>sa});var B={};r.r(B),r.d(B,{shimAddTransceiver:()=>s_,shimCreateAnswer:()=>sR,shimCreateOffer:()=>sO,shimGetDisplayMedia:()=>sh,shimGetParameters:()=>sw,shimGetUserMedia:()=>sp,shimOnTrack:()=>sf,shimPeerConnection:()=>sm,shimRTCDataChannel:()=>sb,shimReceiverGetStats:()=>sv,shimRemoveStream:()=>sy,shimSenderGetStats:()=>sg});var k={};r.r(k),r.d(k,{shimAudioContext:()=>sA,shimCallbacksAPI:()=>sT,shimConstraints:()=>sx,shimCreateOfferLegacy:()=>sj,shimGetUserMedia:()=>sM,shimLocalStreamsAPI:()=>sS,shimRTCIceServerUrls:()=>sC,shimRemoteStreamsAPI:()=>sE,shimTrackEventTransceiver:()=>sI});var P={};r.r(P),r.d(P,{removeExtmapAllowMixed:()=>sU,shimAddIceCandidateNullOrEmpty:()=>sH,shimConnectionState:()=>sF,shimMaxMessageSize:()=>sD,shimParameterlessSetLocalDescription:()=>sq,shimRTCIceCandidate:()=>sP,shimRTCIceCandidateRelayProtocol:()=>sN,shimSendThrowTypeError:()=>sL});var N={};function D(e){return("object"==typeof e&&null!==e||"function"==typeof e)&&"function"==typeof e.then}function L(e){switch(typeof e){case"string":case"symbol":return e.toString();case"function":return e.name;default:throw Error(`Unexpected ${typeof e} service id type`)}}r.r(N),r.d(N,{default:()=>sV}),r("../../node_modules/core-js/modules/es.object.has-own.js"),r("../../node_modules/reflect-metadata/Reflect.js");let F=Symbol.for("@inversifyjs/common/islazyServiceIdentifier");class U{#e;constructor(e){this.#e=e,this[F]=!0}static is(e){return"object"==typeof e&&null!==e&&!0===e[F]}unwrap(){return this.#e()}}function H(e,n){return Reflect.getOwnMetadata(n,e)}function q(e,n,r){Reflect.defineMetadata(n,r,e)}function V(e,n,r,i){var o;let s=i(null!=(o=H(e,n))?o:r());Reflect.defineMetadata(n,s,e)}r("../../node_modules/core-js/modules/es.array.includes.js");let X="@inversifyjs/container/bindingId";function W(){var e;let n=null!=(e=H(Object,X))?e:0;return n===Number.MAX_SAFE_INTEGER?q(Object,X,Number.MIN_SAFE_INTEGER):V(Object,X,()=>n,e=>e+1),n}let $={Request:"Request",Singleton:"Singleton",Transient:"Transient"},z={ConstantValue:"ConstantValue",DynamicValue:"DynamicValue",Factory:"Factory",Instance:"Instance",Provider:"Provider",ResolvedValue:"ResolvedValue",ServiceRedirection:"ServiceRedirection"};function*G(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];for(let e of n)yield*e}class Y{#e;#t;#n;constructor(e){for(let n of(this.#e=new Map,this.#t={},Reflect.ownKeys(e)))this.#t[n]=new Map;this.#n=e}add(e,n){for(let r of(this.#r(e).push(n),Reflect.ownKeys(n)))this.#i(r,n[r]).push(e)}clone(){let e=this.#o(),n=this.#s(),r=Reflect.ownKeys(this.#n),i=this._buildNewInstance(this.#n);for(let o of(this.#a(this.#e,i.#e,e,n),r))this.#c(this.#t[o],i.#t[o],e);return i}get(e,n){return this.#t[e].get(n)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,n){let r=this.get(e,n);if(void 0!==r)for(let i of new Set(r)){let r=this.#e.get(i);if(void 0===r)throw Error("Expecting model relation, none found");for(let o of r)o[e]===n&&this.#l(i,o);this.#e.delete(i)}}_buildNewInstance(e){return new Y(e)}_cloneModel(e){return e}_cloneRelation(e){return e}#o(){let e=new Map;for(let n of this.#e.keys()){let r=this._cloneModel(n);e.set(n,r)}return e}#s(){let e=new Map;for(let n of this.#e.values())for(let r of n){let n=this._cloneRelation(r);e.set(r,n)}return e}#r(e){let n=this.#e.get(e);return void 0===n&&(n=[],this.#e.set(e,n)),n}#i(e,n){let r=this.#t[e].get(n);return void 0===r&&(r=[],this.#t[e].set(n,r)),r}#u(e,n){let r=n.get(e);if(void 0===r)throw Error("Expecting model to be cloned, none found");return r}#d(e,n){let r=n.get(e);if(void 0===r)throw Error("Expecting relation to be cloned, none found");return r}#c(e,n,r){for(let[i,o]of e){let e=[];for(let n of o)e.push(this.#u(n,r));n.set(i,e)}}#a(e,n,r,i){for(let[o,s]of e){let e=[];for(let n of s)e.push(this.#d(n,i));n.set(this.#u(o,r),e)}}#l(e,n){for(let r of Reflect.ownKeys(n))this.#p(e,r,n[r])}#p(e,n,r){let i=this.#t[n].get(r);if(void 0!==i){let o=i.indexOf(e);-1!==o&&i.splice(o,1),0===i.length&&this.#t[n].delete(r)}}}!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(f||(f={}));class Q{#h;#f;constructor(e,n){this.#h=null!=n?n:new Y({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#f=e}static build(e){return new Q(e)}add(e,n){this.#h.add(e,n)}clone(){return new Q(this.#f,this.#h.clone())}get(e){var n;let r=[],i=this.#h.get(f.serviceId,e);void 0!==i&&r.push(i);let o=null==(n=this.#f)?void 0:n.get(e);if(void 0!==o&&r.push(o),0!==r.length)return G(...r)}removeAllByModuleId(e){this.#h.removeByRelation(f.moduleId,e)}removeAllByServiceId(e){this.#h.removeByRelation(f.serviceId,e)}}function J(e){return e.isRight?{isRight:!0,value:e.value}:e}!function(e){e.id="id",e.moduleId="moduleId",e.serviceId="serviceId"}(m||(m={}));class K extends Y{_buildNewInstance(e){return new K(e)}_cloneModel(e){return function(e){switch(e.type){case z.ConstantValue:case z.DynamicValue:return{cache:J(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type,value:e.value};case z.Factory:return{cache:J(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type};case z.Instance:return{cache:J(e.cache),id:e.id,implementationType:e.implementationType,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type};case z.Provider:return{cache:J(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,provider:e.provider,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type};case z.ResolvedValue:return{cache:J(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,metadata:e.metadata,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type};case z.ServiceRedirection:return{id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,serviceIdentifier:e.serviceIdentifier,targetServiceIdentifier:e.targetServiceIdentifier,type:e.type}}}(e)}}class Z{#m;#f;constructor(e,n){this.#m=null!=n?n:new K({id:{isOptional:!1},moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#f=e}static build(e){return new Z(e)}clone(){return new Z(this.#f,this.#m.clone())}get(e){var n,r;return null!=(r=this.getNonParentBindings(e))?r:null==(n=this.#f)?void 0:n.get(e)}getBoundServices(){let e=new Set(this.#m.getAllKeys(m.serviceId));if(void 0!==this.#f)for(let n of this.#f.getBoundServices())e.add(n);return e}getById(e){var n,r;return null!=(r=this.#m.get(m.id,e))?r:null==(n=this.#f)?void 0:n.getById(e)}getByModuleId(e){var n,r;return null!=(r=this.#m.get(m.moduleId,e))?r:null==(n=this.#f)?void 0:n.getByModuleId(e)}getNonParentBindings(e){return this.#m.get(m.serviceId,e)}getNonParentBoundServices(){return this.#m.getAllKeys(m.serviceId)}removeById(e){this.#m.removeByRelation(m.id,e)}removeAllByModuleId(e){this.#m.removeByRelation(m.moduleId,e)}removeAllByServiceId(e){this.#m.removeByRelation(m.serviceId,e)}set(e){let n={[m.id]:e.id,[m.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(n[m.moduleId]=e.moduleId),this.#m.add(e,n)}}!function(e){e.moduleId="moduleId",e.serviceId="serviceId"}(g||(g={}));class ee{#g;#f;constructor(e,n){this.#g=null!=n?n:new Y({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#f=e}static build(e){return new ee(e)}add(e,n){this.#g.add(e,n)}clone(){return new ee(this.#f,this.#g.clone())}get(e){var n;let r=[],i=this.#g.get(g.serviceId,e);void 0!==i&&r.push(i);let o=null==(n=this.#f)?void 0:n.get(e);if(void 0!==o&&r.push(o),0!==r.length)return G(...r)}removeAllByModuleId(e){this.#g.removeByRelation(g.moduleId,e)}removeAllByServiceId(e){this.#g.removeByRelation(g.serviceId,e)}}function et(e,n,r){let i=Array.isArray(e)?e:[e];if(void 0!==r)if("number"!=typeof r)Reflect.decorate(i,n.prototype,r);else for(let e of i)e(n,void 0,r);else Reflect.decorate(i,n)}let en="@inversifyjs/core/classMetadataReflectKey";function er(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}let ei="@inversifyjs/core/pendingClassMetadataCountReflectKey",eo=Symbol.for("@inversifyjs/core/InversifyCoreError");class es extends Error{constructor(e,n,r){super(n,r),this[eo]=!0,this.kind=e}static is(e){return"object"==typeof e&&null!==e&&!0===e[eo]}static isErrorOfKind(e,n){return es.is(e)&&e.kind===n}}function ea(e){var n;let r=null!=(n=H(e,en))?n:er();if(!function(e){let n=H(e,ei);return void 0!==n&&0!==n}(e))return function(e,n){let r=[];if(n.length<e.length)throw new es(v.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}". "${e.name}" constructor requires at least ${e.length.toString()} arguments, found ${n.length.toString()} instead.
|
|
2
|
+
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.KyDigitalHuman=n():e.KyDigitalHuman=n()}(globalThis,()=>(()=>{var e={"../../node_modules/@baidu/weirwood-error/esm/plugins/Plugin.js":function(){},"../../node_modules/@baidu/weirwood-perf/esm/index.js":function(e,n){var r=new Date().getTime();function i(e){var n=window.BOOMR;if(window){if(!e){if(window.parent===window||!document.getElementById("boomr-if-as"))return;if(window.BOOMR&&n.boomerang_frame&&n.window)try{n.boomerang_frame.document.domain!==n.window.document.domain&&(n.boomerang_frame.document.domain=n.window.document.domain)}catch(e){n.isCrossOriginError(e)||n.addError(e,"BOOMR_check_doc_domain.domainFix")}e=document.domain}if(e&&-1!==e.indexOf(".")&&window.parent){try{window.parent.document;return}catch(n){try{document.domain=e}catch(e){return}}try{window.parent.document;return}catch(n){e=e.replace(/^[\w\-]+\./,"")}i(e)}}}function o(e){return"[object String]"===Object.prototype.toString.call(e)}function s(e){return"object"==typeof e&&null!==e}function a(e,n){return!!o(n)&&e.some(function(e){if(!e)return!1;if(o(e))return -1!==n.indexOf(e);if("[object RegExp]"===Object.prototype.toString.call(e))try{return e.test(n)}catch(n){return console.error(e+"正则书写有误"),!1}return console.error(e+"忽略匹配项类型应该是String、RegExp"),!1})}function c(e,n){var r=e.lastClick,i=void 0===r?0:r,o=n.timing.requestStart;return!!i&&!!(o-i<50)}i(),n.PerfClient=function(){function e(e){!(e&&e.ignoreUrls&&e.ignoreUrls.length&&this.shouldIgnoreUrls(e.ignoreUrls))&&(this.BOOMR=function(e){var n,o,s,a,c,d,l,u,f,p=e;e.parent!==e&&document.getElementById("boomr-if-as")&&"script"===document.getElementById("boomr-if-as").nodeName.toLowerCase()&&(e=e.parent),c=e.document,e.BOOMR||(e.BOOMR={});var h=e.BOOMR;if(h.version)return h;h.version="1.3.15",h.window=e,h.boomerang_frame=p,h.plugins||(h.plugins={});try{new e.CustomEvent("CustomEvent"),d=function(n,r){return new e.CustomEvent(n,r)}}catch(e){}try{!d&&c.createEvent&&c.createEvent("CustomEvent")&&(d=function(e,n){var r=c.createEvent("CustomEvent");return n=n||{cancelable:!1,bubbles:!1},r.initCustomEvent(e,n.bubbles,n.cancelable,n.detail),r})}catch(e){}if(!d&&c.createEventObject&&(d=function(e,n){var r=c.createEventObject();return r.type=r.propertyName=e,r.detail=n.detail,r}),d||(d=function(){}),l=function(e,n,r){var i=d(e,{detail:n});function o(){try{c.dispatchEvent?c.dispatchEvent(i):c.fireEvent&&c.fireEvent("onpropertychange",i)}catch(e){}}i&&(r?h.setImmediate(o):o())},void 0!==c.hidden?(u="visibilityState",f="visibilitychange"):void 0!==c.mozHidden?(u="mozVisibilityState",f="mozvisibilitychange"):void 0!==c.msHidden?(u="msVisibilityState",f="msvisibilitychange"):void 0!==c.webkitHidden&&(u="webkitVisibilityState",f="webkitvisibilitychange"),a={t_start:r,t_end:void 0,url:"",config_url:null,loadedLate:!1,beaconsSent:0,isUnloaded:!1,beaconInQueue:!1,cookies:{},testedCookies:!1,constants:{BEACON_TYPE_SPAS:["spa","spa_hard"],MAX_GET_LENGTH:2e3},session:{domain:(s={beacon_url:"",beacon_url_force_https:!0,beacon_urls_allowed:[],beacon_type:"AUTO",beacon_auth_key:"Authorization",beacon_auth_token:void 0,beacon_with_credentials:!1,beacon_disable_sendbeacon:!1,site_domain:e.location.hostname.replace(/.*?([^.]+\.[^.]+)\.?$/,"$1").toLowerCase(),user_ip:"",autorun:!0,hasSentPageLoadBeacon:!1,r:void 0,same_site_cookie:"Lax",secure_cookie:!1,forced_same_site_cookie_none:!1,events:{page_ready:[],page_unload:[],before_unload:[],dom_loaded:[],visibility_changed:[],prerender_to_visible:[],before_beacon:[],beacon:[],page_load_beacon:[],xhr_load:[],click:[],form_submit:[],config:[],xhr_init:[],spa_init:[],spa_navigation:[],spa_cancel:[],xhr_send:[],xhr_error:[],error:[],netinfo:[],rage_click:[],before_early_beacon:[]},public_events:{before_beacon:"onBeforeBoomerangBeacon",beacon:"onBoomerangBeacon",onboomerangloaded:"onBoomerangLoaded"},translate_events:{onbeacon:"beacon",onconfig:"config",onerror:"error",onxhrerror:"xhr_error"},unloadEventsCount:0,unloadEventCalled:0,listenerCallbacks:{},vars:{},singleBeaconVars:{},varPriority:{"-1":{},1:{}},errors:{},disabled_plugins:{},localStorageSupported:!1,LOCAL_STORAGE_PREFIX:"_boomr_",nativeOverwrites:[],xb_handler:function(n){return function(r){var i;r||(r=e.event),r.target?i=r.target:r.srcElement&&(i=r.srcElement),3===i.nodeType&&(i=i.parentNode),i&&i.nodeName&&"OBJECT"===i.nodeName.toUpperCase()&&"application/x-shockwave-flash"===i.type||s.fireEvent(n,i)}},clearEvents:function(){var e;for(e in this.events)this.events.hasOwnProperty(e)&&(this.events[e]=[])},clearListeners:function(){var e;for(e in s.listenerCallbacks)if(s.listenerCallbacks.hasOwnProperty(e))for(;s.listenerCallbacks[e].length;)h.utils.removeListener(s.listenerCallbacks[e][0].el,e,s.listenerCallbacks[e][0].fn);s.listenerCallbacks={}},fireEvent:function(e,n){var r,i,o,s;if(e=e.toLowerCase(),this.translate_events[e]&&(e=this.translate_events[e]),this.events.hasOwnProperty(e)){for(this.public_events.hasOwnProperty(e)&&l(this.public_events[e],n),o=this.events[e],"before_beacon"!==e&&"beacon"!==e&&h.real_sendBeacon(),s=o.length,r=0;r<s;r++)try{(i=o[r]).fn.call(i.scope,n,i.cb_data)}catch(n){h.addError(n,"fireEvent."+e+"<"+r+">")}for(r=0;r<s;r++)try{o[r].once&&(o.splice(r,1),s--,r--)}catch(n){h.addError(n,"fireEvent."+e+"<"+r+">")}}},spaNavigation:function(){s.onloadfired=!0},beaconUrlAllowed:function(e){if(!s.beacon_urls_allowed||0===s.beacon_urls_allowed.length)return!0;for(var n=0;n<s.beacon_urls_allowed.length;n++)if(new RegExp(s.beacon_urls_allowed[n]).exec(e))return!0;return!1},checkLocalStorageSupport:function(){var n=s.LOCAL_STORAGE_PREFIX+"clss";s.localStorageSupported=!1;try{if(!e.JSON||!e.localStorage)return;e.localStorage.setItem(n,n),s.localStorageSupported=e.localStorage.getItem(n)===n,e.localStorage.removeItem(n)}catch(e){s.localStorageSupported=!1}},onFrameUnloaded:function(){var e,n;for(e=0,h.isUnloaded=!0;e<s.nativeOverwrites.length;e++)(n=s.nativeOverwrites[e]).obj[n.functionName]=n.origFn;s.nativeOverwrites=[]}}).site_domain,ID:void 0,start:void 0,length:0,enabled:!0},utils:{hasPostMessageSupport:function(){return!!e.postMessage&&("function"==typeof e.postMessage||"object"==typeof e.postMessage)},objectToString:function(e,n,r){var i,o=[];if(!e||"object"!=typeof e)return e;if(void 0===n&&(n="\n "),r||(r=0),h.utils.isArray(e)){for(i=0;i<e.length;i++)r>0&&null!==e[i]&&"object"==typeof e[i]?o.push(this.objectToString(e[i],n+("\n "===n?" ":""),r-1)):"&"===n?o.push(encodeURIComponent(e[i])):o.push(e[i]);n=","}else for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r>0&&null!==e[i]&&"object"==typeof e[i]?o.push(encodeURIComponent(i)+"="+this.objectToString(e[i],n+("\n "===n?" ":""),r-1)):"&"===n?o.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i])):o.push(i+"="+e[i]));return o.join(n)},getCookie:function(e){var n;if(!e)return null;if(h.utils.mark("get_cookie"),void 0!==h.cookies[e])return!1===h.cookies[e]?void 0:h.cookies[e];if(void 0===(n=this.getRawCookie(e))){h.cookies[e]=!1;return}return h.cookies[e]=n,h.cookies[e]},getRawCookie:function(e){var n,r;return e?(e=" "+e+"=",(n=(r=" "+c.cookie+";").indexOf(e))>=0)?(n+=e.length,r.substring(n,r.indexOf(";",n)).replace(/^"/,"").replace(/"$/,"")):void 0:null},setCookie:function(e,n,r){var i,o,a,d,l;if(!e||!h.session.domain||void 0===n)return h.addVar("nocookie",1),!1;if((i=this.objectToString(n,"&"))===h.cookies[e])return!0;if((o=e+'="'+i+'"').length<500){d=[o,"path=/","domain="+h.session.domain],"number"==typeof r&&((l=new Date).setTime(l.getTime()+1e3*r),l=l.toGMTString(),d.push("expires="+l));var u=this.getSameSiteAttributeParts();if("https:"===location.protocol&&!0===s.secure_cookie&&-1===u.indexOf("Secure")&&u.push("Secure"),d=d.concat(u),h.utils.mark("set_cookie_real"),c.cookie=d.join("; "),h.testedCookies)return"number"!=typeof r||r>0?h.cookies[e]=i:h.cookies[e]=void 0,!0;if(h.cookies[e]=void 0,i===(a=this.getCookie(e))||void 0===a&&"number"==typeof r&&r<=0)return h.cookies[e]=i,h.testedCookies=!0,h.removeVar("nocookie"),!0}return h.addVar("nocookie",1),!1},getSubCookies:function(e){var n,r,i,o,s=!1,a={};if(!e||"string"!=typeof e)return null;for(r=0,i=(n=e.split("&")).length;r<i;r++)(o=n[r].split("="))[0]&&(o.push(""),a[decodeURIComponent(o[0])]=decodeURIComponent(o[1]),s=!0);return s?a:null},removeCookie:function(e){return this.setCookie(e,{},-86400)},getSameSiteAttributeParts:function(){var e=s.same_site_cookie.toUpperCase();return(s.forced_same_site_cookie_none&&(e="NONE"),"LAX"===e)?["SameSite=Lax"]:"NONE"===e?"https:"===location.protocol&&this.isCurrentUASameSiteNoneCompatible()?["SameSite=None","Secure"]:[]:"STRICT"===e?["SameSite=Strict"]:["SameSite=Lax"]},getLocalStorage:function(n){var r,i;if(!n||!s.localStorageSupported)return null;try{if(r=e.localStorage.getItem(s.LOCAL_STORAGE_PREFIX+n),null===r)return;i=e.JSON.parse(r)}catch(e){return null}return i&&"object"==typeof i.items?"number"==typeof i.expires&&h.now()>=i.expires?void this.removeLocalStorage(n):i.items:(this.removeLocalStorage(n),null)},setLocalStorage:function(n,r,i){var o,a,c;if(!n||!s.localStorageSupported||"object"!=typeof r)return!1;if(o={items:r},"number"==typeof i&&(o.expires=h.now()+1e3*i),(a=e.JSON.stringify(o)).length<5e4)try{if(e.localStorage.setItem(s.LOCAL_STORAGE_PREFIX+n,a),c=e.localStorage.getItem(s.LOCAL_STORAGE_PREFIX+n),a===c)return!0}catch(e){}return!1},removeLocalStorage:function(n){if(!n||!s.localStorageSupported)return!1;try{return e.localStorage.removeItem(s.LOCAL_STORAGE_PREFIX+n),!0}catch(e){}return!1},cleanupURL:function(e,n){if(!e||h.utils.isArray(e))return"";if(s.strip_query_string&&(e=e.replace(/\?.*/,"?qs-redacted")),void 0!==n&&e&&e.length>n){var r=e.indexOf("?");e=-1!==r&&r<n?e.substr(0,r)+"?...":e.substr(0,n-3)+"..."}return e},hashQueryString:function(e,n){return e?e.match?(e.match(/^\/\//)&&(e=location.protocol+e),e.match(/^(https?|file):/))?(n&&(e=e.replace(/#.*/,"")),e.replace(/\?([^#]*)/,function(e,n){return"?"+(n.length>10?h.utils.hashString(n):n)})):(h.error("Passed in URL is invalid: "+e),""):(h.addError("TypeError: Not a string","hashQueryString",typeof e),""):e},pluginConfig:function(e,n,r,i){var o,s=0;if(!n||!n[r])return!1;for(o=0;o<i.length;o++)void 0!==n[r][i[o]]&&(e[i[o]]=n[r][i[o]],s++);return s>0},arrayFilter:function(e,n){var r=[];if(!(this.isArray(e)||e&&"number"==typeof e.length)||"function"!=typeof n)return r;if("function"==typeof e.filter)r=e.filter(n);else for(var i,o=-1,s=e.length;++o<s;)n(i=e[o],o,e)&&(r[r.length]=i);return r},arrayFind:function(e,n){if((this.isArray(e)||e&&"number"==typeof e.length)&&"function"==typeof n)if("function"==typeof e.find)return e.find(n);else{for(var r,i=-1,o=e.length;++i<o;)if(n(r=e[i],i,e))return r;return}},isMutationObserverSupported:function(){return!(e&&e.navigator&&e.navigator.userAgent&&e.navigator.userAgent.match(/Trident.*rv[ :]*11\./))&&e&&e.MutationObserver&&"function"==typeof e.MutationObserver},addObserver:function(n,r,i,o,s,a){var c,d,l={observer:null,timer:null};if(!this.isMutationObserverSupported()||!o||!n)return null;function u(e){var n=!1;l.timer&&(clearTimeout(l.timer),l.timer=null),o&&((n=o.call(a,e,s))||(o=null)),!n&&l.observer&&(l.observer.disconnect(),l.observer=null),"number"==typeof n&&n>0&&(l.timer=setTimeout(u,n))}return c=e.MutationObserver,e.Zone&&"function"==typeof e.Zone.__symbol__&&(d=e.Zone.__symbol__("MutationObserver"))&&"string"==typeof d&&e.hasOwnProperty(d)&&"function"==typeof e[d]&&(c=e[d]),l.observer=new c(u),i&&(l.timer=setTimeout(u,l.timeout)),l.observer.observe(n,r),l},addListener:function(e,n,r,i){var o=!1;e.addEventListener?("object"==typeof i?o=i:"boolean"==typeof i&&i&&h.browser.supportsPassive()&&(o={capture:!1,passive:!0}),e.addEventListener(n,r,o)):e.attachEvent&&e.attachEvent("on"+n,r),s.listenerCallbacks[n]=s.listenerCallbacks[n]||[],s.listenerCallbacks[n].push({el:e,fn:r})},removeListener:function(e,n,r){if(e.removeEventListener?e.removeEventListener(n,r,!1):e.detachEvent&&e.detachEvent("on"+n,r),s.listenerCallbacks.hasOwnProperty(n)){for(var i=0;i<s.listenerCallbacks[n].length;i++)if(r===s.listenerCallbacks[n][i].fn&&e===s.listenerCallbacks[n][i].el)return void s.listenerCallbacks[n].splice(i,1)}},isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},inArray:function(e,n){var r;if(void 0===e||void 0===n||!n.length)return!1;for(r=0;r<n.length;r++)if(n[r]===e)return!0;return!1},getQueryParamValue:function(e,n){var r,i,o,s;if(!e)return null;for("string"==typeof n?(r=h.window.document.createElement("a")).href=n:r="object"==typeof n&&"string"==typeof n.search?n:h.window.location,i=r.search.slice(1).split(/&/),o=0;o<i.length;o++)if(i[o]&&(s=i[o].split("=")).length&&s[0]===e)try{return s.length>1?decodeURIComponent(s.splice(1).join("=").replace(/\+/g," ")):""}catch(e){if(e&&"string"==typeof e.name&&-1!==e.name.indexOf("URIError"));else throw e}return null},generateUUID:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})},generateId:function(e){return"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx".substr(0,e||40).replace(/x/g,function(e){var e=(Math.random()||.01).toString(36);return"0"===e?"0":e.substr(2,1)})},serializeForUrl:function(e){return h.utils.Compression&&h.utils.Compression.jsUrl?h.utils.Compression.jsUrl(e):window.JSON?JSON.stringify(e):""},getMyURL:function(){var e=document.currentScript||document.getElementById("boomr-if-as")||document.getElementById("boomr-scr-as");if(e)return e.src;var n,r,i=document.getElementsByTagName("script");for(r=i.length;r--;)if("interactive"===i[r].readyState)return i[r].src;try{throw Error()}catch(e){if("stack"in e&&(n=this.arrayFilter(e.stack.split(/\n/),function(e){return e.match(/https?:\/\//)}))&&n.length)return n[0].replace(/.*(https?:\/\/.+?)(:\d+)+\D*$/m,"$1")}return""},scroll:function(){var n=void 0!==e.pageXOffset,r="CSS1Compat"===(e.document.compatMode||""),i={x:0,y:0};return n?"function"==typeof e.pageXOffset?(i.x=e.pageXOffset(),i.y=e.pageYOffset()):(i.x=e.pageXOffset,i.y=e.pageYOffset):r?(i.x=e.document.documentElement.scrollLeft,i.y=e.document.documentElement.scrollTop):(i.x=e.document.body.scrollLeft,i.y=e.document.body.scrollTop),"number"==typeof i.sx&&(i.sx=Math.round(i.sx)),"number"==typeof i.sy&&(i.sy=Math.round(i.sy)),i},windowHeight:function(){return e.innerHeight||e.document.documentElement.clientHeight||e.document.body.clientHeight},windowWidth:function(){return e.innerWidth||e.document.documentElement.clientWidth||e.document.body.clientWidth},isNative:function(e){return!!e&&e.toString&&!e.hasOwnProperty("toString")&&/\[native code\]/.test(String(e))},overwriteNative:function(e,n,r){e&&r&&(h.boomerang_frame!==h.window&&s.nativeOverwrites.push({obj:e,functionName:n,origFn:e[n]}),e[n]=r)},isInteger:function(e){return(Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e})(e)},isObjectEmpty:function(e){for(var n in e)if(e.hasOwnProperty(n))return!1;return!0},hashString:function(e){e=encodeURIComponent(e);for(var n=0x811c9dc5,r=0;r<e.length;r++)n^=e.charCodeAt(r),n+=(n<<1)+(n<<4)+(n<<7)+(n<<8)+(n<<24);return parseInt((n>>>0).toString()+e.length).toString(36)},isCurrentUASameSiteNoneCompatible:function(){return!e||!e.navigator||!e.navigator.userAgent||"string"!=typeof e.navigator.userAgent||this.isUASameSiteNoneCompatible(e.navigator.userAgent)},isUASameSiteNoneCompatible:function(e){var n=e.match(/(UCBrowser)\/(\d+\.\d+)\.(\d+)/);if(n){var r=parseFloat(n[2]),i=n[3];return 12.13===r?!(i<=2):!(r<12.13)}if(n=e.match(/(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+)/)){var o=n[2];return!(o>=51)||!(o<=66)}if(n=e.match(/(Macintosh;.*Mac OS X 10_14[_\d]*.*) AppleWebKit\//))return(!(n=e.match(/Version\/.* Safari\//))||null!==(n=e.match(/Chrom(?:e|ium)/)))&&!(n=e.match(/^Mozilla\/\d+(?:\.\d+)* \(Macintosh;.*Mac OS X \d+(?:_\d+)*\) AppleWebKit\/\d+(?:\.\d+)* \(KHTML, like Gecko\)$/));return!(n=e.match(/(iP.+; CPU .*OS 12(?:_\d+)*.*)/))},forEach:function(e,n,r){if(h.utils.isArray(e)&&"function"==typeof n)for(var i=e.length,o=0;o<i;o++)e.hasOwnProperty(o)&&n.call(r,e[o],o,e)},mark:function(e){var n=h.getPerformance();n&&"function"==typeof n.mark&&!h.window.BOOMR_no_mark&&n.mark("boomr:"+e)},measure:function(e,n,r){var i=h.getPerformance();i&&"function"==typeof i.measure&&!h.window.BOOMR_no_mark&&i.measure("boomr:"+e,n?"boomr:"+n:void 0,r?"boomr:"+r:void 0)}},browser:{results:{},supportsPassive:function(){if(void 0===h.browser.results.supportsPassive){if(h.browser.results.supportsPassive=!1,!Object.defineProperty)return!1;try{var e=Object.defineProperty({},"passive",{get:function(){h.browser.results.supportsPassive=!0}});window.addEventListener("test",null,e)}catch(e){}}return h.browser.results.supportsPassive}},init:function(n){var r,o,a,d,l=["autorun","sampleRate","interactionSampleRate","normalizeUrl","initiatorTypes","ignoreXhrs","beacon_auth_key","beacon_auth_token","beacon_with_credentials","beacon_disable_sendbeacon","beacon_url","beacon_url_force_https","beacon_type","site_domain","strip_query_string","user_ip","sendWindow"];if(i(),n||(n={}),void 0!==n.log&&(this.log=n.log),this.log||(this.log=function(){}),this.pageId||(this.pageId=h.utils.generateId(8)),n.primary&&s.handlers_attached)return this;for(d in void 0!==n.site_domain&&(/:/.test(n.site_domain)&&(n.site_domain=e.location.hostname.toLowerCase()),this.session.domain=n.site_domain),h.session.enabled&&void 0===h.session.ID&&(h.session.ID=h.utils.generateUUID()),void 0!==n.autorun&&(s.autorun=n.autorun),this.plugins)if(this.plugins.hasOwnProperty(d)){if(n[d]&&n[d].hasOwnProperty("enabled")&&!1===n[d].enabled){s.disabled_plugins[d]=1,"function"==typeof this.plugins[d].disable&&this.plugins[d].disable();continue}if(s.disabled_plugins[d]){if(!n[d]||!n[d].hasOwnProperty("enabled")||!0!==n[d].enabled)continue;"function"==typeof this.plugins[d].enable&&this.plugins[d].enable(),delete s.disabled_plugins[d]}if("function"==typeof this.plugins[d].init)try{this.plugins[d].init(n)}catch(e){h.addError(e,d+".init")}}for(a=0;a<l.length;a++)void 0!==n[l[a]]&&(s[l[a]]=n[l[a]]);if((!s.handlers_attached&&!n.wait||s.handlers_attached&&s.waiting_for_config)&&(s.onloadfired||void 0!==s.autorun&&!1===s.autorun||(h.hasBrowserOnloadFired()&&(h.loadedLate=!0),h.attach_page_ready(h.page_ready_autorun)),s.waiting_for_config=!1),s.handlers_attached)return this;for(n.wait&&(s.waiting_for_config=!0),h.attach_page_ready(function(){h.t_onload||(h.t_onload=h.now())}),h.utils.addListener(e,"DOMContentLoaded",function(){s.fireEvent("dom_loaded")}),h.fireEvent("config",n),h.subscribe("config",function(e){e.beacon_url&&(s.beacon_url=e.beacon_url)}),h.subscribe("spa_navigation",s.spaNavigation,null,s),void 0!==f&&(h.utils.addListener(c,f,function(){s.fireEvent("visibility_changed")}),s.lastVisibilityState=h.visibilityState(),h.subscribe("visibility_changed",function(){var e=h.visibilityState();h.lastVisibilityEvent[e]=h.now(),"prerender"===s.lastVisibilityState&&"prerender"!==e&&(h.addVar("vis.pre","1"),s.fireEvent("prerender_to_visible")),s.lastVisibilityState=e})),h.utils.addListener(c,"mouseup",s.xb_handler("click")),r=c.getElementsByTagName("form"),o=0;o<r.length;o++)h.utils.addListener(r[o],"submit",s.xb_handler("form_submit"));return e.onpagehide||null===e.onpagehide||h.utils.addListener(e,"unload",function(){h.window=e=null}),h.boomerang_frame!==h.window&&h.utils.addListener(h.boomerang_frame,"unload",s.onFrameUnloaded),s.handlers_attached=!0,this},attach_page_ready:function(n){h.hasBrowserOnloadFired()?this.setImmediate(n,null,null,h):e.onpagehide||null===e.onpagehide?h.utils.addListener(e,"pageshow",function(){n()}):h.utils.addListener(e,"load",function(){n()})},page_ready_autorun:function(e){s.autorun&&h.page_ready(e,!0)},page_ready:function(n,r){var i;return r||"number"!=typeof n||(i=n,n=null),n||(n=e.event),n||(n={name:"load"}),r?"number"==typeof e.BOOMR_page_ready&&(n.timing=n.timing||{},n.timing.loadEventEnd=e.BOOMR_page_ready,h.addVar("pr",1,!0)):(n.timing=n.timing||{},i?n.timing.loadEventEnd=i:"number"==typeof e.BOOMR_page_ready?n.timing.loadEventEnd=e.BOOMR_page_ready:n.timing.loadEventEnd=h.now(),h.addVar("pr",1,!0)),s.onloadfired||(s.fireEvent("page_ready",n),s.onloadfired=!0),this},hasBrowserOnloadFired:function(){var n=h.getPerformance();return c.readyState&&"complete"===c.readyState||n&&n.timing&&n.timing.loadEventStart>0||e.BOOMR_onload>0},onloadFired:function(){return s.onloadfired},setImmediate:function(n,r,i,o){var s,a;"undefined"!=typeof Error&&(a=(a=Error()).stack?a.stack.replace(/^Error/,"Called"):void 0),s=function(){n.call(o||null,r,i||{},a),s=null},e.requestIdleCallback?e.requestIdleCallback(s,{timeout:1e3}):e.setImmediate?e.setImmediate(s):setTimeout(s,10)},now:Date.now||function(){return new Date().getTime()},getPerformance:function(){try{if(h.window){if("performance"in h.window&&h.window.performance)return h.window.performance;return h.window.msPerformance||h.window.webkitPerformance||h.window.mozPerformance}}catch(e){}},forceSameSiteCookieNone:function(){s.forced_same_site_cookie_none=!0},hrNow:function(){var e,n,r=h.getPerformance();return r&&r.now?e=r.now():(n=h.plugins.RT&&h.plugins.RT.navigationStart&&h.plugins.RT.navigationStart()||h.t_lstart||h.t_start,e=h.now()-n),e},visibilityState:void 0===u?function(){return"visible"}:function(){return c[u]},lastVisibilityEvent:{},registerEvent:function(e){return s.events.hasOwnProperty(e)||(s.events[e]=[]),this},disable:function(){s.clearEvents(),s.clearListeners()},fireEvent:function(e,n){return s.fireEvent(e,n)},subscribe:function(n,r,i,o,a){var c,d,l;for(n=n.toLowerCase(),s.translate_events[n]&&(n=s.translate_events[n]),s.events.hasOwnProperty(n)||(s.events[n]=[]),l=s.events[n],c=0;c<l.length;c++)if((d=l[c])&&d.fn===r&&d.cb_data===i&&d.scope===o)return this;if(l.push({fn:r,cb_data:i||{},scope:o||null,once:a||!1}),"page_ready"===n&&s.onloadfired&&s.autorun&&this.setImmediate(r,null,i,o),"page_unload"===n||"before_unload"===n){s.unloadEventsCount++;var u,f=this;l.length,u=function(n){if(r&&r.call(o,n||e.event,i),++s.unloadEventCalled===s.unloadEventsCount){h.real_sendBeacon();var a=f.plugins.Continuity;a&&"function"==typeof a.checkIfSendAdditionalBeacon&&a.checkIfSendAdditionalBeacon()}},"page_unload"===n&&(e.onpagehide||null===e.onpagehide?h.utils.addListener(e,"pagehide",u):h.utils.addListener(e,"unload",u)),h.utils.addListener(e,"beforeunload",u)}return this},addError:function(e,n,r){var i,o=h.plugins.Errors;(h.error("Boomerang caught error: "+e+", src: "+n+", extra: "+r),o&&o.is_supported())?"string"==typeof e?o.send({message:e,extra:r,functionName:n,noStack:!0},o.VIA_APP,o.SOURCE_BOOMERANG):("string"==typeof n&&(e.functionName=n),void 0!==r&&(e.extra=r),o.send(e,o.VIA_APP,o.SOURCE_BOOMERANG)):("string"!=typeof e&&((i=String(e)).match(/^\[object/)&&(i=e.name+": "+(e.description||e.message).replace(/\r\n$/,"")),e=i),void 0!==n&&(e="["+n+":"+h.now()+"] "+e),r&&(e+=":: "+r),s.errors[e]?s.errors[e]++:s.errors[e]=1)},isCrossOriginError:function(e){return"SecurityError"===e.name||"TypeError"===e.name&&"Permission denied"===e.message||"Error"===e.name&&e.message&&e.message.match(/^(Permission|Access is) denied/)||-0x7ff5ffba===e.number},addVar:function(e,n,r){if("string"==typeof e)s.vars[e]=n,r&&(s.singleBeaconVars[e]=1);else if("object"==typeof e){var i;for(i in e)e.hasOwnProperty(i)&&(s.vars[i]=e[i],r&&(s.singleBeaconVars[i]=1))}return this},appendVar:function(e,n){var r=h.getVar(e)||"";return r&&(r+=","),h.addVar(e,r+n),this},removeVar:function(e){var n,r;if(!arguments.length)return this;for(n=0,r=1==arguments.length&&h.utils.isArray(e)?e:arguments;n<r.length;n++)s.vars.hasOwnProperty(r[n])&&delete s.vars[r[n]];return this},hasVar:function(e){return s.vars.hasOwnProperty(e)},getVar:function(e){return s.vars[e]},getPendingVar:function(e){return s.ttinewBeaconPendingData?s.ttinewBeaconPendingData[e]:s.vars[e]},hasPending:function(){return s.ttinewBeaconPending},setVarPriority:function(e,n){return"number"!=typeof n||1!==Math.abs(n)||(s.varPriority[n][e]=1),this},setReferrer:function(e){s.r=e},requestStart:function(e){var n=h.now();return h.plugins.RT.startTimer("xhr_"+e,n),{loaded:function(r){h.responseEnd(e,n,r)}}},readyToSend:function(){var e;for(e in this.plugins)if(this.plugins.hasOwnProperty(e)){if(s.disabled_plugins[e])continue;if("function"==typeof this.plugins[e].readyToSend&&!1===this.plugins[e].readyToSend())return!1}return!0},responseEnd:function(e,n,r,i){if(n="number"==typeof n?n:h.now(),i="number"==typeof i?i:h.now(),!h.readyToSend())return void setTimeout(function(){h.responseEnd(e,n,r,i)},1e3);if(!h.hasSentPageLoadBeacon()&&!h.utils.inArray(e.initiator,h.constants.BEACON_TYPE_SPAS))return void h.subscribe("page_load_beacon",function(){h.responseEnd(e,n,r,i)},null,h,!0);if(s.beaconInQueue)return void h.subscribe("beacon",function(){h.responseEnd(e,n,r,i)},null,h,!0);if(s.beaconInQueue=!0,"object"==typeof e){if(!e.url)return;s.fireEvent("xhr_load",e)}else h.real_sendBeacon(),h.addVar("xhr.pg",e),h.plugins.RT.startTimer("xhr_"+e,n),s.fireEvent("xhr_load",{name:"xhr_"+e,data:r,timing:{loadEventEnd:i}})},uninstrumentXHR:function(){},instrumentXHR:function(){},uninstrumentFetch:function(){},instrumentFetch:function(){},sendBeacon:function(e){return e&&(s.beacon_url_override=e),s.beaconQueued||(s.beaconQueued=!0,h.setImmediate(h.real_sendBeacon,null,null,h)),!0},sendBeaconWhenReady:function(e,n,r){if(s.beaconInQueue)return void h.subscribe("beacon",function(){h.sendBeaconWhenReady(e,n,r)},null,h,!0);for(var i in s.beaconInQueue=!0,e)e.hasOwnProperty(i)&&h.addVar(i,e[i],!0);"function"==typeof n&&void 0!==r&&n.apply(r),h.sendBeacon()},real_sendBeacon:function(){var n,r=[],i={};if(!s.beaconQueued&&!s.ttinewBeaconPending)return!1;for(n in s.beaconQueued=!1,this.plugins)if(this.plugins.hasOwnProperty(n)){if(s.disabled_plugins[n])continue;if(!this.plugins[n].is_complete(s.vars))return delete s.vars.early,!1}if(!window||!window.Image||!window.navigator||!h.window)return!1;var o=h.utils.inArray(s.vars["http.initiator"],h.constants.BEACON_TYPE_SPAS),a=void 0===s.vars["http.initiator"]||o;for(n in s.vars.pgu||(s.vars.pgu=o?c.URL:c.URL.replace(/#.*/,"")),s.vars.pgu=h.utils.cleanupURL(s.vars.pgu),(!s.vars.u||o)&&(s.vars.u=s.vars.pgu),s.vars.pgu===s.vars.u&&delete s.vars.pgu,s.r?s.vars.r=h.utils.cleanupURL(s.r):delete s.vars.r,s.vars.v=h.version,h.snippetVersion&&(s.vars.sv=h.snippetVersion),s.vars.sm=h.snippetMethod||"i",h.session.enabled&&(s.vars["rt.si"]=h.session.ID+"-"+Math.round(h.session.start/1e3).toString(36),s.vars["rt.ss"]=h.session.start,void 0===s.vars.early?s.vars["rt.sl"]=h.session.length>=1?h.session.length:1:s.vars["rt.sl"]=h.session.length),h.visibilityState()&&(s.vars["vis.st"]=h.visibilityState(),h.lastVisibilityEvent.visible&&(s.vars["vis.lv"]=h.now()-h.lastVisibilityEvent.visible),h.lastVisibilityEvent.hidden&&(s.vars["vis.lh"]=h.now()-h.lastVisibilityEvent.hidden)),s.vars["ua.plt"]=navigator.platform,s.vars["ua.vnd"]=navigator.vendor,this.pageId&&(s.vars.pid=this.pageId),s.vars.n=++this.beaconsSent,e!==window&&(s.vars.if=""),s.errors)s.errors.hasOwnProperty(n)&&r.push(n+(s.errors[n]>1?" (*"+s.errors[n]+")":""));if(r.length>0&&(s.vars.errors=r.join("\n")),s.errors={},"function"==typeof s.normalizeUrl&&s.vars.u&&(s.vars.nmu=s.normalizeUrl(s.vars.u)),s.vars["http.initiator"]&&-1===s.initiatorTypes.indexOf(s.vars["http.initiator"]))return s.beaconInQueue=!1,!1;for(n in s.fireEvent("before_beacon",s.vars),s.vars)s.vars.hasOwnProperty(n)&&(i[n]=s.vars[n]);if(h.removeVar(["qt","pgu"]),void 0===s.vars.early){for(var d in s.singleBeaconVars)s.singleBeaconVars.hasOwnProperty(d)&&h.removeVar(d);s.singleBeaconVars={},!s.hasSentPageLoadBeacon&&a&&(s.hasSentPageLoadBeacon=!0,h.setImmediate(function(){s.fireEvent("page_load_beacon",i)}))}if(h.session.rate_limited)return!1;if(s.beaconInQueue=!1,"interaction"===s.vars["http.initiator"]){if("number"==typeof s.interactionSampleRate&&Math.random()>s.interactionSampleRate)return!1}else if("number"==typeof s.sampleRate&&Math.random()>s.sampleRate)return!1;return this.plugins.Continuity.getTtiWaitForXHRDone()&&"spa_hard"===i["http.initiator"]&&!i["c.tti.new"]&&(s.ttinewBeaconPending=!0,s.ttinewBeaconPendingData=i),h.sendBeaconData(i),!0},sendAdditionalBeacon:function(e){s.ttinewBeaconPendingData&&(h.sendBeaconData(Object.assign(s.ttinewBeaconPendingData,e)),s.ttinewBeaconPendingData=void 0,s.ttinewBeaconPending=!1)},sendBeaconData:function(n){var r,i,o,a,c=[],d=[],l=!0;if(s.beacon_url=s.beacon_url_override||s.beacon_url,!s.beacon_url||!s.beaconUrlAllowed(s.beacon_url)||h.utils.isObjectEmpty(n))return!1;s.fireEvent("beacon",n),c=this.getVarsOfPriority(n,-1),d=this.getVarsOfPriority(n,1),r=c.concat(this.getVarsOfPriority(n,0),d).join("&"),s.beacon_url_force_https&&s.beacon_url.match(/^\/\//)&&(s.beacon_url="https:"+s.beacon_url),i=s.beacon_url+(s.beacon_url.indexOf("?")>-1?"&":"?")+r,"GET"===s.beacon_type?(l=!0,i.length>h.constants.MAX_GET_LENGTH&&(window.console&&(console.warn||console.log)||function(){})("Boomerang: Warning: Beacon may not be sent via GET due to payload size > 2000 bytes")):("POST"===s.beacon_type||i.length>h.constants.MAX_GET_LENGTH)&&(l=!1);var u=s.sendWindow;if(u&&u.navigator&&"function"==typeof u.navigator.sendBeacon&&h.utils.isNative(u.navigator.sendBeacon)&&"function"==typeof e.Blob&&"GET"!==s.beacon_type&&void 0===s.beacon_auth_token&&!s.beacon_disable_sendbeacon){var f=new e.Blob([r+"&sb=1"],{type:"text/plain"});if(u.navigator.sendBeacon(s.beacon_url,f))return!0}if(h.orig_XMLHttpRequest||u&&u.XMLHttpRequest||(l=!0),l){try{o=new Image}catch(e){return!1}o.src=i}else{a=new(u.XMLHttpRequest||h.window.orig_XMLHttpRequest||h.orig_XMLHttpRequest||h.window.XMLHttpRequest);try{this.sendXhrPostBeacon(a,r)}catch(e){a=new h.boomerang_frame.XMLHttpRequest,this.sendXhrPostBeacon(a,r)}}return!0},hasSentPageLoadBeacon:function(){return s.hasSentPageLoadBeacon},sendXhrPostBeacon:function(e,n){e.open("POST",s.beacon_url),e.setRequestHeader("Content-type","text/plain"),void 0!==s.beacon_auth_token&&(void 0===s.beacon_auth_key&&(s.beacon_auth_key="Authorization"),e.setRequestHeader(s.beacon_auth_key,s.beacon_auth_token)),s.beacon_with_credentials&&(e.withCredentials=!0),e.send(n)},getVarsOfPriority:function(e,n){var r,i=[],o=0!==n?s.varPriority[n]:e;for(r in o)o.hasOwnProperty(r)&&e.hasOwnProperty(r)&&(i.push(this.getUriEncodedVar(r,void 0===e[r]?"":e[r])),0!==n&&delete e[r]);return i},getUriEncodedVar:function(e,n){return null==n&&(n=""),"object"==typeof n&&(n=h.utils.serializeForUrl(n)),encodeURIComponent(e)+"="+encodeURIComponent(n)},getResourceTiming:function(e,n,r){var i,o=h.getPerformance();try{if(o&&"function"==typeof o.getEntriesByName){if(!(i=o.getEntriesByName(e))||!i.length||"function"==typeof r&&(!(i=h.utils.arrayFilter(i,r))||!i.length))return;return i.length>1&&"function"==typeof n&&i.sort(n),i[i.length-1]}}catch(e){}},setBeaconUrlsAllowed:function(e){s.beacon_urls_allowed=e}},h.url){var m=h.window.document.createElement("a");m.href=h.url,a.url=m.href}else a.url=a.utils.getMyURL();delete window.BOOMR_start,"number"==typeof window.BOOMR_lstart?(a.t_lstart=window.BOOMR_lstart,delete window.BOOMR_lstart):"number"==typeof h.window.BOOMR_lstart&&(a.t_lstart=h.window.BOOMR_lstart),"number"==typeof h.window.BOOMR_onload&&(a.t_onload=h.window.BOOMR_onload),"object"==typeof console&&void 0!==console.log?a.log=function(e,n,r){}:a.log=function(){},a.debug=(n=function(e){return function(n,r){return this.log(n,e,"boomerang"+(r?"."+r:"")),this}})("debug"),a.info=n("info"),a.warn=n("warn"),a.error=n("error"),a.traceTime=function(e){var n=e||h.now();return[new Date(n).getHours(),new Date(n).getMinutes(),new Date(n).getSeconds(),new Date(n).getMilliseconds()].join(":")},a.cleanupURL=function(){return""+location.toString().replace(location.protocol+"//"+location.host,"")},a.trace=function(e,n,r,i){h.traceTime(),h.cleanupURL()},a.traceHighlight=function(e,n,r,i){h.traceTime(),h.cleanupURL()},a.warn=function(e,n,r,i){h.traceTime(),h.cleanupURL()};try{var v=a.getPerformance();v&&"function"==typeof v.now&&/\[native code\]/.test(String(v.now))&&v.timing&&v.timing.navigationStart&&(a.now=function(){return Math.round(v.now()+v.timing.navigationStart)})}catch(e){}for(o in s.checkLocalStorageSupport(),a)a.hasOwnProperty(o)&&(h[o]=a[o]);return h.xhr_excludes||(h.xhr_excludes={}),h.checkWindowOverrides=function(e){if(!Object.getOwnPropertyNames)return[];var n,r,i,o=[];function s(n){(function(n){for(var r,i,o=n.split("."),s=e;s&&o.length;)try{s=s[o.shift()]}catch(e){return!1}return"function"==typeof s&&(r=s,!("console.assert"===(i=n)||"Function.prototype"===i||i.indexOf("onload")>=0||i.indexOf("onbeforeunload")>=0||i.indexOf("onerror")>=0||i.indexOf("onload")>=0||i.indexOf("NodeFilter")>=0||r.toString&&!r.hasOwnProperty("toString")&&/\[native code\]/.test(String(r))))})(n)&&o.push(n)}(n=c.createElement("iframe")).style.display="none",n.src="javascript:false",c.getElementsByTagName("script")[0].parentNode.appendChild(n),i=Object.getOwnPropertyNames(r=n.contentWindow);for(var a=0;a<i.length;a++){var d=i[a];if("window"!==d&&"self"!==d&&"top"!==d&&"parent"!==d&&"frames"!==d&&r[d]&&("object"==typeof r[d]||"function"==typeof r[d])){s(d);var l=[];try{l=Object.getOwnPropertyNames(r[d])}catch(e){}for(var u=0;u<l.length;u++)s([d,l[u]].join("."));if(r[d].prototype){l=Object.getOwnPropertyNames(r[d].prototype);for(var u=0;u<l.length;u++)s([d,"prototype",l[u]].join("."))}}}return o},h.checkDocumentOverrides=function(e){return h.utils.arrayFilter(["readyState","domain","hidden","URL","cookie"],function(n){return e.hasOwnProperty(n)})},"true"===h.utils.getQueryParamValue("overridden")&&e&&e.Object&&Object.getOwnPropertyNames&&[].concat(h.checkWindowOverrides(e)).concat(h.checkDocumentOverrides(c)).length,l("onBoomerangLoaded",{BOOMR:h},!0),h}(window),this.BOOMR.addVar("token",e.token),e&&this.initOptions(e))}return e.prototype.shouldIgnoreUrls=function(e){return a(e,location.href)},e.prototype.initOptions=function(e){this.installPlugins();var n=e.sampleRate||1,r=e.interactionSampleRate||.1;for(var i in this.BOOMR.init({beacon_url:"https://fclog.baidu.com/log/weirwood?type=perf",autorun:!1,History:{auto:!0},instrument_xhr:!0,monitor_fetch:!0,ResourceTiming:{clearOnBeacon:!0,monitorClearResourceTimings:!0},Continuity:{monitorLongTasks:!0,monitorPageBusy:!0,monitorFrameRate:!0,monitorInteractions:!0,monitorStats:!1,ttiWaitForXHRDone:e.ttiWaitForXHRDone||!0,ttiWaitForXHRIgnore:e.ttiWaitForXHRIgnore||[],waitAfterOnload:e.waitAfterOnload||!1,afterOnload:e.afterOnload||!1},ignoreImage:e.ignoreImage||!1,sampleRate:n,interactionSampleRate:n*r,normalizeUrl:e.normalizeUrl,initiatorTypes:e.initiatorTypes||["spa_hard","spa","xhr"],ignoreXhrs:e.ignoreXhrs||[],sendWindow:e.sendWindow||window}),this.BOOMR)this.BOOMR.hasOwnProperty(i)&&(this[i]=this.BOOMR[i])},e.prototype.installPlugins=function(){var e,n,r,i,o=function(e){var n,r,i=(e=e||window).document,o=function(n){var r=!1;if(n.getBoundingClientRect){var o=n.getBoundingClientRect();(r={top:Math.max(o.top,0),left:Math.max(o.left,0),bottom:Math.min(o.bottom,e.innerHeight||i.documentElement.clientHeight),right:Math.min(o.right,e.innerWidth||i.documentElement.clientWidth)}).bottom<=r.top||r.right<=r.left?r=!1:r.area=(r.bottom-r.top)*(r.right-r.left)}return r},s=function(e,n){if(n){var r=o(e);r&&a.push({url:n,area:r.area,rect:r})}},a=[],c=[];try{var d=e.performance.timing.navigationStart;!function(){for(var n=i.getElementsByTagName("*"),r=/url\(.*(http.*)\)/ig,c=0;c<n.length;c++){var d=n[c],l=e.getComputedStyle(d);if("IMG"==d.tagName&&s(d,d.currentSrc||d.src),l["background-image"]){r.lastIndex=0;var u=r.exec(l["background-image"]);u&&u.length>1&&s(d,u[1].replace('"',""))}if("IFRAME"==d.tagName)try{var f=o(d);if(f){var p=RUMSpeedIndex(d.contentWindow);p&&a.push({tm:p,area:f.area,rect:f})}}catch(e){}}}();for(var l={},u=e.performance.getEntriesByType("resource"),f=0;f<u.length;f++)l[u[f].name]=u[f].responseEnd;for(var p=0;p<a.length;p++)"tm"in a[p]||(a[p].tm=void 0!==l[a[p].url]?l[a[p].url]:0);if(!function(){try{for(var r=performance.getEntriesByType("paint"),o=0;o<r.length;o++)if("first-paint"==r[o].name){d=performance.getEntriesByType("navigation")[0].startTime,n=r[o].startTime-d;break}}catch(e){}if(void 0===n&&"msFirstPaint"in e.performance.timing&&(n=e.performance.timing.msFirstPaint-d),void 0===n&&"chrome"in e&&"loadTimes"in e.chrome){var s=e.chrome.loadTimes();if("firstPaintTime"in s&&s.firstPaintTime>0){var a=s.startLoadTime;"requestTime"in s&&(a=s.requestTime),s.firstPaintTime>=a&&(n=(s.firstPaintTime-a)*1e3)}}if(void 0===n||n<0||n>12e4){n=e.performance.timing.responseStart-d;for(var c={},l=i.getElementsByTagName("head")[0].children,o=0;o<l.length;o++){var u=l[o];"SCRIPT"==u.tagName&&u.src&&!u.async&&(c[u.src]=!0),"LINK"==u.tagName&&"stylesheet"==u.rel&&u.href&&(c[u.href]=!0)}for(var f=e.performance.getEntriesByType("resource"),p=!1,h=0;h<f.length;h++)if(!p&&c[f[h].name]&&("script"==f[h].initiatorType||"link"==f[h].initiatorType)){var m=f[h].responseEnd;(void 0===n||m>n)&&(n=m)}else p=!0}n=Math.max(n,0)}(),!function(){for(var r={0:0},o=0,s=0;s<a.length;s++){var d=n;"tm"in a[s]&&a[s].tm>n&&(d=a[s].tm),void 0===r[d]&&(r[d]=0),r[d]+=a[s].area,o+=a[s].area}var l=Math.max(i.documentElement.clientWidth,e.innerWidth||0)*Math.max(i.documentElement.clientHeight,e.innerHeight||0);if(l>0&&(l=.1*Math.max(l-o,0),void 0===r[n]&&(r[n]=0),r[n]+=l,o+=l),o){for(var u in r)r.hasOwnProperty(u)&&c.push({tm:u,area:r[u]});c.sort(function(e,n){return e.tm-n.tm});for(var f=0,p=0;p<c.length;p++)f+=c[p].area,c[p].progress=f/o}}(),c.length){r=0;for(var h=0,m=0,v=0;v<c.length;v++){var g=c[v].tm-h;g>0&&m<1&&(r+=(1-m)*g),h=c[v].tm,m=c[v].progress}}else r=n}catch(e){}return r}(window);if(this.BOOMR.addVar("speedIndex",o,!0),!function(){if(!BOOMR.plugins.Continuity){var e,n=0,r=1,i=2,o="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_",s=".",a={passive:!0,capture:!0},c=BOOMR.getPerformance(),d={},l=c&&c.timing&&c.timing.navigationStart?c.timing.navigationStart:BOOMR.now(),u=function(r){var i={},o={},s=[],a=0,u=0,f=0,p=!0;function h(){return Math.floor((BOOMR.now()-r)/100)}function m(n){function o(e){return n?BOOMR.getPendingVar(e):BOOMR.getVar(e)}if(e.ttiWaitForXHRDone&&BOOMR.utils.inArray(o("http.initiator"),BOOMR.constants.BEACON_TYPE_SPAS)){var s=o("c.tti.xd"),a=0,c="spa"===o("http.initiator");c&&(a=o("rt.tstart")-l,s=o("c.tti.xd.increasing"));var d=s?s-(r-l):c?a:r-l,u=h(),f=0,p=0,m=0;for(f=Math.floor(d/100);f<=u;f++){if(!n&&(i.longtask&&i.longtask[f]||i.fps&&(!i.fps[f]||i.fps[f]<2)||i.busy&&i.busy[f]>50||i.interdly&&i.interdly[f])){p=0;continue}if(++p>=5){m=Math.max((m=r+(f-5)*100-a)-l,o("c.tti.xd"));break}}return m>0?(n||e.addToBeacon("c.tti.new",m),e.hasAddedTtinewToBeacon=!0,m):(e.hasAddedTtinewToBeacon=!1,0)}}return BOOMR.fpsLog&&BOOMR.fpsLog.length&&(r=BOOMR.fpsLog[0]+l),d.timeToInteractive=function(){if(a)return a-l},d.timeToVisuallyReady=function(){if(u)return u-l},d.timeToHeroImagesReady=function(){if(e.ttiWaitForHeroImages&&f)return f-l},d.timeToFrameworkReady=function(){if(e.ttiWaitForFrameworkReady&&e.frameworkReady)return e.frameworkReady-l},d.log=function(){return s},{register:function(e,r,s){i[e]||(i[e]=[]),o[e]={compressMode:r||n,backfillLast:s}},set:function(e,n,r){void 0===r&&(r=h()),i[e]&&(i[e][r]=n)},log:function(n,r,i){void 0===r&&(r=h()),s.push({type:n,time:r,val:i}),s.length>e.logMaxEntries&&Array.prototype.splice.call(s,0,s.length-e.logMaxEntries)},increment:function(e,n,r){void 0===r&&(r=h()),void 0===n&&(n=1),i[e]&&(i[e][r]||(i[e][r]=0),i[e][r]+=n)},getTimeBucket:h,getStats:function(e,n){var o,s=0,a=0,c=1/0,d=0,l=Math.floor((n-r)/100);if(!i[e])return 0;for(var u in i[e])(u=parseInt(u,10))>=l&&i[e].hasOwnProperty(u)&&(o=i[e][u],s++,a+=o,c=Math.min(c,o),d=Math.max(d,o));return{total:a,count:s,min:c,max:d}},analyze:function(n){var v=h(),g=0,y=0;if(e.sendLog&&void 0!==n&&function(){for(var n="",r=0;r<s.length;r++){var i=s[r];for(var o in 0!==r&&(n+="|"),n+=i.type,n+=Math.round(i.time-l).toString(36),i.val)i.val.hasOwnProperty(o)&&(n+=","+o,"number"==typeof i.val[o]?n+=i.val[o].toString(36):n+=i.val[o])}""!==n&&e.addToBeacon("c.l",n)}(),e.sendTimeline&&void 0!==n){var b,_,w=n?Math.max(n,BOOMR.now()-12e4):n;for(b in i)i.hasOwnProperty(b)&&""!==(_=E(o[b].compressMode,o[b].backfillLast,i[b],0!==w?Math.floor((w-r)/100):0,h()))&&e.addToBeacon("c.t."+b,_)}if(!a){if(!u&&!(u=function(){var n=0;if(e.ttiWaitForFrameworkReady){if(!e.frameworkReady)return;n=e.frameworkReady}if(BOOMR.plugins.PaintTiming&&BOOMR.plugins.PaintTiming.is_supported()&&c&&c.timeOrigin){var r=BOOMR.plugins.PaintTiming.getTimingFor("largest-contentful-paint");r||(r=BOOMR.plugins.PaintTiming.getTimingFor("first-contentful-paint")),r||(r=BOOMR.plugins.PaintTiming.getTimingFor("first-paint")),r&&(n=Math.max(n,Math.round(r+c.timeOrigin)))}else if(c&&c.timing&&c.timing.msFirstPaint)n=Math.max(n,c.timing.msFirstPaint);else if(BOOMR.window&&BOOMR.window.chrome&&"function"==typeof BOOMR.window.chrome.loadTimes){var i=BOOMR.window.chrome.loadTimes();i&&i.firstPaintTime&&(n=Math.max(n,1e3*i.firstPaintTime))}return c&&c.timing&&c.timing.domContentLoadedEventEnd&&(n=Math.max(n,c.timing.domContentLoadedEventEnd)),e.ttiWaitForHeroImages&&(f=function(e){var n,r,i,o,s,a=0;if(!BOOMR.window||!BOOMR.window.document||"function"!=typeof BOOMR.window.document.querySelectorAll||!c||"function"!=typeof c.getEntriesByType)return 0;if((n=BOOMR.window.document.querySelectorAll(e+", "+e+" * img, "+e+" * image"))&&n.length)for(r=0;r<n.length;r++){if(!(o=n[r].currentSrc||n[r].src||"function"==typeof n[r].getAttribute&&n[r].getAttribute("xlink:href"))&&"function"==typeof BOOMR.window.getComputedStyle){var d=BOOMR.window.getComputedStyle(n[r])&&BOOMR.window.getComputedStyle(n[r]).getPropertyValue("background");if(d){var u=d.match(/url\(["']?([^"']*)["']?\)/);u&&u.length>0&&(o=u[1])}}if(o&&(s=c.getEntriesByName(o))&&s.length)for(i=0;i<s.length;i++)a=Math.max(a,s[i].responseEnd)}return a?Math.floor(a+l):0}(e.ttiWaitForHeroImages))&&(n=Math.max(n,f)),n}())||(p&&(e.addToBeacon("c.tti.vr",d.timeToVisuallyReady()),e.addToBeacon("c.tti.fr",d.timeToFrameworkReady()),e.addToBeacon("c.tti.hi",d.timeToHeroImagesReady()),p=!1),!i.longtask&&!i.fps&&!i.busy))return;for(g=Math.floor((u-r)/100);g<=v;g++){if(i.longtask&&i.longtask[g]||i.fps&&(!i.fps[g]||i.fps[g]<2)||i.busy&&i.busy[g]>50||i.interdly&&i.interdly[g]){y=0;continue}if(++y>=5){a=Math.max(a=r+(g-5)*100,u);break}}a>0&&e.addToBeacon("c.tti",d.timeToInteractive())}m()},analyzeXHRDone:m,stop:function(){i={},s=[]},onBeacon:function(){for(var e in i)i.hasOwnProperty(e)&&(i[e]=[]);s=[],p=!1}}},f=function(n){if(n.PerformanceObserver&&n.LayoutShift){var r=!0,i=0,o=0,s=[],a=new n.PerformanceObserver(function(e){r&&e.getEntries().map(function(e){if(!e.hadRecentInput){var n=s[0],r=s[s.length-1];o&&e.startTime-r.startTime<1e3&&e.startTime-n.startTime<5e3?(o+=e.value,s.push(e)):(o=e.value,s=[e]),o>i&&(i=o)}})});try{a.observe({type:"layout-shift",buffered:!0})}catch(e){return}return d.clsScore=function(){return i},{clearClsScore:c,analyze:function(n){e.addToBeacon("c.cls",d.clsScore())},stop:function(){r=!1,a.disconnect(),c()},onBeacon:function(){c()}}}function c(){i=0}},p=function(r,i){if(r.PerformanceObserver&&r.PerformanceLongTaskTiming){var o={unknown:0,self:1,"same-origin-ancestor":2,"same-origin-descendant":3,"same-origin":4,"cross-origin-ancestor":5,"cross-origin-descendant":6,"cross-origin-unreachable":7,"multiple-contexts":8},s={unknown:0,script:1,layout:2},a={unknown:0,iframe:1,embed:2,object:3},c=new r.PerformanceObserver(function(e){var n,r,o={};if(u){n=e.getEntries(),Array.prototype.push.apply(l,n);var s=i.getTimeBucket();for(r=0;r<n.length;r++){var a=n[r].duration;f+=a;var c=s;for(a-=100;a>0&&c>=0;)o[--c]?o[c]++:o[c]=1,a-=100}for(var d in o)o.hasOwnProperty(d)&&i.increment("longtask",o[d],d);i.increment("longtask",n.length)}});try{c.observe({entryTypes:["longtask"]})}catch(e){return}i.register("longtask",n);var l=[],u=!0,f=0;return d.longTasksTime=function(){return f},d.longTasksCount=function(){return l.length},{getTasks:function(){return l},clearTasks:p,analyze:function(n){var r,i,c,u,f,p=[],h=[];if(0!==l.length){for(r=0;r<l.length;r++){for(i=0,u={s:Math.round((c=l[r]).startTime).toString(36),d:Math.ceil(c.duration).toString(36),n:o[c.name]?o[c.name]:0},h=[];i<c.attribution.length;i++)if("script"!==(f=c.attribution[i]).name||"iframe"!==f.containerType||f.containerName||f.containerId||f.containerSrc){var m,v,g=f.containerName?f.containerName:void 0,y=f.containerId?f.containerId:void 0;g===y&&(g=void 0);var b=void 0===y?f.containerSrc:void 0;h.push({a:s[f.name]?s[f.name]:0,t:a[f.containerType]?a[f.containerType]:0,n:g,i:y,s:b})}h.length>0&&(u.a=h),p.push(u)}e.addToBeacon("c.lt.n",d.longTasksCount(),!0),e.addToBeacon("c.lt.tt",d.longTasksTime()),e.addToBeacon("c.lt",(m=p,(v=BOOMR.utils.Compression&&BOOMR.utils.Compression.jsUrl||window.UserTimingCompression&&window.UserTimingCompression.jsUrl||BOOMR.window.UserTimingCompression&&BOOMR.window.UserTimingCompression.jsUrl)?v(m):window.JSON?JSON.stringify(m):""))}},stop:function(){u=!1,c.disconnect(),p()},onBeacon:function(){p()}}}function p(){l=[],f=0}},h=function(n,r){r.register("busy",i);var o=Math.floor(3.125),s=BOOMR.now(),a=0,c=0,l=0,u=0,f=!1,p=!1;return d.pageBusy=function(){return 0===l?0:Math.ceil(u/l*100)},f=setInterval(function(){var e=BOOMR.now(),n=e-s;if(s=e,n>68){var r=Math.floor((n-32)/32);a+=r,c+=r,n-=32*r}a++,n>36&&c++},32),p=setInterval(function(){var e=r.getTimeBucket(),n=e,i=0;if(0!==a){for(;a>o+1&&i<=100;)r.set("busy",100,--n),a-=o,c=Math.max(c-o,0),l+=o,u+=o,i++;l+=a,u+=c,r.set("busy",Math.ceil(c/a*100),e),a=0,c=0}},100),{analyze:function(n){e.addToBeacon("c.b",d.pageBusy())},stop:function(){f&&(clearInterval(f),f=!1),p&&(clearInterval(p),p=!1)},onBeacon:function(){l=0,u=0}}},m=function(r,i){i.register("fps",n);var o,s,a=0,c=0,u=!0;if(BOOMR.fpsLog&&BOOMR.fpsLog.length){s=o=BOOMR.fpsLog[0]+l;for(var f=0;f<BOOMR.fpsLog.length;f++){var p=l+BOOMR.fpsLog[f];i.increment("fps",1,Math.floor((p-o)/100)),p-s>=50&&c++,s=p}a=BOOMR.fpsLog.length,delete BOOMR.fpsLog}else o=BOOMR.now();return r.requestAnimationFrame(function e(n){u&&(n-s>=50&&c++,s=n,a++,i.increment("fps"),r.requestAnimationFrame(e))}),d.fps=function(){var e=d.fpsDuration();if(e)return Math.floor(a/(e/1e3))},d.fpsDuration=function(){if(o)return BOOMR.now()-o},d.fpsMinimum=function(){if(d.fpsDuration()){var e=i.getStats("fps",o).min;return e!==1/0?e:void 0}},d.fpsLongFrames=function(){return c},d.fpsStart=function(){return o?o.toString(36):0},{analyze:function(n){e.addToBeacon("c.f",d.fps()),e.addToBeacon("c.f.d",d.fpsDuration()),e.addToBeacon("c.f.m",d.fpsMinimum()),e.addToBeacon("c.f.l",d.fpsLongFrames()),e.addToBeacon("c.f.s",d.fpsStart())},stop:function(){u=!1,o=0},onBeacon:function(){u&&(o=BOOMR.now()),a=0,c=0}}},v=function(r,o,s){if(r&&r.document&&r.document.body&&r.document.documentElement){var c=2e3,l=20,u=0,f=0,p=0,h=0,m=0,v=0,g=0,y=0,b=!1,_=r.document.body,w=r.document.documentElement;o.register("scroll",n),o.register("scrollpct",i);var S=Math.max(_.scrollHeight,_.offsetHeight,w.clientHeight,w.scrollHeight,w.offsetHeight)-BOOMR.utils.windowHeight();return d.scrollPct=function(){return h},d.scrollCount=function(){return m},d.scrollDistinct=function(){return g},d.scrollPixels=function(){return v},BOOMR.utils.addListener(r,"scroll",R,a),b=setInterval(function(){var e=Math.min(p,100);0!==e&&o.set("scrollpct",e),p=0},100),{analyze:function(n){e.addToBeacon("c.s",d.scrollCount()),e.addToBeacon("c.s.p",d.scrollPct()),e.addToBeacon("c.s.y",d.scrollPixels()),e.addToBeacon("c.s.d",d.scrollDistinct())},stop:function(){b&&(clearInterval(b),b=!1),BOOMR.utils.removeListener(r,"scroll",R)},onBeacon:function(){h=0,m=0,v=0,g=0}}}function R(e){var n=BOOMR.now();m++,n-y>c&&g++,y=n;var r=Math.ceil(BOOMR.utils.scroll().y),i=Math.abs(u-r);v+=i,o.increment("scroll",i),(0===f||Math.abs(f-r)>l)&&(o.log(0,n,{y:r}),f=r),p+=Math.round(i/S*100),h+=Math.round(i/S*100),u=r}},g=function(r,i,o){i.register("click",n);var s=0,c=0,l=0,u=0,f=0,p=null;function h(e){var n=BOOMR.now(),r=e.clientX,a=e.clientY;s++;var d=Math.round(Math.sqrt(Math.pow(f-a,2)+Math.pow(u-r,2)));p===e.target||d<=10?++c+1>=3&&(l++,BOOMR.fireEvent("rage_click",e)):c=0,u=r,f=a,p=e.target,i.increment("click"),i.log(1,n,{x:r,y:a}),e.cancelable&&o.interact("click",n,e)}return d.clicksCount=function(){return s},d.clicksRage=function(){return l},BOOMR.utils.addListener(r.document,"click",h,a),{analyze:function(n){e.addToBeacon("c.c",d.clicksCount()),e.addToBeacon("c.c.r",d.clicksRage())},stop:function(){BOOMR.utils.removeListener(r.document,"click",h)},onBeacon:function(){s=0,c=0,l=0}}},y=function(r,i,o){i.register("key",n);var s=0,c=0;function l(e){var n=BOOMR.now();s++,27===e.keyCode&&c++,i.increment("key"),i.log(3,n),e.cancelable&&o.interact("key",n,e)}return d.keyCount=function(){return s},d.keyEscapes=function(){return c},BOOMR.utils.addListener(r.document,"keydown",l,a),{analyze:function(n){e.addToBeacon("c.k",d.keyCount()),e.addToBeacon("c.k.e",d.keyEscapes())},stop:function(){BOOMR.utils.removeListener(r.document,"keydown",l)},onBeacon:function(){s=0,c=0}}},b=function(r,o,s){o.register("mouse",n),o.register("mousepct",i);var c=0,l=0,u=0,f=0,p=0,h=0,m=0,v=!1,g=!1,y=Math.round(Math.sqrt(Math.pow(BOOMR.utils.windowHeight(),2)+Math.pow(BOOMR.utils.windowWidth(),2)));function b(e){var n=e.clientX,r=e.clientY,i=Math.round(Math.sqrt(Math.pow(l-r,2)+Math.pow(c-n,2))),s=Math.round(i/y*100);p+=s,h+=s,m+=i,c=n,l=r,o.increment("mouse",i)}return d.mousePct=function(){return h},d.mousePixels=function(){return m},v=setInterval(function(){var e=Math.min(p,100);0!==e&&o.set("mousepct",e),p=0},100),g=setInterval(function(){(u!==c||f!==l)&&Math.round(Math.sqrt(Math.pow(f-l,2)+Math.pow(u-c,2)))>=10&&(o.log(2,BOOMR.now(),{x:c,y:l}),u=c,f=l)},250),BOOMR.utils.addListener(r.document,"mousemove",b,a),{analyze:function(n){e.addToBeacon("c.m.p",d.mousePct()),e.addToBeacon("c.m.n",d.mousePixels())},stop:function(){v&&(clearInterval(v),v=!1),g&&(clearInterval(g),g=!1),BOOMR.utils.removeListener(r.document,"mousemove",b)},onBeacon:function(){h=0,m=0}}},_=function(r,i,o){i.register("inter",n),i.register("interdly",n);var s=0,a=null,c=0,u=0,f=0,p=0,h=!0,m=0,v=0,g=!1,y=!1,b=!1,_=!1;function w(){g&&(clearTimeout(g),g=!1),y&&(clearTimeout(y),y=!1)}function S(){BOOMR.sendBeaconWhenReady({"rt.start":"manual","http.initiator":"interaction","rt.tstart":m,"rt.end":v},function(){w(),BOOMR.fireEvent("interaction")},e)}return d.interactionDelayed=function(){return f},d.interactionDelayedTime=function(){return Math.ceil(p)},d.interactionAvgDelay=function(){if(c>0)return Math.ceil(u/c)},d.timeToFirstInteraction=function(){if(s)return s-l},d.firstInputDelay=function(){if(null!==a)return a},BOOMR.subscribe("spa_init",function(){b=!0,w()},null,e),{interact:function(n,d,_){var w=0;d=d||BOOMR.now(),h&&(c++,s||(s=_&&_.timeStamp?_.timeStamp+l:d),_&&_.timeStamp&&!(e.isSafari&&r!==window)&&(w=_.timeStamp>14e11?d-_.timeStamp:BOOMR.hrNow()-_.timeStamp,u+=w,null===a&&(a=Math.ceil(w)),w>50&&(i.increment("interdly"),f++,p+=w)),i.increment("inter"),!b&&e.afterOnloadMonitoring&&(v=BOOMR.now(),m||(m=v,y=setTimeout(S,3e4)),g&&(clearTimeout(g),g=!1),g=setTimeout(S,o)))},analyze:function(n){var r;e.addToBeacon("c.i.dc",d.interactionDelayed()),e.addToBeacon("c.i.dt",d.interactionDelayedTime()),e.addToBeacon("c.i.a",d.interactionAvgDelay()),!_&&(BOOMR.plugins.EventTiming&&BOOMR.plugins.EventTiming.is_enabled()&&(r=BOOMR.plugins.EventTiming.metrics.firstInputDelay()),r||null===a||(r=d.firstInputDelay()),r&&(e.addToBeacon("c.fid",Math.ceil(r),!0),e.addToBeacon("c.ttfi",BOOMR.plugins.EventTiming.metrics.timeToFirstInteraction()||d.timeToFirstInteraction()),_=!0))},stop:function(){h=!1},onBeacon:function(){p=0,f=0,c=0,u=0,m=0,v=0,b=!1,w()}}},w=function(e,n,r){var i,o,s=!0;function c(){s&&(r.interact("pd",i,o),i=null,o=null,BOOMR.utils.removeListener(window,"pointerup",c))}function d(e){s&&e.cancelable&&(i=BOOMR.now(),o=e,BOOMR.utils.addListener(window,"pointerup",c,a))}function l(){s=!1,BOOMR.utils.removeListener(window,"pointerdown",d),BOOMR.utils.removeListener(window,"pointerup",c),BOOMR.utils.removeListener(window,"pointercancel",l)}return BOOMR.utils.addListener(window,"pointerdown",d,a),BOOMR.utils.addListener(window,"pointercancel",l,a),{stop:l}},S=function(e,n,r){var i=!0;function o(e){if(i&&e.cancelable){var n=BOOMR.now();r.interact("md",n,e)}}return BOOMR.utils.addListener(window,"mousedown",o,a),{stop:function(){i=!1,BOOMR.utils.removeListener(window,"mousedown",o)}}},R=function(e,n,r){var i=!0;function o(e){if(i&&e.cancelable){var n=BOOMR.now();r.interact("ts",n,e)}}return BOOMR.utils.addListener(window,"touchstart",o,a),{stop:function(){i=!1,BOOMR.utils.removeListener(window,"touchstart",o)}}},T=function(e,r,i){r.register("vis",n);var o={visible:0,hidden:1,prerender:2,unloaded:3},s=!0;return BOOMR.subscribe("visibility_changed",function(e){var n=BOOMR.now();s&&(r.increment("vis"),r.log(4,n,{s:o[BOOMR.visibilityState()]}))}),{stop:function(){s=!1}}},C=function(e,r,i){r.register("orn",n);var o=!0;function s(e){var n=BOOMR.now(),i=window.orientation;if(o){r.increment("orn");var s=window.screen&&(screen.orientation||screen.msOrientation||screen.mozOrientation||{});s&&"number"==typeof s.angle&&(i=screen.orientation.angle),"number"==typeof i&&r.log(5,n,{a:i})}}return BOOMR.utils.addListener(e,"orientationchange",s,a),{stop:function(){o=!1,BOOMR.utils.removeListener(e,"orientationchange",s)}}},x=function(e,o){o.register("mem",r,!0),o.register("bat",i,!0),o.register("domsz",r,!0),o.register("domln",r,!0),o.register("mut",n);var s,a=e.document,d=!0,l=!1,u=null,f=0,p=0,h=a.getElementsByTagName("*");function m(){d&&u&&o.set("bat",u.level)}return l=setInterval(function(){var e=c&&c.memory&&c.memory.usedJSHeapSize;if(e&&o.set("mem",e),p=h.length,o.set("domsz",a.documentElement.innerHTML.length),o.set("domln",p),f>0){var n=Math.min(Math.round(f/p*100),100);o.set("mut",n),f=0}},1e3),e.navigator&&"function"==typeof e.navigator.getBattery&&e.navigator.getBattery().then(function(e){(u=e).onlevelchange&&(u.onlevelchange=m)}),BOOMR.utils.isMutationObserverSupported()&&(s=BOOMR.utils.addObserver(a,{childList:!0,subtree:!0},null,function(e){return e.forEach(function(e){if("childList"!==e.type)return!0;for(var n=0;n<e.addedNodes.length;n++){var r=e.addedNodes[n];f++,f+=r.getElementsByTagName?r.getElementsByTagName("*").length:0}}),!0},null,this)),{stop:function(){d=!1,l&&(clearInterval(l),l=!1),s&&s.observer&&(s.observer.disconnect(),s=null),u&&u.onlevelchange&&(u.onlevelchange=null),h=null}}};e={monitorLongTasks:!0,monitorPageBusy:!0,monitorFrameRate:!0,monitorInteractions:!0,monitorStats:!1,monitorLayoutShifts:!0,afterOnload:!1,afterOnloadMaxLength:6e4,afterOnloadMinWait:5e3,waitAfterOnload:!1,ttiWaitForFrameworkReady:!1,ttiWaitForHeroImages:!1,ttiWaitForXHRDone:!1,ttiWaitForXHRIgnore:[],sendLog:!0,sendTimeline:!0,logMaxEntries:100,initialized:!1,complete:!1,isSpa:!1,firedPageReady:!1,afterOnloadMonitoring:!1,frameworkReady:null,timeline:null,ttiMethod:null,longTaskMonitor:null,pageBusyMonitor:null,frameRateMonitor:null,interactionMonitor:null,scrollMonitor:null,clickMonitor:null,keyMonitor:null,mouseMonitor:null,visibilityMonitor:null,orientationMonitor:null,touchStartMonitor:null,mouseDownMonitor:null,pointerDownMonitor:null,statsMonitor:null,layoutShiftMonitor:null,monitors:["timeline","longTaskMonitor","pageBusyMonitor","frameRateMonitor","scrollMonitor","keyMonitor","clickMonitor","mouseMonitor","interactionMonitor","visibilityMonitor","orientationMonitor","statsMonitor","layoutShiftMonitor","touchStartMonitor","mouseDownMonitor","pointerDownMonitor"],timeOfLastBeacon:0,hasAddedDataToBeacon:!1,hasAddedTtinewToBeacon:void 0,isSafari:window&&window.navigator&&window.navigator.vendor&&-1!==window.navigator.vendor.indexOf("Apple"),onBeforeBeacon:function(){e.runAllAnalyzers()},checkIfSendAdditionalBeacon:function(){if(!1===e.hasAddedTtinewToBeacon&&BOOMR.hasPending()){var n=e.timeline.analyzeXHRDone(!0);BOOMR.sendAdditionalBeacon(n>0?{"c.tti.new":n,add:1}:{"c.tti.new":void 0,add:2})}},runAllAnalyzers:function(){var n,r;if(!e.hasAddedDataToBeacon){for(n=0;n<e.monitors.length;n++)(r=e[e.monitors[n]])&&"function"==typeof r.analyze&&r.analyze(e.timeOfLastBeacon);e.addToBeacon("c.lb",e.timeOfLastBeacon?e.timeOfLastBeacon.toString(36):0),e.timeOfLastBeacon=BOOMR.now(),e.hasAddedDataToBeacon=!0}},onBeacon:function(n){var r;if(!n||void 0===n.early&&(!n["http.initiator"]||0!==n["http.initiator"].indexOf("api_custom_"))){for(r=0;r<e.monitors.length;r++){var i=e[e.monitors[r]];i&&(e.afterOnload||"function"!=typeof i.stop||i.stop(),"function"==typeof i.onBeacon&&i.onBeacon())}e.hasAddedDataToBeacon=!1,n&&n.add&&(e.hasAddedTtinewToBeacon=void 0)}},onXhrLoad:function(n){n&&BOOMR.utils.inArray(n.initiator,BOOMR.constants.BEACON_TYPE_SPAS)&&(e.isSpa=!0),n&&"spa_hard"===n.initiator&&e.onPageReady()},onPageReady:function(){if(e.firedPageReady=!0,e.afterOnload&&e.monitorInteractions&&(e.afterOnloadMonitoring=!0,e.isSpa||"number"!=typeof e.afterOnloadMaxLength||setTimeout(function(){e.afterOnloadMonitoring=!1},e.afterOnloadMaxLength)),e.waitAfterOnload){var n=BOOMR.now();setTimeout(function r(){BOOMR.now()-n>e.waitAfterOnload?(e.complete=!0,BOOMR.sendBeacon()):(e.timeline.analyze(),(e.ttiWaitForXHRDone?BOOMR.getVar("c.tti.new"):d.timeToInteractive())?(e.complete=!0,BOOMR.sendBeacon()):setTimeout(r,500))},500)}else e.complete=!0},addToBeacon:function(e,n,r){0!==n&&void 0!==n||r?BOOMR.addVar(e,n,!0):BOOMR.removeVar(e)}},BOOMR.plugins.Continuity={init:function(n){if(BOOMR.utils.pluginConfig(e,n,"Continuity",["monitorLongTasks","monitorPageBusy","monitorFrameRate","monitorInteractions","monitorStats","afterOnload","afterOnloadMaxLength","afterOnloadMinWait","waitAfterOnload","ttiWaitForFrameworkReady","ttiWaitForHeroImages","ttiWaitForXHRDone","ttiWaitForXHRIgnore","sendLog","logMaxEntries","sendTimeline"]),e.initialized)return this;if(e.initialized=!0,e.timeline=new u(BOOMR.now()),BOOMR.window){if(e.monitorLongTasks&&BOOMR.window.PerformanceObserver&&BOOMR.window.PerformanceLongTaskTiming&&(e.longTaskMonitor=new p(BOOMR.window,e.timeline),e.ttiMethod="lt"),e.monitorFrameRate&&"function"==typeof BOOMR.window.requestAnimationFrame&&(e.frameRateMonitor=new m(BOOMR.window,e.timeline),e.ttiMethod||(e.ttiMethod="raf")),!e.monitorPageBusy||BOOMR.window.PerformanceObserver&&BOOMR.window.PerformanceLongTaskTiming&&e.monitorLongTasks||(e.pageBusyMonitor=new h(BOOMR.window,e.timeline),e.ttiMethod||(e.ttiMethod="b")),e.monitorInteractions){var r=BOOMR.window;e.interactionMonitor=new _(r,e.timeline,e.afterOnloadMinWait),e.scrollMonitor=new v(r,e.timeline,e.interactionMonitor),e.keyMonitor=new y(r,e.timeline,e.interactionMonitor),e.clickMonitor=new g(r,e.timeline,e.interactionMonitor),e.mouseMonitor=new b(r,e.timeline,e.interactionMonitor),e.visibilityMonitor=new T(r,e.timeline,e.interactionMonitor),e.orientationMonitor=new C(r,e.timeline,e.interactionMonitor),e.touchStartMonitor=new R(r,e.timeline,e.interactionMonitor),e.mouseDownMonitor=new S(r,e.timeline,e.interactionMonitor),e.pointerDownMonitor=new w(r,e.timeline,e.interactionMonitor)}e.monitorStats&&(e.statsMonitor=new x(BOOMR.window,e.timeline,e.interactionMonitor)),e.monitorLayoutShifts&&BOOMR.window.PerformanceObserver&&(e.layoutShiftMonitor=new f(BOOMR.window))}return BOOMR.addVar("c.e",l.toString(36)),BOOMR.addVar("c.tti.m",e.ttiMethod),BOOMR.subscribe("before_beacon",e.onBeforeBeacon,null,e),BOOMR.subscribe("beacon",e.onBeacon,null,e),BOOMR.subscribe("page_ready",e.onPageReady,null,e),BOOMR.subscribe("xhr_load",e.onXhrLoad,null,e),BOOMR.subscribe("route_change",e.checkIfSendAdditionalBeacon,null,e),this},is_complete:function(n){return e.complete||n&&("error"===n["http.initiator"]||void 0!==n.early)},frameworkReady:function(){e.frameworkReady=BOOMR.now()},getTtiWaitForXHRDone:function(){return e.ttiWaitForXHRDone},getTTIWaitForXHRIngore:function(){return"function"==typeof e.ttiWaitForXHRIgnore?e.ttiWaitForXHRIgnore():e.ttiWaitForXHRIgnore},checkIfSendAdditionalBeacon:e.checkIfSendAdditionalBeacon,metrics:d,compressBucketLog:E,decompressBucketLog:function(e,o){var a,c,d,l,u,f,p=[],h=o||0;if(!e||0===e.length)return[];for(a=0,f=parseInt(e.charAt(0),10),e=e.substring(1),l=1;a<e.length;a++){if("*"===e.charAt(a)){a++,d=e.indexOf("*",a),l=parseInt(e.substring(a,d),36),a=d;continue}for(e.charAt(a)===s?(a++,d=e.indexOf(s,a),u=parseInt(e.substring(a,d),36),a=d):f===n?u=O(e.charAt(a)):f===r?-1!==(d=e.indexOf(",",a))?(u=parseInt(e.substring(a,d),36),a=d):(u=parseInt(e.substring(a),36),a=e.length):f===i&&(u="__"===e.substr(a,2)?100:parseInt(e.substr(a,2),10),a++),c=1,p[h]=u;c<l;c++)p[++h]=u;h++,l=1}return p},decompressBucketLogNumber:O,decompressLog:function(e){var n,r,i,o,s,a=[];for(n=0,o=e.split("|");n<o.length;n++){for(r=1,s={type:parseInt((i=o[n].split(","))[0].charAt(0),10),time:parseInt(i[0].substring(1),36)};r<i.length;r++)s[i[r].charAt(0)]=i[r].substring(1);a.push(s)}return a}}}function E(e,a,c,d,l){var u,f,p,h,m,v="",g=0;if(!c||0===c.length)return"";if(a)for(void 0===c[d]&&(c[d]=0),u=d+1;u<=l;u++)void 0===c[u]&&(c[u]=c[u-1]);for(u=d;u<=l;u++){if(g="number"!=typeof c[u]||isNaN(c[u])?0:c[u],e===n?p=g<=63?o.charAt(g):s+g.toString(36)+s:e===r?p=g.toString(36):e===i&&(p=g<99?g<=9?"0"+Math.max(g,0):g:"__"),u+3<=l&&(c[u+1]===g||0===g&&void 0===c[u+1])&&(c[u+2]===g||0===g&&void 0===c[u+2])&&(c[u+3]===g||0===g&&void 0===c[u+3])){for(f=1;u<l&&(c[u+1]===g||0===g&&void 0===c[u+1]);)f++,u++;h="*"+f.toString(36)+"*"+p}else h=p;(0!==g||u!==l)&&(e===r&&m&&(v+=","),m=!0,v+=h)}return m?e.toString()+v:""}function O(e){if(!e||!e.charCodeAt)return 0;var n=e.charCodeAt(0);if(n>=48&&n<=57)return n-48;if(n>=97&&n<=122)return n-97+10;if(n>=65&&n<=90)return n-65+36;if(95===n)return 62;if(45===n)return 63;else return 0}}(),!function(){var e,n,r,i,o,s=["uninitialized","open","responseStart","domInteractive","responseEnd"];function d(e){if(!e)return null;e.href=e.href;var n=e.pathname;return"/"!==n.charAt(0)&&(n="/"+n),n}function l(e){var n;if(e.href&&(e.href.match(/^(about:|javascript:|data:)/i)||"function"==typeof BOOMR.getBeaconURL&&BOOMR.getBeaconURL()&&(0===(n=e.href.indexOf(BOOMR.getBeaconURL()))||5===n||6===n)))return!0;return BOOMR.xhr_excludes.hasOwnProperty(e.href)||BOOMR.xhr_excludes.hasOwnProperty(e.hostname)||BOOMR.xhr_excludes.hasOwnProperty(d(e))}function u(){this.watch=0,this.timer=null,this.timerEarlyBeacon=null,this.checkTimer=null,this.pending_events=[],this.lastSpaLocation=null}function f(e,n){var r,i;if(!n||!e)return!1;if("boolean"==typeof n)return!0===n;if("function"==typeof n)try{return!0===n(e)}catch(e){return!1}if(BOOMR.utils.isArray(n)){for(r=0;r<n.length;r++)if("string"==typeof(i=n[r])&&i===e||i instanceof RegExp&&i.test(e))return!0}return!1}function p(){if(o.monitorFetch&&"function"==typeof e.fetch&&"function"==typeof e.Request&&"function"==typeof e.Response&&"function"==typeof e.Promise&&"function"==typeof window.fetch&&!e.fetch.polyfill&&(!BOOMR.proxy_fetch||BOOMR.proxy_fetch!==e.fetch)){if(BOOMR.proxy_fetch&&BOOMR.orig_fetch&&BOOMR.orig_fetch===e.fetch){e.fetch=BOOMR.proxy_fetch;return}BOOMR.orig_fetch=e.orig_fetch||e.fetch,BOOMR.proxy_fetch=function(n,s){var a,c,d,l={timing:{},initiator:"xhr"};if("object"==typeof n&&n instanceof e.Request?(a=n.url,c=s&&s.method||n.method||"GET",o.captureXhrRequestResponse&&(d=s&&s.body||n.body||void 0)):(a=n,c=s&&s.method||"GET",o.captureXhrRequestResponse&&(d=s&&s.body||void 0)),i.href=a,o.xhrExcludeFilter(i))return BOOMR.orig_fetch.apply(e,arguments);BOOMR.fireEvent("xhr_init","fetch"),l.url=i.href,l.method=c,l.type="fetch",d&&(l.requestPayload=d),BOOMR.fireEvent("xhr_send",{resource:l}),r.addEvent(l);try{l.timing.requestStart||(l.timing.requestStart=BOOMR.now());var u=BOOMR.orig_fetch.apply(this,arguments);function f(n,r,i){function s(){var e;i.fetchResponse&&!i.fetchResponse.bodyUsed&&o.fetchBodyUsedWait?(e=BOOMR.now(),i.responseBodyNotUsed=!0,setTimeout(function(){o.loadFinished(i,e)},o.fetchBodyUsedWait)):o.loadFinished(i)}return function(){var o,a=n._bmrNextP;try{for(o=r.apply(this===window?e:this,arguments);a&&!a._bmrHasOnFulfilled;)a=a._bmrNextP;return a||(o instanceof e.Promise?o.then=p(o,o.then,i):s()),o}catch(e){for(;a&&!a._bmrHasOnRejected;)a=a._bmrNextP;throw a||s(),e}}}function p(e,n,r){return e._bmrNextP?n:function(){var i=Array.prototype.slice.call(arguments);i.length>0&&("function"==typeof i[0]&&(i[0]=f(e,i[0],r),e._bmrHasOnFulfilled=!0),i.length>1&&"function"==typeof i[1]&&(i[1]=f(e,i[1],r),e._bmrHasOnRejected=!0));var o=n.apply(e,i);return e._bmrNextP=o,o.then=p(o,o.then,r),o}}return u.then=p(u,u.then,l),u.then(function(n){var i,s=!1,a=!1;if(n.redirected&&(l.responseUrl=n.url),(n.status<200||n.status>=400)&&(l.status=n.status),l.fetchResponse=n,l.index>=0&&r.monitorMO(l.index),o.captureXhrRequestResponse&&"function"==typeof n.clone){(i=n.headers.get("content-type"))&&(s=-1!==i.indexOf("json"),a=-1!==i.indexOf("xml")),l.response={};try{n.clone().text().then(function(n){l.response.text=n,l.response.raw=n,a&&"function"==typeof e.DOMParser&&(l.response.xml=new e.DOMParser().parseFromString(n,"text/xml"))}).then(null,function(e){})}catch(e){}if(s)try{n.clone().json().then(function(e){l.response.json=e}).then(null,function(e){})}catch(e){}}return n},function(e){throw e&&("AbortError"===e.name||20===e.code)?l.status=-999:l.status=-998,e})}catch(e){throw l.status=-997,o.loadFinished(l),e}},BOOMR.utils.overwriteNative(e,"fetch",BOOMR.proxy_fetch)}}function h(){"function"==typeof e.fetch&&BOOMR.orig_fetch&&BOOMR.orig_fetch!==e.fetch&&(e.fetch=BOOMR.orig_fetch)}function m(){if(!BOOMR.proxy_XMLHttpRequest||BOOMR.proxy_XMLHttpRequest!==e.XMLHttpRequest){if(BOOMR.proxy_XMLHttpRequest&&BOOMR.orig_XMLHttpRequest&&BOOMR.orig_XMLHttpRequest===e.XMLHttpRequest){e.XMLHttpRequest=BOOMR.proxy_XMLHttpRequest,u.start();return}BOOMR.orig_XMLHttpRequest=e.orig_XMLHttpRequest||e.XMLHttpRequest,u.start(),BOOMR.subscribe("click",function(){if(!o.singlePageApp||o.spaStartFromClick){var n={timing:{},initiator:"click"};BOOMR.orig_XMLHttpRequest&&BOOMR.orig_XMLHttpRequest!==e.XMLHttpRequest&&(n.timing.requestStart=BOOMR.now(),r.addEvent(n))}}),BOOMR.proxy_XMLHttpRequest=function(){var n,a,c,d={timing:{},initiator:"xhr"},l=!1,u=!1;return a=(n=new BOOMR.orig_XMLHttpRequest).open,c=n.send,n.open=function(r,c,f){if(i.href=c,o.xhrExcludeFilter(i))return u=!0,a.apply(n,arguments);function p(r,i){n.addEventListener(r,function(){if("readystatechange"===r)if(d.timing[s[n.readyState]]=BOOMR.now(),4===n.readyState&&0!==n.status){if(n.responseURL!==d.url&&(d.responseUrl=n.responseURL),(n.status<200||n.status>=400)&&(d.status=n.status),o.captureXhrRequestResponse&&(d.response={text:""===n.responseType||"text"===n.responseType?n.responseText:null,xml:""===n.responseType||"document"===n.responseType?n.responseXML:null,raw:n.response,json:n.responseJSON},n.response&&n.response.constructor&&n.response.constructor===BOOMR.boomerang_frame.Object&&BOOMR.boomerang_frame.Object!==e.Object))try{n.response.constructor=e.Object}catch(e){}o.loadFinished(d)}else 0===n.readyState&&"number"==typeof d.timing.open&&(n.responseURL!==d.url&&(d.responseUrl=n.responseURL),d.status=-999,o.loadFinished(d));else n.responseURL!==d.url&&(d.responseUrl=n.responseURL),"load"===r?0!==n.status&&(n.status<200||n.status>=400)&&(d.status=n.status):d.status=void 0===i?n.status:i,o.loadFinished(d)},!1)}u=!1,void 0===f&&(f=!0),BOOMR.fireEvent("xhr_init","xhr"),l||(f&&p("readystatechange"),p("load"),p("timeout",-1001),p("error",-998),p("abort",-999)),d.url=i.href,d.method=r,d.type="xhr",delete d.status,f||(d.synchronous=!0),l=!0;try{return a.apply(n,arguments)}catch(e){throw d.status=-997,o.loadFinished(d),e}},n.send=function(e){return u||(o.captureXhrRequestResponse&&(n.resource.requestPayload=e),BOOMR.fireEvent("xhr_send",n),r.addEvent(d),d.timing.requestStart||(d.timing.requestStart=BOOMR.now()),void 0===d.status||-997!==d.status)?c.apply(n,arguments):void 0},n.resource=d,n},BOOMR.proxy_XMLHttpRequest.UNSENT=0,BOOMR.proxy_XMLHttpRequest.OPENED=1,BOOMR.proxy_XMLHttpRequest.HEADERS_RECEIVED=2,BOOMR.proxy_XMLHttpRequest.LOADING=3,BOOMR.proxy_XMLHttpRequest.DONE=4,BOOMR.proxy_XMLHttpRequest.prototype=BOOMR.orig_XMLHttpRequest.prototype,BOOMR.utils.overwriteNative(e,"XMLHttpRequest",BOOMR.proxy_XMLHttpRequest)}}function v(){BOOMR.orig_XMLHttpRequest&&BOOMR.orig_XMLHttpRequest!==e.XMLHttpRequest&&(e.XMLHttpRequest=BOOMR.orig_XMLHttpRequest)}function g(e){e.initiator="xhr",BOOMR.responseEnd(e)}!BOOMR.plugins.AutoXHR&&(e=BOOMR.window)&&e.XMLHttpRequest&&new e.XMLHttpRequest().addEventListener&&(u.stop=function(){u.pause(),u.observer=null},u.pause=function(){u.observer&&u.observer.observer&&!u.isPaused&&(u.isPaused=!0,u.observer.observer.disconnect())},u.resume=function(){u.observer&&u.observer.observer&&u.isPaused&&(u.isPaused=!1,u.observer.observer.observe(n,u.observer.config))},u.start=function(){if(!u.observer){var e={childList:!0,attributes:!0,subtree:!0,attributeFilter:["src","href"]};u.observer=BOOMR.utils.addObserver(n,e,null,r.mutation_cb,null,r),u.observer&&(u.observer.config=e,BOOMR.subscribe("page_unload",u.stop,null,u))}},u.prototype.addEvent=function(e){if(BOOMR.plugins.SPA&&BOOMR.plugins.SPA.get_ready()||BOOMR.utils.inArray(e.initiator,BOOMR.constants.BEACON_TYPE_SPAS)){var n,i,s,d={type:e.initiator,resource:e,nodes_to_wait:0,total_nodes:0,resources:[],xhr_resources:[],complete:!1,aborted:!1,firedEarlyBeacon:!1},l=this.pending_events.length,f=this;for(n=l-1;n>=0;n--)if(this.pending_events[n]&&!this.pending_events[n].complete){i=this.pending_events[n],s=n;break}if(i){if("click"===i.type&&o.singlePageApp&&o.spaStartFromClick&&"xhr"===d.type)d.resource.fromClick=!0,d.resource.timing.click=i.resource.timing.requestStart,d.resource.timing.requestStart=i.resource.timing.requestStart,d.interesting=i.interesting||0,d.total_nodes+=i.total_nodes,d.resources=i.resources.concat(d.resources),d.xhr_resources=i.xhr_resources.concat(d.xhr_resources),this.pending_events[s]=void 0,this.watch--;else if(("click"===i.type||i.resource.fromClick)&&o.singlePageApp&&o.spaStartFromClick&&"spa"===d.type)d.resource.timing=i.resource.timing,d.interesting=i.interesting||0,d.total_nodes+=i.total_nodes,d.resources=i.resources.concat(d.resources),i.resource.url&&d.xhr_resources.push(i.resource.url),d.xhr_resources=d.xhr_resources.concat(i.xhr_resources),this.pending_events[s]=void 0,this.watch--;else if("click"===i.type)(0===i.nodes_to_wait||!i.resource.url)&&(this.pending_events[s]=void 0,this.watch--);else if("xhr"===i.type){if("click"===d.type)return null;else if("xhr"===d.type)return r.add_event_resource(e),null}else if(BOOMR.utils.inArray(i.type,BOOMR.constants.BEACON_TYPE_SPAS)){if("xhr"===d.type)return r.add_event_resource(e),null;if("click"===d.type)return i.resource.lastClick=d.resource.timing.requestStart,null;if(BOOMR.utils.inArray(d.type,BOOMR.constants.BEACON_TYPE_SPAS)){var p=d.resource.timing.requestStart-i.resource.timing.requestStart;"spa_hard"!==i.type&&c(i.resource,d.resource)&&p<500?(this.pending_events[s]=void 0,this.watch--):(i.resource.timing.loadEventEnd=BOOMR.now(),i.aborted=!0,this.sendEvent(s))}}}if("click"===d.type){if(!u.observer)return null;this.setTimeout(o.xhrIdleTimeout,l)}else if("xhr"===d.type){if(a(o.ignoreXhrs,e.url))return null;d.nodes_to_wait++,d.total_nodes++,d.ignoreMO=!0}else BOOMR.utils.inArray(d.type,BOOMR.constants.BEACON_TYPE_SPAS)&&(u.start(),e.wait?(d.nodes_to_wait++,d.total_nodes++,e.waitComplete=function(){f.load_finished(l),e.waitComplete=void 0}):this.setTimeout(o.spaIdleTimeout,l));return this.watch++,this.pending_events.push(d),e.index=l,l}},u.prototype.sendEvent=function(e){var r=this.pending_events[e],i=this;if(BOOMR.now(),r&&!r.complete)if(this.clearTimeout(e),BOOMR.readyToSend()){if(r.complete=!0,r.resource.complete=!0,this.watch--,BOOMR.utils.inArray(r.type,BOOMR.constants.BEACON_TYPE_SPAS)&&(r.resource.url=n.URL),"spa"===r.type&&0===r.total_nodes&&r.resource.url===i.lastSpaLocation){BOOMR.fireEvent("spa_cancel"),this.pending_events[e]=void 0;return}if("click"===r.type&&(0===r.total_nodes||!r.resource.url)||("click"===r.type&&o.singlePageApp&&o.spaStartFromClick&&(r.type=r.resource.initiator="xhr"),o.xhrRequireChanges&&"xhr"===r.type&&1===r.total_nodes&&(void 0===r.interesting||0===r.interesting)&&!f(r.resource.url,o.alwaysSendXhr))){this.pending_events[e]=void 0;return}if(BOOMR.utils.inArray(r.type,BOOMR.constants.BEACON_TYPE_SPAS)&&(i.lastSpaLocation=r.resource.url,!r.forced)&&("spa"===r.type&&0===r.total_nodes&&(r.resource.timing.loadEventEnd=r.resource.timing.requestStart+1),"spa_hard"===r.type)){var s=BOOMR.getPerformance();s&&s.timing&&s.timing.loadEventEnd&&r.resource.timing.loadEventEnd&&r.resource.timing.loadEventEnd<s.timing.loadEventEnd&&(r.resource.timing.loadEventEnd=s.timing.loadEventEnd)}this.sendResource(r.resource,e)}else setTimeout(function(){i.sendEvent(e)},500)},u.prototype.sendResource=function(r,i){var o=this,s=o.pending_events[i],a=r.timing?r.timing.requestStart:void 0,c=function(e,s){e&&(r.timing.loadEventEnd=s||BOOMR.now()),BOOMR.real_sendBeacon(),r.onComplete&&r.onComplete(r),BOOMR.plugins.ResourceTiming&&BOOMR.plugins.ResourceTiming.is_enabled()&&r.timing&&r.timing.requestStart&&(r.restiming=BOOMR.plugins.ResourceTiming.getCompressedResourceTiming(r.timing.requestStart,r.timing.loadEventEnd)),BOOMR.utils.inArray(r.initiator,BOOMR.constants.BEACON_TYPE_SPAS)&&(o.calculateSpaTimings(r),"number"==typeof i&&o.pending_events[i].aborted&&(BOOMR.addVar("pgu",n.URL,!0),BOOMR.addVar("rt.quit","",!0),BOOMR.addVar("rt.abld","",!0))),BOOMR.responseEnd(r,a,r),"number"==typeof i&&(o.pending_events[i]=void 0)};"spa_hard"!==r.initiator||s&&s.aborted||BOOMR.hasBrowserOnloadFired()?c(!1):BOOMR.utils.addListener(e,"load",function(){var e=BOOMR.now();BOOMR.setImmediate(function(){c(!0,e)})})},u.prototype.calculateSpaTimings=function(e){var n=BOOMR.getPerformance();if(n&&n.timing){if("spa_hard"===e.initiator)e.timing.responseEnd=n.timing.responseStart,e.timing.fetchStart=n.timing.navigationStart;else{if(!BOOMR.plugins.ResourceTiming||!BOOMR.plugins.ResourceTiming.is_supported())return;var r=BOOMR.plugins.ResourceTiming.getFilteredResourceTiming(e.timing.requestStart,e.timing.loadEventEnd,o.spaBackEndResources).entries,i=Math.round(e.timing.loadEventEnd-e.timing.requestStart);if(!r||!r.length){BOOMR.addVar("noresources",1,!0),e.timers={t_resp:0,t_page:i,t_done:i};return}for(var s=e.timing.loadEventEnd-n.timing.navigationStart,c=0;c<r.length;c++)r[c].responseStart>s?(r[c].responseStart=s,r[c].responseEnd=s):r[c].responseEnd>s&&(r[c].responseEnd=s);var d=Math.round(BOOMR.plugins.ResourceTiming.calculateResourceTimingUnion(r)),l=i-d;if(d<0||i<0||l<0)return void BOOMR.addError("Incorrect SPA time calculation");BOOMR.addVar("t_resp_calc",d,!0),BOOMR.addVar("resourceLength",r.length,!0),e.timers={t_resp:d,t_page:l,t_done:i}}var u=BOOMR.plugins.ResourceTiming.getFilteredResourceTiming(e.timing.requestStart,e.timing.loadEventEnd,["xmlhttprequest","fetch"]).entries,f=BOOMR.plugins.Continuity.getTTIWaitForXHRIngore();u=u.filter(function(e){return!a(f,e.name)});var p=e.timing.requestStart-n.timing.navigationStart,s=u.reduce(function(e,n){return n.responseEnd>e?n.responseEnd:e},p);"spa"===e.initiator&&(BOOMR.addVar("c.tti.xd.increasing",s),s-=p,BOOMR.addVar("spa.calcttixd",1,!0)),BOOMR.addVar("c.tti.xd",s)}},u.prototype.setTimeout=function(e,n){var r=this;e&&(this.clearTimeout(n),this.timer=setTimeout(function(){r.timedout(n)},e))},u.prototype.timedout=function(e){var n;if(this.clearTimeout(e),n=this.pending_events[e]){if(BOOMR.utils.inArray(n.type,BOOMR.constants.BEACON_TYPE_SPAS)&&!BOOMR.hasBrowserOnloadFired())return void this.setTimeout(o.spaIdleTimeout,e);0===n.nodes_to_wait&&this.sendEvent(e)}},u.prototype.clearTimeout=function(e){this.timer&&e===this.pending_events.length-1&&(clearTimeout(this.timer),this.timer=null)},u.prototype.load_cb=function(e,n){var r,i,o=BOOMR.now();(r=e.target||e.srcElement)&&r._bmr&&(i=r._bmr.idx,n=void 0!==n?n:r._bmr.res||0,r._bmr.end[n]||(r._bmr.end[n]=o,this.load_finished(i,o)))},u.prototype.monitorMO=function(e){var n=this.pending_events[e];n&&delete n.ignoreMO},u.prototype.load_finished=function(e,n){var i=this.pending_events[e];if(i){if(i.nodes_to_wait--,0===i.nodes_to_wait)this.checkTimer&&clearTimeout(this.checkTimer),this.checkTimer=null,i.resource.timing.loadEventEnd=n||BOOMR.now(),e===this.pending_events.length-1?BOOMR.utils.inArray(i.type,BOOMR.constants.BEACON_TYPE_SPAS)?(!i.firedEarlyBeacon&&BOOMR.plugins.Early&&BOOMR.plugins.Early.is_supported()&&(this.timerEarlyBeacon&&(clearTimeout(this.timerEarlyBeacon),this.timerEarlyBeacon=null),this.timerEarlyBeacon=setTimeout(function(){r.timerEarlyBeacon=null,i.firedEarlyBeacon||0!==i.nodes_to_wait||(i.firedEarlyBeacon=!0,BOOMR.plugins.Early.sendEarlyBeacon(i.resource,i.type))},100)),this.setTimeout(o.spaIdleTimeout,e)):this.setTimeout(o.xhrIdleTimeout,e):this.sendEvent(e);else if(!this.checkTimer&&BOOMR.utils.inArray(i.type,BOOMR.constants.BEACON_TYPE_SPAS)){var s=this;this.checkTimer=setTimeout(function(){0!==i.nodes_to_wait&&i.resources.forEach(function(r){var i=r._bmr,o=i.res||0;try{!i.end[o]&&("LINK"===i.type&&r.sheet||("IMG"===i.type||"IMAGE"===i.type)&&r.complete)&&(i.end[o]=n,s.load_finished(e,n))}catch(e){}}),s.checkTimer=null},500)}}},u.prototype.wait_for_node=function(e,n){var r,s,a,c,d,l,u,f,p,h=this,m=!1,v=!1;if(e&&e.nodeName&&(!o.ignoreImage&&e.nodeName.toUpperCase().match(/^(IMG|IMAGE)$/)||e.nodeName.toUpperCase().match(/^IFRAME$/)||"LINK"===e.nodeName.toUpperCase()&&e.rel&&e.rel.match(/\bstylesheet\b/i))){if(e._bmr&&"number"==typeof e._bmr.res&&e._bmr.end[e._bmr.res]&&(v=!0),d=e.src||"function"==typeof e.getAttribute&&(e.getAttribute("xlink:href")||e.getAttribute("href"))||e.href,e._bmr&&e._bmr.url!==d&&(v=!0),v&&"function"==typeof e._bmr.listener&&(h.load_cb({target:e,type:"changed"}),e.removeEventListener("load",e._bmr.listener),e.removeEventListener("error",e._bmr.listener),delete e._bmr.listener),!d||d.match(/^(about:|javascript:|data:)/i))return!1;if("IMG"===e.nodeName){if(e.naturalWidth&&!v)return!1;else if("function"==typeof e.getAttribute&&""===e.getAttribute("src"))return!1;else if("lazy"===e.loading)return!1}if("IFRAME"===e.nodeName&&v||("function"==typeof e.getAttribute&&(u=parseInt(e.getAttribute("height"),10),f=parseInt(e.getAttribute("width"),10)),isNaN(u)&&(u=e.style&&("0"===e.style.height||"0px"===e.style.height||"1px"===e.style.height)?0:void 0),isNaN(f)&&(f=e.style&&("0"===e.style.width||"0px"===e.style.width||"1px"===e.style.width)?0:void 0),!isNaN(u)&&u<=1&&!isNaN(f)&&f<=1||0===u||0===f||e.style&&("none"===e.style.display||"hidden"===e.style.visibility||"0"===e.style.opacity)||o.domExcludeFilter(e)||!(r=this.pending_events[n]))||(l=r.resources.length,r.urls||(r.urls={}),r.urls[d]))return!1;if(!r.resource.url){if(i.href=d,o.xhrExcludeFilter(i))return!1;r.resource.url=i.href}e._bmr||(e._bmr={end:{},type:e.nodeName.toUpperCase()}),e._bmr.res=l,e._bmr.idx=n,delete e._bmr.end[l],e._bmr.url=d,p=function(n){h.load_cb(n,l),e.removeEventListener("load",p),e.removeEventListener("error",p),delete e._bmr.listener},e._bmr.listener=p,e.addEventListener("load",p),e.addEventListener("error",p),r.nodes_to_wait++,this.clearTimeout(n),r.total_nodes++,r.resources.push(e),r.urls[d]=1,m=!0}else e.nodeType===Node.ELEMENT_NODE&&["IMAGE","IMG"].forEach(function(r){if((s=e.getElementsByTagName(r))&&s.length)for(a=0,c=s.length;a<c;a++)m|=this.wait_for_node(s[a],n)},this);return m},u.prototype.add_event_resource=function(e){var n,r=this.pending_events.length-1;return!(r<0)&&(n=this.pending_events[r])&&e?(n.xhr_resources.push(e.url),n.nodes_to_wait++,n.total_nodes++,e.index=r,e.node=!0,r):-1},u.prototype.mutation_cb=function(e){var n,r,i;return!this.watch||(n=this,(r=this.pending_events.length-1)<0||!this.pending_events[r]||!!(i=this.pending_events[r]).ignoreMO||(void 0===i.interesting&&(i.interesting=!1),e&&e.length&&(i.resource.timing.domComplete=BOOMR.now(),e.forEach(function(e){var o,s,a;if("attributes"===e.type)i.interesting|=n.wait_for_node(e.target,r);else if("childList"===e.type){for(o=0,s=e.addedNodes.length;o<s;o++)i.interesting|=n.wait_for_node(e.addedNodes[o],r);for(o=0,s=e.removedNodes.length;o<s;o++)"IFRAME"===(a=e.removedNodes[o]).nodeName&&a._bmr&&n.load_cb({target:a,type:"removed"})}})),i.interesting||i.timeoutExtended||(this.setTimeout(1e3,r),i.timeoutExtended=!0),!0))},u.prototype.queue_is_empty=function(){return 0===this.nodesWaitingFor()},u.prototype.nodesWaitingFor=function(e){var n;return 0===this.pending_events.length?0:(void 0===e&&(e=this.pending_events.length-1),n=this.pending_events[e])?n.nodes_to_wait:0},u.prototype.completeEvent=function(e){var n,r=BOOMR.now();0===this.pending_events.length||(void 0===e&&(e=this.pending_events.length-1),(n=this.pending_events[e])&&(n.resource.timing.loadEventEnd=r,n.forced=!0,this.sendEvent(e)))},r=new u,o={spaBackEndResources:["xmlhttprequest","script","fetch"],alwaysSendXhr:!1,xhrExcludeFilters:[],domExcludeFilters:[],initialized:!1,captureXhrRequestResponse:!1,singlePageApp:!1,spaStartFromClick:!1,autoXhrEnabled:!1,monitorFetch:!1,fetchBodyUsedWait:200,spaIdleTimeout:1e3,xhrIdleTimeout:50,xhrRequireChanges:!1,ignoreImage:!1,xhrExcludeFilter:function(e){var n,r;if(!e||!e.href)return!1;for(n=0;n<o.xhrExcludeFilters.length;n++)if("function"==typeof o.xhrExcludeFilters[n].cb){r=o.xhrExcludeFilters[n].ctx;try{if(o.xhrExcludeFilters[n].cb.call(r,e))return!0}catch(e){BOOMR.addError(e,"BOOMR.plugins.AutoXHR.impl.xhrExcludeFilter()")}}return!1},domExcludeFilter:function(e){var n,r;for(n=0;n<o.domExcludeFilters.length;n++)if("function"==typeof o.domExcludeFilters[n].cb){r=o.domExcludeFilters[n].ctx,o.domExcludeFilters[n].name;try{if(o.domExcludeFilters[n].cb.call(r,e))return!0}catch(e){BOOMR.addError(e,"BOOMR.plugins.AutoXHR.impl.domExcludeFilter()")}}return!1},loadFinished:function(e,n){var i,s,a,c,d;n=n||BOOMR.now(),!e.timing.loadEventEnd&&(e.status&&BOOMR.fireEvent("xhr_error",e),e.timing.loadEventEnd=n,(d=BOOMR.getPerformance())&&d.timing&&(s=d.timing.navigationStart,(i=BOOMR.getResourceTiming(e.url,function(e,n){return e.responseEnd-n.responseEnd},function(n){return Math.ceil(s+n.startTime+2)>=e.timing.requestStart&&0!==n.responseEnd}))&&(a=Math.floor(s+i.startTime),(c=Math.floor(s+i.responseEnd))<=BOOMR.now()&&(e.timing.responseEnd=c,e.timing.loadEventEnd<c&&(e.timing.loadEventEnd=c),e.fromClick&&e.timing.requestStart||(e.timing.requestStart=a),e.timing.fetchStart=a,0!==i.responseStart&&(e.timing.responseStart=Math.floor(s+i.responseStart)),e.restiming=i))),e.node&&f(e.url,o.alwaysSendXhr)&&r.sendResource(e),e.index>=0&&(r.monitorMO(e.index),r.load_finished(e.index,e.timing.responseEnd)))}},BOOMR.plugins.AutoXHR={is_complete:function(){return!0},init:function(r){var s,a;if(n=e.document,e&&n){if(i=n.createElement("A"),BOOMR.utils.pluginConfig(o,r,"AutoXHR",["spaBackEndResources","alwaysSendXhr","monitorFetch","fetchBodyUsedWait","spaIdleTimeout","xhrIdleTimeout","xhrRequireChanges","spaStartFromClick"]),BOOMR.instrumentXHR=m,BOOMR.uninstrumentXHR=v,BOOMR.instrumentFetch=p,BOOMR.uninstrumentFetch=h,o.initialized||(this.addExcludeFilter(l,null,"shouldExcludeXhr"),o.initialized=!0),r&&r.AutoXHR&&r.AutoXHR.excludeFilters&&r.AutoXHR.excludeFilters.length>0)for(a=0;a<r.AutoXHR.excludeFilters.length;a++)"function"==typeof r.AutoXHR.excludeFilters[a]?o.xhrExcludeFilters.push({cb:r.AutoXHR.excludeFilters[a],ctx:this,name:"unknown XHR filter"}):o.xhrExcludeFilters.push(r.AutoXHR.excludeFilters[a]);if(r&&r.AutoXHR&&r.AutoXHR.domExcludeFilters&&r.AutoXHR.domExcludeFilters.length>0)for(a=0;a<r.AutoXHR.domExcludeFilters.length;a++)"function"==typeof r.AutoXHR.domExcludeFilters[a]?o.domExcludeFilters.push({cb:r.AutoXHR.domExcludeFilters[a],ctx:this,name:"unknown DOM filter"}):o.domExcludeFilters.push(r.AutoXHR.domExcludeFilters[a]);if(o.ignoreXhrs=r.ignoreXhrs,o.ignoreImage=r.ignoreImage,o.autoXhrEnabled=r.instrument_xhr,o.monitorFetch=r.monitor_fetch,o.singlePageApp=BOOMR.plugins.SPA&&BOOMR.plugins.SPA.isSinglePageApp(r),o.alwaysSendXhr&&o.autoXhrEnabled&&BOOMR.xhr&&"function"==typeof BOOMR.xhr.stop){function c(e){if(e.length)for(s=0;s<e.length;s++)g(e[s]);else g(e)}var d=BOOMR.xhr.stop(c);d&&d.length&&BOOMR.setImmediate(c,d)}o.singlePageApp?(o.alwaysSendXhr||(o.autoXhrEnabled=!1),o.autoXhrEnabled&&(BOOMR.instrumentXHR(),BOOMR.instrumentFetch())):o.autoXhrEnabled?(BOOMR.instrumentXHR(),BOOMR.instrumentFetch()):!1===o.autoXhrEnabled&&(BOOMR.uninstrumentXHR(),BOOMR.uninstrumentFetch()),BOOMR.registerEvent("xhr_error")}},getMutationHandler:function(){return r},getPathname:d,enableAutoXhr:function(){o.autoXhrEnabled||(BOOMR.instrumentXHR(),BOOMR.instrumentFetch()),o.autoXhrEnabled=!0},addExcludeFilter:function(e,n,r){o.xhrExcludeFilters.push({cb:e,ctx:n,name:r})},addDomExcludeFilter:function(e,n,r){o.domExcludeFilters.push({cb:e,ctx:n,name:r})},setXhrRequestResponseCapturing:function(e){o.captureXhrRequestResponse=e},matchesAlwaysSendXhr:f})}(),!function(){var e,n=!1,r=!1,i=!1,o=!1,s=!1,a=!0,d=!1,l=!1,u=[],f=!1;if(!BOOMR.plugins.SPA&&BOOMR.plugins.AutoXHR){var p={spaHardMissedOnComplete:function(e){var n,r,i=BOOMR.plugins.RT&&BOOMR.plugins.RT.navigationStart(),o=BOOMR.plugins.AutoXHR.getMutationHandler();f=!1,BOOMR.addVar("spa.missed","1",!0),BOOMR.plugins.RT&&BOOMR.plugins.RT.clearTimer("t_done"),e.timing.requestStart=i,(!(n=o.pending_events[e.index])||0===n.total_nodes)&&(r=BOOMR.getPerformance())&&r.timing&&r.timing.navigationStart&&r.timing.loadEventEnd&&void 0===e.timing.loadEventEnd&&(e.timing.loadEventEnd=r.timing.loadEventEnd)},pageReady:function(){o=!0}};BOOMR.plugins.SPA={is_complete:function(e){return!f||e&&("error"===e["http.initiator"]||void 0!==e.early)},get_ready:function(){return i},init:function(e){e&&e.instrument_xhr&&(s=e.instrument_xhr,i&&s&&BOOMR.plugins.AutoXHR.enableAutoXhr()),r||(r=!0,BOOMR.subscribe("page_ready",p.pageReady,null,p))},register:function(e){u.push(e)},supported_frameworks:function(){return u},onLoadSpaHardMissed:function(){i||(o=!0,s&&BOOMR.plugins.AutoXHR.enableAutoXhr(),f=!0,l?f=!1:BOOMR.plugins.SPA.route_change(p.spaHardMissedOnComplete))},hook:function(e,r){return"function"==typeof(r=r||{}).routeFilter&&(d=r.routeFilter),"function"==typeof r.routeChangeWaitFilter&&r.routeChangeWaitFilter,"boolean"==typeof r.routeChangeWaitFilterHardNavs&&r.routeChangeWaitFilterHardNavs,r.disableHardNav&&(l=r.disableHardNav),n||(e&&BOOMR.attach_page_ready(this.onLoadSpaHardMissed),n=!0),this},route_change:function(n,r){BOOMR.fireEvent("route_change");var u=!1,f=a&&!l?"spa_hard":"spa",p=BOOMR.plugins.RT&&BOOMR.plugins.RT.navigationStart(),h=o?BOOMR.now():p,m=BOOMR.window.document.URL,v={timing:{requestStart:h},initiator:f,url:m};if("spa"===f&&e&&!e.complete)try{if(!c(e,v))return}catch(e){BOOMR.addError(e,"SPA.route_change.routeChangeWaitFilter")}if("spa"===f&&d)try{if(!d.apply(null,r))return}catch(e){BOOMR.addError(e,"SPA.route_change.routeFilter")}i=!0,BOOMR.fireEvent("spa_init",[BOOMR.plugins.SPA.current_spa_nav(),m]),a=!1,o&&"function"!=typeof n||(o=!0,v.onComplete=function(e){u||(u=!0,BOOMR.fireEvent("spa_navigation")),"function"==typeof n&&n(e)}),e=v,v.index=BOOMR.plugins.AutoXHR.getMutationHandler().addEvent(v),s&&BOOMR.plugins.AutoXHR.enableAutoXhr()},last_location:function(e){lastLocationChange=e},current_spa_nav:function(){return o?"spa":"spa_hard"},wait_complete:function(){e&&(e.wait=!1,e.waitComplete&&e.waitComplete(),e=null)},markNavigationComplete:function(){var n,r,i=BOOMR.plugins.AutoXHR.getMutationHandler();if(e&&e.wait&&BOOMR.plugins.SPA.wait_complete(),i&&i.pending_events.length>0){for(n=i.pending_events.length-1;n>=0;n--)if((r=i.pending_events[n])&&BOOMR.utils.inArray(r.type,BOOMR.constants.BEACON_TYPE_SPAS)){if(r.complete)break;i.nodesWaitingFor(n),BOOMR.addVar("spa.forced","1",!0),BOOMR.addVar("spa.waiting",i.nodesWaitingFor(),!0),i.completeEvent(n);return}}},isSpaNavInProgress:function(){var e,n,r=BOOMR.plugins.AutoXHR.getMutationHandler();if(r&&r.pending_events.length>0){for(e=r.pending_events.length-1;e>=0;e--)if((n=r.pending_events[e])&&BOOMR.utils.inArray(n.type,BOOMR.constants.BEACON_TYPE_SPAS))return!n.complete}return!1},isSinglePageApp:function(e){for(var n=!1,r=this.supported_frameworks(),i=0;i<r.length;i++){var o=r[i];if(e[o]&&e[o].enabled){n=!0;break}}return n}},BOOMR.plugins.SPA.waitComplete=BOOMR.plugins.SPA.wait_complete}}(),e={auto:!1,enabled:!0,hooked:!1,routeHooked:!1,hadMissedRouteChange:!1,routeChangeInProgress:!1,disableHardNav:!1,routeFilter:void 0,routeChangeWaitFilter:void 0,monitorReplaceState:!0,a:void 0,originHistoryPushState:null,originHistoryReplaceState:null,originHistoryGo:null,originHistoryBack:null,originHistoryForward:null,resetRouteChangeInProgress:function(){e.routeChangeInProgress&&clearTimeout(e.routeChangeInProgress),e.routeChangeInProgress=!1},setRouteChangeInProgress:function(){e.routeChangeInProgress&&clearTimeout(e.routeChangeInProgress),e.routeChangeInProgress=setTimeout(e.resetRouteChangeInProgress,50)},spaInit:function(e,n){n?BOOMR.fireEvent("spa_init",[BOOMR.plugins.SPA.current_spa_nav(),n]):e?BOOMR.fireEvent("spa_init",[BOOMR.plugins.SPA.current_spa_nav(),e]):BOOMR.fireEvent("spa_init",[BOOMR.plugins.SPA.current_spa_nav(),BOOMR.window.document.URL])},routeChange:function(n,r){e.enabled?(!e.disableHardNav||BOOMR.onloadFired())&&(e.routeChangeInProgress||(e.spaInit(n,r),BOOMR.plugins.SPA.route_change())):(e.hadMissedRouteChange=!0,e.resetRouteChangeInProgress())}},BOOMR.plugins.History||void 0===BOOMR.plugins.SPA||void 0===BOOMR.plugins.AutoXHR||BOOMR.window&&BOOMR.window.history&&(BOOMR.plugins.SPA.register("History"),e.a=BOOMR.window.document.createElement("A"),BOOMR.plugins.History={is_complete:function(){return!0},hook:function(n,r,i){return(i=i||{}).disableHardNav=e.disableHardNav,e.hooked||(e.routeFilter&&(i.routeFilter=e.routeFilter),e.routeChangeWaitFilter&&(i.routeChangeWaitFilter=e.routeChangeWaitFilter),function(){var n,r,i,o,s,a=BOOMR.window.history;function c(){BOOMR.window.addEventListener("popstate",function(n){e.routeChange()})}return"function"==typeof a.pushState&&(e.originHistoryPushState=a.pushState,n=a.pushState,a.pushState=function(r,i,o){return e.routeChange(i,o),n.apply(this,arguments)}),e.monitorReplaceState&&"function"==typeof a.replaceState&&(e.originHistoryReplaceState=a.pushState,r=a.replaceState,a.replaceState=function(n,i,o){if("undefined"!=typeof BOOMR){var s=BOOMR.window.document.URL,a=s;return arguments.length>=3&&null!=o&&(e.a.href=o,a=e.a.href),BOOMR.plugins.SPA.isSpaNavInProgress()&&a===s||e.routeChange(i,o),r.apply(this,arguments)}}),"function"==typeof a.go&&(e.originHistoryGo=a.go,i=a.go,a.go=function(n){return e.routeChange(),i.apply(this,arguments)}),"function"==typeof a.back&&(e.originHistoryBack=a.back,o=a.back,a.back=function(){return e.routeChange(),o.apply(this,arguments)}),"function"==typeof a.forward&&(e.originHistoryForward=a.forward,s=a.forward,a.forward=function(){return e.routeChange(),s.apply(this,arguments)}),BOOMR.window.addEventListener("hashchange",function(n){var r=(n||{}).newURL;e.routeChange(null,r)}),BOOMR.hasBrowserOnloadFired()?c():BOOMR.window.addEventListener("load",function(){setTimeout(c,0)}),BOOMR.subscribe("beacon",e.resetRouteChangeInProgress),BOOMR.subscribe("spa_cancel",e.resetRouteChangeInProgress),BOOMR.subscribe("spa_init",e.setRouteChangeInProgress),!0}()&&(BOOMR.plugins.SPA.hook(r,i),e.hooked=!0)),this},init:function(n){return BOOMR.utils.pluginConfig(e,n,"History",["auto","enabled","disableHardNav","routeFilter","routeChangeWaitFilter","monitorReplaceState"]),e.auto&&e.enabled&&this.hook(void 0,!0,{}),this},disable:function(){return history.pushState=e.originHistoryPushState,history.replaceState=e.originHistoryReplaceState,history.go=e.originHistoryGo,history.back=e.originHistoryBack,history.forward=e.originHistoryForward,e.enabled=!1,this},enable:function(){return e.enabled=!0,e.hooked&&e.hadMissedRouteChange&&(e.hadMissedRouteChange=!1,BOOMR.plugins.SPA.route_change(),e.setRouteChangeInProgress()),this}}),n=window,BOOMR.plugins.RT||(i={onloadfired:!1,unloadfired:!1,visiblefired:!1,initialized:!1,complete:!1,autorun:!0,timers:{},cookie:"RT",cookie_exp:604800,session_exp:1800,strict_referrer:!0,navigationType:0,navigationStart:void 0,responseStart:void 0,loadTime:0,oboError:0,t_start:void 0,cached_t_start:void 0,cached_xhr_start:void 0,t_fb_approx:void 0,r:void 0,beacon_url:void 0,next_beacon_url:void 0,basic_timers:{t_done:1,t_resp:1,t_page:1},crossdomain_sending:!1,navigationStartSource:"",updateCookie:function(e,n){var r,o,s,a;if(!this.cookie)return!1;for(a in s=BOOMR.utils.getSubCookies(BOOMR.utils.getCookie(this.cookie))||{})s.hasOwnProperty(a)&&!isNaN(parseInt(a,10))&&delete s[a];if("object"==typeof e)for(a in e)e.hasOwnProperty(a)&&(void 0===e[a]?s.hasOwnProperty(a)&&delete s[a]:s[a]=e[a]);return(s.z=1,s.dm=BOOMR.session.domain,s.si=BOOMR.session.ID,s.ss=BOOMR.session.start.toString(36),s.sl=BOOMR.session.length.toString(36),1800!==i.session_exp&&(s.se=i.session_exp.toString(36)),BOOMR.session.rate_limited&&(s.rl=1),s.tt=this.loadTime.toString(36),this.oboError>0?s.obo=this.oboError.toString(36):delete s.obo,o=BOOMR.now(),n&&(s[n]=(o-BOOMR.session.start).toString(36),i.lastActionTime=o),this.beacon_url&&(s.bcn=this.beacon_url),BOOMR.utils.setCookie(this.cookie,s,this.cookie_exp))?((r=BOOMR.now())-o>50&&(BOOMR.utils.removeCookie(this.cookie),BOOMR.error("took more than 50ms to set cookie... aborting: "+o+" -> "+r,"rt")),!0):(BOOMR.error("cannot set start cookie","rt"),!1)},refreshSession:function(e){e||(e=BOOMR.plugins.RT.getCookie()),e&&(e.ss?BOOMR.session.start=e.ss:BOOMR.session.start=BOOMR.plugins.RT.navigationStart()||BOOMR.t_lstart||BOOMR.t_start,e.si&&e.si.match(/-/)&&(BOOMR.session.ID=e.si),e.sl&&(BOOMR.session.length=e.sl),e.tt&&(this.loadTime=e.tt),e.obo&&(this.oboError=e.obo),e.dm&&!BOOMR.session.domain&&(BOOMR.session.domain=e.dm),e.se&&(i.session_exp=e.se),e.bcn&&(this.beacon_url=e.bcn),e.rl&&"1"===e.rl&&(BOOMR.session.rate_limited=!0))},maybeResetSession:function(e,n){var r=0;BOOMR.session.start&&BOOMR.session.length&&(r=(BOOMR.now()-BOOMR.session.start)/BOOMR.session.length);var o=1e3*i.session_exp;(!BOOMR.session.start||n&&BOOMR.session.start>n||e-(i.lastActionTime||BOOMR.t_start)>o||r>o)&&(BOOMR.session.start=n||BOOMR.plugins.RT.navigationStart()||BOOMR.t_lstart||BOOMR.t_start,BOOMR.session.length=0,BOOMR.session.rate_limited=!1,i.loadTime=0,i.oboError=0,i.beacon_url=i.next_beacon_url,i.lastActionTime=e,i.updateCookie({rl:void 0,sl:BOOMR.session.length,ss:BOOMR.session.start,tt:i.loadTime,obo:void 0,bcn:i.beacon_url}))},initFromCookie:function(){var e,n,i;i=BOOMR.plugins.RT.getCookie(),this.cookie||(BOOMR.session.enabled=!1),i&&(i.s=Math.max(+i.ld||0,Math.max(+i.ul||0,+i.cl||0)),i.s&&(i.r||i.nu)&&(this.r=i.r,e=BOOMR.utils.hashString(r.URL),n=BOOMR.utils.hashString(r&&r.referrer||""),i.cl,i.nu,!this.strict_referrer||i.cl&&i.nu&&i.nu===e&&i.s<+i.cl+15||i.s===+i.ul&&this.r===n?(this.t_start=i.s,+i.hd>i.s&&(this.t_fb_approx=i.hd)):this.t_start=this.t_fb_approx=void 0),i.s&&(this.lastActionTime=i.s),this.refreshSession(i),this.updateCookie({s:void 0,ul:void 0,cl:void 0,hd:void 0,ld:void 0,rl:void 0,r:void 0,nu:void 0,sh:void 0}),this.maybeResetSession(BOOMR.now()))},incrementSessionDetails:function(){BOOMR.session.length++,!i.timers.t_done||isNaN(i.timers.t_done.delta)?i.oboError++:i.loadTime+=i.timers.t_done.delta},getBoomerangTimings:function(){var e,n,r,i,o;function s(e,n){var r=Math.round(e||0),i=Math.round(n||0);return(r=0===r?0:r-i)||""}BOOMR.t_start&&(BOOMR.plugins.RT.startTimer("boomerang",BOOMR.t_start),BOOMR.plugins.RT.endTimer("boomerang",BOOMR.t_end),BOOMR.plugins.RT.endTimer("boomr_fb",BOOMR.t_start),BOOMR.t_lstart&&(BOOMR.plugins.RT.endTimer("boomr_ld",BOOMR.t_lstart),BOOMR.plugins.RT.setTimer("boomr_lat",BOOMR.t_start-BOOMR.t_lstart)));try{if(window&&"performance"in window&&window.performance&&"function"==typeof window.performance.getEntriesByName){for(r in n={"rt.bmr":BOOMR.url},BOOMR.config_url&&(n["rt.cnf"]=BOOMR.config_url),n)if(n.hasOwnProperty(r)&&n[r]){if(!(e=window.performance.getEntriesByName(n[r]))||0===e.length||!e[0])continue;e=e[0],o=[i=s(e.startTime,0),s(e.responseEnd,i),s(e.responseStart,i),s(e.requestStart,i),s(e.connectEnd,i),s(e.secureConnectionStart,i),s(e.connectStart,i),s(e.domainLookupEnd,i),s(e.domainLookupStart,i),s(e.redirectEnd,i),s(e.redirectStart,i)].join(",").replace(/,+$/,""),BOOMR.addVar(r,o,!0)}}}catch(e){e&&e.name&&e.name.hasOwnProperty("length")&&-1===e.name.indexOf("NS_ERROR_FAILURE")&&BOOMR.addError(e,"rt.getBoomerangTimings")}},checkPreRender:function(){return"prerender"===BOOMR.visibilityState()&&(BOOMR.plugins.RT.startTimer("t_load",this.navigationStart),BOOMR.plugins.RT.endTimer("t_load"),BOOMR.plugins.RT.startTimer("t_prerender",this.navigationStart),BOOMR.plugins.RT.startTimer("t_postrender"),!0)},initFromNavTiming:function(){var e,r;!this.navigationStart&&((r=BOOMR.getPerformance())&&r.navigation&&(this.navigationType=r.navigation.type),r&&r.timing?(e=r.timing,this.navigationStartSource="navigation"):n.chrome&&n.chrome.csi&&n.chrome.csi().startE?(e={navigationStart:n.chrome.csi().startE},this.navigationStartSource="csi"):n.gtbExternal&&n.gtbExternal.startE()&&(e={navigationStart:n.gtbExternal.startE()},this.navigationStartSource="gtb"),e&&(this.navigationStart=e.navigationStart||e.fetchStart||void 0,this.fetchStart=e.fetchStart||void 0,this.responseStart=e.responseStart||void 0,navigator.userAgent.match(/Firefox\/[78]\./)&&(this.navigationStart=e.unloadEventStart||e.fetchStart||void 0)))},validateLoadTimestamp:function(e,n,r){var i;return n&&n.timing&&n.timing.loadEventEnd?n.timing.loadEventEnd:"xhr"!==r||n&&BOOMR.utils.inArray(n.initiator,BOOMR.constants.BEACON_TYPE_SPAS)?(i=BOOMR.getPerformance())&&i.timing?i.timing.loadEventEnd?i.timing.loadEventEnd:e:BOOMR.t_onload||BOOMR.t_lstart||BOOMR.t_start||e:e},setPageLoadTimers:function(e,n,r){var o,s;if("xhr"!==e&&!("early"===e&&r&&BOOMR.utils.inArray(r.initiator,BOOMR.constants.BEACON_TYPE_SPAS))&&(i.initFromCookie(),i.initFromNavTiming(),BOOMR.addVar("rt.start",this.navigationStartSource),i.checkPreRender()))return!1;if("xhr"===e)if(r.timers)for(var a in r.timers)r.timers.hasOwnProperty(a)&&BOOMR.plugins.RT.setTimer(a,r.timers[a]);else r&&r.timing&&(void 0===(s=r.timing.fetchStart)||r.timing.responseEnd>=s)&&(o=r.timing.responseEnd);else i.responseStart?i.responseStart>=i.navigationStart&&i.responseStart>=i.fetchStart&&(o=i.responseStart):i.timers.hasOwnProperty("t_page")?BOOMR.plugins.RT.endTimer("t_page"):i.t_fb_approx&&(o=i.t_fb_approx);return o&&"early"!==e&&(s?BOOMR.plugins.RT.setTimer("t_resp",s,o):BOOMR.plugins.RT.endTimer("t_resp",o),"load"===e&&i.timers.t_load?BOOMR.plugins.RT.setTimer("t_page",i.timers.t_load.end-o):n<o?BOOMR.addVar("t_page.inv",1,!0):n-o==0&&r&&r.timing&&r.timing.requestStart&&i.timers.t_resp&&i.timers.t_resp.delta?BOOMR.plugins.RT.setTimer("t_page",n-r.timing.requestStart-i.timers.t_resp.delta):BOOMR.plugins.RT.setTimer("t_page",n-o)),"load"===e&&i.timers.hasOwnProperty("t_postrender")&&(BOOMR.plugins.RT.endTimer("t_postrender"),BOOMR.plugins.RT.endTimer("t_prerender")),!0},setSupportingTimestamps:function(e,n){e&&BOOMR.addVar("rt.tstart",e,!0),"number"==typeof i.navigationStart&&i.navigationStart!==e&&BOOMR.addVar("rt.nstart",i.navigationStart,!0),"number"==typeof i.t_start&&i.t_start!==e&&BOOMR.addVar("rt.cstart",i.t_start,!0),BOOMR.addVar("rt.bstart",BOOMR.t_start,!0),BOOMR.t_lstart&&BOOMR.addVar("rt.blstart",BOOMR.t_lstart,!0),"early"===n?BOOMR.addVar("rt.end",e||BOOMR.now(),!0):i.timers.t_done&&BOOMR.addVar("rt.end",i.timers.t_done.end,!0)},determineTStart:function(e,n){var r;return"xhr"===e||"early"===e&&n&&"spa"===n.initiator?(n&&n.name&&i.timers[n.name]?r=i.timers[n.name].start:n&&n.timing&&n.timing.requestStart&&(r=n.timing.requestStart),void 0===r&&n&&BOOMR.utils.inArray(n.initiator,BOOMR.constants.BEACON_TYPE_SPAS)?BOOMR.addVar("rt.start","none"):BOOMR.addVar("rt.start","manual"),i.cached_xhr_start=r):(i.navigationStart?r=i.navigationStart:i.t_start&&2!==i.navigationType?(r=i.t_start,BOOMR.addVar("rt.start","cookie")):i.cached_t_start?r=i.cached_t_start:(BOOMR.addVar("rt.start","none"),r=void 0),i.cached_t_start=r),r},page_ready:function(){this.onloadfired=!0},check_visibility:function(){"visible"===BOOMR.visibilityState()&&(i.visiblefired=!0)},prerenderToVisible:function(){i.onloadfired&&i.autorun&&(BOOMR.addVar("vis.pre","1",!0),BOOMR.plugins.RT.done(null,"visible"))},page_unload:function(e){this.unloadfired||BOOMR.plugins.RT.done(e,"unload"),this.updateCookie(!i.navigationStart&&i.strict_referrer?{r:BOOMR.utils.hashString(r.URL)}:null,"beforeunload"===e.type?"ul":"hd"),this.unloadfired=!0},_iterable_click:function(e,n,r,i){var o;if(r){for(;r&&r.nodeName&&r.nodeName.toUpperCase()!==n;)r=r.parentNode;r&&r.nodeName&&r.nodeName.toUpperCase()===n&&(this.refreshSession(),this.maybeResetSession(BOOMR.now()),o=i(r),this.updateCookie({nu:BOOMR.utils.hashString(o)},"cl"),BOOMR.addVar("nu",BOOMR.utils.cleanupURL(o),!0))}},onclick:function(e){i._iterable_click("Click","A",e,function(e){return e.href})},markComplete:function(){this.onloadfired&&(i.complete=!0)},onsubmit:function(e){i._iterable_click("Submit","FORM",e,function(e){var n="function"==typeof e.getAttribute&&e.getAttribute("action")||r.URL||"";return n.match(/\?/)?n:n+"?"})},onconfig:function(e){e.beacon_url&&(i.beacon_url=e.beacon_url),e.RT&&(e.RT.oboError&&!isNaN(e.RT.oboError)&&e.RT.oboError>i.oboError&&(i.oboError=e.RT.oboError),e.RT.loadTime&&!isNaN(e.RT.loadTime)&&e.RT.loadTime>i.loadTime&&(i.loadTime=e.RT.loadTime,i.timers.t_done&&!isNaN(i.timers.t_done.delta)&&(i.loadTime+=i.timers.t_done.delta)))},domloaded:function(){BOOMR.plugins.RT&&BOOMR.plugins.RT.endTimer("t_domloaded")},clear:function(e){e&&void 0!==e.early||BOOMR.removeVar("rt.start")},spaNavigation:function(){i.onloadfired=!0}},BOOMR.plugins.RT={init:function(e){if(n!==BOOMR.window&&(n=BOOMR.window),e&&e.CrossDomain&&e.CrossDomain.sending&&(i.crossdomain_sending=!0),n&&n.document)return r=n.document,BOOMR.utils.pluginConfig(i,e,"RT",["cookie","cookie_exp","session_exp","strict_referrer"]),e&&void 0!==e.autorun&&(i.autorun=e.autorun),e&&e.beacon_url&&((!i.beacon_url||e.force_beacon_url)&&(i.beacon_url=e.beacon_url),i.next_beacon_url=e.beacon_url),void 0!==r&&(i.r=BOOMR.utils.hashQueryString(r.referrer,!0)),i.initFromCookie(),i.initialized||(i.complete=!1,i.timers={},i.check_visibility(),BOOMR.subscribe("page_ready",i.page_ready,null,i),BOOMR.subscribe("visibility_changed",i.check_visibility,null,i),BOOMR.subscribe("prerender_to_visible",i.prerenderToVisible,null,i),BOOMR.subscribe("page_ready",this.done,"load",this),BOOMR.subscribe("xhr_load",this.done,"xhr",this),BOOMR.subscribe("before_early_beacon",this.done,"early",this),BOOMR.subscribe("dom_loaded",i.domloaded,null,i),BOOMR.subscribe("page_unload",i.page_unload,null,i),BOOMR.subscribe("click",i.onclick,null,i),BOOMR.subscribe("form_submit",i.onsubmit,null,i),BOOMR.subscribe("before_beacon",this.addTimersToBeacon,"beacon",this),BOOMR.subscribe("beacon",i.clear,null,i),BOOMR.subscribe("error",i.markComplete,null,i),BOOMR.subscribe("config",i.onconfig,null,i),BOOMR.subscribe("spa_navigation",i.spaNavigation,null,i),BOOMR.subscribe("interaction",i.markComplete,null,i),BOOMR.getBeaconURL=function(){return i.beacon_url},i.initialized=!0),this},startTimer:function(e,n){return e&&("t_page"===e&&this.endTimer("t_resp",n),i.timers[e]={start:"number"==typeof n?n:BOOMR.now()}),this},endTimer:function(e,n){return e&&(i.timers[e]=i.timers[e]||{},void 0===i.timers[e].end&&(i.timers[e].end="number"==typeof n?n:BOOMR.now())),this},clearTimer:function(e){return e&&delete i.timers[e],this},setTimer:function(e,n,r){return e&&(void 0!==r?i.timers[e]={start:n,end:r,delta:r-n}:i.timers[e]={delta:n}),this},addTimersToBeacon:function(e,n){var r,o,s=[];for(r in i.timers)if(i.timers.hasOwnProperty(r)){if("number"!=typeof(o=i.timers[r]).delta&&("number"!=typeof o.start&&(o.start="xhr"===n?i.cached_xhr_start:i.cached_t_start),o.delta=o.end-o.start),isNaN(o.delta))continue;i.basic_timers.hasOwnProperty(r)?BOOMR.addVar(r,o.delta,!0):s.push(r+"|"+o.delta)}s.length&&BOOMR.addVar("t_other",s.join(","),!0),"beacon"!==n||e&&void 0!==e.early||(i.timers={},i.complete=!1)},done:function(e,n){if(BOOMR.plugins.RT){var r,o,s=BOOMR.now(),a=!1;return i.complete=!1,o=i.validateLoadTimestamp(s,e,n),("load"!==n&&"visible"!==n&&"xhr"!==n&&"early"!==n||i.setPageLoadTimers(n,o,e))&&(("load"===n||"visible"===n||"early"===n&&(!e||void 0===e.initiator||"spa_hard"===e.initiator)||"xhr"===n&&e&&"spa_hard"===e.initiator)&&i.getBoomerangTimings(),r=i.determineTStart(n,e),i.refreshSession(),i.maybeResetSession(o,r),"early"!==n&&this.endTimer("t_done",o),e&&"xhr"===e.initiator&&this.setTimer("t_done",e.timing.requestStart,e.timing.loadEventEnd),i.setSupportingTimestamps(r,n),this.addTimersToBeacon(null,n),BOOMR.setReferrer(i.r),"xhr"===n&&e&&e&&e.data&&(e=e.data),"xhr"===n&&e&&(a=e.subresource,e.url&&BOOMR.addVar("u",BOOMR.utils.cleanupURL(e.url.replace(/#.*/,""))),e.status&&(e.status<-1||e.status>=400)&&BOOMR.addVar("http.errno",e.status,!0),e.method&&"GET"!==e.method&&BOOMR.addVar("http.method",e.method,!0),e.type&&"xhr"!==e.type&&BOOMR.addVar("http.type",e.type[0],!0),e.headers&&BOOMR.addVar("http.hdr",e.headers,!0),e.synchronous&&BOOMR.addVar("xhr.sync",1,!0),e.initiator&&BOOMR.addVar("http.initiator",e.initiator,!0),e.responseBodyNotUsed&&BOOMR.addVar("fetch.bnu",1,!0),e.responseUrl&&BOOMR.addVar("xhr.ru",BOOMR.utils.cleanupURL(e.responseUrl),!0)),a&&"passive"!==a&&BOOMR.addVar("rt.subres",1,!0),"load"!==n&&"visible"!==n&&("xhr"!==n||a)&&("unload"!==n||i.onloadfired||!i.autorun||i.crossdomain_sending)||(i.incrementSessionDetails(),i.updateCookie(null,"ld")),BOOMR.addVar({"rt.tt":i.loadTime,"rt.obo":i.oboError},void 0,!0),i.updateCookie(),"unload"===n&&(BOOMR.addVar("rt.quit","",!0),i.onloadfired||BOOMR.addVar("rt.abld","",!0),i.visiblefired||BOOMR.addVar("rt.ntvu","",!0)),"early"!==n&&(i.complete=!0),BOOMR.sendBeacon(i.beacon_url)),this}},is_complete:function(e){return i.complete||e&&"error"===e["http.initiator"]||e&&void 0!==e.early},updateCookie:function(){i.updateCookie()},getCookie:function(){var e,n,r;return!!i.cookie&&(1&(e=BOOMR.utils.getSubCookies(BOOMR.utils.getCookie(i.cookie))||{}).z?(n=36,r=parseInt(e.ss||0,36)):(n=10,r=0),e.ss=parseInt(e.ss||0,n),e.tt=parseInt(e.tt||0,n),e.obo=parseInt(e.obo||0,n),e.sl=parseInt(e.sl||0,n),e.se&&(e.se=parseInt(e.se,n)||1800),e.ld&&(e.ld=r+parseInt(e.ld,n)),e.ul&&(e.ul=r+parseInt(e.ul,n)),e.cl&&(e.cl=r+parseInt(e.cl,n)),e.hd&&(e.hd=r+parseInt(e.hd,n)),e)},incrementSessionDetails:function(){i.incrementSessionDetails()},navigationStart:function(){return i.navigationStart||i.initFromNavTiming(),i.navigationStart},resetTimings:function(){i.navigationStart=void 0,i.responseStart=void 0,i.loadTime=0,i.cached_t_start=void 0}}),!BOOMR.plugins.PaintTiming){var d={"first-paint":"fp","first-contentful-paint":"fcp","largest-contentful-paint":"lcp"},l={initialized:!1,complete:!1,supported:null,timingCache:{},timingHistory:{},observer:null,externalMetrics:{},done:function(e,n){var r,i,o;if(this.complete)return this;if("load"!==n&&(!e||"spa_hard"!==e.initiator))return this.complete=!0,this;if(!(r=BOOMR.getPerformance())||"function"!=typeof r.getEntriesByType){this.complete=!0;return}if((i=r.getEntriesByType("paint"))&&i.length){for(BOOMR.info("This user agent supports PaintTiming","pt"),o=0;o<i.length;o++)l.timingCache[i[o].name]=i[o].startTime,d[i[o].name]&&BOOMR.addVar("pt."+d[i[o].name],Math.floor(i[o].startTime),!0);this.complete=!0,BOOMR.sendBeacon()}},onObserver:function(e){var n=e.getEntries();if(0!==n.length){var r=n[n.length-1],i=r.renderTime||r.loadTime;l.timingCache[r.entryType]=i,l.timingHistory[r.entryType]=l.timingHistory[r.entryType]||[],l.timingHistory[r.entryType].push(i),BOOMR.addVar("pt.lcp",Math.floor(i),!0),l.externalMetrics.lcp=function(){return Math.floor(i)}}}};BOOMR.plugins.PaintTiming={init:function(){return this.is_supported()||(l.complete=!0,l.initialized=!0),l.complete||"hidden"!==BOOMR.visibilityState()||(BOOMR.addVar("pt.hid",1,!0),l.complete=!0),l.initialized||(BOOMR.subscribe("page_ready",l.done,"load",l),BOOMR.subscribe("xhr_load",l.done,"xhr",l),BOOMR.subscribe("before_unload",l.done,null,l),"function"==typeof BOOMR.window.PerformanceObserver&&"function"==typeof window.LargestContentfulPaint&&(l.observer=new BOOMR.window.PerformanceObserver(l.onObserver),l.observer.observe({type:"largest-contentful-paint",buffered:!0})),l.initialized=!0),this},is_complete:function(){return!0},is_enabled:function(){return l.initialized&&this.is_supported()},is_supported:function(){if(null!==l.supported)return l.supported;var e=BOOMR.getPerformance();return l.supported=e&&void 0!==window.PerformancePaintTiming&&"function"==typeof e.getEntriesByType,l.supported},getTimingFor:function(e){if(l.timingCache[e])return l.timingCache[e];if(this.is_supported()){var n,r,i=BOOMR.getPerformance();if(i&&"function"==typeof i.getEntriesByType&&(n=i.getEntriesByType("paint"))&&n.length){for(r=0;r<n.length;r++)if(n[r].name===e)return l.timingCache[e]=n[r].startTime,l.timingCache[e]}}},getHistoryFor:function(e){return l.timingHistory[e]||[]},metrics:l.externalMetrics}}if(!BOOMR.plugins.NavigationTiming){var u={complete:!1,fullySent:!1,sendBeacon:function(){this.complete=!0,BOOMR.sendBeacon()},xhr_done:function(e){if(e&&"spa_hard"===e.initiator)return void u.done(e);if(e&&"spa"===e.initiator)return void u.sendBeacon();BOOMR.window;var n,r,i,o={};if(e){if(e.data&&(e=e.data),(n=BOOMR.getPerformance())&&e.restiming)for(i in o={nt_red_st:e.restiming.redirectStart,nt_red_end:e.restiming.redirectEnd,nt_fet_st:e.restiming.fetchStart,nt_dns_st:e.restiming.domainLookupStart,nt_dns_end:e.restiming.domainLookupEnd,nt_con_st:e.restiming.connectStart,nt_con_end:e.restiming.connectEnd,nt_req_st:e.restiming.requestStart,nt_res_st:e.restiming.responseStart,nt_res_end:e.restiming.responseEnd},e.restiming.secureConnectionStart&&(o.nt_ssl_st=e.restiming.secureConnectionStart),o)o.hasOwnProperty(i)&&o[i]&&(o[i]+=n.timing.navigationStart,o[i]=Math.floor(o[i]));for(i in e.timing&&(r=e.timing,o.nt_req_st||(o.nt_req_st=r.requestStart),o.nt_res_st||(o.nt_res_st=r.responseStart),o.nt_res_end||(o.nt_res_end=r.responseEnd),o.nt_domint=r.domInteractive,o.nt_domcomp=r.domComplete,o.nt_load_st=r.loadEventEnd,o.nt_load_end=r.loadEventEnd),o)o.hasOwnProperty(i)&&!o[i]&&delete o[i];BOOMR.addVar(o,void 0,!0),u.sendBeacon()}},done:function(){var e,n,r,i,o,s,a=BOOMR.window,c={},d=0,l=!1;if(this.complete)return this;if(e=BOOMR.getPerformance()){for(s in"function"==typeof e.getEntriesByType&&((i=e.getEntriesByType("navigation"))&&i.length?(BOOMR.info("This user agent supports NavigationTiming2","nt"),i=i[0],d=e.timing?e.timing.navigationStart:0):i=void 0),!i&&e.timing&&(BOOMR.info("This user agent supports NavigationTiming","nt"),i=e.timing),i&&(!(c={nt_nav_st:e.timing?e.timing.navigationStart:0,nt_red_st:f(d,i.redirectStart),nt_red_end:f(d,i.redirectEnd),nt_fet_st:f(d,i.fetchStart),nt_dns_st:f(d,i.domainLookupStart),nt_dns_end:f(d,i.domainLookupEnd),nt_con_st:f(d,i.connectStart),nt_con_end:f(d,i.connectEnd),nt_req_st:f(d,i.requestStart),nt_res_st:f(d,i.responseStart),nt_res_end:f(d,i.responseEnd),nt_domloading:f(d,i.domLoading),nt_domint:f(d,i.domInteractive),nt_domcontloaded_st:f(d,i.domContentLoadedEventStart),nt_domcontloaded_end:f(d,i.domContentLoadedEventEnd),nt_domcomp:f(d,i.domComplete),nt_load_st:f(d,i.loadEventStart),nt_load_end:f(d,i.loadEventEnd),nt_unload_st:f(d,i.unloadEventStart),nt_unload_end:f(d,i.unloadEventEnd)}).nt_domloading&&e&&e.timing&&e.timing.domLoading&&(c.nt_domloading=e.timing.domLoading),i.secureConnectionStart&&(c.nt_ssl_st=f(d,i.secureConnectionStart)),e.timing&&e.timing.msFirstPaint&&(c.nt_first_paint=e.timing.msFirstPaint),i.workerStart&&(c.nt_worker_start=f(d,i.workerStart)),(i.decodedBodySize||i.transferSize)&&(c.nt_enc_size=i.encodedBodySize,c.nt_dec_size=i.decodedBodySize,c.nt_trn_size=i.transferSize),i.nextHopProtocol&&(c.nt_protocol=i.nextHopProtocol)),!c.nt_first_paint&&BOOMR.plugins.PaintTiming&&(l=BOOMR.plugins.PaintTiming.is_supported(),(o=BOOMR.plugins.PaintTiming.getTimingFor("first-paint"))&&(c.nt_first_paint=f(d,o))),(!c.nt_protocol||!c.nt_first_paint)&&(!i||""!==i.nextHopProtocol)&&!l&&a.chrome&&"function"==typeof a.chrome.loadTimes&&(r=a.chrome.loadTimes())&&(c.nt_spdy=+!!r.wasFetchedViaSpdy,c.nt_cinf=r.connectionInfo,"number"==typeof r.firstPaintTime&&0!==r.firstPaintTime&&(c.nt_first_paint=Math.round(1e3*r.firstPaintTime))),e.navigation&&(n=e.navigation,c.nt_red_cnt=n.redirectCount,c.nt_nav_type=n.type),c)c.hasOwnProperty(s)&&void 0===c[s]&&delete c[s];BOOMR.addVar(c,void 0,!0),i&&(i.requestStart&&i.navigationStart&&i.requestStart<i.navigationStart||i.responseStart&&i.navigationStart&&i.responseStart<i.navigationStart||i.responseStart&&i.fetchStart&&i.responseStart<i.fetchStart||i.navigationStart&&i.fetchStart<i.navigationStart||i.responseEnd&&i.responseEnd>BOOMR.now()+864e5)&&BOOMR.addVar("nt_bad",1,!0),c.nt_load_end>0&&(this.fullySent=!0)}u.sendBeacon()},clear:function(e){this.complete=!(e&&e.early)&&this.fullySent},prerenderToVisible:function(){this.complete=!1,this.done()},onBeforeEarlyBeacon:function(e){e&&void 0!==e.initiator&&"spa_hard"!==e.initiator||this.done()}};BOOMR.plugins.NavigationTiming={init:function(){return u.initialized||(BOOMR.subscribe("page_ready",u.done,null,u),BOOMR.subscribe("prerender_to_visible",u.prerenderToVisible,null,u),BOOMR.subscribe("before_early_beacon",u.onBeforeEarlyBeacon,null,u),BOOMR.subscribe("xhr_load",u.xhr_done,null,u),BOOMR.subscribe("before_unload",u.done,null,u),BOOMR.subscribe("beacon",u.clear,null,u),u.initialized=!0),this},is_complete:function(){return!0}}}function f(e,n){if("number"==typeof n&&0!==n)return Math.floor((e||0)+n)}if(!function(){if(!BOOMR.plugins.ResourceTiming){var e,n={other:0,img:1,link:2,script:3,css:4,xmlhttprequest:5,html:6,image:7,beacon:8,fetch:9,iframe:"a",subdocument:"a",body:"b",input:"c",frame:"a",object:"d",video:"e",audio:"f",source:"g",track:"h",embed:"i",eventsource:"j",navigation:6},r={prefetch:1,preload:2,prerender:3,stylesheet:4},i=["startTime","redirectStart","redirectEnd","fetchStart","domainLookupStart","domainLookupEnd","connectStart","secureConnectionStart","connectEnd","requestStart","responseStart","responseEnd","workerStart"],o="\n",s="*",c="0",d="1",l="2",u=1,f=2,p=4,h="3",m="4",v="5",g="6",y="7";e={complete:!1,sentNavBeacon:!1,initialized:!1,supported:null,xhr_load:function(e){e&&e.restiming&&H(e.restiming),this.complete||(this.complete=!0,BOOMR.sendBeacon())},xssBreakWords:[/(h)(ref)/gi,/(s)(rc)/gi,/(a)(ction)/gi],urlLimit:500,clearOnBeacon:!1,trimUrls:[],serverTiming:!0,monitorClearResourceTimings:!1,splitAtPath:!1,getSrcsetDimensions:!1,trackedResourceTypes:"*",done:function(){this.sentNavBeacon||(B(),this.complete=!0,this.sentNavBeacon=!0,BOOMR.sendBeacon())},onBeacon:function(n){var r=BOOMR.getPerformance();if(e.clearOnBeacon&&r){var i=r.clearResourceTimings||r.webkitClearResourceTimings;i&&"function"==typeof i&&i.call(r)}},prerenderToVisible:function(){this.sentNavBeacon=!1,this.done()}},BOOMR.plugins.ResourceTiming={init:function(n){if(BOOMR.utils.pluginConfig(e,n,"ResourceTiming",["xssBreakWords","clearOnBeacon","urlLimit","trimUrls","trackedResourceTypes","serverTiming","monitorClearResourceTimings","splitAtPath","getSrcsetDimensions"]),e.initialized)return this;if(this.is_supported()){if(BOOMR.subscribe("page_ready",e.done,null,e),BOOMR.subscribe("prerender_to_visible",e.prerenderToVisible,null,e),BOOMR.subscribe("xhr_load",e.xhr_load,null,e),BOOMR.subscribe("beacon",e.onBeacon,null,e),BOOMR.subscribe("before_unload",e.done,null,e),e.monitorClearResourceTimings){var r,i=this;BOOMR.window.performance.clearResourceTimings=(r=BOOMR.window.performance.clearResourceTimings,function(){i.addResources(BOOMR.window.performance.getEntriesByType("resource")),r.apply(BOOMR.window.performance,arguments)})}}else e.complete=!0;return e.initialized=!0,this},is_complete:function(){return!0},is_enabled:function(){return e.initialized&&this.is_supported()},is_supported:function(){if(null!==e.supported)return e.supported;var n=BOOMR.getPerformance();return e.supported=n&&"function"==typeof n.getEntriesByType&&void 0!==window.PerformanceResourceTiming,e.supported},addResources:function(n,r){if(this.is_supported()&&BOOMR.utils.isArray(n)){if(e.collectedEntries=e.collectedEntries||[],"number"==typeof r){var o=r-(BOOMR.window.performance.timeOrigin||BOOMR.window.performance.timing.navigationStart);n=BOOMR.utils.arrayFilter(n,function(e){for(var n=0;n<i.length;n++){var r=i[n];e.hasOwnProperty(r)&&(e[r]+=o)}return!0})}Array.prototype.push.apply(e.collectedEntries,n)}},getCompressedResourceTiming:A,getFilteredResourceTiming:O,calculateResourceTimingUnion:function(e){if(!e||!e.length)return 0;e.sort(function(e,n){return e.fetchStart!==n.fetchStart?e.fetchStart-n.fetchStart:(e.responseStart||e.responseEnd)-(n.responseStart||n.responseEnd)});var n,r=D(e),i=[],o=0;for(n=0;n<r.length;n++){var s=r[n];s.fetchStart<o&&(s.fetchStart=o),s.fetchStart<s.responseEnd&&(i.push(s),o=s.responseEnd)}var a=D(i),c=0;for(n=0;n<a.length;n++)c+=a[n].responseEnd-a[n].fetchStart;return c},addResourceTimingToBeacon:B,addToBeacon:H,trimTiming:w,convertToTrie:b,optimizeTrie:_,findPerformanceEntriesForFrame:T,toBase36:x,getVisibleEntries:E,reduceFetchStarts:D,compressSize:I,decompressSize:function(e,n){var r,i;for(void 0===n&&(n={}),r=e.split(","),i=0;i<r.length;i++)"_"===r[i]?r[i]=0:(""===r[i]&&(r[i]=0),r[i]=parseInt(r[i],36),i>0&&(r[i]+=r[0]));return 1===r.length&&r.push(r[0]),2===r.length&&r.push(r[0]),n.encodedBodySize=r[0],n.transferSize=r[1],n.decodedBodySize=r[2],n},trimUrl:k,getResourceLatestTime:M,mergePixels:P,countPixels:j,getOptimizedTimepoints:function(e){var n,r,i,o,s,a,c,d,l,u,f={},p=[];for(n=0,r=Object.keys(e);n<r.length;n++)void 0===f[s=Math.round(Number(r[n]))]&&(f[s]=[]),Array.prototype.push.apply(f[s],e[r[n]]);if(0===(r=Object.keys(f).map(Number).sort(function(e,n){return e-n})).length)return{};for(n=0;n<r.length;n++)c=j(i=P(i,f[s=r[n]],s)),r[n]=[s,c];for(n=0,o=0,a=0,d=0;n<r.length;n++)s=r[n][0],c=r[n][1],l=j(i,0,s),(c>a||l>d)&&(p.push(u=(u=(s===1/0?"":x(Math.round(s-o)))+"~"+x(c-a)+"~"+x(c-l)).replace(/~~/,"-").replace(/~$/,"")),o=s,a=c,d=l);return p.join("!").replace(/!+$/,"")},decompressTimePoints:function(e){var n,r,i,o={},s=[0,0,0];for(r=0,n=e.split("!");r<n.length;r++)o[(i=n[r].replace(/^~/,"Infinity~").replace("-","~0~").split("~").map(function(e,n){return e="Infinity"===e?1/0:parseInt(e,36),2===n?e=s[1]-e:e+=s[n],s[n]=e,e}))[0]]=[i[1],i[2]||i[1]];return o},accumulateServerTimingEntries:N,compressServerTiming:L,indexServerTiming:U,identifyServerTimingEntry:F,decompressServerTiming:function(e,n){var r=n.split(":"),i=Number(r[0]),o=0,s=0;if(r.length>1){var a=r[1].split(".");""!==a[0]&&(o=Number(a[0])),a.length>1&&(s=Number(a[1]))}var c,d="";return Array.isArray(e[o])?(c=e[o][0],d=e[o][1+s]||""):c=e[o],{name:c,duration:i,description:d}},SPECIAL_DATA_PREFIX:s,SPECIAL_DATA_DIMENSION_TYPE:c,SPECIAL_DATA_SIZE_TYPE:d,SPECIAL_DATA_SCRIPT_ATTR_TYPE:l,SPECIAL_DATA_LINK_ATTR_TYPE:m,SPECIAL_DATA_SERVICE_WORKER_TYPE:g,ASYNC_ATTR:u,DEFER_ATTR:f,LOCAT_ATTR:p,INITIATOR_TYPES:n,REL_TYPES:r}}function b(n,r){var i,s,a,c,d,l,u,f,p={};for(i in n){for(a=0,s=i;a<e.xssBreakWords.length;a++)s=s.replace(e.xssBreakWords[a],"$1"+o+"$2");if(n.hasOwnProperty(i))for(a=0,c=n[i],d=r?[(d=s.split("/"))[0]+"//",d[2]+(d.length>3?"/":"")].concat(d.slice(3).reduce(function(e){return function(n,r,i){var s,a;if(-1!==r.indexOf(o)){for(a=0,s=r.split(o);a<s.length-1;a++)n.push(s[a]),n.push(o);r=s.slice(-1)}return"number"==typeof e&&i<e&&(r+="/"),n.concat(r)}}(d.length-4),[])):s.split(""),u=p;a<d.length;a++)void 0===(f=u[l=d[a]])?u=u[l]=a===d.length-1?c:{}:"string"==typeof f?u=u[l]={"|":f}:a===d.length-1?u[l]["|"]=c:u=u[l]}return p}function _(e,n){var r,i,s,a=0,c=[];for(r in e)e.hasOwnProperty(r)&&c.push(r);for(var d=0;d<c.length;d++)"object"==typeof e[r=c[d]]&&(i=_(e[r],!1))&&(delete e[r],r===o?(r=i.name,a++):r+=i.name,e[r]=i.value),a++;if(1===a)if(n)return(s={})[r]=e[r],s;else return{name:r,value:e[r]};return!!n&&e}function w(e,n){"number"!=typeof e&&(e=0),"number"!=typeof n&&(n=0);var r=Math.round(e||0),i=Math.round(n||0);return 0===r?0:r-i}function S(e){try{if(e.location&&e.location.href,e.document,"performance"in e&&e.performance)return!0}catch(e){}return!1}function R(e){var n=0;return S(e)&&e.performance.timing&&e.performance.timing.navigationStart&&(n=e.performance.timing.navigationStart),n}function T(n,o,s,a,c){var d,l,h,m,v,g,y,b,_,w=[],x={},O={};if(void 0===o&&(o=!0),void 0===s&&(s=0),void 0===a&&(a=0),a>10)return w;try{if(!S(n))return w;if(h=R(n),b=E(n,c),_=n.document.createElement("a"),C(_,x,"script"),C(_,O,"link"),(g=n.document.getElementsByTagName("iframe"))&&g.length)for(d=0;d<g.length;d++)m=R(g[d].contentWindow),v=0,m>h&&(v=s+(m-h)),_.href=g[d].src,w=w.concat(T(g[d].contentWindow,!1,v,a+1,b[_.href]));if("function"!=typeof n.performance.getEntriesByType)return w;function I(n){return e.serverTiming&&n.serverTiming||[]}o&&(k=n,P=w,j=l,A=y,D=I,(j=k.performance.getEntriesByType("navigation"))&&1===j.length?(A=j[0],P.push({name:k.location.href,startTime:0,initiatorType:"html",redirectStart:A.redirectStart,redirectEnd:A.redirectEnd,fetchStart:A.fetchStart,domainLookupStart:A.domainLookupStart,domainLookupEnd:A.domainLookupEnd,connectStart:A.connectStart,secureConnectionStart:A.secureConnectionStart,connectEnd:A.connectEnd,requestStart:A.requestStart,responseStart:A.responseStart,responseEnd:A.responseEnd,workerStart:A.workerStart,encodedBodySize:A.encodedBodySize,decodedBodySize:A.decodedBodySize,transferSize:A.transferSize,serverTiming:D(A)})):k.performance.timing&&0!==(t=k.performance.timing).navigationStart&&t.responseEnd<=t.navigationStart+36e5&&P.push({name:k.location.href,startTime:0,initiatorType:"html",redirectStart:t.redirectStart?t.redirectStart-t.navigationStart:0,redirectEnd:t.redirectEnd?t.redirectEnd-t.navigationStart:0,fetchStart:t.fetchStart?t.fetchStart-t.navigationStart:0,domainLookupStart:t.domainLookupStart?t.domainLookupStart-t.navigationStart:0,domainLookupEnd:t.domainLookupEnd?t.domainLookupEnd-t.navigationStart:0,connectStart:t.connectStart?t.connectStart-t.navigationStart:0,secureConnectionStart:t.secureConnectionStart?t.secureConnectionStart-t.navigationStart:0,connectEnd:t.connectEnd?t.connectEnd-t.navigationStart:0,requestStart:t.requestStart?t.requestStart-t.navigationStart:0,responseStart:t.responseStart?t.responseStart-t.navigationStart:0,responseEnd:t.responseEnd?t.responseEnd-t.navigationStart:0}));var k,P,j,A,D,B=n.performance.getEntriesByType("resource");n===BOOMR.window&&e.collectedEntries&&(Array.prototype.push.apply(B,e.collectedEntries),e.collectedEntries=[]),w=w.concat(function(e,n,o,s,a,c){for(var d,l,h=[],m=0;e&&m<e.length;m++){d={name:(l=e[m]).name,initiatorType:l.initiatorType,encodedBodySize:l.encodedBodySize,decodedBodySize:l.decodedBodySize,transferSize:l.transferSize,serverTiming:n(l),visibleDimensions:o[l.name],latestTime:M(l)};for(var v=0;v<i.length;v++){var g=i[v];d[g]="startTime"===g||l[g]?l[g]+s:0}if(l.hasOwnProperty("_data")&&(d._data=l._data),("script"===l.initiatorType||"link"===l.initiatorType)&&a[l.name]){var y=a[l.name];for(d.scriptAttrs=(y.async?u:0)|(y.defer?f:0);1===y.nodeType&&"BODY"!==y.nodeName;)y=y.parentNode;d.scriptAttrs|="BODY"===y.nodeName?p:0}"link"===l.initiatorType&&c[l.name]&&BOOMR.utils.arrayFind(c[l.name].rel.split(/[\u0009\u000A\u000C\u000D\u0020]+/),function(e){if(r[e=e.toLowerCase()])return d.linkAttrs=r[e],!0}),h.push(d)}return h}(B,I,b,s,x,O))}catch(e){}return w}function C(e,n,r){Array.prototype.forEach.call(e.ownerDocument.getElementsByTagName(r),function(r){e.href=r.currentSrc||r.src||"function"==typeof r.getAttribute&&r.getAttribute("xlink:href")||r.href,e.href.match(/^https?:\/\//)&&(n[e.href]=r)})}function x(e){return"number"==typeof e&&0!==e?e.toString(36):"string"==typeof e?e:""}function E(n,r){var i,o,s={},a=n.document,c=a.createElement("A");return i=(r=r||[0,0,0,0])[3]+(void 0!==n.pageXOffset)?n.pageXOffset:(a.documentElement||a.body.parentNode||a.body).scrollLeft,o=r[2]+(void 0!==n.pageYOffset)?n.pageYOffset:(a.documentElement||a.body.parentNode||a.body).scrollTop,["img","iframe","image"].forEach(function(n){var r,d,l,u,f,p,h,m=a.getElementsByTagName(n);for(f=0;f<m.length;f++)if((u=m[f])&&(c.href=h=u.currentSrc||u.src||"function"==typeof u.getAttribute&&u.getAttribute("src")||u.getAttribute("xlink:href"),(h=c.href)&&!s[h]&&((p=u.getBoundingClientRect()).height||u.offsetHeight)&&(p.width||u.offsetWidth))){if(s[h]=[p.height||u.offsetHeight,p.width||u.offsetWidth,Math.round(p.top+o),Math.round(p.left+i)],!u.naturalHeight&&!u.naturalWidth)continue;e.getSrcsetDimensions&&u.currentSrc&&(u.srcset||u.parentNode&&u.parentNode.nodeName&&"PICTURE"===u.parentNode.nodeName.toUpperCase())?(r=u.isConnected?u.ownerDocument.createElement("IMG"):new BOOMR.window.Image).src=h:r=u,d=r.naturalHeight||u.naturalHeight,l=r.naturalWidth||u.naturalWidth,(d||l)&&(s[h][0]!==d||s[h][1]!==l)&&s[h].push(d,l)}}),s}function O(e,n,r){var i,o,s=T(BOOMR.window,!0,0,0),a=R(BOOMR.window),c={};if(!s||!s.length)return{entries:[]};s.sort(function(e,n){return e.startTime-n.startTime});var d=[];for(i=0;i<s.length;i++)if(!("string"!=typeof(o=s[i]).name||0!==o.name.indexOf("http:")&&0!==o.name.indexOf("https:")||"function"==typeof BOOMR.getBeaconURL&&BOOMR.getBeaconURL()&&o.name.indexOf(BOOMR.getBeaconURL())>-1)&&(!e||!(a+o.startTime<e))){if(n&&a+o.startTime>n)break;(void 0===r||"*"===r||!r.length||o.initiatorType&&BOOMR.utils.inArray(o.initiatorType,r))&&(N(c,o.serverTiming),d.push(o))}var l=L(c);return{entries:d,serverTiming:{lookup:l,indexed:U(l)}}}function I(e){var n,r,i;return e.encodedBodySize||e.decodedBodySize||e.transferSize?(n=e.transferSize,r=e.encodedBodySize,[r,n?n-r:"_",(i=e.decodedBodySize)?i-r:0].map(x).join(",").replace(/,+$/,"")):""}function k(n,r){var i,o,s;if(n&&r)for(i=0;i<r.length;i++)if("string"==typeof(s=r[i])){if(-1!==(o=n.indexOf(s))){n=n.substr(0,o+s.length)+"...";break}}else s instanceof RegExp&&s.test(n)&&(n=n.replace(s,"$1")+"...");return BOOMR.utils.cleanupURL(n,e.urlLimit)}function M(e){return e.responseEnd?e.responseEnd:e.responseStart&&e.startTime?e.responseStart+(e.responseStart-e.startTime)*.2:1/0}function P(e,n,r){var i=BOOMR.window.screen,o=i.height,s=i.width;return n.reduce(function(e,n){var i,a,c,d,l,u;if(i=Math.max(0,n[3]),c=Math.max(0,n[2]),a=Math.min(n[3]+n[1],s),d=Math.min(n[2]+n[0],o),i>=a||c>=d)return e;for(u=c;u<d;u++)for(e[u]||(e[u]=[]),l=i;l<a;l++)e[u][l]=r;return e},e||[])}function j(e,n,r){return n=n||0,r=r||1/0,e.reduce(function(e,i){return e+i.filter(function(e){return n<=e&&e<=r}).length},0)}function A(r,i){var o,u,f,p,S,R={},T={},C=O(r,i,e.trackedResourceTypes),E=C.entries,M=C.serverTiming;if(!E||!E.length)return{restiming:{},servertiming:[]};for(o=0;o<E.length;o++){u=E[o];var P=BOOMR.plugins.Continuity.getTTIWaitForXHRIngore(),j=u.initiatorType&&BOOMR.utils.inArray(u.initiatorType,["xmlhttprequest","fetch"])&&a(P,u.name);void 0===(f=n[u.initiatorType])&&(f=0),S=f+[w(u.startTime,0),w(u.responseEnd,u.startTime),w(u.responseStart,u.startTime),w(u.requestStart,u.startTime),w(u.connectEnd,u.startTime),w(u.secureConnectionStart,u.startTime),w(u.connectStart,u.startTime),w(u.domainLookupEnd,u.startTime),w(u.domainLookupStart,u.startTime),w(u.redirectEnd,u.startTime),w(u.redirectStart,u.startTime)].map(x).join(",").replace(/,+$/,"");var A=I(u);if(""!==A&&(S+=s+d+A),u.hasOwnProperty("scriptAttrs")&&(S+=s+l+u.scriptAttrs),u.serverTiming&&u.serverTiming.length&&(S+=s+h+u.serverTiming.reduce(function(e,n,r){var i=String(void 0!==n.duration?n.duration:n.value);"0."===i.substring(0,2)&&(i=i.substring(1));var o=n.name||n.metric;return e+((r>0?",":"")+i+F(M.indexed[o].index,M.indexed[o].descriptions[n.description]))},"")),u.hasOwnProperty("linkAttrs")&&(S+=s+m+u.linkAttrs),u.workerStart&&"number"==typeof u.workerStart&&0!==u.workerStart){var D,B=w(("number"!=typeof(D=u.workerStart)&&(D=0),Math.ceil(D||0)),u.startTime);S+=s+g+x(B)}if(j&&(S+=s+y+1),p=k(u.name,e.trimUrls),u.hasOwnProperty("_data")){var N="";for(var L in u._data)u._data.hasOwnProperty(L)&&(N+=s+v+L+":"+u._data[L]);void 0===R[p]?R[p]=S+N:R[p]+=N}else void 0!==R[p]?R[p]+="|"+S:u.visibleDimensions?R[p]=s+c+u.visibleDimensions.map(Math.round).map(x).join(",").replace(/,+$/,"")+"|"+S:R[p]=S;u.visibleDimensions&&(T[u.latestTime]||(T[u.latestTime]=[]),T[u.latestTime].push(u.visibleDimensions))}return{restiming:_(b(R,e.splitAtPath),!0),servertiming:M.lookup}}function D(e){var n=[];if(!e||!e.length)return n;for(var r=0;r<e.length;r++){var i=e[r];(r===e.length-1||i.fetchStart!==e[r+1].fetchStart)&&n.push({fetchStart:i.fetchStart,responseEnd:i.responseStart||i.responseEnd})}return n}function B(e,n){var r;"undefined"!=typeof JSON&&(r=A(e,n))&&(BOOMR.info("Client supports Resource Timing API","restiming"),H(r))}function N(e,n){(n||[]).forEach(function(n){var r=n.name||n.metric;void 0===e[r]&&(e[r]={count:0,counts:{}});var i=e[r];i.counts[n.description]=i.counts[n.description]||0,i.counts[n.description]++,i.count++})}function L(e){return Object.keys(e).sort(function(n,r){return e[r].count-e[n].count}).reduce(function(n,r){var i=Object.keys(e[r].counts).sort(function(n,i){return e[r].counts[i]-e[r].counts[n]});return n.push(1===i.length&&""===i[0]?r:[r].concat(i)),n},[])}function U(e){return e.reduce(function(e,n,r){var i,o;return Array.isArray(n)?(i=n[0],o=n.slice(1).reduce(function(e,n,r){return e[n]=r,e},{})):(i=n,o={"":0}),e[i]={index:r,descriptions:o},e},{})}function F(e,n){var r="";return e&&(r+=e),n&&(r+="."+n),r.length&&(r=":"+r),r}function H(e){BOOMR.addVar("restiming",JSON.stringify(e.restiming),!0),e.servertiming.length&&BOOMR.addVar("servertiming",BOOMR.utils.serializeForUrl(e.servertiming),!0)}}(),!BOOMR.plugins.UserTiming){var p={complete:!1,initialized:!1,supported:!1,options:{from:0,window:BOOMR.window},getUserTiming:function(){var e,n=this.findUserTimingForFrame(p.options.window);p.options.from&&(n=n.filter(function(e){return e.startTime+e.duration>=p.options.from}));var r=window.UserTimingCompression||BOOMR.window.UserTimingCompression;if(void 0!==r)return e=r.compressUserTiming(n),r.compressForUri(e);if(0===n.length)return null;for(var i=this.getUserTimingMap(),o=0,s=n.length;o<s;o++){var a=n[o];"measure"===a.entryType&&0===a.name.indexOf("x_")&&(i[a.name]?i[a.name].push(a.duration):i[a.name]=[a.duration])}return JSON.stringify(i)},addEntriesToBeacon:function(e){var n,r=BOOMR.hrNow();this.complete||e&&void 0!==e.early||((n=this.getUserTiming())&&BOOMR.addVar("usertiming",n,!0),this.options.from=r,this.complete=!0)},getUserTimingMap:function(){var e,n=BOOMR.getVar("usertiming");if(!n)return{};try{if(e=JSON.parse(n),s(e))return e}catch(e){}return{}},findUserTimingForFrame:function(e){var n;if(!e)return[];try{if(e.location&&e.location.href,!("performance"in e)||!e.performance||!e.performance.getEntriesByType)return n;n=(n=e.performance.getEntriesByType("mark")).concat(e.performance.getEntriesByType("measure"))}catch(e){}return n},clearMetrics:function(e){this.complete=!1},subscribe:function(){BOOMR.subscribe("before_beacon",this.addEntriesToBeacon,null,this),BOOMR.subscribe("beacon",this.clearMetrics,null,this)},pageReady:function(){this.checkSupport()&&this.subscribe()},checkSupport:function(){if(this.supported)return!0;var e=BOOMR.getPerformance();if(e&&"function"==typeof e.getEntriesByType){var n=e.getEntriesByType("mark"),r=e.getEntriesByType("measure");if(BOOMR.utils.isArray(n)&&BOOMR.utils.isArray(r))return BOOMR.info("Client supports UserTiming API","usertiming"),this.supported=!0,!0}return!1}};BOOMR.plugins.UserTiming={init:function(e){return p.initialized||(p.checkSupport()?p.subscribe():BOOMR.subscribe("page_ready",p.pageReady,null,p),p.initialized=!0),this},is_complete:function(){return!0},is_supported:function(){return p.initialized&&p.supported},addUserTiming:function(e){var n=p.getUserTimingMap();s(e)&&(Object.keys(e).forEach(function(r){var i,o=e[r];i=o,"[object Number]"===Object.prototype.toString.call(i)&&(o=[o]),n[r]?n[r].concat(o):n[r]=o}),n&&BOOMR.addVar("usertiming",JSON.stringify(n),!0))}}}if(!BOOMR.plugins.EventTiming){var h={click:0,dblclick:1,mousedown:2,mouseup:3,mousemove:4,touchstart:5,touchend:6,touchmove:7,keydown:8,keyup:9,keypress:10,wheel:11,pointerdown:12,pointerup:13,pointermove:14,compositionstart:17,compositionupdate:18,compositionend:19,contextmenu:20},m={initialized:!1,supported:null,observerEvent:null,observerFirstInput:null,entries:[],firstInputDelay:null,timeToFirstInteraction:null,onBeforeBeacon:function(){var e;if(m.entries&&m.entries.length){var n=[];for(e=0;e<m.entries.length;e++)n.push({n:h[m.entries[e].name]?h[m.entries[e].name]:m.entries[e].name,s:Math.round(m.entries[e].startTime).toString(36),d:Math.round(m.entries[e].duration).toString(36),p:Math.round(m.entries[e].processingEnd-m.entries[e].processingStart).toString(36),c:+!!m.entries[e].cancelable,fi:"first-input"===m.entries[e].entryType?1:void 0});BOOMR.addVar("et.e",BOOMR.utils.serializeForUrl(n),!0)}m.entries=[],null!==m.firstInputDelay&&(BOOMR.addVar("et.fid",Math.ceil(m.firstInputDelay),!0),m.firstInputDelay=null)},onEventTiming:function(e){m.entries=m.entries.concat(e.getEntries())},onFirstInput:function(e){var n=e.getEntries();m.entries=m.entries.concat(n),m.firstInputDelay=n[0].processingStart-n[0].startTime,m.timeToFirstInteraction=n[0].startTime}};BOOMR.plugins.EventTiming={init:function(){if(this.is_supported()||(m.initialized=!0),!m.initialized){BOOMR.subscribe("before_beacon",m.onBeforeBeacon,null,m);try{var e=BOOMR.window;m.observerEvent=new e.PerformanceObserver(m.onEventTiming),m.observerEvent.observe({type:["event"],buffered:!0}),m.observerFirstInput=new e.PerformanceObserver(m.onFirstInput),m.observerFirstInput.observe({type:["first-input"],buffered:!0})}catch(e){m.supported=!1}m.initialized=!0}return this},is_complete:function(){return!0},is_enabled:function(){return m.initialized&&this.is_supported()},is_supported:function(){if(null!==m.supported)return m.supported;var e=BOOMR.window;return m.supported=BOOMR.getPerformance()&&void 0!==e.PerformanceEventTiming&&"function"==typeof e.PerformanceObserver,m.supported&&BOOMR.info("This user agent supports EventTiming","et"),m.supported},stop:function(){m.observerEvent&&(m.observerEvent.disconnect(),m.observerEvent=null),m.observerFirstInput&&(m.observerFirstInput.disconnect(),m.observerFirstInput=null)},metrics:{count:function(){return m.entries.length},averageDuration:function(){if(0===m.entries.length)return 0;for(var e=0,n=0;n<m.entries.length;n++)e+=m.entries[n].duration;return e/m.entries.length},firstInputDelay:function(){return m.firstInputDelay},timeToFirstInteraction:function(){return m.timeToFirstInteraction}}}}},e.prototype.uninstall=function(){var e=this.BOOMR,n=e.plugins;e.disable(),Object.keys(n).forEach(function(e){n[e].disable&&n[e].disable()}),e.orig_XMLHttpRequest&&e.orig_XMLHttpRequest!==window.XMLHttpRequest&&(window.XMLHttpRequest=e.orig_XMLHttpRequest)},e.prototype.addUserTiming=function(e){var n=this.BOOMR;n&&n.plugins.UserTiming&&n.plugins.UserTiming.addUserTiming&&n.plugins.UserTiming.addUserTiming(e)},e}()},"../../node_modules/abort-signal-polyfill/dist/staticMethods/abort.js":function(e,n){"use strict";n.abortSignalAbort=function(e){let n=new AbortController;return n.abort(e),n.signal}},"../../node_modules/abort-signal-polyfill/dist/staticMethods/any.js":function(e,n){"use strict";n.abortSignalAny=function(e){if(0===e.length)return new AbortController().signal;if(1===e.length)return e[0];for(let n of e)if(n.aborted)return n;let n=new AbortController,r=Array(e.length);return e.forEach((e,i)=>{let o=()=>{for(let i of(n.abort(e.reason),r))i()};e.addEventListener("abort",o),r[i]=()=>e.removeEventListener("abort",o)}),n.signal}},"../../node_modules/abort-signal-polyfill/dist/staticMethods/timeout.js":function(e,n){"use strict";n.abortSignalTimeout=function(e){let n=new AbortController;return setTimeout(()=>{n.abort(new DOMException(`signal timed out after ${e} ms`,"TimeoutError"))},e),n.signal}},"../../node_modules/baidurtc/dist/baidu.rtc.sdk.js":function(e,n,r){"object"!=typeof window&&(window=r.g),e.exports=(i=function(){return(function e(n,r,i){function o(a,c){if(!r[a]){if(!n[a]){if(s)return s(a,!0);var d=Error("Cannot find module '"+a+"'");throw d.code="MODULE_NOT_FOUND",d}var l=r[a]={exports:{}};n[a][0].call(l.exports,function(e){return o(n[a][1][e]||e)},l,l.exports,e,n,r,i)}return r[a].exports}for(var s=void 0,a=0;a<i.length;a++)o(i[a]);return o})({1:[function(e,n,r){"use strict";n.exports=(0,e("./adapter_factory.js").adapterFactory)({window:window})},{"./adapter_factory.js":2}],2:[function(e,n,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.adapterFactory=function(){var e=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).window,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0},r=i.log,l=i.detectBrowser(e),u={browserDetails:l,commonShim:d,extractVersion:i.extractVersion,disableLog:i.disableLog,disableWarnings:i.disableWarnings};switch(l.browser){case"chrome":if(!o||!o.shimPeerConnection||!n.shimChrome)return r("Chrome shim is not included in this adapter release."),u;r("adapter.js shimming chrome."),(u.browserShim=o).shimGetUserMedia(e),o.shimMediaStream(e),o.shimPeerConnection(e),o.shimOnTrack(e),o.shimAddTrackRemoveTrack(e),o.shimGetSendersWithDtmf(e),o.shimGetStats(e),o.shimSenderReceiverGetStats(e),o.fixNegotiationNeeded(e),d.shimRTCIceCandidate(e),d.shimConnectionState(e),d.shimMaxMessageSize(e),d.shimSendThrowTypeError(e),d.removeAllowExtmapMixed(e);break;case"firefox":if(!a||!a.shimPeerConnection||!n.shimFirefox)return r("Firefox shim is not included in this adapter release."),u;r("adapter.js shimming firefox."),(u.browserShim=a).shimGetUserMedia(e),a.shimPeerConnection(e),a.shimOnTrack(e),a.shimRemoveStream(e),a.shimSenderGetStats(e),a.shimReceiverGetStats(e),a.shimRTCDataChannel(e),a.shimAddTransceiver(e),a.shimCreateOffer(e),a.shimCreateAnswer(e),d.shimRTCIceCandidate(e),d.shimConnectionState(e),d.shimMaxMessageSize(e),d.shimSendThrowTypeError(e);break;case"edge":if(!s||!s.shimPeerConnection||!n.shimEdge)return r("MS edge shim is not included in this adapter release."),u;r("adapter.js shimming edge."),(u.browserShim=s).shimGetUserMedia(e),s.shimGetDisplayMedia(e),s.shimPeerConnection(e),s.shimReplaceTrack(e),d.shimMaxMessageSize(e),d.shimSendThrowTypeError(e);break;case"safari":if(!c||!n.shimSafari)return r("Safari shim is not included in this adapter release."),u;r("adapter.js shimming safari."),(u.browserShim=c).shimRTCIceServerUrls(e),c.shimCreateOfferLegacy(e),c.shimCallbacksAPI(e),c.shimLocalStreamsAPI(e),c.shimRemoteStreamsAPI(e),c.shimTrackEventTransceiver(e),c.shimGetUserMedia(e),d.shimRTCIceCandidate(e),d.shimMaxMessageSize(e),d.shimSendThrowTypeError(e),d.removeAllowExtmapMixed(e);break;default:r("Unsupported browser!")}return u};var i=l(e("./utils")),o=l(e("./chrome/chrome_shim")),s=l(e("./edge/edge_shim")),a=l(e("./firefox/firefox_shim")),c=l(e("./safari/safari_shim")),d=l(e("./common_shim"));function l(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n.default=e,n}},{"./chrome/chrome_shim":3,"./common_shim":6,"./edge/edge_shim":7,"./firefox/firefox_shim":11,"./safari/safari_shim":14,"./utils":15}],3:[function(e,n,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.shimGetDisplayMedia=r.shimGetUserMedia=void 0;var i="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},o=e("./getusermedia");Object.defineProperty(r,"shimGetUserMedia",{enumerable:!0,get:function(){return o.shimGetUserMedia}});var s=e("./getdisplaymedia");Object.defineProperty(r,"shimGetDisplayMedia",{enumerable:!0,get:function(){return s.shimGetDisplayMedia}}),r.shimMediaStream=function(e){e.MediaStream=e.MediaStream||e.webkitMediaStream},r.shimOnTrack=function(e){if("object"!==(void 0===e?"undefined":i(e))||!e.RTCPeerConnection||"ontrack"in e.RTCPeerConnection.prototype)a.wrapPeerConnectionEvent(e,"track",function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e});else{Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var r=this;return this._ontrackpoly||(this._ontrackpoly=function(n){n.stream.addEventListener("addtrack",function(i){var o=void 0;o=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find(function(e){return e.track&&e.track.id===i.track.id}):{track:i.track};var s=new Event("track");s.track=i.track,s.receiver=o,s.transceiver={receiver:o},s.streams=[n.stream],r.dispatchEvent(s)}),n.stream.getTracks().forEach(function(i){var o=void 0;o=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find(function(e){return e.track&&e.track.id===i.id}):{track:i};var s=new Event("track");s.track=i,s.receiver=o,s.transceiver={receiver:o},s.streams=[n.stream],r.dispatchEvent(s)})},this.addEventListener("addstream",this._ontrackpoly)),n.apply(this,arguments)}}},r.shimGetSendersWithDtmf=function(e){if("object"===(void 0===e?"undefined":i(e))&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var n=function(e,n){return{track:n,get dtmf(){return void 0===this._dtmf&&("audio"===n.kind?this._dtmf=e.createDTMFSender(n):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){var o=r.apply(this,arguments);return o||(o=n(this,e),this._senders.push(o)),o};var o=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){o.apply(this,arguments);var n=this._senders.indexOf(e);-1!==n&&this._senders.splice(n,1)}}var s=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._senders=this._senders||[],s.apply(this,[e]),e.getTracks().forEach(function(e){r._senders.push(n(r,e))})};var a=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var n=this;this._senders=this._senders||[],a.apply(this,[e]),e.getTracks().forEach(function(e){var r=n._senders.find(function(n){return n.track===e});r&&n._senders.splice(n._senders.indexOf(r),1)})}}else if("object"===(void 0===e?"undefined":i(e))&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var c=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,n=c.apply(this,[]);return n.forEach(function(n){return n._pc=e}),n},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}},r.shimGetStats=function(e){if(!e.RTCPeerConnection)return},r.shimSenderReceiverGetStats=function(e){if("object"===(void 0===e?"undefined":i(e))&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var n=e.RTCPeerConnection.prototype.getSenders;n&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=n.apply(this,[]);return r.forEach(function(n){return n._pc=e}),r});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then(function(n){return a.filterStats(n,e.track,!0)})}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var o=e.RTCPeerConnection.prototype.getReceivers;o&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,n=o.apply(this,[]);return n.forEach(function(n){return n._pc=e}),n}),a.wrapPeerConnectionEvent(e,"track",function(e){return e.receiver._pc=e.srcElement,e}),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then(function(n){return a.filterStats(n,e.track,!1)})}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var s=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(n){if(0<arguments.length&&n instanceof e.MediaStreamTrack){var r=void 0,i=void 0,o=void 0;return this.getSenders().forEach(function(e){e.track===n&&(r?o=!0:r=e)}),this.getReceivers().forEach(function(e){return e.track===n&&(i?o=!0:i=e),e.track===n}),o||r&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):r?r.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return s.apply(this,arguments)}}}},r.shimAddTrackRemoveTrackWithNative=d,r.shimAddTrackRemoveTrack=function(e){if(e.RTCPeerConnection){var n=a.detectBrowser(e);if(e.RTCPeerConnection.prototype.addTrack&&65<=n.version)return d(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,n=r.apply(this);return this._reverseStreams=this._reverseStreams||{},n.map(function(n){return e._reverseStreams[n.id]})};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(n){var r=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.getTracks().forEach(function(e){if(r.getSenders().find(function(n){return n.track===e}))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[n.id]){var o=new e.MediaStream(n.getTracks());this._streams[n.id]=o,this._reverseStreams[o.id]=n,n=o}i.apply(this,[n])};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},o.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(n,r){var i=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var o=[].slice.call(arguments,1);if(1!==o.length||!o[0].getTracks().find(function(e){return e===n}))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(function(e){return e.track===n}))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var s=this._streams[r.id];if(s)s.addTrack(n),Promise.resolve().then(function(){i.dispatchEvent(new Event("negotiationneeded"))});else{var a=new e.MediaStream([n]);this._streams[r.id]=a,this._reverseStreams[a.id]=r,this.addStream(a)}return this.getSenders().find(function(e){return e.track===n})},["createOffer","createAnswer"].forEach(function(n){var r=e.RTCPeerConnection.prototype[n],i=c({},n,function(){var e=this,n=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[function(r){var i=u(e,r);n[0].apply(null,[i])},function(e){n[1]&&n[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then(function(n){return u(e,n)})});e.RTCPeerConnection.prototype[n]=i[n]});var s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(e){var n,r,i;return arguments.length&&e.type&&(n=this,i=(r=e).sdp,Object.keys(n._reverseStreams||[]).forEach(function(e){var r=n._reverseStreams[e],o=n._streams[r.id];i=i.replace(RegExp(r.id,"g"),o.id)}),e=new RTCSessionDescription({type:r.type,sdp:i})),s.apply(this,arguments)};var l=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=l.get.apply(this);return""===e.type?e:u(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var n=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(e._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};var r=void 0;Object.keys(this._streams).forEach(function(i){n._streams[i].getTracks().find(function(n){return e.track===n})&&(r=n._streams[i])}),r&&(1===r.getTracks().length?this.removeStream(this._reverseStreams[r.id]):r.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function u(e,n){var r=n.sdp;return Object.keys(e._reverseStreams||[]).forEach(function(n){var i=e._reverseStreams[n],o=e._streams[i.id];r=r.replace(RegExp(o.id,"g"),i.id)}),new RTCSessionDescription({type:n.type,sdp:r})}},r.shimPeerConnection=function(e){var n=a.detectBrowser(e);if(!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection){n.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(n){var r=e.RTCPeerConnection.prototype[n],i=c({},n,function(){return arguments[0]=new("addIceCandidate"===n?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)});e.RTCPeerConnection.prototype[n]=i[n]});var r=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(e,i){return e?n.version<78&&e&&""===e.candidate?Promise.resolve():r.apply(this,arguments):(i&&i.apply(null),Promise.resolve())}}},r.fixNegotiationNeeded=function(e){a.wrapPeerConnectionEvent(e,"negotiationneeded",function(e){if("stable"===e.target.signalingState)return e})};var a=function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n.default=e,n}(e("../utils.js"));function c(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function d(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(function(n){return e._shimmedLocalStreams[n][0]})};var n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return n.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var i=n.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var n=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(function(e){if(n.getSenders().find(function(n){return n.track===e}))throw new DOMException("Track already exists.","InvalidAccessError")});var i=this.getSenders();r.apply(this,arguments);var o=this.getSenders().filter(function(e){return -1===i.indexOf(e)});this._shimmedLocalStreams[e.id]=[e].concat(o)};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};var o=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var n=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(function(r){var i=n._shimmedLocalStreams[r].indexOf(e);-1!==i&&n._shimmedLocalStreams[r].splice(i,1),1===n._shimmedLocalStreams[r].length&&delete n._shimmedLocalStreams[r]}),o.apply(this,arguments)}}},{"../utils.js":15,"./getdisplaymedia":4,"./getusermedia":5}],4:[function(e,n,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.shimGetDisplayMedia=function(e,n){if((!e.navigator.mediaDevices||!("getDisplayMedia"in e.navigator.mediaDevices))&&e.navigator.mediaDevices){if("function"!=typeof n)return void console.error("shimGetDisplayMedia: getSourceId argument is not a function");e.navigator.mediaDevices.getDisplayMedia=function(r){return n(r).then(function(n){var i=r.video&&r.video.width,o=r.video&&r.video.height,s=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:n,maxFrameRate:s||3}},i&&(r.video.mandatory.maxWidth=i),o&&(r.video.mandatory.maxHeight=o),e.navigator.mediaDevices.getUserMedia(r)})}}}},{}],5:[function(e,n,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i="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};r.shimGetUserMedia=function(e){var n=e&&e.navigator;if(n.mediaDevices){var r=o.detectBrowser(e);if(n.getUserMedia=(function(e,r,i){d(e,function(e){n.webkitGetUserMedia(e,r,function(e){i&&i(l(e))})})}).bind(n),n.mediaDevices.getUserMedia){var a=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return d(e,function(e){return a(e).then(function(n){if(e.audio&&!n.getAudioTracks().length||e.video&&!n.getVideoTracks().length)throw n.getTracks().forEach(function(e){e.stop()}),new DOMException("","NotFoundError");return n},function(e){return Promise.reject(l(e))})})}}}function c(e){if("object"!==(void 0===e?"undefined":i(e))||e.mandatory||e.optional)return e;var n={};return Object.keys(e).forEach(function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var o="object"===i(e[r])?e[r]:{ideal:e[r]};void 0!==o.exact&&"number"==typeof o.exact&&(o.min=o.max=o.exact);var s=function(e,n){return e?e+n.charAt(0).toUpperCase()+n.slice(1):"deviceId"===n?"sourceId":n};if(void 0!==o.ideal){n.optional=n.optional||[];var a={};"number"==typeof o.ideal?(a[s("min",r)]=o.ideal,n.optional.push(a),(a={})[s("max",r)]=o.ideal):a[s("",r)]=o.ideal,n.optional.push(a)}void 0!==o.exact&&"number"!=typeof o.exact?(n.mandatory=n.mandatory||{},n.mandatory[s("",r)]=o.exact):["min","max"].forEach(function(e){void 0!==o[e]&&(n.mandatory=n.mandatory||{},n.mandatory[s(e,r)]=o[e])})}}),e.advanced&&(n.optional=(n.optional||[]).concat(e.advanced)),n}function d(e,o){if(61<=r.version)return o(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===i(e.audio)){var a=function(e,n,r){n in e&&!(r in e)&&(e[r]=e[n],delete e[n])};a((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),a(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=c(e.audio)}if(e&&"object"===i(e.video)){var d=e.video.facingMode;d=d&&("object"===(void 0===d?"undefined":i(d))?d:{ideal:d});var l=r.version<66;if(d&&("user"===d.exact||"environment"===d.exact||"user"===d.ideal||"environment"===d.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||l)){delete e.video.facingMode;var u=void 0;if("environment"===d.exact||"environment"===d.ideal?u=["back","rear"]:"user"!==d.exact&&"user"!==d.ideal||(u=["front"]),u)return n.mediaDevices.enumerateDevices().then(function(n){var r=(n=n.filter(function(e){return"videoinput"===e.kind})).find(function(e){return u.some(function(n){return e.label.toLowerCase().includes(n)})});return!r&&n.length&&u.includes("back")&&(r=n[n.length-1]),r&&(e.video.deviceId=d.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=c(e.video),s("chrome: "+JSON.stringify(e)),o(e)})}e.video=c(e.video)}return s("chrome: "+JSON.stringify(e)),o(e)}function l(e){return 64<=r.version?e:{name:({PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"})[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}}};var o=function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n.default=e,n}(e("../utils.js")),s=o.log},{"../utils.js":15}],6:[function(e,n,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i="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};r.shimRTCIceCandidate=function(e){if(e.RTCIceCandidate&&(!e.RTCIceCandidate||!("foundation"in e.RTCIceCandidate.prototype))){var n=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===(void 0===e?"undefined":i(e))&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var r=Object.assign(new n(e),s.default.parseCandidate(e.candidate));return r.toJSON=function(){return{candidate:r.candidate,sdpMid:r.sdpMid,sdpMLineIndex:r.sdpMLineIndex,usernameFragment:r.usernameFragment}},r}return new n(e)},e.RTCIceCandidate.prototype=n.prototype,a.wrapPeerConnectionEvent(e,"icecandidate",function(n){return n.candidate&&Object.defineProperty(n,"candidate",{value:new e.RTCIceCandidate(n.candidate),writable:"false"}),n})}},r.shimMaxMessageSize=function(e){if(e.RTCPeerConnection){var n=a.detectBrowser(e);"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(e){if(this._sctp=null,"chrome"===n.browser&&76<=n.version&&"plan-b"===this.getConfiguration().sdpSemantics&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0}),function(e){if(!e||!e.sdp)return!1;var n=s.default.splitSections(e.sdp);return n.shift(),n.some(function(e){var n=s.default.parseMLine(e);return n&&"application"===n.kind&&-1!==n.protocol.indexOf("SCTP")})}(e)){var i,o,a,c=function(e){var n=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===n||n.length<2)return -1;var r=parseInt(n[1],10);return r!=r?-1:r}(e),d=(i=65536,"firefox"===n.browser&&(i=n.version<57?-1===c?16384:0x7ffffff5:n.version<60?57===n.version?65535:65536:0x7ffffff5),i),l=(o=65536,"firefox"===n.browser&&57===n.version&&(o=65535),0<(a=s.default.matchPrefix(e.sdp,"a=max-message-size:")).length?o=parseInt(a[0].substr(19),10):"firefox"===n.browser&&-1!==c&&(o=0x7ffffff5),o),u=void 0;u=0===d&&0===l?1/0:0===d||0===l?Math.max(d,l):Math.min(d,l);var f={};Object.defineProperty(f,"maxMessageSize",{get:function(){return u}}),this._sctp=f}return r.apply(this,arguments)}}},r.shimSendThrowTypeError=function(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=n.apply(this,arguments);return r(e,this),e},a.wrapPeerConnectionEvent(e,"datachannel",function(e){return r(e.channel,e.target),e})}function r(e,n){var r=e.send;e.send=function(i){var o=i.length||i.size||i.byteLength;if("open"===e.readyState&&n.sctp&&o>n.sctp.maxMessageSize)throw TypeError("Message too large (can send a maximum of "+n.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}},r.shimConnectionState=function(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var n=e.RTCPeerConnection.prototype;Object.defineProperty(n,"connectionState",{get:function(){return({completed:"connected",checking:"connecting"})[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(n,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(function(e){var r=n[e];n[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var n=e.target;if(n._lastConnectionState!==n.connectionState){n._lastConnectionState=n.connectionState;var r=new Event("connectionstatechange",e);n.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}})}},r.removeAllowExtmapMixed=function(e){if(e.RTCPeerConnection){var n=a.detectBrowser(e);if("chrome"!==n.browser||!(71<=n.version)){var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(e){return e&&e.sdp&&-1!==e.sdp.indexOf("\na=extmap-allow-mixed")&&(e.sdp=e.sdp.split("\n").filter(function(e){return"a=extmap-allow-mixed"!==e.trim()}).join("\n")),r.apply(this,arguments)}}}};var o=e("sdp"),s=o&&o.__esModule?o:{default:o},a=function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n.default=e,n}(e("./utils"))},{"./utils":15,sdp:17}],7:[function(e,n,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.shimGetDisplayMedia=r.shimGetUserMedia=void 0;var i=e("./getusermedia");Object.defineProperty(r,"shimGetUserMedia",{enumerable:!0,get:function(){return i.shimGetUserMedia}});var o=e("./getdisplaymedia");Object.defineProperty(r,"shimGetDisplayMedia",{enumerable:!0,get:function(){return o.shimGetDisplayMedia}}),r.shimPeerConnection=function(e){var n=s.detectBrowser(e);if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),n.version<15025)){var r=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set:function(e){r.set.call(this,e);var n=new Event("enabled");n.enabled=e,this.dispatchEvent(n)}})}!e.RTCRtpSender||"dtmf"in e.RTCRtpSender.prototype||Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);var i=(0,d.default)(e,n.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=(0,a.filterIceServers)(e.iceServers,n.version),s.log("ICE servers after filtering:",e.iceServers)),new i(e)},e.RTCPeerConnection.prototype=i.prototype},r.shimReplaceTrack=function(e){!e.RTCRtpSender||"replaceTrack"in e.RTCRtpSender.prototype||(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)};var s=function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n.default=e,n}(e("../utils")),a=e("./filtericeservers"),c=e("rtcpeerconnection-shim"),d=c&&c.__esModule?c:{default:c}},{"../utils":15,"./filtericeservers":8,"./getdisplaymedia":9,"./getusermedia":10,"rtcpeerconnection-shim":16}],8:[function(e,n,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.filterIceServers=function(e,n){var r=!1;return(e=JSON.parse(JSON.stringify(e))).filter(function(e){if(e&&(e.urls||e.url)){var n=e.urls||e.url;e.url&&!e.urls&&i.deprecated("RTCIceServer.url","RTCIceServer.urls");var o="string"==typeof n;return o&&(n=[n]),n=n.filter(function(e){if(0===e.indexOf("stun:"))return!1;var n=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return n&&!r?r=!0:n&&!r}),delete e.url,e.urls=o?n[0]:n,!!n.length}})};var i=function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n.default=e,n}(e("../utils"))},{"../utils":15}],9:[function(e,n,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.shimGetDisplayMedia=function(e){!("getDisplayMedia"in e.navigator)||!e.navigator.mediaDevices||e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator))}},{}],10:[function(e,n,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.shimGetUserMedia=function(e){var n=e&&e.navigator,r=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(e){return r(e).catch(function(e){return Promise.reject({name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString:function(){return this.name}})})}}},{}],11:[function(e,n,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.shimGetDisplayMedia=r.shimGetUserMedia=void 0;var i="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},o=e("./getusermedia");Object.defineProperty(r,"shimGetUserMedia",{enumerable:!0,get:function(){return o.shimGetUserMedia}});var s=e("./getdisplaymedia");Object.defineProperty(r,"shimGetDisplayMedia",{enumerable:!0,get:function(){return s.shimGetDisplayMedia}}),r.shimOnTrack=function(e){"object"===(void 0===e?"undefined":i(e))&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},r.shimPeerConnection=function(e){var n=a.detectBrowser(e);if("object"===(void 0===e?"undefined":i(e))&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){if(!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),n.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(n){var r,i,o=e.RTCPeerConnection.prototype[n],s=(r={},i=function(){return arguments[0]=new("addIceCandidate"===n?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),o.apply(this,arguments)},n in r?Object.defineProperty(r,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[n]=i,r);e.RTCPeerConnection.prototype[n]=s[n]}),n.version<68){var r=e.RTCPeerConnection.prototype.addIceCandidate;e.RTCPeerConnection.prototype.addIceCandidate=function(e,n){return e?e&&""===e.candidate?Promise.resolve():r.apply(this,arguments):(n&&n.apply(null),Promise.resolve())}}var o={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},s=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),r=e[0],i=e[1],a=e[2];return s.apply(this,[r||null]).then(function(e){if(n.version<53&&!i)try{e.forEach(function(e){e.type=o[e.type]||e.type})}catch(n){if("TypeError"!==n.name)throw n;e.forEach(function(n,r){e.set(r,Object.assign({},n,{type:o[n.type]||n.type}))})}return e}).then(i,a)}}},r.shimSenderGetStats=function(e){if("object"===(void 0===e?"undefined":i(e))&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var n=e.RTCPeerConnection.prototype.getSenders;n&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=n.apply(this,[]);return r.forEach(function(n){return n._pc=e}),r});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}},r.shimReceiverGetStats=function(e){if("object"===(void 0===e?"undefined":i(e))&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,r=n.apply(this,[]);return r.forEach(function(n){return n._pc=e}),r}),a.wrapPeerConnectionEvent(e,"track",function(e){return e.receiver._pc=e.srcElement,e}),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}},r.shimRemoveStream=function(e){!e.RTCPeerConnection||"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var n=this;a.deprecated("removeStream","removeTrack"),this.getSenders().forEach(function(r){r.track&&e.getTracks().includes(r.track)&&n.removeTrack(r)})})},r.shimRTCDataChannel=function(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)},r.shimAddTransceiver=function(e){if("object"===(void 0===e?"undefined":i(e))&&e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype.addTransceiver;n&&(e.RTCPeerConnection.prototype.addTransceiver=function(e,r){this.setParametersPromises=[];var i=r&&"sendEncodings"in r;i&&r.sendEncodings.forEach(function(e){if("rid"in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in e&&!(1<=parseFloat(e.scaleResolutionDownBy)))throw RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(0<=parseFloat(e.maxFramerate)))throw RangeError("max_framerate must be >= 0.0")});var o=n.apply(this,arguments);if(i){var s=o.sender,a=s.getParameters();"encodings"in a||(a.encodings=r.sendEncodings,this.setParametersPromises.push(s.setParameters(a).catch(function(){})))}return o})}},r.shimCreateOffer=function(e){if("object"===(void 0===e?"undefined":i(e))&&e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=this,r=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(function(){return n.apply(e,r)}).finally(function(){e.setParametersPromises=[]}):n.apply(this,arguments)}}},r.shimCreateAnswer=function(e){if("object"===(void 0===e?"undefined":i(e))&&e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=this,r=arguments;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(function(){return n.apply(e,r)}).finally(function(){e.setParametersPromises=[]}):n.apply(this,arguments)}}};var a=function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n.default=e,n}(e("../utils"))},{"../utils":15,"./getdisplaymedia":12,"./getusermedia":13}],12:[function(e,n,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.shimGetDisplayMedia=function(e,n){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(r&&r.video)return!0===r.video?r.video={mediaSource:n}:r.video.mediaSource=n,e.navigator.mediaDevices.getUserMedia(r);var i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)})}},{}],13:[function(e,n,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i="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};r.shimGetUserMedia=function(e){var n=o.detectBrowser(e),r=e&&e.navigator,s=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,n,i){o.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(n,i)},!(55<n.version&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var a=function(e,n,r){n in e&&!(r in e)&&(e[r]=e[n],delete e[n])},c=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===(void 0===e?"undefined":i(e))&&"object"===i(e.audio)&&(a((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","mozAutoGainControl"),a(e.audio,"noiseSuppression","mozNoiseSuppression")),c(e)},s&&s.prototype.getSettings){var d=s.prototype.getSettings;s.prototype.getSettings=function(){var e=d.apply(this,arguments);return a(e,"mozAutoGainControl","autoGainControl"),a(e,"mozNoiseSuppression","noiseSuppression"),e}}if(s&&s.prototype.applyConstraints){var l=s.prototype.applyConstraints;s.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===(void 0===e?"undefined":i(e))&&(a(e=JSON.parse(JSON.stringify(e)),"autoGainControl","mozAutoGainControl"),a(e,"noiseSuppression","mozNoiseSuppression")),l.apply(this,[e])}}}};var o=function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n.default=e,n}(e("../utils"))},{"../utils":15}],14:[function(e,n,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i="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};r.shimLocalStreamsAPI=function(e){if("object"===(void 0===e?"undefined":i(e))&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(function(i){return n.call(r,i,e)}),e.getVideoTracks().forEach(function(i){return n.call(r,i,e)})},e.RTCPeerConnection.prototype.addTrack=function(e,r){return r&&(this._localStreams?this._localStreams.includes(r)||this._localStreams.push(r):this._localStreams=[r]),n.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var n=this;this._localStreams||(this._localStreams=[]);var r=this._localStreams.indexOf(e);if(-1!==r){this._localStreams.splice(r,1);var i=e.getTracks();this.getSenders().forEach(function(e){i.includes(e.track)&&n.removeTrack(e)})}})}},r.shimRemoteStreamsAPI=function(e){if("object"===(void 0===e?"undefined":i(e))&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var n=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach(function(e){if(n._remoteStreams||(n._remoteStreams=[]),!n._remoteStreams.includes(e)){n._remoteStreams.push(e);var r=new Event("addstream");r.stream=e,n.dispatchEvent(r)}})})}});var n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(n){n.streams.forEach(function(n){if(e._remoteStreams||(e._remoteStreams=[]),!(0<=e._remoteStreams.indexOf(n))){e._remoteStreams.push(n);var r=new Event("addstream");r.stream=n,e.dispatchEvent(r)}})}),n.apply(e,arguments)}}},r.shimCallbacksAPI=function(e){if("object"===(void 0===e?"undefined":i(e))&&e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,r=n.createOffer,o=n.createAnswer,s=n.setLocalDescription,a=n.setRemoteDescription,c=n.addIceCandidate;n.createOffer=function(e,n,i){var o=2<=arguments.length?i:e,s=r.apply(this,[o]);return n?(s.then(e,n),Promise.resolve()):s},n.createAnswer=function(e,n,r){var i=2<=arguments.length?r:e,s=o.apply(this,[i]);return n?(s.then(e,n),Promise.resolve()):s};var d=function(e,n,r){var i=s.apply(this,[e]);return r?(i.then(n,r),Promise.resolve()):i};n.setLocalDescription=d,n.setRemoteDescription=d=function(e,n,r){var i=a.apply(this,[e]);return r?(i.then(n,r),Promise.resolve()):i},n.addIceCandidate=d=function(e,n,r){var i=c.apply(this,[e]);return r?(i.then(n,r),Promise.resolve()):i}}},r.shimGetUserMedia=function(e){var n=e&&e.navigator;if(n.mediaDevices&&n.mediaDevices.getUserMedia){var r=n.mediaDevices,i=r.getUserMedia.bind(r);n.mediaDevices.getUserMedia=function(e){return i(s(e))}}!n.getUserMedia&&n.mediaDevices&&n.mediaDevices.getUserMedia&&(n.getUserMedia=(function(e,r,i){n.mediaDevices.getUserMedia(e).then(r,i)}).bind(n))},r.shimConstraints=s,r.shimRTCIceServerUrls=function(e){var n=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var i=[],s=0;s<e.iceServers.length;s++){var a=e.iceServers[s];!a.hasOwnProperty("urls")&&a.hasOwnProperty("url")?(o.deprecated("RTCIceServer.url","RTCIceServer.urls"),(a=JSON.parse(JSON.stringify(a))).urls=a.url,delete a.url,i.push(a)):i.push(e.iceServers[s])}e.iceServers=i}return new n(e,r)},e.RTCPeerConnection.prototype=n.prototype,"generateCertificate"in e.RTCPeerConnection&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return n.generateCertificate}})},r.shimTrackEventTransceiver=function(e){"object"===(void 0===e?"undefined":i(e))&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})},r.shimCreateOfferLegacy=function(e){var n=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var r=this.getTransceivers().find(function(e){return"audio"===e.receiver.track.kind});!1===e.offerToReceiveAudio&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveAudio||r||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var i=this.getTransceivers().find(function(e){return"video"===e.receiver.track.kind});!1===e.offerToReceiveVideo&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==e.offerToReceiveVideo||i||this.addTransceiver("video")}return n.apply(this,arguments)}};var o=function(e){if(e&&e.__esModule)return e;var n={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n.default=e,n}(e("../utils"));function s(e){return e&&void 0!==e.video?Object.assign({},e,{video:o.compactObject(e.video)}):e}},{"../utils":15}],15:[function(e,n,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var i="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};r.extractVersion=a,r.wrapPeerConnectionEvent=function(e,n,r){if(e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype,o=i.addEventListener;i.addEventListener=function(e,i){if(e!==n)return o.apply(this,arguments);function s(e){var n=r(e);n&&i(n)}return this._eventMap=this._eventMap||{},this._eventMap[i]=s,o.apply(this,[e,s])};var s=i.removeEventListener;i.removeEventListener=function(e,r){if(e!==n||!this._eventMap||!this._eventMap[r])return s.apply(this,arguments);var i=this._eventMap[r];return delete this._eventMap[r],s.apply(this,[e,i])},Object.defineProperty(i,"on"+n,{get:function(){return this["_on"+n]},set:function(e){this["_on"+n]&&(this.removeEventListener(n,this["_on"+n]),delete this["_on"+n]),e&&this.addEventListener(n,this["_on"+n]=e)},enumerable:!0,configurable:!0})}},r.disableLog=function(e){return"boolean"==typeof e?(o=e)?"adapter.js logging disabled":"adapter.js logging enabled":Error("Argument type: "+(void 0===e?"undefined":i(e))+". Please use a boolean.")},r.disableWarnings=function(e){return"boolean"==typeof e?(s=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled")):Error("Argument type: "+(void 0===e?"undefined":i(e))+". Please use a boolean.")},r.log=function(){"object"===("undefined"==typeof window?"undefined":i(window))&&(o||"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments))},r.deprecated=function(e,n){s&&console.warn(e+" is deprecated, please use "+n+" instead.")},r.detectBrowser=function(e){var n=e.navigator,r={browser:null,version:null};if(void 0===e||!e.navigator)return r.browser="Not a browser.",r;if(n.mozGetUserMedia)r.browser="firefox",r.version=a(n.userAgent,/Firefox\/(\d+)\./,1);else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)r.browser="chrome",r.version=a(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(n.mediaDevices&&n.userAgent.match(/Edge\/(\d+).(\d+)$/))r.browser="edge",r.version=a(n.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return r.browser="Not a supported browser.",r;r.browser="safari",r.version=a(n.userAgent,/AppleWebKit\/(\d+)\./,1),r.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return r},r.compactObject=function e(n){return c(n)?Object.keys(n).reduce(function(r,i){var o,s=c(n[i]),a=s?e(n[i]):n[i],d=s&&!Object.keys(a).length;return void 0===a||d?r:Object.assign(r,(i in(o={})?Object.defineProperty(o,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):o[i]=a,o))},{}):n},r.walkStats=d,r.filterStats=function(e,n,r){var i=r?"outbound-rtp":"inbound-rtp",o=new Map;if(null===n)return o;var s=[];return e.forEach(function(e){"track"===e.type&&e.trackIdentifier===n.id&&s.push(e)}),s.forEach(function(n){e.forEach(function(r){r.type===i&&r.trackId===n.id&&d(e,r,o)})}),o};var o=!0,s=!0;function a(e,n,r){var i=e.match(n);return i&&i.length>=r&&parseInt(i[r],10)}function c(e){return"[object Object]"===Object.prototype.toString.call(e)}function d(e,n,r){n&&!r.has(n.id)&&(r.set(n.id,n),Object.keys(n).forEach(function(i){i.endsWith("Id")?d(e,e.get(n[i]),r):i.endsWith("Ids")&&n[i].forEach(function(n){d(e,e.get(n),r)})}))}},{}],16:[function(e,n,r){"use strict";var i=e("sdp");function o(e,n,r,o,s){var a=i.writeRtpDescription(e.kind,n);if(a+=i.writeIceParameters(e.iceGatherer.getLocalParameters()),a+=i.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":s||"active"),a+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?a+="a=sendrecv\r\n":e.rtpSender?a+="a=sendonly\r\n":e.rtpReceiver?a+="a=recvonly\r\n":a+="a=inactive\r\n",e.rtpSender){var c=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=c;var d="msid:"+(o?o.id:"-")+" "+c+"\r\n";a+="a="+d,a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+d,e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+d,a+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return a+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+i.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(a+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+i.localCName+"\r\n"),a}function s(e,n){function r(e,n){e=parseInt(e,10);for(var r=0;r<n.length;r++)if(n[r].payloadType===e||n[r].preferredPayloadType===e)return n[r]}var i={codecs:[],headerExtensions:[],fecMechanisms:[]};return e.codecs.forEach(function(o){for(var s,a,c,d,l,u=0;u<n.codecs.length;u++){var f=n.codecs[u];if(o.name.toLowerCase()===f.name.toLowerCase()&&o.clockRate===f.clockRate){if("rtx"===o.name.toLowerCase()&&o.parameters&&f.parameters.apt&&(s=f,a=e.codecs,c=n.codecs,l=d=void 0,d=r(o.parameters.apt,a),l=r(s.parameters.apt,c),!d||!l||d.name.toLowerCase()!==l.name.toLowerCase()))continue;(f=JSON.parse(JSON.stringify(f))).numChannels=Math.min(o.numChannels,f.numChannels),i.codecs.push(f),f.rtcpFeedback=f.rtcpFeedback.filter(function(e){for(var n=0;n<o.rtcpFeedback.length;n++)if(o.rtcpFeedback[n].type===e.type&&o.rtcpFeedback[n].parameter===e.parameter)return!0;return!1});break}}}),e.headerExtensions.forEach(function(e){for(var r=0;r<n.headerExtensions.length;r++){var o=n.headerExtensions[r];if(e.uri===o.uri){i.headerExtensions.push(o);break}}}),i}function a(e,n,r){return -1!==({offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}})[n][e].indexOf(r)}function c(e,n){var r=e.getRemoteCandidates().find(function(e){return n.foundation===e.foundation&&n.ip===e.ip&&n.port===e.port&&n.priority===e.priority&&n.protocol===e.protocol&&n.type===e.type});return r||e.addRemoteCandidate(n),!r}function d(e,n){var r=Error(n);return r.name=e,r.code=({NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0})[e],r}n.exports=function(e,n){function r(n,r){r.addTrack(n),r.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:n}))}function l(n,r,i,o){var s=new Event("track");s.track=r,s.receiver=i,s.transceiver={receiver:i},s.streams=o,e.setTimeout(function(){n._dispatchEvent("track",s)})}function u(r){var o,s,a=this,c=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){a[e]=c[e].bind(c)}),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",r=JSON.parse(JSON.stringify(r||{})),this.usingBundle="max-bundle"===r.bundlePolicy,"negotiate"===r.rtcpMuxPolicy)throw d("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(r.rtcpMuxPolicy||(r.rtcpMuxPolicy="require"),r.iceTransportPolicy){case"all":case"relay":break;default:r.iceTransportPolicy="all"}switch(r.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:r.bundlePolicy="balanced"}if(r.iceServers=(o=r.iceServers||[],s=!1,(o=JSON.parse(JSON.stringify(o))).filter(function(e){if(e&&(e.urls||e.url)){var r=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof r;return i&&(r=[r]),r=r.filter(function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||s?0===e.indexOf("stun:")&&14393<=n&&-1===e.indexOf("?transport=udp"):s=!0}),delete e.url,e.urls=i?r[0]:r,!!r.length}})),this._iceGatherers=[],r.iceCandidatePoolSize)for(var l=r.iceCandidatePoolSize;0<l;l--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:r.iceServers,gatherPolicy:r.iceTransportPolicy}));else r.iceCandidatePoolSize=0;this._config=r,this.transceivers=[],this._sdpSessionId=i.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1}Object.defineProperty(u.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(u.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),u.prototype.onicecandidate=null,u.prototype.onaddstream=null,u.prototype.ontrack=null,u.prototype.onremovestream=null,u.prototype.onsignalingstatechange=null,u.prototype.oniceconnectionstatechange=null,u.prototype.onconnectionstatechange=null,u.prototype.onicegatheringstatechange=null,u.prototype.onnegotiationneeded=null,u.prototype.ondatachannel=null,u.prototype._dispatchEvent=function(e,n){this._isClosed||(this.dispatchEvent(n),"function"==typeof this["on"+e]&&this["on"+e](n))},u.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},u.prototype.getConfiguration=function(){return this._config},u.prototype.getLocalStreams=function(){return this.localStreams},u.prototype.getRemoteStreams=function(){return this.remoteStreams},u.prototype._createTransceiver=function(e,n){var r=0<this.transceivers.length,i={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&r)i.iceTransport=this.transceivers[0].iceTransport,i.dtlsTransport=this.transceivers[0].dtlsTransport;else{var o=this._createIceAndDtlsTransports();i.iceTransport=o.iceTransport,i.dtlsTransport=o.dtlsTransport}return n||this.transceivers.push(i),i},u.prototype.addTrack=function(n,r){if(this._isClosed)throw d("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");if(this.transceivers.find(function(e){return e.track===n}))throw d("InvalidAccessError","Track already exists.");for(var i,o=0;o<this.transceivers.length;o++)this.transceivers[o].track||this.transceivers[o].kind!==n.kind||(i=this.transceivers[o]);return i=i||this._createTransceiver(n.kind),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(r)&&this.localStreams.push(r),i.track=n,i.stream=r,i.rtpSender=new e.RTCRtpSender(n,i.dtlsTransport),i.rtpSender},u.prototype.addStream=function(e){var r=this;if(15025<=n)e.getTracks().forEach(function(n){r.addTrack(n,e)});else{var i=e.clone();e.getTracks().forEach(function(e,n){var r=i.getTracks()[n];e.addEventListener("enabled",function(e){r.enabled=e.enabled})}),i.getTracks().forEach(function(e){r.addTrack(e,i)})}},u.prototype.removeTrack=function(n){if(this._isClosed)throw d("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(n instanceof e.RTCRtpSender))throw TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var r=this.transceivers.find(function(e){return e.rtpSender===n});if(!r)throw d("InvalidAccessError","Sender was not created by this connection.");var i=r.stream;r.rtpSender.stop(),r.rtpSender=null,r.track=null,r.stream=null,-1===this.transceivers.map(function(e){return e.stream}).indexOf(i)&&-1<this.localStreams.indexOf(i)&&this.localStreams.splice(this.localStreams.indexOf(i),1),this._maybeFireNegotiationNeeded()},u.prototype.removeStream=function(e){var n=this;e.getTracks().forEach(function(e){var r=n.getSenders().find(function(n){return n.track===e});r&&n.removeTrack(r)})},u.prototype.getSenders=function(){return this.transceivers.filter(function(e){return!!e.rtpSender}).map(function(e){return e.rtpSender})},u.prototype.getReceivers=function(){return this.transceivers.filter(function(e){return!!e.rtpReceiver}).map(function(e){return e.rtpReceiver})},u.prototype._createIceGatherer=function(n,r){var i=this;if(r&&0<n)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var o=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(o,"state",{value:"new",writable:!0}),this.transceivers[n].bufferedCandidateEvents=[],this.transceivers[n].bufferCandidates=function(e){o.state=e.candidate&&0!==Object.keys(e.candidate).length?"gathering":"completed",null!==i.transceivers[n].bufferedCandidateEvents&&i.transceivers[n].bufferedCandidateEvents.push(e)},o.addEventListener("localcandidate",this.transceivers[n].bufferCandidates),o},u.prototype._gather=function(n,r){var o=this,s=this.transceivers[r].iceGatherer;if(!s.onlocalcandidate){var a=this.transceivers[r].bufferedCandidateEvents;this.transceivers[r].bufferedCandidateEvents=null,s.removeEventListener("localcandidate",this.transceivers[r].bufferCandidates),s.onlocalcandidate=function(e){if(!(o.usingBundle&&0<r)){var a=new Event("icecandidate");a.candidate={sdpMid:n,sdpMLineIndex:r};var c=e.candidate,d=!c||0===Object.keys(c).length;if(d)"new"!==s.state&&"gathering"!==s.state||(s.state="completed");else{"new"===s.state&&(s.state="gathering"),c.component=1,c.ufrag=s.getLocalParameters().usernameFragment;var l=i.writeCandidate(c);a.candidate=Object.assign(a.candidate,i.parseCandidate(l)),a.candidate.candidate=l,a.candidate.toJSON=function(){return{candidate:a.candidate.candidate,sdpMid:a.candidate.sdpMid,sdpMLineIndex:a.candidate.sdpMLineIndex,usernameFragment:a.candidate.usernameFragment}}}var u=i.getMediaSections(o._localDescription.sdp);u[a.candidate.sdpMLineIndex]+=d?"a=end-of-candidates\r\n":"a="+a.candidate.candidate+"\r\n",o._localDescription.sdp=i.getDescription(o._localDescription.sdp)+u.join("");var f=o.transceivers.every(function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state});"gathering"!==o.iceGatheringState&&(o.iceGatheringState="gathering",o._emitGatheringStateChange()),d||o._dispatchEvent("icecandidate",a),f&&(o._dispatchEvent("icecandidate",new Event("icecandidate")),o.iceGatheringState="complete",o._emitGatheringStateChange())}},e.setTimeout(function(){a.forEach(function(e){s.onlocalcandidate(e)})},0)}},u.prototype._createIceAndDtlsTransports=function(){var n=this,r=new e.RTCIceTransport(null);r.onicestatechange=function(){n._updateIceConnectionState(),n._updateConnectionState()};var i=new e.RTCDtlsTransport(r);return i.ondtlsstatechange=function(){n._updateConnectionState()},i.onerror=function(){Object.defineProperty(i,"state",{value:"failed",writable:!0}),n._updateConnectionState()},{iceTransport:r,dtlsTransport:i}},u.prototype._disposeIceAndDtlsTransports=function(e){var n=this.transceivers[e].iceGatherer;n&&(delete n.onlocalcandidate,delete this.transceivers[e].iceGatherer);var r=this.transceivers[e].iceTransport;r&&(delete r.onicestatechange,delete this.transceivers[e].iceTransport);var i=this.transceivers[e].dtlsTransport;i&&(delete i.ondtlsstatechange,delete i.onerror,delete this.transceivers[e].dtlsTransport)},u.prototype._transceive=function(e,r,o){var a=s(e.localCapabilities,e.remoteCapabilities);r&&e.rtpSender&&(a.encodings=e.sendEncodingParameters,a.rtcp={cname:i.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(a.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(a)),o&&e.rtpReceiver&&0<a.codecs.length&&("video"===e.kind&&e.recvEncodingParameters&&n<15019&&e.recvEncodingParameters.forEach(function(e){delete e.rtx}),e.recvEncodingParameters.length?a.encodings=e.recvEncodingParameters:a.encodings=[{}],a.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(a.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(a.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(a))},u.prototype.setLocalDescription=function(e){var n,r,o=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(d("TypeError",'Unsupported type "'+e.type+'"'));if(!a("setLocalDescription",e.type,o.signalingState)||o._isClosed)return Promise.reject(d("InvalidStateError","Can not set local "+e.type+" in state "+o.signalingState));if("offer"===e.type)r=(n=i.splitSections(e.sdp)).shift(),n.forEach(function(e,n){var r=i.parseRtpParameters(e);o.transceivers[n].localCapabilities=r}),o.transceivers.forEach(function(e,n){o._gather(e.mid,n)});else if("answer"===e.type){r=(n=i.splitSections(o._remoteDescription.sdp)).shift();var c=0<i.matchPrefix(r,"a=ice-lite").length;n.forEach(function(e,n){var a=o.transceivers[n],d=a.iceGatherer,l=a.iceTransport,u=a.dtlsTransport,f=a.localCapabilities,p=a.remoteCapabilities;if(!(i.isRejected(e)&&0===i.matchPrefix(e,"a=bundle-only").length)&&!a.rejected){var h=i.getIceParameters(e,r),m=i.getDtlsParameters(e,r);c&&(m.role="server"),o.usingBundle&&0!==n||(o._gather(a.mid,n),"new"===l.state&&l.start(d,h,c?"controlling":"controlled"),"new"===u.state&&u.start(m));var v=s(f,p);o._transceive(a,0<v.codecs.length,!1)}})}return o._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?o._updateSignalingState("have-local-offer"):o._updateSignalingState("stable"),Promise.resolve()},u.prototype.setRemoteDescription=function(o){var u=this;if(-1===["offer","answer"].indexOf(o.type))return Promise.reject(d("TypeError",'Unsupported type "'+o.type+'"'));if(!a("setRemoteDescription",o.type,u.signalingState)||u._isClosed)return Promise.reject(d("InvalidStateError","Can not set remote "+o.type+" in state "+u.signalingState));var f={};u.remoteStreams.forEach(function(e){f[e.id]=e});var p=[],h=i.splitSections(o.sdp),m=h.shift(),v=0<i.matchPrefix(m,"a=ice-lite").length,g=0<i.matchPrefix(m,"a=group:BUNDLE ").length;u.usingBundle=g;var y=i.matchPrefix(m,"a=ice-options:")[0];return u.canTrickleIceCandidates=!!y&&0<=y.substr(14).split(" ").indexOf("trickle"),h.forEach(function(a,d){var l=i.splitLines(a),h=i.getKind(a),y=i.isRejected(a)&&0===i.matchPrefix(a,"a=bundle-only").length,b=l[0].substr(2).split(" ")[2],_=i.getDirection(a,m),w=i.parseMsid(a),S=i.getMid(a)||i.generateIdentifier();if(y||"application"===h&&("DTLS/SCTP"===b||"UDP/DTLS/SCTP"===b))u.transceivers[d]={mid:S,kind:h,protocol:b,rejected:!0};else{!y&&u.transceivers[d]&&u.transceivers[d].rejected&&(u.transceivers[d]=u._createTransceiver(h,!0));var R,T,C,x,E,O,I,k,M,P,j,A=i.parseRtpParameters(a);y||(P=i.getIceParameters(a,m),(j=i.getDtlsParameters(a,m)).role="client"),I=i.parseRtpEncodingParameters(a);var D=i.parseRtcpParameters(a),B=0<i.matchPrefix(a,"a=end-of-candidates",m).length,N=i.matchPrefix(a,"a=candidate:").map(function(e){return i.parseCandidate(e)}).filter(function(e){return 1===e.component});if(("offer"===o.type||"answer"===o.type)&&!y&&g&&0<d&&u.transceivers[d]&&(u._disposeIceAndDtlsTransports(d),u.transceivers[d].iceGatherer=u.transceivers[0].iceGatherer,u.transceivers[d].iceTransport=u.transceivers[0].iceTransport,u.transceivers[d].dtlsTransport=u.transceivers[0].dtlsTransport,u.transceivers[d].rtpSender&&u.transceivers[d].rtpSender.setTransport(u.transceivers[0].dtlsTransport),u.transceivers[d].rtpReceiver&&u.transceivers[d].rtpReceiver.setTransport(u.transceivers[0].dtlsTransport)),"offer"!==o.type||y)"answer"!==o.type||y||(T=(R=u.transceivers[d]).iceGatherer,C=R.iceTransport,x=R.dtlsTransport,E=R.rtpReceiver,O=R.sendEncodingParameters,k=R.localCapabilities,u.transceivers[d].recvEncodingParameters=I,u.transceivers[d].remoteCapabilities=A,u.transceivers[d].rtcpParameters=D,N.length&&"new"===C.state&&((v||B)&&(!g||0===d)?C.setRemoteCandidates(N):N.forEach(function(e){c(R.iceTransport,e)})),g&&0!==d||("new"===C.state&&C.start(T,P,"controlling"),"new"===x.state&&x.start(j)),!s(R.localCapabilities,R.remoteCapabilities).codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&R.sendEncodingParameters[0].rtx&&delete R.sendEncodingParameters[0].rtx,u._transceive(R,"sendrecv"===_||"recvonly"===_,"sendrecv"===_||"sendonly"===_),E&&("sendrecv"===_||"sendonly"===_)?(M=E.track,w?(f[w.stream]||(f[w.stream]=new e.MediaStream),r(M,f[w.stream]),p.push([M,E,f[w.stream]])):(f.default||(f.default=new e.MediaStream),r(M,f.default),p.push([M,E,f.default]))):delete R.rtpReceiver);else{(R=u.transceivers[d]||u._createTransceiver(h)).mid=S,R.iceGatherer||(R.iceGatherer=u._createIceGatherer(d,g)),N.length&&"new"===R.iceTransport.state&&(!B||g&&0!==d?N.forEach(function(e){c(R.iceTransport,e)}):R.iceTransport.setRemoteCandidates(N)),k=e.RTCRtpReceiver.getCapabilities(h),n<15019&&(k.codecs=k.codecs.filter(function(e){return"rtx"!==e.name})),O=R.sendEncodingParameters||[{ssrc:1001*(2*d+2)}];var L,U=!1;"sendrecv"===_||"sendonly"===_?(U=!R.rtpReceiver,E=R.rtpReceiver||new e.RTCRtpReceiver(R.dtlsTransport,h),U&&(M=E.track,w&&"-"===w.stream||(L=w?(f[w.stream]||(f[w.stream]=new e.MediaStream,Object.defineProperty(f[w.stream],"id",{get:function(){return w.stream}})),Object.defineProperty(M,"id",{get:function(){return w.track}}),f[w.stream]):(f.default||(f.default=new e.MediaStream),f.default)),L&&(r(M,L),R.associatedRemoteMediaStreams.push(L)),p.push([M,E,L]))):R.rtpReceiver&&R.rtpReceiver.track&&(R.associatedRemoteMediaStreams.forEach(function(n){var r=n.getTracks().find(function(e){return e.id===R.rtpReceiver.track.id});r&&(n.removeTrack(r),n.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:r})))}),R.associatedRemoteMediaStreams=[]),R.localCapabilities=k,R.remoteCapabilities=A,R.rtpReceiver=E,R.rtcpParameters=D,R.sendEncodingParameters=O,R.recvEncodingParameters=I,u._transceive(u.transceivers[d],!1,U)}}}),void 0===u._dtlsRole&&(u._dtlsRole="offer"===o.type?"active":"passive"),u._remoteDescription={type:o.type,sdp:o.sdp},"offer"===o.type?u._updateSignalingState("have-remote-offer"):u._updateSignalingState("stable"),Object.keys(f).forEach(function(n){var r=f[n];if(r.getTracks().length){if(-1===u.remoteStreams.indexOf(r)){u.remoteStreams.push(r);var i=new Event("addstream");i.stream=r,e.setTimeout(function(){u._dispatchEvent("addstream",i)})}p.forEach(function(e){var n=e[0],i=e[1];r.id===e[2].id&&l(u,n,i,[r])})}}),p.forEach(function(e){e[2]||l(u,e[0],e[1],[])}),e.setTimeout(function(){u&&u.transceivers&&u.transceivers.forEach(function(e){e.iceTransport&&"new"===e.iceTransport.state&&0<e.iceTransport.getRemoteCandidates().length&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},u.prototype.close=function(){this.transceivers.forEach(function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},u.prototype._updateSignalingState=function(e){this.signalingState=e;var n=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",n)},u.prototype._maybeFireNegotiationNeeded=function(){var n=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout(function(){if(n.needNegotiation){n.needNegotiation=!1;var e=new Event("negotiationneeded");n._dispatchEvent("negotiationneeded",e)}},0))},u.prototype._updateIceConnectionState=function(){var e,n={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(e){e.iceTransport&&!e.rejected&&n[e.iceTransport.state]++}),e="new",0<n.failed?e="failed":0<n.checking?e="checking":0<n.disconnected?e="disconnected":0<n.new?e="new":0<n.connected?e="connected":0<n.completed&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var r=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",r)}},u.prototype._updateConnectionState=function(){var e,n={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(n[e.iceTransport.state]++,n[e.dtlsTransport.state]++)}),n.connected+=n.completed,e="new",0<n.failed?e="failed":0<n.connecting?e="connecting":0<n.disconnected?e="disconnected":0<n.new?e="new":0<n.connected&&(e="connected"),e!==this.connectionState){this.connectionState=e;var r=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",r)}},u.prototype.createOffer=function(){var r=this;if(r._isClosed)return Promise.reject(d("InvalidStateError","Can not call createOffer after close"));var s=r.transceivers.filter(function(e){return"audio"===e.kind}).length,a=r.transceivers.filter(function(e){return"video"===e.kind}).length,c=arguments[0];if(c){if(c.mandatory||c.optional)throw TypeError("Legacy mandatory/optional constraints not supported.");void 0!==c.offerToReceiveAudio&&(s=!0===c.offerToReceiveAudio?1:!1===c.offerToReceiveAudio?0:c.offerToReceiveAudio),void 0!==c.offerToReceiveVideo&&(a=!0===c.offerToReceiveVideo?1:!1===c.offerToReceiveVideo?0:c.offerToReceiveVideo)}for(r.transceivers.forEach(function(e){"audio"===e.kind?--s<0&&(e.wantReceive=!1):"video"===e.kind&&--a<0&&(e.wantReceive=!1)});0<s||0<a;)0<s&&(r._createTransceiver("audio"),s--),0<a&&(r._createTransceiver("video"),a--);var l=i.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);return r.transceivers.forEach(function(o,s){var a=o.track,c=o.kind,d=o.mid||i.generateIdentifier();o.mid=d,o.iceGatherer||(o.iceGatherer=r._createIceGatherer(s,r.usingBundle));var l=e.RTCRtpSender.getCapabilities(c);n<15019&&(l.codecs=l.codecs.filter(function(e){return"rtx"!==e.name})),l.codecs.forEach(function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),o.remoteCapabilities&&o.remoteCapabilities.codecs&&o.remoteCapabilities.codecs.forEach(function(n){e.name.toLowerCase()===n.name.toLowerCase()&&e.clockRate===n.clockRate&&(e.preferredPayloadType=n.payloadType)})}),l.headerExtensions.forEach(function(e){(o.remoteCapabilities&&o.remoteCapabilities.headerExtensions||[]).forEach(function(n){e.uri===n.uri&&(e.id=n.id)})});var u=o.sendEncodingParameters||[{ssrc:1001*(2*s+1)}];a&&15019<=n&&"video"===c&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),o.wantReceive&&(o.rtpReceiver=new e.RTCRtpReceiver(o.dtlsTransport,c)),o.localCapabilities=l,o.sendEncodingParameters=u}),"max-compat"!==r._config.bundlePolicy&&(l+="a=group:BUNDLE "+r.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),l+="a=ice-options:trickle\r\n",r.transceivers.forEach(function(e,n){l+=o(e,e.localCapabilities,"offer",e.stream,r._dtlsRole),l+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===r.iceGatheringState||0!==n&&r.usingBundle||(e.iceGatherer.getLocalCandidates().forEach(function(e){e.component=1,l+="a="+i.writeCandidate(e)+"\r\n"}),"completed"===e.iceGatherer.state&&(l+="a=end-of-candidates\r\n"))}),Promise.resolve(new e.RTCSessionDescription({type:"offer",sdp:l}))},u.prototype.createAnswer=function(){var r=this;if(r._isClosed)return Promise.reject(d("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==r.signalingState&&"have-local-pranswer"!==r.signalingState)return Promise.reject(d("InvalidStateError","Can not call createAnswer in signalingState "+r.signalingState));var a=i.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.usingBundle&&(a+="a=group:BUNDLE "+r.transceivers.map(function(e){return e.mid}).join(" ")+"\r\n"),a+="a=ice-options:trickle\r\n";var c=i.getMediaSections(r._remoteDescription.sdp).length;return r.transceivers.forEach(function(e,i){if(!(c<i+1)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?a+="m=application 0 DTLS/SCTP 5000\r\n":a+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?a+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(a+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(a+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");e.stream&&("audio"===e.kind?d=e.stream.getAudioTracks()[0]:"video"===e.kind&&(d=e.stream.getVideoTracks()[0]),d&&15019<=n&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1}));var d,l=s(e.localCapabilities,e.remoteCapabilities);!l.codecs.filter(function(e){return"rtx"===e.name.toLowerCase()}).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,a+=o(e,l,"answer",e.stream,r._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(a+="a=rtcp-rsize\r\n")}}),Promise.resolve(new e.RTCSessionDescription({type:"answer",sdp:a}))},u.prototype.addIceCandidate=function(e){var n,r=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(TypeError("sdpMLineIndex or sdpMid required")):new Promise(function(o,s){if(!r._remoteDescription)return s(d("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var a=e.sdpMLineIndex;if(e.sdpMid){for(var l=0;l<r.transceivers.length;l++)if(r.transceivers[l].mid===e.sdpMid){a=l;break}}var u=r.transceivers[a];if(!u)return s(d("OperationError","Can not add ICE candidate"));if(u.rejected)return o();var f=0<Object.keys(e.candidate).length?i.parseCandidate(e.candidate):{};if("tcp"===f.protocol&&(0===f.port||9===f.port)||f.component&&1!==f.component)return o();if((0===a||0<a&&u.iceTransport!==r.transceivers[0].iceTransport)&&!c(u.iceTransport,f))return s(d("OperationError","Can not add ICE candidate"));var p=e.candidate.trim();0===p.indexOf("a=")&&(p=p.substr(2)),(n=i.getMediaSections(r._remoteDescription.sdp))[a]+="a="+(f.type?p:"end-of-candidates")+"\r\n",r._remoteDescription.sdp=i.getDescription(r._remoteDescription.sdp)+n.join("")}else for(var h=0;h<r.transceivers.length&&(r.transceivers[h].rejected||(r.transceivers[h].iceTransport.addRemoteCandidate({}),(n=i.getMediaSections(r._remoteDescription.sdp))[h]+="a=end-of-candidates\r\n",r._remoteDescription.sdp=i.getDescription(r._remoteDescription.sdp)+n.join(""),!r.usingBundle));h++);o()})},u.prototype.getStats=function(n){if(n&&n instanceof e.MediaStreamTrack){var r=null;if(this.transceivers.forEach(function(e){e.rtpSender&&e.rtpSender.track===n?r=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===n&&(r=e.rtpReceiver)}),!r)throw d("InvalidAccessError","Invalid selector.");return r.getStats()}var i=[];return this.transceivers.forEach(function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach(function(n){e[n]&&i.push(e[n].getStats())})}),Promise.all(i).then(function(e){var n=new Map;return e.forEach(function(e){e.forEach(function(e){n.set(e.id,e)})}),n})},["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach(function(n){var r=e[n];if(r&&r.prototype&&r.prototype.getStats){var i=r.prototype.getStats;r.prototype.getStats=function(){return i.apply(this).then(function(e){var n=new Map;return Object.keys(e).forEach(function(r){var i;e[r].type=({inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"})[(i=e[r]).type]||i.type,n.set(r,e[r])}),n})}}});var f=["createOffer","createAnswer"];return f.forEach(function(e){var n=u.prototype[e];u.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?n.apply(this,[arguments[2]]).then(function(n){"function"==typeof e[0]&&e[0].apply(null,[n])},function(n){"function"==typeof e[1]&&e[1].apply(null,[n])}):n.apply(this,arguments)}}),(f=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach(function(e){var n=u.prototype[e];u.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?n.apply(this,arguments).then(function(){"function"==typeof e[1]&&e[1].apply(null)},function(n){"function"==typeof e[2]&&e[2].apply(null,[n])}):n.apply(this,arguments)}}),["getStats"].forEach(function(e){var n=u.prototype[e];u.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?n.apply(this,arguments).then(function(){"function"==typeof e[1]&&e[1].apply(null)}):n.apply(this,arguments)}}),u}},{sdp:17}],17:[function(e,n,r){"use strict";var i={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};i.localCName=i.generateIdentifier(),i.splitLines=function(e){return e.trim().split("\n").map(function(e){return e.trim()})},i.splitSections=function(e){return e.split("\nm=").map(function(e,n){return(0<n?"m="+e:e).trim()+"\r\n"})},i.getDescription=function(e){var n=i.splitSections(e);return n&&n[0]},i.getMediaSections=function(e){var n=i.splitSections(e);return n.shift(),n},i.matchPrefix=function(e,n){return i.splitLines(e).filter(function(e){return 0===e.indexOf(n)})},i.parseCandidate=function(e){for(var n,r={foundation:(n=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(n[1],10),protocol:n[2].toLowerCase(),priority:parseInt(n[3],10),ip:n[4],address:n[4],port:parseInt(n[5],10),type:n[7]},i=8;i<n.length;i+=2)switch(n[i]){case"raddr":r.relatedAddress=n[i+1];break;case"rport":r.relatedPort=parseInt(n[i+1],10);break;case"tcptype":r.tcpType=n[i+1];break;case"ufrag":r.ufrag=n[i+1],r.usernameFragment=n[i+1];break;default:r[n[i]]=n[i+1]}return r},i.writeCandidate=function(e){var n=[];n.push(e.foundation),n.push(e.component),n.push(e.protocol.toUpperCase()),n.push(e.priority),n.push(e.address||e.ip),n.push(e.port);var r=e.type;return n.push("typ"),n.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(n.push("raddr"),n.push(e.relatedAddress),n.push("rport"),n.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(n.push("tcptype"),n.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(n.push("ufrag"),n.push(e.usernameFragment||e.ufrag)),"candidate:"+n.join(" ")},i.parseIceOptions=function(e){return e.substr(14).split(" ")},i.parseRtpMap=function(e){var n=e.substr(9).split(" "),r={payloadType:parseInt(n.shift(),10)};return r.name=(n=n[0].split("/"))[0],r.clockRate=parseInt(n[1],10),r.channels=3===n.length?parseInt(n[2],10):1,r.numChannels=r.channels,r},i.writeRtpMap=function(e){var n=e.payloadType;void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+n+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},i.parseExtmap=function(e){var n=e.substr(9).split(" ");return{id:parseInt(n[0],10),direction:0<n[0].indexOf("/")?n[0].split("/")[1]:"sendrecv",uri:n[1]}},i.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},i.parseFmtp=function(e){for(var n,r={},i=e.substr(e.indexOf(" ")+1).split(";"),o=0;o<i.length;o++)r[(n=i[o].trim().split("="))[0].trim()]=n[1];return r},i.writeFmtp=function(e){var n="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var i=[];Object.keys(e.parameters).forEach(function(n){e.parameters[n]?i.push(n+"="+e.parameters[n]):i.push(n)}),n+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return n},i.parseRtcpFb=function(e){var n=e.substr(e.indexOf(" ")+1).split(" ");return{type:n.shift(),parameter:n.join(" ")}},i.writeRtcpFb=function(e){var n="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(function(e){n+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),n},i.parseSsrcMedia=function(e){var n=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,n-7),10)},i=e.indexOf(":",n);return -1<i?(r.attribute=e.substr(n+1,i-n-1),r.value=e.substr(i+1)):r.attribute=e.substr(n+1),r},i.parseSsrcGroup=function(e){var n=e.substr(13).split(" ");return{semantics:n.shift(),ssrcs:n.map(function(e){return parseInt(e,10)})}},i.getMid=function(e){var n=i.matchPrefix(e,"a=mid:")[0];if(n)return n.substr(6)},i.parseFingerprint=function(e){var n=e.substr(14).split(" ");return{algorithm:n[0].toLowerCase(),value:n[1]}},i.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:i.matchPrefix(e+n,"a=fingerprint:").map(i.parseFingerprint)}},i.writeDtlsParameters=function(e,n){var r="a=setup:"+n+"\r\n";return e.fingerprints.forEach(function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),r},i.getIceParameters=function(e,n){var r=i.splitLines(e);return{usernameFragment:(r=r.concat(i.splitLines(n))).filter(function(e){return 0===e.indexOf("a=ice-ufrag:")})[0].substr(12),password:r.filter(function(e){return 0===e.indexOf("a=ice-pwd:")})[0].substr(10)}},i.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},i.parseRtpParameters=function(e){for(var n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=i.splitLines(e)[0].split(" "),o=3;o<r.length;o++){var s=r[o],a=i.matchPrefix(e,"a=rtpmap:"+s+" ")[0];if(a){var c=i.parseRtpMap(a),d=i.matchPrefix(e,"a=fmtp:"+s+" ");switch(c.parameters=d.length?i.parseFmtp(d[0]):{},c.rtcpFeedback=i.matchPrefix(e,"a=rtcp-fb:"+s+" ").map(i.parseRtcpFb),n.codecs.push(c),c.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(c.name.toUpperCase())}}}return i.matchPrefix(e,"a=extmap:").forEach(function(e){n.headerExtensions.push(i.parseExtmap(e))}),n},i.writeRtpDescription=function(e,n){var r="";r+="m="+e+" ",r+=0<n.codecs.length?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=n.codecs.map(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType}).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach(function(e){r+=i.writeRtpMap(e),r+=i.writeFmtp(e),r+=i.writeRtcpFb(e)});var o=0;return n.codecs.forEach(function(e){e.maxptime>o&&(o=e.maxptime)}),0<o&&(r+="a=maxptime:"+o+"\r\n"),r+="a=rtcp-mux\r\n",n.headerExtensions&&n.headerExtensions.forEach(function(e){r+=i.writeExtmap(e)}),r},i.parseRtpEncodingParameters=function(e){var n,r=[],o=i.parseRtpParameters(e),s=-1!==o.fecMechanisms.indexOf("RED"),a=-1!==o.fecMechanisms.indexOf("ULPFEC"),c=i.matchPrefix(e,"a=ssrc:").map(function(e){return i.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute}),d=0<c.length&&c[0].ssrc,l=i.matchPrefix(e,"a=ssrc-group:FID").map(function(e){return e.substr(17).split(" ").map(function(e){return parseInt(e,10)})});0<l.length&&1<l[0].length&&l[0][0]===d&&(n=l[0][1]),o.codecs.forEach(function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var i={ssrc:d,codecPayloadType:parseInt(e.parameters.apt,10)};d&&n&&(i.rtx={ssrc:n}),r.push(i),s&&((i=JSON.parse(JSON.stringify(i))).fec={ssrc:d,mechanism:a?"red+ulpfec":"red"},r.push(i))}}),0===r.length&&d&&r.push({ssrc:d});var u=i.matchPrefix(e,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substr(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substr(5),10)*.95-16e3:void 0,r.forEach(function(e){e.maxBitrate=u})),r},i.parseRtcpParameters=function(e){var n={},r=i.matchPrefix(e,"a=ssrc:").map(function(e){return i.parseSsrcMedia(e)}).filter(function(e){return"cname"===e.attribute})[0];r&&(n.cname=r.value,n.ssrc=r.ssrc);var o=i.matchPrefix(e,"a=rtcp-rsize");return n.reducedSize=0<o.length,n.compound=0===o.length,n.mux=0<i.matchPrefix(e,"a=rtcp-mux").length,n},i.parseMsid=function(e){var n,r=i.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(n=r[0].substr(7).split(" "))[0],track:n[1]};var o=i.matchPrefix(e,"a=ssrc:").map(function(e){return i.parseSsrcMedia(e)}).filter(function(e){return"msid"===e.attribute});return 0<o.length?{stream:(n=o[0].value.split(" "))[0],track:n[1]}:void 0},i.parseSctpDescription=function(e){var n,r=i.parseMLine(e),o=i.matchPrefix(e,"a=max-message-size:");0<o.length&&(n=parseInt(o[0].substr(19),10)),isNaN(n)&&(n=65536);var s=i.matchPrefix(e,"a=sctp-port:");if(0<s.length)return{port:parseInt(s[0].substr(12),10),protocol:r.fmt,maxMessageSize:n};if(0<i.matchPrefix(e,"a=sctpmap:").length){var a=i.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(a[0],10),protocol:a[1],maxMessageSize:n}}},i.writeSctpDescription=function(e,n){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+n.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+n.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+n.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+n.port+" "+n.protocol+" 65535\r\n"],void 0!==n.maxMessageSize&&r.push("a=max-message-size:"+n.maxMessageSize+"\r\n"),r.join("")},i.generateSessionId=function(){return Math.random().toString().substr(2,21)},i.writeSessionBoilerplate=function(e,n,r){return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||i.generateSessionId())+" "+(void 0!==n?n:2)+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},i.writeMediaSection=function(e,n,r,o){var s=i.writeRtpDescription(e.kind,n);if(s+=i.writeIceParameters(e.iceGatherer.getLocalParameters()),s+=i.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":"active"),s+="a=mid:"+e.mid+"\r\n",e.direction?s+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?s+="a=sendrecv\r\n":e.rtpSender?s+="a=sendonly\r\n":e.rtpReceiver?s+="a=recvonly\r\n":s+="a=inactive\r\n",e.rtpSender){var a="msid:"+o.id+" "+e.rtpSender.track.id+"\r\n";s+="a="+a,s+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,s+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return s+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+i.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+i.localCName+"\r\n"),s},i.getDirection=function(e,n){for(var r=i.splitLines(e),o=0;o<r.length;o++)switch(r[o]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[o].substr(2)}return n?i.getDirection(n):"sendrecv"},i.getKind=function(e){return i.splitLines(e)[0].split(" ")[0].substr(2)},i.isRejected=function(e){return"0"===e.split(" ",2)[1]},i.parseMLine=function(e){var n=i.splitLines(e)[0].substr(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},i.parseOLine=function(e){var n=i.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},i.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var n=i.splitLines(e),r=0;r<n.length;r++)if(n[r].length<2||"="!==n[r].charAt(1))return!1;return!0},"object"==typeof n&&(n.exports=i)},{}]},{},[1])(1)})(),window.adapter=i(),o=function(){"use strict";function e(e,n){var r,i=document.createElement(e||"div");for(r in n)i[r]=n[r];return i}function n(e){for(var n=1,r=arguments.length;r>n;n++)e.appendChild(arguments[n]);return e}function r(e,n){var r,i,o=e.style;if(void 0!==o[n=n.charAt(0).toUpperCase()+n.slice(1)])return n;for(i=0;i<l.length;i++)if(void 0!==o[r=l[i]+n])return r}function i(e,n){for(var i in n)e.style[r(e,i)||i]=n[i];return e}function o(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)void 0===e[i]&&(e[i]=r[i])}return e}function s(e,n){return"string"==typeof e?e:e[n%e.length]}function a(e){this.opts=o(e||{},a.defaults,f)}var c,d,l=["webkit","Moz","ms","O"],u={},f={lines:12,length:7,width:5,radius:10,scale:1,corners:1,color:"#000",opacity:.25,rotate:0,direction:1,speed:1,trail:100,fps:20,zIndex:2e9,className:"spinner",top:"50%",left:"50%",shadow:!1,hwaccel:!1,position:"absolute"};if(a.defaults={},o(a.prototype,{spin:function(n){this.stop();var r=this,o=r.opts,s=r.el=e(null,{className:o.className});if(i(s,{position:o.position,width:0,zIndex:o.zIndex,left:o.left,top:o.top}),n&&n.insertBefore(s,n.firstChild||null),s.setAttribute("role","progressbar"),r.lines(s,r.opts),!c){var a,d=0,l=(o.lines-1)*(1-o.direction)/2,u=o.fps,f=u/o.speed,p=(1-o.opacity)/(f*o.trail/100),h=f/o.lines;!function e(){d++;for(var n=0;n<o.lines;n++)a=Math.max(1-(d+(o.lines-n)*h)%f*p,o.opacity),r.opacity(s,n*o.direction+l,a,o);r.timeout=r.el&&setTimeout(e,~~(1e3/u))}()}return r},stop:function(){var e=this.el;return e&&(clearTimeout(this.timeout),e.parentNode&&e.parentNode.removeChild(e),this.el=void 0),this},lines:function(r,o){function a(n,r){return i(e(),{position:"absolute",width:o.scale*(o.length+o.width)+"px",height:o.scale*o.width+"px",background:n,boxShadow:r,transformOrigin:"left",transform:"rotate("+~~(360/o.lines*f+o.rotate)+"deg) translate("+o.scale*o.radius+"px,0)",borderRadius:(o.corners*o.scale*o.width>>1)+"px"})}for(var l,f=0,p=(o.lines-1)*(1-o.direction)/2;f<o.lines;f++)l=i(e(),{position:"absolute",top:1+~(o.scale*o.width/2)+"px",transform:o.hwaccel?"translate3d(0,0,0)":"",opacity:o.opacity,animation:c&&function(e,n,r,i){var o=["opacity",n,~~(100*e),r,i].join("-"),s=.01+r/i*100,a=Math.max(1-(1-e)/n*(100-s),e),l=c.substring(0,c.indexOf("Animation")).toLowerCase();return u[o]||(d.insertRule("@"+(l&&"-"+l+"-"||"")+"keyframes "+o+"{0%{opacity:"+a+"}"+s+"%{opacity:"+e+"}"+(s+.01)+"%{opacity:1}"+(s+n)%100+"%{opacity:"+e+"}100%{opacity:"+a+"}}",d.cssRules.length),u[o]=1),o}(o.opacity,o.trail,p+f*o.direction,o.lines)+" "+1/o.speed+"s linear infinite"}),o.shadow&&n(l,i(a("#000","0 0 4px #000"),{top:"2px"})),n(r,n(l,a(s(o.color,f),"0 0 1px rgba(0,0,0,.1)")));return r},opacity:function(e,n,r){n<e.childNodes.length&&(e.childNodes[n].style.opacity=r)}}),"undefined"!=typeof document){p=e("style",{type:"text/css"}),n(document.getElementsByTagName("head")[0],p),d=p.sheet||p.styleSheet;var p,h=i(e("group"),{behavior:"url(#default#VML)"});!r(h,"transform")&&h.adj?function(){function r(n,r){return e("<"+n+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',r)}d.addRule(".spin-vml","behavior:url(#default#VML)"),a.prototype.lines=function(e,o){function a(){return i(r("group",{coordsize:u+" "+u,coordorigin:-l+" "+-l}),{width:u,height:u})}function c(e,c,d){n(p,n(i(a(),{rotation:360/o.lines*e+"deg",left:~~c}),n(i(r("roundrect",{arcsize:o.corners}),{width:l,height:o.scale*o.width,left:o.scale*o.radius,top:-o.scale*o.width>>1,filter:d}),r("fill",{color:s(o.color,e),opacity:o.opacity}),r("stroke",{opacity:0}))))}var d,l=o.scale*(o.length+o.width),u=2*o.scale*l,f=-(o.width+o.length)*o.scale*2+"px",p=i(a(),{position:"absolute",top:f,left:f});if(o.shadow)for(d=1;d<=o.lines;d++)c(d,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(d=1;d<=o.lines;d++)c(d);return n(e,p)},a.prototype.opacity=function(e,n,r,i){var o=e.firstChild;i=i.shadow&&i.lines||0,o&&n+i<o.childNodes.length&&(o=(o=(o=o.childNodes[n+i])&&o.firstChild)&&o.firstChild)&&(o.opacity=r)}}():c=r(h,"animation")}return a},e.exports?(e.exports=o(),window.Spinner=o()):"function"==typeof define&&define.amd?define(o):this.Spinner=o();var i,o,s=[function(e,n){function r(e,n){pluginHandle.consentDialog(!1),e?callbacks.error(e):streamsDone(handleId,jsep,media,callbacks,n)}function i(e,n,r){s.log("Adding media constraint (screen capture)"),s.debug(e),navigator.mediaDevices.getUserMedia(e).then(function(e){r?navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(r){e.addTrack(r.getAudioTracks()[0]),n(null,e)}):n(null,e)}).catch(function(e){pluginHandle.consentDialog(!1),n(e)})}s.sessions={},s.isExtensionEnabled=function(){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;if(window.navigator.userAgent.match("Chrome")){var e=parseInt(window.navigator.userAgent.match(/Chrome\/(.*) /)[1],10),n=33;return window.navigator.userAgent.match("Linux")&&(n=35),e>=26&&e<=n||s.extension.isInstalled()}return!0};var o={extensionId:"hapfgfdkleiggjjpfpenajgdnfckjpaj",isInstalled:function(){return null!==document.querySelector("#janus-extension-installed")},getScreen:function(e){var n=window.setTimeout(function(){let n=Error("NavigatorUserMediaError");return n.name='The required Chrome extension is not installed: click <a href="#">here</a> to install it. (NOTE: this will need you to refresh the page)',e(n)},1e3);this.cache[n]=e,window.postMessage({type:"janusGetScreen",id:n},"*")},init:function(){var e={};this.cache=e,window.addEventListener("message",function(n){if(n.origin==window.location.origin)if("janusGotScreen"==n.data.type&&e[n.data.id]){var r=e[n.data.id];if(delete e[n.data.id],""===n.data.sourceId){var i=Error("NavigatorUserMediaError");i.name="You cancelled the request for permission, giving up...",r(i)}else r(null,n.data.sourceId)}else"janusGetScreenPending"==n.data.type&&(console.log("clearing ",n.data.id),window.clearTimeout(n.data.id))})}};function s(e){let n;if(void 0===s.initDone)return e.error("Library not initialized"),{};if(!s.isWebrtcSupported())return e.error("WebRTC not supported by this browser"),{};if(s.log("Library initialized: "+s.initDone),(e=e||{}).success="function"==typeof e.success?e.success:s.noop,e.error="function"==typeof e.error?e.error:s.noop,e.destroyed="function"==typeof e.destroyed?e.destroyed:s.noop,e.onmessage="function"==typeof e.onmessage?e.onmessage:s.noop,e.onuserevent="function"==typeof e.onuserevent?e.onuserevent:s.noop,e.onsessionevent="function"==typeof e.onsessionevent?e.onsessionevent:s.noop,e.onsetup="function"==typeof e.onsetup?e.onsetup:s.noop,null===e.server||void 0===e.server)return e.error("Invalid server url"),{};var o=!1,a=null,c={},d=null,l=null,u=0,f=e.server;s.isArray(f)?(s.log("Multiple servers provided ("+f.length+"), will use the first that works"),f=null,l=e.server,s.debug(l)):0===f.indexOf("ws")?(o=!0,s.log("Using WebSockets to contact Janus: "+f)):(o=!1,s.log("Using REST API to contact Janus: "+f));var p=e.iceServers,h=e.iceTransportPolicy,m=e.bundlePolicy,v=e.ipv6;null==v&&(v=!1);var g=!1;void 0!==e.withCredentials&&null!==e.withCredentials&&(g=!0===e.withCredentials);var y=10;void 0!==e.max_poll_events&&null!==e.max_poll_events&&(y=e.max_poll_events),y<1&&(y=1);var b=null;void 0!==e.token&&null!==e.token&&(b=e.token);var _=null;void 0!==e.apisecret&&null!==e.apisecret&&(_=e.apisecret),this.destroyOnUnload=!0,void 0!==e.destroyOnUnload&&null!==e.destroyOnUnload&&(this.destroyOnUnload=!0===e.destroyOnUnload);var w=25e3;void 0!==e.keepAlivePeriod&&null!==e.keepAlivePeriod&&(w=e.keepAlivePeriod),isNaN(w)&&(w=25e3);var S=6e4;void 0!==e.longPollTimeout&&null!==e.longPollTimeout&&(S=e.longPollTimeout),isNaN(S)&&(S=6e4);var R=!1,T=null,C="",x=0,E={},O=this,I=0,k={},M="brtc_v0",P=e.userid,j="janus",A="janus-protocol";function D(){if(null!=T)if(s.debug("Long poll..."),R){var n=f+"/"+T+"?rid="+(new Date).getTime();null!=y&&(n=n+"&maxev="+y),null!=b&&(n=n+"&token="+encodeURIComponent(b)),null!=_&&(n=n+"&apisecret="+encodeURIComponent(_)),s.httpAPICall(n,{verb:"GET",withCredentials:g,success:B,timeout:S,error:function(n,r){(s.error(n+":",r),++I>3)?(R=!1,e.error("Lost connection to the server (is it down?)")):D()}})}else s.warn("Is the server down? (connected=false)")}function B(n,r){if(I=0,o||null==T||!0===r||D(),o||!s.isArray(n))if("keepalive"!==n[j])if("ack"!==n[j])if("success"!==n[j])if("bdcrender"!==n[j])if("trickle"===n[j]){if(null==(p=n.sender))return void s.warn("Missing sender...");if(null==(h=E[p]))return void s.debug("This handle is not attached to this session");var i,c,d=n.candidate;s.debug("Got a trickled candidate on session "+T),s.debug(d);var l=h.webrtcStuff;l.pc&&l.remoteSdp?(s.debug("Adding remote candidate:",d),d&&!0!==d.completed?l.pc.addIceCandidate(d):l.pc.addIceCandidate()):(s.debug("We didn't do setRemoteDescription (trickle got here before the offer?), caching candidate"),l.candidates||(l.candidates=[]),l.candidates.push(d),s.debug(l.candidates))}else{if("webrtcup"===n[j])return s.debug("Got a webrtcup event on session "+T),s.debug(n),null==(p=n.sender)?void s.warn("Missing sender..."):null==(h=E[p])?void s.debug("This handle is not attached to this session"):void h.webrtcState(!0);if("hangup"===n[j]){if(s.debug("Got a hangup event on session "+T),s.debug(n),null==(p=n.sender))return void s.warn("Missing sender...");if(null==(h=E[p]))return void s.debug("This handle is not attached to this session");h.webrtcState(!1,n.reason),h.hangup()}else if("detached"===n[j]){if(s.debug("Got a detached event on session "+T),s.debug(n),null==(p=n.sender))return void s.warn("Missing sender...");if(null==(h=E[p]))return;h.detached=!0,h.ondetached(),h.detach()}else if("media"===n[j]){if(s.debug("Got a media event on session "+T),s.debug(n),null==(p=n.sender))return void s.warn("Missing sender...");if(null==(h=E[p]))return void s.debug("This handle is not attached to this session");h.mediaState(n.type,n.receiving||n.sending)}else if("slowlink"===n[j]){if(s.debug("Got a slowlink event on session "+T),s.debug(n),null==(p=n.sender))return void s.warn("Missing sender...");if(null==(h=E[p]))return void s.debug("This handle is not attached to this session");h.slowLink(n.uplink,n.nacks)}else{if("error"===n[j]){s.error("Ooops: "+n.error.code+" "+n.error.reason),"brtc_v0"!==M&&e.error("ServerErrorEvent: code:"+n.error.code+", reason:"+n.error.reason,n.error.code,n.error.reason),s.debug(n),null!=(i=n.transaction)&&(null!=(c=k[i])&&c(n),delete k[i]);return}if("event"===n[j]){if(s.debug("Got a plugin event on session "+T),s.debug(n),null==(p=n.sender)){var u,f=n.recvdata;return null!=f?void s.sessions[T].onmessage(f):null!=n.detached?void s.sessions[T].onuserevent(n):void s.warn("Missing sender...")}if(null==(u=n.plugindata))return void s.warn("Missing plugindata...");s.debug(" -- Event is coming from "+p+" ("+u.plugin+")");var p,h,m=u.data;if(s.debug(m),null==(h=E[p]))return void s.warn("This handle is not attached to this session");var v=n.jsep;null!=v&&(s.debug("Handling SDP as well..."),s.debug(v));var g=h.onmessage;null!=g?(s.debug("Notifying application..."),g(m,v)):s.debug("No provided notification callback")}else{if("timeout"===n[j])return s.error("Timeout on session "+T),s.debug(n),void(o&&a.close(3504,"Gateway timeout"));if("userevent"===n[j])return null==(u=n.plugindata)?void s.warn("Missing plugindata..."):null==(m=u.data)?void s.warn("Missing plugindata['data']..."):n.plugindata?void s.sessions[T].onuserevent(m):void 0;if("sessionevent"===n[j])return void(s.sessions[T]&&s.sessions[T].onsessionevent(n));if("setuped"===n[j]||"brtc_joined"===n[j]){s.debug("Got a setuped/brtc_joined"),s.debug(n),null!=(i=n.transaction)&&(null!=(c=k[i])&&c(n),delete k[i]);return}s.warn("Unknown message/event '"+n[j]+"' on session "+T),s.debug(n)}}}else{if(s.debug("Got a bdcrender on session "+T),s.debug(n),null!=(i=n.transaction)&&"string"==typeof n.status&&(null!=(c=k[i])&&c(n),c))return void delete k[i];"event"===n.action&&s.sessions[T].onbdcrevent(n)}else s.debug("Got a success on session "+T),s.debug(n),null!=(i=n.transaction)&&(null!=(c=k[i])&&c(n),delete k[i]);else s.debug("Got an ack on session "+T),s.debug(n),null!=(i=n.transaction)&&(null!=(c=k[i])&&c(n),delete k[i]);else s.vdebug("Got a keepalive on session "+T);else for(var y=0;y<n.length;y++)B(n[y],!0)}function N(){if(null!==f&&o&&R){d=setTimeout(N,w);var e={[j]:"keepalive",session_id:T,transaction:s.randomString(12),ts:(new Date).toLocaleString()};null!=b&&(e.token=b),null!=_&&(e.apisecret=_),a.send(JSON.stringify(e))}}function L(n){var r=s.randomString(12),i={[j]:"create",transaction:r};if(void 0!==n.mediaserverip&&null!==n.mediaserverip&&(i.janusIp=n.mediaserverip),void 0!==n.sdktag&&null!==n.sdktag&&(i.sdktag=n.sdktag),i.uri=f.split("?")[0],void 0!==n.userevent&&!1!==n.userevent&&(i.userevent=n.userevent),void 0!==n.sessionevent&&!1!==n.sessionevent&&(i.sessionevent=n.sessionevent),"boolean"==typeof n.rigidpull&&n.rigidpull&&(i.rigidPull=n.rigidpull),n.reconnect&&(R=!1,i[j]="claim",i.session_id=T,a&&(a.onopen=null,a.onerror=null,a.onclose=null,d&&(clearTimeout(d),d=null))),null!=b&&(i.token=b),null!=_&&(i.apisecret=_),null===f&&s.isArray(l)&&(0===(f=l[u]).indexOf("ws")?(o=!0,s.log("Server #"+(u+1)+": trying WebSockets to contact Janus ("+f+")")):(o=!1,s.log("Server #"+(u+1)+": trying REST API to contact Janus ("+f+")"))),o)for(var p in a=s.newWebSocket(f,A),c={error:function(){(s.error("Error connecting to the Janus WebSockets server... "+f),s.isArray(l)&&!n.reconnect)?++u==l.length?n.error("Error connecting to any of the provided Janus servers: Is the server down?"):(f=null,setTimeout(function(){L(n)},200)):n.error("Error connecting to the Janus WebSockets server: Is the server down?")},open:function(){k[r]=function(e){(s.debug(e),"success"!==e[j])?(s.error("Ooops: "+e.error.code+" "+e.error.reason),n.error(e.error.reason)):(d=setTimeout(N,w),R=!0,T=e.session_id?e.session_id:e.data.id,e.data.uid&&e.data.roomName&&(C=e.data.roomName,x=e.data.uid),n.reconnect?s.log("Claimed session: "+T):s.log("Created session: "+T),s.sessions[T]=O,e.data.version&&(M=e.data.version),n.success(e.data))},a.send(JSON.stringify(i))},message:function(e){B(JSON.parse(e.data))},close:function(){null!==f&&R&&(R=!1,e.error("Lost connection to the server (is it down?)"))}})a.addEventListener(p,c[p]);else s.httpAPICall(f,{verb:"POST",withCredentials:g,body:i,success:function(e){(s.debug(e),"success"!==e[j])?(s.error("Ooops: "+e.error.code+" "+e.error.reason),n.error(e.error.reason)):(R=!0,T=e.session_id?e.session_id:e.data.id,n.reconnect?s.log("Claimed session: "+T):s.log("Created session: "+T),s.sessions[T]=O,D(),n.success())},error:function(e,r){(s.error(e+":",r),s.isArray(l)&&!n.reconnect)?++u==l.length?n.error("Error connecting to any of the provided Janus servers: Is the server down?"):(f=null,setTimeout(function(){L(n)},200)):""===r?n.error(e+": Is the server down?"):n.error(e+": "+r)}})}function U(e,r,i,o,a){if(s.debug(r),"success"!==r[j]&&"setuped"!==r[j])return s.error("Ooops: "+r.error.code+" "+r.error.reason),void e.error("Ooops: "+r.error.code+" "+r.error.reason);"success"===r[j]?c=r.data.id:"setuped"===r[j]&&(c=r.data.handle_id),s.log("Created handle: "+c);var c,d={session:O,plugin:i,id:c,token:o,detached:!1,webrtcStuff:{started:!1,myStream:null,streamExternal:!1,remoteStream:null,mySdp:null,mediaConstraints:null,pc:null,outerpc:a,dataChannel:{},dtmfSender:null,trickle:!0,iceDone:!1,volume:{value:null,timer:null},bitrate:{value:null,bsnow:null,bsbefore:null,tsnow:null,tsbefore:null,timer:null},fps:{value:null,fsnow:null,fsbefore:null,tsnow:null,tsbefore:null,timer:null},stats:null},getId:function(){return c},getPlugin:function(){return i},getVolume:function(){return K(c,!0)},getRemoteVolume:function(){return K(c,!0)},getLocalVolume:function(){return K(c,!1)},isAudioMuted:function(){return Y(c,!1)},muteAudio:function(){return Q(c,!1,!0)},unmuteAudio:function(){return Q(c,!1,!1)},isVideoMuted:function(){return Y(c,!0)},muteVideo:function(){return Q(c,!0,!0)},unmuteVideo:function(){return Q(c,!0,!1)},getBitrate:function(){return Z(c)},getFps:function(){var e=E[c];if(null==e||null===e.webrtcStuff||void 0===e.webrtcStuff)return s.warn("Invalid handle"),0;var n=e.webrtcStuff;return null===n.pc||void 0===n.pc?0:n.pc.getStats?null===n.fps.timer||void 0===n.fps.timer?(s.log("Starting framerate timer (via getStats)"),n.fps.timer=setInterval(function(){n.pc.getStats().then(function(e){e.forEach(function(e){if(e){var r=!1;if(("video"===e.mediaType||e.id.toLowerCase().indexOf("video")>-1)&&"inbound-rtp"===e.type&&0>e.id.indexOf("rtcp")?r=!0:"ssrc"==e.type&&e.framesReceived&&("VP8"===e.googCodecName||""===e.googCodecName)&&(r=!0),r)if(n.fps.fsnow=e.framesDecoded,n.fps.tsnow=e.timestamp,null===n.fps.bsbefore||null===n.fps.tsbefore)n.fps.fsbefore=n.fps.fsnow,n.fps.tsbefore=n.fps.tsnow;else{var i=n.fps.tsnow-n.fps.tsbefore;"safari"==s.webRTCAdapter.browserDetails.browser&&(i/=1e3);var o=Math.round(1e3*(n.fps.fsnow-n.fps.fsbefore)/i);"safari"===s.webRTCAdapter.browserDetails.browser&&(o=parseInt(o/1e3)),n.fps.value=o,n.fps.fsbefore=n.fps.fsnow,n.fps.tsbefore=n.fps.tsnow}}})})},1e3),0):n.fps.value:(s.warn("Getting the video framerate unsupported by browser"),0)},getStatsInfo:function(e){var n=E[c];if(null==n||null===n.webrtcStuff||void 0===n.webrtcStuff)return null;var r=n.webrtcStuff;return null===r.pc||void 0===r.pc?null:r.pc.getStats?(r.pc.getStats().then(function(n){n.forEach(function(n){e.log(n)})}),r.stats):null},getLocalStats:function(e,r,i){var o=E[c];if(null==o||null===o.webrtcStuff||void 0===o.webrtcStuff)return s.warn("Invalid handle"),"Invalid handle";var a=o.webrtcStuff;return null===a.pc||void 0===a.pc?"Invalid PeerConnection":void(a.pc.getStats&&a.pc.getStats().then(function(o){if(r%e==0){let e={};o.forEach(r=>{let i,s,a;if("outbound-rtp"===r.type){if(r.isRemote)return;let c=r.timestamp;if(i=r.bytesSent,s=r.packetsSent,a=r.retransmittedPacketsSent,n&&n.has(r.id)){let d=(c-n.get(r.id).timestamp)/1e3,l=8*(i-n.get(r.id).bytesSent)/d/1e3;if(l=parseInt(l,10),"video"===r.kind||"video"===r.mediaType){e.videoBitrate=l,e.videoBytesSent=i;let c=o.get(r.trackId),u=c?c.frameWidth:0,f=c?c.frameHeight:0,p=c?c.framesSent:0,h=n.get(r.id).trackId,m=h?(p-n.get(h).framesSent)/d:0;m=parseInt(m,10),e.frameWidth=u,e.frameHeight=f,e.fps=m,e.videoPacketsSent=s,e.videoPacketsLost=a}else"audio"!==r.kind&&"audio"!==r.mediaType||(e.audioBitrate=l,e.audioBytesSent=i,e.audioPacketsSent=s,e.audioPacketsLost=a)}if(ee&&ee.has(r.id)){let n=(c-ee.get(r.id).timestamp)/1e3,s=8*(i-ee.get(r.id).bytesSent)/n/1e3;if(s=parseInt(s,10),"video"===r.kind||"video"===r.mediaType){e.videoAverageBitrate=s;let i=r.trackId?o.get(r.trackId).framesSent:0,a=ee.get(r.id).trackId,c=a?(i-ee.get(a).framesSent)/n:0;e.averageFps=c=parseInt(c,10)}else"audio"!==r.kind&&"audio"!==r.mediaType||(e.audioAverageBitrate=s)}}else if("candidate-pair"===r.type){let n=1e3*r.currentRoundTripTime;e.rtt=n=parseInt(n,10)}e.timestamp=parseInt(r.timestamp,10)}),ee?i.success(e):i.error(),ee=o}else i.error();n=o}))},getRemoteStats:function(e,n,r){var i=c,o=E[i];if(null==o||null===o.webrtcStuff||void 0===o.webrtcStuff)return s.warn("Invalid handle"),"Invalid handle";var a=o.webrtcStuff;return null===a.pc||void 0===a.pc?"Invalid PeerConnection":void(a.pc.getStats&&a.pc.getStats().then(function(o){if(n%e==0){let e={};o.forEach(n=>{let r,a,c;if("inbound-rtp"===n.type){let d=n.timestamp;r=n.bytesReceived,a=n.packetsReceived,c=n.packetsLost;let l=et[i];if(l&&l.has(n.id)){let i=(d-l.get(n.id).timestamp)/1e3,u=8*(r-l.get(n.id).bytesReceived)/i/1e3;if(u=parseInt(u,10),"video"===n.kind||"video"===n.mediaType){e.videoBitrate=u,e.videoBytesReceived=r;let d=n.trackId?o.get(n.trackId):null,f=d?d.framesReceived:0,p=l.get(n.id).trackId,h=p?(f-l.get(p).framesReceived)/i:0;h=parseInt(h,10);let m=d?d.frameWidth:0,v=d?d.frameHeight:0;if(e.frameWidth=m,e.frameHeight=v,e.fps=h,e.videoPacketsReceived=a,e.videoPacketsLost=c,"safari"!==s.webRTCAdapter.browserDetails.browser){let n=d?d.jitterBufferDelay:0,r=d?d.jitterBufferEmittedCount:0,i=n/r*1e3;e.jitterBufferDelay=parseInt(n,10),e.jitterBufferEmittedCount=r,e.jitterBufferMs=parseInt(i,10)}}else"audio"!==n.kind&&"audio"!==n.mediaType||(e.audioBitrate=u,e.audioBytesReceived=r,e.audioPacketsReceived=a,e.audioPacketsLost=c)}let u=en[i];if(u&&u.has(n.id)){let i=(d-u.get(n.id).timestamp)/1e3,s=8*(r-u.get(n.id).bytesReceived)/i/1e3;if(s=parseInt(s,10),"video"===n.kind||"video"===n.mediaType){e.videoAverageBitrate=s;let r=n.trackId?o.get(n.trackId).framesReceived:0,a=u.get(n.id).trackId,c=a?(r-u.get(a).framesReceived)/i:0;e.averageFps=c=parseInt(c,10)}else"audio"!==n.kind&&"audio"!==n.mediaType||(e.audioAverageBitrate=s)}}else if("candidate-pair"===n.type){let r=1e3*n.currentRoundTripTime;e.rtt=r=parseInt(r,10)}e.timestamp=parseInt(n.timestamp,10)}),en[i]?r.success(e):r.error(),en[i]=o}else r.error();et[i]=o}))},getSsrcs:function(){return function(e){var n=E[e];if(null==n||null===n.webrtcStuff||void 0===n.webrtcStuff)return void s.warn("Invalid handle");var r=n.webrtcStuff;if(null===r.pc||void 0===r.pc)return null;var i=r.pc.getTransceivers();if(i&&i.length>0)for(var o in i){let e=i[o].receiver;if(e&&e.track&&"audio"===e.track.kind){let n=e.getSynchronizationSources();if("safari"===s.webRTCAdapter.browserDetails.browser)for(let e in n){let r=n[e];r.audioLevel=Math.pow(10,-1*r.audioLevel/20)}return n}}}(c)},send:function(e){H(c,e)},data:function(e){z(c,e)},dtmf:function(e){G(c,e)},consentDialog:e.consentDialog,iceState:e.iceState,mediaState:e.mediaState,webrtcState:e.webrtcState,slowLink:e.slowLink,onmessage:e.onmessage,createOffer:function(e){$(c,!0,e)},createAnswer:function(e){$(c,!1,e)},handleRemoteJsep:function(e){J(c,e)},onlocalstream:e.onlocalstream,onremotestream:e.onremotestream,ondata:e.ondata,ondataopen:e.ondataopen,oncleanup:e.oncleanup,ondetached:e.ondetached,hangup:function(e){ei(c,!0===e)},detach:function(e){W(c,e)}};E[c]=d,e.success(d)}function F(e,n,r,i){if((e=e||{}).success="function"==typeof e.success?e.success:s.noop,e.error="function"==typeof e.error?e.error:s.noop,e.consentDialog="function"==typeof e.consentDialog?e.consentDialog:s.noop,e.iceState="function"==typeof e.iceState?e.iceState:s.noop,e.mediaState="function"==typeof e.mediaState?e.mediaState:s.noop,e.webrtcState="function"==typeof e.webrtcState?e.webrtcState:s.noop,e.slowLink="function"==typeof e.slowLink?e.slowLink:s.noop,e.onmessage="function"==typeof e.onmessage?e.onmessage:s.noop,e.onlocalstream="function"==typeof e.onlocalstream?e.onlocalstream:s.noop,e.onremotestream="function"==typeof e.onremotestream?e.onremotestream:s.noop,e.ondata="function"==typeof e.ondata?e.ondata:s.noop,e.ondataopen="function"==typeof e.ondataopen?e.ondataopen:s.noop,e.oncleanup="function"==typeof e.oncleanup?e.oncleanup:s.noop,e.ondetached="function"==typeof e.ondetached?e.ondetached:s.noop,!R)return s.warn("Is the server down? (connected=false)"),void e.error("Is the server down? (connected=false)");var c=e.plugin;if(null==c)return s.error("Invalid plugin"),void e.error("Invalid plugin");var d=e.opaqueId,l=e.token?e.token:b,u=s.randomString(12),p={[j]:"attach",plugin:c,opaque_id:d,transaction:u};if(null!=l&&(p.token=l),null!=_&&(p.apisecret=_),o){if(n)return void U(e,n,c,l);if(r&&i){var h={};return h[j]="success",h.data={},h.data.id=i,void U(e,h,c,l,r)}return k[u]=function(n){U(e,n,c,l)},p.session_id=T,void a.send(JSON.stringify(p))}s.httpAPICall(f+"/"+T,{verb:"POST",withCredentials:g,body:p,success:function(n){if(s.debug(n),"success"!==n[j])return s.error("Ooops: "+n.error.code+" "+n.error.reason),void e.error("Ooops: "+n.error.code+" "+n.error.reason);var r=n.data.id;s.log("Created handle: "+r);var i={session:O,plugin:c,id:r,token:l,detached:!1,webrtcStuff:{started:!1,myStream:null,streamExternal:!1,remoteStream:null,mySdp:null,mediaConstraints:null,pc:null,dataChannel:{},dtmfSender:null,trickle:!0,iceDone:!1,volume:{value:null,timer:null},bitrate:{value:null,bsnow:null,bsbefore:null,tsnow:null,tsbefore:null,timer:null}},getId:function(){return r},getPlugin:function(){return c},getVolume:function(){return K(r,!0)},getRemoteVolume:function(){return K(r,!0)},getLocalVolume:function(){return K(r,!1)},isAudioMuted:function(){return Y(r,!1)},muteAudio:function(){return Q(r,!1,!0)},unmuteAudio:function(){return Q(r,!1,!1)},isVideoMuted:function(){return Y(r,!0)},muteVideo:function(){return Q(r,!0,!0)},unmuteVideo:function(){return Q(r,!0,!1)},getBitrate:function(){return Z(r)},send:function(e){H(r,e)},data:function(e){z(r,e)},dtmf:function(e){G(r,e)},consentDialog:e.consentDialog,iceState:e.iceState,mediaState:e.mediaState,webrtcState:e.webrtcState,slowLink:e.slowLink,onmessage:e.onmessage,createOffer:function(e){$(r,!0,e)},createAnswer:function(e){$(r,!1,e)},handleRemoteJsep:function(e){J(r,e)},onlocalstream:e.onlocalstream,onremotestream:e.onremotestream,ondata:e.ondata,ondataopen:e.ondataopen,oncleanup:e.oncleanup,ondetached:e.ondetached,hangup:function(e){ei(r,!0===e)},detach:function(e){W(r,e)}};E[r]=i,e.success(i)},error:function(e,n){s.error(e+":",n)}})}function H(e,n){if((n=n||{}).success="function"==typeof n.success?n.success:s.noop,n.error="function"==typeof n.error?n.error:s.noop,!R)return s.warn("Is the server down? (connected=false)"),void n.error("Is the server down? (connected=false)");var r=E[e];if(null==r||null===r.webrtcStuff||void 0===r.webrtcStuff)return s.warn("Invalid handle"),void n.error("Invalid handle");var i=n.message,c=n.jsep,d=s.randomString(12),l={[j]:"message",body:i,transaction:d};(null!==r.token&&void 0!==r.token&&(l.token=r.token),null!=_&&(l.apisecret=_),null!=c&&(l.jsep=c),s.debug("Sending message to plugin (handle="+e+"):"),s.debug(l),o)?(l.session_id=T,l.handle_id=e,k[d]=function(e){if(s.debug("Message sent!"),s.debug(e),"success"===e[j]){var r=e.plugindata;if(null==r)return s.warn("Request succeeded, but missing plugindata..."),void n.success();s.log("Synchronous transaction successful ("+r.plugin+")");var i=r.data;return s.debug(i),void n.success(i)}"ack"===e[j]?n.success():void 0!==e.error&&null!==e.error?(s.error("Ooops: "+e.error.code+" "+e.error.reason),n.error(e.error.code+" "+e.error.reason)):(s.error("Unknown error"),n.error("Unknown error"))},a.send(JSON.stringify(l))):s.httpAPICall(f+"/"+T+"/"+e,{verb:"POST",withCredentials:g,body:l,success:function(e){if(s.debug("Message sent!"),s.debug(e),"success"===e[j]){var r=e.plugindata;if(null==r)return s.warn("Request succeeded, but missing plugindata..."),void n.success();s.log("Synchronous transaction successful ("+r.plugin+")");var i=r.data;return s.debug(i),void n.success(i)}"ack"===e[j]?n.success():void 0!==e.error&&null!==e.error?(s.error("Ooops: "+e.error.code+" "+e.error.reason),n.error(e.error.code+" "+e.error.reason)):(s.error("Unknown error"),n.error("Unknown error"))},error:function(e,r){s.error(e+":",r),n.error(e+": "+r)}})}function q(e,n){if("brtc_v0"===M)if(R){var r=E[e];if(null!=r&&null!==r.webrtcStuff&&void 0!==r.webrtcStuff){var i={[j]:"trickle",candidate:n,transaction:s.randomString(12)};if(null!==r.token&&void 0!==r.token&&(i.token=r.token),null!=_&&(i.apisecret=_),s.vdebug("Sending trickle candidate (handle="+e+"):"),s.vdebug(i),o)return i.session_id=T,i.handle_id=e,void a.send(JSON.stringify(i));s.httpAPICall(f+"/"+T+"/"+e,{verb:"POST",withCredentials:g,body:i,success:function(e){s.vdebug("Candidate sent!"),s.vdebug(e),"ack"===e[j]||s.error("Ooops: "+e.error.code+" "+e.error.reason)},error:function(e,n){s.error(e+":",n)}})}else s.warn("Invalid handle")}else s.warn("Is the server down? (connected=false)")}function V(e,n,r,i){var o=E[e];if(null!=o&&null!==o.webrtcStuff&&void 0!==o.webrtcStuff){var a=o.webrtcStuff,c=function(e){s.log("Received state change on data channel:",e);var n=e.target.label,r=a.dataChannel[n]?a.dataChannel[n].readyState:"null";if(s.log("State change on <"+n+"> data channel: "+r),"open"===r){if(a.dataChannel[n].pending&&a.dataChannel[n].pending.length>0){for(var i in s.log("Sending pending messages on <' + label + '>:",a.dataChannel[n].pending.length),a.dataChannel[n].pending){var c=a.dataChannel[n].pending[i];s.log("Sending string on data channel <"+n+">: "+c),a.dataChannel[n].send(c)}a.dataChannel[n].pending=[]}o.ondataopen(n)}};if(r)a.dataChannel[n]=r;else{if(null===a.pc)return;a.dataChannel[n]=a.pc.createDataChannel(n,{ordered:!1})}a.dataChannel[n].onmessage=function(e){s.log("Received message on data channel:",e);var n=e.target.label;o.ondata(e.data,n)},a.dataChannel[n].onopen=c,a.dataChannel[n].onclose=c,a.dataChannel[n].onerror=function(e){s.log("Got error on data channel:",e)},a.dataChannel[n].pending=[],i&&a.dataChannel[n].pending.push(i)}else s.warn("Invalid handle")}function z(e,n){(n=n||{}).success="function"==typeof n.success?n.success:s.noop,n.error="function"==typeof n.error?n.error:s.noop;var r=E[e];if(null==r||null===r.webrtcStuff||void 0===r.webrtcStuff)return s.warn("Invalid handle"),void n.error("Invalid handle");var i=r.webrtcStuff,o=n.text;if(null==o)return s.warn("Invalid text"),void n.error("Invalid text");var a=n.label?n.label:s.dataChanDefaultLabel;return i.dataChannel[a]?"open"!==i.dataChannel[a].readyState?i.dataChannel[a].pending.push(o):(s.log("Sending string on data channel <"+a+">: "+o),i.dataChannel[a].send(o)):V(e,a,!1,o),void n.success()}function G(e,n){(n=n||{}).success="function"==typeof n.success?n.success:s.noop,n.error="function"==typeof n.error?n.error:s.noop;var r=E[e];if(null==r||null===r.webrtcStuff||void 0===r.webrtcStuff)return s.warn("Invalid handle"),void n.error("Invalid handle");var i=r.webrtcStuff;if(null===i.dtmfSender||void 0===i.dtmfSender){if(void 0!==i.pc&&null!==i.pc){var o=i.pc.getSenders().find(function(e){return e.track&&"audio"===e.track.kind});if(!o)return s.warn("Invalid DTMF configuration (no audio track)"),void n.error("Invalid DTMF configuration (no audio track)");i.dtmfSender=o.dtmf,i.dtmfSender&&(s.log("Created DTMF Sender"),i.dtmfSender.ontonechange=function(e){s.debug("Sent DTMF tone: "+e.tone)})}if(null===i.dtmfSender||void 0===i.dtmfSender)return s.warn("Invalid DTMF configuration"),void n.error("Invalid DTMF configuration")}var a=n.dtmf;if(null==a)return s.warn("Invalid DTMF parameters"),void n.error("Invalid DTMF parameters");var c=a.tones;if(null==c)return s.warn("Invalid DTMF string"),void n.error("Invalid DTMF string");var d=a.duration;null==d&&(d=500);var l=a.gap;null==l&&(l=50),s.debug("Sending DTMF string "+c+" (duration "+d+"ms, gap "+l+"ms)"),i.dtmfSender.insertDTMF(c,d,l),n.success()}function W(e,n){(n=n||{}).success="function"==typeof n.success?n.success:s.noop,n.error="function"==typeof n.error?n.error:s.noop;var r=!0;void 0!==n.asyncRequest&&null!==n.asyncRequest&&(r=!0===n.asyncRequest);var i=!1;void 0!==n.noRequest&&null!==n.noRequest&&(i=!0===n.noRequest),s.log("Destroying handle "+e+" (async="+r+")"),ei(e);var c=E[e];if(null==c||c.detached||i)return delete E[e],void n.success();if(!R)return s.warn("Is the server down? (connected=false)"),void n.error("Is the server down? (connected=false)");var d={[j]:"detach",transaction:s.randomString(12)};(null!==c.token&&void 0!==c.token&&(d.token=c.token),null!=_&&(d.apisecret=_),o)?(d.session_id=T,d.handle_id=e,a.send(JSON.stringify(d)),delete E[e],n.success()):s.httpAPICall(f+"/"+T+"/"+e,{verb:"POST",async:r,withCredentials:g,body:d,success:function(r){s.log("Destroyed handle:"),s.debug(r),"success"!==r[j]&&s.error("Ooops: "+r.error.code+" "+r.error.reason),delete E[e],n.success()},error:function(r,i){s.error(r+":",i),delete E[e],n.success()}})}function X(e,n,r,i,o){var a=!1;null!==i.media.update&&!0===i.media.update&&(a=!0);var c=E[e];if(null==c||null===c.webrtcStuff||void 0===c.webrtcStuff)return s.warn("Invalid handle"),void i.error("Invalid handle");var d=c.webrtcStuff;s.debug("streamsDone:",o),o&&(s.debug(" -- Audio tracks:",o.getAudioTracks()),s.debug(" -- Video tracks:",o.getVideoTracks()));var l=!1;if(d.myStream&&r.update&&!d.streamExternal){if((!r.update&&eo(r)||r.update&&(r.addAudio||r.replaceAudio))&&o.getAudioTracks()&&o.getAudioTracks().length)if(d.myStream.addTrack(o.getAudioTracks()[0]),"firefox"===s.webRTCAdapter.browserDetails.browser&&s.webRTCAdapter.browserDetails.version>=59||"safari"===s.webRTCAdapter.browserDetails.browser&&window.RTCRtpSender.prototype.replaceTrack||"chrome"===s.webRTCAdapter.browserDetails.browser&&s.webRTCAdapter.browserDetails.version>=72){s.log((r.replaceAudio?"Replacing":"Adding")+" audio track:",o.getAudioTracks()[0]);var u=null;if((y=d.pc.getTransceivers())&&y.length>0){for(var f in y)if((g=y[f]).sender&&g.sender.track&&"audio"===g.sender.track.kind||g.receiver&&g.receiver.track&&"audio"===g.receiver.track.kind){u=g;break}}u&&u.sender?u.sender.replaceTrack(o.getAudioTracks()[0]):d.pc.addTrack(o.getAudioTracks()[0],o)}else s.log((r.replaceAudio?"Replacing":"Adding")+" audio track:",o.getAudioTracks()[0]),d.pc.addTrack(o.getAudioTracks()[0],o);if((!r.update&&ea(r)||r.update&&(r.addVideo||r.replaceVideo))&&o.getVideoTracks()&&o.getVideoTracks().length)if(d.myStream.addTrack(o.getVideoTracks()[0]),"firefox"===s.webRTCAdapter.browserDetails.browser&&s.webRTCAdapter.browserDetails.version>=59||"safari"===s.webRTCAdapter.browserDetails.browser&&window.RTCRtpSender.prototype.replaceTrack||"chrome"===s.webRTCAdapter.browserDetails.browser&&s.webRTCAdapter.browserDetails.version>=72){s.log((r.replaceVideo?"Replacing":"Adding")+" video track:",o.getVideoTracks()[0]);var g,y,b=null;if((y=d.pc.getTransceivers())&&y.length>0){for(var f in y)if((g=y[f]).sender&&g.sender.track&&"video"===g.sender.track.kind||g.receiver&&g.receiver.track&&"video"===g.receiver.track.kind){b=g;break}}b&&b.sender?b.sender.replaceTrack(o.getVideoTracks()[0]):d.pc.addTrack(o.getVideoTracks()[0],o)}else s.log((r.replaceVideo?"Replacing":"Adding")+" video track:",o.getVideoTracks()[0]),d.pc.addTrack(o.getVideoTracks()[0],o)}else d.myStream=o,l=!0;if(!d.pc){var _={iceServers:p,iceTransportPolicy:h,bundlePolicy:m};"chrome"===s.webRTCAdapter.browserDetails.browser&&(_.sdpSemantics=s.webRTCAdapter.browserDetails.version<72?"plan-b":"unified-plan");var w={optional:[{DtlsSrtpKeyAgreement:!0}]};if(!0===v&&w.optional.push({googIPv6:!0}),i.rtcConstraints&&"object"==typeof i.rtcConstraints)for(var f in s.debug("Adding custom PeerConnection constraints:",i.rtcConstraints),i.rtcConstraints)w.optional.push(i.rtcConstraints[f]);"edge"===s.webRTCAdapter.browserDetails.browser&&(_.bundlePolicy="max-bundle"),s.log("Creating PeerConnection"),s.debug(w),d.outerpc?d.pc=d.outerpc:d.pc=new RTCPeerConnection(_,w),s.debug(d.pc),d.pc.getStats&&(d.volume={},d.bitrate.value="0 kbits/sec",d.fps.value=0),s.log("Preparing local SDP and gathering candidates (trickle="+d.trickle+")"),d.pc.oniceconnectionstatechange=function(e){d.pc&&c.iceState(d.pc.iceConnectionState)},d.pc.onicecandidate=function(n){if(null==n.candidate||"edge"===s.webRTCAdapter.browserDetails.browser&&n.candidate.candidate.indexOf("endOfCandidates")>0)s.log("End of candidates."),d.iceDone=!0,!0===d.trickle?q(e,{completed:!0}):function(e,n){(n=n||{}).success="function"==typeof n.success?n.success:s.noop,n.error="function"==typeof n.error?n.error:s.noop;var r=E[e];if(null==r||null===r.webrtcStuff||void 0===r.webrtcStuff)return s.warn("Invalid handle, not sending anything");var i=r.webrtcStuff;if(s.log("Sending offer/answer SDP..."),null===i.mySdp||void 0===i.mySdp)return s.warn("Local SDP instance is invalid, not sending anything...");i.mySdp={type:i.pc.localDescription.type,sdp:i.pc.localDescription.sdp},!1===i.trickle&&(i.mySdp.trickle=!1),s.debug(n),i.sdpSent=!0,n.success(i.mySdp)}(e,i);else{var r={candidate:n.candidate.candidate,sdpMid:n.candidate.sdpMid,sdpMLineIndex:n.candidate.sdpMLineIndex};!0===d.trickle&&q(e,r)}},d.pc.ontrack=function(e){if(s.log("Handling Remote Track"),s.debug(e),e.streams){if(d.remoteStream=e.streams[0],e.track){var n=e.transceiver?e.transceiver.mid:e.track.id;try{c.onremotestream(d.remoteStream,e.track,n,!0)}catch(e){}}else c.onremotestream(d.remoteStream);e.track&&!e.track.onended&&(s.log("Adding onended callback to track:",e.track),e.track.onended=function(r){s.log("Remote track removed:",r),d.remoteStream&&(d.remoteStream.removeTrack(r.target),c.onremotestream(d.remoteStream,e.track,n,!1))})}}}if(l&&null!=o){s.log("Adding local stream");var S=!0===i.simulcast2;o.getTracks().forEach(function(e){s.log("Adding local track:",e),S?"audio"===e.kind?d.pc.addTrack(e,o):(s.log("Enabling rid-based simulcasting:",e),d.pc.addTransceiver(e,{direction:"sendrecv",streams:[o],sendEncodings:[{rid:"h",active:!0,maxBitrate:9e5},{rid:"m",active:!0,maxBitrate:3e5,scaleResolutionDownBy:2},{rid:"l",active:!0,maxBitrate:1e5,scaleResolutionDownBy:4}]})):d.pc.addTrack(e,o)})}if(((s.debug("isDataEnabled:",r),"edge"==s.webRTCAdapter.browserDetails.browser)?(s.warn("Edge doesn't support data channels yet"),1):null==r||!0!==r.data)||d.dataChannel[s.dataChanDefaultLabel]||(s.log("Creating data channel"),V(e,s.dataChanDefaultLabel,!1),"brtc_v4"===M&&["BRTC_CLIENT_UNRELIABLE_MESSAGE","BRTC_CLIENT_BROADCAST_EVENT"].forEach(n=>{V(e,n,d.pc.createDataChannel(n,{ordered:!1,maxRetransmits:10}))}),d.pc.ondatachannel=function(n){s.log("Data channel created by Janus:",n),V(e,n.channel.label,n.channel)}),d.myStream){let e=!0;a&&(e=!1),c.onlocalstream(d.myStream,e)}d.outerpc?i.success():null==n?function(e,n,r){(r=r||{}).success="function"==typeof r.success?r.success:s.noop,r.error="function"==typeof r.error?r.error:s.noop,r.customizeSdp="function"==typeof r.customizeSdp?r.customizeSdp:s.noop;var i=E[e];if(null==i||null===i.webrtcStuff||void 0===i.webrtcStuff)return s.warn("Invalid handle"),r.error("Invalid handle");var o=i.webrtcStuff,a=!0===r.simulcast;a?s.log("Creating offer (iceDone="+o.iceDone+", simulcast="+a+")"):s.log("Creating offer (iceDone="+o.iceDone+")");var c={};if("firefox"===s.webRTCAdapter.browserDetails.browser&&s.webRTCAdapter.browserDetails.version>=59||"safari"===s.webRTCAdapter.browserDetails.browser&&window.RTCRtpSender.prototype.replaceTrack||"chrome"===s.webRTCAdapter.browserDetails.browser&&s.webRTCAdapter.browserDetails.version>=72){var d=null,l=null,u=o.pc.getTransceivers();if(u&&u.length>0)for(var f in u){var p=u[f];p.sender&&p.sender.track&&"audio"===p.sender.track.kind||p.receiver&&p.receiver.track&&"audio"===p.receiver.track.kind?d||(d=p):(p.sender&&p.sender.track&&"video"===p.sender.track.kind||p.receiver&&p.receiver.track&&"video"===p.receiver.track.kind)&&(l||(l=p))}var h=eo(n),m=es(n);h||m?h&&m?d&&(d.setDirection?d.setDirection("sendrecv"):d.direction="sendrecv",s.log("Setting audio transceiver to sendrecv:",d)):h&&!m?d&&(d.setDirection?d.setDirection("sendonly"):d.direction="sendonly",s.log("Setting audio transceiver to sendonly:",d)):!h&&m&&(d?(d.setDirection?d.setDirection("recvonly"):d.direction="recvonly",s.log("Setting audio transceiver to recvonly:",d)):(d=o.pc.addTransceiver("audio",{direction:"recvonly"}),s.log("Adding recvonly audio transceiver:",d))):n.removeAudio&&d&&(d.setDirection?d.setDirection("inactive"):d.direction="inactive",s.log("Setting audio transceiver to inactive:",d));var v=ea(n),g=ec(n);v||g?v&&g?l&&(l.setDirection?l.setDirection("sendrecv"):l.direction="sendrecv",s.log("Setting video transceiver to sendrecv:",l)):v&&!g?l&&(l.setDirection?l.setDirection("sendonly"):l.direction="sendonly",s.log("Setting video transceiver to sendonly:",l)):!v&&g&&(l?(l.setDirection?l.setDirection("recvonly"):l.direction="recvonly",s.log("Setting video transceiver to recvonly:",l)):(l=o.pc.addTransceiver("video",{direction:"recvonly"}),s.log("Adding recvonly video transceiver:",l))):n.removeVideo&&l&&(l.setDirection?l.setDirection("inactive"):l.direction="inactive",s.log("Setting video transceiver to inactive:",l))}else c.offerToReceiveAudio=es(n),c.offerToReceiveVideo=ec(n);!0===r.iceRestart&&(c.iceRestart=!0),s.debug(c);var y=ea(n);if(y&&a&&"firefox"===s.webRTCAdapter.browserDetails.browser){s.log("Enabling Simulcasting for Firefox (RID)");var b=o.pc.getSenders().find(function(e){return"video"==e.track.kind});if(b){var _=b.getParameters();_||(_={}),_.encodings=[{rid:"h",active:!0,maxBitrate:9e5},{rid:"m",active:!0,maxBitrate:3e5,scaleResolutionDownBy:2},{rid:"l",active:!0,maxBitrate:1e5,scaleResolutionDownBy:4}],b.setParameters(_)}}i.session.sendlog({log:{event:"calling pc.createOffer",code:1,ts:(new Date).toLocaleString()}}),o.pc.createOffer(c).then(function(e){s.debug(e);var n={type:e.type,sdp:e.sdp};r.customizeSdp(n),e.sdp=n.sdp,s.log("Setting local description"),y&&a&&("chrome"===s.webRTCAdapter.browserDetails.browser||"safari"===s.webRTCAdapter.browserDetails.browser?(s.log("Enabling Simulcasting for Chrome (SDP munging)"),e.sdp=function(e){for(var n=e.split("\r\n"),r=!1,i=[-1],o=[-1],a=null,c=null,d=null,l=null,u=-1,f=0;f<n.length;f++)if(h=n[f].match(/m=(\w+) */)){if("video"===h[1]){if(!(i[0]<0)){u=f;break}r=!0}else if(i[0]>-1){u=f;break}}else if(r){var p=n[f].match(/a=ssrc-group:FID (\d+) (\d+)/);if(p)i[0]=p[1],o[0]=p[2],n.splice(f,1),f--;else{if(i[0]&&((m=n[f].match("a=ssrc:"+i[0]+" cname:(.+)"))&&(a=m[1]),(m=n[f].match("a=ssrc:"+i[0]+" msid:(.+)"))&&(c=m[1]),(m=n[f].match("a=ssrc:"+i[0]+" mslabel:(.+)"))&&(d=m[1]),(m=n[f].match("a=ssrc:"+i[0]+" label:(.+)"))&&(l=m[1]),0===n[f].indexOf("a=ssrc:"+o[0])||0===n[f].indexOf("a=ssrc:"+i[0]))){n.splice(f,1),f--;continue}0!=n[f].length||(n.splice(f,1),f--)}}if(i[0]<0){for(u=-1,r=!1,f=0;f<n.length;f++)if(h=n[f].match(/m=(\w+) */)){if("video"===h[1]){if(!(i[0]<0)){u=f;break}r=!0}else if(i[0]>-1){u=f;break}}else if(r){if(i[0]<0){var h,m,v=n[f].match(/a=ssrc:(\d+)/);if(v){i[0]=v[1],n.splice(f,1),f--;continue}}else if((m=n[f].match("a=ssrc:"+i[0]+" cname:(.+)"))&&(a=m[1]),(m=n[f].match("a=ssrc:"+i[0]+" msid:(.+)"))&&(c=m[1]),(m=n[f].match("a=ssrc:"+i[0]+" mslabel:(.+)"))&&(d=m[1]),(m=n[f].match("a=ssrc:"+i[0]+" label:(.+)"))&&(l=m[1]),0===n[f].indexOf("a=ssrc:"+o[0])||0===n[f].indexOf("a=ssrc:"+i[0])){n.splice(f,1),f--;continue}0!=n[f].length||(n.splice(f,1),f--)}}if(i[0]<0)return s.warn("Couldn't find the video SSRC, simulcasting NOT enabled"),e;for(u<0&&(u=n.length),i[1]=Math.floor(0xffffffff*Math.random()),i[2]=Math.floor(0xffffffff*Math.random()),o[1]=Math.floor(0xffffffff*Math.random()),o[2]=Math.floor(0xffffffff*Math.random()),f=0;f<i.length;f++)a&&(n.splice(u,0,"a=ssrc:"+i[f]+" cname:"+a),u++),c&&(n.splice(u,0,"a=ssrc:"+i[f]+" msid:"+c),u++),d&&(n.splice(u,0,"a=ssrc:"+i[f]+" mslabel:"+d),u++),l&&(n.splice(u,0,"a=ssrc:"+i[f]+" label:"+l),u++),a&&(n.splice(u,0,"a=ssrc:"+o[f]+" cname:"+a),u++),c&&(n.splice(u,0,"a=ssrc:"+o[f]+" msid:"+c),u++),d&&(n.splice(u,0,"a=ssrc:"+o[f]+" mslabel:"+d),u++),l&&(n.splice(u,0,"a=ssrc:"+o[f]+" label:"+l),u++);return n.splice(u,0,"a=ssrc-group:FID "+i[2]+" "+o[2]),n.splice(u,0,"a=ssrc-group:FID "+i[1]+" "+o[1]),n.splice(u,0,"a=ssrc-group:FID "+i[0]+" "+o[0]),n.splice(u,0,"a=ssrc-group:SIM "+i[0]+" "+i[1]+" "+i[2]),(e=n.join("\r\n")).endsWith("\r\n")||(e+="\r\n"),e}(e.sdp)):"firefox"!==s.webRTCAdapter.browserDetails.browser&&s.warn("simulcast=true, but this is not Chrome nor Firefox, ignoring")),o.mySdp=e.sdp,i.session.sendlog({log:{event:"calling pc.setLocalDescription",code:1,ts:(new Date).toLocaleString()}}),o.pc.setLocalDescription(e).catch(r.error),o.mediaConstraints=c,o.iceDone||o.trickle?(s.log("Offer ready"),s.debug(r),r.success(e)):s.log("Waiting for all candidates...")},r.error)}(e,r,i):d.pc.setRemoteDescription(n).then(function(){if(s.log("Remote description accepted!"),d.remoteSdp=n.sdp,d.candidates&&d.candidates.length>0){for(var o in d.candidates){var a=d.candidates[o];s.debug("Adding remote candidate:",a),a&&!0!==a.completed?d.pc.addIceCandidate(a):d.pc.addIceCandidate()}d.candidates=[]}!function(e,n,r){(r=r||{}).success="function"==typeof r.success?r.success:s.noop,r.error="function"==typeof r.error?r.error:s.noop,r.customizeSdp="function"==typeof r.customizeSdp?r.customizeSdp:s.noop;var i=E[e];if(null==i||null===i.webrtcStuff||void 0===i.webrtcStuff)return s.warn("Invalid handle"),r.error("Invalid handle");var o=i.webrtcStuff,a=!0===r.simulcast;a?s.log("Creating answer (iceDone="+o.iceDone+", simulcast="+a+")"):s.log("Creating answer (iceDone="+o.iceDone+")");var c=null;if("firefox"===s.webRTCAdapter.browserDetails.browser&&s.webRTCAdapter.browserDetails.version>=59||"safari"===s.webRTCAdapter.browserDetails.browser&&window.RTCRtpSender.prototype.replaceTrack||"chrome"===s.webRTCAdapter.browserDetails.browser&&s.webRTCAdapter.browserDetails.version>=72){c={};var d=null,l=null,u=o.pc.getTransceivers();if(u&&u.length>0)for(var f in u){var p=u[f];p.sender&&p.sender.track&&"audio"===p.sender.track.kind||p.receiver&&p.receiver.track&&"audio"===p.receiver.track.kind?d||(d=p):(p.sender&&p.sender.track&&"video"===p.sender.track.kind||p.receiver&&p.receiver.track&&"video"===p.receiver.track.kind)&&(l||(l=p))}var h=eo(n),m=es(n);h||m?h&&m?d&&(d.setDirection?d.setDirection("sendrecv"):d.direction="sendrecv",s.log("Setting audio transceiver to sendrecv:",d)):h&&!m?d&&(d.setDirection?d.setDirection("sendonly"):d.direction="sendonly",s.log("Setting audio transceiver to sendonly:",d)):!h&&m&&(d?(d.setDirection?d.setDirection("recvonly"):d.direction="recvonly",s.log("Setting audio transceiver to recvonly:",d)):(d=o.pc.addTransceiver("audio",{direction:"recvonly"}),s.log("Adding recvonly audio transceiver:",d))):n.removeAudio&&d&&(d.setDirection?d.setDirection("inactive"):d.direction="inactive",s.log("Setting audio transceiver to inactive:",d));var v=ea(n),g=ec(n);v||g?v&&g?l&&(l.setDirection?l.setDirection("sendrecv"):l.direction="sendrecv",s.log("Setting video transceiver to sendrecv:",l)):v&&!g?l&&(l.setDirection?l.setDirection("sendonly"):l.direction="sendonly",s.log("Setting video transceiver to sendonly:",l)):!v&&g&&(l?(l.setDirection?l.setDirection("recvonly"):l.direction="recvonly",s.log("Setting video transceiver to recvonly:",l)):(l=o.pc.addTransceiver("video",{direction:"recvonly"}),s.log("Adding recvonly video transceiver:",l))):n.removeVideo&&l&&(l.setDirection?l.setDirection("inactive"):l.direction="inactive",s.log("Setting video transceiver to inactive:",l))}else c="firefox"==s.webRTCAdapter.browserDetails.browser||"edge"==s.webRTCAdapter.browserDetails.browser?{offerToReceiveAudio:es(n),offerToReceiveVideo:ec(n)}:{mandatory:{OfferToReceiveAudio:es(n),OfferToReceiveVideo:ec(n)}};s.debug(c);var y=ea(n);if(y&&a&&"firefox"===s.webRTCAdapter.browserDetails.browser){s.log("Enabling Simulcasting for Firefox (RID)");var b=o.pc.getSenders()[1];s.log(b);var _=b.getParameters();s.log(_),b.setParameters({encodings:[{rid:"high",active:!0,priority:"high",maxBitrate:1e6},{rid:"medium",active:!0,priority:"medium",maxBitrate:3e5},{rid:"low",active:!0,priority:"low",maxBitrate:1e5}]})}o.pc.createAnswer(c).then(function(e){s.debug(e);var n={type:e.type,sdp:e.sdp};r.customizeSdp(n),e.sdp=n.sdp,s.log("Setting local description"),y&&a&&("chrome"===s.webRTCAdapter.browserDetails.browser?s.warn("simulcast=true, but this is an answer, and video breaks in Chrome if we enable it"):"firefox"!==s.webRTCAdapter.browserDetails.browser&&s.warn("simulcast=true, but this is not Chrome nor Firefox, ignoring")),o.mySdp=e.sdp,o.pc.setLocalDescription(e).catch(r.error),o.mediaConstraints=c,o.iceDone||o.trickle?r.success(e):s.log("Waiting for all candidates...")},r.error)}(e,r,i)},i.error)}function $(e,n,o){(o=o||{}).success="function"==typeof o.success?o.success:s.noop,o.error="function"==typeof o.error?o.error:er;var a=o.jsep;if(n&&a);else if(!(n||a&&a.type&&a.sdp))return s.error("A valid JSEP is required for createAnswer"),void o.error("A valid JSEP is required for createAnswer");o.media=o.media||{audio:!0,video:!0};var c=o.media,d=E[e];if(null==d||null===d.webrtcStuff||void 0===d.webrtcStuff)return s.warn("Invalid handle"),void o.error("Invalid handle");var l,u=d.webrtcStuff;if(l=o.trickle,s.debug("isTrickleEnabled:",l),u.trickle=null==l||!0===l,void 0===u.pc||null===u.pc)c.update=!1,c.keepAudio=!1,c.keepVideo=!1;else if(void 0!==u.pc&&null!==u.pc){if(s.log("Updating existing media session"),c.update=!0,null!==o.stream&&void 0!==o.stream)o.stream!==u.myStream&&s.log("Renegotiation involves a new external stream");else{if(c.addAudio){if(c.keepAudio=!1,c.replaceAudio=!1,c.removeAudio=!1,c.audioSend=!0,u.myStream&&u.myStream.getAudioTracks()&&u.myStream.getAudioTracks().length)return s.error("Can't add audio stream, there already is one"),void o.error("Can't add audio stream, there already is one")}else c.removeAudio?(c.keepAudio=!1,c.replaceAudio=!1,c.addAudio=!1,c.audioSend=!1):c.replaceAudio&&(c.keepAudio=!1,c.addAudio=!1,c.removeAudio=!1,c.audioSend=!0);if(null===u.myStream||void 0===u.myStream?(c.replaceAudio&&(c.keepAudio=!1,c.replaceAudio=!1,c.addAudio=!0,c.audioSend=!0),eo(c)&&(c.keepAudio=!1,c.addAudio=!0)):null===u.myStream.getAudioTracks()||void 0===u.myStream.getAudioTracks()||0===u.myStream.getAudioTracks().length?(c.replaceAudio&&(c.keepAudio=!1,c.replaceAudio=!1,c.addAudio=!0,c.audioSend=!0),eo(c)&&(c.keepVideo=!1,c.addAudio=!0)):!eo(c)||c.removeAudio||c.replaceAudio||(c.keepAudio=!0),c.addVideo){if(c.keepVideo=!1,c.replaceVideo=!1,c.removeVideo=!1,c.videoSend=!0,u.myStream&&u.myStream.getVideoTracks()&&u.myStream.getVideoTracks().length)return s.error("Can't add video stream, there already is one"),void o.error("Can't add video stream, there already is one")}else c.removeVideo?(c.keepVideo=!1,c.replaceVideo=!1,c.addVideo=!1,c.videoSend=!1):c.replaceVideo&&(c.keepVideo=!1,c.addVideo=!1,c.removeVideo=!1,c.videoSend=!0);null===u.myStream||void 0===u.myStream||null===u.myStream.getVideoTracks()||void 0===u.myStream.getVideoTracks()||0===u.myStream.getVideoTracks().length?(c.replaceVideo&&(c.keepVideo=!1,c.replaceVideo=!1,c.addVideo=!0,c.videoSend=!0),ea(c)&&(c.keepVideo=!1,c.addVideo=!0)):!ea(c)||c.removeVideo||c.replaceVideo||(c.keepVideo=!0),c.addData&&(c.data=!0)}if(eo(c)&&c.keepAudio&&ea(c)&&c.keepVideo)return d.consentDialog(!1),void X(e,a,c,o,u.myStream)}if(c.update&&!u.streamExternal){if(c.removeAudio||c.replaceAudio){if(u.myStream&&u.myStream.getAudioTracks()&&u.myStream.getAudioTracks().length){var f=u.myStream.getAudioTracks()[0];s.log("Removing audio track:",f),u.myStream.removeTrack(f);try{f.stop()}catch(e){}}if(u.pc.getSenders()&&u.pc.getSenders().length){var p=!0;if(c.replaceAudio&&("firefox"===s.webRTCAdapter.browserDetails.browser||"chrome"===s.webRTCAdapter.browserDetails.browser&&s.webRTCAdapter.browserDetails.version>=72)&&(p=!1),p)for(var h in u.pc.getSenders())(f=u.pc.getSenders()[h])&&f.track&&"audio"===f.track.kind&&(s.log("Removing audio sender:",f),u.pc.removeTrack(f))}}if(c.removeVideo||c.replaceVideo){if(u.myStream&&u.myStream.getVideoTracks()&&u.myStream.getVideoTracks().length){f=u.myStream.getVideoTracks()[0],s.log("Removing video track:",f),u.myStream.removeTrack(f);try{f.stop()}catch(e){}}if(u.pc.getSenders()&&u.pc.getSenders().length){var m=!0;if(c.replaceVideo&&("firefox"===s.webRTCAdapter.browserDetails.browser||"chrome"===s.webRTCAdapter.browserDetails.browser&&s.webRTCAdapter.browserDetails.version>=72)&&(m=!1),m)for(var h in u.pc.getSenders())(f=u.pc.getSenders()[h])&&f.track&&"video"===f.track.kind&&(s.log("Removing video sender:",f),u.pc.removeTrack(f))}}}if(null!==o.stream&&void 0!==o.stream){var v=o.stream;if(s.log("MediaStream provided by the application"),s.debug(v),c.update&&c.replaceAll&&u.myStream&&u.myStream!==o.stream&&!u.streamExternal){try{var g=u.myStream.getTracks();for(var y in g){var b=g[y];s.log(b),null!=b&&b.stop()}}catch(e){}u.myStream=null}return d.consentDialog(!1),void X(e,a,c,o,v)}if(eo(c)||ea(c)){if(!s.isGetUserMediaAvailable())return void o.error("getUserMedia not available");var _={mandatory:{},optional:[]};d.consentDialog(!0);var w=eo(c);!0===w&&null!=c&&null!=c&&"object"==typeof c.audio&&(w=c.audio);var S=ea(c);if(!0===S&&null!=c&&null!=c){var R=!0===o.simulcast,T=!0===o.simulcast2;if((R||T)&&!a&&(void 0===c.video||!1===c.video)&&(c.video="hires"),c.video&&"screen"!=c.video&&"window"!=c.video)if("object"==typeof c.video){if(S=c.video,null!==c.videoDeviceId&&void 0!==c.videoDeviceId){let e={ideal:c.videoDeviceId};S.deviceId=e,S.facingMode={}}}else{var C=0,x=0;if("lowres"===c.video?(x=240,C=320):"lowres-16:9"===c.video?(x=180,C=320):"hires"===c.video||"hires-16:9"===c.video||"hdres"===c.video?(x=720,C=1280):"fhdres"===c.video?(x=1080,C=1920):"4kres"===c.video?(x=2160,C=3840):("stdres"===c.video?x=480:"stdres-16:9"===c.video?x=360:(s.log("Default video setting is stdres 4:3"),x=480),C=640),s.log("Adding media constraint:",c.video),S={height:{ideal:x},width:{ideal:C}},c.video.includes("x")){var O=(strs=c.video.split("x"))[0],I=strs[1].split("@"),k=I[0],M=15;I.length>1&&(M=I[1]),S={height:{ideal:k},width:{ideal:O},frameRate:{ideal:M}}}if(null!==c.videoDeviceId&&void 0!==c.videoDeviceId){let e={ideal:c.videoDeviceId};S.deviceId=e,S.facingMode={}}s.log("Adding video constraint:",S)}else if("screen"===c.video||"window"===c.video){if(c.screenshareFrameRate||(c.screenshareFrameRate=3),c.screenstream)return void(eo(c)&&!c.keepAudio?navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(n){c.screenstream.addTrack(n.getAudioTracks()[0]),X(e,a,c,o,c.screenstream)}):X(e,a,c,o,c.screenstream));if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return void("safari"===s.webRTCAdapter.browserDetails.browser?o.ongetsharescreenstream():navigator.mediaDevices.getDisplayMedia({video:!c.screenconfig||c.screenconfig})).then(function(n){d.consentDialog(!1),eo(c)&&!c.keepAudio?navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(function(r){n.addTrack(r.getAudioTracks()[0]),X(e,a,c,o,n)}):X(e,a,c,o,n)},function(e){d.consentDialog(!1),o.error(e)});if("chrome"===s.webRTCAdapter.browserDetails.browser){var j=s.webRTCAdapter.browserDetails.version,A=33;window.navigator.userAgent.match("Linux")&&(A=35),j>=26&&j<=A?i(_={video:{mandatory:{googLeakyBucket:!0,maxWidth:window.screen.width,maxHeight:window.screen.height,minFrameRate:c.screenshareFrameRate,maxFrameRate:c.screenshareFrameRate,chromeMediaSource:"screen"}},audio:eo(c)&&!c.keepAudio},r):s.extension.getScreen(function(e,n){if(e)return d.consentDialog(!1),o.error(e);(_={audio:!1,video:{mandatory:{chromeMediaSource:"desktop",maxWidth:window.screen.width,maxHeight:window.screen.height,minFrameRate:c.screenshareFrameRate,maxFrameRate:c.screenshareFrameRate},optional:[{googLeakyBucket:!0},{googTemporalLayeredScreencast:!0}]}}).video.mandatory.chromeMediaSourceId=n,i(_,r,eo(c)&&!c.keepAudio)})}else if("firefox"===s.webRTCAdapter.browserDetails.browser){if(!(s.webRTCAdapter.browserDetails.version>=33)){var D=Error("NavigatorUserMediaError");return D.name="Your version of Firefox does not support screen sharing, please install Firefox 33 (or more recent versions)",d.consentDialog(!1),void o.error(D)}i(_={video:{mozMediaSource:c.video,mediaSource:c.video},audio:eo(c)&&!c.keepAudio},function(e,n){if(r(e,n),!e)var i=n.currentTime,o=window.setInterval(function(){n||window.clearInterval(o),n.currentTime==i&&(window.clearInterval(o),n.onended&&n.onended()),i=n.currentTime},500)})}return}}null!=c&&"screen"===c.video||navigator.mediaDevices.enumerateDevices().then(function(n){var r=n.some(function(e){return"audioinput"===e.kind}),i=function(e){if(s.debug("isScreenSendEnabled:",e),null==e||"object"!=typeof e.video||"object"!=typeof e.video.mandatory)return!1;var n=e.video.mandatory;return n.chromeMediaSource?"desktop"===n.chromeMediaSource||"screen"===n.chromeMediaSource:n.mozMediaSource?"window"===n.mozMediaSource||"screen"===n.mozMediaSource:!!n.mediaSource&&("window"===n.mediaSource||"screen"===n.mediaSource)}(c)||n.some(function(e){return"videoinput"===e.kind}),l=eo(c),u=ea(c),f=(s.debug("isAudioSendRequired:",c),null!=c&&!1!==c.audio&&!1!==c.audioSend&&void 0!==c.failIfNoAudio&&null!==c.failIfNoAudio&&!0===c.failIfNoAudio),p=(s.debug("isVideoSendRequired:",c),null!=c&&!1!==c.video&&!1!==c.videoSend&&void 0!==c.failIfNoVideo&&null!==c.failIfNoVideo&&!0===c.failIfNoVideo);if(l||u||f||p){var h=!!l&&r,m=!!u&&i;if(!h&&!m)return d.consentDialog(!1),o.error("No capture device found"),!1;if(!h&&f)return d.consentDialog(!1),o.error("Audio capture is required, but no capture device found"),!1;if(!m&&p)return d.consentDialog(!1),o.error("Video capture is required, but no capture device found"),!1}var g={audio:!(!r||c.keepAudio)&&w,video:!(!i||c.keepVideo)&&S};if(s.debug("getUserMedia constraints",g),g.audio||g.video){var y=new Promise(function(e,n){var r={};r.code=0,r.name="NotAllowedError timeout",r.message="Permission denied";var i=18e4;void 0!==c.waitPermissionTimeout&&null!==c.waitPermissionTimeout&&(i=c.waitPermissionTimeout),isNaN(i)&&(i=18e4),setTimeout(n,i,r)}),b=new Date;d.session.sendlog({log:{event:"calling mediaDevices.getUserMedia",code:1,constraints:g,id:parseInt(P),ts:b.toLocaleString()+"."+b.getMilliseconds()}});var _=Date.now();Promise.race([navigator.mediaDevices.getUserMedia(g),y]).then(function(n){var r=Date.now()-_,i=new Date;d.session.sendlog({log:{event:"calling mediaDevices.getUserMedia on then:",code:0,id:parseInt(P),deltatime:r,is_normal:r<2e3?"ok":"a little long",ts:i.toLocaleString()+"."+i.getMilliseconds()}}),d.consentDialog(!1),X(e,a,c,o,n)}).catch(function(e){d.consentDialog(!1),o.error({code:e.code,name:e.name,message:e.message})})}else d.consentDialog(!1),X(e,a,c,o,v)}).catch(function(e){d.consentDialog(!1),o.error("enumerateDevices error",e)})}else X(e,a,c,o)}function J(e,n){(n=n||{}).success="function"==typeof n.success?n.success:s.noop,n.error="function"==typeof n.error?n.error:er;var r=n.jsep,i=E[e];if(null==i||null===i.webrtcStuff||void 0===i.webrtcStuff)return s.warn("Invalid handle"),void n.error("Invalid handle");var o=i.webrtcStuff;if(null!=r){if(null===o.pc)return s.warn("Wait, no PeerConnection?? if this is an answer, use createAnswer and not handleRemoteJsep"),void n.error("No PeerConnection: if this is an answer, use createAnswer and not handleRemoteJsep");o.pc.setRemoteDescription(r).then(function(){if(s.log("Remote description accepted!"),o.remoteSdp=r.sdp,o.candidates&&o.candidates.length>0){for(var e in o.candidates){var i=o.candidates[e];s.debug("Adding remote candidate:",i),i&&!0!==i.completed?o.pc.addIceCandidate(i):o.pc.addIceCandidate()}o.candidates=[]}n.success()},n.error)}else n.error("Invalid JSEP")}function K(e,n){var r=E[e];if(null==r||null===r.webrtcStuff||void 0===r.webrtcStuff)return s.warn("Invalid handle"),2;var i=n?"remote":"local",o=r.webrtcStuff;return o.volume[i]||(o.volume[i]={value:2}),null===o.pc||void 0===o.pc?2:o.pc.getStats&&"chrome"===s.webRTCAdapter.browserDetails.browser?n&&(null===o.remoteStream||void 0===o.remoteStream)?(s.warn("Remote stream unavailable"),2):n||null!==o.myStream&&void 0!==o.myStream?null===o.volume[i].timer||void 0===o.volume[i].timer?(s.log("Starting "+i+" volume monitor"),o.volume[i].timer=setInterval(function(){o.pc.getStats().then(function(e){for(var r=0;r<e.length;r++){var s=e[r];"ssrc"==s.type&&void 0!==o.volume[i]&&(n&&s.stat("audioOutputLevel")?o.volume[i].value=parseInt(s.stat("audioOutputLevel")):!n&&s.stat("audioInputLevel")&&(o.volume[i].value=parseInt(s.stat("audioInputLevel"))))}})},200),2):o.volume[i].value:(s.warn("Local stream unavailable"),2):(s.warn("Getting the "+i+" volume unsupported by browser"),2)}function Y(e,n){var r=E[e];if(null==r||null===r.webrtcStuff||void 0===r.webrtcStuff)return s.warn("Invalid handle"),!0;var i=r.webrtcStuff;return null===i.pc||void 0===i.pc?(s.warn("Invalid PeerConnection"),!0):void 0===i.myStream||null===i.myStream?(s.warn("Invalid local MediaStream"),!0):n?null===i.myStream.getVideoTracks()||void 0===i.myStream.getVideoTracks()||0===i.myStream.getVideoTracks().length?(s.warn("No video track"),!0):!i.myStream.getVideoTracks()[0].enabled:null===i.myStream.getAudioTracks()||void 0===i.myStream.getAudioTracks()||0===i.myStream.getAudioTracks().length?(s.warn("No audio track"),!0):!i.myStream.getAudioTracks()[0].enabled}function Q(e,n,r){var i=E[e];if(null==i||null===i.webrtcStuff||void 0===i.webrtcStuff)return s.warn("Invalid handle"),!1;var o=i.webrtcStuff;return null===o.pc||void 0===o.pc?(s.warn("Invalid PeerConnection"),!1):void 0===o.myStream||null===o.myStream?(s.warn("Invalid local MediaStream"),!1):n?null===o.myStream.getVideoTracks()||void 0===o.myStream.getVideoTracks()||0===o.myStream.getVideoTracks().length?(s.warn("No video track"),!1):(o.myStream.getVideoTracks()[0].enabled=!r,!0):null===o.myStream.getAudioTracks()||void 0===o.myStream.getAudioTracks()||0===o.myStream.getAudioTracks().length?(s.warn("No audio track"),!1):(o.myStream.getAudioTracks()[0].enabled=!r,!0)}function Z(e){var n=E[e];if(null==n||null===n.webrtcStuff||void 0===n.webrtcStuff)return s.warn("Invalid handle"),"Invalid handle";var r=n.webrtcStuff;return null===r.pc||void 0===r.pc?"Invalid PeerConnection":r.pc.getStats?null===r.bitrate.timer||void 0===r.bitrate.timer?(s.log("Starting bitrate timer (via getStats)"),r.bitrate.timer=setInterval(function(){r.pc.getStats().then(function(e){e.forEach(function(e){if(e){var n=!1;if(("video"===e.mediaType||e.id.toLowerCase().indexOf("video")>-1)&&"inbound-rtp"===e.type&&0>e.id.indexOf("rtcp")?n=!0:"ssrc"==e.type&&e.bytesReceived&&("VP8"===e.googCodecName||""===e.googCodecName)&&(n=!0),n)if(r.bitrate.bsnow=e.bytesReceived,r.bitrate.tsnow=e.timestamp,null===r.bitrate.bsbefore||null===r.bitrate.tsbefore)r.bitrate.bsbefore=r.bitrate.bsnow,r.bitrate.tsbefore=r.bitrate.tsnow;else{var i=r.bitrate.tsnow-r.bitrate.tsbefore;"safari"==s.webRTCAdapter.browserDetails.browser&&(i/=1e3);var o=Math.round(8*(r.bitrate.bsnow-r.bitrate.bsbefore)/i);"safari"===s.webRTCAdapter.browserDetails.browser&&(o=parseInt(o/1e3)),r.bitrate.value=o+" kbits/sec",r.bitrate.bsbefore=r.bitrate.bsnow,r.bitrate.tsbefore=r.bitrate.tsnow}}})})},1e3),"0 kbits/sec"):r.bitrate.value:(s.warn("Getting the video bitrate unsupported by browser"),"Feature unsupported by browser")}s.dataChanDefaultLabel="JanusDataChannel",e.brtc_v2?function(n){var r=s.randomString(12),i={[j]:"setup",enable_multistream:!0,version:"brtc_v2"},p={plugin:"janus.plugin.videoroom",session_config:{userevent:!0,sessionevent:!0},app_id:n.appid,room_name:n.roomname,id:n.userid,display:n.displayname,token:"no_token",ptype:n.role,room_config:{publishers:100,videocodec:"H264",audiocodec:"opus"}};if(void 0!==n.sdktag&&null!==n.sdktag&&(i.sdktag=n.sdktag),void 0!==n.mediaserverip&&null!==n.mediaserverip&&(p.session_config.janusIp=n.mediaserverip),i.body=p,i.transaction=r,i.uri=f.split("?")[0],o)for(var h in a=s.newWebSocket(f,A),c={error:function(){(s.error("Error connecting to the Janus WebSockets server... "+f),s.isArray(l)&&!n.reconnect)?++u==l.length?n.error("Error connecting to any of the provided Janus servers: Is the server down?"):(f=null,setTimeout(function(){L(n)},200)):n.error("Error connecting to the Janus WebSockets server: Is the server down?")},open:function(){k[r]=function(e){"setuped"!==e[j]?(s.error("Ooops: "+e.error.code+" "+e.error.reason),n.error(e.error.reason)):(d=setTimeout(N,w),R=!0,T=e.session_id?e.session_id:e.data.id,s.sessions[T]=O,M="brtc_v2",e.data.version&&(M=e.data.version),n.onsetup(e))},a.send(JSON.stringify(i))},message:function(e){B(JSON.parse(e.data))},close:function(){null!==f&&R&&(R=!1,e.error("Lost connection to the server (is it down?)"))}})a.addEventListener(h,c[h])}(e):e.brtc_v4?(j="janus",A="janus-protocol",s.dataChanDefaultLabel="BRTC_SERVER_P2P_EVENT",function(n){var r=s.randomString(12),i={[j]:"brtc_join",version:"brtc_v4"},l={appId:n.appid,roomName:n.roomname,userId:n.userid,display:n.displayname,token:n.token,roomConfig:{videoCodec:"h264",audioCodec:"opus",subscribeMode:n.v4_submode},sessionConfig:{},participants:n.v4_participants};if(void 0!==n.sdktag&&null!==n.sdktag&&(l.sessionConfig.sdktag=n.sdktag),void 0!==n.mediaserverip&&null!==n.mediaserverip&&(l.sessionConfig.mediaserverip=n.mediaserverip),void 0!==n.videocodec&&null!==n.videocodec&&(l.roomConfig.videoCodec=n.videocodec),void 0!==n.audiocodec&&null!==n.audiocodec&&(l.roomConfig.audioCodec=n.audiocodec),"object"==typeof n.rtmp&&null!==n.rtmp&&(l.roomConfig.rtmp=n.rtmp),i.body=l,i.transaction=r,o)for(var u in a=s.newWebSocket(f,A),c={error:function(){s.error("Error connecting to the BRTC WebSockets server... "+f),n.error("Error connecting to the BRTC WebSockets server: Is the server down?")},open:function(){k[r]=function(e){"brtc_joined"!==e[j]?(s.error("Ooops: "+e.error.code+" "+e.error.reason),n.error(e.error.reason)):(d=setTimeout(N,w),R=!0,T=e.session_id?e.session_id:e.data.id,s.sessions[T]=O,M="brtc_v4",e.data.version&&(M=e.data.version),n.onv4joined(e))},a.send(JSON.stringify(i))},message:function(e){B(JSON.parse(e.data))},close:function(){null!==f&&R&&(R=!1,e.error("Lost connection to the server (is it down?)"))}})a.addEventListener(u,c[u])}(e)):(e.brtc_render&&(j="brtc",A="brtc-protocol"),L(e)),this.getServer=function(){return f},this.isConnected=function(){return R},this.reconnect=function(e){(e=e||{}).success="function"==typeof e.success?e.success:s.noop,e.error="function"==typeof e.error?e.error:s.noop,e.reconnect=!0,L(e)},this.getSessionId=function(){return T},this.getRoomName=function(){return C},this.getUserID=function(){return x},this.destroy=function(n){!function(n){(n=n||{}).success="function"==typeof n.success?n.success:s.noop;var r=!0;void 0!==n.asyncRequest&&null!==n.asyncRequest&&(r=!0===n.asyncRequest);var i=!0;void 0!==n.notifyDestroyed&&null!==n.notifyDestroyed&&(i=!0===n.notifyDestroyed);var l=!1;if(void 0!==n.cleanupHandles&&null!==n.cleanupHandles&&(l=!0===n.cleanupHandles),s.log("Destroying session "+T+" (async="+r+")"),!R)return s.warn("Is the server down? (connected=false)"),n.success();if(null==T)return s.warn("No session to destroy"),n.success(),i&&e.destroyed();if(l)for(var u in E)W(u,{noRequest:!0});var p={[j]:"destroy",transaction:s.randomString(12)};if(null!=b&&(p.token=b),null!=_&&(p.apisecret=_),o){p.session_id=T;var h=function(){for(var e in c)a.removeEventListener(e,c[e]);a.removeEventListener("message",m),a.removeEventListener("error",v),d&&clearTimeout(d),a.close()},m=function(r){var o=JSON.parse(r.data);o.session_id==p.session_id&&o.transaction==p.transaction&&(h(),n.success(),i&&e.destroyed())},v=function(r){h(),n.error("Failed to destroy the server: Is the server down?"),i&&e.destroyed()};return a.addEventListener("message",m),a.addEventListener("error",v),1==a.readyState&&a.send(JSON.stringify(p))}s.httpAPICall(f+"/"+T,{verb:"POST",async:r,withCredentials:g,body:p,success:function(r){s.log("Destroyed session:"),s.debug(r),T=null,R=!1,"success"!==r[j]&&s.error("Ooops: "+r.error.code+" "+r.error.reason),n.success(),i&&e.destroyed()},error:function(r,o){s.error(r+":",o),T=null,R=!1,n.success(),i&&e.destroyed()}})}(n)},this.attach=function(e,n){F(e,n)},this.attachv4=function(e,n,r,i){F(e,n,r,i)},this.send=function(e){var n=e;if((n=n||{}).success="function"==typeof n.success?n.success:s.noop,n.error="function"==typeof n.error?n.error:s.noop,R){var r=n.message,i=s.randomString(12),c={[j]:"message",body:r,transaction:i};o&&(c.session_id=T,k[i]=function(e){if("success"===e[j]){var r=e.data;return null==r?(s.warn("Request succeeded, but missing data..."),void n.success()):void n.success(r)}n.success()},a.send(JSON.stringify(c)))}},this.sendlog=function(e){var n=e;if((n=n||{}).success="function"==typeof n.success?n.success:s.noop,n.error="function"==typeof n.error?n.error:s.noop,R){var r=n.log,i=s.randomString(12),c={[j]:"sdklog",log:r,transaction:i};o&&(c.session_id=T,a.send(JSON.stringify(c)))}},this.doaction=function(e,n){var r=e,i=n;if((i=i||{}).success="function"==typeof i.success?i.success:s.noop,i.error="function"==typeof i.error?i.error:s.noop,R){var c=s.randomString(12),d=r||{};(r={})[[j]]="bdcrender",(r=Object.assign({},r,d)).transaction=c,o&&(r.session_id=T,k[c]=function(e){if(i.response="function"==typeof i.response?i.response:s.noop,i.response(e),"success"!==e.action)"success"!==e.status?"failure"!==e.status?i.success():i.error(e):(n=e.data,i.success(n));else{var n=e.data;i.success(n)}},a.send(JSON.stringify(r)))}},this.onmessage=function(n){e.onmessage(n)},this.onuserevent=function(n){e.onuserevent(n)},this.onsessionevent=function(n){e.onsessionevent(n)},this.onbdcrevent=function(n){e.onbdcrevent(n)},this.V2setup=function(e){if(o){let n=s.randomString(12),r=e.request;return k[n]=function(n){e.onsetup(n)},r.session_id=T,r.transaction=n,void a.send(JSON.stringify(r))}};let ee=null,et=[],en=[];function er(e){s.error("WebRTC error:",e)}function ei(e,n){s.log("Cleaning WebRTC stuff");var r=E[e];if(null!=r){var i=r.webrtcStuff;if(null!=i){if(!0===n){var c={[j]:"hangup",transaction:s.randomString(12)};null!==r.token&&void 0!==r.token&&(c.token=r.token),null!=_&&(c.apisecret=_),s.debug("Sending hangup request (handle="+e+"):"),s.debug(c),o?(c.session_id=T,c.handle_id=e,a.send(JSON.stringify(c))):s.httpAPICall(f+"/"+T+"/"+e,{verb:"POST",withCredentials:g,body:c})}i.remoteStream=null,i.volume&&(i.volume.local&&i.volume.local.timer&&clearInterval(i.volume.local.timer),i.volume.remote&&i.volume.remote.timer&&clearInterval(i.volume.remote.timer)),i.volume={},i.bitrate.timer&&clearInterval(i.bitrate.timer),i.bitrate.timer=null,i.bitrate.bsnow=null,i.bitrate.bsbefore=null,i.bitrate.tsnow=null,i.bitrate.tsbefore=null,i.bitrate.value=null,i.fps.timer&&clearInterval(i.fps.timer),i.fps.timer=null,i.fps.fsnow=null,i.fps.fsbefore=null,i.fps.tsnow=null,i.fps.tsbefore=null,i.fps.value=null;try{if(!i.streamExternal&&null!==i.myStream&&void 0!==i.myStream){s.log("Stopping local stream tracks");var d=i.myStream.getTracks();for(var l in d){var u=d[l];s.log(u),null!=u&&u.stop()}}}catch(e){}i.streamExternal=!1,i.myStream=null;try{i.pc.close()}catch(e){}i.pc=null,i.candidates=null,i.mySdp=null,i.remoteSdp=null,i.iceDone=!1,i.dataChannel={},i.dtmfSender=null}r.oncleanup()}}function eo(e){return s.debug("isAudioSendEnabled:",e),null==e||!1!==e.audio&&(void 0===e.audioSend||null===e.audioSend||!0===e.audioSend)}function es(e){return s.debug("isAudioRecvEnabled:",e),null==e||!1!==e.audio&&(void 0===e.audioRecv||null===e.audioRecv||!0===e.audioRecv)}function ea(e){return s.debug("isVideoSendEnabled:",e),null==e||!1!==e.video&&(void 0===e.videoSend||null===e.videoSend||!0===e.videoSend)}function ec(e){return s.debug("isVideoRecvEnabled:",e),null==e||!1!==e.video&&(void 0===e.videoRecv||null===e.videoRecv||!0===e.videoRecv)}}function a(){var e="janus.plugin.videoroom",n=s.randomString(12),r="-id-"+n;this.setThisDomID=function(e){r=e};var i=!1,o=!1,a=!1,c=null,d=null,l=null,u=null,f=null,p="brtc-client-"+n,h=!1,m=null,v=null,g=null,y=null,b=[],_=[],w=[],S=[],R=[],T=[],C=null,x=null,E=null,O=null,I="",k=null,M=10,P="h264",j=null,A=!0,D=!1,B=!1,N=!0,L=!0,U=!0,F=!0;let H=null,q=1500;var V=null,z=!1,G=!1,W=!1,X=!0,$=!0,J=!1,K=!1,Y=1e4,Q="",Z=!0,ee=null,et="",en=!1,er=null,ei=18e4,eo=null,es=null,ea=null,ec=null,ed=function(){},el=!0,eu=!0,ef=!1,ep=!1,eh=!0;let em=null,ev=null,eg=null;var ey=function(){},eb=function(){},e_=function(){},ew=function(){},eS=function(){},eR=function(){},eT=function(){},eC=function(){},ex=function(){tI(!0)},eE=function(){},eO=function(e){},eI=function(e){},ek=function(e){},eM=function(e){},eP=function(e){},ej=function(e){},eA=function(){},eD=function(e){},eB=function(e,n){},eN=function(e,n){},eL=function(e,n){},eU=function(e,n,r){},eF=function(e){},eH=function(e){},eq=function(e){},eV=[],ez=[],eG=function(e){},eW=function(e){},eX=!1,e$=function(){},eJ={using_video:!0,using_audio:!0,mirrorlocalvideo:!0,remoteaudioid:"",videoprofile:"hires",videoDeviceId:null,audioDeviceId:null,audioOutputDeviceId:null,myStream:null,onlocalstream:function(){}};let eK={serverUrl:"https://rtc-log.cdn.bcebos.com/collect",defaultOpen:!0,gatherInterval:2,uploadInterval:10};var eY=!1,eQ="online";let eZ=null;var e0=function(){},e1=function(){},e2=function(){},e3=function(){},e4=!1,e5="hires",e6="raw",e8=!0,e9=null,e7=null,te=null,tt=[{ptype:"publisher",sdpInfo:{}},{ptype:"subscriber",streamCreateMode:"pre_create",sdpInfo:{}}],tn=!1;function tr(e,n){e?e1(n):e0(n)}function ti(e){return new to.init(e)}var to={init:function(e){if(!e)return this;if("string"==typeof e){var n=document.getElementById(e.substring(1)+r);return n||(n=document.getElementById(e.substring(1))),n?(this[0]=n,this.length=1,this.append=function(e){if(null!=n){var r=document.createElement("div"),i=document.createDocumentFragment();r.innerHTML=e;for(var o=0,s=r.children,a=s.length;o<a;o++)i.appendChild(s[0]);return n.appendChild(i),s=null,i=null,r=null,n}},this.remove=function(){null!=n&&null!=n.parentNode&&n.parentNode.removeChild(n)},this.attr=function(e,r){if(null!=n)return n.setAttribute(e,r),this[0]=n,this.length=1,this},this.unbind=function(e){return n},this.empty=function(){return n.innerHTML="",n},this.hide=function(){null!=n&&(n.style.display="none")},this.removeClass=function(e){if(null!=n)return n.classList.remove(e),this[0]=n,this.length=1,this.show=function(){null!=n&&(n.style.display=0)},this.text=function(e){if(null!=n)return n.innerHTML=e,this[0]=n,this.length=1,this.show=function(){null!=n&&(n.style.display=0)},this},this},this.show=function(){null!=n&&("none"===n.style.display?n.style.display="inline-block":n.style.display=0)},this.get=function(e){return n},this.bind=function(e,r){n.addEventListener(e,r)},this.text=function(e){null!=n&&(n.innerHTML=e)}):(this.length=0,this.remove=function(){},this.removeClass=function(){},this.append=function(e){},this.empty=function(e){},this.text=function(e){},this.get=function(e){return null},this.hide=function(){},this.show=function(){}),this}}};function ts(){g&&g.getVideoTracks().forEach(function(e){e.stop()})}this.BRTC_Start=function(n){if(console.log("BRTC_Start: "+window.BRTC_Version()),(n=n||{}).success="function"==typeof n.success?n.success:function(){},n.error="function"==typeof n.error?n.error:function(){},n.destroyed="function"==typeof n.destroyed?n.destroyed:function(){},n.onlocalstream="function"==typeof n.onlocalstream?n.onlocalstream:function(){},n.onlocalstream_end="function"==typeof n.onlocalstream_end?n.onlocalstream_end:function(){},n.onmessage="function"==typeof n.onmessage?n.onmessage:function(){},n.onattribute="function"==typeof n.onattribute?n.onattribute:function(){},c=null!==n.server&&void 0!==n.server?n.server:"wss://rtc.exp.bcelive.com/janus",i=!1,o=!1,a=!1,er=null,e="janus.plugin.videoroom","boolean"==typeof n.multistream&&(i=n.multistream),"boolean"==typeof n.v4&&(o=n.v4),n.bdcruserid&&n.projectid&&(a=!0),"boolean"==typeof n.brtc_render&&(a=n.brtc_render),n.displayname&&n.displayname.includes("BRTC_V2_MS_FLAG")&&(i=!0),n.displayname&&n.displayname.includes("BRTC_V4_FLAG")&&(o=!0),null!==n.videocodec&&void 0!==n.videocodec&&(P=n.videocodec),null!==n.audiocodec&&void 0!==n.audiocodec&&(j=n.audiocodec),tw(n),null!==n.logintimeout&&void 0!==n.logintimeout&&(Y=n.logintimeout),null!==n.logintimeoutevent&&void 0!==n.logintimeoutevent&&(eE=n.logintimeoutevent),null!==n.remotevideoloading&&void 0!==n.remotevideoloading&&(eO=n.remotevideoloading),null!==n.statsconfig&&void 0!==n.statsconfig){let e=n.statsconfig;null!==e.serverurl&&void 0!==e.serverurl&&(eK.serverUrl=e.serverurl),null!==e.gatherinterval&&void 0!==e.gatherinterval&&parseInt(e.gatherinterval,10)&&(eK.gatherInterval=e.gatherinterval),null!==e.uploadinterval&&void 0!==e.uploadinterval&&parseInt(e.uploadinterval,10)&&(eK.uploadInterval=e.uploadinterval)}if(null!==n.linkdownupthreshold&&void 0!==n.linkdownupthreshold&&n.linkdownupthreshold,null!==n.linkdownevent&&void 0!==n.linkdownevent&&(e0=n.linkdownevent),null!==n.mediastate&&void 0!==n.mediastate&&(e2=n.mediastate),null!==n.linkupevent&&void 0!==n.linkupevent&&(e1=n.linkupevent),setTimeout(function(){null===l&&eE()},Y),null!==n.userevent&&void 0!==n.userevent&&(el=n.userevent),null!==n.sessionevent&&void 0!==n.sessionevent&&(eu=n.sessionevent),"boolean"==typeof n.usingremotemediastate&&n.usingremotemediastate?(e3=n.remotemediastating,ef=!0):ef=!1,"function"==typeof n.userevent_joinedroom&&(eN=n.userevent_joinedroom),"function"==typeof n.userevent_leavingroom&&(eL=n.userevent_leavingroom),"function"==typeof n.onrtmpstreaming&&(eU=n.onrtmpstreaming),"function"==typeof n.onrecording&&(eF=n.onrecording),"function"==typeof n.onmsgdelayinfo&&(eH=n.onmsgdelayinfo),"function"==typeof n.onbdcrdevicelocked&&(eq=n.onbdcrdevicelocked),"function"==typeof n.a&&n.a("shaohongsheng@baidu.com"),c=a?c+"?projectid="+n.projectid+"&appid="+n.appid+"&bdcruserid="+n.bdcruserid+"&token="+n.token:c+"?appid="+n.appid+"&roomname="+encodeURIComponent(n.roomname)+"&uid="+n.userid+"&token="+n.token,(i||o)&&(c+="&enable_multistream=true"),o&&(c+="&enablePruneSignal=true"),"string"==typeof n.tag&&(c=c+"&tag="+encodeURIComponent(n.tag)),("boolean"!=typeof n.compulsive||n.compulsive)&&(c+="&compulsive=true"),!h)if(h=!0,ey=n.success,eb=n.error,e_=n.destroyed,ew=n.onlocalstream,eS=n.onlocalstream_end,eW=n.onattribute,eG=n.onmessage,null!==n.remotevideoon&&void 0!==n.remotevideoon&&(eI=n.remotevideoon),null!==n.remotevideooff&&void 0!==n.remotevideooff&&(ek=n.remotevideooff),null!==n.remotevideocoming&&void 0!==n.remotevideocoming&&(eP=n.remotevideocoming),null!==n.remotevideoleaving&&void 0!==n.remotevideoleaving&&(ej=n.remotevideoleaving),null!==n.remotevideounpublished&&void 0!==n.remotevideounpublished&&(eD=n.remotevideounpublished),null!==n.remotedata&&void 0!==n.remotedata&&(eB=n.remotedata),null!==n.localvideopublishing&&void 0!==n.localvideopublishing&&(eR=n.localvideopublishing),"function"==typeof n.localvideoconnected_state&&(eT=n.localvideoconnected_state),null!==n.localvideopublished_ok&&void 0!==n.localvideopublished_ok&&(eC=n.localvideopublished_ok),null!==n.localvideopublished_closed&&void 0!==n.localvideopublished_closed&&(ex=n.localvideopublished_closed),"function"==typeof n.remotevideoconnected_state&&(eA=n.remotevideoconnected_state),null!==n.remotevideo_closed&&void 0!==n.remotevideo_closed&&(eM=n.remotevideo_closed),s.isWebrtcSupported()){if(x=n.roomname,O=n.userid,I=n.bdcruserid,C=n.appid,k=n.displayname,A||(k+=":web_listener"),E="publisher",o)return this.BRTC_MuteCamera=this.v4hook_BRTC_MuteCamera,this.BRTC_MuteRemoteVideo=this.v4hook_BRTC_MuteRemoteVideo,this.BRTC_MuteRemoteAudio=this.v4hook_BRTC_MuteRemoteAudio,this.BRTC_SwitchScreen=this.v4hook_BRTC_SwitchScreen,this.BRTC_StopPublish=this.v4hook_BRTC_StopPublish,this.BRTC_StopSubscribeStreaming=this.v4hook_BRTC_StopSubscribeStreaming,e="brtc.plugin.videoroom",void new Promise((e,n)=>{var r=new RTCPeerConnection;r.addTransceiver("audio",{direction:"sendonly"}),r.addTransceiver("video",{direction:"sendonly"}),r.createDataChannel("brtc",{ordered:!0});var i=r.createOffer().then(function(e){return new Promise((n,r)=>{e.ptype="publisher",n(e)})});e7=r,(r=new RTCPeerConnection).addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),r.addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),r.addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),r.addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),r.addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),r.createDataChannel("brtc",{ordered:!0}),Promise.all([i,r.createOffer().then(function(e){return new Promise((n,r)=>{e.ptype="subscriber",n(e)})})]).then(function(n){for(var r in n){var i=n[r];"publisher"===i.ptype?(tt[0].sdpInfo=tC(i.sdp),e7.sdp=i.sdp,e7.setLocalDescription(i)):"subscriber"===i.ptype&&(tt[1].sdpInfo=tC(i.sdp),i.sdp=function(e,n){var r="v=0\r\no=- 847999349747732714 2 IN IP4 127.0.0.1\r\ns=VideoRoom 1393329176\r\nt=0 0";return r+="\r\na=group:BUNDLE",n.forEach(e=>{r+=" "+e.mid}),r+="\r\na=msid-semantic: WMS brtc",n.forEach(n=>{"data"===n.type?r+="\r\nm=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 0.0.0.0\r\na=setup:actpass\r\na=mid:"+n.mid+"\r\na=recvonly\r\na=ice-ufrag:"+e.clientIceUfrag+"\r\na=ice-pwd:"+e.clientIcePwd+"\r\na=ice-options:trickle\r\na=fingerprint:"+e.clientDtlsHashing+" "+e.clientDtlsFingerprint+"\r\na=sctp-port:5000\r\na=sctmap:5000 webrtc-datachannel 16":"opus"===n.codec?r+="\r\nm=audio 9 UDP/TLS/RTP/SAVPF "+n.pt+"\r\nc=IN IP4 0.0.0.0\r\na=setup:actpass\r\na=mid:"+n.mid+"\r\na=recvonly\r\na=rtcp-mux\r\na=ice-ufrag:"+e.clientIceUfrag+"\r\na=ice-pwd:"+e.clientIcePwd+"\r\na=ice-options:trickle\r\na=fingerprint:"+e.clientDtlsHashing+" "+e.clientDtlsFingerprint+"\r\na=rtpmap:"+n.pt+" opus/48000/2\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=rtcp-fb:"+n.pt+" transport-cc\r\na=fmtp:"+n.pt+" minptime=10;useinbandfec=1\r\na=rtcp-fb:"+n.pt+" nack\r\na=rtcp-xr\r\na=ssrc:"+n.ssrc+" cname:brtc-audio":"pcmu"===n.codec?r+="\r\nm=audio 9 UDP/TLS/RTP/SAVPF "+n.pt+"\r\nc=IN IP4 0.0.0.0\r\na=setup:actpass\r\na=mid:"+n.mid+"\r\na=recvonly\r\na=rtcp-mux\r\na=ice-ufrag:"+e.clientIceUfrag+"\r\na=ice-pwd:"+e.clientIcePwd+"\r\na=ice-options:trickle\r\na=fingerprint:"+e.clientDtlsHashing+" "+e.clientDtlsFingerprint+"\r\na=rtpmap:"+n.pt+" PCMU/8000\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=rtcp-fb:"+n.pt+" transport-cc\r\na=rtcp-fb:"+n.pt+" nack\r\na=rtcp-xr\r\na=ssrc:"+n.ssrc+" cname:brtc-audio":"h264"===n.codec&&(r+="\r\nm=video 9 UDP/TLS/RTP/SAVPF "+n.pt+"\r\nc=IN IP4 0.0.0.0\r\na=setup:actpass\r\na=mid:"+n.mid+"\r\na=recvonly\r\na=rtcp-mux\r\na=ice-ufrag:"+e.clientIceUfrag+"\r\na=ice-pwd:"+e.clientIcePwd+"\r\na=ice-options:trickle\r\na=fingerprint:"+e.clientDtlsHashing+" "+e.clientDtlsFingerprint+"\r\na=rtpmap:"+n.pt+" H264/90000\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=rtcp-fb:"+n.pt+" transport-cc\r\na=rtcp-fb:"+n.pt+" ccm fir\r\na=rtcp-fb:"+n.pt+" nack\r\na=rtcp-fb:"+n.pt+" nack pli\r\na=fmtp:"+n.pt+" profile-level-id=42e01f;packetization-mode=1\r\na=rtcp-xr\r\na=ssrc:"+n.ssrc+" cname:brtc-video")}),r+="\r\n"}(tt[1].sdpInfo,tt[1].sdpInfo.streams),te.sdp=i.sdp,te.setLocalDescription(i))}e(n)}),te=r}).then(function(e){tO()});a&&(e="brtc.plugin.videoroom"),tO()}else eb("No WebRTC support... ")},this.BRTC_Stop=function(){tH({roomEvent:{userName:k+"("+O+")",eventDescription:"LEAVE_ROOM"}}),eb=function(){},ez=[],ts(),null!=d&&(d.destroy({cleanupHandles:!0}),d=null),null!=eZ&&window.clearInterval(eZ),b.forEach(e=>{e&&"object"==typeof e&&ti("#videoremote"+e.rfindex).remove()}),l=null,b=[],u=null,f=null,tn=!1,S={},w=[],T=[],eV=[],R=[],h=!1,eE=function(){},ti("#videoremote1").remove(),ti("#videolocal").remove(),ti("#videoremote2").remove(),ti("#videoremote3").remove(),ti("#videoremote4").remove(),ti("#videoremote5").remove()},this.BRTC_SendData=function(e,n){if(o){var r="BRTC_CLIENT_UNRELIABLE_MESSAGE";tD(JSON.stringify({type:r,from:parseInt(O,10),to:0,data:e}),r)}else tD(e,n)},this.BRTC_StopVideo=function(){ts()};let ta={};function tc(e){let n={update:!0,replaceVideo:e.getVideoTracks()&&e.getVideoTracks().length,replaceAudio:e.getAudioTracks()&&e.getAudioTracks().length,audioRecv:!1,videoRecv:!1,audioSend:!0,videoSend:!0};l.createOffer({media:n,stream:e,success(e){}})}function td(e){console.log("navigator.MediaDevices.getUserMedia error: ",e.message,e.name)}function tl(){g&&g.getAudioTracks().forEach(function(e){e.stop()})}function tu(e,n,r,i){if(null!==f){var o,a=[];if(void 0===r)"video"===e?a=["1","3","5","7","9"]:"audio"===e&&(a=["0","2","4","6","8"]);else{if(!_[r])return;_[r].streams.forEach(n=>{n.type===e&&"number"==typeof n.pullmid&&a.push(n.pullmid.toString())})}a.length>0&&(o=[],a.forEach(r=>{o.push({mid:r,type:e,receive:!n})}),tB(JSON.stringify({type:"BRTC_CLIENT_SIGNAL",data:{request:"configure",transaction:s.randomString(12),handleId:f.getId(),session_id:d.getSessionId(),streams:o}}),"BRTC_CLIENT_SIGNAL"))}}function tf(e,n){var r;if(r=tS(e?e6:e5),e){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return navigator.mediaDevices.getDisplayMedia({video:r,audio:n})}else if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia)return navigator.mediaDevices.getUserMedia({video:r,audio:n});return new Promise((e,n)=>{n("No webrtc getUser/DiplayMedia API")})}function tp(e){if(D)return e$=function(){setTimeout(function(){D=!D,tI(!0)},500)},eX=!0,void tM();var n=tS(e6);navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia&&navigator.mediaDevices.getDisplayMedia({video:n}).then(function(n){e&&e.success&&e.success("BRTC_SwitchScreen success."),e$=function(){setTimeout(function(){D=!D;var e=N;N=!0,tI(!0,!1,n),N=e},500)},eX=!0,tM()},function(n){e&&e.error&&e.error("BRTC_SwitchScreen error: "+n)})}function th(e){var n=!1;eV.some((r,i)=>!(!r||"object"!=typeof r||r.id!=e.id)&&(eV.splice(i,1),eV.push(e),n=!0,!0)),!1===n&&eV.push(e)}function tm(e){eV.some((n,r)=>!(!n||"object"!=typeof n||n.id!=e)&&(eV.splice(r,1),!0))}function tv(e,n){eV.some((r,i)=>!(!r||"object"!=typeof r||r.id!==e)&&(r.isleaving=n,!0))}function tg(e){var n=!1;return eV.some((r,i)=>!(!r||"object"!=typeof r||r.id!==e)&&(n="boolean"==typeof r.isleaving&&r.isleaving,!0)),n}function ty(e){var n=!1;return eV.some((r,i)=>!(!r||"object"!=typeof r||r.id!==e)&&(n=!0,!0)),n}function tb(e){ez.some((n,r)=>!(!n||"object"!=typeof n||n.id!=e)&&(ez.splice(r,1),!0))}function t_(e){eV.some((n,r)=>!(!n||"object"!=typeof n||n.id!=e.id)&&(eV[r].attribute=e.attribute,!0))}function tw(e){if(null!==e.videoprofile&&void 0!==e.videoprofile&&(e5=e.videoprofile),null!==e.screensharevideoprofile&&void 0!==e.screensharevideoprofile&&(e6=e.screensharevideoprofile),null!==e.aspublisher&&void 0!==e.aspublisher&&(A=e.aspublisher),null!==e.aslistener&&void 0!==e.aslistener&&e.aslistener,null!==e.usingdatachannel&&void 0!==e.usingdatachannel&&(B=e.usingdatachannel),null!==e.usingvideo&&void 0!==e.usingvideo&&(N=e.usingvideo),null!==e.usingaudio&&void 0!==e.usingaudio&&(L=e.usingaudio),null!==e.receivingvideo&&void 0!==e.receivingvideo&&(U=e.receivingvideo),null!==e.receivingaudio&&void 0!==e.receivingaudio&&(F=e.receivingaudio),null!==e.bitrate&&void 0!==e.bitrate&&(H=e.bitrate),null!==e.audiobitrate&&void 0!==e.audiobitrate&&(V=e.audiobitrate),null!==e.audiostereo&&void 0!==e.audiostereo&&(z=e.audiostereo),null!==e.screenbitrate&&void 0!==e.screenbitrate&&(q=e.screenbitrate),null!==e.showvideobps&&void 0!==e.showvideobps&&(G=e.showvideobps),null!==e.shownovideo&&void 0!==e.shownovideo&&(eh=e.shownovideo),null!==e.sharescreen&&void 0!==e.sharescreen&&(D=e.sharescreen),null!==e.showspinner&&void 0!==e.showspinner&&(K=e.showspinner),null!==e.autoplaymuted&&void 0!==e.autoplaymuted&&(W=e.autoplaymuted),null!==e.autosubscribe&&void 0!==e.autosubscribe&&(X=e.autosubscribe),null!==e.autopublish&&void 0!==e.autopublish&&($=e.autopublish),null!==e.autoresubscribing&&void 0!==e.autoresubscribing&&e.autoresubscribing,null!==e.v4autostreaming&&void 0!==e.v4autostreaming&&(J=e.v4autostreaming),null!==e.rtmpserver&&void 0!==e.rtmpserver&&(Q=e.rtmpserver),null!==e.rtmpmix&&void 0!==e.rtmpmix&&(Z=e.rtmpmix),null!==e.rtmpmixtemplate&&void 0!==e.rtmpmixtemplate&&(ee=e.rtmpmixtemplate),null!==e.rtmpmixlayoutindex&&void 0!==e.rtmpmixlayoutindex&&(et=e.rtmpmixlayoutindex),null!==e.recording&&void 0!==e.recording&&(en=e.recording),Q.includes("rtmp")&&((er={}).url=Q,er.mix=Z,"string"==typeof ee&&""!==ee&&(er.mixTemplate=ee),"object"==typeof ee&&null!==ee&&(er.mixTranscodingCfg=ee,delete er.mix)),null!==e.waitpermissiontimeoutms&&void 0!==e.waitpermissiontimeoutms&&(ei=e.waitpermissiontimeoutms),null!==e.candidateip&&void 0!==e.candidateip&&(eo=e.candidateip),null!==e.candidateport&&void 0!==e.candidateport&&(es=e.candidateport),null!==e.mediaserverip&&void 0!==e.mediaserverip&&(ea=e.mediaserverip),null!==e.videodeviceid&&void 0!==e.videodeviceid&&(em=e.videodeviceid),null!==e.audiodeviceid&&void 0!==e.audiodeviceid&&(ev=e.audiodeviceid),null!==e.audiooutputdeviceid&&void 0!==e.audiooutputdeviceid&&(eg=e.audiooutputdeviceid),null!==e.mirrorlocalvideo&&void 0!==e.mirrorlocalvideo&&(e4=e.mirrorlocalvideo),null!==e.reportmonitordata&&void 0!==e.reportmonitordata&&(eY=e.reportmonitordata),null!==e.reportenv&&void 0!==e.reportenv&&(eQ=e.reportenv),null!==e.debuglevel&&void 0!==e.debuglevel&&(ep=e.debuglevel),null!==e.stream&&void 0!==e.stream&&(ec=e.stream),null!==e.ongetsharescreenstream&&void 0!==e.ongetsharescreenstream&&(ed=e.ongetsharescreenstream),"videoremote1"!=e.remotevideoviewid&&"string"==typeof e.remotevideoviewid&&(ti("#videoremote1"+r).remove(),ti("#"+e.remotevideoviewid).append('<div style="width: 100%;height: 100%;" id="videoremote1'+r+'"></div>')),"videolocal"!=e.localvideoviewid&&"string"==typeof e.localvideoviewid&&(ti("#videolocal"+r).remove(),ti("#"+e.localvideoviewid).append('<div style="width: 100%;height: 100%;" id="videolocal'+r+'"></div>')),"videoremote2"!=e.remotevideoviewid2&&"string"==typeof e.remotevideoviewid2&&(ti("#videoremote2"+r).remove(),ti("#"+e.remotevideoviewid2).append('<div style="width: 100%;height: 100%;" id="videoremote2'+r+'"></div>')),"videoremote3"!=e.remotevideoviewid3&&"string"==typeof e.remotevideoviewid3&&(ti("#videoremote3"+r).remove(),ti("#"+e.remotevideoviewid3).append('<div style="width: 100%;height: 100%;" id="videoremote3'+r+'"></div>')),"videoremote4"!=e.remotevideoviewid4&&"string"==typeof e.remotevideoviewid4&&(ti("#videoremote4"+r).remove(),ti("#"+e.remotevideoviewid4).append('<div style="width: 100%;height: 100%;" id="videoremote4'+r+'"></div>')),"videoremote5"!=e.remotevideoviewid5&&"string"==typeof e.remotevideoviewid5&&(ti("#videoremote5"+r).remove(),ti("#"+e.remotevideoviewid5).append('<div style="width: 100%;height: 100%;" id="videoremote5'+r+'"></div>')),o&&!X){if(!document.getElementById("v4videos"+r)){var n=document.createElement("div");n.style="width: 240; height: 240px; display: none;",n.id="v4videos"+r,document.body.appendChild(n)}document.getElementById("videoremote1"+r)||ti("#v4videos").append('<div style="width: 100%;height: 100%;" id="videoremote1'+r+'"></div>'),document.getElementById("videoremote2"+r)||ti("#v4videos").append('<div style="width: 100%;height: 100%;" id="videoremote2'+r+'"></div>'),document.getElementById("videoremote3"+r)||ti("#v4videos").append('<div style="width: 100%;height: 100%;" id="videoremote3'+r+'"></div>'),document.getElementById("videoremote4"+r)||ti("#v4videos").append('<div style="width: 100%;height: 100%;" id="videoremote4'+r+'"></div>'),document.getElementById("videoremote5"+r)||ti("#v4videos").append('<div style="width: 100%;height: 100%;" id="videoremote5'+r+'"></div>')}}function tS(e){var n=!0;if("raw"===e)n=!0;else if("object"==typeof e)n=e;else{var r=0,i=0;if("lowres"===e?(i=240,r=320):"lowres-16:9"===e?(i=180,r=320):"hires"===e||"hires-16:9"===e||"hdres"===e?(i=720,r=1280):"fhdres"===e?(i=1080,r=1920):"4kres"===e?(i=2160,r=3840):(i="stdres"===e?480:"stdres-16:9"===e?360:480,r=640),n={height:{ideal:i},width:{ideal:r}},e.includes("x")){var o=e.split("x"),s=o[0],a=o[1].split("@"),c=a[0],d=15;a.length>1&&(d=a[1]),n={height:{ideal:c},width:{ideal:s}},a.length>1&&(n.frameRate={},n.frameRate.ideal=d)}}return n}function tR(e,n,r){if((r=r||{}).success="function"==typeof r.success?r.success:function(){},r.error="function"==typeof r.error?r.error:function(){},!e&&!n)return tT(),eJ.using_video=e,void(eJ.using_audio=n);var i=e;if(e&&(i=tS(eJ.videoprofile),null!==eJ.videoDeviceId&&void 0!==eJ.videoDeviceId&&"default"!==eJ.videoDeviceId)){let e={exact:eJ.videoDeviceId};i.deviceId=e}var o=n;if(null!==eJ.audioDeviceId&&void 0!==eJ.audioDeviceId&&"default"!==eJ.audioDeviceId){o={};let e={exact:eJ.audioDeviceId};o.deviceId=e}navigator.mediaDevices.getUserMedia({video:!!e&&i,audio:!!n&&o}).then(function(i){eJ.using_video=e,eJ.using_audio=n,function(e,n){if(null!=e)try{e.srcObject=n}catch(r){e.src=URL.createObjectURL(n)}}(ti("#dt_myvideo").get(0),i),tT(),eJ.myStream=i,r.success(),eJ.onlocalstream(i,"camera")}).catch(function(e){r.error(e)})}function tT(){eJ.myStream&&(eJ.myStream.getAudioTracks().forEach(function(e){e.stop()}),eJ.myStream.getVideoTracks().forEach(function(e){e.stop()}),eJ.myStream=null)}function tC(e){var n=e.split("\r\n"),r={},i="",o={},s=0,a=0;r.audioLevelExtId=1,r.transportWideCcExtId=3,r.midExtId=4,r.streams=[];for(var c=0;c<n.length;c++){var d=n[c].match(/m=(\w+) */);if(d&&(i=d[1],o.type&&(a&&(o.ssrc=a),r.streams.push(Object.assign({},o))),"application"===i&&(i="data"),(o={}).type=i,o.mindex=s++,a=0,"video"===i?(o.codec="h264",o.ssrc=Math.floor(0xffffffff*Math.random())):"audio"===i&&(o.codec="string"==typeof j&&j?j:"opus",o.ssrc=Math.floor(0xffffffff*Math.random()))),n[c].match(/a=mid:*/))o.mid=n[c].match(/a=mid:(.+)/)[1];else if(n[c].match(/a=ssrc:(\d+) */))o.ssrc=parseInt(n[c].match(/a=ssrc:(\d+) */)[1],10);else if(n[c].match(/a=ice-ufrag*/))r.clientIceUfrag=n[c].match(/a=ice-ufrag:(.+)/)[1];else if(n[c].match(/a=ice-pwd*/))r.clientIcePwd=n[c].match(/a=ice-pwd:(.+)/)[1];else if(n[c].match(/a=fingerprint*/)){var l=n[c].match(/a=fingerprint:(.+) (.+)/);r.clientDtlsHashing=l[1],r.clientDtlsFingerprint=l[2]}else n[c].match(/a=setup:*/)?r.clientDtlsRole=n[c].match(/a=setup:(.+)/)[1]:n[c].match(/a=ssrc-group:FID*/)?a=parseInt(n[c].match(/a=ssrc-group:FID (\d+) */)[1],10):o.pt||(!n[c].match(/a=rtpmap:(\d+) opus\/48000\/2/)||j&&"opus"!==j?n[c].match(/a=rtpmap:(\d+) PCMU\/8000/)&&"pcmu"===j?o.pt=parseInt(n[c].match(/a=rtpmap:(\d+) PCMU\/8000/)[1],10):n[c].match(/a=rtpmap:(\d+) H264\/90000/)&&(o.pt=parseInt(n[c].match(/a=rtpmap:(\d+) H264\/90000/)[1],10)):o.pt=parseInt(n[c].match(/a=rtpmap:(\d+) opus\/48000\/2/)[1],10))}return o.type&&(a&&(o.ssrc=a),r.streams.push(Object.assign({},o))),r}function tx(e,n,r){var i=!1,o=!1;for(var s in r){var a=r[s];a.id=e,a.display=n,"audio"===a.type?i=!0:"video"===a.type&&(o=!0)}_[e]={id:e,display:n,streams:r,audio:i,video:o}}function tE(e,n,i){console.log("The DataChannel on data!"+n+e);var o=JSON.parse(e);if(o.compressed){var a=brtc_inflate(Uint8Array.from(atob(o.data).substring(2),e=>e.charCodeAt(0)));o.data=JSON.parse(String.fromCharCode.apply(null,a))}if("BRTC_SERVER_P2P_EVENT"===o.type)if("brtcup"===o.data.event);else if("feedInfo"===o.data.event);else if("media"===o.data.event){var c=!1;if("boolean"!=typeof o.data.receiving)return;c=o.data.receiving;var d=o.data.type;if(s.log("BRTC "+(c?"started":"stopped")+" receiving our "+d),D&&"video"===d&&!c)return;clearInterval(e9),e8=c,c?e2(d,c):e9=setTimeout(function(){e9=null,!1===e8&&e2(d,!1)},5e3)}else"slowlink"===o.data.event&&tr(o.data.uplink,o.data.nacks);else if("BRTC_SERVER_BROADCAST_EVENT"===o.type)if("publishers"===o.data.event){var l=o.data.publishers;for(var u in l){var f=l[u].userId,p=l[u].display,h=l[u].attribute;s.debug(" >> ["+f+"] "+p+" attr: "+h),void 0!==p&&p.includes("web_listener")||(tx(f,p,l[u].streams),X&&tU(f,p),_[f]&&(l[u].streams&&l[u].streams.forEach((e,n)=>{"video"===e.type&&e.connected?_[f].videocoming=!0:"audio"===e.type&&e.connected&&(_[f].audiocoming=!0)}),(_[f].videocoming||_[f].audiocoming)&&(_[f].coming=!0,eP(f,p,h))))}}else if("joined"===o.data.event)f=o.data.publisher,p=o.data.display,th({id:f,display:p,attribute:""}),tx(f,p,o.data.streams),X&&tU(f,p),eN(f,p,"");else if("leaved"===o.data.event)_[f=o.data.publisher]&&_[f].coming&&(ej(f),_[f].coming=!1),eL(f,""),tm(f),w.forEach((e,n)=>{e&&e.feed_id===f&&(w[n]=null)}),b.some(e=>!(!e||"object"!=typeof e||e.rfid!==f&&e.rfindex!==f)&&(b[e.rfindex]=null,!1===X&&document.getElementById("v4videos"+r)&&ti("#videoremote"+e.rfindex)[0]&&(document.getElementById("v4videos"+r).appendChild(ti("#videoremote"+e.rfindex)[0].firstChild),ti("#videoremote"+e.rfindex).remove()),!0)),_[f]=null;else if("published"===o.data.event){f=o.data.publisher,p=o.data.display;var m=o.data.type;_[f]&&("video"===m?_[f].videocoming=!0:"audio"===m&&(_[f].audiocoming=!0),_[f].coming||p&&p.includes("web_listener")||(_[f].coming=!0,eP(f,p,"")))}else"unpublished"===o.data.event?(f=o.data.publisher,m=o.data.type,void 0===p||p.includes("web_listener"),_[f]&&("video"===m?_[f].videocoming=!1:"audio"===m&&(_[f].audiocoming=!1),!_[f].coming||p&&p.includes("web_listener")||_[f].videocoming||_[f].audiocoming||(_[f].coming=!1,ej(f)))):o.data.event;else if("BRTC_CLIENT_P2P_EVENT"===o.type);else if("BRTC_CLIENT_BROADCAST_EVENT"===o.type);else if("BRTC_CLIENT_SIGNAL"===o.type);else if("BRTC_SERVER_SIGNAL"===o.type);else if("BRTC_CLIENT_MESSAGE"===o.type||"BRTC_CLIENT_P2P_MESSAGE"===o.type){var v={id:o.from,data:o.data};eG(v)}else"BRTC_CLIENT_UNRELIABLE_MESSAGE"===o.type&&eB(o.data,o.type)}function tO(){s.init({debug:ep,callback:function(){var n=d=new s({server:c,userid:O,mediaserverip:ea,userevent:el,sessionevent:eu,rigidpull:ef,sdktag:window.BRTC_Version(),roomname:x,appid:C,displayname:k,brtc_v2:i,brtc_v4:o,brtc_render:a,rtmp:er,role:"publisher",videocodec:P,audiocodec:j,v4_participants:tt,v4_submode:"string"==typeof J?J:J?"auto":"manual",onv4joined:function(i){null===d?(n.destroy({cleanupHandles:!0}),console.log("already stop by BRTC_Stop")):(M=i.data.roomId,ey(),function(e){var n=e.data.mediaserver.ip,r=e.data.mediaserver.port;for(var i in e.data.participants){var o=e.data.participants[i];if("publisher"===o.ptype){e7.handleId=o.handleId,e7.SsdpInfo=o.sdpInfo;var s=function(e,n,r,i){var o="v=0\r\no=- 847999349747732714 2 IN IP4 "+r+"\r\ns=VideoRoom 1393329176\r\nt=0 0";return o+="\r\na=group:BUNDLE",n.forEach(e=>{o+=" "+e.mid}),o+="\r\na=msid-semantic: WMS brtc",n.forEach(n=>{"data"===n.type?o+="\r\nm=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 "+r+"\r\na=setup:passive\r\na=mid:"+n.mid+"\r\na=sendrecv\r\na=ice-ufrag:"+e.serverIceUfrag+"\r\na=ice-pwd:"+e.serverIcePwd+"\r\na=ice-options:trickle\r\na=fingerprint:"+e.serverDtlsHashing+" "+e.serverDtlsFingerprint+"\r\na=sctp-port:5000\r\na=sctmap:5000 webrtc-datachannel 16\r\na=candidate:1 1 udp 2013266431 "+r+" "+i+" typ host":"opus"===n.codec?o+="\r\nm=audio 9 UDP/TLS/RTP/SAVPF "+n.pt+"\r\nc=IN IP4 "+r+"\r\na=setup:passive\r\na=mid:"+n.mid+"\r\na=sendrecv\r\na=rtcp-mux\r\na=ice-ufrag:"+e.serverIceUfrag+"\r\na=ice-pwd:"+e.serverIcePwd+"\r\na=ice-options:trickle\r\na=fingerprint:"+e.serverDtlsHashing+" "+e.serverDtlsFingerprint+"\r\na=rtpmap:"+n.pt+" opus/48000/2\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=rtcp-fb:"+n.pt+" transport-cc\r\na=fmtp:"+n.pt+" minptime=10;useinbandfec=1\r\na=rtcp-fb:"+n.pt+" nack\r\na=rtcp-xr\r\na=ssrc:"+n.ssrc+" cname:brtc-audio\r\na=candidate:1 1 udp 2013266431 "+r+" "+i+" typ host":"pcmu"===n.codec?o+="\r\nm=audio 9 UDP/TLS/RTP/SAVPF "+n.pt+"\r\nc=IN IP4 "+r+"\r\na=setup:passive\r\na=mid:"+n.mid+"\r\na=sendrecv\r\na=rtcp-mux\r\na=ice-ufrag:"+e.serverIceUfrag+"\r\na=ice-pwd:"+e.serverIcePwd+"\r\na=ice-options:trickle\r\na=fingerprint:"+e.serverDtlsHashing+" "+e.serverDtlsFingerprint+"\r\na=rtpmap:"+n.pt+" PCMU/8000\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=rtcp-fb:"+n.pt+" transport-cc\r\na=rtcp-fb:"+n.pt+" nack\r\na=rtcp-xr\r\na=ssrc:"+n.ssrc+" cname:brtc-audio\r\na=candidate:1 1 udp 2013266431 "+r+" "+i+" typ host":"h264"===n.codec&&(o+="\r\nm=video 9 UDP/TLS/RTP/SAVPF "+n.pt+"\r\nc=IN IP4 "+r+"\r\na=setup:passive\r\na=mid:"+n.mid+"\r\na=sendrecv\r\na=rtcp-mux\r\na=ice-ufrag:"+e.serverIceUfrag+"\r\na=ice-pwd:"+e.serverIcePwd+"\r\na=ice-options:trickle\r\na=fingerprint:"+e.serverDtlsHashing+" "+e.serverDtlsFingerprint+"\r\na=rtpmap:"+n.pt+" H264/90000\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=rtcp-fb:"+n.pt+" transport-cc\r\na=rtcp-fb:"+n.pt+" ccm fir\r\na=rtcp-fb:"+n.pt+" nack\r\na=rtcp-fb:"+n.pt+" nack pli\r\na=fmtp:"+n.pt+" profile-level-id=42e01f;packetization-mode=1\r\na=rtcp-xr\r\na=ssrc:"+n.ssrc+" cname:brtc-video\r\na=candidate:1 1 udp 2013266431 "+r+" "+i+" typ host")}),o+="\r\n"}(o.sdpInfo,tt[0].sdpInfo.streams,n,r);null!==eo&&(s=tq(s,eo,es));var a=D?q:H;"number"==typeof a&&(s=(s=s.replace(/(m=video.*\r\n)/g,`$1b=AS:${a}\r
|
|
3
|
+
b=TIAS:${1e3*a}\r
|
|
4
|
+
`)).replace(/(profile-level-id=42e01f;packetization-mode=1)/g,`$1;x-google-start-bitrate=${a};x-google-max-bitrate=${a}`)),e7.Ssdp=s}else"subscriber"===o.ptype&&(te.handleId=o.handleId,te.SsdpInfo=o.sdpInfo,s=function(e,n,r,i){var o="v=0\r\no=- 847999349747732714 2 IN IP4 "+r+"\r\ns=VideoRoom 1393329176\r\nt=0 0";return o+="\r\na=group:BUNDLE",n.forEach(e=>{o+=" "+e.mid}),o+="\r\na=msid-semantic: WMS brtc",n.forEach(n=>{"data"===n.type?o+="\r\nm=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 "+r+"\r\na=setup:passive\r\na=mid:"+n.mid+"\r\na=sendrecv\r\na=ice-ufrag:"+e.serverIceUfrag+"\r\na=ice-pwd:"+e.serverIcePwd+"\r\na=ice-options:trickle\r\na=fingerprint:"+e.serverDtlsHashing+" "+e.serverDtlsFingerprint+"\r\na=sctp-port:5000\r\na=sctmap:5000 webrtc-datachannel 16\r\na=candidate:1 1 udp 2013266431 "+r+" "+i+" typ host":"opus"===n.codec?o+="\r\nm=audio 9 UDP/TLS/RTP/SAVPF "+n.pt+"\r\nc=IN IP4 "+r+"\r\na=setup:passive\r\na=mid:"+n.mid+"\r\na=sendrecv\r\na=rtcp-mux\r\na=ice-ufrag:"+e.serverIceUfrag+"\r\na=ice-pwd:"+e.serverIcePwd+"\r\na=ice-options:trickle\r\na=fingerprint:"+e.serverDtlsHashing+" "+e.serverDtlsFingerprint+"\r\na=rtpmap:"+n.pt+" opus/48000/2\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=rtcp-fb:"+n.pt+" transport-cc\r\na=fmtp:"+n.pt+" minptime=10;useinbandfec=1\r\na=rtcp-fb:"+n.pt+" nack\r\na=rtcp-xr\r\na=ssrc:"+n.ssrc+" cname:brtc-audio\r\na=candidate:1 1 udp 2013266431 "+r+" "+i+" typ host":"pcmu"===n.codec?o+="\r\nm=audio 9 UDP/TLS/RTP/SAVPF "+n.pt+"\r\nc=IN IP4 "+r+"\r\na=setup:passive\r\na=mid:"+n.mid+"\r\na=sendrecv\r\na=rtcp-mux\r\na=ice-ufrag:"+e.serverIceUfrag+"\r\na=ice-pwd:"+e.serverIcePwd+"\r\na=ice-options:trickle\r\na=fingerprint:"+e.serverDtlsHashing+" "+e.serverDtlsFingerprint+"\r\na=rtpmap:"+n.pt+" PCMU/8000\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=rtcp-fb:"+n.pt+" transport-cc\r\na=rtcp-fb:"+n.pt+" nack\r\na=rtcp-xr\r\na=ssrc:"+n.ssrc+" cname:brtc-audio\r\na=candidate:1 1 udp 2013266431 "+r+" "+i+" typ host":"h264"===n.codec&&(o+="\r\nm=video 9 UDP/TLS/RTP/SAVPF "+n.pt+"\r\nc=IN IP4 "+r+"\r\na=setup:passive\r\na=mid:"+n.mid+"\r\na=sendrecv\r\na=rtcp-mux\r\na=ice-ufrag:"+e.serverIceUfrag+"\r\na=ice-pwd:"+e.serverIcePwd+"\r\na=ice-options:trickle\r\na=fingerprint:"+e.serverDtlsHashing+" "+e.serverDtlsFingerprint+"\r\na=rtpmap:"+n.pt+" H264/90000\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=rtcp-fb:"+n.pt+" transport-cc\r\na=rtcp-fb:"+n.pt+" ccm fir\r\na=rtcp-fb:"+n.pt+" nack\r\na=rtcp-fb:"+n.pt+" nack pli\r\na=fmtp:"+n.pt+" profile-level-id=42e01f;packetization-mode=1\r\na=rtcp-xr\r\na=ssrc:"+n.ssrc+" cname:brtc-video\r\na=candidate:1 1 udp 2013266431 "+r+" "+i+" typ host")}),o+="\r\n"}(o.sdpInfo,tt[1].sdpInfo.streams,n,r),null!==eo&&(s=tq(s,eo,es)),te.Ssdp=s)}}(i),null!==d&&d.attachv4({plugin:e,opaqueId:p,success:function(e){l=e,s.log("Plugin attached! ("+l.getPlugin()+", id="+l.getId()+")"),s.log(" -- This is a publisher/manager"),$&&tI(!0)},error:function(e){s.error(" -- Error attaching plugin...",e),eb("Error attaching plugin... "+e)},consentDialog:function(e){s.debug("Consent dialog should be "+(e?"on":"off")+" now")},slowLink:function(e,n){tr(e,n)},mediaState:function(e,n){s.log("Janus "+(n?"started":"stopped")+" receiving our "+e)},webrtcState:function(e){s.log("Janus says our WebRTC PeerConnection is "+(e?"up":"down")+" now"),e&&eC()},iceState:function(e){s.log("iceConnectionState: "+e),"disconnected"===e?(setTimeout(function(){eT(!1)},0),null!=d&&d.sendlog({log:{event:"publisher on iceState: disconnected",code:4,id:parseInt(O,10),ts:(new Date).toLocaleString()}})):"connected"===e&&eT(!0)},ondata:function(e,n){tE(e,n)},onmessage:function(e,n){s.debug(" ::: Got a message (publisher) :::"),s.debug(JSON.stringify(e))},onlocalstream:function(e,n){if(e.getVideoTracks().length>0&&(e.getVideoTracks()[0].onended=function(e){eS(D?"screen":"camera")}),ew(e,D?"screen":"camera"),s.debug(" ::: Got a local stream :::"),A){g=e,s.debug(JSON.stringify(e)),n&&(ti("#videolocal").empty(),0===ti("#myvideo").length&&(e4?ti("#videolocal").append('<video style="display: block; margin: auto; -webkit-transform: scaleX(-1); transform: scaleX(-1);" id="myvideo'+r+'" width="100%" height="100%" playsinline autoplay muted="muted"/>'):ti("#videolocal").append('<video style="display: block; margin: auto;" id="myvideo'+r+'" width="100%" height="100%" playsinline autoplay muted="muted"/>')),D&&ti("#myvideo").get(0)&&ti("#myvideo").get(0).style&&(ti("#myvideo").get(0).style.transform="scaleX(1)"),s.attachMediaStream(ti("#myvideo").get(0),e),ti("#myvideo").get(0)&&(ti("#myvideo").get(0).muted="muted"),eR());var i=e.getVideoTracks();null!=i&&0!==i.length||(ti("#myvideo").hide(),N&&ti("#videolocal").append('<div style="position: relative;"><i style="height: 240px; text-align: center;font-size: 12em !important; height: 100%;"></i><span style="text-align: center; position: absolute; bottom: 0px;right: 0px; left: 0px;font-size: 16px;">No webcam available</span></div>'))}},onremotestream:function(e){},oncleanup:function(){s.log(" ::: Got a cleanup notification: we are unpublished now :::"),g=null}},null,e7,e7.handleId),null===d||null===f&&d.attachv4({plugin:e,opaqueId:p,success:function(e){f=e,s.log("Plugin attached! ("+f.getPlugin()+", id="+f.getId()+")"),s.log(" -- This is a V4 subscriber"),f.createOffer({media:{audioSend:!1,videoSend:!1,data:!0},success:function(e){te.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:te.Ssdp}))},error:function(e){s.error("WebRTC error:",e),eb("WebRTC error... "+JSON.stringify(e))}})},onmessage:function(e,n){s.debug(" ::: Got a message (listener) :::")},error:function(e){s.error(" -- Error attaching plugin...",e)},webrtcState:function(e){s.log("BRTC says this WebRTC PeerConnection ) is "+(e?"up":"down")+" now")},iceState:function(e){s.log("iceConnectionState: "+e),"disconnected"===e?setTimeout(function(){eA(0,!1),eM(0)},0):"connected"===e&&eA(0,!0)},onlocalstream:function(e){},slowLink:function(e,n){tr(e,n)},onremotestream:function(e,n,i,o){var a={};a.feed_id=100+i;var c=null;if(S[a.feed_id])S[a.feed_id].addTrack(n.clone()),c=S[a.feed_id];else{var d=new MediaStream;d.addTrack(n.clone()),S[a.feed_id]=d,c=d}var l={};if(l.rfindex=1+Math.floor(i/2),s.debug("Remote feed #"+l.rfindex),0===ti("#remotevideo"+l.rfindex).length){var u="";W&&(u="muted"),K&&ti("#videoremote"+l.rfindex).append('<video style="border-radius: 5px; display: block; margin: auto;" id="waitingvideo'+l.rfindex+r+'" width=320 height=240 />'),"safari"===adapter.browserDetails.browser&&(A||W||(u+=" controls")),ti("#videoremote"+l.rfindex).append("<video "+u+' id="remotevideo'+l.rfindex+r+'" width="100%" height="100%" playsinline autoplay/>'),ti("#videoremote"+l.rfindex).append("<audio "+u+' id="remoteaudio'+l.rfindex+r+'" playsinline autoplay/>')}G&&0===ti("#curres"+l.rfindex).length&&ti("#videoremote"+l.rfindex).append('<span id="curres'+l.rfindex+r+'" style="display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:bold;line-height:1;color:#ffffff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em; background-color: #2fa4e7;position: absolute; bottom: 0px; left: 0px; margin: 2px;"></span><span id="curbitrate'+l.rfindex+r+'" style="display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:bold;line-height:1;color:#ffffff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em;background-color: #033c73;position: absolute; bottom: 0px; right: 0px;margin: 2px;"></span>');var p=c.getVideoTracks(),h=ti("#remote"+n.kind+l.rfindex).get(0);null!==h?(s.attachMediaStream(h,c),null==p||0===p.length?(ti("#remoteaudio"+l.rfindex).hide(),ti("#remoteaudio"+l.rfindex).bind("playing",function(){if(null!==l){var e=ti("#remoteaudio"+l.rfindex).get(0);null!=e&&void 0!==e.setSinkId&&null!=eg&&"default"!==eg&&e.setSinkId(eg),eI(X?l.rfindex:l.rfid,"audio"),K&&(void 0!==l.spinner&&null!==l.spinner&&(l.spinner.stop(),l.spinner=null),ti("#waitingvideo"+l.rfindex).remove())}})):(ti("#remotevideo"+l.rfindex).show(),ti("#remotevideo"+l.rfindex).bind("playing",function(){if(null!==l){0!==ti("#novideo"+l.rfindex).length&&ti("#novideo"+l.rfindex).remove(),l.rfid=w[i]?w[i].feed_id:0,eI(X?l.rfindex:l.rfid),K&&(void 0!==l.spinner&&null!==l.spinner&&(l.spinner.stop(),l.spinner=null),ti("#waitingvideo"+l.rfindex).remove()),ti("#remotevideo"+l.rfindex).removeClass("hide");var e=this.videoWidth,n=this.videoHeight;G&&(ti("#curres"+l.rfindex).removeClass("hide").text(e+"x"+n).show(),"firefox"===adapter.browserDetails.browser&&setTimeout(function(){if(null!==l){var e=ti("#remotevideo"+l.rfindex).get(0).videoWidth,n=ti("#remotevideo"+l.rfindex).get(0).videoHeight;ti("#curres"+l.rfindex).removeClass("hide").text(e+"x"+n).show()}},2e3))}})),G&&("chrome"!==adapter.browserDetails.browser&&"firefox"!==adapter.browserDetails.browser||(ti("#curbitrate"+l.rfindex).removeClass("hide").show(),R[l.rfindex]=setInterval(function(){if(null!==f){var e=f.getBitrate();ti("#curbitrate"+l.rfindex).text(e)}},1e3)))):s.log("no video label for Remote feed #"+l.rfindex)},ondataopen:function(e){s.log("The DataChannel is available!"+e)},ondata:function(e,n){tE(e,n)},oncleanup:function(){s.log(" ::: Got a cleanup notification (remote feed 0) :::"),b.forEach(e=>{if(e&&"object"==typeof e){var n=e;if(null!==eM){var r=X?n.rfindex:n.rfid;setTimeout(function(){ek(r)},0),!1===X&&ti("#videoremote"+n.rfindex).remove(),K&&(void 0!==n.spinner&&null!==n.spinner&&(n.spinner.stop(),n.spinner=null),ti("#waitingvideo"+n.rfindex).remove()),G&&(ti("#curbitrate"+n.rfindex).remove(),ti("#curres"+n.rfindex).remove(),void 0!==R[n.rfindex]&&null!==R[n.rfindex]&&(clearInterval(R[n.rfindex]),R[n.rfindex]=null)),n=null}}})}},null,te,te.handleId))},onsetup:function(i){null===d?(n.destroy({cleanupHandles:!0}),console.log("already stop by BRTC_Stop")):(M=i.data.room,tN(0,"startup"),d.attach({plugin:e,opaqueId:p,success:function(e){if(l=e,s.log("Plugin attached! ("+l.getPlugin()+", id="+l.getId()+")"),s.log(" -- This is a publisher/manager"),ey(),$&&tI(!0),i.data.publishers){var n=i.data.publishers;for(var r in s.debug("Got a list of available publishers/feeds:"),s.debug(n),n){var o=n[r].id,a=n[r].display,c=n[r].streams,d=n[r].attribute;for(var u in c){var f=c[u];f.id=o,f.display=a}_[o]={id:o,display:a,streams:c},void 0!==a&&a.includes("web_listener")||(X&&setTimeout(function(){tN(o,a)},300),setTimeout(function(){eP(o,a,d)},300))}}},error:function(e){s.error(" -- Error attaching plugin...",e),eb("Error attaching plugin... "+e)},consentDialog:function(e){s.debug("Consent dialog should be "+(e?"on":"off")+" now")},slowLink:function(e,n){tr(e,n)},mediaState:function(e,n){s.log("Janus "+(n?"started":"stopped")+" receiving our "+e),D&&"video"===e&&!n||(clearInterval(e9),e8=n,n?e2(e,n):e9=setTimeout(function(){e9=null,!1===e8&&e2(e,!1)},5e3))},webrtcState:function(e){s.log("Janus says our WebRTC PeerConnection is "+(e?"up":"down")+" now"),e&&eC()},iceState:function(e){s.log("iceConnectionState: "+e),"disconnected"===e&&null!=d&&d.sendlog({log:{event:"publisher on iceState: disconnected",code:4,id:parseInt(O,10),ts:(new Date).toLocaleString()}})},onmessage:function(e,n){s.debug(" ::: Got a message (publisher) :::"),s.debug(JSON.stringify(e));var r=e.videoroom;if(s.debug("Event: "+r),null!=r){if("destroyed"===r)s.warn("The room has been destroyed!"),eb("The room has been destroyed");else if("event"===r){if(void 0!==e.publishers&&null!==e.publishers){var i=e.publishers;s.debug("Got a list of available publishers/feeds:"),s.debug(i)}else if(void 0!==e.leaving&&null!==e.leaving){var o=e.leaving;s.log("Publisher left: "+o);var a=null;b.some(e=>!(!e||"object"!=typeof e||e.rfid!==o)&&(a=e,!0)),null!=a&&(s.debug("Feed "+a.rfid+" ("+a.rfdisplay+") has left the room, detaching"),ti("#videoremote"+a.rfindex).empty(),b[a.rfindex]=null,a.detach(),ej(a.rfid))}else if(void 0!==e.unpublished&&null!==e.unpublished){var c=e.unpublished;if(s.log("Publisher left: "+c),"ok"===c)return l.hangup(),void(eX&&tk());if("self"===c)return clearInterval(e9),l.hangup(),void setTimeout(function(){ex()},500);a=null,b.some(e=>!(!e||"object"!=typeof e||e.rfid!==c)&&(a=e,!0)),null!=a&&(s.debug("Feed "+a.rfid+" ("+a.rfdisplay+") has left the room, detaching"),ti("#videoremote"+a.rfindex).empty(),b[a.rfindex]=null,a.detach(),eD(a.rfid))}else if(void 0!==e.error&&null!==e.error){if(435===e.error_code)return;eb(e.error)}}}if(null!=n){s.debug("Handling SDP as well..."),s.debug(n),null!==eo&&(n.sdp=tq(n.sdp,eo,es));var d=D?q:H;"number"==typeof d&&(n.sdp=n.sdp.replace(/(m=video.*\r\n)/g,`$1b=AS:${d}\r
|
|
5
|
+
b=TIAS:${1e3*d}\r
|
|
6
|
+
`),n.sdp=n.sdp.replace(/(profile-level-id=42e01f;packetization-mode=1)/g,`$1;x-google-start-bitrate=${d};x-google-max-bitrate=${d}`)),l.handleRemoteJsep({jsep:n})}},onlocalstream:function(e,n){if(e.getVideoTracks().length>0&&(e.getVideoTracks()[0].onended=function(e){eS(D?"screen":"camera"),D&&tp()}),ew(e,D?"screen":"camera"),s.debug(" ::: Got a local stream :::"),A){g=e,s.debug(JSON.stringify(e)),n&&(ti("#videolocal").empty(),0===ti("#myvideo").length&&(e4?ti("#videolocal").append('<video style="display: block; margin: auto; -webkit-transform: scaleX(-1); transform: scaleX(-1);" id="myvideo'+r+'" width="100%" height="100%" playsinline autoplay muted="muted"/>'):ti("#videolocal").append('<video style="display: block; margin: auto;" id="myvideo'+r+'" width="100%" height="100%" playsinline autoplay muted="muted"/>')),D&&ti("#myvideo").get(0)&&ti("#myvideo").get(0).style&&(ti("#myvideo").get(0).style.transform="scaleX(1)"),s.attachMediaStream(ti("#myvideo").get(0),e),ti("#myvideo").get(0)&&(ti("#myvideo").get(0).muted="muted"),eR());var i=e.getVideoTracks();null!=i&&0!==i.length||(ti("#myvideo").hide(),N&&ti("#videolocal").append('<div style="position: relative;"><i style="height: 240px; text-align: center;font-size: 12em !important; height: 100%;"></i><span style="text-align: center; position: absolute; bottom: 0px;right: 0px; left: 0px;font-size: 16px;">No webcam available</span></div>'))}},onremotestream:function(e){},oncleanup:function(){s.log(" ::: Got a cleanup notification: we are unpublished now :::"),g=null}},i))},success:function(i){null===d?(n.destroy({cleanupHandles:!0}),console.log("already stop by BRTC_Stop")):(i&&Array.isArray(i.remoteUids)&&i.remoteUids.forEach(e=>{th({id:e,display:"",attribute:""})}),d.attach({plugin:e,opaqueId:p,success:function(e){var n,r;l=e,s.log("Plugin attached! ("+l.getPlugin()+", id="+l.getId()+")"),s.log(" -- This is a publisher/manager"),n=k,a&&(x=d.getRoomName(),O=d.getUserID().toString()),r={request:"create",id:parseInt(O),room_name:x,publishers:500,videocodec:P,app_id:C},a&&(r.bdcruserid=I),"string"==typeof j&&""!==j&&(r.audiocodec=j),l.send({message:r,success:function(e){s.log("create resp data:"+e),M=e.room,s.log("create roomid:"+M);var r={request:"join",room:parseInt(M),room_name:x,ptype:"publisher",id:parseInt(O),app_id:C,role:E,token:"no_token",display:n};m=n,Q.includes("rtmp")&&(r.rtmp={},r.rtmp.url={},r.rtmp.url=Q,r.rtmp.mix=Z,"string"==typeof ee&&""!==ee&&(r.rtmp.mixTemplate=ee),"object"==typeof ee&&null!==ee&&(r.rtmp.mixTranscodingCfg=ee,delete r.rtmp.mix)),en&&(r.recording={},r.recording.rec=en),""!==et&&(r.window_id_in_bypass=et),s.log("userid:"+O+",appid:"+C),l.send({message:r}),setTimeout(function(){tH({roomEvent:{userName:k+"("+O+")",eventDescription:"ENTER_ROOM"}}),tH({deviceInfo:{sdkVersion:window.BRTC_Version(),networkType:"unknown",device:navigator.userAgent}})},500)}})},error:function(e){s.error(" -- Error attaching plugin...",e),eb("Error attaching plugin... "+e)},consentDialog:function(e){s.debug("Consent dialog should be "+(e?"on":"off")+" now")},slowLink:function(e,n){tr(e,n)},mediaState:function(e,n){s.log("Janus "+(n?"started":"stopped")+" receiving our "+e),D&&"video"===e&&!n||(clearInterval(e9),e8=n,n?e2(e,n):e9=setTimeout(function(){e9=null,!1===e8&&e2(e,!1)},5e3))},webrtcState:function(e){s.log("Janus says our WebRTC PeerConnection is "+(e?"up":"down")+" now"),e&&eC()},iceState:function(e){s.log("iceConnectionState: "+e),"disconnected"===e?(setTimeout(function(){eT(!1)},0),null!=d&&d.sendlog({log:{event:"publisher on iceState: disconnected",code:4,id:parseInt(O),ts:(new Date).toLocaleString()}})):"connected"===e&&eT(!0)},onmessage:function(e,n){s.debug(" ::: Got a message (publisher) :::"),s.debug(JSON.stringify(e));var r=e.videoroom;if(s.debug("Event: "+r),null!=r&&null!=r){if("joined"===r){if(v=e.id,y=e.private_id,s.log("Successfully joined room "+e.room+" with ID "+v),ey(),$&&tI(!0),function(e){if(!eY)return;let n=e.defaultOpen,r=e.serverUrl,i=e.gatherInterval;e.uploadInterval,!0===n&&null===r&&(r="/rtc-quality-stats-noAuth");let o=0;eZ=window.setInterval(async function(){let e={duration:10,resourceUsageInfo:{sysCpuUsage:20,appCpuUsage:10},senderQualityInfo:{bitrate:0,packetloss:10,fps:0,resolution:"0*0"},receiverQualityInfoList:[]},n=[];if(null!==l||0!=b.length){if(l&&l.webrtcStuff&&l.webrtcStuff.pc){let r=new Promise(function(n,r){l.getLocalStats(i,o,{success(r){r.packetsLost=(r.audioPacketsLost?r.audioPacketsLost:0)+(r.videoPacketsLost?r.videoPacketsLost:0),r.packetsSent=(r.audioPacketsSent?r.audioPacketsSent:0)+(r.videoPacketsSent?r.videoPacketsSent:0),e.senderQualityInfo={bitrate:(r.audioBitrate?r.audioBitrate:0)+(r.videoBitrate?r.videoBitrate:0),packetloss:Math.round(1e3*r.packetsLost/(r.packetsLost+r.packetsSent+1)),fps:r.fps?r.fps:0,resolution:(r.frameWidth?r.frameWidth:"0")+"*"+(r.frameHeight?r.frameHeight:"0")},n()},error(){n()}})});n.push(r)}b.forEach(r=>{if(r&&"object"==typeof r){let s=new Promise(function(n,s){r.rfid,r.getRemoteStats(i,o,{success(i){i.packetsLost=(i.audioPacketsLost?i.audioPacketsLost:0)+(i.videoPacketsLost?i.videoPacketsLost:0),i.packetsReceived=(i.audioPacketsReceived?i.audioPacketsReceived:0)+(i.videoPacketsReceived?i.videoPacketsReceived:0),e.receiverQualityInfoList.push({feedId:r.rfid,bitrate:(i.audioBitrate?i.audioBitrate:0)+(i.videoBitrate?i.videoBitrate:0),packetloss:Math.round(1e3*i.packetsLost/(i.packetsLost+i.packetsReceived+1)),fps:i.fps?i.fps:0,resolution:(i.frameWidth?i.frameWidth:"0")+"*"+(i.frameHeight?i.frameHeight:"0")}),n()},error(){n()}})});n.push(s)}}),await Promise.all(n).then(function(r){o>=i&&o%i==0&&tH({communicationQualityInfo:e}),n=[],o++})}},2e3)}(eK),void 0!==e.publishers&&null!==e.publishers){var i,o=e.publishers;for(var a in s.debug("Got a list of available publishers/feeds:"),s.debug(o),o){var c=o[a].id,d=o[a].display;void 0===(i=o[a].attribute)&&(i=""),""!==i&&t_({id:c,attribute:i}),s.debug(" >> ["+c+"] "+d+" attr: "+i),void 0!==d&&d.includes("web_listener")||(X&&tF(c,k),tv(c,!1),eP(c,d,i))}}}else if("destroyed"===r)s.warn("The room has been destroyed!"),eb("The room has been destroyed");else if("event"===r){if(void 0!==e.publishers&&null!==e.publishers)for(var a in o=e.publishers,s.debug("Got a list of available publishers/feeds:"),s.debug(o),o)c=o[a].id,d=o[a].display,void 0===(i=o[a].attribute)&&(i=""),""!==i&&t_({id:c,attribute:i}),s.debug(" >> ["+c+"] "+d+" attr: "+i),void 0!==d&&d.includes("web_listener")||(X&&tF(c,k),tv(c,!1),eP(c,d,i));else if(void 0!==e.leaving&&null!==e.leaving){var u=e.leaving;s.log("Publisher left: "+u);var f=null;b.some(e=>!(!e||"object"!=typeof e||e.rfid!=u)&&(f=e,!0)),null!=f&&(s.debug("Feed "+f.rfid+" ("+f.rfdisplay+") has left the room, detaching"),ti("#videoremote"+f.rfindex).empty(),b[f.rfindex]=null,f.detach()),tg(u)||(ej(u),tv(u,!0))}else if(void 0!==e.unpublished&&null!==e.unpublished){var p=e.unpublished;if(s.log("Publisher left: "+p),"ok"===p)return l.hangup(),void(eX&&tk());if("self"===p)return clearInterval(e9),l.hangup(),void setTimeout(function(){ex()},500);tg(p)||(ej(p),tv(p,!0)),f=null,b.some(e=>!(!e||"object"!=typeof e||e.rfid!=p)&&(f=e,!0)),null!=f&&(s.debug("Feed "+f.rfid+" ("+f.rfdisplay+") has left the room, detaching"),ti("#videoremote"+f.rfindex).empty(),b[f.rfindex]=null,f.detach(),eD(f.rfid))}else if(void 0!==e.error&&null!==e.error){if(435==e.error_code)return;eb(e.error)}}}if(null!=n){s.debug("Handling SDP as well..."),s.debug(n),null!==eo&&(n.sdp=tq(n.sdp,eo,es)),(V||z)&&(n.sdp=function(e,n,r){for(var i=e.split("\r\n"),o=null,s=0;s<i.length;s++){var a=i[s].match(/a=rtpmap.*opus.*/);if(a)o=a;else if(o){var c=i[s].match(/a=fmtp.*/);if(c){i[s]=c,r&&(i[s]+=";stereo=1"),n&&(i[s]+=";maxaveragebitrate="+1e3*n);break}}}return(e=i.join("\r\n")).endsWith("\r\n")||(e+="\r\n"),e}(n.sdp,V,z));var h=D?q:H;"number"==typeof h&&(n.sdp=n.sdp.replace(/(m=video.*\r\n)/g,`$1b=AS:${h}\r
|
|
7
|
+
b=TIAS:${1e3*h}\r
|
|
8
|
+
`),n.sdp=n.sdp.replace(/(profile-level-id=42e01f;packetization-mode=1)/g,`$1;x-google-start-bitrate=${h};x-google-max-bitrate=${h}`)),l.handleRemoteJsep({jsep:n})}},onlocalstream:function(e,n){if(e.getVideoTracks().length>0&&(e.getVideoTracks()[0].onended=function(e){eS(D?"screen":"camera"),D&&tp()}),ew(e,D?"screen":"camera"),s.debug(" ::: Got a local stream :::"),A){g=e,s.debug(JSON.stringify(e)),n&&(ti("#videolocal").empty(),0===ti("#myvideo").length&&(e4?ti("#videolocal").append('<video style="display: block; margin: auto; -webkit-transform: scaleX(-1); transform: scaleX(-1);" id="myvideo'+r+'" width="100%" height="100%" playsinline autoplay muted="muted"/>'):ti("#videolocal").append('<video style="display: block; margin: auto;" id="myvideo'+r+'" width="100%" height="100%" playsinline autoplay muted="muted"/>')),D&&ti("#myvideo").get(0)&&ti("#myvideo").get(0).style&&(ti("#myvideo").get(0).style.transform="scaleX(1)"),s.attachMediaStream(ti("#myvideo").get(0),e),ti("#myvideo").get(0)&&(ti("#myvideo").get(0).muted="muted"),eR());var i=e.getVideoTracks();null!=i&&0!==i.length||(ti("#myvideo").hide(),N&&ti("#videolocal").append('<div style="position: relative;"><i style="height: 240px; text-align: center; font-size: 12em !important; height: 100%;"></i><span style="text-align: center; position: absolute; bottom: 0px;right: 0px;left: 0px;font-size: 16px;">No webcam available</span></div>'))}},onremotestream:function(e){},oncleanup:function(){s.log(" ::: Got a cleanup notification: we are unpublished now :::"),g=null}}))},error:function(e){s.error(e),"string"==typeof e&&e.includes("Error connecting to the Janus WebSockets")&&(h=!1),eb(e)},destroyed:function(){e_("destroyed")},onuserevent:function(e,n){if(n||!eu){if(e.users){var r=e.users;for(var i in s.debug("Got a list of available users:"),s.debug(r),r){var o=r[i].id,a=r[i].display,c=r[i].attribute;void 0===c&&(c=""),s.debug(" >> ["+o+"] "+a+" attr: "+c),ty(o)||eN(o,a,c),th({id:o,display:a,attribute:c})}}else if(e.leaving)eL(e.leaving,e.display),tm(e.leaving);else if(e.joined)ty(e.joined)||eN(e.joined,e.display,""),th({id:e.joined,display:e.display,attribute:""});else if(e.detached){var l=e.detached;if(l.servertrigger){var u=!0;b.some((e,n)=>!(!e||"object"!=typeof e||e.rfindex!=l.feed&&e.rfid!=l.feed)&&(u=!1,!0)),u||setTimeout(()=>{eV.some((e,n)=>!(!e||"object"!=typeof e||e.id!=l.feed)&&(null!=d&&d.sendlog({log:{event:"on feed detached via servertrigger",code:5,feedid:l.feed,id:parseInt(O),ts:(new Date).toLocaleString()}}),tA(l.feed),!0))},500)}"number"==typeof l.feed&&T.some((e,n)=>!(!e||"object"!=typeof e||e.feedid!==l.feed)&&(e.resolve("success: feedid: "+l.feed),T.splice(n,1),!0))}}},onmessage:function(e,n){if((n||!eu)&&e)if(!0===e.internal){var r={id:e.from,attribute:e.data};eW(r),t_(r)}else{var i={id:e.from,data:e.data};eG(i)}},onbdcrevent:function(e){e&&"lockDeviceEvent"===e.eventType&&eq(e)},onsessionevent:function(e){if(e&&eu){if(e.recvdata)this.onmessage(e.recvdata,!0);else if(e.userevent)this.onuserevent(e.userevent,!0);else if(e.detached)this.onuserevent(e,!0);else if(e.bypass_event){var n=e.bypass_event;eU(n.level,n.rtmp.url,n.bypassStatus)}else if(e.recording_event){var r=e.recording_event;eF(r)}else if(e.recv_echoreq){r=e.recv_echoreq;var i={request:"send_echores",room:M,id:parseInt(O,10),to:r.from,data:r.data,reqSendTs:r.reqSendTs,reqRecvTs:Date.now(),resSendTs:Date.now()};d.send({message:i,success:function(e){}})}else if(e.recv_echores){r=e.recv_echores;var o={};o.id=r.from,o.data=r.data,o.delayms=(Date.now()-r.reqSendTs)/2,eH(o)}else if(e.data){var a=e.data.videoroom;if(s.debug("Event: "+a),null!=a){if("publisherevent"===a){if(void 0!==e.data.publishers&&null!==e.data.publishers){var c=e.data.publishers;for(var l in s.debug("Got a list of available publishers/feeds:"),s.debug(c),c){var u=c[l].id,f=c[l].display,p=c[l].streams,h=c[l].attribute;for(var m in p){var v=p[m];v.id=u,v.display=f}_[u]={id:u,display:f,streams:p},void 0!==f&&f.includes("web_listener")||(X&&setTimeout(function(){tN(u,f)},200),setTimeout(function(){eP(u,f,h)},100))}}else if(void 0!==e.data.leaving&&null!==e.data.leaving){var g=e.data.leaving.id;s.log("Publisher left: "+g);var y=null;if(b.some(e=>!(!e||"object"!=typeof e||e.rfid!==g)&&(y=e,!0)),w.forEach((e,n)=>{e.feed_id===g&&w.splice(n,1)}),w.forEach((e,n)=>{e.feed_id===g&&w.splice(n,1)}),null!=y){var S=y.rfid;s.debug("Feed "+y.rfid+" ("+y.rfdisplay+") has left the room, detaching"),ti("#videoremote"+y.rfindex).empty(),!1===X&&ti("#videoremote"+y.rfindex).remove(),b[y.rfindex]=null;var T=X?y.rfindex:y.rfid;ek(T),K&&(void 0!==y.spinner&&null!==y.spinner&&(y.spinner.stop(),y.spinner=null),ti("#waitingvideo"+y.rfindex).remove()),G&&(ti("#curbitrate"+y.rfindex).remove(),ti("#curres"+y.rfindex).remove(),void 0!==R[y.rfindex]&&null!==R[y.rfindex]&&(clearInterval(R[y.rfindex]),R[y.rfindex]=null)),ej(S),tL(S)}}else if(void 0!==e.data.unpublished&&null!==e.data.unpublished){var C=e.data.unpublished.id;s.log("Publisher unpublished: "+C),y=null,b.some(e=>!(!e||"object"!=typeof e||e.rfid!==C)&&(y=e,!0)),null!=y&&(s.debug("Feed "+y.rfid+" ("+y.rfdisplay+") has unpublished, detaching"),ti("#videoremote"+y.rfindex).empty(),b[y.rfindex]=null,eD(y.rfid),tL(y.rfid))}}else if("streamevent"===a){if(e.data.removed){let n=[];for(let r of e.data.removed)n.push(r.mid)}if(e.data.added){let n=[];for(let r of e.data.added)n.push(r.mid)}}}}}}})}})}function tI(e,n,r){var a=N,c=!1;e=L,A||(a=!1,e=!1,c=!0),B&&(c=!0);let u={audioRecv:!1,videoRecv:!1,audioSend:e,videoSend:a,data:c,video:D?"screen":e5,screenstream:r,screenconfig:tS(e6)};if(null!==em&&(u.videoDeviceId=em),u.audio={},u.audio.optional=[{sourceId:ev||"default"}],u.waitPermissionTimeout=ei,null!==l){if(o){if(tn)return void tf(D,!0).then(function(e){tc(e);var n=[];["0","1"].forEach(e=>{n.push({mid:e,method:"client",pause:!1})});var r="BRTC_CLIENT_SIGNAL",i={type:r,data:{request:"pause_resume",transaction:s.randomString(12),handleId:l.getId(),session_id:d.getSessionId(),streams:n}};console.log("Send DataChannel msg:"+JSON.stringify(i)),tD(JSON.stringify(i),r)},function(e){});tn=!0}null!=d&&d.sendlog({log:{event:"calling publishOwnFeed",code:1,id:parseInt(O),media:u,ts:(new Date).toLocaleString()}});var f=!0;setTimeout(()=>{null!=d&&f&&d.sendlog({log:{event:"calling createOffer on timeout 5s",code:1,id:parseInt(O),ts:(new Date).toLocaleString()}})},5e3);var p=Date.now();l.createOffer({media:u,stream:ec,ongetsharescreenstream:ed,success:function(n){ec=null,f=!1;var r=Date.now()-p;l.session.sendlog({log:{event:"calling createOffer on success:",code:0,id:parseInt(O),deltatime:r,is_normal:r<2e3?"ok":"a little long",ts:(new Date).toLocaleString()}}),s.debug("Got publisher SDP!"),s.debug(n);let d=m;D&&(d+="_screen");let u={};if(u=D?{request:"configure",audio:e,video:!0,data:c,display:d}:{request:"configure",audio:e,video:a,data:c},i)u={request:"configure",streams:[{mid:"0",description:"audio"},{mid:"1",description:"camera"}]};else if(o)return void e7.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e7.Ssdp}));null!=l&&l.send({message:u,jsep:n})},error(e){f=!1,null!=d&&d.sendlog({log:{event:"createOffer on error: "+JSON.stringify(e),code:2,id:parseInt(O),ts:(new Date).toLocaleString()}}),navigator.mediaDevices.enumerateDevices().then(function(e){null!=d&&d.sendlog({log:{event:"createOffer on error .enumerateDevices list: ",code:2,id:parseInt(O),devices:e,ts:(new Date).toLocaleString()}})}).catch(function(e){null!=d&&d.sendlog({log:{event:"createOffer on error .enumerateDevices catch: ",code:2,id:parseInt(O),error:e,ts:(new Date).toLocaleString()}})}),s.log("WebRTC error:",e),setTimeout(()=>{eb("WebRTC error... "+JSON.stringify(e))},0)}})}}function tk(){eX&&(eX=!1,e$())}function tM(){null!==l&&l.send({message:{request:"unpublish"}})}function tP(e,n){var s,a=666,c=null;if(b.forEach(e=>{e&&"object"==typeof e&&e.rfid==n&&(c=e)}),!c&&(!i&&!o||void 0!==_[n]&&null!==_[n])){s={id:n,videoview:e,ts:Date.now()},ez.some((e,n)=>!(!e||"object"!=typeof e||e.id!=s.id||(ez.splice(n,1),0))),ez.push(s);for(var d=500;d<1e3;d++)if(void 0===b[d]||null===b[d]){a=d,b[d]=8888;break}document.getElementById("videoremote"+a+r)||(o||ti("#"+e).empty(),ti("#"+e).append('<div style="width: 100%;height: 100%;" id="videoremote'+a+r+'"></div>')),i?tN(n,k,a):o?tU(n,k,a):tF(n,k,a)}}function tj(e){return new Promise((n,s)=>{tb(e),w.forEach((n,r)=>{n&&n.feed_id===e&&(w[r]=null)});var a=!1;if(b.some((n,s)=>!(!n||"object"!=typeof n||n.rfindex!==e&&n.rfid!==e)&&(b[s]=null,i?tL(e):o||n.detach(),!1===X?o?o&&document.getElementById("v4videos"+r)&&ti("#videoremote"+n.rfindex)[0]&&(document.getElementById("v4videos"+r).appendChild(ti("#videoremote"+n.rfindex)[0].firstChild),ti("#videoremote"+n.rfindex).remove()):ti("#videoremote"+n.rfindex).remove():ti("#videoremote"+n.rfindex).empty(),a=!0,!0)),a){if(!o){var c={};c.resolve=n,c.feedid=e,T.push(c)}}else n("waring: not subscribed feedid: "+e)})}function tA(e){var n=null;ez.some((r,i)=>!(!r||"object"!=typeof r||r.id!=e)&&!(r.ts+1e4>Date.now())&&(n=r.videoview,!0)),X&&b.some((i,o)=>{if(i&&"object"==typeof i&&(i.rfindex==e||i.rfid==e)){var s=document.getElementById("videoremote"+i.rfindex+r);return s&&(n=s.id),!0}return!1}),null!=d&&d.sendlog({log:{event:"calling resubscribeStreaming",code:4,feedid:e,videoview:n,id:parseInt(O),ts:(new Date).toLocaleString()}}),null!==n&&(tj(e),setTimeout(()=>{X?tF(e,k):tP(n,e)},500))}function tD(e,n){l.data({label:n,text:e,error:function(e){eb(e)}})}function tB(e,n){console.log("Send DataChannel via v4 listener msg:"+e),f.data({label:n,text:e,error:function(e){eb(e)}})}function tN(n,i,o){var a=!1;if(void 0!==o&&(a=!0),null!==u){var c=_[n].streams,l=[];if(c.forEach(e=>{l.push(e.mid)}),u.send({message:{request:"subscribe",feeds:[{id:n,mids:l}]}}),(m={}).rfid=n,a)b[o]=m,m.rfindex=o;else for(var f=1;f<500;f++)if(void 0===b[f]||null===b[f]){b[f]=m,m.rfindex=f;break}return void(_[n].rfindex=m.rfindex)}let h={janus:"setup",enable_multistream:!0,version:"brtc_v2",body:{plugin:e,session_config:{userevent:!0,sessionevent:!0},app_id:C,room_name:x,id:O,display:k,token:"",ptype:"subscriber"}};var m={rfindex:1};d.V2setup({request:h,onsetup:function(i){null!==d&&d.attach({plugin:e,opaqueId:p,success:function(e){u=e,s.log("Plugin attached! ("+u.getPlugin()+", id="+u.getId()+")"),s.log(" -- This is a V2 subscriber");var n=i.jsep;if(void 0!==i.data.streams&&i.data.streams.length>0){var o=b[_[i.data.streams[0].feed_id].rfindex];if(o.rfid=i.data.streams[0].feed_id,o.rfdisplay=i.data.streams[0].feed_display,K)if(void 0===o.spinner||null===o.spinner){var a=document.getElementById("videoremote"+o.rfindex+r);o.spinner=new Spinner({top:100}).spin(a)}else o.spinner.spin();eO(X?o.rfindex:o.rfid),s.log("Successfully attached to feed "+o.rfid+" ("+o.rfdisplay+") in room ")}null!=n&&(s.debug("Handling SDP as well..."),s.debug(n),null!==eo&&(n.sdp=tq(n.sdp,eo,es)),u.createAnswer({jsep:n,media:{audioSend:!1,videoSend:!1,data:!0},success:function(e){s.debug("Got SDP!"),s.debug(e);var n={request:"start",room:M};u.send({message:n,jsep:e})},error:function(e){s.error("WebRTC error:",e),eb("WebRTC error... "+JSON.stringify(e))}}))},onmessage:function(e,n){if(s.debug(" ::: Got a message (listener) :::"),s.debug(JSON.stringify(e)),e.unsubscribed&&"ok"===e.unsubscribed&&void 0!==e.streams&&e.streams.length>0){var i=e.streams[0].feed_id;"number"==typeof i&&T.some((e,n)=>!(!e||"object"!=typeof e||e.feedid!==i)&&(e.resolve("success: feedid: "+i),T.splice(n,1),!0))}else{if(void 0!==e.streams&&e.streams.length>0){for(var o in e.streams){var a=e.streams[o].mid;w[a]||(w[a]=e.streams[o])}var c=e.streams[e.streams.length-1].feed_id,d=b[_[c].rfindex];if(d.rfid=c,d.rfdisplay=e.streams[e.streams.length-1].feed_display,K)if(void 0===d.spinner||null===d.spinner){var l=document.getElementById("videoremote"+d.rfindex+r);d.spinner=new Spinner({top:100}).spin(l)}else d.spinner.spin();eO(X?d.rfindex:d.rfid),s.log("Successfully attached to feed "+d.rfid+" ("+d.rfdisplay+") in room ")}null!=n&&(s.debug("Handling SDP as well..."),s.debug(n),null!==eo&&(n.sdp=tq(n.sdp,eo,es)),u.createAnswer({jsep:n,media:{audioSend:!1,videoSend:!1,data:!0},success:function(e){s.debug("Got SDP!"),s.debug(e);var n={request:"start",room:M};u.send({message:n,jsep:e})},error:function(e){s.error("WebRTC error:",e),eb("WebRTC error... "+JSON.stringify(e))}}))}},error:function(e){s.error(" -- Error attaching plugin...",e)},webrtcState:function(e){s.log("Janus says this WebRTC PeerConnection ) is "+(e?"up":"down")+" now")},iceState:function(e){s.log("iceConnectionState: "+e),"disconnected"===e&&eM(0)},onlocalstream:function(e){},slowLink:function(e,n){tr(e,n)},onremotestream:function(e,n,i,o){var a=w[i],c=b[_[a.feed_id].rfindex],d=null;if(S[a.feed_id])S[a.feed_id].addTrack(n.clone()),d=S[a.feed_id];else{var l=new MediaStream;l.addTrack(n.clone()),S[a.feed_id]=l,d=l}if(s.debug("Remote feed #"+c.rfindex),0===ti("#remotevideo"+c.rfindex).length){var f="";W&&(f="muted"),K&&ti("#videoremote"+c.rfindex).append('<video style="border-radius: 5px; display: block; margin: auto;" id="waitingvideo'+c.rfindex+r+'" width=320 height=240 />'),"safari"===adapter.browserDetails.browser&&(A||W||(f+=" controls")),document.getElementById("remotevideo"+c.rfindex+r)||ti("#videoremote"+c.rfindex).append("<video "+f+' id="remotevideo'+c.rfindex+r+'" width="100%" height="100%" playsinline autoplay/>')}G&&0===ti("#curres"+c.rfindex).length&&ti("#videoremote"+c.rfindex).append('<span id="curres'+c.rfindex+r+'" style="display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:bold;line-height:1;color:#ffffff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em; background-color: #2fa4e7;position: absolute; bottom: 0px; left: 0px; margin: 2px;"></span><span id="curbitrate'+c.rfindex+r+'" style="display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:bold;line-height:1;color:#ffffff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em;background-color: #033c73;position: absolute; bottom: 0px; right: 0px;margin: 2px;"></span>');var p=d.getVideoTracks(),h=ti("#remotevideo"+c.rfindex).get(0);null!==h?(s.attachMediaStream(h,d),null==p||0===p.length?(ti("#remotevideo"+c.rfindex).hide(),ti("#remotevideo"+c.rfindex).bind("playing",function(){if(null!==c){var e=ti("#remotevideo"+c.rfindex).get(0);null!=e&&void 0!==e.setSinkId&&null!=eg&&e.setSinkId(eg),eI(X?c.rfindex:c.rfid),K&&(void 0!==c.spinner&&null!==c.spinner&&(c.spinner.stop(),c.spinner=null),ti("#waitingvideo"+c.rfindex).remove()),ti("#remotevideo"+c.rfindex).removeClass("hide")}}),eh&&ti("#videoremote"+c.rfindex).append('<div sytle="position: relative;" id="novideo'+c.rfindex+r+'" ><span style="text-align: center; position: absolute;bottom: 0px; right: 0px;left: 0px;font-size: 16px; ">No remote video available</span></div>')):(ti("#remotevideo"+c.rfindex).show(),ti("#remotevideo"+c.rfindex).bind("playing",function(){if(null!==c){0!==ti("#novideo"+c.rfindex).length&&ti("#novideo"+c.rfindex).remove();var e=ti("#remotevideo"+c.rfindex).get(0);null!=e&&void 0!==e.setSinkId&&null!=eg&&e.setSinkId(eg),eI(X?c.rfindex:c.rfid),K&&(void 0!==c.spinner&&null!==c.spinner&&(c.spinner.stop(),c.spinner=null),ti("#waitingvideo"+c.rfindex).remove()),ti("#remotevideo"+c.rfindex).removeClass("hide");var n=this.videoWidth,r=this.videoHeight;G&&(ti("#curres"+c.rfindex).removeClass("hide").text(n+"x"+r).show(),"firefox"===adapter.browserDetails.browser&&setTimeout(function(){if(null!==c){var e=ti("#remotevideo"+c.rfindex).get(0).videoWidth,n=ti("#remotevideo"+c.rfindex).get(0).videoHeight;ti("#curres"+c.rfindex).removeClass("hide").text(e+"x"+n).show()}},2e3))}})),G&&("chrome"!==adapter.browserDetails.browser&&"firefox"!==adapter.browserDetails.browser||(ti("#curbitrate"+c.rfindex).removeClass("hide").show(),R[c.rfindex]=setInterval(function(){if(null!==u){var e=u.getBitrate();ti("#curbitrate"+c.rfindex).text(e)}},1e3)))):s.log("no video label for Remote feed #"+c.rfindex)},ondataopen:function(e){s.log("The DataChannel is available!"+e)},ondata:function(e,n){eB(e,n),s.log("The DataChannel on data!"+n+e)},oncleanup:function(){s.log(" ::: Got a cleanup notification (remote feed "+n+") :::"),b.forEach(e=>{if(e&&"object"==typeof e){var n=e;if(null!==eM){var r=X?n.rfindex:n.rfid;setTimeout(function(){ek(r)},0),!1===X&&ti("#videoremote"+n.rfindex).remove(),K&&(void 0!==n.spinner&&null!==n.spinner&&(n.spinner.stop(),n.spinner=null),ti("#waitingvideo"+n.rfindex).remove()),G&&(ti("#curbitrate"+n.rfindex).remove(),ti("#curres"+n.rfindex).remove(),void 0!==R[n.rfindex]&&null!==R[n.rfindex]&&(clearInterval(R[n.rfindex]),R[n.rfindex]=null)),n=null}}})}},i)}})}function tL(e){if(S[e]){var n=S[e].getTracks();n&&n.forEach(e=>{e.stop()}),S[e]=null}null!=u&&u.send({message:{request:"unsubscribe",feeds:[{id:e}]}})}function tU(e,n,r){if(null!==d){var i=!1;if(void 0!==r&&(i=!0),_[e]&&null!==f){var o={};if(o.rfid=e,i){if(b[r]=o,o.rfindex=r,null!==(l=ti("#videoremote"+(o.rfindex-499)).get(0))){var a=ti("#videoremote"+r).get(0);null!==a&&a.append(l)}}else for(var c=1;c<500;c++)if(void 0===b[c]||null===b[c]){b[c]=o,o.rfindex=c;break}var l=_[e].streams,u=[],p=0;if(l.forEach(n=>{if("data"!==n.type){var r=-1;for(p=-1,"audio"===n.type?r=0:"video"===n.type&&(r=1),c=r;c<10;c+=2)if(!w[c]){w[p=c]=l,l.feed_id=e;break}if(-1===p)return void console.log("Error! No mid for SubscribeStreaming id:"+e);n.pullmid=p,u.push({mid:p.toString(),action:"switch",feed_id:e,feed_mid:n.mid})}}),0===u.length)return void console.log("No Mid for SubscribeStreaming id:"+e);var h="BRTC_CLIENT_SIGNAL";tB(JSON.stringify({type:h,data:{transaction:s.randomString(12),handleId:f.getId(),session_id:d.getSessionId(),request:"update_streams",feeds:[{streams:u,id:e}]}}),h)}}}function tF(n,i,o){var a=!1;void 0!==o&&(a=!0);var c=null;b.forEach(e=>{e&&"object"==typeof e&&e.rfid==n&&(c=e)}),c||d.attach({plugin:e,opaqueId:p,success:function(e){c=e,s.log("Plugin attached! ("+c.getPlugin()+", id="+c.getId()+")"),s.log(" -- This is a subscriber");var r={request:"join",room:parseInt(M),room_name:x,ptype:"listener",id:parseInt(O),app_id:C,role:E,token:"",feed:n,private_id:y,display:i};c.send({message:r})},error:function(e){s.error(" -- Error attaching plugin...",e)},onmessage:function(e,n){s.debug(" ::: Got a message (listener) :::"),s.debug(JSON.stringify(e));var i=e.videoroom;if(s.debug("Event: "+i),null!=i&&null!=i)if("attached"===i){if(a)b[o]=c,c.rfindex=o;else for(var d=1;d<500;d++)if(void 0===b[d]||null===b[d]){b[d]=c,c.rfindex=d;break}if(c.rfid=e.id,c.rfdisplay=e.display,K)if(void 0===c.spinner||null===c.spinner){var l=document.getElementById("videoremote"+c.rfindex+r);c.spinner=new Spinner({top:100}).spin(l)}else c.spinner.spin();eO(X?c.rfindex:c.rfid),s.log("Successfully attached to feed "+c.rfid+" ("+c.rfdisplay+") in room "+e.room)}else void 0!==e.error&&null!==e.error&&eb(e.error);if(null!=n){s.debug("Handling SDP as well..."),s.debug(n),null!==eo&&(n.sdp=tq(n.sdp,eo,es));var u={request:"configure",audio:F,video:U,data:!0};c.send({message:u}),c.createAnswer({jsep:n,media:{audioSend:!1,videoSend:!1,data:!0},success:function(e){s.debug("Got SDP!"),s.debug(e),c.send({message:{request:"start",room:1234},jsep:e})},error:function(e){s.error("WebRTC error:",e),eb("WebRTC error... "+JSON.stringify(e))}})}},webrtcState:function(e){s.log("Janus says this WebRTC PeerConnection (feed #"+c.rfindex+") is "+(e?"up":"down")+" now")},iceState:function(e){s.log("iceConnectionState: "+e),"disconnected"===e?(setTimeout(function(){eA(n,!1),eM(n)},0),setTimeout(function(){tA(n)},100)):"connected"===e&&eA(n,!0)},mediaState:function(e,r){e3(n,e,r)},onlocalstream:function(e){},slowLink:function(e,n){tr(e,n)},onremotestream:function(e){if(s.debug("Remote feed #"+c.rfindex),0===ti("#remotevideo"+c.rfindex).length){var n="";W&&(n="muted"),K&&ti("#videoremote"+c.rfindex).append('<video style="border-radius: 5px; display: block; margin: auto;" id="waitingvideo'+c.rfindex+r+'" width=320 height=240 />'),"safari"===adapter.browserDetails.browser&&(A||W||(n+=" controls")),document.getElementById("remotevideo"+c.rfindex+r)||ti("#videoremote"+c.rfindex).append("<video "+n+' id="remotevideo'+c.rfindex+r+'" width="100%" height="100%" playsinline autoplay/>')}G&&0===ti("#curres"+c.rfindex).length&&ti("#videoremote"+c.rfindex).append('<span id="curres'+c.rfindex+r+'" style="display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:bold;line-height:1;color:#ffffff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em; background-color: #2fa4e7; position: absolute; bottom: 0px; left: 0px;margin: 2px;"></span><span id="curbitrate'+c.rfindex+r+'" style="display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:bold;line-height:1;color:#ffffff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em;background-color: #033c73; position: absolute; bottom: 0px; right: 0px;margin: 2px;"></span>');var i=e.getVideoTracks(),o=ti("#remotevideo"+c.rfindex).get(0);null!==o?(s.attachMediaStream(o,e),null==i||0===i.length?(ti("#remotevideo"+c.rfindex).hide(),ti("#remotevideo"+c.rfindex).bind("playing",function(){if(null!==c){var e=ti("#remotevideo"+c.rfindex).get(0);null!=e&&void 0!==e.setSinkId&&null!=eg&&e.setSinkId(eg),eI(X?c.rfindex:c.rfid),K&&(void 0!==c.spinner&&null!==c.spinner&&c.spinner.stop(),c.spinner=null,ti("#waitingvideo"+c.rfindex).remove()),ti("#remotevideo"+c.rfindex).removeClass("hide")}}),eh&&ti("#videoremote"+c.rfindex).append('<div sytle="position: relative;" id="novideo'+c.rfindex+r+'" ><span style="text-align: center; position: absolute; bottom: 0px; right: 0px;left: 0px;font-size: 16px; ">No remote video available</span></div>')):(ti("#remotevideo"+c.rfindex).show(),c.playing_called=!1,ti("#remotevideo"+c.rfindex).bind("playing",function(){if(null!==c&&!c.playing_called){c.playing_called=!0,0!==ti("#novideo"+c.rfindex).length&&ti("#novideo"+c.rfindex).remove();var e=ti("#remotevideo"+c.rfindex).get(0);null!=e&&void 0!==e.setSinkId&&null!=eg&&e.setSinkId(eg),eI(X?c.rfindex:c.rfid),K&&(void 0!==c.spinner&&null!==c.spinner&&c.spinner.stop(),c.spinner=null,ti("#waitingvideo"+c.rfindex).remove()),ti("#remotevideo"+c.rfindex).removeClass("hide");var n=this.videoWidth,r=this.videoHeight;if(G){var i=ti("#curres"+c.rfindex);i&&(i.removeClass("hide"),i.text(n+"x"+r),i.show()),"firefox"===adapter.browserDetails.browser&&setTimeout(function(){if(null!==c){var e=ti("#remotevideo"+c.rfindex).get(0).videoWidth,n=ti("#remotevideo"+c.rfindex).get(0).videoHeight,r=ti("#curres"+c.rfindex);r&&(r.removeClass("hide"),r.text(e+"x"+n),r.show())}},2e3)}}})),G&&("chrome"!==adapter.browserDetails.browser&&"firefox"!==adapter.browserDetails.browser||(ti("#curbitrate"+c.rfindex).removeClass("hide").show(),R[c.rfindex]=setInterval(function(){if(null!==c){var e=c.getBitrate();ti("#curbitrate"+c.rfindex).text(e)}},1e3)))):s.log("no video label for Remote feed #"+c.rfindex)},ondataopen:function(e){s.log("The DataChannel is available!"+e)},ondata:function(e,n){eB(e,n),s.log("The DataChannel on data!"+n+e)},oncleanup:function(){if(s.log(" ::: Got a cleanup notification (remote feed "+n+") :::"),null!==c){var e=X?c.rfindex:c.rfid;setTimeout(function(){ek(e)},0),!1===X&&ti("#videoremote"+c.rfindex).remove(),K&&(void 0!==c.spinner&&null!==c.spinner&&c.spinner.stop(),c.spinner=null,ti("#waitingvideo"+c.rfindex).remove()),G&&(ti("#curbitrate"+c.rfindex).remove(),ti("#curres"+c.rfindex).remove(),null!==R[c.rfindex]&&null!==R[c.rfindex]&&clearInterval(R[c.rfindex]),R[c.rfindex]=null),c=null}}})}function tH(e){var n,r;if(!eY)return;let i={env:eQ,timestamp:e.timestamp?e.timestamp:(new Date).getTime(),appId:C,roomId:M,userId:O,message:e};n=eK.serverUrl,null==r&&(r={}),r.success="function"==typeof r.success?r.success:function(){},r.error="function"==typeof r.error?r.error:function(){},function(e,n,r,i,o){let s=null;try{s=new XMLHttpRequest}catch(e){try{s=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return void window.alert("Your browser does not support XMLHTTP!")}}for(let i in s.open("GET",e+"?message="+btoa("[RTC_QUALITY_CONTROL]"+function(e){var n,r,i="";for(e=e.replace(/\r\n/g,"\n"),r=0;r<e.length;r++)(n=e.charCodeAt(r))<128?i+=String.fromCharCode(n):(n>127&&n<2048?i+=String.fromCharCode(n>>6|192):(i+=String.fromCharCode(n>>12|224),i+=String.fromCharCode(n>>6&63|128)),i+=String.fromCharCode(63&n|128));return i}(JSON.stringify(n))),!0),r)if(r.hasOwnProperty(i)){let e=r[i];s.setRequestHeader(i,e)}s.send(),s.onreadystatechange=function(){}}(n,i,{"Content-Type":"application/json"},r.success,r.error)}function tq(e,n,r){for(var i=e.split("\r\n"),o=0;o<i.length;o++)if(i[o].match(/a=candidate*/)){var s=i[o].match(/a=candidate:1 1 udp (.+) (.+) (\d+) typ host/);r&&(s[3]=r),i[o]="a=candidate:1 1 udp "+s[1]+" "+n+" "+s[3]+" typ host"}return(e=i.join("\r\n")).endsWith("\r\n")||(e+="\r\n"),e}function tV(e,n){e.success="function"==typeof e.success?e.success:s.noop,e.error="function"==typeof e.error?e.error:s.noop;let r=[];navigator.mediaDevices.enumerateDevices().then(function(i){i.forEach(function(e){(e.kind===n||"all"===n)&&r.push(e)}),e.success(r)}).catch(function(n){e.error(n)})}this.BRTC_GetStatsData=function(){return ta},this.BRTC_ReplaceVideo=function(e){!function(e){if("default"!==e&&""!==e&&void 0!==e||(e=null),em===e||(console.log("videoDeviceId: "+(em=e)),null==l)||null===g||!N)return;let n=tS(e5);null!=em&&"default"!==em&&(n.deviceId={ideal:em},n.facingMode={}),ts(),navigator.mediaDevices.getUserMedia({audio:!1,video:n}).then(function(e){tc(e)}).catch(td)}(e)},this.BRTC_StopAudio=function(){tl()},this.BRTC_ReplaceAudio=function(e){if(ev===e||null===ev&&"default"===e||(ev=e,null==l)||null===g)return;var n=navigator.userAgent;if(/Safari/.test(n)&&!/Chrome/.test(n))return tM(),void setTimeout(function(){tI(!0)},300);let r={audio:!0,video:!1};null!=ev&&"default"!==ev&&(r={audio:{optional:[{sourceId:ev}]},video:!1}),tl(),navigator.mediaDevices.getUserMedia(r).then(function(e){l.createOffer({media:{update:!0,replaceAudio:!0,audioRecv:!1,videoRecv:!1,audioSend:!0,videoSend:!0},stream:e,success(e){}})}).catch(td)},this.BRTC_SetAudioOutputDevice=function(e){eg=e,null!=l&&b.forEach(n=>{if(n&&"object"==typeof n){var r=ti("#remotevideo"+n.rfindex).get(0);void 0!==r.setSinkId&&null!=r&&(console.log("set Audio output audioDeviceId: "+e),r.setSinkId(e))}})},this.BRTC_ReplaceStream=function(e){console.log("newStream: "+e),null!=l&&null!=e&&tc(e)},this.BRTC_GetVideoDevices=function(e){tV(e,"videoinput")},this.BRTC_GetAudioInputDevices=function(e){tV(e,"audioinput")},this.BRTC_GetAudioOutputDevices=function(e){tV(e,"audiooutput")},this.BRTC_GetAllDevices=function(e){tV(e,"all")},this.BRTC_SetDevicesChangeListener=function(e){e="function"==typeof e?e:function(){},navigator.mediaDevices.ondevicechange=function(n){e(n)}},this.BRTC_GetUserList=function(e){if(null!=e&&(e.success="function"==typeof e.success?e.success:s.noop,e.error="function"==typeof e.error?e.error:s.noop),!o){var n={request:"listparticipants",room:M};l.send({message:n,success:null!=e?e.success:s.noop,error:null!=e?e.error:s.noop})}},this.BRTC_SubscribeStreaming=function(e,n){tP(e,n)},this.BRTC_ResubscribeStreaming=function(e){tA(e)},this.BRTC_StopSubscribeStreaming=function(e){return tj(e)},this.v4hook_BRTC_StopSubscribeStreaming=function(e){return new Promise((n,i)=>{tb(e),w.forEach((n,r)=>{n&&n.feed_id===e&&(w[r]=null)});var a=!1;b.some((n,i)=>!(!n||"object"!=typeof n||n.rfindex!==e&&n.rfid!==e)&&(b[i]=null,!1===X?o&&document.getElementById("v4videos"+r)&&ti("#videoremote"+n.rfindex)[0]&&(document.getElementById("v4videos"+r).appendChild(ti("#videoremote"+n.rfindex)[0].firstChild),ti("#videoremote"+n.rfindex).remove()):ti("#videoremote"+n.rfindex).empty(),function(e){var n="BRTC_CLIENT_SIGNAL",r=[];if(_[e]){_[e].streams.forEach(e=>{"number"==typeof e.pullmid&&r.push({mid:e.pullmid.toString(),type:e.type})});var i={type:n,data:{request:"unsubscribe",transaction:s.randomString(12),handleId:f.getId(),session_id:d.getSessionId(),streams:r}};r.length>0&&tB(JSON.stringify(i),n)}}(e),a=!0,!0)),n(a?"success: feedid: "+e:"warning: not subscribed feedid: "+e)})},this.BRTC_StartPublish=function(){tI(!0)},this.BRTC_StopPublish=function(e){return new Promise((e,n)=>{e$=function(){e()},eX=!0,tM()})},this.v4hook_BRTC_StopPublish=function(e){return new Promise((n,r)=>{var i=[],a=[];e?(e.audio&&a.push("0"),e.video&&a.push("1")):a=["0","1"],a.forEach(e=>{i.push({mid:e,method:"client",pause:!0})});var c="BRTC_CLIENT_SIGNAL",u={type:c,data:{request:"pause_resume",transaction:s.randomString(12),handleId:l.getId(),session_id:d.getSessionId(),streams:i}};console.log("Send DataChannel msg:"+JSON.stringify(u)),tD(JSON.stringify(u),c),n(),o&&tn&&(e?(e.audio&&tl(),e.video&&ts()):(tl(),ts()))})},this.BRTC_MuteMicphone=function(e){null!==l&&(e?l.muteAudio():l.unmuteAudio())},this.v4hook_BRTC_MuteCamera=function(e){if(l&&o){var n="BRTC_CLIENT_SIGNAL",r={type:n,data:{request:"pause_resume",transaction:s.randomString(12),handleId:l.getId(),session_id:d.getSessionId(),streams:[{mid:"1",method:"client",pause:e}]}};return console.log("Send DataChannel msg:"+JSON.stringify(r)),void tD(JSON.stringify(r),n)}},this.BRTC_MuteCamera=function(e){null!==l&&(N=!e,e$=function(){setTimeout(function(){tI(!0)},500)},eX=!0,tM())},this.BRTC_MuteCamera_legcy=function(e){null!==l&&(e?l.muteVideo():l.unmuteVideo())},this.BRTC_MuteRemoteVideo=function(e,n,o){if(null!==l&&!i)return"number"!=typeof o||e?void(void 0!==n?b.some(r=>{if(r&&"object"==typeof r&&(r.rfindex==n||r.rfid==n)){var i={request:"configure",audio:F,video:!e,data:!0};return r.send({message:i}),e&&(r.lastmutedtime=Date.now()),!0}return!1}):b.forEach(n=>{if(n&&"object"==typeof n){var r={request:"configure",audio:F,video:!e,data:!0};n.send({message:r}),e&&(n.lastmutedtime=Date.now())}})):void 0===n?void b.forEach(e=>{if(e&&"object"==typeof e)if(e.lastmutedtime+o<Date.now()){var n=document.getElementById("videoremote"+remoteFeed.rfindex+r).parentNode.parentNode.id,i=e.rfid;tj(i),setTimeout(function(){tP(n,i)},200)}else{var s={request:"configure",audio:F,video:!0,data:!0};e.send({message:s})}}):void b.some(e=>{if(e&&"object"==typeof e&&(e.rfindex==n||e.rfid==n)){if(e.lastmutedtime+o<Date.now()){var i=document.getElementById("videoremote"+remoteFeed.rfindex+r).parentNode.parentNode.id,s=e.rfid;tj(s),setTimeout(function(){tP(i,s)},200)}else{var a={request:"configure",audio:F,video:!0,data:!0};e.send({message:a})}return!0}return!1})},this.BRTC_MuteRemoteAudio=function(e,n){null!==l&&(i||(void 0!==n?b.some(r=>{if(r&&"object"==typeof r&&(X?r.rfindex==n:r.rfid==n)){var i={request:"configure",audio:!e,video:U,data:!0};return r.send({message:i}),!0}return!1}):b.forEach(n=>{if(n&&"object"==typeof n){var r={request:"configure",audio:!e,video:U,data:!0};n.send({message:r})}})))},this.v4hook_BRTC_MuteRemoteVideo=function(e,n,r){tu("video",e,n)},this.v4hook_BRTC_MuteRemoteAudio=function(e,n){tu("audio",e,n)},this.v4hook_BRTC_SwitchScreen=function(e){tf(!D,!1).then(function(n){D=!D,tc(n),e&&e.success&&e.success("BRTC_SwitchScreen success.")},function(n){e&&e.error&&e.error("BRTC_SwitchScreen error: "+n)})},this.BRTC_SwitchScreen=function(e){tp(e)},this.BRTC_GetRemoteAudioLevels=function(){let e=[];return i?b.forEach(n=>{if(n&&"object"==typeof n){if(u.webrtcStuff&&u.webrtcStuff.pc&&u.webrtcStuff.pc.getStats){n.ssrcs=[];var r=u.webrtcStuff.pc.getTransceivers();if(r&&r.length>0)for(var i in r){var o=r[i],s=w[o.mid];if(s&&n.rfid===s.feed_id){let e=o.receiver;if(e&&e.track&&"audio"===e.track.kind){let r=e.getSynchronizationSources();if("safari"===adapter.browserDetails.browser)for(let e in r){let n=r[e];n.audioLevel=Math.pow(10,-1*n.audioLevel/20)}n.ssrcs=r,r.length>0&&(n.ssrc0=r[0].source);break}}}u.webrtcStuff.pc.getStats().then(function(e){e.forEach(e=>!("ssrc"!==e.type||(n.packetsReceived=parseInt(e.stat("packetsReceived"),10),n.packetsLost=parseInt(e.stat("packetsLost"),10),""!==e.stat("googDecodingCTN")&&(n.googDecodingCTN=parseInt(e.stat("googDecodingCTN"),10)),""!==e.stat("googDecodingNormal")&&(n.googDecodingNormal=parseInt(e.stat("googDecodingNormal"),10)),""!==e.stat("googDecodingMuted")&&(n.googDecodingMuted=parseInt(e.stat("googDecodingMuted"),10)),e.stat("audioOutputLevel")&&(n.volume=parseInt(e.stat("audioOutputLevel"),10)),!e.id.includes(n.ssrc0))))})}let a={feedId:n.rfid,display:n.rfdisplay,ssrcs:n.ssrcs,packetsReceived:n.packetsReceived?n.packetsReceived:0,packetsLost:n.packetsLost?n.packetsLost:0,googDecodingCTN:n.googDecodingCTN?n.googDecodingCTN:0,googDecodingNormal:n.googDecodingNormal?n.googDecodingNormal:0,googDecodingMuted:n.googDecodingMuted?n.googDecodingMuted:0,volume:n.volume?n.volume:2};e.push(a)}}):b.forEach(n=>{if(n&&"object"==typeof n){n.webrtcStuff&&n.webrtcStuff.pc&&n.webrtcStuff.pc.getStats&&n.webrtcStuff.pc.getStats().then(function(e){e.forEach(e=>"ssrc"===e.type&&(n.packetsReceived=parseInt(e.stat("packetsReceived")),n.packetsLost=parseInt(e.stat("packetsLost")),""!=e.stat("googDecodingCTN")&&(n.googDecodingCTN=parseInt(e.stat("googDecodingCTN"))),""!=e.stat("googDecodingNormal")&&(n.googDecodingNormal=parseInt(e.stat("googDecodingNormal"))),""!=e.stat("googDecodingMuted")&&(n.googDecodingMuted=parseInt(e.stat("googDecodingMuted"))),""!=e.stat("googDecodingCTN")))});let r={feedId:n.rfid,display:n.rfdisplay,ssrcs:n.getSsrcs(),packetsReceived:n.packetsReceived?n.packetsReceived:0,packetsLost:n.packetsLost?n.packetsLost:0,googDecodingCTN:n.googDecodingCTN?n.googDecodingCTN:0,googDecodingNormal:n.googDecodingNormal?n.googDecodingNormal:0,googDecodingMuted:n.googDecodingMuted?n.googDecodingMuted:0,volume:n.getRemoteVolume()};e.push(r)}}),e},this.BRTC_GetRemoteUsers=function(){return eV},this.BRTC_SendMessageToUser=function(e,n){if(null!==d)if(void 0===n&&(n=0),o){var r=0===n?"BRTC_CLIENT_MESSAGE":"BRTC_CLIENT_P2P_MESSAGE",i={type:r,from:parseInt(O,10),to:n,data:e};tD(JSON.stringify(i),r)}else i={request:"senddata",room:M,id:parseInt(O,10),to:n,data:e,internal:!1},d.send({message:i,success:function(e){}})},this.BRTC_SetUserAttribute=function(e){if(null!==d&&!o){var n={request:"setuserattribute",room:M,id:parseInt(O),userattribute:e};d.send({message:n,success:function(n){var r={request:"senddata",room:M,id:parseInt(O),to:0,data:e,internal:!0};d.send({message:r,success:function(e){}})}})}},this.BRTC_GetUserAttribute=function(e){return new Promise((n,r)=>{if(null!==d)if(o)r();else{(e=e||{}).onattribute="function"==typeof e.onattribute?e.onattribute:function(){},void 0===e.feedid&&(e.feedid=parseInt(O));var i={request:"getuserattribute",room:M,id:e.feedid};d.send({message:i,success:function(r){var i={id:r.id,attribute:r.userattribute};e.onattribute(i),n(i)}})}else r()})},this.BRTC_GetRemoteVideoInfo=function(e){var n={};return i?b.some(r=>{if(r&&"object"==typeof r&&(r.rfid===e||r.rfindex===e)){n.id=r.rfid,n.bitrate=u.getBitrate(),n.fps=u.getFps(),n.width=0,n.height=0;var i=ti("#remotevideo"+r.rfindex).get(0);return null!=i&&(n.width=i.videoWidth,n.height=i.videoHeight),!0}return!1}):b.some(r=>{if(r&&"object"==typeof r&&(r.rfid===e||r.rfindex===e)){n.id=r.rfid,n.bitrate=r.getBitrate(),n.fps=r.getFps(),n.width=0,n.height=0;var i=ti("#remotevideo"+r.rfindex).get(0);return null!=i&&(n.width=i.videoWidth,n.height=i.videoHeight),!0}return!1}),n},this.BRTC_KickoutUser=function(e){if(null!==d&&!o&&void 0!==e){var n={request:"kickoutuser",room:M,target:e};d.send({message:n,success:function(e){}})}},this.BRTC_DisbandRoom=function(){if(null!==d&&!o){var e={request:"disbandroom",room:M};d.send({message:e,success:function(e){}})}},this.BRTC_ShutUpUser=function(e,n){if(null!==d&&!o){"boolean"!=typeof n&&(n=!0);var r={request:"forwardconfigure",room:M,target:e,audio:!n,video:!n,data:!n};d.send({message:r,success:function(e){}})}},this.BRTC_StartLiveServerStreaming=function(e,n,r,i){if(null!==d){var o={request:"startbypass",level:i,room:M,id:parseInt(O,10),rtmp:{url:e,mix:n,mixTemplate:r}};"object"==typeof r&&(o.rtmp.mixTranscodingCfg=r,delete o.rtmp.mix,delete o.rtmp.mixTemplate),d.send({message:o,success:function(e){}})}},this.BRTC_StartLiveServerStreamingEx=function(e,n,r){return this.BRTC_StartLiveServerStreaming(e,!0,r,n)},this.BRTC_StopLiveServerStreaming=function(e){return new Promise((n,r)=>{if(null!==d){var i={request:"stopbypass",level:e,room:M,id:parseInt(O,10)};d.send({message:i,success:function(e){n()}})}else n()})},this.BRTC_StartRoomMediaRelay=function(e,n,r){return new Promise((i,s)=>{if(null===l||o)s();else{0===n&&(n=parseInt(O,10));var a={request:"start_media_relay",dest_room_name:e,dest_id:n,dest_token:r};l.send({message:a,success:function(e){i()},error:function(e){s()}})}})},this.BRTC_StopRoomMediaRelay=function(e,n){return new Promise((r,i)=>{if(null===l||o)i();else{0===n&&(n=parseInt(O,10));var s={request:"stop_media_relay",dest_room_name:e,dest_id:n};l.send({message:s,success:function(e){r()},error:function(e){i()}})}})},this.BRTC_StopRoomMediaRelayAll=function(){return new Promise((e,n)=>{null===l||o?n():l.send({message:{request:"stop_media_relay",stopall:!0},success:function(n){e()},error:function(e){n()}})})},this.BRTC_StartRecording=function(e,n,r,i){return new Promise((s,a)=>{if(null===d||o)a();else{var c={request:"startrecording"};e&&("anchor"===e&&(e="user"),c.level=e),n&&(c.mixTranscodingCfg=n),r&&(c.recordingFileCfg=r),i&&(c.storageCfg=i),d.send({message:c,success:function(e){s()}})}})},this.BRTC_StopRecording=function(e){return new Promise((n,r)=>{if(null===d||o)r();else{var i={request:"stoprecording"};e&&("anchor"===e&&(e="user"),i.level=e),d.send({message:i,success:function(e){n()}})}})},this.BRTC_GetMessageDelay=function(e,n){return new Promise((r,i)=>{if(null===d||o)i();else{var s={request:"send_echoreq",room:M,id:parseInt(O,10),to:e,data:n,reqSendTs:Date.now()};d.send({message:s,success:function(e){r()}})}})},this.BRTC_Render_TryLockDevice=function(){return new Promise((e,n)=>{null===d?n():d.doaction({action:"tryLockDevice",appType:"game",appVersion:"v1",region:"bj"},{success:function(){e()},error:function(e){n(e)}})})},this.BRTC_Render_UnlockDevice=function(e){return new Promise((e,n)=>{null===d?n():d.doaction({action:"unlockDevice",appType:"game",appVersion:"v1",region:"bj"},{success:function(){e()}})})},this.BRTC_Render_JoinDeviceQueue=function(e){return new Promise((e,n)=>{null===d?n():d.doaction({action:"joinDeviceQueue",appType:"game",appVersion:"v1",region:"bj"},{success:function(){e()},error:function(e){n(e)}})})},this.BRTC_Render_LeaveDeviceQueue=function(e){return new Promise((e,n)=>{null===d?n():d.doaction({action:"leaveDeviceQueue",appType:"game",appVersion:"v1",region:"bj"},{success:function(){e()}})})},this.BRTC_Render_StartApp=function(e){return new Promise((n,r)=>{if(null===d)return void r();let i={action:"startApp",appType:"game",appVersion:"v1",region:"bj"};e&&(i.renderEncodeConfig=Object.assign(e)),d.doaction(i,{success:function(){n()}})})},this.BRTC_Render_StopApp=function(e){return new Promise((e,n)=>{null===d?n():d.doaction({action:"stopApp",appType:"game",appVersion:"v1",region:"bj"},{success:function(){e()}})})},this.BRTC_SetParamSettings=function(e){tw(e=e||{})},this.BRTC_AquireDevicePermission=function(e){e.success="function"==typeof e.success?e.success:function(){},e.error="function"==typeof e.error?e.error:function(){},navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(function(n){e.success(),n.getAudioTracks().forEach(function(e){e.stop()}),n.getVideoTracks().forEach(function(e){e.stop()})}).catch(function(n){e.error(n)})},this.BRTC_DeviceTest_Start=function(e){e.success="function"==typeof e.success?e.success:function(){},e.error="function"==typeof e.error?e.error:function(){},eJ.using_video=!0,eJ.using_audio=!0,eJ.mirrorlocalvideo=!0,eJ.remoteaudioid="",eJ.videoprofile="hires",eJ.videoDeviceId=null,eJ.audioDeviceId=null,eJ.audioOutputDeviceId=null,eJ.myStream=null,eJ.onlocalstream=function(){},null!==e.usingvideo&&void 0!==e.usingvideo&&(eJ.using_video=e.usingvideo),null!==e.usingaudio&&void 0!==e.usingaudio&&(eJ.using_audio=e.usingaudio),null!==e.videodeviceid&&void 0!==e.videodeviceid&&(eJ.videoDeviceId=e.videodeviceid),null!==e.audiodeviceid&&void 0!==e.audiodeviceid&&(eJ.audioDeviceId=e.audiodeviceid),null!==e.audiooutputdeviceid&&void 0!==e.audiooutputdeviceid&&(eJ.audioOutputDeviceId=e.audiooutputdeviceid),null!==e.mirrorlocalvideo&&void 0!==e.mirrorlocalvideo&&(eJ.mirrorlocalvideo=e.mirrorlocalvideo),null!==e.remoteaudioid&&void 0!==e.remoteaudioid&&(eJ.remoteaudioid=e.remoteaudioid),null!==e.videoprofile&&void 0!==e.videoprofile&&(eJ.videoprofile=e.videoprofile),eJ.onlocalstream="function"==typeof e.onlocalstream?e.onlocalstream:function(){},"dt_videolocal"!=e.localvideoviewid&&ti("#"+e.localvideoviewid).append('<div style="width: 100%;height: 100%;" id="dt_videolocal"></div>'),ti("#dt_videolocal").empty(),0===ti("#dt_myvideo").length&&(eJ.mirrorlocalvideo?ti("#dt_videolocal").append('<video style="display: block; margin: auto; -webkit-transform: scaleX(-1); transform: scaleX(-1);" id="dt_myvideo" width="100%" height="100%" playsinline autoplay muted="muted"/>'):ti("#dt_videolocal").append('<video style="display: block; margin: auto;" id="dt_myvideo" width="100%" height="100%" playsinline autoplay muted="muted"/>')),tR(eJ.using_video,eJ.using_audio,e)},this.BRTC_DeviceTest_Stop=function(){tT(),ti("#dt_videolocal").remove()},this.BRTC_DeviceTest_MuteCamera=function(e){tR(!e,eJ.using_audio)},this.BRTC_DeviceTest_MuteMicphone=function(e){tR(eJ.using_video,!e)},this.BRTC_DeviceTest_SetAudioOutputDevice=function(e){eJ.audioOutputDeviceId=e;var n=ti("#"+eJ.remoteaudioid).get(0);null!=n&&void 0!==n.setSinkId&&n.setSinkId(e)},this.BRTC_DeviceTest_ReplaceAudio=function(e){"default"!==e&&""!==e&&void 0!==e||(e=null),eJ.audioDeviceId!==e&&(eJ.audioDeviceId=e,console.log("BRTC_DeviceTest_ReplaceAudio audioDeviceId: "+eJ.audioDeviceId),null!==eJ.myStream&&tR(eJ.using_video,!0))},this.BRTC_DeviceTest_ReplaceVideo=function(e){"default"!==e&&""!==e&&void 0!==e||(e=null),eJ.videoDeviceId!==e&&(eJ.videoDeviceId=e,console.log("BRTC_DeviceTest_ReplaceVideo videoDeviceId: "+eJ.videoDeviceId),null!==eJ.myStream&&(tT(),tR(!0,eJ.using_audio)))},this.BRTC_SetDebugLevel=function(e){ep=e},this.BRTC_Version=function(){return"BRTC.Web.SDK V1.2.21"}}s.useDefaultDependencies=function(e){var n=e&&e.fetch||fetch,r=e&&e.Promise||Promise,i=e&&e.WebSocket||WebSocket;return{newWebSocket:function(e,n){return new i(e,n)},extension:e&&e.extension||o,isArray:function(e){return Array.isArray(e)},webRTCAdapter:e&&e.adapter||adapter,httpAPICall:function(e,i){var o={method:i.verb,headers:{Accept:"application/json, text/plain, */*"},cache:"no-cache"};"POST"===i.verb&&(o.headers["Content-Type"]="application/json"),void 0!==i.withCredentials&&(o.credentials=!0===i.withCredentials?"include":i.withCredentials?i.withCredentials:"omit"),void 0!==i.body&&(o.body=JSON.stringify(i.body));var a=n(e,o).catch(function(e){return r.reject({message:"Probably a network error, is the server down?",error:e})});if(void 0!==i.timeout){var c=new r(function(e,n){var r=setTimeout(function(){return clearTimeout(r),n({message:"Request timed out",timeout:i.timeout})},i.timeout)});a=r.race([a,c])}return a.then(function(e){return e.ok?typeof i.success==typeof s.noop?e.json().then(function(e){i.success(e)}).catch(function(n){return r.reject({message:"Failed to parse response body",error:n,response:e})}):void 0:r.reject({message:"API call failed",response:e})}).catch(function(e){typeof i.error==typeof s.noop&&i.error(e.message||"<< internal error >>",e)}),a}}},s.useOldDependencies=function(e){var n=e&&e.jQuery||jQuery,r=e&&e.WebSocket||WebSocket;return{newWebSocket:function(e,n){return new r(e,n)},isArray:function(e){return n.isArray(e)},extension:e&&e.extension||o,webRTCAdapter:e&&e.adapter||adapter,httpAPICall:function(e,r){var i=void 0!==r.body?{contentType:"application/json",data:JSON.stringify(r.body)}:{},o=void 0!==r.withCredentials?{xhrFields:{withCredentials:r.withCredentials}}:{};return n.ajax(n.extend(i,o,{url:e,type:r.verb,cache:!1,dataType:"json",async:r.async,timeout:r.timeout,success:function(e){typeof r.success==typeof s.noop&&r.success(e)},error:function(e,n,i){typeof r.error==typeof s.noop&&r.error(n,i)}}))}}},s.noop=function(){},s.dataChanDefaultLabel="JanusDataChannel",s.init=function(e){if((e=e||{}).callback="function"==typeof e.callback?e.callback:s.noop,!0===s.initDone)e.callback();else{if("undefined"!=typeof console&&void 0!==console.log||(console={log:function(){}}),s.trace=s.noop,s.debug=s.noop,s.vdebug=s.noop,s.log=s.noop,s.warn=s.noop,s.error=s.noop,!0===e.debug||"all"===e.debug)s.trace=console.trace.bind(console),s.debug=console.debug.bind(console),s.vdebug=console.debug.bind(console),s.log=console.log.bind(console),s.warn=console.warn.bind(console),s.error=console.error.bind(console);else if(Array.isArray(e.debug))for(var n in e.debug){var r=e.debug[n];switch(r){case"trace":s.trace=console.trace.bind(console);break;case"debug":s.debug=console.debug.bind(console);break;case"vdebug":s.vdebug=console.debug.bind(console);break;case"log":s.log=console.log.bind(console);break;case"warn":s.warn=console.warn.bind(console);break;case"error":s.error=console.error.bind(console);break;default:console.error("Unknown debugging option '"+r+"' (supported: 'trace', 'debug', 'vdebug', 'log', warn', 'error')")}}s.log("Initializing library");var i=e.dependencies||s.useDefaultDependencies();s.isArray=i.isArray,s.webRTCAdapter=i.webRTCAdapter,s.httpAPICall=i.httpAPICall,s.newWebSocket=i.newWebSocket,s.extension=i.extension,s.extension.init(),s.listDevices=function(e,n){e="function"==typeof e?e:s.noop,null==n&&(n={audio:!0,video:!0}),s.isGetUserMediaAvailable()?navigator.mediaDevices.getUserMedia(n).then(function(n){navigator.mediaDevices.enumerateDevices().then(function(r){s.debug(r),e(r);try{var i=n.getTracks();for(var o in i){var a=i[o];null!=a&&a.stop()}}catch(e){}})}).catch(function(n){s.error(n),e([])}):(s.warn("navigator.mediaDevices unavailable"),e([]))},s.attachMediaStream=function(e,n){if(null!=e)if("chrome"===s.webRTCAdapter.browserDetails.browser){s.webRTCAdapter.browserDetails.version;try{e.srcObject=n}catch(r){e.src=URL.createObjectURL(n)}}else e.srcObject=n},s.reattachMediaStream=function(e,n){"chrome"===s.webRTCAdapter.browserDetails.browser?s.webRTCAdapter.browserDetails.version>=52?e.srcObject=n.srcObject:void 0!==e.src?e.src=n.src:s.error("Error reattaching stream to element"):e.srcObject=n.srcObject};var o=["iPad","iPhone","iPod"].indexOf(navigator.platform)>=0?"pagehide":"beforeunload",a=window["on"+o];if(window.addEventListener(o,function(e){for(var n in s.log("Closing window"),s.sessions)null!==s.sessions[n]&&void 0!==s.sessions[n]&&s.sessions[n].destroyOnUnload&&(s.log("Destroying session "+n),s.sessions[n].destroy({asyncRequest:!1,notifyDestroyed:!1}));a&&"function"==typeof a&&a()}),s.safariVp8=!1,"safari"===s.webRTCAdapter.browserDetails.browser&&s.webRTCAdapter.browserDetails.version>=605)if(RTCRtpSender&&RTCRtpSender.getCapabilities&&RTCRtpSender.getCapabilities("video")&&RTCRtpSender.getCapabilities("video").codecs&&RTCRtpSender.getCapabilities("video").codecs.length){for(var n in RTCRtpSender.getCapabilities("video").codecs){var c=RTCRtpSender.getCapabilities("video").codecs[n];if(c&&c.mimeType&&"video/vp8"===c.mimeType.toLowerCase()){s.safariVp8=!0;break}}s.safariVp8?s.log("This version of Safari supports VP8"):s.warn("This version of Safari does NOT support VP8: if you're using a Technology Preview, try enabling the 'WebRTC VP8 codec' setting in the 'Experimental Features' Develop menu")}else{var d=new RTCPeerConnection({},{});d.createOffer({offerToReceiveVideo:!0}).then(function(e){s.safariVp8=-1!==e.sdp.indexOf("VP8"),s.safariVp8?s.log("This version of Safari supports VP8"):s.warn("This version of Safari does NOT support VP8: if you're using a Technology Preview, try enabling the 'WebRTC VP8 codec' setting in the 'Experimental Features' Develop menu"),d.close(),d=null})}s.initDone=!0,e.callback()}},s.isWebrtcSupported=function(){return void 0!==window.RTCPeerConnection&&null!==window.RTCPeerConnection},s.isGetUserMediaAvailable=function(){return void 0!==navigator.mediaDevices&&null!==navigator.mediaDevices&&void 0!==navigator.mediaDevices.getUserMedia&&null!==navigator.mediaDevices.getUserMedia},s.randomString=function(e){for(var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r="",i=0;i<e;i++){var o=Math.floor(Math.random()*n.length);r+=n.substring(o,o+1)}return r},function(){var e,n,r,i,o,s,a,c,d,l,u,f,p,h,m,v,g,y=null,b=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535],_=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],w=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,99,99],S=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],R=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],T=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function C(){this.next=null,this.list=null}function x(){this.e=0,this.b=0,this.n=0,this.t=null}function E(e,n,r,i,o,s){this.BMAX=16,this.N_MAX=288,this.status=0,this.root=null,this.m=0;var a,c,d,l,u,f,p,h,m,v,g,y,b,_,w,S,R,T=[],E=[],O=new x,I=[],k=[],M=[];for(R=this.root=null,f=0;f<this.BMAX+1;f++)T[f]=0;for(f=0;f<this.BMAX+1;f++)E[f]=0;for(f=0;f<this.BMAX;f++)I[f]=null;for(f=0;f<this.N_MAX;f++)k[f]=0;for(f=0;f<this.BMAX+1;f++)M[f]=0;c=n>256?e[256]:this.BMAX,m=e,v=0,f=n;do T[m[v]]++,v++;while(--f>0);if(T[0]===n)return this.root=null,this.m=0,void(this.status=0);for(p=1;p<=this.BMAX&&0===T[p];p++);for(h=p,s<p&&(s=p),f=this.BMAX;0!==f&&0===T[f];f--);for(l=f,s>f&&(s=f),_=1<<p;p<f;p++,_<<=1)if((_-=T[p])<0)return this.status=2,void(this.m=s);if((_-=T[f])<0)return this.status=2,void(this.m=s);for(T[f]+=_,M[1]=p=0,m=T,v=1,b=2;--f>0;)M[b++]=p+=m[v++];m=e,v=0,f=0;do 0!==(p=m[v++])&&(k[M[p]++]=f);while(++f<n);for(n=M[l],M[0]=f=0,m=k,v=0,u=-1,y=E[0]=0,g=null,w=0;h<=l;h++)for(a=T[h];a-- >0;){for(;h>y+E[1+u];){if(y+=E[1+u],u++,w=(w=l-y)>s?s:w,(d=1<<(p=h-y))>a+1)for(d-=a+1,b=h;++p<w&&!((d<<=1)<=T[++b]);)d-=T[b];for(y+p>c&&y<c&&(p=c-y),w=1<<p,E[1+u]=p,g=[],S=0;S<w;S++)g[S]=new x;(R=R?R.next=new C:this.root=new C).next=null,R.list=g,I[u]=g,u>0&&(M[u]=f,O.b=E[u],O.e=16+p,O.t=g,p=(f&(1<<y)-1)>>y-E[u],I[u-1][p].e=O.e,I[u-1][p].b=O.b,I[u-1][p].n=O.n,I[u-1][p].t=O.t)}for(O.b=h-y,v>=n?O.e=99:m[v]<r?(O.e=m[v]<256?16:15,O.n=m[v++]):(O.e=o[m[v]-r],O.n=i[m[v++]-r]),d=1<<h-y,p=f>>y;p<w;p+=d)g[p].e=O.e,g[p].b=O.b,g[p].n=O.n,g[p].t=O.t;for(p=1<<h-1;0!=(f&p);p>>=1)f^=p;for(f^=p;(f&(1<<y)-1)!==M[u];)y-=E[u],u--}this.m=E[1],this.status=+(0!==_&&1!==l)}function O(e){for(;a<e;)s|=(v.length===g?-1:255&v[g++])<<a,a+=8}function I(e){return s&b[e]}function k(e){s>>=e,a-=e}function M(r,i,o){var s,a,d;if(0===o)return 0;for(d=0;;){for(O(h),s=(a=f.list[I(h)]).e;s>16;){if(99===s)return -1;k(a.b),O(s-=16),s=(a=a.t[I(s)]).e}if(k(a.b),16!==s){if(15===s)break;for(O(s),l=a.n+I(s),k(s),O(m),s=(a=p.list[I(m)]).e;s>16;){if(99===s)return -1;k(a.b),O(s-=16),s=(a=a.t[I(s)]).e}for(k(a.b),O(s),u=n-a.n-I(s),k(s);l>0&&d<o;)l--,u&=32767,n&=32767,r[i+d++]=e[n++]=e[u++];if(d===o)return o}else if(n&=32767,r[i+d++]=e[n++]=a.n,d===o)return o}return c=-1,d}window.brtc_inflate=function(b){var C,x=[];e||(e=[]),n=0,s=0,a=0,c=-1,d=!1,l=u=0,f=null,v=b,g=0;do C=function(v,g,b){var C,x;for(C=0;C<1024&&(!d||-1!==c);){if(l>0){if(0!==c)for(;l>0&&C<1024;)l--,u&=32767,n&=32767,v[g+C++]=e[n++]=e[u++];else{for(;l>0&&C<1024;)l--,n&=32767,O(8),v[g+C++]=e[n++]=I(8),k(8);0===l&&(c=-1)}if(1024===C)break}if(-1===c){if(d)break;O(1),0!==I(1)&&(d=!0),k(1),O(2),c=I(2),k(2),f=null,l=0}switch(c){case 0:x=function(r,i,o){var d;if(k(d=7&a),O(16),d=I(16),k(16),O(16),d!==(65535&~s))return -1;for(k(16),l=d,d=0;l>0&&d<o;)l--,n&=32767,O(8),r[i+d++]=e[n++]=I(8),k(8);return 0===l&&(c=-1),d}(v,g+C,1024-C);break;case 1:x=f?M(v,g+C,1024-C):function(e,n,s){if(!y){var a,c,d=[];for(a=0;a<144;a++)d[a]=8;for(;a<256;a++)d[a]=9;for(;a<280;a++)d[a]=7;for(;a<288;a++)d[a]=8;if(0!==(c=new E(d,288,257,_,w,i=7)).status)return console.error("HufBuild error: "+c.status),-1;for(y=c.root,i=c.m,a=0;a<30;a++)d[a]=5;if((c=new E(d,30,0,S,R,o=5)).status>1)return y=null,console.error("HufBuild error: "+c.status),-1;r=c.root,o=c.m}return f=y,p=r,h=i,m=o,M(e,n,s)}(v,g+C,1024-C);break;case 2:x=f?M(v,g+C,1024-C):function(e,n,r){var i,o,s,a,c,d,l,u,v,g=[];for(i=0;i<316;i++)g[i]=0;if(O(5),l=257+I(5),k(5),O(5),u=1+I(5),k(5),O(4),d=4+I(4),k(4),l>286||u>30)return -1;for(o=0;o<d;o++)O(3),g[T[o]]=I(3),k(3);for(;o<19;o++)g[T[o]]=0;if(0!==(v=new E(g,19,19,null,null,h=7)).status)return -1;for(f=v.root,h=v.m,a=l+u,i=s=0;i<a;)if(O(h),k(o=(c=f.list[I(h)]).b),(o=c.n)<16)g[i++]=s=o;else if(16===o){if(O(2),o=3+I(2),k(2),i+o>a)return -1;for(;o-- >0;)g[i++]=s}else if(17===o){if(O(3),o=3+I(3),k(3),i+o>a)return -1;for(;o-- >0;)g[i++]=0;s=0}else{if(O(7),o=11+I(7),k(7),i+o>a)return -1;for(;o-- >0;)g[i++]=0;s=0}if(v=new E(g,l,257,_,w,h=9),0===h&&(v.status=1),0!==v.status&&1!==v.status)return -1;for(f=v.root,h=v.m,i=0;i<u;i++)g[i]=g[i+l];return p=(v=new E(g,u,0,S,R,m=6)).root,0===(m=v.m)&&l>257||0!==v.status?-1:M(e,n,r)}(v,g+C,1024-C);break;default:x=-1}if(-1===x)return d?0:-1;C+=x}return C}(x,x.length,0);while(C>0);return v=null,x}}();var c=new a;function d(e,n){e.success="function"==typeof e.success?e.success:function(){},e.error="function"==typeof e.error?e.error:function(){};let r=[];navigator.mediaDevices.enumerateDevices().then(function(i){i.forEach(function(e){(e.kind===n||"all"===n)&&r.push(e)}),e.success(r)}).catch(function(n){e.error(n)})}c.setThisDomID(""),window.BRTC_Start=function(e){null===c&&(c=new a),c.BRTC_Start(e)},window.BRTC_Stop=function(){null!=c&&c.BRTC_Stop()},window.BRTC_SendData=function(e,n){null!=c&&c.BRTC_SendData(e,n)},window.BRTC_StopVideo=function(){null!=c&&c.BRTC_StopVideo()},window.BRTC_GetStatsData=function(){if(null!=c)return c.BRTC_GetStatsData()},window.BRTC_ReplaceVideo=function(e){null!=c&&c.BRTC_ReplaceVideo(e)},window.BRTC_StopAudio=function(){null!=c&&c.BRTC_StopAudio()},window.BRTC_ReplaceAudio=function(e){null!=c&&c.BRTC_ReplaceAudio(e)},window.BRTC_SetAudioOutputDevice=function(e){null!=c&&c.BRTC_SetAudioOutputDevice(e)},window.BRTC_ReplaceStream=function(e){null!=c&&c.BRTC_ReplaceStream(e)},window.BRTC_GetVideoDevices=function(e){d(e,"videoinput")},window.BRTC_GetAudioInputDevices=function(e){d(e,"audioinput")},window.BRTC_GetAudioOutputDevices=function(e){d(e,"audiooutput")},window.BRTC_GetAllDevices=function(e){d(e,"all")},window.BRTC_SetDevicesChangeListener=function(e){e="function"==typeof e?e:function(){},navigator.mediaDevices.ondevicechange=function(n){e(n)}},window.BRTC_GetUserList=function(e){null!=c&&c.BRTC_GetUserList(e)},window.BRTC_SubscribeStreaming=function(e,n){null!=c&&c.BRTC_SubscribeStreaming(e,n)},window.BRTC_ResubscribeStreaming=function(e){null!=c&&c.BRTC_ResubscribeStreaming(e)},window.BRTC_StopSubscribeStreaming=function(e){if(null!=c)return c.BRTC_StopSubscribeStreaming(e)},window.BRTC_StartPublish=function(){null!=c&&c.BRTC_StartPublish()},window.BRTC_StopPublish=function(e){if(null!=c)return c.BRTC_StopPublish(e)},window.BRTC_MuteMicphone=function(e){null!=c&&c.BRTC_MuteMicphone(e)},window.BRTC_MuteCamera=function(e){null!=c&&c.BRTC_MuteCamera(e)},window.BRTC_MuteCamera_legcy=function(e){null!=c&&c.BRTC_MuteCamera_legcy(e)},window.BRTC_MuteRemoteVideo=function(e,n,r){null!=c&&c.BRTC_MuteRemoteVideo(e,n,r)},window.BRTC_MuteRemoteAudio=function(e,n){null!=c&&c.BRTC_MuteRemoteAudio(e,n)},window.BRTC_SwitchScreen=function(e){null!=c&&c.BRTC_SwitchScreen(e)},window.BRTC_GetRemoteAudioLevels=function(){if(null!=c)return c.BRTC_GetRemoteAudioLevels()},window.BRTC_GetRemoteUsers=function(){if(null!=c)return c.BRTC_GetRemoteUsers()},window.BRTC_SendMessageToUser=function(e,n){null!=c&&c.BRTC_SendMessageToUser(e,n)},window.BRTC_SetUserAttribute=function(e){null!=c&&c.BRTC_SetUserAttribute(e)},window.BRTC_GetUserAttribute=function(e){if(null!=c)return c.BRTC_GetUserAttribute(e)},window.BRTC_GetRemoteVideoInfo=function(e){if(null!=c)return c.BRTC_GetRemoteVideoInfo(e)},window.BRTC_KickoutUser=function(e){null!=c&&c.BRTC_KickoutUser(e)},window.BRTC_DisbandRoom=function(){null!=c&&c.BRTC_DisbandRoom()},window.BRTC_ShutUpUser=function(e,n){null!=c&&c.BRTC_ShutUpUser(e,n)},window.BRTC_StartLiveServerStreaming=function(e,n,r,i){null!=c&&c.BRTC_StartLiveServerStreaming(e,n,r,i)},window.BRTC_StartLiveServerStreamingEx=function(e,n,r){null!=c&&c.BRTC_StartLiveServerStreamingEx(e,n,r)},window.BRTC_StopLiveServerStreaming=function(e){if(null!=c)return c.BRTC_StopLiveServerStreaming(e)},window.BRTC_StartRoomMediaRelay=function(e,n,r){if(null!=c)return c.BRTC_StartRoomMediaRelay(e,n,r)},window.BRTC_StopRoomMediaRelay=function(e,n){if(null!=c)return c.BRTC_StopRoomMediaRelay(e,n)},window.BRTC_StopRoomMediaRelayAll=function(){if(null!=c)return c.BRTC_StopRoomMediaRelayAll()},window.BRTC_StartRecording=function(e,n,r,i){if(null!=c)return c.BRTC_StartRecording(e,n,r,i)},window.BRTC_StopRecording=function(e){if(null!=c)return c.BRTC_StopRecording(e)},window.BRTC_GetMessageDelay=function(e,n){if(null!=c)return c.BRTC_GetMessageDelay(e,n)},window.BRTC_Render_TryLockDevice=function(){if(null!=c)return c.BRTC_Render_TryLockDevice()},window.BRTC_Render_UnlockDevice=function(){if(null!=c)return c.BRTC_Render_UnlockDevice()},window.BRTC_Render_JoinDeviceQueue=function(){if(null!=c)return c.BRTC_Render_JoinDeviceQueue()},window.BRTC_Render_LeaveDeviceQueue=function(){if(null!=c)return c.BRTC_Render_LeaveDeviceQueue()},window.BRTC_Render_StartApp=function(e){if(null!=c)return c.BRTC_Render_StartApp(e)},window.BRTC_Render_StopApp=function(){if(null!=c)return c.BRTC_Render_StopApp()},window.BRTC_SetParamSettings=function(e){null!=c&&c.BRTC_SetParamSettings(e)},window.BRTC_SetDebugLevel=function(e){null!=c&&c.BRTC_SetDebugLevel(e)},window.BRTC_AquireDevicePermission=function(e){e.success="function"==typeof e.success?e.success:function(){},e.error="function"==typeof e.error?e.error:function(){},navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(function(n){e.success(),n.getAudioTracks().forEach(function(e){e.stop()}),n.getVideoTracks().forEach(function(e){e.stop()})}).catch(function(n){e.error(n)})},window.BRTC_DeviceTest_Start=function(e){null!=c&&c.BRTC_DeviceTest_Start(e)},window.BRTC_DeviceTest_Stop=function(){null!=c&&c.BRTC_DeviceTest_Stop()},window.BRTC_DeviceTest_MuteCamera=function(e){null!=c&&c.BRTC_DeviceTest_MuteCamera(e)},window.BRTC_DeviceTest_MuteMicphone=function(e){null!=c&&c.BRTC_DeviceTest_MuteMicphone(e)},window.BRTC_DeviceTest_SetAudioOutputDevice=function(e){null!=c&&c.BRTC_DeviceTest_SetAudioOutputDevice(e)},window.BRTC_DeviceTest_ReplaceAudio=function(e){null!=c&&c.BRTC_DeviceTest_ReplaceAudio(e)},window.BRTC_DeviceTest_ReplaceVideo=function(e){null!=c&&c.BRTC_DeviceTest_ReplaceVideo(e)},window.BRTC_Version=function(){return"BRTC.Web.SDK V1.2.21"},window.baidurtc={},window.baidurtc.BaiduRtcRoomClient=a}],a={};function c(e){if(a[e])return a[e].exports;var n=a[e]={i:e,l:!1,exports:{}};return s[e].call(n.exports,n,n.exports,c),n.l=!0,n.exports}c.m=s,c.c=a,c.d=function(e,n,r){c.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},c.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.t=function(e,n){if(1&n&&(e=c(e)),8&n||4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(c.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var i in e)c.d(r,i,(function(n){return e[n]}).bind(null,i));return r},c.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(n,"a",n),n},c.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},c.p="",c(c.s=0)},"../../node_modules/eventemitter3/index.js":function(e){"use strict";var n=Object.prototype.hasOwnProperty,r="~";function i(){}function o(e,n,r){this.fn=e,this.context=n,this.once=r||!1}function s(e,n,i,s,a){if("function"!=typeof i)throw TypeError("The listener must be a function");var c=new o(i,s||e,a),d=r?r+n:n;return e._events[d]?e._events[d].fn?e._events[d]=[e._events[d],c]:e._events[d].push(c):(e._events[d]=c,e._eventsCount++),e}function a(e,n){0==--e._eventsCount?e._events=new i:delete e._events[n]}function c(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1)),c.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)n.call(e,i)&&o.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},c.prototype.listeners=function(e){var n=r?r+e:e,i=this._events[n];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,s=i.length,a=Array(s);o<s;o++)a[o]=i[o].fn;return a},c.prototype.listenerCount=function(e){var n=r?r+e:e,i=this._events[n];return i?i.fn?1:i.length:0},c.prototype.emit=function(e,n,i,o,s,a){var c=r?r+e:e;if(!this._events[c])return!1;var d,l,u=this._events[c],f=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),f){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,n),!0;case 3:return u.fn.call(u.context,n,i),!0;case 4:return u.fn.call(u.context,n,i,o),!0;case 5:return u.fn.call(u.context,n,i,o,s),!0;case 6:return u.fn.call(u.context,n,i,o,s,a),!0}for(l=1,d=Array(f-1);l<f;l++)d[l-1]=arguments[l];u.fn.apply(u.context,d)}else{var p,h=u.length;for(l=0;l<h;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),f){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,n);break;case 3:u[l].fn.call(u[l].context,n,i);break;case 4:u[l].fn.call(u[l].context,n,i,o);break;default:if(!d)for(p=1,d=Array(f-1);p<f;p++)d[p-1]=arguments[p];u[l].fn.apply(u[l].context,d)}}return!0},c.prototype.on=function(e,n,r){return s(this,e,n,r,!1)},c.prototype.once=function(e,n,r){return s(this,e,n,r,!0)},c.prototype.removeListener=function(e,n,i,o){var s=r?r+e:e;if(!this._events[s])return this;if(!n)return a(this,s),this;var c=this._events[s];if(c.fn)c.fn!==n||o&&!c.once||i&&c.context!==i||a(this,s);else{for(var d=0,l=[],u=c.length;d<u;d++)(c[d].fn!==n||o&&!c[d].once||i&&c[d].context!==i)&&l.push(c[d]);l.length?this._events[s]=1===l.length?l[0]:l:a(this,s)}return this},c.prototype.removeAllListeners=function(e){var n;return e?(n=r?r+e:e,this._events[n]&&a(this,n)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,e.exports=c},"../../node_modules/fast-unique-numbers/build/es5/bundle.js":function(e,n){(function(e){"use strict";var n,r=void 0===Number.MAX_SAFE_INTEGER?0x1fffffffffffff:Number.MAX_SAFE_INTEGER,i=new WeakMap,o=(n=function(e,n){return i.set(e,n),n},function(e){var o=i.get(e),s=void 0===o?e.size:o<0x40000000?o+1:0;if(!e.has(s))return n(e,s);if(e.size<0x20000000){for(;e.has(s);)s=Math.floor(0x40000000*Math.random());return n(e,s)}if(e.size>r)throw Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;e.has(s);)s=Math.floor(Math.random()*r);return n(e,s)});e.addUniqueNumber=function(e){var n=o(e);return e.add(n),n},e.generateUniqueNumber=o})(n)},"../../node_modules/lodash/_DataView.js":function(e,n,r){e.exports=r("../../node_modules/lodash/_getNative.js")(r("../../node_modules/lodash/_root.js"),"DataView")},"../../node_modules/lodash/_Hash.js":function(e,n,r){var i=r("../../node_modules/lodash/_hashClear.js"),o=r("../../node_modules/lodash/_hashDelete.js"),s=r("../../node_modules/lodash/_hashGet.js"),a=r("../../node_modules/lodash/_hashHas.js"),c=r("../../node_modules/lodash/_hashSet.js");function d(e){var n=-1,r=null==e?0:e.length;for(this.clear();++n<r;){var i=e[n];this.set(i[0],i[1])}}d.prototype.clear=i,d.prototype.delete=o,d.prototype.get=s,d.prototype.has=a,d.prototype.set=c,e.exports=d},"../../node_modules/lodash/_ListCache.js":function(e,n,r){var i=r("../../node_modules/lodash/_listCacheClear.js"),o=r("../../node_modules/lodash/_listCacheDelete.js"),s=r("../../node_modules/lodash/_listCacheGet.js"),a=r("../../node_modules/lodash/_listCacheHas.js"),c=r("../../node_modules/lodash/_listCacheSet.js");function d(e){var n=-1,r=null==e?0:e.length;for(this.clear();++n<r;){var i=e[n];this.set(i[0],i[1])}}d.prototype.clear=i,d.prototype.delete=o,d.prototype.get=s,d.prototype.has=a,d.prototype.set=c,e.exports=d},"../../node_modules/lodash/_Map.js":function(e,n,r){e.exports=r("../../node_modules/lodash/_getNative.js")(r("../../node_modules/lodash/_root.js"),"Map")},"../../node_modules/lodash/_MapCache.js":function(e,n,r){var i=r("../../node_modules/lodash/_mapCacheClear.js"),o=r("../../node_modules/lodash/_mapCacheDelete.js"),s=r("../../node_modules/lodash/_mapCacheGet.js"),a=r("../../node_modules/lodash/_mapCacheHas.js"),c=r("../../node_modules/lodash/_mapCacheSet.js");function d(e){var n=-1,r=null==e?0:e.length;for(this.clear();++n<r;){var i=e[n];this.set(i[0],i[1])}}d.prototype.clear=i,d.prototype.delete=o,d.prototype.get=s,d.prototype.has=a,d.prototype.set=c,e.exports=d},"../../node_modules/lodash/_Promise.js":function(e,n,r){e.exports=r("../../node_modules/lodash/_getNative.js")(r("../../node_modules/lodash/_root.js"),"Promise")},"../../node_modules/lodash/_Set.js":function(e,n,r){e.exports=r("../../node_modules/lodash/_getNative.js")(r("../../node_modules/lodash/_root.js"),"Set")},"../../node_modules/lodash/_Stack.js":function(e,n,r){var i=r("../../node_modules/lodash/_ListCache.js"),o=r("../../node_modules/lodash/_stackClear.js"),s=r("../../node_modules/lodash/_stackDelete.js"),a=r("../../node_modules/lodash/_stackGet.js"),c=r("../../node_modules/lodash/_stackHas.js"),d=r("../../node_modules/lodash/_stackSet.js");function l(e){var n=this.__data__=new i(e);this.size=n.size}l.prototype.clear=o,l.prototype.delete=s,l.prototype.get=a,l.prototype.has=c,l.prototype.set=d,e.exports=l},"../../node_modules/lodash/_Symbol.js":function(e,n,r){e.exports=r("../../node_modules/lodash/_root.js").Symbol},"../../node_modules/lodash/_Uint8Array.js":function(e,n,r){e.exports=r("../../node_modules/lodash/_root.js").Uint8Array},"../../node_modules/lodash/_WeakMap.js":function(e,n,r){e.exports=r("../../node_modules/lodash/_getNative.js")(r("../../node_modules/lodash/_root.js"),"WeakMap")},"../../node_modules/lodash/_apply.js":function(e){e.exports=function(e,n,r){switch(r.length){case 0:return e.call(n);case 1:return e.call(n,r[0]);case 2:return e.call(n,r[0],r[1]);case 3:return e.call(n,r[0],r[1],r[2])}return e.apply(n,r)}},"../../node_modules/lodash/_arrayEach.js":function(e){e.exports=function(e,n){for(var r=-1,i=null==e?0:e.length;++r<i&&!1!==n(e[r],r,e););return e}},"../../node_modules/lodash/_arrayFilter.js":function(e){e.exports=function(e,n){for(var r=-1,i=null==e?0:e.length,o=0,s=[];++r<i;){var a=e[r];n(a,r,e)&&(s[o++]=a)}return s}},"../../node_modules/lodash/_arrayLikeKeys.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseTimes.js"),o=r("../../node_modules/lodash/isArguments.js"),s=r("../../node_modules/lodash/isArray.js"),a=r("../../node_modules/lodash/isBuffer.js"),c=r("../../node_modules/lodash/_isIndex.js"),d=r("../../node_modules/lodash/isTypedArray.js"),l=Object.prototype.hasOwnProperty;e.exports=function(e,n){var r=s(e),u=!r&&o(e),f=!r&&!u&&a(e),p=!r&&!u&&!f&&d(e),h=r||u||f||p,m=h?i(e.length,String):[],v=m.length;for(var g in e)(n||l.call(e,g))&&!(h&&("length"==g||f&&("offset"==g||"parent"==g)||p&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||c(g,v)))&&m.push(g);return m}},"../../node_modules/lodash/_arrayMap.js":function(e){e.exports=function(e,n){for(var r=-1,i=null==e?0:e.length,o=Array(i);++r<i;)o[r]=n(e[r],r,e);return o}},"../../node_modules/lodash/_arrayPush.js":function(e){e.exports=function(e,n){for(var r=-1,i=n.length,o=e.length;++r<i;)e[o+r]=n[r];return e}},"../../node_modules/lodash/_assignValue.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseAssignValue.js"),o=r("../../node_modules/lodash/eq.js"),s=Object.prototype.hasOwnProperty;e.exports=function(e,n,r){var a=e[n];s.call(e,n)&&o(a,r)&&(void 0!==r||n in e)||i(e,n,r)}},"../../node_modules/lodash/_assocIndexOf.js":function(e,n,r){var i=r("../../node_modules/lodash/eq.js");e.exports=function(e,n){for(var r=e.length;r--;)if(i(e[r][0],n))return r;return -1}},"../../node_modules/lodash/_baseAssign.js":function(e,n,r){var i=r("../../node_modules/lodash/_copyObject.js"),o=r("../../node_modules/lodash/keys.js");e.exports=function(e,n){return e&&i(n,o(n),e)}},"../../node_modules/lodash/_baseAssignIn.js":function(e,n,r){var i=r("../../node_modules/lodash/_copyObject.js"),o=r("../../node_modules/lodash/keysIn.js");e.exports=function(e,n){return e&&i(n,o(n),e)}},"../../node_modules/lodash/_baseAssignValue.js":function(e,n,r){var i=r("../../node_modules/lodash/_defineProperty.js");e.exports=function(e,n,r){"__proto__"==n&&i?i(e,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[n]=r}},"../../node_modules/lodash/_baseClone.js":function(e,n,r){var i=r("../../node_modules/lodash/_Stack.js"),o=r("../../node_modules/lodash/_arrayEach.js"),s=r("../../node_modules/lodash/_assignValue.js"),a=r("../../node_modules/lodash/_baseAssign.js"),c=r("../../node_modules/lodash/_baseAssignIn.js"),d=r("../../node_modules/lodash/_cloneBuffer.js"),l=r("../../node_modules/lodash/_copyArray.js"),u=r("../../node_modules/lodash/_copySymbols.js"),f=r("../../node_modules/lodash/_copySymbolsIn.js"),p=r("../../node_modules/lodash/_getAllKeys.js"),h=r("../../node_modules/lodash/_getAllKeysIn.js"),m=r("../../node_modules/lodash/_getTag.js"),v=r("../../node_modules/lodash/_initCloneArray.js"),g=r("../../node_modules/lodash/_initCloneByTag.js"),y=r("../../node_modules/lodash/_initCloneObject.js"),b=r("../../node_modules/lodash/isArray.js"),_=r("../../node_modules/lodash/isBuffer.js"),w=r("../../node_modules/lodash/isMap.js"),S=r("../../node_modules/lodash/isObject.js"),R=r("../../node_modules/lodash/isSet.js"),T=r("../../node_modules/lodash/keys.js"),C=r("../../node_modules/lodash/keysIn.js"),x="[object Arguments]",E="[object Function]",O="[object Object]",I={};I[x]=I["[object Array]"]=I["[object ArrayBuffer]"]=I["[object DataView]"]=I["[object Boolean]"]=I["[object Date]"]=I["[object Float32Array]"]=I["[object Float64Array]"]=I["[object Int8Array]"]=I["[object Int16Array]"]=I["[object Int32Array]"]=I["[object Map]"]=I["[object Number]"]=I[O]=I["[object RegExp]"]=I["[object Set]"]=I["[object String]"]=I["[object Symbol]"]=I["[object Uint8Array]"]=I["[object Uint8ClampedArray]"]=I["[object Uint16Array]"]=I["[object Uint32Array]"]=!0,I["[object Error]"]=I[E]=I["[object WeakMap]"]=!1,e.exports=function e(n,r,k,M,P,j){var A,D=1&r,B=2&r,N=4&r;if(k&&(A=P?k(n,M,P,j):k(n)),void 0!==A)return A;if(!S(n))return n;var L=b(n);if(L){if(A=v(n),!D)return l(n,A)}else{var U=m(n),F=U==E||"[object GeneratorFunction]"==U;if(_(n))return d(n,D);if(U==O||U==x||F&&!P){if(A=B||F?{}:y(n),!D)return B?f(n,c(A,n)):u(n,a(A,n))}else{if(!I[U])return P?n:{};A=g(n,U,D)}}j||(j=new i);var H=j.get(n);if(H)return H;j.set(n,A),R(n)?n.forEach(function(i){A.add(e(i,r,k,i,n,j))}):w(n)&&n.forEach(function(i,o){A.set(o,e(i,r,k,o,n,j))});var q=N?B?h:p:B?C:T,V=L?void 0:q(n);return o(V||n,function(i,o){V&&(i=n[o=i]),s(A,o,e(i,r,k,o,n,j))}),A}},"../../node_modules/lodash/_baseCreate.js":function(e,n,r){var i=r("../../node_modules/lodash/isObject.js"),o=Object.create;e.exports=function(){function e(){}return function(n){if(!i(n))return{};if(o)return o(n);e.prototype=n;var r=new e;return e.prototype=void 0,r}}()},"../../node_modules/lodash/_baseFlatten.js":function(e,n,r){var i=r("../../node_modules/lodash/_arrayPush.js"),o=r("../../node_modules/lodash/_isFlattenable.js");e.exports=function e(n,r,s,a,c){var d=-1,l=n.length;for(s||(s=o),c||(c=[]);++d<l;){var u=n[d];r>0&&s(u)?r>1?e(u,r-1,s,a,c):i(c,u):a||(c[c.length]=u)}return c}},"../../node_modules/lodash/_baseGet.js":function(e,n,r){var i=r("../../node_modules/lodash/_castPath.js"),o=r("../../node_modules/lodash/_toKey.js");e.exports=function(e,n){n=i(n,e);for(var r=0,s=n.length;null!=e&&r<s;)e=e[o(n[r++])];return r&&r==s?e:void 0}},"../../node_modules/lodash/_baseGetAllKeys.js":function(e,n,r){var i=r("../../node_modules/lodash/_arrayPush.js"),o=r("../../node_modules/lodash/isArray.js");e.exports=function(e,n,r){var s=n(e);return o(e)?s:i(s,r(e))}},"../../node_modules/lodash/_baseGetTag.js":function(e,n,r){var i=r("../../node_modules/lodash/_Symbol.js"),o=r("../../node_modules/lodash/_getRawTag.js"),s=r("../../node_modules/lodash/_objectToString.js"),a=i?i.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":a&&a in Object(e)?o(e):s(e)}},"../../node_modules/lodash/_baseHasIn.js":function(e){e.exports=function(e,n){return null!=e&&n in Object(e)}},"../../node_modules/lodash/_baseIsArguments.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseGetTag.js"),o=r("../../node_modules/lodash/isObjectLike.js");e.exports=function(e){return o(e)&&"[object Arguments]"==i(e)}},"../../node_modules/lodash/_baseIsMap.js":function(e,n,r){var i=r("../../node_modules/lodash/_getTag.js"),o=r("../../node_modules/lodash/isObjectLike.js");e.exports=function(e){return o(e)&&"[object Map]"==i(e)}},"../../node_modules/lodash/_baseIsNative.js":function(e,n,r){var i=r("../../node_modules/lodash/isFunction.js"),o=r("../../node_modules/lodash/_isMasked.js"),s=r("../../node_modules/lodash/isObject.js"),a=r("../../node_modules/lodash/_toSource.js"),c=/^\[object .+?Constructor\]$/,d=Object.prototype,l=Function.prototype.toString,u=d.hasOwnProperty,f=RegExp("^"+l.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=function(e){return!(!s(e)||o(e))&&(i(e)?f:c).test(a(e))}},"../../node_modules/lodash/_baseIsSet.js":function(e,n,r){var i=r("../../node_modules/lodash/_getTag.js"),o=r("../../node_modules/lodash/isObjectLike.js");e.exports=function(e){return o(e)&&"[object Set]"==i(e)}},"../../node_modules/lodash/_baseIsTypedArray.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseGetTag.js"),o=r("../../node_modules/lodash/isLength.js"),s=r("../../node_modules/lodash/isObjectLike.js"),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,e.exports=function(e){return s(e)&&o(e.length)&&!!a[i(e)]}},"../../node_modules/lodash/_baseKeys.js":function(e,n,r){var i=r("../../node_modules/lodash/_isPrototype.js"),o=r("../../node_modules/lodash/_nativeKeys.js"),s=Object.prototype.hasOwnProperty;e.exports=function(e){if(!i(e))return o(e);var n=[];for(var r in Object(e))s.call(e,r)&&"constructor"!=r&&n.push(r);return n}},"../../node_modules/lodash/_baseKeysIn.js":function(e,n,r){var i=r("../../node_modules/lodash/isObject.js"),o=r("../../node_modules/lodash/_isPrototype.js"),s=r("../../node_modules/lodash/_nativeKeysIn.js"),a=Object.prototype.hasOwnProperty;e.exports=function(e){if(!i(e))return s(e);var n=o(e),r=[];for(var c in e)"constructor"==c&&(n||!a.call(e,c))||r.push(c);return r}},"../../node_modules/lodash/_basePick.js":function(e,n,r){var i=r("../../node_modules/lodash/_basePickBy.js"),o=r("../../node_modules/lodash/hasIn.js");e.exports=function(e,n){return i(e,n,function(n,r){return o(e,r)})}},"../../node_modules/lodash/_basePickBy.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseGet.js"),o=r("../../node_modules/lodash/_baseSet.js"),s=r("../../node_modules/lodash/_castPath.js");e.exports=function(e,n,r){for(var a=-1,c=n.length,d={};++a<c;){var l=n[a],u=i(e,l);r(u,l)&&o(d,s(l,e),u)}return d}},"../../node_modules/lodash/_baseSet.js":function(e,n,r){var i=r("../../node_modules/lodash/_assignValue.js"),o=r("../../node_modules/lodash/_castPath.js"),s=r("../../node_modules/lodash/_isIndex.js"),a=r("../../node_modules/lodash/isObject.js"),c=r("../../node_modules/lodash/_toKey.js");e.exports=function(e,n,r,d){if(!a(e))return e;n=o(n,e);for(var l=-1,u=n.length,f=u-1,p=e;null!=p&&++l<u;){var h=c(n[l]),m=r;if("__proto__"===h||"constructor"===h||"prototype"===h)break;if(l!=f){var v=p[h];void 0===(m=d?d(v,h,p):void 0)&&(m=a(v)?v:s(n[l+1])?[]:{})}i(p,h,m),p=p[h]}return e}},"../../node_modules/lodash/_baseSetToString.js":function(e,n,r){var i=r("../../node_modules/lodash/constant.js"),o=r("../../node_modules/lodash/_defineProperty.js"),s=r("../../node_modules/lodash/identity.js");e.exports=o?function(e,n){return o(e,"toString",{configurable:!0,enumerable:!1,value:i(n),writable:!0})}:s},"../../node_modules/lodash/_baseSlice.js":function(e){e.exports=function(e,n,r){var i=-1,o=e.length;n<0&&(n=-n>o?0:o+n),(r=r>o?o:r)<0&&(r+=o),o=n>r?0:r-n>>>0,n>>>=0;for(var s=Array(o);++i<o;)s[i]=e[i+n];return s}},"../../node_modules/lodash/_baseTimes.js":function(e){e.exports=function(e,n){for(var r=-1,i=Array(e);++r<e;)i[r]=n(r);return i}},"../../node_modules/lodash/_baseToString.js":function(e,n,r){var i=r("../../node_modules/lodash/_Symbol.js"),o=r("../../node_modules/lodash/_arrayMap.js"),s=r("../../node_modules/lodash/isArray.js"),a=r("../../node_modules/lodash/isSymbol.js"),c=1/0,d=i?i.prototype:void 0,l=d?d.toString:void 0;e.exports=function e(n){if("string"==typeof n)return n;if(s(n))return o(n,e)+"";if(a(n))return l?l.call(n):"";var r=n+"";return"0"==r&&1/n==-c?"-0":r}},"../../node_modules/lodash/_baseUnary.js":function(e){e.exports=function(e){return function(n){return e(n)}}},"../../node_modules/lodash/_baseUnset.js":function(e,n,r){var i=r("../../node_modules/lodash/_castPath.js"),o=r("../../node_modules/lodash/last.js"),s=r("../../node_modules/lodash/_parent.js"),a=r("../../node_modules/lodash/_toKey.js");e.exports=function(e,n){return n=i(n,e),null==(e=s(e,n))||delete e[a(o(n))]}},"../../node_modules/lodash/_castPath.js":function(e,n,r){var i=r("../../node_modules/lodash/isArray.js"),o=r("../../node_modules/lodash/_isKey.js"),s=r("../../node_modules/lodash/_stringToPath.js"),a=r("../../node_modules/lodash/toString.js");e.exports=function(e,n){return i(e)?e:o(e,n)?[e]:s(a(e))}},"../../node_modules/lodash/_cloneArrayBuffer.js":function(e,n,r){var i=r("../../node_modules/lodash/_Uint8Array.js");e.exports=function(e){var n=new e.constructor(e.byteLength);return new i(n).set(new i(e)),n}},"../../node_modules/lodash/_cloneBuffer.js":function(e,n,r){e=r.nmd(e);var i=r("../../node_modules/lodash/_root.js"),o=n&&!n.nodeType&&n,s=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===o?i.Buffer:void 0,c=a?a.allocUnsafe:void 0;e.exports=function(e,n){if(n)return e.slice();var r=e.length,i=c?c(r):new e.constructor(r);return e.copy(i),i}},"../../node_modules/lodash/_cloneDataView.js":function(e,n,r){var i=r("../../node_modules/lodash/_cloneArrayBuffer.js");e.exports=function(e,n){var r=n?i(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}},"../../node_modules/lodash/_cloneRegExp.js":function(e){var n=/\w*$/;e.exports=function(e){var r=new e.constructor(e.source,n.exec(e));return r.lastIndex=e.lastIndex,r}},"../../node_modules/lodash/_cloneSymbol.js":function(e,n,r){var i=r("../../node_modules/lodash/_Symbol.js"),o=i?i.prototype:void 0,s=o?o.valueOf:void 0;e.exports=function(e){return s?Object(s.call(e)):{}}},"../../node_modules/lodash/_cloneTypedArray.js":function(e,n,r){var i=r("../../node_modules/lodash/_cloneArrayBuffer.js");e.exports=function(e,n){var r=n?i(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}},"../../node_modules/lodash/_copyArray.js":function(e){e.exports=function(e,n){var r=-1,i=e.length;for(n||(n=Array(i));++r<i;)n[r]=e[r];return n}},"../../node_modules/lodash/_copyObject.js":function(e,n,r){var i=r("../../node_modules/lodash/_assignValue.js"),o=r("../../node_modules/lodash/_baseAssignValue.js");e.exports=function(e,n,r,s){var a=!r;r||(r={});for(var c=-1,d=n.length;++c<d;){var l=n[c],u=s?s(r[l],e[l],l,r,e):void 0;void 0===u&&(u=e[l]),a?o(r,l,u):i(r,l,u)}return r}},"../../node_modules/lodash/_copySymbols.js":function(e,n,r){var i=r("../../node_modules/lodash/_copyObject.js"),o=r("../../node_modules/lodash/_getSymbols.js");e.exports=function(e,n){return i(e,o(e),n)}},"../../node_modules/lodash/_copySymbolsIn.js":function(e,n,r){var i=r("../../node_modules/lodash/_copyObject.js"),o=r("../../node_modules/lodash/_getSymbolsIn.js");e.exports=function(e,n){return i(e,o(e),n)}},"../../node_modules/lodash/_coreJsData.js":function(e,n,r){e.exports=r("../../node_modules/lodash/_root.js")["__core-js_shared__"]},"../../node_modules/lodash/_customOmitClone.js":function(e,n,r){var i=r("../../node_modules/lodash/isPlainObject.js");e.exports=function(e){return i(e)?void 0:e}},"../../node_modules/lodash/_defineProperty.js":function(e,n,r){var i=r("../../node_modules/lodash/_getNative.js");e.exports=function(){try{var e=i(Object,"defineProperty");return e({},"",{}),e}catch(e){}}()},"../../node_modules/lodash/_flatRest.js":function(e,n,r){var i=r("../../node_modules/lodash/flatten.js"),o=r("../../node_modules/lodash/_overRest.js"),s=r("../../node_modules/lodash/_setToString.js");e.exports=function(e){return s(o(e,void 0,i),e+"")}},"../../node_modules/lodash/_freeGlobal.js":function(e,n,r){e.exports="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g},"../../node_modules/lodash/_getAllKeys.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseGetAllKeys.js"),o=r("../../node_modules/lodash/_getSymbols.js"),s=r("../../node_modules/lodash/keys.js");e.exports=function(e){return i(e,s,o)}},"../../node_modules/lodash/_getAllKeysIn.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseGetAllKeys.js"),o=r("../../node_modules/lodash/_getSymbolsIn.js"),s=r("../../node_modules/lodash/keysIn.js");e.exports=function(e){return i(e,s,o)}},"../../node_modules/lodash/_getMapData.js":function(e,n,r){var i=r("../../node_modules/lodash/_isKeyable.js");e.exports=function(e,n){var r=e.__data__;return i(n)?r["string"==typeof n?"string":"hash"]:r.map}},"../../node_modules/lodash/_getNative.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseIsNative.js"),o=r("../../node_modules/lodash/_getValue.js");e.exports=function(e,n){var r=o(e,n);return i(r)?r:void 0}},"../../node_modules/lodash/_getPrototype.js":function(e,n,r){e.exports=r("../../node_modules/lodash/_overArg.js")(Object.getPrototypeOf,Object)},"../../node_modules/lodash/_getRawTag.js":function(e,n,r){var i=r("../../node_modules/lodash/_Symbol.js"),o=Object.prototype,s=o.hasOwnProperty,a=o.toString,c=i?i.toStringTag:void 0;e.exports=function(e){var n=s.call(e,c),r=e[c];try{e[c]=void 0;var i=!0}catch(e){}var o=a.call(e);return i&&(n?e[c]=r:delete e[c]),o}},"../../node_modules/lodash/_getSymbols.js":function(e,n,r){var i=r("../../node_modules/lodash/_arrayFilter.js"),o=r("../../node_modules/lodash/stubArray.js"),s=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols;e.exports=a?function(e){return null==e?[]:i(a(e=Object(e)),function(n){return s.call(e,n)})}:o},"../../node_modules/lodash/_getSymbolsIn.js":function(e,n,r){var i=r("../../node_modules/lodash/_arrayPush.js"),o=r("../../node_modules/lodash/_getPrototype.js"),s=r("../../node_modules/lodash/_getSymbols.js"),a=r("../../node_modules/lodash/stubArray.js");e.exports=Object.getOwnPropertySymbols?function(e){for(var n=[];e;)i(n,s(e)),e=o(e);return n}:a},"../../node_modules/lodash/_getTag.js":function(e,n,r){var i=r("../../node_modules/lodash/_DataView.js"),o=r("../../node_modules/lodash/_Map.js"),s=r("../../node_modules/lodash/_Promise.js"),a=r("../../node_modules/lodash/_Set.js"),c=r("../../node_modules/lodash/_WeakMap.js"),d=r("../../node_modules/lodash/_baseGetTag.js"),l=r("../../node_modules/lodash/_toSource.js"),u="[object Map]",f="[object Promise]",p="[object Set]",h="[object WeakMap]",m="[object DataView]",v=l(i),g=l(o),y=l(s),b=l(a),_=l(c),w=d;(i&&w(new i(new ArrayBuffer(1)))!=m||o&&w(new o)!=u||s&&w(s.resolve())!=f||a&&w(new a)!=p||c&&w(new c)!=h)&&(w=function(e){var n=d(e),r="[object Object]"==n?e.constructor:void 0,i=r?l(r):"";if(i)switch(i){case v:return m;case g:return u;case y:return f;case b:return p;case _:return h}return n}),e.exports=w},"../../node_modules/lodash/_getValue.js":function(e){e.exports=function(e,n){return null==e?void 0:e[n]}},"../../node_modules/lodash/_hasPath.js":function(e,n,r){var i=r("../../node_modules/lodash/_castPath.js"),o=r("../../node_modules/lodash/isArguments.js"),s=r("../../node_modules/lodash/isArray.js"),a=r("../../node_modules/lodash/_isIndex.js"),c=r("../../node_modules/lodash/isLength.js"),d=r("../../node_modules/lodash/_toKey.js");e.exports=function(e,n,r){n=i(n,e);for(var l=-1,u=n.length,f=!1;++l<u;){var p=d(n[l]);if(!(f=null!=e&&r(e,p)))break;e=e[p]}return f||++l!=u?f:!!(u=null==e?0:e.length)&&c(u)&&a(p,u)&&(s(e)||o(e))}},"../../node_modules/lodash/_hashClear.js":function(e,n,r){var i=r("../../node_modules/lodash/_nativeCreate.js");e.exports=function(){this.__data__=i?i(null):{},this.size=0}},"../../node_modules/lodash/_hashDelete.js":function(e){e.exports=function(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=!!n,n}},"../../node_modules/lodash/_hashGet.js":function(e,n,r){var i=r("../../node_modules/lodash/_nativeCreate.js"),o=Object.prototype.hasOwnProperty;e.exports=function(e){var n=this.__data__;if(i){var r=n[e];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(n,e)?n[e]:void 0}},"../../node_modules/lodash/_hashHas.js":function(e,n,r){var i=r("../../node_modules/lodash/_nativeCreate.js"),o=Object.prototype.hasOwnProperty;e.exports=function(e){var n=this.__data__;return i?void 0!==n[e]:o.call(n,e)}},"../../node_modules/lodash/_hashSet.js":function(e,n,r){var i=r("../../node_modules/lodash/_nativeCreate.js");e.exports=function(e,n){var r=this.__data__;return this.size+=+!this.has(e),r[e]=i&&void 0===n?"__lodash_hash_undefined__":n,this}},"../../node_modules/lodash/_initCloneArray.js":function(e){var n=Object.prototype.hasOwnProperty;e.exports=function(e){var r=e.length,i=new e.constructor(r);return r&&"string"==typeof e[0]&&n.call(e,"index")&&(i.index=e.index,i.input=e.input),i}},"../../node_modules/lodash/_initCloneByTag.js":function(e,n,r){var i=r("../../node_modules/lodash/_cloneArrayBuffer.js"),o=r("../../node_modules/lodash/_cloneDataView.js"),s=r("../../node_modules/lodash/_cloneRegExp.js"),a=r("../../node_modules/lodash/_cloneSymbol.js"),c=r("../../node_modules/lodash/_cloneTypedArray.js");e.exports=function(e,n,r){var d=e.constructor;switch(n){case"[object ArrayBuffer]":return i(e);case"[object Boolean]":case"[object Date]":return new d(+e);case"[object DataView]":return o(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return c(e,r);case"[object Map]":case"[object Set]":return new d;case"[object Number]":case"[object String]":return new d(e);case"[object RegExp]":return s(e);case"[object Symbol]":return a(e)}}},"../../node_modules/lodash/_initCloneObject.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseCreate.js"),o=r("../../node_modules/lodash/_getPrototype.js"),s=r("../../node_modules/lodash/_isPrototype.js");e.exports=function(e){return"function"!=typeof e.constructor||s(e)?{}:i(o(e))}},"../../node_modules/lodash/_isFlattenable.js":function(e,n,r){var i=r("../../node_modules/lodash/_Symbol.js"),o=r("../../node_modules/lodash/isArguments.js"),s=r("../../node_modules/lodash/isArray.js"),a=i?i.isConcatSpreadable:void 0;e.exports=function(e){return s(e)||o(e)||!!(a&&e&&e[a])}},"../../node_modules/lodash/_isIndex.js":function(e){var n=/^(?:0|[1-9]\d*)$/;e.exports=function(e,r){var i=typeof e;return!!(r=null==r?0x1fffffffffffff:r)&&("number"==i||"symbol"!=i&&n.test(e))&&e>-1&&e%1==0&&e<r}},"../../node_modules/lodash/_isKey.js":function(e,n,r){var i=r("../../node_modules/lodash/isArray.js"),o=r("../../node_modules/lodash/isSymbol.js"),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;e.exports=function(e,n){if(i(e))return!1;var r=typeof e;return!!("number"==r||"symbol"==r||"boolean"==r||null==e||o(e))||a.test(e)||!s.test(e)||null!=n&&e in Object(n)}},"../../node_modules/lodash/_isKeyable.js":function(e){e.exports=function(e){var n=typeof e;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e}},"../../node_modules/lodash/_isMasked.js":function(e,n,r){var i,o=r("../../node_modules/lodash/_coreJsData.js"),s=(i=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+i:"";e.exports=function(e){return!!s&&s in e}},"../../node_modules/lodash/_isPrototype.js":function(e){var n=Object.prototype;e.exports=function(e){var r=e&&e.constructor;return e===("function"==typeof r&&r.prototype||n)}},"../../node_modules/lodash/_listCacheClear.js":function(e){e.exports=function(){this.__data__=[],this.size=0}},"../../node_modules/lodash/_listCacheDelete.js":function(e,n,r){var i=r("../../node_modules/lodash/_assocIndexOf.js"),o=Array.prototype.splice;e.exports=function(e){var n=this.__data__,r=i(n,e);return!(r<0)&&(r==n.length-1?n.pop():o.call(n,r,1),--this.size,!0)}},"../../node_modules/lodash/_listCacheGet.js":function(e,n,r){var i=r("../../node_modules/lodash/_assocIndexOf.js");e.exports=function(e){var n=this.__data__,r=i(n,e);return r<0?void 0:n[r][1]}},"../../node_modules/lodash/_listCacheHas.js":function(e,n,r){var i=r("../../node_modules/lodash/_assocIndexOf.js");e.exports=function(e){return i(this.__data__,e)>-1}},"../../node_modules/lodash/_listCacheSet.js":function(e,n,r){var i=r("../../node_modules/lodash/_assocIndexOf.js");e.exports=function(e,n){var r=this.__data__,o=i(r,e);return o<0?(++this.size,r.push([e,n])):r[o][1]=n,this}},"../../node_modules/lodash/_mapCacheClear.js":function(e,n,r){var i=r("../../node_modules/lodash/_Hash.js"),o=r("../../node_modules/lodash/_ListCache.js"),s=r("../../node_modules/lodash/_Map.js");e.exports=function(){this.size=0,this.__data__={hash:new i,map:new(s||o),string:new i}}},"../../node_modules/lodash/_mapCacheDelete.js":function(e,n,r){var i=r("../../node_modules/lodash/_getMapData.js");e.exports=function(e){var n=i(this,e).delete(e);return this.size-=!!n,n}},"../../node_modules/lodash/_mapCacheGet.js":function(e,n,r){var i=r("../../node_modules/lodash/_getMapData.js");e.exports=function(e){return i(this,e).get(e)}},"../../node_modules/lodash/_mapCacheHas.js":function(e,n,r){var i=r("../../node_modules/lodash/_getMapData.js");e.exports=function(e){return i(this,e).has(e)}},"../../node_modules/lodash/_mapCacheSet.js":function(e,n,r){var i=r("../../node_modules/lodash/_getMapData.js");e.exports=function(e,n){var r=i(this,e),o=r.size;return r.set(e,n),this.size+=+(r.size!=o),this}},"../../node_modules/lodash/_memoizeCapped.js":function(e,n,r){var i=r("../../node_modules/lodash/memoize.js");e.exports=function(e){var n=i(e,function(e){return 500===r.size&&r.clear(),e}),r=n.cache;return n}},"../../node_modules/lodash/_nativeCreate.js":function(e,n,r){e.exports=r("../../node_modules/lodash/_getNative.js")(Object,"create")},"../../node_modules/lodash/_nativeKeys.js":function(e,n,r){e.exports=r("../../node_modules/lodash/_overArg.js")(Object.keys,Object)},"../../node_modules/lodash/_nativeKeysIn.js":function(e){e.exports=function(e){var n=[];if(null!=e)for(var r in Object(e))n.push(r);return n}},"../../node_modules/lodash/_nodeUtil.js":function(e,n,r){e=r.nmd(e);var i=r("../../node_modules/lodash/_freeGlobal.js"),o=n&&!n.nodeType&&n,s=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===o&&i.process,c=function(){try{var e=s&&s.require&&s.require("util").types;if(e)return e;return a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=c},"../../node_modules/lodash/_objectToString.js":function(e){var n=Object.prototype.toString;e.exports=function(e){return n.call(e)}},"../../node_modules/lodash/_overArg.js":function(e){e.exports=function(e,n){return function(r){return e(n(r))}}},"../../node_modules/lodash/_overRest.js":function(e,n,r){var i=r("../../node_modules/lodash/_apply.js"),o=Math.max;e.exports=function(e,n,r){return n=o(void 0===n?e.length-1:n,0),function(){for(var s=arguments,a=-1,c=o(s.length-n,0),d=Array(c);++a<c;)d[a]=s[n+a];a=-1;for(var l=Array(n+1);++a<n;)l[a]=s[a];return l[n]=r(d),i(e,this,l)}}},"../../node_modules/lodash/_parent.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseGet.js"),o=r("../../node_modules/lodash/_baseSlice.js");e.exports=function(e,n){return n.length<2?e:i(e,o(n,0,-1))}},"../../node_modules/lodash/_root.js":function(e,n,r){var i=r("../../node_modules/lodash/_freeGlobal.js"),o="object"==typeof self&&self&&self.Object===Object&&self;e.exports=i||o||Function("return this")()},"../../node_modules/lodash/_setToString.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseSetToString.js");e.exports=r("../../node_modules/lodash/_shortOut.js")(i)},"../../node_modules/lodash/_shortOut.js":function(e){var n=Date.now;e.exports=function(e){var r=0,i=0;return function(){var o=n(),s=16-(o-i);if(i=o,s>0){if(++r>=800)return arguments[0]}else r=0;return e.apply(void 0,arguments)}}},"../../node_modules/lodash/_stackClear.js":function(e,n,r){var i=r("../../node_modules/lodash/_ListCache.js");e.exports=function(){this.__data__=new i,this.size=0}},"../../node_modules/lodash/_stackDelete.js":function(e){e.exports=function(e){var n=this.__data__,r=n.delete(e);return this.size=n.size,r}},"../../node_modules/lodash/_stackGet.js":function(e){e.exports=function(e){return this.__data__.get(e)}},"../../node_modules/lodash/_stackHas.js":function(e){e.exports=function(e){return this.__data__.has(e)}},"../../node_modules/lodash/_stackSet.js":function(e,n,r){var i=r("../../node_modules/lodash/_ListCache.js"),o=r("../../node_modules/lodash/_Map.js"),s=r("../../node_modules/lodash/_MapCache.js");e.exports=function(e,n){var r=this.__data__;if(r instanceof i){var a=r.__data__;if(!o||a.length<199)return a.push([e,n]),this.size=++r.size,this;r=this.__data__=new s(a)}return r.set(e,n),this.size=r.size,this}},"../../node_modules/lodash/_stringToPath.js":function(e,n,r){var i=r("../../node_modules/lodash/_memoizeCapped.js"),o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g;e.exports=i(function(e){var n=[];return 46===e.charCodeAt(0)&&n.push(""),e.replace(o,function(e,r,i,o){n.push(i?o.replace(s,"$1"):r||e)}),n})},"../../node_modules/lodash/_toKey.js":function(e,n,r){var i=r("../../node_modules/lodash/isSymbol.js"),o=1/0;e.exports=function(e){if("string"==typeof e||i(e))return e;var n=e+"";return"0"==n&&1/e==-o?"-0":n}},"../../node_modules/lodash/_toSource.js":function(e){var n=Function.prototype.toString;e.exports=function(e){if(null!=e){try{return n.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},"../../node_modules/lodash/cloneDeep.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseClone.js");e.exports=function(e){return i(e,5)}},"../../node_modules/lodash/constant.js":function(e){e.exports=function(e){return function(){return e}}},"../../node_modules/lodash/eq.js":function(e){e.exports=function(e,n){return e===n||e!=e&&n!=n}},"../../node_modules/lodash/flatten.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseFlatten.js");e.exports=function(e){return(null==e?0:e.length)?i(e,1):[]}},"../../node_modules/lodash/get.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseGet.js");e.exports=function(e,n,r){var o=null==e?void 0:i(e,n);return void 0===o?r:o}},"../../node_modules/lodash/hasIn.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseHasIn.js"),o=r("../../node_modules/lodash/_hasPath.js");e.exports=function(e,n){return null!=e&&o(e,n,i)}},"../../node_modules/lodash/identity.js":function(e){e.exports=function(e){return e}},"../../node_modules/lodash/isArguments.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseIsArguments.js"),o=r("../../node_modules/lodash/isObjectLike.js"),s=Object.prototype,a=s.hasOwnProperty,c=s.propertyIsEnumerable;e.exports=i(function(){return arguments}())?i:function(e){return o(e)&&a.call(e,"callee")&&!c.call(e,"callee")}},"../../node_modules/lodash/isArray.js":function(e){e.exports=Array.isArray},"../../node_modules/lodash/isArrayLike.js":function(e,n,r){var i=r("../../node_modules/lodash/isFunction.js"),o=r("../../node_modules/lodash/isLength.js");e.exports=function(e){return null!=e&&o(e.length)&&!i(e)}},"../../node_modules/lodash/isBuffer.js":function(e,n,r){e=r.nmd(e);var i=r("../../node_modules/lodash/_root.js"),o=r("../../node_modules/lodash/stubFalse.js"),s=n&&!n.nodeType&&n,a=s&&"object"==typeof e&&e&&!e.nodeType&&e,c=a&&a.exports===s?i.Buffer:void 0,d=c?c.isBuffer:void 0;e.exports=d||o},"../../node_modules/lodash/isEmpty.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseKeys.js"),o=r("../../node_modules/lodash/_getTag.js"),s=r("../../node_modules/lodash/isArguments.js"),a=r("../../node_modules/lodash/isArray.js"),c=r("../../node_modules/lodash/isArrayLike.js"),d=r("../../node_modules/lodash/isBuffer.js"),l=r("../../node_modules/lodash/_isPrototype.js"),u=r("../../node_modules/lodash/isTypedArray.js"),f=Object.prototype.hasOwnProperty;e.exports=function(e){if(null==e)return!0;if(c(e)&&(a(e)||"string"==typeof e||"function"==typeof e.splice||d(e)||u(e)||s(e)))return!e.length;var n=o(e);if("[object Map]"==n||"[object Set]"==n)return!e.size;if(l(e))return!i(e).length;for(var r in e)if(f.call(e,r))return!1;return!0}},"../../node_modules/lodash/isFunction.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseGetTag.js"),o=r("../../node_modules/lodash/isObject.js");e.exports=function(e){if(!o(e))return!1;var n=i(e);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}},"../../node_modules/lodash/isLength.js":function(e){e.exports=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=0x1fffffffffffff}},"../../node_modules/lodash/isMap.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseIsMap.js"),o=r("../../node_modules/lodash/_baseUnary.js"),s=r("../../node_modules/lodash/_nodeUtil.js"),a=s&&s.isMap;e.exports=a?o(a):i},"../../node_modules/lodash/isNumber.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseGetTag.js"),o=r("../../node_modules/lodash/isObjectLike.js");e.exports=function(e){return"number"==typeof e||o(e)&&"[object Number]"==i(e)}},"../../node_modules/lodash/isObject.js":function(e){e.exports=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)}},"../../node_modules/lodash/isObjectLike.js":function(e){e.exports=function(e){return null!=e&&"object"==typeof e}},"../../node_modules/lodash/isPlainObject.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseGetTag.js"),o=r("../../node_modules/lodash/_getPrototype.js"),s=r("../../node_modules/lodash/isObjectLike.js"),a=Object.prototype,c=Function.prototype.toString,d=a.hasOwnProperty,l=c.call(Object);e.exports=function(e){if(!s(e)||"[object Object]"!=i(e))return!1;var n=o(e);if(null===n)return!0;var r=d.call(n,"constructor")&&n.constructor;return"function"==typeof r&&r instanceof r&&c.call(r)==l}},"../../node_modules/lodash/isSet.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseIsSet.js"),o=r("../../node_modules/lodash/_baseUnary.js"),s=r("../../node_modules/lodash/_nodeUtil.js"),a=s&&s.isSet;e.exports=a?o(a):i},"../../node_modules/lodash/isString.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseGetTag.js"),o=r("../../node_modules/lodash/isArray.js"),s=r("../../node_modules/lodash/isObjectLike.js");e.exports=function(e){return"string"==typeof e||!o(e)&&s(e)&&"[object String]"==i(e)}},"../../node_modules/lodash/isSymbol.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseGetTag.js"),o=r("../../node_modules/lodash/isObjectLike.js");e.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==i(e)}},"../../node_modules/lodash/isTypedArray.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseIsTypedArray.js"),o=r("../../node_modules/lodash/_baseUnary.js"),s=r("../../node_modules/lodash/_nodeUtil.js"),a=s&&s.isTypedArray;e.exports=a?o(a):i},"../../node_modules/lodash/keys.js":function(e,n,r){var i=r("../../node_modules/lodash/_arrayLikeKeys.js"),o=r("../../node_modules/lodash/_baseKeys.js"),s=r("../../node_modules/lodash/isArrayLike.js");e.exports=function(e){return s(e)?i(e):o(e)}},"../../node_modules/lodash/keysIn.js":function(e,n,r){var i=r("../../node_modules/lodash/_arrayLikeKeys.js"),o=r("../../node_modules/lodash/_baseKeysIn.js"),s=r("../../node_modules/lodash/isArrayLike.js");e.exports=function(e){return s(e)?i(e,!0):o(e)}},"../../node_modules/lodash/last.js":function(e){e.exports=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}},"../../node_modules/lodash/memoize.js":function(e,n,r){var i=r("../../node_modules/lodash/_MapCache.js");function o(e,n){if("function"!=typeof e||null!=n&&"function"!=typeof n)throw TypeError("Expected a function");var r=function(){var i=arguments,o=n?n.apply(this,i):i[0],s=r.cache;if(s.has(o))return s.get(o);var a=e.apply(this,i);return r.cache=s.set(o,a)||s,a};return r.cache=new(o.Cache||i),r}o.Cache=i,e.exports=o},"../../node_modules/lodash/omit.js":function(e,n,r){var i=r("../../node_modules/lodash/_arrayMap.js"),o=r("../../node_modules/lodash/_baseClone.js"),s=r("../../node_modules/lodash/_baseUnset.js"),a=r("../../node_modules/lodash/_castPath.js"),c=r("../../node_modules/lodash/_copyObject.js"),d=r("../../node_modules/lodash/_customOmitClone.js"),l=r("../../node_modules/lodash/_flatRest.js"),u=r("../../node_modules/lodash/_getAllKeysIn.js");e.exports=l(function(e,n){var r={};if(null==e)return r;var l=!1;n=i(n,function(n){return n=a(n,e),l||(l=n.length>1),n}),c(e,u(e),r),l&&(r=o(r,7,d));for(var f=n.length;f--;)s(r,n[f]);return r})},"../../node_modules/lodash/pick.js":function(e,n,r){var i=r("../../node_modules/lodash/_basePick.js");e.exports=r("../../node_modules/lodash/_flatRest.js")(function(e,n){return null==e?{}:i(e,n)})},"../../node_modules/lodash/stubArray.js":function(e){e.exports=function(){return[]}},"../../node_modules/lodash/stubFalse.js":function(e){e.exports=function(){return!1}},"../../node_modules/lodash/toString.js":function(e,n,r){var i=r("../../node_modules/lodash/_baseToString.js");e.exports=function(e){return null==e?"":i(e)}},"../../node_modules/process/browser.js":function(e){var n,r,i,o=e.exports={};function s(){throw Error("setTimeout has not been defined")}function a(){throw Error("clearTimeout has not been defined")}try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}function c(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(r){try{return n.call(null,e,0)}catch(r){return n.call(this,e,0)}}}var d=[],l=!1,u=-1;function f(){l&&i&&(l=!1,i.length?d=i.concat(d):u=-1,d.length&&p())}function p(){if(!l){var e=c(f);l=!0;for(var n=d.length;n;){for(i=d,d=[];++u<n;)i&&i[u].run();u=-1,n=d.length}i=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(n){try{return r.call(null,e)}catch(n){return r.call(this,e)}}}(e)}}function h(e,n){this.fun=e,this.array=n}function m(){}o.nextTick=function(e){var n=Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)n[r-1]=arguments[r];d.push(new h(e,n)),1!==d.length||l||c(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw Error("process.chdir is not supported")},o.umask=function(){return 0}},"../../node_modules/sdp/sdp.js":function(e){"use strict";let n={};n.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},n.localCName=n.generateIdentifier(),n.splitLines=function(e){return e.trim().split("\n").map(e=>e.trim())},n.splitSections=function(e){return e.split("\nm=").map((e,n)=>(n>0?"m="+e:e).trim()+"\r\n")},n.getDescription=function(e){let r=n.splitSections(e);return r&&r[0]},n.getMediaSections=function(e){let r=n.splitSections(e);return r.shift(),r},n.matchPrefix=function(e,r){return n.splitLines(e).filter(e=>0===e.indexOf(r))},n.parseCandidate=function(e){let n,r={foundation:(n=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[n[1]]||n[1],protocol:n[2].toLowerCase(),priority:parseInt(n[3],10),ip:n[4],address:n[4],port:parseInt(n[5],10),type:n[7]};for(let e=8;e<n.length;e+=2)switch(n[e]){case"raddr":r.relatedAddress=n[e+1];break;case"rport":r.relatedPort=parseInt(n[e+1],10);break;case"tcptype":r.tcpType=n[e+1];break;case"ufrag":r.ufrag=n[e+1],r.usernameFragment=n[e+1];break;default:void 0===r[n[e]]&&(r[n[e]]=n[e+1])}return r},n.writeCandidate=function(e){let n=[];n.push(e.foundation);let r=e.component;"rtp"===r?n.push(1):"rtcp"===r?n.push(2):n.push(r),n.push(e.protocol.toUpperCase()),n.push(e.priority),n.push(e.address||e.ip),n.push(e.port);let i=e.type;return n.push("typ"),n.push(i),"host"!==i&&e.relatedAddress&&e.relatedPort&&(n.push("raddr"),n.push(e.relatedAddress),n.push("rport"),n.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(n.push("tcptype"),n.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(n.push("ufrag"),n.push(e.usernameFragment||e.ufrag)),"candidate:"+n.join(" ")},n.parseIceOptions=function(e){return e.substring(14).split(" ")},n.parseRtpMap=function(e){let n=e.substring(9).split(" "),r={payloadType:parseInt(n.shift(),10)};return r.name=(n=n[0].split("/"))[0],r.clockRate=parseInt(n[1],10),r.channels=3===n.length?parseInt(n[2],10):1,r.numChannels=r.channels,r},n.writeRtpMap=function(e){let n=e.payloadType;void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType);let r=e.channels||e.numChannels||1;return"a=rtpmap:"+n+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},n.parseExtmap=function(e){let n=e.substring(9).split(" ");return{id:parseInt(n[0],10),direction:n[0].indexOf("/")>0?n[0].split("/")[1]:"sendrecv",uri:n[1],attributes:n.slice(2).join(" ")}},n.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},n.parseFmtp=function(e){let n,r={},i=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<i.length;e++)r[(n=i[e].trim().split("="))[0].trim()]=n[1];return r},n.writeFmtp=function(e){let n="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){let i=[];Object.keys(e.parameters).forEach(n=>{void 0!==e.parameters[n]?i.push(n+"="+e.parameters[n]):i.push(n)}),n+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return n},n.parseRtcpFb=function(e){let n=e.substring(e.indexOf(" ")+1).split(" ");return{type:n.shift(),parameter:n.join(" ")}},n.writeRtcpFb=function(e){let n="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(e=>{n+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),n},n.parseSsrcMedia=function(e){let n=e.indexOf(" "),r={ssrc:parseInt(e.substring(7,n),10)},i=e.indexOf(":",n);return i>-1?(r.attribute=e.substring(n+1,i),r.value=e.substring(i+1)):r.attribute=e.substring(n+1),r},n.parseSsrcGroup=function(e){let n=e.substring(13).split(" ");return{semantics:n.shift(),ssrcs:n.map(e=>parseInt(e,10))}},n.getMid=function(e){let r=n.matchPrefix(e,"a=mid:")[0];if(r)return r.substring(6)},n.parseFingerprint=function(e){let n=e.substring(14).split(" ");return{algorithm:n[0].toLowerCase(),value:n[1].toUpperCase()}},n.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:n.matchPrefix(e+r,"a=fingerprint:").map(n.parseFingerprint)}},n.writeDtlsParameters=function(e,n){let r="a=setup:"+n+"\r\n";return e.fingerprints.forEach(e=>{r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),r},n.parseCryptoLine=function(e){let n=e.substring(9).split(" ");return{tag:parseInt(n[0],10),cryptoSuite:n[1],keyParams:n[2],sessionParams:n.slice(3)}},n.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?n.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},n.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;let n=e.substring(7).split("|");return{keyMethod:"inline",keySalt:n[0],lifeTime:n[1],mkiValue:n[2]?n[2].split(":")[0]:void 0,mkiLength:n[2]?n[2].split(":")[1]:void 0}},n.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},n.getCryptoParameters=function(e,r){return n.matchPrefix(e+r,"a=crypto:").map(n.parseCryptoLine)},n.getIceParameters=function(e,r){let i=n.matchPrefix(e+r,"a=ice-ufrag:")[0],o=n.matchPrefix(e+r,"a=ice-pwd:")[0];return i&&o?{usernameFragment:i.substring(12),password:o.substring(10)}:null},n.writeIceParameters=function(e){let n="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(n+="a=ice-lite\r\n"),n},n.parseRtpParameters=function(e){let r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=n.splitLines(e)[0].split(" ");r.profile=i[2];for(let o=3;o<i.length;o++){let s=i[o],a=n.matchPrefix(e,"a=rtpmap:"+s+" ")[0];if(a){let i=n.parseRtpMap(a),o=n.matchPrefix(e,"a=fmtp:"+s+" ");switch(i.parameters=o.length?n.parseFmtp(o[0]):{},i.rtcpFeedback=n.matchPrefix(e,"a=rtcp-fb:"+s+" ").map(n.parseRtcpFb),r.codecs.push(i),i.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(i.name.toUpperCase())}}}n.matchPrefix(e,"a=extmap:").forEach(e=>{r.headerExtensions.push(n.parseExtmap(e))});let o=n.matchPrefix(e,"a=rtcp-fb:* ").map(n.parseRtcpFb);return r.codecs.forEach(e=>{o.forEach(n=>{e.rtcpFeedback.find(e=>e.type===n.type&&e.parameter===n.parameter)||e.rtcpFeedback.push(n)})}),r},n.writeRtpDescription=function(e,r){let i="";i+="m="+e+" ",i+=r.codecs.length>0?"9":"0",i+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=r.codecs.map(e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach(e=>{i+=n.writeRtpMap(e),i+=n.writeFmtp(e),i+=n.writeRtcpFb(e)});let o=0;return r.codecs.forEach(e=>{e.maxptime>o&&(o=e.maxptime)}),o>0&&(i+="a=maxptime:"+o+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach(e=>{i+=n.writeExtmap(e)}),i},n.parseRtpEncodingParameters=function(e){let r,i=[],o=n.parseRtpParameters(e),s=-1!==o.fecMechanisms.indexOf("RED"),a=-1!==o.fecMechanisms.indexOf("ULPFEC"),c=n.matchPrefix(e,"a=ssrc:").map(e=>n.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute),d=c.length>0&&c[0].ssrc,l=n.matchPrefix(e,"a=ssrc-group:FID").map(e=>e.substring(17).split(" ").map(e=>parseInt(e,10)));l.length>0&&l[0].length>1&&l[0][0]===d&&(r=l[0][1]),o.codecs.forEach(e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let n={ssrc:d,codecPayloadType:parseInt(e.parameters.apt,10)};d&&r&&(n.rtx={ssrc:r}),i.push(n),s&&((n=JSON.parse(JSON.stringify(n))).fec={ssrc:d,mechanism:a?"red+ulpfec":"red"},i.push(n))}}),0===i.length&&d&&i.push({ssrc:d});let u=n.matchPrefix(e,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substring(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substring(5),10)*.95-16e3:void 0,i.forEach(e=>{e.maxBitrate=u})),i},n.parseRtcpParameters=function(e){let r={},i=n.matchPrefix(e,"a=ssrc:").map(e=>n.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute)[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);let o=n.matchPrefix(e,"a=rtcp-rsize");return r.reducedSize=o.length>0,r.compound=0===o.length,r.mux=n.matchPrefix(e,"a=rtcp-mux").length>0,r},n.writeRtcpParameters=function(e){let n="";return e.reducedSize&&(n+="a=rtcp-rsize\r\n"),e.mux&&(n+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(n+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),n},n.parseMsid=function(e){let r,i=n.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(r=i[0].substring(7).split(" "))[0],track:r[1]};let o=n.matchPrefix(e,"a=ssrc:").map(e=>n.parseSsrcMedia(e)).filter(e=>"msid"===e.attribute);if(o.length>0)return{stream:(r=o[0].value.split(" "))[0],track:r[1]}},n.parseSctpDescription=function(e){let r,i=n.parseMLine(e),o=n.matchPrefix(e,"a=max-message-size:");o.length>0&&(r=parseInt(o[0].substring(19),10)),isNaN(r)&&(r=65536);let s=n.matchPrefix(e,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substring(12),10),protocol:i.fmt,maxMessageSize:r};let a=n.matchPrefix(e,"a=sctpmap:");if(a.length>0){let e=a[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:r}}},n.writeSctpDescription=function(e,n){let r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+n.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+n.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+n.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+n.port+" "+n.protocol+" 65535\r\n"],void 0!==n.maxMessageSize&&r.push("a=max-message-size:"+n.maxMessageSize+"\r\n"),r.join("")},n.generateSessionId=function(){return Math.random().toString().substr(2,22)},n.writeSessionBoilerplate=function(e,r,i){return"v=0\r\no="+(i||"thisisadapterortc")+" "+(e||n.generateSessionId())+" "+(void 0!==r?r:2)+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},n.getDirection=function(e,r){let i=n.splitLines(e);for(let e=0;e<i.length;e++)switch(i[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[e].substring(2)}return r?n.getDirection(r):"sendrecv"},n.getKind=function(e){return n.splitLines(e)[0].split(" ")[0].substring(2)},n.isRejected=function(e){return"0"===e.split(" ",2)[1]},n.parseMLine=function(e){let r=n.splitLines(e)[0].substring(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},n.parseOLine=function(e){let r=n.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},n.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;let r=n.splitLines(e);for(let e=0;e<r.length;e++)if(r[e].length<2||"="!==r[e].charAt(1))return!1;return!0},e.exports=n},"../../node_modules/typewriter-effect/dist/core.js":function(e,n,r){var i=r("../../node_modules/process/browser.js");"undefined"!=typeof self&&self,e.exports=(()=>{var e={3146:(e,n,r)=>{for(var i=r(3491),o="undefined"==typeof window?r.g:window,s=["moz","webkit"],a="AnimationFrame",c=o["request"+a],d=o["cancel"+a]||o["cancelRequest"+a],l=0;!c&&l<s.length;l++)c=o[s[l]+"Request"+a],d=o[s[l]+"Cancel"+a]||o[s[l]+"CancelRequest"+a];if(!c||!d){var u=0,f=0,p=[],h=1e3/60;c=function(e){if(0===p.length){var n=i(),r=Math.max(0,h-(n-u));u=r+n,setTimeout(function(){var e=p.slice(0);p.length=0;for(var n=0;n<e.length;n++)if(!e[n].cancelled)try{e[n].callback(u)}catch(e){setTimeout(function(){throw e},0)}},Math.round(r))}return p.push({handle:++f,callback:e,cancelled:!1}),f},d=function(e){for(var n=0;n<p.length;n++)p[n].handle===e&&(p[n].cancelled=!0)}}e.exports=function(e){return c.call(o,e)},e.exports.cancel=function(){d.apply(o,arguments)},e.exports.polyfill=function(e){e||(e=o),e.requestAnimationFrame=c,e.cancelAnimationFrame=d}},3491:function(e){(function(){var n,r,o,s;"undefined"!=typeof performance&&null!==performance&&performance.now?e.exports=function(){return performance.now()}:null!=i&&i.hrtime?(e.exports=function(){return(n()-s)/1e6},r=i.hrtime,s=(n=function(){var e;return 1e9*(e=r())[0]+e[1]})()-1e9*i.uptime()):Date.now?(e.exports=function(){return Date.now()-o},o=Date.now()):(e.exports=function(){return(new Date).getTime()-o},o=(new Date).getTime())}).call(this)}},n={};function r(i){var o=n[i];if(void 0!==o)return o.exports;var s=n[i]={exports:{}};return e[i].call(s.exports,s,s.exports,r),s.exports}r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},r.d=(e,n)=>{for(var i in n)r.o(n,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n);var o={};return(()=>{"use strict";r.d(o,{default:()=>x});var e=r(3146),n=r.n(e);let i=function(e){return new RegExp(/<[a-z][\s\S]*>/i).test(e)},s=function(e,n){return Math.floor(Math.random()*(n-e+1))+e};var a="TYPE_CHARACTER",c="REMOVE_CHARACTER",d="REMOVE_ALL",l="REMOVE_LAST_VISIBLE_NODE",u="PAUSE_FOR",f="CALL_FUNCTION",p="ADD_HTML_TAG_ELEMENT",h="CHANGE_DELETE_SPEED",m="CHANGE_DELAY",v="CHANGE_CURSOR",g="PASTE_STRING",y="HTML_TAG";function b(e){return(b="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})(e)}function _(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function w(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?_(Object(r),!0).forEach(function(n){T(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function S(e){return function(e){if(Array.isArray(e))return R(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(e){if("string"==typeof e)return R(e,void 0);var r=({}).toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?R(e,void 0):void 0}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function T(e,n,r){return(n=C(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function C(e){var n=function(e){if("object"!=b(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=b(r))return r;throw TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==b(n)?n:n+""}let x=function(){var r;function o(r,b){var _=this;if(function(e,n){if(!(e instanceof n))throw TypeError("Cannot call a class as a function")}(this,o),T(this,"state",{cursorAnimation:null,lastFrameTime:null,pauseUntil:null,eventQueue:[],eventLoop:null,eventLoopPaused:!1,reverseCalledEvents:[],calledEvents:[],visibleNodes:[],initialOptions:null,elements:{container:null,wrapper:document.createElement("span"),cursor:document.createElement("span")}}),T(this,"options",{strings:null,cursor:"|",delay:"natural",pauseFor:1500,deleteSpeed:"natural",loop:!1,autoStart:!1,devMode:!1,skipAddStyles:!1,wrapperClassName:"Typewriter__wrapper",cursorClassName:"Typewriter__cursor",stringSplitter:null,onCreateTextNode:null,onRemoveNode:null}),T(this,"setupWrapperElement",function(){_.state.elements.container&&(_.state.elements.wrapper.className=_.options.wrapperClassName,_.state.elements.cursor.className=_.options.cursorClassName,_.state.elements.cursor.innerHTML=_.options.cursor,_.state.elements.container.innerHTML="",_.state.elements.container.appendChild(_.state.elements.wrapper),_.state.elements.container.appendChild(_.state.elements.cursor))}),T(this,"start",function(){return _.state.eventLoopPaused=!1,_.runEventLoop(),_}),T(this,"pause",function(){return _.state.eventLoopPaused=!0,_}),T(this,"stop",function(){return _.state.eventLoop&&((0,e.cancel)(_.state.eventLoop),_.state.eventLoop=null),_}),T(this,"pauseFor",function(e){return _.addEventToQueue(u,{ms:e}),_}),T(this,"typeOutAllStrings",function(){return"string"==typeof _.options.strings?_.typeString(_.options.strings).pauseFor(_.options.pauseFor):_.options.strings.forEach(function(e){_.typeString(e).pauseFor(_.options.pauseFor).deleteAll(_.options.deleteSpeed)}),_}),T(this,"typeString",function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(i(e))return _.typeOutHTMLString(e,n);if(e){var r=(_.options||{}).stringSplitter,o="function"==typeof r?r(e):e.split("");_.typeCharacters(o,n)}return _}),T(this,"pasteString",function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return i(e)?_.typeOutHTMLString(e,n,!0):(e&&_.addEventToQueue(g,{character:e,node:n}),_)}),T(this,"typeOutHTMLString",function(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0,o=((n=document.createElement("div")).innerHTML=e,n.childNodes);if(o.length>0)for(var s=0;s<o.length;s++){var a=o[s],c=a.innerHTML;a&&3!==a.nodeType?(a.innerHTML="",_.addEventToQueue(p,{node:a,parentNode:r}),i?_.pasteString(c,a):_.typeString(c,a)):a.textContent&&(i?_.pasteString(a.textContent,r):_.typeString(a.textContent,r))}return _}),T(this,"deleteAll",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"natural";return _.addEventToQueue(d,{speed:e}),_}),T(this,"changeDeleteSpeed",function(e){if(!e)throw Error("Must provide new delete speed");return _.addEventToQueue(h,{speed:e}),_}),T(this,"changeDelay",function(e){if(!e)throw Error("Must provide new delay");return _.addEventToQueue(m,{delay:e}),_}),T(this,"changeCursor",function(e){if(!e)throw Error("Must provide new cursor");return _.addEventToQueue(v,{cursor:e}),_}),T(this,"deleteChars",function(e){if(!e)throw Error("Must provide amount of characters to delete");for(var n=0;n<e;n++)_.addEventToQueue(c);return _}),T(this,"callFunction",function(e,n){if(!e||"function"!=typeof e)throw Error("Callback must be a function");return _.addEventToQueue(f,{cb:e,thisArg:n}),_}),T(this,"typeCharacters",function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e||!Array.isArray(e))throw Error("Characters must be an array");return e.forEach(function(e){_.addEventToQueue(a,{character:e,node:n})}),_}),T(this,"removeCharacters",function(e){if(!e||!Array.isArray(e))throw Error("Characters must be an array");return e.forEach(function(){_.addEventToQueue(c)}),_}),T(this,"addEventToQueue",function(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return _.addEventToStateProperty(e,n,r,"eventQueue")}),T(this,"addReverseCalledEvent",function(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return _.options.loop?_.addEventToStateProperty(e,n,r,"reverseCalledEvents"):_}),T(this,"addEventToStateProperty",function(e,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3?arguments[3]:void 0,o={eventName:e,eventArgs:n||{}};return _.state[i]=r?[o].concat(S(_.state[i])):[].concat(S(_.state[i]),[o]),_}),T(this,"runEventLoop",function(){_.state.lastFrameTime||(_.state.lastFrameTime=Date.now());var e=Date.now(),r=e-_.state.lastFrameTime;if(!_.state.eventQueue.length){if(!_.options.loop)return;_.state.eventQueue=S(_.state.calledEvents),_.state.calledEvents=[],_.options=w({},_.state.initialOptions)}if(_.state.eventLoop=n()(_.runEventLoop),!_.state.eventLoopPaused){if(_.state.pauseUntil){if(e<_.state.pauseUntil)return;_.state.pauseUntil=null}var i,o=S(_.state.eventQueue),b=o.shift();if(!(r<=(i=b.eventName===l||b.eventName===c?"natural"===_.options.deleteSpeed?s(40,80):_.options.deleteSpeed:"natural"===_.options.delay?s(120,160):_.options.delay))){var R=b.eventName,T=b.eventArgs;switch(_.logInDevMode({currentEvent:b,state:_.state,delay:i}),R){case g:case a:var C=T.character,x=T.node,E=document.createTextNode(C),O=E;_.options.onCreateTextNode&&"function"==typeof _.options.onCreateTextNode&&(O=_.options.onCreateTextNode(C,E)),O&&(x?x.appendChild(O):_.state.elements.wrapper.appendChild(O)),_.state.visibleNodes=[].concat(S(_.state.visibleNodes),[{type:"TEXT_NODE",character:C,node:O}]);break;case c:o.unshift({eventName:l,eventArgs:{removingCharacterNode:!0}});break;case u:var I=b.eventArgs.ms;_.state.pauseUntil=Date.now()+parseInt(I);break;case f:var k=b.eventArgs,M=k.cb,P=k.thisArg;M.call(P,{elements:_.state.elements});break;case p:var j=b.eventArgs,A=j.node,D=j.parentNode;D?D.appendChild(A):_.state.elements.wrapper.appendChild(A),_.state.visibleNodes=[].concat(S(_.state.visibleNodes),[{type:y,node:A,parentNode:D||_.state.elements.wrapper}]);break;case d:var B=_.state.visibleNodes,N=T.speed,L=[];N&&L.push({eventName:h,eventArgs:{speed:N,temp:!0}});for(var U=0,F=B.length;U<F;U++)L.push({eventName:l,eventArgs:{removingCharacterNode:!1}});N&&L.push({eventName:h,eventArgs:{speed:_.options.deleteSpeed,temp:!0}}),o.unshift.apply(o,L);break;case l:var H=b.eventArgs.removingCharacterNode;if(_.state.visibleNodes.length){var q=_.state.visibleNodes.pop(),V=q.type,z=q.node,G=q.character;_.options.onRemoveNode&&"function"==typeof _.options.onRemoveNode&&_.options.onRemoveNode({node:z,character:G}),z&&z.parentNode.removeChild(z),V===y&&H&&o.unshift({eventName:l,eventArgs:{}})}break;case h:_.options.deleteSpeed=b.eventArgs.speed;break;case m:_.options.delay=b.eventArgs.delay;break;case v:_.options.cursor=b.eventArgs.cursor,_.state.elements.cursor.innerHTML=b.eventArgs.cursor}_.options.loop&&(b.eventName===l||b.eventArgs&&b.eventArgs.temp||(_.state.calledEvents=[].concat(S(_.state.calledEvents),[b]))),_.state.eventQueue=o,_.state.lastFrameTime=e}}}),r)if("string"==typeof r){var R=document.querySelector(r);if(!R)throw Error("Could not find container element");this.state.elements.container=R}else this.state.elements.container=r;b&&(this.options=w(w({},this.options),b)),this.state.initialOptions=w({},this.options),this.init()}return r=[{key:"init",value:function(){var e;this.setupWrapperElement(),this.addEventToQueue(v,{cursor:this.options.cursor},!0),this.addEventToQueue(d,null,!0),!window||window.___TYPEWRITER_JS_STYLES_ADDED___||this.options.skipAddStyles||((e=document.createElement("style")).appendChild(document.createTextNode(".Typewriter__cursor{-webkit-animation:Typewriter-cursor 1s infinite;animation:Typewriter-cursor 1s infinite;margin-left:1px}@-webkit-keyframes Typewriter-cursor{0%{opacity:0}50%{opacity:1}100%{opacity:0}}@keyframes Typewriter-cursor{0%{opacity:0}50%{opacity:1}100%{opacity:0}}")),document.head.appendChild(e),window.___TYPEWRITER_JS_STYLES_ADDED___=!0),!0===this.options.autoStart&&this.options.strings&&this.typeOutAllStrings().start()}},{key:"logInDevMode",value:function(e){this.options.devMode&&console.log(e)}}],function(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,C(i.key),i)}}(o.prototype,r),Object.defineProperty(o,"prototype",{writable:!1}),o}()})(),o.default})()},"../../node_modules/ua-parser-js/src/ua-parser.js":function(e,n,r){e=r.nmd(e),function(r,i){"use strict";var o="function",s="undefined",a="object",c="string",d="major",l="model",u="name",f="type",p="vendor",h="version",m="architecture",v="console",g="mobile",y="tablet",b="smarttv",_="wearable",w="embedded",S="Amazon",R="Apple",T="ASUS",C="BlackBerry",x="Browser",E="Chrome",O="Firefox",I="Google",k="Huawei",M="Microsoft",P="Motorola",j="Opera",A="Samsung",D="Sharp",B="Sony",N="Xiaomi",L="Zebra",U="Facebook",F="Chromium OS",H="Mac OS",q=" Browser",V=function(e,n){var r={};for(var i in e)n[i]&&n[i].length%2==0?r[i]=n[i].concat(e[i]):r[i]=e[i];return r},z=function(e){for(var n={},r=0;r<e.length;r++)n[e[r].toUpperCase()]=e[r];return n},G=function(e,n){return typeof e===c&&-1!==W(n).indexOf(W(e))},W=function(e){return e.toLowerCase()},X=function(e,n){if(typeof e===c)return e=e.replace(/^\s\s*/,""),typeof n===s?e:e.substring(0,500)},$=function(e,n){for(var r,i,s,c,d,l,u=0;u<n.length&&!d;){var f=n[u],p=n[u+1];for(r=i=0;r<f.length&&!d&&f[r];)if(d=f[r++].exec(e))for(s=0;s<p.length;s++)l=d[++i],typeof(c=p[s])===a&&c.length>0?2===c.length?typeof c[1]==o?this[c[0]]=c[1].call(this,l):this[c[0]]=c[1]:3===c.length?typeof c[1]!==o||c[1].exec&&c[1].test?this[c[0]]=l?l.replace(c[1],c[2]):void 0:this[c[0]]=l?c[1].call(this,l,c[2]):void 0:4===c.length&&(this[c[0]]=l?c[3].call(this,l.replace(c[1],c[2])):void 0):this[c]=l||void 0;u+=2}},J=function(e,n){for(var r in n)if(typeof n[r]===a&&n[r].length>0){for(var i=0;i<n[r].length;i++)if(G(n[r][i],e))return"?"===r?void 0:r}else if(G(n[r],e))return"?"===r?void 0:r;return n.hasOwnProperty("*")?n["*"]:e},K={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Y={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[h,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[h,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,h],[/opios[\/ ]+([\w\.]+)/i],[h,[u,j+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[h,[u,j+" GX"]],[/\bopr\/([\w\.]+)/i],[h,[u,j]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[h,[u,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[h,[u,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[u,h],[/quark(?:pc)?\/([-\w\.]+)/i],[h,[u,"Quark"]],[/\bddg\/([\w\.]+)/i],[h,[u,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[h,[u,"UC"+x]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[h,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[h,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[h,[u,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[h,[u,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[h,[u,"Smart Lenovo "+x]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+x],h],[/\bfocus\/([\w\.]+)/i],[h,[u,O+" Focus"]],[/\bopt\/([\w\.]+)/i],[h,[u,j+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[u,j+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[h,[u,"MIUI"+q]],[/fxios\/([\w\.-]+)/i],[h,[u,O]],[/\bqihoobrowser\/?([\w\.]*)/i],[h,[u,"360"]],[/\b(qq)\/([\w\.]+)/i],[[u,/(.+)/,"$1Browser"],h],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1"+q],h],[/samsungbrowser\/([\w\.]+)/i],[h,[u,A+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[h,[u,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[u,"Sogou Mobile"],h],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[u,h],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[u],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[h,u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,U],h],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[u,h],[/\bgsa\/([\w\.]+) .*safari\//i],[h,[u,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[h,[u,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[h,[u,E+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,E+" WebView"],h],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[h,[u,"Android "+x]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,h],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[h,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[h,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[h,J,{"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,h],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],h],[/(wolvic|librewolf)\/([\w\.]+)/i],[u,h],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[h,[u,O+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,[h,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[u,[h,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[m,"amd64"]],[/(ia32(?=;))/i],[[m,W]],[/((?:i[346]|x)86)[;\)]/i],[[m,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[m,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[m,"armhf"]],[/windows (ce|mobile); ppc;/i],[[m,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[m,/ower/,"",W]],[/(sun4\w)[;\)]/i],[[m,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[m,W]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[l,[p,A],[f,y]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[l,[p,A],[f,g]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[l,[p,R],[f,g]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[p,R],[f,y]],[/(macintosh);/i],[l,[p,R]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[p,D],[f,g]],[/(?:honor)([-\w ]+)[;\)]/i],[l,[p,"Honor"],[f,g]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[p,k],[f,y]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[p,k],[f,g]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[l,/_/g," "],[p,N],[f,g]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[p,N],[f,y]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[p,"OPPO"],[f,g]],[/\b(opd2\d{3}a?) bui/i],[l,[p,"OPPO"],[f,y]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[p,"Vivo"],[f,g]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[l,[p,"Realme"],[f,g]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[l,[p,P],[f,g]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[p,P],[f,y]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[p,"LG"],[f,y]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[p,"LG"],[f,g]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[p,"Lenovo"],[f,y]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[p,"Nokia"],[f,g]],[/(pixel c)\b/i],[l,[p,I],[f,y]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[p,I],[f,g]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[l,[p,B],[f,g]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[p,B],[f,y]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[p,"OnePlus"],[f,g]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[p,S],[f,y]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[p,S],[f,g]],[/(playbook);[-\w\),; ]+(rim)/i],[l,p,[f,y]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[p,C],[f,g]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[p,T],[f,y]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[p,T],[f,g]],[/(nexus 9)/i],[l,[p,"HTC"],[f,y]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[l,/_/g," "],[f,g]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[l,[p,"TCL"],[f,y]],[/(itel) ((\w+))/i],[[p,W],l,[f,J,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[p,"Acer"],[f,y]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[p,"Meizu"],[f,g]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[l,[p,"Ulefone"],[f,g]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[l,[p,"Energizer"],[f,g]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[l,[p,"Cat"],[f,g]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[l,[p,"Smartfren"],[f,g]],[/droid.+; (a(?:015|06[35]|142p?))/i],[l,[p,"Nothing"],[f,g]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[p,l,[f,g]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[p,l,[f,y]],[/(surface duo)/i],[l,[p,M],[f,y]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[p,"Fairphone"],[f,g]],[/(u304aa)/i],[l,[p,"AT&T"],[f,g]],[/\bsie-(\w*)/i],[l,[p,"Siemens"],[f,g]],[/\b(rct\w+) b/i],[l,[p,"RCA"],[f,y]],[/\b(venue[\d ]{2,7}) b/i],[l,[p,"Dell"],[f,y]],[/\b(q(?:mv|ta)\w+) b/i],[l,[p,"Verizon"],[f,y]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[p,"Barnes & Noble"],[f,y]],[/\b(tm\d{3}\w+) b/i],[l,[p,"NuVision"],[f,y]],[/\b(k88) b/i],[l,[p,"ZTE"],[f,y]],[/\b(nx\d{3}j) b/i],[l,[p,"ZTE"],[f,g]],[/\b(gen\d{3}) b.+49h/i],[l,[p,"Swiss"],[f,g]],[/\b(zur\d{3}) b/i],[l,[p,"Swiss"],[f,y]],[/\b((zeki)?tb.*\b) b/i],[l,[p,"Zeki"],[f,y]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],l,[f,y]],[/\b(ns-?\w{0,9}) b/i],[l,[p,"Insignia"],[f,y]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[p,"NextBook"],[f,y]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],l,[f,g]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],l,[f,g]],[/\b(ph-1) /i],[l,[p,"Essential"],[f,g]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[p,"Envizen"],[f,y]],[/\b(trio[-\w\. ]+) b/i],[l,[p,"MachSpeed"],[f,y]],[/\btu_(1491) b/i],[l,[p,"Rotor"],[f,y]],[/(shield[\w ]+) b/i],[l,[p,"Nvidia"],[f,y]],[/(sprint) (\w+)/i],[p,l,[f,g]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[p,M],[f,g]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[p,L],[f,y]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[p,L],[f,g]],[/smart-tv.+(samsung)/i],[p,[f,b]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[p,A],[f,b]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,"LG"],[f,b]],[/(apple) ?tv/i],[p,[l,R+" TV"],[f,b]],[/crkey/i],[[l,E+"cast"],[p,I],[f,b]],[/droid.+aft(\w+)( bui|\))/i],[l,[p,S],[f,b]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[p,D],[f,b]],[/(bravia[\w ]+)( bui|\))/i],[l,[p,B],[f,b]],[/(mitv-\w{5}) bui/i],[l,[p,N],[f,b]],[/Hbbtv.*(technisat) (.*);/i],[p,l,[f,b]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,X],[l,X],[f,b]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[f,b]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,l,[f,v]],[/droid.+; (shield) bui/i],[l,[p,"Nvidia"],[f,v]],[/(playstation [345portablevi]+)/i],[l,[p,B],[f,v]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[p,M],[f,v]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[l,[p,A],[f,_]],[/((pebble))app/i],[p,l,[f,_]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[l,[p,R],[f,_]],[/droid.+; (glass) \d/i],[l,[p,I],[f,_]],[/droid.+; (wt63?0{2,3})\)/i],[l,[p,L],[f,_]],[/droid.+; (glass) \d/i],[l,[p,I],[f,_]],[/(pico) (4|neo3(?: link|pro)?)/i],[p,l,[f,_]],[/; (quest( \d| pro)?)/i],[l,[p,U],[f,_]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[f,w]],[/(aeobc)\b/i],[l,[p,S],[f,w]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[l,[f,g]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[f,y]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[f,y]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[f,g]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[h,[u,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[u,h],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[h,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[u,h],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[h,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,h],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[u,[h,J,K]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[h,J,K],[u,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[h,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,H],[h,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[h,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,h],[/\(bb(10);/i],[h,[u,C]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[h,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[h,[u,O+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[h,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[h,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[h,[u,E+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,F],h],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,h],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],h],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[u,h]]},Q=function(e,n){if(typeof e===a&&(n=e,e=void 0),!(this instanceof Q))return new Q(e,n).getResult();var i=typeof r!==s&&r.navigator?r.navigator:void 0,v=e||(i&&i.userAgent?i.userAgent:""),b=i&&i.userAgentData?i.userAgentData:void 0,_=n?V(Y,n):Y,w=i&&i.userAgent==v;return this.getBrowser=function(){var e,n={};return n[u]=void 0,n[h]=void 0,$.call(n,v,_.browser),n[d]=typeof(e=n[h])===c?e.replace(/[^\d\.]/g,"").split(".")[0]:void 0,w&&i&&i.brave&&typeof i.brave.isBrave==o&&(n[u]="Brave"),n},this.getCPU=function(){var e={};return e[m]=void 0,$.call(e,v,_.cpu),e},this.getDevice=function(){var e={};return e[p]=void 0,e[l]=void 0,e[f]=void 0,$.call(e,v,_.device),w&&!e[f]&&b&&b.mobile&&(e[f]=g),w&&"Macintosh"==e[l]&&i&&typeof i.standalone!==s&&i.maxTouchPoints&&i.maxTouchPoints>2&&(e[l]="iPad",e[f]=y),e},this.getEngine=function(){var e={};return e[u]=void 0,e[h]=void 0,$.call(e,v,_.engine),e},this.getOS=function(){var e={};return e[u]=void 0,e[h]=void 0,$.call(e,v,_.os),w&&!e[u]&&b&&b.platform&&"Unknown"!=b.platform&&(e[u]=b.platform.replace(/chrome os/i,F).replace(/macos/i,H)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return v},this.setUA=function(e){return v=typeof e===c&&e.length>500?X(e,500):e,this},this.setUA(v),this};Q.VERSION="1.0.40",Q.BROWSER=z([u,h,d]),Q.CPU=z([m]),Q.DEVICE=z([l,p,f,v,g,b,y,_,w]),Q.ENGINE=Q.OS=z([u,h]),typeof n!==s?(typeof e!==s&&e.exports&&(n=e.exports=Q),n.UAParser=Q):typeof define===o&&define.amd?define(function(){return Q}):typeof r!==s&&(r.UAParser=Q);var Z=typeof r!==s&&(r.jQuery||r.Zepto);if(Z&&!Z.ua){var ee=new Q;Z.ua=ee.getResult(),Z.ua.get=function(){return ee.getUA()},Z.ua.set=function(e){ee.setUA(e);var n=ee.getResult();for(var r in n)Z.ua[r]=n[r]}}}("object"==typeof window?window:this)},"../../node_modules/core-js/internals/a-callable.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/is-callable.js"),o=r("../../node_modules/core-js/internals/try-to-string.js"),s=TypeError;e.exports=function(e){if(i(e))return e;throw new s(o(e)+" is not a function")}},"../../node_modules/core-js/internals/add-to-unscopables.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/well-known-symbol.js"),o=r("../../node_modules/core-js/internals/object-create.js"),s=r("../../node_modules/core-js/internals/object-define-property.js").f,a=i("unscopables"),c=Array.prototype;void 0===c[a]&&s(c,a,{configurable:!0,value:o(null)}),e.exports=function(e){c[a][e]=!0}},"../../node_modules/core-js/internals/an-object.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/is-object.js"),o=String,s=TypeError;e.exports=function(e){if(i(e))return e;throw new s(o(e)+" is not an object")}},"../../node_modules/core-js/internals/array-includes.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/to-indexed-object.js"),o=r("../../node_modules/core-js/internals/to-absolute-index.js"),s=r("../../node_modules/core-js/internals/length-of-array-like.js"),a=function(e){return function(n,r,a){var c,d=i(n),l=s(d);if(0===l)return!e&&-1;var u=o(a,l);if(e&&r!=r){for(;l>u;)if((c=d[u++])!=c)return!0}else for(;l>u;u++)if((e||u in d)&&d[u]===r)return e||u||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},"../../node_modules/core-js/internals/array-method-is-strict.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/fails.js");e.exports=function(e,n){var r=[][e];return!!r&&i(function(){r.call(null,n||function(){return 1},1)})}},"../../node_modules/core-js/internals/array-reduce.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/a-callable.js"),o=r("../../node_modules/core-js/internals/to-object.js"),s=r("../../node_modules/core-js/internals/indexed-object.js"),a=r("../../node_modules/core-js/internals/length-of-array-like.js"),c=TypeError,d="Reduce of empty array with no initial value",l=function(e){return function(n,r,l,u){var f=o(n),p=s(f),h=a(f);if(i(r),0===h&&l<2)throw new c(d);var m=e?h-1:0,v=e?-1:1;if(l<2)for(;;){if(m in p){u=p[m],m+=v;break}if(m+=v,e?m<0:h<=m)throw new c(d)}for(;e?m>=0:h>m;m+=v)m in p&&(u=r(u,p[m],m,f));return u}};e.exports={left:l(!1),right:l(!0)}},"../../node_modules/core-js/internals/classof-raw.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this.js"),o=i({}.toString),s=i("".slice);e.exports=function(e){return s(o(e),8,-1)}},"../../node_modules/core-js/internals/copy-constructor-properties.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/has-own-property.js"),o=r("../../node_modules/core-js/internals/own-keys.js"),s=r("../../node_modules/core-js/internals/object-get-own-property-descriptor.js"),a=r("../../node_modules/core-js/internals/object-define-property.js");e.exports=function(e,n,r){for(var c=o(n),d=a.f,l=s.f,u=0;u<c.length;u++){var f=c[u];i(e,f)||r&&i(r,f)||d(e,f,l(n,f))}}},"../../node_modules/core-js/internals/create-non-enumerable-property.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/descriptors.js"),o=r("../../node_modules/core-js/internals/object-define-property.js"),s=r("../../node_modules/core-js/internals/create-property-descriptor.js");e.exports=i?function(e,n,r){return o.f(e,n,s(1,r))}:function(e,n,r){return e[n]=r,e}},"../../node_modules/core-js/internals/create-property-descriptor.js":function(e){"use strict";e.exports=function(e,n){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:n}}},"../../node_modules/core-js/internals/define-built-in.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/is-callable.js"),o=r("../../node_modules/core-js/internals/object-define-property.js"),s=r("../../node_modules/core-js/internals/make-built-in.js"),a=r("../../node_modules/core-js/internals/define-global-property.js");e.exports=function(e,n,r,c){c||(c={});var d=c.enumerable,l=void 0!==c.name?c.name:n;if(i(r)&&s(r,l,c),c.global)d?e[n]=r:a(n,r);else{try{c.unsafe?e[n]&&(d=!0):delete e[n]}catch(e){}d?e[n]=r:o.f(e,n,{value:r,enumerable:!1,configurable:!c.nonConfigurable,writable:!c.nonWritable})}return e}},"../../node_modules/core-js/internals/define-global-property.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js"),o=Object.defineProperty;e.exports=function(e,n){try{o(i,e,{value:n,configurable:!0,writable:!0})}catch(r){i[e]=n}return n}},"../../node_modules/core-js/internals/descriptors.js":function(e,n,r){"use strict";e.exports=!r("../../node_modules/core-js/internals/fails.js")(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},"../../node_modules/core-js/internals/document-create-element.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js"),o=r("../../node_modules/core-js/internals/is-object.js"),s=i.document,a=o(s)&&o(s.createElement);e.exports=function(e){return a?s.createElement(e):{}}},"../../node_modules/core-js/internals/enum-bug-keys.js":function(e){"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},"../../node_modules/core-js/internals/environment-is-node.js":function(e,n,r){"use strict";e.exports="NODE"===r("../../node_modules/core-js/internals/environment.js")},"../../node_modules/core-js/internals/environment-user-agent.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js").navigator,o=i&&i.userAgent;e.exports=o?String(o):""},"../../node_modules/core-js/internals/environment-v8-version.js":function(e,n,r){"use strict";var i,o,s=r("../../node_modules/core-js/internals/global-this.js"),a=r("../../node_modules/core-js/internals/environment-user-agent.js"),c=s.process,d=s.Deno,l=c&&c.versions||d&&d.version,u=l&&l.v8;u&&(o=(i=u.split("."))[0]>0&&i[0]<4?1:+(i[0]+i[1])),!o&&a&&(!(i=a.match(/Edge\/(\d+)/))||i[1]>=74)&&(i=a.match(/Chrome\/(\d+)/))&&(o=+i[1]),e.exports=o},"../../node_modules/core-js/internals/environment.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js"),o=r("../../node_modules/core-js/internals/environment-user-agent.js"),s=r("../../node_modules/core-js/internals/classof-raw.js"),a=function(e){return o.slice(0,e.length)===e};e.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":i.Bun&&"string"==typeof Bun.version?"BUN":i.Deno&&"object"==typeof Deno.version?"DENO":"process"===s(i.process)?"NODE":i.window&&i.document?"BROWSER":"REST"},"../../node_modules/core-js/internals/export.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js"),o=r("../../node_modules/core-js/internals/object-get-own-property-descriptor.js").f,s=r("../../node_modules/core-js/internals/create-non-enumerable-property.js"),a=r("../../node_modules/core-js/internals/define-built-in.js"),c=r("../../node_modules/core-js/internals/define-global-property.js"),d=r("../../node_modules/core-js/internals/copy-constructor-properties.js"),l=r("../../node_modules/core-js/internals/is-forced.js");e.exports=function(e,n){var r,u,f,p,h,m=e.target,v=e.global,g=e.stat;if(r=v?i:g?i[m]||c(m,{}):i[m]&&i[m].prototype)for(u in n){if(p=n[u],f=e.dontCallGetSet?(h=o(r,u))&&h.value:r[u],!l(v?u:m+(g?".":"#")+u,e.forced)&&void 0!==f){if(typeof p==typeof f)continue;d(p,f)}(e.sham||f&&f.sham)&&s(p,"sham",!0),a(r,u,p,e)}}},"../../node_modules/core-js/internals/fails.js":function(e){"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},"../../node_modules/core-js/internals/function-bind-native.js":function(e,n,r){"use strict";e.exports=!r("../../node_modules/core-js/internals/fails.js")(function(){var e=(function(){}).bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})},"../../node_modules/core-js/internals/function-call.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-bind-native.js"),o=Function.prototype.call;e.exports=i?o.bind(o):function(){return o.apply(o,arguments)}},"../../node_modules/core-js/internals/function-name.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/descriptors.js"),o=r("../../node_modules/core-js/internals/has-own-property.js"),s=Function.prototype,a=i&&Object.getOwnPropertyDescriptor,c=o(s,"name"),d=c&&(!i||i&&a(s,"name").configurable);e.exports={EXISTS:c,PROPER:c&&"something"===(function(){}).name,CONFIGURABLE:d}},"../../node_modules/core-js/internals/function-uncurry-this.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-bind-native.js"),o=Function.prototype,s=o.call,a=i&&o.bind.bind(s,s);e.exports=i?a:function(e){return function(){return s.apply(e,arguments)}}},"../../node_modules/core-js/internals/get-built-in.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js"),o=r("../../node_modules/core-js/internals/is-callable.js");e.exports=function(e,n){var r;return arguments.length<2?o(r=i[e])?r:void 0:i[e]&&i[e][n]}},"../../node_modules/core-js/internals/get-method.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/a-callable.js"),o=r("../../node_modules/core-js/internals/is-null-or-undefined.js");e.exports=function(e,n){var r=e[n];return o(r)?void 0:i(r)}},"../../node_modules/core-js/internals/global-this.js":function(e,n,r){"use strict";var i=function(e){return e&&e.Math===Math&&e};e.exports=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof r.g&&r.g)||i("object"==typeof this&&this)||function(){return this}()||Function("return this")()},"../../node_modules/core-js/internals/has-own-property.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this.js"),o=r("../../node_modules/core-js/internals/to-object.js"),s=i({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,n){return s(o(e),n)}},"../../node_modules/core-js/internals/hidden-keys.js":function(e){"use strict";e.exports={}},"../../node_modules/core-js/internals/html.js":function(e,n,r){"use strict";e.exports=r("../../node_modules/core-js/internals/get-built-in.js")("document","documentElement")},"../../node_modules/core-js/internals/ie8-dom-define.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/descriptors.js"),o=r("../../node_modules/core-js/internals/fails.js"),s=r("../../node_modules/core-js/internals/document-create-element.js");e.exports=!i&&!o(function(){return 7!==Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a})},"../../node_modules/core-js/internals/indexed-object.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this.js"),o=r("../../node_modules/core-js/internals/fails.js"),s=r("../../node_modules/core-js/internals/classof-raw.js"),a=Object,c=i("".split);e.exports=o(function(){return!a("z").propertyIsEnumerable(0)})?function(e){return"String"===s(e)?c(e,""):a(e)}:a},"../../node_modules/core-js/internals/inspect-source.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this.js"),o=r("../../node_modules/core-js/internals/is-callable.js"),s=r("../../node_modules/core-js/internals/shared-store.js"),a=i(Function.toString);o(s.inspectSource)||(s.inspectSource=function(e){return a(e)}),e.exports=s.inspectSource},"../../node_modules/core-js/internals/internal-state.js":function(e,n,r){"use strict";var i,o,s,a=r("../../node_modules/core-js/internals/weak-map-basic-detection.js"),c=r("../../node_modules/core-js/internals/global-this.js"),d=r("../../node_modules/core-js/internals/is-object.js"),l=r("../../node_modules/core-js/internals/create-non-enumerable-property.js"),u=r("../../node_modules/core-js/internals/has-own-property.js"),f=r("../../node_modules/core-js/internals/shared-store.js"),p=r("../../node_modules/core-js/internals/shared-key.js"),h=r("../../node_modules/core-js/internals/hidden-keys.js"),m="Object already initialized",v=c.TypeError,g=c.WeakMap;if(a||f.state){var y=f.state||(f.state=new g);y.get=y.get,y.has=y.has,y.set=y.set,i=function(e,n){if(y.has(e))throw new v(m);return n.facade=e,y.set(e,n),n},o=function(e){return y.get(e)||{}},s=function(e){return y.has(e)}}else{var b=p("state");h[b]=!0,i=function(e,n){if(u(e,b))throw new v(m);return n.facade=e,l(e,b,n),n},o=function(e){return u(e,b)?e[b]:{}},s=function(e){return u(e,b)}}e.exports={set:i,get:o,has:s,enforce:function(e){return s(e)?o(e):i(e,{})},getterFor:function(e){return function(n){var r;if(!d(n)||(r=o(n)).type!==e)throw new v("Incompatible receiver, "+e+" required");return r}}}},"../../node_modules/core-js/internals/is-callable.js":function(e){"use strict";var n="object"==typeof document&&document.all;e.exports=void 0===n&&void 0!==n?function(e){return"function"==typeof e||e===n}:function(e){return"function"==typeof e}},"../../node_modules/core-js/internals/is-forced.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/fails.js"),o=r("../../node_modules/core-js/internals/is-callable.js"),s=/#|\.prototype\./,a=function(e,n){var r=d[c(e)];return r===u||r!==l&&(o(n)?i(n):!!n)},c=a.normalize=function(e){return String(e).replace(s,".").toLowerCase()},d=a.data={},l=a.NATIVE="N",u=a.POLYFILL="P";e.exports=a},"../../node_modules/core-js/internals/is-null-or-undefined.js":function(e){"use strict";e.exports=function(e){return null==e}},"../../node_modules/core-js/internals/is-object.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/is-callable.js");e.exports=function(e){return"object"==typeof e?null!==e:i(e)}},"../../node_modules/core-js/internals/is-pure.js":function(e){"use strict";e.exports=!1},"../../node_modules/core-js/internals/is-symbol.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/get-built-in.js"),o=r("../../node_modules/core-js/internals/is-callable.js"),s=r("../../node_modules/core-js/internals/object-is-prototype-of.js"),a=r("../../node_modules/core-js/internals/use-symbol-as-uid.js"),c=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var n=i("Symbol");return o(n)&&s(n.prototype,c(e))}},"../../node_modules/core-js/internals/length-of-array-like.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/to-length.js");e.exports=function(e){return i(e.length)}},"../../node_modules/core-js/internals/make-built-in.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this.js"),o=r("../../node_modules/core-js/internals/fails.js"),s=r("../../node_modules/core-js/internals/is-callable.js"),a=r("../../node_modules/core-js/internals/has-own-property.js"),c=r("../../node_modules/core-js/internals/descriptors.js"),d=r("../../node_modules/core-js/internals/function-name.js").CONFIGURABLE,l=r("../../node_modules/core-js/internals/inspect-source.js"),u=r("../../node_modules/core-js/internals/internal-state.js"),f=u.enforce,p=u.get,h=String,m=Object.defineProperty,v=i("".slice),g=i("".replace),y=i([].join),b=c&&!o(function(){return 8!==m(function(){},"length",{value:8}).length}),_=String(String).split("String"),w=e.exports=function(e,n,r){"Symbol("===v(h(n),0,7)&&(n="["+g(h(n),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),r&&r.getter&&(n="get "+n),r&&r.setter&&(n="set "+n),(!a(e,"name")||d&&e.name!==n)&&(c?m(e,"name",{value:n,configurable:!0}):e.name=n),b&&r&&a(r,"arity")&&e.length!==r.arity&&m(e,"length",{value:r.arity});try{r&&a(r,"constructor")&&r.constructor?c&&m(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var i=f(e);return a(i,"source")||(i.source=y(_,"string"==typeof n?n:"")),e};Function.prototype.toString=w(function(){return s(this)&&p(this).source||l(this)},"toString")},"../../node_modules/core-js/internals/math-trunc.js":function(e){"use strict";var n=Math.ceil,r=Math.floor;e.exports=Math.trunc||function(e){var i=+e;return(i>0?r:n)(i)}},"../../node_modules/core-js/internals/object-create.js":function(e,n,r){"use strict";var i,o=r("../../node_modules/core-js/internals/an-object.js"),s=r("../../node_modules/core-js/internals/object-define-properties.js"),a=r("../../node_modules/core-js/internals/enum-bug-keys.js"),c=r("../../node_modules/core-js/internals/hidden-keys.js"),d=r("../../node_modules/core-js/internals/html.js"),l=r("../../node_modules/core-js/internals/document-create-element.js"),u=r("../../node_modules/core-js/internals/shared-key.js"),f="prototype",p="script",h=u("IE_PROTO"),m=function(){},v=function(e){return"<"+p+">"+e+"</"+p+">"},g=function(e){e.write(v("")),e.close();var n=e.parentWindow.Object;return e=null,n},y=function(){var e,n=l("iframe");return n.style.display="none",d.appendChild(n),n.src=String("java"+p+":"),(e=n.contentWindow.document).open(),e.write(v("document.F=Object")),e.close(),e.F},b=function(){try{i=new ActiveXObject("htmlfile")}catch(e){}b="undefined"!=typeof document?document.domain&&i?g(i):y():g(i);for(var e=a.length;e--;)delete b[f][a[e]];return b()};c[h]=!0,e.exports=Object.create||function(e,n){var r;return null!==e?(m[f]=o(e),r=new m,m[f]=null,r[h]=e):r=b(),void 0===n?r:s.f(r,n)}},"../../node_modules/core-js/internals/object-define-properties.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/descriptors.js"),o=r("../../node_modules/core-js/internals/v8-prototype-define-bug.js"),s=r("../../node_modules/core-js/internals/object-define-property.js"),a=r("../../node_modules/core-js/internals/an-object.js"),c=r("../../node_modules/core-js/internals/to-indexed-object.js"),d=r("../../node_modules/core-js/internals/object-keys.js");n.f=i&&!o?Object.defineProperties:function(e,n){a(e);for(var r,i=c(n),o=d(n),l=o.length,u=0;l>u;)s.f(e,r=o[u++],i[r]);return e}},"../../node_modules/core-js/internals/object-define-property.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/descriptors.js"),o=r("../../node_modules/core-js/internals/ie8-dom-define.js"),s=r("../../node_modules/core-js/internals/v8-prototype-define-bug.js"),a=r("../../node_modules/core-js/internals/an-object.js"),c=r("../../node_modules/core-js/internals/to-property-key.js"),d=TypeError,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,f="enumerable",p="configurable",h="writable";n.f=i?s?function(e,n,r){if(a(e),n=c(n),a(r),"function"==typeof e&&"prototype"===n&&"value"in r&&h in r&&!r[h]){var i=u(e,n);i&&i[h]&&(e[n]=r.value,r={configurable:p in r?r[p]:i[p],enumerable:f in r?r[f]:i[f],writable:!1})}return l(e,n,r)}:l:function(e,n,r){if(a(e),n=c(n),a(r),o)try{return l(e,n,r)}catch(e){}if("get"in r||"set"in r)throw new d("Accessors not supported");return"value"in r&&(e[n]=r.value),e}},"../../node_modules/core-js/internals/object-get-own-property-descriptor.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/descriptors.js"),o=r("../../node_modules/core-js/internals/function-call.js"),s=r("../../node_modules/core-js/internals/object-property-is-enumerable.js"),a=r("../../node_modules/core-js/internals/create-property-descriptor.js"),c=r("../../node_modules/core-js/internals/to-indexed-object.js"),d=r("../../node_modules/core-js/internals/to-property-key.js"),l=r("../../node_modules/core-js/internals/has-own-property.js"),u=r("../../node_modules/core-js/internals/ie8-dom-define.js"),f=Object.getOwnPropertyDescriptor;n.f=i?f:function(e,n){if(e=c(e),n=d(n),u)try{return f(e,n)}catch(e){}if(l(e,n))return a(!o(s.f,e,n),e[n])}},"../../node_modules/core-js/internals/object-get-own-property-names.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/object-keys-internal.js"),o=r("../../node_modules/core-js/internals/enum-bug-keys.js").concat("length","prototype");n.f=Object.getOwnPropertyNames||function(e){return i(e,o)}},"../../node_modules/core-js/internals/object-get-own-property-symbols.js":function(e,n){"use strict";n.f=Object.getOwnPropertySymbols},"../../node_modules/core-js/internals/object-is-prototype-of.js":function(e,n,r){"use strict";e.exports=r("../../node_modules/core-js/internals/function-uncurry-this.js")({}.isPrototypeOf)},"../../node_modules/core-js/internals/object-keys-internal.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this.js"),o=r("../../node_modules/core-js/internals/has-own-property.js"),s=r("../../node_modules/core-js/internals/to-indexed-object.js"),a=r("../../node_modules/core-js/internals/array-includes.js").indexOf,c=r("../../node_modules/core-js/internals/hidden-keys.js"),d=i([].push);e.exports=function(e,n){var r,i=s(e),l=0,u=[];for(r in i)!o(c,r)&&o(i,r)&&d(u,r);for(;n.length>l;)o(i,r=n[l++])&&(~a(u,r)||d(u,r));return u}},"../../node_modules/core-js/internals/object-keys.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/object-keys-internal.js"),o=r("../../node_modules/core-js/internals/enum-bug-keys.js");e.exports=Object.keys||function(e){return i(e,o)}},"../../node_modules/core-js/internals/object-property-is-enumerable.js":function(e,n){"use strict";var r={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor;n.f=i&&!r.call({1:2},1)?function(e){var n=i(this,e);return!!n&&n.enumerable}:r},"../../node_modules/core-js/internals/ordinary-to-primitive.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-call.js"),o=r("../../node_modules/core-js/internals/is-callable.js"),s=r("../../node_modules/core-js/internals/is-object.js"),a=TypeError;e.exports=function(e,n){var r,c;if("string"===n&&o(r=e.toString)&&!s(c=i(r,e))||o(r=e.valueOf)&&!s(c=i(r,e))||"string"!==n&&o(r=e.toString)&&!s(c=i(r,e)))return c;throw new a("Can't convert object to primitive value")}},"../../node_modules/core-js/internals/own-keys.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/get-built-in.js"),o=r("../../node_modules/core-js/internals/function-uncurry-this.js"),s=r("../../node_modules/core-js/internals/object-get-own-property-names.js"),a=r("../../node_modules/core-js/internals/object-get-own-property-symbols.js"),c=r("../../node_modules/core-js/internals/an-object.js"),d=o([].concat);e.exports=i("Reflect","ownKeys")||function(e){var n=s.f(c(e)),r=a.f;return r?d(n,r(e)):n}},"../../node_modules/core-js/internals/require-object-coercible.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/is-null-or-undefined.js"),o=TypeError;e.exports=function(e){if(i(e))throw new o("Can't call method on "+e);return e}},"../../node_modules/core-js/internals/shared-key.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/shared.js"),o=r("../../node_modules/core-js/internals/uid.js"),s=i("keys");e.exports=function(e){return s[e]||(s[e]=o(e))}},"../../node_modules/core-js/internals/shared-store.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/is-pure.js"),o=r("../../node_modules/core-js/internals/global-this.js"),s=r("../../node_modules/core-js/internals/define-global-property.js"),a="__core-js_shared__",c=e.exports=o[a]||s(a,{});(c.versions||(c.versions=[])).push({version:"3.44.0",mode:i?"pure":"global",copyright:"\xa9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.44.0/LICENSE",source:"https://github.com/zloirock/core-js"})},"../../node_modules/core-js/internals/shared.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/shared-store.js");e.exports=function(e,n){return i[e]||(i[e]=n||{})}},"../../node_modules/core-js/internals/symbol-constructor-detection.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/environment-v8-version.js"),o=r("../../node_modules/core-js/internals/fails.js"),s=r("../../node_modules/core-js/internals/global-this.js").String;e.exports=!!Object.getOwnPropertySymbols&&!o(function(){var e=Symbol("symbol detection");return!s(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&i&&i<41})},"../../node_modules/core-js/internals/to-absolute-index.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/to-integer-or-infinity.js"),o=Math.max,s=Math.min;e.exports=function(e,n){var r=i(e);return r<0?o(r+n,0):s(r,n)}},"../../node_modules/core-js/internals/to-indexed-object.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/indexed-object.js"),o=r("../../node_modules/core-js/internals/require-object-coercible.js");e.exports=function(e){return i(o(e))}},"../../node_modules/core-js/internals/to-integer-or-infinity.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/math-trunc.js");e.exports=function(e){var n=+e;return n!=n||0===n?0:i(n)}},"../../node_modules/core-js/internals/to-length.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/to-integer-or-infinity.js"),o=Math.min;e.exports=function(e){var n=i(e);return n>0?o(n,0x1fffffffffffff):0}},"../../node_modules/core-js/internals/to-object.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/require-object-coercible.js"),o=Object;e.exports=function(e){return o(i(e))}},"../../node_modules/core-js/internals/to-primitive.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-call.js"),o=r("../../node_modules/core-js/internals/is-object.js"),s=r("../../node_modules/core-js/internals/is-symbol.js"),a=r("../../node_modules/core-js/internals/get-method.js"),c=r("../../node_modules/core-js/internals/ordinary-to-primitive.js"),d=r("../../node_modules/core-js/internals/well-known-symbol.js"),l=TypeError,u=d("toPrimitive");e.exports=function(e,n){if(!o(e)||s(e))return e;var r,d=a(e,u);if(d){if(void 0===n&&(n="default"),!o(r=i(d,e,n))||s(r))return r;throw new l("Can't convert object to primitive value")}return void 0===n&&(n="number"),c(e,n)}},"../../node_modules/core-js/internals/to-property-key.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/to-primitive.js"),o=r("../../node_modules/core-js/internals/is-symbol.js");e.exports=function(e){var n=i(e,"string");return o(n)?n:n+""}},"../../node_modules/core-js/internals/try-to-string.js":function(e){"use strict";var n=String;e.exports=function(e){try{return n(e)}catch(e){return"Object"}}},"../../node_modules/core-js/internals/uid.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/function-uncurry-this.js"),o=0,s=Math.random(),a=i(1.1.toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++o+s,36)}},"../../node_modules/core-js/internals/use-symbol-as-uid.js":function(e,n,r){"use strict";e.exports=r("../../node_modules/core-js/internals/symbol-constructor-detection.js")&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},"../../node_modules/core-js/internals/v8-prototype-define-bug.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/descriptors.js"),o=r("../../node_modules/core-js/internals/fails.js");e.exports=i&&o(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},"../../node_modules/core-js/internals/weak-map-basic-detection.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js"),o=r("../../node_modules/core-js/internals/is-callable.js"),s=i.WeakMap;e.exports=o(s)&&/native code/.test(String(s))},"../../node_modules/core-js/internals/well-known-symbol.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/global-this.js"),o=r("../../node_modules/core-js/internals/shared.js"),s=r("../../node_modules/core-js/internals/has-own-property.js"),a=r("../../node_modules/core-js/internals/uid.js"),c=r("../../node_modules/core-js/internals/symbol-constructor-detection.js"),d=r("../../node_modules/core-js/internals/use-symbol-as-uid.js"),l=i.Symbol,u=o("wks"),f=d?l.for||l:l&&l.withoutSetter||a;e.exports=function(e){return s(u,e)||(u[e]=c&&s(l,e)?l[e]:f("Symbol."+e)),u[e]}},"../../node_modules/core-js/modules/es.array.includes.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/export.js"),o=r("../../node_modules/core-js/internals/array-includes.js").includes,s=r("../../node_modules/core-js/internals/fails.js"),a=r("../../node_modules/core-js/internals/add-to-unscopables.js");i({target:"Array",proto:!0,forced:s(function(){return![,].includes()})},{includes:function(e){return o(this,e,arguments.length>1?arguments[1]:void 0)}}),a("includes")},"../../node_modules/core-js/modules/es.array.reduce.js":function(e,n,r){"use strict";var i=r("../../node_modules/core-js/internals/export.js"),o=r("../../node_modules/core-js/internals/array-reduce.js").left,s=r("../../node_modules/core-js/internals/array-method-is-strict.js"),a=r("../../node_modules/core-js/internals/environment-v8-version.js");i({target:"Array",proto:!0,forced:!r("../../node_modules/core-js/internals/environment-is-node.js")&&a>79&&a<83||!s("reduce")},{reduce:function(e){var n=arguments.length;return o(this,e,n,n>1?arguments[1]:void 0)}})},"../../node_modules/core-js/modules/es.object.has-own.js":function(e,n,r){"use strict";r("../../node_modules/core-js/internals/export.js")({target:"Object",stat:!0},{hasOwn:r("../../node_modules/core-js/internals/has-own-property.js")})},"../../node_modules/reflect-metadata/Reflect.js":function(e,n,r){var i,o;o=i||(i={}),function(e){var n="object"==typeof globalThis?globalThis:"object"==typeof r.g?r.g:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(e){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(e){}}(),i=s(o);function s(e,n){return function(r,i){Object.defineProperty(e,r,{configurable:!0,writable:!0,value:i}),n&&n(r,i)}}void 0!==n.Reflect&&(i=s(n.Reflect,i)),e(i,n),void 0===n.Reflect&&(n.Reflect=o)}(function(e,n){var r,i=Object.prototype.hasOwnProperty,o="function"==typeof Symbol,s=o&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",a=o&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",c="function"==typeof Object.create,d=({__proto__:[]})instanceof Array,l=!c&&!d,u={create:c?function(){return L(Object.create(null))}:d?function(){return L({__proto__:null})}:function(){return L({})},has:l?function(e,n){return i.call(e,n)}:function(e,n){return n in e},get:l?function(e,n){return i.call(e,n)?e[n]:void 0}:function(e,n){return e[n]}},f=Object.getPrototypeOf(Function),p="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:function(){var e={},n=[],r=function(){function e(e,n,r){this._index=0,this._keys=e,this._values=n,this._selector=r}return e.prototype["@@iterator"]=function(){return this},e.prototype[a]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var r=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=n,this._values=n):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=n,this._values=n),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=n,this._values=n),{value:e,done:!0}},e}();function i(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(i.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),i.prototype.has=function(e){return this._find(e,!1)>=0},i.prototype.get=function(e){var n=this._find(e,!1);return n>=0?this._values[n]:void 0},i.prototype.set=function(e,n){var r=this._find(e,!0);return this._values[r]=n,this},i.prototype.delete=function(n){var r=this._find(n,!1);if(r>=0){for(var i=this._keys.length,o=r+1;o<i;o++)this._keys[o-1]=this._keys[o],this._values[o-1]=this._values[o];return this._keys.length--,this._values.length--,M(n,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},i.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},i.prototype.keys=function(){return new r(this._keys,this._values,o)},i.prototype.values=function(){return new r(this._keys,this._values,s)},i.prototype.entries=function(){return new r(this._keys,this._values,c)},i.prototype["@@iterator"]=function(){return this.entries()},i.prototype[a]=function(){return this.entries()},i.prototype._find=function(e,n){if(!M(this._cacheKey,e)){this._cacheIndex=-1;for(var r=0;r<this._keys.length;r++)if(M(this._keys[r],e)){this._cacheIndex=r;break}}return this._cacheIndex<0&&n&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},i;function o(e,n){return e}function s(e,n){return n}function c(e,n){return[e,n]}}(),h="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:function(){function e(){this._map=new p}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.keys()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[a]=function(){return this.keys()},e}(),m="function"==typeof WeakMap?WeakMap:function(){var e=u.create(),n=o();function r(){this._key=o()}return r.prototype.has=function(e){var n=s(e,!1);return void 0!==n&&u.has(n,this._key)},r.prototype.get=function(e){var n=s(e,!1);return void 0!==n?u.get(n,this._key):void 0},r.prototype.set=function(e,n){return s(e,!0)[this._key]=n,this},r.prototype.delete=function(e){var n=s(e,!1);return void 0!==n&&delete n[this._key]},r.prototype.clear=function(){this._key=o()},r;function o(){var n;do n="@@WeakMap@@"+function(){var e=function(e){if("function"==typeof Uint8Array){var n=new Uint8Array(16);return"undefined"!=typeof crypto?crypto.getRandomValues(n):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(n):a(n,16),n}return a(Array(16),16)}(0);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var n="",r=0;r<16;++r){var i=e[r];(4===r||6===r||8===r)&&(n+="-"),i<16&&(n+="0"),n+=i.toString(16).toLowerCase()}return n}();while(u.has(e,n));return e[n]=!0,n}function s(e,r){if(!i.call(e,n)){if(!r)return;Object.defineProperty(e,n,{value:u.create()})}return e[n]}function a(e,n){for(var r=0;r<n;++r)e[r]=255*Math.random()|0;return e}}(),v=o?Symbol.for("@reflect-metadata:registry"):void 0,g=(!T(v)&&x(n.Reflect)&&Object.isExtensible(n.Reflect)&&(r=n.Reflect[v]),T(r)&&(r=function(){T(v)||void 0===n.Reflect||v in n.Reflect||"function"!=typeof n.Reflect.defineMetadata||(r=(e=n.Reflect).defineMetadata,i=e.hasOwnMetadata,o=e.getOwnMetadata,s=e.getOwnMetadataKeys,a=e.deleteMetadata,c=new m,d={isProviderFor:function(e,n){var r=c.get(e);return!!(!T(r)&&r.has(n))||!!s(e,n).length&&(T(r)&&(r=new h,c.set(e,r)),r.add(n),!0)},OrdinaryDefineOwnMetadata:r,OrdinaryHasOwnMetadata:i,OrdinaryGetOwnMetadata:o,OrdinaryOwnMetadataKeys:s,OrdinaryDeleteMetadata:a});var e,r,i,o,s,a,c,d,l,u,f,g=new m,y={registerProvider:function(e){if(!Object.isExtensible(y))throw Error("Cannot add provider to a frozen registry.");switch(!0){case d===e:break;case T(l):l=e;break;case l===e:break;case T(u):u=e;break;case u===e:break;default:void 0===f&&(f=new h),f.add(e)}},getProvider:b,setProvider:function(e,n,r){if(!function(e){if(T(e))throw TypeError();return l===e||u===e||!T(f)&&f.has(e)}(r))throw Error("Metadata provider not registered.");var i=b(e,n);if(i!==r){if(!T(i))return!1;var o=g.get(e);T(o)&&(o=new p,g.set(e,o)),o.set(n,r)}return!0}};return y;function b(e,n){var r,i=g.get(e);return T(i)||(r=i.get(n)),T(r)&&(r=function(e,n){if(!T(l)){if(l.isProviderFor(e,n))return l;if(!T(u)){if(u.isProviderFor(e,n))return l;if(!T(f))for(var r=j(f);;){var i=A(r);if(!i)return;var o=i.value;if(o.isProviderFor(e,n))return D(r),o}}}if(!T(d)&&d.isProviderFor(e,n))return d}(e,n),T(r)||(T(i)&&(i=new p,g.set(e,i)),i.set(n,r))),r}}()),!T(v)&&x(n.Reflect)&&Object.isExtensible(n.Reflect)&&Object.defineProperty(n.Reflect,v,{enumerable:!1,configurable:!1,writable:!1,value:r}),r),y=function(e){var n=new m,r={isProviderFor:function(e,r){var i=n.get(e);return!T(i)&&i.has(r)},OrdinaryDefineOwnMetadata:function(e,n,r,o){i(r,o,!0).set(e,n)},OrdinaryHasOwnMetadata:function(e,n,r){var o=i(n,r,!1);return!T(o)&&!!o.has(e)},OrdinaryGetOwnMetadata:function(e,n,r){var o=i(n,r,!1);if(!T(o))return o.get(e)},OrdinaryOwnMetadataKeys:function(e,n){var r=[],o=i(e,n,!1);if(T(o))return r;for(var s=j(o.keys()),a=0;;){var c=A(s);if(!c)return r.length=a,r;var d=c.value;try{r[a]=d}catch(e){try{D(s)}finally{throw e}}a++}},OrdinaryDeleteMetadata:function(e,r,o){var s=i(r,o,!1);if(T(s)||!s.delete(e))return!1;if(0===s.size){var a=n.get(r);T(a)||(a.delete(o),0===a.size&&n.delete(a))}return!0}};return g.registerProvider(r),r;function i(i,o,s){var a=n.get(i),c=!1;if(T(a)){if(!s)return;a=new p,n.set(i,a),c=!0}var d=a.get(o);if(T(d)){if(!s)return;if(d=new p,a.set(o,d),!e.setProvider(i,o,r))throw a.delete(o),c&&n.delete(i),Error("Wrong provider for target.")}return d}}(g);function b(e,n,r){var i=N(n,r,!1);return!T(i)&&!!i.OrdinaryHasOwnMetadata(e,n,r)}function _(e,n,r){var i=N(n,r,!1);if(!T(i))return i.OrdinaryGetOwnMetadata(e,n,r)}function w(e,n,r,i){N(r,i,!0).OrdinaryDefineOwnMetadata(e,n,r,i)}function S(e,n){var r=N(e,n,!1);return r?r.OrdinaryOwnMetadataKeys(e,n):[]}function R(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function T(e){return void 0===e}function C(e){return null===e}function x(e){return"object"==typeof e?null!==e:"function"==typeof e}e("decorate",function(e,n,r,i){if(T(r)){if(!O(e)||!k(n))throw TypeError();for(var o=e,s=n,a=o.length-1;a>=0;--a){var c=(0,o[a])(s);if(!T(c)&&!C(c)){if(!k(c))throw TypeError();s=c}}return s}if(!O(e)||!x(n)||!x(i)&&!T(i)&&!C(i))throw TypeError();return C(i)&&(i=void 0),function(e,n,r,i){for(var o=e.length-1;o>=0;--o){var s=(0,e[o])(n,r,i);if(!T(s)&&!C(s)){if(!x(s))throw TypeError();i=s}}return i}(e,n,r=E(r),i)}),e("metadata",function(e,n){return function(r,i){if(!x(r)||!T(i)&&!function(e){switch(R(e)){case 3:case 4:return!0;default:return!1}}(i))throw TypeError();w(e,n,r,i)}}),e("defineMetadata",function(e,n,r,i){if(!x(r))throw TypeError();return T(i)||(i=E(i)),w(e,n,r,i)}),e("hasMetadata",function(e,n,r){if(!x(n))throw TypeError();return T(r)||(r=E(r)),function e(n,r,i){if(b(n,r,i))return!0;var o=B(r);return!C(o)&&e(n,o,i)}(e,n,r)}),e("hasOwnMetadata",function(e,n,r){if(!x(n))throw TypeError();return T(r)||(r=E(r)),b(e,n,r)}),e("getMetadata",function(e,n,r){if(!x(n))throw TypeError();return T(r)||(r=E(r)),function e(n,r,i){if(b(n,r,i))return _(n,r,i);var o=B(r);if(!C(o))return e(n,o,i)}(e,n,r)}),e("getOwnMetadata",function(e,n,r){if(!x(n))throw TypeError();return T(r)||(r=E(r)),_(e,n,r)}),e("getMetadataKeys",function(e,n){if(!x(e))throw TypeError();return T(n)||(n=E(n)),function e(n,r){var i=S(n,r),o=B(n);if(null===o)return i;var s=e(o,r);if(s.length<=0)return i;if(i.length<=0)return s;for(var a=new h,c=[],d=0;d<i.length;d++){var l=i[d],u=a.has(l);u||(a.add(l),c.push(l))}for(var f=0;f<s.length;f++){var l=s[f],u=a.has(l);u||(a.add(l),c.push(l))}return c}(e,n)}),e("getOwnMetadataKeys",function(e,n){if(!x(e))throw TypeError();return T(n)||(n=E(n)),S(e,n)}),e("deleteMetadata",function(e,n,r){if(!x(n)||(T(r)||(r=E(r)),!x(n)))throw TypeError();T(r)||(r=E(r));var i=N(n,r,!1);return!T(i)&&i.OrdinaryDeleteMetadata(e,n,r)});function E(e){var n=function(e,n){switch(R(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var r="string",i=P(e,s);if(void 0!==i){var o=i.call(e,r);if(x(o))throw TypeError();return o}return function(e,n){if("string"===n){var r=e.toString;if(I(r)){var i=r.call(e);if(!x(i))return i}var o=e.valueOf;if(I(o)){var i=o.call(e);if(!x(i))return i}}else{var o=e.valueOf;if(I(o)){var i=o.call(e);if(!x(i))return i}var s=e.toString;if(I(s)){var i=s.call(e);if(!x(i))return i}}throw TypeError()}(e,r)}(e,0);return"symbol"==typeof n?n:""+n}function O(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function I(e){return"function"==typeof e}function k(e){return"function"==typeof e}function M(e,n){return e===n||e!=e&&n!=n}function P(e,n){var r=e[n];if(null!=r){if(!I(r))throw TypeError();return r}}function j(e){var n=P(e,a);if(!I(n))throw TypeError();var r=n.call(e);if(!x(r))throw TypeError();return r}function A(e){var n=e.next();return!n.done&&n}function D(e){var n=e.return;n&&n.call(e)}function B(e){var n=Object.getPrototypeOf(e);if("function"!=typeof e||e===f||n!==f)return n;var r=e.prototype,i=r&&Object.getPrototypeOf(r);if(null==i||i===Object.prototype)return n;var o=i.constructor;return"function"!=typeof o||o===e?n:o}function N(e,n,r){var i=g.getProvider(e,n);if(!T(i))return i;if(r){if(g.setProvider(e,n,y))return y;throw Error("Illegal state.")}}function L(e){return e.__=void 0,delete e.__,e}})}},n={};function r(i){var o=n[i];if(void 0!==o)return o.exports;var s=n[i]={id:i,loaded:!1,exports:{}};return e[i].call(s.exports,s,s.exports,r),s.loaded=!0,s.exports}r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},r.d=(e,n)=>{for(var i in n)r.o(n,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},r.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var i={};return(()=>{"use strict";let e,n,o,s,a;r.r(i),r.d(i,{createAaaSPilotKit:()=>de,Language:()=>rL,ConversationBean:()=>rz,checkAudioDevice:()=>o5,AudioDeviceDetector:()=>o4,AudioDeviceError:()=>o3,ConversationService:()=>iq,DEFAULT_OPTIONS:()=>rV,ClientConversationBean:()=>rG,AaaSPilotKitController:()=>sv,getErrorMessage:()=>o6,subscribeAgentResponse:()=>dt,AIWorkerConversationBean:()=>iU,BaseAgentService:()=>rD});var c,d,l,u,f,p,h,m,v,g,y,b,_={};r.r(_),r.d(_,{fixNegotiationNeeded:()=>sz,shimAddTrackRemoveTrack:()=>sq,shimAddTrackRemoveTrackWithNative:()=>sH,shimGetSendersWithDtmf:()=>sU,shimGetUserMedia:()=>sB,shimMediaStream:()=>sN,shimOnTrack:()=>sL,shimPeerConnection:()=>sV,shimSenderReceiverGetStats:()=>sF});var w={};r.r(w),r.d(w,{shimAddTransceiver:()=>sZ,shimCreateAnswer:()=>s2,shimCreateOffer:()=>s1,shimGetDisplayMedia:()=>sW,shimGetParameters:()=>s0,shimGetUserMedia:()=>sG,shimOnTrack:()=>sX,shimPeerConnection:()=>s$,shimRTCDataChannel:()=>sQ,shimReceiverGetStats:()=>sK,shimRemoveStream:()=>sY,shimSenderGetStats:()=>sJ});var S={};r.r(S),r.d(S,{shimAudioContext:()=>at,shimCallbacksAPI:()=>s5,shimConstraints:()=>s8,shimCreateOfferLegacy:()=>ae,shimGetUserMedia:()=>s6,shimLocalStreamsAPI:()=>s3,shimRTCIceServerUrls:()=>s9,shimRemoteStreamsAPI:()=>s4,shimTrackEventTransceiver:()=>s7});var R={};r.r(R),r.d(R,{removeExtmapAllowMixed:()=>ad,shimAddIceCandidateNullOrEmpty:()=>al,shimConnectionState:()=>ac,shimMaxMessageSize:()=>as,shimParameterlessSetLocalDescription:()=>au,shimRTCIceCandidate:()=>ai,shimRTCIceCandidateRelayProtocol:()=>ao,shimSendThrowTypeError:()=>aa});var T={};r.r(T),r.d(T,{default:()=>af});var C={};function x(e){return("object"==typeof e&&null!==e||"function"==typeof e)&&"function"==typeof e.then}function E(e){switch(typeof e){case"string":case"symbol":return e.toString();case"function":return e.name;default:throw Error(`Unexpected ${typeof e} service id type`)}}r.r(C),r.d(C,{clearInterval:()=>cL,clearTimeout:()=>cU,setInterval:()=>cF,setTimeout:()=>cH}),r("../../node_modules/core-js/modules/es.object.has-own.js"),r("../../node_modules/reflect-metadata/Reflect.js");let O=Symbol.for("@inversifyjs/common/islazyServiceIdentifier");class I{#e;constructor(e){this.#e=e,this[O]=!0}static is(e){return"object"==typeof e&&null!==e&&!0===e[O]}unwrap(){return this.#e()}}function k(e,n,r){return Reflect.getOwnMetadata(n,e,r)}function M(e,n,r,i){Reflect.defineMetadata(n,r,e,i)}function P(e,n,r,i,o){var s;let a=i(null!=(s=k(e,n,o))?s:r());Reflect.defineMetadata(n,a,e,o)}r("../../node_modules/core-js/modules/es.array.includes.js");let j="@inversifyjs/container/bindingId";function A(){var e;let n=null!=(e=k(Object,j))?e:0;return n===Number.MAX_SAFE_INTEGER?M(Object,j,Number.MIN_SAFE_INTEGER):P(Object,j,()=>n,e=>e+1),n}let D="Request",B="Singleton",N="Transient",L="ConstantValue",U="DynamicValue",F="Factory",H="Instance",q="Provider",V="ResolvedValue",z="ServiceRedirection";function*G(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];for(let e of n)yield*e}class W{#e;#t;#n;constructor(e){for(const n of(this.#e=new Map,this.#t={},Reflect.ownKeys(e)))this.#t[n]=new Map;this.#n=e}add(e,n){for(let r of(this.#r(e).push(n),Reflect.ownKeys(n)))this.#i(r,n[r]).push(e)}clone(){let e=this.#o(),n=this.#s(),r=Reflect.ownKeys(this.#n),i=this._buildNewInstance(this.#n);for(let o of(this.#a(this.#e,i.#e,e,n),r))this.#c(this.#t[o],i.#t[o],e);return i}get(e,n){return this.#t[e].get(n)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,n){let r=this.get(e,n);if(void 0!==r)for(let i of new Set(r)){let r=this.#e.get(i);if(void 0===r)throw Error("Expecting model relation, none found");for(let o of r)o[e]===n&&this.#d(i,o);this.#e.delete(i)}}_buildNewInstance(e){return new W(e)}_cloneModel(e){return e}_cloneRelation(e){return e}#o(){let e=new Map;for(let n of this.#e.keys()){let r=this._cloneModel(n);e.set(n,r)}return e}#s(){let e=new Map;for(let n of this.#e.values())for(let r of n){let n=this._cloneRelation(r);e.set(r,n)}return e}#r(e){let n=this.#e.get(e);return void 0===n&&(n=[],this.#e.set(e,n)),n}#i(e,n){let r=this.#t[e].get(n);return void 0===r&&(r=[],this.#t[e].set(n,r)),r}#l(e,n){let r=n.get(e);if(void 0===r)throw Error("Expecting model to be cloned, none found");return r}#u(e,n){let r=n.get(e);if(void 0===r)throw Error("Expecting relation to be cloned, none found");return r}#c(e,n,r){for(let[i,o]of e){let e=[];for(let n of o)e.push(this.#l(n,r));n.set(i,e)}}#a(e,n,r,i){for(let[o,s]of e){let e=[];for(let n of s)e.push(this.#u(n,i));n.set(this.#l(o,r),e)}}#d(e,n){for(let r of Reflect.ownKeys(n))this.#f(e,r,n[r])}#f(e,n,r){let i=this.#t[n].get(r);if(void 0!==i){let o=i.indexOf(e);-1!==o&&i.splice(o,1),0===i.length&&this.#t[n].delete(r)}}}(aj=a1||(a1={})).moduleId="moduleId",aj.serviceId="serviceId";class X{#p;#h;constructor(e,n){this.#p=null!=n?n:new W({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#h=e}static build(e){return new X(e)}add(e,n){this.#p.add(e,n)}clone(){return new X(this.#h,this.#p.clone())}get(e){var n;let r=[],i=this.#p.get(a1.serviceId,e);void 0!==i&&r.push(i);let o=null==(n=this.#h())?void 0:n.get(e);if(void 0!==o&&r.push(o),0!==r.length)return G(...r)}removeAllByModuleId(e){this.#p.removeByRelation(a1.moduleId,e)}removeAllByServiceId(e){this.#p.removeByRelation(a1.serviceId,e)}}let $="@inversifyjs/core/classMetadataReflectKey";function J(){return{constructorArguments:[],lifecycle:{postConstructMethodNames:new Set,preDestroyMethodNames:new Set},properties:new Map,scope:void 0}}let K="@inversifyjs/core/pendingClassMetadataCountReflectKey",Y=Symbol.for("@inversifyjs/core/InversifyCoreError");class Q extends Error{constructor(e,n,r){super(n,r),this[Y]=!0,this.kind=e}static is(e){return"object"==typeof e&&null!==e&&!0===e[Y]}static isErrorOfKind(e,n){return Q.is(e)&&e.kind===n}}function Z(e){var n;let r,i=null!=(n=k(e,$))?n:J();if(void 0===(r=k(e,K))||0===r)return function(e,n){let r=[];if(n.length<e.length)throw new Q(a2.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}". "${e.name}" constructor requires at least ${e.length.toString()} arguments, found ${n.length.toString()} instead.
|
|
3
9
|
Are you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?
|
|
4
10
|
|
|
5
|
-
If you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`);for(let e=0;e<n.length;++e)void 0===n[e]&&r.push(e);if(r.length>0)throw new
|
|
11
|
+
If you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`);for(let e=0;e<n.length;++e)void 0===n[e]&&r.push(e);if(r.length>0)throw new Q(a2.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}" at constructor indexes "${r.join('", "')}".
|
|
6
12
|
|
|
7
13
|
Are you using @inject, @multiInject or @unmanaged decorators at those indexes?
|
|
8
14
|
|
|
9
|
-
If you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(e,
|
|
10
|
-
Every constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(let[n,
|
|
11
|
-
This property must be decorated either with @inject or @multiInject decorator.`);if(0===
|
|
15
|
+
If you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(e,i.constructorArguments),i;let o=[];for(let n=0;n<i.constructorArguments.length;++n){let r=i.constructorArguments[n];void 0!==r&&r.kind!==a3.unknown||o.push(` - Missing or incomplete metadata for type "${e.name}" at constructor argument with index ${n.toString()}.
|
|
16
|
+
Every constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(let[n,r]of i.properties)r.kind===a3.unknown&&o.push(` - Missing or incomplete metadata for type "${e.name}" at property "${n.toString()}".
|
|
17
|
+
This property must be decorated either with @inject or @multiInject decorator.`);if(0===o.length)throw new Q(a2.unknown,`Unexpected class metadata for type "${e.name}" with uncompletion traces.
|
|
12
18
|
This might be caused by one of the following reasons:
|
|
13
19
|
|
|
14
20
|
1. A third party library is targeting inversify reflection metadata.
|
|
15
|
-
2. A bug is causing the issue. Consider submiting an issue to fix it.`);throw new
|
|
21
|
+
2. A bug is causing the issue. Consider submiting an issue to fix it.`);throw new Q(a2.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:
|
|
16
22
|
|
|
17
|
-
${
|
|
18
|
-
Found @inject decorator at method "${null!=(
|
|
19
|
-
Found @inject decorator at method "${n.toString()}" at class "${e.constructor.name}"`);
|
|
23
|
+
${o.join("\n\n")}`)}function ee(e,n){var r;let i=null!=(r=Z(n).scope)?r:e.scope;return{cache:{isRight:!1,value:void 0},id:A(),implementationType:n,isSatisfiedBy:()=>!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:i,serviceIdentifier:n,type:H}}function et(e){return e.isRight?{isRight:!0,value:e.value}:e}(aA=a2||(a2={}))[aA.injectionDecoratorConflict=0]="injectionDecoratorConflict",aA[aA.missingInjectionDecorator=1]="missingInjectionDecorator",aA[aA.planning=2]="planning",aA[aA.resolution=3]="resolution",aA[aA.unknown=4]="unknown",(aD=a3||(a3={}))[aD.unknown=32]="unknown",(aB=a4||(a4={})).id="id",aB.moduleId="moduleId",aB.serviceId="serviceId";class en extends W{_buildNewInstance(e){return new en(e)}_cloneModel(e){return function(e){switch(e.type){case L:case U:return{cache:et(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type,value:e.value};case F:return{cache:et(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type};case H:return{cache:et(e.cache),id:e.id,implementationType:e.implementationType,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type};case q:return{cache:et(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,provider:e.provider,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type};case V:return{cache:et(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,metadata:e.metadata,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type};case z:return{id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,serviceIdentifier:e.serviceIdentifier,targetServiceIdentifier:e.targetServiceIdentifier,type:e.type}}}(e)}}class er{#m;#v;#h;constructor(e,n,r){this.#v=null!=r?r:new en({id:{isOptional:!1},moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#h=e,this.#m=n}static build(e,n){return new er(e,n)}clone(){return new er(this.#h,this.#m,this.#v.clone())}get(e){var n,r;let i=null!=(r=this.getNonParentBindings(e))?r:null==(n=this.#h())?void 0:n.get(e);if(void 0!==i)return i;let o=this.#g(e);return void 0===o?o:[o]}*getChained(e){let n=this.getNonParentBindings(e);void 0!==n&&(yield*n);let r=this.#h();if(void 0===r){if(void 0===n){let n=this.#g(e);void 0!==n&&(yield n)}}else yield*r.getChained(e)}getBoundServices(){let e=new Set(this.#v.getAllKeys(a4.serviceId)),n=this.#h();if(void 0!==n)for(let r of n.getBoundServices())e.add(r);return e}getById(e){var n,r;return null!=(r=this.#v.get(a4.id,e))?r:null==(n=this.#h())?void 0:n.getById(e)}getByModuleId(e){var n,r;return null!=(r=this.#v.get(a4.moduleId,e))?r:null==(n=this.#h())?void 0:n.getByModuleId(e)}getNonParentBindings(e){return this.#v.get(a4.serviceId,e)}getNonParentBoundServices(){return this.#v.getAllKeys(a4.serviceId)}removeById(e){this.#v.removeByRelation(a4.id,e)}removeAllByModuleId(e){this.#v.removeByRelation(a4.moduleId,e)}removeAllByServiceId(e){this.#v.removeByRelation(a4.serviceId,e)}set(e){let n={[a4.id]:e.id,[a4.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(n[a4.moduleId]=e.moduleId),this.#v.add(e,n)}#g(e){if(void 0===this.#m||"function"!=typeof e)return;let n=ee(this.#m,e);return this.set(n),n}}(aN=a5||(a5={})).moduleId="moduleId",aN.serviceId="serviceId";class ei{#y;#h;constructor(e,n){this.#y=null!=n?n:new W({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#h=e}static build(e){return new ei(e)}add(e,n){this.#y.add(e,n)}clone(){return new ei(this.#h,this.#y.clone())}get(e){var n;let r=[],i=this.#y.get(a5.serviceId,e);void 0!==i&&r.push(i);let o=null==(n=this.#h())?void 0:n.get(e);if(void 0!==o&&r.push(o),0!==r.length)return G(...r)}removeAllByModuleId(e){this.#y.removeByRelation(a5.moduleId,e)}removeAllByServiceId(e){this.#y.removeByRelation(a5.serviceId,e)}}function eo(e,n,r,i){let o=Array.isArray(e)?e:[e];if(void 0!==r)if("number"!=typeof r)if(void 0!==i)for(let e of o)e(n,r,i);else Reflect.decorate(o,n.prototype,r);else for(let e of o)e(n,void 0,r);else Reflect.decorate(o,n)}function es(){return 0}function ea(e){return n=>{void 0!==n&&n.kind===a3.unknown&&P(e,K,es,e=>e-1)}}function ec(e,n){return function(){for(var r=arguments.length,i=Array(r),o=0;o<r;o++)i[o]=arguments[o];return r=>{if(void 0===r)return e(...i);if(r.kind===a6.unmanaged)throw new Q(a2.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");return n(r,...i)}}}function ed(e){if(e.kind!==a3.unknown&&!0!==e.isFromTypescriptParamType)throw new Q(a2.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found")}(aL=a6||(a6={}))[aL.multipleInjection=0]="multipleInjection",aL[aL.singleInjection=1]="singleInjection",aL[aL.unmanaged=2]="unmanaged";let el=ec(function(e,n,r){var i;return e===a6.multipleInjection?{chained:null!=(i=null==r?void 0:r.chained)&&i,kind:e,name:void 0,optional:!1,tags:new Map,value:n}:{kind:e,name:void 0,optional:!1,tags:new Map,value:n}},function(e,n,r,i){var o;return ed(e),n===a6.multipleInjection?{...e,chained:null!=(o=null==i?void 0:i.chained)&&o,kind:n,value:r}:{...e,kind:n,value:r}});function eu(e,n){return r=>{let i=r.properties.get(n);return r.properties.set(n,e(i)),r}}function ef(e,n){return(r,i,o)=>{try{let s,a,c;void 0===o?(s=ep(e,n),(e,n)=>{P(e.constructor,$,J,eu(s(e),n))})(r,i):"number"==typeof o?(a=ep(e,n),(e,n,r)=>{var i,o;if("function"!=typeof e||void 0!==n)throw new Q(a2.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.
|
|
24
|
+
Found @inject decorator at method "${null!=(i=null==n?void 0:n.toString())?i:""}" at class "${e.constructor.name}"`);P(e,$,J,(o=a(e),e=>{let n=e.constructorArguments[r];return e.constructorArguments[r]=o(n),e}))})(r,i,o):(c=ep(e,n),(e,n,r)=>{if(void 0===r.set)throw new Q(a2.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.
|
|
25
|
+
Found @inject decorator at method "${n.toString()}" at class "${e.constructor.name}"`);P(e.constructor,$,J,eu(c(e),n))})(r,i,o)}catch(e){if(Q.isErrorOfKind(e,a2.injectionDecoratorConflict)){let n=function(e,n,r){if(void 0===r){if(void 0===n)throw new Q(a2.unknown,"Unexpected undefined property and index values");return{kind:a8.property,property:n,targetClass:e.constructor}}return"number"==typeof r?{index:r,kind:a8.parameter,targetClass:e}:{kind:a8.method,method:n,targetClass:e}}(r,i,o);throw new Q(a2.injectionDecoratorConflict,`Unexpected injection error.
|
|
20
26
|
|
|
21
27
|
Cause:
|
|
22
28
|
|
|
23
|
-
${
|
|
29
|
+
${e.message}
|
|
24
30
|
|
|
25
31
|
Details
|
|
26
32
|
|
|
27
|
-
${function(e){switch(e.kind){case
|
|
33
|
+
${function(e){switch(e.kind){case a8.method:return`[class: "${e.targetClass.name}", method: "${e.method.toString()}"]`;case a8.parameter:return`[class: "${e.targetClass.name}", index: "${e.index.toString()}"]`;case a8.property:return`[class: "${e.targetClass.name}", property: "${e.property.toString()}"]`}}(n)}`,{cause:e})}throw e}}}function ep(e,n){return r=>{let i=n(r);return n=>(i(n),e(n))}}function eh(e){return ef(el(a6.singleInjection,e),ea)}(aU=a8||(a8={}))[aU.method=0]="method",aU[aU.parameter=1]="parameter",aU[aU.property=2]="property";let em="@inversifyjs/core/classIsInjectableFlagReflectKey",ev=[Array,BigInt,Boolean,Function,Number,Object,String];function eg(e){return n=>{let r;!function(e){if(void 0!==k(e,em))throw new Q(a2.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${e.name}"`);M(e,em,!0)}(n),void 0!==(r=k(n,"design:paramtypes"))&&P(n,$,J,e=>(r.forEach((n,r)=>{void 0!==e.constructorArguments[r]||ev.includes(n)||(e.constructorArguments[r]={isFromTypescriptParamType:!0,kind:a6.singleInjection,name:void 0,optional:!1,tags:new Map,value:n})}),e)),void 0!==e&&P(n,$,J,n=>({...n,scope:e}))}}function ey(e,n,r){return e?new Set([...n,...r]):r}function eb(e){return n=>{var r;let i,o=null==(i=Object.getPrototypeOf(n.prototype))?void 0:i.constructor;if(void 0===o)throw new Q(a2.injectionDecoratorConflict,`Expected base type for type "${n.name}", none found.`);(r={...e,type:o},e=>{let n=Z(r.type);P(e,$,J,e=>{var i,o,s,a,c,d;let l,u,f;return{constructorArguments:(null==(i=r.extendConstructorArguments)||i?(l=[...n.constructorArguments],e.constructorArguments.map((e,n)=>{l[n]=e})):l=e.constructorArguments,l),lifecycle:(u=null==(a=null==(o=r.lifecycle)?void 0:o.extendPostConstructMethods)||a,f=ey(null==(c=null==(s=r.lifecycle)?void 0:s.extendPreDestroyMethods)||c,n.lifecycle.preDestroyMethodNames,e.lifecycle.preDestroyMethodNames),{postConstructMethodNames:ey(u,n.lifecycle.postConstructMethodNames,e.lifecycle.postConstructMethodNames),preDestroyMethodNames:f}),properties:null==(d=r.extendProperties)||d?new Map(G(n.properties,e.properties)):e.properties,scope:e.scope}})})(n)}}function e_(e){return n=>{void 0===n&&P(e,K,es,e=>e+1)}}function ew(e){if(e.optional)throw new Q(a2.injectionDecoratorConflict,"Unexpected duplicated optional decorator");return e.optional=!0,e}function eS(){return ef(e=>{let n=null!=e?e:{kind:a3.unknown,name:void 0,optional:!1,tags:new Map};if(n.kind===a6.unmanaged)throw new Q(a2.injectionDecoratorConflict,"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");return ew(n)},e_)}function eR(){return{kind:a6.unmanaged}}function eT(e){return e instanceof Error&&(e instanceof RangeError&&/stack space|call stack|too much recursion/i.test(e.message)||"InternalError"===e.name&&/too much recursion/.test(e.message))}ec(eR,function(e){if(ed(e),void 0!==e.name||e.optional||e.tags.size>0)throw new Q(a2.injectionDecoratorConflict,"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");return eR()}),(aF=a9||(a9={}))[aF.multipleInjection=0]="multipleInjection",aF[aF.singleInjection=1]="singleInjection";let eC=Symbol.for("@inversifyjs/core/LazyPlanServiceNode");class ex{constructor(e,n){this[eC]=!0,this._serviceNode=e,this._serviceIdentifier=n}get bindings(){return this._getNode().bindings}get isContextFree(){return this._getNode().isContextFree}get serviceIdentifier(){return this._serviceIdentifier}set bindings(e){this._getNode().bindings=e}set isContextFree(e){this._getNode().isContextFree=e}static is(e){return"object"==typeof e&&null!==e&&!0===e[eC]}invalidate(){this._serviceNode=void 0}isExpanded(){return void 0!==this._serviceNode}_getNode(){return void 0===this._serviceNode&&(this._serviceNode=this._buildPlanServiceNode()),this._serviceNode}}class eE{#b;constructor(e){this.#b=e}get name(){return this.#b.elem.name}get serviceIdentifier(){return this.#b.elem.serviceIdentifier}get tags(){return this.#b.elem.tags}getAncestor(){if(this.#b.elem.getAncestorsCalled=!0,void 0!==this.#b.previous)return new eE(this.#b.previous)}}function eO(e,n,r){var i,o;let s=null!=(i=null==r?void 0:r.customServiceIdentifier)?i:n.serviceIdentifier,a=(!0===(null==r?void 0:r.chained)?[...e.operations.getBindingsChained(s)]:[...null!=(o=e.operations.getBindings(s))?o:[]]).filter(e=>e.isSatisfiedBy(n));if(0===a.length&&void 0!==e.autobindOptions&&"function"==typeof s){let r=ee(e.autobindOptions,s);e.operations.setBinding(r),r.isSatisfiedBy(n)&&a.push(r)}return a}class eI{constructor(e){this.last=e}concat(e){return new eI({elem:e,previous:this.last})}[Symbol.iterator](){let e=this.last;return{next:()=>{if(void 0===e)return{done:!0,value:void 0};let n=e.elem;return e=e.previous,{done:!1,value:n}}}}}function ek(e){let n=new Map;return void 0!==e.rootConstraints.tag&&n.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value),new eI({elem:{getAncestorsCalled:!1,name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:n},previous:void 0})}function eM(e){return void 0!==e.redirections}function eP(e,n,r,i){var o,s;let a=r.elem.serviceIdentifier,c=null==(o=r.previous)?void 0:o.elem.serviceIdentifier;Array.isArray(e)?function(e,n,r,i,o,s){if(0!==e.length){var a;let n=null!=(a=s[s.length-1])?a:r,c=`Ambiguous bindings found for service: "${E(n)}".${eB(s)}
|
|
28
34
|
|
|
29
35
|
Registered bindings:
|
|
30
36
|
|
|
31
|
-
${e.map(e=>(function(e){switch(e.type){case
|
|
37
|
+
${e.map(e=>(function(e){switch(e.type){case H:return`[ type: "${e.type}", serviceIdentifier: "${E(e.serviceIdentifier)}", scope: "${e.scope}", implementationType: "${e.implementationType.name}" ]`;case z:return`[ type: "${e.type}", serviceIdentifier: "${E(e.serviceIdentifier)}", redirection: "${E(e.targetServiceIdentifier)}" ]`;default:return`[ type: "${e.type}", serviceIdentifier: "${E(e.serviceIdentifier)}", scope: "${e.scope}" ]`}})(e.binding)).join("\n")}
|
|
32
38
|
|
|
33
|
-
Trying to resolve bindings for "${ej(r,i)}".
|
|
39
|
+
Trying to resolve bindings for "${eA(r,i)}".${eD(o)}`;throw new Q(a2.planning,c)}n||ej(r,i,o,s)}(e,n,a,c,r.elem,i):(s=r.elem,void 0!==e||n||ej(a,c,s,i))}function ej(e,n,r,i){var o;let s=null!=(o=i[i.length-1])?o:e,a=`No bindings found for service: "${E(s)}".
|
|
34
40
|
|
|
35
|
-
${eA(
|
|
41
|
+
Trying to resolve bindings for "${eA(e,n)}".${eB(i)}${eD(r)}`;throw new Q(a2.planning,a)}function eA(e,n){return void 0===n?`${E(e)} (Root service)`:E(n)}function eD(e){var n,r;let i=0===e.tags.size?"":`
|
|
42
|
+
- tags:
|
|
43
|
+
- ${[...e.tags.keys()].map(e=>e.toString()).join("\n - ")}`;return`
|
|
36
44
|
|
|
37
|
-
|
|
45
|
+
Binding constraints:
|
|
46
|
+
- service identifier: ${E(e.serviceIdentifier)}
|
|
47
|
+
- name: ${null!=(r=null==(n=e.name)?void 0:n.toString())?r:"-"}${i}`}function eB(e){return 0===e.length?"":`
|
|
38
48
|
|
|
39
|
-
|
|
40
|
-
- tags:
|
|
41
|
-
- ${[...e.tags.keys()].map(e=>e.toString()).join("\n - ")}`;return`Binding constraints:
|
|
42
|
-
|
|
43
|
-
- name: ${null!=(r=null==(n=e.name)?void 0:n.toString())?r:"-"}${i}`}function eB(e,n,r){if(Array.isArray(e.bindings)&&1===e.bindings.length){let[i]=e.bindings;ex(i)&&function e(n,r,i){if(1!==n.redirections.length)eC(n.redirections,r,n,i);else{let[o]=n.redirections;ex(o)&&e(o,r,i)}}(i,n,r)}else eC(e.bindings,n,e,r)}function ek(e,n,r){if(r.kind===b.unmanaged)return;let i=U.is(r.value)?r.value.unwrap():r.value,o=n.concat({name:r.name,serviceIdentifier:i,tags:r.tags}),s=new eE(o.last),a=eM(e,s),c=[],l={bindings:c,parent:e.node,serviceIdentifier:i};if(c.push(...eP(e,o,a,l)),r.kind===b.singleInjection){eB(l,r.optional,s);let[e]=c;l.bindings=e}return l}function eP(e,n,r,i){let o=ex(i)?i.binding.targetServiceIdentifier:i.serviceIdentifier;e.servicesBranch.push(o);let s=[];for(let o of r)switch(o.type){case z.Instance:s.push(function(e,n,r,i){let o={binding:n,classMetadata:e.getClassMetadata(n.implementationType),constructorParams:[],parent:i,propertyParams:new Map};return eN({autobindOptions:e.autobindOptions,getBindings:e.getBindings,getClassMetadata:e.getClassMetadata,node:o,servicesBranch:e.servicesBranch,setBinding:e.setBinding},r)}(e,o,n,i));break;case z.ResolvedValue:s.push(eN({autobindOptions:e.autobindOptions,getBindings:e.getBindings,getClassMetadata:e.getClassMetadata,node:{binding:o,params:[],parent:i},servicesBranch:e.servicesBranch,setBinding:e.setBinding},n));break;case z.ServiceRedirection:{let r=function(e,n,r,i){let o={binding:r,parent:i,redirections:[]},s=eM(e,new eE(n.last),{customServiceIdentifier:r.targetServiceIdentifier});return o.redirections.push(...eP(e,n,s,o)),o}(e,n,o,i);s.push(r);break}default:s.push({binding:o,parent:i})}return e.servicesBranch.pop(),s}function eN(e,n){return e.node.binding.type===z.Instance?function(e,n,r){let i=n.classMetadata;for(let[o,s]of i.constructorArguments.entries())n.constructorParams[o]=ek(e,r,s);for(let[o,s]of i.properties){let i=ek(e,r,s);void 0!==i&&n.propertyParams.set(o,i)}return e.node}(e,e.node,n):function(e,n,r){for(let[i,o]of n.binding.metadata.arguments.entries())n.params[i]=function(e,n,r){let i=U.is(r.value)?r.value.unwrap():r.value,o=n.concat({name:r.name,serviceIdentifier:i,tags:r.tags}),s=new eE(o.last),a=eM(e,s),c=[],l={bindings:c,parent:e.node,serviceIdentifier:i};if(c.push(...eP(e,o,a,l)),r.kind===w.singleInjection){eB(l,r.optional,s);let[e]=c;l.bindings=e}return l}(e,r,o);return e.node}(e,e.node,n)}class eD{#y;#b;#_;constructor(){this.#y=[],this.#b=8,this.#_=1024}*[Symbol.iterator](){let e=0;for(let n of this.#y){let r=n.deref();void 0===r?++e:yield r}this.#y.length>=this.#b&&this.#w(e)&&this.#O(e)}push(e){let n=new WeakRef(e);if(this.#y.push(n),this.#y.length>=this.#b&&this.#y.length%this.#_==0){let e=0;for(let n of this.#y)void 0===n.deref()&&++e;this.#w(e)&&this.#O(e)}}#O(e){let n=Array(this.#y.length-e),r=0;for(let e of this.#y)e.deref()&&(n[r++]=e);this.#y=n}#w(e){return e>=.5*this.#y.length}}!function(e){e[e.singleMandatory=0]="singleMandatory",e[e.singleOptional=1]="singleOptional",e[e.multipleMandatory=2]="multipleMandatory",e[e.multipleOptional=3]="multipleOptional",e[e.length=4]="length"}(O||(O={}));class eL{#R;#S;#E;#T;#M;constructor(){this.#R=this.#x(),this.#S=this.#x(),this.#E=this.#x(),this.#T=this.#x(),this.#M=new eD}clearCache(){for(let e of this.#C())e.clear();for(let e of this.#M)e.clearCache()}get(e){var n,r,i,o,s,a;return void 0===e.name?void 0===e.tag?this.#I(this.#R,e).get(e.serviceIdentifier):null==(r=this.#I(this.#T,e).get(e.serviceIdentifier))||null==(n=r.get(e.tag.key))?void 0:n.get(e.tag.value):void 0===e.tag?null==(i=this.#I(this.#S,e).get(e.serviceIdentifier))?void 0:i.get(e.name):null==(a=this.#I(this.#E,e).get(e.serviceIdentifier))||null==(s=a.get(e.name))||null==(o=s.get(e.tag.key))?void 0:o.get(e.tag.value)}set(e,n){void 0===e.name?void 0===e.tag?this.#I(this.#R,e).set(e.serviceIdentifier,n):this.#j(this.#j(this.#I(this.#T,e),e.serviceIdentifier),e.tag.key).set(e.tag.value,n):void 0===e.tag?this.#j(this.#I(this.#S,e),e.serviceIdentifier).set(e.name,n):this.#j(this.#j(this.#j(this.#I(this.#E,e),e.serviceIdentifier),e.name),e.tag.key).set(e.tag.value,n)}subscribe(e){this.#M.push(e)}#x(){let e=Array(O.length);for(let n=0;n<e.length;++n)e[n]=new Map;return e}#j(e,n){let r=e.get(n);return void 0===r&&(r=new Map,e.set(n,r)),r}#I(e,n){return e[this.#A(n)]}#C(){return[...this.#R,...this.#S,...this.#E,...this.#T]}#A(e){return e.isMultiple?!0===e.optional?O.multipleOptional:O.multipleMandatory:!0===e.optional?O.singleOptional:O.singleMandatory}}function eF(e,n){return D(n)?(e.cache={isRight:!0,value:n},n.then(n=>eU(e,n))):eU(e,n)}function eU(e,n){return e.cache={isRight:!0,value:n},n}async function eH(e,n,r){let i=await n,o=r.next();for(;!0!==o.done;)i=await o.value(e.context,i),o=r.next();return i}function eq(e,n,r){let i=r;if(void 0!==n.onActivation){let r=n.onActivation;i=D(i)?i.then(n=>r(e.context,n)):r(e.context,i)}var o=n.serviceIdentifier,s=i;let a=e.getActivations(o);return void 0===a?s:D(s)?eH(e,s,a[Symbol.iterator]()):function(e,n,r){let i=n,o=r.next();for(;!0!==o.done;){let n=o.value(e.context,i);if(D(n))return eH(e,n,r);i=n,o=r.next()}return i}(e,s,a[Symbol.iterator]())}function eV(e){return(n,r)=>r.cache.isRight?r.cache.value:eF(r,eq(n,r,e(n,r)))}let eX=eV(function(e,n){return n.value});function eW(e,n){return(r,i)=>{let o=e(i);switch(o.scope){case $.Singleton:if(o.cache.isRight)return o.cache.value;return eF(o,eq(r,o,n(r,i)));case $.Request:{if(r.requestScopeCache.has(o.id))return r.requestScopeCache.get(o.id);let e=eq(r,o,n(r,i));return r.requestScopeCache.set(o.id,e),e}case $.Transient:return eq(r,o,n(r,i))}}}let e$=eW(function(e){return e},function(e,n){return n.value(e.context)}),ez=eV(function(e,n){return n.factory(e.context)});function eG(e,n,r){let i=function(e,n,r){if(void 0!==r){if(!(r in e))throw new es(v.resolution,`Expecting a "${r.toString()}" property when resolving "${n.implementationType.name}" class @postConstruct decorated method, none found.`);if("function"!=typeof e[r])throw new es(v.resolution,`Expecting a "${r.toString()}" method when resolving "${n.implementationType.name}" class @postConstruct decorated method, a non function property was found instead.`);{let i;try{i=e[r]()}catch(e){throw new es(v.resolution,`Unexpected error found when calling "${r.toString()}" @postConstruct decorated method on class "${n.implementationType.name}"`,{cause:e})}if(D(i))return async function(e,n,r){try{await r}catch(r){throw new es(v.resolution,`Unexpected error found when calling "${n.toString()}" @postConstruct decorated method on class "${e.implementationType.name}"`,{cause:r})}}(n,r,i)}}}(e,n,r);return D(i)?i.then(()=>e):e}function eY(e){return(n,r,i)=>{let o=new i.binding.implementationType(...n),s=e(r,o,i);return D(s)?s.then(()=>eG(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)):eG(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)}}let eQ=eV(function(e,n){return n.provider(e.context)}),eJ=(o=e6,(e,n,r)=>{let i=[];for(let[s,a]of r.propertyParams){let c=r.classMetadata.properties.get(s);if(void 0===c)throw new es(v.resolution,`Expecting metadata at property "${s.toString()}", none found`);c.kind!==b.unmanaged&&void 0!==a.bindings&&(n[s]=o(e,a),D(n[s])&&i.push((async()=>{n[s]=await n[s]})()))}if(i.length>0)return Promise.all(i).then(()=>{})}),eK=(s=e3,function e(n,r){let i=[];for(let o of r.redirections)ex(o)?i.push(...e(n,o)):i.push(s(n,o));return i}),eZ=(a=e6,l=(e,n)=>{let r=[];for(let i of n.constructorParams)void 0===i?r.push(void 0):r.push(a(e,i));return r.some(D)?Promise.all(r):r},c=eY(eJ),u=async(e,n,r)=>c(await e,n,r),d=eY(eJ),(e,n)=>{let r=l(e,n);return D(r)?u(r,e,n):d(r,e,n)}),e0=(p=e6,h=(e,n)=>{let r=[];for(let i of n.params)r.push(p(e,i));return r.some(D)?Promise.all(r):r},(e,n)=>{let r=h(e,n);return D(r)?r.then(e=>n.binding.factory(...e)):n.binding.factory(...r)}),e1=eW(function(e){return e.binding},eZ),e2=eW(function(e){return e.binding},e0);function e3(e,n){switch(n.binding.type){case z.ConstantValue:return eX(e,n.binding);case z.DynamicValue:return e$(e,n.binding);case z.Factory:return ez(e,n.binding);case z.Instance:return e1(e,n);case z.Provider:return eQ(e,n.binding);case z.ResolvedValue:return e2(e,n)}}function e6(e,n){if(void 0!==n.bindings)return Array.isArray(n.bindings)?function(e,n){let r=[];for(let i of n)ex(i)?r.push(...eK(e,i)):r.push(e3(e,i));return r.some(D)?Promise.all(r):r}(e,n.bindings):function(e,n){if(ex(n)){let r=eK(e,n);if(1===r.length)return r[0];throw new es(v.resolution,"Unexpected multiple resolved values on single injection")}return e3(e,n)}(e,n.bindings)}function e5(e,n){if(void 0!==e.lifecycle.preDestroyMethodName&&"function"==typeof n[e.lifecycle.preDestroyMethodName])return n[e.lifecycle.preDestroyMethodName]()}function e4(e,n,r){let i=e.getDeactivations(n);if(void 0!==i)return D(r)?e8(r,i[Symbol.iterator]()):function(e,n){let r=n.next();for(;!0!==r.done;){if(D(r.value(e)))return e8(e,n);r=n.next()}}(r,i[Symbol.iterator]())}async function e8(e,n){let r=await e,i=n.next();for(;!0!==i.done;)await i.value(r),i=n.next()}function e9(e,n){let r=n.cache;return D(r.value)?r.value.then(r=>e7(e,n,r)):e7(e,n,r.value)}function e7(e,n,r){let i;return void 0!==n.onDeactivation&&(i=(0,n.onDeactivation)(r)),void 0===i?e4(e,n.serviceIdentifier,r):i.then(()=>e4(e,n.serviceIdentifier,r))}function te(e,n){if(void 0===n)return;let r=function(e){let n=[];for(let r of e)void 0!==r.scope&&r.scope===$.Singleton&&r.cache.isRight&&n.push(r);return n}(n),i=[];for(let n of r){let r=function(e,n){let r=function(e,n){if(n.type===z.Instance){let r=e.getClassMetadata(n.implementationType),i=n.cache.value;return D(i)?i.then(e=>e5(r,e)):e5(r,i)}}(e,n);return void 0===r?e9(e,n):r.then(()=>e9(e,n))}(e,n);void 0!==r&&i.push(r)}return i.length>0?Promise.all(i).then(()=>{}):void 0}function tt(e,n){let r=e.getBindings(n);return te(e,r)}let tn=Symbol.for("@inversifyjs/plugin/isPlugin"),tr=Symbol.for("@inversifyjs/container/bindingIdentifier");function ti(e){return"object"==typeof e&&null!==e&&!0===e[tr]}class to{static #B=this.always=e=>!0}function ts(e){return{[tr]:!0,id:e.id}}function ta(e){return n=>{for(let r=n.getAncestor();void 0!==r;r=r.getAncestor())if(e(r))return!0;return!1}}function tc(e){return n=>n.name===e}function tl(e){return n=>n.serviceIdentifier===e}function tu(e,n){return r=>r.tags.has(e)&&r.tags.get(e)===n}function td(e){return void 0===e.name&&0===e.tags.size}function tp(e){let n=ta(e);return e=>!n(e)}function th(e){return n=>{let r=n.getAncestor();return void 0===r||!e(r)}}function tf(e){return n=>{let r=n.getAncestor();return void 0!==r&&e(r)}}class tm{#r;constructor(e){this.#r=e}getIdentifier(){return ts(this.#r)}inRequestScope(){return this.#r.scope=$.Request,new tb(this.#r)}inSingletonScope(){return this.#r.scope=$.Singleton,new tb(this.#r)}inTransientScope(){return this.#r.scope=$.Transient,new tb(this.#r)}}class tg{#t;#o;#s;#a;constructor(e,n,r,i){this.#t=e,this.#o=n,this.#s=r,this.#a=i}to(e){var n;let r=ea(e),i={cache:{isRight:!1,value:void 0},id:W(),implementationType:e,isSatisfiedBy:to.always,moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,scope:null!=(n=r.scope)?n:this.#s,serviceIdentifier:this.#a,type:z.Instance};return this.#t(i),new t_(i)}toSelf(){if("function"!=typeof this.#a)throw Error('"toSelf" function can only be applied when a newable function is used as service identifier');return this.to(this.#a)}toConstantValue(e){let n={cache:{isRight:!1,value:void 0},id:W(),isSatisfiedBy:to.always,moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,scope:$.Singleton,serviceIdentifier:this.#a,type:z.ConstantValue,value:e};return this.#t(n),new tb(n)}toDynamicValue(e){let n={cache:{isRight:!1,value:void 0},id:W(),isSatisfiedBy:to.always,moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,scope:this.#s,serviceIdentifier:this.#a,type:z.DynamicValue,value:e};return this.#t(n),new t_(n)}toResolvedValue(e,n){let r={cache:{isRight:!1,value:void 0},factory:e,id:W(),isSatisfiedBy:to.always,metadata:this.#i(n),moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,scope:this.#s,serviceIdentifier:this.#a,type:z.ResolvedValue};return this.#t(r),new t_(r)}toFactory(e){let n={cache:{isRight:!1,value:void 0},factory:e,id:W(),isSatisfiedBy:to.always,moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,scope:$.Singleton,serviceIdentifier:this.#a,type:z.Factory};return this.#t(n),new tb(n)}toProvider(e){let n={cache:{isRight:!1,value:void 0},id:W(),isSatisfiedBy:to.always,moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,provider:e,scope:$.Singleton,serviceIdentifier:this.#a,type:z.Provider};return this.#t(n),new tb(n)}toService(e){let n={id:W(),isSatisfiedBy:to.always,moduleId:this.#o,serviceIdentifier:this.#a,targetServiceIdentifier:e,type:z.ServiceRedirection};this.#t(n)}#i(e){return{arguments:(null!=e?e:[]).map(e=>{var n,r;return"object"!=typeof e||U.is(e)?{kind:w.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}:{kind:!0===e.isMultiple?w.multipleInjection:w.singleInjection,name:e.name,optional:null!=(n=e.optional)&&n,tags:new Map((null!=(r=e.tags)?r:[]).map(e=>[e.key,e.value])),value:e.serviceIdentifier}})}}}class tv{#r;constructor(e){this.#r=e}getIdentifier(){return ts(this.#r)}onActivation(e){return this.#r.onActivation=e,new ty(this.#r)}onDeactivation(e){return this.#r.onDeactivation=e,new ty(this.#r)}}class ty{#r;constructor(e){this.#r=e}getIdentifier(){return ts(this.#r)}when(e){return this.#r.isSatisfiedBy=e,new tv(this.#r)}whenAnyAncestor(e){return this.when(ta(e))}whenAnyAncestorIs(e){return this.when(ta(tl(e)))}whenAnyAncestorNamed(e){return this.when(ta(tc(e)))}whenAnyAncestorTagged(e,n){return this.when(ta(tu(e,n)))}whenDefault(){return this.when(td)}whenNamed(e){return this.when(tc(e))}whenNoParent(e){return this.when(th(e))}whenNoParentIs(e){return this.when(th(tl(e)))}whenNoParentNamed(e){return this.when(th(tc(e)))}whenNoParentTagged(e,n){return this.when(th(tu(e,n)))}whenParent(e){return this.when(tf(e))}whenParentIs(e){return this.when(tf(tl(e)))}whenParentNamed(e){return this.when(tf(tc(e)))}whenParentTagged(e,n){return this.when(tf(tu(e,n)))}whenTagged(e,n){return this.when(tu(e,n))}whenNoAncestor(e){return this.when(tp(e))}whenNoAncestorIs(e){return this.when(tp(tl(e)))}whenNoAncestorNamed(e){return this.when(tp(tc(e)))}whenNoAncestorTagged(e,n){return this.when(tp(tu(e,n)))}}class tb extends ty{#c;constructor(e){super(e),this.#c=new tv(e)}onActivation(e){return this.#c.onActivation(e)}onDeactivation(e){return this.#c.onDeactivation(e)}}class t_ extends tb{#u;constructor(e){super(e),this.#u=new tm(e)}inRequestScope(){return this.#u.inRequestScope()}inSingletonScope(){return this.#u.inSingletonScope()}inTransientScope(){return this.#u.inTransientScope()}}let tw=Symbol.for("@inversifyjs/container/InversifyContainerError");class tO extends Error{constructor(e,n,r){super(n,r),this[tw]=!0,this.kind=e}static is(e){return"object"==typeof e&&null!==e&&!0===e[tw]}static isErrorOfKind(e,n){return tO.is(e)&&e.kind===n}}!function(e){e[e.invalidOperation=0]="invalidOperation"}(R||(R={}));class tR{#d;#s;#l;constructor(e,n,r){this.#d=e,this.#s=n,this.#l=r}bind(e){return new tg(e=>{this.#m(e)},void 0,this.#s,e)}isBound(e,n){let r=this.#l.bindingService.get(e);return this.#v(e,r,n)}isCurrentBound(e,n){let r=this.#l.bindingService.getNonParentBindings(e);return this.#v(e,r,n)}async rebind(e){return await this.unbind(e),this.bind(e)}rebindSync(e){return this.unbindSync(e),this.bind(e)}async unbind(e){await this.#f(e)}async unbindAll(){let e=[...this.#l.bindingService.getNonParentBoundServices()];for(let n of(await Promise.all(e.map(async e=>tt(this.#d,e))),e))this.#l.activationService.removeAllByServiceId(n),this.#l.bindingService.removeAllByServiceId(n),this.#l.deactivationService.removeAllByServiceId(n);this.#l.planResultCacheService.clearCache()}unbindSync(e){void 0!==this.#f(e)&&this.#h(e)}#m(e){this.#l.bindingService.set(e),this.#l.planResultCacheService.clearCache()}#h(e){var n;let r;if(ti(e)){let i=this.#l.bindingService.getById(e.id),o=null==(n=function(e){if(void 0===e)return;let n=e.next();return!0!==n.done?n.value:void 0}(null==i?void 0:i[Symbol.iterator]()))?void 0:n.serviceIdentifier;r=void 0===o?"Unexpected asynchronous deactivation when unbinding binding identifier. Consider using Container.unbind() instead.":`Unexpected asynchronous deactivation when unbinding "${L(o)}" binding. Consider using Container.unbind() instead.`}else r=`Unexpected asynchronous deactivation when unbinding "${L(e)}" service. Consider using Container.unbind() instead.`;throw new tO(R.invalidOperation,r)}#f(e){return ti(e)?this.#O(e):this.#p(e)}#O(e){let n=this.#l.bindingService.getById(e.id),r=te(this.#d,n);if(void 0!==r)return r.then(()=>{this.#R(e)});this.#R(e)}#R(e){this.#l.bindingService.removeById(e.id),this.#l.planResultCacheService.clearCache()}#p(e){let n=tt(this.#d,e);if(void 0!==n)return n.then(()=>{this.#b(e)});this.#b(e)}#b(e){this.#l.activationService.removeAllByServiceId(e),this.#l.bindingService.removeAllByServiceId(e),this.#l.deactivationService.removeAllByServiceId(e),this.#l.planResultCacheService.clearCache()}#v(e,n,r){if(void 0===n)return!1;let i={getAncestor:()=>{},name:null==r?void 0:r.name,serviceIdentifier:e,tags:new Map};for(let e of(void 0!==(null==r?void 0:r.tag)&&i.tags.set(r.tag.key,r.tag.value),n))if(e.isSatisfiedBy(i))return!0;return!1}}class tS{#y;#d;#s;#l;constructor(e,n,r,i){this.#y=e,this.#d=n,this.#s=r,this.#l=i}async load(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];await Promise.all(this.#n(...n))}loadSync(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];for(let e of this.#n(...n))if(void 0!==e)throw new tO(R.invalidOperation,"Unexpected asynchronous module load. Consider using Container.load() instead.")}async unload(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];await Promise.all(this.#E(...n)),this.#w(n)}unloadSync(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];for(let e of this.#E(...n))if(void 0!==e)throw new tO(R.invalidOperation,"Unexpected asynchronous module unload. Consider using Container.unload() instead.");this.#w(n)}#g(e){return{bind:n=>new tg(e=>{this.#m(e)},e,this.#s,n),isBound:this.#y.isBound.bind(this.#y),onActivation:(n,r)=>{this.#l.activationService.add(r,{moduleId:e,serviceId:n})},onDeactivation:(n,r)=>{this.#l.deactivationService.add(r,{moduleId:e,serviceId:n})},rebind:this.#y.rebind.bind(this.#y),rebindSync:this.#y.rebindSync.bind(this.#y),unbind:this.#y.unbind.bind(this.#y),unbindSync:this.#y.unbindSync.bind(this.#y)}}#w(e){for(let n of e)this.#l.activationService.removeAllByModuleId(n.id),this.#l.bindingService.removeAllByModuleId(n.id),this.#l.deactivationService.removeAllByModuleId(n.id);this.#l.planResultCacheService.clearCache()}#n(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return n.map(e=>e.load(this.#g(e.id)))}#m(e){this.#l.bindingService.set(e),this.#l.planResultCacheService.clearCache()}#E(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return n.map(e=>(function(e,n){let r=e.getBindingsFromModule(n);return te(e,r)})(this.#d,e.id))}}class tE{#_;#M;#k;#l;constructor(e,n,r){this.#l=n,this.#k=r,this.#_=this.#x(e),this.#M=this.#C()}register(e,n){let r=new n(e,this.#M);if(!0!==r[tn])throw new tO(R.invalidOperation,"Invalid plugin. The plugin must extend the Plugin class");r.load(this.#_)}#x(e){return{define:(n,r)=>{if(Object.prototype.hasOwnProperty.call(e,n))throw new tO(R.invalidOperation,`Container already has a method named "${String(n)}"`);e[n]=r},onPlan:this.#k.onPlan.bind(this.#k)}}#C(){let e=this.#l;return{get activationService(){return e.activationService},get bindingService(){return e.bindingService},get deactivationService(){return e.deactivationService},get planResultCacheService(){return e.planResultCacheService}}}}class tT{#j;constructor(e,n,r,i){this.activationService=e,this.bindingService=n,this.deactivationService=r,this.planResultCacheService=i,this.#j=[]}reset(e,n,r){for(let i of(this.activationService=e,this.bindingService=n,this.deactivationService=r,this.planResultCacheService.clearCache(),this.#j))i()}onReset(e){this.#j.push(e)}}class tM{#P;#s;#N;#D;#L;#F;#l;#S;constructor(e,n,r){this.#l=e,this.#L=this.#A(),this.#P=n,this.#s=r,this.#N=e=>this.#l.activationService.get(e),this.#D=this.#l.bindingService.get.bind(this.#l.bindingService),this.#F=[],this.#S=this.#m.bind(this),this.#l.onReset(()=>{this.#T()})}get(e,n){let r=this.#U(!1,e,n),i=this.#H(r);if(D(i))throw new tO(R.invalidOperation,`Unexpected asynchronous service when resolving service "${L(e)}"`);return i}getAll(e,n){let r=this.#U(!0,e,n),i=this.#H(r);if(D(i))throw new tO(R.invalidOperation,`Unexpected asynchronous service when resolving service "${L(e)}"`);return i}async getAllAsync(e,n){let r=this.#U(!0,e,n);return this.#H(r)}async getAsync(e,n){let r=this.#U(!1,e,n);return this.#H(r)}onPlan(e){this.#F.push(e)}#T(){this.#D=this.#l.bindingService.get.bind(this.#l.bindingService),this.#S=this.#m.bind(this),this.#L=this.#A()}#q(e,n,r){return{isMultiple:e,name:null==r?void 0:r.name,optional:null==r?void 0:r.optional,serviceIdentifier:n,tag:null==r?void 0:r.tag}}#V(e,n,r){var i;let o={autobindOptions:(null!=(i=null==r?void 0:r.autobind)?i:this.#P)?{scope:this.#s}:void 0,getBindings:this.#D,getClassMetadata:ea,rootConstraints:{isMultiple:n,serviceIdentifier:e},servicesBranch:[],setBinding:this.#S};return this.#I(o,r),o}#U(e,n,r){let i=this.#q(e,n,r),o=this.#l.planResultCacheService.get(i);if(void 0!==o)return o;let s=function(e){try{let r=new Map;void 0!==e.rootConstraints.tag&&r.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value);let i=new eT({elem:{name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:r},previous:void 0}),o=new eE(i.last),s=eM(e,o),a=[],c={bindings:a,parent:void 0,serviceIdentifier:e.rootConstraints.serviceIdentifier};if(a.push(...eP(e,i,s,c)),!e.rootConstraints.isMultiple){var n;eB(c,null!=(n=e.rootConstraints.isOptional)&&n,o);let[r]=a;c.bindings=r}return{tree:{root:c}}}catch(n){if(n instanceof Error&&(n instanceof RangeError&&/stack space|call stack|too much recursion/i.test(n.message)||"InternalError"===n.name&&/too much recursion/.test(n.message))){let r=function(e){let n=[...e];return 0===n.length?"(No dependency trace)":n.map(L).join(" -> ")}(function(e){let n=new Set;for(let r of e.servicesBranch){if(n.has(r))return[...n,r];n.add(r)}return[...n]}(e));throw new es(v.planning,`Circular dependency found: ${r}`,{cause:n})}throw n}}(this.#V(n,e,r));for(let e of(this.#l.planResultCacheService.set(i,s),this.#F))e(i,s);return s}#A(){return{get:this.get.bind(this),getAll:this.getAll.bind(this),getAllAsync:this.getAllAsync.bind(this),getAsync:this.getAsync.bind(this)}}#H(e){var n;return e6(n={context:this.#L,getActivations:this.#N,planResult:e,requestScopeCache:new Map},n.planResult.tree.root)}#I(e,n){void 0!==n&&(void 0!==n.name&&(e.rootConstraints.name=n.name),!0===n.optional&&(e.rootConstraints.isOptional=!0),void 0!==n.tag&&(e.rootConstraints.tag={key:n.tag.key,value:n.tag.value}))}#m(e){this.#l.bindingService.set(e),this.#l.planResultCacheService.clearCache()}}class tx{#l;#X;constructor(e){this.#l=e,this.#X=[]}restore(){let e=this.#X.pop();if(void 0===e)throw new tO(R.invalidOperation,"No snapshot available to restore");this.#l.reset(e.activationService,e.bindingService,e.deactivationService)}snapshot(){this.#X.push({activationService:this.#l.activationService.clone(),bindingService:this.#l.bindingService.clone(),deactivationService:this.#l.deactivationService.clone()})}}let tC=$.Transient;class tI{#y;#W;#B;#l;#k;#$;constructor(e){var n,r,i;this.#l=this.#z(e);let o=null!=(n=null==e?void 0:e.autobind)&&n,s=null!=(r=null==e?void 0:e.defaultScope)?r:tC,a={getBindings:(i=this.#l).bindingService.get.bind(i.bindingService),getBindingsFromModule:i.bindingService.getByModuleId.bind(i.bindingService),getClassMetadata:ea,getDeactivations:i.deactivationService.get.bind(i.deactivationService)};this.#y=new tR(a,s,this.#l),this.#W=new tS(this.#y,a,s,this.#l),this.#k=new tM(this.#l,o,s),this.#B=new tE(this,this.#l,this.#k),this.#$=new tx(this.#l)}bind(e){return this.#y.bind(e)}get(e,n){return this.#k.get(e,n)}getAll(e,n){return this.#k.getAll(e,n)}async getAllAsync(e,n){return this.#k.getAllAsync(e,n)}async getAsync(e,n){return this.#k.getAsync(e,n)}isBound(e,n){return this.#y.isBound(e,n)}isCurrentBound(e,n){return this.#y.isCurrentBound(e,n)}async load(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.#W.load(...n)}loadSync(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];this.#W.loadSync(...n)}onActivation(e,n){this.#l.activationService.add(n,{serviceId:e})}onDeactivation(e,n){this.#l.deactivationService.add(n,{serviceId:e})}register(e){this.#B.register(this,e)}restore(){this.#$.restore()}async rebind(e){return this.#y.rebind(e)}rebindSync(e){return this.#y.rebindSync(e)}snapshot(){this.#$.snapshot()}async unbind(e){await this.#y.unbind(e)}async unbindAll(){return this.#y.unbindAll()}unbindSync(e){this.#y.unbindSync(e)}async unload(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.#W.unload(...n)}unloadSync(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];this.#W.unloadSync(...n)}#z(e){if(void 0===(null==e?void 0:e.parent))return new tT(Q.build(void 0),Z.build(void 0),ee.build(void 0),new eL);let n=new eL;return e.parent.#l.planResultCacheService.subscribe(n),new tT(Q.build(e.parent.#l.activationService),Z.build(e.parent.#l.bindingService),ee.build(e.parent.#l.deactivationService),n)}}let tj=new WeakMap,tA=new WeakMap,tB=new WeakMap,tk=Symbol("anyProducer"),tP=Promise.resolve(),tN=Symbol("listenerAdded"),tD=Symbol("listenerRemoved"),tL=!1,tF=!1,tU=e=>"string"==typeof e||"symbol"==typeof e||"number"==typeof e;function tH(e){if(!tU(e))throw TypeError("`eventName` must be a string, symbol, or number")}function tq(e){if("function"!=typeof e)throw TypeError("listener must be a function")}function tV(e,n){let r=tA.get(e);if(r.has(n))return r.get(n)}function tX(e,n){let r=tU(n)?n:tk,i=tB.get(e);if(i.has(r))return i.get(r)}function tW(e,n){n=Array.isArray(n)?n:[n];let r=!1,i=()=>{},o=[],s={enqueue(e){o.push(e),i()},finish(){r=!0,i()}};for(let r of n){let n=tX(e,r);n||(n=new Set,tB.get(e).set(r,n)),n.add(s)}return{async next(){return o?0===o.length?(r?o=void 0:await new Promise(e=>{i=e}),this.next()):{done:!1,value:await o.shift()}:{done:!0}},async return(r){for(let r of(o=void 0,n)){let n=tX(e,r);n&&(n.delete(s),0===n.size&&tB.get(e).delete(r))}return i(),arguments.length>0?{done:!0,value:await r}:{done:!0}},[Symbol.asyncIterator](){return this}}}function t$(e){if(void 0===e)return tQ;if(!Array.isArray(e))throw TypeError("`methodNames` must be an array of strings");for(let n of e)if(!tQ.includes(n)){if("string"!=typeof n)throw TypeError("`methodNames` element must be a string");throw Error(`${n} is not Emittery method`)}return e}let tz=e=>e===tN||e===tD;function tG(e,n,r){if(tz(n))try{tL=!0,e.emit(n,r)}finally{tL=!1}}class tY{static mixin(e,n){return n=t$(n),r=>{if("function"!=typeof r)throw TypeError("`target` must be function");for(let e of n)if(void 0!==r.prototype[e])throw Error(`The property \`${e}\` already exists on \`target\``);Object.defineProperty(r.prototype,e,{enumerable:!1,get:function(){return Object.defineProperty(this,e,{enumerable:!1,value:new tY}),this[e]}});let i=n=>function(){for(var r=arguments.length,i=Array(r),o=0;o<r;o++)i[o]=arguments[o];return this[e][n](...i)};for(let e of n)Object.defineProperty(r.prototype,e,{enumerable:!1,value:i(e)});return r}}static get isDebugEnabled(){var e,n;if("object"!=typeof(null==(e=globalThis.process)?void 0:e.env))return tF;let{env:r}=null!=(n=globalThis.process)?n:{env:{}};return"emittery"===r.DEBUG||"*"===r.DEBUG||tF}static set isDebugEnabled(e){tF=e}constructor(e={}){var n;tj.set(this,new Set),tA.set(this,new Map),tB.set(this,new Map),tB.get(this).set(tk,new Set),this.debug=null!=(n=e.debug)?n:{},void 0===this.debug.enabled&&(this.debug.enabled=!1),this.debug.logger||(this.debug.logger=(e,n,r,i)=>{try{i=JSON.stringify(i)}catch{i=`Object with the following keys failed to stringify: ${Object.keys(i).join(",")}`}("symbol"==typeof r||"number"==typeof r)&&(r=r.toString());let o=new Date,s=`${o.getHours()}:${o.getMinutes()}:${o.getSeconds()}.${o.getMilliseconds()}`;console.log(`[${s}][emittery:${e}][${n}] Event Name: ${r}
|
|
44
|
-
data: ${i}`)})}logIfDebugEnabled(e,n,r){(tY.isDebugEnabled||this.debug.enabled)&&this.debug.logger(e,this.debug.name,n,r)}on(e,n){let{signal:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(let r of(tq(n),e=Array.isArray(e)?e:[e])){tH(r);let e=tV(this,r);e||(e=new Set,tA.get(this).set(r,e)),e.add(n),this.logIfDebugEnabled("subscribe",r,void 0),tz(r)||tG(this,tN,{eventName:r,listener:n})}let i=()=>{this.off(e,n),null==r||r.removeEventListener("abort",i)};return null==r||r.addEventListener("abort",i,{once:!0}),(null==r?void 0:r.aborted)&&i(),i}off(e,n){for(let r of(tq(n),e=Array.isArray(e)?e:[e])){tH(r);let e=tV(this,r);e&&(e.delete(n),0===e.size&&tA.get(this).delete(r)),this.logIfDebugEnabled("unsubscribe",r,void 0),tz(r)||tG(this,tD,{eventName:r,listener:n})}}once(e,n){let r;if(void 0!==n&&"function"!=typeof n)throw TypeError("predicate must be a function");let i=new Promise(i=>{r=this.on(e,e=>{(!n||n(e))&&(r(),i(e))})});return i.off=r,i}events(e){for(let n of e=Array.isArray(e)?e:[e])tH(n);return tW(this,e)}async emit(e,n){var r;if(tH(e),tz(e)&&!tL)throw TypeError("`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`");this.logIfDebugEnabled("emit",e,n);let i=tB.get(this);if(i.has(e))for(let r of i.get(e))r.enqueue(n);if(i.has(tk)){let r=Promise.all([e,n]);for(let e of i.get(tk))e.enqueue(r)}let o=null!=(r=tV(this,e))?r:new Set,s=tj.get(this),a=[...o],c=tz(e)?[]:[...s];await tP,await Promise.all([...a.map(async e=>{if(o.has(e))return e(n)}),...c.map(async r=>{if(s.has(r))return r(e,n)})])}async emitSerial(e,n){var r;if(tH(e),tz(e)&&!tL)throw TypeError("`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`");this.logIfDebugEnabled("emitSerial",e,n);let i=null!=(r=tV(this,e))?r:new Set,o=tj.get(this),s=[...i],a=[...o];for(let e of(await tP,s))i.has(e)&&await e(n);for(let r of a)o.has(r)&&await r(e,n)}onAny(e){let{signal:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};tq(e),this.logIfDebugEnabled("subscribeAny",void 0,void 0),tj.get(this).add(e),tG(this,tN,{listener:e});let r=()=>{this.offAny(e),null==n||n.removeEventListener("abort",r)};return null==n||n.addEventListener("abort",r,{once:!0}),(null==n?void 0:n.aborted)&&r(),r}anyEvent(){return tW(this)}offAny(e){tq(e),this.logIfDebugEnabled("unsubscribeAny",void 0,void 0),tG(this,tD,{listener:e}),tj.get(this).delete(e)}clearListeners(e){for(let n of e=Array.isArray(e)?e:[e])if(this.logIfDebugEnabled("clear",n,void 0),tU(n)){let e=tV(this,n);e&&e.clear();let r=tX(this,n);if(r){for(let e of r)e.finish();r.clear()}}else{for(let[e,n]of(tj.get(this).clear(),tA.get(this).entries()))n.clear(),tA.get(this).delete(e);for(let[e,n]of tB.get(this).entries()){for(let e of n)e.finish();n.clear(),tB.get(this).delete(e)}}}listenerCount(e){e=Array.isArray(e)?e:[e];let n=0;for(let l of e){if(tU(l)){var r,i,o,s,a,c;n+=tj.get(this).size+(null!=(s=null==(r=tV(this,l))?void 0:r.size)?s:0)+(null!=(a=null==(i=tX(this,l))?void 0:i.size)?a:0)+(null!=(c=null==(o=tX(this))?void 0:o.size)?c:0);continue}for(let e of(void 0!==l&&tH(l),n+=tj.get(this).size,tA.get(this).values()))n+=e.size;for(let e of tB.get(this).values())n+=e.size}return n}bindMethods(e,n){if("object"!=typeof e||null===e)throw TypeError("`target` must be an object");for(let r of n=t$(n)){if(void 0!==e[r])throw Error(`The property \`${r}\` already exists on \`target\``);Object.defineProperty(e,r,{enumerable:!1,value:this[r].bind(this)})}}}let tQ=Object.getOwnPropertyNames(tY.prototype).filter(e=>"constructor"!==e);Object.defineProperty(tY,"listenerAdded",{value:tN,writable:!1,enumerable:!0,configurable:!1}),Object.defineProperty(tY,"listenerRemoved",{value:tD,writable:!1,enumerable:!0,configurable:!1});let tJ={AaaSPilotKitController:Symbol.for("AaaSPilotKitController"),SignalingService:Symbol.for("SignalingService"),ASRService:Symbol.for("ASRService"),AgentService:Symbol.for("AgentService"),DigitalHumanService:Symbol.for("DigitalHumanService"),ConversationService:Symbol.for("ConversationService"),CommonRequest:Symbol.for("CommonRequest"),ErrorManager:Symbol.for("ErrorManager"),IOptions:Symbol.for("IOptions")};class tK extends Error{constructor(e,n,r){let i=e.status||0===e.status?e.status:"",o=e.statusText||"",s=`${i} ${o}`.trim();super(`Request failed with ${s?`status code ${s}`:"an unknown error"}: ${n.method} ${n.url}`),this.name="HTTPError",this.response=e,this.request=n,this.options=r}}class tZ extends Error{constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}}r("../../node_modules/core-js/modules/es.typed-array.set.js");let t0=(()=>{let e=!1,n=!1,r="function"==typeof globalThis.Request;if("function"==typeof globalThis.ReadableStream&&r)try{n=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(e){if(e instanceof Error&&"unsupported BodyInit type"===e.message)return!1;throw e}return e&&!n})(),t1="function"==typeof globalThis.AbortController,t2="function"==typeof globalThis.ReadableStream,t3="function"==typeof globalThis.FormData,t6=["get","post","put","patch","head","delete"],t5={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},t4=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,t8=Symbol("stop"),t9={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},t7={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0},ne=e=>{if(!e)return 0;if(e instanceof FormData){let n=0;for(let[r,i]of e)n+=t4,n+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,n+="string"==typeof i?new TextEncoder().encode(i).length:i.size;return n}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if("string"==typeof e)return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if("object"==typeof e&&null!==e)try{let n=JSON.stringify(e);return new TextEncoder().encode(n).length}catch{}return 0},nt=(e,n)=>{let r=Number(e.headers.get("content-length"))||0,i=0;return 204===e.status?(n&&n({percent:1,totalBytes:r,transferredBytes:i},new Uint8Array),new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new Response(new ReadableStream({async start(o){let s=e.body.getReader();async function a(){let{done:e,value:c}=await s.read();if(e)return void o.close();n&&(i+=c.byteLength,n({percent:0===r?0:i/r,transferredBytes:i,totalBytes:r},c)),o.enqueue(c),await a()}n&&n({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array),await a()}}),{status:e.status,statusText:e.statusText,headers:e.headers})},nn=(e,n)=>{let r=ne(e.body),i=0;return new Request(e,{duplex:"half",body:new ReadableStream({async start(o){let s=e.body instanceof ReadableStream?e.body.getReader():new Response("").body.getReader();async function a(){let{done:e,value:c}=await s.read();if(e){n&&n({percent:1,transferredBytes:i,totalBytes:Math.max(r,i)},new Uint8Array),o.close();return}i+=c.byteLength;let l=0===r?0:i/r;(r<i||1===l)&&(l=.99),n&&n({percent:Number(l.toFixed(2)),transferredBytes:i,totalBytes:r},c),o.enqueue(c),await a()}await a()}})})},nr=e=>null!==e&&"object"==typeof e,ni=function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];for(let e of n)if((!nr(e)||Array.isArray(e))&&void 0!==e)throw TypeError("The `options` argument must be an object");return nc({},...n)},no=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new globalThis.Headers(e),i=n instanceof globalThis.Headers;for(let[e,o]of new globalThis.Headers(n).entries())i&&"undefined"===o||void 0===o?r.delete(e):r.set(e,o);return r};function ns(e,n,r){var i,o;return Object.hasOwn(n,r)&&void 0===n[r]?[]:nc(null!=(i=e[r])?i:[],null!=(o=n[r])?o:[])}let na=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{beforeRequest:ns(e,n,"beforeRequest"),beforeRetry:ns(e,n,"beforeRetry"),afterResponse:ns(e,n,"afterResponse"),beforeError:ns(e,n,"beforeError")}},nc=function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];let i={},o={},s={};for(let e of n)if(Array.isArray(e))Array.isArray(i)||(i=[]),i=[...i,...e];else if(nr(e)){for(let[n,r]of Object.entries(e))nr(r)&&n in i&&(r=nc(i[n],r)),i={...i,[n]:r};nr(e.hooks)&&(s=na(s,e.hooks),i.hooks=s),nr(e.headers)&&(o=no(o,e.headers),i.headers=o)}return i},nl=e=>t6.includes(e)?e.toUpperCase():e,nu={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},nd=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("number"==typeof e)return{...nu,limit:e};if(e.methods&&!Array.isArray(e.methods))throw Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw Error("retry.statusCodes must be an array");return{...nu,...e}};async function np(e,n,r,i){return new Promise((o,s)=>{let a=setTimeout(()=>{r&&r.abort(),s(new tZ(e))},i.timeout);i.fetch(e,n).then(o).catch(s).then(()=>{clearTimeout(a)})})}async function nh(e,n){let{signal:r}=n;return new Promise((n,i)=>{function o(){clearTimeout(s),i(r.reason)}r&&(r.throwIfAborted(),r.addEventListener("abort",o,{once:!0}));let s=setTimeout(()=>{null==r||r.removeEventListener("abort",o),n()},e)})}let nf=(e,n)=>{let r={};for(let i in n)i in t7||i in t9||i in e||(r[i]=n[i]);return r};class nm{static create(e,n){let r=new nm(e,n),i=async()=>{if("number"==typeof r._options.timeout&&r._options.timeout>0x7fffffff)throw RangeError("The `timeout` option cannot be greater than 2147483647");await Promise.resolve();let e=await r._fetch();for(let n of r._options.hooks.afterResponse){let i=await n(r.request,r._options,r._decorateResponse(e.clone()));i instanceof globalThis.Response&&(e=i)}if(r._decorateResponse(e),!e.ok&&r._options.throwHttpErrors){let n=new tK(e,r.request,r._options);for(let e of r._options.hooks.beforeError)n=await e(n);throw n}if(r._options.onDownloadProgress){if("function"!=typeof r._options.onDownloadProgress)throw TypeError("The `onDownloadProgress` option must be a function");if(!t2)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");return nt(e.clone(),r._options.onDownloadProgress)}return e},o=(r._options.retry.methods.includes(r.request.method.toLowerCase())?r._retry(i):i()).finally(async()=>{if(!r.request.bodyUsed){var e;await (null==(e=r.request.body)?void 0:e.cancel())}});for(let[e,i]of Object.entries(t5))o[e]=async()=>{r.request.headers.set("accept",r.request.headers.get("accept")||i);let s=await o;if("json"===e){if(204===s.status||0===(await s.clone().arrayBuffer()).byteLength)return"";if(n.parseJson)return n.parseJson(await s.text())}return s[e]()};return o}constructor(e,n={}){var r,i,o,s,a,c,l,u,d;if(this._retryCount=0,this._input=e,this._options={...n,headers:no(this._input.headers,n.headers),hooks:na({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},n.hooks),method:nl(null!=(i=null!=(r=n.method)?r:this._input.method)?i:"GET"),prefixUrl:String(n.prefixUrl||""),retry:nd(n.retry),throwHttpErrors:!1!==n.throwHttpErrors,timeout:null!=(o=n.timeout)?o:1e4,fetch:null!=(s=n.fetch)?s:globalThis.fetch.bind(globalThis)},"string"!=typeof this._input&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&"string"==typeof this._input){if(this._input.startsWith("/"))throw Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(t1){let e=null!=(a=this._options.signal)?a:this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=e?AbortSignal.any([e,this.abortController.signal]):this.abortController.signal}if(t0&&(this._options.duplex="half"),void 0!==this._options.json&&(this._options.body=null!=(u=null==(c=(l=this._options).stringifyJson)?void 0:c.call(l,this._options.json))?u:JSON.stringify(this._options.json),this._options.headers.set("content-type",null!=(d=this._options.headers.get("content-type"))?d:"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let e="string"==typeof this._options.searchParams?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString(),n=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,"?"+e);(t3&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(n,{...this.request}),this._options)}if(this._options.onUploadProgress){if("function"!=typeof this._options.onUploadProgress)throw TypeError("The `onUploadProgress` option must be a function");if(!t0)throw Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=nn(this.request,this._options.onUploadProgress))}}_calculateRetryDelay(e){if(this._retryCount++,this._retryCount>this._options.retry.limit||e instanceof tZ)throw e;if(e instanceof tK){var n,r,i,o;if(!this._options.retry.statusCodes.includes(e.response.status))throw e;let s=null!=(i=null!=(r=null!=(n=e.response.headers.get("Retry-After"))?n:e.response.headers.get("RateLimit-Reset"))?r:e.response.headers.get("X-RateLimit-Reset"))?i:e.response.headers.get("X-Rate-Limit-Reset");if(s&&this._options.retry.afterStatusCodes.includes(e.response.status)){let e=1e3*Number(s);Number.isNaN(e)?e=Date.parse(s)-Date.now():e>=Date.parse("2024-01-01")&&(e-=Date.now());let n=null!=(o=this._options.retry.maxRetryAfter)?o:e;return e<n?e:n}if(413===e.response.status)throw e}let s=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,s)}_decorateResponse(e){return this._options.parseJson&&(e.json=async()=>this._options.parseJson(await e.text())),e}async _retry(e){try{return await e()}catch(r){let n=Math.min(this._calculateRetryDelay(r),0x7fffffff);if(this._retryCount<1)throw r;for(let e of(await nh(n,{signal:this._options.signal}),this._options.hooks.beforeRetry))if(await e({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===t8)return;return this._retry(e)}}async _fetch(){for(let e of this._options.hooks.beforeRequest){let n=await e(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let e=nf(this.request,this._options),n=this.request;return(this.request=n.clone(),!1===this._options.timeout)?this._options.fetch(n,e):np(n,e,this.abortController,this._options)}}let ng=e=>{let n=(n,r)=>nm.create(n,ni(e,r));for(let r of t6)n[r]=(n,i)=>nm.create(n,ni(e,i,{method:r}));return n.create=e=>ng(ni(e)),n.extend=n=>("function"==typeof n&&(n=n(null!=e?e:{})),ng(ni(e,n))),n.stop=t8,n},nv=ng();function ny(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function nb(e,n){return function(r,i){n(r,i,e)}}class n_{static #B=this.ONLINE_HOST="https://ky.cloud.baidu.com";static #G=this.SANDBOX_HOST="https://ky-test.cloud.baidu.com";constructor(e){this.opts=e,"production"===this.opts.env?this.client=nv.create({prefixUrl:n_.ONLINE_HOST}):this.client=nv.create({prefixUrl:n_.SANDBOX_HOST})}}n_=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eb(),nb(0,eg(tJ.IOptions)),nb(0,eR()),ny("design:type",Function),ny("design:paramtypes",["undefined"==typeof IResolvedOptions?Object:IResolvedOptions])],n_);var nw=function(e){return e.NETWORK="NETWORK",e.TIMEOUT="TIMEOUT",e.AUTHENTICATION="AUTHENTICATION",e.AUTHORIZATION="AUTHORIZATION",e.RESOURCE="RESOURCE",e.CONFIGURATION="CONFIGURATION",e.PARSING="PARSING",e.SERVICE="SERVICE",e.VALIDATION="VALIDATION",e.INTERNAL="INTERNAL",e}({}),nO=function(e){return e.LOW="LOW",e.MEDIUM="MEDIUM",e.HIGH="HIGH",e.CRITICAL="CRITICAL",e}({});class nR extends Error{constructor(e,n,r,i=nO.MEDIUM,o={},s){super(n),this.name=this.constructor.name,this.code=e,this.category=r,this.severity=i,this.actionRequired=s,this.metadata={timestamp:Date.now(),stack:this.stack,...o},Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error(n).stack}static fromError(e,n,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:nO.MEDIUM;return new nR(n,e.message,r,i,{originalError:e,stack:e.stack})}toJSON(){return{code:this.code,message:this.message,category:this.category,severity:this.severity,metadata:this.metadata,actionRequired:this.actionRequired}}toString(){return`${this.name} [${this.code}]: ${this.message}`}}let nS={AGENT_QUERY_FAILED:"2001",AGENT_RESPONSE_PARSE_ERROR:"2002",AGENT_CONNECTION_FAILED:"2005",AGENT_INSTRUCTION_INVALID:"2006",ASR_INITIALIZATION_FAILED:"3001",ASR_STOP_FAILED:"3003",ASR_PERMISSION_DENIED:"3008",ASR_MESSAGE_PARSE_ERROR:"3010",ASR_MESSAGE_INTERVAL_TIMEOUT:"3013",ASR_RUNTIME_ERROR:"3014",DH_MOUNT_FAILED:"4001",DH_IFRAME_LOAD_ERROR:"4002",DH_RENDER_ERROR:"4003",DH_WEBSOCKET_ERROR:"4004",DH_RTC_ERROR:"4005",DH_AUTHENTICATION_ERROR:"4006",DH_RESOURCE_NOT_ENOUGH:"4008"},nE={1e3:"发生未知错误",1001:"网络连接错误",1002:"请求超时",1003:"配置无效",1004:"身份验证失败",1005:"权限验证失败",1006:"数据验证失败",1007:"资源未找到",1008:"资源不可用",1009:"内部错误",2001:"Agent查询失败",2002:"Agent响应解析错误",2003:"Agent请求超时",2004:"Agent响应无效",2005:"Agent连接失败",2006:"Agent指令无效",3001:"ASR初始化失败",3002:"ASR启动失败",3003:"ASR停止失败",3004:"ASR信令错误",3005:"ASR音频捕获错误",3006:"ASR识别错误",3007:"ASR网络错误",3008:"ASR权限被拒绝",3009:"ASR设备未找到",3010:"ASR消息解析错误",3011:"ASR会话无效",3012:"ASR静音失败",3013:"ASR消息间隔超时",3014:"ASR运行时错误",4001:"数字人挂载失败",4002:"数字人iframe加载错误",4003:"数字人渲染错误",4004:"数字人WebSocket错误",4005:"数字人RTC错误",4006:"数字人认证错误",4007:"数字人会话数量达到上限",4008:"数字人资源不足",4009:"数字人超时",4010:"数字人中断失败",4011:"数字人SSML解析错误",4012:"数字人形象ID无效",4013:"数字人token无效",4014:"数字人流式渲染错误",4015:"数字人控制器未就绪",4016:"数字人播报文本长度不匹配",5001:"会话创建失败",5002:"会话类型无效",5003:"会话快照无效",5004:"会话Bean未找到",5005:"会话序列化错误",5006:"会话反序列化错误",5007:"会话状态无效",5008:"会话清除失败"};class nT extends nR{constructor(e,n,r=nO.MEDIUM,i={},o){super(e,n||nE[e]||"Agent服务错误",nw.SERVICE,r,i,o)}}class nM extends nT{constructor(e,n={}){super(nS.AGENT_QUERY_FAILED,e,nO.HIGH,n)}}class nx extends nT{constructor(e,n={}){super(nS.AGENT_RESPONSE_PARSE_ERROR,e,nO.HIGH,n)}}class nC extends nT{constructor(e,n={}){super(nS.AGENT_CONNECTION_FAILED,e,nO.HIGH,n)}}class nI extends nT{constructor(e,n={}){super(nS.AGENT_INSTRUCTION_INVALID,e,nO.MEDIUM,n)}}var nj=r("../../node_modules/ua-parser-js/src/ua-parser.js"),nA=r.n(nj);let nB=()=>{let e=new(nA()),n=e.getBrowser(),r=e.getOS(),i=e.getDevice();return{userAgent:e.getUA(),browser:{name:n.name,version:n.version},os:{name:r.name,version:r.version},device:{type:i.type,vendor:i.vendor,model:i.model}}},nk=()=>{let e=new(nA()),n=e.getUA();return"WeChat"===e.getBrowser().name||/MicroMessenger/i.test(n)},nP=()=>"iOS"===new(nA())().getOS().name,nN=()=>{let e=new(nA()),n=e.getOS(),r=e.getDevice();return"Mac OS"===n.name&&"tablet"===r.type};class nD extends nR{constructor(e,n,r=nO.MEDIUM,i={}){super(e,n||nE[e]||"ASR服务错误",nw.SERVICE,r,i)}}class nL extends nD{constructor(e,n={}){super(nS.ASR_INITIALIZATION_FAILED,e,nO.HIGH,n)}}class nF extends nD{constructor(e,n={}){super(nS.ASR_STOP_FAILED,e,nO.MEDIUM,n)}}class nU extends nD{constructor(e,n={}){super(nS.ASR_PERMISSION_DENIED,e,nO.MEDIUM,{...n,context:{...n.context,browserInfo:nB()}})}}class nH extends nD{constructor(e,n={}){super(nS.ASR_MESSAGE_PARSE_ERROR,e,nO.MEDIUM,n)}}class nq extends nD{constructor(e,n={}){super(nS.ASR_MESSAGE_INTERVAL_TIMEOUT,e,nO.MEDIUM,n)}}class nV extends nD{constructor(e,n={}){super(nS.ASR_RUNTIME_ERROR,e,nO.HIGH,n)}}class nX extends nR{constructor(e,n,r=nO.MEDIUM,i={}){super(e,n||nE[e]||"数字人服务错误",nw.SERVICE,r,i)}}class nW extends nX{constructor(e,n={}){super(nS.DH_MOUNT_FAILED,e,nO.HIGH,n)}}class n$ extends nX{constructor(e,n={}){super(nS.DH_IFRAME_LOAD_ERROR,e,nO.HIGH,n)}}class nz extends nX{constructor(e,n={}){super(nS.DH_RENDER_ERROR,e,nO.MEDIUM,n)}}class nG extends nX{constructor(e,n={}){super(nS.DH_WEBSOCKET_ERROR,e,nO.HIGH,n)}}class nY extends nX{constructor(e,n={}){super(nS.DH_RTC_ERROR,e,nO.HIGH,n)}}class nQ extends nX{constructor(e,n={}){super(nS.DH_AUTHENTICATION_ERROR,e,nO.CRITICAL,n)}}class nJ extends nX{constructor(e,n={}){super(nS.DH_RESOURCE_NOT_ENOUGH,e,nO.CRITICAL,n)}}class nK{constructor(e){this.opts=e,this.reporters=[]}addReporter(e){this.reporters.push(e)}removeReporter(e){let n=this.reporters.indexOf(e);n>-1&&this.reporters.splice(n,1)}async handle(e){let n;n=e instanceof nR?e.toJSON():this.isErrorDetails(e)?e:nR.fromError(e,"UNKNOWN_ERROR","INTERNAL").toJSON(),await this.processError(n)}async processError(e){try{this.shouldLogError()&&this.logError(e),this.shouldReportError(e)&&await this.reportError(e)}catch(e){console.error("Error in error handler:",e)}}shouldLogError(){var e;return(null==(e=this.opts)?void 0:e.enableErrorLogging)!==!1}shouldReportError(e){var n;return(null==(n=this.opts)?void 0:n.enableErrorReporting)!==!1&&e.severity!==nO.LOW&&this.reporters.length>0}logError(e){let n=this.getLogLevel(e.severity),r=`[${e.code}] ${e.message}`;"error"===n?console.error(r,e):"warn"===n?console.warn(r,e):console.log(r,e)}getLogLevel(e){switch(e){case nO.CRITICAL:case nO.HIGH:return"error";case nO.MEDIUM:return"warn";case nO.LOW:default:return"log"}}async reportError(e){let n=this.reporters.map(n=>n.report(e).catch(e=>{console.error("Error reporter failed:",e)}));await Promise.allSettled(n)}isErrorDetails(e){return e&&"object"==typeof e&&"code"in e&&"message"in e&&"category"in e&&"severity"in e}}class nZ{async report(e){console.error("Error Report:",{code:e.code,message:e.message,category:e.category,severity:e.severity,timestamp:new Date(e.metadata.timestamp).toISOString(),sessionId:e.metadata.sessionId,requestId:e.metadata.requestId,context:e.metadata.context})}}class n0{constructor(e){this.options={timeout:5e3,headers:{"Content-Type":"application/json"},retryCount:3,retryDelay:1e3,...e}}async report(e){let n=this.buildPayload(e);for(let e=0;e<=this.options.retryCount;e++)try{await this.sendRequest(n);return}catch(n){if(e===this.options.retryCount)throw n;await this.delay(this.options.retryDelay*(e+1))}}buildPayload(e){return{error:{code:e.code,message:e.message,category:e.category,severity:e.severity,actionRequired:e.actionRequired},metadata:{timestamp:e.metadata.timestamp,sessionId:e.metadata.sessionId,requestId:e.metadata.requestId,userId:e.metadata.userId,context:e.metadata.context,userAgent:navigator.userAgent,url:window.location.href}}}async sendRequest(e){let n=new AbortController,r=setTimeout(()=>n.abort(),this.options.timeout);try{let r=await fetch(this.options.endpoint,{method:"POST",headers:this.options.headers,body:JSON.stringify(e),signal:n.signal});if(!r.ok)throw Error(`HTTP ${r.status}: ${r.statusText}`)}finally{clearTimeout(r)}}delay(e){return new Promise(n=>setTimeout(n,e))}}class n1{static getErrorSeverity(e){if(e instanceof nR)return e.severity;let n=e.message.toLowerCase();return n.includes("permission")||n.includes("unauthorized")||n.includes("forbidden")?nO.CRITICAL:n.includes("network")||n.includes("timeout")||n.includes("connection")?nO.HIGH:nO.MEDIUM}static shouldReport(e){return!(e instanceof nR)||e.severity!==nO.LOW}static extractMetadata(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={timestamp:Date.now(),context:n,stack:e.stack};return e instanceof nR?{...r,...e.metadata}:r}static getActionRequired(e){if(e instanceof nR){var n;return null!=(n=e.actionRequired)?n:null}let r=e.message.toLowerCase();return r.includes("permission")||r.includes("unauthorized")?"请检查用户权限":r.includes("network")||r.includes("timeout")?"请检查网络连接后重试":r.includes("validation")||r.includes("invalid")?"请检查输入数据的格式和有效性":null}}class n2{constructor(){this.emitter=new tY,this.emit=e=>{let n=this.transformErrorToPayload(e);this.emitter.emit("error",n)},this.on=e=>{this.emitter.on("error",e)},this.off=e=>{this.emitter.off("error",e)},this.clearListeners=()=>{this.emitter.clearListeners()},this.transformErrorToPayload=e=>{if(e instanceof nR){var n;return{code:e.code,message:e.toString(),stack:e.stack,actionRequired:null!=(n=e.actionRequired)?n:null,severity:e.severity,metadata:{timestamp:e.metadata.timestamp,sessionId:e.metadata.sessionId,requestId:e.metadata.requestId,userId:e.metadata.userId,context:e.metadata.context,service:this.extractServiceFromError(e)},originalError:e}}return{code:"UNKNOWN_ERROR",message:e.toString(),stack:e.stack,actionRequired:n1.getActionRequired(e),severity:n1.getErrorSeverity(e),metadata:{timestamp:Date.now(),context:{errorName:e.name}},originalError:e}},this.extractServiceFromError=e=>{let n=e.constructor.name.toLowerCase();return n.includes("agent")?"agent":n.includes("asr")?"asr":n.includes("digitalHuman")||n.includes("dh")?"digital-human":n.includes("conversation")?"conversation":"unknown"}}}class n3 extends Error{constructor(e,n,r={}){super(n),this.name=e||"AaaSPilotKitError",this.message=n,this.data=r,Error.captureStackTrace?Error.captureStackTrace(this,n3):this.stack=Error().stack||"",Object.setPrototypeOf(this,n3.prototype)}static createForMonitoring(e,n,r){return new n3(e,n,r)}getMonitoringData(){return{type:this.name,message:this.message,stack:this.stack,timestamp:Date.now(),...this.data}}getSimplifiedData(){return{type:this.name,message:this.message,userId:this.data.userId,sessionId:this.data.sessionId,page:this.data.page}}toString(){return this.message}toJSON(){return this.getMonitoringData()}}function n6(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function n5(e,n){return function(r,i){n(r,i,e)}}class n4 extends n2{constructor(e){super(),this.opts=e,this.handleError=async e=>{await this.errorHandler.handle(e),this.emit(e)},this.getErrorHandler=()=>this.errorHandler,this.getActionRequired=e=>n1.getActionRequired(e),this.createMonitoringError=e=>{var n,r;let i=this.buildEnhancedMessage(e),o={page:null==(n=e.metadata.context)?void 0:n.page,userId:e.metadata.userId,sessionId:e.metadata.sessionId,requestId:e.metadata.requestId,context:e.metadata.context,severity:e.severity,category:e.metadata.service||"unknown",code:e.code,originalMessage:null==(r=e.originalError)?void 0:r.message};return n3.createForMonitoring(e.code,i,o)},this.buildEnhancedMessage=e=>{let n=[],r=e.severity.toUpperCase();n.push(`[${r}]: ${e.message}`),e.metadata.service&&n.push(`category=${e.metadata.service}`);let i=new Date(e.metadata.timestamp||Date.now()),o=i.getFullYear()+"-"+String(i.getMonth()+1).padStart(2,"0")+"-"+String(i.getDate()).padStart(2,"0")+" "+String(i.getHours()).padStart(2,"0")+":"+String(i.getMinutes()).padStart(2,"0")+":"+String(i.getSeconds()).padStart(2,"0");if(n.push(`time=${o}`),e.metadata&&Object.keys(e.metadata).length>0){let r=this.stringifyMetadata(e.metadata);r&&"{}"!==r&&n.push(`metadata=${r}`)}return n.join(" | ")},this.stringifyMetadata=e=>{if(!e||"object"!=typeof e)return"{}";let n=new Set(["timestamp","stack"]),r={};for(let[i,o]of Object.entries(e))n.has(i)||null==o||(r[i]=o);try{return JSON.stringify(r)}catch{return"{}"}},this.initializeReporters=()=>{this.options.enableConsoleReporter&&this.errorHandler.addReporter(new nZ),this.options.enableHttpReporter&&this.options.httpReporterEndpoint&&this.errorHandler.addReporter(new n0({endpoint:this.options.httpReporterEndpoint}))},this.options={enableConsoleReporter:this.opts.enableDebugMode,enableHttpReporter:!1,enableErrorLogging:this.opts.enableDebugMode,enableErrorReporting:!0},this.errorHandler=new nK(this.options),this.initializeReporters()}}function n8(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function n9(e,n){return function(r,i){n(r,i,e)}}n4=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eb(),n5(0,eg(tJ.IOptions)),n5(0,eR()),n6("design:type",Function),n6("design:paramtypes",["undefined"==typeof IOptions?Object:IOptions])],n4);class n7{constructor(e,n,r){this.request=e,this.errorManager=n,this.opts=r,this.emitter=new tY,this.conversationSessionId="",this.abortController=null,this._queryId="",this._lastQueryId="",this.setSessionId=e=>{this.conversationSessionId=e},this.setQueryId=e=>{this._queryId=e},this.setLastQueryId=e=>{this._lastQueryId=e},this.abort=e=>{var n;null==(n=this.abortController)||n.abort(e),this.abortController&&(this.abortController=null)},this.checkIsRepeat=()=>{let e=!!this.lastQueryId&&this.lastQueryId===this.queryId;return e&&this.opts.enableDebugMode&&console.warn("重复的completed查询被忽略:",this.queryId),e},this.onData=e=>{this.emitter.emit("data",e)},this.onCompleted=e=>{this.emitter.emit("completed",e)},this.onHangup=e=>{this.emitter.emit("hangup",e)},this.onTimeout=e=>{this.emitter.emit("timeout",e)},this.onInstructionReceived=e=>{this.emitter.emit("instruction_received",e)},this.onUsageQuotaReached=e=>{this.emitter.emit("usage_quota_reached",e)},this.onQuotaExpired=e=>{this.emitter.emit("quota_expired",e)},this._dispose=()=>{this.abort(),this.conversationSessionId="",this._queryId="",this._lastQueryId=""}}get sessionId(){return this.conversationSessionId}get queryId(){return this._queryId}get lastQueryId(){return this._lastQueryId}}n7=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eb(),n9(0,eg(tJ.CommonRequest)),n9(1,eg(tJ.ErrorManager)),n9(2,eg(tJ.IOptions)),n9(2,eR()),n8("design:type",Function),n8("design:paramtypes",[void 0===n_?Object:n_,void 0===n4?Object:n4,"undefined"==typeof IResolvedOptions?Object:IResolvedOptions])],n7),r("../../node_modules/core-js/modules/es.array.reduce.js");let re=[{pattern:/客悦\s*one/gi,replacement:"客悦\xb7ONE"},{pattern:/\bSARS\b/gi,replacement:"SaaS"},{pattern:/\bSAS\b/gi,replacement:"SaaS"}],rt=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:re;return n.reduce((e,n)=>{let{pattern:r,replacement:i}=n;return e.replace(r,i)},e)},rn={enableDebugMode:!1,minSplitLen:5,ttsModel:"02-turbo",env:"production",asrVad:600,interruptible:!0,rendererMode:"cloud",autoChromaKey:!0,typeDelay:163,enTypeDelay:45,inactivityPrompt:"您这么久没讲话,是不是有其它事情要忙,那我先挂断了",getMountContainer:()=>document.body,hotWordReplacementRules:re,rtcID:"appreimunmd7utp"},rr={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},ri=new Uint8Array(16),ro=[];for(let e=0;e<256;++e)ro.push((e+256).toString(16).slice(1));let rs=function(n,r,i){if(rr.randomUUID&&!r&&!n)return rr.randomUUID();var o=n,s=i;let a=(o=o||{}).random??o.rng?.()??function(){if(!e){if("undefined"==typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");e=crypto.getRandomValues.bind(crypto)}return e(ri)}();if(a.length<16)throw Error("Random bytes length must be >= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,r){if((s=s||0)<0||s+16>r.length)throw RangeError(`UUID byte range ${s}:${s+15} is out of buffer bounds`);for(let e=0;e<16;++e)r[s+e]=a[e];return r}return function(e,n=0){return(ro[e[n+0]]+ro[e[n+1]]+ro[e[n+2]]+ro[e[n+3]]+"-"+ro[e[n+4]]+ro[e[n+5]]+"-"+ro[e[n+6]]+ro[e[n+7]]+"-"+ro[e[n+8]]+ro[e[n+9]]+"-"+ro[e[n+10]]+ro[e[n+11]]+ro[e[n+12]]+ro[e[n+13]]+ro[e[n+14]]+ro[e[n+15]]).toLowerCase()}(a)};class ra{constructor(e,n){this.opts=n,this.emitter=new tY,this.id="",this.text="",this.update=e=>{let{id:n,...r}=e;n?this.id=n:this.id||(this.id=rs()),Object.assign(this,r)},this.toJSON=()=>({id:this.id,type:this.type,text:this.text}),this.type=e.type,this.update(e)}}let rc=()=>{};class rl extends ra{constructor(e,n){super({...e,type:"client"},n),this.opts=n,this.appendText=e=>{this.text=e,this.emitter.emit("content_change",{mod:"text",content:e,completed:!0}).catch(rc)},this.dispose=()=>{},this.interrupt=()=>{}}static create(e){return new rl({},e)}}var ru=r("../../node_modules/p-queue/node_modules/eventemitter3/index.js"),rd=r.n(ru);class rp extends Error{constructor(e){super(e),this.name="TimeoutError"}}class rh extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}let rf=e=>void 0===globalThis.DOMException?new rh(e):new DOMException(e),rm=e=>{let n=void 0===e.reason?rf("This operation was aborted."):e.reason;return n instanceof Error?n:rf(n)};class rg{#Y=[];enqueue(e,n){let r={priority:(n={priority:0,...n}).priority,id:n.id,run:e};if(0===this.size||this.#Y[this.size-1].priority>=n.priority)return void this.#Y.push(r);let i=function(e,n,r){let i=0,o=e.length;for(;o>0;){let s=Math.trunc(o/2),a=i+s;0>=r(e[a],n)?(i=++a,o-=s+1):o=s}return i}(this.#Y,r,(e,n)=>n.priority-e.priority);this.#Y.splice(i,0,r)}setPriority(e,n){let r=this.#Y.findIndex(n=>n.id===e);if(-1===r)throw ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[i]=this.#Y.splice(r,1);this.enqueue(i.run,{priority:n,id:e})}dequeue(){let e=this.#Y.shift();return e?.run}filter(e){return this.#Y.filter(n=>n.priority===e.priority).map(e=>e.run)}get size(){return this.#Y.length}}class rv extends rd(){#Q;#J;#K=0;#Z;#ee;#et=0;#en;#er;#Y;#ei;#eo=0;#es;#ea;#ec;#el=1n;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:rg,...e}).intervalCap&&e.intervalCap>=1))throw TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#Q=e.carryoverConcurrencyCount,this.#J=e.intervalCap===Number.POSITIVE_INFINITY||0===e.interval,this.#Z=e.intervalCap,this.#ee=e.interval,this.#Y=new e.queueClass,this.#ei=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#ec=!0===e.throwOnTimeout,this.#ea=!1===e.autoStart}get #eu(){return this.#J||this.#K<this.#Z}get #ed(){return this.#eo<this.#es}#ep(){this.#eo--,this.#eh(),this.emit("next")}#ef(){this.#em(),this.#eg(),this.#er=void 0}get #ev(){let e=Date.now();if(void 0===this.#en){let n=this.#et-e;if(!(n<0))return void 0===this.#er&&(this.#er=setTimeout(()=>{this.#ef()},n)),!0;this.#K=this.#Q?this.#eo:0}return!1}#eh(){if(0===this.#Y.size)return this.#en&&clearInterval(this.#en),this.#en=void 0,this.emit("empty"),0===this.#eo&&this.emit("idle"),!1;if(!this.#ea){let e=!this.#ev;if(this.#eu&&this.#ed){let n=this.#Y.dequeue();return!!n&&(this.emit("active"),n(),e&&this.#eg(),!0)}}return!1}#eg(){this.#J||void 0!==this.#en||(this.#en=setInterval(()=>{this.#em()},this.#ee),this.#et=Date.now()+this.#ee)}#em(){0===this.#K&&0===this.#eo&&this.#en&&(clearInterval(this.#en),this.#en=void 0),this.#K=this.#Q?this.#eo:0,this.#ey()}#ey(){for(;this.#eh(););}get concurrency(){return this.#es}set concurrency(e){if(!("number"==typeof e&&e>=1))throw TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#es=e,this.#ey()}async #eb(e){return new Promise((n,r)=>{e.addEventListener("abort",()=>{r(e.reason)},{once:!0})})}setPriority(e,n){this.#Y.setPriority(e,n)}async add(e,n={}){return n.id??=(this.#el++).toString(),n={timeout:this.timeout,throwOnTimeout:this.#ec,...n},new Promise((r,i)=>{this.#Y.enqueue(async()=>{this.#eo++,this.#K++;try{n.signal?.throwIfAborted();let i=e({signal:n.signal});n.timeout&&(i=function(e,n){let r,i,{milliseconds:o,fallback:s,message:a,customTimers:c={setTimeout,clearTimeout}}=n,l=new Promise((l,u)=>{if("number"!=typeof o||1!==Math.sign(o))throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${o}\``);if(n.signal){let{signal:e}=n;e.aborted&&u(rm(e)),i=()=>{u(rm(e))},e.addEventListener("abort",i,{once:!0})}if(o===Number.POSITIVE_INFINITY)return void e.then(l,u);let d=new rp;r=c.setTimeout.call(void 0,()=>{if(s){try{l(s())}catch(e){u(e)}return}"function"==typeof e.cancel&&e.cancel(),!1===a?l():a instanceof Error?u(a):(d.message=a??`Promise timed out after ${o} milliseconds`,u(d))},o),(async()=>{try{l(await e)}catch(e){u(e)}})()}).finally(()=>{l.clear(),i&&n.signal&&n.signal.removeEventListener("abort",i)});return l.clear=()=>{c.clearTimeout.call(void 0,r),r=void 0},l}(Promise.resolve(i),{milliseconds:n.timeout})),n.signal&&(i=Promise.race([i,this.#eb(n.signal)]));let o=await i;r(o),this.emit("completed",o)}catch(e){if(e instanceof rp&&!n.throwOnTimeout)return void r();i(e),this.emit("error",e)}finally{this.#ep()}},n),this.emit("add"),this.#eh()})}async addAll(e,n){return Promise.all(e.map(async e=>this.add(e,n)))}start(){return this.#ea&&(this.#ea=!1,this.#ey()),this}pause(){this.#ea=!0}clear(){this.#Y=new this.#ei}async onEmpty(){0!==this.#Y.size&&await this.#e_("empty")}async onSizeLessThan(e){this.#Y.size<e||await this.#e_("next",()=>this.#Y.size<e)}async onIdle(){(0!==this.#eo||0!==this.#Y.size)&&await this.#e_("idle")}async #e_(e,n){return new Promise(r=>{let i=()=>{(!n||n())&&(this.off(e,i),r())};this.on(e,i)})}get size(){return this.#Y.size}sizeBy(e){return this.#Y.filter(e).length}get pending(){return this.#eo}get isPaused(){return this.#ea}}class ry{constructor(e){this.id=rs(),this.createdAt=Date.now(),this.updatedAt=Date.now(),this.emitter=new tY,this.getConfig=()=>({...this.config}),this.updateConfig=e=>{this.config={...this.config,...e},this.updatedAt=Date.now()},this.toJSON=()=>({id:this.id,mod:this.mod,config:this.getConfig(),createdAt:this.createdAt,updatedAt:this.updatedAt}),this.updateTimestamp=()=>{this.updatedAt=Date.now()},this._dispose=()=>{this.emitter.clearListeners()},this.config={...e},this.config.timestamp||(this.config.timestamp=this.createdAt)}}var rb=r("../../node_modules/typewriter-effect/dist/core.js"),r_=r.n(rb);let rw=e=>/[\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\u3000-\u303F]/.test(e);class rO extends ry{get mod(){return"text"}static fromSnapshot(e){return new rO(e.config)}static fromString(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new rO({content:e,...n})}setTargetElement(e){this.targetElement=e}isEmpty(){return!this.config.content}constructor(...e){super(...e),this.typewriter=null,this.targetElement=null,this.index=0,this.stopTypewriter=()=>{this.typewriter&&(this.typewriter.stop(),this.typewriter=null)},this.runTask=()=>new Promise((e,n)=>{if(this.ensureTarget(),this.isEmpty())return void e({mod:"text",content:""});try{var r,i,o,s,a;let n=null!=(o=null==(r=this.config.typewriterOptions)?void 0:r.delay)?o:163,c=null!=(s=null==(i=this.config.typewriterOptions)?void 0:i.enDelay)?s:n;this.typewriter=new(r_())(this.targetElement,{autoStart:!0,loop:!1,...this.config.typewriterOptions,delay:0,onCreateTextNode:e=>{let n=this.index===this.config.content.length-1;return this.emitter.emit("data",{char:e,index:this.index++,done:n}),document.createTextNode(e)}});let l=[],u="",d=null;for(let e of Array.from(this.config.content)){let n=rw(e);null===d||n===d?u+=e:(l.push({s:u,cn:d}),u=e),d=n}u&&l.push({s:u,cn:d});let p=this.typewriter;if(0===l.length)p=p.changeDelay(n).typeString(this.config.content);else for(let e=0;e<l.length;e++){let{s:r,cn:i}=l[e];if(0===e){let e=null!=(a=r[0])?a:"",o=r.slice(1);p=p.typeString(e),o&&(p=p.changeDelay(i?n:c).typeString(o));continue}p=p.changeDelay(i?n:c).typeString(r)}p.callFunction(()=>{e({mod:"text",content:this.config.content})}).start()}catch(e){n(e)}}),this.dispose=()=>{this._dispose(),this.stopTypewriter(),this.targetElement=null,this.index=0},this.interrupt=()=>{this.stopTypewriter()},this.ensureTarget=()=>{if(this.targetElement)return;let e=document.createElement("span");e.className="text-content-typewriter",this.targetElement=e}}}class rR extends ry{get mod(){return"image"}static fromSnapshot(e){return new rR(e.config)}static fromSrc(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new rR({src:e,...n})}isEmpty(){return!this.config.src}ensureImageElement(){if(this.imgElement)return this.imgElement;let e=document.createElement("img");return this.imgElement=e,e}constructor(...e){super(...e),this.imgElement=null,this.setTargetElement=e=>{this.imgElement=e},this.runTask=()=>new Promise((e,n)=>{var r;if(this.isEmpty())return void e({mod:"image",src:""});let i=this.ensureImageElement(),o=()=>{e({mod:"image",...this.config}),i.removeEventListener("load",o)},s=()=>{n(Error(`Failed to load image: ${this.config.src}`)),i.removeEventListener("error",s)};i.addEventListener("load",o,{once:!0}),i.addEventListener("error",s,{once:!0}),i.alt=null!=(r=this.config.alt)?r:"",this.config.width&&(i.width=this.config.width),this.config.height&&(i.height=this.config.height),i.src=this.config.src}),this.dispose=()=>{this._dispose(),this.imgElement&&(this.imgElement.src="",this.imgElement=null)},this.interrupt=()=>{}}}class rS extends ry{get mod(){return"video"}static fromSnapshot(e){return new rS(e.config)}static fromSrc(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new rS({src:e,...n})}isEmpty(){return!this.config.src}ensureVideoElement(){if(this.videoElement)return this.videoElement;let e=document.createElement("video");return e.muted=!0,e.playsInline=!0,this.videoElement=e,e}constructor(...e){super(...e),this.videoElement=null,this.setTargetElement=e=>{this.videoElement=e},this.runTask=()=>new Promise((e,n)=>{if(this.isEmpty())return void e({mod:"video",src:""});let r=this.ensureVideoElement(),i=()=>{e({mod:"video",...this.config}),r.removeEventListener("loadedmetadata",i)},o=()=>{n(Error(`Failed to load video: ${this.config.src}`)),r.removeEventListener("error",o)};r.addEventListener("loadedmetadata",i,{once:!0}),r.addEventListener("error",o,{once:!0}),this.config.poster&&(r.poster=this.config.poster),this.config.preload&&(r.preload=this.config.preload),this.config.width&&(r.width=this.config.width),this.config.height&&(r.height=this.config.height),r.src=this.config.src,r.load()}),this.dispose=()=>{this._dispose(),this.videoElement&&(this.videoElement.src="",this.videoElement.load(),this.videoElement=null)},this.interrupt=()=>{}}}let rE={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,n){return n},attributeValueProcessor:function(e,n){return n},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,n,r){return e},captureMetaData:!1},rT=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",rM=RegExp("^"+("["+rT+"]["+rT)+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function rx(e,n){let r=[],i=n.exec(e);for(;i;){let o=[];o.startIndex=n.lastIndex-i[0].length;let s=i.length;for(let e=0;e<s;e++)o.push(i[e]);r.push(o),i=n.exec(e)}return r}let rC=function(e){return null!=rM.exec(e)};n="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");class rI{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,n){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:n})}addChild(e,r){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),void 0!==r&&(this.child[this.child.length-1][n]={startIndex:r})}static getMetaDataSymbol(){return n}}let rj=(e,n)=>{for(;n<e.length&&/\s/.test(e[n]);)n++;return n};function rA(e,n,r){let i="",o=e[n];if('"'!==o&&"'"!==o)throw Error(`Expected quoted string, found "${o}"`);for(n++;n<e.length&&e[n]!==o;)i+=e[n],n++;if(e[n]!==o)throw Error(`Unterminated ${r} value`);return[++n,i]}function rB(e,n,r){for(let i=0;i<n.length;i++)if(n[i]!==e[r+i+1])return!1;return!0}function rk(e){if(rC(e))return e;throw Error(`Invalid entity name ${e}`)}let rP=/^[-+]?0x[a-fA-F0-9]+$/,rN=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,rD={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0},rL=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;class rF{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xa2"},pound:{regex:/&(pound|#163);/g,val:"\xa3"},yen:{regex:/&(yen|#165);/g,val:"\xa5"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"\xa9"},reg:{regex:/&(reg|#174);/g,val:"\xae"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,n)=>String.fromCodePoint(Number.parseInt(n,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,n)=>String.fromCodePoint(Number.parseInt(n,16))}},this.addExternalEntities=rU,this.parseXml=rW,this.parseTextData=rH,this.resolveNameSpace=rq,this.buildAttributesMap=rX,this.isItStopNode=rY,this.replaceEntitiesValue=rz,this.readStopNodeData=rK,this.saveTextToParentTag=rG,this.addChild=r$,this.ignoreAttributesFn=function(e){return"function"==typeof e?e:Array.isArray(e)?n=>{for(let r of e)if("string"==typeof r&&n===r||r instanceof RegExp&&r.test(n))return!0}:()=>!1}(this.options.ignoreAttributes)}}function rU(e){let n=Object.keys(e);for(let r=0;r<n.length;r++){let i=n[r];this.lastEntities[i]={regex:RegExp("&"+i+";","g"),val:e[i]}}}function rH(e,n,r,i,o,s,a){if(void 0!==e&&(this.options.trimValues&&!i&&(e=e.trim()),e.length>0)){a||(e=this.replaceEntitiesValue(e));let i=this.options.tagValueProcessor(n,e,r,o,s);return null==i?e:typeof i!=typeof e||i!==e?i:this.options.trimValues||e.trim()===e?rZ(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function rq(e){if(this.options.removeNSPrefix){let n=e.split(":"),r="/"===e.charAt(0)?"/":"";if("xmlns"===n[0])return"";2===n.length&&(e=r+n[1])}return e}let rV=RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function rX(e,n,r){if(!0!==this.options.ignoreAttributes&&"string"==typeof e){let r=rx(e,rV),i=r.length,o={};for(let e=0;e<i;e++){let i=this.resolveNameSpace(r[e][1]);if(this.ignoreAttributesFn(i,n))continue;let s=r[e][4],a=this.options.attributeNamePrefix+i;if(i.length)if(this.options.transformAttributeName&&(a=this.options.transformAttributeName(a)),"__proto__"===a&&(a="#__proto__"),void 0!==s){this.options.trimValues&&(s=s.trim()),s=this.replaceEntitiesValue(s);let e=this.options.attributeValueProcessor(i,s,n);null==e?o[a]=s:typeof e!=typeof s||e!==s?o[a]=e:o[a]=rZ(s,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[a]=!0)}if(Object.keys(o).length){if(this.options.attributesGroupName){let e={};return e[this.options.attributesGroupName]=o,e}return o}}}let rW=function(e){e=e.replace(/\r\n?/g,"\n");let n=new rI("!xml"),r=n,i="",o="";for(let s=0;s<e.length;s++)if("<"===e[s])if("/"===e[s+1]){let n=rQ(e,">",s,"Closing Tag is not closed."),a=e.substring(s+2,n).trim();if(this.options.removeNSPrefix){let e=a.indexOf(":");-1!==e&&(a=a.substr(e+1))}this.options.transformTagName&&(a=this.options.transformTagName(a)),r&&(i=this.saveTextToParentTag(i,r,o));let c=o.substring(o.lastIndexOf(".")+1);if(a&&-1!==this.options.unpairedTags.indexOf(a))throw Error(`Unpaired tag can not be used as closing tag: </${a}>`);let l=0;c&&-1!==this.options.unpairedTags.indexOf(c)?(l=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):l=o.lastIndexOf("."),o=o.substring(0,l),r=this.tagsNodeStack.pop(),i="",s=n}else if("?"===e[s+1]){let n=rJ(e,s,!1,"?>");if(!n)throw Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,r,o),this.options.ignoreDeclaration&&"?xml"===n.tagName||this.options.ignorePiTags);else{let e=new rI(n.tagName);e.add(this.options.textNodeName,""),n.tagName!==n.tagExp&&n.attrExpPresent&&(e[":@"]=this.buildAttributesMap(n.tagExp,o,n.tagName)),this.addChild(r,e,o,s)}s=n.closeIndex+1}else if("!--"===e.substr(s+1,3)){let n=rQ(e,"--\x3e",s+4,"Comment is not closed.");if(this.options.commentPropName){let a=e.substring(s+4,n-2);i=this.saveTextToParentTag(i,r,o),r.add(this.options.commentPropName,[{[this.options.textNodeName]:a}])}s=n}else if("!D"===e.substr(s+1,2)){let n=function(e,n){let r={};if("O"===e[n+3]&&"C"===e[n+4]&&"T"===e[n+5]&&"Y"===e[n+6]&&"P"===e[n+7]&&"E"===e[n+8]){n+=9;let i=1,o=!1,s=!1,a="";for(;n<e.length;n++)if("<"!==e[n]||s)if(">"===e[n]){if(s?"-"===e[n-1]&&"-"===e[n-2]&&(s=!1,i--):i--,0===i)break}else"["===e[n]?o=!0:e[n];else{if(o&&rB(e,"!ENTITY",n)){let i,o;n+=7,[i,o,n]=function(e,n){n=rj(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n])&&'"'!==e[n]&&"'"!==e[n];)r+=e[n],n++;if(rk(r),n=rj(e,n),"SYSTEM"===e.substring(n,n+6).toUpperCase())throw Error("External entities are not supported");if("%"===e[n])throw Error("Parameter entities are not supported");let i="";return[n,i]=rA(e,n,"entity"),[r,i,--n]}(e,n+1),-1===o.indexOf("&")&&(r[i]={regx:RegExp(`&${i};`,"g"),val:o})}else if(o&&rB(e,"!ELEMENT",n)){let{index:r}=function(e,n){n=rj(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n]);)r+=e[n],n++;if(!rk(r))throw Error(`Invalid element name: "${r}"`);n=rj(e,n);let i="";if("E"===e[n]&&rB(e,"MPTY",n))n+=4;else if("A"===e[n]&&rB(e,"NY",n))n+=2;else if("("===e[n]){for(n++;n<e.length&&")"!==e[n];)i+=e[n],n++;if(")"!==e[n])throw Error("Unterminated content model")}else throw Error(`Invalid Element Expression, found "${e[n]}"`);return{elementName:r,contentModel:i.trim(),index:n}}(e,(n+=8)+1);n=r}else if(o&&rB(e,"!ATTLIST",n))n+=8;else if(o&&rB(e,"!NOTATION",n)){let{index:r}=function(e,n){n=rj(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n]);)r+=e[n],n++;rk(r),n=rj(e,n);let i=e.substring(n,n+6).toUpperCase();if("SYSTEM"!==i&&"PUBLIC"!==i)throw Error(`Expected SYSTEM or PUBLIC, found "${i}"`);n+=i.length,n=rj(e,n);let o=null,s=null;if("PUBLIC"===i)[n,o]=rA(e,n,"publicIdentifier"),n=rj(e,n),('"'===e[n]||"'"===e[n])&&([n,s]=rA(e,n,"systemIdentifier"));else if("SYSTEM"===i&&([n,s]=rA(e,n,"systemIdentifier"),!s))throw Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:o,systemIdentifier:s,index:--n}}(e,(n+=9)+1);n=r}else if(rB(e,"!--",n))s=!0;else throw Error("Invalid DOCTYPE");i++}if(0!==i)throw Error("Unclosed DOCTYPE")}else throw Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}(e,s);this.docTypeEntities=n.entities,s=n.i}else if("!["===e.substr(s+1,2)){let n=rQ(e,"]]>",s,"CDATA is not closed.")-2,a=e.substring(s+9,n);i=this.saveTextToParentTag(i,r,o);let c=this.parseTextData(a,r.tagname,o,!0,!1,!0,!0);void 0==c&&(c=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:a}]):r.add(this.options.textNodeName,c),s=n+2}else{let a=rJ(e,s,this.options.removeNSPrefix),c=a.tagName,l=a.rawTagName,u=a.tagExp,d=a.attrExpPresent,p=a.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),r&&i&&"!xml"!==r.tagname&&(i=this.saveTextToParentTag(i,r,o,!1));let h=r;h&&-1!==this.options.unpairedTags.indexOf(h.tagname)&&(r=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),c!==n.tagname&&(o+=o?"."+c:c);let f=s;if(this.isItStopNode(this.options.stopNodes,o,c)){let n="";if(u.length>0&&u.lastIndexOf("/")===u.length-1)"/"===c[c.length-1]?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),u=c):u=u.substr(0,u.length-1),s=a.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(c))s=a.closeIndex;else{let r=this.readStopNodeData(e,l,p+1);if(!r)throw Error(`Unexpected end of ${l}`);s=r.i,n=r.tagContent}let i=new rI(c);c!==u&&d&&(i[":@"]=this.buildAttributesMap(u,o,c)),n&&(n=this.parseTextData(n,c,o,!0,d,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),i.add(this.options.textNodeName,n),this.addChild(r,i,o,f)}else{if(u.length>0&&u.lastIndexOf("/")===u.length-1){"/"===c[c.length-1]?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),u=c):u=u.substr(0,u.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));let e=new rI(c);c!==u&&d&&(e[":@"]=this.buildAttributesMap(u,o,c)),this.addChild(r,e,o,f),o=o.substr(0,o.lastIndexOf("."))}else{let e=new rI(c);this.tagsNodeStack.push(r),c!==u&&d&&(e[":@"]=this.buildAttributesMap(u,o,c)),this.addChild(r,e,o,f),r=e}i="",s=p}}else i+=e[s];return n.child};function r$(e,n,r,i){this.options.captureMetaData||(i=void 0);let o=this.options.updateTag(n.tagname,r,n[":@"]);!1===o||("string"==typeof o&&(n.tagname=o),e.addChild(n,i))}let rz=function(e){if(this.options.processEntities){for(let n in this.docTypeEntities){let r=this.docTypeEntities[n];e=e.replace(r.regx,r.val)}for(let n in this.lastEntities){let r=this.lastEntities[n];e=e.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let n in this.htmlEntities){let r=this.htmlEntities[n];e=e.replace(r.regex,r.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function rG(e,n,r,i){return e&&(void 0===i&&(i=0===n.child.length),void 0!==(e=this.parseTextData(e,n.tagname,r,!1,!!n[":@"]&&0!==Object.keys(n[":@"]).length,i))&&""!==e&&n.add(this.options.textNodeName,e),e=""),e}function rY(e,n,r){let i="*."+r;for(let r in e){let o=e[r];if(i===o||n===o)return!0}return!1}function rQ(e,n,r,i){let o=e.indexOf(n,r);if(-1!==o)return o+n.length-1;throw Error(i)}function rJ(e,n,r,i=">"){let o=function(e,n,r=">"){let i,o="";for(let s=n;s<e.length;s++){let n=e[s];if(i)n===i&&(i="");else if('"'===n||"'"===n)i=n;else if(n===r[0]){if(!r[1])return{data:o,index:s};else if(e[s+1]===r[1])return{data:o,index:s}}else" "===n&&(n=" ");o+=n}}(e,n+1,i);if(!o)return;let s=o.data,a=o.index,c=s.search(/\s/),l=s,u=!0;-1!==c&&(l=s.substring(0,c),s=s.substring(c+1).trimStart());let d=l;if(r){let e=l.indexOf(":");-1!==e&&(u=(l=l.substr(e+1))!==o.data.substr(e+1))}return{tagName:l,tagExp:s,closeIndex:a,attrExpPresent:u,rawTagName:d}}function rK(e,n,r){let i=r,o=1;for(;r<e.length;r++)if("<"===e[r])if("/"===e[r+1]){let s=rQ(e,">",r,`${n} is not closed`);if(e.substring(r+2,s).trim()===n&&0==--o)return{tagContent:e.substring(i,r),i:s};r=s}else if("?"===e[r+1])r=rQ(e,"?>",r+1,"StopNode is not closed.");else if("!--"===e.substr(r+1,3))r=rQ(e,"--\x3e",r+3,"StopNode is not closed.");else if("!["===e.substr(r+1,2))r=rQ(e,"]]>",r,"StopNode is not closed.")-2;else{let i=rJ(e,r,">");i&&((i&&i.tagName)===n&&"/"!==i.tagExp[i.tagExp.length-1]&&o++,r=i.closeIndex)}}function rZ(e,n,r){if(n&&"string"==typeof e){let n=e.trim();return"true"===n||"false"!==n&&function(e,n={}){if(n=Object.assign({},rD,n),!e||"string"!=typeof e)return e;let r=e.trim();if(void 0!==n.skipLike&&n.skipLike.test(r))return e;{if("0"===e)return 0;if(n.hex&&rP.test(r)){var i,o=r,s=16;if(parseInt)return parseInt(o,16);if(Number.parseInt)return Number.parseInt(o,s);if(window&&window.parseInt)return window.parseInt(o,s);throw Error("parseInt, Number.parseInt, window.parseInt are not supported")}if(-1!==r.search(/.+[eE].+/))return function(e,n,r){if(!r.eNotation)return e;let i=n.match(rL);if(!i)return e;{let o=i[1]||"",s=-1===i[3].indexOf("e")?"E":"e",a=i[2],c=o?e[a.length+1]===s:e[a.length]===s;return a.length>1&&c?e:1===a.length&&(i[3].startsWith(`.${s}`)||i[3][0]===s)?Number(n):r.leadingZeros&&!c?Number(n=(i[1]||"")+i[3]):e}}(e,r,n);let a=rN.exec(r);if(!a)return e;{let o=a[1]||"",s=a[2],c=((i=a[3])&&-1!==i.indexOf(".")&&("."===(i=i.replace(/0+$/,""))?i="0":"."===i[0]?i="0"+i:"."===i[i.length-1]&&(i=i.substring(0,i.length-1))),i),l=o?"."===e[s.length+1]:"."===e[s.length];if(!n.leadingZeros&&(s.length>1||1===s.length&&!l))return e;{let i=Number(r),a=String(i);if(0===i)return i;if(-1!==a.search(/[eE]/))if(n.eNotation)return i;else return e;if(-1!==r.indexOf("."))if("0"===a)return i;else if(a===c)return i;else if(a===`${o}${c}`)return i;else return e;let l=s?c:r;return s?l===a||o+l===a?i:e:l===a||l===o+a?i:e}}}}(e,r)}return void 0!==e?e:""}let r0=rI.getMetaDataSymbol(),r1={allowBooleanAttributes:!1,unpairedTags:[]};function r2(e,n){n=Object.assign({},r1,n);let r=[],i=!1,o=!1;"\uFEFF"===e[0]&&(e=e.substr(1));for(let s=0;s<e.length;s++)if("<"===e[s]&&"?"===e[s+1]){if(s+=2,(s=r6(e,s)).err)return s}else if("<"===e[s]){let a=s;if("!"===e[++s]){s=r5(e,s);continue}{let c=!1;"/"===e[s]&&(c=!0,s++);let l="";for(;s<e.length&&">"!==e[s]&&" "!==e[s]&&" "!==e[s]&&"\n"!==e[s]&&"\r"!==e[s];s++)l+=e[s];if("/"===(l=l.trim())[l.length-1]&&(l=l.substring(0,l.length-1),s--),!rC(l)){let n;return r9("InvalidTag",0===l.trim().length?"Invalid space after '<'.":"Tag '"+l+"' is an invalid name.",r7(e,s))}let u=function(e,n){let r="",i="",o=!1;for(;n<e.length;n++){if('"'===e[n]||"'"===e[n])""===i?i=e[n]:i!==e[n]||(i="");else if(">"===e[n]&&""===i){o=!0;break}r+=e[n]}return""===i&&{value:r,index:n,tagClosed:o}}(e,s);if(!1===u)return r9("InvalidAttr","Attributes for '"+l+"' have open quote.",r7(e,s));let d=u.value;if(s=u.index,"/"===d[d.length-1]){let r=s-d.length,o=r8(d=d.substring(0,d.length-1),n);if(!0!==o)return r9(o.err.code,o.err.msg,r7(e,r+o.err.line));i=!0}else if(c)if(!u.tagClosed)return r9("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",r7(e,s));else{if(d.trim().length>0)return r9("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",r7(e,a));if(0===r.length)return r9("InvalidTag","Closing tag '"+l+"' has not been opened.",r7(e,a));let n=r.pop();if(l!==n.tagName){let r=r7(e,n.tagStartPos);return r9("InvalidTag","Expected closing tag '"+n.tagName+"' (opened in line "+r.line+", col "+r.col+") instead of closing tag '"+l+"'.",r7(e,a))}0==r.length&&(o=!0)}else{let c=r8(d,n);if(!0!==c)return r9(c.err.code,c.err.msg,r7(e,s-d.length+c.err.line));if(!0===o)return r9("InvalidXml","Multiple possible root nodes found.",r7(e,s));-1!==n.unpairedTags.indexOf(l)||r.push({tagName:l,tagStartPos:a}),i=!0}for(s++;s<e.length;s++)if("<"===e[s])if("!"===e[s+1]){s=r5(e,++s);continue}else if("?"===e[s+1]){if((s=r6(e,++s)).err)return s}else break;else if("&"===e[s]){let n=function(e,n){if(";"===e[++n])return -1;if("#"===e[n]){var r=++n;let i=/\d/;for("x"===e[r]&&(r++,i=/[\da-fA-F]/);r<e.length;r++){if(";"===e[r])return r;if(!e[r].match(i))break}return -1}let i=0;for(;n<e.length;n++,i++)if(!e[n].match(/\w/)||!(i<20)){if(";"===e[n])break;return -1}return n}(e,s);if(-1==n)return r9("InvalidChar","char '&' is not expected.",r7(e,s));s=n}else if(!0===o&&!r3(e[s]))return r9("InvalidXml","Extra text at the end",r7(e,s));"<"===e[s]&&s--}}else{if(r3(e[s]))continue;return r9("InvalidChar","char '"+e[s]+"' is not expected.",r7(e,s))}return i?1==r.length?r9("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",r7(e,r[0].tagStartPos)):!(r.length>0)||r9("InvalidXml","Invalid '"+JSON.stringify(r.map(e=>e.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):r9("InvalidXml","Start tag expected.",1)}function r3(e){return" "===e||" "===e||"\n"===e||"\r"===e}function r6(e,n){let r=n;for(;n<e.length;n++)if("?"==e[n]||" "==e[n]){let i=e.substr(r,n-r);if(n>5&&"xml"===i)return r9("InvalidXml","XML declaration allowed only at the start of the document.",r7(e,n));if("?"!=e[n]||">"!=e[n+1])continue;n++;break}return n}function r5(e,n){if(e.length>n+5&&"-"===e[n+1]&&"-"===e[n+2]){for(n+=3;n<e.length;n++)if("-"===e[n]&&"-"===e[n+1]&&">"===e[n+2]){n+=2;break}}else if(e.length>n+8&&"D"===e[n+1]&&"O"===e[n+2]&&"C"===e[n+3]&&"T"===e[n+4]&&"Y"===e[n+5]&&"P"===e[n+6]&&"E"===e[n+7]){let r=1;for(n+=8;n<e.length;n++)if("<"===e[n])r++;else if(">"===e[n]&&0==--r)break}else if(e.length>n+9&&"["===e[n+1]&&"C"===e[n+2]&&"D"===e[n+3]&&"A"===e[n+4]&&"T"===e[n+5]&&"A"===e[n+6]&&"["===e[n+7]){for(n+=8;n<e.length;n++)if("]"===e[n]&&"]"===e[n+1]&&">"===e[n+2]){n+=2;break}}return n}let r4=RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function r8(e,n){let r=rx(e,r4),i={};for(let e=0;e<r.length;e++){if(0===r[e][1].length)return r9("InvalidAttr","Attribute '"+r[e][2]+"' has no space in starting.",ie(r[e]));if(void 0!==r[e][3]&&void 0===r[e][4])return r9("InvalidAttr","Attribute '"+r[e][2]+"' is without value.",ie(r[e]));if(void 0===r[e][3]&&!n.allowBooleanAttributes)return r9("InvalidAttr","boolean attribute '"+r[e][2]+"' is not allowed.",ie(r[e]));let o=r[e][2];if(!rC(o))return r9("InvalidAttr","Attribute '"+o+"' is an invalid name.",ie(r[e]));if(i.hasOwnProperty(o))return r9("InvalidAttr","Attribute '"+o+"' is repeated.",ie(r[e]));i[o]=1}return!0}function r9(e,n,r){return{err:{code:e,msg:n,line:r.line||r,col:r.col}}}function r7(e,n){let r=e.substring(0,n).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function ie(e){return e.startIndex+e[1].length}class it{constructor(e){this.externalEntities={},this.options=Object.assign({},rE,e)}parse(e,n){if("string"==typeof e);else if(e.toString)e=e.toString();else throw Error("XML data is accepted in String or Bytes[] form.");if(n){!0===n&&(n={});let r=r2(e,n);if(!0!==r)throw Error(`${r.err.msg}:${r.err.line}:${r.err.col}`)}let r=new rF(this.options);r.addExternalEntities(this.externalEntities);let i=r.parseXml(e);return this.options.preserveOrder||void 0===i?i:function e(n,r,i){let o,s={};for(let a=0;a<n.length;a++){let c=n[a],l=function(e){let n=Object.keys(e);for(let e=0;e<n.length;e++){let r=n[e];if(":@"!==r)return r}}(c),u="";if(u=void 0===i?l:i+"."+l,l===r.textNodeName)void 0===o?o=c[l]:o+=""+c[l];else if(void 0===l)continue;else if(c[l]){let n=e(c[l],r,u),i=function(e,n){let{textNodeName:r}=n,i=Object.keys(e).length;return 0===i||1===i&&(!!e[r]||"boolean"==typeof e[r]||0===e[r])}(n,r);void 0!==c[r0]&&(n[r0]=c[r0]),c[":@"]?function(e,n,r,i){if(n){let o=Object.keys(n),s=o.length;for(let a=0;a<s;a++){let s=o[a];i.isArray(s,r+"."+s,!0,!0)?e[s]=[n[s]]:e[s]=n[s]}}}(n,c[":@"],u,r):1!==Object.keys(n).length||void 0===n[r.textNodeName]||r.alwaysCreateTextNode?0===Object.keys(n).length&&(r.alwaysCreateTextNode?n[r.textNodeName]="":n=""):n=n[r.textNodeName],void 0!==s[l]&&s.hasOwnProperty(l)?(Array.isArray(s[l])||(s[l]=[s[l]]),s[l].push(n)):r.isArray(l,u,i)?s[l]=[n]:s[l]=n}}return"string"==typeof o?o.length>0&&(s[r.textNodeName]=o):void 0!==o&&(s[r.textNodeName]=o),s}(i,this.options)}addEntity(e,n){if(-1!==n.indexOf("&"))throw Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===n)throw Error("An entity with value '&' is not permitted");this.externalEntities[e]=n}static getMetaDataSymbol(){return rI.getMetaDataSymbol()}}let ir={validate:r2};class ii{constructor(){this.isXml=e=>ii.isXml(e),this.parseXmlOrText=e=>{try{let n=this.xmlParser.parse(e);if(Array.isArray(n)&&!n.length);else if(Array.isArray(n)&&n.length)return n;return e}catch(n){return e}},this.hasMixContentByParsedXml=e=>Array.isArray(e),this.xmlParser=new it({preserveOrder:!0,ignoreAttributes:!1,attributeNamePrefix:"",textNodeName:"#text",alwaysCreateTextNode:!0})}static #B=this.isTextNode=e=>"text"in e;static #G=this.isImageNode=e=>"image"in e;static #ew=this.isVideoNode=e=>"video"in e;static #eO=this.isXml=e=>"string"==typeof e&&!0===ir.validate(e,{allowBooleanAttributes:!0})}class io extends ra{constructor(e,n){super({...e,type:"aiWorker"},n),this.opts=n,this.contents=[],this.addContentRenderTask=e=>{io.isTextContent(e)?(e.emitter.on("data",e=>{this.emitter.emit("content_change",{mod:"text",content:e.char,completed:e.done})}),this.queue.add(e.runTask).finally(()=>{e.dispose()})):io.isImageContent(e)?this.queue.add(e.runTask).then(e=>{e&&this.emitter.emit("content_change",{mod:"image",content:e.src,completed:!0})}).finally(()=>{e.dispose()}):io.isVideoContent(e)&&this.queue.add(e.runTask).then(e=>{e&&this.emitter.emit("content_change",{mod:"video",content:e.src,completed:!0})}).finally(()=>{e.dispose()})},this.addAllContents=e=>{for(let n of(this.contents=e,e))this.addContentRenderTask(n)},this.createContentsFromXmlString=e=>{let n=this.customXmlParser.parseXmlOrText(e);return this.customXmlParser.hasMixContentByParsedXml(n)?n[0].root[0].content.map(e=>ii.isTextNode(e)?rO.fromString(e.text[0]["#text"],{typewriterOptions:{delay:this.opts.typeDelay,enDelay:this.opts.enTypeDelay}}):ii.isImageNode(e)?rR.fromSrc(e.image[0]["#text"]):ii.isVideoNode(e)?rS.fromSrc(e.video[0]["#text"]):null).filter(Boolean):[]},this.appendText=e=>{if(this.customXmlParser.isXml(e)){let n=this.createContentsFromXmlString(e);this.addAllContents(n)}else{let n=rO.fromString(e,{typewriterOptions:{delay:this.opts.typeDelay,enDelay:this.opts.enTypeDelay}});this.addContentRenderTask(n),this.contents.push(n)}},this.dispose=()=>{this.queue.removeAllListeners(),this.contents=[]},this.interrupt=()=>{for(let e of this.contents)e.interrupt();this.queue.clear(),this.emitter.emit("interrupt")},this.bindEvents=()=>{this.queue.on("empty",()=>{this.emitter.emit("queue_empty")})},this.queue=new rv({concurrency:1}),this.customXmlParser=new ii,this.bindEvents()}get fulltext(){return this.contents.map(e=>io.isTextContent(e)?e.getConfig().content:"").join("")}static #B=this.create=e=>new io({},e);static #G=this.isAllTextContents=e=>e.every(e=>"text"===e.mod);static #ew=this.isTextContent=e=>e instanceof rO&&"text"===e.mod;static #eO=this.isImageContent=e=>e instanceof rR&&"image"===e.mod;static #eR=this.isVideoContent=e=>e instanceof rS&&"video"===e.mod}function is(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function ia(e,n){return function(r,i){n(r,i,e)}}class ic{constructor(e){var n=this;this.opts=e,this.beans=[],this.currentConversation=null,this.aiWorkerConversationFormatters=[],this.add=e=>{this.beans.push(e)},this.addBySnapshot=function(){let e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};switch(r.type){case"client":e=new rl(r,n.opts);break;case"aiWorker":e=new io(r,n.opts);break;default:throw Error(`Unknown conversation type: ${r.type}`)}return n.beans.push(e),e},this.setCurrentConversation=e=>{this.currentConversation=e},this.clear=()=>{this.beans=[]},this.toJSON=()=>this.beans.map(e=>e.toJSON()),this.dispose=()=>{for(let e of this.beans)e.dispose();this.beans=[],this.currentConversation=null,this.aiWorkerConversationFormatters=[]},this.registerAIWorkerConversationFormatter=e=>{this.aiWorkerConversationFormatters.push(e)},this.runAIWorkerConversationFormatters=e=>{let n=e;for(let e of this.aiWorkerConversationFormatters)n=e(n);return n},this.interruptAll=()=>{for(let e of this.beans)e.interrupt()}}get last(){var e;return null!=(e=this.beans[this.beans.length-1])?e:null}get currentClientConversation(){return ic.isClientConversation(this.currentConversation)?this.currentConversation:null}get currentAIWorkerConversation(){return ic.isAIWorkerConversation(this.currentConversation)?this.currentConversation:null}static isClientConversation(e){return(null==e?void 0:e.type)==="client"}static isAIWorkerConversation(e){return(null==e?void 0:e.type)==="aiWorker"}}ic=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eb(),ia(0,eg(tJ.IOptions)),ia(0,eR()),is("design:type",Function),is("design:paramtypes",["undefined"==typeof IResolvedOptions?Object:IResolvedOptions])],ic);var il=r("../../node_modules/abort-signal-polyfill/dist/staticMethods/any.js"),iu=r("../../node_modules/abort-signal-polyfill/dist/staticMethods/timeout.js"),id=r("../../node_modules/abort-signal-polyfill/dist/staticMethods/abort.js");let ip=(e,n)=>{e in AbortSignal||Object.defineProperty(AbortSignal,e,{value:n,configurable:!0,writable:!0})};var ih=function(){return(ih=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)},im=r("../../node_modules/@baidu/weirwood-perf/esm/index.js"),ig=function(){return(ig=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function iv(e){var n="function"==typeof Symbol&&Symbol.iterator,r=n&&e[n],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function iy(){for(var e=[],n=0;n<arguments.length;n++)e=e.concat(function(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,o,s=r.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(i=s.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return a}(arguments[n]));return e}function ib(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return e instanceof Error}}function i_(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)}function iw(e){return void 0===e}function iO(e){return"function"==typeof e}function iR(e){return"[object String]"===Object.prototype.toString.call(e)}function iS(e){return"[object Number]"===Object.prototype.toString.call(e)}function iE(e){return"[object Array]"===Object.prototype.toString.call(e)}function iT(e){return"[object Object]"===Object.prototype.toString.call(e)}function iM(e){if(!iT(e))return!1;for(var n in e)if(e.hasOwnProperty(n))return!1;return!0}var ix={};function iC(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:ix}var iI=iC(),ij={wrap:function(){return function(){}},report:!1,collectWindowErrors:!1,computeStackTrace:!1,remoteFetching:!1,linesOfContext:!1,extendToAsynchronousCallbacks:!1},iA=[].slice,iB=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function ik(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function iP(){return"undefined"==typeof document||null==document.location?"":document.location.href}ij.wrap=function(e){return function(){try{return e.apply(this,arguments)}catch(e){throw ij.report(e),e}}},ij.report=function(){var e,n,r,i,o=[],s=null,a=null;function c(e,n,r,i,s,a){var c=null;if(!n||ij.collectWindowErrors){for(var l in o)if(ik(o,l))try{o[l](e,n,r,i,s,a)}catch(e){c=e}if(c)throw c}}function l(n,r,i,o,s){var l=null;if(s=i_(s)?s.error:s,n=i_(n)?n.message:n,a)ij.computeStackTrace.augmentStackTraceWithInitialElement(a,r,i,n),d();else if(s&&ib(s))(l=ij.computeStackTrace(s)).mechanism="onerror",c(l,!0,s,r,i,o);else{var u,p={url:r,line:i,column:o},h=n;if("[object String]"===({}).toString.call(n)){var f=n.match(iB);f&&(u=f[1],h=f[2])}p.func=ij.computeStackTrace.guessFunctionName(p.url,p.line),p.context=ij.computeStackTrace.gatherContext(p.url,p.line),c(l={name:u,message:h,mode:"onerror",mechanism:"onerror",stack:[ig(ig({},p),{url:p.url||iP()})]},!0,null,r,i,o)}return!!e&&e.apply(this,arguments)}function u(e){var n=e&&(e.detail?e.detail.reason:e.reason)||e,r=ij.computeStackTrace(n);r.mechanism="onunhandledrejection",c(r,!0,n)}function d(){var e=a,n=s;a=null,s=null,c(e,!1,n)}function p(e){if(a)if(s===e)return;else d();var n=ij.computeStackTrace(e);throw a=n,s=e,setTimeout(function(){s===e&&d()},2e3*!!n.incomplete),e}return p.subscribe=function(e){o.push(e)},p.unsubscribe=function(s){for(var a=o.length-1;a>=0;--a)o[a]===s&&o.splice(a,1);0===o.length&&(n&&(iI.onerror=e,n=!1),i&&(iI.onunhandledrejection=r,i=!1))},p.installGlobalHandler=function(){!0!==n&&(e=iI.onerror,iI.onerror=l,n=!0)},p.installGlobalUnhandledRejectionHandler=function(){!0!==i&&(r=iI.onunhandledrejection,iI.onunhandledrejection=u,i=!0)},p}(),ij.computeStackTrace=function(){var e={};function n(n){if("string"!=typeof n)return[];if(!ik(e,n)){var r="",i="";try{i=iI.document.domain}catch(e){}var o=/(.*)\:\/\/([^:\/]+)([:\d]*)\/{0,1}([\s\S]*)/.exec(n);o&&o[2]===i&&(r=function(e){if(!ij.remoteFetching)return"";try{var n=function(){try{return new iI.XMLHttpRequest}catch(e){return new iI.ActiveXObject("Microsoft.XMLHTTP")}}();return n.open("GET",e,!1),n.send(""),n.responseText}catch(e){return""}}(n)),e[n]=r?r.split("\n"):[]}return e[n]}function r(e,r){var i,o=/function ([^(]*)\(([^)]*)\)/,s=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,a="",c=n(e);if(!c.length)return"?";for(var l=0;l<10;++l)if(!iw(a=c[r-l]+a)){if(i=s.exec(a))return i[1];else if(i=o.exec(a))return i[1]}return"?"}function i(e,r){var i=n(e);if(!i.length)return null;var o=[],s=Math.floor(ij.linesOfContext/2),a=s+ij.linesOfContext%2,c=Math.max(0,r-s-1),l=Math.min(i.length,r+a-1);r-=1;for(var u=c;u<l;++u)iw(i[u])||o.push(i[u]);return o.length>0?o:null}function o(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,"\\$&")}function s(e){return o(e).replace("<","(?:<|<)").replace(">","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function a(e,r){for(var i,o,s=0,a=r.length;s<a;++s)if((i=n(r[s])).length&&(i=i.join("\n"),o=e.exec(i)))return{url:r[s],line:i.substring(0,o.index).split("\n").length,column:o.index-i.lastIndexOf("\n",o.index)-1};return null}function c(e,r,i){var s,a=n(r),c=RegExp("\\b"+o(e)+"\\b");return(i-=1,a&&a.length>i&&(s=c.exec(a[i])))?s.index:null}function l(e){if(!e.stack)return null;for(var n,o,s,a,l=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,u=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,d=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,p=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,h=/\((\S*)(?::(\d+))(?::(\d+))\)/,f=e.stack.split("\n"),m=[],g=/^(.*) is undefined$/.exec(e.message),v=0,y=f.length;v<y;++v){if(s=l.exec(f[v])){var b=s[2]&&0===s[2].indexOf("native");s[2]&&0===s[2].indexOf("eval")&&(o=h.exec(s[2]))&&(s[2]=o[1]),a={url:b?null:s[2],func:s[1]||"?",args:b?[s[2]]:[],line:s[3]?+s[3]:null,column:s[4]?+s[4]:null}}else if(s=d.exec(f[v]))a={url:s[2],func:s[1]||"?",args:[],line:+s[3],column:s[4]?+s[4]:null};else{if(!(s=u.exec(f[v])))continue;s[3]&&s[3].indexOf(" > eval")>-1&&(o=p.exec(s[3]))?s[3]=o[1]:0!==v||s[5]||iw(e.columnNumber)||(m[0].column=e.columnNumber+1),a={url:s[3],func:s[1]||"?",args:s[2]?s[2].split(","):[],line:s[4]?+s[4]:null,column:s[5]?+s[5]:null}}if(!a.func&&a.line&&(a.func=r(a.url,a.line)),ij.remoteFetching&&a.url&&"blob:"===a.url.substr(0,5)){var _=new XMLHttpRequest;if(_.open("GET",a.url,!1),_.send(""),200===_.status){var w=_.responseText||"",O=(w=w.slice(-300)).match(/\/\/# sourceMappingURL=(.*)$/);if(O){var R=O[1];"~"===R.charAt(0)&&(R=("undefined"==typeof document||null==document.location?"":document.location.origin?document.location.origin:document.location.protocol+"//"+document.location.hostname+(document.location.port?":"+document.location.port:""))+R.slice(1)),a.url=R.slice(0,-4)}}}a.context=a.line?i(a.url,a.line):null,m.push(a)}return m.length?(m[0]&&m[0].line&&!m[0].column&&g&&(m[0].column=c(g[1],m[0].url,m[0].line)),{mode:"stack",name:e.name,message:e.message,stack:m}):null}function u(e,n,o,s){var a={url:n,line:o};if(a.url&&a.line){e.incomplete=!1,a.func||(a.func=r(a.url,a.line)),a.context||(a.context=i(a.url,a.line));var l=/ '([^']+)' /.exec(s);if(l&&(a.column=c(l[1],a.url,a.line)),e.stack.length>0&&e.stack[0].url===a.url){if(e.stack[0].line===a.line)return!1;else if(!e.stack[0].line&&e.stack[0].func===a.func)return e.stack[0].line=a.line,e.stack[0].context=a.context,!1}return e.stack.unshift(a),e.partial=!0,!0}return e.incomplete=!0,!1}function d(e,p){var h=null;p=null==p?0:+p;try{if(h=function(e){var n=e.stacktrace;if(n){for(var o,s=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,a=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,c=n.split("\n"),l=[],u=0;u<c.length;u+=2){var d=null;if((o=s.exec(c[u]))?d={url:o[2],line:+o[1],column:null,func:o[3],args:[]}:(o=a.exec(c[u]))&&(d={url:o[6],line:+o[1],column:+o[2],func:o[3]||o[4],args:o[5]?o[5].split(","):[]}),d){if(!d.func&&d.line&&(d.func=r(d.url,d.line)),d.line)try{d.context=i(d.url,d.line)}catch(e){}d.context||(d.context=[c[u+1]]),l.push(d)}}return l.length?{mode:"stacktrace",name:e.name,message:e.message,stack:l}:null}}(e))return h}catch(e){}try{if(h=l(e))return h}catch(e){}try{if(h=function(e){var o=e.message.split("\n");if(o.length<4)return null;var c,l=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,u=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,d=/^\s*Line (\d+) of function script\s*$/i,p=[],h=iI&&iI.document&&iI.document.getElementsByTagName("script"),f=[];for(var m in h)ik(h,m)&&!h[m].src&&f.push(h[m]);for(var g=2;g<o.length;g+=2){var v=null;if(c=l.exec(o[g]))v={url:c[2],func:c[3],args:[],line:+c[1],column:null};else if(c=u.exec(o[g])){v={url:c[3],func:c[4],args:[],line:+c[1],column:null};var y=+c[1],b=f[c[2]-1];if(b){var _=n(v.url);if(_){var w=(_=_.join("\n")).indexOf(b.innerText);w>=0&&(v.line=y+_.substring(0,w).split("\n").length)}}}else if(c=d.exec(o[g])){var O=iP().replace(/#.*$/,""),R=a(new RegExp(s(o[g+1])),[O]);v={url:O,func:"",args:[],line:R?R.line:c[1],column:null}}if(v){v.func||(v.func=r(v.url,v.line));var S=i(v.url,v.line),E=S?S[Math.floor(S.length/2)]:null;S&&E.replace(/^\s*/,"")===o[g+1].replace(/^\s*/,"")?v.context=S:v.context=[o[g+1]],p.push(v)}}return p.length?{mode:"multiline",name:e.name,message:o[0],stack:p}:null}(e))return h}catch(e){}try{if(h=function e(n,i){for(var l,p,h,f=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,m=[],g={},v=!1,y=e.caller;y&&!v;y=y.caller)if(y!==d&&y!==ij.report){if(p={url:null,func:"?",args:[],line:null,column:null},y.name?p.func=y.name:(l=f.exec(y.toString()))&&(p.func=l[1]),void 0===p.func)try{p.func=l.input.substring(0,l.input.indexOf("{"))}catch(e){}if(h=function(e){if(!iw(iI&&iI.document)){for(var n,r,i,c,l=[iP()],u=iI.document.getElementsByTagName("script"),d=""+e,p=0;p<u.length;++p){var h=u[p];h.src&&l.push(h.src)}if(i=/^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/.exec(d)){var f=i[1]?"\\s+"+i[1]:"",m=i[2].split(",").join("\\s*,\\s*");r=RegExp("function"+f+"\\s*\\(\\s*"+m+"\\s*\\)\\s*{\\s*"+(n=o(i[3]).replace(/;$/,";?"))+"\\s*}")}else r=new RegExp(o(d).replace(/\s+/g,"\\s+"));if(c=a(r,l))return c;if(i=/^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/.exec(d)){var g=i[1];if((c=a(r=RegExp("on"+g+"=[\\'\"]\\s*"+(n=s(i[2]))+"\\s*[\\'\"]","i"),l[0]))||(c=a(r=new RegExp(n),l)))return c}return null}}(y)){p.url=h.url,p.line=h.line,"?"===p.func&&(p.func=r(p.url,p.line));var b=/ '([^']+)' /.exec(n.message||n.description);b&&(p.column=c(b[1],h.url,h.line))}g[""+y]?v=!0:g[""+y]=!0,m.push(p)}i&&m.splice(0,i);var _={mode:"callers",name:n.name,message:n.message,stack:m};return u(_,n.sourceURL||n.fileName,n.line||n.lineNumber,n.message||n.description),_}(e,p+1))return h}catch(e){}return{original:e,name:e.name,message:e.message,mode:"failed"}}return d.augmentStackTraceWithInitialElement=u,d.computeStackTraceFromStackProp=l,d.guessFunctionName=r,d.gatherContext=i,d.ofCaller=function(e){e=(null==e?0:+e)+1;try{throw Error()}catch(n){return d(n,e+1)}},d.getSource=n,d}(),ij.extendToAsynchronousCallbacks=function(){var e=function(e){var n=iI[e];iI[e]=function(){var e=iA.call(arguments),r=e[0];return("function"==typeof r&&(e[0]=ij.wrap(r)),n.apply)?n.apply(this,e):n(e[0],e[1])}};e("setTimeout"),e("setInterval")},ij.remoteFetching=!1,ij.collectWindowErrors=!0,ij.linesOfContext=11,ij.report;var iN=ij.report.subscribe,iD=ij.report.unsubscribe,iL=ij.report.installGlobalHandler,iF=ij.report.installGlobalUnhandledRejectionHandler,iU=ij.computeStackTrace;function iH(e,n){var r=(65535&e)+(65535&n);return(e>>16)+(n>>16)+(r>>16)<<16|65535&r}function iq(e,n,r,i,o,s){var a;return iH((a=iH(iH(n,e),iH(i,s)))<<o|a>>>32-o,r)}function iV(e,n,r,i,o,s,a){return iq(n&r|~n&i,e,n,o,s,a)}function iX(e,n,r,i,o,s,a){return iq(n&i|r&~i,e,n,o,s,a)}function iW(e,n,r,i,o,s,a){return iq(n^r^i,e,n,o,s,a)}function i$(e,n,r,i,o,s,a){return iq(r^(n|~i),e,n,o,s,a)}function iz(e,n){e[n>>5]|=128<<n%32,e[(n+64>>>9<<4)+14]=n;var r,i,o,s,a,c=0x67452301,l=-0x10325477,u=-0x67452302,d=0x10325476;for(r=0;r<e.length;r+=16)i=c,o=l,s=u,a=d,c=iV(c,l,u,d,e[r],7,-0x28955b88),d=iV(d,c,l,u,e[r+1],12,-0x173848aa),u=iV(u,d,c,l,e[r+2],17,0x242070db),l=iV(l,u,d,c,e[r+3],22,-0x3e423112),c=iV(c,l,u,d,e[r+4],7,-0xa83f051),d=iV(d,c,l,u,e[r+5],12,0x4787c62a),u=iV(u,d,c,l,e[r+6],17,-0x57cfb9ed),l=iV(l,u,d,c,e[r+7],22,-0x2b96aff),c=iV(c,l,u,d,e[r+8],7,0x698098d8),d=iV(d,c,l,u,e[r+9],12,-0x74bb0851),u=iV(u,d,c,l,e[r+10],17,-42063),l=iV(l,u,d,c,e[r+11],22,-0x76a32842),c=iV(c,l,u,d,e[r+12],7,0x6b901122),d=iV(d,c,l,u,e[r+13],12,-0x2678e6d),u=iV(u,d,c,l,e[r+14],17,-0x5986bc72),l=iV(l,u,d,c,e[r+15],22,0x49b40821),c=iX(c,l,u,d,e[r+1],5,-0x9e1da9e),d=iX(d,c,l,u,e[r+6],9,-0x3fbf4cc0),u=iX(u,d,c,l,e[r+11],14,0x265e5a51),l=iX(l,u,d,c,e[r],20,-0x16493856),c=iX(c,l,u,d,e[r+5],5,-0x29d0efa3),d=iX(d,c,l,u,e[r+10],9,0x2441453),u=iX(u,d,c,l,e[r+15],14,-0x275e197f),l=iX(l,u,d,c,e[r+4],20,-0x182c0438),c=iX(c,l,u,d,e[r+9],5,0x21e1cde6),d=iX(d,c,l,u,e[r+14],9,-0x3cc8f82a),u=iX(u,d,c,l,e[r+3],14,-0xb2af279),l=iX(l,u,d,c,e[r+8],20,0x455a14ed),c=iX(c,l,u,d,e[r+13],5,-0x561c16fb),d=iX(d,c,l,u,e[r+2],9,-0x3105c08),u=iX(u,d,c,l,e[r+7],14,0x676f02d9),l=iX(l,u,d,c,e[r+12],20,-0x72d5b376),c=iW(c,l,u,d,e[r+5],4,-378558),d=iW(d,c,l,u,e[r+8],11,-0x788e097f),u=iW(u,d,c,l,e[r+11],16,0x6d9d6122),l=iW(l,u,d,c,e[r+14],23,-0x21ac7f4),c=iW(c,l,u,d,e[r+1],4,-0x5b4115bc),d=iW(d,c,l,u,e[r+4],11,0x4bdecfa9),u=iW(u,d,c,l,e[r+7],16,-0x944b4a0),l=iW(l,u,d,c,e[r+10],23,-0x41404390),c=iW(c,l,u,d,e[r+13],4,0x289b7ec6),d=iW(d,c,l,u,e[r],11,-0x155ed806),u=iW(u,d,c,l,e[r+3],16,-0x2b10cf7b),l=iW(l,u,d,c,e[r+6],23,0x4881d05),c=iW(c,l,u,d,e[r+9],4,-0x262b2fc7),d=iW(d,c,l,u,e[r+12],11,-0x1924661b),u=iW(u,d,c,l,e[r+15],16,0x1fa27cf8),l=iW(l,u,d,c,e[r+2],23,-0x3b53a99b),c=i$(c,l,u,d,e[r],6,-0xbd6ddbc),d=i$(d,c,l,u,e[r+7],10,0x432aff97),u=i$(u,d,c,l,e[r+14],15,-0x546bdc59),l=i$(l,u,d,c,e[r+5],21,-0x36c5fc7),c=i$(c,l,u,d,e[r+12],6,0x655b59c3),d=i$(d,c,l,u,e[r+3],10,-0x70f3336e),u=i$(u,d,c,l,e[r+10],15,-1051523),l=i$(l,u,d,c,e[r+1],21,-0x7a7ba22f),c=i$(c,l,u,d,e[r+8],6,0x6fa87e4f),d=i$(d,c,l,u,e[r+15],10,-0x1d31920),u=i$(u,d,c,l,e[r+6],15,-0x5cfebcec),l=i$(l,u,d,c,e[r+13],21,0x4e0811a1),c=i$(c,l,u,d,e[r+4],6,-0x8ac817e),d=i$(d,c,l,u,e[r+11],10,-0x42c50dcb),u=i$(u,d,c,l,e[r+2],15,0x2ad7d2bb),l=i$(l,u,d,c,e[r+9],21,-0x14792c6f),c=iH(c,i),l=iH(l,o),u=iH(u,s),d=iH(d,a);return[c,l,u,d]}function iG(e){var n,r="",i=32*e.length;for(n=0;n<i;n+=8)r+=String.fromCharCode(e[n>>5]>>>n%32&255);return r}function iY(e){var n,r=[];for(n=0,r[(e.length>>2)-1]=void 0;n<r.length;n+=1)r[n]=0;var i=8*e.length;for(n=0;n<i;n+=8)r[n>>5]|=(255&e.charCodeAt(n/8))<<n%32;return r}function iQ(e){var n,r,i="0123456789abcdef",o="";for(r=0;r<e.length;r+=1)o+=i.charAt((n=e.charCodeAt(r))>>>4&15)+i.charAt(15&n);return o}function iJ(e){return unescape(encodeURIComponent(e))}function iK(e){var n;return iG(iz(iY(n=iJ(e)),8*n.length))}function iZ(e,n){return function(e,n){var r,i,o=iY(e),s=[],a=[];for(s[15]=a[15]=void 0,o.length>16&&(o=iz(o,8*e.length)),r=0;r<16;r+=1)s[r]=0x36363636^o[r],a[r]=0x5c5c5c5c^o[r];return i=iz(s.concat(iY(n)),512+8*n.length),iG(iz(a.concat(i),640))}(iJ(e),iJ(n))}function i0(e,n,r){if(!n)return r?iK(e):iQ(iK(e));return r?iZ(n,e):iQ(iZ(n,e))}function i1(e){return(e||"").replace(/#.*$/,"").replace(/\?.*$/,"")}function i2(){if(!("fetch"in iC()))return!1;try{return new Headers,new Request(""),new Response,!0}catch(e){return!1}}function i3(e,n){for(var r=0;r<e.length;++r)if(e[r]===n)return r;return -1}function i6(e,n,r,i){var o,s,a,c;return JSON.stringify(e,(o=n,a=[],c=[],null==(s=i)&&(s=function(e,n){return a[0]===n?"[Circular ~]":"[Circular ~."+c.slice(0,i3(a,n)).join(".")+"]"}),function(e,n){if(a.length>0){var r=i3(a,this);~r?a.splice(r+1):a.push(this),~r?c.splice(r,1/0,e):c.push(e),~i3(a,n)&&(n=s.call(this,e,n))}else a.push(n);return null==o?n instanceof Error?function(e){var n={stack:e.stack,message:e.message,name:e.name};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(n):n:o.call(this,e,n)}),r)}function i5(e,n){if(Array.isArray(e))for(var r=e.length,i=0;i<r;i++)n.call(null,i,e[i]);else for(var o in e)Reflect.has(e,o)&&n.call(null,o,e[o])}function i4(e){var n={};for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];n[r]=iO(i)?i():i}return n}function i8(e){return iR(e)?i9(e,40):iS(e)||"[object Boolean]"===Object.prototype.toString.call(e)||iw(e)?e+"":iT(e)?"[Object]":iE(e)?"[Array]":iO(e)?e.name?"[Function: "+e.name+"]":"[Function]":e}function i9(e,n){return 0===n||e.length<=n?e:e.substr(0,n)+"…"}function i7(e){var n={protocol:"",host:"",path:"",relative:""};if("string"!=typeof e)return n;var r=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(r&&r.length){var i=r[6]||"",o=r[8]||"";return{protocol:r[2]||"",host:r[4]||"",path:r[5]||"",relative:(r[5]||"")+i+o}}return n}function oe(e){var n=e.exception,r=[];return r.push("token="+n.token),r.push("type="+n.type),r.push("mechanism="+n.mechanism),r.push("value="+n.value),r.push("url="+n.url),n.stacktrace&&n.stacktrace.forEach(function(e){r.push("filename="+e.filename),r.push("lineno="+e.lineno),r.push("colno="+e.colno)}),r.join("***")}function ot(e){return e&&Array.isArray(e)&&e.length>0}function on(e){for(var n=[],r=e.length,i=0;i<r;i++){var o=e[i];iR(o)?n.push(o.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):o&&o.source&&n.push(o.source)}return RegExp(n.join("|"),"i")}function or(e,n){return!!iR(n)&&e.some(function(e){if(!e)return!1;if(iR(e))return -1!==n.indexOf(e);if("[object RegExp]"===Object.prototype.toString.call(e))try{return e.test(n)}catch(n){return console.error(e+"正则书写有误"),!1}return console.error(e+"忽略匹配项类型应该是String、RegExp"),!1})}function oi(e){return(iR(e)?e:JSON.stringify(e)).slice(0,256)}function oo(e,n,r){var i,o,s=[];if(e.stack&&e.stack.length){try{for(var a=iv(e.stack),c=a.next();!c.done;c=a.next()){var l=c.value,u=function(e,n,r){var i={filename:e.url||n,lineno:e.line,colno:e.column,function:e.func||"?"};if(r&&r.length>0){var o=on(r).test(i.filename),s=/(Weirwood|Tracekit)/.test(i.function),a=/weirwood\-sdk/.test(i.filename);i.in_app=o,(s||a)&&(i.in_app=!1)}else i.in_app=!1;return i}(l,e.url||"",n.includePaths);s.push(u)}}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}if(n&&n.trimHeadFrames)for(var d=0;d<n.trimHeadFrames&&d<s.length;d++)s[d].in_app=!1}return(s=s.filter(function(e){var n,r,i;return r=-1!==(n=e.filename||"").indexOf("weirwood-sdk"),i=/captureException$/.test(n),!r&&!i})).slice(0,r)}function os(e,n,r,i){if(null!=e){var o=e[n];return e[n]=r(o),e[n].__raven__=!0,e[n].__orig__=o,o.__raven_wrapper__=e[n],i&&i.push([e,n,o]),e[n]}}function oa(e,n,r){if(void 0===e&&(e={}),iw(n)&&!iO(e))return e;if(iO(e)&&(n=e,e=void 0),!iO(n))return n;try{if(n.__raven__)return n;if(n.__raven_wrapper__)return n.__raven_wrapper__}catch(e){return n}function i(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var s=[],a=i.length,c=!e||e&&!1!==e.deep;for(r&&iO(r)&&r.apply(this,i);a--;)s[a]=c?oa(e,i[a]):i[a];try{return n.apply(this,s)}catch(e){throw e}}for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o]);return i.prototype=n.prototype,n.__raven_wrapper__=i,i.__raven__=!0,i.__orig__=n,i}function oc(e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=n[0];return(iO(i)&&(n[0]=oa({mechanism:{type:"instrument",data:{function:(null==e?void 0:e.name)||"<anonymous>"}}},i)),e.apply)?e.apply(this,n):e(n[0],n[1])}}function ol(e,n){return function(r){if(S=void 0,E!==r){E=r;try{i=function(e){for(var n,r=[],i=0,o=0;e&&i++<5;){var s="html"===(n=function(e){if(!e||!e.tagName)return"";var n,r,i,o,s=[e.tagName.toLowerCase()];e.id&&s.push("#"+e.id);var a=e.className?e.className.split(/\s+/):[];try{for(var c=iv(a),l=c.next();!l.done;l=c.next()){var u=l.value;s.push("."+u)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}try{for(var d=iv(["type","name","title","alt"]),p=d.next();!p.done;p=d.next()){var h=p.value,f=e.getAttribute(h);f&&s.push("["+h+"="+f+"]")}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}return s.join("")}(e)),a=i>1&&o+3*r.length+n.length>=80;if(s||a)break;r.push(n),o+=n.length,e=e.parentNode}return r.reverse().join(" > ")}(r.target)}catch(e){i="<unknown>"}if(i){var i,o={category:"ui."+n,message:i,name:n};"input"===n&&"password"!==i.type&&(o.data=r.target.value||""),e.captureBehavior(o)}}}}function ou(e){return function(n){try{r=n.target}catch(e){return}var r,i=r&&r.tagName;i&&("INPUT"===i||"TEXTAREA"===i||r.isContentEditable)&&(S||ol(e,"input")(n),clearTimeout(S),S=setTimeout(function(){S=void 0},1e3))}}r("../../node_modules/@baidu/weirwood-error/esm/plugins/Plugin.js");var od=iC(),op=[301,302,304],oh=function(){function e(n){this.name=e.id,this.options=ig({beacon:!0,console:!0,dom:!0,fetch:!0,history:!0,weirwood:!0,xhr:!0},n)}return e.prototype.setupOnce=function(e){this.client=e;var n,r,i=Object.keys(this.options);try{for(var o=iv(i),s=o.next();!s.done;s=o.next()){var a=s.value,c="instrument"+a[0].toUpperCase()+a.slice(1);this.options[a]&&this[c]&&"function"==typeof this[c]&&this[c].call(this)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},e.prototype.instrumentDom=function(){if("document"in iC()){var e=od.document;e.addEventListener("click",ol.call(this,this.client,"click"),!1),e.addEventListener("keypress",ou.call(this,this.client),!1)}},e.prototype.instrumentXhr=function(){var e=this.client,n=e.options,r=n.collectAutoAPIException,i=n.isApiException;if("XMLHttpRequest"in od){var o=XMLHttpRequest.prototype,s=e._globalKey||"";os(o,"open",function(e){return function(n,r){return iR(r)&&-1===r.indexOf(s)&&(this.__raven_xhr={method:n,url:r,status_code:null}),e.apply(this,arguments)}},e._wrappedBuiltIns),os(o,"abort",function(e){return function(){return this.__raven_xhr&&(this.__raven_xhr.abortedFlag=!0),e.apply(this,arguments)}},e._wrappedBuiltIns),os(o,"send",function(n){return function(){var o=this,s=arguments;function a(){if(o.__raven_xhr&&4===o.readyState){try{o.__raven_xhr.status_code=o.status}catch(e){}var n=function(e,n){if(void 0===e&&(e=""),void 0===n&&(n=""),(""===e||"text"===e)&&iR(n)&&n.length)try{return JSON.parse(n)}catch(e){return n}return"json"===e?JSON.parse(JSON.stringify(n)):""}(o.responseType,o.response);if((e.captureBehavior({type:"http",category:"xhr",data:ig(ig({},o.__raven_xhr),{response:oi(n),params:oi(s&&s[0]?s[0]:"")})}),r)&&(!o.__raven_xhr||!o.__raven_xhr.abortedFlag)){var a=!1,c=o.status>=200&&o.status<=299,l=-1!==op.indexOf(o.status);if(c||l||(a=!0),c&&i&&iO(i)&&(a=!!i({method:o.__raven_xhr.method,url:o.responseURL,status:o.status,responseType:o.responseType,response:n})),a){var u="";iO(o.getAllResponseHeaders)&&(u=o.getAllResponseHeaders().trim().replace(/[\r\n]+/g,"***")),e.captureAPIException({url:o.responseURL||o.__raven_xhr.url,method:o.__raven_xhr.method,params:s&&s[0]?s[0]:"",status:o.status,response:(iR(n)?n:JSON.stringify(n)).slice(0,8192),responseHeaders:u,user:"",extra:"AUTO_XHR"})}}}}for(var c=["onload","onerror","onprogress"],l=0;l<c.length;l++)!function(e,n){e in n&&iO(n[e])&&os(n,e,function(n){return oa({mechanism:{data:{function:e,handler:n&&n.name||"<anonymous>"},handled:!0,type:"instrument"}},n)})}(c[l],o);return"onreadystatechange"in o&&iO(o.onreadystatechange)?os(o,"onreadystatechange",function(e){return oa({mechanism:{type:"instrument",data:{function:"onreadystatechange",handler:e&&e.name||"<anonymous>"}}},e,a)}):o.onreadystatechange=a,n.apply(this,arguments)}},e._wrappedBuiltIns)}},e.prototype.instrumentFetch=function(){if(i2()){var e=iC(),n=this.client,r=n.options,i=r.collectAutoAPIException,o=r.isApiException,s=n._globalKey;os(od,"fetch",function(r){return function(){for(var a,c=Array(arguments.length),l=0;l<c.length;++l)c[l]=arguments[l];var u=c[0],d="GET";if("string"==typeof u?a=u:"Request"in e&&u instanceof e.Request?(a=u.url,(null==u?void 0:u.method)&&(d=u.method)):a=""+u,-1!==a.indexOf(s))return r.apply(this,c);c[1]&&c[1].method&&(d=c[1].method);var p={method:d,url:a,status_code:null};return r.apply(this,c).then(function(e){p.status_code=e.status;var r,s,a="";c[1]&&c[1].body&&(a=c[1].body);var l=iO(e.clone)?e.clone():null,u={type:"http",category:"fetch",data:ig(ig({},p),{params:oi(a),response:""})};if(l?l.text().then(function(e){var r;try{r=JSON.parse(e)}catch(n){r=e}u.data.response=oi(r),n.captureBehavior(u)}):n.captureBehavior(u),!i)return e;var d=!1,h=iO(e.clone)?e.clone():null,f=op.includes(e.status);e.ok||f||(d=!0);var m={method:p.method,url:p.url,status:e.status,response:""},g=[];try{for(var v=iv(e.headers.entries()),y=v.next();!y.done;y=v.next()){var b=y.value;g.push(b[0]+": "+b[1])}}catch(e){r={error:e}}finally{try{y&&!y.done&&(s=v.return)&&s.call(v)}finally{if(r)throw r.error}}var _=ig(ig({},m),{params:a,responseHeaders:g.join("***"),user:"",extra:"AUTO_FETCH"});return h?h.text().then(function(r){var i;try{i=JSON.parse(r)}catch(e){i=r}e.ok&&iO(o)&&(d=!!o(ig(ig({},m),{response:i}))),d&&n.captureAPIException(ig(ig({},_),{response:r.slice(0,8192)}))}).catch(function(e){console.error(e)}):(e.ok&&iO(o)&&(d=!!o(m)),d&&n.captureAPIException(_)),e}).catch(function(e){throw n.captureBehavior({type:"http",category:"fetch",data:p,level:"error"}),e})}},n._wrappedBuiltIns)}},e.prototype.instrumentHistory=function(){var e,n,r,i,o=this.client;if(r=(n=(e=iC()).chrome)&&n.app&&n.app.runtime,i="history"in e&&!!e.history.pushState&&!!e.history.replaceState,!r&&i){var s=function(e,n){var r=i7(od.location.href),i=i7(n),s=i7(e);s.path||(s=r),T=n,r.protocol===i.protocol&&r.host===i.host&&(n=i.relative),r.protocol===s.protocol&&r.host===s.host&&(e=s.relative),o.captureBehavior({category:"navigation",data:{from:e,to:n}})},a=od.onpopstate;od.onpopstate=function(e){var n=od.location.href;if(s(T,n),a)return a.apply(od,e)},os(od.history,"pushState",c),os(od.history,"replaceState",c)}function c(e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=n.length>2?n[2]:void 0;return i&&s(T,String(i)),e.apply(this,n)}}},e.prototype.instrumentConsole=function(){},e.prototype.instrumentBeacon=function(){},e.id="behaviors",e}(),of=iC(),om=function(){function e(n){this.name=e.id,this.options=ig({active:!0},n)}return e.prototype.setupOnce=function(e){this.client=e,this.options.active&&os(of,"setTimeout",oc,this.client._wrappedBuiltIns)},e.id="trycatch",e}(),og=iC(),ov=function(){function e(){this.name=e.id}return e.prototype.setupOnce=function(e){this.client=e,this.client.captureUserAgent(this.getUserAgent())},e.prototype.getUserAgent=function(){return"navigator"in og&&"document"in og?{url:og.location.href,headers:{"User-Agent":og.navigator.userAgent,Referrer:og.document.referrer}}:{}},e.id="UserAgent",e}(),oy={collectWindowErrors:!0,collectUnhandledRejections:!0,collectResourceLoadErrors:!1,collectAutoAPIException:!0,sampleRate:1,maxUrlLength:250,maxMessageLength:0,allowDuplicates:!1,stackTraceLimit:50,behaviorLimit:10,plugins:[],ignoreErrors:[],ignoreKeys:[],whitelistUrls:[],apiWhitelistUrls:[],resourceWhitelistUrls:[],ignoreUrls:[],ignoreJsUrls:[],ignoreApiUrls:[],ignoreApiStatus:[],ignoreResourceUrls:[],maxMessagePerMinute:10,endpoint:"https://fclog.baidu.com/log/weirwood?type=error"},ob="https://dmpstatic.cdn.bcebos.com/weirwood",o_=function(){function e(e){this.options=oy,this._globalContext={env:{},user:{},session_id:""},this._globalKey="fclog.baidu.com/log",this._currentExceptionContext={},this._currentExceptionStartTime=Date.now(),this._behaviors=[],this._lastData=null,this._lastAPIData=null,this._messagesSendLastMinute=0,this._messagesSendEmptyStartTime=Date.now(),this._installed=!1,this._globalErrorHandler=null,this._fetchDefaults={method:"POST",credentials:"include",referrerPolicy:!function(){if(!i2())return!1;try{return new Request("pickleRick",{referrerPolicy:"origin"}),!0}catch(e){return!1}}()?"":"origin"},this._wrappedBuiltIns=[],this._requestInfo=null,e&&this.config(e)}return e.prototype.init=function(e){return this.config(e)},e.prototype.config=function(e){this.options=ig(ig({},this.options),e),this.options.sendWindow=this.options.sendWindow||iC(),this._globalContext.session_id=this.options.uuid4();var n=this.options,r=n.token,i=n.buildid;if(!r||!i)throw Error("error: token and buildid must be provided");return this.setFilters(),this.install(),this},e.prototype.install=function(){var e,n=this;return this._installed?(console.error("error: Weirwood Error SDK has been installed and configured"),!1):(this.options.collectWindowErrors&&iL(),this.options.maxMessagePerMinute>=60&&(this.options.maxMessagePerMinute=60),this.options.collectUnhandledRejections&&iF(),this._globalErrorHandler=this._getErrorHandler().bind(this),iN(this._globalErrorHandler),this.options.collectResourceLoadErrors&&(e=function(e){if(window.performance&&window.performance.getEntriesByName){var r,i=window.performance.getEntriesByName(e.asset);i.length>0&&(r=i[0],["name","serverTiming"].forEach(function(e){delete r[e]}))}var o={mechanism:e.type,name:"ResourceError",message:e.asset,stack:[],mode:"onerror",timing:r,page:e.page,element:e.element,elementPath:e.path.slice(0,255)};n._handleStackInfo(o,{trimHeadFrames:0,mechanism:o.mechanism||"generic",includePaths:n.options.includePaths})},window.addEventListener("error",function(n){if(n&&n.target&&n.target!==window){var r,i=n.target,o=null!=(r=null==i?void 0:i.tagName)?r:"unknown tagname";if(-1!==["SCRIPT","LINK","IMG"].indexOf(o)){var s=i.src||i.href,a=window.location.href,c=function(e){for(var n=e.path||[],r="",i=0;i<n.length;i++){var o=n[i];if(o===window){r+="Window";continue}r+=o.nodeName,r+=o.id?"#"+o.id:"",r+=o.className?"."+o.className.split(" ").join("."):"",i<n.length&&(r+=" > ")}return r}(n),l={type:o,asset:i1(s)===i1(a)?"空资源":s,integrity:i.integrity,element:i&&i.outerHTML&&i.outerHTML.replace(/"/g,""),path:c.replace(/"/g,""),page:window.location.href.slice(0,255)};e&&e(l)}}},!0)),this._installed=!0,this.installPlugins(),this)},e.prototype.installPlugins=function(){var e,n;this.options.plugins=iy([new oh(this.options.behaviorOptions),new om(this.options.tryCatchOptions),new ov],this.options.plugins||[]);try{for(var r=iv(this.options.plugins),i=r.next();!i.done;i=r.next())i.value.setupOnce(this)}catch(n){e={error:n}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},e.prototype.setFilters=function(){var e=this.options;e.ignoreErrors&&(e.ignoreErrors=iy([/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,'{"isTrusted":true}','{"isTrusted":false}',"Network Error","ResizeObserver loop"],e.ignoreErrors||[])),e.ignoreJsUrls=iy(["chrome-extension","safari-extension","moz-extension",ob],e.ignoreJsUrls||[])},e.prototype._getErrorHandler=function(){var e=this;return function(n,r,i,o,s,a){if(i&&(i.stack||i.stacktrace)&&(n.originalStack=((i.stack||i.stacktrace)+"").slice(0,1e4)),n.stack&&!n.stack.length&&o&&(n.stack[0]={url:o,line:s,column:a}),!n.name&&!n.message&&"onunhandledrejection"===n.mechanism){var c=iC();n.name="unhandledrejection",n.url=n.url||c.location.href,n.message=i}e._handleStackInfo(n,{trimHeadFrames:0,mechanism:n.mechanism||"generic",includePaths:e.options.includePaths})}},e.prototype._handleStackInfo=function(e,n){var r=oo(e,n,this.options.stackTraceLimit);this._processException(e,r,n)},e.prototype._processException=function(e,n,r){var i=this.options,o=i.ignoreErrors,s=void 0===o?[]:o,a=i.ignoreKeys,c=void 0===a?[]:a,l=i.whitelistUrls,u=void 0===l?[]:l,d=i.resourceWhitelistUrls,p=void 0===d?[]:d,h=i.ignoreUrls,f=void 0===h?[]:h,m=i.ignoreJsUrls,g=void 0===m?[]:m,v=i.ignoreResourceUrls,y=void 0===v?[]:v,b=e.name,_=e.message,w=e.url,O=void 0===w?"":w,R=e.page,S=void 0===R?window.location.href:R,E=e.lineno,T=e.originalStack;if(!(s.length&&or(s,_)||f.length&&or(f,S))){var M=n&&n.length&&n[0].filename||O;if("ResourceError"===b){if(y.length&&or(y,_)||p.length&&!or(p,_))return}else if(c.length&&or(c,b)||g.length&&or(g,M)||u.length&&!or(u,M))return;if(n&&n.length>0){var x=n[0].filename||"",C=-1!==x.indexOf("@baidu/weirwood-error"),I=-1!==x.indexOf(ob);if(C||I)return}if(-1===M.indexOf(ob)){var j,A=(j=void 0===E?0:E,n&&n.length?n.reverse():O?[{filename:O,lineno:j||0,in_app:!0}]:[]),B=ig(ig({},r),{exception:{type:b,value:_,originalStack:void 0===T?"":T,stacktrace:A,url:"ResourceError"===b?_:M,page:e.page,element:e.element,timing:e.timing,elementPath:e.elementPath}}),k=B.exception;null==k.type&&""===k.value&&(k.value="Unrecoverable error caught"),!B.exception.mechanism&&B.mechanism&&(B.exception.mechanism=B.mechanism,delete B.mechanism),this._send(B)}}},e.prototype.mergeGlobalContext=function(e){var n,r,i,o=iC();e.env=ig(ig(ig({},this._globalContext.env),e.env),{network:null==(i=o.navigator.connection)?void 0:i.effectiveType,windowHeight:(o.document.documentElement||o.document.body).clientHeight,windowWidth:(o.document.documentElement||o.document.body).clientWidth,documentTitle:o.document.title});try{for(var s=iv(Object.keys(this._currentExceptionContext)),a=s.next();!a.done;a=s.next()){var c=a.value;e.env[c]=this._currentExceptionContext[c]}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}e.env["session:duration"]=Date.now()-this._currentExceptionStartTime,this._globalContext.user&&(e.user=this._globalContext.user),this._globalContext.session_id&&(e.session_id=this._globalContext.session_id)},e.prototype._send=function(e){var n={request:this._requestInfo};if(iw(e.trimHeadFrames)||delete e.trimHeadFrames,e=ig(ig({},n),e),this.mergeGlobalContext(e),this._behaviors&&this._behaviors.length>0){var r=[].slice.call(this._behaviors,0);this.options.behaviorDataCallback&&(r=this.options.behaviorDataCallback(r)),e.behaviors=r}var i=this.options;if(i.token&&(e.token=i.token),i.buildid&&(e.buildid=i.buildid),Object.keys(e=this._sanitizeData(e)).forEach(function(n){(null==e[n]||""===e[n]||iM(e[n]))&&delete e[n]}),iO(i.dataCallback)&&(e=i.dataCallback(e)),!(!e||iM(e))){var o=Date.now()-this._messagesSendEmptyStartTime,s=this._messagesSendLastMinute>this.options.maxMessagePerMinute;if(o<6e4){if(s)return}else this._messagesSendEmptyStartTime=Date.now(),this._messagesSendLastMinute=1;"number"==typeof i.sampleRate?Math.random()<i.sampleRate&&(this._sendProcessedPayload(e),this._messagesSendLastMinute+=1):(this._sendProcessedPayload(e),this._messagesSendLastMinute+=1)}},e.prototype.isSetup=function(){return this._installed},e.prototype._trimPacket=function(e){var n,r,i=this.options.maxUrlLength||0,o=this.options.maxMessageLength||0;if(e.exception&&(e.exception.value=i9(e.exception.value,o)),e.request){var s=iC();e.request.url=i9(s.location.href,i);var a=e.request.headers.Referrer;e.request.headers.Referrer=i9(a,i)}if(e.behaviors&&e.behaviors.length){var c=["url","to","from"];try{for(var l=iv(e.behaviors),u=l.next();!u.done;u=l.next()){var d=u.value;!function(e){var n=e.data||{},r=function(e){n.hasOwnProperty(e)&&c.forEach(function(r){e===r&&(n[e]=i9(n[e],i))})};for(var o in n)r(o)}(d)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}return e},e.prototype._sendProcessedPayload=function(e,n){var r,i=this,o=this.options;if(e=this._trimPacket(e),!this.options.allowDuplicates&&this._isRepeatData(e))return void console.warn("Weirwood error SDK dropped repeat event:",e);var s=o.issueGroupby;s&&iO(s)&&(r=s(e.exception)),r&&iR(r)?(e.fingerprint=r.substr(0,255),e.event_id=i0(e.fingerprint)):e.event_id=i0(oe(e)),e.data_id=i0(function(e){var n=oe(e),r=[],i=e.request,o=e.env,s=e.behaviors;if(!i)return JSON.stringify(e);var a=i.headers,c=i.url;return r.push("Referrer="+a.Referrer),r.push("ua="+a["User-Agent"]),r.push("url="+c),i5(o,function(e,n){"session:duration"!==e&&r.push(e+"="+n)}),i5(s,function(e){r.push("behavior.category="+e.category),r.push("behavior.name="+e.name),r.push("behavior.message="+e.message)}),n+r.join("***")}(e)),e.version=this.options.version||"",e.sdkTimestamp=Date.now(),this._lastData=e;var a={weirwood_version:this.options.version||""};(o.transport||this._makeRequest).call(this,{url:this.options.endpoint,auth:a,data:e,options:o,onSuccess:function(){i._resetBackoff(),n&&n()},onError:function(e){e.request&&i._setBackoffState(e.request),e=e||Error("Raven send failed (no additional details provided)"),n&&n(e)}})},e.prototype._makeRequest=function(e){var n,r,i=this,o=e.url,s=null,a={};e.options.headers&&(s=i4(e.options.headers)),e.options.fetchParameters&&(a=i4(e.options.fetchParameters));var c=this.options.sendWindow;if(i2()){a.body=i6(e.data);var l=ig(ig({},this._fetchDefaults),a);if(s){var u=new Headers;try{for(var d=iv(Object.keys(s)),p=d.next();!p.done;p=d.next()){var h=p.value;u.append(h,s[h])}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}u.append("Content-Type","text/plain"),l.headers=u}return c.fetch(o,l).then(function(n){if(n.ok)e.onSuccess&&e.onSuccess(),i._resetBackoff();else{var r=Error("Weirwood error SDK error code: "+n.status);r.request=n,e.onError&&e.onError(r)}}).catch(function(){e.onError&&e.onError(Error("Weirwood error SDK error code: network unavailable")),i._resetBackoff()})}var f=c.XMLHttpRequest&&new c.XMLHttpRequest;f&&("withCredentials"in f||"undefined"!=typeof XDomainRequest)&&("withCredentials"in f?f.onreadystatechange=function(){if(4!==f.readyState)return void i._resetBackoff();if(200===f.status)e.onSuccess&&e.onSuccess();else if(e.onError){i._resetBackoff();var n=Error("Weirwood error SDK error code: "+f.status);n.request=f,e.onError(n)}}:(f=new XDomainRequest,o=o.replace(/^https?:/,""),e.onSuccess&&(f.onload=e.onSuccess),e.onError&&(f.onerror=function(){var n=Error("Weirwood error SDK error code: XDomainRequest");n.request=f,e.onError(n)})),f.open("POST",o),s&&i5(s,function(e,n){f.setRequestHeader(e,n)}),f.send(i6(e.data)))},e.prototype._sanitizeData=function(e){var n=this.options.sanitizeKeys||[];if(n.length){if(!Array.isArray(n)||Array.isArray(n)&&0===n.length)return e;var r,i=on(n);try{r=JSON.parse(i6(e))}catch(n){return e}return function e(n){return Array.isArray(n)?n.map(function(n){return e(n)}):iT(n)?Object.keys(n).reduce(function(r,o){return i.test(o)?r[o]="********":r[o]=e(n[o]),r},{}):n}(r)}return e},e.prototype.captureUserAgent=function(e){this._requestInfo=e},e.prototype.captureException=function(e,n){if(n||(n={trimHeadFrames:0,includePaths:[],mechanism:"generic",message:""}),ib(e));else if(i_(e))e=e.error;else if(iT(e))e=Error((n=this._getCaptureExceptionOptionsFromPlainObject(n,e)).message);else{if(r=e,"[object DOMException]"!==Object.prototype.toString.call(r))return this.captureMessage(e,ig(ig({},n),{stacktrace:!0,trimHeadFrames:n.trimHeadFrames+1}));var r,i=e.name||"DOMException",o=e.message?i+": "+e.message:i;return this.captureMessage(o,n)}try{n=ig({trimHeadFrames:0,mechanism:"generic",includePaths:this.options.includePaths||[]},n);var s=iU(e);this._handleStackInfo(s,n)}catch(n){if(e!==n)throw n}return this},e.prototype._isRepeatData=function(e){var n=this._lastData,r=e.exception,i=n?n.exception:{};return r.mechanism===i.mechanism&&r.type===i.type&&r.value===i.value&&r.url===i.url&&(0===r.stacktrace.length&&0===i.stacktrace.length||function(e,n){if(ot(e)&&ot(n)){var r,i,o=e.length;if(o!==n.length)return!1;for(var s=0;s<o;s++){if(r=e[s],i=n[s],r.filename!==i.filename||r.lineno!==i.lineno||r.colno!==i.colno||r.function!==i.function)return!1}return!0}return!1}(r.stacktrace,i.stacktrace))},e.prototype._resetBackoff=function(){this._currentExceptionStartTime=Date.now(),this._currentExceptionContext={}},e.prototype._setBackoffState=function(e){console.log(e)},e.prototype.captureMessage=function(e,n){void 0===n&&(n={});var r,i,o=this.options,s=o.ignoreErrors||[],a=o.ignoreKeys||[],c=o.whitelistUrls||[],l=o.ignoreUrls||[],u=o.ignoreJsUrls||[];if(!(s.length&&or(s,e))){try{throw Error(e)}catch(e){i=e}var d=iU(i),p=Array.isArray(d.stack)&&d.stack[1];(null==(r=null==p?void 0:p.func)?void 0:r.indexOf("captureException"))!==-1&&(p=d.stack[2]);var h=p&&p.url||"";if(!(l.length&&or(l,window.location.href)||a.length&&or(a,i.name)||u.length&&or(u,h))&&(!c.length||or(c,h))){n=ig(ig({},n),{trimHeadFrames:0,includePaths:o.includePaths}),n.trimHeadFrames+=1;var f=oo(d,n),m={exception:{mechanism:"manual",type:i.name,value:i.message,stacktrace:f.slice(1).reverse(),url:h}};return this._send(m),this}}},e.prototype.captureAPIException=function(e){var n,r=this,i=iC(),o=this.options,s=o.ignoreUrls,a=void 0===s?[]:s,c=o.ignoreApiUrls,l=void 0===c?[]:c,u=o.ignoreApiStatus,d=void 0===u?[]:u,p=o.buildid,h=o.token,f=o.version,m=o.apiWhitelistUrls;if(!(e.url&&e.method&&!iw(e.status)))return void console.error("API异常参数至少需要包含 method、url、status 参数。");if(!(a.length&&or(a,i.location.href)||l.length&&or(l,e.url))&&(!m.length||or(m,e.url))&&(!d.length||-1===d.indexOf(Number(e.status)))){var g=ig(ig({},e),{type:"APIError"}),v={request:{headers:{"User-Agent":i.navigator.userAgent},url:i.location.href},exception:g,buildid:p,token:h,version:f||""},y=this.options;if(iO(y.dataCallback)&&(v=y.dataCallback(v)),!(!v||iM(v))){this.mergeGlobalContext(v);var b=this.options.issueGroupby;if((b&&iO(b)&&(n=b(v.exception)),n&&iR(n))?(v.fingerprint=n.substr(0,255),v.event_id=i0(v.fingerprint)):v.event_id=i0(e.method+"***"+function(e){if(!iR(e))return"";var n=e.split("?");return n[1]?(n[1]=n[1].replace(/\d+/g,"*").replace(/[\u4e00-\u9fa5]+/gi,"*"),n.join("?")):e}(e.url)),v.data_id=i0(i6(v)),this._lastAPIData!==v.data_id){this._lastAPIData=v.data_id;var _=function(){var e;((null==(e=r.options.globalOptions)?void 0:e.transport)||r._makeRequest).call(r,{url:r.options.endpoint,data:v,options:{},onSuccess:function(){},onError:function(){}})};"number"==typeof y.sampleRate?Math.random()<y.sampleRate&&_():_()}}}},e.prototype.captureEvent=function(){},e.prototype.afterLoad=function(){var e=iC().RavenConfig;e&&this.init(e)},e.prototype._getCaptureExceptionOptionsFromPlainObject=function(e,n){var r=Object.keys(n).sort(),i=ig(ig({},e),{message:"Non-Error exception captured with keys: "+function(e,n){if(void 0===n&&(n=40),iS(e)||iR(e))return e.toString();if(!iE(e))return"";if(0===(e=e.filter(function(e){return iR(e)})).length)return"[object has no keys]";if(n=iS(n)?n:40,e[0].length>=n)return e[0];for(var r=e.length;r>0;r--){var i=e.slice(0,r).join(", ");if(!(i.length>n)){if(r===e.length)return i;return i+"…"}}return""}(r),fingerprint:[i0(r.join(""))],env:e&&e.env||{}});return i.env.__serialized__=function e(n,r,i){if(void 0===r&&(r=3),void 0===i&&(i=51200),!iT(n))return n+"";var o=function e(n,r){return 0===r?i8(n):iT(n)?Object.keys(n).reduce(function(i,o){return i[o]=e(n[o],r-1),i},{}):Array.isArray(n)?n.map(function(n){return e(n,r-1)}):i8(n)}(n,r);return~-encodeURI(JSON.stringify(i6(o))).split(/%..|./).length>i?e(n,r-1):o}(n),i},e.prototype.captureBehavior=function(e){var n=ig(ig({},e),{timestamp:Date.now()/1e3});if(iO(this.options.breadcrumbCallback)){var r=this.options.breadcrumbCallback(n);if("object"!=typeof r||null===r||iM(r)){if(!1===r)return this}else n=r}return this._behaviors.push(n),this._behaviors.length>(this.options.behaviorLimit||10)&&this._behaviors.shift(),this},e.prototype.setContext=function(e,n){for(var r in void 0===n&&(n={persist:!0}),e)Reflect.has(e,r)&&(n.persist?this._globalContext.env[r]=e[r]:this._currentExceptionContext[r]=e[r])},e.prototype.clearContext=function(){this._globalContext.env={},this._currentExceptionContext={}},e.prototype._restoreBuiltIns=function(){for(var e;this._wrappedBuiltIns.length;){var n=(e=this._wrappedBuiltIns.shift())[0],r=e[1],i=e[2];n[r]=i}},e.prototype.noConflict=function(){},e.prototype.uninstall=function(){this.dispose()},e.prototype.dispose=function(){iD(this._globalErrorHandler),this._restoreBuiltIns(),this._globalErrorHandler=null,this._installed=!1},e}(),ow={};function oO(){var e=window.crypto||window.msCrypto;if(void 0===e||!e.getRandomValues)return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)});var n=new Uint16Array(8);e.getRandomValues(n),n[3]=4095&n[3]|16384,n[4]=16383&n[4]|32768;var r=function(e){for(var n=e.toString(16);n.length<4;)n="0"+n;return n};return r(n[0])+r(n[1])+r(n[2])+r(n[3])+r(n[4])+r(n[5])+r(n[6])+r(n[7])}var oR=function(){function e(e){this.version="1.3.15",this.lastRouteTime=0,e&&this.init(e)}return e.prototype.init=function(e){var n,r,i,o,s=this.getSendWindow();if(!e.perf||e.perf&&!e.perf.disable){var a=ih(ih(ih({},e.perf),e.common),{version:this.version,sendWindow:s});this.perf=new im.PerfClient(a)}if(!e.error||e.error&&!e.error.disable){var c=ih(ih(ih({},e.error),e.common),{version:this.version,sendWindow:s,uuid4:oO});this.error=new o_(c)}this.routeChange(window.document.URL),n=this.routeChange.bind(this),"function"==typeof(r=window.history).pushState&&(i=r.pushState,r.pushState=function(e,r,o){return n(o),i.apply(this,arguments)}),"function"==typeof r.replaceState&&(o=r.replaceState,r.replaceState=function(e,r,i){return i!==window.document.URL&&n(i),o.apply(this,arguments)}),window.addEventListener("hashchange",function(e){n((e||{}).newURL)}),window.addEventListener("popstate",function(e){n(window.document.URL)})},e.prototype.routeChange=function(e){var n=new Date().getTime();if(n-this.lastRouteTime>100){this.lastRouteTime=n;var r=oO()+"-"+n;this.error&&this.error.setContext({pageId:r})}},e.prototype.getSendWindow=function(){var e="undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:ow;if(["fetch","ajax","sendBeacon"].some(function(e){var n;return!((n=window[e])&&n.toString&&!n.hasOwnProperty("toString")&&/\[native code\]/.test(String(n)))})&&document.body){var n=document.createElement("iframe");n.style.setProperty("display","none","important"),document.body.appendChild(n),e=n?n.contentWindow:e}return e},e.prototype.afterLoad=function(){},e}();function oS(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function oE(e,n){return function(r,i){n(r,i,e)}}!function(e){var n;(n=e.EMessageType||(e.EMessageType={}))[n.Query=0]="Query",n[n.Event=1]="Event"}(M||(M={}));class oT{constructor(e,n,r){this.opts=e,this.signalingService=n,this.errorManager=r,this.disabled=!1,this.mutedByUser=!1,this.muted=!1,this.emitter=new tY,this.started=!1,this.mute=e=>{this.signalingService.Mute(e),this.muted=e},this.setMutedByUser=e=>{this.mutedByUser=e},this.tryUnmuteAsr=()=>!this.disabled&&!this.mutedByUser&&(this.muted&&this.mute(!1),!0),this.disable=()=>{this.disabled=!0},this.enable=()=>{this.disabled=!1},this._stop=async()=>{this.started&&(await this.signalingService.Stop(),this.started=!1)},this._dispose=()=>{this.stop().finally(()=>{this.signalingService.Dispose()}).catch(rc),this.emitter.clearListeners()},this._ensureMicPermission=async()=>{var e;if("function"==typeof(null==(e=navigator.permissions)?void 0:e.query)){try{switch((await navigator.permissions.query({name:"microphone"})).state){case"granted":case"prompt":break;case"denied":this.errorManager.handleError(new nU("麦克风权限被浏览器/系统禁用,请检查后重试"))}}catch{await this._ensureMicPermissionPolyfill()}return}await this._ensureMicPermissionPolyfill()},this._ensureMicPermissionPolyfill=async()=>{try{(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop())}catch(e){e instanceof Error&&("NotAllowedError"===e.name||"SecurityError"===e.name?this.errorManager.handleError(new nU(`\u{7528}\u{6237}\u{62D2}\u{7EDD}\u{9EA6}\u{514B}\u{98CE}\u{6743}\u{9650}: ${e.message}`)):"NotFoundError"===e.name?this.errorManager.handleError(new nU(`\u{672A}\u{68C0}\u{6D4B}\u{5230}\u{9EA6}\u{514B}\u{98CE}\u{8BBE}\u{5907}: ${e.message}`)):this.errorManager.handleError(new nU(e.message)))}}}get sessionId(){return this.started?this.signalingService.GetSessionID():null}}function oM(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function ox(e,n){return function(r,i){n(r,i,e)}}oT=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eb(),oE(0,eg(tJ.IOptions)),oE(0,eR()),oE(1,eg(tJ.SignalingService)),oE(2,eg(tJ.ErrorManager)),oS("design:type",Function),oS("design:paramtypes",["undefined"==typeof IResolvedOptions?Object:IResolvedOptions,"undefined"==typeof BaseSignalingService?Object:BaseSignalingService,void 0===n4?Object:n4])],oT);class oC{static #B=this.GET_ACCESS_TOKEN_REQUEST_URI="employee-console/v1/access/r/ai-agent/get_digital_token";constructor(e,n,r){this.opts=e,this.request=n,this.errorManager=r,this.emitter=new tY,this._isRendering=!1,this._isMuted=!1,this._canInterrupt=!0,this.ssmlHandlers=[],this.token="",this.getAccessToken=async()=>{try{let{data:e}=await this.request.client.get(oC.GET_ACCESS_TOKEN_REQUEST_URI,{retry:3,timeout:15e3}).json();return e.authorization}catch(e){throw e instanceof Error&&this.errorManager.handleError(new nQ(e.message)),e}}}get isRendering(){return this._isRendering}get isMuted(){return this._isMuted}get canInterrupt(){return this._canInterrupt}setIsRendering(e){this._isRendering=e}setIsMuted(e){this._isMuted=e}setCanInterrupt(e){this._canInterrupt=e}registerSSMLHandler(e){return this.ssmlHandlers.push(e),this}runSsmlHandlers(e){let n=e;for(let e of this.ssmlHandlers)n=e(n);return n}}oC=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eb(),ox(0,eg(tJ.IOptions)),ox(1,eg(tJ.CommonRequest)),ox(2,eg(tJ.ErrorManager)),oM("design:type",Function),oM("design:paramtypes",["undefined"==typeof IOptions?Object:IOptions,void 0===n_?Object:n_,void 0===n4?Object:n4])],oC);let oI=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;return new Promise(n=>setTimeout(n,e))};function oj(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function oA(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?oj(Object(r),!0).forEach(function(n){oD(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function oB(e){return(oB="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})(e)}function ok(e,n){if(!(e instanceof n))throw TypeError("Cannot call a class as a function")}function oP(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,oL(i.key),i)}}function oN(e,n,r){return n&&oP(e.prototype,n),r&&oP(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function oD(e,n,r){return(n=oL(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function oL(e){var n=function(e,n){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,n||"default");if("object"!=typeof i)return i;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:String(n)}(x||(x={})).INIT="INIT";var oF=function(){function e(n){ok(this,e),oD(this,"iframeId",void 0),this.iframeId=n}return oN(e,[{key:"registerMessageReceived",value:function(e){void 0!==window.addEventListener&&"function"==typeof e&&window.addEventListener("message",e,!1)}},{key:"removeMessageReceived",value:function(e){void 0!==window.addEventListener&&window.removeEventListener("message",e,!1)}},{key:"sendMessageToIframe",value:function(e,n){if(this.iframeId){var r=document.getElementById(this.iframeId);e&&null!==r&&r.contentWindow.postMessage({type:e,content:n},"*")}else if(window.self!==window.top&&window&&window.parent&&window.parent.postMessage){var i=JSON.parse(JSON.stringify(n||{}));window.parent.postMessage({type:e,content:i},"*")}}},{key:"sendCommand",value:function(e){this.sendMessageToIframe("command",e)}},{key:"sendMessage",value:function(e){var n=e.requestId,r=void 0===n?rs():n;return this.sendMessageToIframe("message",oA(oA({},e),{},{requestId:r})),r}},{key:"textRender",value:function(e){return this.sendMessage({action:"TEXT_RENDER",body:e})}},{key:"textQuery",value:function(e){return this.sendMessage({action:"TEXT_QUERY",body:e})}},{key:"changeBackGround",value:function(e){return this.textRender("<display><background><type>image</type><source>http</source><value>".concat(e,"</value></background></display>"))}},{key:"mute",value:function(e){this.sendCommand({subType:"mute",subContent:e})}},{key:"muteAudio",value:function(e){this.sendCommand({subType:"muteAudio",subContent:e})}},{key:"muteRemoteAudio",value:function(e){this.sendCommand({subType:"muteRemoteAudio",subContent:e})}},{key:"playVideo",value:function(e){this.sendCommand({subType:"playVideo",subContent:e})}},{key:"sendAudioData",value:function(e){this.sendMessageToIframe("audioData",e)}},{key:"onStateUpdate",value:function(e){this.sendMessageToIframe("state",e)}},{key:"sendRtcState",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.sendMessageToIframe("rtcState",e)}},{key:"sendWsState",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.sendMessageToIframe("wsState",e)}}]),e}(),oU={LOAD:"LOAD",TEXT_RENDER:"TEXT_RENDER",TEXT_MT_RENDER:"TEXT_MT_RENDER",AUDIO_RENDER:"AUDIO_RENDER",TEXT_QUERY:"TEXT_QUERY",AUDIO_QUERY_START:"AUDIO_QUERY_START",AUDIO_QUERY_STOP:"AUDIO_QUERY_STOP",SET_MODEL_URLS:"SET_MODEL_URLS",CHANGE_CAMERA:"CHANGE_CAMERA",ANIMOJI_RENDER:"ANIMOJI_RENDER",DESTROY:"DESTROY",CHANGE_PARTS:"CHANGE_PARTS",SET_RENDER_CONFIG:"SET_RENDER_CONFIG",AUDIO_RENDER_START:"AUDIO_RENDER_START",AUDIO_RENDER_STOP:"AUDIO_RENDER_STOP",INTERRUPT:"INTERRUPT"};oN(function e(n){ok(this,e),oD(this,"iframeId",void 0),oD(this,"namespace","dhIframeNameSpace"),oD(this,"listener",null),this.iframeId=n},[{key:"onEventListener",value:function(e){var n=this;return function(r){if("object"===oB(r.data))if("onListener"===r.data.type&&r.data.content.listenerId){var i=window[n.namespace][r.data.content.listenerId];null==i||i(r.data.content.data)}else"onListenerRemove"===r.data.type&&r.data.content.listenerId?delete window[n.namespace][r.data.content.listenerId]:r.data.listenerId?e(r.data,function(e){n.sendMessage("onListener",{listenerId:r.data.listenerId,data:e})},function(){n.sendMessage("onListenerRemove",{listenerId:r.data.listenerId})}):e(r.data)}}},{key:"registerMessageReceived",value:function(e){void 0!==window.addEventListener&&"function"==typeof e&&(this.listener=this.onEventListener(e),window.addEventListener("message",this.listener,!1))}},{key:"removeMessageReceived",value:function(){void 0!==window.addEventListener&&this.listener&&(window[this.namespace]=void 0,window.removeEventListener("message",this.listener,!1))}},{key:"sendMessage",value:function(e,n,r){var i=this;if(this.iframeId){var o="";r&&(o=rs(),window[this.namespace]||(window[this.namespace]={}),window[this.namespace][o]=r);var s=document.getElementById(this.iframeId);return e&&null!==s&&s.contentWindow.postMessage({type:e,content:n,listenerId:o},"*"),function(){o&&(window[i.namespace][o]=void 0)}}if(window.self!==window.top&&window&&window.parent&&window.parent.postMessage){var a=JSON.parse(JSON.stringify(n||{}));window.parent.postMessage({type:e,content:a},"*")}}},{key:"textRender",value:function(e,n){return this.sendMessage(oU.TEXT_RENDER,e,n)}},{key:"textMTRender",value:function(e,n){return this.sendMessage(oU.TEXT_MT_RENDER,e,n)}},{key:"audioRender",value:function(e,n){return this.sendMessage(oU.AUDIO_RENDER,e,n)}},{key:"textQuery",value:function(e,n){return this.sendMessage(oU.TEXT_QUERY,e,n)}},{key:"startAudioQuery",value:function(e,n){return this.sendMessage(oU.AUDIO_QUERY_START,e,n)}},{key:"stopAudioQuery",value:function(){return this.sendMessage(oU.AUDIO_QUERY_STOP,{})}},{key:"setModelPackage",value:function(e,n){return this.sendMessage(oU.SET_MODEL_URLS,{urls:e,needInitConfig:n})}},{key:"changeCamera",value:function(e){return this.sendMessage(oU.CHANGE_CAMERA,e)}},{key:"changeParts",value:function(e){return this.sendMessage(oU.CHANGE_PARTS,e)}},{key:"setRenderConfig",value:function(e){return this.sendMessage(oU.SET_RENDER_CONFIG,e)}},{key:"animojiRender",value:function(e,n){return this.sendMessage(oU.ANIMOJI_RENDER,e,n)}},{key:"destroy",value:function(){return this.sendMessage(oU.DESTROY,{})}},{key:"startAudioRender",value:function(e,n){return this.sendMessage(oU.AUDIO_RENDER_START,e,n)}},{key:"stopAudioRender",value:function(){return this.sendMessage(oU.AUDIO_RENDER_STOP,{})}},{key:"interrupt",value:function(){return this.sendMessage(oU.INTERRUPT,{})}},{key:"load",value:function(e){return this.sendMessage(oU.LOAD,e)}},{key:"onStateUpdate",value:function(e){this.sendMessage("state",e)}}]);let oH=e=>new URLSearchParams(Object.entries(e).filter(e=>{let[,n]=e;return null!=n&&""!==n}).reduce((e,n)=>{let[r,i]=n;return e[r]=String(i),e},{})).toString();var oq=function(e){return e[e.Success=0]="Success",e[e.ReachSessionLimit=1004]="ReachSessionLimit",e[e.ResourceNotEnough=3001]="ResourceNotEnough",e}({}),oV=function(e){return e[e.UNINSTANTIATED=-1]="UNINSTANTIATED",e[e.CONNECTING=0]="CONNECTING",e[e.OPEN=1]="OPEN",e[e.CLOSING=2]="CLOSING",e[e.CLOSED=3]="CLOSED",e}({});class oX extends oC{get ready(){return!!this.iframeController&&!!this.token}constructor(...e){super(...e),this.origin="https://open.xiling.baidu.com",this.iframeId=rs(),this.iframeController=null,this.iframe=null,this.$iframeContainer=null,this.requestId=rs(),this.isWSConnected=!1,this.isRtcReady=!1,this.silenceMessageRequestIds=[],this.isStreamTextRendering=!1,this.wsClosedCount=0,this.mount=async e=>{if(!e)return void this.errorManager.handleError(new nW("容器元素不能为空"));if(this.$iframeContainer=e,this.iframe){e.contains(this.iframe)||e.appendChild(this.iframe);return}this.opts.enableDebugMode&&"development"===this.opts.env&&!this.opts.token?this.token=await this.getAccessToken():this.token=this.opts.token,this.iframe=document.createElement("iframe"),this.applyOptions(),e.appendChild(this.iframe),this.iframeController=new oF(this.iframeId),this.bindEvents()},this.bindEvents=()=>{var e,n;return this.ready&&(null==(e=this.iframe)||e.addEventListener("error",this.onIFrameErrorHandler),null==(n=this.iframeController)||n.registerMessageReceived(this.onMessageHandler)),this},this.unbindEvents=()=>{var e,n;return this.ready&&(null==(e=this.iframe)||e.removeEventListener("error",this.onIFrameErrorHandler),null==(n=this.iframeController)||n.removeMessageReceived(this.onMessageHandler)),this},this.cancelMute=()=>{var e;null==(e=this.iframeController)||e.sendCommand({subType:"muteAudio",subContent:!1}),setTimeout(()=>{this._isMuted=!1},1500)},this.renderPlainText=e=>{var n;if(!this.ready)return this;let r=this.runSsmlHandlers(e);return this.refreshRequestId(),null==(n=this.iframeController)||n.sendMessage({action:"TEXT_RENDER",body:r,requestId:this.requestId}),this},this.renderStreamText=(e,n)=>{var r,i,o;if(!this.ready)return this;let s=this.runSsmlHandlers(e);return n?(this.isStreamTextRendering||this.refreshRequestId(),null==(i=this.iframeController)||i.sendMessage({action:"TEXT_STREAM_RENDER",body:JSON.stringify({first:!this.isStreamTextRendering,last:!0,text:s}),requestId:this.requestId}),this.isStreamTextRendering=!1):this.isStreamTextRendering?null==(r=this.iframeController)||r.sendMessage({action:"TEXT_STREAM_RENDER",body:JSON.stringify({first:!1,last:!1,text:s}),requestId:this.requestId}):(this.refreshRequestId(),this.isStreamTextRendering=!0,null==(o=this.iframeController)||o.sendMessage({action:"TEXT_STREAM_RENDER",body:JSON.stringify({first:!0,last:!1,text:s}),requestId:this.requestId})),this},this.interrupt=()=>{var e;return this.ready&&(null==(e=this.iframeController)||e.sendMessage({action:"TEXT_RENDER",body:"<interrupt></interrupt>",requestId:this.requestId}),this.isRendering||this.onRenderFinished(this.requestId)),this},this.sendSilenceMessage=()=>{var e;if(!this.ready)return this;let n=rs();return null==(e=this.iframeController)||e.sendMessage({action:"TEXT_RENDER",body:"",requestId:n}),this.silenceMessageRequestIds.push(n),this.emitter.emit("send_silence_message",{requestId:n}).catch(rc),this},this.dispose=()=>{if(this.unbindEvents(),this.silenceMessageRequestIds=[],this.ssmlHandlers=[],this.wsClosedCount=0,this.emitter.clearListeners(),this.iframe){var e;null==(e=this.$iframeContainer)||e.removeChild(this.iframe),this.iframe=null,this.iframeController=null}return this},this.GetRequestId=()=>this.requestId,this.checkIsReady=()=>{let e=this.isWSConnected&&this.isRtcReady;return e&&this.emitter.emit("ready").catch(rc),e},this.onIFrameErrorHandler=e=>{let n=new n$(`\u{6570}\u{5B57}\u{4EBA}iframe\u{52A0}\u{8F7D}\u{5931}\u{8D25}: ${e.message}`,{context:{method:"onIFrameErrorHandler",iframeId:this.iframeId,filename:e.filename,lineno:e.lineno,colno:e.colno,type:e.type,target:e.target}});this.errorManager.handleError(n)},this.onMessageHandler=e=>{if(e.origin!==this.origin)return;let n=e.data;switch(n.type){case"msg":this.onReceiveMsgTypedMessageHandler(n);break;case"rtcState":this.onReceiveRtcStateTypedMessageHandler(n);break;case"wsState":this.onReceiveWsStateTypedMessageHandler(n)}},this.onReceiveMsgTypedMessageHandler=e=>{let n=e.content.requestId;if((e.content.code===oq.ReachSessionLimit||e.content.code===oq.ResourceNotEnough)&&(this.emitter.emit("reach_session_limit",{requestId:n}).catch(rc),this.errorManager.handleError(new nJ("资源配额已用尽,请联系技术支持申请扩容"))),["RENDER_START","FINISHED","DOWN_SUBTITLE","RENDER_INTERRUPTED","DOWN_SUBTITLE","TEXT_RENDER","TEXT_STREAM_RENDER"].includes(e.content.action)){if(n!==this.requestId)return;switch(e.content.action){case"RENDER_START":this._isRendering=!0,this.emitter.emit("is_rendering_change",!0).catch(rc);break;case"FINISHED":case"RENDER_INTERRUPTED":this.onRenderFinished(n);break;case"DOWN_SUBTITLE":{let r=JSON.parse(e.content.body);this.silenceMessageRequestIds.includes(n)?this.silenceMessageRequestIds=this.silenceMessageRequestIds.filter(e=>e!==n):this.emitter.emit("render_subtitle",{subtitle:r,requestId:n}).catch(rc);break}case"TEXT_RENDER":case"TEXT_STREAM_RENDER":0!==e.content.code&&this.onRenderFinished(n)}return}switch(e.content.action){case"RENDER_ERROR":this.onRenderFinished(n),this.errorManager.handleError(new nz("数字员工文本驱动渲染失败,请确认配置后重试",{requestId:n,context:{msg:e.content.message}}));break;case"DISCONNECT_ALERT":this.emitter.emit("disconnect_alert",{requestId:n}).catch(rc);break;case"TIMEOUT_EXIT":this.onRenderFinished(n),this.emitter.emit("timeout",{requestId:e.content.requestId}).catch(rc)}},this.onReceiveRtcStateTypedMessageHandler=e=>{e.content.action,"localVideoMuted"===e.content.action&&e.content.body&&(this._isMuted=!0),"remotevideoon"===e.content.action&&(this.isRtcReady=!0,this.checkIsReady(),this.iframe&&(this.iframe.style.opacity="1")),"error"===e.content.action&&this.errorManager.handleError(new nY("RTC 房间连接失败,请检查网络后重试"))},this.onReceiveWsStateTypedMessageHandler=e=>{e.content.readyState===oV.OPEN?(this.isWSConnected=!0,this.wsClosedCount=0,this.checkIsReady()):(e.content.readyState===oV.CLOSED||e.content.readyState===oV.CLOSING)&&(this.isWSConnected=!1),e.content.readyState===oV.CLOSED&&(this.wsClosedCount++,this.wsClosedCount>=3&&(this.emitter.emit("reconnect_failed").catch(rc),this.errorManager.handleError(new nG("检测到 Websocket 链接异常断开,如长时间无法恢复,请联系技术支持。"))))},this.applyOptions=()=>{var e,n,r,i,o,s,a,c,l,u,d,p,h,f;if(!this.iframe)return;this.iframe.id=this.iframeId,this.iframe.allow="autoplay",this.iframe.style.border="none",this.iframe.style.opacity="0",this.iframe.style.pointerEvents="none",this.iframe.style.overflow="hidden";let m=null!=(o=null==(e=this.opts)?void 0:e.scaleX)?o:1,g=null!=(s=null==(n=this.opts)?void 0:n.scaleY)?s:1,v=null!=(a=null==(r=this.opts)?void 0:r.translateX)?a:0,y=null!=(c=null==(i=this.opts)?void 0:i.translateY)?c:0;this.iframe.style.width=`${100*m}% `,this.iframe.style.height=`${100*g}%`,this.iframe.style.transform=`translate(${v}px, ${y}px)`;let b=oH({figureId:this.opts.figureId,ttsPer:this.opts.ttsPer,initMode:"noAudio","cp-inactiveDisconnectSec":null!=(l=this.opts.timeoutSec)?l:130,"cp-preAlertSec":null!=(u=this.opts.disconnectAlertSec)?u:10,mode:"crop",resolutionWidth:null!=(d=this.opts.figureResolutionWidth)?d:1920,resolutionHeight:null!=(p=this.opts.figureResolutionHeight)?p:1080,ttsSpeed:null!=(h=this.opts.speechSpeed)?h:6,"cp-ttsSample":this.opts.ttsSample,"cp-minSplitLen":this.opts.minSplitLen,"cp-ttsModel":this.opts.ttsModel,"cp-positionV2":JSON.stringify(this.opts.position),autoChromaKey:this.opts.autoChromaKey,closeLog:null==(f=this.opts.enableDebugMode)||f,token:this.token});this.iframe.src=`${this.origin}/cloud/realtime?${b}`},this.refreshRequestId=()=>{this.requestId=rs()},this.onRenderFinished=e=>{this._isRendering=!1,this.emitter.emit("is_rendering_change",!1).catch(rc),this.refreshRequestId(),this.emitter.emit("render_finished",{requestId:e}).catch(rc)}}}function oW(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function o$(e,n){return function(r,i){n(r,i,e)}}oX=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eb(),e_()],oX);class oz{static #B=this.ENTRY_EMITTER_NAME="AaaSPilotKitEmitter";constructor(e,n,r,i,o,s){this.opts=e,this.errorManager=n,this.agentService=r,this.asrService=i,this.digitalHumanService=o,this.conversationService=s,this.interruptible=!0,this.isRenderingMultiModConversation=!1,this.isDigitalHumanServiceReady=!1,this.isAsrServiceReady=!1,this.aiWorkerMessageCache=null,this.multiModAbortControllers=[],this.playWaitForListener=null,this.mount=async e=>{var n,r;let i=null!=e?e:null==(n=(r=this.opts).getMountContainer)?void 0:n.call(r);i&&(await Promise.all([this.digitalHumanService.mount(i),this.asrService.preloadDeps()]),this.asrService.start(),this.isAsrServiceReady=!0,this.checkServiceReady())},this.getOptions=()=>this.opts,this.checkNeedsManualActivation=()=>nP()||nN(),this.activateManually=async()=>{this.digitalHumanService instanceof oX&&(this.digitalHumanService.cancelMute(),nk()&&(nP()||nN())&&await oI(500))},this.keepAlive=()=>(this.digitalHumanService.sendSilenceMessage(),this),this.playWaitFor=async(e,n)=>(this.playWaitForListener&&this.digitalHumanService.emitter.off("render_finished",this.playWaitForListener),this.digitalHumanService.isRendering)?await new Promise(r=>{this.playWaitForListener=()=>{if(n&&!n())return void r(!1);this.digitalHumanService.renderPlainText(e),this.playWaitForListener&&this.digitalHumanService.emitter.off("render_finished",this.playWaitForListener),r(!0)},this.digitalHumanService.emitter.on("render_finished",this.playWaitForListener)}):(this.digitalHumanService.renderPlainText(e),!0),this.playFromFullText=e=>(this.digitalHumanService.renderPlainText(e),this),this.playFromStreamText=(e,n)=>(this.digitalHumanService.renderStreamText(e,n),this),this.mute=e=>(this.asrService.setMutedByUser(e),this.emitter.emit("mute",e).catch(rc),e?(this.asrService.mute(!0),this.conversationService.currentClientConversation&&this.query(this.conversationService.currentClientConversation.text,!0).catch(rc)):this.asrService.muted&&this.asrService.mute(!1),this),this.interrupt=()=>(this.interruptAIWorkerConversation(),this),this.playPrologue=()=>{if(this.opts.prologue&&this.opts.prologue.length>0)return void this.playFromFullText(this.opts.prologue);this.agentService.query("").catch(rc)},this.query=async(e,n)=>{if(this.checkServiceReady()){if(this.agentService.sessionId||this.agentService.setSessionId(rs()),this.digitalHumanService.sendSilenceMessage(),this.agentService.queryId||this.agentService.setQueryId(rs()),n){if(this.agentService.checkIsRepeat())return;this.agentService.setLastQueryId(this.agentService.queryId)}if(await this.emitter.emit("asr_message",{text:e,completed:n,id:this.agentService.queryId,sessionId:this.agentService.sessionId}),await this.handleClientConversation(e),n){this.asrService.mute(!0);let n=async()=>{this.agentService.setQueryId(""),this.digitalHumanService.canInterrupt&&(this.asrService.tryUnmuteAsr(),await this.emitter.emit("asr_start"),this.digitalHumanService.emitter.off("render_subtitle",n))};this.digitalHumanService.emitter.on("render_subtitle",n);let r=async()=>{this.agentService.setQueryId(""),this.asrService.tryUnmuteAsr(),await this.emitter.emit("asr_start"),this.digitalHumanService.emitter.off("render_finished",r)};this.digitalHumanService.emitter.on("render_finished",r),this.handleClientConversationCompleted(),await this.agentService.query(e)}}},this.input=e=>(this.digitalHumanService.isRendering&&!this.interruptible||this.query(e,!0).catch(rc),this),this.dispose=()=>(this.agentService.dispose(),this.asrService.dispose(),this.digitalHumanService.dispose(),this.conversationService.dispose(),this.emitter.clearListeners(),this.isDigitalHumanServiceReady=!1,this.isAsrServiceReady=!1,this.aiWorkerMessageCache=null,this.isRenderingMultiModConversation=!1,this.multiModAbortControllers=[],this),this.setInterruptible=e=>(this.interruptible=e,this),this.bindAsrServiceEvents=()=>{this.asrService.emitter.on("start",this.handleAsrServiceStarted),this.asrService.emitter.on("message",this.handleAsrMessage)},this.bindAgentServiceEvents=()=>{this.agentService.emitter.on("data",this.handleAgentAnswer),this.agentService.emitter.on("completed",this.handleAgentAnswerCompleted),this.agentService.emitter.on("instruction_received",this.handleAgentInstructionReceived),this.agentService.emitter.on("usage_quota_reached",async e=>{await this.emitter.emit("busy",{...e})})},this.bindDigitalHumanServiceEvents=()=>{this.digitalHumanService.bindEvents(),this.digitalHumanService.emitter.once("ready").then(()=>{this.isDigitalHumanServiceReady=!0,this.checkServiceReady()}),this.digitalHumanService.emitter.on("render_subtitle",this.aiWorkerSubtitleToConversation),this.digitalHumanService.emitter.on("is_rendering_change",e=>{this.emitter.emit("is_rendering_change",e).catch(rc)}),this.digitalHumanService.emitter.on("render_subtitle",async e=>{await this.emitter.emit("render_start",{...e,sessionId:this.agentService.sessionId,queryId:this.agentService.queryId})}),this.digitalHumanService.emitter.on("disconnect_alert",e=>{let n=this.digitalHumanService.emitter.on("render_finished",()=>{this.asrService.mute(!0),this.emitter.emit("inactivity",e).catch(rc),n()}),r=this.digitalHumanService.emitter.on("send_silence_message",()=>{n(),r()});this.playFromFullText(this.opts.inactivityPrompt)}),this.digitalHumanService.emitter.on("reach_session_limit",async e=>{this.isDigitalHumanServiceReady&&this.isAsrServiceReady&&await this.emitter.emit("busy",{...e})}),this.digitalHumanService.emitter.on("reconnect_failed",async()=>{await this.emitter.emit("busy",{requestId:"reconnect_failed"})});let e=this.digitalHumanService.emitter.on("render_finished",()=>{this.asrService.tryUnmuteAsr(),e()})},this.bindErrorEvents=()=>{this.errorManager.on(e=>{let n=this.errorManager.createMonitoringError(e);this.emitter.emit("error",e).catch(rc);try{this.weirwood.error.captureException(n)}catch(e){console.error(e)}})},this.bindEvents=()=>{this.bindErrorEvents(),this.bindAsrServiceEvents(),this.bindAgentServiceEvents(),this.bindDigitalHumanServiceEvents()},this.registerFormatters=()=>{var e,n;let r=null!=(e=this.opts.speechFormatters)?e:[],i=null!=(n=this.opts.conversationFormatters)?n:[];for(let e of r)this.digitalHumanService.registerSSMLHandler(e);for(let e of i)this.conversationService.registerAIWorkerConversationFormatter(e)},this.aiWorkerSubtitleToConversation=async e=>{let n=e.subtitle;if(this.isRenderingMultiModConversation)return;let r=this.conversationService;await this.createNewAIWorkerConversation();let i=r.currentAIWorkerConversation;i&&this.handleAIWorkerConversationChange(i);let o=r.runAIWorkerConversationFormatters(n.content);null==i||i.appendText(o),n.completed&&r.setCurrentConversation(null)},this.handleAgentAnswer=e=>{let{answer:n}=e;if(ii.isXml(n))return void this.handleXmlAgentAnswer(e).catch(rc);this.aiWorkerMessageCache&&this.playFromStreamText(this.aiWorkerMessageCache,!1),this.aiWorkerMessageCache=n},this.handleXmlAgentAnswer=async e=>{let{answer:n}=e,r=this.conversationService;await this.createNewAIWorkerConversation();let i=r.currentAIWorkerConversation;if(!i)return;let o=()=>{this.emitter.emit("conversation_change",{...i.toJSON(),text:i.fulltext,completed:!1})};i.emitter.on("content_change",o),this.isRenderingMultiModConversation=!0;let s=r.runAIWorkerConversationFormatters(n),a=i.createContentsFromXmlString(s),c=new AbortController;for(let e of(this.multiModAbortControllers.push(c),a)){if(c.signal.aborted){i.emitter.off("content_change",o);break}if(io.isTextContent(e)){let n=e.getConfig().content;this.playFromFullText(n),await this.digitalHumanService.emitter.once("render_subtitle")}i.addContentRenderTask(e),i.contents.push(e),await i.emitter.once("queue_empty")}this.isRenderingMultiModConversation=!1,i.emitter.off("content_change",o),await this.emitter.emit("conversation_change",{...i.toJSON(),text:i.fulltext,completed:!0})},this.createNewAIWorkerConversation=async()=>{let e=this.conversationService;if(!e.currentAIWorkerConversation){let n=io.create(this.opts);e.setCurrentConversation(n),e.add(n),await this.emitter.emit("conversation_add",n)}},this.handleAgentAnswerCompleted=async()=>{if(this.aiWorkerMessageCache){this.playFromStreamText(this.aiWorkerMessageCache,!0),this.aiWorkerMessageCache=null;return}this.agentService.setQueryId(""),this.asrService.tryUnmuteAsr(),await this.emitter.emit("asr_start")},this.handleAgentInstructionReceived=e=>{this.emitter.emit("instruction_received",e).catch(rc)},this.handleAsrServiceStarted=async()=>{await oI(800),this.asrService.mute(!0),this.interruptible&&this.emitter.once("render_start").then(()=>{this.asrService.tryUnmuteAsr()})},this.handleAsrMessage=async e=>{this.digitalHumanService.isRendering&&!this.digitalHumanService.canInterrupt||this.asrService.mutedByUser||e.type===M.EMessageType.Query&&(this.opts.enableDebugMode&&console.log("message",e,this.agentService.sessionId,Date.now()),await this.query(rt(e.data,this.opts.hotWordReplacementRules),e.completed))},this.handleClientConversation=async e=>{let n=this.conversationService;if(!n.currentClientConversation){let e=rl.create(this.opts);n.setCurrentConversation(e),n.add(e),await this.emitter.emit("conversation_add",e)}let r=n.currentClientConversation;(this.digitalHumanService.isRendering||this.isRenderingMultiModConversation)&&this.interruptAIWorkerConversation(),null==r||r.appendText(e)},this.handleClientConversationCompleted=()=>{this.conversationService.setCurrentConversation(null)},this.interruptAIWorkerConversation=()=>{for(let e of(this.aiWorkerMessageCache&&this.digitalHumanService.renderStreamText(this.aiWorkerMessageCache,!0),this.multiModAbortControllers))e.abort();this.multiModAbortControllers=[];let e=this.digitalHumanService.GetRequestId();this.digitalHumanService.interrupt(),this.conversationService.interruptAll(),this.agentService.abort(),this.aiWorkerMessageCache=null,this.emitter.emit("interrupt",{requestId:e,queryId:this.agentService.queryId?this.agentService.queryId:this.agentService.lastQueryId,sessionId:this.agentService.sessionId}).catch(rc)},this.checkServiceReady=()=>!!this.isDigitalHumanServiceReady&&!!this.isAsrServiceReady&&(this.emitter.emit("ready").catch(rc),!0),this.handleAIWorkerConversationChange=e=>{let n=r=>{this.emitter.emit("conversation_change",{...e.toJSON(),text:e.fulltext,completed:r.completed}).catch(rc),r.completed&&e.emitter.off("content_change",n)},r=()=>{e.emitter.off("interrupt",r),e.emitter.off("content_change",n)};e.emitter.on("content_change",n),e.emitter.on("interrupt",r)},this.weirwood=new oR({common:{buildid:"AAAS_PILOT_KIT_1.0.0",token:"8f3abab4743f4114bd632999224323af"},error:{collectWindowErrors:!1,collectUnhandledRejections:!1,collectResourceLoadErrors:!1,ignoreUrls:["localhost","127.0.0.1"]},perf:{disable:!0}}),this.emitter=new tY(this.opts.enableDebugMode?{debug:{name:oz.ENTRY_EMITTER_NAME,enabled:!0}}:void 0),this.bindEvents(),this.registerFormatters(),this.interruptible=this.opts.interruptible}}oz=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eb(),o$(0,eg(tJ.IOptions)),o$(0,eR()),o$(1,eg(tJ.ErrorManager)),o$(2,eg(tJ.AgentService)),o$(3,eg(tJ.ASRService)),o$(4,eg(tJ.DigitalHumanService)),o$(5,eg(tJ.ConversationService)),oW("design:type",Function),oW("design:paramtypes",["undefined"==typeof IResolvedOptions?Object:IResolvedOptions,void 0===n4?Object:n4,"undefined"==typeof AS?Object:AS,void 0===oT?Object:oT,void 0===oC?Object:oC,void 0===ic?Object:ic])],oz);let oG=[239,187,191],oY=e=>async(n,r,i)=>{if(!i.ok||!i.body)return;let o=!1,s=n=>{var r;o||(o=!0,null==(r=e.onCompleted)||r.call(e,n))},a=i.body.getReader(),c=new TextDecoder("utf8"),l=function(e){let n,r,i,o,s,a,c;return l(),{feed:function(l){var u;r=r?r+l:l,n&&(u=r,oG.every((e,n)=>u.charCodeAt(n)===e))&&(r=r.slice(oG.length)),n=!1;let d=r.length,p=0,h=!1;for(;p<d;){let n;h&&("\n"===r[p]&&++p,h=!1);let l=-1,u=o;for(let e=i;l<0&&e<d;++e)":"===(n=r[e])&&u<0?u=e-p:"\r"===n?(h=!0,l=e-p):"\n"===n&&(l=e-p);if(l<0){i=d-p,o=u;break}i=0,o=-1,function(n,r,i,o){if(0===o){c.length>0&&(e({type:"event",id:s,event:a||void 0,data:c.slice(0,-1)}),c="",s=void 0),a=void 0;return}let l=i<0,u=n.slice(r,r+(l?o:i)),d=0;d=l?o:" "===n[r+i+1]?i+2:i+1;let p=r+d,h=o-d,f=n.slice(p,p+h).toString();if("data"===u)c+=f?"".concat(f,"\n"):"\n";else if("event"===u)a=f;else if("id"!==u||f.includes("\0")){if("retry"===u){let n=parseInt(f,10);Number.isNaN(n)||e({type:"reconnect-interval",value:n})}}else s=f}(r,p,u,l),p+=l+1}p===d?r="":p>0&&(r=r.slice(p))},reset:l};function l(){n=!0,r="",i=0,o=-1,s=void 0,a=void 0,c=""}}(n=>{var r,i,o;if("event"===n.type&&(null==(r=e.onMessage)||r.call(e,n)),"event"===n.type&&n.data)for(let r of(null==(i=e.onEvent)||i.call(e,n),n.data.split("\n")))e.onData(r);else"reconnect-interval"===n.type&&(null==(o=e.onReconnectInterval)||o.call(e,n.value))}),u=()=>{a.read().then(e=>{if(e.done)return void s();l.feed(c.decode(e.value,{stream:!0})),u()}).catch(r=>{var i;if(n.signal.aborted){null==(i=e.onAborted)||i.call(e);return}s(r)})};return u(),i};!function(e){var n,r,i;(n=e.EAiobAction||(e.EAiobAction={}))[n.silence=1]="silence",n[n.Interrupt=2]="Interrupt",n[n.Hangup=3]="Hangup",(r=e.EResponseType||(e.EResponseType={}))[r.Welcome=1]="Welcome",r[r.Normal=2]="Normal",r[r.Command=3]="Command",r[r.TakeOver=4]="TakeOver",(i=e.ETextType||(e.ETextType={}))[i.unit=0]="unit",i[i.llm=1]="llm"}(C||(C={}));class oQ extends n7{static #B=this.REQUEST_URI="aicc-service/aiob-server/text/stream/query2";constructor(...e){super(...e),this.query=async e=>{this.abortController=new AbortController;let n=oY({onData:e=>{try{let{answer:n,sessionId:r,action:i}=JSON.parse(e);if(r&&(this.conversationSessionId=r),i===C.EAiobAction.Hangup)return void this.onHangup({sessionId:this.conversationSessionId});n&&this.onData({sessionId:this.conversationSessionId,answer:n})}catch(e){e instanceof Error&&this.errorManager.handleError(new nx(e.message,{sessionId:this.conversationSessionId}))}},onCompleted:()=>{this.onCompleted({sessionId:this.conversationSessionId})}}),r=this.opts.agentConfig;if(!(null==r?void 0:r.robotId))return void this.errorManager.handleError(new nM(`\u{8C03}\u{7528} Agent API ${oQ.REQUEST_URI} \u{65F6}\u{5FC5}\u{987B}\u{4F20}\u{5165} robotId \u{53C2}\u{6570}\u{FF0C}\u{8BF7}\u{786E}\u{8BA4}\u{540E}\u{91CD}\u{8BD5}\u{3002}`));let i={query:e,sessionId:this.conversationSessionId,robotId:r.robotId,isComplete:1,queryId:this.queryId};try{var o;await this.request.client.post(oQ.REQUEST_URI,{retry:0,timeout:3e5,signal:null==(o=this.abortController)?void 0:o.signal,hooks:{afterResponse:[n]},json:{...i}})}catch(e){e instanceof tZ?this.onTimeout({sessionId:this.conversationSessionId}):e instanceof Error&&this.errorManager.handleError(new nC(e.message,{sessionId:this.conversationSessionId}))}},this.hangup=async()=>{let e=this.opts.agentConfig;if(!(null==e?void 0:e.robotId))return void await this.errorManager.handleError(new nM(`\u{8C03}\u{7528} Agent API ${oQ.REQUEST_URI} \u{65F6}\u{5FC5}\u{987B}\u{4F20}\u{5165} robotId \u{53C2}\u{6570}\u{FF0C}\u{8BF7}\u{786E}\u{8BA4}\u{540E}\u{91CD}\u{8BD5}\u{3002}`));let n={query:"",robotId:e.robotId,sessionId:this.conversationSessionId,action:C.EAiobAction.Hangup,isComplete:1};try{await this.request.client.post(oQ.REQUEST_URI,{retry:0,timeout:3e5,json:{...n},keepalive:!0})}catch(e){e instanceof Error&&this.errorManager.handleError(new nC(e.message,{sessionId:this.conversationSessionId}))}},this.dispose=()=>{this._dispose(),this.hangup().finally(()=>{this.conversationSessionId=""})}}}oQ=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eb(),e_()],oQ),!function(e){var n;(n=e.EReplyType||(e.EReplyType={}))[n.PlainText=1]="PlainText",n[n.RichText=3]="RichText",n[n.Image=4]="Image",n[n.List=8]="List",e.REPLY_TYPE_MAPPING={1:"plainText",3:"richText",8:"list",4:"image"}}(I||(I={}));class oJ extends n7{static #B=this.REQUEST_URI="csp-service/online/core/v5/stream/query";constructor(...e){super(...e),this.query=async e=>{var n,r;this.abortController=new AbortController;let i=oY({onData:e=>{try{var n,r;let i=JSON.parse(e).answer[0],o=null!=(r=null==(n=i.reply)?void 0:n.text)?r:"";i&&o?this.onData({sessionId:this.conversationSessionId,answer:o}):i&&i.instruction&&(function(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;let n=Object.getPrototypeOf(e);return null===n||!!(Object.prototype.hasOwnProperty.call(n,"constructor")&&"function"==typeof n.constructor)&&Function.prototype.toString.call(n.constructor)===Function.prototype.toString.call(Object)}(i.instruction)?this.onInstructionReceived({sessionId:this.conversationSessionId,instruction:i.instruction}):this.errorManager.handleError(new nI("指令格式非法,请检查后重试",{sessionId:this.conversationSessionId})))}catch(e){e instanceof Error&&this.errorManager.handleError(new nx(e.message,{sessionId:this.conversationSessionId}))}},onCompleted:()=>{this.onCompleted({sessionId:this.conversationSessionId})}});this.conversationSessionId||(this.conversationSessionId=rs());let o=null==(n=this.opts.agentConfig)?void 0:n.token;if(!o)return void this.errorManager.handleError(new nM(`\u{8C03}\u{7528} Agent API ${oJ.REQUEST_URI} \u{65F6}\u{5FC5}\u{987B}\u{4F20}\u{5165} token \u{53C2}\u{6570}\u{FF0C}\u{8BF7}\u{786E}\u{8BA4}\u{540E}\u{91CD}\u{8BD5}\u{3002}`));let s={query:e,sessionId:this.conversationSessionId};try{await this.request.client.post(oJ.REQUEST_URI,{headers:{token:o},retry:0,timeout:3e5,signal:null==(r=this.abortController)?void 0:r.signal,hooks:{afterResponse:[i]},json:{...s}})}catch(e){e instanceof tZ?this.onTimeout({sessionId:this.conversationSessionId}):e instanceof Error&&this.errorManager.handleError(new nC(e.message,{sessionId:this.conversationSessionId}))}},this.dispose=()=>{this._dispose()}}}function oK(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function oZ(e,n){return function(r,i){n(r,i,e)}}oJ=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eb(),e_()],oJ);class o0{constructor(e,n){this.opts=e,this.errorManager=n,this.started=!1,this.sessionId="",this._dispose=()=>{this.started=!1,this.sessionId=""}}}o0=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eb(),oZ(0,eg(tJ.IOptions)),oZ(0,eR()),oZ(1,eg(tJ.ErrorManager)),oK("design:type",Function),oK("design:paramtypes",["undefined"==typeof IResolvedOptions?Object:IResolvedOptions,void 0===n4?Object:n4])],o0);let o1=e=>{if(e)return"string"==typeof e?e:e.id};class o2 extends o0{static #B=this.ONLINE_PREFIX_URL="https://ky.cloud.baidu.com/employee-console";static #G=this.SANDBOX_PREFIX_URL="https://ai.agent.kaywang.cn/api";static #ew=this.AUTH_URL="https://ky.cloud.baidu.com/employee-console/v1/access/r/ai-agent/get-authorization";get prefixUrl(){return"production"===this.opts.env?o2.ONLINE_PREFIX_URL:o2.SANDBOX_PREFIX_URL}loginBRTC(e){if("function"!=typeof window.BRTC_Start)throw Error("BRTC_Start global function is missing. Ensure baidu.rtc.sdk.js is loaded.");let n={aspublisher:!0,usingdatachannel:!0,usingvideo:!1,usingaudio:!0,showvideobps:!1,autosubscribe:!0,autoplaymuted:!1,autopublish:!0,showspinner:!1,shownovideo:!1,userevent:!0,sessionevent:!0,logintimeout:1e4,linkdownevent:rc,linkupevent:rc,logintimeoutevent:rc,mediastate:rc,remotevideoon:rc,remotevideooff:rc,remotevideocoming:rc,remotevideoloading:rc,remotevideoconnected_state:rc,remotevideoleaving:rc,remotevideounpublished:rc,localvideoconnected_state:rc,localvideopublished_ok:rc,destroyed:rc,onlocalstream:rc,onlocalstream_end:rc,remotevideo_closed:rc,onmessage:e.onmessage,userevent_joinedroom:e.userevent_joinedroom,userevent_leavingroom:e.userevent_leavingroom,remotemediastating:e.remotemediastating,remotevideoviewid:o1(e.remotevideoviewid),localvideoviewid:o1(e.localvideoviewid)};window.BRTC_Start({...n,...e})}constructor(...e){super(...e),this.currentAppId="",this.Start=async e=>{var n,r,i,o,s;this.currentAppId=this.opts.rtcID;let a=this.prefixUrl,c={};"production"===this.opts.env&&(c.authorization=await this.getAuthToken("/api/v1/aiagent/generateAIAgentCall"));let l="production"===this.opts.env?"/v1/open/ai-agent/generateAIAgentCall":"/v1/aiagent/generateAIAgentCall",u=await nv.post(`${a}${l}`,{json:{app_id:this.currentAppId,quick_start:!0,config:JSON.stringify({...e.cfg})},headers:c}).json();if(!u.ai_agent_instance_id)throw Error("ai_agent_instance_id missing in response");this.started=!0,this.sessionId=u.ai_agent_instance_id;let d=this.sessionId,p=null!=(s=null==(n=u.context)?void 0:n.token)?s:"";(null==(r=u.context)?void 0:r.uid)&&(d=u.context.uid),(null==(i=u.context)?void 0:i.appid)&&(this.currentAppId=u.context.appid),this.loginBRTC({...e,appid:this.currentAppId,roomname:this.sessionId,userid:d,token:p}),null==(o=e.success)||o.call(e)},this.Stop=async()=>{if(this.started){this.started=!1;try{let e=this.prefixUrl,n={};"production"===this.opts.env&&(n.authorization=await this.getAuthToken("/api/v1/aiagent/stopAIAgentInstance"));let r="production"===this.opts.env?"/v1/open/ai-agent/stopAIAgentInstance":"/v1/aiagent/stopAIAgentInstance";await nv.post(`${e}${r}`,{json:{app_id:this.currentAppId,ai_agent_instance_id:this.sessionId},headers:n})}catch(e){if(e instanceof tK)throw Error(`stopAIAgentInstance failed (${e.response.status})`);throw e}"function"==typeof window.BRTC_Stop&&window.BRTC_Stop()}},this.Mute=e=>{"function"==typeof window.BRTC_MuteMicphone&&window.BRTC_MuteMicphone(e)},this.GetSessionID=()=>this.sessionId,this.Dispose=()=>{this._dispose()},this.getAuthToken=async e=>{try{let{data:n}=await nv.post(o2.AUTH_URL,{json:{http_method:"POST",path:e,headers:{host:"rtc-aiagent.baidubce.com"}}}).json();return n}catch(e){if(e instanceof tK)throw Error(`getAuthToken failed (${e.response.status})`);throw e}}}}o2=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eb(),e_()],o2);let o3=!0,o6=!0;function o5(e,n,r){let i=e.match(n);return i&&i.length>=r&&parseFloat(i[r],10)}function o4(e,n,r){if(!e.RTCPeerConnection)return;let i=e.RTCPeerConnection.prototype,o=i.addEventListener;i.addEventListener=function(e,i){if(e!==n)return o.apply(this,arguments);let s=e=>{let n=r(e);n&&(i.handleEvent?i.handleEvent(n):i(n))};return this._eventMap=this._eventMap||{},this._eventMap[n]||(this._eventMap[n]=new Map),this._eventMap[n].set(i,s),o.apply(this,[e,s])};let s=i.removeEventListener;i.removeEventListener=function(e,r){if(e!==n||!this._eventMap||!this._eventMap[n]||!this._eventMap[n].has(r))return s.apply(this,arguments);let i=this._eventMap[n].get(r);return this._eventMap[n].delete(r),0===this._eventMap[n].size&&delete this._eventMap[n],0===Object.keys(this._eventMap).length&&delete this._eventMap,s.apply(this,[e,i])},Object.defineProperty(i,"on"+n,{get(){return this["_on"+n]},set(e){this["_on"+n]&&(this.removeEventListener(n,this["_on"+n]),delete this["_on"+n]),e&&this.addEventListener(n,this["_on"+n]=e)},enumerable:!0,configurable:!0})}function o8(e){return"boolean"!=typeof e?Error("Argument type: "+typeof e+". Please use a boolean."):(o3=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function o9(e){return"boolean"!=typeof e?Error("Argument type: "+typeof e+". Please use a boolean."):(o6=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function o7(){"object"==typeof window&&(o3||"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments))}function se(e,n){o6&&console.warn(e+" is deprecated, please use "+n+" instead.")}function st(e){return"[object Object]"===Object.prototype.toString.call(e)}function sn(e,n,r){let i=r?"outbound-rtp":"inbound-rtp",o=new Map;if(null===n)return o;let s=[];return e.forEach(e=>{"track"===e.type&&e.trackIdentifier===n.id&&s.push(e)}),s.forEach(n=>{e.forEach(r=>{r.type===i&&r.trackId===n.id&&function e(n,r,i){!r||i.has(r.id)||(i.set(r.id,r),Object.keys(r).forEach(o=>{o.endsWith("Id")?e(n,n.get(r[o]),i):o.endsWith("Ids")&&r[o].forEach(r=>{e(n,n.get(r),i)})}))}(e,r,o)})}),o}function sr(e,n){let r=e&&e.navigator;if(!r.mediaDevices)return;let i=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;let n={};return Object.keys(e).forEach(r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;let i="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);let o=function(e,n){return e?e+n.charAt(0).toUpperCase()+n.slice(1):"deviceId"===n?"sourceId":n};if(void 0!==i.ideal){n.optional=n.optional||[];let e={};"number"==typeof i.ideal?(e[o("min",r)]=i.ideal,n.optional.push(e),(e={})[o("max",r)]=i.ideal):e[o("",r)]=i.ideal,n.optional.push(e)}void 0!==i.exact&&"number"!=typeof i.exact?(n.mandatory=n.mandatory||{},n.mandatory[o("",r)]=i.exact):["min","max"].forEach(e=>{void 0!==i[e]&&(n.mandatory=n.mandatory||{},n.mandatory[o(e,r)]=i[e])})}),e.advanced&&(n.optional=(n.optional||[]).concat(e.advanced)),n},o=function(e,o){if(n.version>=61)return o(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){let n=function(e,n,r){n in e&&!(r in e)&&(e[r]=e[n],delete e[n])};n((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),n(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=i(e.audio)}if(e&&"object"==typeof e.video){let s=e.video.facingMode;s=s&&("object"==typeof s?s:{ideal:s});let a=n.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&!(r.mediaDevices.getSupportedConstraints&&r.mediaDevices.getSupportedConstraints().facingMode&&!a)){let n;if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?n=["back","rear"]:("user"===s.exact||"user"===s.ideal)&&(n=["front"]),n)return r.mediaDevices.enumerateDevices().then(r=>{let a=(r=r.filter(e=>"videoinput"===e.kind)).find(e=>n.some(n=>e.label.toLowerCase().includes(n)));return!a&&r.length&&n.includes("back")&&(a=r[r.length-1]),a&&(e.video.deviceId=s.exact?{exact:a.deviceId}:{ideal:a.deviceId}),e.video=i(e.video),o7("chrome: "+JSON.stringify(e)),o(e)})}e.video=i(e.video)}return o7("chrome: "+JSON.stringify(e)),o(e)},s=function(e){return n.version>=64?e:{name:({PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"})[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=(function(e,n,i){o(e,e=>{r.webkitGetUserMedia(e,n,e=>{i&&i(s(e))})})}).bind(r),r.mediaDevices.getUserMedia){let e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(n){return o(n,n=>e(n).then(e=>{if(n.audio&&!e.getAudioTracks().length||n.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException("","NotFoundError");return e},e=>Promise.reject(s(e))))}}}function si(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function so(e){if("object"!=typeof e||!e.RTCPeerConnection||"ontrack"in e.RTCPeerConnection.prototype)o4(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e));else{Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});let n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=n=>{n.stream.addEventListener("addtrack",r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===r.track.id):{track:r.track};let o=new Event("track");o.track=r.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[n.stream],this.dispatchEvent(o)}),n.stream.getTracks().forEach(r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===r.id):{track:r};let o=new Event("track");o.track=r,o.receiver=i,o.transceiver={receiver:i},o.streams=[n.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),n.apply(this,arguments)}}}function ss(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){let n=function(e,n){return{track:n,get dtmf(){return void 0===this._dtmf&&("audio"===n.kind?this._dtmf=e.createDTMFSender(n):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};let r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){let o=r.apply(this,arguments);return o||(o=n(this,e),this._senders.push(o)),o};let i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.apply(this,arguments);let n=this._senders.indexOf(e);-1!==n&&this._senders.splice(n,1)}}let r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(n(this,e))})};let i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach(e=>{let n=this._senders.find(n=>n.track===e);n&&this._senders.splice(this._senders.indexOf(n),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){let n=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){let e=n.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function sa(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){let n=e.RTCPeerConnection.prototype.getSenders;n&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=n.apply(this,[]);return e.forEach(e=>e._pc=this),e});let r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){let e=this;return this._pc.getStats().then(n=>sn(n,e.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){let n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=n.apply(this,[]);return e.forEach(e=>e._pc=this),e}),o4(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){let e=this;return this._pc.getStats().then(n=>sn(n,e.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype))return;let n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){let e,n,r,i=arguments[0];return(this.getSenders().forEach(n=>{n.track===i&&(e?r=!0:e=n)}),this.getReceivers().forEach(e=>(e.track===i&&(n?r=!0:n=e),e.track===i)),r||e&&n)?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):e?e.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return n.apply(this,arguments)}}function sc(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};let n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return n.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let i=n.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};let r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(n=>n.track===e))throw new DOMException("Track already exists.","InvalidAccessError")});let n=this.getSenders();r.apply(this,arguments);let i=this.getSenders().filter(e=>-1===n.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(i)};let i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};let o=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(n=>{let r=this._shimmedLocalStreams[n].indexOf(e);-1!==r&&this._shimmedLocalStreams[n].splice(r,1),1===this._shimmedLocalStreams[n].length&&delete this._shimmedLocalStreams[n]}),o.apply(this,arguments)}}function sl(e,n){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&n.version>=65)return sc(e);let r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){let e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};let i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(n){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.getTracks().forEach(e=>{if(this.getSenders().find(n=>n.track===e))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[n.id]){let r=new e.MediaStream(n.getTracks());this._streams[n.id]=r,this._reverseStreams[r.id]=n,n=r}i.apply(this,[n])};let o=e.RTCPeerConnection.prototype.removeStream;function s(e,n){let r=n.sdp;return Object.keys(e._reverseStreams||[]).forEach(n=>{let i=e._reverseStreams[n],o=e._streams[i.id];r=r.replace(RegExp(o.id,"g"),i.id)}),new RTCSessionDescription({type:n.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},o.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(n,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");let i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find(e=>e===n))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(e=>e.track===n))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};let o=this._streams[r.id];if(o)o.addTrack(n),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{let i=new e.MediaStream([n]);this._streams[r.id]=i,this._reverseStreams[i.id]=r,this.addStream(i)}return this.getSenders().find(e=>e.track===n)},["createOffer","createAnswer"].forEach(function(n){let r=e.RTCPeerConnection.prototype[n];e.RTCPeerConnection.prototype[n]=({[n](){let e=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?r.apply(this,[n=>{let r=s(this,n);e[0].apply(null,[r])},n=>{e[1]&&e[1].apply(null,n)},arguments[2]]):r.apply(this,arguments).then(e=>s(this,e))}})[n]});let a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){var e,n;let r;return arguments.length&&arguments[0].type?(arguments[0]=(e=this,n=arguments[0],r=n.sdp,Object.keys(e._reverseStreams||[]).forEach(n=>{let i=e._reverseStreams[n],o=e._streams[i.id];r=r.replace(RegExp(i.id,"g"),o.id)}),new RTCSessionDescription({type:n.type,sdp:r})),a.apply(this,arguments)):a.apply(this,arguments)};let c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){let e=c.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){let n;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(e._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach(r=>{this._streams[r].getTracks().find(n=>e.track===n)&&(n=this._streams[r])}),n&&(1===n.getTracks().length?this.removeStream(this._reverseStreams[n.id]):n.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function su(e,n){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&n.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(n){let r=e.RTCPeerConnection.prototype[n];e.RTCPeerConnection.prototype[n]=({[n](){return arguments[0]=new("addIceCandidate"===n?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}})[n]})}function sd(e,n){o4(e,"negotiationneeded",e=>{let r=e.target;if(!(n.version<72)&&(!r.getConfiguration||"plan-b"!==r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e})}function sp(e,n){let r=e&&e.navigator,i=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,n,i){se("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(n,i)},!(n.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){let e=function(e,n,r){n in e&&!(r in e)&&(e[r]=e[n],delete e[n])},n=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(e((r=JSON.parse(JSON.stringify(r))).audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),n(r)},i&&i.prototype.getSettings){let n=i.prototype.getSettings;i.prototype.getSettings=function(){let r=n.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(i&&i.prototype.applyConstraints){let n=i.prototype.applyConstraints;i.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(e(r=JSON.parse(JSON.stringify(r)),"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),n.apply(this,[r])}}}}function sh(e,n){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!(r&&r.video)){let e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:n}:r.video.mediaSource=n,e.navigator.mediaDevices.getUserMedia(r)})}function sf(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function sm(e,n){if("object"!=typeof e||!(e.RTCPeerConnection||e.mozRTCPeerConnection))return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),n.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(n){let r=e.RTCPeerConnection.prototype[n];e.RTCPeerConnection.prototype[n]=({[n](){return arguments[0]=new("addIceCandidate"===n?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}})[n]});let r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){let[e,o,s]=arguments;return i.apply(this,[e||null]).then(e=>{if(n.version<53&&!o)try{e.forEach(e=>{e.type=r[e.type]||e.type})}catch(n){if("TypeError"!==n.name)throw n;e.forEach((n,i)=>{e.set(i,Object.assign({},n,{type:r[n.type]||n.type}))})}return e}).then(o,s)}}function sg(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;let n=e.RTCPeerConnection.prototype.getSenders;n&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=n.apply(this,[]);return e.forEach(e=>e._pc=this),e});let r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function sv(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;let n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=n.apply(this,[]);return e.forEach(e=>e._pc=this),e}),o4(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function sy(e){!e.RTCPeerConnection||"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){se("removeStream","removeTrack"),this.getSenders().forEach(n=>{n.track&&e.getTracks().includes(n.track)&&this.removeTrack(n)})})}function sb(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function s_(e){if(!("object"==typeof e&&e.RTCPeerConnection))return;let n=e.RTCPeerConnection.prototype.addTransceiver;n&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]);let r=(e=[...e]).length>0;r&&e.forEach(e=>{if("rid"in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw RangeError("max_framerate must be >= 0.0")});let i=n.apply(this,arguments);if(r){let{sender:n}=i,r=n.getParameters();"encodings"in r&&(1!==r.encodings.length||0!==Object.keys(r.encodings[0]).length)||(r.encodings=e,n.sendEncodings=e,this.setParametersPromises.push(n.setParameters(r).then(()=>{delete n.sendEncodings}).catch(()=>{delete n.sendEncodings})))}return i})}function sw(e){if(!("object"==typeof e&&e.RTCRtpSender))return;let n=e.RTCRtpSender.prototype.getParameters;n&&(e.RTCRtpSender.prototype.getParameters=function(){let e=n.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function sO(e){if(!("object"==typeof e&&e.RTCPeerConnection))return;let n=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>n.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):n.apply(this,arguments)}}function sR(e){if(!("object"==typeof e&&e.RTCPeerConnection))return;let n=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>n.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):n.apply(this,arguments)}}function sS(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){let n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(r=>n.call(this,r,e)),e.getVideoTracks().forEach(r=>n.call(this,r,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...r){return r&&r.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),n.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);let n=this._localStreams.indexOf(e);if(-1===n)return;this._localStreams.splice(n,1);let r=e.getTracks();this.getSenders().forEach(e=>{r.includes(e.track)&&this.removeTrack(e)})})}}function sE(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);let n=new Event("addstream");n.stream=e,this.dispatchEvent(n)})})}});let n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){let e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(n){n.streams.forEach(n=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(n)>=0)return;e._remoteStreams.push(n);let r=new Event("addstream");r.stream=n,e.dispatchEvent(r)})}),n.apply(e,arguments)}}}function sT(e){if("object"!=typeof e||!e.RTCPeerConnection)return;let n=e.RTCPeerConnection.prototype,r=n.createOffer,i=n.createAnswer,o=n.setLocalDescription,s=n.setRemoteDescription,a=n.addIceCandidate;n.createOffer=function(e,n){let i=arguments.length>=2?arguments[2]:arguments[0],o=r.apply(this,[i]);return n?(o.then(e,n),Promise.resolve()):o},n.createAnswer=function(e,n){let r=arguments.length>=2?arguments[2]:arguments[0],o=i.apply(this,[r]);return n?(o.then(e,n),Promise.resolve()):o};let c=function(e,n,r){let i=o.apply(this,[e]);return r?(i.then(n,r),Promise.resolve()):i};n.setLocalDescription=c,n.setRemoteDescription=c=function(e,n,r){let i=s.apply(this,[e]);return r?(i.then(n,r),Promise.resolve()):i},n.addIceCandidate=function(e,n,r){let i=a.apply(this,[e]);return r?(i.then(n,r),Promise.resolve()):i}}function sM(e){let n=e&&e.navigator;if(n.mediaDevices&&n.mediaDevices.getUserMedia){let e=n.mediaDevices,r=e.getUserMedia.bind(e);n.mediaDevices.getUserMedia=e=>r(sx(e))}!n.getUserMedia&&n.mediaDevices&&n.mediaDevices.getUserMedia&&(n.getUserMedia=(function(e,r,i){n.mediaDevices.getUserMedia(e).then(r,i)}).bind(n))}function sx(e){return e&&void 0!==e.video?Object.assign({},e,{video:function e(n){return st(n)?Object.keys(n).reduce(function(r,i){let o=st(n[i]),s=o?e(n[i]):n[i],a=o&&!Object.keys(s).length;return void 0===s||a?r:Object.assign(r,{[i]:s})},{}):n}(e.video)}):e}function sC(e){if(!e.RTCPeerConnection)return;let n=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){let n=[];for(let r=0;r<e.iceServers.length;r++){let i=e.iceServers[r];void 0===i.urls&&i.url?(se("RTCIceServer.url","RTCIceServer.urls"),(i=JSON.parse(JSON.stringify(i))).urls=i.url,delete i.url,n.push(i)):n.push(e.iceServers[r])}e.iceServers=n}return new n(e,r)},e.RTCPeerConnection.prototype=n.prototype,"generateCertificate"in n&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>n.generateCertificate})}function sI(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function sj(e){let n=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);let n=this.getTransceivers().find(e=>"audio"===e.receiver.track.kind);!1===e.offerToReceiveAudio&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveAudio||n||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);let r=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video",{direction:"recvonly"})}return n.apply(this,arguments)}}function sA(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var sB=r("../../node_modules/sdp/sdp.js"),sk=r.n(sB);function sP(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;let n=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substring(2)),e.candidate&&e.candidate.length){let r=new n(e),i=sk().parseCandidate(e.candidate);for(let e in i)e in r||Object.defineProperty(r,e,{value:i[e]});return r.toJSON=function(){return{candidate:r.candidate,sdpMid:r.sdpMid,sdpMLineIndex:r.sdpMLineIndex,usernameFragment:r.usernameFragment}},r}return new n(e)},e.RTCIceCandidate.prototype=n.prototype,o4(e,"icecandidate",n=>(n.candidate&&Object.defineProperty(n,"candidate",{value:new e.RTCIceCandidate(n.candidate),writable:"false"}),n))}function sN(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||o4(e,"icecandidate",e=>{if(e.candidate){let n=sk().parseCandidate(e.candidate.candidate);"relay"===n.type&&(e.candidate.relayProtocol=({0:"tls",1:"tcp",2:"udp"})[n.priority>>24])}return e})}function sD(e,n){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});let r=function(e){if(!e||!e.sdp)return!1;let n=sk().splitSections(e.sdp);return n.shift(),n.some(e=>{let n=sk().parseMLine(e);return n&&"application"===n.kind&&-1!==n.protocol.indexOf("SCTP")})},i=function(e){let n=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===n||n.length<2)return -1;let r=parseInt(n[1],10);return r!=r?-1:r},o=function(e){let r=65536;return"firefox"===n.browser&&(r=n.version<57?-1===e?16384:0x7ffffff5:n.version<60?57===n.version?65535:65536:0x7ffffff5),r},s=function(e,r){let i=65536;"firefox"===n.browser&&57===n.version&&(i=65535);let o=sk().matchPrefix(e.sdp,"a=max-message-size:");return o.length>0?i=parseInt(o[0].substring(19),10):"firefox"===n.browser&&-1!==r&&(i=0x7ffffff5),i},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===n.browser&&n.version>=76){let{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){let e,n=i(arguments[0]),r=o(n),a=s(arguments[0],n);e=0===r&&0===a?Number.POSITIVE_INFINITY:0===r||0===a?Math.max(r,a):Math.min(r,a);let c={};Object.defineProperty(c,"maxMessageSize",{get:()=>e}),this._sctp=c}return a.apply(this,arguments)}}function sL(e){if(!(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype))return;function n(e,n){let r=e.send;e.send=function(){let i=arguments[0],o=i.length||i.size||i.byteLength;if("open"===e.readyState&&n.sctp&&o>n.sctp.maxMessageSize)throw TypeError("Message too large (can send a maximum of "+n.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}let r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){let e=r.apply(this,arguments);return n(e,this),e},o4(e,"datachannel",e=>(n(e.channel,e.target),e))}function sF(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;let n=e.RTCPeerConnection.prototype;Object.defineProperty(n,"connectionState",{get(){return({completed:"connected",checking:"connecting"})[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(n,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{let r=n[e];n[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{let n=e.target;if(n._lastConnectionState!==n.connectionState){n._lastConnectionState=n.connectionState;let r=new Event("connectionstatechange",e);n.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}})}function sU(e,n){if(!e.RTCPeerConnection||"chrome"===n.browser&&n.version>=71||"safari"===n.browser&&n._safariVersion>=13.1)return;let r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(n){if(n&&n.sdp&&-1!==n.sdp.indexOf("\na=extmap-allow-mixed")){let r=n.sdp.split("\n").filter(e=>"a=extmap-allow-mixed"!==e.trim()).join("\n");e.RTCSessionDescription&&n instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:n.type,sdp:r}):n.sdp=r}return r.apply(this,arguments)}}function sH(e,n){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;let r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===n.browser&&n.version<78||"firefox"===n.browser&&n.version<68||"safari"===n.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function sq(e,n){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;let r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return r.apply(this,arguments);if(!(e={type:e.type,sdp:e.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}return e.sdp||"offer"!==e.type&&"answer"!==e.type?r.apply(this,[e]):("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then(e=>r.apply(this,[e]))})}let sV=function({window:e}={},n={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){let r=function(e){let n={browser:null,version:null};if(void 0===e||!e.navigator||!e.navigator.userAgent)return n.browser="Not a browser.",n;let{navigator:r}=e;if(r.userAgentData&&r.userAgentData.brands){let e=r.userAgentData.brands.find(e=>"Chromium"===e.brand);if(e)return{browser:"chrome",version:parseInt(e.version,10)}}return r.mozGetUserMedia?(n.browser="firefox",n.version=parseInt(o5(r.userAgent,/Firefox\/(\d+)\./,1))):r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection?(n.browser="chrome",n.version=parseInt(o5(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2))):e.RTCPeerConnection&&r.userAgent.match(/AppleWebKit\/(\d+)\./)?(n.browser="safari",n.version=parseInt(o5(r.userAgent,/AppleWebKit\/(\d+)\./,1)),n.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype,n._safariVersion=o5(r.userAgent,/Version\/(\d+(\.?\d+))/,1)):n.browser="Not a supported browser.",n}(e),i={browserDetails:r,commonShim:P,extractVersion:o5,disableLog:o8,disableWarnings:o9,sdp:sB};switch(r.browser){case"chrome":if(!A||!su||!n.shimChrome){o7("Chrome shim is not included in this adapter release.");break}if(null===r.version){o7("Chrome shim can not determine version, not shimming.");break}o7("adapter.js shimming chrome."),i.browserShim=A,sH(e,r),sq(e,r),sr(e,r),si(e,r),su(e,r),so(e,r),sl(e,r),ss(e,r),sa(e,r),sd(e,r),sP(e,r),sN(e,r),sF(e,r),sD(e,r),sL(e,r),sU(e,r);break;case"firefox":if(!B||!sm||!n.shimFirefox){o7("Firefox shim is not included in this adapter release.");break}o7("adapter.js shimming firefox."),i.browserShim=B,sH(e,r),sq(e,r),sp(e,r),sm(e,r),sf(e,r),sy(e,r),sg(e,r),sv(e,r),sb(e,r),s_(e,r),sw(e,r),sO(e,r),sR(e,r),sP(e,r),sF(e,r),sD(e,r),sL(e,r);break;case"safari":if(!k||!n.shimSafari){o7("Safari shim is not included in this adapter release.");break}o7("adapter.js shimming safari."),i.browserShim=k,sH(e,r),sq(e,r),sC(e,r),sj(e,r),sT(e,r),sS(e,r),sE(e,r),sI(e,r),sM(e,r),sA(e,r),sP(e,r),sN(e,r),sD(e,r),sL(e,r),sU(e,r);break;default:o7("Unsupported browser!")}return i}({window:"undefined"==typeof window?void 0:window});!function(e){e.DEFAULT_BRTC_SDK_URL="https://brtc-sdk.cdn.bcebos.com/npm/baidurtc@1.2.19/baidu.rtc.sdk.js",e.DEFAULT_BRTC_CLIENT_CONFIG={displayName:"AaaSPilot Kit",debugLevel:!1,rtcOptions:{},cfg:{tag:"H5.SDK",llm:"LLMMute",tts:"MUTE"},silenceTimeoutMs:1e4}}(j||(j={}));let sX=e=>{if(e)return"string"==typeof e?e:e.id};class sW extends oT{static #B=this.MESSAGE_INTERVAL_THRESHOLD=5e3;preloadDeps(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:j.DEFAULT_BRTC_SDK_URL;return"undefined"==typeof window||window.adapter||(window.adapter=null!=sV?sV:N),"function"==typeof window.BRTC_Start?Promise.resolve():(this.brtcLoadPromise||(this.brtcLoadPromise=new Promise((n,r)=>{let i=document.createElement("script");i.src=e,i.async=!0,i.onload=()=>n(),i.onerror=()=>{this.errorManager.handleError(new nL(`Failed to load BRTC SDK: ${e}`)),r(Error(`Failed to load BRTC SDK: ${e}`))},document.head.appendChild(i)})),this.brtcLoadPromise)}makeStartOptions(){return{...j.DEFAULT_BRTC_CLIENT_CONFIG,cfg:{...j.DEFAULT_BRTC_CLIENT_CONFIG.cfg,asr_vad:this.opts.asrVad}}}parseMessage(e){let n=e.replace(/\[Q\]:?|\[M\]:?|\[C\]:?|\[A\]:?|\[H\]:?|\[E\]:?|\[B\]:?|\[T\]:?/g,"").trim(),r=M.EMessageType.Event,i=!0,o=!1,s=!1;return s=e.includes("VOICE_COMING"),e.includes("[Q]")&&(r=M.EMessageType.Query),e.includes("[E]")&&(r=M.EMessageType.Event),i=!e.includes("[M]"),{type:r,continued:e.includes("[C]"),data:n,completed:i,isCollectingSounds:s}}constructor(...e){super(...e),this.brtcLoadPromise=null,this.silenceTimer=null,this.lastMessageTime=0,this.messageIntervalTimer=null,this.start=async()=>{if(this.started)return;await this._ensureMicPermission();let{displayName:e,debugLevel:n,rtcOptions:{remoteVideoElement:r,localVideoElement:i},cfg:o,silenceTimeoutMs:s}=this.makeStartOptions();return new Promise((a,c)=>{this.signalingService.Start({debuglevel:n,cfg:o,displayname:e,remotevideoviewid:sX(r),localvideoviewid:sX(i),usingremotemediastate:!0,success:()=>{this.started=!0,this.emitter.emit("start",{sessionId:this.sessionId}).catch(rc),a()},error:e=>{this.errorManager.handleError(new nV(e||"",{sessionId:this.sessionId})),c(Error(e||""))},onmessage:e=>{try{let n=this.parseMessage(e.data);if(e.data.includes("VOICE_COMING")||(this.emitter.emitSerial("message",{...n,sessionId:this.sessionId}).catch(rc),this.checkMessageInterval(n)),0!==s){let r=""===n.data;(e.data.includes("[E]")||e.data.includes("VOICE_COMING"))&&r?this.triggerSilence():this.resetSilenceTimer()}}catch(e){e instanceof Error&&this.errorManager.handleError(new nH(e.message,{sessionId:this.sessionId}))}},userevent_joinedroom:(e,n,r)=>{this.emitter.emit("user_joined_room",{id:e,display:n,attribute:r,sessionId:this.sessionId})},userevent_leavingroom:(e,n)=>{this.emitter.emit("user_leaving_room",{id:e,display:n,sessionId:this.sessionId})},remotemediastating:(e,n,r)=>{this.emitter.emit("media_state_changed",{id:e,medium:n,on:r,sessionId:this.sessionId})}})})},this.stop=async()=>{try{await this._stop()}catch(e){e instanceof Error&&this.errorManager.handleError(new nF(e.message,{sessionId:this.sessionId}))}this.emitter.emit("stop",{sessionId:this.signalingService.GetSessionID()})},this.dispose=()=>{this._dispose(),this.brtcLoadPromise=null,this.silenceTimer&&(window.clearTimeout(this.silenceTimer),this.silenceTimer=null),this.messageIntervalTimer&&(window.clearTimeout(this.messageIntervalTimer),this.messageIntervalTimer=null),this.lastMessageTime=0},this.resetSilenceTimer=()=>{null!==this.silenceTimer&&window.clearTimeout(this.silenceTimer),this.silenceTimer=window.setTimeout(()=>{this.emitter.emit("silence",{sessionId:this.signalingService.GetSessionID()})},this.makeStartOptions().silenceTimeoutMs)},this.triggerSilence=()=>{this.emitter.emit("silence",{sessionId:this.signalingService.GetSessionID()}),this.resetSilenceTimer()},this.checkMessageInterval=e=>{let n=Date.now();if(e.completed){this.messageIntervalTimer&&(window.clearTimeout(this.messageIntervalTimer),this.messageIntervalTimer=null),this.lastMessageTime=0;return}if(0===this.lastMessageTime)this.lastMessageTime=n,this.messageIntervalTimer=window.setTimeout(()=>{this.errorManager.handleError(new nq(`ASR\u{6D88}\u{606F}\u{95F4}\u{9694}\u{8D85}\u{8FC7}${sW.MESSAGE_INTERVAL_THRESHOLD}ms\u{9608}\u{503C}`,{sessionId:this.sessionId,context:{lastMessageTime:this.lastMessageTime,currentTime:n,threshold:sW.MESSAGE_INTERVAL_THRESHOLD}}))},sW.MESSAGE_INTERVAL_THRESHOLD);else{let e=n-this.lastMessageTime;e>sW.MESSAGE_INTERVAL_THRESHOLD&&this.errorManager.handleError(new nq(`ASR\u{6D88}\u{606F}\u{95F4}\u{9694}${e}ms\u{8D85}\u{8FC7}${sW.MESSAGE_INTERVAL_THRESHOLD}ms\u{9608}\u{503C}`,{sessionId:this.sessionId,context:{lastMessageTime:this.lastMessageTime,currentTime:n,interval:e,threshold:sW.MESSAGE_INTERVAL_THRESHOLD}})),this.lastMessageTime=n,this.messageIntervalTimer&&window.clearTimeout(this.messageIntervalTimer),this.messageIntervalTimer=window.setTimeout(()=>{this.errorManager.handleError(new nq(`ASR\u{6D88}\u{606F}\u{95F4}\u{9694}\u{8D85}\u{8FC7}${sW.MESSAGE_INTERVAL_THRESHOLD}ms\u{9608}\u{503C}`,{sessionId:this.sessionId,context:{lastMessageTime:this.lastMessageTime,currentTime:Date.now(),threshold:sW.MESSAGE_INTERVAL_THRESHOLD}}))},sW.MESSAGE_INTERVAL_THRESHOLD)}}}}sW=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eb(),e_()],sW),function(){if("undefined"==typeof AbortSignal)return console.warn("AbortSignal is not defined in this environment. The polyfill will not be installed.");ip("any",il.abortSignalAny),ip("timeout",iu.abortSignalTimeout),ip("abort",id.abortSignalAbort)}();let s$=e=>{var n;let r=new tI({defaultScope:"Singleton"}),i={...rn,...e,hotWordReplacementRules:[...re,...null!=(n=e.hotWordReplacementRules)?n:[]]};r.bind(tJ.IOptions).toConstantValue(i),r.bind(tJ.ErrorManager).to(n4),r.bind(tJ.CommonRequest).to(n_);let{agentConfig:o,agentService:s,enableDebugMode:a}=i,c=!!(null==o?void 0:o.robotId),l=!!(null==o?void 0:o.token),u=!!s;if(u&&o&&a&&console.warn("[createAaaSPilotKit] agentService 已提供,agentConfig 配置将被忽略。"),!u&&!c&&!l)throw Error("[createAaaSPilotKit] 未检测到有效的 agent 配置,请至少提供 agentService 或 agentConfig 中的 robotId/token。");s?(Reflect.hasOwnMetadata("@inversifyjs/core/classIsInjectableFlagReflectKey",s)||(et(e_(),s),et(eb(),s)),r.bind(tJ.AgentService).to(s)):l?r.bind(tJ.AgentService).to(oJ):c&&r.bind(tJ.AgentService).to(oQ),r.bind(tJ.SignalingService).to(o2),r.bind(tJ.ASRService).to(sW);let{rendererMode:d}=i;return r.bind(tJ.DigitalHumanService).to(oX),r.bind(tJ.ConversationService).to(ic),r.bind(tJ.AaaSPilotKitController).to(oz),r.get(tJ.AaaSPilotKitController)}})(),i})());
|
|
49
|
+
- service redirections:
|
|
50
|
+
- ${e.map(e=>E(e)).join("\n - ")}`}function eN(e,n,r){if(Array.isArray(e.bindings)&&1===e.bindings.length){let[i]=e.bindings;return void(eM(i)&&function e(n,r,i,o){if(1===n.redirections.length){let[s]=n.redirections;return void(eM(s)&&e(s,r,i,[...o,s.binding.targetServiceIdentifier]))}eP(n.redirections,r,i,o)}(i,n,r,[i.binding.targetServiceIdentifier]))}eP(e.bindings,n,r,[])}function eL(e){return I.is(e)?e.unwrap():e}function eU(e){return(n,r,i)=>{let o=eL(i.value),s=r.concat({getAncestorsCalled:!1,name:i.name,serviceIdentifier:o,tags:i.tags}),a=new eE(s.last),c=i.kind===a6.multipleInjection&&i.chained,d=eO(n,a,{chained:c}),l=[],u={bindings:l,isContextFree:!0,serviceIdentifier:o};if(l.push(...e(n,s,d,u,c)),u.isContextFree=!s.last.elem.getAncestorsCalled,i.kind===a6.singleInjection){eN(u,i.optional,s.last);let[e]=l;u.bindings=e}return u}}function eF(e){return(n,r,i)=>{let o=eL(i.value),s=r.concat({getAncestorsCalled:!1,name:i.name,serviceIdentifier:o,tags:i.tags}),a=new eE(s.last),c=i.kind===a9.multipleInjection&&i.chained,d=eO(n,a,{chained:c}),l=[],u={bindings:l,isContextFree:!0,serviceIdentifier:o};if(l.push(...e(n,s,d,u,c)),u.isContextFree=!s.last.elem.getAncestorsCalled,i.kind===a9.singleInjection){eN(u,i.optional,s.last);let[e]=l;u.bindings=e}return u}}function eH(e){let n=(n,r,i)=>{let o={binding:r,classMetadata:n.operations.getClassMetadata(r.implementationType),constructorParams:[],propertyParams:new Map};return e({autobindOptions:n.autobindOptions,node:o,operations:n.operations,servicesBranch:n.servicesBranch},i)},r=(n,r,i)=>e({autobindOptions:n.autobindOptions,node:{binding:r,params:[]},operations:n.operations,servicesBranch:n.servicesBranch},i),i=(e,i,s,a,c)=>{let d=eM(a)?a.binding.targetServiceIdentifier:a.serviceIdentifier;e.servicesBranch.push(d);let l=[];for(let a of s)switch(a.type){case H:l.push(n(e,a,i));break;case V:l.push(r(e,a,i));break;case z:{let n=o(e,i,a,c);l.push(n);break}default:l.push({binding:a})}return e.servicesBranch.pop(),l},o=(e,n,r,o)=>{let s={binding:r,redirections:[]},a=eO(e,new eE(n.last),{chained:o,customServiceIdentifier:r.targetServiceIdentifier});return s.redirections.push(...i(e,n,a,s,o)),s};return i}function eq(e,n,r,i){void 0!==e&&(ex.is(r)&&!r.isExpanded()||r.isContextFree)?n.setPlan(e,{tree:{root:r}}):n.setNonCachedServiceNode(r,i)}class eV extends ex{#_;#w;#S;#R;constructor(e,n,r,i,o){super(o,eL(i.value)),this.#w=n,this.#_=e,this.#S=r,this.#R=i}_buildPlanServiceNode(){return this.#w(this.#_,this.#S,this.#R)}}class ez extends ex{#_;#T;#S;#C;constructor(e,n,r,i,o){super(o,eL(i.value)),this.#_=e,this.#T=n,this.#S=r,this.#C=i}_buildPlanServiceNode(){return this.#T(this.#_,this.#S,this.#C)}}function eG(e,n,r,i){let o,s,a=(o=(n,i,o)=>{if(o.kind===a6.unmanaged)return;let s=function(e){let n;if(0===e.tags.size)n=void 0;else{if(1!==e.tags.size)return;{let[r,i]=e.tags.entries().next().value;n={key:r,value:i}}}let r=I.is(e.value)?e.value.unwrap():e.value;return e.kind===a6.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:r,tag:n}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:r,tag:n}}(o);if(void 0!==s){let e=n.operations.getPlan(s);if(void 0!==e&&e.tree.root.isContextFree)return e.tree.root}let a=r(n,i,o),c=new eV(n,e,i,o,a);return eq(s,n.operations,c,{bindingConstraintsList:i,chainedBindings:o.kind===a6.multipleInjection&&o.chained,optionalBindings:o.optional}),c},(e,n,r)=>{let i=n.classMetadata;for(let[s,a]of i.constructorArguments.entries())n.constructorParams[s]=o(e,r,a);for(let[s,a]of i.properties){let i=o(e,r,a);void 0!==i&&n.propertyParams.set(s,i)}return e.node}),c=(s=(e,r,o)=>{let s=function(e){let n;if(0===e.tags.size)n=void 0;else{if(1!==e.tags.size)return;{let[r,i]=e.tags.entries().next().value;n={key:r,value:i}}}let r=I.is(e.value)?e.value.unwrap():e.value;return e.kind===a9.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:r,tag:n}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:r,tag:n}}(o);if(void 0!==s){let n=e.operations.getPlan(s);if(void 0!==n&&n.tree.root.isContextFree)return n.tree.root}let a=i(e,r,o),c=new ez(e,n,r,o,a);return eq(s,e.operations,c,{bindingConstraintsList:r,chainedBindings:o.kind===a9.multipleInjection&&o.chained,optionalBindings:o.optional}),c},(e,n,r)=>{for(let[i,o]of n.binding.metadata.arguments.entries())n.params[i]=s(e,r,o);return e.node});return(e,n)=>e.node.binding.type===H?a(e,e.node,n):c(e,e.node,n)}class eW extends ex{#_;constructor(e,n){super(n,n.serviceIdentifier),this.#_=e}_buildPlanServiceNode(){return eY(this.#_)}}let eX=eU(eK),e$=eF(eK),eJ=eH(eG(eX,e$,eX,e$));function eK(e,n,r,i,o){return eJ(e,n,r,i,o)}let eY=e=>{let n=ek(e),r=new eE(n.last),i=e.rootConstraints.isMultiple&&e.rootConstraints.chained,o=eO(e,r,{chained:i}),s=[],a={bindings:s,isContextFree:!0,serviceIdentifier:e.rootConstraints.serviceIdentifier};if(s.push(...eJ(e,n,o,a,i)),a.isContextFree=!n.last.elem.getAncestorsCalled,!e.rootConstraints.isMultiple){var c;eN(a,null!=(c=e.rootConstraints.isOptional)&&c,n.last);let[r]=s;a.bindings=r}return a};(aH=a7||(a7={})).bindingAdded="bindingAdded",aH.bindingRemoved="bindingRemoved";class eQ{#x;#E;#O;constructor(){this.#x=[],this.#E=8,this.#O=1024}*[Symbol.iterator](){let e=0;for(let n of this.#x){let r=n.deref();void 0===r?++e:yield r}this.#x.length>=this.#E&&this.#I(e)&&this.#k(e)}push(e){let n=new WeakRef(e);if(this.#x.push(n),this.#x.length>=this.#E&&this.#x.length%this.#O==0){let e=0;for(let n of this.#x)void 0===n.deref()&&++e;this.#I(e)&&this.#k(e)}}#k(e){let n=Array(this.#x.length-e),r=0;for(let e of this.#x)e.deref()&&(n[r++]=e);this.#x=n}#I(e){return e>=.5*this.#x.length}}let eZ=eH(eG(eX,e$,function(e,n,r){return e0(e,n,r)},function(e,n,r){return e1(e,n,r)})),e0=(o=eU(eZ),(e,n,r)=>{try{return o(e,n,r)}catch(e){if(Q.isErrorOfKind(e,a2.planning))return;throw e}}),e1=(s=eF(eZ),(e,n,r)=>{try{return s(e,n,r)}catch(e){if(Q.isErrorOfKind(e,a2.planning))return;throw e}});function e2(e,n,r,i,o){if(ex.is(n)&&!n.isExpanded())return{isContextFreeBinding:!0,shouldInvalidateServiceNode:!1};let s=new eE(i.last);return!r.isSatisfiedBy(s)||i.last.elem.getAncestorsCalled?{isContextFreeBinding:!i.last.elem.getAncestorsCalled,shouldInvalidateServiceNode:!1}:function(e,n,r,i,o){let s;try{[s]=eZ(e,i,[r],n,o)}catch(e){if(eT(e))return{isContextFreeBinding:!1,shouldInvalidateServiceNode:!0};throw e}var a=s;if(Array.isArray(n.bindings))n.bindings.push(a);else{if(void 0!==n.bindings){if(!ex.is(n))throw new Q(a2.planning,"Unexpected non-lazy plan service node. This is likely a bug in the planning logic. Please, report this issue");return{isContextFreeBinding:!0,shouldInvalidateServiceNode:!0}}n.bindings=a}return{isContextFreeBinding:!0,shouldInvalidateServiceNode:!1}}(e,n,r,i,o)}function e3(e,n,r,i){var o;let s;if(ex.is(e)&&!e.isExpanded())return{bindingNodeRemoved:void 0,isContextFreeBinding:!0};let a=new eE(r.last);if(!n.isSatisfiedBy(a)||r.last.elem.getAncestorsCalled)return{bindingNodeRemoved:void 0,isContextFreeBinding:!r.last.elem.getAncestorsCalled};if(Array.isArray(e.bindings))e.bindings=e.bindings.filter(e=>e.binding!==n||(s=e,!1));else if((null==(o=e.bindings)?void 0:o.binding)===n)if(s=e.bindings,i)e.bindings=void 0;else{if(!ex.is(e))throw new Q(a2.planning,"Unexpected non-lazy plan service node. This is likely a bug in the planning logic. Please, report this issue");e.invalidate()}return{bindingNodeRemoved:s,isContextFreeBinding:!0}}class e4{#M;#P;#j;#A;#D;#B;constructor(){this.#M=new Map,this.#P=this.#N(),this.#j=this.#N(),this.#A=this.#N(),this.#D=this.#N(),this.#B=new eQ}clearCache(){for(let e of this.#L())e.clear();for(let e of this.#B)e.clearCache()}get(e){var n,r,i,o,s,a;return void 0===e.name?void 0===e.tag?this.#U(this.#P,e).get(e.serviceIdentifier):null==(r=this.#U(this.#D,e).get(e.serviceIdentifier))||null==(n=r.get(e.tag.key))?void 0:n.get(e.tag.value):void 0===e.tag?null==(i=this.#U(this.#j,e).get(e.serviceIdentifier))?void 0:i.get(e.name):null==(a=this.#U(this.#A,e).get(e.serviceIdentifier))||null==(s=a.get(e.name))||null==(o=s.get(e.tag.key))?void 0:o.get(e.tag.value)}invalidateServiceBinding(e){for(let n of(this.#F(e),this.#H(e),this.#q(e),this.#V(e),this.#z(e),this.#B))n.invalidateServiceBinding(e)}set(e,n){void 0===e.name?void 0===e.tag?this.#U(this.#P,e).set(e.serviceIdentifier,n):this.#G(this.#G(this.#U(this.#D,e),e.serviceIdentifier),e.tag.key).set(e.tag.value,n):void 0===e.tag?this.#G(this.#U(this.#j,e),e.serviceIdentifier).set(e.name,n):this.#G(this.#G(this.#G(this.#U(this.#A,e),e.serviceIdentifier),e.name),e.tag.key).set(e.tag.value,n)}setNonCachedServiceNode(e,n){let r=this.#M.get(e.serviceIdentifier);void 0===r&&(r=new Map,this.#M.set(e.serviceIdentifier,r)),r.set(e,n)}subscribe(e){this.#B.push(e)}#N(){let e=Array(8);for(let n=0;n<e.length;++n)e[n]=new Map;return e}#W(e,n,r,i){let o,s=!!(2&n);return o=s?{chained:!!(0&n),isMultiple:s,serviceIdentifier:e.binding.serviceIdentifier}:{isMultiple:s,serviceIdentifier:e.binding.serviceIdentifier},1&n&&(o.isOptional=!0),void 0!==r&&(o.name=r),void 0!==i&&(o.tag=i),{autobindOptions:void 0,operations:e.operations,rootConstraints:o,servicesBranch:[]}}#G(e,n){let r=e.get(n);return void 0===r&&(r=new Map,e.set(n,r)),r}#U(e,n){return e[this.#X(n)]}#L(){return[this.#M,...this.#P,...this.#j,...this.#A,...this.#D]}#X(e){return e.isMultiple?4*!!e.chained|!!e.optional|2:+!!e.optional}#H(e){for(let[n,r]of this.#j.entries()){let i=r.get(e.binding.serviceIdentifier);if(void 0!==i)for(let[r,o]of i.entries())this.#$(e,o,n,r,void 0)}}#q(e){for(let[n,r]of this.#A.entries()){let i=r.get(e.binding.serviceIdentifier);if(void 0!==i)for(let[r,o]of i.entries())for(let[i,s]of o.entries())for(let[o,a]of s.entries())this.#$(e,a,n,r,{key:i,value:o})}}#J(e){switch(e.binding.type){case z:for(let n of e.redirections)this.#J(n);break;case H:for(let n of e.constructorParams)void 0!==n&&this.#K(n);for(let n of e.propertyParams.values())this.#K(n);break;case V:for(let n of e.params)this.#K(n)}}#K(e){let n=this.#M.get(e.serviceIdentifier);void 0!==n&&n.has(e)&&(n.delete(e),this.#Y(e))}#Y(e){if((!ex.is(e)||e.isExpanded())&&void 0!==e.bindings)if(Array.isArray(e.bindings))for(let n of e.bindings)this.#J(n);else this.#J(e.bindings)}#z(e){let n=this.#M.get(e.binding.serviceIdentifier);if(void 0!==n)switch(e.kind){case a7.bindingAdded:for(let[r,i]of n){let n=e2({autobindOptions:void 0,operations:e.operations,servicesBranch:[]},r,e.binding,i.bindingConstraintsList,i.chainedBindings);n.isContextFreeBinding?n.shouldInvalidateServiceNode&&ex.is(r)&&(this.#Y(r),r.invalidate()):this.clearCache()}break;case a7.bindingRemoved:for(let[r,i]of n){let n=e3(r,e.binding,i.bindingConstraintsList,i.optionalBindings);n.isContextFreeBinding?void 0!==n.bindingNodeRemoved&&this.#J(n.bindingNodeRemoved):this.clearCache()}}}#F(e){for(let[n,r]of this.#P.entries()){let i=r.get(e.binding.serviceIdentifier);this.#$(e,i,n,void 0,void 0)}}#V(e){for(let[n,r]of this.#D.entries()){let i=r.get(e.binding.serviceIdentifier);if(void 0!==i)for(let[r,o]of i.entries())for(let[i,s]of o.entries())this.#$(e,s,n,void 0,{key:r,value:i})}}#$(e,n,r,i,o){var s,a,c,d,l;if(void 0!==n&&ex.is(n.tree.root)){let u=this.#W(e,r,i,o);switch(e.kind){case a7.bindingAdded:{let r=(s=n.tree.root,a=e.binding,ex.is(s)&&!s.isExpanded()?{isContextFreeBinding:!0,shouldInvalidateServiceNode:!1}:e2(u,s,a,ek(u),u.rootConstraints.isMultiple&&u.rootConstraints.chained));r.isContextFreeBinding?r.shouldInvalidateServiceNode&&(this.#Y(n.tree.root),n.tree.root.invalidate()):this.clearCache()}break;case a7.bindingRemoved:{let r=(c=n.tree.root,d=e.binding,ex.is(c)&&!c.isExpanded()?{bindingNodeRemoved:void 0,isContextFreeBinding:!0}:e3(c,d,ek(u),null!=(l=u.rootConstraints.isOptional)&&l));r.isContextFreeBinding?void 0!==r.bindingNodeRemoved&&this.#J(r.bindingNodeRemoved):this.clearCache()}}}}}function e5(e,n){return x(n)?(e.cache={isRight:!0,value:n},n.then(n=>e6(e,n))):e6(e,n)}function e6(e,n){return e.cache={isRight:!0,value:n},n}async function e8(e,n,r){let i=await n,o=r.next();for(;!0!==o.done;)i=await o.value(e.context,i),o=r.next();return i}function e9(e,n,r){var i,o;let s,a=r;if(void 0!==n.onActivation){let r=n.onActivation;a=x(a)?a.then(n=>r(e.context,n)):r(e.context,a)}return i=n.serviceIdentifier,o=a,void 0===(s=e.getActivations(i))?o:x(o)?e8(e,o,s[Symbol.iterator]()):function(e,n,r){let i=n,o=r.next();for(;!0!==o.done;){let n=o.value(e.context,i);if(x(n))return e8(e,n,r);i=n,o=r.next()}return i}(e,o,s[Symbol.iterator]())}function e7(e){return(n,r)=>r.cache.isRight?r.cache.value:e5(r,e9(n,r,e(n,r)))}let te=e7(function(e,n){return n.value});function tt(e,n){return(r,i)=>{let o=e(i);switch(o.scope){case B:if(o.cache.isRight)return o.cache.value;return e5(o,e9(r,o,n(r,i)));case D:{if(r.requestScopeCache.has(o.id))return r.requestScopeCache.get(o.id);let e=e9(r,o,n(r,i));return r.requestScopeCache.set(o.id,e),e}case N:return e9(r,o,n(r,i))}}}let tn=tt(function(e){return e},function(e,n){return n.value(e.context)}),tr=e7(function(e,n){return n.factory(e.context)});function ti(e,n,r){let i=function(e,n,r){if(!(r in e))throw new Q(a2.resolution,`Expecting a "${r.toString()}" property when resolving "${n.implementationType.name}" class @postConstruct decorated method, none found.`);if("function"!=typeof e[r])throw new Q(a2.resolution,`Expecting a "${r.toString()}" method when resolving "${n.implementationType.name}" class @postConstruct decorated method, a non function property was found instead.`);{let i;try{i=e[r]()}catch(e){throw new Q(a2.resolution,`Unexpected error found when calling "${r.toString()}" @postConstruct decorated method on class "${n.implementationType.name}"`,{cause:e})}if(x(i))return async function(e,n,r){try{await r}catch(r){throw new Q(a2.resolution,`Unexpected error found when calling "${n.toString()}" @postConstruct decorated method on class "${e.implementationType.name}"`,{cause:r})}}(n,r,i)}}(e,n,r);return x(i)?i.then(()=>e):e}function to(e,n,r){if(0===r.size)return e;let i=e;for(let e of r)i=x(i)?i.then(r=>ti(r,n,e)):ti(i,n,e);return i}function ts(e){return(n,r,i)=>{let o=new i.binding.implementationType(...n),s=e(r,o,i);return x(s)?s.then(()=>to(o,i.binding,i.classMetadata.lifecycle.postConstructMethodNames)):to(o,i.binding,i.classMetadata.lifecycle.postConstructMethodNames)}}let ta=e7(function(e,n){return n.provider(e.context)}),tc=(aq=tm,(e,n,r)=>{let i=[];for(let[o,s]of r.propertyParams){let a=r.classMetadata.properties.get(o);if(void 0===a)throw new Q(a2.resolution,`Expecting metadata at property "${o.toString()}", none found`);a.kind!==a6.unmanaged&&void 0!==s.bindings&&(n[o]=aq(e,s),x(n[o])&&i.push((async()=>{n[o]=await n[o]})()))}if(i.length>0)return Promise.all(i).then(()=>{})}),td=(aV=th,function e(n,r){let i=[];for(let o of r.redirections)eM(o)?i.push(...e(n,o)):i.push(aV(n,o));return i}),tl=(az=tm,aW=(e,n)=>{let r=[];for(let i of n.constructorParams)void 0===i?r.push(void 0):r.push(az(e,i));return r.some(x)?Promise.all(r):r},aG=ts(tc),aX=async(e,n,r)=>aG(await e,n,r),a$=ts(tc),(e,n)=>{let r=aW(e,n);return x(r)?aX(r,e,n):a$(r,e,n)}),tu=(aJ=tm,aK=(e,n)=>{let r=[];for(let i of n.params)r.push(aJ(e,i));return r.some(x)?Promise.all(r):r},(e,n)=>{let r=aK(e,n);return x(r)?r.then(e=>n.binding.factory(...e)):n.binding.factory(...r)}),tf=tt(function(e){return e.binding},tl),tp=tt(function(e){return e.binding},tu);function th(e,n){switch(n.binding.type){case L:return te(e,n.binding);case U:return tn(e,n.binding);case F:return tr(e,n.binding);case H:return tf(e,n);case q:return ta(e,n.binding);case V:return tp(e,n)}}function tm(e,n){if(void 0!==n.bindings)return Array.isArray(n.bindings)?function(e,n){let r=[];for(let i of n)eM(i)?r.push(...td(e,i)):r.push(th(e,i));return r.some(x)?Promise.all(r):r}(e,n.bindings):function(e,n){if(eM(n)){let r=td(e,n);if(1===r.length)return r[0];throw new Q(a2.resolution,"Unexpected multiple resolved values on single injection")}return th(e,n)}(e,n.bindings)}function tv(e,n){if("function"==typeof e[n])return e[n]()}function tg(e,n){let r,i=e.lifecycle.preDestroyMethodNames;if(0!==i.size){for(let e of i)r=void 0===r?tv(n,e):r.then(()=>tv(n,e));return r}}function ty(e,n,r){let i=e.getDeactivations(n);if(void 0!==i)return x(r)?tb(r,i[Symbol.iterator]()):function(e,n){let r=n.next();for(;!0!==r.done;){if(x(r.value(e)))return tb(e,n);r=n.next()}}(r,i[Symbol.iterator]())}async function tb(e,n){let r=await e,i=n.next();for(;!0!==i.done;)await i.value(r),i=n.next()}function t_(e,n){let r=n.cache;return x(r.value)?r.value.then(r=>tw(e,n,r)):tw(e,n,r.value)}function tw(e,n,r){let i;return void 0!==n.onDeactivation&&(i=(0,n.onDeactivation)(r)),void 0===i?ty(e,n.serviceIdentifier,r):i.then(()=>ty(e,n.serviceIdentifier,r))}function tS(e,n){if(void 0===n)return;let r=function(e){let n=[];for(let r of e)void 0!==r.scope&&r.scope===B&&r.cache.isRight&&n.push(r);return n}(n),i=[];for(let n of r){let r=function(e,n){let r=function(e,n){if(n.type===H){let r=e.getClassMetadata(n.implementationType),i=n.cache.value;return x(i)?i.then(e=>tg(r,e)):tg(r,i)}}(e,n);return void 0===r?t_(e,n):r.then(()=>t_(e,n))}(e,n);void 0!==r&&i.push(r)}return i.length>0?Promise.all(i).then(()=>{}):void 0}let tR=Symbol.for("@inversifyjs/plugin/isPlugin"),tT=Symbol.for("@inversifyjs/container/bindingIdentifier");function tC(e){return"object"==typeof e&&null!==e&&!0===e[tT]}class tx{static #F=this.always=e=>!0}let tE=Symbol.for("@inversifyjs/container/InversifyContainerError");class tO extends Error{constructor(e,n,r){super(n,r),this[tE]=!0,this.kind=e}static is(e){return"object"==typeof e&&null!==e&&!0===e[tE]}static isErrorOfKind(e,n){return tO.is(e)&&e.kind===n}}function tI(e){return{[tT]:!0,id:e.id}}function tk(e){return n=>{for(let r=n.getAncestor();void 0!==r;r=r.getAncestor())if(e(r))return!0;return!1}}function tM(e){return n=>n.name===e}function tP(e){return n=>n.serviceIdentifier===e}function tj(e,n){return r=>r.tags.has(e)&&r.tags.get(e)===n}function tA(e){return void 0===e.name&&0===e.tags.size}function tD(e){let n=tk(e);return e=>!n(e)}function tB(e){return n=>{let r=n.getAncestor();return void 0===r||!e(r)}}function tN(e){return n=>{let r=n.getAncestor();return void 0!==r&&e(r)}}(aY=ce||(ce={}))[aY.invalidOperation=0]="invalidOperation";class tL{#r;constructor(e){this.#r=e}getIdentifier(){return tI(this.#r)}inRequestScope(){return this.#r.scope=D,new tq(this.#r)}inSingletonScope(){return this.#r.scope=B,new tq(this.#r)}inTransientScope(){return this.#r.scope=N,new tq(this.#r)}}class tU{#t;#o;#a;#s;constructor(e,n,r,i){this.#t=e,this.#o=n,this.#a=r,this.#s=i}to(e){var n;let r=Z(e),i={cache:{isRight:!1,value:void 0},id:A(),implementationType:e,isSatisfiedBy:tx.always,moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,scope:null!=(n=r.scope)?n:this.#a,serviceIdentifier:this.#s,type:H};return this.#t(i),new tV(i)}toSelf(){if("function"!=typeof this.#s)throw Error('"toSelf" function can only be applied when a newable function is used as service identifier');return this.to(this.#s)}toConstantValue(e){let n={cache:{isRight:!1,value:void 0},id:A(),isSatisfiedBy:tx.always,moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,scope:B,serviceIdentifier:this.#s,type:L,value:e};return this.#t(n),new tq(n)}toDynamicValue(e){let n={cache:{isRight:!1,value:void 0},id:A(),isSatisfiedBy:tx.always,moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,scope:this.#a,serviceIdentifier:this.#s,type:U,value:e};return this.#t(n),new tV(n)}toResolvedValue(e,n){let r={cache:{isRight:!1,value:void 0},factory:e,id:A(),isSatisfiedBy:tx.always,metadata:this.#i(n),moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,scope:this.#a,serviceIdentifier:this.#s,type:V};return this.#t(r),new tV(r)}toFactory(e){let n={cache:{isRight:!1,value:void 0},factory:e,id:A(),isSatisfiedBy:tx.always,moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,scope:B,serviceIdentifier:this.#s,type:F};return this.#t(n),new tq(n)}toProvider(e){let n={cache:{isRight:!1,value:void 0},id:A(),isSatisfiedBy:tx.always,moduleId:this.#o,onActivation:void 0,onDeactivation:void 0,provider:e,scope:B,serviceIdentifier:this.#s,type:q};return this.#t(n),new tq(n)}toService(e){let n={id:A(),isSatisfiedBy:tx.always,moduleId:this.#o,serviceIdentifier:this.#s,targetServiceIdentifier:e,type:z};this.#t(n)}#i(e){return{arguments:(null!=e?e:[]).map(e=>{var n,r,i,o,s;return"object"!=typeof e||I.is(e)?{kind:a9.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}:!0===e.isMultiple?{chained:null!=(n=e.chained)&&n,kind:a9.multipleInjection,name:e.name,optional:null!=(r=e.optional)&&r,tags:new Map((null!=(i=e.tags)?i:[]).map(e=>[e.key,e.value])),value:e.serviceIdentifier}:{kind:a9.singleInjection,name:e.name,optional:null!=(o=e.optional)&&o,tags:new Map((null!=(s=e.tags)?s:[]).map(e=>[e.key,e.value])),value:e.serviceIdentifier}})}}}class tF{#r;constructor(e){this.#r=e}getIdentifier(){return tI(this.#r)}onActivation(e){return this.#r.onActivation=e,new tH(this.#r)}onDeactivation(e){if(this.#r.onDeactivation=e,this.#r.scope!==B)throw new tO(ce.invalidOperation,`Binding for service "${E(this.#r.serviceIdentifier)}" has a deactivation function, but its scope is not singleton. Deactivation functions can only be used with singleton bindings.`);return new tH(this.#r)}}class tH{#r;constructor(e){this.#r=e}getIdentifier(){return tI(this.#r)}when(e){return this.#r.isSatisfiedBy=e,new tF(this.#r)}whenAnyAncestor(e){return this.when(tk(e))}whenAnyAncestorIs(e){return this.when(tk(tP(e)))}whenAnyAncestorNamed(e){return this.when(tk(tM(e)))}whenAnyAncestorTagged(e,n){return this.when(tk(tj(e,n)))}whenDefault(){return this.when(tA)}whenNamed(e){return this.when(tM(e))}whenNoParent(e){return this.when(tB(e))}whenNoParentIs(e){return this.when(tB(tP(e)))}whenNoParentNamed(e){return this.when(tB(tM(e)))}whenNoParentTagged(e,n){return this.when(tB(tj(e,n)))}whenParent(e){return this.when(tN(e))}whenParentIs(e){return this.when(tN(tP(e)))}whenParentNamed(e){return this.when(tN(tM(e)))}whenParentTagged(e,n){return this.when(tN(tj(e,n)))}whenTagged(e,n){return this.when(tj(e,n))}whenNoAncestor(e){return this.when(tD(e))}whenNoAncestorIs(e){return this.when(tD(tP(e)))}whenNoAncestorNamed(e){return this.when(tD(tM(e)))}whenNoAncestorTagged(e,n){return this.when(tD(tj(e,n)))}}class tq extends tH{#c;constructor(e){super(e),this.#c=new tF(e)}onActivation(e){return this.#c.onActivation(e)}onDeactivation(e){return this.#c.onDeactivation(e)}}class tV extends tq{#d;constructor(e){super(e),this.#d=new tL(e)}inRequestScope(){return this.#d.inRequestScope()}inSingletonScope(){return this.#d.inSingletonScope()}inTransientScope(){return this.#d.inTransientScope()}}class tz{#u;#a;#l;#m;constructor(e,n,r,i){this.#u=e,this.#a=n,this.#l=r,this.#m=i}bind(e){return new tU(e=>{this.#h(e)},void 0,this.#a,e)}isBound(e,n){let r=this.#m.bindingService.get(e);return this.#v(e,r,n)}isCurrentBound(e,n){let r=this.#m.bindingService.getNonParentBindings(e);return this.#v(e,r,n)}async rebind(e){return await this.unbind(e),this.bind(e)}rebindSync(e){return this.unbindSync(e),this.bind(e)}async unbind(e){await this.#p(e)}async unbindAll(){let e=[...this.#m.bindingService.getNonParentBoundServices()];for(let n of(await Promise.all(e.map(async e=>{var n;let r;return n=this.#u,r=n.getBindings(e),tS(n,r)})),e))this.#m.activationService.removeAllByServiceId(n),this.#m.bindingService.removeAllByServiceId(n),this.#m.deactivationService.removeAllByServiceId(n);this.#m.planResultCacheService.clearCache()}unbindSync(e){void 0!==this.#p(e)&&this.#w(e)}#h(e){this.#m.bindingService.set(e),this.#l.invalidateService({binding:e,kind:a7.bindingAdded})}#w(e){var n;let r;if(tC(e)){let i=this.#m.bindingService.getById(e.id),o=null==(n=function(e){if(void 0===e)return;let n=e.next();return!0!==n.done?n.value:void 0}(null==i?void 0:i[Symbol.iterator]()))?void 0:n.serviceIdentifier;r=void 0===o?"Unexpected asynchronous deactivation when unbinding binding identifier. Consider using Container.unbind() instead.":`Unexpected asynchronous deactivation when unbinding "${E(o)}" binding. Consider using Container.unbind() instead.`}else r=`Unexpected asynchronous deactivation when unbinding "${E(e)}" service. Consider using Container.unbind() instead.`;throw new tO(ce.invalidOperation,r)}#p(e){return tC(e)?this.#f(e):this.#T(e)}#f(e){let n=this.#m.bindingService.getById(e.id),r=void 0===n?void 0:[...n],i=tS(this.#u,n);if(void 0!==i)return i.then(()=>{this.#b(r,e)});this.#b(r,e)}#b(e,n){if(this.#m.bindingService.removeById(n.id),void 0!==e)for(let n of e)this.#l.invalidateService({binding:n,kind:a7.bindingRemoved})}#T(e){let n=this.#m.bindingService.get(e),r=void 0===n?void 0:[...n],i=tS(this.#u,n);if(void 0!==i)return i.then(()=>{this.#O(e,r)});this.#O(e,r)}#O(e,n){if(this.#m.activationService.removeAllByServiceId(e),this.#m.bindingService.removeAllByServiceId(e),this.#m.deactivationService.removeAllByServiceId(e),void 0!==n)for(let e of n)this.#l.invalidateService({binding:e,kind:a7.bindingRemoved})}#v(e,n,r){if(void 0===n)return!1;let i={getAncestor:()=>{},name:null==r?void 0:r.name,serviceIdentifier:e,tags:new Map};for(let e of(void 0!==(null==r?void 0:r.tag)&&i.tags.set(r.tag.key,r.tag.value),n))if(e.isSatisfiedBy(i))return!0;return!1}}class tG{#y;#u;#a;#l;#m;constructor(e,n,r,i,o){this.#y=e,this.#u=n,this.#a=r,this.#l=i,this.#m=o}async load(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];await Promise.all(this.#n(...n))}loadSync(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];for(let e of this.#n(...n))if(void 0!==e)throw new tO(ce.invalidOperation,"Unexpected asynchronous module load. Consider using Container.load() instead.")}async unload(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];await Promise.all(this.#g(...n)),this.#S(n)}unloadSync(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];for(let e of this.#g(...n))if(void 0!==e)throw new tO(ce.invalidOperation,"Unexpected asynchronous module unload. Consider using Container.unload() instead.");this.#S(n)}#_(e){return{bind:n=>new tU(e=>{this.#h(e)},e,this.#a,n),isBound:this.#y.isBound.bind(this.#y),onActivation:(n,r)=>{this.#m.activationService.add(r,{moduleId:e,serviceId:n})},onDeactivation:(n,r)=>{this.#m.deactivationService.add(r,{moduleId:e,serviceId:n})},rebind:this.#y.rebind.bind(this.#y),rebindSync:this.#y.rebindSync.bind(this.#y),unbind:this.#y.unbind.bind(this.#y),unbindSync:this.#y.unbindSync.bind(this.#y)}}#S(e){for(let n of e)this.#m.activationService.removeAllByModuleId(n.id),this.#m.bindingService.removeAllByModuleId(n.id),this.#m.deactivationService.removeAllByModuleId(n.id);this.#m.planResultCacheService.clearCache()}#n(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return n.map(e=>e.load(this.#_(e.id)))}#h(e){this.#m.bindingService.set(e),this.#l.invalidateService({binding:e,kind:a7.bindingAdded})}#g(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return n.map(e=>{var n,r;let i;return n=this.#u,r=e.id,i=n.getBindingsFromModule(r),tS(n,i)})}}class tW{constructor(e){this.deactivationParams=function(e){return{getBindings:e.bindingService.get.bind(e.bindingService),getBindingsFromModule:e.bindingService.getByModuleId.bind(e.bindingService),getClassMetadata:Z,getDeactivations:e.deactivationService.get.bind(e.deactivationService)}}(e),e.onReset(()=>{var n;(n=this.deactivationParams).getBindings=e.bindingService.get.bind(e.bindingService),n.getBindingsFromModule=e.bindingService.getByModuleId.bind(e.bindingService),n.getDeactivations=e.deactivationService.get.bind(e.deactivationService)})}}class tX{#m;constructor(e){this.#m=e,this.planParamsOperations={getBindings:this.#m.bindingService.get.bind(this.#m.bindingService),getBindingsChained:this.#m.bindingService.getChained.bind(this.#m.bindingService),getClassMetadata:Z,getPlan:this.#m.planResultCacheService.get.bind(this.#m.planResultCacheService),setBinding:this.#h.bind(this),setNonCachedServiceNode:this.#m.planResultCacheService.setNonCachedServiceNode.bind(this.#m.planResultCacheService),setPlan:this.#m.planResultCacheService.set.bind(this.#m.planResultCacheService)},this.#m.onReset(()=>{this.#E()})}#E(){this.planParamsOperations.getBindings=this.#m.bindingService.get.bind(this.#m.bindingService),this.planParamsOperations.getBindingsChained=this.#m.bindingService.getChained.bind(this.#m.bindingService),this.planParamsOperations.setBinding=this.#h.bind(this)}#h(e){this.#m.bindingService.set(e),this.#m.planResultCacheService.invalidateServiceBinding({binding:e,kind:a7.bindingAdded,operations:this.planParamsOperations})}}class t${#x;#m;constructor(e,n){this.#x=e,this.#m=n}invalidateService(e){this.#m.planResultCacheService.invalidateServiceBinding({...e,operations:this.#x.planParamsOperations})}}class tJ{#R;#P;#L;#m;constructor(e,n,r){this.#m=n,this.#L=r,this.#R=this.#I(e),this.#P=this.#A()}register(e,n){let r=new n(e,this.#P);if(!0!==r[tR])throw new tO(ce.invalidOperation,"Invalid plugin. The plugin must extend the Plugin class");r.load(this.#R)}#I(e){return{define:(n,r)=>{if(Object.prototype.hasOwnProperty.call(e,n))throw new tO(ce.invalidOperation,`Container already has a method named "${String(n)}"`);e[n]=r},onPlan:this.#L.onPlan.bind(this.#L)}}#A(){let e=this.#m;return{get activationService(){return e.activationService},get bindingService(){return e.bindingService},get deactivationService(){return e.deactivationService},get planResultCacheService(){return e.planResultCacheService}}}}class tK{#C;constructor(e,n,r,i){this.activationService=e,this.bindingService=n,this.deactivationService=r,this.planResultCacheService=i,this.#C=[]}reset(e,n,r){for(let i of(this.activationService=e,this.bindingService=n,this.deactivationService=r,this.planResultCacheService.clearCache(),this.#C))i()}onReset(e){this.#C.push(e)}}class tY{#j;#a;#V;#B;#M;#x;#m;constructor(e,n,r,i){this.#x=e,this.#m=n,this.#B=this.#k(),this.#j=r,this.#a=i,this.#V=e=>this.#m.activationService.get(e),this.#M=[],this.#m.onReset(()=>{this.#E()})}get(e,n){let r=this.#N(!1,e,n),i=this.#U(r);if(x(i))throw new tO(ce.invalidOperation,`Unexpected asynchronous service when resolving service "${E(e)}"`);return i}getAll(e,n){let r=this.#N(!0,e,n),i=this.#U(r);if(x(i))throw new tO(ce.invalidOperation,`Unexpected asynchronous service when resolving service "${E(e)}"`);return i}async getAllAsync(e,n){let r=this.#N(!0,e,n);return this.#U(r)}async getAsync(e,n){let r=this.#N(!1,e,n);return this.#U(r)}onPlan(e){this.#M.push(e)}#E(){this.#B=this.#k()}#q(e,n,r){var i,o;let s=null==r?void 0:r.name,a=null!=(i=null==r?void 0:r.optional)&&i,c=null==r?void 0:r.tag;return e?{chained:null!=(o=null==r?void 0:r.chained)&&o,isMultiple:e,name:s,optional:a,serviceIdentifier:n,tag:c}:{isMultiple:e,name:s,optional:a,serviceIdentifier:n,tag:c}}#D(e,n,r){var i;let o={autobindOptions:(null!=(i=null==r?void 0:r.autobind)?i:this.#j)?{scope:this.#a}:void 0,operations:this.#x.planParamsOperations,rootConstraints:this.#G(e,n,r),servicesBranch:[]};return this.#W(o,r),o}#G(e,n,r){var i;return n?{chained:null!=(i=null==r?void 0:r.chained)&&i,isMultiple:n,serviceIdentifier:e}:{isMultiple:n,serviceIdentifier:e}}#N(e,n,r){let i=this.#q(e,n,r),o=this.#m.planResultCacheService.get(i);if(void 0!==o)return o;let s=function(e){try{var n,r;let i=e.rootConstraints.isMultiple?{chained:e.rootConstraints.chained,isMultiple:!0,name:e.rootConstraints.name,optional:null!=(n=e.rootConstraints.isOptional)&&n,serviceIdentifier:e.rootConstraints.serviceIdentifier,tag:e.rootConstraints.tag}:{isMultiple:!1,name:e.rootConstraints.name,optional:null!=(r=e.rootConstraints.isOptional)&&r,serviceIdentifier:e.rootConstraints.serviceIdentifier,tag:e.rootConstraints.tag},o=e.operations.getPlan(i);if(void 0!==o)return o;let s=eY(e),a={tree:{root:new eW(e,s)}};return e.operations.setPlan(i,a),a}catch(n){if(eT(n)){let r,i=0===(r=[...function(e){let n=new Set;for(let r of e.servicesBranch){if(n.has(r))return[...n,r];n.add(r)}return[...n]}(e)]).length?"(No dependency trace)":r.map(E).join(" -> ");throw new Q(a2.planning,`Circular dependency found: ${i}`,{cause:n})}throw n}}(this.#D(n,e,r));for(let e of this.#M)e(i,s);return s}#k(){return{get:this.get.bind(this),getAll:this.getAll.bind(this),getAllAsync:this.getAllAsync.bind(this),getAsync:this.getAsync.bind(this)}}#U(e){var n={context:this.#B,getActivations:this.#V,planResult:e,requestScopeCache:new Map};try{return tm(n,n.planResult.tree.root)}catch(e){!function(e,n){if(eT(n)){var r;let i,o,s,a=0===(s=[...(i=e.planResult.tree.root,o=[],null!=(r=function e(n){let r=o.indexOf(n);if(-1!==r)return[...o.slice(r),n].map(e=>e.serviceIdentifier);o.push(n);try{for(let r of function(e){let n=[],r=e.bindings;if(void 0===r)return n;let i=e=>{if(eM(e))for(let n of e.redirections)i(n);else switch(e.binding.type){case H:for(let r of e.constructorParams)void 0!==r&&n.push(r);for(let r of e.propertyParams.values())n.push(r);break;case V:for(let r of e.params)n.push(r)}};if(Array.isArray(r))for(let e of r)i(e);else i(r);return n}(n)){let n=e(r);if(void 0!==n)return n}}finally{o.pop()}}(i))?r:[])]).length?"(No dependency trace)":s.map(E).join(" -> ");throw new Q(a2.planning,`Circular dependency found: ${a}`,{cause:n})}throw n}(n,e)}}#W(e,n){var r;void 0!==n&&(void 0!==n.name&&(e.rootConstraints.name=n.name),!0===n.optional&&(e.rootConstraints.isOptional=!0),void 0!==n.tag&&(e.rootConstraints.tag={key:n.tag.key,value:n.tag.value}),e.rootConstraints.isMultiple&&(e.rootConstraints.chained=null!=(r=null==n?void 0:n.chained)&&r))}}class tQ{#m;#J;constructor(e){this.#m=e,this.#J=[]}restore(){let e=this.#J.pop();if(void 0===e)throw new tO(ce.invalidOperation,"No snapshot available to restore");this.#m.reset(e.activationService,e.bindingService,e.deactivationService)}snapshot(){this.#J.push({activationService:this.#m.activationService.clone(),bindingService:this.#m.bindingService.clone(),deactivationService:this.#m.deactivationService.clone()})}}class tZ{#y;#F;#H;#m;#L;#z;constructor(e){var n,r;const i=null!=(n=null==e?void 0:e.autobind)&&n,o=null!=(r=null==e?void 0:e.defaultScope)?r:N;this.#m=this.#$(e,i,o);const s=new tX(this.#m),a=new t$(s,this.#m),c=new tW(this.#m);this.#y=new tz(c.deactivationParams,o,a,this.#m),this.#F=new tG(this.#y,c.deactivationParams,o,a,this.#m),this.#L=new tY(s,this.#m,i,o),this.#H=new tJ(this,this.#m,this.#L),this.#z=new tQ(this.#m)}bind(e){return this.#y.bind(e)}get(e,n){return this.#L.get(e,n)}getAll(e,n){return this.#L.getAll(e,n)}async getAllAsync(e,n){return this.#L.getAllAsync(e,n)}async getAsync(e,n){return this.#L.getAsync(e,n)}isBound(e,n){return this.#y.isBound(e,n)}isCurrentBound(e,n){return this.#y.isCurrentBound(e,n)}async load(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.#F.load(...n)}loadSync(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];this.#F.loadSync(...n)}onActivation(e,n){this.#m.activationService.add(n,{serviceId:e})}onDeactivation(e,n){this.#m.deactivationService.add(n,{serviceId:e})}register(e){this.#H.register(this,e)}restore(){this.#z.restore()}async rebind(e){return this.#y.rebind(e)}rebindSync(e){return this.#y.rebindSync(e)}snapshot(){this.#z.snapshot()}async unbind(e){await this.#y.unbind(e)}async unbindAll(){return this.#y.unbindAll()}unbindSync(e){this.#y.unbindSync(e)}async unload(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];return this.#F.unload(...n)}unloadSync(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];this.#F.unloadSync(...n)}#K(e,n){if(e)return{scope:n}}#$(e,n,r){let i=this.#K(n,r);if(void 0===(null==e?void 0:e.parent))return new tK(X.build(()=>{}),er.build(()=>{},i),ei.build(()=>{}),new e4);let o=new e4,s=e.parent;return s.#m.planResultCacheService.subscribe(o),new tK(X.build(()=>s.#m.activationService),er.build(()=>s.#m.bindingService,i),ei.build(()=>s.#m.deactivationService),o)}}let t0=new WeakMap,t1=new WeakMap,t2=new WeakMap,t3=Symbol("anyProducer"),t4=Promise.resolve(),t5=Symbol("listenerAdded"),t6=Symbol("listenerRemoved"),t8=!1,t9=!1,t7=e=>"string"==typeof e||"symbol"==typeof e||"number"==typeof e;function ne(e){if(!t7(e))throw TypeError("`eventName` must be a string, symbol, or number")}function nt(e){if("function"!=typeof e)throw TypeError("listener must be a function")}function nn(e,n){let r=t1.get(e);if(r.has(n))return r.get(n)}function nr(e,n){let r=t7(n)?n:t3,i=t2.get(e);if(i.has(r))return i.get(r)}function ni(e,n){n=Array.isArray(n)?n:[n];let r=!1,i=()=>{},o=[],s={enqueue(e){o.push(e),i()},finish(){r=!0,i()}};for(let r of n){let n=nr(e,r);n||(n=new Set,t2.get(e).set(r,n)),n.add(s)}return{async next(){return o?0===o.length?(r?o=void 0:await new Promise(e=>{i=e}),this.next()):{done:!1,value:await o.shift()}:{done:!0}},async return(r){for(let r of(o=void 0,n)){let n=nr(e,r);n&&(n.delete(s),0===n.size&&t2.get(e).delete(r))}return i(),arguments.length>0?{done:!0,value:await r}:{done:!0}},[Symbol.asyncIterator](){return this}}}function no(e){if(void 0===e)return nd;if(!Array.isArray(e))throw TypeError("`methodNames` must be an array of strings");for(let n of e)if(!nd.includes(n)){if("string"!=typeof n)throw TypeError("`methodNames` element must be a string");throw Error(`${n} is not Emittery method`)}return e}let ns=e=>e===t5||e===t6;function na(e,n,r){if(ns(n))try{t8=!0,e.emit(n,r)}finally{t8=!1}}class nc{static mixin(e,n){return n=no(n),r=>{if("function"!=typeof r)throw TypeError("`target` must be function");for(let e of n)if(void 0!==r.prototype[e])throw Error(`The property \`${e}\` already exists on \`target\``);Object.defineProperty(r.prototype,e,{enumerable:!1,get:function(){return Object.defineProperty(this,e,{enumerable:!1,value:new nc}),this[e]}});let i=n=>function(){for(var r=arguments.length,i=Array(r),o=0;o<r;o++)i[o]=arguments[o];return this[e][n](...i)};for(let e of n)Object.defineProperty(r.prototype,e,{enumerable:!1,value:i(e)});return r}}static get isDebugEnabled(){var e,n;if("object"!=typeof(null==(e=globalThis.process)?void 0:e.env))return t9;let{env:r}=null!=(n=globalThis.process)?n:{env:{}};return"emittery"===r.DEBUG||"*"===r.DEBUG||t9}static set isDebugEnabled(e){t9=e}constructor(e={}){var n;t0.set(this,new Set),t1.set(this,new Map),t2.set(this,new Map),t2.get(this).set(t3,new Set),this.debug=null!=(n=e.debug)?n:{},void 0===this.debug.enabled&&(this.debug.enabled=!1),this.debug.logger||(this.debug.logger=(e,n,r,i)=>{try{i=JSON.stringify(i)}catch{i=`Object with the following keys failed to stringify: ${Object.keys(i).join(",")}`}("symbol"==typeof r||"number"==typeof r)&&(r=r.toString());let o=new Date,s=`${o.getHours()}:${o.getMinutes()}:${o.getSeconds()}.${o.getMilliseconds()}`;console.log(`[${s}][emittery:${e}][${n}] Event Name: ${r}
|
|
51
|
+
data: ${i}`)})}logIfDebugEnabled(e,n,r){(nc.isDebugEnabled||this.debug.enabled)&&this.debug.logger(e,this.debug.name,n,r)}on(e,n){let{signal:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};for(let r of(nt(n),e=Array.isArray(e)?e:[e])){ne(r);let e=nn(this,r);e||(e=new Set,t1.get(this).set(r,e)),e.add(n),this.logIfDebugEnabled("subscribe",r,void 0),ns(r)||na(this,t5,{eventName:r,listener:n})}let i=()=>{this.off(e,n),null==r||r.removeEventListener("abort",i)};return null==r||r.addEventListener("abort",i,{once:!0}),(null==r?void 0:r.aborted)&&i(),i}off(e,n){for(let r of(nt(n),e=Array.isArray(e)?e:[e])){ne(r);let e=nn(this,r);e&&(e.delete(n),0===e.size&&t1.get(this).delete(r)),this.logIfDebugEnabled("unsubscribe",r,void 0),ns(r)||na(this,t6,{eventName:r,listener:n})}}once(e,n){let r;if(void 0!==n&&"function"!=typeof n)throw TypeError("predicate must be a function");let i=new Promise(i=>{r=this.on(e,e=>{(!n||n(e))&&(r(),i(e))})});return i.off=r,i}events(e){for(let n of e=Array.isArray(e)?e:[e])ne(n);return ni(this,e)}async emit(e,n){var r;if(ne(e),ns(e)&&!t8)throw TypeError("`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`");this.logIfDebugEnabled("emit",e,n);let i=t2.get(this);if(i.has(e))for(let r of i.get(e))r.enqueue(n);if(i.has(t3)){let r=Promise.all([e,n]);for(let e of i.get(t3))e.enqueue(r)}let o=null!=(r=nn(this,e))?r:new Set,s=t0.get(this),a=[...o],c=ns(e)?[]:[...s];await t4,await Promise.all([...a.map(async e=>{if(o.has(e))return e(n)}),...c.map(async r=>{if(s.has(r))return r(e,n)})])}async emitSerial(e,n){var r;if(ne(e),ns(e)&&!t8)throw TypeError("`eventName` cannot be meta event `listenerAdded` or `listenerRemoved`");this.logIfDebugEnabled("emitSerial",e,n);let i=null!=(r=nn(this,e))?r:new Set,o=t0.get(this),s=[...i],a=[...o];for(let e of(await t4,s))i.has(e)&&await e(n);for(let r of a)o.has(r)&&await r(e,n)}onAny(e){let{signal:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};nt(e),this.logIfDebugEnabled("subscribeAny",void 0,void 0),t0.get(this).add(e),na(this,t5,{listener:e});let r=()=>{this.offAny(e),null==n||n.removeEventListener("abort",r)};return null==n||n.addEventListener("abort",r,{once:!0}),(null==n?void 0:n.aborted)&&r(),r}anyEvent(){return ni(this)}offAny(e){nt(e),this.logIfDebugEnabled("unsubscribeAny",void 0,void 0),na(this,t6,{listener:e}),t0.get(this).delete(e)}clearListeners(e){for(let n of e=Array.isArray(e)?e:[e])if(this.logIfDebugEnabled("clear",n,void 0),t7(n)){let e=nn(this,n);e&&e.clear();let r=nr(this,n);if(r){for(let e of r)e.finish();r.clear()}}else{for(let[e,n]of(t0.get(this).clear(),t1.get(this).entries()))n.clear(),t1.get(this).delete(e);for(let[e,n]of t2.get(this).entries()){for(let e of n)e.finish();n.clear(),t2.get(this).delete(e)}}}listenerCount(e){e=Array.isArray(e)?e:[e];let n=0;for(let d of e){if(t7(d)){var r,i,o,s,a,c;n+=t0.get(this).size+(null!=(s=null==(r=nn(this,d))?void 0:r.size)?s:0)+(null!=(a=null==(i=nr(this,d))?void 0:i.size)?a:0)+(null!=(c=null==(o=nr(this))?void 0:o.size)?c:0);continue}for(let e of(void 0!==d&&ne(d),n+=t0.get(this).size,t1.get(this).values()))n+=e.size;for(let e of t2.get(this).values())n+=e.size}return n}bindMethods(e,n){if("object"!=typeof e||null===e)throw TypeError("`target` must be an object");for(let r of n=no(n)){if(void 0!==e[r])throw Error(`The property \`${r}\` already exists on \`target\``);Object.defineProperty(e,r,{enumerable:!1,value:this[r].bind(this)})}}}let nd=Object.getOwnPropertyNames(nc.prototype).filter(e=>"constructor"!==e);Object.defineProperty(nc,"listenerAdded",{value:t5,writable:!1,enumerable:!0,configurable:!1}),Object.defineProperty(nc,"listenerRemoved",{value:t6,writable:!1,enumerable:!0,configurable:!1});let nl={AaaSPilotKitController:Symbol.for("AaaSPilotKitController"),SignalingService:Symbol.for("SignalingService"),ASRService:Symbol.for("ASRService"),AgentService:Symbol.for("AgentService"),DigitalHumanService:Symbol.for("DigitalHumanService"),ConversationService:Symbol.for("ConversationService"),CommonRequest:Symbol.for("CommonRequest"),ErrorManager:Symbol.for("ErrorManager"),IOptions:Symbol.for("IOptions")};class nu extends Error{constructor(e,n,r){var i;const o=e.status||0===e.status?e.status:"",s=null!=(i=e.statusText)?i:"",a=`${o} ${s}`.trim();super(`Request failed with ${a?`status code ${a}`:"an unknown error"}: ${n.method} ${n.url}`),this.name="HTTPError",this.response=e,this.request=n,this.options=r}}class nf extends Error{constructor(e){let n="Non-error value was thrown";try{"string"==typeof e?n=e:e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message&&(n=e.message)}catch{}super(n),this.name="NonError",this.value=e}}class np extends Error{constructor(e){const n=(null==e?void 0:e.cause)?e.cause instanceof Error?e.cause:new nf(e.cause):void 0;super((null==e?void 0:e.code)?`Forced retry: ${e.code}`:"Forced retry",n?{cause:n}:void 0),this.name="ForceRetryError",this.customDelay=null==e?void 0:e.delay,this.code=null==e?void 0:e.code,this.customRequest=null==e?void 0:e.request}}let nh=(()=>{let e=!1,n=!1,r="function"==typeof globalThis.Request;if("function"==typeof globalThis.ReadableStream&&r)try{n=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(e){if(e instanceof Error&&"unsupported BodyInit type"===e.message)return!1;throw e}return e&&!n})(),nm="function"==typeof globalThis.AbortController,nv="function"==typeof globalThis.AbortSignal&&"function"==typeof globalThis.AbortSignal.any,ng="function"==typeof globalThis.ReadableStream,ny="function"==typeof globalThis.FormData,nb=["get","post","put","patch","head","delete"],n_={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},nw=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,nS=Symbol("stop");class nR{constructor(e){this.options=e}}let nT=e=>new nR(e),nC={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},nx={next:!0},nE={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},nO=(e,n,r)=>{let i,o=0;return e.pipeThrough(new TransformStream({transform(e,s){if(s.enqueue(e),i){o+=i.byteLength;let e=0===n?0:o/n;e>=1&&(e=1-Number.EPSILON),null==r||r({percent:e,totalBytes:Math.max(n,o),transferredBytes:o},i)}i=e},flush(){i&&(o+=i.byteLength,null==r||r({percent:1,totalBytes:Math.max(n,o),transferredBytes:o},i))}}))},nI=e=>null!==e&&"object"==typeof e,nk=function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];for(let e of n)if((!nI(e)||Array.isArray(e))&&void 0!==e)throw TypeError("The `options` argument must be an object");return nD({},...n)},nM=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=new globalThis.Headers(e),i=n instanceof globalThis.Headers;for(let[e,o]of new globalThis.Headers(n).entries())i&&"undefined"===o||void 0===o?r.delete(e):r.set(e,o);return r};function nP(e,n,r){var i,o;return Object.hasOwn(n,r)&&void 0===n[r]?[]:nD(null!=(i=e[r])?i:[],null!=(o=n[r])?o:[])}let nj=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{beforeRequest:nP(e,n,"beforeRequest"),beforeRetry:nP(e,n,"beforeRetry"),afterResponse:nP(e,n,"afterResponse"),beforeError:nP(e,n,"beforeError")}},nA=(e,n)=>{let r=new URLSearchParams;for(let i of[e,n])if(void 0!==i)if(i instanceof URLSearchParams)for(let[e,n]of i.entries())r.append(e,n);else if(Array.isArray(i))for(let e of i){if(!Array.isArray(e)||2!==e.length)throw TypeError("Array search parameters must be provided in [[key, value], ...] format");r.append(String(e[0]),String(e[1]))}else if(nI(i))for(let[e,n]of Object.entries(i))void 0!==n&&r.append(e,String(n));else for(let[e,n]of new URLSearchParams(i).entries())r.append(e,n);return r},nD=function(){let e;for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];let o={},s={},a={},c=[];for(let n of r)if(Array.isArray(n))Array.isArray(o)||(o=[]),o=[...o,...n];else if(nI(n)){for(let[r,i]of Object.entries(n)){if("signal"===r&&i instanceof globalThis.AbortSignal){c.push(i);continue}if("context"===r){if(null!=i&&(!nI(i)||Array.isArray(i)))throw TypeError("The `context` option must be an object");o={...o,context:null==i?{}:{...o.context,...i}};continue}if("searchParams"===r){e=null==i?void 0:void 0===e?i:nA(e,i);continue}nI(i)&&r in o&&(i=nD(o[r],i)),o={...o,[r]:i}}nI(n.hooks)&&(a=nj(a,n.hooks),o.hooks=a),nI(n.headers)&&(s=nM(s,n.headers),o.headers=s)}return void 0!==e&&(o.searchParams=e),c.length>0&&(1===c.length?o.signal=c[0]:nv?o.signal=AbortSignal.any(c):o.signal=c.at(-1)),void 0===o.context&&(o.context={}),o},nB={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:1/0,backoffLimit:1/0,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},nN=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("number"==typeof e)return{...nB,limit:e};if(e.methods&&!Array.isArray(e.methods))throw Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw Error("retry.statusCodes must be an array");return{...nB,...e}};class nL extends Error{constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}}async function nU(e,n,r,i){return new Promise((o,s)=>{let a=setTimeout(()=>{r&&r.abort(),s(new nL(e))},i.timeout);i.fetch(e,n).then(o).catch(s).then(()=>{clearTimeout(a)})})}async function nF(e,n){let{signal:r}=n;return new Promise((n,i)=>{function o(){clearTimeout(s),i(r.reason)}r&&(r.throwIfAborted(),r.addEventListener("abort",o,{once:!0}));let s=setTimeout(()=>{null==r||r.removeEventListener("abort",o),n()},e)})}class nH{static create(e,n){let r=new nH(e,n),i=async()=>{if("number"==typeof r.#Q.timeout&&r.#Q.timeout>0x7fffffff)throw RangeError("The `timeout` option cannot be greater than 2147483647");await Promise.resolve();let e=await r.#Z();for(let o of r.#Q.hooks.afterResponse){let s=r.#ee(e.clone()),a=await o(r.request,r.#et(),s,{retryCount:r.#en});if(a instanceof globalThis.Response&&(e=a),a instanceof nR){var n,i;throw await Promise.all([null==(n=s.body)?void 0:n.cancel(),null==(i=e.body)?void 0:i.cancel()]),new np(a.options)}}if(r.#ee(e),!e.ok&&("function"==typeof r.#Q.throwHttpErrors?r.#Q.throwHttpErrors(e.status):r.#Q.throwHttpErrors)){let n=new nu(e,r.request,r.#et());for(let e of r.#Q.hooks.beforeError)n=await e(n,{retryCount:r.#en});throw n}if(r.#Q.onDownloadProgress){if("function"!=typeof r.#Q.onDownloadProgress)throw TypeError("The `onDownloadProgress` option must be a function");if(!ng)throw Error("Streams are not supported in your environment. `ReadableStream` is missing.");return((e,n)=>{if(!e.body)return e;if(204===e.status)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Math.max(0,Number(e.headers.get("content-length"))||0);return new Response(nO(e.body,r,n),{status:e.status,statusText:e.statusText,headers:e.headers})})(e.clone(),r.#Q.onDownloadProgress)}return e},o=r.#er(i).finally(async()=>{var e,n;let i=r.#ei,o=[];i&&!i.bodyUsed&&o.push(null==(e=i.body)?void 0:e.cancel()),r.request.bodyUsed||o.push(null==(n=r.request.body)?void 0:n.cancel()),await Promise.all(o)});for(let[e,i]of Object.entries(n_)){var s,a;("bytes"!==e||"function"==typeof(null==(a=globalThis.Response)||null==(s=a.prototype)?void 0:s.bytes))&&(o[e]=async()=>{r.request.headers.set("accept",r.request.headers.get("accept")||i);let s=await o;if("json"===e){if(204===s.status)return"";let e=await s.text();return""===e?"":n.parseJson?n.parseJson(e):JSON.parse(e)}return s[e]()})}return o}static #eo(e){return!e||"object"!=typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.fromEntries(Object.entries(e).filter(e=>{let[,n]=e;return void 0!==n}))}#es;#en;#ea;#Q;#ei;#ec;#ed;constructor(e,n={}){var r,i,o,s,a,c,d,l,u,f,p,h;if(this.#en=0,this.#ea=e,this.#Q={...n,headers:nM(this.#ea.headers,n.headers),hooks:nj({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},n.hooks),method:(e=>nb.includes(e)?e.toUpperCase():e)(null!=(i=null!=(r=n.method)?r:this.#ea.method)?i:"GET"),prefixUrl:String(n.prefixUrl||""),retry:nN(n.retry),throwHttpErrors:null==(o=n.throwHttpErrors)||o,timeout:null!=(s=n.timeout)?s:1e4,fetch:null!=(a=n.fetch)?a:globalThis.fetch.bind(globalThis),context:null!=(c=n.context)?c:{}},"string"!=typeof this.#ea&&!(this.#ea instanceof URL||this.#ea instanceof globalThis.Request))throw TypeError("`input` must be a string, URL, or Request");if(this.#Q.prefixUrl&&"string"==typeof this.#ea){if(this.#ea.startsWith("/"))throw Error("`input` must not begin with a slash when using `prefixUrl`");this.#Q.prefixUrl.endsWith("/")||(this.#Q.prefixUrl+="/"),this.#ea=this.#Q.prefixUrl+this.#ea}nm&&nv&&(this.#ec=null!=(d=this.#Q.signal)?d:this.#ea.signal,this.#es=new globalThis.AbortController,this.#Q.signal=this.#ec?AbortSignal.any([this.#ec,this.#es.signal]):this.#es.signal),nh&&(this.#Q.duplex="half"),void 0!==this.#Q.json&&(this.#Q.body=null!=(f=null==(l=(u=this.#Q).stringifyJson)?void 0:l.call(u,this.#Q.json))?f:JSON.stringify(this.#Q.json),this.#Q.headers.set("content-type",null!=(p=this.#Q.headers.get("content-type"))?p:"application/json"));const m=n.headers&&new globalThis.Headers(n.headers).has("content-type");if(this.#ea instanceof globalThis.Request&&(ny&&this.#Q.body instanceof globalThis.FormData||this.#Q.body instanceof URLSearchParams)&&!m&&this.#Q.headers.delete("content-type"),this.request=new globalThis.Request(this.#ea,this.#Q),(e=>void 0!==e&&(Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:"object"==typeof e?Object.keys(e).length>0:"string"==typeof e?e.trim().length>0:!!e))(this.#Q.searchParams)){const e="string"==typeof this.#Q.searchParams?this.#Q.searchParams.replace(/^\?/,""):new URLSearchParams(nH.#eo(this.#Q.searchParams)).toString(),n=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,"?"+e);this.request=new globalThis.Request(n,this.#Q)}if(this.#Q.onUploadProgress){if("function"!=typeof this.#Q.onUploadProgress)throw TypeError("The `onUploadProgress` option must be a function");if(!nh)throw Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#el(this.request,null!=(h=this.#Q.body)?h:void 0)}}#eu(){let e=this.#Q.retry.delay(this.#en),n=e;return!0===this.#Q.retry.jitter?n=Math.random()*e:"function"==typeof this.#Q.retry.jitter&&(!Number.isFinite(n=this.#Q.retry.jitter(e))||n<0)&&(n=e),Math.min(this.#Q.retry.backoffLimit,n)}async #ef(e){var n,r,i,o,s,a;if(this.#en++,this.#en>this.#Q.retry.limit)throw e;let c=e instanceof Error?e:new nf(e);if(c instanceof np)return null!=(n=c.customDelay)?n:this.#eu();if(!this.#Q.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(void 0!==this.#Q.retry.shouldRetry){let n=await this.#Q.retry.shouldRetry({error:c,retryCount:this.#en});if(!1===n)throw e;if(!0===n)return this.#eu()}if((e instanceof nL||(null==e?void 0:e.name)===nL.name)&&!this.#Q.retry.retryOnTimeout)throw e;if(e instanceof nu||(null==e?void 0:e.name)===nu.name){if(!this.#Q.retry.statusCodes.includes(e.response.status))throw e;let n=null!=(s=null!=(o=null!=(i=null!=(r=e.response.headers.get("Retry-After"))?r:e.response.headers.get("RateLimit-Reset"))?i:e.response.headers.get("X-RateLimit-Retry-After"))?o:e.response.headers.get("X-RateLimit-Reset"))?s:e.response.headers.get("X-Rate-Limit-Reset");if(n&&this.#Q.retry.afterStatusCodes.includes(e.response.status)){let e=1e3*Number(n);Number.isNaN(e)?e=Date.parse(n)-Date.now():e>=Date.parse("2024-01-01")&&(e-=Date.now());let r=null!=(a=this.#Q.retry.maxRetryAfter)?a:e;return e<r?e:r}if(413===e.response.status)throw e}return this.#eu()}#ee(e){return this.#Q.parseJson&&(e.json=async()=>this.#Q.parseJson(await e.text())),e}async #er(e){try{return await e()}catch(r){let n=Math.min(await this.#ef(r),0x7fffffff);if(this.#en<1)throw r;if(await nF(n,this.#ec?{signal:this.#ec}:{}),r instanceof np&&r.customRequest){let e=this.#Q.signal?new globalThis.Request(r.customRequest,{signal:this.#Q.signal}):new globalThis.Request(r.customRequest);this.#ep(e)}for(let e of this.#Q.hooks.beforeRetry){let n=await e({request:this.request,options:this.#et(),error:r,retryCount:this.#en});if(n instanceof globalThis.Request){this.#ep(n);break}if(n instanceof globalThis.Response)return n;if(n===nS)return}return this.#er(e)}}async #Z(){var e;for(let n of((null==(e=this.#es)?void 0:e.signal.aborted)&&(this.#es=new globalThis.AbortController,this.#Q.signal=this.#ec?AbortSignal.any([this.#ec,this.#es.signal]):this.#es.signal,this.request=new globalThis.Request(this.request,{signal:this.#Q.signal})),this.#Q.hooks.beforeRequest)){let e=await n(this.request,this.#et(),{retryCount:this.#en});if(e instanceof Response)return e;if(e instanceof globalThis.Request){this.#ep(e);break}}let n=((e,n)=>{let r={};for(let i in n)Object.hasOwn(n,i)&&(i in nE||i in nC||i in e&&!(i in nx)||(r[i]=n[i]));return r})(this.request,this.#Q);return(this.#ei=this.request,this.request=this.#ei.clone(),!1===this.#Q.timeout)?this.#Q.fetch(this.#ei,n):nU(this.#ei,n,this.#es,this.#Q)}#et(){if(!this.#ed){let{hooks:e,...n}=this.#Q;this.#ed=Object.freeze(n)}return this.#ed}#ep(e){this.#ed=void 0,this.request=this.#el(e)}#el(e,n){var r;return this.#Q.onUploadProgress&&e.body?((e,n,r)=>{if(!e.body)return e;let i=(e=>{if(!e)return 0;if(e instanceof FormData){let n=0;for(let[r,i]of e)n+=nw,n+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,n+="string"==typeof i?new TextEncoder().encode(i).length:i.size;return n}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if("string"==typeof e)return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if("object"==typeof e&&null!==e)try{let n=JSON.stringify(e);return new TextEncoder().encode(n).length}catch{}return 0})(null!=r?r:e.body);return new Request(e,{duplex:"half",body:nO(e.body,i,n)})})(e,this.#Q.onUploadProgress,null!=(r=null!=n?n:this.#Q.body)?r:void 0):e}}let nq=e=>{let n=(n,r)=>nH.create(n,nk(e,r));for(let r of nb)n[r]=(n,i)=>nH.create(n,nk(e,i,{method:r}));return n.create=e=>nq(nk(e)),n.extend=n=>("function"==typeof n&&(n=n(null!=e?e:{})),nq(nk(e,n))),n.stop=nS,n.retry=nT,n},nV=nq();function nz(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function nG(e,n){return function(r,i){n(r,i,e)}}class nW{static #F=this.ONLINE_HOST="https://ky.cloud.baidu.com";static #eh=this.SANDBOX_HOST="https://ky-test.cloud.baidu.com";constructor(e){this.opts=e,"production"===this.opts.env?this.client=nV.create({prefixUrl:nW.ONLINE_HOST}):this.client=nV.create({prefixUrl:nW.SANDBOX_HOST})}}nW=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eg(),nG(0,eh(nl.IOptions)),nG(0,eS()),nz("design:type",Function),nz("design:paramtypes",["undefined"==typeof IResolvedOptions?Object:IResolvedOptions])],nW);class nX extends Error{constructor(e,n,r,i="MEDIUM",o={},s){super(n),this.name=this.constructor.name,this.code=e,this.category=r,this.severity=i,this.actionRequired=s,this.metadata={timestamp:Date.now(),stack:this.stack,...o},Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=Error(n).stack}static fromError(e,n,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"MEDIUM";return new nX(n,e.message,r,i,{originalError:e,stack:e.stack})}toJSON(){return{code:this.code,message:this.message,category:this.category,severity:this.severity,metadata:this.metadata,actionRequired:this.actionRequired}}toString(){return`${this.name} [${this.code}]: ${this.message}`}}let n$={1e3:"发生未知错误",1001:"网络连接错误",1002:"请求超时",1003:"配置无效",1004:"身份验证失败",1005:"权限验证失败",1006:"数据验证失败",1007:"资源未找到",1008:"资源不可用",1009:"内部错误",2001:"Agent查询失败",2002:"Agent响应解析错误",2003:"Agent请求超时",2004:"Agent响应无效",2005:"Agent连接失败",2006:"Agent指令无效",3001:"ASR初始化失败",3002:"ASR启动失败",3003:"ASR停止失败",3004:"ASR信令错误",3005:"ASR音频捕获错误",3006:"ASR识别错误",3007:"ASR网络错误",3008:"ASR权限被拒绝",3009:"ASR设备未找到",3010:"ASR消息解析错误",3011:"ASR会话无效",3012:"ASR静音失败",3013:"ASR消息间隔超时",3014:"ASR运行时错误",3100:"浏览器不支持 MediaDevices API",3101:"需要 HTTPS 安全上下文",3102:"音频设备枚举失败",3103:"用户关闭权限请求",3104:"设备被占用或不可读",3105:"音频设备检测超时",4001:"数字人挂载失败",4002:"数字人iframe加载错误",4003:"数字人渲染错误",4004:"数字人WebSocket错误",4005:"数字人RTC错误",4006:"数字人认证错误",4007:"数字人会话数量达到上限",4008:"数字人资源不足",4009:"数字人超时",4010:"数字人中断失败",4011:"数字人SSML解析错误",4012:"数字人形象ID无效",4013:"数字人token无效",4014:"数字人流式渲染错误",4015:"数字人控制器未就绪",4016:"数字人播报文本长度不匹配",5001:"会话创建失败",5002:"会话类型无效",5003:"会话快照无效",5004:"会话Bean未找到",5005:"会话序列化错误",5006:"会话反序列化错误",5007:"会话状态无效",5008:"会话清除失败"};class nJ extends nX{constructor(e,n,r="MEDIUM",i={},o){super(e,n||n$[e]||"Agent服务错误","SERVICE",r,i,o)}}class nK extends nJ{constructor(e,n={}){super("2001",e,"HIGH",n)}}class nY extends nJ{constructor(e,n={}){super("2002",e,"HIGH",n)}}class nQ extends nJ{constructor(e,n={}){super("2005",e,"HIGH",n)}}class nZ extends nJ{constructor(e,n={}){super("2006",e,"MEDIUM",n)}}var n0=r("../../node_modules/ua-parser-js/src/ua-parser.js"),n1=r.n(n0);let n2=()=>{let e=new(n1()),n=e.getBrowser(),r=e.getOS(),i=e.getDevice();return{userAgent:e.getUA(),browser:{name:n.name,version:n.version},os:{name:r.name,version:r.version},device:{type:i.type,vendor:i.vendor,model:i.model}}},n3=()=>"iOS"===new(n1())().getOS().name,n4=()=>{let e=new(n1()),n=e.getOS(),r=e.getDevice();return"Mac OS"===n.name&&"tablet"===r.type};class n5 extends nX{constructor(e,n,r="MEDIUM",i={}){super(e,n||n$[e]||"ASR服务错误","SERVICE",r,i)}}class n6 extends n5{constructor(e,n={}){super("3001",e,"HIGH",n)}}class n8 extends n5{constructor(e,n={}){super("3003",e,"MEDIUM",n)}}class n9 extends n5{constructor(e,n={}){super("3008",e,"MEDIUM",{...n,context:{...n.context,browserInfo:n2()}})}}class n7 extends n5{constructor(e,n={}){super("3010",e,"MEDIUM",n)}}class re extends n5{constructor(e,n={}){super("3013",e,"MEDIUM",n)}}class rt extends n5{constructor(e,n={}){super("3014",e,"HIGH",n)}}class rn extends n5{constructor(e,n={}){super("3009",e,"HIGH",{...n,context:{...n.context,browserInfo:n2()}})}}class rr extends n5{constructor(e,n={}){super("3104",e,"MEDIUM",{...n,context:{...n.context,browserInfo:n2()}})}}class ri extends n5{constructor(e,n={}){super("3100",e,"CRITICAL",{...n,context:{...n.context,browserInfo:n2()}})}}class ro extends n5{constructor(e,n={}){super("3101",e,"HIGH",n)}}class rs extends n5{constructor(e,n={}){super("3103",e,"MEDIUM",n)}}class ra extends n5{constructor(e,n={}){super("3105",e,"MEDIUM",n)}}class rc extends nX{constructor(e,n,r="MEDIUM",i={}){super(e,n||n$[e]||"数字人服务错误","SERVICE",r,i)}}class rd extends rc{constructor(e,n={}){super("4001",e,"HIGH",n)}}class rl extends rc{constructor(e,n={}){super("4002",e,"HIGH",n)}}class ru extends rc{constructor(e,n={}){super("4003",e,"MEDIUM",n)}}class rf extends rc{constructor(e,n={}){super("4004",e,"HIGH",n)}}class rp extends rc{constructor(e,n={}){super("4005",e,"HIGH",n)}}class rh extends rc{constructor(e,n={}){super("4006",e,"CRITICAL",n)}}class rm extends rc{constructor(e,n={}){super("4008",e,"CRITICAL",n)}}class rv{constructor(e){this.opts=e,this.reporters=[]}addReporter(e){this.reporters.push(e)}removeReporter(e){let n=this.reporters.indexOf(e);n>-1&&this.reporters.splice(n,1)}async handle(e){let n;n=e instanceof nX?e.toJSON():this.isErrorDetails(e)?e:nX.fromError(e,"UNKNOWN_ERROR","INTERNAL").toJSON(),await this.processError(n)}async processError(e){try{this.shouldLogError()&&this.logError(e),this.shouldReportError(e)&&await this.reportError(e)}catch(e){console.error("Error in error handler:",e)}}shouldLogError(){var e;return(null==(e=this.opts)?void 0:e.enableErrorLogging)!==!1}shouldReportError(e){var n;return(null==(n=this.opts)?void 0:n.enableErrorReporting)!==!1&&"LOW"!==e.severity&&this.reporters.length>0}logError(e){let n=this.getLogLevel(e.severity),r=`[${e.code}] ${e.message}`;"error"===n?console.error(r,e):"warn"===n?console.warn(r,e):console.log(r,e)}getLogLevel(e){switch(e){case"CRITICAL":case"HIGH":return"error";case"MEDIUM":return"warn";default:return"log"}}async reportError(e){let n=this.reporters.map(n=>n.report(e).catch(e=>{console.error("Error reporter failed:",e)}));await Promise.allSettled(n)}isErrorDetails(e){return e&&"object"==typeof e&&"code"in e&&"message"in e&&"category"in e&&"severity"in e}}class rg{async report(e){console.error("Error Report:",{code:e.code,message:e.message,category:e.category,severity:e.severity,timestamp:new Date(e.metadata.timestamp).toISOString(),sessionId:e.metadata.sessionId,requestId:e.metadata.requestId,context:e.metadata.context})}}class ry{constructor(e){this.options={timeout:5e3,headers:{"Content-Type":"application/json"},retryCount:3,retryDelay:1e3,...e}}async report(e){let n=this.buildPayload(e);for(let e=0;e<=this.options.retryCount;e++)try{await this.sendRequest(n);return}catch(n){if(e===this.options.retryCount)throw n;await this.delay(this.options.retryDelay*(e+1))}}buildPayload(e){return{error:{code:e.code,message:e.message,category:e.category,severity:e.severity,actionRequired:e.actionRequired},metadata:{timestamp:e.metadata.timestamp,sessionId:e.metadata.sessionId,requestId:e.metadata.requestId,userId:e.metadata.userId,context:e.metadata.context,userAgent:navigator.userAgent,url:window.location.href}}}async sendRequest(e){let n=new AbortController,r=setTimeout(()=>n.abort(),this.options.timeout);try{let r=await fetch(this.options.endpoint,{method:"POST",headers:this.options.headers,body:JSON.stringify(e),signal:n.signal});if(!r.ok)throw Error(`HTTP ${r.status}: ${r.statusText}`)}finally{clearTimeout(r)}}delay(e){return new Promise(n=>setTimeout(n,e))}}class rb{static getErrorSeverity(e){if(e instanceof nX)return e.severity;let n=e.message.toLowerCase();return n.includes("permission")||n.includes("unauthorized")||n.includes("forbidden")?"CRITICAL":n.includes("network")||n.includes("timeout")||n.includes("connection")?"HIGH":"MEDIUM"}static shouldReport(e){return!(e instanceof nX)||"LOW"!==e.severity}static extractMetadata(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={timestamp:Date.now(),context:n,stack:e.stack};return e instanceof nX?{...r,...e.metadata}:r}static getActionRequired(e){if(e instanceof nX){var n;return null!=(n=e.actionRequired)?n:null}let r=e.message.toLowerCase();return r.includes("permission")||r.includes("unauthorized")?"请检查用户权限":r.includes("network")||r.includes("timeout")?"请检查网络连接后重试":r.includes("validation")||r.includes("invalid")?"请检查输入数据的格式和有效性":null}}class r_{constructor(){this.emitter=new nc,this.emit=e=>{let n=this.transformErrorToPayload(e);this.emitter.emit("error",n)},this.on=e=>{this.emitter.on("error",e)},this.off=e=>{this.emitter.off("error",e)},this.clearListeners=()=>{this.emitter.clearListeners()},this.transformErrorToPayload=e=>{if(e instanceof nX){var n;return{code:e.code,message:e.toString(),stack:e.stack,actionRequired:null!=(n=e.actionRequired)?n:null,severity:e.severity,metadata:{timestamp:e.metadata.timestamp,sessionId:e.metadata.sessionId,requestId:e.metadata.requestId,userId:e.metadata.userId,context:e.metadata.context,service:this.extractServiceFromError(e)},originalError:e}}return{code:"UNKNOWN_ERROR",message:e.toString(),stack:e.stack,actionRequired:rb.getActionRequired(e),severity:rb.getErrorSeverity(e),metadata:{timestamp:Date.now(),context:{errorName:e.name}},originalError:e}},this.extractServiceFromError=e=>{let n=e.constructor.name.toLowerCase();return n.includes("agent")?"agent":n.includes("asr")?"asr":n.includes("digitalHuman")||n.includes("dh")?"digital-human":n.includes("conversation")?"conversation":"unknown"}}}class rw extends Error{constructor(e,n,r={}){super(n),this.name=e||"AaaSPilotKitError",this.message=n,this.data=r,Error.captureStackTrace?Error.captureStackTrace(this,rw):this.stack=Error().stack||"",Object.setPrototypeOf(this,rw.prototype)}static createForMonitoring(e,n,r){return new rw(e,n,r)}getMonitoringData(){return{type:this.name,message:this.message,stack:this.stack,timestamp:Date.now(),...this.data}}getSimplifiedData(){return{type:this.name,message:this.message,userId:this.data.userId,sessionId:this.data.sessionId,page:this.data.page}}toString(){return this.message}toJSON(){return this.getMonitoringData()}}function rS(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function rR(e,n){return function(r,i){n(r,i,e)}}class rT extends r_{constructor(e){super(),this.opts=e,this.handleError=async e=>{await this.errorHandler.handle(e),this.emit(e)},this.getErrorHandler=()=>this.errorHandler,this.getActionRequired=e=>rb.getActionRequired(e),this.createMonitoringError=e=>{var n,r;let i=this.buildEnhancedMessage(e),o={page:null==(n=e.metadata.context)?void 0:n.page,userId:e.metadata.userId,sessionId:e.metadata.sessionId,requestId:e.metadata.requestId,context:e.metadata.context,severity:e.severity,category:e.metadata.service||"unknown",code:e.code,originalMessage:null==(r=e.originalError)?void 0:r.message};return rw.createForMonitoring(e.code,i,o)},this.buildEnhancedMessage=e=>{let n=[],r=e.severity.toUpperCase();n.push(`[${r}]: ${e.message}`),e.metadata.service&&n.push(`category=${e.metadata.service}`);let i=new Date(e.metadata.timestamp||Date.now()),o=i.getFullYear()+"-"+String(i.getMonth()+1).padStart(2,"0")+"-"+String(i.getDate()).padStart(2,"0")+" "+String(i.getHours()).padStart(2,"0")+":"+String(i.getMinutes()).padStart(2,"0")+":"+String(i.getSeconds()).padStart(2,"0");if(n.push(`time=${o}`),e.metadata&&Object.keys(e.metadata).length>0){let r=this.stringifyMetadata(e.metadata);r&&"{}"!==r&&n.push(`metadata=${r}`)}return n.join(" | ")},this.stringifyMetadata=e=>{if(!e||"object"!=typeof e)return"{}";let n=new Set(["timestamp","stack"]),r={};for(let[i,o]of Object.entries(e))n.has(i)||null==o||(r[i]=o);try{return JSON.stringify(r)}catch{return"{}"}},this.initializeReporters=()=>{this.options.enableConsoleReporter&&this.errorHandler.addReporter(new rg),this.options.enableHttpReporter&&this.options.httpReporterEndpoint&&this.errorHandler.addReporter(new ry({endpoint:this.options.httpReporterEndpoint}))},this.options={enableConsoleReporter:this.opts.enableDebugMode,enableHttpReporter:!1,enableErrorLogging:this.opts.enableDebugMode,enableErrorReporting:!0},this.errorHandler=new rv(this.options),this.initializeReporters()}}rT=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eg(),rR(0,eh(nl.IOptions)),rR(0,eS()),rS("design:type",Function),rS("design:paramtypes",["undefined"==typeof IOptions?Object:IOptions])],rT);let rC="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),rx=new Uint8Array(16),rE=[];for(let e=0;e<256;++e)rE.push((e+256).toString(16).slice(1));let rO=function(n,r,i){if(rC&&!r&&!n)return rC();var o=n,s=i;let a=(o=o||{}).random??o.rng?.()??function(){if(!e){if("undefined"==typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");e=crypto.getRandomValues.bind(crypto)}return e(rx)}();if(a.length<16)throw Error("Random bytes length must be >= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,r){if((s=s||0)<0||s+16>r.length)throw RangeError(`UUID byte range ${s}:${s+15} is out of buffer bounds`);for(let e=0;e<16;++e)r[s+e]=a[e];return r}return function(e,n=0){return(rE[e[n+0]]+rE[e[n+1]]+rE[e[n+2]]+rE[e[n+3]]+"-"+rE[e[n+4]]+rE[e[n+5]]+"-"+rE[e[n+6]]+rE[e[n+7]]+"-"+rE[e[n+8]]+rE[e[n+9]]+"-"+rE[e[n+10]]+rE[e[n+11]]+rE[e[n+12]]+rE[e[n+13]]+rE[e[n+14]]+rE[e[n+15]]).toLowerCase()}(a)},rI=()=>{};class rk{constructor(e,n){this.getText=()=>"string"==typeof this.data?this.data:this.data&&"object"==typeof this.data&&"answer"in this.data&&this.data.answer||"",this.toJSON=()=>({data:this.data,index:this.index}),this.data=e,this.index=n}}class rM{constructor(e,n){this.emitter=new nc,this.id=rO(),this._endTime=0,this._isCompleted=!1,this.chunks=[],this.appendChunk=e=>{this._isCompleted?console.warn(`Response ${this.id} 已完成,无法添加新的 chunk`):(this.chunks.push(e),this.emitter.emit("update",{sessionId:this.sessionId,queryId:this.queryId,response:this}).catch(rI))},this.complete=()=>{this._isCompleted||(this._isCompleted=!0,this._endTime=Date.now())},this.getChunks=()=>this.chunks,this.getFullText=()=>this.chunks.map(e=>e.getText()).join(""),this.getDuration=()=>(this._endTime||Date.now())-this.startTime,this.isCompleted=()=>this._isCompleted,this.toJSON=()=>({id:this.id,sessionId:this.sessionId,queryId:this.queryId,startTime:this.startTime,endTime:this._endTime,duration:this.getDuration(),isCompleted:this._isCompleted,chunks:this.chunks.map(e=>e.toJSON()),fullText:this.getFullText()}),this.toString=()=>this.getFullText(),this.sessionId=e,this.queryId=n,this.startTime=Date.now()}get endTime(){return this._endTime}}class rP{constructor(e=0){this.currentResponse=null,this.responses=[],this.maxSize=0,this.onResponse=(e,n,r)=>{if(this.currentResponse&&this.currentResponse.queryId===r){let n=new rk(e,this.currentResponse.getChunks().length);this.currentResponse.appendChunk(n);return}if(!this.currentResponse||this.currentResponse.queryId!==r){let i=new rM(n,r),o=new rk(e,0);i.appendChunk(o),this.currentResponse=i,this.addResponse(i)}},this.onComplete=()=>{this.currentResponse&&(this.currentResponse.complete(),this.currentResponse=null)},this.getResponses=()=>this.responses,this.getResponseById=e=>this.responses.find(n=>n.id===e),this.getResponseByQueryId=e=>this.responses.find(n=>n.queryId===e),this.getLastResponse=()=>this.responses[this.responses.length-1]||null,this.clear=()=>{this.responses=[],this.currentResponse=null},this.toJSON=()=>this.responses.map(e=>e.toJSON()),this.addResponse=e=>{this.responses.push(e),this.maxSize>0&&this.responses.length>this.maxSize&&(this.responses=this.responses.slice(-this.maxSize))},this.maxSize=e}}function rj(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function rA(e,n){return function(r,i){n(r,i,e)}}class rD{constructor(e,n,r){this.request=e,this.errorManager=n,this.opts=r,this.emitter=new nc,this.conversationSessionId="",this.abortController=null,this._queryId="",this._lastQueryId="",this.setSessionId=e=>{this.conversationSessionId=e},this.setQueryId=e=>{this._queryId=e},this.setLastQueryId=e=>{this._lastQueryId=e},this.abort=e=>{var n;null==(n=this.abortController)||n.abort(e),this.abortController&&(this.abortController=null)},this.checkIsRepeat=()=>{let e=!!this.lastQueryId&&this.lastQueryId===this.queryId;return e&&this.opts.enableDebugMode&&console.warn("重复的completed查询被忽略:",this.queryId),e},this.onData=e=>{this.emitter.emit("data",e)},this.onCompleted=e=>{this.emitter.emit("completed",e),this.responseManager.onComplete()},this.onHangup=e=>{this.emitter.emit("hangup",e)},this.onTimeout=e=>{this.emitter.emit("timeout",e)},this.onInstructionReceived=e=>{this.emitter.emit("instruction_received",e)},this.onResponse=e=>{this.responseManager.onResponse(e,this.sessionId,this.queryId)},this.onUsageQuotaReached=e=>{this.emitter.emit("usage_quota_reached",e)},this.onQuotaExpired=e=>{this.emitter.emit("quota_expired",e)},this._dispose=()=>{this.abort(),this.conversationSessionId="",this._queryId="",this._lastQueryId="",this.responseManager.clear()},this.responseManager=new rP}get sessionId(){return this.conversationSessionId}get queryId(){return this._queryId}get lastQueryId(){return this._lastQueryId}getResponses(){return this.responseManager.getResponses()}getResponseManager(){return this.responseManager}}rD=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eg(),rA(0,eh(nl.CommonRequest)),rA(1,eh(nl.ErrorManager)),rA(2,eh(nl.IOptions)),rA(2,eS()),rj("design:type",Function),rj("design:paramtypes",[void 0===nW?Object:nW,void 0===rT?Object:rT,"undefined"==typeof IResolvedOptions?Object:IResolvedOptions])],rD),r("../../node_modules/core-js/modules/es.array.reduce.js");let rB=[{pattern:/客悦\s*one/gi,replacement:"客悦\xb7ONE"},{pattern:/\bSARS\b/gi,replacement:"SaaS"},{pattern:/\bSAS\b/gi,replacement:"SaaS"}],rN=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rB;return n.reduce((e,n)=>{let{pattern:r,replacement:i}=n;return e.replace(r,i)},e)},rL={CHINESE:"zh",ENGLISH:"en",JAPANESE:"ja",SPANISH:"es",RUSSIAN:"ru",KOREAN:"ko",VIETNAMESE:"vi",GERMAN:"de",INDONESIAN:"id",THAI:"th"},rU={[rL.CHINESE]:"zh",[rL.ENGLISH]:"en",[rL.JAPANESE]:"ja",[rL.SPANISH]:"es",[rL.RUSSIAN]:"ru",[rL.KOREAN]:"ko",[rL.VIETNAMESE]:"vi",[rL.GERMAN]:"de",[rL.INDONESIAN]:"id",[rL.THAI]:"th",ar:"ar",ms:"ms"},rF={[rL.CHINESE]:"Chinese",[rL.ENGLISH]:"English",[rL.JAPANESE]:"Japanese",[rL.SPANISH]:"Spanish",[rL.RUSSIAN]:"Russian",[rL.KOREAN]:"Korean",[rL.VIETNAMESE]:"Vietnamese",[rL.GERMAN]:"German",[rL.INDONESIAN]:"Indonesian",[rL.THAI]:"Thai",yue:"Chinese,Yue",fr:"French",pt:"Portuguese",tr:"Turkish",nl:"Dutch",uk:"Ukrainian",it:"Italian",pl:"Polish",ro:"Romanian",el:"Greek",cs:"Czech",fi:"Finnish",hi:"Hindi",auto:"auto"},rH=rL.CHINESE,rq=e=>{if(!e)return rF[rH];let n=rF[e];return n||(console.warn(`[AaaSPilotKit] 不支持的语言代码 "${e}",已自动回退到中文。支持的语言:${Object.keys(rF).join(", ")}`),rF[rH])},rV={enableDebugMode:!1,minSplitLen:5,ttsModel:"turbo_v2",env:"production",asrVad:600,interruptible:!0,rendererMode:"cloud",autoChromaKey:!0,typeDelay:163,enTypeDelay:45,lang:rL.CHINESE,inactivityPrompt:"您这么久没讲话,是不是有其它事情要忙,那我先挂断了",getMountContainer:()=>document.body,hotWordReplacementRules:rB,checkAudioDeviceBeforeStart:!0,rtcID:"appreimunmd7utp"};class rz{constructor(e,n){this.opts=n,this.emitter=new nc,this.id="",this.text="",this.update=e=>{let{id:n,...r}=e;n?this.id=n:this.id||(this.id=rO()),Object.assign(this,r)},this.toJSON=()=>({id:this.id,type:this.type,text:this.text}),this.type=e.type,this.update(e)}}class rG extends rz{constructor(e,n){super({...e,type:"client"},n),this.opts=n,this.appendText=e=>{this.text=e,this.emitter.emit("content_change",{mod:"text",content:e,completed:!0}).catch(rI)},this.dispose=()=>{},this.interrupt=()=>{}}static create(e){return new rG({},e)}}var rW=r("../../node_modules/eventemitter3/index.js"),rX=r.n(rW);class r$ extends Error{name="TimeoutError";constructor(e,n){super(e,n),Error.captureStackTrace?.(this,r$)}}let rJ=e=>e.reason??new DOMException("This operation was aborted.","AbortError");class rK{#em=[];enqueue(e,n){let{priority:r=0,id:i}=n??{},o={priority:r,id:i,run:e};if(0===this.size||this.#em[this.size-1].priority>=r)return void this.#em.push(o);let s=function(e,n,r){let i=0,o=e.length;for(;o>0;){let s=Math.trunc(o/2),a=i+s;0>=r(e[a],n)?(i=++a,o-=s+1):o=s}return i}(this.#em,o,(e,n)=>n.priority-e.priority);this.#em.splice(s,0,o)}setPriority(e,n){let r=this.#em.findIndex(n=>n.id===e);if(-1===r)throw ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[i]=this.#em.splice(r,1);this.enqueue(i.run,{priority:n,id:e})}dequeue(){let e=this.#em.shift();return e?.run}filter(e){return this.#em.filter(n=>n.priority===e.priority).map(e=>e.run)}get size(){return this.#em.length}}class rY extends rX(){#ev;#eg;#ey=0;#eb;#e_=!1;#ew=!1;#eS;#eR=0;#eT=0;#eC;#ex;#em;#eE;#eO=0;#eI;#ek;#eM=1n;#eP=new Map;timeout;constructor(e){if(super(),!("number"==typeof(e={carryoverIntervalCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:rK,...e}).intervalCap&&e.intervalCap>=1))throw TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);if(this.#ev=e.carryoverIntervalCount??e.carryoverConcurrencyCount??!1,this.#eg=e.intervalCap===1/0||0===e.interval,this.#eb=e.intervalCap,this.#eS=e.interval,this.#em=new e.queueClass,this.#eE=e.queueClass,this.concurrency=e.concurrency,void 0!==e.timeout&&!(Number.isFinite(e.timeout)&&e.timeout>0))throw TypeError(`Expected \`timeout\` to be a positive finite number, got \`${e.timeout}\` (${typeof e.timeout})`);this.timeout=e.timeout,this.#ek=!1===e.autoStart,this.#ej()}get #eA(){return this.#eg||this.#ey<this.#eb}get #eD(){return this.#eO<this.#eI}#eB(){this.#eO--,0===this.#eO&&this.emit("pendingZero"),this.#eN(),this.emit("next")}#eL(){this.#eU(),this.#eF(),this.#ex=void 0}get #eH(){let e=Date.now();if(void 0===this.#eC){let n=this.#eR-e;if(!(n<0))return this.#eq(n),!0;if(this.#eT>0){let n=e-this.#eT;if(n<this.#eS)return this.#eq(this.#eS-n),!0}this.#ey=this.#ev?this.#eO:0}return!1}#eq(e){void 0===this.#ex&&(this.#ex=setTimeout(()=>{this.#eL()},e))}#eV(){this.#eC&&(clearInterval(this.#eC),this.#eC=void 0)}#ez(){this.#ex&&(clearTimeout(this.#ex),this.#ex=void 0)}#eN(){if(0===this.#em.size)return this.#eV(),this.emit("empty"),0===this.#eO&&(this.#ez(),this.emit("idle")),!1;let e=!1;if(!this.#ek){let n=!this.#eH;if(this.#eA&&this.#eD){let r=this.#em.dequeue();this.#eg||(this.#ey++,this.#eG()),this.emit("active"),this.#eT=Date.now(),r(),n&&this.#eF(),e=!0}}return e}#eF(){this.#eg||void 0!==this.#eC||(this.#eC=setInterval(()=>{this.#eU()},this.#eS),this.#eR=Date.now()+this.#eS)}#eU(){0===this.#ey&&0===this.#eO&&this.#eC&&this.#eV(),this.#ey=this.#ev?this.#eO:0,this.#eW(),this.#eG()}#eW(){for(;this.#eN(););}get concurrency(){return this.#eI}set concurrency(e){if(!("number"==typeof e&&e>=1))throw TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#eI=e,this.#eW()}async #eX(e){return new Promise((n,r)=>{e.addEventListener("abort",()=>{r(e.reason)},{once:!0})})}setPriority(e,n){if("number"!=typeof n||!Number.isFinite(n))throw TypeError(`Expected \`priority\` to be a finite number, got \`${n}\` (${typeof n})`);this.#em.setPriority(e,n)}async add(e,n={}){return n.id??=(this.#eM++).toString(),n={timeout:this.timeout,...n},new Promise((r,i)=>{let o=Symbol(`task-${n.id}`);this.#em.enqueue(async()=>{this.#eO++,this.#eP.set(o,{id:n.id,priority:n.priority??0,startTime:Date.now(),timeout:n.timeout});try{try{n.signal?.throwIfAborted()}catch(e){throw!this.#eg&&this.#ey--,this.#eP.delete(o),e}let i=e({signal:n.signal});n.timeout&&(i=function(e,n){let r,i,{milliseconds:o,fallback:s,message:a,customTimers:c={setTimeout,clearTimeout},signal:d}=n,l=new Promise((n,l)=>{if("number"!=typeof o||1!==Math.sign(o))throw TypeError(`Expected \`milliseconds\` to be a positive number, got \`${o}\``);if(d?.aborted)return void l(rJ(d));if(d&&(i=()=>{l(rJ(d))},d.addEventListener("abort",i,{once:!0})),e.then(n,l),o===1/0)return;let u=new r$;r=c.setTimeout.call(void 0,()=>{if(s){try{n(s())}catch(e){l(e)}return}"function"==typeof e.cancel&&e.cancel(),!1===a?n():a instanceof Error?l(a):(u.message=a??`Promise timed out after ${o} milliseconds`,l(u))},o)}).finally(()=>{l.clear(),i&&d&&d.removeEventListener("abort",i)});return l.clear=()=>{c.clearTimeout.call(void 0,r),r=void 0},l}(Promise.resolve(i),{milliseconds:n.timeout,message:`Task timed out after ${n.timeout}ms (queue has ${this.#eO} running, ${this.#em.size} waiting)`})),n.signal&&(i=Promise.race([i,this.#eX(n.signal)]));let s=await i;r(s),this.emit("completed",s)}catch(e){i(e),this.emit("error",e)}finally{this.#eP.delete(o),queueMicrotask(()=>{this.#eB()})}},n),this.emit("add"),this.#eN()})}async addAll(e,n){return Promise.all(e.map(async e=>this.add(e,n)))}start(){return this.#ek&&(this.#ek=!1,this.#eW()),this}pause(){this.#ek=!0}clear(){this.#em=new this.#eE,this.#e$()}async onEmpty(){0!==this.#em.size&&await this.#eJ("empty")}async onSizeLessThan(e){this.#em.size<e||await this.#eJ("next",()=>this.#em.size<e)}async onIdle(){(0!==this.#eO||0!==this.#em.size)&&await this.#eJ("idle")}async onPendingZero(){0!==this.#eO&&await this.#eJ("pendingZero")}async onRateLimit(){this.isRateLimited||await this.#eJ("rateLimit")}async onRateLimitCleared(){this.isRateLimited&&await this.#eJ("rateLimitCleared")}async onError(){return new Promise((e,n)=>{let r=e=>{this.off("error",r),n(e)};this.on("error",r)})}async #eJ(e,n){return new Promise(r=>{let i=()=>{(!n||n())&&(this.off(e,i),r())};this.on(e,i)})}get size(){return this.#em.size}sizeBy(e){return this.#em.filter(e).length}get pending(){return this.#eO}get isPaused(){return this.#ek}#ej(){this.#eg||(this.on("add",()=>{this.#em.size>0&&this.#eG()}),this.on("next",()=>{this.#eG()}))}#eG(){this.#eg||this.#ew||(this.#ew=!0,queueMicrotask(()=>{this.#ew=!1,this.#e$()}))}#e$(){let e=this.#e_,n=!this.#eg&&this.#ey>=this.#eb&&this.#em.size>0;n!==e&&(this.#e_=n,this.emit(n?"rateLimit":"rateLimitCleared"))}get isRateLimited(){return this.#e_}get isSaturated(){return this.#eO===this.#eI&&this.#em.size>0||this.isRateLimited&&this.#em.size>0}get runningTasks(){return[...this.#eP.values()].map(e=>({...e}))}}class rQ{constructor(e){this.id=rO(),this.createdAt=Date.now(),this.updatedAt=Date.now(),this.emitter=new nc,this.getConfig=()=>({...this.config}),this.updateConfig=e=>{this.config={...this.config,...e},this.updatedAt=Date.now()},this.toJSON=()=>({id:this.id,mod:this.mod,config:this.getConfig(),createdAt:this.createdAt,updatedAt:this.updatedAt}),this.updateTimestamp=()=>{this.updatedAt=Date.now()},this._dispose=()=>{this.emitter.clearListeners()},this.config={...e},this.config.timestamp||(this.config.timestamp=this.createdAt)}}var rZ=r("../../node_modules/typewriter-effect/dist/core.js"),r0=r.n(rZ);let r1=e=>/[\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\u3000-\u303F]/.test(e);class r2 extends rQ{get mod(){return"text"}static fromSnapshot(e){return new r2(e.config)}static fromString(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new r2({content:e,...n})}setTargetElement(e){this.targetElement=e}isEmpty(){return!this.config.content}constructor(...e){super(...e),this.typewriter=null,this.targetElement=null,this.index=0,this.stopTypewriter=()=>{this.typewriter&&(this.typewriter.stop(),this.typewriter=null)},this.runTask=()=>new Promise((e,n)=>{if(this.ensureTarget(),this.isEmpty())return void e({mod:"text",content:""});try{var r,i,o,s,a;let n=null!=(o=null==(r=this.config.typewriterOptions)?void 0:r.delay)?o:163,c=null!=(s=null==(i=this.config.typewriterOptions)?void 0:i.enDelay)?s:n;this.typewriter=new(r0())(this.targetElement,{autoStart:!0,loop:!1,...this.config.typewriterOptions,delay:0,onCreateTextNode:e=>{let n=this.index===this.config.content.length-1;return this.emitter.emit("data",{char:e,index:this.index++,done:n}),document.createTextNode(e)}});let d=[],l="",u=null;for(let e of Array.from(this.config.content)){let n=r1(e);null===u||n===u?l+=e:(d.push({s:l,cn:u}),l=e),u=n}l&&d.push({s:l,cn:u});let f=this.typewriter;if(0===d.length)f=f.changeDelay(n).typeString(this.config.content);else for(let e=0;e<d.length;e++){let{s:r,cn:i}=d[e];if(0===e){let e=null!=(a=r[0])?a:"",o=r.slice(1);f=f.typeString(e),o&&(f=f.changeDelay(i?n:c).typeString(o));continue}f=f.changeDelay(i?n:c).typeString(r)}f.callFunction(()=>{e({mod:"text",content:this.config.content})}).start()}catch(e){n(e)}}),this.dispose=()=>{this._dispose(),this.stopTypewriter(),this.targetElement=null,this.index=0},this.interrupt=()=>{this.stopTypewriter()},this.ensureTarget=()=>{if(this.targetElement)return;let e=document.createElement("span");e.className="text-content-typewriter",this.targetElement=e}}}class r3 extends rQ{get mod(){return"image"}static fromSnapshot(e){return new r3(e.config)}static fromSrc(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new r3({src:e,...n})}isEmpty(){return!this.config.src}ensureImageElement(){if(this.imgElement)return this.imgElement;let e=document.createElement("img");return this.imgElement=e,e}constructor(...e){super(...e),this.imgElement=null,this.setTargetElement=e=>{this.imgElement=e},this.runTask=()=>new Promise((e,n)=>{var r;if(this.isEmpty())return void e({mod:"image",src:""});let i=this.ensureImageElement(),o=()=>{e({mod:"image",...this.config}),i.removeEventListener("load",o)},s=()=>{n(Error(`Failed to load image: ${this.config.src}`)),i.removeEventListener("error",s)};i.addEventListener("load",o,{once:!0}),i.addEventListener("error",s,{once:!0}),i.alt=null!=(r=this.config.alt)?r:"",this.config.width&&(i.width=this.config.width),this.config.height&&(i.height=this.config.height),i.src=this.config.src}),this.dispose=()=>{this._dispose(),this.imgElement&&(this.imgElement.src="",this.imgElement=null)},this.interrupt=()=>{}}}class r4 extends rQ{get mod(){return"video"}static fromSnapshot(e){return new r4(e.config)}static fromSrc(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new r4({src:e,...n})}isEmpty(){return!this.config.src}ensureVideoElement(){if(this.videoElement)return this.videoElement;let e=document.createElement("video");return e.muted=!0,e.playsInline=!0,this.videoElement=e,e}constructor(...e){super(...e),this.videoElement=null,this.setTargetElement=e=>{this.videoElement=e},this.runTask=()=>new Promise((e,n)=>{if(this.isEmpty())return void e({mod:"video",src:""});let r=this.ensureVideoElement(),i=()=>{e({mod:"video",...this.config}),r.removeEventListener("loadedmetadata",i)},o=()=>{n(Error(`Failed to load video: ${this.config.src}`)),r.removeEventListener("error",o)};r.addEventListener("loadedmetadata",i,{once:!0}),r.addEventListener("error",o,{once:!0}),this.config.poster&&(r.poster=this.config.poster),this.config.preload&&(r.preload=this.config.preload),this.config.width&&(r.width=this.config.width),this.config.height&&(r.height=this.config.height),r.src=this.config.src,r.load()}),this.dispose=()=>{this._dispose(),this.videoElement&&(this.videoElement.src="",this.videoElement.load(),this.videoElement=null)},this.interrupt=()=>{}}}let r5={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,n){return n},attributeValueProcessor:function(e,n){return n},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,n,r){return e},captureMetaData:!1},r6=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",r8=RegExp("^"+("["+r6+"]["+r6)+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$");function r9(e,n){let r=[],i=n.exec(e);for(;i;){let o=[];o.startIndex=n.lastIndex-i[0].length;let s=i.length;for(let e=0;e<s;e++)o.push(i[e]);r.push(o),i=n.exec(e)}return r}let r7=function(e){return null!=r8.exec(e)};n="function"!=typeof Symbol?"@@xmlMetadata":Symbol("XML Node Metadata");class ie{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,n){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:n})}addChild(e,r){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child}),void 0!==r&&(this.child[this.child.length-1][n]={startIndex:r})}static getMetaDataSymbol(){return n}}let it=(e,n)=>{for(;n<e.length&&/\s/.test(e[n]);)n++;return n};function ir(e,n,r){let i="",o=e[n];if('"'!==o&&"'"!==o)throw Error(`Expected quoted string, found "${o}"`);for(n++;n<e.length&&e[n]!==o;)i+=e[n],n++;if(e[n]!==o)throw Error(`Unterminated ${r} value`);return[++n,i]}function ii(e,n,r){for(let i=0;i<n.length;i++)if(n[i]!==e[r+i+1])return!1;return!0}function io(e){if(r7(e))return e;throw Error(`Invalid entity name ${e}`)}let is=/^[-+]?0x[a-fA-F0-9]+$/,ia=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,ic={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0},id=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;class il{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xa2"},pound:{regex:/&(pound|#163);/g,val:"\xa3"},yen:{regex:/&(yen|#165);/g,val:"\xa5"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"\xa9"},reg:{regex:/&(reg|#174);/g,val:"\xae"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,n)=>String.fromCodePoint(Number.parseInt(n,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,n)=>String.fromCodePoint(Number.parseInt(n,16))}},this.addExternalEntities=iu,this.parseXml=ig,this.parseTextData=ip,this.resolveNameSpace=ih,this.buildAttributesMap=iv,this.isItStopNode=iw,this.replaceEntitiesValue=ib,this.readStopNodeData=iT,this.saveTextToParentTag=i_,this.addChild=iy,this.ignoreAttributesFn=function(e){return"function"==typeof e?e:Array.isArray(e)?n=>{for(let r of e)if("string"==typeof r&&n===r||r instanceof RegExp&&r.test(n))return!0}:()=>!1}(this.options.ignoreAttributes)}}function iu(e){let n=Object.keys(e);for(let r=0;r<n.length;r++){let i=n[r];this.lastEntities[i]={regex:RegExp("&"+i+";","g"),val:e[i]}}}function ip(e,n,r,i,o,s,a){if(void 0!==e&&(this.options.trimValues&&!i&&(e=e.trim()),e.length>0)){a||(e=this.replaceEntitiesValue(e));let i=this.options.tagValueProcessor(n,e,r,o,s);return null==i?e:typeof i!=typeof e||i!==e?i:this.options.trimValues||e.trim()===e?iC(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function ih(e){if(this.options.removeNSPrefix){let n=e.split(":"),r="/"===e.charAt(0)?"/":"";if("xmlns"===n[0])return"";2===n.length&&(e=r+n[1])}return e}let im=RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function iv(e,n,r){if(!0!==this.options.ignoreAttributes&&"string"==typeof e){let r=r9(e,im),i=r.length,o={};for(let e=0;e<i;e++){let i=this.resolveNameSpace(r[e][1]);if(this.ignoreAttributesFn(i,n))continue;let s=r[e][4],a=this.options.attributeNamePrefix+i;if(i.length)if(this.options.transformAttributeName&&(a=this.options.transformAttributeName(a)),"__proto__"===a&&(a="#__proto__"),void 0!==s){this.options.trimValues&&(s=s.trim()),s=this.replaceEntitiesValue(s);let e=this.options.attributeValueProcessor(i,s,n);null==e?o[a]=s:typeof e!=typeof s||e!==s?o[a]=e:o[a]=iC(s,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[a]=!0)}if(Object.keys(o).length){if(this.options.attributesGroupName){let e={};return e[this.options.attributesGroupName]=o,e}return o}}}let ig=function(e){e=e.replace(/\r\n?/g,"\n");let n=new ie("!xml"),r=n,i="",o="";for(let s=0;s<e.length;s++)if("<"===e[s])if("/"===e[s+1]){let n=iS(e,">",s,"Closing Tag is not closed."),a=e.substring(s+2,n).trim();if(this.options.removeNSPrefix){let e=a.indexOf(":");-1!==e&&(a=a.substr(e+1))}this.options.transformTagName&&(a=this.options.transformTagName(a)),r&&(i=this.saveTextToParentTag(i,r,o));let c=o.substring(o.lastIndexOf(".")+1);if(a&&-1!==this.options.unpairedTags.indexOf(a))throw Error(`Unpaired tag can not be used as closing tag: </${a}>`);let d=0;c&&-1!==this.options.unpairedTags.indexOf(c)?(d=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):d=o.lastIndexOf("."),o=o.substring(0,d),r=this.tagsNodeStack.pop(),i="",s=n}else if("?"===e[s+1]){let n=iR(e,s,!1,"?>");if(!n)throw Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,r,o),this.options.ignoreDeclaration&&"?xml"===n.tagName||this.options.ignorePiTags);else{let e=new ie(n.tagName);e.add(this.options.textNodeName,""),n.tagName!==n.tagExp&&n.attrExpPresent&&(e[":@"]=this.buildAttributesMap(n.tagExp,o,n.tagName)),this.addChild(r,e,o,s)}s=n.closeIndex+1}else if("!--"===e.substr(s+1,3)){let n=iS(e,"--\x3e",s+4,"Comment is not closed.");if(this.options.commentPropName){let a=e.substring(s+4,n-2);i=this.saveTextToParentTag(i,r,o),r.add(this.options.commentPropName,[{[this.options.textNodeName]:a}])}s=n}else if("!D"===e.substr(s+1,2)){let n=function(e,n){let r={};if("O"===e[n+3]&&"C"===e[n+4]&&"T"===e[n+5]&&"Y"===e[n+6]&&"P"===e[n+7]&&"E"===e[n+8]){n+=9;let i=1,o=!1,s=!1;for(;n<e.length;n++)if("<"!==e[n]||s)if(">"===e[n]){if(s?"-"===e[n-1]&&"-"===e[n-2]&&(s=!1,i--):i--,0===i)break}else"["===e[n]?o=!0:e[n];else{if(o&&ii(e,"!ENTITY",n)){let i,o;n+=7,[i,o,n]=function(e,n){n=it(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n])&&'"'!==e[n]&&"'"!==e[n];)r+=e[n],n++;if(io(r),n=it(e,n),"SYSTEM"===e.substring(n,n+6).toUpperCase())throw Error("External entities are not supported");if("%"===e[n])throw Error("Parameter entities are not supported");let i="";return[n,i]=ir(e,n,"entity"),[r,i,--n]}(e,n+1),-1===o.indexOf("&")&&(r[i]={regx:RegExp(`&${i};`,"g"),val:o})}else if(o&&ii(e,"!ELEMENT",n)){let{index:r}=function(e,n){n=it(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n]);)r+=e[n],n++;if(!io(r))throw Error(`Invalid element name: "${r}"`);n=it(e,n);let i="";if("E"===e[n]&&ii(e,"MPTY",n))n+=4;else if("A"===e[n]&&ii(e,"NY",n))n+=2;else if("("===e[n]){for(n++;n<e.length&&")"!==e[n];)i+=e[n],n++;if(")"!==e[n])throw Error("Unterminated content model")}else throw Error(`Invalid Element Expression, found "${e[n]}"`);return{elementName:r,contentModel:i.trim(),index:n}}(e,(n+=8)+1);n=r}else if(o&&ii(e,"!ATTLIST",n))n+=8;else if(o&&ii(e,"!NOTATION",n)){let{index:r}=function(e,n){n=it(e,n);let r="";for(;n<e.length&&!/\s/.test(e[n]);)r+=e[n],n++;io(r),n=it(e,n);let i=e.substring(n,n+6).toUpperCase();if("SYSTEM"!==i&&"PUBLIC"!==i)throw Error(`Expected SYSTEM or PUBLIC, found "${i}"`);n+=i.length,n=it(e,n);let o=null,s=null;if("PUBLIC"===i)[n,o]=ir(e,n,"publicIdentifier"),n=it(e,n),('"'===e[n]||"'"===e[n])&&([n,s]=ir(e,n,"systemIdentifier"));else if("SYSTEM"===i&&([n,s]=ir(e,n,"systemIdentifier"),!s))throw Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:o,systemIdentifier:s,index:--n}}(e,(n+=9)+1);n=r}else if(ii(e,"!--",n))s=!0;else throw Error("Invalid DOCTYPE");i++}if(0!==i)throw Error("Unclosed DOCTYPE")}else throw Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}(e,s);this.docTypeEntities=n.entities,s=n.i}else if("!["===e.substr(s+1,2)){let n=iS(e,"]]>",s,"CDATA is not closed.")-2,a=e.substring(s+9,n);i=this.saveTextToParentTag(i,r,o);let c=this.parseTextData(a,r.tagname,o,!0,!1,!0,!0);void 0==c&&(c=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:a}]):r.add(this.options.textNodeName,c),s=n+2}else{let a=iR(e,s,this.options.removeNSPrefix),c=a.tagName,d=a.rawTagName,l=a.tagExp,u=a.attrExpPresent,f=a.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),r&&i&&"!xml"!==r.tagname&&(i=this.saveTextToParentTag(i,r,o,!1));let p=r;p&&-1!==this.options.unpairedTags.indexOf(p.tagname)&&(r=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),c!==n.tagname&&(o+=o?"."+c:c);let h=s;if(this.isItStopNode(this.options.stopNodes,o,c)){let n="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)"/"===c[c.length-1]?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),l=c):l=l.substr(0,l.length-1),s=a.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(c))s=a.closeIndex;else{let r=this.readStopNodeData(e,d,f+1);if(!r)throw Error(`Unexpected end of ${d}`);s=r.i,n=r.tagContent}let i=new ie(c);c!==l&&u&&(i[":@"]=this.buildAttributesMap(l,o,c)),n&&(n=this.parseTextData(n,c,o,!0,u,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),i.add(this.options.textNodeName,n),this.addChild(r,i,o,h)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===c[c.length-1]?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),l=c):l=l.substr(0,l.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));let e=new ie(c);c!==l&&u&&(e[":@"]=this.buildAttributesMap(l,o,c)),this.addChild(r,e,o,h),o=o.substr(0,o.lastIndexOf("."))}else{let e=new ie(c);this.tagsNodeStack.push(r),c!==l&&u&&(e[":@"]=this.buildAttributesMap(l,o,c)),this.addChild(r,e,o,h),r=e}i="",s=f}}else i+=e[s];return n.child};function iy(e,n,r,i){this.options.captureMetaData||(i=void 0);let o=this.options.updateTag(n.tagname,r,n[":@"]);!1===o||("string"==typeof o&&(n.tagname=o),e.addChild(n,i))}let ib=function(e){if(this.options.processEntities){for(let n in this.docTypeEntities){let r=this.docTypeEntities[n];e=e.replace(r.regx,r.val)}for(let n in this.lastEntities){let r=this.lastEntities[n];e=e.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let n in this.htmlEntities){let r=this.htmlEntities[n];e=e.replace(r.regex,r.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function i_(e,n,r,i){return e&&(void 0===i&&(i=0===n.child.length),void 0!==(e=this.parseTextData(e,n.tagname,r,!1,!!n[":@"]&&0!==Object.keys(n[":@"]).length,i))&&""!==e&&n.add(this.options.textNodeName,e),e=""),e}function iw(e,n,r){let i="*."+r;for(let r in e){let o=e[r];if(i===o||n===o)return!0}return!1}function iS(e,n,r,i){let o=e.indexOf(n,r);if(-1!==o)return o+n.length-1;throw Error(i)}function iR(e,n,r,i=">"){let o=function(e,n,r=">"){let i,o="";for(let s=n;s<e.length;s++){let n=e[s];if(i)n===i&&(i="");else if('"'===n||"'"===n)i=n;else if(n===r[0]){if(!r[1])return{data:o,index:s};else if(e[s+1]===r[1])return{data:o,index:s}}else" "===n&&(n=" ");o+=n}}(e,n+1,i);if(!o)return;let s=o.data,a=o.index,c=s.search(/\s/),d=s,l=!0;-1!==c&&(d=s.substring(0,c),s=s.substring(c+1).trimStart());let u=d;if(r){let e=d.indexOf(":");-1!==e&&(l=(d=d.substr(e+1))!==o.data.substr(e+1))}return{tagName:d,tagExp:s,closeIndex:a,attrExpPresent:l,rawTagName:u}}function iT(e,n,r){let i=r,o=1;for(;r<e.length;r++)if("<"===e[r])if("/"===e[r+1]){let s=iS(e,">",r,`${n} is not closed`);if(e.substring(r+2,s).trim()===n&&0==--o)return{tagContent:e.substring(i,r),i:s};r=s}else if("?"===e[r+1])r=iS(e,"?>",r+1,"StopNode is not closed.");else if("!--"===e.substr(r+1,3))r=iS(e,"--\x3e",r+3,"StopNode is not closed.");else if("!["===e.substr(r+1,2))r=iS(e,"]]>",r,"StopNode is not closed.")-2;else{let i=iR(e,r,">");i&&((i&&i.tagName)===n&&"/"!==i.tagExp[i.tagExp.length-1]&&o++,r=i.closeIndex)}}function iC(e,n,r){if(n&&"string"==typeof e){let n=e.trim();return"true"===n||"false"!==n&&function(e,n={}){if(n=Object.assign({},ic,n),!e||"string"!=typeof e)return e;let r=e.trim();if(void 0!==n.skipLike&&n.skipLike.test(r))return e;{if("0"===e)return 0;if(n.hex&&is.test(r)){var i,o=r;if(parseInt)return parseInt(o,16);if(Number.parseInt)return Number.parseInt(o,16);if(window&&window.parseInt)return window.parseInt(o,16);throw Error("parseInt, Number.parseInt, window.parseInt are not supported")}if(-1!==r.search(/.+[eE].+/))return function(e,n,r){if(!r.eNotation)return e;let i=n.match(id);if(!i)return e;{let o=i[1]||"",s=-1===i[3].indexOf("e")?"E":"e",a=i[2],c=o?e[a.length+1]===s:e[a.length]===s;return a.length>1&&c?e:1===a.length&&(i[3].startsWith(`.${s}`)||i[3][0]===s)?Number(n):r.leadingZeros&&!c?Number(n=(i[1]||"")+i[3]):e}}(e,r,n);let s=ia.exec(r);if(!s)return e;{let o=s[1]||"",a=s[2],c=((i=s[3])&&-1!==i.indexOf(".")&&("."===(i=i.replace(/0+$/,""))?i="0":"."===i[0]?i="0"+i:"."===i[i.length-1]&&(i=i.substring(0,i.length-1))),i),d=o?"."===e[a.length+1]:"."===e[a.length];if(!n.leadingZeros&&(a.length>1||1===a.length&&!d))return e;{let i=Number(r),s=String(i);if(0===i)return i;if(-1!==s.search(/[eE]/))if(n.eNotation)return i;else return e;if(-1!==r.indexOf("."))if("0"===s)return i;else if(s===c)return i;else if(s===`${o}${c}`)return i;else return e;let d=a?c:r;return a?d===s||o+d===s?i:e:d===s||d===o+s?i:e}}}}(e,r)}return void 0!==e?e:""}let ix=ie.getMetaDataSymbol(),iE={allowBooleanAttributes:!1,unpairedTags:[]};function iO(e,n){n=Object.assign({},iE,n);let r=[],i=!1,o=!1;"\uFEFF"===e[0]&&(e=e.substr(1));for(let s=0;s<e.length;s++)if("<"===e[s]&&"?"===e[s+1]){if(s+=2,(s=ik(e,s)).err)return s}else if("<"===e[s]){let a=s;if("!"===e[++s]){s=iM(e,s);continue}{let c=!1;"/"===e[s]&&(c=!0,s++);let d="";for(;s<e.length&&">"!==e[s]&&" "!==e[s]&&" "!==e[s]&&"\n"!==e[s]&&"\r"!==e[s];s++)d+=e[s];if("/"===(d=d.trim())[d.length-1]&&(d=d.substring(0,d.length-1),s--),!r7(d))return iA("InvalidTag",0===d.trim().length?"Invalid space after '<'.":"Tag '"+d+"' is an invalid name.",iD(e,s));let l=function(e,n){let r="",i="",o=!1;for(;n<e.length;n++){if('"'===e[n]||"'"===e[n])""===i?i=e[n]:i!==e[n]||(i="");else if(">"===e[n]&&""===i){o=!0;break}r+=e[n]}return""===i&&{value:r,index:n,tagClosed:o}}(e,s);if(!1===l)return iA("InvalidAttr","Attributes for '"+d+"' have open quote.",iD(e,s));let u=l.value;if(s=l.index,"/"===u[u.length-1]){let r=s-u.length,o=ij(u=u.substring(0,u.length-1),n);if(!0!==o)return iA(o.err.code,o.err.msg,iD(e,r+o.err.line));i=!0}else if(c)if(!l.tagClosed)return iA("InvalidTag","Closing tag '"+d+"' doesn't have proper closing.",iD(e,s));else{if(u.trim().length>0)return iA("InvalidTag","Closing tag '"+d+"' can't have attributes or invalid starting.",iD(e,a));if(0===r.length)return iA("InvalidTag","Closing tag '"+d+"' has not been opened.",iD(e,a));let n=r.pop();if(d!==n.tagName){let r=iD(e,n.tagStartPos);return iA("InvalidTag","Expected closing tag '"+n.tagName+"' (opened in line "+r.line+", col "+r.col+") instead of closing tag '"+d+"'.",iD(e,a))}0==r.length&&(o=!0)}else{let c=ij(u,n);if(!0!==c)return iA(c.err.code,c.err.msg,iD(e,s-u.length+c.err.line));if(!0===o)return iA("InvalidXml","Multiple possible root nodes found.",iD(e,s));-1!==n.unpairedTags.indexOf(d)||r.push({tagName:d,tagStartPos:a}),i=!0}for(s++;s<e.length;s++)if("<"===e[s])if("!"===e[s+1]){s=iM(e,++s);continue}else if("?"===e[s+1]){if((s=ik(e,++s)).err)return s}else break;else if("&"===e[s]){let n=function(e,n){if(";"===e[++n])return -1;if("#"===e[n]){var r=++n;let i=/\d/;for("x"===e[r]&&(r++,i=/[\da-fA-F]/);r<e.length;r++){if(";"===e[r])return r;if(!e[r].match(i))break}return -1}let i=0;for(;n<e.length;n++,i++)if(!e[n].match(/\w/)||!(i<20)){if(";"===e[n])break;return -1}return n}(e,s);if(-1==n)return iA("InvalidChar","char '&' is not expected.",iD(e,s));s=n}else if(!0===o&&!iI(e[s]))return iA("InvalidXml","Extra text at the end",iD(e,s));"<"===e[s]&&s--}}else{if(iI(e[s]))continue;return iA("InvalidChar","char '"+e[s]+"' is not expected.",iD(e,s))}return i?1==r.length?iA("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",iD(e,r[0].tagStartPos)):!(r.length>0)||iA("InvalidXml","Invalid '"+JSON.stringify(r.map(e=>e.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):iA("InvalidXml","Start tag expected.",1)}function iI(e){return" "===e||" "===e||"\n"===e||"\r"===e}function ik(e,n){let r=n;for(;n<e.length;n++)if("?"==e[n]||" "==e[n]){let i=e.substr(r,n-r);if(n>5&&"xml"===i)return iA("InvalidXml","XML declaration allowed only at the start of the document.",iD(e,n));if("?"!=e[n]||">"!=e[n+1])continue;n++;break}return n}function iM(e,n){if(e.length>n+5&&"-"===e[n+1]&&"-"===e[n+2]){for(n+=3;n<e.length;n++)if("-"===e[n]&&"-"===e[n+1]&&">"===e[n+2]){n+=2;break}}else if(e.length>n+8&&"D"===e[n+1]&&"O"===e[n+2]&&"C"===e[n+3]&&"T"===e[n+4]&&"Y"===e[n+5]&&"P"===e[n+6]&&"E"===e[n+7]){let r=1;for(n+=8;n<e.length;n++)if("<"===e[n])r++;else if(">"===e[n]&&0==--r)break}else if(e.length>n+9&&"["===e[n+1]&&"C"===e[n+2]&&"D"===e[n+3]&&"A"===e[n+4]&&"T"===e[n+5]&&"A"===e[n+6]&&"["===e[n+7]){for(n+=8;n<e.length;n++)if("]"===e[n]&&"]"===e[n+1]&&">"===e[n+2]){n+=2;break}}return n}let iP=RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function ij(e,n){let r=r9(e,iP),i={};for(let e=0;e<r.length;e++){if(0===r[e][1].length)return iA("InvalidAttr","Attribute '"+r[e][2]+"' has no space in starting.",iB(r[e]));if(void 0!==r[e][3]&&void 0===r[e][4])return iA("InvalidAttr","Attribute '"+r[e][2]+"' is without value.",iB(r[e]));if(void 0===r[e][3]&&!n.allowBooleanAttributes)return iA("InvalidAttr","boolean attribute '"+r[e][2]+"' is not allowed.",iB(r[e]));let o=r[e][2];if(!r7(o))return iA("InvalidAttr","Attribute '"+o+"' is an invalid name.",iB(r[e]));if(i.hasOwnProperty(o))return iA("InvalidAttr","Attribute '"+o+"' is repeated.",iB(r[e]));i[o]=1}return!0}function iA(e,n,r){return{err:{code:e,msg:n,line:r.line||r,col:r.col}}}function iD(e,n){let r=e.substring(0,n).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function iB(e){return e.startIndex+e[1].length}class iN{constructor(e){this.externalEntities={},this.options=Object.assign({},r5,e)}parse(e,n){if("string"==typeof e);else if(e.toString)e=e.toString();else throw Error("XML data is accepted in String or Bytes[] form.");if(n){!0===n&&(n={});let r=iO(e,n);if(!0!==r)throw Error(`${r.err.msg}:${r.err.line}:${r.err.col}`)}let r=new il(this.options);r.addExternalEntities(this.externalEntities);let i=r.parseXml(e);return this.options.preserveOrder||void 0===i?i:function e(n,r,i){let o,s={};for(let a=0;a<n.length;a++){let c=n[a],d=function(e){let n=Object.keys(e);for(let e=0;e<n.length;e++){let r=n[e];if(":@"!==r)return r}}(c),l="";if(l=void 0===i?d:i+"."+d,d===r.textNodeName)void 0===o?o=c[d]:o+=""+c[d];else if(void 0===d)continue;else if(c[d]){let n=e(c[d],r,l),i=function(e,n){let{textNodeName:r}=n,i=Object.keys(e).length;return 0===i||1===i&&(!!e[r]||"boolean"==typeof e[r]||0===e[r])}(n,r);void 0!==c[ix]&&(n[ix]=c[ix]),c[":@"]?function(e,n,r,i){if(n){let o=Object.keys(n),s=o.length;for(let a=0;a<s;a++){let s=o[a];i.isArray(s,r+"."+s,!0,!0)?e[s]=[n[s]]:e[s]=n[s]}}}(n,c[":@"],l,r):1!==Object.keys(n).length||void 0===n[r.textNodeName]||r.alwaysCreateTextNode?0===Object.keys(n).length&&(r.alwaysCreateTextNode?n[r.textNodeName]="":n=""):n=n[r.textNodeName],void 0!==s[d]&&s.hasOwnProperty(d)?(Array.isArray(s[d])||(s[d]=[s[d]]),s[d].push(n)):r.isArray(d,l,i)?s[d]=[n]:s[d]=n}}return"string"==typeof o?o.length>0&&(s[r.textNodeName]=o):void 0!==o&&(s[r.textNodeName]=o),s}(i,this.options)}addEntity(e,n){if(-1!==n.indexOf("&"))throw Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===n)throw Error("An entity with value '&' is not permitted");this.externalEntities[e]=n}static getMetaDataSymbol(){return ie.getMetaDataSymbol()}}class iL{constructor(){this.isXml=e=>iL.isXml(e),this.parseXmlOrText=e=>{try{let n=this.xmlParser.parse(e);if(Array.isArray(n)&&!n.length);else if(Array.isArray(n)&&n.length)return n;return e}catch(n){return e}},this.hasMixContentByParsedXml=e=>Array.isArray(e),this.xmlParser=new iN({preserveOrder:!0,ignoreAttributes:!1,attributeNamePrefix:"",textNodeName:"#text",alwaysCreateTextNode:!0})}static #F=this.isTextNode=e=>"text"in e;static #eh=this.isImageNode=e=>"image"in e;static #eK=this.isVideoNode=e=>"video"in e;static #eY=this.isXml=e=>"string"==typeof e&&!0===iO(e,{allowBooleanAttributes:!0})}class iU extends rz{constructor(e,n){super({...e,type:"aiWorker"},n),this.opts=n,this.contents=[],this.addContentRenderTask=e=>{if(iU.isTextContent(e)){let n=e=>{this.emitter.emit("content_change",{mod:"text",content:e.char,completed:e.done})};e.emitter.on("data",n),this.queue.add(e.runTask).finally(()=>{e.dispose()})}else iU.isImageContent(e)?this.queue.add(e.runTask).then(e=>{e&&this.emitter.emit("content_change",{mod:"image",content:e.src,completed:!0})}).finally(()=>{e.dispose()}):iU.isVideoContent(e)&&this.queue.add(e.runTask).then(e=>{e&&this.emitter.emit("content_change",{mod:"video",content:e.src,completed:!0})}).finally(()=>{e.dispose()})},this.addAllContents=e=>{for(let n of(this.contents=e,e))this.addContentRenderTask(n)},this.createContentsFromXmlString=e=>{let n=this.customXmlParser.parseXmlOrText(e);return this.customXmlParser.hasMixContentByParsedXml(n)?n[0].root[0].content.map(e=>iL.isTextNode(e)?r2.fromString(e.text[0]["#text"],{typewriterOptions:{delay:this.opts.typeDelay,enDelay:this.opts.enTypeDelay}}):iL.isImageNode(e)?r3.fromSrc(e.image[0]["#text"]):iL.isVideoNode(e)?r4.fromSrc(e.video[0]["#text"]):null).filter(Boolean):[]},this.appendText=e=>{if(this.customXmlParser.isXml(e)){let n=this.createContentsFromXmlString(e);this.addAllContents(n)}else{let n=r2.fromString(e,{typewriterOptions:{delay:this.opts.typeDelay,enDelay:this.opts.enTypeDelay}});this.addContentRenderTask(n),this.contents.push(n)}},this.dispose=()=>{this.queue.removeAllListeners(),this.contents=[]},this.interrupt=()=>{for(let e of this.contents)e.interrupt();this.queue.clear(),this.emitter.emit("interrupt")},this.bindEvents=()=>{this.queue.on("empty",()=>{this.emitter.emit("queue_empty")})},this.queue=new rY({concurrency:1}),this.customXmlParser=new iL,this.bindEvents()}get fulltext(){return this.contents.map(e=>iU.isTextContent(e)?e.getConfig().content:"").join("")}static #F=this.create=e=>new iU({},e);static #eh=this.isAllTextContents=e=>e.every(e=>"text"===e.mod);static #eK=this.isTextContent=e=>e instanceof r2&&"text"===e.mod;static #eY=this.isImageContent=e=>e instanceof r3&&"image"===e.mod;static #eQ=this.isVideoContent=e=>e instanceof r4&&"video"===e.mod}function iF(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function iH(e,n){return function(r,i){n(r,i,e)}}class iq{constructor(e){var n=this;this.opts=e,this.beans=[],this.currentConversation=null,this.aiWorkerConversationFormatters=[],this.add=e=>{this.beans.push(e)},this.addBySnapshot=function(){let e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};switch(r.type){case"client":e=new rG(r,n.opts);break;case"aiWorker":e=new iU(r,n.opts);break;default:throw Error(`Unknown conversation type: ${r.type}`)}return n.beans.push(e),e},this.setCurrentConversation=e=>{this.currentConversation=e},this.clear=()=>{this.beans=[]},this.toJSON=()=>this.beans.map(e=>e.toJSON()),this.dispose=()=>{for(let e of this.beans)e.dispose();this.beans=[],this.currentConversation=null,this.aiWorkerConversationFormatters=[]},this.registerAIWorkerConversationFormatter=e=>{this.aiWorkerConversationFormatters.push(e)},this.runAIWorkerConversationFormatters=e=>{let n=e;for(let e of this.aiWorkerConversationFormatters)n=e(n);return n},this.interruptAll=()=>{for(let e of this.beans)e.interrupt()}}get last(){var e;return null!=(e=this.beans[this.beans.length-1])?e:null}get currentClientConversation(){return iq.isClientConversation(this.currentConversation)?this.currentConversation:null}get currentAIWorkerConversation(){return iq.isAIWorkerConversation(this.currentConversation)?this.currentConversation:null}static isClientConversation(e){return(null==e?void 0:e.type)==="client"}static isAIWorkerConversation(e){return(null==e?void 0:e.type)==="aiWorker"}}iq=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eg(),iH(0,eh(nl.IOptions)),iH(0,eS()),iF("design:type",Function),iF("design:paramtypes",["undefined"==typeof IResolvedOptions?Object:IResolvedOptions])],iq);var iV=r("../../node_modules/abort-signal-polyfill/dist/staticMethods/any.js"),iz=r("../../node_modules/abort-signal-polyfill/dist/staticMethods/timeout.js"),iG=r("../../node_modules/abort-signal-polyfill/dist/staticMethods/abort.js");let iW=(e,n)=>{e in AbortSignal||Object.defineProperty(AbortSignal,e,{value:n,configurable:!0,writable:!0})};var iX=function(){return(iX=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)},i$=r("../../node_modules/@baidu/weirwood-perf/esm/index.js"),iJ=function(){return(iJ=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function iK(e){var n="function"==typeof Symbol&&Symbol.iterator,r=n&&e[n],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function iY(){for(var e=[],n=0;n<arguments.length;n++)e=e.concat(function(e,n){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,o,s=r.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(i=s.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return a}(arguments[n]));return e}function iQ(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return e instanceof Error}}function iZ(e){return"[object ErrorEvent]"===Object.prototype.toString.call(e)}function i0(e){return void 0===e}function i1(e){return"function"==typeof e}function i2(e){return"[object String]"===Object.prototype.toString.call(e)}function i3(e){return"[object Number]"===Object.prototype.toString.call(e)}function i4(e){return"[object Array]"===Object.prototype.toString.call(e)}function i5(e){return"[object Object]"===Object.prototype.toString.call(e)}function i6(e){if(!i5(e))return!1;for(var n in e)if(e.hasOwnProperty(n))return!1;return!0}var i8={};function i9(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:i8}var i7=i9(),oe={wrap:function(){return function(){}},report:!1,collectWindowErrors:!1,computeStackTrace:!1,remoteFetching:!1,linesOfContext:!1,extendToAsynchronousCallbacks:!1},ot=[].slice,on=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;function or(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function oi(){return"undefined"==typeof document||null==document.location?"":document.location.href}oe.wrap=function(e){return function(){try{return e.apply(this,arguments)}catch(e){throw oe.report(e),e}}},oe.report=function(){var e,n,r,i,o=[],s=null,a=null;function c(e,n,r,i,s,a){var c=null;if(!n||oe.collectWindowErrors){for(var d in o)if(or(o,d))try{o[d](e,n,r,i,s,a)}catch(e){c=e}if(c)throw c}}function d(n,r,i,o,s){var d=null;if(s=iZ(s)?s.error:s,n=iZ(n)?n.message:n,a)oe.computeStackTrace.augmentStackTraceWithInitialElement(a,r,i,n),u();else if(s&&iQ(s))(d=oe.computeStackTrace(s)).mechanism="onerror",c(d,!0,s,r,i,o);else{var l,f={url:r,line:i,column:o},p=n;if("[object String]"===({}).toString.call(n)){var h=n.match(on);h&&(l=h[1],p=h[2])}f.func=oe.computeStackTrace.guessFunctionName(f.url,f.line),f.context=oe.computeStackTrace.gatherContext(f.url,f.line),c(d={name:l,message:p,mode:"onerror",mechanism:"onerror",stack:[iJ(iJ({},f),{url:f.url||oi()})]},!0,null,r,i,o)}return!!e&&e.apply(this,arguments)}function l(e){var n=e&&(e.detail?e.detail.reason:e.reason)||e,r=oe.computeStackTrace(n);r.mechanism="onunhandledrejection",c(r,!0,n)}function u(){var e=a,n=s;a=null,s=null,c(e,!1,n)}function f(e){if(a)if(s===e)return;else u();var n=oe.computeStackTrace(e);throw a=n,s=e,setTimeout(function(){s===e&&u()},2e3*!!n.incomplete),e}return f.subscribe=function(e){o.push(e)},f.unsubscribe=function(s){for(var a=o.length-1;a>=0;--a)o[a]===s&&o.splice(a,1);0===o.length&&(n&&(i7.onerror=e,n=!1),i&&(i7.onunhandledrejection=r,i=!1))},f.installGlobalHandler=function(){!0!==n&&(e=i7.onerror,i7.onerror=d,n=!0)},f.installGlobalUnhandledRejectionHandler=function(){!0!==i&&(r=i7.onunhandledrejection,i7.onunhandledrejection=l,i=!0)},f}(),oe.computeStackTrace=function(){var e={};function n(n){if("string"!=typeof n)return[];if(!or(e,n)){var r="",i="";try{i=i7.document.domain}catch(e){}var o=/(.*)\:\/\/([^:\/]+)([:\d]*)\/{0,1}([\s\S]*)/.exec(n);o&&o[2]===i&&(r=function(e){if(!oe.remoteFetching)return"";try{var n=function(){try{return new i7.XMLHttpRequest}catch(e){return new i7.ActiveXObject("Microsoft.XMLHTTP")}}();return n.open("GET",e,!1),n.send(""),n.responseText}catch(e){return""}}(n)),e[n]=r?r.split("\n"):[]}return e[n]}function r(e,r){var i,o=/function ([^(]*)\(([^)]*)\)/,s=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,a="",c=n(e);if(!c.length)return"?";for(var d=0;d<10;++d)if(!i0(a=c[r-d]+a)){if(i=s.exec(a))return i[1];else if(i=o.exec(a))return i[1]}return"?"}function i(e,r){var i=n(e);if(!i.length)return null;var o=[],s=Math.floor(oe.linesOfContext/2),a=s+oe.linesOfContext%2,c=Math.max(0,r-s-1),d=Math.min(i.length,r+a-1);r-=1;for(var l=c;l<d;++l)i0(i[l])||o.push(i[l]);return o.length>0?o:null}function o(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,"\\$&")}function s(e){return o(e).replace("<","(?:<|<)").replace(">","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function a(e,r){for(var i,o,s=0,a=r.length;s<a;++s)if((i=n(r[s])).length&&(i=i.join("\n"),o=e.exec(i)))return{url:r[s],line:i.substring(0,o.index).split("\n").length,column:o.index-i.lastIndexOf("\n",o.index)-1};return null}function c(e,r,i){var s,a=n(r),c=RegExp("\\b"+o(e)+"\\b");return(i-=1,a&&a.length>i&&(s=c.exec(a[i])))?s.index:null}function d(e){if(!e.stack)return null;for(var n,o,s,a,d=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,l=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,u=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,f=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,p=/\((\S*)(?::(\d+))(?::(\d+))\)/,h=e.stack.split("\n"),m=[],v=/^(.*) is undefined$/.exec(e.message),g=0,y=h.length;g<y;++g){if(s=d.exec(h[g])){var b=s[2]&&0===s[2].indexOf("native");s[2]&&0===s[2].indexOf("eval")&&(o=p.exec(s[2]))&&(s[2]=o[1]),a={url:b?null:s[2],func:s[1]||"?",args:b?[s[2]]:[],line:s[3]?+s[3]:null,column:s[4]?+s[4]:null}}else if(s=u.exec(h[g]))a={url:s[2],func:s[1]||"?",args:[],line:+s[3],column:s[4]?+s[4]:null};else{if(!(s=l.exec(h[g])))continue;s[3]&&s[3].indexOf(" > eval")>-1&&(o=f.exec(s[3]))?s[3]=o[1]:0!==g||s[5]||i0(e.columnNumber)||(m[0].column=e.columnNumber+1),a={url:s[3],func:s[1]||"?",args:s[2]?s[2].split(","):[],line:s[4]?+s[4]:null,column:s[5]?+s[5]:null}}if(!a.func&&a.line&&(a.func=r(a.url,a.line)),oe.remoteFetching&&a.url&&"blob:"===a.url.substr(0,5)){var _=new XMLHttpRequest;if(_.open("GET",a.url,!1),_.send(""),200===_.status){var w=_.responseText||"",S=(w=w.slice(-300)).match(/\/\/# sourceMappingURL=(.*)$/);if(S){var R=S[1];"~"===R.charAt(0)&&(R=("undefined"==typeof document||null==document.location?"":document.location.origin?document.location.origin:document.location.protocol+"//"+document.location.hostname+(document.location.port?":"+document.location.port:""))+R.slice(1)),a.url=R.slice(0,-4)}}}a.context=a.line?i(a.url,a.line):null,m.push(a)}return m.length?(m[0]&&m[0].line&&!m[0].column&&v&&(m[0].column=c(v[1],m[0].url,m[0].line)),{mode:"stack",name:e.name,message:e.message,stack:m}):null}function l(e,n,o,s){var a={url:n,line:o};if(a.url&&a.line){e.incomplete=!1,a.func||(a.func=r(a.url,a.line)),a.context||(a.context=i(a.url,a.line));var d=/ '([^']+)' /.exec(s);if(d&&(a.column=c(d[1],a.url,a.line)),e.stack.length>0&&e.stack[0].url===a.url){if(e.stack[0].line===a.line)return!1;else if(!e.stack[0].line&&e.stack[0].func===a.func)return e.stack[0].line=a.line,e.stack[0].context=a.context,!1}return e.stack.unshift(a),e.partial=!0,!0}return e.incomplete=!0,!1}function u(e,f){var p=null;f=null==f?0:+f;try{if(p=function(e){var n=e.stacktrace;if(n){for(var o,s=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,a=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\))? in (.*):\s*$/i,c=n.split("\n"),d=[],l=0;l<c.length;l+=2){var u=null;if((o=s.exec(c[l]))?u={url:o[2],line:+o[1],column:null,func:o[3],args:[]}:(o=a.exec(c[l]))&&(u={url:o[6],line:+o[1],column:+o[2],func:o[3]||o[4],args:o[5]?o[5].split(","):[]}),u){if(!u.func&&u.line&&(u.func=r(u.url,u.line)),u.line)try{u.context=i(u.url,u.line)}catch(e){}u.context||(u.context=[c[l+1]]),d.push(u)}}return d.length?{mode:"stacktrace",name:e.name,message:e.message,stack:d}:null}}(e))return p}catch(e){}try{if(p=d(e))return p}catch(e){}try{if(p=function(e){var o=e.message.split("\n");if(o.length<4)return null;var c,d=/^\s*Line (\d+) of linked script ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,l=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?|blob)\S+)(?:: in function (\S+))?\s*$/i,u=/^\s*Line (\d+) of function script\s*$/i,f=[],p=i7&&i7.document&&i7.document.getElementsByTagName("script"),h=[];for(var m in p)or(p,m)&&!p[m].src&&h.push(p[m]);for(var v=2;v<o.length;v+=2){var g=null;if(c=d.exec(o[v]))g={url:c[2],func:c[3],args:[],line:+c[1],column:null};else if(c=l.exec(o[v])){g={url:c[3],func:c[4],args:[],line:+c[1],column:null};var y=+c[1],b=h[c[2]-1];if(b){var _=n(g.url);if(_){var w=(_=_.join("\n")).indexOf(b.innerText);w>=0&&(g.line=y+_.substring(0,w).split("\n").length)}}}else if(c=u.exec(o[v])){var S=oi().replace(/#.*$/,""),R=a(new RegExp(s(o[v+1])),[S]);g={url:S,func:"",args:[],line:R?R.line:c[1],column:null}}if(g){g.func||(g.func=r(g.url,g.line));var T=i(g.url,g.line),C=T?T[Math.floor(T.length/2)]:null;T&&C.replace(/^\s*/,"")===o[v+1].replace(/^\s*/,"")?g.context=T:g.context=[o[v+1]],f.push(g)}}return f.length?{mode:"multiline",name:e.name,message:o[0],stack:f}:null}(e))return p}catch(e){}try{if(p=function e(n,i){for(var d,f,p,h=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,m=[],v={},g=!1,y=e.caller;y&&!g;y=y.caller)if(y!==u&&y!==oe.report){if(f={url:null,func:"?",args:[],line:null,column:null},y.name?f.func=y.name:(d=h.exec(y.toString()))&&(f.func=d[1]),void 0===f.func)try{f.func=d.input.substring(0,d.input.indexOf("{"))}catch(e){}if(p=function(e){if(!i0(i7&&i7.document)){for(var n,r,i,c,d=[oi()],l=i7.document.getElementsByTagName("script"),u=""+e,f=0;f<l.length;++f){var p=l[f];p.src&&d.push(p.src)}if(i=/^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/.exec(u)){var h=i[1]?"\\s+"+i[1]:"",m=i[2].split(",").join("\\s*,\\s*");r=RegExp("function"+h+"\\s*\\(\\s*"+m+"\\s*\\)\\s*{\\s*"+(n=o(i[3]).replace(/;$/,";?"))+"\\s*}")}else r=new RegExp(o(u).replace(/\s+/g,"\\s+"));if(c=a(r,d))return c;if(i=/^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/.exec(u)){var v=i[1];if((c=a(r=RegExp("on"+v+"=[\\'\"]\\s*"+(n=s(i[2]))+"\\s*[\\'\"]","i"),d[0]))||(c=a(r=new RegExp(n),d)))return c}return null}}(y)){f.url=p.url,f.line=p.line,"?"===f.func&&(f.func=r(f.url,f.line));var b=/ '([^']+)' /.exec(n.message||n.description);b&&(f.column=c(b[1],p.url,p.line))}v[""+y]?g=!0:v[""+y]=!0,m.push(f)}i&&m.splice(0,i);var _={mode:"callers",name:n.name,message:n.message,stack:m};return l(_,n.sourceURL||n.fileName,n.line||n.lineNumber,n.message||n.description),_}(e,f+1))return p}catch(e){}return{original:e,name:e.name,message:e.message,mode:"failed"}}return u.augmentStackTraceWithInitialElement=l,u.computeStackTraceFromStackProp=d,u.guessFunctionName=r,u.gatherContext=i,u.ofCaller=function(e){e=(null==e?0:+e)+1;try{throw Error()}catch(n){return u(n,e+1)}},u.getSource=n,u}(),oe.extendToAsynchronousCallbacks=function(){var e=function(e){var n=i7[e];i7[e]=function(){var e=ot.call(arguments),r=e[0];return("function"==typeof r&&(e[0]=oe.wrap(r)),n.apply)?n.apply(this,e):n(e[0],e[1])}};e("setTimeout"),e("setInterval")},oe.remoteFetching=!1,oe.collectWindowErrors=!0,oe.linesOfContext=11,oe.report;var oo=oe.report.subscribe,os=oe.report.unsubscribe,oa=oe.report.installGlobalHandler,oc=oe.report.installGlobalUnhandledRejectionHandler,od=oe.computeStackTrace;function ol(e,n){var r=(65535&e)+(65535&n);return(e>>16)+(n>>16)+(r>>16)<<16|65535&r}function ou(e,n,r,i,o,s){var a;return ol((a=ol(ol(n,e),ol(i,s)))<<o|a>>>32-o,r)}function of(e,n,r,i,o,s,a){return ou(n&r|~n&i,e,n,o,s,a)}function op(e,n,r,i,o,s,a){return ou(n&i|r&~i,e,n,o,s,a)}function oh(e,n,r,i,o,s,a){return ou(n^r^i,e,n,o,s,a)}function om(e,n,r,i,o,s,a){return ou(r^(n|~i),e,n,o,s,a)}function ov(e,n){e[n>>5]|=128<<n%32,e[(n+64>>>9<<4)+14]=n;var r,i,o,s,a,c=0x67452301,d=-0x10325477,l=-0x67452302,u=0x10325476;for(r=0;r<e.length;r+=16)i=c,o=d,s=l,a=u,c=of(c,d,l,u,e[r],7,-0x28955b88),u=of(u,c,d,l,e[r+1],12,-0x173848aa),l=of(l,u,c,d,e[r+2],17,0x242070db),d=of(d,l,u,c,e[r+3],22,-0x3e423112),c=of(c,d,l,u,e[r+4],7,-0xa83f051),u=of(u,c,d,l,e[r+5],12,0x4787c62a),l=of(l,u,c,d,e[r+6],17,-0x57cfb9ed),d=of(d,l,u,c,e[r+7],22,-0x2b96aff),c=of(c,d,l,u,e[r+8],7,0x698098d8),u=of(u,c,d,l,e[r+9],12,-0x74bb0851),l=of(l,u,c,d,e[r+10],17,-42063),d=of(d,l,u,c,e[r+11],22,-0x76a32842),c=of(c,d,l,u,e[r+12],7,0x6b901122),u=of(u,c,d,l,e[r+13],12,-0x2678e6d),l=of(l,u,c,d,e[r+14],17,-0x5986bc72),d=of(d,l,u,c,e[r+15],22,0x49b40821),c=op(c,d,l,u,e[r+1],5,-0x9e1da9e),u=op(u,c,d,l,e[r+6],9,-0x3fbf4cc0),l=op(l,u,c,d,e[r+11],14,0x265e5a51),d=op(d,l,u,c,e[r],20,-0x16493856),c=op(c,d,l,u,e[r+5],5,-0x29d0efa3),u=op(u,c,d,l,e[r+10],9,0x2441453),l=op(l,u,c,d,e[r+15],14,-0x275e197f),d=op(d,l,u,c,e[r+4],20,-0x182c0438),c=op(c,d,l,u,e[r+9],5,0x21e1cde6),u=op(u,c,d,l,e[r+14],9,-0x3cc8f82a),l=op(l,u,c,d,e[r+3],14,-0xb2af279),d=op(d,l,u,c,e[r+8],20,0x455a14ed),c=op(c,d,l,u,e[r+13],5,-0x561c16fb),u=op(u,c,d,l,e[r+2],9,-0x3105c08),l=op(l,u,c,d,e[r+7],14,0x676f02d9),d=op(d,l,u,c,e[r+12],20,-0x72d5b376),c=oh(c,d,l,u,e[r+5],4,-378558),u=oh(u,c,d,l,e[r+8],11,-0x788e097f),l=oh(l,u,c,d,e[r+11],16,0x6d9d6122),d=oh(d,l,u,c,e[r+14],23,-0x21ac7f4),c=oh(c,d,l,u,e[r+1],4,-0x5b4115bc),u=oh(u,c,d,l,e[r+4],11,0x4bdecfa9),l=oh(l,u,c,d,e[r+7],16,-0x944b4a0),d=oh(d,l,u,c,e[r+10],23,-0x41404390),c=oh(c,d,l,u,e[r+13],4,0x289b7ec6),u=oh(u,c,d,l,e[r],11,-0x155ed806),l=oh(l,u,c,d,e[r+3],16,-0x2b10cf7b),d=oh(d,l,u,c,e[r+6],23,0x4881d05),c=oh(c,d,l,u,e[r+9],4,-0x262b2fc7),u=oh(u,c,d,l,e[r+12],11,-0x1924661b),l=oh(l,u,c,d,e[r+15],16,0x1fa27cf8),d=oh(d,l,u,c,e[r+2],23,-0x3b53a99b),c=om(c,d,l,u,e[r],6,-0xbd6ddbc),u=om(u,c,d,l,e[r+7],10,0x432aff97),l=om(l,u,c,d,e[r+14],15,-0x546bdc59),d=om(d,l,u,c,e[r+5],21,-0x36c5fc7),c=om(c,d,l,u,e[r+12],6,0x655b59c3),u=om(u,c,d,l,e[r+3],10,-0x70f3336e),l=om(l,u,c,d,e[r+10],15,-1051523),d=om(d,l,u,c,e[r+1],21,-0x7a7ba22f),c=om(c,d,l,u,e[r+8],6,0x6fa87e4f),u=om(u,c,d,l,e[r+15],10,-0x1d31920),l=om(l,u,c,d,e[r+6],15,-0x5cfebcec),d=om(d,l,u,c,e[r+13],21,0x4e0811a1),c=om(c,d,l,u,e[r+4],6,-0x8ac817e),u=om(u,c,d,l,e[r+11],10,-0x42c50dcb),l=om(l,u,c,d,e[r+2],15,0x2ad7d2bb),d=om(d,l,u,c,e[r+9],21,-0x14792c6f),c=ol(c,i),d=ol(d,o),l=ol(l,s),u=ol(u,a);return[c,d,l,u]}function og(e){var n,r="",i=32*e.length;for(n=0;n<i;n+=8)r+=String.fromCharCode(e[n>>5]>>>n%32&255);return r}function oy(e){var n,r=[];for(n=0,r[(e.length>>2)-1]=void 0;n<r.length;n+=1)r[n]=0;var i=8*e.length;for(n=0;n<i;n+=8)r[n>>5]|=(255&e.charCodeAt(n/8))<<n%32;return r}function ob(e){var n,r,i="0123456789abcdef",o="";for(r=0;r<e.length;r+=1)o+=i.charAt((n=e.charCodeAt(r))>>>4&15)+i.charAt(15&n);return o}function o_(e){return unescape(encodeURIComponent(e))}function ow(e){var n;return og(ov(oy(n=o_(e)),8*n.length))}function oS(e,n){return function(e,n){var r,i,o=oy(e),s=[],a=[];for(s[15]=a[15]=void 0,o.length>16&&(o=ov(o,8*e.length)),r=0;r<16;r+=1)s[r]=0x36363636^o[r],a[r]=0x5c5c5c5c^o[r];return i=ov(s.concat(oy(n)),512+8*n.length),og(ov(a.concat(i),640))}(o_(e),o_(n))}function oR(e,n,r){if(!n)return r?ow(e):ob(ow(e));return r?oS(n,e):ob(oS(n,e))}function oT(e){return(e||"").replace(/#.*$/,"").replace(/\?.*$/,"")}function oC(){if(!("fetch"in i9()))return!1;try{return new Headers,new Request(""),new Response,!0}catch(e){return!1}}function ox(e,n){for(var r=0;r<e.length;++r)if(e[r]===n)return r;return -1}function oE(e,n,r,i){var o,s,a,c;return JSON.stringify(e,(o=n,a=[],c=[],null==(s=i)&&(s=function(e,n){return a[0]===n?"[Circular ~]":"[Circular ~."+c.slice(0,ox(a,n)).join(".")+"]"}),function(e,n){if(a.length>0){var r=ox(a,this);~r?a.splice(r+1):a.push(this),~r?c.splice(r,1/0,e):c.push(e),~ox(a,n)&&(n=s.call(this,e,n))}else a.push(n);return null==o?n instanceof Error?function(e){var n={stack:e.stack,message:e.message,name:e.name};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(n):n:o.call(this,e,n)}),r)}function oO(e,n){if(Array.isArray(e))for(var r=e.length,i=0;i<r;i++)n.call(null,i,e[i]);else for(var o in e)Reflect.has(e,o)&&n.call(null,o,e[o])}function oI(e){var n={};for(var r in e)if(e.hasOwnProperty(r)){var i=e[r];n[r]=i1(i)?i():i}return n}function ok(e){return i2(e)?oM(e,40):i3(e)||"[object Boolean]"===Object.prototype.toString.call(e)||i0(e)?e+"":i5(e)?"[Object]":i4(e)?"[Array]":i1(e)?e.name?"[Function: "+e.name+"]":"[Function]":e}function oM(e,n){return 0===n||e.length<=n?e:e.substr(0,n)+"…"}function oP(e){var n={protocol:"",host:"",path:"",relative:""};if("string"!=typeof e)return n;var r=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(r&&r.length){var i=r[6]||"",o=r[8]||"";return{protocol:r[2]||"",host:r[4]||"",path:r[5]||"",relative:(r[5]||"")+i+o}}return n}function oj(e){var n=e.exception,r=[];return r.push("token="+n.token),r.push("type="+n.type),r.push("mechanism="+n.mechanism),r.push("value="+n.value),r.push("url="+n.url),n.stacktrace&&n.stacktrace.forEach(function(e){r.push("filename="+e.filename),r.push("lineno="+e.lineno),r.push("colno="+e.colno)}),r.join("***")}function oA(e){return e&&Array.isArray(e)&&e.length>0}function oD(e){for(var n=[],r=e.length,i=0;i<r;i++){var o=e[i];i2(o)?n.push(o.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")):o&&o.source&&n.push(o.source)}return RegExp(n.join("|"),"i")}function oB(e,n){return!!i2(n)&&e.some(function(e){if(!e)return!1;if(i2(e))return -1!==n.indexOf(e);if("[object RegExp]"===Object.prototype.toString.call(e))try{return e.test(n)}catch(n){return console.error(e+"正则书写有误"),!1}return console.error(e+"忽略匹配项类型应该是String、RegExp"),!1})}function oN(e){return(i2(e)?e:JSON.stringify(e)).slice(0,256)}function oL(e,n,r){var i,o,s=[];if(e.stack&&e.stack.length){try{for(var a=iK(e.stack),c=a.next();!c.done;c=a.next()){var d=c.value,l=function(e,n,r){var i={filename:e.url||n,lineno:e.line,colno:e.column,function:e.func||"?"};if(r&&r.length>0){var o=oD(r).test(i.filename),s=/(Weirwood|Tracekit)/.test(i.function),a=/weirwood\-sdk/.test(i.filename);i.in_app=o,(s||a)&&(i.in_app=!1)}else i.in_app=!1;return i}(d,e.url||"",n.includePaths);s.push(l)}}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}if(n&&n.trimHeadFrames)for(var u=0;u<n.trimHeadFrames&&u<s.length;u++)s[u].in_app=!1}return(s=s.filter(function(e){var n,r,i;return r=-1!==(n=e.filename||"").indexOf("weirwood-sdk"),i=/captureException$/.test(n),!r&&!i})).slice(0,r)}function oU(e,n,r,i){if(null!=e){var o=e[n];return e[n]=r(o),e[n].__raven__=!0,e[n].__orig__=o,o.__raven_wrapper__=e[n],i&&i.push([e,n,o]),e[n]}}function oF(e,n,r){if(void 0===e&&(e={}),i0(n)&&!i1(e))return e;if(i1(e)&&(n=e,e=void 0),!i1(n))return n;try{if(n.__raven__)return n;if(n.__raven_wrapper__)return n.__raven_wrapper__}catch(e){return n}function i(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var s=[],a=i.length,c=!e||e&&!1!==e.deep;for(r&&i1(r)&&r.apply(this,i);a--;)s[a]=c?oF(e,i[a]):i[a];try{return n.apply(this,s)}catch(e){throw e}}for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o]);return i.prototype=n.prototype,n.__raven_wrapper__=i,i.__raven__=!0,i.__orig__=n,i}function oH(e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=n[0];return(i1(i)&&(n[0]=oF({mechanism:{type:"instrument",data:{function:(null==e?void 0:e.name)||"<anonymous>"}}},i)),e.apply)?e.apply(this,n):e(n[0],n[1])}}function oq(e,n){return function(r){if(ct=void 0,cn!==r){cn=r;try{i=function(e){for(var n,r=[],i=0,o=0;e&&i++<5;){var s="html"===(n=function(e){if(!e||!e.tagName)return"";var n,r,i,o,s=[e.tagName.toLowerCase()];e.id&&s.push("#"+e.id);var a=e.className?e.className.split(/\s+/):[];try{for(var c=iK(a),d=c.next();!d.done;d=c.next()){var l=d.value;s.push("."+l)}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}try{for(var u=iK(["type","name","title","alt"]),f=u.next();!f.done;f=u.next()){var p=f.value,h=e.getAttribute(p);h&&s.push("["+p+"="+h+"]")}}catch(e){i={error:e}}finally{try{f&&!f.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}return s.join("")}(e)),a=i>1&&o+3*r.length+n.length>=80;if(s||a)break;r.push(n),o+=n.length,e=e.parentNode}return r.reverse().join(" > ")}(r.target)}catch(e){i="<unknown>"}if(i){var i,o={category:"ui."+n,message:i,name:n};"input"===n&&"password"!==i.type&&(o.data=r.target.value||""),e.captureBehavior(o)}}}}function oV(e){return function(n){try{r=n.target}catch(e){return}var r,i=r&&r.tagName;i&&("INPUT"===i||"TEXTAREA"===i||r.isContentEditable)&&(ct||oq(e,"input")(n),clearTimeout(ct),ct=setTimeout(function(){ct=void 0},1e3))}}r("../../node_modules/@baidu/weirwood-error/esm/plugins/Plugin.js");var oz=i9(),oG=[301,302,304],oW=function(){function e(n){this.name=e.id,this.options=iJ({beacon:!0,console:!0,dom:!0,fetch:!0,history:!0,weirwood:!0,xhr:!0},n)}return e.prototype.setupOnce=function(e){this.client=e;var n,r,i=Object.keys(this.options);try{for(var o=iK(i),s=o.next();!s.done;s=o.next()){var a=s.value,c="instrument"+a[0].toUpperCase()+a.slice(1);this.options[a]&&this[c]&&"function"==typeof this[c]&&this[c].call(this)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},e.prototype.instrumentDom=function(){if("document"in i9()){var e=oz.document;e.addEventListener("click",oq.call(this,this.client,"click"),!1),e.addEventListener("keypress",oV.call(this,this.client),!1)}},e.prototype.instrumentXhr=function(){var e=this.client,n=e.options,r=n.collectAutoAPIException,i=n.isApiException;if("XMLHttpRequest"in oz){var o=XMLHttpRequest.prototype,s=e._globalKey||"";oU(o,"open",function(e){return function(n,r){return i2(r)&&-1===r.indexOf(s)&&(this.__raven_xhr={method:n,url:r,status_code:null}),e.apply(this,arguments)}},e._wrappedBuiltIns),oU(o,"abort",function(e){return function(){return this.__raven_xhr&&(this.__raven_xhr.abortedFlag=!0),e.apply(this,arguments)}},e._wrappedBuiltIns),oU(o,"send",function(n){return function(){var o=this,s=arguments;function a(){if(o.__raven_xhr&&4===o.readyState){try{o.__raven_xhr.status_code=o.status}catch(e){}var n=function(e,n){if(void 0===e&&(e=""),void 0===n&&(n=""),(""===e||"text"===e)&&i2(n)&&n.length)try{return JSON.parse(n)}catch(e){return n}return"json"===e?JSON.parse(JSON.stringify(n)):""}(o.responseType,o.response);if((e.captureBehavior({type:"http",category:"xhr",data:iJ(iJ({},o.__raven_xhr),{response:oN(n),params:oN(s&&s[0]?s[0]:"")})}),r)&&(!o.__raven_xhr||!o.__raven_xhr.abortedFlag)){var a=!1,c=o.status>=200&&o.status<=299,d=-1!==oG.indexOf(o.status);if(c||d||(a=!0),c&&i&&i1(i)&&(a=!!i({method:o.__raven_xhr.method,url:o.responseURL,status:o.status,responseType:o.responseType,response:n})),a){var l="";i1(o.getAllResponseHeaders)&&(l=o.getAllResponseHeaders().trim().replace(/[\r\n]+/g,"***")),e.captureAPIException({url:o.responseURL||o.__raven_xhr.url,method:o.__raven_xhr.method,params:s&&s[0]?s[0]:"",status:o.status,response:(i2(n)?n:JSON.stringify(n)).slice(0,8192),responseHeaders:l,user:"",extra:"AUTO_XHR"})}}}}for(var c=["onload","onerror","onprogress"],d=0;d<c.length;d++)!function(e,n){e in n&&i1(n[e])&&oU(n,e,function(n){return oF({mechanism:{data:{function:e,handler:n&&n.name||"<anonymous>"},handled:!0,type:"instrument"}},n)})}(c[d],o);return"onreadystatechange"in o&&i1(o.onreadystatechange)?oU(o,"onreadystatechange",function(e){return oF({mechanism:{type:"instrument",data:{function:"onreadystatechange",handler:e&&e.name||"<anonymous>"}}},e,a)}):o.onreadystatechange=a,n.apply(this,arguments)}},e._wrappedBuiltIns)}},e.prototype.instrumentFetch=function(){if(oC()){var e=i9(),n=this.client,r=n.options,i=r.collectAutoAPIException,o=r.isApiException,s=n._globalKey;oU(oz,"fetch",function(r){return function(){for(var a,c=Array(arguments.length),d=0;d<c.length;++d)c[d]=arguments[d];var l=c[0],u="GET";if("string"==typeof l?a=l:"Request"in e&&l instanceof e.Request?(a=l.url,(null==l?void 0:l.method)&&(u=l.method)):a=""+l,-1!==a.indexOf(s))return r.apply(this,c);c[1]&&c[1].method&&(u=c[1].method);var f={method:u,url:a,status_code:null};return r.apply(this,c).then(function(e){f.status_code=e.status;var r,s,a="";c[1]&&c[1].body&&(a=c[1].body);var d=i1(e.clone)?e.clone():null,l={type:"http",category:"fetch",data:iJ(iJ({},f),{params:oN(a),response:""})};if(d?d.text().then(function(e){var r;try{r=JSON.parse(e)}catch(n){r=e}l.data.response=oN(r),n.captureBehavior(l)}):n.captureBehavior(l),!i)return e;var u=!1,p=i1(e.clone)?e.clone():null,h=oG.includes(e.status);e.ok||h||(u=!0);var m={method:f.method,url:f.url,status:e.status,response:""},v=[];try{for(var g=iK(e.headers.entries()),y=g.next();!y.done;y=g.next()){var b=y.value;v.push(b[0]+": "+b[1])}}catch(e){r={error:e}}finally{try{y&&!y.done&&(s=g.return)&&s.call(g)}finally{if(r)throw r.error}}var _=iJ(iJ({},m),{params:a,responseHeaders:v.join("***"),user:"",extra:"AUTO_FETCH"});return p?p.text().then(function(r){var i;try{i=JSON.parse(r)}catch(e){i=r}e.ok&&i1(o)&&(u=!!o(iJ(iJ({},m),{response:i}))),u&&n.captureAPIException(iJ(iJ({},_),{response:r.slice(0,8192)}))}).catch(function(e){console.error(e)}):(e.ok&&i1(o)&&(u=!!o(m)),u&&n.captureAPIException(_)),e}).catch(function(e){throw n.captureBehavior({type:"http",category:"fetch",data:f,level:"error"}),e})}},n._wrappedBuiltIns)}},e.prototype.instrumentHistory=function(){var e,n,r,i,o=this.client;if(r=(n=(e=i9()).chrome)&&n.app&&n.app.runtime,i="history"in e&&!!e.history.pushState&&!!e.history.replaceState,!r&&i){var s=function(e,n){var r=oP(oz.location.href),i=oP(n),s=oP(e);s.path||(s=r),cr=n,r.protocol===i.protocol&&r.host===i.host&&(n=i.relative),r.protocol===s.protocol&&r.host===s.host&&(e=s.relative),o.captureBehavior({category:"navigation",data:{from:e,to:n}})},a=oz.onpopstate;oz.onpopstate=function(e){var n=oz.location.href;if(s(cr,n),a)return a.apply(oz,e)},oU(oz.history,"pushState",c),oU(oz.history,"replaceState",c)}function c(e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=n.length>2?n[2]:void 0;return i&&s(cr,String(i)),e.apply(this,n)}}},e.prototype.instrumentConsole=function(){},e.prototype.instrumentBeacon=function(){},e.id="behaviors",e}(),oX=i9(),o$=function(){function e(n){this.name=e.id,this.options=iJ({active:!0},n)}return e.prototype.setupOnce=function(e){this.client=e,this.options.active&&oU(oX,"setTimeout",oH,this.client._wrappedBuiltIns)},e.id="trycatch",e}(),oJ=i9(),oK=function(){function e(){this.name=e.id}return e.prototype.setupOnce=function(e){this.client=e,this.client.captureUserAgent(this.getUserAgent())},e.prototype.getUserAgent=function(){return"navigator"in oJ&&"document"in oJ?{url:oJ.location.href,headers:{"User-Agent":oJ.navigator.userAgent,Referrer:oJ.document.referrer}}:{}},e.id="UserAgent",e}(),oY={collectWindowErrors:!0,collectUnhandledRejections:!0,collectResourceLoadErrors:!1,collectAutoAPIException:!0,sampleRate:1,maxUrlLength:250,maxMessageLength:0,allowDuplicates:!1,stackTraceLimit:50,behaviorLimit:10,plugins:[],ignoreErrors:[],ignoreKeys:[],whitelistUrls:[],apiWhitelistUrls:[],resourceWhitelistUrls:[],ignoreUrls:[],ignoreJsUrls:[],ignoreApiUrls:[],ignoreApiStatus:[],ignoreResourceUrls:[],maxMessagePerMinute:10,endpoint:"https://fclog.baidu.com/log/weirwood?type=error"},oQ="https://dmpstatic.cdn.bcebos.com/weirwood",oZ=function(){function e(e){this.options=oY,this._globalContext={env:{},user:{},session_id:""},this._globalKey="fclog.baidu.com/log",this._currentExceptionContext={},this._currentExceptionStartTime=Date.now(),this._behaviors=[],this._lastData=null,this._lastAPIData=null,this._messagesSendLastMinute=0,this._messagesSendEmptyStartTime=Date.now(),this._installed=!1,this._globalErrorHandler=null,this._fetchDefaults={method:"POST",credentials:"include",referrerPolicy:!function(){if(!oC())return!1;try{return new Request("pickleRick",{referrerPolicy:"origin"}),!0}catch(e){return!1}}()?"":"origin"},this._wrappedBuiltIns=[],this._requestInfo=null,e&&this.config(e)}return e.prototype.init=function(e){return this.config(e)},e.prototype.config=function(e){this.options=iJ(iJ({},this.options),e),this.options.sendWindow=this.options.sendWindow||i9(),this._globalContext.session_id=this.options.uuid4();var n=this.options,r=n.token,i=n.buildid;if(!r||!i)throw Error("error: token and buildid must be provided");return this.setFilters(),this.install(),this},e.prototype.install=function(){var e,n=this;return this._installed?(console.error("error: Weirwood Error SDK has been installed and configured"),!1):(this.options.collectWindowErrors&&oa(),this.options.maxMessagePerMinute>=60&&(this.options.maxMessagePerMinute=60),this.options.collectUnhandledRejections&&oc(),this._globalErrorHandler=this._getErrorHandler().bind(this),oo(this._globalErrorHandler),this.options.collectResourceLoadErrors&&(e=function(e){if(window.performance&&window.performance.getEntriesByName){var r,i=window.performance.getEntriesByName(e.asset);i.length>0&&(r=i[0],["name","serverTiming"].forEach(function(e){delete r[e]}))}var o={mechanism:e.type,name:"ResourceError",message:e.asset,stack:[],mode:"onerror",timing:r,page:e.page,element:e.element,elementPath:e.path.slice(0,255)};n._handleStackInfo(o,{trimHeadFrames:0,mechanism:o.mechanism||"generic",includePaths:n.options.includePaths})},window.addEventListener("error",function(n){if(n&&n.target&&n.target!==window){var r,i=n.target,o=null!=(r=null==i?void 0:i.tagName)?r:"unknown tagname";if(-1!==["SCRIPT","LINK","IMG"].indexOf(o)){var s=i.src||i.href,a=window.location.href,c=function(e){for(var n=e.path||[],r="",i=0;i<n.length;i++){var o=n[i];if(o===window){r+="Window";continue}r+=o.nodeName,r+=o.id?"#"+o.id:"",r+=o.className?"."+o.className.split(" ").join("."):"",i<n.length&&(r+=" > ")}return r}(n),d={type:o,asset:oT(s)===oT(a)?"空资源":s,integrity:i.integrity,element:i&&i.outerHTML&&i.outerHTML.replace(/"/g,""),path:c.replace(/"/g,""),page:window.location.href.slice(0,255)};e&&e(d)}}},!0)),this._installed=!0,this.installPlugins(),this)},e.prototype.installPlugins=function(){var e,n;this.options.plugins=iY([new oW(this.options.behaviorOptions),new o$(this.options.tryCatchOptions),new oK],this.options.plugins||[]);try{for(var r=iK(this.options.plugins),i=r.next();!i.done;i=r.next())i.value.setupOnce(this)}catch(n){e={error:n}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},e.prototype.setFilters=function(){var e=this.options;e.ignoreErrors&&(e.ignoreErrors=iY([/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,'{"isTrusted":true}','{"isTrusted":false}',"Network Error","ResizeObserver loop"],e.ignoreErrors||[])),e.ignoreJsUrls=iY(["chrome-extension","safari-extension","moz-extension",oQ],e.ignoreJsUrls||[])},e.prototype._getErrorHandler=function(){var e=this;return function(n,r,i,o,s,a){if(i&&(i.stack||i.stacktrace)&&(n.originalStack=((i.stack||i.stacktrace)+"").slice(0,1e4)),n.stack&&!n.stack.length&&o&&(n.stack[0]={url:o,line:s,column:a}),!n.name&&!n.message&&"onunhandledrejection"===n.mechanism){var c=i9();n.name="unhandledrejection",n.url=n.url||c.location.href,n.message=i}e._handleStackInfo(n,{trimHeadFrames:0,mechanism:n.mechanism||"generic",includePaths:e.options.includePaths})}},e.prototype._handleStackInfo=function(e,n){var r=oL(e,n,this.options.stackTraceLimit);this._processException(e,r,n)},e.prototype._processException=function(e,n,r){var i=this.options,o=i.ignoreErrors,s=void 0===o?[]:o,a=i.ignoreKeys,c=void 0===a?[]:a,d=i.whitelistUrls,l=void 0===d?[]:d,u=i.resourceWhitelistUrls,f=void 0===u?[]:u,p=i.ignoreUrls,h=void 0===p?[]:p,m=i.ignoreJsUrls,v=void 0===m?[]:m,g=i.ignoreResourceUrls,y=void 0===g?[]:g,b=e.name,_=e.message,w=e.url,S=void 0===w?"":w,R=e.page,T=void 0===R?window.location.href:R,C=e.lineno,x=e.originalStack;if(!(s.length&&oB(s,_)||h.length&&oB(h,T))){var E=n&&n.length&&n[0].filename||S;if("ResourceError"===b){if(y.length&&oB(y,_)||f.length&&!oB(f,_))return}else if(c.length&&oB(c,b)||v.length&&oB(v,E)||l.length&&!oB(l,E))return;if(n&&n.length>0){var O=n[0].filename||"",I=-1!==O.indexOf("@baidu/weirwood-error"),k=-1!==O.indexOf(oQ);if(I||k)return}if(-1===E.indexOf(oQ)){var M,P=(M=void 0===C?0:C,n&&n.length?n.reverse():S?[{filename:S,lineno:M||0,in_app:!0}]:[]),j=iJ(iJ({},r),{exception:{type:b,value:_,originalStack:void 0===x?"":x,stacktrace:P,url:"ResourceError"===b?_:E,page:e.page,element:e.element,timing:e.timing,elementPath:e.elementPath}}),A=j.exception;null==A.type&&""===A.value&&(A.value="Unrecoverable error caught"),!j.exception.mechanism&&j.mechanism&&(j.exception.mechanism=j.mechanism,delete j.mechanism),this._send(j)}}},e.prototype.mergeGlobalContext=function(e){var n,r,i,o=i9();e.env=iJ(iJ(iJ({},this._globalContext.env),e.env),{network:null==(i=o.navigator.connection)?void 0:i.effectiveType,windowHeight:(o.document.documentElement||o.document.body).clientHeight,windowWidth:(o.document.documentElement||o.document.body).clientWidth,documentTitle:o.document.title});try{for(var s=iK(Object.keys(this._currentExceptionContext)),a=s.next();!a.done;a=s.next()){var c=a.value;e.env[c]=this._currentExceptionContext[c]}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}e.env["session:duration"]=Date.now()-this._currentExceptionStartTime,this._globalContext.user&&(e.user=this._globalContext.user),this._globalContext.session_id&&(e.session_id=this._globalContext.session_id)},e.prototype._send=function(e){var n={request:this._requestInfo};if(i0(e.trimHeadFrames)||delete e.trimHeadFrames,e=iJ(iJ({},n),e),this.mergeGlobalContext(e),this._behaviors&&this._behaviors.length>0){var r=[].slice.call(this._behaviors,0);this.options.behaviorDataCallback&&(r=this.options.behaviorDataCallback(r)),e.behaviors=r}var i=this.options;if(i.token&&(e.token=i.token),i.buildid&&(e.buildid=i.buildid),Object.keys(e=this._sanitizeData(e)).forEach(function(n){(null==e[n]||""===e[n]||i6(e[n]))&&delete e[n]}),i1(i.dataCallback)&&(e=i.dataCallback(e)),!(!e||i6(e))){var o=Date.now()-this._messagesSendEmptyStartTime,s=this._messagesSendLastMinute>this.options.maxMessagePerMinute;if(o<6e4){if(s)return}else this._messagesSendEmptyStartTime=Date.now(),this._messagesSendLastMinute=1;"number"==typeof i.sampleRate?Math.random()<i.sampleRate&&(this._sendProcessedPayload(e),this._messagesSendLastMinute+=1):(this._sendProcessedPayload(e),this._messagesSendLastMinute+=1)}},e.prototype.isSetup=function(){return this._installed},e.prototype._trimPacket=function(e){var n,r,i=this.options.maxUrlLength||0,o=this.options.maxMessageLength||0;if(e.exception&&(e.exception.value=oM(e.exception.value,o)),e.request){var s=i9();e.request.url=oM(s.location.href,i);var a=e.request.headers.Referrer;e.request.headers.Referrer=oM(a,i)}if(e.behaviors&&e.behaviors.length){var c=["url","to","from"];try{for(var d=iK(e.behaviors),l=d.next();!l.done;l=d.next()){var u=l.value;!function(e){var n=e.data||{},r=function(e){n.hasOwnProperty(e)&&c.forEach(function(r){e===r&&(n[e]=oM(n[e],i))})};for(var o in n)r(o)}(u)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}}return e},e.prototype._sendProcessedPayload=function(e,n){var r,i=this,o=this.options;if(e=this._trimPacket(e),!this.options.allowDuplicates&&this._isRepeatData(e))return void console.warn("Weirwood error SDK dropped repeat event:",e);var s=o.issueGroupby;s&&i1(s)&&(r=s(e.exception)),r&&i2(r)?(e.fingerprint=r.substr(0,255),e.event_id=oR(e.fingerprint)):e.event_id=oR(oj(e)),e.data_id=oR(function(e){var n=oj(e),r=[],i=e.request,o=e.env,s=e.behaviors;if(!i)return JSON.stringify(e);var a=i.headers,c=i.url;return r.push("Referrer="+a.Referrer),r.push("ua="+a["User-Agent"]),r.push("url="+c),oO(o,function(e,n){"session:duration"!==e&&r.push(e+"="+n)}),oO(s,function(e){r.push("behavior.category="+e.category),r.push("behavior.name="+e.name),r.push("behavior.message="+e.message)}),n+r.join("***")}(e)),e.version=this.options.version||"",e.sdkTimestamp=Date.now(),this._lastData=e;var a={weirwood_version:this.options.version||""};(o.transport||this._makeRequest).call(this,{url:this.options.endpoint,auth:a,data:e,options:o,onSuccess:function(){i._resetBackoff(),n&&n()},onError:function(e){e.request&&i._setBackoffState(e.request),e=e||Error("Raven send failed (no additional details provided)"),n&&n(e)}})},e.prototype._makeRequest=function(e){var n,r,i=this,o=e.url,s=null,a={};e.options.headers&&(s=oI(e.options.headers)),e.options.fetchParameters&&(a=oI(e.options.fetchParameters));var c=this.options.sendWindow;if(oC()){a.body=oE(e.data);var d=iJ(iJ({},this._fetchDefaults),a);if(s){var l=new Headers;try{for(var u=iK(Object.keys(s)),f=u.next();!f.done;f=u.next()){var p=f.value;l.append(p,s[p])}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}l.append("Content-Type","text/plain"),d.headers=l}return c.fetch(o,d).then(function(n){if(n.ok)e.onSuccess&&e.onSuccess(),i._resetBackoff();else{var r=Error("Weirwood error SDK error code: "+n.status);r.request=n,e.onError&&e.onError(r)}}).catch(function(){e.onError&&e.onError(Error("Weirwood error SDK error code: network unavailable")),i._resetBackoff()})}var h=c.XMLHttpRequest&&new c.XMLHttpRequest;!h||("withCredentials"in h||"undefined"!=typeof XDomainRequest)&&("withCredentials"in h?h.onreadystatechange=function(){if(4!==h.readyState)return void i._resetBackoff();if(200===h.status)e.onSuccess&&e.onSuccess();else if(e.onError){i._resetBackoff();var n=Error("Weirwood error SDK error code: "+h.status);n.request=h,e.onError(n)}}:(h=new XDomainRequest,o=o.replace(/^https?:/,""),e.onSuccess&&(h.onload=e.onSuccess),e.onError&&(h.onerror=function(){var n=Error("Weirwood error SDK error code: XDomainRequest");n.request=h,e.onError(n)})),h.open("POST",o),s&&oO(s,function(e,n){h.setRequestHeader(e,n)}),h.send(oE(e.data)))},e.prototype._sanitizeData=function(e){var n=this.options.sanitizeKeys||[];if(n.length){if(!Array.isArray(n)||Array.isArray(n)&&0===n.length)return e;var r,i=oD(n);try{r=JSON.parse(oE(e))}catch(n){return e}return function e(n){return Array.isArray(n)?n.map(function(n){return e(n)}):i5(n)?Object.keys(n).reduce(function(r,o){return i.test(o)?r[o]="********":r[o]=e(n[o]),r},{}):n}(r)}return e},e.prototype.captureUserAgent=function(e){this._requestInfo=e},e.prototype.captureException=function(e,n){if(n||(n={trimHeadFrames:0,includePaths:[],mechanism:"generic",message:""}),iQ(e));else if(iZ(e))e=e.error;else if(i5(e))e=Error((n=this._getCaptureExceptionOptionsFromPlainObject(n,e)).message);else{if(r=e,"[object DOMException]"!==Object.prototype.toString.call(r))return this.captureMessage(e,iJ(iJ({},n),{stacktrace:!0,trimHeadFrames:n.trimHeadFrames+1}));var r,i=e.name||"DOMException",o=e.message?i+": "+e.message:i;return this.captureMessage(o,n)}try{n=iJ({trimHeadFrames:0,mechanism:"generic",includePaths:this.options.includePaths||[]},n);var s=od(e);this._handleStackInfo(s,n)}catch(n){if(e!==n)throw n}return this},e.prototype._isRepeatData=function(e){var n=this._lastData,r=e.exception,i=n?n.exception:{};return r.mechanism===i.mechanism&&r.type===i.type&&r.value===i.value&&r.url===i.url&&(0===r.stacktrace.length&&0===i.stacktrace.length||function(e,n){if(oA(e)&&oA(n)){var r,i,o=e.length;if(o!==n.length)return!1;for(var s=0;s<o;s++){if(r=e[s],i=n[s],r.filename!==i.filename||r.lineno!==i.lineno||r.colno!==i.colno||r.function!==i.function)return!1}return!0}return!1}(r.stacktrace,i.stacktrace))},e.prototype._resetBackoff=function(){this._currentExceptionStartTime=Date.now(),this._currentExceptionContext={}},e.prototype._setBackoffState=function(e){console.log(e)},e.prototype.captureMessage=function(e,n){void 0===n&&(n={});var r,i,o=this.options,s=o.ignoreErrors||[],a=o.ignoreKeys||[],c=o.whitelistUrls||[],d=o.ignoreUrls||[],l=o.ignoreJsUrls||[];if(!(s.length&&oB(s,e))){try{throw Error(e)}catch(e){i=e}var u=od(i),f=Array.isArray(u.stack)&&u.stack[1];(null==(r=null==f?void 0:f.func)?void 0:r.indexOf("captureException"))!==-1&&(f=u.stack[2]);var p=f&&f.url||"";if(!(d.length&&oB(d,window.location.href)||a.length&&oB(a,i.name)||l.length&&oB(l,p))&&(!c.length||oB(c,p))){n=iJ(iJ({},n),{trimHeadFrames:0,includePaths:o.includePaths}),n.trimHeadFrames+=1;var h=oL(u,n),m={exception:{mechanism:"manual",type:i.name,value:i.message,stacktrace:h.slice(1).reverse(),url:p}};return this._send(m),this}}},e.prototype.captureAPIException=function(e){var n,r=this,i=i9(),o=this.options,s=o.ignoreUrls,a=void 0===s?[]:s,c=o.ignoreApiUrls,d=void 0===c?[]:c,l=o.ignoreApiStatus,u=void 0===l?[]:l,f=o.buildid,p=o.token,h=o.version,m=o.apiWhitelistUrls;if(!(e.url&&e.method&&!i0(e.status)))return void console.error("API异常参数至少需要包含 method、url、status 参数。");if(!(a.length&&oB(a,i.location.href)||d.length&&oB(d,e.url))&&(!m.length||oB(m,e.url))&&(!u.length||-1===u.indexOf(Number(e.status)))){var v=iJ(iJ({},e),{type:"APIError"}),g={request:{headers:{"User-Agent":i.navigator.userAgent},url:i.location.href},exception:v,buildid:f,token:p,version:h||""},y=this.options;if(i1(y.dataCallback)&&(g=y.dataCallback(g)),!(!g||i6(g))){this.mergeGlobalContext(g);var b=this.options.issueGroupby;if((b&&i1(b)&&(n=b(g.exception)),n&&i2(n))?(g.fingerprint=n.substr(0,255),g.event_id=oR(g.fingerprint)):g.event_id=oR(e.method+"***"+function(e){if(!i2(e))return"";var n=e.split("?");return n[1]?(n[1]=n[1].replace(/\d+/g,"*").replace(/[\u4e00-\u9fa5]+/gi,"*"),n.join("?")):e}(e.url)),g.data_id=oR(oE(g)),this._lastAPIData!==g.data_id){this._lastAPIData=g.data_id;var _=function(){var e;((null==(e=r.options.globalOptions)?void 0:e.transport)||r._makeRequest).call(r,{url:r.options.endpoint,data:g,options:{},onSuccess:function(){},onError:function(){}})};"number"==typeof y.sampleRate?Math.random()<y.sampleRate&&_():_()}}}},e.prototype.captureEvent=function(){},e.prototype.afterLoad=function(){var e=i9().RavenConfig;e&&this.init(e)},e.prototype._getCaptureExceptionOptionsFromPlainObject=function(e,n){var r=Object.keys(n).sort(),i=iJ(iJ({},e),{message:"Non-Error exception captured with keys: "+function(e,n){if(void 0===n&&(n=40),i3(e)||i2(e))return e.toString();if(!i4(e))return"";if(0===(e=e.filter(function(e){return i2(e)})).length)return"[object has no keys]";if(n=i3(n)?n:40,e[0].length>=n)return e[0];for(var r=e.length;r>0;r--){var i=e.slice(0,r).join(", ");if(!(i.length>n)){if(r===e.length)return i;return i+"…"}}return""}(r),fingerprint:[oR(r.join(""))],env:e&&e.env||{}});return i.env.__serialized__=function e(n,r,i){if(void 0===r&&(r=3),void 0===i&&(i=51200),!i5(n))return n+"";var o=function e(n,r){return 0===r?ok(n):i5(n)?Object.keys(n).reduce(function(i,o){return i[o]=e(n[o],r-1),i},{}):Array.isArray(n)?n.map(function(n){return e(n,r-1)}):ok(n)}(n,r);return~-encodeURI(JSON.stringify(oE(o))).split(/%..|./).length>i?e(n,r-1):o}(n),i},e.prototype.captureBehavior=function(e){var n=iJ(iJ({},e),{timestamp:Date.now()/1e3});if(i1(this.options.breadcrumbCallback)){var r=this.options.breadcrumbCallback(n);if("object"!=typeof r||null===r||i6(r)){if(!1===r)return this}else n=r}return this._behaviors.push(n),this._behaviors.length>(this.options.behaviorLimit||10)&&this._behaviors.shift(),this},e.prototype.setContext=function(e,n){for(var r in void 0===n&&(n={persist:!0}),e)Reflect.has(e,r)&&(n.persist?this._globalContext.env[r]=e[r]:this._currentExceptionContext[r]=e[r])},e.prototype.clearContext=function(){this._globalContext.env={},this._currentExceptionContext={}},e.prototype._restoreBuiltIns=function(){for(var e;this._wrappedBuiltIns.length;){var n=(e=this._wrappedBuiltIns.shift())[0],r=e[1],i=e[2];n[r]=i}},e.prototype.noConflict=function(){},e.prototype.uninstall=function(){this.dispose()},e.prototype.dispose=function(){os(this._globalErrorHandler),this._restoreBuiltIns(),this._globalErrorHandler=null,this._installed=!1},e}(),o0={};function o1(){var e=window.crypto||window.msCrypto;if(void 0===e||!e.getRandomValues)return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)});var n=new Uint16Array(8);e.getRandomValues(n),n[3]=4095&n[3]|16384,n[4]=16383&n[4]|32768;var r=function(e){for(var n=e.toString(16);n.length<4;)n="0"+n;return n};return r(n[0])+r(n[1])+r(n[2])+r(n[3])+r(n[4])+r(n[5])+r(n[6])+r(n[7])}var o2=function(){function e(e){this.version="1.3.15",this.lastRouteTime=0,e&&this.init(e)}return e.prototype.init=function(e){var n,r,i,o,s=this.getSendWindow();if(!e.perf||e.perf&&!e.perf.disable){var a=iX(iX(iX({},e.perf),e.common),{version:this.version,sendWindow:s});this.perf=new i$.PerfClient(a)}if(!e.error||e.error&&!e.error.disable){var c=iX(iX(iX({},e.error),e.common),{version:this.version,sendWindow:s,uuid4:o1});this.error=new oZ(c)}this.routeChange(window.document.URL),n=this.routeChange.bind(this),"function"==typeof(r=window.history).pushState&&(i=r.pushState,r.pushState=function(e,r,o){return n(o),i.apply(this,arguments)}),"function"==typeof r.replaceState&&(o=r.replaceState,r.replaceState=function(e,r,i){return i!==window.document.URL&&n(i),o.apply(this,arguments)}),window.addEventListener("hashchange",function(e){n((e||{}).newURL)}),window.addEventListener("popstate",function(e){n(window.document.URL)})},e.prototype.routeChange=function(e){var n=new Date().getTime();if(n-this.lastRouteTime>100){this.lastRouteTime=n;var r=o1()+"-"+n;this.error&&this.error.setContext({pageId:r})}},e.prototype.getSendWindow=function(){var e="undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:o0;if(["fetch","ajax","sendBeacon"].some(function(e){var n;return!((n=window[e])&&n.toString&&!n.hasOwnProperty("toString")&&/\[native code\]/.test(String(n)))})&&document.body){var n=document.createElement("iframe");n.style.setProperty("display","none","important"),document.body.appendChild(n),e=n?n.contentWindow:e}return e},e.prototype.afterLoad=function(){},e}(),o3=((aQ={}).NO_API_SUPPORT="NO_API_SUPPORT",aQ.INSECURE_CONTEXT="INSECURE_CONTEXT",aQ.NO_DEVICE_FOUND="NO_DEVICE_FOUND",aQ.PERMISSION_DENIED="PERMISSION_DENIED",aQ.PERMISSION_DISMISSED="PERMISSION_DISMISSED",aQ.DEVICE_IN_USE="DEVICE_IN_USE",aQ.TIMEOUT="TIMEOUT",aQ.UNKNOWN_ERROR="UNKNOWN_ERROR",aQ);class o4{constructor(e={}){var n,r;this.mediaStream=null,this.options={timeout:null!=(n=e.timeout)?n:5e3,autoCleanup:null==(r=e.autoCleanup)||r}}cleanup(){this.mediaStream&&(this.mediaStream.getTracks().forEach(e=>{e.stop()}),this.mediaStream=null)}async checkAudioDevice(){try{return await this.withTimeout(this.performCheck(),this.options.timeout)}catch(e){if(e instanceof Error&&"TIMEOUT"===e.message)return this.createErrorResult("TIMEOUT","设备检测超时");return this.createErrorResult("UNKNOWN_ERROR",e instanceof Error?e.message:"未知错误")}finally{this.options.autoCleanup&&this.cleanup()}}async performCheck(){let e=this.checkAPISupport();if(!e.available)return e;let n=await this.checkDeviceEnumeration();if(!n.available)return n;let r=await this.checkPermissionState(),i=await this.checkMediaStream();return i.available?{available:!0,passedLevel:4,devices:n.devices,permissionState:r.permissionState,message:"音频设备可用"}:i}checkAPISupport(){return navigator.mediaDevices?navigator.mediaDevices.getUserMedia?"undefined"==typeof window||window.isSecureContext?{available:!0,passedLevel:1}:this.createErrorResult("INSECURE_CONTEXT","需要 HTTPS 环境才能访问麦克风 (localhost 除外)"):this.createErrorResult("NO_API_SUPPORT","浏览器不支持 getUserMedia API"):this.createErrorResult("NO_API_SUPPORT","浏览器不支持 navigator.mediaDevices API")}async checkDeviceEnumeration(){try{let e=(await navigator.mediaDevices.enumerateDevices()).filter(e=>"audioinput"===e.kind);if(0===e.length)return this.createErrorResult("NO_DEVICE_FOUND","系统中未找到音频输入设备");let n=e.some(e=>""!==e.deviceId);return{available:!0,passedLevel:2,devices:e,message:n?`找到 ${e.length} 个音频输入设备`:"找到设备但需要权限才能获取详细信息"}}catch(e){return this.createErrorResult("UNKNOWN_ERROR",`设备枚举失败: ${e instanceof Error?e.message:"未知错误"}`)}}async checkPermissionState(){try{if(!navigator.permissions||!navigator.permissions.query)return{available:!0,passedLevel:3,message:"浏览器不支持 Permissions API,跳过权限检查"};let e=await navigator.permissions.query({name:"microphone"});if("denied"===e.state)return this.createErrorResult("PERMISSION_DENIED","麦克风权限已被拒绝,请在浏览器设置中开启");return{available:!0,passedLevel:3,permissionState:e.state,message:`权限状态: ${e.state}`}}catch(e){return{available:!0,passedLevel:3,message:"Permissions API 检查失败,继续后续检测"}}}async checkMediaStream(){try{this.mediaStream=await navigator.mediaDevices.getUserMedia({audio:!0});let e=this.mediaStream.getAudioTracks();if(0===e.length)return this.createErrorResult("NO_DEVICE_FOUND","未能获取音频轨道");let n=e[0];if("live"!==n.readyState)return this.createErrorResult("DEVICE_IN_USE",`音频轨道状态异常: ${n.readyState}`);if(!n.enabled)return this.createErrorResult("DEVICE_IN_USE","音频轨道已被禁用");if(n.muted)return this.createErrorResult("DEVICE_IN_USE","音频轨道处于静音状态");return{available:!0,passedLevel:4,message:`成功获取音频流: ${n.label}`}}catch(e){if(e instanceof Error){if("NotAllowedError"===e.name||"PermissionDeniedError"===e.name)return this.createErrorResult("PERMISSION_DENIED","用户拒绝了麦克风权限请求");if("NotFoundError"===e.name||"DevicesNotFoundError"===e.name)return this.createErrorResult("NO_DEVICE_FOUND","未找到可用的音频输入设备");if("NotReadableError"===e.name||"TrackStartError"===e.name)return this.createErrorResult("DEVICE_IN_USE","设备正被其他程序占用或无法访问");if("AbortError"===e.name)return this.createErrorResult("PERMISSION_DISMISSED","权限请求被中止或超时")}return this.createErrorResult("UNKNOWN_ERROR",`获取音频流失败: ${e instanceof Error?e.message:"未知错误"}`)}}createErrorResult(e,n){return{available:!1,error:e,message:n}}withTimeout(e,n){return Promise.race([e,new Promise((e,r)=>{setTimeout(()=>r(Error("TIMEOUT")),n)})])}}async function o5(e){return new o4(e).checkAudioDevice()}let o6=e=>{let n={NO_API_SUPPORT:"您的浏览器不支持语音功能,请使用最新版 Chrome、Firefox 或 Edge 浏览器。",INSECURE_CONTEXT:"出于安全考虑,语音功能仅在 HTTPS 网站下可用。",NO_DEVICE_FOUND:"未检测到麦克风设备,请连接麦克风后重试。",PERMISSION_DENIED:"您已拒绝麦克风权限,请在浏览器设置中允许访问麦克风。",PERMISSION_DISMISSED:"麦克风权限请求已关闭,请刷新页面重新授权。",DEVICE_IN_USE:"麦克风正被其他程序占用,请关闭其他使用麦克风的应用后重试。",TIMEOUT:"设备检测超时,请检查网络连接或刷新页面重试。",UNKNOWN_ERROR:"发生未知错误,请刷新页面重试或联系技术支持。"};return n[e]||n.UNKNOWN_ERROR};function o8(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function o9(e,n){return function(r,i){n(r,i,e)}}(a0=(aZ=ci||(ci={})).EMessageType||(aZ.EMessageType={}))[a0.Query=0]="Query",a0[a0.Event=1]="Event";class o7{constructor(e,n,r){this.opts=e,this.signalingService=n,this.errorManager=r,this.disabled=!1,this.mutedByUser=!1,this.muted=!1,this.emitter=new nc,this.started=!1,this.lastCheckResult=null,this.lastCheckTime=0,this.CHECK_CACHE_TTL=5e3,this.mute=e=>{this.signalingService.Mute(e),this.muted=e},this.setMutedByUser=e=>{this.mutedByUser=e},this.tryUnmuteAsr=()=>!this.disabled&&!this.mutedByUser&&(this.muted&&this.mute(!1),!0),this.disable=()=>{this.disabled=!0},this.enable=()=>{this.disabled=!1},this.checkAudioDevice=async e=>{var n;let r=Date.now();if(!(null==e?void 0:e.forceCheck)&&(null==(n=this.lastCheckResult)?void 0:n.available)&&r-this.lastCheckTime<this.CHECK_CACHE_TTL)return this.lastCheckResult;let i=new o4(e),o=await i.checkAudioDevice();return this.lastCheckResult=o,this.lastCheckTime=r,await this.emitter.emit("device_check_completed",o),!o.available&&o.error&&this.errorManager.handleError(this.mapToAsrError(o)),o},this._stop=async()=>{this.started&&(await this.signalingService.Stop(),this.started=!1)},this._dispose=()=>{this.stop().finally(()=>{this.signalingService.Dispose()}).catch(rI),this.emitter.clearListeners(),this.lastCheckTime=0},this.mapToAsrError=e=>new({[o3.NO_API_SUPPORT]:ri,[o3.INSECURE_CONTEXT]:ro,[o3.NO_DEVICE_FOUND]:rn,[o3.PERMISSION_DENIED]:n9,[o3.PERMISSION_DISMISSED]:rs,[o3.DEVICE_IN_USE]:rr,[o3.TIMEOUT]:ra,[o3.UNKNOWN_ERROR]:n6})[e.error](e.message,{passedLevel:e.passedLevel,devices:e.devices,permissionState:e.permissionState})}get sessionId(){return this.started?this.signalingService.GetSessionID():null}}function se(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function st(e,n){return function(r,i){n(r,i,e)}}o7=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eg(),o9(0,eh(nl.IOptions)),o9(0,eS()),o9(1,eh(nl.SignalingService)),o9(2,eh(nl.ErrorManager)),o8("design:type",Function),o8("design:paramtypes",["undefined"==typeof IResolvedOptions?Object:IResolvedOptions,"undefined"==typeof BaseSignalingService?Object:BaseSignalingService,void 0===rT?Object:rT])],o7);class sn{static #F=this.GET_ACCESS_TOKEN_REQUEST_URI="employee-console/v1/access/r/ai-agent/get_digital_token";constructor(e,n,r){this.opts=e,this.request=n,this.errorManager=r,this.emitter=new nc,this._isRendering=!1,this._isMuted=!1,this._canInterrupt=!0,this.ssmlHandlers=[],this.token="",this.getAccessToken=async()=>{try{let{data:e}=await this.request.client.get(sn.GET_ACCESS_TOKEN_REQUEST_URI,{retry:3,timeout:15e3}).json();return e.authorization}catch(e){throw e instanceof Error&&this.errorManager.handleError(new rh(e.message)),e}}}get isRendering(){return this._isRendering}get isMuted(){return this._isMuted}get canInterrupt(){return this._canInterrupt}setIsRendering(e){this._isRendering=e}setIsMuted(e){this._isMuted=e}setCanInterrupt(e){this._canInterrupt=e}registerSSMLHandler(e){return this.ssmlHandlers.push(e),this}runSsmlHandlers(e){let n=e;for(let e of this.ssmlHandlers)n=e(n);return n}}sn=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eg(),st(0,eh(nl.IOptions)),st(1,eh(nl.CommonRequest)),st(2,eh(nl.ErrorManager)),se("design:type",Function),se("design:paramtypes",["undefined"==typeof IOptions?Object:IOptions,void 0===nW?Object:nW,void 0===rT?Object:rT])],sn);let sr=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:500;return new Promise(n=>setTimeout(n,e))};function si(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function so(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?si(Object(r),!0).forEach(function(n){sl(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):si(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ss(e){return(ss="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})(e)}function sa(e,n){if(!(e instanceof n))throw TypeError("Cannot call a class as a function")}function sc(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,su(i.key),i)}}function sd(e,n,r){return n&&sc(e.prototype,n),r&&sc(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function sl(e,n,r){return(n=su(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function su(e){var n=function(e,n){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,n||"default");if("object"!=typeof i)return i;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:String(n)}(co||(co={})).INIT="INIT";var sf=function(){function e(n){sa(this,e),sl(this,"iframeId",void 0),this.iframeId=n}return sd(e,[{key:"registerMessageReceived",value:function(e){void 0!==window.addEventListener&&"function"==typeof e&&window.addEventListener("message",e,!1)}},{key:"removeMessageReceived",value:function(e){void 0!==window.addEventListener&&window.removeEventListener("message",e,!1)}},{key:"sendMessageToIframe",value:function(e,n){if(this.iframeId){var r=document.getElementById(this.iframeId);e&&null!==r&&r.contentWindow.postMessage({type:e,content:n},"*")}else if(window.self!==window.top&&window&&window.parent&&window.parent.postMessage){var i=JSON.parse(JSON.stringify(n||{}));window.parent.postMessage({type:e,content:i},"*")}}},{key:"sendCommand",value:function(e){this.sendMessageToIframe("command",e)}},{key:"sendMessage",value:function(e){var n=e.requestId,r=void 0===n?rO():n;return this.sendMessageToIframe("message",so(so({},e),{},{requestId:r})),r}},{key:"textRender",value:function(e){return this.sendMessage({action:"TEXT_RENDER",body:e})}},{key:"textQuery",value:function(e){return this.sendMessage({action:"TEXT_QUERY",body:e})}},{key:"changeBackGround",value:function(e){return this.textRender("<display><background><type>image</type><source>http</source><value>".concat(e,"</value></background></display>"))}},{key:"mute",value:function(e){this.sendCommand({subType:"mute",subContent:e})}},{key:"muteAudio",value:function(e){this.sendCommand({subType:"muteAudio",subContent:e})}},{key:"muteRemoteAudio",value:function(e){this.sendCommand({subType:"muteRemoteAudio",subContent:e})}},{key:"playVideo",value:function(e){this.sendCommand({subType:"playVideo",subContent:e})}},{key:"sendAudioData",value:function(e){this.sendMessageToIframe("audioData",e)}},{key:"onStateUpdate",value:function(e){this.sendMessageToIframe("state",e)}},{key:"sendRtcState",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.sendMessageToIframe("rtcState",e)}},{key:"sendWsState",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.sendMessageToIframe("wsState",e)}}]),e}();sd(function e(n){sa(this,e),sl(this,"iframeId",void 0),sl(this,"namespace","dhIframeNameSpace"),sl(this,"listener",null),this.iframeId=n},[{key:"onEventListener",value:function(e){var n=this;return function(r){if("object"===ss(r.data))if("onListener"===r.data.type&&r.data.content.listenerId){var i=window[n.namespace][r.data.content.listenerId];null==i||i(r.data.content.data)}else"onListenerRemove"===r.data.type&&r.data.content.listenerId?delete window[n.namespace][r.data.content.listenerId]:r.data.listenerId?e(r.data,function(e){n.sendMessage("onListener",{listenerId:r.data.listenerId,data:e})},function(){n.sendMessage("onListenerRemove",{listenerId:r.data.listenerId})}):e(r.data)}}},{key:"registerMessageReceived",value:function(e){void 0!==window.addEventListener&&"function"==typeof e&&(this.listener=this.onEventListener(e),window.addEventListener("message",this.listener,!1))}},{key:"removeMessageReceived",value:function(){void 0!==window.addEventListener&&this.listener&&(window[this.namespace]=void 0,window.removeEventListener("message",this.listener,!1))}},{key:"sendMessage",value:function(e,n,r){var i=this;if(this.iframeId){var o="";r&&(o=rO(),window[this.namespace]||(window[this.namespace]={}),window[this.namespace][o]=r);var s=document.getElementById(this.iframeId);return e&&null!==s&&s.contentWindow.postMessage({type:e,content:n,listenerId:o},"*"),function(){o&&(window[i.namespace][o]=void 0)}}if(window.self!==window.top&&window&&window.parent&&window.parent.postMessage){var a=JSON.parse(JSON.stringify(n||{}));window.parent.postMessage({type:e,content:a},"*")}}},{key:"textRender",value:function(e,n){return this.sendMessage("TEXT_RENDER",e,n)}},{key:"textMTRender",value:function(e,n){return this.sendMessage("TEXT_MT_RENDER",e,n)}},{key:"audioRender",value:function(e,n){return this.sendMessage("AUDIO_RENDER",e,n)}},{key:"textQuery",value:function(e,n){return this.sendMessage("TEXT_QUERY",e,n)}},{key:"startAudioQuery",value:function(e,n){return this.sendMessage("AUDIO_QUERY_START",e,n)}},{key:"stopAudioQuery",value:function(){return this.sendMessage("AUDIO_QUERY_STOP",{})}},{key:"setModelPackage",value:function(e,n){return this.sendMessage("SET_MODEL_URLS",{urls:e,needInitConfig:n})}},{key:"changeCamera",value:function(e){return this.sendMessage("CHANGE_CAMERA",e)}},{key:"changeParts",value:function(e){return this.sendMessage("CHANGE_PARTS",e)}},{key:"setRenderConfig",value:function(e){return this.sendMessage("SET_RENDER_CONFIG",e)}},{key:"animojiRender",value:function(e,n){return this.sendMessage("ANIMOJI_RENDER",e,n)}},{key:"destroy",value:function(){return this.sendMessage("DESTROY",{})}},{key:"startAudioRender",value:function(e,n){return this.sendMessage("AUDIO_RENDER_START",e,n)}},{key:"stopAudioRender",value:function(){return this.sendMessage("AUDIO_RENDER_STOP",{})}},{key:"interrupt",value:function(){return this.sendMessage("INTERRUPT",{})}},{key:"load",value:function(e){return this.sendMessage("LOAD",e)}},{key:"onStateUpdate",value:function(e){this.sendMessage("state",e)}}]);class sp extends sn{get ready(){return!!this.iframeController&&!!this.token}constructor(...e){super(...e),this.origin="https://open.xiling.baidu.com",this.iframeId=rO(),this.iframeController=null,this.iframe=null,this.$iframeContainer=null,this.requestId=rO(),this.isWSConnected=!1,this.isRtcReady=!1,this.silenceMessageRequestIds=[],this.isStreamTextRendering=!1,this.wsClosedCount=0,this.mount=async e=>{if(!e)return void this.errorManager.handleError(new rd("容器元素不能为空"));if(this.$iframeContainer=e,this.iframe){e.contains(this.iframe)||e.appendChild(this.iframe);return}this.opts.enableDebugMode&&"development"===this.opts.env&&!this.opts.token?this.token=await this.getAccessToken():this.token=this.opts.token,this.iframe=document.createElement("iframe"),this.applyOptions(),e.appendChild(this.iframe),this.iframeController=new sf(this.iframeId),this.bindEvents()},this.bindEvents=()=>{var e,n;return this.ready&&(null==(e=this.iframe)||e.addEventListener("error",this.onIFrameErrorHandler),null==(n=this.iframeController)||n.registerMessageReceived(this.onMessageHandler)),this},this.unbindEvents=()=>{var e,n;return this.ready&&(null==(e=this.iframe)||e.removeEventListener("error",this.onIFrameErrorHandler),null==(n=this.iframeController)||n.removeMessageReceived(this.onMessageHandler)),this},this.cancelMute=()=>{var e;null==(e=this.iframeController)||e.sendCommand({subType:"muteAudio",subContent:!1}),setTimeout(()=>{this._isMuted=!1},1500)},this.muteHuman=()=>{var e;null==(e=this.iframeController)||e.sendCommand({subType:"muteAudio",subContent:!0}),setTimeout(()=>{this._isMuted=!0},1500)},this.play=async()=>{var e;null==(e=this.iframeController)||e.sendCommand({subType:"playVideo",subContent:!0})},this.pause=()=>{var e;null==(e=this.iframeController)||e.sendCommand({subType:"playVideo",subContent:!1})},this.renderPlainText=e=>{var n;if(!this.ready)return this;let r=this.runSsmlHandlers(e);return this.refreshRequestId(),null==(n=this.iframeController)||n.sendMessage({action:"TEXT_RENDER",body:r,requestId:this.requestId}),this},this.renderStreamText=(e,n)=>{var r,i,o;if(!this.ready)return this;let s=this.runSsmlHandlers(e);return n?(this.isStreamTextRendering||this.refreshRequestId(),null==(i=this.iframeController)||i.sendMessage({action:"TEXT_STREAM_RENDER",body:JSON.stringify({first:!this.isStreamTextRendering,last:!0,text:s}),requestId:this.requestId}),this.isStreamTextRendering=!1):this.isStreamTextRendering?null==(r=this.iframeController)||r.sendMessage({action:"TEXT_STREAM_RENDER",body:JSON.stringify({first:!1,last:!1,text:s}),requestId:this.requestId}):(this.refreshRequestId(),this.isStreamTextRendering=!0,null==(o=this.iframeController)||o.sendMessage({action:"TEXT_STREAM_RENDER",body:JSON.stringify({first:!0,last:!1,text:s}),requestId:this.requestId})),this},this.interrupt=()=>{var e;return this.ready&&(null==(e=this.iframeController)||e.sendMessage({action:"TEXT_RENDER",body:"<interrupt></interrupt>",requestId:this.requestId}),this.isRendering||this.onRenderFinished(this.requestId)),this},this.sendSilenceMessage=()=>{var e;if(!this.ready)return this;let n=rO();return null==(e=this.iframeController)||e.sendMessage({action:"TEXT_RENDER",body:"",requestId:n}),this.silenceMessageRequestIds.push(n),this.emitter.emit("send_silence_message",{requestId:n}).catch(rI),this},this.dispose=()=>{if(this.unbindEvents(),this.silenceMessageRequestIds=[],this.ssmlHandlers=[],this.wsClosedCount=0,this.isStreamTextRendering=!1,this.emitter.clearListeners(),this.iframe){var e;null==(e=this.$iframeContainer)||e.removeChild(this.iframe),this.iframe=null,this.iframeController=null}return this},this.GetRequestId=()=>this.requestId,this.checkIsReady=()=>{let e=this.isWSConnected&&this.isRtcReady;return e&&this.emitter.emit("ready").catch(rI),e},this.onIFrameErrorHandler=e=>{let n=new rl(`数字人iframe加载失败: ${e.message}`,{context:{method:"onIFrameErrorHandler",iframeId:this.iframeId,filename:e.filename,lineno:e.lineno,colno:e.colno,type:e.type,target:e.target}});this.errorManager.handleError(n)},this.onMessageHandler=e=>{if(e.origin!==this.origin)return;let n=e.data;switch(n.type){case"msg":this.onReceiveMsgTypedMessageHandler(n);break;case"rtcState":this.onReceiveRtcStateTypedMessageHandler(n);break;case"wsState":this.onReceiveWsStateTypedMessageHandler(n)}},this.onReceiveMsgTypedMessageHandler=e=>{let n=e.content.requestId;if((1004===e.content.code||3001===e.content.code)&&(this.emitter.emit("reach_session_limit",{requestId:n}).catch(rI),this.errorManager.handleError(new rm("资源配额已用尽,请联系技术支持申请扩容"))),["RENDER_START","FINISHED","DOWN_SUBTITLE","RENDER_INTERRUPTED","DOWN_SUBTITLE","TEXT_RENDER","TEXT_STREAM_RENDER"].includes(e.content.action)){if(n!==this.requestId)return;switch(e.content.action){case"RENDER_START":this._isRendering=!0,this.emitter.emit("is_rendering_change",!0).catch(rI);break;case"FINISHED":case"RENDER_INTERRUPTED":this.onRenderFinished(n);break;case"DOWN_SUBTITLE":{let r=JSON.parse(e.content.body);this.silenceMessageRequestIds.includes(n)?this.silenceMessageRequestIds=this.silenceMessageRequestIds.filter(e=>e!==n):this.emitter.emit("render_subtitle",{subtitle:r,requestId:n}).catch(rI);break}case"TEXT_RENDER":case"TEXT_STREAM_RENDER":0!==e.content.code&&this.onRenderFinished(n)}return}switch(e.content.action){case"RENDER_ERROR":this.onRenderFinished(n),this.errorManager.handleError(new ru("数字员工文本驱动渲染失败,请确认配置后重试",{requestId:n,context:{msg:e.content.message}}));break;case"DISCONNECT_ALERT":this.emitter.emit("disconnect_alert",{requestId:n}).catch(rI);break;case"TIMEOUT_EXIT":this.onRenderFinished(n),this.emitter.emit("timeout",{requestId:e.content.requestId}).catch(rI)}},this.onReceiveRtcStateTypedMessageHandler=e=>{if(e.content.action,"localVideoMuted"===e.content.action&&e.content.body&&(this._isMuted=!0),"remotevideoon"===e.content.action&&(this.isRtcReady=!0,this.checkIsReady(),this.iframe&&(this.iframe.style.opacity="1")),"error"===e.content.action){let n="string"==typeof e.content.body?e.content.body:"";this.errorManager.handleError(new rp("RTC 房间连接失败,请检查网络后重试"+n))}},this.onReceiveWsStateTypedMessageHandler=e=>{1===e.content.readyState?(this.isWSConnected=!0,this.wsClosedCount=0,this.checkIsReady()):(3===e.content.readyState||2===e.content.readyState)&&(this.isWSConnected=!1),3===e.content.readyState&&(this.wsClosedCount++,this.wsClosedCount>=3&&(this.emitter.emit("reconnect_failed").catch(rI),this.errorManager.handleError(new rf("检测到 Websocket 链接异常断开,如长时间无法恢复,请联系技术支持。"))))},this.applyOptions=()=>{var e,n,r,i,o,s,a,c,d,l,u,f,p,h;if(!this.iframe)return;this.iframe.id=this.iframeId,this.iframe.allow="autoplay",this.iframe.style.border="none",this.iframe.style.opacity="0",this.iframe.style.pointerEvents="none",this.iframe.style.overflow="hidden";let m=null!=(o=null==(e=this.opts)?void 0:e.scaleX)?o:1,v=null!=(s=null==(n=this.opts)?void 0:n.scaleY)?s:1,g=null!=(a=null==(r=this.opts)?void 0:r.translateX)?a:0,y=null!=(c=null==(i=this.opts)?void 0:i.translateY)?c:0;this.iframe.style.width=`${100*m}% `,this.iframe.style.height=`${100*v}%`,this.iframe.style.transform=`translate(${g}px, ${y}px)`;let b=new URLSearchParams(Object.entries({figureId:this.opts.figureId,ttsPer:this.opts.ttsPer,initMode:"noAudio","cp-inactiveDisconnectSec":null!=(d=this.opts.timeoutSec)?d:130,"cp-preAlertSec":null!=(l=this.opts.disconnectAlertSec)?l:10,mode:"crop",resolutionWidth:null!=(u=this.opts.figureResolutionWidth)?u:1920,resolutionHeight:null!=(f=this.opts.figureResolutionHeight)?f:1080,ttsSpeed:null!=(p=this.opts.speechSpeed)?p:6,"cp-ttsSample":this.opts.ttsSample,"cp-minSplitLen":this.opts.minSplitLen,"cp-ttsModel":this.opts.ttsModel,"cp-positionV2":JSON.stringify(this.opts.position),"cp-ttsLang":rq(this.opts.lang),autoChromaKey:this.opts.autoChromaKey,closeLog:null==(h=this.opts.enableDebugMode)||h,token:this.token}).filter(e=>{let[,n]=e;return null!=n&&""!==n}).reduce((e,n)=>{let[r,i]=n;return e[r]=String(i),e},{})).toString();this.iframe.src=`${this.origin}/cloud/realtime?${b}`},this.refreshRequestId=()=>{this.requestId=rO()},this.onRenderFinished=e=>{this._isRendering=!1,this.isStreamTextRendering=!1,this.emitter.emit("is_rendering_change",!1).catch(rI),this.refreshRequestId(),this.emitter.emit("render_finished",{requestId:e}).catch(rI)}}}function sh(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function sm(e,n){return function(r,i){n(r,i,e)}}sp=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eg(),eb()],sp);class sv{static #F=this.ENTRY_EMITTER_NAME="AaaSPilotKitEmitter";constructor(e,n,r,i,o,s){this.opts=e,this.errorManager=n,this.agentService=r,this.asrService=i,this.digitalHumanService=o,this.conversationService=s,this.interruptible=!0,this.isRenderingMultiModConversation=!1,this.isDigitalHumanServiceReady=!1,this.isAsrServiceReady=!1,this.lastReplyStartRequestId=null,this.aiWorkerMessageCache=null,this.multiModAbortControllers=[],this.playWaitForListener=null,this.mount=async e=>{var n,r;let i=null!=e?e:null==(n=(r=this.opts).getMountContainer)?void 0:n.call(r);i&&(await Promise.all([this.digitalHumanService.mount(i),this.asrService.preloadDeps()]),this.asrService.start(),this.isAsrServiceReady=!0,this.checkServiceReady())},this.getOptions=()=>this.opts,this.checkNeedsManualActivation=()=>n3()||n4(),this.activateManually=async()=>{if(this.digitalHumanService instanceof sp){let e,n;this.digitalHumanService.cancelMute(),n=(e=new(n1())).getUA(),("WeChat"===e.getBrowser().name||/MicroMessenger/i.test(n))&&(n3()||n4())&&await sr(500)}},this.keepAlive=()=>(this.digitalHumanService.sendSilenceMessage(),this),this.playWaitFor=async(e,n)=>(this.playWaitForListener&&this.digitalHumanService.emitter.off("render_finished",this.playWaitForListener),this.digitalHumanService.isRendering)?await new Promise(r=>{this.playWaitForListener=()=>{n&&!n()?r(!1):(this.digitalHumanService.renderPlainText(e),this.playWaitForListener&&this.digitalHumanService.emitter.off("render_finished",this.playWaitForListener),r(!0))},this.digitalHumanService.emitter.on("render_finished",this.playWaitForListener)}):(this.digitalHumanService.renderPlainText(e),!0),this.playFromFullText=e=>(this.digitalHumanService.renderPlainText(e),this),this.playFromStreamText=(e,n)=>(this.digitalHumanService.renderStreamText(e,n),this),this.mute=e=>(this.asrService.setMutedByUser(e),this.emitter.emit("mute",e).catch(rI),e?(this.asrService.mute(!0),this.conversationService.currentClientConversation&&this.query(this.conversationService.currentClientConversation.text,!0).catch(rI)):this.asrService.muted&&this.asrService.mute(!1),this),this.interrupt=()=>(this.interruptAIWorkerConversation(),this),this.playPrologue=()=>{this.opts.prologue&&this.opts.prologue.length>0?this.playFromFullText(this.opts.prologue):this.agentService.query("").catch(rI)},this.query=async(e,n)=>{if(this.checkServiceReady()){if(this.agentService.sessionId||this.agentService.setSessionId(rO()),this.digitalHumanService.sendSilenceMessage(),this.agentService.queryId||this.agentService.setQueryId(rO()),n){if(this.agentService.checkIsRepeat())return;this.agentService.setLastQueryId(this.agentService.queryId)}if(await this.emitter.emit("asr_message",{text:e,completed:n,id:this.agentService.queryId,sessionId:this.agentService.sessionId}),await this.handleClientConversation(e),n){this.asrService.mute(!0);let n=async()=>{this.agentService.setQueryId(""),this.digitalHumanService.canInterrupt&&(this.asrService.tryUnmuteAsr(),await this.emitter.emit("asr_start"),this.digitalHumanService.emitter.off("render_subtitle",n))};this.digitalHumanService.emitter.on("render_subtitle",n);let r=async()=>{this.agentService.setQueryId(""),this.asrService.tryUnmuteAsr(),await this.emitter.emit("asr_start"),this.digitalHumanService.emitter.off("render_finished",r)};this.digitalHumanService.emitter.on("render_finished",r),this.handleClientConversationCompleted(),await this.agentService.query(e)}}},this.input=e=>(this.digitalHumanService.isRendering&&!this.interruptible||this.query(e,!0).catch(rI),this),this.dispose=()=>(this.agentService.dispose(),this.asrService.dispose(),this.digitalHumanService.dispose(),this.conversationService.dispose(),this.emitter.clearListeners(),this.isDigitalHumanServiceReady=!1,this.isAsrServiceReady=!1,this.aiWorkerMessageCache=null,this.isRenderingMultiModConversation=!1,this.multiModAbortControllers=[],this.lastReplyStartRequestId=null,this),this.setInterruptible=e=>(this.interruptible=e,this),this.checkAudioDevice=async e=>this.asrService.checkAudioDevice(e),this.bindAsrServiceEvents=()=>{this.asrService.emitter.on("start",this.handleAsrServiceStarted),this.asrService.emitter.on("message",this.handleAsrMessage),this.asrService.emitter.on("device_check_completed",this.handleDeviceCheckCompleted)},this.bindAgentServiceEvents=()=>{this.agentService.emitter.on("data",this.handleAgentAnswer),this.agentService.emitter.on("completed",this.handleAgentAnswerCompleted),this.agentService.emitter.on("instruction_received",this.handleAgentInstructionReceived),this.agentService.emitter.on("usage_quota_reached",async e=>{await this.emitter.emit("busy",{...e})})},this.bindDigitalHumanServiceEvents=()=>{this.digitalHumanService.bindEvents(),this.digitalHumanService.emitter.once("ready").then(()=>{this.isDigitalHumanServiceReady=!0,this.checkServiceReady()}),this.digitalHumanService.emitter.on("render_subtitle",this.aiWorkerSubtitleToConversation),this.digitalHumanService.emitter.on("is_rendering_change",e=>{this.emitter.emit("is_rendering_change",e).catch(rI)}),this.digitalHumanService.emitter.on("render_subtitle",async e=>{await this.emitter.emit("render_start",{...e,sessionId:this.agentService.sessionId,queryId:this.agentService.queryId});let{requestId:n}=e;if(n!==this.lastReplyStartRequestId){this.lastReplyStartRequestId=n;let e=this.agentService.getResponseManager().getLastResponse();this.emitter.emit("reply_start",{agentResponse:e}).catch(rI)}}),this.digitalHumanService.emitter.on("disconnect_alert",e=>{let n=this.digitalHumanService.emitter.on("render_finished",()=>{this.asrService.mute(!0),this.emitter.emit("inactivity",e).catch(rI),n()}),r=this.digitalHumanService.emitter.on("send_silence_message",()=>{n(),r()});this.playFromFullText(this.opts.inactivityPrompt)}),this.digitalHumanService.emitter.on("reach_session_limit",async e=>{this.isDigitalHumanServiceReady&&this.isAsrServiceReady&&await this.emitter.emit("busy",{...e})}),this.digitalHumanService.emitter.on("reconnect_failed",async()=>{await this.emitter.emit("busy",{requestId:"reconnect_failed"})});let e=this.digitalHumanService.emitter.on("render_finished",()=>{this.asrService.tryUnmuteAsr(),e()})},this.bindErrorEvents=()=>{this.errorManager.on(e=>{let n=this.errorManager.createMonitoringError(e);this.emitter.emit("error",e).catch(rI);try{this.weirwood.error.captureException(n)}catch(e){console.error(e)}})},this.bindEvents=()=>{this.bindErrorEvents(),this.bindAsrServiceEvents(),this.bindAgentServiceEvents(),this.bindDigitalHumanServiceEvents()},this.registerFormatters=()=>{var e,n;let r=null!=(e=this.opts.speechFormatters)?e:[],i=null!=(n=this.opts.conversationFormatters)?n:[];for(let e of r)this.digitalHumanService.registerSSMLHandler(e);for(let e of i)this.conversationService.registerAIWorkerConversationFormatter(e)},this.aiWorkerSubtitleToConversation=async e=>{let n=e.subtitle;if(this.isRenderingMultiModConversation)return;let r=this.conversationService;await this.createNewAIWorkerConversation();let i=r.currentAIWorkerConversation;i&&this.handleAIWorkerConversationChange(i);let o=r.runAIWorkerConversationFormatters(n.content);null==i||i.appendText(o),n.completed&&r.setCurrentConversation(null)},this.handleAgentAnswer=e=>{let{answer:n}=e;iL.isXml(n)?this.handleXmlAgentAnswer(e).catch(rI):(this.aiWorkerMessageCache&&this.playFromStreamText(this.aiWorkerMessageCache,!1),this.aiWorkerMessageCache=n)},this.handleXmlAgentAnswer=async e=>{let{answer:n}=e,r=this.conversationService;await this.createNewAIWorkerConversation();let i=r.currentAIWorkerConversation;if(!i)return;let o=()=>{this.emitter.emit("conversation_change",{...i.toJSON(),text:i.fulltext,completed:!1})};i.emitter.on("content_change",o),this.isRenderingMultiModConversation=!0;let s=r.runAIWorkerConversationFormatters(n),a=i.createContentsFromXmlString(s),c=new AbortController;for(let e of(this.multiModAbortControllers.push(c),a)){if(c.signal.aborted){i.emitter.off("content_change",o);break}if(iU.isTextContent(e)){let n=e.getConfig().content;this.playFromFullText(n),await this.digitalHumanService.emitter.once("render_subtitle")}i.addContentRenderTask(e),i.contents.push(e),await i.emitter.once("queue_empty")}this.isRenderingMultiModConversation=!1,i.emitter.off("content_change",o),await this.emitter.emit("conversation_change",{...i.toJSON(),text:i.fulltext,completed:!0})},this.createNewAIWorkerConversation=async()=>{let e=this.conversationService;if(!e.currentAIWorkerConversation){let n=iU.create(this.opts);e.setCurrentConversation(n),e.add(n),await this.emitter.emit("conversation_add",n)}},this.handleAgentAnswerCompleted=async()=>{if(this.aiWorkerMessageCache){this.playFromStreamText(this.aiWorkerMessageCache,!0),this.aiWorkerMessageCache=null;return}this.agentService.setQueryId(""),this.asrService.tryUnmuteAsr(),await this.emitter.emit("asr_start")},this.handleAgentInstructionReceived=e=>{this.emitter.emit("instruction_received",e).catch(rI)},this.handleAsrServiceStarted=async()=>{await sr(800),this.asrService.mute(!0),this.interruptible&&this.emitter.once("render_start").then(()=>{this.asrService.tryUnmuteAsr()})},this.handleAsrMessage=async e=>{this.digitalHumanService.isRendering&&!this.digitalHumanService.canInterrupt||this.asrService.mutedByUser||e.type===ci.EMessageType.Query&&(this.opts.enableDebugMode&&console.log("message",e,this.agentService.sessionId,Date.now()),await this.query(rN(e.data,this.opts.hotWordReplacementRules),e.completed))},this.handleDeviceCheckCompleted=async e=>{await this.emitter.emit("microphone_available",{available:e.available,error:e.error,userMessage:e.error?o6(e.error):void 0,devices:e.devices,permissionState:e.permissionState})},this.handleClientConversation=async e=>{let n=this.conversationService;if(!n.currentClientConversation){let e=rG.create(this.opts);n.setCurrentConversation(e),n.add(e),await this.emitter.emit("conversation_add",e)}let r=n.currentClientConversation;(this.digitalHumanService.isRendering||this.isRenderingMultiModConversation)&&this.interruptAIWorkerConversation(),null==r||r.appendText(e)},this.handleClientConversationCompleted=()=>{this.conversationService.setCurrentConversation(null)},this.interruptAIWorkerConversation=()=>{for(let e of(this.aiWorkerMessageCache&&this.digitalHumanService.renderStreamText(this.aiWorkerMessageCache,!0),this.multiModAbortControllers))e.abort();this.multiModAbortControllers=[];let e=this.digitalHumanService.GetRequestId();this.digitalHumanService.interrupt(),this.conversationService.interruptAll(),this.agentService.abort(),this.aiWorkerMessageCache=null,this.emitter.emit("interrupt",{requestId:e,queryId:this.agentService.queryId?this.agentService.queryId:this.agentService.lastQueryId,sessionId:this.agentService.sessionId}).catch(rI)},this.checkServiceReady=()=>!!this.isDigitalHumanServiceReady&&!!this.isAsrServiceReady&&(this.emitter.emit("ready").catch(rI),!0),this.handleAIWorkerConversationChange=e=>{let n=r=>{this.emitter.emit("conversation_change",{...e.toJSON(),text:e.fulltext,completed:r.completed}).catch(rI),r.completed&&e.emitter.off("content_change",n)},r=()=>{e.emitter.off("interrupt",r),e.emitter.off("content_change",n)};e.emitter.on("content_change",n),e.emitter.on("interrupt",r)},this.weirwood=new o2({common:{buildid:"AAAS_PILOT_KIT_1.0.0",token:"8f3abab4743f4114bd632999224323af"},error:{collectWindowErrors:!1,collectUnhandledRejections:!1,collectResourceLoadErrors:!1,ignoreUrls:["localhost","127.0.0.1"]},perf:{disable:!0}}),this.emitter=new nc(this.opts.enableDebugMode?{debug:{name:sv.ENTRY_EMITTER_NAME,enabled:!0}}:void 0),this.bindEvents(),this.registerFormatters(),this.interruptible=this.opts.interruptible}}sv=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eg(),sm(0,eh(nl.IOptions)),sm(0,eS()),sm(1,eh(nl.ErrorManager)),sm(2,eh(nl.AgentService)),sm(3,eh(nl.ASRService)),sm(4,eh(nl.DigitalHumanService)),sm(5,eh(nl.ConversationService)),sh("design:type",Function),sh("design:paramtypes",["undefined"==typeof IResolvedOptions?Object:IResolvedOptions,void 0===rT?Object:rT,"undefined"==typeof AS?Object:AS,void 0===o7?Object:o7,void 0===sn?Object:sn,void 0===iq?Object:iq])],sv);let sg=[239,187,191],sy=e=>async(n,r,i)=>{if(!i.ok||!i.body)return;let o=!1,s=n=>{var r;o||(o=!0,null==(r=e.onCompleted)||r.call(e,n))},a=i.body.getReader(),c=new TextDecoder("utf8"),d=function(e){let n,r,i,o,s,a,c;return d(),{feed:function(d){var l;r=r?r+d:d,n&&(l=r,sg.every((e,n)=>l.charCodeAt(n)===e))&&(r=r.slice(sg.length)),n=!1;let u=r.length,f=0,p=!1;for(;f<u;){let n;p&&("\n"===r[f]&&++f,p=!1);let d=-1,l=o;for(let e=i;d<0&&e<u;++e)":"===(n=r[e])&&l<0?l=e-f:"\r"===n?(p=!0,d=e-f):"\n"===n&&(d=e-f);if(d<0){i=u-f,o=l;break}i=0,o=-1,function(n,r,i,o){if(0===o){c.length>0&&(e({type:"event",id:s,event:a||void 0,data:c.slice(0,-1)}),c="",s=void 0),a=void 0;return}let d=i<0,l=n.slice(r,r+(d?o:i)),u=0;u=d?o:" "===n[r+i+1]?i+2:i+1;let f=r+u,p=o-u,h=n.slice(f,f+p).toString();if("data"===l)c+=h?"".concat(h,"\n"):"\n";else if("event"===l)a=h;else if("id"!==l||h.includes("\0")){if("retry"===l){let n=parseInt(h,10);Number.isNaN(n)||e({type:"reconnect-interval",value:n})}}else s=h}(r,f,l,d),f+=d+1}f===u?r="":f>0&&(r=r.slice(f))},reset:d};function d(){n=!0,r="",i=0,o=-1,s=void 0,a=void 0,c=""}}(n=>{var r,i,o;if("event"===n.type&&(null==(r=e.onMessage)||r.call(e,n)),"event"===n.type&&n.data)for(let r of(null==(i=e.onEvent)||i.call(e,n),n.data.split("\n")))e.onData(r);else"reconnect-interval"===n.type&&(null==(o=e.onReconnectInterval)||o.call(e,n.value))}),l=()=>{a.read().then(e=>{e.done?s():(d.feed(c.decode(e.value,{stream:!0})),l())}).catch(r=>{var i;if(n.signal.aborted){null==(i=e.onAborted)||i.call(e);return}s(r)})};return l(),i};(ca=(cs=cp||(cp={})).EAiobAction||(cs.EAiobAction={}))[ca.silence=1]="silence",ca[ca.Interrupt=2]="Interrupt",ca[ca.Hangup=3]="Hangup",(cc=cs.EResponseType||(cs.EResponseType={}))[cc.Welcome=1]="Welcome",cc[cc.Normal=2]="Normal",cc[cc.Command=3]="Command",cc[cc.TakeOver=4]="TakeOver",(cd=cs.ETextType||(cs.ETextType={}))[cd.unit=0]="unit",cd[cd.llm=1]="llm";class sb extends rD{static #F=this.REQUEST_URI="aicc-service/aiob-server/text/stream/query2";constructor(...e){super(...e),this.query=async e=>{this.abortController=new AbortController;let n=sy({onData:e=>{try{let n=JSON.parse(e);this.onResponse(n);let{answer:r,sessionId:i,action:o}=n;if(i&&(this.conversationSessionId=i),o===cp.EAiobAction.Hangup)return void this.onHangup({sessionId:this.conversationSessionId});r&&this.onData({sessionId:this.conversationSessionId,answer:r})}catch(e){e instanceof Error&&this.errorManager.handleError(new nY(e.message,{sessionId:this.conversationSessionId}))}},onCompleted:()=>{this.onCompleted({sessionId:this.conversationSessionId})}}),r=this.opts.agentConfig;if(!(null==r?void 0:r.robotId))return void this.errorManager.handleError(new nK(`调用 Agent API ${sb.REQUEST_URI} 时必须传入 robotId 参数,请确认后重试。`));let i={query:e,sessionId:this.conversationSessionId,robotId:r.robotId,isComplete:1,queryId:this.queryId};try{var o;await this.request.client.post(sb.REQUEST_URI,{retry:0,timeout:3e5,signal:null==(o=this.abortController)?void 0:o.signal,hooks:{afterResponse:[n]},json:{...i}})}catch(e){e instanceof nL?this.onTimeout({sessionId:this.conversationSessionId}):e instanceof Error&&this.errorManager.handleError(new nQ(e.message,{sessionId:this.conversationSessionId}))}},this.hangup=async()=>{let e=this.opts.agentConfig;if(!(null==e?void 0:e.robotId))return void await this.errorManager.handleError(new nK(`调用 Agent API ${sb.REQUEST_URI} 时必须传入 robotId 参数,请确认后重试。`));let n={query:"",robotId:e.robotId,sessionId:this.conversationSessionId,action:cp.EAiobAction.Hangup,isComplete:1};try{await this.request.client.post(sb.REQUEST_URI,{retry:0,timeout:3e5,json:{...n},keepalive:!0})}catch(e){e instanceof Error&&this.errorManager.handleError(new nQ(e.message,{sessionId:this.conversationSessionId}))}},this.dispose=()=>{this._dispose(),this.hangup().finally(()=>{this.conversationSessionId=""})}}}sb=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eg(),eb()],sb),(cu=(cl=ch||(ch={})).EReplyType||(cl.EReplyType={}))[cu.PlainText=1]="PlainText",cu[cu.RichText=3]="RichText",cu[cu.Image=4]="Image",cu[cu.List=8]="List",cl.REPLY_TYPE_MAPPING={1:"plainText",3:"richText",8:"list",4:"image"};class s_ extends rD{static #F=this.REQUEST_URI="csp-service/online/core/v5/stream/query";constructor(...e){super(...e),this.query=async e=>{var n,r;this.abortController=new AbortController;let i=sy({onData:e=>{try{var n,r;let i=JSON.parse(e);this.onResponse(i);let o=i.answer[0],s=null!=(r=null==(n=o.reply)?void 0:n.text)?r:"";o&&s?this.onData({sessionId:this.conversationSessionId,answer:s}):o&&o.instruction&&(function(e){if("object"!=typeof e||null===e||"[object Object]"!==Object.prototype.toString.call(e))return!1;let n=Object.getPrototypeOf(e);return null===n||!!(Object.prototype.hasOwnProperty.call(n,"constructor")&&"function"==typeof n.constructor)&&Function.prototype.toString.call(n.constructor)===Function.prototype.toString.call(Object)}(o.instruction)?this.onInstructionReceived({sessionId:this.conversationSessionId,instruction:o.instruction}):this.errorManager.handleError(new nZ("指令格式非法,请检查后重试",{sessionId:this.conversationSessionId})))}catch(e){e instanceof Error&&this.errorManager.handleError(new nY(e.message,{sessionId:this.conversationSessionId}))}},onCompleted:()=>{this.onCompleted({sessionId:this.conversationSessionId})}});this.conversationSessionId||(this.conversationSessionId=rO());let o=null==(n=this.opts.agentConfig)?void 0:n.token;if(!o)return void this.errorManager.handleError(new nK(`调用 Agent API ${s_.REQUEST_URI} 时必须传入 token 参数,请确认后重试。`));let s={query:e,sessionId:this.conversationSessionId};try{await this.request.client.post(s_.REQUEST_URI,{headers:{token:o},retry:0,timeout:3e5,signal:null==(r=this.abortController)?void 0:r.signal,hooks:{afterResponse:[i]},json:{...s}})}catch(e){e instanceof nL?this.onTimeout({sessionId:this.conversationSessionId}):e instanceof Error&&this.errorManager.handleError(new nQ(e.message,{sessionId:this.conversationSessionId}))}},this.dispose=()=>{this._dispose()}}}function sw(e,n){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,n)}function sS(e,n){return function(r,i){n(r,i,e)}}s_=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eg(),eb()],s_);class sR{constructor(e,n){this.opts=e,this.errorManager=n,this.started=!1,this.sessionId="",this._dispose=()=>{this.started=!1,this.sessionId=""}}}sR=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eg(),sS(0,eh(nl.IOptions)),sS(0,eS()),sS(1,eh(nl.ErrorManager)),sw("design:type",Function),sw("design:paramtypes",["undefined"==typeof IResolvedOptions?Object:IResolvedOptions,void 0===rT?Object:rT])],sR);let sT=e=>{if(e)return"string"==typeof e?e:e.id};class sC extends sR{static #F=this.ONLINE_PREFIX_URL="https://ky.cloud.baidu.com/employee-console";static #eh=this.SANDBOX_PREFIX_URL="https://ai.agent.kaywang.cn/api";static #eK=this.AUTH_URL="https://ky.cloud.baidu.com/employee-console/v1/access/r/ai-agent/get-authorization";get prefixUrl(){return"production"===this.opts.env?sC.ONLINE_PREFIX_URL:sC.SANDBOX_PREFIX_URL}loginBRTC(e){if("function"!=typeof window.BRTC_Start)throw Error("BRTC_Start global function is missing. Ensure baidu.rtc.sdk.js is loaded.");let n={aspublisher:!0,usingdatachannel:!0,usingvideo:!1,usingaudio:!0,showvideobps:!1,autosubscribe:!0,autoplaymuted:!1,autopublish:!0,showspinner:!1,shownovideo:!1,userevent:!0,sessionevent:!0,logintimeout:1e4,linkdownevent:rI,linkupevent:rI,logintimeoutevent:rI,mediastate:rI,remotevideoon:rI,remotevideooff:rI,remotevideocoming:rI,remotevideoloading:rI,remotevideoconnected_state:rI,remotevideoleaving:rI,remotevideounpublished:rI,localvideoconnected_state:rI,localvideopublished_ok:rI,destroyed:rI,onlocalstream:rI,onlocalstream_end:rI,remotevideo_closed:rI,onmessage:e.onmessage,userevent_joinedroom:e.userevent_joinedroom,userevent_leavingroom:e.userevent_leavingroom,remotemediastating:e.remotemediastating,remotevideoviewid:sT(e.remotevideoviewid),localvideoviewid:sT(e.localvideoviewid)};window.BRTC_Start({...n,...e})}constructor(...e){super(...e),this.currentAppId="",this.Start=async e=>{var n,r,i,o,s;this.currentAppId=this.opts.rtcID;let a=this.prefixUrl,c={};"production"===this.opts.env&&(c.authorization=await this.getAuthToken("/api/v1/aiagent/generateAIAgentCall"));let d="production"===this.opts.env?"/v1/open/ai-agent/generateAIAgentCall":"/v1/aiagent/generateAIAgentCall",l=await nV.post(`${a}${d}`,{json:{app_id:this.currentAppId,quick_start:!0,config:JSON.stringify({...e.cfg})},headers:c}).json();if(!l.ai_agent_instance_id)throw Error("ai_agent_instance_id missing in response");this.started=!0,this.sessionId=l.ai_agent_instance_id;let u=this.sessionId,f=null!=(s=null==(n=l.context)?void 0:n.token)?s:"";(null==(r=l.context)?void 0:r.uid)&&(u=l.context.uid),(null==(i=l.context)?void 0:i.appid)&&(this.currentAppId=l.context.appid),this.loginBRTC({...e,appid:this.currentAppId,roomname:this.sessionId,userid:u,token:f}),null==(o=e.success)||o.call(e)},this.Stop=async()=>{if(this.started){this.started=!1;try{let e=this.prefixUrl,n={};"production"===this.opts.env&&(n.authorization=await this.getAuthToken("/api/v1/aiagent/stopAIAgentInstance"));let r="production"===this.opts.env?"/v1/open/ai-agent/stopAIAgentInstance":"/v1/aiagent/stopAIAgentInstance";await nV.post(`${e}${r}`,{json:{app_id:this.currentAppId,ai_agent_instance_id:this.sessionId},headers:n})}catch(e){if(e instanceof nu)throw Error(`stopAIAgentInstance failed (${e.response.status})`);throw e}"function"==typeof window.BRTC_Stop&&window.BRTC_Stop()}},this.Mute=e=>{"function"==typeof window.BRTC_MuteMicphone&&window.BRTC_MuteMicphone(e)},this.GetSessionID=()=>this.sessionId,this.Dispose=()=>{this._dispose()},this.getAuthToken=async e=>{try{let{data:n}=await nV.post(sC.AUTH_URL,{json:{http_method:"POST",path:e,headers:{host:"rtc-aiagent.baidubce.com"}}}).json();return n}catch(e){if(e instanceof nu)throw Error(`getAuthToken failed (${e.response.status})`);throw e}}}}sC=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eg(),eb()],sC),r("../../node_modules/baidurtc/dist/baidu.rtc.sdk.js");let sx=!0,sE=!0;function sO(e,n,r){let i=e.match(n);return i&&i.length>=r&&parseFloat(i[r],10)}function sI(e,n,r){if(!e.RTCPeerConnection)return;let i=e.RTCPeerConnection.prototype,o=i.addEventListener;i.addEventListener=function(e,i){if(e!==n)return o.apply(this,arguments);let s=e=>{let n=r(e);n&&(i.handleEvent?i.handleEvent(n):i(n))};return this._eventMap=this._eventMap||{},this._eventMap[n]||(this._eventMap[n]=new Map),this._eventMap[n].set(i,s),o.apply(this,[e,s])};let s=i.removeEventListener;i.removeEventListener=function(e,r){if(e!==n||!this._eventMap||!this._eventMap[n]||!this._eventMap[n].has(r))return s.apply(this,arguments);let i=this._eventMap[n].get(r);return this._eventMap[n].delete(r),0===this._eventMap[n].size&&delete this._eventMap[n],0===Object.keys(this._eventMap).length&&delete this._eventMap,s.apply(this,[e,i])},Object.defineProperty(i,"on"+n,{get(){return this["_on"+n]},set(e){this["_on"+n]&&(this.removeEventListener(n,this["_on"+n]),delete this["_on"+n]),e&&this.addEventListener(n,this["_on"+n]=e)},enumerable:!0,configurable:!0})}function sk(e){return"boolean"!=typeof e?Error("Argument type: "+typeof e+". Please use a boolean."):(sx=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function sM(e){return"boolean"!=typeof e?Error("Argument type: "+typeof e+". Please use a boolean."):(sE=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function sP(){"object"==typeof window&&(sx||"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments))}function sj(e,n){sE&&console.warn(e+" is deprecated, please use "+n+" instead.")}function sA(e){return"[object Object]"===Object.prototype.toString.call(e)}function sD(e,n,r){let i=r?"outbound-rtp":"inbound-rtp",o=new Map;if(null===n)return o;let s=[];return e.forEach(e=>{"track"===e.type&&e.trackIdentifier===n.id&&s.push(e)}),s.forEach(n=>{e.forEach(r=>{r.type===i&&r.trackId===n.id&&function e(n,r,i){!r||i.has(r.id)||(i.set(r.id,r),Object.keys(r).forEach(o=>{o.endsWith("Id")?e(n,n.get(r[o]),i):o.endsWith("Ids")&&r[o].forEach(r=>{e(n,n.get(r),i)})}))}(e,r,o)})}),o}function sB(e,n){let r=e&&e.navigator;if(!r.mediaDevices)return;let i=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;let n={};return Object.keys(e).forEach(r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;let i="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);let o=function(e,n){return e?e+n.charAt(0).toUpperCase()+n.slice(1):"deviceId"===n?"sourceId":n};if(void 0!==i.ideal){n.optional=n.optional||[];let e={};"number"==typeof i.ideal?(e[o("min",r)]=i.ideal,n.optional.push(e),(e={})[o("max",r)]=i.ideal):e[o("",r)]=i.ideal,n.optional.push(e)}void 0!==i.exact&&"number"!=typeof i.exact?(n.mandatory=n.mandatory||{},n.mandatory[o("",r)]=i.exact):["min","max"].forEach(e=>{void 0!==i[e]&&(n.mandatory=n.mandatory||{},n.mandatory[o(e,r)]=i[e])})}),e.advanced&&(n.optional=(n.optional||[]).concat(e.advanced)),n},o=function(e,o){if(n.version>=61)return o(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){let n=function(e,n,r){n in e&&!(r in e)&&(e[r]=e[n],delete e[n])};n((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),n(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=i(e.audio)}if(e&&"object"==typeof e.video){let s=e.video.facingMode;s=s&&("object"==typeof s?s:{ideal:s});let a=n.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&!(r.mediaDevices.getSupportedConstraints&&r.mediaDevices.getSupportedConstraints().facingMode&&!a)){let n;if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?n=["back","rear"]:("user"===s.exact||"user"===s.ideal)&&(n=["front"]),n)return r.mediaDevices.enumerateDevices().then(r=>{let a=(r=r.filter(e=>"videoinput"===e.kind)).find(e=>n.some(n=>e.label.toLowerCase().includes(n)));return!a&&r.length&&n.includes("back")&&(a=r[r.length-1]),a&&(e.video.deviceId=s.exact?{exact:a.deviceId}:{ideal:a.deviceId}),e.video=i(e.video),sP("chrome: "+JSON.stringify(e)),o(e)})}e.video=i(e.video)}return sP("chrome: "+JSON.stringify(e)),o(e)},s=function(e){return n.version>=64?e:{name:({PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"})[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=(function(e,n,i){o(e,e=>{r.webkitGetUserMedia(e,n,e=>{i&&i(s(e))})})}).bind(r),r.mediaDevices.getUserMedia){let e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(n){return o(n,n=>e(n).then(e=>{if(n.audio&&!e.getAudioTracks().length||n.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException("","NotFoundError");return e},e=>Promise.reject(s(e))))}}}function sN(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function sL(e){if("object"!=typeof e||!e.RTCPeerConnection||"ontrack"in e.RTCPeerConnection.prototype)sI(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e));else{Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});let n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=n=>{n.stream.addEventListener("addtrack",r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===r.track.id):{track:r.track};let o=new Event("track");o.track=r.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[n.stream],this.dispatchEvent(o)}),n.stream.getTracks().forEach(r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===r.id):{track:r};let o=new Event("track");o.track=r,o.receiver=i,o.transceiver={receiver:i},o.streams=[n.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),n.apply(this,arguments)}}}function sU(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){let n=function(e,n){return{track:n,get dtmf(){return void 0===this._dtmf&&("audio"===n.kind?this._dtmf=e.createDTMFSender(n):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};let r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){let o=r.apply(this,arguments);return o||(o=n(this,e),this._senders.push(o)),o};let i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.apply(this,arguments);let n=this._senders.indexOf(e);-1!==n&&this._senders.splice(n,1)}}let r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(n(this,e))})};let i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach(e=>{let n=this._senders.find(n=>n.track===e);n&&this._senders.splice(this._senders.indexOf(n),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){let n=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){let e=n.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function sF(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){let n=e.RTCPeerConnection.prototype.getSenders;n&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=n.apply(this,[]);return e.forEach(e=>e._pc=this),e});let r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){let e=this;return this._pc.getStats().then(n=>sD(n,e.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){let n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=n.apply(this,[]);return e.forEach(e=>e._pc=this),e}),sI(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){let e=this;return this._pc.getStats().then(n=>sD(n,e.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype))return;let n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){let e,n,r,i=arguments[0];return(this.getSenders().forEach(n=>{n.track===i&&(e?r=!0:e=n)}),this.getReceivers().forEach(e=>(e.track===i&&(n?r=!0:n=e),e.track===i)),r||e&&n)?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):e?e.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return n.apply(this,arguments)}}function sH(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};let n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return n.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};let i=n.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};let r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(n=>n.track===e))throw new DOMException("Track already exists.","InvalidAccessError")});let n=this.getSenders();r.apply(this,arguments);let i=this.getSenders().filter(e=>-1===n.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(i)};let i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};let o=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(n=>{let r=this._shimmedLocalStreams[n].indexOf(e);-1!==r&&this._shimmedLocalStreams[n].splice(r,1),1===this._shimmedLocalStreams[n].length&&delete this._shimmedLocalStreams[n]}),o.apply(this,arguments)}}function sq(e,n){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&n.version>=65)return sH(e);let r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){let e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};let i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(n){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.getTracks().forEach(e=>{if(this.getSenders().find(n=>n.track===e))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[n.id]){let r=new e.MediaStream(n.getTracks());this._streams[n.id]=r,this._reverseStreams[r.id]=n,n=r}i.apply(this,[n])};let o=e.RTCPeerConnection.prototype.removeStream;function s(e,n){let r=n.sdp;return Object.keys(e._reverseStreams||[]).forEach(n=>{let i=e._reverseStreams[n],o=e._streams[i.id];r=r.replace(RegExp(o.id,"g"),i.id)}),new RTCSessionDescription({type:n.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},o.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(n,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");let i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find(e=>e===n))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(e=>e.track===n))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};let o=this._streams[r.id];if(o)o.addTrack(n),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{let i=new e.MediaStream([n]);this._streams[r.id]=i,this._reverseStreams[i.id]=r,this.addStream(i)}return this.getSenders().find(e=>e.track===n)},["createOffer","createAnswer"].forEach(function(n){let r=e.RTCPeerConnection.prototype[n];e.RTCPeerConnection.prototype[n]=({[n](){let e=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?r.apply(this,[n=>{let r=s(this,n);e[0].apply(null,[r])},n=>{e[1]&&e[1].apply(null,n)},arguments[2]]):r.apply(this,arguments).then(e=>s(this,e))}})[n]});let a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){var e,n;let r;return arguments.length&&arguments[0].type?(arguments[0]=(e=this,n=arguments[0],r=n.sdp,Object.keys(e._reverseStreams||[]).forEach(n=>{let i=e._reverseStreams[n],o=e._streams[i.id];r=r.replace(RegExp(i.id,"g"),o.id)}),new RTCSessionDescription({type:n.type,sdp:r})),a.apply(this,arguments)):a.apply(this,arguments)};let c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){let e=c.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){let n;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(e._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach(r=>{this._streams[r].getTracks().find(n=>e.track===n)&&(n=this._streams[r])}),n&&(1===n.getTracks().length?this.removeStream(this._reverseStreams[n.id]):n.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function sV(e,n){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&n.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(n){let r=e.RTCPeerConnection.prototype[n];e.RTCPeerConnection.prototype[n]=({[n](){return arguments[0]=new("addIceCandidate"===n?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}})[n]})}function sz(e,n){sI(e,"negotiationneeded",e=>{let r=e.target;if(!(n.version<72)&&(!r.getConfiguration||"plan-b"!==r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e})}function sG(e,n){let r=e&&e.navigator,i=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,n,i){sj("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(n,i)},!(n.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){let e=function(e,n,r){n in e&&!(r in e)&&(e[r]=e[n],delete e[n])},n=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(e((r=JSON.parse(JSON.stringify(r))).audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),n(r)},i&&i.prototype.getSettings){let n=i.prototype.getSettings;i.prototype.getSettings=function(){let r=n.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(i&&i.prototype.applyConstraints){let n=i.prototype.applyConstraints;i.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(e(r=JSON.parse(JSON.stringify(r)),"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),n.apply(this,[r])}}}}function sW(e,n){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!(r&&r.video)){let e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:n}:r.video.mediaSource=n,e.navigator.mediaDevices.getUserMedia(r)})}function sX(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function s$(e,n){if("object"!=typeof e||!(e.RTCPeerConnection||e.mozRTCPeerConnection))return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),n.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(n){let r=e.RTCPeerConnection.prototype[n];e.RTCPeerConnection.prototype[n]=({[n](){return arguments[0]=new("addIceCandidate"===n?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}})[n]});let r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){let[e,o,s]=arguments;return i.apply(this,[e||null]).then(e=>{if(n.version<53&&!o)try{e.forEach(e=>{e.type=r[e.type]||e.type})}catch(n){if("TypeError"!==n.name)throw n;e.forEach((n,i)=>{e.set(i,Object.assign({},n,{type:r[n.type]||n.type}))})}return e}).then(o,s)}}function sJ(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;let n=e.RTCPeerConnection.prototype.getSenders;n&&(e.RTCPeerConnection.prototype.getSenders=function(){let e=n.apply(this,[]);return e.forEach(e=>e._pc=this),e});let r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){let e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function sK(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender)||e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;let n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){let e=n.apply(this,[]);return e.forEach(e=>e._pc=this),e}),sI(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function sY(e){!e.RTCPeerConnection||"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){sj("removeStream","removeTrack"),this.getSenders().forEach(n=>{n.track&&e.getTracks().includes(n.track)&&this.removeTrack(n)})})}function sQ(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function sZ(e){if(!("object"==typeof e&&e.RTCPeerConnection))return;let n=e.RTCPeerConnection.prototype.addTransceiver;n&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]);let r=(e=[...e]).length>0;r&&e.forEach(e=>{if("rid"in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw RangeError("max_framerate must be >= 0.0")});let i=n.apply(this,arguments);if(r){let{sender:n}=i,r=n.getParameters();"encodings"in r&&(1!==r.encodings.length||0!==Object.keys(r.encodings[0]).length)||(r.encodings=e,n.sendEncodings=e,this.setParametersPromises.push(n.setParameters(r).then(()=>{delete n.sendEncodings}).catch(()=>{delete n.sendEncodings})))}return i})}function s0(e){if(!("object"==typeof e&&e.RTCRtpSender))return;let n=e.RTCRtpSender.prototype.getParameters;n&&(e.RTCRtpSender.prototype.getParameters=function(){let e=n.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function s1(e){if(!("object"==typeof e&&e.RTCPeerConnection))return;let n=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>n.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):n.apply(this,arguments)}}function s2(e){if(!("object"==typeof e&&e.RTCPeerConnection))return;let n=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>n.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):n.apply(this,arguments)}}function s3(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){let n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(r=>n.call(this,r,e)),e.getVideoTracks().forEach(r=>n.call(this,r,e))},e.RTCPeerConnection.prototype.addTrack=function(e,...r){return r&&r.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),n.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);let n=this._localStreams.indexOf(e);if(-1===n)return;this._localStreams.splice(n,1);let r=e.getTracks();this.getSenders().forEach(e=>{r.includes(e.track)&&this.removeTrack(e)})})}}function s4(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);let n=new Event("addstream");n.stream=e,this.dispatchEvent(n)})})}});let n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){let e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(n){n.streams.forEach(n=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(n)>=0)return;e._remoteStreams.push(n);let r=new Event("addstream");r.stream=n,e.dispatchEvent(r)})}),n.apply(e,arguments)}}}function s5(e){if("object"!=typeof e||!e.RTCPeerConnection)return;let n=e.RTCPeerConnection.prototype,r=n.createOffer,i=n.createAnswer,o=n.setLocalDescription,s=n.setRemoteDescription,a=n.addIceCandidate;n.createOffer=function(e,n){let i=arguments.length>=2?arguments[2]:arguments[0],o=r.apply(this,[i]);return n?(o.then(e,n),Promise.resolve()):o},n.createAnswer=function(e,n){let r=arguments.length>=2?arguments[2]:arguments[0],o=i.apply(this,[r]);return n?(o.then(e,n),Promise.resolve()):o};let c=function(e,n,r){let i=o.apply(this,[e]);return r?(i.then(n,r),Promise.resolve()):i};n.setLocalDescription=c,n.setRemoteDescription=c=function(e,n,r){let i=s.apply(this,[e]);return r?(i.then(n,r),Promise.resolve()):i},n.addIceCandidate=function(e,n,r){let i=a.apply(this,[e]);return r?(i.then(n,r),Promise.resolve()):i}}function s6(e){let n=e&&e.navigator;if(n.mediaDevices&&n.mediaDevices.getUserMedia){let e=n.mediaDevices,r=e.getUserMedia.bind(e);n.mediaDevices.getUserMedia=e=>r(s8(e))}!n.getUserMedia&&n.mediaDevices&&n.mediaDevices.getUserMedia&&(n.getUserMedia=(function(e,r,i){n.mediaDevices.getUserMedia(e).then(r,i)}).bind(n))}function s8(e){return e&&void 0!==e.video?Object.assign({},e,{video:function e(n){return sA(n)?Object.keys(n).reduce(function(r,i){let o=sA(n[i]),s=o?e(n[i]):n[i],a=o&&!Object.keys(s).length;return void 0===s||a?r:Object.assign(r,{[i]:s})},{}):n}(e.video)}):e}function s9(e){if(!e.RTCPeerConnection)return;let n=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){let n=[];for(let r=0;r<e.iceServers.length;r++){let i=e.iceServers[r];void 0===i.urls&&i.url?(sj("RTCIceServer.url","RTCIceServer.urls"),(i=JSON.parse(JSON.stringify(i))).urls=i.url,delete i.url,n.push(i)):n.push(e.iceServers[r])}e.iceServers=n}return new n(e,r)},e.RTCPeerConnection.prototype=n.prototype,"generateCertificate"in n&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>n.generateCertificate})}function s7(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function ae(e){let n=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);let n=this.getTransceivers().find(e=>"audio"===e.receiver.track.kind);!1===e.offerToReceiveAudio&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveAudio||n||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);let r=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video",{direction:"recvonly"})}return n.apply(this,arguments)}}function at(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var an=r("../../node_modules/sdp/sdp.js"),ar=r.n(an);function ai(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;let n=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substring(2)),e.candidate&&e.candidate.length){let r=new n(e),i=ar().parseCandidate(e.candidate);for(let e in i)e in r||Object.defineProperty(r,e,{value:i[e]});return r.toJSON=function(){return{candidate:r.candidate,sdpMid:r.sdpMid,sdpMLineIndex:r.sdpMLineIndex,usernameFragment:r.usernameFragment}},r}return new n(e)},e.RTCIceCandidate.prototype=n.prototype,sI(e,"icecandidate",n=>(n.candidate&&Object.defineProperty(n,"candidate",{value:new e.RTCIceCandidate(n.candidate),writable:"false"}),n))}function ao(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||sI(e,"icecandidate",e=>{if(e.candidate){let n=ar().parseCandidate(e.candidate.candidate);"relay"===n.type&&(e.candidate.relayProtocol=({0:"tls",1:"tcp",2:"udp"})[n.priority>>24])}return e})}function as(e,n){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});let r=function(e){if(!e||!e.sdp)return!1;let n=ar().splitSections(e.sdp);return n.shift(),n.some(e=>{let n=ar().parseMLine(e);return n&&"application"===n.kind&&-1!==n.protocol.indexOf("SCTP")})},i=function(e){let n=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===n||n.length<2)return -1;let r=parseInt(n[1],10);return r!=r?-1:r},o=function(e){let r=65536;return"firefox"===n.browser&&(r=n.version<57?-1===e?16384:0x7ffffff5:n.version<60?57===n.version?65535:65536:0x7ffffff5),r},s=function(e,r){let i=65536;"firefox"===n.browser&&57===n.version&&(i=65535);let o=ar().matchPrefix(e.sdp,"a=max-message-size:");return o.length>0?i=parseInt(o[0].substring(19),10):"firefox"===n.browser&&-1!==r&&(i=0x7ffffff5),i},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===n.browser&&n.version>=76){let{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){let e,n=i(arguments[0]),r=o(n),a=s(arguments[0],n);e=0===r&&0===a?1/0:0===r||0===a?Math.max(r,a):Math.min(r,a);let c={};Object.defineProperty(c,"maxMessageSize",{get:()=>e}),this._sctp=c}return a.apply(this,arguments)}}function aa(e){if(!(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype))return;function n(e,n){let r=e.send;e.send=function(){let i=arguments[0],o=i.length||i.size||i.byteLength;if("open"===e.readyState&&n.sctp&&o>n.sctp.maxMessageSize)throw TypeError("Message too large (can send a maximum of "+n.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}let r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){let e=r.apply(this,arguments);return n(e,this),e},sI(e,"datachannel",e=>(n(e.channel,e.target),e))}function ac(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;let n=e.RTCPeerConnection.prototype;Object.defineProperty(n,"connectionState",{get(){return({completed:"connected",checking:"connecting"})[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(n,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{let r=n[e];n[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{let n=e.target;if(n._lastConnectionState!==n.connectionState){n._lastConnectionState=n.connectionState;let r=new Event("connectionstatechange",e);n.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}})}function ad(e,n){if(!e.RTCPeerConnection||"chrome"===n.browser&&n.version>=71||"safari"===n.browser&&n._safariVersion>=13.1)return;let r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(n){if(n&&n.sdp&&-1!==n.sdp.indexOf("\na=extmap-allow-mixed")){let r=n.sdp.split("\n").filter(e=>"a=extmap-allow-mixed"!==e.trim()).join("\n");e.RTCSessionDescription&&n instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:n.type,sdp:r}):n.sdp=r}return r.apply(this,arguments)}}function al(e,n){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;let r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===n.browser&&n.version<78||"firefox"===n.browser&&n.version<68||"safari"===n.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function au(e,n){if(!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype))return;let r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return r.apply(this,arguments);if(!(e={type:e.type,sdp:e.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}return e.sdp||"offer"!==e.type&&"answer"!==e.type?r.apply(this,[e]):("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then(e=>r.apply(this,[e]))})}let af=function({window:e}={},n={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){let r=function(e){let n={browser:null,version:null};if(void 0===e||!e.navigator||!e.navigator.userAgent)return n.browser="Not a browser.",n;let{navigator:r}=e;if(r.userAgentData&&r.userAgentData.brands){let e=r.userAgentData.brands.find(e=>"Chromium"===e.brand);if(e)return{browser:"chrome",version:parseInt(e.version,10)}}return r.mozGetUserMedia?(n.browser="firefox",n.version=parseInt(sO(r.userAgent,/Firefox\/(\d+)\./,1))):r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection?(n.browser="chrome",n.version=parseInt(sO(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2))):e.RTCPeerConnection&&r.userAgent.match(/AppleWebKit\/(\d+)\./)?(n.browser="safari",n.version=parseInt(sO(r.userAgent,/AppleWebKit\/(\d+)\./,1)),n.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype,n._safariVersion=sO(r.userAgent,/Version\/(\d+(\.?\d+))/,1)):n.browser="Not a supported browser.",n}(e),i={browserDetails:r,commonShim:R,extractVersion:sO,disableLog:sk,disableWarnings:sM,sdp:an};switch(r.browser){case"chrome":if(!_||!sV||!n.shimChrome){sP("Chrome shim is not included in this adapter release.");break}if(null===r.version){sP("Chrome shim can not determine version, not shimming.");break}sP("adapter.js shimming chrome."),i.browserShim=_,al(e,r),au(e,r),sB(e,r),sN(e,r),sV(e,r),sL(e,r),sq(e,r),sU(e,r),sF(e,r),sz(e,r),ai(e,r),ao(e,r),ac(e,r),as(e,r),aa(e,r),ad(e,r);break;case"firefox":if(!w||!s$||!n.shimFirefox){sP("Firefox shim is not included in this adapter release.");break}sP("adapter.js shimming firefox."),i.browserShim=w,al(e,r),au(e,r),sG(e,r),s$(e,r),sX(e,r),sY(e,r),sJ(e,r),sK(e,r),sQ(e,r),sZ(e,r),s0(e,r),s1(e,r),s2(e,r),ai(e,r),ac(e,r),as(e,r),aa(e,r);break;case"safari":if(!S||!n.shimSafari){sP("Safari shim is not included in this adapter release.");break}sP("adapter.js shimming safari."),i.browserShim=S,al(e,r),au(e,r),s9(e,r),ae(e,r),s5(e,r),s3(e,r),s4(e,r),s7(e,r),s6(e,r),at(e,r),ai(e,r),ao(e,r),as(e,r),aa(e,r),ad(e,r);break;default:sP("Unsupported browser!")}return i}({window:"undefined"==typeof window?void 0:window});(cf=cm||(cm={})).DEFAULT_BRTC_SDK_URL="https://brtc-sdk.cdn.bcebos.com/npm/baidurtc@1.2.19/baidu.rtc.sdk.js",cf.DEFAULT_BRTC_CLIENT_CONFIG={displayName:"AaaSPilot Kit",debugLevel:!1,rtcOptions:{},cfg:{tag:"H5.SDK",llm:"LLMMute",tts:"MUTE"},silenceTimeoutMs:1e4};let ap=e=>{if(e)return"string"==typeof e?e:e.id};class ah extends o7{static #F=this.MESSAGE_INTERVAL_THRESHOLD=5e3;preloadDeps(){if("undefined"==typeof window){let e="Window object not available";return this.errorManager.handleError(new n6(e)),Promise.reject(Error(e))}if(window.adapter||(window.adapter=null!=af?af:T),"function"!=typeof window.BRTC_Start){let e='RTC SDK not loaded. Ensure "baidurtc" is imported correctly.';return this.errorManager.handleError(new n6(e)),Promise.reject(Error(e))}return Promise.resolve()}makeStartOptions(){return{...cm.DEFAULT_BRTC_CLIENT_CONFIG,cfg:{...cm.DEFAULT_BRTC_CLIENT_CONFIG.cfg,asr_vad:this.opts.asrVad,lang:(e=>{if(!e)return rU[rH];let n=rU[e];return n||(console.warn(`[AaaSPilotKit] 不支持的语言代码 "${e}",已自动回退到中文。支持的语言:${Object.keys(rU).join(", ")}`),rU[rH])})(this.opts.lang)}}}parseMessage(e){let n=e.replace(/\[Q\]:?|\[M\]:?|\[C\]:?|\[A\]:?|\[H\]:?|\[E\]:?|\[B\]:?|\[T\]:?/g,"").trim(),r=ci.EMessageType.Event,i=!0,o=!1;return o=e.includes("VOICE_COMING"),e.includes("[Q]")&&(r=ci.EMessageType.Query),e.includes("[E]")&&(r=ci.EMessageType.Event),i=!e.includes("[M]"),{type:r,continued:e.includes("[C]"),data:n,completed:i,isCollectingSounds:o}}constructor(...e){super(...e),this.silenceTimer=null,this.lastMessageTime=0,this.messageIntervalTimer=null,this.start=async()=>{if(this.started)return;if(this.opts.checkAudioDeviceBeforeStart){let e=await this.checkAudioDevice();if(!e.available)throw new n6("音频设备检测失败,无法启动 ASR",{context:{checkResult:e}})}let{displayName:e,debugLevel:n,rtcOptions:{remoteVideoElement:r,localVideoElement:i},cfg:o,silenceTimeoutMs:s}=this.makeStartOptions();return new Promise((a,c)=>{this.signalingService.Start({debuglevel:n,cfg:o,displayname:e,remotevideoviewid:ap(r),localvideoviewid:ap(i),usingremotemediastate:!0,success:()=>{this.started=!0,this.emitter.emit("start",{sessionId:this.sessionId}).catch(rI),a()},error:e=>{this.errorManager.handleError(new rt(e||"",{sessionId:this.sessionId})),c(Error(e||""))},onmessage:e=>{try{let n=this.parseMessage(e.data);if(e.data.includes("VOICE_COMING")||(this.emitter.emitSerial("message",{...n,sessionId:this.sessionId}).catch(rI),this.checkMessageInterval(n)),0!==s){let r=""===n.data;(e.data.includes("[E]")||e.data.includes("VOICE_COMING"))&&r?this.triggerSilence():this.resetSilenceTimer()}}catch(e){e instanceof Error&&this.errorManager.handleError(new n7(e.message,{sessionId:this.sessionId}))}},userevent_joinedroom:(e,n,r)=>{this.emitter.emit("user_joined_room",{id:e,display:n,attribute:r,sessionId:this.sessionId})},userevent_leavingroom:(e,n)=>{this.emitter.emit("user_leaving_room",{id:e,display:n,sessionId:this.sessionId})},remotemediastating:(e,n,r)=>{this.emitter.emit("media_state_changed",{id:e,medium:n,on:r,sessionId:this.sessionId})}})})},this.stop=async()=>{try{await this._stop()}catch(e){e instanceof Error&&this.errorManager.handleError(new n8(e.message,{sessionId:this.sessionId}))}this.emitter.emit("stop",{sessionId:this.signalingService.GetSessionID()})},this.dispose=()=>{this._dispose(),this.silenceTimer&&(window.clearTimeout(this.silenceTimer),this.silenceTimer=null),this.messageIntervalTimer&&(window.clearTimeout(this.messageIntervalTimer),this.messageIntervalTimer=null),this.lastMessageTime=0},this.resetSilenceTimer=()=>{null!==this.silenceTimer&&window.clearTimeout(this.silenceTimer),this.silenceTimer=window.setTimeout(()=>{this.emitter.emit("silence",{sessionId:this.signalingService.GetSessionID()})},this.makeStartOptions().silenceTimeoutMs)},this.triggerSilence=()=>{this.emitter.emit("silence",{sessionId:this.signalingService.GetSessionID()}),this.resetSilenceTimer()},this.checkMessageInterval=e=>{let n=Date.now();if(e.completed){this.messageIntervalTimer&&(window.clearTimeout(this.messageIntervalTimer),this.messageIntervalTimer=null),this.lastMessageTime=0;return}if(0===this.lastMessageTime)this.lastMessageTime=n,this.messageIntervalTimer=window.setTimeout(()=>{this.errorManager.handleError(new re(`ASR消息间隔超过${ah.MESSAGE_INTERVAL_THRESHOLD}ms阈值`,{sessionId:this.sessionId,context:{lastMessageTime:this.lastMessageTime,currentTime:n,threshold:ah.MESSAGE_INTERVAL_THRESHOLD}}))},ah.MESSAGE_INTERVAL_THRESHOLD);else{let e=n-this.lastMessageTime;e>ah.MESSAGE_INTERVAL_THRESHOLD&&this.errorManager.handleError(new re(`ASR消息间隔${e}ms超过${ah.MESSAGE_INTERVAL_THRESHOLD}ms阈值`,{sessionId:this.sessionId,context:{lastMessageTime:this.lastMessageTime,currentTime:n,interval:e,threshold:ah.MESSAGE_INTERVAL_THRESHOLD}})),this.lastMessageTime=n,this.messageIntervalTimer&&window.clearTimeout(this.messageIntervalTimer),this.messageIntervalTimer=window.setTimeout(()=>{this.errorManager.handleError(new re(`ASR消息间隔超过${ah.MESSAGE_INTERVAL_THRESHOLD}ms阈值`,{sessionId:this.sessionId,context:{lastMessageTime:this.lastMessageTime,currentTime:Date.now(),threshold:ah.MESSAGE_INTERVAL_THRESHOLD}}))},ah.MESSAGE_INTERVAL_THRESHOLD)}}}}function am(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,i)}return r}function av(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?am(Object(r),!0).forEach(function(n){aT(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):am(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ag(){ag=function(){return n};var e,n={},r=Object.prototype,i=r.hasOwnProperty,o=Object.defineProperty||function(e,n,r){e[n]=r.value},s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",d=s.toStringTag||"@@toStringTag";function l(e,n,r){return Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[n]}try{l({},"")}catch(e){l=function(e,n,r){return e[n]=r}}function u(n,r,i,s){var a,c,d,l,u=Object.create((r&&r.prototype instanceof g?r:g).prototype);return o(u,"_invoke",{value:(a=n,c=i,d=new O(s||[]),l=p,function(n,r){if(l===h)throw Error("Generator is already running");if(l===m){if("throw"===n)throw r;return{value:e,done:!0}}for(d.method=n,d.arg=r;;){var i=d.delegate;if(i){var o=function n(r,i){var o=i.method,s=r.iterator[o];if(s===e)return i.delegate=null,"throw"===o&&r.iterator.return&&(i.method="return",i.arg=e,n(r,i),"throw"===i.method)||"return"!==o&&(i.method="throw",i.arg=TypeError("The iterator does not provide a '"+o+"' method")),v;var a=f(s,r.iterator,i.arg);if("throw"===a.type)return i.method="throw",i.arg=a.arg,i.delegate=null,v;var c=a.arg;return c?c.done?(i[r.resultName]=c.value,i.next=r.nextLoc,"return"!==i.method&&(i.method="next",i.arg=e),i.delegate=null,v):c:(i.method="throw",i.arg=TypeError("iterator result is not an object"),i.delegate=null,v)}(i,d);if(o){if(o===v)continue;return o}}if("next"===d.method)d.sent=d._sent=d.arg;else if("throw"===d.method){if(l===p)throw l=m,d.arg;d.dispatchException(d.arg)}else"return"===d.method&&d.abrupt("return",d.arg);l=h;var s=f(a,c,d);if("normal"===s.type){if(l=d.done?m:"suspendedYield",s.arg===v)continue;return{value:s.arg,done:d.done}}"throw"===s.type&&(l=m,d.method="throw",d.arg=s.arg)}})}),u}function f(e,n,r){try{return{type:"normal",arg:e.call(n,r)}}catch(e){return{type:"throw",arg:e}}}n.wrap=u;var p="suspendedStart",h="executing",m="completed",v={};function g(){}function y(){}function b(){}var _={};l(_,a,function(){return this});var w=Object.getPrototypeOf,S=w&&w(w(I([])));S&&S!==r&&i.call(S,a)&&(_=S);var R=b.prototype=g.prototype=Object.create(_);function T(e){["next","throw","return"].forEach(function(n){l(e,n,function(e){return this._invoke(n,e)})})}function C(e,n){var r;o(this,"_invoke",{value:function(o,s){function a(){return new n(function(r,a){!function r(o,s,a,c){var d=f(e[o],e,s);if("throw"!==d.type){var l=d.arg,u=l.value;return u&&"object"==typeof u&&i.call(u,"__await")?n.resolve(u.__await).then(function(e){r("next",e,a,c)},function(e){r("throw",e,a,c)}):n.resolve(u).then(function(e){l.value=e,a(l)},function(e){return r("throw",e,a,c)})}c(d.arg)}(o,s,r,a)})}return r=r?r.then(a,a):a()}})}function x(e){var n={tryLoc:e[0]};1 in e&&(n.catchLoc=e[1]),2 in e&&(n.finallyLoc=e[2],n.afterLoc=e[3]),this.tryEntries.push(n)}function E(e){var n=e.completion||{};n.type="normal",delete n.arg,e.completion=n}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function I(n){if(n||""===n){var r=n[a];if(r)return r.call(n);if("function"==typeof n.next)return n;if(!isNaN(n.length)){var o=-1,s=function r(){for(;++o<n.length;)if(i.call(n,o))return r.value=n[o],r.done=!1,r;return r.value=e,r.done=!0,r};return s.next=s}}throw TypeError(typeof n+" is not iterable")}return y.prototype=b,o(R,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:y,configurable:!0}),y.displayName=l(b,d,"GeneratorFunction"),n.isGeneratorFunction=function(e){var n="function"==typeof e&&e.constructor;return!!n&&(n===y||"GeneratorFunction"===(n.displayName||n.name))},n.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,d,"GeneratorFunction")),e.prototype=Object.create(R),e},n.awrap=function(e){return{__await:e}},T(C.prototype),l(C.prototype,c,function(){return this}),n.AsyncIterator=C,n.async=function(e,r,i,o,s){void 0===s&&(s=Promise);var a=new C(u(e,r,i,o),s);return n.isGeneratorFunction(r)?a:a.next().then(function(e){return e.done?e.value:a.next()})},T(R),l(R,d,"Generator"),l(R,a,function(){return this}),l(R,"toString",function(){return"[object Generator]"}),n.keys=function(e){var n=Object(e),r=[];for(var i in n)r.push(i);return r.reverse(),function e(){for(;r.length;){var i=r.pop();if(i in n)return e.value=i,e.done=!1,e}return e.done=!0,e}},n.values=I,O.prototype={constructor:O,reset:function(n){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(E),!n)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(n){if(this.done)throw n;var r=this;function o(i,o){return c.type="throw",c.arg=n,r.next=i,o&&(r.method="next",r.arg=e),!!o}for(var s=this.tryEntries.length-1;s>=0;--s){var a=this.tryEntries[s],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var d=i.call(a,"catchLoc"),l=i.call(a,"finallyLoc");if(d&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(d){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,n){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var s=o;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=n&&n<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=e,a.arg=n,s?(this.method="next",this.next=s.finallyLoc,v):this.complete(a)},complete:function(e,n){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&n&&(this.next=n),v},finish:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),v}},catch:function(e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc===e){var i=r.completion;if("throw"===i.type){var o=i.arg;E(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(n,r,i){return this.delegate={iterator:I(n),resultName:r,nextLoc:i},"next"===this.method&&(this.arg=e),v}},n}function ay(e){return(ay="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})(e)}function ab(e,n,r,i,o,s,a){try{var c=e[s](a),d=c.value}catch(e){return void r(e)}c.done?n(d):Promise.resolve(d).then(i,o)}function a_(e){return function(){var n=this,r=arguments;return new Promise(function(i,o){var s=e.apply(n,r);function a(e){ab(s,i,o,a,c,"next",e)}function c(e){ab(s,i,o,a,c,"throw",e)}a(void 0)})}}function aw(e,n){if(!(e instanceof n))throw TypeError("Cannot call a class as a function")}function aS(e,n){for(var r=0;r<n.length;r++){var i=n[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,aC(i.key),i)}}function aR(e,n,r){return n&&aS(e.prototype,n),r&&aS(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function aT(e,n,r){return(n=aC(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function aC(e){var n=function(e,n){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,n||"default");if("object"!=typeof i)return i;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:String(n)}ah=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eg(),eb()],ah);var ax=r("../../node_modules/lodash/isString.js"),aE=r.n(ax),aO=r("../../node_modules/lodash/isObject.js"),aI=r.n(aO),ak=r("../../node_modules/lodash/cloneDeep.js"),aM=r.n(ak);class aP{static isJsonStr(e){if(aE()(e))try{let n=JSON.parse(e);return!!aI()(n)}catch(e){}return!1}static parse(e){let n={};try{n=JSON.parse(e||"{}")}catch(n){console.error("JSON.parse Error:",e)}return n||{}}static stringify(e){let n="";try{n=JSON.stringify(e||{})}catch(n){console.error("JSON.stringify error:",e)}return n||"{}"}static getParseValue(e){try{return e&&aE()(e)?aP.parse(e):e}catch(n){return console.info("JSON parse error",e),e}}static parseObj(e,n){let r=aM()(e);return n.forEach(n=>{if(Object.keys(e).includes(n))try{r[n]=aP.parse(e[n]),console.log(n,r[n])}catch(e){console.error(`Failed to parse JSON for key "${n}":`,e)}}),r}static stringifyObj(e,n){let r=aM()(e);return n.forEach(n=>{Object.keys(e).includes(n)&&(r[n]=aP.stringify(e[n]))}),r}}var aj,aA,aD,aB,aN,aL,aU,aF,aH,aq,aV,az,aG,aW,aX,a$,aJ,aK,aY,aQ,aZ,a0,a1,a2,a3,a4,a5,a6,a8,a9,a7,ce,ct,cn,cr,ci,co,cs,ca,cc,cd,cl,cu,cf,cp,ch,cm,cv,cg,cy=r("../../node_modules/lodash/isEmpty.js"),cb=r.n(cy),c_=r("../../node_modules/lodash/omit.js"),cw=r.n(c_),cS=r("../../node_modules/lodash/pick.js"),cR=r.n(cS),cT=["projectId","characterConfigId","configVersion","selectors","figureName","reConnect"];(c=cv||(cv={})).DH_LIB_INIT="DH_LIB_INIT",c.DH_LIB_WS_SUCCESS="DH_LIB_WS_SUCCESS",c.DH_LIB_OPEN="DH_LIB_OPEN",c.DH_LIB_STATUS="DH_LIB_STATUS",c.DH_LIB_CLOSE="DH_LIB_CLOSE",c.DH_LIB_ERROR="DH_LIB_ERROR",c.DH_LIB_WARNING="DH_LIB_WARNING",c.DH_LIB_FULL_STATUS="DH_LIB_FULL_STATUS",c.DH_LIB_MESSAGE="DH_LIB_MESSAGE",(d=cg||(cg={})).CONNECT_ERROR="CONNECT_ERROR",d.DISCONNECT_ALERT="DISCONNECT_ALERT",d.TIMEOUT_EXIT="TIMEOUT_EXIT",d.LOCAL_VIDEO_MUTED="LOCAL_VIDEO_MUTED",d.LOCAL_VIDEO_ERROR="LOCAL_VIDEO_ERROR",d.RTC_ERROR="RTC_ERROR";var cC={"-1":"UNINSTANTIATED",0:"CONNECTING",1:"OPEN",2:"CLOSING",3:"CLOSED"},cx=r("../../node_modules/fast-unique-numbers/build/es5/bundle.js");let cE=(l=e=>{let n=new Map([[0,()=>{}]]),r=new Map([[0,()=>{}]]),i=new Map,o=new Worker(e);return o.addEventListener("message",({data:e})=>{if(void 0!==e.method&&"call"===e.method){let{params:{timerId:o,timerType:s}}=e;if("interval"===s){let e=n.get(o);if("number"==typeof e){let n=i.get(e);if(void 0===n||n.timerId!==o||n.timerType!==s)throw Error("The timer is in an undefined state.")}else if(void 0!==e)e();else throw Error("The timer is in an undefined state.")}else if("timeout"===s){let e=r.get(o);if("number"==typeof e){let n=i.get(e);if(void 0===n||n.timerId!==o||n.timerType!==s)throw Error("The timer is in an undefined state.")}else if(void 0!==e)e(),r.delete(o);else throw Error("The timer is in an undefined state.")}}else if(null===e.error&&"number"==typeof e.id){let{id:o}=e,s=i.get(o);if(void 0===s)throw Error("The timer is in an undefined state.");let{timerId:a,timerType:c}=s;i.delete(o),"interval"===c?n.delete(a):r.delete(a)}else{let{error:{message:n}}=e;throw Error(n)}}),{clearInterval:e=>{let r=(0,cx.generateUniqueNumber)(i);i.set(r,{timerId:e,timerType:"interval"}),n.set(e,r),o.postMessage({id:r,method:"clear",params:{timerId:e,timerType:"interval"}})},clearTimeout:e=>{let n=(0,cx.generateUniqueNumber)(i);i.set(n,{timerId:e,timerType:"timeout"}),r.set(e,n),o.postMessage({id:n,method:"clear",params:{timerId:e,timerType:"timeout"}})},setInterval:(e,r=0)=>{let i=(0,cx.generateUniqueNumber)(n);return n.set(i,()=>{e(),"function"==typeof n.get(i)&&o.postMessage({id:null,method:"set",params:{delay:r,now:performance.now(),timerId:i,timerType:"interval"}})}),o.postMessage({id:null,method:"set",params:{delay:r,now:performance.now(),timerId:i,timerType:"interval"}}),i},setTimeout:(e,n=0)=>{let i=(0,cx.generateUniqueNumber)(r);return r.set(i,e),o.postMessage({id:null,method:"set",params:{delay:n,now:performance.now(),timerId:i,timerType:"timeout"}}),i}}},a=null,()=>{if(null!==a)return a;let e=new Blob(['(()=>{"use strict";const e=new Map,t=new Map,r=(e,t)=>{let r,o;const i=performance.now();r=i,o=e-Math.max(0,i-t);return{expected:r+o,remainingDelay:o}},o=(e,t,r,i)=>{const s=performance.now();s>r?postMessage({id:null,method:"call",params:{timerId:t,timerType:i}}):e.set(t,setTimeout(o,r-s,e,t,r,i))};addEventListener("message",(i=>{let{data:s}=i;try{if("clear"===s.method){const{id:r,params:{timerId:o,timerType:i}}=s;if("interval"===i)(t=>{const r=e.get(t);if(void 0===r)throw new Error(\'There is no interval scheduled with the given id "\'.concat(t,\'".\'));clearTimeout(r),e.delete(t)})(o),postMessage({error:null,id:r});else{if("timeout"!==i)throw new Error(\'The given type "\'.concat(i,\'" is not supported\'));(e=>{const r=t.get(e);if(void 0===r)throw new Error(\'There is no timeout scheduled with the given id "\'.concat(e,\'".\'));clearTimeout(r),t.delete(e)})(o),postMessage({error:null,id:r})}}else{if("set"!==s.method)throw new Error(\'The given method "\'.concat(s.method,\'" is not supported\'));{const{params:{delay:i,now:n,timerId:a,timerType:d}}=s;if("interval"===d)((t,i,s)=>{const{expected:n,remainingDelay:a}=r(t,s);e.set(i,setTimeout(o,a,e,i,n,"interval"))})(i,a,n);else{if("timeout"!==d)throw new Error(\'The given type "\'.concat(d,\'" is not supported\'));((e,i,s)=>{const{expected:n,remainingDelay:a}=r(e,s);t.set(i,setTimeout(o,a,t,i,n,"timeout"))})(i,a,n)}}}}catch(e){postMessage({error:{message:e.message},id:s.id,result:null})}}))})();'],{type:"application/javascript; charset=utf-8"}),n=URL.createObjectURL(e);return a=l(n),setTimeout(()=>URL.revokeObjectURL(n)),a}),cO=(...e)=>cE().setTimeout(...e);(u=v||(v={}))[u.UNINSTANTIATED=-1]="UNINSTANTIATED",u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSING=2]="CLOSING",u[u.CLOSED=3]="CLOSED",(f=g||(g={}))[f.CLOSE_INTERRUPT_WITH_NEW_URL=4e3]="CLOSE_INTERRUPT_WITH_NEW_URL";var cI=r("../../node_modules/lodash/get.js"),ck=r.n(cI),cM=function(e){function n(e){var r,i=this;aw(this,n),aT(this,"dhServerSocket",null),aT(this,"preConnectSuccess",!1),aT(this,"connectParams",null),aT(this,"socketClosingPromise",null),aT(this,"url",void 0),aT(this,"firstConnect",!0),aT(this,"sendPreConnect",function(e,n){var r,o=e.token,s=e.sessionId,a=e.onConnect;null==(r=i.dhServerSocket)||r.request({action:"RE_CONNECT",requestId:rO(),body:JSON.stringify({token:o,sessionId:s})}).on(function(e,r){null==a||a(e),0!==e.code&&(r(),i.handleConnect()),null==n||n(i.dhServerSocket)}),i.firstConnect=!1}),aT(this,"createSocket",function(e,n){return(r=r||a_(ag().mark(function e(n,r){var o,s;return ag().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.connectParams=n,o=n.sessionId,s=n.onDigitalHumanCallback,!i.socketClosingPromise){e.next=5;break}return e.next=5,i.socketClosingPromise;case 5:if(!i.dhServerSocket){e.next=8;break}return e.next=8,i.closeSocket();case 8:return e.abrupt("return",new Promise(function(e,a){var c={keepAlive:"heartbeat",reopen:ck()(i.connectParams,"reConnect",!0),combine:function(e,n){return e&&n&&e.requestId===n.requestId},onOpen:function(){i.dhServerSocket=d,o&&i.firstConnect?i.sendPreConnect(n,e):r&&i.firstConnect||i.handleConnect()},onClose:function(){i.dhServerSocket=null,i.socketClosingPromise=null},onError:function(e){a(e)}},d=function(e,n={}){let r=e,i=0,o=0,s=0,a=!1,c=n?.reopenDelay??5e3,d=!0,l=!1,u=0,f=new Set,p=new Set,h=new Set;function m(){a=!1,i=0,d=!0,c=n?.reopenDelay??5e3}function y(e){let{reopen:r=!0,reopenAttempts:l=10,reopenDelayIncrease:u,onReopenAttemptEnd:f}=n;if(i>=l||!r){let e;return m(),d&&o&&(e=o,cE().clearTimeout(e)),void("function"==typeof f&&f(d))}s=cO(()=>{a=!0,e.open(),i++},c="function"==typeof u?u({reopenCount:i,preDelay:c,isServerClosed:d}):c)}let b={socket:null,messages:[],get readyState(){return this.socket?this.socket.readyState:v.UNINSTANTIATED},get isOpened(){return v.OPEN===this.readyState},get isActive(){return v.CONNECTING===this.readyState||v.OPEN===this.readyState},open(){let e;if(this.isActive)return this;s&&!a&&(e=s,cE().clearTimeout(e));let i=this.socket=new WebSocket(r,n?.protocols);return this._dispchReadyStateChangeEvent(),i.addEventListener("open",this._dispchReadyStateChangeEvent),i.addEventListener("close",this._dispchReadyStateChangeEvent),i.addEventListener("error",this._dispchReadyStateChangeEvent),i.onopen=e=>{let r,{onOpen:s,onMessage:c,combine:l,reopenDelay:u=5e3}=n;a&&(d?(o&&(r=o,cE().clearTimeout(r)),o=cO(m,u>1e3?u+100:1e3)):m()),s&&s(e),i.onmessage=e=>{c&&c(e);let n=this.deserialization(e.data);l&&f.forEach(e=>{l(e.requestData,n)&&(e.then?(e.then(n),f.delete(e)):e.on?e.on(n):e.responseData=n)}),p.forEach(e=>e(n))},this.messages.flush(),this._ping()},i.onerror=e=>{n.onError&&n.onError(e),d=!1,y(this)},i.onclose=e=>{let r;e.isInterruptWithNewUrl=l,l=!1,u&&(r=u,cE().clearTimeout(r));let{reopenWhenServerClosed:o=!0,onClose:s,onServerClose:a}=n;d&&a&&a(e),s&&s(e),this._dispose(i),d&&o&&y(this)},this},openWithNewUrl(e){return e&&this.isActive&&e===r?this:(r=e||r,v.CONNECTING===this.readyState?(this._dispose(),this.socket?.close()):this.isActive&&this.close(g.CLOSE_INTERRUPT_WITH_NEW_URL,"interrupt by new url"),this.open())},close(e=1e3,n){return this.socket?new Promise(r=>{d=!1,g.CLOSE_INTERRUPT_WITH_NEW_URL===e&&(l=!0);let i=()=>{this.socket?.removeEventListener("close",i),this._dispose(this.socket),r()};this.socket?.addEventListener("close",i),this.socket?.close(e,n),this._dispchReadyStateChangeEvent()}):Promise.resolve()},connect(){return this.open()},disconnect(e,n){return this.close(e,n)},send(e){let{socket:n}=this;if(!n)return this;if(v.CONNECTING===n.readyState)return this.messages.push(e),this;e instanceof Function&&(e=e(rO()));let r=this.serialization(e);return n.send(r),this},request(e){if(!n?.combine)throw Error("Request failed! unconfigured combine, this configuration is required to use the request api.");e instanceof Function&&(e=e(rO())),this.send(e);let r={requestData:e,responseData:null};return f.add(r),{then(e){if(r.on&&console.warn('You have already registered for the "on" callback.'),r.responseData){let n=e(r.responseData);return n instanceof Promise?n:Promise.resolve(n)}return new Promise(e=>{r.then=n=>e(n)}).then(n=>e(n))},on(e,n=!0){r.then&&console.warn('You have already registered for the "then" callback.'),r.on=n=>{e(n,()=>{f.delete(r)})},r.responseData&&n&&r.on(r.responseData)}}},receive(){return new Promise(e=>{let n=this.onReceive(r=>{n(),e(r)})})},onReceive:e=>(p.add(e),()=>{p.delete(e)}),onMessage(e){return this.onReceive(e)},_dispchReadyStateChangeEvent(){h.forEach(e=>e(this.readyState))},_dispose(e){(e=e??this.socket)&&(e.removeEventListener("open",this._dispchReadyStateChangeEvent),e.removeEventListener("close",this._dispchReadyStateChangeEvent),e.removeEventListener("error",this._dispchReadyStateChangeEvent),e.onopen=null,e.onclose=null,e.onerror=null)},_ping(){let e,{keepAlive:r="none"}=n;u&&(e=u,cE().clearTimeout(e)),"none"!==r&&this.isOpened&&(u=cO(()=>{if(!this.isOpened)return;let e=n?.getKeepAliveMessage?n?.getKeepAliveMessage(rO()):{requestId:rO(),action:"heartbeat"===r?"HEART_BEAT":"PING"};"heartbeat"===n.keepAlive?(this.send(e),this._ping()):this.request(e).then(()=>{this._ping()}).catch(e=>{console.error(e)})},n?.keepAliveDelay||3e3))},onReadyStateChange:e=>(h.add(e),()=>{h.delete(e)}),serialization:e=>"[object Object]"===Object.prototype.toString.call(e)||Array.isArray(e)||"number"==typeof e?JSON.stringify(e):e,deserialization(e){if("string"==typeof e){let n=e;try{n=JSON.parse(e)}catch(r){n=e}return n}return e}};return b.messages.flush=function(){let e=[...this];if(this.length=0,e.length)for(let n of e)b.send(n)},b}(i.url,c);d.onReadyStateChange(function(e){0===e&&s&&s({status:cv.DH_LIB_INIT}),1===e&&r&&(i.preConnectSuccess=!0),3===e&&(i.preConnectSuccess=!1),s&&s({status:cv.DH_LIB_FULL_STATUS,content:{type:"wsState",readyState:e,body:cC[e]}})}),d.onMessage(function(e){var n=e.action;[cg.TIMEOUT_EXIT,cg.DISCONNECT_ALERT].includes(n)&&s&&s({status:cv.DH_LIB_STATUS,content:{type:n}}),[cg.TIMEOUT_EXIT,cg.DISCONNECT_ALERT,"HEART_BEAT","CONNECT"].includes(n)||s&&s({status:cv.DH_LIB_MESSAGE,content:e})}),r&&(i.dhServerSocket=d),d.open()}));case 9:case"end":return e.stop()}},e)}))).apply(this,arguments)}),aT(this,"closeSocket",a_(ag().mark(function e(){return ag().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.dhServerSocket){e.next=2;break}return e.abrupt("return");case 2:return i.socketClosingPromise=i.dhServerSocket.close(),e.next=5,i.socketClosingPromise;case 5:i.dhServerSocket=null;case 6:case"end":return e.stop()}},e)}))),aT(this,"handleConnect",a_(ag().mark(function e(){var n,r,o,s,a,c;return ag().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i.connectParams){e.next=2;break}return e.abrupt("return");case 2:if(r=(n=i.connectParams).appId,o=n.appKey,s=n.token,a=n.parameters,c=n.onConnect,r||o||s){e.next=5;break}return e.abrupt("return");case 5:i.dhServerSocket&&i.dhServerSocket.request({action:"CONNECT",clientTs:(new Date).getTime(),requestId:rO(),body:JSON.stringify(av(av({token:s,appId:r,appKey:o},cR()(i.connectParams,cT)),{},{parameters:av(av({},cw()(a,["parameters"])),a&&a.parameters?a.parameters:{})}))}).on(function(e,n){null==c||c(e),0!==e.code&&n()});case 6:case"end":return e.stop()}},e)}))),this.url=e}return aR(n,[{key:"sendMessage",value:function(n,r){return(e=e||a_(ag().mark(function e(n,r){var i;return ag().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:try{this.dhServerSocket&&this.dhServerSocket&&this.dhServerSocket.request(n).on(function(e){r&&r(e)})}catch(e){i="object"===ay(n)&&"requestId"in n?n.requestId:rO(),r&&r({code:-11,body:null,action:"RENDER_ERROR",requestId:i,message:JSON.stringify(e)})}case 1:case"end":return e.stop()}},e,this)}))).apply(this,arguments)}}]),n}();let cP={onLocalStream:()=>{},onLocalVideoPublished:()=>{},onRemoteVideoComing:()=>{},onRemoteVideoOn:()=>{},onRemoteVideoOff:()=>{},onRemoteVideoLoading:()=>{},onSuccess:()=>{},onError:()=>{}};class cj{client;#eZ;#e0;#e1;constructor(e){const{roomName:n,token:r,userId:i,appId:o,server:s,rtcConfig:a,callback:c}=e;if(this.#eZ={server:s,token:r,roomName:n,userId:i,appId:o},this.#e1={...cP,...c},this.#e0=a||{},!(n&&r&&i&&o&&s))return this.#e1.onError?.("RtcConnection is required, please check roomName, token, userId, appId, server"),void console.error("RtcConnection is required, please check roomName, token, userId, appId, server");this.init()}init(){let{BaiduRtcRoomClient:e}=window.baidurtc,n=new e;this.client=n,n.BRTC_Start({server:this.#eZ.server,appid:this.#eZ.appId,token:this.#eZ.token,roomname:this.#eZ.roomName,userid:this.#eZ.userId,displayname:"starling-brtc",remotevideoviewid:"starlingRtcContainer",showvideobps:!1,usingvideo:!1,usingaudio:!1,aspublisher:!1,usingdatachannel:!1,autoplaymuted:!1,autosubscribe:!1,autopublish:!1,usingremotemediastate:!0,...this.#e0||{},remotedata:()=>{},success:this.#e1.onSuccess,error:this.#e1.onError,remotevideocoming:this.#e1.onRemoteVideoComing,remotevideoloading:this.#e1.onRemoteVideoLoading,remotevideoon:this.#e1.onRemoteVideoOn,remotevideooff:this.#e1.onRemoteVideoOff,onlocalstream:this.#e1.onLocalStream,localvideopublished_ok:this.#e1.onLocalVideoPublished,remotevideoconnected_state:this.#e1.onRemoteVideoConnected,remotemediastating:this.#e1.onRemoteMediaState,localvideoconnected_state:this.#e1.onLocalVideoConnected})}destroy(){this.client?.BRTC_Stop()}subscribeStreaming(e,n){this.client?.BRTC_SubscribeStreaming(e,n)}stopSubscribeStreaming(e){this.client?.BRTC_StopSubscribeStreaming(e)}muteMicphone(e){this.client?.BRTC_MuteMicphone(e)}getRemoteVideoInfo(e){return this.client?.BRTC_GetRemoteVideoInfo(e)}getClient(){return this.client}}var cA=void 0===Number.MAX_SAFE_INTEGER?0x1fffffffffffff:Number.MAX_SAFE_INTEGER,cD=new WeakMap,cB=(p=function(e,n){return cD.set(e,n),n},function(e){var n=cD.get(e),r=void 0===n?e.size:n<0x40000000?n+1:0;if(!e.has(r))return p(e,r);if(e.size<0x20000000){for(;e.has(r);)r=Math.floor(0x40000000*Math.random());return p(e,r)}if(e.size>cA)throw Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;e.has(r);)r=Math.floor(Math.random()*cA);return p(e,r)}),cN=(h=function(e){var n=new Map([[0,function(){}]]),r=new Map([[0,function(){}]]),i=new Map,o=new Worker(e);return o.addEventListener("message",function(e){var o=e.data;if(void 0!==o.method&&"call"===o.method){var s=o.params,a=s.timerId,c=s.timerType;if("interval"===c){var d=n.get(a);if("number"==typeof d){var l=i.get(d);if(void 0===l||l.timerId!==a||l.timerType!==c)throw Error("The timer is in an undefined state.")}else{if(void 0===d)throw Error("The timer is in an undefined state.");d()}}else if("timeout"===c){var u=r.get(a);if("number"==typeof u){var f=i.get(u);if(void 0===f||f.timerId!==a||f.timerType!==c)throw Error("The timer is in an undefined state.")}else{if(void 0===u)throw Error("The timer is in an undefined state.");u(),r.delete(a)}}}else{if(null!==o.error||"number"!=typeof o.id)throw Error(o.error.message);var p=o.id,h=i.get(p);if(void 0===h)throw Error("The timer is in an undefined state.");var m=h.timerId,v=h.timerType;i.delete(p),"interval"===v?n.delete(m):r.delete(m)}}),{clearInterval:function(e){var r=cB(i);i.set(r,{timerId:e,timerType:"interval"}),n.set(e,r),o.postMessage({id:r,method:"clear",params:{timerId:e,timerType:"interval"}})},clearTimeout:function(e){var n=cB(i);i.set(n,{timerId:e,timerType:"timeout"}),r.set(e,n),o.postMessage({id:n,method:"clear",params:{timerId:e,timerType:"timeout"}})},setInterval:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=cB(n);return n.set(i,function(){e(),"function"==typeof n.get(i)&&o.postMessage({id:null,method:"set",params:{delay:r,now:performance.now(),timerId:i,timerType:"interval"}})}),o.postMessage({id:null,method:"set",params:{delay:r,now:performance.now(),timerId:i,timerType:"interval"}}),i},setTimeout:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=cB(r);return r.set(i,e),o.postMessage({id:null,method:"set",params:{delay:n,now:performance.now(),timerId:i,timerType:"timeout"}}),i}}},m=null,function(){if(null!==m)return m;var e=new Blob(['(()=>{"use strict";const e=new Map,t=new Map,r=(e,t)=>{let r,o;const i=performance.now();r=i,o=e-Math.max(0,i-t);return{expected:r+o,remainingDelay:o}},o=(e,t,r,i)=>{const s=performance.now();s>r?postMessage({id:null,method:"call",params:{timerId:t,timerType:i}}):e.set(t,setTimeout(o,r-s,e,t,r,i))};addEventListener("message",(i=>{let{data:s}=i;try{if("clear"===s.method){const{id:r,params:{timerId:o,timerType:i}}=s;if("interval"===i)(t=>{const r=e.get(t);if(void 0===r)throw new Error(\'There is no interval scheduled with the given id "\'.concat(t,\'".\'));clearTimeout(r),e.delete(t)})(o),postMessage({error:null,id:r});else{if("timeout"!==i)throw new Error(\'The given type "\'.concat(i,\'" is not supported\'));(e=>{const r=t.get(e);if(void 0===r)throw new Error(\'There is no timeout scheduled with the given id "\'.concat(e,\'".\'));clearTimeout(r),t.delete(e)})(o),postMessage({error:null,id:r})}}else{if("set"!==s.method)throw new Error(\'The given method "\'.concat(s.method,\'" is not supported\'));{const{params:{delay:i,now:n,timerId:a,timerType:d}}=s;if("interval"===d)((t,i,s)=>{const{expected:n,remainingDelay:a}=r(t,s);e.set(i,setTimeout(o,a,e,i,n,"interval"))})(i,a,n);else{if("timeout"!==d)throw new Error(\'The given type "\'.concat(d,\'" is not supported\'));((e,i,s)=>{const{expected:n,remainingDelay:a}=r(e,s);t.set(i,setTimeout(o,a,t,i,n,"timeout"))})(i,a,n)}}}}catch(e){postMessage({error:{message:e.message},id:s.id,result:null})}}))})();'],{type:"application/javascript; charset=utf-8"}),n=URL.createObjectURL(e);return m=h(n),setTimeout(function(){return URL.revokeObjectURL(n)}),m}),cL=function(e){return cN().clearInterval(e)},cU=function(e){return cN().clearTimeout(e)},cF=function(){var e;return(e=cN()).setInterval.apply(e,arguments)},cH=function(){var e;return(e=cN()).setTimeout.apply(e,arguments)};class cq{running=!1;logger=!0;timeoutDuration;catchMethod;promise=null;reject=null;stopTimeout=null;constructor(e,n){this.timeoutDuration=e,this.catchMethod=n}start(){this.running?this.logger&&console.warn("TimeoutController已启动"):(this.logger&&console.info("TimeoutController开始计时:",this.timeoutDuration),this.running=!0,this.promise=new Promise((e,n)=>{var r,i;let o,s;this.reject=n,this.stopTimeout?.(),this.stopTimeout=(r=()=>{n(Error("TimeoutController超时错误"))},i=this.timeoutDuration,o=-1,s=null,"undefined"!=typeof Worker?s=C:(s=window,console.warn("浏览器不支持 Web Workers,使用 原生 timer 代替")),i>=0&&(o=s.setTimeout(r,i)),()=>{-1!==o&&s.clearTimeout(o),o=-1})}),this.catchMethod&&this.promise?.catch(this.catchMethod))}clear(){this.running?(this.logger&&console.info("TimeoutController停止计时"),this.running=!1,this.stopTimeout?.(),this.stopTimeout=null,this.reject&&(this.reject=null)):this.logger&&console.warn("TimeoutController未启动")}}var cV=r("../../node_modules/lodash/isFunction.js"),cz=r.n(cV),cG=function(){function e(n){var r=this;aw(this,e),aT(this,"client",void 0),aT(this,"isRtcVideoOn",!1),aT(this,"rtcConnection",void 0),aT(this,"rtcConfig",void 0),aT(this,"bizConfig",void 0),aT(this,"rtcCallback",void 0),aT(this,"restarting",!1),aT(this,"timeoutEvent",void 0),aT(this,"reopenTimer",void 0),aT(this,"restartCount",0),aT(this,"closeLog",!0),aT(this,"haveVideoOn",!1),aT(this,"rtcStateCallback",null),aT(this,"openRtc",function(e){if(r.restarting)r.closeLog||console.warn("rtc restarting");else if(e&&(r.rtcConnection=e),r.rtcConnection&&!cb()(r.rtcConnection)){var n=r.rtcConnection,i=n.server,o=n.appId,s=n.token,a=n.roomName,c=n.userId,d=r.rtcCallback||{},l=d.onRemotedata,u=d.onLocalStream,f=d.onRemoteVideoComing,p=d.onLocalVideoPublished,h=d.onLocalVideoPublishing,m=d.onRemoteVideoOn,v=d.onRemoteVideoOff,g=d.onRemoteVideoLoading,y=d.onSuccess,b=d.onError,_=d.onLocalVideoConnected,w=d.onRemoteVideoConnected,S=d.onRemoteMediaState,R=d.onPlayingError,T=d.onDigitalHumanCallback;r.timeoutEvent.start(),r.rtcStateCallback=function(e){var n=e.body,r=e.action;T&&T({status:cv.DH_LIB_FULL_STATUS,content:{type:"rtcState",action:r,body:n}})},r.client=new cj({roomName:a,token:s,userId:c,appId:o,server:i,rtcConfig:r.rtcConfig,callback:{onRemoteVideoConnected:function(n,i){if(!i&&!r.haveVideoOn)var o=setTimeout(function(){r.restartCount<3?(r.restartCount=++r.restartCount,r.restartRtc&&r.restartRtc(e)):(r.restartCount=0,r.closeRtc()),clearTimeout(o)},500);if(i){var s=document.getElementById("remotevideo500");s.muted=!1;var a=s.play();void 0!==a&&a.catch(function(){s.muted=!0,s.play().catch(function(e){r.closeLog||console.info("videoElement play error",e),R&&R(s),T&&T({status:cv.DH_LIB_ERROR,content:{type:cg.LOCAL_VIDEO_ERROR}})}),T&&T({status:cv.DH_LIB_STATUS,content:{type:cg.LOCAL_VIDEO_MUTED}})})}r.closeLog||console.info("remoteVideoConnected",n,i,r.restartCount),r.rtcStateCallback&&r.rtcStateCallback({action:"remoteVideoConnected",body:{id:n,connected:i,restartCount:r.restartCount}}),cz()(w)&&w(n,i)},onRemoteVideoOn:function(e){r.haveVideoOn=!0,r.closeLog||console.info("remotevideoon by id: ",e),r.timeoutEvent.clear();var n=document.querySelector("#starlingRtcContainer"),i=n&&n.lastChild;i&&(i.style.display="none"),r.rtcStateCallback&&r.rtcStateCallback({action:"remotevideoon",body:e}),T&&T({status:cv.DH_LIB_OPEN}),cz()(m)&&m(e)},onRemoteMediaState:function(e,n,i){r.closeLog||console.info("remoteMediaState",e,n,i),r.rtcStateCallback&&r.rtcStateCallback({action:"remoteMediaState",body:{id:e,medium:n,connected:i}}),cz()(S)&&S(e,n,i)},onLocalVideoConnected:function(e){r.closeLog||console.info("localVideoConnected",e),r.rtcStateCallback&&r.rtcStateCallback({action:"localVideoConnected",body:{connected:e}}),cz()(_)&&_(e)},onRemotedata:function(e){if(r.rtcConfig&&r.rtcConfig.usingdatachannel){var n=aP.parse(e);r.closeLog||console.info("RTC - receive:",n),cz()(l)&&l(n)}},onLocalStream:function(e,n){r.closeLog||console.info("rtc - onlocalstream by name: "+n),r.rtcStateCallback&&r.rtcStateCallback({action:"onlocalstream",body:{stream:e,name:n}}),cz()(u)&&u(e,n)},onLocalVideoPublished:function(){r.closeLog||console.info("LocalVideoPublished 本地视频发布成功"),r.rtcStateCallback&&r.rtcStateCallback({action:"localvideopublished_ok",body:!0}),cz()(p)&&p()},onLocalVideoPublishing:function(){r.closeLog||console.info("LocalVideoPublishing 本地视频发布成功"),r.rtcStateCallback&&r.rtcStateCallback({action:"localvideopublishing",body:!0}),cz()(h)&&h()},onRemoteVideoComing:function(e){r.closeLog||console.info("remotevideocoming",e),r.rtcStateCallback&&r.rtcStateCallback({action:"remotevideocoming",body:e}),cz()(f)&&f(e)},onRemoteVideoLoading:function(e){r.closeLog||console.info("remotevideoloading by id: ",e),r.rtcStateCallback&&r.rtcStateCallback({action:"remotevideoloading",body:e}),cz()(g)&&g(e)},onRemoteVideoOff:function(e){var n=document.getElementById("remotevideo500");n&&n.pause(),r.closeLog||console.info("remotevideooff: ",e),r.isRtcVideoOn=!1,r.rtcStateCallback&&r.rtcStateCallback({action:"remotevideooff",body:e}),T&&T({status:cv.DH_LIB_CLOSE}),cz()(v)&&v(e),r.timeoutEvent.start()},onSuccess:function(){r.closeLog||console.info("rtc - success"),r.rtcStateCallback&&r.rtcStateCallback({action:"success",body:!0}),cz()(y)&&y()},onError:function(n){r.isRtcVideoOn=!1,r.closeLog||console.error("rtc - error:",n),r.rtcStateCallback&&r.rtcStateCallback({action:"error",body:n}),T&&T({status:cv.DH_LIB_ERROR,content:{type:cg.RTC_ERROR}}),cz()(b)&&b(n),(n.includes("Lost connection to the server")||n.includes("Is the server down"))&&r.restartRtc&&r.restartRtc(e)}}})}}),aT(this,"closeRtc",function(){r.timeoutEvent.clear(),clearTimeout(r.reopenTimer),r.client&&r.client.destroy(),r.restarting=!1}),aT(this,"restartRtc",function(e){!r.restarting&&r.bizConfig&&r.bizConfig.autoReConnect&&(r.rtcStateCallback&&r.rtcStateCallback({action:"restartRtc",body:e}),r.restarting=!0,r.closeRtc(),r.reopenTimer=setTimeout(function(){r.closeLog||console.error("拉流失败,开始重启"),r.restarting=!1,r.openRtc(e)},2e3))});var i=n.rtcConnection,o=n.rtcConfig,s=n.closeLog,a=n.rtcCallback;this.rtcConnection=i,this.rtcConfig=o,this.rtcCallback=a,this.closeLog=void 0===s||s,this.timeoutEvent=new cq(6e4,function(){if(!r.rtcConnection)return!r.closeLog&&console.warn("remotevideoon事件超时, rtcConnectionRef is null");r.timeoutEvent.clear(),r.restartRtc&&r.restartRtc(r.rtcConnection)})}return aR(e,[{key:"muteMicphone",value:function(e){this.client&&this.client.muteMicphone&&this.client.muteMicphone(e)}}]),e}(),cW="starling-cutout-canvas",cX="cloud-brtc-player-wrapper",c$="remotevideo500";function cJ(e){var n=document.getElementById(c$);return n&&(n.muted=e),n}function cK(e){var n=document.getElementById(c$);try{if(n)return e?n.play():n.pause()}catch(e){console.info(e)}}var cY=r("../../node_modules/lodash/isNumber.js"),cQ=r.n(cY);function cZ(e){return(cZ="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})(e)}function c0(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}var c1=function(e,n,r){var i;return Promise.race([new Promise(function(n){if(e())var i=setInterval(function(){e()||(clearInterval(i),n())},r||100);else n()})].concat(function(e){if(Array.isArray(e))return c0(e)}(i=n?[new Promise(function(e,r){setTimeout(function(){r(Error("overtime"))},n)})]:[])||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(i)||function(e,n){if(e){if("string"==typeof e)return c0(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c0(e,void 0):void 0}}(i)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()))},c2={exports:{}};b=function(e){var n,r,i,o,s,a,c,d,l=e.document,u=e.console,f={},p={},h={},m={},v=[],g={},y={},b={canvas:[],image:[],video:[]},_={},w=e.WeakMap&&new WeakMap,S=0,R=function(){},T={transparent:[0,0,0,0],black:[0,0,0,1],red:[1,0,0,1],green:[0,128/255,0,1],blue:[0,0,1,1],white:[1,1,1,1],silver:[192/255,192/255,192/255,1],gray:[128/255,128/255,128/255,1],maroon:[128/255,0,0,1],purple:[128/255,0,128/255,1],fuchsia:[1,0,1,1],lime:[0,1,0,1],olive:[128/255,128/255,0,1],yellow:[1,1,0,1],navy:[0,0,128/255,1],teal:[0,128/255,128/255,1],aqua:[0,1,1,1],orange:[1,165/255,0,1]},C=/^(rgb|hsl)a?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*(\d+(\.\d*)?)\s*)?\)/i,x=/^#(([0-9a-fA-F]{3,8}))/,E=["x","y","z","w"],O=["r","g","b","a"],I={srcRGB:770,dstRGB:771,srcAlpha:1,dstAlpha:771},k=["MAX_COMBINED_TEXTURE_IMAGE_UNITS","MAX_FRAGMENT_UNIFORM_VECTORS","MAX_TEXTURE_IMAGE_UNITS","MAX_VARYING_VECTORS","MAX_VERTEX_ATTRIBS","MAX_VERTEX_TEXTURE_IMAGE_UNITS","MAX_VERTEX_UNIFORM_VECTORS"],M=/^[\t ]*#define[\t ]+SHADER_NAME\s+([^$\n\r]+)/i,P={frustum:function(e,n,r,i,o,s,a){a||(a=P.create());var c=n-e,d=i-r,l=s-o;return a[0]=2*o/c,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2*o/d,a[6]=0,a[7]=0,a[8]=(n+e)/c,a[9]=(i+r)/d,a[10]=-(s+o)/l,a[11]=-1,a[12]=0,a[13]=0,a[14]=-s*o*2/l,a[15]=0,a},perspective:function(e,n,r,i,o){var s=r*Math.tan(e*Math.PI/360),a=s*n;return P.frustum(-a,a,-s,s,r,i,o)},multiply:function(e,n,r){var i=n[0],o=n[1],s=n[2],a=n[3],c=n[4],d=n[5],l=n[6],u=n[7],f=n[8],p=n[9],h=n[10],m=n[11],v=n[12],g=n[13],y=n[14],b=n[15],_=r[0],w=r[1],S=r[2],R=r[3];return e[0]=_*i+w*c+S*f+R*v,e[1]=_*o+w*d+S*p+R*g,e[2]=_*s+w*l+S*h+R*y,e[3]=_*a+w*u+S*m+R*b,_=r[4],w=r[5],S=r[6],R=r[7],e[4]=_*i+w*c+S*f+R*v,e[5]=_*o+w*d+S*p+R*g,e[6]=_*s+w*l+S*h+R*y,e[7]=_*a+w*u+S*m+R*b,_=r[8],w=r[9],S=r[10],R=r[11],e[8]=_*i+w*c+S*f+R*v,e[9]=_*o+w*d+S*p+R*g,e[10]=_*s+w*l+S*h+R*y,e[11]=_*a+w*u+S*m+R*b,_=r[12],w=r[13],S=r[14],R=r[15],e[12]=_*i+w*c+S*f+R*v,e[13]=_*o+w*d+S*p+R*g,e[14]=_*s+w*l+S*h+R*y,e[15]=_*a+w*u+S*m+R*b,e},identity:function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},copy:function(e,n){return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],e}},j=(d=0,e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(n){var r,i,o;return i=Math.max(0,16-((r=(new Date).getTime())-d)),o=e.setTimeout(function(){n(r+i)},i),d=r+i,o}),A=e.cancelAnimationFrame||e.webkitCancelAnimationFrame||e.mozCancelAnimationFrame||e.oCancelAnimationFrame||e.msCancelAnimationFrame||function(n){e.cancelTimeout(n)},D=["alias","destroy","effect","id","initialize","inputs","isDestroyed","isReady","matte","off","on","readPixels","render","title","update"],B=["alias","destroy","id","inputs","isDestroyed","isReady","off","on","source","title","update"],N=["aliases","defaults","destroy","effect","go","id","incompatible","isDestroyed","isEffect","isNode","isSource","isTarget","isTransform","removeAlias","render","source","stop","target","transform"];function L(e,n){var r,i;if("string"==typeof e)r=l.querySelector(e);else if(!e)return!1;return e.tagName&&(r=e),r?(i=r.tagName.toLowerCase(),n&&0>n.indexOf(i)?e:r):e}function U(e,n){var r,i;for(r in e.prototype&&n.prototype&&e.prototype!==n.prototype&&U(e.prototype,n.prototype),n)n.hasOwnProperty(r)&&((i=Object.getOwnPropertyDescriptor(n,r)).get||i.set?Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get:i.get,set:i.set}):e[r]=n[r]);return e}function F(e){var n;if(!u)return R;if("function"==typeof u[e])n=u[e];else{if("function"!=typeof u.log)return R;n=u.log}return n.bind?n.bind(u):function(){n.apply(u,arguments)}}function H(n,r){if(r||(r="HTMLElement"),!e[r])return u.error("window[proto] is undefined, proto:",r),!1;if(n instanceof e[r])return!0;if(!n||"object"!==cZ(n))return!1;for(;n;)if((n=Object.getPrototypeOf(n))&&n.constructor.name===r)return!0;return!1}function q(e,n,r,i,o){var s,a;function c(e,n,r){return(r%=1)<0&&(r+=1),r<1/6?e+(n-e)*r*6:r<.5?n:r<2/3?e+(n-e)*(2/3-r)*6:e}return s=2*r-(a=r<.5?r*(n+1):r+n-r*n),o||(o=[]),o[0]=c(s,a,e+1/3),o[1]=c(s,a,e),o[2]=c(s,a,e-1/3),o[3]=i,o}function V(e){var n,r,i,o="#",s=e[3]<1?4:3;for(n=0;n<s;n++)i=(r=Math.min(255,Math.round(255*e[n]||0))).toString(16),r<16&&(i="0"+i),o+=i;return o}function z(e){return Array.isArray(e)||e&&e.BYTES_PER_ELEMENT&&"length"in e}function G(n){if("function"!=typeof n)throw Error("setTimeoutZero argument is not a function");v.push(n),"file:"!==e.location.protocol?e.postMessage("seriously-timeout-message",e.location):setTimeout(function(){v.length&&v.shift()()},0)}function W(n,r){var i;try{i=e.WebGLDebugUtils&&r&&r.debugContext?e.WebGLDebugUtils.makeDebugContext(n.getContext("webgl",r)):n.getContext("webgl",r)}catch(e){}if(!i)try{i=n.getContext("experimental-webgl",r)}catch(e){}return i}function X(){var r;return n&&n.getError()===n.CONTEXT_LOST_WEBGL&&(n=void 0),n||!e.WebGLRenderingContext||i||((n=W(r=l.createElement("canvas")))?r.addEventListener("webglcontextlost",function e(i){i.preventDefault(),n&&n.canvas===this&&(n=void 0,r.removeEventListener("webglcontextlost",e,!1))},!1):Y.logger.warn("Unable to access WebGL.")),n}function $(e){var n,r,i;function o(e,i){var o,s;z(e)?(o=e[0],s=e[1]||o):o=e,"string"==typeof o?o=o.toLowerCase():"number"==typeof o?o=String(o):o||(o=""),r[o]=s,i||(n.firstValue=o)}function s(e){return e}for(i in e.inputs)if(e.inputs.hasOwnProperty(i)){if(e.reserved.indexOf(i)>=0||Object.prototype[i])throw Error("Reserved input name: "+i);(n=e.inputs[i]).name=i,isNaN(n.min)&&(n.min=-1/0),isNaN(n.max)&&(n.max=1/0),isNaN(n.minCount)&&(n.minCount=-1/0),isNaN(n.maxCount)&&(n.maxCount=1/0),isNaN(n.step)&&(n.step=0),isNaN(n.mod)&&(n.mod=0),"enum"===n.type&&n.options&&z(n.options)&&n.options.length&&(r={},n.options.forEach(o),n.options=r),"vector"===n.type?n.dimensions<2?n.dimensions=2:n.dimensions>4||!n.dimensions||isNaN(n.dimensions)?n.dimensions=4:n.dimensions=Math.round(n.dimensions):n.dimensions=1,n.shaderDirty=!!n.shaderDirty,"function"!=typeof n.validate&&(n.validate=Y.inputValidators[n.type]||s),e.defaultImageInput||"image"!==n.type||(e.defaultImageInput=i)}}function J(e,n,r,i){var o,s,a,c,d=!0===i?i:i&&i.useFloat;d=!1,this.type=d?e.FLOAT:e.UNSIGNED_BYTE,o=e.createFramebuffer(),e.bindFramebuffer(e.FRAMEBUFFER,o),i&&i.texture?(this.texture=i.texture,e.bindTexture(e.TEXTURE_2D,this.texture),this.ownTexture=!1):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),this.ownTexture=!0);try{this.type===e.FLOAT?(a=new Float32Array(n*r*4),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,r,0,e.RGBA,e.FLOAT,a)):(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,r,0,e.RGBA,e.UNSIGNED_BYTE,null),this.type=e.UNSIGNED_BYTE)}catch(i){this.type=e.UNSIGNED_BYTE,a=new Uint8Array(n*r*4),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,n,r,0,e.RGBA,e.UNSIGNED_BYTE,a)}if(s=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,s),e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,n,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,s),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,this.texture,0),(c=e.checkFramebufferStatus(e.FRAMEBUFFER))===e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT)throw Error("Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_ATTACHMENT");if(c===e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT)throw Error("Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");if(c===e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS)throw Error("Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_DIMENSIONS");if(c===e.FRAMEBUFFER_UNSUPPORTED)throw Error("Incomplete framebuffer: FRAMEBUFFER_UNSUPPORTED");if(c!==e.FRAMEBUFFER_COMPLETE)throw Error("Incomplete framebuffer: "+c);e.bindTexture(e.TEXTURE_2D,null),e.bindRenderbuffer(e.RENDERBUFFER,null),e.bindFramebuffer(e.FRAMEBUFFER,null),this.gl=e,this.frameBuffer=o,this.renderBuffer=s,this.width=n,this.height=r}function K(e,n,r){var i,o,s,a,c,d,l,u,f="";function p(n,r){var i,o;if(i=r?e.createShader(e.FRAGMENT_SHADER):e.createShader(e.VERTEX_SHADER),e.shaderSource(i,n),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS)){for(n=n.split(/[\n\r]/),o=0;o<n.length;o++)n[o]=o+1+": "+n[o];throw n.unshift("Error compiling "+(r?"fragment":"vertex")+" shader:"),Y.logger.error(n.join("\n")),Error("Shader error: "+e.getShaderInfoLog(i))}return i}if(o=p(n),s=p(r,!0),i=e.createProgram(),e.attachShader(i,o),(a=e.getShaderInfoLog(o))&&(f+="Vertex shader error: "+a+"\n"),e.attachShader(i,s),(a=e.getShaderInfoLog(s))&&(f+="Fragment shader error: "+a+"\n"),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw f+=e.getProgramInfoLog(i),e.deleteProgram(i),e.deleteShader(o),e.deleteShader(s),(l=M.exec(n)||M.exec(r))&&(f="Shader = "+l[1]+"\n"+f),k.forEach(function(n){f+="\n"+n+": "+e.getParameter(e[n])}),Error("Could not initialize shader:\n"+f);for(e.useProgram(i),this.uniforms={},d=e.getProgramParameter(i,e.ACTIVE_UNIFORMS),c=0;c<d;++c)(u={info:e.getActiveUniform(i,c)}).name=u.info.name.replace(/\[0\]$/,""),u.loc=e.getUniformLocation(i,u.name),u.set=function(n,r){if(n.type===e.SAMPLER_2D)return function(i){n.glTexture=e["TEXTURE"+i],e.uniform1i(r,i)};if(n.type===e.BOOL||n.type===e.INT)return n.size>1?function(n){e.uniform1iv(r,n)}:function(n){e.uniform1i(r,n)};if(n.type===e.FLOAT)return n.size>1?function(n){e.uniform1fv(r,n)}:function(n){e.uniform1f(r,n)};if(n.type===e.FLOAT_VEC2)return function(n){e.uniform2f(r,n[0],n[1])};if(n.type===e.FLOAT_VEC3)return function(n){e.uniform3f(r,n[0],n[1],n[2])};if(n.type===e.FLOAT_VEC4)return function(n){e.uniform4f(r,n[0],n[1],n[2],n[3])};if(n.type===e.FLOAT_MAT3)return function(n){e.uniformMatrix3fv(r,!1,n)};if(n.type===e.FLOAT_MAT4)return function(n){e.uniformMatrix4fv(r,!1,n)};throw Error("Unknown shader uniform type: "+n.type)}(u.info,u.loc),u.get=function(n){return function(){return e.getUniform(i,n)}}(u.loc),this.uniforms[u.name]=u,this[u.name]||(this[u.name]=u);for(this.attributes={},this.location={},d=e.getProgramParameter(i,e.ACTIVE_ATTRIBUTES),c=0;c<d;++c)(u={info:e.getActiveAttrib(i,c)}).name=u.info.name,u.location=e.getAttribLocation(i,u.name),this.attributes[u.name]=u,this.location[u.name]=u.location;this.gl=e,this.program=i,this.destroy=function(){var n;for(n in e&&(e.deleteProgram(i),e.deleteShader(o),e.deleteShader(s)),this)this.hasOwnProperty(n)&&delete this[n];i=null,o=null,s=null}}function Y(n){if(e===this||!(this instanceof Y)||void 0!==this.id)return new Y(n);var r,i,s,d,u,v,_,T,C,x,E,O,k,D,B,F=++S,q=this,z=[],X={},Q=0,Z=[],ee=[],et=[],en=[],er={},ei=[],eo=[],es={},ea={},ec=!1,ed=!1,el=null;function eu(e,n){var r,i,o;return!!n&&(r=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,r),n.bufferData(n.ARRAY_BUFFER,e.vertices,n.STATIC_DRAW),r.size=3,i=n.createBuffer(),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,i),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.indices,n.STATIC_DRAW),o=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,o),n.bufferData(n.ARRAY_BUFFER,e.coords,n.STATIC_DRAW),o.size=2,{vertex:r,index:i,texCoord:o,length:e.indices.length,mode:e.mode||n.TRIANGLES})}function ef(e){var n={};return n.vertices=new Float32Array([-1,-1,0,1,-1,0,1,1,0,-1,1,0]),n.indices=new Uint16Array([0,1,2,0,2,3]),n.coords=new Float32Array([0,0,1,0,1,1,0,1]),eu(n,e)}function ep(){Y.logger.warn("WebGL context lost. 5 seconds to restore context."),el&&clearTimeout(el),el=setTimeout(em,5e3)}function eh(e){var n,o;if(!i)if(e.canvas.addEventListener("webglcontextlost",ev,!1),e.canvas.addEventListener("webglcontextrestored",em,!1),e.isContextLost())Y.logger.warn("Unable to attach lost WebGL context. Will try again when context is restored.");else{for(i=e,r=e.canvas,d=ef(i),u=new K(i,"#define SHADER_NAME seriously.base\n"+a,"#define SHADER_NAME seriously.base\n"+c),n=0;n<en.length;n++)(o=en[n]).gl=i,o.initialize(),o.buildShader();for(n=0;n<Z.length;n++)(o=Z[n]).initialize();for(n=0;n<ee.length;n++)(o=ee[n]).model||(o.model=d,o.shader=u)}}function em(){var e,n,r,o;if(el&&clearTimeout(el),el=null,s&&!i){if(H(n=s.target,"WebGLFramebuffer"))return void Y.logger.error("Unable to restore target built on WebGLFramebuffer");if(e=W(n,{alpha:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!0,stencil:!0,debugContext:s.debugContext})){if(e.isContextLost())return el?void Y.logger.error("restore WebGL Context ing, wait...."):(ep(),void Y.logger.error("Unable to restore WebGL Context"));for(eh(e),s.renderToTexture?s.frameBuffer=new J(i,s.width,s.height,!1):s.frameBuffer={frameBuffer:null},r=0;r<z.length;r++)(o=z[r]).setDirty(),o.emit("webglcontextrestored");Y.logger.log("WebGL context restored")}}}function ev(e){var n,o;for(e?(e.preventDefault(),ep()):el&&clearTimeout(el),B&&(A(B),B=0),r&&r.removeEventListener("webglcontextlost",ev,!1),n=0;n<en.length;n++)(o=en[n]).gl=null,o.initialized=!1,o.baseShader=null,o.model=null,o.frameBuffer=null,o.texture=null,o.shader&&o.shader.destroy&&(o.shader.destroy(),o.effect.commonShader&&delete ea[o.hook]),o.shaderDirty=!0,o.shader=null,o.effect.lostContext&&o.effect.lostContext.call(o),e&&o.emit("webglcontextlost");for(n=0;n<Z.length;n++)(o=Z[n]).texture=null,o.initialized=!1,o.allowRefresh=!1,e&&o.emit("webglcontextlost");for(n=0;n<et.length;n++)(o=et[n]).frameBuffer=null,o.texture=null,e&&o.emit("webglcontextlost");for(n=0;n<ee.length;n++)(o=ee[n]).model=!1,o.frameBuffer=null,e&&o.emit("webglcontextlost");u&&u.destroy&&u.destroy(),i&&(i.deleteBuffer(d.vertex),i.deleteBuffer(d.texCoord),i.deleteBuffer(d.index)),d&&(delete d.vertex,delete d.texCoord,delete d.index),d=null,u=null,i=null,r=null}function eg(e){var n,r,i=!1;if(B=0,ei.length)for(i=!0,n=0;n<ei.length;n++)ei[n].call(q,e);if(Z&&Z.length)for(i=!0,n=0;n<Z.length;n++){var o=(r=Z[n]).source&&r.source.dataset&&r.source.dataset.playing;if("string"==typeof o&&"true"!==o)return void(B=j(eg));(r.dirty||r.checkDirty&&r.checkDirty())&&(r.dirty=!1,r.setDirty())}for(n=0;n<ee.length;n++)(r=ee[n]).auto&&r.dirty&&r.render();if(eo.length)for(i=!0,n=0;n<eo.length;n++)eo[n].call(q);i&&!B&&(B=j(eg))}function ey(e,n,r,o,s,a){var c,d,l,u,f,p,h,m,v,g=0,y=s&&s.gl||i;if(y){for(c in s?(u=a&&a.width||s.width||y.canvas.width,f=a&&a.height||s.height||y.canvas.height):(u=a&&a.width||y.canvas.width,f=a&&a.height||y.canvas.height),e.use(),y.viewport(0,0,u,f),y.bindFramebuffer(y.FRAMEBUFFER,o),y.enableVertexAttribArray(e.location.position),y.enableVertexAttribArray(e.location.texCoord),n.texCoord&&(y.bindBuffer(y.ARRAY_BUFFER,n.texCoord),y.vertexAttribPointer(e.location.texCoord,n.texCoord.size,y.FLOAT,!1,0,0)),y.bindBuffer(y.ARRAY_BUFFER,n.vertex),y.vertexAttribPointer(e.location.position,n.vertex.size,y.FLOAT,!1,0,0),y.bindBuffer(y.ELEMENT_ARRAY_BUFFER,n.index),a&&a.depth?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),a?void 0===a.blend||a.blend?(i.enable(i.BLEND),p=void 0===a.srcRGB?i.ONE:a.srcRGB,m=a.dstRGB||i.ZERO,h=void 0===a.srcAlpha?p:a.srcAlpha,v=void 0===a.dstAlpha?m:a.dstAlpha,i.blendFuncSeparate(p,m,h,v),i.blendEquation(a.blendEquation||i.FUNC_ADD)):i.disable(i.BLEND):(i.enable(i.BLEND),i.blendFunc(i.ONE,i.ZERO),i.blendEquation(i.FUNC_ADD)),r)r.hasOwnProperty(c)&&(d=r[c],(l=e.uniforms[c])&&(H(d,"WebGLTexture")?(y.activeTexture(y.TEXTURE0+g),y.bindTexture(y.TEXTURE_2D,d),l.set(g),g++):d instanceof _||d instanceof T||d instanceof C?d.texture&&(y.activeTexture(y.TEXTURE0+g),y.bindTexture(y.TEXTURE_2D,d.texture),l.set(g),g++):null!=d&&l.set(d)));a&&void 0!==a.clear&&!a.clear||(y.clearColor(0,0,0,0),y.clear(y.COLOR_BUFFER_BIT|y.DEPTH_BUFFER_BIT)),y.drawElements(n.mode,n.length,y.UNSIGNED_SHORT,0),i.enable(i.DEPTH_TEST)}}function eb(e,n,r){var i,o;if("string"==typeof e&&(n||0===n)||(r&&"object"===cZ(r)||(r=n),n=e),"string"==typeof e&&h[e]||(e=null),n instanceof _||n instanceof T||n instanceof C)i=n;else if(n instanceof E||n instanceof O||n instanceof k){if(!(i=X[n.id]))throw Error("Cannot connect a foreign node")}else{for("string"==typeof n&&isNaN(n)&&(n=L(n,["canvas","img","video"])),o=0;o<Z.length;o++)if(i=Z[o],(!e||e===i.hook)&&i.compare&&i.compare(n,r))return i;i=new _(e,n,r)}return i}function e_(e,n){var r,i,o;if(!(e instanceof T||e instanceof C))return!1;if(e===n)return!0;for(r in o=e.sources)if(o.hasOwnProperty(r)&&((i=o[r])===n||e_(i,n)))return!0;return!1}(v=function(){this.ready=!1,this.width=1,this.height=1,this.gl=i,this.uniforms={resolution:[this.width,this.height],transform:null},this.dirty=!0,this.isDestroyed=!1,this.seriously=q,this.listeners={},this.id=Q,Q++}).prototype.setReady=function(){var e;if(!this.ready&&(this.ready=!0,this.emit("ready"),this.targets))for(e=0;e<this.targets.length;e++)this.targets[e].setReady()},v.prototype.setUnready=function(){var e;if(this.ready&&(this.ready=!1,this.emit("unready"),this.targets))for(e=0;e<this.targets.length;e++)this.targets[e].setUnready()},v.prototype.setDirty=function(){var e;if(!this.dirty&&(this.emit("dirty"),this.dirty=!0,this.targets))for(e=0;e<this.targets.length;e++)this.targets[e].setDirty()},v.prototype.initFrameBuffer=function(e){i&&(this.frameBuffer=new J(i,this.width,this.height,e))},v.prototype.readPixels=function(e,n,r,o,s){var a=this.gl||i;if(!i)throw Error("Cannot read pixels until a canvas is connected");if(this.frameBuffer||(this.initFrameBuffer(),this.setDirty()),this.render(),void 0===s)s=new Uint8Array(r*o*4);else if(!H(s,"Uint8Array"))throw Error("Incompatible array type");return a.bindFramebuffer(i.FRAMEBUFFER,this.frameBuffer.frameBuffer),a.readPixels(e,n,r,o,i.RGBA,i.UNSIGNED_BYTE,s),s},v.prototype.resize=function(){var e,n;this.source?(e=this.source.width,n=this.source.height):this.sources&&this.sources.source?(e=this.sources.source.width,n=this.sources.source.height):this.inputs&&this.inputs.width?(e=this.inputs.width,n=this.inputs.height||e):this.inputs&&this.inputs.height?e=n=this.inputs.height:(e=1,n=1),e=Math.floor(e),n=Math.floor(n),this.width===e&&this.height===n||(this.width=e,this.height=n,this.emit("resize"),this.setDirty()),this.uniforms&&this.uniforms.resolution&&(this.uniforms.resolution[0]=e,this.uniforms.resolution[1]=n),this.frameBuffer&&this.frameBuffer.resize&&this.frameBuffer.resize(e,n)},v.prototype.on=function(e,n){var r,i=-1;e&&"function"==typeof n&&((r=this.listeners[e])?i=r.indexOf(n):r=this.listeners[e]=[],i<0&&r.push(n))},v.prototype.off=function(e,n){var r,i=-1;e&&"function"==typeof n&&(r=this.listeners[e])&&(i=r.indexOf(n))>=0&&r.splice(i,1)},v.prototype.emit=function(e){var n,r=this.listeners[e];if(r&&r.length)for(n=0;n<r.length;n++)G(r[n])},v.prototype.destroy=function(){var e,n;for(n in delete this.gl,delete this.seriously,this.listeners)this.listeners.hasOwnProperty(n)&&delete this.listeners[n];for(e in this.uniforms)this.uniforms.hasOwnProperty(e)&&delete this.uniforms[e];this.targets&&delete this.targets,this.frameBuffer&&this.frameBuffer.destroy&&(this.frameBuffer.destroy(),delete this.frameBuffer),(e=z.indexOf(this))>=0&&z.splice(e,1),delete X[this.id],this.isDestroyed=!0},E=function(e){var n;function r(n,r){var i,o,s,a;return s=e.effect.inputs[n],i=e.inputElements[n],"string"==typeof r&&isNaN(r)&&("enum"===s.type?s.options.hasOwnProperty(r)||(r=L(r,["select"])):"number"===s.type||"boolean"===s.type?r=L(r,["input","select"]):"image"===s.type&&(r=L(r,["canvas","img","video"]))),H(r,"HTMLInputElement")||H(r,"HTMLSelectElement")?(o=r.value,i&&i.element!==r&&(i.element.removeEventListener("change",i.listener,!0),i.element.removeEventListener("input",i.listener,!0),delete e.inputElements[n],i=null),i||(i={element:r,listener:(a=r,function(){var i,o;i="checkbox"===r.type?r.checked:a.value,o=e.setInput(n,i),"color"===s.type&&(o=V(o).substr(0,7)),o!==i&&(a.value=o)})},e.inputElements[n]=i,"range"===r.type&&r.addEventListener("input",i.listener,!0),r.addEventListener("change",i.listener,!0)),i&&"checkbox"===r.type&&(o=r.checked)):(i&&(i.element.removeEventListener("change",i.listener,!0),i.element.removeEventListener("input",i.listener,!0),delete e.inputElements[n]),o=r),e.setInput(n,o),e.inputs[n]}for(n in e.effect.inputs)if(e.effect.inputs.hasOwnProperty(n)){if(void 0!==this[n])throw Error("Cannot overwrite Seriously."+n);"image"===e.effect.inputs[n].type?Object.defineProperty(this,n,{configurable:!0,enumerable:!0,get:function(n){return function(){var r=e.inputs[n];return r&&r.pub}}(n),set:function(e){return function(n){var i=r(e,n);return i&&i.pub}}(n)}):Object.defineProperty(this,n,{configurable:!0,enumerable:!0,get:function(n){return function(){return e.inputs[n]}}(n),set:function(e){return function(n){return r(e,n)}}(n)})}Object.defineProperties(this,{effect:{enumerable:!0,configurable:!0,get:function(){return e.hook}},title:{enumerable:!0,configurable:!0,get:function(){return e.effect.title||e.hook}},width:{enumerable:!0,configurable:!0,get:function(){return e.width}},height:{enumerable:!0,configurable:!0,get:function(){return e.height}},id:{enumerable:!0,configurable:!0,get:function(){return e.id}}}),this.render=function(){return e.render(),this},this.readPixels=function(n,r,i,o,s){return e.readPixels(n,r,i,o,s)},this.on=function(n,r){e.on(n,r)},this.off=function(n,r){e.off(n,r)},this.inputs=function(n){var r,i,o,s;if(o=e.effect.inputs,n)return(i=o[n])?(r={type:i.type,defaultValue:i.defaultValue,title:i.title||n},"number"===i.type?(r.min=i.min,r.max=i.max,r.step=i.step,r.mod=i.mod):"enum"===i.type?r.options=U({},i.options):"vector"===i.type&&(r.dimensions=i.dimensions),i.description&&(r.description=i.description),r):null;for(s in r={},o)o.hasOwnProperty(s)&&(r[s]=this.inputs(s));return r},this.alias=function(n,r){return e.alias(n,r),this},this.matte=function(n){e.matte(n)},this.destroy=function(){var n,r;for(n in e.destroy(),this)this.hasOwnProperty(n)&&"isDestroyed"!==n&&"id"!==n&&((r=Object.getOwnPropertyDescriptor(this,n)).get||r.set||"function"!=typeof this[n]?delete this[n]:this[n]=R)},this.isDestroyed=function(){return e.isDestroyed},this.isReady=function(){return e.ready}},(T=function(e,n){var r,s,a,c,d={};for(r in v.call(this,n),this.gl=i,this.effectRef=f[e],this.sources={},this.targets=[],this.inputElements={},this.dirty=!0,this.shaderDirty=!0,this.hook=e,this.options=n,this.transform=null,this.effect=U({},this.effectRef),this.effectRef.definition&&U(this.effect,this.effectRef.definition.call(this,n)),$(this.effect),this.uniforms.transform=o,this.inputs={},c=es[e],this.effect.inputs)this.effect.inputs.hasOwnProperty(r)&&(void 0!==(s=this.effect.inputs[r]).defaultValue&&null!==s.defaultValue||("number"===s.type?s.defaultValue=Math.min(Math.max(0,s.min),s.max):"color"===s.type?s.defaultValue=[0,0,0,0]:"boolean"===s.type?s.defaultValue=!1:"string"===s.type?s.defaultValue="":"enum"===s.type&&(s.defaultValue=s.firstValue)),a=s.validate.call(this,s.defaultValue,s),c&&void 0!==c[r]&&(a=s.validate.call(this,c[r],s,s.defaultValue,a),c[r]=a,"image"===s.type&&(d[r]=a)),this.inputs[r]=a,s.uniform&&(this.uniforms[s.uniform]=s.defaultValue));for(r in i&&(this.initialize(),this.effect.commonShader&&this.buildShader()),this.updateReady(),this.inPlace=this.effect.inPlace,this.pub=new E(this),z.push(this),X[this.id]=this,en.push(this),g[e].push(this),d)d.hasOwnProperty(r)&&this.setInput(r,d[r])}).prototype=Object.create(v.prototype),T.prototype.constructor=T,T.prototype.initialize=function(){if(!this.initialized){var e=this;this.baseShader=u,this.shape?this.model=eu(this.shape,this.gl):this.model=d,"function"==typeof this.effect.initialize?this.effect.initialize.call(this,function(){e.initFrameBuffer(!0)},i):this.initFrameBuffer(!0),this.frameBuffer&&(this.texture=this.frameBuffer.texture),this.initialized=!0}},T.prototype.resize=function(){var e;for(v.prototype.resize.call(this),this.effect.resize&&this.effect.resize.call(this),e=0;e<this.targets.length;e++)this.targets[e].resize()},T.prototype.updateReady=function(){var e,n,r,i,o=!0;for(n in(r=this.effect).inputs)if(r.inputs.hasOwnProperty(n)&&"image"===this.effect.inputs[n].type&&(!this.sources[n]||!this.sources[n].ready)&&(!r.requires||r.requires.call(this,n,this.inputs))){o=!1;break}if(this.ready!==o&&(this.ready=o,this.emit(o?"ready":"unready"),i=o?"setReady":"setUnready",this.targets))for(e=0;e<this.targets.length;e++)this.targets[e][i]()},T.prototype.setReady=T.prototype.updateReady,T.prototype.setUnready=T.prototype.updateReady,T.prototype.addTarget=function(e){var n;for(n=0;n<this.targets.length;n++)if(this.targets[n]===e)return;this.targets.push(e)},T.prototype.removeTarget=function(e){var n=this.targets&&this.targets.indexOf(e);n>=0&&this.targets.splice(n,1)},T.prototype.removeSource=function(e){var n,r=e&&e.pub;for(n in this.inputs)this.inputs.hasOwnProperty(n)&&(this.inputs[n]===e||this.inputs[n]===r)&&(this.inputs[n]=null);for(n in this.sources)this.sources.hasOwnProperty(n)&&(this.sources[n]===e||this.sources[n]===r)&&(this.sources[n]=null)},T.prototype.buildShader=function(){var e,n=this.effect,r=this;function o(e){return M.test(e)?e:"#define SHADER_NAME seriously."+r.hook+"\n"+e}this.shaderDirty&&(n.commonShader&&ea[this.hook]?(this.shader||ea[this.hook].count++,this.shader=ea[this.hook].shader):n.shader?(this.shader&&!n.commonShader&&this.shader.destroy(),(e=n.shader.call(this,this.inputs,{vertex:a,fragment:c},Y.util))instanceof K?this.shader=e:e&&e.vertex&&e.fragment?this.shader=new K(i,o(e.vertex),o(e.fragment)):this.shader=u,n.commonShader&&(ea[this.hook]={count:1,shader:this.shader})):this.shader=u,this.shaderDirty=!1)},T.prototype.render=function(){var e,n,r,o=this.effect,s=this;if(i){if(this.initialized||this.initialize(),this.shaderDirty&&this.buildShader(),this.dirty&&this.ready){for(e in this.sources)this.sources.hasOwnProperty(e)&&(!o.requires||o.requires.call(this,e,this.inputs))&&(r="function"==typeof this.inPlace?this.inPlace(e):this.inPlace,this.sources[e].render(!r));this.frameBuffer&&(n=this.frameBuffer.frameBuffer),"function"==typeof o.draw?(o.draw.call(this,this.shader,this.model,this.uniforms,n,function(e,n,r,i,o,a){ey(e,n,r,i,o||s,a)}),this.emit("render")):n&&(ey(this.shader,this.model,this.uniforms,n,this),this.emit("render")),this.dirty=!1}return this.texture}},T.prototype.setInput=function(e,n){var r,i,s,a,c,d=this;if(this.effect.inputs.hasOwnProperty(e)){if("image"===(r=this.effect.inputs[e]).type){if(n){if((n=eb(n))!==this.sources[e]){if(function(){var n,r=d.sources[e];if(r){for(n in d.sources)if(n!==e&&d.sources.hasOwnProperty(n)&&d.sources[n]===r)return;r.removeTarget(d)}}(),e_(n,this))throw Error("Attempt to make cyclical connection.");this.sources[e]=n,n.addTarget(this)}}else delete this.sources[e],n=!1;i=this.sources[e],s=Object.keys(this.sources),!0===this.inPlace&&1===s.length?(a=this.sources[s[0]],this.uniforms.transform=a&&a.cumulativeMatrix||o):this.uniforms.transform=o}else c=es[this.hook]&&void 0!==es[this.hook][e]?es[this.hook][e]:r.defaultValue,i=n=r.validate.call(this,n,r,c,this.inputs[e]);return this.inputs[e]===n&&"color"!==r.type&&"vector"!==r.type||(this.inputs[e]=n,r.uniform&&(this.uniforms[r.uniform]=i),"image"===r.type?(this.resize(),this.updateReady()):r.updateSources&&this.updateReady(),r.shaderDirty&&(this.shaderDirty=!0),this.setDirty(),r.update&&r.update.call(this,n)),n}},T.prototype.alias=function(e,n){var r=this;if(N.indexOf(n)>=0)throw Error("'"+n+"' is a reserved name and cannot be used as an alias.");return this.effect.inputs.hasOwnProperty(e)&&(n||(n=e),q.removeAlias(n),er[n]={node:this,input:e},Object.defineProperty(q,n,{configurable:!0,enumerable:!0,get:function(){return r.inputs[e]},set:function(n){return r.setInput(e,n)}})),this},T.prototype.matte=function(e){var n,r,i,o,s,a,c,d,l=[],u=[],f={};for(r=(n=e)&&n.length&&Array.isArray(n)?Array.isArray(n[0])?Array.isArray(n[0])&&!isNaN(n[0][0])?[n]:n:[n]:[],o=0;o<r.length;o++){for(e=r[o],d=null,i={vertices:[],edges:[]},s=0;s<e.length;s++)a=e[s],"object"!==cZ(a)||isNaN(a.x)||isNaN(a.y)?!(a.length>=2)||isNaN(a[0])||isNaN(a[1])||(c={x:a[0],y:a[1],id:u.length}):c={x:a.x,y:a.y,id:u.length},c&&(d?(d.next=c,c.prev=d,c.next=i.vertices[0],i.vertices[0].prev=c):(i.head=c,c.next=c,c.prev=c),u.push(c),i.vertices.push(c),d=c);if(i.vertices.length>2)for(3===i.vertices.length&&(i.simple=!0),l.push(i),s=0;s<i.vertices.length;s++)c=i.vertices[s],i.edges.push([c,c.next])}for(o=l.length-1;o>=0;o--)!function(e){var n,r,i,o,s,a,c,d,f,p,h,m=[];if(!e.simple){for(n=0;n<e.edges.length;n++)for(i=e.edges[n],r=n+1;r<e.edges.length;r++)o=e.edges[r],(s=function(e,n,r,i){var o,s,a,c,d;return o=(i.x-r.x)*(e.y-r.y)-(i.y-r.y)*(e.x-r.x),s=(n.x-e.x)*(e.y-r.y)-(n.y-e.y)*(e.x-r.x),!!((a=(i.y-r.y)*(n.x-e.x)-(i.x-r.x)*(n.y-e.y))&&(d=s/a,(c=o/a)>0&&c<=1&&d>0&&d<=1))&&{x:e.x+c*(n.x-e.x),y:e.y+c*(n.y-e.y)}}(i[0],i[1],o[0],o[1]))&&(s.edge1=i,s.edge2=o,m.push(s));if(m.length){for(f=[],n=0;n<m.length;n++)i=(s=m[n]).edge1,o=s.edge2,p={x:s.x,y:s.y,prev:i[0],next:o[1],id:u.length},e.vertices.push(p),u.push(p),h={x:s.x,y:s.y,prev:o[0],next:i[1],id:u.length},e.vertices.push(h),u.push(p),p.prev.next=p,p.next.prev=p,h.prev.next=h,h.next.prev=h;do{a={edges:[],vertices:[],simple:!0},f.push(a),c=d=e.vertices[0];do n=e.vertices.indexOf(d),e.vertices.splice(n,1),a.edges.push([d,d.next]),a.vertices.push(d),d=d.next;while(d!==c)}while(e.vertices.length);for(n=l.indexOf(e),l.splice(n,1),n=0;n<f.length;n++)l.push(f[n])}else e.simple=!0}}(i=l[o]);for(o=0;o<l.length;o++)(i=l[o]).clockWise=function(e){var n,r,i,o,s=e.vertices.length,a=0;for(n=s-1,r=0;r<s;n=r,r++)i=e.vertices[n],o=e.vertices[r],a+=i.x*o.y-o.x*i.y;return a>0}(i),function(e){var n,r,o,s,a,c,d,l,u,f,p,h=e.vertices,m=[],v=[];if(r=h.length,e.clockWise)for(n=0;n<r;n++)m[n]=n;else for(n=0;n<r;n++)m[n]=r-1-n;for(s=2*(o=r),n=o-1;o>2;){if(s--<=0)return v;if(o<=(a=n)&&(a=0),o<=(n=a+1)&&(n=0),o<(c=n+1)&&(c=0),function(e,n,r,i,o){var s,a,c,d;if(a=h[o[e]],c=h[o[n]],d=h[o[r]],0>(c.x-a.x)*(d.y-a.y)-(c.y-a.y)*(d.x-a.x))return!1;for(s=0;s<i;s++)if(s!==e&&s!==n&&s!==r&&function(e,n,r,i){var o,s,a,c,d,l,u,f,p,h,m,v;return o=r.x-n.x,s=r.y-n.y,a=e.x-r.x,c=e.y-r.y,d=n.x-e.x,l=n.y-e.y,u=i.x-e.x,f=i.y-e.y,p=i.x-n.x,h=i.y-n.y,m=i.x-r.x,v=i.y-r.y,o*h-s*p>=0&&a*v-c*m>=0&&d*f-l*u>=0}(a,c,d,h[o[s]]))return!1;return!0}(a,n,c,o,m)){for(d=m[a],l=m[n],u=m[c],e.clockWise?(v.push(h[d]),v.push(h[l]),v.push(h[u])):(v.push(h[u]),v.push(h[l]),v.push(h[d])),f=n,p=n+1;p<o;f++,p++)m[f]=m[p];s=2*--o}}i.indices=v}(i);for(f.vertices=[],f.coords=[],o=0;o<u.length;o++)a=u[o],f.vertices.push(2*a.x-1),f.vertices.push(-2*a.y+1),f.vertices.push(-1),f.coords.push(a.x),f.coords.push(-1*a.y+1);for(f.vertices=new Float32Array(f.vertices),f.coords=new Float32Array(f.coords),f.indices=[],o=0;o<l.length;o++)for(i=l[o],s=0;s<i.indices.length;s++)a=i.indices[s],f.indices.push(a.id);f.indices=new Uint16Array(f.indices),this.shape=f,this.gl&&eu(f,this.gl)},T.prototype.destroy=function(){var e,n,r,i=this.hook;for(n in this.effect.destroy&&"function"==typeof this.effect.destroy&&this.effect.destroy.call(this),delete this.effect,ea[i]&&(ea[i].count--,ea[i].count||delete ea[i]),this.shader&&this.shader.destroy&&this.shader!==u&&!ea[i]&&this.shader.destroy(),delete this.shader,this.inputElements)this.inputElements.hasOwnProperty(n)&&((r=this.inputElements[n]).element.removeEventListener("change",r.listener,!0),r.element.removeEventListener("input",r.listener,!0));for(n in this.sources)this.sources.hasOwnProperty(n)&&((r=this.sources[n])&&r.removeTarget&&r.removeTarget(this),delete this.sources[n]);for(;this.targets.length;)(r=this.targets.pop())&&r.removeSource&&r.removeSource(this);for(n in this)this.hasOwnProperty(n)&&"id"!==n&&delete this[n];for(n in er)er.hasOwnProperty(n)&&(r=er[n]).node===this&&q.removeAlias(n);(e=en.indexOf(this))>=0&&en.splice(e,1),(e=g[i].indexOf(this))>=0&&g[i].splice(e,1),v.prototype.destroy.call(this)},O=function(e){Object.defineProperties(this,{original:{enumerable:!0,configurable:!0,get:function(){return e.source}},id:{enumerable:!0,configurable:!0,get:function(){return e.id}},width:{enumerable:!0,configurable:!0,get:function(){return e.width}},height:{enumerable:!0,configurable:!0,get:function(){return e.height}}}),this.render=function(){e.render()},this.update=function(){e.setDirty()},this.readPixels=function(n,r,i,o,s){return e.readPixels(n,r,i,o,s)},this.on=function(n,r){e.on(n,r)},this.off=function(n,r){e.off(n,r)},this.destroy=function(){var n,r;for(n in e.destroy(),this)this.hasOwnProperty(n)&&"isDestroyed"!==n&&"id"!==n&&((r=Object.getOwnPropertyDescriptor(this,n)).get||r.set||"function"!=typeof this[n]?delete this[n]:this[n]=R)},this.isDestroyed=function(){return e.isDestroyed},this.isReady=function(){return e.ready}},(_=function(e,n,r){var o,s,a=r||{},c=void 0===a.flip||a.flip,d=a.width,l=a.height,u=!1,f=this,p=!1;function m(e,n,r,i){var o=h[e];if(o.definition){if(!(o=o.definition.call(f,n,r,i)))return null;o=U(U({},h[e]),o)}return o}function g(e){return f.source===e}if(v.call(this),(e&&"string"!=typeof e||!n&&0!==n)&&(r&&"object"===cZ(r)||(r=n),n=e),"string"==typeof n&&isNaN(n)&&(n=L(n,["canvas","img","video"])),"string"==typeof e&&h[e]&&(s=m(e,n,r,!0))&&(this.hook=e,p=!0,u=s.deferTexture,this.plugin=s,this.compare=s.compare,this.checkDirty=s.checkDirty,s.source&&(n=s.source)),!s&&H(n))"CANVAS"===n.tagName?(this.width=n.width,this.height=n.height,this.render=this.renderImageCanvas,p=!0,this.hook="canvas",this.compare=g):"IMG"===n.tagName&&(this.width=n.naturalWidth||1,this.height=n.naturalHeight||1,n.complete&&n.naturalWidth||(u=!0),n.addEventListener("load",function(){f.isDestroyed||(f.width===n.naturalWidth&&f.height===n.naturalHeight||(f.width=n.naturalWidth,f.height=n.naturalHeight,f.resize()),f.setDirty(),f.setReady())},!0),this.render=this.renderImageCanvas,p=!0,this.hook="image",this.compare=g);else if(!s&&H(n,"WebGLTexture")){if(i&&!i.isTexture(n))throw Error("Not a valid WebGL texture.");isNaN(d)?isNaN(l)||(d=l):isNaN(l)&&(l=d),this.width=d,this.height=l,void 0===a.flip&&(c=!1),p=!0,this.texture=n,this.initialized=!0,this.hook="texture",this.compare=g,this.render=function(){}}if(!p&&!s){for(o in h)if(h.hasOwnProperty(o)&&h[o]&&(s=m(o,n,r,!1))){this.hook=o,p=!0,u=s.deferTexture,this.plugin=s,this.compare=s.compare,this.checkDirty=s.checkDirty,s.source&&(n=s.source);break}}if(!p)throw Error("Unknown source type");this.source=n,void 0===this.flip&&(this.flip=c),this.targets=[],u||f.setReady(),this.pub=new O(this),z.push(this),X[this.id]=this,Z.push(this),b[this.hook].push(this),Z.length&&!B&&eg()}).prototype=Object.create(v.prototype),_.prototype.constructor=_,_.prototype.initialize=function(){var e;i&&!this.texture&&this.ready&&(e=i.createTexture(),i.bindTexture(i.TEXTURE_2D,e),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.bindTexture(i.TEXTURE_2D,null),this.texture=e,this.initialized=!0,this.allowRefresh=!0,this.setDirty())},_.prototype.initFrameBuffer=function(e){i&&(this.frameBuffer=new J(i,this.width,this.height,{texture:this.texture,useFloat:e}))},_.prototype.addTarget=function(e){var n;for(n=0;n<this.targets.length;n++)if(this.targets[n]===e)return;this.targets.push(e)},_.prototype.removeTarget=function(e){var n=this.targets&&this.targets.indexOf(e);n>=0&&this.targets.splice(n,1)},_.prototype.resize=function(){var e,n;if(this.uniforms.resolution[0]=this.width,this.uniforms.resolution[1]=this.height,this.framebuffer&&this.framebuffer.resize(this.width,this.height),this.emit("resize"),this.setDirty(),this.targets)for(e=0;e<this.targets.length;e++)(n=this.targets[e]).resize(),n.setTransformDirty&&n.setTransformDirty()},_.prototype.setReady=function(){var e;if(!this.ready&&(this.ready=!0,this.resize(),this.initialize(),this.emit("ready"),this.targets))for(e=0;e<this.targets.length;e++)this.targets[e].setReady()},_.prototype.render=function(){var e=this.source;i&&(e||0===e)&&this.ready&&(this.initialized||this.initialize(),this.allowRefresh&&this.plugin&&this.plugin.render&&(this.dirty||this.checkDirty&&this.checkDirty())&&this.plugin.render.call(this,i,ey,d,u)&&(this.dirty=!1,this.emit("render")))},_.prototype.renderImageCanvas=function(){var n=this.source;if(i&&n&&this.ready&&(this.initialized||this.initialize(),this.allowRefresh&&this.dirty)){i.bindTexture(i.TEXTURE_2D,this.texture),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,this.flip),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);try{return i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,n),this.dirty=!1,this.emit("render"),!0}catch(n){n.code===e.DOMException.SECURITY_ERR&&(this.allowRefresh=!1,Y.logger.error("Unable to access cross-domain image"))}return!1}},_.prototype.destroy=function(){var e,n,r;for(this.plugin&&this.plugin.destroy&&this.plugin.destroy.call(this),i&&this.texture&&i.deleteTexture(this.texture);this.targets.length;)(r=this.targets.pop())&&r.removeSource&&r.removeSource(this);for(n in(e=Z.indexOf(this))>=0&&Z.splice(e,1),(e=b[this.hook].indexOf(this))>=0&&b[this.hook].splice(e,1),this)this.hasOwnProperty(n)&&"id"!==n&&delete this[n];v.prototype.destroy.call(this)},D=function(e){Object.defineProperties(this,{source:{enumerable:!0,configurable:!0,get:function(){if(e.source)return e.source.pub},set:function(n){e.setSource(n)}},original:{enumerable:!0,configurable:!0,get:function(){return e.target}},width:{enumerable:!0,configurable:!0,get:function(){return e.width},set:function(n){!isNaN(n)&&n>0&&e.width!==n&&(e.width=n,e.resize(),e.setTransformDirty())}},height:{enumerable:!0,configurable:!0,get:function(){return e.height},set:function(n){!isNaN(n)&&n>0&&e.height!==n&&(e.height=n,e.resize(),e.setTransformDirty())}},id:{enumerable:!0,configurable:!0,get:function(){return e.id}}}),this.render=function(){e.render()},this.readPixels=function(n,r,i,o,s){return e.readPixels(n,r,i,o,s)},this.on=function(n,r){e.on(n,r)},this.off=function(n,r){e.off(n,r)},this.go=function(n){e.go(n)},this.stop=function(){e.stop()},this.getTexture=function(){return e.frameBuffer.texture},this.destroy=function(){var n,r;for(n in e.destroy(),this)this.hasOwnProperty(n)&&"isDestroyed"!==n&&"id"!==n&&((r=Object.getOwnPropertyDescriptor(this,n)).get||r.set||"function"!=typeof this[n]?delete this[n]:this[n]=R)},this.inputs=function(e){return{source:{type:"image"}}},this.isDestroyed=function(){return e.isDestroyed},this.isReady=function(){return e.ready}},(x=function(e,n,r){var o,l,f,p,h,g,y,b,_,S=this,T=!1;function C(e,n,r,o){var s=m[e];if(s.definition){if(!(s=s.definition.call(S,n,r,o)))return null;s=U(U({},m[e]),s),S.hook=_,T=!0,S.plugin=s,S.compare=s.compare,s.target&&(n=s.target),s.gl&&!S.gl&&(S.gl=s.gl,i||eh(s.gl)),S.gl===i&&(S.model=d,S.shader=u)}return s}if(v.call(this),(e&&"string"!=typeof e||!n&&0!==n)&&(r&&"object"===cZ(r)||(r=n),n=e),l=void 0===(o=r||{}).flip||o.flip,f=parseInt(o.width,10),p=parseInt(o.height,10),g=o.debugContext,"string"==typeof e&&m[e]&&C(e,n,o,!0),this.renderToTexture=o.renderToTexture,H(n,"WebGLFramebuffer"))if(y=n,H(o,"HTMLCanvasElement"))n=o;else if(H(o,"WebGLRenderingContext"))n=o.canvas;else if(H(o.canvas,"HTMLCanvasElement"))n=o.canvas;else{if(!H(o.context,"WebGLRenderingContext"))throw Error("Must provide a canvas with WebGLFramebuffer target");n=o.context.canvas}if(H(n,"HTMLCanvasElement")){if(f=n.width,p=n.height,(!i||i.canvas!==n&&o.allowSecondaryWebGL)&&(h=W(n,{alpha:!0,premultipliedAlpha:!0,preserveDrawingBuffer:!0,stencil:!0,debugContext:g})),h)i&&i!==h?(this.gl=h,this.frameBuffer={frameBuffer:y||null},this.shader=new K(this.gl,a,c),this.model=ef.call(this,this.gl),this.pixels=null,this.texture=this.gl.createTexture(),this.gl.bindTexture(i.TEXTURE_2D,this.texture),this.gl.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),this.gl.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),this.gl.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),this.gl.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),this.render=this.renderSecondaryWebGL):(s||(s=this),i||eh(h),this.render=this.renderWebGL,o.renderToTexture?i&&(this.frameBuffer=new J(i,f,p,!1)):this.frameBuffer={frameBuffer:y||null});else{if(!o.allowSecondaryWebGL&&i&&i.canvas!==n)throw Error("Only one WebGL target canvas allowed. Set allowSecondaryWebGL option to create secondary context.");this.render=R,Y.logger.log("Unable to create WebGL context.")}T=!0}if(!T){for(_ in m)if(m.hasOwnProperty(_)&&m[_]&&C(_,n,o,!1))break}if(!T)throw Error("Unknown target type");w&&((b=w.get(n))?Y.logger.warn("Target already in use by another instance",n,Object.keys(b).map(function(e){return b[e]})):(b={},w.set(n,b)),b[q.id]=q),this.target=n,this.transform=null,this.transformDirty=!0,this.flip=l,f&&(this.width=f),p&&(this.height=p),this.uniforms.resolution[0]=this.width,this.uniforms.resolution[1]=this.height,void 0!==o.auto?this.auto=o.auto:this.auto=ec,this.frames=0,this.pub=new D(this),z.push(this),X[this.id]=this,ee.push(this)}).prototype=Object.create(v.prototype),x.prototype.constructor=x,x.prototype.setSource=function(e){var n;(n=eb(e))!==this.source&&(this.source&&this.source.removeTarget(this),this.source=n,n.addTarget(this),n&&(this.resize(),n.ready?this.setReady():this.setUnready()),this.setDirty())},x.prototype.setDirty=function(){this.dirty=!0,this.auto&&!B&&(B=j(eg))},x.prototype.resize=function(){H(this.target,"HTMLCanvasElement")?this.width===this.target.width&&this.height===this.target.height||(this.target.width=this.width,this.target.height=this.height,this.uniforms.resolution[0]=this.width,this.uniforms.resolution[1]=this.height,this.emit("resize"),this.setTransformDirty()):this.plugin&&this.plugin.resize&&this.plugin.resize.call(this),!this.source||this.source.width===this.width&&this.source.height===this.height||this.transform||(this.transform=new Float32Array(16))},x.prototype.setTransformDirty=function(){this.transformDirty=!0,this.setDirty()},x.prototype.go=function(){this.auto=!0,this.setDirty()},x.prototype.stop=function(){this.auto=!1},x.prototype.render=function(){i&&this.plugin&&this.plugin.render&&this.plugin.render.call(this,ey,u,d)},x.prototype.renderWebGL=function(){var e,n,r;if(this.resize(),i&&this.dirty&&this.ready){if(!this.source)return;this.source.render(),this.uniforms.source=this.source.texture,this.source.width===this.width&&this.source.height===this.height?this.uniforms.transform=this.source.cumulativeMatrix||o:this.transformDirty&&(e=this.transform,P.copy(e,this.source.cumulativeMatrix||o),n=this.source.width/this.width,r=this.source.height/this.height,e[0]*=n,e[1]*=n,e[2]*=n,e[3]*=n,e[4]*=r,e[5]*=r,e[6]*=r,e[7]*=r,this.uniforms.transform=e,this.transformDirty=!1),ey(u,d,this.uniforms,this.frameBuffer.frameBuffer,this,I),this.emit("render"),this.dirty=!1}},x.prototype.renderSecondaryWebGL=function(){var e,n,r,i,s;this.dirty&&this.ready&&this.source&&(this.emit("render"),this.source.render(!0),e=this.source.width,n=this.source.height,this.pixels&&this.pixels.length===e*n*4||(this.pixels=new Uint8Array(e*n*4)),this.source.readPixels(0,0,e,n,this.pixels),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,e,n,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.pixels),e===this.width&&n===this.height?this.uniforms.transform=o:this.transformDirty&&(r=this.transform,P.copy(r,o),i=this.source.width/this.width,s=this.source.height/this.height,r[0]*=i,r[1]*=i,r[2]*=i,r[3]*=i,r[4]*=s,r[5]*=s,r[6]*=s,r[7]*=s,this.uniforms.transform=r,this.transformDirty=!1),this.uniforms.source=this.texture,ey(this.shader,this.model,this.uniforms,null,this,I),this.dirty=!1)},x.prototype.removeSource=function(e){this.source!==e&&this.source!==e.pub||(this.source=null)},x.prototype.destroy=function(){var e,n;this.source&&this.source.removeTarget&&this.source.removeTarget(this),w&&(delete(n=w.get(this.target))[q.id],Object.keys(n).length||w.delete(this.target)),this.plugin&&this.plugin.destroy&&this.plugin.destroy.call(this),delete this.source,delete this.target,delete this.pub,delete this.uniforms,delete this.pixels,delete this.auto,(e=ee.indexOf(this))>=0&&ee.splice(e,1),v.prototype.destroy.call(this),this===s&&(r.removeEventListener("webglcontextrestored",em,!1),ev(),s=null)},k=function(e){var n,r=this;for(n in Object.defineProperties(this,{transform:{enumerable:!0,configurable:!0,get:function(){return e.hook}},title:{enumerable:!0,configurable:!0,get:function(){return e.plugin.title||e.hook}},width:{enumerable:!0,configurable:!0,get:function(){return e.width}},height:{enumerable:!0,configurable:!0,get:function(){return e.height}},id:{enumerable:!0,configurable:!0,get:function(){return e.id}},source:{enumerable:!0,configurable:!0,get:function(){return e.source&&e.source.pub},set:function(n){e.setSource(n)}}}),e.methods)e.methods.hasOwnProperty(n)&&(this[n]=function(n){return function(){n.apply(e,arguments)&&e.setTransformDirty()}}(e.methods[n]));for(n in e.inputs)e.inputs.hasOwnProperty(n)&&function(n,i){Object.defineProperty(r,n,{configurable:!0,enumerable:!0,get:function(){return i.get.call(e)},set:function(r){var o,s,a,c;o=r,s=e.inputElements[n],"string"==typeof o&&isNaN(o)&&("enum"===i.type?i.options.hasOwnProperty(o)||(o=L(o,["select"])):"number"===i.type||"boolean"===i.type?o=L(o,["input","select"]):"image"===i.type&&(o=L(o,["canvas","img","video"]))),H(o,"HTMLInputElement")||H(o,"HTMLSelectElement")?(a=o.value,s&&s.element!==o&&(s.element.removeEventListener("change",s.listener,!0),s.element.removeEventListener("input",s.listener,!0),delete e.inputElements[n],s=null),s||(s={element:o,listener:(c=o,function(){var r,i;r="checkbox"===o.type?o.checked:c.value,i=e.setInput(n,r),"color"===o.type&&(i=V(i)),i!==r&&(c.value=i)})},e.inputElements[n]=s,"range"===o.type&&o.addEventListener("input",s.listener,!0),o.addEventListener("change",s.listener,!0)),s&&"checkbox"===o.type&&(a=o.checked)):(s&&(s.element.removeEventListener("change",s.listener,!0),s.element.removeEventListener("input",s.listener,!0),delete e.inputElements[n]),a=o),e.setInput(n,a)}})}(n,e.inputs[n]);this.update=function(){e.setDirty()},this.inputs=function(n){var r,i,o,s;if(o=e.plugin.inputs,n)return(i=o[n])&&!i.method?(r={type:i.type,defaultValue:i.defaultValue,title:i.title||n},"number"===i.type?(r.min=i.min,r.max=i.max,r.step=i.step,r.mod=i.mod):"enum"===i.type?r.options=U({},i.options):"vector"===i.type&&(r.dimensions=i.dimensions),i.description&&(r.description=i.description),r):null;for(s in r={},o)o.hasOwnProperty(s)&&!o[s].method&&(r[s]=this.inputs(s));return r},this.alias=function(n,r){return e.alias(n,r),this},this.on=function(n,r){e.on(n,r)},this.off=function(n,r){e.off(n,r)},this.destroy=function(){var n,r;for(n in e.destroy(),this)this.hasOwnProperty(n)&&"isDestroyed"!==n&&"id"!==n&&((r=Object.getOwnPropertyDescriptor(this,n)).get||r.set||"function"!=typeof this[n]?delete this[n]:this[n]=R)},this.isDestroyed=function(){return e.isDestroyed},this.isReady=function(){return e.ready}},(C=function(e,n){var r,i,o,s,a;for(r in this.matrix=new Float32Array(16),this.cumulativeMatrix=new Float32Array(16),this.ready=!1,this.width=1,this.height=1,this.seriously=q,this.transformRef=p[e],this.hook=e,this.id=Q,Q++,this.options=n,this.sources=null,this.targets=[],this.inputElements={},this.inputs={},this.methods={},this.listeners={},this.texture=null,this.frameBuffer=null,this.uniforms=null,this.dirty=!0,this.transformDirty=!0,this.renderDirty=!1,this.isDestroyed=!1,this.transformed=!1,this.plugin=U({},this.transformRef),this.transformRef.definition&&U(this.plugin,this.transformRef.definition.call(this,n)),this.plugin.inputs)this.plugin.inputs.hasOwnProperty(r)&&((i=this.plugin.inputs[r]).method&&"function"==typeof i.method?this.methods[r]=i.method:"function"==typeof i.set&&"function"==typeof i.get&&(this.inputs[r]=i));for(r in $(this.plugin),a=es[e],this.plugin.inputs)this.plugin.inputs.hasOwnProperty(r)&&"function"==typeof(i=this.plugin.inputs[r]).set&&"function"==typeof i.get&&"function"!=typeof i.method&&(o=i.get.call(this),s=void 0===i.defaultValue?o:i.defaultValue,s=i.validate.call(this,s,i,o),a&&void 0!==a[r]&&(s=i.validate.call(this,a[r],i,i.defaultValue,s),a[r]=s),s!==o&&i.set.call(this,s));z.push(this),X[this.id]=this,this.pub=new k(this),et.push(this),y[e].push(this)}).prototype=Object.create(v.prototype),C.prototype.constructor=C,C.prototype.setDirty=function(){this.renderDirty=!0,v.prototype.setDirty.call(this)},C.prototype.setTransformDirty=function(){var e,n;for(this.transformDirty=!0,this.dirty=!0,this.renderDirty=!0,e=0;e<this.targets.length;e++)(n=this.targets[e]).setTransformDirty?n.setTransformDirty():n.setDirty()},C.prototype.resize=function(){var e;for(v.prototype.resize.call(this),this.plugin.resize&&this.plugin.resize.call(this),e=0;e<this.targets.length;e++)this.targets[e].resize();this.setTransformDirty()},C.prototype.setSource=function(e){var n;if((n=eb(e))!==this.source){if(e_(n,this))throw Error("Attempt to make cyclical connection.");this.source&&this.source.removeTarget(this),this.source=n,n.addTarget(this),n&&n.ready?this.setReady():this.setUnready(),this.resize()}},C.prototype.addTarget=function(e){var n;for(n=0;n<this.targets.length;n++)if(this.targets[n]===e)return;this.targets.push(e)},C.prototype.removeTarget=function(e){var n=this.targets&&this.targets.indexOf(e);n>=0&&this.targets.splice(n,1),this.targets&&this.targets.length&&this.resize()},C.prototype.setInput=function(e,n){var r,i,o;if(this.plugin.inputs.hasOwnProperty(e))return r=this.plugin.inputs[e],i=es[this.hook]&&void 0!==es[this.hook][e]?es[this.hook][e]:r.defaultValue,o=r.get.call(this),void 0===i&&(i=o),n=r.validate.call(this,n,r,i,o),r.set.call(this,n)&&this.setTransformDirty(),r.get.call(this)},C.prototype.alias=function(e,n){var r,i,o=this;if(N.indexOf(n)>=0)throw Error("'"+n+"' is a reserved name and cannot be used as an alias.");return this.plugin.inputs.hasOwnProperty(e)&&(n||(n=e),q.removeAlias(n),(r=this.inputs[e])?(i=o.inputs[e],Object.defineProperty(q,n,{configurable:!0,enumerable:!0,get:function(){return i.get.call(o)},set:function(e){i.set.call(o,e)&&o.setTransformDirty()}})):(r=this.methods[e])&&(i=r,q[n]=function(){i.apply(o,arguments)&&o.setTransformDirty()}),r&&(er[n]={node:this,input:e})),this},C.prototype.render=function(e){return this.source?(this.source.render(),this.transformDirty&&(this.transformed?this.source.cumulativeMatrix?P.multiply(this.cumulativeMatrix,this.matrix,this.source.cumulativeMatrix):P.copy(this.cumulativeMatrix,this.matrix):P.copy(this.cumulativeMatrix,this.source.cumulativeMatrix||o),this.transformDirty=!1),e&&i?(this.renderDirty&&(this.frameBuffer||(this.uniforms={resolution:[this.width,this.height]},this.frameBuffer=new J(i,this.width,this.height)),this.uniforms.source=this.source.texture,this.uniforms.transform=this.cumulativeMatrix||o,ey(u,d,this.uniforms,this.frameBuffer.frameBuffer,this),this.renderDirty=!1),this.texture=this.frameBuffer.texture):this.source?this.texture=this.source.texture:this.texture=null,this.dirty=!1,this.texture):(this.transformDirty&&(P.copy(this.cumulativeMatrix,this.matrix),this.transformDirty=!1),this.texture=null,void(this.dirty=!1))},C.prototype.readPixels=function(e,n,r,o,s){var a=this.gl||i;if(!i)throw Error("Cannot read pixels until a canvas is connected");if(this.render(!0),void 0===s)s=new Uint8Array(r*o*4);else if(!H(s,"Uint8Array"))throw Error("Incompatible array type");return a.bindFramebuffer(i.FRAMEBUFFER,this.frameBuffer.frameBuffer),a.readPixels(e,n,r,o,i.RGBA,i.UNSIGNED_BYTE,s),s},C.prototype.destroy=function(){var e,n,r,i=this.hook;for(e in this.plugin.destroy&&"function"==typeof this.plugin.destroy&&this.plugin.destroy.call(this),delete this.effect,this.frameBuffer&&(this.frameBuffer.destroy(),delete this.frameBuffer,delete this.texture),this.inputElements)this.inputElements.hasOwnProperty(e)&&((r=this.inputElements[e]).element.removeEventListener("change",r.listener,!0),r.element.removeEventListener("input",r.listener,!0));for(this.source&&this.source.removeTarget(this);this.targets.length;)(r=this.targets.pop())&&r.removeSource&&r.removeSource(this);for(n in this)this.hasOwnProperty(n)&&"id"!==n&&delete this[n];for(n in er)er.hasOwnProperty(n)&&(r=er[n]).node===this&&q.removeAlias(n);(e=et.indexOf(this))>=0&&et.splice(e,1),(e=y[i].indexOf(this))>=0&&y[i].splice(e,1),v.prototype.destroy.call(this)},C.prototype.setReady=v.prototype.setReady,C.prototype.setUnready=v.prototype.setUnready,C.prototype.on=v.prototype.on,C.prototype.off=v.prototype.off,C.prototype.emit=v.prototype.emit,(n=H(n,"HTMLCanvasElement")?{canvas:n}:n||{}).canvas,this.effect=function(e,n){if(!f[e])throw Error("Unknown effect: "+e);return new T(e,n).pub},this.source=function(e,n,r){return eb(e,n,r).pub},this.transform=function(e,r){if("string"!=typeof e&&(r=e,e=!1),e){if(!p[e])throw Error("Unknown transform: "+e)}else if(!p[e=n&&n.defaultTransform||"2d"])throw Error("No transform specified");return new C(e,r).pub},this.target=function(e,n,r){var i,o,s;for(e&&"string"==typeof e&&!m[e]&&(o=l.querySelector(e)),("string"!=typeof e||!n&&0!==n||o)&&(r&&"object"===cZ(r)||(r=n),n=o||e,e=null),"string"==typeof n&&isNaN(n)&&(n=l.querySelector(n)),s=0;s<ee.length;s++)if(i=ee[s],(!e||e===i.hook)&&(i.target===n||i.compare&&i.compare(n,r)))return i.pub;return(i=new x(e,n,r)).pub},this.aliases=function(){return Object.keys(er)},this.removeAlias=function(e){er[e]&&(delete this[e],delete er[e])},this.defaults=function(e,n){var r;if(e)if("object"!==cZ(e))null===n?delete es[e]:"object"===cZ(n)&&(es[e]=U({},n));else for(r in e)e.hasOwnProperty(r)&&this.defaults(r,e[r]);else if(null===e)for(r in es)es.hasOwnProperty(r)&&delete es[r]},this.go=function(e,n){var r;for("function"==typeof e&&0>ei.indexOf(e)&&ei.push(e),"function"==typeof n&&0>eo.indexOf(n)&&eo.push(n),ec=!0,r=0;r<ee.length;r++)ee[r].go();!B&&(ei.length||eo.length)&&eg()},this.stop=function(){ei.length=0,eo.length=0,A(B),B=0},this.render=function(){var e;for(e=0;e<ee.length;e++)ee[e].render(n)},this.destroy=function(){for(var e,n;z.length;)z[0].pub.destroy();for(e in this)this.hasOwnProperty(e)&&"isDestroyed"!==e&&"id"!==e&&((n=Object.getOwnPropertyDescriptor(this,e)).get||n.set||"function"!=typeof this[e]?delete this[e]:this[e]=R);q=null,Z=[],ee=[],en=[],z=[],ei.length=0,eo.length=0,A(B),B=0,ed=!0},this.isDestroyed=function(){return ed},this.incompatible=function(e){var n,r,i=!1;if(i=Y.incompatible(e))return i;if(!e){for(n in g)if(g.hasOwnProperty(n)&&g[n].length&&(r=f[n])&&"function"==typeof r.compatible&&!r.compatible.call(this))return"plugin-"+n;for(n in b)if(b.hasOwnProperty(n)&&b[n].length&&(r=h[n])&&"function"==typeof r.compatible&&!r.compatible.call(this))return"source-"+n}return!1},this.isNode=function(e){var n;return!(!e||!(n=X[e.id])||n.isDestroyed)},this.isSource=function(e){return this.isNode(e)&&e instanceof O},this.isEffect=function(e){return this.isNode(e)&&e instanceof E},this.isTransform=function(e){return this.isNode(e)&&e instanceof k},this.isTarget=function(e){return this.isNode(e)&&e instanceof D},Object.defineProperties(this,{id:{enumerable:!0,configurable:!0,get:function(){return F}}}),this.defaults(n.defaults)}return e.addEventListener("message",function(n){n.source===e&&"seriously-timeout-message"===n.data&&(n.stopPropagation(),v.length>0&&v.shift()())},!0),J.prototype.resize=function(e,n){var r=this.gl;this.width===e&&this.height===n||(this.width=e,this.height=n,r&&(r.bindTexture(r.TEXTURE_2D,this.texture),r.bindFramebuffer(r.FRAMEBUFFER,this.frameBuffer),r.bindRenderbuffer(r.RENDERBUFFER,this.renderBuffer),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e,n,0,r.RGBA,r.UNSIGNED_BYTE,null),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_COMPONENT16,e,n),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,this.texture,0),r.bindTexture(r.TEXTURE_2D,null),r.bindRenderbuffer(r.RENDERBUFFER,null),r.bindFramebuffer(r.FRAMEBUFFER,null)))},J.prototype.destroy=function(){var e=this.gl;e&&(e.deleteFramebuffer(this.frameBuffer),e.deleteRenderbuffer(this.renderBuffer),this.ownTexture&&e.deleteTexture(this.texture)),delete this.frameBuffer,delete this.renderBuffer,delete this.texture,delete this.gl},K.prototype.use=function(){this.gl.useProgram(this.program)},Y.incompatible=function(n){var r,o,s;if(void 0===i&&((r=l.createElement("canvas"))&&r.getContext?e.WebGLRenderingContext?(o=X())||(i="context"):i="webgl":i="canvas"),i)return i;if(n){if((s=f[n])&&"function"==typeof s.compatible&&!s.compatible(o))return"plugin-"+n;if((s=h[n])&&"function"==typeof s.compatible&&!s.compatible(o))return"source-"+n}return!1},Y.plugin=function(e,n,r){var i;if(f[e])Y.logger.warn("Effect ["+e+"] already loaded");else if(void 0===r&&"object"===cZ(n)&&(r=n),r)return i=U({},r),"function"==typeof n&&(i.definition=n),i.reserved=D,i.inputs&&$(i),i.title||(i.title=e),f[e]=i,g[e]=[],i},Y.removePlugin=function(e){var n;if(!e||!f[e])return this;if(n=g[e]){for(;n.length;)n.shift().destroy();delete g[e]}return delete f[e],this},Y.source=function(e,n,r){var i;if(h[e])Y.logger.warn("Source ["+e+"] already loaded");else if(void 0===r&&"object"===cZ(n)&&(r=n),r||n)return i=U({},r),"function"==typeof n&&(i.definition=n),i.title||(i.title=e),h[e]=i,b[e]=[],i},Y.removeSource=function(e){var n;if(!e||!h[e])return this;if(n=b[e]){for(;n.length;)n.shift().destroy();delete b[e]}return delete h[e],this},Y.transform=function(e,n,r){var i;if(p[e])Y.logger.warn("Transform ["+e+"] already loaded");else if(void 0===r&&"object"===cZ(n)&&(r=n),r||n)return i=U({},r),"function"==typeof n&&(i.definition=n),i.reserved=B,i.inputs&&$(i),i.title||(i.title=e),p[e]=i,y[e]=[],i},Y.removeTransform=function(e){var n;if(!e||!p[e])return this;if(n=y[e]){for(;n.length;)n.shift().destroy();delete y[e]}return delete p[e],this},Y.target=function(e,n,r){var i;if(m[e])Y.logger.warn("Target ["+e+"] already loaded");else if(void 0===r&&"object"===cZ(n)&&(r=n),r||n)return i=U({},r),"function"==typeof n&&(i.definition=n),i.title||(i.title=e),m[e]=i,_[e]=[],i},Y.removeTarget=function(e){var n;if(!e||!m[e])return this;if(n=_[e]){for(;n.length;)n.shift().destroy();delete _[e]}return delete m[e],this},Y.inputValidators={color:function(e,n,i,o){var s,a,c,d;if(a=o||[],"string"==typeof e){if((c=C.exec(e))&&c.length){if(c.length<3)return a[0]=a[1]=a[2]=a[3]=0,a;for(a[3]=1,d=0;d<3;d++)a[d]=parseFloat(c[d+2])/255;return isNaN(c[6])||(a[3]=parseFloat(c[6])),"hsl"===c[1].toLowerCase()?q(a[0],a[1],a[2],a[3],a):a}if((c=x.exec(e))&&c.length)return 3===(s=c[1]).length?(a[0]=parseInt(s[0],16)/15,a[1]=parseInt(s[1],16)/15,a[2]=parseInt(s[2],16)/15,a[3]=1):4===s.length?(a[0]=parseInt(s[0],16)/15,a[1]=parseInt(s[1],16)/15,a[2]=parseInt(s[2],16)/15,a[3]=parseInt(s[3],16)/15):6===s.length?(a[0]=parseInt(s.substr(0,2),16)/255,a[1]=parseInt(s.substr(2,2),16)/255,a[2]=parseInt(s.substr(4,2),16)/255,a[3]=1):8===s.length?(a[0]=parseInt(s.substr(0,2),16)/255,a[1]=parseInt(s.substr(2,2),16)/255,a[2]=parseInt(s.substr(4,2),16)/255,a[3]=parseInt(s.substr(6,2),16)/255):a[0]=a[1]=a[2]=a[3]=0,a;if(c=T[e.toLowerCase()]){for(d=0;d<4;d++)a[d]=c[d];return a}return r||(r=l.createElement("canvas").getContext("2d")),r.fillStyle=e,(s=r.fillStyle)&&"#000000"!==s?Y.inputValidators.color(s,n,i,o):(a[0]=a[1]=a[2]=a[3]=0,a)}if(z(e)){if((a=e).length<3)return a[0]=a[1]=a[2]=a[3]=0,a;for(d=0;d<3;d++)if(isNaN(a[d]))return a[0]=a[1]=a[2]=a[3]=0,a;return a.length<4&&a.push(1),a}if("number"==typeof e)return a[0]=a[1]=a[2]=e,a[3]=1,a;if("object"===cZ(e)){for(d=0;d<4;d++)null===e[s=O[d]]||isNaN(e[s])?a[d]=+(3===d):a[d]=e[s];return a}return a[0]=a[1]=a[2]=a[3]=0,a},number:function(e,n,r){return isNaN(e=parseFloat(e))?r||0:(n.mod&&(e-=n.mod*Math.floor(e/n.mod)),e<n.min?n.min:e>n.max?n.max:n.step?Math.round(e/n.step)*n.step:e)},enum:function(e,n,r){var i=n.options||[];return"string"==typeof e?e=e.toLowerCase():"number"==typeof e?e=e.toString():e||(e=""),i.hasOwnProperty(e)?e:r||""},vector:function(e,n,r,i){var o,s,a,c=n.dimensions||4;if(o=i||[],z(e)){for(s=0;s<c;s++)o[s]=e[s]||0;return o}if("object"===cZ(e)){for(s=0;s<c;s++)void 0===e[a=E[s]]&&(a=O[s]),o[s]=e[a]||0;return o}for(e=parseFloat(e)||0,s=0;s<c;s++)o[s]=e;return o},boolean:function(e){return!(!e||e&&e.toLowerCase&&"false"===e.toLowerCase())},string:function(e){return"string"==typeof e?e:0===e||e?e.toString?e.toString():String(e):""}},Y.prototype.effects=Y.effects=function(){var e,n,r,i,o,s={};for(e in f)if(f.hasOwnProperty(e)){for(o in r={title:(n=f[e]).title||e,description:n.description||"",inputs:{}},n.inputs)n.inputs.hasOwnProperty(o)&&(i=n.inputs[o],r.inputs[o]={type:i.type,defaultValue:i.defaultValue,step:i.step,min:i.min,max:i.max,mod:i.mod,minCount:i.minCount,maxCount:i.maxCount,dimensions:i.dimensions,title:i.title||o,description:i.description||"",options:i.options||[]});s[e]=r}return s},e.Float32Array&&(o=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])),e.Seriously&&"object"===cZ(e.Seriously)&&function(){var n;for(n in e.Seriously)e.Seriously.hasOwnProperty(n)&&"plugin"!==n&&"object"===cZ(e.Seriously[n])&&Y.plugin(n,e.Seriously[n])}(),Y.logger={log:F("log"),info:F("info"),warn:F("warn"),error:F("error")},Y.util={mat4:P,checkSource:function(n){var r,i,o,s;if(!(r=L(n,["img","canvas","video"])))return!1;if(!(i=l.createElement("canvas")))return Y.logger.warn("Browser does not support canvas or Seriously.js"),!1;if(0===r.naturalWidth&&"IMG"===r.tagName)return Y.logger.warn("Image not loaded"),!1;if(0===r.readyState&&0===r.videoWidth&&"VIDEO"===r.tagName)return Y.logger.warn("Video not loaded"),!1;if(o=X()){(s=o.createTexture())||Y.logger.error("Test WebGL context has been lost"),o.bindTexture(o.TEXTURE_2D,s);try{o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,r)}catch(n){return n.code===e.DOMException.SECURITY_ERR?Y.logger.log("Unable to access cross-domain image"):Y.logger.error("Error storing image to texture: "+n.message),o.deleteTexture(s),!1}o.deleteTexture(s)}else{o=i.getContext("2d");try{o.drawImage(r,0,0),o.getImageData(0,0,1,1)}catch(n){return n.code===e.DOMException.SECURITY_ERR?Y.logger.log("Unable to access cross-domain image"):Y.logger.error("Error drawing image to canvas: "+n.message),!1}}return!0},hslToRgb:q,colors:T,setTimeoutZero:G,ShaderProgram:K,FrameBuffer:J,requestAnimationFrame:j,shader:{makeNoise:"float makeNoise(float u, float v, float timer) {\n float x = u * v * mod(timer * 1000.0, 100.0);\n x = mod(x, 13.0) * mod(x, 127.0);\n float dx = mod(x, 0.01);\n return clamp(0.1 + dx * 100.0, 0.0, 1.0);\n}\n",random:"#ifndef RANDOM\n#define RANDOM\nfloat random(vec2 n) {\n return 0.5 + 0.5 * fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453);\n}\n#endif\n"}},Y.source("video",function(n,r,i){var o,a,c=this,d=!1,u=!1,f=!1,p=0;function h(){n.removeEventListener("loadedmetadata",h,!0),d||(n.videoWidth?(c.width===n.videoWidth&&c.height===n.videoHeight||(c.width=n.videoWidth,c.height=n.videoHeight,c.resize()),u&&c.setReady()):(u=!0,setTimeout(h,50)))}function m(){f=!0}function v(){f=!1,c.setDirty()}if(H(n,"HTMLVideoElement"))return n.readyState?h():(u=!0,n.addEventListener("loadedmetadata",h,!0)),n.addEventListener("seeking",m,!1),n.addEventListener("seeked",v,!1),{deferTexture:u,source:n,render:function r(i){var d;if(p=n.currentTime,!n.videoHeight||!n.videoWidth)return!1;s?(a||((o=(a=l.createElement("canvas").getContext("2d")).canvas).width=c.width,o.height=c.height),d=o,a.drawImage(n,0,0,c.width,c.height)):d=n,i.bindTexture(i.TEXTURE_2D,c.texture),i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,c.flip),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,d),void 0===s){if(i.getError()===i.INVALID_VALUE)return s=!0,r(i);s=!1}return!0}catch(n){n.code===e.DOMException.SECURITY_ERR?(c.allowRefresh=!1,Y.logger.error("Unable to access cross-domain image")):Y.logger.error("Error rendering video source",n)}return!1},checkDirty:function(){return!f&&n.currentTime!==p},compare:function(e){return c.source===e},destroy:function(){d=!0,n.removeEventListener("seeking",m,!1),n.removeEventListener("seeked",v,!1),n.removeEventListener("loadedmetadata",h,!0)}}},{title:"Video"}),Y.transform("2d",function(e){var n=this,r=!(e&&e.radians),i=0,o=0,s=1,a=1,c=0,d=0,l=0,u=0,f=0;function p(){var e,p,h,m,v,g,y,b,_,w,S,R=n.matrix;function T(e,n){R[12]=R[0]*e+R[4]*n+R[12],R[13]=R[1]*e+R[5]*n+R[13],R[14]=R[2]*e+R[6]*n+R[14],R[15]=R[3]*e+R[7]*n+R[15]}c||d||l||u||f||1!==s||1!==a?(P.identity(R),T(c+i,d+o),u&&(R[4]=u/n.width),f&&(R[1]=f/n.height),l&&(m=R[0],v=R[1],g=R[2],y=R[3],b=R[4],_=R[5],w=R[6],S=R[7],p=Math.sin(e=-(r?l*Math.PI/180:l)),h=Math.cos(e),R[0]=m*h+b*p,R[1]=v*h+_*p,R[2]=g*h+w*p,R[3]=y*h+S*p,R[4]=b*h-m*p,R[5]=_*h-v*p,R[6]=w*h-g*p,R[7]=S*h-y*p),1!==s&&(R[0]*=s,R[1]*=s,R[2]*=s,R[3]*=s),1!==a&&(R[4]*=a,R[5]*=a,R[6]*=a,R[7]*=a),T(-i,-o),n.transformed=!0):n.transformed=!1}return{inputs:{reset:{method:function(){return i=0,o=0,s=1,a=1,c=0,d=0,l=0,u=0,f=0,!!n.transformed&&(n.transformed=!1,!0)}},translate:{method:function(e,n){return isNaN(e)&&(e=c),isNaN(n)&&(n=d),(e!==c||n!==d)&&(c=e,d=n,p(),!0)},type:["number","number"]},translateX:{get:function(){return c},set:function(e){return e!==c&&(c=e,p(),!0)},type:"number"},translateY:{get:function(){return d},set:function(e){return e!==d&&(d=e,p(),!0)},type:"number"},rotation:{get:function(){return l},set:function(e){return e!==l&&(l=parseFloat(e),p(),!0)},type:"number"},center:{method:function(e,n){return isNaN(e)&&(e=i),isNaN(n)&&(n=o),(e!==i||n!==o)&&(i=e,o=n,p(),!0)},type:["number","number"]},centerX:{get:function(){return i},set:function(e){return e!==i&&(i=e,p(),!0)},type:"number"},centerY:{get:function(){return o},set:function(e){return e!==o&&(o=e,p(),!0)},type:"number"},skew:{method:function(e,n){return isNaN(e)&&(e=u),isNaN(n)&&(n=f),(e!==u||n!==f)&&(u=e,f=n,p(),!0)},type:["number","number"]},skewX:{get:function(){return u},set:function(e){return e!==u&&(u=e,p(),!0)},type:"number"},skewY:{get:function(){return f},set:function(e){return e!==f&&(f=e,p(),!0)},type:"number"},scale:{method:function(e,n){var r,i;if(r=isNaN(e)?s:e,isNaN(n)){if(isNaN(e))return!1;i=r}else i=n;return(r!==s||i!==a)&&(s=r,a=i,p(),!0)},type:["number","number"]},scaleX:{get:function(){return s},set:function(e){return e!==s&&(s=e,p(),!0)},type:"number"},scaleY:{get:function(){return a},set:function(e){return e!==a&&(a=e,p(),!0)},type:"number"}}}},{title:"2D Transform",description:"Translate, Rotate, Scale, Skew"}),Y.transform("flip",function(){var e=this,n=!0;function r(){var r=e.matrix;n?(r[0]=-1,r[5]=1):(r[0]=1,r[5]=-1)}return P.identity(e.matrix),r(),e.transformDirty=!0,e.transformed=!0,{inputs:{direction:{get:function(){return n?"horizontal":"vertical"},set:function(e){var i;return(i="vertical"!==e)!==n&&(n=i,r(),!0)},type:"string"}}}},{title:"Flip",description:"Flip Horizontal/Vertical"}),Y.transform("reformat",function(){var e,n,r=this,i="contain";function o(){var o,s,a,c,d=r.matrix,l=e||r.width,u=n||r.height,f=r.source,p=f&&f.width||1,h=f&&f.height||1;"distort"===i||l===p&&u===h?r.transformed=!1:(a=p/h,c=l/u,"none"===i?(o=p/l,s=h/u):"width"===i||"contain"===i&&c<=a?(o=1,s=c/a):"height"===i||"contain"===i&&c>a?(o=a/c,s=1):c>a?(o=1,s=c/a):(o=a/c,s=1),1!==o||1!==s?(P.identity(d),1!==o&&(d[0]*=o,d[1]*=o,d[2]*=o,d[3]*=o),1!==s&&(d[4]*=s,d[5]*=s,d[6]*=s,d[7]*=s),r.transformed=!0):r.transformed=!1)}function s(){return e||r.source&&r.source.width||1}function a(){return n||r.source&&r.source.height||1}return this.resize=function(){var e,n=s(),r=a();if(this.width!==n||this.height!==r)for(this.width=n,this.height=r,this.uniforms&&this.uniforms.resolution&&(this.uniforms.resolution[0]=n,this.uniforms.resolution[1]=r),this.frameBuffer&&this.frameBuffer.resize&&this.frameBuffer.resize(n,r),e=0;e<this.targets.length;e++)this.targets[e].resize();this.setTransformDirty(),o()},{inputs:{width:{get:s,set:function(n){return(n=Math.floor(n))===e||(e=n,this.resize()),!1},type:"number"},height:{get:a,set:function(e){return(e=Math.floor(e))===n||(n=e,this.resize()),!1},type:"number"},mode:{get:function(){return i},set:function(e){return e!==i&&(i=e,o(),!0)},type:"enum",options:["cover","contain","distort","width","height","none"]}}}},{title:"Reformat",description:"Change output dimensions"}),a="precision mediump float;\nattribute vec4 position;\nattribute vec2 texCoord;\nuniform vec2 resolution;\nuniform mat4 transform;\nvarying vec2 vTexCoord;\nvoid main(void) {\n vec4 screenPosition = vec4(position.xy * resolution / 2.0, position.z, position.w);\n screenPosition = transform * screenPosition;\n gl_Position.xy = screenPosition.xy * 2.0 / resolution;\n gl_Position.z = screenPosition.z * 2.0 / (resolution.x / resolution.y);\n gl_Position.w = screenPosition.w;\n vTexCoord = texCoord;\n}\n",c="precision mediump float;\nvarying vec2 vTexCoord;\nuniform sampler2D source;\nvoid main(void) {\n gl_FragColor = texture2D(source, vTexCoord);\n}",Y.util.shader.noiseHelpers="#ifndef NOISE_HELPERS\n#define NOISE_HELPERS\nvec2 mod289(vec2 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec3 mod289(vec3 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec4 mod289(vec4 x) {\n return x - floor(x * (1.0 / 289.0)) * 289.0;\n}\nvec3 permute(vec3 x) {\n return mod289(((x*34.0)+1.0)*x);\n}\nvec4 permute(vec4 x) {\n return mod289(((x*34.0)+1.0)*x);\n}\nvec4 taylorInvSqrt(vec4 r) {\n return 1.79284291400159 - 0.85373472095314 * r;\n}\nfloat taylorInvSqrt(float r) {\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n#endif\n",Y.util.shader.snoise2d="#ifndef NOISE2D\n#define NOISE2D\nfloat snoise(vec2 v) {\n const vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0\n 0.366025403784439, // 0.5*(sqrt(3.0)-1.0)\n -0.577350269189626, // -1.0 + 2.0 * C.x\n 0.024390243902439); // 1.0 / 41.0\n vec2 i = floor(v + dot(v, C.yy));\n vec2 x0 = v - i + dot(i, C.xx);\n vec2 i1;\n //i1.x = step(x0.y, x0.x); // x0.x > x0.y ? 1.0 : 0.0\n //i1.y = 1.0 - i1.x;\n i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\n // x0 = x0 - 0.0 + 0.0 * C.xx ;\n // x1 = x0 - i1 + 1.0 * C.xx ;\n // x2 = x0 - 1.0 + 2.0 * C.xx ;\n vec4 x12 = x0.xyxy + C.xxzz;\n x12.xy -= i1;\n i = mod289(i); // Avoid truncation effects in permutation\n vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));\n vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);\n m = m*m ;\n m = m*m ;\n vec3 x = 2.0 * fract(p * C.www) - 1.0;\n vec3 h = abs(x) - 0.5;\n vec3 ox = floor(x + 0.5);\n vec3 a0 = x - ox;\n m *= 1.79284291400159 - 0.85373472095314 * (a0*a0 + h*h);\n vec3 g;\n g.x = a0.x * x0.x + h.x * x0.y;\n g.yz = a0.yz * x12.xz + h.yz * x12.yw;\n return 130.0 * dot(m, g);\n}\n#endif\n",Y.util.shader.snoise3d="#ifndef NOISE3D\n#define NOISE3D\nfloat snoise(vec3 v) {\n const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n vec3 i = floor(v + dot(v, C.yyy));\n vec3 x0 = v - i + dot(i, C.xxx) ;\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min(g.xyz, l.zxy);\n vec3 i2 = max(g.xyz, l.zxy);\n // x0 = x0 - 0.0 + 0.0 * C.xxx;\n // x1 = x0 - i1 + 1.0 * C.xxx;\n // x2 = x0 - i2 + 2.0 * C.xxx;\n // x3 = x0 - 1.0 + 3.0 * C.xxx;\n vec3 x1 = x0 - i1 + C.xxx;\n vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y\n vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y\n i = mod289(i);\n vec4 p = permute(permute(permute(\n i.z + vec4(0.0, i1.z, i2.z, 1.0))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0))\n + i.x + vec4(0.0, i1.x, i2.x, 1.0));\n float n_ = 0.142857142857; // 1.0/7.0\n vec3 ns = n_ * D.wyz - D.xzx;\n vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p, 7 * 7)\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_); // mod(j, N)\n vec4 x = x_ * ns.x + ns.yyyy;\n vec4 y = y_ * ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n vec4 b0 = vec4(x.xy, y.xy);\n vec4 b1 = vec4(x.zw, y.zw);\n //vec4 s0 = vec4(lessThan(b0, 0.0)) * 2.0 - 1.0;\n //vec4 s1 = vec4(lessThan(b1, 0.0)) * 2.0 - 1.0;\n vec4 s0 = floor(b0) * 2.0 + 1.0;\n vec4 s1 = floor(b1) * 2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy ;\n vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww ;\n vec3 p0 = vec3(a0.xy, h.x);\n vec3 p1 = vec3(a0.zw, h.y);\n vec3 p2 = vec3(a1.xy, h.z);\n vec3 p3 = vec3(a1.zw, h.w);\n vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n vec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);\n m = m * m;\n return 42.0 * dot(m*m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));\n}\n#endif\n",Y.util.shader.snoise4d="#ifndef NOISE4D\n#define NOISE4D\nvec4 grad4(float j, vec4 ip)\n {\n const vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);\n vec4 p, s;\n\n p.xyz = floor(fract (vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;\n p.w = 1.5 - dot(abs(p.xyz), ones.xyz);\n s = vec4(lessThan(p, vec4(0.0)));\n p.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;\n\n return p;\n }\n\n#define F4 0.309016994374947451\n\nfloat snoise(vec4 v)\n {\n const vec4 C = vec4(0.138196601125011, // (5 - sqrt(5))/20 G4\n 0.276393202250021, // 2 * G4\n 0.414589803375032, // 3 * G4\n -0.447213595499958); // -1 + 4 * G4\n\n vec4 i = floor(v + dot(v, vec4(F4)));\n vec4 x0 = v - i + dot(i, C.xxxx);\n\n\n vec4 i0;\n vec3 isX = step(x0.yzw, x0.xxx);\n vec3 isYZ = step(x0.zww, x0.yyz);\n i0.x = isX.x + isX.y + isX.z;\n i0.yzw = 1.0 - isX;\n i0.y += isYZ.x + isYZ.y;\n i0.zw += 1.0 - isYZ.xy;\n i0.z += isYZ.z;\n i0.w += 1.0 - isYZ.z;\n\n vec4 i3 = clamp(i0, 0.0, 1.0);\n vec4 i2 = clamp(i0 - 1.0, 0.0, 1.0);\n vec4 i1 = clamp(i0 - 2.0, 0.0, 1.0);\n\n vec4 x1 = x0 - i1 + C.xxxx;\n vec4 x2 = x0 - i2 + C.yyyy;\n vec4 x3 = x0 - i3 + C.zzzz;\n vec4 x4 = x0 + C.wwww;\n\n i = mod289(i);\n float j0 = permute(permute(permute(permute(i.w) + i.z) + i.y) + i.x);\n vec4 j1 = permute(permute(permute(permute (\n i.w + vec4(i1.w, i2.w, i3.w, 1.0))\n + i.z + vec4(i1.z, i2.z, i3.z, 1.0))\n + i.y + vec4(i1.y, i2.y, i3.y, 1.0))\n + i.x + vec4(i1.x, i2.x, i3.x, 1.0));\n\n vec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0) ;\n\n vec4 p0 = grad4(j0, ip);\n vec4 p1 = grad4(j1.x, ip);\n vec4 p2 = grad4(j1.y, ip);\n vec4 p3 = grad4(j1.z, ip);\n vec4 p4 = grad4(j1.w, ip);\n\n vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n p4 *= taylorInvSqrt(dot(p4, p4));\n\n vec3 m0 = max(0.6 - vec3(dot(x0, x0), dot(x1, x1), dot(x2, x2)), 0.0);\n vec2 m1 = max(0.6 - vec2(dot(x3, x3), dot(x4, x4)), 0.0);\n m0 = m0 * m0;\n m1 = m1 * m1;\n return 49.0 * (dot(m0*m0, vec3(dot(p0, x0), dot(p1, x1), dot(p2, x2)))\n + dot(m1*m1, vec2(dot(p3, x3), dot(p4, x4)))) ;\n}\n#endif\n",Y}(y=window),y.Seriously||(y.Seriously=b),c2.exports=b;var c3=c2.exports;window,console.info("seriously version: chroma"),c3.plugin("chroma",{shader:function(e,n){return n.vertex="precision mediump float;\nattribute vec4 position;\nattribute vec2 texCoord;\nuniform vec2 resolution;\nuniform mat4 transform;\nvarying vec2 vTexCoord;\nuniform vec4 screen;\nuniform float balance;\nvarying float screenSat;\nvarying vec3 screenPrimary;\nvoid main(void) {\n float fmin = min(min(screen.r, screen.g), screen.b);\n float fmax = max(max(screen.r, screen.g), screen.b);\n float secondaryComponents;\n screenPrimary = step(fmax, screen.rgb);\n secondaryComponents = dot(1.0 - screenPrimary, screen.rgb);\n screenSat = fmax - mix(secondaryComponents - fmin, secondaryComponents / 2.0, balance);\n vec4 screenPosition = vec4(position.xy * resolution / 2.0, position.z, position.w);\n screenPosition = transform * screenPosition;\n gl_Position = screenPosition;\n gl_Position.xy = screenPosition.xy * 2.0 / resolution;\n gl_Position.z = screenPosition.z * 2.0 / (resolution.x / resolution.y);\n vTexCoord = texCoord;\n}",n.fragment=[this.inputs.mask?"#define MASK":"","precision mediump float;\nvarying vec2 vTexCoord;\nuniform sampler2D source;\nuniform vec4 screen;\nuniform float screenWeight;\nuniform float balance;\nuniform float clipBlack;\nuniform float clipWhite;\nuniform bool mask;\nvarying float screenSat;\nvarying vec3 screenPrimary;\nvoid main(void) {\n float pixelSat, secondaryComponents;\n vec4 sourcePixel = texture2D(source, vTexCoord);\n\n if (screen.a == 0.0) {\n gl_FragColor = sourcePixel;\n return;\n }\n \n float fmin = min(min(sourcePixel.r, sourcePixel.g), sourcePixel.b);\n float fmax = max(max(sourcePixel.r, sourcePixel.g), sourcePixel.b);\n vec3 pixelPrimary = step(fmax, sourcePixel.rgb);\n secondaryComponents = dot(1.0 - pixelPrimary, sourcePixel.rgb);\n pixelSat = fmax - mix(secondaryComponents - fmin, secondaryComponents / 2.0, balance);\n float diffPrimary = dot(abs(pixelPrimary - screenPrimary), vec3(1.0));\n float solid = step(1.0, step(pixelSat, 0.1) + step(fmax, 0.1) + diffPrimary);\n float alpha = max(0.0, 1.0 - pixelSat / screenSat);\n alpha = smoothstep(clipBlack, clipWhite, alpha);\n vec4 semiTransparentPixel = vec4((sourcePixel.rgb - (1.0 - alpha) * screen.rgb * screenWeight) / max(0.00001, alpha), alpha);\n vec4 pixel = mix(semiTransparentPixel, sourcePixel, solid);\n#ifdef MASK\n gl_FragColor = vec4(vec3(pixel.a), 1.0);\n#else\n gl_FragColor = pixel;\n#endif\n}"].join("\n"),n},inPlace:!0,inputs:{source:{type:"image",uniform:"source"},screen:{type:"color",uniform:"screen",defaultValue:[66/255,195/255,31/255,1]},weight:{type:"number",uniform:"screenWeight",defaultValue:1,min:0},balance:{type:"number",uniform:"balance",defaultValue:1,min:0,max:1},clipBlack:{type:"number",uniform:"clipBlack",defaultValue:0,min:0,max:1},clipWhite:{type:"number",uniform:"clipWhite",defaultValue:1,min:0,max:1},mask:{type:"boolean",defaultValue:!1,uniform:"mask",shaderDirty:!0}},title:"Chroma Key",description:""}),window,console.info("seriously version: chroma_obs"),c3.plugin("chroma_obs",{shader:function(e,n){return n.vertex="precision mediump float;\nattribute vec4 position;\nattribute vec2 texCoord;\nuniform vec2 resolution;\nuniform mat4 transform;\nvarying vec2 vTexCoord;\nconst vec4 cb_v4 = vec4(-0.100644, -0.338572, 0.439216, 0.501961);\nconst vec4 cr_v4 = vec4(0.439216, -0.398942, -0.040274, 0.501961);\nuniform vec4 screen;\nuniform float similarity;\nuniform float smoothness;\nuniform float spill;\nuniform float contrast;\nuniform float gamma;\nvarying vec2 chroma_key;\nvarying vec2 pixel_size;\nvarying float similarity_v;\nvarying float smoothness_v;\nvarying float spill_v;\nvarying float contrast_v;\nvarying float gamma_v;\nvoid main(void) {\n float cb = dot(screen.rgb, cb_v4.xyz) + cb_v4.w;\n float cr = dot(screen.rgb, cr_v4.xyz) + cr_v4.w;\n chroma_key.x = cb;\n chroma_key.y = cr;\n pixel_size.x = 1.0 / resolution.x;\n pixel_size.y = 1.0 / resolution.y;\n similarity_v = similarity * 1.0 / 1000.0;\n smoothness_v = smoothness * 1.0 / 1000.0;\n spill_v = spill * 1.0 / 1000.0;\n contrast_v = (contrast < 0.0) ? (1.0 / (-contrast + 1.0)) : (contrast + 1.0);\n gamma_v = (gamma < 0.0) ? (-gamma + 1.0) : (1.0 / (gamma + 1.0));\n vec4 screenPosition = vec4(position.xy * resolution / 2.0, position.z, position.w);\n screenPosition = transform * screenPosition;\n gl_Position = screenPosition;\n gl_Position.xy = screenPosition.xy * 2.0 / resolution;\n gl_Position.z = screenPosition.z * 2.0 / (resolution.x / resolution.y);\n vTexCoord = texCoord;\n}",n.fragment=[this.inputs.mask?"#define MASK":"","precision mediump float;\nvarying vec2 vTexCoord;\nuniform bool mask;\nuniform vec4 screen;\nuniform sampler2D source;\nconst vec4 cb_v4 = vec4(-0.100644, -0.338572, 0.439216, 0.501961);\nconst vec4 cr_v4 = vec4(0.439216, -0.398942, -0.040274, 0.501961);\nuniform float opacity;\nuniform float brightness;\nvarying vec2 chroma_key;\nvarying vec2 pixel_size;\nvarying float similarity_v;\nvarying float smoothness_v;\nvarying float spill_v;\nvarying float contrast_v;\nvarying float gamma_v;\nvec4 CalcColor(vec4 rgba) {\n return vec4(pow(rgba.rgb, vec3(gamma_v, gamma_v, gamma_v)) * contrast_v + brightness, rgba.a);\n}\nfloat GetChromaDist(vec3 rgb) {\n float cb = dot(rgb.rgb, cb_v4.xyz) + cb_v4.w;\n float cr = dot(rgb.rgb, cr_v4.xyz) + cr_v4.w;\n return distance(chroma_key, vec2(cb, cr));\n}\nfloat GetNonlinearChannel(float u) {\n return u;\n}\nvec3 GetNonlinearColor(vec3 rgb)\n{\n return vec3(GetNonlinearChannel(rgb.r), GetNonlinearChannel(rgb.g), GetNonlinearChannel(rgb.b));\n}\nvec3 SampleTexture(vec2 uv)\n{\n vec3 rgb = texture2D(source, uv).rgb;\n return GetNonlinearColor(rgb);\n}\nfloat GetBoxFilteredChromaDist(vec3 rgb, vec2 texCoord) {\n vec2 h_pixel_size = pixel_size / 2.0;\n vec2 point_0 = vec2(pixel_size.x, h_pixel_size.y);\n vec2 point_1 = vec2(h_pixel_size.x, -pixel_size.y);\n float distVal = GetChromaDist(SampleTexture(texCoord-point_0));\n distVal += GetChromaDist(SampleTexture(texCoord+point_0));\n distVal += GetChromaDist(SampleTexture(texCoord-point_1));\n distVal += GetChromaDist(SampleTexture(texCoord+point_1));\n distVal *= 2.0;\n distVal += GetChromaDist(GetNonlinearColor(rgb));\n return distVal / 9.0;\n}\nvec4 ProcessChromaKey(vec4 rgba, vec2 uv)\n{\n float chromaDist = GetBoxFilteredChromaDist(rgba.rgb, uv);\n float baseMask = chromaDist - similarity_v;\n float fullMask = pow(clamp(baseMask / smoothness_v, 0.0, 1.0), 1.5);\n float spillVal = pow(clamp(baseMask / spill_v, 0.0, 1.0), 1.5);\n rgba.a *= opacity;\n rgba.a *= fullMask;\n float desat = dot(rgba.rgb, vec3(0.2126, 0.7152, 0.0722));\n rgba.rgb = mix(vec3(desat, desat, desat), rgba.rgb, spillVal);\n return CalcColor(rgba);\n}\nvoid main(void) {\n vec4 rgba = texture2D(source, vTexCoord);\n\n if (screen.w == 0.0) {\n gl_FragColor = rgba;\n return;\n }\n \n rgba.rgb *= (rgba.a > 0.) ? (1. / rgba.a) : 0.;\n rgba = ProcessChromaKey(rgba, vTexCoord);\n rgba.rgb *= rgba.a;\n#ifdef MASK\n gl_FragColor = vec4(vec3(rgba.a), 1.0);\n#else\n gl_FragColor = rgba;\n#endif\n}"].join("\n"),n},inPlace:!0,inputs:{source:{type:"image",uniform:"source"},screen:{type:"color",uniform:"screen",defaultValue:[0,1,0,1]},similarity:{type:"number",uniform:"similarity",defaultValue:400,min:1,max:1e3},smoothness:{type:"number",uniform:"smoothness",defaultValue:80,min:1,max:1e3},opacity:{type:"number",uniform:"opacity",defaultValue:1,min:0,max:1},contrast:{type:"number",uniform:"contrast",defaultValue:0,min:-4,max:4},brightness:{type:"number",uniform:"brightness",defaultValue:0,min:-1,max:1},gamma:{type:"number",uniform:"gamma",defaultValue:0,min:-1,max:1},spill:{type:"number",uniform:"spill",defaultValue:100,min:1,max:1e3},mask:{type:"boolean",defaultValue:!1,uniform:"mask",shaderDirty:!0}},title:"Chroma Key OBS",description:""}),window,console.info("seriously version: chroma_post"),c3.plugin("chroma_post",{shader:function(e,n){return n.vertex="precision mediump float;\nattribute vec4 position;\nattribute vec2 texCoord;\nuniform vec2 resolution;\nuniform mat4 transform;\nvarying vec2 vTexCoord;\nvarying vec2 pixel_size;\nvoid main(void) {\n pixel_size.x = 1.0 / resolution.x;\n pixel_size.y = 1.0 / resolution.y;\n vec4 screenPosition = vec4(position.xy * resolution / 2.0, position.z, position.w);\n screenPosition = transform * screenPosition;\n gl_Position = screenPosition;\n gl_Position.xy = screenPosition.xy * 2.0 / resolution;\n gl_Position.z = screenPosition.z * 2.0 / (resolution.x / resolution.y);\n vTexCoord = texCoord;\n}",n.fragment=[this.inputs.mask?"#define MASK":"","precision mediump float;\nvarying vec2 vTexCoord;\nuniform bool mask;\nuniform sampler2D source;\nuniform float edgeShrink;\nvarying vec2 pixel_size;\nconst int filter_size = 3;\nfloat edgeSmoothSuppKernelV2(vec4 rgba, vec2 coord) {\n float alpha = rgba.a;\n if (edgeShrink > 1.0) {\n float sum = 0.0;\n float weightSum = 0.0;\n // float sigma = 1.0f;\n for (int j = - filter_size / 2; j <= filter_size / 2; j++) {\n for (int i = - filter_size / 2; i <= filter_size / 2; i++) {\n // float weight = exp(-(i*i + j*j) / (2 * sigma * sigma)) / (2 * 3.1415926f * sigma * sigma);\n float weight = 1.0;\n vec4 neighborColor = texture2D(source, coord + vec2(i, j) * pixel_size);\n // speedup: move the powf to chroma_key\n float alpha_ker = pow(neighborColor.w, edgeShrink);\n sum += (alpha_ker * weight);\n weightSum += weight;\n }\n }\n alpha = sum * 1.0 / weightSum;\n }\n return alpha;\n}\nvoid main(void) {\n vec4 rgba = texture2D(source, vTexCoord);\n rgba.a = edgeSmoothSuppKernelV2(rgba, vTexCoord);\n rgba.a = pow(rgba.a, edgeShrink);\n#ifdef MASK\n gl_FragColor = vec4(vec3(rgba.a), 1.0);\n#else\n gl_FragColor = rgba;\n#endif\n}"].join("\n"),n},inPlace:!0,inputs:{source:{type:"image",uniform:"source"},edgeShrink:{type:"number",uniform:"edgeShrink",defaultValue:3,min:1,max:10},mask:{type:"boolean",defaultValue:!1,uniform:"mask",shaderDirty:!0}},title:"Chroma Key Post",description:""});class c4{seriously;version;defaultOptions={screen:[0,255,0,0]};targetElement;sourceElement;source=null;target=null;effect=null;backEffect=null;constructor(e,n,r,i=0){this.seriously=new window.Seriously,this.version=i,this.targetElement="string"==typeof e?document.getElementById(e):e,this.sourceElement="string"==typeof n?document.getElementById(n):n,this.init(r)}async loadEffect(e){return 1===e?"chroma":"chroma_obs"}async init(e){console.info("serious version:",this.version);let n=await this.loadEffect(this.version);await c1(()=>!(this.sourceElement?.videoWidth>0&&this.sourceElement?.videoHeight>0)),this.targetElement.width=this.sourceElement.videoWidth,this.targetElement.height=this.sourceElement.videoHeight,this.source=this.seriously.source(this.sourceElement),this.target=this.seriously.target(this.targetElement),this.effect=this.seriously.effect(n),this.backEffect=this.seriously.effect("chroma_post"),this.effect.source=this.source,this.backEffect.source=this.effect,this.target.source=this.backEffect,this.seriously.go(),this.setOptions(this.defaultOptions),e&&this.setOptions(e)}destroy(){this.seriously.destroy()}async updateSource(e){e&&this.effect&&this.backEffect?(this.sourceElement="string"==typeof e?document.getElementById(e):e,await c1(()=>!(this.sourceElement?.videoWidth>0&&this.sourceElement?.videoHeight>0)),this.source?.destroy(),console.info("update source: ",this.source?.isDestroyed()),this.source=this.seriously.source(this.sourceElement),this.effect.source=this.source,this.backEffect.source=this.effect,this.target.source=this.backEffect):console.warn("update source error: source or effect is null",e,this.effect)}async setOptions(e){if(this.defaultOptions={...this.defaultOptions,...e},!this.effect||!this.backEffect||cb()(e))return;console.info("set options: ",e);let{screen:n,edgeShrink:r}=e;if(n&&n.length>=3){let[e,r,i,o]=n;this.effect.screen=[e/255,r/255,i/255,cQ()(o)?o:1]}for(let[n,i]of(r&&(this.backEffect.edgeShrink=r),Object.entries(e)))"number"==typeof i&&"screen"!==n&&"edgeShrink"!==n&&(this.effect[n]=i)}}var c5={screen:[53,186,123],similarity:90,edgeShrink:3,smoothness:80,spill:100,opacity:1,contrast:0,brightness:0,gamma:0},c6=function(){function e(n){aw(this,e),aT(this,"cutoutInstance",void 0);var r=n.effects,i=n.sourceId;this.cutoutInstance=new c4("starling-cutout-canvas",i||"starling-cutout-video",r&&r.chromaKey||c5,r&&r.version||2)}return aR(e,[{key:"setOptions",value:function(e){e&&this.cutoutInstance&&this.cutoutInstance.setOptions(e)}},{key:"destroy",value:function(){return this.cutoutInstance.destroy()}},{key:"updateSource",value:function(e){return this.cutoutInstance.updateSource(e)}}]),e}(),c8=function(e,n){function r(e){aw(this,r),aT(this,"onAudioData",void 0),aT(this,"onError",void 0),aT(this,"audioContext",null),aT(this,"processor",null),aT(this,"mediaStream",null),aT(this,"recording",!1),this.onAudioData=e.onAudioData,this.onError=e.onError,this.preWarmStream()}return aR(r,[{key:"preWarmStream",value:function(){return(e=e||a_(ag().mark(function e(){var n;return ag().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.audioContext=new(window.AudioContext||window.webkitAudioContext)({sampleRate:16e3}),e.next=4,navigator.mediaDevices.getUserMedia({audio:!0,video:!1});case 4:this.mediaStream=e.sent,n=this.audioContext.createMediaStreamSource(this.mediaStream),this.processor=this.audioContext.createScriptProcessor(1024,1,1),n.connect(this.processor),this.processor.connect(this.audioContext.destination),this.processor.onaudioprocess=function(){},e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),console.error("preWarmStream error",e.t0);case 15:case"end":return e.stop()}},e,this,[[0,12]])}))).apply(this,arguments)}},{key:"start",value:function(){return(n=n||a_(ag().mark(function e(){var n=this;return ag().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.recording){e.next=2;break}return e.abrupt("return");case 2:if(this.audioContext&&this.processor){e.next=4;break}return e.abrupt("return");case 4:try{this.processor.onaudioprocess=function(e){if(n.recording){var r=function(e,n,r,i){try{for(var o=(i=i||{},"number"==typeof i.index)?i.index:0,s=i&&"number"==typeof i.offset?i.offset:0,a=0,c=o;c<e.length;c++)a+=e[c].length;a=Math.max(0,a-Math.floor(s));var d=n/r;d>1?a=Math.floor(a/d):(d=1,r=n);for(var l=new Int16Array(a),u=0,f=e.length;o<f;o++){for(var p=e[o],h=s,m=p.length;h<m;){var v=Math.floor(h),g=Math.ceil(h),y=h-v;l[u]=p[v]+(p[g]-p[v])*y,u++,h+=d}s=h-m}return{index:o,offset:s,sampleRate:r,data:l}}catch(e){console.log("转音错误了",e)}}([function(e){for(var n=new Int16Array(e.length),r=0;r<e.length;r++){var i=Math.max(-1,Math.min(1,e[r]));n[r]=i<0?32768*i:32767*i}return n}(e.inputBuffer.getChannelData(0))],n.audioContext.sampleRate,16e3,null);r&&r.data&&n.onAudioData(r.data.buffer)}},this.recording=!0}catch(e){this.onError&&this.onError(e)}case 5:case"end":return e.stop()}},e,this)}))).apply(this,arguments)}},{key:"stop",value:function(){this.recording=!1,this.processor.onaudioprocess=function(){}}},{key:"destroy",value:function(){this.recording=!1,this.processor&&(this.processor.disconnect(),this.processor.onaudioprocess=null),this.audioContext&&this.audioContext.close(),this.mediaStream&&this.mediaStream.getTracks().forEach(function(e){e.stop()})}}]),r}(),c9=function(){function e(n){var r,i=this;aw(this,e),aT(this,"token",void 0),aT(this,"appKey",void 0),aT(this,"appId",void 0),aT(this,"connectParams",void 0),aT(this,"onDigitalHumanCallback",void 0),aT(this,"dhServer",void 0),aT(this,"rtcServer",void 0),aT(this,"rtcConnectParams",void 0),aT(this,"cutoutInstance",void 0),aT(this,"isHuawei",(r=navigator.userAgent||navigator.vendor,/huawei/i.test(r)||/honor/i.test(r))),aT(this,"rtcServerUrl",void 0),aT(this,"recordController",null),aT(this,"wsReadyState",-1),aT(this,"isPreOpenSession",!1),aT(this,"onDigitalHumanCallbackPlus",function(e){var n;e.status===cv.DH_LIB_FULL_STATUS&&"wsState"===(null==(n=e.content)?void 0:n.type)&&(i.wsReadyState=e.content.readyState),i.onDigitalHumanCallback&&i.onDigitalHumanCallback(e)}),aT(this,"onRemoteVideoComing",function(e){i.rtcConnectParams&&i.rtcConnectParams.feedId&&e===+i.rtcConnectParams.feedId&&i.rtcServer&&i.rtcServer.client&&i.rtcServer.client.subscribeStreaming("remotevideo500",+i.rtcConnectParams.feedId)}),aT(this,"onLocalStream",function(){(i.connectParams||{}).pullAudioFromRtc&&i.rtcServer&&i.rtcServer.muteMicphone(!0)}),aT(this,"onRemoteVideoOn",function(){setTimeout(a_(ag().mark(function e(){var n,r,o,s,a;return ag().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=document.getElementById(c$),e.next=3,i.cutoutInstance&&i.cutoutInstance.updateSource(c$);case 3:n&&(n.setAttribute("data-playing","true"),r=n.videoWidth,o=n.videoHeight,a=(s=document.getElementById(cW)).getContext("2d"),s&&a&&(s.width=r,s.height=o,a.drawImage(n,0,0,r,o)));case 4:case"end":return e.stop()}},e)})),100)}),aT(this,"connectListener",function(e){var n=e.code,r=e.body,o=e.message;if(0===n&&i.onDigitalHumanCallback&&i.onDigitalHumanCallback({status:cv.DH_LIB_WS_SUCCESS,content:e}),0===n){var s=aP.parse(r),a=s.rtcServerUrl,c=s.appId,d=s.clientToken,l=s.roomName,u=s.clientId,f=s.feedId,p=s.chargeId;c&&l&&(i.rtcConnectParams={server:i.rtcServerUrl||a,appId:c,token:d,roomName:l,userId:u,feedId:f,chargeId:p},i.rtcServer&&i.rtcServer.openRtc(i.rtcConnectParams))}else i.onDigitalHumanCallback&&i.onDigitalHumanCallback({status:cv.DH_LIB_ERROR,content:{type:cg.CONNECT_ERROR,msg:{code:n,errMsg:o}}})}),aT(this,"createServer",function(e){var n,r=av(av(av({token:i.token,appKey:i.appKey,appId:i.appId},e?{sessionId:e}:{}),cR()(i.connectParams,cT)),{},{parameters:cw()(i.connectParams,cT),onConnect:i.connectListener,onDigitalHumanCallback:i.onDigitalHumanCallbackPlus});null!=(n=i.dhServer)&&n.preConnectSuccess?(i.dhServer.connectParams=r,i.dhServer&&i.dhServer.sendPreConnect(r)):i.dhServer&&i.dhServer.createSocket(r)}),aT(this,"checkHumanInstansce",function(){return i.dhServer?!(i.isPreOpenSession&&!i.dhServer.preConnectSuccess)||(i.onDigitalHumanCallback&&i.onDigitalHumanCallback({status:cv.DH_LIB_ERROR,content:{type:cg.CONNECT_ERROR,msg:{code:4001,errMsg:"webSocket连接中"}}}),!1):(i.onDigitalHumanCallback&&i.onDigitalHumanCallback({status:cv.DH_LIB_ERROR,content:{type:cg.CONNECT_ERROR,msg:{code:4002,errMsg:"请先初始化数字人实例"}}}),!1)}),aT(this,"sendMessage",function(e,n){return i.dhServer&&i.dhServer.sendMessage(e,n)}),aT(this,"interrupt",a_(ag().mark(function e(){return ag().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e){i.dhServer&&i.dhServer.sendMessage({requestId:rO(),action:"TEXT_RENDER",body:"<interrupt></interrupt>",clientTs:(new Date).getTime()},function(){return e()})}));case 1:case"end":return e.stop()}},e)}))),aT(this,"textRender",function(e){var n=e.requestId,r=e.body,o=e.onCallbackMsg;i.checkHumanInstansce()&&i.dhServer&&i.dhServer.sendMessage({requestId:n||rO(),action:"TEXT_RENDER",body:r,clientTs:(new Date).getTime()},o)}),aT(this,"textStreamRender",function(e){var n=e.requestId,r=e.body,o=e.onCallbackMsg,s=aP.parse(r).first;i.checkHumanInstansce()&&i.dhServer&&i.dhServer.sendMessage({requestId:n||rO(),action:"TEXT_STREAM_RENDER",body:r,clientTs:(new Date).getTime()},s?o:null)}),aT(this,"audioRender",function(e){var n=e.body,r=e.onCallbackMsg;i.checkHumanInstansce()&&i.dhServer&&i.dhServer.sendMessage({requestId:rO(),action:"AUDIO_RENDER",body:n,clientTs:(new Date).getTime()},r)}),aT(this,"audioStreamRender",function(e){var n=e.requestId,r=e.body,o=e.onCallbackMsg;i.checkHumanInstansce()&&i.dhServer&&i.dhServer.sendMessage({requestId:n||rO(),action:"AUDIO_STREAM_RENDER",body:r,clientTs:(new Date).getTime()},o)}),aT(this,"textQuery",function(e){var n=e.requestId,r=e.body,o=e.onCallbackMsg;i.dhServer&&i.dhServer.sendMessage({requestId:n||rO(),action:"TEXT_QUERY",body:r,clientTs:(new Date).getTime()},o)}),aT(this,"destroy",a_(ag().mark(function e(){var n;return ag().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.dhServer&&i.dhServer.closeSocket();case 2:i.rtcServer&&i.rtcServer.closeRtc(),function(){var e=document.getElementById(cX);e&&e.parentNode&&e.parentNode.removeChild(e)}(),null==(n=i.recordController)||n.destroy(),i.dhServer=null,i.rtcServer=null;case 7:case"end":return e.stop()}},e)}))),aT(this,"pauseHuman",function(){return cK(!1)}),aT(this,"playHuman",function(){return cK(!0)}),aT(this,"muteHuman",function(){return cJ(!0)}),aT(this,"unMuteHuman",function(){var e=cJ(!1);try{return i.isHuawei?(e.pause(),e.play()):e.paused&&e.play()}catch(e){console.info(e)}});var o=n.isPreOpenSession,s=void 0!==o&&o,a=n.wsUrl,c=n.renderParams,d=n.onDigitalHumanCallback;this.isPreOpenSession=s,this.dhServer=new cM(a||"wss://open.xiling.baidu.com/cloud/digital-human-demonstration"),this.onDigitalHumanCallback=function(e){e.status!==cv.DH_LIB_FULL_STATUS?d&&d(e):(null==c?void 0:c.fullStatus)&&d&&d(e)},s?this.dhServer.createSocket({onDigitalHumanCallback:this.onDigitalHumanCallbackPlus},s):this.init(n)}return aR(e,[{key:"init",value:function(e){var n,r=this,i=e.wrapperId,o=e.token,s=e.appKey,a=e.appId,c=e.connectParams,d=e.renderParams,l=void 0===d?{}:d,u=e.rtcConnectParams,f=e.brtcParams,p=e.rtcServerUrl;if(this.token=o,this.appKey=s,this.appId=a,this.rtcServerUrl=p,this.connectParams=av({autoChromaKey:(null==l?void 0:l.autoChromaKey)||!1},c),!a&&!s&&!o)throw Error("appId and appKey or token is required");var h=l.closeLog,m=(function(e){var n=e.autoChromaKey,r=void 0!==n&&n,i=e.autoplay;if(document.getElementById(c$))return console.error('DOM with id "'.concat(c$,'" already exists.')),null;var o=document.createElement("div");o.className=cX,o.id=cX,o.style.position="relative";var s=document.createElement("video");if(s.id=c$,s.width=0,s.height=0,s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("data-playing","true"),s.setAttribute("playsinline",""),(void 0===i||i)&&s.setAttribute("autoplay",""),o.appendChild(s),r){var a=document.createElement("canvas");a.id=cW,Object.assign(a.style,{position:"absolute",top:"0",left:"0",height:"100%",width:"100%",zIndex:"1",display:r?"block":"none"}),s.style.visibility="hidden",o.appendChild(a)}return{playerWrapper:o,video:s}}({autoChromaKey:!!l.autoChromaKey||!cb()(l.chromaEffects)})||{}).playerWrapper,v=document.getElementById(i||"");v||console.error("dom with wrapperId is not find"),m&&v&&v.appendChild(m),(n=document.createElement("style")).appendChild(document.createTextNode('\n [id^="videoremote1-"] {\n display: none !important;\n }\n \n video#remotevideo500 {\n width: auto !important;\n height: auto !important;\n max-width: 100% !important;\n max-height: 100% !important;\n width: 100% !important;\n height: 100% !important;\n object-fit: cover;\n }\n\n .cloud-brtc-player-wrapper {\n width: inherit !important;\n background-size: cover;\n height: inherit;\n display: flex;\n justify-content: center;\n }\n\n #starling-cutout-canvas {\n object-fit: cover;\n }\n ')),document.head.appendChild(n);var g=av({remotevideoviewid:i,showvideobps:!1,usingvideo:!1,usingaudio:!(null==c||!c.pullAudioFromRtc),aspublisher:!(null==c||!c.pullAudioFromRtc),autopublish:!(null==c||!c.pullAudioFromRtc),usingdatachannel:!0,autoplaymuted:!1},f);this.rtcServer=new cG({closeLog:h,videoWrapperId:c$,rtcConfig:g,bizConfig:{},rtcCallback:{onRemoteVideoComing:this.onRemoteVideoComing,onDigitalHumanCallback:this.onDigitalHumanCallback,onLocalStream:this.onLocalStream}}),(!cb()(null==l?void 0:l.chromaEffects)||null!=l&&l.autoChromaKey)&&(this.cutoutInstance=new c6({sourceId:c$,effects:null==l?void 0:l.chromaEffects})),cb()(u)||(this.rtcConnectParams=u,this.rtcServer.openRtc(u)),null!=c&&c.pullAudioFromRtc?this.recordController=null:this.recordController=new c8({pickAudioMode:null==c?void 0:c.pickAudioMode,onAudioData:function(e){1===r.wsReadyState&&r.sendMessage(e,null)},onError:function(e){r.onDigitalHumanCallback&&r.onDigitalHumanCallback({status:cv.DH_LIB_ERROR,content:{type:cg.CONNECT_ERROR,msg:{code:-1,errMsg:e.message}}})}})}},{key:"startRecord",value:function(){var e;null!=(e=this.connectParams)&&e.pullAudioFromRtc?this.rtcServer&&this.rtcServer.muteMicphone(!1):this.recordController&&this.recordController.start()}},{key:"stopRecord",value:function(){var e;null!=(e=this.connectParams)&&e.pullAudioFromRtc?this.rtcServer&&this.rtcServer.muteMicphone(!0):this.recordController&&this.recordController.stop(),this.sendMessage({action:"AUDIO_QUERY_INTERRUPT",requestId:rO(),clientTs:Date.now(),body:""},null)}}]),e}();class c7 extends sn{get ready(){return!!this.humanInstance&&!!this.token}constructor(...e){super(...e),this.humanInstance=null,this.requestId=rO(),this.isWSConnected=!1,this.isRtcReady=!1,this.isStreamTextRendering=!1,this.wsClosedCount=0,this.mount=async e=>{e?(this.humanInstance&&this.dispose(),e.id||(e.id=`dh-container-${rO()}`),this.opts.enableDebugMode&&"development"===this.opts.env&&!this.opts.token?this.token=await this.getAccessToken():this.token=this.opts.token,this.humanInstance=new c9({token:this.token,wrapperId:e.id,connectParams:this.buildConnectParams(),renderParams:this.buildRenderParams(),onDigitalHumanCallback:this.onDigitalHumanCallback}),this.humanInstance.createServer()):this.errorManager.handleError(new rd("容器元素不能为空"))},this.bindEvents=()=>this,this.unbindEvents=()=>this,this.renderPlainText=e=>{var n;if(!this.ready)return this;let r=this.runSsmlHandlers(e);return this.refreshRequestId(),null==(n=this.humanInstance)||n.textRender({requestId:this.requestId,body:r,onCallbackMsg:this.handleTextRenderCallback}),this},this.renderStreamText=(e,n)=>{var r;if(!this.ready)return this;let i=this.runSsmlHandlers(e),o=!this.isStreamTextRendering;return o&&(this.refreshRequestId(),this.isStreamTextRendering=!0),null==(r=this.humanInstance)||r.textStreamRender({requestId:this.requestId,body:JSON.stringify({first:o,last:null!=n&&n,text:i}),onCallbackMsg:this.handleTextRenderCallback}),n&&(this.isStreamTextRendering=!1),this},this.interrupt=()=>{var e;if(!this.ready)return this;let n=this.requestId;return null==(e=this.humanInstance)||e.interrupt().catch(e=>{e instanceof Error?this.errorManager.handleError(new ru(`打断当前数字员工播报失败:${e.message}`,{requestId:n})):"string"==typeof e&&this.errorManager.handleError(new ru(`打断当前数字员工播报失败:${e}`,{requestId:n}))}).finally(()=>{this.onRenderFinished(n)}),this},this.sendSilenceMessage=()=>{var e;if(!this.ready)return this;let n=rO();return null==(e=this.humanInstance)||e.textRender({requestId:n,body:"",onCallbackMsg:rI}),this.emitter.emit("send_silence_message",{requestId:n}).catch(rI),this},this.dispose=()=>{var e;return null==(e=this.humanInstance)||e.destroy().catch(rI),this.ssmlHandlers=[],this.isWSConnected=!1,this.isRtcReady=!1,this.wsClosedCount=0,this.isStreamTextRendering=!1,this.emitter.clearListeners(),this.humanInstance=null,this},this.GetRequestId=()=>this.requestId,this.checkIsReady=()=>{let e=this.isWSConnected&&this.isRtcReady;return e&&this.emitter.emit("ready").catch(rI),e},this.cancelMute=async()=>{var e;await (null==(e=this.humanInstance)?void 0:e.unMuteHuman()),this._isMuted=!1},this.muteHuman=()=>{var e;null==(e=this.humanInstance)||e.muteHuman(),this._isMuted=!0},this.play=async()=>{var e;await (null==(e=this.humanInstance)?void 0:e.playHuman())},this.pause=()=>{var e;null==(e=this.humanInstance)||e.pauseHuman()},this.buildConnectParams=()=>{var e,n,r,i,o;return{initMode:"noAudio",mode:"crop",figureId:this.opts.figureId,resolutionWidth:null!=(e=this.opts.figureResolutionWidth)?e:1920,resolutionHeight:null!=(n=this.opts.figureResolutionHeight)?n:1080,ttsPer:this.opts.ttsPer,ttsPitch:5,ttsSpeed:null!=(r=this.opts.speechSpeed)?r:6,ttsVolume:5,inactiveDisconnectSec:null!=(i=this.opts.timeoutSec)?i:130,preAlertSec:null!=(o=this.opts.disconnectAlertSec)?o:10,ttsSample:this.opts.ttsSample,ttsModel:this.opts.ttsModel,minSplitLen:this.opts.minSplitLen,positionV2:JSON.stringify(this.opts.position),ttsLang:rq(this.opts.lang)}},this.buildRenderParams=()=>{var e,n;return{autoChromaKey:null!=(e=this.opts.autoChromaKey)&&e,closeLog:!(null!=(n=this.opts.enableDebugMode)&&n),fullStatus:!1}},this.refreshRequestId=()=>{this.requestId=rO()},this.onRenderFinished=e=>{if(e!==this.requestId){this.isRendering&&this.errorManager.handleError(new ru(`[DigitalHuman] Received FINISHED signal
|
|
52
|
+
for ID ${e}, but current ID is ${this.requestId}.
|
|
53
|
+
Ignored.`));return}this._isRendering=!1,this.isStreamTextRendering=!1,this.emitter.emit("is_rendering_change",!1).catch(rI),this.refreshRequestId(),this.emitter.emit("render_finished",{requestId:e}).catch(rI)},this.onDigitalHumanCallback=e=>{let{status:n,content:r}=e;switch(n){case"DH_LIB_INIT":this.opts.enableDebugMode&&console.log("数字员工初始化中...");break;case"DH_LIB_WS_SUCCESS":this.isWSConnected=!0,this.wsClosedCount=0,this.checkIsReady();break;case"DH_LIB_OPEN":this.isRtcReady=!0,this.checkIsReady();break;case"DH_LIB_CLOSE":this.isWSConnected=!1,this.wsClosedCount++,this.wsClosedCount>=3&&(this.emitter.emit("reconnect_failed").catch(rI),this.errorManager.handleError(new rf("检测到 Websocket 链接异常断开,如长时间无法恢复,请联系技术支持。")));break;case"DH_LIB_ERROR":r&&this.handleError(r);break;case"DH_LIB_WARNING":this.opts.enableDebugMode&&console.warn("数字人警告:",r);break;case"DH_LIB_STATUS":r&&this.handleStatusMessage(r)}},this.handleStatusMessage=e=>{if(e&&"object"==typeof e){let{type:n}=e;switch(n){case"LOCAL_VIDEO_MUTED":this._isMuted=!0;break;case"TIMEOUT_EXIT":this.emitter.emit("timeout",{requestId:this.requestId}).catch(rI);break;case"DISCONNECT_ALERT":this.emitter.emit("disconnect_alert",{requestId:this.requestId}).catch(rI)}}},this.handleTextRenderCallback=e=>{let n=e.requestId;switch(e.action){case"RENDER_START":this._isRendering=!0,this.emitter.emit("is_rendering_change",!0).catch(rI);break;case"FINISHED":case"RENDER_INTERRUPTED":this.onRenderFinished(n);break;case"DOWN_SUBTITLE":if(e.body){let r=JSON.parse(e.body);this.emitter.emit("render_subtitle",{subtitle:r,requestId:n}).catch(rI)}break;case"RENDER_ERROR":this.onRenderFinished(n),this.errorManager.handleError(new ru("数字员工文本驱动渲染失败,请确认配置后重试",{requestId:n,context:{code:e.code,body:e.body}}));break;case"TEXT_RENDER":case"TEXT_STREAM_RENDER":0!==e.code&&(this.onRenderFinished(n),this.errorManager.handleError(new ru("数字员工文本驱动渲染失败,请确认配置后重试",{requestId:n,context:{code:e.code,body:e.body}})))}},this.handleError=e=>{if(!e||"object"!=typeof e)return;let{type:n,msg:r}=e;switch(n){case"CONNECT_ERROR":{let e=null==r?void 0:r.code;1004===e||3001===e?(this.emitter.emit("reach_session_limit",{requestId:this.requestId}).catch(rI),this.errorManager.handleError(new rm("资源配额已用尽,请联系技术支持申请扩容",{context:{code:e}}))):[1002,1003,1005,1009].includes(e)?this.errorManager.handleError(new rh((null==r?void 0:r.errMsg)||"认证失败",{context:{code:e}})):this.errorManager.handleError(new rf((null==r?void 0:r.errMsg)||"连接失败",{context:{code:e}}));break}case"RTC_ERROR":this.errorManager.handleError(new rp("RTC 房间连接失败,请检查网络后重试",{context:{msg:r}}));break;case"LOCAL_VIDEO_ERROR":this.errorManager.handleError(new ru("视频播放受限,请检查浏览器权限",{context:{msg:r}}))}}}}c7=function(e,n,r,i){var o,s=arguments.length,a=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,n,r,i);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(s<3?o(a):s>3?o(n,r,a):o(n,r))||a);return s>3&&a&&Object.defineProperty(n,r,a),a}([eg(),eb()],c7),"undefined"==typeof AbortSignal?console.warn("AbortSignal is not defined in this environment. The polyfill will not be installed."):(iW("any",iV.abortSignalAny),iW("timeout",iz.abortSignalTimeout),iW("abort",iG.abortSignalAbort));let de=e=>{var n;let r=new tZ({defaultScope:"Singleton"}),i={...rV,...e,hotWordReplacementRules:[...rB,...null!=(n=e.hotWordReplacementRules)?n:[]]};r.bind(nl.IOptions).toConstantValue(i),r.bind(nl.ErrorManager).to(rT),r.bind(nl.CommonRequest).to(nW);let{agentConfig:o,agentService:s,enableDebugMode:a}=i,c=!!(null==o?void 0:o.robotId),d=!!(null==o?void 0:o.token),l=!!s;if(l&&o&&a&&console.warn("[createAaaSPilotKit] agentService 已提供,agentConfig 配置将被忽略。"),!l&&!c&&!d)throw Error("[createAaaSPilotKit] 未检测到有效的 agent 配置,请至少提供 agentService 或 agentConfig 中的 robotId/token。");s?(Reflect.hasOwnMetadata("@inversifyjs/core/classIsInjectableFlagReflectKey",s)||(eo(eb(),s),eo(eg(),s)),r.bind(nl.AgentService).to(s)):d?r.bind(nl.AgentService).to(s_):c&&r.bind(nl.AgentService).to(sb),r.bind(nl.SignalingService).to(sC),r.bind(nl.ASRService).to(ah);let{rendererMode:u}=i;switch(u){case"cloud":default:r.bind(nl.DigitalHumanService).to(sp);break;case"cloud-native":r.bind(nl.DigitalHumanService).to(c7)}return r.bind(nl.ConversationService).to(iq),r.bind(nl.AaaSPilotKitController).to(sv),r.get(nl.AaaSPilotKitController)};function dt(e,n){let{onUpdate:r,onComplete:i}=n;if(!e)return()=>{};if(e.isCompleted())return null==r||r(e),null==i||i(e),()=>{};let o=e.emitter.on("update",e=>{let n=e.response;null==r||r(n),n.isCompleted()&&(null==i||i(n),o())});return o}})(),i})());
|