@tencentcloud/tccc-sip-js 0.1.0 → 0.1.2
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/README.md +2 -2
- package/jssip.cjs.js +1 -1
- package/jssip.esm.js +1 -1
- package/jssip.umd.js +1 -1
- package/package.json +1 -1
package/jssip.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("trtc-js-sdk")),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(r){var n,e=r.default;return"function"==typeof e?(n=function(){return e.apply(this,arguments)}).prototype=e.prototype:n={},Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(r).forEach(function(e){var t=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(n,e,t.get?t:{enumerable:!0,get:function(){return r[e]}})}),n}var o={name:"@tencentcloud/tccc-sip-js",title:"TCCCSIP",description:"TCCC JavaScript SIP SDK",version:"0.1.0",homepage:"https://tccc.qcloud.com",contributors:["TCCC Frontend Team"],types:"dist/jssip.d.ts",main:"dist/jssip.cjs.js",module:"dist/jssip.esm.js",browser:"dist/jssip.umd.js",miniprogram:"miniprogram_dist",exports:{".":{import:"dist/jssip.esm.js",require:"dist/index.cjs.js",browser:"dist/jssip.umd.js",types:"dist/jssip.d.ts",default:"dist/jssip.esm.js"}},files:["dist","miniprogram_dist"],keywords:["sip","websocket","webrtc","node","browser","library","tccc","腾讯云呼叫中心","腾讯云联络中心"],license:"MIT",peerDependencies:{"trtc-js-sdk":"^4.13.0"},dependencies:{debug:"^4.3.1",events:"^3.3.0","sdp-transform":"^2.14.1","trtc-js-sdk":"^4.13.0"},devDependencies:{"@babel/core":"^7.19.6","@babel/plugin-external-helpers":"^7.18.6","@babel/plugin-transform-runtime":"^7.18.10","@babel/preset-env":"^7.19.4","@opentelemetry/api":"^1.9.0","@opentelemetry/api-logs":"^0.208.0","@opentelemetry/exporter-logs-otlp-http":"^0.208.0","@opentelemetry/exporter-trace-otlp-http":"^0.208.0","@opentelemetry/resources":"^2.2.0","@opentelemetry/sdk-logs":"^0.208.0","@opentelemetry/sdk-trace-base":"^2.2.0","@opentelemetry/sdk-trace-web":"^2.2.0","@opentelemetry/semantic-conventions":"^1.38.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^22.0.2","@rollup/plugin-eslint":"^8.0.2","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.3.0","@rollup/plugin-replace":"^4.0.0","@rollup/plugin-typescript":"^8.4.0","@types/debug":"^4.1.5","@types/node":"^14.14.34","@typescript-eslint/eslint-plugin":"^5.36.2","@typescript-eslint/parser":"^5.36.2","ansi-colors":"^3.2.4",browserify:"^16.5.1","cross-env":"^7.0.3",eslint:"7.32.0","fancy-log":"^1.3.3",gulp:"^4.0.2","gulp-babel":"^8.0.0","gulp-eslint":"^5.0.0","gulp-expect-file":"^1.0.2","gulp-header":"^2.0.9","gulp-nodeunit-runner":"^0.2.2","gulp-plumber":"^1.2.1","gulp-rename":"^1.4.0","gulp-uglify-es":"^1.0.4","lodash.template":"^4.5.0",pegjs:"^0.7.0",rimraf:"^3.0.2",rollup:"^2.79.0","rollup-plugin-copy":"^3.4.0","rollup-plugin-dts":"^4.2.2","rollup-plugin-filesize":"^10.0.0","rollup-plugin-peer-deps-external":"^2.2.4","rollup-plugin-polyfill-node":"^0.10.2","rollup-plugin-progress":"^1.1.2","rollup-plugin-terser":"^7.0.2","rollup-plugin-uglify":"^6.0.4",typescript:"^4.8.2","vinyl-buffer":"^1.0.1","vinyl-source-stream":"^2.0.0"},scripts:{lint:"node npm-scripts.js lint",test:"node npm-scripts.js test",prepublish:"node npm-scripts.js prepublish",release:"node npm-scripts.js release",dev:"cross-env NODE_ENV=development rollup -c rollup.config.js -w",build:"cross-env rimraf dist && rollup -c rollup.config.js && node config/build-package.js",prepublishOnly:"npm run build",grammar:"gulp grammar"},packageManager:"pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748"},i=o,s={USER_AGENT:"".concat(i.title," ").concat(i.version),SIP:"sip",SIPS:"sips",causes:{CONNECTION_ERROR:"Connection Error",REQUEST_TIMEOUT:"Request Timeout",SIP_FAILURE_CODE:"SIP Failure Code",INTERNAL_ERROR:"Internal Error",BUSY:"Busy",REJECTED:"Rejected",REDIRECTED:"Redirected",UNAVAILABLE:"Unavailable",NOT_FOUND:"Not Found",ADDRESS_INCOMPLETE:"Address Incomplete",INCOMPATIBLE_SDP:"Incompatible SDP",MISSING_SDP:"Missing SDP",AUTHENTICATION_ERROR:"Authentication Error",BYE:"Terminated",WEBRTC_ERROR:"WebRTC Error",CANCELED:"Canceled",NO_ANSWER:"No Answer",EXPIRES:"Expires",NO_ACK:"No ACK",DIALOG_ERROR:"Dialog Error",USER_DENIED_MEDIA_ACCESS:"User Denied Media Access",BAD_MEDIA_DESCRIPTION:"Bad Media Description",RTP_TIMEOUT:"RTP Timeout"},SIP_ERROR_CAUSES:{REDIRECTED:[300,301,302,305,380],BUSY:[486,600],REJECTED:[403,603],NOT_FOUND:[404,604],UNAVAILABLE:[480,410,408,430],ADDRESS_INCOMPLETE:[484,424],INCOMPATIBLE_SDP:[488,606],AUTHENTICATION_ERROR:[401,407]},ACK:"ACK",BYE:"BYE",CANCEL:"CANCEL",INFO:"INFO",INVITE:"INVITE",MESSAGE:"MESSAGE",NOTIFY:"NOTIFY",OPTIONS:"OPTIONS",REGISTER:"REGISTER",REFER:"REFER",UPDATE:"UPDATE",SUBSCRIBE:"SUBSCRIBE",DTMF_TRANSPORT:{INFO:"INFO",RFC2833:"RFC2833"},REASON_PHRASE:{100:"Trying",180:"Ringing",181:"Call Is Being Forwarded",182:"Queued",183:"Session Progress",199:"Early Dialog Terminated",200:"OK",202:"Accepted",204:"No Notification",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",305:"Use Proxy",380:"Alternative Service",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",410:"Gone",412:"Conditional Request Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Unsupported URI Scheme",417:"Unknown Resource-Priority",420:"Bad Extension",421:"Extension Required",422:"Session Interval Too Small",423:"Interval Too Brief",424:"Bad Location Information",428:"Use Identity Header",429:"Provide Referrer Identity",430:"Flow Failed",433:"Anonymity Disallowed",436:"Bad Identity-Info",437:"Unsupported Certificate",438:"Invalid Identity Header",439:"First Hop Lacks Outbound Support",440:"Max-Breadth Exceeded",469:"Bad Info Package",470:"Consent Needed",478:"Unresolvable Destination",480:"Temporarily Unavailable",481:"Call/Transaction Does Not Exist",482:"Loop Detected",483:"Too Many Hops",484:"Address Incomplete",485:"Ambiguous",486:"Busy Here",487:"Request Terminated",488:"Not Acceptable Here",489:"Bad Event",491:"Request Pending",493:"Undecipherable",494:"Security Agreement Required",500:"JsSIP Internal Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Server Time-out",505:"Version Not Supported",513:"Message Too Large",580:"Precondition Failure",600:"Busy Everywhere",603:"Decline",604:"Does Not Exist Anywhere",606:"Not Acceptable"},ALLOWED_METHODS:"INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY",ACCEPTED_BODY_TYPES:"application/sdp, application/dtmf-relay",MAX_FORWARDS:69,SESSION_EXPIRES:90,MIN_SESSION_EXPIRES:60,CONNECTION_RECOVERY_MAX_INTERVAL:30,CONNECTION_RECOVERY_MIN_INTERVAL:2,LOG_LEVEL:{TRACE:0,DEBUG:1,WARN:2,ERROR:3,NONE:4}};function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t,r){t=f(t);var n=e,t=g()?Reflect.construct(t,r||[],f(e).constructor):t.apply(e,r);if(!t||"object"!=typeof t&&"function"!=typeof t){if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(t=n))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,T(n.key),n)}}function p(e,t,r){return t&&c(e.prototype,t),r&&c(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t){var r,n,o,s,i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return o=!(n=!0),{s:function(){i=i.call(e)},n:function(){var e=i.next();return n=e.done,e},e:function(e){o=!0,r=e},f:function(){try{n||null==i.return||i.return()}finally{if(o)throw r}}};if(Array.isArray(e)||(i=w(e))||t&&e&&"number"==typeof e.length)return i&&(e=i),s=0,{s:t=function(){},n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(e,t,r){return(t=T(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!e})()}function y(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?y(Object(r),!0).forEach(function(e){h(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function v(e,t){return(v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function b(e){return(e=>{if(Array.isArray(e))return a(e)})(e)||(()=>{if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)})()||w(e)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function T(e){e=(e=>{if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);if("object"!=typeof(t=t.call(e,"string")))return t;throw new TypeError("@@toPrimitive must return a primitive value.")})(e);return"symbol"==typeof e?e:e+""}function S(e){return(S="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 w(e,t){var r;if(e)return"string"==typeof e?a(e,t):"Map"===(r="Object"===(r={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}function E(e){var r="function"==typeof Map?new Map:void 0;return(E=function(e){if(null===e||!(t=>{try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}})(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return function(e,t,r){var n;return g()?Reflect.construct.apply(null,arguments):((n=[null]).push.apply(n,t),t=new(e.bind.apply(e,n)),r&&v(t,r.prototype),t)}(e,arguments,f(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),v(t,e)})(e)}var A,O,x,C,R,N,I,P=(()=>{function n(e,t){var r;return l(this,n),(r=u(this,n)).code=1,r.name="CONFIGURATION_ERROR",r.parameter=e,r.value=t,r.message=r.value?"Invalid value ".concat(JSON.stringify(r.value),' for parameter "').concat(r.parameter,'"'):"Missing parameter: ".concat(r.parameter),r}return m(n,E(Error)),p(n)})(),U=(()=>{function r(e){var t;return l(this,r),(t=u(this,r)).code=2,t.name="INVALID_STATE_ERROR",t.status=e,t.message="Invalid status: ".concat(e),t}return m(r,E(Error)),p(r)})(),k=(()=>{function r(e){var t;return l(this,r),(t=u(this,r)).code=3,t.name="NOT_SUPPORTED_ERROR",t.message=e,t}return m(r,E(Error)),p(r)})(),L=(()=>{function r(e){var t;return l(this,r),(t=u(this,r)).code=4,t.name="NOT_READY_ERROR",t.message=e,t}return m(r,E(Error)),p(r)})(),j={ConfigurationError:P,InvalidStateError:U,NotSupportedError:k,NotReadyError:L},D={};function M(){var o,t;return O||(O=1,o=B(),t=V(),A=p(s,[{key:"uri",get:function(){return this._uri}},{key:"display_name",get:function(){return this._display_name},set:function(e){this._display_name=0===e?"0":e}},{key:"setParam",value:function(e,t){e&&(this._parameters[e.toLowerCase()]=null==t?null:t.toString())}},{key:"getParam",value:function(e){if(e)return this._parameters[e.toLowerCase()]}},{key:"hasParam",value:function(e){if(e)return!!this._parameters.hasOwnProperty(e.toLowerCase())}},{key:"deleteParam",value:function(e){var t;if(e=e.toLowerCase(),this._parameters.hasOwnProperty(e))return t=this._parameters[e],delete this._parameters[e],t}},{key:"clearParams",value:function(){this._parameters={}}},{key:"clone",value:function(){return new s(this._uri.clone(),this._display_name,JSON.parse(JSON.stringify(this._parameters)))}},{key:"_quote",value:function(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}},{key:"toString",value:function(){var e,t=this._display_name?'"'.concat(this._quote(this._display_name),'" '):"";for(e in t+="<".concat(this._uri.toString(),">"),this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,e)&&(t+=";".concat(e),null!==this._parameters[e])&&(t+="=".concat(this._parameters[e]));return t}}],[{key:"parse",value:function(e){return-1!==(e=t.parse(e,"Name_Addr_Header"))?e:void 0}}])),A;function s(e,t,r){if(l(this,s),!(e&&e instanceof o))throw new TypeError('missing or invalid "uri" parameter');for(var n in this._uri=e,this._parameters={},this.display_name=t,r)Object.prototype.hasOwnProperty.call(r,n)&&this.setParam(n,r[n])}}function V(){return C||(C=1,(e={parse:function(g,u){var e={CRLF:V,DIGIT:l,ALPHA:i,HEXDIG:a,WSP:c,OCTET:r,DQUOTE:p,SP:h,HTAB:d,alphanum:o,reserved:F,unreserved:n,mark:q,escaped:f,LWS:m,SWS:v,HCOLON:H,TEXT_UTF8_TRIM:G,TEXT_UTF8char:b,UTF8_NONASCII:S,UTF8_CONT:T,LHEX:function(){var e;return null===(e=l())&&(/^[a-f]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[a-f]"))),e},token:w,token_nodot:z,separators:function(){var e;return 40===g.charCodeAt(y)?(e="(",y++):(e=null,_('"("')),e=null===e&&(41===g.charCodeAt(y)?(e=")",y++):(e=null,_('")"')),null===e)&&(60===g.charCodeAt(y)?(e="<",y++):(e=null,_('"<"')),null===e)&&(62===g.charCodeAt(y)?(e=">",y++):(e=null,_('">"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')),null===e)&&(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(92===g.charCodeAt(y)?(e="\\",y++):(e=null,_('"\\\\"')),null===e)&&null===(e=p())&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null===e)&&(93===g.charCodeAt(y)?(e="]",y++):(e=null,_('"]"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(123===g.charCodeAt(y)?(e="{",y++):(e=null,_('"{"')),null===e)&&(125===g.charCodeAt(y)?(e="}",y++):(e=null,_('"}"')),null===e)&&null===(e=h())?d():e},word:E,STAR:K,SLASH:Y,EQUAL:A,LPAREN:J,RPAREN:W,RAQUOT:X,LAQUOT:$,COMMA:O,SEMI:x,COLON:Q,LDQUOT:Z,RDQUOT:ee,comment:function e(){var t,r,n,o=y;if(null!==(t=J())){for(r=[],null===(n=te())&&null===(n=R())&&(n=e());null!==n;)r.push(n),null===(n=te())&&null===(n=R())&&(n=e());null!==r&&null!==(n=W())?t=[t,r,n]:(t=null,y=o)}else t=null,y=o;return t},ctext:te,quoted_string:re,quoted_string_clean:C,qdtext:ne,quoted_pair:R,SIP_URI_noparams:oe,SIP_URI:se,uri_scheme:ie,uri_scheme_sips:ae,uri_scheme_sip:ue,userinfo:le,user:ce,user_unreserved:pe,password:he,hostport:de,host:fe,hostname:me,domainlabel:ge,toplabel:ye,IPv6reference:_e,IPv6address:ve,h16:N,ls32:I,IPv4address:be,dec_octet:Se,port:Te,uri_parameters:we,uri_parameter:Ee,transport_param:Ae,user_param:Oe,method_param:xe,ttl_param:Ce,maddr_param:Re,lr_param:Ne,other_param:Ie,pname:Pe,pvalue:Ue,paramchar:Le,param_unreserved:ke,headers:De,header:je,hname:Ve,hvalue:Me,hnv_unreserved:Be,Request_Response:function(){var e;return e=null===(e=gt())?Fe():e},Request_Line:Fe,Request_URI:qe,absoluteURI:He,hier_part:Ge,net_path:ze,abs_path:Ke,opaque_part:Ye,uric:Je,uric_no_slash:We,path_segments:Xe,segment:$e,param:Qe,pchar:Ze,scheme:et,authority:tt,srvr:rt,reg_name:nt,query:ot,SIP_Version:st,INVITEm:it,ACKm:at,OPTIONSm:ut,BYEm:lt,CANCELm:ct,REGISTERm:pt,SUBSCRIBEm:ht,NOTIFYm:dt,REFERm:ft,Method:mt,Status_Line:gt,Status_Code:yt,extension_code:_t,Reason_Phrase:vt,Allow_Events:function(){var e,t,r,n,o,s=y;if(null!==(e=Bt())){for(t=[],o=y,null!==(r=O())&&null!==(n=Bt())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=Bt())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Call_ID:function(){var e,t,r,n,o=y,s=y;return null!==(e=E())&&(n=y,64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null!==t&&null!==(r=E())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null===(e=null!==e?void(j=g.substring(y,o)):e)&&(y=o),e},Contact:function(){var e,t,r,n,o,s,i=y;if(null===(e=K()))if(o=y,null!==(e=bt())){for(t=[],s=y,null!==(r=O())&&null!==(n=bt())?r=[r,n]:(r=null,y=s);null!==r;)t.push(r),s=y,null!==(r=O())&&null!==(n=bt())?r=[r,n]:(r=null,y=s);null!==t?e=[e,t]:(e=null,y=o)}else e=null,y=o;return null===(e=null!==e?(()=>{for(var e=j.multi_header.length,t=0;t<e;t++)if(null===j.multi_header[t].parsed){j=null;break}j=null!==j?j.multi_header:-1})():e)&&(y=i),e},contact_param:bt,name_addr:P,display_name:St,contact_params:Tt,c_p_q:wt,c_p_expires:Et,delta_seconds:U,qvalue:At,generic_param:L,gen_value:Ot,Content_Disposition:function(){var e,t,r,n,o,s=y;if(null!==(e=xt())){for(t=[],o=y,null!==(r=x())&&null!==(n=Ct())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Ct())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},disp_type:xt,disp_param:Ct,handling_param:Rt,Content_Encoding:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Content_Length:function(){var e,t,r=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null===(e=null!==e?void(j=parseInt(e.join(""))):e)&&(y=r),e},Content_Type:function(){var e,t=y;return null===(e=null!==(e=Nt())?void(j=g.substring(y,t)):e)&&(y=t),e},media_type:Nt,m_type:It,discrete_type:Pt,composite_type:Ut,extension_token:Lt,x_token:kt,m_subtype:Dt,m_parameter:jt,m_value:Vt,CSeq:function(){var e,t,r,n=y;return null!==(e=Mt())&&null!==(t=m())&&null!==(r=mt())?e=[e,t,r]:(e=null,y=n),e},CSeq_value:Mt,Expires:function(){var e,t=y;return null===(e=null!==(e=U())?void(j=e):e)&&(y=t),e},Event:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=Bt())){for(t=[],o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null!==e&&(i=e[0],e=void(j.event=i.join("").toLowerCase())),null===e&&(y=s),e},event_type:Bt,From:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?P():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=Ft())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Ft())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{var e=j.tag;try{j=new D(j.uri,j.display_name,j.params),e&&j.setParam("tag",e)}catch(e){j=-1}})():e)&&(y=s),e},from_param:Ft,tag_param:qt,Max_Forwards:function(){var e,t,r=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null===(e=null!==e?void(j=parseInt(e.join(""))):e)&&(y=r),e},Min_Expires:function(){var e,t=y;return null===(e=null!==(e=U())?void(j=e):e)&&(y=t),e},Name_Addr_Header:function(){for(var e,t,r,n,o,s,i=y,a=y,u=[],l=St();null!==l;)u.push(l),l=St();if(null!==u)if(null!==(l=$()))if(null!==(e=se()))if(null!==(t=X())){for(r=[],s=y,null!==(n=x())&&null!==(o=L())?n=[n,o]:(n=null,y=s);null!==n;)r.push(n),s=y,null!==(n=x())&&null!==(o=L())?n=[n,o]:(n=null,y=s);null!==r?u=[u,l,e,t,r]:(u=null,y=a)}else u=null,y=a;else u=null,y=a;else u=null,y=a;else u=null,y=a;return null===(u=null!==u?(()=>{try{j=new D(j.uri,j.display_name,j.params)}catch(e){j=-1}})():u)&&(y=i),u},Proxy_Authenticate:Ht,challenge:Ht,other_challenge:Gt,auth_param:zt,digest_cln:Kt,realm:Yt,realm_value:Jt,domain:Wt,URI:Xt,nonce:$t,nonce_value:Qt,opaque:Zt,stale:er,algorithm:tr,qop_options:rr,qop_value:nr,Proxy_Require:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Record_Route:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=or())){for(t=[],o=y,null!==(r=O())&&null!==(n=or())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=or())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{for(var e=j.multi_header.length,t=0;t<e;t++)if(null===j.multi_header[t].parsed){j=null;break}j=null!==j?j.multi_header:-1})():e)&&(y=s),e},rec_route:or,Reason:function(){var e,t,r,n,o,s=y,i=y;if("sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"SIP"')),null!==(e=null===e?w():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=sr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=sr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null!==e&&(i=e[0],j.protocol=i.toLowerCase(),j.params||(j.params={}),e=void(j.params.text&&'"'===j.params.text[0]&&(i=j.params.text,j.text=i.substring(1,i.length-1),delete j.params.text))),null===e&&(y=s),e},reason_param:sr,reason_cause:ir,Require:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Route:function(){var e,t,r,n,o,s=y;if(null!==(e=ar())){for(t=[],o=y,null!==(r=O())&&null!==(n=ar())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=ar())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},route_param:ar,Subscription_State:function(){var e,t,r,n,o,s=y;if(null!==(e=ur())){for(t=[],o=y,null!==(r=x())&&null!==(n=lr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=lr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},substate_value:ur,subexp_params:lr,event_reason_value:cr,Subject:function(){var e;return null!==(e=G())?e:""},Supported:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return null!==e?e:""},To:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?P():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=pr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=pr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{var e=j.tag;try{j=new D(j.uri,j.display_name,j.params),e&&j.setParam("tag",e)}catch(e){j=-1}})():e)&&(y=s),e},to_param:pr,Via:function(){var e,t,r,n,o,s=y;if(null!==(e=hr())){for(t=[],o=y,null!==(r=O())&&null!==(n=hr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=hr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},via_param:hr,via_params:dr,via_ttl:fr,via_maddr:mr,via_received:gr,via_branch:yr,response_port:_r,rport:vr,sent_protocol:br,protocol_name:Sr,transport:Tr,sent_by:wr,via_host:Er,via_port:Ar,ttl:Or,WWW_Authenticate:Ht,Session_Expires:function(){var e,t,r,n,o,s=y;if(null!==(e=xr())){for(t=[],o=y,null!==(r=x())&&null!==(n=Cr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Cr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},s_e_expires:xr,s_e_params:Cr,s_e_refresher:Rr,extension_header:function(){var e,t,r,n=y;return null!==(e=w())&&null!==(t=H())&&null!==(r=Nr())?e=[e,t,r]:(e=null,y=n),e},header_value:Nr,message_body:function(){for(var e=[],t=r();null!==t;)e.push(t),t=r();return e},uuid_URI:function(){var e,t,r=y;return"uuid:"===g.substr(y,5)?(e="uuid:",y+=5):(e=null,_('"uuid:"')),null!==e&&null!==(t=Ir())?e=[e,t]:(e=null,y=r),e},uuid:Ir,hex4:k,hex8:Pr,hex12:Ur,Refer_To:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?P():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{try{j=new D(j.uri,j.display_name,j.params)}catch(e){j=-1}})():e)&&(y=s),e},Replaces:function(){var e,t,r,n,o,s=y;if(null!==(e=Lr())){for(t=[],o=y,null!==(r=x())&&null!==(n=kr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=kr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},call_id:Lr,replaces_param:kr,to_tag:Dr,from_tag:jr,early_flag:Vr};if(void 0!==u){if(void 0===e[u])throw new Error("Invalid rule name: "+qr(u)+".")}else u="CRLF";var y=0,s=0,t=[];function _(e){y<s||(s<y&&(s=y,t=[]),t.push(e))}function V(){var e;return"\r\n"===g.substr(y,2)?(e="\r\n",y+=2):(e=null,_('"\\r\\n"')),e}function l(){var e;return/^[0-9]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[0-9]")),e}function i(){var e;return/^[a-zA-Z]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[a-zA-Z]")),e}function a(){var e;return/^[0-9a-fA-F]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[0-9a-fA-F]")),e}function c(){var e;return e=null===(e=h())?d():e}function r(){var e;return/^[\0-\xFF]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\0-\\xFF]")),e}function p(){var e;return/^["]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_('["]')),e}function h(){var e;return 32===g.charCodeAt(y)?(e=" ",y++):(e=null,_('" "')),e}function d(){var e;return 9===g.charCodeAt(y)?(e="\t",y++):(e=null,_('"\\t"')),e}function o(){var e;return/^[a-zA-Z0-9]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[a-zA-Z0-9]")),e}function F(){var e;return 59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","'))),e}function n(){var e;return e=null===(e=o())?q():e}function q(){var e;return 45===g.charCodeAt(y)?(e="-",y++):(e=null,_('"-"')),null===e&&(95===g.charCodeAt(y)?(e="_",y++):(e=null,_('"_"')),null===e)&&(46===g.charCodeAt(y)?(e=".",y++):(e=null,_('"."')),null===e)&&(33===g.charCodeAt(y)?(e="!",y++):(e=null,_('"!"')),null===e)&&(126===g.charCodeAt(y)?(e="~",y++):(e=null,_('"~"')),null===e)&&(42===g.charCodeAt(y)?(e="*",y++):(e=null,_('"*"')),null===e)&&(39===g.charCodeAt(y)?(e="'",y++):(e=null,_('"\'"')),null===e)&&(40===g.charCodeAt(y)?(e="(",y++):(e=null,_('"("')),null===e)&&(41===g.charCodeAt(y)?(e=")",y++):(e=null,_('")"'))),e}function f(){var e,t,r,n=y,o=y;return 37===g.charCodeAt(y)?(e="%",y++):(e=null,_('"%"')),null!==e&&null!==(t=a())&&null!==(r=a())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?e.join(""):e)&&(y=n),e}function m(){for(var e,t=y,r=y,n=y,o=[],s=c();null!==s;)o.push(s),s=c();if(null!==o&&null!==(s=V())?o=[o,s]:(o=null,y=n),null!==(o=null!==o?o:"")){if(null!==(e=c()))for(s=[];null!==e;)s.push(e),e=c();else s=null;null!==s?o=[o,s]:(o=null,y=r)}else o=null,y=r;return null===(o=null!==o?" ":o)&&(y=t),o}function v(){var e;return null!==(e=m())?e:""}function H(){var e,t,r=y,n=y,o=[];for(null===(e=h())&&(e=d());null!==e;)o.push(e),null===(e=h())&&(e=d());return null!==o&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null!==e)&&null!==(t=v())?o=[o,e,t]:(o=null,y=n),null===(o=null!==o?":":o)&&(y=r),o}function G(){var e,t,r,n,o,s=y,i=y;if(null!==(t=b()))for(e=[];null!==t;)e.push(t),t=b();else e=null;if(null!==e){for(t=[],o=y,r=[],n=m();null!==n;)r.push(n),n=m();for(null!==r&&null!==(n=b())?r=[r,n]:(r=null,y=o);null!==r;){for(t.push(r),o=y,r=[],n=m();null!==n;)r.push(n),n=m();null!==r&&null!==(n=b())?r=[r,n]:(r=null,y=o)}null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?g.substring(y,s):e)&&(y=s),e}function b(){var e;return/^[!-~]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[!-~]")),e=null===e?S():e}function S(){var e;return/^[\x80-\uFFFF]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\x80-\\uFFFF]")),e}function T(){var e;return/^[\x80-\xBF]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\x80-\\xBF]")),e}function w(){var e,t,r=y;if(null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')));else e=null;return null===(e=null!==e?g.substring(y,r):e)&&(y=r),e}function z(){var e,t,r=y;if(null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')));else e=null;return null===(e=null!==e?g.substring(y,r):e)&&(y=r),e}function E(){var e,t,r=y;if(null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')),null===t)&&(40===g.charCodeAt(y)?(t="(",y++):(t=null,_('"("')),null===t)&&(41===g.charCodeAt(y)?(t=")",y++):(t=null,_('")"')),null===t)&&(60===g.charCodeAt(y)?(t="<",y++):(t=null,_('"<"')),null===t)&&(62===g.charCodeAt(y)?(t=">",y++):(t=null,_('">"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(92===g.charCodeAt(y)?(t="\\",y++):(t=null,_('"\\\\"')),null===t)&&null===(t=p())&&(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null===t)&&(91===g.charCodeAt(y)?(t="[",y++):(t=null,_('"["')),null===t)&&(93===g.charCodeAt(y)?(t="]",y++):(t=null,_('"]"')),null===t)&&(63===g.charCodeAt(y)?(t="?",y++):(t=null,_('"?"')),null===t)&&(123===g.charCodeAt(y)?(t="{",y++):(t=null,_('"{"')),null===t)&&(125===g.charCodeAt(y)?(t="}",y++):(t=null,_('"}"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')),null===t)&&(40===g.charCodeAt(y)?(t="(",y++):(t=null,_('"("')),null===t)&&(41===g.charCodeAt(y)?(t=")",y++):(t=null,_('")"')),null===t)&&(60===g.charCodeAt(y)?(t="<",y++):(t=null,_('"<"')),null===t)&&(62===g.charCodeAt(y)?(t=">",y++):(t=null,_('">"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(92===g.charCodeAt(y)?(t="\\",y++):(t=null,_('"\\\\"')),null===t)&&null===(t=p())&&(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null===t)&&(91===g.charCodeAt(y)?(t="[",y++):(t=null,_('"["')),null===t)&&(93===g.charCodeAt(y)?(t="]",y++):(t=null,_('"]"')),null===t)&&(63===g.charCodeAt(y)?(t="?",y++):(t=null,_('"?"')),null===t)&&(123===g.charCodeAt(y)?(t="{",y++):(t=null,_('"{"')),null===t)&&(125===g.charCodeAt(y)?(t="}",y++):(t=null,_('"}"')));else e=null;return null===(e=null!==e?g.substring(y,r):e)&&(y=r),e}function K(){var e,t,r,n=y,o=y;return null!==(e=v())&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"*":e)&&(y=n),e}function Y(){var e,t,r,n=y,o=y;return null!==(e=v())&&(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"/":e)&&(y=n),e}function A(){var e,t,r,n=y,o=y;return null!==(e=v())&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"=":e)&&(y=n),e}function J(){var e,t,r,n=y,o=y;return null!==(e=v())&&(40===g.charCodeAt(y)?(t="(",y++):(t=null,_('"("')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"(":e)&&(y=n),e}function W(){var e,t,r,n=y,o=y;return null!==(e=v())&&(41===g.charCodeAt(y)?(t=")",y++):(t=null,_('")"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?")":e)&&(y=n),e}function X(){var e,t,r=y,n=y;return 62===g.charCodeAt(y)?(e=">",y++):(e=null,_('">"')),null!==e&&null!==(t=v())?e=[e,t]:(e=null,y=n),null===(e=null!==e?">":e)&&(y=r),e}function $(){var e,t,r=y,n=y;return null!==(e=v())&&(60===g.charCodeAt(y)?(t="<",y++):(t=null,_('"<"')),null!==t)?e=[e,t]:(e=null,y=n),null===(e=null!==e?"<":e)&&(y=r),e}function O(){var e,t,r,n=y,o=y;return null!==(e=v())&&(44===g.charCodeAt(y)?(t=",",y++):(t=null,_('","')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?",":e)&&(y=n),e}function x(){var e,t,r,n=y,o=y;return null!==(e=v())&&(59===g.charCodeAt(y)?(t=";",y++):(t=null,_('";"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?";":e)&&(y=n),e}function Q(){var e,t,r,n=y,o=y;return null!==(e=v())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?":":e)&&(y=n),e}function Z(){var e,t,r=y,n=y;return null!==(e=v())&&null!==(t=p())?e=[e,t]:(e=null,y=n),null===(e=null!==e?'"':e)&&(y=r),e}function ee(){var e,t,r=y,n=y;return null!==(e=p())&&null!==(t=v())?e=[e,t]:(e=null,y=n),null===(e=null!==e?'"':e)&&(y=r),e}function te(){var e;return/^[!-']/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[!-']")),e=null===e&&(/^[*-[]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[*-[]")),null===e)&&(/^[\]-~]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\]-~]")),null===e)&&null===(e=S())?m():e}function re(){var e,t,r,n,o=y,s=y;if(null!==(e=v()))if(null!==(t=p())){for(r=[],null===(n=ne())&&(n=R());null!==n;)r.push(n),null===(n=ne())&&(n=R());null!==r&&null!==(n=p())?e=[e,t,r,n]:(e=null,y=s)}else e=null,y=s;else e=null,y=s;return null===(e=null!==e?g.substring(y,o):e)&&(y=o),e}function C(){var e,t,r,n,o=y,s=y;if(null!==(e=v()))if(null!==(n=p())){for(t=[],null===(r=ne())&&(r=R());null!==r;)t.push(r),null===(r=ne())&&(r=R());null!==t&&null!==(r=p())?e=[e,n,t,r]:(e=null,y=s)}else e=null,y=s;else e=null,y=s;return null===(e=null!==e?(n=g.substring(y,o).trim()).substring(1,n.length-1).replace(/\\([\x00-\x09\x0b-\x0c\x0e-\x7f])/g,"$1"):e)&&(y=o),e}function ne(){var e;return e=null===(e=m())&&(33===g.charCodeAt(y)?(e="!",y++):(e=null,_('"!"')),null===e)&&(/^[#-[]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[#-[]")),null===e)&&(/^[\]-~]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\]-~]")),null===e)?S():e}function R(){var e,t,r=y;return 92===g.charCodeAt(y)?(e="\\",y++):(e=null,_('"\\\\"')),null!==e&&(/^[\0-\t]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[\\0-\\t]")),null===t&&(/^[\x0B-\f]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[\\x0B-\\f]")),null===t)&&(/^[\x0E-]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[\\x0E-]"))),null!==t)?e=[e,t]:(e=null,y=r),e}function oe(){var e,t,r,n,o=y,s=y;return null!==(e=ie())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=null!==(r=le())?r:"")&&null!==(n=de())?e=[e,t,r,n]:(e=null,y=s),null===(e=null!==e?(()=>{try{j.uri=new Fr(j.scheme,j.user,j.host,j.port),delete j.scheme,delete j.user,delete j.host,delete j.host_type,delete j.port}catch(e){j=-1}})():e)&&(y=o),e}function se(){var e,t,r,n,o,s,i=y,a=y;return null!==(e=ie())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=null!==(r=le())?r:"")&&null!==(n=de())&&null!==(o=we())&&null!==(s=null!==(s=De())?s:"")?e=[e,t,r,n,o,s]:(e=null,y=a),null===(e=null!==e?(()=>{try{j.uri=new Fr(j.scheme,j.user,j.host,j.port,j.uri_params,j.uri_headers),delete j.scheme,delete j.user,delete j.host,delete j.host_type,delete j.port,delete j.uri_params,"SIP_URI"===u&&(j=j.uri)}catch(e){j=-1}})():e)&&(y=i),e}function ie(){var e;return e=null===(e=ae())?ue():e}function ae(){var e,t,r=y;return"sips"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"sips"')),null!==e&&(t=e,e=void(j.scheme=t.toLowerCase())),null===e&&(y=r),e}function ue(){var e,t,r=y;return"sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"sip"')),null!==e&&(t=e,e=void(j.scheme=t.toLowerCase())),null===e&&(y=r),e}function le(){var e,t,r,n,o=y,s=y;return null!==(e=ce())&&(n=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=he())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))&&(64===g.charCodeAt(y)?(r="@",y++):(r=null,_('"@"')),null!==r)?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(j.user=decodeURIComponent(g.substring(y-1,o))):e)&&(y=o),e}function ce(){var e,t;if(null!==(t=null===(t=n())&&null===(t=f())?pe():t))for(e=[];null!==t;)e.push(t),null===(t=n())&&null===(t=f())&&(t=pe());else e=null;return e}function pe(){var e;return 38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')),null===e)&&(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"'))),e}function he(){var e,t=y,r=[];for(null===(e=n())&&null===(e=f())&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')));null!==e;)r.push(e),null===(e=n())&&null===(e=f())&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')));return null===(r=null!==r?void(j.password=g.substring(y,t)):r)&&(y=t),r}function de(){var e,t,r,n,o=y;return null!==(e=fe())&&(n=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=Te())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function fe(){var e,t=y;return null!==(e=null===(e=me())&&null===(e=be())?_e():e)&&(j.host=g.substring(y,t).toLowerCase(),e=j.host),null===e&&(y=t),e}function me(){var e,t,r=y,n=y,o=[],s=y;for(null!==(e=ge())&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==t)?e=[e,t]:(e=null,y=s);null!==e;)o.push(e),s=y,null!==(e=ge())&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==t)?e=[e,t]:(e=null,y=s);return null!==o&&null!==(e=ye())&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==(t=null!==t?t:""))?o=[o,e,t]:(o=null,y=n),null!==o&&(n=r,j.host_type="domain",o=g.substring(y,n)),null===o&&(y=r),o}function ge(){var e,t,r,n=y;if(null!==(e=o())){for(t=[],null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==r;)t.push(r),null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==t?e=[e,t]:(e=null,y=n)}else e=null,y=n;return e}function ye(){var e,t,r,n=y;if(null!==(e=i())){for(t=[],null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==r;)t.push(r),null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==t?e=[e,t]:(e=null,y=n)}else e=null,y=n;return e}function _e(){var e,t,r,n=y,o=y;return 91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null!==e&&null!==(r=ve())&&(93===g.charCodeAt(y)?(t="]",y++):(t=null,_('"]"')),null!==t)?e=[e,r,t]:(e=null,y=o),null!==e&&(r=n,j.host_type="IPv6",e=g.substring(y,r)),null===e&&(y=n),e}function ve(){var e,t,r,n,o,s,i,a,u,l,c,p,h,d,f=y,m=y;return null!==(e=N())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=N())&&(58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n)&&null!==(o=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(i=N())&&(58===g.charCodeAt(y)?(a=":",y++):(a=null,_('":"')),null!==a)&&null!==(u=N())&&(58===g.charCodeAt(y)?(l=":",y++):(l=null,_('":"')),null!==l)&&null!==(c=N())&&(58===g.charCodeAt(y)?(p=":",y++):(p=null,_('":"')),null!==p)&&null!==(d=I())?e=[e,t,r,n,o,s,i,a,u,l,c,p,d]:(e=null,y=m),null===e&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=N())&&(58===g.charCodeAt(y)?(u=":",y++):(u=null,_('":"')),null!==u)&&null!==(l=N())&&(58===g.charCodeAt(y)?(c=":",y++):(c=null,_('":"')),null!==c)&&null!==(p=I())?e=[e,t,r,n,o,s,i,a,u,l,c,p]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=N())&&(58===g.charCodeAt(y)?(u=":",y++):(u=null,_('":"')),null!==u)&&null!==(l=I())?e=[e,t,r,n,o,s,i,a,u,l]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=I())?e=[e,t,r,n,o,s,i,a]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=I())?e=[e,t,r,n,o,s]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=I())?e=[e,t,r,n]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=I())?e=[e,t]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())?e=[e,t]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&("::"===g.substr(y,2)?(t="::",y+=2):(t=null,_('"::"')),null!==t)&&null!==(r=N())&&(58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n)&&null!==(o=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(i=N())&&(58===g.charCodeAt(y)?(a=":",y++):(a=null,_('":"')),null!==a)&&null!==(u=N())&&(58===g.charCodeAt(y)?(l=":",y++):(l=null,_('":"')),null!==l)&&null!==(c=I())?e=[e,t,r,n,o,s,i,a,u,l,c]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&("::"===g.substr(y,2)?(r="::",y+=2):(r=null,_('"::"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=N())&&(58===g.charCodeAt(y)?(u=":",y++):(u=null,_('":"')),null!==u)&&null!==(l=I())?e=[e,t,r,n,o,s,i,a,u,l]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&("::"===g.substr(y,2)?(n="::",y+=2):(n=null,_('"::"')),null!==n)&&null!==(o=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(i=N())&&(58===g.charCodeAt(y)?(a=":",y++):(a=null,_('":"')),null!==a)&&null!==(u=I())?e=[e,t,r,n,o,s,i,a,u]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&("::"===g.substr(y,2)?(o="::",y+=2):(o=null,_('"::"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=I())?e=[e,t,r,n,o,s,i,a]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&(h=y,58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o&&null!==(s=N())?o=[o,s]:(o=null,y=h),null!==(o=null!==o?o:""))&&("::"===g.substr(y,2)?(s="::",y+=2):(s=null,_('"::"')),null!==s)&&null!==(i=I())?e=[e,t,r,n,o,s,i]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&(h=y,58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o&&null!==(s=N())?o=[o,s]:(o=null,y=h),null!==(o=null!==o?o:""))&&(h=y,58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s&&null!==(i=N())?s=[s,i]:(s=null,y=h),null!==(s=null!==s?s:""))&&("::"===g.substr(y,2)?(i="::",y+=2):(i=null,_('"::"')),null!==i)&&null!==(a=N())?e=[e,t,r,n,o,s,i,a]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&(h=y,58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o&&null!==(s=N())?o=[o,s]:(o=null,y=h),null!==(o=null!==o?o:""))&&(h=y,58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s&&null!==(i=N())?s=[s,i]:(s=null,y=h),null!==(s=null!==s?s:""))&&(h=y,58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i&&null!==(a=N())?i=[i,a]:(i=null,y=h),null!==(i=null!==i?i:""))&&("::"===g.substr(y,2)?(a="::",y+=2):(a=null,_('"::"')),null!==a)?e=[e,t,r,n,o,s,i,a]:(e=null,y=m)),null!==e&&(d=f,j.host_type="IPv6",e=g.substring(y,d)),null===e&&(y=f),e}function N(){var e,t,r,n,o=y;return null!==(e=a())&&null!==(t=null!==(t=a())?t:"")&&null!==(r=null!==(r=a())?r:"")&&null!==(n=null!==(n=a())?n:"")?e=[e,t,r,n]:(e=null,y=o),e}function I(){var e,t,r,n=y;return null!==(e=N())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=N())?e=[e,t,r]:(e=null,y=n),e=null===e?be():e}function be(){var e,t,r,n,o,s,i,a=y,u=y;return null!==(e=Se())&&(46===g.charCodeAt(y)?(i=".",y++):(i=null,_('"."')),null!==i)&&null!==(t=Se())&&(46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')),null!==r)&&null!==(n=Se())&&(46===g.charCodeAt(y)?(o=".",y++):(o=null,_('"."')),null!==o)&&null!==(s=Se())?e=[e,i,t,r,n,o,s]:(e=null,y=u),null!==e&&(i=a,j.host_type="IPv4",e=g.substring(y,i)),null===e&&(y=a),e}function Se(){var e,t,r,n=y;return"25"===g.substr(y,2)?(e="25",y+=2):(e=null,_('"25"')),null!==e&&(/^[0-5]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[0-5]")),null!==t)?e=[e,t]:(e=null,y=n),e=null===e&&(n=y,50===g.charCodeAt(y)?(e="2",y++):(e=null,_('"2"')),null!==e&&(/^[0-4]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[0-4]")),null!==t)&&null!==(r=l())?e=[e,t,r]:(e=null,y=n),null===e)&&(n=y,49===g.charCodeAt(y)?(e="1",y++):(e=null,_('"1"')),null!==e&&null!==(t=l())&&null!==(r=l())?e=[e,t,r]:(e=null,y=n),null===e)&&(n=y,/^[1-9]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[1-9]")),null!==e&&null!==(t=l())?e=[e,t]:(e=null,y=n),null===e)?l():e}function Te(){var e,t,r,n,o,s=y,i=y;return null!==(e=null!==(e=l())?e:"")&&null!==(o=null!==(o=l())?o:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")?e=[e,o,t,r,n]:(e=null,y=i),null!==e&&(o=e,o=parseInt(o.join("")),e=j.port=o),null===e&&(y=s),e}function we(){var e,t,r=[],n=y;for(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Ee())?e=[e,t]:(e=null,y=n);null!==e;)r.push(e),n=y,59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Ee())?e=[e,t]:(e=null,y=n);return r}function Ee(){var e;return e=null===(e=Ae())&&null===(e=Oe())&&null===(e=xe())&&null===(e=Ce())&&null===(e=Re())&&null===(e=Ne())?Ie():e}function Ae(){var e,t,r=y,n=y;return"transport="===g.substr(y,10).toLowerCase()?(e=g.substr(y,10),y+=10):(e=null,_('"transport="')),null!==e&&("udp"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"udp"')),null!==(t=null===t&&("tcp"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"tcp"')),null===t)&&("sctp"===g.substr(y,4).toLowerCase()?(t=g.substr(y,4),y+=4):(t=null,_('"sctp"')),null===t)&&("tls"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"tls"')),null===t)?w():t))?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],j.uri_params||(j.uri_params={}),e=void(j.uri_params.transport=t.toLowerCase())),null===e&&(y=r),e}function Oe(){var e,t,r=y,n=y;return"user="===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"user="')),null!==e&&("phone"===g.substr(y,5).toLowerCase()?(t=g.substr(y,5),y+=5):(t=null,_('"phone"')),null!==(t=null===t&&("ip"===g.substr(y,2).toLowerCase()?(t=g.substr(y,2),y+=2):(t=null,_('"ip"')),null===t)?w():t))?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],j.uri_params||(j.uri_params={}),e=void(j.uri_params.user=t.toLowerCase())),null===e&&(y=r),e}function xe(){var e,t,r=y,n=y;return"method="===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"method="')),null!==e&&null!==(t=mt())?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],j.uri_params||(j.uri_params={}),e=void(j.uri_params.method=t)),null===e&&(y=r),e}function Ce(){var e,t,r=y,n=y;return"ttl="===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"ttl="')),null!==e&&null!==(t=Or())?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],j.params||(j.params={}),e=void(j.params.ttl=t)),null===e&&(y=r),e}function Re(){var e,t,r=y,n=y;return"maddr="===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"maddr="')),null!==e&&null!==(t=fe())?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],j.uri_params||(j.uri_params={}),e=void(j.uri_params.maddr=t)),null===e&&(y=r),e}function Ne(){var e,t,r,n,o=y,s=y;return"lr"===g.substr(y,2).toLowerCase()?(e=g.substr(y,2),y+=2):(e=null,_('"lr"')),null!==e&&(n=y,61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t&&null!==(r=w())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null!==e&&(j.uri_params||(j.uri_params={}),e=void(j.uri_params.lr=void 0)),null===e&&(y=o),e}function Ie(){var e,t,r,n,o=y,s=y;return null!==(e=Pe())&&(n=y,61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t&&null!==(r=Ue())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null!==e&&(r=e[0],n=e[1],j.uri_params||(j.uri_params={}),n=void 0===n?void 0:n[1],e=void(j.uri_params[r.toLowerCase()]=n)),null===e&&(y=o),e}function Pe(){var e,t,r=y;if(null!==(t=Le()))for(e=[];null!==t;)e.push(t),t=Le();else e=null;return null===(e=null!==e?e.join(""):e)&&(y=r),e}function Ue(){var e,t,r=y;if(null!==(t=Le()))for(e=[];null!==t;)e.push(t),t=Le();else e=null;return null===(e=null!==e?e.join(""):e)&&(y=r),e}function Le(){var e;return e=null===(e=ke())&&null===(e=n())?f():e}function ke(){var e;return 91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null===e&&(93===g.charCodeAt(y)?(e="]",y++):(e=null,_('"]"')),null===e)&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"'))),e}function De(){var e,t,r,n,o,s,i=y;if(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null!==e)if(null!==(t=je())){for(r=[],s=y,38===g.charCodeAt(y)?(n="&",y++):(n=null,_('"&"')),null!==n&&null!==(o=je())?n=[n,o]:(n=null,y=s);null!==n;)r.push(n),s=y,38===g.charCodeAt(y)?(n="&",y++):(n=null,_('"&"')),null!==n&&null!==(o=je())?n=[n,o]:(n=null,y=s);null!==r?e=[e,t,r]:(e=null,y=i)}else e=null,y=i;else e=null,y=i;return e}function je(){var e,t,r,n=y,o=y;return null!==(e=Ve())&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t)&&null!==(r=Me())?e=[e,t,r]:(e=null,y=o),null!==e&&(t=e[0],r=e[2],t=t.join("").toLowerCase(),r=r.join(""),j.uri_headers||(j.uri_headers={}),e=void(j.uri_headers[t]?j.uri_headers[t].push(r):j.uri_headers[t]=[r])),null===e&&(y=n),e}function Ve(){var e,t;if(null!==(t=null===(t=Be())&&null===(t=n())?f():t))for(e=[];null!==t;)e.push(t),null===(t=Be())&&null===(t=n())&&(t=f());else e=null;return e}function Me(){var e,t=[];for(null===(e=Be())&&null===(e=n())&&(e=f());null!==e;)t.push(e),null===(e=Be())&&null===(e=n())&&(e=f());return t}function Be(){var e;return 91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null===e&&(93===g.charCodeAt(y)?(e="]",y++):(e=null,_('"]"')),null===e)&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"'))),e}function Fe(){var e,t,r,n,o,s=y;return null!==(e=mt())&&null!==(t=h())&&null!==(r=qe())&&null!==(n=h())&&null!==(o=st())?e=[e,t,r,n,o]:(e=null,y=s),e}function qe(){var e;return e=null===(e=se())?He():e}function He(){var e,t,r,n=y;return null!==(e=et())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=null===(r=Ge())?Ye():r)?e=[e,t,r]:(e=null,y=n),e}function Ge(){var e,t,r,n,o=y;return null!==(e=null===(e=ze())?Ke():e)&&(n=y,63===g.charCodeAt(y)?(t="?",y++):(t=null,_('"?"')),null!==t&&null!==(r=ot())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function ze(){var e,t,r,n=y;return"//"===g.substr(y,2)?(e="//",y+=2):(e=null,_('"//"')),null!==e&&null!==(t=tt())&&null!==(r=null!==(r=Ke())?r:"")?e=[e,t,r]:(e=null,y=n),e}function Ke(){var e,t,r=y;return 47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null!==e&&null!==(t=Xe())?e=[e,t]:(e=null,y=r),e}function Ye(){var e,t,r,n=y;if(null!==(e=We())){for(t=[],r=Je();null!==r;)t.push(r),r=Je();null!==t?e=[e,t]:(e=null,y=n)}else e=null,y=n;return e}function Je(){var e;return e=null===(e=F())&&null===(e=n())?f():e}function We(){var e;return null===(e=n())&&null===(e=f())&&(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","'))),e}function Xe(){var e,t,r,n,o,s=y;if(null!==(e=$e())){for(t=[],o=y,47===g.charCodeAt(y)?(r="/",y++):(r=null,_('"/"')),null!==r&&null!==(n=$e())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,47===g.charCodeAt(y)?(r="/",y++):(r=null,_('"/"')),null!==r&&null!==(n=$e())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e}function $e(){for(var e,t,r,n=y,o=[],s=Ze();null!==s;)o.push(s),s=Ze();if(null!==o){for(s=[],r=y,59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Qe())?e=[e,t]:(e=null,y=r);null!==e;)s.push(e),r=y,59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Qe())?e=[e,t]:(e=null,y=r);null!==s?o=[o,s]:(o=null,y=n)}else o=null,y=n;return o}function Qe(){for(var e=[],t=Ze();null!==t;)e.push(t),t=Ze();return e}function Ze(){var e;return null===(e=n())&&null===(e=f())&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","'))),e}function et(){var e,t,r,n=y,o=y;if(null!==(e=i())){for(t=[],null===(r=i())&&null===(r=l())&&(43===g.charCodeAt(y)?(r="+",y++):(r=null,_('"+"')),null===r)&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')));null!==r;)t.push(r),null===(r=i())&&null===(r=l())&&(43===g.charCodeAt(y)?(r="+",y++):(r=null,_('"+"')),null===r)&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')));null!==t?e=[e,t]:(e=null,y=o)}else e=null,y=o;return null===(e=null!==e?void(j.scheme=g.substring(y,n)):e)&&(y=n),e}function tt(){var e;return e=null===(e=rt())?nt():e}function rt(){var e,t,r=y,n=y;return null!==(e=le())&&(64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null!==t)?e=[e,t]:(e=null,y=n),null!==(e=null!==e?e:"")&&null!==(t=de())?e=[e,t]:(e=null,y=r),null!==e?e:""}function nt(){var e,t;if(null===(t=n())&&null===(t=f())&&(36===g.charCodeAt(y)?(t="$",y++):(t=null,_('"$"')),null===t)&&(44===g.charCodeAt(y)?(t=",",y++):(t=null,_('","')),null===t)&&(59===g.charCodeAt(y)?(t=";",y++):(t=null,_('";"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null===t)&&(38===g.charCodeAt(y)?(t="&",y++):(t=null,_('"&"')),null===t)&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=n())&&null===(t=f())&&(36===g.charCodeAt(y)?(t="$",y++):(t=null,_('"$"')),null===t)&&(44===g.charCodeAt(y)?(t=",",y++):(t=null,_('","')),null===t)&&(59===g.charCodeAt(y)?(t=";",y++):(t=null,_('";"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null===t)&&(38===g.charCodeAt(y)?(t="&",y++):(t=null,_('"&"')),null===t)&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')));else e=null;return e}function ot(){for(var e=[],t=Je();null!==t;)e.push(t),t=Je();return e}function st(){var e,t,r,n,o,s,i=y,a=y;if("sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"SIP"')),null!==e)if(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null!==t){if(null!==(n=l()))for(r=[];null!==n;)r.push(n),n=l();else r=null;if(null!==r)if(46===g.charCodeAt(y)?(n=".",y++):(n=null,_('"."')),null!==n){if(null!==(s=l()))for(o=[];null!==s;)o.push(s),s=l();else o=null;null!==o?e=[e,t,r,n,o]:(e=null,y=a)}else e=null,y=a;else e=null,y=a}else e=null,y=a;else e=null,y=a;return null===(e=null!==e?void(j.sip_version=g.substring(y,i)):e)&&(y=i),e}function it(){var e;return"INVITE"===g.substr(y,6)?(e="INVITE",y+=6):(e=null,_('"INVITE"')),e}function at(){var e;return"ACK"===g.substr(y,3)?(e="ACK",y+=3):(e=null,_('"ACK"')),e}function ut(){var e;return"OPTIONS"===g.substr(y,7)?(e="OPTIONS",y+=7):(e=null,_('"OPTIONS"')),e}function lt(){var e;return"BYE"===g.substr(y,3)?(e="BYE",y+=3):(e=null,_('"BYE"')),e}function ct(){var e;return"CANCEL"===g.substr(y,6)?(e="CANCEL",y+=6):(e=null,_('"CANCEL"')),e}function pt(){var e;return"REGISTER"===g.substr(y,8)?(e="REGISTER",y+=8):(e=null,_('"REGISTER"')),e}function ht(){var e;return"SUBSCRIBE"===g.substr(y,9)?(e="SUBSCRIBE",y+=9):(e=null,_('"SUBSCRIBE"')),e}function dt(){var e;return"NOTIFY"===g.substr(y,6)?(e="NOTIFY",y+=6):(e=null,_('"NOTIFY"')),e}function ft(){var e;return"REFER"===g.substr(y,5)?(e="REFER",y+=5):(e=null,_('"REFER"')),e}function mt(){var e,t=y;return null!==(e=null===(e=it())&&null===(e=at())&&null===(e=ut())&&null===(e=lt())&&null===(e=ct())&&null===(e=pt())&&null===(e=ht())&&null===(e=dt())&&null===(e=ft())?w():e)&&(j.method=g.substring(y,t),e=j.method),null===e&&(y=t),e}function gt(){var e,t,r,n,o,s=y;return null!==(e=st())&&null!==(t=h())&&null!==(r=yt())&&null!==(n=h())&&null!==(o=vt())?e=[e,t,r,n,o]:(e=null,y=s),e}function yt(){var e,t,r=y;return null!==(e=_t())&&(t=e,e=void(j.status_code=parseInt(t.join("")))),null===e&&(y=r),e}function _t(){var e,t,r,n=y;return null!==(e=l())&&null!==(t=l())&&null!==(r=l())?e=[e,t,r]:(e=null,y=n),e}function vt(){var e,t=y,r=[];for(null===(e=F())&&null===(e=n())&&null===(e=f())&&null===(e=S())&&null===(e=T())&&null===(e=h())&&(e=d());null!==e;)r.push(e),null===(e=F())&&null===(e=n())&&null===(e=f())&&null===(e=S())&&null===(e=T())&&null===(e=h())&&(e=d());return null===(r=null!==r?void(j.reason_phrase=g.substring(y,t)):r)&&(y=t),r}function bt(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?P():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=Tt())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Tt())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(e=>{var t;j.multi_header||(j.multi_header=[]);try{t=new D(j.uri,j.display_name,j.params),delete j.uri,delete j.display_name,delete j.params}catch(e){t=null}j.multi_header.push({possition:y,offset:e,parsed:t})})(s):e)&&(y=s),e}function P(){var e,t,r,n,o=y;return null!==(e=null!==(e=St())?e:"")&&null!==(t=$())&&null!==(r=se())&&null!==(n=X())?e=[e,t,r,n]:(e=null,y=o),e}function St(){var e,t,r,n,o,s=y,i=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=m())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=m())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null!==(e=null===e?C():e)&&(i=e,e=void(j.display_name="string"==typeof i?i:i[1].reduce(function(e,t){return e+t[0]+t[1]},i[0]))),null===e&&(y=s),e}function Tt(){var e;return e=null===(e=wt())&&null===(e=Et())?L():e}function wt(){var e,t,r,n=y,o=y;return"q"===g.substr(y,1).toLowerCase()?(e=g.substr(y,1),y++):(e=null,_('"q"')),null!==e&&null!==(r=A())&&null!==(t=At())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],j.params||(j.params={}),e=void(j.params.q=r)),null===e&&(y=n),e}function Et(){var e,t,r,n=y,o=y;return"expires"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"expires"')),null!==e&&null!==(r=A())&&null!==(t=U())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],j.params||(j.params={}),e=void(j.params.expires=r)),null===e&&(y=n),e}function U(){var e,t,r=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null===(e=null!==e?parseInt(e.join("")):e)&&(y=r),e}function At(){var e,t,r,n,o,s,i=y,a=y;return 48===g.charCodeAt(y)?(e="0",y++):(e=null,_('"0"')),null!==e&&(s=y,46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==t&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")&&null!==(o=null!==(o=l())?o:"")?t=[t,r,n,o]:(t=null,y=s),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=a),null===(e=null!==e?parseFloat(g.substring(y,i)):e)&&(y=i),e}function L(){var e,t,r,n,o=y,s=y;return null!==(e=w())&&(n=y,null!==(t=A())&&null!==(r=Ot())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null!==e&&(r=e[0],n=e[1],j.params||(j.params={}),n=void 0===n?void 0:n[1],e=void(j.params[r.toLowerCase()]=n)),null===e&&(y=o),e}function Ot(){var e;return e=null===(e=w())&&null===(e=fe())?re():e}function xt(){var e;return"render"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"render"')),e=null===e&&("session"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"session"')),null===e)&&("icon"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"icon"')),null===e)&&("alert"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"alert"')),null===e)?w():e}function Ct(){var e;return e=null===(e=Rt())?L():e}function Rt(){var e,t,r,n=y;return"handling"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"handling"')),null!==e&&null!==(t=A())&&("optional"===g.substr(y,8).toLowerCase()?(r=g.substr(y,8),y+=8):(r=null,_('"optional"')),null!==(r=null===r&&("required"===g.substr(y,8).toLowerCase()?(r=g.substr(y,8),y+=8):(r=null,_('"required"')),null===r)?w():r))?e=[e,t,r]:(e=null,y=n),e}function Nt(){var e,t,r,n,o,s,i,a=y;if(null!==(e=It()))if(null!==(t=Y()))if(null!==(r=Dt())){for(n=[],i=y,null!==(o=x())&&null!==(s=jt())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=x())&&null!==(s=jt())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e}function It(){var e;return e=null===(e=Pt())?Ut():e}function Pt(){var e;return"text"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"text"')),e=null===e&&("image"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"image"')),null===e)&&("audio"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"audio"')),null===e)&&("video"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"video"')),null===e)&&("application"===g.substr(y,11).toLowerCase()?(e=g.substr(y,11),y+=11):(e=null,_('"application"')),null===e)?Lt():e}function Ut(){var e;return"message"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"message"')),e=null===e&&("multipart"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"multipart"')),null===e)?Lt():e}function Lt(){var e;return e=null===(e=w())?kt():e}function kt(){var e,t,r=y;return"x-"===g.substr(y,2).toLowerCase()?(e=g.substr(y,2),y+=2):(e=null,_('"x-"')),null!==e&&null!==(t=w())?e=[e,t]:(e=null,y=r),e}function Dt(){var e;return e=null===(e=Lt())?w():e}function jt(){var e,t,r,n=y;return null!==(e=w())&&null!==(t=A())&&null!==(r=Vt())?e=[e,t,r]:(e=null,y=n),e}function Vt(){var e;return e=null===(e=w())?re():e}function Mt(){var e,t,r,n=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null!==e&&(r=e,e=void(j.value=parseInt(r.join("")))),null===e&&(y=n),e}function Bt(){var e,t,r,n,o,s=y;if(null!==(e=z())){for(t=[],o=y,46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')),null!==r&&null!==(n=z())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')),null!==r&&null!==(n=z())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e}function Ft(){var e;return e=null===(e=qt())?L():e}function qt(){var e,t,r,n=y,o=y;return"tag"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"tag"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.tag=r)),null===e&&(y=n),e}function Ht(){var e,t,r,n,o,s,i,a=y;if("digest"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"Digest"')),null!==e)if(null!==(t=m()))if(null!==(r=Kt())){for(n=[],i=y,null!==(o=O())&&null!==(s=Kt())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=O())&&null!==(s=Kt())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e=null===e?Gt():e}function Gt(){var e,t,r,n,o,s,i,a=y;if(null!==(e=w()))if(null!==(t=m()))if(null!==(r=zt())){for(n=[],i=y,null!==(o=O())&&null!==(s=zt())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=O())&&null!==(s=zt())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e}function zt(){var e,t,r,n=y;return null!==(e=w())&&null!==(t=A())&&null!==(r=null===(r=w())?re():r)?e=[e,t,r]:(e=null,y=n),e}function Kt(){var e;return e=null===(e=Yt())&&null===(e=Wt())&&null===(e=$t())&&null===(e=Zt())&&null===(e=er())&&null===(e=tr())&&null===(e=rr())?zt():e}function Yt(){var e,t,r,n=y;return"realm"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"realm"')),null!==e&&null!==(t=A())&&null!==(r=Jt())?e=[e,t,r]:(e=null,y=n),e}function Jt(){var e,t,r=y;return null!==(e=C())&&(t=e,e=void(j.realm=t)),null===e&&(y=r),e}function Wt(){var e,t,r,n,o,s,i,a,u=y;if("domain"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"domain"')),null!==e)if(null!==(t=A()))if(null!==(r=Z()))if(null!==(n=Xt())){if(o=[],a=y,null!==(i=h()))for(s=[];null!==i;)s.push(i),i=h();else s=null;for(null!==s&&null!==(i=Xt())?s=[s,i]:(s=null,y=a);null!==s;){if(o.push(s),a=y,null!==(i=h()))for(s=[];null!==i;)s.push(i),i=h();else s=null;null!==s&&null!==(i=Xt())?s=[s,i]:(s=null,y=a)}null!==o&&null!==(s=ee())?e=[e,t,r,n,o,s]:(e=null,y=u)}else e=null,y=u;else e=null,y=u;else e=null,y=u;else e=null,y=u;return e}function Xt(){var e;return e=null===(e=He())?Ke():e}function $t(){var e,t,r,n=y;return"nonce"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"nonce"')),null!==e&&null!==(t=A())&&null!==(r=Qt())?e=[e,t,r]:(e=null,y=n),e}function Qt(){var e,t,r=y;return null!==(e=C())&&(t=e,e=void(j.nonce=t)),null===e&&(y=r),e}function Zt(){var e,t,r,n=y,o=y;return"opaque"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"opaque"')),null!==e&&null!==(r=A())&&null!==(t=C())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.opaque=r)),null===e&&(y=n),e}function er(){var e,t,r,n,o=y;return"stale"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"stale"')),null!==e&&null!==(t=A())&&(n=y,"true"===g.substr(y,4).toLowerCase()?(r=g.substr(y,4),y+=4):(r=null,_('"true"')),null===(r=null!==r?void(j.stale=!0):r)&&(y=n),null===r&&(n=y,"false"===g.substr(y,5).toLowerCase()?(r=g.substr(y,5),y+=5):(r=null,_('"false"')),null===(r=null!==r?void(j.stale=!1):r))&&(y=n),null!==r)?e=[e,t,r]:(e=null,y=o),e}function tr(){var e,t,r,n=y,o=y;return"algorithm"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"algorithm"')),null!==e&&null!==(r=A())&&("md5"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"MD5"')),null!==(t=null===t&&("md5-sess"===g.substr(y,8).toLowerCase()?(t=g.substr(y,8),y+=8):(t=null,_('"MD5-sess"')),null===t)?w():t))?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.algorithm=r.toUpperCase())),null===e&&(y=n),e}function rr(){var e,t,r,n,o,s,i,a,u,l=y;if("qop"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"qop"')),null!==e)if(null!==(t=A()))if(null!==(r=Z())){if(a=y,null!==(n=nr())){for(o=[],u=y,44===g.charCodeAt(y)?(s=",",y++):(s=null,_('","')),null!==s&&null!==(i=nr())?s=[s,i]:(s=null,y=u);null!==s;)o.push(s),u=y,44===g.charCodeAt(y)?(s=",",y++):(s=null,_('","')),null!==s&&null!==(i=nr())?s=[s,i]:(s=null,y=u);null!==o?n=[n,o]:(n=null,y=a)}else n=null,y=a;null!==n&&null!==(o=ee())?e=[e,t,r,n,o]:(e=null,y=l)}else e=null,y=l;else e=null,y=l;else e=null,y=l;return e}function nr(){var e,t,r=y;return"auth-int"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"auth-int"')),null!==(e=null===e&&("auth"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"auth"')),null===e)?w():e)&&(t=e,j.qop||(j.qop=[]),e=void j.qop.push(t.toLowerCase())),null===e&&(y=r),e}function or(){var e,t,r,n,o,s=y,i=y;if(null!==(e=P())){for(t=[],o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(e=>{var t;j.multi_header||(j.multi_header=[]);try{t=new D(j.uri,j.display_name,j.params),delete j.uri,delete j.display_name,delete j.params}catch(e){t=null}j.multi_header.push({possition:y,offset:e,parsed:t})})(s):e)&&(y=s),e}function sr(){var e;return e=null===(e=ir())?L():e}function ir(){var e,t,r,n,o=y,s=y;if("cause"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"cause"')),null!==e)if(null!==(n=A())){if(null!==(r=l()))for(t=[];null!==r;)t.push(r),r=l();else t=null;null!==t?e=[e,n,t]:(e=null,y=s)}else e=null,y=s;else e=null,y=s;return null!==e&&(n=e[2],e=void(j.cause=parseInt(n.join("")))),null===e&&(y=o),e}function ar(){var e,t,r,n,o,s=y;if(null!==(e=P())){for(t=[],o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=L())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e}function ur(){var e,t=y;return"active"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"active"')),null===(e=null!==(e=null===e&&("pending"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"pending"')),null===e)&&("terminated"===g.substr(y,10).toLowerCase()?(e=g.substr(y,10),y+=10):(e=null,_('"terminated"')),null===e)?w():e)?void(j.state=g.substring(y,t)):e)&&(y=t),e}function lr(){var e,t,r,n,o=y,s=y;return"reason"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"reason"')),null!==e&&null!==(t=A())&&null!==(r=cr())?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(void 0!==(n=e[2])&&(j.reason=n)):e)&&(y=o),e=null===e&&(s=o=y,"expires"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"expires"')),null!==e&&null!==(t=A())&&null!==(r=U())?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(void 0!==(n=e[2])&&(j.expires=n)):e)&&(y=o),null===e)&&(s=o=y,"retry_after"===g.substr(y,11).toLowerCase()?(e=g.substr(y,11),y+=11):(e=null,_('"retry_after"')),null!==e&&null!==(t=A())&&null!==(r=U())?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(void 0!==(n=e[2])&&(j.retry_after=n)):e)&&(y=o),null===e)?L():e}function cr(){var e;return"deactivated"===g.substr(y,11).toLowerCase()?(e=g.substr(y,11),y+=11):(e=null,_('"deactivated"')),e=null===e&&("probation"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"probation"')),null===e)&&("rejected"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"rejected"')),null===e)&&("timeout"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"timeout"')),null===e)&&("giveup"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"giveup"')),null===e)&&("noresource"===g.substr(y,10).toLowerCase()?(e=g.substr(y,10),y+=10):(e=null,_('"noresource"')),null===e)&&("invariant"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"invariant"')),null===e)?w():e}function pr(){var e;return e=null===(e=qt())?L():e}function hr(){var e,t,r,n,o,s,i,a=y;if(null!==(e=br()))if(null!==(t=m()))if(null!==(r=wr())){for(n=[],i=y,null!==(o=x())&&null!==(s=dr())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=x())&&null!==(s=dr())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e}function dr(){var e;return e=null===(e=fr())&&null===(e=mr())&&null===(e=gr())&&null===(e=yr())&&null===(e=_r())?L():e}function fr(){var e,t,r,n=y,o=y;return"ttl"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"ttl"')),null!==e&&null!==(r=A())&&null!==(t=Or())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.ttl=r)),null===e&&(y=n),e}function mr(){var e,t,r,n=y,o=y;return"maddr"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"maddr"')),null!==e&&null!==(r=A())&&null!==(t=fe())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.maddr=r)),null===e&&(y=n),e}function gr(){var e,t,r,n=y,o=y;return"received"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"received"')),null!==e&&null!==(r=A())&&null!==(t=null===(t=be())?ve():t)?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.received=r)),null===e&&(y=n),e}function yr(){var e,t,r,n=y,o=y;return"branch"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"branch"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.branch=r)),null===e&&(y=n),e}function _r(){var e,t,r,n,o=y;return"rport"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"rport"')),null!==e&&(n=y,null!==(t=A())&&null!==(r=vr())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function vr(){var e,t,r,n,o,s=y,i=y;return null!==(e=null!==(e=l())?e:"")&&null!==(o=null!==(o=l())?o:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")?e=[e,o,t,r,n]:(e=null,y=i),null!==e&&(o=e,e=void(j.rport=parseInt(o.join("")))),null===e&&(y=s),e}function br(){var e,t,r,n,o,s=y;return null!==(e=Sr())&&null!==(t=Y())&&null!==(r=w())&&null!==(n=Y())&&null!==(o=Tr())?e=[e,t,r,n,o]:(e=null,y=s),e}function Sr(){var e,t,r=y;return"sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"SIP"')),null!==(e=null===e?w():e)&&(t=e,e=void(j.protocol=t)),null===e&&(y=r),e}function Tr(){var e,t,r=y;return"udp"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"UDP"')),null!==(e=null===e&&("tcp"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"TCP"')),null===e)&&("tls"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"TLS"')),null===e)&&("sctp"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"SCTP"')),null===e)?w():e)&&(t=e,e=void(j.transport=t)),null===e&&(y=r),e}function wr(){var e,t,r,n,o=y;return null!==(e=Er())&&(n=y,null!==(t=Q())&&null!==(r=Ar())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function Er(){var e,t=y;return null===(e=null!==(e=null===(e=be())&&null===(e=_e())?me():e)?void(j.host=g.substring(y,t)):e)&&(y=t),e}function Ar(){var e,t,r,n,o,s=y,i=y;return null!==(e=null!==(e=l())?e:"")&&null!==(o=null!==(o=l())?o:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")?e=[e,o,t,r,n]:(e=null,y=i),null!==e&&(o=e,e=void(j.port=parseInt(o.join("")))),null===e&&(y=s),e}function Or(){var e,t,r,n=y,o=y;return null!==(e=l())&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?parseInt(e.join("")):e)&&(y=n),e}function xr(){var e,t,r=y;return null!==(e=U())&&(t=e,e=void(j.expires=t)),null===e&&(y=r),e}function Cr(){var e;return e=null===(e=Rr())?L():e}function Rr(){var e,t,r,n=y,o=y;return"refresher"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"refresher"')),null!==e&&null!==(r=A())&&("uac"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"uac"')),null===t&&("uas"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"uas"'))),null!==t)?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.refresher=r.toLowerCase())),null===e&&(y=n),e}function Nr(){var e,t=[];for(null===(e=b())&&null===(e=T())&&(e=m());null!==e;)t.push(e),null===(e=b())&&null===(e=T())&&(e=m());return t}function Ir(){var e,t,r,n,o,s,i,a,u,l=y,c=y;return null!==(e=Pr())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null!==t)&&null!==(r=k())&&(45===g.charCodeAt(y)?(n="-",y++):(n=null,_('"-"')),null!==n)&&null!==(o=k())&&(45===g.charCodeAt(y)?(s="-",y++):(s=null,_('"-"')),null!==s)&&null!==(i=k())&&(45===g.charCodeAt(y)?(a="-",y++):(a=null,_('"-"')),null!==a)&&null!==(u=Ur())?e=[e,t,r,n,o,s,i,a,u]:(e=null,y=c),null!==e&&(e[0],e=void(j=g.substring(y+5,l))),null===e&&(y=l),e}function k(){var e,t,r,n,o=y;return null!==(e=a())&&null!==(t=a())&&null!==(r=a())&&null!==(n=a())?e=[e,t,r,n]:(e=null,y=o),e}function Pr(){var e,t,r=y;return null!==(e=k())&&null!==(t=k())?e=[e,t]:(e=null,y=r),e}function Ur(){var e,t,r,n=y;return null!==(e=k())&&null!==(t=k())&&null!==(r=k())?e=[e,t,r]:(e=null,y=n),e}function Lr(){var e,t,r,n,o=y,s=y;return null!==(e=E())&&(n=y,64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null!==t&&null!==(r=E())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null===(e=null!==e?void(j.call_id=g.substring(y,o)):e)&&(y=o),e}function kr(){var e;return e=null===(e=Dr())&&null===(e=jr())&&null===(e=Vr())?L():e}function Dr(){var e,t,r,n=y,o=y;return"to-tag"===g.substr(y,6)?(e="to-tag",y+=6):(e=null,_('"to-tag"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.to_tag=r)),null===e&&(y=n),e}function jr(){var e,t,r,n=y,o=y;return"from-tag"===g.substr(y,8)?(e="from-tag",y+=8):(e=null,_('"from-tag"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(j.from_tag=r)),null===e&&(y=n),e}function Vr(){var e,t=y;return"early-only"===g.substr(y,10)?(e="early-only",y+=10):(e=null,_('"early-only"')),null===(e=null!==e?void(j.early_only=!0):e)&&(y=t),e}var Mr,Br,Fr=B(),D=M(),j={};return null===e[u]()||y!==g.length?(Mr=(e=Math.max(y,s))<g.length?g.charAt(e):null,Br=(()=>{for(var e=1,t=1,r=!1,n=0;n<Math.max(y,s);n++)var o=g.charAt(n),r="\n"===o?(r||e++,!(t=1)):"\r"===o||"\u2028"===o||"\u2029"===o?(e++,t=1,!0):(t++,!1);return{line:e,column:t}})(),new this.SyntaxError((e=>{e.sort();for(var t=null,r=[],n=0;n<e.length;n++)e[n]!==t&&(r.push(e[n]),t=e[n]);return r})(t),Mr,e,Br.line,Br.column),-1):j},toSource:function(){return this._source},SyntaxError:function(e,t,r,n,o){this.name="SyntaxError",this.expected=e,this.found=t,this.message=((e,t)=>{var r;switch(e.length){case 0:r="end of input";break;case 1:r=e[0];break;default:r=e.slice(0,e.length-1).join(", ")+" or "+e[e.length-1]}return"Expected "+r+" but "+(t?qr(t):"end of input")+" found."})(e,t),this.offset=r,this.line=n,this.column=o}}).SyntaxError.prototype=Error.prototype,x=e),x;function qr(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g,escape)+'"'}var e}function B(){var u,a,t;return N||(N=1,u=s,a=F(),t=V(),R=p(c,[{key:"scheme",get:function(){return this._scheme},set:function(e){this._scheme=e.toLowerCase()}},{key:"user",get:function(){return this._user},set:function(e){this._user=e}},{key:"host",get:function(){return this._host},set:function(e){this._host=e.toLowerCase()}},{key:"port",get:function(){return this._port},set:function(e){this._port=0===e?e:parseInt(e,10)||null}},{key:"setParam",value:function(e,t){e&&(this._parameters[e.toLowerCase()]=null==t?null:t.toString())}},{key:"getParam",value:function(e){if(e)return this._parameters[e.toLowerCase()]}},{key:"hasParam",value:function(e){if(e)return!!this._parameters.hasOwnProperty(e.toLowerCase())}},{key:"deleteParam",value:function(e){var t;if(e=e.toLowerCase(),this._parameters.hasOwnProperty(e))return t=this._parameters[e],delete this._parameters[e],t}},{key:"clearParams",value:function(){this._parameters={}}},{key:"setHeader",value:function(e,t){this._headers[a.headerize(e)]=Array.isArray(t)?t:[t]}},{key:"getHeader",value:function(e){if(e)return this._headers[a.headerize(e)]}},{key:"hasHeader",value:function(e){if(e)return!!this._headers.hasOwnProperty(a.headerize(e))}},{key:"deleteHeader",value:function(e){var t;if(e=a.headerize(e),this._headers.hasOwnProperty(e))return t=this._headers[e],delete this._headers[e],t}},{key:"clearHeaders",value:function(){this._headers={}}},{key:"clone",value:function(){return new c(this._scheme,this._user,this._host,this._port,JSON.parse(JSON.stringify(this._parameters)),JSON.parse(JSON.stringify(this._headers)))}},{key:"toString",value:function(){var e,t,r=[],n="".concat(this._scheme,":");for(e in this._user&&(n+="".concat(a.escapeUser(this._user),"@")),n+=this._host,!this._port&&0!==this._port||(n+=":".concat(this._port)),this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,e)&&(n+=";".concat(e),null!==this._parameters[e])&&(n+="=".concat(this._parameters[e]));for(t in this._headers)if(Object.prototype.hasOwnProperty.call(this._headers,t)){var o,s=d(this._headers[t]);try{for(s.s();!(o=s.n()).done;){var i=o.value;r.push("".concat(t,"=").concat(i))}}catch(r){s.e(r)}finally{s.f()}}return 0<r.length&&(n+="?".concat(r.join("&"))),n}},{key:"toAor",value:function(e){var t="".concat(this._scheme,":");return this._user&&(t+="".concat(a.escapeUser(this._user),"@")),t+=this._host,e&&(this._port||0===this._port)&&(t+=":".concat(this._port)),t}}],[{key:"parse",value:function(e){return-1!==(e=t.parse(e,"SIP_URI"))?e:void 0}}])),R;function c(e,t,r,n){var o,s,i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{},a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:{};if(l(this,c),!r)throw new TypeError('missing or invalid "host" parameter');for(o in this._parameters={},this._headers={},this._scheme=e||u.SIP,this._user=t,this._host=r,this._port=n,i)Object.prototype.hasOwnProperty.call(i,o)&&this.setParam(o,i[o]);for(s in a)Object.prototype.hasOwnProperty.call(a,s)&&this.setHeader(s,a[s])}}function F(){var i,a,t,u,e,l;return I||(I=1,i=s,a=B(),t=V(),D.str_utf8_length=function(e){return unescape(encodeURIComponent(e)).length},u=D.isFunction=function(e){return void 0!==e&&"[object Function]"===Object.prototype.toString.call(e)},D.isString=function(e){return void 0!==e&&"[object String]"===Object.prototype.toString.call(e)},D.isDecimal=function(e){return!isNaN(e)&&parseFloat(e)===parseInt(e,10)},D.isEmpty=function(e){return null===e||""===e||void 0===e||Array.isArray(e)&&0===e.length||"number"==typeof e&&isNaN(e)},D.hasMethods=function(e){for(var t=arguments.length,r=new Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var o=0,s=r;o<s.length;o++){var i=s[o];if(u(e[i]))return!1}return!0},e=D.createRandomToken=function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:32,r="",n=0;n<e;n++)r+=(Math.random()*t|0).toString(t);return r},D.newTag=function(){return e(10)},D.newUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},D.hostType=function(e){return e&&-1!==(e=t.parse(e,"host"))?e.host_type:void 0},l=D.escapeUser=function(e){return encodeURIComponent(decodeURIComponent(e)).replace(/%3A/gi,":").replace(/%2B/gi,"+").replace(/%3F/gi,"?").replace(/%2F/gi,"/")},D.normalizeTarget=function(e,t){if(e){if(e instanceof a)return e;if("string"==typeof e){var r,n,o=e.split("@");switch(o.length){case 1:if(!t)return;r=e,n=t;break;case 2:r=o[0],n=o[1];break;default:r=o.slice(0,o.length-1).join("@"),n=o[o.length-1]}return r=r.replace(/^(sips?|tel):/i,""),/^[-.()]*\+?[0-9\-.()]+$/.test(r)&&(r=r.replace(/[-.()]/g,"")),e="".concat(i.SIP,":").concat(l(r),"@").concat(n),a.parse(e)||void 0}}},D.headerize=function(e){for(var t={"Call-Id":"Call-ID",Cseq:"CSeq","Www-Authenticate":"WWW-Authenticate"},r=e.toLowerCase().replace(/_/g,"-").split("-"),n="",o=r.length,s=0;s<o;s++)0!==s&&(n+="-"),n+=r[s].charAt(0).toUpperCase()+r[s].substring(1);return n=t[n]?t[n]:n},D.sipErrorCause=function(e){for(var t in i.SIP_ERROR_CAUSES)if(-1!==i.SIP_ERROR_CAUSES[t].indexOf(e))return i.causes[t];return i.causes.SIP_FAILURE_CODE},D.getRandomTestNetIP=function(){return"192.0.2.".concat(Math.floor(254*Math.random()+1))},D.calculateMD5=function(e){function a(e,t){return e<<t|e>>>32-t}function u(e,t){var r=2147483648&e,n=2147483648&t,o=1073741824&e,s=1073741824&t,e=(1073741823&e)+(1073741823&t);return o&s?2147483648^e^r^n:o|s?1073741824&e?3221225472^e^r^n:1073741824^e^r^n:e^r^n}function t(e,t,r,n,o,s,i){return e=u(e,u(u(t&r|~t&n,o),i)),u(a(e,s),t)}function r(e,t,r,n,o,s,i){return e=u(e,u(u(t&n|r&~n,o),i)),u(a(e,s),t)}function n(e,t,r,n,o,s,i){return e=u(e,u(u(t^r^n,o),i)),u(a(e,s),t)}function o(e,t,r,n,o,s,i){return e=u(e,u(u(r^(t|~n),o),i)),u(a(e,s),t)}function s(e){for(var t="",r="",n=0;n<=3;n++)t+=(r="0".concat((e>>>8*n&255).toString(16))).substr(r.length-2,2);return t}for(var i,l,c,p,h=(e=>{for(var t,r=e.length,n=16*(((n=r+8)-n%64)/64+1),o=new Array(n-1),s=0,i=0;i<r;)s=i%4*8,o[t=(i-i%4)/4]=o[t]|e.charCodeAt(i)<<s,i++;return o[t=(i-i%4)/4]=o[t]|128<<(s=i%4*8),o[n-2]=r<<3,o[n-1]=r>>>29,o})(e=(e=>{for(var t="",r=0;r<e.length;r++){var n=e.charCodeAt(r);n<128?t+=String.fromCharCode(n):(127<n&&n<2048?t+=String.fromCharCode(n>>6|192):t=(t+=String.fromCharCode(n>>12|224))+String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t})(e)),d=1732584193,f=4023233417,m=2562383102,g=271733878,y=0;y<h.length;y+=16)d=t(i=d,l=f,c=m,p=g,h[y+0],7,3614090360),g=t(g,d,f,m,h[y+1],12,3905402710),m=t(m,g,d,f,h[y+2],17,606105819),f=t(f,m,g,d,h[y+3],22,3250441966),d=t(d,f,m,g,h[y+4],7,4118548399),g=t(g,d,f,m,h[y+5],12,1200080426),m=t(m,g,d,f,h[y+6],17,2821735955),f=t(f,m,g,d,h[y+7],22,4249261313),d=t(d,f,m,g,h[y+8],7,1770035416),g=t(g,d,f,m,h[y+9],12,2336552879),m=t(m,g,d,f,h[y+10],17,4294925233),f=t(f,m,g,d,h[y+11],22,2304563134),d=t(d,f,m,g,h[y+12],7,1804603682),g=t(g,d,f,m,h[y+13],12,4254626195),m=t(m,g,d,f,h[y+14],17,2792965006),d=r(d,f=t(f,m,g,d,h[y+15],22,1236535329),m,g,h[y+1],5,4129170786),g=r(g,d,f,m,h[y+6],9,3225465664),m=r(m,g,d,f,h[y+11],14,643717713),f=r(f,m,g,d,h[y+0],20,3921069994),d=r(d,f,m,g,h[y+5],5,3593408605),g=r(g,d,f,m,h[y+10],9,38016083),m=r(m,g,d,f,h[y+15],14,3634488961),f=r(f,m,g,d,h[y+4],20,3889429448),d=r(d,f,m,g,h[y+9],5,568446438),g=r(g,d,f,m,h[y+14],9,3275163606),m=r(m,g,d,f,h[y+3],14,4107603335),f=r(f,m,g,d,h[y+8],20,1163531501),d=r(d,f,m,g,h[y+13],5,2850285829),g=r(g,d,f,m,h[y+2],9,4243563512),m=r(m,g,d,f,h[y+7],14,1735328473),d=n(d,f=r(f,m,g,d,h[y+12],20,2368359562),m,g,h[y+5],4,4294588738),g=n(g,d,f,m,h[y+8],11,2272392833),m=n(m,g,d,f,h[y+11],16,1839030562),f=n(f,m,g,d,h[y+14],23,4259657740),d=n(d,f,m,g,h[y+1],4,2763975236),g=n(g,d,f,m,h[y+4],11,1272893353),m=n(m,g,d,f,h[y+7],16,4139469664),f=n(f,m,g,d,h[y+10],23,3200236656),d=n(d,f,m,g,h[y+13],4,681279174),g=n(g,d,f,m,h[y+0],11,3936430074),m=n(m,g,d,f,h[y+3],16,3572445317),f=n(f,m,g,d,h[y+6],23,76029189),d=n(d,f,m,g,h[y+9],4,3654602809),g=n(g,d,f,m,h[y+12],11,3873151461),m=n(m,g,d,f,h[y+15],16,530742520),d=o(d,f=n(f,m,g,d,h[y+2],23,3299628645),m,g,h[y+0],6,4096336452),g=o(g,d,f,m,h[y+7],10,1126891415),m=o(m,g,d,f,h[y+14],15,2878612391),f=o(f,m,g,d,h[y+5],21,4237533241),d=o(d,f,m,g,h[y+12],6,1700485571),g=o(g,d,f,m,h[y+3],10,2399980690),m=o(m,g,d,f,h[y+10],15,4293915773),f=o(f,m,g,d,h[y+1],21,2240044497),d=o(d,f,m,g,h[y+8],6,1873313359),g=o(g,d,f,m,h[y+15],10,4264355552),m=o(m,g,d,f,h[y+6],15,2734768916),f=o(f,m,g,d,h[y+13],21,1309151649),d=o(d,f,m,g,h[y+4],6,4149444226),g=o(g,d,f,m,h[y+11],10,3174756917),m=o(m,g,d,f,h[y+2],15,718787259),f=o(f,m,g,d,h[y+9],21,3951481745),d=u(d,i),f=u(f,l),m=u(m,c),g=u(g,p);return(s(d)+s(f)+s(m)+s(g)).toLowerCase()},D.closeMediaStream=function(e){if(e)try{if(e.getTracks){var t,r=d(e.getTracks());try{for(r.s();!(t=r.n()).done;)t.value.stop()}catch(e){r.e(e)}finally{r.f()}}else{var n,o=d(e.getAudioTracks());try{for(o.s();!(n=o.n()).done;)n.value.stop()}catch(e){o.e(e)}finally{o.f()}var s,i=d(e.getVideoTracks());try{for(i.s();!(s=i.n()).done;)s.value.stop()}catch(e){i.e(e)}finally{i.f()}}}catch(t){"function"!=typeof e.stop&&"object"!==S(e.stop)||e.stop()}},D.cloneArray=function(e){return e&&e.slice()||[]},D.cloneObject=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return e&&Object.assign({},e)||t},D.toPlainObject=function(r){var n;return"object"!==S(r)||null===r?r:(n={},Object.keys(r).forEach(function(e){var t=r[e];!t||"function"==typeof t||t instanceof Date||t instanceof RegExp||"symbol"===S(t)||"object"===S(t)&&t.constructor!==Object||(n[e]=t)}),n)},D.isMiniProgram=function(){return"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfo&&"undefined"==typeof window}),D}function q(){}function H(){H.init.call(this)}function G(e){return void 0===e._maxListeners?H.defaultMaxListeners:e._maxListeners}function z(e,t,r,n){var o,s;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');return(o=e._events)?(o.newListener&&(e.emit("newListener",t,r.listener||r),o=e._events),s=o[t]):(o=e._events=new q,e._eventsCount=0),s?("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),!s.warned&&(n=G(e))&&0<n&&s.length>n&&(s.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=s.length,n=n,"function"==typeof console.warn?console.warn(n):console.log(n))):(s=o[t]=r,++e._eventsCount),e}function K(e,t,r){var n=!1;function o(){e.removeListener(t,o),n||(n=!0,r.apply(e,arguments))}return o.listener=r,o}function Y(e){var t=this._events;if(t){t=t[e];if("function"==typeof t)return 1;if(t)return t.length}return 0}function W(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}q.prototype=Object.create(null),(H.EventEmitter=H).usingDomains=!1,H.prototype.domain=void 0,H.prototype._events=void 0,H.prototype._maxListeners=void 0,H.defaultMaxListeners=10,H.init=function(){this.domain=null,H.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new q,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},H.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},H.prototype.getMaxListeners=function(){return G(this)},H.prototype.emit=function(e){var t,r,n,o,s,i="error"===e;if(s=this._events)i=i&&null==s.error;else if(!i)return!1;if(a=this.domain,i){if(i=arguments[1],a)return(i=i||new Error('Uncaught, unspecified "error" event')).domainEmitter=this,i.domain=a,i.domainThrown=!1,a.emit("error",i),!1;if(i instanceof Error)throw i;var a=new Error('Uncaught, unspecified "error" event. ('+i+")");throw a.context=i,a}if(!(t=s[e]))return!1;var u="function"==typeof t;switch(r=arguments.length){case 1:var l=t,c=this;if(u)l.call(c);else for(var p=l.length,k=W(l,p),h=0;h<p;++h)k[h].call(c);break;case 2:var l=t,d=u,f=this,m=arguments[1];if(d)l.call(f,m);else for(var g=l.length,D=W(l,g),y=0;y<g;++y)D[y].call(f,m);break;case 3:var d=t,_=u,v=this,b=arguments[1],S=arguments[2];if(_)d.call(v,b,S);else for(var T=d.length,j=W(d,T),w=0;w<T;++w)j[w].call(v,b,S);break;case 4:var _=t,E=u,A=this,O=arguments[1],x=arguments[2],C=arguments[3];if(E)_.call(A,O,x,C);else for(var R=_.length,V=W(_,R),N=0;N<R;++N)V[N].call(A,O,x,C);break;default:for(n=new Array(r-1),o=1;o<r;o++)n[o-1]=arguments[o];var E=t,I=this,P=n;if(u)E.apply(I,P);else for(var U=E.length,M=W(E,U),L=0;L<U;++L)M[L].apply(I,P)}return!0},H.prototype.addListener=function(e,t){return z(this,e,t,!1)},H.prototype.on=H.prototype.addListener,H.prototype.prependListener=function(e,t){return z(this,e,t,!0)},H.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,K(this,e,t)),this},H.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,K(this,e,t)),this},H.prototype.removeListener=function(e,t){var r,n,o,s,i;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if((n=this._events)&&(r=n[e]))if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new q:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,s=r.length;0<s--;)if(r[s]===t||r[s].listener&&r[s].listener===t){i=r[s].listener,o=s;break}if(o<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new q,this;delete n[e]}else{var a=r;for(var u=o,l=u+1,c=a.length;l<c;u+=1,l+=1)a[u]=a[l];a.pop()}n.removeListener&&this.emit("removeListener",e,i||t)}return this},H.prototype.off=function(e,t){return this.removeListener(e,t)},H.prototype.removeAllListeners=function(e){var t,r;if(r=this._events)if(r.removeListener){if(0===arguments.length){for(var n,o=Object.keys(r),s=0;s<o.length;++s)"removeListener"!==(n=o[s])&&this.removeAllListeners(n);this.removeAllListeners("removeListener"),this._events=new q,this._eventsCount=0}else if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)for(;this.removeListener(e,t[t.length-1]),t[0];);}else 0===arguments.length?(this._events=new q,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new q:delete r[e]);return this},H.prototype.listeners=function(e){var t=this._events;{if(t&&(t=t[e])){if("function"==typeof t)return[t.listener||t];for(var r=t,n=new Array(r.length),o=0;o<n.length;++o)n[o]=r[o].listener||r[o];return n}return[]}},H.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Y.call(e,t)},H.prototype.listenerCount=Y,H.prototype.eventNames=function(){return 0<this._eventsCount?Reflect.ownKeys(this._events):[]};var $=n(Object.freeze({__proto__:null,default:H,EventEmitter:H})),J="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function X(){throw new Error("setTimeout has not been defined")}function Q(){throw new Error("clearTimeout has not been defined")}var Z=X,ee=Q;function te(t){if(Z===setTimeout)return setTimeout(t,0);if((Z===X||!Z)&&setTimeout)return(Z=setTimeout)(t,0);try{return Z(t,0)}catch(e){try{return Z.call(null,t,0)}catch(e){return Z.call(this,t,0)}}}"function"==typeof J.setTimeout&&(Z=setTimeout),"function"==typeof J.clearTimeout&&(ee=clearTimeout);var re,ne=[],oe=!1,ie=-1;function se(){oe&&re&&(oe=!1,re.length?ne=re.concat(ne):ie=-1,ne.length)&&ae()}function ae(){if(!oe){var e=te(se);oe=!0;for(var t=ne.length;t;){for(re=ne,ne=[];++ie<t;)re&&re[ie].run();ie=-1,t=ne.length}re=null,oe=!1,function(t){if(ee===clearTimeout)return clearTimeout(t);if((ee===Q||!ee)&&clearTimeout)return(ee=clearTimeout)(t);try{ee(t)}catch(e){try{return ee.call(null,t)}catch(e){return ee.call(this,t)}}}(e)}}function ue(e,t){this.fun=e,this.array=t}function le(){}ue.prototype.run=function(){this.fun.apply(null,this.array)};var be,Te,ce=le,pe=le,de=le,he=le,fe=le,me=le,ge=le,ye=J.performance||{},_e=ye.now||ye.mozNow||ye.msNow||ye.oNow||ye.webkitNow||function(){return(new Date).getTime()},ve=new Date,Se={nextTick:function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];ne.push(new ue(e,t)),1!==ne.length||oe||te(ae)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:ce,addListener:pe,once:de,off:he,removeListener:fe,removeAllListeners:me,emit:ge,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*_e.call(ye),r=Math.floor(t),t=Math.floor(t%1*1e9);return e&&(r-=e[0],(t-=e[1])<0)&&(r--,t+=1e9),[r,t]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-ve)/1e3}},we={exports:{}};function Ee(){if(Te)return be;Te=1;var o=1e3,s=60*o,i=60*s,a=24*i,u=7*a,l=365.25*a;function c(e,t,r,n){t=1.5*r<=t;return Math.round(e/r)+" "+n+(t?"s":"")}return be=function(e,t){t=t||{};var r=typeof e;if(!("string"==r&&0<e.length)){if("number"==r&&isFinite(e))return t.long?(r=e,t=Math.abs(r),a<=t?c(r,t,a,"day"):i<=t?c(r,t,i,"hour"):s<=t?c(r,t,s,"minute"):o<=t?c(r,t,o,"second"):r+" ms"):(t=e,r=Math.abs(t),a<=r?Math.round(t/a)+"d":i<=r?Math.round(t/i)+"h":s<=r?Math.round(t/s)+"m":o<=r?Math.round(t/o)+"s":t+"ms");throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}r=e;if(!(100<(r=String(r)).length)){r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(r){var n=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"weeks":case"week":case"w":return n*u;case"days":case"day":case"d":return n*a;case"hours":case"hour":case"hrs":case"hr":case"h":return n*i;case"minutes":case"minute":case"mins":case"min":case"m":return n*s;case"seconds":case"second":case"secs":case"sec":case"s":return n*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}}var Ae=function(t){function a(e){let r,t,n,o=null;function i(...s){if(i.enabled){let n=i,e=Number(new Date),t=e-(r||e),o=(n.diff=t,n.prev=r,n.curr=e,r=e,s[0]=a.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O"),0);s[0]=s[0].replace(/%([a-zA-Z%])/g,(t,r)=>{if("%%"===t)return"%";o++;r=a.formatters[r];if("function"==typeof r){let e=s[o];t=r.call(n,e),s.splice(o,1),o--}return t}),a.formatArgs.call(n,s),(n.log||a.log).apply(n,s)}}return i.namespace=e,i.useColors=a.useColors(),i.color=a.selectColor(e),i.extend=s,i.destroy=a.destroy,Object.defineProperty(i,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(t!==a.namespaces&&(t=a.namespaces,n=a.enabled(e)),n),set:e=>{o=e}}),"function"==typeof a.init&&a.init(i),i}function s(e,t){t=a(this.namespace+(void 0===t?":":t)+e);return t.log=this.log,t}function n(e,t){let r=0,n=0,o=-1,s=0;for(;r<e.length;)if(n<t.length&&(t[n]===e[r]||"*"===t[n]))"*"===t[n]?(o=n,s=r):r++,n++;else{if(-1===o)return;n=o+1,s++,r=s}for(;n<t.length&&"*"===t[n];)n++;return n===t.length}return((a.debug=a).default=a).coerce=function(e){return e instanceof Error?e.stack||e.message:e},a.disable=function(){var e=[...a.names,...a.skips.map(e=>"-"+e)].join(",");return a.enable(""),e},a.enable=function(e){a.save(e),a.namespaces=e,a.names=[],a.skips=[];var t=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let e of t)"-"===e[0]?a.skips.push(e.slice(1)):a.names.push(e)},a.enabled=function(e){for(var t of a.skips)if(n(e,t))return!1;for(var r of a.names)if(n(e,r))return!0;return!1},a.humanize=Ee(),a.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach(e=>{a[e]=t[e]}),a.names=[],a.skips=[],a.formatters={},a.selectColor=function(t){let r=0;for(let e=0;e<t.length;e++)r=(r<<5)-r+t.charCodeAt(e),r|=0;return a.colors[Math.abs(r)%a.colors.length]},a.enable(a.load()),a},Oe=(((t,r)=>{r.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),this.useColors){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");let t=0,r=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(t++,"%c"===e)&&(r=t)}),e.splice(r,0,n)}},r.save=function(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}},r.load=function(){let e;try{e=r.storage.getItem("debug")||r.storage.getItem("DEBUG")}catch(e){}return e=!e&&"env"in Se?Se.env.DEBUG:e},r.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&31<=parseInt(e[1],10)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage=(()=>{try{return localStorage}catch(e){}})(),r.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],r.log=console.debug||console.log||(()=>{}),t.exports=Ae(r),t.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}})(we,we.exports),{}),xe=[],Ce=[],Re="undefined"!=typeof Uint8Array?Uint8Array:Array,Ne=!1;function Ie(){Ne=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)xe[t]=e[t],Ce[e.charCodeAt(t)]=t;Ce["-".charCodeAt(0)]=62,Ce["_".charCodeAt(0)]=63}function Pe(e){return xe[e>>18&63]+xe[e>>12&63]+xe[e>>6&63]+xe[63&e]}function Ue(e,t,r){for(var n,o=[],s=t;s<r;s+=3)n=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(Pe(n));return o.join("")}function ke(e){var t;Ne||Ie();for(var r=e.length,n=r%3,o="",s=[],i=0,a=r-n;i<a;i+=16383)s.push(Ue(e,i,a<i+16383?a:i+16383));return 1==n?(t=e[r-1],o=(o+=xe[t>>2])+xe[t<<4&63]+"=="):2==n&&(t=(e[r-2]<<8)+e[r-1],o=(o=(o+=xe[t>>10])+xe[t>>4&63])+xe[t<<2&63]+"="),s.push(o),s.join("")}function Le(e,t,r,n,o){var s,i,a=8*o-n-1,u=(1<<a)-1,l=u>>1,c=-7,p=r?o-1:0,h=r?-1:1,o=e[t+p];for(p+=h,s=o&(1<<-c)-1,o>>=-c,c+=a;0<c;s=256*s+e[t+p],p+=h,c-=8);for(i=s&(1<<-c)-1,s>>=-c,c+=n;0<c;i=256*i+e[t+p],p+=h,c-=8);if(0===s)s=1-l;else{if(s===u)return i?NaN:1/0*(o?-1:1);i+=Math.pow(2,n),s-=l}return(o?-1:1)*i*Math.pow(2,s-n)}function je(e,t,r,n,o,s){var i,a,u=8*s-o-1,l=(1<<u)-1,c=l>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,d=n?1:-1,s=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=l):(i=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-i))<1&&(i--,n*=2),2<=(t+=1<=i+c?p/n:p*Math.pow(2,1-c))*n&&(i++,n/=2),l<=i+c?(a=0,i=l):1<=i+c?(a=(t*n-1)*Math.pow(2,o),i+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,o),i=0));8<=o;e[r+h]=255&a,h+=d,a/=256,o-=8);for(i=i<<o|a,u+=o;0<u;e[r+h]=255&i,h+=d,i/=256,u-=8);e[r+h-d]|=128*s}var De={}.toString,Me=Array.isArray||function(e){return"[object Array]"==De.call(e)};function Ve(){return Fe.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Be(e,t){if(Ve()<t)throw new RangeError("Invalid typed array length");return Fe.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Fe.prototype:(e=null===e?new Fe(t):e).length=t,e}function Fe(e,t,r){if(!(Fe.TYPED_ARRAY_SUPPORT||this instanceof Fe))return new Fe(e,t,r);if("number"!=typeof e)return qe(this,e,t,r);if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return Ge(this,e)}function qe(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer){var o=e,s=t,i=r;if(s.byteLength,i<0||s.byteLength<i)throw new RangeError("'offset' is out of bounds");if(s.byteLength<i+(n||0))throw new RangeError("'length' is out of bounds");return s=void 0===i&&void 0===n?new Uint8Array(s):void 0===n?new Uint8Array(s,i):new Uint8Array(s,i,n),Fe.TYPED_ARRAY_SUPPORT?(o=s).__proto__=Fe.prototype:o=ze(o,s),o}if("string"==typeof t){i=e,n=t,s=r;if(Fe.isEncoding(s="string"==typeof s&&""!==s?s:"utf8"))return(n=(i=Be(i,o=0|We(n,s))).write(n,s))!==o?i.slice(0,n):i;throw new TypeError('"encoding" must be a valid string encoding')}var a,r=e,n=t;if(Ye(n))return 0!==(r=Be(r,a=0|Ke(n.length))).length&&n.copy(r,0,0,a),r;if(n){if("undefined"!=typeof ArrayBuffer&&n.buffer instanceof ArrayBuffer||"length"in n)return"number"!=typeof n.length||(a=n.length)!=a?Be(r,0):ze(r,n);if("Buffer"===n.type&&Me(n.data))return ze(r,n.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function He(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function Ge(e,t){if(He(t),e=Be(e,t<0?0:0|Ke(t)),!Fe.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function ze(e,t){var r=t.length<0?0:0|Ke(t.length);e=Be(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function Ke(e){if(e>=Ve())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ve().toString(16)+" bytes");return 0|e}function Ye(e){return!(null==e||!e._isBuffer)}function We(e,t){if(Ye(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;var r=(e="string"!=typeof e?""+e:e).length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Tt(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return St(e).length;default:if(n)return Tt(e).length;t=(""+t).toLowerCase(),n=!0}}function $e(e,t,r){var n=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":return ct(this,t,r);case"utf8":case"utf-8":return st(this,t,r);case"ascii":return ut(this,t,r);case"latin1":case"binary":return lt(this,t,r);case"base64":return it(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pt(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function Je(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Xe(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647<r?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,(r=(r=isNaN(r)?o?0:e.length-1:r)<0?e.length+r:r)>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if(Ye(t="string"==typeof t?Fe.from(t,n):t))return 0===t.length?-1:Qe(e,t,r,n,o);if("number"==typeof t)return t&=255,Fe.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?(o?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):Qe(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function Qe(e,t,r,n,o){var s=1,i=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;i/=s=2,a/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o)for(var l=-1,c=r;c<i;c++)if(u(e,c)===u(t,-1===l?0:c-l)){if(c-(l=-1===l?c:l)+1===a)return l*s}else-1!==l&&(c-=c-l),l=-1;else for(c=r=i<r+a?i-a:r;0<=c;c--){for(var p=!0,h=0;h<a;h++)if(u(e,c+h)!==u(t,h)){p=!1;break}if(p)return c}return-1}function Ze(e,t,r,n){r=Number(r)||0;var o=e.length-r,o=((!n||(n=Number(n))>o)&&(n=o),t.length);if(o%2!=0)throw new TypeError("Invalid hex string");o/2<n&&(n=o/2);for(var s=0;s<n;++s){var i=parseInt(t.substr(2*s,2),16);if(isNaN(i))return s;e[r+s]=i}return s}function et(e,t,r,n){return wt(Tt(t,e.length-r),e,r,n)}function tt(e,t,r,n){return wt((e=>{for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t})(t),e,r,n)}function rt(e,t,r,n){return tt(e,t,r,n)}function nt(e,t,r,n){return wt(St(t),e,r,n)}function ot(e,t,r,n){return wt(((e,t)=>{for(var r,n,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,o.push(r%256),o.push(n);return o})(t,e.length-r),e,r,n)}function it(e,t,r){return 0===t&&r===e.length?ke(e):ke(e.slice(t,r))}function st(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var s,i,a,u,l=e[o],c=null,p=239<l?4:223<l?3:191<l?2:1;if(o+p<=r)switch(p){case 1:l<128&&(c=l);break;case 2:128==(192&(s=e[o+1]))&&127<(u=(31&l)<<6|63&s)&&(c=u);break;case 3:s=e[o+1],i=e[o+2],128==(192&s)&&128==(192&i)&&2047<(u=(15&l)<<12|(63&s)<<6|63&i)&&(u<55296||57343<u)&&(c=u);break;case 4:s=e[o+1],i=e[o+2],a=e[o+3],128==(192&s)&&128==(192&i)&&128==(192&a)&&65535<(u=(15&l)<<18|(63&s)<<12|(63&i)<<6|63&a)&&u<1114112&&(c=u)}null===c?(c=65533,p=1):65535<c&&(n.push((c-=65536)>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=p}var h=n,d=h.length;if(d<=at)return String.fromCharCode.apply(String,h);for(var f="",m=0;m<d;)f+=String.fromCharCode.apply(String,h.slice(m,m+=at));return f}Fe.TYPED_ARRAY_SUPPORT=void 0===J.TYPED_ARRAY_SUPPORT||J.TYPED_ARRAY_SUPPORT,Ve(),Fe.poolSize=8192,Fe._augment=function(e){return e.__proto__=Fe.prototype,e},Fe.from=function(e,t,r){return qe(null,e,t,r)},Fe.TYPED_ARRAY_SUPPORT&&(Fe.prototype.__proto__=Uint8Array.prototype,Fe.__proto__=Uint8Array),Fe.alloc=function(e,t,r){return t=t,r=r,He(e=e),!(e<=0)&&void 0!==t?"string"==typeof r?Be(null,e).fill(t,r):Be(null,e).fill(t):Be(null,e)},Fe.allocUnsafe=function(e){return Ge(null,e)},Fe.allocUnsafeSlow=function(e){return Ge(null,e)},Fe.isBuffer=function(e){return null!=e&&(!!e._isBuffer||Et(e)||"function"==typeof(e=e).readFloatLE&&"function"==typeof e.slice&&Et(e.slice(0,0)))},Fe.compare=function(e,t){if(!Ye(e)||!Ye(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,o=0,s=Math.min(r,n);o<s;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},Fe.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Fe.concat=function(e,t){if(!Me(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Fe.alloc(0);if(void 0===t)for(o=t=0;o<e.length;++o)t+=e[o].length;for(var r=Fe.allocUnsafe(t),n=0,o=0;o<e.length;++o){var s=e[o];if(!Ye(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,n),n+=s.length}return r},Fe.byteLength=We,Fe.prototype._isBuffer=!0,Fe.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Je(this,t,t+1);return this},Fe.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Je(this,t,t+3),Je(this,t+1,t+2);return this},Fe.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Je(this,t,t+7),Je(this,t+1,t+6),Je(this,t+2,t+5),Je(this,t+3,t+4);return this},Fe.prototype.toString=function(){var e=0|this.length;return 0==e?"":0===arguments.length?st(this,0,e):$e.apply(this,arguments)},Fe.prototype.equals=function(e){if(Ye(e))return this===e||0===Fe.compare(this,e);throw new TypeError("Argument must be a Buffer")},Fe.prototype.inspect=function(){var e="";return 0<this.length&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),50<this.length)&&(e+=" ... "),"<Buffer "+e+">"},Fe.prototype.compare=function(e,t,r,n,o){if(!Ye(e))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(o<=n&&r<=t)return 0;if(o<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var s=(o>>>=0)-(n>>>=0),i=(r>>>=0)-(t>>>=0),a=Math.min(s,i),u=this.slice(n,o),l=e.slice(t,r),c=0;c<a;++c)if(u[c]!==l[c]){s=u[c],i=l[c];break}return s<i?-1:i<s?1:0},Fe.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},Fe.prototype.indexOf=function(e,t,r){return Xe(this,e,t,r,!0)},Fe.prototype.lastIndexOf=function(e,t,r){return Xe(this,e,t,r,!1)},Fe.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||o<r)&&(r=o),0<e.length&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var s=!1;;)switch(n){case"hex":return Ze(this,e,t,r);case"utf8":case"utf-8":return et(this,e,t,r);case"ascii":return tt(this,e,t,r);case"latin1":case"binary":return rt(this,e,t,r);case"base64":return nt(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ot(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},Fe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var at=4096;function ut(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function lt(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function ct(e,t,r){var n=e.length;(!r||r<0||n<r)&&(r=n);for(var o="",s=t=!t||t<0?0:t;s<r;++s)o+=bt(e[s]);return o}function pt(e,t,r){for(var n=e.slice(t,r),o="",s=0;s<n.length;s+=2)o+=String.fromCharCode(n[s]+256*n[s+1]);return o}function dt(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(r<e+t)throw new RangeError("Trying to access beyond buffer length")}function ht(e,t,r,n,o,s){if(!Ye(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(o<t||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function ft(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,s=Math.min(e.length-r,2);o<s;++o)e[r+o]=(t&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function mt(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,s=Math.min(e.length-r,4);o<s;++o)e[r+o]=t>>>8*(n?o:3-o)&255}function gt(e,t,r,n,o,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function yt(e,t,r,n,o){return o||gt(e,0,r,4),je(e,t,r,n,23,4),r+4}function _t(e,t,r,n,o){return o||gt(e,0,r,8),je(e,t,r,n,52,8),r+8}Fe.prototype.slice=function(e,t){var r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):r<e&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):r<t&&(t=r),t<e&&(t=e),Fe.TYPED_ARRAY_SUPPORT)(o=this.subarray(e,t)).__proto__=Fe.prototype;else for(var n=t-e,o=new Fe(n,void 0),s=0;s<n;++s)o[s]=this[s+e];return o},Fe.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||dt(e,t,this.length);for(var n=this[e],o=1,s=0;++s<t&&(o*=256);)n+=this[e+s]*o;return n},Fe.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||dt(e,t,this.length);for(var n=this[e+--t],o=1;0<t&&(o*=256);)n+=this[e+--t]*o;return n},Fe.prototype.readUInt8=function(e,t){return t||dt(e,1,this.length),this[e]},Fe.prototype.readUInt16LE=function(e,t){return t||dt(e,2,this.length),this[e]|this[e+1]<<8},Fe.prototype.readUInt16BE=function(e,t){return t||dt(e,2,this.length),this[e]<<8|this[e+1]},Fe.prototype.readUInt32LE=function(e,t){return t||dt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Fe.prototype.readUInt32BE=function(e,t){return t||dt(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Fe.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||dt(e,t,this.length);for(var n=this[e],o=1,s=0;++s<t&&(o*=256);)n+=this[e+s]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},Fe.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||dt(e,t,this.length);for(var n=t,o=1,s=this[e+--n];0<n&&(o*=256);)s+=this[e+--n]*o;return s>=(o*=128)&&(s-=Math.pow(2,8*t)),s},Fe.prototype.readInt8=function(e,t){return t||dt(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Fe.prototype.readInt16LE=function(e,t){t||dt(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},Fe.prototype.readInt16BE=function(e,t){t||dt(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},Fe.prototype.readInt32LE=function(e,t){return t||dt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Fe.prototype.readInt32BE=function(e,t){return t||dt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Fe.prototype.readFloatLE=function(e,t){return t||dt(e,4,this.length),Le(this,e,!0,23,4)},Fe.prototype.readFloatBE=function(e,t){return t||dt(e,4,this.length),Le(this,e,!1,23,4)},Fe.prototype.readDoubleLE=function(e,t){return t||dt(e,8,this.length),Le(this,e,!0,52,8)},Fe.prototype.readDoubleBE=function(e,t){return t||dt(e,8,this.length),Le(this,e,!1,52,8)},Fe.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||ht(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,s=0;for(this[t]=255&e;++s<r&&(o*=256);)this[t+s]=e/o&255;return t+r},Fe.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||ht(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,s=1;for(this[t+o]=255&e;0<=--o&&(s*=256);)this[t+o]=e/s&255;return t+r},Fe.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||ht(this,e,t,1,255,0),Fe.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Fe.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||ht(this,e,t,2,65535,0),Fe.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ft(this,e,t,!0),t+2},Fe.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||ht(this,e,t,2,65535,0),Fe.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ft(this,e,t,!1),t+2},Fe.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||ht(this,e,t,4,4294967295,0),Fe.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):mt(this,e,t,!0),t+4},Fe.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||ht(this,e,t,4,4294967295,0),Fe.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):mt(this,e,t,!1),t+4},Fe.prototype.writeIntLE=function(e,t,r,n){e=+e,t|=0,n||ht(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=0,s=1,i=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===i&&0!==this[t+o-1]&&(i=1),this[t+o]=(e/s|0)-i&255;return t+r},Fe.prototype.writeIntBE=function(e,t,r,n){e=+e,t|=0,n||ht(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=r-1,s=1,i=0;for(this[t+o]=255&e;0<=--o&&(s*=256);)e<0&&0===i&&0!==this[t+o+1]&&(i=1),this[t+o]=(e/s|0)-i&255;return t+r},Fe.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||ht(this,e,t,1,127,-128),Fe.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&(e=e<0?255+e+1:e),t+1},Fe.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||ht(this,e,t,2,32767,-32768),Fe.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ft(this,e,t,!0),t+2},Fe.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||ht(this,e,t,2,32767,-32768),Fe.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ft(this,e,t,!1),t+2},Fe.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||ht(this,e,t,4,2147483647,-2147483648),Fe.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):mt(this,e,t,!0),t+4},Fe.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||ht(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Fe.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):mt(this,e,t,!1),t+4},Fe.prototype.writeFloatLE=function(e,t,r){return yt(this,e,t,!0,r)},Fe.prototype.writeFloatBE=function(e,t,r){return yt(this,e,t,!1,r)},Fe.prototype.writeDoubleLE=function(e,t,r){return _t(this,e,t,!0,r)},Fe.prototype.writeDoubleBE=function(e,t,r){return _t(this,e,t,!1,r)},Fe.prototype.copy=function(e,t,r,n){if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0<n&&n<r?r:n)===r)return 0;if(0===e.length||0===this.length)return 0;if((t=t||0)<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var o,s=(n=e.length-t<n-r?e.length-t+r:n)-r;if(this===e&&r<t&&t<n)for(o=s-1;0<=o;--o)e[o+t]=this[o+r];else if(s<1e3||!Fe.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+s),t);return s},Fe.prototype.fill=function(e,t,r,n){if("string"==typeof e){var o;if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length&&(o=e.charCodeAt(0))<256&&(e=o),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Fe.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(!(r<=t))if(t>>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(a=t;a<r;++a)this[a]=e;else for(var s=Ye(e)?e:Tt(new Fe(e,n).toString()),i=s.length,a=0;a<r-t;++a)this[a+t]=s[a%i];return this};var vt=/[^+\/0-9A-Za-z-_]/g;function bt(e){return e<16?"0"+e.toString(16):e.toString(16)}function Tt(e,t){var r;t=t||1/0;for(var n=e.length,o=null,s=[],i=0;i<n;++i){if(55295<(r=e.charCodeAt(i))&&r<57344){if(!o){if(56319<r){-1<(t-=3)&&s.push(239,191,189);continue}if(i+1===n){-1<(t-=3)&&s.push(239,191,189);continue}o=r;continue}if(r<56320){-1<(t-=3)&&s.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&-1<(t-=3)&&s.push(239,191,189);if(o=null,r<128){if(--t<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function St(e){var t=(e=>{if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(vt,"")).length<2)return"";for(var t;e.length%4!=0;)e+="=";return e})(e);Ne||Ie();var r,e=t.length;if(0<e%4)throw new Error("Invalid string. Length must be a multiple of 4");for(var n="="===t[e-2]?2:"="===t[e-1]?1:0,o=new Re(3*e/4-n),s=0<n?e-4:e,i=0,a=0;a<s;a+=4)r=Ce[t.charCodeAt(a)]<<18|Ce[t.charCodeAt(a+1)]<<12|Ce[t.charCodeAt(a+2)]<<6|Ce[t.charCodeAt(a+3)],o[i++]=r>>16&255,o[i++]=r>>8&255,o[i++]=255&r;return 2==n?(r=Ce[t.charCodeAt(a)]<<2|Ce[t.charCodeAt(a+1)]>>4,o[i++]=255&r):1==n&&(r=Ce[t.charCodeAt(a)]<<10|Ce[t.charCodeAt(a+1)]<<4|Ce[t.charCodeAt(a+2)]>>2,o[i++]=r>>8&255,o[i++]=255&r),o}function wt(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function Et(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var At="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;function r(){}r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e},Ot=/%[sdj%]/g;function xt(e){if(!Ht(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(Pt(arguments[r]));return t.join(" ")}for(var r=1,n=arguments,o=n.length,s=String(e).replace(Ot,function(e){if("%%"===e)return"%";if(o<=r)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),i=n[r];r<o;i=n[++r])Bt(i)||!Yt(i)?s+=" "+i:s+=" "+Pt(i);return s}function Ct(e,t){var r;return zt(J.process)?function(){return Ct(e,t).apply(this,arguments)}:!0===Se.noDeprecation?e:(r=!1,function(){if(!r){if(Se.throwDeprecation)throw new Error(t);Se.traceDeprecation?console.trace(t):console.error(t),r=!0}return e.apply(this,arguments)})}var Rt,Nt={};function It(t){return zt(Rt)&&(Rt=Se.env.NODE_DEBUG||""),t=t.toUpperCase(),Nt[t]||(new RegExp("\\b"+t+"\\b","i").test(Rt)?Nt[t]=function(){var e=xt.apply(null,arguments);console.error("%s %d: %s",t,0,e)}:Nt[t]=function(){}),Nt[t]}function Pt(e,t){var r={seen:[],stylize:kt};return 3<=arguments.length&&(r.depth=arguments[2]),4<=arguments.length&&(r.colors=arguments[3]),Vt(t)?r.showHidden=t:t&&nr(r,t),zt(r.showHidden)&&(r.showHidden=!1),zt(r.depth)&&(r.depth=2),zt(r.colors)&&(r.colors=!1),zt(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=Ut),Lt(r,e,r.depth)}function Ut(e,t){t=Pt.styles[t];return t?"["+Pt.colors[t][0]+"m"+e+"["+Pt.colors[t][1]+"m":e}function kt(e,t){return e}function Lt(t,r,n){if(t.customInspect&&r&&Jt(r.inspect)&&r.inspect!==Pt&&(!r.constructor||r.constructor.prototype!==r))return Ht(e=r.inspect(n,t))?e:Lt(t,e,n);e=t;var e,o=zt(i=r)?e.stylize("undefined","undefined"):Ht(i)?(o="'"+JSON.stringify(i).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'",e.stylize(o,"string")):qt(i)?e.stylize(""+i,"number"):Vt(i)?e.stylize(""+i,"boolean"):Bt(i)?e.stylize("null","null"):void 0;if(o)return o;var s,i=Object.keys(r),a=(s={},i.forEach(function(e,t){s[e]=!0}),s);if(t.showHidden&&(i=Object.getOwnPropertyNames(r)),$t(r)&&(0<=i.indexOf("message")||0<=i.indexOf("description")))return jt(r);if(0===i.length){if(Jt(r))return c=r.name?": "+r.name:"",t.stylize("[Function"+c+"]","special");if(Kt(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(Wt(r))return t.stylize(Date.prototype.toString.call(r),"date");if($t(r))return jt(r)}var u,l,c="",p=!1,h=["{","}"];return Mt(r)&&(p=!0,h=["[","]"]),Jt(r)&&(c=" [Function"+(r.name?": "+r.name:"")+"]"),Kt(r)&&(c=" "+RegExp.prototype.toString.call(r)),Wt(r)&&(c=" "+Date.prototype.toUTCString.call(r)),$t(r)&&(c=" "+jt(r)),0!==i.length||p&&0!=r.length?n<0?Kt(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),i=p?((t,r,n,o,e)=>{for(var s=[],i=0,a=r.length;i<a;++i)or(r,String(i))?s.push(Dt(t,r,n,o,String(i),!0)):s.push("");return e.forEach(function(e){e.match(/^\d+$/)||s.push(Dt(t,r,n,o,e,!0))}),s})(t,r,n,a,i):i.map(function(e){return Dt(t,r,n,a,e,p)}),t.seen.pop(),u=c,l=h,60<(i=i).reduce(function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)?l[0]+(""===u?"":u+"\n ")+" "+i.join(",\n ")+" "+l[1]:l[0]+u+" "+i.join(", ")+" "+l[1]):h[0]+c+h[1]}function jt(e){return"["+Error.prototype.toString.call(e)+"]"}function Dt(e,t,r,n,o,s){var i,a;if((t=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?a=t.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):t.set&&(a=e.stylize("[Setter]","special")),or(n,o)||(i="["+o+"]"),a||(e.seen.indexOf(t.value)<0?-1<(a=Bt(r)?Lt(e,t.value,null):Lt(e,t.value,r-1)).indexOf("\n")&&(a=s?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),zt(i)){if(s&&o.match(/^\d+$/))return a;i=(i=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),e.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),e.stylize(i,"string"))}return i+": "+a}function Mt(e){return Array.isArray(e)}function Vt(e){return"boolean"==typeof e}function Bt(e){return null===e}function Ft(e){return null==e}function qt(e){return"number"==typeof e}function Ht(e){return"string"==typeof e}function Gt(e){return"symbol"==typeof e}function zt(e){return void 0===e}function Kt(e){return Yt(e)&&"[object RegExp]"===Zt(e)}function Yt(e){return"object"==typeof e&&null!==e}function Wt(e){return Yt(e)&&"[object Date]"===Zt(e)}function $t(e){return Yt(e)&&("[object Error]"===Zt(e)||e instanceof Error)}function Jt(e){return"function"==typeof e}function Xt(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function Qt(e){return Fe.isBuffer(e)}function Zt(e){return Object.prototype.toString.call(e)}function er(e){return e<10?"0"+e.toString(10):e.toString(10)}Pt.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Pt.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var tr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function rr(){var e,t;console.log("%s - %s",(t=[er((e=new Date).getHours()),er(e.getMinutes()),er(e.getSeconds())].join(":"),[e.getDate(),tr[e.getMonth()],t].join(" ")),xt.apply(null,arguments))}function nr(e,t){if(t&&Yt(t))for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function or(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var ir,sr={inherits:At,_extend:nr,log:rr,isBuffer:Qt,isPrimitive:Xt,isFunction:Jt,isError:$t,isDate:Wt,isObject:Yt,isRegExp:Kt,isUndefined:zt,isSymbol:Gt,isString:Ht,isNumber:qt,isNullOrUndefined:Ft,isNull:Bt,isBoolean:Vt,isArray:Mt,inspect:Pt,deprecate:Ct,format:xt,debuglog:It},ar=n(Object.freeze({__proto__:null,format:xt,deprecate:Ct,debuglog:It,inspect:Pt,isArray:Mt,isBoolean:Vt,isNull:Bt,isNullOrUndefined:Ft,isNumber:qt,isString:Ht,isSymbol:Gt,isUndefined:zt,isRegExp:Kt,isObject:Yt,isDate:Wt,isError:$t,isFunction:Jt,isPrimitive:Xt,isBuffer:Qt,log:rr,inherits:At,_extend:nr,default:sr}));class ur{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}class lr extends Error{code;name="OTLPExporterError";data;constructor(e,t,r){super(e),this.data=r,this.code=t}}function cr(e){if(Number.isFinite(e)&&0<e)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function pr(e,t,r){return{timeoutMillis:cr(e.timeoutMillis??t.timeoutMillis??r.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??r.concurrencyLimit,compression:e.compression??t.compression??r.compression}}(e=>{e.NONE="none",e.GZIP="gzip"})(ir=ir||{});class dr{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(t){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(t);var e=()=>{var e=this._sendingPromises.indexOf(t);this._sendingPromises.splice(e,1)};t.then(e,e)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function hr(e){return new dr(e.concurrencyLimit)}var fr="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof J?J:{},mr="1.9.0",gr=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,yr=(t=>{var o,s,i,a=new Set([t]),u=new Set,e=t.match(gr);return e?(o=+e[1],s=+e[2],i=+e[3],null!=e[4]?function(e){return e===t}:function(e){var t,r,n;return!!a.has(e)||!u.has(e)&&(!(t=e.match(gr))||(r=+t[1],n=+t[2],null!=t[4])||o!=r?l:0==o?s==n&&i<=+t[3]?c:l:s<=n?c:l)(e)}):function(){return!1};function l(e){return u.add(e),!1}function c(e){return a.add(e),!0}})(mr),_r=mr.split(".")[0],vr=Symbol.for("opentelemetry.js.api."+_r),br=fr;function Tr(e,t,r,n){void 0===n&&(n=!1);var o,s=br[vr]=null!=(s=br[vr])?s:{version:mr};return!n&&s[e]?(o=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e),r.error(o.stack||o.message),!1):s.version!==mr?(o=new Error("@opentelemetry/api: Registration of version v"+s.version+" for "+e+" does not match previously registered API v"+mr),r.error(o.stack||o.message),!1):(s[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+mr+"."),!0)}function Sr(e){var t=null==(t=br[vr])?void 0:t.version;return!t||!yr(t)||null==(t=br[vr])?void 0:t[e]}function wr(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+mr+".");t=br[vr];t&&delete t[e]}var Er,Ar=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},Or=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},xr=(()=>{function e(e){this._namespace=e.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Cr("debug",this._namespace,e)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Cr("error",this._namespace,e)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Cr("info",this._namespace,e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Cr("warn",this._namespace,e)},e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Cr("verbose",this._namespace,e)},e})();function Cr(e,t,r){var n=Sr("diag");if(n)return r.unshift(t),n[e].apply(n,Or([],Ar(r),!1))}(e=>{e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(Er=Er||{});var Rr=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},Nr=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},Ir=(()=>{function e(){function e(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Sr("diag");if(r)return r[n].apply(r,Nr([],Rr(e),!1))}}var a=this;a.setLogger=function(e,t){if(void 0===t&&(t={logLevel:Er.INFO}),e===a)return s=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation"),a.error(null!=(o=s.stack)?o:s.message),!1;"number"==typeof t&&(t={logLevel:t});var r,n,o=Sr("diag"),s=(r=null!=(s=t.logLevel)?s:Er.INFO,n=e,r<Er.NONE?r=Er.NONE:r>Er.ALL&&(r=Er.ALL),n=n||{},{error:i("error",Er.ERROR),warn:i("warn",Er.WARN),info:i("info",Er.INFO),debug:i("debug",Er.DEBUG),verbose:i("verbose",Er.VERBOSE)});function i(e,t){e=n[e];return"function"==typeof e&&t<=r?e.bind(n):function(){}}return o&&!t.suppressOverrideMessage&&(t=null!=(e=(new Error).stack)?e:"<failed to generate stacktrace>",o.warn("Current logger will be overwritten from "+t),s.warn("Current logger will overwrite one already registered from "+t)),Tr("diag",s,a,!0)},a.disable=function(){wr("diag",a)},a.createComponentLogger=function(e){return new xr(e)},a.verbose=e("verbose"),a.debug=e("debug"),a.info=e("info"),a.warn=e("warn"),a.error=e("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e})(),Pr=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},Ur=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&n>=e.length?void 0:e)&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},kr=(()=>{function u(e){this._entries=e?new Map(e):new Map}return u.prototype.getEntry=function(e){e=this._entries.get(e);if(e)return Object.assign({},e)},u.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){e=Pr(e,2);return[e[0],e[1]]})},u.prototype.setEntry=function(e,t){var r=new u(this._entries);return r._entries.set(e,t),r},u.prototype.removeEntry=function(e){var t=new u(this._entries);return t._entries.delete(e),t},u.prototype.removeEntries=function(){for(var t,e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=new u(this._entries);try{for(var s=Ur(r),i=s.next();!i.done;i=s.next()){var a=i.value;o._entries.delete(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return o},u.prototype.clear=function(){return new u},u})(),Lr=Symbol("BaggageEntryMetadata"),jr=Ir.instance();function Dr(e){return void 0===e&&(e={}),new kr(new Map(Object.entries(e)))}function Mr(e){return"string"!=typeof e&&(jr.error("Cannot create baggage metadata from unknown type: "+typeof e),e=""),{__TYPE__:Lr,toString:function(){return e}}}function Vr(e){return Symbol.for(e)}var Br,Fr,qr=function n(e){var o=this;o._currentContext=e?new Map(e):new Map,o.getValue=function(e){return o._currentContext.get(e)},o.setValue=function(e,t){var r=new n(o._currentContext);return r._currentContext.set(e,t),r},o.deleteValue=function(e){var t=new n(o._currentContext);return t._currentContext.delete(e),t}},Hr=new qr,Gr=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],zr=function(){for(var e=0;e<Gr.length;e++)this[Gr[e].n]=(n=>function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(console){var r=console[n];if("function"==typeof(r="function"!=typeof r?console.log:r))return r.apply(console,e)}})(Gr[e].c)},Kr=(Br=function(e,t){return(Br=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Br(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),Yr=(()=>{function e(){}return e.prototype.createGauge=function(e,t){return sn},e.prototype.createHistogram=function(e,t){return an},e.prototype.createCounter=function(e,t){return on},e.prototype.createUpDownCounter=function(e,t){return un},e.prototype.createObservableGauge=function(e,t){return cn},e.prototype.createObservableCounter=function(e,t){return ln},e.prototype.createObservableUpDownCounter=function(e,t){return pn},e.prototype.addBatchObservableCallback=function(e,t){},e.prototype.removeBatchObservableCallback=function(e){},e})(),Wr=function(){},$r=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Kr(t,e),t.prototype.add=function(e,t){},t})(Wr),Jr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Kr(t,e),t.prototype.add=function(e,t){},t})(Wr),Xr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Kr(t,e),t.prototype.record=function(e,t){},t})(Wr),Qr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Kr(t,e),t.prototype.record=function(e,t){},t})(Wr),Zr=(()=>{function e(){}return e.prototype.addCallback=function(e){},e.prototype.removeCallback=function(e){},e})(),en=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Kr(t,e),t})(Zr),tn=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Kr(t,e),t})(Zr),rn=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Kr(t,e),t})(Zr),nn=new Yr,on=new $r,sn=new Xr,an=new Qr,un=new Jr,ln=new en,cn=new tn,pn=new rn;function dn(){return nn}(e=>{e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(Fr=Fr||{});var hn,fn={get:function(e,t){if(null!=e)return e[t]},keys:function(e){return null==e?[]:Object.keys(e)}},mn={set:function(e,t,r){null!=e&&(e[t]=r)}},gn=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},yn=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},_n=(()=>{function e(){}return e.prototype.active=function(){return Hr},e.prototype.with=function(e,t,r){for(var n=[],o=3;o<arguments.length;o++)n[o-3]=arguments[o];return t.call.apply(t,yn([r],gn(n),!1))},e.prototype.bind=function(e,t){return t},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e})(),vn=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},bn=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},Tn="context",Sn=new _n,wn=(()=>{function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(e){return Tr(Tn,e,Ir.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(e,t,r){for(var n,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return(n=this._getContextManager()).with.apply(n,bn([e,t,r],vn(o),!1))},e.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},e.prototype._getContextManager=function(){return Sr(Tn)||Sn},e.prototype.disable=function(){this._getContextManager().disable(),wr(Tn,Ir.instance())},e})(),En=((e=>{e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(hn=hn||{}),"0000000000000000"),An="00000000000000000000000000000000",On={traceId:An,spanId:En,traceFlags:hn.NONE},xn=(()=>{function e(e){this._spanContext=e=void 0===e?On:e}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(e,t){return this},e.prototype.setAttributes=function(e){return this},e.prototype.addEvent=function(e,t){return this},e.prototype.addLink=function(e){return this},e.prototype.addLinks=function(e){return this},e.prototype.setStatus=function(e){return this},e.prototype.updateName=function(e){return this},e.prototype.end=function(e){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(e,t){},e})(),Cn=Vr("OpenTelemetry Context Key SPAN");function Rn(e){return e.getValue(Cn)||void 0}function Nn(){return Rn(wn.getInstance().active())}function In(e,t){return e.setValue(Cn,t)}function Pn(e){return e.deleteValue(Cn)}function Un(e,t){return In(e,new xn(t))}function kn(e){return null==(e=Rn(e))?void 0:e.spanContext()}var Ln=/^([0-9a-f]{32})$/i,jn=/^[0-9a-f]{16}$/i;function Dn(e){return Ln.test(e)&&e!==An}function Mn(e){return jn.test(e)&&e!==En}function Vn(e){return Dn(e.traceId)&&Mn(e.spanId)}function Bn(e){return new xn(e)}var Hn,Gn,zn,Fn=wn.getInstance(),qn=(()=>{function e(){}return e.prototype.startSpan=function(e,t,r){return void 0===r&&(r=Fn.active()),!Boolean(null==t?void 0:t.root)&&"object"==typeof(t=r&&kn(r))&&"string"==typeof t.spanId&&"string"==typeof t.traceId&&"number"==typeof t.traceFlags&&Vn(t)?new xn(t):new xn},e.prototype.startActiveSpan=function(e,t,r,n){var o,s;if(!(arguments.length<2))return t=2===arguments.length?t:3===arguments.length?(o=t,r):(o=t,s=r,n),s=In(r=null!=s?s:Fn.active(),n=this.startSpan(e,o,r)),Fn.with(s,t,void 0,n)},e})(),Kn=new qn,Yn=(()=>{function e(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}return e.prototype.startSpan=function(e,t,r){return this._getTracer().startSpan(e,t,r)},e.prototype.startActiveSpan=function(e,t,r,n){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},e.prototype._getTracer=function(){var e;return this._delegate||((e=this._provider.getDelegateTracer(this.name,this.version,this.options))?(this._delegate=e,this._delegate):Kn)},e})(),Wn=new((()=>{function e(){}return e.prototype.getTracer=function(e,t,r){return new qn},e})()),$n=(()=>{function e(){}return e.prototype.getTracer=function(e,t,r){var n;return null!=(n=this.getDelegateTracer(e,t,r))?n:new Yn(this,e,t,r)},e.prototype.getDelegate=function(){var e;return null!=(e=this._delegate)?e:Wn},e.prototype.setDelegate=function(e){this._delegate=e},e.prototype.getDelegateTracer=function(e,t,r){var n;return null==(n=this._delegate)?void 0:n.getTracer(e,t,r)},e})(),Jn=((e=>{e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(Hn=Hn||{}),(e=>{e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(Gn=Gn||{}),(e=>{e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(zn=zn||{}),"[_0-9a-z-*/]"),Xn=new RegExp("^(?:[a-z]"+Jn+"{0,255}|[a-z0-9]"+Jn+"{0,240}@[a-z]"+Jn+"{0,13})$"),Qn=/^[ -~]{0,255}[!-~]$/,Zn=/,|=/,eo=(()=>{function t(e){this._internalState=new Map,e&&this._parse(e)}return t.prototype.set=function(e,t){var r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,t),r},t.prototype.unset=function(e){var t=this._clone();return t._internalState.delete(e),t},t.prototype.get=function(e){return this._internalState.get(e)},t.prototype.serialize=function(){var r=this;return this._keys().reduce(function(e,t){return e.push(t+"="+r.get(t)),e},[]).join(",")},t.prototype._parse=function(e){512<e.length||(this._internalState=e.split(",").reverse().reduce(function(e,t){var r,n=t.trim(),o=n.indexOf("=");return-1!==o&&(r=n.slice(0,o),n=n.slice(o+1,t.length),Xn.test(r))&&(o=n,Qn.test(o))&&!Zn.test(o)&&e.set(r,n),e},new Map),32<this._internalState.size&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))},t.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},t.prototype._clone=function(){var e=new t;return e._internalState=new Map(this._internalState),e},t})(),to=wn.getInstance(),ro=Ir.instance(),no=new((()=>{function e(){}return e.prototype.getMeter=function(e,t,r){return nn},e})()),oo="metrics",io=(()=>{function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalMeterProvider=function(e){return Tr(oo,e,Ir.instance())},e.prototype.getMeterProvider=function(){return Sr(oo)||no},e.prototype.getMeter=function(e,t,r){return this.getMeterProvider().getMeter(e,t,r)},e.prototype.disable=function(){wr(oo,Ir.instance())},e})(),so=io.getInstance(),ao=(()=>{function e(){}return e.prototype.inject=function(e,t){},e.prototype.extract=function(e,t){return e},e.prototype.fields=function(){return[]},e})(),uo=Vr("OpenTelemetry Baggage Key");function lo(e){return e.getValue(uo)||void 0}function co(){return lo(wn.getInstance().active())}function po(e,t){return e.setValue(uo,t)}function ho(e){return e.deleteValue(uo)}var Go,zo,fo="propagation",mo=new ao,go=(()=>{function e(){this.createBaggage=Dr,this.getBaggage=lo,this.getActiveBaggage=co,this.setBaggage=po,this.deleteBaggage=ho}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalPropagator=function(e){return Tr(fo,e,Ir.instance())},e.prototype.inject=function(e,t,r){return void 0===r&&(r=mn),this._getGlobalPropagator().inject(e,t,r)},e.prototype.extract=function(e,t,r){return void 0===r&&(r=fn),this._getGlobalPropagator().extract(e,t,r)},e.prototype.fields=function(){return this._getGlobalPropagator().fields()},e.prototype.disable=function(){wr(fo,Ir.instance())},e.prototype._getGlobalPropagator=function(){return Sr(fo)||mo},e})(),yo=go.getInstance(),_o="trace",vo=(()=>{function e(){this._proxyTracerProvider=new $n,this.wrapSpanContext=Bn,this.isSpanContextValid=Vn,this.deleteSpan=Pn,this.getSpan=Rn,this.getActiveSpan=Nn,this.getSpanContext=kn,this.setSpan=In,this.setSpanContext=Un}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(e){var t=Tr(_o,this._proxyTracerProvider,Ir.instance());return t&&this._proxyTracerProvider.setDelegate(e),t},e.prototype.getTracerProvider=function(){return Sr(_o)||this._proxyTracerProvider},e.prototype.getTracer=function(e,t){return this.getTracerProvider().getTracer(e,t)},e.prototype.disable=function(){wr(_o,Ir.instance()),this._proxyTracerProvider=new $n},e})(),bo=vo.getInstance(),To={context:to,diag:ro,metrics:so,propagation:yo,trace:bo},So=Object.freeze({__proto__:null,context:to,diag:ro,metrics:so,propagation:yo,trace:bo,default:To,baggageEntryMetadataFromString:Mr,createContextKey:Vr,ROOT_CONTEXT:Hr,DiagConsoleLogger:zr,get DiagLogLevel(){return Er},createNoopMeter:dn,get ValueType(){return Fr},defaultTextMapGetter:fn,defaultTextMapSetter:mn,ProxyTracer:Yn,ProxyTracerProvider:$n,get SamplingDecision(){return Hn},get SpanKind(){return Gn},get SpanStatusCode(){return zn},get TraceFlags(){return hn},createTraceState:function(e){return new eo(e)},isSpanContextValid:Vn,isValidTraceId:Dn,isValidSpanId:Mn,INVALID_SPANID:En,INVALID_TRACEID:An,INVALID_SPAN_CONTEXT:On});let wo=Vr("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function Eo(e){return null==e||(Array.isArray(e)?(e=>{let t;for(var r of e)if(null!=r){let e=typeof r;if(e!==t){if(t||!Ao(e))return!1;t=e}}return!0})(e):Ao(typeof e))}function Ao(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}let Oo=e=>{var t;ro.error("string"==typeof(t=e)?t:JSON.stringify((()=>{let r={},n=t;for(;null!==n;)Object.getOwnPropertyNames(n).forEach(e=>{var t;r[e]||(t=n[e])&&(r[e]=String(t))}),n=Object.getPrototypeOf(n);return r})()))};function xo(e){try{Oo(e)}catch{}}let Co=performance,Ro="exception.message",No="exception.type",Io="service.name",Po="telemetry.sdk.language",Uo="webjs",ko="telemetry.sdk.name",Lo="telemetry.sdk.version",jo="process.runtime.name",Do={[ko]:"opentelemetry",[jo]:"browser",[Po]:Uo,[Lo]:"2.2.0"},Mo=Math.pow(10,6),Vo=Math.pow(10,9);function Bo(e){return[Math.trunc(e/1e3),Math.round(e%1e3*Mo)]}function Fo(){let e=Co.timeOrigin;var t;return"number"!=typeof e&&(t=Co,e=t.timing&&t.timing.fetchStart),e}function qo(e){var t=Bo(Fo()),e=Bo("number"==typeof e?e:Co.now());return(t=[t[0]+e[0],t[1]+e[1]])[1]>=Vo&&(t[1]-=Vo,t[0]+=1),t}function Ho(e){if(t=e,Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])return e;if("number"==typeof e)return(e<Fo()?qo:Bo)(e);if(e instanceof Date)return Bo(e.getTime());throw TypeError("Invalid input type");var t}(e=>{e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(Go=Go||{}),(zo=zo||{}).HTTP="http";let Ko="[object Null]",Yo="[object Undefined]",Wo=Function.prototype.toString,$o=Wo.call(Object),Jo=Object.getPrototypeOf,Xo=Object.prototype,Qo=Xo.hasOwnProperty,Zo=Symbol?Symbol.toStringTag:void 0,ei=Xo.toString;function ti(e){return null!=e&&"object"==typeof e&&"[object Object]"===(t=>{if(null==t)return void 0===t?Yo:Ko;if(Zo&&Zo in Object(t)){var r=t,n=Qo.call(r,Zo),o=r[Zo];let e=!1;try{r[Zo]=void 0,e=!0}catch{}var s=ei.call(r);return e&&(n?r[Zo]=o:delete r[Zo]),s}return n=t,ei.call(n)})(e)&&(null===(e=Jo(e))||"function"==typeof(e=Qo.call(e,"constructor")&&e.constructor)&&e instanceof e&&Wo.call(e)===$o)}function ri(e){return ii(e)?e.slice():e}function ni(r,n,o=0,s){let i;if(!(20<o)){if(o++,ui(r)||ui(n)||si(n))i=ri(n);else if(ii(r)){if(i=r.slice(),ii(n))for(let e=0,t=n.length;e<t;e++)i.push(ri(n[e]));else if(ai(n)){let r=Object.keys(n);for(let t=0,e=r.length;t<e;t++){let e=r[t];i[e]=ri(n[e])}}}else if(ai(r))if(ai(n)){if(e=n,!ti(r)||!ti(e))return n;i=Object.assign({},r);var a=Object.keys(n);for(let e=0,t=a.length;e<t;e++){var u=a[e],l=n[u];if(ui(l))void 0===l?delete i[u]:i[u]=l;else{var c=i[u],p=l;if(oi(r,u,s)||oi(n,u,s))delete i[u];else{if(ai(c)&&ai(p)){let e=s.get(c)||[],t=s.get(p)||[];e.push({obj:r,key:u}),t.push({obj:n,key:u}),s.set(c,e),s.set(p,t)}i[u]=ni(i[u],l,o,s)}}}}else i=n;return i}var e}function oi(r,n,e){var o=e.get(r[n])||[];for(let e=0,t=o.length;e<t;e++){var s=o[e];if(s.key===n&&s.obj===r)return!0}return!1}function ii(e){return Array.isArray(e)}function si(e){return"function"==typeof e}function ai(e){return!ui(e)&&!ii(e)&&!si(e)&&"object"==typeof e}function ui(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e||e instanceof Date||e instanceof RegExp||null===e}class li extends Error{constructor(e){super(e),Object.setPrototypeOf(this,li.prototype)}}function ci(e,r){let n;var t=new Promise(function(e,t){n=setTimeout(function(){t(new li("Operation timed out."))},r)});return Promise.race([e,t]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}class pi{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class di{_callback;_that;_isCalled=!1;_deferred=new pi;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}Er.ALL,Er.VERBOSE,Er.DEBUG,Er.INFO,Er.WARN,Er.ERROR,Er.NONE;let hi={_export:function(e,r){return new Promise(t=>{to.with(to.active().setValue(wo,!0),()=>{e.export(r,e=>{t(e)})})})}};function fi(){return{handleResponse(e){null!=e&&Object.prototype.hasOwnProperty.call(e,"partialSuccess")&&null!=e.partialSuccess&&0!==Object.keys(e.partialSuccess).length&&ro.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}class mi{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(e,t,r,n,o){this._transport=e,this._serializer=t,this._responseHandler=r,this._promiseQueue=n,this._timeout=o,this._diagLogger=ro.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,r){this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()?r({code:Go.FAILED,error:new Error("Concurrent export limit reached")}):null!=(e=this._serializer.serializeRequest(e))?this._promiseQueue.pushPromise(this._transport.send(e,this._timeout).then(t=>{if("success"!==t.status)"failure"===t.status&&t.error?r({code:Go.FAILED,error:t.error}):"retryable"===t.status?r({code:Go.FAILED,error:new lr("Export failed with retryable status")}):r({code:Go.FAILED,error:new lr("Export failed with unknown error")});else{if(null!=t.data)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(t.data))}catch(e){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",e,t.data)}r({code:Go.SUCCESS})}},e=>r({code:Go.FAILED,error:e}))):r({code:Go.FAILED,error:new Error("Nothing to send")})}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function gi(e,t,r){return r={transport:r,serializer:t,promiseHandler:hr(e)},t={timeout:e.timeoutMillis},new mi(r.transport,r.serializer,fi(),r.promiseHandler,t.timeout)}var yi,_i,Si,wi,Ei,Ai,Oi,xi,Ci,vi={exports:{}},bi={},Ti={},Ri={};function Ni(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ii,Pi,Ui,ki,Li,Di,Mi,ji={},Vi={exports:{}};function Bi(){if(!Di){Di=1;var e=Vi,t=Vi.exports,r=t,h=(Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,null);try{h=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function n(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function d(e){return!0===(e&&e.__isLong__)}function o(e){var t=Math.clz32(e&-e);return e?31-t:t}Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=d;var s={},i={};function a(e,t){var r,n,o;return t?(o=0<=(e>>>=0)&&e<256)&&(n=i[e])?n:(r=m(e,0,!0),o&&(i[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(n=s[e])?n:(r=m(e,e<0?-1:0,!1),o&&(s[e]=r),r)}function f(e,t){if(isNaN(e))return t?b:v;if(t){if(e<0)return b;if(p<=e)return A}else{if(e<=-y)return O;if(y<=e+1)return E}return e<0?f(-e,t).neg():m(e%u|0,e/u|0,t)}function m(e,t,r){return new n(e,t,r)}n.fromInt=a,n.fromNumber=f,n.fromBits=m;var l=Math.pow;function c(e,t,r){if(0===e.length)throw Error("empty string");if(t="number"==typeof t?(r=t,!1):!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?b:v;if((r=r||10)<2||36<r)throw RangeError("radix");var n;if(0<(n=e.indexOf("-")))throw Error("interior hyphen");if(0===n)return c(e.substring(1),t,r).neg();for(var o=f(l(r,8)),s=v,i=0;i<e.length;i+=8){var a=Math.min(8,e.length-i),u=parseInt(e.substring(i,i+a),r);s=(a<8?(a=f(l(r,a)),s.mul(a)):s=s.mul(o)).add(f(u))}return s.unsigned=t,s}function g(e,t){return"number"==typeof e?f(e,t):"string"==typeof e?c(e,t):m(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=c,n.fromValue=g;var u=4294967296,p=u*u,y=p/2,_=a(1<<24),v=a(0),b=(n.ZERO=v,a(0,!0)),S=(n.UZERO=b,a(1)),T=(n.ONE=S,a(1,!0)),w=(n.UONE=T,a(-1)),E=(n.NEG_ONE=w,m(-1,2147483647,!1)),A=(n.MAX_VALUE=E,m(-1,-1,!0)),O=(n.MAX_UNSIGNED_VALUE=A,m(0,-2147483648,!1)),x=(n.MIN_VALUE=O,n.prototype);x.toInt=function(){return this.unsigned?this.low>>>0:this.low},x.toNumber=function(){return this.unsigned?(this.high>>>0)*u+(this.low>>>0):this.high*u+(this.low>>>0)},x.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";var t,r;if(this.isNegative())return this.eq(O)?(r=f(e),r=(t=this.div(r)).mul(r).sub(this),t.toString(e)+r.toInt().toString(e)):"-"+this.neg().toString(e);for(var n=f(l(e,6),this.unsigned),o=this,s="";;){var i=o.div(n),a=(o.sub(i.mul(n)).toInt()>>>0).toString(e);if((o=i).isZero())return a+s;for(;a.length<6;)a="0"+a;s=""+a+s}},x.getHighBits=function(){return this.high},x.getHighBitsUnsigned=function(){return this.high>>>0},x.getLowBits=function(){return this.low},x.getLowBitsUnsigned=function(){return this.low>>>0},x.getNumBitsAbs=function(){if(this.isNegative())return this.eq(O)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;0<t&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},x.isSafeInteger=function(){var e=this.high>>21;return!e||!this.unsigned&&-1==e&&!(0===this.low&&-2097152===this.high)},x.isZero=function(){return 0===this.high&&0===this.low},x.eqz=x.isZero,x.isNegative=function(){return!this.unsigned&&this.high<0},x.isPositive=function(){return this.unsigned||0<=this.high},x.isOdd=function(){return!(1&~this.low)},x.isEven=function(){return!(1&this.low)},x.equals=function(e){return d(e)||(e=g(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},x.eq=x.equals,x.notEquals=function(e){return!this.eq(e)},x.neq=x.notEquals,x.ne=x.notEquals,x.lessThan=function(e){return this.comp(e)<0},x.lt=x.lessThan,x.lessThanOrEqual=function(e){return this.comp(e)<=0},x.lte=x.lessThanOrEqual,x.le=x.lessThanOrEqual,x.greaterThan=function(e){return 0<this.comp(e)},x.gt=x.greaterThan,x.greaterThanOrEqual=function(e){return 0<=this.comp(e)},x.gte=x.greaterThanOrEqual,x.ge=x.greaterThanOrEqual,x.compare=function(e){var t,r;return d(e)||(e=g(e)),this.eq(e)?0:(t=this.isNegative(),r=e.isNegative(),t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1)},x.comp=x.compare,x.negate=function(){return!this.unsigned&&this.eq(O)?O:this.not().add(S)},x.neg=x.negate,x.add=function(e){d(e)||(e=g(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,s=e.high>>>16,i=65535&e.high,a=e.low>>>16,u=0,l=0,c=0,p=0;return l+=(c=c+((p+=o+(65535&e.low))>>>16)+(n+a))>>>16,m((c&=65535)<<16|(p&=65535),((u+=(l+=r+i)>>>16)+(t+s)&65535)<<16|(l&=65535),this.unsigned)},x.subtract=function(e){return d(e)||(e=g(e)),this.add(e.neg())},x.sub=x.subtract,x.multiply=function(e){var t,r,n,o,s,i,a,u,l,c,p;return this.isZero()?this:(d(e)||(e=g(e)),h?m(h.mul(this.low,this.high,e.low,e.high),h.get_high(),this.unsigned):e.isZero()?this.unsigned?b:v:this.eq(O)?e.isOdd()?O:v:e.eq(O)?this.isOdd()?O:v:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(_)&&e.lt(_)?f(this.toNumber()*e.toNumber(),this.unsigned):(t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,s=e.high>>>16,i=65535&e.high,a=e.low>>>16,p=(p=c=l=u=0)+((l=l+((c+=o*(e=65535&e.low))>>>16)+n*e)>>>16)+((l=(l&65535)+o*a)>>>16),m((l&=65535)<<16|(c&=65535),(u=(u=(u+=(p+=r*e)>>>16)+((p=(p&65535)+n*a)>>>16)+((p=(p&65535)+o*i)>>>16))+(t*e+r*a+n*i+o*s)&65535)<<16|(p&=65535),this.unsigned)))},x.mul=x.multiply,x.divide=function(e){if((e=d(e)?e:g(e)).isZero())throw Error("division by zero");var t,r;if(h)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?m((this.unsigned?h.div_u:h.div_s)(this.low,this.high,e.low,e.high),h.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?b:v;if(this.unsigned){if((e=e.unsigned?e:e.toUnsigned()).gt(this))return b;if(e.gt(this.shru(1)))return T;r=b}else{if(this.eq(O))return e.eq(S)||e.eq(w)?O:e.eq(O)?S:(n=this.shr(1).div(e).shl(1)).eq(v)?e.isNegative()?S:w:(t=this.sub(e.mul(n)),n.add(t.div(e)));if(e.eq(O))return this.unsigned?b:v;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=v}for(t=this;t.gte(e);){for(var n=Math.max(1,Math.floor(t.toNumber()/e.toNumber())),o=Math.ceil(Math.log(n)/Math.LN2),s=o<=48?1:l(2,o-48),i=f(n),a=i.mul(e);a.isNegative()||a.gt(t);)a=(i=f(n-=s,this.unsigned)).mul(e);i.isZero()&&(i=S),r=r.add(i),t=t.sub(a)}return r},x.div=x.divide,x.modulo=function(e){return d(e)||(e=g(e)),h?m((this.unsigned?h.rem_u:h.rem_s)(this.low,this.high,e.low,e.high),h.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},x.mod=x.modulo,x.rem=x.modulo,x.not=function(){return m(~this.low,~this.high,this.unsigned)},x.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},x.clz=x.countLeadingZeros,x.countTrailingZeros=function(){return this.low?o(this.low):o(this.high)+32},x.ctz=x.countTrailingZeros,x.and=function(e){return d(e)||(e=g(e)),m(this.low&e.low,this.high&e.high,this.unsigned)},x.or=function(e){return d(e)||(e=g(e)),m(this.low|e.low,this.high|e.high,this.unsigned)},x.xor=function(e){return d(e)||(e=g(e)),m(this.low^e.low,this.high^e.high,this.unsigned)},x.shiftLeft=function(e){return d(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?m(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):m(0,this.low<<e-32,this.unsigned)},x.shl=x.shiftLeft,x.shiftRight=function(e){return d(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?m(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):m(this.high>>e-32,0<=this.high?0:-1,this.unsigned)},x.shr=x.shiftRight,x.shiftRightUnsigned=function(e){return d(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?m(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):m(32===e?this.high:this.high>>>e-32,0,this.unsigned)},x.shru=x.shiftRightUnsigned,x.shr_u=x.shiftRightUnsigned,x.rotateLeft=function(e){var t;return d(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?m(this.high,this.low,this.unsigned):e<32?m(this.low<<e|this.high>>>(t=32-e),this.high<<e|this.low>>>t,this.unsigned):(t=32-(e-=32),m(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},x.rotl=x.rotateLeft,x.rotateRight=function(e){var t;return d(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?m(this.high,this.low,this.unsigned):e<32?m(this.high<<(t=32-e)|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned):(t=32-(e-=32),m(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},x.rotr=x.rotateRight,x.toSigned=function(){return this.unsigned?m(this.low,this.high,!1):this},x.toUnsigned=function(){return this.unsigned?this:m(this.low,this.high,!0)},x.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},x.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},x.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)},"function"==typeof BigInt&&(n.fromBigInt=function(e,t){return m(Number(BigInt.asIntN(32,e)),Number(BigInt.asIntN(32,e>>BigInt(32))),t)},n.fromValue=function(e,t){return"bigint"==typeof e?n.fromBigInt(e,t):g(e,t)},x.toBigInt=function(){var e=BigInt(this.low>>>0);return BigInt(this.unsigned?this.high>>>0:this.high)<<BigInt(32)|e}),r.default=n,e.exports=t.default||t}return Vi.exports}function Fi(){return Mi||(Mi=1,(p=Ti).asPromise=(_i||(_i=1,yi=function(e,t){for(var r=new Array(arguments.length-1),s=0,n=2,i=!0;n<arguments.length;)r[s++]=arguments[n++];return new Promise(function(n,o){r[s]=function(e){if(i)if(i=!1,e)o(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];n.apply(null,t)}};try{e.apply(t||null,r)}catch(e){i&&(i=!1,o(e))}})}),yi),p.base64=(Si||(Si=1,(()=>{var e=Ri;e.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;1<--t%4&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var l=new Array(64),u=new Array(123),t=0;t<64;)u[l[t]=t<26?t+65:t<52?t+71:t<62?t-4:t-59|43]=t++;e.encode=function(e,t,r){for(var n,o=null,s=[],i=0,a=0;t<r;){var u=e[t++];switch(a){case 0:s[i++]=l[u>>2],n=(3&u)<<4,a=1;break;case 1:s[i++]=l[n|u>>4],n=(15&u)<<2,a=2;break;case 2:s[i++]=l[n|u>>6],s[i++]=l[63&u],a=0}8191<i&&((o=o||[]).push(String.fromCharCode.apply(String,s)),i=0)}return a&&(s[i++]=l[n],s[i++]=61,1===a)&&(s[i++]=61),o?(i&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))};var c="invalid encoding";e.decode=function(e,t,r){for(var n,o=r,s=0,i=0;i<e.length;){var a=e.charCodeAt(i++);if(61===a&&1<s)break;if(void 0===(a=u[a]))throw Error(c);switch(s){case 0:n=a,s=1;break;case 1:t[r++]=n<<2|(48&a)>>4,n=a,s=2;break;case 2:t[r++]=(15&n)<<4|(60&a)>>2,n=a,s=3;break;case 3:t[r++]=(3&n)<<6|a,s=0}}if(1===s)throw Error(c);return r-o},e.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}})()),Ri),p.EventEmitter=(Ei||(Ei=1,(wi=s).prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},s.prototype.off=function(e,t){if(void 0===e)this._listeners=Object.create(null);else if(void 0===t)this._listeners[e]=[];else{var r=this._listeners[e];if(!r)return this;for(var n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n}return this},s.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}),wi),p.float=Oi?Ai:(Oi=1,Ai=t(t)),p.inquire=Ci?xi:(Ci=1,xi=function(e){try{var t=Ni(e);return t&&(t.length||Object.keys(t).length)?t:null}catch(e){return null}}),p.utf8=(Ii||(Ii=1,(c=ji).length=function(e){for(var t,r=0,n=0;n<e.length;++n)(t=e.charCodeAt(n))<128?r+=1:t<2048?r+=2:55296==(64512&t)&&56320==(64512&e.charCodeAt(n+1))?(++n,r+=4):r+=3;return r},c.read=function(e,t,r){if(r-t<1)return"";for(var n="",o=t;o<r;){var s,i=e[o++];i<=127?n+=String.fromCharCode(i):192<=i&&i<224?n+=128<=(s=(31&i)<<6|63&e[o++])?String.fromCharCode(s):"�":224<=i&&i<240?n+=2048<=(s=(15&i)<<12|(63&e[o++])<<6|63&e[o++])?String.fromCharCode(s):"�":240<=i&&((i=(7&i)<<18|(63&e[o++])<<12|(63&e[o++])<<6|63&e[o++])<65536||1114111<i?n+="�":(i-=65536,n=(n+=String.fromCharCode(55296+(i>>10)))+String.fromCharCode(56320+(1023&i))))}return n},c.write=function(e,t,r){for(var n,o,s=r,i=0;i<e.length;++i)(n=e.charCodeAt(i))<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(55296==(64512&n)&&56320==(64512&(o=e.charCodeAt(i+1)))?(++i,t[r++]=(n=65536+((1023&n)<<10)+(1023&o))>>18|240,t[r++]=n>>12&63|128):t[r++]=n>>12|224,t[r++]=n>>6&63|128),t[r++]=63&n|128);return r-s}),ji),p.pool=(Ui||(Ui=1,Pi=function(t,r,e){var n=e||8192,o=n>>>1,s=null,i=n;return function(e){if(e<1||o<e)return t(e);n<i+e&&(s=t(n),i=0);e=r.call(s,i,i+=e);return 7&i&&(i=1+(7|i)),e}}),Pi),p.LongBits=(Li||(Li=1,ki=o,i=Fi(),(u=o.zero=new o(0,0)).toNumber=function(){return 0},u.zzEncode=u.zzDecode=function(){return this},u.length=function(){return 1},o.zeroHash="\0\0\0\0\0\0\0\0",o.fromNumber=function(e){var t,r;return 0===e?u:(r=(e=(t=e<0)?-e:e)>>>0,e=(e-r)/4294967296>>>0,t&&(e=~e>>>0,r=~r>>>0,4294967295<++r)&&(r=0,4294967295<++e)&&(e=0),new o(r,e))},o.from=function(e){if("number"==typeof e)return o.fromNumber(e);if(i.isString(e)){if(!i.Long)return o.fromNumber(parseInt(e,10));e=i.Long.fromString(e)}return e.low||e.high?new o(e.low>>>0,e.high>>>0):u},o.prototype.toNumber=function(e){var t;return!e&&this.hi>>>31?(e=1+~this.lo>>>0,t=~this.hi>>>0,-(e+4294967296*(t=e?t:t+1>>>0))):this.lo+4294967296*this.hi},o.prototype.toLong=function(e){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}},l=String.prototype.charCodeAt,o.fromHash=function(e){return"\0\0\0\0\0\0\0\0"===e?u:new o((l.call(e,0)|l.call(e,1)<<8|l.call(e,2)<<16|l.call(e,3)<<24)>>>0,(l.call(e,4)|l.call(e,5)<<8|l.call(e,6)<<16|l.call(e,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},o.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},o.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0==r?0==t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}),ki),p.isUnsafeProperty=a,p.isNode=Boolean(void 0!==r&&r&&r.process&&r.process.versions&&r.process.versions.node),p.global=p.isNode&&r||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||r,p.emptyArray=Object.freeze?Object.freeze([]):[],p.emptyObject=Object.freeze?Object.freeze({}):{},p.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},p.isString=function(e){return"string"==typeof e||e instanceof String},p.isObject=function(e){return e&&"object"==typeof e},p.isset=p.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||0<(Array.isArray(r)?r:Object.keys(r)).length)},p.Buffer=(()=>{try{var e=p.global.Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}})(),p._Buffer_from=null,p._Buffer_allocUnsafe=null,p.newBuffer=function(e){return"number"==typeof e?p.Buffer?p._Buffer_allocUnsafe(e):new p.Array(e):p.Buffer?p._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},p.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,p.Long=p.global.dcodeIO&&p.global.dcodeIO.Long||p.global.Long||(()=>{try{var e=Bi();return e&&e.isLong?e:null}catch(e){return null}})(),p.key2Re=/^true|false|0|1$/,p.key32Re=/^-?(?:0|[1-9][0-9]*)$/,p.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,p.longToHash=function(e){return e?p.LongBits.from(e).toHash():p.LongBits.zeroHash},p.longFromHash=function(e,t){e=p.LongBits.fromHash(e);return p.Long?p.Long.fromBits(e.lo,e.hi,t):e.toNumber(Boolean(t))},p.merge=n,p.nestingLimit=32,p.recursionLimit=100,p.makeProp=function(e,t){Object.defineProperty(e,t,{enumerable:!0,configurable:!0,writable:!0})},p.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},p.newError=e,p.ProtocolError=e("ProtocolError"),p.oneOfGetter=function(e){for(var r={},t=0;t<e.length;++t)r[e[t]]=1;return function(){for(var e=Object.keys(this),t=e.length-1;-1<t;--t)if(1===r[e[t]]&&null!=this[e[t]])return e[t]}},p.oneOfSetter=function(r){return function(e){for(var t=0;t<r.length;++t)r[t]!==e&&delete this[r[t]]}},p.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},p._configure=function(){var r=p.Buffer;r?(p._Buffer_from=r.from!==Uint8Array.from&&r.from||function(e,t){return new r(e,t)},p._Buffer_allocUnsafe=r.allocUnsafe||function(e){return new r(e)}):p._Buffer_from=p._Buffer_allocUnsafe=null}),Ti;function a(e){return"__proto__"===e||"prototype"===e||"constructor"===e}function n(e){for(var t=(r="boolean"==typeof arguments[arguments.length-1])?arguments.length-1:arguments.length,r=r&&arguments[arguments.length-1],n=1;n<t;++n){var o=arguments[n];if(o)for(var s=Object.keys(o),i=0;i<s.length;++i)a(s[i])||void 0!==e[s[i]]&&r||(e[s[i]]=o[s[i]])}return e}function e(e){function r(e,t){if(!(this instanceof r))return new r(e,t);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,r):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),t&&n(this,t)}return r.prototype=Object.create(Error.prototype,{constructor:{value:r,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),r}function o(e,t){this.lo=e>>>0,this.hi=t>>>0}function t(e){return"undefined"!=typeof Float32Array?(l=new Float32Array([-0]),c=new Uint8Array(l.buffer),p=128===c[3],e.writeFloatLE=p?f:m,e.writeFloatBE=p?m:f,e.readFloatLE=p?g:y,e.readFloatBE=p?y:g):(e.writeFloatLE=h.bind(null,_),e.writeFloatBE=h.bind(null,v),e.readFloatLE=d.bind(null,b),e.readFloatBE=d.bind(null,S)),"undefined"!=typeof Float64Array?(a=new Float64Array([-0]),u=new Uint8Array(a.buffer),p=128===u[7],e.writeDoubleLE=p?n:o,e.writeDoubleBE=p?o:n,e.readDoubleLE=p?s:i,e.readDoubleBE=p?i:s):(e.writeDoubleLE=t.bind(null,_,0,4),e.writeDoubleBE=t.bind(null,v,4,0),e.readDoubleLE=r.bind(null,b,0,4),e.readDoubleBE=r.bind(null,S,4,0)),e;function t(e,t,r,n,o,s){var i,a,u=n<0?1:0;0===(n=u?-n:n)?(e(0,o,s+t),e(0<1/n?0:2147483648,o,s+r)):isNaN(n)?(e(0,o,s+t),e(2146959360,o,s+r)):17976931348623157e292<n?(e(0,o,s+t),e((u<<31|2146435072)>>>0,o,s+r)):n<22250738585072014e-324?(e((i=n/5e-324)>>>0,o,s+t),e((u<<31|i/4294967296)>>>0,o,s+r)):(1024===(a=Math.floor(Math.log(n)/Math.LN2))&&(a=1023),e(4503599627370496*(i=n*Math.pow(2,-a))>>>0,o,s+t),e((u<<31|a+1023<<20|1048576*i&1048575)>>>0,o,s+r))}function r(e,t,r,n,o){t=e(n,o+t),e=e(n,o+r),n=2*(e>>31)+1,o=e>>>20&2047,r=4294967296*(1048575&e)+t;return 2047==o?r?NaN:1/0*n:0==o?5e-324*n*r:n*Math.pow(2,o-1075)*(r+4503599627370496)}function n(e,t,r){a[0]=e,t[r]=u[0],t[r+1]=u[1],t[r+2]=u[2],t[r+3]=u[3],t[r+4]=u[4],t[r+5]=u[5],t[r+6]=u[6],t[r+7]=u[7]}function o(e,t,r){a[0]=e,t[r]=u[7],t[r+1]=u[6],t[r+2]=u[5],t[r+3]=u[4],t[r+4]=u[3],t[r+5]=u[2],t[r+6]=u[1],t[r+7]=u[0]}function s(e,t){return u[0]=e[t],u[1]=e[t+1],u[2]=e[t+2],u[3]=e[t+3],u[4]=e[t+4],u[5]=e[t+5],u[6]=e[t+6],u[7]=e[t+7],a[0]}function i(e,t){return u[7]=e[t],u[6]=e[t+1],u[5]=e[t+2],u[4]=e[t+3],u[3]=e[t+4],u[2]=e[t+5],u[1]=e[t+6],u[0]=e[t+7],a[0]}var a,u,l,c,p;function h(e,t,r,n){var o=t<0?1:0;0===(t=o?-t:t)?e(0<1/t?0:2147483648,r,n):isNaN(t)?e(2143289344,r,n):e(34028234663852886e22<t?(o<<31|2139095040)>>>0:t<11754943508222875e-54?(o<<31|Math.round(t/1401298464324817e-60))>>>0:(o<<31|(e=Math.floor(Math.log(t)/Math.LN2))+127<<23|8388607&Math.round(t*Math.pow(2,-e)*8388608))>>>0,r,n)}function d(e,t,r){e=e(t,r),t=2*(e>>31)+1,r=e>>>23&255,e&=8388607;return 255==r?e?NaN:1/0*t:0==r?1401298464324817e-60*t*e:t*Math.pow(2,r-150)*(8388608+e)}function f(e,t,r){l[0]=e,t[r]=c[0],t[r+1]=c[1],t[r+2]=c[2],t[r+3]=c[3]}function m(e,t,r){l[0]=e,t[r]=c[3],t[r+1]=c[2],t[r+2]=c[1],t[r+3]=c[0]}function g(e,t){return c[0]=e[t],c[1]=e[t+1],c[2]=e[t+2],c[3]=e[t+3],l[0]}function y(e,t){return c[3]=e[t],c[2]=e[t+1],c[1]=e[t+2],c[0]=e[t+3],l[0]}}function _(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function v(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function b(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function S(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function s(){this._listeners=Object.create(null)}var i,u,l,c,p}var qi,Hi=Xi,Gi=Fi(),zi=Gi.LongBits,Ki=Gi.base64,Yi=Gi.utf8;function Wi(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function $i(){}function Ji(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function Xi(){this.len=0,this.head=new Wi($i,0,0),this.tail=this.head,this.states=null}var Qi=function(){return Gi.Buffer?function(){return(Xi.create=function(){return new qi})()}:function(){return new Xi}};function Zi(e,t,r){t[r]=255&e}function es(e,t){this.len=e,this.next=void 0,this.val=t}function ts(e,t,r){for(var n=e.lo,o=e.hi;o;)t[r++]=127&n|128,n=(n>>>7|o<<25)>>>0,o>>>=7;for(;127<n;)t[r++]=127&n|128,n>>>=7;t[r++]=n}function rs(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}Xi.create=Qi(),Xi.alloc=function(e){return new Gi.Array(e)},Gi.Array!==Array&&(Xi.alloc=Gi.pool(Xi.alloc,Gi.Array.prototype.subarray)),Xi.prototype._push=function(e,t,r){return this.tail=this.tail.next=new Wi(e,t,r),this.len+=t,this},es.prototype=Object.create(Wi.prototype),es.prototype.fn=function(e,t,r){for(;127<e;)t[r++]=127&e|128,e>>>=7;t[r]=e},Xi.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new es((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},Xi.prototype.int32=function(e){return(e|=0)<0?this._push(ts,10,zi.fromNumber(e)):this.uint32(e)},Xi.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},Xi.prototype.uint64=function(e){e=zi.from(e);return this._push(ts,e.length(),e)},Xi.prototype.int64=Xi.prototype.uint64,Xi.prototype.sint64=function(e){e=zi.from(e).zzEncode();return this._push(ts,e.length(),e)},Xi.prototype.bool=function(e){return this._push(Zi,1,e?1:0)},Xi.prototype.fixed32=function(e){return this._push(rs,4,e>>>0)},Xi.prototype.sfixed32=Xi.prototype.fixed32,Xi.prototype.fixed64=function(e){e=zi.from(e);return this._push(rs,4,e.lo)._push(rs,4,e.hi)},Xi.prototype.sfixed64=Xi.prototype.fixed64,Xi.prototype.float=function(e){return this._push(Gi.float.writeFloatLE,4,e)},Xi.prototype.double=function(e){return this._push(Gi.float.writeDoubleLE,8,e)};var ns=Gi.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]},os=(Xi.prototype.bytes=function(e){var t,r=e.length>>>0;return r?(Gi.isString(e)&&(t=Xi.alloc(r=Ki.length(e)),Ki.decode(e,t,0),e=t),this.uint32(r)._push(ns,r,e)):this._push(Zi,1,0)},Xi.prototype.string=function(e){var t=Yi.length(e);return t?this.uint32(t)._push(Yi.write,t,e):this._push(Zi,1,0)},Xi.prototype.fork=function(){return this.states=new Ji(this),this.head=this.tail=new Wi($i,0,0),this.len=0,this},Xi.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Wi($i,0,0),this.len=0),this},Xi.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},Xi.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},Xi._configure=function(e){qi=e,Xi.create=Qi(),qi._configure()},as),is=Hi,ss=((as.prototype=Object.create(is.prototype)).constructor=as,Fi());function as(){is.call(this)}function us(e,t,r){e.length<40?ss.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}as._configure=function(){as.alloc=ss._Buffer_allocUnsafe,as.writeBytesBuffer=ss.Buffer&&ss.Buffer.prototype instanceof Uint8Array&&"set"===ss.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},as.prototype.bytes=function(e){var t=(e=ss.isString(e)?ss._Buffer_from(e,"base64"):e).length>>>0;return this.uint32(t),t&&this._push(as.writeBytesBuffer,t,e),this},as.prototype.string=function(e){var t=ss.Buffer.byteLength(e);return this.uint32(t),t&&this._push(us,t,e),this},as._configure();var ls,cs=ms,ps=Fi(),ds=ps.LongBits,hs=ps.utf8;function fs(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function ms(e){this.buf=e,this.pos=0,this.len=e.length}var gs,ys="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new ms(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new ms(e);throw Error("illegal buffer")},_s=function(){return ps.Buffer?function(e){return(ms.create=function(e){return ps.Buffer.isBuffer(e)?new ls(e):ys(e)})(e)}:ys};function vs(){var e=new ds(0,0),t=0;if(!(4<this.len-this.pos)){for(;t<3;++t){if(this.pos>=this.len)throw fs(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,4<this.len-this.pos){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw fs(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function bs(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function Ts(){if(this.pos+8>this.len)throw fs(this,8);return new ds(bs(this.buf,this.pos+=4),bs(this.buf,this.pos+=4))}ms.create=_s(),ms.prototype._slice=ps.Array.prototype.subarray||ps.Array.prototype.slice,ms.prototype.uint32=(gs=4294967295,function(){if(gs=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(gs=(gs|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(gs=(gs|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(gs=(gs|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(gs=(gs|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)||!((this.pos+=5)>this.len))return gs;throw this.pos=this.len,fs(this,10)}),ms.prototype.int32=function(){return 0|this.uint32()},ms.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},ms.prototype.bool=function(){return 0!==this.uint32()},ms.prototype.fixed32=function(){if(this.pos+4>this.len)throw fs(this,4);return bs(this.buf,this.pos+=4)},ms.prototype.sfixed32=function(){if(this.pos+4>this.len)throw fs(this,4);return 0|bs(this.buf,this.pos+=4)},ms.prototype.float=function(){if(this.pos+4>this.len)throw fs(this,4);var e=ps.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},ms.prototype.double=function(){if(this.pos+8>this.len)throw fs(this,4);var e=ps.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},ms.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw fs(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?(e=ps.Buffer)?e.alloc(0):new this.buf.constructor(0):this._slice.call(this.buf,t,r)},ms.prototype.string=function(){var e=this.bytes();return hs.read(e,0,e.length)},ms.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw fs(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw fs(this)}while(128&this.buf[this.pos++]);return this},ms.recursionLimit=ps.recursionLimit,ms.prototype.skipType=function(e,t){if((t=void 0===t?0:t)>ms.recursionLimit)throw Error("maximum nesting depth exceeded");switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e,t+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},ms._configure=function(e){ls=e,ms.create=_s(),ls._configure();var t=ps.Long?"toLong":"toNumber";ps.merge(ms.prototype,{int64:function(){return vs.call(this)[t](!1)},uint64:function(){return vs.call(this)[t](!0)},sint64:function(){return vs.call(this).zzDecode()[t](!1)},fixed64:function(){return Ts.call(this)[t](!0)},sfixed64:function(){return Ts.call(this)[t](!1)}})};var Ss=As,ws=cs,Es=((As.prototype=Object.create(ws.prototype)).constructor=As,Fi());function As(e){ws.call(this,e)}As._configure=function(){Es.Buffer&&(As.prototype._slice=Es.Buffer.prototype.slice)},As.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},As._configure();var Os={},xs=Rs,Cs=Fi();function Rs(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");Cs.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}((Rs.prototype=Object.create(Cs.EventEmitter.prototype)).constructor=Rs).prototype.rpcCall=function e(r,t,n,o,s){if(!o)throw TypeError("request must be specified");var i=this;if(!s)return Cs.asPromise(e,i,r,t,n,o);if(i.rpcImpl)try{return i.rpcImpl(r,t[i.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(e,t){if(e)return i.emit("error",e,r),s(e);if(null!==t){if(!(t instanceof n))try{t=n[i.responseDelimited?"decodeDelimited":"decode"](t)}catch(e){return i.emit("error",e,r),s(e)}return i.emit("data",t,r),s(null,t)}i.end(!0)})}catch(e){i.emit("error",e,r),setTimeout(function(){s(e)},0)}else setTimeout(function(){s(Error("already ended"))},0)},Rs.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},Os.Service=xs;var Ns=Object.create(null);(()=>{var e=bi;function t(){e.util._configure(),e.Writer._configure(e.BufferWriter),e.Reader._configure(e.BufferReader)}e.build="minimal",e.Writer=Hi,e.BufferWriter=os,e.Reader=cs,e.BufferReader=Ss,e.util=Fi(),e.rpc=Os,e.roots=Ns,e.configure=t,t()})();var Is,Ps,Us,ks,Ls,oa,ia,sa,aa,ya,Sa,js=vi.exports=bi,Ds=js.Reader,Ms=js.Writer,Vs=js.util,Bs=js.roots.default||(js.roots.default={}),Fs=(Bs.opentelemetry=((Ls={}).proto=((ks={}).common=(()=>{var e,t,r={};return r.v1=((e={}).AnyValue=(u.prototype.stringValue=null,u.prototype.boolValue=null,u.prototype.intValue=null,u.prototype.doubleValue=null,u.prototype.arrayValue=null,u.prototype.kvlistValue=null,u.prototype.bytesValue=null,Object.defineProperty(u.prototype,"value",{get:Vs.oneOfGetter(t=["stringValue","boolValue","intValue","doubleValue","arrayValue","kvlistValue","bytesValue"]),set:Vs.oneOfSetter(t)}),u.create=function(e){return new u(e)},u.encode=function(e,t){return t=t||Ms.create(),null!=e.stringValue&&Object.hasOwnProperty.call(e,"stringValue")&&t.uint32(10).string(e.stringValue),null!=e.boolValue&&Object.hasOwnProperty.call(e,"boolValue")&&t.uint32(16).bool(e.boolValue),null!=e.intValue&&Object.hasOwnProperty.call(e,"intValue")&&t.uint32(24).int64(e.intValue),null!=e.doubleValue&&Object.hasOwnProperty.call(e,"doubleValue")&&t.uint32(33).double(e.doubleValue),null!=e.arrayValue&&Object.hasOwnProperty.call(e,"arrayValue")&&Bs.opentelemetry.proto.common.v1.ArrayValue.encode(e.arrayValue,t.uint32(42).fork()).ldelim(),null!=e.kvlistValue&&Object.hasOwnProperty.call(e,"kvlistValue")&&Bs.opentelemetry.proto.common.v1.KeyValueList.encode(e.kvlistValue,t.uint32(50).fork()).ldelim(),null!=e.bytesValue&&Object.hasOwnProperty.call(e,"bytesValue")&&t.uint32(58).bytes(e.bytesValue),t},u.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},u.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.common.v1.AnyValue;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.stringValue=e.string();break;case 2:o.boolValue=e.bool();break;case 3:o.intValue=e.int64();break;case 4:o.doubleValue=e.double();break;case 5:o.arrayValue=Bs.opentelemetry.proto.common.v1.ArrayValue.decode(e,e.uint32());break;case 6:o.kvlistValue=Bs.opentelemetry.proto.common.v1.KeyValueList.decode(e,e.uint32());break;case 7:o.bytesValue=e.bytes();break;default:e.skipType(7&s)}}return o},u.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},u.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t,r={};if(null!=e.stringValue&&e.hasOwnProperty("stringValue")&&(r.value=1,!Vs.isString(e.stringValue)))return"stringValue: string expected";if(null!=e.boolValue&&e.hasOwnProperty("boolValue")){if(1===r.value)return"value: multiple values";if(r.value=1,"boolean"!=typeof e.boolValue)return"boolValue: boolean expected"}if(null!=e.intValue&&e.hasOwnProperty("intValue")){if(1===r.value)return"value: multiple values";if(r.value=1,!(Vs.isInteger(e.intValue)||e.intValue&&Vs.isInteger(e.intValue.low)&&Vs.isInteger(e.intValue.high)))return"intValue: integer|Long expected"}if(null!=e.doubleValue&&e.hasOwnProperty("doubleValue")){if(1===r.value)return"value: multiple values";if(r.value=1,"number"!=typeof e.doubleValue)return"doubleValue: number expected"}if(null!=e.arrayValue&&e.hasOwnProperty("arrayValue")){if(1===r.value)return"value: multiple values";if(r.value=1,t=Bs.opentelemetry.proto.common.v1.ArrayValue.verify(e.arrayValue))return"arrayValue."+t}if(null!=e.kvlistValue&&e.hasOwnProperty("kvlistValue")){if(1===r.value)return"value: multiple values";if(r.value=1,t=Bs.opentelemetry.proto.common.v1.KeyValueList.verify(e.kvlistValue))return"kvlistValue."+t}if(null!=e.bytesValue&&e.hasOwnProperty("bytesValue")){if(1===r.value)return"value: multiple values";if(r.value=1,!(e.bytesValue&&"number"==typeof e.bytesValue.length||Vs.isString(e.bytesValue)))return"bytesValue: buffer expected"}return null},u.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.common.v1.AnyValue)return e;var t=new Bs.opentelemetry.proto.common.v1.AnyValue;if(null!=e.stringValue&&(t.stringValue=String(e.stringValue)),null!=e.boolValue&&(t.boolValue=Boolean(e.boolValue)),null!=e.intValue&&(Vs.Long?(t.intValue=Vs.Long.fromValue(e.intValue)).unsigned=!1:"string"==typeof e.intValue?t.intValue=parseInt(e.intValue,10):"number"==typeof e.intValue?t.intValue=e.intValue:"object"==typeof e.intValue&&(t.intValue=new Vs.LongBits(e.intValue.low>>>0,e.intValue.high>>>0).toNumber())),null!=e.doubleValue&&(t.doubleValue=Number(e.doubleValue)),null!=e.arrayValue){if("object"!=typeof e.arrayValue)throw TypeError(".opentelemetry.proto.common.v1.AnyValue.arrayValue: object expected");t.arrayValue=Bs.opentelemetry.proto.common.v1.ArrayValue.fromObject(e.arrayValue)}if(null!=e.kvlistValue){if("object"!=typeof e.kvlistValue)throw TypeError(".opentelemetry.proto.common.v1.AnyValue.kvlistValue: object expected");t.kvlistValue=Bs.opentelemetry.proto.common.v1.KeyValueList.fromObject(e.kvlistValue)}return null!=e.bytesValue&&("string"==typeof e.bytesValue?Vs.base64.decode(e.bytesValue,t.bytesValue=Vs.newBuffer(Vs.base64.length(e.bytesValue)),0):0<=e.bytesValue.length&&(t.bytesValue=e.bytesValue)),t},u.toObject=function(e,t){t=t||{};var r={};return null!=e.stringValue&&e.hasOwnProperty("stringValue")&&(r.stringValue=e.stringValue,t.oneofs)&&(r.value="stringValue"),null!=e.boolValue&&e.hasOwnProperty("boolValue")&&(r.boolValue=e.boolValue,t.oneofs)&&(r.value="boolValue"),null!=e.intValue&&e.hasOwnProperty("intValue")&&("number"==typeof e.intValue?r.intValue=t.longs===String?String(e.intValue):e.intValue:r.intValue=t.longs===String?Vs.Long.prototype.toString.call(e.intValue):t.longs===Number?new Vs.LongBits(e.intValue.low>>>0,e.intValue.high>>>0).toNumber():e.intValue,t.oneofs)&&(r.value="intValue"),null!=e.doubleValue&&e.hasOwnProperty("doubleValue")&&(r.doubleValue=t.json&&!isFinite(e.doubleValue)?String(e.doubleValue):e.doubleValue,t.oneofs)&&(r.value="doubleValue"),null!=e.arrayValue&&e.hasOwnProperty("arrayValue")&&(r.arrayValue=Bs.opentelemetry.proto.common.v1.ArrayValue.toObject(e.arrayValue,t),t.oneofs)&&(r.value="arrayValue"),null!=e.kvlistValue&&e.hasOwnProperty("kvlistValue")&&(r.kvlistValue=Bs.opentelemetry.proto.common.v1.KeyValueList.toObject(e.kvlistValue,t),t.oneofs)&&(r.value="kvlistValue"),null!=e.bytesValue&&e.hasOwnProperty("bytesValue")&&(r.bytesValue=t.bytes===String?Vs.base64.encode(e.bytesValue,0,e.bytesValue.length):t.bytes===Array?Array.prototype.slice.call(e.bytesValue):e.bytesValue,t.oneofs)&&(r.value="bytesValue"),r},u.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},u.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.AnyValue"},u),e.ArrayValue=(a.prototype.values=Vs.emptyArray,a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Ms.create(),null!=e.values&&e.values.length)for(var r=0;r<e.values.length;++r)Bs.opentelemetry.proto.common.v1.AnyValue.encode(e.values[r],t.uint32(10).fork()).ldelim();return t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.common.v1.ArrayValue;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.values&&o.values.length||(o.values=[]),o.values.push(Bs.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32()))):e.skipType(7&s)}return o},a.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.values&&e.hasOwnProperty("values")){if(!Array.isArray(e.values))return"values: array expected";for(var t=0;t<e.values.length;++t){var r=Bs.opentelemetry.proto.common.v1.AnyValue.verify(e.values[t]);if(r)return"values."+r}}return null},a.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.common.v1.ArrayValue)return e;var t=new Bs.opentelemetry.proto.common.v1.ArrayValue;if(e.values){if(!Array.isArray(e.values))throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: array expected");t.values=[];for(var r=0;r<e.values.length;++r){if("object"!=typeof e.values[r])throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: object expected");t.values[r]=Bs.opentelemetry.proto.common.v1.AnyValue.fromObject(e.values[r])}}return t},a.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.values=[]),e.values&&e.values.length){r.values=[];for(var n=0;n<e.values.length;++n)r.values[n]=Bs.opentelemetry.proto.common.v1.AnyValue.toObject(e.values[n],t)}return r},a.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.ArrayValue"},a),e.KeyValueList=(i.prototype.values=Vs.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,t){if(t=t||Ms.create(),null!=e.values&&e.values.length)for(var r=0;r<e.values.length;++r)Bs.opentelemetry.proto.common.v1.KeyValue.encode(e.values[r],t.uint32(10).fork()).ldelim();return t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.common.v1.KeyValueList;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.values&&o.values.length||(o.values=[]),o.values.push(Bs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()))):e.skipType(7&s)}return o},i.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},i.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.values&&e.hasOwnProperty("values")){if(!Array.isArray(e.values))return"values: array expected";for(var t=0;t<e.values.length;++t){var r=Bs.opentelemetry.proto.common.v1.KeyValue.verify(e.values[t]);if(r)return"values."+r}}return null},i.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.common.v1.KeyValueList)return e;var t=new Bs.opentelemetry.proto.common.v1.KeyValueList;if(e.values){if(!Array.isArray(e.values))throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: array expected");t.values=[];for(var r=0;r<e.values.length;++r){if("object"!=typeof e.values[r])throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: object expected");t.values[r]=Bs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.values[r])}}return t},i.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.values=[]),e.values&&e.values.length){r.values=[];for(var n=0;n<e.values.length;++n)r.values[n]=Bs.opentelemetry.proto.common.v1.KeyValue.toObject(e.values[n],t)}return r},i.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.KeyValueList"},i),e.KeyValue=(s.prototype.key=null,s.prototype.value=null,s.create=function(e){return new s(e)},s.encode=function(e,t){return t=t||Ms.create(),null!=e.key&&Object.hasOwnProperty.call(e,"key")&&t.uint32(10).string(e.key),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&Bs.opentelemetry.proto.common.v1.AnyValue.encode(e.value,t.uint32(18).fork()).ldelim(),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.common.v1.KeyValue;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.key=e.string();break;case 2:o.value=Bs.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32());break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.key&&e.hasOwnProperty("key")&&!Vs.isString(e.key))return"key: string expected";if(null!=e.value&&e.hasOwnProperty("value")){e=Bs.opentelemetry.proto.common.v1.AnyValue.verify(e.value);if(e)return"value."+e}return null},s.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.common.v1.KeyValue)return e;var t=new Bs.opentelemetry.proto.common.v1.KeyValue;if(null!=e.key&&(t.key=String(e.key)),null!=e.value){if("object"!=typeof e.value)throw TypeError(".opentelemetry.proto.common.v1.KeyValue.value: object expected");t.value=Bs.opentelemetry.proto.common.v1.AnyValue.fromObject(e.value)}return t},s.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.key="",r.value=null),null!=e.key&&e.hasOwnProperty("key")&&(r.key=e.key),null!=e.value&&e.hasOwnProperty("value")&&(r.value=Bs.opentelemetry.proto.common.v1.AnyValue.toObject(e.value,t)),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.KeyValue"},s),e.InstrumentationScope=(o.prototype.name=null,o.prototype.version=null,o.prototype.attributes=Vs.emptyArray,o.prototype.droppedAttributesCount=null,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ms.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.version&&Object.hasOwnProperty.call(e,"version")&&t.uint32(18).string(e.version),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Bs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(26).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(32).uint32(e.droppedAttributesCount),t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.common.v1.InstrumentationScope;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.name=e.string();break;case 2:o.version=e.string();break;case 3:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Bs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 4:o.droppedAttributesCount=e.uint32();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!Vs.isString(e.name))return"name: string expected";if(null!=e.version&&e.hasOwnProperty("version")&&!Vs.isString(e.version))return"version: string expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t){var r=Bs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]);if(r)return"attributes."+r}}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Vs.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},o.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.common.v1.InstrumentationScope)return e;var t=new Bs.opentelemetry.proto.common.v1.InstrumentationScope;if(null!=e.name&&(t.name=String(e.name)),null!=e.version&&(t.version=String(e.version)),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: object expected");t.attributes[r]=Bs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.attributes=[]),t.defaults&&(r.name="",r.version="",r.droppedAttributesCount=0),null!=e.name&&e.hasOwnProperty("name")&&(r.name=e.name),null!=e.version&&e.hasOwnProperty("version")&&(r.version=e.version),e.attributes&&e.attributes.length){r.attributes=[];for(var n=0;n<e.attributes.length;++n)r.attributes[n]=Bs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[n],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(r.droppedAttributesCount=e.droppedAttributesCount),r},o.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.InstrumentationScope"},o),e.EntityRef=(n.prototype.schemaUrl=null,n.prototype.type=null,n.prototype.idKeys=Vs.emptyArray,n.prototype.descriptionKeys=Vs.emptyArray,n.create=function(e){return new n(e)},n.encode=function(e,t){if(t=t||Ms.create(),null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(10).string(e.schemaUrl),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(18).string(e.type),null!=e.idKeys&&e.idKeys.length)for(var r=0;r<e.idKeys.length;++r)t.uint32(26).string(e.idKeys[r]);if(null!=e.descriptionKeys&&e.descriptionKeys.length)for(r=0;r<e.descriptionKeys.length;++r)t.uint32(34).string(e.descriptionKeys[r]);return t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.common.v1.EntityRef;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.schemaUrl=e.string();break;case 2:o.type=e.string();break;case 3:o.idKeys&&o.idKeys.length||(o.idKeys=[]),o.idKeys.push(e.string());break;case 4:o.descriptionKeys&&o.descriptionKeys.length||(o.descriptionKeys=[]),o.descriptionKeys.push(e.string());break;default:e.skipType(7&s)}}return o},n.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Vs.isString(e.schemaUrl))return"schemaUrl: string expected";if(null!=e.type&&e.hasOwnProperty("type")&&!Vs.isString(e.type))return"type: string expected";if(null!=e.idKeys&&e.hasOwnProperty("idKeys")){if(!Array.isArray(e.idKeys))return"idKeys: array expected";for(var t=0;t<e.idKeys.length;++t)if(!Vs.isString(e.idKeys[t]))return"idKeys: string[] expected"}if(null!=e.descriptionKeys&&e.hasOwnProperty("descriptionKeys")){if(!Array.isArray(e.descriptionKeys))return"descriptionKeys: array expected";for(t=0;t<e.descriptionKeys.length;++t)if(!Vs.isString(e.descriptionKeys[t]))return"descriptionKeys: string[] expected"}return null},n.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.common.v1.EntityRef)return e;var t=new Bs.opentelemetry.proto.common.v1.EntityRef;if(null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),null!=e.type&&(t.type=String(e.type)),e.idKeys){if(!Array.isArray(e.idKeys))throw TypeError(".opentelemetry.proto.common.v1.EntityRef.idKeys: array expected");t.idKeys=[];for(var r=0;r<e.idKeys.length;++r)t.idKeys[r]=String(e.idKeys[r])}if(e.descriptionKeys){if(!Array.isArray(e.descriptionKeys))throw TypeError(".opentelemetry.proto.common.v1.EntityRef.descriptionKeys: array expected");for(t.descriptionKeys=[],r=0;r<e.descriptionKeys.length;++r)t.descriptionKeys[r]=String(e.descriptionKeys[r])}return t},n.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.idKeys=[],r.descriptionKeys=[]),t.defaults&&(r.schemaUrl="",r.type=""),null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),null!=e.type&&e.hasOwnProperty("type")&&(r.type=e.type),e.idKeys&&e.idKeys.length){r.idKeys=[];for(var n=0;n<e.idKeys.length;++n)r.idKeys[n]=e.idKeys[n]}if(e.descriptionKeys&&e.descriptionKeys.length)for(r.descriptionKeys=[],n=0;n<e.descriptionKeys.length;++n)r.descriptionKeys[n]=e.descriptionKeys[n];return r},n.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.EntityRef"},n),e),r;function n(e){if(this.idKeys=[],this.descriptionKeys=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(this.values=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.values=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function u(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),ks.resource=((Ps={}).v1=((Is={}).Resource=(()=>{function t(e){if(this.attributes=[],this.entityRefs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return t.prototype.attributes=Vs.emptyArray,t.prototype.droppedAttributesCount=null,t.prototype.entityRefs=Vs.emptyArray,t.create=function(e){return new t(e)},t.encode=function(e,t){if(t=t||Ms.create(),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Bs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(10).fork()).ldelim();if(null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(16).uint32(e.droppedAttributesCount),null!=e.entityRefs&&e.entityRefs.length)for(r=0;r<e.entityRefs.length;++r)Bs.opentelemetry.proto.common.v1.EntityRef.encode(e.entityRefs[r],t.uint32(26).fork()).ldelim();return t},t.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},t.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.resource.v1.Resource;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Bs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.droppedAttributesCount=e.uint32();break;case 3:o.entityRefs&&o.entityRefs.length||(o.entityRefs=[]),o.entityRefs.push(Bs.opentelemetry.proto.common.v1.EntityRef.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return o},t.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=Bs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Vs.isInteger(e.droppedAttributesCount))return"droppedAttributesCount: integer expected";if(null!=e.entityRefs&&e.hasOwnProperty("entityRefs")){if(!Array.isArray(e.entityRefs))return"entityRefs: array expected";for(t=0;t<e.entityRefs.length;++t){var r;if(r=Bs.opentelemetry.proto.common.v1.EntityRef.verify(e.entityRefs[t]))return"entityRefs."+r}}return null},t.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.resource.v1.Resource)return e;var t=new Bs.opentelemetry.proto.resource.v1.Resource;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: object expected");t.attributes[r]=Bs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),e.entityRefs){if(!Array.isArray(e.entityRefs))throw TypeError(".opentelemetry.proto.resource.v1.Resource.entityRefs: array expected");for(t.entityRefs=[],r=0;r<e.entityRefs.length;++r){if("object"!=typeof e.entityRefs[r])throw TypeError(".opentelemetry.proto.resource.v1.Resource.entityRefs: object expected");t.entityRefs[r]=Bs.opentelemetry.proto.common.v1.EntityRef.fromObject(e.entityRefs[r])}}return t},t.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.attributes=[],r.entityRefs=[]),t.defaults&&(r.droppedAttributesCount=0),e.attributes&&e.attributes.length){r.attributes=[];for(var n=0;n<e.attributes.length;++n)r.attributes[n]=Bs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[n],t)}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(r.droppedAttributesCount=e.droppedAttributesCount),e.entityRefs&&e.entityRefs.length)for(r.entityRefs=[],n=0;n<e.entityRefs.length;++n)r.entityRefs[n]=Bs.opentelemetry.proto.common.v1.EntityRef.toObject(e.entityRefs[n],t);return r},t.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},t.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.resource.v1.Resource"},t})(),Is),Ps),ks.trace=(()=>{var e,t,r,n={};return n.v1=((r={}).TracesData=(c.prototype.resourceSpans=Vs.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,t){if(t=t||Ms.create(),null!=e.resourceSpans&&e.resourceSpans.length)for(var r=0;r<e.resourceSpans.length;++r)Bs.opentelemetry.proto.trace.v1.ResourceSpans.encode(e.resourceSpans[r],t.uint32(10).fork()).ldelim();return t},c.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},c.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.trace.v1.TracesData;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceSpans&&o.resourceSpans.length||(o.resourceSpans=[]),o.resourceSpans.push(Bs.opentelemetry.proto.trace.v1.ResourceSpans.decode(e,e.uint32()))):e.skipType(7&s)}return o},c.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},c.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceSpans&&e.hasOwnProperty("resourceSpans")){if(!Array.isArray(e.resourceSpans))return"resourceSpans: array expected";for(var t=0;t<e.resourceSpans.length;++t){var r=Bs.opentelemetry.proto.trace.v1.ResourceSpans.verify(e.resourceSpans[t]);if(r)return"resourceSpans."+r}}return null},c.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.trace.v1.TracesData)return e;var t=new Bs.opentelemetry.proto.trace.v1.TracesData;if(e.resourceSpans){if(!Array.isArray(e.resourceSpans))throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: array expected");t.resourceSpans=[];for(var r=0;r<e.resourceSpans.length;++r){if("object"!=typeof e.resourceSpans[r])throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: object expected");t.resourceSpans[r]=Bs.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(e.resourceSpans[r])}}return t},c.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceSpans=[]),e.resourceSpans&&e.resourceSpans.length){r.resourceSpans=[];for(var n=0;n<e.resourceSpans.length;++n)r.resourceSpans[n]=Bs.opentelemetry.proto.trace.v1.ResourceSpans.toObject(e.resourceSpans[n],t)}return r},c.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},c.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.TracesData"},c),r.ResourceSpans=(l.prototype.resource=null,l.prototype.scopeSpans=Vs.emptyArray,l.prototype.schemaUrl=null,l.create=function(e){return new l(e)},l.encode=function(e,t){if(t=t||Ms.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&Bs.opentelemetry.proto.resource.v1.Resource.encode(e.resource,t.uint32(10).fork()).ldelim(),null!=e.scopeSpans&&e.scopeSpans.length)for(var r=0;r<e.scopeSpans.length;++r)Bs.opentelemetry.proto.trace.v1.ScopeSpans.encode(e.scopeSpans[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},l.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},l.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.trace.v1.ResourceSpans;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.resource=Bs.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break;case 2:o.scopeSpans&&o.scopeSpans.length||(o.scopeSpans=[]),o.scopeSpans.push(Bs.opentelemetry.proto.trace.v1.ScopeSpans.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},l.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},l.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&(t=Bs.opentelemetry.proto.resource.v1.Resource.verify(e.resource)))return"resource."+t;if(null!=e.scopeSpans&&e.hasOwnProperty("scopeSpans")){if(!Array.isArray(e.scopeSpans))return"scopeSpans: array expected";for(var t,r=0;r<e.scopeSpans.length;++r)if(t=Bs.opentelemetry.proto.trace.v1.ScopeSpans.verify(e.scopeSpans[r]))return"scopeSpans."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Vs.isString(e.schemaUrl)?"schemaUrl: string expected":null},l.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.trace.v1.ResourceSpans)return e;var t=new Bs.opentelemetry.proto.trace.v1.ResourceSpans;if(null!=e.resource){if("object"!=typeof e.resource)throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.resource: object expected");t.resource=Bs.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeSpans){if(!Array.isArray(e.scopeSpans))throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: array expected");t.scopeSpans=[];for(var r=0;r<e.scopeSpans.length;++r){if("object"!=typeof e.scopeSpans[r])throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: object expected");t.scopeSpans[r]=Bs.opentelemetry.proto.trace.v1.ScopeSpans.fromObject(e.scopeSpans[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},l.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.scopeSpans=[]),t.defaults&&(r.resource=null,r.schemaUrl=""),null!=e.resource&&e.hasOwnProperty("resource")&&(r.resource=Bs.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,t)),e.scopeSpans&&e.scopeSpans.length){r.scopeSpans=[];for(var n=0;n<e.scopeSpans.length;++n)r.scopeSpans[n]=Bs.opentelemetry.proto.trace.v1.ScopeSpans.toObject(e.scopeSpans[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},l.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},l.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.ResourceSpans"},l),r.ScopeSpans=(u.prototype.scope=null,u.prototype.spans=Vs.emptyArray,u.prototype.schemaUrl=null,u.create=function(e){return new u(e)},u.encode=function(e,t){if(t=t||Ms.create(),null!=e.scope&&Object.hasOwnProperty.call(e,"scope")&&Bs.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,t.uint32(10).fork()).ldelim(),null!=e.spans&&e.spans.length)for(var r=0;r<e.spans.length;++r)Bs.opentelemetry.proto.trace.v1.Span.encode(e.spans[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},u.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},u.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.trace.v1.ScopeSpans;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.scope=Bs.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break;case 2:o.spans&&o.spans.length||(o.spans=[]),o.spans.push(Bs.opentelemetry.proto.trace.v1.Span.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},u.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},u.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.scope&&e.hasOwnProperty("scope")&&(t=Bs.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope)))return"scope."+t;if(null!=e.spans&&e.hasOwnProperty("spans")){if(!Array.isArray(e.spans))return"spans: array expected";for(var t,r=0;r<e.spans.length;++r)if(t=Bs.opentelemetry.proto.trace.v1.Span.verify(e.spans[r]))return"spans."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Vs.isString(e.schemaUrl)?"schemaUrl: string expected":null},u.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.trace.v1.ScopeSpans)return e;var t=new Bs.opentelemetry.proto.trace.v1.ScopeSpans;if(null!=e.scope){if("object"!=typeof e.scope)throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.scope: object expected");t.scope=Bs.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.spans){if(!Array.isArray(e.spans))throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: array expected");t.spans=[];for(var r=0;r<e.spans.length;++r){if("object"!=typeof e.spans[r])throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: object expected");t.spans[r]=Bs.opentelemetry.proto.trace.v1.Span.fromObject(e.spans[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},u.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.spans=[]),t.defaults&&(r.scope=null,r.schemaUrl=""),null!=e.scope&&e.hasOwnProperty("scope")&&(r.scope=Bs.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,t)),e.spans&&e.spans.length){r.spans=[];for(var n=0;n<e.spans.length;++n)r.spans[n]=Bs.opentelemetry.proto.trace.v1.Span.toObject(e.spans[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},u.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},u.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.ScopeSpans"},u),r.Span=(s.prototype.traceId=null,s.prototype.spanId=null,s.prototype.traceState=null,s.prototype.parentSpanId=null,s.prototype.flags=null,s.prototype.name=null,s.prototype.kind=null,s.prototype.startTimeUnixNano=null,s.prototype.endTimeUnixNano=null,s.prototype.attributes=Vs.emptyArray,s.prototype.droppedAttributesCount=null,s.prototype.events=Vs.emptyArray,s.prototype.droppedEventsCount=null,s.prototype.links=Vs.emptyArray,s.prototype.droppedLinksCount=null,s.prototype.status=null,s.create=function(e){return new s(e)},s.encode=function(e,t){if(t=t||Ms.create(),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(10).bytes(e.traceId),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(18).bytes(e.spanId),null!=e.traceState&&Object.hasOwnProperty.call(e,"traceState")&&t.uint32(26).string(e.traceState),null!=e.parentSpanId&&Object.hasOwnProperty.call(e,"parentSpanId")&&t.uint32(34).bytes(e.parentSpanId),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(42).string(e.name),null!=e.kind&&Object.hasOwnProperty.call(e,"kind")&&t.uint32(48).int32(e.kind),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(57).fixed64(e.startTimeUnixNano),null!=e.endTimeUnixNano&&Object.hasOwnProperty.call(e,"endTimeUnixNano")&&t.uint32(65).fixed64(e.endTimeUnixNano),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Bs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(74).fork()).ldelim();if(null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(80).uint32(e.droppedAttributesCount),null!=e.events&&e.events.length)for(r=0;r<e.events.length;++r)Bs.opentelemetry.proto.trace.v1.Span.Event.encode(e.events[r],t.uint32(90).fork()).ldelim();if(null!=e.droppedEventsCount&&Object.hasOwnProperty.call(e,"droppedEventsCount")&&t.uint32(96).uint32(e.droppedEventsCount),null!=e.links&&e.links.length)for(r=0;r<e.links.length;++r)Bs.opentelemetry.proto.trace.v1.Span.Link.encode(e.links[r],t.uint32(106).fork()).ldelim();return null!=e.droppedLinksCount&&Object.hasOwnProperty.call(e,"droppedLinksCount")&&t.uint32(112).uint32(e.droppedLinksCount),null!=e.status&&Object.hasOwnProperty.call(e,"status")&&Bs.opentelemetry.proto.trace.v1.Status.encode(e.status,t.uint32(122).fork()).ldelim(),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(133).fixed32(e.flags),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.trace.v1.Span;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.traceId=e.bytes();break;case 2:o.spanId=e.bytes();break;case 3:o.traceState=e.string();break;case 4:o.parentSpanId=e.bytes();break;case 16:o.flags=e.fixed32();break;case 5:o.name=e.string();break;case 6:o.kind=e.int32();break;case 7:o.startTimeUnixNano=e.fixed64();break;case 8:o.endTimeUnixNano=e.fixed64();break;case 9:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Bs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 10:o.droppedAttributesCount=e.uint32();break;case 11:o.events&&o.events.length||(o.events=[]),o.events.push(Bs.opentelemetry.proto.trace.v1.Span.Event.decode(e,e.uint32()));break;case 12:o.droppedEventsCount=e.uint32();break;case 13:o.links&&o.links.length||(o.links=[]),o.links.push(Bs.opentelemetry.proto.trace.v1.Span.Link.decode(e,e.uint32()));break;case 14:o.droppedLinksCount=e.uint32();break;case 15:o.status=Bs.opentelemetry.proto.trace.v1.Status.decode(e,e.uint32());break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||Vs.isString(e.traceId)))return"traceId: buffer expected";if(null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||Vs.isString(e.spanId)))return"spanId: buffer expected";if(null!=e.traceState&&e.hasOwnProperty("traceState")&&!Vs.isString(e.traceState))return"traceState: string expected";if(null!=e.parentSpanId&&e.hasOwnProperty("parentSpanId")&&!(e.parentSpanId&&"number"==typeof e.parentSpanId.length||Vs.isString(e.parentSpanId)))return"parentSpanId: buffer expected";if(null!=e.flags&&e.hasOwnProperty("flags")&&!Vs.isInteger(e.flags))return"flags: integer expected";if(null!=e.name&&e.hasOwnProperty("name")&&!Vs.isString(e.name))return"name: string expected";if(null!=e.kind&&e.hasOwnProperty("kind"))switch(e.kind){default:return"kind: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(Vs.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&Vs.isInteger(e.startTimeUnixNano.low)&&Vs.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.endTimeUnixNano&&e.hasOwnProperty("endTimeUnixNano")&&!(Vs.isInteger(e.endTimeUnixNano)||e.endTimeUnixNano&&Vs.isInteger(e.endTimeUnixNano.low)&&Vs.isInteger(e.endTimeUnixNano.high)))return"endTimeUnixNano: integer|Long expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=Bs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Vs.isInteger(e.droppedAttributesCount))return"droppedAttributesCount: integer expected";if(null!=e.events&&e.hasOwnProperty("events")){if(!Array.isArray(e.events))return"events: array expected";for(t=0;t<e.events.length;++t)if(r=Bs.opentelemetry.proto.trace.v1.Span.Event.verify(e.events[t]))return"events."+r}if(null!=e.droppedEventsCount&&e.hasOwnProperty("droppedEventsCount")&&!Vs.isInteger(e.droppedEventsCount))return"droppedEventsCount: integer expected";if(null!=e.links&&e.hasOwnProperty("links")){if(!Array.isArray(e.links))return"links: array expected";for(t=0;t<e.links.length;++t)if(r=Bs.opentelemetry.proto.trace.v1.Span.Link.verify(e.links[t]))return"links."+r}return null!=e.droppedLinksCount&&e.hasOwnProperty("droppedLinksCount")&&!Vs.isInteger(e.droppedLinksCount)?"droppedLinksCount: integer expected":null!=e.status&&e.hasOwnProperty("status")&&(r=Bs.opentelemetry.proto.trace.v1.Status.verify(e.status))?"status."+r:null;var r},s.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.trace.v1.Span)return e;var t=new Bs.opentelemetry.proto.trace.v1.Span;switch(null!=e.traceId&&("string"==typeof e.traceId?Vs.base64.decode(e.traceId,t.traceId=Vs.newBuffer(Vs.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),null!=e.spanId&&("string"==typeof e.spanId?Vs.base64.decode(e.spanId,t.spanId=Vs.newBuffer(Vs.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.traceState&&(t.traceState=String(e.traceState)),null!=e.parentSpanId&&("string"==typeof e.parentSpanId?Vs.base64.decode(e.parentSpanId,t.parentSpanId=Vs.newBuffer(Vs.base64.length(e.parentSpanId)),0):0<=e.parentSpanId.length&&(t.parentSpanId=e.parentSpanId)),null!=e.flags&&(t.flags=e.flags>>>0),null!=e.name&&(t.name=String(e.name)),e.kind){default:"number"==typeof e.kind&&(t.kind=e.kind);break;case"SPAN_KIND_UNSPECIFIED":case 0:t.kind=0;break;case"SPAN_KIND_INTERNAL":case 1:t.kind=1;break;case"SPAN_KIND_SERVER":case 2:t.kind=2;break;case"SPAN_KIND_CLIENT":case 3:t.kind=3;break;case"SPAN_KIND_PRODUCER":case 4:t.kind=4;break;case"SPAN_KIND_CONSUMER":case 5:t.kind=5}if(null!=e.startTimeUnixNano&&(Vs.Long?(t.startTimeUnixNano=Vs.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new Vs.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.endTimeUnixNano&&(Vs.Long?(t.endTimeUnixNano=Vs.Long.fromValue(e.endTimeUnixNano)).unsigned=!1:"string"==typeof e.endTimeUnixNano?t.endTimeUnixNano=parseInt(e.endTimeUnixNano,10):"number"==typeof e.endTimeUnixNano?t.endTimeUnixNano=e.endTimeUnixNano:"object"==typeof e.endTimeUnixNano&&(t.endTimeUnixNano=new Vs.LongBits(e.endTimeUnixNano.low>>>0,e.endTimeUnixNano.high>>>0).toNumber())),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: object expected");t.attributes[r]=Bs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),e.events){if(!Array.isArray(e.events))throw TypeError(".opentelemetry.proto.trace.v1.Span.events: array expected");for(t.events=[],r=0;r<e.events.length;++r){if("object"!=typeof e.events[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.events: object expected");t.events[r]=Bs.opentelemetry.proto.trace.v1.Span.Event.fromObject(e.events[r])}}if(null!=e.droppedEventsCount&&(t.droppedEventsCount=e.droppedEventsCount>>>0),e.links){if(!Array.isArray(e.links))throw TypeError(".opentelemetry.proto.trace.v1.Span.links: array expected");for(t.links=[],r=0;r<e.links.length;++r){if("object"!=typeof e.links[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.links: object expected");t.links[r]=Bs.opentelemetry.proto.trace.v1.Span.Link.fromObject(e.links[r])}}if(null!=e.droppedLinksCount&&(t.droppedLinksCount=e.droppedLinksCount>>>0),null!=e.status){if("object"!=typeof e.status)throw TypeError(".opentelemetry.proto.trace.v1.Span.status: object expected");t.status=Bs.opentelemetry.proto.trace.v1.Status.fromObject(e.status)}return t},s.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[],n.events=[],n.links=[]),t.defaults&&(t.bytes===String?n.traceId="":(n.traceId=[],t.bytes!==Array&&(n.traceId=Vs.newBuffer(n.traceId))),t.bytes===String?n.spanId="":(n.spanId=[],t.bytes!==Array&&(n.spanId=Vs.newBuffer(n.spanId))),n.traceState="",t.bytes===String?n.parentSpanId="":(n.parentSpanId=[],t.bytes!==Array&&(n.parentSpanId=Vs.newBuffer(n.parentSpanId))),n.name="",n.kind=t.enums===String?"SPAN_KIND_UNSPECIFIED":0,Vs.Long?(r=new Vs.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,Vs.Long?(r=new Vs.Long(0,0,!1),n.endTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.endTimeUnixNano=t.longs===String?"0":0,n.droppedAttributesCount=0,n.droppedEventsCount=0,n.droppedLinksCount=0,n.status=null,n.flags=0),null!=e.traceId&&e.hasOwnProperty("traceId")&&(n.traceId=t.bytes===String?Vs.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.spanId&&e.hasOwnProperty("spanId")&&(n.spanId=t.bytes===String?Vs.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.traceState&&e.hasOwnProperty("traceState")&&(n.traceState=e.traceState),null!=e.parentSpanId&&e.hasOwnProperty("parentSpanId")&&(n.parentSpanId=t.bytes===String?Vs.base64.encode(e.parentSpanId,0,e.parentSpanId.length):t.bytes===Array?Array.prototype.slice.call(e.parentSpanId):e.parentSpanId),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.kind&&e.hasOwnProperty("kind")&&(n.kind=t.enums!==String||void 0===Bs.opentelemetry.proto.trace.v1.Span.SpanKind[e.kind]?e.kind:Bs.opentelemetry.proto.trace.v1.Span.SpanKind[e.kind]),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?Vs.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new Vs.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.endTimeUnixNano&&e.hasOwnProperty("endTimeUnixNano")&&("number"==typeof e.endTimeUnixNano?n.endTimeUnixNano=t.longs===String?String(e.endTimeUnixNano):e.endTimeUnixNano:n.endTimeUnixNano=t.longs===String?Vs.Long.prototype.toString.call(e.endTimeUnixNano):t.longs===Number?new Vs.LongBits(e.endTimeUnixNano.low>>>0,e.endTimeUnixNano.high>>>0).toNumber():e.endTimeUnixNano),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=Bs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(n.droppedAttributesCount=e.droppedAttributesCount),e.events&&e.events.length)for(n.events=[],o=0;o<e.events.length;++o)n.events[o]=Bs.opentelemetry.proto.trace.v1.Span.Event.toObject(e.events[o],t);if(null!=e.droppedEventsCount&&e.hasOwnProperty("droppedEventsCount")&&(n.droppedEventsCount=e.droppedEventsCount),e.links&&e.links.length)for(n.links=[],o=0;o<e.links.length;++o)n.links[o]=Bs.opentelemetry.proto.trace.v1.Span.Link.toObject(e.links[o],t);return null!=e.droppedLinksCount&&e.hasOwnProperty("droppedLinksCount")&&(n.droppedLinksCount=e.droppedLinksCount),null!=e.status&&e.hasOwnProperty("status")&&(n.status=Bs.opentelemetry.proto.trace.v1.Status.toObject(e.status,t)),null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),n},s.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Span"},s.SpanKind=(e={},(t=Object.create(e))[e[0]="SPAN_KIND_UNSPECIFIED"]=0,t[e[1]="SPAN_KIND_INTERNAL"]=1,t[e[2]="SPAN_KIND_SERVER"]=2,t[e[3]="SPAN_KIND_CLIENT"]=3,t[e[4]="SPAN_KIND_PRODUCER"]=4,t[e[5]="SPAN_KIND_CONSUMER"]=5,t),s.Event=(a.prototype.timeUnixNano=null,a.prototype.name=null,a.prototype.attributes=Vs.emptyArray,a.prototype.droppedAttributesCount=null,a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Ms.create(),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(9).fixed64(e.timeUnixNano),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(18).string(e.name),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Bs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(26).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(32).uint32(e.droppedAttributesCount),t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.trace.v1.Span.Event;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.timeUnixNano=e.fixed64();break;case 2:o.name=e.string();break;case 3:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Bs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 4:o.droppedAttributesCount=e.uint32();break;default:e.skipType(7&s)}}return o},a.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Vs.isInteger(e.timeUnixNano)||e.timeUnixNano&&Vs.isInteger(e.timeUnixNano.low)&&Vs.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.name&&e.hasOwnProperty("name")&&!Vs.isString(e.name))return"name: string expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t){var r=Bs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]);if(r)return"attributes."+r}}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Vs.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},a.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.trace.v1.Span.Event)return e;var t=new Bs.opentelemetry.proto.trace.v1.Span.Event;if(null!=e.timeUnixNano&&(Vs.Long?(t.timeUnixNano=Vs.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Vs.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.name&&(t.name=String(e.name)),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: object expected");t.attributes[r]=Bs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),t},a.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[]),t.defaults&&(Vs.Long?(r=new Vs.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,n.name="",n.droppedAttributesCount=0),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Vs.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Vs.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=Bs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(n.droppedAttributesCount=e.droppedAttributesCount),n},a.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Span.Event"},a),s.Link=(i.prototype.traceId=null,i.prototype.spanId=null,i.prototype.traceState=null,i.prototype.attributes=Vs.emptyArray,i.prototype.droppedAttributesCount=null,i.prototype.flags=null,i.create=function(e){return new i(e)},i.encode=function(e,t){if(t=t||Ms.create(),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(10).bytes(e.traceId),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(18).bytes(e.spanId),null!=e.traceState&&Object.hasOwnProperty.call(e,"traceState")&&t.uint32(26).string(e.traceState),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Bs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(34).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(40).uint32(e.droppedAttributesCount),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(53).fixed32(e.flags),t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.trace.v1.Span.Link;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.traceId=e.bytes();break;case 2:o.spanId=e.bytes();break;case 3:o.traceState=e.string();break;case 4:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Bs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 5:o.droppedAttributesCount=e.uint32();break;case 6:o.flags=e.fixed32();break;default:e.skipType(7&s)}}return o},i.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},i.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||Vs.isString(e.traceId)))return"traceId: buffer expected";if(null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||Vs.isString(e.spanId)))return"spanId: buffer expected";if(null!=e.traceState&&e.hasOwnProperty("traceState")&&!Vs.isString(e.traceState))return"traceState: string expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t){var r=Bs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]);if(r)return"attributes."+r}}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Vs.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null!=e.flags&&e.hasOwnProperty("flags")&&!Vs.isInteger(e.flags)?"flags: integer expected":null},i.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.trace.v1.Span.Link)return e;var t=new Bs.opentelemetry.proto.trace.v1.Span.Link;if(null!=e.traceId&&("string"==typeof e.traceId?Vs.base64.decode(e.traceId,t.traceId=Vs.newBuffer(Vs.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),null!=e.spanId&&("string"==typeof e.spanId?Vs.base64.decode(e.spanId,t.spanId=Vs.newBuffer(Vs.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.traceState&&(t.traceState=String(e.traceState)),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: object expected");t.attributes[r]=Bs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),null!=e.flags&&(t.flags=e.flags>>>0),t},i.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.attributes=[]),t.defaults&&(t.bytes===String?r.traceId="":(r.traceId=[],t.bytes!==Array&&(r.traceId=Vs.newBuffer(r.traceId))),t.bytes===String?r.spanId="":(r.spanId=[],t.bytes!==Array&&(r.spanId=Vs.newBuffer(r.spanId))),r.traceState="",r.droppedAttributesCount=0,r.flags=0),null!=e.traceId&&e.hasOwnProperty("traceId")&&(r.traceId=t.bytes===String?Vs.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.spanId&&e.hasOwnProperty("spanId")&&(r.spanId=t.bytes===String?Vs.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.traceState&&e.hasOwnProperty("traceState")&&(r.traceState=e.traceState),e.attributes&&e.attributes.length){r.attributes=[];for(var n=0;n<e.attributes.length;++n)r.attributes[n]=Bs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[n],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(r.droppedAttributesCount=e.droppedAttributesCount),null!=e.flags&&e.hasOwnProperty("flags")&&(r.flags=e.flags),r},i.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Span.Link"},i),s),r.Status=(o.prototype.message=null,o.prototype.code=null,o.create=function(e){return new o(e)},o.encode=function(e,t){return t=t||Ms.create(),null!=e.message&&Object.hasOwnProperty.call(e,"message")&&t.uint32(18).string(e.message),null!=e.code&&Object.hasOwnProperty.call(e,"code")&&t.uint32(24).int32(e.code),t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.trace.v1.Status;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 2:o.message=e.string();break;case 3:o.code=e.int32();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.message&&e.hasOwnProperty("message")&&!Vs.isString(e.message))return"message: string expected";if(null!=e.code&&e.hasOwnProperty("code"))switch(e.code){default:return"code: enum value expected";case 0:case 1:case 2:}return null},o.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.trace.v1.Status)return e;var t=new Bs.opentelemetry.proto.trace.v1.Status;switch(null!=e.message&&(t.message=String(e.message)),e.code){default:"number"==typeof e.code&&(t.code=e.code);break;case"STATUS_CODE_UNSET":case 0:t.code=0;break;case"STATUS_CODE_OK":case 1:t.code=1;break;case"STATUS_CODE_ERROR":case 2:t.code=2}return t},o.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.message="",r.code=t.enums===String?"STATUS_CODE_UNSET":0),null!=e.message&&e.hasOwnProperty("message")&&(r.message=e.message),null!=e.code&&e.hasOwnProperty("code")&&(r.code=t.enums!==String||void 0===Bs.opentelemetry.proto.trace.v1.Status.StatusCode[e.code]?e.code:Bs.opentelemetry.proto.trace.v1.Status.StatusCode[e.code]),r},o.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Status"},o.StatusCode=(e={},(t=Object.create(e))[e[0]="STATUS_CODE_UNSET"]=0,t[e[1]="STATUS_CODE_OK"]=1,t[e[2]="STATUS_CODE_ERROR"]=2,t),o),r.SpanFlags=(e={},(t=Object.create(e))[e[0]="SPAN_FLAGS_DO_NOT_USE"]=0,t[e[255]="SPAN_FLAGS_TRACE_FLAGS_MASK"]=255,t[e[256]="SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK"]=256,t[e[512]="SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK"]=512,t),r),n;function o(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(this.attributes=[],this.events=[],this.links=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function u(e){if(this.spans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function l(e){if(this.scopeSpans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function c(e){if(this.resourceSpans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),ks.collector=((Us={}).trace=(()=>{var e,t={};return t.v1=((e={}).TraceService=(((s.prototype=Object.create(js.rpc.Service.prototype)).constructor=s).create=function(e,t,r){return new this(e,t,r)},Object.defineProperty(s.prototype.export=function e(t,r){return this.rpcCall(e,Bs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest,Bs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,t,r)},"name",{value:"Export"}),s),e.ExportTraceServiceRequest=(o.prototype.resourceSpans=Vs.emptyArray,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ms.create(),null!=e.resourceSpans&&e.resourceSpans.length)for(var r=0;r<e.resourceSpans.length;++r)Bs.opentelemetry.proto.trace.v1.ResourceSpans.encode(e.resourceSpans[r],t.uint32(10).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceSpans&&o.resourceSpans.length||(o.resourceSpans=[]),o.resourceSpans.push(Bs.opentelemetry.proto.trace.v1.ResourceSpans.decode(e,e.uint32()))):e.skipType(7&s)}return o},o.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceSpans&&e.hasOwnProperty("resourceSpans")){if(!Array.isArray(e.resourceSpans))return"resourceSpans: array expected";for(var t=0;t<e.resourceSpans.length;++t){var r=Bs.opentelemetry.proto.trace.v1.ResourceSpans.verify(e.resourceSpans[t]);if(r)return"resourceSpans."+r}}return null},o.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest)return e;var t=new Bs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;if(e.resourceSpans){if(!Array.isArray(e.resourceSpans))throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: array expected");t.resourceSpans=[];for(var r=0;r<e.resourceSpans.length;++r){if("object"!=typeof e.resourceSpans[r])throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: object expected");t.resourceSpans[r]=Bs.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(e.resourceSpans[r])}}return t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceSpans=[]),e.resourceSpans&&e.resourceSpans.length){r.resourceSpans=[];for(var n=0;n<e.resourceSpans.length;++n)r.resourceSpans[n]=Bs.opentelemetry.proto.trace.v1.ResourceSpans.toObject(e.resourceSpans[n],t)}return r},o.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"},o),e.ExportTraceServiceResponse=(n.prototype.partialSuccess=null,n.create=function(e){return new n(e)},n.encode=function(e,t){return t=t||Ms.create(),null!=e.partialSuccess&&Object.hasOwnProperty.call(e,"partialSuccess")&&Bs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.encode(e.partialSuccess,t.uint32(10).fork()).ldelim(),t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?o.partialSuccess=Bs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.decode(e,e.uint32()):e.skipType(7&s)}return o},n.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")){e=Bs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.verify(e.partialSuccess);if(e)return"partialSuccess."+e}return null},n.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse)return e;var t=new Bs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;if(null!=e.partialSuccess){if("object"!=typeof e.partialSuccess)throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.partialSuccess: object expected");t.partialSuccess=Bs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.fromObject(e.partialSuccess)}return t},n.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.partialSuccess=null),null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")&&(r.partialSuccess=Bs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.toObject(e.partialSuccess,t)),r},n.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse"},n),e.ExportTracePartialSuccess=(r.prototype.rejectedSpans=null,r.prototype.errorMessage=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t=t||Ms.create(),null!=e.rejectedSpans&&Object.hasOwnProperty.call(e,"rejectedSpans")&&t.uint32(8).int64(e.rejectedSpans),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},r.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},r.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.rejectedSpans=e.int64();break;case 2:o.errorMessage=e.string();break;default:e.skipType(7&s)}}return o},r.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},r.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.rejectedSpans&&e.hasOwnProperty("rejectedSpans")&&!(Vs.isInteger(e.rejectedSpans)||e.rejectedSpans&&Vs.isInteger(e.rejectedSpans.low)&&Vs.isInteger(e.rejectedSpans.high))?"rejectedSpans: integer|Long expected":null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&!Vs.isString(e.errorMessage)?"errorMessage: string expected":null},r.fromObject=function(e){var t;return e instanceof Bs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess?e:(t=new Bs.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess,null!=e.rejectedSpans&&(Vs.Long?(t.rejectedSpans=Vs.Long.fromValue(e.rejectedSpans)).unsigned=!1:"string"==typeof e.rejectedSpans?t.rejectedSpans=parseInt(e.rejectedSpans,10):"number"==typeof e.rejectedSpans?t.rejectedSpans=e.rejectedSpans:"object"==typeof e.rejectedSpans&&(t.rejectedSpans=new Vs.LongBits(e.rejectedSpans.low>>>0,e.rejectedSpans.high>>>0).toNumber())),null!=e.errorMessage&&(t.errorMessage=String(e.errorMessage)),t)},r.toObject=function(e,t){var r,n={};return(t=t||{}).defaults&&(Vs.Long?(r=new Vs.Long(0,0,!1),n.rejectedSpans=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.rejectedSpans=t.longs===String?"0":0,n.errorMessage=""),null!=e.rejectedSpans&&e.hasOwnProperty("rejectedSpans")&&("number"==typeof e.rejectedSpans?n.rejectedSpans=t.longs===String?String(e.rejectedSpans):e.rejectedSpans:n.rejectedSpans=t.longs===String?Vs.Long.prototype.toString.call(e.rejectedSpans):t.longs===Number?new Vs.LongBits(e.rejectedSpans.low>>>0,e.rejectedSpans.high>>>0).toNumber():e.rejectedSpans),null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&(n.errorMessage=e.errorMessage),n},r.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},r.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess"},r),e),t;function r(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.resourceSpans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e,t,r){js.rpc.Service.call(this,e,t,r)}})(),Us.metrics=(()=>{var e,t={};return t.v1=((e={}).MetricsService=(((s.prototype=Object.create(js.rpc.Service.prototype)).constructor=s).create=function(e,t,r){return new this(e,t,r)},Object.defineProperty(s.prototype.export=function e(t,r){return this.rpcCall(e,Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,t,r)},"name",{value:"Export"}),s),e.ExportMetricsServiceRequest=(o.prototype.resourceMetrics=Vs.emptyArray,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ms.create(),null!=e.resourceMetrics&&e.resourceMetrics.length)for(var r=0;r<e.resourceMetrics.length;++r)Bs.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(e.resourceMetrics[r],t.uint32(10).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceMetrics&&o.resourceMetrics.length||(o.resourceMetrics=[]),o.resourceMetrics.push(Bs.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(e,e.uint32()))):e.skipType(7&s)}return o},o.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceMetrics&&e.hasOwnProperty("resourceMetrics")){if(!Array.isArray(e.resourceMetrics))return"resourceMetrics: array expected";for(var t=0;t<e.resourceMetrics.length;++t){var r=Bs.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(e.resourceMetrics[t]);if(r)return"resourceMetrics."+r}}return null},o.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest)return e;var t=new Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;if(e.resourceMetrics){if(!Array.isArray(e.resourceMetrics))throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: array expected");t.resourceMetrics=[];for(var r=0;r<e.resourceMetrics.length;++r){if("object"!=typeof e.resourceMetrics[r])throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: object expected");t.resourceMetrics[r]=Bs.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(e.resourceMetrics[r])}}return t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceMetrics=[]),e.resourceMetrics&&e.resourceMetrics.length){r.resourceMetrics=[];for(var n=0;n<e.resourceMetrics.length;++n)r.resourceMetrics[n]=Bs.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(e.resourceMetrics[n],t)}return r},o.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest"},o),e.ExportMetricsServiceResponse=(n.prototype.partialSuccess=null,n.create=function(e){return new n(e)},n.encode=function(e,t){return t=t||Ms.create(),null!=e.partialSuccess&&Object.hasOwnProperty.call(e,"partialSuccess")&&Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.encode(e.partialSuccess,t.uint32(10).fork()).ldelim(),t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?o.partialSuccess=Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.decode(e,e.uint32()):e.skipType(7&s)}return o},n.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")){e=Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.verify(e.partialSuccess);if(e)return"partialSuccess."+e}return null},n.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse)return e;var t=new Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;if(null!=e.partialSuccess){if("object"!=typeof e.partialSuccess)throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse.partialSuccess: object expected");t.partialSuccess=Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.fromObject(e.partialSuccess)}return t},n.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.partialSuccess=null),null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")&&(r.partialSuccess=Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.toObject(e.partialSuccess,t)),r},n.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse"},n),e.ExportMetricsPartialSuccess=(r.prototype.rejectedDataPoints=null,r.prototype.errorMessage=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t=t||Ms.create(),null!=e.rejectedDataPoints&&Object.hasOwnProperty.call(e,"rejectedDataPoints")&&t.uint32(8).int64(e.rejectedDataPoints),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},r.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},r.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.rejectedDataPoints=e.int64();break;case 2:o.errorMessage=e.string();break;default:e.skipType(7&s)}}return o},r.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},r.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.rejectedDataPoints&&e.hasOwnProperty("rejectedDataPoints")&&!(Vs.isInteger(e.rejectedDataPoints)||e.rejectedDataPoints&&Vs.isInteger(e.rejectedDataPoints.low)&&Vs.isInteger(e.rejectedDataPoints.high))?"rejectedDataPoints: integer|Long expected":null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&!Vs.isString(e.errorMessage)?"errorMessage: string expected":null},r.fromObject=function(e){var t;return e instanceof Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess?e:(t=new Bs.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess,null!=e.rejectedDataPoints&&(Vs.Long?(t.rejectedDataPoints=Vs.Long.fromValue(e.rejectedDataPoints)).unsigned=!1:"string"==typeof e.rejectedDataPoints?t.rejectedDataPoints=parseInt(e.rejectedDataPoints,10):"number"==typeof e.rejectedDataPoints?t.rejectedDataPoints=e.rejectedDataPoints:"object"==typeof e.rejectedDataPoints&&(t.rejectedDataPoints=new Vs.LongBits(e.rejectedDataPoints.low>>>0,e.rejectedDataPoints.high>>>0).toNumber())),null!=e.errorMessage&&(t.errorMessage=String(e.errorMessage)),t)},r.toObject=function(e,t){var r,n={};return(t=t||{}).defaults&&(Vs.Long?(r=new Vs.Long(0,0,!1),n.rejectedDataPoints=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.rejectedDataPoints=t.longs===String?"0":0,n.errorMessage=""),null!=e.rejectedDataPoints&&e.hasOwnProperty("rejectedDataPoints")&&("number"==typeof e.rejectedDataPoints?n.rejectedDataPoints=t.longs===String?String(e.rejectedDataPoints):e.rejectedDataPoints:n.rejectedDataPoints=t.longs===String?Vs.Long.prototype.toString.call(e.rejectedDataPoints):t.longs===Number?new Vs.LongBits(e.rejectedDataPoints.low>>>0,e.rejectedDataPoints.high>>>0).toNumber():e.rejectedDataPoints),null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&(n.errorMessage=e.errorMessage),n},r.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},r.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess"},r),e),t;function r(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.resourceMetrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e,t,r){js.rpc.Service.call(this,e,t,r)}})(),Us.logs=(()=>{var e,t={};return t.v1=((e={}).LogsService=(((s.prototype=Object.create(js.rpc.Service.prototype)).constructor=s).create=function(e,t,r){return new this(e,t,r)},Object.defineProperty(s.prototype.export=function e(t,r){return this.rpcCall(e,Bs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,Bs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,t,r)},"name",{value:"Export"}),s),e.ExportLogsServiceRequest=(o.prototype.resourceLogs=Vs.emptyArray,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ms.create(),null!=e.resourceLogs&&e.resourceLogs.length)for(var r=0;r<e.resourceLogs.length;++r)Bs.opentelemetry.proto.logs.v1.ResourceLogs.encode(e.resourceLogs[r],t.uint32(10).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceLogs&&o.resourceLogs.length||(o.resourceLogs=[]),o.resourceLogs.push(Bs.opentelemetry.proto.logs.v1.ResourceLogs.decode(e,e.uint32()))):e.skipType(7&s)}return o},o.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceLogs&&e.hasOwnProperty("resourceLogs")){if(!Array.isArray(e.resourceLogs))return"resourceLogs: array expected";for(var t=0;t<e.resourceLogs.length;++t){var r=Bs.opentelemetry.proto.logs.v1.ResourceLogs.verify(e.resourceLogs[t]);if(r)return"resourceLogs."+r}}return null},o.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest)return e;var t=new Bs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;if(e.resourceLogs){if(!Array.isArray(e.resourceLogs))throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: array expected");t.resourceLogs=[];for(var r=0;r<e.resourceLogs.length;++r){if("object"!=typeof e.resourceLogs[r])throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: object expected");t.resourceLogs[r]=Bs.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(e.resourceLogs[r])}}return t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceLogs=[]),e.resourceLogs&&e.resourceLogs.length){r.resourceLogs=[];for(var n=0;n<e.resourceLogs.length;++n)r.resourceLogs[n]=Bs.opentelemetry.proto.logs.v1.ResourceLogs.toObject(e.resourceLogs[n],t)}return r},o.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest"},o),e.ExportLogsServiceResponse=(n.prototype.partialSuccess=null,n.create=function(e){return new n(e)},n.encode=function(e,t){return t=t||Ms.create(),null!=e.partialSuccess&&Object.hasOwnProperty.call(e,"partialSuccess")&&Bs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.encode(e.partialSuccess,t.uint32(10).fork()).ldelim(),t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?o.partialSuccess=Bs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.decode(e,e.uint32()):e.skipType(7&s)}return o},n.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")){e=Bs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.verify(e.partialSuccess);if(e)return"partialSuccess."+e}return null},n.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse)return e;var t=new Bs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;if(null!=e.partialSuccess){if("object"!=typeof e.partialSuccess)throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.partialSuccess: object expected");t.partialSuccess=Bs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.fromObject(e.partialSuccess)}return t},n.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.partialSuccess=null),null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")&&(r.partialSuccess=Bs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.toObject(e.partialSuccess,t)),r},n.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse"},n),e.ExportLogsPartialSuccess=(r.prototype.rejectedLogRecords=null,r.prototype.errorMessage=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t=t||Ms.create(),null!=e.rejectedLogRecords&&Object.hasOwnProperty.call(e,"rejectedLogRecords")&&t.uint32(8).int64(e.rejectedLogRecords),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},r.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},r.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.rejectedLogRecords=e.int64();break;case 2:o.errorMessage=e.string();break;default:e.skipType(7&s)}}return o},r.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},r.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.rejectedLogRecords&&e.hasOwnProperty("rejectedLogRecords")&&!(Vs.isInteger(e.rejectedLogRecords)||e.rejectedLogRecords&&Vs.isInteger(e.rejectedLogRecords.low)&&Vs.isInteger(e.rejectedLogRecords.high))?"rejectedLogRecords: integer|Long expected":null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&!Vs.isString(e.errorMessage)?"errorMessage: string expected":null},r.fromObject=function(e){var t;return e instanceof Bs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess?e:(t=new Bs.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess,null!=e.rejectedLogRecords&&(Vs.Long?(t.rejectedLogRecords=Vs.Long.fromValue(e.rejectedLogRecords)).unsigned=!1:"string"==typeof e.rejectedLogRecords?t.rejectedLogRecords=parseInt(e.rejectedLogRecords,10):"number"==typeof e.rejectedLogRecords?t.rejectedLogRecords=e.rejectedLogRecords:"object"==typeof e.rejectedLogRecords&&(t.rejectedLogRecords=new Vs.LongBits(e.rejectedLogRecords.low>>>0,e.rejectedLogRecords.high>>>0).toNumber())),null!=e.errorMessage&&(t.errorMessage=String(e.errorMessage)),t)},r.toObject=function(e,t){var r,n={};return(t=t||{}).defaults&&(Vs.Long?(r=new Vs.Long(0,0,!1),n.rejectedLogRecords=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.rejectedLogRecords=t.longs===String?"0":0,n.errorMessage=""),null!=e.rejectedLogRecords&&e.hasOwnProperty("rejectedLogRecords")&&("number"==typeof e.rejectedLogRecords?n.rejectedLogRecords=t.longs===String?String(e.rejectedLogRecords):e.rejectedLogRecords:n.rejectedLogRecords=t.longs===String?Vs.Long.prototype.toString.call(e.rejectedLogRecords):t.longs===Number?new Vs.LongBits(e.rejectedLogRecords.low>>>0,e.rejectedLogRecords.high>>>0).toNumber():e.rejectedLogRecords),null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&(n.errorMessage=e.errorMessage),n},r.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},r.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess"},r),e),t;function r(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.resourceLogs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e,t,r){js.rpc.Service.call(this,e,t,r)}})(),Us),ks.metrics=(()=>{var e,t,r,n={};return n.v1=((r={}).MetricsData=(v.prototype.resourceMetrics=Vs.emptyArray,v.create=function(e){return new v(e)},v.encode=function(e,t){if(t=t||Ms.create(),null!=e.resourceMetrics&&e.resourceMetrics.length)for(var r=0;r<e.resourceMetrics.length;++r)Bs.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(e.resourceMetrics[r],t.uint32(10).fork()).ldelim();return t},v.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},v.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.MetricsData;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceMetrics&&o.resourceMetrics.length||(o.resourceMetrics=[]),o.resourceMetrics.push(Bs.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(e,e.uint32()))):e.skipType(7&s)}return o},v.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},v.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceMetrics&&e.hasOwnProperty("resourceMetrics")){if(!Array.isArray(e.resourceMetrics))return"resourceMetrics: array expected";for(var t=0;t<e.resourceMetrics.length;++t){var r=Bs.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(e.resourceMetrics[t]);if(r)return"resourceMetrics."+r}}return null},v.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.metrics.v1.MetricsData)return e;var t=new Bs.opentelemetry.proto.metrics.v1.MetricsData;if(e.resourceMetrics){if(!Array.isArray(e.resourceMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: array expected");t.resourceMetrics=[];for(var r=0;r<e.resourceMetrics.length;++r){if("object"!=typeof e.resourceMetrics[r])throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: object expected");t.resourceMetrics[r]=Bs.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(e.resourceMetrics[r])}}return t},v.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceMetrics=[]),e.resourceMetrics&&e.resourceMetrics.length){r.resourceMetrics=[];for(var n=0;n<e.resourceMetrics.length;++n)r.resourceMetrics[n]=Bs.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(e.resourceMetrics[n],t)}return r},v.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},v.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.MetricsData"},v),r.ResourceMetrics=(_.prototype.resource=null,_.prototype.scopeMetrics=Vs.emptyArray,_.prototype.schemaUrl=null,_.create=function(e){return new _(e)},_.encode=function(e,t){if(t=t||Ms.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&Bs.opentelemetry.proto.resource.v1.Resource.encode(e.resource,t.uint32(10).fork()).ldelim(),null!=e.scopeMetrics&&e.scopeMetrics.length)for(var r=0;r<e.scopeMetrics.length;++r)Bs.opentelemetry.proto.metrics.v1.ScopeMetrics.encode(e.scopeMetrics[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},_.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},_.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.ResourceMetrics;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.resource=Bs.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break;case 2:o.scopeMetrics&&o.scopeMetrics.length||(o.scopeMetrics=[]),o.scopeMetrics.push(Bs.opentelemetry.proto.metrics.v1.ScopeMetrics.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},_.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},_.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&(t=Bs.opentelemetry.proto.resource.v1.Resource.verify(e.resource)))return"resource."+t;if(null!=e.scopeMetrics&&e.hasOwnProperty("scopeMetrics")){if(!Array.isArray(e.scopeMetrics))return"scopeMetrics: array expected";for(var t,r=0;r<e.scopeMetrics.length;++r)if(t=Bs.opentelemetry.proto.metrics.v1.ScopeMetrics.verify(e.scopeMetrics[r]))return"scopeMetrics."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Vs.isString(e.schemaUrl)?"schemaUrl: string expected":null},_.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.metrics.v1.ResourceMetrics)return e;var t=new Bs.opentelemetry.proto.metrics.v1.ResourceMetrics;if(null!=e.resource){if("object"!=typeof e.resource)throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.resource: object expected");t.resource=Bs.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeMetrics){if(!Array.isArray(e.scopeMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: array expected");t.scopeMetrics=[];for(var r=0;r<e.scopeMetrics.length;++r){if("object"!=typeof e.scopeMetrics[r])throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: object expected");t.scopeMetrics[r]=Bs.opentelemetry.proto.metrics.v1.ScopeMetrics.fromObject(e.scopeMetrics[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},_.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.scopeMetrics=[]),t.defaults&&(r.resource=null,r.schemaUrl=""),null!=e.resource&&e.hasOwnProperty("resource")&&(r.resource=Bs.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,t)),e.scopeMetrics&&e.scopeMetrics.length){r.scopeMetrics=[];for(var n=0;n<e.scopeMetrics.length;++n)r.scopeMetrics[n]=Bs.opentelemetry.proto.metrics.v1.ScopeMetrics.toObject(e.scopeMetrics[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},_.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},_.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ResourceMetrics"},_),r.ScopeMetrics=(y.prototype.scope=null,y.prototype.metrics=Vs.emptyArray,y.prototype.schemaUrl=null,y.create=function(e){return new y(e)},y.encode=function(e,t){if(t=t||Ms.create(),null!=e.scope&&Object.hasOwnProperty.call(e,"scope")&&Bs.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,t.uint32(10).fork()).ldelim(),null!=e.metrics&&e.metrics.length)for(var r=0;r<e.metrics.length;++r)Bs.opentelemetry.proto.metrics.v1.Metric.encode(e.metrics[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},y.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},y.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.ScopeMetrics;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.scope=Bs.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break;case 2:o.metrics&&o.metrics.length||(o.metrics=[]),o.metrics.push(Bs.opentelemetry.proto.metrics.v1.Metric.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},y.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},y.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.scope&&e.hasOwnProperty("scope")&&(t=Bs.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope)))return"scope."+t;if(null!=e.metrics&&e.hasOwnProperty("metrics")){if(!Array.isArray(e.metrics))return"metrics: array expected";for(var t,r=0;r<e.metrics.length;++r)if(t=Bs.opentelemetry.proto.metrics.v1.Metric.verify(e.metrics[r]))return"metrics."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Vs.isString(e.schemaUrl)?"schemaUrl: string expected":null},y.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.metrics.v1.ScopeMetrics)return e;var t=new Bs.opentelemetry.proto.metrics.v1.ScopeMetrics;if(null!=e.scope){if("object"!=typeof e.scope)throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.scope: object expected");t.scope=Bs.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.metrics){if(!Array.isArray(e.metrics))throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: array expected");t.metrics=[];for(var r=0;r<e.metrics.length;++r){if("object"!=typeof e.metrics[r])throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: object expected");t.metrics[r]=Bs.opentelemetry.proto.metrics.v1.Metric.fromObject(e.metrics[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},y.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.metrics=[]),t.defaults&&(r.scope=null,r.schemaUrl=""),null!=e.scope&&e.hasOwnProperty("scope")&&(r.scope=Bs.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,t)),e.metrics&&e.metrics.length){r.metrics=[];for(var n=0;n<e.metrics.length;++n)r.metrics[n]=Bs.opentelemetry.proto.metrics.v1.Metric.toObject(e.metrics[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},y.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},y.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ScopeMetrics"},y),r.Metric=(g.prototype.name=null,g.prototype.description=null,g.prototype.unit=null,g.prototype.gauge=null,g.prototype.sum=null,g.prototype.histogram=null,g.prototype.exponentialHistogram=null,g.prototype.summary=null,g.prototype.metadata=Vs.emptyArray,Object.defineProperty(g.prototype,"data",{get:Vs.oneOfGetter(t=["gauge","sum","histogram","exponentialHistogram","summary"]),set:Vs.oneOfSetter(t)}),g.create=function(e){return new g(e)},g.encode=function(e,t){if(t=t||Ms.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.description&&Object.hasOwnProperty.call(e,"description")&&t.uint32(18).string(e.description),null!=e.unit&&Object.hasOwnProperty.call(e,"unit")&&t.uint32(26).string(e.unit),null!=e.gauge&&Object.hasOwnProperty.call(e,"gauge")&&Bs.opentelemetry.proto.metrics.v1.Gauge.encode(e.gauge,t.uint32(42).fork()).ldelim(),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&Bs.opentelemetry.proto.metrics.v1.Sum.encode(e.sum,t.uint32(58).fork()).ldelim(),null!=e.histogram&&Object.hasOwnProperty.call(e,"histogram")&&Bs.opentelemetry.proto.metrics.v1.Histogram.encode(e.histogram,t.uint32(74).fork()).ldelim(),null!=e.exponentialHistogram&&Object.hasOwnProperty.call(e,"exponentialHistogram")&&Bs.opentelemetry.proto.metrics.v1.ExponentialHistogram.encode(e.exponentialHistogram,t.uint32(82).fork()).ldelim(),null!=e.summary&&Object.hasOwnProperty.call(e,"summary")&&Bs.opentelemetry.proto.metrics.v1.Summary.encode(e.summary,t.uint32(90).fork()).ldelim(),null!=e.metadata&&e.metadata.length)for(var r=0;r<e.metadata.length;++r)Bs.opentelemetry.proto.common.v1.KeyValue.encode(e.metadata[r],t.uint32(98).fork()).ldelim();return t},g.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},g.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.Metric;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.name=e.string();break;case 2:o.description=e.string();break;case 3:o.unit=e.string();break;case 5:o.gauge=Bs.opentelemetry.proto.metrics.v1.Gauge.decode(e,e.uint32());break;case 7:o.sum=Bs.opentelemetry.proto.metrics.v1.Sum.decode(e,e.uint32());break;case 9:o.histogram=Bs.opentelemetry.proto.metrics.v1.Histogram.decode(e,e.uint32());break;case 10:o.exponentialHistogram=Bs.opentelemetry.proto.metrics.v1.ExponentialHistogram.decode(e,e.uint32());break;case 11:o.summary=Bs.opentelemetry.proto.metrics.v1.Summary.decode(e,e.uint32());break;case 12:o.metadata&&o.metadata.length||(o.metadata=[]),o.metadata.push(Bs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return o},g.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},g.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.name&&e.hasOwnProperty("name")&&!Vs.isString(e.name))return"name: string expected";if(null!=e.description&&e.hasOwnProperty("description")&&!Vs.isString(e.description))return"description: string expected";if(null!=e.unit&&e.hasOwnProperty("unit")&&!Vs.isString(e.unit))return"unit: string expected";if(null!=e.gauge&&e.hasOwnProperty("gauge")&&(t.data=1,r=Bs.opentelemetry.proto.metrics.v1.Gauge.verify(e.gauge)))return"gauge."+r;if(null!=e.sum&&e.hasOwnProperty("sum")){if(1===t.data)return"data: multiple values";if(t.data=1,r=Bs.opentelemetry.proto.metrics.v1.Sum.verify(e.sum))return"sum."+r}if(null!=e.histogram&&e.hasOwnProperty("histogram")){if(1===t.data)return"data: multiple values";if(t.data=1,r=Bs.opentelemetry.proto.metrics.v1.Histogram.verify(e.histogram))return"histogram."+r}if(null!=e.exponentialHistogram&&e.hasOwnProperty("exponentialHistogram")){if(1===t.data)return"data: multiple values";if(t.data=1,r=Bs.opentelemetry.proto.metrics.v1.ExponentialHistogram.verify(e.exponentialHistogram))return"exponentialHistogram."+r}if(null!=e.summary&&e.hasOwnProperty("summary")){if(1===t.data)return"data: multiple values";if(t.data=1,r=Bs.opentelemetry.proto.metrics.v1.Summary.verify(e.summary))return"summary."+r}if(null!=e.metadata&&e.hasOwnProperty("metadata")){if(!Array.isArray(e.metadata))return"metadata: array expected";for(var r,n=0;n<e.metadata.length;++n)if(r=Bs.opentelemetry.proto.common.v1.KeyValue.verify(e.metadata[n]))return"metadata."+r}return null},g.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.metrics.v1.Metric)return e;var t=new Bs.opentelemetry.proto.metrics.v1.Metric;if(null!=e.name&&(t.name=String(e.name)),null!=e.description&&(t.description=String(e.description)),null!=e.unit&&(t.unit=String(e.unit)),null!=e.gauge){if("object"!=typeof e.gauge)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.gauge: object expected");t.gauge=Bs.opentelemetry.proto.metrics.v1.Gauge.fromObject(e.gauge)}if(null!=e.sum){if("object"!=typeof e.sum)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.sum: object expected");t.sum=Bs.opentelemetry.proto.metrics.v1.Sum.fromObject(e.sum)}if(null!=e.histogram){if("object"!=typeof e.histogram)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.histogram: object expected");t.histogram=Bs.opentelemetry.proto.metrics.v1.Histogram.fromObject(e.histogram)}if(null!=e.exponentialHistogram){if("object"!=typeof e.exponentialHistogram)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.exponentialHistogram: object expected");t.exponentialHistogram=Bs.opentelemetry.proto.metrics.v1.ExponentialHistogram.fromObject(e.exponentialHistogram)}if(null!=e.summary){if("object"!=typeof e.summary)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.summary: object expected");t.summary=Bs.opentelemetry.proto.metrics.v1.Summary.fromObject(e.summary)}if(e.metadata){if(!Array.isArray(e.metadata))throw TypeError(".opentelemetry.proto.metrics.v1.Metric.metadata: array expected");t.metadata=[];for(var r=0;r<e.metadata.length;++r){if("object"!=typeof e.metadata[r])throw TypeError(".opentelemetry.proto.metrics.v1.Metric.metadata: object expected");t.metadata[r]=Bs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.metadata[r])}}return t},g.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.metadata=[]),t.defaults&&(r.name="",r.description="",r.unit=""),null!=e.name&&e.hasOwnProperty("name")&&(r.name=e.name),null!=e.description&&e.hasOwnProperty("description")&&(r.description=e.description),null!=e.unit&&e.hasOwnProperty("unit")&&(r.unit=e.unit),null!=e.gauge&&e.hasOwnProperty("gauge")&&(r.gauge=Bs.opentelemetry.proto.metrics.v1.Gauge.toObject(e.gauge,t),t.oneofs)&&(r.data="gauge"),null!=e.sum&&e.hasOwnProperty("sum")&&(r.sum=Bs.opentelemetry.proto.metrics.v1.Sum.toObject(e.sum,t),t.oneofs)&&(r.data="sum"),null!=e.histogram&&e.hasOwnProperty("histogram")&&(r.histogram=Bs.opentelemetry.proto.metrics.v1.Histogram.toObject(e.histogram,t),t.oneofs)&&(r.data="histogram"),null!=e.exponentialHistogram&&e.hasOwnProperty("exponentialHistogram")&&(r.exponentialHistogram=Bs.opentelemetry.proto.metrics.v1.ExponentialHistogram.toObject(e.exponentialHistogram,t),t.oneofs)&&(r.data="exponentialHistogram"),null!=e.summary&&e.hasOwnProperty("summary")&&(r.summary=Bs.opentelemetry.proto.metrics.v1.Summary.toObject(e.summary,t),t.oneofs)&&(r.data="summary"),e.metadata&&e.metadata.length){r.metadata=[];for(var n=0;n<e.metadata.length;++n)r.metadata[n]=Bs.opentelemetry.proto.common.v1.KeyValue.toObject(e.metadata[n],t)}return r},g.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},g.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Metric"},g),r.Gauge=(m.prototype.dataPoints=Vs.emptyArray,m.create=function(e){return new m(e)},m.encode=function(e,t){if(t=t||Ms.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)Bs.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return t},m.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},m.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.Gauge;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(Bs.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(e,e.uint32()))):e.skipType(7&s)}return o},m.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},m.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=Bs.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}return null},m.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.metrics.v1.Gauge)return e;var t=new Bs.opentelemetry.proto.metrics.v1.Gauge;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: object expected");t.dataPoints[r]=Bs.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(e.dataPoints[r])}}return t},m.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=Bs.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(e.dataPoints[n],t)}return r},m.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},m.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Gauge"},m),r.Sum=(f.prototype.dataPoints=Vs.emptyArray,f.prototype.aggregationTemporality=null,f.prototype.isMonotonic=null,f.create=function(e){return new f(e)},f.encode=function(e,t){if(t=t||Ms.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)Bs.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return null!=e.aggregationTemporality&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&t.uint32(16).int32(e.aggregationTemporality),null!=e.isMonotonic&&Object.hasOwnProperty.call(e,"isMonotonic")&&t.uint32(24).bool(e.isMonotonic),t},f.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},f.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.Sum;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(Bs.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(e,e.uint32()));break;case 2:o.aggregationTemporality=e.int32();break;case 3:o.isMonotonic=e.bool();break;default:e.skipType(7&s)}}return o},f.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},f.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=Bs.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}if(null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:}return null!=e.isMonotonic&&e.hasOwnProperty("isMonotonic")&&"boolean"!=typeof e.isMonotonic?"isMonotonic: boolean expected":null},f.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.metrics.v1.Sum)return e;var t=new Bs.opentelemetry.proto.metrics.v1.Sum;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: object expected");t.dataPoints[r]=Bs.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(e.dataPoints[r])}}switch(e.aggregationTemporality){default:"number"==typeof e.aggregationTemporality&&(t.aggregationTemporality=e.aggregationTemporality);break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:t.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:t.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:t.aggregationTemporality=2}return null!=e.isMonotonic&&(t.isMonotonic=Boolean(e.isMonotonic)),t},f.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),t.defaults&&(r.aggregationTemporality=t.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0,r.isMonotonic=!1),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=Bs.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(e.dataPoints[n],t)}return null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality")&&(r.aggregationTemporality=t.enums!==String||void 0===Bs.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]?e.aggregationTemporality:Bs.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]),null!=e.isMonotonic&&e.hasOwnProperty("isMonotonic")&&(r.isMonotonic=e.isMonotonic),r},f.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},f.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Sum"},f),r.Histogram=(d.prototype.dataPoints=Vs.emptyArray,d.prototype.aggregationTemporality=null,d.create=function(e){return new d(e)},d.encode=function(e,t){if(t=t||Ms.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)Bs.opentelemetry.proto.metrics.v1.HistogramDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return null!=e.aggregationTemporality&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&t.uint32(16).int32(e.aggregationTemporality),t},d.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},d.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.Histogram;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(Bs.opentelemetry.proto.metrics.v1.HistogramDataPoint.decode(e,e.uint32()));break;case 2:o.aggregationTemporality=e.int32();break;default:e.skipType(7&s)}}return o},d.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},d.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=Bs.opentelemetry.proto.metrics.v1.HistogramDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}if(null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:}return null},d.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.metrics.v1.Histogram)return e;var t=new Bs.opentelemetry.proto.metrics.v1.Histogram;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: object expected");t.dataPoints[r]=Bs.opentelemetry.proto.metrics.v1.HistogramDataPoint.fromObject(e.dataPoints[r])}}switch(e.aggregationTemporality){default:"number"==typeof e.aggregationTemporality&&(t.aggregationTemporality=e.aggregationTemporality);break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:t.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:t.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:t.aggregationTemporality=2}return t},d.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),t.defaults&&(r.aggregationTemporality=t.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=Bs.opentelemetry.proto.metrics.v1.HistogramDataPoint.toObject(e.dataPoints[n],t)}return null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality")&&(r.aggregationTemporality=t.enums!==String||void 0===Bs.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]?e.aggregationTemporality:Bs.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]),r},d.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},d.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Histogram"},d),r.ExponentialHistogram=(h.prototype.dataPoints=Vs.emptyArray,h.prototype.aggregationTemporality=null,h.create=function(e){return new h(e)},h.encode=function(e,t){if(t=t||Ms.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return null!=e.aggregationTemporality&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&t.uint32(16).int32(e.aggregationTemporality),t},h.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},h.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.ExponentialHistogram;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.decode(e,e.uint32()));break;case 2:o.aggregationTemporality=e.int32();break;default:e.skipType(7&s)}}return o},h.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},h.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}if(null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:}return null},h.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.metrics.v1.ExponentialHistogram)return e;var t=new Bs.opentelemetry.proto.metrics.v1.ExponentialHistogram;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: object expected");t.dataPoints[r]=Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.fromObject(e.dataPoints[r])}}switch(e.aggregationTemporality){default:"number"==typeof e.aggregationTemporality&&(t.aggregationTemporality=e.aggregationTemporality);break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:t.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:t.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:t.aggregationTemporality=2}return t},h.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),t.defaults&&(r.aggregationTemporality=t.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.toObject(e.dataPoints[n],t)}return null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality")&&(r.aggregationTemporality=t.enums!==String||void 0===Bs.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]?e.aggregationTemporality:Bs.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]),r},h.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},h.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ExponentialHistogram"},h),r.Summary=(p.prototype.dataPoints=Vs.emptyArray,p.create=function(e){return new p(e)},p.encode=function(e,t){if(t=t||Ms.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return t},p.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},p.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.Summary;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint.decode(e,e.uint32()))):e.skipType(7&s)}return o},p.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},p.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}return null},p.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.metrics.v1.Summary)return e;var t=new Bs.opentelemetry.proto.metrics.v1.Summary;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: object expected");t.dataPoints[r]=Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint.fromObject(e.dataPoints[r])}}return t},p.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint.toObject(e.dataPoints[n],t)}return r},p.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},p.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Summary"},p),r.AggregationTemporality=(t={},(e=Object.create(t))[t[0]="AGGREGATION_TEMPORALITY_UNSPECIFIED"]=0,e[t[1]="AGGREGATION_TEMPORALITY_DELTA"]=1,e[t[2]="AGGREGATION_TEMPORALITY_CUMULATIVE"]=2,e),r.DataPointFlags=(t={},(e=Object.create(t))[t[0]="DATA_POINT_FLAGS_DO_NOT_USE"]=0,e[t[1]="DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK"]=1,e),r.NumberDataPoint=(c.prototype.attributes=Vs.emptyArray,c.prototype.startTimeUnixNano=null,c.prototype.timeUnixNano=null,c.prototype.asDouble=null,c.prototype.asInt=null,c.prototype.exemplars=Vs.emptyArray,c.prototype.flags=null,Object.defineProperty(c.prototype,"value",{get:Vs.oneOfGetter(t=["asDouble","asInt"]),set:Vs.oneOfSetter(t)}),c.create=function(e){return new c(e)},c.encode=function(e,t){if(t=t||Ms.create(),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.asDouble&&Object.hasOwnProperty.call(e,"asDouble")&&t.uint32(33).double(e.asDouble),null!=e.exemplars&&e.exemplars.length)for(var r=0;r<e.exemplars.length;++r)Bs.opentelemetry.proto.metrics.v1.Exemplar.encode(e.exemplars[r],t.uint32(42).fork()).ldelim();if(null!=e.asInt&&Object.hasOwnProperty.call(e,"asInt")&&t.uint32(49).sfixed64(e.asInt),null!=e.attributes&&e.attributes.length)for(r=0;r<e.attributes.length;++r)Bs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(58).fork()).ldelim();return null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(64).uint32(e.flags),t},c.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},c.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.NumberDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 7:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Bs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.asDouble=e.double();break;case 6:o.asInt=e.sfixed64();break;case 5:o.exemplars&&o.exemplars.length||(o.exemplars=[]),o.exemplars.push(Bs.opentelemetry.proto.metrics.v1.Exemplar.decode(e,e.uint32()));break;case 8:o.flags=e.uint32();break;default:e.skipType(7&s)}}return o},c.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},c.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t,r={};if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var n=0;n<e.attributes.length;++n)if(t=Bs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[n]))return"attributes."+t}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(Vs.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&Vs.isInteger(e.startTimeUnixNano.low)&&Vs.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Vs.isInteger(e.timeUnixNano)||e.timeUnixNano&&Vs.isInteger(e.timeUnixNano.low)&&Vs.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(r.value=1,"number"!=typeof e.asDouble))return"asDouble: number expected";if(null!=e.asInt&&e.hasOwnProperty("asInt")){if(1===r.value)return"value: multiple values";if(r.value=1,!(Vs.isInteger(e.asInt)||e.asInt&&Vs.isInteger(e.asInt.low)&&Vs.isInteger(e.asInt.high)))return"asInt: integer|Long expected"}if(null!=e.exemplars&&e.hasOwnProperty("exemplars")){if(!Array.isArray(e.exemplars))return"exemplars: array expected";for(n=0;n<e.exemplars.length;++n)if(t=Bs.opentelemetry.proto.metrics.v1.Exemplar.verify(e.exemplars[n]))return"exemplars."+t}return null!=e.flags&&e.hasOwnProperty("flags")&&!Vs.isInteger(e.flags)?"flags: integer expected":null},c.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.metrics.v1.NumberDataPoint)return e;var t=new Bs.opentelemetry.proto.metrics.v1.NumberDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: object expected");t.attributes[r]=Bs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(Vs.Long?(t.startTimeUnixNano=Vs.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new Vs.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(Vs.Long?(t.timeUnixNano=Vs.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Vs.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.asDouble&&(t.asDouble=Number(e.asDouble)),null!=e.asInt&&(Vs.Long?(t.asInt=Vs.Long.fromValue(e.asInt)).unsigned=!1:"string"==typeof e.asInt?t.asInt=parseInt(e.asInt,10):"number"==typeof e.asInt?t.asInt=e.asInt:"object"==typeof e.asInt&&(t.asInt=new Vs.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber())),e.exemplars){if(!Array.isArray(e.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: array expected");for(t.exemplars=[],r=0;r<e.exemplars.length;++r){if("object"!=typeof e.exemplars[r])throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: object expected");t.exemplars[r]=Bs.opentelemetry.proto.metrics.v1.Exemplar.fromObject(e.exemplars[r])}}return null!=e.flags&&(t.flags=e.flags>>>0),t},c.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.exemplars=[],n.attributes=[]),t.defaults&&(Vs.Long?(r=new Vs.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,Vs.Long?(r=new Vs.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,n.flags=0),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?Vs.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new Vs.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Vs.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Vs.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(n.asDouble=t.json&&!isFinite(e.asDouble)?String(e.asDouble):e.asDouble,t.oneofs)&&(n.value="asDouble"),e.exemplars&&e.exemplars.length){n.exemplars=[];for(var o=0;o<e.exemplars.length;++o)n.exemplars[o]=Bs.opentelemetry.proto.metrics.v1.Exemplar.toObject(e.exemplars[o],t)}if(null!=e.asInt&&e.hasOwnProperty("asInt")&&("number"==typeof e.asInt?n.asInt=t.longs===String?String(e.asInt):e.asInt:n.asInt=t.longs===String?Vs.Long.prototype.toString.call(e.asInt):t.longs===Number?new Vs.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber():e.asInt,t.oneofs)&&(n.value="asInt"),e.attributes&&e.attributes.length)for(n.attributes=[],o=0;o<e.attributes.length;++o)n.attributes[o]=Bs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t);return null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),n},c.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},c.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.NumberDataPoint"},c),r.HistogramDataPoint=(l.prototype.attributes=Vs.emptyArray,l.prototype.startTimeUnixNano=null,l.prototype.timeUnixNano=null,l.prototype.count=null,l.prototype.sum=null,l.prototype.bucketCounts=Vs.emptyArray,l.prototype.explicitBounds=Vs.emptyArray,l.prototype.exemplars=Vs.emptyArray,l.prototype.flags=null,l.prototype.min=null,l.prototype.max=null,Object.defineProperty(l.prototype,"_sum",{get:Vs.oneOfGetter(e=["sum"]),set:Vs.oneOfSetter(e)}),Object.defineProperty(l.prototype,"_min",{get:Vs.oneOfGetter(e=["min"]),set:Vs.oneOfSetter(e)}),Object.defineProperty(l.prototype,"_max",{get:Vs.oneOfGetter(e=["max"]),set:Vs.oneOfSetter(e)}),l.create=function(e){return new l(e)},l.encode=function(e,t){if(t=t||Ms.create(),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.count&&Object.hasOwnProperty.call(e,"count")&&t.uint32(33).fixed64(e.count),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&t.uint32(41).double(e.sum),null!=e.bucketCounts&&e.bucketCounts.length){t.uint32(50).fork();for(var r=0;r<e.bucketCounts.length;++r)t.fixed64(e.bucketCounts[r]);t.ldelim()}if(null!=e.explicitBounds&&e.explicitBounds.length){for(t.uint32(58).fork(),r=0;r<e.explicitBounds.length;++r)t.double(e.explicitBounds[r]);t.ldelim()}if(null!=e.exemplars&&e.exemplars.length)for(r=0;r<e.exemplars.length;++r)Bs.opentelemetry.proto.metrics.v1.Exemplar.encode(e.exemplars[r],t.uint32(66).fork()).ldelim();if(null!=e.attributes&&e.attributes.length)for(r=0;r<e.attributes.length;++r)Bs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(74).fork()).ldelim();return null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(80).uint32(e.flags),null!=e.min&&Object.hasOwnProperty.call(e,"min")&&t.uint32(89).double(e.min),null!=e.max&&Object.hasOwnProperty.call(e,"max")&&t.uint32(97).double(e.max),t},l.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},l.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.HistogramDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 9:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Bs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.count=e.fixed64();break;case 5:o.sum=e.double();break;case 6:if(o.bucketCounts&&o.bucketCounts.length||(o.bucketCounts=[]),2==(7&s))for(var i=e.uint32()+e.pos;e.pos<i;)o.bucketCounts.push(e.fixed64());else o.bucketCounts.push(e.fixed64());break;case 7:if(o.explicitBounds&&o.explicitBounds.length||(o.explicitBounds=[]),2==(7&s))for(i=e.uint32()+e.pos;e.pos<i;)o.explicitBounds.push(e.double());else o.explicitBounds.push(e.double());break;case 8:o.exemplars&&o.exemplars.length||(o.exemplars=[]),o.exemplars.push(Bs.opentelemetry.proto.metrics.v1.Exemplar.decode(e,e.uint32()));break;case 10:o.flags=e.uint32();break;case 11:o.min=e.double();break;case 12:o.max=e.double();break;default:e.skipType(7&s)}}return o},l.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},l.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=Bs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(Vs.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&Vs.isInteger(e.startTimeUnixNano.low)&&Vs.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Vs.isInteger(e.timeUnixNano)||e.timeUnixNano&&Vs.isInteger(e.timeUnixNano.low)&&Vs.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.count&&e.hasOwnProperty("count")&&!(Vs.isInteger(e.count)||e.count&&Vs.isInteger(e.count.low)&&Vs.isInteger(e.count.high)))return"count: integer|Long expected";if(null!=e.sum&&e.hasOwnProperty("sum")&&"number"!=typeof e.sum)return"sum: number expected";if(null!=e.bucketCounts&&e.hasOwnProperty("bucketCounts")){if(!Array.isArray(e.bucketCounts))return"bucketCounts: array expected";for(t=0;t<e.bucketCounts.length;++t)if(!(Vs.isInteger(e.bucketCounts[t])||e.bucketCounts[t]&&Vs.isInteger(e.bucketCounts[t].low)&&Vs.isInteger(e.bucketCounts[t].high)))return"bucketCounts: integer|Long[] expected"}if(null!=e.explicitBounds&&e.hasOwnProperty("explicitBounds")){if(!Array.isArray(e.explicitBounds))return"explicitBounds: array expected";for(t=0;t<e.explicitBounds.length;++t)if("number"!=typeof e.explicitBounds[t])return"explicitBounds: number[] expected"}if(null!=e.exemplars&&e.hasOwnProperty("exemplars")){if(!Array.isArray(e.exemplars))return"exemplars: array expected";for(t=0;t<e.exemplars.length;++t){var r;if(r=Bs.opentelemetry.proto.metrics.v1.Exemplar.verify(e.exemplars[t]))return"exemplars."+r}}return null!=e.flags&&e.hasOwnProperty("flags")&&!Vs.isInteger(e.flags)?"flags: integer expected":null!=e.min&&e.hasOwnProperty("min")&&"number"!=typeof e.min?"min: number expected":null!=e.max&&e.hasOwnProperty("max")&&"number"!=typeof e.max?"max: number expected":null},l.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.metrics.v1.HistogramDataPoint)return e;var t=new Bs.opentelemetry.proto.metrics.v1.HistogramDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: object expected");t.attributes[r]=Bs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(Vs.Long?(t.startTimeUnixNano=Vs.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new Vs.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(Vs.Long?(t.timeUnixNano=Vs.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Vs.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.count&&(Vs.Long?(t.count=Vs.Long.fromValue(e.count)).unsigned=!1:"string"==typeof e.count?t.count=parseInt(e.count,10):"number"==typeof e.count?t.count=e.count:"object"==typeof e.count&&(t.count=new Vs.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber())),null!=e.sum&&(t.sum=Number(e.sum)),e.bucketCounts){if(!Array.isArray(e.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.bucketCounts: array expected");for(t.bucketCounts=[],r=0;r<e.bucketCounts.length;++r)Vs.Long?(t.bucketCounts[r]=Vs.Long.fromValue(e.bucketCounts[r])).unsigned=!1:"string"==typeof e.bucketCounts[r]?t.bucketCounts[r]=parseInt(e.bucketCounts[r],10):"number"==typeof e.bucketCounts[r]?t.bucketCounts[r]=e.bucketCounts[r]:"object"==typeof e.bucketCounts[r]&&(t.bucketCounts[r]=new Vs.LongBits(e.bucketCounts[r].low>>>0,e.bucketCounts[r].high>>>0).toNumber())}if(e.explicitBounds){if(!Array.isArray(e.explicitBounds))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.explicitBounds: array expected");for(t.explicitBounds=[],r=0;r<e.explicitBounds.length;++r)t.explicitBounds[r]=Number(e.explicitBounds[r])}if(e.exemplars){if(!Array.isArray(e.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: array expected");for(t.exemplars=[],r=0;r<e.exemplars.length;++r){if("object"!=typeof e.exemplars[r])throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: object expected");t.exemplars[r]=Bs.opentelemetry.proto.metrics.v1.Exemplar.fromObject(e.exemplars[r])}}return null!=e.flags&&(t.flags=e.flags>>>0),null!=e.min&&(t.min=Number(e.min)),null!=e.max&&(t.max=Number(e.max)),t},l.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.bucketCounts=[],n.explicitBounds=[],n.exemplars=[],n.attributes=[]),t.defaults&&(Vs.Long?(r=new Vs.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,Vs.Long?(r=new Vs.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,Vs.Long?(r=new Vs.Long(0,0,!1),n.count=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.count=t.longs===String?"0":0,n.flags=0),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?Vs.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new Vs.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Vs.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Vs.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.count&&e.hasOwnProperty("count")&&("number"==typeof e.count?n.count=t.longs===String?String(e.count):e.count:n.count=t.longs===String?Vs.Long.prototype.toString.call(e.count):t.longs===Number?new Vs.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber():e.count),null!=e.sum&&e.hasOwnProperty("sum")&&(n.sum=t.json&&!isFinite(e.sum)?String(e.sum):e.sum,t.oneofs)&&(n._sum="sum"),e.bucketCounts&&e.bucketCounts.length){n.bucketCounts=[];for(var o=0;o<e.bucketCounts.length;++o)"number"==typeof e.bucketCounts[o]?n.bucketCounts[o]=t.longs===String?String(e.bucketCounts[o]):e.bucketCounts[o]:n.bucketCounts[o]=t.longs===String?Vs.Long.prototype.toString.call(e.bucketCounts[o]):t.longs===Number?new Vs.LongBits(e.bucketCounts[o].low>>>0,e.bucketCounts[o].high>>>0).toNumber():e.bucketCounts[o]}if(e.explicitBounds&&e.explicitBounds.length)for(n.explicitBounds=[],o=0;o<e.explicitBounds.length;++o)n.explicitBounds[o]=t.json&&!isFinite(e.explicitBounds[o])?String(e.explicitBounds[o]):e.explicitBounds[o];if(e.exemplars&&e.exemplars.length)for(n.exemplars=[],o=0;o<e.exemplars.length;++o)n.exemplars[o]=Bs.opentelemetry.proto.metrics.v1.Exemplar.toObject(e.exemplars[o],t);if(e.attributes&&e.attributes.length)for(n.attributes=[],o=0;o<e.attributes.length;++o)n.attributes[o]=Bs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t);return null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),null!=e.min&&e.hasOwnProperty("min")&&(n.min=t.json&&!isFinite(e.min)?String(e.min):e.min,t.oneofs)&&(n._min="min"),null!=e.max&&e.hasOwnProperty("max")&&(n.max=t.json&&!isFinite(e.max)?String(e.max):e.max,t.oneofs)&&(n._max="max"),n},l.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},l.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.HistogramDataPoint"},l),r.ExponentialHistogramDataPoint=(a.prototype.attributes=Vs.emptyArray,a.prototype.startTimeUnixNano=null,a.prototype.timeUnixNano=null,a.prototype.count=null,a.prototype.sum=null,a.prototype.scale=null,a.prototype.zeroCount=null,a.prototype.positive=null,a.prototype.negative=null,a.prototype.flags=null,a.prototype.exemplars=Vs.emptyArray,a.prototype.min=null,a.prototype.max=null,a.prototype.zeroThreshold=null,Object.defineProperty(a.prototype,"_sum",{get:Vs.oneOfGetter(t=["sum"]),set:Vs.oneOfSetter(t)}),Object.defineProperty(a.prototype,"_min",{get:Vs.oneOfGetter(t=["min"]),set:Vs.oneOfSetter(t)}),Object.defineProperty(a.prototype,"_max",{get:Vs.oneOfGetter(t=["max"]),set:Vs.oneOfSetter(t)}),a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Ms.create(),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Bs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(10).fork()).ldelim();if(null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.count&&Object.hasOwnProperty.call(e,"count")&&t.uint32(33).fixed64(e.count),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&t.uint32(41).double(e.sum),null!=e.scale&&Object.hasOwnProperty.call(e,"scale")&&t.uint32(48).sint32(e.scale),null!=e.zeroCount&&Object.hasOwnProperty.call(e,"zeroCount")&&t.uint32(57).fixed64(e.zeroCount),null!=e.positive&&Object.hasOwnProperty.call(e,"positive")&&Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(e.positive,t.uint32(66).fork()).ldelim(),null!=e.negative&&Object.hasOwnProperty.call(e,"negative")&&Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(e.negative,t.uint32(74).fork()).ldelim(),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(80).uint32(e.flags),null!=e.exemplars&&e.exemplars.length)for(r=0;r<e.exemplars.length;++r)Bs.opentelemetry.proto.metrics.v1.Exemplar.encode(e.exemplars[r],t.uint32(90).fork()).ldelim();return null!=e.min&&Object.hasOwnProperty.call(e,"min")&&t.uint32(97).double(e.min),null!=e.max&&Object.hasOwnProperty.call(e,"max")&&t.uint32(105).double(e.max),null!=e.zeroThreshold&&Object.hasOwnProperty.call(e,"zeroThreshold")&&t.uint32(113).double(e.zeroThreshold),t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Bs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.count=e.fixed64();break;case 5:o.sum=e.double();break;case 6:o.scale=e.sint32();break;case 7:o.zeroCount=e.fixed64();break;case 8:o.positive=Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(e,e.uint32());break;case 9:o.negative=Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(e,e.uint32());break;case 10:o.flags=e.uint32();break;case 11:o.exemplars&&o.exemplars.length||(o.exemplars=[]),o.exemplars.push(Bs.opentelemetry.proto.metrics.v1.Exemplar.decode(e,e.uint32()));break;case 12:o.min=e.double();break;case 13:o.max=e.double();break;case 14:o.zeroThreshold=e.double();break;default:e.skipType(7&s)}}return o},a.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=Bs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(Vs.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&Vs.isInteger(e.startTimeUnixNano.low)&&Vs.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Vs.isInteger(e.timeUnixNano)||e.timeUnixNano&&Vs.isInteger(e.timeUnixNano.low)&&Vs.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.count&&e.hasOwnProperty("count")&&!(Vs.isInteger(e.count)||e.count&&Vs.isInteger(e.count.low)&&Vs.isInteger(e.count.high)))return"count: integer|Long expected";if(null!=e.sum&&e.hasOwnProperty("sum")&&"number"!=typeof e.sum)return"sum: number expected";if(null!=e.scale&&e.hasOwnProperty("scale")&&!Vs.isInteger(e.scale))return"scale: integer expected";if(null!=e.zeroCount&&e.hasOwnProperty("zeroCount")&&!(Vs.isInteger(e.zeroCount)||e.zeroCount&&Vs.isInteger(e.zeroCount.low)&&Vs.isInteger(e.zeroCount.high)))return"zeroCount: integer|Long expected";if(null!=e.positive&&e.hasOwnProperty("positive")&&(r=Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(e.positive)))return"positive."+r;if(null!=e.negative&&e.hasOwnProperty("negative")&&(r=Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(e.negative)))return"negative."+r;if(null!=e.flags&&e.hasOwnProperty("flags")&&!Vs.isInteger(e.flags))return"flags: integer expected";if(null!=e.exemplars&&e.hasOwnProperty("exemplars")){if(!Array.isArray(e.exemplars))return"exemplars: array expected";for(t=0;t<e.exemplars.length;++t){var r;if(r=Bs.opentelemetry.proto.metrics.v1.Exemplar.verify(e.exemplars[t]))return"exemplars."+r}}return null!=e.min&&e.hasOwnProperty("min")&&"number"!=typeof e.min?"min: number expected":null!=e.max&&e.hasOwnProperty("max")&&"number"!=typeof e.max?"max: number expected":null!=e.zeroThreshold&&e.hasOwnProperty("zeroThreshold")&&"number"!=typeof e.zeroThreshold?"zeroThreshold: number expected":null},a.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint)return e;var t=new Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: object expected");t.attributes[r]=Bs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(Vs.Long?(t.startTimeUnixNano=Vs.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new Vs.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(Vs.Long?(t.timeUnixNano=Vs.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Vs.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.count&&(Vs.Long?(t.count=Vs.Long.fromValue(e.count)).unsigned=!1:"string"==typeof e.count?t.count=parseInt(e.count,10):"number"==typeof e.count?t.count=e.count:"object"==typeof e.count&&(t.count=new Vs.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber())),null!=e.sum&&(t.sum=Number(e.sum)),null!=e.scale&&(t.scale=0|e.scale),null!=e.zeroCount&&(Vs.Long?(t.zeroCount=Vs.Long.fromValue(e.zeroCount)).unsigned=!1:"string"==typeof e.zeroCount?t.zeroCount=parseInt(e.zeroCount,10):"number"==typeof e.zeroCount?t.zeroCount=e.zeroCount:"object"==typeof e.zeroCount&&(t.zeroCount=new Vs.LongBits(e.zeroCount.low>>>0,e.zeroCount.high>>>0).toNumber())),null!=e.positive){if("object"!=typeof e.positive)throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.positive: object expected");t.positive=Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(e.positive)}if(null!=e.negative){if("object"!=typeof e.negative)throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.negative: object expected");t.negative=Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(e.negative)}if(null!=e.flags&&(t.flags=e.flags>>>0),e.exemplars){if(!Array.isArray(e.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: array expected");for(t.exemplars=[],r=0;r<e.exemplars.length;++r){if("object"!=typeof e.exemplars[r])throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: object expected");t.exemplars[r]=Bs.opentelemetry.proto.metrics.v1.Exemplar.fromObject(e.exemplars[r])}}return null!=e.min&&(t.min=Number(e.min)),null!=e.max&&(t.max=Number(e.max)),null!=e.zeroThreshold&&(t.zeroThreshold=Number(e.zeroThreshold)),t},a.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[],n.exemplars=[]),t.defaults&&(Vs.Long?(r=new Vs.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,Vs.Long?(r=new Vs.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,Vs.Long?(r=new Vs.Long(0,0,!1),n.count=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.count=t.longs===String?"0":0,n.scale=0,Vs.Long?(r=new Vs.Long(0,0,!1),n.zeroCount=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.zeroCount=t.longs===String?"0":0,n.positive=null,n.negative=null,n.flags=0,n.zeroThreshold=0),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=Bs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?Vs.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new Vs.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Vs.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Vs.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.count&&e.hasOwnProperty("count")&&("number"==typeof e.count?n.count=t.longs===String?String(e.count):e.count:n.count=t.longs===String?Vs.Long.prototype.toString.call(e.count):t.longs===Number?new Vs.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber():e.count),null!=e.sum&&e.hasOwnProperty("sum")&&(n.sum=t.json&&!isFinite(e.sum)?String(e.sum):e.sum,t.oneofs)&&(n._sum="sum"),null!=e.scale&&e.hasOwnProperty("scale")&&(n.scale=e.scale),null!=e.zeroCount&&e.hasOwnProperty("zeroCount")&&("number"==typeof e.zeroCount?n.zeroCount=t.longs===String?String(e.zeroCount):e.zeroCount:n.zeroCount=t.longs===String?Vs.Long.prototype.toString.call(e.zeroCount):t.longs===Number?new Vs.LongBits(e.zeroCount.low>>>0,e.zeroCount.high>>>0).toNumber():e.zeroCount),null!=e.positive&&e.hasOwnProperty("positive")&&(n.positive=Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(e.positive,t)),null!=e.negative&&e.hasOwnProperty("negative")&&(n.negative=Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(e.negative,t)),null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),e.exemplars&&e.exemplars.length)for(n.exemplars=[],o=0;o<e.exemplars.length;++o)n.exemplars[o]=Bs.opentelemetry.proto.metrics.v1.Exemplar.toObject(e.exemplars[o],t);return null!=e.min&&e.hasOwnProperty("min")&&(n.min=t.json&&!isFinite(e.min)?String(e.min):e.min,t.oneofs)&&(n._min="min"),null!=e.max&&e.hasOwnProperty("max")&&(n.max=t.json&&!isFinite(e.max)?String(e.max):e.max,t.oneofs)&&(n._max="max"),null!=e.zeroThreshold&&e.hasOwnProperty("zeroThreshold")&&(n.zeroThreshold=t.json&&!isFinite(e.zeroThreshold)?String(e.zeroThreshold):e.zeroThreshold),n},a.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint"},a.Buckets=(u.prototype.offset=null,u.prototype.bucketCounts=Vs.emptyArray,u.create=function(e){return new u(e)},u.encode=function(e,t){if(t=t||Ms.create(),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(8).sint32(e.offset),null!=e.bucketCounts&&e.bucketCounts.length){t.uint32(18).fork();for(var r=0;r<e.bucketCounts.length;++r)t.uint64(e.bucketCounts[r]);t.ldelim()}return t},u.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},u.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.offset=e.sint32();break;case 2:if(o.bucketCounts&&o.bucketCounts.length||(o.bucketCounts=[]),2==(7&s))for(var i=e.uint32()+e.pos;e.pos<i;)o.bucketCounts.push(e.uint64());else o.bucketCounts.push(e.uint64());break;default:e.skipType(7&s)}}return o},u.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},u.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.offset&&e.hasOwnProperty("offset")&&!Vs.isInteger(e.offset))return"offset: integer expected";if(null!=e.bucketCounts&&e.hasOwnProperty("bucketCounts")){if(!Array.isArray(e.bucketCounts))return"bucketCounts: array expected";for(var t=0;t<e.bucketCounts.length;++t)if(!(Vs.isInteger(e.bucketCounts[t])||e.bucketCounts[t]&&Vs.isInteger(e.bucketCounts[t].low)&&Vs.isInteger(e.bucketCounts[t].high)))return"bucketCounts: integer|Long[] expected"}return null},u.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets)return e;var t=new Bs.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;if(null!=e.offset&&(t.offset=0|e.offset),e.bucketCounts){if(!Array.isArray(e.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.bucketCounts: array expected");t.bucketCounts=[];for(var r=0;r<e.bucketCounts.length;++r)Vs.Long?(t.bucketCounts[r]=Vs.Long.fromValue(e.bucketCounts[r])).unsigned=!0:"string"==typeof e.bucketCounts[r]?t.bucketCounts[r]=parseInt(e.bucketCounts[r],10):"number"==typeof e.bucketCounts[r]?t.bucketCounts[r]=e.bucketCounts[r]:"object"==typeof e.bucketCounts[r]&&(t.bucketCounts[r]=new Vs.LongBits(e.bucketCounts[r].low>>>0,e.bucketCounts[r].high>>>0).toNumber(!0))}return t},u.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.bucketCounts=[]),t.defaults&&(r.offset=0),null!=e.offset&&e.hasOwnProperty("offset")&&(r.offset=e.offset),e.bucketCounts&&e.bucketCounts.length){r.bucketCounts=[];for(var n=0;n<e.bucketCounts.length;++n)"number"==typeof e.bucketCounts[n]?r.bucketCounts[n]=t.longs===String?String(e.bucketCounts[n]):e.bucketCounts[n]:r.bucketCounts[n]=t.longs===String?Vs.Long.prototype.toString.call(e.bucketCounts[n]):t.longs===Number?new Vs.LongBits(e.bucketCounts[n].low>>>0,e.bucketCounts[n].high>>>0).toNumber(!0):e.bucketCounts[n]}return r},u.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},u.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets"},u),a),r.SummaryDataPoint=(s.prototype.attributes=Vs.emptyArray,s.prototype.startTimeUnixNano=null,s.prototype.timeUnixNano=null,s.prototype.count=null,s.prototype.sum=null,s.prototype.quantileValues=Vs.emptyArray,s.prototype.flags=null,s.create=function(e){return new s(e)},s.encode=function(e,t){if(t=t||Ms.create(),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.count&&Object.hasOwnProperty.call(e,"count")&&t.uint32(33).fixed64(e.count),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&t.uint32(41).double(e.sum),null!=e.quantileValues&&e.quantileValues.length)for(var r=0;r<e.quantileValues.length;++r)Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.encode(e.quantileValues[r],t.uint32(50).fork()).ldelim();if(null!=e.attributes&&e.attributes.length)for(r=0;r<e.attributes.length;++r)Bs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(58).fork()).ldelim();return null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(64).uint32(e.flags),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 7:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Bs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.count=e.fixed64();break;case 5:o.sum=e.double();break;case 6:o.quantileValues&&o.quantileValues.length||(o.quantileValues=[]),o.quantileValues.push(Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.decode(e,e.uint32()));break;case 8:o.flags=e.uint32();break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=Bs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(Vs.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&Vs.isInteger(e.startTimeUnixNano.low)&&Vs.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Vs.isInteger(e.timeUnixNano)||e.timeUnixNano&&Vs.isInteger(e.timeUnixNano.low)&&Vs.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.count&&e.hasOwnProperty("count")&&!(Vs.isInteger(e.count)||e.count&&Vs.isInteger(e.count.low)&&Vs.isInteger(e.count.high)))return"count: integer|Long expected";if(null!=e.sum&&e.hasOwnProperty("sum")&&"number"!=typeof e.sum)return"sum: number expected";if(null!=e.quantileValues&&e.hasOwnProperty("quantileValues")){if(!Array.isArray(e.quantileValues))return"quantileValues: array expected";for(t=0;t<e.quantileValues.length;++t){var r;if(r=Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.verify(e.quantileValues[t]))return"quantileValues."+r}}return null!=e.flags&&e.hasOwnProperty("flags")&&!Vs.isInteger(e.flags)?"flags: integer expected":null},s.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint)return e;var t=new Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: object expected");t.attributes[r]=Bs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(Vs.Long?(t.startTimeUnixNano=Vs.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new Vs.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(Vs.Long?(t.timeUnixNano=Vs.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Vs.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.count&&(Vs.Long?(t.count=Vs.Long.fromValue(e.count)).unsigned=!1:"string"==typeof e.count?t.count=parseInt(e.count,10):"number"==typeof e.count?t.count=e.count:"object"==typeof e.count&&(t.count=new Vs.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber())),null!=e.sum&&(t.sum=Number(e.sum)),e.quantileValues){if(!Array.isArray(e.quantileValues))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: array expected");for(t.quantileValues=[],r=0;r<e.quantileValues.length;++r){if("object"!=typeof e.quantileValues[r])throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: object expected");t.quantileValues[r]=Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.fromObject(e.quantileValues[r])}}return null!=e.flags&&(t.flags=e.flags>>>0),t},s.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.quantileValues=[],n.attributes=[]),t.defaults&&(Vs.Long?(r=new Vs.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,Vs.Long?(r=new Vs.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,Vs.Long?(r=new Vs.Long(0,0,!1),n.count=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.count=t.longs===String?"0":0,n.sum=0,n.flags=0),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?Vs.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new Vs.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Vs.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Vs.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.count&&e.hasOwnProperty("count")&&("number"==typeof e.count?n.count=t.longs===String?String(e.count):e.count:n.count=t.longs===String?Vs.Long.prototype.toString.call(e.count):t.longs===Number?new Vs.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber():e.count),null!=e.sum&&e.hasOwnProperty("sum")&&(n.sum=t.json&&!isFinite(e.sum)?String(e.sum):e.sum),e.quantileValues&&e.quantileValues.length){n.quantileValues=[];for(var o=0;o<e.quantileValues.length;++o)n.quantileValues[o]=Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.toObject(e.quantileValues[o],t)}if(e.attributes&&e.attributes.length)for(n.attributes=[],o=0;o<e.attributes.length;++o)n.attributes[o]=Bs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t);return null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),n},s.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.SummaryDataPoint"},s.ValueAtQuantile=(i.prototype.quantile=null,i.prototype.value=null,i.create=function(e){return new i(e)},i.encode=function(e,t){return t=t||Ms.create(),null!=e.quantile&&Object.hasOwnProperty.call(e,"quantile")&&t.uint32(9).double(e.quantile),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&t.uint32(17).double(e.value),t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.quantile=e.double();break;case 2:o.value=e.double();break;default:e.skipType(7&s)}}return o},i.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},i.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.quantile&&e.hasOwnProperty("quantile")&&"number"!=typeof e.quantile?"quantile: number expected":null!=e.value&&e.hasOwnProperty("value")&&"number"!=typeof e.value?"value: number expected":null},i.fromObject=function(e){var t;return e instanceof Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile?e:(t=new Bs.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile,null!=e.quantile&&(t.quantile=Number(e.quantile)),null!=e.value&&(t.value=Number(e.value)),t)},i.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.quantile=0,r.value=0),null!=e.quantile&&e.hasOwnProperty("quantile")&&(r.quantile=t.json&&!isFinite(e.quantile)?String(e.quantile):e.quantile),null!=e.value&&e.hasOwnProperty("value")&&(r.value=t.json&&!isFinite(e.value)?String(e.value):e.value),r},i.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile"},i),s),r.Exemplar=(o.prototype.filteredAttributes=Vs.emptyArray,o.prototype.timeUnixNano=null,o.prototype.asDouble=null,o.prototype.asInt=null,o.prototype.spanId=null,o.prototype.traceId=null,Object.defineProperty(o.prototype,"value",{get:Vs.oneOfGetter(e=["asDouble","asInt"]),set:Vs.oneOfSetter(e)}),o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ms.create(),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(17).fixed64(e.timeUnixNano),null!=e.asDouble&&Object.hasOwnProperty.call(e,"asDouble")&&t.uint32(25).double(e.asDouble),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(34).bytes(e.spanId),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(42).bytes(e.traceId),null!=e.asInt&&Object.hasOwnProperty.call(e,"asInt")&&t.uint32(49).sfixed64(e.asInt),null!=e.filteredAttributes&&e.filteredAttributes.length)for(var r=0;r<e.filteredAttributes.length;++r)Bs.opentelemetry.proto.common.v1.KeyValue.encode(e.filteredAttributes[r],t.uint32(58).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.metrics.v1.Exemplar;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 7:o.filteredAttributes&&o.filteredAttributes.length||(o.filteredAttributes=[]),o.filteredAttributes.push(Bs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.timeUnixNano=e.fixed64();break;case 3:o.asDouble=e.double();break;case 6:o.asInt=e.sfixed64();break;case 4:o.spanId=e.bytes();break;case 5:o.traceId=e.bytes();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.filteredAttributes&&e.hasOwnProperty("filteredAttributes")){if(!Array.isArray(e.filteredAttributes))return"filteredAttributes: array expected";for(var r=0;r<e.filteredAttributes.length;++r){var n=Bs.opentelemetry.proto.common.v1.KeyValue.verify(e.filteredAttributes[r]);if(n)return"filteredAttributes."+n}}if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Vs.isInteger(e.timeUnixNano)||e.timeUnixNano&&Vs.isInteger(e.timeUnixNano.low)&&Vs.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(t.value=1,"number"!=typeof e.asDouble))return"asDouble: number expected";if(null!=e.asInt&&e.hasOwnProperty("asInt")){if(1===t.value)return"value: multiple values";if(t.value=1,!(Vs.isInteger(e.asInt)||e.asInt&&Vs.isInteger(e.asInt.low)&&Vs.isInteger(e.asInt.high)))return"asInt: integer|Long expected"}return null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||Vs.isString(e.spanId))?"spanId: buffer expected":null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||Vs.isString(e.traceId))?"traceId: buffer expected":null},o.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.metrics.v1.Exemplar)return e;var t=new Bs.opentelemetry.proto.metrics.v1.Exemplar;if(e.filteredAttributes){if(!Array.isArray(e.filteredAttributes))throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: array expected");t.filteredAttributes=[];for(var r=0;r<e.filteredAttributes.length;++r){if("object"!=typeof e.filteredAttributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: object expected");t.filteredAttributes[r]=Bs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.filteredAttributes[r])}}return null!=e.timeUnixNano&&(Vs.Long?(t.timeUnixNano=Vs.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Vs.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.asDouble&&(t.asDouble=Number(e.asDouble)),null!=e.asInt&&(Vs.Long?(t.asInt=Vs.Long.fromValue(e.asInt)).unsigned=!1:"string"==typeof e.asInt?t.asInt=parseInt(e.asInt,10):"number"==typeof e.asInt?t.asInt=e.asInt:"object"==typeof e.asInt&&(t.asInt=new Vs.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber())),null!=e.spanId&&("string"==typeof e.spanId?Vs.base64.decode(e.spanId,t.spanId=Vs.newBuffer(Vs.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.traceId&&("string"==typeof e.traceId?Vs.base64.decode(e.traceId,t.traceId=Vs.newBuffer(Vs.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),t},o.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.filteredAttributes=[]),t.defaults&&(Vs.Long?(r=new Vs.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,t.bytes===String?n.spanId="":(n.spanId=[],t.bytes!==Array&&(n.spanId=Vs.newBuffer(n.spanId))),t.bytes===String?n.traceId="":(n.traceId=[],t.bytes!==Array&&(n.traceId=Vs.newBuffer(n.traceId)))),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Vs.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Vs.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(n.asDouble=t.json&&!isFinite(e.asDouble)?String(e.asDouble):e.asDouble,t.oneofs)&&(n.value="asDouble"),null!=e.spanId&&e.hasOwnProperty("spanId")&&(n.spanId=t.bytes===String?Vs.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.traceId&&e.hasOwnProperty("traceId")&&(n.traceId=t.bytes===String?Vs.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.asInt&&e.hasOwnProperty("asInt")&&("number"==typeof e.asInt?n.asInt=t.longs===String?String(e.asInt):e.asInt:n.asInt=t.longs===String?Vs.Long.prototype.toString.call(e.asInt):t.longs===Number?new Vs.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber():e.asInt,t.oneofs)&&(n.value="asInt"),e.filteredAttributes&&e.filteredAttributes.length){n.filteredAttributes=[];for(var o=0;o<e.filteredAttributes.length;++o)n.filteredAttributes[o]=Bs.opentelemetry.proto.common.v1.KeyValue.toObject(e.filteredAttributes[o],t)}return n},o.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Exemplar"},o),r),n;function o(e){if(this.filteredAttributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(this.attributes=[],this.quantileValues=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.attributes=[],this.exemplars=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function u(e){if(this.bucketCounts=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function l(e){if(this.attributes=[],this.bucketCounts=[],this.explicitBounds=[],this.exemplars=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function c(e){if(this.attributes=[],this.exemplars=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function p(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function h(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function d(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function f(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function m(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function g(e){if(this.metadata=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function y(e){if(this.metrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function _(e){if(this.scopeMetrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function v(e){if(this.resourceMetrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),ks.logs=(()=>{var e,t,r,n={};return n.v1=((r={}).LogsData=(a.prototype.resourceLogs=Vs.emptyArray,a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Ms.create(),null!=e.resourceLogs&&e.resourceLogs.length)for(var r=0;r<e.resourceLogs.length;++r)Bs.opentelemetry.proto.logs.v1.ResourceLogs.encode(e.resourceLogs[r],t.uint32(10).fork()).ldelim();return t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.logs.v1.LogsData;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceLogs&&o.resourceLogs.length||(o.resourceLogs=[]),o.resourceLogs.push(Bs.opentelemetry.proto.logs.v1.ResourceLogs.decode(e,e.uint32()))):e.skipType(7&s)}return o},a.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceLogs&&e.hasOwnProperty("resourceLogs")){if(!Array.isArray(e.resourceLogs))return"resourceLogs: array expected";for(var t=0;t<e.resourceLogs.length;++t){var r=Bs.opentelemetry.proto.logs.v1.ResourceLogs.verify(e.resourceLogs[t]);if(r)return"resourceLogs."+r}}return null},a.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.logs.v1.LogsData)return e;var t=new Bs.opentelemetry.proto.logs.v1.LogsData;if(e.resourceLogs){if(!Array.isArray(e.resourceLogs))throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: array expected");t.resourceLogs=[];for(var r=0;r<e.resourceLogs.length;++r){if("object"!=typeof e.resourceLogs[r])throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: object expected");t.resourceLogs[r]=Bs.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(e.resourceLogs[r])}}return t},a.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceLogs=[]),e.resourceLogs&&e.resourceLogs.length){r.resourceLogs=[];for(var n=0;n<e.resourceLogs.length;++n)r.resourceLogs[n]=Bs.opentelemetry.proto.logs.v1.ResourceLogs.toObject(e.resourceLogs[n],t)}return r},a.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.LogsData"},a),r.ResourceLogs=(i.prototype.resource=null,i.prototype.scopeLogs=Vs.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,t){if(t=t||Ms.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&Bs.opentelemetry.proto.resource.v1.Resource.encode(e.resource,t.uint32(10).fork()).ldelim(),null!=e.scopeLogs&&e.scopeLogs.length)for(var r=0;r<e.scopeLogs.length;++r)Bs.opentelemetry.proto.logs.v1.ScopeLogs.encode(e.scopeLogs[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.logs.v1.ResourceLogs;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.resource=Bs.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break;case 2:o.scopeLogs&&o.scopeLogs.length||(o.scopeLogs=[]),o.scopeLogs.push(Bs.opentelemetry.proto.logs.v1.ScopeLogs.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},i.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},i.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&(t=Bs.opentelemetry.proto.resource.v1.Resource.verify(e.resource)))return"resource."+t;if(null!=e.scopeLogs&&e.hasOwnProperty("scopeLogs")){if(!Array.isArray(e.scopeLogs))return"scopeLogs: array expected";for(var t,r=0;r<e.scopeLogs.length;++r)if(t=Bs.opentelemetry.proto.logs.v1.ScopeLogs.verify(e.scopeLogs[r]))return"scopeLogs."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Vs.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.logs.v1.ResourceLogs)return e;var t=new Bs.opentelemetry.proto.logs.v1.ResourceLogs;if(null!=e.resource){if("object"!=typeof e.resource)throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.resource: object expected");t.resource=Bs.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeLogs){if(!Array.isArray(e.scopeLogs))throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: array expected");t.scopeLogs=[];for(var r=0;r<e.scopeLogs.length;++r){if("object"!=typeof e.scopeLogs[r])throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: object expected");t.scopeLogs[r]=Bs.opentelemetry.proto.logs.v1.ScopeLogs.fromObject(e.scopeLogs[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},i.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.scopeLogs=[]),t.defaults&&(r.resource=null,r.schemaUrl=""),null!=e.resource&&e.hasOwnProperty("resource")&&(r.resource=Bs.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,t)),e.scopeLogs&&e.scopeLogs.length){r.scopeLogs=[];for(var n=0;n<e.scopeLogs.length;++n)r.scopeLogs[n]=Bs.opentelemetry.proto.logs.v1.ScopeLogs.toObject(e.scopeLogs[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},i.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.ResourceLogs"},i),r.ScopeLogs=(s.prototype.scope=null,s.prototype.logRecords=Vs.emptyArray,s.prototype.schemaUrl=null,s.create=function(e){return new s(e)},s.encode=function(e,t){if(t=t||Ms.create(),null!=e.scope&&Object.hasOwnProperty.call(e,"scope")&&Bs.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,t.uint32(10).fork()).ldelim(),null!=e.logRecords&&e.logRecords.length)for(var r=0;r<e.logRecords.length;++r)Bs.opentelemetry.proto.logs.v1.LogRecord.encode(e.logRecords[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.logs.v1.ScopeLogs;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.scope=Bs.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break;case 2:o.logRecords&&o.logRecords.length||(o.logRecords=[]),o.logRecords.push(Bs.opentelemetry.proto.logs.v1.LogRecord.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.scope&&e.hasOwnProperty("scope")&&(t=Bs.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope)))return"scope."+t;if(null!=e.logRecords&&e.hasOwnProperty("logRecords")){if(!Array.isArray(e.logRecords))return"logRecords: array expected";for(var t,r=0;r<e.logRecords.length;++r)if(t=Bs.opentelemetry.proto.logs.v1.LogRecord.verify(e.logRecords[r]))return"logRecords."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!Vs.isString(e.schemaUrl)?"schemaUrl: string expected":null},s.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.logs.v1.ScopeLogs)return e;var t=new Bs.opentelemetry.proto.logs.v1.ScopeLogs;if(null!=e.scope){if("object"!=typeof e.scope)throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.scope: object expected");t.scope=Bs.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.logRecords){if(!Array.isArray(e.logRecords))throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: array expected");t.logRecords=[];for(var r=0;r<e.logRecords.length;++r){if("object"!=typeof e.logRecords[r])throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: object expected");t.logRecords[r]=Bs.opentelemetry.proto.logs.v1.LogRecord.fromObject(e.logRecords[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},s.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.logRecords=[]),t.defaults&&(r.scope=null,r.schemaUrl=""),null!=e.scope&&e.hasOwnProperty("scope")&&(r.scope=Bs.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,t)),e.logRecords&&e.logRecords.length){r.logRecords=[];for(var n=0;n<e.logRecords.length;++n)r.logRecords[n]=Bs.opentelemetry.proto.logs.v1.LogRecord.toObject(e.logRecords[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.ScopeLogs"},s),r.SeverityNumber=(e={},(t=Object.create(e))[e[0]="SEVERITY_NUMBER_UNSPECIFIED"]=0,t[e[1]="SEVERITY_NUMBER_TRACE"]=1,t[e[2]="SEVERITY_NUMBER_TRACE2"]=2,t[e[3]="SEVERITY_NUMBER_TRACE3"]=3,t[e[4]="SEVERITY_NUMBER_TRACE4"]=4,t[e[5]="SEVERITY_NUMBER_DEBUG"]=5,t[e[6]="SEVERITY_NUMBER_DEBUG2"]=6,t[e[7]="SEVERITY_NUMBER_DEBUG3"]=7,t[e[8]="SEVERITY_NUMBER_DEBUG4"]=8,t[e[9]="SEVERITY_NUMBER_INFO"]=9,t[e[10]="SEVERITY_NUMBER_INFO2"]=10,t[e[11]="SEVERITY_NUMBER_INFO3"]=11,t[e[12]="SEVERITY_NUMBER_INFO4"]=12,t[e[13]="SEVERITY_NUMBER_WARN"]=13,t[e[14]="SEVERITY_NUMBER_WARN2"]=14,t[e[15]="SEVERITY_NUMBER_WARN3"]=15,t[e[16]="SEVERITY_NUMBER_WARN4"]=16,t[e[17]="SEVERITY_NUMBER_ERROR"]=17,t[e[18]="SEVERITY_NUMBER_ERROR2"]=18,t[e[19]="SEVERITY_NUMBER_ERROR3"]=19,t[e[20]="SEVERITY_NUMBER_ERROR4"]=20,t[e[21]="SEVERITY_NUMBER_FATAL"]=21,t[e[22]="SEVERITY_NUMBER_FATAL2"]=22,t[e[23]="SEVERITY_NUMBER_FATAL3"]=23,t[e[24]="SEVERITY_NUMBER_FATAL4"]=24,t),r.LogRecordFlags=(e={},(t=Object.create(e))[e[0]="LOG_RECORD_FLAGS_DO_NOT_USE"]=0,t[e[255]="LOG_RECORD_FLAGS_TRACE_FLAGS_MASK"]=255,t),r.LogRecord=(o.prototype.timeUnixNano=null,o.prototype.observedTimeUnixNano=null,o.prototype.severityNumber=null,o.prototype.severityText=null,o.prototype.body=null,o.prototype.attributes=Vs.emptyArray,o.prototype.droppedAttributesCount=null,o.prototype.flags=null,o.prototype.traceId=null,o.prototype.spanId=null,o.prototype.eventName=null,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Ms.create(),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(9).fixed64(e.timeUnixNano),null!=e.severityNumber&&Object.hasOwnProperty.call(e,"severityNumber")&&t.uint32(16).int32(e.severityNumber),null!=e.severityText&&Object.hasOwnProperty.call(e,"severityText")&&t.uint32(26).string(e.severityText),null!=e.body&&Object.hasOwnProperty.call(e,"body")&&Bs.opentelemetry.proto.common.v1.AnyValue.encode(e.body,t.uint32(42).fork()).ldelim(),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Bs.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(50).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(56).uint32(e.droppedAttributesCount),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(69).fixed32(e.flags),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(74).bytes(e.traceId),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(82).bytes(e.spanId),null!=e.observedTimeUnixNano&&Object.hasOwnProperty.call(e,"observedTimeUnixNano")&&t.uint32(89).fixed64(e.observedTimeUnixNano),null!=e.eventName&&Object.hasOwnProperty.call(e,"eventName")&&t.uint32(98).string(e.eventName),t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Ds||(e=Ds.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Bs.opentelemetry.proto.logs.v1.LogRecord;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.timeUnixNano=e.fixed64();break;case 11:o.observedTimeUnixNano=e.fixed64();break;case 2:o.severityNumber=e.int32();break;case 3:o.severityText=e.string();break;case 5:o.body=Bs.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32());break;case 6:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Bs.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 7:o.droppedAttributesCount=e.uint32();break;case 8:o.flags=e.fixed32();break;case 9:o.traceId=e.bytes();break;case 10:o.spanId=e.bytes();break;case 12:o.eventName=e.string();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof Ds||(e=new Ds(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(Vs.isInteger(e.timeUnixNano)||e.timeUnixNano&&Vs.isInteger(e.timeUnixNano.low)&&Vs.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.observedTimeUnixNano&&e.hasOwnProperty("observedTimeUnixNano")&&!(Vs.isInteger(e.observedTimeUnixNano)||e.observedTimeUnixNano&&Vs.isInteger(e.observedTimeUnixNano.low)&&Vs.isInteger(e.observedTimeUnixNano.high)))return"observedTimeUnixNano: integer|Long expected";if(null!=e.severityNumber&&e.hasOwnProperty("severityNumber"))switch(e.severityNumber){default:return"severityNumber: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:}if(null!=e.severityText&&e.hasOwnProperty("severityText")&&!Vs.isString(e.severityText))return"severityText: string expected";if(null!=e.body&&e.hasOwnProperty("body")&&(t=Bs.opentelemetry.proto.common.v1.AnyValue.verify(e.body)))return"body."+t;if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t,r=0;r<e.attributes.length;++r)if(t=Bs.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[r]))return"attributes."+t}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!Vs.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null!=e.flags&&e.hasOwnProperty("flags")&&!Vs.isInteger(e.flags)?"flags: integer expected":null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||Vs.isString(e.traceId))?"traceId: buffer expected":null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||Vs.isString(e.spanId))?"spanId: buffer expected":null!=e.eventName&&e.hasOwnProperty("eventName")&&!Vs.isString(e.eventName)?"eventName: string expected":null},o.fromObject=function(e){if(e instanceof Bs.opentelemetry.proto.logs.v1.LogRecord)return e;var t=new Bs.opentelemetry.proto.logs.v1.LogRecord;switch(null!=e.timeUnixNano&&(Vs.Long?(t.timeUnixNano=Vs.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new Vs.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.observedTimeUnixNano&&(Vs.Long?(t.observedTimeUnixNano=Vs.Long.fromValue(e.observedTimeUnixNano)).unsigned=!1:"string"==typeof e.observedTimeUnixNano?t.observedTimeUnixNano=parseInt(e.observedTimeUnixNano,10):"number"==typeof e.observedTimeUnixNano?t.observedTimeUnixNano=e.observedTimeUnixNano:"object"==typeof e.observedTimeUnixNano&&(t.observedTimeUnixNano=new Vs.LongBits(e.observedTimeUnixNano.low>>>0,e.observedTimeUnixNano.high>>>0).toNumber())),e.severityNumber){default:"number"==typeof e.severityNumber&&(t.severityNumber=e.severityNumber);break;case"SEVERITY_NUMBER_UNSPECIFIED":case 0:t.severityNumber=0;break;case"SEVERITY_NUMBER_TRACE":case 1:t.severityNumber=1;break;case"SEVERITY_NUMBER_TRACE2":case 2:t.severityNumber=2;break;case"SEVERITY_NUMBER_TRACE3":case 3:t.severityNumber=3;break;case"SEVERITY_NUMBER_TRACE4":case 4:t.severityNumber=4;break;case"SEVERITY_NUMBER_DEBUG":case 5:t.severityNumber=5;break;case"SEVERITY_NUMBER_DEBUG2":case 6:t.severityNumber=6;break;case"SEVERITY_NUMBER_DEBUG3":case 7:t.severityNumber=7;break;case"SEVERITY_NUMBER_DEBUG4":case 8:t.severityNumber=8;break;case"SEVERITY_NUMBER_INFO":case 9:t.severityNumber=9;break;case"SEVERITY_NUMBER_INFO2":case 10:t.severityNumber=10;break;case"SEVERITY_NUMBER_INFO3":case 11:t.severityNumber=11;break;case"SEVERITY_NUMBER_INFO4":case 12:t.severityNumber=12;break;case"SEVERITY_NUMBER_WARN":case 13:t.severityNumber=13;break;case"SEVERITY_NUMBER_WARN2":case 14:t.severityNumber=14;break;case"SEVERITY_NUMBER_WARN3":case 15:t.severityNumber=15;break;case"SEVERITY_NUMBER_WARN4":case 16:t.severityNumber=16;break;case"SEVERITY_NUMBER_ERROR":case 17:t.severityNumber=17;break;case"SEVERITY_NUMBER_ERROR2":case 18:t.severityNumber=18;break;case"SEVERITY_NUMBER_ERROR3":case 19:t.severityNumber=19;break;case"SEVERITY_NUMBER_ERROR4":case 20:t.severityNumber=20;break;case"SEVERITY_NUMBER_FATAL":case 21:t.severityNumber=21;break;case"SEVERITY_NUMBER_FATAL2":case 22:t.severityNumber=22;break;case"SEVERITY_NUMBER_FATAL3":case 23:t.severityNumber=23;break;case"SEVERITY_NUMBER_FATAL4":case 24:t.severityNumber=24}if(null!=e.severityText&&(t.severityText=String(e.severityText)),null!=e.body){if("object"!=typeof e.body)throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.body: object expected");t.body=Bs.opentelemetry.proto.common.v1.AnyValue.fromObject(e.body)}if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: object expected");t.attributes[r]=Bs.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),null!=e.flags&&(t.flags=e.flags>>>0),null!=e.traceId&&("string"==typeof e.traceId?Vs.base64.decode(e.traceId,t.traceId=Vs.newBuffer(Vs.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),null!=e.spanId&&("string"==typeof e.spanId?Vs.base64.decode(e.spanId,t.spanId=Vs.newBuffer(Vs.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.eventName&&(t.eventName=String(e.eventName)),t},o.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[]),t.defaults&&(Vs.Long?(r=new Vs.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,n.severityNumber=t.enums===String?"SEVERITY_NUMBER_UNSPECIFIED":0,n.severityText="",n.body=null,n.droppedAttributesCount=0,n.flags=0,t.bytes===String?n.traceId="":(n.traceId=[],t.bytes!==Array&&(n.traceId=Vs.newBuffer(n.traceId))),t.bytes===String?n.spanId="":(n.spanId=[],t.bytes!==Array&&(n.spanId=Vs.newBuffer(n.spanId))),Vs.Long?(r=new Vs.Long(0,0,!1),n.observedTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.observedTimeUnixNano=t.longs===String?"0":0,n.eventName=""),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?Vs.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new Vs.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.severityNumber&&e.hasOwnProperty("severityNumber")&&(n.severityNumber=t.enums!==String||void 0===Bs.opentelemetry.proto.logs.v1.SeverityNumber[e.severityNumber]?e.severityNumber:Bs.opentelemetry.proto.logs.v1.SeverityNumber[e.severityNumber]),null!=e.severityText&&e.hasOwnProperty("severityText")&&(n.severityText=e.severityText),null!=e.body&&e.hasOwnProperty("body")&&(n.body=Bs.opentelemetry.proto.common.v1.AnyValue.toObject(e.body,t)),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=Bs.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(n.droppedAttributesCount=e.droppedAttributesCount),null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),null!=e.traceId&&e.hasOwnProperty("traceId")&&(n.traceId=t.bytes===String?Vs.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.spanId&&e.hasOwnProperty("spanId")&&(n.spanId=t.bytes===String?Vs.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.observedTimeUnixNano&&e.hasOwnProperty("observedTimeUnixNano")&&("number"==typeof e.observedTimeUnixNano?n.observedTimeUnixNano=t.longs===String?String(e.observedTimeUnixNano):e.observedTimeUnixNano:n.observedTimeUnixNano=t.longs===String?Vs.Long.prototype.toString.call(e.observedTimeUnixNano):t.longs===Number?new Vs.LongBits(e.observedTimeUnixNano.low>>>0,e.observedTimeUnixNano.high>>>0).toNumber():e.observedTimeUnixNano),null!=e.eventName&&e.hasOwnProperty("eventName")&&(n.eventName=e.eventName),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,js.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.LogRecord"},o),r),n;function o(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(this.logRecords=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(this.scopeLogs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.resourceLogs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),ks),Ls),Bs);function qs(e){return 48<=e&&e<=57?e-48:97<=e&&e<=102?e-87:e-55}function Hs(t){var r=new Uint8Array(t.length/2);let n=0;for(let e=0;e<t.length;e+=2){var o=qs(t.charCodeAt(e)),s=qs(t.charCodeAt(e+1));r[n++]=o<<4|s}return r}function Gs(e){var t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function zs(e){return e=Gs(e),{low:Number(BigInt.asUintN(32,e)),high:Number(BigInt.asUintN(32,e>>BigInt(32)))}}let Ks="undefined"!=typeof BigInt?function(e){return Gs(e).toString()}:function(e){return e[0]*Vo+e[1]};function Ys(e){return e}function Ws(e){if(void 0!==e)return Hs(e)}let $s={encodeHrTime:zs,encodeSpanContext:Hs,encodeOptionalSpanContext:Ws};function Js(e){var t;return void 0===e?$s:(t=e.useLongBits??!0,e=e.useHex??!1,{encodeHrTime:t?zs:Ks,encodeSpanContext:e?Ys:Hs,encodeOptionalSpanContext:e?Ys:Ws})}function Xs(e){var t={attributes:Zs(e.attributes),droppedAttributesCount:0},e=e.schemaUrl;return e&&""!==e&&(t.schemaUrl=e),t}function Qs(e){return{name:e.name,version:e.version}}function Zs(t){return Object.keys(t).map(e=>ea(e,t[e]))}function ea(e,t){return{key:e,value:ta(t)}}function ta(e){var t=typeof e;return"string"==t?{stringValue:e}:"number"==t?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:"boolean"==t?{boolValue:e}:e instanceof Uint8Array?{bytesValue:e}:Array.isArray(e)?{arrayValue:{values:e.map(ta)}}:"object"==t&&null!=e?{kvlistValue:{values:Object.entries(e).map(([e,t])=>ea(e,t))}}:{}}function ra(e,r){e=(e=>{var i,a=new Map;for(i of e){let{resource:e,instrumentationScope:{name:t,version:r="",schemaUrl:n=""}}=i,o=a.get(e);o||(o=new Map,a.set(e,o));var u=t+`@${r}:`+n;let s=o.get(u);s||(s=[],o.set(u,s)),s.push(i)}return a})(e);return Array.from(e,([e,t])=>{e=Xs(e);return{resource:e,scopeLogs:Array.from(t,([,e])=>({scope:Qs(e[0].instrumentationScope),logRecords:e.map(e=>{return e=e,{timeUnixNano:(t=r).encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:ta(e.body),eventName:e.eventName,attributes:na(e.attributes),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)};var t}),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:e.schemaUrl}})}function na(t){return Object.keys(t).map(e=>ea(e,t[e]))}Fs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,Fs.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,(e=>{e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE"})(oa=oa||{}),(e=>{e.COUNTER="COUNTER",e.GAUGE="GAUGE",e.HISTOGRAM="HISTOGRAM",e.UP_DOWN_COUNTER="UP_DOWN_COUNTER",e.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",e.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",e.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(ia=ia||{}),(e=>{e[e.HISTOGRAM=0]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",e[e.GAUGE=2]="GAUGE",e[e.SUM=3]="SUM"})(sa=sa||{}),(e=>{e[e.DROP=0]="DROP",e[e.SUM=1]="SUM",e[e.LAST_VALUE=2]="LAST_VALUE",e[e.HISTOGRAM=3]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(aa=aa||{});let ua=1023,la=ua,ca=Math.pow(2,-1022);function pa(e){var t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((2146435072&t.getUint32(0))>>20)-ua}function da(e){var t=new DataView(new ArrayBuffer(8)),e=(t.setFloat64(0,e),t.getUint32(0)),t=t.getUint32(4);return(1048575&e)*Math.pow(2,32)+t}function ha(e,t){return 0===e||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}class fa extends Error{}class ma{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<ca?this._minNormalLowerBoundaryIndex():pa(e)+this._rightShift(da(e)-1,52)>>this._shift}lowerBoundary(e){var t=this._minNormalLowerBoundaryIndex();if(e<t)throw new fa(`underflow: ${e} is < minimum lower boundary: `+t);t=this._maxNormalLowerBoundaryIndex();if(t<e)throw new fa(`overflow: ${e} is > maximum lower boundary: `+t);return ha(1,e<<this._shift)}get scale(){return 0===this._shift?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=-1022>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return la>>this._shift}_rightShift(e,t){return Math.floor(e*Math.pow(2,-t))}}class ga{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=ha(Math.LOG2E,e),this._inverseFactor=ha(Math.LN2,-e)}mapToIndex(e){var t;return e<=ca?this._minNormalLowerBoundaryIndex()-1:0===da(e)?(pa(e)<<this._scale)-1:(e=Math.floor(Math.log(e)*this._scaleFactor),(t=this._maxNormalLowerBoundaryIndex())<=e?t:e)}lowerBoundary(e){var t=this._maxNormalLowerBoundaryIndex();if(t<=e){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new fa(`overflow: ${e} is > maximum lower boundary: `+t)}t=this._minNormalLowerBoundaryIndex();if(e<=t){if(e===t)return ca;if(e===t-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new fa(`overflow: ${e} is < minimum lower boundary: `+t)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return-1022<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}}Array.from({length:31},(e,t)=>new(10<t?ga:ma)(t-10)),(e=>{e[e.DEFAULT=0]="DEFAULT",e[e.DROP=1]="DROP",e[e.SUM=2]="SUM",e[e.LAST_VALUE=3]="LAST_VALUE",e[e.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM"})(ya=ya||{});let _a=e=>null!==e&&"object"==typeof e&&"function"==typeof e.then;class va{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,t){t=new va({},t);return t._rawAttributes=Ta(e),t._asyncAttributesPending=0<e.filter(([,e])=>_a(e)).length,t}constructor(e,t){var e=e.attributes??{};this._rawAttributes=Object.entries(e).map(([e,t])=>(_a(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=Ta(this._rawAttributes),this._schemaUrl="string"==typeof(e=t?.schemaUrl)||void 0===e?e:void ro.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){var[t,r]=this._rawAttributes[e];this._rawAttributes[e]=[t,_a(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&ro.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;var e,t,r={};for([e,t]of this._rawAttributes)_a(t)?ro.debug(`Unsettled resource attribute ${e} skipped`):null!=t&&(r[e]??=t);return this._asyncAttributesPending||(this._memoizedAttributes=r),r}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){var t,r;return null==e?this:(t=(t=this)?.schemaUrl,r=e?.schemaUrl,r=(t=void 0===t||""===t?r:void 0===r||""===r||t===r?t:void ro.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',t,r))?{schemaUrl:t}:void 0,va.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r))}}function ba(){return e={[Io]:"unknown_service",[Po]:Do[Po],[ko]:Do[ko],[Lo]:Do[Lo]},va.FromAttributeList(Object.entries(e),void 0);var e}function Ta(e){return e.map(([t,e])=>_a(e)?[t,e.catch(e=>{ro.debug("promise rejection for resource attribute: %s - %s",t,e)})]:[t,e])}function wa(e,t){let r=255&e|256;return t&&(r|=512),r}function Ea(e,r){var t=e.spanContext(),n=e.status,o=e.parentSpanContext?.spanId?r.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:r.encodeSpanContext(t.traceId),spanId:r.encodeSpanContext(t.spanId),parentSpanId:o,traceState:t.traceState?.serialize(),name:e.name,kind:null==e.kind?0:e.kind+1,startTimeUnixNano:r.encodeHrTime(e.startTime),endTimeUnixNano:r.encodeHrTime(e.endTime),attributes:Zs(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>{return t=r,{attributes:(e=e).attributes?Zs(e.attributes):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0};var t}),droppedEventsCount:e.droppedEventsCount,status:{code:n.code,message:n.message},links:e.links.map(e=>{return t=r,{attributes:(e=e).attributes?Zs(e.attributes):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:wa(e.context.traceFlags,e.context.isRemote)};var t}),droppedLinksCount:e.droppedLinksCount,flags:wa(t.traceFlags,e.parentSpanContext?.isRemote)}}function Aa(e,s){let t=(e=>{var r,n=new Map;for(r of e){let e=n.get(r.resource);e||(e=new Map,n.set(r.resource,e));var o=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:`+(r.instrumentationScope.schemaUrl||"");let t=e.get(o);t||(t=[],e.set(o,t)),t.push(r)}return n})(e),i=[],a=t.entries(),u=a.next();for(;!u.done;){let[e,t]=u.value,r=[],n=t.values(),o=n.next();for(;!o.done;){let t=o.value;if(0<t.length){let e=t.map(e=>Ea(e,s));r.push({scope:Qs(t[0].instrumentationScope),spans:e,schemaUrl:t[0].instrumentationScope.schemaUrl})}o=n.next()}var l=Xs(e),l={resource:l,scopeSpans:r,schemaUrl:l.schemaUrl};i.push(l),u=a.next()}return i}(e=>{e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",e[e.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(Sa=Sa||{}),Fs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,Fs.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,Fs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,Fs.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;let Oa={serializeRequest:e=>{e={resourceLogs:ra(e,Js({useHex:!0,useLongBits:!1}))};return(new TextEncoder).encode(JSON.stringify(e))},deserializeResponse:e=>{var t;return 0===e.length?{}:(t=new TextDecoder,JSON.parse(t.decode(e)))}},xa={serializeRequest:e=>{e={resourceSpans:Aa(e,Js({useHex:!0,useLongBits:!1}))};return(new TextEncoder).encode(JSON.stringify(e))},deserializeResponse:e=>{var t;return 0===e.length?{}:(t=new TextDecoder,JSON.parse(t.decode(e)))}};function Ca(){return.4*Math.random()-.2}class Ra{_transport;constructor(e){this._transport=e}retry(r,n,o){return new Promise((e,t)=>{setTimeout(()=>{this._transport.send(r,n).then(e,t)},o)})}async send(t,e){var r=Date.now()+e;let n=await this._transport.send(t,e),o=5,s=1e3;for(;"retryable"===n.status&&0<o;){o--;let e=Math.max(Math.min(s,5e3)+Ca(),0);s*=1.5;var i=n.retryInMillis??e,a=r-Date.now();if(a<i)return n;n=await this.retry(t,a,i)}return n}shutdown(){return this._transport.shutdown()}}function Na(e){return new Ra(e.transport)}function Ia(e){return[429,502,503,504].includes(e)}function Pa(e){var t;if(null!=e)return t=Number.parseInt(e,10),Number.isInteger(t)?0<t?1e3*t:-1:0<=(t=new Date(e).getTime()-Date.now())?t:0}class Ua{_parameters;constructor(e){this._parameters=e}async send(e,n){let o=await this._parameters.headers();return new Promise(t=>{let r=new XMLHttpRequest;r.timeout=n,r.open("POST",this._parameters.url),Object.entries(o).forEach(([e,t])=>{r.setRequestHeader(e,t)}),r.ontimeout=e=>{t({status:"failure",error:new Error("XHR request timed out")})},r.onreadystatechange=()=>{200<=r.status&&r.status<=299?(ro.debug("XHR success"),t({status:"success"})):r.status&&Ia(r.status)?t({status:"retryable",retryInMillis:Pa(r.getResponseHeader("Retry-After"))}):0!==r.status&&t({status:"failure",error:new Error("XHR request failed with non-retryable status")})},r.onabort=()=>{t({status:"failure",error:new Error("XHR request aborted")})},r.onerror=()=>{t({status:"failure",error:new Error("XHR request errored")})},r.send(e)})}shutdown(){}}class ka{_params;constructor(e){this._params=e}async send(t){let r=(await this._params.headers())["Content-Type"];return new Promise(e=>{navigator.sendBeacon(this._params.url,new Blob([t],{type:r}))?(ro.debug("SendBeacon success"),e({status:"success"})):e({status:"failure",error:new Error("SendBeacon failed")})})}shutdown(){}}class La{_parameters;constructor(e){this._parameters=e}async send(n,e){let o=new AbortController,t=setTimeout(()=>o.abort(),e);try{let e=!!globalThis.location,t=new URL(this._parameters.url),r=await fetch(t.href,{method:"POST",headers:await this._parameters.headers(),body:n,signal:o.signal,keepalive:e,mode:e?globalThis.location?.origin===t.origin?"same-origin":"cors":"no-cors"});if(200<=r.status&&r.status<=299)return ro.debug("response success"),{status:"success"};if(Ia(r.status)){let e=r.headers.get("Retry-After");return{status:"retryable",retryInMillis:Pa(e)}}return{status:"failure",error:new Error("Fetch request failed with non-retryable status")}}catch(n){return"AbortError"===n?.name?{status:"failure",error:new Error("Fetch request timed out",{cause:n})}:{status:"failure",error:new Error("Fetch request errored",{cause:n})}}finally{clearTimeout(t)}}shutdown(){}}function ja(e,t){return gi(e,t,Na({transport:(t=e,new Ua(t))}))}function Da(e,t){return gi(e,t,Na({transport:(t=e,new La(t))}))}function Ma(e,t){return gi(e,t,Na({transport:(t={url:e.url,headers:e.headers},new ka(t))}))}function Va(r,n,o){return async()=>{var e={...await o()},t={};return null!=n&&Object.assign(t,await n()),null!=r&&Object.assign(t,(e=>{let r={};return Object.entries(e??{}).forEach(([e,t])=>{void 0!==t?r[e]=String(t):ro.warn(`Header "${e}" has invalid value (${t}) and will be ignored`)}),r})(await r())),Object.assign(t,e)}}function Ba(e){if(null!=e)try{var t=globalThis.location?.href;return new URL(e,t).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function Fa(e){var t;return"function"==typeof e.headers?e.headers:null!=(t=e.headers)?async()=>t:void 0}function qa(e,t,r){return e={url:e.url,timeoutMillis:e.timeoutMillis,headers:Fa(e),concurrencyLimit:e.concurrencyLimit},n=r,{...pr(e,r={},t={timeoutMillis:1e4,concurrencyLimit:30,compression:"none",headers:async()=>n,url:"http://localhost:4318/"+t}),headers:Va(e.headers,r.headers,t.headers),url:Ba(e.url)??r.url??t.url};var n}function Ha(e,t,r,n){return(e.headers||"function"!=typeof navigator.sendBeacon?void 0!==globalThis.fetch?Da:ja:Ma)(qa(e,r,n),t)}var Ga,za=Object.freeze({__proto__:null,OTLPLogExporter:class extends ur{constructor(e={}){super(Ha(e,Oa,"v1/logs",{"Content-Type":"application/json"}))}}}),Ka=n(za);(e=>{e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRACE=1]="TRACE",e[e.TRACE2=2]="TRACE2",e[e.TRACE3=3]="TRACE3",e[e.TRACE4=4]="TRACE4",e[e.DEBUG=5]="DEBUG",e[e.DEBUG2=6]="DEBUG2",e[e.DEBUG3=7]="DEBUG3",e[e.DEBUG4=8]="DEBUG4",e[e.INFO=9]="INFO",e[e.INFO2=10]="INFO2",e[e.INFO3=11]="INFO3",e[e.INFO4=12]="INFO4",e[e.WARN=13]="WARN",e[e.WARN2=14]="WARN2",e[e.WARN3=15]="WARN3",e[e.WARN4=16]="WARN4",e[e.ERROR=17]="ERROR",e[e.ERROR2=18]="ERROR2",e[e.ERROR3=19]="ERROR3",e[e.ERROR4=20]="ERROR4",e[e.FATAL=21]="FATAL",e[e.FATAL2=22]="FATAL2",e[e.FATAL3=23]="FATAL3",e[e.FATAL4=24]="FATAL4"})(Ga=Ga||{});class Ya{emit(e){}}let Wa=new Ya,$a=new class{getLogger(e,t,r){return new Ya}};class Ja{constructor(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}emit(e){this._getLogger().emit(e)}_getLogger(){var e;return this._delegate||((e=this._provider._getDelegateLogger(this.name,this.version,this.options))?(this._delegate=e,this._delegate):Wa)}}class Xa{getLogger(e,t,r){var n;return null!=(n=this._getDelegateLogger(e,t,r))?n:new Ja(this,e,t,r)}_getDelegate(){var e;return null!=(e=this._delegate)?e:$a}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,r){var n;return null==(n=this._delegate)?void 0:n.getLogger(e,t,r)}}let Qa="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof J?J:{},Za=Symbol.for("io.opentelemetry.js.api.logs"),eu=Qa;class tu{constructor(){this._proxyLoggerProvider=new Xa}static getInstance(){return this._instance||(this._instance=new tu),this._instance}setGlobalLoggerProvider(e){return eu[Za]?this.getLoggerProvider():(eu[Za]=(t=e,r=$a,e=>1===e?t:r),this._proxyLoggerProvider._setDelegate(e),e);var t,r}getLoggerProvider(){var e;return null!=(e=null==(e=eu[Za])?void 0:e.call(eu,1))?e:this._proxyLoggerProvider}getLogger(e,t,r){return this.getLoggerProvider().getLogger(e,t,r)}disable(){delete eu[Za],this._proxyLoggerProvider=new Xa}}let ru=tu.getInstance();var nu=n(Object.freeze({__proto__:null,logs:ru,get SeverityNumber(){return Ga},NOOP_LOGGER:Wa,NoopLogger:Ya,ProxyLoggerProvider:Xa}));class ou{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;totalAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,t,r){var{timestamp:r,observedTimestamp:n,eventName:o,severityNumber:s,severityText:i,body:a,attributes:u={},context:l}=r,c=Date.now();if(this.hrTime=Ho(r??c),this.hrTimeObserved=Ho(n??c),l){let e=bo.getSpanContext(l);e&&Vn(e)&&(this.spanContext=e)}this.severityNumber=s,this.severityText=i,this.body=a,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=o,this.setAttributes(u)}setAttribute(e,t){return this._isLogRecordReadonly()||null===t||(0===e.length?ro.warn("Invalid attribute key: "+e):Eo(t)||"object"==typeof t&&!Array.isArray(t)&&0<Object.keys(t).length?(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?1===this.droppedAttributesCount&&ro.warn("Dropping extra attributes."):Eo(t)?this.attributes[e]=this._truncateToSize(t):this.attributes[e]=t):ro.warn("Invalid attribute value set for key: "+e)),this}setAttributes(e){for(var[t,r]of Object.entries(e))this.setAttribute(t,r);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;return t<=0?(ro.warn("Attribute value limit must be positive, got "+t),e):"string"==typeof e?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>"string"==typeof e?this._truncateToLimitUtil(e,t):e):e}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&ro.warn("Can not execute the operation on emitted log record"),this._isReadonly}}class iu{instrumentationScope;_sharedState;constructor(e,t){this.instrumentationScope=e,this._sharedState=t}emit(e){var t=e.context||to.active(),e=new ou(this._sharedState,this.instrumentationScope,{context:t,...e});this._sharedState.activeProcessor.onEmit(e,t),e._makeReadonly()}}class su{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}}class au{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let t=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(e=>ci(e.forceFlush(),t)))}onEmit(t,r){this.processors.forEach(e=>e.onEmit(t,r))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}}class uu{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,t,r,n){this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=r,0<(this.processors=n).length?(this.registeredLogRecordProcessors=n,this.activeProcessor=new au(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new su}}class lu{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,t){this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new di(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(ro.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{var r=[],n=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let e=0;e<n;e++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),0===this._finishedLogRecords.length?Promise.resolve():new Promise((e,t)=>{ci(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis).then(()=>e()).catch(t)})}_maybeStartTimer(){if(!this._isExporting){let e=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,0<this._finishedLogRecords.length&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,xo(e)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return e();void 0===this._timer&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),"number"!=typeof this._timer)&&this._timer.unref()}}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){var t=()=>hi._export(this._exporter,e).then(e=>{e.code!==Go.SUCCESS&&xo(e.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${e})`))}).catch(xo),r=e.map(e=>e.resource).filter(e=>e.asyncAttributesPending);return 0===r.length?t():Promise.all(r.map(e=>e.waitForAsyncAttributes?.())).then(t,xo)}}var ju,$u,cu=Object.freeze({__proto__:null,LoggerProvider:class{_shutdownOnce;_sharedState;constructor(e={}){var t=(e=>{let t=e.shift();for(var r=new WeakMap;0<e.length;)t=ni(t,e.shift(),0,r);return t})([{},{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},includeTraceContext:!0},e]),r=e.resource??ba();this._sharedState=new uu(r,t.forceFlushTimeoutMillis,{attributeCountLimit:(r=t.logRecordLimits).attributeCountLimit??128,attributeValueLengthLimit:r.attributeValueLengthLimit??1/0},e?.processors??[]),this._shutdownOnce=new di(this._shutdown,this)}getLogger(e,t,r){if(this._shutdownOnce.isCalled)return ro.warn("A shutdown LoggerProvider cannot provide a Logger"),Wa;e||ro.warn("Logger requested without instrumentation scope name.");var e=e||"unknown",n=e+`@${t||""}:`+(r?.schemaUrl||"");return this._sharedState.loggers.has(n)||this._sharedState.loggers.set(n,new iu({name:e,version:t,schemaUrl:r?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(n)}forceFlush(){return this._shutdownOnce.isCalled?(ro.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(ro.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}},ConsoleLogRecordExporter:class{export(e,t){this._sendLogRecords(e,t)}shutdown(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:1e6*(t=e.hrTime)[0]+t[1]/1e3,traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,body:e.body,attributes:e.attributes};var t}_sendLogRecords(t,e){for(let e of t)console.dir(this._exportInfo(e),{depth:3});e?.({code:Go.SUCCESS})}},SimpleLogRecordProcessor:class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new di(this._shutdown,this),this._unresolvedExports=new Set}onEmit(r){if(!this._shutdownOnce.isCalled){let t=()=>hi._export(this._exporter,[r]).then(e=>{e.code!==Go.SUCCESS&&xo(e.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${e})`))}).catch(xo);if(r.resource.asyncAttributesPending){let e=r.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(e),t()),xo);null!=e&&this._unresolvedExports.add(e)}else t()}}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}},InMemoryLogRecordExporter:class{_finishedLogRecords=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:Go.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),t({code:Go.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}},BatchLogRecordProcessor:class extends lu{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this._onInit(t)}onShutdown(){"undefined"!=typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener)&&document.removeEventListener("pagehide",this._pageHideListener)}_onInit(e){!0!==e?.disableAutoFlushOnDocumentHide&&"undefined"!=typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}}}),pu=n(cu);let du=Vr("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function hu(e){return e.setValue(du,!0)}function fu(e){return!0===e.getValue(du)}let mu="baggage";class gu{inject(e,r,n){var o=yo.getBaggage(e);if(o&&!fu(e)){let e=o.getAllEntries().map(([e,t])=>{let r=encodeURIComponent(e)+"="+encodeURIComponent(t.value);return void 0!==t.metadata&&(r+=";"+t.metadata.toString()),r}).filter(e=>e.length<=4096).slice(0,180),t=e.reduce((e,t)=>{t=e+(""!==e?",":"")+t;return 8192<t.length?e:t},"");0<t.length&&n.set(r,mu,t)}}extract(e,t,r){r=r.get(t,mu),t=Array.isArray(r)?r.join(","):r;if(!t)return e;let n={};return 0===t.length||(t.split(",").forEach(e=>{var t=(n=>{if(n){var o=n.indexOf(";"),s=-1===o?n:n.substring(0,o),e=s.indexOf("=");if(!(e<=0)){var i=s.substring(0,e).trim(),s=s.substring(e+1).trim();if(i&&s){let e,t,r;try{e=decodeURIComponent(i),t=decodeURIComponent(s)}catch{return}return-1!==o&&o<n.length-1&&(r=Mr(n.substring(o+1))),{key:e,value:t,metadata:r}}}}})(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),n[t.key]=e}}),0===Object.entries(n).length)?e:yo.setBaggage(e,yo.createBaggage(n))}fields(){return[mu]}}function yu(e){var t,r={};if("object"==typeof e&&null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(_u(n)?vu(t=e[n])?Array.isArray(t)?r[n]=t.slice():r[n]=t:ro.warn("Invalid attribute value set for key: "+n):ro.warn("Invalid attribute key: "+n));return r}function _u(e){return"string"==typeof e&&""!==e}function vu(e){return null==e||(Array.isArray(e)?(e=>{let t;for(var r of e)if(null!=r){let e=typeof r;if(e!==t){if(t||!bu(e))return!1;t=e}}return!0})(e):bu(typeof e))}function bu(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}let Tu=e=>{var t;ro.error("string"==typeof(t=e)?t:JSON.stringify((()=>{let r={},n=t;for(;null!==n;)Object.getOwnPropertyNames(n).forEach(e=>{var t;r[e]||(t=n[e])&&(r[e]=String(t))}),n=Object.getPrototypeOf(n);return r})()))};function Su(e){try{Tu(e)}catch{}}let wu="process.runtime.name",Eu={[ko]:"opentelemetry",[wu]:"browser",[Po]:Uo,[Lo]:"2.7.1"},Au=performance,Ou=Math.pow(10,6),xu=Math.pow(10,9);function Cu(e){return[Math.trunc(e/1e3),Math.round(e%1e3*Ou)]}function Ru(e){return Lu(Cu(Au.timeOrigin),Cu("number"==typeof e?e:Au.now()))}function Nu(e){if(Uu(e))return e;if("number"==typeof e)return(e<Au.timeOrigin?Ru:Cu)(e);if(e instanceof Date)return Cu(e.getTime());throw TypeError("Invalid input type")}function Iu(e){return e[0]*xu+e[1]}function Pu(e){return 1e6*e[0]+e[1]/1e3}function Uu(e){return Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function ku(e){return Uu(e)||"number"==typeof e||e instanceof Date}function Lu(e,t){e=[e[0]+t[0],e[1]+t[1]];return e[1]>=xu&&(e[1]-=xu,e[0]+=1),e}(e=>{e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(ju=ju||{});class Du{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[];var t=new Set;for(let e of this._propagators){var r="function"==typeof e.fields?e.fields():[];for(let e of r)t.add(e)}this._fields=Array.from(t)}inject(e,t,r){for(var n of this._propagators)try{n.inject(e,t,r)}catch(e){ro.warn(`Failed to inject with ${n.constructor.name}. Err: `+e.message)}}extract(e,r,n){return this._propagators.reduce((e,t)=>{try{return t.extract(e,r,n)}catch(e){ro.warn(`Failed to extract with ${t.constructor.name}. Err: `+e.message)}return e},e)}fields(){return this._fields.slice()}}let Mu="[_0-9a-z-*/]",Vu=new RegExp(`^(?:${`[a-z]${Mu}{0,255}`}|${`[a-z0-9]${Mu}{0,240}@[a-z]${Mu}{0,13}`})$`),Bu=/^[ -~]{0,255}[!-~]$/,Fu=/,|=/;function qu(e){return Vu.test(e)}function Hu(e){return Bu.test(e)&&!Fu.test(e)}class Gu{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState="string"==typeof e?e:"",this._length=this._rawTraceState.length}set(e,t){var r,n,o;return!qu(e)||!Hu(t)||(o=(r=this._getState()).get(e),n=this._length,512<(n+="string"==typeof o?t.length-o.length:e.length+t.length+(0<r.size?2:1)))?this:((o=new Map(r)).delete(e),o.set(e,t),this._fromState(o,n))}unset(e){var t=this._getState(),r=t.get(e);if("string"!=typeof r)return this;let n=this._length-(e.length+r.length+1);1<t.size&&--n;r=new Map(t);return r.delete(e),this._fromState(r,n)}get(e){return this._getState().get(e)}serialize(){let e="",t=0;for(var r of this._getState())0<t&&(e=","+e),e=r[0]+"="+r[1]+e,t++;return e}_getState(){if(!this._internalState){let e=this._rawTraceState.split(","),r=new Map,n=0;for(var o of e){let e=o.trim(),t=e.indexOf("=");if(-1!==t){var o=e.slice(0,t),s=e.slice(t+1);if(qu(o)&&Hu(s)){var i=n+e.length+(0<r.size?1:0);if(!(512<i)&&(r.set(o,s),n=i,32<=r.size))break}}}this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse())}return this._internalState}_fromState(e,t){var r=Object.create(Gu.prototype);return r._internalState=e,r._length=t,r}}let zu="traceparent",Ku="tracestate",Yu=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");class Wu{inject(e,t,r){var n=bo.getSpanContext(e);n&&!fu(e)&&Vn(n)&&(e=`00-${n.traceId}-${n.spanId}-0`+Number(n.traceFlags||hn.NONE).toString(16),r.set(t,zu,e),n.traceState)&&r.set(t,Ku,n.traceState.serialize())}extract(e,t,r){var n=r.get(t,zu);if(!n)return e;n=Array.isArray(n)?n[0]:n;if("string"!=typeof n)return e;n=(e=>!(e=Yu.exec(e))||"00"===e[1]&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)})(n);if(!n)return e;n.isRemote=!0;r=r.get(t,Ku);if(r){let e=Array.isArray(r)?r.join(","):r;n.traceState=new Gu("string"==typeof e?e:void 0)}return bo.setSpanContext(e,n)}fields(){return[zu,Ku]}}($u=$u||{}).HTTP="http";let Ju="[object Null]",Xu="[object Undefined]",Qu=Function.prototype.toString,Zu=Qu.call(Object),el=Object.getPrototypeOf,tl=Object.prototype,rl=tl.hasOwnProperty,nl=Symbol?Symbol.toStringTag:void 0,ol=tl.toString;function il(e){return null!=e&&"object"==typeof e&&"[object Object]"===(t=>{if(null==t)return void 0===t?Xu:Ju;if(nl&&nl in Object(t)){var r=t,n=rl.call(r,nl),o=r[nl];let e=!1;try{r[nl]=void 0,e=!0}catch{}var s=ol.call(r);return e&&(n?r[nl]=o:delete r[nl]),s}return n=t,ol.call(n)})(e)&&(null===(e=el(e))||"function"==typeof(e=rl.call(e,"constructor")&&e.constructor)&&e instanceof e&&Qu.call(e)===Zu)}function sl(e){return ll(e)?e.slice():e}function al(r,n,o=0,s){let i;if(!(20<o)){if(o++,dl(r)||dl(n)||cl(n))i=sl(n);else if(ll(r)){if(i=r.slice(),ll(n))for(let e=0,t=n.length;e<t;e++)i.push(sl(n[e]));else if(pl(n)){let r=Object.keys(n);for(let t=0,e=r.length;t<e;t++){let e=r[t];"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(i[e]=sl(n[e]))}}}else if(pl(r))if(pl(n)){if(e=n,!il(r)||!il(e))return n;i=Object.assign({},r);var a=Object.keys(n);for(let e=0,t=a.length;e<t;e++){var u=a[e];if("__proto__"!==u&&"constructor"!==u&&"prototype"!==u){var l=n[u];if(dl(l))void 0===l?delete i[u]:i[u]=l;else{var c=i[u],p=l;if(ul(r,u,s)||ul(n,u,s))delete i[u];else{if(pl(c)&&pl(p)){let e=s.get(c)||[],t=s.get(p)||[];e.push({obj:r,key:u}),t.push({obj:n,key:u}),s.set(c,e),s.set(p,t)}i[u]=al(i[u],l,o,s)}}}}}else i=n;return i}var e}function ul(r,n,e){var o=e.get(r[n])||[];for(let e=0,t=o.length;e<t;e++){var s=o[e];if(s.key===n&&s.obj===r)return!0}return!1}function ll(e){return Array.isArray(e)}function cl(e){return"function"==typeof e}function pl(e){return!dl(e)&&!ll(e)&&!cl(e)&&"object"==typeof e}function dl(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e||e instanceof Date||e instanceof RegExp||null===e}class hl{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class fl{_isCalled=!1;_deferred=new hl;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}Er.ALL,Er.VERBOSE,Er.DEBUG,Er.INFO,Er.WARN,Er.ERROR,Er.NONE;let ml={_export:function(t,r){return new Promise(e=>{to.with(hu(to.active()),()=>{t.export(r,e)})})}},gl;function yl(){if(void 0===gl)try{var e=globalThis.process.argv0;gl=e?"unknown_service:"+e:"unknown_service"}catch{gl="unknown_service"}return gl}let _l=e=>null!==e&&"object"==typeof e&&"function"==typeof e.then;class vl{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,t){t=new vl({},t);return t._rawAttributes=wl(e),t._asyncAttributesPending=0<e.filter(([,e])=>_l(e)).length,t}constructor(e,t){var e=e.attributes??{};this._rawAttributes=Object.entries(e).map(([e,t])=>(_l(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=wl(this._rawAttributes),this._schemaUrl="string"==typeof(e=t?.schemaUrl)||void 0===e?e:void ro.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){var[t,r]=this._rawAttributes[e];this._rawAttributes[e]=[t,_l(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&ro.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;var e,t,r={};for([e,t]of this._rawAttributes)_l(t)?ro.debug(`Unsettled resource attribute ${e} skipped`):null!=t&&(r[e]??=t);return this._asyncAttributesPending||(this._memoizedAttributes=r),r}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){var t,r;return null==e?this:(t=(t=this)?.schemaUrl,r=e?.schemaUrl,r=(t=void 0===t||""===t?r:void 0===r||""===r||t===r?t:void ro.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',t,r))?{schemaUrl:t}:void 0,vl.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r))}}function bl(e,t){return vl.FromAttributeList(Object.entries(e),t)}function Tl(){return bl({})}function Sl(){return bl({[Io]:yl(),[Po]:Eu[Po],[ko]:Eu[ko],[Lo]:Eu[Lo]})}function wl(e){return e.map(([t,e])=>_l(e)?[t,e.catch(e=>{ro.debug("promise rejection for resource attribute: %s - %s",t,e)})]:[t,e])}let El=new class{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";detect(e){return{attributes:{}}}_parseResourceAttributes(e){if(!e)return{};let o={},t=e.split(this._COMMA_SEPARATOR).filter(e=>""!==e.trim());for(let n of t){let e=n.split(this._LABEL_KEY_VALUE_SPLITTER);if(2!==e.length)throw new Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${n}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);var[s,i]=e,s=s.trim(),i=i.trim();if(0===s.length)throw new Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${n}".`);let t,r;try{t=decodeURIComponent(s),r=decodeURIComponent(i)}catch(o){throw new Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${n}": `+(o instanceof Error?o.message:o))}if(t.length>this._MAX_LENGTH)throw new Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${t}".`);if(r.length>this._MAX_LENGTH)throw new Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${t}".`);o[t]=r}return o}},Al=new class{detect(){return{attributes:{}}}},Ol=Al,xl=Al,Cl=Al,Rl=Al;var sd,ad,Nd,Nl=Object.freeze({__proto__:null,detectResources:(n={})=>(n.detectors||[]).map(t=>{try{r=t.detect(n);var e=new vl(r,void 0);return ro.debug(t.constructor.name+" found resource.",e),e}catch(e){return ro.debug(t.constructor.name+" failed: "+e.message),Tl()}var r}).reduce((e,t)=>e.merge(t),Tl()),envDetector:El,hostDetector:Ol,osDetector:xl,processDetector:Cl,serviceInstanceIdDetector:Rl,resourceFromAttributes:bl,defaultResource:Sl,emptyResource:Tl,defaultServiceName:yl}),Il=n(Nl),Pl={exports:{}},Ul=(Pl.exports=t.default,ar.inspect),kl=Ka.OTLPLogExporter,Ll=nu,jl=pu.LoggerProvider,Dl=pu.BatchLogRecordProcessor,Ml=Il,Vl=Pl.exports,Bl=F(),Fl=o,ql="tccc",Hl="https://otlp.tccc.qcloud.com/v1/logs",Gl=Bl.newUUID(),zl=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Ul.apply(void 0,t.concat([{compact:!0,breakLength:1/0}])).slice(1,-1).replace(/((\\r|\\n)\\n(\\n)?)/g,"\n")},Kl=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=_({url:e.url||Hl,headers:{"X-Tps-TenantID":e.tenantId||ql},attributes:{}},e);return new jl({resource:Ml.defaultResource().merge(Ml.resourceFromAttributes(_({"tps.tenant.id":e.tenantId||ql,"service.name":"JsSIP","service.version":Fl.version},t))),processors:[new Dl(new kl(r))]}).getLogger("JsSIP",Fl.version)},Yl={provider:Kl({tenantId:ql,url:Hl}),attributes:{uuid:Gl,"trtc.version":Vl.VERSION}},Wl=(Oe.setConfig=function(e){Yl.provider=Kl(e)},Oe.setAttributes=function(e){Yl.attributes=Object.assign(Yl.attributes,e)},{DEBUG:{severityNumber:Ll.SeverityNumber.DEBUG,severityText:"debug"},INFO:{severityNumber:Ll.SeverityNumber.INFO,severityText:"info"},WARN:{severityNumber:Ll.SeverityNumber.WARN,severityText:"warn"},ERROR:{severityNumber:Ll.SeverityNumber.ERROR,severityText:"error"}}),$l=(Oe.log=function(e,t,r){for(var n=arguments.length,o=new Array(3<n?n-3:0),s=3;s<n;s++)o[s-3]=arguments[s];Yl.provider.emit(_(_({},Wl[(null==t?void 0:t.toUpperCase())||"DEBUG"]),{},{attributes:_(_({},Bl.toPlainObject(r)),Bl.toPlainObject(Yl.attributes)),body:"".concat(e||""," ").concat(zl.apply(void 0,o))}))},we.exports),Jl=s,Xl=Oe,Ql="TCCCSIP",Zl=(()=>{function s(e){l(this,s),e?(this._debug=$l.default("".concat(Ql,":").concat(e)),this._warn=$l.default("".concat(Ql,":WARN:").concat(e)),this._error=$l.default("".concat(Ql,":ERROR:").concat(e)),this.prefix=e):(this._debug=$l.default(Ql),this._warn=$l.default("".concat(Ql,":WARN")),this._error=$l.default("".concat(Ql,":ERROR"))),this._debug.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}return p(s,[{key:"debug",get:function(){var n=this;return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(n.report.apply(n,["debug"].concat(t)),!(s._logLevel>Jl.LOG_LEVEL.DEBUG))return n._debug.apply(n,t)}}},{key:"warn",get:function(){var n=this;return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(n.report.apply(n,["warn"].concat(t)),!(s._logLevel>Jl.LOG_LEVEL.WARN))return n._warn.apply(n,t)}}},{key:"error",get:function(){var n=this;return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(n.report.apply(n,["error"].concat(t)),!(s._logLevel>Jl.LOG_LEVEL.ERROR))return n._error.apply(n,t)}}},{key:"report",value:function(e){for(var t=arguments.length,r=new Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(s._log_report){var o={};try{0<r.length&&"object"===S(r[r.length-1])&&(Object.assign(o,r[r.length-1]),r=r.slice(0,-1))}catch(e){}Xl.log.apply(Xl,[this.prefix,e,o].concat(b(r)))}}}],[{key:"setLogLevel",value:function(e){s._logLevel=e}},{key:"setLogReport",value:function(e){s._log_report=e}},{key:"setConfig",value:function(e){Xl.setConfig(e)}},{key:"setAttributes",value:function(e){Xl.setAttributes(e)}}])})(),ec=(Zl.setLogLevel(Jl.LOG_LEVEL.TRACE),Zl.setLogReport(!0),Zl),tc={},rc={},nc={exports:{}},oc=nc.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s",t=(t+=null!=e.raddr?" raddr %s rport %d":"%v%v")+(null!=e.tcptype?" tcptype %s":"%v");return null!=e.generation&&(t+=" generation %d"),(t+=null!=e["network-id"]?" network-id %d":"%v")+(null!=e["network-cost"]?" network-cost %d":"%v")}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value)&&(t+=":%s"),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return(t=(t+=null!=e.id?"id=%s %s":"%v%s")+(null!=e.mediaClockValue?"=%s":"")+(null!=e.rateNumerator?" rate=%s":""))+(null!=e.rateDenominator?"/%s":"")}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]},ic=(Object.keys(oc).forEach(function(e){oc[e].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})}),(e=>{function f(e){return String(Number(e))===e?Number(e):e}function t(e,t){var r=t.split(/=(.+)/,2);return 2===r.length?e[r[0]]=f(r[1]):1===r.length&&1<t.length&&(e[r[0]]=void 0),e}var m=nc.exports,r=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},h=[],d=t;return e.split(/(\r\n|\r|\n)/).filter(r).forEach(function(e){var t=e[0],r=e.slice(2);"m"===t&&(h.push({rtp:[],fmtp:[]}),d=h[h.length-1]);for(var n=0;n<(m[t]||[]).length;n+=1){var o=m[t][n];if(o.reg.test(r)){var s=d;var i=r;var a=o.name&&o.names,a=(o.push&&!s[o.push]?s[o.push]=[]:a&&!s[o.name]&&(s[o.name]={}),o.push?{}:a?s[o.name]:s),u=i.match(o.reg),l=a,c=o.names;if((i=o.name)&&!c)l[i]=f(u[1]);else for(var p=0;p<c.length;p+=1)null!=u[p+1]&&(l[c[p]]=f(u[p+1]));o.push&&s[o.push].push(a);return}}}),t.media=h,t},e.parseParams=function(e){return e.split(/;\s?/).reduce(t,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var t=[],r=e.split(" ").map(f),n=0;n<r.length;n+=3)t.push({component:r[n],ip:r[n+1],port:r[n+2]});return t},e.parseImageAttributes=function(e){return e.split(" ").map(function(e){return e.substring(1,e.length-1).split(",").reduce(t,{})})},e.parseSimulcastStreamList=function(e){return e.split(";").map(function(e){return e.split(",").map(function(e){var t,r=!1;return"~"!==e[0]?t=f(e):(t=f(e.substring(1,e.length)),r=!0),{scid:t,paused:r}})})}})(rc),nc.exports),sc=/%[sdv%]/g,ac=function(e){var r=1,n=arguments,o=n.length;return e.replace(sc,function(e){if(o<=r)return e;var t=n[r];switch(r+=1,e){case"%%":return"%";case"%s":return String(t);case"%d":return Number(t);case"%v":return""}})},uc=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var o=0;o<t.names.length;o+=1){var s=t.names[o];n.push(t.name?r[t.name][s]:r[t.names[o]])}else n.push(r[t.name]);return ac.apply(null,n)},lc=["v","o","s","i","u","e","p","c","b","t","r","z","a"],cc=["i","c","b","a"],pc=rc,dc=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach(function(e){null==e.payloads&&(e.payloads="")});var r=t.outerOrder||lc,n=t.innerOrder||cc,o=[];return r.forEach(function(r){ic[r].forEach(function(t){t.name in e&&null!=e[t.name]?o.push(uc(r,t,e)):t.push in e&&null!=e[t.push]&&e[t.push].forEach(function(e){o.push(uc(r,t,e))})})}),e.media.forEach(function(e){o.push(uc("m",ic.m[0],e)),n.forEach(function(r){ic[r].forEach(function(t){t.name in e&&null!=e[t.name]?o.push(uc(r,t,e)):t.push in e&&null!=e[t.push]&&e[t.push].forEach(function(e){o.push(uc(r,t,e))})})})}),o.join("\r\n")+"\r\n"},hc=nc.exports,fc=(tc.grammar=hc,tc.write=dc,tc.parse=pc.parse,tc.parseParams=pc.parseParams,tc.parseFmtpConfig=pc.parseFmtpConfig,tc.parsePayloads=pc.parsePayloads,tc.parseRemoteCandidates=pc.parseRemoteCandidates,tc.parseImageAttributes=pc.parseImageAttributes,tc.parseSimulcastStreamList=pc.parseSimulcastStreamList,tc),mc=ec,gc=s,yc=F(),_c=M(),vc=V(),bc=new mc("SIPMessage"),Tc=(()=>{function i(e,t,r,n,o,s){if(l(this,i),!e||!t||!r)return null;n=n||{},this.ua=r,this.headers={},this.method=e,this.ruri=t,this.body=s,this.extraHeaders=yc.cloneArray(o),this.ua.configuration.extra_headers&&(this.extraHeaders=this.extraHeaders.concat(this.ua.configuration.extra_headers)),n.route_set?this.setHeader("route",n.route_set):r.configuration.use_preloaded_route&&this.setHeader("route","<".concat(r.transport.sip_uri,";lr>")),this.setHeader("via",""),this.setHeader("max-forwards",gc.MAX_FORWARDS);s=n.to_uri||t,o=n.to_tag?{tag:n.to_tag}:null,t=void 0!==n.to_display_name?n.to_display_name:null;this.to=new _c(s,t,o),this.setHeader("to",this.to.toString());s=n.from_uri||r.configuration.uri,t={tag:n.from_tag||yc.newTag()},o=void 0!==n.from_display_name?n.from_display_name:r.configuration.display_name||null,this.from=new _c(s,o,t),this.setHeader("from",this.from.toString()),s=n.call_id||r.configuration.jssip_id+yc.createRandomToken(15),this.call_id=s,this.setHeader("call-id",s),o=n.cseq||Math.floor(1e4*Math.random());this.cseq=o,this.setHeader("cseq","".concat(o," ").concat(e))}return p(i,[{key:"setHeader",value:function(e,t){for(var r=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),n=0;n<this.extraHeaders.length;n++)r.test(this.extraHeaders[n])&&this.extraHeaders.splice(n,1);this.headers[yc.headerize(e)]=Array.isArray(t)?t:[t]}},{key:"getHeader",value:function(e){var t=this.headers[yc.headerize(e)];if(t){if(t[0])return t[0]}else{var r,n=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),o=d(this.extraHeaders);try{for(o.s();!(r=o.n()).done;){var s=r.value;if(n.test(s))return s.substring(s.indexOf(":")+1).trim()}}catch(e){o.e(e)}finally{o.f()}}}},{key:"getHeaders",value:function(e){var t=this.headers[yc.headerize(e)],r=[];if(t){var n,o=d(t);try{for(o.s();!(n=o.n()).done;)r.push(n.value)}catch(e){o.e(e)}finally{o.f()}}else{var s,i=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),a=d(this.extraHeaders);try{for(a.s();!(s=a.n()).done;){var u=s.value;i.test(u)&&r.push(u.substring(u.indexOf(":")+1).trim())}}catch(e){a.e(e)}finally{a.f()}}return r}},{key:"hasHeader",value:function(e){if(this.headers[yc.headerize(e)])return!0;var t,r=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),n=d(this.extraHeaders);try{for(n.s();!(t=n.n()).done;){var o=t.value;if(r.test(o))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"parseSDP",value:function(e){return!e&&this.sdp||(this.sdp=fc.parse(this.body||"")),this.sdp}},{key:"toString",value:function(){var e,t="".concat(this.method," ").concat(this.ruri," SIP/2.0\r\n");for(e in this.headers)if(Object.prototype.hasOwnProperty.call(this.headers,e)){var r,n=d(this.headers[e]);try{for(n.s();!(r=n.n()).done;){var o=r.value;t+="".concat(e,": ").concat(o,"\r\n")}}catch(t){n.e(t)}finally{n.f()}}var s,i=d(this.extraHeaders);try{for(i.s();!(s=i.n()).done;){var a=s.value;t+="".concat(a.trim(),"\r\n")}}catch(t){i.e(t)}finally{i.f()}var u=[];switch(this.method){case gc.REGISTER:u.push("path","gruu");break;case gc.INVITE:this.ua.configuration.session_timers&&u.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&u.push("gruu"),u.push("ice","replaces");break;case gc.UPDATE:this.ua.configuration.session_timers&&u.push("timer"),u.push("ice")}u.push("outbound");var l=this.ua.configuration.user_agent||gc.USER_AGENT;return t=(t=(t+="Allow: ".concat(gc.ALLOWED_METHODS,"\r\n"))+"Supported: ".concat(u,"\r\n"))+"User-Agent: ".concat(l,"\r\n"),this.body?(l=yc.str_utf8_length(this.body),t=(t+="Content-Length: ".concat(l,"\r\n\r\n"))+this.body):t+="Content-Length: 0\r\n\r\n",t}},{key:"clone",value:function(){var t=new i(this.method,this.ruri,this.ua);return Object.keys(this.headers).forEach(function(e){t.headers[e]=this.headers[e].slice()},this),t.body=this.body,t.extraHeaders=yc.cloneArray(this.extraHeaders),t.to=this.to,t.from=this.from,t.call_id=this.call_id,t.cseq=this.cseq,t}}])})(),Sc=(()=>{function s(e,t,r,n,o){return l(this,s),(e=u(this,s,[gc.INVITE,e,t,r,n,o])).transaction=null,e}return m(s,Tc),p(s,[{key:"cancel",value:function(e){this.transaction.cancel(e)}},{key:"clone",value:function(){var t=new s(this.ruri,this.ua);return Object.keys(this.headers).forEach(function(e){t.headers[e]=this.headers[e].slice()},this),t.body=this.body,t.extraHeaders=yc.cloneArray(this.extraHeaders),t.to=this.to,t.from=this.from,t.call_id=this.call_id,t.cseq=this.cseq,t.transaction=this.transaction,t}}])})(),wc=p(function e(){l(this,e),this.data=null,this.headers=null,this.method=null,this.via=null,this.via_branch=null,this.call_id=null,this.cseq=null,this.from=null,this.from_tag=null,this.to=null,this.to_tag=null,this.body=null,this.sdp=null},[{key:"addHeader",value:function(e,t){t={raw:t};e=yc.headerize(e),this.headers[e]?this.headers[e].push(t):this.headers[e]=[t]}},{key:"getHeader",value:function(e){e=this.headers[yc.headerize(e)];return e&&e[0]?e[0].raw:void 0}},{key:"getHeaders",value:function(e){var t=this.headers[yc.headerize(e)],r=[];if(!t)return[];var n,o=d(t);try{for(o.s();!(n=o.n()).done;)r.push(n.value.raw)}catch(e){o.e(e)}finally{o.f()}return r}},{key:"hasHeader",value:function(e){return!!this.headers[yc.headerize(e)]}},{key:"parseHeader",value:function(e){var t,r,n,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;if(e=yc.headerize(e),this.headers[e]){if(!(o>=this.headers[e].length))return r=(t=this.headers[e][o]).raw,t.parsed||(-1===(n=vc.parse(r,e.replace(/-/g,"_")))?(this.headers[e].splice(o,1),void bc.debug('error parsing "'.concat(e,'" header field with value "').concat(r,'"'))):t.parsed=n);bc.debug('not so many "'.concat(e,'" headers present'))}else bc.debug('header "'.concat(e,'" not present'))}},{key:"s",value:function(e,t){return this.parseHeader(e,t)}},{key:"setHeader",value:function(e,t){t={raw:t};this.headers[yc.headerize(e)]=[t]}},{key:"parseSDP",value:function(e){return!e&&this.sdp||(this.sdp=fc.parse(this.body||"")),this.sdp}},{key:"toString",value:function(){return this.data}}]),Ec=(()=>{function r(e){var t;return l(this,r),(t=u(this,r)).ua=e,t.headers={},t.ruri=null,t.transport=null,t.server_transaction=null,t}return m(r,wc),p(r,[{key:"reply",value:function(e,t,r,n,o,s){var i=[],a=this.getHeader("To");if(t=t||null,!(e=e||null)||e<100||699<e)throw new TypeError("Invalid status_code: ".concat(e));if(t&&"string"!=typeof t&&!(t instanceof String))throw new TypeError("Invalid reason_phrase: ".concat(t));t=t||gc.REASON_PHRASE[e]||"",r=yc.cloneArray(r),this.ua.configuration.extra_headers&&(r=r.concat(this.ua.configuration.extra_headers));var u="SIP/2.0 ".concat(e," ").concat(t,"\r\n");if(this.method===gc.INVITE&&100<e&&e<=200){var l,c=d(this.getHeaders("record-route"));try{for(c.s();!(l=c.n()).done;)u+="Record-Route: ".concat(l.value,"\r\n")}catch(e){c.e(e)}finally{c.f()}}var p,h=d(this.getHeaders("via"));try{for(h.s();!(p=h.n()).done;)u+="Via: ".concat(p.value,"\r\n")}catch(e){h.e(e)}finally{h.f()}!this.to_tag&&100<e?a+=";tag=".concat(yc.newTag()):this.to_tag&&!this.s("to").hasParam("tag")&&(a+=";tag=".concat(this.to_tag)),u=(u=(u=(u+="To: ".concat(a,"\r\n"))+"From: ".concat(this.getHeader("From"),"\r\n"))+"Call-ID: ".concat(this.call_id,"\r\n"))+"CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n");var f,m=d(r);try{for(m.s();!(f=m.n()).done;){var g=f.value;u+="".concat(g.trim(),"\r\n")}}catch(e){m.e(e)}finally{m.f()}switch(this.method){case gc.INVITE:this.ua.configuration.session_timers&&i.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&i.push("gruu"),i.push("ice","replaces");break;case gc.UPDATE:this.ua.configuration.session_timers&&i.push("timer"),n&&i.push("ice"),i.push("replaces")}i.push("outbound"),this.method===gc.OPTIONS?u=(u+="Allow: ".concat(gc.ALLOWED_METHODS,"\r\n"))+"Accept: ".concat(gc.ACCEPTED_BODY_TYPES,"\r\n"):405===e?u+="Allow: ".concat(gc.ALLOWED_METHODS,"\r\n"):415===e&&(u+="Accept: ".concat(gc.ACCEPTED_BODY_TYPES,"\r\n")),u+="Supported: ".concat(i,"\r\n"),n?(t=yc.str_utf8_length(n),u=(u+="Content-Type: application/sdp\r\n")+"Content-Length: ".concat(t,"\r\n\r\n")+n):u+="Content-Length: ".concat(0,"\r\n\r\n"),this.server_transaction.receiveResponse(e,u,o,s)}},{key:"reply_sl",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,r=this.getHeaders("via");if(!e||e<100||699<e)throw new TypeError("Invalid status_code: ".concat(e));if(t&&"string"!=typeof t&&!(t instanceof String))throw new TypeError("Invalid reason_phrase: ".concat(t));var n,t=t||gc.REASON_PHRASE[e]||"",o="SIP/2.0 ".concat(e," ").concat(t,"\r\n"),s=d(r);try{for(s.s();!(n=s.n()).done;)o+="Via: ".concat(n.value,"\r\n")}catch(e){s.e(e)}finally{s.f()}t=this.getHeader("To");if(!this.to_tag&&100<e?t+=";tag=".concat(yc.newTag()):this.to_tag&&!this.s("to").hasParam("tag")&&(t+=";tag=".concat(this.to_tag)),o=(o=(o=(o+="To: ".concat(t,"\r\n"))+"From: ".concat(this.getHeader("From"),"\r\n"))+"Call-ID: ".concat(this.call_id,"\r\n"))+"CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n"),this.ua.configuration.extra_headers){var i,a=d(this.ua.configuration.extra_headers);try{for(a.s();!(i=a.n()).done;){var u=i.value;o+="".concat(u.trim(),"\r\n")}}catch(e){a.e(e)}finally{a.f()}}o+="Content-Length: ".concat(0,"\r\n\r\n"),this.transport.send(o)}}])})(),Ac={OutgoingRequest:Tc,InitialOutgoingInviteRequest:Sc,IncomingRequest:Ec,IncomingResponse:(()=>{function t(){var e;return l(this,t),(e=u(this,t)).headers={},e.status_code=null,e.reason_phrase=null,e}return m(t,wc),p(t)})()},Oc=ec,xc=F(),Cc=new Oc("DigestAuthentication"),Rc=p(function e(t){l(this,e),this._credentials=t,this._cnonce=null,this._nc=0,this._ncHex="00000000",this._algorithm=null,this._realm=null,this._nonce=null,this._opaque=null,this._stale=null,this._qop=null,this._method=null,this._uri=null,this._ha1=null,this._response=null},[{key:"get",value:function(e){switch(e){case"realm":return this._realm;case"ha1":return this._ha1;default:return void Cc.warn('get() | cannot get "%s" parameter',e)}}},{key:"authenticate",value:function(e,t){var r=e.method,n=e.ruri,e=e.body,o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(this._algorithm=t.algorithm,this._realm=t.realm,this._nonce=t.nonce,this._opaque=t.opaque,this._stale=t.stale,this._algorithm){if("MD5"!==this._algorithm)return Cc.warn('authenticate() | challenge with Digest algorithm different than "MD5", authentication aborted'),!1}else this._algorithm="MD5";if(!this._nonce)return Cc.warn("authenticate() | challenge without Digest nonce, authentication aborted"),!1;if(!this._realm)return Cc.warn("authenticate() | challenge without Digest realm, authentication aborted"),!1;if(!this._credentials.password){if(!this._credentials.ha1)return Cc.warn("authenticate() | no plain SIP password nor ha1 provided, authentication aborted"),!1;if(this._credentials.realm!==this._realm)return Cc.warn('authenticate() | no plain SIP password, and stored `realm` does not match the given `realm`, cannot authenticate [stored:"%s", given:"%s"]',this._credentials.realm,this._realm),!1}if(t.qop)if(-1<t.qop.indexOf("auth-int"))this._qop="auth-int";else{if(!(-1<t.qop.indexOf("auth")))return Cc.warn('authenticate() | challenge without Digest qop different than "auth" or "auth-int", authentication aborted'),!1;this._qop="auth"}else this._qop=null;this._method=r,this._uri=n,this._cnonce=o||xc.createRandomToken(12),this._nc+=1;var s,i,t=Number(this._nc).toString(16);return this._ncHex="00000000".substr(0,8-t.length)+t,4294967296===this._nc&&(this._nc=1,this._ncHex="00000001"),this._credentials.password?this._ha1=xc.calculateMD5("".concat(this._credentials.username,":").concat(this._realm,":").concat(this._credentials.password)):this._ha1=this._credentials.ha1,"auth"===this._qop?(s="".concat(this._method,":").concat(this._uri),i=xc.calculateMD5(s),Cc.debug('authenticate() | using qop=auth [a2:"%s"]',s),this._response=xc.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth:").concat(i))):"auth-int"===this._qop?(s="".concat(this._method,":").concat(this._uri,":").concat(xc.calculateMD5(e||"")),i=xc.calculateMD5(s),Cc.debug('authenticate() | using qop=auth-int [a2:"%s"]',s),this._response=xc.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth-int:").concat(i))):null===this._qop&&(s="".concat(this._method,":").concat(this._uri),i=xc.calculateMD5(s),Cc.debug('authenticate() | using qop=null [a2:"%s"]',s),this._response=xc.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(i))),Cc.debug("authenticate() | response generated"),!0}},{key:"toString",value:function(){var e=[];if(this._response)return e.push("algorithm=".concat(this._algorithm)),e.push('username="'.concat(this._credentials.username,'"')),e.push('realm="'.concat(this._realm,'"')),e.push('nonce="'.concat(this._nonce,'"')),e.push('uri="'.concat(this._uri,'"')),e.push('response="'.concat(this._response,'"')),this._opaque&&e.push('opaque="'.concat(this._opaque,'"')),this._qop&&(e.push("qop=".concat(this._qop)),e.push('cnonce="'.concat(this._cnonce,'"')),e.push("nc=".concat(this._ncHex))),"Digest ".concat(e.join(", "));throw new Error("response field does not exist, cannot generate Authorization header")}}]),Nc=500,Ic={T1:Nc,T2:4e3,T4:5e3,TIMER_B:32e3,TIMER_D:0,TIMER_F:32e3,TIMER_H:32e3,TIMER_I:0,TIMER_J:0,TIMER_K:0,TIMER_L:32e3,TIMER_M:32e3,PROVISIONAL_RESPONSE_INTERVAL:6e4},Pc=$.EventEmitter,Uc=ec,kc=s,Lc=Ac,jc=Ic,Dc=new Uc("NonInviteClientTransaction"),Mc=new Uc("InviteClientTransaction"),Vc=new Uc("AckClientTransaction"),Bc=new Uc("NonInviteServerTransaction"),Fc=new Uc("InviteServerTransaction"),qc={STATUS_TRYING:1,STATUS_PROCEEDING:2,STATUS_CALLING:3,STATUS_ACCEPTED:4,STATUS_COMPLETED:5,STATUS_TERMINATED:6,STATUS_CONFIRMED:7,NON_INVITE_CLIENT:"nict",NON_INVITE_SERVER:"nist",INVITE_CLIENT:"ict",INVITE_SERVER:"ist"},Hc=(()=>{function s(e,t,r,n){l(this,s),(o=u(this,s)).type=qc.NON_INVITE_CLIENT,o.id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.ua=e,o.transport=t,o.request=r,o.eventHandlers=n;var o,r="SIP/2.0/".concat(t.via_transport);return r+=" ".concat(e.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",r),o.ua.newTransaction(o),o}return m(s,Pc),p(s,[{key:"C",get:function(){return qc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"send",value:function(){var e=this;this.stateChanged(qc.STATUS_TRYING),this.F=setTimeout(function(){e.timer_F()},jc.TIMER_F),this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){Dc.debug("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.F),clearTimeout(this.K),this.stateChanged(qc.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onTransportError()}},{key:"timer_F",value:function(){Dc.debug("Timer F expired for transaction ".concat(this.id)),this.stateChanged(qc.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onRequestTimeout()}},{key:"timer_K",value:function(){this.stateChanged(qc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"receiveResponse",value:function(e){var t=this,r=e.status_code;if(r<200)switch(this.state){case qc.STATUS_TRYING:case qc.STATUS_PROCEEDING:this.stateChanged(qc.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(e)}else switch(this.state){case qc.STATUS_TRYING:case qc.STATUS_PROCEEDING:this.stateChanged(qc.STATUS_COMPLETED),clearTimeout(this.F),408===r?this.eventHandlers.onRequestTimeout():this.eventHandlers.onReceiveResponse(e),this.K=setTimeout(function(){t.timer_K()},jc.TIMER_K)}}}])})(),Gc=(()=>{function s(e,t,r,n){l(this,s),(o=u(this,s)).type=qc.INVITE_CLIENT,o.id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.ua=e,o.transport=t,o.request=r,o.eventHandlers=n,r.transaction=o;var o,n="SIP/2.0/".concat(t.via_transport);return n+=" ".concat(e.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",n),o.ua.newTransaction(o),o}return m(s,Pc),p(s,[{key:"C",get:function(){return qc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"send",value:function(){var e=this;this.stateChanged(qc.STATUS_CALLING),this.B=setTimeout(function(){e.timer_B()},jc.TIMER_B),this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){clearTimeout(this.B),clearTimeout(this.D),clearTimeout(this.M),this.state!==qc.STATUS_ACCEPTED&&(Mc.debug("transport error occurred, deleting transaction ".concat(this.id)),this.eventHandlers.onTransportError()),this.stateChanged(qc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_M",value:function(){Mc.debug("Timer M expired for transaction ".concat(this.id)),this.state===qc.STATUS_ACCEPTED&&(clearTimeout(this.B),this.stateChanged(qc.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"timer_B",value:function(){Mc.debug("Timer B expired for transaction ".concat(this.id)),this.state===qc.STATUS_CALLING&&(this.stateChanged(qc.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onRequestTimeout())}},{key:"timer_D",value:function(){Mc.debug("Timer D expired for transaction ".concat(this.id)),clearTimeout(this.B),this.stateChanged(qc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"sendACK",value:function(e){var t=this,r=new Lc.OutgoingRequest(kc.ACK,this.request.ruri,this.ua,{route_set:this.request.getHeaders("route"),call_id:this.request.getHeader("call-id"),cseq:this.request.cseq});r.setHeader("from",this.request.getHeader("from")),r.setHeader("via",this.request.getHeader("via")),r.setHeader("to",e.getHeader("to")),this.D=setTimeout(function(){t.timer_D()},jc.TIMER_D),this.transport.send(r)}},{key:"cancel",value:function(e){var t;this.state===qc.STATUS_PROCEEDING&&((t=new Lc.OutgoingRequest(kc.CANCEL,this.request.ruri,this.ua,{route_set:this.request.getHeaders("route"),call_id:this.request.getHeader("call-id"),cseq:this.request.cseq})).setHeader("from",this.request.getHeader("from")),t.setHeader("via",this.request.getHeader("via")),t.setHeader("to",this.request.getHeader("to")),e&&t.setHeader("reason",e),this.transport.send(t))}},{key:"receiveResponse",value:function(e){var t=this,r=e.status_code;if(100<=r&&r<=199)switch(this.state){case qc.STATUS_CALLING:this.stateChanged(qc.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(e);break;case qc.STATUS_PROCEEDING:this.eventHandlers.onReceiveResponse(e)}else if(200<=r&&r<=299)switch(this.state){case qc.STATUS_CALLING:case qc.STATUS_PROCEEDING:this.stateChanged(qc.STATUS_ACCEPTED),this.M=setTimeout(function(){t.timer_M()},jc.TIMER_M),this.eventHandlers.onReceiveResponse(e);break;case qc.STATUS_ACCEPTED:this.eventHandlers.onReceiveResponse(e)}else if(300<=r&&r<=699)switch(this.state){case qc.STATUS_CALLING:case qc.STATUS_PROCEEDING:this.stateChanged(qc.STATUS_COMPLETED),this.sendACK(e),this.eventHandlers.onReceiveResponse(e);break;case qc.STATUS_COMPLETED:this.sendACK(e)}}}])})(),zc=(()=>{function s(e,t,r,n){l(this,s),(o=u(this,s)).id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.transport=t,o.request=r,o.eventHandlers=n;var o,r="SIP/2.0/".concat(t.via_transport);return r+=" ".concat(e.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",r),o}return m(s,Pc),p(s,[{key:"C",get:function(){return qc}},{key:"send",value:function(){this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){Vc.debug("transport error occurred for transaction ".concat(this.id)),this.eventHandlers.onTransportError()}}])})(),Kc=(()=>{function o(e,t,r){var n;return l(this,o),(n=u(this,o)).type=qc.NON_INVITE_SERVER,n.id=r.via_branch,n.ua=e,n.transport=t,n.request=r,n.last_response="",(r.server_transaction=n).state=qc.STATUS_TRYING,e.newTransaction(n),n}return m(o,Pc),p(o,[{key:"C",get:function(){return qc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_J",value:function(){Bc.debug("Timer J expired for transaction ".concat(this.id)),this.stateChanged(qc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,Bc.debug("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.J),this.stateChanged(qc.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"receiveResponse",value:function(e,t,r,n){var o=this;if(100===e)switch(this.state){case qc.STATUS_TRYING:this.stateChanged(qc.STATUS_PROCEEDING),this.transport.send(t)||this.onTransportError();break;case qc.STATUS_PROCEEDING:this.last_response=t,this.transport.send(t)?r&&r():(this.onTransportError(),n&&n())}else if(200<=e&&e<=699)switch(this.state){case qc.STATUS_TRYING:case qc.STATUS_PROCEEDING:this.stateChanged(qc.STATUS_COMPLETED),this.last_response=t,this.J=setTimeout(function(){o.timer_J()},jc.TIMER_J),this.transport.send(t)?r&&r():(this.onTransportError(),n&&n())}}}])})(),Yc=(()=>{function o(e,t,r){var n;return l(this,o),(n=u(this,o)).type=qc.INVITE_SERVER,n.id=r.via_branch,n.ua=e,n.transport=t,n.request=r,n.last_response="",(r.server_transaction=n).state=qc.STATUS_PROCEEDING,e.newTransaction(n),n.resendProvisionalTimer=null,r.reply(100),n}return m(o,Pc),p(o,[{key:"C",get:function(){return qc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_H",value:function(){Fc.debug("Timer H expired for transaction ".concat(this.id)),this.state===qc.STATUS_COMPLETED&&Fc.debug("ACK not received, dialog will be terminated"),this.stateChanged(qc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_I",value:function(){this.stateChanged(qc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_L",value:function(){Fc.debug("Timer L expired for transaction ".concat(this.id)),this.state===qc.STATUS_ACCEPTED&&(this.stateChanged(qc.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,Fc.debug("transport error occurred, deleting transaction ".concat(this.id)),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),clearTimeout(this.L),clearTimeout(this.H),clearTimeout(this.I),this.stateChanged(qc.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"resend_provisional",value:function(){this.transport.send(this.last_response)||this.onTransportError()}},{key:"receiveResponse",value:function(e,t,r,n){var o=this;if(100<=e&&e<=199&&this.state===qc.STATUS_PROCEEDING&&(this.transport.send(t)||this.onTransportError(),this.last_response=t),100<e&&e<=199&&this.state===qc.STATUS_PROCEEDING)null===this.resendProvisionalTimer&&(this.resendProvisionalTimer=setInterval(function(){o.resend_provisional()},jc.PROVISIONAL_RESPONSE_INTERVAL));else if(200<=e&&e<=299)switch(this.state){case qc.STATUS_PROCEEDING:this.stateChanged(qc.STATUS_ACCEPTED),this.last_response=t,this.L=setTimeout(function(){o.timer_L()},jc.TIMER_L),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null);case qc.STATUS_ACCEPTED:this.transport.send(t)?r&&r():(this.onTransportError(),n&&n())}else 300<=e&&e<=699&&this.state===qc.STATUS_PROCEEDING&&(null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),this.transport.send(t)?(this.stateChanged(qc.STATUS_COMPLETED),this.H=setTimeout(function(){o.timer_H()},jc.TIMER_H),r&&r()):(this.onTransportError(),n&&n()))}}])})(),Wc={C:qc,NonInviteClientTransaction:Hc,InviteClientTransaction:Gc,AckClientTransaction:zc,NonInviteServerTransaction:Kc,InviteServerTransaction:Yc,checkTransaction:function(e,t){var r,n=e._transactions;switch(t.method){case kc.INVITE:if(r=n.ist[t.via_branch])return r.state===qc.STATUS_PROCEEDING&&r.transport.send(r.last_response),!0;break;case kc.ACK:if(!(r=n.ist[t.via_branch]))return!1;if(r.state===qc.STATUS_ACCEPTED)return!1;if(r.state===qc.STATUS_COMPLETED)return r.state=qc.STATUS_CONFIRMED,r.I=setTimeout(function(){r.timer_I()},jc.TIMER_I),!0;break;case kc.CANCEL:return(r=n.ist[t.via_branch])?(t.reply_sl(200),r.state!==qc.STATUS_PROCEEDING):(t.reply_sl(481),!0);default:if(r=n.nist[t.via_branch]){switch(r.state){case qc.STATUS_TRYING:break;case qc.STATUS_PROCEEDING:case qc.STATUS_COMPLETED:r.transport.send(r.last_response)}return!0}}}},$c=s,Jc=Rc,Xc=Wc,Qc=new ec("RequestSender"),Zc={onRequestTimeout:function(){},onTransportError:function(){},onReceiveResponse:function(){},onAuthenticated:function(){}},ep=p(function e(t,r,n){for(var o in l(this,e),this._ua=t,this._eventHandlers=n,this._method=r.method,this._request=r,this._auth=null,this._challenged=!1,this._staled=!1,Zc)!Object.prototype.hasOwnProperty.call(Zc,o)||this._eventHandlers[o]||(this._eventHandlers[o]=Zc[o]);t.status!==t.C.STATUS_USER_CLOSED||this._method===$c.BYE&&this._method===$c.ACK||this._eventHandlers.onTransportError()},[{key:"send",value:function(){var t=this,e={onRequestTimeout:function(){t._eventHandlers.onRequestTimeout()},onTransportError:function(){t._eventHandlers.onTransportError()},onReceiveResponse:function(e){t._receiveResponse(e)}};switch(this._method){case"INVITE":this.clientTransaction=new Xc.InviteClientTransaction(this._ua,this._ua.transport,this._request,e);break;case"ACK":this.clientTransaction=new Xc.AckClientTransaction(this._ua,this._ua.transport,this._request,e);break;default:this.clientTransaction=new Xc.NonInviteClientTransaction(this._ua,this._ua.transport,this._request,e)}this._ua._configuration.authorization_jwt&&this._request.setHeader("Authorization",this._ua._configuration.authorization_jwt),this.clientTransaction.send()}},{key:"_receiveResponse",value:function(e){var t,r=e.status_code;401!==r&&407!==r||null===this._ua.configuration.password&&null===this._ua.configuration.ha1?this._eventHandlers.onReceiveResponse(e):(r=401===e.status_code?(t=e.parseHeader("www-authenticate"),"authorization"):(t=e.parseHeader("proxy-authenticate"),"proxy-authorization"),t?(!this._challenged||!this._staled&&!0===t.stale)&&(this._auth||(this._auth=new Jc({username:this._ua.configuration.authorization_user,password:this._ua.configuration.password,realm:this._ua.configuration.realm,ha1:this._ua.configuration.ha1})),this._auth.authenticate(this._request,t))?(this._challenged=!0,this._ua.set("realm",this._auth.get("realm")),this._ua.set("ha1",this._auth.get("ha1")),t.stale&&(this._staled=!0),this._request=this._request.clone(),this._request.cseq+=1,this._request.setHeader("cseq","".concat(this._request.cseq," ").concat(this._method)),this._request.setHeader(r,this._auth.toString()),this._eventHandlers.onAuthenticated(this._request),this.send()):this._eventHandlers.onReceiveResponse(e):(Qc.debug("".concat(e.status_code," with wrong or missing challenge, cannot authenticate")),this._eventHandlers.onReceiveResponse(e)))}}]),tp=ec,rp=F(),np=s,op=Ac,ip=ep,sp=new tp("Registrator"),ap=p(function e(t,r){l(this,e),this._reg_id=1,this._ua=t,this._transport=r,this._registrar=t.configuration.registrar_server,this._expires=t.configuration.register_expires,this._call_id=rp.createRandomToken(22),this._cseq=0,this._to_uri=t.configuration.uri,this._registrationTimer=null,this._registering=!1,this._registered=!1,this._contact=this._ua.contact.toString(),this._contact+=";+sip.ice",this._extraHeaders=[],this._extraContactParams="",this._sipInstance='"<urn:uuid:'.concat(this._ua.configuration.instance_id,'>"'),this._contact+=";reg-id=".concat(this._reg_id),this._contact+=";+sip.instance=".concat(this._sipInstance),this._ua.configuration.use_trtc&&(this._contact+=";trtc")},[{key:"registered",get:function(){return this._registered}},{key:"setExtraHeaders",value:function(e){Array.isArray(e)||(e=[]),this._extraHeaders=e.slice()}},{key:"setExtraContactParams",value:function(e){for(var t in e instanceof Object||(e={}),this._extraContactParams="",e){var r;Object.prototype.hasOwnProperty.call(e,t)&&(r=e[t],this._extraContactParams+=";".concat(t),r)&&(this._extraContactParams+="=".concat(r))}}},{key:"register",value:function(){var e,n=this;this._registering?sp.debug("Register request in progress..."):((e=this._extraHeaders.slice()).push("Contact: ".concat(this._contact,";expires=").concat(this._expires).concat(this._extraContactParams)),e.push("Expires: ".concat(this._expires)),this._ua.configuration.use_trtc&&e.push("X-TRTC: 1"),e=new op.OutgoingRequest(np.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},e),e=new ip(this._ua,e,{onRequestTimeout:function(){n._registrationFailure(null,np.causes.REQUEST_TIMEOUT)},onTransportError:function(){n._registrationFailure(null,np.causes.CONNECTION_ERROR)},onAuthenticated:function(){n._cseq+=1},onReceiveResponse:function(e){if(e.cseq===n._cseq)switch(null!==n._registrationTimer&&(clearTimeout(n._registrationTimer),n._registrationTimer=null),!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):var t;(n._registering=!1,e.hasHeader("Contact"))?(t=(t=(r=e.headers.Contact.reduce(function(e,t){return e.concat(t.parsed)},[])).find(function(e){return n._sipInstance===e.getParam("+sip.instance")&&n._reg_id===parseInt(e.getParam("reg-id"))}))||r.find(function(e){return e.uri.user===n._ua.contact.uri.user}))?(r=(r=!(r=t.getParam("expires"))&&e.hasHeader("expires")?e.getHeader("expires"):r)||n._expires,r=64<(r=(r=Number(r))<10?10:r)?1e3*r/2+Math.floor(1e3*(r/2-32)*Math.random()):1e3*r-5e3,n._registrationTimer=setTimeout(function(){n._registrationTimer=null,0===n._ua.listeners("registrationExpiring").length?n.register():n._ua.emit("registrationExpiring")},r),t.hasParam("temp-gruu")&&(n._ua.contact.temp_gruu=t.getParam("temp-gruu").replace(/"/g,"")),t.hasParam("pub-gruu")&&(n._ua.contact.pub_gruu=t.getParam("pub-gruu").replace(/"/g,"")),n._registered||(n._registered=!0,n._ua.registered({response:e}))):sp.debug("no Contact header pointing to us, response ignored"):sp.debug("no Contact header in response to REGISTER, response ignored");break;case/^423$/.test(e.status_code):e.hasHeader("min-expires")?(n._expires=Number(e.getHeader("min-expires")),n._expires<10&&(n._expires=10),n.register()):(sp.debug("423 response received for REGISTER without Min-Expires"),n._registrationFailure(e,np.causes.SIP_FAILURE_CODE));break;default:var r=rp.sipErrorCause(e.status_code);n._registrationFailure(e,r)}}}),this._registering=!0,e.send())}},{key:"unregister",value:function(){var e,r=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this._registered?(this._registered=!1,null!==this._registrationTimer&&(clearTimeout(this._registrationTimer),this._registrationTimer=null),e=this._extraHeaders.slice(),t.all?e.push("Contact: *".concat(this._extraContactParams)):e.push("Contact: ".concat(this._contact,";expires=0").concat(this._extraContactParams)),e.push("Expires: 0"),t=new op.OutgoingRequest(np.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},e),new ip(this._ua,t,{onRequestTimeout:function(){r._unregistered(null,np.causes.REQUEST_TIMEOUT)},onTransportError:function(){r._unregistered(null,np.causes.CONNECTION_ERROR)},onAuthenticated:function(){r._cseq+=1},onReceiveResponse:function(e){switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):r._unregistered(e);break;default:var t=rp.sipErrorCause(e.status_code);r._unregistered(e,t)}}}).send()):sp.debug("already unregistered")}},{key:"close",value:function(){this._registered&&this.unregister()}},{key:"onTransportClosed",value:function(){this._registering=!1,null!==this._registrationTimer&&(clearTimeout(this._registrationTimer),this._registrationTimer=null),this._registered&&(this._registered=!1,this._ua.unregistered({}))}},{key:"_registrationFailure",value:function(e,t){this._registering=!1,this._ua.registrationFailed({response:e||null,cause:t}),this._registered&&(this._registered=!1,this._ua.unregistered({response:e||null,cause:t}))}},{key:"_unregistered",value:function(e,t){this._registering=!1,this._registered=!1,this._ua.unregistered({response:e||null,cause:t||null})}}]),up=n(So),lp=s,cp=Wc,pp=ep,dp={onRequestTimeout:function(){},onTransportError:function(){},onSuccessResponse:function(){},onErrorResponse:function(){},onAuthenticated:function(){},onDialogError:function(){}},hp=ec,fp=Ac,mp=s,gp=Wc,yp=p(function e(t,r,n){for(var o in l(this,e),this._dialog=t,this._ua=t._ua,this._request=r,this._eventHandlers=n,this._reattempt=!1,this._reattemptTimer=null,dp)!Object.prototype.hasOwnProperty.call(dp,o)||this._eventHandlers[o]||(this._eventHandlers[o]=dp[o])},[{key:"request",get:function(){return this._request}},{key:"send",value:function(){var e,t=this,r=new pp(this._ua,this._request,{onRequestTimeout:function(){t._eventHandlers.onRequestTimeout()},onTransportError:function(){t._eventHandlers.onTransportError()},onAuthenticated:function(e){t._eventHandlers.onAuthenticated(e)},onReceiveResponse:function(e){t._receiveResponse(e)}});r.send(),(this._request.method===lp.INVITE||this._request.method===lp.UPDATE&&this._request.body)&&r.clientTransaction.state!==cp.C.STATUS_TERMINATED&&(this._dialog.uac_pending_reply=!0,e=function(){r.clientTransaction.state!==cp.C.STATUS_ACCEPTED&&r.clientTransaction.state!==cp.C.STATUS_COMPLETED&&r.clientTransaction.state!==cp.C.STATUS_TERMINATED||(r.clientTransaction.removeListener("stateChanged",e),t._dialog.uac_pending_reply=!1)},r.clientTransaction.on("stateChanged",e))}},{key:"_receiveResponse",value:function(e){var t=this;408===e.status_code||481===e.status_code?this._eventHandlers.onDialogError(e):e.method!==lp.INVITE||491!==e.status_code||this._reattempt?200<=e.status_code&&e.status_code<300?this._eventHandlers.onSuccessResponse(e):300<=e.status_code&&this._eventHandlers.onErrorResponse(e):(this._request.cseq=this._dialog.local_seqnum+=1,this._reattemptTimer=setTimeout(function(){t._dialog.isTerminated()||(t._reattempt=!0,t.send())},1e3))}}]),_p=F(),vp=new hp("Dialog"),bp={STATUS_EARLY:1,STATUS_CONFIRMED:2,STATUS_TERMINATED:3},Tp=p(function e(t,r,n){var o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:bp.STATUS_CONFIRMED;if(l(this,e),this._owner=t,this._ua=t._ua,this._uac_pending_reply=!1,this._uas_pending_reply=!1,!r.hasHeader("contact"))return{error:"unable to create a Dialog without Contact header field"};r instanceof fp.IncomingResponse&&(o=r.status_code<200?bp.STATUS_EARLY:bp.STATUS_CONFIRMED);t=r.parseHeader("contact");"UAS"===n?(this._id={call_id:r.call_id,local_tag:r.to_tag,remote_tag:r.from_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=o,this._remote_seqnum=r.cseq,this._local_uri=r.parseHeader("to").uri,this._remote_uri=r.parseHeader("from").uri,this._remote_target=t.uri,this._route_set=r.getHeaders("record-route"),this._ack_seqnum=this._remote_seqnum):"UAC"===n&&(this._id={call_id:r.call_id,local_tag:r.from_tag,remote_tag:r.to_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=o,this._local_seqnum=r.cseq,this._local_uri=r.parseHeader("from").uri,this._remote_uri=r.parseHeader("to").uri,this._remote_target=t.uri,this._route_set=r.getHeaders("record-route").reverse(),this._ack_seqnum=null),this._ua.newDialog(this),vp.debug("new ".concat(n," dialog created with status ").concat(this._state===bp.STATUS_EARLY?"EARLY":"CONFIRMED"))},[{key:"id",get:function(){return this._id}},{key:"local_seqnum",get:function(){return this._local_seqnum},set:function(e){this._local_seqnum=e}},{key:"owner",get:function(){return this._owner}},{key:"uac_pending_reply",get:function(){return this._uac_pending_reply},set:function(e){this._uac_pending_reply=e}},{key:"uas_pending_reply",get:function(){return this._uas_pending_reply}},{key:"isTerminated",value:function(){return this._status===bp.STATUS_TERMINATED}},{key:"update",value:function(e,t){this._state=bp.STATUS_CONFIRMED,vp.debug("dialog ".concat(this._id.toString()," changed to CONFIRMED state")),"UAC"===t&&(this._route_set=e.getHeaders("record-route").reverse())}},{key:"terminate",value:function(){vp.debug("dialog ".concat(this._id.toString()," deleted")),this._ua.destroyDialog(this),this._state=bp.STATUS_TERMINATED}},{key:"sendRequest",value:function(e){var t=this,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=_p.cloneArray(r.extraHeaders),o=_p.cloneObject(r.eventHandlers),r=r.body||null,e=this._createRequest(e,n,r);return o.onAuthenticated=function(){t._local_seqnum+=1},new yp(this,e,o).send(),e}},{key:"receiveRequest",value:function(e){this._checkInDialogRequest(e)&&(e.method===mp.ACK&&null!==this._ack_seqnum?this._ack_seqnum=null:e.method===mp.INVITE&&(this._ack_seqnum=e.cseq),this._owner.receiveRequest(e))}},{key:"_createRequest",value:function(e,t,r){t=_p.cloneArray(t),this._local_seqnum||(this._local_seqnum=Math.floor(1e4*Math.random()));var n=e===mp.CANCEL||e===mp.ACK?this._local_seqnum:this._local_seqnum+=1;return new fp.OutgoingRequest(e,this._remote_target,this._ua,{cseq:n,call_id:this._id.call_id,from_uri:this._local_uri,from_tag:this._id.local_tag,to_uri:this._remote_uri,to_tag:this._id.remote_tag,route_set:this._route_set},t,r)}},{key:"_checkInDialogRequest",value:function(e){var t,r=this;if(this._remote_seqnum)if(e.cseq<this._remote_seqnum){if(e.method!==mp.ACK)return e.reply(500),!1;if(null===this._ack_seqnum||e.cseq!==this._ack_seqnum)return!1}else e.cseq>this._remote_seqnum&&(this._remote_seqnum=e.cseq);else this._remote_seqnum=e.cseq;if(e.method===mp.INVITE||e.method===mp.UPDATE&&e.body){if(!0===this._uac_pending_reply)e.reply(491);else{if(!0===this._uas_pending_reply)return t=1+(10*Math.random()|0),e.reply(500,null,["Retry-After:".concat(t)]),!1;this._uas_pending_reply=!0;var n=function(){e.server_transaction.state!==gp.C.STATUS_ACCEPTED&&e.server_transaction.state!==gp.C.STATUS_COMPLETED&&e.server_transaction.state!==gp.C.STATUS_TERMINATED||(e.server_transaction.removeListener("stateChanged",n),r._uas_pending_reply=!1)};e.server_transaction.on("stateChanged",n)}e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){e.server_transaction.state===gp.C.STATUS_ACCEPTED&&(r._remote_target=e.parseHeader("contact").uri)})}else e.method===mp.NOTIFY&&e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){e.server_transaction.state===gp.C.STATUS_COMPLETED&&(r._remote_target=e.parseHeader("contact").uri)});return!0}}],[{key:"C",get:function(){return bp}}]),Sp={exports:{}},wp=$.EventEmitter,Ep=ec,Ap=s,Op=j,xp=F(),Cp=new Ep("RTCSession:DTMF"),Rp={MIN_DURATION:70,MAX_DURATION:6e3,DEFAULT_DURATION:100,MIN_INTER_TONE_GAP:50,DEFAULT_INTER_TONE_GAP:500},Np=(Sp.exports=(()=>{function r(e){var t;return l(this,r),(t=u(this,r))._session=e,t._direction=null,t._tone=null,t._duration=null,t._request=null,t}return m(r,wp),p(r,[{key:"tone",get:function(){return this._tone}},{key:"duration",get:function(){return this._duration}},{key:"send",value:function(e){var t=this,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(void 0===e)throw new TypeError("Not enough arguments");if(this._direction="outgoing",this._session.status!==this._session.C.STATUS_CONFIRMED&&this._session.status!==this._session.C.STATUS_WAITING_FOR_ACK)throw new Op.InvalidStateError(this._session.status);var n=xp.cloneArray(r.extraHeaders);if(this.eventHandlers=xp.cloneObject(r.eventHandlers),"string"==typeof e)e=e.toUpperCase();else{if("number"!=typeof e)throw new TypeError("Invalid tone: ".concat(e));e=e.toString()}if(!e.match(/^[0-9A-DR#*]$/))throw new TypeError("Invalid tone: ".concat(e));this._tone=e,this._duration=r.duration,n.push("Content-Type: application/dtmf-relay");e="Signal=".concat(this._tone,"\r\n");e+="Duration=".concat(this._duration),this._session.newDTMF({originator:"local",dtmf:this,request:this._request}),this._session.sendRequest(Ap.INFO,{extraHeaders:n,eventHandlers:{onSuccessResponse:function(e){t.emit("succeeded",{originator:"remote",response:e})},onErrorResponse:function(e){t.eventHandlers.onFailed&&t.eventHandlers.onFailed(),t.emit("failed",{originator:"remote",response:e})},onRequestTimeout:function(){t._session.onRequestTimeout()},onTransportError:function(){t._session.onTransportError()},onDialogError:function(){t._session.onDialogError()}},body:e})}},{key:"init_incoming",value:function(e){var t,r=/^(Signal\s*?=\s*?)([0-9A-D#*]{1})(\s)?.*/,n=/^(Duration\s?=\s?)([0-9]{1,4})(\s)?.*/;this._direction="incoming",(this._request=e).reply(200),e.body&&(1<=(t=e.body.split("\n")).length&&r.test(t[0])&&(this._tone=t[0].replace(r,"$2")),2<=t.length)&&n.test(t[1])&&(this._duration=parseInt(t[1].replace(n,"$2"),10)),this._duration||(this._duration=Rp.DEFAULT_DURATION),this._tone?this._session.newDTMF({originator:"remote",dtmf:this,request:e}):Cp.debug("invalid INFO DTMF received, discarded")}}])})(),Sp.exports.C=Rp,$.EventEmitter),Ip=s,Pp=j,Up=F(),kp=(()=>{function r(e){var t;return l(this,r),(t=u(this,r))._session=e,t._direction=null,t._contentType=null,t._body=null,t}return m(r,Np),p(r,[{key:"contentType",get:function(){return this._contentType}},{key:"body",get:function(){return this._body}},{key:"send",value:function(e,t){var r=this,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(this._direction="outgoing",void 0===e)throw new TypeError("Not enough arguments");if(this._session.status!==this._session.C.STATUS_CONFIRMED&&this._session.status!==this._session.C.STATUS_WAITING_FOR_ACK)throw new Pp.InvalidStateError(this._session.status);this._contentType=e,this._body=t;n=Up.cloneArray(n.extraHeaders);n.push("Content-Type: ".concat(e)),this._session.newInfo({originator:"local",info:this,request:this.request}),this._session.sendRequest(Ip.INFO,{extraHeaders:n,eventHandlers:{onSuccessResponse:function(e){r.emit("succeeded",{originator:"remote",response:e})},onErrorResponse:function(e){r.emit("failed",{originator:"remote",response:e})},onTransportError:function(){r._session.onTransportError()},onRequestTimeout:function(){r._session.onRequestTimeout()},onDialogError:function(){r._session.onDialogError()}},body:t})}},{key:"init_incoming",value:function(e){this._direction="incoming",(this.request=e).reply(200),this._contentType=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0,this._body=e.body,this._session.newInfo({originator:"remote",info:this,request:e})}}])})(),Lp=s,jp=new ec("RTCSession:ReferNotifier"),Dp="refer",Mp="message/sipfrag;version=2.0",Vp=300,Bp=p(function e(t,r,n){l(this,e),this._session=t,this._id=r,this._expires=n||Vp,this._active=!0,this.notify(100)},[{key:"notify",value:function(e,t){var r;jp.debug("notify()"),!1!==this._active&&(t=t||Lp.REASON_PHRASE[e]||"",r=200<=e?"terminated;reason=noresource":"active;expires=".concat(this._expires),this._session.sendRequest(Lp.NOTIFY,{extraHeaders:["Event: ".concat(Dp,";id=").concat(this._id),"Subscription-State: ".concat(r),"Content-Type: ".concat(Mp)],body:"SIP/2.0 ".concat(e," ").concat(t),eventHandlers:{onErrorResponse:function(){this._active=!1}}}))}}]),Fp=$.EventEmitter,qp=ec,Hp=s,Gp=V(),zp=F(),Kp=new qp("RTCSession:ReferSubscriber"),Yp=(()=>{function r(e){var t;return l(this,r),(t=u(this,r))._id=null,t._session=e,t}return m(r,Fp),p(r,[{key:"id",get:function(){return this._id}},{key:"sendRefer",value:function(e){var t,r=this,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=(Kp.debug("sendRefer()"),zp.cloneArray(n.extraHeaders)),s=zp.cloneObject(n.eventHandlers);for(t in s)Object.prototype.hasOwnProperty.call(s,t)&&this.on(t,s[t]);var i=null,n=(n.replaces&&(i=n.replaces._request.call_id,i=(i+=";to-tag=".concat(n.replaces._to_tag))+";from-tag=".concat(n.replaces._from_tag),i=encodeURIComponent(i)),"Refer-To: <".concat(e).concat(i?"?Replaces=".concat(i):"",">")),i=(o.push(n),o.some(function(e){return e.toLowerCase().startsWith("referred-by:")})||(e="Referred-By: <".concat(this._session._ua._configuration.uri._scheme,":").concat(this._session._ua._configuration.uri._user,"@").concat(this._session._ua._configuration.uri._host,">"),o.push(e)),o.push("Contact: ".concat(this._session.contact)),this._session.sendRequest(Hp.REFER,{extraHeaders:o,eventHandlers:{onSuccessResponse:function(e){r._requestSucceeded(e)},onErrorResponse:function(e){r._requestFailed(e,Hp.causes.REJECTED)},onTransportError:function(){r._requestFailed(null,Hp.causes.CONNECTION_ERROR)},onRequestTimeout:function(){r._requestFailed(null,Hp.causes.REQUEST_TIMEOUT)},onDialogError:function(){r._requestFailed(null,Hp.causes.DIALOG_ERROR)}}}));this._id=i.cseq}},{key:"receiveNotify",value:function(e){if(Kp.debug("receiveNotify()"),e.body){var t=Gp.parse(e.body.trim().split("\r\n",1)[0],"Status_Line");if(-1!==t)switch(!0){case/^100$/.test(t.status_code):this.emit("trying",{request:e,status_line:t});break;case/^1[0-9]{2}$/.test(t.status_code):this.emit("progress",{request:e,status_line:t});break;case/^2[0-9]{2}$/.test(t.status_code):this.emit("accepted",{request:e,status_line:t});break;default:this.emit("failed",{request:e,status_line:t})}else Kp.debug('receiveNotify() | error parsing NOTIFY body: "'.concat(e.body,'"'))}}},{key:"_requestSucceeded",value:function(e){Kp.debug("REFER succeeded"),Kp.debug('emit "requestSucceeded"'),this.emit("requestSucceeded",{response:e})}},{key:"_requestFailed",value:function(e,t){Kp.debug("REFER failed"),Kp.debug('emit "requestFailed"'),this.emit("requestFailed",{response:e||null,cause:t})}}])})(),Wp=$.EventEmitter,$p=(()=>{function r(e){var t;return l(this,r),(t=u(this,r)).audio=e.audio,t.video=e.video,t._mediaStream=e.mediaStream,t._player=null,t}return m(r,Wp),p(r,[{key:"mediaStream",get:function(){return this._mediaStream}},{key:"getMediaStream",value:function(){return this._mediaStream}},{key:"getAudioTrack",value:function(){if(this._mediaStream){var e=this._mediaStream.getAudioTracks();if(0<e.length)return e[0]}return null}},{key:"play",value:function(){}}])})(),Jp=$p,Xp=F(),Qp=(()=>{function t(e){return l(this,t),(e=u(this,t,[e])).type="local",e}return m(t,Jp),p(t,[{key:"initialize",value:function(){var t=this;return navigator.mediaDevices.getUserMedia({audio:this.audio,video:this.video}).then(function(e){return t._mediaStream=e,t}).catch(function(e){throw e})}},{key:"close",value:function(){this._mediaStream&&Xp.closeMediaStream(this._mediaStream)}}])})(),Zp=$p,ed=(()=>{function r(e){var t;return l(this,r),(t=u(this,r,[e]))._mediaStream=e.mediaStream,t.type="remote",t}return m(r,Zp),p(r)})(),td="object"===("undefined"==typeof globalThis?"undefined":S(globalThis))?globalThis:"object"===("undefined"==typeof self?"undefined":S(self))?self:"object"===("undefined"==typeof window?"undefined":S(window))?window:"object"===S(r)?r:{},rd={},nd=Object.freeze({__proto__:null,OTLPTraceExporter:class extends ur{constructor(e={}){super(Ha(e,xa,"v1/traces",{"Content-Type":"application/json"}))}}}),od=n(nd);class id{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:zn.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(t){let e=Date.now();if(this._spanContext=t.spanContext,this._performanceStartTime=Au.now(),this._performanceOffset=e-(this._performanceStartTime+Au.timeOrigin),this._startTimeProvided=null!=t.startTime,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,t.links)for(let e of t.links)this.addLink(e);this.startTime=this._getTime(t.startTime??e),this.resource=t.resource,this.instrumentationScope=t.scope,this._recordEndMetrics=t.recordEndMetrics,null!=t.attributes&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(e,t){var r,n;return null==t||this._isSpanEnded()||(0===e.length?ro.warn("Invalid attribute key: "+e):vu(t)?(r=this._spanLimits.attributeCountLimit,n=!Object.prototype.hasOwnProperty.call(this.attributes,e),void 0!==r&&this._attributesCount>=r&&n?this._droppedAttributesCount++:(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++)):ro.warn("Invalid attribute value set for key: "+e)),this}setAttributes(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,o){if(!this._isSpanEnded()){var s=this._spanLimits.eventCountLimit;if(0===s)ro.warn("No events allowed."),this._droppedEventsCount++;else{void 0!==s&&this.events.length>=s&&(0===this._droppedEventsCount&&ro.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),ku(t)&&(ku(o)||(o=t),t=void 0);var i=yu(t),a=this._spanLimits.attributePerEventCountLimit,u={};let r=0,n=0;for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)){let e=i[t];void 0!==a&&n>=a?r++:(u[t]=this._truncateToSize(e),n++)}this.events.push({name:e,attributes:u,time:this._getTime(o),droppedAttributesCount:r})}}return this}addLink(t){if(!this._isSpanEnded()){let e=this._spanLimits.linkCountLimit;if(0===e)this._droppedLinksCount++;else{void 0!==e&&this.links.length>=e&&(0===this._droppedLinksCount&&ro.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);var o=this._spanLimits.attributePerLinkCountLimit,s=yu(t.attributes),i={};let r=0,n=0;for(let t in s)if(Object.prototype.hasOwnProperty.call(s,t)){let e=s[t];void 0!==o&&n>=o?r++:(i[t]=this._truncateToSize(e),n++)}t={context:t.context};0<n&&(t.attributes=i),0<r&&(t.droppedAttributesCount=r),this.links.push(t)}}return this}addLinks(e){for(var t of e)this.addLink(t);return this}setStatus(e){var t;return this._isSpanEnded()||e.code!==zn.UNSET&&this.status.code!==zn.OK&&(t={code:e.code},e.code===zn.ERROR&&("string"==typeof e.message?t.message=e.message:null!=e.message&&ro.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t),this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){this._isSpanEnded()?ro.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`):(this.endTime=this._getTime(e),this._duration=((e,t)=>{let r=t[0]-e[0],n=t[1]-e[1];return n<0&&(--r,n+=xu),[r,n]})(this.startTime,this.endTime),this._duration[0]<0&&(ro.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),0<this._droppedEventsCount&&ro.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),0<this._droppedLinksCount&&ro.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this))}_getTime(e){return"number"==typeof e&&e<=Au.now()?Ru(e+this._performanceOffset):"number"==typeof e?Cu(e):e instanceof Date?Cu(e.getTime()):Uu(e)?e:this._startTimeProvided?Cu(Date.now()):(e=Au.now()-this._performanceStartTime,Lu(this.startTime,Cu(e)))}isRecording(){return!1===this._ended}recordException(e,t){var r={};"string"==typeof e?r[Ro]=e:e&&(e.code?r[No]=e.code.toString():e.name&&(r[No]=e.name),e.message&&(r[Ro]=e.message),e.stack)&&(r["exception.stacktrace"]=e.stack),r[No]||r[Ro]?this.addEvent("exception",r,t):ro.warn("Failed to record an exception "+e)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){var e;return this._ended&&(e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`),ro.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)),this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(ro.warn("Attribute value limit must be positive, got "+t),e):"string"==typeof e?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>"string"==typeof e?this._truncateToLimitUtil(e,t):e):e}}(e=>{e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(sd=sd||{});class ud{shouldSample(){return{decision:sd.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class ld{shouldSample(){return{decision:sd.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class cd{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(Su(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new ld),this._remoteParentSampled=e.remoteParentSampled??new ld,this._remoteParentNotSampled=e.remoteParentNotSampled??new ud,this._localParentSampled=e.localParentSampled??new ld,this._localParentNotSampled=e.localParentNotSampled??new ud}shouldSample(e,t,r,n,o,s){var i=bo.getSpanContext(e);return(i&&Vn(i)?i.isRemote?i.traceFlags&hn.SAMPLED?this._remoteParentSampled:this._remoteParentNotSampled:i.traceFlags&hn.SAMPLED?this._localParentSampled:this._localParentNotSampled:this._root).shouldSample(e,t,r,n,o,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class pd{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(4294967295*this._ratio)}shouldSample(e,t){return{decision:Dn(t)&&this._accumulate(t)<this._upperBound?sd.RECORD_AND_SAMPLED:sd.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return"number"!=typeof e||isNaN(e)?0:1<=e?1:e<=0?0:e}_accumulate(n){let e=0;for(let r=0;r<32;r+=8){let t=0;for(let e=0;e<8;e++){var o=n.charCodeAt(r+e);t=t<<4|(o<58?o-48:o<71?o-55:o-87)}e=(e^t)>>>0}return e}}function dd(){return{sampler:hd(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function hd(){var e=ad.ParentBasedAlwaysOn;switch(e){case ad.AlwaysOn:return new ld;case ad.AlwaysOff:return new ud;case ad.ParentBasedAlwaysOn:return new cd({root:new ld});case ad.ParentBasedAlwaysOff:return new cd({root:new ud});case ad.TraceIdRatio:return new pd(fd());case ad.ParentBasedTraceIdRatio:return new cd({root:new pd(fd())});default:return ro.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${ad.ParentBasedAlwaysOn}".`),new cd({root:new ld})}}function fd(){return ro.error("OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1."),1}(e=>{e.AlwaysOff="always_off",e.AlwaysOn="always_on",e.ParentBasedAlwaysOff="parentbased_always_off",e.ParentBasedAlwaysOn="parentbased_always_on",e.ParentBasedTraceIdRatio="parentbased_traceidratio",e.TraceIdRatio="traceidratio"})(ad=ad||{});let md=1/0;class gd{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,t){this._exporter=e,this._maxExportBatchSize="number"==typeof t?.maxExportBatchSize?t.maxExportBatchSize:512,this._maxQueueSize="number"==typeof t?.maxQueueSize?t.maxQueueSize:2048,this._scheduledDelayMillis="number"==typeof t?.scheduledDelayMillis?t.scheduledDelayMillis:5e3,this._exportTimeoutMillis="number"==typeof t?.exportTimeoutMillis?t.exportTimeoutMillis:3e4,this._shutdownOnce=new fl(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(ro.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||0!=(e.spanContext().traceFlags&hn.SAMPLED)&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){this._finishedSpans.length>=this._maxQueueSize?(0===this._droppedSpansCount&&ro.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++):(0<this._droppedSpansCount&&(ro.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{var r=[];for(let e=0,t=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);e<t;e++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),0===this._finishedSpans.length?Promise.resolve():new Promise((t,o)=>{let s=setTimeout(()=>{o(new Error("Timeout"))},this._exportTimeoutMillis);to.with(hu(to.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);var e=()=>this._exporter.export(r,e=>{clearTimeout(s),e.code===ju.SUCCESS?t():o(e.error??new Error("BatchSpanProcessor: span export failed"))});let n=null;for(let t=0,e=r.length;t<e;t++){let e=r[t];e.resource.asyncAttributesPending&&e.resource.waitForAsyncAttributes&&(n??=[]).push(e.resource.waitForAsyncAttributes())}null===n?e():Promise.all(n).then(e,e=>{Su(e),o(e)})})})}_maybeStartTimer(){if(!this._isExporting){let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,0<this._finishedSpans.length&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,Su(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();void 0===this._timer&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),"number"!=typeof this._timer)&&this._timer.unref()}}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}}class yd extends gd{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this.onInit(t)}onInit(e){!0!==e?.disableAutoFlushOnDocumentHide&&"undefined"!=typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush().catch(e=>{Su(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{Su(e)})},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){"undefined"!=typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener)&&document.removeEventListener("pagehide",this._pageHideListener)}}let _d=new Uint8Array(16),vd=new Uint8Array(8),bd=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Td(t){for(let e=0;e<t.length;e++)t[e]=256*Math.random()>>>0;for(let e=0;e<t.length;e++)if(0<t[e])return;t[t.length-1]=1}function Sd(t){let r="";for(let e=0;e<t.length;e++)r+=bd[t[e]];return r}class wd{generateTraceId(){return Td(_d),Sd(_d)}generateSpanId(){return Td(vd),Sd(vd)}}let Ed="otel.span.parent.origin",Ad="otel.span.sampling_result";class Od{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter("otel.sdk.span.started",{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter("otel.sdk.span.live",{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,t){var r=(()=>{switch(t){case sd.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case sd.RECORD:return"RECORD_ONLY";case sd.NOT_RECORD:return"DROP"}})();if(this.startedSpans.add(1,{[Ed]:xd(e),[Ad]:r}),t===sd.NOT_RECORD)return()=>{};let n={[Ad]:r};return this.liveSpans.add(1,n),()=>{this.liveSpans.add(-1,n)}}}function xd(e){return e?e.isRemote?"remote":"local":"none"}class Cd{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t,r,n){i=t,o={sampler:hd()},s=dd(),(o=Object.assign({},s,o,i)).generalLimits=Object.assign({},s.generalLimits,i.generalLimits||{}),o.spanLimits=Object.assign({},s.spanLimits,i.spanLimits||{});var o,s=o,i=(this._sampler=s.sampler,this._generalLimits=s.generalLimits,this._spanLimits=s.spanLimits,this._idGenerator=t.idGenerator||new wd,this._resource=r,this._spanProcessor=n,this.instrumentationScope=e,s.meterProvider?s.meterProvider.getMeter("@opentelemetry/sdk-trace","2.7.1"):dn());this._tracerMetrics=new Od(i)}startSpan(e,t={},r=to.active()){t.root&&(r=bo.deleteSpan(r));var n=bo.getSpan(r);if(fu(r))return ro.debug("Instrumentation suppressed, returning Noop Span"),bo.wrapSpanContext(On);var n=n?.spanContext(),o=this._idGenerator.generateSpanId();let s,i,a;n&&bo.isSpanContextValid(n)?(i=n.traceId,a=n.traceState,s=n):i=this._idGenerator.generateTraceId();var u=t.kind??Gn.INTERNAL,l=(t.links??[]).map(e=>({context:e.context,attributes:yu(e.attributes)})),c=yu(t.attributes),p=this._sampler.shouldSample(r,i,e,u,c,l),n=this._tracerMetrics.startSpan(n,p.decision),o=(a=p.traceState??a,{traceId:i,spanId:o,traceFlags:p.decision===Hn.RECORD_AND_SAMPLED?hn.SAMPLED:hn.NONE,traceState:a});return p.decision===Hn.NOT_RECORD?(ro.debug("Recording is off, propagating context in a non-recording span"),bo.wrapSpanContext(o)):(c=yu(Object.assign(c,p.attributes)),new id({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:o,name:e,kind:u,links:l,parentSpanContext:s,attributes:c,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:n}))}startActiveSpan(e,t,r,n){let o,s,i;if(!(arguments.length<2))return i=2===arguments.length?t:3===arguments.length?(o=t,r):(o=t,s=r,n),t=s??to.active(),r=this.startSpan(e,o,t),n=bo.setSpan(t,r),to.with(n,i,void 0,r)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class Rd{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(var t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{Su(e||new Error("MultiSpanProcessor: forceFlush failed")),t()})})}onStart(e,t){for(var r of this._spanProcessors)r.onStart(e,t)}onEnding(e){for(var t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(var t of this._spanProcessors)t.onEnd(e)}shutdown(){let r=[];for(var e of this._spanProcessors)r.push(e.shutdown());return new Promise((e,t)=>{Promise.all(r).then(()=>{e()},t)})}}(e=>{e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(Nd=Nd||{});class Id{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){var t=(e=>{let t=e.shift();for(var r=new WeakMap;0<e.length;)t=al(t,e.shift(),0,r);return t})([{},dd(),(t=e,(r=Object.assign({},t.spanLimits)).attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??128,r.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??md,Object.assign({},t,{spanLimits:r}))]),r=(this._resource=t.resource??Sl(),this._config=Object.assign({},t,{resource:this._resource}),[]);e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new Rd(r)}getTracer(e,t,r){var n=e+`@${t||""}:`+(r?.schemaUrl||"");return this._tracers.has(n)||this._tracers.set(n,new Cd({name:e,version:t,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(n)}forceFlush(){let o=this._config.forceFlushTimeoutMillis,e=this._activeSpanProcessor._spanProcessors.map(e=>new Promise(t=>{let r,n=setTimeout(()=>{t(new Error(`Span processor did not completed within timeout period of ${o} ms`)),r=Nd.timeout},o);e.forceFlush().then(()=>{clearTimeout(n),r!==Nd.timeout&&(r=Nd.resolved,t(r))}).catch(e=>{clearTimeout(n),r=Nd.error,t(e)})}));return new Promise((t,r)=>{Promise.all(e).then(e=>{e=e.filter(e=>e!==Nd.resolved);0<e.length?r(e):t()}).catch(e=>r([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}class Pd{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:Pu(e.startTime),duration:Pu(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(t,e){for(let e of t)console.dir(this._exportInfo(e),{depth:3});if(e)return e({code:ju.SUCCESS})}}class Ud{_finishedSpans=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:ju.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>t({code:ju.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}class kd{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new fl(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,t){}onEnd(t){if(!this._shutdownOnce.isCalled&&0!=(t.spanContext().traceFlags&hn.SAMPLED)){let e=this._doExport(t).catch(e=>Su(e));this._pendingExports.add(e),e.finally(()=>this._pendingExports.delete(e))}}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();e=await ml._export(this._exporter,[e]);if(e.code!==ju.SUCCESS)throw e.error??new Error(`SimpleSpanProcessor: span export failed (status ${e})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}class Ld{onStart(e,t){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}var jd,Dd=n(Object.freeze({__proto__:null,BasicTracerProvider:Id,BatchSpanProcessor:yd,RandomIdGenerator:wd,ConsoleSpanExporter:Pd,InMemorySpanExporter:Ud,SimpleSpanProcessor:kd,NoopSpanProcessor:Ld,AlwaysOffSampler:ud,AlwaysOnSampler:ld,ParentBasedSampler:cd,TraceIdRatioBasedSampler:pd,get SamplingDecision(){return sd}}));class Md{_enabled=!1;_currentContext=Hr;_bindFunction(t=Hr,r){function e(...e){return n.with(t,()=>r.apply(this,e))}let n=this;return Object.defineProperty(e,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),e}active(){return this._currentContext}bind(e,t){return void 0===e&&(e=this.active()),"function"==typeof t?this._bindFunction(e,t):t}disable(){return this._currentContext=Hr,this._enabled=!1,this}enable(){return this._enabled||(this._enabled=!0,this._currentContext=Hr),this}with(e,t,r,...n){var o=this._currentContext;this._currentContext=e||Hr;try{return t.call(r,...n)}finally{this._currentContext=o}}}(e=>{e.CONNECT_END="connectEnd",e.CONNECT_START="connectStart",e.DECODED_BODY_SIZE="decodedBodySize",e.DOM_COMPLETE="domComplete",e.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",e.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",e.DOM_INTERACTIVE="domInteractive",e.DOMAIN_LOOKUP_END="domainLookupEnd",e.DOMAIN_LOOKUP_START="domainLookupStart",e.ENCODED_BODY_SIZE="encodedBodySize",e.FETCH_START="fetchStart",e.LOAD_EVENT_END="loadEventEnd",e.LOAD_EVENT_START="loadEventStart",e.NAVIGATION_START="navigationStart",e.REDIRECT_END="redirectEnd",e.REDIRECT_START="redirectStart",e.REQUEST_START="requestStart",e.RESPONSE_END="responseEnd",e.RESPONSE_START="responseStart",e.SECURE_CONNECTION_START="secureConnectionStart",e.START_TIME="startTime",e.UNLOAD_EVENT_END="unloadEventEnd",e.UNLOAD_EVENT_START="unloadEventStart"})(jd=jd||{});let Vd;function Bd(e,t){return t in e}function Fd(e,t,r,n=!0){if(Bd(r,t)&&"number"==typeof r[t]&&(!n||0!==r[t]))return e.addEvent(t,r[t])}function qd(e){return e.slice().sort((e,t)=>{e=e[jd.FETCH_START],t=t[jd.FETCH_START];return t<e?1:e<t?-1:0})}function Hd(){return"undefined"!=typeof location?location.origin:void 0}function Gd(e){var t;return"function"==typeof URL?new URL(e,"undefined"!=typeof document?document.baseURI:"undefined"!=typeof location?location.href:void 0):((t=Vd=Vd||document.createElement("a")).href=e,t)}var zd=Object.freeze({__proto__:null,WebTracerProvider:class extends Id{constructor(e={}){super(e)}register(e={}){bo.setGlobalTracerProvider(this),null!==(t=e.propagator)&&(void 0!==t?yo.setGlobalPropagator(t):yo.setGlobalPropagator(new Du({propagators:[new Wu,new gu]})));var t,r=e.contextManager;if(null!==r){if(void 0===r){let e=new Md;return void(e.enable(),to.setGlobalContextManager(e))}r.enable(),to.setGlobalContextManager(r)}}},StackContextManager:Md,get PerformanceTimingNames(){return jd},addSpanNetworkEvent:Fd,addSpanNetworkEvents:function(r,n,e=!1,t,o){if(void 0===t&&(t=0!==n[jd.START_TIME]),e||(Fd(r,jd.FETCH_START,n,t),Fd(r,jd.DOMAIN_LOOKUP_START,n,t),Fd(r,jd.DOMAIN_LOOKUP_END,n,t),Fd(r,jd.CONNECT_START,n,t),Fd(r,jd.SECURE_CONNECTION_START,n,t),Fd(r,jd.CONNECT_END,n,t),Fd(r,jd.REQUEST_START,n,t),Fd(r,jd.RESPONSE_START,n,t),Fd(r,jd.RESPONSE_END,n,t)),!o){let e=n[jd.ENCODED_BODY_SIZE],t=(void 0!==e&&r.setAttribute("http.response_content_length",e),n[jd.DECODED_BODY_SIZE]);void 0!==t&&e!==t&&r.setAttribute("http.response_content_length_uncompressed",t)}},getElementXPath:function e(t,r){if(t.nodeType===Node.DOCUMENT_NODE)return"/";var n=((t,r)=>{let e=t.nodeType,n=(r=>{if(!r.parentNode)return 0;let n=[r.nodeType],e=(r.nodeType===Node.CDATA_SECTION_NODE&&n.push(Node.TEXT_NODE),Array.from(r.parentNode.childNodes));return 1<=(e=e.filter(e=>{var t=e.localName;return 0<=n.indexOf(e.nodeType)&&t===r.localName})).length?e.indexOf(r)+1:0})(t),o="";if(e===Node.ELEMENT_NODE){let e=t.getAttribute("id");if(r&&e)return`//*[@id="${e}"]`;o=t.localName}else if(e===Node.TEXT_NODE||e===Node.CDATA_SECTION_NODE)o="text()";else{if(e!==Node.COMMENT_NODE)return"";o="comment()"}return o&&1<n?`/${o}[${n}]`:"/"+o})(t,r);if(r&&0<n.indexOf("@id"))return n;let o="";return t.parentNode&&(o+=e(t.parentNode,r)),o+=n},getResource:function(e,u,n,t,o=new WeakSet,r){var s=Gd(e),e=((n,e,t,r,o)=>{let s=Iu(u),i=Iu(e),a=t.filter(e=>{var t=Iu(Nu(e[jd.FETCH_START])),r=Iu(Nu(e[jd.RESPONSE_END]));return e.initiatorType.toLowerCase()===(o||"xmlhttprequest")&&e.name===n&&t>=s&&r<=i});return a=0<a.length?a.filter(e=>!r.has(e)):a})(e=s.toString(),n,t,o,r);if(0===e.length)return{mainRequest:void 0};if(1!==e.length){o=qd(e);if(s.origin!==Hd()&&1<o.length){let e=o[0],t=((o,e,t)=>{var s=Iu(t),i=Iu(Nu(e));let a,u=o[1],r=o.length;for(let n=1;n<r;n++){let e=o[n],t=Iu(Nu(e[jd.FETCH_START])),r=s-Iu(Nu(e[jd.RESPONSE_END]));t>=i&&(!a||r<a)&&(a=r,u=e)}return u})(o,e[jd.RESPONSE_END],n),r=e[jd.RESPONSE_END];return t[jd.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}}return{mainRequest:e[0]}},hasKey:Bd,normalizeUrl:function(e){return Gd(e).href},parseUrl:Gd,shouldPropagateTraceHeaders:function(t,e){let r=e||[];return("string"==typeof r||r instanceof RegExp)&&(r=[r]),Gd(t).origin===Hd()||r.some(e=>"string"==typeof e?t===e:!!t.match(e))},sortResources:qd,AlwaysOffSampler:ud,AlwaysOnSampler:ld,BasicTracerProvider:Id,BatchSpanProcessor:yd,ConsoleSpanExporter:Pd,InMemorySpanExporter:Ud,NoopSpanProcessor:Ld,ParentBasedSampler:cd,RandomIdGenerator:wd,get SamplingDecision(){return sd},SimpleSpanProcessor:kd,TraceIdRatioBasedSampler:pd}),Kd=n(zd),Yd=od.OTLPTraceExporter,Wd=Dd.BatchSpanProcessor,$d=Kd.WebTracerProvider,Jd=Il,Xd=o,Qd="tccc",Zd="https://otlp.tccc.qcloud.com/v1/traces",eh=function(e){var t=new Yd({url:e.url||Zd,headers:{"X-Tps-TenantID":e.id||Qd}}),t=new $d({spanProcessors:[new Wd(t,{})],resource:Jd.defaultResource().merge(Jd.resourceFromAttributes({"tps.tenant.id":e.id||Qd,"service.name":"JsSIP","service.version":Xd.version}))});return t.register(),t.getTracer("JsSIP")},th={provider:eh({id:Qd,url:Zd}),attributes:{}},rh=(rd.setConfig=function(e){th.provider=eh(e)},rd.setAttributes=function(e){Object.assign(th.attributes,e)},rd.trace=function(e){return eh(e)},$.EventEmitter),nh=Pl.exports,oh=tc,ih=ec,sh=up,ah=s,uh=j,lh=Wc,ch=F(),ph=Ic,dh=Ac,hh=Tp,fh=ep,mh=Sp.exports,gh=kp,yh=Bp,_h=Yp,vh=B(),bh=Qp,Th=ed,Sh=td,wh=rd,Eh=sh.trace,Ah=sh.context,Oh=new ih("RTCSession"),xh={STATUS_NULL:0,STATUS_INVITE_SENT:1,STATUS_1XX_RECEIVED:2,STATUS_INVITE_RECEIVED:3,STATUS_WAITING_FOR_ANSWER:4,STATUS_ANSWERED:5,STATUS_WAITING_FOR_ACK:6,STATUS_CANCELED:7,STATUS_TERMINATED:8,STATUS_CONFIRMED:9},Ch=["audio","video"],Rh=(()=>{function i(e){l(this,i),Oh.debug("new"),(t=u(this,i))._id=null,t._ua=e,t._status=xh.STATUS_NULL,t._dialog=null,t._earlyDialogs={},t._contact=null,t._from_tag=null,t._to_tag=null,t._use_trtc=t._ua.configuration.use_trtc,t._trtc_already_join=!1,t._is_mini_program=ch.isMiniProgram(),t._connection=null,t._connectionPromiseQueue=Promise.resolve(),t._request=null,t._is_canceled=!1,t._cancel_reason="",t._is_confirmed=!1,t._late_sdp=!1,t._rtcOfferConstraints=null,t._rtcAnswerConstraints=null,t._localStream=null,t._remoteStream={},t._remoteMediaStream={},t._localTRTCClient=null,t._localUserId=null,t._trtcLocalStream=null,t._trtcLocalStreamLocallyGenerated=!1,t._trtcLocalStreamConfig={},t._trtcRemoteStream={},t._rtcReady=!0,t._iceReady=!1,t._timers={ackTimer:null,expiresTimer:null,invite2xxTimer:null,userNoAnswerTimer:null},t._direction=null,t._local_identity=null,t._remote_identity=null,t._start_time=null,t._end_time=null,t._tones=null,t._audioMuted=!1,t._videoMuted=!1,t._localHold=!1,t._remoteHold=!1,t._sessionTimers={enabled:t._ua.configuration.session_timers,refreshMethod:t._ua.configuration.session_timers_refresh_method,defaultExpires:ah.SESSION_EXPIRES,currentExpires:null,running:!1,refresher:!1,timer:null},t._referSubscribers={},t._data={};var t,e=Number(t._ua.configuration.log_level),e=1<e?e+1:e,r=null==(r=t._ua.configuration.uri.host)?void 0:r.includes("tencentcloud.com");return t.tracer=wh.trace({id:r?"tcccsg":"tccc",url:r?"https://otlp.connect.tencentcloud.com/v1/traces":"https://otlp.tccc.qcloud.com/v1/traces"}),nh.Logger.setLogLevel(e),t._ua.configuration.log_report?nh.Logger.enableUploadLog():nh.Logger.disableUploadLog(),t}return m(i,rh),p(i,[{key:"C",get:function(){return xh}},{key:"causes",get:function(){return ah.causes}},{key:"id",get:function(){return this._id}},{key:"connection",get:function(){return this._connection}},{key:"contact",get:function(){return this._contact}},{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}},{key:"start_time",get:function(){return this._start_time}},{key:"end_time",get:function(){return this._end_time}},{key:"data",get:function(){return this._data},set:function(e){this._data=e}},{key:"status",get:function(){return this._status}},{key:"localStreams",get:function(){return this._use_trtc?[this._trtcLocalStream]:[this._localStream]}},{key:"remoteStreams",get:function(){return this._use_trtc?Object.values(this._trtcRemoteStream):Object.values(this._remoteStream)}},{key:"isInProgress",value:function(){switch(this._status){case xh.STATUS_NULL:case xh.STATUS_INVITE_SENT:case xh.STATUS_1XX_RECEIVED:case xh.STATUS_INVITE_RECEIVED:case xh.STATUS_WAITING_FOR_ANSWER:return!0;default:return!1}}},{key:"isEstablished",value:function(){switch(this._status){case xh.STATUS_ANSWERED:case xh.STATUS_WAITING_FOR_ACK:case xh.STATUS_CONFIRMED:return!0;default:return!1}}},{key:"isEnded",value:function(){switch(this._status){case xh.STATUS_CANCELED:case xh.STATUS_TERMINATED:return!0;default:return!1}}},{key:"isMuted",value:function(){return{audio:this._audioMuted,video:this._videoMuted}}},{key:"isOnHold",value:function(){return{local:this._localHold,remote:this._remoteHold}}},{key:"connect",value:function(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length?arguments[2]:void 0,o=(Oh.debug("connect()"),e),s=ch.cloneObject(r.eventHandlers),i=ch.cloneArray(r.extraHeaders),a=ch.cloneObject(r.mediaConstraints,{audio:!0,video:!0}),u=r.mediaStream||null,l=ch.cloneObject(r.pcConfig,{iceServers:[]}),c=r.rtcConstraints||null,p=r.rtcOfferConstraints||null;if(this._rtcOfferConstraints=p,this._rtcAnswerConstraints=r.rtcAnswerConstraints||null,this._trtcLocalStreamConfig=r.streamConfig||{},this._data=r.data||this._data,void 0===e)throw new TypeError("Not enough arguments");if(this._status!==xh.STATUS_NULL)throw new uh.InvalidStateError(this._status);if(!Sh.RTCPeerConnection&&!ch.isMiniProgram())throw new uh.NotSupportedError("WebRTC not supported");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(o));for(t in this._sessionTimers.enabled&&ch.isDecimal(r.sessionTimersExpires)&&(r.sessionTimersExpires>=ah.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=r.sessionTimersExpires:this._sessionTimers.defaultExpires=ah.SESSION_EXPIRES),s)Object.prototype.hasOwnProperty.call(s,t)&&this.on(t,s[t]);this._from_tag=ch.newTag();var o=r.anonymous||!1,h={from_tag:this._from_tag};this._contact=this._ua.contact.toString({anonymous:o,outbound:!0}),o?(h.from_display_name="Anonymous",h.from_uri=new vh("sip","anonymous","anonymous.invalid"),i.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString())),i.push("Privacy: id")):r.fromUserName&&(h.from_uri=new vh("sip",r.fromUserName,this._ua.configuration.uri.host),i.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))),r.fromDisplayName&&(h.from_display_name=r.fromDisplayName),i.push("Contact: ".concat(this._contact)),i.push("Content-Type: application/sdp"),this._sessionTimers.enabled&&i.push("Session-Expires: ".concat(this._sessionTimers.defaultExpires).concat(this._ua.configuration.session_timers_force_refresher?";refresher=uac":"")),this._use_trtc&&i.push("X-TRTC: 1"),this._request=new dh.InitialOutgoingInviteRequest(e,this._ua,h,i),this._id=this._request.call_id+this._from_tag,this._use_trtc||this._createRTCConnection(l,c),this._direction="outgoing",this._local_identity=this._request.from,this._remote_identity=this._request.to,n&&n(this),this._newRTCSession("local",this._request),this._use_trtc?this._sendTRTCInitialRequest():this._sendInitialRequest(a,p,u)}},{key:"init_incoming",value:function(e,t){var r,n=this,o=(Oh.debug("init_incoming()"),e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0);e.body&&"application/sdp"!==o?e.reply(415):(this._status=xh.STATUS_INVITE_RECEIVED,this._from_tag=e.from_tag,this._id=e.call_id+this._from_tag,this._request=e,this._contact=this._ua.contact.toString(),e.hasHeader("expires")&&(r=1e3*e.getHeader("expires")),e.to_tag=ch.newTag(),this._createDialog(e,"UAS",!0)?(e.body?this._late_sdp=!1:this._late_sdp=!0,this._status=xh.STATUS_WAITING_FOR_ANSWER,this._timers.userNoAnswerTimer=setTimeout(function(){e.reply(408),n._failed("local",null,ah.causes.NO_ANSWER)},this._ua.configuration.no_answer_timeout),r&&(this._timers.expiresTimer=setTimeout(function(){n._status===xh.STATUS_WAITING_FOR_ANSWER&&(e.reply(487),n._failed("system",null,ah.causes.EXPIRES))},r)),this._direction="incoming",this._local_identity=e.to,this._remote_identity=e.from,t&&t(this),this._newRTCSession("remote",e),this._status!==xh.STATUS_TERMINATED&&(e.reply(180,null,["Contact: ".concat(this._contact)]),this._progress("local",null))):e.reply(500,"Missing Contact header field"))}},{key:"answer",value:function(){var i=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=(Oh.debug("answer()"),this._request),t=ch.cloneArray(e.extraHeaders),r=ch.cloneObject(e.mediaConstraints),n=e.mediaStream||null,o=ch.cloneObject(e.pcConfig,{iceServers:[]}),s=e.rtcConstraints||null,u=e.rtcAnswerConstraints||null,l=ch.cloneObject(e.rtcOfferConstraints),c=!1,p=!1,h=!1,f=!1;if(this._rtcAnswerConstraints=u,this._rtcOfferConstraints=e.rtcOfferConstraints||null,this._trtcLocalStreamConfig=e.streamConfig||{},this._data=e.data||this._data,"incoming"!==this._direction)throw new uh.NotSupportedError('"answer" not supported for outgoing RTCSession');if(this._status!==xh.STATUS_WAITING_FOR_ANSWER)throw new uh.InvalidStateError(this._status);if(this._sessionTimers.enabled&&ch.isDecimal(e.sessionTimersExpires)&&(e.sessionTimersExpires>=ah.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=e.sessionTimersExpires:this._sessionTimers.defaultExpires=ah.SESSION_EXPIRES),this._status=xh.STATUS_ANSWERED,this._createDialog(a,"UAS")){if(clearTimeout(this._timers.userNoAnswerTimer),t.unshift("Contact: ".concat(this._contact)),this._use_trtc){var m=a.getHeader("X-TRTC-SDKAPPID"),g=a.getHeader("X-TRTC-USERID"),y=parseInt(a.getHeader("X-TRTC-ROOMID"),10),_=a.getHeader("X-TRTC-STRROOMID"),v=a.getHeader("X-TRTC-USERSIG"),b=a.getHeader("X-TRTC-PRIVATEMAPKEY"),e=a.getHeader("X-TCCC-IVR"),S=a.getHeader("X-TRTC-PROXY");if(!this._is_mini_program&&m&&g&&(y||_)&&v)return void Promise.resolve().then(function(){return i._connecting(a),i._joinTRTCRoom({sdkAppId:m,userId:g,roomId:y,strRoomId:_,privateMapKey:b,userSig:v,proxy:S},function(e){i.terminate({status_code:480,cause:ah.causes.WEBRTC_ERROR,reason_phrase:"TRTC Error"}),i._failed("system",e.toString(),ah.causes.WEBRTC_ERROR)})}).then(function(e){if(i._status===xh.STATUS_TERMINATED)throw new Error("terminated");Oh.debug("TRTC success"),i._handleSessionTimersInIncomingRequest(a,t),a.reply(200,null,t,e,function(){i._status=xh.STATUS_WAITING_FOR_ACK,i._setInvite2xxTimer(a,e),i._setACKTimer(),i._accepted("local")},function(){i._failed("system",null,ah.causes.CONNECTION_ERROR)}),i._late_sdp=!1}).catch(function(e){var t,r,n,o,s;if(i._status!==xh.STATUS_TERMINATED)throw r=t=ah.causes.WEBRTC_ERROR,n=e.name,(o=["NotFoundError","NotAllowedError","NotReadableError","OverconstrainedError","AbortError"].includes(n))&&(t=ah.causes.USER_DENIED_MEDIA_ACCESS,Oh.warn('emit "getusermediafailed" [error:%o]',e),i.emit("getusermediafailed",e)),s=ch.isFunction(e.getCode)?e.getCode():"0","RtcError"===e.name&&Oh.error("TRTC error",e.toString(),{code:s,name:n}),!o&&e.message&&(r=e.message),Oh.debug("TRTC error then terminate",{code:s,name:n}),a.reply(480,r),i._failed("local",e.toString(),t),e});if(e||this._is_mini_program)return(new Promise.resolve).then(function(e){if(i._status===xh.STATUS_TERMINATED)throw new Error("terminated");Oh.debug("processing pure signal mode"),i._handleSessionTimersInIncomingRequest(a,t),a.reply(200,null,t,e,function(){i._status=xh.STATUS_WAITING_FOR_ACK,i._setInvite2xxTimer(a,e),i._setACKTimer(),i._accepted("local")},function(){i._failed("system",null,ah.causes.CONNECTION_ERROR)}),i._late_sdp=!1}).catch(function(e){var t;if(i._status!==xh.STATUS_TERMINATED)throw Oh.error("pure signal mode error then terminate",e.toString()),t=ah.causes.WEBRTC_ERROR,a.reply(480,t),i._failed("local",e.toString(),t),e});throw Oh.error("missing TRTC config"),a.reply(500),this._failed("system",null,ah.causes.INTERNAL_ERROR),new Error("missing config")}e=a.parseSDP();Array.isArray(e.media)||(e.media=[e.media]);var T,w=d(e.media);try{for(w.s();!(T=w.n()).done;){var E=T.value;"audio"===E.type&&(c=!0,E.direction&&"sendrecv"!==E.direction||(h=!0)),"video"===E.type&&(p=!0,E.direction&&"sendrecv"!==E.direction||(f=!0))}}catch(i){w.e(i)}finally{w.f()}if(n&&!1===r.audio){var A,O=d(n.getAudioTracks());try{for(O.s();!(A=O.n()).done;){var x=A.value;n.removeTrack(x)}}catch(i){O.e(i)}finally{O.f()}}if(n&&!1===r.video){var C,R=d(n.getVideoTracks());try{for(R.s();!(C=R.n()).done;){var N=C.value;n.removeTrack(N)}}catch(i){R.e(i)}finally{R.f()}}n||void 0!==r.audio||(r.audio=h),n||void 0!==r.video||(r.video=f),n||c||l.offerToReceiveAudio||(r.audio=!1),n||p||l.offerToReceiveVideo||(r.video=!1),this._createRTCConnection(o,s),Promise.resolve().then(function(){return n||(r.audio||r.video?new bh(r).initialize().catch(function(e){if(i._status===xh.STATUS_TERMINATED)throw new Error("terminated");var t=ah.causes.USER_DENIED_MEDIA_ACCESS;throw a.reply(480,t),i._failed("local",null,ah.causes.USER_DENIED_MEDIA_ACCESS),Oh.warn('emit "getusermediafailed" [error:%o]',e),i.emit("getusermediafailed",e),new Error("getUserMedia() failed")}):void 0)}).then(function(t){if(i._status===xh.STATUS_TERMINATED)throw new Error("terminated");(i._localStream=t).mediaStream&&t.mediaStream.getTracks().forEach(function(e){i._connection.addTrack(e,t.mediaStream)})}).then(function(){var e,t;if(!i._late_sdp)return e={originator:"remote",type:"offer",sdp:a.body},Oh.debug('emit "sdp"'),i.emit("sdp",e),t=new RTCSessionDescription({type:"offer",sdp:e.sdp}),i._connectionPromiseQueue=i._connectionPromiseQueue.then(function(){return i._connection.setRemoteDescription(t)}).catch(function(e){throw a.reply(488),i._failed("system",null,ah.causes.WEBRTC_ERROR),Oh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),i.emit("peerconnection:setremotedescriptionfailed",e),new Error("peerconnection.setRemoteDescription() failed")}),i._connectionPromiseQueue}).then(function(){if(i._status===xh.STATUS_TERMINATED)throw new Error("terminated");return i._connecting(a),(i._late_sdp?i._createLocalDescription("offer",i._rtcOfferConstraints):i._createLocalDescription("answer",u)).catch(function(){throw a.reply(500),new Error("_createLocalDescription() failed")})}).then(function(e){if(i._status===xh.STATUS_TERMINATED)throw new Error("terminated");i._handleSessionTimersInIncomingRequest(a,t),a.reply(200,null,t,e,function(){i._status=xh.STATUS_WAITING_FOR_ACK,i._setInvite2xxTimer(a,e),i._setACKTimer(),i._accepted("local")},function(){i._failed("system",null,ah.causes.CONNECTION_ERROR)})}).catch(function(e){i._status!==xh.STATUS_TERMINATED&&Oh.warn(e)})}else a.reply(500,"Error creating dialog")}},{key:"terminate",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};Oh.debug("terminate()");var r,n,o=e.cause||ah.causes.BYE,s=ch.cloneArray(e.extraHeaders),i=e.body,a=e.status_code,u=e.reason_phrase;if(this._status===xh.STATUS_TERMINATED)throw new uh.InvalidStateError(this._status);switch(this._status){case xh.STATUS_NULL:case xh.STATUS_INVITE_SENT:case xh.STATUS_1XX_RECEIVED:if(Oh.debug("canceling session"),a&&(a<200||700<=a))throw new TypeError("Invalid status_code: ".concat(a));a&&(u=u||ah.REASON_PHRASE[a]||"",r="SIP ;cause=".concat(a,' ;text="').concat(u,'"')),this._status===xh.STATUS_NULL||this._status===xh.STATUS_INVITE_SENT?(this._is_canceled=!0,this._cancel_reason=r):this._status===xh.STATUS_1XX_RECEIVED&&this._request.cancel(r),this._status=xh.STATUS_CANCELED,this._failed("local",null,ah.causes.CANCELED);break;case xh.STATUS_WAITING_FOR_ANSWER:case xh.STATUS_ANSWERED:if(Oh.debug("rejecting session"),(a=a||480)<300||700<=a)throw new TypeError("Invalid status_code: ".concat(a));this._request.reply(a,u,s,i),this._failed("local",null,ah.causes.REJECTED);break;case xh.STATUS_WAITING_FOR_ACK:case xh.STATUS_CONFIRMED:if(Oh.debug("terminating session"),u=e.reason_phrase||ah.REASON_PHRASE[a]||"",a&&(a<200||700<=a))throw new TypeError("Invalid status_code: ".concat(a));a&&s.push("Reason: SIP ;cause=".concat(a,'; text="').concat(u,'"')),this._status===xh.STATUS_WAITING_FOR_ACK&&"incoming"===this._direction&&this._request.server_transaction.state!==lh.C.STATUS_TERMINATED?(n=this._dialog,this.receiveRequest=function(e){e.method===ah.ACK&&(t.sendRequest(ah.BYE,{extraHeaders:s,body:i}),n.terminate())},this._request.server_transaction.on("stateChanged",function(){t._request.server_transaction.state===lh.C.STATUS_TERMINATED&&(t.sendRequest(ah.BYE,{extraHeaders:s,body:i}),n.terminate())}),this._ended("local",null,o),this._dialog=n,this._ua.newDialog(n)):(this.sendRequest(ah.BYE,{extraHeaders:s,body:i}),this._ended("local",null,o))}}},{key:"sendDTMF",value:function(e){var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},s=(Oh.debug("sendDTMF() | tones: %s",e),0),i=o.duration||null,a=o.interToneGap||null,t=o.transportType||ah.DTMF_TRANSPORT.INFO;if(void 0===e)throw new TypeError("Not enough arguments");if(this._status!==xh.STATUS_CONFIRMED&&this._status!==xh.STATUS_WAITING_FOR_ACK&&this._status!==xh.STATUS_1XX_RECEIVED)throw new uh.InvalidStateError(this._status);if(t!==ah.DTMF_TRANSPORT.INFO&&t!==ah.DTMF_TRANSPORT.RFC2833)throw new TypeError("invalid transportType: ".concat(t));if(!(e="number"==typeof e?e.toString():e)||"string"!=typeof e||!e.match(/^[0-9A-DR#*,]+$/i))throw new TypeError("Invalid tones: ".concat(e));if(i&&!ch.isDecimal(i))throw new TypeError("Invalid tone duration: ".concat(i));if(i=i?i<mh.C.MIN_DURATION?(Oh.debug('"duration" value is lower than the minimum allowed, setting it to '.concat(mh.C.MIN_DURATION," milliseconds")),mh.C.MIN_DURATION):i>mh.C.MAX_DURATION?(Oh.debug('"duration" value is greater than the maximum allowed, setting it to '.concat(mh.C.MAX_DURATION," milliseconds")),mh.C.MAX_DURATION):Math.abs(i):mh.C.DEFAULT_DURATION,o.duration=i,a&&!ch.isDecimal(a))throw new TypeError("Invalid interToneGap: ".concat(a));a=a?a<mh.C.MIN_INTER_TONE_GAP?(Oh.debug('"interToneGap" value is lower than the minimum allowed, setting it to '.concat(mh.C.MIN_INTER_TONE_GAP," milliseconds")),mh.C.MIN_INTER_TONE_GAP):Math.abs(a):mh.C.DEFAULT_INTER_TONE_GAP,t!==ah.DTMF_TRANSPORT.RFC2833?this._tones?this._tones+=e:(this._tones=e,function e(){var t,r,n=this;this._status===xh.STATUS_TERMINATED||!this._tones||s>=this._tones.length?this._tones=null:(t=this._tones[s],s+=1,r=","===t?2e3:(r=new mh(this),o.eventHandlers={onFailed:function(){n._tones=null}},r.send(t,o),i+a),setTimeout(e.bind(this),r))}.call(this)):(t=this._getDTMFRTPSender())&&(e=t.toneBuffer+e,t.insertDTMF(e,i,a))}},{key:"sendInfo",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(Oh.debug("sendInfo()"),this._status!==xh.STATUS_CONFIRMED&&this._status!==xh.STATUS_WAITING_FOR_ACK&&this._status!==xh.STATUS_1XX_RECEIVED)throw new uh.InvalidStateError(this._status);new gh(this).send(e,t,r)}},{key:"mute",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!1},t=(Oh.debug("mute()"),!1),r=!1;!1===this._audioMuted&&e.audio&&(this._audioMuted=t=!0,this._toggleMuteAudio(!0)),!1===this._videoMuted&&e.video&&(this._videoMuted=r=!0,this._toggleMuteVideo(!0)),!0!==t&&!0!==r||this._onmute({audio:t,video:r})}},{key:"unmute",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!0},t=(Oh.debug("unmute()"),!1),r=!1;!0===this._audioMuted&&e.audio&&(this._audioMuted=!(t=!0))===this._localHold&&this._toggleMuteAudio(!1),!0===this._videoMuted&&e.video&&(this._videoMuted=!(r=!0))===this._localHold&&this._toggleMuteVideo(!1),!0!==t&&!0!==r||this._onunmute({audio:t,video:r})}},{key:"switchMicrophones",value:function(e){if(Oh.debug("switchMicrophones(%s)",e),!this._is_confirmed||!this._trtcLocalStream)throw new uh.InvalidStateError(this._status);if(this._trtcLocalStream)return this._trtcLocalStream.switchDevice("audio",e);throw new uh.NotSupportedError("WebRTC mode not support switchMicrophones")}},{key:"switchSpeaker",value:function(t){var r=this;if(Oh.debug("switchSpeaker(%s)",t,this._trtcRemoteStream),!this._is_confirmed)throw new uh.InvalidStateError(this._status);if(this._trtcLocalStream){var e,n=[];for(e in this._trtcRemoteStream)(e=>{Object.prototype.hasOwnProperty.call(r._trtcRemoteStream,e)&&(Oh.error("stream",e),n.push(function(){return r._trtcRemoteStream[e].setAudioOutput(t)}))})(e);return Promise.all(n)}throw new uh.NotSupportedError("WebRTC mode not support switchSpeaker")}},{key:"setAudioVolume",value:function(e){if(Oh.debug("setAudioVolume(%d)",e),!this._is_confirmed)throw new uh.InvalidStateError(this._status);if(this._trtcLocalStream)for(var t in this._trtcLocalStream.setAudioVolume(e),this._trtcRemoteStream)Object.prototype.hasOwnProperty.call(this._trtcRemoteStream,t)&&this._trtcRemoteStream[t].setAudioVolume(e);throw new uh.NotSupportedError("WebRTC mode not support setAudioVolume")}},{key:"enableAudioVolumeEvaluation",value:function(e,t){if(Oh.debug("enableAudioVolumeEvaluation(%d)",e),this._localTRTCClient)return this._localTRTCClient.enableAudioVolumeEvaluation(e,t);throw new uh.InvalidStateError(this._status)}},{key:"hold",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length?arguments[1]:void 0;if(Oh.debug("hold()"),this._status!==xh.STATUS_WAITING_FOR_ACK&&this._status!==xh.STATUS_CONFIRMED)return!1;if(!0===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!0,this._onhold("local");var n={succeeded:function(){r&&r()},failed:function(){e.terminate({cause:ah.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Hold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:n,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:n,extraHeaders:t.extraHeaders}),!0}},{key:"unhold",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length?arguments[1]:void 0;if(Oh.debug("unhold()"),this._status!==xh.STATUS_WAITING_FOR_ACK&&this._status!==xh.STATUS_CONFIRMED)return!1;if(!1===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!1,this._onunhold("local");var n={succeeded:function(){r&&r()},failed:function(){e.terminate({cause:ah.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Unhold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:n,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:n,extraHeaders:t.extraHeaders}),!0}},{key:"renegotiate",value:function(){var e,t=this,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,o=(Oh.debug("renegotiate()"),r.rtcOfferConstraints||null);return!(this._status!==xh.STATUS_WAITING_FOR_ACK&&this._status!==xh.STATUS_CONFIRMED||!this._isReadyToReOffer()||(e={succeeded:function(){n&&n()},failed:function(){t.terminate({cause:ah.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Media Renegotiation Failed"})}},this._setLocalMediaStatus(),r.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:e,rtcOfferConstraints:o,extraHeaders:r.extraHeaders}):this._sendReinvite({eventHandlers:e,rtcOfferConstraints:o,extraHeaders:r.extraHeaders}),0))}},{key:"refer",value:function(e,t){var r,n,o=this,s=(Oh.debug("refer()"),e);if(this._status!==xh.STATUS_WAITING_FOR_ACK&&this._status!==xh.STATUS_CONFIRMED)return!1;if(e=this._ua.normalizeTarget(e))return(r=new _h(this)).sendRefer(e,t),n=r.id,(this._referSubscribers[n]=r).on("requestFailed",function(){delete o._referSubscribers[n]}),r.on("accepted",function(){delete o._referSubscribers[n]}),r.on("failed",function(){delete o._referSubscribers[n]}),r;throw new TypeError("Invalid target: ".concat(s))}},{key:"sendRequest",value:function(e,t){return Oh.debug("sendRequest()"),this._dialog.sendRequest(e,t)}},{key:"receiveRequest",value:function(e){var t=this;if(Oh.debug("receiveRequest()"),e.method===ah.CANCEL)this._status!==xh.STATUS_WAITING_FOR_ANSWER&&this._status!==xh.STATUS_ANSWERED||(this._status=xh.STATUS_CANCELED,this._request.reply(487),this._failed("remote",e,ah.causes.CANCELED));else switch(e.method){case ah.ACK:if(this._status===xh.STATUS_WAITING_FOR_ACK)if(this._status=xh.STATUS_CONFIRMED,clearTimeout(this._timers.ackTimer),clearTimeout(this._timers.invite2xxTimer),this._late_sdp){if(!e.body){this.terminate({cause:ah.causes.MISSING_SDP,status_code:400});break}var r={originator:"remote",type:"answer",sdp:e.body},n=(Oh.debug('emit "sdp"'),this.emit("sdp",r),new RTCSessionDescription({type:"answer",sdp:r.sdp}));this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(n)}).then(function(){t._is_confirmed||t._confirmed("remote",e)}).catch(function(e){t.terminate({cause:ah.causes.BAD_MEDIA_DESCRIPTION,status_code:488}),Oh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)})}else this._is_confirmed||this._confirmed("remote",e);break;case ah.BYE:this._status===xh.STATUS_CONFIRMED||this._status===xh.STATUS_WAITING_FOR_ACK?(e.reply(200),this._ended("remote",e,ah.causes.BYE)):this._status===xh.STATUS_INVITE_RECEIVED||this._status===xh.STATUS_WAITING_FOR_ANSWER?(e.reply(200),this._request.reply(487,"BYE Received"),this._ended("remote",e,ah.causes.BYE)):e.reply(403,"Wrong Status");break;case ah.INVITE:this._status===xh.STATUS_CONFIRMED?e.hasHeader("replaces")?this._receiveReplaces(e):this._receiveReinvite(e):e.reply(403,"Wrong Status");break;case ah.INFO:this._status===xh.STATUS_1XX_RECEIVED||this._status===xh.STATUS_WAITING_FOR_ANSWER||this._status===xh.STATUS_ANSWERED||this._status===xh.STATUS_WAITING_FOR_ACK||this._status===xh.STATUS_CONFIRMED?(r=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0)&&r.match(/^application\/dtmf-relay/i)?new mh(this).init_incoming(e):void 0!==r?new gh(this).init_incoming(e):e.reply(415):e.reply(403,"Wrong Status");break;case ah.UPDATE:this._status===xh.STATUS_CONFIRMED?this._receiveUpdate(e):e.reply(403,"Wrong Status");break;case ah.REFER:this._status===xh.STATUS_CONFIRMED?this._receiveRefer(e):e.reply(403,"Wrong Status");break;case ah.NOTIFY:this._status===xh.STATUS_CONFIRMED?this._receiveNotify(e):e.reply(403,"Wrong Status");break;default:e.reply(501)}}},{key:"onTransportError",value:function(){Oh.warn("onTransportError()"),this._status!==xh.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:ah.causes.CONNECTION_ERROR,cause:ah.causes.CONNECTION_ERROR})}},{key:"onRequestTimeout",value:function(){Oh.warn("onRequestTimeout()"),this._status!==xh.STATUS_TERMINATED&&this.terminate({status_code:408,reason_phrase:ah.causes.REQUEST_TIMEOUT,cause:ah.causes.REQUEST_TIMEOUT})}},{key:"onDialogError",value:function(){Oh.warn("onDialogError()"),this._status!==xh.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:ah.causes.DIALOG_ERROR,cause:ah.causes.DIALOG_ERROR})}},{key:"newDTMF",value:function(e){Oh.debug("newDTMF()"),this.emit("newDTMF",e)}},{key:"newInfo",value:function(e){Oh.debug("newInfo()"),this.emit("newInfo",e)}},{key:"_isReadyToReOffer",value:function(){return this._rtcReady?this._dialog?!0!==this._dialog.uac_pending_reply&&!0!==this._dialog.uas_pending_reply||(Oh.debug("_isReadyToReOffer() | there is another INVITE/UPDATE transaction in progress"),!1):(Oh.debug("_isReadyToReOffer() | session not established yet"),!1):(Oh.debug("_isReadyToReOffer() | internal WebRTC status not ready"),!1)}},{key:"_close",value:function(){var e=this;if(Oh.debug("close()"),this._localStream&&this._localStream.close(),this._trtcLocalStream&&this._trtcLocalStreamLocallyGenerated&&(Oh.debug("close() | closing trtcLocalStream"),Promise.resolve().then(function(){if(e._localTRTCClient)return e._localTRTCClient.unpublish(e._trtcLocalStream)}).then(function(){return!e._localTRTCClient||e._localTRTCClient.leave()}).then(function(){e._trtcLocalStream.close()}).catch(function(e){Oh.warn("TRTC leave room failed [error:%o]",e)}).then(function(){Oh.debug("TRTC destroy"),e._localTRTCClient&&e._localTRTCClient.destroy()})),this._status!==xh.STATUS_TERMINATED){if(this._status=xh.STATUS_TERMINATED,this._connection){for(var t in this._remoteStream)this.emit("removestream",t);try{this._connection.close()}catch(e){Oh.warn("close() | error closing the RTCPeerConnection: %o",e)}}for(var r in this._timers)Object.prototype.hasOwnProperty.call(this._timers,r)&&clearTimeout(this._timers[r]);for(var n in clearTimeout(this._sessionTimers.timer),this._dialog&&(this._dialog.terminate(),delete this._dialog),this._earlyDialogs)Object.prototype.hasOwnProperty.call(this._earlyDialogs,n)&&(this._earlyDialogs[n].terminate(),delete this._earlyDialogs[n]);for(var o in this._referSubscribers)Object.prototype.hasOwnProperty.call(this._referSubscribers,o)&&delete this._referSubscribers[o];this._ua.destroyRTCSession(this)}}},{key:"_setInvite2xxTimer",value:function(t,r){var n=ph.T1;this._timers.invite2xxTimer=setTimeout(function e(){this._status===xh.STATUS_WAITING_FOR_ACK&&(t.reply(200,null,["Contact: ".concat(this._contact)],r),n<ph.T2&&(n*=2)>ph.T2&&(n=ph.T2),this._timers.invite2xxTimer=setTimeout(e.bind(this),n))}.bind(this),n)}},{key:"_setACKTimer",value:function(){var e=this;this._timers.ackTimer=setTimeout(function(){e._status===xh.STATUS_WAITING_FOR_ACK&&(Oh.debug("no ACK received, terminating the session"),clearTimeout(e._timers.invite2xxTimer),e.sendRequest(ah.BYE),e._ended("remote",null,ah.causes.NO_ACK))},ph.TIMER_H)}},{key:"_createRTCConnection",value:function(e,t){var r=this;this._connection=new RTCPeerConnection(e,t),this._connection.addEventListener("iceconnectionstatechange",function(){"failed"===r._connection.iceConnectionState&&r.terminate({cause:ah.causes.RTP_TIMEOUT,status_code:408,reason_phrase:ah.causes.RTP_TIMEOUT})}),this._connection.addEventListener("track",function(e){var t,e=e.streams[0];r._remoteStream[e.id]||(t=new Th({mediaStream:e}),r._remoteStream[e.id]=t,Oh.debug('emit "addstream" '.concat(e.id)),r.emit("addstream",{stream:t}))}),Oh.debug('emit "peerconnection"'),this.emit("peerconnection",{peerconnection:this._connection})}},{key:"_createLocalDescription",value:function(i,t){var a=this;if(Oh.debug("createLocalDescription(%s, %o)",i,t),"offer"!==i&&"answer"!==i)throw new Error('createLocalDescription() | invalid type "'.concat(i,'"'));var u=this._connection;return this._rtcReady=!1,Promise.resolve().then(function(){return"offer"===i?u.createOffer(t).catch(function(e){return Oh.warn('emit "peerconnection:createofferfailed" [error:%o]',e),a.emit("peerconnection:createofferfailed",e),Promise.reject(e)}):u.createAnswer(t).catch(function(e){return Oh.warn('emit "peerconnection:createanswerfailed" [error:%o]',e),a.emit("peerconnection:createanswerfailed",e),Promise.reject(e)})}).then(function(e){return u.setLocalDescription(e).catch(function(e){return a._rtcReady=!0,Oh.warn('emit "peerconnection:setlocaldescriptionfailed" [error:%o]',e),a.emit("peerconnection:setlocaldescriptionfailed",e),Promise.reject(e)})}).then(function(){var e=t&&t.iceRestart;return"complete"===u.iceGatheringState&&!e||"gathering"===u.iceGatheringState&&a._iceReady?(a._rtcReady=!0,e={originator:"local",type:i,sdp:u.localDescription.sdp},Oh.debug('emit "sdp"'),a.emit("sdp",e),Promise.resolve(e.sdp)):new Promise(function(t){function r(){u.removeEventListener("icecandidate",n),u.removeEventListener("icegatheringstatechange",o),s=!0,a._rtcReady=!0,a._iceReady=!0;var e={originator:"local",type:i,sdp:u.localDescription.sdp};Oh.debug('emit "sdp"'),a.emit("sdp",e),t(e.sdp)}var n,o,s=!1;a._iceReady=!1;u.addEventListener("icecandidate",n=function(e){e=e.candidate;e?a.emit("icecandidate",{candidate:e,ready:r}):s||r()}),u.addEventListener("icegatheringstatechange",o=function(){"complete"!==u.iceGatheringState||s||r()})})})}},{key:"_createDialog",value:function(e,t,r){var n="UAS"===t?e.to_tag:e.from_tag,o="UAS"===t?e.from_tag:e.to_tag,n=e.call_id+n+o,o=this._earlyDialogs[n];return r?!!o||((o=new hh(this,e,t,hh.C.STATUS_EARLY)).error?(Oh.debug(o.error),this._failed("remote",e,ah.causes.INTERNAL_ERROR),!1):(this._earlyDialogs[n]=o,!0)):(this._from_tag=e.from_tag,this._to_tag=e.to_tag,o?(o.update(e,t),this._dialog=o,delete this._earlyDialogs[n],!0):(r=new hh(this,e,t)).error?(Oh.debug(r.error),this._failed("remote",e,ah.causes.INTERNAL_ERROR),!1):(this._dialog=r,!0))}},{key:"_receiveReinvite",value:function(n){var t=this,e=(Oh.debug("receiveReinvite()"),n.hasHeader("Content-Type")?n.getHeader("Content-Type").toLowerCase():void 0),o={request:n,callback:void 0,reject:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s=!0,e.status_code||403),r=e.reason_phrase||"",e=ch.cloneArray(e.extraHeaders);if(this._status!==xh.STATUS_CONFIRMED)return!1;if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));n.reply(t,r,e)}.bind(this)},s=!1;function r(e){var t=this,r=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(n,r),this._late_sdp&&(e=this._mangleOffer(e)),n.reply(200,null,r,e,function(){t._status=xh.STATUS_WAITING_FOR_ACK,t._setInvite2xxTimer(n,e),t._setACKTimer()}),"function"==typeof o.callback&&o.callback()}this.emit("reinvite",o),s||(this._late_sdp=!1,n.body?"application/sdp"!==e?(Oh.debug("invalid Content-Type"),n.reply(415)):this._processInDialogSdpOffer(n).then(function(e){t._status!==xh.STATUS_TERMINATED&&r.call(t,e)}).catch(function(e){Oh.warn(e)}):(this._late_sdp=!0,this._remoteHold&&(this._remoteHold=!1,this._onunhold("remote")),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._createLocalDescription("offer",t._rtcOfferConstraints)}).then(function(e){r.call(t,e)}).catch(function(){n.reply(500)})))}},{key:"_receiveUpdate",value:function(n){var t=this,e=(Oh.debug("receiveUpdate()"),n.hasHeader("Content-Type")?n.getHeader("Content-Type").toLowerCase():void 0),r={request:n,callback:void 0,reject:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(o=!0,e.status_code||403),r=e.reason_phrase||"",e=ch.cloneArray(e.extraHeaders);if(this._status!==xh.STATUS_CONFIRMED)return!1;if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));n.reply(t,r,e)}.bind(this)},o=!1;function s(e){var t=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(n,t),n.reply(200,null,t,e),"function"==typeof r.callback&&r.callback()}this.emit("update",r),o||(n.body?"application/sdp"!==e?(Oh.debug("invalid Content-Type"),n.reply(415)):this._processInDialogSdpOffer(n).then(function(e){t._status!==xh.STATUS_TERMINATED&&s.call(t,e)}).catch(function(e){Oh.warn(e)}):s.call(this,null))}},{key:"_processInDialogSdpOffer",value:function(t){var r=this;Oh.debug("_processInDialogSdpOffer()");var e,n=t.parseSDP(),o=!1,s=d(n.media);try{for(s.s();!(e=s.n()).done;){var i=e.value;if(-1!==Ch.indexOf(i.type)){var a=i.direction||n.direction||"sendrecv";if("sendonly"!==a&&"inactive"!==a){o=!1;break}o=!0}}}catch(t){s.e(t)}finally{s.f()}var u={originator:"remote",type:"offer",sdp:t.body},l=(Oh.debug('emit "sdp"'),this.emit("sdp",u),new RTCSessionDescription({type:"offer",sdp:u.sdp}));return this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if(r._status===xh.STATUS_TERMINATED)throw new Error("terminated");return r._connection.setRemoteDescription(l).catch(function(e){throw t.reply(488),Oh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),r.emit("peerconnection:setremotedescriptionfailed",e),e})}).then(function(){if(r._status===xh.STATUS_TERMINATED)throw new Error("terminated");!0===r._remoteHold&&!1===o?(r._remoteHold=!1,r._onunhold("remote")):!1===r._remoteHold&&!0===o&&(r._remoteHold=!0,r._onhold("remote"))}).then(function(){if(r._status===xh.STATUS_TERMINATED)throw new Error("terminated");return r._createLocalDescription("answer",r._rtcAnswerConstraints).catch(function(e){throw t.reply(500),Oh.warn('emit "peerconnection:createtelocaldescriptionfailed" [error:%o]',e),e})}).catch(function(e){Oh.warn("_processInDialogSdpOffer() failed [error: %o]",e)}),this._connectionPromiseQueue}},{key:"_receiveRefer",value:function(o){var s,r=this;Oh.debug("receiveRefer()"),o.refer_to?o.refer_to.uri.scheme!==ah.SIP?(Oh.debug("Refer-To header field points to a non-SIP URI scheme"),o.reply(416)):(o.reply(202),s=new yh(this,o.cseq),Oh.debug('emit "refer"'),this.emit("refer",{request:o,accept:function(e,t){!function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(e="function"==typeof e?e:null,this._status!==xh.STATUS_WAITING_FOR_ACK&&this._status!==xh.STATUS_CONFIRMED)return!1;var r,n=new i(this._ua);n.on("progress",function(e){e=e.response;s.notify(e.status_code,e.reason_phrase)}),n.on("accepted",function(e){e=e.response;s.notify(e.status_code,e.reason_phrase)}),n.on("_failed",function(e){var t=e.message,e=e.cause;t?s.notify(t.status_code,t.reason_phrase):s.notify(487,e)}),o.refer_to.uri.hasHeader("replaces")&&(r=decodeURIComponent(o.refer_to.uri.getHeader("replaces")),t.extraHeaders=ch.cloneArray(t.extraHeaders),t.extraHeaders.push("Replaces: ".concat(r))),n.connect(o.refer_to.uri.toAor(),t,e)}.call(r,e,t)},reject:function(){!function(){s.notify(603)}.call(r)}})):(Oh.debug("no Refer-To header field present in REFER"),o.reply(400))}},{key:"_receiveNotify",value:function(e){if(Oh.debug("receiveNotify()"),e.event||e.reply(400),"refer"===e.event.event){var t;if(e.event.params&&e.event.params.id)t=e.event.params.id,t=this._referSubscribers[t];else{if(1!==Object.keys(this._referSubscribers).length)return void e.reply(400,"Missing event id parameter");t=this._referSubscribers[Object.keys(this._referSubscribers)[0]]}t?(t.receiveNotify(e),e.reply(200)):e.reply(481,"Subscription does not exist")}else e.reply(489)}},{key:"_receiveReplaces",value:function(n){var t=this;Oh.debug("receiveReplaces()"),this.emit("replaces",{request:n,accept:function(e){!function(e){var t=this;if(this._status!==xh.STATUS_WAITING_FOR_ACK&&this._status!==xh.STATUS_CONFIRMED)return!1;var r=new i(this._ua);r.on("confirmed",function(){t.terminate()}),r.init_incoming(n,e)}.call(t,e)},reject:function(){!function(){Oh.debug("Replaced INVITE rejected by the user"),n.reply(486)}.call(t)}})}},{key:"_sendInitialRequest",value:function(e,r,t){var n=this,o=new fh(this._ua,this._request,{onRequestTimeout:function(){n.onRequestTimeout()},onTransportError:function(){n.onTransportError()},onAuthenticated:function(e){n._request=e},onReceiveResponse:function(e){n._receiveInviteResponse(e)}});Promise.resolve().then(function(){return t||(e.audio||e.video?new bh(e).initialize().catch(function(e){if(n._status===xh.STATUS_TERMINATED)throw new Error("terminated");throw n._failed("local",null,ah.causes.USER_DENIED_MEDIA_ACCESS),Oh.warn('emit "getusermediafailed" [error:%o]',e),n.emit("getusermediafailed",e),e}):void 0)}).then(function(t){if(n._status===xh.STATUS_TERMINATED)throw new Error("terminated");return(n._localStream=t).mediaStream&&t.mediaStream.getTracks().forEach(function(e){n._connection.addTrack(e,t.mediaStream)}),n._connecting(n._request),n._createLocalDescription("offer",r).catch(function(e){throw n._failed("local",null,ah.causes.WEBRTC_ERROR),e})}).then(function(e){if(n._is_canceled||n._status===xh.STATUS_TERMINATED)throw new Error("terminated");n._request.body=e,n._status=xh.STATUS_INVITE_SENT,Oh.debug('emit "sending" [request:%o]',n._request),n.emit("sending",{request:n._request}),o.send()}).catch(function(e){n._status!==xh.STATUS_TERMINATED&&Oh.warn(e)})}},{key:"_sendTRTCInitialRequest",value:function(){var t=this,e=new fh(this._ua,this._request,{onRequestTimeout:function(){t.onRequestTimeout()},onTransportError:function(){t.onTransportError()},onAuthenticated:function(e){t._request=e},onReceiveResponse:function(e){t._receiveInviteResponse(e)}});Promise.resolve().then(function(){if(t._status===xh.STATUS_TERMINATED)throw new Error("terminated");Oh.debug("connecting"),t._connecting(t._request),t._status=xh.STATUS_INVITE_SENT,Oh.debug('emit "sending" [request:%o]',t._request),t.emit("sending",{request:t._request}),e.send()}).catch(function(e){t._status!==xh.STATUS_TERMINATED&&Oh.warn(e)})}},{key:"_inviteToTRTCRoom",value:function(o,e){var s=this;this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return s._joinTRTCRoom(e,function(e){s._acceptAndTerminate(o),s._failed("system",e.toString(),ah.causes.WEBRTC_ERROR)})}).then(function(){s._rtcReady=!0,"incoming"===s._direction&&(s._handleSessionTimersInIncomingResponse(o),s._accepted("remote",o),s.sendRequest(ah.ACK),s._confirmed("local",null))}).catch(function(e){var t,r,n;if(s._status!==xh.STATUS_TERMINATED)throw r=t=ah.causes.WEBRTC_ERROR,(n=["NotFoundError","NotAllowedError","NotReadableError","OverconstrainedError","AbortError"].includes(e.name))&&(r=t=ah.causes.USER_DENIED_MEDIA_ACCESS,Oh.warn('emit "getusermediafailed" [error:%o]',e),s.emit("getusermediafailed",e)),"RtcError"===e.name&&Oh.error("TRTC error",e.toString()),!n&&e.message&&(r=e.message),s._acceptAndTerminate(o,480,r),s._failed("local",o,t),e}).then(function(){Oh.debug("trtc done")})}},{key:"_joinTRTCRoom",value:function(e,r){var n,t,o,s,i,a,u,l,c,p,h=this;if(!this._trtc_already_join)return this._trtc_already_join=!0,n=this.tracer.startSpan("trtc",void 0),t=e.sdkAppId,i=e.userSig,a=e.privateMapKey,l=e.proxy,c={sdkAppId:t,userId:o=e.userId,roomId:s=e.roomId,strRoomId:u=e.strRoomId,direction:this._direction,uri:this._ua.configuration.uri.toString(),proxy:l},Oh.debug("TRTC start",c),n.setAttributes(c),p=nh.createClient({mode:"rtc",sdkAppId:Number(t),userId:o,userSig:i,useStringRoomId:!s}),l&&p.setProxyServer({websocketProxy:"wss://".concat(l)}),this._trtcLocalStream=nh.createStream(_({userId:o,audio:!this._trtcLocalStreamConfig.screenAudio,video:!1},this._trtcLocalStreamConfig)),this._localTRTCClient=p,this._localUserId=o,this._ua.configuration.trtc_proxy_server&&p.setProxyServer(this._ua.configuration.trtc_proxy_server),this._ua.configuration.trtc_turn_server&&p.setTurnServer(this._ua.configuration.trtc_turn_server),p.on("stream-added",function(e){Oh.debug("TRTC stream-added, id:%s",e.stream.getId()),h.emit("stream-added",e),p.subscribe(e.stream,{audio:!0,video:Boolean(h._trtcLocalStream.video)}).catch(function(e){h._status!==xh.STATUS_TERMINATED&&(Oh.error("TRTC subscribe stream errorCode: %d",e.getCode()),r)&&r(e)})}),p.on("stream-subscribed",function(e){var t=e.stream;Oh.debug("TRTC stream-subscribed, id:%o",t.getId()),h._trtcRemoteStream[t.getId()]=t,h.emit("addstream",e),h.emit("stream-subscribed",e),0<h.listenerCount("stream-subscribed")?Oh.debug("stream-subscribe listener count greater than 0"):t.play(h._getStreamPlayElement(o)).then(function(){Oh.debug("TRTC play stream success, id:%o",t.getId())}).catch(function(e){h._status!==xh.STATUS_TERMINATED&&(Oh.error("TRTC play stream errorCode: %d",e.getCode()),r)&&r(e)})}),p.on("stream-removed",function(e){var t=e.stream;delete h._trtcRemoteStream[t.getId()],h.emit("stream-removed",e),h.emit("removestream",e)}),p.on("stream-updated",function(e){var t=e.stream;h._trtcRemoteStream[t.getId()]=t,h.emit("stream-updated",e)}),p.on("error",function(e){var t;h._status!==xh.STATUS_TERMINATED&&(t=e.getCode(),Oh.error("TRTC errorCode: %o",t),h._failed("local",e.toString(),ah.causes.WEBRTC_ERROR))}),p.on("audio-volume",function(e){e&&Array.isArray(e.result)&&(e=e.result.map(function(e){return _(_({},e),{},{originator:e.userId===h._localUserId?"local":"remote"})}),h.emit("audiovolume",{result:e}))}),p.on("network-quality",function(e){h.emit("networkquality",e)}),Promise.resolve().then(function(){var t=h.tracer.startSpan("trtc/join",{attributes:c},Eh.setSpan(Ah.active(),n));return Promise.all([t,h._trtcLocalStream.initialize().then(function(){h._trtcLocalStreamLocallyGenerated=!0}),h._localTRTCClient.join({roomId:s||u,privateMapKey:a}).then(function(){Oh.debug("TRTC join success"),t.end()}).catch(function(e){return t.recordException(e),t.end(),Promise.reject(e)})])}).then(function(){var t;if(Oh.debug("TRTC join and initialize success"),h._status!==xh.STATUS_TERMINATED)return 0<h.listenerCount("audiovolume")&&h._trtcLocalStream.play(h._getStreamPlayElement(o)),Oh.debug("TRTC join success then publish"),t=h.tracer.startSpan("trtc/publish",{attributes:c},Eh.setSpan(Ah.active(),n)),h._localTRTCClient.publish(h._trtcLocalStream).then(function(){t.end()}).catch(function(e){return t.recordException(e),t.end(),Promise.reject(e)});Oh.debug("TRTC join success after terminate");try{h._trtcLocalStream.close(),h._localTRTCClient.leave().then(function(){h._localTRTCClient.destroy()}).catch(function(){h._localTRTCClient.destroy()})}catch(t){Oh.debug("trtc initial or join success then close error, message: ".concat(t.message))}}).then(function(){Oh.debug("TRTC publish success"),n.end()}).catch(function(e){Oh.warn("trtc join failed, status: ".concat(h._status,", error message: ").concat(e.toString()));var t=ch.isFunction(e.getCode)?e.getCode():"0";n.recordException(e),n.setAttributes({errorName:e.name,errorCode:t,errorMessage:e.toString()}),n.end();try{h._trtcLocalStream.close(),h._localTRTCClient.leave().then(function(){h._localTRTCClient.destroy()})}catch(e){Oh.debug("trtc join failed then close or destroy error, error: ".concat(e.message))}if(h._status!==xh.STATUS_TERMINATED)throw e});Oh.debug("ignore duplicate join trtc room")}},{key:"_pureSignalingRoom",value:function(){}},{key:"_getStreamPlayElement",value:function(e){var e="".concat(e,"-rtc-session-audio"),t=document.getElementById(e);return Oh.debug("get audio container",t),t||(Oh.debug("create audio container"),(t=document.createElement("div")).setAttribute("id",e),t.setAttribute("style","width:0;height:0;overflow:hidden"),document.body.appendChild(t),Oh.debug("create audio container id:%o",e)),t}},{key:"_getDTMFRTPSender",value:function(){var e=this._connection.getSenders().find(function(e){return e.track&&"audio"===e.track.kind});if(e&&e.dtmf)return e.dtmf;Oh.warn("sendDTMF() | no local audio track to send DTMF with")}},{key:"_receiveInviteResponse",value:function(t){var e,r,n,o,s,i,a,u,l,c,p,h,d,f,m,g,y,_=this;if(Oh.debug("receiveInviteResponse()"),this._dialog&&200<=t.status_code&&t.status_code<=299)return this._dialog.id.call_id===t.call_id&&this._dialog.id.local_tag===t.from_tag&&this._dialog.id.remote_tag===t.to_tag?void this.sendRequest(ah.ACK):void 0!==(e=new hh(this,t,"UAC")).error?void Oh.debug(e.error):(this.sendRequest(ah.ACK),void this.sendRequest(ah.BYE));if(this._is_canceled)100<=t.status_code&&t.status_code<200?this._request.cancel(this._cancel_reason):200<=t.status_code&&t.status_code<299&&this._acceptAndTerminate(t);else if(this._status===xh.STATUS_INVITE_SENT||this._status===xh.STATUS_1XX_RECEIVED)switch(!0){case/^100$/.test(t.status_code):this._status=xh.STATUS_1XX_RECEIVED;break;case/^1[0-9]{2}$/.test(t.status_code):t.to_tag?t.hasHeader("contact")&&!this._createDialog(t,"UAC",!0)||(this._status=xh.STATUS_1XX_RECEIVED,!this._is_mini_program&&this._use_trtc?(this._progress("remote",t),i=t.getHeader("X-TRTC-SDKAPPID"),f=t.getHeader("X-TRTC-USERID"),g=parseInt(t.getHeader("X-TRTC-ROOMID"),10),v=t.getHeader("X-TRTC-STRROOMID"),r=t.getHeader("X-TRTC-USERSIG"),n=t.getHeader("X-TRTC-PRIVATEMAPKEY"),o=t.getHeader("X-TCCC-IVR"),s=t.getHeader("X-TRTC-PROXY"),Oh.debug("".concat(t.status_code," with trtc params"),{sdkAppId:i,userId:f,roomId:g,strRoomId:v,userSig:r,privateMapKey:n,isIVRCall:o,proxy:s}),i&&f&&(g||v)&&r?this._inviteToTRTCRoom(t,{sdkAppId:i,userId:f,roomId:g,strRoomId:v,userSig:r,privateMapKey:n,proxy:s}):this._is_mini_program||o?Oh.debug("pure signal mode, no trtc params in 1xx response"):(this._acceptAndTerminate(t,400,ah.causes.MISSING_SDP),this._failed("remote",t,ah.causes.BAD_MEDIA_DESCRIPTION))):t.body?(i={originator:"remote",type:"answer",sdp:t.body},Oh.debug('emit "sdp"'),this.emit("sdp",i),a=new RTCSessionDescription({type:"answer",sdp:i.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return _._connection.setRemoteDescription(a)}).then(function(){return _._progress("remote",t)}).catch(function(e){Oh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),_.emit("peerconnection:setremotedescriptionfailed",e)})):this._progress("remote",t)):Oh.debug("1xx response received without to tag");break;case/^2[0-9]{2}$/.test(t.status_code):(this._status=xh.STATUS_CONFIRMED,t.body||this._use_trtc)?this._createDialog(t,"UAC")&&(this._use_trtc?(this._handleSessionTimersInIncomingResponse(t),this._accepted("remote",t),this.sendRequest(ah.ACK),this._confirmed("local",null),u=t.getHeader("X-TRTC-SDKAPPID"),l=t.getHeader("X-TRTC-USERID"),c=parseInt(t.getHeader("X-TRTC-ROOMID"),10),p=t.getHeader("X-TRTC-STRROOMID"),h=t.getHeader("X-TRTC-USERSIG"),d=t.getHeader("X-TRTC-PRIVATEMAPKEY"),f=t.getHeader("X-TCCC-IVR"),m=t.getHeader("X-TRTC-PROXY"),Oh.debug("".concat(t.status_code," with trtc params"),{sdkAppId:u,userId:l,roomId:c,strRoomId:p,userSig:h,privateMapKey:d,isIVRCall:f,proxy:m}),u&&l&&(c||p)&&h?Promise.resolve().then(function(){return _._joinTRTCRoom({sdkAppId:u,userId:l,roomId:c,strRoomId:p,privateMapKey:d,userSig:h,proxy:m},function(e){_.terminate({status_code:480,cause:ah.causes.WEBRTC_ERROR,reason_phrase:"TRTC Error"}),_._failed("system",e.toString(),ah.causes.WEBRTC_ERROR)})}).catch(function(e){var t,r,n;_._status!==xh.STATUS_TERMINATED&&(r=t=ah.causes.WEBRTC_ERROR,(n=["NotFoundError","NotAllowedError","NotReadableError","OverconstrainedError","AbortError"].includes(e.name))&&(r=t=ah.causes.USER_DENIED_MEDIA_ACCESS,Oh.warn('emit "getusermediafailed" [error:%o]',e),_.emit("getusermediafailed",e)),"RtcError"===e.name&&Oh.error("TRTC error",e.toString()),!n&&e.message&&(r=e.message),_.terminate({status_code:480,cause:t,reason_phrase:r}))}):this._is_mini_program||f?Oh.debug("pure signal mode, no trtc params in 200OK"):Oh.debug("missing trtc params in 200OK")):(g={originator:"remote",type:"answer",sdp:t.body},Oh.debug('emit "sdp"'),this.emit("sdp",g),y=new RTCSessionDescription({type:"answer",sdp:g.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if("stable"===_._connection.signalingState)return _._connection.createOffer(_._rtcOfferConstraints).then(function(e){return _._connection.setLocalDescription(e)}).catch(function(e){_._acceptAndTerminate(t,500,e.toString()),_._failed("local",t,ah.causes.WEBRTC_ERROR)})}).then(function(){_._connection.setRemoteDescription(y).then(function(){_._handleSessionTimersInIncomingResponse(t),_._accepted("remote",t),_.sendRequest(ah.ACK),_._confirmed("local",null)}).catch(function(e){_._acceptAndTerminate(t,488,"Not Acceptable Here"),_._failed("remote",t,ah.causes.BAD_MEDIA_DESCRIPTION),Oh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),_.emit("peerconnection:setremotedescriptionfailed",e)})}))):(this._acceptAndTerminate(t,400,ah.causes.MISSING_SDP),this._failed("remote",t,ah.causes.BAD_MEDIA_DESCRIPTION));break;default:var v=ch.sipErrorCause(t.status_code);this._failed("remote",t,v)}}},{key:"_sendReinvite",value:function(){var r=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=(Oh.debug("sendReinvite()"),ch.cloneArray(e.extraHeaders)),o=ch.cloneObject(e.eventHandlers),t=e.rtcOfferConstraints||this._rtcOfferConstraints||null,s=!1;function i(e){o.failed&&o.failed(e)}n.push("Contact: ".concat(this._contact)),n.push("Content-Type: application/sdp"),this._sessionTimers.running&&n.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(this._sessionTimers.refresher?"uac":"uas")),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return r._createLocalDescription("offer",t)}).then(function(e){var t={originator:"local",type:"offer",sdp:e=r._mangleOffer(e)};Oh.debug('emit "sdp"'),r.emit("sdp",t),r.sendRequest(ah.INVITE,{extraHeaders:n,body:e,eventHandlers:{onSuccessResponse:function(e){(function(e){var t,r,n=this;this._status===xh.STATUS_TERMINATED||(this.sendRequest(ah.ACK),s)||(this._handleSessionTimersInIncomingResponse(e),e.body&&e.hasHeader("Content-Type")&&"application/sdp"===e.getHeader("Content-Type").toLowerCase()?(t={originator:"remote",type:"answer",sdp:e.body},Oh.debug('emit "sdp"'),this.emit("sdp",t),r=new RTCSessionDescription({type:"answer",sdp:t.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return n._connection.setRemoteDescription(r)}).then(function(){o.succeeded&&o.succeeded(e)}).catch(function(e){i.call(n),Oh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),n.emit("peerconnection:setremotedescriptionfailed",e)})):i.call(this))}).call(r,e),s=!0},onErrorResponse:function(e){i.call(r,e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})}).catch(function(){i()})}},{key:"_sendUpdate",value:function(){var r=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=(Oh.debug("sendUpdate()"),ch.cloneArray(e.extraHeaders)),o=ch.cloneObject(e.eventHandlers),t=e.rtcOfferConstraints||this._rtcOfferConstraints||null,s=e.sdpOffer||!1,i=!1;function a(e){var t,r,n=this;this._status===xh.STATUS_TERMINATED||i||(this._handleSessionTimersInIncomingResponse(e),s?e.body&&e.hasHeader("Content-Type")&&"application/sdp"===e.getHeader("Content-Type").toLowerCase()?(t={originator:"remote",type:"answer",sdp:e.body},Oh.debug('emit "sdp"'),this.emit("sdp",t),r=new RTCSessionDescription({type:"answer",sdp:t.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return n._connection.setRemoteDescription(r)}).then(function(){o.succeeded&&o.succeeded(e)}).catch(function(e){u.call(n),Oh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),n.emit("peerconnection:setremotedescriptionfailed",e)})):u.call(this):o.succeeded&&o.succeeded(e))}function u(e){o.failed&&o.failed(e)}n.push("Contact: ".concat(this._contact)),this._sessionTimers.running&&n.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(this._sessionTimers.refresher?"uac":"uas")),s?(n.push("Content-Type: application/sdp"),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return r._createLocalDescription("offer",t)}).then(function(e){var t={originator:"local",type:"offer",sdp:e=r._mangleOffer(e)};Oh.debug('emit "sdp"'),r.emit("sdp",t),r.sendRequest(ah.UPDATE,{extraHeaders:n,body:e,eventHandlers:{onSuccessResponse:function(e){a.call(r,e),i=!0},onErrorResponse:function(e){u.call(r,e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})}).catch(function(){u.call(r)})):this.sendRequest(ah.UPDATE,{extraHeaders:n,eventHandlers:{onSuccessResponse:function(e){a.call(r,e)},onErrorResponse:function(e){u.call(r,e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})}},{key:"_acceptAndTerminate",value:function(e,t,r){Oh.debug("acceptAndTerminate()");var n=[];t&&(r=r||ah.REASON_PHRASE[t]||"",n.push("Reason: SIP ;cause=".concat(t,'; text="').concat(r,'"'))),(this._dialog||this._createDialog(e,"UAC"))&&(this.sendRequest(ah.ACK),this.sendRequest(ah.BYE,{extraHeaders:n})),this._status=xh.STATUS_TERMINATED}},{key:"_mangleOffer",value:function(e){if(!this._localHold&&!this._remoteHold)return e;if(e=oh.parse(e),this._localHold&&!this._remoteHold){Oh.debug("mangleOffer() | me on hold, mangling offer");var t,r=d(e.media);try{for(r.s();!(t=r.n()).done;){var n=t.value;-1!==Ch.indexOf(n.type)&&(!n.direction||"sendrecv"===n.direction?n.direction="sendonly":"recvonly"===n.direction&&(n.direction="inactive"))}}catch(e){r.e(e)}finally{r.f()}}else if(this._localHold&&this._remoteHold){Oh.debug("mangleOffer() | both on hold, mangling offer");var o,s=d(e.media);try{for(s.s();!(o=s.n()).done;){var i=o.value;-1!==Ch.indexOf(i.type)&&(i.direction="inactive")}}catch(e){s.e(e)}finally{s.f()}}else if(this._remoteHold){Oh.debug("mangleOffer() | remote on hold, mangling offer");var a,u=d(e.media);try{for(u.s();!(a=u.n()).done;){var l=a.value;-1!==Ch.indexOf(l.type)&&(!l.direction||"sendrecv"===l.direction?l.direction="recvonly":"recvonly"===l.direction&&(l.direction="inactive"))}}catch(e){u.e(e)}finally{u.f()}}return oh.write(e)}},{key:"_setLocalMediaStatus",value:function(){var e=!0,t=!0;(this._localHold||this._remoteHold)&&(t=e=!1),this._audioMuted&&(e=!1),this._videoMuted&&(t=!1),this._toggleMuteAudio(!e),this._toggleMuteVideo(!t)}},{key:"_handleSessionTimersInIncomingRequest",value:function(e,t){this._sessionTimers.enabled&&(e=e.session_expires&&e.session_expires>=ah.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,e.session_expires_refresher||"uas"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,"uas"),t.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(e)),this._sessionTimers.refresher="uas"===e,this._runSessionTimer())}},{key:"_handleSessionTimersInIncomingResponse",value:function(e){this._sessionTimers.enabled&&(e=e.session_expires&&e.session_expires>=ah.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,e.session_expires_refresher||"uac"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,"uac"),this._sessionTimers.refresher="uac"===e,this._runSessionTimer())}},{key:"_runSessionTimer",value:function(){var e=this,t=this._sessionTimers.currentExpires;this._sessionTimers.running=!0,clearTimeout(this._sessionTimers.timer),this._sessionTimers.refresher?this._sessionTimers.timer=setTimeout(function(){e._status!==xh.STATUS_TERMINATED&&e._isReadyToReOffer()&&(Oh.debug("runSessionTimer() | sending session refresh request"),e._sessionTimers.refreshMethod===ah.UPDATE?e._sendUpdate():e._sendReinvite())},500*t):this._sessionTimers.timer=setTimeout(function(){e._status!==xh.STATUS_TERMINATED&&(Oh.warn("runSessionTimer() | timer expired, terminating the session"),e.terminate({cause:ah.causes.REQUEST_TIMEOUT,status_code:408,reason_phrase:"Session Timer Expired"}))},1100*t)}},{key:"_toggleMuteAudio",value:function(e){if(this._use_trtc){if(this._trtcLocalStream)return e?this._trtcLocalStream.muteAudio():this._trtcLocalStream.unmuteAudio();throw new uh.InvalidStateError(this._status)}var t,r=d(this._connection.getSenders().filter(function(e){return e.track&&"audio"===e.track.kind}));try{for(r.s();!(t=r.n()).done;)t.value.track.enabled=!e}catch(e){r.e(e)}finally{r.f()}}},{key:"_toggleMuteVideo",value:function(e){if(this._use_trtc){if(this._trtcLocalStream)return e?this._trtcLocalStream.muteVideo():this._trtcLocalStream.unmuteVideo();throw new uh.InvalidStateError(this._status)}var t,r=d(this._connection.getSenders().filter(function(e){return e.track&&"video"===e.track.kind}));try{for(r.s();!(t=r.n()).done;)t.value.track.enabled=!e}catch(e){r.e(e)}finally{r.f()}}},{key:"_newRTCSession",value:function(e,t){Oh.debug("newRTCSession()"),this._ua.newRTCSession(this,{originator:e,session:this,request:t})}},{key:"_connecting",value:function(e){Oh.debug("session connecting"),Oh.debug('emit "connecting"'),this.emit("connecting",{request:e})}},{key:"_progress",value:function(e,t){Oh.debug("session progress"),Oh.debug('emit "progress"'),this.emit("progress",{originator:e,response:t||null})}},{key:"_accepted",value:function(e,t){Oh.debug("session accepted"),this._start_time=new Date,Oh.debug('emit "accepted"'),this.emit("accepted",{originator:e,response:t||null})}},{key:"_confirmed",value:function(e,t){Oh.debug("session confirmed"),this._is_confirmed=!0,Oh.debug('emit "confirmed"'),this.emit("confirmed",{originator:e,ack:t||null})}},{key:"_ended",value:function(e,t,r){Oh.debug("session ended"),this._end_time=new Date,this._close(),Oh.debug('emit "ended"'),this.emit("ended",{originator:e,message:t||null,cause:r})}},{key:"_failed",value:function(e,t,r){Oh.debug("session failed"),Oh.debug('emit "_failed"'),this.emit("_failed",{originator:e,message:t||null,cause:r}),this._close(),Oh.debug('emit "failed"'),this.emit("failed",{originator:e,message:t||null,cause:r})}},{key:"_onhold",value:function(e){Oh.debug("session onhold"),this._setLocalMediaStatus(),Oh.debug('emit "hold"'),this.emit("hold",{originator:e})}},{key:"_onunhold",value:function(e){Oh.debug("session onunhold"),this._setLocalMediaStatus(),Oh.debug('emit "unhold"'),this.emit("unhold",{originator:e})}},{key:"_onmute",value:function(e){var t=e.audio,e=e.video;Oh.debug("session onmute"),this._setLocalMediaStatus(),Oh.debug('emit "muted"'),this.emit("muted",{audio:t,video:e})}},{key:"_onunmute",value:function(e){var t=e.audio,e=e.video;Oh.debug("session onunmute"),this._setLocalMediaStatus(),Oh.debug('emit "unmuted"'),this.emit("unmuted",{audio:t,video:e})}}],[{key:"C",get:function(){return xh}}])})(),Nh=$.EventEmitter,Ih=ec,Ph=s,Uh=Ac,kh=F(),Lh=ep,jh=j,Dh=B(),Mh=new Ih("Message"),Vh=(()=>{function r(e){var t;return l(this,r),(t=u(this,r))._ua=e,t._request=null,t._closed=!1,t._direction=null,t._local_identity=null,t._remote_identity=null,t._is_replied=!1,t._data={},t}return m(r,Nh),p(r,[{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}},{key:"send",value:function(e,t){var r=this,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},o=e;if(void 0===e||void 0===t)throw new TypeError("Not enough arguments");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(o));var s,o=kh.cloneArray(n.extraHeaders),i=kh.cloneObject(n.eventHandlers),a=n.contentType||"text/plain",u={};for(s in n.fromUserName&&(u.from_uri=new Dh("sip",n.fromUserName,this._ua.configuration.uri.host),o.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))),n.fromDisplayName&&(u.from_display_name=n.fromDisplayName),i)Object.prototype.hasOwnProperty.call(i,s)&&this.on(s,i[s]);o.push("Content-Type: ".concat(a)),this._request=new Uh.OutgoingRequest(Ph.MESSAGE,e,this._ua,u,o),t&&(this._request.body=t);n=new Lh(this._ua,this._request,{onRequestTimeout:function(){r._onRequestTimeout()},onTransportError:function(){r._onTransportError()},onReceiveResponse:function(e){r._receiveResponse(e)}});this._newMessage("local",this._request),n.send()}},{key:"init_incoming",value:function(e){this._request=e,this._newMessage("remote",e),this._is_replied||(this._is_replied=!0,e.reply(200)),this._close()}},{key:"accept",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=kh.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new jh.NotSupportedError('"accept" not supported for outgoing Message');if(this._is_replied)throw new Error("incoming Message already replied");this._is_replied=!0,this._request.reply(200,null,t,e)}},{key:"reject",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.status_code||480,r=e.reason_phrase,n=kh.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new jh.NotSupportedError('"reject" not supported for outgoing Message');if(this._is_replied)throw new Error("incoming Message already replied");if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));this._is_replied=!0,this._request.reply(t,r,n,e)}},{key:"_receiveResponse",value:function(e){if(!this._closed)switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):this._succeeded("remote",e);break;default:var t=kh.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,Ph.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,Ph.causes.CONNECTION_ERROR)}},{key:"_close",value:function(){this._closed=!0,this._ua.destroyMessage(this)}},{key:"_newMessage",value:function(e,t){"remote"===e?(this._direction="incoming",this._local_identity=t.to,this._remote_identity=t.from):"local"===e&&(this._direction="outgoing",this._local_identity=t.from,this._remote_identity=t.to),this._ua.newMessage(this,{originator:e,message:this,request:t})}},{key:"_failed",value:function(e,t,r){Mh.debug("MESSAGE failed"),this._close(),Mh.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:r})}},{key:"_succeeded",value:function(e,t){Mh.debug("MESSAGE succeeded"),this._close(),Mh.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}}])})(),Bh=$.EventEmitter,Fh=ec,qh=s,Hh=Ac,Gh=F(),zh=ep,Kh=j,Yh=new Fh("Options"),Wh=(()=>{function r(e){var t;return l(this,r),(t=u(this,r))._ua=e,t._request=null,t._closed=!1,t._direction=null,t._local_identity=null,t._remote_identity=null,t._is_replied=!1,t._data={},t}return m(r,Bh),p(r,[{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}},{key:"send",value:function(e,t){var r=this,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},o=e;if(void 0===e)throw new TypeError("A target is required for OPTIONS");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(o));var s,o=Gh.cloneArray(n.extraHeaders),i=Gh.cloneObject(n.eventHandlers),n=n.contentType||"application/sdp";for(s in i)Object.prototype.hasOwnProperty.call(i,s)&&this.on(s,i[s]);o.push("Content-Type: ".concat(n)),this._request=new Hh.OutgoingRequest(qh.OPTIONS,e,this._ua,null,o),t&&(this._request.body=t);n=new zh(this._ua,this._request,{onRequestTimeout:function(){r._onRequestTimeout()},onTransportError:function(){r._onTransportError()},onReceiveResponse:function(e){r._receiveResponse(e)}});this._newOptions("local",this._request),n.send()}},{key:"init_incoming",value:function(e){this._request=e,this._newOptions("remote",e),this._is_replied||(this._is_replied=!0,e.reply(200)),this._close()}},{key:"accept",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=Gh.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Kh.NotSupportedError('"accept" not supported for outgoing Options');if(this._is_replied)throw new Error("incoming Options already replied");this._is_replied=!0,this._request.reply(200,null,t,e)}},{key:"reject",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.status_code||480,r=e.reason_phrase,n=Gh.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Kh.NotSupportedError('"reject" not supported for outgoing Options');if(this._is_replied)throw new Error("incoming Options already replied");if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));this._is_replied=!0,this._request.reply(t,r,n,e)}},{key:"_receiveResponse",value:function(e){if(!this._closed)switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):this._succeeded("remote",e);break;default:var t=Gh.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,qh.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,qh.causes.CONNECTION_ERROR)}},{key:"_close",value:function(){this._closed=!0,this._ua.destroyMessage(this)}},{key:"_newOptions",value:function(e,t){"remote"===e?(this._direction="incoming",this._local_identity=t.to,this._remote_identity=t.from):"local"===e&&(this._direction="outgoing",this._local_identity=t.from,this._remote_identity=t.to),this._ua.newOptions(this,{originator:e,message:this,request:t})}},{key:"_failed",value:function(e,t,r){Yh.debug("OPTIONS failed"),this._close(),Yh.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:r})}},{key:"_succeeded",value:function(e,t){Yh.debug("OPTIONS succeeded"),this._close(),Yh.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}}])})(),$h={},Jh=ec,Xh=F(),Qh=V(),Zh=new Jh("Socket"),ef=($h.isSocket=function(t){if(Array.isArray(t))return!1;if(void 0===t)return Zh.warn("undefined JsSIP.Socket instance"),!1;try{if(!Xh.isString(t.url))throw Zh.warn("missing or invalid JsSIP.Socket url property"),new Error("Missing or invalid JsSIP.Socket url property");if(!Xh.isString(t.via_transport))throw Zh.warn("missing or invalid JsSIP.Socket via_transport property"),new Error("Missing or invalid JsSIP.Socket via_transport property");if(-1===Qh.parse(t.sip_uri,"SIP_URI"))throw Zh.warn("missing or invalid JsSIP.Socket sip_uri property"),new Error("missing or invalid JsSIP.Socket sip_uri property")}catch(t){return!1}try{["connect","disconnect","send"].forEach(function(e){if(!Xh.isFunction(t[e]))throw Zh.warn("missing or invalid JsSIP.Socket method: ".concat(e)),new Error("Missing or invalid JsSIP.Socket method: ".concat(e))})}catch(t){return!1}return!0},$h),tf=s,rf=new ec("Transport"),nf={STATUS_CONNECTED:0,STATUS_CONNECTING:1,STATUS_DISCONNECTED:2,SOCKET_STATUS_READY:0,SOCKET_STATUS_ERROR:1,recovery_options:{min_interval:tf.CONNECTION_RECOVERY_MIN_INTERVAL,max_interval:tf.CONNECTION_RECOVERY_MAX_INTERVAL}},of=p(function e(t){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:nf.recovery_options;l(this,e),rf.debug("new()"),this.status=nf.STATUS_DISCONNECTED,this.socket=null,this.sockets=[],this.recovery_options=r,this.recover_attempts=0,this.recovery_timer=null,this.close_requested=!1;try{this.textDecoder=new TextDecoder("utf8")}catch(e){rf.warn("cannot use TextDecoder: ".concat(e))}if(void 0===t)throw new TypeError("Invalid argument. undefined 'sockets' argument");(t=t instanceof Array?t:[t]).forEach(function(e){if(!ef.isSocket(e.socket))throw new TypeError("Invalid argument. invalid 'JsSIP.Socket' instance");if(e.weight&&!Number(e.weight))throw new TypeError("Invalid argument. 'weight' attribute is not a number");this.sockets.push({socket:e.socket,weight:e.weight||0,status:nf.SOCKET_STATUS_READY})},this),this._getSocket()},[{key:"via_transport",get:function(){return this.socket.via_transport}},{key:"url",get:function(){return this.socket.url}},{key:"sip_uri",get:function(){return this.socket.sip_uri}},{key:"connect",value:function(){rf.debug("connect()"),this.isConnected()?rf.debug("Transport is already connected"):this.isConnecting()?rf.debug("Transport is connecting"):(this.close_requested=!1,this.status=nf.STATUS_CONNECTING,this.onconnecting({socket:this.socket,attempts:this.recover_attempts}),this.close_requested||(this.socket.onconnect=this._onConnect.bind(this),this.socket.ondisconnect=this._onDisconnect.bind(this),this.socket.ondata=this._onData.bind(this),this.socket.connect()))}},{key:"disconnect",value:function(){rf.debug("close()"),this.close_requested=!0,this.recover_attempts=0,this.status=nf.STATUS_DISCONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.socket.onconnect=function(){},this.socket.ondisconnect=function(){},this.socket.ondata=function(){},this.socket.disconnect(),this.ondisconnect({socket:this.socket,error:!1})}},{key:"send",value:function(e){return rf.debug("send()"),this.isConnected()?(e=e.toString(),rf.debug("sending message:\n\n".concat(e,"\n")),this.socket.send(e)):(rf.warn("unable to send message, transport is not connected"),!1)}},{key:"isConnected",value:function(){return this.status===nf.STATUS_CONNECTED}},{key:"isConnecting",value:function(){return this.status===nf.STATUS_CONNECTING}},{key:"_reconnect",value:function(){var e=this,t=(this.recover_attempts+=1,Math.floor(Math.random()*Math.pow(2,this.recover_attempts)+1));t<this.recovery_options.min_interval?t=this.recovery_options.min_interval:t>this.recovery_options.max_interval&&(t=this.recovery_options.max_interval),rf.debug("reconnection attempt: ".concat(this.recover_attempts,". next connection attempt in ").concat(t," seconds")),this.recovery_timer=setTimeout(function(){e.close_requested||e.isConnected()||e.isConnecting()||(e._getSocket(),e.connect())},1e3*t)}},{key:"_getSocket",value:function(){var e,t=[];this.sockets.forEach(function(e){e.status!==nf.SOCKET_STATUS_ERROR&&(0===t.length?t.push(e):e.weight>t[0].weight?t=[e]:e.weight===t[0].weight&&t.push(e))}),0===t.length?(this.sockets.forEach(function(e){e.status=nf.SOCKET_STATUS_READY}),this._getSocket()):(e=Math.floor(Math.random()*t.length),this.socket=t[e].socket)}},{key:"_onConnect",value:function(){this.recover_attempts=0,this.status=nf.STATUS_CONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.onconnect({socket:this})}},{key:"_onDisconnect",value:function(e,t,r){this.status=nf.STATUS_DISCONNECTED,this.ondisconnect({socket:this.socket,error:e,code:t,reason:r}),this.close_requested||(this.sockets.forEach(function(e){this.socket===e.socket&&(e.status=nf.SOCKET_STATUS_ERROR)},this),this._reconnect(e))}},{key:"_onData",value:function(e){if("\r\n"!==e){if("string"!=typeof e){try{e=this.textDecoder?this.textDecoder.decode(e):String.fromCharCode.apply(null,new Uint8Array(e))}catch(e){return void rf.debug("received binary message failed to be converted into string, message discarded")}rf.debug("received binary message:\n\n".concat(e,"\n"))}else rf.debug("received text message:\n\n".concat(e,"\n"));this.ondata({transport:this,message:e})}else rf.debug("received message with CRLF Keep Alive response")}}]),sf={},af=ec,uf=V(),lf=Ac,cf=new af("Parser");function pf(e,t){var r,n=t,o=0;if(e.substring(n,n+2).match(/(^\r\n)/))return-2;for(;0===o;){if(-1===(r=e.indexOf("\r\n",n)))return r;!e.substring(r+2,r+4).match(/(^\r\n)/)&&e.charAt(r+2).match(/(^\s+)/)?n=r+2:o=r}return o}function df(e,t,r,n){var o,s=t.indexOf(":",r),i=t.substring(r,s).trim(),a=t.substring(s+1,n).trim();switch(i.toLowerCase()){case"via":case"v":e.addHeader("via",a),1===e.getHeaders("via").length?(o=e.parseHeader("Via"))&&(e.via=o,e.via_branch=o.branch):o=0;break;case"from":case"f":e.setHeader("from",a),(o=e.parseHeader("from"))&&(e.from=o,e.from_tag=o.getParam("tag"));break;case"to":case"t":e.setHeader("to",a),(o=e.parseHeader("to"))&&(e.to=o,e.to_tag=o.getParam("tag"));break;case"record-route":if(-1===(o=uf.parse(a,"Record_Route")))o=void 0;else{var u,l=d(o);try{for(l.s();!(u=l.n()).done;){var c=u.value;e.addHeader("record-route",a.substring(c.possition,c.offset)),e.headers["Record-Route"][e.getHeaders("record-route").length-1].parsed=c.parsed}}catch(e){l.e(e)}finally{l.f()}}break;case"call-id":case"i":e.setHeader("call-id",a),(o=e.parseHeader("call-id"))&&(e.call_id=a);break;case"contact":case"m":if(-1===(o=uf.parse(a,"Contact")))o=void 0;else{var p,h=d(o);try{for(h.s();!(p=h.n()).done;){var f=p.value;e.addHeader("contact",a.substring(f.possition,f.offset)),e.headers.Contact[e.getHeaders("contact").length-1].parsed=f.parsed}}catch(e){h.e(e)}finally{h.f()}}break;case"content-length":case"l":e.setHeader("content-length",a),o=e.parseHeader("content-length");break;case"content-type":case"c":e.setHeader("content-type",a),o=e.parseHeader("content-type");break;case"cseq":e.setHeader("cseq",a),(o=e.parseHeader("cseq"))&&(e.cseq=o.value),e instanceof lf.IncomingResponse&&(e.method=o.method);break;case"max-forwards":e.setHeader("max-forwards",a),o=e.parseHeader("max-forwards");break;case"www-authenticate":e.setHeader("www-authenticate",a),o=e.parseHeader("www-authenticate");break;case"proxy-authenticate":e.setHeader("proxy-authenticate",a),o=e.parseHeader("proxy-authenticate");break;case"session-expires":case"x":e.setHeader("session-expires",a),(o=e.parseHeader("session-expires"))&&(e.session_expires=o.expires,e.session_expires_refresher=o.refresher);break;case"refer-to":case"r":e.setHeader("refer-to",a),(o=e.parseHeader("refer-to"))&&(e.refer_to=o);break;case"replaces":e.setHeader("replaces",a),(o=e.parseHeader("replaces"))&&(e.replaces=o);break;case"event":case"o":e.setHeader("event",a),(o=e.parseHeader("event"))&&(e.event=o);break;default:e.addHeader(i,a),o=0}return void 0!==o||{error:'error parsing header "'.concat(i,'"')}}sf.parseMessage=function(e,t){var r,n,o=e.indexOf("\r\n");if(-1!==o){var s=e.substring(0,o),i=uf.parse(s,"Request_Response");if(-1!==i){i.status_code?((r=new lf.IncomingResponse).status_code=i.status_code,r.reason_phrase=i.reason_phrase):((r=new lf.IncomingRequest(t)).method=i.method,r.ruri=i.uri),r.data=e;for(var a=o+2;;){if(-2===(o=pf(e,a))){n=a+2;break}if(-1===o)return void cf.warn("parseMessage() | malformed message");if(!0!==(i=df(r,e,a,o)))return void cf.warn("parseMessage() |",i.error);a=o+2}return r.hasHeader("content-length")?(t=r.getHeader("content-length"),r.body=e.substr(n,t)):r.body=e.substring(n),r}cf.warn('parseMessage() | error parsing first line of SIP message: "'.concat(s,'"'))}else cf.warn("parseMessage() | no CRLF found, not a SIP message")};var hf,ff,mf,gf=ec,yf=s,_f=Ac,vf=F(),bf=new gf("sanityCheck"),Tf=[function(){for(var e=0,t=["from","to","call_id","cseq","via"];e<t.length;e++){var r=t[e];if(!hf.hasHeader(r))return bf.debug("missing mandatory header field : ".concat(r,", dropping the response")),!1}}],Sf=[function(){if("sip"!==hf.s("to").uri.scheme)return Ef(416),!1},function(){if(!hf.to_tag&&hf.call_id.substr(0,5)===ff.configuration.jssip_id)return Ef(482),!1},function(){if(vf.str_utf8_length(hf.body)<hf.getHeader("content-length"))return Ef(400),!1},function(){var e,t=hf.from_tag,r=hf.call_id,n=hf.cseq;if(!hf.to_tag)if(hf.method===yf.INVITE){if(ff._transactions.ist[hf.via_branch])return!1;for(var o in ff._transactions.ist)if(Object.prototype.hasOwnProperty.call(ff._transactions.ist,o)&&(e=ff._transactions.ist[o]).request.from_tag===t&&e.request.call_id===r&&e.request.cseq===n)return Ef(482),!1}else{if(ff._transactions.nist[hf.via_branch])return!1;for(var s in ff._transactions.nist)if(Object.prototype.hasOwnProperty.call(ff._transactions.nist,s)&&(e=ff._transactions.nist[s]).request.from_tag===t&&e.request.call_id===r&&e.request.cseq===n)return Ef(482),!1}}],wf=[function(){if(1<hf.getHeaders("via").length)return bf.debug("more than one Via header field present in the response, dropping the response"),!1},function(){if(vf.str_utf8_length(hf.body)<hf.getHeader("content-length"))return bf.debug("message body length is lower than the value in Content-Length header field, dropping the response"),!1}];function Ef(e){var t,r=hf.getHeaders("via"),n="SIP/2.0 ".concat(e," ").concat(yf.REASON_PHRASE[e],"\r\n"),o=d(r);try{for(o.s();!(t=o.n()).done;)n+="Via: ".concat(t.value,"\r\n")}catch(e){o.e(e)}finally{o.f()}r=hf.getHeader("To"),hf.to_tag||(r+=";tag=".concat(vf.newTag())),n=(n=(n=(n+="To: ".concat(r,"\r\n"))+"From: ".concat(hf.getHeader("From"),"\r\n"))+"Call-ID: ".concat(hf.call_id,"\r\n"))+"CSeq: ".concat(hf.cseq," ").concat(hf.method,"\r\n"),mf.send(n+="\r\n")}var Af={},Of=F(),xf=s,Cf=V(),Rf=B(),Nf=$h,If=j,Pf=ec,Uf=(Af.settings={authorization_user:null,password:null,realm:null,ha1:null,authorization_jwt:null,display_name:null,uri:null,contact_uri:null,instance_id:null,use_preloaded_route:!1,session_timers:!0,session_timers_refresh_method:xf.UPDATE,session_timers_force_refresher:!1,no_answer_timeout:60,register:!0,register_expires:600,registrar_server:null,sockets:null,connection_recovery_max_interval:xf.CONNECTION_RECOVERY_MAX_INTERVAL,connection_recovery_min_interval:xf.CONNECTION_RECOVERY_MIN_INTERVAL,extra_headers:null,via_host:"".concat(Of.createRandomToken(12),".invalid"),log_level:xf.LOG_LEVEL.TRACE,log_report:!0,log_proxy:null,use_trtc:!0,trtc_proxy_server:null,trtc_turn_server:null},{mandatory:{sockets:function(e){var t=[];if(Nf.isSocket(e))t.push({socket:e});else{if(!Array.isArray(e)||!e.length)return;var r,n=d(e);try{for(n.s();!(r=n.n()).done;){var o=r.value;Object.prototype.hasOwnProperty.call(o,"socket")&&Nf.isSocket(o.socket)?t.push(o):Nf.isSocket(o)&&t.push({socket:o})}}catch(e){n.e(e)}finally{n.f()}}return t},uri:function(e){/^sip:/i.test(e)||(e="".concat(xf.SIP,":").concat(e));e=Rf.parse(e);return e&&e.user?e:void 0}},optional:{authorization_user:function(e){return-1===Cf.parse('"'.concat(e,'"'),"quoted_string")?void 0:e},authorization_jwt:function(e){if("string"==typeof e)return e},user_agent:function(e){if("string"==typeof e)return e},connection_recovery_max_interval:function(e){if(Of.isDecimal(e)){e=Number(e);if(0<e)return e}},connection_recovery_min_interval:function(e){if(Of.isDecimal(e)){e=Number(e);if(0<e)return e}},contact_uri:function(e){if("string"==typeof e){e=Cf.parse(e,"SIP_URI");if(-1!==e)return e}},display_name:function(e){return e},instance_id:function(e){return/^uuid:/i.test(e)&&(e=e.substr(5)),-1===Cf.parse(e,"uuid")?void 0:e},no_answer_timeout:function(e){if(Of.isDecimal(e)){e=Number(e);if(0<e)return e}},session_timers:function(e){if("boolean"==typeof e)return e},session_timers_refresh_method:function(e){if("string"==typeof e&&((e=e.toUpperCase())===xf.INVITE||e===xf.UPDATE))return e},session_timers_force_refresher:function(e){if("boolean"==typeof e)return e},password:function(e){return String(e)},realm:function(e){return String(e)},ha1:function(e){return String(e)},register:function(e){if("boolean"==typeof e)return e},register_expires:function(e){if(Of.isDecimal(e)){e=Number(e);if(0<e)return e}},registrar_server:function(e){/^sip:/i.test(e)||(e="".concat(xf.SIP,":").concat(e));e=Rf.parse(e);return!e||e.user?void 0:e},use_preloaded_route:function(e){if("boolean"==typeof e)return e},extra_headers:function(e){var t=[];if(Array.isArray(e)&&e.length){var r,n=d(e);try{for(n.s();!(r=n.n()).done;){var o=r.value;"string"==typeof o&&t.push(o)}}catch(e){n.e(e)}finally{n.f()}return t}},log_level:function(e){return Of.isDecimal(e)&&-1!==Object.values(xf.LOG_LEVEL).indexOf(Number(e))?(Pf.setLogLevel(Number(e)),e):(Pf.setLogLevel(xf.LOG_LEVEL.TRACE),xf.LOG_LEVEL.TRACE)},log_report:function(e){return"boolean"==typeof e?(Pf.setLogReport(e),e):(Pf.setLogReport(!0),!0)},log_proxy:function(e){return Pf.setLogProxy(e),e},use_trtc:function(e){if("boolean"==typeof e)return e},trtc_proxy_server:function(e){return e},trtc_turn_server:function(e){return e}}}),kf=(Af.load=function(e,t){for(var r in Uf.mandatory){if(!t.hasOwnProperty(r))throw new If.ConfigurationError(r);var n=t[r],o=Uf.mandatory[r](n);if(void 0===o)throw new If.ConfigurationError(r,n);e[r]=o}for(var s in Uf.optional)if(t.hasOwnProperty(s)){var i=t[s];if(Of.isEmpty(i))continue;var a=Uf.optional[s](i);if(void 0===a)throw new If.ConfigurationError(s,i);e[s]=a}},$.EventEmitter),Lf=ec,jf=s,Df=ap,Mf=Rh,Vf=Vh,Bf=Wh,Ff=Wc,qf=of,Hf=F(),Gf=j,zf=B(),Kf=sf,Yf=Ac,Wf=function(e,t,r){hf=e,ff=t,mf=r;for(var n=0,o=Tf;n<o.length;n++)if(!1===(0,o[n])())return!1;if(hf instanceof _f.IncomingRequest){for(var s=0,i=Sf;s<i.length;s++)if(!1===(0,i[s])())return!1}else if(hf instanceof _f.IncomingResponse)for(var a=0,u=wf;a<u.length;a++)if(!1===(0,u[a])())return!1;return!0},$f=Af,Jf=new Lf("UA"),Xf={STATUS_INIT:0,STATUS_READY:1,STATUS_USER_CLOSED:2,STATUS_NOT_READY:3,CONFIGURATION_ERROR:1,NETWORK_ERROR:2},Qf=(()=>{function r(e){var t;if(l(this,r),Jf.debug("new() [configuration:%o]",e),(t=u(this,r))._cache={credentials:{}},t._configuration=Object.assign({},$f.settings),t._dynConfiguration={},t._dialogs={},t._applicants={},t._sessions={},t._transport=null,t._contact=null,t._status=Xf.STATUS_INIT,t._error=null,t._transactions={nist:{},nict:{},ist:{},ict:{}},t._data={},t._closeTimer=null,void 0===e)throw new TypeError("Not enough arguments");try{t._loadConfig(e)}catch(e){throw t._status=Xf.STATUS_NOT_READY,t._error=Xf.CONFIGURATION_ERROR,e}return t._registrator=new Df(t),t}return m(r,kf),p(r,[{key:"C",get:function(){return Xf}},{key:"status",get:function(){return this._status}},{key:"contact",get:function(){return this._contact}},{key:"configuration",get:function(){return this._configuration}},{key:"transport",get:function(){return this._transport}},{key:"start",value:function(){Jf.debug("start()",{}),this._status===Xf.STATUS_INIT?this._transport.connect():this._status===Xf.STATUS_USER_CLOSED?(Jf.debug("restarting UA"),null!==this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null,this._transport.disconnect()),this._status=Xf.STATUS_INIT,this._transport.connect()):this._status===Xf.STATUS_READY?Jf.debug("UA is in READY status, not restarted"):Jf.debug("ERROR: connection is down, Auto-Recovery system is trying to reconnect"),this._dynConfiguration.register=this._configuration.register}},{key:"register",value:function(){Jf.debug("register()"),this._dynConfiguration.register=!0,this._registrator.register()}},{key:"unregister",value:function(e){Jf.debug("unregister()"),this._dynConfiguration.register=!1,this._registrator.unregister(e)}},{key:"registrator",value:function(){return this._registrator}},{key:"isRegistered",value:function(){return this._registrator.registered}},{key:"isConnected",value:function(){return this._transport.isConnected()}},{key:"call",value:function(e,t){Jf.debug("call()");var r=new Mf(this);return r.connect(e,t),r}},{key:"sendMessage",value:function(e,t,r){Jf.debug("sendMessage()");var n=new Vf(this);return n.send(e,t,r),n}},{key:"sendOptions",value:function(e,t,r){Jf.debug("sendOptions()");var n=new Bf(this);return n.send(e,t,r),n}},{key:"terminateSessions",value:function(e){for(var t in Jf.debug("terminateSessions()"),this._sessions)this._sessions[t].isEnded()||this._sessions[t].terminate(e)}},{key:"stop",value:function(){var e=this;if(Jf.debug("stop()"),this._dynConfiguration={},this._status!==Xf.STATUS_USER_CLOSED){this._registrator.close();var t,r,n=Object.keys(this._sessions).length;for(t in this._sessions)if(Object.prototype.hasOwnProperty.call(this._sessions,t)){Jf.debug("closing session ".concat(t));try{this._sessions[t].terminate()}catch(e){}}for(r in this._applicants)if(Object.prototype.hasOwnProperty.call(this._applicants,r))try{this._applicants[r].close()}catch(e){}this._status=Xf.STATUS_USER_CLOSED,0===Object.keys(this._transactions.nict).length+Object.keys(this._transactions.nist).length+Object.keys(this._transactions.ict).length+Object.keys(this._transactions.ist).length&&0===n?this._transport.disconnect():this._closeTimer=setTimeout(function(){e._closeTimer=null,e._transport.disconnect()},2e3)}else Jf.debug("UA already closed")}},{key:"normalizeTarget",value:function(e){return Hf.normalizeTarget(e,this._configuration.hostport_params)}},{key:"get",value:function(e){switch(e){case"authorization_user":return this._configuration.authorization_user;case"realm":return this._configuration.realm;case"ha1":return this._configuration.ha1;case"authorization_jwt":return this._configuration.authorization_jwt;default:return void Jf.warn('get() | cannot get "%s" parameter in runtime',e)}}},{key:"set",value:function(e,t){switch(e){case"authorization_user":this._configuration.authorization_user=String(t);break;case"password":this._configuration.password=String(t);break;case"realm":this._configuration.realm=String(t);break;case"ha1":this._configuration.ha1=String(t),this._configuration.password=null;break;case"authorization_jwt":this._configuration.authorization_jwt=String(t);break;case"display_name":this._configuration.display_name=t;break;case"log_level":Hf.isDecimal(t)&&-1!==Object.values(jf.LOG_LEVEL).indexOf(Number(t))&&Lf.setLogLevel(t);break;case"log_report":Lf.setLogReport(Boolean(t));break;case"log_proxy":Lf.setLogProxy(t);break;case"trtc_proxy_server":case"trtc_turn_server":this._configuration[e]=t;break;default:return Jf.warn('set() | cannot set "%s" parameter in runtime',e),!1}return!0}},{key:"newTransaction",value:function(e){this._transactions[e.type][e.id]=e,this.emit("newTransaction",{transaction:e})}},{key:"destroyTransaction",value:function(e){delete this._transactions[e.type][e.id],this.emit("transactionDestroyed",{transaction:e})}},{key:"newDialog",value:function(e){this._dialogs[e.id]=e}},{key:"destroyDialog",value:function(e){delete this._dialogs[e.id]}},{key:"newMessage",value:function(e,t){this._applicants[e]=e,this.emit("newMessage",t)}},{key:"newOptions",value:function(e,t){this._applicants[e]=e,this.emit("newOptions",t)}},{key:"destroyMessage",value:function(e){delete this._applicants[e]}},{key:"newRTCSession",value:function(e,t){this._sessions[e.id]=e,this.emit("newRTCSession",t)}},{key:"destroyRTCSession",value:function(e){delete this._sessions[e.id]}},{key:"registered",value:function(e){this.emit("registered",e)}},{key:"unregistered",value:function(e){this.emit("unregistered",e)}},{key:"registrationFailed",value:function(e){this.emit("registrationFailed",e)}},{key:"receiveRequest",value:function(e){var t,r,n,o=e.method;if(e.ruri.user!==this._configuration.uri.user&&e.ruri.user!==this._contact.uri.user)Jf.debug("Request-URI does not point to us"),e.method!==jf.ACK&&e.reply_sl(404);else if(e.ruri.scheme!==jf.SIPS){if(!Ff.checkTransaction(this,e)){if(o===jf.INVITE?new Ff.InviteServerTransaction(this,this._transport,e):o!==jf.ACK&&o!==jf.CANCEL&&new Ff.NonInviteServerTransaction(this,this._transport,e),o===jf.OPTIONS){if(0===this.listeners("newOptions").length)return void e.reply(200);new Bf(this).init_incoming(e)}else if(o===jf.MESSAGE){if(0===this.listeners("newMessage").length)return void e.reply(405);new Vf(this).init_incoming(e)}else if(o===jf.INVITE&&!e.to_tag&&0===this.listeners("newRTCSession").length)return void e.reply(405);if(e.to_tag)(t=this._findDialog(e.call_id,e.from_tag,e.to_tag))?t.receiveRequest(e):o===jf.NOTIFY?(r=this._findSession(e))?r.receiveRequest(e):(Jf.debug("received NOTIFY request for a non existent subscription"),e.reply(481,"Subscription does not exist")):o!==jf.ACK&&e.reply(481);else switch(o){case jf.INVITE:window.RTCPeerConnection?e.hasHeader("replaces")?(n=e.replaces,(t=this._findDialog(n.call_id,n.from_tag,n.to_tag))?(r=t.owner).isEnded()?e.reply(603):r.receiveRequest(e):e.reply(481)):(r=new Mf(this)).init_incoming(e):(Jf.warn("INVITE received but WebRTC is not supported"),e.reply(488));break;case jf.BYE:e.reply(481);break;case jf.CANCEL:(r=this._findSession(e))?r.receiveRequest(e):Jf.debug("received CANCEL request for a non existent session");break;case jf.ACK:break;case jf.NOTIFY:this.emit("sipEvent",{event:e.event,request:e}),e.reply(200);break;default:e.reply(405)}}}else e.reply_sl(416)}},{key:"_findSession",value:function(e){var t=e.call_id,r=this._sessions[t+e.from_tag],t=this._sessions[t+e.to_tag];return r||t||null}},{key:"_findDialog",value:function(e,t,r){var n=this._dialogs[e+t+r];return n||this._dialogs[e+r+t]||null}},{key:"_loadConfig",value:function(e){try{$f.load(this._configuration,e),Lf.setAttributes({uri:this._configuration.uri.toString()})}catch(r){throw Jf.error("config load: %o",e,r),r}0===this._configuration.display_name&&(this._configuration.display_name="0"),this._configuration.instance_id||(this._configuration.instance_id=Hf.newUUID()),this._configuration.jssip_id=Hf.createRandomToken(5);var t,r=this._configuration.uri.clone();r.user=null,this._configuration.hostport_params=r.toString().replace(/^sip:/i,"");try{this._transport=new qf(this._configuration.sockets,{max_interval:this._configuration.connection_recovery_max_interval,min_interval:this._configuration.connection_recovery_min_interval}),this._transport.onconnecting=Zf.bind(this),this._transport.onconnect=em.bind(this),this._transport.ondisconnect=tm.bind(this),this._transport.ondata=rm.bind(this)}catch(e){throw Jf.warn(e),new Gf.ConfigurationError("sockets",this._configuration.sockets)}delete this._configuration.sockets,this._configuration.authorization_user||(this._configuration.authorization_user=this._configuration.uri.user),this._configuration.registrar_server||((t=this._configuration.uri.clone()).user=null,t.clearParams(),t.clearHeaders(),this._configuration.registrar_server=t),this._configuration.no_answer_timeout*=1e3,this._configuration.contact_uri?this._configuration.via_host=this._configuration.contact_uri.host:this._configuration.contact_uri=new zf("sip",Hf.createRandomToken(8),this._configuration.via_host,null,{transport:"ws"});var n,o,s=this._configuration.use_trtc,i=(this._contact={pub_gruu:null,temp_gruu:null,uri:this._configuration.contact_uri,toString:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.anonymous||null,e=e.outbound||null,r="<";return r+=t?this.temp_gruu||"sip:anonymous@anonymous.invalid;transport=ws":this.pub_gruu||this.uri.toString(),!e||(t?this.temp_gruu:this.pub_gruu)||(r+=";ob"),s&&(r+=";trtc"),r+">"}},["authorization_user","password","realm","ha1","authorization_jwt","display_name","register","log_level","log_report","log_proxy","use_trtc","trtc_proxy_server","trtc_turn_server"]);for(n in this._configuration)Object.prototype.hasOwnProperty.call(this._configuration,n)&&(-1!==i.indexOf(n)?Object.defineProperty(this._configuration,n,{writable:!0,configurable:!1}):Object.defineProperty(this._configuration,n,{writable:!1,configurable:!1}));for(o in Jf.debug("configuration parameters after validation:"),this._configuration)if(Object.prototype.hasOwnProperty.call($f.settings,o))switch(o){case"uri":case"registrar_server":Jf.debug("- ".concat(o,": ").concat(this._configuration[o]));break;case"password":case"ha1":case"authorization_jwt":Jf.debug("- ".concat(o,": NOT SHOWN"));break;default:Jf.debug("- ".concat(o,": ").concat(JSON.stringify(this._configuration[o])))}}}],[{key:"C",get:function(){return Xf}}])})();function Zf(e){this.emit("connecting",e)}function em(e){this._status!==Xf.STATUS_USER_CLOSED&&(this._status=Xf.STATUS_READY,this._error=null,this.emit("connected",e),this._dynConfiguration.register)&&this._registrator.register()}function tm(e){for(var t=0,r=["nict","ict","nist","ist"];t<r.length;t++){var n,o=r[t];for(n in this._transactions[o])Object.prototype.hasOwnProperty.call(this._transactions[o],n)&&this._transactions[o][n].onTransportError()}this.emit("disconnected",e),this._registrator.onTransportClosed(),this._status!==Xf.STATUS_USER_CLOSED&&(this._status=Xf.STATUS_NOT_READY,this._error=Xf.NETWORK_ERROR)}function rm(e){var t,r=e.transport,n=e.message;if((n=Kf.parseMessage(n,this))&&!(this._status===Xf.STATUS_USER_CLOSED&&n instanceof Yf.IncomingRequest)&&Wf(n,this,r))if(n instanceof Yf.IncomingRequest)n.transport=r,this.receiveRequest(n);else if(n instanceof Yf.IncomingResponse)switch(n.method){case jf.INVITE:(t=this._transactions.ict[n.via_branch])&&t.receiveResponse(n);break;case jf.ACK:break;default:(t=this._transactions.nict[n.via_branch])&&t.receiveResponse(n)}}var nm=ec,om=V(),im=new nm("WebSocketInterface"),sm=p(function e(t){l(this,e),im.debug('new() [url:"%s"]',t),this._url=t,this._sip_uri=null,this._via_transport=null,this._ws=null;var r=om.parse(t,"absoluteURI");if(-1===r)throw im.warn("invalid WebSocket URI: ".concat(t)),new TypeError("Invalid argument: ".concat(t));if("wss"!==r.scheme&&"ws"!==r.scheme)throw im.warn("invalid WebSocket URI scheme: ".concat(r.scheme)),new TypeError("Invalid argument: ".concat(t));this._sip_uri="sip:".concat(r.host).concat(r.port?":".concat(r.port):"",";transport=ws"),this._via_transport=r.scheme.toUpperCase()},[{key:"via_transport",get:function(){return this._via_transport},set:function(e){this._via_transport=e.toUpperCase()}},{key:"sip_uri",get:function(){return this._sip_uri}},{key:"url",get:function(){return this._url}},{key:"connect",value:function(){if(im.debug("connect()"),this.isConnected())im.debug("WebSocket ".concat(this._url," is already connected"));else if(this.isConnecting())im.debug("WebSocket ".concat(this._url," is connecting"));else{this._ws&&this.disconnect(),im.debug("connecting to WebSocket ".concat(this._url));try{this._ws=new WebSocket(this._url,"sip"),this._ws.binaryType="arraybuffer",this._ws.onopen=this._onOpen.bind(this),this._ws.onclose=this._onClose.bind(this),this._ws.onmessage=this._onMessage.bind(this),this._ws.onerror=this._onError.bind(this)}catch(e){this._onError(e)}}}},{key:"disconnect",value:function(){im.debug("disconnect()"),this._ws&&(this._ws.onopen=function(){},this._ws.onclose=function(){},this._ws.onmessage=function(){},this._ws.onerror=function(){},this._ws.close(),this._ws=null)}},{key:"send",value:function(e){return im.debug("send()"),this.isConnected()?(this._ws.send(e),!0):(im.warn("unable to send message, WebSocket is not open"),!1)}},{key:"isConnected",value:function(){return this._ws&&this._ws.readyState===this._ws.OPEN}},{key:"isConnecting",value:function(){return this._ws&&this._ws.readyState===this._ws.CONNECTING}},{key:"_onOpen",value:function(){im.debug("WebSocket ".concat(this._url," connected")),this.onconnect()}},{key:"_onClose",value:function(e){var t=e.wasClean,r=e.code,e=e.reason;im.debug("WebSocket ".concat(this._url," closed")),!1===t&&im.debug("WebSocket abrupt disconnection"),this.ondisconnect(!t,r,e)}},{key:"_onMessage",value:function(e){e=e.data;im.debug("received WebSocket message"),this.ondata(e)}},{key:"_onError",value:function(e){im.warn("WebSocket ".concat(this._url," error: "),e)}}]),am=ec,um=(V(),new am("WxWebsocketInterface"),{}),lm=Pl.exports,cm=(um.getMicrophones=lm.getMicrophones,um.getSpeakers=lm.getSpeakers,um.getDevices=lm.getDevices,o),pm=s,dm=j,hm=F(),fm=Qf,mm=B(),gm=M(),ym=V(),_m=sm,vm=um,bm=ec,Tm=(we.exports(cm.title)("version %s",cm.version),{C:pm,Exceptions:dm,Utils:hm,UA:fm,URI:mm,NameAddrHeader:gm,WebSocketInterface:_m,Grammar:ym,Devices:vm,Logger:bm,debug:we.exports,get name(){return cm.title},get version(){return cm.version}});exports.default=Tm;
|
|
1
|
+
function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("trtc-js-sdk")),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(r){var n,e=r.default;return"function"==typeof e?(n=function(){return e.apply(this,arguments)}).prototype=e.prototype:n={},Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(r).forEach(function(e){var t=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(n,e,t.get?t:{enumerable:!0,get:function(){return r[e]}})}),n}var o={name:"@tencentcloud/tccc-sip-js",title:"TCCCSIP",description:"TCCC JavaScript SIP SDK",version:"0.1.2",homepage:"https://tccc.qcloud.com",contributors:["TCCC Frontend Team"],types:"dist/jssip.d.ts",main:"dist/jssip.cjs.js",module:"dist/jssip.esm.js",browser:"dist/jssip.umd.js",miniprogram:"miniprogram_dist",exports:{".":{import:"dist/jssip.esm.js",require:"dist/index.cjs.js",browser:"dist/jssip.umd.js",types:"dist/jssip.d.ts",default:"dist/jssip.esm.js"}},files:["dist","miniprogram_dist"],keywords:["sip","websocket","webrtc","node","browser","library","tccc","腾讯云呼叫中心","腾讯云联络中心"],license:"MIT",peerDependencies:{"trtc-js-sdk":"^4.13.0"},dependencies:{debug:"^4.3.1",events:"^3.3.0","sdp-transform":"^2.14.1","trtc-js-sdk":"^4.13.0"},devDependencies:{"@babel/core":"^7.19.6","@babel/plugin-external-helpers":"^7.18.6","@babel/plugin-transform-runtime":"^7.18.10","@babel/preset-env":"^7.19.4","@opentelemetry/api":"^1.9.0","@opentelemetry/api-logs":"^0.208.0","@opentelemetry/exporter-logs-otlp-http":"^0.208.0","@opentelemetry/exporter-trace-otlp-http":"^0.208.0","@opentelemetry/resources":"^2.2.0","@opentelemetry/sdk-logs":"^0.208.0","@opentelemetry/sdk-trace-base":"^2.2.0","@opentelemetry/sdk-trace-web":"^2.2.0","@opentelemetry/semantic-conventions":"^1.38.0","@rollup/plugin-babel":"^5.3.1","@rollup/plugin-commonjs":"^22.0.2","@rollup/plugin-eslint":"^8.0.2","@rollup/plugin-json":"^4.1.0","@rollup/plugin-node-resolve":"^13.3.0","@rollup/plugin-replace":"^4.0.0","@rollup/plugin-typescript":"^8.4.0","@types/debug":"^4.1.5","@types/node":"^14.14.34","@typescript-eslint/eslint-plugin":"^5.36.2","@typescript-eslint/parser":"^5.36.2","ansi-colors":"^3.2.4",browserify:"^16.5.1","cross-env":"^7.0.3",eslint:"7.32.0","fancy-log":"^1.3.3",gulp:"^4.0.2","gulp-babel":"^8.0.0","gulp-eslint":"^5.0.0","gulp-expect-file":"^1.0.2","gulp-header":"^2.0.9","gulp-nodeunit-runner":"^0.2.2","gulp-plumber":"^1.2.1","gulp-rename":"^1.4.0","gulp-uglify-es":"^1.0.4","lodash.template":"^4.5.0",pegjs:"^0.7.0",rimraf:"^3.0.2",rollup:"^2.79.0","rollup-plugin-copy":"^3.4.0","rollup-plugin-dts":"^4.2.2","rollup-plugin-filesize":"^10.0.0","rollup-plugin-peer-deps-external":"^2.2.4","rollup-plugin-polyfill-node":"^0.10.2","rollup-plugin-progress":"^1.1.2","rollup-plugin-terser":"^7.0.2","rollup-plugin-uglify":"^6.0.4",typescript:"^4.8.2","vinyl-buffer":"^1.0.1","vinyl-source-stream":"^2.0.0"},scripts:{lint:"node npm-scripts.js lint",test:"node npm-scripts.js test",prepublish:"node npm-scripts.js prepublish",release:"node npm-scripts.js release",dev:"cross-env NODE_ENV=development rollup -c rollup.config.js -w",build:"cross-env rimraf dist && rollup -c rollup.config.js && node config/build-package.js",prepublishOnly:"npm run build",grammar:"gulp grammar"},packageManager:"pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748"},i=o,s={USER_AGENT:"".concat(i.title," ").concat(i.version),SIP:"sip",SIPS:"sips",causes:{CONNECTION_ERROR:"Connection Error",REQUEST_TIMEOUT:"Request Timeout",SIP_FAILURE_CODE:"SIP Failure Code",INTERNAL_ERROR:"Internal Error",BUSY:"Busy",REJECTED:"Rejected",REDIRECTED:"Redirected",UNAVAILABLE:"Unavailable",NOT_FOUND:"Not Found",ADDRESS_INCOMPLETE:"Address Incomplete",INCOMPATIBLE_SDP:"Incompatible SDP",MISSING_SDP:"Missing SDP",AUTHENTICATION_ERROR:"Authentication Error",BYE:"Terminated",WEBRTC_ERROR:"WebRTC Error",CANCELED:"Canceled",NO_ANSWER:"No Answer",EXPIRES:"Expires",NO_ACK:"No ACK",DIALOG_ERROR:"Dialog Error",USER_DENIED_MEDIA_ACCESS:"User Denied Media Access",BAD_MEDIA_DESCRIPTION:"Bad Media Description",RTP_TIMEOUT:"RTP Timeout"},SIP_ERROR_CAUSES:{REDIRECTED:[300,301,302,305,380],BUSY:[486,600],REJECTED:[403,603],NOT_FOUND:[404,604],UNAVAILABLE:[480,410,408,430],ADDRESS_INCOMPLETE:[484,424],INCOMPATIBLE_SDP:[488,606],AUTHENTICATION_ERROR:[401,407]},ACK:"ACK",BYE:"BYE",CANCEL:"CANCEL",INFO:"INFO",INVITE:"INVITE",MESSAGE:"MESSAGE",NOTIFY:"NOTIFY",OPTIONS:"OPTIONS",REGISTER:"REGISTER",REFER:"REFER",UPDATE:"UPDATE",SUBSCRIBE:"SUBSCRIBE",DTMF_TRANSPORT:{INFO:"INFO",RFC2833:"RFC2833"},REASON_PHRASE:{100:"Trying",180:"Ringing",181:"Call Is Being Forwarded",182:"Queued",183:"Session Progress",199:"Early Dialog Terminated",200:"OK",202:"Accepted",204:"No Notification",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",305:"Use Proxy",380:"Alternative Service",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",410:"Gone",412:"Conditional Request Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Unsupported URI Scheme",417:"Unknown Resource-Priority",420:"Bad Extension",421:"Extension Required",422:"Session Interval Too Small",423:"Interval Too Brief",424:"Bad Location Information",428:"Use Identity Header",429:"Provide Referrer Identity",430:"Flow Failed",433:"Anonymity Disallowed",436:"Bad Identity-Info",437:"Unsupported Certificate",438:"Invalid Identity Header",439:"First Hop Lacks Outbound Support",440:"Max-Breadth Exceeded",469:"Bad Info Package",470:"Consent Needed",478:"Unresolvable Destination",480:"Temporarily Unavailable",481:"Call/Transaction Does Not Exist",482:"Loop Detected",483:"Too Many Hops",484:"Address Incomplete",485:"Ambiguous",486:"Busy Here",487:"Request Terminated",488:"Not Acceptable Here",489:"Bad Event",491:"Request Pending",493:"Undecipherable",494:"Security Agreement Required",500:"JsSIP Internal Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Server Time-out",505:"Version Not Supported",513:"Message Too Large",580:"Precondition Failure",600:"Busy Everywhere",603:"Decline",604:"Does Not Exist Anywhere",606:"Not Acceptable"},ALLOWED_METHODS:"INVITE,ACK,CANCEL,BYE,UPDATE,MESSAGE,OPTIONS,REFER,INFO,NOTIFY",ACCEPTED_BODY_TYPES:"application/sdp, application/dtmf-relay",MAX_FORWARDS:69,SESSION_EXPIRES:90,MIN_SESSION_EXPIRES:60,CONNECTION_RECOVERY_MAX_INTERVAL:30,CONNECTION_RECOVERY_MIN_INTERVAL:2,LOG_LEVEL:{TRACE:0,DEBUG:1,WARN:2,ERROR:3,NONE:4}};function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t,r){t=f(t);var n=e,t=g()?Reflect.construct(t,r||[],f(e).constructor):t.apply(e,r);if(!t||"object"!=typeof t&&"function"!=typeof t){if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");if(void 0===(t=n))throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,S(n.key),n)}}function p(e,t,r){return t&&c(e.prototype,t),r&&c(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function d(e,t){var r,n,o,s,i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return o=!(n=!0),{s:function(){i=i.call(e)},n:function(){var e=i.next();return n=e.done,e},e:function(e){o=!0,r=e},f:function(){try{n||null==i.return||i.return()}finally{if(o)throw r}}};if(Array.isArray(e)||(i=w(e))||t&&e&&"number"==typeof e.length)return i&&(e=i),s=0,{s:t=function(){},n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:t};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function h(e,t,r){return(t=S(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e){return(f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!e})()}function y(t,e){var r,n=Object.keys(t);return Object.getOwnPropertySymbols&&(r=Object.getOwnPropertySymbols(t),e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)),n}function _(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?y(Object(r),!0).forEach(function(e){h(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function v(e,t){return(v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function b(e){return(e=>{if(Array.isArray(e))return a(e)})(e)||(()=>{if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)})()||w(e)||(()=>{throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function S(e){e=(e=>{if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return String(e);if("object"!=typeof(t=t.call(e,"string")))return t;throw new TypeError("@@toPrimitive must return a primitive value.")})(e);return"symbol"==typeof e?e:e+""}function T(e){return(T="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 w(e,t){var r;if(e)return"string"==typeof e?a(e,t):"Map"===(r="Object"===(r={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:r)||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}function E(e){var r="function"==typeof Map?new Map:void 0;return(E=function(e){if(null===e||!(t=>{try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}})(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,t)}function t(){return function(e,t,r){var n;return g()?Reflect.construct.apply(null,arguments):((n=[null]).push.apply(n,t),t=new(e.bind.apply(e,n)),r&&v(t,r.prototype),t)}(e,arguments,f(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),v(t,e)})(e)}var A,O,x,C,R,N,I,P=(()=>{function n(e,t){var r;return l(this,n),(r=u(this,n)).code=1,r.name="CONFIGURATION_ERROR",r.parameter=e,r.value=t,r.message=r.value?"Invalid value ".concat(JSON.stringify(r.value),' for parameter "').concat(r.parameter,'"'):"Missing parameter: ".concat(r.parameter),r}return m(n,E(Error)),p(n)})(),U=(()=>{function r(e){var t;return l(this,r),(t=u(this,r)).code=2,t.name="INVALID_STATE_ERROR",t.status=e,t.message="Invalid status: ".concat(e),t}return m(r,E(Error)),p(r)})(),k=(()=>{function r(e){var t;return l(this,r),(t=u(this,r)).code=3,t.name="NOT_SUPPORTED_ERROR",t.message=e,t}return m(r,E(Error)),p(r)})(),L=(()=>{function r(e){var t;return l(this,r),(t=u(this,r)).code=4,t.name="NOT_READY_ERROR",t.message=e,t}return m(r,E(Error)),p(r)})(),j={ConfigurationError:P,InvalidStateError:U,NotSupportedError:k,NotReadyError:L},D={};function M(){var o,t;return O||(O=1,o=B(),t=V(),A=p(s,[{key:"uri",get:function(){return this._uri}},{key:"display_name",get:function(){return this._display_name},set:function(e){this._display_name=0===e?"0":e}},{key:"setParam",value:function(e,t){e&&(this._parameters[e.toLowerCase()]=null==t?null:t.toString())}},{key:"getParam",value:function(e){if(e)return this._parameters[e.toLowerCase()]}},{key:"hasParam",value:function(e){if(e)return!!this._parameters.hasOwnProperty(e.toLowerCase())}},{key:"deleteParam",value:function(e){var t;if(e=e.toLowerCase(),this._parameters.hasOwnProperty(e))return t=this._parameters[e],delete this._parameters[e],t}},{key:"clearParams",value:function(){this._parameters={}}},{key:"clone",value:function(){return new s(this._uri.clone(),this._display_name,JSON.parse(JSON.stringify(this._parameters)))}},{key:"_quote",value:function(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}},{key:"toString",value:function(){var e,t=this._display_name?'"'.concat(this._quote(this._display_name),'" '):"";for(e in t+="<".concat(this._uri.toString(),">"),this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,e)&&(t+=";".concat(e),null!==this._parameters[e])&&(t+="=".concat(this._parameters[e]));return t}}],[{key:"parse",value:function(e){return-1!==(e=t.parse(e,"Name_Addr_Header"))?e:void 0}}])),A;function s(e,t,r){if(l(this,s),!(e&&e instanceof o))throw new TypeError('missing or invalid "uri" parameter');for(var n in this._uri=e,this._parameters={},this.display_name=t,r)Object.prototype.hasOwnProperty.call(r,n)&&this.setParam(n,r[n])}}function V(){return C||(C=1,(e={parse:function(g,u){var e={CRLF:V,DIGIT:l,ALPHA:i,HEXDIG:a,WSP:c,OCTET:r,DQUOTE:p,SP:h,HTAB:d,alphanum:o,reserved:F,unreserved:n,mark:H,escaped:f,LWS:m,SWS:v,HCOLON:q,TEXT_UTF8_TRIM:K,TEXT_UTF8char:b,UTF8_NONASCII:S,UTF8_CONT:T,LHEX:function(){var e;return null===(e=l())&&(/^[a-f]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[a-f]"))),e},token:w,token_nodot:G,separators:function(){var e;return 40===g.charCodeAt(y)?(e="(",y++):(e=null,_('"("')),e=null===e&&(41===g.charCodeAt(y)?(e=")",y++):(e=null,_('")"')),null===e)&&(60===g.charCodeAt(y)?(e="<",y++):(e=null,_('"<"')),null===e)&&(62===g.charCodeAt(y)?(e=">",y++):(e=null,_('">"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')),null===e)&&(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(92===g.charCodeAt(y)?(e="\\",y++):(e=null,_('"\\\\"')),null===e)&&null===(e=p())&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null===e)&&(93===g.charCodeAt(y)?(e="]",y++):(e=null,_('"]"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(123===g.charCodeAt(y)?(e="{",y++):(e=null,_('"{"')),null===e)&&(125===g.charCodeAt(y)?(e="}",y++):(e=null,_('"}"')),null===e)&&null===(e=h())?d():e},word:E,STAR:z,SLASH:Y,EQUAL:A,LPAREN:W,RPAREN:X,RAQUOT:J,LAQUOT:$,COMMA:O,SEMI:x,COLON:Q,LDQUOT:Z,RDQUOT:ee,comment:function e(){var t,r,n,o=y;if(null!==(t=W())){for(r=[],null===(n=te())&&null===(n=R())&&(n=e());null!==n;)r.push(n),null===(n=te())&&null===(n=R())&&(n=e());null!==r&&null!==(n=X())?t=[t,r,n]:(t=null,y=o)}else t=null,y=o;return t},ctext:te,quoted_string:re,quoted_string_clean:C,qdtext:ne,quoted_pair:R,SIP_URI_noparams:oe,SIP_URI:se,uri_scheme:ie,uri_scheme_sips:ae,uri_scheme_sip:ue,userinfo:le,user:ce,user_unreserved:pe,password:he,hostport:de,host:fe,hostname:me,domainlabel:ge,toplabel:ye,IPv6reference:_e,IPv6address:ve,h16:N,ls32:I,IPv4address:be,dec_octet:Se,port:Te,uri_parameters:we,uri_parameter:Ee,transport_param:Ae,user_param:Oe,method_param:xe,ttl_param:Ce,maddr_param:Re,lr_param:Ne,other_param:Ie,pname:Le,pvalue:ke,paramchar:Pe,param_unreserved:Ue,headers:je,header:De,hname:Me,hvalue:Ve,hnv_unreserved:Be,Request_Response:function(){var e;return e=null===(e=gt())?Fe():e},Request_Line:Fe,Request_URI:He,absoluteURI:qe,hier_part:Ke,net_path:Ge,abs_path:ze,opaque_part:Ye,uric:We,uric_no_slash:Xe,path_segments:Je,segment:$e,param:Qe,pchar:Ze,scheme:et,authority:tt,srvr:rt,reg_name:nt,query:ot,SIP_Version:st,INVITEm:it,ACKm:at,OPTIONSm:ut,BYEm:lt,CANCELm:ct,REGISTERm:pt,SUBSCRIBEm:ht,NOTIFYm:dt,REFERm:ft,Method:mt,Status_Line:gt,Status_Code:yt,extension_code:_t,Reason_Phrase:vt,Allow_Events:function(){var e,t,r,n,o,s=y;if(null!==(e=Bt())){for(t=[],o=y,null!==(r=O())&&null!==(n=Bt())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=Bt())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Call_ID:function(){var e,t,r,n,o=y,s=y;return null!==(e=E())&&(n=y,64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null!==t&&null!==(r=E())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null===(e=null!==e?void(D=g.substring(y,o)):e)&&(y=o),e},Contact:function(){var e,t,r,n,o,s,i=y;if(null===(e=z()))if(o=y,null!==(e=bt())){for(t=[],s=y,null!==(r=O())&&null!==(n=bt())?r=[r,n]:(r=null,y=s);null!==r;)t.push(r),s=y,null!==(r=O())&&null!==(n=bt())?r=[r,n]:(r=null,y=s);null!==t?e=[e,t]:(e=null,y=o)}else e=null,y=o;return null===(e=null!==e?(()=>{for(var e=D.multi_header.length,t=0;t<e;t++)if(null===D.multi_header[t].parsed){D=null;break}D=null!==D?D.multi_header:-1})():e)&&(y=i),e},contact_param:bt,name_addr:L,display_name:St,contact_params:Tt,c_p_q:wt,c_p_expires:Et,delta_seconds:k,qvalue:At,generic_param:P,gen_value:Ot,Content_Disposition:function(){var e,t,r,n,o,s=y;if(null!==(e=xt())){for(t=[],o=y,null!==(r=x())&&null!==(n=Ct())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Ct())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},disp_type:xt,disp_param:Ct,handling_param:Rt,Content_Encoding:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Content_Length:function(){var e,t,r=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null===(e=null!==e?void(D=parseInt(e.join(""))):e)&&(y=r),e},Content_Type:function(){var e,t=y;return null===(e=null!==(e=Nt())?void(D=g.substring(y,t)):e)&&(y=t),e},media_type:Nt,m_type:It,discrete_type:Lt,composite_type:kt,extension_token:Pt,x_token:Ut,m_subtype:jt,m_parameter:Dt,m_value:Mt,CSeq:function(){var e,t,r,n=y;return null!==(e=Vt())&&null!==(t=m())&&null!==(r=mt())?e=[e,t,r]:(e=null,y=n),e},CSeq_value:Vt,Expires:function(){var e,t=y;return null===(e=null!==(e=k())?void(D=e):e)&&(y=t),e},Event:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=Bt())){for(t=[],o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null!==e&&(i=e[0],e=void(D.event=i.join("").toLowerCase())),null===e&&(y=s),e},event_type:Bt,From:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?L():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=Ft())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Ft())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{var e=D.tag;try{D=new j(D.uri,D.display_name,D.params),e&&D.setParam("tag",e)}catch(e){D=-1}})():e)&&(y=s),e},from_param:Ft,tag_param:Ht,Max_Forwards:function(){var e,t,r=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null===(e=null!==e?void(D=parseInt(e.join(""))):e)&&(y=r),e},Min_Expires:function(){var e,t=y;return null===(e=null!==(e=k())?void(D=e):e)&&(y=t),e},Name_Addr_Header:function(){for(var e,t,r,n,o,s,i=y,a=y,u=[],l=St();null!==l;)u.push(l),l=St();if(null!==u)if(null!==(l=$()))if(null!==(e=se()))if(null!==(t=J())){for(r=[],s=y,null!==(n=x())&&null!==(o=P())?n=[n,o]:(n=null,y=s);null!==n;)r.push(n),s=y,null!==(n=x())&&null!==(o=P())?n=[n,o]:(n=null,y=s);null!==r?u=[u,l,e,t,r]:(u=null,y=a)}else u=null,y=a;else u=null,y=a;else u=null,y=a;else u=null,y=a;return null===(u=null!==u?(()=>{try{D=new j(D.uri,D.display_name,D.params)}catch(e){D=-1}})():u)&&(y=i),u},Proxy_Authenticate:qt,challenge:qt,other_challenge:Kt,auth_param:Gt,digest_cln:zt,realm:Yt,realm_value:Wt,domain:Xt,URI:Jt,nonce:$t,nonce_value:Qt,opaque:Zt,stale:er,algorithm:tr,qop_options:rr,qop_value:nr,Proxy_Require:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Record_Route:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=or())){for(t=[],o=y,null!==(r=O())&&null!==(n=or())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=or())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{for(var e=D.multi_header.length,t=0;t<e;t++)if(null===D.multi_header[t].parsed){D=null;break}D=null!==D?D.multi_header:-1})():e)&&(y=s),e},rec_route:or,Reason:function(){var e,t,r,n,o,s=y,i=y;if("sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"SIP"')),null!==(e=null===e?w():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=sr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=sr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null!==e&&(i=e[0],D.protocol=i.toLowerCase(),D.params||(D.params={}),e=void(D.params.text&&'"'===D.params.text[0]&&(i=D.params.text,D.text=i.substring(1,i.length-1),delete D.params.text))),null===e&&(y=s),e},reason_param:sr,reason_cause:ir,Require:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},Route:function(){var e,t,r,n,o,s=y;if(null!==(e=ar())){for(t=[],o=y,null!==(r=O())&&null!==(n=ar())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=ar())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},route_param:ar,Subscription_State:function(){var e,t,r,n,o,s=y;if(null!==(e=ur())){for(t=[],o=y,null!==(r=x())&&null!==(n=lr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=lr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},substate_value:ur,subexp_params:lr,event_reason_value:cr,Subject:function(){var e;return null!==(e=K())?e:""},Supported:function(){var e,t,r,n,o,s=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return null!==e?e:""},To:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?L():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=pr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=pr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{var e=D.tag;try{D=new j(D.uri,D.display_name,D.params),e&&D.setParam("tag",e)}catch(e){D=-1}})():e)&&(y=s),e},to_param:pr,Via:function(){var e,t,r,n,o,s=y;if(null!==(e=hr())){for(t=[],o=y,null!==(r=O())&&null!==(n=hr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=O())&&null!==(n=hr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},via_param:hr,via_params:dr,via_ttl:fr,via_maddr:mr,via_received:gr,via_branch:yr,response_port:_r,rport:vr,sent_protocol:br,protocol_name:Sr,transport:Tr,sent_by:wr,via_host:Er,via_port:Ar,ttl:Or,WWW_Authenticate:qt,Session_Expires:function(){var e,t,r,n,o,s=y;if(null!==(e=xr())){for(t=[],o=y,null!==(r=x())&&null!==(n=Cr())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Cr())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},s_e_expires:xr,s_e_params:Cr,s_e_refresher:Rr,extension_header:function(){var e,t,r,n=y;return null!==(e=w())&&null!==(t=q())&&null!==(r=Nr())?e=[e,t,r]:(e=null,y=n),e},header_value:Nr,message_body:function(){for(var e=[],t=r();null!==t;)e.push(t),t=r();return e},uuid_URI:function(){var e,t,r=y;return"uuid:"===g.substr(y,5)?(e="uuid:",y+=5):(e=null,_('"uuid:"')),null!==e&&null!==(t=Ir())?e=[e,t]:(e=null,y=r),e},uuid:Ir,hex4:U,hex8:Lr,hex12:kr,Refer_To:function(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?L():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(()=>{try{D=new j(D.uri,D.display_name,D.params)}catch(e){D=-1}})():e)&&(y=s),e},Replaces:function(){var e,t,r,n,o,s=y;if(null!==(e=Pr())){for(t=[],o=y,null!==(r=x())&&null!==(n=Ur())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Ur())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e},call_id:Pr,replaces_param:Ur,to_tag:jr,from_tag:Dr,early_flag:Mr};if(void 0!==u){if(void 0===e[u])throw new Error("Invalid rule name: "+Hr(u)+".")}else u="CRLF";var y=0,s=0,t=[];function _(e){y<s||(s<y&&(s=y,t=[]),t.push(e))}function V(){var e;return"\r\n"===g.substr(y,2)?(e="\r\n",y+=2):(e=null,_('"\\r\\n"')),e}function l(){var e;return/^[0-9]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[0-9]")),e}function i(){var e;return/^[a-zA-Z]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[a-zA-Z]")),e}function a(){var e;return/^[0-9a-fA-F]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[0-9a-fA-F]")),e}function c(){var e;return e=null===(e=h())?d():e}function r(){var e;return/^[\0-\xFF]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\0-\\xFF]")),e}function p(){var e;return/^["]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_('["]')),e}function h(){var e;return 32===g.charCodeAt(y)?(e=" ",y++):(e=null,_('" "')),e}function d(){var e;return 9===g.charCodeAt(y)?(e="\t",y++):(e=null,_('"\\t"')),e}function o(){var e;return/^[a-zA-Z0-9]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[a-zA-Z0-9]")),e}function F(){var e;return 59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","'))),e}function n(){var e;return e=null===(e=o())?H():e}function H(){var e;return 45===g.charCodeAt(y)?(e="-",y++):(e=null,_('"-"')),null===e&&(95===g.charCodeAt(y)?(e="_",y++):(e=null,_('"_"')),null===e)&&(46===g.charCodeAt(y)?(e=".",y++):(e=null,_('"."')),null===e)&&(33===g.charCodeAt(y)?(e="!",y++):(e=null,_('"!"')),null===e)&&(126===g.charCodeAt(y)?(e="~",y++):(e=null,_('"~"')),null===e)&&(42===g.charCodeAt(y)?(e="*",y++):(e=null,_('"*"')),null===e)&&(39===g.charCodeAt(y)?(e="'",y++):(e=null,_('"\'"')),null===e)&&(40===g.charCodeAt(y)?(e="(",y++):(e=null,_('"("')),null===e)&&(41===g.charCodeAt(y)?(e=")",y++):(e=null,_('")"'))),e}function f(){var e,t,r,n=y,o=y;return 37===g.charCodeAt(y)?(e="%",y++):(e=null,_('"%"')),null!==e&&null!==(t=a())&&null!==(r=a())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?e.join(""):e)&&(y=n),e}function m(){for(var e,t=y,r=y,n=y,o=[],s=c();null!==s;)o.push(s),s=c();if(null!==o&&null!==(s=V())?o=[o,s]:(o=null,y=n),null!==(o=null!==o?o:"")){if(null!==(e=c()))for(s=[];null!==e;)s.push(e),e=c();else s=null;null!==s?o=[o,s]:(o=null,y=r)}else o=null,y=r;return null===(o=null!==o?" ":o)&&(y=t),o}function v(){var e;return null!==(e=m())?e:""}function q(){var e,t,r=y,n=y,o=[];for(null===(e=h())&&(e=d());null!==e;)o.push(e),null===(e=h())&&(e=d());return null!==o&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null!==e)&&null!==(t=v())?o=[o,e,t]:(o=null,y=n),null===(o=null!==o?":":o)&&(y=r),o}function K(){var e,t,r,n,o,s=y,i=y;if(null!==(t=b()))for(e=[];null!==t;)e.push(t),t=b();else e=null;if(null!==e){for(t=[],o=y,r=[],n=m();null!==n;)r.push(n),n=m();for(null!==r&&null!==(n=b())?r=[r,n]:(r=null,y=o);null!==r;){for(t.push(r),o=y,r=[],n=m();null!==n;)r.push(n),n=m();null!==r&&null!==(n=b())?r=[r,n]:(r=null,y=o)}null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?g.substring(y,s):e)&&(y=s),e}function b(){var e;return/^[!-~]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[!-~]")),e=null===e?S():e}function S(){var e;return/^[\x80-\uFFFF]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\x80-\\uFFFF]")),e}function T(){var e;return/^[\x80-\xBF]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\x80-\\xBF]")),e}function w(){var e,t,r=y;if(null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')));else e=null;return null===(e=null!==e?g.substring(y,r):e)&&(y=r),e}function G(){var e,t,r=y;if(null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')));else e=null;return null===(e=null!==e?g.substring(y,r):e)&&(y=r),e}function E(){var e,t,r=y;if(null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')),null===t)&&(40===g.charCodeAt(y)?(t="(",y++):(t=null,_('"("')),null===t)&&(41===g.charCodeAt(y)?(t=")",y++):(t=null,_('")"')),null===t)&&(60===g.charCodeAt(y)?(t="<",y++):(t=null,_('"<"')),null===t)&&(62===g.charCodeAt(y)?(t=">",y++):(t=null,_('">"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(92===g.charCodeAt(y)?(t="\\",y++):(t=null,_('"\\\\"')),null===t)&&null===(t=p())&&(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null===t)&&(91===g.charCodeAt(y)?(t="[",y++):(t=null,_('"["')),null===t)&&(93===g.charCodeAt(y)?(t="]",y++):(t=null,_('"]"')),null===t)&&(63===g.charCodeAt(y)?(t="?",y++):(t=null,_('"?"')),null===t)&&(123===g.charCodeAt(y)?(t="{",y++):(t=null,_('"{"')),null===t)&&(125===g.charCodeAt(y)?(t="}",y++):(t=null,_('"}"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=o())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null===t)&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null===t)&&(33===g.charCodeAt(y)?(t="!",y++):(t=null,_('"!"')),null===t)&&(37===g.charCodeAt(y)?(t="%",y++):(t=null,_('"%"')),null===t)&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null===t)&&(95===g.charCodeAt(y)?(t="_",y++):(t=null,_('"_"')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')),null===t)&&(96===g.charCodeAt(y)?(t="`",y++):(t=null,_('"`"')),null===t)&&(39===g.charCodeAt(y)?(t="'",y++):(t=null,_('"\'"')),null===t)&&(126===g.charCodeAt(y)?(t="~",y++):(t=null,_('"~"')),null===t)&&(40===g.charCodeAt(y)?(t="(",y++):(t=null,_('"("')),null===t)&&(41===g.charCodeAt(y)?(t=")",y++):(t=null,_('")"')),null===t)&&(60===g.charCodeAt(y)?(t="<",y++):(t=null,_('"<"')),null===t)&&(62===g.charCodeAt(y)?(t=">",y++):(t=null,_('">"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(92===g.charCodeAt(y)?(t="\\",y++):(t=null,_('"\\\\"')),null===t)&&null===(t=p())&&(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null===t)&&(91===g.charCodeAt(y)?(t="[",y++):(t=null,_('"["')),null===t)&&(93===g.charCodeAt(y)?(t="]",y++):(t=null,_('"]"')),null===t)&&(63===g.charCodeAt(y)?(t="?",y++):(t=null,_('"?"')),null===t)&&(123===g.charCodeAt(y)?(t="{",y++):(t=null,_('"{"')),null===t)&&(125===g.charCodeAt(y)?(t="}",y++):(t=null,_('"}"')));else e=null;return null===(e=null!==e?g.substring(y,r):e)&&(y=r),e}function z(){var e,t,r,n=y,o=y;return null!==(e=v())&&(42===g.charCodeAt(y)?(t="*",y++):(t=null,_('"*"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"*":e)&&(y=n),e}function Y(){var e,t,r,n=y,o=y;return null!==(e=v())&&(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"/":e)&&(y=n),e}function A(){var e,t,r,n=y,o=y;return null!==(e=v())&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"=":e)&&(y=n),e}function W(){var e,t,r,n=y,o=y;return null!==(e=v())&&(40===g.charCodeAt(y)?(t="(",y++):(t=null,_('"("')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?"(":e)&&(y=n),e}function X(){var e,t,r,n=y,o=y;return null!==(e=v())&&(41===g.charCodeAt(y)?(t=")",y++):(t=null,_('")"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?")":e)&&(y=n),e}function J(){var e,t,r=y,n=y;return 62===g.charCodeAt(y)?(e=">",y++):(e=null,_('">"')),null!==e&&null!==(t=v())?e=[e,t]:(e=null,y=n),null===(e=null!==e?">":e)&&(y=r),e}function $(){var e,t,r=y,n=y;return null!==(e=v())&&(60===g.charCodeAt(y)?(t="<",y++):(t=null,_('"<"')),null!==t)?e=[e,t]:(e=null,y=n),null===(e=null!==e?"<":e)&&(y=r),e}function O(){var e,t,r,n=y,o=y;return null!==(e=v())&&(44===g.charCodeAt(y)?(t=",",y++):(t=null,_('","')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?",":e)&&(y=n),e}function x(){var e,t,r,n=y,o=y;return null!==(e=v())&&(59===g.charCodeAt(y)?(t=";",y++):(t=null,_('";"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?";":e)&&(y=n),e}function Q(){var e,t,r,n=y,o=y;return null!==(e=v())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=v())?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?":":e)&&(y=n),e}function Z(){var e,t,r=y,n=y;return null!==(e=v())&&null!==(t=p())?e=[e,t]:(e=null,y=n),null===(e=null!==e?'"':e)&&(y=r),e}function ee(){var e,t,r=y,n=y;return null!==(e=p())&&null!==(t=v())?e=[e,t]:(e=null,y=n),null===(e=null!==e?'"':e)&&(y=r),e}function te(){var e;return/^[!-']/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[!-']")),e=null===e&&(/^[*-[]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[*-[]")),null===e)&&(/^[\]-~]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\]-~]")),null===e)&&null===(e=S())?m():e}function re(){var e,t,r,n,o=y,s=y;if(null!==(e=v()))if(null!==(t=p())){for(r=[],null===(n=ne())&&(n=R());null!==n;)r.push(n),null===(n=ne())&&(n=R());null!==r&&null!==(n=p())?e=[e,t,r,n]:(e=null,y=s)}else e=null,y=s;else e=null,y=s;return null===(e=null!==e?g.substring(y,o):e)&&(y=o),e}function C(){var e,t,r,n,o=y,s=y;if(null!==(e=v()))if(null!==(n=p())){for(t=[],null===(r=ne())&&(r=R());null!==r;)t.push(r),null===(r=ne())&&(r=R());null!==t&&null!==(r=p())?e=[e,n,t,r]:(e=null,y=s)}else e=null,y=s;else e=null,y=s;return null===(e=null!==e?(n=g.substring(y,o).trim()).substring(1,n.length-1).replace(/\\([\x00-\x09\x0b-\x0c\x0e-\x7f])/g,"$1"):e)&&(y=o),e}function ne(){var e;return e=null===(e=m())&&(33===g.charCodeAt(y)?(e="!",y++):(e=null,_('"!"')),null===e)&&(/^[#-[]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[#-[]")),null===e)&&(/^[\]-~]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[\\]-~]")),null===e)?S():e}function R(){var e,t,r=y;return 92===g.charCodeAt(y)?(e="\\",y++):(e=null,_('"\\\\"')),null!==e&&(/^[\0-\t]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[\\0-\\t]")),null===t&&(/^[\x0B-\f]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[\\x0B-\\f]")),null===t)&&(/^[\x0E-]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[\\x0E-]"))),null!==t)?e=[e,t]:(e=null,y=r),e}function oe(){var e,t,r,n,o=y,s=y;return null!==(e=ie())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=null!==(r=le())?r:"")&&null!==(n=de())?e=[e,t,r,n]:(e=null,y=s),null===(e=null!==e?(()=>{try{D.uri=new Fr(D.scheme,D.user,D.host,D.port),delete D.scheme,delete D.user,delete D.host,delete D.host_type,delete D.port}catch(e){D=-1}})():e)&&(y=o),e}function se(){var e,t,r,n,o,s,i=y,a=y;return null!==(e=ie())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=null!==(r=le())?r:"")&&null!==(n=de())&&null!==(o=we())&&null!==(s=null!==(s=je())?s:"")?e=[e,t,r,n,o,s]:(e=null,y=a),null===(e=null!==e?(()=>{try{D.uri=new Fr(D.scheme,D.user,D.host,D.port,D.uri_params,D.uri_headers),delete D.scheme,delete D.user,delete D.host,delete D.host_type,delete D.port,delete D.uri_params,"SIP_URI"===u&&(D=D.uri)}catch(e){D=-1}})():e)&&(y=i),e}function ie(){var e;return e=null===(e=ae())?ue():e}function ae(){var e,t,r=y;return"sips"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"sips"')),null!==e&&(t=e,e=void(D.scheme=t.toLowerCase())),null===e&&(y=r),e}function ue(){var e,t,r=y;return"sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"sip"')),null!==e&&(t=e,e=void(D.scheme=t.toLowerCase())),null===e&&(y=r),e}function le(){var e,t,r,n,o=y,s=y;return null!==(e=ce())&&(n=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=he())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))&&(64===g.charCodeAt(y)?(r="@",y++):(r=null,_('"@"')),null!==r)?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(D.user=decodeURIComponent(g.substring(y-1,o))):e)&&(y=o),e}function ce(){var e,t;if(null!==(t=null===(t=n())&&null===(t=f())?pe():t))for(e=[];null!==t;)e.push(t),null===(t=n())&&null===(t=f())&&(t=pe());else e=null;return e}function pe(){var e;return 38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')),null===e)&&(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"'))),e}function he(){var e,t=y,r=[];for(null===(e=n())&&null===(e=f())&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')));null!==e;)r.push(e),null===(e=n())&&null===(e=f())&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","')));return null===(r=null!==r?void(D.password=g.substring(y,t)):r)&&(y=t),r}function de(){var e,t,r,n,o=y;return null!==(e=fe())&&(n=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=Te())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function fe(){var e,t=y;return null!==(e=null===(e=me())&&null===(e=be())?_e():e)&&(D.host=g.substring(y,t).toLowerCase(),e=D.host),null===e&&(y=t),e}function me(){var e,t,r=y,n=y,o=[],s=y;for(null!==(e=ge())&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==t)?e=[e,t]:(e=null,y=s);null!==e;)o.push(e),s=y,null!==(e=ge())&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==t)?e=[e,t]:(e=null,y=s);return null!==o&&null!==(e=ye())&&(46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==(t=null!==t?t:""))?o=[o,e,t]:(o=null,y=n),null!==o&&(n=r,D.host_type="domain",o=g.substring(y,n)),null===o&&(y=r),o}function ge(){var e,t,r,n=y;if(null!==(e=o())){for(t=[],null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==r;)t.push(r),null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==t?e=[e,t]:(e=null,y=n)}else e=null,y=n;return e}function ye(){var e,t,r,n=y;if(null!==(e=i())){for(t=[],null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==r;)t.push(r),null===(r=o())&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(95===g.charCodeAt(y)?(r="_",y++):(r=null,_('"_"')));null!==t?e=[e,t]:(e=null,y=n)}else e=null,y=n;return e}function _e(){var e,t,r,n=y,o=y;return 91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null!==e&&null!==(r=ve())&&(93===g.charCodeAt(y)?(t="]",y++):(t=null,_('"]"')),null!==t)?e=[e,r,t]:(e=null,y=o),null!==e&&(r=n,D.host_type="IPv6",e=g.substring(y,r)),null===e&&(y=n),e}function ve(){var e,t,r,n,o,s,i,a,u,l,c,p,h,d,f=y,m=y;return null!==(e=N())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=N())&&(58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n)&&null!==(o=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(i=N())&&(58===g.charCodeAt(y)?(a=":",y++):(a=null,_('":"')),null!==a)&&null!==(u=N())&&(58===g.charCodeAt(y)?(l=":",y++):(l=null,_('":"')),null!==l)&&null!==(c=N())&&(58===g.charCodeAt(y)?(p=":",y++):(p=null,_('":"')),null!==p)&&null!==(d=I())?e=[e,t,r,n,o,s,i,a,u,l,c,p,d]:(e=null,y=m),null===e&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=N())&&(58===g.charCodeAt(y)?(u=":",y++):(u=null,_('":"')),null!==u)&&null!==(l=N())&&(58===g.charCodeAt(y)?(c=":",y++):(c=null,_('":"')),null!==c)&&null!==(p=I())?e=[e,t,r,n,o,s,i,a,u,l,c,p]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=N())&&(58===g.charCodeAt(y)?(u=":",y++):(u=null,_('":"')),null!==u)&&null!==(l=I())?e=[e,t,r,n,o,s,i,a,u,l]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=I())?e=[e,t,r,n,o,s,i,a]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=I())?e=[e,t,r,n,o,s]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())&&(58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r)&&null!==(n=I())?e=[e,t,r,n]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=I())?e=[e,t]:(e=null,y=m),null===e)&&(m=y,"::"===g.substr(y,2)?(e="::",y+=2):(e=null,_('"::"')),null!==e&&null!==(t=N())?e=[e,t]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&("::"===g.substr(y,2)?(t="::",y+=2):(t=null,_('"::"')),null!==t)&&null!==(r=N())&&(58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n)&&null!==(o=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(i=N())&&(58===g.charCodeAt(y)?(a=":",y++):(a=null,_('":"')),null!==a)&&null!==(u=N())&&(58===g.charCodeAt(y)?(l=":",y++):(l=null,_('":"')),null!==l)&&null!==(c=I())?e=[e,t,r,n,o,s,i,a,u,l,c]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&("::"===g.substr(y,2)?(r="::",y+=2):(r=null,_('"::"')),null!==r)&&null!==(n=N())&&(58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=N())&&(58===g.charCodeAt(y)?(u=":",y++):(u=null,_('":"')),null!==u)&&null!==(l=I())?e=[e,t,r,n,o,s,i,a,u,l]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&("::"===g.substr(y,2)?(n="::",y+=2):(n=null,_('"::"')),null!==n)&&null!==(o=N())&&(58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s)&&null!==(i=N())&&(58===g.charCodeAt(y)?(a=":",y++):(a=null,_('":"')),null!==a)&&null!==(u=I())?e=[e,t,r,n,o,s,i,a,u]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&("::"===g.substr(y,2)?(o="::",y+=2):(o=null,_('"::"')),null!==o)&&null!==(s=N())&&(58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i)&&null!==(a=I())?e=[e,t,r,n,o,s,i,a]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&(h=y,58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o&&null!==(s=N())?o=[o,s]:(o=null,y=h),null!==(o=null!==o?o:""))&&("::"===g.substr(y,2)?(s="::",y+=2):(s=null,_('"::"')),null!==s)&&null!==(i=I())?e=[e,t,r,n,o,s,i]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&(h=y,58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o&&null!==(s=N())?o=[o,s]:(o=null,y=h),null!==(o=null!==o?o:""))&&(h=y,58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s&&null!==(i=N())?s=[s,i]:(s=null,y=h),null!==(s=null!==s?s:""))&&("::"===g.substr(y,2)?(i="::",y+=2):(i=null,_('"::"')),null!==i)&&null!==(a=N())?e=[e,t,r,n,o,s,i,a]:(e=null,y=m),null===e)&&(m=y,null!==(e=N())&&(h=y,58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t&&null!==(r=N())?t=[t,r]:(t=null,y=h),null!==(t=null!==t?t:""))&&(h=y,58===g.charCodeAt(y)?(r=":",y++):(r=null,_('":"')),null!==r&&null!==(n=N())?r=[r,n]:(r=null,y=h),null!==(r=null!==r?r:""))&&(h=y,58===g.charCodeAt(y)?(n=":",y++):(n=null,_('":"')),null!==n&&null!==(o=N())?n=[n,o]:(n=null,y=h),null!==(n=null!==n?n:""))&&(h=y,58===g.charCodeAt(y)?(o=":",y++):(o=null,_('":"')),null!==o&&null!==(s=N())?o=[o,s]:(o=null,y=h),null!==(o=null!==o?o:""))&&(h=y,58===g.charCodeAt(y)?(s=":",y++):(s=null,_('":"')),null!==s&&null!==(i=N())?s=[s,i]:(s=null,y=h),null!==(s=null!==s?s:""))&&(h=y,58===g.charCodeAt(y)?(i=":",y++):(i=null,_('":"')),null!==i&&null!==(a=N())?i=[i,a]:(i=null,y=h),null!==(i=null!==i?i:""))&&("::"===g.substr(y,2)?(a="::",y+=2):(a=null,_('"::"')),null!==a)?e=[e,t,r,n,o,s,i,a]:(e=null,y=m)),null!==e&&(d=f,D.host_type="IPv6",e=g.substring(y,d)),null===e&&(y=f),e}function N(){var e,t,r,n,o=y;return null!==(e=a())&&null!==(t=null!==(t=a())?t:"")&&null!==(r=null!==(r=a())?r:"")&&null!==(n=null!==(n=a())?n:"")?e=[e,t,r,n]:(e=null,y=o),e}function I(){var e,t,r,n=y;return null!==(e=N())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=N())?e=[e,t,r]:(e=null,y=n),e=null===e?be():e}function be(){var e,t,r,n,o,s,i,a=y,u=y;return null!==(e=Se())&&(46===g.charCodeAt(y)?(i=".",y++):(i=null,_('"."')),null!==i)&&null!==(t=Se())&&(46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')),null!==r)&&null!==(n=Se())&&(46===g.charCodeAt(y)?(o=".",y++):(o=null,_('"."')),null!==o)&&null!==(s=Se())?e=[e,i,t,r,n,o,s]:(e=null,y=u),null!==e&&(i=a,D.host_type="IPv4",e=g.substring(y,i)),null===e&&(y=a),e}function Se(){var e,t,r,n=y;return"25"===g.substr(y,2)?(e="25",y+=2):(e=null,_('"25"')),null!==e&&(/^[0-5]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[0-5]")),null!==t)?e=[e,t]:(e=null,y=n),e=null===e&&(n=y,50===g.charCodeAt(y)?(e="2",y++):(e=null,_('"2"')),null!==e&&(/^[0-4]/.test(g.charAt(y))?(t=g.charAt(y),y++):(t=null,_("[0-4]")),null!==t)&&null!==(r=l())?e=[e,t,r]:(e=null,y=n),null===e)&&(n=y,49===g.charCodeAt(y)?(e="1",y++):(e=null,_('"1"')),null!==e&&null!==(t=l())&&null!==(r=l())?e=[e,t,r]:(e=null,y=n),null===e)&&(n=y,/^[1-9]/.test(g.charAt(y))?(e=g.charAt(y),y++):(e=null,_("[1-9]")),null!==e&&null!==(t=l())?e=[e,t]:(e=null,y=n),null===e)?l():e}function Te(){var e,t,r,n,o,s=y,i=y;return null!==(e=null!==(e=l())?e:"")&&null!==(o=null!==(o=l())?o:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")?e=[e,o,t,r,n]:(e=null,y=i),null!==e&&(o=e,o=parseInt(o.join("")),e=D.port=o),null===e&&(y=s),e}function we(){var e,t,r=[],n=y;for(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Ee())?e=[e,t]:(e=null,y=n);null!==e;)r.push(e),n=y,59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Ee())?e=[e,t]:(e=null,y=n);return r}function Ee(){var e;return e=null===(e=Ae())&&null===(e=Oe())&&null===(e=xe())&&null===(e=Ce())&&null===(e=Re())&&null===(e=Ne())?Ie():e}function Ae(){var e,t,r=y,n=y;return"transport="===g.substr(y,10).toLowerCase()?(e=g.substr(y,10),y+=10):(e=null,_('"transport="')),null!==e&&("udp"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"udp"')),null!==(t=null===t&&("tcp"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"tcp"')),null===t)&&("sctp"===g.substr(y,4).toLowerCase()?(t=g.substr(y,4),y+=4):(t=null,_('"sctp"')),null===t)&&("tls"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"tls"')),null===t)?w():t))?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],D.uri_params||(D.uri_params={}),e=void(D.uri_params.transport=t.toLowerCase())),null===e&&(y=r),e}function Oe(){var e,t,r=y,n=y;return"user="===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"user="')),null!==e&&("phone"===g.substr(y,5).toLowerCase()?(t=g.substr(y,5),y+=5):(t=null,_('"phone"')),null!==(t=null===t&&("ip"===g.substr(y,2).toLowerCase()?(t=g.substr(y,2),y+=2):(t=null,_('"ip"')),null===t)?w():t))?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],D.uri_params||(D.uri_params={}),e=void(D.uri_params.user=t.toLowerCase())),null===e&&(y=r),e}function xe(){var e,t,r=y,n=y;return"method="===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"method="')),null!==e&&null!==(t=mt())?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],D.uri_params||(D.uri_params={}),e=void(D.uri_params.method=t)),null===e&&(y=r),e}function Ce(){var e,t,r=y,n=y;return"ttl="===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"ttl="')),null!==e&&null!==(t=Or())?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],D.params||(D.params={}),e=void(D.params.ttl=t)),null===e&&(y=r),e}function Re(){var e,t,r=y,n=y;return"maddr="===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"maddr="')),null!==e&&null!==(t=fe())?e=[e,t]:(e=null,y=n),null!==e&&(t=e[1],D.uri_params||(D.uri_params={}),e=void(D.uri_params.maddr=t)),null===e&&(y=r),e}function Ne(){var e,t,r,n,o=y,s=y;return"lr"===g.substr(y,2).toLowerCase()?(e=g.substr(y,2),y+=2):(e=null,_('"lr"')),null!==e&&(n=y,61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t&&null!==(r=w())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null!==e&&(D.uri_params||(D.uri_params={}),e=void(D.uri_params.lr=void 0)),null===e&&(y=o),e}function Ie(){var e,t,r,n,o=y,s=y;return null!==(e=Le())&&(n=y,61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t&&null!==(r=ke())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null!==e&&(r=e[0],n=e[1],D.uri_params||(D.uri_params={}),n=void 0===n?void 0:n[1],e=void(D.uri_params[r.toLowerCase()]=n)),null===e&&(y=o),e}function Le(){var e,t,r=y;if(null!==(t=Pe()))for(e=[];null!==t;)e.push(t),t=Pe();else e=null;return null===(e=null!==e?e.join(""):e)&&(y=r),e}function ke(){var e,t,r=y;if(null!==(t=Pe()))for(e=[];null!==t;)e.push(t),t=Pe();else e=null;return null===(e=null!==e?e.join(""):e)&&(y=r),e}function Pe(){var e;return e=null===(e=Ue())&&null===(e=n())?f():e}function Ue(){var e;return 91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null===e&&(93===g.charCodeAt(y)?(e="]",y++):(e=null,_('"]"')),null===e)&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"'))),e}function je(){var e,t,r,n,o,s,i=y;if(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null!==e)if(null!==(t=De())){for(r=[],s=y,38===g.charCodeAt(y)?(n="&",y++):(n=null,_('"&"')),null!==n&&null!==(o=De())?n=[n,o]:(n=null,y=s);null!==n;)r.push(n),s=y,38===g.charCodeAt(y)?(n="&",y++):(n=null,_('"&"')),null!==n&&null!==(o=De())?n=[n,o]:(n=null,y=s);null!==r?e=[e,t,r]:(e=null,y=i)}else e=null,y=i;else e=null,y=i;return e}function De(){var e,t,r,n=y,o=y;return null!==(e=Me())&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null!==t)&&null!==(r=Ve())?e=[e,t,r]:(e=null,y=o),null!==e&&(t=e[0],r=e[2],t=t.join("").toLowerCase(),r=r.join(""),D.uri_headers||(D.uri_headers={}),e=void(D.uri_headers[t]?D.uri_headers[t].push(r):D.uri_headers[t]=[r])),null===e&&(y=n),e}function Me(){var e,t;if(null!==(t=null===(t=Be())&&null===(t=n())?f():t))for(e=[];null!==t;)e.push(t),null===(t=Be())&&null===(t=n())&&(t=f());else e=null;return e}function Ve(){var e,t=[];for(null===(e=Be())&&null===(e=n())&&(e=f());null!==e;)t.push(e),null===(e=Be())&&null===(e=n())&&(e=f());return t}function Be(){var e;return 91===g.charCodeAt(y)?(e="[",y++):(e=null,_('"["')),null===e&&(93===g.charCodeAt(y)?(e="]",y++):(e=null,_('"]"')),null===e)&&(47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"'))),e}function Fe(){var e,t,r,n,o,s=y;return null!==(e=mt())&&null!==(t=h())&&null!==(r=He())&&null!==(n=h())&&null!==(o=st())?e=[e,t,r,n,o]:(e=null,y=s),e}function He(){var e;return e=null===(e=se())?qe():e}function qe(){var e,t,r,n=y;return null!==(e=et())&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null!==t)&&null!==(r=null===(r=Ke())?Ye():r)?e=[e,t,r]:(e=null,y=n),e}function Ke(){var e,t,r,n,o=y;return null!==(e=null===(e=Ge())?ze():e)&&(n=y,63===g.charCodeAt(y)?(t="?",y++):(t=null,_('"?"')),null!==t&&null!==(r=ot())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function Ge(){var e,t,r,n=y;return"//"===g.substr(y,2)?(e="//",y+=2):(e=null,_('"//"')),null!==e&&null!==(t=tt())&&null!==(r=null!==(r=ze())?r:"")?e=[e,t,r]:(e=null,y=n),e}function ze(){var e,t,r=y;return 47===g.charCodeAt(y)?(e="/",y++):(e=null,_('"/"')),null!==e&&null!==(t=Je())?e=[e,t]:(e=null,y=r),e}function Ye(){var e,t,r,n=y;if(null!==(e=Xe())){for(t=[],r=We();null!==r;)t.push(r),r=We();null!==t?e=[e,t]:(e=null,y=n)}else e=null,y=n;return e}function We(){var e;return e=null===(e=F())&&null===(e=n())?f():e}function Xe(){var e;return null===(e=n())&&null===(e=f())&&(59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null===e)&&(63===g.charCodeAt(y)?(e="?",y++):(e=null,_('"?"')),null===e)&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","'))),e}function Je(){var e,t,r,n,o,s=y;if(null!==(e=$e())){for(t=[],o=y,47===g.charCodeAt(y)?(r="/",y++):(r=null,_('"/"')),null!==r&&null!==(n=$e())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,47===g.charCodeAt(y)?(r="/",y++):(r=null,_('"/"')),null!==r&&null!==(n=$e())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e}function $e(){for(var e,t,r,n=y,o=[],s=Ze();null!==s;)o.push(s),s=Ze();if(null!==o){for(s=[],r=y,59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Qe())?e=[e,t]:(e=null,y=r);null!==e;)s.push(e),r=y,59===g.charCodeAt(y)?(e=";",y++):(e=null,_('";"')),null!==e&&null!==(t=Qe())?e=[e,t]:(e=null,y=r);null!==s?o=[o,s]:(o=null,y=n)}else o=null,y=n;return o}function Qe(){for(var e=[],t=Ze();null!==t;)e.push(t),t=Ze();return e}function Ze(){var e;return null===(e=n())&&null===(e=f())&&(58===g.charCodeAt(y)?(e=":",y++):(e=null,_('":"')),null===e)&&(64===g.charCodeAt(y)?(e="@",y++):(e=null,_('"@"')),null===e)&&(38===g.charCodeAt(y)?(e="&",y++):(e=null,_('"&"')),null===e)&&(61===g.charCodeAt(y)?(e="=",y++):(e=null,_('"="')),null===e)&&(43===g.charCodeAt(y)?(e="+",y++):(e=null,_('"+"')),null===e)&&(36===g.charCodeAt(y)?(e="$",y++):(e=null,_('"$"')),null===e)&&(44===g.charCodeAt(y)?(e=",",y++):(e=null,_('","'))),e}function et(){var e,t,r,n=y,o=y;if(null!==(e=i())){for(t=[],null===(r=i())&&null===(r=l())&&(43===g.charCodeAt(y)?(r="+",y++):(r=null,_('"+"')),null===r)&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')));null!==r;)t.push(r),null===(r=i())&&null===(r=l())&&(43===g.charCodeAt(y)?(r="+",y++):(r=null,_('"+"')),null===r)&&(45===g.charCodeAt(y)?(r="-",y++):(r=null,_('"-"')),null===r)&&(46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')));null!==t?e=[e,t]:(e=null,y=o)}else e=null,y=o;return null===(e=null!==e?void(D.scheme=g.substring(y,n)):e)&&(y=n),e}function tt(){var e;return e=null===(e=rt())?nt():e}function rt(){var e,t,r=y,n=y;return null!==(e=le())&&(64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null!==t)?e=[e,t]:(e=null,y=n),null!==(e=null!==e?e:"")&&null!==(t=de())?e=[e,t]:(e=null,y=r),null!==e?e:""}function nt(){var e,t;if(null===(t=n())&&null===(t=f())&&(36===g.charCodeAt(y)?(t="$",y++):(t=null,_('"$"')),null===t)&&(44===g.charCodeAt(y)?(t=",",y++):(t=null,_('","')),null===t)&&(59===g.charCodeAt(y)?(t=";",y++):(t=null,_('";"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null===t)&&(38===g.charCodeAt(y)?(t="&",y++):(t=null,_('"&"')),null===t)&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"'))),null!==t)for(e=[];null!==t;)e.push(t),null===(t=n())&&null===(t=f())&&(36===g.charCodeAt(y)?(t="$",y++):(t=null,_('"$"')),null===t)&&(44===g.charCodeAt(y)?(t=",",y++):(t=null,_('","')),null===t)&&(59===g.charCodeAt(y)?(t=";",y++):(t=null,_('";"')),null===t)&&(58===g.charCodeAt(y)?(t=":",y++):(t=null,_('":"')),null===t)&&(64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null===t)&&(38===g.charCodeAt(y)?(t="&",y++):(t=null,_('"&"')),null===t)&&(61===g.charCodeAt(y)?(t="=",y++):(t=null,_('"="')),null===t)&&(43===g.charCodeAt(y)?(t="+",y++):(t=null,_('"+"')));else e=null;return e}function ot(){for(var e=[],t=We();null!==t;)e.push(t),t=We();return e}function st(){var e,t,r,n,o,s,i=y,a=y;if("sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"SIP"')),null!==e)if(47===g.charCodeAt(y)?(t="/",y++):(t=null,_('"/"')),null!==t){if(null!==(n=l()))for(r=[];null!==n;)r.push(n),n=l();else r=null;if(null!==r)if(46===g.charCodeAt(y)?(n=".",y++):(n=null,_('"."')),null!==n){if(null!==(s=l()))for(o=[];null!==s;)o.push(s),s=l();else o=null;null!==o?e=[e,t,r,n,o]:(e=null,y=a)}else e=null,y=a;else e=null,y=a}else e=null,y=a;else e=null,y=a;return null===(e=null!==e?void(D.sip_version=g.substring(y,i)):e)&&(y=i),e}function it(){var e;return"INVITE"===g.substr(y,6)?(e="INVITE",y+=6):(e=null,_('"INVITE"')),e}function at(){var e;return"ACK"===g.substr(y,3)?(e="ACK",y+=3):(e=null,_('"ACK"')),e}function ut(){var e;return"OPTIONS"===g.substr(y,7)?(e="OPTIONS",y+=7):(e=null,_('"OPTIONS"')),e}function lt(){var e;return"BYE"===g.substr(y,3)?(e="BYE",y+=3):(e=null,_('"BYE"')),e}function ct(){var e;return"CANCEL"===g.substr(y,6)?(e="CANCEL",y+=6):(e=null,_('"CANCEL"')),e}function pt(){var e;return"REGISTER"===g.substr(y,8)?(e="REGISTER",y+=8):(e=null,_('"REGISTER"')),e}function ht(){var e;return"SUBSCRIBE"===g.substr(y,9)?(e="SUBSCRIBE",y+=9):(e=null,_('"SUBSCRIBE"')),e}function dt(){var e;return"NOTIFY"===g.substr(y,6)?(e="NOTIFY",y+=6):(e=null,_('"NOTIFY"')),e}function ft(){var e;return"REFER"===g.substr(y,5)?(e="REFER",y+=5):(e=null,_('"REFER"')),e}function mt(){var e,t=y;return null!==(e=null===(e=it())&&null===(e=at())&&null===(e=ut())&&null===(e=lt())&&null===(e=ct())&&null===(e=pt())&&null===(e=ht())&&null===(e=dt())&&null===(e=ft())?w():e)&&(D.method=g.substring(y,t),e=D.method),null===e&&(y=t),e}function gt(){var e,t,r,n,o,s=y;return null!==(e=st())&&null!==(t=h())&&null!==(r=yt())&&null!==(n=h())&&null!==(o=vt())?e=[e,t,r,n,o]:(e=null,y=s),e}function yt(){var e,t,r=y;return null!==(e=_t())&&(t=e,e=void(D.status_code=parseInt(t.join("")))),null===e&&(y=r),e}function _t(){var e,t,r,n=y;return null!==(e=l())&&null!==(t=l())&&null!==(r=l())?e=[e,t,r]:(e=null,y=n),e}function vt(){var e,t=y,r=[];for(null===(e=F())&&null===(e=n())&&null===(e=f())&&null===(e=S())&&null===(e=T())&&null===(e=h())&&(e=d());null!==e;)r.push(e),null===(e=F())&&null===(e=n())&&null===(e=f())&&null===(e=S())&&null===(e=T())&&null===(e=h())&&(e=d());return null===(r=null!==r?void(D.reason_phrase=g.substring(y,t)):r)&&(y=t),r}function bt(){var e,t,r,n,o,s=y,i=y;if(null!==(e=null===(e=oe())?L():e)){for(t=[],o=y,null!==(r=x())&&null!==(n=Tt())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=Tt())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(e=>{var t;D.multi_header||(D.multi_header=[]);try{t=new j(D.uri,D.display_name,D.params),delete D.uri,delete D.display_name,delete D.params}catch(e){t=null}D.multi_header.push({possition:y,offset:e,parsed:t})})(s):e)&&(y=s),e}function L(){var e,t,r,n,o=y;return null!==(e=null!==(e=St())?e:"")&&null!==(t=$())&&null!==(r=se())&&null!==(n=J())?e=[e,t,r,n]:(e=null,y=o),e}function St(){var e,t,r,n,o,s=y,i=y;if(null!==(e=w())){for(t=[],o=y,null!==(r=m())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=m())&&null!==(n=w())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null!==(e=null===e?C():e)&&(i=e,e=void(D.display_name="string"==typeof i?i:i[1].reduce(function(e,t){return e+t[0]+t[1]},i[0]))),null===e&&(y=s),e}function Tt(){var e;return e=null===(e=wt())&&null===(e=Et())?P():e}function wt(){var e,t,r,n=y,o=y;return"q"===g.substr(y,1).toLowerCase()?(e=g.substr(y,1),y++):(e=null,_('"q"')),null!==e&&null!==(r=A())&&null!==(t=At())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],D.params||(D.params={}),e=void(D.params.q=r)),null===e&&(y=n),e}function Et(){var e,t,r,n=y,o=y;return"expires"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"expires"')),null!==e&&null!==(r=A())&&null!==(t=k())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],D.params||(D.params={}),e=void(D.params.expires=r)),null===e&&(y=n),e}function k(){var e,t,r=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null===(e=null!==e?parseInt(e.join("")):e)&&(y=r),e}function At(){var e,t,r,n,o,s,i=y,a=y;return 48===g.charCodeAt(y)?(e="0",y++):(e=null,_('"0"')),null!==e&&(s=y,46===g.charCodeAt(y)?(t=".",y++):(t=null,_('"."')),null!==t&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")&&null!==(o=null!==(o=l())?o:"")?t=[t,r,n,o]:(t=null,y=s),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=a),null===(e=null!==e?parseFloat(g.substring(y,i)):e)&&(y=i),e}function P(){var e,t,r,n,o=y,s=y;return null!==(e=w())&&(n=y,null!==(t=A())&&null!==(r=Ot())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null!==e&&(r=e[0],n=e[1],D.params||(D.params={}),n=void 0===n?void 0:n[1],e=void(D.params[r.toLowerCase()]=n)),null===e&&(y=o),e}function Ot(){var e;return e=null===(e=w())&&null===(e=fe())?re():e}function xt(){var e;return"render"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"render"')),e=null===e&&("session"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"session"')),null===e)&&("icon"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"icon"')),null===e)&&("alert"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"alert"')),null===e)?w():e}function Ct(){var e;return e=null===(e=Rt())?P():e}function Rt(){var e,t,r,n=y;return"handling"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"handling"')),null!==e&&null!==(t=A())&&("optional"===g.substr(y,8).toLowerCase()?(r=g.substr(y,8),y+=8):(r=null,_('"optional"')),null!==(r=null===r&&("required"===g.substr(y,8).toLowerCase()?(r=g.substr(y,8),y+=8):(r=null,_('"required"')),null===r)?w():r))?e=[e,t,r]:(e=null,y=n),e}function Nt(){var e,t,r,n,o,s,i,a=y;if(null!==(e=It()))if(null!==(t=Y()))if(null!==(r=jt())){for(n=[],i=y,null!==(o=x())&&null!==(s=Dt())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=x())&&null!==(s=Dt())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e}function It(){var e;return e=null===(e=Lt())?kt():e}function Lt(){var e;return"text"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"text"')),e=null===e&&("image"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"image"')),null===e)&&("audio"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"audio"')),null===e)&&("video"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"video"')),null===e)&&("application"===g.substr(y,11).toLowerCase()?(e=g.substr(y,11),y+=11):(e=null,_('"application"')),null===e)?Pt():e}function kt(){var e;return"message"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"message"')),e=null===e&&("multipart"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"multipart"')),null===e)?Pt():e}function Pt(){var e;return e=null===(e=w())?Ut():e}function Ut(){var e,t,r=y;return"x-"===g.substr(y,2).toLowerCase()?(e=g.substr(y,2),y+=2):(e=null,_('"x-"')),null!==e&&null!==(t=w())?e=[e,t]:(e=null,y=r),e}function jt(){var e;return e=null===(e=Pt())?w():e}function Dt(){var e,t,r,n=y;return null!==(e=w())&&null!==(t=A())&&null!==(r=Mt())?e=[e,t,r]:(e=null,y=n),e}function Mt(){var e;return e=null===(e=w())?re():e}function Vt(){var e,t,r,n=y;if(null!==(t=l()))for(e=[];null!==t;)e.push(t),t=l();else e=null;return null!==e&&(r=e,e=void(D.value=parseInt(r.join("")))),null===e&&(y=n),e}function Bt(){var e,t,r,n,o,s=y;if(null!==(e=G())){for(t=[],o=y,46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')),null!==r&&null!==(n=G())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,46===g.charCodeAt(y)?(r=".",y++):(r=null,_('"."')),null!==r&&null!==(n=G())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e}function Ft(){var e;return e=null===(e=Ht())?P():e}function Ht(){var e,t,r,n=y,o=y;return"tag"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"tag"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(D.tag=r)),null===e&&(y=n),e}function qt(){var e,t,r,n,o,s,i,a=y;if("digest"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"Digest"')),null!==e)if(null!==(t=m()))if(null!==(r=zt())){for(n=[],i=y,null!==(o=O())&&null!==(s=zt())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=O())&&null!==(s=zt())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e=null===e?Kt():e}function Kt(){var e,t,r,n,o,s,i,a=y;if(null!==(e=w()))if(null!==(t=m()))if(null!==(r=Gt())){for(n=[],i=y,null!==(o=O())&&null!==(s=Gt())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=O())&&null!==(s=Gt())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e}function Gt(){var e,t,r,n=y;return null!==(e=w())&&null!==(t=A())&&null!==(r=null===(r=w())?re():r)?e=[e,t,r]:(e=null,y=n),e}function zt(){var e;return e=null===(e=Yt())&&null===(e=Xt())&&null===(e=$t())&&null===(e=Zt())&&null===(e=er())&&null===(e=tr())&&null===(e=rr())?Gt():e}function Yt(){var e,t,r,n=y;return"realm"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"realm"')),null!==e&&null!==(t=A())&&null!==(r=Wt())?e=[e,t,r]:(e=null,y=n),e}function Wt(){var e,t,r=y;return null!==(e=C())&&(t=e,e=void(D.realm=t)),null===e&&(y=r),e}function Xt(){var e,t,r,n,o,s,i,a,u=y;if("domain"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"domain"')),null!==e)if(null!==(t=A()))if(null!==(r=Z()))if(null!==(n=Jt())){if(o=[],a=y,null!==(i=h()))for(s=[];null!==i;)s.push(i),i=h();else s=null;for(null!==s&&null!==(i=Jt())?s=[s,i]:(s=null,y=a);null!==s;){if(o.push(s),a=y,null!==(i=h()))for(s=[];null!==i;)s.push(i),i=h();else s=null;null!==s&&null!==(i=Jt())?s=[s,i]:(s=null,y=a)}null!==o&&null!==(s=ee())?e=[e,t,r,n,o,s]:(e=null,y=u)}else e=null,y=u;else e=null,y=u;else e=null,y=u;else e=null,y=u;return e}function Jt(){var e;return e=null===(e=qe())?ze():e}function $t(){var e,t,r,n=y;return"nonce"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"nonce"')),null!==e&&null!==(t=A())&&null!==(r=Qt())?e=[e,t,r]:(e=null,y=n),e}function Qt(){var e,t,r=y;return null!==(e=C())&&(t=e,e=void(D.nonce=t)),null===e&&(y=r),e}function Zt(){var e,t,r,n=y,o=y;return"opaque"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"opaque"')),null!==e&&null!==(r=A())&&null!==(t=C())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(D.opaque=r)),null===e&&(y=n),e}function er(){var e,t,r,n,o=y;return"stale"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"stale"')),null!==e&&null!==(t=A())&&(n=y,"true"===g.substr(y,4).toLowerCase()?(r=g.substr(y,4),y+=4):(r=null,_('"true"')),null===(r=null!==r?void(D.stale=!0):r)&&(y=n),null===r&&(n=y,"false"===g.substr(y,5).toLowerCase()?(r=g.substr(y,5),y+=5):(r=null,_('"false"')),null===(r=null!==r?void(D.stale=!1):r))&&(y=n),null!==r)?e=[e,t,r]:(e=null,y=o),e}function tr(){var e,t,r,n=y,o=y;return"algorithm"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"algorithm"')),null!==e&&null!==(r=A())&&("md5"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"MD5"')),null!==(t=null===t&&("md5-sess"===g.substr(y,8).toLowerCase()?(t=g.substr(y,8),y+=8):(t=null,_('"MD5-sess"')),null===t)?w():t))?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(D.algorithm=r.toUpperCase())),null===e&&(y=n),e}function rr(){var e,t,r,n,o,s,i,a,u,l=y;if("qop"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"qop"')),null!==e)if(null!==(t=A()))if(null!==(r=Z())){if(a=y,null!==(n=nr())){for(o=[],u=y,44===g.charCodeAt(y)?(s=",",y++):(s=null,_('","')),null!==s&&null!==(i=nr())?s=[s,i]:(s=null,y=u);null!==s;)o.push(s),u=y,44===g.charCodeAt(y)?(s=",",y++):(s=null,_('","')),null!==s&&null!==(i=nr())?s=[s,i]:(s=null,y=u);null!==o?n=[n,o]:(n=null,y=a)}else n=null,y=a;null!==n&&null!==(o=ee())?e=[e,t,r,n,o]:(e=null,y=l)}else e=null,y=l;else e=null,y=l;else e=null,y=l;return e}function nr(){var e,t,r=y;return"auth-int"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"auth-int"')),null!==(e=null===e&&("auth"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"auth"')),null===e)?w():e)&&(t=e,D.qop||(D.qop=[]),e=void D.qop.push(t.toLowerCase())),null===e&&(y=r),e}function or(){var e,t,r,n,o,s=y,i=y;if(null!==(e=L())){for(t=[],o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=i)}else e=null,y=i;return null===(e=null!==e?(e=>{var t;D.multi_header||(D.multi_header=[]);try{t=new j(D.uri,D.display_name,D.params),delete D.uri,delete D.display_name,delete D.params}catch(e){t=null}D.multi_header.push({possition:y,offset:e,parsed:t})})(s):e)&&(y=s),e}function sr(){var e;return e=null===(e=ir())?P():e}function ir(){var e,t,r,n,o=y,s=y;if("cause"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"cause"')),null!==e)if(null!==(n=A())){if(null!==(r=l()))for(t=[];null!==r;)t.push(r),r=l();else t=null;null!==t?e=[e,n,t]:(e=null,y=s)}else e=null,y=s;else e=null,y=s;return null!==e&&(n=e[2],e=void(D.cause=parseInt(n.join("")))),null===e&&(y=o),e}function ar(){var e,t,r,n,o,s=y;if(null!==(e=L())){for(t=[],o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==r;)t.push(r),o=y,null!==(r=x())&&null!==(n=P())?r=[r,n]:(r=null,y=o);null!==t?e=[e,t]:(e=null,y=s)}else e=null,y=s;return e}function ur(){var e,t=y;return"active"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"active"')),null===(e=null!==(e=null===e&&("pending"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"pending"')),null===e)&&("terminated"===g.substr(y,10).toLowerCase()?(e=g.substr(y,10),y+=10):(e=null,_('"terminated"')),null===e)?w():e)?void(D.state=g.substring(y,t)):e)&&(y=t),e}function lr(){var e,t,r,n,o=y,s=y;return"reason"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"reason"')),null!==e&&null!==(t=A())&&null!==(r=cr())?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(void 0!==(n=e[2])&&(D.reason=n)):e)&&(y=o),e=null===e&&(s=o=y,"expires"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"expires"')),null!==e&&null!==(t=A())&&null!==(r=k())?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(void 0!==(n=e[2])&&(D.expires=n)):e)&&(y=o),null===e)&&(s=o=y,"retry_after"===g.substr(y,11).toLowerCase()?(e=g.substr(y,11),y+=11):(e=null,_('"retry_after"')),null!==e&&null!==(t=A())&&null!==(r=k())?e=[e,t,r]:(e=null,y=s),null===(e=null!==e?void(void 0!==(n=e[2])&&(D.retry_after=n)):e)&&(y=o),null===e)?P():e}function cr(){var e;return"deactivated"===g.substr(y,11).toLowerCase()?(e=g.substr(y,11),y+=11):(e=null,_('"deactivated"')),e=null===e&&("probation"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"probation"')),null===e)&&("rejected"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"rejected"')),null===e)&&("timeout"===g.substr(y,7).toLowerCase()?(e=g.substr(y,7),y+=7):(e=null,_('"timeout"')),null===e)&&("giveup"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"giveup"')),null===e)&&("noresource"===g.substr(y,10).toLowerCase()?(e=g.substr(y,10),y+=10):(e=null,_('"noresource"')),null===e)&&("invariant"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"invariant"')),null===e)?w():e}function pr(){var e;return e=null===(e=Ht())?P():e}function hr(){var e,t,r,n,o,s,i,a=y;if(null!==(e=br()))if(null!==(t=m()))if(null!==(r=wr())){for(n=[],i=y,null!==(o=x())&&null!==(s=dr())?o=[o,s]:(o=null,y=i);null!==o;)n.push(o),i=y,null!==(o=x())&&null!==(s=dr())?o=[o,s]:(o=null,y=i);null!==n?e=[e,t,r,n]:(e=null,y=a)}else e=null,y=a;else e=null,y=a;else e=null,y=a;return e}function dr(){var e;return e=null===(e=fr())&&null===(e=mr())&&null===(e=gr())&&null===(e=yr())&&null===(e=_r())?P():e}function fr(){var e,t,r,n=y,o=y;return"ttl"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"ttl"')),null!==e&&null!==(r=A())&&null!==(t=Or())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(D.ttl=r)),null===e&&(y=n),e}function mr(){var e,t,r,n=y,o=y;return"maddr"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"maddr"')),null!==e&&null!==(r=A())&&null!==(t=fe())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(D.maddr=r)),null===e&&(y=n),e}function gr(){var e,t,r,n=y,o=y;return"received"===g.substr(y,8).toLowerCase()?(e=g.substr(y,8),y+=8):(e=null,_('"received"')),null!==e&&null!==(r=A())&&null!==(t=null===(t=be())?ve():t)?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(D.received=r)),null===e&&(y=n),e}function yr(){var e,t,r,n=y,o=y;return"branch"===g.substr(y,6).toLowerCase()?(e=g.substr(y,6),y+=6):(e=null,_('"branch"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(D.branch=r)),null===e&&(y=n),e}function _r(){var e,t,r,n,o=y;return"rport"===g.substr(y,5).toLowerCase()?(e=g.substr(y,5),y+=5):(e=null,_('"rport"')),null!==e&&(n=y,null!==(t=A())&&null!==(r=vr())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function vr(){var e,t,r,n,o,s=y,i=y;return null!==(e=null!==(e=l())?e:"")&&null!==(o=null!==(o=l())?o:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")?e=[e,o,t,r,n]:(e=null,y=i),null!==e&&(o=e,e=void(D.rport=parseInt(o.join("")))),null===e&&(y=s),e}function br(){var e,t,r,n,o,s=y;return null!==(e=Sr())&&null!==(t=Y())&&null!==(r=w())&&null!==(n=Y())&&null!==(o=Tr())?e=[e,t,r,n,o]:(e=null,y=s),e}function Sr(){var e,t,r=y;return"sip"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"SIP"')),null!==(e=null===e?w():e)&&(t=e,e=void(D.protocol=t)),null===e&&(y=r),e}function Tr(){var e,t,r=y;return"udp"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"UDP"')),null!==(e=null===e&&("tcp"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"TCP"')),null===e)&&("tls"===g.substr(y,3).toLowerCase()?(e=g.substr(y,3),y+=3):(e=null,_('"TLS"')),null===e)&&("sctp"===g.substr(y,4).toLowerCase()?(e=g.substr(y,4),y+=4):(e=null,_('"SCTP"')),null===e)?w():e)&&(t=e,e=void(D.transport=t)),null===e&&(y=r),e}function wr(){var e,t,r,n,o=y;return null!==(e=Er())&&(n=y,null!==(t=Q())&&null!==(r=Ar())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=o),e}function Er(){var e,t=y;return null===(e=null!==(e=null===(e=be())&&null===(e=_e())?me():e)?void(D.host=g.substring(y,t)):e)&&(y=t),e}function Ar(){var e,t,r,n,o,s=y,i=y;return null!==(e=null!==(e=l())?e:"")&&null!==(o=null!==(o=l())?o:"")&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")&&null!==(n=null!==(n=l())?n:"")?e=[e,o,t,r,n]:(e=null,y=i),null!==e&&(o=e,e=void(D.port=parseInt(o.join("")))),null===e&&(y=s),e}function Or(){var e,t,r,n=y,o=y;return null!==(e=l())&&null!==(t=null!==(t=l())?t:"")&&null!==(r=null!==(r=l())?r:"")?e=[e,t,r]:(e=null,y=o),null===(e=null!==e?parseInt(e.join("")):e)&&(y=n),e}function xr(){var e,t,r=y;return null!==(e=k())&&(t=e,e=void(D.expires=t)),null===e&&(y=r),e}function Cr(){var e;return e=null===(e=Rr())?P():e}function Rr(){var e,t,r,n=y,o=y;return"refresher"===g.substr(y,9).toLowerCase()?(e=g.substr(y,9),y+=9):(e=null,_('"refresher"')),null!==e&&null!==(r=A())&&("uac"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"uac"')),null===t&&("uas"===g.substr(y,3).toLowerCase()?(t=g.substr(y,3),y+=3):(t=null,_('"uas"'))),null!==t)?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(D.refresher=r.toLowerCase())),null===e&&(y=n),e}function Nr(){var e,t=[];for(null===(e=b())&&null===(e=T())&&(e=m());null!==e;)t.push(e),null===(e=b())&&null===(e=T())&&(e=m());return t}function Ir(){var e,t,r,n,o,s,i,a,u,l=y,c=y;return null!==(e=Lr())&&(45===g.charCodeAt(y)?(t="-",y++):(t=null,_('"-"')),null!==t)&&null!==(r=U())&&(45===g.charCodeAt(y)?(n="-",y++):(n=null,_('"-"')),null!==n)&&null!==(o=U())&&(45===g.charCodeAt(y)?(s="-",y++):(s=null,_('"-"')),null!==s)&&null!==(i=U())&&(45===g.charCodeAt(y)?(a="-",y++):(a=null,_('"-"')),null!==a)&&null!==(u=kr())?e=[e,t,r,n,o,s,i,a,u]:(e=null,y=c),null!==e&&(e[0],e=void(D=g.substring(y+5,l))),null===e&&(y=l),e}function U(){var e,t,r,n,o=y;return null!==(e=a())&&null!==(t=a())&&null!==(r=a())&&null!==(n=a())?e=[e,t,r,n]:(e=null,y=o),e}function Lr(){var e,t,r=y;return null!==(e=U())&&null!==(t=U())?e=[e,t]:(e=null,y=r),e}function kr(){var e,t,r,n=y;return null!==(e=U())&&null!==(t=U())&&null!==(r=U())?e=[e,t,r]:(e=null,y=n),e}function Pr(){var e,t,r,n,o=y,s=y;return null!==(e=E())&&(n=y,64===g.charCodeAt(y)?(t="@",y++):(t=null,_('"@"')),null!==t&&null!==(r=E())?t=[t,r]:(t=null,y=n),null!==(t=null!==t?t:""))?e=[e,t]:(e=null,y=s),null===(e=null!==e?void(D.call_id=g.substring(y,o)):e)&&(y=o),e}function Ur(){var e;return e=null===(e=jr())&&null===(e=Dr())&&null===(e=Mr())?P():e}function jr(){var e,t,r,n=y,o=y;return"to-tag"===g.substr(y,6)?(e="to-tag",y+=6):(e=null,_('"to-tag"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(D.to_tag=r)),null===e&&(y=n),e}function Dr(){var e,t,r,n=y,o=y;return"from-tag"===g.substr(y,8)?(e="from-tag",y+=8):(e=null,_('"from-tag"')),null!==e&&null!==(r=A())&&null!==(t=w())?e=[e,r,t]:(e=null,y=o),null!==e&&(r=e[2],e=void(D.from_tag=r)),null===e&&(y=n),e}function Mr(){var e,t=y;return"early-only"===g.substr(y,10)?(e="early-only",y+=10):(e=null,_('"early-only"')),null===(e=null!==e?void(D.early_only=!0):e)&&(y=t),e}var Vr,Br,Fr=B(),j=M(),D={};return null===e[u]()||y!==g.length?(Vr=(e=Math.max(y,s))<g.length?g.charAt(e):null,Br=(()=>{for(var e=1,t=1,r=!1,n=0;n<Math.max(y,s);n++)var o=g.charAt(n),r="\n"===o?(r||e++,!(t=1)):"\r"===o||"\u2028"===o||"\u2029"===o?(e++,t=1,!0):(t++,!1);return{line:e,column:t}})(),new this.SyntaxError((e=>{e.sort();for(var t=null,r=[],n=0;n<e.length;n++)e[n]!==t&&(r.push(e[n]),t=e[n]);return r})(t),Vr,e,Br.line,Br.column),-1):D},toSource:function(){return this._source},SyntaxError:function(e,t,r,n,o){this.name="SyntaxError",this.expected=e,this.found=t,this.message=((e,t)=>{var r;switch(e.length){case 0:r="end of input";break;case 1:r=e[0];break;default:r=e.slice(0,e.length-1).join(", ")+" or "+e[e.length-1]}return"Expected "+r+" but "+(t?Hr(t):"end of input")+" found."})(e,t),this.offset=r,this.line=n,this.column=o}}).SyntaxError.prototype=Error.prototype,x=e),x;function Hr(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g,escape)+'"'}var e}function B(){var u,a,t;return N||(N=1,u=s,a=F(),t=V(),R=p(c,[{key:"scheme",get:function(){return this._scheme},set:function(e){this._scheme=e.toLowerCase()}},{key:"user",get:function(){return this._user},set:function(e){this._user=e}},{key:"host",get:function(){return this._host},set:function(e){this._host=e.toLowerCase()}},{key:"port",get:function(){return this._port},set:function(e){this._port=0===e?e:parseInt(e,10)||null}},{key:"setParam",value:function(e,t){e&&(this._parameters[e.toLowerCase()]=null==t?null:t.toString())}},{key:"getParam",value:function(e){if(e)return this._parameters[e.toLowerCase()]}},{key:"hasParam",value:function(e){if(e)return!!this._parameters.hasOwnProperty(e.toLowerCase())}},{key:"deleteParam",value:function(e){var t;if(e=e.toLowerCase(),this._parameters.hasOwnProperty(e))return t=this._parameters[e],delete this._parameters[e],t}},{key:"clearParams",value:function(){this._parameters={}}},{key:"setHeader",value:function(e,t){this._headers[a.headerize(e)]=Array.isArray(t)?t:[t]}},{key:"getHeader",value:function(e){if(e)return this._headers[a.headerize(e)]}},{key:"hasHeader",value:function(e){if(e)return!!this._headers.hasOwnProperty(a.headerize(e))}},{key:"deleteHeader",value:function(e){var t;if(e=a.headerize(e),this._headers.hasOwnProperty(e))return t=this._headers[e],delete this._headers[e],t}},{key:"clearHeaders",value:function(){this._headers={}}},{key:"clone",value:function(){return new c(this._scheme,this._user,this._host,this._port,JSON.parse(JSON.stringify(this._parameters)),JSON.parse(JSON.stringify(this._headers)))}},{key:"toString",value:function(){var e,t,r=[],n="".concat(this._scheme,":");for(e in this._user&&(n+="".concat(a.escapeUser(this._user),"@")),n+=this._host,!this._port&&0!==this._port||(n+=":".concat(this._port)),this._parameters)Object.prototype.hasOwnProperty.call(this._parameters,e)&&(n+=";".concat(e),null!==this._parameters[e])&&(n+="=".concat(this._parameters[e]));for(t in this._headers)if(Object.prototype.hasOwnProperty.call(this._headers,t)){var o,s=d(this._headers[t]);try{for(s.s();!(o=s.n()).done;){var i=o.value;r.push("".concat(t,"=").concat(i))}}catch(r){s.e(r)}finally{s.f()}}return 0<r.length&&(n+="?".concat(r.join("&"))),n}},{key:"toAor",value:function(e){var t="".concat(this._scheme,":");return this._user&&(t+="".concat(a.escapeUser(this._user),"@")),t+=this._host,e&&(this._port||0===this._port)&&(t+=":".concat(this._port)),t}}],[{key:"parse",value:function(e){return-1!==(e=t.parse(e,"SIP_URI"))?e:void 0}}])),R;function c(e,t,r,n){var o,s,i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:{},a=5<arguments.length&&void 0!==arguments[5]?arguments[5]:{};if(l(this,c),!r)throw new TypeError('missing or invalid "host" parameter');for(o in this._parameters={},this._headers={},this._scheme=e||u.SIP,this._user=t,this._host=r,this._port=n,i)Object.prototype.hasOwnProperty.call(i,o)&&this.setParam(o,i[o]);for(s in a)Object.prototype.hasOwnProperty.call(a,s)&&this.setHeader(s,a[s])}}function F(){var i,a,t,u,e,l;return I||(I=1,i=s,a=B(),t=V(),D.str_utf8_length=function(e){return unescape(encodeURIComponent(e)).length},u=D.isFunction=function(e){return void 0!==e&&"[object Function]"===Object.prototype.toString.call(e)},D.isString=function(e){return void 0!==e&&"[object String]"===Object.prototype.toString.call(e)},D.isDecimal=function(e){return!isNaN(e)&&parseFloat(e)===parseInt(e,10)},D.isEmpty=function(e){return null===e||""===e||void 0===e||Array.isArray(e)&&0===e.length||"number"==typeof e&&isNaN(e)},D.hasMethods=function(e){for(var t=arguments.length,r=new Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var o=0,s=r;o<s.length;o++){var i=s[o];if(u(e[i]))return!1}return!0},e=D.createRandomToken=function(e){for(var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:32,r="",n=0;n<e;n++)r+=(Math.random()*t|0).toString(t);return r},D.newTag=function(){return e(10)},D.newUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},D.hostType=function(e){return e&&-1!==(e=t.parse(e,"host"))?e.host_type:void 0},l=D.escapeUser=function(e){return encodeURIComponent(decodeURIComponent(e)).replace(/%3A/gi,":").replace(/%2B/gi,"+").replace(/%3F/gi,"?").replace(/%2F/gi,"/")},D.normalizeTarget=function(e,t){if(e){if(e instanceof a)return e;if("string"==typeof e){var r,n,o=e.split("@");switch(o.length){case 1:if(!t)return;r=e,n=t;break;case 2:r=o[0],n=o[1];break;default:r=o.slice(0,o.length-1).join("@"),n=o[o.length-1]}return r=r.replace(/^(sips?|tel):/i,""),/^[-.()]*\+?[0-9\-.()]+$/.test(r)&&(r=r.replace(/[-.()]/g,"")),e="".concat(i.SIP,":").concat(l(r),"@").concat(n),a.parse(e)||void 0}}},D.headerize=function(e){for(var t={"Call-Id":"Call-ID",Cseq:"CSeq","Www-Authenticate":"WWW-Authenticate"},r=e.toLowerCase().replace(/_/g,"-").split("-"),n="",o=r.length,s=0;s<o;s++)0!==s&&(n+="-"),n+=r[s].charAt(0).toUpperCase()+r[s].substring(1);return n=t[n]?t[n]:n},D.sipErrorCause=function(e){for(var t in i.SIP_ERROR_CAUSES)if(-1!==i.SIP_ERROR_CAUSES[t].indexOf(e))return i.causes[t];return i.causes.SIP_FAILURE_CODE},D.getRandomTestNetIP=function(){return"192.0.2.".concat(Math.floor(254*Math.random()+1))},D.calculateMD5=function(e){function a(e,t){return e<<t|e>>>32-t}function u(e,t){var r=2147483648&e,n=2147483648&t,o=1073741824&e,s=1073741824&t,e=(1073741823&e)+(1073741823&t);return o&s?2147483648^e^r^n:o|s?1073741824&e?3221225472^e^r^n:1073741824^e^r^n:e^r^n}function t(e,t,r,n,o,s,i){return e=u(e,u(u(t&r|~t&n,o),i)),u(a(e,s),t)}function r(e,t,r,n,o,s,i){return e=u(e,u(u(t&n|r&~n,o),i)),u(a(e,s),t)}function n(e,t,r,n,o,s,i){return e=u(e,u(u(t^r^n,o),i)),u(a(e,s),t)}function o(e,t,r,n,o,s,i){return e=u(e,u(u(r^(t|~n),o),i)),u(a(e,s),t)}function s(e){for(var t="",r="",n=0;n<=3;n++)t+=(r="0".concat((e>>>8*n&255).toString(16))).substr(r.length-2,2);return t}for(var i,l,c,p,h=(e=>{for(var t,r=e.length,n=16*(((n=r+8)-n%64)/64+1),o=new Array(n-1),s=0,i=0;i<r;)s=i%4*8,o[t=(i-i%4)/4]=o[t]|e.charCodeAt(i)<<s,i++;return o[t=(i-i%4)/4]=o[t]|128<<(s=i%4*8),o[n-2]=r<<3,o[n-1]=r>>>29,o})(e=(e=>{for(var t="",r=0;r<e.length;r++){var n=e.charCodeAt(r);n<128?t+=String.fromCharCode(n):(127<n&&n<2048?t+=String.fromCharCode(n>>6|192):t=(t+=String.fromCharCode(n>>12|224))+String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t})(e)),d=1732584193,f=4023233417,m=2562383102,g=271733878,y=0;y<h.length;y+=16)d=t(i=d,l=f,c=m,p=g,h[y+0],7,3614090360),g=t(g,d,f,m,h[y+1],12,3905402710),m=t(m,g,d,f,h[y+2],17,606105819),f=t(f,m,g,d,h[y+3],22,3250441966),d=t(d,f,m,g,h[y+4],7,4118548399),g=t(g,d,f,m,h[y+5],12,1200080426),m=t(m,g,d,f,h[y+6],17,2821735955),f=t(f,m,g,d,h[y+7],22,4249261313),d=t(d,f,m,g,h[y+8],7,1770035416),g=t(g,d,f,m,h[y+9],12,2336552879),m=t(m,g,d,f,h[y+10],17,4294925233),f=t(f,m,g,d,h[y+11],22,2304563134),d=t(d,f,m,g,h[y+12],7,1804603682),g=t(g,d,f,m,h[y+13],12,4254626195),m=t(m,g,d,f,h[y+14],17,2792965006),d=r(d,f=t(f,m,g,d,h[y+15],22,1236535329),m,g,h[y+1],5,4129170786),g=r(g,d,f,m,h[y+6],9,3225465664),m=r(m,g,d,f,h[y+11],14,643717713),f=r(f,m,g,d,h[y+0],20,3921069994),d=r(d,f,m,g,h[y+5],5,3593408605),g=r(g,d,f,m,h[y+10],9,38016083),m=r(m,g,d,f,h[y+15],14,3634488961),f=r(f,m,g,d,h[y+4],20,3889429448),d=r(d,f,m,g,h[y+9],5,568446438),g=r(g,d,f,m,h[y+14],9,3275163606),m=r(m,g,d,f,h[y+3],14,4107603335),f=r(f,m,g,d,h[y+8],20,1163531501),d=r(d,f,m,g,h[y+13],5,2850285829),g=r(g,d,f,m,h[y+2],9,4243563512),m=r(m,g,d,f,h[y+7],14,1735328473),d=n(d,f=r(f,m,g,d,h[y+12],20,2368359562),m,g,h[y+5],4,4294588738),g=n(g,d,f,m,h[y+8],11,2272392833),m=n(m,g,d,f,h[y+11],16,1839030562),f=n(f,m,g,d,h[y+14],23,4259657740),d=n(d,f,m,g,h[y+1],4,2763975236),g=n(g,d,f,m,h[y+4],11,1272893353),m=n(m,g,d,f,h[y+7],16,4139469664),f=n(f,m,g,d,h[y+10],23,3200236656),d=n(d,f,m,g,h[y+13],4,681279174),g=n(g,d,f,m,h[y+0],11,3936430074),m=n(m,g,d,f,h[y+3],16,3572445317),f=n(f,m,g,d,h[y+6],23,76029189),d=n(d,f,m,g,h[y+9],4,3654602809),g=n(g,d,f,m,h[y+12],11,3873151461),m=n(m,g,d,f,h[y+15],16,530742520),d=o(d,f=n(f,m,g,d,h[y+2],23,3299628645),m,g,h[y+0],6,4096336452),g=o(g,d,f,m,h[y+7],10,1126891415),m=o(m,g,d,f,h[y+14],15,2878612391),f=o(f,m,g,d,h[y+5],21,4237533241),d=o(d,f,m,g,h[y+12],6,1700485571),g=o(g,d,f,m,h[y+3],10,2399980690),m=o(m,g,d,f,h[y+10],15,4293915773),f=o(f,m,g,d,h[y+1],21,2240044497),d=o(d,f,m,g,h[y+8],6,1873313359),g=o(g,d,f,m,h[y+15],10,4264355552),m=o(m,g,d,f,h[y+6],15,2734768916),f=o(f,m,g,d,h[y+13],21,1309151649),d=o(d,f,m,g,h[y+4],6,4149444226),g=o(g,d,f,m,h[y+11],10,3174756917),m=o(m,g,d,f,h[y+2],15,718787259),f=o(f,m,g,d,h[y+9],21,3951481745),d=u(d,i),f=u(f,l),m=u(m,c),g=u(g,p);return(s(d)+s(f)+s(m)+s(g)).toLowerCase()},D.closeMediaStream=function(e){if(e)try{if(e.getTracks){var t,r=d(e.getTracks());try{for(r.s();!(t=r.n()).done;)t.value.stop()}catch(e){r.e(e)}finally{r.f()}}else{var n,o=d(e.getAudioTracks());try{for(o.s();!(n=o.n()).done;)n.value.stop()}catch(e){o.e(e)}finally{o.f()}var s,i=d(e.getVideoTracks());try{for(i.s();!(s=i.n()).done;)s.value.stop()}catch(e){i.e(e)}finally{i.f()}}}catch(t){"function"!=typeof e.stop&&"object"!==T(e.stop)||e.stop()}},D.cloneArray=function(e){return e&&e.slice()||[]},D.cloneObject=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return e&&Object.assign({},e)||t},D.toPlainObject=function(r){var n;return"object"!==T(r)||null===r?r:(n={},Object.keys(r).forEach(function(e){var t=r[e];!t||"function"==typeof t||t instanceof Date||t instanceof RegExp||"symbol"===T(t)||"object"===T(t)&&t.constructor!==Object||(n[e]=t)}),n)},D.isMiniProgram=function(){return"undefined"!=typeof wx&&"function"==typeof wx.getSystemInfo&&"undefined"==typeof window}),D}function q(){}function H(){H.init.call(this)}function G(e){return void 0===e._maxListeners?H.defaultMaxListeners:e._maxListeners}function z(e,t,r,n){var o,s;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');return(o=e._events)?(o.newListener&&(e.emit("newListener",t,r.listener||r),o=e._events),s=o[t]):(o=e._events=new q,e._eventsCount=0),s?("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),!s.warned&&(n=G(e))&&0<n&&s.length>n&&(s.warned=!0,(n=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit")).name="MaxListenersExceededWarning",n.emitter=e,n.type=t,n.count=s.length,n=n,"function"==typeof console.warn?console.warn(n):console.log(n))):(s=o[t]=r,++e._eventsCount),e}function K(e,t,r){var n=!1;function o(){e.removeListener(t,o),n||(n=!0,r.apply(e,arguments))}return o.listener=r,o}function Y(e){var t=this._events;if(t){t=t[e];if("function"==typeof t)return 1;if(t)return t.length}return 0}function W(e,t){for(var r=new Array(t);t--;)r[t]=e[t];return r}q.prototype=Object.create(null),(H.EventEmitter=H).usingDomains=!1,H.prototype.domain=void 0,H.prototype._events=void 0,H.prototype._maxListeners=void 0,H.defaultMaxListeners=10,H.init=function(){this.domain=null,H.usingDomains&&(void 0).active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new q,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},H.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},H.prototype.getMaxListeners=function(){return G(this)},H.prototype.emit=function(e){var t,r,n,o,s,i="error"===e;if(s=this._events)i=i&&null==s.error;else if(!i)return!1;if(a=this.domain,i){if(i=arguments[1],a)return(i=i||new Error('Uncaught, unspecified "error" event')).domainEmitter=this,i.domain=a,i.domainThrown=!1,a.emit("error",i),!1;if(i instanceof Error)throw i;var a=new Error('Uncaught, unspecified "error" event. ('+i+")");throw a.context=i,a}if(!(t=s[e]))return!1;var u="function"==typeof t;switch(r=arguments.length){case 1:var l=t,c=this;if(u)l.call(c);else for(var p=l.length,U=W(l,p),h=0;h<p;++h)U[h].call(c);break;case 2:var l=t,d=u,f=this,m=arguments[1];if(d)l.call(f,m);else for(var g=l.length,j=W(l,g),y=0;y<g;++y)j[y].call(f,m);break;case 3:var d=t,_=u,v=this,b=arguments[1],S=arguments[2];if(_)d.call(v,b,S);else for(var T=d.length,D=W(d,T),w=0;w<T;++w)D[w].call(v,b,S);break;case 4:var _=t,E=u,A=this,O=arguments[1],x=arguments[2],C=arguments[3];if(E)_.call(A,O,x,C);else for(var R=_.length,M=W(_,R),N=0;N<R;++N)M[N].call(A,O,x,C);break;default:for(n=new Array(r-1),o=1;o<r;o++)n[o-1]=arguments[o];var E=t,I=this,L=n;if(u)E.apply(I,L);else for(var k=E.length,V=W(E,k),P=0;P<k;++P)V[P].apply(I,L)}return!0},H.prototype.addListener=function(e,t){return z(this,e,t,!1)},H.prototype.on=H.prototype.addListener,H.prototype.prependListener=function(e,t){return z(this,e,t,!0)},H.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,K(this,e,t)),this},H.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,K(this,e,t)),this},H.prototype.removeListener=function(e,t){var r,n,o,s,i;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if((n=this._events)&&(r=n[e]))if(r===t||r.listener&&r.listener===t)0==--this._eventsCount?this._events=new q:(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(o=-1,s=r.length;0<s--;)if(r[s]===t||r[s].listener&&r[s].listener===t){i=r[s].listener,o=s;break}if(o<0)return this;if(1===r.length){if(r[0]=void 0,0==--this._eventsCount)return this._events=new q,this;delete n[e]}else{var a=r;for(var u=o,l=u+1,c=a.length;l<c;u+=1,l+=1)a[u]=a[l];a.pop()}n.removeListener&&this.emit("removeListener",e,i||t)}return this},H.prototype.off=function(e,t){return this.removeListener(e,t)},H.prototype.removeAllListeners=function(e){var t,r;if(r=this._events)if(r.removeListener){if(0===arguments.length){for(var n,o=Object.keys(r),s=0;s<o.length;++s)"removeListener"!==(n=o[s])&&this.removeAllListeners(n);this.removeAllListeners("removeListener"),this._events=new q,this._eventsCount=0}else if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)for(;this.removeListener(e,t[t.length-1]),t[0];);}else 0===arguments.length?(this._events=new q,this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=new q:delete r[e]);return this},H.prototype.listeners=function(e){var t=this._events;{if(t&&(t=t[e])){if("function"==typeof t)return[t.listener||t];for(var r=t,n=new Array(r.length),o=0;o<n.length;++o)n[o]=r[o].listener||r[o];return n}return[]}},H.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Y.call(e,t)},H.prototype.listenerCount=Y,H.prototype.eventNames=function(){return 0<this._eventsCount?Reflect.ownKeys(this._events):[]};var $=n(Object.freeze({__proto__:null,default:H,EventEmitter:H})),J={},X="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Q=[],Z=[],ee="undefined"!=typeof Uint8Array?Uint8Array:Array,te=!1;function re(){te=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)Q[t]=e[t],Z[e.charCodeAt(t)]=t;Z["-".charCodeAt(0)]=62,Z["_".charCodeAt(0)]=63}function ne(e){return Q[e>>18&63]+Q[e>>12&63]+Q[e>>6&63]+Q[63&e]}function oe(e,t,r){for(var n,o=[],s=t;s<r;s+=3)n=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(ne(n));return o.join("")}function ie(e){var t;te||re();for(var r=e.length,n=r%3,o="",s=[],i=0,a=r-n;i<a;i+=16383)s.push(oe(e,i,a<i+16383?a:i+16383));return 1==n?(t=e[r-1],o=(o+=Q[t>>2])+Q[t<<4&63]+"=="):2==n&&(t=(e[r-2]<<8)+e[r-1],o=(o=(o+=Q[t>>10])+Q[t>>4&63])+Q[t<<2&63]+"="),s.push(o),s.join("")}function se(e,t,r,n,o){var s,i,a=8*o-n-1,u=(1<<a)-1,l=u>>1,c=-7,p=r?o-1:0,h=r?-1:1,o=e[t+p];for(p+=h,s=o&(1<<-c)-1,o>>=-c,c+=a;0<c;s=256*s+e[t+p],p+=h,c-=8);for(i=s&(1<<-c)-1,s>>=-c,c+=n;0<c;i=256*i+e[t+p],p+=h,c-=8);if(0===s)s=1-l;else{if(s===u)return i?NaN:1/0*(o?-1:1);i+=Math.pow(2,n),s-=l}return(o?-1:1)*i*Math.pow(2,s-n)}function ae(e,t,r,n,o,s){var i,a,u=8*s-o-1,l=(1<<u)-1,c=l>>1,p=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,d=n?1:-1,s=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=l):(i=Math.floor(Math.log(t)/Math.LN2),t*(n=Math.pow(2,-i))<1&&(i--,n*=2),2<=(t+=1<=i+c?p/n:p*Math.pow(2,1-c))*n&&(i++,n/=2),l<=i+c?(a=0,i=l):1<=i+c?(a=(t*n-1)*Math.pow(2,o),i+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,o),i=0));8<=o;e[r+h]=255&a,h+=d,a/=256,o-=8);for(i=i<<o|a,u+=o;0<u;e[r+h]=255&i,h+=d,i/=256,u-=8);e[r+h-d]|=128*s}var ue={}.toString,le=Array.isArray||function(e){return"[object Array]"==ue.call(e)};function ce(){return de.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function pe(e,t){if(ce()<t)throw new RangeError("Invalid typed array length");return de.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=de.prototype:(e=null===e?new de(t):e).length=t,e}function de(e,t,r){if(!(de.TYPED_ARRAY_SUPPORT||this instanceof de))return new de(e,t,r);if("number"!=typeof e)return he(this,e,t,r);if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return me(this,e)}function he(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer){var o=e,s=t,i=r;if(s.byteLength,i<0||s.byteLength<i)throw new RangeError("'offset' is out of bounds");if(s.byteLength<i+(n||0))throw new RangeError("'length' is out of bounds");return s=void 0===i&&void 0===n?new Uint8Array(s):void 0===n?new Uint8Array(s,i):new Uint8Array(s,i,n),de.TYPED_ARRAY_SUPPORT?(o=s).__proto__=de.prototype:o=ge(o,s),o}if("string"==typeof t){i=e,n=t,s=r;if(de.isEncoding(s="string"==typeof s&&""!==s?s:"utf8"))return(n=(i=pe(i,o=0|ve(n,s))).write(n,s))!==o?i.slice(0,n):i;throw new TypeError('"encoding" must be a valid string encoding')}var a,r=e,n=t;if(_e(n))return 0!==(r=pe(r,a=0|ye(n.length))).length&&n.copy(r,0,0,a),r;if(n){if("undefined"!=typeof ArrayBuffer&&n.buffer instanceof ArrayBuffer||"length"in n)return"number"!=typeof n.length||(a=n.length)!=a?pe(r,0):ge(r,n);if("Buffer"===n.type&&le(n.data))return ge(r,n.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function fe(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function me(e,t){if(fe(t),e=pe(e,t<0?0:0|ye(t)),!de.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function ge(e,t){var r=t.length<0?0:0|ye(t.length);e=pe(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function ye(e){if(e>=ce())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ce().toString(16)+" bytes");return 0|e}function _e(e){return!(null==e||!e._isBuffer)}function ve(e,t){if(_e(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;var r=(e="string"!=typeof e?""+e:e).length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Ke(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Ye(e).length;default:if(n)return Ke(e).length;t=(""+t).toLowerCase(),n=!0}}function be(e,t,r){var n=!1;if((t=void 0===t||t<0?0:t)>this.length)return"";if((r=void 0===r||r>this.length?this.length:r)<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e=e||"utf8";;)switch(e){case"hex":return Le(this,t,r);case"utf8":case"utf-8":return Ie(this,t,r);case"ascii":return Ue(this,t,r);case"latin1":case"binary":return ke(this,t,r);case"base64":return Ne(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return je(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function Se(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Te(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647<r?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,(r=(r=isNaN(r)?o?0:e.length-1:r)<0?e.length+r:r)>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if(_e(t="string"==typeof t?de.from(t,n):t))return 0===t.length?-1:we(e,t,r,n,o);if("number"==typeof t)return t&=255,de.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?(o?Uint8Array.prototype.indexOf:Uint8Array.prototype.lastIndexOf).call(e,t,r):we(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function we(e,t,r,n,o){var s=1,i=e.length,a=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;i/=s=2,a/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o)for(var l=-1,c=r;c<i;c++)if(u(e,c)===u(t,-1===l?0:c-l)){if(c-(l=-1===l?c:l)+1===a)return l*s}else-1!==l&&(c-=c-l),l=-1;else for(c=r=i<r+a?i-a:r;0<=c;c--){for(var p=!0,h=0;h<a;h++)if(u(e,c+h)!==u(t,h)){p=!1;break}if(p)return c}return-1}function Ee(e,t,r,n){r=Number(r)||0;var o=e.length-r,o=((!n||(n=Number(n))>o)&&(n=o),t.length);if(o%2!=0)throw new TypeError("Invalid hex string");o/2<n&&(n=o/2);for(var s=0;s<n;++s){var i=parseInt(t.substr(2*s,2),16);if(isNaN(i))return s;e[r+s]=i}return s}function Ae(e,t,r,n){return We(Ke(t,e.length-r),e,r,n)}function Oe(e,t,r,n){return We((e=>{for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t})(t),e,r,n)}function xe(e,t,r,n){return Oe(e,t,r,n)}function Ce(e,t,r,n){return We(Ye(t),e,r,n)}function Re(e,t,r,n){return We(((e,t)=>{for(var r,n,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,o.push(r%256),o.push(n);return o})(t,e.length-r),e,r,n)}function Ne(e,t,r){return 0===t&&r===e.length?ie(e):ie(e.slice(t,r))}function Ie(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var s,i,a,u,l=e[o],c=null,p=239<l?4:223<l?3:191<l?2:1;if(o+p<=r)switch(p){case 1:l<128&&(c=l);break;case 2:128==(192&(s=e[o+1]))&&127<(u=(31&l)<<6|63&s)&&(c=u);break;case 3:s=e[o+1],i=e[o+2],128==(192&s)&&128==(192&i)&&2047<(u=(15&l)<<12|(63&s)<<6|63&i)&&(u<55296||57343<u)&&(c=u);break;case 4:s=e[o+1],i=e[o+2],a=e[o+3],128==(192&s)&&128==(192&i)&&128==(192&a)&&65535<(u=(15&l)<<18|(63&s)<<12|(63&i)<<6|63&a)&&u<1114112&&(c=u)}null===c?(c=65533,p=1):65535<c&&(n.push((c-=65536)>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=p}var h=n,d=h.length;if(d<=Pe)return String.fromCharCode.apply(String,h);for(var f="",m=0;m<d;)f+=String.fromCharCode.apply(String,h.slice(m,m+=Pe));return f}de.TYPED_ARRAY_SUPPORT=void 0===X.TYPED_ARRAY_SUPPORT||X.TYPED_ARRAY_SUPPORT,ce(),de.poolSize=8192,de._augment=function(e){return e.__proto__=de.prototype,e},de.from=function(e,t,r){return he(null,e,t,r)},de.TYPED_ARRAY_SUPPORT&&(de.prototype.__proto__=Uint8Array.prototype,de.__proto__=Uint8Array),de.alloc=function(e,t,r){return t=t,r=r,fe(e=e),!(e<=0)&&void 0!==t?"string"==typeof r?pe(null,e).fill(t,r):pe(null,e).fill(t):pe(null,e)},de.allocUnsafe=function(e){return me(null,e)},de.allocUnsafeSlow=function(e){return me(null,e)},de.isBuffer=function(e){return null!=e&&(!!e._isBuffer||$e(e)||"function"==typeof(e=e).readFloatLE&&"function"==typeof e.slice&&$e(e.slice(0,0)))},de.compare=function(e,t){if(!_e(e)||!_e(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,o=0,s=Math.min(r,n);o<s;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},de.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},de.concat=function(e,t){if(!le(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return de.alloc(0);if(void 0===t)for(o=t=0;o<e.length;++o)t+=e[o].length;for(var r=de.allocUnsafe(t),n=0,o=0;o<e.length;++o){var s=e[o];if(!_e(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,n),n+=s.length}return r},de.byteLength=ve,de.prototype._isBuffer=!0,de.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Se(this,t,t+1);return this},de.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Se(this,t,t+3),Se(this,t+1,t+2);return this},de.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Se(this,t,t+7),Se(this,t+1,t+6),Se(this,t+2,t+5),Se(this,t+3,t+4);return this},de.prototype.toString=function(){var e=0|this.length;return 0==e?"":0===arguments.length?Ie(this,0,e):be.apply(this,arguments)},de.prototype.equals=function(e){if(_e(e))return this===e||0===de.compare(this,e);throw new TypeError("Argument must be a Buffer")},de.prototype.inspect=function(){var e="";return 0<this.length&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),50<this.length)&&(e+=" ... "),"<Buffer "+e+">"},de.prototype.compare=function(e,t,r,n,o){if(!_e(e))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),(t=void 0===t?0:t)<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(o<=n&&r<=t)return 0;if(o<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var s=(o>>>=0)-(n>>>=0),i=(r>>>=0)-(t>>>=0),a=Math.min(s,i),u=this.slice(n,o),l=e.slice(t,r),c=0;c<a;++c)if(u[c]!==l[c]){s=u[c],i=l[c];break}return s<i?-1:i<s?1:0},de.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},de.prototype.indexOf=function(e,t,r){return Te(this,e,t,r,!0)},de.prototype.lastIndexOf=function(e,t,r){return Te(this,e,t,r,!1)},de.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||o<r)&&(r=o),0<e.length&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n=n||"utf8";for(var s=!1;;)switch(n){case"hex":return Ee(this,e,t,r);case"utf8":case"utf-8":return Ae(this,e,t,r);case"ascii":return Oe(this,e,t,r);case"latin1":case"binary":return xe(this,e,t,r);case"base64":return Ce(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Re(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},de.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Pe=4096;function Ue(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function ke(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function Le(e,t,r){var n=e.length;(!r||r<0||n<r)&&(r=n);for(var o="",s=t=!t||t<0?0:t;s<r;++s)o+=ze(e[s]);return o}function je(e,t,r){for(var n=e.slice(t,r),o="",s=0;s<n.length;s+=2)o+=String.fromCharCode(n[s]+256*n[s+1]);return o}function De(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(r<e+t)throw new RangeError("Trying to access beyond buffer length")}function Me(e,t,r,n,o,s){if(!_e(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(o<t||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function Ve(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,s=Math.min(e.length-r,2);o<s;++o)e[r+o]=(t&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function Be(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,s=Math.min(e.length-r,4);o<s;++o)e[r+o]=t>>>8*(n?o:3-o)&255}function Fe(e,t,r,n,o,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function qe(e,t,r,n,o){return o||Fe(e,0,r,4),ae(e,t,r,n,23,4),r+4}function He(e,t,r,n,o){return o||Fe(e,0,r,8),ae(e,t,r,n,52,8),r+8}de.prototype.slice=function(e,t){var r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):r<e&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):r<t&&(t=r),t<e&&(t=e),de.TYPED_ARRAY_SUPPORT)(o=this.subarray(e,t)).__proto__=de.prototype;else for(var n=t-e,o=new de(n,void 0),s=0;s<n;++s)o[s]=this[s+e];return o},de.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||De(e,t,this.length);for(var n=this[e],o=1,s=0;++s<t&&(o*=256);)n+=this[e+s]*o;return n},de.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||De(e,t,this.length);for(var n=this[e+--t],o=1;0<t&&(o*=256);)n+=this[e+--t]*o;return n},de.prototype.readUInt8=function(e,t){return t||De(e,1,this.length),this[e]},de.prototype.readUInt16LE=function(e,t){return t||De(e,2,this.length),this[e]|this[e+1]<<8},de.prototype.readUInt16BE=function(e,t){return t||De(e,2,this.length),this[e]<<8|this[e+1]},de.prototype.readUInt32LE=function(e,t){return t||De(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},de.prototype.readUInt32BE=function(e,t){return t||De(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},de.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||De(e,t,this.length);for(var n=this[e],o=1,s=0;++s<t&&(o*=256);)n+=this[e+s]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},de.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||De(e,t,this.length);for(var n=t,o=1,s=this[e+--n];0<n&&(o*=256);)s+=this[e+--n]*o;return s>=(o*=128)&&(s-=Math.pow(2,8*t)),s},de.prototype.readInt8=function(e,t){return t||De(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},de.prototype.readInt16LE=function(e,t){t||De(e,2,this.length);t=this[e]|this[e+1]<<8;return 32768&t?4294901760|t:t},de.prototype.readInt16BE=function(e,t){t||De(e,2,this.length);t=this[e+1]|this[e]<<8;return 32768&t?4294901760|t:t},de.prototype.readInt32LE=function(e,t){return t||De(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},de.prototype.readInt32BE=function(e,t){return t||De(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},de.prototype.readFloatLE=function(e,t){return t||De(e,4,this.length),se(this,e,!0,23,4)},de.prototype.readFloatBE=function(e,t){return t||De(e,4,this.length),se(this,e,!1,23,4)},de.prototype.readDoubleLE=function(e,t){return t||De(e,8,this.length),se(this,e,!0,52,8)},de.prototype.readDoubleBE=function(e,t){return t||De(e,8,this.length),se(this,e,!1,52,8)},de.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||Me(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,s=0;for(this[t]=255&e;++s<r&&(o*=256);)this[t+s]=e/o&255;return t+r},de.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||Me(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,s=1;for(this[t+o]=255&e;0<=--o&&(s*=256);)this[t+o]=e/s&255;return t+r},de.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||Me(this,e,t,1,255,0),de.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},de.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||Me(this,e,t,2,65535,0),de.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ve(this,e,t,!0),t+2},de.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||Me(this,e,t,2,65535,0),de.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ve(this,e,t,!1),t+2},de.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||Me(this,e,t,4,4294967295,0),de.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Be(this,e,t,!0),t+4},de.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||Me(this,e,t,4,4294967295,0),de.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Be(this,e,t,!1),t+4},de.prototype.writeIntLE=function(e,t,r,n){e=+e,t|=0,n||Me(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=0,s=1,i=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===i&&0!==this[t+o-1]&&(i=1),this[t+o]=(e/s|0)-i&255;return t+r},de.prototype.writeIntBE=function(e,t,r,n){e=+e,t|=0,n||Me(this,e,t,r,(n=Math.pow(2,8*r-1))-1,-n);var o=r-1,s=1,i=0;for(this[t+o]=255&e;0<=--o&&(s*=256);)e<0&&0===i&&0!==this[t+o+1]&&(i=1),this[t+o]=(e/s|0)-i&255;return t+r},de.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||Me(this,e,t,1,127,-128),de.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&(e=e<0?255+e+1:e),t+1},de.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||Me(this,e,t,2,32767,-32768),de.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ve(this,e,t,!0),t+2},de.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||Me(this,e,t,2,32767,-32768),de.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ve(this,e,t,!1),t+2},de.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||Me(this,e,t,4,2147483647,-2147483648),de.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Be(this,e,t,!0),t+4},de.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||Me(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),de.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Be(this,e,t,!1),t+4},de.prototype.writeFloatLE=function(e,t,r){return qe(this,e,t,!0,r)},de.prototype.writeFloatBE=function(e,t,r){return qe(this,e,t,!1,r)},de.prototype.writeDoubleLE=function(e,t,r){return He(this,e,t,!0,r)},de.prototype.writeDoubleBE=function(e,t,r){return He(this,e,t,!1,r)},de.prototype.copy=function(e,t,r,n){if(r=r||0,n||0===n||(n=this.length),t>=e.length&&(t=e.length),(n=0<n&&n<r?r:n)===r)return 0;if(0===e.length||0===this.length)return 0;if((t=t||0)<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length);var o,s=(n=e.length-t<n-r?e.length-t+r:n)-r;if(this===e&&r<t&&t<n)for(o=s-1;0<=o;--o)e[o+t]=this[o+r];else if(s<1e3||!de.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+s),t);return s},de.prototype.fill=function(e,t,r,n){if("string"==typeof e){var o;if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length&&(o=e.charCodeAt(0))<256&&(e=o),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!de.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(!(r<=t))if(t>>>=0,r=void 0===r?this.length:r>>>0,"number"==typeof(e=e||0))for(a=t;a<r;++a)this[a]=e;else for(var s=_e(e)?e:Ke(new de(e,n).toString()),i=s.length,a=0;a<r-t;++a)this[a+t]=s[a%i];return this};var Ge=/[^+\/0-9A-Za-z-_]/g;function ze(e){return e<16?"0"+e.toString(16):e.toString(16)}function Ke(e,t){var r;t=t||1/0;for(var n=e.length,o=null,s=[],i=0;i<n;++i){if(55295<(r=e.charCodeAt(i))&&r<57344){if(!o){if(56319<r){-1<(t-=3)&&s.push(239,191,189);continue}if(i+1===n){-1<(t-=3)&&s.push(239,191,189);continue}o=r;continue}if(r<56320){-1<(t-=3)&&s.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&-1<(t-=3)&&s.push(239,191,189);if(o=null,r<128){if(--t<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function Ye(e){var t=(e=>{if((e=((t=e).trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(Ge,"")).length<2)return"";for(var t;e.length%4!=0;)e+="=";return e})(e);te||re();var r,e=t.length;if(0<e%4)throw new Error("Invalid string. Length must be a multiple of 4");for(var n="="===t[e-2]?2:"="===t[e-1]?1:0,o=new ee(3*e/4-n),s=0<n?e-4:e,i=0,a=0;a<s;a+=4)r=Z[t.charCodeAt(a)]<<18|Z[t.charCodeAt(a+1)]<<12|Z[t.charCodeAt(a+2)]<<6|Z[t.charCodeAt(a+3)],o[i++]=r>>16&255,o[i++]=r>>8&255,o[i++]=255&r;return 2==n?(r=Z[t.charCodeAt(a)]<<2|Z[t.charCodeAt(a+1)]>>4,o[i++]=255&r):1==n&&(r=Z[t.charCodeAt(a)]<<10|Z[t.charCodeAt(a+1)]<<4|Z[t.charCodeAt(a+2)]>>2,o[i++]=r>>8&255,o[i++]=255&r),o}function We(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}function $e(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function Je(){throw new Error("setTimeout has not been defined")}function Xe(){throw new Error("clearTimeout has not been defined")}var Qe=Je,Ze=Xe;function et(t){if(Qe===setTimeout)return setTimeout(t,0);if((Qe===Je||!Qe)&&setTimeout)return(Qe=setTimeout)(t,0);try{return Qe(t,0)}catch(e){try{return Qe.call(null,t,0)}catch(e){return Qe.call(this,t,0)}}}"function"==typeof X.setTimeout&&(Qe=setTimeout),"function"==typeof X.clearTimeout&&(Ze=clearTimeout);var tt,rt=[],nt=!1,ot=-1;function it(){nt&&tt&&(nt=!1,tt.length?rt=tt.concat(rt):ot=-1,rt.length)&&st()}function st(){if(!nt){var e=et(it);nt=!0;for(var t=rt.length;t;){for(tt=rt,rt=[];++ot<t;)tt&&tt[ot].run();ot=-1,t=rt.length}tt=null,nt=!1,function(t){if(Ze===clearTimeout)return clearTimeout(t);if((Ze===Xe||!Ze)&&clearTimeout)return(Ze=clearTimeout)(t);try{Ze(t)}catch(e){try{return Ze.call(null,t)}catch(e){return Ze.call(this,t)}}}(e)}}function at(e,t){this.fun=e,this.array=t}function ut(){}at.prototype.run=function(){this.fun.apply(null,this.array)};var lt=ut,ct=ut,pt=ut,dt=ut,ht=ut,ft=ut,mt=ut,gt=X.performance||{},yt=gt.now||gt.mozNow||gt.msNow||gt.oNow||gt.webkitNow||function(){return(new Date).getTime()},_t=new Date,vt={nextTick:function(e){var t=new Array(arguments.length-1);if(1<arguments.length)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];rt.push(new at(e,t)),1!==rt.length||nt||et(st)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:lt,addListener:ct,once:pt,off:dt,removeListener:ht,removeAllListeners:ft,emit:mt,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*yt.call(gt),r=Math.floor(t),t=Math.floor(t%1*1e9);return e&&(r-=e[0],(t-=e[1])<0)&&(r--,t+=1e9),[r,t]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-_t)/1e3}},bt="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;function r(){}r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e},St=/%[sdj%]/g;function Tt(e){if(!Mt(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(xt(arguments[r]));return t.join(" ")}for(var r=1,n=arguments,o=n.length,s=String(e).replace(St,function(e){if("%%"===e)return"%";if(o<=r)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(e){return"[Circular]"}default:return e}}),i=n[r];r<o;i=n[++r])Lt(i)||!qt(i)?s+=" "+i:s+=" "+xt(i);return s}function wt(e,t){var r;return Bt(X.process)?function(){return wt(e,t).apply(this,arguments)}:!0===vt.noDeprecation?e:(r=!1,function(){if(!r){if(vt.throwDeprecation)throw new Error(t);vt.traceDeprecation?console.trace(t):console.error(t),r=!0}return e.apply(this,arguments)})}var Et,At={};function Ot(t){return Bt(Et)&&(Et=vt.env.NODE_DEBUG||""),t=t.toUpperCase(),At[t]||(new RegExp("\\b"+t+"\\b","i").test(Et)?At[t]=function(){var e=Tt.apply(null,arguments);console.error("%s %d: %s",t,0,e)}:At[t]=function(){}),At[t]}function xt(e,t){var r={seen:[],stylize:Rt};return 3<=arguments.length&&(r.depth=arguments[2]),4<=arguments.length&&(r.colors=arguments[3]),kt(t)?r.showHidden=t:t&&Qt(r,t),Bt(r.showHidden)&&(r.showHidden=!1),Bt(r.depth)&&(r.depth=2),Bt(r.colors)&&(r.colors=!1),Bt(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=Ct),Nt(r,e,r.depth)}function Ct(e,t){t=xt.styles[t];return t?"["+xt.colors[t][0]+"m"+e+"["+xt.colors[t][1]+"m":e}function Rt(e,t){return e}function Nt(t,r,n){if(t.customInspect&&r&&zt(r.inspect)&&r.inspect!==xt&&(!r.constructor||r.constructor.prototype!==r))return Mt(e=r.inspect(n,t))?e:Nt(t,e,n);e=t;var e,o=Bt(i=r)?e.stylize("undefined","undefined"):Mt(i)?(o="'"+JSON.stringify(i).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'",e.stylize(o,"string")):Dt(i)?e.stylize(""+i,"number"):kt(i)?e.stylize(""+i,"boolean"):Lt(i)?e.stylize("null","null"):void 0;if(o)return o;var s,i=Object.keys(r),a=(s={},i.forEach(function(e,t){s[e]=!0}),s);if(t.showHidden&&(i=Object.getOwnPropertyNames(r)),Gt(r)&&(0<=i.indexOf("message")||0<=i.indexOf("description")))return It(r);if(0===i.length){if(zt(r))return c=r.name?": "+r.name:"",t.stylize("[Function"+c+"]","special");if(Ft(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(Ht(r))return t.stylize(Date.prototype.toString.call(r),"date");if(Gt(r))return It(r)}var u,l,c="",p=!1,h=["{","}"];return Ut(r)&&(p=!0,h=["[","]"]),zt(r)&&(c=" [Function"+(r.name?": "+r.name:"")+"]"),Ft(r)&&(c=" "+RegExp.prototype.toString.call(r)),Ht(r)&&(c=" "+Date.prototype.toUTCString.call(r)),Gt(r)&&(c=" "+It(r)),0!==i.length||p&&0!=r.length?n<0?Ft(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),i=p?((t,r,n,o,e)=>{for(var s=[],i=0,a=r.length;i<a;++i)Zt(r,String(i))?s.push(Pt(t,r,n,o,String(i),!0)):s.push("");return e.forEach(function(e){e.match(/^\d+$/)||s.push(Pt(t,r,n,o,e,!0))}),s})(t,r,n,a,i):i.map(function(e){return Pt(t,r,n,a,e,p)}),t.seen.pop(),u=c,l=h,60<(i=i).reduce(function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0)?l[0]+(""===u?"":u+"\n ")+" "+i.join(",\n ")+" "+l[1]:l[0]+u+" "+i.join(", ")+" "+l[1]):h[0]+c+h[1]}function It(e){return"["+Error.prototype.toString.call(e)+"]"}function Pt(e,t,r,n,o,s){var i,a;if((t=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]}).get?a=t.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):t.set&&(a=e.stylize("[Setter]","special")),Zt(n,o)||(i="["+o+"]"),a||(e.seen.indexOf(t.value)<0?-1<(a=Lt(r)?Nt(e,t.value,null):Nt(e,t.value,r-1)).indexOf("\n")&&(a=s?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n")):a=e.stylize("[Circular]","special")),Bt(i)){if(s&&o.match(/^\d+$/))return a;i=(i=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(i=i.substr(1,i.length-2),e.stylize(i,"name")):(i=i.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),e.stylize(i,"string"))}return i+": "+a}function Ut(e){return Array.isArray(e)}function kt(e){return"boolean"==typeof e}function Lt(e){return null===e}function jt(e){return null==e}function Dt(e){return"number"==typeof e}function Mt(e){return"string"==typeof e}function Vt(e){return"symbol"==typeof e}function Bt(e){return void 0===e}function Ft(e){return qt(e)&&"[object RegExp]"===Wt(e)}function qt(e){return"object"==typeof e&&null!==e}function Ht(e){return qt(e)&&"[object Date]"===Wt(e)}function Gt(e){return qt(e)&&("[object Error]"===Wt(e)||e instanceof Error)}function zt(e){return"function"==typeof e}function Kt(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e}function Yt(e){return de.isBuffer(e)}function Wt(e){return Object.prototype.toString.call(e)}function $t(e){return e<10?"0"+e.toString(10):e.toString(10)}xt.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},xt.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Jt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Xt(){var e,t;console.log("%s - %s",(t=[$t((e=new Date).getHours()),$t(e.getMinutes()),$t(e.getSeconds())].join(":"),[e.getDate(),Jt[e.getMonth()],t].join(" ")),Tt.apply(null,arguments))}function Qt(e,t){if(t&&qt(t))for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function Zt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var er,tr={inherits:bt,_extend:Qt,log:Xt,isBuffer:Yt,isPrimitive:Kt,isFunction:zt,isError:Gt,isDate:Ht,isObject:qt,isRegExp:Ft,isUndefined:Bt,isSymbol:Vt,isString:Mt,isNumber:Dt,isNullOrUndefined:jt,isNull:Lt,isBoolean:kt,isArray:Ut,inspect:xt,deprecate:wt,format:Tt,debuglog:Ot},rr=n(Object.freeze({__proto__:null,format:Tt,deprecate:wt,debuglog:Ot,inspect:xt,isArray:Ut,isBoolean:kt,isNull:Lt,isNullOrUndefined:jt,isNumber:Dt,isString:Mt,isSymbol:Vt,isUndefined:Bt,isRegExp:Ft,isObject:qt,isDate:Ht,isError:Gt,isFunction:zt,isPrimitive:Kt,isBuffer:Yt,log:Xt,inherits:bt,_extend:Qt,default:tr}));class nr{_delegate;constructor(e){this._delegate=e}export(e,t){this._delegate.export(e,t)}forceFlush(){return this._delegate.forceFlush()}shutdown(){return this._delegate.shutdown()}}class or extends Error{code;name="OTLPExporterError";data;constructor(e,t,r){super(e),this.data=r,this.code=t}}function ir(e){if(Number.isFinite(e)&&0<e)return e;throw new Error(`Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '${e}')`)}function sr(e,t,r){return{timeoutMillis:ir(e.timeoutMillis??t.timeoutMillis??r.timeoutMillis),concurrencyLimit:e.concurrencyLimit??t.concurrencyLimit??r.concurrencyLimit,compression:e.compression??t.compression??r.compression}}(e=>{e.NONE="none",e.GZIP="gzip"})(er=er||{});class ar{_concurrencyLimit;_sendingPromises=[];constructor(e){this._concurrencyLimit=e}pushPromise(t){if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(t);var e=()=>{var e=this._sendingPromises.indexOf(t);this._sendingPromises.splice(e,1)};t.then(e,e)}hasReachedLimit(){return this._sendingPromises.length>=this._concurrencyLimit}async awaitAll(){await Promise.all(this._sendingPromises)}}function ur(e){return new ar(e.concurrencyLimit)}var lr="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof X?X:{},cr="1.9.0",pr=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,dr=(t=>{var o,s,i,a=new Set([t]),u=new Set,e=t.match(pr);return e?(o=+e[1],s=+e[2],i=+e[3],null!=e[4]?function(e){return e===t}:function(e){var t,r,n;return!!a.has(e)||!u.has(e)&&(!(t=e.match(pr))||(r=+t[1],n=+t[2],null!=t[4])||o!=r?l:0==o?s==n&&i<=+t[3]?c:l:s<=n?c:l)(e)}):function(){return!1};function l(e){return u.add(e),!1}function c(e){return a.add(e),!0}})(cr),hr=cr.split(".")[0],fr=Symbol.for("opentelemetry.js.api."+hr),mr=lr;function gr(e,t,r,n){void 0===n&&(n=!1);var o,s=mr[fr]=null!=(s=mr[fr])?s:{version:cr};return!n&&s[e]?(o=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+e),r.error(o.stack||o.message),!1):s.version!==cr?(o=new Error("@opentelemetry/api: Registration of version v"+s.version+" for "+e+" does not match previously registered API v"+cr),r.error(o.stack||o.message),!1):(s[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+cr+"."),!0)}function yr(e){var t=null==(t=mr[fr])?void 0:t.version;return!t||!dr(t)||null==(t=mr[fr])?void 0:t[e]}function _r(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+cr+".");t=mr[fr];t&&delete t[e]}var vr,br=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},Sr=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},Tr=(()=>{function e(e){this._namespace=e.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return wr("debug",this._namespace,e)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return wr("error",this._namespace,e)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return wr("info",this._namespace,e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return wr("warn",this._namespace,e)},e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return wr("verbose",this._namespace,e)},e})();function wr(e,t,r){var n=yr("diag");if(n)return r.unshift(t),n[e].apply(n,Sr([],br(r),!1))}(e=>{e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(vr=vr||{});var Er=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},Ar=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},Or=(()=>{function e(){function e(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=yr("diag");if(r)return r[n].apply(r,Ar([],Er(e),!1))}}var a=this;a.setLogger=function(e,t){if(void 0===t&&(t={logLevel:vr.INFO}),e===a)return s=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation"),a.error(null!=(o=s.stack)?o:s.message),!1;"number"==typeof t&&(t={logLevel:t});var r,n,o=yr("diag"),s=(r=null!=(s=t.logLevel)?s:vr.INFO,n=e,r<vr.NONE?r=vr.NONE:r>vr.ALL&&(r=vr.ALL),n=n||{},{error:i("error",vr.ERROR),warn:i("warn",vr.WARN),info:i("info",vr.INFO),debug:i("debug",vr.DEBUG),verbose:i("verbose",vr.VERBOSE)});function i(e,t){e=n[e];return"function"==typeof e&&t<=r?e.bind(n):function(){}}return o&&!t.suppressOverrideMessage&&(t=null!=(e=(new Error).stack)?e:"<failed to generate stacktrace>",o.warn("Current logger will be overwritten from "+t),s.warn("Current logger will overwrite one already registered from "+t)),gr("diag",s,a,!0)},a.disable=function(){_r("diag",a)},a.createComponentLogger=function(e){return new Tr(e)},a.verbose=e("verbose"),a.debug=e("debug"),a.info=e("info"),a.warn=e("warn"),a.error=e("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e})(),xr=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},Cr=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&n>=e.length?void 0:e)&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Rr=(()=>{function u(e){this._entries=e?new Map(e):new Map}return u.prototype.getEntry=function(e){e=this._entries.get(e);if(e)return Object.assign({},e)},u.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){e=xr(e,2);return[e[0],e[1]]})},u.prototype.setEntry=function(e,t){var r=new u(this._entries);return r._entries.set(e,t),r},u.prototype.removeEntry=function(e){var t=new u(this._entries);return t._entries.delete(e),t},u.prototype.removeEntries=function(){for(var t,e,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var o=new u(this._entries);try{for(var s=Cr(r),i=s.next();!i.done;i=s.next()){var a=i.value;o._entries.delete(a)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=s.return)&&e.call(s)}finally{if(t)throw t.error}}return o},u.prototype.clear=function(){return new u},u})(),Nr=Symbol("BaggageEntryMetadata"),Ir=Or.instance();function Pr(e){return void 0===e&&(e={}),new Rr(new Map(Object.entries(e)))}function Ur(e){return"string"!=typeof e&&(Ir.error("Cannot create baggage metadata from unknown type: "+typeof e),e=""),{__TYPE__:Nr,toString:function(){return e}}}function kr(e){return Symbol.for(e)}var Lr,jr,Dr=function n(e){var o=this;o._currentContext=e?new Map(e):new Map,o.getValue=function(e){return o._currentContext.get(e)},o.setValue=function(e,t){var r=new n(o._currentContext);return r._currentContext.set(e,t),r},o.deleteValue=function(e){var t=new n(o._currentContext);return t._currentContext.delete(e),t}},Mr=new Dr,Vr=[{n:"error",c:"error"},{n:"warn",c:"warn"},{n:"info",c:"info"},{n:"debug",c:"debug"},{n:"verbose",c:"trace"}],Br=function(){for(var e=0;e<Vr.length;e++)this[Vr[e].n]=(n=>function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(console){var r=console[n];if("function"==typeof(r="function"!=typeof r?console.log:r))return r.apply(console,e)}})(Vr[e].c)},Fr=(Lr=function(e,t){return(Lr=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}))(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}Lr(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),qr=(()=>{function e(){}return e.prototype.createGauge=function(e,t){return en},e.prototype.createHistogram=function(e,t){return tn},e.prototype.createCounter=function(e,t){return Zr},e.prototype.createUpDownCounter=function(e,t){return rn},e.prototype.createObservableGauge=function(e,t){return on},e.prototype.createObservableCounter=function(e,t){return nn},e.prototype.createObservableUpDownCounter=function(e,t){return sn},e.prototype.addBatchObservableCallback=function(e,t){},e.prototype.removeBatchObservableCallback=function(e){},e})(),Hr=function(){},Gr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Fr(t,e),t.prototype.add=function(e,t){},t})(Hr),zr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Fr(t,e),t.prototype.add=function(e,t){},t})(Hr),Kr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Fr(t,e),t.prototype.record=function(e,t){},t})(Hr),Yr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Fr(t,e),t.prototype.record=function(e,t){},t})(Hr),Wr=(()=>{function e(){}return e.prototype.addCallback=function(e){},e.prototype.removeCallback=function(e){},e})(),$r=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Fr(t,e),t})(Wr),Jr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Fr(t,e),t})(Wr),Xr=(e=>{function t(){return null!==e&&e.apply(this,arguments)||this}return Fr(t,e),t})(Wr),Qr=new qr,Zr=new Gr,en=new Kr,tn=new Yr,rn=new zr,nn=new $r,on=new Jr,sn=new Xr;function an(){return Qr}(e=>{e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(jr=jr||{});var un,ln={get:function(e,t){if(null!=e)return e[t]},keys:function(e){return null==e?[]:Object.keys(e)}},cn={set:function(e,t,r){null!=e&&(e[t]=r)}},pn=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},dn=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},hn=(()=>{function e(){}return e.prototype.active=function(){return Mr},e.prototype.with=function(e,t,r){for(var n=[],o=3;o<arguments.length;o++)n[o-3]=arguments[o];return t.call.apply(t,dn([r],pn(n),!1))},e.prototype.bind=function(e,t){return t},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e})(),fn=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(void 0===t||0<t--)&&!(n=s.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i},mn=function(e,t,r){if(r||2===arguments.length)for(var n,o=0,s=t.length;o<s;o++)!n&&o in t||((n=n||Array.prototype.slice.call(t,0,o))[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))},gn="context",yn=new hn,_n=(()=>{function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(e){return gr(gn,e,Or.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(e,t,r){for(var n,o=[],s=3;s<arguments.length;s++)o[s-3]=arguments[s];return(n=this._getContextManager()).with.apply(n,mn([e,t,r],fn(o),!1))},e.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},e.prototype._getContextManager=function(){return yr(gn)||yn},e.prototype.disable=function(){this._getContextManager().disable(),_r(gn,Or.instance())},e})(),vn=((e=>{e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(un=un||{}),"0000000000000000"),bn="00000000000000000000000000000000",Sn={traceId:bn,spanId:vn,traceFlags:un.NONE},Tn=(()=>{function e(e){this._spanContext=e=void 0===e?Sn:e}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(e,t){return this},e.prototype.setAttributes=function(e){return this},e.prototype.addEvent=function(e,t){return this},e.prototype.addLink=function(e){return this},e.prototype.addLinks=function(e){return this},e.prototype.setStatus=function(e){return this},e.prototype.updateName=function(e){return this},e.prototype.end=function(e){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(e,t){},e})(),wn=kr("OpenTelemetry Context Key SPAN");function En(e){return e.getValue(wn)||void 0}function An(){return En(_n.getInstance().active())}function On(e,t){return e.setValue(wn,t)}function xn(e){return e.deleteValue(wn)}function Cn(e,t){return On(e,new Tn(t))}function Rn(e){return null==(e=En(e))?void 0:e.spanContext()}var Nn=/^([0-9a-f]{32})$/i,In=/^[0-9a-f]{16}$/i;function Pn(e){return Nn.test(e)&&e!==bn}function Un(e){return In.test(e)&&e!==vn}function kn(e){return Pn(e.traceId)&&Un(e.spanId)}function Ln(e){return new Tn(e)}var Mn,Vn,Bn,jn=_n.getInstance(),Dn=(()=>{function e(){}return e.prototype.startSpan=function(e,t,r){return void 0===r&&(r=jn.active()),!Boolean(null==t?void 0:t.root)&&"object"==typeof(t=r&&Rn(r))&&"string"==typeof t.spanId&&"string"==typeof t.traceId&&"number"==typeof t.traceFlags&&kn(t)?new Tn(t):new Tn},e.prototype.startActiveSpan=function(e,t,r,n){var o,s;if(!(arguments.length<2))return t=2===arguments.length?t:3===arguments.length?(o=t,r):(o=t,s=r,n),s=On(r=null!=s?s:jn.active(),n=this.startSpan(e,o,r)),jn.with(s,t,void 0,n)},e})(),Fn=new Dn,qn=(()=>{function e(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}return e.prototype.startSpan=function(e,t,r){return this._getTracer().startSpan(e,t,r)},e.prototype.startActiveSpan=function(e,t,r,n){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},e.prototype._getTracer=function(){var e;return this._delegate||((e=this._provider.getDelegateTracer(this.name,this.version,this.options))?(this._delegate=e,this._delegate):Fn)},e})(),Hn=new((()=>{function e(){}return e.prototype.getTracer=function(e,t,r){return new Dn},e})()),Gn=(()=>{function e(){}return e.prototype.getTracer=function(e,t,r){var n;return null!=(n=this.getDelegateTracer(e,t,r))?n:new qn(this,e,t,r)},e.prototype.getDelegate=function(){var e;return null!=(e=this._delegate)?e:Hn},e.prototype.setDelegate=function(e){this._delegate=e},e.prototype.getDelegateTracer=function(e,t,r){var n;return null==(n=this._delegate)?void 0:n.getTracer(e,t,r)},e})(),zn=((e=>{e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(Mn=Mn||{}),(e=>{e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"})(Vn=Vn||{}),(e=>{e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"})(Bn=Bn||{}),"[_0-9a-z-*/]"),Kn=new RegExp("^(?:[a-z]"+zn+"{0,255}|[a-z0-9]"+zn+"{0,240}@[a-z]"+zn+"{0,13})$"),Yn=/^[ -~]{0,255}[!-~]$/,Wn=/,|=/,$n=(()=>{function t(e){this._internalState=new Map,e&&this._parse(e)}return t.prototype.set=function(e,t){var r=this._clone();return r._internalState.has(e)&&r._internalState.delete(e),r._internalState.set(e,t),r},t.prototype.unset=function(e){var t=this._clone();return t._internalState.delete(e),t},t.prototype.get=function(e){return this._internalState.get(e)},t.prototype.serialize=function(){var r=this;return this._keys().reduce(function(e,t){return e.push(t+"="+r.get(t)),e},[]).join(",")},t.prototype._parse=function(e){512<e.length||(this._internalState=e.split(",").reverse().reduce(function(e,t){var r,n=t.trim(),o=n.indexOf("=");return-1!==o&&(r=n.slice(0,o),n=n.slice(o+1,t.length),Kn.test(r))&&(o=n,Yn.test(o))&&!Wn.test(o)&&e.set(r,n),e},new Map),32<this._internalState.size&&(this._internalState=new Map(Array.from(this._internalState.entries()).reverse().slice(0,32))))},t.prototype._keys=function(){return Array.from(this._internalState.keys()).reverse()},t.prototype._clone=function(){var e=new t;return e._internalState=new Map(this._internalState),e},t})(),Jn=_n.getInstance(),Xn=Or.instance(),Qn=new((()=>{function e(){}return e.prototype.getMeter=function(e,t,r){return Qr},e})()),Zn="metrics",eo=(()=>{function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalMeterProvider=function(e){return gr(Zn,e,Or.instance())},e.prototype.getMeterProvider=function(){return yr(Zn)||Qn},e.prototype.getMeter=function(e,t,r){return this.getMeterProvider().getMeter(e,t,r)},e.prototype.disable=function(){_r(Zn,Or.instance())},e})(),to=eo.getInstance(),ro=(()=>{function e(){}return e.prototype.inject=function(e,t){},e.prototype.extract=function(e,t){return e},e.prototype.fields=function(){return[]},e})(),no=kr("OpenTelemetry Baggage Key");function oo(e){return e.getValue(no)||void 0}function io(){return oo(_n.getInstance().active())}function so(e,t){return e.setValue(no,t)}function ao(e){return e.deleteValue(no)}var Vo,Bo,uo="propagation",lo=new ro,co=(()=>{function e(){this.createBaggage=Pr,this.getBaggage=oo,this.getActiveBaggage=io,this.setBaggage=so,this.deleteBaggage=ao}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalPropagator=function(e){return gr(uo,e,Or.instance())},e.prototype.inject=function(e,t,r){return void 0===r&&(r=cn),this._getGlobalPropagator().inject(e,t,r)},e.prototype.extract=function(e,t,r){return void 0===r&&(r=ln),this._getGlobalPropagator().extract(e,t,r)},e.prototype.fields=function(){return this._getGlobalPropagator().fields()},e.prototype.disable=function(){_r(uo,Or.instance())},e.prototype._getGlobalPropagator=function(){return yr(uo)||lo},e})(),po=co.getInstance(),ho="trace",fo=(()=>{function e(){this._proxyTracerProvider=new Gn,this.wrapSpanContext=Ln,this.isSpanContextValid=kn,this.deleteSpan=xn,this.getSpan=En,this.getActiveSpan=An,this.getSpanContext=Rn,this.setSpan=On,this.setSpanContext=Cn}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(e){var t=gr(ho,this._proxyTracerProvider,Or.instance());return t&&this._proxyTracerProvider.setDelegate(e),t},e.prototype.getTracerProvider=function(){return yr(ho)||this._proxyTracerProvider},e.prototype.getTracer=function(e,t){return this.getTracerProvider().getTracer(e,t)},e.prototype.disable=function(){_r(ho,Or.instance()),this._proxyTracerProvider=new Gn},e})(),mo=fo.getInstance(),go={context:Jn,diag:Xn,metrics:to,propagation:po,trace:mo},yo=Object.freeze({__proto__:null,context:Jn,diag:Xn,metrics:to,propagation:po,trace:mo,default:go,baggageEntryMetadataFromString:Ur,createContextKey:kr,ROOT_CONTEXT:Mr,DiagConsoleLogger:Br,get DiagLogLevel(){return vr},createNoopMeter:an,get ValueType(){return jr},defaultTextMapGetter:ln,defaultTextMapSetter:cn,ProxyTracer:qn,ProxyTracerProvider:Gn,get SamplingDecision(){return Mn},get SpanKind(){return Vn},get SpanStatusCode(){return Bn},get TraceFlags(){return un},createTraceState:function(e){return new $n(e)},isSpanContextValid:kn,isValidTraceId:Pn,isValidSpanId:Un,INVALID_SPANID:vn,INVALID_TRACEID:bn,INVALID_SPAN_CONTEXT:Sn});let _o=kr("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function vo(e){return null==e||(Array.isArray(e)?(e=>{let t;for(var r of e)if(null!=r){let e=typeof r;if(e!==t){if(t||!bo(e))return!1;t=e}}return!0})(e):bo(typeof e))}function bo(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}let So=e=>{var t;Xn.error("string"==typeof(t=e)?t:JSON.stringify((()=>{let r={},n=t;for(;null!==n;)Object.getOwnPropertyNames(n).forEach(e=>{var t;r[e]||(t=n[e])&&(r[e]=String(t))}),n=Object.getPrototypeOf(n);return r})()))};function To(e){try{So(e)}catch{}}let wo=performance,Eo="exception.message",Ao="exception.type",Oo="service.name",xo="telemetry.sdk.language",Co="webjs",Ro="telemetry.sdk.name",No="telemetry.sdk.version",Io="process.runtime.name",Po={[Ro]:"opentelemetry",[Io]:"browser",[xo]:Co,[No]:"2.2.0"},Uo=Math.pow(10,6),ko=Math.pow(10,9);function Lo(e){return[Math.trunc(e/1e3),Math.round(e%1e3*Uo)]}function jo(){let e=wo.timeOrigin;var t;return"number"!=typeof e&&(t=wo,e=t.timing&&t.timing.fetchStart),e}function Do(e){var t=Lo(jo()),e=Lo("number"==typeof e?e:wo.now());return(t=[t[0]+e[0],t[1]+e[1]])[1]>=ko&&(t[1]-=ko,t[0]+=1),t}function Mo(e){if(t=e,Array.isArray(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1])return e;if("number"==typeof e)return(e<jo()?Do:Lo)(e);if(e instanceof Date)return Lo(e.getTime());throw TypeError("Invalid input type");var t}(e=>{e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(Vo=Vo||{}),(Bo=Bo||{}).HTTP="http";let Fo="[object Null]",qo="[object Undefined]",Ho=Function.prototype.toString,Go=Ho.call(Object),zo=Object.getPrototypeOf,Ko=Object.prototype,Yo=Ko.hasOwnProperty,Wo=Symbol?Symbol.toStringTag:void 0,$o=Ko.toString;function Jo(e){return null!=e&&"object"==typeof e&&"[object Object]"===(t=>{if(null==t)return void 0===t?qo:Fo;if(Wo&&Wo in Object(t)){var r=t,n=Yo.call(r,Wo),o=r[Wo];let e=!1;try{r[Wo]=void 0,e=!0}catch{}var s=$o.call(r);return e&&(n?r[Wo]=o:delete r[Wo]),s}return n=t,$o.call(n)})(e)&&(null===(e=zo(e))||"function"==typeof(e=Yo.call(e,"constructor")&&e.constructor)&&e instanceof e&&Ho.call(e)===Go)}function Xo(e){return ei(e)?e.slice():e}function Qo(r,n,o=0,s){let i;if(!(20<o)){if(o++,ni(r)||ni(n)||ti(n))i=Xo(n);else if(ei(r)){if(i=r.slice(),ei(n))for(let e=0,t=n.length;e<t;e++)i.push(Xo(n[e]));else if(ri(n)){let r=Object.keys(n);for(let t=0,e=r.length;t<e;t++){let e=r[t];i[e]=Xo(n[e])}}}else if(ri(r))if(ri(n)){if(e=n,!Jo(r)||!Jo(e))return n;i=Object.assign({},r);var a=Object.keys(n);for(let e=0,t=a.length;e<t;e++){var u=a[e],l=n[u];if(ni(l))void 0===l?delete i[u]:i[u]=l;else{var c=i[u],p=l;if(Zo(r,u,s)||Zo(n,u,s))delete i[u];else{if(ri(c)&&ri(p)){let e=s.get(c)||[],t=s.get(p)||[];e.push({obj:r,key:u}),t.push({obj:n,key:u}),s.set(c,e),s.set(p,t)}i[u]=Qo(i[u],l,o,s)}}}}else i=n;return i}var e}function Zo(r,n,e){var o=e.get(r[n])||[];for(let e=0,t=o.length;e<t;e++){var s=o[e];if(s.key===n&&s.obj===r)return!0}return!1}function ei(e){return Array.isArray(e)}function ti(e){return"function"==typeof e}function ri(e){return!ni(e)&&!ei(e)&&!ti(e)&&"object"==typeof e}function ni(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e||e instanceof Date||e instanceof RegExp||null===e}class oi extends Error{constructor(e){super(e),Object.setPrototypeOf(this,oi.prototype)}}function ii(e,r){let n;var t=new Promise(function(e,t){n=setTimeout(function(){t(new oi("Operation timed out."))},r)});return Promise.race([e,t]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}class si{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class ai{_callback;_that;_isCalled=!1;_deferred=new si;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}vr.ALL,vr.VERBOSE,vr.DEBUG,vr.INFO,vr.WARN,vr.ERROR,vr.NONE;let ui={_export:function(e,r){return new Promise(t=>{Jn.with(Jn.active().setValue(_o,!0),()=>{e.export(r,e=>{t(e)})})})}};function li(){return{handleResponse(e){null!=e&&Object.prototype.hasOwnProperty.call(e,"partialSuccess")&&null!=e.partialSuccess&&0!==Object.keys(e.partialSuccess).length&&Xn.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}class ci{_transport;_serializer;_responseHandler;_promiseQueue;_timeout;_diagLogger;constructor(e,t,r,n,o){this._transport=e,this._serializer=t,this._responseHandler=r,this._promiseQueue=n,this._timeout=o,this._diagLogger=Xn.createComponentLogger({namespace:"OTLPExportDelegate"})}export(e,r){this._diagLogger.debug("items to be sent",e),this._promiseQueue.hasReachedLimit()?r({code:Vo.FAILED,error:new Error("Concurrent export limit reached")}):null!=(e=this._serializer.serializeRequest(e))?this._promiseQueue.pushPromise(this._transport.send(e,this._timeout).then(t=>{if("success"!==t.status)"failure"===t.status&&t.error?r({code:Vo.FAILED,error:t.error}):"retryable"===t.status?r({code:Vo.FAILED,error:new or("Export failed with retryable status")}):r({code:Vo.FAILED,error:new or("Export failed with unknown error")});else{if(null!=t.data)try{this._responseHandler.handleResponse(this._serializer.deserializeResponse(t.data))}catch(e){this._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",e,t.data)}r({code:Vo.SUCCESS})}},e=>r({code:Vo.FAILED,error:e}))):r({code:Vo.FAILED,error:new Error("Nothing to send")})}forceFlush(){return this._promiseQueue.awaitAll()}async shutdown(){this._diagLogger.debug("shutdown started"),await this.forceFlush(),this._transport.shutdown()}}function pi(e,t,r){return r={transport:r,serializer:t,promiseHandler:ur(e)},t={timeout:e.timeoutMillis},new ci(r.transport,r.serializer,li(),r.promiseHandler,t.timeout)}var di,hi,yi,_i,vi,bi,Si,Ti,wi,fi={exports:{}},mi={},gi={},Ei={};function Ai(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Oi,xi,Ci,Ri,Ni,Pi,Ui,Ii={},ki={exports:{}};function Li(){if(!Pi){Pi=1;var e=ki,t=ki.exports,r=t,h=(Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,null);try{h=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function n(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function d(e){return!0===(e&&e.__isLong__)}function o(e){var t=Math.clz32(e&-e);return e?31-t:t}Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=d;var s={},i={};function a(e,t){var r,n,o;return t?(o=0<=(e>>>=0)&&e<256)&&(n=i[e])?n:(r=m(e,0,!0),o&&(i[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(n=s[e])?n:(r=m(e,e<0?-1:0,!1),o&&(s[e]=r),r)}function f(e,t){if(isNaN(e))return t?b:v;if(t){if(e<0)return b;if(p<=e)return A}else{if(e<=-y)return O;if(y<=e+1)return E}return e<0?f(-e,t).neg():m(e%u|0,e/u|0,t)}function m(e,t,r){return new n(e,t,r)}n.fromInt=a,n.fromNumber=f,n.fromBits=m;var l=Math.pow;function c(e,t,r){if(0===e.length)throw Error("empty string");if(t="number"==typeof t?(r=t,!1):!!t,"NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t?b:v;if((r=r||10)<2||36<r)throw RangeError("radix");var n;if(0<(n=e.indexOf("-")))throw Error("interior hyphen");if(0===n)return c(e.substring(1),t,r).neg();for(var o=f(l(r,8)),s=v,i=0;i<e.length;i+=8){var a=Math.min(8,e.length-i),u=parseInt(e.substring(i,i+a),r);s=(a<8?(a=f(l(r,a)),s.mul(a)):s=s.mul(o)).add(f(u))}return s.unsigned=t,s}function g(e,t){return"number"==typeof e?f(e,t):"string"==typeof e?c(e,t):m(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}n.fromString=c,n.fromValue=g;var u=4294967296,p=u*u,y=p/2,_=a(1<<24),v=a(0),b=(n.ZERO=v,a(0,!0)),S=(n.UZERO=b,a(1)),T=(n.ONE=S,a(1,!0)),w=(n.UONE=T,a(-1)),E=(n.NEG_ONE=w,m(-1,2147483647,!1)),A=(n.MAX_VALUE=E,m(-1,-1,!0)),O=(n.MAX_UNSIGNED_VALUE=A,m(0,-2147483648,!1)),x=(n.MIN_VALUE=O,n.prototype);x.toInt=function(){return this.unsigned?this.low>>>0:this.low},x.toNumber=function(){return this.unsigned?(this.high>>>0)*u+(this.low>>>0):this.high*u+(this.low>>>0)},x.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";var t,r;if(this.isNegative())return this.eq(O)?(r=f(e),r=(t=this.div(r)).mul(r).sub(this),t.toString(e)+r.toInt().toString(e)):"-"+this.neg().toString(e);for(var n=f(l(e,6),this.unsigned),o=this,s="";;){var i=o.div(n),a=(o.sub(i.mul(n)).toInt()>>>0).toString(e);if((o=i).isZero())return a+s;for(;a.length<6;)a="0"+a;s=""+a+s}},x.getHighBits=function(){return this.high},x.getHighBitsUnsigned=function(){return this.high>>>0},x.getLowBits=function(){return this.low},x.getLowBitsUnsigned=function(){return this.low>>>0},x.getNumBitsAbs=function(){if(this.isNegative())return this.eq(O)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;0<t&&!(e&1<<t);t--);return 0!=this.high?t+33:t+1},x.isSafeInteger=function(){var e=this.high>>21;return!e||!this.unsigned&&-1==e&&!(0===this.low&&-2097152===this.high)},x.isZero=function(){return 0===this.high&&0===this.low},x.eqz=x.isZero,x.isNegative=function(){return!this.unsigned&&this.high<0},x.isPositive=function(){return this.unsigned||0<=this.high},x.isOdd=function(){return!(1&~this.low)},x.isEven=function(){return!(1&this.low)},x.equals=function(e){return d(e)||(e=g(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},x.eq=x.equals,x.notEquals=function(e){return!this.eq(e)},x.neq=x.notEquals,x.ne=x.notEquals,x.lessThan=function(e){return this.comp(e)<0},x.lt=x.lessThan,x.lessThanOrEqual=function(e){return this.comp(e)<=0},x.lte=x.lessThanOrEqual,x.le=x.lessThanOrEqual,x.greaterThan=function(e){return 0<this.comp(e)},x.gt=x.greaterThan,x.greaterThanOrEqual=function(e){return 0<=this.comp(e)},x.gte=x.greaterThanOrEqual,x.ge=x.greaterThanOrEqual,x.compare=function(e){var t,r;return d(e)||(e=g(e)),this.eq(e)?0:(t=this.isNegative(),r=e.isNegative(),t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1)},x.comp=x.compare,x.negate=function(){return!this.unsigned&&this.eq(O)?O:this.not().add(S)},x.neg=x.negate,x.add=function(e){d(e)||(e=g(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,s=e.high>>>16,i=65535&e.high,a=e.low>>>16,u=0,l=0,c=0,p=0;return l+=(c=c+((p+=o+(65535&e.low))>>>16)+(n+a))>>>16,m((c&=65535)<<16|(p&=65535),((u+=(l+=r+i)>>>16)+(t+s)&65535)<<16|(l&=65535),this.unsigned)},x.subtract=function(e){return d(e)||(e=g(e)),this.add(e.neg())},x.sub=x.subtract,x.multiply=function(e){var t,r,n,o,s,i,a,u,l,c,p;return this.isZero()?this:(d(e)||(e=g(e)),h?m(h.mul(this.low,this.high,e.low,e.high),h.get_high(),this.unsigned):e.isZero()?this.unsigned?b:v:this.eq(O)?e.isOdd()?O:v:e.eq(O)?this.isOdd()?O:v:this.isNegative()?e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg():e.isNegative()?this.mul(e.neg()).neg():this.lt(_)&&e.lt(_)?f(this.toNumber()*e.toNumber(),this.unsigned):(t=this.high>>>16,r=65535&this.high,n=this.low>>>16,o=65535&this.low,s=e.high>>>16,i=65535&e.high,a=e.low>>>16,p=(p=c=l=u=0)+((l=l+((c+=o*(e=65535&e.low))>>>16)+n*e)>>>16)+((l=(l&65535)+o*a)>>>16),m((l&=65535)<<16|(c&=65535),(u=(u=(u+=(p+=r*e)>>>16)+((p=(p&65535)+n*a)>>>16)+((p=(p&65535)+o*i)>>>16))+(t*e+r*a+n*i+o*s)&65535)<<16|(p&=65535),this.unsigned)))},x.mul=x.multiply,x.divide=function(e){if((e=d(e)?e:g(e)).isZero())throw Error("division by zero");var t,r;if(h)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?m((this.unsigned?h.div_u:h.div_s)(this.low,this.high,e.low,e.high),h.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?b:v;if(this.unsigned){if((e=e.unsigned?e:e.toUnsigned()).gt(this))return b;if(e.gt(this.shru(1)))return T;r=b}else{if(this.eq(O))return e.eq(S)||e.eq(w)?O:e.eq(O)?S:(n=this.shr(1).div(e).shl(1)).eq(v)?e.isNegative()?S:w:(t=this.sub(e.mul(n)),n.add(t.div(e)));if(e.eq(O))return this.unsigned?b:v;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();r=v}for(t=this;t.gte(e);){for(var n=Math.max(1,Math.floor(t.toNumber()/e.toNumber())),o=Math.ceil(Math.log(n)/Math.LN2),s=o<=48?1:l(2,o-48),i=f(n),a=i.mul(e);a.isNegative()||a.gt(t);)a=(i=f(n-=s,this.unsigned)).mul(e);i.isZero()&&(i=S),r=r.add(i),t=t.sub(a)}return r},x.div=x.divide,x.modulo=function(e){return d(e)||(e=g(e)),h?m((this.unsigned?h.rem_u:h.rem_s)(this.low,this.high,e.low,e.high),h.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},x.mod=x.modulo,x.rem=x.modulo,x.not=function(){return m(~this.low,~this.high,this.unsigned)},x.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},x.clz=x.countLeadingZeros,x.countTrailingZeros=function(){return this.low?o(this.low):o(this.high)+32},x.ctz=x.countTrailingZeros,x.and=function(e){return d(e)||(e=g(e)),m(this.low&e.low,this.high&e.high,this.unsigned)},x.or=function(e){return d(e)||(e=g(e)),m(this.low|e.low,this.high|e.high,this.unsigned)},x.xor=function(e){return d(e)||(e=g(e)),m(this.low^e.low,this.high^e.high,this.unsigned)},x.shiftLeft=function(e){return d(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?m(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):m(0,this.low<<e-32,this.unsigned)},x.shl=x.shiftLeft,x.shiftRight=function(e){return d(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?m(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):m(this.high>>e-32,0<=this.high?0:-1,this.unsigned)},x.shr=x.shiftRight,x.shiftRightUnsigned=function(e){return d(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?m(this.low>>>e|this.high<<32-e,this.high>>>e,this.unsigned):m(32===e?this.high:this.high>>>e-32,0,this.unsigned)},x.shru=x.shiftRightUnsigned,x.shr_u=x.shiftRightUnsigned,x.rotateLeft=function(e){var t;return d(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?m(this.high,this.low,this.unsigned):e<32?m(this.low<<e|this.high>>>(t=32-e),this.high<<e|this.low>>>t,this.unsigned):(t=32-(e-=32),m(this.high<<e|this.low>>>t,this.low<<e|this.high>>>t,this.unsigned))},x.rotl=x.rotateLeft,x.rotateRight=function(e){var t;return d(e)&&(e=e.toInt()),0==(e&=63)?this:32===e?m(this.high,this.low,this.unsigned):e<32?m(this.high<<(t=32-e)|this.low>>>e,this.low<<t|this.high>>>e,this.unsigned):(t=32-(e-=32),m(this.low<<t|this.high>>>e,this.high<<t|this.low>>>e,this.unsigned))},x.rotr=x.rotateRight,x.toSigned=function(){return this.unsigned?m(this.low,this.high,!1):this},x.toUnsigned=function(){return this.unsigned?this:m(this.low,this.high,!0)},x.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},x.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},x.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},n.fromBytes=function(e,t,r){return r?n.fromBytesLE(e,t):n.fromBytesBE(e,t)},n.fromBytesLE=function(e,t){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},n.fromBytesBE=function(e,t){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)},"function"==typeof BigInt&&(n.fromBigInt=function(e,t){return m(Number(BigInt.asIntN(32,e)),Number(BigInt.asIntN(32,e>>BigInt(32))),t)},n.fromValue=function(e,t){return"bigint"==typeof e?n.fromBigInt(e,t):g(e,t)},x.toBigInt=function(){var e=BigInt(this.low>>>0);return BigInt(this.unsigned?this.high>>>0:this.high)<<BigInt(32)|e}),r.default=n,e.exports=t.default||t}return ki.exports}function ji(){return Ui||(Ui=1,(p=gi).asPromise=(hi||(hi=1,di=function(e,t){for(var r=new Array(arguments.length-1),s=0,n=2,i=!0;n<arguments.length;)r[s++]=arguments[n++];return new Promise(function(n,o){r[s]=function(e){if(i)if(i=!1,e)o(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];n.apply(null,t)}};try{e.apply(t||null,r)}catch(e){i&&(i=!1,o(e))}})}),di),p.base64=(yi||(yi=1,(()=>{var e=Ei;e.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;1<--t%4&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var l=new Array(64),u=new Array(123),t=0;t<64;)u[l[t]=t<26?t+65:t<52?t+71:t<62?t-4:t-59|43]=t++;e.encode=function(e,t,r){for(var n,o=null,s=[],i=0,a=0;t<r;){var u=e[t++];switch(a){case 0:s[i++]=l[u>>2],n=(3&u)<<4,a=1;break;case 1:s[i++]=l[n|u>>4],n=(15&u)<<2,a=2;break;case 2:s[i++]=l[n|u>>6],s[i++]=l[63&u],a=0}8191<i&&((o=o||[]).push(String.fromCharCode.apply(String,s)),i=0)}return a&&(s[i++]=l[n],s[i++]=61,1===a)&&(s[i++]=61),o?(i&&o.push(String.fromCharCode.apply(String,s.slice(0,i))),o.join("")):String.fromCharCode.apply(String,s.slice(0,i))};var c="invalid encoding";e.decode=function(e,t,r){for(var n,o=r,s=0,i=0;i<e.length;){var a=e.charCodeAt(i++);if(61===a&&1<s)break;if(void 0===(a=u[a]))throw Error(c);switch(s){case 0:n=a,s=1;break;case 1:t[r++]=n<<2|(48&a)>>4,n=a,s=2;break;case 2:t[r++]=(15&n)<<4|(60&a)>>2,n=a,s=3;break;case 3:t[r++]=(3&n)<<6|a,s=0}}if(1===s)throw Error(c);return r-o},e.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}})()),Ei),p.EventEmitter=(vi||(vi=1,(_i=s).prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},s.prototype.off=function(e,t){if(void 0===e)this._listeners=Object.create(null);else if(void 0===t)this._listeners[e]=[];else{var r=this._listeners[e];if(!r)return this;for(var n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n}return this},s.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}),_i),p.float=Si?bi:(Si=1,bi=t(t)),p.inquire=wi?Ti:(wi=1,Ti=function(e){try{var t=Ai(e);return t&&(t.length||Object.keys(t).length)?t:null}catch(e){return null}}),p.utf8=(Oi||(Oi=1,(c=Ii).length=function(e){for(var t,r=0,n=0;n<e.length;++n)(t=e.charCodeAt(n))<128?r+=1:t<2048?r+=2:55296==(64512&t)&&56320==(64512&e.charCodeAt(n+1))?(++n,r+=4):r+=3;return r},c.read=function(e,t,r){if(r-t<1)return"";for(var n="",o=t;o<r;){var s,i=e[o++];i<=127?n+=String.fromCharCode(i):192<=i&&i<224?n+=128<=(s=(31&i)<<6|63&e[o++])?String.fromCharCode(s):"�":224<=i&&i<240?n+=2048<=(s=(15&i)<<12|(63&e[o++])<<6|63&e[o++])?String.fromCharCode(s):"�":240<=i&&((i=(7&i)<<18|(63&e[o++])<<12|(63&e[o++])<<6|63&e[o++])<65536||1114111<i?n+="�":(i-=65536,n=(n+=String.fromCharCode(55296+(i>>10)))+String.fromCharCode(56320+(1023&i))))}return n},c.write=function(e,t,r){for(var n,o,s=r,i=0;i<e.length;++i)(n=e.charCodeAt(i))<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(55296==(64512&n)&&56320==(64512&(o=e.charCodeAt(i+1)))?(++i,t[r++]=(n=65536+((1023&n)<<10)+(1023&o))>>18|240,t[r++]=n>>12&63|128):t[r++]=n>>12|224,t[r++]=n>>6&63|128),t[r++]=63&n|128);return r-s}),Ii),p.pool=(Ci||(Ci=1,xi=function(t,r,e){var n=e||8192,o=n>>>1,s=null,i=n;return function(e){if(e<1||o<e)return t(e);n<i+e&&(s=t(n),i=0);e=r.call(s,i,i+=e);return 7&i&&(i=1+(7|i)),e}}),xi),p.LongBits=(Ni||(Ni=1,Ri=o,i=ji(),(u=o.zero=new o(0,0)).toNumber=function(){return 0},u.zzEncode=u.zzDecode=function(){return this},u.length=function(){return 1},o.zeroHash="\0\0\0\0\0\0\0\0",o.fromNumber=function(e){var t,r;return 0===e?u:(r=(e=(t=e<0)?-e:e)>>>0,e=(e-r)/4294967296>>>0,t&&(e=~e>>>0,r=~r>>>0,4294967295<++r)&&(r=0,4294967295<++e)&&(e=0),new o(r,e))},o.from=function(e){if("number"==typeof e)return o.fromNumber(e);if(i.isString(e)){if(!i.Long)return o.fromNumber(parseInt(e,10));e=i.Long.fromString(e)}return e.low||e.high?new o(e.low>>>0,e.high>>>0):u},o.prototype.toNumber=function(e){var t;return!e&&this.hi>>>31?(e=1+~this.lo>>>0,t=~this.hi>>>0,-(e+4294967296*(t=e?t:t+1>>>0))):this.lo+4294967296*this.hi},o.prototype.toLong=function(e){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}},l=String.prototype.charCodeAt,o.fromHash=function(e){return"\0\0\0\0\0\0\0\0"===e?u:new o((l.call(e,0)|l.call(e,1)<<8|l.call(e,2)<<16|l.call(e,3)<<24)>>>0,(l.call(e,4)|l.call(e,5)<<8|l.call(e,6)<<16|l.call(e,7)<<24)>>>0)},o.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},o.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},o.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},o.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0==r?0==t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}),Ri),p.isUnsafeProperty=a,p.isNode=Boolean(void 0!==r&&r&&r.process&&r.process.versions&&r.process.versions.node),p.global=p.isNode&&r||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||r,p.emptyArray=Object.freeze?Object.freeze([]):[],p.emptyObject=Object.freeze?Object.freeze({}):{},p.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},p.isString=function(e){return"string"==typeof e||e instanceof String},p.isObject=function(e){return e&&"object"==typeof e},p.isset=p.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||0<(Array.isArray(r)?r:Object.keys(r)).length)},p.Buffer=(()=>{try{var e=p.global.Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}})(),p._Buffer_from=null,p._Buffer_allocUnsafe=null,p.newBuffer=function(e){return"number"==typeof e?p.Buffer?p._Buffer_allocUnsafe(e):new p.Array(e):p.Buffer?p._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},p.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,p.Long=p.global.dcodeIO&&p.global.dcodeIO.Long||p.global.Long||(()=>{try{var e=Li();return e&&e.isLong?e:null}catch(e){return null}})(),p.key2Re=/^true|false|0|1$/,p.key32Re=/^-?(?:0|[1-9][0-9]*)$/,p.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,p.longToHash=function(e){return e?p.LongBits.from(e).toHash():p.LongBits.zeroHash},p.longFromHash=function(e,t){e=p.LongBits.fromHash(e);return p.Long?p.Long.fromBits(e.lo,e.hi,t):e.toNumber(Boolean(t))},p.merge=n,p.nestingLimit=32,p.recursionLimit=100,p.makeProp=function(e,t){Object.defineProperty(e,t,{enumerable:!0,configurable:!0,writable:!0})},p.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},p.newError=e,p.ProtocolError=e("ProtocolError"),p.oneOfGetter=function(e){for(var r={},t=0;t<e.length;++t)r[e[t]]=1;return function(){for(var e=Object.keys(this),t=e.length-1;-1<t;--t)if(1===r[e[t]]&&null!=this[e[t]])return e[t]}},p.oneOfSetter=function(r){return function(e){for(var t=0;t<r.length;++t)r[t]!==e&&delete this[r[t]]}},p.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},p._configure=function(){var r=p.Buffer;r?(p._Buffer_from=r.from!==Uint8Array.from&&r.from||function(e,t){return new r(e,t)},p._Buffer_allocUnsafe=r.allocUnsafe||function(e){return new r(e)}):p._Buffer_from=p._Buffer_allocUnsafe=null}),gi;function a(e){return"__proto__"===e||"prototype"===e||"constructor"===e}function n(e){for(var t=(r="boolean"==typeof arguments[arguments.length-1])?arguments.length-1:arguments.length,r=r&&arguments[arguments.length-1],n=1;n<t;++n){var o=arguments[n];if(o)for(var s=Object.keys(o),i=0;i<s.length;++i)a(s[i])||void 0!==e[s[i]]&&r||(e[s[i]]=o[s[i]])}return e}function e(e){function r(e,t){if(!(this instanceof r))return new r(e,t);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,r):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),t&&n(this,t)}return r.prototype=Object.create(Error.prototype,{constructor:{value:r,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),r}function o(e,t){this.lo=e>>>0,this.hi=t>>>0}function t(e){return"undefined"!=typeof Float32Array?(l=new Float32Array([-0]),c=new Uint8Array(l.buffer),p=128===c[3],e.writeFloatLE=p?f:m,e.writeFloatBE=p?m:f,e.readFloatLE=p?g:y,e.readFloatBE=p?y:g):(e.writeFloatLE=h.bind(null,_),e.writeFloatBE=h.bind(null,v),e.readFloatLE=d.bind(null,b),e.readFloatBE=d.bind(null,S)),"undefined"!=typeof Float64Array?(a=new Float64Array([-0]),u=new Uint8Array(a.buffer),p=128===u[7],e.writeDoubleLE=p?n:o,e.writeDoubleBE=p?o:n,e.readDoubleLE=p?s:i,e.readDoubleBE=p?i:s):(e.writeDoubleLE=t.bind(null,_,0,4),e.writeDoubleBE=t.bind(null,v,4,0),e.readDoubleLE=r.bind(null,b,0,4),e.readDoubleBE=r.bind(null,S,4,0)),e;function t(e,t,r,n,o,s){var i,a,u=n<0?1:0;0===(n=u?-n:n)?(e(0,o,s+t),e(0<1/n?0:2147483648,o,s+r)):isNaN(n)?(e(0,o,s+t),e(2146959360,o,s+r)):17976931348623157e292<n?(e(0,o,s+t),e((u<<31|2146435072)>>>0,o,s+r)):n<22250738585072014e-324?(e((i=n/5e-324)>>>0,o,s+t),e((u<<31|i/4294967296)>>>0,o,s+r)):(1024===(a=Math.floor(Math.log(n)/Math.LN2))&&(a=1023),e(4503599627370496*(i=n*Math.pow(2,-a))>>>0,o,s+t),e((u<<31|a+1023<<20|1048576*i&1048575)>>>0,o,s+r))}function r(e,t,r,n,o){t=e(n,o+t),e=e(n,o+r),n=2*(e>>31)+1,o=e>>>20&2047,r=4294967296*(1048575&e)+t;return 2047==o?r?NaN:1/0*n:0==o?5e-324*n*r:n*Math.pow(2,o-1075)*(r+4503599627370496)}function n(e,t,r){a[0]=e,t[r]=u[0],t[r+1]=u[1],t[r+2]=u[2],t[r+3]=u[3],t[r+4]=u[4],t[r+5]=u[5],t[r+6]=u[6],t[r+7]=u[7]}function o(e,t,r){a[0]=e,t[r]=u[7],t[r+1]=u[6],t[r+2]=u[5],t[r+3]=u[4],t[r+4]=u[3],t[r+5]=u[2],t[r+6]=u[1],t[r+7]=u[0]}function s(e,t){return u[0]=e[t],u[1]=e[t+1],u[2]=e[t+2],u[3]=e[t+3],u[4]=e[t+4],u[5]=e[t+5],u[6]=e[t+6],u[7]=e[t+7],a[0]}function i(e,t){return u[7]=e[t],u[6]=e[t+1],u[5]=e[t+2],u[4]=e[t+3],u[3]=e[t+4],u[2]=e[t+5],u[1]=e[t+6],u[0]=e[t+7],a[0]}var a,u,l,c,p;function h(e,t,r,n){var o=t<0?1:0;0===(t=o?-t:t)?e(0<1/t?0:2147483648,r,n):isNaN(t)?e(2143289344,r,n):e(34028234663852886e22<t?(o<<31|2139095040)>>>0:t<11754943508222875e-54?(o<<31|Math.round(t/1401298464324817e-60))>>>0:(o<<31|(e=Math.floor(Math.log(t)/Math.LN2))+127<<23|8388607&Math.round(t*Math.pow(2,-e)*8388608))>>>0,r,n)}function d(e,t,r){e=e(t,r),t=2*(e>>31)+1,r=e>>>23&255,e&=8388607;return 255==r?e?NaN:1/0*t:0==r?1401298464324817e-60*t*e:t*Math.pow(2,r-150)*(8388608+e)}function f(e,t,r){l[0]=e,t[r]=c[0],t[r+1]=c[1],t[r+2]=c[2],t[r+3]=c[3]}function m(e,t,r){l[0]=e,t[r]=c[3],t[r+1]=c[2],t[r+2]=c[1],t[r+3]=c[0]}function g(e,t){return c[0]=e[t],c[1]=e[t+1],c[2]=e[t+2],c[3]=e[t+3],l[0]}function y(e,t){return c[3]=e[t],c[2]=e[t+1],c[1]=e[t+2],c[0]=e[t+3],l[0]}}function _(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function v(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function b(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function S(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function s(){this._listeners=Object.create(null)}var i,u,l,c,p}var Di,Mi=Ki,Vi=ji(),Bi=Vi.LongBits,Fi=Vi.base64,qi=Vi.utf8;function Hi(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function Gi(){}function zi(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function Ki(){this.len=0,this.head=new Hi(Gi,0,0),this.tail=this.head,this.states=null}var Yi=function(){return Vi.Buffer?function(){return(Ki.create=function(){return new Di})()}:function(){return new Ki}};function Wi(e,t,r){t[r]=255&e}function $i(e,t){this.len=e,this.next=void 0,this.val=t}function Ji(e,t,r){for(var n=e.lo,o=e.hi;o;)t[r++]=127&n|128,n=(n>>>7|o<<25)>>>0,o>>>=7;for(;127<n;)t[r++]=127&n|128,n>>>=7;t[r++]=n}function Xi(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}Ki.create=Yi(),Ki.alloc=function(e){return new Vi.Array(e)},Vi.Array!==Array&&(Ki.alloc=Vi.pool(Ki.alloc,Vi.Array.prototype.subarray)),Ki.prototype._push=function(e,t,r){return this.tail=this.tail.next=new Hi(e,t,r),this.len+=t,this},$i.prototype=Object.create(Hi.prototype),$i.prototype.fn=function(e,t,r){for(;127<e;)t[r++]=127&e|128,e>>>=7;t[r]=e},Ki.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new $i((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},Ki.prototype.int32=function(e){return(e|=0)<0?this._push(Ji,10,Bi.fromNumber(e)):this.uint32(e)},Ki.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},Ki.prototype.uint64=function(e){e=Bi.from(e);return this._push(Ji,e.length(),e)},Ki.prototype.int64=Ki.prototype.uint64,Ki.prototype.sint64=function(e){e=Bi.from(e).zzEncode();return this._push(Ji,e.length(),e)},Ki.prototype.bool=function(e){return this._push(Wi,1,e?1:0)},Ki.prototype.fixed32=function(e){return this._push(Xi,4,e>>>0)},Ki.prototype.sfixed32=Ki.prototype.fixed32,Ki.prototype.fixed64=function(e){e=Bi.from(e);return this._push(Xi,4,e.lo)._push(Xi,4,e.hi)},Ki.prototype.sfixed64=Ki.prototype.fixed64,Ki.prototype.float=function(e){return this._push(Vi.float.writeFloatLE,4,e)},Ki.prototype.double=function(e){return this._push(Vi.float.writeDoubleLE,8,e)};var Qi=Vi.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]},Zi=(Ki.prototype.bytes=function(e){var t,r=e.length>>>0;return r?(Vi.isString(e)&&(t=Ki.alloc(r=Fi.length(e)),Fi.decode(e,t,0),e=t),this.uint32(r)._push(Qi,r,e)):this._push(Wi,1,0)},Ki.prototype.string=function(e){var t=qi.length(e);return t?this.uint32(t)._push(qi.write,t,e):this._push(Wi,1,0)},Ki.prototype.fork=function(){return this.states=new zi(this),this.head=this.tail=new Hi(Gi,0,0),this.len=0,this},Ki.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Hi(Gi,0,0),this.len=0),this},Ki.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},Ki.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},Ki._configure=function(e){Di=e,Ki.create=Yi(),Di._configure()},rs),es=Mi,ts=((rs.prototype=Object.create(es.prototype)).constructor=rs,ji());function rs(){es.call(this)}function ns(e,t,r){e.length<40?ts.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}rs._configure=function(){rs.alloc=ts._Buffer_allocUnsafe,rs.writeBytesBuffer=ts.Buffer&&ts.Buffer.prototype instanceof Uint8Array&&"set"===ts.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]}},rs.prototype.bytes=function(e){var t=(e=ts.isString(e)?ts._Buffer_from(e,"base64"):e).length>>>0;return this.uint32(t),t&&this._push(rs.writeBytesBuffer,t,e),this},rs.prototype.string=function(e){var t=ts.Buffer.byteLength(e);return this.uint32(t),t&&this._push(ns,t,e),this},rs._configure();var os,is=cs,ss=ji(),as=ss.LongBits,us=ss.utf8;function ls(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function cs(e){this.buf=e,this.pos=0,this.len=e.length}var ps,ds="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new cs(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new cs(e);throw Error("illegal buffer")},hs=function(){return ss.Buffer?function(e){return(cs.create=function(e){return ss.Buffer.isBuffer(e)?new os(e):ds(e)})(e)}:ds};function fs(){var e=new as(0,0),t=0;if(!(4<this.len-this.pos)){for(;t<3;++t){if(this.pos>=this.len)throw ls(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,4<this.len-this.pos){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw ls(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function ms(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function gs(){if(this.pos+8>this.len)throw ls(this,8);return new as(ms(this.buf,this.pos+=4),ms(this.buf,this.pos+=4))}cs.create=hs(),cs.prototype._slice=ss.Array.prototype.subarray||ss.Array.prototype.slice,cs.prototype.uint32=(ps=4294967295,function(){if(ps=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(ps=(ps|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(ps=(ps|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(ps=(ps|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(ps=(ps|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)||!((this.pos+=5)>this.len))return ps;throw this.pos=this.len,ls(this,10)}),cs.prototype.int32=function(){return 0|this.uint32()},cs.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)},cs.prototype.bool=function(){return 0!==this.uint32()},cs.prototype.fixed32=function(){if(this.pos+4>this.len)throw ls(this,4);return ms(this.buf,this.pos+=4)},cs.prototype.sfixed32=function(){if(this.pos+4>this.len)throw ls(this,4);return 0|ms(this.buf,this.pos+=4)},cs.prototype.float=function(){if(this.pos+4>this.len)throw ls(this,4);var e=ss.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},cs.prototype.double=function(){if(this.pos+8>this.len)throw ls(this,4);var e=ss.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},cs.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw ls(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?(e=ss.Buffer)?e.alloc(0):new this.buf.constructor(0):this._slice.call(this.buf,t,r)},cs.prototype.string=function(){var e=this.bytes();return us.read(e,0,e.length)},cs.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw ls(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw ls(this)}while(128&this.buf[this.pos++]);return this},cs.recursionLimit=ss.recursionLimit,cs.prototype.skipType=function(e,t){if((t=void 0===t?0:t)>cs.recursionLimit)throw Error("maximum nesting depth exceeded");switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e,t+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},cs._configure=function(e){os=e,cs.create=hs(),os._configure();var t=ss.Long?"toLong":"toNumber";ss.merge(cs.prototype,{int64:function(){return fs.call(this)[t](!1)},uint64:function(){return fs.call(this)[t](!0)},sint64:function(){return fs.call(this).zzDecode()[t](!1)},fixed64:function(){return gs.call(this)[t](!0)},sfixed64:function(){return gs.call(this)[t](!1)}})};var ys=bs,_s=is,vs=((bs.prototype=Object.create(_s.prototype)).constructor=bs,ji());function bs(e){_s.call(this,e)}bs._configure=function(){vs.Buffer&&(bs.prototype._slice=vs.Buffer.prototype.slice)},bs.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},bs._configure();var Ss={},Ts=Es,ws=ji();function Es(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");ws.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}((Es.prototype=Object.create(ws.EventEmitter.prototype)).constructor=Es).prototype.rpcCall=function e(r,t,n,o,s){if(!o)throw TypeError("request must be specified");var i=this;if(!s)return ws.asPromise(e,i,r,t,n,o);if(i.rpcImpl)try{return i.rpcImpl(r,t[i.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(e,t){if(e)return i.emit("error",e,r),s(e);if(null!==t){if(!(t instanceof n))try{t=n[i.responseDelimited?"decodeDelimited":"decode"](t)}catch(e){return i.emit("error",e,r),s(e)}return i.emit("data",t,r),s(null,t)}i.end(!0)})}catch(e){i.emit("error",e,r),setTimeout(function(){s(e)},0)}else setTimeout(function(){s(Error("already ended"))},0)},Es.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},Ss.Service=Ts;var As=Object.create(null);(()=>{var e=mi;function t(){e.util._configure(),e.Writer._configure(e.BufferWriter),e.Reader._configure(e.BufferReader)}e.build="minimal",e.Writer=Mi,e.BufferWriter=Zi,e.Reader=is,e.BufferReader=ys,e.util=ji(),e.rpc=Ss,e.roots=As,e.configure=t,t()})();var Os,xs,Cs,Rs,Ns,Zs,ea,ta,ra,da,ya,Is=fi.exports=mi,Ps=Is.Reader,Us=Is.Writer,ks=Is.util,Ls=Is.roots.default||(Is.roots.default={}),js=(Ls.opentelemetry=((Ns={}).proto=((Rs={}).common=(()=>{var e,t,r={};return r.v1=((e={}).AnyValue=(u.prototype.stringValue=null,u.prototype.boolValue=null,u.prototype.intValue=null,u.prototype.doubleValue=null,u.prototype.arrayValue=null,u.prototype.kvlistValue=null,u.prototype.bytesValue=null,Object.defineProperty(u.prototype,"value",{get:ks.oneOfGetter(t=["stringValue","boolValue","intValue","doubleValue","arrayValue","kvlistValue","bytesValue"]),set:ks.oneOfSetter(t)}),u.create=function(e){return new u(e)},u.encode=function(e,t){return t=t||Us.create(),null!=e.stringValue&&Object.hasOwnProperty.call(e,"stringValue")&&t.uint32(10).string(e.stringValue),null!=e.boolValue&&Object.hasOwnProperty.call(e,"boolValue")&&t.uint32(16).bool(e.boolValue),null!=e.intValue&&Object.hasOwnProperty.call(e,"intValue")&&t.uint32(24).int64(e.intValue),null!=e.doubleValue&&Object.hasOwnProperty.call(e,"doubleValue")&&t.uint32(33).double(e.doubleValue),null!=e.arrayValue&&Object.hasOwnProperty.call(e,"arrayValue")&&Ls.opentelemetry.proto.common.v1.ArrayValue.encode(e.arrayValue,t.uint32(42).fork()).ldelim(),null!=e.kvlistValue&&Object.hasOwnProperty.call(e,"kvlistValue")&&Ls.opentelemetry.proto.common.v1.KeyValueList.encode(e.kvlistValue,t.uint32(50).fork()).ldelim(),null!=e.bytesValue&&Object.hasOwnProperty.call(e,"bytesValue")&&t.uint32(58).bytes(e.bytesValue),t},u.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},u.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.common.v1.AnyValue;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.stringValue=e.string();break;case 2:o.boolValue=e.bool();break;case 3:o.intValue=e.int64();break;case 4:o.doubleValue=e.double();break;case 5:o.arrayValue=Ls.opentelemetry.proto.common.v1.ArrayValue.decode(e,e.uint32());break;case 6:o.kvlistValue=Ls.opentelemetry.proto.common.v1.KeyValueList.decode(e,e.uint32());break;case 7:o.bytesValue=e.bytes();break;default:e.skipType(7&s)}}return o},u.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},u.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t,r={};if(null!=e.stringValue&&e.hasOwnProperty("stringValue")&&(r.value=1,!ks.isString(e.stringValue)))return"stringValue: string expected";if(null!=e.boolValue&&e.hasOwnProperty("boolValue")){if(1===r.value)return"value: multiple values";if(r.value=1,"boolean"!=typeof e.boolValue)return"boolValue: boolean expected"}if(null!=e.intValue&&e.hasOwnProperty("intValue")){if(1===r.value)return"value: multiple values";if(r.value=1,!(ks.isInteger(e.intValue)||e.intValue&&ks.isInteger(e.intValue.low)&&ks.isInteger(e.intValue.high)))return"intValue: integer|Long expected"}if(null!=e.doubleValue&&e.hasOwnProperty("doubleValue")){if(1===r.value)return"value: multiple values";if(r.value=1,"number"!=typeof e.doubleValue)return"doubleValue: number expected"}if(null!=e.arrayValue&&e.hasOwnProperty("arrayValue")){if(1===r.value)return"value: multiple values";if(r.value=1,t=Ls.opentelemetry.proto.common.v1.ArrayValue.verify(e.arrayValue))return"arrayValue."+t}if(null!=e.kvlistValue&&e.hasOwnProperty("kvlistValue")){if(1===r.value)return"value: multiple values";if(r.value=1,t=Ls.opentelemetry.proto.common.v1.KeyValueList.verify(e.kvlistValue))return"kvlistValue."+t}if(null!=e.bytesValue&&e.hasOwnProperty("bytesValue")){if(1===r.value)return"value: multiple values";if(r.value=1,!(e.bytesValue&&"number"==typeof e.bytesValue.length||ks.isString(e.bytesValue)))return"bytesValue: buffer expected"}return null},u.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.common.v1.AnyValue)return e;var t=new Ls.opentelemetry.proto.common.v1.AnyValue;if(null!=e.stringValue&&(t.stringValue=String(e.stringValue)),null!=e.boolValue&&(t.boolValue=Boolean(e.boolValue)),null!=e.intValue&&(ks.Long?(t.intValue=ks.Long.fromValue(e.intValue)).unsigned=!1:"string"==typeof e.intValue?t.intValue=parseInt(e.intValue,10):"number"==typeof e.intValue?t.intValue=e.intValue:"object"==typeof e.intValue&&(t.intValue=new ks.LongBits(e.intValue.low>>>0,e.intValue.high>>>0).toNumber())),null!=e.doubleValue&&(t.doubleValue=Number(e.doubleValue)),null!=e.arrayValue){if("object"!=typeof e.arrayValue)throw TypeError(".opentelemetry.proto.common.v1.AnyValue.arrayValue: object expected");t.arrayValue=Ls.opentelemetry.proto.common.v1.ArrayValue.fromObject(e.arrayValue)}if(null!=e.kvlistValue){if("object"!=typeof e.kvlistValue)throw TypeError(".opentelemetry.proto.common.v1.AnyValue.kvlistValue: object expected");t.kvlistValue=Ls.opentelemetry.proto.common.v1.KeyValueList.fromObject(e.kvlistValue)}return null!=e.bytesValue&&("string"==typeof e.bytesValue?ks.base64.decode(e.bytesValue,t.bytesValue=ks.newBuffer(ks.base64.length(e.bytesValue)),0):0<=e.bytesValue.length&&(t.bytesValue=e.bytesValue)),t},u.toObject=function(e,t){t=t||{};var r={};return null!=e.stringValue&&e.hasOwnProperty("stringValue")&&(r.stringValue=e.stringValue,t.oneofs)&&(r.value="stringValue"),null!=e.boolValue&&e.hasOwnProperty("boolValue")&&(r.boolValue=e.boolValue,t.oneofs)&&(r.value="boolValue"),null!=e.intValue&&e.hasOwnProperty("intValue")&&("number"==typeof e.intValue?r.intValue=t.longs===String?String(e.intValue):e.intValue:r.intValue=t.longs===String?ks.Long.prototype.toString.call(e.intValue):t.longs===Number?new ks.LongBits(e.intValue.low>>>0,e.intValue.high>>>0).toNumber():e.intValue,t.oneofs)&&(r.value="intValue"),null!=e.doubleValue&&e.hasOwnProperty("doubleValue")&&(r.doubleValue=t.json&&!isFinite(e.doubleValue)?String(e.doubleValue):e.doubleValue,t.oneofs)&&(r.value="doubleValue"),null!=e.arrayValue&&e.hasOwnProperty("arrayValue")&&(r.arrayValue=Ls.opentelemetry.proto.common.v1.ArrayValue.toObject(e.arrayValue,t),t.oneofs)&&(r.value="arrayValue"),null!=e.kvlistValue&&e.hasOwnProperty("kvlistValue")&&(r.kvlistValue=Ls.opentelemetry.proto.common.v1.KeyValueList.toObject(e.kvlistValue,t),t.oneofs)&&(r.value="kvlistValue"),null!=e.bytesValue&&e.hasOwnProperty("bytesValue")&&(r.bytesValue=t.bytes===String?ks.base64.encode(e.bytesValue,0,e.bytesValue.length):t.bytes===Array?Array.prototype.slice.call(e.bytesValue):e.bytesValue,t.oneofs)&&(r.value="bytesValue"),r},u.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},u.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.AnyValue"},u),e.ArrayValue=(a.prototype.values=ks.emptyArray,a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Us.create(),null!=e.values&&e.values.length)for(var r=0;r<e.values.length;++r)Ls.opentelemetry.proto.common.v1.AnyValue.encode(e.values[r],t.uint32(10).fork()).ldelim();return t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.common.v1.ArrayValue;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.values&&o.values.length||(o.values=[]),o.values.push(Ls.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32()))):e.skipType(7&s)}return o},a.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.values&&e.hasOwnProperty("values")){if(!Array.isArray(e.values))return"values: array expected";for(var t=0;t<e.values.length;++t){var r=Ls.opentelemetry.proto.common.v1.AnyValue.verify(e.values[t]);if(r)return"values."+r}}return null},a.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.common.v1.ArrayValue)return e;var t=new Ls.opentelemetry.proto.common.v1.ArrayValue;if(e.values){if(!Array.isArray(e.values))throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: array expected");t.values=[];for(var r=0;r<e.values.length;++r){if("object"!=typeof e.values[r])throw TypeError(".opentelemetry.proto.common.v1.ArrayValue.values: object expected");t.values[r]=Ls.opentelemetry.proto.common.v1.AnyValue.fromObject(e.values[r])}}return t},a.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.values=[]),e.values&&e.values.length){r.values=[];for(var n=0;n<e.values.length;++n)r.values[n]=Ls.opentelemetry.proto.common.v1.AnyValue.toObject(e.values[n],t)}return r},a.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.ArrayValue"},a),e.KeyValueList=(i.prototype.values=ks.emptyArray,i.create=function(e){return new i(e)},i.encode=function(e,t){if(t=t||Us.create(),null!=e.values&&e.values.length)for(var r=0;r<e.values.length;++r)Ls.opentelemetry.proto.common.v1.KeyValue.encode(e.values[r],t.uint32(10).fork()).ldelim();return t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.common.v1.KeyValueList;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.values&&o.values.length||(o.values=[]),o.values.push(Ls.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()))):e.skipType(7&s)}return o},i.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},i.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.values&&e.hasOwnProperty("values")){if(!Array.isArray(e.values))return"values: array expected";for(var t=0;t<e.values.length;++t){var r=Ls.opentelemetry.proto.common.v1.KeyValue.verify(e.values[t]);if(r)return"values."+r}}return null},i.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.common.v1.KeyValueList)return e;var t=new Ls.opentelemetry.proto.common.v1.KeyValueList;if(e.values){if(!Array.isArray(e.values))throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: array expected");t.values=[];for(var r=0;r<e.values.length;++r){if("object"!=typeof e.values[r])throw TypeError(".opentelemetry.proto.common.v1.KeyValueList.values: object expected");t.values[r]=Ls.opentelemetry.proto.common.v1.KeyValue.fromObject(e.values[r])}}return t},i.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.values=[]),e.values&&e.values.length){r.values=[];for(var n=0;n<e.values.length;++n)r.values[n]=Ls.opentelemetry.proto.common.v1.KeyValue.toObject(e.values[n],t)}return r},i.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.KeyValueList"},i),e.KeyValue=(s.prototype.key=null,s.prototype.value=null,s.create=function(e){return new s(e)},s.encode=function(e,t){return t=t||Us.create(),null!=e.key&&Object.hasOwnProperty.call(e,"key")&&t.uint32(10).string(e.key),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&Ls.opentelemetry.proto.common.v1.AnyValue.encode(e.value,t.uint32(18).fork()).ldelim(),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.common.v1.KeyValue;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.key=e.string();break;case 2:o.value=Ls.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32());break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.key&&e.hasOwnProperty("key")&&!ks.isString(e.key))return"key: string expected";if(null!=e.value&&e.hasOwnProperty("value")){e=Ls.opentelemetry.proto.common.v1.AnyValue.verify(e.value);if(e)return"value."+e}return null},s.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.common.v1.KeyValue)return e;var t=new Ls.opentelemetry.proto.common.v1.KeyValue;if(null!=e.key&&(t.key=String(e.key)),null!=e.value){if("object"!=typeof e.value)throw TypeError(".opentelemetry.proto.common.v1.KeyValue.value: object expected");t.value=Ls.opentelemetry.proto.common.v1.AnyValue.fromObject(e.value)}return t},s.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.key="",r.value=null),null!=e.key&&e.hasOwnProperty("key")&&(r.key=e.key),null!=e.value&&e.hasOwnProperty("value")&&(r.value=Ls.opentelemetry.proto.common.v1.AnyValue.toObject(e.value,t)),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.KeyValue"},s),e.InstrumentationScope=(o.prototype.name=null,o.prototype.version=null,o.prototype.attributes=ks.emptyArray,o.prototype.droppedAttributesCount=null,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Us.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.version&&Object.hasOwnProperty.call(e,"version")&&t.uint32(18).string(e.version),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Ls.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(26).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(32).uint32(e.droppedAttributesCount),t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.common.v1.InstrumentationScope;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.name=e.string();break;case 2:o.version=e.string();break;case 3:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Ls.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 4:o.droppedAttributesCount=e.uint32();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!ks.isString(e.name))return"name: string expected";if(null!=e.version&&e.hasOwnProperty("version")&&!ks.isString(e.version))return"version: string expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t){var r=Ls.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]);if(r)return"attributes."+r}}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!ks.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},o.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.common.v1.InstrumentationScope)return e;var t=new Ls.opentelemetry.proto.common.v1.InstrumentationScope;if(null!=e.name&&(t.name=String(e.name)),null!=e.version&&(t.version=String(e.version)),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.common.v1.InstrumentationScope.attributes: object expected");t.attributes[r]=Ls.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.attributes=[]),t.defaults&&(r.name="",r.version="",r.droppedAttributesCount=0),null!=e.name&&e.hasOwnProperty("name")&&(r.name=e.name),null!=e.version&&e.hasOwnProperty("version")&&(r.version=e.version),e.attributes&&e.attributes.length){r.attributes=[];for(var n=0;n<e.attributes.length;++n)r.attributes[n]=Ls.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[n],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(r.droppedAttributesCount=e.droppedAttributesCount),r},o.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.InstrumentationScope"},o),e.EntityRef=(n.prototype.schemaUrl=null,n.prototype.type=null,n.prototype.idKeys=ks.emptyArray,n.prototype.descriptionKeys=ks.emptyArray,n.create=function(e){return new n(e)},n.encode=function(e,t){if(t=t||Us.create(),null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(10).string(e.schemaUrl),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(18).string(e.type),null!=e.idKeys&&e.idKeys.length)for(var r=0;r<e.idKeys.length;++r)t.uint32(26).string(e.idKeys[r]);if(null!=e.descriptionKeys&&e.descriptionKeys.length)for(r=0;r<e.descriptionKeys.length;++r)t.uint32(34).string(e.descriptionKeys[r]);return t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.common.v1.EntityRef;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.schemaUrl=e.string();break;case 2:o.type=e.string();break;case 3:o.idKeys&&o.idKeys.length||(o.idKeys=[]),o.idKeys.push(e.string());break;case 4:o.descriptionKeys&&o.descriptionKeys.length||(o.descriptionKeys=[]),o.descriptionKeys.push(e.string());break;default:e.skipType(7&s)}}return o},n.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!ks.isString(e.schemaUrl))return"schemaUrl: string expected";if(null!=e.type&&e.hasOwnProperty("type")&&!ks.isString(e.type))return"type: string expected";if(null!=e.idKeys&&e.hasOwnProperty("idKeys")){if(!Array.isArray(e.idKeys))return"idKeys: array expected";for(var t=0;t<e.idKeys.length;++t)if(!ks.isString(e.idKeys[t]))return"idKeys: string[] expected"}if(null!=e.descriptionKeys&&e.hasOwnProperty("descriptionKeys")){if(!Array.isArray(e.descriptionKeys))return"descriptionKeys: array expected";for(t=0;t<e.descriptionKeys.length;++t)if(!ks.isString(e.descriptionKeys[t]))return"descriptionKeys: string[] expected"}return null},n.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.common.v1.EntityRef)return e;var t=new Ls.opentelemetry.proto.common.v1.EntityRef;if(null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),null!=e.type&&(t.type=String(e.type)),e.idKeys){if(!Array.isArray(e.idKeys))throw TypeError(".opentelemetry.proto.common.v1.EntityRef.idKeys: array expected");t.idKeys=[];for(var r=0;r<e.idKeys.length;++r)t.idKeys[r]=String(e.idKeys[r])}if(e.descriptionKeys){if(!Array.isArray(e.descriptionKeys))throw TypeError(".opentelemetry.proto.common.v1.EntityRef.descriptionKeys: array expected");for(t.descriptionKeys=[],r=0;r<e.descriptionKeys.length;++r)t.descriptionKeys[r]=String(e.descriptionKeys[r])}return t},n.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.idKeys=[],r.descriptionKeys=[]),t.defaults&&(r.schemaUrl="",r.type=""),null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),null!=e.type&&e.hasOwnProperty("type")&&(r.type=e.type),e.idKeys&&e.idKeys.length){r.idKeys=[];for(var n=0;n<e.idKeys.length;++n)r.idKeys[n]=e.idKeys[n]}if(e.descriptionKeys&&e.descriptionKeys.length)for(r.descriptionKeys=[],n=0;n<e.descriptionKeys.length;++n)r.descriptionKeys[n]=e.descriptionKeys[n];return r},n.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.common.v1.EntityRef"},n),e),r;function n(e){if(this.idKeys=[],this.descriptionKeys=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(this.values=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.values=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function u(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),Rs.resource=((xs={}).v1=((Os={}).Resource=(()=>{function t(e){if(this.attributes=[],this.entityRefs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}return t.prototype.attributes=ks.emptyArray,t.prototype.droppedAttributesCount=null,t.prototype.entityRefs=ks.emptyArray,t.create=function(e){return new t(e)},t.encode=function(e,t){if(t=t||Us.create(),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Ls.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(10).fork()).ldelim();if(null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(16).uint32(e.droppedAttributesCount),null!=e.entityRefs&&e.entityRefs.length)for(r=0;r<e.entityRefs.length;++r)Ls.opentelemetry.proto.common.v1.EntityRef.encode(e.entityRefs[r],t.uint32(26).fork()).ldelim();return t},t.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},t.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.resource.v1.Resource;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Ls.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.droppedAttributesCount=e.uint32();break;case 3:o.entityRefs&&o.entityRefs.length||(o.entityRefs=[]),o.entityRefs.push(Ls.opentelemetry.proto.common.v1.EntityRef.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return o},t.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},t.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=Ls.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!ks.isInteger(e.droppedAttributesCount))return"droppedAttributesCount: integer expected";if(null!=e.entityRefs&&e.hasOwnProperty("entityRefs")){if(!Array.isArray(e.entityRefs))return"entityRefs: array expected";for(t=0;t<e.entityRefs.length;++t){var r;if(r=Ls.opentelemetry.proto.common.v1.EntityRef.verify(e.entityRefs[t]))return"entityRefs."+r}}return null},t.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.resource.v1.Resource)return e;var t=new Ls.opentelemetry.proto.resource.v1.Resource;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.resource.v1.Resource.attributes: object expected");t.attributes[r]=Ls.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),e.entityRefs){if(!Array.isArray(e.entityRefs))throw TypeError(".opentelemetry.proto.resource.v1.Resource.entityRefs: array expected");for(t.entityRefs=[],r=0;r<e.entityRefs.length;++r){if("object"!=typeof e.entityRefs[r])throw TypeError(".opentelemetry.proto.resource.v1.Resource.entityRefs: object expected");t.entityRefs[r]=Ls.opentelemetry.proto.common.v1.EntityRef.fromObject(e.entityRefs[r])}}return t},t.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.attributes=[],r.entityRefs=[]),t.defaults&&(r.droppedAttributesCount=0),e.attributes&&e.attributes.length){r.attributes=[];for(var n=0;n<e.attributes.length;++n)r.attributes[n]=Ls.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[n],t)}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(r.droppedAttributesCount=e.droppedAttributesCount),e.entityRefs&&e.entityRefs.length)for(r.entityRefs=[],n=0;n<e.entityRefs.length;++n)r.entityRefs[n]=Ls.opentelemetry.proto.common.v1.EntityRef.toObject(e.entityRefs[n],t);return r},t.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},t.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.resource.v1.Resource"},t})(),Os),xs),Rs.trace=(()=>{var e,t,r,n={};return n.v1=((r={}).TracesData=(c.prototype.resourceSpans=ks.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,t){if(t=t||Us.create(),null!=e.resourceSpans&&e.resourceSpans.length)for(var r=0;r<e.resourceSpans.length;++r)Ls.opentelemetry.proto.trace.v1.ResourceSpans.encode(e.resourceSpans[r],t.uint32(10).fork()).ldelim();return t},c.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},c.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.trace.v1.TracesData;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceSpans&&o.resourceSpans.length||(o.resourceSpans=[]),o.resourceSpans.push(Ls.opentelemetry.proto.trace.v1.ResourceSpans.decode(e,e.uint32()))):e.skipType(7&s)}return o},c.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},c.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceSpans&&e.hasOwnProperty("resourceSpans")){if(!Array.isArray(e.resourceSpans))return"resourceSpans: array expected";for(var t=0;t<e.resourceSpans.length;++t){var r=Ls.opentelemetry.proto.trace.v1.ResourceSpans.verify(e.resourceSpans[t]);if(r)return"resourceSpans."+r}}return null},c.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.trace.v1.TracesData)return e;var t=new Ls.opentelemetry.proto.trace.v1.TracesData;if(e.resourceSpans){if(!Array.isArray(e.resourceSpans))throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: array expected");t.resourceSpans=[];for(var r=0;r<e.resourceSpans.length;++r){if("object"!=typeof e.resourceSpans[r])throw TypeError(".opentelemetry.proto.trace.v1.TracesData.resourceSpans: object expected");t.resourceSpans[r]=Ls.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(e.resourceSpans[r])}}return t},c.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceSpans=[]),e.resourceSpans&&e.resourceSpans.length){r.resourceSpans=[];for(var n=0;n<e.resourceSpans.length;++n)r.resourceSpans[n]=Ls.opentelemetry.proto.trace.v1.ResourceSpans.toObject(e.resourceSpans[n],t)}return r},c.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},c.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.TracesData"},c),r.ResourceSpans=(l.prototype.resource=null,l.prototype.scopeSpans=ks.emptyArray,l.prototype.schemaUrl=null,l.create=function(e){return new l(e)},l.encode=function(e,t){if(t=t||Us.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&Ls.opentelemetry.proto.resource.v1.Resource.encode(e.resource,t.uint32(10).fork()).ldelim(),null!=e.scopeSpans&&e.scopeSpans.length)for(var r=0;r<e.scopeSpans.length;++r)Ls.opentelemetry.proto.trace.v1.ScopeSpans.encode(e.scopeSpans[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},l.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},l.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.trace.v1.ResourceSpans;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.resource=Ls.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break;case 2:o.scopeSpans&&o.scopeSpans.length||(o.scopeSpans=[]),o.scopeSpans.push(Ls.opentelemetry.proto.trace.v1.ScopeSpans.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},l.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},l.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&(t=Ls.opentelemetry.proto.resource.v1.Resource.verify(e.resource)))return"resource."+t;if(null!=e.scopeSpans&&e.hasOwnProperty("scopeSpans")){if(!Array.isArray(e.scopeSpans))return"scopeSpans: array expected";for(var t,r=0;r<e.scopeSpans.length;++r)if(t=Ls.opentelemetry.proto.trace.v1.ScopeSpans.verify(e.scopeSpans[r]))return"scopeSpans."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!ks.isString(e.schemaUrl)?"schemaUrl: string expected":null},l.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.trace.v1.ResourceSpans)return e;var t=new Ls.opentelemetry.proto.trace.v1.ResourceSpans;if(null!=e.resource){if("object"!=typeof e.resource)throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.resource: object expected");t.resource=Ls.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeSpans){if(!Array.isArray(e.scopeSpans))throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: array expected");t.scopeSpans=[];for(var r=0;r<e.scopeSpans.length;++r){if("object"!=typeof e.scopeSpans[r])throw TypeError(".opentelemetry.proto.trace.v1.ResourceSpans.scopeSpans: object expected");t.scopeSpans[r]=Ls.opentelemetry.proto.trace.v1.ScopeSpans.fromObject(e.scopeSpans[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},l.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.scopeSpans=[]),t.defaults&&(r.resource=null,r.schemaUrl=""),null!=e.resource&&e.hasOwnProperty("resource")&&(r.resource=Ls.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,t)),e.scopeSpans&&e.scopeSpans.length){r.scopeSpans=[];for(var n=0;n<e.scopeSpans.length;++n)r.scopeSpans[n]=Ls.opentelemetry.proto.trace.v1.ScopeSpans.toObject(e.scopeSpans[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},l.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},l.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.ResourceSpans"},l),r.ScopeSpans=(u.prototype.scope=null,u.prototype.spans=ks.emptyArray,u.prototype.schemaUrl=null,u.create=function(e){return new u(e)},u.encode=function(e,t){if(t=t||Us.create(),null!=e.scope&&Object.hasOwnProperty.call(e,"scope")&&Ls.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,t.uint32(10).fork()).ldelim(),null!=e.spans&&e.spans.length)for(var r=0;r<e.spans.length;++r)Ls.opentelemetry.proto.trace.v1.Span.encode(e.spans[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},u.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},u.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.trace.v1.ScopeSpans;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.scope=Ls.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break;case 2:o.spans&&o.spans.length||(o.spans=[]),o.spans.push(Ls.opentelemetry.proto.trace.v1.Span.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},u.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},u.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.scope&&e.hasOwnProperty("scope")&&(t=Ls.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope)))return"scope."+t;if(null!=e.spans&&e.hasOwnProperty("spans")){if(!Array.isArray(e.spans))return"spans: array expected";for(var t,r=0;r<e.spans.length;++r)if(t=Ls.opentelemetry.proto.trace.v1.Span.verify(e.spans[r]))return"spans."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!ks.isString(e.schemaUrl)?"schemaUrl: string expected":null},u.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.trace.v1.ScopeSpans)return e;var t=new Ls.opentelemetry.proto.trace.v1.ScopeSpans;if(null!=e.scope){if("object"!=typeof e.scope)throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.scope: object expected");t.scope=Ls.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.spans){if(!Array.isArray(e.spans))throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: array expected");t.spans=[];for(var r=0;r<e.spans.length;++r){if("object"!=typeof e.spans[r])throw TypeError(".opentelemetry.proto.trace.v1.ScopeSpans.spans: object expected");t.spans[r]=Ls.opentelemetry.proto.trace.v1.Span.fromObject(e.spans[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},u.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.spans=[]),t.defaults&&(r.scope=null,r.schemaUrl=""),null!=e.scope&&e.hasOwnProperty("scope")&&(r.scope=Ls.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,t)),e.spans&&e.spans.length){r.spans=[];for(var n=0;n<e.spans.length;++n)r.spans[n]=Ls.opentelemetry.proto.trace.v1.Span.toObject(e.spans[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},u.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},u.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.ScopeSpans"},u),r.Span=(s.prototype.traceId=null,s.prototype.spanId=null,s.prototype.traceState=null,s.prototype.parentSpanId=null,s.prototype.flags=null,s.prototype.name=null,s.prototype.kind=null,s.prototype.startTimeUnixNano=null,s.prototype.endTimeUnixNano=null,s.prototype.attributes=ks.emptyArray,s.prototype.droppedAttributesCount=null,s.prototype.events=ks.emptyArray,s.prototype.droppedEventsCount=null,s.prototype.links=ks.emptyArray,s.prototype.droppedLinksCount=null,s.prototype.status=null,s.create=function(e){return new s(e)},s.encode=function(e,t){if(t=t||Us.create(),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(10).bytes(e.traceId),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(18).bytes(e.spanId),null!=e.traceState&&Object.hasOwnProperty.call(e,"traceState")&&t.uint32(26).string(e.traceState),null!=e.parentSpanId&&Object.hasOwnProperty.call(e,"parentSpanId")&&t.uint32(34).bytes(e.parentSpanId),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(42).string(e.name),null!=e.kind&&Object.hasOwnProperty.call(e,"kind")&&t.uint32(48).int32(e.kind),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(57).fixed64(e.startTimeUnixNano),null!=e.endTimeUnixNano&&Object.hasOwnProperty.call(e,"endTimeUnixNano")&&t.uint32(65).fixed64(e.endTimeUnixNano),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Ls.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(74).fork()).ldelim();if(null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(80).uint32(e.droppedAttributesCount),null!=e.events&&e.events.length)for(r=0;r<e.events.length;++r)Ls.opentelemetry.proto.trace.v1.Span.Event.encode(e.events[r],t.uint32(90).fork()).ldelim();if(null!=e.droppedEventsCount&&Object.hasOwnProperty.call(e,"droppedEventsCount")&&t.uint32(96).uint32(e.droppedEventsCount),null!=e.links&&e.links.length)for(r=0;r<e.links.length;++r)Ls.opentelemetry.proto.trace.v1.Span.Link.encode(e.links[r],t.uint32(106).fork()).ldelim();return null!=e.droppedLinksCount&&Object.hasOwnProperty.call(e,"droppedLinksCount")&&t.uint32(112).uint32(e.droppedLinksCount),null!=e.status&&Object.hasOwnProperty.call(e,"status")&&Ls.opentelemetry.proto.trace.v1.Status.encode(e.status,t.uint32(122).fork()).ldelim(),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(133).fixed32(e.flags),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.trace.v1.Span;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.traceId=e.bytes();break;case 2:o.spanId=e.bytes();break;case 3:o.traceState=e.string();break;case 4:o.parentSpanId=e.bytes();break;case 16:o.flags=e.fixed32();break;case 5:o.name=e.string();break;case 6:o.kind=e.int32();break;case 7:o.startTimeUnixNano=e.fixed64();break;case 8:o.endTimeUnixNano=e.fixed64();break;case 9:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Ls.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 10:o.droppedAttributesCount=e.uint32();break;case 11:o.events&&o.events.length||(o.events=[]),o.events.push(Ls.opentelemetry.proto.trace.v1.Span.Event.decode(e,e.uint32()));break;case 12:o.droppedEventsCount=e.uint32();break;case 13:o.links&&o.links.length||(o.links=[]),o.links.push(Ls.opentelemetry.proto.trace.v1.Span.Link.decode(e,e.uint32()));break;case 14:o.droppedLinksCount=e.uint32();break;case 15:o.status=Ls.opentelemetry.proto.trace.v1.Status.decode(e,e.uint32());break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||ks.isString(e.traceId)))return"traceId: buffer expected";if(null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||ks.isString(e.spanId)))return"spanId: buffer expected";if(null!=e.traceState&&e.hasOwnProperty("traceState")&&!ks.isString(e.traceState))return"traceState: string expected";if(null!=e.parentSpanId&&e.hasOwnProperty("parentSpanId")&&!(e.parentSpanId&&"number"==typeof e.parentSpanId.length||ks.isString(e.parentSpanId)))return"parentSpanId: buffer expected";if(null!=e.flags&&e.hasOwnProperty("flags")&&!ks.isInteger(e.flags))return"flags: integer expected";if(null!=e.name&&e.hasOwnProperty("name")&&!ks.isString(e.name))return"name: string expected";if(null!=e.kind&&e.hasOwnProperty("kind"))switch(e.kind){default:return"kind: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(ks.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&ks.isInteger(e.startTimeUnixNano.low)&&ks.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.endTimeUnixNano&&e.hasOwnProperty("endTimeUnixNano")&&!(ks.isInteger(e.endTimeUnixNano)||e.endTimeUnixNano&&ks.isInteger(e.endTimeUnixNano.low)&&ks.isInteger(e.endTimeUnixNano.high)))return"endTimeUnixNano: integer|Long expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=Ls.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!ks.isInteger(e.droppedAttributesCount))return"droppedAttributesCount: integer expected";if(null!=e.events&&e.hasOwnProperty("events")){if(!Array.isArray(e.events))return"events: array expected";for(t=0;t<e.events.length;++t)if(r=Ls.opentelemetry.proto.trace.v1.Span.Event.verify(e.events[t]))return"events."+r}if(null!=e.droppedEventsCount&&e.hasOwnProperty("droppedEventsCount")&&!ks.isInteger(e.droppedEventsCount))return"droppedEventsCount: integer expected";if(null!=e.links&&e.hasOwnProperty("links")){if(!Array.isArray(e.links))return"links: array expected";for(t=0;t<e.links.length;++t)if(r=Ls.opentelemetry.proto.trace.v1.Span.Link.verify(e.links[t]))return"links."+r}return null!=e.droppedLinksCount&&e.hasOwnProperty("droppedLinksCount")&&!ks.isInteger(e.droppedLinksCount)?"droppedLinksCount: integer expected":null!=e.status&&e.hasOwnProperty("status")&&(r=Ls.opentelemetry.proto.trace.v1.Status.verify(e.status))?"status."+r:null;var r},s.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.trace.v1.Span)return e;var t=new Ls.opentelemetry.proto.trace.v1.Span;switch(null!=e.traceId&&("string"==typeof e.traceId?ks.base64.decode(e.traceId,t.traceId=ks.newBuffer(ks.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),null!=e.spanId&&("string"==typeof e.spanId?ks.base64.decode(e.spanId,t.spanId=ks.newBuffer(ks.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.traceState&&(t.traceState=String(e.traceState)),null!=e.parentSpanId&&("string"==typeof e.parentSpanId?ks.base64.decode(e.parentSpanId,t.parentSpanId=ks.newBuffer(ks.base64.length(e.parentSpanId)),0):0<=e.parentSpanId.length&&(t.parentSpanId=e.parentSpanId)),null!=e.flags&&(t.flags=e.flags>>>0),null!=e.name&&(t.name=String(e.name)),e.kind){default:"number"==typeof e.kind&&(t.kind=e.kind);break;case"SPAN_KIND_UNSPECIFIED":case 0:t.kind=0;break;case"SPAN_KIND_INTERNAL":case 1:t.kind=1;break;case"SPAN_KIND_SERVER":case 2:t.kind=2;break;case"SPAN_KIND_CLIENT":case 3:t.kind=3;break;case"SPAN_KIND_PRODUCER":case 4:t.kind=4;break;case"SPAN_KIND_CONSUMER":case 5:t.kind=5}if(null!=e.startTimeUnixNano&&(ks.Long?(t.startTimeUnixNano=ks.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new ks.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.endTimeUnixNano&&(ks.Long?(t.endTimeUnixNano=ks.Long.fromValue(e.endTimeUnixNano)).unsigned=!1:"string"==typeof e.endTimeUnixNano?t.endTimeUnixNano=parseInt(e.endTimeUnixNano,10):"number"==typeof e.endTimeUnixNano?t.endTimeUnixNano=e.endTimeUnixNano:"object"==typeof e.endTimeUnixNano&&(t.endTimeUnixNano=new ks.LongBits(e.endTimeUnixNano.low>>>0,e.endTimeUnixNano.high>>>0).toNumber())),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.attributes: object expected");t.attributes[r]=Ls.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),e.events){if(!Array.isArray(e.events))throw TypeError(".opentelemetry.proto.trace.v1.Span.events: array expected");for(t.events=[],r=0;r<e.events.length;++r){if("object"!=typeof e.events[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.events: object expected");t.events[r]=Ls.opentelemetry.proto.trace.v1.Span.Event.fromObject(e.events[r])}}if(null!=e.droppedEventsCount&&(t.droppedEventsCount=e.droppedEventsCount>>>0),e.links){if(!Array.isArray(e.links))throw TypeError(".opentelemetry.proto.trace.v1.Span.links: array expected");for(t.links=[],r=0;r<e.links.length;++r){if("object"!=typeof e.links[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.links: object expected");t.links[r]=Ls.opentelemetry.proto.trace.v1.Span.Link.fromObject(e.links[r])}}if(null!=e.droppedLinksCount&&(t.droppedLinksCount=e.droppedLinksCount>>>0),null!=e.status){if("object"!=typeof e.status)throw TypeError(".opentelemetry.proto.trace.v1.Span.status: object expected");t.status=Ls.opentelemetry.proto.trace.v1.Status.fromObject(e.status)}return t},s.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[],n.events=[],n.links=[]),t.defaults&&(t.bytes===String?n.traceId="":(n.traceId=[],t.bytes!==Array&&(n.traceId=ks.newBuffer(n.traceId))),t.bytes===String?n.spanId="":(n.spanId=[],t.bytes!==Array&&(n.spanId=ks.newBuffer(n.spanId))),n.traceState="",t.bytes===String?n.parentSpanId="":(n.parentSpanId=[],t.bytes!==Array&&(n.parentSpanId=ks.newBuffer(n.parentSpanId))),n.name="",n.kind=t.enums===String?"SPAN_KIND_UNSPECIFIED":0,ks.Long?(r=new ks.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,ks.Long?(r=new ks.Long(0,0,!1),n.endTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.endTimeUnixNano=t.longs===String?"0":0,n.droppedAttributesCount=0,n.droppedEventsCount=0,n.droppedLinksCount=0,n.status=null,n.flags=0),null!=e.traceId&&e.hasOwnProperty("traceId")&&(n.traceId=t.bytes===String?ks.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.spanId&&e.hasOwnProperty("spanId")&&(n.spanId=t.bytes===String?ks.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.traceState&&e.hasOwnProperty("traceState")&&(n.traceState=e.traceState),null!=e.parentSpanId&&e.hasOwnProperty("parentSpanId")&&(n.parentSpanId=t.bytes===String?ks.base64.encode(e.parentSpanId,0,e.parentSpanId.length):t.bytes===Array?Array.prototype.slice.call(e.parentSpanId):e.parentSpanId),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.kind&&e.hasOwnProperty("kind")&&(n.kind=t.enums!==String||void 0===Ls.opentelemetry.proto.trace.v1.Span.SpanKind[e.kind]?e.kind:Ls.opentelemetry.proto.trace.v1.Span.SpanKind[e.kind]),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?ks.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new ks.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.endTimeUnixNano&&e.hasOwnProperty("endTimeUnixNano")&&("number"==typeof e.endTimeUnixNano?n.endTimeUnixNano=t.longs===String?String(e.endTimeUnixNano):e.endTimeUnixNano:n.endTimeUnixNano=t.longs===String?ks.Long.prototype.toString.call(e.endTimeUnixNano):t.longs===Number?new ks.LongBits(e.endTimeUnixNano.low>>>0,e.endTimeUnixNano.high>>>0).toNumber():e.endTimeUnixNano),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=Ls.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}if(null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(n.droppedAttributesCount=e.droppedAttributesCount),e.events&&e.events.length)for(n.events=[],o=0;o<e.events.length;++o)n.events[o]=Ls.opentelemetry.proto.trace.v1.Span.Event.toObject(e.events[o],t);if(null!=e.droppedEventsCount&&e.hasOwnProperty("droppedEventsCount")&&(n.droppedEventsCount=e.droppedEventsCount),e.links&&e.links.length)for(n.links=[],o=0;o<e.links.length;++o)n.links[o]=Ls.opentelemetry.proto.trace.v1.Span.Link.toObject(e.links[o],t);return null!=e.droppedLinksCount&&e.hasOwnProperty("droppedLinksCount")&&(n.droppedLinksCount=e.droppedLinksCount),null!=e.status&&e.hasOwnProperty("status")&&(n.status=Ls.opentelemetry.proto.trace.v1.Status.toObject(e.status,t)),null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),n},s.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Span"},s.SpanKind=(e={},(t=Object.create(e))[e[0]="SPAN_KIND_UNSPECIFIED"]=0,t[e[1]="SPAN_KIND_INTERNAL"]=1,t[e[2]="SPAN_KIND_SERVER"]=2,t[e[3]="SPAN_KIND_CLIENT"]=3,t[e[4]="SPAN_KIND_PRODUCER"]=4,t[e[5]="SPAN_KIND_CONSUMER"]=5,t),s.Event=(a.prototype.timeUnixNano=null,a.prototype.name=null,a.prototype.attributes=ks.emptyArray,a.prototype.droppedAttributesCount=null,a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Us.create(),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(9).fixed64(e.timeUnixNano),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(18).string(e.name),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Ls.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(26).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(32).uint32(e.droppedAttributesCount),t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.trace.v1.Span.Event;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.timeUnixNano=e.fixed64();break;case 2:o.name=e.string();break;case 3:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Ls.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 4:o.droppedAttributesCount=e.uint32();break;default:e.skipType(7&s)}}return o},a.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(ks.isInteger(e.timeUnixNano)||e.timeUnixNano&&ks.isInteger(e.timeUnixNano.low)&&ks.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.name&&e.hasOwnProperty("name")&&!ks.isString(e.name))return"name: string expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t){var r=Ls.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]);if(r)return"attributes."+r}}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!ks.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null},a.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.trace.v1.Span.Event)return e;var t=new Ls.opentelemetry.proto.trace.v1.Span.Event;if(null!=e.timeUnixNano&&(ks.Long?(t.timeUnixNano=ks.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new ks.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.name&&(t.name=String(e.name)),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.Event.attributes: object expected");t.attributes[r]=Ls.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),t},a.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[]),t.defaults&&(ks.Long?(r=new ks.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,n.name="",n.droppedAttributesCount=0),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?ks.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new ks.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=Ls.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(n.droppedAttributesCount=e.droppedAttributesCount),n},a.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Span.Event"},a),s.Link=(i.prototype.traceId=null,i.prototype.spanId=null,i.prototype.traceState=null,i.prototype.attributes=ks.emptyArray,i.prototype.droppedAttributesCount=null,i.prototype.flags=null,i.create=function(e){return new i(e)},i.encode=function(e,t){if(t=t||Us.create(),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(10).bytes(e.traceId),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(18).bytes(e.spanId),null!=e.traceState&&Object.hasOwnProperty.call(e,"traceState")&&t.uint32(26).string(e.traceState),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Ls.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(34).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(40).uint32(e.droppedAttributesCount),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(53).fixed32(e.flags),t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.trace.v1.Span.Link;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.traceId=e.bytes();break;case 2:o.spanId=e.bytes();break;case 3:o.traceState=e.string();break;case 4:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Ls.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 5:o.droppedAttributesCount=e.uint32();break;case 6:o.flags=e.fixed32();break;default:e.skipType(7&s)}}return o},i.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},i.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||ks.isString(e.traceId)))return"traceId: buffer expected";if(null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||ks.isString(e.spanId)))return"spanId: buffer expected";if(null!=e.traceState&&e.hasOwnProperty("traceState")&&!ks.isString(e.traceState))return"traceState: string expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t){var r=Ls.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]);if(r)return"attributes."+r}}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!ks.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null!=e.flags&&e.hasOwnProperty("flags")&&!ks.isInteger(e.flags)?"flags: integer expected":null},i.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.trace.v1.Span.Link)return e;var t=new Ls.opentelemetry.proto.trace.v1.Span.Link;if(null!=e.traceId&&("string"==typeof e.traceId?ks.base64.decode(e.traceId,t.traceId=ks.newBuffer(ks.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),null!=e.spanId&&("string"==typeof e.spanId?ks.base64.decode(e.spanId,t.spanId=ks.newBuffer(ks.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.traceState&&(t.traceState=String(e.traceState)),e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.trace.v1.Span.Link.attributes: object expected");t.attributes[r]=Ls.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),null!=e.flags&&(t.flags=e.flags>>>0),t},i.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.attributes=[]),t.defaults&&(t.bytes===String?r.traceId="":(r.traceId=[],t.bytes!==Array&&(r.traceId=ks.newBuffer(r.traceId))),t.bytes===String?r.spanId="":(r.spanId=[],t.bytes!==Array&&(r.spanId=ks.newBuffer(r.spanId))),r.traceState="",r.droppedAttributesCount=0,r.flags=0),null!=e.traceId&&e.hasOwnProperty("traceId")&&(r.traceId=t.bytes===String?ks.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.spanId&&e.hasOwnProperty("spanId")&&(r.spanId=t.bytes===String?ks.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.traceState&&e.hasOwnProperty("traceState")&&(r.traceState=e.traceState),e.attributes&&e.attributes.length){r.attributes=[];for(var n=0;n<e.attributes.length;++n)r.attributes[n]=Ls.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[n],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(r.droppedAttributesCount=e.droppedAttributesCount),null!=e.flags&&e.hasOwnProperty("flags")&&(r.flags=e.flags),r},i.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Span.Link"},i),s),r.Status=(o.prototype.message=null,o.prototype.code=null,o.create=function(e){return new o(e)},o.encode=function(e,t){return t=t||Us.create(),null!=e.message&&Object.hasOwnProperty.call(e,"message")&&t.uint32(18).string(e.message),null!=e.code&&Object.hasOwnProperty.call(e,"code")&&t.uint32(24).int32(e.code),t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.trace.v1.Status;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 2:o.message=e.string();break;case 3:o.code=e.int32();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.message&&e.hasOwnProperty("message")&&!ks.isString(e.message))return"message: string expected";if(null!=e.code&&e.hasOwnProperty("code"))switch(e.code){default:return"code: enum value expected";case 0:case 1:case 2:}return null},o.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.trace.v1.Status)return e;var t=new Ls.opentelemetry.proto.trace.v1.Status;switch(null!=e.message&&(t.message=String(e.message)),e.code){default:"number"==typeof e.code&&(t.code=e.code);break;case"STATUS_CODE_UNSET":case 0:t.code=0;break;case"STATUS_CODE_OK":case 1:t.code=1;break;case"STATUS_CODE_ERROR":case 2:t.code=2}return t},o.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.message="",r.code=t.enums===String?"STATUS_CODE_UNSET":0),null!=e.message&&e.hasOwnProperty("message")&&(r.message=e.message),null!=e.code&&e.hasOwnProperty("code")&&(r.code=t.enums!==String||void 0===Ls.opentelemetry.proto.trace.v1.Status.StatusCode[e.code]?e.code:Ls.opentelemetry.proto.trace.v1.Status.StatusCode[e.code]),r},o.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.trace.v1.Status"},o.StatusCode=(e={},(t=Object.create(e))[e[0]="STATUS_CODE_UNSET"]=0,t[e[1]="STATUS_CODE_OK"]=1,t[e[2]="STATUS_CODE_ERROR"]=2,t),o),r.SpanFlags=(e={},(t=Object.create(e))[e[0]="SPAN_FLAGS_DO_NOT_USE"]=0,t[e[255]="SPAN_FLAGS_TRACE_FLAGS_MASK"]=255,t[e[256]="SPAN_FLAGS_CONTEXT_HAS_IS_REMOTE_MASK"]=256,t[e[512]="SPAN_FLAGS_CONTEXT_IS_REMOTE_MASK"]=512,t),r),n;function o(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(this.attributes=[],this.events=[],this.links=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function u(e){if(this.spans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function l(e){if(this.scopeSpans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function c(e){if(this.resourceSpans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),Rs.collector=((Cs={}).trace=(()=>{var e,t={};return t.v1=((e={}).TraceService=(((s.prototype=Object.create(Is.rpc.Service.prototype)).constructor=s).create=function(e,t,r){return new this(e,t,r)},Object.defineProperty(s.prototype.export=function e(t,r){return this.rpcCall(e,Ls.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest,Ls.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,t,r)},"name",{value:"Export"}),s),e.ExportTraceServiceRequest=(o.prototype.resourceSpans=ks.emptyArray,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Us.create(),null!=e.resourceSpans&&e.resourceSpans.length)for(var r=0;r<e.resourceSpans.length;++r)Ls.opentelemetry.proto.trace.v1.ResourceSpans.encode(e.resourceSpans[r],t.uint32(10).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceSpans&&o.resourceSpans.length||(o.resourceSpans=[]),o.resourceSpans.push(Ls.opentelemetry.proto.trace.v1.ResourceSpans.decode(e,e.uint32()))):e.skipType(7&s)}return o},o.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceSpans&&e.hasOwnProperty("resourceSpans")){if(!Array.isArray(e.resourceSpans))return"resourceSpans: array expected";for(var t=0;t<e.resourceSpans.length;++t){var r=Ls.opentelemetry.proto.trace.v1.ResourceSpans.verify(e.resourceSpans[t]);if(r)return"resourceSpans."+r}}return null},o.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest)return e;var t=new Ls.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;if(e.resourceSpans){if(!Array.isArray(e.resourceSpans))throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: array expected");t.resourceSpans=[];for(var r=0;r<e.resourceSpans.length;++r){if("object"!=typeof e.resourceSpans[r])throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest.resourceSpans: object expected");t.resourceSpans[r]=Ls.opentelemetry.proto.trace.v1.ResourceSpans.fromObject(e.resourceSpans[r])}}return t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceSpans=[]),e.resourceSpans&&e.resourceSpans.length){r.resourceSpans=[];for(var n=0;n<e.resourceSpans.length;++n)r.resourceSpans[n]=Ls.opentelemetry.proto.trace.v1.ResourceSpans.toObject(e.resourceSpans[n],t)}return r},o.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest"},o),e.ExportTraceServiceResponse=(n.prototype.partialSuccess=null,n.create=function(e){return new n(e)},n.encode=function(e,t){return t=t||Us.create(),null!=e.partialSuccess&&Object.hasOwnProperty.call(e,"partialSuccess")&&Ls.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.encode(e.partialSuccess,t.uint32(10).fork()).ldelim(),t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?o.partialSuccess=Ls.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.decode(e,e.uint32()):e.skipType(7&s)}return o},n.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")){e=Ls.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.verify(e.partialSuccess);if(e)return"partialSuccess."+e}return null},n.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse)return e;var t=new Ls.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;if(null!=e.partialSuccess){if("object"!=typeof e.partialSuccess)throw TypeError(".opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse.partialSuccess: object expected");t.partialSuccess=Ls.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.fromObject(e.partialSuccess)}return t},n.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.partialSuccess=null),null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")&&(r.partialSuccess=Ls.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess.toObject(e.partialSuccess,t)),r},n.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse"},n),e.ExportTracePartialSuccess=(r.prototype.rejectedSpans=null,r.prototype.errorMessage=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t=t||Us.create(),null!=e.rejectedSpans&&Object.hasOwnProperty.call(e,"rejectedSpans")&&t.uint32(8).int64(e.rejectedSpans),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},r.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},r.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.rejectedSpans=e.int64();break;case 2:o.errorMessage=e.string();break;default:e.skipType(7&s)}}return o},r.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},r.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.rejectedSpans&&e.hasOwnProperty("rejectedSpans")&&!(ks.isInteger(e.rejectedSpans)||e.rejectedSpans&&ks.isInteger(e.rejectedSpans.low)&&ks.isInteger(e.rejectedSpans.high))?"rejectedSpans: integer|Long expected":null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&!ks.isString(e.errorMessage)?"errorMessage: string expected":null},r.fromObject=function(e){var t;return e instanceof Ls.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess?e:(t=new Ls.opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess,null!=e.rejectedSpans&&(ks.Long?(t.rejectedSpans=ks.Long.fromValue(e.rejectedSpans)).unsigned=!1:"string"==typeof e.rejectedSpans?t.rejectedSpans=parseInt(e.rejectedSpans,10):"number"==typeof e.rejectedSpans?t.rejectedSpans=e.rejectedSpans:"object"==typeof e.rejectedSpans&&(t.rejectedSpans=new ks.LongBits(e.rejectedSpans.low>>>0,e.rejectedSpans.high>>>0).toNumber())),null!=e.errorMessage&&(t.errorMessage=String(e.errorMessage)),t)},r.toObject=function(e,t){var r,n={};return(t=t||{}).defaults&&(ks.Long?(r=new ks.Long(0,0,!1),n.rejectedSpans=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.rejectedSpans=t.longs===String?"0":0,n.errorMessage=""),null!=e.rejectedSpans&&e.hasOwnProperty("rejectedSpans")&&("number"==typeof e.rejectedSpans?n.rejectedSpans=t.longs===String?String(e.rejectedSpans):e.rejectedSpans:n.rejectedSpans=t.longs===String?ks.Long.prototype.toString.call(e.rejectedSpans):t.longs===Number?new ks.LongBits(e.rejectedSpans.low>>>0,e.rejectedSpans.high>>>0).toNumber():e.rejectedSpans),null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&(n.errorMessage=e.errorMessage),n},r.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},r.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess"},r),e),t;function r(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.resourceSpans=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e,t,r){Is.rpc.Service.call(this,e,t,r)}})(),Cs.metrics=(()=>{var e,t={};return t.v1=((e={}).MetricsService=(((s.prototype=Object.create(Is.rpc.Service.prototype)).constructor=s).create=function(e,t,r){return new this(e,t,r)},Object.defineProperty(s.prototype.export=function e(t,r){return this.rpcCall(e,Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,t,r)},"name",{value:"Export"}),s),e.ExportMetricsServiceRequest=(o.prototype.resourceMetrics=ks.emptyArray,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Us.create(),null!=e.resourceMetrics&&e.resourceMetrics.length)for(var r=0;r<e.resourceMetrics.length;++r)Ls.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(e.resourceMetrics[r],t.uint32(10).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceMetrics&&o.resourceMetrics.length||(o.resourceMetrics=[]),o.resourceMetrics.push(Ls.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(e,e.uint32()))):e.skipType(7&s)}return o},o.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceMetrics&&e.hasOwnProperty("resourceMetrics")){if(!Array.isArray(e.resourceMetrics))return"resourceMetrics: array expected";for(var t=0;t<e.resourceMetrics.length;++t){var r=Ls.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(e.resourceMetrics[t]);if(r)return"resourceMetrics."+r}}return null},o.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest)return e;var t=new Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest;if(e.resourceMetrics){if(!Array.isArray(e.resourceMetrics))throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: array expected");t.resourceMetrics=[];for(var r=0;r<e.resourceMetrics.length;++r){if("object"!=typeof e.resourceMetrics[r])throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest.resourceMetrics: object expected");t.resourceMetrics[r]=Ls.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(e.resourceMetrics[r])}}return t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceMetrics=[]),e.resourceMetrics&&e.resourceMetrics.length){r.resourceMetrics=[];for(var n=0;n<e.resourceMetrics.length;++n)r.resourceMetrics[n]=Ls.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(e.resourceMetrics[n],t)}return r},o.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest"},o),e.ExportMetricsServiceResponse=(n.prototype.partialSuccess=null,n.create=function(e){return new n(e)},n.encode=function(e,t){return t=t||Us.create(),null!=e.partialSuccess&&Object.hasOwnProperty.call(e,"partialSuccess")&&Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.encode(e.partialSuccess,t.uint32(10).fork()).ldelim(),t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?o.partialSuccess=Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.decode(e,e.uint32()):e.skipType(7&s)}return o},n.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")){e=Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.verify(e.partialSuccess);if(e)return"partialSuccess."+e}return null},n.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse)return e;var t=new Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse;if(null!=e.partialSuccess){if("object"!=typeof e.partialSuccess)throw TypeError(".opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse.partialSuccess: object expected");t.partialSuccess=Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.fromObject(e.partialSuccess)}return t},n.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.partialSuccess=null),null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")&&(r.partialSuccess=Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess.toObject(e.partialSuccess,t)),r},n.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse"},n),e.ExportMetricsPartialSuccess=(r.prototype.rejectedDataPoints=null,r.prototype.errorMessage=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t=t||Us.create(),null!=e.rejectedDataPoints&&Object.hasOwnProperty.call(e,"rejectedDataPoints")&&t.uint32(8).int64(e.rejectedDataPoints),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},r.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},r.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.rejectedDataPoints=e.int64();break;case 2:o.errorMessage=e.string();break;default:e.skipType(7&s)}}return o},r.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},r.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.rejectedDataPoints&&e.hasOwnProperty("rejectedDataPoints")&&!(ks.isInteger(e.rejectedDataPoints)||e.rejectedDataPoints&&ks.isInteger(e.rejectedDataPoints.low)&&ks.isInteger(e.rejectedDataPoints.high))?"rejectedDataPoints: integer|Long expected":null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&!ks.isString(e.errorMessage)?"errorMessage: string expected":null},r.fromObject=function(e){var t;return e instanceof Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess?e:(t=new Ls.opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess,null!=e.rejectedDataPoints&&(ks.Long?(t.rejectedDataPoints=ks.Long.fromValue(e.rejectedDataPoints)).unsigned=!1:"string"==typeof e.rejectedDataPoints?t.rejectedDataPoints=parseInt(e.rejectedDataPoints,10):"number"==typeof e.rejectedDataPoints?t.rejectedDataPoints=e.rejectedDataPoints:"object"==typeof e.rejectedDataPoints&&(t.rejectedDataPoints=new ks.LongBits(e.rejectedDataPoints.low>>>0,e.rejectedDataPoints.high>>>0).toNumber())),null!=e.errorMessage&&(t.errorMessage=String(e.errorMessage)),t)},r.toObject=function(e,t){var r,n={};return(t=t||{}).defaults&&(ks.Long?(r=new ks.Long(0,0,!1),n.rejectedDataPoints=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.rejectedDataPoints=t.longs===String?"0":0,n.errorMessage=""),null!=e.rejectedDataPoints&&e.hasOwnProperty("rejectedDataPoints")&&("number"==typeof e.rejectedDataPoints?n.rejectedDataPoints=t.longs===String?String(e.rejectedDataPoints):e.rejectedDataPoints:n.rejectedDataPoints=t.longs===String?ks.Long.prototype.toString.call(e.rejectedDataPoints):t.longs===Number?new ks.LongBits(e.rejectedDataPoints.low>>>0,e.rejectedDataPoints.high>>>0).toNumber():e.rejectedDataPoints),null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&(n.errorMessage=e.errorMessage),n},r.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},r.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess"},r),e),t;function r(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.resourceMetrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e,t,r){Is.rpc.Service.call(this,e,t,r)}})(),Cs.logs=(()=>{var e,t={};return t.v1=((e={}).LogsService=(((s.prototype=Object.create(Is.rpc.Service.prototype)).constructor=s).create=function(e,t,r){return new this(e,t,r)},Object.defineProperty(s.prototype.export=function e(t,r){return this.rpcCall(e,Ls.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,Ls.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,t,r)},"name",{value:"Export"}),s),e.ExportLogsServiceRequest=(o.prototype.resourceLogs=ks.emptyArray,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Us.create(),null!=e.resourceLogs&&e.resourceLogs.length)for(var r=0;r<e.resourceLogs.length;++r)Ls.opentelemetry.proto.logs.v1.ResourceLogs.encode(e.resourceLogs[r],t.uint32(10).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceLogs&&o.resourceLogs.length||(o.resourceLogs=[]),o.resourceLogs.push(Ls.opentelemetry.proto.logs.v1.ResourceLogs.decode(e,e.uint32()))):e.skipType(7&s)}return o},o.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceLogs&&e.hasOwnProperty("resourceLogs")){if(!Array.isArray(e.resourceLogs))return"resourceLogs: array expected";for(var t=0;t<e.resourceLogs.length;++t){var r=Ls.opentelemetry.proto.logs.v1.ResourceLogs.verify(e.resourceLogs[t]);if(r)return"resourceLogs."+r}}return null},o.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest)return e;var t=new Ls.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest;if(e.resourceLogs){if(!Array.isArray(e.resourceLogs))throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: array expected");t.resourceLogs=[];for(var r=0;r<e.resourceLogs.length;++r){if("object"!=typeof e.resourceLogs[r])throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest.resourceLogs: object expected");t.resourceLogs[r]=Ls.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(e.resourceLogs[r])}}return t},o.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceLogs=[]),e.resourceLogs&&e.resourceLogs.length){r.resourceLogs=[];for(var n=0;n<e.resourceLogs.length;++n)r.resourceLogs[n]=Ls.opentelemetry.proto.logs.v1.ResourceLogs.toObject(e.resourceLogs[n],t)}return r},o.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest"},o),e.ExportLogsServiceResponse=(n.prototype.partialSuccess=null,n.create=function(e){return new n(e)},n.encode=function(e,t){return t=t||Us.create(),null!=e.partialSuccess&&Object.hasOwnProperty.call(e,"partialSuccess")&&Ls.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.encode(e.partialSuccess,t.uint32(10).fork()).ldelim(),t},n.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},n.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?o.partialSuccess=Ls.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.decode(e,e.uint32()):e.skipType(7&s)}return o},n.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},n.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")){e=Ls.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.verify(e.partialSuccess);if(e)return"partialSuccess."+e}return null},n.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse)return e;var t=new Ls.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse;if(null!=e.partialSuccess){if("object"!=typeof e.partialSuccess)throw TypeError(".opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse.partialSuccess: object expected");t.partialSuccess=Ls.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.fromObject(e.partialSuccess)}return t},n.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.partialSuccess=null),null!=e.partialSuccess&&e.hasOwnProperty("partialSuccess")&&(r.partialSuccess=Ls.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess.toObject(e.partialSuccess,t)),r},n.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},n.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse"},n),e.ExportLogsPartialSuccess=(r.prototype.rejectedLogRecords=null,r.prototype.errorMessage=null,r.create=function(e){return new r(e)},r.encode=function(e,t){return t=t||Us.create(),null!=e.rejectedLogRecords&&Object.hasOwnProperty.call(e,"rejectedLogRecords")&&t.uint32(8).int64(e.rejectedLogRecords),null!=e.errorMessage&&Object.hasOwnProperty.call(e,"errorMessage")&&t.uint32(18).string(e.errorMessage),t},r.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},r.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.rejectedLogRecords=e.int64();break;case 2:o.errorMessage=e.string();break;default:e.skipType(7&s)}}return o},r.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},r.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.rejectedLogRecords&&e.hasOwnProperty("rejectedLogRecords")&&!(ks.isInteger(e.rejectedLogRecords)||e.rejectedLogRecords&&ks.isInteger(e.rejectedLogRecords.low)&&ks.isInteger(e.rejectedLogRecords.high))?"rejectedLogRecords: integer|Long expected":null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&!ks.isString(e.errorMessage)?"errorMessage: string expected":null},r.fromObject=function(e){var t;return e instanceof Ls.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess?e:(t=new Ls.opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess,null!=e.rejectedLogRecords&&(ks.Long?(t.rejectedLogRecords=ks.Long.fromValue(e.rejectedLogRecords)).unsigned=!1:"string"==typeof e.rejectedLogRecords?t.rejectedLogRecords=parseInt(e.rejectedLogRecords,10):"number"==typeof e.rejectedLogRecords?t.rejectedLogRecords=e.rejectedLogRecords:"object"==typeof e.rejectedLogRecords&&(t.rejectedLogRecords=new ks.LongBits(e.rejectedLogRecords.low>>>0,e.rejectedLogRecords.high>>>0).toNumber())),null!=e.errorMessage&&(t.errorMessage=String(e.errorMessage)),t)},r.toObject=function(e,t){var r,n={};return(t=t||{}).defaults&&(ks.Long?(r=new ks.Long(0,0,!1),n.rejectedLogRecords=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.rejectedLogRecords=t.longs===String?"0":0,n.errorMessage=""),null!=e.rejectedLogRecords&&e.hasOwnProperty("rejectedLogRecords")&&("number"==typeof e.rejectedLogRecords?n.rejectedLogRecords=t.longs===String?String(e.rejectedLogRecords):e.rejectedLogRecords:n.rejectedLogRecords=t.longs===String?ks.Long.prototype.toString.call(e.rejectedLogRecords):t.longs===Number?new ks.LongBits(e.rejectedLogRecords.low>>>0,e.rejectedLogRecords.high>>>0).toNumber():e.rejectedLogRecords),null!=e.errorMessage&&e.hasOwnProperty("errorMessage")&&(n.errorMessage=e.errorMessage),n},r.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},r.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess"},r),e),t;function r(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function o(e){if(this.resourceLogs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e,t,r){Is.rpc.Service.call(this,e,t,r)}})(),Cs),Rs.metrics=(()=>{var e,t,r,n={};return n.v1=((r={}).MetricsData=(v.prototype.resourceMetrics=ks.emptyArray,v.create=function(e){return new v(e)},v.encode=function(e,t){if(t=t||Us.create(),null!=e.resourceMetrics&&e.resourceMetrics.length)for(var r=0;r<e.resourceMetrics.length;++r)Ls.opentelemetry.proto.metrics.v1.ResourceMetrics.encode(e.resourceMetrics[r],t.uint32(10).fork()).ldelim();return t},v.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},v.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.MetricsData;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceMetrics&&o.resourceMetrics.length||(o.resourceMetrics=[]),o.resourceMetrics.push(Ls.opentelemetry.proto.metrics.v1.ResourceMetrics.decode(e,e.uint32()))):e.skipType(7&s)}return o},v.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},v.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceMetrics&&e.hasOwnProperty("resourceMetrics")){if(!Array.isArray(e.resourceMetrics))return"resourceMetrics: array expected";for(var t=0;t<e.resourceMetrics.length;++t){var r=Ls.opentelemetry.proto.metrics.v1.ResourceMetrics.verify(e.resourceMetrics[t]);if(r)return"resourceMetrics."+r}}return null},v.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.metrics.v1.MetricsData)return e;var t=new Ls.opentelemetry.proto.metrics.v1.MetricsData;if(e.resourceMetrics){if(!Array.isArray(e.resourceMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: array expected");t.resourceMetrics=[];for(var r=0;r<e.resourceMetrics.length;++r){if("object"!=typeof e.resourceMetrics[r])throw TypeError(".opentelemetry.proto.metrics.v1.MetricsData.resourceMetrics: object expected");t.resourceMetrics[r]=Ls.opentelemetry.proto.metrics.v1.ResourceMetrics.fromObject(e.resourceMetrics[r])}}return t},v.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceMetrics=[]),e.resourceMetrics&&e.resourceMetrics.length){r.resourceMetrics=[];for(var n=0;n<e.resourceMetrics.length;++n)r.resourceMetrics[n]=Ls.opentelemetry.proto.metrics.v1.ResourceMetrics.toObject(e.resourceMetrics[n],t)}return r},v.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},v.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.MetricsData"},v),r.ResourceMetrics=(_.prototype.resource=null,_.prototype.scopeMetrics=ks.emptyArray,_.prototype.schemaUrl=null,_.create=function(e){return new _(e)},_.encode=function(e,t){if(t=t||Us.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&Ls.opentelemetry.proto.resource.v1.Resource.encode(e.resource,t.uint32(10).fork()).ldelim(),null!=e.scopeMetrics&&e.scopeMetrics.length)for(var r=0;r<e.scopeMetrics.length;++r)Ls.opentelemetry.proto.metrics.v1.ScopeMetrics.encode(e.scopeMetrics[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},_.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},_.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.ResourceMetrics;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.resource=Ls.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break;case 2:o.scopeMetrics&&o.scopeMetrics.length||(o.scopeMetrics=[]),o.scopeMetrics.push(Ls.opentelemetry.proto.metrics.v1.ScopeMetrics.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},_.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},_.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&(t=Ls.opentelemetry.proto.resource.v1.Resource.verify(e.resource)))return"resource."+t;if(null!=e.scopeMetrics&&e.hasOwnProperty("scopeMetrics")){if(!Array.isArray(e.scopeMetrics))return"scopeMetrics: array expected";for(var t,r=0;r<e.scopeMetrics.length;++r)if(t=Ls.opentelemetry.proto.metrics.v1.ScopeMetrics.verify(e.scopeMetrics[r]))return"scopeMetrics."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!ks.isString(e.schemaUrl)?"schemaUrl: string expected":null},_.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.metrics.v1.ResourceMetrics)return e;var t=new Ls.opentelemetry.proto.metrics.v1.ResourceMetrics;if(null!=e.resource){if("object"!=typeof e.resource)throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.resource: object expected");t.resource=Ls.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeMetrics){if(!Array.isArray(e.scopeMetrics))throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: array expected");t.scopeMetrics=[];for(var r=0;r<e.scopeMetrics.length;++r){if("object"!=typeof e.scopeMetrics[r])throw TypeError(".opentelemetry.proto.metrics.v1.ResourceMetrics.scopeMetrics: object expected");t.scopeMetrics[r]=Ls.opentelemetry.proto.metrics.v1.ScopeMetrics.fromObject(e.scopeMetrics[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},_.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.scopeMetrics=[]),t.defaults&&(r.resource=null,r.schemaUrl=""),null!=e.resource&&e.hasOwnProperty("resource")&&(r.resource=Ls.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,t)),e.scopeMetrics&&e.scopeMetrics.length){r.scopeMetrics=[];for(var n=0;n<e.scopeMetrics.length;++n)r.scopeMetrics[n]=Ls.opentelemetry.proto.metrics.v1.ScopeMetrics.toObject(e.scopeMetrics[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},_.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},_.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ResourceMetrics"},_),r.ScopeMetrics=(y.prototype.scope=null,y.prototype.metrics=ks.emptyArray,y.prototype.schemaUrl=null,y.create=function(e){return new y(e)},y.encode=function(e,t){if(t=t||Us.create(),null!=e.scope&&Object.hasOwnProperty.call(e,"scope")&&Ls.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,t.uint32(10).fork()).ldelim(),null!=e.metrics&&e.metrics.length)for(var r=0;r<e.metrics.length;++r)Ls.opentelemetry.proto.metrics.v1.Metric.encode(e.metrics[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},y.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},y.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.ScopeMetrics;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.scope=Ls.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break;case 2:o.metrics&&o.metrics.length||(o.metrics=[]),o.metrics.push(Ls.opentelemetry.proto.metrics.v1.Metric.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},y.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},y.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.scope&&e.hasOwnProperty("scope")&&(t=Ls.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope)))return"scope."+t;if(null!=e.metrics&&e.hasOwnProperty("metrics")){if(!Array.isArray(e.metrics))return"metrics: array expected";for(var t,r=0;r<e.metrics.length;++r)if(t=Ls.opentelemetry.proto.metrics.v1.Metric.verify(e.metrics[r]))return"metrics."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!ks.isString(e.schemaUrl)?"schemaUrl: string expected":null},y.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.metrics.v1.ScopeMetrics)return e;var t=new Ls.opentelemetry.proto.metrics.v1.ScopeMetrics;if(null!=e.scope){if("object"!=typeof e.scope)throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.scope: object expected");t.scope=Ls.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.metrics){if(!Array.isArray(e.metrics))throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: array expected");t.metrics=[];for(var r=0;r<e.metrics.length;++r){if("object"!=typeof e.metrics[r])throw TypeError(".opentelemetry.proto.metrics.v1.ScopeMetrics.metrics: object expected");t.metrics[r]=Ls.opentelemetry.proto.metrics.v1.Metric.fromObject(e.metrics[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},y.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.metrics=[]),t.defaults&&(r.scope=null,r.schemaUrl=""),null!=e.scope&&e.hasOwnProperty("scope")&&(r.scope=Ls.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,t)),e.metrics&&e.metrics.length){r.metrics=[];for(var n=0;n<e.metrics.length;++n)r.metrics[n]=Ls.opentelemetry.proto.metrics.v1.Metric.toObject(e.metrics[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},y.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},y.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ScopeMetrics"},y),r.Metric=(g.prototype.name=null,g.prototype.description=null,g.prototype.unit=null,g.prototype.gauge=null,g.prototype.sum=null,g.prototype.histogram=null,g.prototype.exponentialHistogram=null,g.prototype.summary=null,g.prototype.metadata=ks.emptyArray,Object.defineProperty(g.prototype,"data",{get:ks.oneOfGetter(t=["gauge","sum","histogram","exponentialHistogram","summary"]),set:ks.oneOfSetter(t)}),g.create=function(e){return new g(e)},g.encode=function(e,t){if(t=t||Us.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.description&&Object.hasOwnProperty.call(e,"description")&&t.uint32(18).string(e.description),null!=e.unit&&Object.hasOwnProperty.call(e,"unit")&&t.uint32(26).string(e.unit),null!=e.gauge&&Object.hasOwnProperty.call(e,"gauge")&&Ls.opentelemetry.proto.metrics.v1.Gauge.encode(e.gauge,t.uint32(42).fork()).ldelim(),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&Ls.opentelemetry.proto.metrics.v1.Sum.encode(e.sum,t.uint32(58).fork()).ldelim(),null!=e.histogram&&Object.hasOwnProperty.call(e,"histogram")&&Ls.opentelemetry.proto.metrics.v1.Histogram.encode(e.histogram,t.uint32(74).fork()).ldelim(),null!=e.exponentialHistogram&&Object.hasOwnProperty.call(e,"exponentialHistogram")&&Ls.opentelemetry.proto.metrics.v1.ExponentialHistogram.encode(e.exponentialHistogram,t.uint32(82).fork()).ldelim(),null!=e.summary&&Object.hasOwnProperty.call(e,"summary")&&Ls.opentelemetry.proto.metrics.v1.Summary.encode(e.summary,t.uint32(90).fork()).ldelim(),null!=e.metadata&&e.metadata.length)for(var r=0;r<e.metadata.length;++r)Ls.opentelemetry.proto.common.v1.KeyValue.encode(e.metadata[r],t.uint32(98).fork()).ldelim();return t},g.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},g.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.Metric;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.name=e.string();break;case 2:o.description=e.string();break;case 3:o.unit=e.string();break;case 5:o.gauge=Ls.opentelemetry.proto.metrics.v1.Gauge.decode(e,e.uint32());break;case 7:o.sum=Ls.opentelemetry.proto.metrics.v1.Sum.decode(e,e.uint32());break;case 9:o.histogram=Ls.opentelemetry.proto.metrics.v1.Histogram.decode(e,e.uint32());break;case 10:o.exponentialHistogram=Ls.opentelemetry.proto.metrics.v1.ExponentialHistogram.decode(e,e.uint32());break;case 11:o.summary=Ls.opentelemetry.proto.metrics.v1.Summary.decode(e,e.uint32());break;case 12:o.metadata&&o.metadata.length||(o.metadata=[]),o.metadata.push(Ls.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;default:e.skipType(7&s)}}return o},g.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},g.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.name&&e.hasOwnProperty("name")&&!ks.isString(e.name))return"name: string expected";if(null!=e.description&&e.hasOwnProperty("description")&&!ks.isString(e.description))return"description: string expected";if(null!=e.unit&&e.hasOwnProperty("unit")&&!ks.isString(e.unit))return"unit: string expected";if(null!=e.gauge&&e.hasOwnProperty("gauge")&&(t.data=1,r=Ls.opentelemetry.proto.metrics.v1.Gauge.verify(e.gauge)))return"gauge."+r;if(null!=e.sum&&e.hasOwnProperty("sum")){if(1===t.data)return"data: multiple values";if(t.data=1,r=Ls.opentelemetry.proto.metrics.v1.Sum.verify(e.sum))return"sum."+r}if(null!=e.histogram&&e.hasOwnProperty("histogram")){if(1===t.data)return"data: multiple values";if(t.data=1,r=Ls.opentelemetry.proto.metrics.v1.Histogram.verify(e.histogram))return"histogram."+r}if(null!=e.exponentialHistogram&&e.hasOwnProperty("exponentialHistogram")){if(1===t.data)return"data: multiple values";if(t.data=1,r=Ls.opentelemetry.proto.metrics.v1.ExponentialHistogram.verify(e.exponentialHistogram))return"exponentialHistogram."+r}if(null!=e.summary&&e.hasOwnProperty("summary")){if(1===t.data)return"data: multiple values";if(t.data=1,r=Ls.opentelemetry.proto.metrics.v1.Summary.verify(e.summary))return"summary."+r}if(null!=e.metadata&&e.hasOwnProperty("metadata")){if(!Array.isArray(e.metadata))return"metadata: array expected";for(var r,n=0;n<e.metadata.length;++n)if(r=Ls.opentelemetry.proto.common.v1.KeyValue.verify(e.metadata[n]))return"metadata."+r}return null},g.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.metrics.v1.Metric)return e;var t=new Ls.opentelemetry.proto.metrics.v1.Metric;if(null!=e.name&&(t.name=String(e.name)),null!=e.description&&(t.description=String(e.description)),null!=e.unit&&(t.unit=String(e.unit)),null!=e.gauge){if("object"!=typeof e.gauge)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.gauge: object expected");t.gauge=Ls.opentelemetry.proto.metrics.v1.Gauge.fromObject(e.gauge)}if(null!=e.sum){if("object"!=typeof e.sum)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.sum: object expected");t.sum=Ls.opentelemetry.proto.metrics.v1.Sum.fromObject(e.sum)}if(null!=e.histogram){if("object"!=typeof e.histogram)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.histogram: object expected");t.histogram=Ls.opentelemetry.proto.metrics.v1.Histogram.fromObject(e.histogram)}if(null!=e.exponentialHistogram){if("object"!=typeof e.exponentialHistogram)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.exponentialHistogram: object expected");t.exponentialHistogram=Ls.opentelemetry.proto.metrics.v1.ExponentialHistogram.fromObject(e.exponentialHistogram)}if(null!=e.summary){if("object"!=typeof e.summary)throw TypeError(".opentelemetry.proto.metrics.v1.Metric.summary: object expected");t.summary=Ls.opentelemetry.proto.metrics.v1.Summary.fromObject(e.summary)}if(e.metadata){if(!Array.isArray(e.metadata))throw TypeError(".opentelemetry.proto.metrics.v1.Metric.metadata: array expected");t.metadata=[];for(var r=0;r<e.metadata.length;++r){if("object"!=typeof e.metadata[r])throw TypeError(".opentelemetry.proto.metrics.v1.Metric.metadata: object expected");t.metadata[r]=Ls.opentelemetry.proto.common.v1.KeyValue.fromObject(e.metadata[r])}}return t},g.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.metadata=[]),t.defaults&&(r.name="",r.description="",r.unit=""),null!=e.name&&e.hasOwnProperty("name")&&(r.name=e.name),null!=e.description&&e.hasOwnProperty("description")&&(r.description=e.description),null!=e.unit&&e.hasOwnProperty("unit")&&(r.unit=e.unit),null!=e.gauge&&e.hasOwnProperty("gauge")&&(r.gauge=Ls.opentelemetry.proto.metrics.v1.Gauge.toObject(e.gauge,t),t.oneofs)&&(r.data="gauge"),null!=e.sum&&e.hasOwnProperty("sum")&&(r.sum=Ls.opentelemetry.proto.metrics.v1.Sum.toObject(e.sum,t),t.oneofs)&&(r.data="sum"),null!=e.histogram&&e.hasOwnProperty("histogram")&&(r.histogram=Ls.opentelemetry.proto.metrics.v1.Histogram.toObject(e.histogram,t),t.oneofs)&&(r.data="histogram"),null!=e.exponentialHistogram&&e.hasOwnProperty("exponentialHistogram")&&(r.exponentialHistogram=Ls.opentelemetry.proto.metrics.v1.ExponentialHistogram.toObject(e.exponentialHistogram,t),t.oneofs)&&(r.data="exponentialHistogram"),null!=e.summary&&e.hasOwnProperty("summary")&&(r.summary=Ls.opentelemetry.proto.metrics.v1.Summary.toObject(e.summary,t),t.oneofs)&&(r.data="summary"),e.metadata&&e.metadata.length){r.metadata=[];for(var n=0;n<e.metadata.length;++n)r.metadata[n]=Ls.opentelemetry.proto.common.v1.KeyValue.toObject(e.metadata[n],t)}return r},g.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},g.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Metric"},g),r.Gauge=(m.prototype.dataPoints=ks.emptyArray,m.create=function(e){return new m(e)},m.encode=function(e,t){if(t=t||Us.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)Ls.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return t},m.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},m.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.Gauge;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(Ls.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(e,e.uint32()))):e.skipType(7&s)}return o},m.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},m.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=Ls.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}return null},m.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.metrics.v1.Gauge)return e;var t=new Ls.opentelemetry.proto.metrics.v1.Gauge;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Gauge.dataPoints: object expected");t.dataPoints[r]=Ls.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(e.dataPoints[r])}}return t},m.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=Ls.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(e.dataPoints[n],t)}return r},m.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},m.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Gauge"},m),r.Sum=(f.prototype.dataPoints=ks.emptyArray,f.prototype.aggregationTemporality=null,f.prototype.isMonotonic=null,f.create=function(e){return new f(e)},f.encode=function(e,t){if(t=t||Us.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)Ls.opentelemetry.proto.metrics.v1.NumberDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return null!=e.aggregationTemporality&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&t.uint32(16).int32(e.aggregationTemporality),null!=e.isMonotonic&&Object.hasOwnProperty.call(e,"isMonotonic")&&t.uint32(24).bool(e.isMonotonic),t},f.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},f.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.Sum;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(Ls.opentelemetry.proto.metrics.v1.NumberDataPoint.decode(e,e.uint32()));break;case 2:o.aggregationTemporality=e.int32();break;case 3:o.isMonotonic=e.bool();break;default:e.skipType(7&s)}}return o},f.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},f.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=Ls.opentelemetry.proto.metrics.v1.NumberDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}if(null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:}return null!=e.isMonotonic&&e.hasOwnProperty("isMonotonic")&&"boolean"!=typeof e.isMonotonic?"isMonotonic: boolean expected":null},f.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.metrics.v1.Sum)return e;var t=new Ls.opentelemetry.proto.metrics.v1.Sum;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Sum.dataPoints: object expected");t.dataPoints[r]=Ls.opentelemetry.proto.metrics.v1.NumberDataPoint.fromObject(e.dataPoints[r])}}switch(e.aggregationTemporality){default:"number"==typeof e.aggregationTemporality&&(t.aggregationTemporality=e.aggregationTemporality);break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:t.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:t.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:t.aggregationTemporality=2}return null!=e.isMonotonic&&(t.isMonotonic=Boolean(e.isMonotonic)),t},f.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),t.defaults&&(r.aggregationTemporality=t.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0,r.isMonotonic=!1),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=Ls.opentelemetry.proto.metrics.v1.NumberDataPoint.toObject(e.dataPoints[n],t)}return null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality")&&(r.aggregationTemporality=t.enums!==String||void 0===Ls.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]?e.aggregationTemporality:Ls.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]),null!=e.isMonotonic&&e.hasOwnProperty("isMonotonic")&&(r.isMonotonic=e.isMonotonic),r},f.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},f.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Sum"},f),r.Histogram=(d.prototype.dataPoints=ks.emptyArray,d.prototype.aggregationTemporality=null,d.create=function(e){return new d(e)},d.encode=function(e,t){if(t=t||Us.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)Ls.opentelemetry.proto.metrics.v1.HistogramDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return null!=e.aggregationTemporality&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&t.uint32(16).int32(e.aggregationTemporality),t},d.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},d.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.Histogram;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(Ls.opentelemetry.proto.metrics.v1.HistogramDataPoint.decode(e,e.uint32()));break;case 2:o.aggregationTemporality=e.int32();break;default:e.skipType(7&s)}}return o},d.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},d.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=Ls.opentelemetry.proto.metrics.v1.HistogramDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}if(null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:}return null},d.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.metrics.v1.Histogram)return e;var t=new Ls.opentelemetry.proto.metrics.v1.Histogram;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Histogram.dataPoints: object expected");t.dataPoints[r]=Ls.opentelemetry.proto.metrics.v1.HistogramDataPoint.fromObject(e.dataPoints[r])}}switch(e.aggregationTemporality){default:"number"==typeof e.aggregationTemporality&&(t.aggregationTemporality=e.aggregationTemporality);break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:t.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:t.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:t.aggregationTemporality=2}return t},d.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),t.defaults&&(r.aggregationTemporality=t.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=Ls.opentelemetry.proto.metrics.v1.HistogramDataPoint.toObject(e.dataPoints[n],t)}return null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality")&&(r.aggregationTemporality=t.enums!==String||void 0===Ls.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]?e.aggregationTemporality:Ls.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]),r},d.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},d.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Histogram"},d),r.ExponentialHistogram=(h.prototype.dataPoints=ks.emptyArray,h.prototype.aggregationTemporality=null,h.create=function(e){return new h(e)},h.encode=function(e,t){if(t=t||Us.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return null!=e.aggregationTemporality&&Object.hasOwnProperty.call(e,"aggregationTemporality")&&t.uint32(16).int32(e.aggregationTemporality),t},h.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},h.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.ExponentialHistogram;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.decode(e,e.uint32()));break;case 2:o.aggregationTemporality=e.int32();break;default:e.skipType(7&s)}}return o},h.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},h.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}if(null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality"))switch(e.aggregationTemporality){default:return"aggregationTemporality: enum value expected";case 0:case 1:case 2:}return null},h.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.metrics.v1.ExponentialHistogram)return e;var t=new Ls.opentelemetry.proto.metrics.v1.ExponentialHistogram;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogram.dataPoints: object expected");t.dataPoints[r]=Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.fromObject(e.dataPoints[r])}}switch(e.aggregationTemporality){default:"number"==typeof e.aggregationTemporality&&(t.aggregationTemporality=e.aggregationTemporality);break;case"AGGREGATION_TEMPORALITY_UNSPECIFIED":case 0:t.aggregationTemporality=0;break;case"AGGREGATION_TEMPORALITY_DELTA":case 1:t.aggregationTemporality=1;break;case"AGGREGATION_TEMPORALITY_CUMULATIVE":case 2:t.aggregationTemporality=2}return t},h.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),t.defaults&&(r.aggregationTemporality=t.enums===String?"AGGREGATION_TEMPORALITY_UNSPECIFIED":0),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.toObject(e.dataPoints[n],t)}return null!=e.aggregationTemporality&&e.hasOwnProperty("aggregationTemporality")&&(r.aggregationTemporality=t.enums!==String||void 0===Ls.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]?e.aggregationTemporality:Ls.opentelemetry.proto.metrics.v1.AggregationTemporality[e.aggregationTemporality]),r},h.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},h.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ExponentialHistogram"},h),r.Summary=(p.prototype.dataPoints=ks.emptyArray,p.create=function(e){return new p(e)},p.encode=function(e,t){if(t=t||Us.create(),null!=e.dataPoints&&e.dataPoints.length)for(var r=0;r<e.dataPoints.length;++r)Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint.encode(e.dataPoints[r],t.uint32(10).fork()).ldelim();return t},p.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},p.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.Summary;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.dataPoints&&o.dataPoints.length||(o.dataPoints=[]),o.dataPoints.push(Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint.decode(e,e.uint32()))):e.skipType(7&s)}return o},p.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},p.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.dataPoints&&e.hasOwnProperty("dataPoints")){if(!Array.isArray(e.dataPoints))return"dataPoints: array expected";for(var t=0;t<e.dataPoints.length;++t){var r=Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint.verify(e.dataPoints[t]);if(r)return"dataPoints."+r}}return null},p.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.metrics.v1.Summary)return e;var t=new Ls.opentelemetry.proto.metrics.v1.Summary;if(e.dataPoints){if(!Array.isArray(e.dataPoints))throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: array expected");t.dataPoints=[];for(var r=0;r<e.dataPoints.length;++r){if("object"!=typeof e.dataPoints[r])throw TypeError(".opentelemetry.proto.metrics.v1.Summary.dataPoints: object expected");t.dataPoints[r]=Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint.fromObject(e.dataPoints[r])}}return t},p.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.dataPoints=[]),e.dataPoints&&e.dataPoints.length){r.dataPoints=[];for(var n=0;n<e.dataPoints.length;++n)r.dataPoints[n]=Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint.toObject(e.dataPoints[n],t)}return r},p.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},p.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Summary"},p),r.AggregationTemporality=(t={},(e=Object.create(t))[t[0]="AGGREGATION_TEMPORALITY_UNSPECIFIED"]=0,e[t[1]="AGGREGATION_TEMPORALITY_DELTA"]=1,e[t[2]="AGGREGATION_TEMPORALITY_CUMULATIVE"]=2,e),r.DataPointFlags=(t={},(e=Object.create(t))[t[0]="DATA_POINT_FLAGS_DO_NOT_USE"]=0,e[t[1]="DATA_POINT_FLAGS_NO_RECORDED_VALUE_MASK"]=1,e),r.NumberDataPoint=(c.prototype.attributes=ks.emptyArray,c.prototype.startTimeUnixNano=null,c.prototype.timeUnixNano=null,c.prototype.asDouble=null,c.prototype.asInt=null,c.prototype.exemplars=ks.emptyArray,c.prototype.flags=null,Object.defineProperty(c.prototype,"value",{get:ks.oneOfGetter(t=["asDouble","asInt"]),set:ks.oneOfSetter(t)}),c.create=function(e){return new c(e)},c.encode=function(e,t){if(t=t||Us.create(),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.asDouble&&Object.hasOwnProperty.call(e,"asDouble")&&t.uint32(33).double(e.asDouble),null!=e.exemplars&&e.exemplars.length)for(var r=0;r<e.exemplars.length;++r)Ls.opentelemetry.proto.metrics.v1.Exemplar.encode(e.exemplars[r],t.uint32(42).fork()).ldelim();if(null!=e.asInt&&Object.hasOwnProperty.call(e,"asInt")&&t.uint32(49).sfixed64(e.asInt),null!=e.attributes&&e.attributes.length)for(r=0;r<e.attributes.length;++r)Ls.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(58).fork()).ldelim();return null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(64).uint32(e.flags),t},c.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},c.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.NumberDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 7:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Ls.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.asDouble=e.double();break;case 6:o.asInt=e.sfixed64();break;case 5:o.exemplars&&o.exemplars.length||(o.exemplars=[]),o.exemplars.push(Ls.opentelemetry.proto.metrics.v1.Exemplar.decode(e,e.uint32()));break;case 8:o.flags=e.uint32();break;default:e.skipType(7&s)}}return o},c.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},c.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t,r={};if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var n=0;n<e.attributes.length;++n)if(t=Ls.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[n]))return"attributes."+t}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(ks.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&ks.isInteger(e.startTimeUnixNano.low)&&ks.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(ks.isInteger(e.timeUnixNano)||e.timeUnixNano&&ks.isInteger(e.timeUnixNano.low)&&ks.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(r.value=1,"number"!=typeof e.asDouble))return"asDouble: number expected";if(null!=e.asInt&&e.hasOwnProperty("asInt")){if(1===r.value)return"value: multiple values";if(r.value=1,!(ks.isInteger(e.asInt)||e.asInt&&ks.isInteger(e.asInt.low)&&ks.isInteger(e.asInt.high)))return"asInt: integer|Long expected"}if(null!=e.exemplars&&e.hasOwnProperty("exemplars")){if(!Array.isArray(e.exemplars))return"exemplars: array expected";for(n=0;n<e.exemplars.length;++n)if(t=Ls.opentelemetry.proto.metrics.v1.Exemplar.verify(e.exemplars[n]))return"exemplars."+t}return null!=e.flags&&e.hasOwnProperty("flags")&&!ks.isInteger(e.flags)?"flags: integer expected":null},c.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.metrics.v1.NumberDataPoint)return e;var t=new Ls.opentelemetry.proto.metrics.v1.NumberDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.attributes: object expected");t.attributes[r]=Ls.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(ks.Long?(t.startTimeUnixNano=ks.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new ks.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(ks.Long?(t.timeUnixNano=ks.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new ks.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.asDouble&&(t.asDouble=Number(e.asDouble)),null!=e.asInt&&(ks.Long?(t.asInt=ks.Long.fromValue(e.asInt)).unsigned=!1:"string"==typeof e.asInt?t.asInt=parseInt(e.asInt,10):"number"==typeof e.asInt?t.asInt=e.asInt:"object"==typeof e.asInt&&(t.asInt=new ks.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber())),e.exemplars){if(!Array.isArray(e.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: array expected");for(t.exemplars=[],r=0;r<e.exemplars.length;++r){if("object"!=typeof e.exemplars[r])throw TypeError(".opentelemetry.proto.metrics.v1.NumberDataPoint.exemplars: object expected");t.exemplars[r]=Ls.opentelemetry.proto.metrics.v1.Exemplar.fromObject(e.exemplars[r])}}return null!=e.flags&&(t.flags=e.flags>>>0),t},c.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.exemplars=[],n.attributes=[]),t.defaults&&(ks.Long?(r=new ks.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,ks.Long?(r=new ks.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,n.flags=0),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?ks.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new ks.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?ks.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new ks.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(n.asDouble=t.json&&!isFinite(e.asDouble)?String(e.asDouble):e.asDouble,t.oneofs)&&(n.value="asDouble"),e.exemplars&&e.exemplars.length){n.exemplars=[];for(var o=0;o<e.exemplars.length;++o)n.exemplars[o]=Ls.opentelemetry.proto.metrics.v1.Exemplar.toObject(e.exemplars[o],t)}if(null!=e.asInt&&e.hasOwnProperty("asInt")&&("number"==typeof e.asInt?n.asInt=t.longs===String?String(e.asInt):e.asInt:n.asInt=t.longs===String?ks.Long.prototype.toString.call(e.asInt):t.longs===Number?new ks.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber():e.asInt,t.oneofs)&&(n.value="asInt"),e.attributes&&e.attributes.length)for(n.attributes=[],o=0;o<e.attributes.length;++o)n.attributes[o]=Ls.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t);return null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),n},c.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},c.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.NumberDataPoint"},c),r.HistogramDataPoint=(l.prototype.attributes=ks.emptyArray,l.prototype.startTimeUnixNano=null,l.prototype.timeUnixNano=null,l.prototype.count=null,l.prototype.sum=null,l.prototype.bucketCounts=ks.emptyArray,l.prototype.explicitBounds=ks.emptyArray,l.prototype.exemplars=ks.emptyArray,l.prototype.flags=null,l.prototype.min=null,l.prototype.max=null,Object.defineProperty(l.prototype,"_sum",{get:ks.oneOfGetter(e=["sum"]),set:ks.oneOfSetter(e)}),Object.defineProperty(l.prototype,"_min",{get:ks.oneOfGetter(e=["min"]),set:ks.oneOfSetter(e)}),Object.defineProperty(l.prototype,"_max",{get:ks.oneOfGetter(e=["max"]),set:ks.oneOfSetter(e)}),l.create=function(e){return new l(e)},l.encode=function(e,t){if(t=t||Us.create(),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.count&&Object.hasOwnProperty.call(e,"count")&&t.uint32(33).fixed64(e.count),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&t.uint32(41).double(e.sum),null!=e.bucketCounts&&e.bucketCounts.length){t.uint32(50).fork();for(var r=0;r<e.bucketCounts.length;++r)t.fixed64(e.bucketCounts[r]);t.ldelim()}if(null!=e.explicitBounds&&e.explicitBounds.length){for(t.uint32(58).fork(),r=0;r<e.explicitBounds.length;++r)t.double(e.explicitBounds[r]);t.ldelim()}if(null!=e.exemplars&&e.exemplars.length)for(r=0;r<e.exemplars.length;++r)Ls.opentelemetry.proto.metrics.v1.Exemplar.encode(e.exemplars[r],t.uint32(66).fork()).ldelim();if(null!=e.attributes&&e.attributes.length)for(r=0;r<e.attributes.length;++r)Ls.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(74).fork()).ldelim();return null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(80).uint32(e.flags),null!=e.min&&Object.hasOwnProperty.call(e,"min")&&t.uint32(89).double(e.min),null!=e.max&&Object.hasOwnProperty.call(e,"max")&&t.uint32(97).double(e.max),t},l.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},l.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.HistogramDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 9:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Ls.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.count=e.fixed64();break;case 5:o.sum=e.double();break;case 6:if(o.bucketCounts&&o.bucketCounts.length||(o.bucketCounts=[]),2==(7&s))for(var i=e.uint32()+e.pos;e.pos<i;)o.bucketCounts.push(e.fixed64());else o.bucketCounts.push(e.fixed64());break;case 7:if(o.explicitBounds&&o.explicitBounds.length||(o.explicitBounds=[]),2==(7&s))for(i=e.uint32()+e.pos;e.pos<i;)o.explicitBounds.push(e.double());else o.explicitBounds.push(e.double());break;case 8:o.exemplars&&o.exemplars.length||(o.exemplars=[]),o.exemplars.push(Ls.opentelemetry.proto.metrics.v1.Exemplar.decode(e,e.uint32()));break;case 10:o.flags=e.uint32();break;case 11:o.min=e.double();break;case 12:o.max=e.double();break;default:e.skipType(7&s)}}return o},l.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},l.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=Ls.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(ks.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&ks.isInteger(e.startTimeUnixNano.low)&&ks.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(ks.isInteger(e.timeUnixNano)||e.timeUnixNano&&ks.isInteger(e.timeUnixNano.low)&&ks.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.count&&e.hasOwnProperty("count")&&!(ks.isInteger(e.count)||e.count&&ks.isInteger(e.count.low)&&ks.isInteger(e.count.high)))return"count: integer|Long expected";if(null!=e.sum&&e.hasOwnProperty("sum")&&"number"!=typeof e.sum)return"sum: number expected";if(null!=e.bucketCounts&&e.hasOwnProperty("bucketCounts")){if(!Array.isArray(e.bucketCounts))return"bucketCounts: array expected";for(t=0;t<e.bucketCounts.length;++t)if(!(ks.isInteger(e.bucketCounts[t])||e.bucketCounts[t]&&ks.isInteger(e.bucketCounts[t].low)&&ks.isInteger(e.bucketCounts[t].high)))return"bucketCounts: integer|Long[] expected"}if(null!=e.explicitBounds&&e.hasOwnProperty("explicitBounds")){if(!Array.isArray(e.explicitBounds))return"explicitBounds: array expected";for(t=0;t<e.explicitBounds.length;++t)if("number"!=typeof e.explicitBounds[t])return"explicitBounds: number[] expected"}if(null!=e.exemplars&&e.hasOwnProperty("exemplars")){if(!Array.isArray(e.exemplars))return"exemplars: array expected";for(t=0;t<e.exemplars.length;++t){var r;if(r=Ls.opentelemetry.proto.metrics.v1.Exemplar.verify(e.exemplars[t]))return"exemplars."+r}}return null!=e.flags&&e.hasOwnProperty("flags")&&!ks.isInteger(e.flags)?"flags: integer expected":null!=e.min&&e.hasOwnProperty("min")&&"number"!=typeof e.min?"min: number expected":null!=e.max&&e.hasOwnProperty("max")&&"number"!=typeof e.max?"max: number expected":null},l.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.metrics.v1.HistogramDataPoint)return e;var t=new Ls.opentelemetry.proto.metrics.v1.HistogramDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.attributes: object expected");t.attributes[r]=Ls.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(ks.Long?(t.startTimeUnixNano=ks.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new ks.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(ks.Long?(t.timeUnixNano=ks.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new ks.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.count&&(ks.Long?(t.count=ks.Long.fromValue(e.count)).unsigned=!1:"string"==typeof e.count?t.count=parseInt(e.count,10):"number"==typeof e.count?t.count=e.count:"object"==typeof e.count&&(t.count=new ks.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber())),null!=e.sum&&(t.sum=Number(e.sum)),e.bucketCounts){if(!Array.isArray(e.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.bucketCounts: array expected");for(t.bucketCounts=[],r=0;r<e.bucketCounts.length;++r)ks.Long?(t.bucketCounts[r]=ks.Long.fromValue(e.bucketCounts[r])).unsigned=!1:"string"==typeof e.bucketCounts[r]?t.bucketCounts[r]=parseInt(e.bucketCounts[r],10):"number"==typeof e.bucketCounts[r]?t.bucketCounts[r]=e.bucketCounts[r]:"object"==typeof e.bucketCounts[r]&&(t.bucketCounts[r]=new ks.LongBits(e.bucketCounts[r].low>>>0,e.bucketCounts[r].high>>>0).toNumber())}if(e.explicitBounds){if(!Array.isArray(e.explicitBounds))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.explicitBounds: array expected");for(t.explicitBounds=[],r=0;r<e.explicitBounds.length;++r)t.explicitBounds[r]=Number(e.explicitBounds[r])}if(e.exemplars){if(!Array.isArray(e.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: array expected");for(t.exemplars=[],r=0;r<e.exemplars.length;++r){if("object"!=typeof e.exemplars[r])throw TypeError(".opentelemetry.proto.metrics.v1.HistogramDataPoint.exemplars: object expected");t.exemplars[r]=Ls.opentelemetry.proto.metrics.v1.Exemplar.fromObject(e.exemplars[r])}}return null!=e.flags&&(t.flags=e.flags>>>0),null!=e.min&&(t.min=Number(e.min)),null!=e.max&&(t.max=Number(e.max)),t},l.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.bucketCounts=[],n.explicitBounds=[],n.exemplars=[],n.attributes=[]),t.defaults&&(ks.Long?(r=new ks.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,ks.Long?(r=new ks.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,ks.Long?(r=new ks.Long(0,0,!1),n.count=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.count=t.longs===String?"0":0,n.flags=0),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?ks.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new ks.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?ks.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new ks.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.count&&e.hasOwnProperty("count")&&("number"==typeof e.count?n.count=t.longs===String?String(e.count):e.count:n.count=t.longs===String?ks.Long.prototype.toString.call(e.count):t.longs===Number?new ks.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber():e.count),null!=e.sum&&e.hasOwnProperty("sum")&&(n.sum=t.json&&!isFinite(e.sum)?String(e.sum):e.sum,t.oneofs)&&(n._sum="sum"),e.bucketCounts&&e.bucketCounts.length){n.bucketCounts=[];for(var o=0;o<e.bucketCounts.length;++o)"number"==typeof e.bucketCounts[o]?n.bucketCounts[o]=t.longs===String?String(e.bucketCounts[o]):e.bucketCounts[o]:n.bucketCounts[o]=t.longs===String?ks.Long.prototype.toString.call(e.bucketCounts[o]):t.longs===Number?new ks.LongBits(e.bucketCounts[o].low>>>0,e.bucketCounts[o].high>>>0).toNumber():e.bucketCounts[o]}if(e.explicitBounds&&e.explicitBounds.length)for(n.explicitBounds=[],o=0;o<e.explicitBounds.length;++o)n.explicitBounds[o]=t.json&&!isFinite(e.explicitBounds[o])?String(e.explicitBounds[o]):e.explicitBounds[o];if(e.exemplars&&e.exemplars.length)for(n.exemplars=[],o=0;o<e.exemplars.length;++o)n.exemplars[o]=Ls.opentelemetry.proto.metrics.v1.Exemplar.toObject(e.exemplars[o],t);if(e.attributes&&e.attributes.length)for(n.attributes=[],o=0;o<e.attributes.length;++o)n.attributes[o]=Ls.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t);return null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),null!=e.min&&e.hasOwnProperty("min")&&(n.min=t.json&&!isFinite(e.min)?String(e.min):e.min,t.oneofs)&&(n._min="min"),null!=e.max&&e.hasOwnProperty("max")&&(n.max=t.json&&!isFinite(e.max)?String(e.max):e.max,t.oneofs)&&(n._max="max"),n},l.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},l.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.HistogramDataPoint"},l),r.ExponentialHistogramDataPoint=(a.prototype.attributes=ks.emptyArray,a.prototype.startTimeUnixNano=null,a.prototype.timeUnixNano=null,a.prototype.count=null,a.prototype.sum=null,a.prototype.scale=null,a.prototype.zeroCount=null,a.prototype.positive=null,a.prototype.negative=null,a.prototype.flags=null,a.prototype.exemplars=ks.emptyArray,a.prototype.min=null,a.prototype.max=null,a.prototype.zeroThreshold=null,Object.defineProperty(a.prototype,"_sum",{get:ks.oneOfGetter(t=["sum"]),set:ks.oneOfSetter(t)}),Object.defineProperty(a.prototype,"_min",{get:ks.oneOfGetter(t=["min"]),set:ks.oneOfSetter(t)}),Object.defineProperty(a.prototype,"_max",{get:ks.oneOfGetter(t=["max"]),set:ks.oneOfSetter(t)}),a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Us.create(),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Ls.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(10).fork()).ldelim();if(null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.count&&Object.hasOwnProperty.call(e,"count")&&t.uint32(33).fixed64(e.count),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&t.uint32(41).double(e.sum),null!=e.scale&&Object.hasOwnProperty.call(e,"scale")&&t.uint32(48).sint32(e.scale),null!=e.zeroCount&&Object.hasOwnProperty.call(e,"zeroCount")&&t.uint32(57).fixed64(e.zeroCount),null!=e.positive&&Object.hasOwnProperty.call(e,"positive")&&Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(e.positive,t.uint32(66).fork()).ldelim(),null!=e.negative&&Object.hasOwnProperty.call(e,"negative")&&Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.encode(e.negative,t.uint32(74).fork()).ldelim(),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(80).uint32(e.flags),null!=e.exemplars&&e.exemplars.length)for(r=0;r<e.exemplars.length;++r)Ls.opentelemetry.proto.metrics.v1.Exemplar.encode(e.exemplars[r],t.uint32(90).fork()).ldelim();return null!=e.min&&Object.hasOwnProperty.call(e,"min")&&t.uint32(97).double(e.min),null!=e.max&&Object.hasOwnProperty.call(e,"max")&&t.uint32(105).double(e.max),null!=e.zeroThreshold&&Object.hasOwnProperty.call(e,"zeroThreshold")&&t.uint32(113).double(e.zeroThreshold),t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Ls.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.count=e.fixed64();break;case 5:o.sum=e.double();break;case 6:o.scale=e.sint32();break;case 7:o.zeroCount=e.fixed64();break;case 8:o.positive=Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(e,e.uint32());break;case 9:o.negative=Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.decode(e,e.uint32());break;case 10:o.flags=e.uint32();break;case 11:o.exemplars&&o.exemplars.length||(o.exemplars=[]),o.exemplars.push(Ls.opentelemetry.proto.metrics.v1.Exemplar.decode(e,e.uint32()));break;case 12:o.min=e.double();break;case 13:o.max=e.double();break;case 14:o.zeroThreshold=e.double();break;default:e.skipType(7&s)}}return o},a.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=Ls.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(ks.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&ks.isInteger(e.startTimeUnixNano.low)&&ks.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(ks.isInteger(e.timeUnixNano)||e.timeUnixNano&&ks.isInteger(e.timeUnixNano.low)&&ks.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.count&&e.hasOwnProperty("count")&&!(ks.isInteger(e.count)||e.count&&ks.isInteger(e.count.low)&&ks.isInteger(e.count.high)))return"count: integer|Long expected";if(null!=e.sum&&e.hasOwnProperty("sum")&&"number"!=typeof e.sum)return"sum: number expected";if(null!=e.scale&&e.hasOwnProperty("scale")&&!ks.isInteger(e.scale))return"scale: integer expected";if(null!=e.zeroCount&&e.hasOwnProperty("zeroCount")&&!(ks.isInteger(e.zeroCount)||e.zeroCount&&ks.isInteger(e.zeroCount.low)&&ks.isInteger(e.zeroCount.high)))return"zeroCount: integer|Long expected";if(null!=e.positive&&e.hasOwnProperty("positive")&&(r=Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(e.positive)))return"positive."+r;if(null!=e.negative&&e.hasOwnProperty("negative")&&(r=Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.verify(e.negative)))return"negative."+r;if(null!=e.flags&&e.hasOwnProperty("flags")&&!ks.isInteger(e.flags))return"flags: integer expected";if(null!=e.exemplars&&e.hasOwnProperty("exemplars")){if(!Array.isArray(e.exemplars))return"exemplars: array expected";for(t=0;t<e.exemplars.length;++t){var r;if(r=Ls.opentelemetry.proto.metrics.v1.Exemplar.verify(e.exemplars[t]))return"exemplars."+r}}return null!=e.min&&e.hasOwnProperty("min")&&"number"!=typeof e.min?"min: number expected":null!=e.max&&e.hasOwnProperty("max")&&"number"!=typeof e.max?"max: number expected":null!=e.zeroThreshold&&e.hasOwnProperty("zeroThreshold")&&"number"!=typeof e.zeroThreshold?"zeroThreshold: number expected":null},a.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint)return e;var t=new Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.attributes: object expected");t.attributes[r]=Ls.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(ks.Long?(t.startTimeUnixNano=ks.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new ks.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(ks.Long?(t.timeUnixNano=ks.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new ks.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.count&&(ks.Long?(t.count=ks.Long.fromValue(e.count)).unsigned=!1:"string"==typeof e.count?t.count=parseInt(e.count,10):"number"==typeof e.count?t.count=e.count:"object"==typeof e.count&&(t.count=new ks.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber())),null!=e.sum&&(t.sum=Number(e.sum)),null!=e.scale&&(t.scale=0|e.scale),null!=e.zeroCount&&(ks.Long?(t.zeroCount=ks.Long.fromValue(e.zeroCount)).unsigned=!1:"string"==typeof e.zeroCount?t.zeroCount=parseInt(e.zeroCount,10):"number"==typeof e.zeroCount?t.zeroCount=e.zeroCount:"object"==typeof e.zeroCount&&(t.zeroCount=new ks.LongBits(e.zeroCount.low>>>0,e.zeroCount.high>>>0).toNumber())),null!=e.positive){if("object"!=typeof e.positive)throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.positive: object expected");t.positive=Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(e.positive)}if(null!=e.negative){if("object"!=typeof e.negative)throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.negative: object expected");t.negative=Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.fromObject(e.negative)}if(null!=e.flags&&(t.flags=e.flags>>>0),e.exemplars){if(!Array.isArray(e.exemplars))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: array expected");for(t.exemplars=[],r=0;r<e.exemplars.length;++r){if("object"!=typeof e.exemplars[r])throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.exemplars: object expected");t.exemplars[r]=Ls.opentelemetry.proto.metrics.v1.Exemplar.fromObject(e.exemplars[r])}}return null!=e.min&&(t.min=Number(e.min)),null!=e.max&&(t.max=Number(e.max)),null!=e.zeroThreshold&&(t.zeroThreshold=Number(e.zeroThreshold)),t},a.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[],n.exemplars=[]),t.defaults&&(ks.Long?(r=new ks.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,ks.Long?(r=new ks.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,ks.Long?(r=new ks.Long(0,0,!1),n.count=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.count=t.longs===String?"0":0,n.scale=0,ks.Long?(r=new ks.Long(0,0,!1),n.zeroCount=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.zeroCount=t.longs===String?"0":0,n.positive=null,n.negative=null,n.flags=0,n.zeroThreshold=0),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=Ls.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?ks.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new ks.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?ks.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new ks.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.count&&e.hasOwnProperty("count")&&("number"==typeof e.count?n.count=t.longs===String?String(e.count):e.count:n.count=t.longs===String?ks.Long.prototype.toString.call(e.count):t.longs===Number?new ks.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber():e.count),null!=e.sum&&e.hasOwnProperty("sum")&&(n.sum=t.json&&!isFinite(e.sum)?String(e.sum):e.sum,t.oneofs)&&(n._sum="sum"),null!=e.scale&&e.hasOwnProperty("scale")&&(n.scale=e.scale),null!=e.zeroCount&&e.hasOwnProperty("zeroCount")&&("number"==typeof e.zeroCount?n.zeroCount=t.longs===String?String(e.zeroCount):e.zeroCount:n.zeroCount=t.longs===String?ks.Long.prototype.toString.call(e.zeroCount):t.longs===Number?new ks.LongBits(e.zeroCount.low>>>0,e.zeroCount.high>>>0).toNumber():e.zeroCount),null!=e.positive&&e.hasOwnProperty("positive")&&(n.positive=Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(e.positive,t)),null!=e.negative&&e.hasOwnProperty("negative")&&(n.negative=Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.toObject(e.negative,t)),null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),e.exemplars&&e.exemplars.length)for(n.exemplars=[],o=0;o<e.exemplars.length;++o)n.exemplars[o]=Ls.opentelemetry.proto.metrics.v1.Exemplar.toObject(e.exemplars[o],t);return null!=e.min&&e.hasOwnProperty("min")&&(n.min=t.json&&!isFinite(e.min)?String(e.min):e.min,t.oneofs)&&(n._min="min"),null!=e.max&&e.hasOwnProperty("max")&&(n.max=t.json&&!isFinite(e.max)?String(e.max):e.max,t.oneofs)&&(n._max="max"),null!=e.zeroThreshold&&e.hasOwnProperty("zeroThreshold")&&(n.zeroThreshold=t.json&&!isFinite(e.zeroThreshold)?String(e.zeroThreshold):e.zeroThreshold),n},a.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint"},a.Buckets=(u.prototype.offset=null,u.prototype.bucketCounts=ks.emptyArray,u.create=function(e){return new u(e)},u.encode=function(e,t){if(t=t||Us.create(),null!=e.offset&&Object.hasOwnProperty.call(e,"offset")&&t.uint32(8).sint32(e.offset),null!=e.bucketCounts&&e.bucketCounts.length){t.uint32(18).fork();for(var r=0;r<e.bucketCounts.length;++r)t.uint64(e.bucketCounts[r]);t.ldelim()}return t},u.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},u.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.offset=e.sint32();break;case 2:if(o.bucketCounts&&o.bucketCounts.length||(o.bucketCounts=[]),2==(7&s))for(var i=e.uint32()+e.pos;e.pos<i;)o.bucketCounts.push(e.uint64());else o.bucketCounts.push(e.uint64());break;default:e.skipType(7&s)}}return o},u.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},u.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.offset&&e.hasOwnProperty("offset")&&!ks.isInteger(e.offset))return"offset: integer expected";if(null!=e.bucketCounts&&e.hasOwnProperty("bucketCounts")){if(!Array.isArray(e.bucketCounts))return"bucketCounts: array expected";for(var t=0;t<e.bucketCounts.length;++t)if(!(ks.isInteger(e.bucketCounts[t])||e.bucketCounts[t]&&ks.isInteger(e.bucketCounts[t].low)&&ks.isInteger(e.bucketCounts[t].high)))return"bucketCounts: integer|Long[] expected"}return null},u.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets)return e;var t=new Ls.opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets;if(null!=e.offset&&(t.offset=0|e.offset),e.bucketCounts){if(!Array.isArray(e.bucketCounts))throw TypeError(".opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets.bucketCounts: array expected");t.bucketCounts=[];for(var r=0;r<e.bucketCounts.length;++r)ks.Long?(t.bucketCounts[r]=ks.Long.fromValue(e.bucketCounts[r])).unsigned=!0:"string"==typeof e.bucketCounts[r]?t.bucketCounts[r]=parseInt(e.bucketCounts[r],10):"number"==typeof e.bucketCounts[r]?t.bucketCounts[r]=e.bucketCounts[r]:"object"==typeof e.bucketCounts[r]&&(t.bucketCounts[r]=new ks.LongBits(e.bucketCounts[r].low>>>0,e.bucketCounts[r].high>>>0).toNumber(!0))}return t},u.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.bucketCounts=[]),t.defaults&&(r.offset=0),null!=e.offset&&e.hasOwnProperty("offset")&&(r.offset=e.offset),e.bucketCounts&&e.bucketCounts.length){r.bucketCounts=[];for(var n=0;n<e.bucketCounts.length;++n)"number"==typeof e.bucketCounts[n]?r.bucketCounts[n]=t.longs===String?String(e.bucketCounts[n]):e.bucketCounts[n]:r.bucketCounts[n]=t.longs===String?ks.Long.prototype.toString.call(e.bucketCounts[n]):t.longs===Number?new ks.LongBits(e.bucketCounts[n].low>>>0,e.bucketCounts[n].high>>>0).toNumber(!0):e.bucketCounts[n]}return r},u.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},u.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets"},u),a),r.SummaryDataPoint=(s.prototype.attributes=ks.emptyArray,s.prototype.startTimeUnixNano=null,s.prototype.timeUnixNano=null,s.prototype.count=null,s.prototype.sum=null,s.prototype.quantileValues=ks.emptyArray,s.prototype.flags=null,s.create=function(e){return new s(e)},s.encode=function(e,t){if(t=t||Us.create(),null!=e.startTimeUnixNano&&Object.hasOwnProperty.call(e,"startTimeUnixNano")&&t.uint32(17).fixed64(e.startTimeUnixNano),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(25).fixed64(e.timeUnixNano),null!=e.count&&Object.hasOwnProperty.call(e,"count")&&t.uint32(33).fixed64(e.count),null!=e.sum&&Object.hasOwnProperty.call(e,"sum")&&t.uint32(41).double(e.sum),null!=e.quantileValues&&e.quantileValues.length)for(var r=0;r<e.quantileValues.length;++r)Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.encode(e.quantileValues[r],t.uint32(50).fork()).ldelim();if(null!=e.attributes&&e.attributes.length)for(r=0;r<e.attributes.length;++r)Ls.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(58).fork()).ldelim();return null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(64).uint32(e.flags),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 7:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Ls.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.startTimeUnixNano=e.fixed64();break;case 3:o.timeUnixNano=e.fixed64();break;case 4:o.count=e.fixed64();break;case 5:o.sum=e.double();break;case 6:o.quantileValues&&o.quantileValues.length||(o.quantileValues=[]),o.quantileValues.push(Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.decode(e,e.uint32()));break;case 8:o.flags=e.uint32();break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t=0;t<e.attributes.length;++t)if(r=Ls.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[t]))return"attributes."+r}if(null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&!(ks.isInteger(e.startTimeUnixNano)||e.startTimeUnixNano&&ks.isInteger(e.startTimeUnixNano.low)&&ks.isInteger(e.startTimeUnixNano.high)))return"startTimeUnixNano: integer|Long expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(ks.isInteger(e.timeUnixNano)||e.timeUnixNano&&ks.isInteger(e.timeUnixNano.low)&&ks.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.count&&e.hasOwnProperty("count")&&!(ks.isInteger(e.count)||e.count&&ks.isInteger(e.count.low)&&ks.isInteger(e.count.high)))return"count: integer|Long expected";if(null!=e.sum&&e.hasOwnProperty("sum")&&"number"!=typeof e.sum)return"sum: number expected";if(null!=e.quantileValues&&e.hasOwnProperty("quantileValues")){if(!Array.isArray(e.quantileValues))return"quantileValues: array expected";for(t=0;t<e.quantileValues.length;++t){var r;if(r=Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.verify(e.quantileValues[t]))return"quantileValues."+r}}return null!=e.flags&&e.hasOwnProperty("flags")&&!ks.isInteger(e.flags)?"flags: integer expected":null},s.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint)return e;var t=new Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint;if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.attributes: object expected");t.attributes[r]=Ls.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}if(null!=e.startTimeUnixNano&&(ks.Long?(t.startTimeUnixNano=ks.Long.fromValue(e.startTimeUnixNano)).unsigned=!1:"string"==typeof e.startTimeUnixNano?t.startTimeUnixNano=parseInt(e.startTimeUnixNano,10):"number"==typeof e.startTimeUnixNano?t.startTimeUnixNano=e.startTimeUnixNano:"object"==typeof e.startTimeUnixNano&&(t.startTimeUnixNano=new ks.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber())),null!=e.timeUnixNano&&(ks.Long?(t.timeUnixNano=ks.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new ks.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.count&&(ks.Long?(t.count=ks.Long.fromValue(e.count)).unsigned=!1:"string"==typeof e.count?t.count=parseInt(e.count,10):"number"==typeof e.count?t.count=e.count:"object"==typeof e.count&&(t.count=new ks.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber())),null!=e.sum&&(t.sum=Number(e.sum)),e.quantileValues){if(!Array.isArray(e.quantileValues))throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: array expected");for(t.quantileValues=[],r=0;r<e.quantileValues.length;++r){if("object"!=typeof e.quantileValues[r])throw TypeError(".opentelemetry.proto.metrics.v1.SummaryDataPoint.quantileValues: object expected");t.quantileValues[r]=Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.fromObject(e.quantileValues[r])}}return null!=e.flags&&(t.flags=e.flags>>>0),t},s.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.quantileValues=[],n.attributes=[]),t.defaults&&(ks.Long?(r=new ks.Long(0,0,!1),n.startTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.startTimeUnixNano=t.longs===String?"0":0,ks.Long?(r=new ks.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,ks.Long?(r=new ks.Long(0,0,!1),n.count=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.count=t.longs===String?"0":0,n.sum=0,n.flags=0),null!=e.startTimeUnixNano&&e.hasOwnProperty("startTimeUnixNano")&&("number"==typeof e.startTimeUnixNano?n.startTimeUnixNano=t.longs===String?String(e.startTimeUnixNano):e.startTimeUnixNano:n.startTimeUnixNano=t.longs===String?ks.Long.prototype.toString.call(e.startTimeUnixNano):t.longs===Number?new ks.LongBits(e.startTimeUnixNano.low>>>0,e.startTimeUnixNano.high>>>0).toNumber():e.startTimeUnixNano),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?ks.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new ks.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.count&&e.hasOwnProperty("count")&&("number"==typeof e.count?n.count=t.longs===String?String(e.count):e.count:n.count=t.longs===String?ks.Long.prototype.toString.call(e.count):t.longs===Number?new ks.LongBits(e.count.low>>>0,e.count.high>>>0).toNumber():e.count),null!=e.sum&&e.hasOwnProperty("sum")&&(n.sum=t.json&&!isFinite(e.sum)?String(e.sum):e.sum),e.quantileValues&&e.quantileValues.length){n.quantileValues=[];for(var o=0;o<e.quantileValues.length;++o)n.quantileValues[o]=Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile.toObject(e.quantileValues[o],t)}if(e.attributes&&e.attributes.length)for(n.attributes=[],o=0;o<e.attributes.length;++o)n.attributes[o]=Ls.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t);return null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),n},s.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.SummaryDataPoint"},s.ValueAtQuantile=(i.prototype.quantile=null,i.prototype.value=null,i.create=function(e){return new i(e)},i.encode=function(e,t){return t=t||Us.create(),null!=e.quantile&&Object.hasOwnProperty.call(e,"quantile")&&t.uint32(9).double(e.quantile),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&t.uint32(17).double(e.value),t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.quantile=e.double();break;case 2:o.value=e.double();break;default:e.skipType(7&s)}}return o},i.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},i.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.quantile&&e.hasOwnProperty("quantile")&&"number"!=typeof e.quantile?"quantile: number expected":null!=e.value&&e.hasOwnProperty("value")&&"number"!=typeof e.value?"value: number expected":null},i.fromObject=function(e){var t;return e instanceof Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile?e:(t=new Ls.opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile,null!=e.quantile&&(t.quantile=Number(e.quantile)),null!=e.value&&(t.value=Number(e.value)),t)},i.toObject=function(e,t){var r={};return(t=t||{}).defaults&&(r.quantile=0,r.value=0),null!=e.quantile&&e.hasOwnProperty("quantile")&&(r.quantile=t.json&&!isFinite(e.quantile)?String(e.quantile):e.quantile),null!=e.value&&e.hasOwnProperty("value")&&(r.value=t.json&&!isFinite(e.value)?String(e.value):e.value),r},i.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile"},i),s),r.Exemplar=(o.prototype.filteredAttributes=ks.emptyArray,o.prototype.timeUnixNano=null,o.prototype.asDouble=null,o.prototype.asInt=null,o.prototype.spanId=null,o.prototype.traceId=null,Object.defineProperty(o.prototype,"value",{get:ks.oneOfGetter(e=["asDouble","asInt"]),set:ks.oneOfSetter(e)}),o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Us.create(),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(17).fixed64(e.timeUnixNano),null!=e.asDouble&&Object.hasOwnProperty.call(e,"asDouble")&&t.uint32(25).double(e.asDouble),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(34).bytes(e.spanId),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(42).bytes(e.traceId),null!=e.asInt&&Object.hasOwnProperty.call(e,"asInt")&&t.uint32(49).sfixed64(e.asInt),null!=e.filteredAttributes&&e.filteredAttributes.length)for(var r=0;r<e.filteredAttributes.length;++r)Ls.opentelemetry.proto.common.v1.KeyValue.encode(e.filteredAttributes[r],t.uint32(58).fork()).ldelim();return t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.metrics.v1.Exemplar;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 7:o.filteredAttributes&&o.filteredAttributes.length||(o.filteredAttributes=[]),o.filteredAttributes.push(Ls.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 2:o.timeUnixNano=e.fixed64();break;case 3:o.asDouble=e.double();break;case 6:o.asInt=e.sfixed64();break;case 4:o.spanId=e.bytes();break;case 5:o.traceId=e.bytes();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.filteredAttributes&&e.hasOwnProperty("filteredAttributes")){if(!Array.isArray(e.filteredAttributes))return"filteredAttributes: array expected";for(var r=0;r<e.filteredAttributes.length;++r){var n=Ls.opentelemetry.proto.common.v1.KeyValue.verify(e.filteredAttributes[r]);if(n)return"filteredAttributes."+n}}if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(ks.isInteger(e.timeUnixNano)||e.timeUnixNano&&ks.isInteger(e.timeUnixNano.low)&&ks.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(t.value=1,"number"!=typeof e.asDouble))return"asDouble: number expected";if(null!=e.asInt&&e.hasOwnProperty("asInt")){if(1===t.value)return"value: multiple values";if(t.value=1,!(ks.isInteger(e.asInt)||e.asInt&&ks.isInteger(e.asInt.low)&&ks.isInteger(e.asInt.high)))return"asInt: integer|Long expected"}return null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||ks.isString(e.spanId))?"spanId: buffer expected":null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||ks.isString(e.traceId))?"traceId: buffer expected":null},o.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.metrics.v1.Exemplar)return e;var t=new Ls.opentelemetry.proto.metrics.v1.Exemplar;if(e.filteredAttributes){if(!Array.isArray(e.filteredAttributes))throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: array expected");t.filteredAttributes=[];for(var r=0;r<e.filteredAttributes.length;++r){if("object"!=typeof e.filteredAttributes[r])throw TypeError(".opentelemetry.proto.metrics.v1.Exemplar.filteredAttributes: object expected");t.filteredAttributes[r]=Ls.opentelemetry.proto.common.v1.KeyValue.fromObject(e.filteredAttributes[r])}}return null!=e.timeUnixNano&&(ks.Long?(t.timeUnixNano=ks.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new ks.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.asDouble&&(t.asDouble=Number(e.asDouble)),null!=e.asInt&&(ks.Long?(t.asInt=ks.Long.fromValue(e.asInt)).unsigned=!1:"string"==typeof e.asInt?t.asInt=parseInt(e.asInt,10):"number"==typeof e.asInt?t.asInt=e.asInt:"object"==typeof e.asInt&&(t.asInt=new ks.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber())),null!=e.spanId&&("string"==typeof e.spanId?ks.base64.decode(e.spanId,t.spanId=ks.newBuffer(ks.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.traceId&&("string"==typeof e.traceId?ks.base64.decode(e.traceId,t.traceId=ks.newBuffer(ks.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),t},o.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.filteredAttributes=[]),t.defaults&&(ks.Long?(r=new ks.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,t.bytes===String?n.spanId="":(n.spanId=[],t.bytes!==Array&&(n.spanId=ks.newBuffer(n.spanId))),t.bytes===String?n.traceId="":(n.traceId=[],t.bytes!==Array&&(n.traceId=ks.newBuffer(n.traceId)))),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?ks.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new ks.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.asDouble&&e.hasOwnProperty("asDouble")&&(n.asDouble=t.json&&!isFinite(e.asDouble)?String(e.asDouble):e.asDouble,t.oneofs)&&(n.value="asDouble"),null!=e.spanId&&e.hasOwnProperty("spanId")&&(n.spanId=t.bytes===String?ks.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.traceId&&e.hasOwnProperty("traceId")&&(n.traceId=t.bytes===String?ks.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.asInt&&e.hasOwnProperty("asInt")&&("number"==typeof e.asInt?n.asInt=t.longs===String?String(e.asInt):e.asInt:n.asInt=t.longs===String?ks.Long.prototype.toString.call(e.asInt):t.longs===Number?new ks.LongBits(e.asInt.low>>>0,e.asInt.high>>>0).toNumber():e.asInt,t.oneofs)&&(n.value="asInt"),e.filteredAttributes&&e.filteredAttributes.length){n.filteredAttributes=[];for(var o=0;o<e.filteredAttributes.length;++o)n.filteredAttributes[o]=Ls.opentelemetry.proto.common.v1.KeyValue.toObject(e.filteredAttributes[o],t)}return n},o.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.metrics.v1.Exemplar"},o),r),n;function o(e){if(this.filteredAttributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(this.attributes=[],this.quantileValues=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.attributes=[],this.exemplars=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function u(e){if(this.bucketCounts=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function l(e){if(this.attributes=[],this.bucketCounts=[],this.explicitBounds=[],this.exemplars=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function c(e){if(this.attributes=[],this.exemplars=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function p(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function h(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function d(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function f(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function m(e){if(this.dataPoints=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function g(e){if(this.metadata=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function y(e){if(this.metrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function _(e){if(this.scopeMetrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function v(e){if(this.resourceMetrics=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),Rs.logs=(()=>{var e,t,r,n={};return n.v1=((r={}).LogsData=(a.prototype.resourceLogs=ks.emptyArray,a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||Us.create(),null!=e.resourceLogs&&e.resourceLogs.length)for(var r=0;r<e.resourceLogs.length;++r)Ls.opentelemetry.proto.logs.v1.ResourceLogs.encode(e.resourceLogs[r],t.uint32(10).fork()).ldelim();return t},a.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},a.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.logs.v1.LogsData;e.pos<n;){var s=e.uint32();if(s===r)break;s>>>3==1?(o.resourceLogs&&o.resourceLogs.length||(o.resourceLogs=[]),o.resourceLogs.push(Ls.opentelemetry.proto.logs.v1.ResourceLogs.decode(e,e.uint32()))):e.skipType(7&s)}return o},a.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resourceLogs&&e.hasOwnProperty("resourceLogs")){if(!Array.isArray(e.resourceLogs))return"resourceLogs: array expected";for(var t=0;t<e.resourceLogs.length;++t){var r=Ls.opentelemetry.proto.logs.v1.ResourceLogs.verify(e.resourceLogs[t]);if(r)return"resourceLogs."+r}}return null},a.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.logs.v1.LogsData)return e;var t=new Ls.opentelemetry.proto.logs.v1.LogsData;if(e.resourceLogs){if(!Array.isArray(e.resourceLogs))throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: array expected");t.resourceLogs=[];for(var r=0;r<e.resourceLogs.length;++r){if("object"!=typeof e.resourceLogs[r])throw TypeError(".opentelemetry.proto.logs.v1.LogsData.resourceLogs: object expected");t.resourceLogs[r]=Ls.opentelemetry.proto.logs.v1.ResourceLogs.fromObject(e.resourceLogs[r])}}return t},a.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.resourceLogs=[]),e.resourceLogs&&e.resourceLogs.length){r.resourceLogs=[];for(var n=0;n<e.resourceLogs.length;++n)r.resourceLogs[n]=Ls.opentelemetry.proto.logs.v1.ResourceLogs.toObject(e.resourceLogs[n],t)}return r},a.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},a.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.LogsData"},a),r.ResourceLogs=(i.prototype.resource=null,i.prototype.scopeLogs=ks.emptyArray,i.prototype.schemaUrl=null,i.create=function(e){return new i(e)},i.encode=function(e,t){if(t=t||Us.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&Ls.opentelemetry.proto.resource.v1.Resource.encode(e.resource,t.uint32(10).fork()).ldelim(),null!=e.scopeLogs&&e.scopeLogs.length)for(var r=0;r<e.scopeLogs.length;++r)Ls.opentelemetry.proto.logs.v1.ScopeLogs.encode(e.scopeLogs[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},i.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},i.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.logs.v1.ResourceLogs;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.resource=Ls.opentelemetry.proto.resource.v1.Resource.decode(e,e.uint32());break;case 2:o.scopeLogs&&o.scopeLogs.length||(o.scopeLogs=[]),o.scopeLogs.push(Ls.opentelemetry.proto.logs.v1.ScopeLogs.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},i.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},i.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&(t=Ls.opentelemetry.proto.resource.v1.Resource.verify(e.resource)))return"resource."+t;if(null!=e.scopeLogs&&e.hasOwnProperty("scopeLogs")){if(!Array.isArray(e.scopeLogs))return"scopeLogs: array expected";for(var t,r=0;r<e.scopeLogs.length;++r)if(t=Ls.opentelemetry.proto.logs.v1.ScopeLogs.verify(e.scopeLogs[r]))return"scopeLogs."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!ks.isString(e.schemaUrl)?"schemaUrl: string expected":null},i.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.logs.v1.ResourceLogs)return e;var t=new Ls.opentelemetry.proto.logs.v1.ResourceLogs;if(null!=e.resource){if("object"!=typeof e.resource)throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.resource: object expected");t.resource=Ls.opentelemetry.proto.resource.v1.Resource.fromObject(e.resource)}if(e.scopeLogs){if(!Array.isArray(e.scopeLogs))throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: array expected");t.scopeLogs=[];for(var r=0;r<e.scopeLogs.length;++r){if("object"!=typeof e.scopeLogs[r])throw TypeError(".opentelemetry.proto.logs.v1.ResourceLogs.scopeLogs: object expected");t.scopeLogs[r]=Ls.opentelemetry.proto.logs.v1.ScopeLogs.fromObject(e.scopeLogs[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},i.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.scopeLogs=[]),t.defaults&&(r.resource=null,r.schemaUrl=""),null!=e.resource&&e.hasOwnProperty("resource")&&(r.resource=Ls.opentelemetry.proto.resource.v1.Resource.toObject(e.resource,t)),e.scopeLogs&&e.scopeLogs.length){r.scopeLogs=[];for(var n=0;n<e.scopeLogs.length;++n)r.scopeLogs[n]=Ls.opentelemetry.proto.logs.v1.ScopeLogs.toObject(e.scopeLogs[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},i.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},i.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.ResourceLogs"},i),r.ScopeLogs=(s.prototype.scope=null,s.prototype.logRecords=ks.emptyArray,s.prototype.schemaUrl=null,s.create=function(e){return new s(e)},s.encode=function(e,t){if(t=t||Us.create(),null!=e.scope&&Object.hasOwnProperty.call(e,"scope")&&Ls.opentelemetry.proto.common.v1.InstrumentationScope.encode(e.scope,t.uint32(10).fork()).ldelim(),null!=e.logRecords&&e.logRecords.length)for(var r=0;r<e.logRecords.length;++r)Ls.opentelemetry.proto.logs.v1.LogRecord.encode(e.logRecords[r],t.uint32(18).fork()).ldelim();return null!=e.schemaUrl&&Object.hasOwnProperty.call(e,"schemaUrl")&&t.uint32(26).string(e.schemaUrl),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.logs.v1.ScopeLogs;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.scope=Ls.opentelemetry.proto.common.v1.InstrumentationScope.decode(e,e.uint32());break;case 2:o.logRecords&&o.logRecords.length||(o.logRecords=[]),o.logRecords.push(Ls.opentelemetry.proto.logs.v1.LogRecord.decode(e,e.uint32()));break;case 3:o.schemaUrl=e.string();break;default:e.skipType(7&s)}}return o},s.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.scope&&e.hasOwnProperty("scope")&&(t=Ls.opentelemetry.proto.common.v1.InstrumentationScope.verify(e.scope)))return"scope."+t;if(null!=e.logRecords&&e.hasOwnProperty("logRecords")){if(!Array.isArray(e.logRecords))return"logRecords: array expected";for(var t,r=0;r<e.logRecords.length;++r)if(t=Ls.opentelemetry.proto.logs.v1.LogRecord.verify(e.logRecords[r]))return"logRecords."+t}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&!ks.isString(e.schemaUrl)?"schemaUrl: string expected":null},s.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.logs.v1.ScopeLogs)return e;var t=new Ls.opentelemetry.proto.logs.v1.ScopeLogs;if(null!=e.scope){if("object"!=typeof e.scope)throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.scope: object expected");t.scope=Ls.opentelemetry.proto.common.v1.InstrumentationScope.fromObject(e.scope)}if(e.logRecords){if(!Array.isArray(e.logRecords))throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: array expected");t.logRecords=[];for(var r=0;r<e.logRecords.length;++r){if("object"!=typeof e.logRecords[r])throw TypeError(".opentelemetry.proto.logs.v1.ScopeLogs.logRecords: object expected");t.logRecords[r]=Ls.opentelemetry.proto.logs.v1.LogRecord.fromObject(e.logRecords[r])}}return null!=e.schemaUrl&&(t.schemaUrl=String(e.schemaUrl)),t},s.toObject=function(e,t){var r={};if(((t=t||{}).arrays||t.defaults)&&(r.logRecords=[]),t.defaults&&(r.scope=null,r.schemaUrl=""),null!=e.scope&&e.hasOwnProperty("scope")&&(r.scope=Ls.opentelemetry.proto.common.v1.InstrumentationScope.toObject(e.scope,t)),e.logRecords&&e.logRecords.length){r.logRecords=[];for(var n=0;n<e.logRecords.length;++n)r.logRecords[n]=Ls.opentelemetry.proto.logs.v1.LogRecord.toObject(e.logRecords[n],t)}return null!=e.schemaUrl&&e.hasOwnProperty("schemaUrl")&&(r.schemaUrl=e.schemaUrl),r},s.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},s.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.ScopeLogs"},s),r.SeverityNumber=(e={},(t=Object.create(e))[e[0]="SEVERITY_NUMBER_UNSPECIFIED"]=0,t[e[1]="SEVERITY_NUMBER_TRACE"]=1,t[e[2]="SEVERITY_NUMBER_TRACE2"]=2,t[e[3]="SEVERITY_NUMBER_TRACE3"]=3,t[e[4]="SEVERITY_NUMBER_TRACE4"]=4,t[e[5]="SEVERITY_NUMBER_DEBUG"]=5,t[e[6]="SEVERITY_NUMBER_DEBUG2"]=6,t[e[7]="SEVERITY_NUMBER_DEBUG3"]=7,t[e[8]="SEVERITY_NUMBER_DEBUG4"]=8,t[e[9]="SEVERITY_NUMBER_INFO"]=9,t[e[10]="SEVERITY_NUMBER_INFO2"]=10,t[e[11]="SEVERITY_NUMBER_INFO3"]=11,t[e[12]="SEVERITY_NUMBER_INFO4"]=12,t[e[13]="SEVERITY_NUMBER_WARN"]=13,t[e[14]="SEVERITY_NUMBER_WARN2"]=14,t[e[15]="SEVERITY_NUMBER_WARN3"]=15,t[e[16]="SEVERITY_NUMBER_WARN4"]=16,t[e[17]="SEVERITY_NUMBER_ERROR"]=17,t[e[18]="SEVERITY_NUMBER_ERROR2"]=18,t[e[19]="SEVERITY_NUMBER_ERROR3"]=19,t[e[20]="SEVERITY_NUMBER_ERROR4"]=20,t[e[21]="SEVERITY_NUMBER_FATAL"]=21,t[e[22]="SEVERITY_NUMBER_FATAL2"]=22,t[e[23]="SEVERITY_NUMBER_FATAL3"]=23,t[e[24]="SEVERITY_NUMBER_FATAL4"]=24,t),r.LogRecordFlags=(e={},(t=Object.create(e))[e[0]="LOG_RECORD_FLAGS_DO_NOT_USE"]=0,t[e[255]="LOG_RECORD_FLAGS_TRACE_FLAGS_MASK"]=255,t),r.LogRecord=(o.prototype.timeUnixNano=null,o.prototype.observedTimeUnixNano=null,o.prototype.severityNumber=null,o.prototype.severityText=null,o.prototype.body=null,o.prototype.attributes=ks.emptyArray,o.prototype.droppedAttributesCount=null,o.prototype.flags=null,o.prototype.traceId=null,o.prototype.spanId=null,o.prototype.eventName=null,o.create=function(e){return new o(e)},o.encode=function(e,t){if(t=t||Us.create(),null!=e.timeUnixNano&&Object.hasOwnProperty.call(e,"timeUnixNano")&&t.uint32(9).fixed64(e.timeUnixNano),null!=e.severityNumber&&Object.hasOwnProperty.call(e,"severityNumber")&&t.uint32(16).int32(e.severityNumber),null!=e.severityText&&Object.hasOwnProperty.call(e,"severityText")&&t.uint32(26).string(e.severityText),null!=e.body&&Object.hasOwnProperty.call(e,"body")&&Ls.opentelemetry.proto.common.v1.AnyValue.encode(e.body,t.uint32(42).fork()).ldelim(),null!=e.attributes&&e.attributes.length)for(var r=0;r<e.attributes.length;++r)Ls.opentelemetry.proto.common.v1.KeyValue.encode(e.attributes[r],t.uint32(50).fork()).ldelim();return null!=e.droppedAttributesCount&&Object.hasOwnProperty.call(e,"droppedAttributesCount")&&t.uint32(56).uint32(e.droppedAttributesCount),null!=e.flags&&Object.hasOwnProperty.call(e,"flags")&&t.uint32(69).fixed32(e.flags),null!=e.traceId&&Object.hasOwnProperty.call(e,"traceId")&&t.uint32(74).bytes(e.traceId),null!=e.spanId&&Object.hasOwnProperty.call(e,"spanId")&&t.uint32(82).bytes(e.spanId),null!=e.observedTimeUnixNano&&Object.hasOwnProperty.call(e,"observedTimeUnixNano")&&t.uint32(89).fixed64(e.observedTimeUnixNano),null!=e.eventName&&Object.hasOwnProperty.call(e,"eventName")&&t.uint32(98).string(e.eventName),t},o.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},o.decode=function(e,t,r){e instanceof Ps||(e=Ps.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new Ls.opentelemetry.proto.logs.v1.LogRecord;e.pos<n;){var s=e.uint32();if(s===r)break;switch(s>>>3){case 1:o.timeUnixNano=e.fixed64();break;case 11:o.observedTimeUnixNano=e.fixed64();break;case 2:o.severityNumber=e.int32();break;case 3:o.severityText=e.string();break;case 5:o.body=Ls.opentelemetry.proto.common.v1.AnyValue.decode(e,e.uint32());break;case 6:o.attributes&&o.attributes.length||(o.attributes=[]),o.attributes.push(Ls.opentelemetry.proto.common.v1.KeyValue.decode(e,e.uint32()));break;case 7:o.droppedAttributesCount=e.uint32();break;case 8:o.flags=e.fixed32();break;case 9:o.traceId=e.bytes();break;case 10:o.spanId=e.bytes();break;case 12:o.eventName=e.string();break;default:e.skipType(7&s)}}return o},o.decodeDelimited=function(e){return e instanceof Ps||(e=new Ps(e)),this.decode(e,e.uint32())},o.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&!(ks.isInteger(e.timeUnixNano)||e.timeUnixNano&&ks.isInteger(e.timeUnixNano.low)&&ks.isInteger(e.timeUnixNano.high)))return"timeUnixNano: integer|Long expected";if(null!=e.observedTimeUnixNano&&e.hasOwnProperty("observedTimeUnixNano")&&!(ks.isInteger(e.observedTimeUnixNano)||e.observedTimeUnixNano&&ks.isInteger(e.observedTimeUnixNano.low)&&ks.isInteger(e.observedTimeUnixNano.high)))return"observedTimeUnixNano: integer|Long expected";if(null!=e.severityNumber&&e.hasOwnProperty("severityNumber"))switch(e.severityNumber){default:return"severityNumber: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:}if(null!=e.severityText&&e.hasOwnProperty("severityText")&&!ks.isString(e.severityText))return"severityText: string expected";if(null!=e.body&&e.hasOwnProperty("body")&&(t=Ls.opentelemetry.proto.common.v1.AnyValue.verify(e.body)))return"body."+t;if(null!=e.attributes&&e.hasOwnProperty("attributes")){if(!Array.isArray(e.attributes))return"attributes: array expected";for(var t,r=0;r<e.attributes.length;++r)if(t=Ls.opentelemetry.proto.common.v1.KeyValue.verify(e.attributes[r]))return"attributes."+t}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&!ks.isInteger(e.droppedAttributesCount)?"droppedAttributesCount: integer expected":null!=e.flags&&e.hasOwnProperty("flags")&&!ks.isInteger(e.flags)?"flags: integer expected":null!=e.traceId&&e.hasOwnProperty("traceId")&&!(e.traceId&&"number"==typeof e.traceId.length||ks.isString(e.traceId))?"traceId: buffer expected":null!=e.spanId&&e.hasOwnProperty("spanId")&&!(e.spanId&&"number"==typeof e.spanId.length||ks.isString(e.spanId))?"spanId: buffer expected":null!=e.eventName&&e.hasOwnProperty("eventName")&&!ks.isString(e.eventName)?"eventName: string expected":null},o.fromObject=function(e){if(e instanceof Ls.opentelemetry.proto.logs.v1.LogRecord)return e;var t=new Ls.opentelemetry.proto.logs.v1.LogRecord;switch(null!=e.timeUnixNano&&(ks.Long?(t.timeUnixNano=ks.Long.fromValue(e.timeUnixNano)).unsigned=!1:"string"==typeof e.timeUnixNano?t.timeUnixNano=parseInt(e.timeUnixNano,10):"number"==typeof e.timeUnixNano?t.timeUnixNano=e.timeUnixNano:"object"==typeof e.timeUnixNano&&(t.timeUnixNano=new ks.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber())),null!=e.observedTimeUnixNano&&(ks.Long?(t.observedTimeUnixNano=ks.Long.fromValue(e.observedTimeUnixNano)).unsigned=!1:"string"==typeof e.observedTimeUnixNano?t.observedTimeUnixNano=parseInt(e.observedTimeUnixNano,10):"number"==typeof e.observedTimeUnixNano?t.observedTimeUnixNano=e.observedTimeUnixNano:"object"==typeof e.observedTimeUnixNano&&(t.observedTimeUnixNano=new ks.LongBits(e.observedTimeUnixNano.low>>>0,e.observedTimeUnixNano.high>>>0).toNumber())),e.severityNumber){default:"number"==typeof e.severityNumber&&(t.severityNumber=e.severityNumber);break;case"SEVERITY_NUMBER_UNSPECIFIED":case 0:t.severityNumber=0;break;case"SEVERITY_NUMBER_TRACE":case 1:t.severityNumber=1;break;case"SEVERITY_NUMBER_TRACE2":case 2:t.severityNumber=2;break;case"SEVERITY_NUMBER_TRACE3":case 3:t.severityNumber=3;break;case"SEVERITY_NUMBER_TRACE4":case 4:t.severityNumber=4;break;case"SEVERITY_NUMBER_DEBUG":case 5:t.severityNumber=5;break;case"SEVERITY_NUMBER_DEBUG2":case 6:t.severityNumber=6;break;case"SEVERITY_NUMBER_DEBUG3":case 7:t.severityNumber=7;break;case"SEVERITY_NUMBER_DEBUG4":case 8:t.severityNumber=8;break;case"SEVERITY_NUMBER_INFO":case 9:t.severityNumber=9;break;case"SEVERITY_NUMBER_INFO2":case 10:t.severityNumber=10;break;case"SEVERITY_NUMBER_INFO3":case 11:t.severityNumber=11;break;case"SEVERITY_NUMBER_INFO4":case 12:t.severityNumber=12;break;case"SEVERITY_NUMBER_WARN":case 13:t.severityNumber=13;break;case"SEVERITY_NUMBER_WARN2":case 14:t.severityNumber=14;break;case"SEVERITY_NUMBER_WARN3":case 15:t.severityNumber=15;break;case"SEVERITY_NUMBER_WARN4":case 16:t.severityNumber=16;break;case"SEVERITY_NUMBER_ERROR":case 17:t.severityNumber=17;break;case"SEVERITY_NUMBER_ERROR2":case 18:t.severityNumber=18;break;case"SEVERITY_NUMBER_ERROR3":case 19:t.severityNumber=19;break;case"SEVERITY_NUMBER_ERROR4":case 20:t.severityNumber=20;break;case"SEVERITY_NUMBER_FATAL":case 21:t.severityNumber=21;break;case"SEVERITY_NUMBER_FATAL2":case 22:t.severityNumber=22;break;case"SEVERITY_NUMBER_FATAL3":case 23:t.severityNumber=23;break;case"SEVERITY_NUMBER_FATAL4":case 24:t.severityNumber=24}if(null!=e.severityText&&(t.severityText=String(e.severityText)),null!=e.body){if("object"!=typeof e.body)throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.body: object expected");t.body=Ls.opentelemetry.proto.common.v1.AnyValue.fromObject(e.body)}if(e.attributes){if(!Array.isArray(e.attributes))throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: array expected");t.attributes=[];for(var r=0;r<e.attributes.length;++r){if("object"!=typeof e.attributes[r])throw TypeError(".opentelemetry.proto.logs.v1.LogRecord.attributes: object expected");t.attributes[r]=Ls.opentelemetry.proto.common.v1.KeyValue.fromObject(e.attributes[r])}}return null!=e.droppedAttributesCount&&(t.droppedAttributesCount=e.droppedAttributesCount>>>0),null!=e.flags&&(t.flags=e.flags>>>0),null!=e.traceId&&("string"==typeof e.traceId?ks.base64.decode(e.traceId,t.traceId=ks.newBuffer(ks.base64.length(e.traceId)),0):0<=e.traceId.length&&(t.traceId=e.traceId)),null!=e.spanId&&("string"==typeof e.spanId?ks.base64.decode(e.spanId,t.spanId=ks.newBuffer(ks.base64.length(e.spanId)),0):0<=e.spanId.length&&(t.spanId=e.spanId)),null!=e.eventName&&(t.eventName=String(e.eventName)),t},o.toObject=function(e,t){var r,n={};if(((t=t||{}).arrays||t.defaults)&&(n.attributes=[]),t.defaults&&(ks.Long?(r=new ks.Long(0,0,!1),n.timeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.timeUnixNano=t.longs===String?"0":0,n.severityNumber=t.enums===String?"SEVERITY_NUMBER_UNSPECIFIED":0,n.severityText="",n.body=null,n.droppedAttributesCount=0,n.flags=0,t.bytes===String?n.traceId="":(n.traceId=[],t.bytes!==Array&&(n.traceId=ks.newBuffer(n.traceId))),t.bytes===String?n.spanId="":(n.spanId=[],t.bytes!==Array&&(n.spanId=ks.newBuffer(n.spanId))),ks.Long?(r=new ks.Long(0,0,!1),n.observedTimeUnixNano=t.longs===String?r.toString():t.longs===Number?r.toNumber():r):n.observedTimeUnixNano=t.longs===String?"0":0,n.eventName=""),null!=e.timeUnixNano&&e.hasOwnProperty("timeUnixNano")&&("number"==typeof e.timeUnixNano?n.timeUnixNano=t.longs===String?String(e.timeUnixNano):e.timeUnixNano:n.timeUnixNano=t.longs===String?ks.Long.prototype.toString.call(e.timeUnixNano):t.longs===Number?new ks.LongBits(e.timeUnixNano.low>>>0,e.timeUnixNano.high>>>0).toNumber():e.timeUnixNano),null!=e.severityNumber&&e.hasOwnProperty("severityNumber")&&(n.severityNumber=t.enums!==String||void 0===Ls.opentelemetry.proto.logs.v1.SeverityNumber[e.severityNumber]?e.severityNumber:Ls.opentelemetry.proto.logs.v1.SeverityNumber[e.severityNumber]),null!=e.severityText&&e.hasOwnProperty("severityText")&&(n.severityText=e.severityText),null!=e.body&&e.hasOwnProperty("body")&&(n.body=Ls.opentelemetry.proto.common.v1.AnyValue.toObject(e.body,t)),e.attributes&&e.attributes.length){n.attributes=[];for(var o=0;o<e.attributes.length;++o)n.attributes[o]=Ls.opentelemetry.proto.common.v1.KeyValue.toObject(e.attributes[o],t)}return null!=e.droppedAttributesCount&&e.hasOwnProperty("droppedAttributesCount")&&(n.droppedAttributesCount=e.droppedAttributesCount),null!=e.flags&&e.hasOwnProperty("flags")&&(n.flags=e.flags),null!=e.traceId&&e.hasOwnProperty("traceId")&&(n.traceId=t.bytes===String?ks.base64.encode(e.traceId,0,e.traceId.length):t.bytes===Array?Array.prototype.slice.call(e.traceId):e.traceId),null!=e.spanId&&e.hasOwnProperty("spanId")&&(n.spanId=t.bytes===String?ks.base64.encode(e.spanId,0,e.spanId.length):t.bytes===Array?Array.prototype.slice.call(e.spanId):e.spanId),null!=e.observedTimeUnixNano&&e.hasOwnProperty("observedTimeUnixNano")&&("number"==typeof e.observedTimeUnixNano?n.observedTimeUnixNano=t.longs===String?String(e.observedTimeUnixNano):e.observedTimeUnixNano:n.observedTimeUnixNano=t.longs===String?ks.Long.prototype.toString.call(e.observedTimeUnixNano):t.longs===Number?new ks.LongBits(e.observedTimeUnixNano.low>>>0,e.observedTimeUnixNano.high>>>0).toNumber():e.observedTimeUnixNano),null!=e.eventName&&e.hasOwnProperty("eventName")&&(n.eventName=e.eventName),n},o.prototype.toJSON=function(){return this.constructor.toObject(this,Is.util.toJSONOptions)},o.getTypeUrl=function(e){return(e=void 0===e?"type.googleapis.com":e)+"/opentelemetry.proto.logs.v1.LogRecord"},o),r),n;function o(e){if(this.attributes=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function s(e){if(this.logRecords=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function i(e){if(this.scopeLogs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}function a(e){if(this.resourceLogs=[],e)for(var t=Object.keys(e),r=0;r<t.length;++r)null!=e[t[r]]&&(this[t[r]]=e[t[r]])}})(),Rs),Ns),Ls);function Ds(e){return 48<=e&&e<=57?e-48:97<=e&&e<=102?e-87:e-55}function Ms(t){var r=new Uint8Array(t.length/2);let n=0;for(let e=0;e<t.length;e+=2){var o=Ds(t.charCodeAt(e)),s=Ds(t.charCodeAt(e+1));r[n++]=o<<4|s}return r}function Vs(e){var t=BigInt(1e9);return BigInt(Math.trunc(e[0]))*t+BigInt(Math.trunc(e[1]))}function Bs(e){return e=Vs(e),{low:Number(BigInt.asUintN(32,e)),high:Number(BigInt.asUintN(32,e>>BigInt(32)))}}let Fs="undefined"!=typeof BigInt?function(e){return Vs(e).toString()}:function(e){return e[0]*ko+e[1]};function qs(e){return e}function Hs(e){if(void 0!==e)return Ms(e)}let Gs={encodeHrTime:Bs,encodeSpanContext:Ms,encodeOptionalSpanContext:Hs};function zs(e){var t;return void 0===e?Gs:(t=e.useLongBits??!0,e=e.useHex??!1,{encodeHrTime:t?Bs:Fs,encodeSpanContext:e?qs:Ms,encodeOptionalSpanContext:e?qs:Hs})}function Ks(e){var t={attributes:Ws(e.attributes),droppedAttributesCount:0},e=e.schemaUrl;return e&&""!==e&&(t.schemaUrl=e),t}function Ys(e){return{name:e.name,version:e.version}}function Ws(t){return Object.keys(t).map(e=>$s(e,t[e]))}function $s(e,t){return{key:e,value:Js(t)}}function Js(e){var t=typeof e;return"string"==t?{stringValue:e}:"number"==t?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:"boolean"==t?{boolValue:e}:e instanceof Uint8Array?{bytesValue:e}:Array.isArray(e)?{arrayValue:{values:e.map(Js)}}:"object"==t&&null!=e?{kvlistValue:{values:Object.entries(e).map(([e,t])=>$s(e,t))}}:{}}function Xs(e,r){e=(e=>{var i,a=new Map;for(i of e){let{resource:e,instrumentationScope:{name:t,version:r="",schemaUrl:n=""}}=i,o=a.get(e);o||(o=new Map,a.set(e,o));var u=t+`@${r}:`+n;let s=o.get(u);s||(s=[],o.set(u,s)),s.push(i)}return a})(e);return Array.from(e,([e,t])=>{e=Ks(e);return{resource:e,scopeLogs:Array.from(t,([,e])=>({scope:Ys(e[0].instrumentationScope),logRecords:e.map(e=>{return e=e,{timeUnixNano:(t=r).encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:Js(e.body),eventName:e.eventName,attributes:Qs(e.attributes),droppedAttributesCount:e.droppedAttributesCount,flags:e.spanContext?.traceFlags,traceId:t.encodeOptionalSpanContext(e.spanContext?.traceId),spanId:t.encodeOptionalSpanContext(e.spanContext?.spanId)};var t}),schemaUrl:e[0].instrumentationScope.schemaUrl})),schemaUrl:e.schemaUrl}})}function Qs(t){return Object.keys(t).map(e=>$s(e,t[e]))}js.opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse,js.opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest,(e=>{e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE"})(Zs=Zs||{}),(e=>{e.COUNTER="COUNTER",e.GAUGE="GAUGE",e.HISTOGRAM="HISTOGRAM",e.UP_DOWN_COUNTER="UP_DOWN_COUNTER",e.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",e.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",e.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(ea=ea||{}),(e=>{e[e.HISTOGRAM=0]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",e[e.GAUGE=2]="GAUGE",e[e.SUM=3]="SUM"})(ta=ta||{}),(e=>{e[e.DROP=0]="DROP",e[e.SUM=1]="SUM",e[e.LAST_VALUE=2]="LAST_VALUE",e[e.HISTOGRAM=3]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=4]="EXPONENTIAL_HISTOGRAM"})(ra=ra||{});let na=1023,oa=na,ia=Math.pow(2,-1022);function sa(e){var t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((2146435072&t.getUint32(0))>>20)-na}function aa(e){var t=new DataView(new ArrayBuffer(8)),e=(t.setFloat64(0,e),t.getUint32(0)),t=t.getUint32(4);return(1048575&e)*Math.pow(2,32)+t}function ua(e,t){return 0===e||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}class la extends Error{}class ca{_shift;constructor(e){this._shift=-e}mapToIndex(e){return e<ia?this._minNormalLowerBoundaryIndex():sa(e)+this._rightShift(aa(e)-1,52)>>this._shift}lowerBoundary(e){var t=this._minNormalLowerBoundaryIndex();if(e<t)throw new la(`underflow: ${e} is < minimum lower boundary: `+t);t=this._maxNormalLowerBoundaryIndex();if(t<e)throw new la(`overflow: ${e} is > maximum lower boundary: `+t);return ua(1,e<<this._shift)}get scale(){return 0===this._shift?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=-1022>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return oa>>this._shift}_rightShift(e,t){return Math.floor(e*Math.pow(2,-t))}}class pa{_scale;_scaleFactor;_inverseFactor;constructor(e){this._scale=e,this._scaleFactor=ua(Math.LOG2E,e),this._inverseFactor=ua(Math.LN2,-e)}mapToIndex(e){var t;return e<=ia?this._minNormalLowerBoundaryIndex()-1:0===aa(e)?(sa(e)<<this._scale)-1:(e=Math.floor(Math.log(e)*this._scaleFactor),(t=this._maxNormalLowerBoundaryIndex())<=e?t:e)}lowerBoundary(e){var t=this._maxNormalLowerBoundaryIndex();if(t<=e){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new la(`overflow: ${e} is > maximum lower boundary: `+t)}t=this._minNormalLowerBoundaryIndex();if(e<=t){if(e===t)return ia;if(e===t-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new la(`overflow: ${e} is < minimum lower boundary: `+t)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return-1022<<this._scale}_maxNormalLowerBoundaryIndex(){return(1024<<this._scale)-1}}Array.from({length:31},(e,t)=>new(10<t?pa:ca)(t-10)),(e=>{e[e.DEFAULT=0]="DEFAULT",e[e.DROP=1]="DROP",e[e.SUM=2]="SUM",e[e.LAST_VALUE=3]="LAST_VALUE",e[e.EXPLICIT_BUCKET_HISTOGRAM=4]="EXPLICIT_BUCKET_HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=5]="EXPONENTIAL_HISTOGRAM"})(da=da||{});let ha=e=>null!==e&&"object"==typeof e&&"function"==typeof e.then;class fa{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,t){t=new fa({},t);return t._rawAttributes=ga(e),t._asyncAttributesPending=0<e.filter(([,e])=>ha(e)).length,t}constructor(e,t){var e=e.attributes??{};this._rawAttributes=Object.entries(e).map(([e,t])=>(ha(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=ga(this._rawAttributes),this._schemaUrl="string"==typeof(e=t?.schemaUrl)||void 0===e?e:void Xn.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){var[t,r]=this._rawAttributes[e];this._rawAttributes[e]=[t,ha(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Xn.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;var e,t,r={};for([e,t]of this._rawAttributes)ha(t)?Xn.debug(`Unsettled resource attribute ${e} skipped`):null!=t&&(r[e]??=t);return this._asyncAttributesPending||(this._memoizedAttributes=r),r}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){var t,r;return null==e?this:(t=(t=this)?.schemaUrl,r=e?.schemaUrl,r=(t=void 0===t||""===t?r:void 0===r||""===r||t===r?t:void Xn.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',t,r))?{schemaUrl:t}:void 0,fa.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r))}}function ma(){return e={[Oo]:"unknown_service",[xo]:Po[xo],[Ro]:Po[Ro],[No]:Po[No]},fa.FromAttributeList(Object.entries(e),void 0);var e}function ga(e){return e.map(([t,e])=>ha(e)?[t,e.catch(e=>{Xn.debug("promise rejection for resource attribute: %s - %s",t,e)})]:[t,e])}function _a(e,t){let r=255&e|256;return t&&(r|=512),r}function va(e,r){var t=e.spanContext(),n=e.status,o=e.parentSpanContext?.spanId?r.encodeSpanContext(e.parentSpanContext?.spanId):void 0;return{traceId:r.encodeSpanContext(t.traceId),spanId:r.encodeSpanContext(t.spanId),parentSpanId:o,traceState:t.traceState?.serialize(),name:e.name,kind:null==e.kind?0:e.kind+1,startTimeUnixNano:r.encodeHrTime(e.startTime),endTimeUnixNano:r.encodeHrTime(e.endTime),attributes:Ws(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(e=>{return t=r,{attributes:(e=e).attributes?Ws(e.attributes):[],name:e.name,timeUnixNano:t.encodeHrTime(e.time),droppedAttributesCount:e.droppedAttributesCount||0};var t}),droppedEventsCount:e.droppedEventsCount,status:{code:n.code,message:n.message},links:e.links.map(e=>{return t=r,{attributes:(e=e).attributes?Ws(e.attributes):[],spanId:t.encodeSpanContext(e.context.spanId),traceId:t.encodeSpanContext(e.context.traceId),traceState:e.context.traceState?.serialize(),droppedAttributesCount:e.droppedAttributesCount||0,flags:_a(e.context.traceFlags,e.context.isRemote)};var t}),droppedLinksCount:e.droppedLinksCount,flags:_a(t.traceFlags,e.parentSpanContext?.isRemote)}}function ba(e,s){let t=(e=>{var r,n=new Map;for(r of e){let e=n.get(r.resource);e||(e=new Map,n.set(r.resource,e));var o=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:`+(r.instrumentationScope.schemaUrl||"");let t=e.get(o);t||(t=[],e.set(o,t)),t.push(r)}return n})(e),i=[],a=t.entries(),u=a.next();for(;!u.done;){let[e,t]=u.value,r=[],n=t.values(),o=n.next();for(;!o.done;){let t=o.value;if(0<t.length){let e=t.map(e=>va(e,s));r.push({scope:Ys(t[0].instrumentationScope),spans:e,schemaUrl:t[0].instrumentationScope.schemaUrl})}o=n.next()}var l=Ks(e),l={resource:l,scopeSpans:r,schemaUrl:l.schemaUrl};i.push(l),u=a.next()}return i}(e=>{e[e.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",e[e.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",e[e.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(ya=ya||{}),js.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse,js.opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest,js.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse,js.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;let Sa={serializeRequest:e=>{e={resourceLogs:Xs(e,zs({useHex:!0,useLongBits:!1}))};return(new TextEncoder).encode(JSON.stringify(e))},deserializeResponse:e=>{var t;return 0===e.length?{}:(t=new TextDecoder,JSON.parse(t.decode(e)))}},Ta={serializeRequest:e=>{e={resourceSpans:ba(e,zs({useHex:!0,useLongBits:!1}))};return(new TextEncoder).encode(JSON.stringify(e))},deserializeResponse:e=>{var t;return 0===e.length?{}:(t=new TextDecoder,JSON.parse(t.decode(e)))}};function wa(){return.4*Math.random()-.2}class Ea{_transport;constructor(e){this._transport=e}retry(r,n,o){return new Promise((e,t)=>{setTimeout(()=>{this._transport.send(r,n).then(e,t)},o)})}async send(t,e){var r=Date.now()+e;let n=await this._transport.send(t,e),o=5,s=1e3;for(;"retryable"===n.status&&0<o;){o--;let e=Math.max(Math.min(s,5e3)+wa(),0);s*=1.5;var i=n.retryInMillis??e,a=r-Date.now();if(a<i)return n;n=await this.retry(t,a,i)}return n}shutdown(){return this._transport.shutdown()}}function Aa(e){return new Ea(e.transport)}function Oa(e){return[429,502,503,504].includes(e)}function xa(e){var t;if(null!=e)return t=Number.parseInt(e,10),Number.isInteger(t)?0<t?1e3*t:-1:0<=(t=new Date(e).getTime()-Date.now())?t:0}class Ca{_parameters;constructor(e){this._parameters=e}async send(e,n){let o=await this._parameters.headers();return new Promise(t=>{let r=new XMLHttpRequest;r.timeout=n,r.open("POST",this._parameters.url),Object.entries(o).forEach(([e,t])=>{r.setRequestHeader(e,t)}),r.ontimeout=e=>{t({status:"failure",error:new Error("XHR request timed out")})},r.onreadystatechange=()=>{200<=r.status&&r.status<=299?(Xn.debug("XHR success"),t({status:"success"})):r.status&&Oa(r.status)?t({status:"retryable",retryInMillis:xa(r.getResponseHeader("Retry-After"))}):0!==r.status&&t({status:"failure",error:new Error("XHR request failed with non-retryable status")})},r.onabort=()=>{t({status:"failure",error:new Error("XHR request aborted")})},r.onerror=()=>{t({status:"failure",error:new Error("XHR request errored")})},r.send(e)})}shutdown(){}}class Ra{_params;constructor(e){this._params=e}async send(t){let r=(await this._params.headers())["Content-Type"];return new Promise(e=>{navigator.sendBeacon(this._params.url,new Blob([t],{type:r}))?(Xn.debug("SendBeacon success"),e({status:"success"})):e({status:"failure",error:new Error("SendBeacon failed")})})}shutdown(){}}class Na{_parameters;constructor(e){this._parameters=e}async send(n,e){let o=new AbortController,t=setTimeout(()=>o.abort(),e);try{let e=!!globalThis.location,t=new URL(this._parameters.url),r=await fetch(t.href,{method:"POST",headers:await this._parameters.headers(),body:n,signal:o.signal,keepalive:e,mode:e?globalThis.location?.origin===t.origin?"same-origin":"cors":"no-cors"});if(200<=r.status&&r.status<=299)return Xn.debug("response success"),{status:"success"};if(Oa(r.status)){let e=r.headers.get("Retry-After");return{status:"retryable",retryInMillis:xa(e)}}return{status:"failure",error:new Error("Fetch request failed with non-retryable status")}}catch(n){return"AbortError"===n?.name?{status:"failure",error:new Error("Fetch request timed out",{cause:n})}:{status:"failure",error:new Error("Fetch request errored",{cause:n})}}finally{clearTimeout(t)}}shutdown(){}}function Ia(e,t){return pi(e,t,Aa({transport:(t=e,new Ca(t))}))}function Pa(e,t){return pi(e,t,Aa({transport:(t=e,new Na(t))}))}function Ua(e,t){return pi(e,t,Aa({transport:(t={url:e.url,headers:e.headers},new Ra(t))}))}function ka(r,n,o){return async()=>{var e={...await o()},t={};return null!=n&&Object.assign(t,await n()),null!=r&&Object.assign(t,(e=>{let r={};return Object.entries(e??{}).forEach(([e,t])=>{void 0!==t?r[e]=String(t):Xn.warn(`Header "${e}" has invalid value (${t}) and will be ignored`)}),r})(await r())),Object.assign(t,e)}}function La(e){if(null!=e)try{var t=globalThis.location?.href;return new URL(e,t).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${e}'`)}}function ja(e){var t;return"function"==typeof e.headers?e.headers:null!=(t=e.headers)?async()=>t:void 0}function Da(e,t,r){return e={url:e.url,timeoutMillis:e.timeoutMillis,headers:ja(e),concurrencyLimit:e.concurrencyLimit},n=r,{...sr(e,r={},t={timeoutMillis:1e4,concurrencyLimit:30,compression:"none",headers:async()=>n,url:"http://localhost:4318/"+t}),headers:ka(e.headers,r.headers,t.headers),url:La(e.url)??r.url??t.url};var n}function Ma(e,t,r,n){return(e.headers||"function"!=typeof navigator.sendBeacon?void 0!==globalThis.fetch?Pa:Ia:Ua)(Da(e,r,n),t)}var Va,Ba=Object.freeze({__proto__:null,OTLPLogExporter:class extends nr{constructor(e={}){super(Ma(e,Sa,"v1/logs",{"Content-Type":"application/json"}))}}}),Fa=n(Ba);(e=>{e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRACE=1]="TRACE",e[e.TRACE2=2]="TRACE2",e[e.TRACE3=3]="TRACE3",e[e.TRACE4=4]="TRACE4",e[e.DEBUG=5]="DEBUG",e[e.DEBUG2=6]="DEBUG2",e[e.DEBUG3=7]="DEBUG3",e[e.DEBUG4=8]="DEBUG4",e[e.INFO=9]="INFO",e[e.INFO2=10]="INFO2",e[e.INFO3=11]="INFO3",e[e.INFO4=12]="INFO4",e[e.WARN=13]="WARN",e[e.WARN2=14]="WARN2",e[e.WARN3=15]="WARN3",e[e.WARN4=16]="WARN4",e[e.ERROR=17]="ERROR",e[e.ERROR2=18]="ERROR2",e[e.ERROR3=19]="ERROR3",e[e.ERROR4=20]="ERROR4",e[e.FATAL=21]="FATAL",e[e.FATAL2=22]="FATAL2",e[e.FATAL3=23]="FATAL3",e[e.FATAL4=24]="FATAL4"})(Va=Va||{});class qa{emit(e){}}let Ha=new qa,Ga=new class{getLogger(e,t,r){return new qa}};class za{constructor(e,t,r,n){this._provider=e,this.name=t,this.version=r,this.options=n}emit(e){this._getLogger().emit(e)}_getLogger(){var e;return this._delegate||((e=this._provider._getDelegateLogger(this.name,this.version,this.options))?(this._delegate=e,this._delegate):Ha)}}class Ka{getLogger(e,t,r){var n;return null!=(n=this._getDelegateLogger(e,t,r))?n:new za(this,e,t,r)}_getDelegate(){var e;return null!=(e=this._delegate)?e:Ga}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,r){var n;return null==(n=this._delegate)?void 0:n.getLogger(e,t,r)}}let Ya="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof X?X:{},Wa=Symbol.for("io.opentelemetry.js.api.logs"),$a=Ya;class Ja{constructor(){this._proxyLoggerProvider=new Ka}static getInstance(){return this._instance||(this._instance=new Ja),this._instance}setGlobalLoggerProvider(e){return $a[Wa]?this.getLoggerProvider():($a[Wa]=(t=e,r=Ga,e=>1===e?t:r),this._proxyLoggerProvider._setDelegate(e),e);var t,r}getLoggerProvider(){var e;return null!=(e=null==(e=$a[Wa])?void 0:e.call($a,1))?e:this._proxyLoggerProvider}getLogger(e,t,r){return this.getLoggerProvider().getLogger(e,t,r)}disable(){delete $a[Wa],this._proxyLoggerProvider=new Ka}}let Xa=Ja.getInstance();var Qa=n(Object.freeze({__proto__:null,logs:Xa,get SeverityNumber(){return Va},NOOP_LOGGER:Ha,NoopLogger:qa,ProxyLoggerProvider:Ka}));class Za{hrTime;hrTimeObserved;spanContext;resource;instrumentationScope;attributes={};_severityText;_severityNumber;_body;_eventName;totalAttributesCount=0;_isReadonly=!1;_logRecordLimits;set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this.totalAttributesCount-Object.keys(this.attributes).length}constructor(e,t,r){var{timestamp:r,observedTimestamp:n,eventName:o,severityNumber:s,severityText:i,body:a,attributes:u={},context:l}=r,c=Date.now();if(this.hrTime=Mo(r??c),this.hrTimeObserved=Mo(n??c),l){let e=mo.getSpanContext(l);e&&kn(e)&&(this.spanContext=e)}this.severityNumber=s,this.severityText=i,this.body=a,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=o,this.setAttributes(u)}setAttribute(e,t){return this._isLogRecordReadonly()||null===t||(0===e.length?Xn.warn("Invalid attribute key: "+e):vo(t)||"object"==typeof t&&!Array.isArray(t)&&0<Object.keys(t).length?(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,e)?1===this.droppedAttributesCount&&Xn.warn("Dropping extra attributes."):vo(t)?this.attributes[e]=this._truncateToSize(t):this.attributes[e]=t):Xn.warn("Invalid attribute value set for key: "+e)),this}setAttributes(e){for(var[t,r]of Object.entries(e))this.setAttribute(t,r);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;return t<=0?(Xn.warn("Attribute value limit must be positive, got "+t),e):"string"==typeof e?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>"string"==typeof e?this._truncateToLimitUtil(e,t):e):e}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&Xn.warn("Can not execute the operation on emitted log record"),this._isReadonly}}class eu{instrumentationScope;_sharedState;constructor(e,t){this.instrumentationScope=e,this._sharedState=t}emit(e){var t=e.context||Jn.active(),e=new Za(this._sharedState,this.instrumentationScope,{context:t,...e});this._sharedState.activeProcessor.onEmit(e,t),e._makeReadonly()}}class tu{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}}class ru{processors;forceFlushTimeoutMillis;constructor(e,t){this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let t=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(e=>ii(e.forceFlush(),t)))}onEmit(t,r){this.processors.forEach(e=>e.onEmit(t,r))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}}class nu{resource;forceFlushTimeoutMillis;logRecordLimits;processors;loggers=new Map;activeProcessor;registeredLogRecordProcessors=[];constructor(e,t,r,n){this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=r,0<(this.processors=n).length?(this.registeredLogRecordProcessors=n,this.activeProcessor=new ru(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new tu}}class ou{_exporter;_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_isExporting=!1;_finishedLogRecords=[];_timer;_shutdownOnce;constructor(e,t){this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new ai(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(Xn.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{var r=[],n=Math.ceil(this._finishedLogRecords.length/this._maxExportBatchSize);for(let e=0;e<n;e++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),0===this._finishedLogRecords.length?Promise.resolve():new Promise((e,t)=>{ii(this._export(this._finishedLogRecords.splice(0,this._maxExportBatchSize)),this._exportTimeoutMillis).then(()=>e()).catch(t)})}_maybeStartTimer(){if(!this._isExporting){let e=()=>{this._isExporting=!0,this._flushOneBatch().then(()=>{this._isExporting=!1,0<this._finishedLogRecords.length&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,To(e)})};if(this._finishedLogRecords.length>=this._maxExportBatchSize)return e();void 0===this._timer&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),"number"!=typeof this._timer)&&this._timer.unref()}}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}_export(e){var t=()=>ui._export(this._exporter,e).then(e=>{e.code!==Vo.SUCCESS&&To(e.error??new Error(`BatchLogRecordProcessor: log record export failed (status ${e})`))}).catch(To),r=e.map(e=>e.resource).filter(e=>e.asyncAttributesPending);return 0===r.length?t():Promise.all(r.map(e=>e.waitForAsyncAttributes?.())).then(t,To)}}var Iu,Gu,iu=Object.freeze({__proto__:null,LoggerProvider:class{_shutdownOnce;_sharedState;constructor(e={}){var t=(e=>{let t=e.shift();for(var r=new WeakMap;0<e.length;)t=Qo(t,e.shift(),0,r);return t})([{},{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},includeTraceContext:!0},e]),r=e.resource??ma();this._sharedState=new nu(r,t.forceFlushTimeoutMillis,{attributeCountLimit:(r=t.logRecordLimits).attributeCountLimit??128,attributeValueLengthLimit:r.attributeValueLengthLimit??1/0},e?.processors??[]),this._shutdownOnce=new ai(this._shutdown,this)}getLogger(e,t,r){if(this._shutdownOnce.isCalled)return Xn.warn("A shutdown LoggerProvider cannot provide a Logger"),Ha;e||Xn.warn("Logger requested without instrumentation scope name.");var e=e||"unknown",n=e+`@${t||""}:`+(r?.schemaUrl||"");return this._sharedState.loggers.has(n)||this._sharedState.loggers.set(n,new eu({name:e,version:t,schemaUrl:r?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(n)}forceFlush(){return this._shutdownOnce.isCalled?(Xn.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(Xn.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}},ConsoleLogRecordExporter:class{export(e,t){this._sendLogRecords(e,t)}shutdown(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:1e6*(t=e.hrTime)[0]+t[1]/1e3,traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,body:e.body,attributes:e.attributes};var t}_sendLogRecords(t,e){for(let e of t)console.dir(this._exportInfo(e),{depth:3});e?.({code:Vo.SUCCESS})}},SimpleLogRecordProcessor:class{_exporter;_shutdownOnce;_unresolvedExports;constructor(e){this._exporter=e,this._shutdownOnce=new ai(this._shutdown,this),this._unresolvedExports=new Set}onEmit(r){if(!this._shutdownOnce.isCalled){let t=()=>ui._export(this._exporter,[r]).then(e=>{e.code!==Vo.SUCCESS&&To(e.error??new Error(`SimpleLogRecordProcessor: log record export failed (status ${e})`))}).catch(To);if(r.resource.asyncAttributesPending){let e=r.resource.waitForAsyncAttributes?.().then(()=>(this._unresolvedExports.delete(e),t()),To);null!=e&&this._unresolvedExports.add(e)}else t()}}async forceFlush(){await Promise.all(Array.from(this._unresolvedExports))}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}},InMemoryLogRecordExporter:class{_finishedLogRecords=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:Vo.FAILED,error:new Error("Exporter has been stopped")});this._finishedLogRecords.push(...e),t({code:Vo.SUCCESS})}shutdown(){return this._stopped=!0,this.reset(),Promise.resolve()}getFinishedLogRecords(){return this._finishedLogRecords}reset(){this._finishedLogRecords=[]}},BatchLogRecordProcessor:class extends ou{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this._onInit(t)}onShutdown(){"undefined"!=typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener)&&document.removeEventListener("pagehide",this._pageHideListener)}_onInit(e){!0!==e?.disableAutoFlushOnDocumentHide&&"undefined"!=typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush()},this._pageHideListener=()=>{this.forceFlush()},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}}}),su=n(iu);let au=kr("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function uu(e){return e.setValue(au,!0)}function lu(e){return!0===e.getValue(au)}let cu="baggage";class pu{inject(e,r,n){var o=po.getBaggage(e);if(o&&!lu(e)){let e=o.getAllEntries().map(([e,t])=>{let r=encodeURIComponent(e)+"="+encodeURIComponent(t.value);return void 0!==t.metadata&&(r+=";"+t.metadata.toString()),r}).filter(e=>e.length<=4096).slice(0,180),t=e.reduce((e,t)=>{t=e+(""!==e?",":"")+t;return 8192<t.length?e:t},"");0<t.length&&n.set(r,cu,t)}}extract(e,t,r){r=r.get(t,cu),t=Array.isArray(r)?r.join(","):r;if(!t)return e;let n={};return 0===t.length||(t.split(",").forEach(e=>{var t=(n=>{if(n){var o=n.indexOf(";"),s=-1===o?n:n.substring(0,o),e=s.indexOf("=");if(!(e<=0)){var i=s.substring(0,e).trim(),s=s.substring(e+1).trim();if(i&&s){let e,t,r;try{e=decodeURIComponent(i),t=decodeURIComponent(s)}catch{return}return-1!==o&&o<n.length-1&&(r=Ur(n.substring(o+1))),{key:e,value:t,metadata:r}}}}})(e);if(t){let e={value:t.value};t.metadata&&(e.metadata=t.metadata),n[t.key]=e}}),0===Object.entries(n).length)?e:po.setBaggage(e,po.createBaggage(n))}fields(){return[cu]}}function du(e){var t,r={};if("object"==typeof e&&null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(hu(n)?fu(t=e[n])?Array.isArray(t)?r[n]=t.slice():r[n]=t:Xn.warn("Invalid attribute value set for key: "+n):Xn.warn("Invalid attribute key: "+n));return r}function hu(e){return"string"==typeof e&&""!==e}function fu(e){return null==e||(Array.isArray(e)?(e=>{let t;for(var r of e)if(null!=r){let e=typeof r;if(e!==t){if(t||!mu(e))return!1;t=e}}return!0})(e):mu(typeof e))}function mu(e){switch(e){case"number":case"boolean":case"string":return!0}return!1}let gu=e=>{var t;Xn.error("string"==typeof(t=e)?t:JSON.stringify((()=>{let r={},n=t;for(;null!==n;)Object.getOwnPropertyNames(n).forEach(e=>{var t;r[e]||(t=n[e])&&(r[e]=String(t))}),n=Object.getPrototypeOf(n);return r})()))};function yu(e){try{gu(e)}catch{}}let _u="process.runtime.name",vu={[Ro]:"opentelemetry",[_u]:"browser",[xo]:Co,[No]:"2.7.1"},bu=performance,Su=Math.pow(10,6),Tu=Math.pow(10,9);function wu(e){return[Math.trunc(e/1e3),Math.round(e%1e3*Su)]}function Eu(e){return Nu(wu(bu.timeOrigin),wu("number"==typeof e?e:bu.now()))}function Au(e){if(Cu(e))return e;if("number"==typeof e)return(e<bu.timeOrigin?Eu:wu)(e);if(e instanceof Date)return wu(e.getTime());throw TypeError("Invalid input type")}function Ou(e){return e[0]*Tu+e[1]}function xu(e){return 1e6*e[0]+e[1]/1e3}function Cu(e){return Array.isArray(e)&&2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Ru(e){return Cu(e)||"number"==typeof e||e instanceof Date}function Nu(e,t){e=[e[0]+t[0],e[1]+t[1]];return e[1]>=Tu&&(e[1]-=Tu,e[0]+=1),e}(e=>{e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(Iu=Iu||{});class Pu{_propagators;_fields;constructor(e={}){this._propagators=e.propagators??[];var t=new Set;for(let e of this._propagators){var r="function"==typeof e.fields?e.fields():[];for(let e of r)t.add(e)}this._fields=Array.from(t)}inject(e,t,r){for(var n of this._propagators)try{n.inject(e,t,r)}catch(e){Xn.warn(`Failed to inject with ${n.constructor.name}. Err: `+e.message)}}extract(e,r,n){return this._propagators.reduce((e,t)=>{try{return t.extract(e,r,n)}catch(e){Xn.warn(`Failed to extract with ${t.constructor.name}. Err: `+e.message)}return e},e)}fields(){return this._fields.slice()}}let Uu="[_0-9a-z-*/]",ku=new RegExp(`^(?:${`[a-z]${Uu}{0,255}`}|${`[a-z0-9]${Uu}{0,240}@[a-z]${Uu}{0,13}`})$`),Lu=/^[ -~]{0,255}[!-~]$/,ju=/,|=/;function Du(e){return ku.test(e)}function Mu(e){return Lu.test(e)&&!ju.test(e)}class Vu{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState="string"==typeof e?e:"",this._length=this._rawTraceState.length}set(e,t){var r,n,o;return!Du(e)||!Mu(t)||(o=(r=this._getState()).get(e),n=this._length,512<(n+="string"==typeof o?t.length-o.length:e.length+t.length+(0<r.size?2:1)))?this:((o=new Map(r)).delete(e),o.set(e,t),this._fromState(o,n))}unset(e){var t=this._getState(),r=t.get(e);if("string"!=typeof r)return this;let n=this._length-(e.length+r.length+1);1<t.size&&--n;r=new Map(t);return r.delete(e),this._fromState(r,n)}get(e){return this._getState().get(e)}serialize(){let e="",t=0;for(var r of this._getState())0<t&&(e=","+e),e=r[0]+"="+r[1]+e,t++;return e}_getState(){if(!this._internalState){let e=this._rawTraceState.split(","),r=new Map,n=0;for(var o of e){let e=o.trim(),t=e.indexOf("=");if(-1!==t){var o=e.slice(0,t),s=e.slice(t+1);if(Du(o)&&Mu(s)){var i=n+e.length+(0<r.size?1:0);if(!(512<i)&&(r.set(o,s),n=i,32<=r.size))break}}}this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse())}return this._internalState}_fromState(e,t){var r=Object.create(Vu.prototype);return r._internalState=e,r._length=t,r}}let Bu="traceparent",Fu="tracestate",qu=new RegExp("^\\s?((?!ff)[\\da-f]{2})-((?![0]{32})[\\da-f]{32})-((?![0]{16})[\\da-f]{16})-([\\da-f]{2})(-.*)?\\s?$");class Hu{inject(e,t,r){var n=mo.getSpanContext(e);n&&!lu(e)&&kn(n)&&(e=`00-${n.traceId}-${n.spanId}-0`+Number(n.traceFlags||un.NONE).toString(16),r.set(t,Bu,e),n.traceState)&&r.set(t,Fu,n.traceState.serialize())}extract(e,t,r){var n=r.get(t,Bu);if(!n)return e;n=Array.isArray(n)?n[0]:n;if("string"!=typeof n)return e;n=(e=>!(e=qu.exec(e))||"00"===e[1]&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)})(n);if(!n)return e;n.isRemote=!0;r=r.get(t,Fu);if(r){let e=Array.isArray(r)?r.join(","):r;n.traceState=new Vu("string"==typeof e?e:void 0)}return mo.setSpanContext(e,n)}fields(){return[Bu,Fu]}}(Gu=Gu||{}).HTTP="http";let zu="[object Null]",Ku="[object Undefined]",Yu=Function.prototype.toString,Wu=Yu.call(Object),$u=Object.getPrototypeOf,Ju=Object.prototype,Xu=Ju.hasOwnProperty,Qu=Symbol?Symbol.toStringTag:void 0,Zu=Ju.toString;function el(e){return null!=e&&"object"==typeof e&&"[object Object]"===(t=>{if(null==t)return void 0===t?Ku:zu;if(Qu&&Qu in Object(t)){var r=t,n=Xu.call(r,Qu),o=r[Qu];let e=!1;try{r[Qu]=void 0,e=!0}catch{}var s=Zu.call(r);return e&&(n?r[Qu]=o:delete r[Qu]),s}return n=t,Zu.call(n)})(e)&&(null===(e=$u(e))||"function"==typeof(e=Xu.call(e,"constructor")&&e.constructor)&&e instanceof e&&Yu.call(e)===Wu)}function tl(e){return ol(e)?e.slice():e}function rl(r,n,o=0,s){let i;if(!(20<o)){if(o++,al(r)||al(n)||il(n))i=tl(n);else if(ol(r)){if(i=r.slice(),ol(n))for(let e=0,t=n.length;e<t;e++)i.push(tl(n[e]));else if(sl(n)){let r=Object.keys(n);for(let t=0,e=r.length;t<e;t++){let e=r[t];"__proto__"!==e&&"constructor"!==e&&"prototype"!==e&&(i[e]=tl(n[e]))}}}else if(sl(r))if(sl(n)){if(e=n,!el(r)||!el(e))return n;i=Object.assign({},r);var a=Object.keys(n);for(let e=0,t=a.length;e<t;e++){var u=a[e];if("__proto__"!==u&&"constructor"!==u&&"prototype"!==u){var l=n[u];if(al(l))void 0===l?delete i[u]:i[u]=l;else{var c=i[u],p=l;if(nl(r,u,s)||nl(n,u,s))delete i[u];else{if(sl(c)&&sl(p)){let e=s.get(c)||[],t=s.get(p)||[];e.push({obj:r,key:u}),t.push({obj:n,key:u}),s.set(c,e),s.set(p,t)}i[u]=rl(i[u],l,o,s)}}}}}else i=n;return i}var e}function nl(r,n,e){var o=e.get(r[n])||[];for(let e=0,t=o.length;e<t;e++){var s=o[e];if(s.key===n&&s.obj===r)return!0}return!1}function ol(e){return Array.isArray(e)}function il(e){return"function"==typeof e}function sl(e){return!al(e)&&!ol(e)&&!il(e)&&"object"==typeof e}function al(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e||e instanceof Date||e instanceof RegExp||null===e}class ul{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}class ll{_isCalled=!1;_deferred=new ul;_callback;_that;constructor(e,t){this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}vr.ALL,vr.VERBOSE,vr.DEBUG,vr.INFO,vr.WARN,vr.ERROR,vr.NONE;let cl={_export:function(t,r){return new Promise(e=>{Jn.with(uu(Jn.active()),()=>{t.export(r,e)})})}},pl;function dl(){if(void 0===pl)try{var e=globalThis.process.argv0;pl=e?"unknown_service:"+e:"unknown_service"}catch{pl="unknown_service"}return pl}let hl=e=>null!==e&&"object"==typeof e&&"function"==typeof e.then;class fl{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,t){t=new fl({},t);return t._rawAttributes=_l(e),t._asyncAttributesPending=0<e.filter(([,e])=>hl(e)).length,t}constructor(e,t){var e=e.attributes??{};this._rawAttributes=Object.entries(e).map(([e,t])=>(hl(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=_l(this._rawAttributes),this._schemaUrl="string"==typeof(e=t?.schemaUrl)||void 0===e?e:void Xn.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",e)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){var[t,r]=this._rawAttributes[e];this._rawAttributes[e]=[t,hl(r)?await r:r]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&Xn.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;var e,t,r={};for([e,t]of this._rawAttributes)hl(t)?Xn.debug(`Unsettled resource attribute ${e} skipped`):null!=t&&(r[e]??=t);return this._asyncAttributesPending||(this._memoizedAttributes=r),r}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){var t,r;return null==e?this:(t=(t=this)?.schemaUrl,r=e?.schemaUrl,r=(t=void 0===t||""===t?r:void 0===r||""===r||t===r?t:void Xn.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',t,r))?{schemaUrl:t}:void 0,fl.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],r))}}function ml(e,t){return fl.FromAttributeList(Object.entries(e),t)}function gl(){return ml({})}function yl(){return ml({[Oo]:dl(),[xo]:vu[xo],[Ro]:vu[Ro],[No]:vu[No]})}function _l(e){return e.map(([t,e])=>hl(e)?[t,e.catch(e=>{Xn.debug("promise rejection for resource attribute: %s - %s",t,e)})]:[t,e])}let vl=new class{_MAX_LENGTH=255;_COMMA_SEPARATOR=",";_LABEL_KEY_VALUE_SPLITTER="=";detect(e){return{attributes:{}}}_parseResourceAttributes(e){if(!e)return{};let o={},t=e.split(this._COMMA_SEPARATOR).filter(e=>""!==e.trim());for(let n of t){let e=n.split(this._LABEL_KEY_VALUE_SPLITTER);if(2!==e.length)throw new Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${n}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);var[s,i]=e,s=s.trim(),i=i.trim();if(0===s.length)throw new Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${n}".`);let t,r;try{t=decodeURIComponent(s),r=decodeURIComponent(i)}catch(o){throw new Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${n}": `+(o instanceof Error?o.message:o))}if(t.length>this._MAX_LENGTH)throw new Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${t}".`);if(r.length>this._MAX_LENGTH)throw new Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${t}".`);o[t]=r}return o}},bl=new class{detect(){return{attributes:{}}}},Sl=bl,Tl=bl,wl=bl,El=bl;var ed,td,Ed,Al=Object.freeze({__proto__:null,detectResources:(n={})=>(n.detectors||[]).map(t=>{try{r=t.detect(n);var e=new fl(r,void 0);return Xn.debug(t.constructor.name+" found resource.",e),e}catch(e){return Xn.debug(t.constructor.name+" failed: "+e.message),gl()}var r}).reduce((e,t)=>e.merge(t),gl()),envDetector:vl,hostDetector:Sl,osDetector:Tl,processDetector:wl,serviceInstanceIdDetector:El,resourceFromAttributes:ml,defaultResource:yl,emptyResource:gl,defaultServiceName:dl}),Ol=n(Al),xl={exports:{}},Cl=(xl.exports=t.default,rr.inspect),Rl=Fa.OTLPLogExporter,Nl=Qa,Il=su.LoggerProvider,Pl=su.BatchLogRecordProcessor,Ul=Ol,kl=xl.exports,Ll=F(),jl=o,Dl="tccc",Ml="https://otlp.tccc.qcloud.com/v1/logs",Vl=Ll.newUUID(),Bl=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Cl.apply(void 0,t.concat([{compact:!0,breakLength:1/0}])).slice(1,-1).replace(/((\\r|\\n)\\n(\\n)?)/g,"\n")},Fl=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=_({url:e.url||Ml,headers:{"X-Tps-TenantID":e.tenantId||Dl},attributes:{}},e);return new Il({resource:Ul.defaultResource().merge(Ul.resourceFromAttributes(_({"tps.tenant.id":e.tenantId||Dl,"service.name":"JsSIP","service.version":jl.version},t))),processors:[new Pl(new Rl(r))]}).getLogger("JsSIP",jl.version)},ql={provider:Fl({tenantId:Dl,url:Ml}),attributes:{uuid:Vl,"trtc.version":kl.VERSION}},Hl=(J.setConfig=function(e){ql.provider=Fl(e)},J.setAttributes=function(e){ql.attributes=Object.assign(ql.attributes,e)},{DEBUG:{severityNumber:Nl.SeverityNumber.DEBUG,severityText:"debug"},INFO:{severityNumber:Nl.SeverityNumber.INFO,severityText:"info"},WARN:{severityNumber:Nl.SeverityNumber.WARN,severityText:"warn"},ERROR:{severityNumber:Nl.SeverityNumber.ERROR,severityText:"error"}}),Gl=function(){var e=(new Date).getMilliseconds().toString().padStart(3,"0");return"[".concat(e,"]")},zl=(J.log=function(e,t,r){for(var n=arguments.length,o=new Array(3<n?n-3:0),s=3;s<n;s++)o[s-3]=arguments[s];ql.provider.emit(_(_({},Hl[(null==t?void 0:t.toUpperCase())||"DEBUG"]),{},{attributes:_(_({},Ll.toPlainObject(r)),Ll.toPlainObject(ql.attributes)),body:"".concat(Gl()," ").concat(e||""," ").concat(Bl.apply(void 0,o))}))},s),Kl=J,Yl=(()=>{function s(e){l(this,s),this.prefix=e}return p(s,[{key:"debug",get:function(){var n=this;return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(n.report.apply(n,["debug"].concat(t)),!(s._logLevel>zl.LOG_LEVEL.DEBUG))return n.d.apply(n,t)}}},{key:"warn",get:function(){var n=this;return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(n.report.apply(n,["warn"].concat(t)),!(s._logLevel>zl.LOG_LEVEL.WARN))return n.w.apply(n,t)}}},{key:"error",get:function(){var n=this;return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(n.report.apply(n,["error"].concat(t)),!(s._logLevel>zl.LOG_LEVEL.ERROR))return n.e.apply(n,t)}}},{key:"report",value:function(e){for(var t=arguments.length,r=new Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(s._log_report){var o={};try{0<r.length&&"object"===T(r[r.length-1])&&(Object.assign(o,r[r.length-1]),r=r.slice(0,-1))}catch(e){}Kl.log.apply(Kl,[this.prefix,e,o].concat(b(r)))}}},{key:"d",value:function(e){this.exec("debug",e)}},{key:"i",value:function(e){this.exec("info",e)}},{key:"w",value:function(e){this.exec("warn",e)}},{key:"e",value:function(e){this.exec("error",e)}},{key:"exec",value:function(e,t){console[e](this.getPrefix(),this.getPrefixStyle(),this.getBgStyle(),this.getTime(),"string"==typeof t?t:JSON.stringify(t))}},{key:"getPrefix",value:function(){return"%c JsSIP %c"}},{key:"getPrefixStyle",value:function(){return"background:#27ae60; padding:1px; border-radius:3px; color: #fff"}},{key:"getBgStyle",value:function(){return"background:transparent"}},{key:"getTime",value:function(){var e=new Date;return"".concat(e.toLocaleTimeString("en-US",{hour12:!1}),".").concat(this.padMs(e.getMilliseconds()))}},{key:"padMs",value:function(e){var t;switch(e.toString().length){case 1:t="00".concat(e);break;case 2:t="0".concat(e);break;default:t="".concat(e)}return t}}],[{key:"setLogLevel",value:function(e){s._logLevel=e}},{key:"setLogReport",value:function(e){s._log_report=e}},{key:"setConfig",value:function(e){Kl.setConfig(e)}},{key:"setAttributes",value:function(e){Kl.setAttributes(e)}}])})(),Wl=(Yl.setLogLevel(zl.LOG_LEVEL.TRACE),Yl.setLogReport(!0),Yl),$l={},Jl={},Xl={exports:{}},Ql=Xl.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s",t=(t+=null!=e.raddr?" raddr %s rport %d":"%v%v")+(null!=e.tcptype?" tcptype %s":"%v");return null!=e.generation&&(t+=" generation %d"),(t+=null!=e["network-id"]?" network-id %d":"%v")+(null!=e["network-cost"]?" network-cost %d":"%v")}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value)&&(t+=":%s"),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return(t=(t+=null!=e.id?"id=%s %s":"%v%s")+(null!=e.mediaClockValue?"=%s":"")+(null!=e.rateNumerator?" rate=%s":""))+(null!=e.rateDenominator?"/%s":"")}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]},Zl=(Object.keys(Ql).forEach(function(e){Ql[e].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})}),(e=>{function f(e){return String(Number(e))===e?Number(e):e}function t(e,t){var r=t.split(/=(.+)/,2);return 2===r.length?e[r[0]]=f(r[1]):1===r.length&&1<t.length&&(e[r[0]]=void 0),e}var m=Xl.exports,r=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},h=[],d=t;return e.split(/(\r\n|\r|\n)/).filter(r).forEach(function(e){var t=e[0],r=e.slice(2);"m"===t&&(h.push({rtp:[],fmtp:[]}),d=h[h.length-1]);for(var n=0;n<(m[t]||[]).length;n+=1){var o=m[t][n];if(o.reg.test(r)){var s=d;var i=r;var a=o.name&&o.names,a=(o.push&&!s[o.push]?s[o.push]=[]:a&&!s[o.name]&&(s[o.name]={}),o.push?{}:a?s[o.name]:s),u=i.match(o.reg),l=a,c=o.names;if((i=o.name)&&!c)l[i]=f(u[1]);else for(var p=0;p<c.length;p+=1)null!=u[p+1]&&(l[c[p]]=f(u[p+1]));o.push&&s[o.push].push(a);return}}}),t.media=h,t},e.parseParams=function(e){return e.split(/;\s?/).reduce(t,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var t=[],r=e.split(" ").map(f),n=0;n<r.length;n+=3)t.push({component:r[n],ip:r[n+1],port:r[n+2]});return t},e.parseImageAttributes=function(e){return e.split(" ").map(function(e){return e.substring(1,e.length-1).split(",").reduce(t,{})})},e.parseSimulcastStreamList=function(e){return e.split(";").map(function(e){return e.split(",").map(function(e){var t,r=!1;return"~"!==e[0]?t=f(e):(t=f(e.substring(1,e.length)),r=!0),{scid:t,paused:r}})})}})(Jl),Xl.exports),ec=/%[sdv%]/g,tc=function(e){var r=1,n=arguments,o=n.length;return e.replace(ec,function(e){if(o<=r)return e;var t=n[r];switch(r+=1,e){case"%%":return"%";case"%s":return String(t);case"%d":return Number(t);case"%v":return""}})},rc=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var o=0;o<t.names.length;o+=1){var s=t.names[o];n.push(t.name?r[t.name][s]:r[t.names[o]])}else n.push(r[t.name]);return tc.apply(null,n)},nc=["v","o","s","i","u","e","p","c","b","t","r","z","a"],oc=["i","c","b","a"],ic=Jl,sc=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach(function(e){null==e.payloads&&(e.payloads="")});var r=t.outerOrder||nc,n=t.innerOrder||oc,o=[];return r.forEach(function(r){Zl[r].forEach(function(t){t.name in e&&null!=e[t.name]?o.push(rc(r,t,e)):t.push in e&&null!=e[t.push]&&e[t.push].forEach(function(e){o.push(rc(r,t,e))})})}),e.media.forEach(function(e){o.push(rc("m",Zl.m[0],e)),n.forEach(function(r){Zl[r].forEach(function(t){t.name in e&&null!=e[t.name]?o.push(rc(r,t,e)):t.push in e&&null!=e[t.push]&&e[t.push].forEach(function(e){o.push(rc(r,t,e))})})})}),o.join("\r\n")+"\r\n"},ac=Xl.exports,uc=($l.grammar=ac,$l.write=sc,$l.parse=ic.parse,$l.parseParams=ic.parseParams,$l.parseFmtpConfig=ic.parseFmtpConfig,$l.parsePayloads=ic.parsePayloads,$l.parseRemoteCandidates=ic.parseRemoteCandidates,$l.parseImageAttributes=ic.parseImageAttributes,$l.parseSimulcastStreamList=ic.parseSimulcastStreamList,$l),lc=Wl,cc=s,pc=F(),dc=M(),hc=V(),fc=new lc("SIPMessage"),mc=(()=>{function i(e,t,r,n,o,s){if(l(this,i),!e||!t||!r)return null;n=n||{},this.ua=r,this.headers={},this.method=e,this.ruri=t,this.body=s,this.extraHeaders=pc.cloneArray(o),this.ua.configuration.extra_headers&&(this.extraHeaders=this.extraHeaders.concat(this.ua.configuration.extra_headers)),n.route_set?this.setHeader("route",n.route_set):r.configuration.use_preloaded_route&&this.setHeader("route","<".concat(r.transport.sip_uri,";lr>")),this.setHeader("via",""),this.setHeader("max-forwards",cc.MAX_FORWARDS);s=n.to_uri||t,o=n.to_tag?{tag:n.to_tag}:null,t=void 0!==n.to_display_name?n.to_display_name:null;this.to=new dc(s,t,o),this.setHeader("to",this.to.toString());s=n.from_uri||r.configuration.uri,t={tag:n.from_tag||pc.newTag()},o=void 0!==n.from_display_name?n.from_display_name:r.configuration.display_name||null,this.from=new dc(s,o,t),this.setHeader("from",this.from.toString()),s=n.call_id||r.configuration.jssip_id+pc.createRandomToken(15),this.call_id=s,this.setHeader("call-id",s),o=n.cseq||Math.floor(1e4*Math.random());this.cseq=o,this.setHeader("cseq","".concat(o," ").concat(e))}return p(i,[{key:"setHeader",value:function(e,t){for(var r=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),n=0;n<this.extraHeaders.length;n++)r.test(this.extraHeaders[n])&&this.extraHeaders.splice(n,1);this.headers[pc.headerize(e)]=Array.isArray(t)?t:[t]}},{key:"getHeader",value:function(e){var t=this.headers[pc.headerize(e)];if(t){if(t[0])return t[0]}else{var r,n=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),o=d(this.extraHeaders);try{for(o.s();!(r=o.n()).done;){var s=r.value;if(n.test(s))return s.substring(s.indexOf(":")+1).trim()}}catch(e){o.e(e)}finally{o.f()}}}},{key:"getHeaders",value:function(e){var t=this.headers[pc.headerize(e)],r=[];if(t){var n,o=d(t);try{for(o.s();!(n=o.n()).done;)r.push(n.value)}catch(e){o.e(e)}finally{o.f()}}else{var s,i=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),a=d(this.extraHeaders);try{for(a.s();!(s=a.n()).done;){var u=s.value;i.test(u)&&r.push(u.substring(u.indexOf(":")+1).trim())}}catch(e){a.e(e)}finally{a.f()}}return r}},{key:"hasHeader",value:function(e){if(this.headers[pc.headerize(e)])return!0;var t,r=new RegExp("^\\s*".concat(e,"\\s*:"),"i"),n=d(this.extraHeaders);try{for(n.s();!(t=n.n()).done;){var o=t.value;if(r.test(o))return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"parseSDP",value:function(e){return!e&&this.sdp||(this.sdp=uc.parse(this.body||"")),this.sdp}},{key:"toString",value:function(){var e,t="".concat(this.method," ").concat(this.ruri," SIP/2.0\r\n");for(e in this.headers)if(Object.prototype.hasOwnProperty.call(this.headers,e)){var r,n=d(this.headers[e]);try{for(n.s();!(r=n.n()).done;){var o=r.value;t+="".concat(e,": ").concat(o,"\r\n")}}catch(t){n.e(t)}finally{n.f()}}var s,i=d(this.extraHeaders);try{for(i.s();!(s=i.n()).done;){var a=s.value;t+="".concat(a.trim(),"\r\n")}}catch(t){i.e(t)}finally{i.f()}var u=[];switch(this.method){case cc.REGISTER:u.push("path","gruu");break;case cc.INVITE:this.ua.configuration.session_timers&&u.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&u.push("gruu"),u.push("ice","replaces");break;case cc.UPDATE:this.ua.configuration.session_timers&&u.push("timer"),u.push("ice")}u.push("outbound");var l=this.ua.configuration.user_agent||cc.USER_AGENT;return t=(t=(t+="Allow: ".concat(cc.ALLOWED_METHODS,"\r\n"))+"Supported: ".concat(u,"\r\n"))+"User-Agent: ".concat(l,"\r\n"),this.body?(l=pc.str_utf8_length(this.body),t=(t+="Content-Length: ".concat(l,"\r\n\r\n"))+this.body):t+="Content-Length: 0\r\n\r\n",t}},{key:"clone",value:function(){var t=new i(this.method,this.ruri,this.ua);return Object.keys(this.headers).forEach(function(e){t.headers[e]=this.headers[e].slice()},this),t.body=this.body,t.extraHeaders=pc.cloneArray(this.extraHeaders),t.to=this.to,t.from=this.from,t.call_id=this.call_id,t.cseq=this.cseq,t}}])})(),gc=(()=>{function s(e,t,r,n,o){return l(this,s),(e=u(this,s,[cc.INVITE,e,t,r,n,o])).transaction=null,e}return m(s,mc),p(s,[{key:"cancel",value:function(e){this.transaction.cancel(e)}},{key:"clone",value:function(){var t=new s(this.ruri,this.ua);return Object.keys(this.headers).forEach(function(e){t.headers[e]=this.headers[e].slice()},this),t.body=this.body,t.extraHeaders=pc.cloneArray(this.extraHeaders),t.to=this.to,t.from=this.from,t.call_id=this.call_id,t.cseq=this.cseq,t.transaction=this.transaction,t}}])})(),yc=p(function e(){l(this,e),this.data=null,this.headers=null,this.method=null,this.via=null,this.via_branch=null,this.call_id=null,this.cseq=null,this.from=null,this.from_tag=null,this.to=null,this.to_tag=null,this.body=null,this.sdp=null},[{key:"addHeader",value:function(e,t){t={raw:t};e=pc.headerize(e),this.headers[e]?this.headers[e].push(t):this.headers[e]=[t]}},{key:"getHeader",value:function(e){e=this.headers[pc.headerize(e)];return e&&e[0]?e[0].raw:void 0}},{key:"getHeaders",value:function(e){var t=this.headers[pc.headerize(e)],r=[];if(!t)return[];var n,o=d(t);try{for(o.s();!(n=o.n()).done;)r.push(n.value.raw)}catch(e){o.e(e)}finally{o.f()}return r}},{key:"hasHeader",value:function(e){return!!this.headers[pc.headerize(e)]}},{key:"parseHeader",value:function(e){var t,r,n,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;if(e=pc.headerize(e),this.headers[e]){if(!(o>=this.headers[e].length))return r=(t=this.headers[e][o]).raw,t.parsed||(-1===(n=hc.parse(r,e.replace(/-/g,"_")))?(this.headers[e].splice(o,1),void fc.debug('error parsing "'.concat(e,'" header field with value "').concat(r,'"'))):t.parsed=n);fc.debug('not so many "'.concat(e,'" headers present'))}else fc.debug('header "'.concat(e,'" not present'))}},{key:"s",value:function(e,t){return this.parseHeader(e,t)}},{key:"setHeader",value:function(e,t){t={raw:t};this.headers[pc.headerize(e)]=[t]}},{key:"parseSDP",value:function(e){return!e&&this.sdp||(this.sdp=uc.parse(this.body||"")),this.sdp}},{key:"toString",value:function(){return this.data}}]),_c=(()=>{function r(e){var t;return l(this,r),(t=u(this,r)).ua=e,t.headers={},t.ruri=null,t.transport=null,t.server_transaction=null,t}return m(r,yc),p(r,[{key:"reply",value:function(e,t,r,n,o,s){var i=[],a=this.getHeader("To");if(t=t||null,!(e=e||null)||e<100||699<e)throw new TypeError("Invalid status_code: ".concat(e));if(t&&"string"!=typeof t&&!(t instanceof String))throw new TypeError("Invalid reason_phrase: ".concat(t));t=t||cc.REASON_PHRASE[e]||"",r=pc.cloneArray(r),this.ua.configuration.extra_headers&&(r=r.concat(this.ua.configuration.extra_headers));var u="SIP/2.0 ".concat(e," ").concat(t,"\r\n");if(this.method===cc.INVITE&&100<e&&e<=200){var l,c=d(this.getHeaders("record-route"));try{for(c.s();!(l=c.n()).done;)u+="Record-Route: ".concat(l.value,"\r\n")}catch(e){c.e(e)}finally{c.f()}}var p,h=d(this.getHeaders("via"));try{for(h.s();!(p=h.n()).done;)u+="Via: ".concat(p.value,"\r\n")}catch(e){h.e(e)}finally{h.f()}!this.to_tag&&100<e?a+=";tag=".concat(pc.newTag()):this.to_tag&&!this.s("to").hasParam("tag")&&(a+=";tag=".concat(this.to_tag)),u=(u=(u=(u+="To: ".concat(a,"\r\n"))+"From: ".concat(this.getHeader("From"),"\r\n"))+"Call-ID: ".concat(this.call_id,"\r\n"))+"CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n");var f,m=d(r);try{for(m.s();!(f=m.n()).done;){var g=f.value;u+="".concat(g.trim(),"\r\n")}}catch(e){m.e(e)}finally{m.f()}switch(this.method){case cc.INVITE:this.ua.configuration.session_timers&&i.push("timer"),(this.ua.contact.pub_gruu||this.ua.contact.temp_gruu)&&i.push("gruu"),i.push("ice","replaces");break;case cc.UPDATE:this.ua.configuration.session_timers&&i.push("timer"),n&&i.push("ice"),i.push("replaces")}i.push("outbound"),this.method===cc.OPTIONS?u=(u+="Allow: ".concat(cc.ALLOWED_METHODS,"\r\n"))+"Accept: ".concat(cc.ACCEPTED_BODY_TYPES,"\r\n"):405===e?u+="Allow: ".concat(cc.ALLOWED_METHODS,"\r\n"):415===e&&(u+="Accept: ".concat(cc.ACCEPTED_BODY_TYPES,"\r\n")),u+="Supported: ".concat(i,"\r\n"),n?(t=pc.str_utf8_length(n),u=(u+="Content-Type: application/sdp\r\n")+"Content-Length: ".concat(t,"\r\n\r\n")+n):u+="Content-Length: ".concat(0,"\r\n\r\n"),this.server_transaction.receiveResponse(e,u,o,s)}},{key:"reply_sl",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,r=this.getHeaders("via");if(!e||e<100||699<e)throw new TypeError("Invalid status_code: ".concat(e));if(t&&"string"!=typeof t&&!(t instanceof String))throw new TypeError("Invalid reason_phrase: ".concat(t));var n,t=t||cc.REASON_PHRASE[e]||"",o="SIP/2.0 ".concat(e," ").concat(t,"\r\n"),s=d(r);try{for(s.s();!(n=s.n()).done;)o+="Via: ".concat(n.value,"\r\n")}catch(e){s.e(e)}finally{s.f()}t=this.getHeader("To");if(!this.to_tag&&100<e?t+=";tag=".concat(pc.newTag()):this.to_tag&&!this.s("to").hasParam("tag")&&(t+=";tag=".concat(this.to_tag)),o=(o=(o=(o+="To: ".concat(t,"\r\n"))+"From: ".concat(this.getHeader("From"),"\r\n"))+"Call-ID: ".concat(this.call_id,"\r\n"))+"CSeq: ".concat(this.cseq," ").concat(this.method,"\r\n"),this.ua.configuration.extra_headers){var i,a=d(this.ua.configuration.extra_headers);try{for(a.s();!(i=a.n()).done;){var u=i.value;o+="".concat(u.trim(),"\r\n")}}catch(e){a.e(e)}finally{a.f()}}o+="Content-Length: ".concat(0,"\r\n\r\n"),this.transport.send(o)}}])})(),vc={OutgoingRequest:mc,InitialOutgoingInviteRequest:gc,IncomingRequest:_c,IncomingResponse:(()=>{function t(){var e;return l(this,t),(e=u(this,t)).headers={},e.status_code=null,e.reason_phrase=null,e}return m(t,yc),p(t)})()},bc=Wl,Sc=F(),Tc=new bc("DigestAuthentication"),wc=p(function e(t){l(this,e),this._credentials=t,this._cnonce=null,this._nc=0,this._ncHex="00000000",this._algorithm=null,this._realm=null,this._nonce=null,this._opaque=null,this._stale=null,this._qop=null,this._method=null,this._uri=null,this._ha1=null,this._response=null},[{key:"get",value:function(e){switch(e){case"realm":return this._realm;case"ha1":return this._ha1;default:return void Tc.warn('get() | cannot get "%s" parameter',e)}}},{key:"authenticate",value:function(e,t){var r=e.method,n=e.ruri,e=e.body,o=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(this._algorithm=t.algorithm,this._realm=t.realm,this._nonce=t.nonce,this._opaque=t.opaque,this._stale=t.stale,this._algorithm){if("MD5"!==this._algorithm)return Tc.warn('authenticate() | challenge with Digest algorithm different than "MD5", authentication aborted'),!1}else this._algorithm="MD5";if(!this._nonce)return Tc.warn("authenticate() | challenge without Digest nonce, authentication aborted"),!1;if(!this._realm)return Tc.warn("authenticate() | challenge without Digest realm, authentication aborted"),!1;if(!this._credentials.password){if(!this._credentials.ha1)return Tc.warn("authenticate() | no plain SIP password nor ha1 provided, authentication aborted"),!1;if(this._credentials.realm!==this._realm)return Tc.warn('authenticate() | no plain SIP password, and stored `realm` does not match the given `realm`, cannot authenticate [stored:"%s", given:"%s"]',this._credentials.realm,this._realm),!1}if(t.qop)if(-1<t.qop.indexOf("auth-int"))this._qop="auth-int";else{if(!(-1<t.qop.indexOf("auth")))return Tc.warn('authenticate() | challenge without Digest qop different than "auth" or "auth-int", authentication aborted'),!1;this._qop="auth"}else this._qop=null;this._method=r,this._uri=n,this._cnonce=o||Sc.createRandomToken(12),this._nc+=1;var s,i,t=Number(this._nc).toString(16);return this._ncHex="00000000".substr(0,8-t.length)+t,4294967296===this._nc&&(this._nc=1,this._ncHex="00000001"),this._credentials.password?this._ha1=Sc.calculateMD5("".concat(this._credentials.username,":").concat(this._realm,":").concat(this._credentials.password)):this._ha1=this._credentials.ha1,"auth"===this._qop?(s="".concat(this._method,":").concat(this._uri),i=Sc.calculateMD5(s),Tc.debug('authenticate() | using qop=auth [a2:"%s"]',s),this._response=Sc.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth:").concat(i))):"auth-int"===this._qop?(s="".concat(this._method,":").concat(this._uri,":").concat(Sc.calculateMD5(e||"")),i=Sc.calculateMD5(s),Tc.debug('authenticate() | using qop=auth-int [a2:"%s"]',s),this._response=Sc.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(this._ncHex,":").concat(this._cnonce,":auth-int:").concat(i))):null===this._qop&&(s="".concat(this._method,":").concat(this._uri),i=Sc.calculateMD5(s),Tc.debug('authenticate() | using qop=null [a2:"%s"]',s),this._response=Sc.calculateMD5("".concat(this._ha1,":").concat(this._nonce,":").concat(i))),Tc.debug("authenticate() | response generated"),!0}},{key:"toString",value:function(){var e=[];if(this._response)return e.push("algorithm=".concat(this._algorithm)),e.push('username="'.concat(this._credentials.username,'"')),e.push('realm="'.concat(this._realm,'"')),e.push('nonce="'.concat(this._nonce,'"')),e.push('uri="'.concat(this._uri,'"')),e.push('response="'.concat(this._response,'"')),this._opaque&&e.push('opaque="'.concat(this._opaque,'"')),this._qop&&(e.push("qop=".concat(this._qop)),e.push('cnonce="'.concat(this._cnonce,'"')),e.push("nc=".concat(this._ncHex))),"Digest ".concat(e.join(", "));throw new Error("response field does not exist, cannot generate Authorization header")}}]),Ec=500,Ac={T1:Ec,T2:4e3,T4:5e3,TIMER_B:32e3,TIMER_D:0,TIMER_F:32e3,TIMER_H:32e3,TIMER_I:0,TIMER_J:0,TIMER_K:0,TIMER_L:32e3,TIMER_M:32e3,PROVISIONAL_RESPONSE_INTERVAL:6e4},Oc=$.EventEmitter,xc=Wl,Cc=s,Rc=vc,Nc=Ac,Ic=new xc("NonInviteClientTransaction"),Pc=new xc("InviteClientTransaction"),Uc=new xc("AckClientTransaction"),kc=new xc("NonInviteServerTransaction"),Lc=new xc("InviteServerTransaction"),jc={STATUS_TRYING:1,STATUS_PROCEEDING:2,STATUS_CALLING:3,STATUS_ACCEPTED:4,STATUS_COMPLETED:5,STATUS_TERMINATED:6,STATUS_CONFIRMED:7,NON_INVITE_CLIENT:"nict",NON_INVITE_SERVER:"nist",INVITE_CLIENT:"ict",INVITE_SERVER:"ist"},Dc=(()=>{function s(e,t,r,n){l(this,s),(o=u(this,s)).type=jc.NON_INVITE_CLIENT,o.id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.ua=e,o.transport=t,o.request=r,o.eventHandlers=n;var o,r="SIP/2.0/".concat(t.via_transport);return r+=" ".concat(e.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",r),o.ua.newTransaction(o),o}return m(s,Oc),p(s,[{key:"C",get:function(){return jc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"send",value:function(){var e=this;this.stateChanged(jc.STATUS_TRYING),this.F=setTimeout(function(){e.timer_F()},Nc.TIMER_F),this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){Ic.debug("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.F),clearTimeout(this.K),this.stateChanged(jc.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onTransportError()}},{key:"timer_F",value:function(){Ic.debug("Timer F expired for transaction ".concat(this.id)),this.stateChanged(jc.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onRequestTimeout()}},{key:"timer_K",value:function(){this.stateChanged(jc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"receiveResponse",value:function(e){var t=this,r=e.status_code;if(r<200)switch(this.state){case jc.STATUS_TRYING:case jc.STATUS_PROCEEDING:this.stateChanged(jc.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(e)}else switch(this.state){case jc.STATUS_TRYING:case jc.STATUS_PROCEEDING:this.stateChanged(jc.STATUS_COMPLETED),clearTimeout(this.F),408===r?this.eventHandlers.onRequestTimeout():this.eventHandlers.onReceiveResponse(e),this.K=setTimeout(function(){t.timer_K()},Nc.TIMER_K)}}}])})(),Mc=(()=>{function s(e,t,r,n){l(this,s),(o=u(this,s)).type=jc.INVITE_CLIENT,o.id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.ua=e,o.transport=t,o.request=r,o.eventHandlers=n,r.transaction=o;var o,n="SIP/2.0/".concat(t.via_transport);return n+=" ".concat(e.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",n),o.ua.newTransaction(o),o}return m(s,Oc),p(s,[{key:"C",get:function(){return jc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"send",value:function(){var e=this;this.stateChanged(jc.STATUS_CALLING),this.B=setTimeout(function(){e.timer_B()},Nc.TIMER_B),this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){clearTimeout(this.B),clearTimeout(this.D),clearTimeout(this.M),this.state!==jc.STATUS_ACCEPTED&&(Pc.debug("transport error occurred, deleting transaction ".concat(this.id)),this.eventHandlers.onTransportError()),this.stateChanged(jc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_M",value:function(){Pc.debug("Timer M expired for transaction ".concat(this.id)),this.state===jc.STATUS_ACCEPTED&&(clearTimeout(this.B),this.stateChanged(jc.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"timer_B",value:function(){Pc.debug("Timer B expired for transaction ".concat(this.id)),this.state===jc.STATUS_CALLING&&(this.stateChanged(jc.STATUS_TERMINATED),this.ua.destroyTransaction(this),this.eventHandlers.onRequestTimeout())}},{key:"timer_D",value:function(){Pc.debug("Timer D expired for transaction ".concat(this.id)),clearTimeout(this.B),this.stateChanged(jc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"sendACK",value:function(e){var t=this,r=new Rc.OutgoingRequest(Cc.ACK,this.request.ruri,this.ua,{route_set:this.request.getHeaders("route"),call_id:this.request.getHeader("call-id"),cseq:this.request.cseq});r.setHeader("from",this.request.getHeader("from")),r.setHeader("via",this.request.getHeader("via")),r.setHeader("to",e.getHeader("to")),this.D=setTimeout(function(){t.timer_D()},Nc.TIMER_D),this.transport.send(r)}},{key:"cancel",value:function(e){var t;this.state===jc.STATUS_PROCEEDING&&((t=new Rc.OutgoingRequest(Cc.CANCEL,this.request.ruri,this.ua,{route_set:this.request.getHeaders("route"),call_id:this.request.getHeader("call-id"),cseq:this.request.cseq})).setHeader("from",this.request.getHeader("from")),t.setHeader("via",this.request.getHeader("via")),t.setHeader("to",this.request.getHeader("to")),e&&t.setHeader("reason",e),this.transport.send(t))}},{key:"receiveResponse",value:function(e){var t=this,r=e.status_code;if(100<=r&&r<=199)switch(this.state){case jc.STATUS_CALLING:this.stateChanged(jc.STATUS_PROCEEDING),this.eventHandlers.onReceiveResponse(e);break;case jc.STATUS_PROCEEDING:this.eventHandlers.onReceiveResponse(e)}else if(200<=r&&r<=299)switch(this.state){case jc.STATUS_CALLING:case jc.STATUS_PROCEEDING:this.stateChanged(jc.STATUS_ACCEPTED),this.M=setTimeout(function(){t.timer_M()},Nc.TIMER_M),this.eventHandlers.onReceiveResponse(e);break;case jc.STATUS_ACCEPTED:this.eventHandlers.onReceiveResponse(e)}else if(300<=r&&r<=699)switch(this.state){case jc.STATUS_CALLING:case jc.STATUS_PROCEEDING:this.stateChanged(jc.STATUS_COMPLETED),this.sendACK(e),this.eventHandlers.onReceiveResponse(e);break;case jc.STATUS_COMPLETED:this.sendACK(e)}}}])})(),Vc=(()=>{function s(e,t,r,n){l(this,s),(o=u(this,s)).id="z9hG4bK".concat(Math.floor(1e7*Math.random())),o.transport=t,o.request=r,o.eventHandlers=n;var o,r="SIP/2.0/".concat(t.via_transport);return r+=" ".concat(e.configuration.via_host,";branch=").concat(o.id),o.request.setHeader("via",r),o}return m(s,Oc),p(s,[{key:"C",get:function(){return jc}},{key:"send",value:function(){this.transport.send(this.request)||this.onTransportError()}},{key:"onTransportError",value:function(){Uc.debug("transport error occurred for transaction ".concat(this.id)),this.eventHandlers.onTransportError()}}])})(),Bc=(()=>{function o(e,t,r){var n;return l(this,o),(n=u(this,o)).type=jc.NON_INVITE_SERVER,n.id=r.via_branch,n.ua=e,n.transport=t,n.request=r,n.last_response="",(r.server_transaction=n).state=jc.STATUS_TRYING,e.newTransaction(n),n}return m(o,Oc),p(o,[{key:"C",get:function(){return jc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_J",value:function(){kc.debug("Timer J expired for transaction ".concat(this.id)),this.stateChanged(jc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,kc.debug("transport error occurred, deleting transaction ".concat(this.id)),clearTimeout(this.J),this.stateChanged(jc.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"receiveResponse",value:function(e,t,r,n){var o=this;if(100===e)switch(this.state){case jc.STATUS_TRYING:this.stateChanged(jc.STATUS_PROCEEDING),this.transport.send(t)||this.onTransportError();break;case jc.STATUS_PROCEEDING:this.last_response=t,this.transport.send(t)?r&&r():(this.onTransportError(),n&&n())}else if(200<=e&&e<=699)switch(this.state){case jc.STATUS_TRYING:case jc.STATUS_PROCEEDING:this.stateChanged(jc.STATUS_COMPLETED),this.last_response=t,this.J=setTimeout(function(){o.timer_J()},Nc.TIMER_J),this.transport.send(t)?r&&r():(this.onTransportError(),n&&n())}}}])})(),Fc=(()=>{function o(e,t,r){var n;return l(this,o),(n=u(this,o)).type=jc.INVITE_SERVER,n.id=r.via_branch,n.ua=e,n.transport=t,n.request=r,n.last_response="",(r.server_transaction=n).state=jc.STATUS_PROCEEDING,e.newTransaction(n),n.resendProvisionalTimer=null,r.reply(100),n}return m(o,Oc),p(o,[{key:"C",get:function(){return jc}},{key:"stateChanged",value:function(e){this.state=e,this.emit("stateChanged")}},{key:"timer_H",value:function(){Lc.debug("Timer H expired for transaction ".concat(this.id)),this.state===jc.STATUS_COMPLETED&&Lc.debug("ACK not received, dialog will be terminated"),this.stateChanged(jc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_I",value:function(){this.stateChanged(jc.STATUS_TERMINATED),this.ua.destroyTransaction(this)}},{key:"timer_L",value:function(){Lc.debug("Timer L expired for transaction ".concat(this.id)),this.state===jc.STATUS_ACCEPTED&&(this.stateChanged(jc.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"onTransportError",value:function(){this.transportError||(this.transportError=!0,Lc.debug("transport error occurred, deleting transaction ".concat(this.id)),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),clearTimeout(this.L),clearTimeout(this.H),clearTimeout(this.I),this.stateChanged(jc.STATUS_TERMINATED),this.ua.destroyTransaction(this))}},{key:"resend_provisional",value:function(){this.transport.send(this.last_response)||this.onTransportError()}},{key:"receiveResponse",value:function(e,t,r,n){var o=this;if(100<=e&&e<=199&&this.state===jc.STATUS_PROCEEDING&&(this.transport.send(t)||this.onTransportError(),this.last_response=t),100<e&&e<=199&&this.state===jc.STATUS_PROCEEDING)null===this.resendProvisionalTimer&&(this.resendProvisionalTimer=setInterval(function(){o.resend_provisional()},Nc.PROVISIONAL_RESPONSE_INTERVAL));else if(200<=e&&e<=299)switch(this.state){case jc.STATUS_PROCEEDING:this.stateChanged(jc.STATUS_ACCEPTED),this.last_response=t,this.L=setTimeout(function(){o.timer_L()},Nc.TIMER_L),null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null);case jc.STATUS_ACCEPTED:this.transport.send(t)?r&&r():(this.onTransportError(),n&&n())}else 300<=e&&e<=699&&this.state===jc.STATUS_PROCEEDING&&(null!==this.resendProvisionalTimer&&(clearInterval(this.resendProvisionalTimer),this.resendProvisionalTimer=null),this.transport.send(t)?(this.stateChanged(jc.STATUS_COMPLETED),this.H=setTimeout(function(){o.timer_H()},Nc.TIMER_H),r&&r()):(this.onTransportError(),n&&n()))}}])})(),qc={C:jc,NonInviteClientTransaction:Dc,InviteClientTransaction:Mc,AckClientTransaction:Vc,NonInviteServerTransaction:Bc,InviteServerTransaction:Fc,checkTransaction:function(e,t){var r,n=e._transactions;switch(t.method){case Cc.INVITE:if(r=n.ist[t.via_branch])return r.state===jc.STATUS_PROCEEDING&&r.transport.send(r.last_response),!0;break;case Cc.ACK:if(!(r=n.ist[t.via_branch]))return!1;if(r.state===jc.STATUS_ACCEPTED)return!1;if(r.state===jc.STATUS_COMPLETED)return r.state=jc.STATUS_CONFIRMED,r.I=setTimeout(function(){r.timer_I()},Nc.TIMER_I),!0;break;case Cc.CANCEL:return(r=n.ist[t.via_branch])?(t.reply_sl(200),r.state!==jc.STATUS_PROCEEDING):(t.reply_sl(481),!0);default:if(r=n.nist[t.via_branch]){switch(r.state){case jc.STATUS_TRYING:break;case jc.STATUS_PROCEEDING:case jc.STATUS_COMPLETED:r.transport.send(r.last_response)}return!0}}}},Hc=s,Gc=wc,zc=qc,Kc=new Wl("RequestSender"),Yc={onRequestTimeout:function(){},onTransportError:function(){},onReceiveResponse:function(){},onAuthenticated:function(){}},Wc=p(function e(t,r,n){for(var o in l(this,e),this._ua=t,this._eventHandlers=n,this._method=r.method,this._request=r,this._auth=null,this._challenged=!1,this._staled=!1,Yc)!Object.prototype.hasOwnProperty.call(Yc,o)||this._eventHandlers[o]||(this._eventHandlers[o]=Yc[o]);t.status!==t.C.STATUS_USER_CLOSED||this._method===Hc.BYE&&this._method===Hc.ACK||this._eventHandlers.onTransportError()},[{key:"send",value:function(){var t=this,e={onRequestTimeout:function(){t._eventHandlers.onRequestTimeout()},onTransportError:function(){t._eventHandlers.onTransportError()},onReceiveResponse:function(e){t._receiveResponse(e)}};switch(this._method){case"INVITE":this.clientTransaction=new zc.InviteClientTransaction(this._ua,this._ua.transport,this._request,e);break;case"ACK":this.clientTransaction=new zc.AckClientTransaction(this._ua,this._ua.transport,this._request,e);break;default:this.clientTransaction=new zc.NonInviteClientTransaction(this._ua,this._ua.transport,this._request,e)}this._ua._configuration.authorization_jwt&&this._request.setHeader("Authorization",this._ua._configuration.authorization_jwt),this.clientTransaction.send()}},{key:"_receiveResponse",value:function(e){var t,r=e.status_code;401!==r&&407!==r||null===this._ua.configuration.password&&null===this._ua.configuration.ha1?this._eventHandlers.onReceiveResponse(e):(r=401===e.status_code?(t=e.parseHeader("www-authenticate"),"authorization"):(t=e.parseHeader("proxy-authenticate"),"proxy-authorization"),t?(!this._challenged||!this._staled&&!0===t.stale)&&(this._auth||(this._auth=new Gc({username:this._ua.configuration.authorization_user,password:this._ua.configuration.password,realm:this._ua.configuration.realm,ha1:this._ua.configuration.ha1})),this._auth.authenticate(this._request,t))?(this._challenged=!0,this._ua.set("realm",this._auth.get("realm")),this._ua.set("ha1",this._auth.get("ha1")),t.stale&&(this._staled=!0),this._request=this._request.clone(),this._request.cseq+=1,this._request.setHeader("cseq","".concat(this._request.cseq," ").concat(this._method)),this._request.setHeader(r,this._auth.toString()),this._eventHandlers.onAuthenticated(this._request),this.send()):this._eventHandlers.onReceiveResponse(e):(Kc.debug("".concat(e.status_code," with wrong or missing challenge, cannot authenticate")),this._eventHandlers.onReceiveResponse(e)))}}]),$c=Wl,Jc=F(),Xc=s,Qc=vc,Zc=Wc,ep=new $c("Registrator"),tp=p(function e(t,r){l(this,e),this._reg_id=1,this._ua=t,this._transport=r,this._registrar=t.configuration.registrar_server,this._expires=t.configuration.register_expires,this._call_id=Jc.createRandomToken(22),this._cseq=0,this._to_uri=t.configuration.uri,this._registrationTimer=null,this._registering=!1,this._registered=!1,this._contact=this._ua.contact.toString(),this._contact+=";+sip.ice",this._extraHeaders=[],this._extraContactParams="",this._sipInstance='"<urn:uuid:'.concat(this._ua.configuration.instance_id,'>"'),this._contact+=";reg-id=".concat(this._reg_id),this._contact+=";+sip.instance=".concat(this._sipInstance),this._ua.configuration.use_trtc&&(this._contact+=";trtc")},[{key:"registered",get:function(){return this._registered}},{key:"setExtraHeaders",value:function(e){Array.isArray(e)||(e=[]),this._extraHeaders=e.slice()}},{key:"setExtraContactParams",value:function(e){for(var t in e instanceof Object||(e={}),this._extraContactParams="",e){var r;Object.prototype.hasOwnProperty.call(e,t)&&(r=e[t],this._extraContactParams+=";".concat(t),r)&&(this._extraContactParams+="=".concat(r))}}},{key:"register",value:function(){var e,n=this;this._registering?ep.debug("Register request in progress..."):((e=this._extraHeaders.slice()).push("Contact: ".concat(this._contact,";expires=").concat(this._expires).concat(this._extraContactParams)),e.push("Expires: ".concat(this._expires)),this._ua.configuration.use_trtc&&e.push("X-TRTC: 1"),e=new Qc.OutgoingRequest(Xc.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},e),e=new Zc(this._ua,e,{onRequestTimeout:function(){n._registrationFailure(null,Xc.causes.REQUEST_TIMEOUT)},onTransportError:function(){n._registrationFailure(null,Xc.causes.CONNECTION_ERROR)},onAuthenticated:function(){n._cseq+=1},onReceiveResponse:function(e){if(e.cseq===n._cseq)switch(null!==n._registrationTimer&&(clearTimeout(n._registrationTimer),n._registrationTimer=null),!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):var t;(n._registering=!1,e.hasHeader("Contact"))?(t=(t=(r=e.headers.Contact.reduce(function(e,t){return e.concat(t.parsed)},[])).find(function(e){return n._sipInstance===e.getParam("+sip.instance")&&n._reg_id===parseInt(e.getParam("reg-id"))}))||r.find(function(e){return e.uri.user===n._ua.contact.uri.user}))?(r=(r=!(r=t.getParam("expires"))&&e.hasHeader("expires")?e.getHeader("expires"):r)||n._expires,r=64<(r=(r=Number(r))<10?10:r)?1e3*r/2+Math.floor(1e3*(r/2-32)*Math.random()):1e3*r-5e3,n._registrationTimer=setTimeout(function(){n._registrationTimer=null,0===n._ua.listeners("registrationExpiring").length?n.register():n._ua.emit("registrationExpiring")},r),t.hasParam("temp-gruu")&&(n._ua.contact.temp_gruu=t.getParam("temp-gruu").replace(/"/g,"")),t.hasParam("pub-gruu")&&(n._ua.contact.pub_gruu=t.getParam("pub-gruu").replace(/"/g,"")),n._registered||(n._registered=!0,n._ua.registered({response:e}))):ep.debug("no Contact header pointing to us, response ignored"):ep.debug("no Contact header in response to REGISTER, response ignored");break;case/^423$/.test(e.status_code):e.hasHeader("min-expires")?(n._expires=Number(e.getHeader("min-expires")),n._expires<10&&(n._expires=10),n.register()):(ep.debug("423 response received for REGISTER without Min-Expires"),n._registrationFailure(e,Xc.causes.SIP_FAILURE_CODE));break;default:var r=Jc.sipErrorCause(e.status_code);n._registrationFailure(e,r)}}}),this._registering=!0,e.send())}},{key:"unregister",value:function(){var e,r=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this._registered?(this._registered=!1,null!==this._registrationTimer&&(clearTimeout(this._registrationTimer),this._registrationTimer=null),e=this._extraHeaders.slice(),t.all?e.push("Contact: *".concat(this._extraContactParams)):e.push("Contact: ".concat(this._contact,";expires=0").concat(this._extraContactParams)),e.push("Expires: 0"),t=new Qc.OutgoingRequest(Xc.REGISTER,this._registrar,this._ua,{to_uri:this._to_uri,call_id:this._call_id,cseq:this._cseq+=1},e),new Zc(this._ua,t,{onRequestTimeout:function(){r._unregistered(null,Xc.causes.REQUEST_TIMEOUT)},onTransportError:function(){r._unregistered(null,Xc.causes.CONNECTION_ERROR)},onAuthenticated:function(){r._cseq+=1},onReceiveResponse:function(e){switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):r._unregistered(e);break;default:var t=Jc.sipErrorCause(e.status_code);r._unregistered(e,t)}}}).send()):ep.debug("already unregistered")}},{key:"close",value:function(){this._registered&&this.unregister()}},{key:"onTransportClosed",value:function(){this._registering=!1,null!==this._registrationTimer&&(clearTimeout(this._registrationTimer),this._registrationTimer=null),this._registered&&(this._registered=!1,this._ua.unregistered({}))}},{key:"_registrationFailure",value:function(e,t){this._registering=!1,this._ua.registrationFailed({response:e||null,cause:t}),this._registered&&(this._registered=!1,this._ua.unregistered({response:e||null,cause:t}))}},{key:"_unregistered",value:function(e,t){this._registering=!1,this._registered=!1,this._ua.unregistered({response:e||null,cause:t||null})}}]),rp=n(yo),np=s,op=qc,ip=Wc,sp={onRequestTimeout:function(){},onTransportError:function(){},onSuccessResponse:function(){},onErrorResponse:function(){},onAuthenticated:function(){},onDialogError:function(){}},ap=Wl,up=vc,lp=s,cp=qc,pp=p(function e(t,r,n){for(var o in l(this,e),this._dialog=t,this._ua=t._ua,this._request=r,this._eventHandlers=n,this._reattempt=!1,this._reattemptTimer=null,sp)!Object.prototype.hasOwnProperty.call(sp,o)||this._eventHandlers[o]||(this._eventHandlers[o]=sp[o])},[{key:"request",get:function(){return this._request}},{key:"send",value:function(){var e,t=this,r=new ip(this._ua,this._request,{onRequestTimeout:function(){t._eventHandlers.onRequestTimeout()},onTransportError:function(){t._eventHandlers.onTransportError()},onAuthenticated:function(e){t._eventHandlers.onAuthenticated(e)},onReceiveResponse:function(e){t._receiveResponse(e)}});r.send(),(this._request.method===np.INVITE||this._request.method===np.UPDATE&&this._request.body)&&r.clientTransaction.state!==op.C.STATUS_TERMINATED&&(this._dialog.uac_pending_reply=!0,e=function(){r.clientTransaction.state!==op.C.STATUS_ACCEPTED&&r.clientTransaction.state!==op.C.STATUS_COMPLETED&&r.clientTransaction.state!==op.C.STATUS_TERMINATED||(r.clientTransaction.removeListener("stateChanged",e),t._dialog.uac_pending_reply=!1)},r.clientTransaction.on("stateChanged",e))}},{key:"_receiveResponse",value:function(e){var t=this;408===e.status_code||481===e.status_code?this._eventHandlers.onDialogError(e):e.method!==np.INVITE||491!==e.status_code||this._reattempt?200<=e.status_code&&e.status_code<300?this._eventHandlers.onSuccessResponse(e):300<=e.status_code&&this._eventHandlers.onErrorResponse(e):(this._request.cseq=this._dialog.local_seqnum+=1,this._reattemptTimer=setTimeout(function(){t._dialog.isTerminated()||(t._reattempt=!0,t.send())},1e3))}}]),dp=F(),hp=new ap("Dialog"),fp={STATUS_EARLY:1,STATUS_CONFIRMED:2,STATUS_TERMINATED:3},mp=p(function e(t,r,n){var o=3<arguments.length&&void 0!==arguments[3]?arguments[3]:fp.STATUS_CONFIRMED;if(l(this,e),this._owner=t,this._ua=t._ua,this._uac_pending_reply=!1,this._uas_pending_reply=!1,!r.hasHeader("contact"))return{error:"unable to create a Dialog without Contact header field"};r instanceof up.IncomingResponse&&(o=r.status_code<200?fp.STATUS_EARLY:fp.STATUS_CONFIRMED);t=r.parseHeader("contact");"UAS"===n?(this._id={call_id:r.call_id,local_tag:r.to_tag,remote_tag:r.from_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=o,this._remote_seqnum=r.cseq,this._local_uri=r.parseHeader("to").uri,this._remote_uri=r.parseHeader("from").uri,this._remote_target=t.uri,this._route_set=r.getHeaders("record-route"),this._ack_seqnum=this._remote_seqnum):"UAC"===n&&(this._id={call_id:r.call_id,local_tag:r.from_tag,remote_tag:r.to_tag,toString:function(){return this.call_id+this.local_tag+this.remote_tag}},this._state=o,this._local_seqnum=r.cseq,this._local_uri=r.parseHeader("from").uri,this._remote_uri=r.parseHeader("to").uri,this._remote_target=t.uri,this._route_set=r.getHeaders("record-route").reverse(),this._ack_seqnum=null),this._ua.newDialog(this),hp.debug("new ".concat(n," dialog created with status ").concat(this._state===fp.STATUS_EARLY?"EARLY":"CONFIRMED"))},[{key:"id",get:function(){return this._id}},{key:"local_seqnum",get:function(){return this._local_seqnum},set:function(e){this._local_seqnum=e}},{key:"owner",get:function(){return this._owner}},{key:"uac_pending_reply",get:function(){return this._uac_pending_reply},set:function(e){this._uac_pending_reply=e}},{key:"uas_pending_reply",get:function(){return this._uas_pending_reply}},{key:"isTerminated",value:function(){return this._status===fp.STATUS_TERMINATED}},{key:"update",value:function(e,t){this._state=fp.STATUS_CONFIRMED,hp.debug("dialog ".concat(this._id.toString()," changed to CONFIRMED state")),"UAC"===t&&(this._route_set=e.getHeaders("record-route").reverse())}},{key:"terminate",value:function(){hp.debug("dialog ".concat(this._id.toString()," deleted")),this._ua.destroyDialog(this),this._state=fp.STATUS_TERMINATED}},{key:"sendRequest",value:function(e){var t=this,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=dp.cloneArray(r.extraHeaders),o=dp.cloneObject(r.eventHandlers),r=r.body||null,e=this._createRequest(e,n,r);return o.onAuthenticated=function(){t._local_seqnum+=1},new pp(this,e,o).send(),e}},{key:"receiveRequest",value:function(e){this._checkInDialogRequest(e)&&(e.method===lp.ACK&&null!==this._ack_seqnum?this._ack_seqnum=null:e.method===lp.INVITE&&(this._ack_seqnum=e.cseq),this._owner.receiveRequest(e))}},{key:"_createRequest",value:function(e,t,r){t=dp.cloneArray(t),this._local_seqnum||(this._local_seqnum=Math.floor(1e4*Math.random()));var n=e===lp.CANCEL||e===lp.ACK?this._local_seqnum:this._local_seqnum+=1;return new up.OutgoingRequest(e,this._remote_target,this._ua,{cseq:n,call_id:this._id.call_id,from_uri:this._local_uri,from_tag:this._id.local_tag,to_uri:this._remote_uri,to_tag:this._id.remote_tag,route_set:this._route_set},t,r)}},{key:"_checkInDialogRequest",value:function(e){var t,r=this;if(this._remote_seqnum)if(e.cseq<this._remote_seqnum){if(e.method!==lp.ACK)return e.reply(500),!1;if(null===this._ack_seqnum||e.cseq!==this._ack_seqnum)return!1}else e.cseq>this._remote_seqnum&&(this._remote_seqnum=e.cseq);else this._remote_seqnum=e.cseq;if(e.method===lp.INVITE||e.method===lp.UPDATE&&e.body){if(!0===this._uac_pending_reply)e.reply(491);else{if(!0===this._uas_pending_reply)return t=1+(10*Math.random()|0),e.reply(500,null,["Retry-After:".concat(t)]),!1;this._uas_pending_reply=!0;var n=function(){e.server_transaction.state!==cp.C.STATUS_ACCEPTED&&e.server_transaction.state!==cp.C.STATUS_COMPLETED&&e.server_transaction.state!==cp.C.STATUS_TERMINATED||(e.server_transaction.removeListener("stateChanged",n),r._uas_pending_reply=!1)};e.server_transaction.on("stateChanged",n)}e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){e.server_transaction.state===cp.C.STATUS_ACCEPTED&&(r._remote_target=e.parseHeader("contact").uri)})}else e.method===lp.NOTIFY&&e.hasHeader("contact")&&e.server_transaction.on("stateChanged",function(){e.server_transaction.state===cp.C.STATUS_COMPLETED&&(r._remote_target=e.parseHeader("contact").uri)});return!0}}],[{key:"C",get:function(){return fp}}]),gp={exports:{}},yp=$.EventEmitter,_p=Wl,vp=s,bp=j,Sp=F(),Tp=new _p("RTCSession:DTMF"),wp={MIN_DURATION:70,MAX_DURATION:6e3,DEFAULT_DURATION:100,MIN_INTER_TONE_GAP:50,DEFAULT_INTER_TONE_GAP:500},Ep=(gp.exports=(()=>{function r(e){var t;return l(this,r),(t=u(this,r))._session=e,t._direction=null,t._tone=null,t._duration=null,t._request=null,t}return m(r,yp),p(r,[{key:"tone",get:function(){return this._tone}},{key:"duration",get:function(){return this._duration}},{key:"send",value:function(e){var t=this,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(void 0===e)throw new TypeError("Not enough arguments");if(this._direction="outgoing",this._session.status!==this._session.C.STATUS_CONFIRMED&&this._session.status!==this._session.C.STATUS_WAITING_FOR_ACK)throw new bp.InvalidStateError(this._session.status);var n=Sp.cloneArray(r.extraHeaders);if(this.eventHandlers=Sp.cloneObject(r.eventHandlers),"string"==typeof e)e=e.toUpperCase();else{if("number"!=typeof e)throw new TypeError("Invalid tone: ".concat(e));e=e.toString()}if(!e.match(/^[0-9A-DR#*]$/))throw new TypeError("Invalid tone: ".concat(e));this._tone=e,this._duration=r.duration,n.push("Content-Type: application/dtmf-relay");e="Signal=".concat(this._tone,"\r\n");e+="Duration=".concat(this._duration),this._session.newDTMF({originator:"local",dtmf:this,request:this._request}),this._session.sendRequest(vp.INFO,{extraHeaders:n,eventHandlers:{onSuccessResponse:function(e){t.emit("succeeded",{originator:"remote",response:e})},onErrorResponse:function(e){t.eventHandlers.onFailed&&t.eventHandlers.onFailed(),t.emit("failed",{originator:"remote",response:e})},onRequestTimeout:function(){t._session.onRequestTimeout()},onTransportError:function(){t._session.onTransportError()},onDialogError:function(){t._session.onDialogError()}},body:e})}},{key:"init_incoming",value:function(e){var t,r=/^(Signal\s*?=\s*?)([0-9A-D#*]{1})(\s)?.*/,n=/^(Duration\s?=\s?)([0-9]{1,4})(\s)?.*/;this._direction="incoming",(this._request=e).reply(200),e.body&&(1<=(t=e.body.split("\n")).length&&r.test(t[0])&&(this._tone=t[0].replace(r,"$2")),2<=t.length)&&n.test(t[1])&&(this._duration=parseInt(t[1].replace(n,"$2"),10)),this._duration||(this._duration=wp.DEFAULT_DURATION),this._tone?this._session.newDTMF({originator:"remote",dtmf:this,request:e}):Tp.debug("invalid INFO DTMF received, discarded")}}])})(),gp.exports.C=wp,$.EventEmitter),Ap=s,Op=j,xp=F(),Cp=(()=>{function r(e){var t;return l(this,r),(t=u(this,r))._session=e,t._direction=null,t._contentType=null,t._body=null,t}return m(r,Ep),p(r,[{key:"contentType",get:function(){return this._contentType}},{key:"body",get:function(){return this._body}},{key:"send",value:function(e,t){var r=this,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(this._direction="outgoing",void 0===e)throw new TypeError("Not enough arguments");if(this._session.status!==this._session.C.STATUS_CONFIRMED&&this._session.status!==this._session.C.STATUS_WAITING_FOR_ACK)throw new Op.InvalidStateError(this._session.status);this._contentType=e,this._body=t;n=xp.cloneArray(n.extraHeaders);n.push("Content-Type: ".concat(e)),this._session.newInfo({originator:"local",info:this,request:this.request}),this._session.sendRequest(Ap.INFO,{extraHeaders:n,eventHandlers:{onSuccessResponse:function(e){r.emit("succeeded",{originator:"remote",response:e})},onErrorResponse:function(e){r.emit("failed",{originator:"remote",response:e})},onTransportError:function(){r._session.onTransportError()},onRequestTimeout:function(){r._session.onRequestTimeout()},onDialogError:function(){r._session.onDialogError()}},body:t})}},{key:"init_incoming",value:function(e){this._direction="incoming",(this.request=e).reply(200),this._contentType=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0,this._body=e.body,this._session.newInfo({originator:"remote",info:this,request:e})}}])})(),Rp=s,Np=new Wl("RTCSession:ReferNotifier"),Ip="refer",Pp="message/sipfrag;version=2.0",Up=300,kp=p(function e(t,r,n){l(this,e),this._session=t,this._id=r,this._expires=n||Up,this._active=!0,this.notify(100)},[{key:"notify",value:function(e,t){var r;Np.debug("notify()"),!1!==this._active&&(t=t||Rp.REASON_PHRASE[e]||"",r=200<=e?"terminated;reason=noresource":"active;expires=".concat(this._expires),this._session.sendRequest(Rp.NOTIFY,{extraHeaders:["Event: ".concat(Ip,";id=").concat(this._id),"Subscription-State: ".concat(r),"Content-Type: ".concat(Pp)],body:"SIP/2.0 ".concat(e," ").concat(t),eventHandlers:{onErrorResponse:function(){this._active=!1}}}))}}]),Lp=$.EventEmitter,jp=Wl,Dp=s,Mp=V(),Vp=F(),Bp=new jp("RTCSession:ReferSubscriber"),Fp=(()=>{function r(e){var t;return l(this,r),(t=u(this,r))._id=null,t._session=e,t}return m(r,Lp),p(r,[{key:"id",get:function(){return this._id}},{key:"sendRefer",value:function(e){var t,r=this,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},o=(Bp.debug("sendRefer()"),Vp.cloneArray(n.extraHeaders)),s=Vp.cloneObject(n.eventHandlers);for(t in s)Object.prototype.hasOwnProperty.call(s,t)&&this.on(t,s[t]);var i=null,n=(n.replaces&&(i=n.replaces._request.call_id,i=(i+=";to-tag=".concat(n.replaces._to_tag))+";from-tag=".concat(n.replaces._from_tag),i=encodeURIComponent(i)),"Refer-To: <".concat(e).concat(i?"?Replaces=".concat(i):"",">")),i=(o.push(n),o.some(function(e){return e.toLowerCase().startsWith("referred-by:")})||(e="Referred-By: <".concat(this._session._ua._configuration.uri._scheme,":").concat(this._session._ua._configuration.uri._user,"@").concat(this._session._ua._configuration.uri._host,">"),o.push(e)),o.push("Contact: ".concat(this._session.contact)),this._session.sendRequest(Dp.REFER,{extraHeaders:o,eventHandlers:{onSuccessResponse:function(e){r._requestSucceeded(e)},onErrorResponse:function(e){r._requestFailed(e,Dp.causes.REJECTED)},onTransportError:function(){r._requestFailed(null,Dp.causes.CONNECTION_ERROR)},onRequestTimeout:function(){r._requestFailed(null,Dp.causes.REQUEST_TIMEOUT)},onDialogError:function(){r._requestFailed(null,Dp.causes.DIALOG_ERROR)}}}));this._id=i.cseq}},{key:"receiveNotify",value:function(e){if(Bp.debug("receiveNotify()"),e.body){var t=Mp.parse(e.body.trim().split("\r\n",1)[0],"Status_Line");if(-1!==t)switch(!0){case/^100$/.test(t.status_code):this.emit("trying",{request:e,status_line:t});break;case/^1[0-9]{2}$/.test(t.status_code):this.emit("progress",{request:e,status_line:t});break;case/^2[0-9]{2}$/.test(t.status_code):this.emit("accepted",{request:e,status_line:t});break;default:this.emit("failed",{request:e,status_line:t})}else Bp.debug('receiveNotify() | error parsing NOTIFY body: "'.concat(e.body,'"'))}}},{key:"_requestSucceeded",value:function(e){Bp.debug("REFER succeeded"),Bp.debug('emit "requestSucceeded"'),this.emit("requestSucceeded",{response:e})}},{key:"_requestFailed",value:function(e,t){Bp.debug("REFER failed"),Bp.debug('emit "requestFailed"'),this.emit("requestFailed",{response:e||null,cause:t})}}])})(),qp=$.EventEmitter,Hp=(()=>{function r(e){var t;return l(this,r),(t=u(this,r)).audio=e.audio,t.video=e.video,t._mediaStream=e.mediaStream,t._player=null,t}return m(r,qp),p(r,[{key:"mediaStream",get:function(){return this._mediaStream}},{key:"getMediaStream",value:function(){return this._mediaStream}},{key:"getAudioTrack",value:function(){if(this._mediaStream){var e=this._mediaStream.getAudioTracks();if(0<e.length)return e[0]}return null}},{key:"play",value:function(){}}])})(),Gp=Hp,zp=F(),Kp=(()=>{function t(e){return l(this,t),(e=u(this,t,[e])).type="local",e}return m(t,Gp),p(t,[{key:"initialize",value:function(){var t=this;return navigator.mediaDevices.getUserMedia({audio:this.audio,video:this.video}).then(function(e){return t._mediaStream=e,t}).catch(function(e){throw e})}},{key:"close",value:function(){this._mediaStream&&zp.closeMediaStream(this._mediaStream)}}])})(),Yp=Hp,Wp=(()=>{function r(e){var t;return l(this,r),(t=u(this,r,[e]))._mediaStream=e.mediaStream,t.type="remote",t}return m(r,Yp),p(r)})(),$p="object"===("undefined"==typeof globalThis?"undefined":T(globalThis))?globalThis:"object"===("undefined"==typeof self?"undefined":T(self))?self:"object"===("undefined"==typeof window?"undefined":T(window))?window:"object"===T(r)?r:{},Jp={},Xp=Object.freeze({__proto__:null,OTLPTraceExporter:class extends nr{constructor(e={}){super(Ma(e,Ta,"v1/traces",{"Content-Type":"application/json"}))}}}),Qp=n(Xp);class Zp{_spanContext;kind;parentSpanContext;attributes={};links=[];events=[];startTime;resource;instrumentationScope;_droppedAttributesCount=0;_droppedEventsCount=0;_droppedLinksCount=0;_attributesCount=0;name;status={code:Bn.UNSET};endTime=[0,0];_ended=!1;_duration=[-1,-1];_spanProcessor;_spanLimits;_attributeValueLengthLimit;_recordEndMetrics;_performanceStartTime;_performanceOffset;_startTimeProvided;constructor(t){let e=Date.now();if(this._spanContext=t.spanContext,this._performanceStartTime=bu.now(),this._performanceOffset=e-(this._performanceStartTime+bu.timeOrigin),this._startTimeProvided=null!=t.startTime,this._spanLimits=t.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=t.spanProcessor,this.name=t.name,this.parentSpanContext=t.parentSpanContext,this.kind=t.kind,t.links)for(let e of t.links)this.addLink(e);this.startTime=this._getTime(t.startTime??e),this.resource=t.resource,this.instrumentationScope=t.scope,this._recordEndMetrics=t.recordEndMetrics,null!=t.attributes&&this.setAttributes(t.attributes),this._spanProcessor.onStart(this,t.context)}spanContext(){return this._spanContext}setAttribute(e,t){var r,n;return null==t||this._isSpanEnded()||(0===e.length?Xn.warn("Invalid attribute key: "+e):fu(t)?(r=this._spanLimits.attributeCountLimit,n=!Object.prototype.hasOwnProperty.call(this.attributes,e),void 0!==r&&this._attributesCount>=r&&n?this._droppedAttributesCount++:(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++)):Xn.warn("Invalid attribute value set for key: "+e)),this}setAttributes(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,o){if(!this._isSpanEnded()){var s=this._spanLimits.eventCountLimit;if(0===s)Xn.warn("No events allowed."),this._droppedEventsCount++;else{void 0!==s&&this.events.length>=s&&(0===this._droppedEventsCount&&Xn.debug("Dropping extra events."),this.events.shift(),this._droppedEventsCount++),Ru(t)&&(Ru(o)||(o=t),t=void 0);var i=du(t),a=this._spanLimits.attributePerEventCountLimit,u={};let r=0,n=0;for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)){let e=i[t];void 0!==a&&n>=a?r++:(u[t]=this._truncateToSize(e),n++)}this.events.push({name:e,attributes:u,time:this._getTime(o),droppedAttributesCount:r})}}return this}addLink(t){if(!this._isSpanEnded()){let e=this._spanLimits.linkCountLimit;if(0===e)this._droppedLinksCount++;else{void 0!==e&&this.links.length>=e&&(0===this._droppedLinksCount&&Xn.debug("Dropping extra links."),this.links.shift(),this._droppedLinksCount++);var o=this._spanLimits.attributePerLinkCountLimit,s=du(t.attributes),i={};let r=0,n=0;for(let t in s)if(Object.prototype.hasOwnProperty.call(s,t)){let e=s[t];void 0!==o&&n>=o?r++:(i[t]=this._truncateToSize(e),n++)}t={context:t.context};0<n&&(t.attributes=i),0<r&&(t.droppedAttributesCount=r),this.links.push(t)}}return this}addLinks(e){for(var t of e)this.addLink(t);return this}setStatus(e){var t;return this._isSpanEnded()||e.code!==Bn.UNSET&&this.status.code!==Bn.OK&&(t={code:e.code},e.code===Bn.ERROR&&("string"==typeof e.message?t.message=e.message:null!=e.message&&Xn.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t),this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){this._isSpanEnded()?Xn.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`):(this.endTime=this._getTime(e),this._duration=((e,t)=>{let r=t[0]-e[0],n=t[1]-e[1];return n<0&&(--r,n+=Tu),[r,n]})(this.startTime,this.endTime),this._duration[0]<0&&(Xn.warn("Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.",this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),0<this._droppedEventsCount&&Xn.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),0<this._droppedLinksCount&&Xn.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this))}_getTime(e){return"number"==typeof e&&e<=bu.now()?Eu(e+this._performanceOffset):"number"==typeof e?wu(e):e instanceof Date?wu(e.getTime()):Cu(e)?e:this._startTimeProvided?wu(Date.now()):(e=bu.now()-this._performanceStartTime,Nu(this.startTime,wu(e)))}isRecording(){return!1===this._ended}recordException(e,t){var r={};"string"==typeof e?r[Eo]=e:e&&(e.code?r[Ao]=e.code.toString():e.name&&(r[Ao]=e.name),e.message&&(r[Eo]=e.message),e.stack)&&(r["exception.stacktrace"]=e.stack),r[Ao]||r[Eo]?this.addEvent("exception",r,t):Xn.warn("Failed to record an exception "+e)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){var e;return this._ended&&(e=new Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`),Xn.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)),this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(Xn.warn("Attribute value limit must be positive, got "+t),e):"string"==typeof e?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>"string"==typeof e?this._truncateToLimitUtil(e,t):e):e}}(e=>{e[e.NOT_RECORD=0]="NOT_RECORD",e[e.RECORD=1]="RECORD",e[e.RECORD_AND_SAMPLED=2]="RECORD_AND_SAMPLED"})(ed=ed||{});class rd{shouldSample(){return{decision:ed.NOT_RECORD}}toString(){return"AlwaysOffSampler"}}class nd{shouldSample(){return{decision:ed.RECORD_AND_SAMPLED}}toString(){return"AlwaysOnSampler"}}class od{_root;_remoteParentSampled;_remoteParentNotSampled;_localParentSampled;_localParentNotSampled;constructor(e){this._root=e.root,this._root||(yu(new Error("ParentBasedSampler must have a root sampler configured")),this._root=new nd),this._remoteParentSampled=e.remoteParentSampled??new nd,this._remoteParentNotSampled=e.remoteParentNotSampled??new rd,this._localParentSampled=e.localParentSampled??new nd,this._localParentNotSampled=e.localParentNotSampled??new rd}shouldSample(e,t,r,n,o,s){var i=mo.getSpanContext(e);return(i&&kn(i)?i.isRemote?i.traceFlags&un.SAMPLED?this._remoteParentSampled:this._remoteParentNotSampled:i.traceFlags&un.SAMPLED?this._localParentSampled:this._localParentNotSampled:this._root).shouldSample(e,t,r,n,o,s)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}}class id{_ratio;_upperBound;constructor(e=0){this._ratio=this._normalize(e),this._upperBound=Math.floor(4294967295*this._ratio)}shouldSample(e,t){return{decision:Pn(t)&&this._accumulate(t)<this._upperBound?ed.RECORD_AND_SAMPLED:ed.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return"number"!=typeof e||isNaN(e)?0:1<=e?1:e<=0?0:e}_accumulate(n){let e=0;for(let r=0;r<32;r+=8){let t=0;for(let e=0;e<8;e++){var o=n.charCodeAt(r+e);t=t<<4|(o<58?o-48:o<71?o-55:o-87)}e=(e^t)>>>0}return e}}function sd(){return{sampler:ad(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128},spanLimits:{attributeValueLengthLimit:1/0,attributeCountLimit:128,linkCountLimit:128,eventCountLimit:128,attributePerEventCountLimit:128,attributePerLinkCountLimit:128}}}function ad(){var e=td.ParentBasedAlwaysOn;switch(e){case td.AlwaysOn:return new nd;case td.AlwaysOff:return new rd;case td.ParentBasedAlwaysOn:return new od({root:new nd});case td.ParentBasedAlwaysOff:return new od({root:new rd});case td.TraceIdRatio:return new id(ud());case td.ParentBasedTraceIdRatio:return new od({root:new id(ud())});default:return Xn.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${td.ParentBasedAlwaysOn}".`),new od({root:new nd})}}function ud(){return Xn.error("OTEL_TRACES_SAMPLER_ARG is blank, defaulting to 1."),1}(e=>{e.AlwaysOff="always_off",e.AlwaysOn="always_on",e.ParentBasedAlwaysOff="parentbased_always_off",e.ParentBasedAlwaysOn="parentbased_always_on",e.ParentBasedTraceIdRatio="parentbased_traceidratio",e.TraceIdRatio="traceidratio"})(td=td||{});let ld=1/0;class cd{_maxExportBatchSize;_maxQueueSize;_scheduledDelayMillis;_exportTimeoutMillis;_exporter;_isExporting=!1;_finishedSpans=[];_timer;_shutdownOnce;_droppedSpansCount=0;constructor(e,t){this._exporter=e,this._maxExportBatchSize="number"==typeof t?.maxExportBatchSize?t.maxExportBatchSize:512,this._maxQueueSize="number"==typeof t?.maxQueueSize?t.maxQueueSize:2048,this._scheduledDelayMillis="number"==typeof t?.scheduledDelayMillis?t.scheduledDelayMillis:5e3,this._exportTimeoutMillis="number"==typeof t?.exportTimeoutMillis?t.exportTimeoutMillis:3e4,this._shutdownOnce=new ll(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(Xn.warn("BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||0!=(e.spanContext().traceFlags&un.SAMPLED)&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>this._exporter.shutdown())}_addToBuffer(e){this._finishedSpans.length>=this._maxQueueSize?(0===this._droppedSpansCount&&Xn.debug("maxQueueSize reached, dropping spans"),this._droppedSpansCount++):(0<this._droppedSpansCount&&(Xn.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer())}_flushAll(){return new Promise((e,t)=>{var r=[];for(let e=0,t=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);e<t;e++)r.push(this._flushOneBatch());Promise.all(r).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),0===this._finishedSpans.length?Promise.resolve():new Promise((t,o)=>{let s=setTimeout(()=>{o(new Error("Timeout"))},this._exportTimeoutMillis);Jn.with(uu(Jn.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);var e=()=>this._exporter.export(r,e=>{clearTimeout(s),e.code===Iu.SUCCESS?t():o(e.error??new Error("BatchSpanProcessor: span export failed"))});let n=null;for(let t=0,e=r.length;t<e;t++){let e=r[t];e.resource.asyncAttributesPending&&e.resource.waitForAsyncAttributes&&(n??=[]).push(e.resource.waitForAsyncAttributes())}null===n?e():Promise.all(n).then(e,e=>{yu(e),o(e)})})})}_maybeStartTimer(){if(!this._isExporting){let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,0<this._finishedSpans.length&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,yu(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();void 0===this._timer&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),"number"!=typeof this._timer)&&this._timer.unref()}}_clearTimer(){void 0!==this._timer&&(clearTimeout(this._timer),this._timer=void 0)}}class pd extends cd{_visibilityChangeListener;_pageHideListener;constructor(e,t){super(e,t),this.onInit(t)}onInit(e){!0!==e?.disableAutoFlushOnDocumentHide&&"undefined"!=typeof document&&(this._visibilityChangeListener=()=>{"hidden"===document.visibilityState&&this.forceFlush().catch(e=>{yu(e)})},this._pageHideListener=()=>{this.forceFlush().catch(e=>{yu(e)})},document.addEventListener("visibilitychange",this._visibilityChangeListener),document.addEventListener("pagehide",this._pageHideListener))}onShutdown(){"undefined"!=typeof document&&(this._visibilityChangeListener&&document.removeEventListener("visibilitychange",this._visibilityChangeListener),this._pageHideListener)&&document.removeEventListener("pagehide",this._pageHideListener)}}let dd=new Uint8Array(16),hd=new Uint8Array(8),fd=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function md(t){for(let e=0;e<t.length;e++)t[e]=256*Math.random()>>>0;for(let e=0;e<t.length;e++)if(0<t[e])return;t[t.length-1]=1}function gd(t){let r="";for(let e=0;e<t.length;e++)r+=fd[t[e]];return r}class yd{generateTraceId(){return md(dd),gd(dd)}generateSpanId(){return md(hd),gd(hd)}}let _d="otel.span.parent.origin",vd="otel.span.sampling_result";class bd{startedSpans;liveSpans;constructor(e){this.startedSpans=e.createCounter("otel.sdk.span.started",{unit:"{span}",description:"The number of created spans."}),this.liveSpans=e.createUpDownCounter("otel.sdk.span.live",{unit:"{span}",description:"The number of currently live spans."})}startSpan(e,t){var r=(()=>{switch(t){case ed.RECORD_AND_SAMPLED:return"RECORD_AND_SAMPLE";case ed.RECORD:return"RECORD_ONLY";case ed.NOT_RECORD:return"DROP"}})();if(this.startedSpans.add(1,{[_d]:Sd(e),[vd]:r}),t===ed.NOT_RECORD)return()=>{};let n={[vd]:r};return this.liveSpans.add(1,n),()=>{this.liveSpans.add(-1,n)}}}function Sd(e){return e?e.isRemote?"remote":"local":"none"}class Td{_sampler;_generalLimits;_spanLimits;_idGenerator;instrumentationScope;_resource;_spanProcessor;_tracerMetrics;constructor(e,t,r,n){i=t,o={sampler:ad()},s=sd(),(o=Object.assign({},s,o,i)).generalLimits=Object.assign({},s.generalLimits,i.generalLimits||{}),o.spanLimits=Object.assign({},s.spanLimits,i.spanLimits||{});var o,s=o,i=(this._sampler=s.sampler,this._generalLimits=s.generalLimits,this._spanLimits=s.spanLimits,this._idGenerator=t.idGenerator||new yd,this._resource=r,this._spanProcessor=n,this.instrumentationScope=e,s.meterProvider?s.meterProvider.getMeter("@opentelemetry/sdk-trace","2.7.1"):an());this._tracerMetrics=new bd(i)}startSpan(e,t={},r=Jn.active()){t.root&&(r=mo.deleteSpan(r));var n=mo.getSpan(r);if(lu(r))return Xn.debug("Instrumentation suppressed, returning Noop Span"),mo.wrapSpanContext(Sn);var n=n?.spanContext(),o=this._idGenerator.generateSpanId();let s,i,a;n&&mo.isSpanContextValid(n)?(i=n.traceId,a=n.traceState,s=n):i=this._idGenerator.generateTraceId();var u=t.kind??Vn.INTERNAL,l=(t.links??[]).map(e=>({context:e.context,attributes:du(e.attributes)})),c=du(t.attributes),p=this._sampler.shouldSample(r,i,e,u,c,l),n=this._tracerMetrics.startSpan(n,p.decision),o=(a=p.traceState??a,{traceId:i,spanId:o,traceFlags:p.decision===Mn.RECORD_AND_SAMPLED?un.SAMPLED:un.NONE,traceState:a});return p.decision===Mn.NOT_RECORD?(Xn.debug("Recording is off, propagating context in a non-recording span"),mo.wrapSpanContext(o)):(c=du(Object.assign(c,p.attributes)),new Zp({resource:this._resource,scope:this.instrumentationScope,context:r,spanContext:o,name:e,kind:u,links:l,parentSpanContext:s,attributes:c,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:n}))}startActiveSpan(e,t,r,n){let o,s,i;if(!(arguments.length<2))return i=2===arguments.length?t:3===arguments.length?(o=t,r):(o=t,s=r,n),t=s??Jn.active(),r=this.startSpan(e,o,t),n=mo.setSpan(t,r),Jn.with(n,i,void 0,r)}getGeneralLimits(){return this._generalLimits}getSpanLimits(){return this._spanLimits}}class wd{_spanProcessors;constructor(e){this._spanProcessors=e}forceFlush(){let e=[];for(var t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{yu(e||new Error("MultiSpanProcessor: forceFlush failed")),t()})})}onStart(e,t){for(var r of this._spanProcessors)r.onStart(e,t)}onEnding(e){for(var t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(var t of this._spanProcessors)t.onEnd(e)}shutdown(){let r=[];for(var e of this._spanProcessors)r.push(e.shutdown());return new Promise((e,t)=>{Promise.all(r).then(()=>{e()},t)})}}(e=>{e[e.resolved=0]="resolved",e[e.timeout=1]="timeout",e[e.error=2]="error",e[e.unresolved=3]="unresolved"})(Ed=Ed||{});class Ad{_config;_tracers=new Map;_resource;_activeSpanProcessor;constructor(e={}){var t=(e=>{let t=e.shift();for(var r=new WeakMap;0<e.length;)t=rl(t,e.shift(),0,r);return t})([{},sd(),(t=e,(r=Object.assign({},t.spanLimits)).attributeCountLimit=t.spanLimits?.attributeCountLimit??t.generalLimits?.attributeCountLimit??128,r.attributeValueLengthLimit=t.spanLimits?.attributeValueLengthLimit??t.generalLimits?.attributeValueLengthLimit??ld,Object.assign({},t,{spanLimits:r}))]),r=(this._resource=t.resource??yl(),this._config=Object.assign({},t,{resource:this._resource}),[]);e.spanProcessors?.length&&r.push(...e.spanProcessors),this._activeSpanProcessor=new wd(r)}getTracer(e,t,r){var n=e+`@${t||""}:`+(r?.schemaUrl||"");return this._tracers.has(n)||this._tracers.set(n,new Td({name:e,version:t,schemaUrl:r?.schemaUrl},this._config,this._resource,this._activeSpanProcessor)),this._tracers.get(n)}forceFlush(){let o=this._config.forceFlushTimeoutMillis,e=this._activeSpanProcessor._spanProcessors.map(e=>new Promise(t=>{let r,n=setTimeout(()=>{t(new Error(`Span processor did not completed within timeout period of ${o} ms`)),r=Ed.timeout},o);e.forceFlush().then(()=>{clearTimeout(n),r!==Ed.timeout&&(r=Ed.resolved,t(r))}).catch(e=>{clearTimeout(n),r=Ed.error,t(e)})}));return new Promise((t,r)=>{Promise.all(e).then(e=>{e=e.filter(e=>e!==Ed.resolved);0<e.length?r(e):t()}).catch(e=>r([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}}class Od{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:xu(e.startTime),duration:xu(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(t,e){for(let e of t)console.dir(this._exportInfo(e),{depth:3});if(e)return e({code:Iu.SUCCESS})}}class xd{_finishedSpans=[];_stopped=!1;export(e,t){if(this._stopped)return t({code:Iu.FAILED,error:new Error("Exporter has been stopped")});this._finishedSpans.push(...e),setTimeout(()=>t({code:Iu.SUCCESS}),0)}shutdown(){return this._stopped=!0,this._finishedSpans=[],this.forceFlush()}forceFlush(){return Promise.resolve()}reset(){this._finishedSpans=[]}getFinishedSpans(){return this._finishedSpans}}class Cd{_exporter;_shutdownOnce;_pendingExports;constructor(e){this._exporter=e,this._shutdownOnce=new ll(this._shutdown,this),this._pendingExports=new Set}async forceFlush(){await Promise.all(Array.from(this._pendingExports)),this._exporter.forceFlush&&await this._exporter.forceFlush()}onStart(e,t){}onEnd(t){if(!this._shutdownOnce.isCalled&&0!=(t.spanContext().traceFlags&un.SAMPLED)){let e=this._doExport(t).catch(e=>yu(e));this._pendingExports.add(e),e.finally(()=>this._pendingExports.delete(e))}}async _doExport(e){e.resource.asyncAttributesPending&&await e.resource.waitForAsyncAttributes?.();e=await cl._export(this._exporter,[e]);if(e.code!==Iu.SUCCESS)throw e.error??new Error(`SimpleSpanProcessor: span export failed (status ${e})`)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return this._exporter.shutdown()}}class Rd{onStart(e,t){}onEnd(e){}shutdown(){return Promise.resolve()}forceFlush(){return Promise.resolve()}}var Nd,Id=n(Object.freeze({__proto__:null,BasicTracerProvider:Ad,BatchSpanProcessor:pd,RandomIdGenerator:yd,ConsoleSpanExporter:Od,InMemorySpanExporter:xd,SimpleSpanProcessor:Cd,NoopSpanProcessor:Rd,AlwaysOffSampler:rd,AlwaysOnSampler:nd,ParentBasedSampler:od,TraceIdRatioBasedSampler:id,get SamplingDecision(){return ed}}));class Pd{_enabled=!1;_currentContext=Mr;_bindFunction(t=Mr,r){function e(...e){return n.with(t,()=>r.apply(this,e))}let n=this;return Object.defineProperty(e,"length",{enumerable:!1,configurable:!0,writable:!1,value:r.length}),e}active(){return this._currentContext}bind(e,t){return void 0===e&&(e=this.active()),"function"==typeof t?this._bindFunction(e,t):t}disable(){return this._currentContext=Mr,this._enabled=!1,this}enable(){return this._enabled||(this._enabled=!0,this._currentContext=Mr),this}with(e,t,r,...n){var o=this._currentContext;this._currentContext=e||Mr;try{return t.call(r,...n)}finally{this._currentContext=o}}}(e=>{e.CONNECT_END="connectEnd",e.CONNECT_START="connectStart",e.DECODED_BODY_SIZE="decodedBodySize",e.DOM_COMPLETE="domComplete",e.DOM_CONTENT_LOADED_EVENT_END="domContentLoadedEventEnd",e.DOM_CONTENT_LOADED_EVENT_START="domContentLoadedEventStart",e.DOM_INTERACTIVE="domInteractive",e.DOMAIN_LOOKUP_END="domainLookupEnd",e.DOMAIN_LOOKUP_START="domainLookupStart",e.ENCODED_BODY_SIZE="encodedBodySize",e.FETCH_START="fetchStart",e.LOAD_EVENT_END="loadEventEnd",e.LOAD_EVENT_START="loadEventStart",e.NAVIGATION_START="navigationStart",e.REDIRECT_END="redirectEnd",e.REDIRECT_START="redirectStart",e.REQUEST_START="requestStart",e.RESPONSE_END="responseEnd",e.RESPONSE_START="responseStart",e.SECURE_CONNECTION_START="secureConnectionStart",e.START_TIME="startTime",e.UNLOAD_EVENT_END="unloadEventEnd",e.UNLOAD_EVENT_START="unloadEventStart"})(Nd=Nd||{});let Ud;function kd(e,t){return t in e}function Ld(e,t,r,n=!0){if(kd(r,t)&&"number"==typeof r[t]&&(!n||0!==r[t]))return e.addEvent(t,r[t])}function jd(e){return e.slice().sort((e,t)=>{e=e[Nd.FETCH_START],t=t[Nd.FETCH_START];return t<e?1:e<t?-1:0})}function Dd(){return"undefined"!=typeof location?location.origin:void 0}function Md(e){var t;return"function"==typeof URL?new URL(e,"undefined"!=typeof document?document.baseURI:"undefined"!=typeof location?location.href:void 0):((t=Ud=Ud||document.createElement("a")).href=e,t)}var Vd=Object.freeze({__proto__:null,WebTracerProvider:class extends Ad{constructor(e={}){super(e)}register(e={}){mo.setGlobalTracerProvider(this),null!==(t=e.propagator)&&(void 0!==t?po.setGlobalPropagator(t):po.setGlobalPropagator(new Pu({propagators:[new Hu,new pu]})));var t,r=e.contextManager;if(null!==r){if(void 0===r){let e=new Pd;return void(e.enable(),Jn.setGlobalContextManager(e))}r.enable(),Jn.setGlobalContextManager(r)}}},StackContextManager:Pd,get PerformanceTimingNames(){return Nd},addSpanNetworkEvent:Ld,addSpanNetworkEvents:function(r,n,e=!1,t,o){if(void 0===t&&(t=0!==n[Nd.START_TIME]),e||(Ld(r,Nd.FETCH_START,n,t),Ld(r,Nd.DOMAIN_LOOKUP_START,n,t),Ld(r,Nd.DOMAIN_LOOKUP_END,n,t),Ld(r,Nd.CONNECT_START,n,t),Ld(r,Nd.SECURE_CONNECTION_START,n,t),Ld(r,Nd.CONNECT_END,n,t),Ld(r,Nd.REQUEST_START,n,t),Ld(r,Nd.RESPONSE_START,n,t),Ld(r,Nd.RESPONSE_END,n,t)),!o){let e=n[Nd.ENCODED_BODY_SIZE],t=(void 0!==e&&r.setAttribute("http.response_content_length",e),n[Nd.DECODED_BODY_SIZE]);void 0!==t&&e!==t&&r.setAttribute("http.response_content_length_uncompressed",t)}},getElementXPath:function e(t,r){if(t.nodeType===Node.DOCUMENT_NODE)return"/";var n=((t,r)=>{let e=t.nodeType,n=(r=>{if(!r.parentNode)return 0;let n=[r.nodeType],e=(r.nodeType===Node.CDATA_SECTION_NODE&&n.push(Node.TEXT_NODE),Array.from(r.parentNode.childNodes));return 1<=(e=e.filter(e=>{var t=e.localName;return 0<=n.indexOf(e.nodeType)&&t===r.localName})).length?e.indexOf(r)+1:0})(t),o="";if(e===Node.ELEMENT_NODE){let e=t.getAttribute("id");if(r&&e)return`//*[@id="${e}"]`;o=t.localName}else if(e===Node.TEXT_NODE||e===Node.CDATA_SECTION_NODE)o="text()";else{if(e!==Node.COMMENT_NODE)return"";o="comment()"}return o&&1<n?`/${o}[${n}]`:"/"+o})(t,r);if(r&&0<n.indexOf("@id"))return n;let o="";return t.parentNode&&(o+=e(t.parentNode,r)),o+=n},getResource:function(e,u,n,t,o=new WeakSet,r){var s=Md(e),e=((n,e,t,r,o)=>{let s=Ou(u),i=Ou(e),a=t.filter(e=>{var t=Ou(Au(e[Nd.FETCH_START])),r=Ou(Au(e[Nd.RESPONSE_END]));return e.initiatorType.toLowerCase()===(o||"xmlhttprequest")&&e.name===n&&t>=s&&r<=i});return a=0<a.length?a.filter(e=>!r.has(e)):a})(e=s.toString(),n,t,o,r);if(0===e.length)return{mainRequest:void 0};if(1!==e.length){o=jd(e);if(s.origin!==Dd()&&1<o.length){let e=o[0],t=((o,e,t)=>{var s=Ou(t),i=Ou(Au(e));let a,u=o[1],r=o.length;for(let n=1;n<r;n++){let e=o[n],t=Ou(Au(e[Nd.FETCH_START])),r=s-Ou(Au(e[Nd.RESPONSE_END]));t>=i&&(!a||r<a)&&(a=r,u=e)}return u})(o,e[Nd.RESPONSE_END],n),r=e[Nd.RESPONSE_END];return t[Nd.FETCH_START]<r&&(t=e,e=void 0),{corsPreFlightRequest:e,mainRequest:t}}}return{mainRequest:e[0]}},hasKey:kd,normalizeUrl:function(e){return Md(e).href},parseUrl:Md,shouldPropagateTraceHeaders:function(t,e){let r=e||[];return("string"==typeof r||r instanceof RegExp)&&(r=[r]),Md(t).origin===Dd()||r.some(e=>"string"==typeof e?t===e:!!t.match(e))},sortResources:jd,AlwaysOffSampler:rd,AlwaysOnSampler:nd,BasicTracerProvider:Ad,BatchSpanProcessor:pd,ConsoleSpanExporter:Od,InMemorySpanExporter:xd,NoopSpanProcessor:Rd,ParentBasedSampler:od,RandomIdGenerator:yd,get SamplingDecision(){return ed},SimpleSpanProcessor:Cd,TraceIdRatioBasedSampler:id}),Bd=n(Vd),Fd=Qp.OTLPTraceExporter,qd=Id.BatchSpanProcessor,Hd=Bd.WebTracerProvider,Gd=Ol,zd=o,Kd="tccc",Yd="https://otlp.tccc.qcloud.com/v1/traces",Wd=function(e){var t=new Fd({url:e.url||Yd,headers:{"X-Tps-TenantID":e.id||Kd}}),t=new Hd({spanProcessors:[new qd(t,{})],resource:Gd.defaultResource().merge(Gd.resourceFromAttributes({"tps.tenant.id":e.id||Kd,"service.name":"JsSIP","service.version":zd.version}))});return t.register(),t.getTracer("JsSIP")},$d={provider:Wd({id:Kd,url:Yd}),attributes:{}},Jd=(Jp.setConfig=function(e){$d.provider=Wd(e)},Jp.setAttributes=function(e){Object.assign($d.attributes,e)},Jp.trace=function(e){return Wd(e)},$.EventEmitter),Xd=xl.exports,Qd=$l,Zd=Wl,eh=rp,th=s,rh=j,nh=qc,oh=F(),ih=Ac,sh=vc,ah=mp,uh=Wc,lh=gp.exports,ch=Cp,ph=kp,dh=Fp,hh=B(),fh=Kp,mh=Wp,gh=$p,yh=Jp,_h=eh.trace,vh=eh.context,bh=new Zd("RTCSession"),Sh={STATUS_NULL:0,STATUS_INVITE_SENT:1,STATUS_1XX_RECEIVED:2,STATUS_INVITE_RECEIVED:3,STATUS_WAITING_FOR_ANSWER:4,STATUS_ANSWERED:5,STATUS_WAITING_FOR_ACK:6,STATUS_CANCELED:7,STATUS_TERMINATED:8,STATUS_CONFIRMED:9},Th=["audio","video"],wh=(()=>{function i(e){l(this,i),bh.debug("new"),(t=u(this,i))._id=null,t._ua=e,t._status=Sh.STATUS_NULL,t._dialog=null,t._earlyDialogs={},t._contact=null,t._from_tag=null,t._to_tag=null,t._use_trtc=t._ua.configuration.use_trtc,t._trtc_already_join=!1,t._is_mini_program=oh.isMiniProgram(),t._connection=null,t._connectionPromiseQueue=Promise.resolve(),t._request=null,t._is_canceled=!1,t._cancel_reason="",t._is_confirmed=!1,t._late_sdp=!1,t._rtcOfferConstraints=null,t._rtcAnswerConstraints=null,t._localStream=null,t._remoteStream={},t._remoteMediaStream={},t._localTRTCClient=null,t._localUserId=null,t._trtcLocalStream=null,t._trtcLocalStreamLocallyGenerated=!1,t._trtcLocalStreamConfig={},t._trtcRemoteStream={},t._rtcReady=!0,t._iceReady=!1,t._timers={ackTimer:null,expiresTimer:null,invite2xxTimer:null,userNoAnswerTimer:null},t._direction=null,t._local_identity=null,t._remote_identity=null,t._start_time=null,t._end_time=null,t._tones=null,t._audioMuted=!1,t._videoMuted=!1,t._localHold=!1,t._remoteHold=!1,t._sessionTimers={enabled:t._ua.configuration.session_timers,refreshMethod:t._ua.configuration.session_timers_refresh_method,defaultExpires:th.SESSION_EXPIRES,currentExpires:null,running:!1,refresher:!1,timer:null},t._referSubscribers={},t._data={};var t,e=Number(t._ua.configuration.log_level),e=1<e?e+1:e,r=null==(r=t._ua.configuration.uri.host)?void 0:r.includes("tencentcloud.com");return t.tracer=yh.trace({id:r?"tcccsg":"tccc",url:r?"https://otlp.connect.tencentcloud.com/v1/traces":"https://otlp.tccc.qcloud.com/v1/traces"}),Xd.Logger.setLogLevel(e),t._ua.configuration.log_report?Xd.Logger.enableUploadLog():Xd.Logger.disableUploadLog(),t}return m(i,Jd),p(i,[{key:"C",get:function(){return Sh}},{key:"causes",get:function(){return th.causes}},{key:"id",get:function(){return this._id}},{key:"connection",get:function(){return this._connection}},{key:"contact",get:function(){return this._contact}},{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}},{key:"start_time",get:function(){return this._start_time}},{key:"end_time",get:function(){return this._end_time}},{key:"data",get:function(){return this._data},set:function(e){this._data=e}},{key:"status",get:function(){return this._status}},{key:"localStreams",get:function(){return this._use_trtc?[this._trtcLocalStream]:[this._localStream]}},{key:"remoteStreams",get:function(){return this._use_trtc?Object.values(this._trtcRemoteStream):Object.values(this._remoteStream)}},{key:"isInProgress",value:function(){switch(this._status){case Sh.STATUS_NULL:case Sh.STATUS_INVITE_SENT:case Sh.STATUS_1XX_RECEIVED:case Sh.STATUS_INVITE_RECEIVED:case Sh.STATUS_WAITING_FOR_ANSWER:return!0;default:return!1}}},{key:"isEstablished",value:function(){switch(this._status){case Sh.STATUS_ANSWERED:case Sh.STATUS_WAITING_FOR_ACK:case Sh.STATUS_CONFIRMED:return!0;default:return!1}}},{key:"isEnded",value:function(){switch(this._status){case Sh.STATUS_CANCELED:case Sh.STATUS_TERMINATED:return!0;default:return!1}}},{key:"isMuted",value:function(){return{audio:this._audioMuted,video:this._videoMuted}}},{key:"isOnHold",value:function(){return{local:this._localHold,remote:this._remoteHold}}},{key:"connect",value:function(e){var t,r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=2<arguments.length?arguments[2]:void 0,o=(bh.debug("connect options:".concat(JSON.stringify(r))),e),s=oh.cloneObject(r.eventHandlers),i=oh.cloneArray(r.extraHeaders),a=oh.cloneObject(r.mediaConstraints,{audio:!0,video:!0}),u=r.mediaStream||null,l=oh.cloneObject(r.pcConfig,{iceServers:[]}),c=r.rtcConstraints||null,p=r.rtcOfferConstraints||null;if(this._rtcOfferConstraints=p,this._rtcAnswerConstraints=r.rtcAnswerConstraints||null,this._trtcLocalStreamConfig=r.streamConfig||{},this._data=r.data||this._data,void 0===e)throw new TypeError("Not enough arguments");if(this._status!==Sh.STATUS_NULL)throw new rh.InvalidStateError(this._status);if(!gh.RTCPeerConnection&&!oh.isMiniProgram())throw new rh.NotSupportedError("WebRTC not supported");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(o));for(t in this._sessionTimers.enabled&&oh.isDecimal(r.sessionTimersExpires)&&(r.sessionTimersExpires>=th.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=r.sessionTimersExpires:this._sessionTimers.defaultExpires=th.SESSION_EXPIRES),s)Object.prototype.hasOwnProperty.call(s,t)&&this.on(t,s[t]);this._from_tag=oh.newTag();var o=r.anonymous||!1,h={from_tag:this._from_tag};this._contact=this._ua.contact.toString({anonymous:o,outbound:!0}),o?(h.from_display_name="Anonymous",h.from_uri=new hh("sip","anonymous","anonymous.invalid"),i.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString())),i.push("Privacy: id")):r.fromUserName&&(h.from_uri=new hh("sip",r.fromUserName,this._ua.configuration.uri.host),i.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))),r.fromDisplayName&&(h.from_display_name=r.fromDisplayName),i.push("Contact: ".concat(this._contact)),i.push("Content-Type: application/sdp"),this._sessionTimers.enabled&&i.push("Session-Expires: ".concat(this._sessionTimers.defaultExpires).concat(this._ua.configuration.session_timers_force_refresher?";refresher=uac":"")),this._use_trtc&&i.push("X-TRTC: 1"),this._request=new sh.InitialOutgoingInviteRequest(e,this._ua,h,i),this._id=this._request.call_id+this._from_tag,this._use_trtc||this._createRTCConnection(l,c),this._direction="outgoing",this._local_identity=this._request.from,this._remote_identity=this._request.to,n&&n(this),this._newRTCSession("local",this._request),this._use_trtc?this._sendTRTCInitialRequest():this._sendInitialRequest(a,p,u)}},{key:"init_incoming",value:function(e,t){var r,n=this,o=(bh.debug("init_incoming()"),e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0);e.body&&"application/sdp"!==o?e.reply(415):(this._status=Sh.STATUS_INVITE_RECEIVED,this._from_tag=e.from_tag,this._id=e.call_id+this._from_tag,this._request=e,this._contact=this._ua.contact.toString(),e.hasHeader("expires")&&(r=1e3*e.getHeader("expires")),e.to_tag=oh.newTag(),this._createDialog(e,"UAS",!0)?(e.body?this._late_sdp=!1:this._late_sdp=!0,this._status=Sh.STATUS_WAITING_FOR_ANSWER,this._timers.userNoAnswerTimer=setTimeout(function(){e.reply(408),n._failed("local",null,th.causes.NO_ANSWER)},this._ua.configuration.no_answer_timeout),r&&(this._timers.expiresTimer=setTimeout(function(){n._status===Sh.STATUS_WAITING_FOR_ANSWER&&(e.reply(487),n._failed("system",null,th.causes.EXPIRES))},r)),this._direction="incoming",this._local_identity=e.to,this._remote_identity=e.from,t&&t(this),this._newRTCSession("remote",e),this._status!==Sh.STATUS_TERMINATED&&(e.reply(180,null,["Contact: ".concat(this._contact)]),this._progress("local",null))):e.reply(500,"Missing Contact header field"))}},{key:"answer",value:function(){var i=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},a=(bh.debug("answer()"),this._request),t=oh.cloneArray(e.extraHeaders),r=oh.cloneObject(e.mediaConstraints),n=e.mediaStream||null,o=oh.cloneObject(e.pcConfig,{iceServers:[]}),s=e.rtcConstraints||null,u=e.rtcAnswerConstraints||null,l=oh.cloneObject(e.rtcOfferConstraints),c=!1,p=!1,h=!1,f=!1;if(this._rtcAnswerConstraints=u,this._rtcOfferConstraints=e.rtcOfferConstraints||null,this._trtcLocalStreamConfig=e.streamConfig||{},this._data=e.data||this._data,"incoming"!==this._direction)throw new rh.NotSupportedError('"answer" not supported for outgoing RTCSession');if(this._status!==Sh.STATUS_WAITING_FOR_ANSWER)throw new rh.InvalidStateError(this._status);if(this._sessionTimers.enabled&&oh.isDecimal(e.sessionTimersExpires)&&(e.sessionTimersExpires>=th.MIN_SESSION_EXPIRES?this._sessionTimers.defaultExpires=e.sessionTimersExpires:this._sessionTimers.defaultExpires=th.SESSION_EXPIRES),this._status=Sh.STATUS_ANSWERED,this._createDialog(a,"UAS")){if(clearTimeout(this._timers.userNoAnswerTimer),t.unshift("Contact: ".concat(this._contact)),this._use_trtc){var m=a.getHeader("X-TRTC-SDKAPPID"),g=a.getHeader("X-TRTC-USERID"),y=parseInt(a.getHeader("X-TRTC-ROOMID"),10),_=a.getHeader("X-TRTC-STRROOMID"),v=a.getHeader("X-TRTC-USERSIG"),b=a.getHeader("X-TRTC-PRIVATEMAPKEY"),e=a.getHeader("X-TCCC-IVR"),S=a.getHeader("X-TRTC-PROXY");if(!this._is_mini_program&&m&&g&&(y||_)&&v)return void Promise.resolve().then(function(){return i._connecting(a),i._joinTRTCRoom({sdkAppId:m,userId:g,roomId:y,strRoomId:_,privateMapKey:b,userSig:v,proxy:S},function(e){i.terminate({status_code:480,cause:th.causes.WEBRTC_ERROR,reason_phrase:"TRTC Error"}),i._failed("system",e.toString(),th.causes.WEBRTC_ERROR)})}).then(function(e){if(i._status===Sh.STATUS_TERMINATED)throw new Error("terminated");bh.debug("TRTC success"),i._handleSessionTimersInIncomingRequest(a,t),a.reply(200,null,t,e,function(){i._status=Sh.STATUS_WAITING_FOR_ACK,i._setInvite2xxTimer(a,e),i._setACKTimer(),i._accepted("local")},function(){i._failed("system",null,th.causes.CONNECTION_ERROR)}),i._late_sdp=!1}).catch(function(e){var t,r,n,o,s;if(i._status!==Sh.STATUS_TERMINATED)throw r=t=th.causes.WEBRTC_ERROR,n=e.name,(o=["NotFoundError","NotAllowedError","NotReadableError","OverconstrainedError","AbortError"].includes(n))&&(t=th.causes.USER_DENIED_MEDIA_ACCESS,bh.warn('emit "getusermediafailed" [error:%o]',e),i.emit("getusermediafailed",e)),s=oh.isFunction(e.getCode)?e.getCode():"0","RtcError"===e.name&&bh.error("TRTC error",e.toString(),{code:s,name:n}),!o&&e.message&&(r=e.message),bh.debug("TRTC error then terminate",{code:s,name:n}),a.reply(480,r),i._failed("local",e.toString(),t),e});if(e||this._is_mini_program)return(new Promise.resolve).then(function(e){if(i._status===Sh.STATUS_TERMINATED)throw new Error("terminated");bh.debug("processing pure signal mode"),i._handleSessionTimersInIncomingRequest(a,t),a.reply(200,null,t,e,function(){i._status=Sh.STATUS_WAITING_FOR_ACK,i._setInvite2xxTimer(a,e),i._setACKTimer(),i._accepted("local")},function(){i._failed("system",null,th.causes.CONNECTION_ERROR)}),i._late_sdp=!1}).catch(function(e){var t;if(i._status!==Sh.STATUS_TERMINATED)throw bh.error("pure signal mode error then terminate",e.toString()),t=th.causes.WEBRTC_ERROR,a.reply(480,t),i._failed("local",e.toString(),t),e});throw bh.error("missing TRTC config"),a.reply(500),this._failed("system",null,th.causes.INTERNAL_ERROR),new Error("missing config")}e=a.parseSDP();Array.isArray(e.media)||(e.media=[e.media]);var T,w=d(e.media);try{for(w.s();!(T=w.n()).done;){var E=T.value;"audio"===E.type&&(c=!0,E.direction&&"sendrecv"!==E.direction||(h=!0)),"video"===E.type&&(p=!0,E.direction&&"sendrecv"!==E.direction||(f=!0))}}catch(i){w.e(i)}finally{w.f()}if(n&&!1===r.audio){var A,O=d(n.getAudioTracks());try{for(O.s();!(A=O.n()).done;){var x=A.value;n.removeTrack(x)}}catch(i){O.e(i)}finally{O.f()}}if(n&&!1===r.video){var C,R=d(n.getVideoTracks());try{for(R.s();!(C=R.n()).done;){var N=C.value;n.removeTrack(N)}}catch(i){R.e(i)}finally{R.f()}}n||void 0!==r.audio||(r.audio=h),n||void 0!==r.video||(r.video=f),n||c||l.offerToReceiveAudio||(r.audio=!1),n||p||l.offerToReceiveVideo||(r.video=!1),this._createRTCConnection(o,s),Promise.resolve().then(function(){return n||(r.audio||r.video?new fh(r).initialize().catch(function(e){if(i._status===Sh.STATUS_TERMINATED)throw new Error("terminated");var t=th.causes.USER_DENIED_MEDIA_ACCESS;throw a.reply(480,t),i._failed("local",null,th.causes.USER_DENIED_MEDIA_ACCESS),bh.warn('emit "getusermediafailed" [error:%o]',e),i.emit("getusermediafailed",e),new Error("getUserMedia() failed")}):void 0)}).then(function(t){if(i._status===Sh.STATUS_TERMINATED)throw new Error("terminated");(i._localStream=t).mediaStream&&t.mediaStream.getTracks().forEach(function(e){i._connection.addTrack(e,t.mediaStream)})}).then(function(){var e,t;if(!i._late_sdp)return e={originator:"remote",type:"offer",sdp:a.body},bh.debug('emit "sdp"'),i.emit("sdp",e),t=new RTCSessionDescription({type:"offer",sdp:e.sdp}),i._connectionPromiseQueue=i._connectionPromiseQueue.then(function(){return i._connection.setRemoteDescription(t)}).catch(function(e){throw a.reply(488),i._failed("system",null,th.causes.WEBRTC_ERROR),bh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),i.emit("peerconnection:setremotedescriptionfailed",e),new Error("peerconnection.setRemoteDescription() failed")}),i._connectionPromiseQueue}).then(function(){if(i._status===Sh.STATUS_TERMINATED)throw new Error("terminated");return i._connecting(a),(i._late_sdp?i._createLocalDescription("offer",i._rtcOfferConstraints):i._createLocalDescription("answer",u)).catch(function(){throw a.reply(500),new Error("_createLocalDescription() failed")})}).then(function(e){if(i._status===Sh.STATUS_TERMINATED)throw new Error("terminated");i._handleSessionTimersInIncomingRequest(a,t),a.reply(200,null,t,e,function(){i._status=Sh.STATUS_WAITING_FOR_ACK,i._setInvite2xxTimer(a,e),i._setACKTimer(),i._accepted("local")},function(){i._failed("system",null,th.causes.CONNECTION_ERROR)})}).catch(function(e){i._status!==Sh.STATUS_TERMINATED&&bh.warn(e)})}else a.reply(500,"Error creating dialog")}},{key:"terminate",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};bh.debug("terminate()");var r,n,o=e.cause||th.causes.BYE,s=oh.cloneArray(e.extraHeaders),i=e.body,a=e.status_code,u=e.reason_phrase;if(this._status===Sh.STATUS_TERMINATED)throw new rh.InvalidStateError(this._status);switch(this._status){case Sh.STATUS_NULL:case Sh.STATUS_INVITE_SENT:case Sh.STATUS_1XX_RECEIVED:if(bh.debug("canceling session"),a&&(a<200||700<=a))throw new TypeError("Invalid status_code: ".concat(a));a&&(u=u||th.REASON_PHRASE[a]||"",r="SIP ;cause=".concat(a,' ;text="').concat(u,'"')),this._status===Sh.STATUS_NULL||this._status===Sh.STATUS_INVITE_SENT?(this._is_canceled=!0,this._cancel_reason=r):this._status===Sh.STATUS_1XX_RECEIVED&&this._request.cancel(r),this._status=Sh.STATUS_CANCELED,this._failed("local",null,th.causes.CANCELED);break;case Sh.STATUS_WAITING_FOR_ANSWER:case Sh.STATUS_ANSWERED:if(bh.debug("rejecting session"),(a=a||480)<300||700<=a)throw new TypeError("Invalid status_code: ".concat(a));this._request.reply(a,u,s,i),this._failed("local",null,th.causes.REJECTED);break;case Sh.STATUS_WAITING_FOR_ACK:case Sh.STATUS_CONFIRMED:if(bh.debug("terminating session"),u=e.reason_phrase||th.REASON_PHRASE[a]||"",a&&(a<200||700<=a))throw new TypeError("Invalid status_code: ".concat(a));a&&s.push("Reason: SIP ;cause=".concat(a,'; text="').concat(u,'"')),this._status===Sh.STATUS_WAITING_FOR_ACK&&"incoming"===this._direction&&this._request.server_transaction.state!==nh.C.STATUS_TERMINATED?(n=this._dialog,this.receiveRequest=function(e){e.method===th.ACK&&(t.sendRequest(th.BYE,{extraHeaders:s,body:i}),n.terminate())},this._request.server_transaction.on("stateChanged",function(){t._request.server_transaction.state===nh.C.STATUS_TERMINATED&&(t.sendRequest(th.BYE,{extraHeaders:s,body:i}),n.terminate())}),this._ended("local",null,o),this._dialog=n,this._ua.newDialog(n)):(this.sendRequest(th.BYE,{extraHeaders:s,body:i}),this._ended("local",null,o))}}},{key:"sendDTMF",value:function(e){var o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},s=(bh.debug("sendDTMF() | tones: %s",e),0),i=o.duration||null,a=o.interToneGap||null,t=o.transportType||th.DTMF_TRANSPORT.INFO;if(void 0===e)throw new TypeError("Not enough arguments");if(this._status!==Sh.STATUS_CONFIRMED&&this._status!==Sh.STATUS_WAITING_FOR_ACK&&this._status!==Sh.STATUS_1XX_RECEIVED)throw new rh.InvalidStateError(this._status);if(t!==th.DTMF_TRANSPORT.INFO&&t!==th.DTMF_TRANSPORT.RFC2833)throw new TypeError("invalid transportType: ".concat(t));if(!(e="number"==typeof e?e.toString():e)||"string"!=typeof e||!e.match(/^[0-9A-DR#*,]+$/i))throw new TypeError("Invalid tones: ".concat(e));if(i&&!oh.isDecimal(i))throw new TypeError("Invalid tone duration: ".concat(i));if(i=i?i<lh.C.MIN_DURATION?(bh.debug('"duration" value is lower than the minimum allowed, setting it to '.concat(lh.C.MIN_DURATION," milliseconds")),lh.C.MIN_DURATION):i>lh.C.MAX_DURATION?(bh.debug('"duration" value is greater than the maximum allowed, setting it to '.concat(lh.C.MAX_DURATION," milliseconds")),lh.C.MAX_DURATION):Math.abs(i):lh.C.DEFAULT_DURATION,o.duration=i,a&&!oh.isDecimal(a))throw new TypeError("Invalid interToneGap: ".concat(a));a=a?a<lh.C.MIN_INTER_TONE_GAP?(bh.debug('"interToneGap" value is lower than the minimum allowed, setting it to '.concat(lh.C.MIN_INTER_TONE_GAP," milliseconds")),lh.C.MIN_INTER_TONE_GAP):Math.abs(a):lh.C.DEFAULT_INTER_TONE_GAP,t!==th.DTMF_TRANSPORT.RFC2833?this._tones?this._tones+=e:(this._tones=e,function e(){var t,r,n=this;this._status===Sh.STATUS_TERMINATED||!this._tones||s>=this._tones.length?this._tones=null:(t=this._tones[s],s+=1,r=","===t?2e3:(r=new lh(this),o.eventHandlers={onFailed:function(){n._tones=null}},r.send(t,o),i+a),setTimeout(e.bind(this),r))}.call(this)):(t=this._getDTMFRTPSender())&&(e=t.toneBuffer+e,t.insertDTMF(e,i,a))}},{key:"sendInfo",value:function(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(bh.debug("sendInfo()"),this._status!==Sh.STATUS_CONFIRMED&&this._status!==Sh.STATUS_WAITING_FOR_ACK&&this._status!==Sh.STATUS_1XX_RECEIVED)throw new rh.InvalidStateError(this._status);new ch(this).send(e,t,r)}},{key:"mute",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!1},t=(bh.debug("mute()"),!1),r=!1;!1===this._audioMuted&&e.audio&&(this._audioMuted=t=!0,this._toggleMuteAudio(!0)),!1===this._videoMuted&&e.video&&(this._videoMuted=r=!0,this._toggleMuteVideo(!0)),!0!==t&&!0!==r||this._onmute({audio:t,video:r})}},{key:"unmute",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{audio:!0,video:!0},t=(bh.debug("unmute()"),!1),r=!1;!0===this._audioMuted&&e.audio&&(this._audioMuted=!(t=!0))===this._localHold&&this._toggleMuteAudio(!1),!0===this._videoMuted&&e.video&&(this._videoMuted=!(r=!0))===this._localHold&&this._toggleMuteVideo(!1),!0!==t&&!0!==r||this._onunmute({audio:t,video:r})}},{key:"switchMicrophones",value:function(e){if(bh.debug("switchMicrophones(%s)",e),!this._is_confirmed||!this._trtcLocalStream)throw new rh.InvalidStateError(this._status);if(this._trtcLocalStream)return this._trtcLocalStream.switchDevice("audio",e);throw new rh.NotSupportedError("WebRTC mode not support switchMicrophones")}},{key:"switchSpeaker",value:function(t){var r=this;if(bh.debug("switchSpeaker(%s)",t,this._trtcRemoteStream),!this._is_confirmed)throw new rh.InvalidStateError(this._status);if(this._trtcLocalStream){var e,n=[];for(e in this._trtcRemoteStream)(e=>{Object.prototype.hasOwnProperty.call(r._trtcRemoteStream,e)&&(bh.error("stream",e),n.push(function(){return r._trtcRemoteStream[e].setAudioOutput(t)}))})(e);return Promise.all(n)}throw new rh.NotSupportedError("WebRTC mode not support switchSpeaker")}},{key:"setAudioVolume",value:function(e){if(bh.debug("setAudioVolume(%d)",e),!this._is_confirmed)throw new rh.InvalidStateError(this._status);if(this._trtcLocalStream)for(var t in this._trtcLocalStream.setAudioVolume(e),this._trtcRemoteStream)Object.prototype.hasOwnProperty.call(this._trtcRemoteStream,t)&&this._trtcRemoteStream[t].setAudioVolume(e);throw new rh.NotSupportedError("WebRTC mode not support setAudioVolume")}},{key:"enableAudioVolumeEvaluation",value:function(e,t){if(bh.debug("enableAudioVolumeEvaluation(%d)",e),this._localTRTCClient)return this._localTRTCClient.enableAudioVolumeEvaluation(e,t);throw new rh.InvalidStateError(this._status)}},{key:"hold",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length?arguments[1]:void 0;if(bh.debug("hold()"),this._status!==Sh.STATUS_WAITING_FOR_ACK&&this._status!==Sh.STATUS_CONFIRMED)return!1;if(!0===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!0,this._onhold("local");var n={succeeded:function(){r&&r()},failed:function(){e.terminate({cause:th.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Hold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:n,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:n,extraHeaders:t.extraHeaders}),!0}},{key:"unhold",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},r=1<arguments.length?arguments[1]:void 0;if(bh.debug("unhold()"),this._status!==Sh.STATUS_WAITING_FOR_ACK&&this._status!==Sh.STATUS_CONFIRMED)return!1;if(!1===this._localHold)return!1;if(!this._isReadyToReOffer())return!1;this._localHold=!1,this._onunhold("local");var n={succeeded:function(){r&&r()},failed:function(){e.terminate({cause:th.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Unhold Failed"})}};return t.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:n,extraHeaders:t.extraHeaders}):this._sendReinvite({eventHandlers:n,extraHeaders:t.extraHeaders}),!0}},{key:"renegotiate",value:function(){var e,t=this,r=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=1<arguments.length?arguments[1]:void 0,o=(bh.debug("renegotiate()"),r.rtcOfferConstraints||null);return!(this._status!==Sh.STATUS_WAITING_FOR_ACK&&this._status!==Sh.STATUS_CONFIRMED||!this._isReadyToReOffer()||(e={succeeded:function(){n&&n()},failed:function(){t.terminate({cause:th.causes.WEBRTC_ERROR,status_code:500,reason_phrase:"Media Renegotiation Failed"})}},this._setLocalMediaStatus(),r.useUpdate?this._sendUpdate({sdpOffer:!0,eventHandlers:e,rtcOfferConstraints:o,extraHeaders:r.extraHeaders}):this._sendReinvite({eventHandlers:e,rtcOfferConstraints:o,extraHeaders:r.extraHeaders}),0))}},{key:"refer",value:function(e,t){var r,n,o=this,s=(bh.debug("refer()"),e);if(this._status!==Sh.STATUS_WAITING_FOR_ACK&&this._status!==Sh.STATUS_CONFIRMED)return!1;if(e=this._ua.normalizeTarget(e))return(r=new dh(this)).sendRefer(e,t),n=r.id,(this._referSubscribers[n]=r).on("requestFailed",function(){delete o._referSubscribers[n]}),r.on("accepted",function(){delete o._referSubscribers[n]}),r.on("failed",function(){delete o._referSubscribers[n]}),r;throw new TypeError("Invalid target: ".concat(s))}},{key:"sendRequest",value:function(e,t){return bh.debug("sendRequest()"),this._dialog.sendRequest(e,t)}},{key:"receiveRequest",value:function(e){var t=this;if(bh.debug("receiveRequest()"),e.method===th.CANCEL)this._status!==Sh.STATUS_WAITING_FOR_ANSWER&&this._status!==Sh.STATUS_ANSWERED||(this._status=Sh.STATUS_CANCELED,this._request.reply(487),this._failed("remote",e,th.causes.CANCELED));else switch(e.method){case th.ACK:if(this._status===Sh.STATUS_WAITING_FOR_ACK)if(this._status=Sh.STATUS_CONFIRMED,clearTimeout(this._timers.ackTimer),clearTimeout(this._timers.invite2xxTimer),this._late_sdp){if(!e.body){this.terminate({cause:th.causes.MISSING_SDP,status_code:400});break}var r={originator:"remote",type:"answer",sdp:e.body},n=(bh.debug('emit "sdp"'),this.emit("sdp",r),new RTCSessionDescription({type:"answer",sdp:r.sdp}));this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._connection.setRemoteDescription(n)}).then(function(){t._is_confirmed||t._confirmed("remote",e)}).catch(function(e){t.terminate({cause:th.causes.BAD_MEDIA_DESCRIPTION,status_code:488}),bh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),t.emit("peerconnection:setremotedescriptionfailed",e)})}else this._is_confirmed||this._confirmed("remote",e);break;case th.BYE:this._status===Sh.STATUS_CONFIRMED||this._status===Sh.STATUS_WAITING_FOR_ACK?(e.reply(200),this._ended("remote",e,th.causes.BYE)):this._status===Sh.STATUS_INVITE_RECEIVED||this._status===Sh.STATUS_WAITING_FOR_ANSWER?(e.reply(200),this._request.reply(487,"BYE Received"),this._ended("remote",e,th.causes.BYE)):e.reply(403,"Wrong Status");break;case th.INVITE:this._status===Sh.STATUS_CONFIRMED?e.hasHeader("replaces")?this._receiveReplaces(e):this._receiveReinvite(e):e.reply(403,"Wrong Status");break;case th.INFO:this._status===Sh.STATUS_1XX_RECEIVED||this._status===Sh.STATUS_WAITING_FOR_ANSWER||this._status===Sh.STATUS_ANSWERED||this._status===Sh.STATUS_WAITING_FOR_ACK||this._status===Sh.STATUS_CONFIRMED?(r=e.hasHeader("Content-Type")?e.getHeader("Content-Type").toLowerCase():void 0)&&r.match(/^application\/dtmf-relay/i)?new lh(this).init_incoming(e):void 0!==r?new ch(this).init_incoming(e):e.reply(415):e.reply(403,"Wrong Status");break;case th.UPDATE:this._status===Sh.STATUS_CONFIRMED?this._receiveUpdate(e):e.reply(403,"Wrong Status");break;case th.REFER:this._status===Sh.STATUS_CONFIRMED?this._receiveRefer(e):e.reply(403,"Wrong Status");break;case th.NOTIFY:this._status===Sh.STATUS_CONFIRMED?this._receiveNotify(e):e.reply(403,"Wrong Status");break;default:e.reply(501)}}},{key:"onTransportError",value:function(){bh.warn("onTransportError()"),this._status!==Sh.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:th.causes.CONNECTION_ERROR,cause:th.causes.CONNECTION_ERROR})}},{key:"onRequestTimeout",value:function(){bh.warn("onRequestTimeout()"),this._status!==Sh.STATUS_TERMINATED&&this.terminate({status_code:408,reason_phrase:th.causes.REQUEST_TIMEOUT,cause:th.causes.REQUEST_TIMEOUT})}},{key:"onDialogError",value:function(){bh.warn("onDialogError()"),this._status!==Sh.STATUS_TERMINATED&&this.terminate({status_code:500,reason_phrase:th.causes.DIALOG_ERROR,cause:th.causes.DIALOG_ERROR})}},{key:"newDTMF",value:function(e){bh.debug("newDTMF()"),this.emit("newDTMF",e)}},{key:"newInfo",value:function(e){bh.debug("newInfo()"),this.emit("newInfo",e)}},{key:"_isReadyToReOffer",value:function(){return this._rtcReady?this._dialog?!0!==this._dialog.uac_pending_reply&&!0!==this._dialog.uas_pending_reply||(bh.debug("_isReadyToReOffer() | there is another INVITE/UPDATE transaction in progress"),!1):(bh.debug("_isReadyToReOffer() | session not established yet"),!1):(bh.debug("_isReadyToReOffer() | internal WebRTC status not ready"),!1)}},{key:"_close",value:function(){var e=this;if(bh.debug("close()"),this._localStream&&this._localStream.close(),this._trtcLocalStream&&this._trtcLocalStreamLocallyGenerated&&(bh.debug("close() | closing trtcLocalStream"),Promise.resolve().then(function(){if(e._localTRTCClient)return e._localTRTCClient.unpublish(e._trtcLocalStream)}).then(function(){return!e._localTRTCClient||e._localTRTCClient.leave()}).then(function(){e._trtcLocalStream.close()}).catch(function(e){bh.warn("TRTC leave room failed [error:%o]",e)}).then(function(){bh.debug("TRTC destroy"),e._localTRTCClient&&e._localTRTCClient.destroy()})),this._status!==Sh.STATUS_TERMINATED){if(this._status=Sh.STATUS_TERMINATED,this._connection){for(var t in this._remoteStream)this.emit("removestream",t);try{this._connection.close()}catch(e){bh.warn("close() | error closing the RTCPeerConnection: %o",e)}}for(var r in this._timers)Object.prototype.hasOwnProperty.call(this._timers,r)&&clearTimeout(this._timers[r]);for(var n in clearTimeout(this._sessionTimers.timer),this._dialog&&(this._dialog.terminate(),delete this._dialog),this._earlyDialogs)Object.prototype.hasOwnProperty.call(this._earlyDialogs,n)&&(this._earlyDialogs[n].terminate(),delete this._earlyDialogs[n]);for(var o in this._referSubscribers)Object.prototype.hasOwnProperty.call(this._referSubscribers,o)&&delete this._referSubscribers[o];this._ua.destroyRTCSession(this)}}},{key:"_setInvite2xxTimer",value:function(t,r){var n=ih.T1;this._timers.invite2xxTimer=setTimeout(function e(){this._status===Sh.STATUS_WAITING_FOR_ACK&&(t.reply(200,null,["Contact: ".concat(this._contact)],r),n<ih.T2&&(n*=2)>ih.T2&&(n=ih.T2),this._timers.invite2xxTimer=setTimeout(e.bind(this),n))}.bind(this),n)}},{key:"_setACKTimer",value:function(){var e=this;this._timers.ackTimer=setTimeout(function(){e._status===Sh.STATUS_WAITING_FOR_ACK&&(bh.debug("no ACK received, terminating the session"),clearTimeout(e._timers.invite2xxTimer),e.sendRequest(th.BYE),e._ended("remote",null,th.causes.NO_ACK))},ih.TIMER_H)}},{key:"_createRTCConnection",value:function(e,t){var r=this;this._connection=new RTCPeerConnection(e,t),this._connection.addEventListener("iceconnectionstatechange",function(){"failed"===r._connection.iceConnectionState&&r.terminate({cause:th.causes.RTP_TIMEOUT,status_code:408,reason_phrase:th.causes.RTP_TIMEOUT})}),this._connection.addEventListener("track",function(e){var t,e=e.streams[0];r._remoteStream[e.id]||(t=new mh({mediaStream:e}),r._remoteStream[e.id]=t,bh.debug('emit "addstream" '.concat(e.id)),r.emit("addstream",{stream:t}))}),bh.debug('emit "peerconnection"'),this.emit("peerconnection",{peerconnection:this._connection})}},{key:"_createLocalDescription",value:function(i,t){var a=this;if(bh.debug("createLocalDescription(%s, %o)",i,t),"offer"!==i&&"answer"!==i)throw new Error('createLocalDescription() | invalid type "'.concat(i,'"'));var u=this._connection;return this._rtcReady=!1,Promise.resolve().then(function(){return"offer"===i?u.createOffer(t).catch(function(e){return bh.warn('emit "peerconnection:createofferfailed" [error:%o]',e),a.emit("peerconnection:createofferfailed",e),Promise.reject(e)}):u.createAnswer(t).catch(function(e){return bh.warn('emit "peerconnection:createanswerfailed" [error:%o]',e),a.emit("peerconnection:createanswerfailed",e),Promise.reject(e)})}).then(function(e){return u.setLocalDescription(e).catch(function(e){return a._rtcReady=!0,bh.warn('emit "peerconnection:setlocaldescriptionfailed" [error:%o]',e),a.emit("peerconnection:setlocaldescriptionfailed",e),Promise.reject(e)})}).then(function(){var e=t&&t.iceRestart;return"complete"===u.iceGatheringState&&!e||"gathering"===u.iceGatheringState&&a._iceReady?(a._rtcReady=!0,e={originator:"local",type:i,sdp:u.localDescription.sdp},bh.debug('emit "sdp"'),a.emit("sdp",e),Promise.resolve(e.sdp)):new Promise(function(t){function r(){u.removeEventListener("icecandidate",n),u.removeEventListener("icegatheringstatechange",o),s=!0,a._rtcReady=!0,a._iceReady=!0;var e={originator:"local",type:i,sdp:u.localDescription.sdp};bh.debug('emit "sdp"'),a.emit("sdp",e),t(e.sdp)}var n,o,s=!1;a._iceReady=!1;u.addEventListener("icecandidate",n=function(e){e=e.candidate;e?a.emit("icecandidate",{candidate:e,ready:r}):s||r()}),u.addEventListener("icegatheringstatechange",o=function(){"complete"!==u.iceGatheringState||s||r()})})})}},{key:"_createDialog",value:function(e,t,r){var n="UAS"===t?e.to_tag:e.from_tag,o="UAS"===t?e.from_tag:e.to_tag,n=e.call_id+n+o,o=this._earlyDialogs[n];return r?!!o||((o=new ah(this,e,t,ah.C.STATUS_EARLY)).error?(bh.debug(o.error),this._failed("remote",e,th.causes.INTERNAL_ERROR),!1):(this._earlyDialogs[n]=o,!0)):(this._from_tag=e.from_tag,this._to_tag=e.to_tag,o?(o.update(e,t),this._dialog=o,delete this._earlyDialogs[n],!0):(r=new ah(this,e,t)).error?(bh.debug(r.error),this._failed("remote",e,th.causes.INTERNAL_ERROR),!1):(this._dialog=r,!0))}},{key:"_receiveReinvite",value:function(n){var t=this,e=(bh.debug("receiveReinvite()"),n.hasHeader("Content-Type")?n.getHeader("Content-Type").toLowerCase():void 0),o={request:n,callback:void 0,reject:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(s=!0,e.status_code||403),r=e.reason_phrase||"",e=oh.cloneArray(e.extraHeaders);if(this._status!==Sh.STATUS_CONFIRMED)return!1;if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));n.reply(t,r,e)}.bind(this)},s=!1;function r(e){var t=this,r=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(n,r),this._late_sdp&&(e=this._mangleOffer(e)),n.reply(200,null,r,e,function(){t._status=Sh.STATUS_WAITING_FOR_ACK,t._setInvite2xxTimer(n,e),t._setACKTimer()}),"function"==typeof o.callback&&o.callback()}this.emit("reinvite",o),s||(this._late_sdp=!1,n.body?"application/sdp"!==e?(bh.debug("invalid Content-Type"),n.reply(415)):this._processInDialogSdpOffer(n).then(function(e){t._status!==Sh.STATUS_TERMINATED&&r.call(t,e)}).catch(function(e){bh.warn(e)}):(this._late_sdp=!0,this._remoteHold&&(this._remoteHold=!1,this._onunhold("remote")),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return t._createLocalDescription("offer",t._rtcOfferConstraints)}).then(function(e){r.call(t,e)}).catch(function(){n.reply(500)})))}},{key:"_receiveUpdate",value:function(n){var t=this,e=(bh.debug("receiveUpdate()"),n.hasHeader("Content-Type")?n.getHeader("Content-Type").toLowerCase():void 0),r={request:n,callback:void 0,reject:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=(o=!0,e.status_code||403),r=e.reason_phrase||"",e=oh.cloneArray(e.extraHeaders);if(this._status!==Sh.STATUS_CONFIRMED)return!1;if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));n.reply(t,r,e)}.bind(this)},o=!1;function s(e){var t=["Contact: ".concat(this._contact)];this._handleSessionTimersInIncomingRequest(n,t),n.reply(200,null,t,e),"function"==typeof r.callback&&r.callback()}this.emit("update",r),o||(n.body?"application/sdp"!==e?(bh.debug("invalid Content-Type"),n.reply(415)):this._processInDialogSdpOffer(n).then(function(e){t._status!==Sh.STATUS_TERMINATED&&s.call(t,e)}).catch(function(e){bh.warn(e)}):s.call(this,null))}},{key:"_processInDialogSdpOffer",value:function(t){var r=this;bh.debug("_processInDialogSdpOffer()");var e,n=t.parseSDP(),o=!1,s=d(n.media);try{for(s.s();!(e=s.n()).done;){var i=e.value;if(-1!==Th.indexOf(i.type)){var a=i.direction||n.direction||"sendrecv";if("sendonly"!==a&&"inactive"!==a){o=!1;break}o=!0}}}catch(t){s.e(t)}finally{s.f()}var u={originator:"remote",type:"offer",sdp:t.body},l=(bh.debug('emit "sdp"'),this.emit("sdp",u),new RTCSessionDescription({type:"offer",sdp:u.sdp}));return this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if(r._status===Sh.STATUS_TERMINATED)throw new Error("terminated");return r._connection.setRemoteDescription(l).catch(function(e){throw t.reply(488),bh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),r.emit("peerconnection:setremotedescriptionfailed",e),e})}).then(function(){if(r._status===Sh.STATUS_TERMINATED)throw new Error("terminated");!0===r._remoteHold&&!1===o?(r._remoteHold=!1,r._onunhold("remote")):!1===r._remoteHold&&!0===o&&(r._remoteHold=!0,r._onhold("remote"))}).then(function(){if(r._status===Sh.STATUS_TERMINATED)throw new Error("terminated");return r._createLocalDescription("answer",r._rtcAnswerConstraints).catch(function(e){throw t.reply(500),bh.warn('emit "peerconnection:createtelocaldescriptionfailed" [error:%o]',e),e})}).catch(function(e){bh.warn("_processInDialogSdpOffer() failed [error: %o]",e)}),this._connectionPromiseQueue}},{key:"_receiveRefer",value:function(o){var s,r=this;bh.debug("receiveRefer()"),o.refer_to?o.refer_to.uri.scheme!==th.SIP?(bh.debug("Refer-To header field points to a non-SIP URI scheme"),o.reply(416)):(o.reply(202),s=new ph(this,o.cseq),bh.debug('emit "refer"'),this.emit("refer",{request:o,accept:function(e,t){!function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(e="function"==typeof e?e:null,this._status!==Sh.STATUS_WAITING_FOR_ACK&&this._status!==Sh.STATUS_CONFIRMED)return!1;var r,n=new i(this._ua);n.on("progress",function(e){e=e.response;s.notify(e.status_code,e.reason_phrase)}),n.on("accepted",function(e){e=e.response;s.notify(e.status_code,e.reason_phrase)}),n.on("_failed",function(e){var t=e.message,e=e.cause;t?s.notify(t.status_code,t.reason_phrase):s.notify(487,e)}),o.refer_to.uri.hasHeader("replaces")&&(r=decodeURIComponent(o.refer_to.uri.getHeader("replaces")),t.extraHeaders=oh.cloneArray(t.extraHeaders),t.extraHeaders.push("Replaces: ".concat(r))),n.connect(o.refer_to.uri.toAor(),t,e)}.call(r,e,t)},reject:function(){!function(){s.notify(603)}.call(r)}})):(bh.debug("no Refer-To header field present in REFER"),o.reply(400))}},{key:"_receiveNotify",value:function(e){if(bh.debug("receiveNotify()"),e.event||e.reply(400),"refer"===e.event.event){var t;if(e.event.params&&e.event.params.id)t=e.event.params.id,t=this._referSubscribers[t];else{if(1!==Object.keys(this._referSubscribers).length)return void e.reply(400,"Missing event id parameter");t=this._referSubscribers[Object.keys(this._referSubscribers)[0]]}t?(t.receiveNotify(e),e.reply(200)):e.reply(481,"Subscription does not exist")}else e.reply(489)}},{key:"_receiveReplaces",value:function(n){var t=this;bh.debug("receiveReplaces()"),this.emit("replaces",{request:n,accept:function(e){!function(e){var t=this;if(this._status!==Sh.STATUS_WAITING_FOR_ACK&&this._status!==Sh.STATUS_CONFIRMED)return!1;var r=new i(this._ua);r.on("confirmed",function(){t.terminate()}),r.init_incoming(n,e)}.call(t,e)},reject:function(){!function(){bh.debug("Replaced INVITE rejected by the user"),n.reply(486)}.call(t)}})}},{key:"_sendInitialRequest",value:function(e,r,t){var n=this,o=new uh(this._ua,this._request,{onRequestTimeout:function(){n.onRequestTimeout()},onTransportError:function(){n.onTransportError()},onAuthenticated:function(e){n._request=e},onReceiveResponse:function(e){n._receiveInviteResponse(e)}});Promise.resolve().then(function(){return t||(e.audio||e.video?new fh(e).initialize().catch(function(e){if(n._status===Sh.STATUS_TERMINATED)throw new Error("terminated");throw n._failed("local",null,th.causes.USER_DENIED_MEDIA_ACCESS),bh.warn('emit "getusermediafailed" [error:%o]',e),n.emit("getusermediafailed",e),e}):void 0)}).then(function(t){if(n._status===Sh.STATUS_TERMINATED)throw new Error("terminated");return(n._localStream=t).mediaStream&&t.mediaStream.getTracks().forEach(function(e){n._connection.addTrack(e,t.mediaStream)}),n._connecting(n._request),n._createLocalDescription("offer",r).catch(function(e){throw n._failed("local",null,th.causes.WEBRTC_ERROR),e})}).then(function(e){if(n._is_canceled||n._status===Sh.STATUS_TERMINATED)throw new Error("terminated");n._request.body=e,n._status=Sh.STATUS_INVITE_SENT,bh.debug('emit "sending" [request:%o]',n._request),n.emit("sending",{request:n._request}),o.send()}).catch(function(e){n._status!==Sh.STATUS_TERMINATED&&bh.warn(e)})}},{key:"_sendTRTCInitialRequest",value:function(){var t=this,e=new uh(this._ua,this._request,{onRequestTimeout:function(){t.onRequestTimeout()},onTransportError:function(){t.onTransportError()},onAuthenticated:function(e){t._request=e},onReceiveResponse:function(e){t._receiveInviteResponse(e)}});Promise.resolve().then(function(){if(t._status===Sh.STATUS_TERMINATED)throw new Error("terminated");bh.debug("connecting"),t._connecting(t._request),t._status=Sh.STATUS_INVITE_SENT,bh.debug('emit "sending" [request:%o]',t._request),t.emit("sending",{request:t._request}),e.send()}).catch(function(e){t._status!==Sh.STATUS_TERMINATED&&bh.warn(e)})}},{key:"_inviteToTRTCRoom",value:function(o,e){var s=this;this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return s._joinTRTCRoom(e,function(e){s._acceptAndTerminate(o),s._failed("system",e.toString(),th.causes.WEBRTC_ERROR)})}).then(function(){s._rtcReady=!0,"incoming"===s._direction&&(s._handleSessionTimersInIncomingResponse(o),s._accepted("remote",o),s.sendRequest(th.ACK),s._confirmed("local",null))}).catch(function(e){var t,r,n;if(s._status!==Sh.STATUS_TERMINATED)throw r=t=th.causes.WEBRTC_ERROR,(n=["NotFoundError","NotAllowedError","NotReadableError","OverconstrainedError","AbortError"].includes(e.name))&&(r=t=th.causes.USER_DENIED_MEDIA_ACCESS,bh.warn('emit "getusermediafailed" [error:%o]',e),s.emit("getusermediafailed",e)),"RtcError"===e.name&&bh.error("TRTC error",e.toString()),!n&&e.message&&(r=e.message),s._acceptAndTerminate(o,480,r),s._failed("local",o,t),e}).then(function(){bh.debug("trtc done")})}},{key:"_joinTRTCRoom",value:function(e,r){var n,t,o,s,i,a,u,l,c,p,h=this;if(!this._trtc_already_join)return this._trtc_already_join=!0,n=this.tracer.startSpan("trtc",void 0),t=e.sdkAppId,i=e.userSig,a=e.privateMapKey,l=e.proxy,c={sdkAppId:t,userId:o=e.userId,roomId:s=e.roomId,strRoomId:u=e.strRoomId,direction:this._direction,uri:this._ua.configuration.uri.toString(),proxy:l},bh.debug("TRTC start",c),n.setAttributes(c),p=Xd.createClient({mode:"rtc",sdkAppId:Number(t),userId:o,userSig:i,useStringRoomId:!s}),l&&p.setProxyServer({websocketProxy:"wss://".concat(l)}),this._trtcLocalStream=Xd.createStream(_({userId:o,audio:!this._trtcLocalStreamConfig.screenAudio,video:!1},this._trtcLocalStreamConfig)),this._localTRTCClient=p,this._localUserId=o,this._ua.configuration.trtc_proxy_server&&p.setProxyServer(this._ua.configuration.trtc_proxy_server),this._ua.configuration.trtc_turn_server&&p.setTurnServer(this._ua.configuration.trtc_turn_server),p.on("stream-added",function(e){bh.debug("TRTC stream-added, id:%s",e.stream.getId()),h.emit("stream-added",e),p.subscribe(e.stream,{audio:!0,video:Boolean(h._trtcLocalStream.video)}).catch(function(e){h._status!==Sh.STATUS_TERMINATED&&(bh.error("TRTC subscribe stream errorCode: %d",e.getCode()),r)&&r(e)})}),p.on("stream-subscribed",function(e){var t=e.stream;bh.debug("TRTC stream-subscribed, id:%o",t.getId()),h._trtcRemoteStream[t.getId()]=t,h.emit("addstream",e),h.emit("stream-subscribed",e),0<h.listenerCount("stream-subscribed")?bh.debug("stream-subscribe listener count greater than 0"):t.play(h._getStreamPlayElement(o)).then(function(){bh.debug("TRTC play stream success, id:%o",t.getId())}).catch(function(e){h._status!==Sh.STATUS_TERMINATED&&(bh.error("TRTC play stream errorCode: %d",e.getCode()),r)&&r(e)})}),p.on("stream-removed",function(e){var t=e.stream;delete h._trtcRemoteStream[t.getId()],h.emit("stream-removed",e),h.emit("removestream",e)}),p.on("stream-updated",function(e){var t=e.stream;h._trtcRemoteStream[t.getId()]=t,h.emit("stream-updated",e)}),p.on("error",function(e){var t;h._status!==Sh.STATUS_TERMINATED&&(t=e.getCode(),bh.error("TRTC errorCode: %o",t),h._failed("local",e.toString(),th.causes.WEBRTC_ERROR))}),p.on("audio-volume",function(e){e&&Array.isArray(e.result)&&(e=e.result.map(function(e){return _(_({},e),{},{originator:e.userId===h._localUserId?"local":"remote"})}),h.emit("audiovolume",{result:e}))}),p.on("network-quality",function(e){h.emit("networkquality",e)}),Promise.resolve().then(function(){var t=h.tracer.startSpan("trtc/join",{attributes:c},_h.setSpan(vh.active(),n));return Promise.all([t,h._trtcLocalStream.initialize().then(function(){h._trtcLocalStreamLocallyGenerated=!0}),h._localTRTCClient.join({roomId:s||u,privateMapKey:a}).then(function(){bh.debug("TRTC join success"),t.end()}).catch(function(e){return t.recordException(e),t.end(),Promise.reject(e)})])}).then(function(){var t;if(bh.debug("TRTC join and initialize success"),h._status!==Sh.STATUS_TERMINATED)return 0<h.listenerCount("audiovolume")&&h._trtcLocalStream.play(h._getStreamPlayElement(o)),bh.debug("TRTC join success then publish"),t=h.tracer.startSpan("trtc/publish",{attributes:c},_h.setSpan(vh.active(),n)),h._localTRTCClient.publish(h._trtcLocalStream).then(function(){t.end()}).catch(function(e){return t.recordException(e),t.end(),Promise.reject(e)});bh.debug("TRTC join success after terminate");try{h._trtcLocalStream.close(),h._localTRTCClient.leave().then(function(){h._localTRTCClient.destroy()}).catch(function(){h._localTRTCClient.destroy()})}catch(t){bh.debug("trtc initial or join success then close error, message: ".concat(t.message))}}).then(function(){bh.debug("TRTC publish success"),n.end()}).catch(function(e){bh.warn("trtc join failed, status: ".concat(h._status,", error message: ").concat(e.toString()));var t=oh.isFunction(e.getCode)?e.getCode():"0";n.recordException(e),n.setAttributes({errorName:e.name,errorCode:t,errorMessage:e.toString()}),n.end();try{h._trtcLocalStream.close(),h._localTRTCClient.leave().then(function(){h._localTRTCClient.destroy()})}catch(e){bh.debug("trtc join failed then close or destroy error, error: ".concat(e.message))}if(h._status!==Sh.STATUS_TERMINATED)throw e});bh.debug("ignore duplicate join trtc room")}},{key:"_pureSignalingRoom",value:function(){}},{key:"_getStreamPlayElement",value:function(e){var e="".concat(e,"-rtc-session-audio"),t=document.getElementById(e);return bh.debug("get audio container",t),t||(bh.debug("create audio container"),(t=document.createElement("div")).setAttribute("id",e),t.setAttribute("style","width:0;height:0;overflow:hidden"),document.body.appendChild(t),bh.debug("create audio container id:%o",e)),t}},{key:"_getDTMFRTPSender",value:function(){var e=this._connection.getSenders().find(function(e){return e.track&&"audio"===e.track.kind});if(e&&e.dtmf)return e.dtmf;bh.warn("sendDTMF() | no local audio track to send DTMF with")}},{key:"_receiveInviteResponse",value:function(t){var e,r,n,o,s,i,a,u,l,c,p,h,d,f,m,g,y,_=this;if(bh.debug("receiveInviteResponse()"),this._dialog&&200<=t.status_code&&t.status_code<=299)return this._dialog.id.call_id===t.call_id&&this._dialog.id.local_tag===t.from_tag&&this._dialog.id.remote_tag===t.to_tag?void this.sendRequest(th.ACK):void 0!==(e=new ah(this,t,"UAC")).error?void bh.debug(e.error):(this.sendRequest(th.ACK),void this.sendRequest(th.BYE));if(this._is_canceled)100<=t.status_code&&t.status_code<200?this._request.cancel(this._cancel_reason):200<=t.status_code&&t.status_code<299&&this._acceptAndTerminate(t);else if(this._status===Sh.STATUS_INVITE_SENT||this._status===Sh.STATUS_1XX_RECEIVED)switch(!0){case/^100$/.test(t.status_code):this._status=Sh.STATUS_1XX_RECEIVED;break;case/^1[0-9]{2}$/.test(t.status_code):t.to_tag?t.hasHeader("contact")&&!this._createDialog(t,"UAC",!0)||(this._status=Sh.STATUS_1XX_RECEIVED,!this._is_mini_program&&this._use_trtc?(this._progress("remote",t),i=t.getHeader("X-TRTC-SDKAPPID"),f=t.getHeader("X-TRTC-USERID"),g=parseInt(t.getHeader("X-TRTC-ROOMID"),10),v=t.getHeader("X-TRTC-STRROOMID"),r=t.getHeader("X-TRTC-USERSIG"),n=t.getHeader("X-TRTC-PRIVATEMAPKEY"),o=t.getHeader("X-TCCC-IVR"),s=t.getHeader("X-TRTC-PROXY"),bh.debug("".concat(t.status_code," with trtc params"),{sdkAppId:i,userId:f,roomId:g,strRoomId:v,userSig:r,privateMapKey:n,isIVRCall:o,proxy:s}),i&&f&&(g||v)&&r?this._inviteToTRTCRoom(t,{sdkAppId:i,userId:f,roomId:g,strRoomId:v,userSig:r,privateMapKey:n,proxy:s}):this._is_mini_program||o?bh.debug("pure signal mode, no trtc params in 1xx response"):(this._acceptAndTerminate(t,400,th.causes.MISSING_SDP),this._failed("remote",t,th.causes.BAD_MEDIA_DESCRIPTION))):t.body?(i={originator:"remote",type:"answer",sdp:t.body},bh.debug('emit "sdp"'),this.emit("sdp",i),a=new RTCSessionDescription({type:"answer",sdp:i.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return _._connection.setRemoteDescription(a)}).then(function(){return _._progress("remote",t)}).catch(function(e){bh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),_.emit("peerconnection:setremotedescriptionfailed",e)})):this._progress("remote",t)):bh.debug("1xx response received without to tag");break;case/^2[0-9]{2}$/.test(t.status_code):(this._status=Sh.STATUS_CONFIRMED,t.body||this._use_trtc)?this._createDialog(t,"UAC")&&(this._use_trtc?(this._handleSessionTimersInIncomingResponse(t),this._accepted("remote",t),this.sendRequest(th.ACK),this._confirmed("local",null),u=t.getHeader("X-TRTC-SDKAPPID"),l=t.getHeader("X-TRTC-USERID"),c=parseInt(t.getHeader("X-TRTC-ROOMID"),10),p=t.getHeader("X-TRTC-STRROOMID"),h=t.getHeader("X-TRTC-USERSIG"),d=t.getHeader("X-TRTC-PRIVATEMAPKEY"),f=t.getHeader("X-TCCC-IVR"),m=t.getHeader("X-TRTC-PROXY"),bh.debug("".concat(t.status_code," with trtc params"),{sdkAppId:u,userId:l,roomId:c,strRoomId:p,userSig:h,privateMapKey:d,isIVRCall:f,proxy:m}),u&&l&&(c||p)&&h?Promise.resolve().then(function(){return _._joinTRTCRoom({sdkAppId:u,userId:l,roomId:c,strRoomId:p,privateMapKey:d,userSig:h,proxy:m},function(e){_.terminate({status_code:480,cause:th.causes.WEBRTC_ERROR,reason_phrase:"TRTC Error"}),_._failed("system",e.toString(),th.causes.WEBRTC_ERROR)})}).catch(function(e){var t,r,n;_._status!==Sh.STATUS_TERMINATED&&(r=t=th.causes.WEBRTC_ERROR,(n=["NotFoundError","NotAllowedError","NotReadableError","OverconstrainedError","AbortError"].includes(e.name))&&(r=t=th.causes.USER_DENIED_MEDIA_ACCESS,bh.warn('emit "getusermediafailed" [error:%o]',e),_.emit("getusermediafailed",e)),"RtcError"===e.name&&bh.error("TRTC error",e.toString()),!n&&e.message&&(r=e.message),_.terminate({status_code:480,cause:t,reason_phrase:r}))}):this._is_mini_program||f?bh.debug("pure signal mode, no trtc params in 200OK"):bh.debug("missing trtc params in 200OK")):(g={originator:"remote",type:"answer",sdp:t.body},bh.debug('emit "sdp"'),this.emit("sdp",g),y=new RTCSessionDescription({type:"answer",sdp:g.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){if("stable"===_._connection.signalingState)return _._connection.createOffer(_._rtcOfferConstraints).then(function(e){return _._connection.setLocalDescription(e)}).catch(function(e){_._acceptAndTerminate(t,500,e.toString()),_._failed("local",t,th.causes.WEBRTC_ERROR)})}).then(function(){_._connection.setRemoteDescription(y).then(function(){_._handleSessionTimersInIncomingResponse(t),_._accepted("remote",t),_.sendRequest(th.ACK),_._confirmed("local",null)}).catch(function(e){_._acceptAndTerminate(t,488,"Not Acceptable Here"),_._failed("remote",t,th.causes.BAD_MEDIA_DESCRIPTION),bh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),_.emit("peerconnection:setremotedescriptionfailed",e)})}))):(this._acceptAndTerminate(t,400,th.causes.MISSING_SDP),this._failed("remote",t,th.causes.BAD_MEDIA_DESCRIPTION));break;default:var v=oh.sipErrorCause(t.status_code);this._failed("remote",t,v)}}},{key:"_sendReinvite",value:function(){var r=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=(bh.debug("sendReinvite()"),oh.cloneArray(e.extraHeaders)),o=oh.cloneObject(e.eventHandlers),t=e.rtcOfferConstraints||this._rtcOfferConstraints||null,s=!1;function i(e){o.failed&&o.failed(e)}n.push("Contact: ".concat(this._contact)),n.push("Content-Type: application/sdp"),this._sessionTimers.running&&n.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(this._sessionTimers.refresher?"uac":"uas")),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return r._createLocalDescription("offer",t)}).then(function(e){var t={originator:"local",type:"offer",sdp:e=r._mangleOffer(e)};bh.debug('emit "sdp"'),r.emit("sdp",t),r.sendRequest(th.INVITE,{extraHeaders:n,body:e,eventHandlers:{onSuccessResponse:function(e){(function(e){var t,r,n=this;this._status===Sh.STATUS_TERMINATED||(this.sendRequest(th.ACK),s)||(this._handleSessionTimersInIncomingResponse(e),e.body&&e.hasHeader("Content-Type")&&"application/sdp"===e.getHeader("Content-Type").toLowerCase()?(t={originator:"remote",type:"answer",sdp:e.body},bh.debug('emit "sdp"'),this.emit("sdp",t),r=new RTCSessionDescription({type:"answer",sdp:t.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return n._connection.setRemoteDescription(r)}).then(function(){o.succeeded&&o.succeeded(e)}).catch(function(e){i.call(n),bh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),n.emit("peerconnection:setremotedescriptionfailed",e)})):i.call(this))}).call(r,e),s=!0},onErrorResponse:function(e){i.call(r,e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})}).catch(function(){i()})}},{key:"_sendUpdate",value:function(){var r=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},n=(bh.debug("sendUpdate()"),oh.cloneArray(e.extraHeaders)),o=oh.cloneObject(e.eventHandlers),t=e.rtcOfferConstraints||this._rtcOfferConstraints||null,s=e.sdpOffer||!1,i=!1;function a(e){var t,r,n=this;this._status===Sh.STATUS_TERMINATED||i||(this._handleSessionTimersInIncomingResponse(e),s?e.body&&e.hasHeader("Content-Type")&&"application/sdp"===e.getHeader("Content-Type").toLowerCase()?(t={originator:"remote",type:"answer",sdp:e.body},bh.debug('emit "sdp"'),this.emit("sdp",t),r=new RTCSessionDescription({type:"answer",sdp:t.sdp}),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return n._connection.setRemoteDescription(r)}).then(function(){o.succeeded&&o.succeeded(e)}).catch(function(e){u.call(n),bh.warn('emit "peerconnection:setremotedescriptionfailed" [error:%o]',e),n.emit("peerconnection:setremotedescriptionfailed",e)})):u.call(this):o.succeeded&&o.succeeded(e))}function u(e){o.failed&&o.failed(e)}n.push("Contact: ".concat(this._contact)),this._sessionTimers.running&&n.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(this._sessionTimers.refresher?"uac":"uas")),s?(n.push("Content-Type: application/sdp"),this._connectionPromiseQueue=this._connectionPromiseQueue.then(function(){return r._createLocalDescription("offer",t)}).then(function(e){var t={originator:"local",type:"offer",sdp:e=r._mangleOffer(e)};bh.debug('emit "sdp"'),r.emit("sdp",t),r.sendRequest(th.UPDATE,{extraHeaders:n,body:e,eventHandlers:{onSuccessResponse:function(e){a.call(r,e),i=!0},onErrorResponse:function(e){u.call(r,e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})}).catch(function(){u.call(r)})):this.sendRequest(th.UPDATE,{extraHeaders:n,eventHandlers:{onSuccessResponse:function(e){a.call(r,e)},onErrorResponse:function(e){u.call(r,e)},onTransportError:function(){r.onTransportError()},onRequestTimeout:function(){r.onRequestTimeout()},onDialogError:function(){r.onDialogError()}}})}},{key:"_acceptAndTerminate",value:function(e,t,r){bh.debug("acceptAndTerminate()");var n=[];t&&(r=r||th.REASON_PHRASE[t]||"",n.push("Reason: SIP ;cause=".concat(t,'; text="').concat(r,'"'))),(this._dialog||this._createDialog(e,"UAC"))&&(this.sendRequest(th.ACK),this.sendRequest(th.BYE,{extraHeaders:n})),this._status=Sh.STATUS_TERMINATED}},{key:"_mangleOffer",value:function(e){if(!this._localHold&&!this._remoteHold)return e;if(e=Qd.parse(e),this._localHold&&!this._remoteHold){bh.debug("mangleOffer() | me on hold, mangling offer");var t,r=d(e.media);try{for(r.s();!(t=r.n()).done;){var n=t.value;-1!==Th.indexOf(n.type)&&(!n.direction||"sendrecv"===n.direction?n.direction="sendonly":"recvonly"===n.direction&&(n.direction="inactive"))}}catch(e){r.e(e)}finally{r.f()}}else if(this._localHold&&this._remoteHold){bh.debug("mangleOffer() | both on hold, mangling offer");var o,s=d(e.media);try{for(s.s();!(o=s.n()).done;){var i=o.value;-1!==Th.indexOf(i.type)&&(i.direction="inactive")}}catch(e){s.e(e)}finally{s.f()}}else if(this._remoteHold){bh.debug("mangleOffer() | remote on hold, mangling offer");var a,u=d(e.media);try{for(u.s();!(a=u.n()).done;){var l=a.value;-1!==Th.indexOf(l.type)&&(!l.direction||"sendrecv"===l.direction?l.direction="recvonly":"recvonly"===l.direction&&(l.direction="inactive"))}}catch(e){u.e(e)}finally{u.f()}}return Qd.write(e)}},{key:"_setLocalMediaStatus",value:function(){var e=!0,t=!0;(this._localHold||this._remoteHold)&&(t=e=!1),this._audioMuted&&(e=!1),this._videoMuted&&(t=!1),this._toggleMuteAudio(!e),this._toggleMuteVideo(!t)}},{key:"_handleSessionTimersInIncomingRequest",value:function(e,t){this._sessionTimers.enabled&&(e=e.session_expires&&e.session_expires>=th.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,e.session_expires_refresher||"uas"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,"uas"),t.push("Session-Expires: ".concat(this._sessionTimers.currentExpires,";refresher=").concat(e)),this._sessionTimers.refresher="uas"===e,this._runSessionTimer())}},{key:"_handleSessionTimersInIncomingResponse",value:function(e){this._sessionTimers.enabled&&(e=e.session_expires&&e.session_expires>=th.MIN_SESSION_EXPIRES?(this._sessionTimers.currentExpires=e.session_expires,e.session_expires_refresher||"uac"):(this._sessionTimers.currentExpires=this._sessionTimers.defaultExpires,"uac"),this._sessionTimers.refresher="uac"===e,this._runSessionTimer())}},{key:"_runSessionTimer",value:function(){var e=this,t=this._sessionTimers.currentExpires;this._sessionTimers.running=!0,clearTimeout(this._sessionTimers.timer),this._sessionTimers.refresher?this._sessionTimers.timer=setTimeout(function(){e._status!==Sh.STATUS_TERMINATED&&e._isReadyToReOffer()&&(bh.debug("runSessionTimer() | sending session refresh request"),e._sessionTimers.refreshMethod===th.UPDATE?e._sendUpdate():e._sendReinvite())},500*t):this._sessionTimers.timer=setTimeout(function(){e._status!==Sh.STATUS_TERMINATED&&(bh.warn("runSessionTimer() | timer expired, terminating the session"),e.terminate({cause:th.causes.REQUEST_TIMEOUT,status_code:408,reason_phrase:"Session Timer Expired"}))},1100*t)}},{key:"_toggleMuteAudio",value:function(e){if(this._use_trtc){if(this._trtcLocalStream)return e?this._trtcLocalStream.muteAudio():this._trtcLocalStream.unmuteAudio();throw new rh.InvalidStateError(this._status)}var t,r=d(this._connection.getSenders().filter(function(e){return e.track&&"audio"===e.track.kind}));try{for(r.s();!(t=r.n()).done;)t.value.track.enabled=!e}catch(e){r.e(e)}finally{r.f()}}},{key:"_toggleMuteVideo",value:function(e){if(this._use_trtc){if(this._trtcLocalStream)return e?this._trtcLocalStream.muteVideo():this._trtcLocalStream.unmuteVideo();throw new rh.InvalidStateError(this._status)}var t,r=d(this._connection.getSenders().filter(function(e){return e.track&&"video"===e.track.kind}));try{for(r.s();!(t=r.n()).done;)t.value.track.enabled=!e}catch(e){r.e(e)}finally{r.f()}}},{key:"_newRTCSession",value:function(e,t){bh.debug("newRTCSession()"),this._ua.newRTCSession(this,{originator:e,session:this,request:t})}},{key:"_connecting",value:function(e){bh.debug("session connecting"),bh.debug('emit "connecting"'),this.emit("connecting",{request:e})}},{key:"_progress",value:function(e,t){bh.debug("session progress"),bh.debug('emit "progress"'),this.emit("progress",{originator:e,response:t||null})}},{key:"_accepted",value:function(e,t){bh.debug("session accepted"),this._start_time=new Date,bh.debug('emit "accepted"'),this.emit("accepted",{originator:e,response:t||null})}},{key:"_confirmed",value:function(e,t){bh.debug("session confirmed"),this._is_confirmed=!0,bh.debug('emit "confirmed"'),this.emit("confirmed",{originator:e,ack:t||null})}},{key:"_ended",value:function(e,t,r){bh.debug("session ended"),this._end_time=new Date,this._close(),bh.debug('emit "ended"'),this.emit("ended",{originator:e,message:t||null,cause:r})}},{key:"_failed",value:function(e,t,r){bh.debug("session failed"),bh.debug('emit "_failed"'),this.emit("_failed",{originator:e,message:t||null,cause:r}),this._close(),bh.debug('emit "failed"'),this.emit("failed",{originator:e,message:t||null,cause:r})}},{key:"_onhold",value:function(e){bh.debug("session onhold"),this._setLocalMediaStatus(),bh.debug('emit "hold"'),this.emit("hold",{originator:e})}},{key:"_onunhold",value:function(e){bh.debug("session onunhold"),this._setLocalMediaStatus(),bh.debug('emit "unhold"'),this.emit("unhold",{originator:e})}},{key:"_onmute",value:function(e){var t=e.audio,e=e.video;bh.debug("session onmute"),this._setLocalMediaStatus(),bh.debug('emit "muted"'),this.emit("muted",{audio:t,video:e})}},{key:"_onunmute",value:function(e){var t=e.audio,e=e.video;bh.debug("session onunmute"),this._setLocalMediaStatus(),bh.debug('emit "unmuted"'),this.emit("unmuted",{audio:t,video:e})}}],[{key:"C",get:function(){return Sh}}])})(),Eh=$.EventEmitter,Ah=Wl,Oh=s,xh=vc,Ch=F(),Rh=Wc,Nh=j,Ih=B(),Ph=new Ah("Message"),Uh=(()=>{function r(e){var t;return l(this,r),(t=u(this,r))._ua=e,t._request=null,t._closed=!1,t._direction=null,t._local_identity=null,t._remote_identity=null,t._is_replied=!1,t._data={},t}return m(r,Eh),p(r,[{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}},{key:"send",value:function(e,t){var r=this,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},o=e;if(void 0===e||void 0===t)throw new TypeError("Not enough arguments");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(o));var s,o=Ch.cloneArray(n.extraHeaders),i=Ch.cloneObject(n.eventHandlers),a=n.contentType||"text/plain",u={};for(s in n.fromUserName&&(u.from_uri=new Ih("sip",n.fromUserName,this._ua.configuration.uri.host),o.push("P-Preferred-Identity: ".concat(this._ua.configuration.uri.toString()))),n.fromDisplayName&&(u.from_display_name=n.fromDisplayName),i)Object.prototype.hasOwnProperty.call(i,s)&&this.on(s,i[s]);o.push("Content-Type: ".concat(a)),this._request=new xh.OutgoingRequest(Oh.MESSAGE,e,this._ua,u,o),t&&(this._request.body=t);n=new Rh(this._ua,this._request,{onRequestTimeout:function(){r._onRequestTimeout()},onTransportError:function(){r._onTransportError()},onReceiveResponse:function(e){r._receiveResponse(e)}});this._newMessage("local",this._request),n.send()}},{key:"init_incoming",value:function(e){this._request=e,this._newMessage("remote",e),this._is_replied||(this._is_replied=!0,e.reply(200)),this._close()}},{key:"accept",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=Ch.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Nh.NotSupportedError('"accept" not supported for outgoing Message');if(this._is_replied)throw new Error("incoming Message already replied");this._is_replied=!0,this._request.reply(200,null,t,e)}},{key:"reject",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.status_code||480,r=e.reason_phrase,n=Ch.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Nh.NotSupportedError('"reject" not supported for outgoing Message');if(this._is_replied)throw new Error("incoming Message already replied");if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));this._is_replied=!0,this._request.reply(t,r,n,e)}},{key:"_receiveResponse",value:function(e){if(!this._closed)switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):this._succeeded("remote",e);break;default:var t=Ch.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,Oh.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,Oh.causes.CONNECTION_ERROR)}},{key:"_close",value:function(){this._closed=!0,this._ua.destroyMessage(this)}},{key:"_newMessage",value:function(e,t){"remote"===e?(this._direction="incoming",this._local_identity=t.to,this._remote_identity=t.from):"local"===e&&(this._direction="outgoing",this._local_identity=t.from,this._remote_identity=t.to),this._ua.newMessage(this,{originator:e,message:this,request:t})}},{key:"_failed",value:function(e,t,r){Ph.debug("MESSAGE failed"),this._close(),Ph.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:r})}},{key:"_succeeded",value:function(e,t){Ph.debug("MESSAGE succeeded"),this._close(),Ph.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}}])})(),kh=$.EventEmitter,Lh=Wl,jh=s,Dh=vc,Mh=F(),Vh=Wc,Bh=j,Fh=new Lh("Options"),qh=(()=>{function r(e){var t;return l(this,r),(t=u(this,r))._ua=e,t._request=null,t._closed=!1,t._direction=null,t._local_identity=null,t._remote_identity=null,t._is_replied=!1,t._data={},t}return m(r,kh),p(r,[{key:"direction",get:function(){return this._direction}},{key:"local_identity",get:function(){return this._local_identity}},{key:"remote_identity",get:function(){return this._remote_identity}},{key:"send",value:function(e,t){var r=this,n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},o=e;if(void 0===e)throw new TypeError("A target is required for OPTIONS");if(!(e=this._ua.normalizeTarget(e)))throw new TypeError("Invalid target: ".concat(o));var s,o=Mh.cloneArray(n.extraHeaders),i=Mh.cloneObject(n.eventHandlers),n=n.contentType||"application/sdp";for(s in i)Object.prototype.hasOwnProperty.call(i,s)&&this.on(s,i[s]);o.push("Content-Type: ".concat(n)),this._request=new Dh.OutgoingRequest(jh.OPTIONS,e,this._ua,null,o),t&&(this._request.body=t);n=new Vh(this._ua,this._request,{onRequestTimeout:function(){r._onRequestTimeout()},onTransportError:function(){r._onTransportError()},onReceiveResponse:function(e){r._receiveResponse(e)}});this._newOptions("local",this._request),n.send()}},{key:"init_incoming",value:function(e){this._request=e,this._newOptions("remote",e),this._is_replied||(this._is_replied=!0,e.reply(200)),this._close()}},{key:"accept",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=Mh.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Bh.NotSupportedError('"accept" not supported for outgoing Options');if(this._is_replied)throw new Error("incoming Options already replied");this._is_replied=!0,this._request.reply(200,null,t,e)}},{key:"reject",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.status_code||480,r=e.reason_phrase,n=Mh.cloneArray(e.extraHeaders),e=e.body;if("incoming"!==this._direction)throw new Bh.NotSupportedError('"reject" not supported for outgoing Options');if(this._is_replied)throw new Error("incoming Options already replied");if(t<300||700<=t)throw new TypeError("Invalid status_code: ".concat(t));this._is_replied=!0,this._request.reply(t,r,n,e)}},{key:"_receiveResponse",value:function(e){if(!this._closed)switch(!0){case/^1[0-9]{2}$/.test(e.status_code):break;case/^2[0-9]{2}$/.test(e.status_code):this._succeeded("remote",e);break;default:var t=Mh.sipErrorCause(e.status_code);this._failed("remote",e,t)}}},{key:"_onRequestTimeout",value:function(){this._closed||this._failed("system",null,jh.causes.REQUEST_TIMEOUT)}},{key:"_onTransportError",value:function(){this._closed||this._failed("system",null,jh.causes.CONNECTION_ERROR)}},{key:"_close",value:function(){this._closed=!0,this._ua.destroyMessage(this)}},{key:"_newOptions",value:function(e,t){"remote"===e?(this._direction="incoming",this._local_identity=t.to,this._remote_identity=t.from):"local"===e&&(this._direction="outgoing",this._local_identity=t.from,this._remote_identity=t.to),this._ua.newOptions(this,{originator:e,message:this,request:t})}},{key:"_failed",value:function(e,t,r){Fh.debug("OPTIONS failed"),this._close(),Fh.debug('emit "failed"'),this.emit("failed",{originator:e,response:t||null,cause:r})}},{key:"_succeeded",value:function(e,t){Fh.debug("OPTIONS succeeded"),this._close(),Fh.debug('emit "succeeded"'),this.emit("succeeded",{originator:e,response:t})}}])})(),Hh={},Gh=Wl,zh=F(),Kh=V(),Yh=new Gh("Socket"),Wh=(Hh.isSocket=function(t){if(Array.isArray(t))return!1;if(void 0===t)return Yh.warn("undefined JsSIP.Socket instance"),!1;try{if(!zh.isString(t.url))throw Yh.warn("missing or invalid JsSIP.Socket url property"),new Error("Missing or invalid JsSIP.Socket url property");if(!zh.isString(t.via_transport))throw Yh.warn("missing or invalid JsSIP.Socket via_transport property"),new Error("Missing or invalid JsSIP.Socket via_transport property");if(-1===Kh.parse(t.sip_uri,"SIP_URI"))throw Yh.warn("missing or invalid JsSIP.Socket sip_uri property"),new Error("missing or invalid JsSIP.Socket sip_uri property")}catch(t){return!1}try{["connect","disconnect","send"].forEach(function(e){if(!zh.isFunction(t[e]))throw Yh.warn("missing or invalid JsSIP.Socket method: ".concat(e)),new Error("Missing or invalid JsSIP.Socket method: ".concat(e))})}catch(t){return!1}return!0},Hh),$h=s,Jh=new Wl("Transport"),Xh={STATUS_CONNECTED:0,STATUS_CONNECTING:1,STATUS_DISCONNECTED:2,SOCKET_STATUS_READY:0,SOCKET_STATUS_ERROR:1,recovery_options:{min_interval:$h.CONNECTION_RECOVERY_MIN_INTERVAL,max_interval:$h.CONNECTION_RECOVERY_MAX_INTERVAL}},Qh=p(function e(t){var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:Xh.recovery_options;l(this,e),Jh.debug("new()"),this.status=Xh.STATUS_DISCONNECTED,this.socket=null,this.sockets=[],this.recovery_options=r,this.recover_attempts=0,this.recovery_timer=null,this.close_requested=!1;try{this.textDecoder=new TextDecoder("utf8")}catch(e){Jh.warn("cannot use TextDecoder: ".concat(e))}if(void 0===t)throw new TypeError("Invalid argument. undefined 'sockets' argument");(t=t instanceof Array?t:[t]).forEach(function(e){if(!Wh.isSocket(e.socket))throw new TypeError("Invalid argument. invalid 'JsSIP.Socket' instance");if(e.weight&&!Number(e.weight))throw new TypeError("Invalid argument. 'weight' attribute is not a number");this.sockets.push({socket:e.socket,weight:e.weight||0,status:Xh.SOCKET_STATUS_READY})},this),this._getSocket()},[{key:"via_transport",get:function(){return this.socket.via_transport}},{key:"url",get:function(){return this.socket.url}},{key:"sip_uri",get:function(){return this.socket.sip_uri}},{key:"connect",value:function(){Jh.debug("connect()"),this.isConnected()?Jh.debug("Transport is already connected"):this.isConnecting()?Jh.debug("Transport is connecting"):(this.close_requested=!1,this.status=Xh.STATUS_CONNECTING,this.onconnecting({socket:this.socket,attempts:this.recover_attempts}),this.close_requested||(this.socket.onconnect=this._onConnect.bind(this),this.socket.ondisconnect=this._onDisconnect.bind(this),this.socket.ondata=this._onData.bind(this),this.socket.connect()))}},{key:"disconnect",value:function(){Jh.debug("close()"),this.close_requested=!0,this.recover_attempts=0,this.status=Xh.STATUS_DISCONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.socket.onconnect=function(){},this.socket.ondisconnect=function(){},this.socket.ondata=function(){},this.socket.disconnect(),this.ondisconnect({socket:this.socket,error:!1})}},{key:"send",value:function(e){return Jh.debug("send()"),this.isConnected()?(e=e.toString(),Jh.debug("sending message:\n\n".concat(e,"\n")),this.socket.send(e)):(Jh.warn("unable to send message, transport is not connected"),!1)}},{key:"isConnected",value:function(){return this.status===Xh.STATUS_CONNECTED}},{key:"isConnecting",value:function(){return this.status===Xh.STATUS_CONNECTING}},{key:"_reconnect",value:function(){var e=this,t=(this.recover_attempts+=1,Math.floor(Math.random()*Math.pow(2,this.recover_attempts)+1));t<this.recovery_options.min_interval?t=this.recovery_options.min_interval:t>this.recovery_options.max_interval&&(t=this.recovery_options.max_interval),Jh.debug("reconnection attempt: ".concat(this.recover_attempts,". next connection attempt in ").concat(t," seconds")),this.recovery_timer=setTimeout(function(){e.close_requested||e.isConnected()||e.isConnecting()||(e._getSocket(),e.connect())},1e3*t)}},{key:"_getSocket",value:function(){var e,t=[];this.sockets.forEach(function(e){e.status!==Xh.SOCKET_STATUS_ERROR&&(0===t.length?t.push(e):e.weight>t[0].weight?t=[e]:e.weight===t[0].weight&&t.push(e))}),0===t.length?(this.sockets.forEach(function(e){e.status=Xh.SOCKET_STATUS_READY}),this._getSocket()):(e=Math.floor(Math.random()*t.length),this.socket=t[e].socket)}},{key:"_onConnect",value:function(){this.recover_attempts=0,this.status=Xh.STATUS_CONNECTED,null!==this.recovery_timer&&(clearTimeout(this.recovery_timer),this.recovery_timer=null),this.onconnect({socket:this})}},{key:"_onDisconnect",value:function(e,t,r){this.status=Xh.STATUS_DISCONNECTED,this.ondisconnect({socket:this.socket,error:e,code:t,reason:r}),this.close_requested||(this.sockets.forEach(function(e){this.socket===e.socket&&(e.status=Xh.SOCKET_STATUS_ERROR)},this),this._reconnect(e))}},{key:"_onData",value:function(e){if("\r\n"!==e){if("string"!=typeof e){try{e=this.textDecoder?this.textDecoder.decode(e):String.fromCharCode.apply(null,new Uint8Array(e))}catch(e){return void Jh.debug("received binary message failed to be converted into string, message discarded")}Jh.debug("received binary message:\n\n".concat(e,"\n"))}else Jh.debug("received text message:\n\n".concat(e,"\n"));this.ondata({transport:this,message:e})}else Jh.debug("received message with CRLF Keep Alive response")}}]),Zh={},ef=Wl,tf=V(),rf=vc,nf=new ef("Parser");function of(e,t){var r,n=t,o=0;if(e.substring(n,n+2).match(/(^\r\n)/))return-2;for(;0===o;){if(-1===(r=e.indexOf("\r\n",n)))return r;!e.substring(r+2,r+4).match(/(^\r\n)/)&&e.charAt(r+2).match(/(^\s+)/)?n=r+2:o=r}return o}function sf(e,t,r,n){var o,s=t.indexOf(":",r),i=t.substring(r,s).trim(),a=t.substring(s+1,n).trim();switch(i.toLowerCase()){case"via":case"v":e.addHeader("via",a),1===e.getHeaders("via").length?(o=e.parseHeader("Via"))&&(e.via=o,e.via_branch=o.branch):o=0;break;case"from":case"f":e.setHeader("from",a),(o=e.parseHeader("from"))&&(e.from=o,e.from_tag=o.getParam("tag"));break;case"to":case"t":e.setHeader("to",a),(o=e.parseHeader("to"))&&(e.to=o,e.to_tag=o.getParam("tag"));break;case"record-route":if(-1===(o=tf.parse(a,"Record_Route")))o=void 0;else{var u,l=d(o);try{for(l.s();!(u=l.n()).done;){var c=u.value;e.addHeader("record-route",a.substring(c.possition,c.offset)),e.headers["Record-Route"][e.getHeaders("record-route").length-1].parsed=c.parsed}}catch(e){l.e(e)}finally{l.f()}}break;case"call-id":case"i":e.setHeader("call-id",a),(o=e.parseHeader("call-id"))&&(e.call_id=a);break;case"contact":case"m":if(-1===(o=tf.parse(a,"Contact")))o=void 0;else{var p,h=d(o);try{for(h.s();!(p=h.n()).done;){var f=p.value;e.addHeader("contact",a.substring(f.possition,f.offset)),e.headers.Contact[e.getHeaders("contact").length-1].parsed=f.parsed}}catch(e){h.e(e)}finally{h.f()}}break;case"content-length":case"l":e.setHeader("content-length",a),o=e.parseHeader("content-length");break;case"content-type":case"c":e.setHeader("content-type",a),o=e.parseHeader("content-type");break;case"cseq":e.setHeader("cseq",a),(o=e.parseHeader("cseq"))&&(e.cseq=o.value),e instanceof rf.IncomingResponse&&(e.method=o.method);break;case"max-forwards":e.setHeader("max-forwards",a),o=e.parseHeader("max-forwards");break;case"www-authenticate":e.setHeader("www-authenticate",a),o=e.parseHeader("www-authenticate");break;case"proxy-authenticate":e.setHeader("proxy-authenticate",a),o=e.parseHeader("proxy-authenticate");break;case"session-expires":case"x":e.setHeader("session-expires",a),(o=e.parseHeader("session-expires"))&&(e.session_expires=o.expires,e.session_expires_refresher=o.refresher);break;case"refer-to":case"r":e.setHeader("refer-to",a),(o=e.parseHeader("refer-to"))&&(e.refer_to=o);break;case"replaces":e.setHeader("replaces",a),(o=e.parseHeader("replaces"))&&(e.replaces=o);break;case"event":case"o":e.setHeader("event",a),(o=e.parseHeader("event"))&&(e.event=o);break;default:e.addHeader(i,a),o=0}return void 0!==o||{error:'error parsing header "'.concat(i,'"')}}Zh.parseMessage=function(e,t){var r,n,o=e.indexOf("\r\n");if(-1!==o){var s=e.substring(0,o),i=tf.parse(s,"Request_Response");if(-1!==i){i.status_code?((r=new rf.IncomingResponse).status_code=i.status_code,r.reason_phrase=i.reason_phrase):((r=new rf.IncomingRequest(t)).method=i.method,r.ruri=i.uri),r.data=e;for(var a=o+2;;){if(-2===(o=of(e,a))){n=a+2;break}if(-1===o)return void nf.warn("parseMessage() | malformed message");if(!0!==(i=sf(r,e,a,o)))return void nf.warn("parseMessage() |",i.error);a=o+2}return r.hasHeader("content-length")?(t=r.getHeader("content-length"),r.body=e.substr(n,t)):r.body=e.substring(n),r}nf.warn('parseMessage() | error parsing first line of SIP message: "'.concat(s,'"'))}else nf.warn("parseMessage() | no CRLF found, not a SIP message")};var af,uf,lf,cf=Wl,pf=s,df=vc,hf=F(),ff=new cf("sanityCheck"),mf=[function(){for(var e=0,t=["from","to","call_id","cseq","via"];e<t.length;e++){var r=t[e];if(!af.hasHeader(r))return ff.debug("missing mandatory header field : ".concat(r,", dropping the response")),!1}}],gf=[function(){if("sip"!==af.s("to").uri.scheme)return _f(416),!1},function(){if(!af.to_tag&&af.call_id.substr(0,5)===uf.configuration.jssip_id)return _f(482),!1},function(){if(hf.str_utf8_length(af.body)<af.getHeader("content-length"))return _f(400),!1},function(){var e,t=af.from_tag,r=af.call_id,n=af.cseq;if(!af.to_tag)if(af.method===pf.INVITE){if(uf._transactions.ist[af.via_branch])return!1;for(var o in uf._transactions.ist)if(Object.prototype.hasOwnProperty.call(uf._transactions.ist,o)&&(e=uf._transactions.ist[o]).request.from_tag===t&&e.request.call_id===r&&e.request.cseq===n)return _f(482),!1}else{if(uf._transactions.nist[af.via_branch])return!1;for(var s in uf._transactions.nist)if(Object.prototype.hasOwnProperty.call(uf._transactions.nist,s)&&(e=uf._transactions.nist[s]).request.from_tag===t&&e.request.call_id===r&&e.request.cseq===n)return _f(482),!1}}],yf=[function(){if(1<af.getHeaders("via").length)return ff.debug("more than one Via header field present in the response, dropping the response"),!1},function(){if(hf.str_utf8_length(af.body)<af.getHeader("content-length"))return ff.debug("message body length is lower than the value in Content-Length header field, dropping the response"),!1}];function _f(e){var t,r=af.getHeaders("via"),n="SIP/2.0 ".concat(e," ").concat(pf.REASON_PHRASE[e],"\r\n"),o=d(r);try{for(o.s();!(t=o.n()).done;)n+="Via: ".concat(t.value,"\r\n")}catch(e){o.e(e)}finally{o.f()}r=af.getHeader("To"),af.to_tag||(r+=";tag=".concat(hf.newTag())),n=(n=(n=(n+="To: ".concat(r,"\r\n"))+"From: ".concat(af.getHeader("From"),"\r\n"))+"Call-ID: ".concat(af.call_id,"\r\n"))+"CSeq: ".concat(af.cseq," ").concat(af.method,"\r\n"),lf.send(n+="\r\n")}var vf={},bf=F(),Sf=s,Tf=V(),wf=B(),Ef=Hh,Af=j,Of=Wl,xf=(vf.settings={authorization_user:null,password:null,realm:null,ha1:null,authorization_jwt:null,display_name:null,uri:null,contact_uri:null,instance_id:null,use_preloaded_route:!1,session_timers:!0,session_timers_refresh_method:Sf.UPDATE,session_timers_force_refresher:!1,no_answer_timeout:60,register:!0,register_expires:600,registrar_server:null,sockets:null,connection_recovery_max_interval:Sf.CONNECTION_RECOVERY_MAX_INTERVAL,connection_recovery_min_interval:Sf.CONNECTION_RECOVERY_MIN_INTERVAL,extra_headers:null,via_host:"".concat(bf.createRandomToken(12),".invalid"),log_level:Sf.LOG_LEVEL.TRACE,log_report:!0,log_proxy:null,use_trtc:!0,trtc_proxy_server:null,trtc_turn_server:null},{mandatory:{sockets:function(e){var t=[];if(Ef.isSocket(e))t.push({socket:e});else{if(!Array.isArray(e)||!e.length)return;var r,n=d(e);try{for(n.s();!(r=n.n()).done;){var o=r.value;Object.prototype.hasOwnProperty.call(o,"socket")&&Ef.isSocket(o.socket)?t.push(o):Ef.isSocket(o)&&t.push({socket:o})}}catch(e){n.e(e)}finally{n.f()}}return t},uri:function(e){/^sip:/i.test(e)||(e="".concat(Sf.SIP,":").concat(e));e=wf.parse(e);return e&&e.user?e:void 0}},optional:{authorization_user:function(e){return-1===Tf.parse('"'.concat(e,'"'),"quoted_string")?void 0:e},authorization_jwt:function(e){if("string"==typeof e)return e},user_agent:function(e){if("string"==typeof e)return e},connection_recovery_max_interval:function(e){if(bf.isDecimal(e)){e=Number(e);if(0<e)return e}},connection_recovery_min_interval:function(e){if(bf.isDecimal(e)){e=Number(e);if(0<e)return e}},contact_uri:function(e){if("string"==typeof e){e=Tf.parse(e,"SIP_URI");if(-1!==e)return e}},display_name:function(e){return e},instance_id:function(e){return/^uuid:/i.test(e)&&(e=e.substr(5)),-1===Tf.parse(e,"uuid")?void 0:e},no_answer_timeout:function(e){if(bf.isDecimal(e)){e=Number(e);if(0<e)return e}},session_timers:function(e){if("boolean"==typeof e)return e},session_timers_refresh_method:function(e){if("string"==typeof e&&((e=e.toUpperCase())===Sf.INVITE||e===Sf.UPDATE))return e},session_timers_force_refresher:function(e){if("boolean"==typeof e)return e},password:function(e){return String(e)},realm:function(e){return String(e)},ha1:function(e){return String(e)},register:function(e){if("boolean"==typeof e)return e},register_expires:function(e){if(bf.isDecimal(e)){e=Number(e);if(0<e)return e}},registrar_server:function(e){/^sip:/i.test(e)||(e="".concat(Sf.SIP,":").concat(e));e=wf.parse(e);return!e||e.user?void 0:e},use_preloaded_route:function(e){if("boolean"==typeof e)return e},extra_headers:function(e){var t=[];if(Array.isArray(e)&&e.length){var r,n=d(e);try{for(n.s();!(r=n.n()).done;){var o=r.value;"string"==typeof o&&t.push(o)}}catch(e){n.e(e)}finally{n.f()}return t}},log_level:function(e){return bf.isDecimal(e)&&-1!==Object.values(Sf.LOG_LEVEL).indexOf(Number(e))?(Of.setLogLevel(Number(e)),e):(Of.setLogLevel(Sf.LOG_LEVEL.TRACE),Sf.LOG_LEVEL.TRACE)},log_report:function(e){return"boolean"==typeof e?(Of.setLogReport(e),e):(Of.setLogReport(!0),!0)},log_proxy:function(e){return Of.setLogProxy(e),e},use_trtc:function(e){if("boolean"==typeof e)return e},trtc_proxy_server:function(e){return e},trtc_turn_server:function(e){return e}}}),Cf=(vf.load=function(e,t){for(var r in xf.mandatory){if(!t.hasOwnProperty(r))throw new Af.ConfigurationError(r);var n=t[r],o=xf.mandatory[r](n);if(void 0===o)throw new Af.ConfigurationError(r,n);e[r]=o}for(var s in xf.optional)if(t.hasOwnProperty(s)){var i=t[s];if(bf.isEmpty(i))continue;var a=xf.optional[s](i);if(void 0===a)throw new Af.ConfigurationError(s,i);e[s]=a}},$.EventEmitter),Rf=Wl,Nf=s,If=tp,Pf=wh,Uf=Uh,kf=qh,Lf=qc,jf=Qh,Df=F(),Mf=j,Vf=B(),Bf=Zh,Ff=vc,qf=function(e,t,r){af=e,uf=t,lf=r;for(var n=0,o=mf;n<o.length;n++)if(!1===(0,o[n])())return!1;if(af instanceof df.IncomingRequest){for(var s=0,i=gf;s<i.length;s++)if(!1===(0,i[s])())return!1}else if(af instanceof df.IncomingResponse)for(var a=0,u=yf;a<u.length;a++)if(!1===(0,u[a])())return!1;return!0},Hf=vf,Gf=o,zf=new Rf("UA"),Kf={STATUS_INIT:0,STATUS_READY:1,STATUS_USER_CLOSED:2,STATUS_NOT_READY:3,CONFIGURATION_ERROR:1,NETWORK_ERROR:2},Yf=(()=>{function r(e){var t;if(l(this,r),zf.debug("".concat(Gf.version," new() [configuration:%o]"),e),(t=u(this,r))._cache={credentials:{}},t._configuration=Object.assign({},Hf.settings),t._dynConfiguration={},t._dialogs={},t._applicants={},t._sessions={},t._transport=null,t._contact=null,t._status=Kf.STATUS_INIT,t._error=null,t._transactions={nist:{},nict:{},ist:{},ict:{}},t._data={},t._closeTimer=null,void 0===e)throw new TypeError("Not enough arguments");try{t._loadConfig(e)}catch(e){throw t._status=Kf.STATUS_NOT_READY,t._error=Kf.CONFIGURATION_ERROR,e}return t._registrator=new If(t),t}return m(r,Cf),p(r,[{key:"C",get:function(){return Kf}},{key:"status",get:function(){return this._status}},{key:"contact",get:function(){return this._contact}},{key:"configuration",get:function(){return this._configuration}},{key:"transport",get:function(){return this._transport}},{key:"start",value:function(){zf.debug("start()",{}),this._status===Kf.STATUS_INIT?this._transport.connect():this._status===Kf.STATUS_USER_CLOSED?(zf.debug("restarting UA"),null!==this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null,this._transport.disconnect()),this._status=Kf.STATUS_INIT,this._transport.connect()):this._status===Kf.STATUS_READY?zf.debug("UA is in READY status, not restarted"):zf.debug("ERROR: connection is down, Auto-Recovery system is trying to reconnect"),this._dynConfiguration.register=this._configuration.register}},{key:"register",value:function(){zf.debug("register()"),this._dynConfiguration.register=!0,this._registrator.register()}},{key:"unregister",value:function(e){zf.debug("unregister()"),this._dynConfiguration.register=!1,this._registrator.unregister(e)}},{key:"registrator",value:function(){return this._registrator}},{key:"isRegistered",value:function(){return this._registrator.registered}},{key:"isConnected",value:function(){return this._transport.isConnected()}},{key:"call",value:function(e,t){zf.debug("call()");var r=new Pf(this);return r.connect(e,t),r}},{key:"sendMessage",value:function(e,t,r){zf.debug("sendMessage()");var n=new Uf(this);return n.send(e,t,r),n}},{key:"sendOptions",value:function(e,t,r){zf.debug("sendOptions()");var n=new kf(this);return n.send(e,t,r),n}},{key:"terminateSessions",value:function(e){for(var t in zf.debug("terminateSessions()"),this._sessions)this._sessions[t].isEnded()||this._sessions[t].terminate(e)}},{key:"stop",value:function(){var e=this;if(zf.debug("stop()"),this._dynConfiguration={},this._status!==Kf.STATUS_USER_CLOSED){this._registrator.close();var t,r,n=Object.keys(this._sessions).length;for(t in this._sessions)if(Object.prototype.hasOwnProperty.call(this._sessions,t)){zf.debug("closing session ".concat(t));try{this._sessions[t].terminate()}catch(e){}}for(r in this._applicants)if(Object.prototype.hasOwnProperty.call(this._applicants,r))try{this._applicants[r].close()}catch(e){}this._status=Kf.STATUS_USER_CLOSED,0===Object.keys(this._transactions.nict).length+Object.keys(this._transactions.nist).length+Object.keys(this._transactions.ict).length+Object.keys(this._transactions.ist).length&&0===n?this._transport.disconnect():this._closeTimer=setTimeout(function(){e._closeTimer=null,e._transport.disconnect()},2e3)}else zf.debug("UA already closed")}},{key:"normalizeTarget",value:function(e){return Df.normalizeTarget(e,this._configuration.hostport_params)}},{key:"get",value:function(e){switch(e){case"authorization_user":return this._configuration.authorization_user;case"realm":return this._configuration.realm;case"ha1":return this._configuration.ha1;case"authorization_jwt":return this._configuration.authorization_jwt;default:return void zf.warn('get() | cannot get "%s" parameter in runtime',e)}}},{key:"set",value:function(e,t){switch(e){case"authorization_user":this._configuration.authorization_user=String(t);break;case"password":this._configuration.password=String(t);break;case"realm":this._configuration.realm=String(t);break;case"ha1":this._configuration.ha1=String(t),this._configuration.password=null;break;case"authorization_jwt":this._configuration.authorization_jwt=String(t);break;case"display_name":this._configuration.display_name=t;break;case"log_level":Df.isDecimal(t)&&-1!==Object.values(Nf.LOG_LEVEL).indexOf(Number(t))&&Rf.setLogLevel(t);break;case"log_report":Rf.setLogReport(Boolean(t));break;case"log_proxy":Rf.setLogProxy(t);break;case"trtc_proxy_server":case"trtc_turn_server":this._configuration[e]=t;break;default:return zf.warn('set() | cannot set "%s" parameter in runtime',e),!1}return!0}},{key:"newTransaction",value:function(e){this._transactions[e.type][e.id]=e,this.emit("newTransaction",{transaction:e})}},{key:"destroyTransaction",value:function(e){delete this._transactions[e.type][e.id],this.emit("transactionDestroyed",{transaction:e})}},{key:"newDialog",value:function(e){this._dialogs[e.id]=e}},{key:"destroyDialog",value:function(e){delete this._dialogs[e.id]}},{key:"newMessage",value:function(e,t){this._applicants[e]=e,this.emit("newMessage",t)}},{key:"newOptions",value:function(e,t){this._applicants[e]=e,this.emit("newOptions",t)}},{key:"destroyMessage",value:function(e){delete this._applicants[e]}},{key:"newRTCSession",value:function(e,t){this._sessions[e.id]=e,this.emit("newRTCSession",t)}},{key:"destroyRTCSession",value:function(e){delete this._sessions[e.id]}},{key:"registered",value:function(e){this.emit("registered",e)}},{key:"unregistered",value:function(e){this.emit("unregistered",e)}},{key:"registrationFailed",value:function(e){this.emit("registrationFailed",e)}},{key:"receiveRequest",value:function(e){var t,r,n,o=e.method;if(e.ruri.user!==this._configuration.uri.user&&e.ruri.user!==this._contact.uri.user)zf.debug("Request-URI does not point to us"),e.method!==Nf.ACK&&e.reply_sl(404);else if(e.ruri.scheme!==Nf.SIPS){if(!Lf.checkTransaction(this,e)){if(o===Nf.INVITE?new Lf.InviteServerTransaction(this,this._transport,e):o!==Nf.ACK&&o!==Nf.CANCEL&&new Lf.NonInviteServerTransaction(this,this._transport,e),o===Nf.OPTIONS){if(0===this.listeners("newOptions").length)return void e.reply(200);new kf(this).init_incoming(e)}else if(o===Nf.MESSAGE){if(0===this.listeners("newMessage").length)return void e.reply(405);new Uf(this).init_incoming(e)}else if(o===Nf.INVITE&&!e.to_tag&&0===this.listeners("newRTCSession").length)return void e.reply(405);if(e.to_tag)(t=this._findDialog(e.call_id,e.from_tag,e.to_tag))?t.receiveRequest(e):o===Nf.NOTIFY?(r=this._findSession(e))?r.receiveRequest(e):(zf.debug("received NOTIFY request for a non existent subscription"),e.reply(481,"Subscription does not exist")):o!==Nf.ACK&&e.reply(481);else switch(o){case Nf.INVITE:window.RTCPeerConnection?e.hasHeader("replaces")?(n=e.replaces,(t=this._findDialog(n.call_id,n.from_tag,n.to_tag))?(r=t.owner).isEnded()?e.reply(603):r.receiveRequest(e):e.reply(481)):(r=new Pf(this)).init_incoming(e):(zf.warn("INVITE received but WebRTC is not supported"),e.reply(488));break;case Nf.BYE:e.reply(481);break;case Nf.CANCEL:(r=this._findSession(e))?r.receiveRequest(e):zf.debug("received CANCEL request for a non existent session");break;case Nf.ACK:break;case Nf.NOTIFY:this.emit("sipEvent",{event:e.event,request:e}),e.reply(200);break;default:e.reply(405)}}}else e.reply_sl(416)}},{key:"_findSession",value:function(e){var t=e.call_id,r=this._sessions[t+e.from_tag],t=this._sessions[t+e.to_tag];return r||t||null}},{key:"_findDialog",value:function(e,t,r){var n=this._dialogs[e+t+r];return n||this._dialogs[e+r+t]||null}},{key:"_loadConfig",value:function(e){try{Hf.load(this._configuration,e),Rf.setAttributes({uri:this._configuration.uri.toString()})}catch(r){throw zf.error("config load: %o",e,r),r}0===this._configuration.display_name&&(this._configuration.display_name="0"),this._configuration.instance_id||(this._configuration.instance_id=Df.newUUID()),this._configuration.jssip_id=Df.createRandomToken(5);var t,r=this._configuration.uri.clone();r.user=null,this._configuration.hostport_params=r.toString().replace(/^sip:/i,"");try{this._transport=new jf(this._configuration.sockets,{max_interval:this._configuration.connection_recovery_max_interval,min_interval:this._configuration.connection_recovery_min_interval}),this._transport.onconnecting=Wf.bind(this),this._transport.onconnect=$f.bind(this),this._transport.ondisconnect=Jf.bind(this),this._transport.ondata=Xf.bind(this)}catch(e){throw zf.warn(e),new Mf.ConfigurationError("sockets",this._configuration.sockets)}delete this._configuration.sockets,this._configuration.authorization_user||(this._configuration.authorization_user=this._configuration.uri.user),this._configuration.registrar_server||((t=this._configuration.uri.clone()).user=null,t.clearParams(),t.clearHeaders(),this._configuration.registrar_server=t),this._configuration.no_answer_timeout*=1e3,this._configuration.contact_uri?this._configuration.via_host=this._configuration.contact_uri.host:this._configuration.contact_uri=new Vf("sip",Df.createRandomToken(8),this._configuration.via_host,null,{transport:"ws"});var n,o,s=this._configuration.use_trtc,i=(this._contact={pub_gruu:null,temp_gruu:null,uri:this._configuration.contact_uri,toString:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=e.anonymous||null,e=e.outbound||null,r="<";return r+=t?this.temp_gruu||"sip:anonymous@anonymous.invalid;transport=ws":this.pub_gruu||this.uri.toString(),!e||(t?this.temp_gruu:this.pub_gruu)||(r+=";ob"),s&&(r+=";trtc"),r+">"}},["authorization_user","password","realm","ha1","authorization_jwt","display_name","register","log_level","log_report","log_proxy","use_trtc","trtc_proxy_server","trtc_turn_server"]);for(n in this._configuration)Object.prototype.hasOwnProperty.call(this._configuration,n)&&(-1!==i.indexOf(n)?Object.defineProperty(this._configuration,n,{writable:!0,configurable:!1}):Object.defineProperty(this._configuration,n,{writable:!1,configurable:!1}));for(o in zf.debug("configuration parameters after validation:"),this._configuration)if(Object.prototype.hasOwnProperty.call(Hf.settings,o))switch(o){case"uri":case"registrar_server":zf.debug("- ".concat(o,": ").concat(this._configuration[o]));break;case"password":case"ha1":case"authorization_jwt":zf.debug("- ".concat(o,": NOT SHOWN"));break;default:zf.debug("- ".concat(o,": ").concat(JSON.stringify(this._configuration[o])))}}}],[{key:"C",get:function(){return Kf}}])})();function Wf(e){this.emit("connecting",e)}function $f(e){this._status!==Kf.STATUS_USER_CLOSED&&(this._status=Kf.STATUS_READY,this._error=null,this.emit("connected",e),this._dynConfiguration.register)&&this._registrator.register()}function Jf(e){for(var t=0,r=["nict","ict","nist","ist"];t<r.length;t++){var n,o=r[t];for(n in this._transactions[o])Object.prototype.hasOwnProperty.call(this._transactions[o],n)&&this._transactions[o][n].onTransportError()}this.emit("disconnected",e),this._registrator.onTransportClosed(),this._status!==Kf.STATUS_USER_CLOSED&&(this._status=Kf.STATUS_NOT_READY,this._error=Kf.NETWORK_ERROR)}function Xf(e){var t,r=e.transport,n=e.message;if((n=Bf.parseMessage(n,this))&&!(this._status===Kf.STATUS_USER_CLOSED&&n instanceof Ff.IncomingRequest)&&qf(n,this,r))if(n instanceof Ff.IncomingRequest)n.transport=r,this.receiveRequest(n);else if(n instanceof Ff.IncomingResponse)switch(n.method){case Nf.INVITE:(t=this._transactions.ict[n.via_branch])&&t.receiveResponse(n);break;case Nf.ACK:break;default:(t=this._transactions.nict[n.via_branch])&&t.receiveResponse(n)}}var Qf=Wl,Zf=V(),em=new Qf("WebSocketInterface"),tm=p(function e(t){l(this,e),em.debug('new() [url:"%s"]',t),this._url=t,this._sip_uri=null,this._via_transport=null,this._ws=null;var r=Zf.parse(t,"absoluteURI");if(-1===r)throw em.warn("invalid WebSocket URI: ".concat(t)),new TypeError("Invalid argument: ".concat(t));if("wss"!==r.scheme&&"ws"!==r.scheme)throw em.warn("invalid WebSocket URI scheme: ".concat(r.scheme)),new TypeError("Invalid argument: ".concat(t));this._sip_uri="sip:".concat(r.host).concat(r.port?":".concat(r.port):"",";transport=ws"),this._via_transport=r.scheme.toUpperCase()},[{key:"via_transport",get:function(){return this._via_transport},set:function(e){this._via_transport=e.toUpperCase()}},{key:"sip_uri",get:function(){return this._sip_uri}},{key:"url",get:function(){return this._url}},{key:"connect",value:function(){if(em.debug("connect()"),this.isConnected())em.debug("WebSocket ".concat(this._url," is already connected"));else if(this.isConnecting())em.debug("WebSocket ".concat(this._url," is connecting"));else{this._ws&&this.disconnect(),em.debug("connecting to WebSocket ".concat(this._url));try{this._ws=new WebSocket(this._url,"sip"),this._ws.binaryType="arraybuffer",this._ws.onopen=this._onOpen.bind(this),this._ws.onclose=this._onClose.bind(this),this._ws.onmessage=this._onMessage.bind(this),this._ws.onerror=this._onError.bind(this)}catch(e){this._onError(e)}}}},{key:"disconnect",value:function(){em.debug("disconnect()"),this._ws&&(this._ws.onopen=function(){},this._ws.onclose=function(){},this._ws.onmessage=function(){},this._ws.onerror=function(){},this._ws.close(),this._ws=null)}},{key:"send",value:function(e){return em.debug("send()"),this.isConnected()?(this._ws.send(e),!0):(em.warn("unable to send message, WebSocket is not open"),!1)}},{key:"isConnected",value:function(){return this._ws&&this._ws.readyState===this._ws.OPEN}},{key:"isConnecting",value:function(){return this._ws&&this._ws.readyState===this._ws.CONNECTING}},{key:"_onOpen",value:function(){em.debug("WebSocket ".concat(this._url," connected")),this.onconnect()}},{key:"_onClose",value:function(e){var t=e.wasClean,r=e.code,e=e.reason;em.debug("WebSocket ".concat(this._url," closed")),!1===t&&em.debug("WebSocket abrupt disconnection"),this.ondisconnect(!t,r,e)}},{key:"_onMessage",value:function(e){e=e.data;em.debug("received WebSocket message"),this.ondata(e)}},{key:"_onError",value:function(e){em.warn("WebSocket ".concat(this._url," error: "),e)}}]),rm=Wl;V(),new rm("WxWebsocketInterface");var nm,om,im={exports:{}};function sm(){if(om)return nm;om=1;var o=1e3,s=60*o,i=60*s,a=24*i,u=7*a,l=365.25*a;function c(e,t,r,n){t=1.5*r<=t;return Math.round(e/r)+" "+n+(t?"s":"")}return nm=function(e,t){t=t||{};var r=typeof e;if(!("string"==r&&0<e.length)){if("number"==r&&isFinite(e))return t.long?(r=e,t=Math.abs(r),a<=t?c(r,t,a,"day"):i<=t?c(r,t,i,"hour"):s<=t?c(r,t,s,"minute"):o<=t?c(r,t,o,"second"):r+" ms"):(t=e,r=Math.abs(t),a<=r?Math.round(t/a)+"d":i<=r?Math.round(t/i)+"h":s<=r?Math.round(t/s)+"m":o<=r?Math.round(t/o)+"s":t+"ms");throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}r=e;if(!(100<(r=String(r)).length)){r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(r){var n=parseFloat(r[1]);switch((r[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"weeks":case"week":case"w":return n*u;case"days":case"day":case"d":return n*a;case"hours":case"hour":case"hrs":case"hr":case"h":return n*i;case"minutes":case"minute":case"mins":case"min":case"m":return n*s;case"seconds":case"second":case"secs":case"sec":case"s":return n*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}}var am=function(t){function a(e){let r,t,n,o=null;function i(...s){if(i.enabled){let n=i,e=Number(new Date),t=e-(r||e),o=(n.diff=t,n.prev=r,n.curr=e,r=e,s[0]=a.coerce(s[0]),"string"!=typeof s[0]&&s.unshift("%O"),0);s[0]=s[0].replace(/%([a-zA-Z%])/g,(t,r)=>{if("%%"===t)return"%";o++;r=a.formatters[r];if("function"==typeof r){let e=s[o];t=r.call(n,e),s.splice(o,1),o--}return t}),a.formatArgs.call(n,s),(n.log||a.log).apply(n,s)}}return i.namespace=e,i.useColors=a.useColors(),i.color=a.selectColor(e),i.extend=s,i.destroy=a.destroy,Object.defineProperty(i,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(t!==a.namespaces&&(t=a.namespaces,n=a.enabled(e)),n),set:e=>{o=e}}),"function"==typeof a.init&&a.init(i),i}function s(e,t){t=a(this.namespace+(void 0===t?":":t)+e);return t.log=this.log,t}function n(e,t){let r=0,n=0,o=-1,s=0;for(;r<e.length;)if(n<t.length&&(t[n]===e[r]||"*"===t[n]))"*"===t[n]?(o=n,s=r):r++,n++;else{if(-1===o)return;n=o+1,s++,r=s}for(;n<t.length&&"*"===t[n];)n++;return n===t.length}return((a.debug=a).default=a).coerce=function(e){return e instanceof Error?e.stack||e.message:e},a.disable=function(){var e=[...a.names,...a.skips.map(e=>"-"+e)].join(",");return a.enable(""),e},a.enable=function(e){a.save(e),a.namespaces=e,a.names=[],a.skips=[];var t=("string"==typeof e?e:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let e of t)"-"===e[0]?a.skips.push(e.slice(1)):a.names.push(e)},a.enabled=function(e){for(var t of a.skips)if(n(e,t))return!1;for(var r of a.names)if(n(e,r))return!0;return!1},a.humanize=sm(),a.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach(e=>{a[e]=t[e]}),a.names=[],a.skips=[],a.formatters={},a.selectColor=function(t){let r=0;for(let e=0;e<t.length;e++)r=(r<<5)-r+t.charCodeAt(e),r|=0;return a.colors[Math.abs(r)%a.colors.length]},a.enable(a.load()),a},um=(((t,r)=>{r.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),this.useColors){var n="color: "+this.color;e.splice(1,0,n,"color: inherit");let t=0,r=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(t++,"%c"===e)&&(r=t)}),e.splice(r,0,n)}},r.save=function(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}},r.load=function(){let e;try{e=r.storage.getItem("debug")||r.storage.getItem("DEBUG")}catch(e){}return e=!e&&"env"in vt?vt.env.DEBUG:e},r.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&31<=parseInt(e[1],10)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},r.storage=(()=>{try{return localStorage}catch(e){}})(),r.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],r.log=console.debug||console.log||(()=>{}),t.exports=am(r),t.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}})(im,im.exports),{}),lm=xl.exports,cm=(um.getMicrophones=lm.getMicrophones,um.getSpeakers=lm.getSpeakers,um.getDevices=lm.getDevices,o),pm=s,dm=j,hm=F(),fm=Yf,mm=B(),gm=M(),ym=V(),_m=tm,vm=um,bm=Wl,Sm=(im.exports(cm.title)("version %s",cm.version),{C:pm,Exceptions:dm,Utils:hm,UA:fm,URI:mm,NameAddrHeader:gm,WebSocketInterface:_m,Grammar:ym,Devices:vm,Logger:bm,debug:im.exports,get name(){return cm.title},get version(){return cm.version}});exports.default=Sm;
|